repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
io7m/coreland-posix-ada | Ada | 302 | adb | with Ada.Command_Line;
with Ada.Text_IO;
with POSIX.Path;
procedure T_Pathrm is
Last_Index : Positive;
Path : constant String := Ada.Command_Line.Argument (1);
begin
Last_Index := POSIX.Path.Remove_Component (Path);
Ada.Text_IO.Put_Line (Path (Path'First .. Last_Index));
end T_Pathrm;
|
reznikmm/matreshka | Ada | 3,664 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Text_Sequence_Elements is
pragma Preelaborate;
type ODF_Text_Sequence is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Sequence_Access is
access all ODF_Text_Sequence'Class
with Storage_Size => 0;
end ODF.DOM.Text_Sequence_Elements;
|
docandrew/YOTROC | Ada | 42,725 | adb |
-- BNF(ish) grammar for our parser. Assume all production rules are
-- newline-terminated.
--
-- Reserved words: registers, "Define"
--
-- <comment> := ";", string
-- <label> := "@", {alphanum}
--
-- //Identifier must start with a letter, then any sequence of letters
-- // and numbers. Can not be a reserved word.
-- <identifier> := [alpha], {alphanum}
--
-- <directive> := "%", <dirname>, <identifier>, <real>
--
-- //For instructions:
-- //Our parser will just keep eating operands until we either get 3 or
-- //we reach LF or EOF. Later, during codegen, we will
-- // do semantic analysis to see if they make sense for the instruction.
-- <instruction> := <operator>, {<operand>} //up to 3 operands.
--
-- <operand> := <register> | <immediate> | <indirect> | <indexed>
-- <register> := ('R' | 'F'),natural | 'Z'
-- <immediate> := <integer> | <float> | <identifier>
-- <indirect> := '*',
-- <indexed> := '*(', <register>, '+', <natural>, ')'
--
-- <real> := <integer> | <natural>
-- <integer> := "0" | ['-'], <natural>
-- <natural> := {digit}
-- <float> := <integer>, '.', <natural>
--
--
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Containers.Hashed_Maps;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Ada.Strings.Hash;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with util; use util;
with vm; use vm;
package body assembler is
pos : Natural := 0;
-- Hashmap to store identifiers with their values
function Equivalent_Keys(Left : in Unbounded_String; Right : in Unbounded_String) return Boolean is
begin
return Left = Right;
end Equivalent_Keys;
function Hash_Func(Key : in Unbounded_String) return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Hash(Ada.Strings.Unbounded.To_String(Key));
end Hash_Func;
-- An identifier is just a variable representing some kind of constant (YOTROCReal).
package Identifier_Map is new Ada.Containers.Hashed_Maps(
Key_Type => Unbounded_String,
Element_Type => YOTROCReal,
Hash => Hash_Func,
Equivalent_Keys => Equivalent_Keys);
-- A label is just a name fixed at a certain line.
--package Label_Map is new Ada.Containers.Hashed_Maps(
-- Key_Type => Unbounded_String,
-- Element_Type => Natural,
-- Hash => Hash_Func,
-- Equivalent_Keys => Equivalent_Keys);
-- globals for identifiers and labels.
-- after a parse run, these need to be present for codegen.
identifiers : Identifier_Map.Map;
--labels : Label_Map.Map;
---------------------------------------------------------------------------
-- Procedures for debugging, printing contents of the label and identifier maps.
-- probably a nicer way to use generics here
---------------------------------------------------------------------------
--procedure printLabelEntry(position : Label_Map.Cursor) is
--begin
-- Ada.Text_IO.Put_Line(" Label: " & To_String(Label_Map.Key(position)) &
-- " Address: " & Natural'Image(Label_Map.Element(position)));
--end printLabelEntry;
procedure printIdentifierEntry(position : Identifier_Map.Cursor) is
element : YOTROCReal;
elemStr : Unbounded_String;
begin
element := Identifier_Map.Element(position);
if(element.kind = IntegerReal) then
elemStr := To_Unbounded_String(Integer'Image(Integer(element.realInt)));
else
elemStr := To_Unbounded_String(Float'Image(Float(element.realFloat)));
end if;
Ada.Text_IO.Put_Line(" Identifier: " & To_String(Identifier_Map.Key(position)) &
" Value: " & To_String(elemStr));
end printIdentifierEntry;
--procedure dumpLabels is
--begin
-- labels.Iterate(printLabelEntry'Access);
--end dumpLabels;
procedure dumpIdentifiers is
begin
identifiers.Iterate(printIdentifierEntry'Access);
end dumpIdentifiers;
---------------------------------------------------------------------------
-- parse a YOTROC .asm file
-- Param source - valid .asm file
-- Param out instructions - if successful in parsing, output a vector of
-- Instruction records
-- Param out msg - if unsuccessful, this will be a String containing the
-- error message and offending line.
--
-- We don't care if the operand types make sense for the instruction at this
-- point.
-- During codegen, we'll do semantic analysis to sanity-check them.
---------------------------------------------------------------------------
function parse(source : in String; instructions : out InstructionVector.Vector; msg : out Unbounded_String) return Boolean is
use ASCII;
-- to track where in the file we are for parsing
--nextChar : Character;
pos : Integer := 0;
-- track what line of file we are in for error messages
curLine : Integer := 1;
-- every instruction advances this by 8 bytes. We use this to keep track of what address
-- a label is at.
curAddress : Natural := 0;
-- Advance the cursor and return the char at this cursor
-- If we reach the EOF, return NUL
function getNext return Character is
begin
pos := pos + 1;
if pos > source'Last then
return NUL;
else
if source(pos) = LF then
curLine := curLine + 1;
end if;
--Ada.Text_IO.Put_Line(pos'Image & " " & source(pos));
return source(pos);
end if;
end getNext;
-- Look at the next character without advancing cursor
function peekNext return Character is
begin
if pos < source'Last then
return source(pos + 1);
else
return NUL;
end if;
end peekNext;
-- identify whitespace
function isWhite(c : Character) return Boolean is
begin
if c = ' ' or c = HT then
return True;
else
return False;
end if;
end isWhite;
-- identify the end of a word
function isWordEnd(c : Character) return Boolean is
begin
if isWhite(c) or c = ';' or c = ')' or c = '+' or c = NUL or c = LF then
return True;
else
return False;
end if;
end isWordEnd;
-- skip whitespace
procedure skipWhite is
ignore : Character;
begin
while isWhite(peekNext) loop
ignore := getNext;
end loop;
end skipWhite;
-- skip comment until end of line.
procedure skipComment is
ignore : Character;
begin
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Skipping Comment ");
while peekNext /= LF and then peekNext /= NUL loop
ignore := getNext;
Ada.Text_IO.Put(ignore);
end loop;
Ada.Text_IO.Put_Line("");
end skipComment;
-- determine whether this identifier is valid or not.
function isValidIdentifier(ubstr : Unbounded_String) return Boolean is
str : String := To_String(ubstr);
begin
if not Is_Letter(str(1)) then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Identifier must start with a letter");
return False;
end if;
for chr of str loop
if not (Is_Alphanumeric(chr) or chr = '_') then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Identifers can only contain letters, numbers or underscores.");
return False;
end if;
end loop;
return True;
end isValidIdentifier;
-- Get a single word, like "define" or "R12"
function getName(dir : out Unbounded_String) return Boolean is
chr : Character;
begin
while not isWordEnd(peekNext) loop
chr := getNext;
Append(dir, To_Lower(chr));
end loop;
return True;
end getName;
-- all identifiers must start with a letter and then be alpha-numeric or underscore
function getIdentifier(ident : out Identifier) return Boolean is
identStr : Unbounded_String;
--chr : Character;
success : Boolean;
begin
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Identifier: ");
success := getName(identStr);
if not isValidIdentifier(identStr) then
return False;
end if;
--TODO: check against list of reserved words?
Ada.Text_IO.Unbounded_IO.Put_Line(identStr);
ident := Identifier(identStr);
return True;
end getIdentifier;
-- parse a label. It works just like an identifier but using the label's
-- address instead of a predefined value.
function doLabel return Boolean is
labelValue : YOTROCReal;
identStr : Unbounded_String;
begin
-- read the label, if good, add it to the identifier hashmap with current address.
if not getIdentifier(identStr) then
return False;
else
-- TODO: check to make sure we aren't clobbering another identifier.
labelValue := (kind => IntegerReal, realInt => curAddress);
identifiers.Insert(Key => identStr, New_Item => labelValue);
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Label: ");
Ada.Text_IO.Unbounded_IO.Put(identStr);
Ada.Text_IO.Put_Line(" at address " & curAddress'Image);
return True;
end if;
end doLabel;
-- check to see if a word is a number or not.
function isReal(ubstr : in Unbounded_String; num : out YOTROCReal) return Boolean is
isFloat : Boolean := False;
str : String := To_String(ubstr);
numFloat : Float;
numInteger : Integer;
begin
-- first check to see if this is a float or not, so we know how to store it.
for c of str loop
if c = '.' then
isFloat := True;
end if;
end loop;
if isFloat then
numFloat := Float'Value(str);
num := (kind => FloatReal, realFloat => numFloat);
else
numInteger := Integer'Value(str);
num := (kind => IntegerReal, realInt => numInteger);
end if;
return True;
exception -- problem parsing the number.
when others =>
return False;
end isReal;
-- parse a real number
function getReal(num : out YOTROCReal) return Boolean is
--chr : Character;
asStr : Unbounded_String;
isFloat : Boolean := False;
--numInteger : Long_Integer;
--numFloat : Float;
begin
while not isWordEnd(peekNext) loop
Append(asStr, getNext);
end loop;
Ada.Text_IO.Put_Line("PARSE: Line" & curLine'Image & " Literal: " & To_String(asStr));
if not isReal(asStr, num) then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", invalid number literal " & To_String(asStr));
return False;
end if;
return True;
end getReal;
-- parse a directive. A directive is the directive itself, then some extra stuff like
-- an identifier or an immediate.
function doDirective return Boolean is
directive : Unbounded_String;
ident : Identifier;
value : YOTROCReal;
--chr : Character;
success : Boolean := False;
begin
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Directive %");
-- Get the directive name
success := getName(directive);
Ada.Text_IO.Unbounded_IO.Put_Line(directive);
if not success then
return False;
end if;
-- only support "define" right now.
if directive = "define" then
skipWhite;
success := getIdentifier(ident);
if not success then
return False;
else
skipWhite;
success := getReal(value);
if success then
-- cool, we defined an identifier.
identifiers.Insert(Key => ident, New_Item => value);
else
return False;
end if;
end if;
else
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Unsupported assembler directive: " & To_String(directive));
return False;
end if;
-- other interesting directives might be:
-- %address LITERAL : set address the "object file" gets loaded at
return True;
end doDirective;
-- check to see if a given word is in our list of registers. Return True
-- and set the Register value if this is in fact a register.
function isRegister(str : in Unbounded_String; reg : out Register) return Boolean is
begin
for r in Register loop
--Ada.Text_IO.Put_Line(" checking" & Register'Image(r) & " and " & To_String(str));
if Register'Image(r) = To_Upper(To_String(str)) then
reg := r;
return True;
end if;
end loop;
return False;
end isRegister;
-- get a register
function getRegister(reg : out Register) return Boolean is
curWord : Unbounded_String;
--success : Boolean;
goodRegister : Boolean := False;
begin
Ada.Text_IO.Put_Line("PARSE: Line" & curLine'Image & " Register");
if not getName(curWord) then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", expected register name");
return False;
end if;
-- capitalize it so we can compare with enumerated type
curWord := To_Unbounded_String(To_Upper(To_String(curWord)));
goodRegister := isRegister(curWord, reg);
if not goodRegister then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Unrecognized register: " & To_String(curWord));
return False;
end if;
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Register: ");
Ada.Text_IO.Put_Line(Register'Image(reg));
return True;
end getRegister;
-- get a single operand. This is kind of a mess, just because of how
-- many different operands we support, and I don't like prefixing
-- registers or immediates with a special character,
-- because we can figure it out here.
function getOperand(op : out Operand) return Boolean is
curWord : Unbounded_String;
reg : Register;
chr1 : Character;
chr2 : Character;
offset : YOTROCReal;
immedNumber : YOTROCReal;
immed : Immediate;
success : Boolean;
begin
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Operand ");
chr1 := peekNext;
if(chr1 = '*') then
-- either an offset or register indirect
chr1 := getNext; --eat the *
chr2 := peekNext; --check next char
if chr2 = '(' then
chr2 := getNext; --eat the (
-- displacement, first word must be a register
success := getRegister(reg);
if not success then
return False;
end if;
skipWhite;
-- expect a plus sign
chr1 := getNext;
if chr1 /= '+' then
msg := To_Unbounded_String("Error, line" & curLine'Image &
", invalid syntax for displacement operand. (should be *(Reg + Offset))");
return False;
end if;
skipWhite;
-- should be a number here, must be an Integer. Would be cool
-- to be able to use identifiers here too, but, eh.
success := getReal(offset);
if (not success) or (offset.kind = FloatReal) then
msg := To_Unbounded_String("Error, line" & curLine'Image &
", invalid offset for displacement operand. (should be *(Reg + <integer>))");
return False;
end if;
skipWhite;
chr1 := getNext;
if chr1 /= ')' then
msg := To_Unbounded_String("Error, line" & curLine'Image &
", missing closing parenthesis on displacement operand.");
return False;
end if;
Ada.Text_IO.Put_Line("Displacement w/ offset");
op := (kind => Displacement, regBase => reg, offset => offset.realInt);
return True;
else
-- register indirect. Should be a General-Purpose reg, but
-- we'll check for that in code gen.
success := getRegister(reg);
if not success then
return False;
end if;
Ada.Text_IO.Put_Line("Displacement, no offset (reg indirect)");
op := (kind => Displacement, regBase => reg, offset => 0);
return True;
end if;
else
-- don't know what type of operand this is, so just get it as
-- a string for now, then check it.
success := getName(curWord);
-- Try register.
if isRegister(curWord, reg) then
Ada.Text_IO.Put_Line("Register");
op := (kind => RegisterOperand, regName => reg);
return True;
end if;
-- try and parse as a number. This is kind of a mess.
if isReal(curWord, immedNumber) then
Ada.Text_IO.Put_Line("Immediate");
if immedNumber.kind = IntegerReal then
immed := (kind => IntegerImm, immInt => immedNumber.realInt);
else
immed := (kind => FloatImm, immFloat => immedNumber.realFloat);
end if;
op := (kind => ImmediateOperand, imm => immed);
return True;
end if;
-- Has to be an identifier. We don't bother checking to see if
-- the identifier exists here, we'll do that in code gen.
-- This way, we have the ability to jump to labels that are
-- declared later in the code.
if isValidIdentifier(curWord) then
Ada.Text_IO.Put_Line("Immediate (identifier)");
immed := (kind => IdentifierImm, immID => curWord);
op := (kind => ImmediateOperand, imm => immed);
return True;
end if;
msg := To_Unbounded_String("Error, line" & curLine'Image &
", invalid operand. (Must be immediate, register, displacement or an identifier)");
return False;
end if;
end getOperand;
-- get an Operator (basic instruction with no operands)
function getOperator(operator : out Operators) return Boolean is
success : Boolean;
goodOperator : Boolean; -- if this operator is in our list defined in vm.ads
curWord : Unbounded_String;
begin
success := getName(curWord);
curWord := To_Unbounded_String(To_Upper(To_String(curWord)));
Ada.Text_IO.Put("PARSE: Line" & curLine'Image & " Operator: ");
-- instruction list.
-- make sure this operator is in our list
for op in Operators loop
--Ada.Text_IO.Put_Line(" checking match with instruction " & Operators'Image(op) & ".");
if Operators'Image(op) = To_String(curWord) then
operator := op;
Ada.Text_IO.Put_Line(Operators'Image(operator));
goodOperator := True;
exit;
end if;
end loop;
if not goodOperator then
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Unrecognized instruction: " & To_String(curWord));
return False;
end if;
return True;
end getOperator;
-- attempt to parse an instruction
function doInstruction return Boolean is
inst : Instruction;
operator : Operators;
type OperandArr is array (0..2) of Operand;
operands : OperandArr;
operandCount : Integer;
success : Boolean;
curWord : Unbounded_String;
goodOperator : Boolean := False;
begin
Ada.Text_IO.Put_Line("PARSE: Line" & curLine'Image & " Instruction");
-- Get the instruction. It should be something of type Operators
success := getOperator(operator);
if not success then
return False;
end if;
skipWhite;
operandCount := 0;
-- now start eating operands until the end of the line.
while peekNext /= LF and peekNext /= ';' and peekNext /= NUL loop
success := getOperand(operands(operandCount));
if not success then
return False;
else
skipWhite;
operandCount := operandCount + 1;
end if;
end loop;
case operandCount is
when 0 =>
inst := (kind => NoOperand, operator => operator, line => curLine);
when 1 =>
inst := (kind => OneOperand, operator => operator, line => curLine, op1 => operands(0));
when 2 =>
inst := (kind => TwoOperand, operator => operator, line => curLine, op1 => operands(0),
op2 => operands(1));
when 3 =>
inst := (kind => ThreeOperand, operator => operator, line => curLine, op1 => operands(0),
op2 => operands(1), op3 => operands(2));
when others =>
msg := To_Unbounded_String("Error, line" & curLine'Image & ", Too many operands for instruction. (Max 3)");
end case;
-- add the instruction to our list.
instructions.Append(New_Item => inst);
-- Advance the current address by 8 bytes.
curAddress := curAddress + 1;
return True;
end doInstruction;
-- begin the parse() function itself
ignore : Character;
begin
-- in case we are doing successive parse() runs (like for testing)
identifiers.Clear;
--labels.Clear;
while pos < source'Last loop
skipWhite;
case peekNext is
when NUL =>
-- Reached the end of the file. If no errors by this point,
-- we were successful.
exit;
when ';' =>
-- ignore := getNext; -- eat the ;
skipComment;
when '@' =>
ignore := getNext; -- eat the @
if not doLabel then
return False;
end if;
when '%' =>
ignore := getNext; -- eat the %
if not doDirective then
return False;
end if;
when LF =>
ignore := getNext;
null;
when others =>
if not doInstruction then
return False;
end if;
end case;
end loop;
msg := To_Unbounded_String("Success");
return True;
end parse;
-- Given a vector of instructions, sanity-check to make sure operands match
-- the operators, look up identifiers in the table and fill in their values,
-- and emit machine code for each instruction.
function codeGen(instructions : in InstructionVector.Vector;
objectFile : out MachineCodeVector.Vector;
msg : out Unbounded_String) return Boolean is
--success : Boolean;
opcode : Unsigned_64;
-- Try and get an integer value from an immediate. This function will perform
-- a lookup in the identifier table if it refers to one.
function getImmediateIntegerValue(imm : in Immediate; int : out Integer) return Boolean is
immedReal : YOTROCReal;
begin
if imm.kind = IdentifierImm then
-- lookup identifier if it is.
lookupIdentifier : declare
begin
immedReal := identifiers.Element(Key => imm.immID);
exception
when others =>
return False;
end lookupIdentifier;
if(immedReal.kind /= IntegerReal) then
-- this identifier maps to a float
--msg := To_Unbounded_String("Error, identifier points to floating-point type for " & inst.operator'Image);
return False;
end if;
int := immedReal.realInt;
return True;
elsif imm.kind = IntegerImm then
-- otherwise just take the immediate as is.
int := imm.immInt;
return True;
else
-- this was a raw float immediate
--msg := To_Unbounded_String("Error, identifier points to floating-point type for " & inst.operator'Image);
return False;
end if;
end getImmediateIntegerValue;
-- Try and get a float value from an immediate. This function will perform
-- a lookup in the identifier table if it refers to one.
function getImmediateFloatValue(imm : in Immediate; flt : out Float) return Boolean is
immedReal : YOTROCReal;
begin
if imm.kind = IdentifierImm then
-- lookup identifier if it is.
lookupIdentifier : declare
begin
immedReal := identifiers.Element(Key => imm.immID);
exception
when others =>
return False;
end lookupIdentifier;
if(immedReal.kind /= FloatReal) then
-- this identifier maps to an integer
--msg := To_Unbounded_String("Error, identifier points to integer type for " & inst.operator'Image);
return False;
end if;
flt := immedReal.realFloat;
return True;
elsif imm.kind = FloatImm then
-- otherwise just take the immediate as is.
flt := imm.immFloat;
return True;
else
-- this immediate was a raw integer
--msg := To_Unbounded_String("Error, identifier points to integer type for " & inst.operator'Image);
return False;
end if;
end getImmediateFloatValue;
-- Given an Instruction, generate a single word of machine code
function genCode(inst : in Instruction;
code : out Unsigned_64;
msg : out Unbounded_String) return Boolean is
--immedReal : YOTROCReal; -- for identifier -> real number lookups.
immedInt : Integer; -- for holding integer immediates
immedFloat : Float; -- for holding float immediates
modifiedOpcode : Integer := 0;
begin
-- initialize opcode as all zeroes to start
code := 0;
-- determine the instruction type, see vm.ads for list
case inst.operator is
-- load/store operation. Need to gen opcode based on operands, so there
-- is some extra work here to ensure operands match the instruction
when ABCDOps =>
if inst.kind /= TwoOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected two operands for " & inst.operator'Image);
return False;
end if;
-- first, handle loads. Loads can be reg reg/reg imm/reg disp
if inst.operator in l8 .. l64 then
-- first operand must be a register
if inst.op1.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": first operand must be register for " & inst.operator'Image);
return False;
end if;
-- second operand can be any type.
end if;
-- now, stores. Stores can be reg imm/reg disp
if inst.operator in s8 .. s64 then
-- first operand must be a register
if inst.op1.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": first operand must be register for " & inst.operator'Image);
return False;
end if;
if inst.op2.kind = RegisterOperand or inst.op2.kind = ImmediateOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": second operand must be register indirect or displacement for " & inst.operator'Image);
return False;
end if;
end if;
-- Determine what modifier to use based on the second operand.
case inst.op2.kind is
when ImmediateOperand =>
modifiedOpcode := Integer(Operators'Pos(inst.operator)) + loadStoreImmModifier;
-- get the immediate here too. Try and get it as an integer first, if that
-- fails then it must be a float.
if getImmediateIntegerValue(inst.op2.imm, immedInt) then
setHiWord(Unsigned_32(immedInt), code); -- put the immediate in machine code
-- Only floating point immediates allowed in FP regs.
if inst.op1.regName in FloatRegister then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": cannot assign an integer immediate to the FP Register " & inst.operator'Image);
return False;
end if;
elsif getImmediateFloatValue(inst.op2.imm, immedFloat) then
setHiWord(rawFloatBits(immedFloat), code); -- put the immediate in machine code
-- do a quick sanity check here. If we are trying to put a float immediate in a
-- GPR, error.
if inst.op1.regName not in FloatRegister then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": cannot assign a floating immediate to the GPR " & inst.operator'Image);
return False;
end if;
else
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": undefined immediate " & To_String(inst.op2.imm.immID));
return False;
end if;
when RegisterOperand =>
modifiedOpcode := Integer(Operators'Pos(inst.operator)) + loadStoreRegModifier;
when Displacement =>
-- we use the same section of the Operand variant record for register indirect
-- and displacement, but the opcodes are different, so we discriminate between
-- the two by checking the offset.
if inst.op2.offset = 0 then
modifiedOpcode := Integer(Operators'Pos(inst.operator)) + loadStoreIndModifier;
else
modifiedOpcode := Integer(Operators'Pos(inst.operator)) + loadStoreDisModifier;
setHiWord(Unsigned_32(inst.op2.offset), code); -- put displacement in machine code
end if;
when others =>
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": unrecognized addressing type for " & inst.operator'Image);
return False;
end case;
-- if there was an immediate or displacement required, they are already set above.
setByte(0, Unsigned_8(modifiedOpcode), code);
setByte(1, Register'Pos(inst.op1.regName), code);
-- if this isn't an immediate, we need to set Reg 2
if inst.op2.kind = RegisterOperand then
setByte(2, Register'Pos(inst.op2.regName), code);
elsif inst.op2.kind = Displacement then
setByte(2, Register'Pos(inst.op2.regBase), code);
end if;
Ada.Text_IO.Put_Line("CODEGEN: emitting ABCD-Type code " & toHexString(code));
return True;
-- Three-operand arithmetic. All of these should be registers.
when ETypeOps =>
if inst.kind /= ThreeOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected three operands for " & inst.operator'Image);
return False;
end if;
if inst.op1.kind /= RegisterOperand or inst.op2.kind /= RegisterOperand or
inst.op3.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected three registers for " & inst.operator'Image);
return False;
end if;
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
setByte(1, Unsigned_8(Register'Pos(inst.op1.regName)), code);
setByte(2, Unsigned_8(Register'Pos(inst.op2.regName)), code);
setByte(3, Unsigned_8(Register'Pos(inst.op3.regName)), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting E-Type code " & toHexString(code));
return True;
-- Two-operand arithmetic. Both of these should be registers.
when FTypeOps =>
if inst.kind /= TwoOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected two operands for " & inst.operator'Image);
return False;
end if;
if inst.op1.kind /= RegisterOperand or inst.op2.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected two registers for " & inst.operator'Image);
return False;
end if;
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
setByte(1, Unsigned_8(Register'Pos(inst.op1.regName)), code);
setByte(2, Unsigned_8(Register'Pos(inst.op2.regName)), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting F-Type code " & toHexString(code));
return True;
-- Bit operation, expect register, immediate.
when GTypeOps =>
if inst.kind /= TwoOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected two operands for " & inst.operator'Image);
return False;
end if;
if inst.op1.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected register as first operand for " & inst.operator'Image);
return False;
end if;
if inst.op2.kind /= ImmediateOperand or inst.op2.imm.kind /= IntegerImm then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected immediate integer type as second operand for " & inst.operator'Image);
return False;
end if;
-- set the opcode
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
setByte(1, Unsigned_8(Register'Pos(inst.op1.regName)), code);
setByte(2, Unsigned_8(inst.op2.imm.immInt), code);
--setHiWord(Unsigned_32(inst.op2.imm.immInt), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting G-Type code " & toHexString(code));
return True;
-- Jump to label, expect a single large operand
when HTypeOps =>
if inst.kind /= OneOperand and then inst.op1.kind /= ImmediateOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected one immediate as operand for " & inst.operator'Image);
return False;
end if;
-- now we need to see if this immediate is an identifier
if not getImmediateIntegerValue(inst.op1.imm, immedInt) then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": immediate " & To_String(inst.op1.imm.immID) & " is either uninitialized or a floating point value");
return False;
end if;
-- set the opcode. Kinda lame, but we only support 32-bit absolute addresses
-- right now.
setHiWord(Unsigned_32(immedInt), code);
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting H-Type code " & toHexString(code));
return True;
-- Jump to register (needs to be a GPR)
when ITypeOps =>
if inst.kind /= OneOperand or inst.op1.kind /= RegisterOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected one register as operand for " & inst.operator'Image);
return False;
end if;
if inst.op1.regName not in GeneralRegister then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": jumps only allowed to address in a general-purpose register. " & inst.operator'Image);
return False;
end if;
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
setByte(1, Unsigned_8(Register'Pos(inst.op1.regName)), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting I-Type code " & toHexString(code));
return True;
-- Zero operands, like ret or relax
when JTypeOps =>
if inst.kind /= NoOperand then
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": expected zero operands for " & inst.operator'Image);
return False;
end if;
setByte(0, Unsigned_8(Operators'Pos(inst.operator)), code);
Ada.Text_IO.Put_Line("CODEGEN: emitting J-Type code " & toHexString(code));
return True;
when others =>
msg := To_Unbounded_String("Error, line" & inst.line'Image & ": unsupported instruction type " & inst.operator'Image);
return False;
end case;
end genCode;
begin
-- just in case we're passed something with old values in it.
objectFile.Clear;
for inst of instructions loop
if genCode(inst, opcode, msg) then
objectFile.Append(New_Item => opcode);
else
return False;
end if;
end loop;
return True;
end codeGen;
end assembler;
|
rahulyhg/swaggy-jenkins | Ada | 102,539 | ads | -- Swaggy Jenkins
-- Jenkins API clients generated from Swagger / Open API specification
--
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 3.2.1-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
with Swagger.Streams;
with Ada.Containers.Vectors;
package .Models is
type Body_Type is
record
Favorite : Boolean;
end record;
package Body_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Body_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Body_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Body_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Body_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Body_Type_Vectors.Vector);
subtype UserFavorites_Type is FavoriteImpl_Type_Vectors.Vector;
type User_Type is
record
_class : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Full_Name : Swagger.Nullable_UString;
Email : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
end record;
package User_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in User_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out User_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out User_Type_Vectors.Vector);
type GithubContent_Type is
record
Name : Swagger.Nullable_UString;
Sha : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
Repo : Swagger.Nullable_UString;
Size : Swagger.Nullable_Integer;
Owner : Swagger.Nullable_UString;
Path : Swagger.Nullable_UString;
Base64_Data : Swagger.Nullable_UString;
end record;
package GithubContent_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubContent_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubContent_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubContent_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubContent_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubContent_Type_Vectors.Vector);
type GithubFile_Type is
record
Content : .Models.GithubContent_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubFile_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubFile_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubFile_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubFile_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubFile_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubFile_Type_Vectors.Vector);
subtype PipelineRuns_Type is PipelineRun_Type_Vectors.Vector;
type GenericResource_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Duration_In_Millis : Swagger.Nullable_Integer;
Id : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
end record;
package GenericResource_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GenericResource_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GenericResource_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GenericResource_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GenericResource_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GenericResource_Type_Vectors.Vector);
subtype PipelineRunNodeSteps_Type is PipelineStepImpl_Type_Vectors.Vector;
type PipelineRunartifacts_Type is
record
Name : Swagger.Nullable_UString;
Size : Swagger.Nullable_Integer;
Url : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineRunartifacts_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRunartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunartifacts_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunartifacts_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunartifacts_Type_Vectors.Vector);
type PipelineRun_Type is
record
_class : Swagger.Nullable_UString;
Artifacts : .Models.PipelineRunartifacts_Type_Vectors.Vector;
Duration_In_Millis : Swagger.Nullable_Integer;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
En_Queue_Time : Swagger.Nullable_UString;
End_Time : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Run_Summary : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
Commit_Id : Swagger.Nullable_UString;
end record;
package PipelineRun_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRun_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRun_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRun_Type_Vectors.Vector);
type QueueItemImpl_Type is
record
_class : Swagger.Nullable_UString;
Expected_Build_Number : Swagger.Nullable_Integer;
Id : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Queued_Time : Swagger.Nullable_Integer;
end record;
package QueueItemImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => QueueItemImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueItemImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueItemImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueItemImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueItemImpl_Type_Vectors.Vector);
type PipelineBranchesitempullRequestlinks_Type is
record
Self : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineBranchesitempullRequestlinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineBranchesitempullRequestlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitempullRequestlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitempullRequestlinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitempullRequestlinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitempullRequestlinks_Type_Vectors.Vector);
type PipelineBranchesitempullRequest_Type is
record
_links : .Models.PipelineBranchesitempullRequestlinks_Type;
Author : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Title : Swagger.Nullable_UString;
Url : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineBranchesitempullRequest_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineBranchesitempullRequest_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitempullRequest_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitempullRequest_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitempullRequest_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitempullRequest_Type_Vectors.Vector);
subtype PipelineActivities_Type is PipelineActivity_Type_Vectors.Vector;
type PipelineActivityartifacts_Type is
record
Name : Swagger.Nullable_UString;
Size : Swagger.Nullable_Integer;
Url : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineActivityartifacts_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineActivityartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineActivityartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineActivityartifacts_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineActivityartifacts_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineActivityartifacts_Type_Vectors.Vector);
type PipelineActivity_Type is
record
_class : Swagger.Nullable_UString;
Artifacts : .Models.PipelineActivityartifacts_Type_Vectors.Vector;
Duration_In_Millis : Swagger.Nullable_Integer;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
En_Queue_Time : Swagger.Nullable_UString;
End_Time : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Run_Summary : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
Commit_Id : Swagger.Nullable_UString;
end record;
package PipelineActivity_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineActivity_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineActivity_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineActivity_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineActivity_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineActivity_Type_Vectors.Vector);
subtype Organisations_Type is Organisation_Type_Vectors.Vector;
type ClassesByClass_Type is
record
Classes : Swagger.UString_Vectors.Vector;
_class : Swagger.Nullable_UString;
end record;
package ClassesByClass_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ClassesByClass_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ClassesByClass_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ClassesByClass_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ClassesByClass_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ClassesByClass_Type_Vectors.Vector);
type Link_Type is
record
_class : Swagger.Nullable_UString;
Href : Swagger.Nullable_UString;
end record;
package Link_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Link_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Link_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Link_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Link_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Link_Type_Vectors.Vector);
type PipelineRunImpllinks_Type is
record
Nodes : .Models.Link_Type;
Log : .Models.Link_Type;
Self : .Models.Link_Type;
Actions : .Models.Link_Type;
Steps : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package PipelineRunImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRunImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunImpllinks_Type_Vectors.Vector);
type PipelineRunImpl_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.PipelineRunImpllinks_Type;
Duration_In_Millis : Swagger.Nullable_Integer;
En_Queue_Time : Swagger.Nullable_UString;
End_Time : Swagger.Nullable_UString;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Id : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Run_Summary : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
Commit_Id : Swagger.Nullable_UString;
end record;
package PipelineRunImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRunImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunImpl_Type_Vectors.Vector);
type GithubRepositorylinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubRepositorylinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRepositorylinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorylinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorylinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorylinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorylinks_Type_Vectors.Vector);
type GithubRespositoryContainerlinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubRespositoryContainerlinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRespositoryContainerlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRespositoryContainerlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRespositoryContainerlinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRespositoryContainerlinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRespositoryContainerlinks_Type_Vectors.Vector);
type GithubScmlinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubScmlinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubScmlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubScmlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubScmlinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubScmlinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubScmlinks_Type_Vectors.Vector);
type GithubScm_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.GithubScmlinks_Type;
Credential_Id : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Uri : Swagger.Nullable_UString;
end record;
package GithubScm_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubScm_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubScm_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubScm_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubScm_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubScm_Type_Vectors.Vector);
type PipelineStepImpllinks_Type is
record
Self : .Models.Link_Type;
Actions : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package PipelineStepImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineStepImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineStepImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineStepImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineStepImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineStepImpllinks_Type_Vectors.Vector);
type FavoriteImpllinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package FavoriteImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FavoriteImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FavoriteImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FavoriteImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FavoriteImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FavoriteImpllinks_Type_Vectors.Vector);
type ExtensionClassImpllinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package ExtensionClassImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ExtensionClassImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassImpllinks_Type_Vectors.Vector);
type ExtensionClassImpl_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.ExtensionClassImpllinks_Type;
Classes : Swagger.UString_Vectors.Vector;
end record;
package ExtensionClassImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ExtensionClassImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassImpl_Type_Vectors.Vector);
type ExtensionClassContainerImpl1map_Type is
record
Io_Jenkins_Blueocean_Service_Embedded_Rest_Pipeline_Impl : .Models.ExtensionClassImpl_Type;
Io_Jenkins_Blueocean_Service_Embedded_Rest_Multi_Branch_Pipeline_Impl : .Models.ExtensionClassImpl_Type;
_class : Swagger.Nullable_UString;
end record;
package ExtensionClassContainerImpl1map_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ExtensionClassContainerImpl1map_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1map_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1map_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1map_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1map_Type_Vectors.Vector);
type ExtensionClassContainerImpl1links_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package ExtensionClassContainerImpl1links_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ExtensionClassContainerImpl1links_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1links_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1links_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1links_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1links_Type_Vectors.Vector);
type ExtensionClassContainerImpl1_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.ExtensionClassContainerImpl1links_Type;
Map : .Models.ExtensionClassContainerImpl1map_Type;
end record;
package ExtensionClassContainerImpl1_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ExtensionClassContainerImpl1_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ExtensionClassContainerImpl1_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ExtensionClassContainerImpl1_Type_Vectors.Vector);
type PipelineImpllinks_Type is
record
Runs : .Models.Link_Type;
Self : .Models.Link_Type;
Queue : .Models.Link_Type;
Actions : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package PipelineImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineImpllinks_Type_Vectors.Vector);
type PipelineImpl_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Full_Name : Swagger.Nullable_UString;
Latest_Run : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Weather_Score : Swagger.Nullable_Integer;
_links : .Models.PipelineImpllinks_Type;
end record;
package PipelineImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineImpl_Type_Vectors.Vector);
type FavoriteImpl_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.FavoriteImpllinks_Type;
Item : .Models.PipelineImpl_Type;
end record;
package FavoriteImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FavoriteImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FavoriteImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FavoriteImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FavoriteImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FavoriteImpl_Type_Vectors.Vector);
type InputStepImpllinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package InputStepImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => InputStepImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in InputStepImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in InputStepImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out InputStepImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out InputStepImpllinks_Type_Vectors.Vector);
type GithubRepositorieslinks_Type is
record
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubRepositorieslinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRepositorieslinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorieslinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorieslinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorieslinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorieslinks_Type_Vectors.Vector);
type GithubOrganizationlinks_Type is
record
Repositories : .Models.Link_Type;
Self : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package GithubOrganizationlinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubOrganizationlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubOrganizationlinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubOrganizationlinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubOrganizationlinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubOrganizationlinks_Type_Vectors.Vector);
type GithubOrganization_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.GithubOrganizationlinks_Type;
Jenkins_Organization_Pipeline : Swagger.Nullable_Boolean;
Name : Swagger.Nullable_UString;
end record;
package GithubOrganization_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubOrganization_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubOrganization_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubOrganization_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubOrganization_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubOrganization_Type_Vectors.Vector);
type BranchImpllinks_Type is
record
Self : .Models.Link_Type;
Actions : .Models.Link_Type;
Runs : .Models.Link_Type;
Queue : .Models.Link_Type;
_class : Swagger.Nullable_UString;
end record;
package BranchImpllinks_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => BranchImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImpllinks_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImpllinks_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImpllinks_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImpllinks_Type_Vectors.Vector);
type NullSCM_Type is
record
_class : Swagger.Nullable_UString;
end record;
package NullSCM_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => NullSCM_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in NullSCM_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in NullSCM_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out NullSCM_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out NullSCM_Type_Vectors.Vector);
type FreeStyleProjectactions_Type is
record
_class : Swagger.Nullable_UString;
end record;
package FreeStyleProjectactions_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FreeStyleProjectactions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProjectactions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProjectactions_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProjectactions_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProjectactions_Type_Vectors.Vector);
type UnlabeledLoadStatistics_Type is
record
_class : Swagger.Nullable_UString;
end record;
package UnlabeledLoadStatistics_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => UnlabeledLoadStatistics_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in UnlabeledLoadStatistics_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in UnlabeledLoadStatistics_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out UnlabeledLoadStatistics_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out UnlabeledLoadStatistics_Type_Vectors.Vector);
type DefaultCrumbIssuer_Type is
record
_class : Swagger.Nullable_UString;
Crumb : Swagger.Nullable_UString;
Crumb_Request_Field : Swagger.Nullable_UString;
end record;
package DefaultCrumbIssuer_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => DefaultCrumbIssuer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in DefaultCrumbIssuer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in DefaultCrumbIssuer_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out DefaultCrumbIssuer_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out DefaultCrumbIssuer_Type_Vectors.Vector);
type ClockDifference_Type is
record
_class : Swagger.Nullable_UString;
Diff : Swagger.Nullable_Integer;
end record;
package ClockDifference_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ClockDifference_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ClockDifference_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ClockDifference_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ClockDifference_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ClockDifference_Type_Vectors.Vector);
type DiskSpaceMonitorDescriptorDiskSpace_Type is
record
_class : Swagger.Nullable_UString;
Timestamp : Swagger.Nullable_Integer;
Path : Swagger.Nullable_UString;
Size : Swagger.Nullable_Integer;
end record;
package DiskSpaceMonitorDescriptorDiskSpace_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => DiskSpaceMonitorDescriptorDiskSpace_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in DiskSpaceMonitorDescriptorDiskSpace_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in DiskSpaceMonitorDescriptorDiskSpace_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out DiskSpaceMonitorDescriptorDiskSpace_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out DiskSpaceMonitorDescriptorDiskSpace_Type_Vectors.Vector);
type Label1_Type is
record
_class : Swagger.Nullable_UString;
end record;
package Label1_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Label1_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Label1_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Label1_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Label1_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Label1_Type_Vectors.Vector);
type SwapSpaceMonitorMemoryUsage2_Type is
record
_class : Swagger.Nullable_UString;
Available_Physical_Memory : Swagger.Nullable_Integer;
Available_Swap_Space : Swagger.Nullable_Integer;
Total_Physical_Memory : Swagger.Nullable_Integer;
Total_Swap_Space : Swagger.Nullable_Integer;
end record;
package SwapSpaceMonitorMemoryUsage2_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => SwapSpaceMonitorMemoryUsage2_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in SwapSpaceMonitorMemoryUsage2_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in SwapSpaceMonitorMemoryUsage2_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out SwapSpaceMonitorMemoryUsage2_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out SwapSpaceMonitorMemoryUsage2_Type_Vectors.Vector);
type ResponseTimeMonitorData_Type is
record
_class : Swagger.Nullable_UString;
Timestamp : Swagger.Nullable_Integer;
Average : Swagger.Nullable_Integer;
end record;
package ResponseTimeMonitorData_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ResponseTimeMonitorData_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ResponseTimeMonitorData_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ResponseTimeMonitorData_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ResponseTimeMonitorData_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ResponseTimeMonitorData_Type_Vectors.Vector);
type HudsonMasterComputermonitorData_Type is
record
Hudson_Node_Monitors_Swap_Space_Monitor : .Models.SwapSpaceMonitorMemoryUsage2_Type;
Hudson_Node_Monitors_Temporary_Space_Monitor : .Models.DiskSpaceMonitorDescriptorDiskSpace_Type;
Hudson_Node_Monitors_Disk_Space_Monitor : .Models.DiskSpaceMonitorDescriptorDiskSpace_Type;
Hudson_Node_Monitors_Architecture_Monitor : Swagger.Nullable_UString;
Hudson_Node_Monitors_Response_Time_Monitor : .Models.ResponseTimeMonitorData_Type;
Hudson_Node_Monitors_Clock_Monitor : .Models.ClockDifference_Type;
_class : Swagger.Nullable_UString;
end record;
package HudsonMasterComputermonitorData_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => HudsonMasterComputermonitorData_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputermonitorData_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputermonitorData_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputermonitorData_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputermonitorData_Type_Vectors.Vector);
type HudsonassignedLabels_Type is
record
_class : Swagger.Nullable_UString;
end record;
package HudsonassignedLabels_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => HudsonassignedLabels_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonassignedLabels_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonassignedLabels_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonassignedLabels_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonassignedLabels_Type_Vectors.Vector);
type AllView_Type is
record
_class : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Url : Swagger.Nullable_UString;
end record;
package AllView_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => AllView_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in AllView_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in AllView_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out AllView_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out AllView_Type_Vectors.Vector);
type FreeStyleProjecthealthReport_Type is
record
Description : Swagger.Nullable_UString;
Icon_Class_Name : Swagger.Nullable_UString;
Icon_Url : Swagger.Nullable_UString;
Score : Swagger.Nullable_Integer;
_class : Swagger.Nullable_UString;
end record;
package FreeStyleProjecthealthReport_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FreeStyleProjecthealthReport_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProjecthealthReport_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProjecthealthReport_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProjecthealthReport_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProjecthealthReport_Type_Vectors.Vector);
type CauseUserIdCause_Type is
record
_class : Swagger.Nullable_UString;
Short_Description : Swagger.Nullable_UString;
User_Id : Swagger.Nullable_UString;
User_Name : Swagger.Nullable_UString;
end record;
package CauseUserIdCause_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => CauseUserIdCause_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CauseUserIdCause_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CauseUserIdCause_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CauseUserIdCause_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CauseUserIdCause_Type_Vectors.Vector);
type CauseAction_Type is
record
_class : Swagger.Nullable_UString;
Causes : .Models.CauseUserIdCause_Type_Vectors.Vector;
end record;
package CauseAction_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => CauseAction_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CauseAction_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CauseAction_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CauseAction_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CauseAction_Type_Vectors.Vector);
type EmptyChangeLogSet_Type is
record
_class : Swagger.Nullable_UString;
Kind : Swagger.Nullable_UString;
end record;
package EmptyChangeLogSet_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => EmptyChangeLogSet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in EmptyChangeLogSet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in EmptyChangeLogSet_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out EmptyChangeLogSet_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out EmptyChangeLogSet_Type_Vectors.Vector);
type FreeStyleBuild_Type is
record
_class : Swagger.Nullable_UString;
Number : Swagger.Nullable_Integer;
Url : Swagger.Nullable_UString;
Actions : .Models.CauseAction_Type_Vectors.Vector;
Building : Swagger.Nullable_Boolean;
Description : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Duration : Swagger.Nullable_Integer;
Estimated_Duration : Swagger.Nullable_Integer;
Executor : Swagger.Nullable_UString;
Full_Display_Name : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Keep_Log : Swagger.Nullable_Boolean;
Queue_Id : Swagger.Nullable_Integer;
Result : Swagger.Nullable_UString;
Timestamp : Swagger.Nullable_Integer;
Built_On : Swagger.Nullable_UString;
Change_Set : .Models.EmptyChangeLogSet_Type;
end record;
package FreeStyleBuild_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FreeStyleBuild_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleBuild_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleBuild_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleBuild_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleBuild_Type_Vectors.Vector);
type FreeStyleProject_Type is
record
_class : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Url : Swagger.Nullable_UString;
Color : Swagger.Nullable_UString;
Actions : .Models.FreeStyleProjectactions_Type_Vectors.Vector;
Description : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Display_Name_Or_Null : Swagger.Nullable_UString;
Full_Display_Name : Swagger.Nullable_UString;
Full_Name : Swagger.Nullable_UString;
Buildable : Swagger.Nullable_Boolean;
Builds : .Models.FreeStyleBuild_Type_Vectors.Vector;
First_Build : .Models.FreeStyleBuild_Type;
Health_Report : .Models.FreeStyleProjecthealthReport_Type_Vectors.Vector;
In_Queue : Swagger.Nullable_Boolean;
Keep_Dependencies : Swagger.Nullable_Boolean;
Last_Build : .Models.FreeStyleBuild_Type;
Last_Completed_Build : .Models.FreeStyleBuild_Type;
Last_Failed_Build : Swagger.Nullable_UString;
Last_Stable_Build : .Models.FreeStyleBuild_Type;
Last_Successful_Build : .Models.FreeStyleBuild_Type;
Last_Unstable_Build : Swagger.Nullable_UString;
Last_Unsuccessful_Build : Swagger.Nullable_UString;
Next_Build_Number : Swagger.Nullable_Integer;
Queue_Item : Swagger.Nullable_UString;
Concurrent_Build : Swagger.Nullable_Boolean;
Scm : .Models.NullSCM_Type;
end record;
package FreeStyleProject_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => FreeStyleProject_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProject_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in FreeStyleProject_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProject_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out FreeStyleProject_Type_Vectors.Vector);
type QueueLeftItem_Type is
record
_class : Swagger.Nullable_UString;
Actions : .Models.CauseAction_Type_Vectors.Vector;
Blocked : Swagger.Nullable_Boolean;
Buildable : Swagger.Nullable_Boolean;
Id : Swagger.Nullable_Integer;
In_Queue_Since : Swagger.Nullable_Integer;
Params : Swagger.Nullable_UString;
Stuck : Swagger.Nullable_Boolean;
P_Task : .Models.FreeStyleProject_Type;
Url : Swagger.Nullable_UString;
Why : Swagger.Nullable_UString;
Cancelled : Swagger.Nullable_Boolean;
Executable : .Models.FreeStyleBuild_Type;
end record;
package QueueLeftItem_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => QueueLeftItem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueLeftItem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueLeftItem_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueLeftItem_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueLeftItem_Type_Vectors.Vector);
type QueueBlockedItem_Type is
record
_class : Swagger.Nullable_UString;
Actions : .Models.CauseAction_Type_Vectors.Vector;
Blocked : Swagger.Nullable_Boolean;
Buildable : Swagger.Nullable_Boolean;
Id : Swagger.Nullable_Integer;
In_Queue_Since : Swagger.Nullable_Integer;
Params : Swagger.Nullable_UString;
Stuck : Swagger.Nullable_Boolean;
P_Task : .Models.FreeStyleProject_Type;
Url : Swagger.Nullable_UString;
Why : Swagger.Nullable_UString;
Buildable_Start_Milliseconds : Swagger.Nullable_Integer;
end record;
package QueueBlockedItem_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => QueueBlockedItem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueBlockedItem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in QueueBlockedItem_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueBlockedItem_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out QueueBlockedItem_Type_Vectors.Vector);
type Queue_Type is
record
_class : Swagger.Nullable_UString;
Items : .Models.QueueBlockedItem_Type_Vectors.Vector;
end record;
package Queue_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Queue_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Queue_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Queue_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Queue_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Queue_Type_Vectors.Vector);
type Hudson_Type is
record
_class : Swagger.Nullable_UString;
Assigned_Labels : .Models.HudsonassignedLabels_Type_Vectors.Vector;
Mode : Swagger.Nullable_UString;
Node_Description : Swagger.Nullable_UString;
Node_Name : Swagger.Nullable_UString;
Num_Executors : Swagger.Nullable_Integer;
Description : Swagger.Nullable_UString;
Jobs : .Models.FreeStyleProject_Type_Vectors.Vector;
Primary_View : .Models.AllView_Type;
Quieting_Down : Swagger.Nullable_Boolean;
Slave_Agent_Port : Swagger.Nullable_Integer;
Unlabeled_Load : .Models.UnlabeledLoadStatistics_Type;
Use_Crumbs : Swagger.Nullable_Boolean;
Use_Security : Swagger.Nullable_Boolean;
Views : .Models.AllView_Type_Vectors.Vector;
end record;
package Hudson_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Hudson_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Hudson_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Hudson_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Hudson_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Hudson_Type_Vectors.Vector);
type ListView_Type is
record
_class : Swagger.Nullable_UString;
Description : Swagger.Nullable_UString;
Jobs : .Models.FreeStyleProject_Type_Vectors.Vector;
Name : Swagger.Nullable_UString;
Url : Swagger.Nullable_UString;
end record;
package ListView_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ListView_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ListView_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ListView_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ListView_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ListView_Type_Vectors.Vector);
type HudsonMasterComputerexecutors_Type is
record
Current_Executable : .Models.FreeStyleBuild_Type;
Idle : Swagger.Nullable_Boolean;
Likely_Stuck : Swagger.Nullable_Boolean;
Number : Swagger.Nullable_Integer;
Progress : Swagger.Nullable_Integer;
_class : Swagger.Nullable_UString;
end record;
package HudsonMasterComputerexecutors_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => HudsonMasterComputerexecutors_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputerexecutors_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputerexecutors_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputerexecutors_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputerexecutors_Type_Vectors.Vector);
type HudsonMasterComputer_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Executors : .Models.HudsonMasterComputerexecutors_Type_Vectors.Vector;
Icon : Swagger.Nullable_UString;
Icon_Class_Name : Swagger.Nullable_UString;
Idle : Swagger.Nullable_Boolean;
Jnlp_Agent : Swagger.Nullable_Boolean;
Launch_Supported : Swagger.Nullable_Boolean;
Load_Statistics : .Models.Label1_Type;
Manual_Launch_Allowed : Swagger.Nullable_Boolean;
Monitor_Data : .Models.HudsonMasterComputermonitorData_Type;
Num_Executors : Swagger.Nullable_Integer;
Offline : Swagger.Nullable_Boolean;
Offline_Cause : Swagger.Nullable_UString;
Offline_Cause_Reason : Swagger.Nullable_UString;
Temporarily_Offline : Swagger.Nullable_Boolean;
end record;
package HudsonMasterComputer_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => HudsonMasterComputer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in HudsonMasterComputer_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputer_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out HudsonMasterComputer_Type_Vectors.Vector);
type ComputerSet_Type is
record
_class : Swagger.Nullable_UString;
Busy_Executors : Swagger.Nullable_Integer;
Computer : .Models.HudsonMasterComputer_Type_Vectors.Vector;
Display_Name : Swagger.Nullable_UString;
Total_Executors : Swagger.Nullable_Integer;
end record;
package ComputerSet_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ComputerSet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ComputerSet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ComputerSet_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ComputerSet_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ComputerSet_Type_Vectors.Vector);
type MultibranchPipeline_Type is
record
Display_Name : Swagger.Nullable_UString;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Latest_Run : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Weather_Score : Swagger.Nullable_Integer;
Branch_Names : Swagger.UString_Vectors.Vector;
Number_Of_Failing_Branches : Swagger.Nullable_Integer;
Number_Of_Failing_Pull_Requests : Swagger.Nullable_Integer;
Number_Of_Successful_Branches : Swagger.Nullable_Integer;
Number_Of_Successful_Pull_Requests : Swagger.Nullable_Integer;
Total_Number_Of_Branches : Swagger.Nullable_Integer;
Total_Number_Of_Pull_Requests : Swagger.Nullable_Integer;
_class : Swagger.Nullable_UString;
end record;
package MultibranchPipeline_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => MultibranchPipeline_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in MultibranchPipeline_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in MultibranchPipeline_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out MultibranchPipeline_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out MultibranchPipeline_Type_Vectors.Vector);
type Organisation_Type is
record
_class : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
end record;
package Organisation_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Organisation_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Organisation_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Organisation_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Organisation_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Organisation_Type_Vectors.Vector);
type PipelinelatestRunartifacts_Type is
record
Name : Swagger.Nullable_UString;
Size : Swagger.Nullable_Integer;
Url : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelinelatestRunartifacts_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelinelatestRunartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelinelatestRunartifacts_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelinelatestRunartifacts_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelinelatestRunartifacts_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelinelatestRunartifacts_Type_Vectors.Vector);
type PipelinelatestRun_Type is
record
Artifacts : .Models.PipelinelatestRunartifacts_Type_Vectors.Vector;
Duration_In_Millis : Swagger.Nullable_Integer;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
En_Queue_Time : Swagger.Nullable_UString;
End_Time : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Run_Summary : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
Commit_Id : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelinelatestRun_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelinelatestRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelinelatestRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelinelatestRun_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelinelatestRun_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelinelatestRun_Type_Vectors.Vector);
type Pipeline_Type is
record
_class : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Full_Name : Swagger.Nullable_UString;
Weather_Score : Swagger.Nullable_Integer;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Latest_Run : .Models.PipelinelatestRun_Type;
end record;
package Pipeline_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Pipeline_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Pipeline_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Pipeline_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Pipeline_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Pipeline_Type_Vectors.Vector);
type StringParameterValue_Type is
record
_class : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Value : Swagger.Nullable_UString;
end record;
package StringParameterValue_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => StringParameterValue_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in StringParameterValue_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in StringParameterValue_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out StringParameterValue_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out StringParameterValue_Type_Vectors.Vector);
type StringParameterDefinition_Type is
record
_class : Swagger.Nullable_UString;
Default_Parameter_Value : .Models.StringParameterValue_Type;
Description : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
end record;
package StringParameterDefinition_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => StringParameterDefinition_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in StringParameterDefinition_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in StringParameterDefinition_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out StringParameterDefinition_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out StringParameterDefinition_Type_Vectors.Vector);
type InputStepImpl_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.InputStepImpllinks_Type;
Id : Swagger.Nullable_UString;
Message : Swagger.Nullable_UString;
Ok : Swagger.Nullable_UString;
Parameters : .Models.StringParameterDefinition_Type_Vectors.Vector;
Submitter : Swagger.Nullable_UString;
end record;
package InputStepImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => InputStepImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in InputStepImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in InputStepImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out InputStepImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out InputStepImpl_Type_Vectors.Vector);
type PipelineStepImpl_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.PipelineStepImpllinks_Type;
Display_Name : Swagger.Nullable_UString;
Duration_In_Millis : Swagger.Nullable_Integer;
Id : Swagger.Nullable_UString;
Input : .Models.InputStepImpl_Type;
Result : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
end record;
package PipelineStepImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineStepImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineStepImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineStepImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineStepImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineStepImpl_Type_Vectors.Vector);
type BranchImplpermissions_Type is
record
Create : Swagger.Nullable_Boolean;
Read : Swagger.Nullable_Boolean;
Start : Swagger.Nullable_Boolean;
Stop : Swagger.Nullable_Boolean;
_class : Swagger.Nullable_UString;
end record;
package BranchImplpermissions_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => BranchImplpermissions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImplpermissions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImplpermissions_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImplpermissions_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImplpermissions_Type_Vectors.Vector);
type BranchImpl_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Full_Display_Name : Swagger.Nullable_UString;
Full_Name : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Parameters : .Models.StringParameterDefinition_Type_Vectors.Vector;
Permissions : .Models.BranchImplpermissions_Type;
Weather_Score : Swagger.Nullable_Integer;
Pull_Request : Swagger.Nullable_UString;
_links : .Models.BranchImpllinks_Type;
Latest_Run : .Models.PipelineRunImpl_Type;
end record;
package BranchImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => BranchImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BranchImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BranchImpl_Type_Vectors.Vector);
type PipelineBranchesitemlatestRun_Type is
record
Duration_In_Millis : Swagger.Nullable_Integer;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
En_Queue_Time : Swagger.Nullable_UString;
End_Time : Swagger.Nullable_UString;
Id : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Pipeline : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Run_Summary : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
P_Type : Swagger.Nullable_UString;
Commit_Id : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineBranchesitemlatestRun_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineBranchesitemlatestRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitemlatestRun_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitemlatestRun_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitemlatestRun_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitemlatestRun_Type_Vectors.Vector);
type PipelineBranchesitem_Type is
record
Display_Name : Swagger.Nullable_UString;
Estimated_Duration_In_Millis : Swagger.Nullable_Integer;
Name : Swagger.Nullable_UString;
Weather_Score : Swagger.Nullable_Integer;
Latest_Run : .Models.PipelineBranchesitemlatestRun_Type;
Organization : Swagger.Nullable_UString;
Pull_Request : .Models.PipelineBranchesitempullRequest_Type;
Total_Number_Of_Pull_Requests : Swagger.Nullable_Integer;
_class : Swagger.Nullable_UString;
end record;
package PipelineBranchesitem_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineBranchesitem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitem_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineBranchesitem_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitem_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineBranchesitem_Type_Vectors.Vector);
subtype PipelineBranches_Type is PipelineBranchesitem_Type_Vectors.Vector;
type PipelineFolderImpl_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Full_Name : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Organization : Swagger.Nullable_UString;
Number_Of_Folders : Swagger.Nullable_Integer;
Number_Of_Pipelines : Swagger.Nullable_Integer;
end record;
package PipelineFolderImpl_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineFolderImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineFolderImpl_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineFolderImpl_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineFolderImpl_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineFolderImpl_Type_Vectors.Vector);
subtype PipelineQueue_Type is QueueItemImpl_Type_Vectors.Vector;
type PipelineRunNodeedges_Type is
record
Id : Swagger.Nullable_UString;
_class : Swagger.Nullable_UString;
end record;
package PipelineRunNodeedges_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRunNodeedges_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunNodeedges_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunNodeedges_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunNodeedges_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunNodeedges_Type_Vectors.Vector);
type PipelineRunNode_Type is
record
_class : Swagger.Nullable_UString;
Display_Name : Swagger.Nullable_UString;
Duration_In_Millis : Swagger.Nullable_Integer;
Edges : .Models.PipelineRunNodeedges_Type_Vectors.Vector;
Id : Swagger.Nullable_UString;
Result : Swagger.Nullable_UString;
Start_Time : Swagger.Nullable_UString;
State : Swagger.Nullable_UString;
end record;
package PipelineRunNode_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PipelineRunNode_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunNode_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PipelineRunNode_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunNode_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PipelineRunNode_Type_Vectors.Vector);
subtype PipelineRunNodes_Type is PipelineRunNode_Type_Vectors.Vector;
subtype PipelineRunSteps_Type is GenericResource_Type_Vectors.Vector;
subtype Pipelines_Type is Pipeline_Type_Vectors.Vector;
type GithubRepositorypermissions_Type is
record
Admin : Swagger.Nullable_Boolean;
Push : Swagger.Nullable_Boolean;
Pull : Swagger.Nullable_Boolean;
_class : Swagger.Nullable_UString;
end record;
package GithubRepositorypermissions_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRepositorypermissions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorypermissions_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositorypermissions_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorypermissions_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositorypermissions_Type_Vectors.Vector);
type GithubRepository_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.GithubRepositorylinks_Type;
Default_Branch : Swagger.Nullable_UString;
Description : Swagger.Nullable_UString;
Name : Swagger.Nullable_UString;
Permissions : .Models.GithubRepositorypermissions_Type;
P_Private : Swagger.Nullable_Boolean;
Full_Name : Swagger.Nullable_UString;
end record;
package GithubRepository_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRepository_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepository_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepository_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepository_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepository_Type_Vectors.Vector);
type GithubRepositories_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.GithubRepositorieslinks_Type;
Items : .Models.GithubRepository_Type_Vectors.Vector;
Last_Page : Swagger.Nullable_Integer;
Next_Page : Swagger.Nullable_Integer;
Page_Size : Swagger.Nullable_Integer;
end record;
package GithubRepositories_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRepositories_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositories_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRepositories_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositories_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRepositories_Type_Vectors.Vector);
type GithubRespositoryContainer_Type is
record
_class : Swagger.Nullable_UString;
_links : .Models.GithubRespositoryContainerlinks_Type;
Repositories : .Models.GithubRepositories_Type;
end record;
package GithubRespositoryContainer_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => GithubRespositoryContainer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRespositoryContainer_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in GithubRespositoryContainer_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRespositoryContainer_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out GithubRespositoryContainer_Type_Vectors.Vector);
subtype ScmOrganisations_Type is GithubOrganization_Type_Vectors.Vector;
subtype Users_Type is User_Type_Vectors.Vector;
end .Models;
|
zhmu/ananas | Ada | 4,512 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . V A L U E _ I --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains routines for scanning signed integer values for use
-- in Text_IO.Integer_IO, and the Value attribute.
generic
type Int is range <>;
type Uns is mod <>;
with procedure Scan_Raw_Unsigned
(Str : String;
Ptr : not null access Integer;
Max : Integer;
Res : out Uns);
package System.Value_I is
pragma Preelaborate;
procedure Scan_Integer
(Str : String;
Ptr : not null access Integer;
Max : Integer;
Res : out Int);
-- This procedure scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
-- return:
--
-- If a valid integer is found after scanning past any initial spaces, then
-- Ptr.all is updated past the last character of the integer (but trailing
-- spaces are not scanned out).
--
-- If no valid integer is found, then Ptr.all points either to an initial
-- non-digit character, or to Max + 1 if the field is all spaces and the
-- exception Constraint_Error is raised.
--
-- If a syntactically valid integer is scanned, but the value is out of
-- range, or, in the based case, the base value is out of range or there
-- is an out of range digit, then Ptr.all points past the integer, and
-- Constraint_Error is raised.
--
-- Note: these rules correspond to the requirements for leaving the pointer
-- positioned in Text_Io.Get
--
-- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case.
function Value_Integer (Str : String) return Int;
-- Used in computing X'Value (Str) where X is a signed integer type whose
-- base range does not exceed the base range of Integer. Str is the string
-- argument of the attribute. Constraint_Error is raised if the string is
-- malformed, or if the value is out of range.
end System.Value_I;
|
stcarrez/dynamo | Ada | 896 | ads | -----------------------------------------------------------------------
-- Test -- Test the code generation
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package Gen.Permissions is
end Gen.Permissions;
|
reznikmm/matreshka | Ada | 4,717 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Text_Printed_By_Elements;
package Matreshka.ODF_Text.Printed_By_Elements is
type Text_Printed_By_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_Printed_By_Elements.ODF_Text_Printed_By
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Printed_By_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Printed_By_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_Printed_By_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Text_Printed_By_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Text_Printed_By_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Text.Printed_By_Elements;
|
Rodeo-McCabe/orka | Ada | 1,517 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.SIMD.SSE.Singles.Arithmetic;
with Orka.SIMD.SSE.Singles.Swizzle;
package body Orka.SIMD.SSE.Singles.Math is
function Cross_Product (Left, Right : m128) return m128 is
use SIMD.SSE.Singles.Arithmetic;
use SIMD.SSE.Singles.Swizzle;
Mask_1_2_0_3 : constant Unsigned_32 := 1 or 2 * 4 or 0 * 16 or 3 * 64;
Left_YZX : constant m128 := Shuffle (Left, Left, Mask_1_2_0_3);
Right_YZX : constant m128 := Shuffle (Right, Right, Mask_1_2_0_3);
-- Z := Left (X) * Right (Y) - Left (Y) * Right (X)
-- X := Left (Y) * Right (Z) - Left (Z) * Right (Y)
-- Y := Left (Z) * Right (X) - Left (X) * Right (Z)
Result_ZXY : constant m128 := Left * Right_YZX - Left_YZX * Right;
begin
return Shuffle (Result_ZXY, Result_ZXY, Mask_1_2_0_3);
end Cross_Product;
end Orka.SIMD.SSE.Singles.Math;
|
MinimSecure/unum-sdk | Ada | 944 | adb | -- Copyright 2008-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Types is
function Ident (O : Object'Class) return Object'Class is
begin
return O;
end Ident;
procedure Do_Nothing (O : in out Object'Class) is
begin
null;
end Do_Nothing;
end Types;
|
ohenley/awt | Ada | 9,876 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Real_Time;
with Ada.Strings.Fixed;
with Orka.Logging;
with Orka.OS;
with Orka.Terminals;
with EGL.Objects.Configs;
with EGL.Objects.Surfaces;
with Wayland.Protocols.Client.AWT;
package body Orka.Contexts.EGL.AWT is
use all type Orka.Logging.Source;
use all type Orka.Logging.Severity;
use Orka.Logging;
package Messages is new Orka.Logging.Messages (Window_System);
procedure Print_Monitor (Monitor : Standard.AWT.Monitors.Monitor'Class) is
State : constant Standard.AWT.Monitors.Monitor_State := Monitor.State;
use Standard.AWT.Monitors;
begin
Messages.Log (Debug, "Window visible on monitor");
Messages.Log (Debug, " name: " & (+State.Name));
Messages.Log (Debug, " offset: " &
Trim (State.X'Image) & ", " & Trim (State.Y'Image));
Messages.Log (Debug, " size: " &
Trim (State.Width'Image) & " × " & Trim (State.Height'Image));
Messages.Log (Debug, " refresh: " & Orka.Terminals.Image (State.Refresh));
end Print_Monitor;
use all type Standard.AWT.Inputs.Dimension;
use all type Standard.AWT.Inputs.Button_State;
use all type Standard.AWT.Inputs.Pointer_Button;
use all type Standard.AWT.Inputs.Pointer_Mode;
----------------------------------------------------------------------------
overriding
function Width (Object : AWT_Window) return Positive is
State : Standard.AWT.Windows.Framebuffer_State renames Object.State;
begin
return State.Width;
end Width;
overriding
function Height (Object : AWT_Window) return Positive is
State : Standard.AWT.Windows.Framebuffer_State renames Object.State;
begin
return State.Height;
end Height;
overriding
function Position_X (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Position (X));
end Position_X;
overriding
function Position_Y (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Position (Y));
end Position_Y;
overriding
function Delta_X (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Relative (X));
end Delta_X;
overriding
function Delta_Y (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Relative (Y));
end Delta_Y;
overriding
function Scroll_X (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Scroll (X));
end Scroll_X;
overriding
function Scroll_Y (Object : AWT_Pointer) return GL.Types.Double is
begin
return GL.Types.Double (Object.Window.State.Scroll (Y));
end Scroll_Y;
overriding
function Locked (Object : AWT_Pointer) return Boolean is
begin
return Object.Window.State.Mode = Locked;
end Locked;
overriding
function Visible (Object : AWT_Pointer) return Boolean is
begin
return Object.Window.State.Mode = Visible;
end Visible;
overriding
function Button_Pressed
(Object : AWT_Pointer;
Subject : Orka.Inputs.Pointers.Button) return Boolean is
begin
return Object.Window.State.Buttons
(case Subject is
when Orka.Inputs.Pointers.Left => Left,
when Orka.Inputs.Pointers.Right => Right,
when Orka.Inputs.Pointers.Middle => Middle) = Pressed;
end Button_Pressed;
overriding
procedure Lock_Pointer (Object : in out AWT_Pointer; Locked : Boolean) is
begin
Object.Window.Set_Pointer_Mode (if Locked then Standard.AWT.Inputs.Locked else Visible);
end Lock_Pointer;
overriding
procedure Set_Visible (Object : in out AWT_Pointer; Visible : Boolean) is
begin
Object.Window.Set_Pointer_Mode (if Visible then Standard.AWT.Inputs.Visible else Hidden);
end Set_Visible;
----------------------------------------------------------------------------
overriding
function Pointer_Input (Object : AWT_Window)
return Orka.Inputs.Pointers.Pointer_Input_Ptr is
begin
return Object.Pointer'Unrestricted_Access;
end Pointer_Input;
overriding
procedure Process_Input (Object : in out AWT_Window) is
Interval : constant Duration := 0.016_667;
Result : constant Boolean := Standard.AWT.Process_Events (Interval);
begin
if not Result then
raise Program_Error;
end if;
end Process_Input;
overriding
procedure Sleep_Until_Swap
(Object : in out AWT_Window;
Time_To_Swap : Duration)
is
Sleep : constant Duration := Time_To_Swap - Orka.OS.Monotonic_Clock;
use Ada.Real_Time;
begin
delay until Clock + To_Time_Span (Sleep);
end Sleep_Until_Swap;
overriding
procedure On_Move
(Object : in out AWT_Window;
Monitor : Standard.AWT.Monitors.Monitor'Class;
Presence : Standard.AWT.Windows.Monitor_Presence)
is
use all type Standard.AWT.Windows.Monitor_Presence;
use Standard.AWT.Monitors;
begin
case Presence is
when Entered =>
Print_Monitor (Monitor);
when Left =>
Messages.Log (Debug, "Window no longer visible on monitor");
Messages.Log (Debug, " name: " & (+Monitor.State.Name));
end case;
end On_Move;
----------------------------------------------------------------------------
overriding
procedure Make_Current
(Object : AWT_Context;
Window : in out Orka.Windows.Window'Class) is
begin
if Window not in AWT_Window'Class then
raise Constraint_Error;
end if;
declare
Subject : AWT_Window renames AWT_Window (Window);
begin
Subject.Make_Current (Object.Context);
end;
end Make_Current;
overriding
function Create_Context
(Version : Orka.Contexts.Context_Version;
Flags : Orka.Contexts.Context_Flags := (others => False)) return AWT_Context is
begin
return Create_Context
(Wayland.Protocols.Client.AWT.Get_Display (Standard.AWT.Wayland.Get_Display.all),
Version, Flags);
end Create_Context;
overriding
function Create_Window
(Context : Orka.Contexts.Surface_Context'Class;
Width, Height : Positive;
Title : String := "";
Samples : Natural := 0;
Visible, Resizable : Boolean := True;
Transparent : Boolean := False) return AWT_Window
is
package EGL_Configs renames Standard.EGL.Objects.Configs;
package EGL_Surfaces renames Standard.EGL.Objects.Surfaces;
use all type Standard.EGL.Objects.Contexts.Buffer_Kind;
use type EGL_Configs.Config;
package SF renames Ada.Strings.Fixed;
Object : AWT_Context renames AWT_Context (Context);
begin
return Result : AWT_Window do
declare
Configs : constant EGL_Configs.Config_Array :=
EGL_Configs.Get_Configs
(Object.Context.Display,
8, 8, 8, (if Transparent then 8 else 0),
24, 8, EGL_Configs.Sample_Size (Samples));
Used_Config : EGL_Configs.Config renames Configs (Configs'First);
begin
Messages.Log (Debug, "EGL configs: (" & Trim (Natural'Image (Configs'Length)) & ")");
Messages.Log (Debug, " Re Gr Bl Al De St Ms");
Messages.Log (Debug, " --------------------");
for Config of Configs loop
declare
State : constant EGL_Configs.Config_State := Config.State;
begin
Messages.Log (Debug, " - " &
SF.Tail (Trim (State.Red'Image), 2) & " " &
SF.Tail (Trim (State.Green'Image), 2) & " " &
SF.Tail (Trim (State.Blue'Image), 2) & " " &
SF.Tail (Trim (State.Alpha'Image), 2) & " " &
SF.Tail (Trim (State.Depth'Image), 2) & " " &
SF.Tail (Trim (State.Stencil'Image), 2) & " " &
SF.Tail (Trim (State.Samples'Image), 2) &
(if Config = Used_Config then " (used)" else ""));
end;
end loop;
Result.Set_EGL_Data (Object.Context, Used_Config, sRGB => True);
Result.Create_Window ("", Title, Width, Height,
Visible => Visible,
Resizable => Resizable,
Decorated => True,
Transparent => Transparent);
Result.Make_Current (Object.Context);
pragma Assert (Object.Context.Buffer = Back);
Messages.Log (Debug, "Created AWT window");
Messages.Log (Debug, " size: " &
Trim (Width'Image) & " × " & Trim (Height'Image));
Messages.Log (Debug, " visible: " & (if Visible then "yes" else "no"));
Messages.Log (Debug, " resizable: " & (if Resizable then "yes" else "no"));
Messages.Log (Debug, " transparent: " & (if Transparent then "yes" else "no"));
end;
end return;
end Create_Window;
end Orka.Contexts.EGL.AWT;
|
reznikmm/matreshka | Ada | 3,674 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Table_Operation_Elements is
pragma Preelaborate;
type ODF_Table_Operation is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Operation_Access is
access all ODF_Table_Operation'Class
with Storage_Size => 0;
end ODF.DOM.Table_Operation_Elements;
|
AdaCore/libadalang | Ada | 803 | ads | package Test is
procedure Foo (X, Y : Integer);
--% ids = node.f_subp_spec.f_subp_params.f_params[0].f_ids
--% ids[0].p_next_part()
--% ids[1].p_next_part()
procedure Bar (X : Integer; Y : Integer);
--% params = node.f_subp_spec.f_subp_params.f_params
--% params[0].f_ids[0].p_next_part()
--% params[1].f_ids[0].p_next_part()
private
procedure Foo (X : Integer; Y : Integer) is null;
--% params = node.f_subp_spec.f_subp_params.f_params
--% params[0].f_ids[0].p_previous_part()
--% params[1].f_ids[0].p_previous_part()
procedure Bar (X, Y : Integer) is null;
--% ids = node.f_subp_spec.f_subp_params.f_params[0].f_ids
--% ids[0].p_previous_part()
--% ids[1].p_previous_part()
--% ids[0].p_canonical_part()
--% ids[1].p_canonical_part()
end Test;
|
charlie5/cBound | Ada | 1,836 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_histogram_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context_tag : aliased xcb.xcb_glx_context_tag_t;
target : aliased Interfaces.Unsigned_32;
format : aliased Interfaces.Unsigned_32;
the_type : aliased Interfaces.Unsigned_32;
swap_bytes : aliased Interfaces.Unsigned_8;
reset : aliased Interfaces.Unsigned_8;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_histogram_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_histogram_request_t.Item,
Element_Array => xcb.xcb_glx_get_histogram_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_histogram_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_histogram_request_t.Pointer,
Element_Array => xcb.xcb_glx_get_histogram_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_histogram_request_t;
|
persan/AdaYaml | Ada | 272 | ads | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with AUnit.Test_Suites;
package Yaml.Dumping_Tests.Suite is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
end Yaml.Dumping_Tests.Suite;
|
burratoo/Acton | Ada | 2,266 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK COMPONENTS --
-- --
-- OAK.STORAGE.BINARY_HEAP --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
generic
type Item_Type is private;
pragma Preelaborable_Initialization (Item_Type);
No_Item : Item_Type;
Size : Positive;
with function ">" (Left, Right : Item_Type) return Boolean is <>;
-- package Oak.Storage.Binary_Heap with Pure is
package Oak.Storage.Binary_Heap is
pragma Pure;
Heap_Capacity_Error : exception;
type Heap_Type is private with Preelaborable_Initialization;
procedure Add_Item (To_Heap : in out Heap_Type;
Item : in Item_Type);
-- Adds an item to the priority queue
procedure Remove_Top (From_Heap : in out Heap_Type;
Item : out Item_Type);
-- Removes the first item from the priority queue. Returns an empty element
-- if the queue is empty.
function First_Item (From_Heap : in out Heap_Type) return Item_Type;
function Is_Heap_Full (Heap : in Heap_Type) return Boolean;
private
subtype Index_Type is Natural;
type Heap_Array is array (Index_Type range 1 .. Size) of Item_Type;
type Heap_Type is record
Size : Index_Type := 0;
Items : Heap_Array;
end record;
function Is_Heap_Full (Heap : in Heap_Type) return Boolean is
(Heap.Size = Heap.Items'Last);
function First_Item (From_Heap : in out Heap_Type) return Item_Type is
(if From_Heap.Size > 0 then From_Heap.Items (From_Heap.Items'First)
else No_Item);
end Oak.Storage.Binary_Heap;
|
AdaCore/libadalang | Ada | 186 | adb | with Libadalang.Helpers;
procedure Main is
package App is new Libadalang.Helpers.App
(Name => "example",
Description => "Example app");
begin
App.Run;
end Main;
|
AdaCore/Ada_Drivers_Library | Ada | 3,579 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
package body Ravenscar_Time is
Delay_Singleton : aliased Ravenscar_Delays;
------------
-- Delays --
------------
function Delays return not null HAL.Time.Any_Delays is
begin
return Delay_Singleton'Access;
end Delays;
------------------------
-- Delay_Microseconds --
------------------------
overriding procedure Delay_Microseconds
(This : in out Ravenscar_Delays;
Us : Integer)
is
pragma Unreferenced (This);
begin
delay until Clock + Microseconds (Us);
end Delay_Microseconds;
------------------------
-- Delay_Milliseconds --
------------------------
overriding procedure Delay_Milliseconds
(This : in out Ravenscar_Delays;
Ms : Integer)
is
pragma Unreferenced (This);
begin
delay until Clock + Milliseconds (Ms);
end Delay_Milliseconds;
-------------------
-- Delay_Seconds --
-------------------
overriding procedure Delay_Seconds
(This : in out Ravenscar_Delays;
S : Integer)
is
pragma Unreferenced (This);
begin
delay until Clock + Seconds (S);
end Delay_Seconds;
end Ravenscar_Time;
|
reznikmm/matreshka | Ada | 3,724 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Section_Name_Attributes is
pragma Preelaborate;
type ODF_Text_Section_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Section_Name_Attribute_Access is
access all ODF_Text_Section_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Section_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Form_Multi_Line_Attributes is
pragma Preelaborate;
type ODF_Form_Multi_Line_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Form_Multi_Line_Attribute_Access is
access all ODF_Form_Multi_Line_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Form_Multi_Line_Attributes;
|
stcarrez/ada-util | Ada | 1,375 | ads | -----------------------------------------------------------------------
-- util-streams-buffered-lzma-tests -- Unit tests for LZMA buffered streams
-- Copyright (C) 2018, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Streams.Buffered.Lzma.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Compress_Stream (T : in out Test);
procedure Test_Compress_File_Stream (T : in out Test);
procedure Test_Compress_Decompress_Stream (T : in out Test);
procedure Test_Compress_Encrypt_Decompress_Decrypt_Stream (T : in out Test);
end Util.Streams.Buffered.Lzma.Tests;
|
AdaCore/Ada_Drivers_Library | Ada | 5,327 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2022, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package defines an abstract data type for a "serial port" providing
-- non-blocking input (Receive) and output (Send) procedures. The procedures
-- are considered non-blocking because they return to the caller (potentially)
-- before the entire message is received or sent.
--
-- The serial port abstraction is a wrapper around a USART peripheral,
-- described by a value of type Peripheral_Descriptor.
--
-- Interrupts are used to send and receive characters.
--
-- NB: clients must not send or receive messages until any prior sending or
-- receiving is completed.
with Message_Buffers; use Message_Buffers;
with Ada.Interrupts; use Ada.Interrupts;
with System; use System;
package Serial_IO.Nonblocking is
pragma Elaborate_Body;
type Serial_Port
(Device : not null access Peripheral_Descriptor;
IRQ : Interrupt_ID;
IRQ_Priority : Interrupt_Priority)
is limited private;
procedure Initialize_Hardware (This : in out Serial_Port);
-- A convenience wrapper for Serial_IO.Initialize_Hardware
procedure Configure
(This : in out Serial_Port;
Baud_Rate : Baud_Rates;
Parity : Parities := No_Parity;
Data_Bits : Word_Lengths := Word_Length_8;
End_Bits : Stop_Bits := Stopbits_1;
Control : Flow_Control := No_Flow_Control);
-- A convenience wrapper for Serial_IO.Configure
procedure Send
(This : in out Serial_Port;
Msg : not null access Message)
with Inline;
-- Start sending the content of Msg.all, returning potentially
-- prior to the completion of the message transmission
procedure Receive
(This : in out Serial_Port;
Msg : not null access Message)
with
Post => Msg.Length <= Msg.Physical_Size and
(if Msg.Length > 0 then Msg.Content_At (Msg.Length) /= Msg.Terminator),
Inline;
-- Start receiving Msg.all content, ending when the specified
-- Msg.Terminator character is received (it is not stored), or
-- the physical capacity of Msg.all is reached
private
protected type Serial_Port
(Device : not null access Peripheral_Descriptor;
IRQ : Interrupt_ID;
IRQ_Priority : Interrupt_Priority)
-- with
-- Interrupt_Priority => IRQ_Priority
is
pragma Interrupt_Priority (IRQ_Priority);
-- use pragma as workaround for bug in CE_2021 frontend (V523-041)
procedure Start_Sending (Msg : not null access Message);
procedure Start_Receiving (Msg : not null access Message);
private
Next_Out : Positive;
Outgoing_Msg : access Message;
Incoming_Msg : access Message;
procedure Handle_Transmission with Inline;
procedure Handle_Reception with Inline;
procedure Detect_Errors (Is_Xmit_IRQ : Boolean) with Inline;
procedure ISR with Attach_Handler => IRQ;
end Serial_Port;
end Serial_IO.Nonblocking;
|
mirror/ncurses | Ada | 6,959 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020,2021 Thomas E. Dickey --
-- Copyright 2000-2014,2015 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.9 $
-- $Date: 2021/09/04 10:52:55 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
-- test effects of overlapping windows
procedure ncurses2.overlap_test is
procedure fillwin (win : Window; ch : Character);
procedure crosswin (win : Window; ch : Character);
procedure fillwin (win : Window; ch : Character) is
y1 : Line_Position;
x1 : Column_Position;
begin
Get_Size (win, y1, x1);
for y in 0 .. y1 - 1 loop
Move_Cursor (win, y, 0);
for x in 0 .. x1 - 1 loop
Add (win, Ch => ch);
end loop;
end loop;
exception
when Curses_Exception => null;
-- write to lower right corner
end fillwin;
procedure crosswin (win : Window; ch : Character) is
y1 : Line_Position;
x1 : Column_Position;
begin
Get_Size (win, y1, x1);
for y in 0 .. y1 - 1 loop
for x in 0 .. x1 - 1 loop
if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) or
(((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3)))
then
Move_Cursor (win, y, x);
Add (win, Ch => ch);
end if;
end loop;
end loop;
end crosswin;
-- In a 24x80 screen like some xterms are, the instructions will
-- be overwritten.
ch : Character;
win1 : Window := New_Window (9, 20, 3, 3);
win2 : Window := New_Window (9, 20, 9, 16);
begin
Set_Raw_Mode (SwitchOn => True);
Refresh;
Move_Cursor (Line => 0, Column => 0);
Add (Str => "This test shows the behavior of wnoutrefresh() with " &
"respect to");
Add (Ch => newl);
Add (Str => "the shared region of two overlapping windows A and B. " &
"The cross");
Add (Ch => newl);
Add (Str => "pattern in each window does not overlap the other.");
Add (Ch => newl);
Move_Cursor (Line => 18, Column => 0);
Add (Str => "a = refresh A, then B, then doupdate. b = refresh B, " &
"then A, then doupdate");
Add (Ch => newl);
Add (Str => "c = fill window A with letter A. d = fill window B " &
"with letter B.");
Add (Ch => newl);
Add (Str => "e = cross pattern in window A. f = cross pattern " &
"in window B.");
Add (Ch => newl);
Add (Str => "g = clear window A. h = clear window B.");
Add (Ch => newl);
Add (Str => "i = overwrite A onto B. j = overwrite " &
"B onto A.");
Add (Ch => newl);
Add (Str => "^Q/ESC = terminate test.");
loop
ch := Code_To_Char (Getchar);
exit when ch = CTRL ('Q') or ch = CTRL ('['); -- QUIT or ESCAPE
case ch is
when 'a' => -- refresh window A first, then B
Refresh_Without_Update (win1);
Refresh_Without_Update (win2);
Update_Screen;
when 'b' => -- refresh window B first, then A
Refresh_Without_Update (win2);
Refresh_Without_Update (win1);
Update_Screen;
when 'c' => -- fill window A so it is visible
fillwin (win1, 'A');
when 'd' => -- fill window B so it is visible
fillwin (win2, 'B');
when 'e' => -- cross test pattern in window A
crosswin (win1, 'A');
when 'f' => -- cross test pattern in window B
crosswin (win2, 'B');
when 'g' => -- clear window A
Clear (win1);
Move_Cursor (win1, 0, 0);
when 'h' => -- clear window B
Clear (win2);
Move_Cursor (win2, 0, 0);
when 'i' => -- overwrite A onto B
Overwrite (win1, win2);
when 'j' => -- overwrite B onto A
Overwrite (win2, win1);
when others => null;
end case;
end loop;
Delete (win2);
Delete (win1);
Erase;
End_Windows;
end ncurses2.overlap_test;
|
reznikmm/matreshka | Ada | 4,647 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Form.Navigation_Mode_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Form_Navigation_Mode_Attribute_Node is
begin
return Self : Form_Navigation_Mode_Attribute_Node do
Matreshka.ODF_Form.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Form_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Form_Navigation_Mode_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Navigation_Mode_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Form_URI,
Matreshka.ODF_String_Constants.Navigation_Mode_Attribute,
Form_Navigation_Mode_Attribute_Node'Tag);
end Matreshka.ODF_Form.Navigation_Mode_Attributes;
|
reznikmm/matreshka | Ada | 6,760 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Frame_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Frame_Element_Node is
begin
return Self : Draw_Frame_Element_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Draw_Frame_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Draw_Frame
(ODF.DOM.Draw_Frame_Elements.ODF_Draw_Frame_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Frame_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Frame_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Draw_Frame_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Draw_Frame
(ODF.DOM.Draw_Frame_Elements.ODF_Draw_Frame_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Draw_Frame_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Draw_Frame
(Visitor,
ODF.DOM.Draw_Frame_Elements.ODF_Draw_Frame_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Frame_Element,
Draw_Frame_Element_Node'Tag);
end Matreshka.ODF_Draw.Frame_Elements;
|
MinimSecure/unum-sdk | Ada | 925 | adb | -- Copyright 2015-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pack;
procedure Fun_Renaming is
function N (I : Integer) return Integer renames Pack.Next;
begin
Pack.Discard (N (1)); -- BREAK
Pack.Discard (Pack.Renamed_Next (1)); -- BREAK
end Fun_Renaming;
|
reznikmm/matreshka | Ada | 5,141 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.CMOF.Classes;
with AMF.CMOF.Properties;
with AMF.Extents;
with AMF.Internals.Elements;
with League.Holders;
package AMF.Internals.MOF_Elements is
type MOF_Element_Proxy is
abstract limited new AMF.Internals.Elements.Element_Base with null record;
overriding function Get
(Self : not null access constant MOF_Element_Proxy;
Property : not null AMF.CMOF.Properties.CMOF_Property_Access)
return League.Holders.Holder;
overriding function Get_Meta_Class
(Self : not null access constant MOF_Element_Proxy)
return AMF.CMOF.Classes.CMOF_Class_Access;
-- overriding function Get_Owned_Comment
-- (Self : not null access constant CMOF_Element_Proxy)
-- return AMF.CMOF.Comments.Collections.Set_Of_CMOF_Comment;
--
-- overriding function Get_Owned_Element
-- (Self : not null access constant CMOF_Element_Proxy)
-- return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element;
--
-- overriding function Get_Owner
-- (Self : not null access constant CMOF_Element_Proxy)
-- return AMF.CMOF.Elements.CMOF_Element_Access;
overriding procedure Set
(Self : not null access MOF_Element_Proxy;
Property : not null AMF.CMOF.Properties.CMOF_Property_Access;
Value : League.Holders.Holder);
overriding function Extent
(Self : not null access constant MOF_Element_Proxy)
return AMF.Extents.Extent_Access;
-- overriding function Must_Be_Owned
-- (Self : not null access constant MOF_Element_Proxy) return Boolean;
-- -- Operation Element::mustBeOwned.
-- --
-- -- The query mustBeOwned() indicates whether elements of this type must
-- -- have an owner. Subclasses of Element that do not require an owner must
-- -- override this operation.
end AMF.Internals.MOF_Elements;
|
symengine/symengine.ada | Ada | 3,468 | ads | with Ada.Finalization;
with symengine_cwrapper;
use symengine_cwrapper;
package symengine is
type Basic is tagged private;
type BasicArray is array (Positive range <>) of Basic;
type SymInteger is new Basic with private;
type Rational is new Basic with private;
type RealDouble is new Basic with private;
type Symbol is new Basic with private;
SymEngineException : exception;
procedure Initialize(self : in out Basic);
procedure Adjust(self : in out Basic);
procedure Finalize(self : in out Basic);
function str(self : Basic) return String;
function parse(str : string) return Basic;
function "=" (left, right : Basic'Class) return Boolean;
function "+" (left, right : Basic'Class) return Basic;
function "+" (left : Basic'Class; right : Integer) return Basic;
function "+" (left : Integer; right : Basic'Class) return Basic;
function "+" (left : Basic'Class; right : Float) return Basic;
function "+" (left : Float; right : Basic'Class) return Basic;
function "+" (right : Basic'Class) return Basic;
function "-" (left, right : Basic'Class) return Basic;
function "-" (left : Basic'Class; right : Integer) return Basic;
function "-" (left : Integer; right : Basic'Class) return Basic;
function "-" (left : Basic'Class; right : Float) return Basic;
function "-" (left : Float; right : Basic'Class) return Basic;
function "-" (right : Basic'Class) return Basic;
function "*" (left, right : Basic'Class) return Basic;
function "*" (left : Basic'Class; right : Integer) return Basic;
function "*" (left : Integer; right : Basic'Class) return Basic;
function "*" (left : Basic'Class; right : Float) return Basic;
function "*" (left : Float; right : Basic'Class) return Basic;
function "/" (left, right : Basic'Class) return Basic;
function "/" (left : Basic'Class; right : Integer) return Basic;
function "/" (left : Integer; right : Basic'Class) return Basic;
function "/" (left : Basic'Class; right : Float) return Basic;
function "/" (left : Float; right : Basic'Class) return Basic;
function "**" (left, right : Basic'Class) return Basic;
function "**" (left : Basic'Class; right : Integer) return Basic;
function "**" (left : Integer; right : Basic'Class) return Basic;
function "**" (left : Basic'Class; right : Float) return Basic;
function "**" (left : Float; right : Basic'Class) return Basic;
function "abs"(x : Basic) return Basic;
function pi return Basic;
function e return Basic;
function log(x : Basic) return Basic;
function exp(x : Basic) return Basic;
function sin(x : Basic) return Basic;
function cos(x : Basic) return Basic;
function tan(x : Basic) return Basic;
function atan2(x, y : Basic) return Basic;
function max(a : BasicArray) return Basic;
function min(a : BasicArray) return Basic;
function new_integer(x : Integer) return SymInteger;
function new_rational(a, b : Integer) return Rational;
function new_real_double(x : Float) return RealDouble;
function new_symbol(s : String) return Symbol;
private
type Basic is new Ada.Finalization.Controlled with record
ptr : cptr;
end record;
type SymInteger is new Basic with null record;
type Rational is new Basic with null record;
type RealDouble is new Basic with null record;
type Symbol is new Basic with null record;
end symengine;
|
apsdehal/Programming-Languages-Assignments | Ada | 257 | ads | generic
with function F(X: Float) return Float;
package AdaptiveQuad is
function SimpsonsRule(A, B: in Float) return Float;
function AQuad(A, B, Eps: in Float) return Float;
function RecAQuad(A, B, Eps, Whole: in Float) return Float;
end AdaptiveQuad;
|
reznikmm/matreshka | Ada | 3,804 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Extrusion_Second_Light_Harsh_Attributes is
pragma Preelaborate;
type ODF_Draw_Extrusion_Second_Light_Harsh_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Extrusion_Second_Light_Harsh_Attribute_Access is
access all ODF_Draw_Extrusion_Second_Light_Harsh_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Extrusion_Second_Light_Harsh_Attributes;
|
AdaCore/libadalang | Ada | 66,037 | adb | ------------------------------------------------------------------------------
-- --
-- GPR PROJECT MANAGER --
-- --
-- Copyright (C) 2001-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.Table;
with GPR.Attr.PM;
with GPR.Com;
with GPR.Env;
with GPR.Names; use GPR.Names;
with GPR.Opt;
with GPR.Osint; use GPR.Osint;
with GPR.Part;
with GPR.PP;
with GPR.Tree; use GPR.Tree;
with GPR.Snames; use GPR.Snames;
with GPR.Tempdir;
with GPR.Util; use GPR.Util;
with GprConfig.Sdefault;
with Gpr_Util; use Gpr_Util;
with System.Case_Util; use System.Case_Util;
with System.CRTL;
with System.HTable;
with System.Regexp; use System.Regexp;
package body GPRName is
use Gpr_Util.Project_Output;
-- Packages of project files where unknown attributes are errors
-- All the following need comments ??? All global variables and
-- subprograms must be fully commented.
Very_Verbose : Boolean := False;
-- Set in call to Initialize to indicate very verbose output
Tree : constant GPR.Project_Node_Tree_Ref := new Project_Node_Tree_Data;
-- The project tree where the project file is parsed
Root_Environment : GPR.Tree.Environment;
Args : Argument_List_Access;
-- The list of arguments for calls to the compiler to get the unit names
-- and kinds (spec or body) in the Ada sources.
Path_Name : String_Access;
Path_Last : Natural;
Directory_Last : Natural := 0;
Output_Name : String_Access;
Output_Name_Last : Natural;
Output_Name_Id : Name_Id;
Project_Naming_File_Name : String_Access;
-- String (1 .. Output_Name'Length + Naming_File_Suffix'Length);
Project_Naming_Last : Natural;
Project_Naming_Id : Name_Id := No_Name;
Source_List_Path : String_Access;
-- (1 .. Output_Name'Length + Source_List_File_Suffix'Length);
Source_List_Last : Natural;
Source_List_FD : File_Descriptor;
Project_Node : Project_Node_Id := Empty_Project_Node;
Project_Declaration : Project_Node_Id := Empty_Project_Node;
Source_Dirs_List : Project_Node_Id := Empty_Project_Node;
Languages_List : Project_Node_Id := Empty_Project_Node;
Project_Naming_Node : Project_Node_Id := Empty_Project_Node;
Project_Naming_Decl : Project_Node_Id := Empty_Project_Node;
Naming_Package : Project_Node_Id := Empty_Project_Node;
Naming_Package_Comments : Project_Node_Id := Empty_Project_Node;
Source_Files_Comments : Project_Node_Id := Empty_Project_Node;
Source_Dirs_Comments : Project_Node_Id := Empty_Project_Node;
Source_List_File_Comments : Project_Node_Id := Empty_Project_Node;
Languages_Comments : Project_Node_Id := Empty_Project_Node;
function Dup (Fd : File_Descriptor) return File_Descriptor;
-- Create a copy of Fd and returns it
procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
-- Close New_Fd if necessary and copy Old_Fd into New_Fd
Non_Empty_Node : constant Project_Node_Id := 1;
-- Used for the With_Clause of the naming project
type Matched_Type is (Match, No_Match, Excluded);
Naming_File_Suffix : constant String := "_naming";
Source_List_File_Suffix : constant String := "_source_list.txt";
package Processed_Directories is new GNAT.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
-- The list of already processed directories for each section, to avoid
-- processing several times the same directory in the same section.
package Source_Directories is new GNAT.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
-- The complete list of directories to be put in attribute Source_Dirs in
-- the project file.
type Source is record
File_Name : Name_Id;
Unit_Name : Name_Id;
Index : Int := 0;
Spec : Boolean;
end record;
package Sources is new GNAT.Table
(Table_Component_Type => Source,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
-- The list of Ada sources found, with their unit name and kind, to be put
-- in the source attribute and package Naming of the project file, or in
-- the pragmas Source_File_Name in the configuration pragmas file.
type Foreign_Source is record
Language : Name_Id;
File_Name : Name_Id;
end record;
package Foreign_Sources is new GNAT.Table
(Table_Component_Type => Foreign_Source,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
package Source_Files is new System.HTable.Simple_HTable
(Header_Num => GPR.Header_Num,
Element => Boolean,
No_Element => False,
Key => Name_Id,
Hash => GPR.Hash,
Equal => "=");
-- Hash table to keep track of source file names, to avoid putting several
-- times the same file name in case of multi-unit files.
package Languages is new GNAT.Table
(Table_Component_Type => Name_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
procedure Add_Language (Lang : Name_Id);
-- Add Lang to the list of languages
------------------
-- Add_Language --
------------------
procedure Add_Language (Lang : Name_Id) is
begin
for J in 1 .. Languages.Last loop
if Languages.Table (J) = Lang then
return;
end if;
end loop;
Languages.Append (Lang);
end Add_Language;
---------
-- Dup --
---------
function Dup (Fd : File_Descriptor) return File_Descriptor is
begin
return File_Descriptor (System.CRTL.dup (Integer (Fd)));
end Dup;
----------
-- Dup2 --
----------
procedure Dup2 (Old_Fd, New_Fd : File_Descriptor) is
Fd : Integer;
pragma Warnings (Off, Fd);
begin
Fd := System.CRTL.dup2 (Integer (Old_Fd), Integer (New_Fd));
end Dup2;
--------------
-- Finalize --
--------------
procedure Finalize is
Discard : Boolean;
pragma Warnings (Off, Discard);
Current_Source_Dir : Project_Node_Id := Empty_Project_Node;
Current_Language_Node : Project_Node_Id := Empty_Project_Node;
Naming_Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item,
In_Tree => Tree);
Naming : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Package_Declaration,
In_Tree => Tree);
procedure Check_Duplicates
(Current_Source : Source;
Source_Index : Natural;
Result : out Natural);
-- Check for duplicated source file+index in
-- Source.Table (1 .. Source_Index - 1) and set Result to the relevant
-- index if any. Set Result to 0 if not found.
----------------------
-- Check_Duplicates --
----------------------
procedure Check_Duplicates
(Current_Source : Source;
Source_Index : Natural;
Result : out Natural) is
begin
Result := 0;
for J in reverse 1 .. Source_Index - 1 loop
declare
S : Source renames Sources.Table (J);
begin
if S.File_Name = Current_Source.File_Name
and then S.Index = Current_Source.Index
then
Result := J;
return;
end if;
end;
end loop;
end Check_Duplicates;
begin
-- If there were no already existing project file, or if the parsing was
-- unsuccessful, create an empty project node with the correct name and
-- its project declaration node.
if No (Project_Node) then
Project_Node :=
Default_Project_Node (Of_Kind => N_Project, In_Tree => Tree);
Set_Name_Of (Project_Node, Tree, To => Output_Name_Id);
Set_Project_Declaration_Of
(Project_Node, Tree,
To => Default_Project_Node
(Of_Kind => N_Project_Declaration, In_Tree => Tree));
end if;
-- Delete the file if it already exists
Delete_File
(Path_Name (Directory_Last + 1 .. Path_Last),
Success => Discard);
-- Create a new one
if Opt.Verbose_Mode then
Put ("Creating new file """);
Put (Path_Name (Directory_Last + 1 .. Path_Last));
Put_Line ("""");
end if;
Output_FD := Create_New_File
(Path_Name (Directory_Last + 1 .. Path_Last),
Fmode => Text);
-- Fails if project file cannot be created
if Output_FD = Invalid_FD then
GPR.Com.Fail
("cannot create new """ & Path_Name (1 .. Path_Last) & """");
end if;
-- Delete the source list file, if it already exists
declare
Discard : Boolean;
pragma Warnings (Off, Discard);
begin
Delete_File
(Source_List_Path (1 .. Source_List_Last),
Success => Discard);
end;
-- And create a new source list file, fail if file cannot be created
Source_List_FD := Create_New_File
(Name => Source_List_Path (1 .. Source_List_Last),
Fmode => Text);
if Source_List_FD = Invalid_FD then
GPR.Com.Fail
("cannot create file """
& Source_List_Path (1 .. Source_List_Last)
& """");
end if;
if Opt.Verbose_Mode then
Put ("Naming project file name is """);
Put
(Project_Naming_File_Name (1 .. Project_Naming_Last));
Put_Line ("""");
end if;
-- Create the naming project node
Project_Naming_Node :=
Default_Project_Node (Of_Kind => N_Project, In_Tree => Tree);
Set_Name_Of (Project_Naming_Node, Tree, To => Project_Naming_Id);
Project_Naming_Decl :=
Default_Project_Node
(Of_Kind => N_Project_Declaration, In_Tree => Tree);
Set_Project_Declaration_Of
(Project_Naming_Node, Tree, Project_Naming_Decl);
Naming_Package :=
Default_Project_Node
(Of_Kind => N_Package_Declaration, In_Tree => Tree);
Set_Name_Of (Naming_Package, Tree, To => Name_Naming);
-- Add an attribute declaration for Source_Files as an empty list (to
-- indicate there are no sources in the naming project) and a package
-- Naming (that will be filled later).
declare
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item, In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Attribute_Declaration,
In_Tree => Tree,
And_Expr_Kind => List);
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => List);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => List);
Empty_List : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Literal_String_List,
In_Tree => Tree);
begin
Set_First_Declarative_Item_Of
(Project_Naming_Decl, Tree, To => Decl_Item);
Set_Next_Declarative_Item (Decl_Item, Tree, Naming_Package);
Set_Current_Item_Node (Decl_Item, Tree, To => Attribute);
Set_Name_Of (Attribute, Tree, To => Name_Source_Files);
Set_Expression_Of (Attribute, Tree, To => Expression);
Set_First_Term (Expression, Tree, To => Term);
Set_Current_Term (Term, Tree, To => Empty_List);
end;
-- Add a with clause on the naming project in the main project, if
-- there is not already one.
declare
With_Clause : Project_Node_Id :=
First_With_Clause_Of (Project_Node, Tree);
begin
while Present (With_Clause) loop
exit when
GPR.Tree.Name_Of (With_Clause, Tree) = Project_Naming_Id;
With_Clause := Next_With_Clause_Of (With_Clause, Tree);
end loop;
if No (With_Clause) then
With_Clause := Default_Project_Node
(Of_Kind => N_With_Clause, In_Tree => Tree);
Set_Next_With_Clause_Of
(With_Clause, Tree,
To => First_With_Clause_Of (Project_Node, Tree));
Set_First_With_Clause_Of
(Project_Node, Tree, To => With_Clause);
Set_Name_Of (With_Clause, Tree, To => Project_Naming_Id);
-- We set the project node to something different than Empty_Node,
-- so that GPR.PP does not generate a limited with clause.
Set_Project_Node_Of (With_Clause, Tree, Non_Empty_Node);
Name_Len := Project_Naming_Last;
Name_Buffer (1 .. Name_Len) :=
Project_Naming_File_Name (1 .. Project_Naming_Last);
Set_String_Value_Of (With_Clause, Tree, To => Name_Find);
end if;
end;
Project_Declaration := Project_Declaration_Of (Project_Node, Tree);
-- Add a package Naming in the main project
declare
begin
Set_Next_Declarative_Item
(Naming_Decl_Item, Tree,
To => First_Declarative_Item_Of (Project_Declaration, Tree));
Set_First_Declarative_Item_Of
(Project_Declaration, Tree, To => Naming_Decl_Item);
Set_Current_Item_Node (Naming_Decl_Item, Tree, To => Naming);
Set_Name_Of (Naming, Tree, To => Name_Naming);
-- Attach the comments, if any, that were saved for package
-- Naming.
Tree.Project_Nodes.Table (Naming).Comments :=
Naming_Package_Comments;
end;
-- Package Naming is a renaming of package Naming in the naming project
Set_Project_Of_Renamed_Package_Of
(Naming, Tree, To => Project_Naming_Node);
-- Add an attribute declaration for Languages, initialized as an
-- empty list.
declare
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item,
In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Attribute_Declaration,
In_Tree => Tree,
And_Expr_Kind => List);
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => List);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term, In_Tree => Tree,
And_Expr_Kind => List);
begin
Set_Next_Declarative_Item
(Decl_Item, Tree,
To => First_Declarative_Item_Of (Project_Declaration, Tree));
Set_First_Declarative_Item_Of
(Project_Declaration, Tree, To => Decl_Item);
Set_Current_Item_Node (Decl_Item, Tree, To => Attribute);
Set_Name_Of (Attribute, Tree, To => Name_Languages);
Set_Expression_Of (Attribute, Tree, To => Expression);
Set_First_Term (Expression, Tree, To => Term);
Languages_List :=
Default_Project_Node
(Of_Kind => N_Literal_String_List,
In_Tree => Tree,
And_Expr_Kind => List);
Set_Current_Term (Term, Tree, To => Languages_List);
-- Attach the comments, if any, that were saved for attribute
-- Source_Dirs.
Tree.Project_Nodes.Table (Attribute).Comments :=
Languages_Comments;
end;
-- Put the languages in attribute Languages
for Language_Index in 1 .. Languages.Last loop
declare
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => Single);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => Single);
Value : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Literal_String,
In_Tree => Tree,
And_Expr_Kind => Single);
begin
if No (Current_Language_Node) then
Set_First_Expression_In_List
(Languages_List, Tree, To => Expression);
else
Set_Next_Expression_In_List
(Current_Language_Node, Tree, To => Expression);
end if;
Current_Language_Node := Expression;
Set_First_Term (Expression, Tree, To => Term);
Set_Current_Term (Term, Tree, To => Value);
Set_String_Value_Of
(Value, Tree, To => Languages.Table (Language_Index));
end;
end loop;
-- Add an attribute declaration for Source_Dirs, initialized as an
-- empty list.
declare
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item,
In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Attribute_Declaration,
In_Tree => Tree,
And_Expr_Kind => List);
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => List);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term, In_Tree => Tree,
And_Expr_Kind => List);
begin
Set_Next_Declarative_Item
(Decl_Item, Tree,
To => First_Declarative_Item_Of (Project_Declaration, Tree));
Set_First_Declarative_Item_Of
(Project_Declaration, Tree, To => Decl_Item);
Set_Current_Item_Node (Decl_Item, Tree, To => Attribute);
Set_Name_Of (Attribute, Tree, To => Name_Source_Dirs);
Set_Expression_Of (Attribute, Tree, To => Expression);
Set_First_Term (Expression, Tree, To => Term);
Source_Dirs_List :=
Default_Project_Node
(Of_Kind => N_Literal_String_List,
In_Tree => Tree,
And_Expr_Kind => List);
Set_Current_Term (Term, Tree, To => Source_Dirs_List);
-- Attach the comments, if any, that were saved for attribute
-- Source_Dirs.
Tree.Project_Nodes.Table (Attribute).Comments :=
Source_Dirs_Comments;
end;
-- Put the source directories in attribute Source_Dirs
for Source_Dir_Index in 1 .. Source_Directories.Last loop
declare
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => Single);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => Single);
Value : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Literal_String,
In_Tree => Tree,
And_Expr_Kind => Single);
begin
if No (Current_Source_Dir) then
Set_First_Expression_In_List
(Source_Dirs_List, Tree, To => Expression);
else
Set_Next_Expression_In_List
(Current_Source_Dir, Tree, To => Expression);
end if;
Current_Source_Dir := Expression;
Set_First_Term (Expression, Tree, To => Term);
Set_Current_Term (Term, Tree, To => Value);
Name_Len := 0;
Add_Str_To_Name_Buffer
(Source_Directories.Table (Source_Dir_Index).all);
Set_String_Value_Of (Value, Tree, To => Name_Find);
end;
end loop;
-- Add an attribute declaration for Source_Files or Source_List_File
-- with the source list file name that will be created.
declare
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item,
In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Attribute_Declaration,
In_Tree => Tree,
And_Expr_Kind => Single);
Expression : Project_Node_Id;
Term : Project_Node_Id;
Value : Project_Node_Id;
begin
Set_Next_Declarative_Item
(Decl_Item, Tree,
To => First_Declarative_Item_Of (Project_Declaration, Tree));
Set_First_Declarative_Item_Of
(Project_Declaration, Tree, To => Decl_Item);
Set_Current_Item_Node (Decl_Item, Tree, To => Attribute);
Set_Name_Of (Attribute, Tree, To => Name_Source_List_File);
Expression :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => Single);
Set_Expression_Of (Attribute, Tree, To => Expression);
Term :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => Single);
Value :=
Default_Project_Node
(Of_Kind => N_Literal_String,
In_Tree => Tree,
And_Expr_Kind => Single);
Set_First_Term (Expression, Tree, To => Term);
Set_Current_Term (Term, Tree, To => Value);
Name_Len := Source_List_Last;
Name_Buffer (1 .. Name_Len) :=
Source_List_Path (1 .. Source_List_Last);
Set_String_Value_Of (Value, Tree, To => Name_Find);
-- If there was no comments for attribute Source_List_File, put those
-- for Source_Files, if they exist.
if Present (Source_List_File_Comments) then
Tree.Project_Nodes.Table (Attribute).Comments :=
Source_List_File_Comments;
else
Tree.Project_Nodes.Table (Attribute).Comments :=
Source_Files_Comments;
end if;
-- Put the foreign source file names in the source list file
for Source_Index in 1 .. Foreign_Sources.Last loop
Get_Name_String (Foreign_Sources.Table (Source_Index).File_Name);
Add_Char_To_Name_Buffer (ASCII.LF);
if Write (Source_List_FD,
Name_Buffer (1)'Address,
Name_Len) /= Name_Len
then
GPR.Com.Fail ("disk full");
end if;
end loop;
-- Put the exception declarations in package Naming
for J in 1 .. Languages.Last loop
declare
Lang : constant Name_Id := Languages.Table (J);
begin
if Lang /= Name_Ada then
-- Add an attribute declaration for
-- Implementation_Exceptions for the language.
declare
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Declarative_Item,
In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Attribute_Declaration,
In_Tree => Tree,
And_Expr_Kind => List);
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => List);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => List);
Source_List : Project_Node_Id;
Expr : Project_Node_Id;
Prev_Expr : Project_Node_Id;
Trm : Project_Node_Id;
Value : Project_Node_Id;
begin
Set_Next_Declarative_Item
(Decl_Item,
To => First_Declarative_Item_Of
(Naming_Package, Tree),
In_Tree => Tree);
Set_First_Declarative_Item_Of
(Naming_Package, Tree, To => Decl_Item);
Set_Current_Item_Node (Decl_Item, Tree, To => Attribute);
Set_Name_Of
(Attribute, Tree, To => Name_Implementation_Exceptions);
Set_Associative_Array_Index_Of
(Attribute, Tree, To => Lang);
Set_Expression_Of (Attribute, Tree, To => Expression);
Set_First_Term (Expression, Tree, To => Term);
Source_List :=
Default_Project_Node
(Of_Kind => N_Literal_String_List,
In_Tree => Tree,
And_Expr_Kind => List);
Set_Current_Term (Term, Tree, To => Source_List);
Prev_Expr := Empty_Project_Node;
-- Put all the sources for this language in the list
for J in 1 .. Foreign_Sources.Last loop
if Foreign_Sources.Table (J).Language = Lang then
Expr :=
Default_Project_Node
(Of_Kind => N_Expression,
In_Tree => Tree,
And_Expr_Kind => Single);
if Prev_Expr = Empty_Project_Node then
Set_First_Expression_In_List
(Node => Source_List,
In_Tree => Tree,
To => Expr);
else
Set_Next_Expression_In_List
(Node => Prev_Expr,
In_Tree => Tree,
To => Expr);
end if;
Prev_Expr := Expr;
Trm :=
Default_Project_Node
(Of_Kind => N_Term,
In_Tree => Tree,
And_Expr_Kind => Single);
Set_First_Term (Expr, Tree, To => Trm);
Value := Default_Project_Node
(Of_Kind => N_Literal_String,
And_Expr_Kind => Single,
In_Tree => Tree);
Set_String_Value_Of
(Node => Value,
In_Tree => Tree,
To => Foreign_Sources.Table (J).File_Name);
Set_Current_Term (Trm, Tree, To => Value);
end if;
end loop;
end;
end if;
end;
end loop;
-- Put the sources in the source list files (or attribute
-- Source_Files) and in the naming project (or the Naming package).
for Source_Index in 1 .. Sources.Last loop
-- Add the corresponding attribute in the Naming package
declare
Current_Source : constant Source :=
Sources.Table (Source_Index);
Decl_Item : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind =>
N_Declarative_Item,
In_Tree => Tree);
Attribute : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind =>
N_Attribute_Declaration,
In_Tree => Tree);
Expression : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Expression,
And_Expr_Kind => Single,
In_Tree => Tree);
Term : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Term,
And_Expr_Kind => Single,
In_Tree => Tree);
Value : constant Project_Node_Id :=
Default_Project_Node
(Of_Kind => N_Literal_String,
And_Expr_Kind => Single,
In_Tree => Tree);
Process_File : Boolean := True;
Index : Natural;
begin
if Opt.Ignore_Predefined_Units
and then Current_Source.Unit_Name /= No_Name
then
Get_Name_String (Current_Source.Unit_Name);
if Is_Ada_Predefined_Unit (Name_Buffer (1 .. Name_Len)) then
Process_File := False;
end if;
end if;
if Process_File then
-- Add source file name to the source list file (or the
-- attribute Source_Files) if it is not already there.
-- If already there, check for duplicate filenames+source
-- index and emit warnings accordingly.
if Source_Files.Get (Current_Source.File_Name) then
Check_Duplicates (Current_Source, Source_Index, Index);
if Index /= 0 then
if Opt.Ignore_Duplicate_Files then
Process_File := False;
elsif Sources.Table (Index).Unit_Name
= Current_Source.Unit_Name
then
Put_Line
("warning: duplicate file " &
Get_Name_String (Current_Source.File_Name) &
" for unit " &
Get_Name_String (Current_Source.Unit_Name) &
" will be ignored");
Process_File := False;
else
Put_Line
("warning: duplicate file " &
Get_Name_String (Current_Source.File_Name) &
" for units " &
Get_Name_String (Current_Source.Unit_Name) &
" and " &
Get_Name_String
(Sources.Table (Index).Unit_Name));
Put_Line
("warning: generated Naming package needs " &
"to be reviewed manually");
end if;
end if;
else
Source_Files.Set (Current_Source.File_Name, True);
Get_Name_String (Current_Source.File_Name);
Add_Char_To_Name_Buffer (ASCII.LF);
if Write (Source_List_FD,
Name_Buffer (1)'Address,
Name_Len) /= Name_Len
then
GPR.Com.Fail ("disk full");
end if;
end if;
end if;
if Process_File then
-- For an Ada source, add entry in package Naming
if Current_Source.Unit_Name /= No_Name then
Set_Next_Declarative_Item
(Decl_Item,
To => First_Declarative_Item_Of
(Naming_Package, Tree),
In_Tree => Tree);
Set_First_Declarative_Item_Of
(Naming_Package,
To => Decl_Item,
In_Tree => Tree);
Set_Current_Item_Node
(Decl_Item,
To => Attribute,
In_Tree => Tree);
-- Is it a spec or a body?
if Current_Source.Spec then
Set_Name_Of
(Attribute, Tree,
To => Name_Spec);
else
Set_Name_Of
(Attribute, Tree,
To => Name_Body);
end if;
-- Get the name of the unit
Get_Name_String (Current_Source.Unit_Name);
To_Lower (Name_Buffer (1 .. Name_Len));
Set_Associative_Array_Index_Of
(Attribute, Tree, To => Name_Find);
Set_Expression_Of
(Attribute, Tree, To => Expression);
Set_First_Term
(Expression, Tree, To => Term);
Set_Current_Term
(Term, Tree, To => Value);
-- And set the name of the file
Set_String_Value_Of
(Value, Tree, To => Current_Source.File_Name);
Set_Source_Index_Of
(Value, Tree, To => Current_Source.Index);
end if;
end if;
end;
end loop;
end;
-- Close the source list file
Close (Source_List_FD);
-- Output the project file
GPR.PP.Pretty_Print
(Project_Node, Tree,
W_Char => Write_A_Char'Access,
W_Eol => Write_Eol'Access,
W_Str => Write_A_String'Access,
Backward_Compatibility => False,
Max_Line_Length => 79);
Close (Output_FD);
-- Delete the naming project file if it already exists
Delete_File
(Project_Naming_File_Name (1 .. Project_Naming_Last),
Success => Discard);
-- Create a new one
if Opt.Verbose_Mode then
Put ("Creating new naming project file """);
Put (Project_Naming_File_Name
(1 .. Project_Naming_Last));
Put_Line ("""");
end if;
Output_FD := Create_New_File
(Project_Naming_File_Name (1 .. Project_Naming_Last),
Fmode => Text);
-- Fails if naming project file cannot be created
if Output_FD = Invalid_FD then
GPR.Com.Fail
("cannot create new """
& Project_Naming_File_Name (1 .. Project_Naming_Last)
& """");
end if;
-- Output the naming project file
GPR.PP.Pretty_Print
(Project_Naming_Node, Tree,
W_Char => Write_A_Char'Access,
W_Eol => Write_Eol'Access,
W_Str => Write_A_String'Access,
Backward_Compatibility => False);
Close (Output_FD);
end Finalize;
----------------
-- Initialize --
----------------
procedure Initialize
(File_Path : String;
Preproc_Switches : Argument_List;
Very_Verbose : Boolean;
Flags : Processing_Flags)
is
begin
GPRName.Very_Verbose := Initialize.Very_Verbose;
-- Do some needed initializations
Snames.Initialize;
Set_Program_Name ("gprname");
GPR.Initialize (No_Project_Tree);
GPR.Tree.Initialize (Root_Environment, Flags);
GPR.Env.Initialize_Default_Project_Path
(Root_Environment.Project_Path,
Target_Name => GprConfig.Sdefault.Hostname);
GPR.Tree.Initialize (Tree);
Sources.Set_Last (0);
Source_Directories.Set_Last (0);
Foreign_Sources.Set_Last (0);
Languages.Set_Last (0);
-- Initialize the compiler switches
Args := new Argument_List (1 .. Preproc_Switches'Length + 6);
Args (1) := new String'("-c");
Args (2) := new String'("-gnats");
Args (3) := new String'("-gnatu");
Args (4 .. 3 + Preproc_Switches'Length) := Preproc_Switches;
Args (4 + Preproc_Switches'Length) := new String'("-x");
Args (5 + Preproc_Switches'Length) := new String'("ada");
-- Get the path and file names
Path_Name := new
String (1 .. File_Path'Length + Project_File_Extension'Length);
Path_Last := File_Path'Length;
if File_Names_Case_Sensitive then
Path_Name (1 .. Path_Last) := File_Path;
else
Path_Name (1 .. Path_Last) := To_Lower (File_Path);
end if;
Path_Name (Path_Last + 1 .. Path_Name'Last) :=
Project_File_Extension;
-- Get the end of directory information, if any
for Index in reverse 1 .. Path_Last loop
if Path_Name (Index) = Directory_Separator then
Directory_Last := Index;
exit;
end if;
end loop;
if Path_Last < Project_File_Extension'Length + 1
or else Path_Name
(Path_Last - Project_File_Extension'Length + 1 .. Path_Last)
/= Project_File_Extension
then
Path_Last := Path_Name'Last;
end if;
Output_Name := new String'(To_Lower (Path_Name (1 .. Path_Last)));
Output_Name_Last := Output_Name'Last - 4;
-- If there is already a project file with the specified name, parse
-- it to get the components that are not automatically generated.
if Is_Regular_File (Output_Name (1 .. Path_Last)) then
if Opt.Verbose_Mode then
Put ("Parsing already existing project file """);
Put (Output_Name.all);
Put_Line ("""");
end if;
else
declare
File : File_Type;
begin
Create (File, Out_File, Output_Name.all);
Put (File, "project ");
Put (File, Path_Name (Directory_Last + 1 .. Output_Name_Last));
Put_Line (File, " is");
Put (File, "end ");
Put (File, Path_Name (Directory_Last + 1 .. Output_Name_Last));
Put_Line (File, ";");
Close (File);
Opt.No_Backup := True;
end;
end if;
GPR.Attr.PM.Remove_Unknown_Packages;
Part.Parse
(In_Tree => Tree,
Project => Project_Node,
Project_File_Name => Output_Name.all,
Errout_Handling => Part.Finalize_If_Error,
Store_Comments => True,
Is_Config_File => False,
Env => Root_Environment,
Current_Directory => Get_Current_Dir,
Packages_To_Check => Packages_To_Check_By_Gprname);
-- Fail if parsing was not successful
if No (Project_Node) then
GPR.Com.Fail ("parsing of existing project file failed");
elsif Project_Qualifier_Of (Project_Node, Tree) = Aggregate then
GPR.Com.Fail ("aggregate projects are not supported");
elsif Project_Qualifier_Of (Project_Node, Tree) =
Aggregate_Library
then
GPR.Com.Fail ("aggregate library projects are not supported");
else
-- If parsing was successful, remove the components that are
-- automatically generated, if any, so that they will be
-- unconditionally added later.
-- Remove the with clause for the naming project file
declare
With_Clause : Project_Node_Id :=
First_With_Clause_Of (Project_Node, Tree);
Previous : Project_Node_Id := Empty_Project_Node;
begin
while Present (With_Clause) loop
if GPR.Tree.Name_Of (With_Clause, Tree) =
Project_Naming_Id
then
if No (Previous) then
Set_First_With_Clause_Of
(Project_Node, Tree,
To => Next_With_Clause_Of (With_Clause, Tree));
else
Set_Next_With_Clause_Of
(Previous, Tree,
To => Next_With_Clause_Of (With_Clause, Tree));
end if;
exit;
end if;
Previous := With_Clause;
With_Clause := Next_With_Clause_Of (With_Clause, Tree);
end loop;
end;
-- Remove attribute declarations of Source_Files,
-- Source_List_File, Source_Dirs, Languages and the declaration of
-- package Naming, if they exist, but preserve the comments
-- attached to these nodes.
declare
Declaration : Project_Node_Id :=
First_Declarative_Item_Of
(Project_Declaration_Of
(Project_Node, Tree),
Tree);
Previous : Project_Node_Id := Empty_Project_Node;
Current_Node : Project_Node_Id := Empty_Project_Node;
Name : Name_Id;
Kind_Of_Node : Project_Node_Kind;
Comments : Project_Node_Id;
begin
while Present (Declaration) loop
Current_Node := Current_Item_Node (Declaration, Tree);
Kind_Of_Node := Kind_Of (Current_Node, Tree);
if Kind_Of_Node = N_Attribute_Declaration or else
Kind_Of_Node = N_Package_Declaration
then
Name := GPR.Tree.Name_Of (Current_Node, Tree);
if Name = Name_Source_Files or else
Name = Name_Source_List_File or else
Name = Name_Source_Dirs or else
Name = Name_Languages or else
Name = Name_Naming
then
Comments :=
Tree.Project_Nodes.Table (Current_Node).Comments;
if Name = Name_Source_Files then
Source_Files_Comments := Comments;
elsif Name = Name_Source_List_File then
Source_List_File_Comments := Comments;
elsif Name = Name_Source_Dirs then
Source_Dirs_Comments := Comments;
elsif Name = Name_Languages then
Languages_Comments := Comments;
elsif Name = Name_Naming then
Naming_Package_Comments := Comments;
end if;
if No (Previous) then
Set_First_Declarative_Item_Of
(Project_Declaration_Of (Project_Node, Tree),
Tree,
To => Next_Declarative_Item
(Declaration, Tree));
else
Set_Next_Declarative_Item
(Previous, Tree,
To => Next_Declarative_Item
(Declaration, Tree));
end if;
else
Previous := Declaration;
end if;
end if;
Declaration := Next_Declarative_Item (Declaration, Tree);
end loop;
end;
end if;
if Directory_Last /= 0 then
Output_Name (1 .. Output_Name_Last - Directory_Last) :=
Output_Name (Directory_Last + 1 .. Output_Name_Last);
Output_Name_Last := Output_Name_Last - Directory_Last;
end if;
-- Get the project name id
Name_Len := Output_Name_Last;
Name_Buffer (1 .. Name_Len) := Output_Name (1 .. Name_Len);
Output_Name_Id := Name_Find;
-- Create the project naming file name
Project_Naming_Last := Output_Name_Last;
Project_Naming_File_Name :=
new String'(Output_Name (1 .. Output_Name_Last) &
Naming_File_Suffix &
Project_File_Extension);
Project_Naming_Last :=
Project_Naming_Last + Naming_File_Suffix'Length;
-- Get the project naming id
Name_Len := Project_Naming_Last;
Name_Buffer (1 .. Name_Len) :=
Project_Naming_File_Name (1 .. Name_Len);
Project_Naming_Id := Name_Find;
Project_Naming_Last :=
Project_Naming_Last + Project_File_Extension'Length;
-- Create the source list file name
Source_List_Last := Output_Name_Last;
Source_List_Path :=
new String'(Output_Name (1 .. Output_Name_Last) &
Source_List_File_Suffix);
Source_List_Last :=
Output_Name_Last + Source_List_File_Suffix'Length;
-- Add the project file extension to the project name
Output_Name
(Output_Name_Last + 1 ..
Output_Name_Last + Project_File_Extension'Length) :=
Project_File_Extension;
Output_Name_Last := Output_Name_Last + Project_File_Extension'Length;
-- Back up project file if it already exists
if not Opt.No_Backup
and then Is_Regular_File (Path_Name (1 .. Path_Last))
then
declare
Discard : Boolean;
Saved_Path : constant String :=
Path_Name (1 .. Path_Last) & ".saved_";
Nmb : Natural;
begin
Nmb := 0;
loop
declare
Img : constant String := Nmb'Img;
begin
if not Is_Regular_File
(Saved_Path & Img (2 .. Img'Last))
then
Copy_File
(Name => Path_Name (1 .. Path_Last),
Pathname => Saved_Path & Img (2 .. Img'Last),
Mode => Overwrite,
Success => Discard);
exit;
end if;
Nmb := Nmb + 1;
end;
end loop;
end;
end if;
-- Change the current directory to the directory of the project file,
-- if any directory information is specified.
if Directory_Last /= 0 then
begin
Change_Dir (Path_Name (1 .. Directory_Last));
exception
when Directory_Error =>
GPR.Com.Fail
("unknown directory """
& Path_Name (1 .. Directory_Last)
& """");
end;
end if;
end Initialize;
-------------
-- Process --
-------------
procedure Process
(Directories : Argument_List;
Name_Patterns : Regexp_List;
Excluded_Patterns : Regexp_List;
Foreign_Patterns : Foreign_Regexp_List)
is
procedure Process_Directory (Dir_Name : String; Recursively : Boolean);
-- Look for Ada and foreign sources in a directory, according to the
-- patterns. When Recursively is True, after looking for sources in
-- Dir_Name, look also in its subdirectories, if any.
-----------------------
-- Process_Directory --
-----------------------
procedure Process_Directory (Dir_Name : String; Recursively : Boolean) is
Matched : Matched_Type := No_Match;
Str : String (1 .. 2_000);
Canon : String (1 .. 2_000);
Last : Natural;
Dir : Dir_Type;
Do_Process : Boolean := True;
Temp_File_Name : String_Access := null;
Save_Last_Source_Index : Natural := 0;
File_Name_Id : Name_Id := No_Name;
Current_Source : Source;
Current_Language : Name_Id;
begin
-- Avoid processing the same directory more than once
for Index in 1 .. Processed_Directories.Last loop
if Processed_Directories.Table (Index).all = Dir_Name then
Do_Process := False;
exit;
end if;
end loop;
if Do_Process then
if Opt.Verbose_Mode then
Put ("Processing directory """);
Put (Dir_Name);
Put_Line ("""");
end if;
Processed_Directories. Increment_Last;
Processed_Directories.Table (Processed_Directories.Last) :=
new String'(Dir_Name);
-- Get the source file names from the directory. Fails if the
-- directory does not exist.
begin
Open (Dir, Dir_Name);
exception
when Directory_Error =>
GPR.Com.Fail ("cannot open directory """ & Dir_Name & """");
end;
-- Process each regular file in the directory
File_Loop : loop
Read (Dir, Str, Last);
exit File_Loop when Last = 0;
-- Copy the file name and put it in canonical case to match
-- against the patterns that have themselves already been put
-- in canonical case.
Canon (1 .. Last) := Str (1 .. Last);
Canonical_Case_File_Name (Canon (1 .. Last));
if Is_Regular_File
(Dir_Name & Directory_Separator & Str (1 .. Last))
then
Matched := Match;
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Str (1 .. Last);
File_Name_Id := Name_Find;
-- First, check if the file name matches at least one of
-- the excluded expressions;
for Index in Excluded_Patterns'Range loop
if
Match (Canon (1 .. Last), Excluded_Patterns (Index))
then
Matched := Excluded;
exit;
end if;
end loop;
-- If it does not match any of the excluded expressions,
-- check if the file name matches at least one of the
-- regular expressions.
if Matched = Match then
Matched := No_Match;
for Index in Name_Patterns'Range loop
if
Match
(Canon (1 .. Last), Name_Patterns (Index))
then
Matched := Match;
exit;
end if;
end loop;
end if;
if Very_Verbose
or else (Matched = Match and then Opt.Verbose_Mode)
then
Put (" Checking """);
Put (Str (1 .. Last));
Put_Line (""": ");
end if;
-- If the file name matches one of the regular expressions,
-- parse it to get its unit name.
if Matched = Match then
declare
FD : File_Descriptor;
Success : Boolean;
Saved_Output : File_Descriptor;
Saved_Error : File_Descriptor;
Tmp_File : Path_Name_Type;
begin
-- If we don't have the path of the compiler yet,
-- get it now. The compiler name may have a prefix,
-- so we get the potentially prefixed name.
if Gcc_Path = null then
Gcc_Path := Locate_Exec_On_Path (Gcc);
if Gcc_Path = null then
GPR.Com.Fail ("could not locate " & Gcc);
end if;
end if;
-- Create the temporary file
Tempdir.Create_Temp_File (FD, Tmp_File);
if FD = Invalid_FD then
GPR.Com.Fail
("could not create temporary file");
else
Temp_File_Name :=
new String'(Get_Name_String (Tmp_File));
end if;
Args (Args'Last) :=
new String'
(Dir_Name & Directory_Separator & Str (1 .. Last));
-- Save the standard output and error
Saved_Output := Dup (Standout);
Saved_Error := Dup (Standerr);
-- Set standard output and error to the temporary file
Dup2 (FD, Standout);
Dup2 (FD, Standerr);
-- And spawn the compiler
if Very_Verbose then
Put (Gcc_Path.all);
for J in Args'Range loop
if Args (J)'Length > 0 then
Put (" " & Args (J).all);
end if;
end loop;
New_Line;
end if;
Spawn (Gcc_Path.all, Args.all, Success);
-- Restore the standard output and error
Dup2 (Saved_Output, Standout);
Dup2 (Saved_Error, Standerr);
-- Close the temporary file
Close (FD);
-- And close the saved standard output and error to
-- avoid too many file descriptors.
Close (Saved_Output);
Close (Saved_Error);
-- Now that standard output is restored, check if
-- the compiler ran correctly.
-- Read the lines of the temporary file:
-- they should contain the kind and name of the unit.
declare
File : Text_File;
Text_Line : String (1 .. 1_000);
Text_Last : Natural;
begin
Open (File, Temp_File_Name.all);
if not Is_Valid (File) then
GPR.Com.Fail
("could not read temporary file " &
Temp_File_Name.all);
end if;
Save_Last_Source_Index := Sources.Last;
if End_Of_File (File) then
if Opt.Verbose_Mode then
if not Success then
Put (" (process died) ");
end if;
end if;
else
Line_Loop : while not End_Of_File (File) loop
Get_Line (File, Text_Line, Text_Last);
if Very_Verbose then
Put_Line (Text_Line (1 .. Text_Last));
end if;
-- Find the first closing parenthesis
Char_Loop : for J in 1 .. Text_Last loop
if Text_Line (J) = ')' then
if J >= 13 and then
Text_Line (1 .. 4) = "Unit"
then
-- Add entry to Sources table
Name_Len := J - 12;
Name_Buffer (1 .. Name_Len) :=
Text_Line (6 .. J - 7);
Current_Source :=
(Unit_Name => Name_Find,
File_Name => File_Name_Id,
Index => 0,
Spec => Text_Line (J - 5 .. J) =
"(spec)");
Sources.Append (Current_Source);
end if;
exit Char_Loop;
end if;
end loop Char_Loop;
end loop Line_Loop;
end if;
if Save_Last_Source_Index = Sources.Last then
if Opt.Verbose_Mode then
Put_Line (" not a unit");
end if;
else
Add_Language (Name_Ada);
if Sources.Last >
Save_Last_Source_Index + 1
then
for Index in Save_Last_Source_Index + 1 ..
Sources.Last
loop
Sources.Table (Index).Index :=
Int (Index - Save_Last_Source_Index);
end loop;
end if;
for Index in Save_Last_Source_Index + 1 ..
Sources.Last
loop
Current_Source := Sources.Table (Index);
if Opt.Verbose_Mode then
if Current_Source.Spec then
Put (" spec of ");
else
Put (" body of ");
end if;
Put_Line
(Get_Name_String
(Current_Source.Unit_Name));
end if;
end loop;
end if;
Close (File);
Delete_File (Temp_File_Name.all, Success);
end;
end;
-- File name matches none of the regular expressions
else
-- If file is not excluded, see if this is foreign source
if Matched /= Excluded then
for Index in Foreign_Patterns'Range loop
if Match (Canon (1 .. Last),
Foreign_Patterns (Index).Pattern)
then
Matched := Match;
Current_Language :=
Foreign_Patterns (Index).Language;
Add_Language (Current_Language);
exit;
end if;
end loop;
end if;
if Very_Verbose then
case Matched is
when No_Match =>
Put_Line ("no match");
when Excluded =>
Put_Line ("excluded");
when Match =>
Put_Line ("foreign source");
end case;
end if;
if Matched = Match then
-- Add foreign source file name
Name_Len := 0;
Add_Str_To_Name_Buffer (Canon (1 .. Last));
Foreign_Sources.Append
((File_Name => Name_Find,
Language => Current_Language));
end if;
end if;
end if;
end loop File_Loop;
Close (Dir);
end if;
-- If Recursively is True, call itself for each subdirectory.
-- We do that, even when this directory has already been processed,
-- because all of its subdirectories may not have been processed.
if Recursively then
Open (Dir, Dir_Name);
loop
Read (Dir, Str, Last);
exit when Last = 0;
-- Do not call itself for "." or ".."
if Is_Directory
(Dir_Name & Directory_Separator & Str (1 .. Last))
and then Str (1 .. Last) /= "."
and then Str (1 .. Last) /= ".."
then
Process_Directory
(Dir_Name & Directory_Separator & Str (1 .. Last),
Recursively => True);
end if;
end loop;
Close (Dir);
end if;
end Process_Directory;
-- Start of processing for Process
begin
Processed_Directories.Set_Last (0);
-- Process each directory
for Index in Directories'Range loop
declare
Dir_Name : constant String := Directories (Index).all;
Last : Natural := Dir_Name'Last;
Recursively : Boolean := False;
Found : Boolean;
Canonical : String (1 .. Dir_Name'Length) := Dir_Name;
begin
Canonical_Case_File_Name (Canonical);
Found := False;
for J in 1 .. Source_Directories.Last loop
if Source_Directories.Table (J).all = Canonical then
Found := True;
exit;
end if;
end loop;
if not Found then
Source_Directories.Append (new String'(Canonical));
end if;
if Dir_Name'Length >= 4
and then (Dir_Name (Last - 2 .. Last) = "/**")
then
Last := Last - 3;
Recursively := True;
end if;
Process_Directory (Dir_Name (Dir_Name'First .. Last), Recursively);
end;
end loop;
end Process;
end GPRName;
|
gabemgem/LITEC | Ada | 9,168 | adb | M:hw4
F:G$SYSCLK_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$UART0_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$Sys_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$putchar$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$getchar$0$0({2}DF,SC:U),C,0,0,0,0,0
F:G$getchar_nw$0$0({2}DF,SC:U),C,0,0,0,0,0
F:G$main$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$Port_Init$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$Set_Outputs_First$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$Set_Outputs_Second$0$0({2}DF,SV:S),Z,0,0,0,0,0
S:Lhw4.getchar$c$1$10({1}SC:U),R,0,0,[]
S:Lhw4.getchar_nw$c$1$12({1}SC:U),R,0,0,[]
S:G$P0$0$0({1}SC:U),I,0,0
S:G$SP$0$0({1}SC:U),I,0,0
S:G$DPL$0$0({1}SC:U),I,0,0
S:G$DPH$0$0({1}SC:U),I,0,0
S:G$P4$0$0({1}SC:U),I,0,0
S:G$P5$0$0({1}SC:U),I,0,0
S:G$P6$0$0({1}SC:U),I,0,0
S:G$PCON$0$0({1}SC:U),I,0,0
S:G$TCON$0$0({1}SC:U),I,0,0
S:G$TMOD$0$0({1}SC:U),I,0,0
S:G$TL0$0$0({1}SC:U),I,0,0
S:G$TL1$0$0({1}SC:U),I,0,0
S:G$TH0$0$0({1}SC:U),I,0,0
S:G$TH1$0$0({1}SC:U),I,0,0
S:G$CKCON$0$0({1}SC:U),I,0,0
S:G$PSCTL$0$0({1}SC:U),I,0,0
S:G$P1$0$0({1}SC:U),I,0,0
S:G$TMR3CN$0$0({1}SC:U),I,0,0
S:G$TMR3RLL$0$0({1}SC:U),I,0,0
S:G$TMR3RLH$0$0({1}SC:U),I,0,0
S:G$TMR3L$0$0({1}SC:U),I,0,0
S:G$TMR3H$0$0({1}SC:U),I,0,0
S:G$P7$0$0({1}SC:U),I,0,0
S:G$SCON$0$0({1}SC:U),I,0,0
S:G$SCON0$0$0({1}SC:U),I,0,0
S:G$SBUF$0$0({1}SC:U),I,0,0
S:G$SBUF0$0$0({1}SC:U),I,0,0
S:G$SPI0CFG$0$0({1}SC:U),I,0,0
S:G$SPI0DAT$0$0({1}SC:U),I,0,0
S:G$ADC1$0$0({1}SC:U),I,0,0
S:G$SPI0CKR$0$0({1}SC:U),I,0,0
S:G$CPT0CN$0$0({1}SC:U),I,0,0
S:G$CPT1CN$0$0({1}SC:U),I,0,0
S:G$P2$0$0({1}SC:U),I,0,0
S:G$EMI0TC$0$0({1}SC:U),I,0,0
S:G$EMI0CF$0$0({1}SC:U),I,0,0
S:G$PRT0CF$0$0({1}SC:U),I,0,0
S:G$P0MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT1CF$0$0({1}SC:U),I,0,0
S:G$P1MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT2CF$0$0({1}SC:U),I,0,0
S:G$P2MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT3CF$0$0({1}SC:U),I,0,0
S:G$P3MDOUT$0$0({1}SC:U),I,0,0
S:G$IE$0$0({1}SC:U),I,0,0
S:G$SADDR0$0$0({1}SC:U),I,0,0
S:G$ADC1CN$0$0({1}SC:U),I,0,0
S:G$ADC1CF$0$0({1}SC:U),I,0,0
S:G$AMX1SL$0$0({1}SC:U),I,0,0
S:G$P3IF$0$0({1}SC:U),I,0,0
S:G$SADEN1$0$0({1}SC:U),I,0,0
S:G$EMI0CN$0$0({1}SC:U),I,0,0
S:G$_XPAGE$0$0({1}SC:U),I,0,0
S:G$P3$0$0({1}SC:U),I,0,0
S:G$OSCXCN$0$0({1}SC:U),I,0,0
S:G$OSCICN$0$0({1}SC:U),I,0,0
S:G$P74OUT$0$0({1}SC:U),I,0,0
S:G$FLSCL$0$0({1}SC:U),I,0,0
S:G$FLACL$0$0({1}SC:U),I,0,0
S:G$IP$0$0({1}SC:U),I,0,0
S:G$SADEN0$0$0({1}SC:U),I,0,0
S:G$AMX0CF$0$0({1}SC:U),I,0,0
S:G$AMX0SL$0$0({1}SC:U),I,0,0
S:G$ADC0CF$0$0({1}SC:U),I,0,0
S:G$P1MDIN$0$0({1}SC:U),I,0,0
S:G$ADC0L$0$0({1}SC:U),I,0,0
S:G$ADC0H$0$0({1}SC:U),I,0,0
S:G$SMB0CN$0$0({1}SC:U),I,0,0
S:G$SMB0STA$0$0({1}SC:U),I,0,0
S:G$SMB0DAT$0$0({1}SC:U),I,0,0
S:G$SMB0ADR$0$0({1}SC:U),I,0,0
S:G$ADC0GTL$0$0({1}SC:U),I,0,0
S:G$ADC0GTH$0$0({1}SC:U),I,0,0
S:G$ADC0LTL$0$0({1}SC:U),I,0,0
S:G$ADC0LTH$0$0({1}SC:U),I,0,0
S:G$T2CON$0$0({1}SC:U),I,0,0
S:G$T4CON$0$0({1}SC:U),I,0,0
S:G$RCAP2L$0$0({1}SC:U),I,0,0
S:G$RCAP2H$0$0({1}SC:U),I,0,0
S:G$TL2$0$0({1}SC:U),I,0,0
S:G$TH2$0$0({1}SC:U),I,0,0
S:G$SMB0CR$0$0({1}SC:U),I,0,0
S:G$PSW$0$0({1}SC:U),I,0,0
S:G$REF0CN$0$0({1}SC:U),I,0,0
S:G$DAC0L$0$0({1}SC:U),I,0,0
S:G$DAC0H$0$0({1}SC:U),I,0,0
S:G$DAC0CN$0$0({1}SC:U),I,0,0
S:G$DAC1L$0$0({1}SC:U),I,0,0
S:G$DAC1H$0$0({1}SC:U),I,0,0
S:G$DAC1CN$0$0({1}SC:U),I,0,0
S:G$PCA0CN$0$0({1}SC:U),I,0,0
S:G$PCA0MD$0$0({1}SC:U),I,0,0
S:G$PCA0CPM0$0$0({1}SC:U),I,0,0
S:G$PCA0CPM1$0$0({1}SC:U),I,0,0
S:G$PCA0CPM2$0$0({1}SC:U),I,0,0
S:G$PCA0CPM3$0$0({1}SC:U),I,0,0
S:G$PCA0CPM4$0$0({1}SC:U),I,0,0
S:G$ACC$0$0({1}SC:U),I,0,0
S:G$XBR0$0$0({1}SC:U),I,0,0
S:G$XBR1$0$0({1}SC:U),I,0,0
S:G$XBR2$0$0({1}SC:U),I,0,0
S:G$RCAP4L$0$0({1}SC:U),I,0,0
S:G$RCAP4H$0$0({1}SC:U),I,0,0
S:G$EIE1$0$0({1}SC:U),I,0,0
S:G$EIE2$0$0({1}SC:U),I,0,0
S:G$ADC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0L$0$0({1}SC:U),I,0,0
S:G$PCA0CPL0$0$0({1}SC:U),I,0,0
S:G$PCA0CPL1$0$0({1}SC:U),I,0,0
S:G$PCA0CPL2$0$0({1}SC:U),I,0,0
S:G$PCA0CPL3$0$0({1}SC:U),I,0,0
S:G$PCA0CPL4$0$0({1}SC:U),I,0,0
S:G$RSTSRC$0$0({1}SC:U),I,0,0
S:G$B$0$0({1}SC:U),I,0,0
S:G$SCON1$0$0({1}SC:U),I,0,0
S:G$SBUF1$0$0({1}SC:U),I,0,0
S:G$SADDR1$0$0({1}SC:U),I,0,0
S:G$TL4$0$0({1}SC:U),I,0,0
S:G$TH4$0$0({1}SC:U),I,0,0
S:G$EIP1$0$0({1}SC:U),I,0,0
S:G$EIP2$0$0({1}SC:U),I,0,0
S:G$SPI0CN$0$0({1}SC:U),I,0,0
S:G$PCA0H$0$0({1}SC:U),I,0,0
S:G$PCA0CPH0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH1$0$0({1}SC:U),I,0,0
S:G$PCA0CPH2$0$0({1}SC:U),I,0,0
S:G$PCA0CPH3$0$0({1}SC:U),I,0,0
S:G$PCA0CPH4$0$0({1}SC:U),I,0,0
S:G$WDTCN$0$0({1}SC:U),I,0,0
S:G$TMR0$0$0({2}SI:U),I,0,0
S:G$TMR1$0$0({2}SI:U),I,0,0
S:G$TMR2$0$0({2}SI:U),I,0,0
S:G$RCAP2$0$0({2}SI:U),I,0,0
S:G$TMR3$0$0({2}SI:U),I,0,0
S:G$TMR3RL$0$0({2}SI:U),I,0,0
S:G$TMR4$0$0({2}SI:U),I,0,0
S:G$RCAP4$0$0({2}SI:U),I,0,0
S:G$ADC0$0$0({2}SI:U),I,0,0
S:G$ADC0GT$0$0({2}SI:U),I,0,0
S:G$ADC0LT$0$0({2}SI:U),I,0,0
S:G$DAC0$0$0({2}SI:U),I,0,0
S:G$DAC1$0$0({2}SI:U),I,0,0
S:G$PCA0$0$0({2}SI:U),I,0,0
S:G$PCA0CP0$0$0({2}SI:U),I,0,0
S:G$PCA0CP1$0$0({2}SI:U),I,0,0
S:G$PCA0CP2$0$0({2}SI:U),I,0,0
S:G$PCA0CP3$0$0({2}SI:U),I,0,0
S:G$PCA0CP4$0$0({2}SI:U),I,0,0
S:G$P0_0$0$0({1}SX:U),J,0,0
S:G$P0_1$0$0({1}SX:U),J,0,0
S:G$P0_2$0$0({1}SX:U),J,0,0
S:G$P0_3$0$0({1}SX:U),J,0,0
S:G$P0_4$0$0({1}SX:U),J,0,0
S:G$P0_5$0$0({1}SX:U),J,0,0
S:G$P0_6$0$0({1}SX:U),J,0,0
S:G$P0_7$0$0({1}SX:U),J,0,0
S:G$IT0$0$0({1}SX:U),J,0,0
S:G$IE0$0$0({1}SX:U),J,0,0
S:G$IT1$0$0({1}SX:U),J,0,0
S:G$IE1$0$0({1}SX:U),J,0,0
S:G$TR0$0$0({1}SX:U),J,0,0
S:G$TF0$0$0({1}SX:U),J,0,0
S:G$TR1$0$0({1}SX:U),J,0,0
S:G$TF1$0$0({1}SX:U),J,0,0
S:G$P1_0$0$0({1}SX:U),J,0,0
S:G$P1_1$0$0({1}SX:U),J,0,0
S:G$P1_2$0$0({1}SX:U),J,0,0
S:G$P1_3$0$0({1}SX:U),J,0,0
S:G$P1_4$0$0({1}SX:U),J,0,0
S:G$P1_5$0$0({1}SX:U),J,0,0
S:G$P1_6$0$0({1}SX:U),J,0,0
S:G$P1_7$0$0({1}SX:U),J,0,0
S:G$RI$0$0({1}SX:U),J,0,0
S:G$RI0$0$0({1}SX:U),J,0,0
S:G$TI$0$0({1}SX:U),J,0,0
S:G$TI0$0$0({1}SX:U),J,0,0
S:G$RB8$0$0({1}SX:U),J,0,0
S:G$RB80$0$0({1}SX:U),J,0,0
S:G$TB8$0$0({1}SX:U),J,0,0
S:G$TB80$0$0({1}SX:U),J,0,0
S:G$REN$0$0({1}SX:U),J,0,0
S:G$REN0$0$0({1}SX:U),J,0,0
S:G$SM2$0$0({1}SX:U),J,0,0
S:G$SM20$0$0({1}SX:U),J,0,0
S:G$MCE0$0$0({1}SX:U),J,0,0
S:G$SM1$0$0({1}SX:U),J,0,0
S:G$SM10$0$0({1}SX:U),J,0,0
S:G$SM0$0$0({1}SX:U),J,0,0
S:G$SM00$0$0({1}SX:U),J,0,0
S:G$S0MODE$0$0({1}SX:U),J,0,0
S:G$P2_0$0$0({1}SX:U),J,0,0
S:G$P2_1$0$0({1}SX:U),J,0,0
S:G$P2_2$0$0({1}SX:U),J,0,0
S:G$P2_3$0$0({1}SX:U),J,0,0
S:G$P2_4$0$0({1}SX:U),J,0,0
S:G$P2_5$0$0({1}SX:U),J,0,0
S:G$P2_6$0$0({1}SX:U),J,0,0
S:G$P2_7$0$0({1}SX:U),J,0,0
S:G$EX0$0$0({1}SX:U),J,0,0
S:G$ET0$0$0({1}SX:U),J,0,0
S:G$EX1$0$0({1}SX:U),J,0,0
S:G$ET1$0$0({1}SX:U),J,0,0
S:G$ES0$0$0({1}SX:U),J,0,0
S:G$ES$0$0({1}SX:U),J,0,0
S:G$ET2$0$0({1}SX:U),J,0,0
S:G$EA$0$0({1}SX:U),J,0,0
S:G$P3_0$0$0({1}SX:U),J,0,0
S:G$P3_1$0$0({1}SX:U),J,0,0
S:G$P3_2$0$0({1}SX:U),J,0,0
S:G$P3_3$0$0({1}SX:U),J,0,0
S:G$P3_4$0$0({1}SX:U),J,0,0
S:G$P3_5$0$0({1}SX:U),J,0,0
S:G$P3_6$0$0({1}SX:U),J,0,0
S:G$P3_7$0$0({1}SX:U),J,0,0
S:G$PX0$0$0({1}SX:U),J,0,0
S:G$PT0$0$0({1}SX:U),J,0,0
S:G$PX1$0$0({1}SX:U),J,0,0
S:G$PT1$0$0({1}SX:U),J,0,0
S:G$PS0$0$0({1}SX:U),J,0,0
S:G$PS$0$0({1}SX:U),J,0,0
S:G$PT2$0$0({1}SX:U),J,0,0
S:G$SMBTOE$0$0({1}SX:U),J,0,0
S:G$SMBFTE$0$0({1}SX:U),J,0,0
S:G$AA$0$0({1}SX:U),J,0,0
S:G$SI$0$0({1}SX:U),J,0,0
S:G$STO$0$0({1}SX:U),J,0,0
S:G$STA$0$0({1}SX:U),J,0,0
S:G$ENSMB$0$0({1}SX:U),J,0,0
S:G$BUSY$0$0({1}SX:U),J,0,0
S:G$CPRL2$0$0({1}SX:U),J,0,0
S:G$CT2$0$0({1}SX:U),J,0,0
S:G$TR2$0$0({1}SX:U),J,0,0
S:G$EXEN2$0$0({1}SX:U),J,0,0
S:G$TCLK$0$0({1}SX:U),J,0,0
S:G$RCLK$0$0({1}SX:U),J,0,0
S:G$EXF2$0$0({1}SX:U),J,0,0
S:G$TF2$0$0({1}SX:U),J,0,0
S:G$P$0$0({1}SX:U),J,0,0
S:G$F1$0$0({1}SX:U),J,0,0
S:G$OV$0$0({1}SX:U),J,0,0
S:G$RS0$0$0({1}SX:U),J,0,0
S:G$RS1$0$0({1}SX:U),J,0,0
S:G$F0$0$0({1}SX:U),J,0,0
S:G$AC$0$0({1}SX:U),J,0,0
S:G$CY$0$0({1}SX:U),J,0,0
S:G$CCF0$0$0({1}SX:U),J,0,0
S:G$CCF1$0$0({1}SX:U),J,0,0
S:G$CCF2$0$0({1}SX:U),J,0,0
S:G$CCF3$0$0({1}SX:U),J,0,0
S:G$CCF4$0$0({1}SX:U),J,0,0
S:G$CR$0$0({1}SX:U),J,0,0
S:G$CF$0$0({1}SX:U),J,0,0
S:G$ADLJST$0$0({1}SX:U),J,0,0
S:G$AD0LJST$0$0({1}SX:U),J,0,0
S:G$ADWINT$0$0({1}SX:U),J,0,0
S:G$AD0WINT$0$0({1}SX:U),J,0,0
S:G$ADSTM0$0$0({1}SX:U),J,0,0
S:G$AD0CM0$0$0({1}SX:U),J,0,0
S:G$ADSTM1$0$0({1}SX:U),J,0,0
S:G$AD0CM1$0$0({1}SX:U),J,0,0
S:G$ADBUSY$0$0({1}SX:U),J,0,0
S:G$AD0BUSY$0$0({1}SX:U),J,0,0
S:G$ADCINT$0$0({1}SX:U),J,0,0
S:G$AD0INT$0$0({1}SX:U),J,0,0
S:G$ADCTM$0$0({1}SX:U),J,0,0
S:G$AD0TM$0$0({1}SX:U),J,0,0
S:G$ADCEN$0$0({1}SX:U),J,0,0
S:G$AD0EN$0$0({1}SX:U),J,0,0
S:G$SPIEN$0$0({1}SX:U),J,0,0
S:G$MSTEN$0$0({1}SX:U),J,0,0
S:G$SLVSEL$0$0({1}SX:U),J,0,0
S:G$TXBSY$0$0({1}SX:U),J,0,0
S:G$RXOVRN$0$0({1}SX:U),J,0,0
S:G$MODF$0$0({1}SX:U),J,0,0
S:G$WCOL$0$0({1}SX:U),J,0,0
S:G$SPIF$0$0({1}SX:U),J,0,0
S:G$out1$0$0({1}SX:U),J,0,0
S:G$out2$0$0({1}SX:U),J,0,0
S:G$SYSCLK_Init$0$0({2}DF,SV:S),C,0,0
S:G$UART0_Init$0$0({2}DF,SV:S),C,0,0
S:G$Sys_Init$0$0({2}DF,SV:S),C,0,0
S:G$getchar_nw$0$0({2}DF,SC:U),C,0,0
S:G$_print_format$0$0({2}DF,SI:S),C,0,0
S:G$printf_small$0$0({2}DF,SV:S),C,0,0
S:G$printf$0$0({2}DF,SI:S),C,0,0
S:G$vprintf$0$0({2}DF,SI:S),C,0,0
S:G$sprintf$0$0({2}DF,SI:S),C,0,0
S:G$vsprintf$0$0({2}DF,SI:S),C,0,0
S:G$puts$0$0({2}DF,SI:S),C,0,0
S:G$getchar$0$0({2}DF,SC:U),C,0,0
S:G$putchar$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast_f$0$0({2}DF,SV:S),C,0,0
S:G$printf_tiny$0$0({2}DF,SV:S),C,0,0
S:G$main$0$0({2}DF,SV:S),C,0,0
S:Fhw4$__str_0$0$0({44}DA44d,SC:S),D,0,0
S:Fhw4$__str_1$0$0({45}DA45d,SC:S),D,0,0
|
faicaltoubali/ENSEEIHT | Ada | 6,296 | adb | With Ada.Text_IO ; use Ada.Text_IO ;
package body registre is
------------------------------------------------------------------
function Hashage ( Identifiant : in Integer ) return integer is
begin
return (Identifiant mod Capacite) ;
end Hashage ;
------------------------------------------------------------------
------------------------------------------------------------------
procedure Initialiser( Registre : out T_Registre) is
begin
Registre.Taille :=0 ;
end Initialiser ;
-------------------------------------------------------------------
----------------------------------------------------------------------------------------
function Est_Vide(Registre : in T_Registre) return boolean is
begin
return Registre.Taille = 0 ;
end Est_Vide ;
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
function Appartient(Registre : in T_Registre ; Id : in integer ) return Boolean is
Index : integer ;
begin
Index := hashage( Id );
return Registre.elements(index).Identifiant = Id ;
end Appartient ;
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
function Creer_Dictionnaire ( Nom : Unbounded_String ; Prenom : Unbounded_String ; Jour : Integer ; Mois : T_Mois ; Annee : Integer ; Lieu_De_Naissance : Unbounded_String ) return T_Dictionnaire is
Date : T_Date ;
Dico : T_Dictionnaire ;
begin
Date.Jour := Jour;
Date.Mois := Mois;
Date.Annee := Annee ;
Dico.Nom := Nom ;
Dico.Prenom := Prenom ;
Dico.Date_De_Naissance := Date ;
Dico.Lieu_De_Naissance := Lieu_De_Naissance ;
return Dico ;
end Creer_Dictionnaire;
-------------------------------------------------------------------------------------------------------------------------------------------------
Procedure Ajouter_Identifiant_Dictionnaire( Registre : in out T_Registre ; Identifiant : in Integer ; Dictionnaire : in T_Dictionnaire ) is
Petit_Cellule : T_Cellule ;
Index : Integer ;
begin
if not Appartient(Registre , Identifiant) then
Index := Hashage( Identifiant) ;
Petit_Cellule.Identifiant := Identifiant ;
Petit_Cellule.Dictionnaire := Dictionnaire ;
Registre.elements(index) := Petit_Cellule ;
else
raise Identifiant_Absent_Exception ;
end if ;
Exception
when Identifiant_Absent_Exception => Put_Line("l'identifiant est déja existant");
end Ajouter_Identifiant_Dictionnaire ;
------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Enregistrer_Dictionnaire_Identifiant ( Registre : in out T_Registre ; Identifiant : in Integer ; Dictionnaire : in T_Dictionnaire ) is
Index : Integer ;
begin
if Appartient(Registre , Identifiant) then
Index := Hashage(Identifiant) ;
Registre.elements(Index).Dictionnaire := Dictionnaire ;
else
raise Identifiant_Present_Exception ;
end if ;
Exception
when Identifiant_Present_Exception => Put_Line("l'identifiant n'existe pas");
end Enregistrer_Dictionnaire_Identifiant ;
--------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Supprimer_Identifiant ( Registre : in out T_Registre ; Identifiant : in Integer ) is
Index : Integer ;
begin
if Appartient(Registre , Identifiant) then
Index := Hashage(Identifiant) ;
Registre.elements(Index) := Registre.elements(Taille_Registre(Registre)) ;
Registre.taille := Registre.taille -1 ;
else
Null ;
end if ;
end Supprimer_Identifiant ;
--------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
function Dictionnaire_Identifiant ( Registre : in T_Registre ; Identifiant : in Integer ) return T_Dictionnaire is
D: T_Dictionnaire ;
Index : Integer ;
begin
if Appartient(Registre , Identifiant) then
Index := hashage(Identifiant);
D := Registre.elements(index).Dictionnaire ;
return D ;
else
raise Identifiant_Absent_Exception;
end if;
end Dictionnaire_Identifiant ;
--------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
function Taille_Registre ( Rg : in T_Registre ) return Integer is
begin
if Est_vide(Rg) then
return 0;
else
return Rg.Taille ;
end if ;
end Taille_Registre ;
-----------------------------------------------------------------------------------------------------------------------------------------------------------
end registre ;
|
AdaCore/Ada_Drivers_Library | Ada | 4,964 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with nRF.Device; use nRF.Device;
with nRF.GPIO; use nRF.GPIO;
with NRF52_DK.Time; use NRF52_DK.Time;
package body NRF52_DK.Buttons is
type Button_State_Array is array (Button_Id) of Button_State;
Points : constant array (Button_Id) of GPIO_Point := (P13, P14, P15, P16);
States : Button_State_Array := (others => Released);
Subscribers : array (1 .. 10) of Button_Callback := (others => null);
procedure Initialize;
procedure Tick_Handler;
----------------
-- Initialize --
----------------
procedure Initialize is
Conf : GPIO_Configuration;
begin
Conf.Mode := Mode_In;
Conf.Resistors := Pull_Up;
Conf.Input_Buffer := Input_Buffer_Connect;
Conf.Sense := Sense_Disabled;
for Pt of Points loop
Pt.Configure_IO (Conf);
end loop;
if not Tick_Subscribe (Tick_Handler'Access) then
raise Program_Error;
end if;
end Initialize;
------------------
-- Tick_Handler --
------------------
procedure Tick_Handler is
Prev_States : constant Button_State_Array := States;
begin
-- Update all components of States array
for Id in Button_Id loop
if not Set (Points (Id)) then
States (Id) := Pressed;
else
States (Id) := Released;
end if;
end loop;
-- Notify changes to subscribers
for Id in Button_Id loop
if States (Id) /= Prev_States (Id) then
for Sub of Subscribers loop
if Sub /= null then
Sub.all (Id, States (Id));
end if;
end loop;
end if;
end loop;
end Tick_Handler;
-----------
-- State --
-----------
function State (Button : Button_Id) return Button_State is
begin
return States (Button);
end State;
---------------
-- Subscribe --
---------------
function Subscribe (Callback : not null Button_Callback) return Boolean is
begin
for Subs of Subscribers loop
if Subs = null then
Subs := Callback;
return True;
end if;
end loop;
return False;
end Subscribe;
-----------------
-- Unsubscribe --
-----------------
function Unsubscribe (Callback : not null Button_Callback) return Boolean is
begin
for Subs of Subscribers loop
if Subs = Callback then
Subs := null;
return True;
end if;
end loop;
return False;
end Unsubscribe;
begin
Initialize;
end NRF52_DK.Buttons;
|
reznikmm/gela | Ada | 10,200 | ads | with Gela.Compilations;
with Gela.Interpretations;
with Gela.Lexical_Types;
with Gela.Semantic_Types;
with Gela.Elements.Defining_Names;
with Gela.Elements.Generic_Associations;
package Gela.Resolve is
pragma Preelaborate;
procedure Direct_Name
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Symbol : Gela.Lexical_Types.Symbol;
Set : out Gela.Interpretations.Interpretation_Set_Index);
-- Resolve Symbol as direct_name and populate interpretation set with
-- defining name interpretations
procedure Selected_Component
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Prefix : Gela.Interpretations.Interpretation_Set_Index;
Symbol : Gela.Lexical_Types.Symbol;
Set : out Gela.Interpretations.Interpretation_Set_Index);
-- Resolve Symbol as selected_component and populate interpretation set
-- with defining name interpretations
procedure Attribute_Reference
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Prefix : Gela.Interpretations.Interpretation_Set_Index;
Symbol : Gela.Lexical_Types.Symbol;
Set : out Gela.Interpretations.Interpretation_Set_Index);
-- Resolve Symbol as attr. reference designator and populate interpretation
-- set with interpretations
procedure Simple_Expression_Range
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Set : out Gela.Interpretations.Interpretation_Set_Index);
procedure Membership_Test
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Set : out Gela.Interpretations.Interpretation_Set_Index);
procedure Discrete_Range
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Tipe : out Gela.Semantic_Types.Type_View_Index);
procedure Discrete_Range_Lower
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Discrete_Range_Upper
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Function_Call
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Prefix : Gela.Interpretations.Interpretation_Set_Index;
Args : Gela.Interpretations.Interpretation_Tuple_List_Index;
Set : out Gela.Interpretations.Interpretation_Set_Index);
procedure Qualified_Expression
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Prefix : Gela.Interpretations.Interpretation_Set_Index;
Arg : Gela.Interpretations.Interpretation_Set_Index;
Set : out Gela.Interpretations.Interpretation_Set_Index);
procedure Shall_Be_Subtype
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Set : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Set of interpretation shall resolve to denote a subtype. 3.2.2 (8)
procedure To_Type
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Type_Up : Gela.Interpretations.Interpretation_Set_Index;
Expr_Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Resolve Type_Up to be type, then resolve Expr_Up have this type
procedure To_The_Same_Type
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Type_Up : Gela.Interpretations.Interpretation_Set_Index;
Expr_Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Resolve Type_Up to be an expression of some type, then resolve Expr_Up
-- to have this type.
procedure Case_Statement
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Expr_Up : Gela.Interpretations.Interpretation_Set_Index;
Tuple : Gela.Interpretations.Interpretation_Tuple_List_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Resolve Type_Up to be an expression of some type, then resolve each item
-- of Tuple to have this type.
procedure To_Type_Or_The_Same_Type
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Type_Up : Gela.Interpretations.Interpretation_Set_Index;
Expr_Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Resolve Type_Up to be a type or an expression of some type,
-- then resolve Expr_Up to have this type.
procedure Character_Literal
(Comp : Gela.Compilations.Compilation_Access;
Result : out Gela.Interpretations.Interpretation_Set_Index);
procedure Numeric_Literal
(Comp : Gela.Compilations.Compilation_Access;
Token : Gela.Lexical_Types.Token_Count;
Result : out Gela.Interpretations.Interpretation_Set_Index);
procedure String_Literal
(Comp : Gela.Compilations.Compilation_Access;
Token : Gela.Lexical_Types.Token_Count;
Result : out Gela.Interpretations.Interpretation_Set_Index);
procedure Interpretation
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Set : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Get any interpretation from the Set excluding Symbol
function Placeholder
(Comp : Gela.Compilations.Compilation_Access)
return Gela.Interpretations.Interpretation_Set_Index;
procedure Constraint
(Comp : Gela.Compilations.Compilation_Access;
Constraint : access Gela.Elements.Element'Class;
Env : Gela.Semantic_Types.Env_Index;
Type_Up : Gela.Interpretations.Interpretation_Set_Index;
Constr : Gela.Interpretations.Interpretation_Tuple_List_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Constraint
(Comp : Gela.Compilations.Compilation_Access;
Constraint : access Gela.Elements.Element'Class;
Env : Gela.Semantic_Types.Env_Index;
Type_Up : Gela.Interpretations.Interpretation_Set_Index;
Constr : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Variant_Part
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Name_Up : Gela.Interpretations.Interpretation_Set_Index;
Variants : Gela.Interpretations.Interpretation_Tuple_List_Index;
Result : out Gela.Interpretations.Interpretation_Index);
-- Resolve variant_part using Name_Up as interpretations of discriminant,
-- Variants is putle of tuples of discrete_choice interpretations
procedure Assignment_Right
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Left : Gela.Interpretations.Interpretation_Set_Index;
Right : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Signed_Integer_Type
(Comp : Gela.Compilations.Compilation_Access;
Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Real_Type
(Comp : Gela.Compilations.Compilation_Access;
Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
function Record_Matcher
return not null Gela.Interpretations.Type_Matcher_Access;
function Array_Matcher
return not null Gela.Interpretations.Type_Matcher_Access;
procedure Record_Aggregate
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Up : Gela.Interpretations.Interpretation_Index;
Tuple : Gela.Interpretations.Interpretation_Tuple_List_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Generic_Association
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
-- Actual_Part : Gela.Elements.Generic_Associations.
-- Generic_Association_Sequence_Access;
Up : Gela.Interpretations.Interpretation_Set_Index;
Result : out Gela.Interpretations.Interpretation_Index);
procedure Generic_Association_List
(Comp : Gela.Compilations.Compilation_Access;
Env : Gela.Semantic_Types.Env_Index;
Instance : Gela.Elements.Element_Access;
Generic_Name : Gela.Elements.Defining_Names.Defining_Name_Access;
Actual_Part : Gela.Elements.Generic_Associations.
Generic_Association_Sequence_Access;
Associations : Gela.Interpretations.Interpretation_Tuple_Index;
Result : out Gela.Interpretations.Interpretation_Index);
end Gela.Resolve;
|
reznikmm/matreshka | Ada | 6,000 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
with ODF.DOM.Elements.Text.H.Internals;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Elements.Text.H is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access Text_H_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then
ODF.DOM.Visitors.ODF_Visitor'Class
(Visitor).Enter_Text_H
(ODF.DOM.Elements.Text.H.Internals.Create
(Text_H_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Enter_Element (Visitor, Control);
end if;
end Enter_Element;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_H_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.H_Name;
end Get_Local_Name;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access Text_H_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then
ODF.DOM.Visitors.ODF_Visitor'Class
(Visitor).Leave_Text_H
(ODF.DOM.Elements.Text.H.Internals.Create
(Text_H_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Leave_Element (Visitor, Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access Text_H_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.ODF_Iterator'Class then
ODF.DOM.Iterators.ODF_Iterator'Class
(Iterator).Visit_Text_H
(Visitor,
ODF.DOM.Elements.Text.H.Internals.Create
(Text_H_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Visit_Element (Iterator, Visitor, Control);
end if;
end Visit_Element;
end Matreshka.ODF_Elements.Text.H;
|
sungyeon/drake | Ada | 478 | ads | pragma License (Unrestricted);
-- extended unit
with Ada.References.Wide_Strings;
with Ada.Streams.Block_Transmission.Wide_Strings;
with Ada.Strings.Generic_Bounded;
package Ada.Strings.Bounded_Wide_Strings is
new Generic_Bounded (
Wide_Character,
Wide_String,
Streams.Block_Transmission.Wide_Strings.Read,
Streams.Block_Transmission.Wide_Strings.Write,
References.Wide_Strings.Slicing);
pragma Preelaborate (Ada.Strings.Bounded_Wide_Strings);
|
AdaCore/training_material | Ada | 1,861 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package pmmintrin_h is
-- Copyright (C) 2003-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3, or (at your option)
-- any later version.
-- GCC is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- Under Section 7 of GPL version 3, you are granted additional
-- permissions described in the GCC Runtime Library Exception, version
-- 3.1, as published by the Free Software Foundation.
-- You should have received a copy of the GNU General Public License and
-- a copy of the GCC Runtime Library Exception along with this program;
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-- <http://www.gnu.org/licenses/>.
-- Implemented from the specification included in the Intel C++ Compiler
-- User Guide and Reference, version 9.0.
-- We need definitions from the SSE2 and SSE header files
-- Additional bits in the MXCSR.
-- skipped func _mm_addsub_ps
-- skipped func _mm_hadd_ps
-- skipped func _mm_hsub_ps
-- skipped func _mm_movehdup_ps
-- skipped func _mm_moveldup_ps
-- skipped func _mm_addsub_pd
-- skipped func _mm_hadd_pd
-- skipped func _mm_hsub_pd
-- skipped func _mm_loaddup_pd
-- skipped func _mm_movedup_pd
-- skipped func _mm_lddqu_si128
-- skipped func _mm_monitor
-- skipped func _mm_mwait
end pmmintrin_h;
|
Fabien-Chouteau/AGATE | Ada | 2,670 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
private package AGATE.Mutexes is
procedure Wait_Lock (Mut : Mutex_ID);
function Try_Lock (Mut : Mutex_ID) return Boolean;
procedure Release (Mut : Mutex_ID);
private
procedure Insert_Task (Mut : in out Mutex;
T : Task_Object_Access);
end AGATE.Mutexes;
|
reznikmm/matreshka | Ada | 3,689 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Db_Driver_Settings_Elements is
pragma Preelaborate;
type ODF_Db_Driver_Settings is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Db_Driver_Settings_Access is
access all ODF_Db_Driver_Settings'Class
with Storage_Size => 0;
end ODF.DOM.Db_Driver_Settings_Elements;
|
1Crazymoney/LearnAda | Ada | 7,446 | adb | pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__hello.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__hello.adb");
pragma Suppress (Overflow_Check);
with Ada.Exceptions;
package body ada_main is
pragma Warnings (Off);
E73 : Short_Integer; pragma Import (Ada, E73, "system__os_lib_E");
E14 : Short_Integer; pragma Import (Ada, E14, "system__soft_links_E");
E24 : Short_Integer; pragma Import (Ada, E24, "system__exception_table_E");
E47 : Short_Integer; pragma Import (Ada, E47, "ada__io_exceptions_E");
E49 : Short_Integer; pragma Import (Ada, E49, "ada__tags_E");
E46 : Short_Integer; pragma Import (Ada, E46, "ada__streams_E");
E71 : Short_Integer; pragma Import (Ada, E71, "interfaces__c_E");
E26 : Short_Integer; pragma Import (Ada, E26, "system__exceptions_E");
E76 : Short_Integer; pragma Import (Ada, E76, "system__file_control_block_E");
E65 : Short_Integer; pragma Import (Ada, E65, "system__file_io_E");
E69 : Short_Integer; pragma Import (Ada, E69, "system__finalization_root_E");
E67 : Short_Integer; pragma Import (Ada, E67, "ada__finalization_E");
E18 : Short_Integer; pragma Import (Ada, E18, "system__secondary_stack_E");
E07 : Short_Integer; pragma Import (Ada, E07, "ada__text_io_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E07 := E07 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "ada__text_io__finalize_spec");
begin
F1;
end;
declare
procedure F2;
pragma Import (Ada, F2, "system__file_io__finalize_body");
begin
E65 := E65 - 1;
F2;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E24 := E24 + 1;
Ada.Io_Exceptions'Elab_Spec;
E47 := E47 + 1;
Ada.Tags'Elab_Spec;
Ada.Streams'Elab_Spec;
E46 := E46 + 1;
Interfaces.C'Elab_Spec;
System.Exceptions'Elab_Spec;
E26 := E26 + 1;
System.File_Control_Block'Elab_Spec;
E76 := E76 + 1;
System.Finalization_Root'Elab_Spec;
E69 := E69 + 1;
Ada.Finalization'Elab_Spec;
E67 := E67 + 1;
System.File_Io'Elab_Body;
E65 := E65 + 1;
E71 := E71 + 1;
Ada.Tags'Elab_Body;
E49 := E49 + 1;
System.Soft_Links'Elab_Body;
E14 := E14 + 1;
System.Os_Lib'Elab_Body;
E73 := E73 + 1;
System.Secondary_Stack'Elab_Body;
E18 := E18 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E07 := E07 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_hello");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- C:\Users\Soba95\Desktop\ada\hello.o
-- -LC:\Users\Soba95\Desktop\ada\
-- -LC:\Users\Soba95\Desktop\ada\
-- -LC:/gnat/2015/lib/gcc/i686-pc-mingw32/4.9.3/adalib/
-- -static
-- -lgnat
-- -Wl,--stack=0x2000000
-- END Object file/option list
end ada_main;
|
Rodeo-McCabe/orka | Ada | 3,079 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Transforms.Doubles.Matrices;
with Orka.Transforms.Doubles.Matrix_Conversions;
package body Orka.Cameras.Rotate_Around_Cameras is
procedure Set_Angles
(Object : in out Rotate_Around_Camera;
Alpha : Angle;
Beta : Angle) is
begin
Object.Alpha := Alpha;
Object.Beta := Beta;
end Set_Angles;
procedure Set_Radius
(Object : in out Rotate_Around_Camera;
Radius : Distance) is
begin
Object.Radius := Radius;
end Set_Radius;
overriding
procedure Update (Object : in out Rotate_Around_Camera; Delta_Time : Duration) is
Using_Camera : constant Boolean := Object.Input.Button_Pressed (Inputs.Pointers.Right);
begin
Object.Input.Lock_Pointer (Using_Camera);
if Using_Camera then
Object.Alpha := Normalize_Angle (Object.Alpha + Object.Input.Delta_X * Object.Scale (X));
Object.Beta := Normalize_Angle (Object.Beta + Object.Input.Delta_Y * Object.Scale (Y));
end if;
Object.Radius := Clamp_Distance (Object.Radius - Object.Input.Scroll_Y * Object.Scale (Z));
end Update;
use Orka.Transforms.Doubles.Matrices;
use Orka.Transforms.Doubles.Matrix_Conversions;
overriding
function View_Matrix (Object : Rotate_Around_Camera) return Transforms.Matrix4 is
(Convert (Rx (Object.Beta) * Ry (Object.Alpha) * Object.Rotate_To_Up));
function View_Matrix_Inverse (Object : Rotate_Around_Camera) return Matrix4 is
(Transpose (Object.Rotate_To_Up) * Ry (-Object.Alpha) * Rx (-Object.Beta))
with Inline;
overriding
function View_Matrix_Inverse (Object : Rotate_Around_Camera) return Transforms.Matrix4 is
(Convert (Object.View_Matrix_Inverse));
overriding
function View_Position (Object : Rotate_Around_Camera) return Vector4 is
View_Matrix : constant Matrix4 :=
Object.Target_Position + Object.View_Matrix_Inverse * T ((0.0, 0.0, Object.Radius, 0.0));
begin
return View_Matrix (W);
end View_Position;
overriding
function Create_Camera
(Input : Inputs.Pointers.Pointer_Input_Ptr;
Lens : Lens_Ptr;
FB : aliased Rendering.Framebuffers.Framebuffer) return Rotate_Around_Camera is
begin
return Rotate_Around_Camera'(Camera with
Input => Input,
Lens => Lens,
FB => FB'Access,
others => <>);
end Create_Camera;
end Orka.Cameras.Rotate_Around_Cameras;
|
zhmu/ananas | Ada | 10,327 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ W I D E _ M A P S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Finalization;
package Ada.Strings.Wide_Wide_Maps is
pragma Preelaborate;
------------------------------------------
-- Wide_Wide_Character Set Declarations --
------------------------------------------
type Wide_Wide_Character_Set is private;
pragma Preelaborable_Initialization (Wide_Wide_Character_Set);
-- Representation for a set of Wide_Wide_Character values:
Null_Set : constant Wide_Wide_Character_Set;
-----------------------------------------------
-- Constructors for Wide_Wide_Character Sets --
-----------------------------------------------
type Wide_Wide_Character_Range is record
Low : Wide_Wide_Character;
High : Wide_Wide_Character;
end record;
-- Represents Wide_Wide_Character range Low .. High
type Wide_Wide_Character_Ranges is
array (Positive range <>) of Wide_Wide_Character_Range;
function To_Set
(Ranges : Wide_Wide_Character_Ranges) return Wide_Wide_Character_Set;
function To_Set
(Span : Wide_Wide_Character_Range) return Wide_Wide_Character_Set;
function To_Ranges
(Set : Wide_Wide_Character_Set) return Wide_Wide_Character_Ranges;
---------------------------------------
-- Operations on Wide Character Sets --
---------------------------------------
function "=" (Left, Right : Wide_Wide_Character_Set) return Boolean;
function "not"
(Right : Wide_Wide_Character_Set) return Wide_Wide_Character_Set;
function "and"
(Left, Right : Wide_Wide_Character_Set) return Wide_Wide_Character_Set;
function "or"
(Left, Right : Wide_Wide_Character_Set) return Wide_Wide_Character_Set;
function "xor"
(Left, Right : Wide_Wide_Character_Set) return Wide_Wide_Character_Set;
function "-"
(Left, Right : Wide_Wide_Character_Set) return Wide_Wide_Character_Set;
function Is_In
(Element : Wide_Wide_Character;
Set : Wide_Wide_Character_Set) return Boolean;
function Is_Subset
(Elements : Wide_Wide_Character_Set;
Set : Wide_Wide_Character_Set) return Boolean;
function "<="
(Left : Wide_Wide_Character_Set;
Right : Wide_Wide_Character_Set) return Boolean
renames Is_Subset;
subtype Wide_Wide_Character_Sequence is Wide_Wide_String;
-- Alternative representation for a set of character values
function To_Set
(Sequence : Wide_Wide_Character_Sequence) return Wide_Wide_Character_Set;
function To_Set
(Singleton : Wide_Wide_Character) return Wide_Wide_Character_Set;
function To_Sequence
(Set : Wide_Wide_Character_Set) return Wide_Wide_Character_Sequence;
----------------------------------------------
-- Wide_Wide_Character Mapping Declarations --
----------------------------------------------
type Wide_Wide_Character_Mapping is private;
pragma Preelaborable_Initialization (Wide_Wide_Character_Mapping);
-- Representation for a wide character to wide character mapping:
function Value
(Map : Wide_Wide_Character_Mapping;
Element : Wide_Wide_Character) return Wide_Wide_Character;
Identity : constant Wide_Wide_Character_Mapping;
--------------------------------------
-- Operations on Wide Wide Mappings --
---------------------------------------
function To_Mapping
(From, To : Wide_Wide_Character_Sequence)
return Wide_Wide_Character_Mapping;
function To_Domain
(Map : Wide_Wide_Character_Mapping) return Wide_Wide_Character_Sequence;
function To_Range
(Map : Wide_Wide_Character_Mapping) return Wide_Wide_Character_Sequence;
type Wide_Wide_Character_Mapping_Function is
access function (From : Wide_Wide_Character) return Wide_Wide_Character;
private
package AF renames Ada.Finalization;
-----------------------------------------------
-- Representation of Wide_Wide_Character_Set --
-----------------------------------------------
-- A wide character set is represented as a sequence of wide character
-- ranges (i.e. an object of type Wide_Wide_Character_Ranges) in which the
-- following hold:
-- The lower bound is 1
-- The ranges are in order by increasing Low values
-- The ranges are non-overlapping and discontigous
-- A character value is in the set if it is contained in one of the
-- ranges. The actual Wide_Wide_Character_Set value is a controlled pointer
-- to this Wide_Wide_Character_Ranges value. The use of a controlled type
-- is necessary to prevent storage leaks.
type Wide_Wide_Character_Ranges_Access is
access all Wide_Wide_Character_Ranges;
type Wide_Wide_Character_Set is new AF.Controlled with record
Set : Wide_Wide_Character_Ranges_Access;
end record;
pragma Finalize_Storage_Only (Wide_Wide_Character_Set);
-- This avoids useless finalizations, and, more importantly avoids
-- incorrect attempts to finalize constants that are statically
-- declared here and in Ada.Strings.Wide_Wide_Maps, which is incorrect.
procedure Initialize (Object : in out Wide_Wide_Character_Set);
procedure Adjust (Object : in out Wide_Wide_Character_Set);
procedure Finalize (Object : in out Wide_Wide_Character_Set);
Null_Range : aliased constant Wide_Wide_Character_Ranges := [];
Null_Set : constant Wide_Wide_Character_Set :=
(AF.Controlled with
Set => Null_Range'Unrestricted_Access);
---------------------------------------------------
-- Representation of Wide_Wide_Character_Mapping --
---------------------------------------------------
-- A wide character mapping is represented as two strings of equal
-- length, where any character appearing in Domain is mapped to the
-- corresponding character in Rangev. A character not appearing in
-- Domain is mapped to itself. The characters in Domain are sorted
-- in ascending order.
-- The actual Wide_Wide_Character_Mapping value is a controlled record
-- that contains a pointer to a discriminated record containing the
-- range and domain values.
-- Note: this representation is canonical, and the values stored in
-- Domain and Rangev are exactly the values that are returned by the
-- functions To_Domain and To_Range. The use of a controlled type is
-- necessary to prevent storage leaks.
type Wide_Wide_Character_Mapping_Values (Length : Natural) is record
Domain : Wide_Wide_Character_Sequence (1 .. Length);
Rangev : Wide_Wide_Character_Sequence (1 .. Length);
end record;
type Wide_Wide_Character_Mapping_Values_Access is
access all Wide_Wide_Character_Mapping_Values;
type Wide_Wide_Character_Mapping is new AF.Controlled with record
Map : Wide_Wide_Character_Mapping_Values_Access;
end record;
pragma Finalize_Storage_Only (Wide_Wide_Character_Mapping);
-- This avoids useless finalizations, and, more importantly avoids
-- incorrect attempts to finalize constants that are statically
-- declared here and in Ada.Strings.Wide_Wide_Maps, which is incorrect.
procedure Initialize (Object : in out Wide_Wide_Character_Mapping);
procedure Adjust (Object : in out Wide_Wide_Character_Mapping);
procedure Finalize (Object : in out Wide_Wide_Character_Mapping);
Null_Map : aliased constant Wide_Wide_Character_Mapping_Values :=
(Length => 0,
Domain => "",
Rangev => "");
Identity : constant Wide_Wide_Character_Mapping :=
(AF.Controlled with
Map => Null_Map'Unrestricted_Access);
end Ada.Strings.Wide_Wide_Maps;
|
jrcarter/Ada_GUI | Ada | 4,887 | adb | -- Ada_GUI implementation based on Gnoga. Adapted 2021
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A . S E R V E R . D A T A B A S E --
-- --
-- B o d y --
-- --
-- --
-- Copyright (C) 2014 David Botton --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are --
-- granted additional permissions described in the GCC Runtime Library --
-- Exception, version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
package body Ada_GUI.Gnoga.Server.Database is
----------------
-- Field_Type --
----------------
function Field_Type (Field : Field_Description) return String is
Data : constant String :=
Ada.Strings.Unbounded.To_String (Field.Data_Type);
Right : constant Natural := Ada.Strings.Fixed.Index (Data, "(");
begin
if Right = 0 then
return Data;
else
return Data (Data'First .. Right - 1);
end if;
end Field_Type;
function Field_Size (Field : Field_Description) return Natural is
Option : constant String := Field_Options (Field);
begin
if Option = "" then
return 0;
else
declare
Comma : constant Natural := Ada.Strings.Fixed.Index (Option, ",");
begin
if Comma = 0 then
return Natural'Value (Option);
else
return Natural'Value (Option (Option'First .. Comma - 1));
end if;
end;
end if;
end Field_Size;
--------------------
-- Field_Decimals --
--------------------
function Field_Decimals (Field : Field_Description) return Natural is
Option : constant String := Field_Options (Field);
Comma : constant Natural := Ada.Strings.Fixed.Index (Option, ",");
begin
if Comma = 0 then
return 0;
else
return Natural'Value (Option (Comma + 1 .. Option'Last));
end if;
end Field_Decimals;
-------------------
-- Field_Options --
-------------------
function Field_Options (Field : Field_Description) return String is
Data : constant String :=
Ada.Strings.Unbounded.To_String (Field.Data_Type);
Right : constant Natural := Ada.Strings.Fixed.Index (Data, "(");
Left : constant Natural := Ada.Strings.Fixed.Index (Data, ")");
begin
if Right = 0 or Left = 0 then
return "";
else
return Data (Right + 1 .. Left - 1);
end if;
end Field_Options;
end Ada_GUI.Gnoga.Server.Database;
|
francesco-bongiovanni/ewok-kernel | Ada | 741 | adb |
package body types.c
with SPARK_Mode => Off
is
function len (s : c_string) return natural
is
len : natural := 0;
begin
for i in s'range loop
exit when s(i) = nul;
len := len + 1;
end loop;
return len;
end len;
procedure to_ada
(dst : out string;
src : in c_string)
is
begin
for i in src'range loop
exit when src(i) = nul;
dst(i) := src(i);
end loop;
end to_ada;
procedure to_c
(dst : out c_string;
src : in string)
is
len : natural := 0;
begin
for i in src'range loop
dst(i) := src(i);
len := len + 1;
end loop;
dst(len) := nul;
end to_c;
end types.c;
|
reznikmm/matreshka | Ada | 5,262 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.UML.Packageable_Elements.Collections is
pragma Preelaborate;
package UML_Packageable_Element_Collections is
new AMF.Generic_Collections
(UML_Packageable_Element,
UML_Packageable_Element_Access);
type Set_Of_UML_Packageable_Element is
new UML_Packageable_Element_Collections.Set with null record;
Empty_Set_Of_UML_Packageable_Element : constant Set_Of_UML_Packageable_Element;
type Ordered_Set_Of_UML_Packageable_Element is
new UML_Packageable_Element_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Packageable_Element : constant Ordered_Set_Of_UML_Packageable_Element;
type Bag_Of_UML_Packageable_Element is
new UML_Packageable_Element_Collections.Bag with null record;
Empty_Bag_Of_UML_Packageable_Element : constant Bag_Of_UML_Packageable_Element;
type Sequence_Of_UML_Packageable_Element is
new UML_Packageable_Element_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Packageable_Element : constant Sequence_Of_UML_Packageable_Element;
private
Empty_Set_Of_UML_Packageable_Element : constant Set_Of_UML_Packageable_Element
:= (UML_Packageable_Element_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Packageable_Element : constant Ordered_Set_Of_UML_Packageable_Element
:= (UML_Packageable_Element_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Packageable_Element : constant Bag_Of_UML_Packageable_Element
:= (UML_Packageable_Element_Collections.Bag with null record);
Empty_Sequence_Of_UML_Packageable_Element : constant Sequence_Of_UML_Packageable_Element
:= (UML_Packageable_Element_Collections.Sequence with null record);
end AMF.UML.Packageable_Elements.Collections;
|
godunko/cga | Ada | 4,546 | adb | --
-- Copyright (C) 2023, Vadim Godunko <[email protected]>
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
with Ada.Unchecked_Deallocation;
package body CGK.Internals.Generic_Sequences is
procedure Free is
new Ada.Unchecked_Deallocation
(Element_Array_Type, Element_Array_Access);
procedure Reallocate
(Data : in out Element_Array_Access;
Capacity : Index_Type'Base;
Size : Index_Type'Base);
------------
-- Adjust --
------------
overriding procedure Adjust (Self : in out Sequence) is
begin
if Self.Data /= null then
Self.Data := new Element_Array_Type'(Self.Data.all);
end if;
end Adjust;
------------
-- Append --
------------
procedure Append (Self : in out Sequence'Class; Item : Element_Type) is
begin
Self.Length := @ + 1;
Reallocate (Self.Data, Self.Capacity, Self.Length);
Self.Data (Self.Length) := Item;
end Append;
-----------
-- Clear --
-----------
procedure Clear (Self : in out Sequence'Class) is
begin
Free (Self.Data);
Self.Capacity := 0;
Self.Length := 0;
end Clear;
------------
-- Delete --
------------
procedure Delete (Self : in out Sequence'Class; Index : Index_Type) is
begin
if Index not in 1 .. Self.Length then
raise Constraint_Error;
end if;
Self.Data (Index .. Self.Length - 1) :=
Self.Data (Index + 1 .. Self.Length);
Self.Length := @ - 1;
end Delete;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (Self : in out Sequence'Class) is
begin
if Self.Length = 0 then
raise Constraint_Error;
end if;
Self.Length := @ - 1;
end Delete_Last;
-------------
-- Element --
-------------
function Element
(Self : Sequence'Class; Index : Index_Type) return Element_Type is
begin
if Index not in 1 .. Self.Length then
raise Constraint_Error;
end if;
return Self.Data (Index);
end Element;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Self : in out Sequence) is
begin
Free (Self.Data);
end Finalize;
-----------
-- First --
-----------
function First (Self : Sequence'Class) return Index_Type is
pragma Unreferenced (Self);
begin
return 1;
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Self : Sequence'Class) return Element_Type is
begin
if Self.Length = 0 then
raise Constraint_Error;
end if;
return Self.Data (Self.Data'First);
end First_Element;
----------
-- Last --
----------
function Last (Self : Sequence'Class) return Index_Type'Base is
begin
return Self.Length;
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Self : Sequence'Class) return Element_Type is
begin
if Self.Length = 0 then
raise Program_Error;
end if;
return Self.Data (Self.Length);
end Last_Element;
------------
-- Length --
------------
function Length (Self : Sequence'Class) return Count_Type is
begin
return Self.Length;
end Length;
----------------
-- Reallocate --
----------------
procedure Reallocate
(Data : in out Element_Array_Access;
Capacity : Index_Type'Base;
Size : Index_Type'Base)
is
New_Size : constant Index_Type'Base :=
Index_Type'Max (Capacity, Size * 2);
Aux : Element_Array_Access := Data;
begin
if Size = 0 then
return;
elsif Data = null or else Size > Data'Last then
Data := new Element_Array_Type (1 .. New_Size);
if Aux /= null then
Data (Aux'Range) := Aux.all;
Free (Aux);
end if;
end if;
end Reallocate;
-------------
-- Replace --
-------------
procedure Replace
(Self : in out Sequence'Class; Index : Index_Type; Item : Element_Type) is
begin
if Index not in 1 .. Self.Length then
raise Constraint_Error;
end if;
Self.Data (Index) := Item;
end Replace;
------------------
-- Set_Capacity --
------------------
procedure Set_Capacity
(Self : in out Sequence'Class; To : Index_Type'Base) is
begin
Self.Capacity := To;
end Set_Capacity;
end CGK.Internals.Generic_Sequences;
|
reznikmm/matreshka | Ada | 3,937 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Smil_To_Attributes;
package Matreshka.ODF_Smil.To_Attributes is
type Smil_To_Attribute_Node is
new Matreshka.ODF_Smil.Abstract_Smil_Attribute_Node
and ODF.DOM.Smil_To_Attributes.ODF_Smil_To_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Smil_To_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Smil_To_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Smil.To_Attributes;
|
AdaDoom3/wayland_ada_binding | Ada | 4,167 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
-- This package provides a specialization of the Element_Traits package for
-- use with indefinite type (i.e. their size might not be known at compile
-- time).
-- Such elements are returned as reference types, so containers will not
-- return the element itself. This is in general more efficient and safer,
-- and avoids copying potentially large elements.
pragma Ada_2012;
generic
type Element_Type (<>) is private;
with procedure Free (E : in out Element_Type) is null;
-- This procedure is called when the element is removed from its
-- container.
with package Pool is new Conts.Pools (<>);
package Conts.Elements.Indefinite is
type Element_Access is access all Element_Type;
for Element_Access'Storage_Pool use Pool.Pool;
type Constant_Reference_Type
(Element : not null access constant Element_Type)
is null record with Implicit_Dereference => Element;
-- ??? Would be nice if we could make this constrained by
-- providing a default value for the discriminant, but this is
-- illegal.
type Reference_Type (Element : not null access Element_Type)
is null record with Implicit_Dereference => Element;
function To_Element_Access (E : Element_Type) return Element_Access
is (new Element_Type'(E)) with Inline;
function To_Constant_Ref (E : Element_Access) return Constant_Reference_Type
is (Constant_Reference_Type'(Element => E)) with Inline;
function To_Element (E : Constant_Reference_Type) return Element_Type
is (E.Element.all) with Inline;
function To_Ref (E : Element_Access) return Reference_Type
is (Reference_Type'(Element => E)) with Inline;
function To_Element (E : Reference_Type) return Element_Type
is (E.Element.all) with Inline;
function Copy (E : Element_Access) return Element_Access
is (new Element_Type'(E.all)) with Inline;
procedure Release (E : in out Element_Access) with Inline;
package Traits is new Conts.Elements.Traits
(Element_Type => Element_Type,
Stored_Type => Element_Access,
Returned_Type => Reference_Type,
Constant_Returned_Type => Constant_Reference_Type,
To_Stored => To_Element_Access,
To_Returned => To_Ref,
To_Constant_Returned => To_Constant_Ref,
To_Element => To_Element,
Copy => Copy,
Release => Release,
Copyable => False, -- would create aliases
Movable => True);
end Conts.Elements.Indefinite;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 236 | ads | with Ada.Real_Time; use Ada.Real_Time;
package Tasks is
protected Protect is
procedure Go;
entry Wait;
private
Active : Boolean := False;
end Protect;
task T with Storage_Size => 512;
end Tasks;
|
reznikmm/matreshka | Ada | 3,669 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Table_Previous_Elements is
pragma Preelaborate;
type ODF_Table_Previous is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Previous_Access is
access all ODF_Table_Previous'Class
with Storage_Size => 0;
end ODF.DOM.Table_Previous_Elements;
|
burratoo/Acton | Ada | 6,744 | adb | ------------------------------------------------------------------------------------------
-- --
-- OAK PROCESSOR SUPPORT PACKAGE --
-- FREESCALE MPC5544 --
-- --
-- MPC5554.FLASH --
-- --
-- Copyright (C) 2010-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
with Ada.Unchecked_Conversion;
package body MPC5554.Flash is
-- Instead of throwing an exception, should probably return a code like
-- the Standard Software Driver does.
procedure Initialise_For_Flash_Programming is
MCR : Module_Configuration_Type renames Module_Configuration_Register;
FBIUCR : Flash_Bus_Interface_Unit_Control_Type;
begin
if MCR.ECC_Error_Event = Occurred then
raise Flash_Exception;
elsif MCR.Read_While_Write_Error_Event = Occurred then
raise Flash_Exception;
elsif MCR.Stop_Mode = Enable then
raise Flash_Exception;
end if;
-- Disable Prefetching and pipelining prior to programming.
Saved_FBIUCR := Flash_Bus_Interface_Unit_Control_Register;
FBIUCR := (Master_Prefetch => (others => Disable),
Address_Pipeline_Control => No_Pipelining,
Write_Wait_State_Control =>
Saved_FBIUCR.Write_Wait_State_Control,
Read_Wait_State_Control =>
Saved_FBIUCR.Read_Wait_State_Control,
Data_Prefetch => No_Prefetching,
Instruction_Prefetch => No_Prefetching,
Prefetch_Limit => Saved_FBIUCR.Prefetch_Limit,
FBIU_Line_Read_Buffers => Disable);
Write_Flash_Bus_Interface_Unit_Control_Register (FBIUCR);
end Initialise_For_Flash_Programming;
procedure Completed_Flash_Programming is
begin
Write_Flash_Bus_Interface_Unit_Control_Register (Saved_FBIUCR);
end Completed_Flash_Programming;
procedure Program_Protected_Access
(P : access protected procedure;
Destination : in Address)
is
MCR : Module_Configuration_Type := Module_Configuration_Register;
pragma Warnings (Off, "*alignment*");
P_Destination : access protected procedure
with Address => Destination,
Convention => Ada,
Import;
-- It would be preferable to use Address_To_Access_Conversions instead
-- of the Address clause but that would require a new type. Import
-- declaration is needed since we are overlapping memory.
pragma Warnings (On, "*alignment*");
begin
Do_Not_Clear_Error_States (MCR);
MCR.Program := Executing;
Module_Configuration_Register := MCR;
P_Destination := P;
MCR.High_Voltage := Enable;
Module_Configuration_Register := MCR;
while Module_Configuration_Register.Done = No loop
null;
end loop;
MCR.High_Voltage := Disable;
Module_Configuration_Register := MCR;
if Module_Configuration_Register.Program_Erase_Good = No then
MCR.Program := Not_Executing;
Module_Configuration_Register := MCR;
raise Flash_Exception;
end if;
MCR.Program := Not_Executing;
Module_Configuration_Register := MCR;
end Program_Protected_Access;
procedure Unlock_Space_Block_Locking_Register
(Space : in Address_Space)
is
function To_LMLR is new Ada.Unchecked_Conversion
(Unsigned_32, Low_Mid_Address_Space_Block_Locking_Type);
function To_HLR is new Ada.Unchecked_Conversion
(Unsigned_32, High_Address_Space_Block_Locking_Type);
begin
case Space is
when Shadow_Primary | Low_Primary | Mid_Primary =>
if Low_Mid_Address_Space_Block_Locking_Register.Locks =
Not_Editable
then
Low_Mid_Address_Space_Block_Locking_Register :=
To_LMLR (LMLR_Password);
end if;
when Shadow_Secondary | Low_Secondary | Mid_Secondary =>
if Secondary_Low_Mid_Address_Space_Block_Locking_Register.Locks =
Not_Editable
then
Secondary_Low_Mid_Address_Space_Block_Locking_Register :=
To_LMLR (SLMLR_Password);
end if;
when High =>
if High_Address_Space_Block_Locking_Register.Locks =
Not_Editable
then
High_Address_Space_Block_Locking_Register :=
To_HLR (HLR_Password);
end if;
end case;
end Unlock_Space_Block_Locking_Register;
procedure Write_Flash_Bus_Interface_Unit_Control_Register
(Contents : Flash_Bus_Interface_Unit_Control_Type)
is
begin
-- Save Link Register
Asm ("mflr r4" & ASCII.LF & ASCII.HT &
-- Load address of the register writing function to r5
"mr r5, %0" & ASCII.LF & ASCII.HT &
"mtlr r5" & ASCII.LF & ASCII.HT &
-- Load address of the Flash Bus Interface Unit Control Register
"lis r6, %1@ha" & ASCII.LF & ASCII.HT &
"addi r6, r6, %1@l" & ASCII.LF & ASCII.HT &
-- Move register contents to r7
"mr r7, %2" & ASCII.LF & ASCII.HT &
-- Branch to register writing function
"blrl" & ASCII.LF & ASCII.HT &
-- Restore Link Register
"mtlr r4",
Inputs => (Address'Asm_Input ("r", SRAM_LOAD'Address),
Address'Asm_Input ("i",
System'To_Address (Flash_Base_Address +
BIUCR_Offset_Address)),
Flash_Bus_Interface_Unit_Control_Type'Asm_Input ("r",
Contents)),
Clobber => "r4, r5, r6, r7",
Volatile => True);
end Write_Flash_Bus_Interface_Unit_Control_Register;
procedure Do_Not_Clear_Error_States (MCR : in out Module_Configuration_Type)
is
begin
MCR.ECC_Error_Event := Not_Occurred;
MCR.Read_While_Write_Error_Event := Not_Occurred;
end Do_Not_Clear_Error_States;
end MPC5554.Flash;
|
reznikmm/matreshka | Ada | 3,764 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Font_Family_Complex_Attributes is
pragma Preelaborate;
type ODF_Style_Font_Family_Complex_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Font_Family_Complex_Attribute_Access is
access all ODF_Style_Font_Family_Complex_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Font_Family_Complex_Attributes;
|
zhmu/ananas | Ada | 92 | adb | -- { dg-do compile }
package body Predicate5 is
procedure Foo is null;
end Predicate5;
|
zhmu/ananas | Ada | 14,005 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.UTF_ENCODING.CONVERSIONS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.UTF_Encoding.Conversions is
use Interfaces;
-- Convert from UTF-8/UTF-16BE/LE to UTF-8/UTF-16BE/LE
function Convert
(Item : UTF_String;
Input_Scheme : Encoding_Scheme;
Output_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_String
is
begin
-- Nothing to do if identical schemes, but for UTF_8 we need to
-- handle overlong encodings, so need to do the full conversion.
if Input_Scheme = Output_Scheme
and then Input_Scheme /= UTF_8
then
return Item;
-- For remaining cases, one or other of the operands is UTF-16BE/LE
-- encoded, or we have the UTF-8 to UTF-8 case where we must handle
-- overlong encodings. In all cases, go through UTF-16 intermediate.
else
return Convert (UTF_16_Wide_String'(Convert (Item, Input_Scheme)),
Output_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-8/UTF-16BE/LE to UTF-16
function Convert
(Item : UTF_String;
Input_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_16_Wide_String
is
begin
if Input_Scheme = UTF_8 then
return Convert (Item, Output_BOM);
else
return To_UTF_16 (Item, Input_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-8 to UTF-16
function Convert
(Item : UTF_8_String;
Output_BOM : Boolean := False) return UTF_16_Wide_String
is
Result : UTF_16_Wide_String (1 .. Item'Length + 1);
-- Maximum length of result, including possible BOM
Len : Natural := 0;
-- Number of characters stored so far in Result
Iptr : Natural;
-- Next character to process in Item
C : Unsigned_8;
-- Input UTF-8 code
R : Unsigned_16;
-- Output UTF-16 code
procedure Get_Continuation;
-- Reads a continuation byte of the form 10xxxxxx, shifts R left by 6
-- bits, and or's in the xxxxxx to the low order 6 bits. On return Ptr
-- is incremented. Raises exception if continuation byte does not exist
-- or is invalid.
----------------------
-- Get_Continuation --
----------------------
procedure Get_Continuation is
begin
if Iptr > Item'Last then
Raise_Encoding_Error (Iptr - 1);
else
C := To_Unsigned_8 (Item (Iptr));
Iptr := Iptr + 1;
if C < 2#10_000000# or else C > 2#10_111111# then
Raise_Encoding_Error (Iptr - 1);
else
R :=
Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#);
end if;
end if;
end Get_Continuation;
-- Start of processing for Convert
begin
-- Output BOM if required
if Output_BOM then
Len := Len + 1;
Result (Len) := BOM_16 (1);
end if;
-- Skip OK BOM
Iptr := Item'First;
if Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then
Iptr := Iptr + 3;
-- Error if bad BOM
elsif Item'Length >= 2
and then (Item (Iptr .. Iptr + 1) = BOM_16BE
or else
Item (Iptr .. Iptr + 1) = BOM_16LE)
then
Raise_Encoding_Error (Iptr);
-- No BOM present
else
Iptr := Item'First;
end if;
while Iptr <= Item'Last loop
C := To_Unsigned_8 (Item (Iptr));
Iptr := Iptr + 1;
-- Codes in the range 16#00# .. 16#7F#
-- UTF-8: 0xxxxxxx
-- UTF-16: 00000000_0xxxxxxx
if C <= 16#7F# then
Len := Len + 1;
Result (Len) := Wide_Character'Val (C);
-- No initial code can be of the form 10xxxxxx. Such codes are used
-- only for continuations.
elsif C <= 2#10_111111# then
Raise_Encoding_Error (Iptr - 1);
-- Codes in the range 16#80# .. 16#7FF#
-- UTF-8: 110yyyxx 10xxxxxx
-- UTF-16: 00000yyy_xxxxxxxx
elsif C <= 2#110_11111# then
R := Unsigned_16 (C and 2#000_11111#);
Get_Continuation;
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Codes in the range 16#800# .. 16#D7FF or 16#DF01# .. 16#FFFF#
-- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
-- UTF-16: yyyyyyyy_xxxxxxxx
elsif C <= 2#1110_1111# then
R := Unsigned_16 (C and 2#0000_1111#);
Get_Continuation;
Get_Continuation;
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Make sure that we don't have a result in the forbidden range
-- reserved for UTF-16 surrogate characters.
if R in 16#D800# .. 16#DF00# then
Raise_Encoding_Error (Iptr - 3);
end if;
-- Codes in the range 16#10000# .. 16#10FFFF#
-- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
-- UTF-16: 110110zz_zzyyyyyy 110111yy_xxxxxxxx
-- Note: zzzz in the output is input zzzzz - 1
elsif C <= 2#11110_111# then
R := Unsigned_16 (C and 2#00000_111#);
Get_Continuation;
-- R now has zzzzzyyyy
-- At this stage, we check for the case where we have an overlong
-- encoding, and the encoded value in fact lies in the single word
-- range (16#800# .. 16#D7FF or 16#DF01# .. 16#FFFF#). This means
-- that the result fits in a single result word.
if R <= 2#1111# then
Get_Continuation;
Get_Continuation;
-- Make sure we are not in the forbidden surrogate range
if R in 16#D800# .. 16#DF00# then
Raise_Encoding_Error (Iptr - 3);
end if;
-- Otherwise output a single UTF-16 value
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Here for normal case (code value > 16#FFFF and zzzzz non-zero)
else
-- Subtract 1 from input zzzzz value to get output zzzz value
R := R - 2#0000_1_0000#;
-- R now has zzzzyyyy (zzzz minus one for the output)
Get_Continuation;
-- R now has zzzzyy_yyyyyyxx
Len := Len + 1;
Result (Len) :=
Wide_Character'Val
(2#110110_00_0000_0000# or Shift_Right (R, 4));
R := R and 2#1111#;
Get_Continuation;
Len := Len + 1;
Result (Len) :=
Wide_Character'Val (2#110111_00_0000_0000# or R);
end if;
-- Any other code is an error
else
Raise_Encoding_Error (Iptr - 1);
end if;
end loop;
return Result (1 .. Len);
end Convert;
-- Convert from UTF-16 to UTF-8/UTF-16-BE/LE
function Convert
(Item : UTF_16_Wide_String;
Output_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_String
is
begin
if Output_Scheme = UTF_8 then
return Convert (Item, Output_BOM);
else
return From_UTF_16 (Item, Output_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-16 to UTF-8
function Convert
(Item : UTF_16_Wide_String;
Output_BOM : Boolean := False) return UTF_8_String
is
Result : UTF_8_String (1 .. 3 * Item'Length + 3);
-- Worst case is 3 output codes for each input code + BOM space
Len : Natural;
-- Number of result codes stored
Iptr : Natural;
-- Pointer to next input character
C1, C2 : Unsigned_16;
zzzzz : Unsigned_16;
yyyyyyyy : Unsigned_16;
xxxxxxxx : Unsigned_16;
-- Components of double length case
begin
Iptr := Item'First;
-- Skip BOM at start of input
if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then
Iptr := Iptr + 1;
end if;
-- Generate output BOM if required
if Output_BOM then
Result (1 .. 3) := BOM_8;
Len := 3;
else
Len := 0;
end if;
-- Loop through input
while Iptr <= Item'Last loop
C1 := To_Unsigned_16 (Item (Iptr));
Iptr := Iptr + 1;
-- Codes in the range 16#0000# - 16#007F#
-- UTF-16: 000000000xxxxxxx
-- UTF-8: 0xxxxxxx
if C1 <= 16#007F# then
Result (Len + 1) := Character'Val (C1);
Len := Len + 1;
-- Codes in the range 16#80# - 16#7FF#
-- UTF-16: 00000yyyxxxxxxxx
-- UTF-8: 110yyyxx 10xxxxxx
elsif C1 <= 16#07FF# then
Result (Len + 1) :=
Character'Val
(2#110_00000# or Shift_Right (C1, 6));
Result (Len + 2) :=
Character'Val
(2#10_000000# or (C1 and 2#00_111111#));
Len := Len + 2;
-- Codes in the range 16#800# - 16#D7FF# or 16#E000# - 16#FFFF#
-- UTF-16: yyyyyyyyxxxxxxxx
-- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
elsif C1 <= 16#D7FF# or else C1 >= 16#E000# then
Result (Len + 1) :=
Character'Val
(2#1110_0000# or Shift_Right (C1, 12));
Result (Len + 2) :=
Character'Val
(2#10_000000# or (Shift_Right (C1, 6) and 2#00_111111#));
Result (Len + 3) :=
Character'Val
(2#10_000000# or (C1 and 2#00_111111#));
Len := Len + 3;
-- Codes in the range 16#10000# - 16#10FFFF#
-- UTF-16: 110110zzzzyyyyyy 110111yyxxxxxxxx
-- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
-- Note: zzzzz in the output is input zzzz + 1
elsif C1 <= 2#110110_11_11111111# then
if Iptr > Item'Last then
Raise_Encoding_Error (Iptr - 1);
else
C2 := To_Unsigned_16 (Item (Iptr));
Iptr := Iptr + 1;
end if;
if (C2 and 2#111111_00_00000000#) /= 2#110111_00_00000000# then
Raise_Encoding_Error (Iptr - 1);
end if;
zzzzz := (Shift_Right (C1, 6) and 2#1111#) + 1;
yyyyyyyy := ((Shift_Left (C1, 2) and 2#111111_00#)
or
(Shift_Right (C2, 8) and 2#000000_11#));
xxxxxxxx := C2 and 2#11111111#;
Result (Len + 1) :=
Character'Val
(2#11110_000# or (Shift_Right (zzzzz, 2)));
Result (Len + 2) :=
Character'Val
(2#10_000000# or Shift_Left (zzzzz and 2#11#, 4)
or Shift_Right (yyyyyyyy, 4));
Result (Len + 3) :=
Character'Val
(2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 2)
or Shift_Right (xxxxxxxx, 6));
Result (Len + 4) :=
Character'Val
(2#10_000000# or (xxxxxxxx and 2#00_111111#));
Len := Len + 4;
-- Error if input in 16#DC00# - 16#DFFF# (2nd surrogate with no 1st)
else
Raise_Encoding_Error (Iptr - 2);
end if;
end loop;
return Result (1 .. Len);
end Convert;
end Ada.Strings.UTF_Encoding.Conversions;
|
optikos/oasis | Ada | 6,115 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Names;
with Program.Elements.Expressions;
with Program.Elements.Aspect_Specifications;
with Program.Elements.Package_Renaming_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Package_Renaming_Declarations is
pragma Preelaborate;
type Package_Renaming_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration
and Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Text
with private;
function Create
(Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Package : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Package_Renaming_Declaration;
type Implicit_Package_Renaming_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renamed_Package : not null Program.Elements.Expressions
.Expression_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Package_Renaming_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Package_Renaming_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration
with record
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renamed_Package : not null Program.Elements.Expressions
.Expression_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Package_Renaming_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Package_Renaming_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Package_Renaming_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Renamed_Package
(Self : Base_Package_Renaming_Declaration)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Aspects
(Self : Base_Package_Renaming_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Is_Package_Renaming_Declaration_Element
(Self : Base_Package_Renaming_Declaration)
return Boolean;
overriding function Is_Declaration_Element
(Self : Base_Package_Renaming_Declaration)
return Boolean;
type Package_Renaming_Declaration is
new Base_Package_Renaming_Declaration
and Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Text
with record
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Package_Renaming_Declaration_Text
(Self : aliased in out Package_Renaming_Declaration)
return Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Text_Access;
overriding function Package_Token
(Self : Package_Renaming_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Renames_Token
(Self : Package_Renaming_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Package_Renaming_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Package_Renaming_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Package_Renaming_Declaration is
new Base_Package_Renaming_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Package_Renaming_Declaration_Text
(Self : aliased in out Implicit_Package_Renaming_Declaration)
return Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Package_Renaming_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Package_Renaming_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Package_Renaming_Declaration)
return Boolean;
end Program.Nodes.Package_Renaming_Declarations;
|
reznikmm/matreshka | Ada | 3,633 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Interaction_Operands.Hash is
new AMF.Elements.Generic_Hash (UML_Interaction_Operand, UML_Interaction_Operand_Access);
|
pdaxrom/Kino2 | Ada | 4,152 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.IntField --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
-- Version Control:
-- $Revision: 1.7 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.IntField is
use type Interfaces.C.int;
procedure Set_Field_Type (Fld : in Field;
Typ : in Integer_Field)
is
C_Integer_Field_Type : C_Field_Type;
pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER");
function Set_Fld_Type (F : Field := Fld;
Cft : C_Field_Type := C_Integer_Field_Type;
Arg1 : C_Int;
Arg2 : C_Long_Int;
Arg3 : C_Long_Int) return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type");
Res : Eti_Error;
begin
Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision),
Arg2 => C_Long_Int (Typ.Lower_Limit),
Arg3 => C_Long_Int (Typ.Upper_Limit));
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Wrap_Builtin (Fld, Typ);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.IntField;
|
charlie5/cBound | Ada | 1,625 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_lookup_color_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
cmap : aliased xcb.xcb_colormap_t;
name_len : aliased Interfaces.Unsigned_16;
pad1 : aliased swig.int8_t_Array (0 .. 1);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_lookup_color_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_lookup_color_request_t.Item,
Element_Array => xcb.xcb_lookup_color_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_lookup_color_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_lookup_color_request_t.Pointer,
Element_Array => xcb.xcb_lookup_color_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_lookup_color_request_t;
|
reznikmm/matreshka | Ada | 3,764 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Presentation_Mouse_As_Pen_Attributes is
pragma Preelaborate;
type ODF_Presentation_Mouse_As_Pen_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Presentation_Mouse_As_Pen_Attribute_Access is
access all ODF_Presentation_Mouse_As_Pen_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Presentation_Mouse_As_Pen_Attributes;
|
AdaCore/Ada_Drivers_Library | Ada | 1,938 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Architecture : constant String := "ARM"; -- From board definition
Board : constant String := "STM32F769_Discovery"; -- From command line
CPU_Core : constant String := "ARM Cortex-M7F"; -- From mcu definition
Device_Family : constant String := "STM32F7"; -- From board definition
Device_Name : constant String := "STM32F769NIHx"; -- From board definition
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
Has_ZFP_Runtime : constant String := "False"; -- From board definition
High_Speed_External_Clock : constant := 25000000; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 0; -- From default value
Runtime_Name : constant String := "light-tasking-stm32f769disco"; -- From default value
Runtime_Name_Suffix : constant String := "stm32f769disco"; -- From board definition
Runtime_Profile : constant String := "light-tasking"; -- From command line
Use_Startup_Gen : constant Boolean := False; -- From command line
Vendor : constant String := "STMicro"; -- From board definition
end ADL_Config;
|
ph0sph8/amass | Ada | 2,272 | ads | -- Copyright 2017 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "FacebookCT"
type = "cert"
function start()
setratelimit(20)
end
function vertical(ctx, domain)
if (api == nil or api.key == "" or api.secret == "") then
return
end
local dec
local resp
local cacheurl = queryurl_notoken(domain)
-- Check if the response data is in the graph database
if (api.ttl ~= nil and api.ttl > 0) then
resp = obtain_response(cacheurl, api.ttl)
end
if (resp == nil or resp == "") then
local err
resp, err = request({
url=authurl(api.key, api.secret),
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
dec = json.decode(resp)
if (dec == nil or dec.access_token == nil or dec.access_token == "") then
return
end
resp, err = request({
url=queryurl(domain, dec.access_token),
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
if (api.ttl ~= nil and api.ttl > 0) then
cache_response(cacheurl, resp)
end
end
dec = json.decode(resp)
if (dec == nil or #(dec.data) == 0) then
return
end
for i, r in pairs(dec.data) do
for j, name in pairs(r.domains) do
sendnames(ctx, name)
end
end
end
function authurl(id, secret)
return "https://graph.facebook.com/oauth/access_token?client_id=" .. id .. "&client_secret=" .. secret .. "&grant_type=client_credentials"
end
function queryurl(domain, token)
return "https://graph.facebook.com/certificates?fields=domains&access_token=" .. token .. "&query=*." .. domain
end
function queryurl_notoken(domain)
return "https://graph.facebook.com/certificates?fields=domains&query=*." .. domain
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
for i, v in pairs(names) do
newname(ctx, v)
end
end
|
zrmyers/VulkanAda | Ada | 10,234 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenUType;
with Vulkan.Math.Uvec3;
with Vulkan.Math.Uvec2;
use Vulkan.Math.GenUType;
use Vulkan.Math.Uvec3;
use Vulkan.Math.Uvec2;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides a 32-bit unsigned integer vector type with 4 components.
--------------------------------------------------------------------------------
package Vulkan.Math.Uvec4 is
pragma Preelaborate;
pragma Pure;
--< A 4-component unsigned integer vector.
subtype Vkm_Uvec4 is Vkm_GenUType(Last_Index => 3);
----------------------------------------------------------------------------
-- Ada does not have the concept of constructors in the sense that they exist
-- in C++. For this reason, we will instead define multiple methods for
-- instantiating a Uvec4 here.
----------------------------------------------------------------------------
-- The following are explicit constructors for Uvec4:
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a default vector with all components set to 0.0.
--
--< @return a Uvec4 with all components set to 0.0.
----------------------------------------------------------------------------
function Make_Uvec4 return Vkm_Uvec4 is
(GUT.Make_GenType(Last_Index => 3, value => 0)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector with all components set to the same value.
--
--< @param scalar_value The value to set all components to.
--
--< @return A Uvec4 with all components set to scalar_value.
----------------------------------------------------------------------------
function Make_Uvec4 (scalar_value : in Vkm_Uint) return Vkm_Uvec4 is
(GUT.Make_GenType(Last_Index => 3, value => scalar_value)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by copying components from an existing vector.
--
--< @param vec4_value The Uvec4 to copy components from.
--
--< @return A Uvec4 with all of its components set equal to the corresponding
--< components of vec4_value.
----------------------------------------------------------------------------
function Make_Uvec4 (vec4_value : in Vkm_Uvec4) return Vkm_Uvec4 is
(GUT.Make_GenType(vec4_value.data(0),vec4_value.data(1),
vec4_value.data(2),vec4_value.data(3))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by specifying the values for each of its components.
--
--< @param value1 Value for component 1.
--< @param value2 Value for component 2.
--< @param value3 Value for componetn 3.
--< @param value4 value for component 4.
--
--< @return A Uvec4 with all components set as specified.
----------------------------------------------------------------------------
function Make_Uvec4 (value1, value2, value3, value4 : in Vkm_Uint) return Vkm_Uvec4
renames GUT.Make_GenType;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating a scalar value with a Uvec3.
--
--< Uvec4 = [scalar_value, vec3_value ]
--
--< @param scalar_value The scalar value to concatenate with the Uvec3.
--< @param vec3_value The Uvec3 to concatenate to the scalar value.
--
--< @return The instance of Uvec4.
----------------------------------------------------------------------------
function Make_Uvec4 (scalar_value : in Vkm_Uint;
vec3_value : in Vkm_Uvec3) return Vkm_Uvec3 is
(Make_Uvec4(scalar_value,
vec3_value.data(0),
vec3_value.data(1),
vec3_value.data(2))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating a Uvec3 with a scalar value.
--
--< Uvec4 = [vec3_value, scalar_value]
--
--< @param vec3_value The Uvec3 to concatenate to the scalar value.
--< @param scalar_value The scalar value to concatenate to the Uvec3.
--
--< @return The instance of Uvec4.
----------------------------------------------------------------------------
function Make_Uvec4 (vec3_value : in Vkm_Uvec3;
scalar_value : in Vkm_Uint) return Vkm_Uvec4 is
(Make_Uvec4(vec3_value.data(0),
vec3_value.data(1),
vec3_value.data(2),
scalar_value )) with Inline;
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating a Uvec2 with a Uvec2.
--
--< Uvec4 = [vec2_value1, vec2_value2]
--
--< @param vec2_value1 The first Uvec2.
--< @param vec2_value2 The second Uvec2.
--
--< @return The instance of Uvec4.
---------------------------------------------------------------------------
function Make_Uvec4 (vec2_value1, vec2_value2 : in Vkm_Uvec2) return Vkm_Uvec4 is
(Make_Uvec4(vec2_value1.data(0),vec2_value1.data(1),
vec2_value2.data(0),vec2_value2.data(1)));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Uvec2.
--
--< Uvec4 = [scalar1, scalar2, vec2_value]
--
--< @param scalar1 First scalar value.
--< @param scalar2 Second scalar value.
--< @param vec2_value The Uvec2 value.
--
--< @return The instance of Uvec4.
---------------------------------------------------------------------------
function Make_Uvec4 (scalar1, scalar2 : in Vkm_Uint;
vec2_value : in Vkm_Uvec2) return Vkm_Uvec4 is
(Make_Uvec4(scalar1, scalar2, vec2_value.data(0),vec2_value.data(1)));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Uvec2.
--
--< Uvec4 = [scalar1, vec2_value, scalar2]
--
--< @param scalar1 First scalar value.
--< @param vec2_value The Uvec2 value.
--< @param scalar2 Second scalar value.
--
--< @return The instance of Uvec4.
---------------------------------------------------------------------------
function Make_Uvec4 (scalar1 : in Vkm_Uint;
vec2_value : in Vkm_Uvec2 ;
scalar2 : in Vkm_Uint) return Vkm_Uvec4 is
(Make_Uvec4(scalar1, vec2_value.data(0),vec2_value.data(1), scalar2));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Uvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Uvec2.
--
--< Uvec4 = [vec2_value, scalar1, scalar2]
--
--< @param vec2_value The Uvec2 value.
--< @param scalar1 First scalar value.
--< @param scalar2 Second scalar value.
--
--< @return The instance of Uvec4.
---------------------------------------------------------------------------
function Make_Uvec4 (vec2_value : in Vkm_Uvec2 ;
scalar1 : in Vkm_Uint;
scalar2 : in Vkm_Uint) return Vkm_Uvec4 is
(Make_Uvec4(vec2_value.data(0),vec2_value.data(1), scalar1, scalar2));
end Vulkan.Math.Uvec4;
|
Rodeo-McCabe/orka | Ada | 5,414 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.SIMD.SSE.Singles;
package Orka.SIMD.AVX.Singles.Swizzle is
pragma Pure;
use SIMD.SSE.Singles;
function Shuffle (Left, Right : m256; Mask : Unsigned_32) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_shufps256";
-- Shuffle the 32-bit floats in Left and Right using the given Mask.
-- The first, second, fifth, and sixth float are retrieved from Left.
-- The third, fourth, seventh, and eight float are retrieved from Right.
--
-- The compiler needs access to the Mask at compile-time, thus construct it
-- as follows:
--
-- Mask_a_b_c_d : constant Unsigned_32 := a or b * 4 or c * 16 or d * 64;
--
-- a and b select the floats to use from Left, c and d from Right.
function Unpack_High (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_unpckhps256";
-- Unpack and interleave the 32-bit floats from the upper halves of
-- the 128-bit lanes of Left and Right as follows:
-- Left (3), Right (3), Left (4), Right (4)
-- Left (7), Right (7), Left (8), Right (8)
function Unpack_Low (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_unpcklps256";
-- Unpack and interleave the 32-bit floats from the lower halves of
-- the 128-bit lanes of Left and Right as follows:
-- Left (1), Right (1), Left (2), Right (2)
-- Left (5), Right (5), Left (6), Right (6)
function Duplicate_H (Elements : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_movshdup256";
-- Duplicate second, fourth, sixth and eight element as follows:
-- Elements (2), Elements (2), Elements (4), Elements (4)
-- Elements (6), Elements (6), Elements (8), Elements (8)
function Duplicate_L (Elements : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_movsldup256";
-- Duplicate first, third, fifth and seventh element as follows:
-- Elements (1), Elements (1), Elements (3), Elements (3)
-- Elements (5), Elements (5), Elements (7), Elements (7)
function Blend (Left, Right : m256; Mask : Unsigned_32) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_blendps256";
-- Select elements from two sources (Left and Right) using a constant mask
function Blend (Left, Right, Mask : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_blendvps256";
-- Select elements from two sources (Left and Right) using a variable mask
function Cast (Elements : m256) return m128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_ps_ps256";
function Extract (Elements : m256; Mask : Unsigned_32) return m128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vextractf128_ps256";
-- Extract 128-bit from either the lower half (Mask = 0) or upper
-- half (Mask = 1)
function Insert (Left : m256; Right : m128; Mask : Unsigned_32) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vinsertf128_ps256";
-- Insert Right into the lower half (Mask = 0) or upper half (Mask = 1)
function Permute (Elements : m128; Mask : Unsigned_32) return m128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vpermilps";
-- Shuffle elements using just Elements. Similar to Shuffle (Elements, Elements, Mask)
function Permute (Elements : m256; Mask : Unsigned_32) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vpermilps256";
-- Shuffle elements using just Elements. Similar to Shuffle (Elements, Elements, Mask)
function Permute_Lanes (Left, Right : m256; Mask : Unsigned_32) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vperm2f128_ps256";
-- Shuffle 128-bit lanes.
--
-- Bits 1-2 of Mask are used to control which of the four 128-bit lanes
-- to use for the lower half (128-bit) of the result. Bits 5-6 to select
-- a lane for the upper half of the result:
--
-- 0 => Left (1 .. 4)
-- 1 => Left (5 .. 8)
-- 2 => Right (1 .. 4)
-- 3 => Right (5 .. 8)
--
-- Bits 4 and 8 are used to zero the corresponding half (lower or upper).
--
-- The compiler needs access to the Mask at compile-time, thus construct it
-- as follows:
--
-- Mask_zu_zl_u_l : constant Unsigned_32 := zu * 128 or zl * 8 or u * 16 or l;
--
-- u and l are numbers between 0 and 3 (see above). zu and zl are either 0 or 1
-- to zero a lane.
end Orka.SIMD.AVX.Singles.Swizzle;
|
pdaxrom/Kino2 | Ada | 3,609 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Explanation --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
-- Version Control
-- $Revision: 1.9 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-- Poor mans help system. This scans a sequential file for key lines and
-- then reads the lines up to the next key. Those lines are presented in
-- a window as help or explanation.
--
package Sample.Explanation is
procedure Explain (Key : in String);
-- Retrieve the text associated with this key and display it.
procedure Explain_Context;
-- Explain the current context.
procedure Notepad (Key : in String);
-- Put a note on the screen and maintain it with the context
Explanation_Not_Found : exception;
Explanation_Error : exception;
end Sample.Explanation;
|
stcarrez/ada-ado | Ada | 15,146 | adb | -----------------------------------------------------------------------
-- ado-drivers-tests -- Unit tests for database drivers
-- Copyright (C) 2014, 2015, 2016, 2018, 2019, 2021, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Exceptions;
with Util.Test_Caller;
with Regtests;
with ADO.Configs;
with ADO.Statements;
with ADO.Sessions.Factory;
with ADO.Connections;
package body ADO.Drivers.Tests is
use ADO.Configs;
use ADO.Connections;
package Caller is new Util.Test_Caller (Test, "ADO.Drivers");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test ADO.Drivers.Initialize",
Test_Initialize'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Get_Config",
Test_Get_Config'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Get_Driver",
Test_Get_Driver'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Get_Driver_Index",
Test_Get_Driver_Index'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Get_Driver",
Test_Load_Invalid_Driver'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections.Set_Connection",
Test_Set_Connection'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections.Set_Connection (Errors)",
Test_Set_Connection_Error'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections.Set_Server",
Test_Set_Connection_Server'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections.Set_Port",
Test_Set_Connection_Port'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections.Set_Database",
Test_Set_Connection_Database'Access);
Caller.Add_Test (Suite, "Test ADO.Databases (Errors)",
Test_Empty_Connection'Access);
Caller.Add_Test (Suite, "Test ADO.Databases (DB Closed errors)",
Test_Closed_Connection'Access);
Caller.Add_Test (Suite, "Test ADO.Drivers.Connections (Invalid)",
Test_Invalid_Connection'Access);
end Add_Tests;
-- ------------------------------
-- Test the Initialize operation.
-- ------------------------------
procedure Test_Initialize (T : in out Test) is
pragma Unreferenced (T);
begin
ADO.Drivers.Initialize ("test-missing-config.properties");
end Test_Initialize;
-- ------------------------------
-- Test the Get_Config operation.
-- ------------------------------
procedure Test_Get_Config (T : in out Test) is
begin
T.Assert (ADO.Configs.Get_Config ("test.database")'Length > 0,
"The Get_Config operation returned no value for the test database");
end Test_Get_Config;
-- ------------------------------
-- Test the Get_Driver operation.
-- ------------------------------
procedure Test_Get_Driver (T : in out Test) is
Mysql_Driver : constant Driver_Access := Connections.Get_Driver ("mysql");
Sqlite_Driver : constant Driver_Access := Connections.Get_Driver ("sqlite");
Postgres_Driver : constant Driver_Access := Connections.Get_Driver ("postgresql");
begin
T.Assert (Mysql_Driver /= null or else Sqlite_Driver /= null or else Postgres_Driver /= null,
"No database driver was found!");
end Test_Get_Driver;
-- ------------------------------
-- Test loading some invalid database driver.
-- ------------------------------
procedure Test_Load_Invalid_Driver (T : in out Test) is
Invalid_Driver : constant Driver_Access := ADO.Connections.Get_Driver ("invalid");
begin
T.Assert (Invalid_Driver = null,
"The Get_Driver operation must return null for invalid drivers");
end Test_Load_Invalid_Driver;
-- ------------------------------
-- Test the Get_Driver_Index operation.
-- ------------------------------
procedure Test_Get_Driver_Index (T : in out Test) is
Mysql_Driver : constant Driver_Access := Connections.Get_Driver ("mysql");
Sqlite_Driver : constant Driver_Access := Connections.Get_Driver ("sqlite");
Postgres_Driver : constant Driver_Access := Connections.Get_Driver ("postgresql");
begin
if Mysql_Driver /= null then
T.Assert (Mysql_Driver.Get_Driver_Index > 0, "The driver index must be positive");
end if;
if Sqlite_Driver /= null then
T.Assert (Sqlite_Driver.Get_Driver_Index > 0, "The driver index must be positive");
end if;
if Postgres_Driver /= null then
T.Assert (Postgres_Driver.Get_Driver_Index > 0, "The driver index must be positive");
end if;
if Mysql_Driver /= null and then Sqlite_Driver /= null then
T.Assert (Mysql_Driver.Get_Driver_Index /= Sqlite_Driver.Get_Driver_Index,
"Two drivers must have different driver indexes");
end if;
if Mysql_Driver /= null and then Postgres_Driver /= null then
T.Assert (Mysql_Driver.Get_Driver_Index /= Postgres_Driver.Get_Driver_Index,
"Two drivers must have different driver indexes");
end if;
if Sqlite_Driver /= null and then Postgres_Driver /= null then
T.Assert (Sqlite_Driver.Get_Driver_Index /= Postgres_Driver.Get_Driver_Index,
"Two drivers must have different driver indexes");
end if;
end Test_Get_Driver_Index;
-- ------------------------------
-- Test the Set_Connection procedure.
-- ------------------------------
procedure Test_Set_Connection (T : in out Test) is
procedure Check (URI : in String;
Server : in String;
Port : in Integer;
Database : in String);
procedure Check (URI : in String;
Server : in String;
Port : in Integer;
Database : in String) is
Controller : ADO.Connections.Configuration;
begin
Controller.Set_Connection (URI);
Util.Tests.Assert_Equals (T, Server, Controller.Get_Server, "Invalid server for " & URI);
Util.Tests.Assert_Equals (T, Port, Controller.Get_Port, "Invalid port for " & URI);
Util.Tests.Assert_Equals (T, Database, Controller.Get_Database, "Invalid db for " & URI);
Controller.Set_Property ("password", "test");
Util.Tests.Assert_Equals (T, "test", Controller.Get_Property ("password"),
"Invalid 'password' property for " & URI);
exception
when E : Connection_Error =>
Util.Tests.Assert_Matches (T, "Driver.*not found.*",
Ada.Exceptions.Exception_Message (E),
"Invalid exception raised for " & URI);
end Check;
begin
Check ("mysql://test:3306/db", "test", 3306, "db");
Check ("mysql://test2:3307/db2?user=admin&password=admin", "test2", 3307, "db2");
Check ("sqlite:///test.db", "", 0, "test.db");
Check ("sqlite:///test2.db?user=root&encoding=UTF-8", "", 0, "test2.db");
end Test_Set_Connection;
-- ------------------------------
-- Test the Set_Connection procedure with several error cases.
-- ------------------------------
procedure Test_Set_Connection_Error (T : in out Test) is
procedure Check_Invalid_Connection (URI : in String);
Controller : ADO.Connections.Configuration;
procedure Check_Invalid_Connection (URI : in String) is
begin
Controller.Set_Connection (URI);
T.Fail ("No Connection_Error exception raised for " & URI);
exception
when Connection_Error =>
null;
end Check_Invalid_Connection;
begin
Check_Invalid_Connection ("");
Check_Invalid_Connection ("http://");
Check_Invalid_Connection ("mysql://");
Check_Invalid_Connection ("sqlite://");
Check_Invalid_Connection ("mysql://:toto/");
Check_Invalid_Connection ("sqlite://:toto/");
end Test_Set_Connection_Error;
-- ------------------------------
-- Test the Set_Server operation.
-- ------------------------------
procedure Test_Set_Connection_Server (T : in out Test) is
Controller : ADO.Connections.Configuration;
begin
Controller.Set_Connection ("mysql://localhost:3306/db");
Controller.Set_Server ("server-name");
Util.Tests.Assert_Equals (T, "server-name", Controller.Get_Server,
"Configuration Set_Server returned invalid value");
exception
when E : ADO.Configs.Connection_Error =>
Util.Tests.Assert_Equals (T, "Driver 'mysql' not found",
Ada.Exceptions.Exception_Message (E),
"Invalid exception message");
end Test_Set_Connection_Server;
-- ------------------------------
-- Test the Set_Port operation.
-- ------------------------------
procedure Test_Set_Connection_Port (T : in out Test) is
Controller : ADO.Connections.Configuration;
begin
Controller.Set_Connection ("mysql://localhost:3306/db");
Controller.Set_Port (1234);
Util.Tests.Assert_Equals (T, 1234, Controller.Get_Port,
"Configuration Set_Port returned invalid value");
exception
when E : ADO.Configs.Connection_Error =>
Util.Tests.Assert_Equals (T, "Driver 'mysql' not found",
Ada.Exceptions.Exception_Message (E),
"Invalid exception message");
end Test_Set_Connection_Port;
-- ------------------------------
-- Test the Set_Database operation.
-- ------------------------------
procedure Test_Set_Connection_Database (T : in out Test) is
Controller : ADO.Connections.Configuration;
begin
Controller.Set_Connection ("mysql://localhost:3306/db");
Controller.Set_Database ("test-database");
Util.Tests.Assert_Equals (T, "test-database", Controller.Get_Database,
"Configuration Set_Database returned invalid value");
exception
when E : ADO.Configs.Connection_Error =>
Util.Tests.Assert_Equals (T, "Driver 'mysql' not found",
Ada.Exceptions.Exception_Message (E),
"Invalid exception message");
end Test_Set_Connection_Database;
-- ------------------------------
-- Test the connection operations on an empty connection.
-- ------------------------------
procedure Test_Empty_Connection (T : in out Test) is
use type ADO.Sessions.Connection_Status;
C : ADO.Sessions.Session;
Stmt : ADO.Statements.Query_Statement;
pragma Unreferenced (Stmt);
begin
T.Assert (C.Get_Status = ADO.Sessions.CLOSED,
"The database connection must be closed for an empty connection");
-- Create_Statement must raise Session_Error.
begin
Stmt := C.Create_Statement ("");
T.Fail ("No exception raised for Create_Statement");
exception
when ADO.Sessions.Session_Error =>
null;
end;
-- Create_Statement must raise Session_Error.
begin
Stmt := C.Create_Statement ("select");
T.Fail ("No exception raised for Create_Statement");
exception
when ADO.Sessions.Session_Error =>
null;
end;
end Test_Empty_Connection;
-- ------------------------------
-- Test the connection operations on a closed connection.
-- ------------------------------
procedure Test_Closed_Connection (T : in out Test) is
begin
declare
DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database;
DB2 : constant ADO.Sessions.Master_Session := DB;
Stmt : ADO.Statements.Query_Statement;
begin
DB.Close;
Stmt := DB2.Create_Statement ("SELECT name FROM test_table");
Stmt.Execute;
Util.Tests.Fail (T, "No Session_Error exception was raised");
exception
when ADO.Sessions.Session_Error =>
null;
end;
declare
DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database;
DB2 : ADO.Sessions.Master_Session := DB;
begin
DB.Close;
DB2.Begin_Transaction;
Util.Tests.Fail (T, "No Session_Error exception was raised");
exception
when ADO.Sessions.Session_Error =>
null;
end;
declare
DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database;
DB2 : ADO.Sessions.Master_Session := DB;
begin
DB.Close;
DB2.Commit;
Util.Tests.Fail (T, "No Session_Error exception was raised");
exception
when ADO.Sessions.Session_Error =>
null;
end;
declare
DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database;
DB2 : ADO.Sessions.Master_Session := DB;
begin
DB.Close;
DB2.Rollback;
Util.Tests.Fail (T, "No Session_Error exception was raised");
exception
when ADO.Sessions.Session_Error =>
null;
end;
end Test_Closed_Connection;
-- ------------------------------
-- Test opening an invalid connection and make sure we get some error.
-- ------------------------------
procedure Test_Invalid_Connection (T : in out Test) is
use ADO.Sessions;
procedure Check (Connection : in String);
procedure Check (Connection : in String) is
Factory : ADO.Sessions.Factory.Session_Factory;
DB : ADO.Sessions.Master_Session;
begin
Factory.Create (Connection);
DB := Factory.Get_Master_Session;
T.Assert (DB.Get_Status = ADO.Sessions.CLOSED, "No exception raised");
T.Fail ("No exception raised for " & Connection);
exception
when ADO.Configs.Connection_Error =>
null;
end Check;
begin
Check ("mysql://localhost:13456/ado?user=plop&socket=/dev/null");
Check ("postgresql://localhost:13456/ado?user=plop&socket=/dev/null");
Check ("");
end Test_Invalid_Connection;
end ADO.Drivers.Tests;
|
yannickmoy/SPARKNaCl | Ada | 10,866 | adb | with SPARKNaCl.Car;
package body SPARKNaCl
with SPARK_Mode => On
is
pragma Warnings (GNATProve, Off, "pragma * ignored (not yet supported)");
--===============================
-- Exported subprogram bodies
--===============================
function "+" (Left, Right : in Normal_GF) return Normal_GF
is
subtype ILT is I32 range 0 .. (LMM1 * 2) + 1;
T : ILT;
Carry : I32_Bit;
R : GF32 with Relaxed_Initialization;
begin
Carry := 0;
-- In this implementation, we compute and add Carry
-- as we go along
for I in Index_16 loop
pragma Loop_Optimize (No_Unroll);
T := I32 (Left (I)) + I32 (Right (I)) + Carry;
R (I) := T mod LM;
Carry := T / LM;
pragma Loop_Invariant
(for all J in Index_16 range 0 .. I => R (J)'Initialized);
pragma Loop_Invariant
(for all J in Index_16 range 0 .. I => R (J) in GF32_Normal_Limb);
end loop;
pragma Assert (R'Initialized and then R in Normal_GF32);
-- The "Carry" from limb 15 can only be 0 or 1, so we
-- multiply that by R2256 and add to limb 0. R is then a
-- "Nearlynormal_GF", so only a _single_ call to
-- Car.Nearlynormal_To_Normal is required
R (0) := R (0) + (R2256 * Carry);
pragma Assert (R'Initialized and then R in Nearlynormal_GF);
return Car.Nearlynormal_To_Normal (R);
end "+";
function "-" (Left, Right : in Normal_GF) return Normal_GF
is
subtype ILT is I32 range -LM .. LMM1;
T : ILT;
Carry : I32 range -1 .. 0;
R : GF32 with Relaxed_Initialization;
begin
Carry := 0;
-- In this implementation, we compute and add Carry
-- as we go along
for I in Index_16 loop
pragma Loop_Optimize (No_Unroll);
T := I32 (Left (I)) - I32 (Right (I)) + Carry;
R (I) := T mod LM;
Carry := ASR32_16 (T);
pragma Loop_Invariant
(for all J in Index_16 range 0 .. I => R (J)'Initialized);
pragma Loop_Invariant
(for all J in Index_16 range 0 .. I => R (J) in GF32_Normal_Limb);
end loop;
pragma Assert (R'Initialized and then R in Normal_GF32);
-- The "Carry" from limb 15 can only be 0 or -1, so we
-- multiply that by R2256 and add to limb 0. R is then a
-- "Nearlynormal_GF", so only a _single_ call to
-- Car.Nearlynormal_To_Normal is required
R (0) := R (0) + (R2256 * Carry);
pragma Assert (R'Initialized and then R in Nearlynormal_GF);
return Car.Nearlynormal_To_Normal (R);
end "-";
function "*" (Left, Right : in Normal_GF) return Normal_GF
is
subtype U32_Normal_Limb is U32 range 0 .. LMM1;
T : GF64_PA;
TF : GF64 with Relaxed_Initialization;
LT : U32_Normal_Limb;
begin
LT := U32_Normal_Limb (Left (0));
-- Initialization of T and unrolling of the first loop
-- iteration can both be done in a single assignment here.
T := GF64_PA'(0 => I64 (LT * U32_Normal_Limb (Right (0))),
1 => I64 (LT * U32_Normal_Limb (Right (1))),
2 => I64 (LT * U32_Normal_Limb (Right (2))),
3 => I64 (LT * U32_Normal_Limb (Right (3))),
4 => I64 (LT * U32_Normal_Limb (Right (4))),
5 => I64 (LT * U32_Normal_Limb (Right (5))),
6 => I64 (LT * U32_Normal_Limb (Right (6))),
7 => I64 (LT * U32_Normal_Limb (Right (7))),
8 => I64 (LT * U32_Normal_Limb (Right (8))),
9 => I64 (LT * U32_Normal_Limb (Right (9))),
10 => I64 (LT * U32_Normal_Limb (Right (10))),
11 => I64 (LT * U32_Normal_Limb (Right (11))),
12 => I64 (LT * U32_Normal_Limb (Right (12))),
13 => I64 (LT * U32_Normal_Limb (Right (13))),
14 => I64 (LT * U32_Normal_Limb (Right (14))),
15 => I64 (LT * U32_Normal_Limb (Right (15))),
others => 0);
-- Based on the loop invariant below, but substituting I for 0,
-- we can assert...
pragma Assert
((for all K in Index_31 range 0 .. 15 =>
T (K) >= 0 and T (K) <= MGFLP) and
(for all K in Index_31 range 16 .. 30 =>
T (K) = 0));
-- "Textbook" ladder multiplication
for I in Index_16 range 1 .. 15 loop
pragma Loop_Optimize (No_Unroll);
-- Manual unroll and PRE of the inner loop here gives a significant
-- performance gain at all optimization levels, preserves proof,
-- and avoids the need for a complex inner loop invariant.
--
-- for J in Index_16 loop
-- T (I + J) := T (I + J) + (Left (I) * Right (J));
-- end loop;
LT := U32_Normal_Limb (Left (I));
-- Note that the "*" here is done in 32-bit Unsigned arithmetic
-- before the result is converted to 64-bit and accumulated into T.
-- This is much faster on 32-bit platforms that don't do 64-bit
-- multiplication in a single instruction.
T (I) := T (I) + I64 (LT * U32_Normal_Limb (Right (0)));
T (I + 1) := T (I + 1) + I64 (LT * U32_Normal_Limb (Right (1)));
T (I + 2) := T (I + 2) + I64 (LT * U32_Normal_Limb (Right (2)));
T (I + 3) := T (I + 3) + I64 (LT * U32_Normal_Limb (Right (3)));
T (I + 4) := T (I + 4) + I64 (LT * U32_Normal_Limb (Right (4)));
T (I + 5) := T (I + 5) + I64 (LT * U32_Normal_Limb (Right (5)));
T (I + 6) := T (I + 6) + I64 (LT * U32_Normal_Limb (Right (6)));
T (I + 7) := T (I + 7) + I64 (LT * U32_Normal_Limb (Right (7)));
T (I + 8) := T (I + 8) + I64 (LT * U32_Normal_Limb (Right (8)));
T (I + 9) := T (I + 9) + I64 (LT * U32_Normal_Limb (Right (9)));
T (I + 10) := T (I + 10) + I64 (LT * U32_Normal_Limb (Right (10)));
T (I + 11) := T (I + 11) + I64 (LT * U32_Normal_Limb (Right (11)));
T (I + 12) := T (I + 12) + I64 (LT * U32_Normal_Limb (Right (12)));
T (I + 13) := T (I + 13) + I64 (LT * U32_Normal_Limb (Right (13)));
T (I + 14) := T (I + 14) + I64 (LT * U32_Normal_Limb (Right (14)));
T (I + 15) := T (I + 15) + I64 (LT * U32_Normal_Limb (Right (15)));
pragma Loop_Invariant
(
-- Lower bound
(for all K in Index_31 => T (K) >= 0) and
-- Upper bounds
(for all K in Index_31 range 0 .. (I - 1) =>
T (K) <= (I64 (K + 1) * MGFLP)) and
(for all K in Index_31 range I .. 15 =>
T (K) <= (I64 (I + 1) * MGFLP)) and
(for all K in Index_31 range 16 .. (I + 15) =>
T (K) <= (I64 (16 + I) - I64 (K)) * MGFLP) and
(for all K in Index_31 range I + 16 .. 30 =>
T (K) = 0)
);
end loop;
-- Substituting I = 15 into the outer loop invariant above,
-- and eliminating quantifiers with null ranges yields
-- the following assertion.
--
-- The coefficients of MGFLP in the upper bound for limbs 0 .. 30
-- form a "pyramid" which peaks at 16 for T (15), like this:
--
--- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 14 13 12 11 10 ... 1
pragma Assert
(
-- Lower bound
(for all K in Index_31 => T (K) >= 0) and
-- Upper bounds
(for all K in Index_31 range 0 .. 14 =>
T (K) <= (I64 (K) + 1) * MGFLP) and
T (15) <= 16 * MGFLP and
(for all K in Index_31 range 16 .. 30 =>
T (K) <= (31 - I64 (K)) * MGFLP)
);
-- To "carry" the value in limbs 16 .. 30 and above down into
-- limbs 0 .. 14, we need to multiply each upper limb by 2**256.
--
-- Unfortutely, our limbs don't have enough bits for that to work,
-- but we're working in mod (2**255 - 19) arithmetic, and we know that
-- 2**256 mod (2**255 - 19) = R2256, so we can multiply by that instead.
--
-- Given the upper bounds established above, we _can_ prove that
-- T (I) + R2256 * T (I + 16) WILL fit in 64 bits.
for I in Index_15 loop
pragma Loop_Optimize (No_Unroll);
TF (I) := T (I) + R2256 * T (I + 16);
pragma Loop_Invariant
(for all J in Index_15 range 0 .. I => TF (J)'Initialized);
pragma Loop_Invariant
(
(for all J in Index_15 range 0 .. I =>
TF (J) = T (J) + R2256 * T (J + 16))
);
end loop;
pragma Assert
(for all J in Index_15 => TF (J)'Initialized);
TF (15) := T (15);
pragma Assert (TF'Initialized);
pragma Assert (TF in Product_GF);
-- Sanitize T, as per WireGuard sources
pragma Warnings (GNATProve, Off, "statement has no effect");
Sanitize_GF64_PA (T);
pragma Unreferenced (T);
-- In SPARKNaCl, we normalize after "*".
--
-- Interestingly, in the TweetNaCl sources, only TWO
-- applications of the "car_25519" function are used here.
--
-- In SPARKNaCl we have proved that THREE
-- applications of car_25519 are required to definitely
-- return any possible Product_GF to a fully normalized
-- Normal_GF.
return Car.Nearlynormal_To_Normal
(Car.Seminormal_To_Nearlynormal
(Car.Product_To_Seminormal (TF)));
end "*";
--------------------------------------------------------
-- Constant time equality test
--------------------------------------------------------
function Equal (X, Y : in Byte_Seq) return Boolean
is
D : Boolean := True;
begin
for I in N32 range X'Range loop
pragma Loop_Optimize (No_Unroll);
D := D and (X (I) = Y (I));
pragma Loop_Invariant
(D = (for all J in N32 range X'First .. I => X (J) = Y (J)));
end loop;
return D;
end Equal;
--------------------------------------------------------
-- Data sanitization
--------------------------------------------------------
procedure Sanitize (R : out Byte_Seq) is separate;
procedure Sanitize_U16 (R : out U16) is separate;
procedure Sanitize_U32 (R : out U32) is separate;
procedure Sanitize_U64 (R : out U64) is separate;
procedure Sanitize_GF16 (R : out Normal_GF) is separate;
procedure Sanitize_GF32 (R : out GF32) is separate;
procedure Sanitize_GF64_PA (R : out GF64_PA) is separate;
procedure Sanitize_I64_Seq (R : out I64_Seq) is separate;
procedure Sanitize_Boolean (R : out Boolean) is separate;
end SPARKNaCl;
|
zhmu/ananas | Ada | 4,463 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.UNBOUNDED_PRIORITY_QUEUES --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
package body Ada.Containers.Unbounded_Priority_Queues is
protected body Queue is
-----------------
-- Current_Use --
-----------------
function Current_Use return Count_Type is
begin
return Q_Elems.Length;
end Current_Use;
-------------
-- Dequeue --
-------------
entry Dequeue (Element : out Queue_Interfaces.Element_Type)
when Q_Elems.Length > 0
is
-- Grab the first item of the set, and remove it from the set
C : constant Cursor := First (Q_Elems);
begin
Element := Sets.Element (C).Item;
Delete_First (Q_Elems);
end Dequeue;
--------------------------------
-- Dequeue_Only_High_Priority --
--------------------------------
procedure Dequeue_Only_High_Priority
(At_Least : Queue_Priority;
Element : in out Queue_Interfaces.Element_Type;
Success : out Boolean)
is
-- Grab the first item. If it exists and has appropriate priority,
-- set Success to True, and remove that item. Otherwise, set Success
-- to False.
C : constant Cursor := First (Q_Elems);
begin
Success := Has_Element (C) and then
not Before (At_Least, Get_Priority (Sets.Element (C).Item));
if Success then
Element := Sets.Element (C).Item;
Delete_First (Q_Elems);
end if;
end Dequeue_Only_High_Priority;
-------------
-- Enqueue --
-------------
entry Enqueue (New_Item : Queue_Interfaces.Element_Type) when True is
begin
Insert (Q_Elems, (Next_Sequence_Number, New_Item));
Next_Sequence_Number := Next_Sequence_Number + 1;
-- If we reached a new high-water mark, increase Max_Length
if Q_Elems.Length > Max_Length then
pragma Assert (Max_Length + 1 = Q_Elems.Length);
Max_Length := Q_Elems.Length;
end if;
end Enqueue;
--------------
-- Peak_Use --
--------------
function Peak_Use return Count_Type is
begin
return Max_Length;
end Peak_Use;
end Queue;
end Ada.Containers.Unbounded_Priority_Queues;
|
jrcarter/Ada_GUI | Ada | 14,918 | ads | -- Ada_GUI implementation based on Gnoga. Adapted 2021
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A . G U I . E L E M E N T . C O M M O N --
-- --
-- S p e c --
-- --
-- --
-- Copyright (C) 2014 David Botton --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are --
-- granted additional permissions described in the GCC Runtime Library --
-- Exception, version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada_GUI.Gnoga.Gui.View;
package Ada_GUI.Gnoga.Gui.Element.Common is
-------------------------------------------------------------------------
-- A_Types
-------------------------------------------------------------------------
type A_Type is new Gnoga.Gui.View.View_Base_Type with private;
type A_Access is access all A_Type;
type Pointer_To_A_Class is access all A_Type'Class;
-------------------------------------------------------------------------
-- A_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (A : in out A_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Link : in String := "";
Content : in String := "";
Target : in String := "_self";
ID : in String := "");
-- Create an Anchor link
-------------------------------------------------------------------------
-- A_Type - Properties
-------------------------------------------------------------------------
procedure Link (A : in out A_Type; Value : String);
function Link (A : A_Type) return String;
-- The HREF link of the Anchor
procedure Target (A : in out A_Type; Value : String);
function Target (A : A_Type) return String;
-- Target of link, name of a frame or:
-- _blank = new window
-- _top = top most frame (full browser window)
-- _parent = parent frame or window
-- _self = current frame or window
-------------------------------------------------------------------------
-- Button_Types
-------------------------------------------------------------------------
type Button_Type is new Gnoga.Gui.View.View_Base_Type with private;
type Button_Access is access all Button_Type;
type Pointer_To_Button_Class is access all Button_Type'Class;
-------------------------------------------------------------------------
-- Button_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (Button : in out Button_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Content : in String := "";
ID : in String := "");
-- Create an HTML button. The content will be placed inside the button.
-- For forms use Gnoga.Gui.Element.Form.Button instead.
-- Button_Type's can contain other elements like images.
-------------------------------------------------------------------------
-- Button_Type - Properties
-------------------------------------------------------------------------
procedure Disabled (Button : in out Button_Type;
Value : in Boolean := True);
function Disabled (Button : Button_Type) return Boolean;
-------------------------------------------------------------------------
-- DIV_Types
-------------------------------------------------------------------------
type DIV_Type is new Gnoga.Gui.View.View_Base_Type with private;
type DIV_Access is access all DIV_Type;
type Pointer_To_DIV_Class is access all DIV_Type'Class;
-------------------------------------------------------------------------
-- DIV_Type - Creation Methods
-------------------------------------------------------------------------
-- Also note, that View_Base_Type.Put_Line also creates DIVs internally
procedure Create (DIV : in out DIV_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Content : in String := "";
ID : in String := "");
-- Create a div container with optional HTML content
-------------------------------------------------------------------------
-- P_Types
-------------------------------------------------------------------------
type P_Type is new Gnoga.Gui.View.View_Base_Type with private;
type P_Access is access all P_Type;
type Pointer_To_P_Class is access all P_Type'Class;
-------------------------------------------------------------------------
-- P_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (P : in out P_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Content : in String := "";
ID : in String := "");
-------------------------------------------------------------------------
-- IMG_Types
-------------------------------------------------------------------------
type IMG_Type is new Gnoga.Gui.Element.Element_Type with private;
type IMG_Access is access all IMG_Type;
type Pointer_To_IMG_Class is access all IMG_Type'Class;
-------------------------------------------------------------------------
-- IMG_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (IMG : in out IMG_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
URL_Source : in String := "";
Alternative_Text : in String := "";
ID : in String := "");
-- Create an image element. Use width and height properties before
-- placing image to constrain image size.
procedure URL_Source (IMG : in out IMG_Type; Value : in String);
-- Change URL Source for IMG
-------------------------------------------------------------------------
-- HR_Types
-------------------------------------------------------------------------
type HR_Type is new Gnoga.Gui.Element.Element_Type with private;
type HR_Access is access all HR_Type;
type Pointer_To_HR_Class is access all HR_Type'Class;
-------------------------------------------------------------------------
-- HR_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (HR : in out HR_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
ID : in String := "");
-- Create a horizontal rule
-------------------------------------------------------------------------
-- BR_Types
-------------------------------------------------------------------------
type BR_Type is new Gnoga.Gui.Element.Element_Type with private;
type BR_Access is access all BR_Type;
type Pointer_To_BR_Class is access all BR_Type'Class;
-------------------------------------------------------------------------
-- BR_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (BR : in out BR_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
ID : in String := "");
-------------------------------------------------------------------------
-- Meter_Types
-------------------------------------------------------------------------
type Meter_Type is new Gnoga.Gui.Element.Element_Type with private;
type Meter_Access is access all Meter_Type;
type Pointer_To_Meter_Class is access all Meter_Type'Class;
-------------------------------------------------------------------------
-- Meter_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (Meter : in out Meter_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Value : in Integer := 0;
High : in Integer := 100;
Low : in Integer := 0;
Maximum : in Integer := 100;
Minimum : in Integer := 0;
Optimum : in Integer := 50;
ID : in String := "");
-------------------------------------------------------------------------
-- Meter_Type - Properties
-------------------------------------------------------------------------
procedure Value (Meter : in out Meter_Type; Value : in Integer);
function Value (Meter : Meter_Type) return Integer;
procedure High (Meter : in out Meter_Type; Value : in Integer);
function High (Meter : Meter_Type) return Integer;
procedure Low (Meter : in out Meter_Type; Value : in Integer);
function Low (Meter : Meter_Type) return Integer;
procedure Maximum (Meter : in out Meter_Type; Value : in Integer);
function Maximum (Meter : Meter_Type) return Integer;
procedure Minimum (Meter : in out Meter_Type; Value : in Integer);
function Minimum (Meter : Meter_Type) return Integer;
procedure Optimum (Meter : in out Meter_Type; Value : in Integer);
function Optimum (Meter : Meter_Type) return Integer;
-------------------------------------------------------------------------
-- Progress_Bar_Types
-------------------------------------------------------------------------
type Progress_Bar_Type is new Gnoga.Gui.Element.Element_Type with private;
type Progress_Bar_Access is access all Progress_Bar_Type;
type Pointer_To_Progress_Bar_Class is access all Progress_Bar_Type'Class;
-------------------------------------------------------------------------
-- Progress_Bar_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create (Progress_Bar : in out Progress_Bar_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Value : in Integer := 0;
Maximum : in Integer := 100;
ID : in String := "");
-------------------------------------------------------------------------
-- Progress_Bar_Type - Properties
-------------------------------------------------------------------------
procedure Value (Progress_Bar : in out Progress_Bar_Type;
Value : in Integer);
function Value (Progress_Bar : Progress_Bar_Type) return Integer;
procedure Maximum (Progress_Bar : in out Progress_Bar_Type;
Value : in Integer);
function Maximum (Progress_Bar : Progress_Bar_Type) return Integer;
-------------------------------------------------------------------------
-- Span_Types
-------------------------------------------------------------------------
type Span_Type is new Gnoga.Gui.View.View_Base_Type with private;
type Span_Access is access all Span_Type;
type Pointer_To_Span_Class is access all Span_Type'Class;
-------------------------------------------------------------------------
-- Span_Type - Creation Methods
-------------------------------------------------------------------------
-- The Spans are created automatically when using View_Base_Type.Put
procedure Create (Span : in out Span_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Content : in String := "";
ID : in String := "");
-- Create a Span container
private
type A_Type is new Gnoga.Gui.View.View_Base_Type with null record;
type Button_Type is new Gnoga.Gui.View.View_Base_Type with null record;
type DIV_Type is new Gnoga.Gui.View.View_Base_Type with null record;
type P_Type is new Gnoga.Gui.View.View_Base_Type with null record;
type IMG_Type is new Gnoga.Gui.Element.Element_Type with null record;
type HR_Type is new Gnoga.Gui.Element.Element_Type with null record;
type BR_Type is new Gnoga.Gui.Element.Element_Type with null record;
type Meter_Type is new Gnoga.Gui.Element.Element_Type with null record;
type Progress_Bar_Type is
new Gnoga.Gui.Element.Element_Type with null record;
type Span_Type is new Gnoga.Gui.View.View_Base_Type with null record;
end Ada_GUI.Gnoga.Gui.Element.Common;
|
JeremyGrosser/Ada_Drivers_Library | Ada | 10,577 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with NRF_SVD.TWI; use NRF_SVD.TWI;
package body nRF.TWI is
procedure Stop_Sequence (This : in out TWI_Master'Class);
-------------------
-- Stop_Sequence --
-------------------
procedure Stop_Sequence (This : in out TWI_Master'Class) is
begin
-- Stop sequence
This.Periph.EVENTS_STOPPED := 0;
This.Periph.TASKS_STOP := 1;
while This.Periph.EVENTS_STOPPED = 0 loop
null;
end loop;
end Stop_Sequence;
------------
-- Enable --
------------
procedure Enable (This : in out TWI_Master) is
begin
This.Periph.ENABLE.ENABLE := Enabled;
end Enable;
-------------
-- Disable --
-------------
procedure Disable (This : in out TWI_Master) is
begin
This.Periph.ENABLE.ENABLE := Disabled;
end Disable;
-------------
-- Enabled --
-------------
function Enabled (This : TWI_Master) return Boolean is
begin
return This.Periph.ENABLE.ENABLE = Enabled;
end Enabled;
---------------
-- Configure --
---------------
procedure Configure
(This : in out TWI_Master;
SCL, SDA : GPIO_Pin_Index;
Speed : TWI_Speed)
is
begin
This.Periph.PSELSCL := UInt32 (SCL);
This.Periph.PSELSDA := UInt32 (SDA);
This.Periph.FREQUENCY := (case Speed is
when TWI_100kbps => 16#0198_0000#,
when TWI_250kbps => 16#0400_0000#,
when TWI_400kbps => 16#0668_0000#);
end Configure;
----------------
-- Disconnect --
----------------
procedure Disconnect (This : in out TWI_Master) is
begin
This.Periph.PSELSCL := 16#FFFF_FFFF#;
This.Periph.PSELSDA := 16#FFFF_FFFF#;
end Disconnect;
---------------------
-- Master_Transmit --
---------------------
overriding procedure Master_Transmit
(This : in out TWI_Master;
Addr : I2C_Address;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
pragma Unreferenced (Timeout);
Index : Integer := Data'First + 1;
Evt_Err : UInt32;
Err_Src : ERRORSRC_Register with Unreferenced;
begin
if Data'Length = 0 then
Status := Ok;
return;
end if;
-- Clear errors
This.Periph.ERRORSRC := (Clear, Clear, Clear, 0);
-- Set Address
This.Periph.ADDRESS.ADDRESS := UInt7 (Addr / 2);
-- Prepare first byte
This.Periph.TXD.TXD := Data (Data'First);
-- Start TX sequence
This.Periph.TASKS_STARTTX := 1;
loop
loop
Evt_Err := This.Periph.EVENTS_ERROR;
if Evt_Err /= 0 then
Err_Src := This.Periph.ERRORSRC;
Status := Err_Error;
-- Clear the error
This.Periph.EVENTS_ERROR := 0;
-- Stop sequence
This.Periph.TASKS_STOP := 1;
return;
end if;
exit when This.Periph.EVENTS_TXDSENT /= 0;
end loop;
-- Clear the event
This.Periph.EVENTS_TXDSENT := 0;
exit when Index > Data'Last;
This.Periph.TXD.TXD := Data (Index);
Index := Index + 1;
end loop;
if This.Do_Stop_Sequence then
Stop_Sequence (This);
end if;
Status := Ok;
end Master_Transmit;
--------------------
-- Master_Receive --
--------------------
overriding procedure Master_Receive
(This : in out TWI_Master;
Addr : I2C_Address;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
pragma Unreferenced (Timeout);
begin
if Data'Length = 0 then
Status := Ok;
return;
end if;
-- Clear errors
This.Periph.ERRORSRC := (Clear, Clear, Clear, 0);
-- Set Address
This.Periph.ADDRESS.ADDRESS := UInt7 (Addr / 2);
if Data'Length = 1 then
-- Only one byte to receive so we stop at the next one
This.Periph.SHORTS.BB_STOP := Enabled;
This.Periph.SHORTS.BB_SUSPEND := Disabled;
else
-- Configure SHORTS to automatically suspend TWI port when receiving a
-- byte.
This.Periph.SHORTS.BB_SUSPEND := Enabled;
This.Periph.SHORTS.BB_STOP := Disabled;
end if;
-- Start RX sequence
This.Periph.TASKS_STARTRX := 1;
for Index in Data'Range loop
loop
if This.Periph.EVENTS_ERROR /= 0 then
Status := Err_Error;
-- Clear the error
This.Periph.EVENTS_ERROR := 0;
Stop_Sequence (This);
return;
end if;
exit when This.Periph.EVENTS_RXDREADY /= 0;
end loop;
-- Clear the event
This.Periph.EVENTS_RXDREADY := 0;
Data (Index) := This.Periph.RXD.RXD;
if Index = Data'Last - 1 and then This.Do_Stop_Sequence then
-- Configure SHORTS to automatically stop the TWI port and produce
-- a STOP event on the bus when receiving a byte.
This.Periph.SHORTS.BB_SUSPEND := Disabled;
This.Periph.SHORTS.BB_STOP := Enabled;
end if;
This.Periph.TASKS_RESUME := 1;
end loop;
Status := Ok;
end Master_Receive;
---------------
-- Mem_Write --
---------------
overriding procedure Mem_Write
(This : in out TWI_Master;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
This.Do_Stop_Sequence := False;
case Mem_Addr_Size is
when Memory_Size_8b =>
This.Master_Transmit (Addr => Addr,
Data => (0 => UInt8 (Mem_Addr)),
Status => Status,
Timeout => Timeout);
when Memory_Size_16b =>
This.Master_Transmit (Addr => Addr,
Data => (UInt8 (Shift_Right (Mem_Addr, 8)),
UInt8 (Mem_Addr and 16#FF#)),
Status => Status,
Timeout => Timeout);
end case;
This.Do_Stop_Sequence := True;
if Status /= Ok then
This.Stop_Sequence;
return;
end if;
This.Master_Transmit (Addr => Addr,
Data => Data,
Status => Status,
Timeout => Timeout);
end Mem_Write;
--------------
-- Mem_Read --
--------------
overriding procedure Mem_Read
(This : in out TWI_Master;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
This.Do_Stop_Sequence := False;
case Mem_Addr_Size is
when Memory_Size_8b =>
This.Master_Transmit (Addr => Addr,
Data => (0 => UInt8 (Mem_Addr)),
Status => Status,
Timeout => Timeout);
when Memory_Size_16b =>
This.Master_Transmit (Addr => Addr,
Data => (UInt8 (Shift_Right (Mem_Addr, 8)),
UInt8 (Mem_Addr and 16#FF#)),
Status => Status,
Timeout => Timeout);
end case;
This.Do_Stop_Sequence := True;
if Status /= Ok then
This.Stop_Sequence;
return;
end if;
This.Master_Receive (Addr => Addr,
Data => Data,
Status => Status,
Timeout => Timeout);
end Mem_Read;
end nRF.TWI;
|
reznikmm/matreshka | Ada | 4,640 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Chart.Attached_Axis_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Attached_Axis_Attribute_Node is
begin
return Self : Chart_Attached_Axis_Attribute_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Attached_Axis_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Attached_Axis_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Attached_Axis_Attribute,
Chart_Attached_Axis_Attribute_Node'Tag);
end Matreshka.ODF_Chart.Attached_Axis_Attributes;
|
tum-ei-rcs/StratoX | Ada | 59,721 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.DMA is
pragma Preelaborate;
---------------
-- Registers --
---------------
-------------------
-- LISR_Register --
-------------------
-- low interrupt status register
type LISR_Register is record
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF0 : Boolean;
-- unspecified
Reserved_1_1 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF0 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF0 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF0 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF0 : Boolean;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF1 : Boolean;
-- unspecified
Reserved_7_7 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF1 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF1 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF1 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF1 : Boolean;
-- unspecified
Reserved_12_15 : HAL.UInt4;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF2 : Boolean;
-- unspecified
Reserved_17_17 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF2 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF2 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF2 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF2 : Boolean;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF3 : Boolean;
-- unspecified
Reserved_23_23 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF3 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF3 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF3 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF3 : Boolean;
-- unspecified
Reserved_28_31 : HAL.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LISR_Register use record
FEIF0 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
DMEIF0 at 0 range 2 .. 2;
TEIF0 at 0 range 3 .. 3;
HTIF0 at 0 range 4 .. 4;
TCIF0 at 0 range 5 .. 5;
FEIF1 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DMEIF1 at 0 range 8 .. 8;
TEIF1 at 0 range 9 .. 9;
HTIF1 at 0 range 10 .. 10;
TCIF1 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
FEIF2 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
DMEIF2 at 0 range 18 .. 18;
TEIF2 at 0 range 19 .. 19;
HTIF2 at 0 range 20 .. 20;
TCIF2 at 0 range 21 .. 21;
FEIF3 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
DMEIF3 at 0 range 24 .. 24;
TEIF3 at 0 range 25 .. 25;
HTIF3 at 0 range 26 .. 26;
TCIF3 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- HISR_Register --
-------------------
-- high interrupt status register
type HISR_Register is record
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF4 : Boolean;
-- unspecified
Reserved_1_1 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF4 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF4 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF4 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF4 : Boolean;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF5 : Boolean;
-- unspecified
Reserved_7_7 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF5 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF5 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF5 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF5 : Boolean;
-- unspecified
Reserved_12_15 : HAL.UInt4;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF6 : Boolean;
-- unspecified
Reserved_17_17 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF6 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF6 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF6 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF6 : Boolean;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF7 : Boolean;
-- unspecified
Reserved_23_23 : HAL.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF7 : Boolean;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF7 : Boolean;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF7 : Boolean;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF7 : Boolean;
-- unspecified
Reserved_28_31 : HAL.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HISR_Register use record
FEIF4 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
DMEIF4 at 0 range 2 .. 2;
TEIF4 at 0 range 3 .. 3;
HTIF4 at 0 range 4 .. 4;
TCIF4 at 0 range 5 .. 5;
FEIF5 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DMEIF5 at 0 range 8 .. 8;
TEIF5 at 0 range 9 .. 9;
HTIF5 at 0 range 10 .. 10;
TCIF5 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
FEIF6 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
DMEIF6 at 0 range 18 .. 18;
TEIF6 at 0 range 19 .. 19;
HTIF6 at 0 range 20 .. 20;
TCIF6 at 0 range 21 .. 21;
FEIF7 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
DMEIF7 at 0 range 24 .. 24;
TEIF7 at 0 range 25 .. 25;
HTIF7 at 0 range 26 .. 26;
TCIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
--------------------
-- LIFCR_Register --
--------------------
-- low interrupt flag clear register
type LIFCR_Register is record
-- Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF0 : Boolean := False;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 3..0)
CDMEIF0 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF0 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF0 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 3..0)
CTCIF0 : Boolean := False;
-- Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF1 : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 3..0)
CDMEIF1 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF1 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF1 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 3..0)
CTCIF1 : Boolean := False;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF2 : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 3..0)
CDMEIF2 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF2 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF2 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 3..0)
CTCIF2 : Boolean := False;
-- Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF3 : Boolean := False;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 3..0)
CDMEIF3 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF3 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF3 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 3..0)
CTCIF3 : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LIFCR_Register use record
CFEIF0 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CDMEIF0 at 0 range 2 .. 2;
CTEIF0 at 0 range 3 .. 3;
CHTIF0 at 0 range 4 .. 4;
CTCIF0 at 0 range 5 .. 5;
CFEIF1 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CDMEIF1 at 0 range 8 .. 8;
CTEIF1 at 0 range 9 .. 9;
CHTIF1 at 0 range 10 .. 10;
CTCIF1 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CFEIF2 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
CDMEIF2 at 0 range 18 .. 18;
CTEIF2 at 0 range 19 .. 19;
CHTIF2 at 0 range 20 .. 20;
CTCIF2 at 0 range 21 .. 21;
CFEIF3 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
CDMEIF3 at 0 range 24 .. 24;
CTEIF3 at 0 range 25 .. 25;
CHTIF3 at 0 range 26 .. 26;
CTCIF3 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
--------------------
-- HIFCR_Register --
--------------------
-- high interrupt flag clear register
type HIFCR_Register is record
-- Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF4 : Boolean := False;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 7..4)
CDMEIF4 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF4 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF4 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 7..4)
CTCIF4 : Boolean := False;
-- Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF5 : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 7..4)
CDMEIF5 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF5 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF5 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 7..4)
CTCIF5 : Boolean := False;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF6 : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 7..4)
CDMEIF6 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF6 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF6 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 7..4)
CTCIF6 : Boolean := False;
-- Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF7 : Boolean := False;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Stream x clear direct mode error interrupt flag (x = 7..4)
CDMEIF7 : Boolean := False;
-- Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF7 : Boolean := False;
-- Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF7 : Boolean := False;
-- Stream x clear transfer complete interrupt flag (x = 7..4)
CTCIF7 : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HIFCR_Register use record
CFEIF4 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CDMEIF4 at 0 range 2 .. 2;
CTEIF4 at 0 range 3 .. 3;
CHTIF4 at 0 range 4 .. 4;
CTCIF4 at 0 range 5 .. 5;
CFEIF5 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CDMEIF5 at 0 range 8 .. 8;
CTEIF5 at 0 range 9 .. 9;
CHTIF5 at 0 range 10 .. 10;
CTCIF5 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CFEIF6 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
CDMEIF6 at 0 range 18 .. 18;
CTEIF6 at 0 range 19 .. 19;
CHTIF6 at 0 range 20 .. 20;
CTCIF6 at 0 range 21 .. 21;
CFEIF7 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
CDMEIF7 at 0 range 24 .. 24;
CTEIF7 at 0 range 25 .. 25;
CHTIF7 at 0 range 26 .. 26;
CTCIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- S0CR_Register --
-------------------
subtype S0CR_DIR_Field is HAL.UInt2;
subtype S0CR_PSIZE_Field is HAL.UInt2;
subtype S0CR_MSIZE_Field is HAL.UInt2;
subtype S0CR_PL_Field is HAL.UInt2;
subtype S0CR_PBURST_Field is HAL.UInt2;
subtype S0CR_MBURST_Field is HAL.UInt2;
subtype S0CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S0CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S0CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S0CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S0CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S0CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S0CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S0CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S0CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S0NDTR_Register --
---------------------
subtype S0NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S0NDTR_Register is record
-- Number of data items to transfer
NDT : S0NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S0FCR_Register --
--------------------
subtype S0FCR_FTH_Field is HAL.UInt2;
subtype S0FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S0FCR_Register is record
-- FIFO threshold selection
FTH : S0FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S0FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S1CR_Register --
-------------------
subtype S1CR_DIR_Field is HAL.UInt2;
subtype S1CR_PSIZE_Field is HAL.UInt2;
subtype S1CR_MSIZE_Field is HAL.UInt2;
subtype S1CR_PL_Field is HAL.UInt2;
subtype S1CR_PBURST_Field is HAL.UInt2;
subtype S1CR_MBURST_Field is HAL.UInt2;
subtype S1CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S1CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S1CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S1CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S1CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S1CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S1CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S1CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S1CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S1NDTR_Register --
---------------------
subtype S1NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S1NDTR_Register is record
-- Number of data items to transfer
NDT : S1NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S1FCR_Register --
--------------------
subtype S1FCR_FTH_Field is HAL.UInt2;
subtype S1FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S1FCR_Register is record
-- FIFO threshold selection
FTH : S1FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S1FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S2CR_Register --
-------------------
subtype S2CR_DIR_Field is HAL.UInt2;
subtype S2CR_PSIZE_Field is HAL.UInt2;
subtype S2CR_MSIZE_Field is HAL.UInt2;
subtype S2CR_PL_Field is HAL.UInt2;
subtype S2CR_PBURST_Field is HAL.UInt2;
subtype S2CR_MBURST_Field is HAL.UInt2;
subtype S2CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S2CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S2CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S2CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S2CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S2CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S2CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S2CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S2CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S2NDTR_Register --
---------------------
subtype S2NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S2NDTR_Register is record
-- Number of data items to transfer
NDT : S2NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S2FCR_Register --
--------------------
subtype S2FCR_FTH_Field is HAL.UInt2;
subtype S2FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S2FCR_Register is record
-- FIFO threshold selection
FTH : S2FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S2FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S3CR_Register --
-------------------
subtype S3CR_DIR_Field is HAL.UInt2;
subtype S3CR_PSIZE_Field is HAL.UInt2;
subtype S3CR_MSIZE_Field is HAL.UInt2;
subtype S3CR_PL_Field is HAL.UInt2;
subtype S3CR_PBURST_Field is HAL.UInt2;
subtype S3CR_MBURST_Field is HAL.UInt2;
subtype S3CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S3CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S3CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S3CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S3CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S3CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S3CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S3CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S3CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S3NDTR_Register --
---------------------
subtype S3NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S3NDTR_Register is record
-- Number of data items to transfer
NDT : S3NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S3FCR_Register --
--------------------
subtype S3FCR_FTH_Field is HAL.UInt2;
subtype S3FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S3FCR_Register is record
-- FIFO threshold selection
FTH : S3FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S3FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S4CR_Register --
-------------------
subtype S4CR_DIR_Field is HAL.UInt2;
subtype S4CR_PSIZE_Field is HAL.UInt2;
subtype S4CR_MSIZE_Field is HAL.UInt2;
subtype S4CR_PL_Field is HAL.UInt2;
subtype S4CR_PBURST_Field is HAL.UInt2;
subtype S4CR_MBURST_Field is HAL.UInt2;
subtype S4CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S4CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S4CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S4CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S4CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S4CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S4CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S4CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S4CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S4NDTR_Register --
---------------------
subtype S4NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S4NDTR_Register is record
-- Number of data items to transfer
NDT : S4NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S4FCR_Register --
--------------------
subtype S4FCR_FTH_Field is HAL.UInt2;
subtype S4FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S4FCR_Register is record
-- FIFO threshold selection
FTH : S4FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S4FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S5CR_Register --
-------------------
subtype S5CR_DIR_Field is HAL.UInt2;
subtype S5CR_PSIZE_Field is HAL.UInt2;
subtype S5CR_MSIZE_Field is HAL.UInt2;
subtype S5CR_PL_Field is HAL.UInt2;
subtype S5CR_PBURST_Field is HAL.UInt2;
subtype S5CR_MBURST_Field is HAL.UInt2;
subtype S5CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S5CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S5CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S5CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S5CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S5CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S5CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S5CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S5CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S5NDTR_Register --
---------------------
subtype S5NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S5NDTR_Register is record
-- Number of data items to transfer
NDT : S5NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S5FCR_Register --
--------------------
subtype S5FCR_FTH_Field is HAL.UInt2;
subtype S5FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S5FCR_Register is record
-- FIFO threshold selection
FTH : S5FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S5FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S6CR_Register --
-------------------
subtype S6CR_DIR_Field is HAL.UInt2;
subtype S6CR_PSIZE_Field is HAL.UInt2;
subtype S6CR_MSIZE_Field is HAL.UInt2;
subtype S6CR_PL_Field is HAL.UInt2;
subtype S6CR_PBURST_Field is HAL.UInt2;
subtype S6CR_MBURST_Field is HAL.UInt2;
subtype S6CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S6CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S6CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S6CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S6CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S6CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S6CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S6CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S6CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S6NDTR_Register --
---------------------
subtype S6NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S6NDTR_Register is record
-- Number of data items to transfer
NDT : S6NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S6FCR_Register --
--------------------
subtype S6FCR_FTH_Field is HAL.UInt2;
subtype S6FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S6FCR_Register is record
-- FIFO threshold selection
FTH : S6FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S6FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-------------------
-- S7CR_Register --
-------------------
subtype S7CR_DIR_Field is HAL.UInt2;
subtype S7CR_PSIZE_Field is HAL.UInt2;
subtype S7CR_MSIZE_Field is HAL.UInt2;
subtype S7CR_PL_Field is HAL.UInt2;
subtype S7CR_PBURST_Field is HAL.UInt2;
subtype S7CR_MBURST_Field is HAL.UInt2;
subtype S7CR_CHSEL_Field is HAL.UInt3;
-- stream x configuration register
type S7CR_Register is record
-- Stream enable / flag stream ready when read low
EN : Boolean := False;
-- Direct mode error interrupt enable
DMEIE : Boolean := False;
-- Transfer error interrupt enable
TEIE : Boolean := False;
-- Half transfer interrupt enable
HTIE : Boolean := False;
-- Transfer complete interrupt enable
TCIE : Boolean := False;
-- Peripheral flow controller
PFCTRL : Boolean := False;
-- Data transfer direction
DIR : S7CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : Boolean := False;
-- Peripheral increment mode
PINC : Boolean := False;
-- Memory increment mode
MINC : Boolean := False;
-- Peripheral data size
PSIZE : S7CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S7CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : Boolean := False;
-- Priority level
PL : S7CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : Boolean := False;
-- Current target (only in double buffer mode)
CT : Boolean := False;
-- ACK
ACK : Boolean := False;
-- Peripheral burst transfer configuration
PBURST : S7CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S7CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S7CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- S7NDTR_Register --
---------------------
subtype S7NDTR_NDT_Field is HAL.Short;
-- stream x number of data register
type S7NDTR_Register is record
-- Number of data items to transfer
NDT : S7NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- S7FCR_Register --
--------------------
subtype S7FCR_FTH_Field is HAL.UInt2;
subtype S7FCR_FS_Field is HAL.UInt3;
-- stream x FIFO control register
type S7FCR_Register is record
-- FIFO threshold selection
FTH : S7FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : Boolean := False;
-- Read-only. FIFO status
FS : S7FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- DMA controller
type DMA_Peripheral is record
-- low interrupt status register
LISR : LISR_Register;
-- high interrupt status register
HISR : HISR_Register;
-- low interrupt flag clear register
LIFCR : LIFCR_Register;
-- high interrupt flag clear register
HIFCR : HIFCR_Register;
-- stream x configuration register
S0CR : S0CR_Register;
-- stream x number of data register
S0NDTR : S0NDTR_Register;
-- stream x peripheral address register
S0PAR : HAL.Word;
-- stream x memory 0 address register
S0M0AR : HAL.Word;
-- stream x memory 1 address register
S0M1AR : HAL.Word;
-- stream x FIFO control register
S0FCR : S0FCR_Register;
-- stream x configuration register
S1CR : S1CR_Register;
-- stream x number of data register
S1NDTR : S1NDTR_Register;
-- stream x peripheral address register
S1PAR : HAL.Word;
-- stream x memory 0 address register
S1M0AR : HAL.Word;
-- stream x memory 1 address register
S1M1AR : HAL.Word;
-- stream x FIFO control register
S1FCR : S1FCR_Register;
-- stream x configuration register
S2CR : S2CR_Register;
-- stream x number of data register
S2NDTR : S2NDTR_Register;
-- stream x peripheral address register
S2PAR : HAL.Word;
-- stream x memory 0 address register
S2M0AR : HAL.Word;
-- stream x memory 1 address register
S2M1AR : HAL.Word;
-- stream x FIFO control register
S2FCR : S2FCR_Register;
-- stream x configuration register
S3CR : S3CR_Register;
-- stream x number of data register
S3NDTR : S3NDTR_Register;
-- stream x peripheral address register
S3PAR : HAL.Word;
-- stream x memory 0 address register
S3M0AR : HAL.Word;
-- stream x memory 1 address register
S3M1AR : HAL.Word;
-- stream x FIFO control register
S3FCR : S3FCR_Register;
-- stream x configuration register
S4CR : S4CR_Register;
-- stream x number of data register
S4NDTR : S4NDTR_Register;
-- stream x peripheral address register
S4PAR : HAL.Word;
-- stream x memory 0 address register
S4M0AR : HAL.Word;
-- stream x memory 1 address register
S4M1AR : HAL.Word;
-- stream x FIFO control register
S4FCR : S4FCR_Register;
-- stream x configuration register
S5CR : S5CR_Register;
-- stream x number of data register
S5NDTR : S5NDTR_Register;
-- stream x peripheral address register
S5PAR : HAL.Word;
-- stream x memory 0 address register
S5M0AR : HAL.Word;
-- stream x memory 1 address register
S5M1AR : HAL.Word;
-- stream x FIFO control register
S5FCR : S5FCR_Register;
-- stream x configuration register
S6CR : S6CR_Register;
-- stream x number of data register
S6NDTR : S6NDTR_Register;
-- stream x peripheral address register
S6PAR : HAL.Word;
-- stream x memory 0 address register
S6M0AR : HAL.Word;
-- stream x memory 1 address register
S6M1AR : HAL.Word;
-- stream x FIFO control register
S6FCR : S6FCR_Register;
-- stream x configuration register
S7CR : S7CR_Register;
-- stream x number of data register
S7NDTR : S7NDTR_Register;
-- stream x peripheral address register
S7PAR : HAL.Word;
-- stream x memory 0 address register
S7M0AR : HAL.Word;
-- stream x memory 1 address register
S7M1AR : HAL.Word;
-- stream x FIFO control register
S7FCR : S7FCR_Register;
end record
with Volatile;
for DMA_Peripheral use record
LISR at 0 range 0 .. 31;
HISR at 4 range 0 .. 31;
LIFCR at 8 range 0 .. 31;
HIFCR at 12 range 0 .. 31;
S0CR at 16 range 0 .. 31;
S0NDTR at 20 range 0 .. 31;
S0PAR at 24 range 0 .. 31;
S0M0AR at 28 range 0 .. 31;
S0M1AR at 32 range 0 .. 31;
S0FCR at 36 range 0 .. 31;
S1CR at 40 range 0 .. 31;
S1NDTR at 44 range 0 .. 31;
S1PAR at 48 range 0 .. 31;
S1M0AR at 52 range 0 .. 31;
S1M1AR at 56 range 0 .. 31;
S1FCR at 60 range 0 .. 31;
S2CR at 64 range 0 .. 31;
S2NDTR at 68 range 0 .. 31;
S2PAR at 72 range 0 .. 31;
S2M0AR at 76 range 0 .. 31;
S2M1AR at 80 range 0 .. 31;
S2FCR at 84 range 0 .. 31;
S3CR at 88 range 0 .. 31;
S3NDTR at 92 range 0 .. 31;
S3PAR at 96 range 0 .. 31;
S3M0AR at 100 range 0 .. 31;
S3M1AR at 104 range 0 .. 31;
S3FCR at 108 range 0 .. 31;
S4CR at 112 range 0 .. 31;
S4NDTR at 116 range 0 .. 31;
S4PAR at 120 range 0 .. 31;
S4M0AR at 124 range 0 .. 31;
S4M1AR at 128 range 0 .. 31;
S4FCR at 132 range 0 .. 31;
S5CR at 136 range 0 .. 31;
S5NDTR at 140 range 0 .. 31;
S5PAR at 144 range 0 .. 31;
S5M0AR at 148 range 0 .. 31;
S5M1AR at 152 range 0 .. 31;
S5FCR at 156 range 0 .. 31;
S6CR at 160 range 0 .. 31;
S6NDTR at 164 range 0 .. 31;
S6PAR at 168 range 0 .. 31;
S6M0AR at 172 range 0 .. 31;
S6M1AR at 176 range 0 .. 31;
S6FCR at 180 range 0 .. 31;
S7CR at 184 range 0 .. 31;
S7NDTR at 188 range 0 .. 31;
S7PAR at 192 range 0 .. 31;
S7M0AR at 196 range 0 .. 31;
S7M1AR at 200 range 0 .. 31;
S7FCR at 204 range 0 .. 31;
end record;
-- DMA controller
DMA1_Periph : aliased DMA_Peripheral
with Import, Address => DMA1_Base;
-- DMA controller
DMA2_Periph : aliased DMA_Peripheral
with Import, Address => DMA2_Base;
end STM32_SVD.DMA;
|
persan/AdaYaml | Ada | 286 | ads | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with AUnit.Test_Suites;
package Yaml.Transformation_Tests.Suite is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
end Yaml.Transformation_Tests.Suite;
|
reznikmm/matreshka | Ada | 4,605 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Db.Catalog_Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Catalog_Name_Attribute_Node is
begin
return Self : Db_Catalog_Name_Attribute_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Catalog_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Catalog_Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Catalog_Name_Attribute,
Db_Catalog_Name_Attribute_Node'Tag);
end Matreshka.ODF_Db.Catalog_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,689 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Value_Attributes is
pragma Preelaborate;
type ODF_Text_Value_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Value_Attribute_Access is
access all ODF_Text_Value_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Value_Attributes;
|
AaronC98/PlaneSystem | Ada | 5,227 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Vectors;
with Ada.Strings.Unbounded;
package body SOAP.WSDL.Schema is
use Ada;
use Ada.Strings.Unbounded;
type Data is record
URL : Unbounded_String;
Node : DOM.Core.Node;
end record;
package Schema_Store is new Containers.Indefinite_Vectors (Positive, Data);
Store : Schema_Store.Vector;
--------------
-- Contains --
--------------
function Contains (Namespace : URL) return Boolean is
begin
for E of Store loop
if E.URL = Namespace then
return True;
end if;
end loop;
return False;
end Contains;
-------------
-- For_All --
-------------
procedure For_All
(Namespace : URL;
Process : not null access procedure (N : DOM.Core.Node)) is
begin
for E of Store loop
if E.URL = Namespace then
Process (E.Node);
end if;
end loop;
end For_All;
-----------------------
-- Get_Binding_Style --
-----------------------
function Get_Binding_Style (Schema : Definition) return Binding_Style is
begin
if Schema.Contains ("@binding.style") then
return Binding_Style'Value (Schema ("@binding.style"));
else
return RPC;
end if;
end Get_Binding_Style;
----------------------------
-- Get_Call_For_Signature --
----------------------------
function Get_Call_For_Signature
(Schema : Definition;
Signature : String) return String
is
Key : constant String := "@" & Signature;
begin
if Schema.Contains (Key) then
return Schema (Key);
else
return "";
end if;
end Get_Call_For_Signature;
------------------------
-- Get_Encoding_Style --
------------------------
function Get_Encoding_Style
(Schema : Definition;
Operation : String) return Encoding_Style
is
Key : constant String := "@" & Operation & ".encoding";
begin
if Schema.Contains (Key) then
return Encoding_Style'Value (Schema (Key));
else
return Encoded;
end if;
end Get_Encoding_Style;
--------------
-- Register --
--------------
procedure Register (Namespace : URL; Node : DOM.Core.Node) is
begin
Store.Append (Data'(To_Unbounded_String (Namespace), Node));
end Register;
-----------------------
-- Set_Binding_Style --
-----------------------
procedure Set_Binding_Style
(Schema : in out Definition; Style : Binding_Style) is
begin
Schema.Include ("@binding.style", Binding_Style'Image (Style));
end Set_Binding_Style;
------------------------
-- Set_Encoding_Style --
------------------------
procedure Set_Encoding_Style
(Schema : in out Definition;
Operation : String;
Encoding : Encoding_Style) is
begin
Schema.Include
("@" & Operation & ".encoding", Encoding_Style'Image (Encoding));
end Set_Encoding_Style;
end SOAP.WSDL.Schema;
|
AdaCore/langkit | Ada | 2,658 | adb | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
package body Langkit_Support.Names.Maps is
use Helper_Maps;
function Create_Name (Name : Text_Type; M : Map) return Name_Type
is (Create_Name (Name, M.Casing));
function Create_Key (Name : Name_Type; M : Map) return Unbounded_String
is (To_Unbounded_String (Image (Format_Name (Name, M.Casing))));
---------------------
-- Create_Name_Map --
---------------------
function Create_Name_Map (Casing : Casing_Convention) return Map is
begin
return (Casing => Casing, Map => Empty_Map);
end Create_Name_Map;
------------
-- Insert --
------------
procedure Insert
(Self : in out Map; Name : Name_Type; Element : Element_Type)
is
begin
Self.Map.Insert (Create_Key (Name, Self), Element);
end Insert;
-------------
-- Include --
-------------
procedure Include
(Self : in out Map; Name : Name_Type; Element : Element_Type)
is
begin
Self.Map.Include (Create_Key (Name, Self), Element);
end Include;
------------
-- Lookup --
------------
function Lookup (Self : Map; Name : Name_Type) return Lookup_Result is
Cur : constant Cursor := Self.Map.Find (Create_Key (Name, Self));
begin
if Has_Element (Cur) then
return (Present => True, Element => Element (Cur));
else
return Absent_Lookup_Result;
end if;
end Lookup;
---------
-- Get --
---------
function Get (Self : Map; Name : Name_Type) return Element_Type is
Result : constant Lookup_Result := Lookup (Self, Name);
begin
return (if Result.Present
then Result.Element
else raise Constraint_Error with "no such name");
end Get;
------------
-- Insert --
------------
procedure Insert
(Self : in out Map; Name : Text_Type; Element : Element_Type)
is
begin
Insert (Self, Create_Name (Name, Self), Element);
end Insert;
-------------
-- Include --
-------------
procedure Include
(Self : in out Map; Name : Text_Type; Element : Element_Type)
is
begin
Include (Self, Create_Name (Name, Self), Element);
end Include;
------------
-- Lookup --
------------
function Lookup (Self : Map; Name : Text_Type) return Lookup_Result is
begin
return Lookup (Self, Create_Name (Name, Self));
end Lookup;
---------
-- Get --
---------
function Get (Self : Map; Name : Text_Type) return Element_Type is
begin
return Get (Self, Create_Name (Name, Self));
end Get;
end Langkit_Support.Names.Maps;
|
sungyeon/drake | Ada | 870 | adb | with System.Synchronous_Objects.Abortable;
with System.Tasks;
package body Ada.Synchronous_Task_Control.EDF is
procedure Suspend_Until_True_And_Set_Deadline (
S : in out Suspension_Object;
TS : Real_Time.Time_Span)
is
Dummy : Boolean;
begin
Suspend_Until_True_And_Set_Deadline (S, TS, Dummy);
end Suspend_Until_True_And_Set_Deadline;
procedure Suspend_Until_True_And_Set_Deadline (
S : in out Suspension_Object;
TS : Real_Time.Time_Span;
State : out Boolean)
is
Aborted : Boolean;
begin
System.Tasks.Enable_Abort;
System.Synchronous_Objects.Abortable.Wait (
S.Object,
Real_Time.To_Duration (TS),
State,
Aborted => Aborted);
System.Tasks.Disable_Abort (Aborted);
end Suspend_Until_True_And_Set_Deadline;
end Ada.Synchronous_Task_Control.EDF;
|
thierr26/ada-keystore | Ada | 5,270 | adb | -----------------------------------------------------------------------
-- keystore -- Ada keystore
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
package body Keystore is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore");
function To_String (UUID : in UUID_Type) return String is
Encode : constant Util.Encoders.Encoder := Util.Encoders.Create ("hex");
U1 : constant String := Encode.Encode_Unsigned_32 (UUID (1));
U2 : constant String := Encode.Encode_Unsigned_32 (UUID (2));
U3 : constant String := Encode.Encode_Unsigned_32 (UUID (3));
U4 : constant String := Encode.Encode_Unsigned_32 (UUID (4));
begin
return U1 & "-"
& U2 (U2'First .. U2'First + 3) & "-"
& U2 (U2'First + 4 .. U2'Last) & "-"
& U3 (U3'First .. U3'First + 3) & "-"
& U3 (U3'First + 4 .. U3'Last) & U4;
end To_String;
-- ------------------------------
-- Add in the wallet the named entry and associate it the content.
-- The content is encrypted in AES-CBC with a secret key and an IV vector
-- that is created randomly for the new named entry.
-- ------------------------------
procedure Add (Container : in out Wallet;
Name : in String;
Content : in String) is
use Ada.Streams;
Data : Stream_Element_Array (Stream_Element_Offset (Content'First)
.. Stream_Element_Offset (Content'Last));
for Data'Address use Content'Address;
begin
Wallet'Class (Container).Add (Name, T_STRING, Data);
end Add;
-- ------------------------------
-- Add or update in the wallet the named entry and associate it the content.
-- The content is encrypted in AES-CBC with a secret key and an IV vector
-- that is created randomly for the new or updated named entry.
-- ------------------------------
procedure Set (Container : in out Wallet;
Name : in String;
Content : in String) is
use Ada.Streams;
Data : Stream_Element_Array (Stream_Element_Offset (Content'First)
.. Stream_Element_Offset (Content'Last));
for Data'Address use Content'Address;
begin
Wallet'Class (Container).Set (Name, T_STRING, Data);
end Set;
-- ------------------------------
-- Update in the wallet the named entry and associate it the new content.
-- The secret key and IV vectors are not changed.
-- ------------------------------
procedure Update (Container : in out Wallet;
Name : in String;
Content : in String) is
use Ada.Streams;
Data : Stream_Element_Array (Stream_Element_Offset (Content'First)
.. Stream_Element_Offset (Content'Last));
for Data'Address use Content'Address;
begin
Wallet'Class (Container).Update (Name, T_STRING, Data);
end Update;
-- ------------------------------
-- Get from the wallet the named entry.
-- ------------------------------
function Get (Container : in out Wallet;
Name : in String) return String is
use Ada.Streams;
Info : Entry_Info := Wallet'Class (Container).Find (Name);
Result : String (1 .. Natural (Info.Size));
Buffer : Stream_Element_Array (1 .. Stream_Element_Offset (Info.Size));
for Buffer'Address use Result'Address;
begin
Wallet'Class (Container).Get (Name, Info, Buffer);
return Result;
end Get;
-- ------------------------------
-- Start the tasks of the task manager.
-- ------------------------------
procedure Start (Manager : in Task_Manager_Access) is
begin
Manager.Start;
end Start;
-- ------------------------------
-- Stop the tasks.
-- ------------------------------
procedure Stop (Manager : in Task_Manager_Access) is
begin
Manager.Stop;
end Stop;
procedure Execute (Manager : in out Task_Manager;
Work : in Work_Type_Access) is
begin
Executors.Execute (Executors.Executor_Manager (Manager), Work);
end Execute;
procedure Execute (Work : in out Work_Type_Access) is
begin
Work.Execute;
end Execute;
procedure Error (Work : in out Work_Type_Access;
Ex : in Ada.Exceptions.Exception_Occurrence) is
pragma Unreferenced (Work);
begin
Log.Error ("Work error", Ex);
end Error;
end Keystore;
|
jwarwick/aoc_2019_ada | Ada | 249 | adb | with AUnit.Reporter.Text;
with AUnit.Run;
with Day1_Suite; use Day1_Suite;
procedure Test_Day1 is
procedure Runner is new AUnit.Run.Test_Runner (Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Runner (Reporter);
end Test_Day1;
|
reznikmm/matreshka | Ada | 10,226 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010 Vadim Godunko <[email protected]> --
-- --
-- Matreshka is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. Matreshka is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with Matreshka; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, --
-- Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This package provides access to SSE2 instructions set.
------------------------------------------------------------------------------
with Interfaces;
package Matreshka.Internals.SIMD.Intel.SSE2 is
pragma Preelaborate;
function To_Integer_16_Vector_8
(Q7 : Interfaces.Integer_16;
Q6 : Interfaces.Integer_16;
Q5 : Interfaces.Integer_16;
Q4 : Interfaces.Integer_16;
Q3 : Interfaces.Integer_16;
Q2 : Interfaces.Integer_16;
Q1 : Interfaces.Integer_16;
Q0 : Interfaces.Integer_16) return Integer_16_Vector_8;
function To_Unsigned_16_Vector_8
(Q7 : Interfaces.Unsigned_16;
Q6 : Interfaces.Unsigned_16;
Q5 : Interfaces.Unsigned_16;
Q4 : Interfaces.Unsigned_16;
Q3 : Interfaces.Unsigned_16;
Q2 : Interfaces.Unsigned_16;
Q1 : Interfaces.Unsigned_16;
Q0 : Interfaces.Unsigned_16) return Unsigned_16_Vector_8;
-- function mm_set_epi16
-- (Q7 : Interfaces.Integer_16;
-- Q6 : Interfaces.Integer_16;
-- Q5 : Interfaces.Integer_16;
-- Q4 : Interfaces.Integer_16;
-- Q3 : Interfaces.Integer_16;
-- Q2 : Interfaces.Integer_16;
-- Q1 : Interfaces.Integer_16;
-- Q0 : Interfaces.Integer_16) return Integer_16_Vector_8;
--
-- function mm_set_epi16
-- (Q7 : Interfaces.Unsigned_16;
-- Q6 : Interfaces.Unsigned_16;
-- Q5 : Interfaces.Unsigned_16;
-- Q4 : Interfaces.Unsigned_16;
-- Q3 : Interfaces.Unsigned_16;
-- Q2 : Interfaces.Unsigned_16;
-- Q1 : Interfaces.Unsigned_16;
-- Q0 : Interfaces.Unsigned_16) return Unsigned_16_Vector_8;
function mm_and
(A : Integer_16_Vector_8;
B : Integer_16_Vector_8) return Integer_16_Vector_8;
function mm_and
(A : Unsigned_16_Vector_8;
B : Unsigned_16_Vector_8) return Unsigned_16_Vector_8;
function mm_cmpeq
(A : Integer_16_Vector_8;
B : Integer_16_Vector_8) return Integer_16_Vector_8;
function mm_cmpeq
(A : Unsigned_16_Vector_8;
B : Unsigned_16_Vector_8) return Unsigned_16_Vector_8;
function mm_movemask
(A : Integer_16_Vector_8) return Interfaces.Unsigned_32;
function mm_movemask
(A : Unsigned_16_Vector_8) return Interfaces.Unsigned_32;
private
pragma Inline_Always (mm_and);
pragma Inline_Always (mm_cmpeq);
pragma Inline_Always (mm_movemask);
-- pragma Inline_Always (mm_set_epi16);
pragma Inline_Always (To_Unsigned_16_Vector_8);
-- _mm_set_sd
-- _mm_set1_pd
-- _mm_set_pd1
-- _mm_set_pd
-- _mm_setr_pd
-- _mm_setzero_pd
-- _mm_move_sd
-- _mm_load_pd
-- _mm_loadu_pd
-- _mm_load1_pd
-- _mm_load_sd
-- _mm_load_pd1
-- _mm_loadr_pd
-- _mm_store_pd
-- _mm_storeu_pd
-- _mm_store_sd
-- _mm_cvtsd_f64
-- _mm_storel_pd
-- _mm_storeh_pd
-- _mm_store1_pd
-- _mm_store_pd1
-- _mm_storer_pd
-- _mm_cvtsi128_si32
-- _mm_cvtsi128_si64 x86_64, Intel
-- _mm_cvtsi128_si64x x86_64, Microsoft
-- _mm_add_pd
-- _mm_add_sd
-- _mm_sub_pd
-- _mm_sub_sd
-- _mm_mul_pd
-- _mm_mul_sd
-- _mm_div_pd
-- _mm_div_sd
-- _mm_sqrt_pd
-- _mm_sqrt_sd
-- _mm_min_pd
-- _mm_min_sd
-- _mm_max_pd
-- _mm_max_sd
-- _mm_and_pd
-- _mm_andnot_pd
-- _mm_or_pd
-- _mm_xor_pd
-- _mm_cmpeq_pd
-- _mm_cmplt_pd
-- _mm_cmple_pd
-- _mm_cmpgt_pd
-- _mm_cmpge_pd
-- _mm_cmpneq_pd
-- _mm_cmpnlt_pd
-- _mm_cmpnle_pd
-- _mm_cmpngt_pd
-- _mm_cmpnge_pd
-- _mm_cmpord_pd
-- _mm_cmpunord_pd
-- _mm_cmpeq_sd
-- _mm_cmplt_sd
-- _mm_cmple_sd
-- _mm_cmpgt_sd
-- _mm_cmpge_sd
-- _mm_cmpneq_sd
-- _mm_cmpnlt_sd
-- _mm_cmpnle_sd
-- _mm_cmpngt_sd
-- _mm_cmpnge_sd
-- _mm_cmpord_sd
-- _mm_cmpunord_sd
-- _mm_comieq_sd
-- _mm_comilt_sd
-- _mm_comile_sd
-- _mm_comigt_sd
-- _mm_comige_sd
-- _mm_comineq_sd
-- _mm_ucomieq_sd
-- _mm_ucomilt_sd
-- _mm_ucomile_sd
-- _mm_ucomigt_sd
-- _mm_ucomige_sd
-- _mm_ucomineq_sd
-- _mm_set_epi64x
-- _mm_set_epi64
-- _mm_set_epi32
-- + _mm_set_epi16
-- _mm_set_epi8
-- _mm_set1_epi64x
-- _mm_set1_epi64
-- _mm_set1_epi32
-- _mm_set1_epi16
-- _mm_set1_epi8
-- _mm_setr_epi64
-- _mm_setr_epi32
-- _mm_setr_epi16
-- _mm_setr_epi8
-- _mm_load_si128
-- _mm_loadu_si128
-- _mm_loadl_epi64
-- _mm_store_si128
-- _mm_storeu_si128
-- _mm_storel_epi64
-- _mm_movepi64_pi64
-- _mm_movpi64_epi64
-- _mm_move_epi64
-- _mm_setzero_si128
-- _mm_cvtepi32_pd
-- _mm_cvtepi32_ps
-- _mm_cvtpd_epi32
-- _mm_cvtpd_pi32
-- _mm_cvtpd_ps
-- _mm_cvttpd_epi32
-- _mm_cvttpd_pi32
-- _mm_cvtpi32_pd
-- _mm_cvtps_epi32
-- _mm_cvttps_epi32
-- _mm_cvtps_pd
-- _mm_cvtsd_si32
-- _mm_cvtsd_si64 x86_64, Intel
-- _mm_cvtsd_si64x x86_64, Microsoft
-- _mm_cvttsd_si32
-- _mm_cvttsd_si64 x86_64, Intel
-- _mm_cvttsd_si64x x86_64, Microsoft
-- _mm_cvtsd_ss
-- _mm_cvtsi32_sd
-- _mm_cvtsi64_sd x86_64, Intel
-- _mm_cvtsi64x_sd x86_64, Microsoft
-- _mm_cvtss_sd
-- _mm_shuffle_pd
-- _mm_unpackhi_pd
-- _mm_unpacklo_pd
-- _mm_loadh_pd
-- _mm_loadl_pd
-- _mm_movemask_pd
-- _mm_packs_epi16
-- _mm_packs_epi32
-- _mm_packus_epi16
-- _mm_unpackhi_epi8
-- _mm_unpackhi_epi16
-- _mm_unpackhi_epi32
-- _mm_unpackhi_epi64
-- _mm_unpacklo_epi8
-- _mm_unpacklo_epi16
-- _mm_unpacklo_epi32
-- _mm_unpacklo_epi64
-- _mm_add_epi8
-- _mm_add_epi16
-- _mm_add_epi32
-- _mm_add_epi64
-- _mm_adds_epi8
-- _mm_adds_epi16
-- _mm_adds_epu8
-- _mm_adds_epu16
-- _mm_sub_epi8
-- _mm_sub_epi16
-- _mm_sub_epi32
-- _mm_sub_epi64
-- _mm_subs_epi8
-- _mm_subs_epi16
-- _mm_subs_epu8
-- _mm_subs_epu16
-- _mm_madd_epi16
-- _mm_mulhi_epi16
-- _mm_mullo_epi16
-- _mm_mul_su32
-- _mm_mul_epu32
-- _mm_slli_epi16
-- _mm_slli_epi32
-- _mm_slli_epi64
-- _mm_srai_epi16
-- _mm_srai_epi32
-- _mm_srli_si128
-- _mm_slli_si128
-- _mm_srli_epi16
-- _mm_srli_epi32
-- _mm_srli_epi64
-- _mm_sll_epi16
-- _mm_sll_epi32
-- _mm_sll_epi64
-- _mm_sra_epi16
-- _mm_sra_epi32
-- _mm_srl_epi16
-- _mm_srl_epi32
-- _mm_srl_epi64
-- + _mm_and_si128
-- _mm_andnot_si128
-- _mm_or_si128
-- _mm_xor_si128
-- _mm_cmpeq_epi8
-- + _mm_cmpeq_epi16
-- _mm_cmpeq_epi32
-- _mm_cmplt_epi8
-- _mm_cmplt_epi16
-- _mm_cmplt_epi32
-- _mm_cmpgt_epi8
-- _mm_cmpgt_epi16
-- _mm_cmpgt_epi32
-- _mm_extract_epi16
-- _mm_insert_epi16
-- _mm_max_epi16
-- _mm_max_epu8
-- _mm_min_epi16
-- _mm_min_epu8
-- + _mm_movemask_epi8
-- _mm_mulhi_epu16
-- _mm_shufflehi_epi16
-- _mm_shufflelo_epi16
-- _mm_shuffle_epi32
-- _mm_maskmoveu_si128
-- _mm_avg_epu8
-- _mm_avg_epu16
-- _mm_sad_epu8
-- _mm_stream_si32
-- _mm_stream_si128
-- _mm_stream_pd
-- _mm_clflush
-- _mm_lfence
-- _mm_mfence
-- _mm_cvtsi32_si128
-- _mm_cvtsi64_si128 x86_64, Intel
-- _mm_cvtsi64x_si128 x86_64, Microsoft
-- _mm_castpd_ps
-- _mm_castpd_si128
-- _mm_castps_pd
-- _mm_castps_si128
-- _mm_castsi128_ps
-- _mm_castsi128_pd
function mm_and_si128 (A : v2di; B : v2di) return v2di;
pragma Import (Intrinsic, mm_and_si128, "__builtin_ia32_pand128");
function mm_movemask_epi8 (Item : v16qi) return Interfaces.Unsigned_32;
pragma Import (Intrinsic, mm_movemask_epi8, "__builtin_ia32_pmovmskb128");
function mm_cmpeq_epi16 (Left : v8hi; Right : v8hi) return v8hi;
pragma Import (Intrinsic, mm_cmpeq_epi16, "__builtin_ia32_pcmpeqw128");
end Matreshka.Internals.SIMD.Intel.SSE2;
|
zrmyers/VulkanAda | Ada | 5,691 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenType;
with Vulkan.Math.GenBType;
with Vulkan.Math.GenUType;
use Vulkan.Math.GenBType;
use Vulkan.Math.GenUType;
--------------------------------------------------------------------------------
--< @group Vulkan Math GenType
--------------------------------------------------------------------------------
--< @summary
--< This package describes any length vector of Vkm_Int type.
--<
--< @description
--< Provides an instantiation of the generic GenType package with a Base_Type of
--< Vkm_Int. This is used to provide the Vkm_GenIType subtype for the Vulkan Math
--< library.
--------------------------------------------------------------------------------
package Vulkan.Math.GenIType is
pragma Preelaborate;
pragma Pure;
--< @private
--< An instance of the generic GenType package, with Vkm_Int as the Base_Type.
package GIT is new Vulkan.Math.GenType(
Base_Type => Vkm_Int,
Default_Value => 0,
Image => Vkm_Int'Image,
Unary_Minus => "-",
Multiply => "*");
--< A subtype of the instantiated Vkm_GenType that represents the GenIType
--< described in the GLSL specification.
subtype Vkm_GenIType is GIT.Vkm_GenType;
----------------------------------------------------------------------------
-- Generic Operations
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--< @summary
--< Apply function for parameters of Vkm_Int and Vkm_Bool type to GenIType
--< and GenBType vectors.
--<
--< @description
--< Applies a supplied function component wise on two GenIType vectors and
--< a GenBType vector returning a GenIType vector.
--<
--< RVI := [Func(IVI1.x, IVI2.x, IVB1.x) ... Func(IVI1.w, IVI2.w, IVB1.w)]
--<
--< @param IVI1
--< The first input GenIType parameter.
--<
--< @param IVI2
--< The second input GenIType parameter.
--<
--< @param IVB1
--< The first input GenBType parameter.
--<
--< @return
--< The result GenIType vector, RVI.
----------------------------------------------------------------------------
generic
with function Func(ISI1, ISI2 : in Vkm_Int;
ISB1 : in Vkm_Bool ) return Vkm_Int;
function Apply_Func_IVI_IVI_IVB_RVI(IVI1, IVI2 : in Vkm_GenIType;
IVB1 : in Vkm_GenBType) return Vkm_GenIType;
----------------------------------------------------------------------------
--< @summary
--< Apply function on two Vkm_Int inputs that returns a Vkm_Bool component-wise
--< to two Vkm_GenIType vectors.
--<
--< @description
--< Applies a supplied function component wise on two GenIType vectors,
--< returning a GenBType vector.
--<
--< RVB := [Func(IVI1.x,IVI2.x) ... Func(IVI1.w,IVI2.w)]
--<
--< @param IVI1
--< The first input GenIType parameter.
--<
--< @param IVI2
--< The second input GenIType parameter.
--<
--< @return
--< The resulting GenBType vector, RVB.
----------------------------------------------------------------------------
generic
with function Func(ISI1, ISI2 : in Vkm_Int) return Vkm_Bool;
function Apply_Func_IVI_IVI_RVB(IVI1, IVI2 : in Vkm_GenIType) return Vkm_GenBType;
----------------------------------------------------------------------------
--< @summary
--< Apply function on a Vkm_Uint input that returns a Vkm_Int component-wise
--< on a Vkm_GenUType vector.
--<
--< @description
--< Applies a supplied function component wise on a GenUType vectors,
--< returning a GenIType vector.
--<
--< RVU := [Func(IVI1.x) ... Func(IVI1.w)]
--<
--< @param IVU1
--< The first input GenIType parameter.
--<
--< @return
--< The resulting GenIType vector, RVI.
----------------------------------------------------------------------------
generic
with function Func(ISU1 : in Vkm_Uint) return Vkm_Int;
function Apply_Func_IVU_RVI(IVU1 : in Vkm_GenUType) return Vkm_GenIType;
end Vulkan.Math.GenIType;
|
reznikmm/matreshka | Ada | 3,779 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Presentation_Use_Header_Name_Attributes is
pragma Preelaborate;
type ODF_Presentation_Use_Header_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Presentation_Use_Header_Name_Attribute_Access is
access all ODF_Presentation_Use_Header_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Presentation_Use_Header_Name_Attributes;
|
reznikmm/matreshka | Ada | 5,405 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- StructuralFeatureAction is an abstract class for all structural feature
-- actions.
------------------------------------------------------------------------------
with AMF.UML.Actions;
limited with AMF.UML.Input_Pins;
limited with AMF.UML.Structural_Features;
package AMF.UML.Structural_Feature_Actions is
pragma Preelaborate;
type UML_Structural_Feature_Action is limited interface
and AMF.UML.Actions.UML_Action;
type UML_Structural_Feature_Action_Access is
access all UML_Structural_Feature_Action'Class;
for UML_Structural_Feature_Action_Access'Storage_Size use 0;
not overriding function Get_Object
(Self : not null access constant UML_Structural_Feature_Action)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract;
-- Getter of StructuralFeatureAction::object.
--
-- Gives the input pin from which the object whose structural feature is
-- to be read or written is obtained.
not overriding procedure Set_Object
(Self : not null access UML_Structural_Feature_Action;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is abstract;
-- Setter of StructuralFeatureAction::object.
--
-- Gives the input pin from which the object whose structural feature is
-- to be read or written is obtained.
not overriding function Get_Structural_Feature
(Self : not null access constant UML_Structural_Feature_Action)
return AMF.UML.Structural_Features.UML_Structural_Feature_Access is abstract;
-- Getter of StructuralFeatureAction::structuralFeature.
--
-- Structural feature to be read.
not overriding procedure Set_Structural_Feature
(Self : not null access UML_Structural_Feature_Action;
To : AMF.UML.Structural_Features.UML_Structural_Feature_Access) is abstract;
-- Setter of StructuralFeatureAction::structuralFeature.
--
-- Structural feature to be read.
end AMF.UML.Structural_Feature_Actions;
|
zhmu/ananas | Ada | 1,290 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- U N C H E C K E D _ D E A L L O C A T I O N --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Object (<>) is limited private;
type Name is access Object;
procedure Unchecked_Deallocation (X : in out Name);
pragma Import (Intrinsic, Unchecked_Deallocation);
|
MatrixMike/Ada_Drivers_Library | Ada | 5,053 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with nRF51.GPIO; use nRF51.GPIO;
with nRF51.RTC; use nRF51.RTC;
with NRF51_SVD.RTC;
with nRF51.TWI; use nRF51.TWI;
with NRF51_SVD.TWI;
with nRF51.SPI_Master; use nRF51.SPI_Master;
with NRF51_SVD.SPI;
with nRF51.Timers; use nRF51.Timers;
with NRF51_SVD.TIMER;
package nRF51.Device is
P00 : aliased GPIO_Point := (Pin => 00);
P01 : aliased GPIO_Point := (Pin => 01);
P02 : aliased GPIO_Point := (Pin => 02);
P03 : aliased GPIO_Point := (Pin => 03);
P04 : aliased GPIO_Point := (Pin => 04);
P05 : aliased GPIO_Point := (Pin => 05);
P06 : aliased GPIO_Point := (Pin => 06);
P07 : aliased GPIO_Point := (Pin => 07);
P08 : aliased GPIO_Point := (Pin => 08);
P09 : aliased GPIO_Point := (Pin => 09);
P10 : aliased GPIO_Point := (Pin => 10);
P11 : aliased GPIO_Point := (Pin => 11);
P12 : aliased GPIO_Point := (Pin => 12);
P13 : aliased GPIO_Point := (Pin => 13);
P14 : aliased GPIO_Point := (Pin => 14);
P15 : aliased GPIO_Point := (Pin => 15);
P16 : aliased GPIO_Point := (Pin => 16);
P17 : aliased GPIO_Point := (Pin => 17);
P18 : aliased GPIO_Point := (Pin => 18);
P19 : aliased GPIO_Point := (Pin => 19);
P20 : aliased GPIO_Point := (Pin => 20);
P21 : aliased GPIO_Point := (Pin => 21);
P22 : aliased GPIO_Point := (Pin => 22);
P23 : aliased GPIO_Point := (Pin => 23);
P24 : aliased GPIO_Point := (Pin => 24);
P25 : aliased GPIO_Point := (Pin => 25);
P26 : aliased GPIO_Point := (Pin => 26);
P27 : aliased GPIO_Point := (Pin => 27);
P28 : aliased GPIO_Point := (Pin => 28);
P29 : aliased GPIO_Point := (Pin => 29);
P30 : aliased GPIO_Point := (Pin => 30);
P31 : aliased GPIO_Point := (Pin => 31);
RTC_0 : aliased Real_Time_Counter (NRF51_SVD.RTC.RTC0_Periph'Access);
RTC_1 : aliased Real_Time_Counter (NRF51_SVD.RTC.RTC1_Periph'Access);
-- Be carefull of shared resources between the TWI and SPI controllers.
-- TWI_O and SPI_Master_0 cannot be used at the same time.
-- TWI_1 and SPI_Master_1 cannot be used at the same time.
--
-- See nRF51 Series Reference Manual, chapter Memory.Instantiation.
TWI_0 : aliased TWI_Master (NRF51_SVD.TWI.TWI0_Periph'Access);
TWI_1 : aliased TWI_Master (NRF51_SVD.TWI.TWI1_Periph'Access);
SPI_Master_0 : aliased nRF51.SPI_Master.SPI_Master (NRF51_SVD.SPI.SPI0_Periph'Access);
SPI_Master_1 : aliased nRF51.SPI_Master.SPI_Master (NRF51_SVD.SPI.SPI1_Periph'Access);
Timer_0 : aliased Timer (NRF51_SVD.TIMER.TIMER0_Periph'Access);
Timer_1 : aliased Timer (NRF51_SVD.TIMER.TIMER1_Periph'Access);
Timer_2 : aliased Timer (NRF51_SVD.TIMER.TIMER2_Periph'Access);
end nRF51.Device;
|
AdaCore/training_material | Ada | 999 | ads |
-- This package implements a stack.
with Values; use Values;
package Stack is
Overflow : exception;
-- Raised if operation Push below is called when the stack is full.
Underflow : exception;
-- Raised if operations Pop/Top below are called when the stack is empty.
procedure Push (V : Value);
-- Pushes value onto the stack.
-- If the stack is full Stack.Overflow is raised.
function Pop return Value;
-- Pops a value off the stack and returns it. If the pop fails
-- because the stack is empty Stack.Underflow is raised.
function Empty return Boolean;
-- Returns True if the Stack is empty.
procedure Clear;
-- Empties the stack.
function Top return Value;
-- Returns the value on top of the stack. If the stack is empty
-- the exception Stack.Underflow is raised.
procedure View;
-- Prints the contents of the Stack on the screen.
-- Values are printed in the order in which they occur in the Stack.
end Stack;
|
reznikmm/matreshka | Ada | 6,271 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
with ODF.DOM.Elements.Style.Table_Properties.Internals;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Elements.Style.Table_Properties is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access Style_Table_Properties_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then
ODF.DOM.Visitors.ODF_Visitor'Class
(Visitor).Enter_Style_Table_Properties
(ODF.DOM.Elements.Style.Table_Properties.Internals.Create
(Style_Table_Properties_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Enter_Element (Visitor, Control);
end if;
end Enter_Element;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Table_Properties_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Table_Properties_Name;
end Get_Local_Name;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access Style_Table_Properties_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then
ODF.DOM.Visitors.ODF_Visitor'Class
(Visitor).Leave_Style_Table_Properties
(ODF.DOM.Elements.Style.Table_Properties.Internals.Create
(Style_Table_Properties_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Leave_Element (Visitor, Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access Style_Table_Properties_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.ODF_Iterator'Class then
ODF.DOM.Iterators.ODF_Iterator'Class
(Iterator).Visit_Style_Table_Properties
(Visitor,
ODF.DOM.Elements.Style.Table_Properties.Internals.Create
(Style_Table_Properties_Access (Self)),
Control);
else
Matreshka.DOM_Nodes.Elements.Abstract_Element
(Self.all).Visit_Element (Iterator, Visitor, Control);
end if;
end Visit_Element;
end Matreshka.ODF_Elements.Style.Table_Properties;
|
reznikmm/matreshka | Ada | 4,056 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers.Vectors;
with OPM.Generic_References;
with Forum.Posts.Objects.Stores;
package Forum.Posts.References is
-- pragma Preelaborate;
package Post_References is
new OPM.Generic_References
(Post_Identifier,
Forum.Posts.Objects.Post_Object,
Forum.Posts.Objects.Stores.Post_Access,
Forum.Posts.Objects.Stores.Post_Store,
Forum.Posts.Objects.Stores.Get,
Forum.Posts.Objects.Stores.Release);
type Post is new Post_References.Reference with null record;
package Post_Vectors is new Ada.Containers.Vectors (Positive, Post);
type Post_Vector is new Post_Vectors.Vector with null record;
end Forum.Posts.References;
|
reznikmm/matreshka | Ada | 4,623 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Dr3d.Normals_Kind_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Dr3d_Normals_Kind_Attribute_Node is
begin
return Self : Dr3d_Normals_Kind_Attribute_Node do
Matreshka.ODF_Dr3d.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Dr3d_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Dr3d_Normals_Kind_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Normals_Kind_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Dr3d_URI,
Matreshka.ODF_String_Constants.Normals_Kind_Attribute,
Dr3d_Normals_Kind_Attribute_Node'Tag);
end Matreshka.ODF_Dr3d.Normals_Kind_Attributes;
|
reznikmm/matreshka | Ada | 3,977 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Text_Tab_Ref_Attributes;
package Matreshka.ODF_Text.Tab_Ref_Attributes is
type Text_Tab_Ref_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Tab_Ref_Attributes.ODF_Text_Tab_Ref_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Tab_Ref_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Tab_Ref_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Tab_Ref_Attributes;
|
AdaCore/training_material | Ada | 98 | ads | with Base_Types;
package Odometer is
function Read return Base_Types.Meters_T;
end Odometer;
|
gabemgem/LITEC | Ada | 9,480 | adb | M:lab1_1
F:G$SYSCLK_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$UART0_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$Sys_Init$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$putchar$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$getchar$0$0({2}DF,SC:U),C,0,0,0,0,0
F:G$getchar_nw$0$0({2}DF,SC:U),C,0,0,0,0,0
F:G$main$0$0({2}DF,SV:S),C,0,0,0,0,0
F:G$Port_Init$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$Set_outputs$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$sensor1$0$0({2}DF,SI:S),Z,0,0,0,0,0
F:G$sensor2$0$0({2}DF,SI:S),Z,0,0,0,0,0
S:Llab1_1.getchar$c$1$10({1}SC:U),R,0,0,[]
S:Llab1_1.getchar_nw$c$1$12({1}SC:U),R,0,0,[]
S:G$P0$0$0({1}SC:U),I,0,0
S:G$SP$0$0({1}SC:U),I,0,0
S:G$DPL$0$0({1}SC:U),I,0,0
S:G$DPH$0$0({1}SC:U),I,0,0
S:G$P4$0$0({1}SC:U),I,0,0
S:G$P5$0$0({1}SC:U),I,0,0
S:G$P6$0$0({1}SC:U),I,0,0
S:G$PCON$0$0({1}SC:U),I,0,0
S:G$TCON$0$0({1}SC:U),I,0,0
S:G$TMOD$0$0({1}SC:U),I,0,0
S:G$TL0$0$0({1}SC:U),I,0,0
S:G$TL1$0$0({1}SC:U),I,0,0
S:G$TH0$0$0({1}SC:U),I,0,0
S:G$TH1$0$0({1}SC:U),I,0,0
S:G$CKCON$0$0({1}SC:U),I,0,0
S:G$PSCTL$0$0({1}SC:U),I,0,0
S:G$P1$0$0({1}SC:U),I,0,0
S:G$TMR3CN$0$0({1}SC:U),I,0,0
S:G$TMR3RLL$0$0({1}SC:U),I,0,0
S:G$TMR3RLH$0$0({1}SC:U),I,0,0
S:G$TMR3L$0$0({1}SC:U),I,0,0
S:G$TMR3H$0$0({1}SC:U),I,0,0
S:G$P7$0$0({1}SC:U),I,0,0
S:G$SCON$0$0({1}SC:U),I,0,0
S:G$SCON0$0$0({1}SC:U),I,0,0
S:G$SBUF$0$0({1}SC:U),I,0,0
S:G$SBUF0$0$0({1}SC:U),I,0,0
S:G$SPI0CFG$0$0({1}SC:U),I,0,0
S:G$SPI0DAT$0$0({1}SC:U),I,0,0
S:G$ADC1$0$0({1}SC:U),I,0,0
S:G$SPI0CKR$0$0({1}SC:U),I,0,0
S:G$CPT0CN$0$0({1}SC:U),I,0,0
S:G$CPT1CN$0$0({1}SC:U),I,0,0
S:G$P2$0$0({1}SC:U),I,0,0
S:G$EMI0TC$0$0({1}SC:U),I,0,0
S:G$EMI0CF$0$0({1}SC:U),I,0,0
S:G$PRT0CF$0$0({1}SC:U),I,0,0
S:G$P0MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT1CF$0$0({1}SC:U),I,0,0
S:G$P1MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT2CF$0$0({1}SC:U),I,0,0
S:G$P2MDOUT$0$0({1}SC:U),I,0,0
S:G$PRT3CF$0$0({1}SC:U),I,0,0
S:G$P3MDOUT$0$0({1}SC:U),I,0,0
S:G$IE$0$0({1}SC:U),I,0,0
S:G$SADDR0$0$0({1}SC:U),I,0,0
S:G$ADC1CN$0$0({1}SC:U),I,0,0
S:G$ADC1CF$0$0({1}SC:U),I,0,0
S:G$AMX1SL$0$0({1}SC:U),I,0,0
S:G$P3IF$0$0({1}SC:U),I,0,0
S:G$SADEN1$0$0({1}SC:U),I,0,0
S:G$EMI0CN$0$0({1}SC:U),I,0,0
S:G$_XPAGE$0$0({1}SC:U),I,0,0
S:G$P3$0$0({1}SC:U),I,0,0
S:G$OSCXCN$0$0({1}SC:U),I,0,0
S:G$OSCICN$0$0({1}SC:U),I,0,0
S:G$P74OUT$0$0({1}SC:U),I,0,0
S:G$FLSCL$0$0({1}SC:U),I,0,0
S:G$FLACL$0$0({1}SC:U),I,0,0
S:G$IP$0$0({1}SC:U),I,0,0
S:G$SADEN0$0$0({1}SC:U),I,0,0
S:G$AMX0CF$0$0({1}SC:U),I,0,0
S:G$AMX0SL$0$0({1}SC:U),I,0,0
S:G$ADC0CF$0$0({1}SC:U),I,0,0
S:G$P1MDIN$0$0({1}SC:U),I,0,0
S:G$ADC0L$0$0({1}SC:U),I,0,0
S:G$ADC0H$0$0({1}SC:U),I,0,0
S:G$SMB0CN$0$0({1}SC:U),I,0,0
S:G$SMB0STA$0$0({1}SC:U),I,0,0
S:G$SMB0DAT$0$0({1}SC:U),I,0,0
S:G$SMB0ADR$0$0({1}SC:U),I,0,0
S:G$ADC0GTL$0$0({1}SC:U),I,0,0
S:G$ADC0GTH$0$0({1}SC:U),I,0,0
S:G$ADC0LTL$0$0({1}SC:U),I,0,0
S:G$ADC0LTH$0$0({1}SC:U),I,0,0
S:G$T2CON$0$0({1}SC:U),I,0,0
S:G$T4CON$0$0({1}SC:U),I,0,0
S:G$RCAP2L$0$0({1}SC:U),I,0,0
S:G$RCAP2H$0$0({1}SC:U),I,0,0
S:G$TL2$0$0({1}SC:U),I,0,0
S:G$TH2$0$0({1}SC:U),I,0,0
S:G$SMB0CR$0$0({1}SC:U),I,0,0
S:G$PSW$0$0({1}SC:U),I,0,0
S:G$REF0CN$0$0({1}SC:U),I,0,0
S:G$DAC0L$0$0({1}SC:U),I,0,0
S:G$DAC0H$0$0({1}SC:U),I,0,0
S:G$DAC0CN$0$0({1}SC:U),I,0,0
S:G$DAC1L$0$0({1}SC:U),I,0,0
S:G$DAC1H$0$0({1}SC:U),I,0,0
S:G$DAC1CN$0$0({1}SC:U),I,0,0
S:G$PCA0CN$0$0({1}SC:U),I,0,0
S:G$PCA0MD$0$0({1}SC:U),I,0,0
S:G$PCA0CPM0$0$0({1}SC:U),I,0,0
S:G$PCA0CPM1$0$0({1}SC:U),I,0,0
S:G$PCA0CPM2$0$0({1}SC:U),I,0,0
S:G$PCA0CPM3$0$0({1}SC:U),I,0,0
S:G$PCA0CPM4$0$0({1}SC:U),I,0,0
S:G$ACC$0$0({1}SC:U),I,0,0
S:G$XBR0$0$0({1}SC:U),I,0,0
S:G$XBR1$0$0({1}SC:U),I,0,0
S:G$XBR2$0$0({1}SC:U),I,0,0
S:G$RCAP4L$0$0({1}SC:U),I,0,0
S:G$RCAP4H$0$0({1}SC:U),I,0,0
S:G$EIE1$0$0({1}SC:U),I,0,0
S:G$EIE2$0$0({1}SC:U),I,0,0
S:G$ADC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0L$0$0({1}SC:U),I,0,0
S:G$PCA0CPL0$0$0({1}SC:U),I,0,0
S:G$PCA0CPL1$0$0({1}SC:U),I,0,0
S:G$PCA0CPL2$0$0({1}SC:U),I,0,0
S:G$PCA0CPL3$0$0({1}SC:U),I,0,0
S:G$PCA0CPL4$0$0({1}SC:U),I,0,0
S:G$RSTSRC$0$0({1}SC:U),I,0,0
S:G$B$0$0({1}SC:U),I,0,0
S:G$SCON1$0$0({1}SC:U),I,0,0
S:G$SBUF1$0$0({1}SC:U),I,0,0
S:G$SADDR1$0$0({1}SC:U),I,0,0
S:G$TL4$0$0({1}SC:U),I,0,0
S:G$TH4$0$0({1}SC:U),I,0,0
S:G$EIP1$0$0({1}SC:U),I,0,0
S:G$EIP2$0$0({1}SC:U),I,0,0
S:G$SPI0CN$0$0({1}SC:U),I,0,0
S:G$PCA0H$0$0({1}SC:U),I,0,0
S:G$PCA0CPH0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH1$0$0({1}SC:U),I,0,0
S:G$PCA0CPH2$0$0({1}SC:U),I,0,0
S:G$PCA0CPH3$0$0({1}SC:U),I,0,0
S:G$PCA0CPH4$0$0({1}SC:U),I,0,0
S:G$WDTCN$0$0({1}SC:U),I,0,0
S:G$TMR0$0$0({2}SI:U),I,0,0
S:G$TMR1$0$0({2}SI:U),I,0,0
S:G$TMR2$0$0({2}SI:U),I,0,0
S:G$RCAP2$0$0({2}SI:U),I,0,0
S:G$TMR3$0$0({2}SI:U),I,0,0
S:G$TMR3RL$0$0({2}SI:U),I,0,0
S:G$TMR4$0$0({2}SI:U),I,0,0
S:G$RCAP4$0$0({2}SI:U),I,0,0
S:G$ADC0$0$0({2}SI:U),I,0,0
S:G$ADC0GT$0$0({2}SI:U),I,0,0
S:G$ADC0LT$0$0({2}SI:U),I,0,0
S:G$DAC0$0$0({2}SI:U),I,0,0
S:G$DAC1$0$0({2}SI:U),I,0,0
S:G$PCA0$0$0({2}SI:U),I,0,0
S:G$PCA0CP0$0$0({2}SI:U),I,0,0
S:G$PCA0CP1$0$0({2}SI:U),I,0,0
S:G$PCA0CP2$0$0({2}SI:U),I,0,0
S:G$PCA0CP3$0$0({2}SI:U),I,0,0
S:G$PCA0CP4$0$0({2}SI:U),I,0,0
S:G$P0_0$0$0({1}SX:U),J,0,0
S:G$P0_1$0$0({1}SX:U),J,0,0
S:G$P0_2$0$0({1}SX:U),J,0,0
S:G$P0_3$0$0({1}SX:U),J,0,0
S:G$P0_4$0$0({1}SX:U),J,0,0
S:G$P0_5$0$0({1}SX:U),J,0,0
S:G$P0_6$0$0({1}SX:U),J,0,0
S:G$P0_7$0$0({1}SX:U),J,0,0
S:G$IT0$0$0({1}SX:U),J,0,0
S:G$IE0$0$0({1}SX:U),J,0,0
S:G$IT1$0$0({1}SX:U),J,0,0
S:G$IE1$0$0({1}SX:U),J,0,0
S:G$TR0$0$0({1}SX:U),J,0,0
S:G$TF0$0$0({1}SX:U),J,0,0
S:G$TR1$0$0({1}SX:U),J,0,0
S:G$TF1$0$0({1}SX:U),J,0,0
S:G$P1_0$0$0({1}SX:U),J,0,0
S:G$P1_1$0$0({1}SX:U),J,0,0
S:G$P1_2$0$0({1}SX:U),J,0,0
S:G$P1_3$0$0({1}SX:U),J,0,0
S:G$P1_4$0$0({1}SX:U),J,0,0
S:G$P1_5$0$0({1}SX:U),J,0,0
S:G$P1_6$0$0({1}SX:U),J,0,0
S:G$P1_7$0$0({1}SX:U),J,0,0
S:G$RI$0$0({1}SX:U),J,0,0
S:G$RI0$0$0({1}SX:U),J,0,0
S:G$TI$0$0({1}SX:U),J,0,0
S:G$TI0$0$0({1}SX:U),J,0,0
S:G$RB8$0$0({1}SX:U),J,0,0
S:G$RB80$0$0({1}SX:U),J,0,0
S:G$TB8$0$0({1}SX:U),J,0,0
S:G$TB80$0$0({1}SX:U),J,0,0
S:G$REN$0$0({1}SX:U),J,0,0
S:G$REN0$0$0({1}SX:U),J,0,0
S:G$SM2$0$0({1}SX:U),J,0,0
S:G$SM20$0$0({1}SX:U),J,0,0
S:G$MCE0$0$0({1}SX:U),J,0,0
S:G$SM1$0$0({1}SX:U),J,0,0
S:G$SM10$0$0({1}SX:U),J,0,0
S:G$SM0$0$0({1}SX:U),J,0,0
S:G$SM00$0$0({1}SX:U),J,0,0
S:G$S0MODE$0$0({1}SX:U),J,0,0
S:G$P2_0$0$0({1}SX:U),J,0,0
S:G$P2_1$0$0({1}SX:U),J,0,0
S:G$P2_2$0$0({1}SX:U),J,0,0
S:G$P2_3$0$0({1}SX:U),J,0,0
S:G$P2_4$0$0({1}SX:U),J,0,0
S:G$P2_5$0$0({1}SX:U),J,0,0
S:G$P2_6$0$0({1}SX:U),J,0,0
S:G$P2_7$0$0({1}SX:U),J,0,0
S:G$EX0$0$0({1}SX:U),J,0,0
S:G$ET0$0$0({1}SX:U),J,0,0
S:G$EX1$0$0({1}SX:U),J,0,0
S:G$ET1$0$0({1}SX:U),J,0,0
S:G$ES0$0$0({1}SX:U),J,0,0
S:G$ES$0$0({1}SX:U),J,0,0
S:G$ET2$0$0({1}SX:U),J,0,0
S:G$EA$0$0({1}SX:U),J,0,0
S:G$P3_0$0$0({1}SX:U),J,0,0
S:G$P3_1$0$0({1}SX:U),J,0,0
S:G$P3_2$0$0({1}SX:U),J,0,0
S:G$P3_3$0$0({1}SX:U),J,0,0
S:G$P3_4$0$0({1}SX:U),J,0,0
S:G$P3_5$0$0({1}SX:U),J,0,0
S:G$P3_6$0$0({1}SX:U),J,0,0
S:G$P3_7$0$0({1}SX:U),J,0,0
S:G$PX0$0$0({1}SX:U),J,0,0
S:G$PT0$0$0({1}SX:U),J,0,0
S:G$PX1$0$0({1}SX:U),J,0,0
S:G$PT1$0$0({1}SX:U),J,0,0
S:G$PS0$0$0({1}SX:U),J,0,0
S:G$PS$0$0({1}SX:U),J,0,0
S:G$PT2$0$0({1}SX:U),J,0,0
S:G$SMBTOE$0$0({1}SX:U),J,0,0
S:G$SMBFTE$0$0({1}SX:U),J,0,0
S:G$AA$0$0({1}SX:U),J,0,0
S:G$SI$0$0({1}SX:U),J,0,0
S:G$STO$0$0({1}SX:U),J,0,0
S:G$STA$0$0({1}SX:U),J,0,0
S:G$ENSMB$0$0({1}SX:U),J,0,0
S:G$BUSY$0$0({1}SX:U),J,0,0
S:G$CPRL2$0$0({1}SX:U),J,0,0
S:G$CT2$0$0({1}SX:U),J,0,0
S:G$TR2$0$0({1}SX:U),J,0,0
S:G$EXEN2$0$0({1}SX:U),J,0,0
S:G$TCLK$0$0({1}SX:U),J,0,0
S:G$RCLK$0$0({1}SX:U),J,0,0
S:G$EXF2$0$0({1}SX:U),J,0,0
S:G$TF2$0$0({1}SX:U),J,0,0
S:G$P$0$0({1}SX:U),J,0,0
S:G$F1$0$0({1}SX:U),J,0,0
S:G$OV$0$0({1}SX:U),J,0,0
S:G$RS0$0$0({1}SX:U),J,0,0
S:G$RS1$0$0({1}SX:U),J,0,0
S:G$F0$0$0({1}SX:U),J,0,0
S:G$AC$0$0({1}SX:U),J,0,0
S:G$CY$0$0({1}SX:U),J,0,0
S:G$CCF0$0$0({1}SX:U),J,0,0
S:G$CCF1$0$0({1}SX:U),J,0,0
S:G$CCF2$0$0({1}SX:U),J,0,0
S:G$CCF3$0$0({1}SX:U),J,0,0
S:G$CCF4$0$0({1}SX:U),J,0,0
S:G$CR$0$0({1}SX:U),J,0,0
S:G$CF$0$0({1}SX:U),J,0,0
S:G$ADLJST$0$0({1}SX:U),J,0,0
S:G$AD0LJST$0$0({1}SX:U),J,0,0
S:G$ADWINT$0$0({1}SX:U),J,0,0
S:G$AD0WINT$0$0({1}SX:U),J,0,0
S:G$ADSTM0$0$0({1}SX:U),J,0,0
S:G$AD0CM0$0$0({1}SX:U),J,0,0
S:G$ADSTM1$0$0({1}SX:U),J,0,0
S:G$AD0CM1$0$0({1}SX:U),J,0,0
S:G$ADBUSY$0$0({1}SX:U),J,0,0
S:G$AD0BUSY$0$0({1}SX:U),J,0,0
S:G$ADCINT$0$0({1}SX:U),J,0,0
S:G$AD0INT$0$0({1}SX:U),J,0,0
S:G$ADCTM$0$0({1}SX:U),J,0,0
S:G$AD0TM$0$0({1}SX:U),J,0,0
S:G$ADCEN$0$0({1}SX:U),J,0,0
S:G$AD0EN$0$0({1}SX:U),J,0,0
S:G$SPIEN$0$0({1}SX:U),J,0,0
S:G$MSTEN$0$0({1}SX:U),J,0,0
S:G$SLVSEL$0$0({1}SX:U),J,0,0
S:G$TXBSY$0$0({1}SX:U),J,0,0
S:G$RXOVRN$0$0({1}SX:U),J,0,0
S:G$MODF$0$0({1}SX:U),J,0,0
S:G$WCOL$0$0({1}SX:U),J,0,0
S:G$SPIF$0$0({1}SX:U),J,0,0
S:G$LED0$0$0({1}SX:U),J,0,0
S:G$BILED0$0$0({1}SX:U),J,0,0
S:G$BILED1$0$0({1}SX:U),J,0,0
S:G$BUZZER$0$0({1}SX:U),J,0,0
S:G$SS$0$0({1}SX:U),J,0,0
S:G$PB1$0$0({1}SX:U),J,0,0
S:G$PB2$0$0({1}SX:U),J,0,0
S:G$SYSCLK_Init$0$0({2}DF,SV:S),C,0,0
S:G$UART0_Init$0$0({2}DF,SV:S),C,0,0
S:G$Sys_Init$0$0({2}DF,SV:S),C,0,0
S:G$getchar_nw$0$0({2}DF,SC:U),C,0,0
S:G$_print_format$0$0({2}DF,SI:S),C,0,0
S:G$printf_small$0$0({2}DF,SV:S),C,0,0
S:G$printf$0$0({2}DF,SI:S),C,0,0
S:G$vprintf$0$0({2}DF,SI:S),C,0,0
S:G$sprintf$0$0({2}DF,SI:S),C,0,0
S:G$vsprintf$0$0({2}DF,SI:S),C,0,0
S:G$puts$0$0({2}DF,SI:S),C,0,0
S:G$getchar$0$0({2}DF,SC:U),C,0,0
S:G$putchar$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast_f$0$0({2}DF,SV:S),C,0,0
S:G$printf_tiny$0$0({2}DF,SV:S),C,0,0
S:G$main$0$0({2}DF,SV:S),C,0,0
S:Flab1_1$__str_0$0$0({23}DA23d,SC:S),D,0,0
S:Flab1_1$__str_1$0$0({22}DA22d,SC:S),D,0,0
S:Flab1_1$__str_2$0$0({42}DA42d,SC:S),D,0,0
S:Flab1_1$__str_3$0$0({48}DA48d,SC:S),D,0,0
S:Flab1_1$__str_4$0$0({48}DA48d,SC:S),D,0,0
|
zhmu/ananas | Ada | 69,489 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- U I N T P --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Output; use Output;
with GNAT.HTable; use GNAT.HTable;
package body Uintp is
------------------------
-- Local Declarations --
------------------------
Uint_Int_First : Uint := Uint_0;
-- Uint value containing Int'First value, set by Initialize. The initial
-- value of Uint_0 is used for an assertion check that ensures that this
-- value is not used before it is initialized. This value is used in the
-- UI_Is_In_Int_Range predicate, and it is right that this is a host value,
-- since the issue is host representation of integer values.
Uint_Int_Last : Uint;
-- Uint value containing Int'Last value set by Initialize
UI_Power_2 : array (Int range 0 .. 128) of Uint;
-- This table is used to memoize exponentiations by powers of 2. The Nth
-- entry, if set, contains the Uint value 2**N. Initially UI_Power_2_Set
-- is zero and only the 0'th entry is set, the invariant being that all
-- entries in the range 0 .. UI_Power_2_Set are initialized.
UI_Power_2_Set : Nat;
-- Number of entries set in UI_Power_2;
UI_Power_10 : array (Int range 0 .. 128) of Uint;
-- This table is used to memoize exponentiations by powers of 10 in the
-- same manner as described above for UI_Power_2.
UI_Power_10_Set : Nat;
-- Number of entries set in UI_Power_10;
Uints_Min : Uint;
Udigits_Min : Int;
-- These values are used to make sure that the mark/release mechanism does
-- not destroy values saved in the U_Power tables or in the hash table used
-- by UI_From_Int. Whenever an entry is made in either of these tables,
-- Uints_Min and Udigits_Min are updated to protect the entry, and Release
-- never cuts back beyond these minimum values.
Int_0 : constant Int := 0;
Int_1 : constant Int := 1;
Int_2 : constant Int := 2;
-- These values are used in some cases where the use of numeric literals
-- would cause ambiguities (integer vs Uint).
type UI_Vector is array (Pos range <>) of Int;
-- Vector containing the integer values of a Uint value
-- Note: An earlier version of this package used pointers of arrays of Ints
-- (dynamically allocated) for the Uint type. The change leads to a few
-- less natural idioms used throughout this code, but eliminates all uses
-- of the heap except for the table package itself. For example, Uint
-- parameters are often converted to UI_Vectors for internal manipulation.
-- This is done by creating the local UI_Vector using the function N_Digits
-- on the Uint to find the size needed for the vector, and then calling
-- Init_Operand to copy the values out of the table into the vector.
----------------------------
-- UI_From_Int Hash Table --
----------------------------
-- UI_From_Int uses a hash table to avoid duplicating entries and wasting
-- storage. This is particularly important for complex cases of back
-- annotation.
subtype Hnum is Nat range 0 .. 1022;
function Hash_Num (F : Int) return Hnum;
-- Hashing function
package UI_Ints is new Simple_HTable (
Header_Num => Hnum,
Element => Uint,
No_Element => No_Uint,
Key => Int,
Hash => Hash_Num,
Equal => "=");
-----------------------
-- Local Subprograms --
-----------------------
function Direct (U : Valid_Uint) return Boolean;
pragma Inline (Direct);
-- Returns True if U is represented directly
function Direct_Val (U : Valid_Uint) return Int;
-- U is a Uint that is represented directly. The returned result is the
-- value represented.
function GCD (Jin, Kin : Int) return Int;
-- Compute GCD of two integers. Assumes that Jin >= Kin >= 0
procedure Image_Out
(Input : Uint;
To_Buffer : Boolean;
Format : UI_Format);
-- Common processing for UI_Image and UI_Write, To_Buffer is set True for
-- UI_Image, and false for UI_Write, and Format is copied from the Format
-- parameter to UI_Image or UI_Write.
procedure Init_Operand (UI : Valid_Uint; Vec : out UI_Vector);
pragma Inline (Init_Operand);
-- This procedure puts the value of UI into the vector in canonical
-- multiple precision format. The parameter should be of the correct size
-- as determined by a previous call to N_Digits (UI). The first digit of
-- Vec contains the sign, all other digits are always non-negative. Note
-- that the input may be directly represented, and in this case Vec will
-- contain the corresponding one or two digit value. The low bound of Vec
-- is always 1.
function Vector_To_Uint
(In_Vec : UI_Vector;
Negative : Boolean) return Valid_Uint;
-- Functions that calculate values in UI_Vectors, call this function to
-- create and return the Uint value. In_Vec contains the multiple precision
-- (Base) representation of a non-negative value. Leading zeroes are
-- permitted. Negative is set if the desired result is the negative of the
-- given value. The result will be either the appropriate directly
-- represented value, or a table entry in the proper canonical format is
-- created and returned.
--
-- Note that Init_Operand puts a signed value in the result vector, but
-- Vector_To_Uint is always presented with a non-negative value. The
-- processing of signs is something that is done by the caller before
-- calling Vector_To_Uint.
function Least_Sig_Digit (Arg : Valid_Uint) return Int;
pragma Inline (Least_Sig_Digit);
-- Returns the Least Significant Digit of Arg quickly. When the given Uint
-- is less than 2**15, the value returned is the input value, in this case
-- the result may be negative. It is expected that any use will mask off
-- unnecessary bits. This is used for finding Arg mod B where B is a power
-- of two. Hence the actual base is irrelevant as long as it is a power of
-- two.
procedure Most_Sig_2_Digits
(Left : Valid_Uint;
Right : Valid_Uint;
Left_Hat : out Int;
Right_Hat : out Int);
-- Returns leading two significant digits from the given pair of Uint's.
-- Mathematically: returns Left / (Base**K) and Right / (Base**K) where
-- K is as small as possible S.T. Right_Hat < Base * Base. It is required
-- that Left >= Right for the algorithm to work.
function N_Digits (Input : Valid_Uint) return Int;
pragma Inline (N_Digits);
-- Returns number of "digits" in a Uint
procedure UI_Div_Rem
(Left, Right : Valid_Uint;
Quotient : out Uint;
Remainder : out Uint;
Discard_Quotient : Boolean := False;
Discard_Remainder : Boolean := False);
-- Compute Euclidean division of Left by Right. If Discard_Quotient is
-- False then the quotient is returned in Quotient. If Discard_Remainder
-- is False, then the remainder is returned in Remainder.
--
-- If Discard_Quotient is True, Quotient is set to No_Uint.
-- If Discard_Remainder is True, Remainder is set to No_Uint.
function UI_Modular_Exponentiation
(B : Valid_Uint;
E : Valid_Uint;
Modulo : Valid_Uint) return Valid_Uint with Unreferenced;
-- Efficiently compute (B**E) rem Modulo
function UI_Modular_Inverse
(N : Valid_Uint; Modulo : Valid_Uint) return Valid_Uint with Unreferenced;
-- Compute the multiplicative inverse of N in modular arithmetics with the
-- given Modulo (uses Euclid's algorithm). Note: the call is considered
-- to be erroneous (and the behavior is undefined) if n is not invertible.
------------
-- Direct --
------------
function Direct (U : Valid_Uint) return Boolean is
begin
return Int (U) <= Int (Uint_Direct_Last);
end Direct;
----------------
-- Direct_Val --
----------------
function Direct_Val (U : Valid_Uint) return Int is
begin
pragma Assert (Direct (U));
return Int (U) - Int (Uint_Direct_Bias);
end Direct_Val;
---------
-- GCD --
---------
function GCD (Jin, Kin : Int) return Int is
J, K, Tmp : Int;
begin
pragma Assert (Jin >= Kin);
pragma Assert (Kin >= Int_0);
J := Jin;
K := Kin;
while K /= Uint_0 loop
Tmp := J mod K;
J := K;
K := Tmp;
end loop;
return J;
end GCD;
--------------
-- Hash_Num --
--------------
function Hash_Num (F : Int) return Hnum is
begin
return Types."mod" (F, Hnum'Range_Length);
end Hash_Num;
---------------
-- Image_Out --
---------------
procedure Image_Out
(Input : Uint;
To_Buffer : Boolean;
Format : UI_Format)
is
Marks : constant Uintp.Save_Mark := Uintp.Mark;
Base : Valid_Uint;
Ainput : Valid_Uint;
Digs_Output : Natural := 0;
-- Counts digits output. In hex mode, but not in decimal mode, we
-- put an underline after every four hex digits that are output.
Exponent : Natural := 0;
-- If the number is too long to fit in the buffer, we switch to an
-- approximate output format with an exponent. This variable records
-- the exponent value.
function Better_In_Hex return Boolean;
-- Determines if it is better to generate digits in base 16 (result
-- is true) or base 10 (result is false). The choice is purely a
-- matter of convenience and aesthetics, so it does not matter which
-- value is returned from a correctness point of view.
procedure Image_Char (C : Character);
-- Output one character
procedure Image_String (S : String);
-- Output characters
procedure Image_Exponent (N : Natural);
-- Output non-zero exponent. Note that we only use the exponent form in
-- the buffer case, so we know that To_Buffer is true.
procedure Image_Uint (U : Valid_Uint);
-- Internal procedure to output characters of non-negative Uint
-------------------
-- Better_In_Hex --
-------------------
function Better_In_Hex return Boolean is
T16 : constant Valid_Uint := Uint_2**Int'(16);
A : Valid_Uint;
begin
A := UI_Abs (Input);
-- Small values up to 2**16 can always be in decimal
if A < T16 then
return False;
end if;
-- Otherwise, see if we are a power of 2 or one less than a power
-- of 2. For the moment these are the only cases printed in hex.
if A mod Uint_2 = Uint_1 then
A := A + Uint_1;
end if;
loop
if A mod T16 /= Uint_0 then
return False;
else
A := A / T16;
end if;
exit when A < T16;
end loop;
while A > Uint_2 loop
if A mod Uint_2 /= Uint_0 then
return False;
else
A := A / Uint_2;
end if;
end loop;
return True;
end Better_In_Hex;
----------------
-- Image_Char --
----------------
procedure Image_Char (C : Character) is
begin
if To_Buffer then
if UI_Image_Length + 6 > UI_Image_Max then
Exponent := Exponent + 1;
else
UI_Image_Length := UI_Image_Length + 1;
UI_Image_Buffer (UI_Image_Length) := C;
end if;
else
Write_Char (C);
end if;
end Image_Char;
--------------------
-- Image_Exponent --
--------------------
procedure Image_Exponent (N : Natural) is
begin
if N >= 10 then
Image_Exponent (N / 10);
end if;
UI_Image_Length := UI_Image_Length + 1;
UI_Image_Buffer (UI_Image_Length) :=
Character'Val (Character'Pos ('0') + N mod 10);
end Image_Exponent;
------------------
-- Image_String --
------------------
procedure Image_String (S : String) is
begin
for X of S loop
Image_Char (X);
end loop;
end Image_String;
----------------
-- Image_Uint --
----------------
procedure Image_Uint (U : Valid_Uint) is
H : constant array (Int range 0 .. 15) of Character :=
"0123456789ABCDEF";
Q, R : Valid_Uint;
begin
UI_Div_Rem (U, Base, Q, R);
if Q > Uint_0 then
Image_Uint (Q);
end if;
if Digs_Output = 4 and then Base = Uint_16 then
Image_Char ('_');
Digs_Output := 0;
end if;
Image_Char (H (UI_To_Int (R)));
Digs_Output := Digs_Output + 1;
end Image_Uint;
-- Start of processing for Image_Out
begin
if No (Input) then
Image_String ("No_Uint");
return;
end if;
UI_Image_Length := 0;
if Input < Uint_0 then
Image_Char ('-');
Ainput := -Input;
else
Ainput := Input;
end if;
if Format = Hex
or else (Format = Auto and then Better_In_Hex)
then
Base := Uint_16;
Image_Char ('1');
Image_Char ('6');
Image_Char ('#');
Image_Uint (Ainput);
Image_Char ('#');
else
Base := Uint_10;
Image_Uint (Ainput);
end if;
if Exponent /= 0 then
UI_Image_Length := UI_Image_Length + 1;
UI_Image_Buffer (UI_Image_Length) := 'E';
Image_Exponent (Exponent);
end if;
Uintp.Release (Marks);
end Image_Out;
-------------------
-- Init_Operand --
-------------------
procedure Init_Operand (UI : Valid_Uint; Vec : out UI_Vector) is
Loc : Int;
pragma Assert (Vec'First = Int'(1));
begin
if Direct (UI) then
Vec (1) := Direct_Val (UI);
if Vec (1) >= Base then
Vec (2) := Vec (1) rem Base;
Vec (1) := Vec (1) / Base;
end if;
else
Loc := Uints.Table (UI).Loc;
for J in 1 .. Uints.Table (UI).Length loop
Vec (J) := Udigits.Table (Loc + J - 1);
end loop;
end if;
end Init_Operand;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Uints.Init;
Udigits.Init;
Uint_Int_First := UI_From_Int (Int'First);
Uint_Int_Last := UI_From_Int (Int'Last);
UI_Power_2 (0) := Uint_1;
UI_Power_2_Set := 0;
UI_Power_10 (0) := Uint_1;
UI_Power_10_Set := 0;
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
UI_Ints.Reset;
end Initialize;
---------------------
-- Least_Sig_Digit --
---------------------
function Least_Sig_Digit (Arg : Valid_Uint) return Int is
V : Int;
begin
if Direct (Arg) then
V := Direct_Val (Arg);
if V >= Base then
V := V mod Base;
end if;
-- Note that this result may be negative
return V;
else
return
Udigits.Table
(Uints.Table (Arg).Loc + Uints.Table (Arg).Length - 1);
end if;
end Least_Sig_Digit;
----------
-- Mark --
----------
function Mark return Save_Mark is
begin
return (Save_Uint => Uints.Last, Save_Udigit => Udigits.Last);
end Mark;
-----------------------
-- Most_Sig_2_Digits --
-----------------------
procedure Most_Sig_2_Digits
(Left : Valid_Uint;
Right : Valid_Uint;
Left_Hat : out Int;
Right_Hat : out Int)
is
begin
pragma Assert (Left >= Right);
if Direct (Left) then
pragma Assert (Direct (Right));
Left_Hat := Direct_Val (Left);
Right_Hat := Direct_Val (Right);
return;
else
declare
L1 : constant Int :=
Udigits.Table (Uints.Table (Left).Loc);
L2 : constant Int :=
Udigits.Table (Uints.Table (Left).Loc + 1);
begin
-- It is not so clear what to return when Arg is negative???
Left_Hat := abs (L1) * Base + L2;
end;
end if;
declare
Length_L : constant Int := Uints.Table (Left).Length;
Length_R : Int;
R1 : Int;
R2 : Int;
T : Int;
begin
if Direct (Right) then
T := Direct_Val (Right);
R1 := abs (T / Base);
R2 := T rem Base;
Length_R := 2;
else
R1 := abs (Udigits.Table (Uints.Table (Right).Loc));
R2 := Udigits.Table (Uints.Table (Right).Loc + 1);
Length_R := Uints.Table (Right).Length;
end if;
if Length_L = Length_R then
Right_Hat := R1 * Base + R2;
elsif Length_L = Length_R + Int_1 then
Right_Hat := R1;
else
Right_Hat := 0;
end if;
end;
end Most_Sig_2_Digits;
---------------
-- N_Digits --
---------------
function N_Digits (Input : Valid_Uint) return Int is
begin
if Direct (Input) then
if Direct_Val (Input) >= Base then
return 2;
else
return 1;
end if;
else
return Uints.Table (Input).Length;
end if;
end N_Digits;
--------------
-- Num_Bits --
--------------
function Num_Bits (Input : Valid_Uint) return Nat is
Bits : Nat;
Num : Nat;
begin
-- Largest negative number has to be handled specially, since it is in
-- Int_Range, but we cannot take the absolute value.
if Input = Uint_Int_First then
return Int'Size;
-- For any other number in Int_Range, get absolute value of number
elsif UI_Is_In_Int_Range (Input) then
Num := abs (UI_To_Int (Input));
Bits := 0;
-- If not in Int_Range then initialize bit count for all low order
-- words, and set number to high order digit.
else
Bits := Base_Bits * (Uints.Table (Input).Length - 1);
Num := abs (Udigits.Table (Uints.Table (Input).Loc));
end if;
-- Increase bit count for remaining value in Num
while Types.">" (Num, 0) loop
Num := Num / 2;
Bits := Bits + 1;
end loop;
return Bits;
end Num_Bits;
---------
-- pid --
---------
procedure pid (Input : Uint) is
begin
UI_Write (Input, Decimal);
Write_Eol;
end pid;
---------
-- pih --
---------
procedure pih (Input : Uint) is
begin
UI_Write (Input, Hex);
Write_Eol;
end pih;
-------------
-- Release --
-------------
procedure Release (M : Save_Mark) is
begin
Uints.Set_Last (Valid_Uint'Max (M.Save_Uint, Uints_Min));
Udigits.Set_Last (Int'Max (M.Save_Udigit, Udigits_Min));
end Release;
----------------------
-- Release_And_Save --
----------------------
procedure Release_And_Save (M : Save_Mark; UI : in out Valid_Uint) is
begin
if Direct (UI) then
Release (M);
else
declare
UE_Len : constant Pos := Uints.Table (UI).Length;
UE_Loc : constant Int := Uints.Table (UI).Loc;
UD : constant Udigits.Table_Type (1 .. UE_Len) :=
Udigits.Table (UE_Loc .. UE_Loc + UE_Len - 1);
begin
Release (M);
Uints.Append ((Length => UE_Len, Loc => Udigits.Last + 1));
UI := Uints.Last;
for J in 1 .. UE_Len loop
Udigits.Append (UD (J));
end loop;
end;
end if;
end Release_And_Save;
procedure Release_And_Save (M : Save_Mark; UI1, UI2 : in out Valid_Uint) is
begin
if Direct (UI1) then
Release_And_Save (M, UI2);
elsif Direct (UI2) then
Release_And_Save (M, UI1);
else
declare
UE1_Len : constant Pos := Uints.Table (UI1).Length;
UE1_Loc : constant Int := Uints.Table (UI1).Loc;
UD1 : constant Udigits.Table_Type (1 .. UE1_Len) :=
Udigits.Table (UE1_Loc .. UE1_Loc + UE1_Len - 1);
UE2_Len : constant Pos := Uints.Table (UI2).Length;
UE2_Loc : constant Int := Uints.Table (UI2).Loc;
UD2 : constant Udigits.Table_Type (1 .. UE2_Len) :=
Udigits.Table (UE2_Loc .. UE2_Loc + UE2_Len - 1);
begin
Release (M);
Uints.Append ((Length => UE1_Len, Loc => Udigits.Last + 1));
UI1 := Uints.Last;
for J in 1 .. UE1_Len loop
Udigits.Append (UD1 (J));
end loop;
Uints.Append ((Length => UE2_Len, Loc => Udigits.Last + 1));
UI2 := Uints.Last;
for J in 1 .. UE2_Len loop
Udigits.Append (UD2 (J));
end loop;
end;
end if;
end Release_And_Save;
-------------
-- UI_Abs --
-------------
function UI_Abs (Right : Valid_Uint) return Unat is
begin
if Right < Uint_0 then
return -Right;
else
return Right;
end if;
end UI_Abs;
-------------
-- UI_Add --
-------------
function UI_Add (Left : Int; Right : Valid_Uint) return Valid_Uint is
begin
return UI_Add (UI_From_Int (Left), Right);
end UI_Add;
function UI_Add (Left : Valid_Uint; Right : Int) return Valid_Uint is
begin
return UI_Add (Left, UI_From_Int (Right));
end UI_Add;
function UI_Add (Left : Valid_Uint; Right : Valid_Uint) return Valid_Uint is
begin
pragma Assert (Present (Left));
pragma Assert (Present (Right));
-- Assertions are here in case we're called from C++ code, which does
-- not check the predicates.
-- Simple cases of direct operands and addition of zero
if Direct (Left) then
if Direct (Right) then
return UI_From_Int (Direct_Val (Left) + Direct_Val (Right));
elsif Int (Left) = Int (Uint_0) then
return Right;
end if;
elsif Direct (Right) and then Int (Right) = Int (Uint_0) then
return Left;
end if;
-- Otherwise full circuit is needed
declare
L_Length : constant Int := N_Digits (Left);
R_Length : constant Int := N_Digits (Right);
L_Vec : UI_Vector (1 .. L_Length);
R_Vec : UI_Vector (1 .. R_Length);
Sum_Length : Int;
Tmp_Int : Int;
Carry : Int;
Borrow : Int;
X_Bigger : Boolean := False;
Y_Bigger : Boolean := False;
Result_Neg : Boolean := False;
begin
Init_Operand (Left, L_Vec);
Init_Operand (Right, R_Vec);
-- At least one of the two operands is in multi-digit form.
-- Calculate the number of digits sufficient to hold result.
if L_Length > R_Length then
Sum_Length := L_Length + 1;
X_Bigger := True;
else
Sum_Length := R_Length + 1;
if R_Length > L_Length then
Y_Bigger := True;
end if;
end if;
-- Make copies of the absolute values of L_Vec and R_Vec into X and Y
-- both with lengths equal to the maximum possibly needed. This makes
-- looping over the digits much simpler.
declare
X : UI_Vector (1 .. Sum_Length);
Y : UI_Vector (1 .. Sum_Length);
Tmp_UI : UI_Vector (1 .. Sum_Length);
begin
for J in 1 .. Sum_Length - L_Length loop
X (J) := 0;
end loop;
X (Sum_Length - L_Length + 1) := abs L_Vec (1);
for J in 2 .. L_Length loop
X (J + (Sum_Length - L_Length)) := L_Vec (J);
end loop;
for J in 1 .. Sum_Length - R_Length loop
Y (J) := 0;
end loop;
Y (Sum_Length - R_Length + 1) := abs R_Vec (1);
for J in 2 .. R_Length loop
Y (J + (Sum_Length - R_Length)) := R_Vec (J);
end loop;
if (L_Vec (1) < Int_0) = (R_Vec (1) < Int_0) then
-- Same sign so just add
Carry := 0;
for J in reverse 1 .. Sum_Length loop
Tmp_Int := X (J) + Y (J) + Carry;
if Tmp_Int >= Base then
Tmp_Int := Tmp_Int - Base;
Carry := 1;
else
Carry := 0;
end if;
X (J) := Tmp_Int;
end loop;
return Vector_To_Uint (X, L_Vec (1) < Int_0);
else
-- Find which one has bigger magnitude
if not (X_Bigger or Y_Bigger) then
for J in L_Vec'Range loop
if abs L_Vec (J) > abs R_Vec (J) then
X_Bigger := True;
exit;
elsif abs R_Vec (J) > abs L_Vec (J) then
Y_Bigger := True;
exit;
end if;
end loop;
end if;
-- If they have identical magnitude, just return 0, else swap
-- if necessary so that X had the bigger magnitude. Determine
-- if result is negative at this time.
Result_Neg := False;
if not (X_Bigger or Y_Bigger) then
return Uint_0;
elsif Y_Bigger then
if R_Vec (1) < Int_0 then
Result_Neg := True;
end if;
Tmp_UI := X;
X := Y;
Y := Tmp_UI;
else
if L_Vec (1) < Int_0 then
Result_Neg := True;
end if;
end if;
-- Subtract Y from the bigger X
Borrow := 0;
for J in reverse 1 .. Sum_Length loop
Tmp_Int := X (J) - Y (J) + Borrow;
if Tmp_Int < Int_0 then
Tmp_Int := Tmp_Int + Base;
Borrow := -1;
else
Borrow := 0;
end if;
X (J) := Tmp_Int;
end loop;
return Vector_To_Uint (X, Result_Neg);
end if;
end;
end;
end UI_Add;
--------------------------
-- UI_Decimal_Digits_Hi --
--------------------------
function UI_Decimal_Digits_Hi (U : Valid_Uint) return Nat is
begin
-- The maximum value of a "digit" is 32767, which is 5 decimal digits,
-- so an N_Digit number could take up to 5 times this number of digits.
-- This is certainly too high for large numbers but it is not worth
-- worrying about.
return 5 * N_Digits (U);
end UI_Decimal_Digits_Hi;
--------------------------
-- UI_Decimal_Digits_Lo --
--------------------------
function UI_Decimal_Digits_Lo (U : Valid_Uint) return Nat is
begin
-- The maximum value of a "digit" is 32767, which is more than four
-- decimal digits, but not a full five digits. The easily computed
-- minimum number of decimal digits is thus 1 + 4 * the number of
-- digits. This is certainly too low for large numbers but it is not
-- worth worrying about.
return 1 + 4 * (N_Digits (U) - 1);
end UI_Decimal_Digits_Lo;
------------
-- UI_Div --
------------
function UI_Div (Left : Int; Right : Nonzero_Uint) return Valid_Uint is
begin
return UI_Div (UI_From_Int (Left), Right);
end UI_Div;
function UI_Div
(Left : Valid_Uint; Right : Nonzero_Int) return Valid_Uint
is
begin
return UI_Div (Left, UI_From_Int (Right));
end UI_Div;
function UI_Div
(Left : Valid_Uint; Right : Nonzero_Uint) return Valid_Uint
is
Quotient : Valid_Uint;
Ignored_Remainder : Uint;
begin
UI_Div_Rem
(Left, Right,
Quotient, Ignored_Remainder,
Discard_Remainder => True);
return Quotient;
end UI_Div;
----------------
-- UI_Div_Rem --
----------------
procedure UI_Div_Rem
(Left, Right : Valid_Uint;
Quotient : out Uint;
Remainder : out Uint;
Discard_Quotient : Boolean := False;
Discard_Remainder : Boolean := False)
is
begin
pragma Assert (Right /= Uint_0);
Quotient := No_Uint;
Remainder := No_Uint;
-- Cases where both operands are represented directly
if Direct (Left) and then Direct (Right) then
declare
DV_Left : constant Int := Direct_Val (Left);
DV_Right : constant Int := Direct_Val (Right);
begin
if not Discard_Quotient then
Quotient := UI_From_Int (DV_Left / DV_Right);
end if;
if not Discard_Remainder then
Remainder := UI_From_Int (DV_Left rem DV_Right);
end if;
return;
end;
end if;
declare
L_Length : constant Int := N_Digits (Left);
R_Length : constant Int := N_Digits (Right);
Q_Length : constant Int := L_Length - R_Length + 1;
L_Vec : UI_Vector (1 .. L_Length);
R_Vec : UI_Vector (1 .. R_Length);
D : Int;
Remainder_I : Int;
Tmp_Divisor : Int;
Carry : Int;
Tmp_Int : Int;
Tmp_Dig : Int;
procedure UI_Div_Vector
(L_Vec : UI_Vector;
R_Int : Int;
Quotient : out UI_Vector;
Remainder : out Int);
pragma Inline (UI_Div_Vector);
-- Specialised variant for case where the divisor is a single digit
procedure UI_Div_Vector
(L_Vec : UI_Vector;
R_Int : Int;
Quotient : out UI_Vector;
Remainder : out Int)
is
Tmp_Int : Int;
begin
Remainder := 0;
for J in L_Vec'Range loop
Tmp_Int := Remainder * Base + abs L_Vec (J);
Quotient (Quotient'First + J - L_Vec'First) := Tmp_Int / R_Int;
Remainder := Tmp_Int rem R_Int;
end loop;
if L_Vec (L_Vec'First) < Int_0 then
Remainder := -Remainder;
end if;
end UI_Div_Vector;
-- Start of processing for UI_Div_Rem
begin
-- Result is zero if left operand is shorter than right
if L_Length < R_Length then
if not Discard_Quotient then
Quotient := Uint_0;
end if;
if not Discard_Remainder then
Remainder := Left;
end if;
return;
end if;
Init_Operand (Left, L_Vec);
Init_Operand (Right, R_Vec);
-- Case of right operand is single digit. Here we can simply divide
-- each digit of the left operand by the divisor, from most to least
-- significant, carrying the remainder to the next digit (just like
-- ordinary long division by hand).
if R_Length = Int_1 then
Tmp_Divisor := abs R_Vec (1);
declare
Quotient_V : UI_Vector (1 .. L_Length);
begin
UI_Div_Vector (L_Vec, Tmp_Divisor, Quotient_V, Remainder_I);
if not Discard_Quotient then
Quotient :=
Vector_To_Uint
(Quotient_V, (L_Vec (1) < Int_0 xor R_Vec (1) < Int_0));
end if;
if not Discard_Remainder then
Remainder := UI_From_Int (Remainder_I);
end if;
return;
end;
end if;
-- The possible simple cases have been exhausted. Now turn to the
-- algorithm D from the section of Knuth mentioned at the top of
-- this package.
Algorithm_D : declare
Dividend : UI_Vector (1 .. L_Length + 1);
Divisor : UI_Vector (1 .. R_Length);
Quotient_V : UI_Vector (1 .. Q_Length);
Divisor_Dig1 : Int;
Divisor_Dig2 : Int;
Q_Guess : Int;
R_Guess : Int;
begin
-- [ NORMALIZE ] (step D1 in the algorithm). First calculate the
-- scale d, and then multiply Left and Right (u and v in the book)
-- by d to get the dividend and divisor to work with.
D := Base / (abs R_Vec (1) + 1);
Dividend (1) := 0;
Dividend (2) := abs L_Vec (1);
for J in 3 .. L_Length + Int_1 loop
Dividend (J) := L_Vec (J - 1);
end loop;
Divisor (1) := abs R_Vec (1);
for J in Int_2 .. R_Length loop
Divisor (J) := R_Vec (J);
end loop;
if D > Int_1 then
-- Multiply Dividend by d
Carry := 0;
for J in reverse Dividend'Range loop
Tmp_Int := Dividend (J) * D + Carry;
Dividend (J) := Tmp_Int rem Base;
Carry := Tmp_Int / Base;
end loop;
-- Multiply Divisor by d
Carry := 0;
for J in reverse Divisor'Range loop
Tmp_Int := Divisor (J) * D + Carry;
Divisor (J) := Tmp_Int rem Base;
Carry := Tmp_Int / Base;
end loop;
end if;
-- Main loop of long division algorithm
Divisor_Dig1 := Divisor (1);
Divisor_Dig2 := Divisor (2);
for J in Quotient_V'Range loop
-- [ CALCULATE Q (hat) ] (step D3 in the algorithm)
-- Note: this version of step D3 is from the original published
-- algorithm, which is known to have a bug causing overflows.
-- See: http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz
-- and http://www-cs-faculty.stanford.edu/~uno/all2-pre.ps.gz.
-- The code below is the fixed version of this step.
Tmp_Int := Dividend (J) * Base + Dividend (J + 1);
-- Initial guess
Q_Guess := Tmp_Int / Divisor_Dig1;
R_Guess := Tmp_Int rem Divisor_Dig1;
-- Refine the guess
while Q_Guess >= Base
or else Divisor_Dig2 * Q_Guess >
R_Guess * Base + Dividend (J + 2)
loop
Q_Guess := Q_Guess - 1;
R_Guess := R_Guess + Divisor_Dig1;
exit when R_Guess >= Base;
end loop;
-- [ MULTIPLY & SUBTRACT ] (step D4). Q_Guess * Divisor is
-- subtracted from the remaining dividend.
Carry := 0;
for K in reverse Divisor'Range loop
Tmp_Int := Dividend (J + K) - Q_Guess * Divisor (K) + Carry;
Tmp_Dig := Tmp_Int rem Base;
Carry := Tmp_Int / Base;
if Tmp_Dig < Int_0 then
Tmp_Dig := Tmp_Dig + Base;
Carry := Carry - 1;
end if;
Dividend (J + K) := Tmp_Dig;
end loop;
Dividend (J) := Dividend (J) + Carry;
-- [ TEST REMAINDER ] & [ ADD BACK ] (steps D5 and D6)
-- Here there is a slight difference from the book: the last
-- carry is always added in above and below (cancelling each
-- other). In fact the dividend going negative is used as
-- the test.
-- If the Dividend went negative, then Q_Guess was off by
-- one, so it is decremented, and the divisor is added back
-- into the relevant portion of the dividend.
if Dividend (J) < Int_0 then
Q_Guess := Q_Guess - 1;
Carry := 0;
for K in reverse Divisor'Range loop
Tmp_Int := Dividend (J + K) + Divisor (K) + Carry;
if Tmp_Int >= Base then
Tmp_Int := Tmp_Int - Base;
Carry := 1;
else
Carry := 0;
end if;
Dividend (J + K) := Tmp_Int;
end loop;
Dividend (J) := Dividend (J) + Carry;
end if;
-- Finally we can get the next quotient digit
Quotient_V (J) := Q_Guess;
end loop;
-- [ UNNORMALIZE ] (step D8)
if not Discard_Quotient then
Quotient := Vector_To_Uint
(Quotient_V, (L_Vec (1) < Int_0 xor R_Vec (1) < Int_0));
end if;
if not Discard_Remainder then
declare
Remainder_V : UI_Vector (1 .. R_Length);
Ignore : Int;
begin
pragma Assert (D /= Int'(0));
UI_Div_Vector
(Dividend (Dividend'Last - R_Length + 1 .. Dividend'Last),
D,
Remainder_V, Ignore);
Remainder := Vector_To_Uint (Remainder_V, L_Vec (1) < Int_0);
end;
end if;
end Algorithm_D;
end;
end UI_Div_Rem;
------------
-- UI_Eq --
------------
function UI_Eq (Left : Int; Right : Valid_Uint) return Boolean is
begin
return not UI_Ne (UI_From_Int (Left), Right);
end UI_Eq;
function UI_Eq (Left : Valid_Uint; Right : Int) return Boolean is
begin
return not UI_Ne (Left, UI_From_Int (Right));
end UI_Eq;
function UI_Eq (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
return not UI_Ne (Left, Right);
end UI_Eq;
--------------
-- UI_Expon --
--------------
function UI_Expon (Left : Int; Right : Unat) return Valid_Uint is
begin
return UI_Expon (UI_From_Int (Left), Right);
end UI_Expon;
function UI_Expon (Left : Valid_Uint; Right : Nat) return Valid_Uint is
begin
return UI_Expon (Left, UI_From_Int (Right));
end UI_Expon;
function UI_Expon (Left : Int; Right : Nat) return Valid_Uint is
begin
return UI_Expon (UI_From_Int (Left), UI_From_Int (Right));
end UI_Expon;
function UI_Expon
(Left : Valid_Uint; Right : Unat) return Valid_Uint
is
begin
pragma Assert (Right >= Uint_0);
-- Any value raised to power of 0 is 1
if Right = Uint_0 then
return Uint_1;
-- 0 to any positive power is 0
elsif Left = Uint_0 then
return Uint_0;
-- 1 to any power is 1
elsif Left = Uint_1 then
return Uint_1;
-- Any value raised to power of 1 is that value
elsif Right = Uint_1 then
return Left;
-- Cases which can be done by table lookup
elsif Right <= Uint_128 then
-- 2**N for N in 2 .. 128
if Left = Uint_2 then
declare
Right_Int : constant Int := Direct_Val (Right);
begin
if Right_Int > UI_Power_2_Set then
for J in UI_Power_2_Set + Int_1 .. Right_Int loop
UI_Power_2 (J) := UI_Power_2 (J - Int_1) * Int_2;
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
end loop;
UI_Power_2_Set := Right_Int;
end if;
return UI_Power_2 (Right_Int);
end;
-- 10**N for N in 2 .. 128
elsif Left = Uint_10 then
declare
Right_Int : constant Int := Direct_Val (Right);
begin
if Right_Int > UI_Power_10_Set then
for J in UI_Power_10_Set + Int_1 .. Right_Int loop
UI_Power_10 (J) := UI_Power_10 (J - Int_1) * Int (10);
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
end loop;
UI_Power_10_Set := Right_Int;
end if;
return UI_Power_10 (Right_Int);
end;
end if;
end if;
-- If we fall through, then we have the general case (see Knuth 4.6.3)
declare
N : Valid_Uint := Right;
Squares : Valid_Uint := Left;
Result : Valid_Uint := Uint_1;
M : constant Uintp.Save_Mark := Uintp.Mark;
begin
loop
if (Least_Sig_Digit (N) mod Int_2) = Int_1 then
Result := Result * Squares;
end if;
N := N / Uint_2;
exit when N = Uint_0;
Squares := Squares * Squares;
end loop;
Uintp.Release_And_Save (M, Result);
return Result;
end;
end UI_Expon;
----------------
-- UI_From_CC --
----------------
function UI_From_CC (Input : Char_Code) return Valid_Uint is
begin
return UI_From_Int (Int (Input));
end UI_From_CC;
-----------------
-- UI_From_Int --
-----------------
function UI_From_Int (Input : Int) return Valid_Uint is
U : Uint;
begin
if Min_Direct <= Input and then Input <= Max_Direct then
return Valid_Uint (Int (Uint_Direct_Bias) + Input);
end if;
-- If already in the hash table, return entry
U := UI_Ints.Get (Input);
if Present (U) then
return U;
end if;
-- For values of larger magnitude, compute digits into a vector and call
-- Vector_To_Uint.
declare
Max_For_Int : constant := 3;
-- Base is defined so that 3 Uint digits is sufficient to hold the
-- largest possible Int value.
V : UI_Vector (1 .. Max_For_Int);
Temp_Integer : Int := Input;
begin
for J in reverse V'Range loop
V (J) := abs (Temp_Integer rem Base);
Temp_Integer := Temp_Integer / Base;
end loop;
U := Vector_To_Uint (V, Input < Int_0);
UI_Ints.Set (Input, U);
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
return U;
end;
end UI_From_Int;
----------------------
-- UI_From_Integral --
----------------------
function UI_From_Integral (Input : In_T) return Valid_Uint is
begin
-- If in range of our normal conversion function, use it so we can use
-- direct access and our cache.
if In_T'Size <= Int'Size
or else Input in In_T (Int'First) .. In_T (Int'Last)
then
return UI_From_Int (Int (Input));
else
-- For values of larger magnitude, compute digits into a vector and
-- call Vector_To_Uint.
declare
Max_For_In_T : constant Int := 3 * In_T'Size / Int'Size;
Our_Base : constant In_T := In_T (Base);
Temp_Integer : In_T := Input;
-- Base is defined so that 3 Uint digits is sufficient to hold the
-- largest possible Int value.
U : Valid_Uint;
V : UI_Vector (1 .. Max_For_In_T);
begin
for J in reverse V'Range loop
V (J) := Int (abs (Temp_Integer rem Our_Base));
Temp_Integer := Temp_Integer / Our_Base;
end loop;
U := Vector_To_Uint (V, Input < 0);
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
return U;
end;
end if;
end UI_From_Integral;
------------
-- UI_GCD --
------------
-- Lehmer's algorithm for GCD
-- The idea is to avoid using multiple precision arithmetic wherever
-- possible, substituting Int arithmetic instead. See Knuth volume II,
-- Algorithm L (page 329).
-- We use the same notation as Knuth (U_Hat standing for the obvious)
function UI_GCD (Uin, Vin : Valid_Uint) return Valid_Uint is
U, V : Valid_Uint;
-- Copies of Uin and Vin
U_Hat, V_Hat : Int;
-- The most Significant digits of U,V
A, B, C, D, T, Q, Den1, Den2 : Int;
Tmp_UI : Valid_Uint;
Marks : constant Uintp.Save_Mark := Uintp.Mark;
Iterations : Integer := 0;
begin
pragma Assert (Uin >= Vin);
pragma Assert (Vin >= Uint_0);
U := Uin;
V := Vin;
loop
Iterations := Iterations + 1;
if Direct (V) then
if V = Uint_0 then
return U;
else
return
UI_From_Int (GCD (Direct_Val (V), UI_To_Int (U rem V)));
end if;
end if;
Most_Sig_2_Digits (U, V, U_Hat, V_Hat);
A := 1;
B := 0;
C := 0;
D := 1;
loop
-- We might overflow and get division by zero here. This just
-- means we cannot take the single precision step
Den1 := V_Hat + C;
Den2 := V_Hat + D;
exit when Den1 = Int_0 or else Den2 = Int_0;
-- Compute Q, the trial quotient
Q := (U_Hat + A) / Den1;
exit when Q /= ((U_Hat + B) / Den2);
-- A single precision step Euclid step will give same answer as a
-- multiprecision one.
T := A - (Q * C);
A := C;
C := T;
T := B - (Q * D);
B := D;
D := T;
T := U_Hat - (Q * V_Hat);
U_Hat := V_Hat;
V_Hat := T;
end loop;
-- Take a multiprecision Euclid step
if B = Int_0 then
-- No single precision steps take a regular Euclid step
Tmp_UI := U rem V;
U := V;
V := Tmp_UI;
else
-- Use prior single precision steps to compute this Euclid step
Tmp_UI := (UI_From_Int (A) * U) + (UI_From_Int (B) * V);
V := (UI_From_Int (C) * U) + (UI_From_Int (D) * V);
U := Tmp_UI;
end if;
-- If the operands are very different in magnitude, the loop will
-- generate large amounts of short-lived data, which it is worth
-- removing periodically.
if Iterations > 100 then
Release_And_Save (Marks, U, V);
Iterations := 0;
end if;
end loop;
end UI_GCD;
------------
-- UI_Ge --
------------
function UI_Ge (Left : Int; Right : Valid_Uint) return Boolean is
begin
return not UI_Lt (UI_From_Int (Left), Right);
end UI_Ge;
function UI_Ge (Left : Valid_Uint; Right : Int) return Boolean is
begin
return not UI_Lt (Left, UI_From_Int (Right));
end UI_Ge;
function UI_Ge (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
return not UI_Lt (Left, Right);
end UI_Ge;
------------
-- UI_Gt --
------------
function UI_Gt (Left : Int; Right : Valid_Uint) return Boolean is
begin
return UI_Lt (Right, UI_From_Int (Left));
end UI_Gt;
function UI_Gt (Left : Valid_Uint; Right : Int) return Boolean is
begin
return UI_Lt (UI_From_Int (Right), Left);
end UI_Gt;
function UI_Gt (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
return UI_Lt (Left => Right, Right => Left);
end UI_Gt;
---------------
-- UI_Image --
---------------
procedure UI_Image (Input : Uint; Format : UI_Format := Auto) is
begin
Image_Out (Input, True, Format);
end UI_Image;
function UI_Image
(Input : Uint;
Format : UI_Format := Auto) return String
is
begin
Image_Out (Input, True, Format);
return UI_Image_Buffer (1 .. UI_Image_Length);
end UI_Image;
-------------------------
-- UI_Is_In_Int_Range --
-------------------------
function UI_Is_In_Int_Range (Input : Valid_Uint) return Boolean is
pragma Assert (Present (Input));
-- Assertion is here in case we're called from C++ code, which does
-- not check the predicates.
begin
-- Make sure we don't get called before Initialize
pragma Assert (Uint_Int_First /= Uint_0);
if Direct (Input) then
return True;
else
return Input >= Uint_Int_First and then Input <= Uint_Int_Last;
end if;
end UI_Is_In_Int_Range;
------------
-- UI_Le --
------------
function UI_Le (Left : Int; Right : Valid_Uint) return Boolean is
begin
return not UI_Lt (Right, UI_From_Int (Left));
end UI_Le;
function UI_Le (Left : Valid_Uint; Right : Int) return Boolean is
begin
return not UI_Lt (UI_From_Int (Right), Left);
end UI_Le;
function UI_Le (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
return not UI_Lt (Left => Right, Right => Left);
end UI_Le;
------------
-- UI_Lt --
------------
function UI_Lt (Left : Int; Right : Valid_Uint) return Boolean is
begin
return UI_Lt (UI_From_Int (Left), Right);
end UI_Lt;
function UI_Lt (Left : Valid_Uint; Right : Int) return Boolean is
begin
return UI_Lt (Left, UI_From_Int (Right));
end UI_Lt;
function UI_Lt (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
pragma Assert (Present (Left));
pragma Assert (Present (Right));
-- Assertions are here in case we're called from C++ code, which does
-- not check the predicates.
-- Quick processing for identical arguments
if Int (Left) = Int (Right) then
return False;
-- Quick processing for both arguments directly represented
elsif Direct (Left) and then Direct (Right) then
return Int (Left) < Int (Right);
-- At least one argument is more than one digit long
else
declare
L_Length : constant Int := N_Digits (Left);
R_Length : constant Int := N_Digits (Right);
L_Vec : UI_Vector (1 .. L_Length);
R_Vec : UI_Vector (1 .. R_Length);
begin
Init_Operand (Left, L_Vec);
Init_Operand (Right, R_Vec);
if L_Vec (1) < Int_0 then
-- First argument negative, second argument non-negative
if R_Vec (1) >= Int_0 then
return True;
-- Both arguments negative
else
if L_Length /= R_Length then
return L_Length > R_Length;
elsif L_Vec (1) /= R_Vec (1) then
return L_Vec (1) < R_Vec (1);
else
for J in 2 .. L_Vec'Last loop
if L_Vec (J) /= R_Vec (J) then
return L_Vec (J) > R_Vec (J);
end if;
end loop;
return False;
end if;
end if;
else
-- First argument non-negative, second argument negative
if R_Vec (1) < Int_0 then
return False;
-- Both arguments non-negative
else
if L_Length /= R_Length then
return L_Length < R_Length;
else
for J in L_Vec'Range loop
if L_Vec (J) /= R_Vec (J) then
return L_Vec (J) < R_Vec (J);
end if;
end loop;
return False;
end if;
end if;
end if;
end;
end if;
end UI_Lt;
------------
-- UI_Max --
------------
function UI_Max (Left : Int; Right : Valid_Uint) return Valid_Uint is
begin
return UI_Max (UI_From_Int (Left), Right);
end UI_Max;
function UI_Max (Left : Valid_Uint; Right : Int) return Valid_Uint is
begin
return UI_Max (Left, UI_From_Int (Right));
end UI_Max;
function UI_Max (Left : Valid_Uint; Right : Valid_Uint) return Valid_Uint is
begin
if Left >= Right then
return Left;
else
return Right;
end if;
end UI_Max;
------------
-- UI_Min --
------------
function UI_Min (Left : Int; Right : Valid_Uint) return Valid_Uint is
begin
return UI_Min (UI_From_Int (Left), Right);
end UI_Min;
function UI_Min (Left : Valid_Uint; Right : Int) return Valid_Uint is
begin
return UI_Min (Left, UI_From_Int (Right));
end UI_Min;
function UI_Min (Left : Valid_Uint; Right : Valid_Uint) return Valid_Uint is
begin
if Left <= Right then
return Left;
else
return Right;
end if;
end UI_Min;
-------------
-- UI_Mod --
-------------
function UI_Mod (Left : Int; Right : Nonzero_Uint) return Valid_Uint is
begin
return UI_Mod (UI_From_Int (Left), Right);
end UI_Mod;
function UI_Mod
(Left : Valid_Uint; Right : Nonzero_Int) return Valid_Uint
is
begin
return UI_Mod (Left, UI_From_Int (Right));
end UI_Mod;
function UI_Mod
(Left : Valid_Uint; Right : Nonzero_Uint) return Valid_Uint
is
Urem : constant Valid_Uint := Left rem Right;
begin
if (Left < Uint_0) = (Right < Uint_0)
or else Urem = Uint_0
then
return Urem;
else
return Right + Urem;
end if;
end UI_Mod;
-------------------------------
-- UI_Modular_Exponentiation --
-------------------------------
function UI_Modular_Exponentiation
(B : Valid_Uint;
E : Valid_Uint;
Modulo : Valid_Uint) return Valid_Uint
is
M : constant Save_Mark := Mark;
Result : Valid_Uint := Uint_1;
Base : Valid_Uint := B;
Exponent : Valid_Uint := E;
begin
while Exponent /= Uint_0 loop
if Least_Sig_Digit (Exponent) rem Int'(2) = Int'(1) then
Result := (Result * Base) rem Modulo;
end if;
Exponent := Exponent / Uint_2;
Base := (Base * Base) rem Modulo;
end loop;
Release_And_Save (M, Result);
return Result;
end UI_Modular_Exponentiation;
------------------------
-- UI_Modular_Inverse --
------------------------
function UI_Modular_Inverse
(N : Valid_Uint; Modulo : Valid_Uint) return Valid_Uint
is
M : constant Save_Mark := Mark;
U : Valid_Uint;
V : Valid_Uint;
Q : Valid_Uint;
R : Valid_Uint;
X : Valid_Uint;
Y : Valid_Uint;
T : Valid_Uint;
S : Int := 1;
begin
U := Modulo;
V := N;
X := Uint_1;
Y := Uint_0;
loop
UI_Div_Rem (U, V, Quotient => Q, Remainder => R);
U := V;
V := R;
T := X;
X := Y + Q * X;
Y := T;
S := -S;
exit when R = Uint_1;
end loop;
if S = Int'(-1) then
X := Modulo - X;
end if;
Release_And_Save (M, X);
return X;
end UI_Modular_Inverse;
------------
-- UI_Mul --
------------
function UI_Mul (Left : Int; Right : Valid_Uint) return Valid_Uint is
begin
return UI_Mul (UI_From_Int (Left), Right);
end UI_Mul;
function UI_Mul (Left : Valid_Uint; Right : Int) return Valid_Uint is
begin
return UI_Mul (Left, UI_From_Int (Right));
end UI_Mul;
function UI_Mul (Left : Valid_Uint; Right : Valid_Uint) return Valid_Uint is
begin
-- Case where product fits in the range of a 32-bit integer
if Int (Left) <= Int (Uint_Max_Simple_Mul)
and then
Int (Right) <= Int (Uint_Max_Simple_Mul)
then
return UI_From_Int (Direct_Val (Left) * Direct_Val (Right));
end if;
-- Otherwise we have the general case (Algorithm M in Knuth)
declare
L_Length : constant Int := N_Digits (Left);
R_Length : constant Int := N_Digits (Right);
L_Vec : UI_Vector (1 .. L_Length);
R_Vec : UI_Vector (1 .. R_Length);
Neg : Boolean;
begin
Init_Operand (Left, L_Vec);
Init_Operand (Right, R_Vec);
Neg := (L_Vec (1) < Int_0) xor (R_Vec (1) < Int_0);
L_Vec (1) := abs (L_Vec (1));
R_Vec (1) := abs (R_Vec (1));
Algorithm_M : declare
Product : UI_Vector (1 .. L_Length + R_Length);
Tmp_Sum : Int;
Carry : Int;
begin
for J in Product'Range loop
Product (J) := 0;
end loop;
for J in reverse R_Vec'Range loop
Carry := 0;
for K in reverse L_Vec'Range loop
Tmp_Sum :=
L_Vec (K) * R_Vec (J) + Product (J + K) + Carry;
Product (J + K) := Tmp_Sum rem Base;
Carry := Tmp_Sum / Base;
end loop;
Product (J) := Carry;
end loop;
return Vector_To_Uint (Product, Neg);
end Algorithm_M;
end;
end UI_Mul;
------------
-- UI_Ne --
------------
function UI_Ne (Left : Int; Right : Valid_Uint) return Boolean is
begin
return UI_Ne (UI_From_Int (Left), Right);
end UI_Ne;
function UI_Ne (Left : Valid_Uint; Right : Int) return Boolean is
begin
return UI_Ne (Left, UI_From_Int (Right));
end UI_Ne;
function UI_Ne (Left : Valid_Uint; Right : Valid_Uint) return Boolean is
begin
pragma Assert (Present (Left));
pragma Assert (Present (Right));
-- Assertions are here in case we're called from C++ code, which does
-- not check the predicates.
-- Quick processing for identical arguments
if Int (Left) = Int (Right) then
return False;
end if;
-- See if left operand directly represented
if Direct (Left) then
-- If right operand directly represented then compare
if Direct (Right) then
return Int (Left) /= Int (Right);
-- Left operand directly represented, right not, must be unequal
else
return True;
end if;
-- Right operand directly represented, left not, must be unequal
elsif Direct (Right) then
return True;
end if;
-- Otherwise both multi-word, do comparison
declare
Size : constant Int := N_Digits (Left);
Left_Loc : Int;
Right_Loc : Int;
begin
if Size /= N_Digits (Right) then
return True;
end if;
Left_Loc := Uints.Table (Left).Loc;
Right_Loc := Uints.Table (Right).Loc;
for J in Int_0 .. Size - Int_1 loop
if Udigits.Table (Left_Loc + J) /=
Udigits.Table (Right_Loc + J)
then
return True;
end if;
end loop;
return False;
end;
end UI_Ne;
----------------
-- UI_Negate --
----------------
function UI_Negate (Right : Valid_Uint) return Valid_Uint is
begin
-- Case where input is directly represented. Note that since the range
-- of Direct values is non-symmetrical, the result may not be directly
-- represented, this is taken care of in UI_From_Int.
if Direct (Right) then
return UI_From_Int (-Direct_Val (Right));
-- Full processing for multi-digit case. Note that we cannot just copy
-- the value to the end of the table negating the first digit, since the
-- range of Direct values is non-symmetrical, so we can have a negative
-- value that is not Direct whose negation can be represented directly.
else
declare
R_Length : constant Int := N_Digits (Right);
R_Vec : UI_Vector (1 .. R_Length);
Neg : Boolean;
begin
Init_Operand (Right, R_Vec);
Neg := R_Vec (1) > Int_0;
R_Vec (1) := abs R_Vec (1);
return Vector_To_Uint (R_Vec, Neg);
end;
end if;
end UI_Negate;
-------------
-- UI_Rem --
-------------
function UI_Rem (Left : Int; Right : Nonzero_Uint) return Valid_Uint is
begin
return UI_Rem (UI_From_Int (Left), Right);
end UI_Rem;
function UI_Rem
(Left : Valid_Uint; Right : Nonzero_Int) return Valid_Uint
is
begin
return UI_Rem (Left, UI_From_Int (Right));
end UI_Rem;
function UI_Rem
(Left : Valid_Uint; Right : Nonzero_Uint) return Valid_Uint
is
Remainder : Valid_Uint;
Ignored_Quotient : Uint;
begin
pragma Assert (Right /= Uint_0);
if Direct (Right) and then Direct (Left) then
return UI_From_Int (Direct_Val (Left) rem Direct_Val (Right));
else
UI_Div_Rem
(Left, Right, Ignored_Quotient, Remainder,
Discard_Quotient => True);
return Remainder;
end if;
end UI_Rem;
------------
-- UI_Sub --
------------
function UI_Sub (Left : Int; Right : Valid_Uint) return Valid_Uint is
begin
return UI_Add (Left, -Right);
end UI_Sub;
function UI_Sub (Left : Valid_Uint; Right : Int) return Valid_Uint is
begin
return UI_Add (Left, -Right);
end UI_Sub;
function UI_Sub (Left : Valid_Uint; Right : Valid_Uint) return Valid_Uint is
begin
if Direct (Left) and then Direct (Right) then
return UI_From_Int (Direct_Val (Left) - Direct_Val (Right));
else
return UI_Add (Left, -Right);
end if;
end UI_Sub;
--------------
-- UI_To_CC --
--------------
function UI_To_CC (Input : Valid_Uint) return Char_Code is
begin
if Direct (Input) then
return Char_Code (Direct_Val (Input));
-- Case of input is more than one digit
else
declare
In_Length : constant Int := N_Digits (Input);
In_Vec : UI_Vector (1 .. In_Length);
Ret_CC : Char_Code;
begin
Init_Operand (Input, In_Vec);
-- We assume value is positive
Ret_CC := 0;
for Idx in In_Vec'Range loop
Ret_CC := Ret_CC * Char_Code (Base) +
Char_Code (abs In_Vec (Idx));
end loop;
return Ret_CC;
end;
end if;
end UI_To_CC;
---------------
-- UI_To_Int --
---------------
function UI_To_Int (Input : Valid_Uint) return Int is
begin
if Direct (Input) then
return Direct_Val (Input);
-- Case of input is more than one digit
else
declare
In_Length : constant Int := N_Digits (Input);
In_Vec : UI_Vector (1 .. In_Length);
Ret_Int : Int;
begin
-- Uints of more than one digit could be outside the range for
-- Ints. Caller should have checked for this if not certain.
-- Constraint_Error to attempt to convert from value outside
-- Int'Range.
if not UI_Is_In_Int_Range (Input) then
raise Constraint_Error;
end if;
-- Otherwise, proceed ahead, we are OK
Init_Operand (Input, In_Vec);
Ret_Int := 0;
-- Calculate -|Input| and then negates if value is positive. This
-- handles our current definition of Int (based on 2s complement).
-- Is it secure enough???
for Idx in In_Vec'Range loop
Ret_Int := Ret_Int * Base - abs In_Vec (Idx);
end loop;
if In_Vec (1) < Int_0 then
return Ret_Int;
else
return -Ret_Int;
end if;
end;
end if;
end UI_To_Int;
-----------------
-- UI_To_Uns64 --
-----------------
function UI_To_Unsigned_64 (Input : Valid_Uint) return Unsigned_64 is
begin
if Input < Uint_0 then
raise Constraint_Error;
end if;
if Direct (Input) then
return Unsigned_64 (Direct_Val (Input));
-- Case of input is more than one digit
else
if Input >= Uint_2**Int'(64) then
raise Constraint_Error;
end if;
declare
In_Length : constant Int := N_Digits (Input);
In_Vec : UI_Vector (1 .. In_Length);
Ret_Int : Unsigned_64 := 0;
begin
Init_Operand (Input, In_Vec);
for Idx in In_Vec'Range loop
Ret_Int :=
Ret_Int * Unsigned_64 (Base) + Unsigned_64 (In_Vec (Idx));
end loop;
return Ret_Int;
end;
end if;
end UI_To_Unsigned_64;
--------------
-- UI_Write --
--------------
procedure UI_Write (Input : Uint; Format : UI_Format := Auto) is
begin
Image_Out (Input, False, Format);
end UI_Write;
---------------------
-- Vector_To_Uint --
---------------------
function Vector_To_Uint
(In_Vec : UI_Vector;
Negative : Boolean) return Valid_Uint
is
Size : Int;
Val : Int;
begin
-- The vector can contain leading zeros. These are not stored in the
-- table, so loop through the vector looking for first non-zero digit
for J in In_Vec'Range loop
if In_Vec (J) /= Int_0 then
-- The length of the value is the length of the rest of the vector
Size := In_Vec'Last - J + 1;
-- One digit value can always be represented directly
if Size = Int_1 then
if Negative then
return Valid_Uint (Int (Uint_Direct_Bias) - In_Vec (J));
else
return Valid_Uint (Int (Uint_Direct_Bias) + In_Vec (J));
end if;
-- Positive two digit values may be in direct representation range
elsif Size = Int_2 and then not Negative then
Val := In_Vec (J) * Base + In_Vec (J + 1);
if Val <= Max_Direct then
return Valid_Uint (Int (Uint_Direct_Bias) + Val);
end if;
end if;
-- The value is outside the direct representation range and must
-- therefore be stored in the table. Expand the table to contain
-- the count and digits. The index of the new table entry will be
-- returned as the result.
Uints.Append ((Length => Size, Loc => Udigits.Last + 1));
if Negative then
Val := -In_Vec (J);
else
Val := +In_Vec (J);
end if;
Udigits.Append (Val);
for K in 2 .. Size loop
Udigits.Append (In_Vec (J + K - 1));
end loop;
return Uints.Last;
end if;
end loop;
-- Dropped through loop only if vector contained all zeros
return Uint_0;
end Vector_To_Uint;
end Uintp;
|
AdaCore/Ada_Drivers_Library | Ada | 2,022 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Architecture : constant String := "ARM"; -- From board definition
Board : constant String := "NRF52_DK"; -- From command line
Boot_Memory : constant String := "flash"; -- From default value
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
Device_Family : constant String := "nRF52"; -- From board definition
Device_Name : constant String := "nRF52832xxAA"; -- From board definition
Has_Custom_Memory_Area_1 : constant Boolean := False; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "False"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition
Has_ZFP_Runtime : constant String := "True"; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 128; -- From MCU definition
Runtime_Name : constant String := "light-cortex-m4f"; -- From default value
Runtime_Name_Suffix : constant String := "cortex-m4f"; -- From board definition
Runtime_Profile : constant String := "light"; -- From command line
Use_Startup_Gen : constant Boolean := True; -- From command line
Vendor : constant String := "Nordic"; -- From board definition
end ADL_Config;
|
reznikmm/matreshka | Ada | 3,609 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.CMOF.Classifiers.Hash is
new AMF.Elements.Generic_Hash (CMOF_Classifier, CMOF_Classifier_Access);
|
optikos/oasis | Ada | 5,179 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Identifiers;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Simple_Expression_Ranges;
with Program.Elements.Component_Clauses;
with Program.Element_Visitors;
package Program.Nodes.Component_Clauses is
pragma Preelaborate;
type Component_Clause is
new Program.Nodes.Node
and Program.Elements.Component_Clauses.Component_Clause
and Program.Elements.Component_Clauses.Component_Clause_Text
with private;
function Create
(Clause_Name : not null Program.Elements.Identifiers.Identifier_Access;
At_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Position : not null Program.Elements.Expressions.Expression_Access;
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Clause_Range : not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Component_Clause;
type Implicit_Component_Clause is
new Program.Nodes.Node
and Program.Elements.Component_Clauses.Component_Clause
with private;
function Create
(Clause_Name : not null Program.Elements.Identifiers
.Identifier_Access;
Position : not null Program.Elements.Expressions
.Expression_Access;
Clause_Range : not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Component_Clause
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Component_Clause is
abstract new Program.Nodes.Node
and Program.Elements.Component_Clauses.Component_Clause
with record
Clause_Name : not null Program.Elements.Identifiers.Identifier_Access;
Position : not null Program.Elements.Expressions.Expression_Access;
Clause_Range : not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access;
end record;
procedure Initialize (Self : aliased in out Base_Component_Clause'Class);
overriding procedure Visit
(Self : not null access Base_Component_Clause;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Clause_Name
(Self : Base_Component_Clause)
return not null Program.Elements.Identifiers.Identifier_Access;
overriding function Position
(Self : Base_Component_Clause)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Clause_Range
(Self : Base_Component_Clause)
return not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access;
overriding function Is_Component_Clause_Element
(Self : Base_Component_Clause)
return Boolean;
overriding function Is_Clause_Element
(Self : Base_Component_Clause)
return Boolean;
type Component_Clause is
new Base_Component_Clause
and Program.Elements.Component_Clauses.Component_Clause_Text
with record
At_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Component_Clause_Text
(Self : aliased in out Component_Clause)
return Program.Elements.Component_Clauses.Component_Clause_Text_Access;
overriding function At_Token
(Self : Component_Clause)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Range_Token
(Self : Component_Clause)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Component_Clause)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Component_Clause is
new Base_Component_Clause
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Component_Clause_Text
(Self : aliased in out Implicit_Component_Clause)
return Program.Elements.Component_Clauses.Component_Clause_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Component_Clause)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Component_Clause)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Component_Clause)
return Boolean;
end Program.Nodes.Component_Clauses;
|
zhmu/ananas | Ada | 9,096 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S H A R E D _ S T O R A G E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package manages the shared/persistent storage required for
-- full implementation of variables in Shared_Passive packages, more
-- precisely variables whose enclosing dynamic scope is a shared
-- passive package. This implementation is specific to GNAT and GLADE
-- provides a more general implementation not dedicated to file
-- storage.
-- --------------------------
-- -- Shared Storage Model --
-- --------------------------
-- The basic model used is that each partition that references the
-- Shared_Passive package has a local copy of the package data that
-- is initialized in accordance with the declarations of the package
-- in the normal manner. The routines in System.Shared_Storage are
-- then used to ensure that the values in these separate copies are
-- properly synchronized with the state of the overall system.
-- In the GNAT implementation, this synchronization is ensured by
-- maintaining a set of files, in a designated directory. The
-- directory is designated by setting the environment variable
-- SHARED_MEMORY_DIRECTORY. This variable must be set for all
-- partitions. If the environment variable is not defined, then the
-- current directory is used.
-- There is one storage for each variable. The name is the fully
-- qualified name of the variable with all letters forced to lower
-- case. For example, the variable Var in the shared passive package
-- Pkg results in the storage name pkg.var.
-- If the storage does not exist, it indicates that no partition has
-- assigned a new value, so that the initial value is the correct
-- one. This is the critical component of the model. It means that
-- there is no system-wide synchronization required for initializing
-- the package, since the shared storages need not (and do not)
-- reflect the initial state. There is therefore no issue of
-- synchronizing initialization and read/write access.
-- -----------------------
-- -- Read/Write Access --
-- -----------------------
-- The approach is as follows:
-- For each shared variable, var, an instantiation of the below generic
-- package is created which provides Read and Write supporting procedures.
-- The routine Read in package System.Shared_Storage.Shared_Var_Procs
-- ensures to assign variable V to the last written value among processes
-- referencing it. A call to this procedure is generated by the expander
-- before each read access to the shared variable.
-- The routine Write in package System.Shared_Storage.Shared_Var_Proc
-- set a new value to the shared variable and, according to the used
-- implementation, propagate this value among processes referencing it.
-- A call to this procedure is generated by the expander after each
-- assignment of the shared variable.
-- Note: a special circuit allows the use of stream attributes Read and
-- Write for limited types (using the corresponding attribute for the
-- full type), but there are limitations on the data that can be placed
-- in shared passive partitions. See sem_smem.ads/adb for details.
-- ----------------------------------------------------------------
-- -- Handling of Protected Objects in Shared Passive Partitions --
-- ----------------------------------------------------------------
-- In the context of GNAT, during the execution of a protected
-- subprogram call, access is locked out using a locking mechanism
-- per protected object, as provided by the GNAT.Lock_Files
-- capability in the specific case of GNAT. This package contains the
-- lock and unlock calls, and the expander generates a call to the
-- lock routine before the protected call and a call to the unlock
-- routine after the protected call.
-- Within the code of the protected subprogram, the access to the
-- protected object itself uses the local copy, without any special
-- synchronization. Since global access is locked out, no other task
-- or partition can attempt to read or write this data as long as the
-- lock is held.
-- The data in the local copy does however need synchronizing with
-- the global values in the shared storage. This is achieved as
-- follows:
-- The protected object generates a read and assignment routine as
-- described for other shared passive variables. The code for the
-- 'Read and 'Write attributes (not normally allowed, but allowed
-- in this special case) simply reads or writes the values of the
-- components in the protected record.
-- The lock call is followed by a call to the shared read routine to
-- synchronize the local copy to contain the proper global value.
-- The unlock call in the procedure case only is preceded by a call
-- to the shared assign routine to synchronize the global shared
-- storages with the (possibly modified) local copy.
-- These calls to the read and assign routines, as well as the lock
-- and unlock routines, are inserted by the expander (see exp_smem.adb).
package System.Shared_Storage is
procedure Shared_Var_Lock (Var : String);
-- This procedure claims the shared storage lock. It is used for
-- protected types in shared passive packages. A call to this
-- locking routine is generated as the first operation in the code
-- for the body of a protected subprogram, and it busy waits if
-- the lock is busy.
procedure Shared_Var_Unlock (Var : String);
-- This procedure releases the shared storage lock obtained by a
-- prior call to the Shared_Var_Lock procedure, and is to be
-- generated as the last operation in the body of a protected
-- subprogram.
-- This generic package is instantiated for each shared passive
-- variable. It provides supporting procedures called upon each
-- read or write access by the expanded code.
generic
type Typ is limited private;
-- Shared passive variable type
V : in out Typ;
-- Shared passive variable
Full_Name : String;
-- Shared passive variable storage name
package Shared_Var_Procs is
procedure Read;
-- Shared passive variable access routine. Each reference to the
-- shared variable, V, is preceded by a call to the corresponding
-- Read procedure, which either leaves the initial value unchanged
-- if the storage does not exist, or reads the current value from
-- the shared storage.
procedure Write;
-- Shared passive variable assignment routine. Each assignment to
-- the shared variable, V, is followed by a call to the corresponding
-- Write procedure, which writes the new value to the shared storage.
end Shared_Var_Procs;
end System.Shared_Storage;
|
zhmu/ananas | Ada | 474 | adb | -- { dg-do run }
with Ada.Text_IO; use Ada.Text_IO;
with System; use System;
procedure Equal9 is
Val : Address := Null_Address;
begin
if Val = Null_Address then
Put_Line ("= OK");
else
raise Program_Error;
end if;
if Val /= Null_Address then
raise Program_Error;
else
Put_Line ("/= OK");
end if;
if not (Val = Null_Address) then
raise Program_Error;
else
Put_Line ("not = OK");
end if;
end Equal9;
|
Gabriel-Degret/adalib | Ada | 794 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.IO_Exceptions is
pragma Pure (IO_Exceptions);
Status_Error : exception;
Mode_Error : exception;
Name_Error : exception;
Use_Error : exception;
Device_Error : exception;
End_Error : exception;
Data_Error : exception;
Layout_Error : exception;
end Ada.IO_Exceptions;
|
zhmu/ananas | Ada | 2,321 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T M A K E --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Gnatmake usage: please consult the gnat documentation
with Gnatvsn;
with Make;
procedure Gnatmake is
pragma Ident (Gnatvsn.Gnat_Static_Version_String);
begin
-- The real work is done in Package Make. Gnatmake used to be a standalone
-- routine. Now Gnatmake's facilities have been placed in a package
-- because a number of gnatmake's services may be useful to others.
Make.Gnatmake;
end Gnatmake;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.