content stringlengths 23 1.05M |
|---|
package body Ada_Lapack.Extras is
function MatrixDeterm (Source : Real_Matrix) return Real
is
matrix : Real_Matrix := source;
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
pivots : Integer_Vector (1..matrix_rows);
determ : Real;
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "MatrixDeterm: source matrix must be square";
end if;
GETRF ( A => matrix,
M => matrix_rows,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
INFO => return_code );
determ := 1.0e0;
for i in 1..matrix_rows loop
determ := determ * matrix(i,i);
if pivots(i) /= i then
determ := -determ;
end if;
end loop;
return determ;
end MatrixDeterm;
function MatrixDeterm (Source : Complex_Matrix) return Complex
is
matrix : Complex_Matrix := source;
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
pivots : Integer_Vector (1..matrix_rows);
determ : Complex;
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "MatrixDeterm: source matrix must be square";
end if;
GETRF ( A => matrix,
M => matrix_rows,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
INFO => return_code );
determ := Complex'(1.0e0,0.0e0);
for i in 1..matrix_rows loop
determ := determ * matrix(i,i);
if pivots(i) /= i then
determ := -determ;
end if;
end loop;
return determ;
end MatrixDeterm;
function Eigenvalues (Source : Real_Matrix) return Complex_Vector is
matrix : Real_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := matrix_rows;
dummy_Matrix_rows : Integer := matrix_rows;
dummy_Matrix : Real_Matrix (1 .. dummy_Matrix_rows, 1 .. dummy_Matrix_rows);
short_vector : Real_Vector (1 .. 1);
real_eigenvalues : Real_Vector (1 .. eigenvalues_rows);
imag_eigenvalues : Real_Vector (1 .. eigenvalues_rows);
eigenvalues : Complex_Vector (1 .. eigenvalues_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[Eigenvalues] source matrix must be square";
end if;
GEEV
(JOBVL => 'N',
JOBVR => 'N',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
WR => real_eigenvalues,
WI => imag_eigenvalues,
VL => dummy_Matrix,
VR => dummy_Matrix,
LDVL => dummy_Matrix_rows,
LDVR => dummy_Matrix_rows,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1));
work_vector : Real_Vector (1 .. work_vector_rows);
begin
GEEV
(JOBVL => 'N',
JOBVR => 'N',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
WR => real_eigenvalues,
WI => imag_eigenvalues,
VL => dummy_Matrix,
VR => dummy_Matrix,
LDVL => dummy_Matrix_rows,
LDVR => dummy_Matrix_rows,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[Eigenvalues] failed to find all eigenvalues";
end if;
for i in 1 .. eigenvalues_rows loop
eigenvalues (i) := Complex'(real_eigenvalues (i), imag_eigenvalues (i));
end loop;
end;
return eigenvalues;
end Eigenvalues;
function Eigenvalues (Source : Complex_Matrix) return Complex_Vector is
matrix : Complex_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := matrix_rows;
dummy_Matrix_rows : Integer := matrix_rows;
dummy_Matrix : Complex_Matrix (1 .. dummy_Matrix_rows, 1 .. dummy_Matrix_rows);
short_vector : Complex_Vector (1 .. 1);
temp_vector : Real_Vector (1 .. 2 * matrix_rows);
eigenvalues : Complex_Vector (1 .. eigenvalues_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[Eigenvalues] source matrix must be square";
end if;
GEEV
(JOBVL => 'N',
JOBVR => 'N',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
W => eigenvalues,
VL => dummy_Matrix,
VR => dummy_Matrix,
LDVL => dummy_Matrix_rows,
LDVR => dummy_Matrix_rows,
WORK => short_vector,
LWORK => -1,
RWORK => temp_vector,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1).Re);
work_vector : Complex_Vector (1 .. work_vector_rows);
begin
GEEV
(JOBVL => 'N',
JOBVR => 'N',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => eigenvalues,
VL => dummy_Matrix,
VR => dummy_Matrix,
LDVL => dummy_Matrix_rows,
LDVR => dummy_Matrix_rows,
WORK => work_vector,
LWORK => work_vector_rows,
RWORK => temp_vector,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[Eigenvalues] failed to find all eigenvalues";
end if;
end;
return eigenvalues;
end Eigenvalues;
function EigenvaluesRealSymm (Source : Real_Matrix) return Real_Vector is
matrix : Real_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := matrix_rows;
eigenvalues : Real_Vector (1 .. eigenvalues_rows);
short_vector : Real_Vector (1 .. 1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[EigenvaluesRealSymm] source matrix must be square";
end if;
SYEV
(JOBZ => 'N',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => eigenvalues,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1));
work_vector : Real_Vector (1 .. work_vector_rows);
begin
SYEV
(JOBZ => 'N',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => eigenvalues,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[EigenvaluesRealSymm] failed to find all eigenvalues";
end if;
end;
return eigenvalues;
end EigenvaluesRealSymm;
function EigenvaluesHermSymm (Source : Complex_Matrix) return Real_Vector is
matrix : Complex_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := matrix_rows;
eigenvalues : Real_Vector (1 .. eigenvalues_rows);
short_vector : Complex_Vector (1 .. 1);
temp_vector : Real_Vector (1 .. 3 * matrix_rows - 2);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[EigenvaluesHermSymm] source matrix must be square";
end if;
HEEV
(JOBZ => 'N',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => eigenvalues,
WORK => short_vector,
LWORK => -1,
RWORK => temp_vector,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1).Re);
work_vector : Complex_Vector (1 .. work_vector_rows);
begin
HEEV
(JOBZ => 'N',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => eigenvalues,
WORK => work_vector,
LWORK => work_vector_rows,
RWORK => temp_vector,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[EigenvaluesHermSymm] failed to find all eigenvalues";
end if;
end;
return eigenvalues;
end EigenvaluesHermSymm;
procedure Eigensystem
(Source : Real_Matrix;
Eigenvalues : out Complex_Vector;
Eigenvectors : out Complex_Matrix)
is
i, j : Integer;
matrix : Real_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := Eigenvalues'Length;
eigenvectors_rows : Integer := Eigenvectors'Length (1);
eigenvectors_cols : Integer := Eigenvectors'Length (2);
real_eigenvalues : Real_Vector (1 .. eigenvalues_rows);
imag_eigenvalues : Real_Vector (1 .. eigenvalues_rows);
left_eigenvectors : Real_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols);
right_eigenvectors : Real_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols);
short_vector : Real_Vector (1 .. 1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[Eigensystem] source matrix must be square";
end if;
if eigenvectors_rows /= eigenvectors_cols then
raise Constraint_Error with "[Eigensystem] matrix of eigenvectors must be square";
end if;
if eigenvalues_rows /= matrix_rows then
raise Constraint_Error with "[Eigensystem] matrix and eigenvectors have different no. of rows";
end if;
if eigenvectors_rows /= matrix_rows then
raise Constraint_Error with "[Eigensystem] matrix and eigenvalues have different no. of rows";
end if;
GEEV
(JOBVL => 'N',
JOBVR => 'V',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
WR => real_eigenvalues,
WI => imag_eigenvalues,
VL => left_eigenvectors,
VR => right_eigenvectors,
LDVL => eigenvectors_rows,
LDVR => eigenvectors_rows,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1));
work_vector : Real_Vector (1 .. work_vector_rows);
begin
GEEV
(JOBVL => 'N',
JOBVR => 'V',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
WR => real_eigenvalues,
WI => imag_eigenvalues,
VL => left_eigenvectors,
VR => right_eigenvectors,
LDVL => eigenvectors_rows,
LDVR => eigenvectors_rows,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[Eigensystem] failed to find all eigenvector/value pairs";
end if;
for i in 1 .. eigenvalues_rows loop
Eigenvalues (i) := Complex'(real_eigenvalues (i), imag_eigenvalues (i));
end loop;
i := 1;
while i <= eigenvectors_rows loop
j := 1;
while j <= eigenvectors_rows loop
if imag_eigenvalues (j) /= 0.0e0 then
Eigenvectors (i, j) := Complex'(right_eigenvectors (i, j), right_eigenvectors (i, j + 1));
Eigenvectors (i, j + 1) := Complex'(right_eigenvectors (i, j), -right_eigenvectors (i, j + 1));
j := j + 2;
else
Eigenvectors (i, j) := Complex'(right_eigenvectors (i, j), 0.0e0);
j := j + 1;
end if;
end loop;
i := i + 1;
end loop;
end;
end Eigensystem;
procedure Eigensystem
(Source : Complex_Matrix;
Eigenvalues : out Complex_Vector;
Eigenvectors : out Complex_Matrix)
is
matrix : Complex_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := Eigenvalues'Length;
eigenvectors_rows : Integer := Eigenvectors'Length (1);
eigenvectors_cols : Integer := Eigenvectors'Length (2);
left_eigenvectors : Complex_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols);
right_eigenvectors : Complex_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols);
short_vector : Complex_Vector (1 .. 1);
temp_vector : Real_Vector (1 .. 2 * matrix_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[Eigensystem] source matrix must be square";
end if;
if eigenvectors_rows /= eigenvectors_cols then
raise Constraint_Error with "[Eigensystem] matrix of eigenvectors must be square";
end if;
if eigenvalues_rows /= matrix_rows then
raise Constraint_Error with "[Eigensystem] matrix and eigenvectors have different no. of rows";
end if;
if eigenvectors_rows /= matrix_rows then
raise Constraint_Error with "[Eigensystem] matrix and eigenvalues have different no. of rows";
end if;
GEEV
(JOBVL => 'N',
JOBVR => 'V',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
W => Eigenvalues,
VL => left_eigenvectors,
VR => right_eigenvectors,
LDVL => eigenvectors_rows,
LDVR => eigenvectors_rows,
WORK => short_vector,
LWORK => -1,
RWORK => temp_vector,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1).Re);
work_vector : Complex_Vector (1 .. work_vector_rows);
begin
GEEV
(JOBVL => 'N',
JOBVR => 'V',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => Eigenvalues,
VL => left_eigenvectors,
VR => right_eigenvectors,
LDVL => eigenvectors_rows,
LDVR => eigenvectors_rows,
WORK => work_vector,
LWORK => work_vector_rows,
RWORK => temp_vector,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[Eigensystem] failed to find all eigenvectors/values pairs";
end if;
Eigenvectors := right_eigenvectors;
end;
end Eigensystem;
procedure EigensystemRealSymm
(Source : Real_Matrix;
Eigenvalues : out Real_Vector;
Eigenvectors : out Real_Matrix)
is
matrix : Real_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := Eigenvalues'Length;
eigenvectors_rows : Integer := Eigenvectors'Length (1);
eigenvectors_cols : Integer := Eigenvectors'Length (2);
short_vector : Real_Vector (1 .. 1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[EigensystemRealSymm] source matrix must be square";
end if;
if eigenvectors_rows /= eigenvectors_cols then
raise Constraint_Error with "[EigensystemRealSymm] matrix of eigenvectors must be square";
end if;
if eigenvalues_rows /= matrix_rows then
raise Constraint_Error with "[EigensystemRealSymm] matrix and eigenvectors have different no. of rows";
end if;
if eigenvectors_rows /= matrix_rows then
raise Constraint_Error with "[EigensystemRealSymm] matrix and eigenvalues have different no. of rows";
end if;
SYEV
(JOBZ => 'V',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => Eigenvalues,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1));
work_vector : Real_Vector (1 .. work_vector_rows);
begin
SYEV
(JOBZ => 'V',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => Eigenvalues,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[EigensystemRealSymm] failed to find all eigenvector/value pairs";
end if;
for i in 1 .. matrix_rows loop
for j in 1 .. matrix_cols loop
Eigenvectors (i, j) := matrix (i, j);
end loop;
end loop;
end;
end EigensystemRealSymm;
procedure EigensystemHermSymm
(Source : Complex_Matrix;
Eigenvalues : out Real_Vector;
Eigenvectors : out Complex_Matrix)
is
matrix : Complex_Matrix := Source;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
eigenvalues_rows : Integer := Eigenvalues'Length;
eigenvectors_rows : Integer := Eigenvectors'Length (1);
eigenvectors_cols : Integer := Eigenvectors'Length (2);
short_vector : Complex_Vector (1 .. 1);
temp_vector : Real_Vector (1 .. 3 * matrix_rows - 2);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[EigensystemHermSymm] source matrix must be square";
end if;
if eigenvectors_rows /= eigenvectors_cols then
raise Constraint_Error with "[EigensystemHermSymm] matrix of eigenvectors must be square";
end if;
if eigenvalues_rows /= matrix_rows then
raise Constraint_Error with "[EigensystemHermSymm] matrix and eigenvectors have different no. of rows";
end if;
if eigenvectors_rows /= matrix_rows then
raise Constraint_Error with "[EigensystemHermSymm] matrix and eigenvalues have different no. of rows";
end if;
HEEV
(JOBZ => 'V',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => Eigenvalues,
WORK => short_vector,
LWORK => -1,
RWORK => temp_vector,
INFO => return_code);
declare
work_vector_rows : Integer := Integer (short_vector (1).Re);
work_vector : Complex_Vector (1 .. work_vector_rows);
begin
HEEV
(JOBZ => 'V',
UPLO => 'L',
A => matrix,
N => matrix_cols,
LDA => matrix_rows,
W => Eigenvalues,
WORK => work_vector,
LWORK => work_vector_rows,
RWORK => temp_vector,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[EigensystemHermSymm] failed to find all eigenvectors/values pairs";
end if;
for i in 1 .. matrix_rows loop
for j in 1 .. matrix_cols loop
Eigenvectors (i, j) := matrix (i, j);
end loop;
end loop;
end;
end EigensystemHermSymm;
function MatrixInverse (Source : Real_Matrix) return Real_Matrix
is
matrix : Real_Matrix := source;
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
pivots : Integer_Vector (1..matrix_rows);
short_vector : Real_Vector (1..1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "MatrixInverse: source matrix must be square";
end if;
GETRF ( A => matrix,
M => matrix_rows,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
INFO => return_code );
GETRI ( A => matrix,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer( short_vector(1) );
work_vector : Real_Vector (1 .. work_vector_rows);
begin
GETRI ( A => matrix,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "MatrixInverse: matrix is singular";
end if;
end;
return matrix;
end MatrixInverse;
function MatrixInverse (Source : Complex_Matrix) return Complex_Matrix
is
matrix : Complex_Matrix := source;
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
pivots : Integer_Vector (1..matrix_rows);
short_vector : Complex_Vector (1..1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "MatrixInverse: source matrix must be square";
end if;
GETRF ( A => matrix,
M => matrix_rows,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
INFO => return_code );
GETRI ( A => matrix,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
WORK => short_vector,
LWORK => -1,
INFO => return_code);
declare
work_vector_rows : Integer := Integer( short_vector(1).Re );
work_vector : Complex_Vector (1 .. work_vector_rows);
begin
GETRI ( A => matrix,
N => matrix_rows,
LDA => matrix_rows,
IPIV => pivots,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "MatrixInverse: matrix is singular";
end if;
end;
return matrix;
end MatrixInverse;
function SolveSystem
(Source_mat : Real_Matrix;
Source_rhs : Real_Vector)
return Real_Vector
is
matrix : Real_Matrix := Source_mat;
rhs : Real_Vector := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := 1;
mixed_sol_rhs : Real_Matrix (1..matrix_rows,1..1);
solution : Real_Vector (1..matrix_rows);
pivots : Integer_Vector (1..matrix_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystem] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows";
end if;
for i in 1..rhs_rows loop
mixed_sol_rhs (i,1) := rhs (i);
end loop;
GESV (A => matrix,
LDA => matrix_rows,
N => matrix_rows,
IPIV => pivots,
B => mixed_sol_rhs,
LDB => matrix_rows,
NRHS => 1,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
for i in 1..rhs_rows loop
solution (i) := mixed_sol_rhs (i,1);
end loop;
return solution;
end SolveSystem;
function SolveSystem
(Source_mat : Complex_Matrix;
Source_rhs : Complex_Vector)
return Complex_Vector
is
matrix : Complex_Matrix := Source_mat;
rhs : Complex_Vector := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := 1;
mixed_sol_rhs : Complex_Matrix (1..matrix_rows,1..1);
solution : Complex_Vector (1..matrix_rows);
pivots : Integer_Vector (1..matrix_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystem] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows";
end if;
for i in 1..rhs_rows loop
mixed_sol_rhs (i,1) := rhs (i);
end loop;
GESV (A => matrix,
LDA => matrix_rows,
N => matrix_rows,
IPIV => pivots,
B => mixed_sol_rhs,
LDB => matrix_rows,
NRHS => 1,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
for i in 1..rhs_rows loop
solution (i) := mixed_sol_rhs (i,1);
end loop;
return solution;
end SolveSystem;
function SolveSystem
(Source_mat : Real_Matrix;
Source_rhs : Real_Matrix)
return Real_Matrix
is
matrix : Real_Matrix := Source_mat;
rhs : Real_Matrix := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := rhs'Length (2);
solution : Real_Matrix := rhs;
solution_rows : Integer := rhs_rows;
solution_cols : Integer := rhs_cols;
pivots : Integer_Vector (1 .. matrix_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystem] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows";
end if;
GESV (A => matrix,
LDA => matrix_rows,
N => matrix_rows,
IPIV => pivots,
B => solution,
LDB => solution_rows,
NRHS => solution_cols,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
return solution;
end SolveSystem;
function SolveSystem
(Source_mat : Complex_Matrix;
Source_rhs : Complex_Matrix)
return Complex_Matrix
is
matrix : Complex_Matrix := Source_mat;
rhs : Complex_Matrix := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := rhs'Length (2);
solution : Complex_Matrix := rhs;
solution_rows : Integer := rhs_rows;
solution_cols : Integer := rhs_cols;
pivots : Integer_Vector (1 .. matrix_rows);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystem] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows";
end if;
GESV (A => matrix,
LDA => matrix_rows,
N => matrix_rows,
IPIV => pivots,
B => solution,
LDB => solution_rows,
NRHS => solution_cols,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
return solution;
end SolveSystem;
function SolveSystemRealSymm
(Source_mat : Real_Matrix;
Source_rhs : Real_Matrix)
return Real_Matrix
is
matrix : Real_Matrix := Source_mat;
rhs : Real_Matrix := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := rhs'Length (2);
pivots : Integer_Vector (1 .. matrix_rows);
short_vector : Real_Vector (1..1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystemRealSymm] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystemRealSymm] matrix and rhs must have equal no. of rows";
end if;
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => short_vector,
LWORK => -1,
INFO => return_code );
declare
work_vector_max : Constant Integer := Integer( short_vector(1) );
work_vector : Real_Vector (1 .. work_vector_max);
begin
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => work_vector,
LWORK => work_vector_max,
INFO => return_code );
end;
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystemRealSymm] matrix may be singular";
end if;
return rhs;
end SolveSystemRealSymm;
function SolveSystemHermSymm
(Source_mat : Complex_Matrix;
Source_rhs : Complex_Matrix)
return Complex_Matrix
is
matrix : Complex_Matrix := Source_mat;
rhs : Complex_Matrix := Source_rhs;
matrix_rows : Integer := matrix'Length (1);
matrix_cols : Integer := matrix'Length (2);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := rhs'Length (2);
pivots : Integer_Vector (1 .. matrix_rows);
short_vector : Complex_Vector (1..1);
return_code : Integer := 0;
begin
if matrix_rows /= matrix_cols then
raise Constraint_Error with "[SolveSystemHermSymm] source matrix must be square";
end if;
if rhs_rows /= matrix_rows then
raise Constraint_Error with "[SolveSystemHermSymm] matrix and rhs must have equal no. of rows";
end if;
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => short_vector,
LWORK => -1,
INFO => return_code );
declare
work_vector_max : Constant Integer := Integer( short_vector(1).Re );
work_vector : Complex_Vector (1 .. work_vector_max);
begin
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => work_vector,
LWORK => work_vector_max,
INFO => return_code );
end;
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystemHermSymm] matrix may be singular";
end if;
return rhs;
end SolveSystemHermSymm;
procedure SolveSystem
(Solution : out Real_Vector;
Source_mat : Real_Matrix;
Source_rhs : Real_Vector;
Size : Integer)
is
matrix : Real_Matrix (1..size,1..size);
mixed_sol_rhs : Real_Matrix (1..size,1..1);
pivots : Integer_Vector (1..size);
return_code : Integer := 0;
begin
if size > matrix'length(1) then
raise Constraint_Error with "[SolveSystem] no. rows in matrix less than size";
end if;
if size > matrix'length(2) then
raise Constraint_Error with "[SolveSystem] no. columns in matrix less than size";
end if;
for i in 1..size loop
mixed_sol_rhs (i,1) := Source_rhs (i);
for j in 1..size loop
matrix (i,j) := Source_mat (i,j);
end loop;
end loop;
GESV (A => matrix,
LDA => size,
N => size,
IPIV => pivots,
B => mixed_sol_rhs,
LDB => size,
NRHS => 1,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
for i in 1..size loop
solution (i) := mixed_sol_rhs (i,1);
end loop;
end SolveSystem;
procedure SolveSystem
(Solution : out Complex_Vector;
Source_mat : Complex_Matrix;
Source_rhs : Complex_Vector;
Size : Integer)
is
matrix : Complex_Matrix (1..size,1..size);
mixed_sol_rhs : Complex_Matrix (1..size,1..1);
pivots : Integer_Vector (1..size);
return_code : Integer := 0;
begin
if size > matrix'length(1) then
raise Constraint_Error with "[SolveSystem] no. rows in matrix less than size";
end if;
if size > matrix'length(2) then
raise Constraint_Error with "[SolveSystem] no. columns in matrix less than size";
end if;
for i in 1..size loop
mixed_sol_rhs (i,1) := Source_rhs (i);
for j in 1..size loop
matrix (i,j) := Source_mat (i,j);
end loop;
end loop;
GESV (A => matrix,
LDA => size,
N => size,
IPIV => pivots,
B => mixed_sol_rhs,
LDB => size,
NRHS => 1,
INFO => return_code);
if return_code /= 0 then
lapack_return_code := return_code;
raise Constraint_Error with "[SolveSystem] matrix may be singular";
end if;
for i in 1..size loop
solution (i) := mixed_sol_rhs (i,1);
end loop;
end SolveSystem;
end Ada_Lapack.Extras;
|
package Protected_Body_Declaration is
protected type T is
function func return Integer;
end T;
end Protected_Body_Declaration;
|
with System.Storage_Elements; use System.Storage_Elements;
with Ada.Containers.Indefinite_Vectors;
with Ada.Numerics.Discrete_Random;
with AUnit.Assertions; use AUnit.Assertions;
with Test_Utils; use Test_Utils;
with AAA.Strings;
package body Testsuite.Encode_Decode.Random is
pragma Style_Checks ("gnatyM120-s");
package Input_Frames_Package is new Ada.Containers.Indefinite_Vectors
(Natural, Storage_Array);
-------------------------------
-- Make_Random_Test_Scenario --
-------------------------------
function Make_Random_Test_Scenario return Input_Frames_Package.Vector is
type Frames_Number_Range is range 1 .. 100;
subtype Frames_Length_Range is Storage_Count range 1 .. 1000;
package Rand_Frames_Number
is new Ada.Numerics.Discrete_Random (Frames_Number_Range);
package Rand_Frames_Length
is new Ada.Numerics.Discrete_Random (Frames_Length_Range);
package Rand_Data
is new Ada.Numerics.Discrete_Random (Storage_Element);
Gen_Nbr : Rand_Frames_Number.Generator;
Gen_Len : Rand_Frames_Length.Generator;
Gen_Data : Rand_Data.Generator;
Result : Input_Frames_Package.Vector;
begin
for Frame in 1 .. Rand_Frames_Number.Random (Gen_Nbr) loop
declare
Frame : Storage_Array (1 .. Rand_Frames_Length.Random (Gen_Len));
begin
for Elt of Frame loop
Elt := Rand_Data.Random (Gen_Data);
end loop;
Result.Append (Frame);
end;
end loop;
return Result;
end Make_Random_Test_Scenario;
-----------------
-- Test_Random --
-----------------
procedure Test_Random (Fixture : in out Encoder_Decoder_Fixture) is
Input : constant Input_Frames_Package.Vector := Make_Random_Test_Scenario;
begin
Fixture.Encoder.Clear;
for Frame of Input loop
for Elt of Frame loop
Fixture.Encoder.Receive (Elt);
end loop;
Fixture.Encoder.End_Of_Frame;
end loop;
Fixture.Encoder.End_Of_Test;
Assert (Fixture.Encoder.Number_Of_Frames = 1,
"Unexpected number of encode output frames: " &
Fixture.Encoder.Number_Of_Frames'Img);
for Elt of Fixture.Encoder.Get_Frame (0) loop
Fixture.Decoder.Receive (Elt);
end loop;
Fixture.Decoder.End_Of_Test;
Assert (Fixture.Decoder.Number_Of_Frames =
Storage_Count (Input.Length),
"Unexpected number of decode output frames: " &
Fixture.Decoder.Number_Of_Frames'Img);
for Index in 0 .. Fixture.Decoder.Number_Of_Frames - 1 loop
declare
Output_Frame : constant Data_Frame :=
Fixture.Decoder.Get_Frame (Index);
Expected_Frame : constant Data_Frame :=
From_Array (Input.Element (Natural (Index)));
begin
if Output_Frame /= Expected_Frame then
declare
Diff : constant AAA.Strings.Vector :=
Test_Utils.Diff (Expected_Frame,
Output_Frame);
begin
Assert (False, "Error in frame #" & Index'Img & ASCII.LF &
Diff.Flatten (ASCII.LF));
end;
end if;
end;
end loop;
end Test_Random;
---------------
-- Add_Tests --
---------------
procedure Add_Tests (Suite : in out AUnit.Test_Suites.Test_Suite'Class) is
begin
for X in 1 .. 10 loop
Suite.Add_Test (Encoder_Decoder_Caller.Create ("Random" & X'Img,
Test_Random'Access));
end loop;
end Add_Tests;
end Testsuite.Encode_Decode.Random;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
with Ada.Containers; use Ada.Containers;
package Apsepp.Containers is
subtype Index_Type is Count_Type range 1 .. Count_Type'Last;
end Apsepp.Containers;
|
with Ada.Containers.Vectors;
with Ada.Text_IO;
with Space_Image_Format;
use Space_Image_Format;
procedure Day_08 is
function Count_Pixel(Within: Layer; Value: Pixel) return Natural is
Total: Natural := 0;
begin
for P of Within loop
if P = Value then Total := Total + 1; end if;
end loop;
return Total;
end Count_Pixel;
package Layer_Vector is new Ada.Containers.Vectors(
Index_Type => Positive, Element_Type => Layer);
All_Layers: Layer_Vector.Vector;
Least_Zeroed_Layer: Layer;
Zero_Count: Natural := Natural'Last;
begin
while not Ada.Text_IO.End_Of_File loop
declare
L: Layer;
Z: Natural;
begin
Get_Layer(L);
Z := Count_Pixel(Within => L, Value => '0');
if Z < Zero_Count then
Zero_Count := Z;
Least_Zeroed_Layer := L;
end if;
All_Layers.Append(L);
end;
end loop;
declare
Ones: constant Natural :=
Count_Pixel(Within => Least_Zeroed_Layer, Value => '1');
Twos: constant Natural :=
Count_Pixel(Within => Least_Zeroed_Layer, Value => '2');
LS: Layer_Stack(All_Layers.First_Index .. All_Layers.Last_Index);
Output: Image;
begin
Ada.Text_IO.Put_Line("checksum:" & Natural'Image(Ones * Twos));
Ada.Text_IO.New_Line;
for I in LS'Range loop
LS(I) := All_Layers.Element(I);
end loop;
Output := To_Image(LS);
Put_Image(Output);
end;
end Day_08;
|
package body Thin_Pointer2_Pkg is
type SB is access constant String;
function Inner (S : SB) return Character is
begin
if S /= null and then S'Length > 0 then
return S (S'First);
end if;
return '*';
end;
function F return Character is
begin
return Inner (SB (S));
end;
end Thin_Pointer2_Pkg;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C A S E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1996-2020, 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. --
-- --
------------------------------------------------------------------------------
-- Package containing the routines to process a list of discrete choices.
-- Such lists can occur in two different constructs: case statements and
-- record variants. We have factorized what used to be two very similar
-- sets of routines in one place. These are not currently used for the
-- aggregate case, since issues with nested aggregates make that case
-- substantially different.
-- The following processing is required for such cases:
-- 1. Analysis of names of subtypes, constants, expressions appearing within
-- the choices. This must be done when the construct is encountered to get
-- proper visibility of names.
-- 2. Checking for semantic correctness of the choices. A lot of this could
-- be done at the time when the construct is encountered, but not all, since
-- in the case of variants, statically predicated subtypes won't be frozen
-- (and the choice sets known) till the enclosing record type is frozen. So
-- at least the check for no overlaps and covering the range must be delayed
-- till the freeze point in this case.
-- 3. Set the Others_Discrete_Choices list for an others choice. This is
-- used in various ways, e.g. to construct the disriminant checking function
-- for the case of a variant with an others choice.
-- 4. In the case of static predicates, we need to expand out choices that
-- correspond to the predicate for the back end. This expansion destroys
-- the list of choices, so it should be delayed to expansion time.
-- Step 1 is performed by the generic procedure Analyze_Choices, which is
-- called when the variant record or case statement/expression is first
-- encountered.
-- Step 2 is performed by the generic procedure Check_Choices. We decide to
-- do all semantic checking in that step, since as noted above some of this
-- has to be deferred to the freeze point in any case for variants. For case
-- statements and expressions, this procedure can be called at the time the
-- case construct is encountered (after calling Analyze_Choices).
-- Step 3 is also performed by Check_Choices, since we need the static ranges
-- for predicated subtypes to accurately construct this.
-- Step 4 is performed by the procedure Expand_Static_Predicates_In_Choices.
-- For case statements, this call only happens during expansion. The reason
-- we do the expansion unconditionally for variants is that other processing,
-- for example for aggregates, relies on having a complete list of choices.
-- Historical note: We used to perform all four of these functions at once in
-- a single procedure called Analyze_Choices. This routine was called at the
-- time the construct was first encountered. That seemed to work OK up to Ada
-- 2005, but the introduction of statically predicated subtypes with delayed
-- evaluation of the static ranges made this completely wrong, both because
-- the ASIS tree got destroyed by step 4, and steps 2 and 3 were too early
-- in the variant record case.
with Types; use Types;
package Sem_Case is
procedure No_OP (C : Node_Id);
-- The no-operation routine. Does mostly nothing. Can be used
-- in the following generics for the parameters Process_Empty_Choice,
-- or Process_Associated_Node. In the case of an empty range choice,
-- routine emits a warning when Warn_On_Redundant_Constructs is enabled.
generic
with procedure Process_Associated_Node (A : Node_Id);
-- Associated with each case alternative or record variant A there is
-- a node or list of nodes that need additional processing. This routine
-- implements that processing.
package Generic_Analyze_Choices is
procedure Analyze_Choices
(Alternatives : List_Id;
Subtyp : Entity_Id);
-- From a case expression, case statement, or record variant, this
-- routine analyzes the corresponding list of discrete choices which
-- appear in each element of the list Alternatives (for the variant
-- part case, this is the variants, for a case expression or statement,
-- this is the Alternatives).
--
-- Subtyp is the subtype of the discrete choices. The type against which
-- the discrete choices must be resolved is its base type.
end Generic_Analyze_Choices;
generic
with procedure Process_Empty_Choice (Choice : Node_Id);
-- Processing to carry out for an empty Choice. Set to No_Op (declared
-- above) if no such processing is required.
with procedure Process_Non_Static_Choice (Choice : Node_Id);
-- Processing to carry out for a non static Choice (gives an error msg)
with procedure Process_Associated_Node (A : Node_Id);
-- Associated with each case alternative or record variant A there is
-- a node or list of nodes that need semantic processing. This routine
-- implements that processing.
package Generic_Check_Choices is
procedure Check_Choices
(N : Node_Id;
Alternatives : List_Id;
Subtyp : Entity_Id;
Others_Present : out Boolean);
-- From a case expression, case statement, or record variant N, this
-- routine analyzes the corresponding list of discrete choices which
-- appear in each element of the list Alternatives (for the variant
-- part case, this is the variants, for a case expression or statement,
-- this is the Alternatives).
--
-- Subtyp is the subtype of the discrete choices. The type against which
-- the discrete choices must be resolved is its base type.
--
-- Others_Present is set to True if an Others choice is present in the
-- list of choices, and in this case Others_Discrete_Choices is set in
-- the N_Others_Choice node.
--
-- If a Discrete_Choice list contains at least one instance of a subtype
-- with a static predicate, then the Has_SP_Choice flag is set true in
-- the parent node (N_Variant, N_Case_Expression/Statement_Alternative).
end Generic_Check_Choices;
end Sem_Case;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Sf.System.Clock; use Sf.System, Sf.System.Clock;
with Sf.System.Sleep; use Sf.System.Sleep;
with Sf.System.Time; use Sf.System.Time;
procedure Main is
My_Clock : sfClock_Ptr;
begin
My_Clock := Create;
sfDelay(0.05);
Put ("Time elapsed(s): ");
Put (asSeconds (GetElapsedTime (My_Clock)), Fore => 0, Aft => 3, Exp => 0);
New_Line;
Put ("Time elapsed(ms) since start: ");
Put (Integer (asMilliseconds (Restart (My_Clock))));
New_Line;
sfSleep(sfMilliseconds(1050));
Put ("Time elapsed(ms): ");
Put (Integer (asMilliseconds (GetElapsedTime (My_Clock))));
New_Line;
Destroy (My_Clock);
end Main;
|
-- Task 2 of RTPL WS17/18
-- Team members: Hannes B. and Gabriel Z.
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO;
package body counting with SPARK_Mode is
-- Procedure for option 1
procedure opt1 is
-- Integer values for user input
I1 : Integer := 1;
I2 : Integer := 2;
begin
-- Get user input
Put_Line ("Please input two integers between 1 and 100.");
Put ("First: ");
Ada.Integer_Text_IO.Get (I1);
Put ("Second: ");
Ada.Integer_Text_IO.Get (I2);
-- Call the counting funtion
myCount (myRange'Value (I1'Image), myRange'Value (I2'Image));
exception when others =>
Put_Line ("Exception occured due to incorrect user input.");
Put_Line ("Please start over!");
end opt1;
-- Counting procedure
procedure myCount (start_value : in myRange; end_value : in myRange) is
begin
Put ("Start counting from" & start_value'Image);
Put_Line (" to" & end_value'Image & ":");
-- Start the counting depending on the different cases
if start_value = end_value then
Put_Line (start_value'Image);
elsif start_value < end_value then
for i in start_value .. end_value loop
Put (i'Image);
end loop;
else
for i in reverse end_value .. start_value loop
Put (i'Image);
end loop;
end if;
end myCount;
end counting;
|
------------------------------------------------------------------------------
-- EMAIL: <darkestkhan@gmail.com> --
-- License: ISC --
-- --
-- Copyright © 2015 - 2016 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
with Imago.IL;
use Imago;
package Imago.ILU is
--------------------------------------------------------------------------
---------------
-- T Y P E S --
---------------
--------------------------------------------------------------------------
-- NOTE: Really, this one should be replaced with type whose definition
-- is much more Ada-like.
type Info is
record
ID : IL.UInt; -- the image's ID
Data : IL.Pointer; -- the image's data
Width : IL.UInt; -- the image's width
Height : IL.UInt; -- the image's height
Depth : IL.UInt; -- the image's depth
Bpp : IL.UByte; -- bytes per pixel (not bits) of the image
Size_Of_Data: IL.UInt; -- the total size of the data (in bytes)
Format : IL.Enum; -- image format (in IL.Enum style)
Of_Type : IL.Enum; -- image type (in IL.Enum style)
Origin : IL.Enum; -- origin of the image
Palette : IL.Pointer; -- the image's palette
Palette_Type: IL.Enum; -- palette size
Palette_Size: IL.UInt; -- palette type
Cube_Flags : IL.Enum; -- flags for what cube map sides are present
Num_Next : IL.UInt; -- number of images following
Num_Mips : IL.UInt; -- number of mipmaps
Num_Layers : IL.UInt; -- number of layers
end record
with Convention => C;
type Point_F is
record
X: Float;
Y: Float;
end record
with Convention => C;
type Point_I is
record
X: IL.Int;
Y: IL.Int;
end record
with Convention => C;
--------------------------------------------------------------------------
-----------------------
-- C O N S T A N T S --
-----------------------
--------------------------------------------------------------------------
ILU_VERSION_1_7_8 : constant IL.Enum := 1;
ILU_VERSION : constant IL.Enum := 178;
ILU_FILTER : constant IL.Enum := 16#2600#;
ILU_NEAREST : constant IL.Enum := 16#2601#;
ILU_LINEAR : constant IL.Enum := 16#2602#;
ILU_BILINEAR : constant IL.Enum := 16#2603#;
ILU_SCALE_BOX : constant IL.Enum := 16#2604#;
ILU_SCALE_TRIANGLE : constant IL.Enum := 16#2605#;
ILU_SCALE_BELL : constant IL.Enum := 16#2606#;
ILU_SCALE_BSPLINE : constant IL.Enum := 16#2607#;
ILU_SCALE_LANCZOS3 : constant IL.Enum := 16#2608#;
ILU_SCALE_MITCHELL : constant IL.Enum := 16#2609#;
-- Error types.
ILU_INVALID_ENUM : constant IL.Enum := 16#0501#;
ILU_OUT_OF_MEMORY : constant IL.Enum := 16#0502#;
ILU_INTERNAL_ERROR : constant IL.Enum := 16#0504#;
ILU_INVALID_VALUE : constant IL.Enum := 16#0505#;
ILU_ILLEGAL_OPERATION : constant IL.Enum := 16#0506#;
ILU_INVALID_PARAM : constant IL.Enum := 16#0509#;
-- Values.
ILU_PLACEMENT : constant IL.Enum := 16#0700#;
ILU_LOWER_LEFT : constant IL.Enum := 16#0701#;
ILU_LOWER_RIGHT : constant IL.Enum := 16#0702#;
ILU_UPPER_LEFT : constant IL.Enum := 16#0703#;
ILU_UPPER_RIGHT : constant IL.Enum := 16#0704#;
ILU_CENTER : constant IL.Enum := 16#0705#;
ILU_CONVOLUTION_MATRIX : constant IL.Enum := 16#0710#;
ILU_VERSION_NUM : constant IL.Enum := IL.IL_VERSION_NUM;
ILU_VENDOR : constant IL.Enum := IL.IL_VENDOR;
-- Languages.
ILU_ENGLISH : constant IL.Enum := 16#0800#;
ILU_ARABIC : constant IL.Enum := 16#0801#;
ILU_DUTCH : constant IL.Enum := 16#0802#;
ILU_JAPANESE : constant IL.Enum := 16#0803#;
ILU_SPANISH : constant IL.Enum := 16#0804#;
ILU_GERMAN : constant IL.Enum := 16#0805#;
ILU_FRENCH : constant IL.Enum := 16#0806#;
--------------------------------------------------------------------------
---------------------------
-- S U B P R O G R A M S --
---------------------------
--------------------------------------------------------------------------
function Alienify return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluAlienify";
function Blur_Avg (Iter: in IL.UInt) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluBlurAvg";
function Blur_Gaussian (Iter: in IL.UInt) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluBlurGaussian";
function Build_Mipmaps return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluBuildMipmaps";
function Colors_Used return IL.UInt
with Import => True, Convention => StdCall,
External_Name => "iluColoursUsed";
function Colours_Used return IL.UInt
with Import => True, Convention => StdCall,
External_Name => "iluColoursUsed";
function Compare_Image (Comp: in IL.UInt) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluCompareImage";
function Contrast (Contrats: in Float) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluContrast";
function Crop
( XOff: in IL.UInt; YOff: in IL.UInt; ZOff: in IL.UInt;
Width: in IL.UInt; Height: in IL.UInt; Depth: in IL.UInt
) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluCrop";
procedure Delete_Image (ID: in IL.UInt)
with Import => True, Convention => StdCall,
External_Name => "iluDeleteImage";
function Edge_Detect_E return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluEdgeDetectE";
function Edge_Detect_P return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluEdgeDetectP";
function Edge_Detect_S return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluEdgeDetectS";
function Emboss return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluEmboss";
function Enlarge_Canvas
( Width: in IL.UInt; Height: in IL.UInt; Depth: in IL.UInt
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluEnlargeCanvas";
function Enlarge_Image
( XDim: in Float; YDim: in Float; ZDim: in Float
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluEnlargeImage";
function Error_String (String_Name: in IL.Enum) return String
with Inline => True;
function Equalize return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluEqualize";
function Convolution
( Matrix: in IL.Pointer; Scale: in IL.Int; Bias: in IL.Int
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluConvolution";
function Flip_Image return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluFlipImage";
function Gamma_Correct (Gamma: in Float) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluGammaCorrect";
function Gen_Image return IL.UInt
with Import => True, Convention => StdCall, External_Name => "iluGenImage";
procedure Get_Image_Info (Item: out Info)
with Import => True, Convention => StdCall,
External_Name => "iluGetImageInfo";
function Get_Integer (Mode: in IL.Enum) return IL.Int
with Import => True, Convention => StdCall,
External_Name => "iluGetInteger";
procedure Get_Integer (Mode: in IL.Enum; Param: in IL.Pointer)
with Import => True, Convention => StdCall,
External_Name => "iluGetIntegerv";
function Get_String (String_Name: in IL.Enum) return String
with Inline => True;
procedure Image_Parameter (P_Name: in IL.Enum; Param: in IL.Enum)
with Import => True, Convention => StdCall,
External_Name => "iluImageParameter";
procedure Init
with Import => True, Convention => StdCall, External_Name => "iluInit";
function Invert_Alpha return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluInvertAlpha";
function Load_Image (File_Name: in String) return IL.UInt
with Inline => True;
function Mirror return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluMirror";
function Negative return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluNegative";
function Noisify (Tolerance: in IL.ClampF) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluNoisify";
function Pixelize (Pix_Size: in IL.UInt) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluPixelize";
procedure Region_F (Points: in IL.Pointer; N: in IL.UInt)
with Import => True, Convention => StdCall, External_Name => "iluRegionfv";
procedure Region_I (Points: in IL.Pointer; N: in IL.UInt)
with Import => True, Convention => StdCall, External_Name => "iluRegioniv";
function Replace_Color
( Red: in IL.UByte; Green: in IL.UByte;
Blue: in IL.UByte; Tolerance: in Float
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluReplaceColour";
function Replace_Colour
( Red: in IL.UByte; Green: in IL.UByte;
Blue: in IL.UByte; Tolerance: in Float
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluReplaceColour";
function Rotate (Angle: in Float) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluRotate";
function Rotate
( X: in Float; Y: in Float; Z: in Float; Angle: in Float
) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluRotate3D";
function Saturate (Saturation: in Float) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluSaturate1f";
function Saturate
( R: in Float; G: in Float; B: in Float; Saturation: in Float
) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluSaturate4f";
function Scale
( Width: in IL.UInt; Height: in IL.UInt; Depth: in IL.UInt
) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluScale";
function Scale_Alpha (Scale: in Float) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluScaleAlpha";
function Scale_Colors (R: in Float; G: in Float; B: in Float) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluScaleColours";
function Scale_Colours (R: in Float; G: in Float; B: in Float) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluScaleColours";
function Set_Language (Language: in IL.Enum) return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluSetLanguage";
function Sharpen (Factor: in Float; Iter: in IL.UInt) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluSharpen";
function Swap_Colors return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluSwapColours";
function Swap_Colours return IL.Bool
with Import => True, Convention => StdCall,
External_Name => "iluSwapColours";
function Wave (Angle: in Float) return IL.Bool
with Import => True, Convention => StdCall, External_Name => "iluWave";
--------------------------------------------------------------------------
end Imago.ILU;
|
with Ada.Text_IO, Ada.Command_Line, Crypto.Types.Big_Numbers;
procedure Mod_Exp is
A: String :=
"2988348162058574136915891421498819466320163312926952423791023078876139";
B: String :=
"2351399303373464486466122544523690094744975233415544072992656881240319";
D: constant Positive := Positive'Max(Positive'Max(A'Length, B'Length), 40);
-- the number of decimals to store A, B, and result
Bits: constant Positive := (34*D)/10;
-- (slightly more than) the number of bits to store A, B, and result
package LN is new Crypto.Types.Big_Numbers (Bits + (32 - Bits mod 32));
-- the actual number of bits has to be a multiple of 32
use type LN.Big_Unsigned;
function "+"(S: String) return LN.Big_Unsigned
renames LN.Utils.To_Big_Unsigned;
M: LN.Big_Unsigned := (+"10") ** (+"40");
begin
Ada.Text_IO.Put("A**B (mod 10**40) = ");
Ada.Text_IO.Put_Line(LN.Utils.To_String(LN.Mod_Utils.Pow((+A), (+B), M)));
end Mod_Exp;
|
with
Interfaces.C.Strings,
System.Address_To_Access_Conversions,
Ada.Unchecked_Conversion;
use type
Interfaces.C.int,
Interfaces.C.Strings.chars_ptr;
package body FLTK.Static is
procedure fl_static_add_awake_handler
(H, F : in System.Address);
pragma Import (C, fl_static_add_awake_handler, "fl_static_add_awake_handler");
pragma Inline (fl_static_add_awake_handler);
procedure fl_static_get_awake_handler
(H, F : out System.Address);
pragma Import (C, fl_static_get_awake_handler, "fl_static_get_awake_handler");
pragma Inline (fl_static_get_awake_handler);
procedure fl_static_add_check
(H, F : in System.Address);
pragma Import (C, fl_static_add_check, "fl_static_add_check");
pragma Inline (fl_static_add_check);
function fl_static_has_check
(H, F : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_static_has_check, "fl_static_has_check");
pragma Inline (fl_static_has_check);
procedure fl_static_remove_check
(H, F : in System.Address);
pragma Import (C, fl_static_remove_check, "fl_static_remove_check");
pragma Inline (fl_static_remove_check);
procedure fl_static_add_timeout
(S : in Interfaces.C.double;
H, F : in System.Address);
pragma Import (C, fl_static_add_timeout, "fl_static_add_timeout");
pragma Inline (fl_static_add_timeout);
function fl_static_has_timeout
(H, F : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_static_has_timeout, "fl_static_has_timeout");
pragma Inline (fl_static_has_timeout);
procedure fl_static_remove_timeout
(H, F : in System.Address);
pragma Import (C, fl_static_remove_timeout, "fl_static_remove_timeout");
pragma Inline (fl_static_remove_timeout);
procedure fl_static_repeat_timeout
(S : in Interfaces.C.double;
H, F : in System.Address);
pragma Import (C, fl_static_repeat_timeout, "fl_static_repeat_timeout");
pragma Inline (fl_static_repeat_timeout);
procedure fl_static_add_clipboard_notify
(H, F : in System.Address);
pragma Import (C, fl_static_add_clipboard_notify, "fl_static_add_clipboard_notify");
pragma Inline (fl_static_add_clipboard_notify);
procedure fl_static_add_fd
(D : in Interfaces.C.int;
H, F : in System.Address);
pragma Import (C, fl_static_add_fd, "fl_static_add_fd");
pragma Inline (fl_static_add_fd);
procedure fl_static_add_fd2
(D, M : in Interfaces.C.int;
H, F : in System.Address);
pragma Import (C, fl_static_add_fd2, "fl_static_add_fd2");
pragma Inline (fl_static_add_fd2);
procedure fl_static_remove_fd
(D : in Interfaces.C.int);
pragma Import (C, fl_static_remove_fd, "fl_static_remove_fd");
pragma Inline (fl_static_remove_fd);
procedure fl_static_remove_fd2
(D, M : in Interfaces.C.int);
pragma Import (C, fl_static_remove_fd2, "fl_static_remove_fd2");
pragma Inline (fl_static_remove_fd2);
procedure fl_static_add_idle
(H, F : in System.Address);
pragma Import (C, fl_static_add_idle, "fl_static_add_idle");
pragma Inline (fl_static_add_idle);
function fl_static_has_idle
(H, F : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_static_has_idle, "fl_static_has_idle");
pragma Inline (fl_static_has_idle);
procedure fl_static_remove_idle
(H, F : in System.Address);
pragma Import (C, fl_static_remove_idle, "fl_static_remove_idle");
pragma Inline (fl_static_remove_idle);
procedure fl_static_get_color
(C : in Interfaces.C.unsigned;
R, G, B : out Interfaces.C.unsigned_char);
pragma Import (C, fl_static_get_color, "fl_static_get_color");
pragma Inline (fl_static_get_color);
procedure fl_static_set_color
(C : in Interfaces.C.unsigned;
R, G, B : in Interfaces.C.unsigned_char);
pragma Import (C, fl_static_set_color, "fl_static_set_color");
pragma Inline (fl_static_set_color);
procedure fl_static_free_color
(C : in Interfaces.C.unsigned;
B : in Interfaces.C.int);
pragma Import (C, fl_static_free_color, "fl_static_free_color");
pragma Inline (fl_static_free_color);
procedure fl_static_foreground
(R, G, B : in Interfaces.C.unsigned_char);
pragma Import (C, fl_static_foreground, "fl_static_foreground");
pragma Inline (fl_static_foreground);
procedure fl_static_background
(R, G, B : in Interfaces.C.unsigned_char);
pragma Import (C, fl_static_background, "fl_static_background");
pragma Inline (fl_static_background);
procedure fl_static_background2
(R, G, B : in Interfaces.C.unsigned_char);
pragma Import (C, fl_static_background2, "fl_static_background2");
pragma Inline (fl_static_background2);
function fl_static_get_font
(K : in Interfaces.C.int)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_static_get_font, "fl_static_get_font");
pragma Inline (fl_static_get_font);
function fl_static_get_font_name
(K : in Interfaces.C.int)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_static_get_font_name, "fl_static_get_font_name");
pragma Inline (fl_static_get_font_name);
procedure fl_static_set_font
(T, F : in Interfaces.C.int);
pragma Import (C, fl_static_set_font, "fl_static_set_font");
pragma Inline (fl_static_set_font);
function fl_static_get_font_sizes
(F : in Interfaces.C.int;
A : out System.Address)
return Interfaces.C.int;
pragma Import (C, fl_static_get_font_sizes, "fl_static_get_font_sizes");
pragma Inline (fl_static_get_font_sizes);
function fl_static_font_size_array_get
(A : in System.Address;
I : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_font_size_array_get, "fl_static_font_size_array_get");
pragma Inline (fl_static_font_size_array_get);
function fl_static_set_fonts
return Interfaces.C.int;
pragma Import (C, fl_static_set_fonts, "fl_static_set_fonts");
pragma Inline (fl_static_set_fonts);
function fl_static_box_dh
(B : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_box_dh, "fl_static_box_dh");
pragma Inline (fl_static_box_dh);
function fl_static_box_dw
(B : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_box_dw, "fl_static_box_dw");
pragma Inline (fl_static_box_dw);
function fl_static_box_dx
(B : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_box_dx, "fl_static_box_dx");
pragma Inline (fl_static_box_dx);
function fl_static_box_dy
(B : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_box_dy, "fl_static_box_dy");
pragma Inline (fl_static_box_dy);
procedure fl_static_set_boxtype
(T, F : in Interfaces.C.int);
pragma Import (C, fl_static_set_boxtype, "fl_static_set_boxtype");
pragma Inline (fl_static_set_boxtype);
function fl_static_draw_box_active
return Interfaces.C.int;
pragma Import (C, fl_static_draw_box_active, "fl_static_draw_box_active");
pragma Inline (fl_static_draw_box_active);
procedure fl_static_copy
(T : in Interfaces.C.char_array;
L, K : in Interfaces.C.int);
pragma Import (C, fl_static_copy, "fl_static_copy");
pragma Inline (fl_static_copy);
procedure fl_static_paste
(R : in System.Address;
S : in Interfaces.C.int);
pragma Import (C, fl_static_paste, "fl_static_paste");
pragma Inline (fl_static_paste);
procedure fl_static_selection
(O : in System.Address;
T : in Interfaces.C.char_array;
L : in Interfaces.C.int);
pragma Import (C, fl_static_selection, "fl_static_selection");
pragma Inline (fl_static_selection);
function fl_static_get_dnd_text_ops
return Interfaces.C.int;
pragma Import (C, fl_static_get_dnd_text_ops, "fl_static_get_dnd_text_ops");
pragma Inline (fl_static_get_dnd_text_ops);
procedure fl_static_set_dnd_text_ops
(T : in Interfaces.C.int);
pragma Import (C, fl_static_set_dnd_text_ops, "fl_static_set_dnd_text_ops");
pragma Inline (fl_static_set_dnd_text_ops);
function fl_static_get_visible_focus
return Interfaces.C.int;
pragma Import (C, fl_static_get_visible_focus, "fl_static_get_visible_focus");
pragma Inline (fl_static_get_visible_focus);
procedure fl_static_set_visible_focus
(T : in Interfaces.C.int);
pragma Import (C, fl_static_set_visible_focus, "fl_static_set_visible_focus");
pragma Inline (fl_static_set_visible_focus);
procedure fl_static_default_atclose
(W : in System.Address);
pragma Import (C, fl_static_default_atclose, "fl_static_default_atclose");
pragma Inline (fl_static_default_atclose);
function fl_static_get_first_window
return System.Address;
pragma Import (C, fl_static_get_first_window, "fl_static_get_first_window");
pragma Inline (fl_static_get_first_window);
procedure fl_static_set_first_window
(T : in System.Address);
pragma Import (C, fl_static_set_first_window, "fl_static_set_first_window");
pragma Inline (fl_static_set_first_window);
function fl_static_next_window
(W : in System.Address)
return System.Address;
pragma Import (C, fl_static_next_window, "fl_static_next_window");
pragma Inline (fl_static_next_window);
function fl_static_modal
return System.Address;
pragma Import (C, fl_static_modal, "fl_static_modal");
pragma Inline (fl_static_modal);
function fl_static_readqueue
return System.Address;
pragma Import (C, fl_static_readqueue, "fl_static_readqueue");
pragma Inline (fl_static_readqueue);
function fl_static_get_scheme
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_static_get_scheme, "fl_static_get_scheme");
pragma Inline (fl_static_get_scheme);
procedure fl_static_set_scheme
(S : in Interfaces.C.char_array);
pragma Import (C, fl_static_set_scheme, "fl_static_set_scheme");
pragma Inline (fl_static_set_scheme);
function fl_static_is_scheme
(S : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_static_is_scheme, "fl_static_is_scheme");
pragma Inline (fl_static_is_scheme);
function fl_static_get_option
(O : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_static_get_option, "fl_static_get_option");
pragma Inline (fl_static_get_option);
procedure fl_static_set_option
(O, T : in Interfaces.C.int);
pragma Import (C, fl_static_set_option, "fl_static_set_option");
pragma Inline (fl_static_set_option);
function fl_static_get_scrollbar_size
return Interfaces.C.int;
pragma Import (C, fl_static_get_scrollbar_size, "fl_static_get_scrollbar_size");
pragma Inline (fl_static_get_scrollbar_size);
procedure fl_static_set_scrollbar_size
(S : in Interfaces.C.int);
pragma Import (C, fl_static_set_scrollbar_size, "fl_static_set_scrollbar_size");
pragma Inline (fl_static_set_scrollbar_size);
package Widget_Convert is new System.Address_To_Access_Conversions
(FLTK.Widgets.Widget'Class);
package Window_Convert is new System.Address_To_Access_Conversions
(FLTK.Widgets.Groups.Windows.Window'Class);
function fl_widget_get_user_data
(W : in System.Address)
return System.Address;
pragma Import (C, fl_widget_get_user_data, "fl_widget_get_user_data");
package Awake_Convert is
function To_Pointer is new Ada.Unchecked_Conversion (System.Address, Awake_Handler);
function To_Address is new Ada.Unchecked_Conversion (Awake_Handler, System.Address);
end Awake_Convert;
procedure Awake_Hook
(U : in System.Address);
pragma Convention (C, Awake_Hook);
procedure Awake_Hook
(U : in System.Address) is
begin
Awake_Convert.To_Pointer (U).all;
end Awake_Hook;
procedure Add_Awake_Handler
(Func : in Awake_Handler) is
begin
fl_static_add_awake_handler
(Awake_Hook'Address,
Awake_Convert.To_Address (Func));
end Add_Awake_Handler;
function Get_Awake_Handler
return Awake_Handler
is
Hook, Func : System.Address;
begin
fl_static_get_awake_handler (Hook, Func);
return Awake_Convert.To_Pointer (Func);
end Get_Awake_Handler;
package Timeout_Convert is
function To_Pointer is new Ada.Unchecked_Conversion (System.Address, Timeout_Handler);
function To_Address is new Ada.Unchecked_Conversion (Timeout_Handler, System.Address);
end Timeout_Convert;
procedure Timeout_Hook
(U : in System.Address);
pragma Convention (C, Timeout_Hook);
procedure Timeout_Hook
(U : in System.Address) is
begin
Timeout_Convert.To_Pointer (U).all;
end Timeout_Hook;
procedure Add_Check
(Func : in Timeout_Handler) is
begin
fl_static_add_check
(Timeout_Hook'Address,
Timeout_Convert.To_Address (Func));
end Add_Check;
function Has_Check
(Func : in Timeout_Handler)
return Boolean is
begin
return fl_static_has_check
(Timeout_Hook'Address,
Timeout_Convert.To_Address (Func)) /= 0;
end Has_Check;
procedure Remove_Check
(Func : in Timeout_Handler) is
begin
fl_static_remove_check
(Timeout_Hook'Address,
Timeout_Convert.To_Address (Func));
end Remove_Check;
procedure Add_Timeout
(Seconds : in Long_Float;
Func : in Timeout_Handler) is
begin
fl_static_add_timeout
(Interfaces.C.double (Seconds),
Timeout_Hook'Address,
Timeout_Convert.To_Address (Func));
end Add_Timeout;
function Has_Timeout
(Func : in Timeout_Handler)
return Boolean is
begin
return fl_static_has_timeout
(Timeout_Hook'Address,
Timeout_Convert.To_Address (Func)) /= 0;
end Has_Timeout;
procedure Remove_Timeout
(Func : in Timeout_Handler) is
begin
fl_static_remove_timeout
(Timeout_Hook'Address,
Timeout_Convert.To_Address (Func));
end Remove_Timeout;
procedure Repeat_Timeout
(Seconds : in Long_Float;
Func : in Timeout_Handler) is
begin
fl_static_repeat_timeout
(Interfaces.C.double (Seconds),
Timeout_Hook'Address,
Timeout_Convert.To_Address (Func));
end Repeat_Timeout;
package Clipboard_Convert is
function To_Pointer is new Ada.Unchecked_Conversion
(System.Address, Clipboard_Notify_Handler);
function To_Address is new Ada.Unchecked_Conversion
(Clipboard_Notify_Handler, System.Address);
end Clipboard_Convert;
Current_Clipboard_Notify : Clipboard_Notify_Handler;
procedure Clipboard_Notify_Hook
(S : in Interfaces.C.int;
U : in System.Address);
pragma Convention (C, Clipboard_Notify_Hook);
procedure Clipboard_Notify_Hook
(S : in Interfaces.C.int;
U : in System.Address) is
begin
if Current_Clipboard_Notify /= null then
Current_Clipboard_Notify.all (Buffer_Kind'Val (S));
end if;
end Clipboard_Notify_Hook;
procedure Add_Clipboard_Notify
(Func : in Clipboard_Notify_Handler) is
begin
Current_Clipboard_Notify := Func;
end Add_Clipboard_Notify;
procedure Remove_Clipboard_Notify
(Func : in Clipboard_Notify_Handler) is
begin
Current_Clipboard_Notify := null;
end Remove_Clipboard_Notify;
package FD_Convert is
function To_Pointer is new Ada.Unchecked_Conversion (System.Address, File_Handler);
function To_Address is new Ada.Unchecked_Conversion (File_Handler, System.Address);
end FD_Convert;
procedure FD_Hook
(FD : in Interfaces.C.int;
U : in System.Address);
pragma Convention (C, FD_Hook);
procedure FD_Hook
(FD : in Interfaces.C.int;
U : in System.Address) is
begin
FD_Convert.To_Pointer (U).all (File_Descriptor (FD));
end FD_Hook;
procedure Add_File_Descriptor
(FD : in File_Descriptor;
Func : in File_Handler) is
begin
fl_static_add_fd
(Interfaces.C.int (FD),
FD_Hook'Address,
FD_Convert.To_Address (Func));
end Add_File_Descriptor;
procedure Add_File_Descriptor
(FD : in File_Descriptor;
Mode : in File_Mode;
Func : in File_Handler) is
begin
fl_static_add_fd2
(Interfaces.C.int (FD),
File_Mode_Codes (Mode),
FD_Hook'Address,
FD_Convert.To_Address (Func));
end Add_File_Descriptor;
procedure Remove_File_Descriptor
(FD : in File_Descriptor) is
begin
fl_static_remove_fd (Interfaces.C.int (FD));
end Remove_File_Descriptor;
procedure Remove_File_Descriptor
(FD : in File_Descriptor;
Mode : in File_Mode) is
begin
fl_static_remove_fd2 (Interfaces.C.int (FD), File_Mode_Codes (Mode));
end Remove_File_Descriptor;
package Idle_Convert is
function To_Pointer is new Ada.Unchecked_Conversion (System.Address, Idle_Handler);
function To_Address is new Ada.Unchecked_Conversion (Idle_Handler, System.Address);
end Idle_Convert;
procedure Idle_Hook
(U : in System.Address);
pragma Convention (C, Idle_Hook);
procedure Idle_Hook
(U : in System.Address) is
begin
Idle_Convert.To_Pointer (U).all;
end Idle_Hook;
procedure Add_Idle
(Func : in Idle_Handler) is
begin
fl_static_add_idle
(Idle_Hook'Address,
Idle_Convert.To_Address (Func));
end Add_Idle;
function Has_Idle
(Func : in Idle_Handler)
return Boolean is
begin
return fl_static_has_idle
(Idle_Hook'Address,
Idle_Convert.To_Address (Func)) /= 0;
end Has_Idle;
procedure Remove_Idle
(Func : in Idle_Handler) is
begin
fl_static_remove_idle
(Idle_Hook'Address,
Idle_Convert.To_Address (Func));
end Remove_Idle;
procedure Get_Color
(From : in Color;
R, G, B : out Color_Component) is
begin
fl_static_get_color
(Interfaces.C.unsigned (From),
Interfaces.C.unsigned_char (R),
Interfaces.C.unsigned_char (G),
Interfaces.C.unsigned_char (B));
end Get_Color;
procedure Set_Color
(To : in Color;
R, G, B : in Color_Component) is
begin
fl_static_set_color
(Interfaces.C.unsigned (To),
Interfaces.C.unsigned_char (R),
Interfaces.C.unsigned_char (G),
Interfaces.C.unsigned_char (B));
end Set_Color;
procedure Free_Color
(Value : in Color;
Overlay : in Boolean := False) is
begin
fl_static_free_color
(Interfaces.C.unsigned (Value),
Boolean'Pos (Overlay));
end Free_Color;
procedure Set_Foreground
(R, G, B : in Color_Component) is
begin
fl_static_foreground
(Interfaces.C.unsigned_char (R),
Interfaces.C.unsigned_char (G),
Interfaces.C.unsigned_char (B));
end Set_Foreground;
procedure Set_Background
(R, G, B : in Color_Component) is
begin
fl_static_background
(Interfaces.C.unsigned_char (R),
Interfaces.C.unsigned_char (G),
Interfaces.C.unsigned_char (B));
end Set_Background;
procedure Set_Alt_Background
(R, G, B : in Color_Component) is
begin
fl_static_background2
(Interfaces.C.unsigned_char (R),
Interfaces.C.unsigned_char (G),
Interfaces.C.unsigned_char (B));
end Set_Alt_Background;
function Font_Image
(Kind : in Font_Kind)
return String is
begin
-- should never get a null string in return since it's from an enum
return Interfaces.C.Strings.Value (fl_static_get_font (Font_Kind'Pos (Kind)));
end Font_Image;
function Font_Family_Image
(Kind : in Font_Kind)
return String is
begin
-- should never get a null string in return since it's from an enum
return Interfaces.C.Strings.Value (fl_static_get_font_name (Font_Kind'Pos (Kind)));
end Font_Family_Image;
procedure Set_Font_Kind
(To, From : in Font_Kind) is
begin
fl_static_set_font (Font_Kind'Pos (To), Font_Kind'Pos (From));
end Set_Font_Kind;
function Font_Sizes
(Kind : in Font_Kind)
return Font_Size_Array
is
Ptr : System.Address;
Arr : Font_Size_Array
(1 .. Integer (fl_static_get_font_sizes (Font_Kind'Pos (Kind), Ptr)));
begin
-- This array copying avoids any worry that the static buffer will be overwritten.
for I in 1 .. Arr'Length loop
Arr (I) := Font_Size (fl_static_font_size_array_get (Ptr, Interfaces.C.int (I)));
end loop;
return Arr;
end Font_Sizes;
procedure Setup_Fonts
(How_Many_Set_Up : out Natural) is
begin
How_Many_Set_Up := Natural (fl_static_set_fonts);
end Setup_Fonts;
function Get_Box_Height_Offset
(Kind : in Box_Kind)
return Integer is
begin
return Integer (fl_static_box_dh (Box_Kind'Pos (Kind)));
end Get_Box_Height_Offset;
function Get_Box_Width_Offset
(Kind : in Box_Kind)
return Integer is
begin
return Integer (fl_static_box_dw (Box_Kind'Pos (Kind)));
end Get_Box_Width_Offset;
function Get_Box_X_Offset
(Kind : in Box_Kind)
return Integer is
begin
return Integer (fl_static_box_dx (Box_Kind'Pos (Kind)));
end Get_Box_X_Offset;
function Get_Box_Y_Offset
(Kind : in Box_Kind)
return Integer is
begin
return Integer (fl_static_box_dy (Box_Kind'Pos (Kind)));
end Get_Box_Y_Offset;
procedure Set_Box_Kind
(To, From : in Box_Kind) is
begin
fl_static_set_boxtype (Box_Kind'Pos (To), Box_Kind'Pos (From));
end Set_Box_Kind;
function Draw_Box_Active
return Boolean is
begin
return fl_static_draw_box_active /= 0;
end Draw_Box_Active;
-- function Get_Box_Draw_Function
-- (Kind : in Box_Kind)
-- return Box_Draw_Function is
-- begin
-- return null;
-- end Get_Box_Draw_Function;
-- procedure Set_Box_Draw_Function
-- (Kind : in Box_Kind;
-- Func : in Box_Draw_Function;
-- Offset_X, Offset_Y : in Integer := 0;
-- Offset_W, Offset_H : in Integer := 0) is
-- begin
-- null;
-- end Set_Box_Draw_Function;
procedure Copy
(Text : in String;
Dest : in Buffer_Kind) is
begin
fl_static_copy
(Interfaces.C.To_C (Text),
Text'Length,
Buffer_Kind'Pos (Dest));
end Copy;
procedure Paste
(Receiver : in FLTK.Widgets.Widget'Class;
Source : in Buffer_Kind) is
begin
fl_static_paste
(Wrapper (Receiver).Void_Ptr,
Buffer_Kind'Pos (Source));
end Paste;
procedure Selection
(Owner : in FLTK.Widgets.Widget'Class;
Text : in String) is
begin
fl_static_selection
(Wrapper (Owner).Void_Ptr,
Interfaces.C.To_C (Text),
Text'Length);
end Selection;
function Get_Drag_Drop_Text_Support
return Boolean is
begin
return fl_static_get_dnd_text_ops /= 0;
end Get_Drag_Drop_Text_Support;
procedure Set_Drag_Drop_Text_Support
(To : in Boolean) is
begin
fl_static_set_dnd_text_ops (Boolean'Pos (To));
end Set_Drag_Drop_Text_Support;
function Has_Visible_Focus
return Boolean is
begin
return fl_static_get_visible_focus /= 0;
end Has_Visible_Focus;
procedure Set_Visible_Focus
(To : in Boolean) is
begin
fl_static_set_visible_focus (Boolean'Pos (To));
end Set_Visible_Focus;
procedure Default_Window_Close
(Item : in out FLTK.Widgets.Widget'Class) is
begin
fl_static_default_atclose (Wrapper (Item).Void_Ptr);
end Default_Window_Close;
function Get_First_Window
return access FLTK.Widgets.Groups.Windows.Window'Class is
begin
return Window_Convert.To_Pointer
(fl_widget_get_user_data (fl_static_get_first_window));
end Get_First_Window;
procedure Set_First_Window
(To : in FLTK.Widgets.Groups.Windows.Window'Class) is
begin
fl_static_set_first_window (Wrapper (To).Void_Ptr);
end Set_First_Window;
function Get_Next_Window
(From : in FLTK.Widgets.Groups.Windows.Window'Class)
return access FLTK.Widgets.Groups.Windows.Window'Class is
begin
return Window_Convert.To_Pointer
(fl_widget_get_user_data (fl_static_next_window (Wrapper (From).Void_Ptr)));
end Get_Next_Window;
function Get_Top_Modal
return access FLTK.Widgets.Groups.Windows.Window'Class is
begin
return Window_Convert.To_Pointer (fl_widget_get_user_data (fl_static_modal));
end Get_Top_Modal;
function Read_Queue
return access FLTK.Widgets.Widget'Class is
begin
return Widget_Convert.To_Pointer (fl_widget_get_user_data (fl_static_readqueue));
end Read_Queue;
function Get_Scheme
return String
is
Ptr : Interfaces.C.Strings.chars_ptr := fl_static_get_scheme;
begin
if Ptr = Interfaces.C.Strings.Null_Ptr then
return "";
else
return Interfaces.C.Strings.Value (Ptr);
end if;
end Get_Scheme;
procedure Set_Scheme
(To : in String) is
begin
fl_static_set_scheme (Interfaces.C.To_C (To));
end Set_Scheme;
function Is_Scheme
(Scheme : in String)
return Boolean is
begin
return fl_static_is_scheme (Interfaces.C.To_C (Scheme)) /= 0;
end Is_Scheme;
function Get_Option
(Opt : in Option)
return Boolean is
begin
return fl_static_get_option (Option'Pos (Opt)) /= 0;
end Get_Option;
procedure Set_Option
(Opt : in Option;
To : in Boolean) is
begin
fl_static_set_option (Option'Pos (Opt), Boolean'Pos (To));
end Set_Option;
function Get_Default_Scrollbar_Size
return Natural is
begin
return Natural (fl_static_get_scrollbar_size);
end Get_Default_Scrollbar_Size;
procedure Set_Default_Scrollbar_Size
(To : in Natural) is
begin
fl_static_set_scrollbar_size (Interfaces.C.int (To));
end Set_Default_Scrollbar_Size;
begin
fl_static_add_clipboard_notify (Clipboard_Notify_Hook'Address, System.Null_Address);
end FLTK.Static;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . B I G N U M S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2012-2020, 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. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with System.Generic_Bignums;
with System.Secondary_Stack; use System.Secondary_Stack;
with System.Shared_Bignums; use System.Shared_Bignums;
with System.Storage_Elements; use System.Storage_Elements;
package body System.Bignums is
function Allocate_Bignum (D : Digit_Vector; Neg : Boolean) return Bignum;
-- Allocate Bignum value with the given contents
procedure Free_Bignum (X : in out Bignum) is null;
-- No op when using the secondary stack
function To_Bignum (X : aliased in out Bignum) return Bignum is (X);
---------------------
-- Allocate_Bignum --
---------------------
function Allocate_Bignum (D : Digit_Vector; Neg : Boolean) return Bignum is
Addr : aliased Address;
begin
-- Note: The approach used here is designed to avoid strict aliasing
-- warnings that appeared previously using unchecked conversion.
SS_Allocate (Addr, Storage_Offset (4 + 4 * D'Length));
declare
B : Bignum;
for B'Address use Addr'Address;
pragma Import (Ada, B);
BD : Bignum_Data (D'Length);
for BD'Address use Addr;
pragma Import (Ada, BD);
-- Expose a writable view of discriminant BD.Len so that we can
-- initialize it. We need to use the exact layout of the record
-- to ensure that the Length field has 24 bits as expected.
type Bignum_Data_Header is record
Len : Length;
Neg : Boolean;
end record;
for Bignum_Data_Header use record
Len at 0 range 0 .. 23;
Neg at 3 range 0 .. 7;
end record;
BDH : Bignum_Data_Header;
for BDH'Address use BD'Address;
pragma Import (Ada, BDH);
pragma Assert (BDH.Len'Size = BD.Len'Size);
begin
BDH.Len := D'Length;
BDH.Neg := Neg;
B.D := D;
return B;
end;
end Allocate_Bignum;
package Sec_Stack_Bignums is new System.Generic_Bignums
(Bignum, Allocate_Bignum, Free_Bignum, To_Bignum);
function Big_Add (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Add;
function Big_Sub (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Sub;
function Big_Mul (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Mul;
function Big_Div (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Div;
function Big_Exp (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Exp;
function Big_Mod (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Mod;
function Big_Rem (X, Y : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Rem;
function Big_Neg (X : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Neg;
function Big_Abs (X : Bignum) return Bignum
renames Sec_Stack_Bignums.Big_Abs;
function Big_EQ (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_EQ;
function Big_NE (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_NE;
function Big_GE (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_GE;
function Big_LE (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_LE;
function Big_GT (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_GT;
function Big_LT (X, Y : Bignum) return Boolean
renames Sec_Stack_Bignums.Big_LT;
function Bignum_In_LLI_Range (X : Bignum) return Boolean
renames Sec_Stack_Bignums.Bignum_In_LLI_Range;
function To_Bignum (X : Long_Long_Integer) return Bignum
renames Sec_Stack_Bignums.To_Bignum;
function From_Bignum (X : Bignum) return Long_Long_Integer
renames Sec_Stack_Bignums.From_Bignum;
end System.Bignums;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B I N D O . V A L I D A T O R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2019-2020, 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 Debug; use Debug;
with Output; use Output;
with Types; use Types;
with Bindo.Units;
use Bindo.Units;
with Bindo.Writers;
use Bindo.Writers;
use Bindo.Writers.Phase_Writers;
package body Bindo.Validators is
-----------------------
-- Local subprograms --
-----------------------
procedure Write_Error
(Msg : String;
Flag : out Boolean);
pragma Inline (Write_Error);
-- Write error message Msg to standard output and set flag Flag to True
----------------------
-- Cycle_Validators --
----------------------
package body Cycle_Validators is
Has_Invalid_Cycle : Boolean := False;
-- Flag set when the library graph contains an invalid cycle
-----------------------
-- Local subprograms --
-----------------------
procedure Validate_Cycle
(G : Library_Graph;
Cycle : Library_Graph_Cycle_Id);
pragma Inline (Validate_Cycle);
-- Ensure that a cycle meets the following requirements:
--
-- * Is of proper kind
-- * Has enough edges to form a circuit
-- * No edge is repeated
procedure Validate_Cycle_Path
(G : Library_Graph;
Cycle : Library_Graph_Cycle_Id);
pragma Inline (Validate_Cycle_Path);
-- Ensure that the path of a cycle meets the following requirements:
--
-- * No edge is repeated
--------------------
-- Validate_Cycle --
--------------------
procedure Validate_Cycle
(G : Library_Graph;
Cycle : Library_Graph_Cycle_Id)
is
Msg : constant String := "Validate_Cycle";
begin
pragma Assert (Present (G));
if not Present (Cycle) then
Write_Error (Msg, Has_Invalid_Cycle);
Write_Str (" empty cycle");
Write_Eol;
Write_Eol;
return;
end if;
if Kind (G, Cycle) = No_Cycle_Kind then
Write_Error (Msg, Has_Invalid_Cycle);
Write_Str (" cycle (LGC_Id_");
Write_Int (Int (Cycle));
Write_Str (") is a No_Cycle");
Write_Eol;
Write_Eol;
end if;
-- A cycle requires at least one edge (self cycle) to form a circuit
if Length (G, Cycle) < 1 then
Write_Error (Msg, Has_Invalid_Cycle);
Write_Str (" cycle (LGC_Id_");
Write_Int (Int (Cycle));
Write_Str (") does not contain enough edges");
Write_Eol;
Write_Eol;
end if;
Validate_Cycle_Path (G, Cycle);
end Validate_Cycle;
-------------------------
-- Validate_Cycle_Path --
-------------------------
procedure Validate_Cycle_Path
(G : Library_Graph;
Cycle : Library_Graph_Cycle_Id)
is
Msg : constant String := "Validate_Cycle_Path";
Edge : Library_Graph_Edge_Id;
Edges : LGE_Sets.Membership_Set;
Iter : Edges_Of_Cycle_Iterator;
begin
pragma Assert (Present (G));
pragma Assert (Present (Cycle));
-- Use a set to detect duplicate edges while traversing the cycle
Edges := LGE_Sets.Create (Length (G, Cycle));
-- Inspect the edges of the cycle, trying to catch duplicates
Iter := Iterate_Edges_Of_Cycle (G, Cycle);
while Has_Next (Iter) loop
Next (Iter, Edge);
-- The current edge has already been encountered while traversing
-- the cycle. This indicates that the cycle is malformed as edges
-- are not repeated in the circuit.
if LGE_Sets.Contains (Edges, Edge) then
Write_Error (Msg, Has_Invalid_Cycle);
Write_Str (" library graph edge (LGE_Id_");
Write_Int (Int (Edge));
Write_Str (") is repeated in cycle (LGC_Id_");
Write_Int (Int (Cycle));
Write_Str (")");
Write_Eol;
-- Otherwise add the current edge to the set of encountered edges
else
LGE_Sets.Insert (Edges, Edge);
end if;
end loop;
LGE_Sets.Destroy (Edges);
end Validate_Cycle_Path;
---------------------
-- Validate_Cycles --
---------------------
procedure Validate_Cycles (G : Library_Graph) is
Cycle : Library_Graph_Cycle_Id;
Iter : All_Cycle_Iterator;
begin
pragma Assert (Present (G));
-- Nothing to do when switch -d_V (validate bindo cycles, graphs, and
-- order) is not in effect.
if not Debug_Flag_Underscore_VV then
return;
end if;
Start_Phase (Cycle_Validation);
Iter := Iterate_All_Cycles (G);
while Has_Next (Iter) loop
Next (Iter, Cycle);
Validate_Cycle (G, Cycle);
end loop;
End_Phase (Cycle_Validation);
if Has_Invalid_Cycle then
raise Invalid_Cycle;
end if;
end Validate_Cycles;
end Cycle_Validators;
----------------------------------
-- Elaboration_Order_Validators --
----------------------------------
package body Elaboration_Order_Validators is
Has_Invalid_Data : Boolean := False;
-- Flag set when the elaboration order contains invalid data
-----------------------
-- Local subprograms --
-----------------------
function Build_Elaborable_Unit_Set return Unit_Sets.Membership_Set;
pragma Inline (Build_Elaborable_Unit_Set);
-- Create a set from all units that need to be elaborated
procedure Report_Missing_Elaboration (U_Id : Unit_Id);
pragma Inline (Report_Missing_Elaboration);
-- Emit an error concerning unit U_Id that must be elaborated, but was
-- not.
procedure Report_Missing_Elaborations (Set : Unit_Sets.Membership_Set);
pragma Inline (Report_Missing_Elaborations);
-- Emit errors on all units in set Set that must be elaborated, but were
-- not.
procedure Report_Spurious_Elaboration (U_Id : Unit_Id);
pragma Inline (Report_Spurious_Elaboration);
-- Emit an error concerning unit U_Id that is incorrectly elaborated
procedure Validate_Unit
(U_Id : Unit_Id;
Elab_Set : Unit_Sets.Membership_Set);
pragma Inline (Validate_Unit);
-- Validate the elaboration status of unit U_Id. Elab_Set is the set of
-- all units that need to be elaborated.
procedure Validate_Units (Order : Unit_Id_Table);
pragma Inline (Validate_Units);
-- Validate all units in elaboration order Order
-------------------------------
-- Build_Elaborable_Unit_Set --
-------------------------------
function Build_Elaborable_Unit_Set return Unit_Sets.Membership_Set is
Iter : Elaborable_Units_Iterator;
Set : Unit_Sets.Membership_Set;
U_Id : Unit_Id;
begin
Set := Unit_Sets.Create (Number_Of_Elaborable_Units);
Iter := Iterate_Elaborable_Units;
while Has_Next (Iter) loop
Next (Iter, U_Id);
Unit_Sets.Insert (Set, U_Id);
end loop;
return Set;
end Build_Elaborable_Unit_Set;
--------------------------------
-- Report_Missing_Elaboration --
--------------------------------
procedure Report_Missing_Elaboration (U_Id : Unit_Id) is
Msg : constant String := "Report_Missing_Elaboration";
begin
pragma Assert (Present (U_Id));
Write_Error (Msg, Has_Invalid_Data);
Write_Str ("unit (U_Id_");
Write_Int (Int (U_Id));
Write_Str (") name = ");
Write_Name (Name (U_Id));
Write_Str (" must be elaborated");
Write_Eol;
end Report_Missing_Elaboration;
---------------------------------
-- Report_Missing_Elaborations --
---------------------------------
procedure Report_Missing_Elaborations (Set : Unit_Sets.Membership_Set) is
Iter : Unit_Sets.Iterator;
U_Id : Unit_Id;
begin
Iter := Unit_Sets.Iterate (Set);
while Unit_Sets.Has_Next (Iter) loop
Unit_Sets.Next (Iter, U_Id);
Report_Missing_Elaboration (U_Id);
end loop;
end Report_Missing_Elaborations;
---------------------------------
-- Report_Spurious_Elaboration --
---------------------------------
procedure Report_Spurious_Elaboration (U_Id : Unit_Id) is
Msg : constant String := "Report_Spurious_Elaboration";
begin
pragma Assert (Present (U_Id));
Write_Error (Msg, Has_Invalid_Data);
Write_Str ("unit (U_Id_");
Write_Int (Int (U_Id));
Write_Str (") name = ");
Write_Name (Name (U_Id));
Write_Str (" must not be elaborated");
end Report_Spurious_Elaboration;
--------------------------------
-- Validate_Elaboration_Order --
--------------------------------
procedure Validate_Elaboration_Order (Order : Unit_Id_Table) is
begin
-- Nothing to do when switch -d_V (validate bindo cycles, graphs, and
-- order) is not in effect.
if not Debug_Flag_Underscore_VV then
return;
end if;
Start_Phase (Elaboration_Order_Validation);
Validate_Units (Order);
End_Phase (Elaboration_Order_Validation);
if Has_Invalid_Data then
raise Invalid_Elaboration_Order;
end if;
end Validate_Elaboration_Order;
-------------------
-- Validate_Unit --
-------------------
procedure Validate_Unit
(U_Id : Unit_Id;
Elab_Set : Unit_Sets.Membership_Set)
is
begin
pragma Assert (Present (U_Id));
-- The current unit in the elaboration order appears within the set
-- of units that require elaboration. Remove it from the set.
if Unit_Sets.Contains (Elab_Set, U_Id) then
Unit_Sets.Delete (Elab_Set, U_Id);
-- Otherwise the current unit in the elaboration order must not be
-- elaborated.
else
Report_Spurious_Elaboration (U_Id);
end if;
end Validate_Unit;
--------------------
-- Validate_Units --
--------------------
procedure Validate_Units (Order : Unit_Id_Table) is
Elab_Set : Unit_Sets.Membership_Set;
begin
-- Collect all units in the compilation that need to be elaborated
-- in a set.
Elab_Set := Build_Elaborable_Unit_Set;
-- Validate each unit in the elaboration order against the set of
-- units that need to be elaborated.
for Index in Unit_Id_Tables.First .. Unit_Id_Tables.Last (Order) loop
Validate_Unit
(U_Id => Order.Table (Index),
Elab_Set => Elab_Set);
end loop;
-- At this point all units that need to be elaborated should have
-- been eliminated from the set. Report any units that are missing
-- their elaboration.
Report_Missing_Elaborations (Elab_Set);
Unit_Sets.Destroy (Elab_Set);
end Validate_Units;
end Elaboration_Order_Validators;
---------------------------------
-- Invocation_Graph_Validators --
---------------------------------
package body Invocation_Graph_Validators is
Has_Invalid_Data : Boolean := False;
-- Flag set when the invocation graph contains invalid data
-----------------------
-- Local subprograms --
-----------------------
procedure Validate_Invocation_Graph_Edge
(G : Invocation_Graph;
Edge : Invocation_Graph_Edge_Id);
pragma Inline (Validate_Invocation_Graph_Edge);
-- Verify that the attributes of edge Edge of invocation graph G are
-- properly set.
procedure Validate_Invocation_Graph_Edges (G : Invocation_Graph);
pragma Inline (Validate_Invocation_Graph_Edges);
-- Verify that the attributes of all edges of invocation graph G are
-- properly set.
procedure Validate_Invocation_Graph_Vertex
(G : Invocation_Graph;
Vertex : Invocation_Graph_Vertex_Id);
pragma Inline (Validate_Invocation_Graph_Vertex);
-- Verify that the attributes of vertex Vertex of invocation graph G are
-- properly set.
procedure Validate_Invocation_Graph_Vertices (G : Invocation_Graph);
pragma Inline (Validate_Invocation_Graph_Vertices);
-- Verify that the attributes of all vertices of invocation graph G are
-- properly set.
-------------------------------
-- Validate_Invocation_Graph --
-------------------------------
procedure Validate_Invocation_Graph (G : Invocation_Graph) is
begin
pragma Assert (Present (G));
-- Nothing to do when switch -d_V (validate bindo cycles, graphs, and
-- order) is not in effect.
if not Debug_Flag_Underscore_VV then
return;
end if;
Start_Phase (Invocation_Graph_Validation);
Validate_Invocation_Graph_Vertices (G);
Validate_Invocation_Graph_Edges (G);
End_Phase (Invocation_Graph_Validation);
if Has_Invalid_Data then
raise Invalid_Invocation_Graph;
end if;
end Validate_Invocation_Graph;
------------------------------------
-- Validate_Invocation_Graph_Edge --
------------------------------------
procedure Validate_Invocation_Graph_Edge
(G : Invocation_Graph;
Edge : Invocation_Graph_Edge_Id)
is
Msg : constant String := "Validate_Invocation_Graph_Edge";
begin
pragma Assert (Present (G));
if not Present (Edge) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" empty invocation graph edge");
Write_Eol;
Write_Eol;
return;
end if;
if not Present (Relation (G, Edge)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" invocation graph edge (IGE_Id_");
Write_Int (Int (Edge));
Write_Str (") lacks Relation");
Write_Eol;
Write_Eol;
end if;
if not Present (Target (G, Edge)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" invocation graph edge (IGE_Id_");
Write_Int (Int (Edge));
Write_Str (") lacks Target");
Write_Eol;
Write_Eol;
end if;
end Validate_Invocation_Graph_Edge;
-------------------------------------
-- Validate_Invocation_Graph_Edges --
-------------------------------------
procedure Validate_Invocation_Graph_Edges (G : Invocation_Graph) is
Edge : Invocation_Graph_Edge_Id;
Iter : Invocation_Graphs.All_Edge_Iterator;
begin
pragma Assert (Present (G));
Iter := Iterate_All_Edges (G);
while Has_Next (Iter) loop
Next (Iter, Edge);
Validate_Invocation_Graph_Edge (G, Edge);
end loop;
end Validate_Invocation_Graph_Edges;
--------------------------------------
-- Validate_Invocation_Graph_Vertex --
--------------------------------------
procedure Validate_Invocation_Graph_Vertex
(G : Invocation_Graph;
Vertex : Invocation_Graph_Vertex_Id)
is
Msg : constant String := "Validate_Invocation_Graph_Vertex";
begin
pragma Assert (Present (G));
if not Present (Vertex) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" empty invocation graph vertex");
Write_Eol;
Write_Eol;
return;
end if;
if not Present (Body_Vertex (G, Vertex)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" invocation graph vertex (IGV_Id_");
Write_Int (Int (Vertex));
Write_Str (") lacks Body_Vertex");
Write_Eol;
Write_Eol;
end if;
if not Present (Construct (G, Vertex)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" invocation graph vertex (IGV_Id_");
Write_Int (Int (Vertex));
Write_Str (") lacks Construct");
Write_Eol;
Write_Eol;
end if;
if not Present (Spec_Vertex (G, Vertex)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" invocation graph vertex (IGV_Id_");
Write_Int (Int (Vertex));
Write_Str (") lacks Spec_Vertex");
Write_Eol;
Write_Eol;
end if;
end Validate_Invocation_Graph_Vertex;
----------------------------------------
-- Validate_Invocation_Graph_Vertices --
----------------------------------------
procedure Validate_Invocation_Graph_Vertices (G : Invocation_Graph) is
Iter : Invocation_Graphs.All_Vertex_Iterator;
Vertex : Invocation_Graph_Vertex_Id;
begin
pragma Assert (Present (G));
Iter := Iterate_All_Vertices (G);
while Has_Next (Iter) loop
Next (Iter, Vertex);
Validate_Invocation_Graph_Vertex (G, Vertex);
end loop;
end Validate_Invocation_Graph_Vertices;
end Invocation_Graph_Validators;
------------------------------
-- Library_Graph_Validators --
------------------------------
package body Library_Graph_Validators is
Has_Invalid_Data : Boolean := False;
-- Flag set when the library graph contains invalid data
-----------------------
-- Local subprograms --
-----------------------
procedure Validate_Library_Graph_Edge
(G : Library_Graph;
Edge : Library_Graph_Edge_Id);
pragma Inline (Validate_Library_Graph_Edge);
-- Verify that the attributes of edge Edge of library graph G are
-- properly set.
procedure Validate_Library_Graph_Edges (G : Library_Graph);
pragma Inline (Validate_Library_Graph_Edges);
-- Verify that the attributes of all edges of library graph G are
-- properly set.
procedure Validate_Library_Graph_Vertex
(G : Library_Graph;
Vertex : Library_Graph_Vertex_Id);
pragma Inline (Validate_Library_Graph_Vertex);
-- Verify that the attributes of vertex Vertex of library graph G are
-- properly set.
procedure Validate_Library_Graph_Vertices (G : Library_Graph);
pragma Inline (Validate_Library_Graph_Vertices);
-- Verify that the attributes of all vertices of library graph G are
-- properly set.
----------------------------
-- Validate_Library_Graph --
----------------------------
procedure Validate_Library_Graph (G : Library_Graph) is
begin
pragma Assert (Present (G));
-- Nothing to do when switch -d_V (validate bindo cycles, graphs, and
-- order) is not in effect.
if not Debug_Flag_Underscore_VV then
return;
end if;
Start_Phase (Library_Graph_Validation);
Validate_Library_Graph_Vertices (G);
Validate_Library_Graph_Edges (G);
End_Phase (Library_Graph_Validation);
if Has_Invalid_Data then
raise Invalid_Library_Graph;
end if;
end Validate_Library_Graph;
---------------------------------
-- Validate_Library_Graph_Edge --
---------------------------------
procedure Validate_Library_Graph_Edge
(G : Library_Graph;
Edge : Library_Graph_Edge_Id)
is
Msg : constant String := "Validate_Library_Graph_Edge";
begin
pragma Assert (Present (G));
if not Present (Edge) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" empty library graph edge");
Write_Eol;
Write_Eol;
return;
end if;
if Kind (G, Edge) = No_Edge then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph edge (LGE_Id_");
Write_Int (Int (Edge));
Write_Str (") is not a valid edge");
Write_Eol;
Write_Eol;
elsif Kind (G, Edge) = Body_Before_Spec_Edge then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph edge (LGE_Id_");
Write_Int (Int (Edge));
Write_Str (") is a Body_Before_Spec edge");
Write_Eol;
Write_Eol;
end if;
if not Present (Predecessor (G, Edge)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph edge (LGE_Id_");
Write_Int (Int (Edge));
Write_Str (") lacks Predecessor");
Write_Eol;
Write_Eol;
end if;
if not Present (Successor (G, Edge)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph edge (LGE_Id_");
Write_Int (Int (Edge));
Write_Str (") lacks Successor");
Write_Eol;
Write_Eol;
end if;
end Validate_Library_Graph_Edge;
----------------------------------
-- Validate_Library_Graph_Edges --
----------------------------------
procedure Validate_Library_Graph_Edges (G : Library_Graph) is
Edge : Library_Graph_Edge_Id;
Iter : Library_Graphs.All_Edge_Iterator;
begin
pragma Assert (Present (G));
Iter := Iterate_All_Edges (G);
while Has_Next (Iter) loop
Next (Iter, Edge);
Validate_Library_Graph_Edge (G, Edge);
end loop;
end Validate_Library_Graph_Edges;
-----------------------------------
-- Validate_Library_Graph_Vertex --
-----------------------------------
procedure Validate_Library_Graph_Vertex
(G : Library_Graph;
Vertex : Library_Graph_Vertex_Id)
is
Msg : constant String := "Validate_Library_Graph_Vertex";
begin
pragma Assert (Present (G));
if not Present (Vertex) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" empty library graph vertex");
Write_Eol;
Write_Eol;
return;
end if;
if (Is_Body_With_Spec (G, Vertex)
or else
Is_Spec_With_Body (G, Vertex))
and then not Present (Corresponding_Item (G, Vertex))
then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph vertex (LGV_Id_");
Write_Int (Int (Vertex));
Write_Str (") lacks Corresponding_Item");
Write_Eol;
Write_Eol;
end if;
if not Present (Unit (G, Vertex)) then
Write_Error (Msg, Has_Invalid_Data);
Write_Str (" library graph vertex (LGV_Id_");
Write_Int (Int (Vertex));
Write_Str (") lacks Unit");
Write_Eol;
Write_Eol;
end if;
end Validate_Library_Graph_Vertex;
-------------------------------------
-- Validate_Library_Graph_Vertices --
-------------------------------------
procedure Validate_Library_Graph_Vertices (G : Library_Graph) is
Iter : Library_Graphs.All_Vertex_Iterator;
Vertex : Library_Graph_Vertex_Id;
begin
pragma Assert (Present (G));
Iter := Iterate_All_Vertices (G);
while Has_Next (Iter) loop
Next (Iter, Vertex);
Validate_Library_Graph_Vertex (G, Vertex);
end loop;
end Validate_Library_Graph_Vertices;
end Library_Graph_Validators;
-----------------
-- Write_Error --
-----------------
procedure Write_Error
(Msg : String;
Flag : out Boolean)
is
begin
Write_Str ("ERROR: ");
Write_Str (Msg);
Write_Eol;
Flag := True;
end Write_Error;
end Bindo.Validators;
|
with SimpleAda;
package Simple_Use_Type is
use type SimpleAda.Device;
stdcout : constant SimpleAda.Device := 0;
stdcerr : constant SimpleAda.Device := 1;
stdcurr : SimpleAda.Device := stdcerr;
end Simple_Use_Type;
|
with Ada.Text_IO, Generic_Divisors;
procedure ADB_Classification is
function Same(P: Positive) return Positive is (P);
package Divisor_Sum is new Generic_Divisors
(Result_Type => Natural, None => 0, One => Same, Add => "+");
type Class_Type is (Deficient, Perfect, Abundant);
function Class(D_Sum, N: Natural) return Class_Type is
(if D_Sum < N then Deficient
elsif D_Sum = N then Perfect
else Abundant);
Cls: Class_Type;
Results: array (Class_Type) of Natural := (others => 0);
package NIO is new Ada.Text_IO.Integer_IO(Natural);
package CIO is new Ada.Text_IO.Enumeration_IO(Class_Type);
begin
for N in 1 .. 20_000 loop
Cls := Class(Divisor_Sum.Process(N), N);
Results(Cls) := Results(Cls)+1;
end loop;
for Class in Results'Range loop
CIO.Put(Class, 12);
NIO.Put(Results(Class), 8);
Ada.Text_IO.New_Line;
end loop;
Ada.Text_IO.Put_Line("--------------------");
Ada.Text_IO.Put("Sum ");
NIO.Put(Results(Deficient)+Results(Perfect)+Results(Abundant), 8);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line("====================");
end ADB_Classification;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- C O N T R A C T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2015-2020, 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 Aspects; use Aspects;
with Atree; use Atree;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Prag; use Exp_Prag;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch12; use Sem_Ch12;
with Sem_Ch13; use Sem_Ch13;
with Sem_Disp; use Sem_Disp;
with Sem_Prag; use Sem_Prag;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Tbuild; use Tbuild;
package body Contracts is
procedure Analyze_Package_Instantiation_Contract (Inst_Id : Entity_Id);
-- Analyze all delayed pragmas chained on the contract of package
-- instantiation Inst_Id as if they appear at the end of a declarative
-- region. The pragmas in question are:
--
-- Part_Of
procedure Check_Type_Or_Object_External_Properties
(Type_Or_Obj_Id : Entity_Id);
-- Perform checking of external properties pragmas that is common to both
-- type declarations and object declarations.
procedure Expand_Subprogram_Contract (Body_Id : Entity_Id);
-- Expand the contracts of a subprogram body and its correspoding spec (if
-- any). This routine processes all [refined] pre- and postconditions as
-- well as Contract_Cases, Subprogram_Variant, invariants and predicates.
-- Body_Id denotes the entity of the subprogram body.
-----------------------
-- Add_Contract_Item --
-----------------------
procedure Add_Contract_Item (Prag : Node_Id; Id : Entity_Id) is
Items : Node_Id := Contract (Id);
procedure Add_Classification;
-- Prepend Prag to the list of classifications
procedure Add_Contract_Test_Case;
-- Prepend Prag to the list of contract and test cases
procedure Add_Pre_Post_Condition;
-- Prepend Prag to the list of pre- and postconditions
------------------------
-- Add_Classification --
------------------------
procedure Add_Classification is
begin
Set_Next_Pragma (Prag, Classifications (Items));
Set_Classifications (Items, Prag);
end Add_Classification;
----------------------------
-- Add_Contract_Test_Case --
----------------------------
procedure Add_Contract_Test_Case is
begin
Set_Next_Pragma (Prag, Contract_Test_Cases (Items));
Set_Contract_Test_Cases (Items, Prag);
end Add_Contract_Test_Case;
----------------------------
-- Add_Pre_Post_Condition --
----------------------------
procedure Add_Pre_Post_Condition is
begin
Set_Next_Pragma (Prag, Pre_Post_Conditions (Items));
Set_Pre_Post_Conditions (Items, Prag);
end Add_Pre_Post_Condition;
-- Local variables
-- A contract must contain only pragmas
pragma Assert (Nkind (Prag) = N_Pragma);
Prag_Nam : constant Name_Id := Pragma_Name (Prag);
-- Start of processing for Add_Contract_Item
begin
-- Create a new contract when adding the first item
if No (Items) then
Items := Make_Contract (Sloc (Id));
Set_Contract (Id, Items);
end if;
-- Constants, the applicable pragmas are:
-- Part_Of
if Ekind (Id) = E_Constant then
if Prag_Nam = Name_Part_Of then
Add_Classification;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Entry bodies, the applicable pragmas are:
-- Refined_Depends
-- Refined_Global
-- Refined_Post
elsif Is_Entry_Body (Id) then
if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then
Add_Classification;
elsif Prag_Nam = Name_Refined_Post then
Add_Pre_Post_Condition;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Entry or subprogram declarations, the applicable pragmas are:
-- Attach_Handler
-- Contract_Cases
-- Depends
-- Extensions_Visible
-- Global
-- Interrupt_Handler
-- Postcondition
-- Precondition
-- Test_Case
-- Volatile_Function
elsif Is_Entry_Declaration (Id)
or else Ekind (Id) in E_Function
| E_Generic_Function
| E_Generic_Procedure
| E_Procedure
then
if Prag_Nam in Name_Attach_Handler | Name_Interrupt_Handler
and then Ekind (Id) in E_Generic_Procedure | E_Procedure
then
Add_Classification;
elsif Prag_Nam in Name_Depends
| Name_Extensions_Visible
| Name_Global
then
Add_Classification;
elsif Prag_Nam = Name_Volatile_Function
and then Ekind (Id) in E_Function | E_Generic_Function
then
Add_Classification;
elsif Prag_Nam in Name_Contract_Cases
| Name_Subprogram_Variant
| Name_Test_Case
then
Add_Contract_Test_Case;
elsif Prag_Nam in Name_Postcondition | Name_Precondition then
Add_Pre_Post_Condition;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Packages or instantiations, the applicable pragmas are:
-- Abstract_States
-- Initial_Condition
-- Initializes
-- Part_Of (instantiation only)
elsif Is_Package_Or_Generic_Package (Id) then
if Prag_Nam in Name_Abstract_State
| Name_Initial_Condition
| Name_Initializes
then
Add_Classification;
-- Indicator Part_Of must be associated with a package instantiation
elsif Prag_Nam = Name_Part_Of and then Is_Generic_Instance (Id) then
Add_Classification;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Package bodies, the applicable pragmas are:
-- Refined_States
elsif Ekind (Id) = E_Package_Body then
if Prag_Nam = Name_Refined_State then
Add_Classification;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- The four volatility refinement pragmas are ok for all types.
-- Part_Of is ok for task types and protected types.
-- Depends and Global are ok for task types.
elsif Is_Type (Id) then
declare
Is_OK : constant Boolean :=
Prag_Nam in Name_Async_Readers
| Name_Async_Writers
| Name_Effective_Reads
| Name_Effective_Writes
or else (Ekind (Id) = E_Task_Type
and Prag_Nam in Name_Part_Of
| Name_Depends
| Name_Global)
or else (Ekind (Id) = E_Protected_Type
and Prag_Nam = Name_Part_Of);
begin
if Is_OK then
Add_Classification;
else
-- The pragma is not a proper contract item
raise Program_Error;
end if;
end;
-- Subprogram bodies, the applicable pragmas are:
-- Postcondition
-- Precondition
-- Refined_Depends
-- Refined_Global
-- Refined_Post
elsif Ekind (Id) = E_Subprogram_Body then
if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then
Add_Classification;
elsif Prag_Nam in Name_Postcondition
| Name_Precondition
| Name_Refined_Post
then
Add_Pre_Post_Condition;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Task bodies, the applicable pragmas are:
-- Refined_Depends
-- Refined_Global
elsif Ekind (Id) = E_Task_Body then
if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then
Add_Classification;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
-- Task units, the applicable pragmas are:
-- Depends
-- Global
-- Part_Of
-- Variables, the applicable pragmas are:
-- Async_Readers
-- Async_Writers
-- Constant_After_Elaboration
-- Depends
-- Effective_Reads
-- Effective_Writes
-- Global
-- No_Caching
-- Part_Of
elsif Ekind (Id) = E_Variable then
if Prag_Nam in Name_Async_Readers
| Name_Async_Writers
| Name_Constant_After_Elaboration
| Name_Depends
| Name_Effective_Reads
| Name_Effective_Writes
| Name_Global
| Name_No_Caching
| Name_Part_Of
then
Add_Classification;
-- The pragma is not a proper contract item
else
raise Program_Error;
end if;
else
raise Program_Error;
end if;
end Add_Contract_Item;
-----------------------
-- Analyze_Contracts --
-----------------------
procedure Analyze_Contracts (L : List_Id) is
Decl : Node_Id;
begin
Decl := First (L);
while Present (Decl) loop
-- Entry or subprogram declarations
if Nkind (Decl) in N_Abstract_Subprogram_Declaration
| N_Entry_Declaration
| N_Generic_Subprogram_Declaration
| N_Subprogram_Declaration
then
declare
Subp_Id : constant Entity_Id := Defining_Entity (Decl);
begin
Analyze_Entry_Or_Subprogram_Contract (Subp_Id);
-- If analysis of a class-wide pre/postcondition indicates
-- that a class-wide clone is needed, analyze its declaration
-- now. Its body is created when the body of the original
-- operation is analyzed (and rewritten).
if Is_Subprogram (Subp_Id)
and then Present (Class_Wide_Clone (Subp_Id))
then
Analyze (Unit_Declaration_Node (Class_Wide_Clone (Subp_Id)));
end if;
end;
-- Entry or subprogram bodies
elsif Nkind (Decl) in N_Entry_Body | N_Subprogram_Body then
Analyze_Entry_Or_Subprogram_Body_Contract (Defining_Entity (Decl));
-- Objects
elsif Nkind (Decl) = N_Object_Declaration then
Analyze_Object_Contract (Defining_Entity (Decl));
-- Package instantiation
elsif Nkind (Decl) = N_Package_Instantiation then
Analyze_Package_Instantiation_Contract (Defining_Entity (Decl));
-- Protected units
elsif Nkind (Decl) in N_Protected_Type_Declaration
| N_Single_Protected_Declaration
then
Analyze_Protected_Contract (Defining_Entity (Decl));
-- Subprogram body stubs
elsif Nkind (Decl) = N_Subprogram_Body_Stub then
Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl));
-- Task units
elsif Nkind (Decl) in N_Single_Task_Declaration
| N_Task_Type_Declaration
then
Analyze_Task_Contract (Defining_Entity (Decl));
-- For type declarations, we need to do the preanalysis of Iterable
-- and the 3 Xxx_Literal aspect specifications.
-- Other type aspects need to be resolved here???
elsif Nkind (Decl) = N_Private_Type_Declaration
and then Present (Aspect_Specifications (Decl))
then
declare
E : constant Entity_Id := Defining_Identifier (Decl);
It : constant Node_Id := Find_Aspect (E, Aspect_Iterable);
I_Lit : constant Node_Id :=
Find_Aspect (E, Aspect_Integer_Literal);
R_Lit : constant Node_Id :=
Find_Aspect (E, Aspect_Real_Literal);
S_Lit : constant Node_Id :=
Find_Aspect (E, Aspect_String_Literal);
begin
if Present (It) then
Validate_Iterable_Aspect (E, It);
end if;
if Present (I_Lit) then
Validate_Literal_Aspect (E, I_Lit);
end if;
if Present (R_Lit) then
Validate_Literal_Aspect (E, R_Lit);
end if;
if Present (S_Lit) then
Validate_Literal_Aspect (E, S_Lit);
end if;
end;
end if;
if Nkind (Decl) in N_Full_Type_Declaration
| N_Private_Type_Declaration
| N_Task_Type_Declaration
| N_Protected_Type_Declaration
| N_Formal_Type_Declaration
then
Analyze_Type_Contract (Defining_Identifier (Decl));
end if;
Next (Decl);
end loop;
end Analyze_Contracts;
-----------------------------------------------
-- Analyze_Entry_Or_Subprogram_Body_Contract --
-----------------------------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Entry_Or_Subprogram_Body_Contract (Body_Id : Entity_Id) is
Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id);
Items : constant Node_Id := Contract (Body_Id);
Spec_Id : constant Entity_Id := Unique_Defining_Entity (Body_Decl);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
begin
-- When a subprogram body declaration is illegal, its defining entity is
-- left unanalyzed. There is nothing left to do in this case because the
-- body lacks a contract, or even a proper Ekind.
if Ekind (Body_Id) = E_Void then
return;
-- Do not analyze a contract multiple times
elsif Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related subprogram body.
Set_SPARK_Mode (Body_Id);
-- Ensure that the contract cases or postconditions mention 'Result or
-- define a post-state.
Check_Result_And_Post_State (Body_Id);
-- A stand-alone nonvolatile function body cannot have an effectively
-- volatile formal parameter or return type (SPARK RM 7.1.3(9)). This
-- check is relevant only when SPARK_Mode is on, as it is not a standard
-- legality rule. The check is performed here because Volatile_Function
-- is processed after the analysis of the related subprogram body. The
-- check only applies to source subprograms and not to generated TSS
-- subprograms.
if SPARK_Mode = On
and then Ekind (Body_Id) in E_Function | E_Generic_Function
and then Comes_From_Source (Spec_Id)
and then not Is_Volatile_Function (Body_Id)
then
Check_Nonvolatile_Function_Profile (Body_Id);
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
-- Capture all global references in a generic subprogram body now that
-- the contract has been analyzed.
if Is_Generic_Declaration_Or_Body (Body_Decl) then
Save_Global_References_In_Contract
(Templ => Original_Node (Body_Decl),
Gen_Id => Spec_Id);
end if;
-- Deal with preconditions, [refined] postconditions, Contract_Cases,
-- Subprogram_Variant, invariants and predicates associated with body
-- and its spec. Do not expand the contract of subprogram body stubs.
if Nkind (Body_Decl) = N_Subprogram_Body then
Expand_Subprogram_Contract (Body_Id);
end if;
end Analyze_Entry_Or_Subprogram_Body_Contract;
------------------------------------------
-- Analyze_Entry_Or_Subprogram_Contract --
------------------------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Entry_Or_Subprogram_Contract
(Subp_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty)
is
Items : constant Node_Id := Contract (Subp_Id);
Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
Skip_Assert_Exprs : constant Boolean :=
Is_Entry (Subp_Id) and then not GNATprove_Mode;
Depends : Node_Id := Empty;
Global : Node_Id := Empty;
Prag : Node_Id;
Prag_Nam : Name_Id;
begin
-- Do not analyze a contract multiple times
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related subprogram body.
Set_SPARK_Mode (Subp_Id);
-- All subprograms carry a contract, but for some it is not significant
-- and should not be processed.
if not Has_Significant_Contract (Subp_Id) then
null;
elsif Present (Items) then
-- Do not analyze the pre/postconditions of an entry declaration
-- unless annotating the original tree for GNATprove. The
-- real analysis occurs when the pre/postconditons are relocated to
-- the contract wrapper procedure (see Build_Contract_Wrapper).
if Skip_Assert_Exprs then
null;
-- Otherwise analyze the pre/postconditions.
-- If these come from an aspect specification, their expressions
-- might include references to types that are not frozen yet, in the
-- case where the body is a rewritten expression function that is a
-- completion, so freeze all types within before constructing the
-- contract code.
else
declare
Bod : Node_Id;
Freeze_Types : Boolean := False;
begin
if Present (Freeze_Id) then
Bod := Unit_Declaration_Node (Freeze_Id);
if Nkind (Bod) = N_Subprogram_Body
and then Was_Expression_Function (Bod)
and then Ekind (Subp_Id) = E_Function
and then Chars (Subp_Id) = Chars (Freeze_Id)
and then Subp_Id /= Freeze_Id
then
Freeze_Types := True;
end if;
end if;
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Freeze_Types
and then Present (Corresponding_Aspect (Prag))
then
Freeze_Expr_Types
(Def_Id => Subp_Id,
Typ => Standard_Boolean,
Expr =>
Expression
(First (Pragma_Argument_Associations (Prag))),
N => Bod);
end if;
Analyze_Pre_Post_Condition_In_Decl_Part (Prag, Freeze_Id);
Prag := Next_Pragma (Prag);
end loop;
end;
end if;
-- Analyze contract-cases and test-cases
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Contract_Cases then
-- Do not analyze the contract cases of an entry declaration
-- unless annotating the original tree for GNATprove.
-- The real analysis occurs when the contract cases are moved
-- to the contract wrapper procedure (Build_Contract_Wrapper).
if Skip_Assert_Exprs then
null;
-- Otherwise analyze the contract cases
else
Analyze_Contract_Cases_In_Decl_Part (Prag, Freeze_Id);
end if;
elsif Prag_Nam = Name_Subprogram_Variant then
Analyze_Subprogram_Variant_In_Decl_Part (Prag);
else
pragma Assert (Prag_Nam = Name_Test_Case);
Analyze_Test_Case_In_Decl_Part (Prag);
end if;
Prag := Next_Pragma (Prag);
end loop;
-- Analyze classification pragmas
Prag := Classifications (Items);
while Present (Prag) loop
Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Depends then
Depends := Prag;
elsif Prag_Nam = Name_Global then
Global := Prag;
end if;
Prag := Next_Pragma (Prag);
end loop;
-- Analyze Global first, as Depends may mention items classified in
-- the global categorization.
if Present (Global) then
Analyze_Global_In_Decl_Part (Global);
end if;
-- Depends must be analyzed after Global in order to see the modes of
-- all global items.
if Present (Depends) then
Analyze_Depends_In_Decl_Part (Depends);
end if;
-- Ensure that the contract cases or postconditions mention 'Result
-- or define a post-state.
Check_Result_And_Post_State (Subp_Id);
end if;
-- A nonvolatile function cannot have an effectively volatile formal
-- parameter or return type (SPARK RM 7.1.3(9)). This check is relevant
-- only when SPARK_Mode is on, as it is not a standard legality rule.
-- The check is performed here because pragma Volatile_Function is
-- processed after the analysis of the related subprogram declaration.
if SPARK_Mode = On
and then Ekind (Subp_Id) in E_Function | E_Generic_Function
and then Comes_From_Source (Subp_Id)
and then not Is_Volatile_Function (Subp_Id)
then
Check_Nonvolatile_Function_Profile (Subp_Id);
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
-- Capture all global references in a generic subprogram now that the
-- contract has been analyzed.
if Is_Generic_Declaration_Or_Body (Subp_Decl) then
Save_Global_References_In_Contract
(Templ => Original_Node (Subp_Decl),
Gen_Id => Subp_Id);
end if;
end Analyze_Entry_Or_Subprogram_Contract;
----------------------------------------------
-- Check_Type_Or_Object_External_Properties --
----------------------------------------------
procedure Check_Type_Or_Object_External_Properties
(Type_Or_Obj_Id : Entity_Id)
is
function Decl_Kind (Is_Type : Boolean;
Object_Kind : String) return String;
-- Returns "type" or Object_Kind, depending on Is_Type
---------------
-- Decl_Kind --
---------------
function Decl_Kind (Is_Type : Boolean;
Object_Kind : String) return String is
begin
if Is_Type then
return "type";
else
return Object_Kind;
end if;
end Decl_Kind;
Is_Type_Id : constant Boolean := Is_Type (Type_Or_Obj_Id);
-- Local variables
AR_Val : Boolean := False;
AW_Val : Boolean := False;
ER_Val : Boolean := False;
EW_Val : Boolean := False;
Seen : Boolean := False;
Prag : Node_Id;
Obj_Typ : Entity_Id;
-- Start of processing for Check_Type_Or_Object_External_Properties
begin
-- Analyze all external properties
if Is_Type_Id then
Obj_Typ := Type_Or_Obj_Id;
-- If the parent type of a derived type is volatile
-- then the derived type inherits volatility-related flags.
if Is_Derived_Type (Type_Or_Obj_Id) then
declare
Parent_Type : constant Entity_Id :=
Etype (Base_Type (Type_Or_Obj_Id));
begin
if Is_Effectively_Volatile (Parent_Type) then
AR_Val := Async_Readers_Enabled (Parent_Type);
AW_Val := Async_Writers_Enabled (Parent_Type);
ER_Val := Effective_Reads_Enabled (Parent_Type);
EW_Val := Effective_Writes_Enabled (Parent_Type);
end if;
end;
end if;
else
Obj_Typ := Etype (Type_Or_Obj_Id);
end if;
Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Async_Readers);
if Present (Prag) then
declare
Saved_AR_Val : constant Boolean := AR_Val;
begin
Analyze_External_Property_In_Decl_Part (Prag, AR_Val);
Seen := True;
if Saved_AR_Val and not AR_Val then
Error_Msg_N
("illegal non-confirming Async_Readers specification",
Prag);
end if;
end;
end if;
Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Async_Writers);
if Present (Prag) then
declare
Saved_AW_Val : constant Boolean := AW_Val;
begin
Analyze_External_Property_In_Decl_Part (Prag, AW_Val);
Seen := True;
if Saved_AW_Val and not AW_Val then
Error_Msg_N
("illegal non-confirming Async_Writers specification",
Prag);
end if;
end;
end if;
Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Effective_Reads);
if Present (Prag) then
declare
Saved_ER_Val : constant Boolean := ER_Val;
begin
Analyze_External_Property_In_Decl_Part (Prag, ER_Val);
Seen := True;
if Saved_ER_Val and not ER_Val then
Error_Msg_N
("illegal non-confirming Effective_Reads specification",
Prag);
end if;
end;
end if;
Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Effective_Writes);
if Present (Prag) then
declare
Saved_EW_Val : constant Boolean := EW_Val;
begin
Analyze_External_Property_In_Decl_Part (Prag, EW_Val);
Seen := True;
if Saved_EW_Val and not EW_Val then
Error_Msg_N
("illegal non-confirming Effective_Writes specification",
Prag);
end if;
end;
end if;
-- Verify the mutual interaction of the various external properties
if Seen then
Check_External_Properties
(Type_Or_Obj_Id, AR_Val, AW_Val, ER_Val, EW_Val);
end if;
-- The following checks are relevant only when SPARK_Mode is on, as
-- they are not standard Ada legality rules. Internally generated
-- temporaries are ignored.
if SPARK_Mode = On and then Comes_From_Source (Type_Or_Obj_Id) then
if Is_Effectively_Volatile (Type_Or_Obj_Id) then
-- The declaration of an effectively volatile object or type must
-- appear at the library level (SPARK RM 7.1.3(3), C.6(6)).
if not Is_Library_Level_Entity (Type_Or_Obj_Id) then
Error_Msg_N
("effectively volatile "
& Decl_Kind (Is_Type => Is_Type_Id,
Object_Kind => "variable")
& " & must be declared at library level "
& "(SPARK RM 7.1.3(3))", Type_Or_Obj_Id);
-- An object of a discriminated type cannot be effectively
-- volatile except for protected objects (SPARK RM 7.1.3(5)).
elsif Has_Discriminants (Obj_Typ)
and then not Is_Protected_Type (Obj_Typ)
then
Error_Msg_N
("discriminated "
& Decl_Kind (Is_Type => Is_Type_Id,
Object_Kind => "object")
& " & cannot be volatile",
Type_Or_Obj_Id);
end if;
-- An object decl shall be compatible with respect to volatility
-- with its type (SPARK RM 7.1.3(2)).
if not Is_Type_Id then
if Is_Effectively_Volatile (Obj_Typ) then
Check_Volatility_Compatibility
(Type_Or_Obj_Id, Obj_Typ,
"volatile object", "its type",
Srcpos_Bearer => Type_Or_Obj_Id);
end if;
-- A component of a composite type (in this case, the composite
-- type is an array type) shall be compatible with respect to
-- volatility with the composite type (SPARK RM 7.1.3(6)).
elsif Is_Array_Type (Obj_Typ) then
Check_Volatility_Compatibility
(Component_Type (Obj_Typ), Obj_Typ,
"component type", "its enclosing array type",
Srcpos_Bearer => Obj_Typ);
-- A component of a composite type (in this case, the composite
-- type is a record type) shall be compatible with respect to
-- volatility with the composite type (SPARK RM 7.1.3(6)).
elsif Is_Record_Type (Obj_Typ) then
declare
Comp : Entity_Id := First_Component (Obj_Typ);
begin
while Present (Comp) loop
Check_Volatility_Compatibility
(Etype (Comp), Obj_Typ,
"record component " & Get_Name_String (Chars (Comp)),
"its enclosing record type",
Srcpos_Bearer => Comp);
Next_Component (Comp);
end loop;
end;
end if;
-- The type or object is not effectively volatile
else
-- A non-effectively volatile type cannot have effectively
-- volatile components (SPARK RM 7.1.3(6)).
if Is_Type_Id
and then not Is_Effectively_Volatile (Type_Or_Obj_Id)
and then Has_Volatile_Component (Type_Or_Obj_Id)
then
Error_Msg_N
("non-volatile type & cannot have volatile"
& " components",
Type_Or_Obj_Id);
end if;
end if;
end if;
end Check_Type_Or_Object_External_Properties;
-----------------------------
-- Analyze_Object_Contract --
-----------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Object_Contract
(Obj_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty)
is
Obj_Typ : constant Entity_Id := Etype (Obj_Id);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
NC_Val : Boolean := False;
Items : Node_Id;
Prag : Node_Id;
Ref_Elmt : Elmt_Id;
begin
-- The loop parameter in an element iterator over a formal container
-- is declared with an object declaration, but no contracts apply.
if Ekind (Obj_Id) = E_Loop_Parameter then
return;
end if;
-- Do not analyze a contract multiple times
Items := Contract (Obj_Id);
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- The anonymous object created for a single concurrent type inherits
-- the SPARK_Mode from the type. Due to the timing of contract analysis,
-- delayed pragmas may be subject to the wrong SPARK_Mode, usually that
-- of the enclosing context. To remedy this, restore the original mode
-- of the related anonymous object.
if Is_Single_Concurrent_Object (Obj_Id)
and then Present (SPARK_Pragma (Obj_Id))
then
Set_SPARK_Mode (Obj_Id);
end if;
-- Constant-related checks
if Ekind (Obj_Id) = E_Constant then
-- Analyze indicator Part_Of
Prag := Get_Pragma (Obj_Id, Pragma_Part_Of);
-- Check whether the lack of indicator Part_Of agrees with the
-- placement of the constant with respect to the state space.
if No (Prag) then
Check_Missing_Part_Of (Obj_Id);
end if;
-- A constant cannot be effectively volatile (SPARK RM 7.1.3(4)).
-- This check is relevant only when SPARK_Mode is on, as it is not
-- a standard Ada legality rule. Internally-generated constants that
-- map generic formals to actuals in instantiations are allowed to
-- be volatile.
if SPARK_Mode = On
and then Comes_From_Source (Obj_Id)
and then Is_Effectively_Volatile (Obj_Id)
and then No (Corresponding_Generic_Association (Parent (Obj_Id)))
then
Error_Msg_N ("constant cannot be volatile", Obj_Id);
end if;
-- Variable-related checks
else pragma Assert (Ekind (Obj_Id) = E_Variable);
Check_Type_Or_Object_External_Properties
(Type_Or_Obj_Id => Obj_Id);
-- Analyze the non-external volatility property No_Caching
Prag := Get_Pragma (Obj_Id, Pragma_No_Caching);
if Present (Prag) then
Analyze_External_Property_In_Decl_Part (Prag, NC_Val);
end if;
-- The anonymous object created for a single task type carries
-- pragmas Depends and Global of the type.
if Is_Single_Task_Object (Obj_Id) then
-- Analyze Global first, as Depends may mention items classified
-- in the global categorization.
Prag := Get_Pragma (Obj_Id, Pragma_Global);
if Present (Prag) then
Analyze_Global_In_Decl_Part (Prag);
end if;
-- Depends must be analyzed after Global in order to see the modes
-- of all global items.
Prag := Get_Pragma (Obj_Id, Pragma_Depends);
if Present (Prag) then
Analyze_Depends_In_Decl_Part (Prag);
end if;
end if;
Prag := Get_Pragma (Obj_Id, Pragma_Part_Of);
-- Analyze indicator Part_Of
if Present (Prag) then
Analyze_Part_Of_In_Decl_Part (Prag, Freeze_Id);
-- The variable is a constituent of a single protected/task type
-- and behaves as a component of the type. Verify that references
-- to the variable occur within the definition or body of the type
-- (SPARK RM 9.3).
if Present (Encapsulating_State (Obj_Id))
and then Is_Single_Concurrent_Object
(Encapsulating_State (Obj_Id))
and then Present (Part_Of_References (Obj_Id))
then
Ref_Elmt := First_Elmt (Part_Of_References (Obj_Id));
while Present (Ref_Elmt) loop
Check_Part_Of_Reference (Obj_Id, Node (Ref_Elmt));
Next_Elmt (Ref_Elmt);
end loop;
end if;
-- Otherwise check whether the lack of indicator Part_Of agrees with
-- the placement of the variable with respect to the state space.
else
Check_Missing_Part_Of (Obj_Id);
end if;
end if;
-- Common checks
if Comes_From_Source (Obj_Id) and then Is_Ghost_Entity (Obj_Id) then
-- A Ghost object cannot be of a type that yields a synchronized
-- object (SPARK RM 6.9(19)).
if Yields_Synchronized_Object (Obj_Typ) then
Error_Msg_N ("ghost object & cannot be synchronized", Obj_Id);
-- A Ghost object cannot be effectively volatile (SPARK RM 6.9(7) and
-- SPARK RM 6.9(19)).
elsif Is_Effectively_Volatile (Obj_Id) then
Error_Msg_N ("ghost object & cannot be volatile", Obj_Id);
-- A Ghost object cannot be imported or exported (SPARK RM 6.9(7)).
-- One exception to this is the object that represents the dispatch
-- table of a Ghost tagged type, as the symbol needs to be exported.
elsif Is_Exported (Obj_Id) then
Error_Msg_N ("ghost object & cannot be exported", Obj_Id);
elsif Is_Imported (Obj_Id) then
Error_Msg_N ("ghost object & cannot be imported", Obj_Id);
end if;
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
end Analyze_Object_Contract;
-----------------------------------
-- Analyze_Package_Body_Contract --
-----------------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Package_Body_Contract
(Body_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty)
is
Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id);
Items : constant Node_Id := Contract (Body_Id);
Spec_Id : constant Entity_Id := Spec_Entity (Body_Id);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
Ref_State : Node_Id;
begin
-- Do not analyze a contract multiple times
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related package body.
Set_SPARK_Mode (Body_Id);
Ref_State := Get_Pragma (Body_Id, Pragma_Refined_State);
-- The analysis of pragma Refined_State detects whether the spec has
-- abstract states available for refinement.
if Present (Ref_State) then
Analyze_Refined_State_In_Decl_Part (Ref_State, Freeze_Id);
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
-- Capture all global references in a generic package body now that the
-- contract has been analyzed.
if Is_Generic_Declaration_Or_Body (Body_Decl) then
Save_Global_References_In_Contract
(Templ => Original_Node (Body_Decl),
Gen_Id => Spec_Id);
end if;
end Analyze_Package_Body_Contract;
------------------------------
-- Analyze_Package_Contract --
------------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Package_Contract (Pack_Id : Entity_Id) is
Items : constant Node_Id := Contract (Pack_Id);
Pack_Decl : constant Node_Id := Unit_Declaration_Node (Pack_Id);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
Init : Node_Id := Empty;
Init_Cond : Node_Id := Empty;
Prag : Node_Id;
Prag_Nam : Name_Id;
begin
-- Do not analyze a contract multiple times
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related package.
Set_SPARK_Mode (Pack_Id);
if Present (Items) then
-- Locate and store pragmas Initial_Condition and Initializes, since
-- their order of analysis matters.
Prag := Classifications (Items);
while Present (Prag) loop
Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Initial_Condition then
Init_Cond := Prag;
elsif Prag_Nam = Name_Initializes then
Init := Prag;
end if;
Prag := Next_Pragma (Prag);
end loop;
-- Analyze the initialization-related pragmas. Initializes must come
-- before Initial_Condition due to item dependencies.
if Present (Init) then
Analyze_Initializes_In_Decl_Part (Init);
end if;
if Present (Init_Cond) then
Analyze_Initial_Condition_In_Decl_Part (Init_Cond);
end if;
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
-- Capture all global references in a generic package now that the
-- contract has been analyzed.
if Is_Generic_Declaration_Or_Body (Pack_Decl) then
Save_Global_References_In_Contract
(Templ => Original_Node (Pack_Decl),
Gen_Id => Pack_Id);
end if;
end Analyze_Package_Contract;
--------------------------------------------
-- Analyze_Package_Instantiation_Contract --
--------------------------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Package_Instantiation_Contract (Inst_Id : Entity_Id) is
Inst_Spec : constant Node_Id :=
Instance_Spec (Unit_Declaration_Node (Inst_Id));
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
Pack_Id : Entity_Id;
Prag : Node_Id;
begin
-- Nothing to do when the package instantiation is erroneous or left
-- partially decorated.
if No (Inst_Spec) then
return;
end if;
Pack_Id := Defining_Entity (Inst_Spec);
Prag := Get_Pragma (Pack_Id, Pragma_Part_Of);
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related package.
Set_SPARK_Mode (Pack_Id);
-- Check whether the lack of indicator Part_Of agrees with the placement
-- of the package instantiation with respect to the state space. Nested
-- package instantiations do not need to be checked because they inherit
-- Part_Of indicator of the outermost package instantiation (see routine
-- Propagate_Part_Of in Sem_Prag).
if In_Instance then
null;
elsif No (Prag) then
Check_Missing_Part_Of (Pack_Id);
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
end Analyze_Package_Instantiation_Contract;
--------------------------------
-- Analyze_Protected_Contract --
--------------------------------
procedure Analyze_Protected_Contract (Prot_Id : Entity_Id) is
Items : constant Node_Id := Contract (Prot_Id);
begin
-- Do not analyze a contract multiple times
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
end Analyze_Protected_Contract;
-------------------------------------------
-- Analyze_Subprogram_Body_Stub_Contract --
-------------------------------------------
procedure Analyze_Subprogram_Body_Stub_Contract (Stub_Id : Entity_Id) is
Stub_Decl : constant Node_Id := Parent (Parent (Stub_Id));
Spec_Id : constant Entity_Id := Corresponding_Spec_Of_Stub (Stub_Decl);
begin
-- A subprogram body stub may act as its own spec or as the completion
-- of a previous declaration. Depending on the context, the contract of
-- the stub may contain two sets of pragmas.
-- The stub is a completion, the applicable pragmas are:
-- Refined_Depends
-- Refined_Global
if Present (Spec_Id) then
Analyze_Entry_Or_Subprogram_Body_Contract (Stub_Id);
-- The stub acts as its own spec, the applicable pragmas are:
-- Contract_Cases
-- Depends
-- Global
-- Postcondition
-- Precondition
-- Test_Case
else
Analyze_Entry_Or_Subprogram_Contract (Stub_Id);
end if;
end Analyze_Subprogram_Body_Stub_Contract;
---------------------------
-- Analyze_Task_Contract --
---------------------------
-- WARNING: This routine manages SPARK regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- SPARK mode.
procedure Analyze_Task_Contract (Task_Id : Entity_Id) is
Items : constant Node_Id := Contract (Task_Id);
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
Saved_SMP : constant Node_Id := SPARK_Mode_Pragma;
-- Save the SPARK_Mode-related data to restore on exit
Prag : Node_Id;
begin
-- Do not analyze a contract multiple times
if Present (Items) then
if Analyzed (Items) then
return;
else
Set_Analyzed (Items);
end if;
end if;
-- Due to the timing of contract analysis, delayed pragmas may be
-- subject to the wrong SPARK_Mode, usually that of the enclosing
-- context. To remedy this, restore the original SPARK_Mode of the
-- related task unit.
Set_SPARK_Mode (Task_Id);
-- Analyze Global first, as Depends may mention items classified in the
-- global categorization.
Prag := Get_Pragma (Task_Id, Pragma_Global);
if Present (Prag) then
Analyze_Global_In_Decl_Part (Prag);
end if;
-- Depends must be analyzed after Global in order to see the modes of
-- all global items.
Prag := Get_Pragma (Task_Id, Pragma_Depends);
if Present (Prag) then
Analyze_Depends_In_Decl_Part (Prag);
end if;
-- Restore the SPARK_Mode of the enclosing context after all delayed
-- pragmas have been analyzed.
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
end Analyze_Task_Contract;
---------------------------
-- Analyze_Type_Contract --
---------------------------
procedure Analyze_Type_Contract (Type_Id : Entity_Id) is
begin
Check_Type_Or_Object_External_Properties
(Type_Or_Obj_Id => Type_Id);
end Analyze_Type_Contract;
-----------------------------
-- Create_Generic_Contract --
-----------------------------
procedure Create_Generic_Contract (Unit : Node_Id) is
Templ : constant Node_Id := Original_Node (Unit);
Templ_Id : constant Entity_Id := Defining_Entity (Templ);
procedure Add_Generic_Contract_Pragma (Prag : Node_Id);
-- Add a single contract-related source pragma Prag to the contract of
-- generic template Templ_Id.
---------------------------------
-- Add_Generic_Contract_Pragma --
---------------------------------
procedure Add_Generic_Contract_Pragma (Prag : Node_Id) is
Prag_Templ : Node_Id;
begin
-- Mark the pragma to prevent the premature capture of global
-- references when capturing global references of the context
-- (see Save_References_In_Pragma).
Set_Is_Generic_Contract_Pragma (Prag);
-- Pragmas that apply to a generic subprogram declaration are not
-- part of the semantic structure of the generic template:
-- generic
-- procedure Example (Formal : Integer);
-- pragma Precondition (Formal > 0);
-- Create a generic template for such pragmas and link the template
-- of the pragma with the generic template.
if Nkind (Templ) = N_Generic_Subprogram_Declaration then
Rewrite
(Prag, Copy_Generic_Node (Prag, Empty, Instantiating => False));
Prag_Templ := Original_Node (Prag);
Set_Is_Generic_Contract_Pragma (Prag_Templ);
Add_Contract_Item (Prag_Templ, Templ_Id);
-- Otherwise link the pragma with the generic template
else
Add_Contract_Item (Prag, Templ_Id);
end if;
end Add_Generic_Contract_Pragma;
-- Local variables
Context : constant Node_Id := Parent (Unit);
Decl : Node_Id := Empty;
-- Start of processing for Create_Generic_Contract
begin
-- A generic package declaration carries contract-related source pragmas
-- in its visible declarations.
if Nkind (Templ) = N_Generic_Package_Declaration then
Set_Ekind (Templ_Id, E_Generic_Package);
if Present (Visible_Declarations (Specification (Templ))) then
Decl := First (Visible_Declarations (Specification (Templ)));
end if;
-- A generic package body carries contract-related source pragmas in its
-- declarations.
elsif Nkind (Templ) = N_Package_Body then
Set_Ekind (Templ_Id, E_Package_Body);
if Present (Declarations (Templ)) then
Decl := First (Declarations (Templ));
end if;
-- Generic subprogram declaration
elsif Nkind (Templ) = N_Generic_Subprogram_Declaration then
if Nkind (Specification (Templ)) = N_Function_Specification then
Set_Ekind (Templ_Id, E_Generic_Function);
else
Set_Ekind (Templ_Id, E_Generic_Procedure);
end if;
-- When the generic subprogram acts as a compilation unit, inspect
-- the Pragmas_After list for contract-related source pragmas.
if Nkind (Context) = N_Compilation_Unit then
if Present (Aux_Decls_Node (Context))
and then Present (Pragmas_After (Aux_Decls_Node (Context)))
then
Decl := First (Pragmas_After (Aux_Decls_Node (Context)));
end if;
-- Otherwise inspect the successive declarations for contract-related
-- source pragmas.
else
Decl := Next (Unit);
end if;
-- A generic subprogram body carries contract-related source pragmas in
-- its declarations.
elsif Nkind (Templ) = N_Subprogram_Body then
Set_Ekind (Templ_Id, E_Subprogram_Body);
if Present (Declarations (Templ)) then
Decl := First (Declarations (Templ));
end if;
end if;
-- Inspect the relevant declarations looking for contract-related source
-- pragmas and add them to the contract of the generic unit.
while Present (Decl) loop
if Comes_From_Source (Decl) then
if Nkind (Decl) = N_Pragma then
-- The source pragma is a contract annotation
if Is_Contract_Annotation (Decl) then
Add_Generic_Contract_Pragma (Decl);
end if;
-- The region where a contract-related source pragma may appear
-- ends with the first source non-pragma declaration or statement.
else
exit;
end if;
end if;
Next (Decl);
end loop;
end Create_Generic_Contract;
--------------------------------
-- Expand_Subprogram_Contract --
--------------------------------
procedure Expand_Subprogram_Contract (Body_Id : Entity_Id) is
Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id);
Spec_Id : constant Entity_Id := Corresponding_Spec (Body_Decl);
procedure Add_Invariant_And_Predicate_Checks
(Subp_Id : Entity_Id;
Stmts : in out List_Id;
Result : out Node_Id);
-- Process the result of function Subp_Id (if applicable) and all its
-- formals. Add invariant and predicate checks where applicable. The
-- routine appends all the checks to list Stmts. If Subp_Id denotes a
-- function, Result contains the entity of parameter _Result, to be
-- used in the creation of procedure _Postconditions.
procedure Append_Enabled_Item (Item : Node_Id; List : in out List_Id);
-- Append a node to a list. If there is no list, create a new one. When
-- the item denotes a pragma, it is added to the list only when it is
-- enabled.
procedure Build_Postconditions_Procedure
(Subp_Id : Entity_Id;
Stmts : List_Id;
Result : Entity_Id);
-- Create the body of procedure _Postconditions which handles various
-- assertion actions on exit from subprogram Subp_Id. Stmts is the list
-- of statements to be checked on exit. Parameter Result is the entity
-- of parameter _Result when Subp_Id denotes a function.
procedure Process_Contract_Cases (Stmts : in out List_Id);
-- Process pragma Contract_Cases. This routine prepends items to the
-- body declarations and appends items to list Stmts.
procedure Process_Postconditions (Stmts : in out List_Id);
-- Collect all [inherited] spec and body postconditions and accumulate
-- their pragma Check equivalents in list Stmts.
procedure Process_Preconditions;
-- Collect all [inherited] spec and body preconditions and prepend their
-- pragma Check equivalents to the declarations of the body.
----------------------------------------
-- Add_Invariant_And_Predicate_Checks --
----------------------------------------
procedure Add_Invariant_And_Predicate_Checks
(Subp_Id : Entity_Id;
Stmts : in out List_Id;
Result : out Node_Id)
is
procedure Add_Invariant_Access_Checks (Id : Entity_Id);
-- Id denotes the return value of a function or a formal parameter.
-- Add an invariant check if the type of Id is access to a type with
-- invariants. The routine appends the generated code to Stmts.
function Invariant_Checks_OK (Typ : Entity_Id) return Boolean;
-- Determine whether type Typ can benefit from invariant checks. To
-- qualify, the type must have a non-null invariant procedure and
-- subprogram Subp_Id must appear visible from the point of view of
-- the type.
---------------------------------
-- Add_Invariant_Access_Checks --
---------------------------------
procedure Add_Invariant_Access_Checks (Id : Entity_Id) is
Loc : constant Source_Ptr := Sloc (Body_Decl);
Ref : Node_Id;
Typ : Entity_Id;
begin
Typ := Etype (Id);
if Is_Access_Type (Typ) and then not Is_Access_Constant (Typ) then
Typ := Designated_Type (Typ);
if Invariant_Checks_OK (Typ) then
Ref :=
Make_Explicit_Dereference (Loc,
Prefix => New_Occurrence_Of (Id, Loc));
Set_Etype (Ref, Typ);
-- Generate:
-- if <Id> /= null then
-- <invariant_call (<Ref>)>
-- end if;
Append_Enabled_Item
(Item =>
Make_If_Statement (Loc,
Condition =>
Make_Op_Ne (Loc,
Left_Opnd => New_Occurrence_Of (Id, Loc),
Right_Opnd => Make_Null (Loc)),
Then_Statements => New_List (
Make_Invariant_Call (Ref))),
List => Stmts);
end if;
end if;
end Add_Invariant_Access_Checks;
-------------------------
-- Invariant_Checks_OK --
-------------------------
function Invariant_Checks_OK (Typ : Entity_Id) return Boolean is
function Has_Public_Visibility_Of_Subprogram return Boolean;
-- Determine whether type Typ has public visibility of subprogram
-- Subp_Id.
-----------------------------------------
-- Has_Public_Visibility_Of_Subprogram --
-----------------------------------------
function Has_Public_Visibility_Of_Subprogram return Boolean is
Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id);
begin
-- An Initialization procedure must be considered visible even
-- though it is internally generated.
if Is_Init_Proc (Defining_Entity (Subp_Decl)) then
return True;
elsif Ekind (Scope (Typ)) /= E_Package then
return False;
-- Internally generated code is never publicly visible except
-- for a subprogram that is the implementation of an expression
-- function. In that case the visibility is determined by the
-- last check.
elsif not Comes_From_Source (Subp_Decl)
and then
(Nkind (Original_Node (Subp_Decl)) /= N_Expression_Function
or else not
Comes_From_Source (Defining_Entity (Subp_Decl)))
then
return False;
-- Determine whether the subprogram is declared in the visible
-- declarations of the package containing the type, or in the
-- visible declaration of a child unit of that package.
else
declare
Decls : constant List_Id :=
List_Containing (Subp_Decl);
Subp_Scope : constant Entity_Id :=
Scope (Defining_Entity (Subp_Decl));
Typ_Scope : constant Entity_Id := Scope (Typ);
begin
return
Decls = Visible_Declarations
(Specification (Unit_Declaration_Node (Typ_Scope)))
or else
(Ekind (Subp_Scope) = E_Package
and then Typ_Scope /= Subp_Scope
and then Is_Child_Unit (Subp_Scope)
and then
Is_Ancestor_Package (Typ_Scope, Subp_Scope)
and then
Decls = Visible_Declarations
(Specification
(Unit_Declaration_Node (Subp_Scope))));
end;
end if;
end Has_Public_Visibility_Of_Subprogram;
-- Start of processing for Invariant_Checks_OK
begin
return
Has_Invariants (Typ)
and then Present (Invariant_Procedure (Typ))
and then not Has_Null_Body (Invariant_Procedure (Typ))
and then Has_Public_Visibility_Of_Subprogram;
end Invariant_Checks_OK;
-- Local variables
Loc : constant Source_Ptr := Sloc (Body_Decl);
-- Source location of subprogram body contract
Formal : Entity_Id;
Typ : Entity_Id;
-- Start of processing for Add_Invariant_And_Predicate_Checks
begin
Result := Empty;
-- Process the result of a function
if Ekind (Subp_Id) = E_Function then
Typ := Etype (Subp_Id);
-- Generate _Result which is used in procedure _Postconditions to
-- verify the return value.
Result := Make_Defining_Identifier (Loc, Name_uResult);
Set_Etype (Result, Typ);
-- Add an invariant check when the return type has invariants and
-- the related function is visible to the outside.
if Invariant_Checks_OK (Typ) then
Append_Enabled_Item
(Item =>
Make_Invariant_Call (New_Occurrence_Of (Result, Loc)),
List => Stmts);
end if;
-- Add an invariant check when the return type is an access to a
-- type with invariants.
Add_Invariant_Access_Checks (Result);
end if;
-- Add invariant checks for all formals that qualify (see AI05-0289
-- and AI12-0044).
Formal := First_Formal (Subp_Id);
while Present (Formal) loop
Typ := Etype (Formal);
if Ekind (Formal) /= E_In_Parameter
or else Ekind (Subp_Id) = E_Procedure
or else Is_Access_Type (Typ)
then
if Invariant_Checks_OK (Typ) then
Append_Enabled_Item
(Item =>
Make_Invariant_Call (New_Occurrence_Of (Formal, Loc)),
List => Stmts);
end if;
Add_Invariant_Access_Checks (Formal);
-- Note: we used to add predicate checks for OUT and IN OUT
-- formals here, but that was misguided, since such checks are
-- performed on the caller side, based on the predicate of the
-- actual, rather than the predicate of the formal.
end if;
Next_Formal (Formal);
end loop;
end Add_Invariant_And_Predicate_Checks;
-------------------------
-- Append_Enabled_Item --
-------------------------
procedure Append_Enabled_Item (Item : Node_Id; List : in out List_Id) is
begin
-- Do not chain ignored or disabled pragmas
if Nkind (Item) = N_Pragma
and then (Is_Ignored (Item) or else Is_Disabled (Item))
then
null;
-- Otherwise, add the item
else
if No (List) then
List := New_List;
end if;
-- If the pragma is a conjunct in a composite postcondition, it
-- has been processed in reverse order. In the postcondition body
-- it must appear before the others.
if Nkind (Item) = N_Pragma
and then From_Aspect_Specification (Item)
and then Split_PPC (Item)
then
Prepend (Item, List);
else
Append (Item, List);
end if;
end if;
end Append_Enabled_Item;
------------------------------------
-- Build_Postconditions_Procedure --
------------------------------------
procedure Build_Postconditions_Procedure
(Subp_Id : Entity_Id;
Stmts : List_Id;
Result : Entity_Id)
is
Loc : constant Source_Ptr := Sloc (Body_Decl);
Params : List_Id := No_List;
Proc_Bod : Node_Id;
Proc_Decl : Node_Id;
Proc_Id : Entity_Id;
Proc_Spec : Node_Id;
begin
-- Nothing to do if there are no actions to check on exit
if No (Stmts) then
return;
end if;
Proc_Id := Make_Defining_Identifier (Loc, Name_uPostconditions);
Set_Debug_Info_Needed (Proc_Id);
Set_Postconditions_Proc (Subp_Id, Proc_Id);
-- Force the front-end inlining of _Postconditions when generating C
-- code, since its body may have references to itypes defined in the
-- enclosing subprogram, which would cause problems for unnesting
-- routines in the absence of inlining.
if Modify_Tree_For_C then
Set_Has_Pragma_Inline (Proc_Id);
Set_Has_Pragma_Inline_Always (Proc_Id);
Set_Is_Inlined (Proc_Id);
end if;
-- The related subprogram is a function: create the specification of
-- parameter _Result.
if Present (Result) then
Params := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Result,
Parameter_Type =>
New_Occurrence_Of (Etype (Result), Loc)));
end if;
Proc_Spec :=
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Proc_Id,
Parameter_Specifications => Params);
Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec);
-- Insert _Postconditions before the first source declaration of the
-- body. This ensures that the body will not cause any premature
-- freezing, as it may mention types:
-- procedure Proc (Obj : Array_Typ) is
-- procedure _postconditions is
-- begin
-- ... Obj ...
-- end _postconditions;
-- subtype T is Array_Typ (Obj'First (1) .. Obj'Last (1));
-- begin
-- In the example above, Obj is of type T but the incorrect placement
-- of _Postconditions will cause a crash in gigi due to an out-of-
-- order reference. The body of _Postconditions must be placed after
-- the declaration of Temp to preserve correct visibility.
Insert_Before_First_Source_Declaration
(Proc_Decl, Declarations (Body_Decl));
Analyze (Proc_Decl);
-- Set an explicit End_Label to override the sloc of the implicit
-- RETURN statement, and prevent it from inheriting the sloc of one
-- the postconditions: this would cause confusing debug info to be
-- produced, interfering with coverage-analysis tools.
Proc_Bod :=
Make_Subprogram_Body (Loc,
Specification =>
Copy_Subprogram_Spec (Proc_Spec),
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmts,
End_Label => Make_Identifier (Loc, Chars (Proc_Id))));
Insert_After_And_Analyze (Proc_Decl, Proc_Bod);
end Build_Postconditions_Procedure;
----------------------------
-- Process_Contract_Cases --
----------------------------
procedure Process_Contract_Cases (Stmts : in out List_Id) is
procedure Process_Contract_Cases_For (Subp_Id : Entity_Id);
-- Process pragma Contract_Cases for subprogram Subp_Id
--------------------------------
-- Process_Contract_Cases_For --
--------------------------------
procedure Process_Contract_Cases_For (Subp_Id : Entity_Id) is
Items : constant Node_Id := Contract (Subp_Id);
Prag : Node_Id;
begin
if Present (Items) then
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
if Is_Checked (Prag) then
if Pragma_Name (Prag) = Name_Contract_Cases then
Expand_Pragma_Contract_Cases
(CCs => Prag,
Subp_Id => Subp_Id,
Decls => Declarations (Body_Decl),
Stmts => Stmts);
elsif Pragma_Name (Prag) = Name_Subprogram_Variant then
Expand_Pragma_Subprogram_Variant
(Prag => Prag,
Subp_Id => Subp_Id,
Body_Decls => Declarations (Body_Decl));
end if;
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
end Process_Contract_Cases_For;
pragma Unmodified (Stmts);
-- Stmts is passed as IN OUT to signal that the list can be updated,
-- even if the corresponding integer value representing the list does
-- not change.
-- Start of processing for Process_Contract_Cases
begin
Process_Contract_Cases_For (Body_Id);
if Present (Spec_Id) then
Process_Contract_Cases_For (Spec_Id);
end if;
end Process_Contract_Cases;
----------------------------
-- Process_Postconditions --
----------------------------
procedure Process_Postconditions (Stmts : in out List_Id) is
procedure Process_Body_Postconditions (Post_Nam : Name_Id);
-- Collect all [refined] postconditions of a specific kind denoted
-- by Post_Nam that belong to the body, and generate pragma Check
-- equivalents in list Stmts.
procedure Process_Spec_Postconditions;
-- Collect all [inherited] postconditions of the spec, and generate
-- pragma Check equivalents in list Stmts.
---------------------------------
-- Process_Body_Postconditions --
---------------------------------
procedure Process_Body_Postconditions (Post_Nam : Name_Id) is
Items : constant Node_Id := Contract (Body_Id);
Unit_Decl : constant Node_Id := Parent (Body_Decl);
Decl : Node_Id;
Prag : Node_Id;
begin
-- Process the contract
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Pragma_Name (Prag) = Post_Nam
and then Is_Checked (Prag)
then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
-- The subprogram body being processed is actually the proper body
-- of a stub with a corresponding spec. The subprogram stub may
-- carry a postcondition pragma, in which case it must be taken
-- into account. The pragma appears after the stub.
if Present (Spec_Id) and then Nkind (Unit_Decl) = N_Subunit then
Decl := Next (Corresponding_Stub (Unit_Decl));
while Present (Decl) loop
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
if Pragma_Name (Decl) = Post_Nam
and then Is_Checked (Decl)
then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Decl),
List => Stmts);
end if;
-- Skip internally generated code
elsif not Comes_From_Source (Decl) then
null;
-- Postcondition pragmas are usually grouped together. There
-- is no need to inspect the whole declarative list.
else
exit;
end if;
Next (Decl);
end loop;
end if;
end Process_Body_Postconditions;
---------------------------------
-- Process_Spec_Postconditions --
---------------------------------
procedure Process_Spec_Postconditions is
Subps : constant Subprogram_List :=
Inherited_Subprograms (Spec_Id);
Item : Node_Id;
Items : Node_Id;
Prag : Node_Id;
Subp_Id : Entity_Id;
begin
-- Process the contract
Items := Contract (Spec_Id);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Pragma_Name (Prag) = Name_Postcondition
and then Is_Checked (Prag)
then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
-- Process the contracts of all inherited subprograms, looking for
-- class-wide postconditions.
for Index in Subps'Range loop
Subp_Id := Subps (Index);
Items := Contract (Subp_Id);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Pragma_Name (Prag) = Name_Postcondition
and then Class_Present (Prag)
then
Item :=
Build_Pragma_Check_Equivalent
(Prag => Prag,
Subp_Id => Spec_Id,
Inher_Id => Subp_Id);
-- The pragma Check equivalent of the class-wide
-- postcondition is still created even though the
-- pragma may be ignored because the equivalent
-- performs semantic checks.
if Is_Checked (Prag) then
Append_Enabled_Item (Item, Stmts);
end if;
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
end loop;
end Process_Spec_Postconditions;
pragma Unmodified (Stmts);
-- Stmts is passed as IN OUT to signal that the list can be updated,
-- even if the corresponding integer value representing the list does
-- not change.
-- Start of processing for Process_Postconditions
begin
-- The processing of postconditions is done in reverse order (body
-- first) to ensure the following arrangement:
-- <refined postconditions from body>
-- <postconditions from body>
-- <postconditions from spec>
-- <inherited postconditions>
Process_Body_Postconditions (Name_Refined_Post);
Process_Body_Postconditions (Name_Postcondition);
if Present (Spec_Id) then
Process_Spec_Postconditions;
end if;
end Process_Postconditions;
---------------------------
-- Process_Preconditions --
---------------------------
procedure Process_Preconditions is
Class_Pre : Node_Id := Empty;
-- The sole [inherited] class-wide precondition pragma that applies
-- to the subprogram.
Insert_Node : Node_Id := Empty;
-- The insertion node after which all pragma Check equivalents are
-- inserted.
function Is_Prologue_Renaming (Decl : Node_Id) return Boolean;
-- Determine whether arbitrary declaration Decl denotes a renaming of
-- a discriminant or protection field _object.
procedure Merge_Preconditions (From : Node_Id; Into : Node_Id);
-- Merge two class-wide preconditions by "or else"-ing them. The
-- changes are accumulated in parameter Into. Update the error
-- message of Into.
procedure Prepend_To_Decls (Item : Node_Id);
-- Prepend a single item to the declarations of the subprogram body
procedure Prepend_To_Decls_Or_Save (Prag : Node_Id);
-- Save a class-wide precondition into Class_Pre, or prepend a normal
-- precondition to the declarations of the body and analyze it.
procedure Process_Inherited_Preconditions;
-- Collect all inherited class-wide preconditions and merge them into
-- one big precondition to be evaluated as pragma Check.
procedure Process_Preconditions_For (Subp_Id : Entity_Id);
-- Collect all preconditions of subprogram Subp_Id and prepend their
-- pragma Check equivalents to the declarations of the body.
--------------------------
-- Is_Prologue_Renaming --
--------------------------
function Is_Prologue_Renaming (Decl : Node_Id) return Boolean is
Nam : Node_Id;
Obj : Entity_Id;
Pref : Node_Id;
Sel : Node_Id;
begin
if Nkind (Decl) = N_Object_Renaming_Declaration then
Obj := Defining_Entity (Decl);
Nam := Name (Decl);
if Nkind (Nam) = N_Selected_Component then
Pref := Prefix (Nam);
Sel := Selector_Name (Nam);
-- A discriminant renaming appears as
-- Discr : constant ... := Prefix.Discr;
if Ekind (Obj) = E_Constant
and then Is_Entity_Name (Sel)
and then Present (Entity (Sel))
and then Ekind (Entity (Sel)) = E_Discriminant
then
return True;
-- A protection field renaming appears as
-- Prot : ... := _object._object;
-- A renamed private component is just a component of
-- _object, with an arbitrary name.
elsif Ekind (Obj) in E_Variable | E_Constant
and then Nkind (Pref) = N_Identifier
and then Chars (Pref) = Name_uObject
and then Nkind (Sel) = N_Identifier
then
return True;
end if;
end if;
end if;
return False;
end Is_Prologue_Renaming;
-------------------------
-- Merge_Preconditions --
-------------------------
procedure Merge_Preconditions (From : Node_Id; Into : Node_Id) is
function Expression_Arg (Prag : Node_Id) return Node_Id;
-- Return the boolean expression argument of a precondition while
-- updating its parentheses count for the subsequent merge.
function Message_Arg (Prag : Node_Id) return Node_Id;
-- Return the message argument of a precondition
--------------------
-- Expression_Arg --
--------------------
function Expression_Arg (Prag : Node_Id) return Node_Id is
Args : constant List_Id := Pragma_Argument_Associations (Prag);
Arg : constant Node_Id := Get_Pragma_Arg (Next (First (Args)));
begin
if Paren_Count (Arg) = 0 then
Set_Paren_Count (Arg, 1);
end if;
return Arg;
end Expression_Arg;
-----------------
-- Message_Arg --
-----------------
function Message_Arg (Prag : Node_Id) return Node_Id is
Args : constant List_Id := Pragma_Argument_Associations (Prag);
begin
return Get_Pragma_Arg (Last (Args));
end Message_Arg;
-- Local variables
From_Expr : constant Node_Id := Expression_Arg (From);
From_Msg : constant Node_Id := Message_Arg (From);
Into_Expr : constant Node_Id := Expression_Arg (Into);
Into_Msg : constant Node_Id := Message_Arg (Into);
Loc : constant Source_Ptr := Sloc (Into);
-- Start of processing for Merge_Preconditions
begin
-- Merge the two preconditions by "or else"-ing them
Rewrite (Into_Expr,
Make_Or_Else (Loc,
Right_Opnd => Relocate_Node (Into_Expr),
Left_Opnd => From_Expr));
-- Merge the two error messages to produce a single message of the
-- form:
-- failed precondition from ...
-- also failed inherited precondition from ...
if not Exception_Locations_Suppressed then
Start_String (Strval (Into_Msg));
Store_String_Char (ASCII.LF);
Store_String_Chars (" also ");
Store_String_Chars (Strval (From_Msg));
Set_Strval (Into_Msg, End_String);
end if;
end Merge_Preconditions;
----------------------
-- Prepend_To_Decls --
----------------------
procedure Prepend_To_Decls (Item : Node_Id) is
Decls : List_Id;
begin
Decls := Declarations (Body_Decl);
-- Ensure that the body has a declarative list
if No (Decls) then
Decls := New_List;
Set_Declarations (Body_Decl, Decls);
end if;
Prepend_To (Decls, Item);
end Prepend_To_Decls;
------------------------------
-- Prepend_To_Decls_Or_Save --
------------------------------
procedure Prepend_To_Decls_Or_Save (Prag : Node_Id) is
Check_Prag : Node_Id;
begin
Check_Prag := Build_Pragma_Check_Equivalent (Prag);
-- Save the sole class-wide precondition (if any) for the next
-- step, where it will be merged with inherited preconditions.
if Class_Present (Prag) then
pragma Assert (No (Class_Pre));
Class_Pre := Check_Prag;
-- Accumulate the corresponding Check pragmas at the top of the
-- declarations. Prepending the items ensures that they will be
-- evaluated in their original order.
else
if Present (Insert_Node) then
Insert_After (Insert_Node, Check_Prag);
else
Prepend_To_Decls (Check_Prag);
end if;
Analyze (Check_Prag);
end if;
end Prepend_To_Decls_Or_Save;
-------------------------------------
-- Process_Inherited_Preconditions --
-------------------------------------
procedure Process_Inherited_Preconditions is
Subps : constant Subprogram_List :=
Inherited_Subprograms (Spec_Id);
Item : Node_Id;
Items : Node_Id;
Prag : Node_Id;
Subp_Id : Entity_Id;
begin
-- Process the contracts of all inherited subprograms, looking for
-- class-wide preconditions.
for Index in Subps'Range loop
Subp_Id := Subps (Index);
Items := Contract (Subp_Id);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Pragma_Name (Prag) = Name_Precondition
and then Class_Present (Prag)
then
Item :=
Build_Pragma_Check_Equivalent
(Prag => Prag,
Subp_Id => Spec_Id,
Inher_Id => Subp_Id);
-- The pragma Check equivalent of the class-wide
-- precondition is still created even though the
-- pragma may be ignored because the equivalent
-- performs semantic checks.
if Is_Checked (Prag) then
-- The spec of an inherited subprogram already
-- yielded a class-wide precondition. Merge the
-- existing precondition with the current one
-- using "or else".
if Present (Class_Pre) then
Merge_Preconditions (Item, Class_Pre);
else
Class_Pre := Item;
end if;
end if;
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
end loop;
-- Add the merged class-wide preconditions
if Present (Class_Pre) then
Prepend_To_Decls (Class_Pre);
Analyze (Class_Pre);
end if;
end Process_Inherited_Preconditions;
-------------------------------
-- Process_Preconditions_For --
-------------------------------
procedure Process_Preconditions_For (Subp_Id : Entity_Id) is
Items : constant Node_Id := Contract (Subp_Id);
Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id);
Decl : Node_Id;
Freeze_T : Boolean;
Prag : Node_Id;
begin
-- Process the contract. If the body is an expression function
-- that is a completion, freeze types within, because this may
-- not have been done yet, when the subprogram declaration and
-- its completion by an expression function appear in distinct
-- declarative lists of the same unit (visible and private).
Freeze_T :=
Was_Expression_Function (Body_Decl)
and then Sloc (Body_Id) /= Sloc (Subp_Id)
and then In_Same_Source_Unit (Body_Id, Subp_Id)
and then List_Containing (Body_Decl) /=
List_Containing (Subp_Decl);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
if Pragma_Name (Prag) = Name_Precondition
and then Is_Checked (Prag)
then
if Freeze_T
and then Present (Corresponding_Aspect (Prag))
then
Freeze_Expr_Types
(Def_Id => Subp_Id,
Typ => Standard_Boolean,
Expr =>
Expression
(First (Pragma_Argument_Associations (Prag))),
N => Body_Decl);
end if;
Prepend_To_Decls_Or_Save (Prag);
end if;
Prag := Next_Pragma (Prag);
end loop;
end if;
-- The subprogram declaration being processed is actually a body
-- stub. The stub may carry a precondition pragma, in which case
-- it must be taken into account. The pragma appears after the
-- stub.
if Nkind (Subp_Decl) = N_Subprogram_Body_Stub then
-- Inspect the declarations following the body stub
Decl := Next (Subp_Decl);
while Present (Decl) loop
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
if Pragma_Name (Decl) = Name_Precondition
and then Is_Checked (Decl)
then
Prepend_To_Decls_Or_Save (Decl);
end if;
-- Skip internally generated code
elsif not Comes_From_Source (Decl) then
null;
-- Preconditions are usually grouped together. There is no
-- need to inspect the whole declarative list.
else
exit;
end if;
Next (Decl);
end loop;
end if;
end Process_Preconditions_For;
-- Local variables
Decls : constant List_Id := Declarations (Body_Decl);
Decl : Node_Id;
-- Start of processing for Process_Preconditions
begin
-- Find the proper insertion point for all pragma Check equivalents
if Present (Decls) then
Decl := First (Decls);
while Present (Decl) loop
-- First source declaration terminates the search, because all
-- preconditions must be evaluated prior to it, by definition.
if Comes_From_Source (Decl) then
exit;
-- Certain internally generated object renamings such as those
-- for discriminants and protection fields must be elaborated
-- before the preconditions are evaluated, as their expressions
-- may mention the discriminants. The renamings include those
-- for private components so we need to find the last such.
elsif Is_Prologue_Renaming (Decl) then
while Present (Next (Decl))
and then Is_Prologue_Renaming (Next (Decl))
loop
Next (Decl);
end loop;
Insert_Node := Decl;
-- Otherwise the declaration does not come from source. This
-- also terminates the search, because internal code may raise
-- exceptions which should not preempt the preconditions.
else
exit;
end if;
Next (Decl);
end loop;
end if;
-- The processing of preconditions is done in reverse order (body
-- first), because each pragma Check equivalent is inserted at the
-- top of the declarations. This ensures that the final order is
-- consistent with following diagram:
-- <inherited preconditions>
-- <preconditions from spec>
-- <preconditions from body>
Process_Preconditions_For (Body_Id);
if Present (Spec_Id) then
Process_Preconditions_For (Spec_Id);
Process_Inherited_Preconditions;
end if;
end Process_Preconditions;
-- Local variables
Restore_Scope : Boolean := False;
Result : Entity_Id;
Stmts : List_Id := No_List;
Subp_Id : Entity_Id;
-- Start of processing for Expand_Subprogram_Contract
begin
-- Obtain the entity of the initial declaration
if Present (Spec_Id) then
Subp_Id := Spec_Id;
else
Subp_Id := Body_Id;
end if;
-- Do not perform expansion activity when it is not needed
if not Expander_Active then
return;
-- GNATprove does not need the executable semantics of a contract
elsif GNATprove_Mode then
return;
-- The contract of a generic subprogram or one declared in a generic
-- context is not expanded, as the corresponding instance will provide
-- the executable semantics of the contract.
elsif Is_Generic_Subprogram (Subp_Id) or else Inside_A_Generic then
return;
-- All subprograms carry a contract, but for some it is not significant
-- and should not be processed. This is a small optimization.
elsif not Has_Significant_Contract (Subp_Id) then
return;
-- The contract of an ignored Ghost subprogram does not need expansion,
-- because the subprogram and all calls to it will be removed.
elsif Is_Ignored_Ghost_Entity (Subp_Id) then
return;
-- Do not re-expand the same contract. This scenario occurs when a
-- construct is rewritten into something else during its analysis
-- (expression functions for instance).
elsif Has_Expanded_Contract (Subp_Id) then
return;
end if;
-- Prevent multiple expansion attempts of the same contract
Set_Has_Expanded_Contract (Subp_Id);
-- Ensure that the formal parameters are visible when expanding all
-- contract items.
if not In_Open_Scopes (Subp_Id) then
Restore_Scope := True;
Push_Scope (Subp_Id);
if Is_Generic_Subprogram (Subp_Id) then
Install_Generic_Formals (Subp_Id);
else
Install_Formals (Subp_Id);
end if;
end if;
-- The expansion of a subprogram contract involves the creation of Check
-- pragmas to verify the contract assertions of the spec and body in a
-- particular order. The order is as follows:
-- function Example (...) return ... is
-- procedure _Postconditions (...) is
-- begin
-- <refined postconditions from body>
-- <postconditions from body>
-- <postconditions from spec>
-- <inherited postconditions>
-- <contract case consequences>
-- <invariant check of function result>
-- <invariant and predicate checks of parameters>
-- end _Postconditions;
-- <inherited preconditions>
-- <preconditions from spec>
-- <preconditions from body>
-- <contract case conditions>
-- <source declarations>
-- begin
-- <source statements>
-- _Preconditions (Result);
-- return Result;
-- end Example;
-- Routine _Postconditions holds all contract assertions that must be
-- verified on exit from the related subprogram.
-- Step 1: Handle all preconditions. This action must come before the
-- processing of pragma Contract_Cases because the pragma prepends items
-- to the body declarations.
Process_Preconditions;
-- Step 2: Handle all postconditions. This action must come before the
-- processing of pragma Contract_Cases because the pragma appends items
-- to list Stmts.
Process_Postconditions (Stmts);
-- Step 3: Handle pragma Contract_Cases. This action must come before
-- the processing of invariants and predicates because those append
-- items to list Stmts.
Process_Contract_Cases (Stmts);
-- Step 4: Apply invariant and predicate checks on a function result and
-- all formals. The resulting checks are accumulated in list Stmts.
Add_Invariant_And_Predicate_Checks (Subp_Id, Stmts, Result);
-- Step 5: Construct procedure _Postconditions
Build_Postconditions_Procedure (Subp_Id, Stmts, Result);
if Restore_Scope then
End_Scope;
end if;
end Expand_Subprogram_Contract;
-------------------------------
-- Freeze_Previous_Contracts --
-------------------------------
procedure Freeze_Previous_Contracts (Body_Decl : Node_Id) is
function Causes_Contract_Freezing (N : Node_Id) return Boolean;
pragma Inline (Causes_Contract_Freezing);
-- Determine whether arbitrary node N causes contract freezing
procedure Freeze_Contracts;
pragma Inline (Freeze_Contracts);
-- Freeze the contracts of all eligible constructs which precede body
-- Body_Decl.
procedure Freeze_Enclosing_Package_Body;
pragma Inline (Freeze_Enclosing_Package_Body);
-- Freeze the contract of the nearest package body (if any) which
-- encloses body Body_Decl.
------------------------------
-- Causes_Contract_Freezing --
------------------------------
function Causes_Contract_Freezing (N : Node_Id) return Boolean is
begin
return Nkind (N) in
N_Entry_Body | N_Package_Body | N_Protected_Body |
N_Subprogram_Body | N_Subprogram_Body_Stub | N_Task_Body;
end Causes_Contract_Freezing;
----------------------
-- Freeze_Contracts --
----------------------
procedure Freeze_Contracts is
Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
Decl : Node_Id;
begin
-- Nothing to do when the body which causes freezing does not appear
-- in a declarative list because there cannot possibly be constructs
-- with contracts.
if not Is_List_Member (Body_Decl) then
return;
end if;
-- Inspect the declarations preceding the body, and freeze individual
-- contracts of eligible constructs.
Decl := Prev (Body_Decl);
while Present (Decl) loop
-- Stop the traversal when a preceding construct that causes
-- freezing is encountered as there is no point in refreezing
-- the already frozen constructs.
if Causes_Contract_Freezing (Decl) then
exit;
-- Entry or subprogram declarations
elsif Nkind (Decl) in N_Abstract_Subprogram_Declaration
| N_Entry_Declaration
| N_Generic_Subprogram_Declaration
| N_Subprogram_Declaration
then
Analyze_Entry_Or_Subprogram_Contract
(Subp_Id => Defining_Entity (Decl),
Freeze_Id => Body_Id);
-- Objects
elsif Nkind (Decl) = N_Object_Declaration then
Analyze_Object_Contract
(Obj_Id => Defining_Entity (Decl),
Freeze_Id => Body_Id);
-- Protected units
elsif Nkind (Decl) in N_Protected_Type_Declaration
| N_Single_Protected_Declaration
then
Analyze_Protected_Contract (Defining_Entity (Decl));
-- Subprogram body stubs
elsif Nkind (Decl) = N_Subprogram_Body_Stub then
Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl));
-- Task units
elsif Nkind (Decl) in N_Single_Task_Declaration
| N_Task_Type_Declaration
then
Analyze_Task_Contract (Defining_Entity (Decl));
end if;
if Nkind (Decl) in N_Full_Type_Declaration
| N_Private_Type_Declaration
| N_Task_Type_Declaration
| N_Protected_Type_Declaration
| N_Formal_Type_Declaration
then
Analyze_Type_Contract (Defining_Identifier (Decl));
end if;
Prev (Decl);
end loop;
end Freeze_Contracts;
-----------------------------------
-- Freeze_Enclosing_Package_Body --
-----------------------------------
procedure Freeze_Enclosing_Package_Body is
Orig_Decl : constant Node_Id := Original_Node (Body_Decl);
Par : Node_Id;
begin
-- Climb the parent chain looking for an enclosing package body. Do
-- not use the scope stack, because a body utilizes the entity of its
-- corresponding spec.
Par := Parent (Body_Decl);
while Present (Par) loop
if Nkind (Par) = N_Package_Body then
Analyze_Package_Body_Contract
(Body_Id => Defining_Entity (Par),
Freeze_Id => Defining_Entity (Body_Decl));
exit;
-- Do not look for an enclosing package body when the construct
-- which causes freezing is a body generated for an expression
-- function and it appears within a package spec. This ensures
-- that the traversal will not reach too far up the parent chain
-- and attempt to freeze a package body which must not be frozen.
-- package body Enclosing_Body
-- with Refined_State => (State => Var)
-- is
-- package Nested is
-- type Some_Type is ...;
-- function Cause_Freezing return ...;
-- private
-- function Cause_Freezing is (...);
-- end Nested;
--
-- Var : Nested.Some_Type;
elsif Nkind (Par) = N_Package_Declaration
and then Nkind (Orig_Decl) = N_Expression_Function
then
exit;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (Par) then
exit;
end if;
Par := Parent (Par);
end loop;
end Freeze_Enclosing_Package_Body;
-- Local variables
Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
-- Start of processing for Freeze_Previous_Contracts
begin
pragma Assert (Causes_Contract_Freezing (Body_Decl));
-- A body that is in the process of being inlined appears from source,
-- but carries name _parent. Such a body does not cause freezing of
-- contracts.
if Chars (Body_Id) = Name_uParent then
return;
end if;
Freeze_Enclosing_Package_Body;
Freeze_Contracts;
end Freeze_Previous_Contracts;
---------------------------------
-- Inherit_Subprogram_Contract --
---------------------------------
procedure Inherit_Subprogram_Contract
(Subp : Entity_Id;
From_Subp : Entity_Id)
is
procedure Inherit_Pragma (Prag_Id : Pragma_Id);
-- Propagate a pragma denoted by Prag_Id from From_Subp's contract to
-- Subp's contract.
--------------------
-- Inherit_Pragma --
--------------------
procedure Inherit_Pragma (Prag_Id : Pragma_Id) is
Prag : constant Node_Id := Get_Pragma (From_Subp, Prag_Id);
New_Prag : Node_Id;
begin
-- A pragma cannot be part of more than one First_Pragma/Next_Pragma
-- chains, therefore the node must be replicated. The new pragma is
-- flagged as inherited for distinction purposes.
if Present (Prag) then
New_Prag := New_Copy_Tree (Prag);
Set_Is_Inherited_Pragma (New_Prag);
Add_Contract_Item (New_Prag, Subp);
end if;
end Inherit_Pragma;
-- Start of processing for Inherit_Subprogram_Contract
begin
-- Inheritance is carried out only when both entities are subprograms
-- with contracts.
if Is_Subprogram_Or_Generic_Subprogram (Subp)
and then Is_Subprogram_Or_Generic_Subprogram (From_Subp)
and then Present (Contract (From_Subp))
then
Inherit_Pragma (Pragma_Extensions_Visible);
end if;
end Inherit_Subprogram_Contract;
-------------------------------------
-- Instantiate_Subprogram_Contract --
-------------------------------------
procedure Instantiate_Subprogram_Contract (Templ : Node_Id; L : List_Id) is
procedure Instantiate_Pragmas (First_Prag : Node_Id);
-- Instantiate all contract-related source pragmas found in the list,
-- starting with pragma First_Prag. Each instantiated pragma is added
-- to list L.
-------------------------
-- Instantiate_Pragmas --
-------------------------
procedure Instantiate_Pragmas (First_Prag : Node_Id) is
Inst_Prag : Node_Id;
Prag : Node_Id;
begin
Prag := First_Prag;
while Present (Prag) loop
if Is_Generic_Contract_Pragma (Prag) then
Inst_Prag :=
Copy_Generic_Node (Prag, Empty, Instantiating => True);
Set_Analyzed (Inst_Prag, False);
Append_To (L, Inst_Prag);
end if;
Prag := Next_Pragma (Prag);
end loop;
end Instantiate_Pragmas;
-- Local variables
Items : constant Node_Id := Contract (Defining_Entity (Templ));
-- Start of processing for Instantiate_Subprogram_Contract
begin
if Present (Items) then
Instantiate_Pragmas (Pre_Post_Conditions (Items));
Instantiate_Pragmas (Contract_Test_Cases (Items));
Instantiate_Pragmas (Classifications (Items));
end if;
end Instantiate_Subprogram_Contract;
----------------------------------------
-- Save_Global_References_In_Contract --
----------------------------------------
procedure Save_Global_References_In_Contract
(Templ : Node_Id;
Gen_Id : Entity_Id)
is
procedure Save_Global_References_In_List (First_Prag : Node_Id);
-- Save all global references in contract-related source pragmas found
-- in the list, starting with pragma First_Prag.
------------------------------------
-- Save_Global_References_In_List --
------------------------------------
procedure Save_Global_References_In_List (First_Prag : Node_Id) is
Prag : Node_Id;
begin
Prag := First_Prag;
while Present (Prag) loop
if Is_Generic_Contract_Pragma (Prag) then
Save_Global_References (Prag);
end if;
Prag := Next_Pragma (Prag);
end loop;
end Save_Global_References_In_List;
-- Local variables
Items : constant Node_Id := Contract (Defining_Entity (Templ));
-- Start of processing for Save_Global_References_In_Contract
begin
-- The entity of the analyzed generic copy must be on the scope stack
-- to ensure proper detection of global references.
Push_Scope (Gen_Id);
if Permits_Aspect_Specifications (Templ)
and then Has_Aspects (Templ)
then
Save_Global_References_In_Aspects (Templ);
end if;
if Present (Items) then
Save_Global_References_In_List (Pre_Post_Conditions (Items));
Save_Global_References_In_List (Contract_Test_Cases (Items));
Save_Global_References_In_List (Classifications (Items));
end if;
Pop_Scope;
end Save_Global_References_In_Contract;
end Contracts;
|
-- Root name-space for general, reusable packages from
-- JSA Research & Innovation.
--
-- Licence: ISC
package JSA
with Pure
is
end JSA;
|
pragma License (Unrestricted);
-- runtime unit specialized for Darwin
with C.pthread;
with C.signal;
package System.Stack is
pragma Preelaborate;
procedure Get (
Thread : C.pthread.pthread_t := C.pthread.pthread_self;
Top, Bottom : out Address);
procedure Fake_Return_From_Signal_Handler;
function Fault_Address (Info : C.signal.siginfo_t) return Address;
pragma Inline (Fault_Address);
end System.Stack;
|
with Ada.Real_Time; use Ada.Real_Time;
package body Solar_System.Graphics is
procedure Draw_Body (Object : Body_T; Canvas : Canvas_ID) is
Tail_Color : RGBA_T;
Dimmer : Color_Component_T := 30;
function Dim (C : Color_Component_T) return Color_Component_T is
begin
if C < Dimmer then
return 0;
else
return C - Dimmer;
end if;
end Dim;
begin
if Object.Visible then
Draw_Sphere
(Canvas => Canvas,
Position => (Object.Pos.X, Object.Pos.Y, 0.0),
Radius => Object.Radius,
Color => Object.Color);
if Object.With_Tail then
Tail_Color := Object.Color;
for I in reverse Tail_T'First .. Tail_T'Last loop
Draw_Sphere
(Canvas => Canvas,
Position => (Object.Tail (I).X, Object.Tail (I).Y, 0.0),
Radius => Object.Radius,
Color => Tail_Color);
Tail_Color.R := Dim (Tail_Color.R);
Tail_Color.G := Dim (Tail_Color.G);
Tail_Color.B := Dim (Tail_Color.B);
end loop;
end if;
end if;
end Draw_Body;
end Solar_System.Graphics;
|
private with NXP_SVD.INPUTMUX;
with HAL.GPIO;
package NXP.Pint is
type Pint_PinInt is
(PinInt_0, PinInt_1, PinInt_2, PinInt_3, PinInt_4, PinInt_5, PinInt_6, PinInt_7)
with Size => 3;
type Mode_Selection is (Pint_Edge, Pint_Level);
type Edge_Selection is (Pint_Rising, Pint_Falling);
type Level_Selection is (Pint_Low, Pint_High);
type Pint_Configuration is record
Slot : Pint_PinInt;
Mode : Mode_Selection;
Edge : Edge_Selection;
Level : Level_Selection;
end record;
procedure Enable_Pint;
procedure Disable_Pint;
function Pint_Interrupt_Pending (IntNum : Pint_PinInt) return Boolean;
procedure Pint_Clear_Interrupt (IntNum : Pint_PinInt);
end NXP.Pint;
|
-----------------------------------------------------------------------
-- awa-wikis-beans -- Beans for module wikis
-- Copyright (C) 2015, 2016, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Strings.Unbounded;
with Ada.Strings.Hash;
with Ada.Strings.Wide_Wide_Unbounded;
with Ada.Strings.Wide_Wide_Hash;
with Ada.Containers.Indefinite_Hashed_Maps;
with Util.Beans.Basic;
with Util.Beans.Objects;
with ADO;
with ADO.Objects;
with ASF.Helpers.Beans;
with Wiki.Strings;
with Wiki.Attributes;
with Wiki.Plugins.Templates;
with Wiki.Plugins.Conditions;
with Wiki.Plugins.Variables;
with AWA.Wikis.Modules;
with AWA.Wikis.Models;
with AWA.Tags.Beans;
with AWA.Counters.Beans;
with AWA.Components.Wikis;
-- == Ada Beans ==
-- Several bean types are provided to represent and manage the blogs and their posts.
-- The blog module registers the bean constructors when it is initialized.
-- To use them, one must declare a bean definition in the application XML configuration.
--
-- @include-bean wikis.xml
-- @include-bean wiki-page.xml
-- @include-bean wiki-pages.xml
-- @include-bean wiki-history.xml
-- @include-bean wiki-list.xml
package AWA.Wikis.Beans is
use Ada.Strings.Wide_Wide_Unbounded;
package Image_Info_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => Wiki.Strings.WString,
Element_Type => Wikis.Models.Wiki_Image_Info,
Hash => Ada.Strings.Wide_Wide_Hash,
Equivalent_Keys => "=",
"=" => AWA.Wikis.Models."=");
package Template_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String,
Element_Type => Wiki.Strings.UString,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=",
"=" => "=");
type Wiki_Links_Bean is new AWA.Components.Wikis.Link_Renderer_Bean
and Util.Beans.Basic.List_Bean with record
-- The wiki space identifier.
Wiki_Space_Id : ADO.Identifier;
Images : Image_Info_Maps.Map;
-- The info bean used for the list iterator.
Info : aliased AWA.Wikis.Models.Wiki_Image_Info;
Info_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- Current index when iterating over the list.
Pos : Image_Info_Maps.Cursor;
end record;
procedure Make_Image_Link (Renderer : in out Wiki_Links_Bean;
Link : in Wiki.Strings.WString;
Info : in AWA.Wikis.Models.Wiki_Image_Info;
URI : out Unbounded_Wide_Wide_String;
Width : in out Natural;
Height : in out Natural);
procedure Find_Image_Link (Renderer : in out Wiki_Links_Bean;
Link : in Wiki.Strings.WString;
URI : out Unbounded_Wide_Wide_String;
Width : in out Natural;
Height : in out Natural);
-- Get the image link that must be rendered from the wiki image link.
overriding
procedure Make_Image_Link (Renderer : in out Wiki_Links_Bean;
Link : in Wiki.Strings.WString;
URI : out Unbounded_Wide_Wide_String;
Width : in out Natural;
Height : in out Natural);
-- Get the page link that must be rendered from the wiki page link.
overriding
procedure Make_Page_Link (Renderer : in out Wiki_Links_Bean;
Link : in Wiki.Strings.WString;
URI : out Unbounded_Wide_Wide_String;
Exists : out Boolean);
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Links_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Get the number of elements in the list.
overriding
function Get_Count (From : Wiki_Links_Bean) return Natural;
-- Set the current row index. Valid row indexes start at 1.
overriding
procedure Set_Row_Index (From : in out Wiki_Links_Bean;
Index : in Natural);
-- Get the element at the current row index.
overriding
function Get_Row (From : in Wiki_Links_Bean) return Util.Beans.Objects.Object;
-- The Wiki template plugin that retrieves the template content from the Wiki space.
type Wiki_Template_Bean is new Wiki.Plugins.Templates.Template_Plugin
and Wiki.Plugins.Plugin_Factory
and Util.Beans.Basic.List_Bean with record
-- The wiki space identifier.
Wiki_Space_Id : ADO.Identifier;
-- The list of templates that have been loaded.
Templates : Template_Maps.Map;
-- Condition plugin.
Condition : aliased Wiki.Plugins.Conditions.Condition_Plugin;
-- Variable plugin.
Variable : aliased Wiki.Plugins.Variables.Variable_Plugin;
List_Variable : aliased Wiki.Plugins.Variables.List_Variable_Plugin;
-- The info bean used for the list iterator.
Info : aliased AWA.Wikis.Models.Wiki_Info;
Info_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- Current index when iterating over the list.
Pos : Template_Maps.Cursor;
end record;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Template_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Get the number of elements in the list.
overriding
function Get_Count (From : Wiki_Template_Bean) return Natural;
-- Set the current row index. Valid row indexes start at 1.
overriding
procedure Set_Row_Index (From : in out Wiki_Template_Bean;
Index : in Natural);
-- Get the element at the current row index.
overriding
function Get_Row (From : in Wiki_Template_Bean) return Util.Beans.Objects.Object;
-- Get the template content for the plugin evaluation.
overriding
procedure Get_Template (Plugin : in out Wiki_Template_Bean;
Params : in out Wiki.Attributes.Attribute_List;
Template : out Wiki.Strings.UString);
-- Find a plugin knowing its name.
overriding
function Find (Factory : in Wiki_Template_Bean;
Name : in String) return Wiki.Plugins.Wiki_Plugin_Access;
type Wiki_Space_Bean is new AWA.Wikis.Models.Wiki_Space_Bean with record
Module : Modules.Wiki_Module_Access := null;
-- List of tags associated with the question.
Tags : aliased AWA.Tags.Beans.Tag_List_Bean;
Tags_Bean : Util.Beans.Basic.Readonly_Bean_Access;
end record;
type Wiki_Space_Bean_Access is access all Wiki_Space_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Space_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Space_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create or save the wiki space.
overriding
procedure Save (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load the wiki space information.
overriding
procedure Load (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Delete the wiki space.
procedure Delete (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Wiki_Space_Bean bean instance.
function Create_Wiki_Space_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
function Get_Wiki_Space_Bean is
new ASF.Helpers.Beans.Get_Bean (Element_Type => Wiki_Space_Bean,
Element_Access => Wiki_Space_Bean_Access);
type Wiki_View_Bean is new AWA.Wikis.Models.Wiki_View_Info with record
-- The wiki module instance.
Module : Modules.Wiki_Module_Access := null;
-- The wiki space identifier.
Wiki_Space : Wiki_Space_Bean_Access;
-- List of tags associated with the wiki page.
Tags : aliased AWA.Tags.Beans.Tag_List_Bean;
Tags_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- The read page counter associated with the wiki page.
Counter : aliased AWA.Counters.Beans.Counter_Bean (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => Models.WIKI_PAGE_TABLE);
Counter_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- The wiki page links.
Links : aliased Wiki_Links_Bean;
Links_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- The wiki plugins.
Plugins : aliased Wiki_Template_Bean;
Plugins_Bean : Util.Beans.Basic.Readonly_Bean_Access;
end record;
type Wiki_View_Bean_Access is access all Wiki_View_Bean'Class;
-- Set the wiki identifier.
procedure Set_Wiki_Id (Into : in out Wiki_View_Bean;
Id : in ADO.Identifier);
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_View_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_View_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Get the wiki syntax for the page.
function Get_Syntax (From : in Wiki_View_Bean) return Wiki.Wiki_Syntax;
-- Load the information about the wiki page to display it.
overriding
procedure Load (Bean : in out Wiki_View_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Wiki_View_Bean bean instance.
function Create_Wiki_View_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
function Get_Wiki_View_Bean is
new ASF.Helpers.Beans.Get_Bean (Element_Type => Wiki_View_Bean,
Element_Access => Wiki_View_Bean_Access);
-- Get a select item list which contains a list of wiki formats.
function Create_Format_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Wiki Page Bean
-- ------------------------------
-- The <tt>Wiki_Page_Bean</tt> is used to edit a wiki page. The model type inherit from
-- the <tt>Wiki_Page</tt> and the wiki page text is hold in the <tt>Content</tt> member.
-- When a new content is updated, the <tt>Set_Value</tt> procedure sets it in the
-- <tt>New_Content</tt> member. It is compared to the current wiki text to decide whether
-- we have to create a new version or not.
type Wiki_Page_Bean is new AWA.Wikis.Models.Wiki_Page_Bean with record
Module : Modules.Wiki_Module_Access := null;
-- The page content.
Content : Models.Wiki_Content_Ref;
Has_Content : Boolean := False;
Format : AWA.Wikis.Models.Format_Type := AWA.Wikis.Models.FORMAT_CREOLE;
New_Content : Ada.Strings.Unbounded.Unbounded_String;
New_Comment : Ada.Strings.Unbounded.Unbounded_String;
Wiki_Space : Wiki_Space_Bean_Access;
-- List of tags associated with the wiki page.
Tags : aliased AWA.Tags.Beans.Tag_List_Bean;
Tags_Bean : Util.Beans.Basic.Readonly_Bean_Access;
end record;
type Wiki_Page_Bean_Access is access all Wiki_Page_Bean'Class;
-- Returns True if the wiki page has a new text content and requires
-- a new version to be created.
function Has_New_Content (Bean : in Wiki_Page_Bean) return Boolean;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Page_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Page_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create or save the wiki page.
overriding
procedure Save (Bean : in out Wiki_Page_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load the wiki page.
overriding
procedure Load (Bean : in out Wiki_Page_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Setup the wiki page for the creation.
overriding
procedure Setup (Bean : in out Wiki_Page_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Delete the wiki page.
overriding
procedure Delete (Bean : in out Wiki_Page_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Wiki_Page_Bean bean instance.
function Create_Wiki_Page_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Wiki List Bean
-- ------------------------------
-- The <b>Wiki_List_Bean</b> gives a list of visible wikis to be displayed to users.
-- The list can be filtered by a given tag. The list pagination is supported.
type Wiki_List_Bean is new AWA.Wikis.Models.Wiki_Page_List_Bean with record
Module : Modules.Wiki_Module_Access := null;
Pages : aliased AWA.Wikis.Models.Wiki_Page_Info_List_Bean;
Tags : AWA.Tags.Beans.Entity_Tag_Map;
Pages_Bean : AWA.Wikis.Models.Wiki_Page_Info_List_Bean_Access;
-- The wiki space identifier.
Wiki_Space : Wiki_Space_Bean_Access;
end record;
type Wiki_List_Bean_Access is access all Wiki_List_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
procedure Load (From : in out Wiki_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load the list of pages. If a tag was set, filter the list of pages with the tag.
procedure Load_List (Into : in out Wiki_List_Bean);
-- Create the Post_List_Bean bean instance.
function Create_Wiki_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Wiki Version List Bean
-- ------------------------------
type Wiki_Version_List_Bean is new AWA.Wikis.Models.Wiki_Version_List_Bean with record
Module : Modules.Wiki_Module_Access := null;
Versions : aliased AWA.Wikis.Models.Wiki_Version_Info_List_Bean;
Versions_Bean : AWA.Wikis.Models.Wiki_Version_Info_List_Bean_Access;
end record;
type Wiki_Version_List_Bean_Access is access all Wiki_Version_List_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Version_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Version_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
procedure Load (Into : in out Wiki_Version_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Post_List_Bean bean instance.
function Create_Wiki_Version_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Wiki page info Bean
-- ------------------------------
-- The <tt>Wiki_Page_Info_Bean</tt> is used to provide information about a wiki page.
-- It analyzes the page content and extract the list of links, images, words, templates
-- used in the page.
type Wiki_Page_Info_Bean is new AWA.Wikis.Models.Wiki_Page_Info_Bean with record
Module : Modules.Wiki_Module_Access := null;
Page : Wiki_View_Bean_Access;
-- List of words contained in the wiki page.
Words : aliased AWA.Tags.Beans.Tag_Info_List_Bean;
Words_Bean : AWA.Tags.Beans.Tag_Info_List_Bean_Access;
-- List of wiki page links used in the wiki page.
Links : aliased AWA.Tags.Beans.Tag_Info_List_Bean;
Links_Bean : AWA.Tags.Beans.Tag_Info_List_Bean_Access;
-- List of external links used in the wiki page.
Ext_Links : aliased AWA.Tags.Beans.Tag_Info_List_Bean;
Ext_Links_Bean : AWA.Tags.Beans.Tag_Info_List_Bean_Access;
end record;
type Wiki_Page_Info_Bean_Access is access all Wiki_Page_Info_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Page_Info_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Page_Info_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
procedure Load (Into : in out Wiki_Page_Info_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Wiki_Page_Info_Bean bean instance.
function Create_Wiki_Page_Info_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Wiki image info Bean
-- ------------------------------
-- The <tt>Wiki_Image_Info_Bean</tt> is used to provide information about a wiki image.
type Wiki_Image_Info_Bean is new AWA.Wikis.Models.Wiki_Image_Bean with record
Module : Modules.Wiki_Module_Access := null;
Page : Wiki_View_Bean_Access;
-- The folder name and image name.
Folder_Name : Ada.Strings.Unbounded.Unbounded_String;
Name : Ada.Strings.Unbounded.Unbounded_String;
-- The wiki space identifier and wiki page identifer that uses the image.
Wiki_Id : ADO.Identifier := ADO.NO_IDENTIFIER;
Page_Id : ADO.Identifier := ADO.NO_IDENTIFIER;
-- Information about images.
List : aliased AWA.Wikis.Models.Wiki_Image_Info_List_Bean;
List_Bean : AWA.Wikis.Models.Wiki_Image_Info_List_Bean_Access;
end record;
type Wiki_Image_Info_Bean_Access is access all Wiki_Image_Info_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Wiki_Image_Info_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Image_Info_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Load the information about the image.
overriding
procedure Load (Into : in out Wiki_Image_Info_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Wiki_Image_Info_BEan bean instance.
function Create_Wiki_Image_Info_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
type Init_Flag is (INIT_WIKI_LIST);
type Init_Map is array (Init_Flag) of Boolean;
-- ------------------------------
-- Admin List Bean
-- ------------------------------
-- The <b>Wiki_Admin_Bean</b> is used for the administration of a wiki. It gives the
-- list of wikis and pages that are created, published or not.
type Wiki_Admin_Bean is new Util.Beans.Basic.Bean with record
Module : AWA.Wikis.Modules.Wiki_Module_Access := null;
-- The wiki space identifier.
Wiki_Id : ADO.Identifier := ADO.NO_IDENTIFIER;
-- List of blogs.
Wiki_List : aliased AWA.Wikis.Models.Wiki_Info_List_Bean;
Wiki_List_Bean : AWA.Wikis.Models.Wiki_Info_List_Bean_Access;
-- Initialization flags.
Init_Flags : aliased Init_Map := (others => False);
Flags : access Init_Map;
end record;
type Wiki_Admin_Bean_Access is access all Wiki_Admin_Bean;
-- Get the wiki space identifier.
function Get_Wiki_Id (List : in Wiki_Admin_Bean) return ADO.Identifier;
overriding
function Get_Value (List : in Wiki_Admin_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Wiki_Admin_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Load the list of wikis.
procedure Load_Wikis (List : in Wiki_Admin_Bean);
-- Create the Wiki_Admin_Bean bean instance.
function Create_Wiki_Admin_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
end AWA.Wikis.Beans;
|
pragma Ada_2012;
with Ada.Containers;
with Protypo.Api.Engine_Values.Constant_Wrappers;
package body Protypo.Match_Data_Wrappers is
Matched_Field_Name : constant Id := "matched?";
function Wrap (Match_Data : Gnat.Regpat.Match_Array;
Source : String)
return Handlers.Ambivalent_Interface_Access
is
use Gnat.Regpat;
Wrapper : constant Match_Data_Wrapper_Access :=
new Match_Data_Wrapper (Match_Data'Last);
begin
if Match_Data (0) = No_Match then
Wrapper.Matched := False;
Wrapper.Submatches := (others => Null_Unbounded_String);
else
Wrapper.Matched := True;
for Idx in Match_Data'Range loop
Wrapper.Submatches (Idx) :=
To_Unbounded_String
(Source (Match_Data (Idx).First .. Match_Data (Idx).Last));
end loop;
end if;
return Handlers.Ambivalent_Interface_Access (Wrapper);
end Wrap;
function Wrap (Match_Data : Gnat.Regpat.Match_Array;
Source : String)
return Engine_Value
is (Handlers.Create (Wrap (Match_Data, Source)));
--------------
-- Is_Field --
--------------
function Is_Field (X : Match_Data_Wrapper; Field : Id) return Boolean
is (Field = Matched_Field_Name);
---------
-- Get --
---------
function Get (X : Match_Data_Wrapper; Field : Id) return Handler_Value is
begin
if Field = Matched_Field_Name then
return Constant_Wrappers.To_Handler_Value (X.Matched);
else
raise Run_Time_Error
with "Unknown field for match data: '" & String (Field) & "'";
end if;
end Get;
---------
-- Get --
---------
function Get
(X : Match_Data_Wrapper; Index : Engine_Value_Vectors.Vector)
return Handler_Value
is
use type Ada.Containers.Count_Type;
begin
if Index.Length /= 1 then
raise Run_Time_Error with "Match data requires 1 index only";
end if;
if Index.First_Element.Class /= Int then
raise Run_Time_Error with "Match data requires one integer index";
end if;
declare
use Constant_Wrappers;
Idx : constant Integer := Get_Integer (Index.First_Element);
begin
if not (Idx in X.Submatches'Range) then
raise Run_Time_Error
with "Match data index "
& Idx'Image
& " outside of valid range "
& X.Submatches'First'Image & ".." & X.Submatches'Last'Image;
end if;
return To_Handler_Value (X.Submatches (Idx));
end;
end Get;
end Protypo.Match_Data_Wrappers;
|
-----------------------------------------------------------------------
-- wiki-parsers -- Wiki parser
-- Copyright (C) 2011, 2015, 2016, 2018, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 Wiki.Attributes;
with Wiki.Plugins;
with Wiki.Filters;
with Wiki.Strings;
with Wiki.Documents;
with Wiki.Streams;
-- == Wiki Parsers {#wiki-parsers} ==
-- The `Wikis.Parsers` package implements a parser for several well known wiki formats
-- but also for HTML. While reading the input, the parser populates a wiki `Document`
-- instance with headers, paragraphs, links, and other elements.
--
-- Engine : Wiki.Parsers.Parser;
--
-- Before using the parser, it must be configured to choose the syntax by using the
-- `Set_Syntax` procedure:
--
-- Engine.Set_Syntax (Wiki.SYNTAX_HTML);
--
-- The parser can be configured to use filters. A filter is added by using the
-- `Add_Filter` procedure. A filter is added at begining of the chain so that
-- the filter added last is called first. The wiki `Document` is always built through
-- the filter chain so this allows filters to change or alter the content that was parsed.
--
-- Engine.Add_Filter (TOC'Unchecked_Access);
-- Engine.Add_Filter (Filter'Unchecked_Access);
--
-- The `Parse` procedure is then used to parse either a string content or some stream
-- represented by the `Input_Stream` interface. After the `Parse` procedure
-- completes, the `Document` instance holds the wiki document.
--
-- Engine.Parse (Some_Text, Doc);
--
package Wiki.Parsers is
pragma Preelaborate;
type Parser is tagged limited private;
-- Set the plugin factory to find and use plugins.
procedure Set_Plugin_Factory (Engine : in out Parser;
Factory : in Wiki.Plugins.Plugin_Factory_Access);
-- Set the wiki syntax that the wiki engine must use.
procedure Set_Syntax (Engine : in out Parser;
Syntax : in Wiki_Syntax := SYNTAX_MIX);
-- Add a filter in the wiki engine.
procedure Add_Filter (Engine : in out Parser;
Filter : in Wiki.Filters.Filter_Type_Access);
-- Set the plugin context.
procedure Set_Context (Engine : in out Parser;
Context : in Wiki.Plugins.Plugin_Context);
-- Parse the wiki text contained in <b>Text</b> according to the wiki syntax
-- defined on the parser. The string is assumed to be in UTF-8 format.
procedure Parse (Engine : in out Parser;
Text : in String;
Doc : in out Wiki.Documents.Document);
-- Parse the wiki text contained in <b>Text</b> according to the wiki syntax
-- defined on the parser.
procedure Parse (Engine : in out Parser;
Text : in Wiki.Strings.WString;
Doc : in out Wiki.Documents.Document);
-- Parse the wiki text contained in <b>Text</b> according to the wiki syntax
-- defined on the parser.
procedure Parse (Engine : in out Parser;
Text : in Wiki.Strings.UString;
Doc : in out Wiki.Documents.Document);
-- Parse the wiki stream managed by <tt>Stream</tt> according to the wiki syntax configured
-- on the wiki engine.
procedure Parse (Engine : in out Parser;
Stream : in Wiki.Streams.Input_Stream_Access;
Doc : in out Wiki.Documents.Document);
private
type Parser_Handler is access procedure (P : in out Parser;
Token : in Wiki.Strings.WChar);
type Parser_Table is array (0 .. 127) of Parser_Handler;
type Parser_Table_Access is access constant Parser_Table;
type Parser is tagged limited record
Context : aliased Wiki.Plugins.Plugin_Context;
Pending : Wiki.Strings.WChar;
Has_Pending : Boolean;
Previous_Syntax : Wiki_Syntax;
Table : Parser_Table_Access;
Document : Wiki.Documents.Document;
Format : Wiki.Format_Map;
Text : Wiki.Strings.BString (512);
Empty_Line : Boolean := True;
Is_Eof : Boolean := False;
In_Paragraph : Boolean := False;
In_List : Boolean := False;
In_Table : Boolean := False;
Need_Paragraph : Boolean := True;
Link_Double_Bracket : Boolean := False;
Link_No_Space : Boolean := False;
Is_Dotclear : Boolean := False;
Link_Title_First : Boolean := False;
Check_Image_Link : Boolean := False;
Header_Offset : Integer := 0;
Preformat_Column : Natural := 1;
Quote_Level : Natural := 0;
Escape_Char : Wiki.Strings.WChar;
Param_Char : Wiki.Strings.WChar;
List_Level : Natural := 0;
Previous_Tag : Html_Tag := UNKNOWN_TAG;
Reader : Wiki.Streams.Input_Stream_Access := null;
Attributes : Wiki.Attributes.Attribute_List;
end record;
-- Peek the next character from the wiki text buffer.
procedure Peek (P : in out Parser'Class;
Token : out Wiki.Strings.WChar);
pragma Inline (Peek);
-- Put back the character so that it will be returned by the next call to Peek.
procedure Put_Back (P : in out Parser;
Token : in Wiki.Strings.WChar);
-- Skip all the spaces and tabs as well as end of the current line (CR+LF).
procedure Skip_End_Of_Line (P : in out Parser);
-- Skip white spaces and tabs.
procedure Skip_Spaces (P : in out Parser);
-- Flush the wiki text that was collected in the text buffer.
procedure Flush_Text (P : in out Parser);
-- Flush the wiki dl/dt/dd definition list.
procedure Flush_List (P : in out Parser);
-- Append a character to the wiki text buffer.
procedure Parse_Text (P : in out Parser;
Token : in Wiki.Strings.WChar);
-- Check if the link refers to an image and must be rendered as an image.
-- Returns a positive index of the start the the image link.
function Is_Image (P : in Parser;
Link : in Wiki.Strings.WString) return Natural;
-- Returns true if we are included from another wiki content.
function Is_Included (P : in Parser) return Boolean;
-- Find the plugin with the given name.
-- Returns null if there is no such plugin.
function Find (P : in Parser;
Name : in Wiki.Strings.WString) return Wiki.Plugins.Wiki_Plugin_Access;
type String_Array is array (Positive range <>) of Wiki.String_Access;
-- Extract a list of parameters separated by the given separator (ex: '|').
procedure Parse_Parameters (P : in out Parser;
Separator : in Wiki.Strings.WChar;
Terminator : in Wiki.Strings.WChar;
Names : in String_Array;
Max : in Positive := 200);
procedure Start_Element (P : in out Parser;
Tag : in Wiki.Html_Tag;
Attributes : in out Wiki.Attributes.Attribute_List);
procedure End_Element (P : in out Parser;
Tag : in Wiki.Html_Tag);
procedure Parse_Token (P : in out Parser);
end Wiki.Parsers;
|
with Interfaces;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Numerics.Generic_Complex_Elementary_Functions;
with Ada.Numerics.Generic_Complex_Types;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Numerics;
with GL.Types;
with Maths;
package GA_Maths is
package Float_List_Package is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Float);
type Float_List is new Float_List_Package.List with null Record;
package Float_Sort_Package is new
Float_List_Package.Generic_Sorting ("<");
package Float_Array_Package is new Ada.Numerics.Generic_Real_Arrays (float);
package Long_Float_Array_Package is new
Ada.Numerics.Generic_Real_Arrays (Long_Float);
package Float_Functions is new Ada.Numerics.Generic_Elementary_Functions (Float);
package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Float);
package Complex_Functions is new
Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Types);
subtype Float_Matrix is Float_Array_Package.Real_Matrix;
subtype Float_Vector is Float_Array_Package.Real_Vector;
subtype Long_Float_Matrix is Long_Float_Array_Package.Real_Matrix;
type float_3 is digits 3;
type Bit_Map is new integer range 0 .. 2 ** 30;
type Bit_Map_Array is array (integer range <>) of Bit_Map;
type Coords_Continuous_Array is array (integer range <>) of float;
subtype Scalar_Coords is Coords_Continuous_Array (1 .. 1);
subtype Bivector_Coords is Coords_Continuous_Array (1 .. 1);
subtype MV_Coordinate_Array is Coords_Continuous_Array (1 .. 32);
subtype Safe_Float is Float range Float'Range;
type Fixed_4 is delta 0.01 range -1.0 .. 1.0;
for Fixed_4'Small use 0.01;
US_1 : constant Interfaces.Unsigned_32 := Interfaces.Unsigned_32 (1);
type Vector_Unsigned_3D is array (1 .. 3) of Interfaces.Unsigned_32;
subtype Basis_Index is Integer range 1 .. 2; -- e1, e2
subtype Grade_Index is Integer range 0 .. 2; -- Scalar, Vector, Bivector
subtype Grade_Usage is Interfaces.Unsigned_32;
type Basis_Array is array (Basis_Index) of integer;
type Grade_Array is array (Grade_Index) of integer;
type Integer_Array is array (Integer range <>) of Integer;
type Array_I2 is array (1 .. 2) of integer;
type Array_I3 is array (1 .. 3) of integer;
type Array_I4 is array (1 .. 4) of integer;
type Array_I8 is array (1 .. 8) of integer;
type Array_UI2 is array (1 .. 2) of Interfaces.Unsigned_32;
type Array_UI3 is array (1 .. 3) of Interfaces.Unsigned_32;
type Array_UI4 is array (1 .. 4) of Interfaces.Unsigned_32;
type Array_UI8 is array (1 .. 8) of Interfaces.Unsigned_32;
type Array_F1 is array (1 .. 1) of float;
type Array_F2 is array (1 .. 2) of float;
type Array_F4 is array (1 .. 4) of float;
type Array_F8 is array (1 .. 8) of float;
type Float_Array is array (Natural range <>) of float;
type GA_Matrix3 is new Float_Matrix (1 .. 3, 1 .. 3);
type Vector_Unsigned is record
C1_e1 : Interfaces.Unsigned_64;
C2_e2 : Interfaces.Unsigned_64;
C3_e3 : Interfaces.Unsigned_64;
end record;
type Float_2D is array (1 .. 2) of float;
type Float_3D is array (1 .. 3) of float;
type Float_4D is array (1 .. 4) of float;
type Coord4_Array is Array (1 .. 4) of float;
Infinity : constant Safe_Float := Safe_Float'Last;
Pi : constant float := Ada.Numerics.Pi;
Two_Pi : constant float := 2.0 * Ada.Numerics.Pi;
GU_0 : constant Grade_Usage := 1;
GU_1 : constant Grade_Usage := 2;
GU_2 : constant Grade_Usage := 4;
GU_4 : constant Grade_Usage := 8;
GU_8 : constant Grade_Usage := 16;
GU_16 : constant Grade_Usage := 32;
function Is_Anti_Euclidean (aMatrix : Float_Matrix) return Boolean;
function Is_Diagonal (aMatrix : Float_Matrix) return Boolean;
function Is_Euclidean (aMatrix : Float_Matrix) return Boolean;
function Is_Symetric (aMatrix : Float_Matrix) return Boolean;
function Maximum (I1, I2 : Integer) return Integer;
function Maximum (F1, F2 : Float) return Float;
function Maximum (F1, F2 : Long_Float) return Long_Float;
function Minimum (I1, I2 : Integer) return Integer;
function Minimum (F1, F2 : Float) return Float;
function Minimum (F1, F2 : Long_Float) return Long_Float;
function Rotation_Matrix (Angle : Maths.Radian;
Axis : GL.Types.Singles.Vector3)
return GL.Types.Singles.Matrix3;
function Rotation_Matrix (Angle : Maths.Degree;
Axis : GL.Types.Singles.Vector3)
return GL.Types.Singles.Matrix3;
function Vector_Rotation_Matrix (From, To : GL.Types.Singles.Vector3)
return GL.Types.Singles.Matrix4;
end GA_Maths;
|
--------------------------------------------------------------------------------
-- --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU Lesser General Public --
-- License as published by the Free Software Foundation; either --
-- version 2.1 of the License, 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. See the GNU --
-- Lesser General Public License for more details. --
-- --
-- You should have received a copy of the GNU Lesser General Public --
-- License along with this library; if not, write to the Free Software --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
-- --
--------------------------------------------------------------------------------
-- @brief MessageTrans types and methods.
-- $Author$
-- $Date$
-- $Revision$
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with RASCAL.OS; use RASCAL.OS;
package RASCAL.MessageTrans is
Messages_File_Is_Closed : Exception;
--
-- Open messages file.
--
function Open_File (Filename : in String) return Messages_Handle_Type;
--
-- Lookup token in messages file.
--
function Lookup (Token : in String;
MCB : in Messages_Handle_Type;
Parameter1 : in String := "";
Parameter2 : in String := "";
Parameter3 : in String := "";
Parameter4 : in String := "") return String;
--
-- Close messages file.
--
procedure Close_File (MCB : Messages_Handle_Type);
--
-- Looks up the Token and interprets the result as a boolean.
--
procedure Read_Boolean (Token : in String;
Value : in out Boolean;
MCB : in Messages_Handle_Type);
--
-- Looks up the Token and interprets the result as an integer.
--
procedure Read_Integer (Token : in String;
Value : in out Integer;
MCB : in Messages_Handle_Type);
--
-- Looks up the Token and interprets the result as a string.
--
procedure Read_String (Token : in String;
Value : in out Unbounded_String;
MCB : in Messages_Handle_Type);
end RASCAL.MessageTrans;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <denkpadje@gmail.com>
--
-- 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.Containers.Ring_Buffers;
with Orka.Futures.Slots;
generic
Maximum_Graphs : Positive;
-- Maximum number of separate job graphs
Capacity : Positive;
package Orka.Jobs.Queues is
type Executor_Kind is (CPU, GPU);
type Pair is record
Job : Job_Ptr := Null_Job;
Future : Futures.Pointers.Mutable_Pointer;
end record;
package Buffers is new Orka.Containers.Ring_Buffers (Pair);
type Buffer_Array is array (Executor_Kind) of Buffers.Buffer (Capacity);
protected type Queue is
entry Enqueue (Element : Job_Ptr; Future : in out Futures.Pointers.Mutable_Pointer);
-- with Pre => not Element.Has_Dependencies
-- and then Element.all not in Parallel_Job'Class
-- and then Element /= Null_Job
entry Dequeue (Executor_Kind)
(Element : out Pair; Stop : out Boolean)
with Post => Stop or else not Element.Job.Has_Dependencies;
procedure Shutdown;
function Length (Kind : Executor_Kind) return Natural;
private
entry Enqueue_Job (Executor_Kind)
(Element : Job_Ptr; Future : in out Futures.Pointers.Mutable_Pointer);
Buffers : Buffer_Array;
Should_Stop : Boolean := False;
end Queue;
type Queue_Ptr is not null access all Queue;
-----------------------------------------------------------------------------
package Slots is new Orka.Futures.Slots (Count => Maximum_Graphs);
end Orka.Jobs.Queues;
|
-- Copyright 2019 Michael Casadevall <michael@casadevall.pro>
--
-- 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 System;
with Ada.Unchecked_Conversion;
with Interfaces.C;
package body DNSCatcher.Utils is
function Ntohs
(Network_Short : Unsigned_16)
return Unsigned_16
is
function Internal
(Network_Short : Unsigned_16)
return Unsigned_16;
pragma Import (C, Internal, "ntohs");
begin
return Internal (Network_Short);
end Ntohs;
function Ntohl
(Network_Long : Unsigned_32)
return Unsigned_32
is
function Internal
(Network_Long : Unsigned_32)
return Unsigned_32;
pragma Import (C, Internal, "ntohl");
begin
return Internal (Network_Long);
end Ntohl;
function Htons
(Host_Short : Unsigned_16)
return Unsigned_16
is
function Internal
(Host_Short : Unsigned_16)
return Unsigned_16;
pragma Import (C, Internal, "htons");
begin
return Internal (Host_Short);
end Htons;
function Htonl
(Host_Long : Unsigned_32)
return Unsigned_32
is
function Internal
(Host_Long : Unsigned_32)
return Unsigned_32;
pragma Import (C, Internal, "htonl");
begin
return Internal (Host_Long);
end Htonl;
-- Bullshit functions to handle Endianess, wish Ada handled this better
function Read_Unsigned_16
(Raw_Data : Stream_Element_Array_Ptr;
Offset : in out Stream_Element_Offset)
return Unsigned_16
is
Network_Short : Unsigned_16;
function From_Network_Value is new Ada.Unchecked_Conversion
(Source => Stream_Element_Array, Target => Unsigned_16);
begin
Network_Short := Ntohs (From_Network_Value (Raw_Data
(Offset .. Offset + 1)));
Offset := Offset + 2;
return Network_Short;
end Read_Unsigned_16;
-- 32-bit bullshit
function Read_Unsigned_32
(Raw_Data : Stream_Element_Array_Ptr;
Offset : in out Stream_Element_Offset)
return Unsigned_32
is
Network_Long : Unsigned_32;
function From_Network_Value is new Ada.Unchecked_Conversion
(Source => Stream_Element_Array, Target => Unsigned_32);
begin
Network_Long := Ntohl (From_Network_Value (Raw_Data
(Offset .. Offset + 3)));
Offset := Offset + 4;
return Network_Long;
end Read_Unsigned_32;
function Inet_Ntop
(Family : IP_Addr_Family;
Raw_Data : Unbounded_String)
return Unbounded_String
is
procedure Internal
(Family : Interfaces.C.int;
Src : System.Address;
Dst : System.Address;
Len : Interfaces.C.int);
pragma Import (C, Internal, "ada_inet_ntop");
-- 16 is the max length of a v4 string + null
C_IP_String : Interfaces.C.char_array (1 .. 16);
begin
-- Call the ada helper function
Internal
(Interfaces.C.int (Family'Enum_Rep), To_String (Raw_Data)'Address,
C_IP_String'Address, 15);
return To_Unbounded_String (Interfaces.C.To_Ada (C_IP_String));
end Inet_Ntop;
end DNSCatcher.Utils;
|
with Ada.Unchecked_Conversion;
package body QOI
with SPARK_Mode
is
pragma Compile_Time_Error
(Storage_Element'Size /= 8, "Invalid element size");
pragma Warnings (Off, "lower bound test optimized away");
subtype SE is Storage_Element;
function As_Index is new Ada.Unchecked_Conversion (SE, Index_Tag);
function As_Diff is new Ada.Unchecked_Conversion (SE, Diff_Tag);
function As_LUMA_A is new Ada.Unchecked_Conversion (SE, LUMA_Tag_A);
function As_LUMA_B is new Ada.Unchecked_Conversion (SE, LUMA_Tag_B);
function As_Run is new Ada.Unchecked_Conversion (SE, Run_Tag);
type Color is record
R, G, B, A : SE;
end record;
type Index_Range is range 0 .. 63;
subtype Run_Range is Unsigned_32 range 0 .. 62;
function Hash (C : Color) return SE;
----------
-- Hash --
----------
function Hash (C : Color) return SE is
begin
return C.R * 3 + C.G * 5 + C.B * 7 + C.A * 11;
end Hash;
------------
-- Encode --
------------
procedure Encode (Pix : Storage_Array;
Desc : QOI_Desc;
Output : out Storage_Array;
Output_Size : out Storage_Count)
is
P : Storage_Count := Output'First;
Run : Run_Range := 0;
function Valid_Parameters return Boolean is
(Valid_Size (Desc)
and then Output'First >= 0
and then Output'Last < Storage_Count'Last
and then Output'Length >= Encode_Worst_Case (Desc))
with Ghost;
procedure Push (D : Unsigned_32)
with
Pre =>
Valid_Parameters
and then P in Output'First .. Output'Last - 3
and then Output (Output'First .. P - 1)'Initialized,
Post =>
P = P'Old + 4 and then Output (Output'First .. P - 1)'Initialized;
generic
type T is private;
procedure Gen_Push_8 (D : T)
with
Pre =>
Valid_Parameters
and then T'Size = 8
and then P in Output'Range
and then Output (Output'First .. P - 1)'Initialized,
Post =>
P = P'Old + 1 and then Output (Output'First .. P - 1)'Initialized;
----------
-- Push --
----------
procedure Push (D : Unsigned_32) is
begin
Output (P) := SE (Shift_Right (D and 16#FF_00_00_00#, 24));
Output (P + 1) := SE (Shift_Right (D and 16#00_FF_00_00#, 16));
Output (P + 2) := SE (Shift_Right (D and 16#00_00_FF_00#, 8));
Output (P + 3) := SE (Shift_Right (D and 16#00_00_00_FF#, 0));
P := P + 4;
end Push;
----------------
-- Gen_Push_8 --
----------------
procedure Gen_Push_8 (D : T) is
function To_Byte is new Ada.Unchecked_Conversion (T, SE);
begin
Output (P) := To_Byte (D);
P := P + 1;
end Gen_Push_8;
procedure Push is new Gen_Push_8 (SE);
procedure Push_Run is new Gen_Push_8 (Run_Tag);
procedure Push_Index is new Gen_Push_8 (Index_Tag);
procedure Push_Diff is new Gen_Push_8 (Diff_Tag);
procedure Push_Luma_A is new Gen_Push_8 (LUMA_Tag_A);
procedure Push_Luma_B is new Gen_Push_8 (LUMA_Tag_B);
Number_Of_Pixels : constant Storage_Count := Desc.Width * Desc.Height;
subtype Pixel_Index is Storage_Count range 0 .. Number_Of_Pixels - 1;
function Read (Index : Pixel_Index) return Color;
----------
-- Read --
----------
function Read (Index : Pixel_Index) return Color is
Result : Color;
Offset : constant Storage_Count := Index * Desc.Channels;
Buffer_Index : constant Storage_Count := Pix'First + Offset;
begin
Result.R := Pix (Buffer_Index);
Result.G := Pix (Buffer_Index + 1);
Result.B := Pix (Buffer_Index + 2);
if Desc.Channels = 4 then
Result.A := Pix (Buffer_Index + 3);
else
Result.A := 255;
end if;
return Result;
end Read;
Index : array (Index_Range) of Color := (others => ((0, 0, 0, 0)));
Px_Prev : Color := (R => 0, G => 0, B => 0, A => 255);
Px : Color;
begin
if Output'Length < Encode_Worst_Case (Desc) then
Output_Size := 0;
return;
end if;
Push (QOI_MAGIC);
Push (Unsigned_32 (Desc.Width));
Push (Unsigned_32 (Desc.Height));
Push (SE (Desc.Channels));
Push (SE (Desc.Colorspace'Enum_Rep));
pragma Assert (P = Output'First + QOI_HEADER_SIZE);
pragma Assert (Run = 0);
pragma Assert (Output (Output'First .. P - 1)'Initialized);
for Px_Index in Pixel_Index loop
pragma Loop_Invariant
(Run in 0 .. Run_Range'Last - 1);
pragma Loop_Invariant
(P - Output'First in
0
..
QOI_HEADER_SIZE
+ (Desc.Channels + 1) *
(Storage_Count (Px_Index) - Storage_Count (Run)));
pragma Loop_Invariant (Output (Output'First .. P - 1)'Initialized);
pragma Loop_Invariant (if Desc.Channels /= 4 then Px_Prev.A = 255);
Px := Read (Px_Index);
if Px = Px_Prev then
Run := Run + 1;
if Run = Run_Range'Last or else Px_Index = Pixel_Index'Last
then
Push_Run ((Op => QOI_OP_RUN, Run => Uint6 (Run - 1)));
Run := 0;
end if;
else
if Run > 0 then
Push_Run ((Op => QOI_OP_RUN, Run => Uint6 (Run - 1)));
Run := 0;
end if;
pragma Assert (Run = 0);
pragma Assert (P - Output'First in
0 .. QOI_HEADER_SIZE + (Desc.Channels + 1) *
Storage_Count (Px_Index));
declare
Index_Pos : constant Index_Range :=
Index_Range (Hash (Px) mod Index'Length);
begin
if Index (Index_Pos) = Px then
Push_Index ((Op => QOI_OP_INDEX,
Index => Uint6 (Index_Pos)));
else
Index (Index_Pos) := Px;
if Px.A = Px_Prev.A then
declare
VR : constant Integer :=
Integer (Px.R) - Integer (Px_Prev.R);
VG : constant Integer :=
Integer (Px.G) - Integer (Px_Prev.G);
VB : constant Integer :=
Integer (Px.B) - Integer (Px_Prev.B);
VG_R : constant Integer := VR - VG;
VG_B : constant Integer := VB - VG;
begin
if VR in -2 .. 1
and then VG in -2 .. 1
and then VB in -2 .. 1
then
Push_Diff ((Op => QOI_OP_DIFF,
DR => Uint2 (VR + 2),
DG => Uint2 (VG + 2),
DB => Uint2 (VB + 2)));
elsif VG_R in -8 .. 7
and then VG in -32 .. 31
and then VG_B in -8 .. 7
then
Push_Luma_A ((Op => QOI_OP_LUMA,
DG => Uint6 (VG + 32)));
Push_Luma_B ((DG_R => Uint4 (VG_R + 8),
DG_B => Uint4 (VG_B + 8)));
else
Push (QOI_OP_RGB);
Push (Px.R);
Push (Px.G);
Push (Px.B);
end if;
end;
else
Push (QOI_OP_RGBA);
Push (Px.R);
Push (Px.G);
Push (Px.B);
Push (Px.A);
end if;
end if;
end;
end if;
pragma Assert (Output (Output'First .. P - 1)'Initialized);
Px_Prev := Px;
end loop;
pragma Assert (Output (Output'First .. P - 1)'Initialized);
pragma Assert (P - Output'First in
0 .. QOI_HEADER_SIZE + (Desc.Channels + 1) * Number_Of_Pixels);
for Index in QOI_PADDING'Range loop
pragma Loop_Invariant
(P - Output'First in
0 .. Encode_Worst_Case (Desc) - QOI_PADDING'Length + Index - 1);
pragma Loop_Invariant (Output (Output'First .. P - 1)'Initialized);
Push (QOI_PADDING (Index));
end loop;
pragma Assert (Output (Output'First .. P - 1)'Initialized);
Output_Size := P - Output'First;
end Encode;
--------------
-- Get_Desc --
--------------
procedure Get_Desc (Data : Storage_Array;
Desc : out QOI_Desc)
is
P : Storage_Count := Data'First;
procedure Pop8 (Result : out SE);
procedure Pop32 (Result : out Unsigned_32);
procedure Pop8 (Result : out SE) is
begin
Result := Data (P);
P := P + 1;
end Pop8;
procedure Pop32 (Result : out Unsigned_32) is
A : constant Unsigned_32 := Unsigned_32 (Data (P));
B : constant Unsigned_32 := Unsigned_32 (Data (P + 1));
C : constant Unsigned_32 := Unsigned_32 (Data (P + 2));
D : constant Unsigned_32 := Unsigned_32 (Data (P + 3));
begin
Result :=
Shift_Left (A, 24)
or Shift_Left (B, 16)
or Shift_Left (C, 8)
or D;
P := P + 4;
end Pop32;
Magic : Unsigned_32;
Temp_32 : Unsigned_32;
Temp_8 : SE;
begin
if Data'Length < QOI_HEADER_SIZE then
Desc := (0, 0, 0, SRGB);
return;
end if;
Pop32 (Magic);
if Magic /= QOI_MAGIC then
Desc := (0, 0, 0, SRGB);
return;
end if;
Pop32 (Temp_32);
Desc.Width := Storage_Count (Temp_32);
Pop32 (Temp_32);
Desc.Height := Storage_Count (Temp_32);
Pop8 (Temp_8);
Desc.Channels := Storage_Count (Temp_8);
Pop8 (Temp_8);
pragma Assert (P = Data'First + QOI_HEADER_SIZE);
if Temp_8 not in SE (Colorspace_Kind'Enum_Rep (SRGB))
| SE (Colorspace_Kind'Enum_Rep (SRGB_Linear_Alpha))
then
Desc := (0, 0, 0, SRGB);
return;
end if;
Desc.Colorspace := Colorspace_Kind'Enum_Val (Temp_8);
end Get_Desc;
------------
-- Decode --
------------
procedure Decode (Data : Storage_Array;
Desc : out QOI_Desc;
Output : out Storage_Array;
Output_Size : out Storage_Count)
is
P : Storage_Count;
Out_Index : Storage_Count := Output'First;
procedure Pop (Result : out SE) with
Pre =>
P in Data'Range
and then Data'Last < Storage_Count'Last,
Post => P = P'Old + 1;
procedure Push (D : SE) with
Pre =>
Out_Index in Output'Range
and then Output'Last < Storage_Count'Last
and then Output (Output'First .. Out_Index - 1)'Initialized,
Post =>
Out_Index = Out_Index'Old + 1
and then Output (Output'First .. Out_Index - 1)'Initialized;
procedure Pop (Result : out SE) is
begin
Result := Data (P);
P := P + 1;
end Pop;
procedure Push (D : SE) is
begin
Output (Out_Index) := D;
Out_Index := Out_Index + 1;
end Push;
begin
Get_Desc (Data, Desc);
if Desc.Width = 0
or else
Desc.Height = 0
or else
Desc.Channels not in 3 .. 4
or else
Desc.Height > Storage_Count'Last / Desc.Width
or else
Desc.Channels > Storage_Count'Last / (Desc.Width * Desc.Height)
or else
Output'Length < Desc.Width * Desc.Height * Desc.Channels
then
Output_Size := 0;
return;
end if;
P := Data'First + QOI_HEADER_SIZE;
declare
Number_Of_Pixels : constant Storage_Count := Desc.Width * Desc.Height;
subtype Pixel_Index is Storage_Count range 0 .. Number_Of_Pixels - 1;
Last_Chunk : constant Storage_Count := Data'Last - QOI_PADDING'Length;
Index : array (Index_Range) of Color := (others => ((0, 0, 0, 0)));
Px : Color := (R => 0, G => 0, B => 0, A => 255);
B1, B2 : SE;
VG : SE;
Run : Run_Range := 0;
begin
for Px_Index in Pixel_Index loop
pragma Loop_Invariant (P >= Data'First);
pragma Loop_Invariant
(Out_Index
= Output'First + Desc.Channels * (Px_Index - Pixel_Index'First));
pragma Loop_Invariant
(Output (Output'First .. Out_Index - 1)'Initialized);
if Run > 0 then
Run := Run - 1;
elsif P <= Last_Chunk then
Pop (B1);
if B1 = QOI_OP_RGB then
Pop (Px.R);
Pop (Px.G);
Pop (Px.B);
elsif B1 = QOI_OP_RGBA then
Pop (Px.R);
Pop (Px.G);
Pop (Px.B);
Pop (Px.A);
else
case As_Run (B1).Op is
when QOI_OP_INDEX =>
Px := Index (Index_Range (As_Index (B1).Index));
when QOI_OP_DIFF =>
Px.R := Px.R + SE (As_Diff (B1).DR) - 2;
Px.G := Px.G + SE (As_Diff (B1).DG) - 2;
Px.B := Px.B + SE (As_Diff (B1).DB) - 2;
when QOI_OP_LUMA =>
Pop (B2);
VG := SE (As_LUMA_A (B1).DG) - 32;
Px.R := Px.R + VG + SE (As_LUMA_B (B2).DG_R) - 8;
Px.G := Px.G + VG;
Px.B := Px.B + VG + SE (As_LUMA_B (B2).DG_B) - 8;
when QOI_OP_RUN =>
Run := Run_Range (As_Run (B1).Run mod 63);
end case;
end if;
Index (Index_Range (Hash (Px) mod Index'Length)) := Px;
end if;
Push (Px.R);
Push (Px.G);
Push (Px.B);
if Desc.Channels = 4 then
Push (Px.A);
end if;
end loop;
end;
Output_Size := Out_Index - Output'First;
end Decode;
end QOI;
|
package Giza.Bitmap_Fonts.FreeSerifBoldItalic12pt7b is
Font : constant Giza.Font.Ref_Const;
private
FreeSerifBoldItalic12pt7bBitmaps : aliased constant Font_Bitmap := (
16#07#, 16#07#, 16#07#, 16#0F#, 16#0E#, 16#0E#, 16#0C#, 16#0C#, 16#08#,
16#18#, 16#10#, 16#00#, 16#00#, 16#60#, 16#F0#, 16#F0#, 16#60#, 16#61#,
16#F1#, 16#F8#, 16#F8#, 16#6C#, 16#34#, 16#12#, 16#08#, 16#01#, 16#8C#,
16#06#, 16#60#, 16#31#, 16#80#, 16#CC#, 16#06#, 16#30#, 16#FF#, 16#F0#,
16#C6#, 16#03#, 16#18#, 16#0C#, 16#C0#, 16#63#, 16#0F#, 16#FF#, 16#0C#,
16#60#, 16#33#, 16#01#, 16#8C#, 16#06#, 16#30#, 16#19#, 16#80#, 16#00#,
16#80#, 16#08#, 16#07#, 16#C1#, 16#96#, 16#31#, 16#33#, 16#13#, 16#3A#,
16#23#, 16#E0#, 16#1E#, 16#01#, 16#F0#, 16#07#, 16#80#, 16#7C#, 16#05#,
16#C4#, 16#CC#, 16#48#, 16#CC#, 16#8C#, 16#F8#, 16#83#, 16#30#, 16#1E#,
16#01#, 16#00#, 16#00#, 16#02#, 16#07#, 16#83#, 16#03#, 16#9F#, 16#81#,
16#C4#, 16#20#, 16#71#, 16#10#, 16#3C#, 16#44#, 16#0E#, 16#22#, 16#03#,
16#88#, 16#80#, 16#E4#, 16#40#, 16#1E#, 16#21#, 16#E0#, 16#08#, 16#E4#,
16#04#, 16#71#, 16#01#, 16#3C#, 16#40#, 16#8E#, 16#10#, 16#23#, 16#88#,
16#10#, 16#E2#, 16#04#, 16#39#, 16#02#, 16#07#, 16#80#, 16#00#, 16#F0#,
16#01#, 16#98#, 16#03#, 16#98#, 16#03#, 16#98#, 16#03#, 16#B0#, 16#03#,
16#E0#, 16#03#, 16#80#, 16#0F#, 16#9F#, 16#19#, 16#CE#, 16#31#, 16#CC#,
16#61#, 16#C8#, 16#E1#, 16#C8#, 16#E0#, 16#F0#, 16#E0#, 16#E0#, 16#F0#,
16#70#, 16#78#, 16#79#, 16#3F#, 16#BE#, 16#7F#, 16#ED#, 16#20#, 16#02#,
16#08#, 16#20#, 16#C3#, 16#0E#, 16#18#, 16#30#, 16#E1#, 16#83#, 16#06#,
16#0C#, 16#18#, 16#30#, 16#20#, 16#40#, 16#80#, 16#81#, 16#01#, 16#00#,
16#10#, 16#10#, 16#20#, 16#20#, 16#40#, 16#C1#, 16#83#, 16#06#, 16#0C#,
16#18#, 16#70#, 16#E1#, 16#83#, 16#0C#, 16#18#, 16#61#, 16#86#, 16#00#,
16#00#, 16#0C#, 16#33#, 16#6C#, 16#9B#, 16#AE#, 16#1C#, 16#3F#, 16#EC#,
16#9B#, 16#36#, 16#0C#, 16#02#, 16#00#, 16#06#, 16#00#, 16#60#, 16#06#,
16#00#, 16#60#, 16#06#, 16#0F#, 16#FF#, 16#FF#, 16#F0#, 16#60#, 16#06#,
16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#31#, 16#CE#, 16#31#, 16#08#,
16#98#, 16#FF#, 16#FF#, 16#C0#, 16#6F#, 16#F6#, 16#00#, 16#80#, 16#60#,
16#10#, 16#0C#, 16#02#, 16#01#, 16#80#, 16#40#, 16#30#, 16#08#, 16#06#,
16#01#, 16#00#, 16#C0#, 16#20#, 16#18#, 16#06#, 16#03#, 16#00#, 16#03#,
16#81#, 16#C8#, 16#71#, 16#1C#, 16#33#, 16#86#, 16#E1#, 16#DC#, 16#3B#,
16#87#, 16#E0#, 16#FC#, 16#3B#, 16#87#, 16#70#, 16#EC#, 16#39#, 16#87#,
16#31#, 16#C2#, 16#30#, 16#3C#, 16#00#, 16#01#, 16#C3#, 16#F0#, 16#38#,
16#0E#, 16#03#, 16#81#, 16#C0#, 16#70#, 16#1C#, 16#07#, 16#03#, 16#80#,
16#E0#, 16#38#, 16#1C#, 16#07#, 16#01#, 16#C0#, 16#F0#, 16#FF#, 16#80#,
16#07#, 16#81#, 16#F8#, 16#47#, 16#90#, 16#70#, 16#0E#, 16#01#, 16#C0#,
16#30#, 16#0E#, 16#01#, 16#80#, 16#60#, 16#18#, 16#06#, 16#01#, 16#80#,
16#40#, 16#8F#, 16#E3#, 16#FC#, 16#FF#, 16#80#, 16#07#, 16#C3#, 16#3C#,
16#03#, 16#80#, 16#70#, 16#0C#, 16#03#, 16#81#, 16#C0#, 16#FC#, 16#07#,
16#C0#, 16#78#, 16#07#, 16#00#, 16#E0#, 16#1C#, 16#03#, 16#30#, 16#E7#,
16#10#, 16#7C#, 16#00#, 16#00#, 16#10#, 16#01#, 16#80#, 16#3C#, 16#02#,
16#E0#, 16#2E#, 16#02#, 16#70#, 16#23#, 16#82#, 16#38#, 16#21#, 16#C2#,
16#0E#, 16#1F#, 16#F9#, 16#FF#, 16#C0#, 16#38#, 16#01#, 16#C0#, 16#1C#,
16#00#, 16#E0#, 16#07#, 16#F0#, 16#7E#, 16#07#, 16#E0#, 16#80#, 16#08#,
16#01#, 16#E0#, 16#1F#, 16#83#, 16#F8#, 16#03#, 16#C0#, 16#1C#, 16#00#,
16#C0#, 16#0C#, 16#00#, 16#C0#, 16#08#, 16#61#, 16#8F#, 16#30#, 16#7C#,
16#00#, 16#00#, 16#60#, 16#78#, 16#1C#, 16#0F#, 16#01#, 16#C0#, 16#70#,
16#1F#, 16#C3#, 16#8C#, 16#E1#, 16#DC#, 16#3B#, 16#87#, 16#61#, 16#EC#,
16#3D#, 16#87#, 16#31#, 16#E2#, 16#38#, 16#3C#, 16#00#, 16#3F#, 16#EF#,
16#F9#, 16#FF#, 16#60#, 16#C8#, 16#10#, 16#06#, 16#00#, 16#80#, 16#30#,
16#0C#, 16#01#, 16#80#, 16#60#, 16#18#, 16#03#, 16#00#, 16#C0#, 16#18#,
16#06#, 16#00#, 16#03#, 16#81#, 16#88#, 16#61#, 16#8C#, 16#31#, 16#86#,
16#38#, 16#C7#, 16#B0#, 16#78#, 16#0F#, 16#86#, 16#71#, 16#87#, 16#60#,
16#6C#, 16#0D#, 16#81#, 16#B0#, 16#63#, 16#18#, 16#3E#, 16#00#, 16#07#,
16#81#, 16#C8#, 16#71#, 16#8E#, 16#33#, 16#C6#, 16#70#, 16#CE#, 16#39#,
16#C7#, 16#38#, 16#E3#, 16#38#, 16#3F#, 16#01#, 16#C0#, 16#38#, 16#0E#,
16#03#, 16#81#, 16#C0#, 16#E0#, 16#00#, 16#0C#, 16#3C#, 16#78#, 16#60#,
16#00#, 16#00#, 16#00#, 16#61#, 16#E3#, 16#C3#, 16#00#, 16#0E#, 16#0F#,
16#0F#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#38#, 16#38#,
16#18#, 16#10#, 16#20#, 16#40#, 16#00#, 16#10#, 16#07#, 16#01#, 16#F0#,
16#7C#, 16#3F#, 16#0F#, 16#80#, 16#E0#, 16#0F#, 16#80#, 16#3E#, 16#00#,
16#F8#, 16#03#, 16#E0#, 16#07#, 16#00#, 16#10#, 16#FF#, 16#FF#, 16#FF#,
16#00#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#80#, 16#07#, 16#00#,
16#3F#, 16#00#, 16#3E#, 16#00#, 16#7C#, 16#00#, 16#F8#, 16#01#, 16#E0#,
16#1F#, 16#07#, 16#E0#, 16#F8#, 16#1F#, 16#01#, 16#E0#, 16#0C#, 16#00#,
16#00#, 16#1E#, 16#19#, 16#8C#, 16#E6#, 16#70#, 16#38#, 16#38#, 16#1C#,
16#18#, 16#18#, 16#08#, 16#08#, 16#00#, 16#00#, 16#03#, 16#03#, 16#C1#,
16#E0#, 16#60#, 16#00#, 16#03#, 16#F0#, 16#07#, 16#06#, 16#06#, 16#00#,
16#86#, 16#0E#, 16#66#, 16#0D#, 16#DB#, 16#0C#, 16#E7#, 16#06#, 16#33#,
16#83#, 16#31#, 16#C3#, 16#18#, 16#E1#, 16#8C#, 16#70#, 16#CC#, 16#4C#,
16#66#, 16#46#, 16#1F#, 16#C1#, 16#80#, 16#00#, 16#30#, 16#10#, 16#07#,
16#F0#, 16#00#, 16#10#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#,
16#00#, 16#F0#, 16#01#, 16#F8#, 16#01#, 16#78#, 16#03#, 16#78#, 16#02#,
16#38#, 16#04#, 16#38#, 16#0C#, 16#38#, 16#0F#, 16#FC#, 16#18#, 16#3C#,
16#30#, 16#3C#, 16#20#, 16#3C#, 16#60#, 16#3C#, 16#F8#, 16#7F#, 16#1F#,
16#FC#, 16#07#, 16#9E#, 16#07#, 16#0F#, 16#07#, 16#0F#, 16#0F#, 16#0F#,
16#0F#, 16#1E#, 16#0E#, 16#3C#, 16#0F#, 16#E0#, 16#1E#, 16#3C#, 16#1E#,
16#1E#, 16#1C#, 16#1E#, 16#3C#, 16#1E#, 16#3C#, 16#1E#, 16#3C#, 16#3E#,
16#38#, 16#3C#, 16#7C#, 16#78#, 16#FF#, 16#E0#, 16#01#, 16#F2#, 16#0E#,
16#1C#, 16#38#, 16#18#, 16#E0#, 16#33#, 16#C0#, 16#4F#, 16#00#, 16#9E#,
16#00#, 16#7C#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#07#,
16#80#, 16#0F#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#04#, 16#1E#, 16#30#,
16#0F#, 16#80#, 16#1F#, 16#FC#, 16#01#, 16#E3#, 16#C0#, 16#70#, 16#78#,
16#1C#, 16#0E#, 16#0F#, 16#03#, 16#C3#, 16#C0#, 16#F0#, 16#E0#, 16#3C#,
16#38#, 16#0F#, 16#1E#, 16#03#, 16#C7#, 16#81#, 16#F1#, 16#C0#, 16#78#,
16#F0#, 16#1E#, 16#3C#, 16#0F#, 16#0F#, 16#03#, 16#C3#, 16#81#, 16#C1#,
16#E1#, 16#E0#, 16#FF#, 16#E0#, 16#00#, 16#1F#, 16#FF#, 16#83#, 16#C1#,
16#C1#, 16#C0#, 16#40#, 16#E0#, 16#20#, 16#70#, 16#00#, 16#78#, 16#C0#,
16#38#, 16#40#, 16#1F#, 16#E0#, 16#1E#, 16#70#, 16#0F#, 16#18#, 16#07#,
16#08#, 16#03#, 16#84#, 16#03#, 16#C0#, 16#61#, 16#E0#, 16#20#, 16#E0#,
16#30#, 16#F8#, 16#78#, 16#FF#, 16#FC#, 16#00#, 16#1F#, 16#FF#, 16#07#,
16#87#, 16#07#, 16#02#, 16#07#, 16#02#, 16#07#, 16#00#, 16#0F#, 16#18#,
16#0E#, 16#10#, 16#0F#, 16#F0#, 16#1E#, 16#70#, 16#1E#, 16#30#, 16#1C#,
16#20#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#3C#, 16#00#, 16#38#, 16#00#,
16#7C#, 16#00#, 16#FE#, 16#00#, 16#01#, 16#F9#, 16#03#, 16#C3#, 16#83#,
16#81#, 16#83#, 16#80#, 16#43#, 16#C0#, 16#23#, 16#C0#, 16#01#, 16#E0#,
16#01#, 16#F0#, 16#00#, 16#F0#, 16#3F#, 16#F8#, 16#0F#, 16#3C#, 16#07#,
16#9E#, 16#03#, 16#CF#, 16#01#, 16#C3#, 16#80#, 16#E1#, 16#E0#, 16#F0#,
16#78#, 16#70#, 16#0F#, 16#E0#, 16#00#, 16#1F#, 16#E7#, 16#F0#, 16#78#,
16#3C#, 16#07#, 16#83#, 16#C0#, 16#70#, 16#38#, 16#0F#, 16#03#, 16#80#,
16#F0#, 16#78#, 16#0E#, 16#07#, 16#80#, 16#E0#, 16#70#, 16#1F#, 16#FF#,
16#01#, 16#E0#, 16#F0#, 16#1C#, 16#0E#, 16#03#, 16#C0#, 16#E0#, 16#3C#,
16#1E#, 16#03#, 16#C1#, 16#E0#, 16#38#, 16#1E#, 16#07#, 16#C3#, 16#E0#,
16#FE#, 16#7F#, 16#00#, 16#1F#, 16#C1#, 16#E0#, 16#70#, 16#1C#, 16#07#,
16#03#, 16#C0#, 16#E0#, 16#38#, 16#1E#, 16#07#, 16#81#, 16#C0#, 16#70#,
16#3C#, 16#0F#, 16#03#, 16#81#, 16#F0#, 16#FE#, 16#00#, 16#01#, 16#FC#,
16#03#, 16#C0#, 16#0F#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#07#, 16#80#,
16#1E#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#0F#, 16#00#, 16#3C#, 16#00#,
16#E0#, 16#07#, 16#80#, 16#1E#, 16#0E#, 16#70#, 16#3B#, 16#C0#, 16#CE#,
16#01#, 16#F0#, 16#00#, 16#1F#, 16#EF#, 16#83#, 16#C1#, 16#81#, 16#C1#,
16#80#, 16#E1#, 16#80#, 16#F1#, 16#80#, 16#79#, 16#00#, 16#39#, 16#00#,
16#1F#, 16#80#, 16#1F#, 16#E0#, 16#0F#, 16#70#, 16#07#, 16#3C#, 16#07#,
16#8E#, 16#03#, 16#C7#, 16#81#, 16#E3#, 16#C0#, 16#E0#, 16#E0#, 16#F8#,
16#78#, 16#FE#, 16#FE#, 16#00#, 16#1F#, 16#E0#, 16#0F#, 16#00#, 16#1C#,
16#00#, 16#38#, 16#00#, 16#70#, 16#01#, 16#E0#, 16#03#, 16#80#, 16#07#,
16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#03#,
16#C0#, 16#27#, 16#00#, 16#CE#, 16#03#, 16#3C#, 16#1E#, 16#FF#, 16#FC#,
16#0F#, 16#80#, 16#7E#, 16#0F#, 16#00#, 16#F0#, 16#1E#, 16#03#, 16#E0#,
16#3C#, 16#0F#, 16#80#, 16#B8#, 16#17#, 16#01#, 16#70#, 16#5E#, 16#02#,
16#F1#, 16#BC#, 16#05#, 16#E2#, 16#70#, 16#13#, 16#C8#, 16#E0#, 16#23#,
16#B3#, 16#C0#, 16#47#, 16#47#, 16#81#, 16#0F#, 16#8E#, 16#02#, 16#1E#,
16#1C#, 16#04#, 16#38#, 16#78#, 16#08#, 16#70#, 16#F0#, 16#30#, 16#C3#,
16#E0#, 16#F9#, 16#0F#, 16#E0#, 16#1F#, 16#03#, 16#E0#, 16#F0#, 16#38#,
16#1E#, 16#02#, 16#03#, 16#E0#, 16#C0#, 16#BC#, 16#10#, 16#13#, 16#C2#,
16#02#, 16#78#, 16#40#, 16#47#, 16#90#, 16#10#, 16#F2#, 16#02#, 16#0F#,
16#40#, 16#41#, 16#E8#, 16#10#, 16#1E#, 16#02#, 16#03#, 16#C0#, 16#40#,
16#38#, 16#08#, 16#06#, 16#03#, 16#00#, 16#40#, 16#10#, 16#08#, 16#00#,
16#01#, 16#F8#, 16#07#, 16#1C#, 16#0E#, 16#0E#, 16#1E#, 16#0F#, 16#3C#,
16#0F#, 16#3C#, 16#0F#, 16#78#, 16#0F#, 16#78#, 16#0F#, 16#F8#, 16#1F#,
16#F0#, 16#1E#, 16#F0#, 16#1E#, 16#F0#, 16#3C#, 16#F0#, 16#3C#, 16#F0#,
16#78#, 16#70#, 16#70#, 16#38#, 16#E0#, 16#1F#, 16#80#, 16#1F#, 16#FC#,
16#07#, 16#9E#, 16#07#, 16#0F#, 16#07#, 16#0F#, 16#07#, 16#0F#, 16#0F#,
16#0F#, 16#0E#, 16#1E#, 16#0E#, 16#3C#, 16#1F#, 16#F0#, 16#1E#, 16#00#,
16#1C#, 16#00#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#38#, 16#00#, 16#38#,
16#00#, 16#7C#, 16#00#, 16#FE#, 16#00#, 16#01#, 16#F8#, 16#07#, 16#1C#,
16#0E#, 16#0E#, 16#1E#, 16#0F#, 16#3C#, 16#0F#, 16#3C#, 16#0F#, 16#78#,
16#0F#, 16#78#, 16#1F#, 16#F8#, 16#1F#, 16#F0#, 16#1E#, 16#F0#, 16#1E#,
16#F0#, 16#3C#, 16#F0#, 16#3C#, 16#F0#, 16#78#, 16#70#, 16#70#, 16#39#,
16#C0#, 16#0E#, 16#00#, 16#08#, 16#02#, 16#3F#, 16#04#, 16#7F#, 16#F8#,
16#83#, 16#F0#, 16#1F#, 16#F8#, 16#07#, 16#9E#, 16#07#, 16#8F#, 16#07#,
16#0F#, 16#0F#, 16#0F#, 16#0F#, 16#0F#, 16#0F#, 16#1E#, 16#0E#, 16#3C#,
16#1F#, 16#F0#, 16#1E#, 16#F0#, 16#1C#, 16#F0#, 16#3C#, 16#F0#, 16#3C#,
16#78#, 16#3C#, 16#78#, 16#3C#, 16#78#, 16#7C#, 16#3C#, 16#FE#, 16#3E#,
16#07#, 16#91#, 16#C7#, 16#18#, 16#63#, 16#82#, 16#38#, 16#23#, 16#C0#,
16#3E#, 16#01#, 16#F0#, 16#0F#, 16#80#, 16#7C#, 16#01#, 16#E0#, 16#1E#,
16#40#, 16#E4#, 16#0E#, 16#60#, 16#CE#, 16#1C#, 16#9F#, 16#00#, 16#7F#,
16#FE#, 16#E7#, 16#9D#, 16#0E#, 16#16#, 16#3C#, 16#20#, 16#78#, 16#40#,
16#E0#, 16#01#, 16#C0#, 16#07#, 16#80#, 16#0F#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#F0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#0F#, 16#00#,
16#1E#, 16#00#, 16#FF#, 16#00#, 16#7F#, 16#1F#, 16#3C#, 16#0E#, 16#38#,
16#04#, 16#38#, 16#0C#, 16#78#, 16#08#, 16#78#, 16#08#, 16#70#, 16#08#,
16#70#, 16#10#, 16#F0#, 16#10#, 16#F0#, 16#10#, 16#F0#, 16#10#, 16#F0#,
16#20#, 16#F0#, 16#20#, 16#F0#, 16#20#, 16#F0#, 16#40#, 16#78#, 16#C0#,
16#3F#, 16#00#, 16#FF#, 16#1F#, 16#3C#, 16#06#, 16#3C#, 16#04#, 16#3C#,
16#08#, 16#3C#, 16#08#, 16#3C#, 16#10#, 16#3C#, 16#20#, 16#1C#, 16#20#,
16#1E#, 16#40#, 16#1E#, 16#80#, 16#1E#, 16#80#, 16#1F#, 16#00#, 16#1E#,
16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#08#, 16#00#, 16#FE#, 16#7C#,
16#79#, 16#E1#, 16#C1#, 16#8F#, 16#0E#, 16#08#, 16#78#, 16#70#, 16#43#,
16#C7#, 16#84#, 16#1E#, 16#3E#, 16#20#, 16#F2#, 16#F2#, 16#03#, 16#97#,
16#90#, 16#1D#, 16#3D#, 16#00#, 16#E8#, 16#E8#, 16#07#, 16#87#, 16#80#,
16#3C#, 16#38#, 16#01#, 16#C1#, 16#C0#, 16#0E#, 16#0C#, 16#00#, 16#20#,
16#60#, 16#01#, 16#02#, 16#00#, 16#1F#, 16#CF#, 16#83#, 16#C1#, 16#81#,
16#E1#, 16#80#, 16#71#, 16#80#, 16#39#, 16#80#, 16#1F#, 16#80#, 16#0F#,
16#00#, 16#03#, 16#80#, 16#01#, 16#E0#, 16#01#, 16#F0#, 16#00#, 16#B8#,
16#00#, 16#9E#, 16#00#, 16#8F#, 16#00#, 16#83#, 16#80#, 16#C1#, 16#C0#,
16#E0#, 16#F0#, 16#F9#, 16#FE#, 16#00#, 16#FE#, 16#7C#, 16#E0#, 16#63#,
16#81#, 16#0F#, 16#08#, 16#1C#, 16#40#, 16#71#, 16#01#, 16#E8#, 16#03#,
16#C0#, 16#0E#, 16#00#, 16#38#, 16#01#, 16#E0#, 16#07#, 16#80#, 16#1C#,
16#00#, 16#70#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#FF#, 16#00#, 16#1F#,
16#FE#, 16#38#, 16#78#, 16#60#, 16#F1#, 16#83#, 16#C2#, 16#0F#, 16#00#,
16#1E#, 16#00#, 16#78#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#0F#, 16#00#,
16#3C#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#47#, 16#81#, 16#1E#, 16#06#,
16#3C#, 16#3C#, 16#FF#, 16#F0#, 16#07#, 16#C1#, 16#80#, 16#E0#, 16#30#,
16#0C#, 16#03#, 16#01#, 16#C0#, 16#60#, 16#18#, 16#06#, 16#03#, 16#80#,
16#C0#, 16#30#, 16#0C#, 16#07#, 16#01#, 16#C0#, 16#60#, 16#18#, 16#0E#,
16#03#, 16#E0#, 16#C3#, 16#06#, 16#18#, 16#61#, 16#83#, 16#0C#, 16#30#,
16#C1#, 16#86#, 16#18#, 16#60#, 16#C3#, 16#0F#, 16#81#, 16#C0#, 16#E0#,
16#60#, 16#30#, 16#18#, 16#1C#, 16#0C#, 16#06#, 16#03#, 16#03#, 16#81#,
16#80#, 16#C0#, 16#60#, 16#70#, 16#38#, 16#18#, 16#0C#, 16#0E#, 16#1F#,
16#00#, 16#0C#, 16#07#, 16#81#, 16#E0#, 16#DC#, 16#33#, 16#18#, 16#C6#,
16#1B#, 16#06#, 16#C0#, 16#C0#, 16#FF#, 16#F0#, 16#C7#, 16#0C#, 16#30#,
16#07#, 16#70#, 16#CE#, 16#1C#, 16#E3#, 16#8E#, 16#70#, 16#C7#, 16#0C#,
16#71#, 16#CE#, 16#1C#, 16#E1#, 16#8E#, 16#79#, 16#E9#, 16#A7#, 16#1C#,
16#02#, 16#07#, 16#C0#, 16#38#, 16#06#, 16#01#, 16#C0#, 16#38#, 16#06#,
16#71#, 16#F7#, 16#38#, 16#E7#, 16#1C#, 16#C3#, 16#B8#, 16#77#, 16#1C#,
16#E3#, 16#B8#, 16#E7#, 16#18#, 16#E6#, 16#0F#, 16#80#, 16#07#, 16#0C#,
16#CE#, 16#66#, 16#07#, 16#03#, 16#83#, 16#81#, 16#C0#, 16#E0#, 16#70#,
16#BC#, 16#87#, 16#80#, 16#00#, 16#08#, 16#03#, 16#E0#, 16#03#, 16#80#,
16#0E#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#77#, 16#03#, 16#38#, 16#18#,
16#E0#, 16#E3#, 16#87#, 16#0E#, 16#1C#, 16#70#, 16#71#, 16#C3#, 16#87#,
16#0E#, 16#3C#, 16#38#, 16#E8#, 16#E5#, 16#A1#, 16#E7#, 16#00#, 16#07#,
16#0C#, 16#CE#, 16#66#, 16#37#, 16#33#, 16#BB#, 16#B1#, 16#E0#, 16#E0#,
16#70#, 16#B8#, 16#87#, 16#80#, 16#00#, 16#38#, 16#01#, 16#B0#, 16#0C#,
16#C0#, 16#30#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#7E#, 16#00#, 16#E0#,
16#03#, 16#80#, 16#0E#, 16#00#, 16#30#, 16#01#, 16#C0#, 16#07#, 16#00#,
16#1C#, 16#00#, 16#70#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#38#, 16#00#,
16#C0#, 16#33#, 16#00#, 16#D8#, 16#01#, 16#C0#, 16#00#, 16#03#, 16#80#,
16#73#, 16#C7#, 16#1C#, 16#38#, 16#E1#, 16#CF#, 16#06#, 16#70#, 16#1E#,
16#01#, 16#00#, 16#1C#, 16#00#, 16#F8#, 16#07#, 16#F0#, 16#C7#, 16#8C#,
16#0C#, 16#60#, 16#63#, 16#86#, 16#07#, 16#E0#, 16#01#, 16#00#, 16#F8#,
16#01#, 16#80#, 16#1C#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#31#, 16#C3#,
16#BE#, 16#1E#, 16#70#, 16#E3#, 16#8F#, 16#38#, 16#71#, 16#C3#, 16#8E#,
16#1C#, 16#E1#, 16#C7#, 16#0E#, 16#3A#, 16#71#, 16#D3#, 16#0F#, 16#00#,
16#1C#, 16#71#, 16#C0#, 16#00#, 16#6F#, 16#8E#, 16#31#, 16#C7#, 16#18#,
16#63#, 16#8E#, 16#BC#, 16#E0#, 16#00#, 16#E0#, 16#1C#, 16#03#, 16#80#,
16#00#, 16#00#, 16#0F#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#C0#, 16#30#,
16#0E#, 16#01#, 16#C0#, 16#30#, 16#0E#, 16#01#, 16#C0#, 16#38#, 16#06#,
16#01#, 16#C3#, 16#38#, 16#6E#, 16#07#, 16#80#, 16#01#, 16#00#, 16#F8#,
16#01#, 16#C0#, 16#0C#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#33#, 16#E1#,
16#8C#, 16#1C#, 16#C0#, 16#E4#, 16#06#, 16#40#, 16#7E#, 16#03#, 16#F0#,
16#1D#, 16#81#, 16#CE#, 16#0E#, 16#72#, 16#71#, 16#A3#, 16#8E#, 16#00#,
16#06#, 16#7C#, 16#70#, 16#E1#, 16#C3#, 16#0E#, 16#1C#, 16#30#, 16#61#,
16#C3#, 16#86#, 16#0C#, 16#38#, 16#72#, 16#E9#, 16#E0#, 16#3C#, 16#73#,
16#C7#, 16#7D#, 16#71#, 16#E7#, 16#9C#, 16#F1#, 16#CE#, 16#3C#, 16#F3#,
16#8E#, 16#39#, 16#C3#, 16#8E#, 16#70#, 16#C3#, 16#1C#, 16#71#, 16#C7#,
16#1C#, 16#71#, 16#D7#, 16#1C#, 16#7B#, 16#8E#, 16#1C#, 16#3C#, 16#F1#,
16#D7#, 16#1E#, 16#73#, 16#CE#, 16#3C#, 16#E3#, 16#8E#, 16#39#, 16#C7#,
16#9C#, 16#71#, 16#C7#, 16#1D#, 16#71#, 16#EE#, 16#1C#, 16#0F#, 16#06#,
16#63#, 16#9D#, 16#C7#, 16#71#, 16#F8#, 16#7E#, 16#3F#, 16#8E#, 16#E3#,
16#B9#, 16#C6#, 16#60#, 16#F0#, 16#0F#, 16#38#, 16#1F#, 16#70#, 16#71#,
16#C1#, 16#C7#, 16#0E#, 16#1C#, 16#38#, 16#F0#, 16#E3#, 16#83#, 16#8E#,
16#1C#, 16#70#, 16#71#, 16#C1#, 16#CE#, 16#07#, 16#E0#, 16#38#, 16#00#,
16#E0#, 16#03#, 16#80#, 16#3F#, 16#00#, 16#07#, 16#70#, 16#CE#, 16#18#,
16#E3#, 16#8E#, 16#70#, 16#E7#, 16#1C#, 16#F1#, 16#CE#, 16#1C#, 16#E3#,
16#8E#, 16#38#, 16#E7#, 16#87#, 16#B0#, 16#07#, 16#00#, 16#70#, 16#0F#,
16#03#, 16#F8#, 16#0D#, 16#DF#, 16#71#, 16#AC#, 16#F0#, 16#38#, 16#0E#,
16#03#, 16#81#, 16#C0#, 16#70#, 16#1C#, 16#0E#, 16#00#, 16#1D#, 16#99#,
16#8C#, 16#46#, 16#23#, 16#80#, 16#E0#, 16#70#, 16#1C#, 16#06#, 16#23#,
16#19#, 16#17#, 16#00#, 16#0C#, 16#10#, 16#E3#, 16#F3#, 16#86#, 16#1C#,
16#38#, 16#71#, 16#C3#, 16#87#, 16#0E#, 16#9E#, 16#38#, 16#00#, 16#F8#,
16#E3#, 16#8E#, 16#38#, 16#C3#, 16#9C#, 16#71#, 16#C7#, 16#18#, 16#71#,
16#86#, 16#38#, 16#E3#, 16#8E#, 16#FA#, 16#F3#, 16#AE#, 16#3C#, 16#F0#,
16#DC#, 16#33#, 16#0C#, 16#C2#, 16#31#, 16#8C#, 16#C3#, 16#60#, 16#F0#,
16#38#, 16#0C#, 16#02#, 16#00#, 16#E0#, 16#86#, 16#E3#, 16#0C#, 16#C6#,
16#19#, 16#9C#, 16#23#, 16#78#, 16#C7#, 16#F9#, 16#0E#, 16#74#, 16#1C#,
16#F0#, 16#31#, 16#C0#, 16#43#, 16#00#, 16#84#, 16#00#, 16#0E#, 16#31#,
16#F3#, 16#83#, 16#A0#, 16#0E#, 16#00#, 16#70#, 16#03#, 16#80#, 16#1C#,
16#00#, 16#E0#, 16#0B#, 16#02#, 16#5D#, 16#3C#, 16#F1#, 16#C3#, 16#00#,
16#04#, 16#67#, 16#8C#, 16#79#, 16#87#, 16#10#, 16#E2#, 16#1C#, 16#81#,
16#90#, 16#3A#, 16#07#, 16#80#, 16#F0#, 16#1C#, 16#03#, 16#00#, 16#40#,
16#08#, 16#32#, 16#07#, 16#80#, 16#3F#, 16#CF#, 16#E6#, 16#30#, 16#08#,
16#04#, 16#02#, 16#01#, 16#00#, 16#C0#, 16#30#, 16#1E#, 16#0F#, 16#98#,
16#76#, 16#07#, 16#00#, 16#01#, 16#E0#, 16#70#, 16#1C#, 16#03#, 16#80#,
16#60#, 16#1C#, 16#03#, 16#80#, 16#60#, 16#0C#, 16#03#, 16#80#, 16#F0#,
16#3C#, 16#07#, 16#00#, 16#40#, 16#0C#, 16#01#, 16#80#, 16#70#, 16#0E#,
16#01#, 16#C0#, 16#30#, 16#03#, 16#80#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#07#, 16#00#, 16#E0#, 16#18#, 16#06#, 16#01#, 16#80#, 16#E0#, 16#38#,
16#0C#, 16#03#, 16#00#, 16#C0#, 16#10#, 16#1F#, 16#07#, 16#03#, 16#80#,
16#E0#, 16#30#, 16#0C#, 16#07#, 16#01#, 16#80#, 16#E0#, 16#E0#, 16#00#,
16#38#, 16#0F#, 16#CD#, 16#1F#, 16#80#, 16#E0#);
FreeSerifBoldItalic12pt7bGlyphs : aliased constant Glyph_Array := (
(0, 0, 0, 6, 0, 1), -- 0x20 ' '
(0, 8, 17, 9, 2, -15), -- 0x21 '!'
(17, 9, 7, 13, 4, -15), -- 0x22 '"'
(25, 14, 16, 12, -1, -15), -- 0x23 '#'
(53, 12, 20, 12, 0, -17), -- 0x24 '$'
(83, 18, 18, 20, 1, -16), -- 0x25 '%'
(124, 16, 17, 19, 0, -15), -- 0x26 '&'
(158, 3, 7, 7, 3, -15), -- 0x27 '''
(161, 7, 21, 8, 1, -15), -- 0x28 '('
(180, 7, 21, 8, -1, -15), -- 0x29 ')'
(199, 10, 10, 12, 1, -15), -- 0x2A '*'
(212, 12, 12, 14, 1, -11), -- 0x2B '+'
(230, 5, 8, 6, -2, -3), -- 0x2C ','
(235, 6, 3, 8, 0, -6), -- 0x2D '-'
(238, 4, 4, 6, 0, -2), -- 0x2E '.'
(240, 10, 16, 8, 0, -15), -- 0x2F '/'
(260, 11, 17, 12, 0, -15), -- 0x30 '0'
(284, 10, 17, 12, 0, -15), -- 0x31 '1'
(306, 11, 17, 12, 0, -15), -- 0x32 '2'
(330, 11, 17, 12, 0, -15), -- 0x33 '3'
(354, 13, 16, 12, 0, -15), -- 0x34 '4'
(380, 12, 17, 12, 0, -15), -- 0x35 '5'
(406, 11, 17, 12, 1, -15), -- 0x36 '6'
(430, 11, 16, 12, 2, -15), -- 0x37 '7'
(452, 11, 17, 12, 0, -15), -- 0x38 '8'
(476, 11, 17, 12, 0, -15), -- 0x39 '9'
(500, 7, 12, 6, 0, -10), -- 0x3A ':'
(511, 8, 15, 6, -1, -10), -- 0x3B ';'
(526, 12, 13, 14, 1, -12), -- 0x3C '<'
(546, 12, 6, 14, 2, -8), -- 0x3D '='
(555, 13, 13, 14, 1, -12), -- 0x3E '>'
(577, 9, 17, 12, 2, -15), -- 0x3F '?'
(597, 17, 16, 20, 1, -15), -- 0x40 '@'
(631, 16, 17, 17, 0, -15), -- 0x41 'A'
(665, 16, 17, 15, 0, -15), -- 0x42 'B'
(699, 15, 17, 15, 1, -15), -- 0x43 'C'
(731, 18, 17, 17, 0, -15), -- 0x44 'D'
(770, 17, 17, 15, 0, -15), -- 0x45 'E'
(807, 16, 17, 15, 0, -15), -- 0x46 'F'
(841, 17, 17, 17, 1, -15), -- 0x47 'G'
(878, 20, 17, 18, 0, -15), -- 0x48 'H'
(921, 10, 17, 9, 0, -15), -- 0x49 'I'
(943, 14, 18, 12, 0, -15), -- 0x4A 'J'
(975, 17, 17, 16, 0, -15), -- 0x4B 'K'
(1012, 15, 17, 15, 0, -15), -- 0x4C 'L'
(1044, 23, 17, 21, 0, -15), -- 0x4D 'M'
(1093, 19, 17, 17, 0, -15), -- 0x4E 'N'
(1134, 16, 17, 16, 1, -15), -- 0x4F 'O'
(1168, 16, 17, 14, 0, -15), -- 0x50 'P'
(1202, 16, 21, 16, 1, -15), -- 0x51 'Q'
(1244, 16, 17, 16, 0, -15), -- 0x52 'R'
(1278, 12, 17, 12, 0, -15), -- 0x53 'S'
(1304, 15, 17, 14, 2, -15), -- 0x54 'T'
(1336, 16, 17, 17, 3, -15), -- 0x55 'U'
(1370, 16, 16, 17, 3, -15), -- 0x56 'V'
(1402, 21, 16, 22, 3, -15), -- 0x57 'W'
(1444, 17, 17, 17, 0, -15), -- 0x58 'X'
(1481, 14, 17, 15, 3, -15), -- 0x59 'Y'
(1511, 15, 17, 13, 0, -15), -- 0x5A 'Z'
(1543, 10, 20, 8, -1, -15), -- 0x5B '['
(1568, 6, 16, 10, 3, -15), -- 0x5C '\'
(1580, 9, 20, 8, -1, -15), -- 0x5D ']'
(1603, 10, 9, 14, 2, -15), -- 0x5E '^'
(1615, 12, 1, 12, 0, 4), -- 0x5F '_'
(1617, 5, 4, 8, 2, -15), -- 0x60 '`'
(1620, 12, 12, 12, 0, -10), -- 0x61 'a'
(1638, 11, 18, 12, 1, -16), -- 0x62 'b'
(1663, 9, 12, 10, 1, -10), -- 0x63 'c'
(1677, 14, 18, 12, 0, -16), -- 0x64 'd'
(1709, 9, 12, 10, 1, -10), -- 0x65 'e'
(1723, 14, 22, 12, -2, -16), -- 0x66 'f'
(1762, 13, 16, 12, -1, -10), -- 0x67 'g'
(1788, 13, 18, 13, 0, -16), -- 0x68 'h'
(1818, 6, 17, 7, 1, -15), -- 0x69 'i'
(1831, 11, 21, 8, -2, -15), -- 0x6A 'j'
(1860, 13, 18, 12, 0, -16), -- 0x6B 'k'
(1890, 7, 18, 7, 1, -16), -- 0x6C 'l'
(1906, 18, 12, 18, 0, -10), -- 0x6D 'm'
(1933, 12, 12, 13, 0, -10), -- 0x6E 'n'
(1951, 10, 12, 11, 1, -10), -- 0x6F 'o'
(1966, 14, 16, 12, -2, -10), -- 0x70 'p'
(1994, 12, 16, 12, 0, -10), -- 0x71 'q'
(2018, 10, 11, 10, 0, -10), -- 0x72 'r'
(2032, 9, 12, 9, 0, -10), -- 0x73 's'
(2046, 7, 15, 7, 1, -13), -- 0x74 't'
(2060, 12, 12, 13, 1, -10), -- 0x75 'u'
(2078, 10, 11, 11, 1, -10), -- 0x76 'v'
(2092, 15, 11, 16, 1, -10), -- 0x77 'w'
(2113, 13, 12, 11, -1, -10), -- 0x78 'x'
(2133, 11, 16, 10, -1, -10), -- 0x79 'y'
(2155, 10, 13, 10, 0, -10), -- 0x7A 'z'
(2172, 11, 21, 8, 0, -16), -- 0x7B '{'
(2201, 2, 16, 6, 3, -15), -- 0x7C '|'
(2205, 10, 21, 8, -3, -16), -- 0x7D '}'
(2232, 11, 4, 14, 1, -7)); -- 0x7E '~'
Font_D : aliased constant Bitmap_Font :=
(FreeSerifBoldItalic12pt7bBitmaps'Access,
FreeSerifBoldItalic12pt7bGlyphs'Access,
28);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Bitmap_Fonts.FreeSerifBoldItalic12pt7b;
|
with Ada.Text_IO; With Real_To_Rational;
procedure Convert_Decimal_To_Rational is
type My_Real is new Long_Float; -- change this for another "Real" type
package FIO is new Ada.Text_IO.Float_IO(My_Real);
procedure R2R is new Real_To_Rational(My_Real);
Nom, Denom: Integer;
R: My_Real;
begin
loop
Ada.Text_IO.New_Line;
FIO.Get(R);
FIO.Put(R, Fore => 2, Aft => 9, Exp => 0);
exit when R = 0.0;
for I in 0 .. 4 loop
R2R(R, 10**I, Nom, Denom);
Ada.Text_IO.Put(" " & Integer'Image(Nom) &
" /" & Integer'Image(Denom));
end loop;
end loop;
end Convert_Decimal_To_Rational;
|
package Giza.Bitmap_Fonts.FreeMonoOblique32pt7b is
Font : constant Giza.Font.Ref_Const;
private
FreeMonoOblique32pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#30#, 16#03#, 16#C0#, 16#3E#, 16#01#, 16#F0#, 16#0F#, 16#00#,
16#78#, 16#07#, 16#C0#, 16#3E#, 16#01#, 16#E0#, 16#0F#, 16#00#, 16#78#,
16#07#, 16#C0#, 16#3C#, 16#01#, 16#E0#, 16#0F#, 16#00#, 16#70#, 16#03#,
16#80#, 16#3C#, 16#01#, 16#E0#, 16#0E#, 16#00#, 16#70#, 16#03#, 16#80#,
16#3C#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#00#, 16#FC#, 16#0F#, 16#E0#, 16#7F#, 16#03#, 16#F0#,
16#0F#, 16#00#, 16#7F#, 16#81#, 16#FE#, 16#FE#, 16#03#, 16#F9#, 16#FC#,
16#07#, 16#F3#, 16#F8#, 16#0F#, 16#E7#, 16#E0#, 16#1F#, 16#8F#, 16#C0#,
16#3F#, 16#1F#, 16#80#, 16#7E#, 16#3E#, 16#00#, 16#F8#, 16#7C#, 16#01#,
16#F0#, 16#F8#, 16#03#, 16#E3#, 16#E0#, 16#0F#, 16#87#, 16#C0#, 16#1F#,
16#0F#, 16#80#, 16#3E#, 16#1E#, 16#00#, 16#78#, 16#3C#, 16#00#, 16#F0#,
16#78#, 16#01#, 16#E0#, 16#E0#, 16#03#, 16#81#, 16#C0#, 16#07#, 16#00#,
16#00#, 16#01#, 16#81#, 16#80#, 16#00#, 16#38#, 16#38#, 16#00#, 16#03#,
16#03#, 16#80#, 16#00#, 16#30#, 16#30#, 16#00#, 16#07#, 16#07#, 16#00#,
16#00#, 16#70#, 16#70#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#E0#,
16#60#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#E0#, 16#00#,
16#0C#, 16#0C#, 16#00#, 16#01#, 16#C1#, 16#C0#, 16#00#, 16#1C#, 16#1C#,
16#00#, 16#01#, 16#81#, 16#80#, 16#00#, 16#38#, 16#18#, 16#01#, 16#FF#,
16#FF#, 16#FF#, 16#1F#, 16#FF#, 16#FF#, 16#F1#, 16#FF#, 16#FF#, 16#FF#,
16#00#, 16#70#, 16#70#, 16#00#, 16#07#, 16#07#, 16#00#, 16#00#, 16#60#,
16#70#, 16#00#, 16#0E#, 16#06#, 16#00#, 16#00#, 16#E0#, 16#E0#, 16#00#,
16#0C#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#C0#, 16#0F#, 16#FF#, 16#FF#,
16#F8#, 16#FF#, 16#FF#, 16#FF#, 16#8F#, 16#FF#, 16#FF#, 16#F0#, 16#03#,
16#81#, 16#80#, 16#00#, 16#38#, 16#38#, 16#00#, 16#03#, 16#03#, 16#80#,
16#00#, 16#30#, 16#30#, 16#00#, 16#07#, 16#03#, 16#00#, 16#00#, 16#70#,
16#70#, 16#00#, 16#06#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#60#, 16#00#,
16#0E#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#E0#, 16#00#, 16#0C#, 16#0C#,
16#00#, 16#01#, 16#C0#, 16#C0#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#01#,
16#81#, 16#C0#, 16#00#, 16#38#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#03#,
16#FF#, 16#8C#, 16#00#, 16#7F#, 16#FE#, 16#E0#, 16#07#, 16#C0#, 16#7F#,
16#00#, 16#78#, 16#00#, 16#F8#, 16#07#, 16#00#, 16#03#, 16#80#, 16#70#,
16#00#, 16#0C#, 16#03#, 16#80#, 16#00#, 16#60#, 16#38#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#78#,
16#00#, 16#00#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#,
16#00#, 16#3F#, 16#F0#, 16#00#, 16#00#, 16#7F#, 16#F8#, 16#00#, 16#00#,
16#7F#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#3E#,
16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#03#,
16#87#, 16#00#, 16#00#, 16#3C#, 16#38#, 16#00#, 16#01#, 16#C1#, 16#C0#,
16#00#, 16#1E#, 16#0F#, 16#00#, 16#01#, 16#E0#, 16#FC#, 16#00#, 16#1E#,
16#07#, 16#FC#, 16#07#, 16#E0#, 16#3B#, 16#FF#, 16#FE#, 16#01#, 16#87#,
16#FF#, 16#C0#, 16#00#, 16#0F#, 16#F0#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#03#, 16#FE#, 16#00#, 16#00#, 16#FF#,
16#F0#, 16#00#, 16#1F#, 16#0F#, 16#00#, 16#01#, 16#C0#, 16#78#, 16#00#,
16#38#, 16#03#, 16#80#, 16#03#, 16#80#, 16#38#, 16#00#, 16#70#, 16#03#,
16#80#, 16#07#, 16#00#, 16#38#, 16#00#, 16#70#, 16#07#, 16#00#, 16#07#,
16#00#, 16#70#, 16#00#, 16#78#, 16#0E#, 16#00#, 16#03#, 16#C3#, 16#E0#,
16#00#, 16#3F#, 16#FC#, 16#00#, 16#01#, 16#FF#, 16#80#, 16#00#, 16#07#,
16#E0#, 16#07#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#01#, 16#FC#,
16#00#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#7F#,
16#00#, 16#00#, 16#7F#, 16#80#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#0F#,
16#C0#, 16#00#, 16#00#, 16#E0#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#FF#,
16#C0#, 16#00#, 16#1F#, 16#FE#, 16#00#, 16#03#, 16#E1#, 16#E0#, 16#00#,
16#78#, 16#0F#, 16#00#, 16#07#, 16#00#, 16#70#, 16#00#, 16#F0#, 16#07#,
16#00#, 16#0E#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#0E#,
16#00#, 16#E0#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#0F#, 16#01#, 16#C0#,
16#00#, 16#78#, 16#7C#, 16#00#, 16#07#, 16#FF#, 16#80#, 16#00#, 16#3F#,
16#E0#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#03#, 16#FF#, 16#80#, 16#07#, 16#FF#, 16#80#, 16#07#, 16#C3#, 16#80#,
16#07#, 16#80#, 16#00#, 16#03#, 16#80#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#01#, 16#F0#,
16#00#, 16#03#, 16#F8#, 16#00#, 16#07#, 16#CE#, 16#03#, 16#C7#, 16#87#,
16#03#, 16#E7#, 16#81#, 16#C1#, 16#F3#, 16#80#, 16#E1#, 16#C3#, 16#80#,
16#30#, 16#E1#, 16#C0#, 16#1C#, 16#E1#, 16#C0#, 16#0E#, 16#70#, 16#E0#,
16#03#, 16#70#, 16#70#, 16#01#, 16#F0#, 16#38#, 16#00#, 16#70#, 16#1C#,
16#00#, 16#38#, 16#0F#, 16#00#, 16#3C#, 16#03#, 16#C0#, 16#3F#, 16#01#,
16#F0#, 16#7B#, 16#F0#, 16#7F#, 16#F9#, 16#F8#, 16#1F#, 16#F8#, 16#7C#,
16#03#, 16#F0#, 16#00#, 16#00#, 16#7F#, 16#BF#, 16#9F#, 16#CF#, 16#E7#,
16#E3#, 16#F1#, 16#F8#, 16#F8#, 16#7C#, 16#3E#, 16#3E#, 16#1F#, 16#0F#,
16#87#, 16#83#, 16#C1#, 16#E0#, 16#E0#, 16#70#, 16#00#, 16#00#, 16#06#,
16#00#, 16#1C#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#0E#,
16#00#, 16#38#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#0E#,
16#00#, 16#38#, 16#00#, 16#F0#, 16#01#, 16#C0#, 16#07#, 16#80#, 16#0E#,
16#00#, 16#1C#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#03#, 16#C0#, 16#07#,
16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#78#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#,
16#03#, 16#00#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#,
16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#01#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#06#, 16#00#,
16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#70#,
16#00#, 16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#0E#,
16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#03#,
16#C0#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#,
16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#1C#, 16#00#,
16#70#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#1C#, 16#00#,
16#70#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#18#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#E0#, 16#1C#,
16#03#, 16#FC#, 16#38#, 16#1F#, 16#FF#, 16#38#, 16#FE#, 16#3F#, 16#FF#,
16#F8#, 16#07#, 16#FF#, 16#C0#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#FC#,
16#00#, 16#01#, 16#DC#, 16#00#, 16#03#, 16#9E#, 16#00#, 16#07#, 16#0E#,
16#00#, 16#0F#, 16#0F#, 16#00#, 16#1E#, 16#07#, 16#00#, 16#3C#, 16#07#,
16#80#, 16#38#, 16#03#, 16#80#, 16#70#, 16#01#, 16#80#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#03#,
16#80#, 16#01#, 16#FF#, 16#FF#, 16#FF#, 16#EF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#01#, 16#FE#, 16#01#, 16#FC#,
16#03#, 16#F8#, 16#03#, 16#F8#, 16#07#, 16#F0#, 16#07#, 16#E0#, 16#0F#,
16#C0#, 16#0F#, 16#C0#, 16#1F#, 16#80#, 16#1F#, 16#00#, 16#3E#, 16#00#,
16#3C#, 16#00#, 16#7C#, 16#00#, 16#78#, 16#00#, 16#F0#, 16#00#, 16#F0#,
16#00#, 16#E0#, 16#00#, 16#7F#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#1F#, 16#3F#, 16#DF#, 16#FF#,
16#FF#, 16#FF#, 16#FB#, 16#FC#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#01#,
16#80#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#,
16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#,
16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#,
16#18#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#03#, 16#FF#, 16#00#, 16#03#,
16#FF#, 16#E0#, 16#01#, 16#F0#, 16#7C#, 16#00#, 16#F0#, 16#07#, 16#80#,
16#78#, 16#01#, 16#E0#, 16#3C#, 16#00#, 16#38#, 16#0E#, 16#00#, 16#0F#,
16#07#, 16#00#, 16#01#, 16#C3#, 16#C0#, 16#00#, 16#70#, 16#E0#, 16#00#,
16#1C#, 16#78#, 16#00#, 16#07#, 16#1C#, 16#00#, 16#01#, 16#C7#, 16#00#,
16#00#, 16#73#, 16#80#, 16#00#, 16#1C#, 16#E0#, 16#00#, 16#06#, 16#38#,
16#00#, 16#01#, 16#8E#, 16#00#, 16#00#, 16#63#, 16#00#, 16#00#, 16#39#,
16#C0#, 16#00#, 16#0E#, 16#70#, 16#00#, 16#03#, 16#1C#, 16#00#, 16#00#,
16#C6#, 16#00#, 16#00#, 16#31#, 16#80#, 16#00#, 16#1C#, 16#E0#, 16#00#,
16#06#, 16#38#, 16#00#, 16#01#, 16#8E#, 16#00#, 16#00#, 16#E3#, 16#80#,
16#00#, 16#38#, 16#E0#, 16#00#, 16#0C#, 16#38#, 16#00#, 16#07#, 16#0E#,
16#00#, 16#03#, 16#83#, 16#80#, 16#00#, 16#E0#, 16#F0#, 16#00#, 16#70#,
16#1C#, 16#00#, 16#3C#, 16#07#, 16#00#, 16#1E#, 16#01#, 16#E0#, 16#0F#,
16#00#, 16#3E#, 16#0F#, 16#80#, 16#07#, 16#FF#, 16#C0#, 16#00#, 16#FF#,
16#E0#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#,
16#00#, 16#F8#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#07#, 16#B8#, 16#00#,
16#0F#, 16#38#, 16#00#, 16#3E#, 16#30#, 16#00#, 16#78#, 16#30#, 16#00#,
16#F0#, 16#70#, 16#01#, 16#E0#, 16#70#, 16#01#, 16#80#, 16#70#, 16#00#,
16#00#, 16#60#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#01#, 16#80#, 16#00#, 16#03#, 16#80#, 16#00#, 16#03#, 16#80#, 16#00#,
16#03#, 16#80#, 16#00#, 16#03#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#,
16#06#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#7F#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#7F#,
16#FF#, 16#FF#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#01#, 16#FF#,
16#C0#, 16#00#, 16#0F#, 16#FF#, 16#C0#, 16#00#, 16#7E#, 16#07#, 16#C0#,
16#01#, 16#E0#, 16#07#, 16#C0#, 16#07#, 16#80#, 16#07#, 16#80#, 16#0E#,
16#00#, 16#07#, 16#80#, 16#38#, 16#00#, 16#07#, 16#00#, 16#E0#, 16#00#,
16#0E#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#02#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#,
16#3C#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#1E#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#1E#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#,
16#0F#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#01#, 16#81#, 16#E0#,
16#00#, 16#07#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#07#, 16#FF#, 16#FF#,
16#F8#, 16#1F#, 16#FF#, 16#FF#, 16#F0#, 16#3F#, 16#FF#, 16#FF#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#7F#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#00#,
16#00#, 16#FF#, 16#FF#, 16#00#, 16#0F#, 16#C0#, 16#7E#, 16#00#, 16#78#,
16#00#, 16#78#, 16#01#, 16#80#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#07#, 16#80#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#3F#, 16#C0#,
16#00#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#,
16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#,
16#70#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#03#, 16#81#, 16#00#,
16#00#, 16#1C#, 16#0E#, 16#00#, 16#01#, 16#F0#, 16#3E#, 16#00#, 16#0F#,
16#00#, 16#7E#, 16#01#, 16#F8#, 16#00#, 16#FF#, 16#FF#, 16#C0#, 16#00#,
16#FF#, 16#FC#, 16#00#, 16#00#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#,
16#1F#, 16#80#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#0F#, 16#E0#, 16#00#,
16#0E#, 16#70#, 16#00#, 16#0E#, 16#30#, 16#00#, 16#0E#, 16#38#, 16#00#,
16#06#, 16#1C#, 16#00#, 16#07#, 16#0E#, 16#00#, 16#07#, 16#07#, 16#00#,
16#07#, 16#03#, 16#00#, 16#07#, 16#03#, 16#80#, 16#03#, 16#01#, 16#C0#,
16#03#, 16#80#, 16#E0#, 16#03#, 16#80#, 16#60#, 16#03#, 16#80#, 16#70#,
16#03#, 16#80#, 16#38#, 16#01#, 16#C0#, 16#1C#, 16#01#, 16#C0#, 16#0E#,
16#01#, 16#C0#, 16#06#, 16#01#, 16#C0#, 16#07#, 16#01#, 16#C0#, 16#03#,
16#80#, 16#E0#, 16#01#, 16#C0#, 16#E0#, 16#00#, 16#C0#, 16#E0#, 16#00#,
16#60#, 16#E0#, 16#00#, 16#70#, 16#7F#, 16#FF#, 16#FF#, 16#BF#, 16#FF#,
16#FF#, 16#DF#, 16#FF#, 16#FF#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#70#, 16#00#,
16#0F#, 16#FF#, 16#80#, 16#0F#, 16#FF#, 16#C0#, 16#03#, 16#FF#, 16#C0#,
16#00#, 16#1F#, 16#FF#, 16#F8#, 16#00#, 16#FF#, 16#FF#, 16#F0#, 16#03#,
16#FF#, 16#FF#, 16#80#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#18#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#01#, 16#80#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#07#, 16#F0#, 16#00#, 16#1D#,
16#FF#, 16#F0#, 16#00#, 16#7F#, 16#FF#, 16#E0#, 16#01#, 16#FC#, 16#07#,
16#C0#, 16#07#, 16#80#, 16#07#, 16#80#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#60#, 16#00#, 16#07#, 16#03#, 16#C0#, 16#00#,
16#38#, 16#07#, 16#80#, 16#03#, 16#C0#, 16#0F#, 16#C0#, 16#3E#, 16#00#,
16#1F#, 16#FF#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#00#, 16#00#, 16#0F#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#00#, 16#0F#,
16#FF#, 16#00#, 16#03#, 16#FF#, 16#F0#, 16#00#, 16#FE#, 16#00#, 16#00#,
16#1F#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#78#, 16#00#,
16#00#, 16#0F#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#38#, 16#0F#, 16#80#, 16#03#,
16#83#, 16#FE#, 16#00#, 16#78#, 16#FF#, 16#F8#, 16#07#, 16#1E#, 16#07#,
16#80#, 16#73#, 16#80#, 16#3C#, 16#07#, 16#70#, 16#01#, 16#C0#, 16#FE#,
16#00#, 16#1E#, 16#0E#, 16#C0#, 16#00#, 16#E0#, 16#F8#, 16#00#, 16#0E#,
16#0F#, 16#00#, 16#00#, 16#E0#, 16#F0#, 16#00#, 16#0E#, 16#0E#, 16#00#,
16#00#, 16#E0#, 16#E0#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#01#, 16#C0#,
16#E0#, 16#00#, 16#1C#, 16#0F#, 16#00#, 16#03#, 16#C0#, 16#70#, 16#00#,
16#38#, 16#07#, 16#00#, 16#07#, 16#00#, 16#78#, 16#00#, 16#F0#, 16#03#,
16#C0#, 16#1E#, 16#00#, 16#3E#, 16#07#, 16#C0#, 16#01#, 16#FF#, 16#F8#,
16#00#, 16#0F#, 16#FE#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#7F#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#E0#,
16#00#, 16#07#, 16#C0#, 16#00#, 16#06#, 16#C0#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#01#, 16#80#, 16#00#, 16#03#, 16#80#, 16#00#, 16#03#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#01#,
16#80#, 16#00#, 16#03#, 16#80#, 16#00#, 16#03#, 16#00#, 16#00#, 16#07#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#,
16#00#, 16#FF#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#80#, 16#07#, 16#E0#,
16#7C#, 16#00#, 16#F8#, 16#01#, 16#E0#, 16#0E#, 16#00#, 16#0E#, 16#01#,
16#C0#, 16#00#, 16#F0#, 16#3C#, 16#00#, 16#07#, 16#03#, 16#80#, 16#00#,
16#70#, 16#70#, 16#00#, 16#07#, 16#07#, 16#00#, 16#00#, 16#70#, 16#70#,
16#00#, 16#07#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#70#, 16#00#, 16#0E#,
16#07#, 16#00#, 16#01#, 16#C0#, 16#38#, 16#00#, 16#38#, 16#03#, 16#C0#,
16#0F#, 16#00#, 16#1F#, 16#03#, 16#E0#, 16#00#, 16#FF#, 16#F8#, 16#00#,
16#03#, 16#FE#, 16#00#, 16#00#, 16#FF#, 16#F0#, 16#00#, 16#3E#, 16#07#,
16#80#, 16#0F#, 16#00#, 16#1C#, 16#01#, 16#E0#, 16#00#, 16#E0#, 16#3C#,
16#00#, 16#0F#, 16#03#, 16#80#, 16#00#, 16#70#, 16#70#, 16#00#, 16#07#,
16#07#, 16#00#, 16#00#, 16#70#, 16#E0#, 16#00#, 16#07#, 16#0E#, 16#00#,
16#00#, 16#70#, 16#E0#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#, 16#E0#,
16#E0#, 16#00#, 16#1C#, 16#0F#, 16#00#, 16#03#, 16#C0#, 16#70#, 16#00#,
16#78#, 16#07#, 16#C0#, 16#0F#, 16#00#, 16#3F#, 16#03#, 16#E0#, 16#01#,
16#FF#, 16#FC#, 16#00#, 16#0F#, 16#FF#, 16#00#, 16#00#, 16#1F#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#3F#, 16#F8#, 16#00#,
16#03#, 16#FF#, 16#F0#, 16#00#, 16#7E#, 16#0F#, 16#80#, 16#07#, 16#C0#,
16#1E#, 16#00#, 16#78#, 16#00#, 16#78#, 16#03#, 16#80#, 16#01#, 16#C0#,
16#38#, 16#00#, 16#0E#, 16#03#, 16#C0#, 16#00#, 16#78#, 16#1C#, 16#00#,
16#01#, 16#C0#, 16#E0#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#, 16#70#,
16#70#, 16#00#, 16#03#, 16#83#, 16#80#, 16#00#, 16#3C#, 16#1C#, 16#00#,
16#01#, 16#E0#, 16#E0#, 16#00#, 16#1F#, 16#07#, 16#00#, 16#01#, 16#B8#,
16#3C#, 16#00#, 16#1F#, 16#C0#, 16#E0#, 16#01#, 16#DC#, 16#07#, 16#80#,
16#3C#, 16#E0#, 16#1F#, 16#07#, 16#C7#, 16#00#, 16#FF#, 16#FC#, 16#78#,
16#01#, 16#FF#, 16#83#, 16#80#, 16#03#, 16#F0#, 16#1C#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#07#, 16#80#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#07#, 16#80#,
16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#,
16#F8#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#07#, 16#F0#, 16#00#,
16#7F#, 16#FE#, 16#00#, 16#03#, 16#FF#, 16#C0#, 16#00#, 16#0F#, 16#F0#,
16#00#, 16#00#, 16#01#, 16#F0#, 16#3F#, 16#C1#, 16#FE#, 16#1F#, 16#F0#,
16#FF#, 16#87#, 16#F8#, 16#3F#, 16#80#, 16#F8#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#07#, 16#F8#,
16#3F#, 16#C3#, 16#FE#, 16#1F#, 16#F0#, 16#FF#, 16#07#, 16#F8#, 16#1F#,
16#00#, 16#00#, 16#07#, 16#C0#, 16#03#, 16#FC#, 16#00#, 16#7F#, 16#80#,
16#1F#, 16#F0#, 16#03#, 16#FE#, 16#00#, 16#7F#, 16#80#, 16#0F#, 16#E0#,
16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C0#, 16#07#,
16#F8#, 16#01#, 16#FE#, 16#00#, 16#3F#, 16#80#, 16#0F#, 16#E0#, 16#01#,
16#FC#, 16#00#, 16#7F#, 16#00#, 16#0F#, 16#C0#, 16#03#, 16#F0#, 16#00#,
16#7E#, 16#00#, 16#1F#, 16#80#, 16#03#, 16#E0#, 16#00#, 16#F8#, 16#00#,
16#1F#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#1C#, 16#00#,
16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#,
16#00#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#0F#,
16#80#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#,
16#00#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#,
16#3E#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#E0#,
16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#,
16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#80#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#01#,
16#F0#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#3E#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#07#, 16#E0#,
16#00#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#00#,
16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#,
16#00#, 16#07#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#3F#, 16#FF#,
16#FF#, 16#FF#, 16#9F#, 16#FF#, 16#FF#, 16#FF#, 16#CF#, 16#FF#, 16#FF#,
16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#,
16#FF#, 16#FF#, 16#FF#, 16#3F#, 16#FF#, 16#FF#, 16#FF#, 16#9F#, 16#FF#,
16#FF#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#,
16#00#, 16#07#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#,
16#03#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#01#,
16#F0#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#,
16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#,
16#00#, 16#3F#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#0F#,
16#C0#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#,
16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#07#,
16#C0#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#03#,
16#E0#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#00#, 16#1F#, 16#FF#, 16#81#,
16#FF#, 16#FF#, 16#1F#, 16#80#, 16#7E#, 16#70#, 16#00#, 16#79#, 16#80#,
16#00#, 16#FE#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#07#, 16#C0#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#38#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#F0#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#F8#, 16#00#, 16#0F#,
16#80#, 16#00#, 16#F8#, 16#00#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#06#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#,
16#00#, 16#7F#, 16#80#, 16#01#, 16#FE#, 16#00#, 16#0F#, 16#F8#, 16#00#,
16#1F#, 16#C0#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FC#,
16#00#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#7F#, 16#FE#, 16#00#, 16#1F#,
16#03#, 16#E0#, 16#07#, 16#80#, 16#1C#, 16#01#, 16#E0#, 16#03#, 16#C0#,
16#78#, 16#00#, 16#38#, 16#1E#, 16#00#, 16#07#, 16#03#, 16#80#, 16#00#,
16#E0#, 16#E0#, 16#00#, 16#18#, 16#3C#, 16#00#, 16#07#, 16#07#, 16#00#,
16#00#, 16#E0#, 16#E0#, 16#01#, 16#FC#, 16#38#, 16#01#, 16#FF#, 16#07#,
16#00#, 16#7F#, 16#E0#, 16#E0#, 16#1F#, 16#1C#, 16#18#, 16#07#, 16#83#,
16#87#, 16#01#, 16#C0#, 16#70#, 16#E0#, 16#70#, 16#0C#, 16#1C#, 16#0E#,
16#03#, 16#83#, 16#83#, 16#80#, 16#70#, 16#E0#, 16#70#, 16#0E#, 16#1C#,
16#0E#, 16#01#, 16#C3#, 16#81#, 16#C0#, 16#30#, 16#70#, 16#38#, 16#0E#,
16#1E#, 16#07#, 16#81#, 16#C3#, 16#80#, 16#78#, 16#38#, 16#70#, 16#0F#,
16#FF#, 16#0E#, 16#00#, 16#FF#, 16#F1#, 16#C0#, 16#07#, 16#FC#, 16#38#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#78#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#0F#,
16#00#, 16#18#, 16#01#, 16#F0#, 16#1F#, 16#00#, 16#1F#, 16#FF#, 16#C0#,
16#01#, 16#FF#, 16#E0#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#07#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#80#, 16#00#,
16#01#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#E0#, 16#00#,
16#00#, 16#00#, 16#67#, 16#00#, 16#00#, 16#00#, 16#07#, 16#38#, 16#00#,
16#00#, 16#00#, 16#31#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#0F#, 16#00#,
16#00#, 16#00#, 16#38#, 16#38#, 16#00#, 16#00#, 16#01#, 16#81#, 16#C0#,
16#00#, 16#00#, 16#1C#, 16#0E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#78#,
16#00#, 16#00#, 16#0C#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#E0#, 16#0E#,
16#00#, 16#00#, 16#06#, 16#00#, 16#70#, 16#00#, 16#00#, 16#70#, 16#03#,
16#80#, 16#00#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#F0#, 16#00#, 16#03#, 16#80#, 16#07#, 16#80#, 16#00#, 16#18#, 16#00#,
16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#1F#, 16#FF#,
16#FF#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#0F#, 16#FF#,
16#FF#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#0F#, 16#00#, 16#07#, 16#00#,
16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#80#,
16#00#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#00#, 16#78#, 16#01#, 16#80#,
16#00#, 16#03#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#1E#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#70#, 16#FF#, 16#F8#, 16#01#, 16#FF#, 16#F7#, 16#FF#,
16#C0#, 16#0F#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#7F#, 16#FC#, 16#01#,
16#FF#, 16#FF#, 16#F8#, 16#00#, 16#7F#, 16#FF#, 16#FF#, 16#E0#, 16#07#,
16#FF#, 16#FF#, 16#FE#, 16#00#, 16#0E#, 16#00#, 16#07#, 16#E0#, 16#01#,
16#C0#, 16#00#, 16#3C#, 16#00#, 16#38#, 16#00#, 16#03#, 16#C0#, 16#07#,
16#00#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#38#,
16#00#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#E0#,
16#00#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#07#, 16#00#,
16#00#, 16#78#, 16#00#, 16#E0#, 16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#,
16#1F#, 16#80#, 16#03#, 16#FF#, 16#FF#, 16#C0#, 16#00#, 16#7F#, 16#FF#,
16#F8#, 16#00#, 16#1F#, 16#FF#, 16#FF#, 16#C0#, 16#03#, 16#80#, 16#00#,
16#FC#, 16#00#, 16#70#, 16#00#, 16#07#, 16#C0#, 16#0E#, 16#00#, 16#00#,
16#38#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#80#, 16#70#, 16#00#, 16#00#,
16#70#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#01#,
16#C0#, 16#38#, 16#00#, 16#00#, 16#38#, 16#0F#, 16#00#, 16#00#, 16#0F#,
16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#38#, 16#00#, 16#00#, 16#78#,
16#07#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#80#,
16#3C#, 16#00#, 16#03#, 16#E0#, 16#FF#, 16#FF#, 16#FF#, 16#F8#, 16#1F#,
16#FF#, 16#FF#, 16#FC#, 16#03#, 16#FF#, 16#FF#, 16#FE#, 16#00#, 16#00#,
16#00#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#E0#, 16#C0#,
16#07#, 16#FF#, 16#FC#, 16#E0#, 16#07#, 16#E0#, 16#3F#, 16#70#, 16#0F#,
16#80#, 16#07#, 16#F8#, 16#0F#, 16#80#, 16#00#, 16#F8#, 16#0F#, 16#00#,
16#00#, 16#3C#, 16#0F#, 16#00#, 16#00#, 16#0E#, 16#07#, 16#00#, 16#00#,
16#07#, 16#07#, 16#00#, 16#00#, 16#03#, 16#07#, 16#80#, 16#00#, 16#01#,
16#83#, 16#80#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#01#, 16#80#, 16#F0#, 16#00#,
16#03#, 16#C0#, 16#7C#, 16#00#, 16#03#, 16#C0#, 16#1F#, 16#00#, 16#07#,
16#C0#, 16#07#, 16#E0#, 16#1F#, 16#80#, 16#01#, 16#FF#, 16#FF#, 16#80#,
16#00#, 16#3F#, 16#FE#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#,
16#01#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#7F#, 16#FF#, 16#FF#, 16#00#,
16#07#, 16#FF#, 16#FF#, 16#F8#, 16#00#, 16#1C#, 16#00#, 16#1F#, 16#80#,
16#03#, 16#80#, 16#00#, 16#F8#, 16#00#, 16#70#, 16#00#, 16#0F#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#F0#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#,
16#70#, 16#00#, 16#01#, 16#E0#, 16#0E#, 16#00#, 16#00#, 16#3C#, 16#01#,
16#C0#, 16#00#, 16#03#, 16#80#, 16#70#, 16#00#, 16#00#, 16#70#, 16#0E#,
16#00#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#38#,
16#00#, 16#00#, 16#38#, 16#0F#, 16#00#, 16#00#, 16#07#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#C0#, 16#38#, 16#00#, 16#00#, 16#38#, 16#07#, 16#00#,
16#00#, 16#07#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#E0#, 16#3C#, 16#00#,
16#00#, 16#1C#, 16#07#, 16#00#, 16#00#, 16#07#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#E0#, 16#1C#, 16#00#, 16#00#, 16#38#, 16#03#, 16#80#, 16#00#,
16#07#, 16#00#, 16#F0#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#,
16#78#, 16#03#, 16#80#, 16#00#, 16#1E#, 16#00#, 16#70#, 16#00#, 16#07#,
16#80#, 16#0E#, 16#00#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#00#, 16#F8#,
16#00#, 16#70#, 16#00#, 16#7E#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#00#,
16#1F#, 16#FF#, 16#FF#, 16#80#, 16#03#, 16#FF#, 16#FF#, 16#C0#, 16#00#,
16#00#, 16#01#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#3F#, 16#FF#, 16#FF#,
16#FF#, 16#01#, 16#FF#, 16#FF#, 16#FF#, 16#E0#, 16#01#, 16#C0#, 16#00#,
16#06#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#00#,
16#0E#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#00#,
16#0C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#80#, 16#00#,
16#0C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#30#,
16#00#, 16#00#, 16#70#, 16#07#, 16#00#, 16#00#, 16#07#, 16#00#, 16#70#,
16#00#, 16#00#, 16#70#, 16#07#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#F0#,
16#00#, 16#00#, 16#7F#, 16#FE#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#E0#,
16#00#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#C0#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#70#, 16#03#, 16#C0#, 16#00#, 16#06#, 16#00#, 16#38#, 16#00#, 16#00#,
16#60#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#00#,
16#E0#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#78#, 16#00#, 16#00#,
16#C0#, 16#FF#, 16#FF#, 16#FF#, 16#FC#, 16#0F#, 16#FF#, 16#FF#, 16#FF#,
16#C0#, 16#FF#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#01#, 16#FF#, 16#FF#,
16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#FF#, 16#FF#, 16#C0#, 16#7F#, 16#FF#,
16#FF#, 16#FE#, 16#00#, 16#38#, 16#00#, 16#00#, 16#70#, 16#01#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#18#, 16#00#, 16#70#,
16#00#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#38#,
16#00#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#06#, 16#00#, 16#00#, 16#07#,
16#00#, 16#70#, 16#00#, 16#00#, 16#38#, 16#03#, 16#80#, 16#00#, 16#01#,
16#C0#, 16#1C#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#E0#, 16#00#, 16#00#,
16#7F#, 16#FE#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#F0#, 16#00#, 16#00#,
16#38#, 16#03#, 16#80#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#70#, 16#06#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#,
16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#,
16#00#, 16#FF#, 16#FF#, 16#C0#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#,
16#00#, 16#3F#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#,
16#00#, 16#00#, 16#03#, 16#FF#, 16#F0#, 16#C0#, 16#07#, 16#FF#, 16#FE#,
16#E0#, 16#07#, 16#E0#, 16#1F#, 16#F0#, 16#0F#, 16#C0#, 16#03#, 16#F8#,
16#0F#, 16#80#, 16#00#, 16#78#, 16#0F#, 16#80#, 16#00#, 16#1C#, 16#0F#,
16#00#, 16#00#, 16#0E#, 16#07#, 16#00#, 16#00#, 16#07#, 16#07#, 16#80#,
16#00#, 16#03#, 16#07#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#70#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#0F#, 16#FF#, 16#E7#, 16#00#, 16#07#, 16#FF#, 16#F3#, 16#80#, 16#03#,
16#FF#, 16#F9#, 16#C0#, 16#00#, 16#00#, 16#70#, 16#E0#, 16#00#, 16#00#,
16#38#, 16#70#, 16#00#, 16#00#, 16#1C#, 16#38#, 16#00#, 16#00#, 16#1C#,
16#1C#, 16#00#, 16#00#, 16#0E#, 16#0F#, 16#00#, 16#00#, 16#07#, 16#03#,
16#80#, 16#00#, 16#03#, 16#81#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#78#,
16#00#, 16#01#, 16#C0#, 16#1F#, 16#00#, 16#01#, 16#E0#, 16#0F#, 16#F0#,
16#07#, 16#F0#, 16#01#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#7F#, 16#FF#,
16#C0#, 16#00#, 16#07#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#E0#,
16#3F#, 16#F0#, 16#0F#, 16#FF#, 16#03#, 16#FF#, 16#C0#, 16#3F#, 16#F0#,
16#1F#, 16#FC#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#,
16#00#, 16#38#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#E0#,
16#00#, 16#1C#, 16#00#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#70#,
16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#1C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#0F#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#, 16#03#,
16#80#, 16#00#, 16#38#, 16#00#, 16#1F#, 16#FF#, 16#FF#, 16#C0#, 16#00#,
16#FF#, 16#FF#, 16#FC#, 16#00#, 16#0F#, 16#FF#, 16#FF#, 16#E0#, 16#00#,
16#70#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#,
16#1C#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#,
16#0F#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#,
16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#70#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#,
16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#E0#, 16#00#, 16#1C#,
16#00#, 16#FF#, 16#F0#, 16#1F#, 16#FE#, 16#07#, 16#FF#, 16#80#, 16#FF#,
16#F0#, 16#3F#, 16#FC#, 16#07#, 16#FF#, 16#80#, 16#01#, 16#FF#, 16#FF#,
16#FE#, 16#03#, 16#FF#, 16#FF#, 16#FC#, 16#07#, 16#FF#, 16#FF#, 16#F0#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#FF#, 16#01#, 16#FF#,
16#FF#, 16#FE#, 16#01#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#,
16#FF#, 16#FF#, 16#FC#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#FC#, 16#00#,
16#03#, 16#FF#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#,
16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#40#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0C#,
16#00#, 16#07#, 16#00#, 16#00#, 16#38#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#70#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#03#, 16#80#, 16#01#, 16#C0#,
16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#00#, 16#07#,
16#00#, 16#00#, 16#70#, 16#00#, 16#1E#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#3E#, 16#00#, 16#07#, 16#80#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#,
16#00#, 16#3F#, 16#81#, 16#F8#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#C0#,
16#00#, 16#00#, 16#1F#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#F8#, 16#0F#, 16#FE#, 16#07#,
16#FF#, 16#F0#, 16#1F#, 16#FC#, 16#07#, 16#FF#, 16#E0#, 16#3F#, 16#F8#,
16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#3C#,
16#00#, 16#03#, 16#80#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#07#,
16#80#, 16#00#, 16#1C#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#38#, 16#00#,
16#70#, 16#00#, 16#00#, 16#70#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#E0#,
16#0E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#78#, 16#00#, 16#00#, 16#07#,
16#01#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#07#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#F8#, 16#00#, 16#00#,
16#00#, 16#77#, 16#FC#, 16#00#, 16#00#, 16#01#, 16#DE#, 16#7C#, 16#00#,
16#00#, 16#03#, 16#F0#, 16#3C#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#3C#,
16#00#, 16#00#, 16#0F#, 16#00#, 16#38#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#03#,
16#80#, 16#01#, 16#C0#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#80#, 16#00#,
16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#07#, 16#00#,
16#00#, 16#70#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#1C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#FF#, 16#FC#, 16#00#,
16#3F#, 16#81#, 16#FF#, 16#FC#, 16#00#, 16#7F#, 16#83#, 16#FF#, 16#F0#,
16#00#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#FF#,
16#FF#, 16#C0#, 16#00#, 16#7F#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#01#, 16#E0#, 16#00#, 16#0C#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#,
16#70#, 16#00#, 16#07#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#1C#,
16#00#, 16#03#, 16#80#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#0E#, 16#00#,
16#00#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#,
16#38#, 16#01#, 16#C0#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#1C#,
16#7F#, 16#FF#, 16#FF#, 16#FE#, 16#7F#, 16#FF#, 16#FF#, 16#FF#, 16#3F#,
16#FF#, 16#FF#, 16#FF#, 16#80#, 16#01#, 16#FF#, 16#00#, 16#00#, 16#1F#,
16#E0#, 16#3F#, 16#E0#, 16#00#, 16#03#, 16#FC#, 16#07#, 16#FE#, 16#00#,
16#00#, 16#FF#, 16#80#, 16#1D#, 16#C0#, 16#00#, 16#3F#, 16#00#, 16#03#,
16#B8#, 16#00#, 16#06#, 16#E0#, 16#00#, 16#77#, 16#00#, 16#01#, 16#9C#,
16#00#, 16#1C#, 16#F0#, 16#00#, 16#73#, 16#80#, 16#03#, 16#8E#, 16#00#,
16#0C#, 16#70#, 16#00#, 16#71#, 16#C0#, 16#03#, 16#1C#, 16#00#, 16#0E#,
16#38#, 16#00#, 16#E3#, 16#80#, 16#03#, 16#C7#, 16#00#, 16#18#, 16#70#,
16#00#, 16#70#, 16#70#, 16#06#, 16#0E#, 16#00#, 16#0E#, 16#0E#, 16#01#,
16#C3#, 16#C0#, 16#01#, 16#C1#, 16#C0#, 16#70#, 16#70#, 16#00#, 16#38#,
16#38#, 16#0C#, 16#0E#, 16#00#, 16#0F#, 16#03#, 16#83#, 16#81#, 16#C0#,
16#01#, 16#C0#, 16#70#, 16#E0#, 16#38#, 16#00#, 16#38#, 16#0E#, 16#18#,
16#0F#, 16#00#, 16#07#, 16#01#, 16#C6#, 16#01#, 16#C0#, 16#00#, 16#E0#,
16#1D#, 16#C0#, 16#38#, 16#00#, 16#3C#, 16#03#, 16#B0#, 16#07#, 16#00#,
16#07#, 16#00#, 16#7C#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#0F#, 16#80#,
16#3C#, 16#00#, 16#1C#, 16#01#, 16#E0#, 16#07#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#03#, 16#80#, 16#03#, 16#80#, 16#00#, 16#00#,
16#F0#, 16#00#, 16#70#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#03#, 16#80#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#70#, 16#00#,
16#70#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#FF#, 16#F8#, 16#00#, 16#FF#,
16#F8#, 16#1F#, 16#FF#, 16#00#, 16#1F#, 16#FF#, 16#03#, 16#FF#, 16#E0#,
16#03#, 16#FF#, 16#E0#, 16#00#, 16#03#, 16#FC#, 16#00#, 16#1F#, 16#FE#,
16#03#, 16#FE#, 16#00#, 16#1F#, 16#FF#, 16#03#, 16#FE#, 16#00#, 16#1F#,
16#FE#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#60#, 16#00#, 16#3F#, 16#00#,
16#00#, 16#60#, 16#00#, 16#33#, 16#80#, 16#00#, 16#60#, 16#00#, 16#33#,
16#80#, 16#00#, 16#60#, 16#00#, 16#33#, 16#80#, 16#00#, 16#C0#, 16#00#,
16#31#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#61#, 16#C0#, 16#00#, 16#C0#,
16#00#, 16#60#, 16#E0#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#E0#, 16#01#,
16#C0#, 16#00#, 16#60#, 16#E0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#70#,
16#01#, 16#80#, 16#00#, 16#C0#, 16#70#, 16#01#, 16#80#, 16#00#, 16#C0#,
16#38#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#38#, 16#03#, 16#00#, 16#01#,
16#C0#, 16#3C#, 16#03#, 16#00#, 16#01#, 16#80#, 16#1C#, 16#03#, 16#00#,
16#01#, 16#80#, 16#1C#, 16#03#, 16#00#, 16#01#, 16#80#, 16#0E#, 16#06#,
16#00#, 16#03#, 16#80#, 16#0E#, 16#06#, 16#00#, 16#03#, 16#00#, 16#0F#,
16#06#, 16#00#, 16#03#, 16#00#, 16#07#, 16#06#, 16#00#, 16#03#, 16#00#,
16#07#, 16#0E#, 16#00#, 16#03#, 16#00#, 16#03#, 16#8C#, 16#00#, 16#06#,
16#00#, 16#03#, 16#8C#, 16#00#, 16#06#, 16#00#, 16#03#, 16#CC#, 16#00#,
16#06#, 16#00#, 16#01#, 16#DC#, 16#00#, 16#06#, 16#00#, 16#01#, 16#F8#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#F8#, 16#00#, 16#FF#, 16#F8#, 16#00#, 16#F8#, 16#00#, 16#FF#, 16#F8#,
16#00#, 16#70#, 16#00#, 16#FF#, 16#F0#, 16#00#, 16#70#, 16#00#, 16#00#,
16#00#, 16#7F#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#F0#, 16#00#, 16#03#,
16#FF#, 16#FC#, 16#00#, 16#07#, 16#E0#, 16#3F#, 16#00#, 16#07#, 16#C0#,
16#07#, 16#C0#, 16#07#, 16#80#, 16#01#, 16#F0#, 16#07#, 16#80#, 16#00#,
16#78#, 16#07#, 16#80#, 16#00#, 16#1E#, 16#07#, 16#80#, 16#00#, 16#07#,
16#07#, 16#80#, 16#00#, 16#03#, 16#83#, 16#80#, 16#00#, 16#01#, 16#E3#,
16#80#, 16#00#, 16#00#, 16#71#, 16#C0#, 16#00#, 16#00#, 16#39#, 16#C0#,
16#00#, 16#00#, 16#1C#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#E0#, 16#00#,
16#00#, 16#07#, 16#70#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#00#, 16#00#,
16#01#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#,
16#EE#, 16#00#, 16#00#, 16#00#, 16#77#, 16#00#, 16#00#, 16#00#, 16#3B#,
16#80#, 16#00#, 16#00#, 16#39#, 16#C0#, 16#00#, 16#00#, 16#1C#, 16#E0#,
16#00#, 16#00#, 16#1C#, 16#70#, 16#00#, 16#00#, 16#0E#, 16#3C#, 16#00#,
16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#, 16#0F#, 16#07#, 16#00#, 16#00#,
16#0F#, 16#03#, 16#C0#, 16#00#, 16#0F#, 16#00#, 16#F0#, 16#00#, 16#0F#,
16#00#, 16#7C#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#00#, 16#1F#, 16#00#,
16#07#, 16#E0#, 16#3F#, 16#00#, 16#01#, 16#FF#, 16#FE#, 16#00#, 16#00#,
16#7F#, 16#FC#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#01#,
16#FF#, 16#FF#, 16#E0#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#00#, 16#1F#,
16#FF#, 16#FF#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#7C#, 16#00#, 16#1C#,
16#00#, 16#07#, 16#80#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#01#, 16#C0#,
16#00#, 16#3C#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#38#, 16#00#,
16#01#, 16#C0#, 16#0E#, 16#00#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#,
16#1C#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#70#, 16#00#, 16#03#,
16#80#, 16#1C#, 16#00#, 16#01#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#F0#,
16#01#, 16#C0#, 16#00#, 16#78#, 16#00#, 16#70#, 16#00#, 16#3C#, 16#00#,
16#38#, 16#00#, 16#7E#, 16#00#, 16#0F#, 16#FF#, 16#FF#, 16#00#, 16#03#,
16#FF#, 16#FF#, 16#00#, 16#00#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#,
16#FF#, 16#FF#, 16#C0#, 16#00#, 16#3F#, 16#FF#, 16#F8#, 16#00#, 16#0F#,
16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#00#, 16#00#,
16#01#, 16#FF#, 16#F0#, 16#00#, 16#03#, 16#FF#, 16#FC#, 16#00#, 16#07#,
16#E0#, 16#3F#, 16#00#, 16#07#, 16#C0#, 16#07#, 16#C0#, 16#07#, 16#80#,
16#01#, 16#F0#, 16#07#, 16#80#, 16#00#, 16#78#, 16#07#, 16#80#, 16#00#,
16#1E#, 16#07#, 16#80#, 16#00#, 16#07#, 16#07#, 16#80#, 16#00#, 16#03#,
16#83#, 16#80#, 16#00#, 16#01#, 16#E3#, 16#80#, 16#00#, 16#00#, 16#71#,
16#C0#, 16#00#, 16#00#, 16#39#, 16#C0#, 16#00#, 16#00#, 16#1C#, 16#E0#,
16#00#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#70#, 16#00#,
16#00#, 16#03#, 16#B8#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#,
16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#EE#, 16#00#, 16#00#, 16#00#,
16#77#, 16#00#, 16#00#, 16#00#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#39#,
16#C0#, 16#00#, 16#00#, 16#1C#, 16#E0#, 16#00#, 16#00#, 16#1C#, 16#70#,
16#00#, 16#00#, 16#0E#, 16#3C#, 16#00#, 16#00#, 16#0E#, 16#0E#, 16#00#,
16#00#, 16#0F#, 16#07#, 16#00#, 16#00#, 16#0F#, 16#03#, 16#C0#, 16#00#,
16#0F#, 16#00#, 16#F0#, 16#00#, 16#0F#, 16#00#, 16#7C#, 16#00#, 16#0F#,
16#00#, 16#1F#, 16#00#, 16#1F#, 16#00#, 16#07#, 16#E0#, 16#3F#, 16#00#,
16#01#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#,
16#0F#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#,
16#80#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#00#, 16#C0#, 16#0F#, 16#FF#,
16#E1#, 16#E0#, 16#1F#, 16#FF#, 16#FF#, 16#F0#, 16#0F#, 16#C0#, 16#3F#,
16#E0#, 16#07#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#01#, 16#FF#, 16#FF#,
16#F0#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#00#, 16#1F#, 16#FF#, 16#FF#,
16#E0#, 16#00#, 16#70#, 16#00#, 16#7C#, 16#00#, 16#1C#, 16#00#, 16#07#,
16#80#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#00#, 16#3C#,
16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#38#, 16#00#, 16#01#, 16#C0#,
16#0E#, 16#00#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#00#,
16#E0#, 16#00#, 16#0E#, 16#00#, 16#70#, 16#00#, 16#03#, 16#80#, 16#1C#,
16#00#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#01#, 16#E0#, 16#01#, 16#C0#,
16#01#, 16#F0#, 16#00#, 16#70#, 16#01#, 16#F8#, 16#00#, 16#3F#, 16#FF#,
16#F8#, 16#00#, 16#0F#, 16#FF#, 16#F8#, 16#00#, 16#03#, 16#FF#, 16#F8#,
16#00#, 16#00#, 16#E0#, 16#0F#, 16#00#, 16#00#, 16#38#, 16#00#, 16#E0#,
16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#,
16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#1C#, 16#00#,
16#3C#, 16#00#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#03#,
16#80#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#38#,
16#00#, 16#01#, 16#C0#, 16#1E#, 16#00#, 16#00#, 16#38#, 16#FF#, 16#FC#,
16#00#, 16#0F#, 16#FF#, 16#FF#, 16#80#, 16#03#, 16#FF#, 16#FF#, 16#C0#,
16#00#, 16#78#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#1F#, 16#FE#,
16#30#, 16#01#, 16#FF#, 16#FC#, 16#C0#, 16#0F#, 16#C0#, 16#FB#, 16#00#,
16#78#, 16#00#, 16#FC#, 16#03#, 16#C0#, 16#01#, 16#F0#, 16#1E#, 16#00#,
16#03#, 16#80#, 16#70#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#38#,
16#0E#, 16#00#, 16#00#, 16#E0#, 16#38#, 16#00#, 16#03#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#,
16#FE#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#3F#,
16#E0#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#C0#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#03#,
16#87#, 16#00#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#00#, 16#78#, 16#70#,
16#00#, 16#01#, 16#C1#, 16#C0#, 16#00#, 16#0F#, 16#07#, 16#80#, 16#00#,
16#78#, 16#3F#, 16#00#, 16#03#, 16#E0#, 16#FE#, 16#00#, 16#1F#, 16#03#,
16#BE#, 16#03#, 16#F0#, 16#0C#, 16#7F#, 16#FF#, 16#80#, 16#30#, 16#FF#,
16#F8#, 16#00#, 16#00#, 16#7F#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#FF#,
16#FE#, 16#FF#, 16#FF#, 16#FF#, 16#FD#, 16#FF#, 16#FF#, 16#FF#, 16#FB#,
16#80#, 16#1C#, 16#00#, 16#77#, 16#00#, 16#38#, 16#01#, 16#DC#, 16#00#,
16#70#, 16#03#, 16#B8#, 16#01#, 16#E0#, 16#07#, 16#70#, 16#03#, 16#80#,
16#0E#, 16#C0#, 16#07#, 16#00#, 16#18#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#00#, 16#70#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#E0#, 16#01#, 16#FF#,
16#FF#, 16#C0#, 16#03#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#3F#, 16#FC#,
16#07#, 16#FF#, 16#DF#, 16#FF#, 16#01#, 16#FF#, 16#F3#, 16#FF#, 16#C0#,
16#7F#, 16#FC#, 16#3C#, 16#00#, 16#00#, 16#70#, 16#0E#, 16#00#, 16#00#,
16#1C#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#E0#, 16#00#, 16#03#,
16#80#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#1C#, 16#00#, 16#00#, 16#38#,
16#07#, 16#00#, 16#00#, 16#1E#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#00#,
16#70#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#0E#,
16#00#, 16#00#, 16#1C#, 16#03#, 16#80#, 16#00#, 16#0F#, 16#00#, 16#E0#,
16#00#, 16#03#, 16#80#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#0C#, 16#00#,
16#00#, 16#38#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#,
16#07#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#,
16#70#, 16#0E#, 16#00#, 16#00#, 16#1C#, 16#03#, 16#80#, 16#00#, 16#07#,
16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#38#, 16#00#, 16#00#, 16#E0#,
16#0E#, 16#00#, 16#00#, 16#78#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#00#,
16#E0#, 16#00#, 16#0F#, 16#00#, 16#3C#, 16#00#, 16#07#, 16#80#, 16#07#,
16#80#, 16#03#, 16#C0#, 16#01#, 16#F0#, 16#03#, 16#E0#, 16#00#, 16#3F#,
16#03#, 16#F0#, 16#00#, 16#07#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#FF#,
16#F8#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#FF#, 16#F8#,
16#00#, 16#FF#, 16#F7#, 16#FF#, 16#C0#, 16#07#, 16#FF#, 16#FF#, 16#FC#,
16#00#, 16#3F#, 16#FC#, 16#38#, 16#00#, 16#00#, 16#06#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#03#, 16#00#, 16#38#,
16#00#, 16#00#, 16#30#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#80#, 16#0E#,
16#00#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#, 16#01#, 16#80#, 16#01#,
16#80#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#70#, 16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#60#, 16#00#,
16#1C#, 16#00#, 16#06#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#,
16#03#, 16#00#, 16#03#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#30#, 16#00#,
16#00#, 16#E0#, 16#03#, 16#80#, 16#00#, 16#07#, 16#00#, 16#18#, 16#00#,
16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#C0#, 16#1C#, 16#00#,
16#00#, 16#06#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#38#, 16#0E#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#06#, 16#00#,
16#00#, 16#00#, 16#70#, 16#70#, 16#00#, 16#00#, 16#01#, 16#83#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#38#, 16#00#, 16#00#, 16#00#, 16#73#, 16#80#,
16#00#, 16#00#, 16#03#, 16#98#, 16#00#, 16#00#, 16#00#, 16#1D#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#F8#,
16#00#, 16#FF#, 16#FF#, 16#FF#, 16#80#, 16#1F#, 16#FF#, 16#FF#, 16#F8#,
16#01#, 16#FF#, 16#F1#, 16#80#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#,
16#00#, 16#01#, 16#81#, 16#80#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#,
16#00#, 16#03#, 16#03#, 16#80#, 16#00#, 16#00#, 16#30#, 16#38#, 16#01#,
16#E0#, 16#06#, 16#03#, 16#80#, 16#1E#, 16#00#, 16#60#, 16#38#, 16#03#,
16#E0#, 16#0E#, 16#03#, 16#80#, 16#2E#, 16#00#, 16#C0#, 16#38#, 16#06#,
16#E0#, 16#0C#, 16#03#, 16#80#, 16#47#, 16#01#, 16#80#, 16#38#, 16#0C#,
16#70#, 16#18#, 16#03#, 16#00#, 16#87#, 16#01#, 16#80#, 16#30#, 16#18#,
16#70#, 16#30#, 16#07#, 16#01#, 16#07#, 16#03#, 16#00#, 16#70#, 16#30#,
16#70#, 16#30#, 16#07#, 16#02#, 16#07#, 16#06#, 16#00#, 16#70#, 16#60#,
16#70#, 16#60#, 16#07#, 16#04#, 16#07#, 16#06#, 16#00#, 16#70#, 16#C0#,
16#70#, 16#C0#, 16#07#, 16#08#, 16#07#, 16#0C#, 16#00#, 16#71#, 16#80#,
16#71#, 16#C0#, 16#07#, 16#30#, 16#07#, 16#18#, 16#00#, 16#63#, 16#00#,
16#71#, 16#80#, 16#0E#, 16#60#, 16#07#, 16#30#, 16#00#, 16#E6#, 16#00#,
16#3B#, 16#00#, 16#0E#, 16#C0#, 16#03#, 16#B0#, 16#00#, 16#EC#, 16#00#,
16#3E#, 16#00#, 16#0F#, 16#80#, 16#03#, 16#E0#, 16#00#, 16#F8#, 16#00#,
16#3E#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#F0#, 16#00#,
16#3C#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#C0#, 16#07#, 16#FC#, 16#03#,
16#FF#, 16#80#, 16#1F#, 16#FC#, 16#03#, 16#FE#, 16#00#, 16#3F#, 16#F0#,
16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#03#, 16#80#, 16#01#,
16#C0#, 16#00#, 16#07#, 16#80#, 16#07#, 16#00#, 16#00#, 16#07#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#07#, 16#00#, 16#70#, 16#00#, 16#00#, 16#0E#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#07#, 16#00#, 16#00#, 16#00#,
16#1E#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#70#, 16#00#, 16#00#,
16#00#, 16#1D#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#,
16#00#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#71#,
16#E0#, 16#00#, 16#00#, 16#01#, 16#C1#, 16#E0#, 16#00#, 16#00#, 16#07#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#3C#, 16#03#, 16#C0#, 16#00#, 16#00#,
16#F0#, 16#03#, 16#80#, 16#00#, 16#03#, 16#80#, 16#07#, 16#80#, 16#00#,
16#0E#, 16#00#, 16#07#, 16#80#, 16#00#, 16#38#, 16#00#, 16#07#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#FF#, 16#E0#, 16#07#,
16#FF#, 16#01#, 16#FF#, 16#C0#, 16#0F#, 16#FF#, 16#03#, 16#FF#, 16#80#,
16#1F#, 16#FC#, 16#00#, 16#7F#, 16#E0#, 16#03#, 16#FF#, 16#FF#, 16#E0#,
16#03#, 16#FF#, 16#7F#, 16#C0#, 16#03#, 16#FF#, 16#1E#, 16#00#, 16#00#,
16#30#, 16#0E#, 16#00#, 16#00#, 16#60#, 16#0F#, 16#00#, 16#00#, 16#E0#,
16#07#, 16#00#, 16#01#, 16#C0#, 16#07#, 16#80#, 16#03#, 16#80#, 16#03#,
16#80#, 16#07#, 16#00#, 16#03#, 16#C0#, 16#0E#, 16#00#, 16#01#, 16#C0#,
16#1C#, 16#00#, 16#01#, 16#E0#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#70#,
16#00#, 16#00#, 16#F0#, 16#E0#, 16#00#, 16#00#, 16#71#, 16#C0#, 16#00#,
16#00#, 16#7B#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#,
16#3E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#,
16#78#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#E0#, 16#00#,
16#FF#, 16#FF#, 16#E0#, 16#00#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#00#,
16#7F#, 16#FF#, 16#FE#, 16#00#, 16#FF#, 16#FF#, 16#FC#, 16#01#, 16#FF#,
16#FF#, 16#F8#, 16#03#, 16#00#, 16#00#, 16#70#, 16#0E#, 16#00#, 16#01#,
16#C0#, 16#1C#, 16#00#, 16#07#, 16#00#, 16#30#, 16#00#, 16#1C#, 16#00#,
16#60#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#01#, 16#C0#, 16#03#, 16#80#,
16#07#, 16#00#, 16#06#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#0C#, 16#00#, 16#78#,
16#00#, 16#38#, 16#01#, 16#E0#, 16#00#, 16#60#, 16#07#, 16#80#, 16#00#,
16#C0#, 16#1E#, 16#00#, 16#01#, 16#80#, 16#38#, 16#00#, 16#07#, 16#00#,
16#E0#, 16#00#, 16#0C#, 16#03#, 16#80#, 16#00#, 16#18#, 16#0E#, 16#00#,
16#00#, 16#30#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#7F#, 16#FF#, 16#FF#,
16#C0#, 16#FF#, 16#FF#, 16#FF#, 16#03#, 16#FF#, 16#FF#, 16#FE#, 16#00#,
16#00#, 16#3F#, 16#F0#, 16#03#, 16#FF#, 16#00#, 16#3F#, 16#F0#, 16#03#,
16#00#, 16#00#, 16#20#, 16#00#, 16#06#, 16#00#, 16#00#, 16#60#, 16#00#,
16#06#, 16#00#, 16#00#, 16#60#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#01#,
16#80#, 16#00#, 16#18#, 16#00#, 16#01#, 16#80#, 16#00#, 16#10#, 16#00#,
16#03#, 16#00#, 16#00#, 16#30#, 16#00#, 16#03#, 16#00#, 16#00#, 16#30#,
16#00#, 16#06#, 16#00#, 16#00#, 16#60#, 16#00#, 16#06#, 16#00#, 16#00#,
16#60#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#08#, 16#00#, 16#01#, 16#80#, 16#00#, 16#18#,
16#00#, 16#01#, 16#80#, 16#00#, 16#18#, 16#00#, 16#03#, 16#00#, 16#00#,
16#30#, 16#00#, 16#03#, 16#00#, 16#00#, 16#30#, 16#00#, 16#06#, 16#00#,
16#00#, 16#60#, 16#00#, 16#06#, 16#00#, 16#00#, 16#60#, 16#00#, 16#07#,
16#FE#, 16#00#, 16#FF#, 16#E0#, 16#0F#, 16#FC#, 16#00#, 16#E0#, 16#03#,
16#80#, 16#0E#, 16#00#, 16#3C#, 16#00#, 16#F0#, 16#03#, 16#C0#, 16#07#,
16#00#, 16#1E#, 16#00#, 16#78#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#0F#,
16#00#, 16#3C#, 16#00#, 16#70#, 16#01#, 16#E0#, 16#07#, 16#80#, 16#1E#,
16#00#, 16#38#, 16#00#, 16#F0#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#1E#,
16#00#, 16#78#, 16#01#, 16#E0#, 16#03#, 16#80#, 16#0F#, 16#00#, 16#3C#,
16#00#, 16#F0#, 16#01#, 16#C0#, 16#07#, 16#80#, 16#1E#, 16#00#, 16#38#,
16#00#, 16#F0#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#1C#, 16#00#, 16#78#,
16#01#, 16#E0#, 16#07#, 16#80#, 16#0E#, 16#00#, 16#3C#, 16#00#, 16#F0#,
16#01#, 16#C0#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#70#, 16#00#, 16#C0#,
16#00#, 16#3F#, 16#F0#, 16#07#, 16#FF#, 16#00#, 16#7F#, 16#E0#, 16#00#,
16#06#, 16#00#, 16#00#, 16#60#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#80#, 16#00#, 16#18#, 16#00#,
16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#, 16#30#,
16#00#, 16#03#, 16#00#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#, 16#00#,
16#70#, 16#00#, 16#06#, 16#00#, 16#00#, 16#60#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0C#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#80#, 16#00#,
16#18#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#,
16#00#, 16#30#, 16#00#, 16#03#, 16#00#, 16#00#, 16#70#, 16#00#, 16#07#,
16#00#, 16#00#, 16#70#, 16#00#, 16#06#, 16#00#, 16#00#, 16#60#, 16#0F#,
16#FE#, 16#00#, 16#FF#, 16#E0#, 16#0F#, 16#FC#, 16#00#, 16#00#, 16#02#,
16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#1F#,
16#80#, 16#00#, 16#3D#, 16#C0#, 16#00#, 16#79#, 16#E0#, 16#00#, 16#F0#,
16#E0#, 16#01#, 16#E0#, 16#F0#, 16#03#, 16#80#, 16#70#, 16#07#, 16#00#,
16#38#, 16#0E#, 16#00#, 16#3C#, 16#1C#, 16#00#, 16#1C#, 16#38#, 16#00#,
16#1E#, 16#70#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#07#, 16#C0#, 16#00#,
16#06#, 16#7F#, 16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FB#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#E0#, 16#78#,
16#1E#, 16#07#, 16#81#, 16#C0#, 16#F0#, 16#3C#, 16#0F#, 16#03#, 16#80#,
16#00#, 16#03#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#FC#, 16#00#, 16#3F#,
16#FF#, 16#F0#, 16#03#, 16#E0#, 16#07#, 16#C0#, 16#00#, 16#00#, 16#0F#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#03#,
16#80#, 16#07#, 16#F8#, 16#38#, 16#01#, 16#FF#, 16#F9#, 16#C0#, 16#3F#,
16#FF#, 16#FE#, 16#07#, 16#F0#, 16#07#, 16#F0#, 16#7C#, 16#00#, 16#07#,
16#07#, 16#80#, 16#00#, 16#38#, 16#78#, 16#00#, 16#01#, 16#C3#, 16#80#,
16#00#, 16#0E#, 16#38#, 16#00#, 16#00#, 16#71#, 16#C0#, 16#00#, 16#07#,
16#0E#, 16#00#, 16#00#, 16#38#, 16#70#, 16#00#, 16#07#, 16#C3#, 16#80#,
16#00#, 16#FE#, 16#1E#, 16#00#, 16#1F#, 16#60#, 16#7C#, 16#07#, 16#E7#,
16#F9#, 16#FF#, 16#FE#, 16#3F#, 16#C7#, 16#FF#, 16#C1#, 16#FC#, 16#0F#,
16#F0#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#1F#,
16#E0#, 16#00#, 16#00#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#01#,
16#80#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#01#,
16#80#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#01#,
16#00#, 16#7F#, 16#00#, 16#00#, 16#30#, 16#3F#, 16#FE#, 16#00#, 16#03#,
16#0F#, 16#FF#, 16#F0#, 16#00#, 16#31#, 16#F0#, 16#1F#, 16#80#, 16#03#,
16#7C#, 16#00#, 16#7C#, 16#00#, 16#6F#, 16#00#, 16#03#, 16#E0#, 16#07#,
16#E0#, 16#00#, 16#1E#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#F0#, 16#07#,
16#80#, 16#00#, 16#0F#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#70#, 16#0F#,
16#00#, 16#00#, 16#07#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#70#, 16#0E#,
16#00#, 16#00#, 16#07#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#70#, 16#1C#,
16#00#, 16#00#, 16#07#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#E0#, 16#1C#,
16#00#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#E0#, 16#3C#,
16#00#, 16#00#, 16#1C#, 16#03#, 16#C0#, 16#00#, 16#03#, 16#80#, 16#3E#,
16#00#, 16#00#, 16#78#, 16#03#, 16#F0#, 16#00#, 16#0F#, 16#00#, 16#77#,
16#00#, 16#01#, 16#E0#, 16#07#, 16#7C#, 16#00#, 16#7C#, 16#0F#, 16#E3#,
16#F0#, 16#1F#, 16#80#, 16#FE#, 16#1F#, 16#FF#, 16#E0#, 16#0F#, 16#E0#,
16#FF#, 16#F8#, 16#00#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#00#,
16#03#, 16#FC#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#0C#, 16#01#, 16#FF#,
16#FF#, 16#38#, 16#0F#, 16#C0#, 16#3F#, 16#70#, 16#3E#, 16#00#, 16#1F#,
16#C0#, 16#F0#, 16#00#, 16#0F#, 16#83#, 16#C0#, 16#00#, 16#0F#, 16#0F#,
16#00#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#00#, 16#38#, 16#70#, 16#00#,
16#00#, 16#71#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#0E#, 16#1E#, 16#00#, 16#00#, 16#7C#, 16#1F#, 16#00#,
16#03#, 16#F0#, 16#1F#, 16#80#, 16#3F#, 16#80#, 16#1F#, 16#FF#, 16#FC#,
16#00#, 16#1F#, 16#FF#, 16#E0#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3F#, 16#C0#, 16#00#, 16#00#, 16#0F#, 16#E0#,
16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#60#, 16#00#, 16#1F#, 16#E0#, 16#18#, 16#00#, 16#3F#, 16#FE#,
16#06#, 16#00#, 16#1F#, 16#FF#, 16#C3#, 16#80#, 16#1F#, 16#80#, 16#F8#,
16#C0#, 16#0F#, 16#80#, 16#0F#, 16#30#, 16#07#, 16#80#, 16#00#, 16#EC#,
16#03#, 16#C0#, 16#00#, 16#3F#, 16#01#, 16#E0#, 16#00#, 16#07#, 16#80#,
16#70#, 16#00#, 16#01#, 16#E0#, 16#38#, 16#00#, 16#00#, 16#38#, 16#1E#,
16#00#, 16#00#, 16#0E#, 16#07#, 16#00#, 16#00#, 16#03#, 16#81#, 16#C0#,
16#00#, 16#00#, 16#C0#, 16#E0#, 16#00#, 16#00#, 16#30#, 16#38#, 16#00#,
16#00#, 16#0C#, 16#0E#, 16#00#, 16#00#, 16#07#, 16#03#, 16#80#, 16#00#,
16#01#, 16#80#, 16#E0#, 16#00#, 16#00#, 16#E0#, 16#38#, 16#00#, 16#00#,
16#38#, 16#0F#, 16#00#, 16#00#, 16#1E#, 16#03#, 16#C0#, 16#00#, 16#0F#,
16#00#, 16#78#, 16#00#, 16#07#, 16#C0#, 16#1E#, 16#00#, 16#03#, 16#B0#,
16#03#, 16#E0#, 16#03#, 16#CC#, 16#00#, 16#7E#, 16#03#, 16#E3#, 16#F8#,
16#0F#, 16#FF#, 16#F1#, 16#FE#, 16#01#, 16#FF#, 16#F0#, 16#7F#, 16#80#,
16#1F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#01#,
16#FF#, 16#F8#, 16#00#, 16#3F#, 16#FF#, 16#E0#, 16#03#, 16#F0#, 16#1F#,
16#80#, 16#3C#, 16#00#, 16#3E#, 16#03#, 16#C0#, 16#00#, 16#78#, 16#38#,
16#00#, 16#03#, 16#C3#, 16#80#, 16#00#, 16#0F#, 16#3C#, 16#00#, 16#00#,
16#39#, 16#C0#, 16#00#, 16#01#, 16#DC#, 16#00#, 16#00#, 16#0E#, 16#E0#,
16#00#, 16#00#, 16#77#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#01#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#03#, 16#07#, 16#C0#, 16#00#,
16#F8#, 16#1F#, 16#80#, 16#3F#, 16#80#, 16#7F#, 16#FF#, 16#F0#, 16#00#,
16#FF#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#FF#, 16#80#, 16#00#, 16#03#, 16#FF#, 16#FC#, 16#00#, 16#00#,
16#FF#, 16#FF#, 16#80#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#1E#,
16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#FF#,
16#80#, 16#0F#, 16#FF#, 16#FF#, 16#F0#, 16#00#, 16#FF#, 16#FF#, 16#FE#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#03#,
16#80#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#7F#, 16#FF#,
16#FF#, 16#80#, 16#0F#, 16#FF#, 16#FF#, 16#F0#, 16#01#, 16#FF#, 16#FF#,
16#FC#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#0F#,
16#FE#, 16#0F#, 16#E0#, 16#0F#, 16#FF#, 16#E3#, 16#FC#, 16#0F#, 16#E0#,
16#7C#, 16#FE#, 16#07#, 16#C0#, 16#07#, 16#30#, 16#03#, 16#E0#, 16#00#,
16#7C#, 16#01#, 16#E0#, 16#00#, 16#1F#, 16#00#, 16#70#, 16#00#, 16#03#,
16#80#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#1E#, 16#00#, 16#00#, 16#18#,
16#07#, 16#00#, 16#00#, 16#06#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#80#,
16#E0#, 16#00#, 16#00#, 16#40#, 16#38#, 16#00#, 16#00#, 16#30#, 16#0E#,
16#00#, 16#00#, 16#0C#, 16#03#, 16#80#, 16#00#, 16#03#, 16#00#, 16#E0#,
16#00#, 16#01#, 16#80#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#0F#, 16#00#,
16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#3E#, 16#00#, 16#78#, 16#00#,
16#1F#, 16#00#, 16#0F#, 16#00#, 16#0E#, 16#C0#, 16#03#, 16#F0#, 16#1F#,
16#30#, 16#00#, 16#7F#, 16#FF#, 16#0C#, 16#00#, 16#07#, 16#FF#, 16#87#,
16#00#, 16#00#, 16#7F#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#60#,
16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#80#, 16#00#, 16#1F#, 16#FF#, 16#C0#, 16#00#, 16#0F#, 16#FF#,
16#C0#, 16#00#, 16#01#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#FE#,
16#00#, 16#00#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#80#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#,
16#01#, 16#FC#, 16#00#, 16#03#, 16#87#, 16#FF#, 16#80#, 16#01#, 16#CF#,
16#FF#, 16#E0#, 16#00#, 16#CF#, 16#80#, 16#F8#, 16#00#, 16#6F#, 16#00#,
16#1C#, 16#00#, 16#7E#, 16#00#, 16#0F#, 16#00#, 16#3E#, 16#00#, 16#03#,
16#80#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#00#, 16#E0#,
16#0E#, 16#00#, 16#00#, 16#70#, 16#07#, 16#00#, 16#00#, 16#38#, 16#03#,
16#80#, 16#00#, 16#3C#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#C0#,
16#00#, 16#0E#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#70#, 16#00#,
16#03#, 16#80#, 16#38#, 16#00#, 16#03#, 16#C0#, 16#1C#, 16#00#, 16#01#,
16#C0#, 16#0C#, 16#00#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#00#, 16#70#,
16#07#, 16#00#, 16#00#, 16#78#, 16#03#, 16#80#, 16#00#, 16#38#, 16#01#,
16#C0#, 16#00#, 16#1C#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#0F#, 16#FF#,
16#00#, 16#7F#, 16#FF#, 16#FF#, 16#80#, 16#3F#, 16#FB#, 16#FF#, 16#80#,
16#1F#, 16#F8#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#07#, 16#80#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#07#,
16#80#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#01#, 16#FF#, 16#E0#, 16#00#, 16#7F#, 16#F8#, 16#00#, 16#0F#,
16#FF#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#07#, 16#00#, 16#0F#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#FF#, 16#FF#, 16#00#, 16#FF#, 16#FF#, 16#F0#, 16#0F#, 16#FF#,
16#FF#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#03#, 16#80#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#60#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#7F#, 16#FF#, 16#80#, 16#0F#,
16#FF#, 16#F0#, 16#00#, 16#7F#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#FF#,
16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#,
16#00#, 16#00#, 16#18#, 16#07#, 16#FF#, 16#00#, 16#38#, 16#07#, 16#FF#,
16#00#, 16#30#, 16#07#, 16#FF#, 16#00#, 16#30#, 16#01#, 16#E0#, 16#00#,
16#30#, 16#07#, 16#80#, 16#00#, 16#70#, 16#0F#, 16#00#, 16#00#, 16#60#,
16#3C#, 16#00#, 16#00#, 16#60#, 16#78#, 16#00#, 16#00#, 16#61#, 16#E0#,
16#00#, 16#00#, 16#63#, 16#C0#, 16#00#, 16#00#, 16#EF#, 16#00#, 16#00#,
16#00#, 16#DF#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#80#, 16#00#, 16#00#,
16#F3#, 16#C0#, 16#00#, 16#01#, 16#C1#, 16#E0#, 16#00#, 16#01#, 16#C0#,
16#F0#, 16#00#, 16#01#, 16#C0#, 16#70#, 16#00#, 16#01#, 16#80#, 16#38#,
16#00#, 16#01#, 16#80#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#1E#, 16#00#,
16#03#, 16#80#, 16#0F#, 16#00#, 16#03#, 16#00#, 16#07#, 16#80#, 16#03#,
16#00#, 16#03#, 16#C0#, 16#7F#, 16#00#, 16#1F#, 16#FC#, 16#FF#, 16#00#,
16#1F#, 16#FC#, 16#FE#, 16#00#, 16#1F#, 16#FC#, 16#00#, 16#3F#, 16#FC#,
16#00#, 16#07#, 16#FF#, 16#80#, 16#00#, 16#FF#, 16#F0#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#,
16#00#, 16#60#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#03#, 16#80#,
16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#01#,
16#80#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#06#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#38#, 16#00#, 16#7F#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#80#,
16#00#, 16#00#, 16#F8#, 16#07#, 16#C0#, 16#3F#, 16#9F#, 16#E0#, 16#FF#,
16#01#, 16#F9#, 16#FF#, 16#8F#, 16#FC#, 16#0F#, 16#FE#, 16#3C#, 16#F1#,
16#F0#, 16#07#, 16#C0#, 16#FE#, 16#07#, 16#80#, 16#78#, 16#03#, 16#E0#,
16#1C#, 16#03#, 16#80#, 16#1C#, 16#00#, 16#E0#, 16#18#, 16#00#, 16#C0#,
16#07#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#30#, 16#0E#, 16#00#, 16#30#,
16#01#, 16#80#, 16#70#, 16#01#, 16#80#, 16#0C#, 16#03#, 16#00#, 16#1C#,
16#00#, 16#60#, 16#18#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#C0#, 16#06#,
16#00#, 16#30#, 16#0E#, 16#00#, 16#30#, 16#01#, 16#80#, 16#60#, 16#03#,
16#80#, 16#0C#, 16#03#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#18#, 16#00#,
16#C0#, 16#07#, 16#01#, 16#C0#, 16#06#, 16#00#, 16#30#, 16#0C#, 16#00#,
16#70#, 16#01#, 16#80#, 16#60#, 16#03#, 16#80#, 16#1C#, 16#03#, 16#00#,
16#18#, 16#00#, 16#E0#, 16#38#, 16#00#, 16#C0#, 16#06#, 16#01#, 16#80#,
16#06#, 16#00#, 16#30#, 16#FF#, 16#C0#, 16#7E#, 16#01#, 16#F7#, 16#FE#,
16#03#, 16#F0#, 16#1F#, 16#FF#, 16#F0#, 16#1F#, 16#80#, 16#FC#, 16#00#,
16#00#, 16#1F#, 16#C0#, 16#0F#, 16#E1#, 16#FF#, 16#E0#, 16#1F#, 16#C7#,
16#FF#, 16#E0#, 16#3F#, 16#BE#, 16#03#, 16#E0#, 16#0E#, 16#F0#, 16#03#,
16#C0#, 16#1F#, 16#80#, 16#03#, 16#C0#, 16#3E#, 16#00#, 16#03#, 16#80#,
16#78#, 16#00#, 16#07#, 16#01#, 16#E0#, 16#00#, 16#0E#, 16#03#, 16#80#,
16#00#, 16#1C#, 16#07#, 16#00#, 16#00#, 16#38#, 16#0E#, 16#00#, 16#00#,
16#E0#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#38#, 16#00#, 16#03#, 16#80#,
16#E0#, 16#00#, 16#07#, 16#01#, 16#C0#, 16#00#, 16#0C#, 16#03#, 16#80#,
16#00#, 16#38#, 16#07#, 16#00#, 16#00#, 16#70#, 16#0E#, 16#00#, 16#00#,
16#E0#, 16#38#, 16#00#, 16#01#, 16#C0#, 16#70#, 16#00#, 16#07#, 16#00#,
16#E0#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#03#, 16#80#,
16#00#, 16#38#, 16#FF#, 16#F0#, 16#07#, 16#FF#, 16#FF#, 16#E0#, 16#0F#,
16#FF#, 16#FF#, 16#80#, 16#1F#, 16#F0#, 16#00#, 16#03#, 16#FC#, 16#00#,
16#00#, 16#7F#, 16#FC#, 16#00#, 16#07#, 16#FF#, 16#FC#, 16#00#, 16#7F#,
16#01#, 16#F8#, 16#03#, 16#E0#, 16#01#, 16#F0#, 16#1E#, 16#00#, 16#03#,
16#E0#, 16#F0#, 16#00#, 16#07#, 16#87#, 16#80#, 16#00#, 16#0E#, 16#1C#,
16#00#, 16#00#, 16#3C#, 16#E0#, 16#00#, 16#00#, 16#77#, 16#80#, 16#00#,
16#01#, 16#DC#, 16#00#, 16#00#, 16#07#, 16#70#, 16#00#, 16#00#, 16#1F#,
16#80#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#,
16#00#, 16#0E#, 16#E0#, 16#00#, 16#00#, 16#3B#, 16#80#, 16#00#, 16#01#,
16#EE#, 16#00#, 16#00#, 16#07#, 16#3C#, 16#00#, 16#00#, 16#38#, 16#70#,
16#00#, 16#01#, 16#E1#, 16#E0#, 16#00#, 16#0F#, 16#07#, 16#C0#, 16#00#,
16#78#, 16#0F#, 16#80#, 16#07#, 16#C0#, 16#1F#, 16#80#, 16#FE#, 16#00#,
16#3F#, 16#FF#, 16#E0#, 16#00#, 16#3F#, 16#FE#, 16#00#, 16#00#, 16#3F#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FE#, 16#00#, 16#01#, 16#FE#,
16#0F#, 16#FF#, 16#80#, 16#07#, 16#F8#, 16#7F#, 16#FF#, 16#80#, 16#0F#,
16#F3#, 16#F0#, 16#1F#, 16#80#, 16#00#, 16#EF#, 16#00#, 16#0F#, 16#80#,
16#01#, 16#FC#, 16#00#, 16#07#, 16#80#, 16#03#, 16#F0#, 16#00#, 16#07#,
16#00#, 16#07#, 16#80#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#70#, 16#00#,
16#00#, 16#38#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#70#, 16#01#, 16#80#,
16#00#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#0E#,
16#00#, 16#00#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#38#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#70#, 16#00#, 16#00#, 16#70#,
16#01#, 16#F0#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#E0#, 16#00#, 16#07#,
16#80#, 16#07#, 16#E0#, 16#00#, 16#3E#, 16#00#, 16#0E#, 16#F0#, 16#00#,
16#F8#, 16#00#, 16#39#, 16#F8#, 16#0F#, 16#C0#, 16#00#, 16#71#, 16#FF#,
16#FF#, 16#00#, 16#00#, 16#E0#, 16#FF#, 16#F8#, 16#00#, 16#01#, 16#C0#,
16#7F#, 16#80#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#F0#,
16#00#, 16#00#, 16#1F#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#3F#, 16#FF#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#,
16#07#, 16#FF#, 16#83#, 16#FC#, 16#03#, 16#FF#, 16#FC#, 16#7F#, 16#81#,
16#FC#, 16#07#, 16#CF#, 16#F0#, 16#7C#, 16#00#, 16#39#, 16#C0#, 16#1F#,
16#00#, 16#01#, 16#F0#, 16#07#, 16#80#, 16#00#, 16#1E#, 16#00#, 16#E0#,
16#00#, 16#03#, 16#C0#, 16#38#, 16#00#, 16#00#, 16#38#, 16#0F#, 16#00#,
16#00#, 16#07#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#C0#, 16#38#, 16#00#,
16#00#, 16#18#, 16#0E#, 16#00#, 16#00#, 16#03#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#60#, 16#38#, 16#00#, 16#00#, 16#1C#, 16#07#, 16#00#, 16#00#,
16#03#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#E0#, 16#1C#, 16#00#, 16#00#,
16#1C#, 16#03#, 16#C0#, 16#00#, 16#07#, 16#80#, 16#38#, 16#00#, 16#01#,
16#F0#, 16#07#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#7C#, 16#00#, 16#3B#,
16#80#, 16#0F#, 16#E0#, 16#3E#, 16#70#, 16#00#, 16#FF#, 16#FF#, 16#0E#,
16#00#, 16#07#, 16#FF#, 16#C1#, 16#C0#, 16#00#, 16#3F#, 16#C0#, 16#70#,
16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#,
16#00#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#E0#, 16#00#,
16#03#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#01#,
16#FF#, 16#01#, 16#FF#, 16#81#, 16#FF#, 16#81#, 16#FF#, 16#E0#, 16#7F#,
16#C3#, 16#E0#, 16#F0#, 16#00#, 16#E3#, 16#C0#, 16#38#, 16#00#, 16#E7#,
16#80#, 16#00#, 16#00#, 16#77#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#00#,
16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#,
16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#FE#, 16#00#, 16#7F#,
16#FF#, 16#FF#, 16#00#, 16#3F#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#00#,
16#07#, 16#F0#, 16#00#, 16#07#, 16#FF#, 16#8C#, 16#01#, 16#FF#, 16#FB#,
16#80#, 16#FC#, 16#07#, 16#F0#, 16#3E#, 16#00#, 16#3E#, 16#07#, 16#00#,
16#01#, 16#81#, 16#C0#, 16#00#, 16#30#, 16#38#, 16#00#, 16#06#, 16#07#,
16#00#, 16#00#, 16#80#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#,
16#01#, 16#FE#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#00#, 16#00#, 16#3F#,
16#FC#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#38#, 16#80#, 16#00#, 16#07#,
16#30#, 16#00#, 16#00#, 16#E6#, 16#00#, 16#00#, 16#1C#, 16#C0#, 16#00#,
16#07#, 16#1C#, 16#00#, 16#01#, 16#E7#, 16#C0#, 16#00#, 16#F8#, 16#FF#,
16#00#, 16#7E#, 16#1D#, 16#FF#, 16#FF#, 16#03#, 16#0F#, 16#FF#, 16#80#,
16#00#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#03#, 16#80#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#03#, 16#80#, 16#00#, 16#03#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#07#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#0E#, 16#1E#, 16#00#, 16#FE#, 16#1F#, 16#FF#, 16#FC#, 16#0F#, 16#FF#,
16#E0#, 16#03#, 16#FE#, 16#00#, 16#FE#, 16#00#, 16#1F#, 16#FF#, 16#E0#,
16#01#, 16#FF#, 16#FC#, 16#00#, 16#1F#, 16#F1#, 16#C0#, 16#00#, 16#07#,
16#1C#, 16#00#, 16#00#, 16#61#, 16#C0#, 16#00#, 16#0E#, 16#1C#, 16#00#,
16#00#, 16#E3#, 16#80#, 16#00#, 16#0C#, 16#38#, 16#00#, 16#01#, 16#C3#,
16#80#, 16#00#, 16#1C#, 16#38#, 16#00#, 16#01#, 16#C3#, 16#80#, 16#00#,
16#18#, 16#70#, 16#00#, 16#03#, 16#87#, 16#00#, 16#00#, 16#38#, 16#70#,
16#00#, 16#03#, 16#87#, 16#00#, 16#00#, 16#30#, 16#70#, 16#00#, 16#07#,
16#07#, 16#00#, 16#00#, 16#70#, 16#70#, 16#00#, 16#07#, 16#07#, 16#00#,
16#00#, 16#E0#, 16#70#, 16#00#, 16#1E#, 16#07#, 16#00#, 16#07#, 16#E0#,
16#78#, 16#01#, 16#EE#, 16#03#, 16#C0#, 16#FC#, 16#FC#, 16#3F#, 16#FF#,
16#1F#, 16#C1#, 16#FF#, 16#C1#, 16#FC#, 16#07#, 16#E0#, 16#00#, 16#00#,
16#7F#, 16#F8#, 16#03#, 16#FF#, 16#FF#, 16#FE#, 16#01#, 16#FF#, 16#FF#,
16#FF#, 16#80#, 16#7F#, 16#FC#, 16#38#, 16#00#, 16#00#, 16#60#, 16#0E#,
16#00#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#70#,
16#00#, 16#06#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#38#, 16#00#,
16#38#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#0E#,
16#00#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#01#, 16#C0#,
16#00#, 16#07#, 16#00#, 16#E0#, 16#00#, 16#01#, 16#C0#, 16#38#, 16#00#,
16#00#, 16#38#, 16#1C#, 16#00#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#,
16#03#, 16#83#, 16#80#, 16#00#, 16#00#, 16#61#, 16#C0#, 16#00#, 16#00#,
16#1C#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#38#, 16#00#, 16#00#, 16#01#,
16#FC#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#80#, 16#00#, 16#00#, 16#FF#, 16#80#, 16#00#, 16#FF#, 16#BF#, 16#E0#,
16#00#, 16#7F#, 16#FF#, 16#F8#, 16#00#, 16#1F#, 16#F8#, 16#E0#, 16#00#,
16#00#, 16#30#, 16#38#, 16#00#, 16#00#, 16#1C#, 16#0E#, 16#00#, 16#00#,
16#06#, 16#03#, 16#80#, 16#08#, 16#03#, 16#80#, 16#E0#, 16#0E#, 16#00#,
16#C0#, 16#38#, 16#07#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#E0#, 16#1C#,
16#03#, 16#80#, 16#FC#, 16#0E#, 16#00#, 16#E0#, 16#6F#, 16#03#, 16#80#,
16#38#, 16#19#, 16#C0#, 16#C0#, 16#0E#, 16#0C#, 16#70#, 16#70#, 16#03#,
16#83#, 16#1C#, 16#18#, 16#00#, 16#E1#, 16#87#, 16#0E#, 16#00#, 16#38#,
16#E1#, 16#E3#, 16#00#, 16#0E#, 16#30#, 16#79#, 16#C0#, 16#03#, 16#98#,
16#0E#, 16#70#, 16#00#, 16#E6#, 16#03#, 16#B8#, 16#00#, 16#3B#, 16#00#,
16#EE#, 16#00#, 16#0E#, 16#C0#, 16#3B#, 16#00#, 16#03#, 16#E0#, 16#0F#,
16#C0#, 16#00#, 16#F8#, 16#03#, 16#E0#, 16#00#, 16#3C#, 16#00#, 16#F8#,
16#00#, 16#0F#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#80#,
16#3F#, 16#E0#, 16#1F#, 16#F8#, 16#07#, 16#FE#, 16#01#, 16#FF#, 16#80#,
16#7F#, 16#E0#, 16#07#, 16#80#, 16#00#, 16#70#, 16#00#, 16#3C#, 16#00#,
16#0E#, 16#00#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#00#, 16#0F#, 16#00#,
16#70#, 16#00#, 16#00#, 16#70#, 16#0E#, 16#00#, 16#00#, 16#03#, 16#83#,
16#C0#, 16#00#, 16#00#, 16#3C#, 16#70#, 16#00#, 16#00#, 16#01#, 16#EE#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#78#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#DC#,
16#00#, 16#00#, 16#00#, 16#78#, 16#E0#, 16#00#, 16#00#, 16#0E#, 16#0F#,
16#00#, 16#00#, 16#03#, 16#C0#, 16#78#, 16#00#, 16#00#, 16#78#, 16#03#,
16#C0#, 16#00#, 16#0E#, 16#00#, 16#1E#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#F0#, 16#00#, 16#78#, 16#00#, 16#07#, 16#80#, 16#0E#, 16#00#, 16#00#,
16#38#, 16#07#, 16#FF#, 16#00#, 16#7F#, 16#F0#, 16#FF#, 16#F0#, 16#0F#,
16#FF#, 16#07#, 16#FF#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#FF#, 16#C0#,
16#07#, 16#FC#, 16#01#, 16#FF#, 16#80#, 16#1F#, 16#FC#, 16#03#, 16#FF#,
16#00#, 16#1F#, 16#F0#, 16#01#, 16#C0#, 16#00#, 16#03#, 16#80#, 16#03#,
16#80#, 16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#18#, 16#00#,
16#07#, 16#00#, 16#00#, 16#60#, 16#00#, 16#0E#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#0C#, 16#00#, 16#07#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#00#, 16#70#, 16#00#,
16#E0#, 16#00#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#, 16#00#, 16#E0#,
16#06#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#01#,
16#80#, 16#70#, 16#00#, 16#00#, 16#03#, 16#80#, 16#C0#, 16#00#, 16#00#,
16#07#, 16#03#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#38#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#60#, 16#00#,
16#00#, 16#00#, 16#39#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#37#, 16#00#,
16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#03#,
16#80#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#,
16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#,
16#00#, 16#0F#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#E0#, 16#FF#, 16#FF#,
16#FC#, 16#1F#, 16#FF#, 16#FF#, 16#87#, 16#80#, 16#00#, 16#E0#, 16#E0#,
16#00#, 16#38#, 16#1C#, 16#00#, 16#0E#, 16#03#, 16#00#, 16#07#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#,
16#60#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#03#, 16#80#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#07#, 16#00#, 16#01#, 16#81#, 16#C0#,
16#00#, 16#70#, 16#70#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#01#, 16#87#,
16#FF#, 16#FF#, 16#F0#, 16#FF#, 16#FF#, 16#FE#, 16#1F#, 16#FF#, 16#FF#,
16#C0#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#3F#, 16#00#, 16#0F#, 16#E0#,
16#00#, 16#F0#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#38#,
16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#,
16#70#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#3C#, 16#00#, 16#0F#, 16#80#, 16#07#,
16#E0#, 16#00#, 16#F8#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#0F#, 16#00#,
16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#,
16#80#, 16#00#, 16#70#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#,
16#07#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1E#, 16#00#,
16#00#, 16#FC#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#3C#, 16#00#, 16#00#,
16#30#, 16#07#, 16#00#, 16#70#, 16#02#, 16#00#, 16#60#, 16#06#, 16#00#,
16#60#, 16#06#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#C0#, 16#0C#, 16#00#,
16#80#, 16#18#, 16#01#, 16#80#, 16#18#, 16#01#, 16#00#, 16#30#, 16#03#,
16#00#, 16#30#, 16#03#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#06#,
16#00#, 16#40#, 16#0C#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#C0#, 16#18#,
16#01#, 16#80#, 16#18#, 16#01#, 16#80#, 16#10#, 16#03#, 16#00#, 16#30#,
16#03#, 16#00#, 16#20#, 16#06#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#,
16#0C#, 16#00#, 16#C0#, 16#0E#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#03#, 16#F0#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#78#, 16#00#,
16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#, 16#70#,
16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#7F#, 16#00#,
16#01#, 16#F0#, 16#00#, 16#7F#, 16#00#, 16#1F#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#38#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#0E#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#,
16#80#, 16#00#, 16#70#, 16#00#, 16#1F#, 16#00#, 16#0F#, 16#E0#, 16#00#,
16#FC#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#,
16#FF#, 16#00#, 16#04#, 16#7F#, 16#F0#, 16#03#, 16#9F#, 16#1F#, 16#00#,
16#F7#, 16#81#, 16#F0#, 16#3C#, 16#E0#, 16#1F#, 16#0F#, 16#38#, 16#00#,
16#FF#, 16#C2#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#F8#, 16#00#);
FreeMonoOblique32pt7bGlyphs : aliased constant Glyph_Array := (
(0, 0, 0, 38, 0, 1), -- 0x20 ' '
(0, 13, 40, 38, 16, -38), -- 0x21 '!'
(65, 23, 18, 38, 13, -37), -- 0x22 '"'
(117, 28, 43, 38, 9, -39), -- 0x23 '#'
(268, 29, 45, 38, 8, -39), -- 0x24 '$'
(432, 28, 40, 38, 9, -38), -- 0x25 '%'
(572, 25, 34, 38, 8, -32), -- 0x26 '&'
(679, 9, 18, 38, 22, -37), -- 0x27 '''
(700, 15, 46, 38, 21, -37), -- 0x28 '('
(787, 15, 46, 38, 8, -37), -- 0x29 ')'
(874, 24, 23, 38, 13, -38), -- 0x2A '*'
(943, 30, 30, 38, 8, -31), -- 0x2B '+'
(1056, 16, 18, 38, 7, -8), -- 0x2C ','
(1092, 29, 3, 38, 8, -18), -- 0x2D '-'
(1103, 9, 8, 38, 15, -6), -- 0x2E '.'
(1112, 33, 47, 38, 6, -41), -- 0x2F '/'
(1306, 26, 40, 38, 10, -38), -- 0x30 '0'
(1436, 24, 38, 38, 7, -37), -- 0x31 '1'
(1550, 31, 39, 38, 5, -38), -- 0x32 '2'
(1702, 30, 40, 38, 7, -38), -- 0x33 '3'
(1852, 25, 38, 38, 9, -37), -- 0x34 '4'
(1971, 30, 39, 38, 7, -37), -- 0x35 '5'
(2118, 28, 40, 38, 12, -38), -- 0x36 '6'
(2258, 24, 38, 38, 14, -37), -- 0x37 '7'
(2372, 28, 40, 38, 9, -38), -- 0x38 '8'
(2512, 29, 40, 38, 9, -38), -- 0x39 '9'
(2657, 13, 27, 38, 15, -25), -- 0x3A ':'
(2701, 19, 35, 38, 7, -25), -- 0x3B ';'
(2785, 32, 30, 38, 8, -32), -- 0x3C '<'
(2905, 33, 12, 38, 6, -23), -- 0x3D '='
(2955, 31, 30, 38, 6, -32), -- 0x3E '>'
(3072, 22, 37, 38, 15, -35), -- 0x3F '?'
(3174, 27, 43, 38, 9, -38), -- 0x40 '@'
(3320, 37, 35, 38, 1, -34), -- 0x41 'A'
(3482, 35, 35, 38, 3, -34), -- 0x42 'B'
(3636, 33, 37, 38, 7, -35), -- 0x43 'C'
(3789, 35, 35, 38, 3, -34), -- 0x44 'D'
(3943, 36, 35, 38, 3, -34), -- 0x45 'E'
(4101, 37, 35, 38, 3, -34), -- 0x46 'F'
(4263, 33, 37, 38, 7, -35), -- 0x47 'G'
(4416, 37, 35, 38, 4, -34), -- 0x48 'H'
(4578, 31, 35, 38, 7, -34), -- 0x49 'I'
(4714, 39, 36, 38, 6, -34), -- 0x4A 'J'
(4890, 39, 35, 38, 3, -34), -- 0x4B 'K'
(5061, 33, 35, 38, 4, -34), -- 0x4C 'L'
(5206, 43, 35, 38, 1, -34), -- 0x4D 'M'
(5395, 40, 35, 38, 3, -34), -- 0x4E 'N'
(5570, 33, 37, 38, 6, -35), -- 0x4F 'O'
(5723, 34, 35, 38, 3, -34), -- 0x50 'P'
(5872, 33, 44, 38, 6, -35), -- 0x51 'Q'
(6054, 34, 35, 38, 3, -34), -- 0x52 'R'
(6203, 30, 37, 38, 7, -35), -- 0x53 'S'
(6342, 31, 35, 38, 10, -34), -- 0x54 'T'
(6478, 34, 36, 38, 9, -34), -- 0x55 'U'
(6631, 37, 35, 38, 8, -34), -- 0x56 'V'
(6793, 36, 35, 38, 8, -34), -- 0x57 'W'
(6951, 39, 35, 38, 3, -34), -- 0x58 'X'
(7122, 32, 35, 38, 10, -34), -- 0x59 'Y'
(7262, 31, 35, 38, 6, -34), -- 0x5A 'Z'
(7398, 20, 46, 38, 16, -37), -- 0x5B '['
(7513, 14, 47, 38, 16, -41), -- 0x5C '\'
(7596, 20, 46, 38, 8, -37), -- 0x5D ']'
(7711, 24, 16, 38, 12, -37), -- 0x5E '^'
(7759, 39, 3, 38, -2, 6), -- 0x5F '_'
(7774, 9, 9, 38, 17, -39), -- 0x60 '`'
(7785, 29, 28, 38, 6, -26), -- 0x61 'a'
(7887, 36, 39, 38, 2, -37), -- 0x62 'b'
(8063, 31, 28, 38, 8, -26), -- 0x63 'c'
(8172, 34, 39, 38, 6, -37), -- 0x64 'd'
(8338, 29, 28, 38, 7, -26), -- 0x65 'e'
(8440, 35, 38, 38, 7, -37), -- 0x66 'f'
(8607, 34, 39, 38, 7, -26), -- 0x67 'g'
(8773, 33, 38, 38, 3, -37), -- 0x68 'h'
(8930, 27, 39, 38, 6, -38), -- 0x69 'i'
(9062, 28, 51, 38, 5, -38), -- 0x6A 'j'
(9241, 32, 38, 38, 4, -37), -- 0x6B 'k'
(9393, 27, 38, 38, 6, -37), -- 0x6C 'l'
(9522, 37, 27, 38, 1, -26), -- 0x6D 'm'
(9647, 31, 27, 38, 4, -26), -- 0x6E 'n'
(9752, 30, 28, 38, 7, -26), -- 0x6F 'o'
(9857, 39, 39, 38, -1, -26), -- 0x70 'p'
(10048, 35, 39, 38, 7, -26), -- 0x71 'q'
(10219, 33, 27, 38, 6, -26), -- 0x72 'r'
(10331, 27, 28, 37, 7, -26), -- 0x73 's'
(10426, 24, 36, 38, 8, -34), -- 0x74 't'
(10534, 28, 27, 38, 8, -25), -- 0x75 'u'
(10629, 34, 26, 38, 7, -25), -- 0x76 'v'
(10740, 34, 26, 38, 8, -25), -- 0x77 'w'
(10851, 36, 26, 38, 3, -25), -- 0x78 'x'
(10968, 39, 38, 38, 1, -25), -- 0x79 'y'
(11154, 27, 26, 38, 8, -25), -- 0x7A 'z'
(11242, 20, 46, 38, 14, -37), -- 0x7B '{'
(11357, 12, 47, 38, 16, -38), -- 0x7C '|'
(11428, 20, 46, 38, 11, -37), -- 0x7D '}'
(11543, 27, 9, 38, 9, -21)); -- 0x7E '~'
Font_D : aliased constant Bitmap_Font :=
(FreeMonoOblique32pt7bBitmaps'Access,
FreeMonoOblique32pt7bGlyphs'Access,
63);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Bitmap_Fonts.FreeMonoOblique32pt7b;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- This specification is adapted 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. --
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with System;
with System.Parameters;
package Ada.Wide_Text_IO is
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
type Count is range 0 .. System.Parameters.Count_Max;
subtype Positive_Count is Count range 1 .. Count'Last;
Unbounded : constant Count := 0;
-- Line and page length
subtype Field is Integer range 0 .. System.Parameters.Field_Max;
subtype Number_Base is Integer range 2 .. 16;
type Type_Set is (Lower_Case, Upper_Case);
---------------------
-- File Management --
---------------------
procedure Create
(File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "");
procedure Open
(File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode);
procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode;
function Name (File : in File_Type) return String;
function Form (File : in File_Type) return String;
function Is_Open (File : in File_Type) return Boolean;
------------------------------------------------------
-- Control of default input, output and error files --
------------------------------------------------------
procedure Set_Input (File : in File_Type);
procedure Set_Output (File : in File_Type);
procedure Set_Error (File : in File_Type);
function Standard_Input return File_Type;
function Standard_Output return File_Type;
function Standard_Error return File_Type;
function Current_Input return File_Type;
function Current_Output return File_Type;
function Current_Error return File_Type;
type File_Access is access constant File_Type;
function Standard_Input return File_Access;
function Standard_Output return File_Access;
function Standard_Error return File_Access;
function Current_Input return File_Access;
function Current_Output return File_Access;
function Current_Error return File_Access;
--------------------
-- Buffer control --
--------------------
procedure Flush (File : in out File_Type);
procedure Flush;
--------------------------------------------
-- Specification of line and page lengths --
--------------------------------------------
procedure Set_Line_Length (File : in File_Type; To : in Count);
procedure Set_Line_Length (To : in Count);
procedure Set_Page_Length (File : in File_Type; To : in Count);
procedure Set_Page_Length (To : in Count);
function Line_Length (File : in File_Type) return Count;
function Line_Length return Count;
function Page_Length (File : in File_Type) return Count;
function Page_Length return Count;
------------------------------------
-- Column, Line, and Page Control --
------------------------------------
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean;
function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type);
procedure New_Page;
procedure Skip_Page (File : in File_Type);
procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean;
function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean;
function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count);
procedure Set_Col (To : in Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count);
procedure Set_Line (To : in Positive_Count);
function Col (File : in File_Type) return Positive_Count;
function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count;
function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count;
function Page return Positive_Count;
-----------------------------
-- Characters Input-Output --
-----------------------------
procedure Get (File : in File_Type; Item : out Wide_Character);
procedure Get (Item : out Wide_Character);
procedure Put (File : in File_Type; Item : in Wide_Character);
procedure Put (Item : in Wide_Character);
procedure Look_Ahead
(File : in File_Type;
Item : out Wide_Character;
End_Of_Line : out Boolean);
procedure Look_Ahead
(Item : out Wide_Character;
End_of_Line : out Boolean);
procedure Get_Immediate
(File : in File_Type;
Item : out Wide_Character);
procedure Get_Immediate
(Item : out Wide_Character);
procedure Get_Immediate
(File : in File_Type;
Item : out Wide_Character;
Available : out Boolean);
procedure Get_Immediate
(Item : out Wide_Character;
Available : out Boolean);
--------------------------
-- Strings Input-Output --
--------------------------
procedure Get (File : in File_Type; Item : out Wide_String);
procedure Get (Item : out Wide_String);
procedure Put (File : in File_Type; Item : in Wide_String);
procedure Put (Item : in Wide_String);
procedure Get_Line
(File : in File_Type;
Item : out Wide_String;
Last : out Natural);
procedure Get_Line
(Item : out Wide_String;
Last : out Natural);
procedure Put_Line
(File : in File_Type;
Item : in Wide_String);
procedure Put_Line
(Item : in Wide_String);
--------------------------------------------------------
-- Generic packages for Input-Output of Integer Types --
--------------------------------------------------------
generic
type Num is range <>;
package Integer_Io is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get
(File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get
(Item : out Num;
Width : in Field := 0);
procedure Put
(File : in File_Type;
Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put
(Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Get
(From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put
(To : out Wide_String;
Item : in Num;
Base : in Number_Base := Default_Base);
end Integer_Io;
-----------------------------------
-- Input-Output of Modular Types --
-----------------------------------
generic
type Num is mod <>;
package Modular_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get
(File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get
(Item : out Num;
Width : in Field := 0);
procedure Put
(File : in File_Type;
Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put
(Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Get
(From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put
(To : out Wide_String;
Item : in Num;
Base : in Number_Base := Default_Base);
end Modular_IO;
--------------------------------
-- Input-Output of Real Types --
--------------------------------
generic
type Num is digits <>;
package Float_Io is
Default_Fore : Field := 2;
Default_Aft : Field := Num'Digits - 1;
Default_Exp : Field := 3;
procedure Get
(File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get
(Item : out Num;
Width : in Field := 0);
procedure Put
(File : in File_Type;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Put
(Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Get
(From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put
(To : out Wide_String;
Item : in Num;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
end Float_Io;
generic
type Num is delta <>;
package Fixed_Io is
Default_Fore : Field := Num'Fore;
Default_Aft : Field := Num'Aft;
Default_Exp : Field := 0;
procedure Get
(File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get
(Item : out Num;
Width : in Field := 0);
procedure Put
(File : in File_Type;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Put
(Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Get
(From : in Wide_String;
Item : out Num; Last : out Positive);
procedure Put
(To : out Wide_String;
Item : in Num;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
end Fixed_Io;
-- generic
-- type Num is delta <> digits <>;
-- package Decimal_IO is
--
-- Default_Fore : Field := Num'Fore;
-- Default_Aft : Field := Num'Aft;
-- Default_Exp : Field := 0;
-- procedure Get
-- (File : in File_Type;
-- Item : out Num;
-- Width : in Field := 0);
-- procedure Get
-- (Item : out Num;
-- Width : in Field := 0);
-- procedure Put
-- (File : in File_Type;
-- Item : in Num;
-- Fore : in Field := Default_Fore;
-- Aft : in Field := Default_Aft;
-- Exp : in Field := Default_Exp);
-- procedure Put
-- (Item : in Num;
-- Fore : in Field := Default_Fore;
-- Aft : in Field := Default_Aft;
-- Exp : in Field := Default_Exp);
-- procedure Get
-- (From : in Wide_String;
-- Item : out Num;
-- Last : out Positive);
-- procedure Put
-- (To : out Wide_String;
-- Item : in Num;
-- Aft : in Field := Default_Aft;
-- Exp : in Field := Default_Exp);
--
-- end Decimal_IO;
---------------------------------------
-- Input-Output of Enumeration Types --
---------------------------------------
generic
type Enum is (<>);
package Enumeration_Io is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : in File_Type; Item : out Enum);
procedure Get (Item : out Enum);
procedure Put
(File : in File_Type;
Item : in Enum;
Width : in Field := Default_Width;
Set : in Type_Set := Default_Setting);
procedure Put
(Item : in Enum;
Width : in Field := Default_Width;
Set : in Type_Set := Default_Setting);
procedure Get
(From : in Wide_String;
Item : out Enum;
Last : out positive);
procedure Put
(To : out Wide_String;
Item : in Enum;
Set : in Type_Set := Default_Setting);
end Enumeration_Io;
-- Exceptions
Status_Error : exception renames IO_Exceptions.Status_Error;
Mode_Error : exception renames IO_Exceptions.Mode_Error;
Name_Error : exception renames IO_Exceptions.Name_Error;
Use_Error : exception renames IO_Exceptions.Use_Error;
Device_Error : exception renames IO_Exceptions.Device_Error;
End_Error : exception renames IO_Exceptions.End_Error;
Data_Error : exception renames IO_Exceptions.Data_Error;
Layout_Error : exception renames IO_Exceptions.Layout_Error;
private
type File_Ptr is new System.Address;
type Pstring is access String;
-- Ada File Control Block
type AFCB is record
AFCB_In_Use : Boolean;
Desc : File_Ptr;
Name : Pstring;
Form : Pstring;
Mode : File_Mode;
Page : Count;
Line : Count;
Col : Positive_Count;
Line_Length : Count;
Page_Length : Count;
Count : Integer;
Is_Keyboard : Boolean;
Look_Ahead : String (1 .. 3);
end record;
type File_Type is access AFCB;
end Ada.Wide_Text_IO;
|
pragma License (Unrestricted);
-- implementation unit
package System.Shared_Locking is
pragma Preelaborate;
-- no-operation
procedure Nop is null;
type Enter_Handler is access procedure;
pragma Favor_Top_Level (Enter_Handler);
Enter_Hook : not null Enter_Handler := Nop'Access;
procedure Enter;
type Leave_Handler is access procedure;
pragma Favor_Top_Level (Leave_Handler);
Leave_Hook : not null Leave_Handler := Nop'Access;
procedure Leave;
end System.Shared_Locking;
|
-----------------------------------------------------------------------
-- jason-tickets-beans -- Beans for module tickets
-- Copyright (C) 2016, 2017, 2019 Stephane.Carrez
-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Strings.Unbounded;
with Ada.Containers.Vectors;
with Ada.Containers.Ordered_Maps;
with ADO;
with Util.Beans.Basic;
with Util.Beans.Objects;
with AWA.Tags.Beans;
with Jason.Tickets.Modules;
with Jason.Tickets.Models;
with Jason.Projects.Beans;
package Jason.Tickets.Beans is
type Ticket_Bean is new Jason.Tickets.Models.Ticket_Bean with record
Module : Jason.Tickets.Modules.Ticket_Module_Access := null;
Ticket_Id : ADO.Identifier := ADO.NO_IDENTIFIER;
Project : Jason.Projects.Beans.Project_Bean_Access;
-- List of tags associated with the wiki page.
Tags : aliased AWA.Tags.Beans.Tag_List_Bean;
Tags_Bean : Util.Beans.Basic.Readonly_Bean_Access;
end record;
type Ticket_Bean_Access is access all Ticket_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Ticket_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Ticket_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create ticket action.
overriding
procedure Create (Bean : in out Ticket_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Save ticket action.
overriding
procedure Save (Bean : in out Ticket_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Save ticket action.
overriding
procedure Save_Status (Bean : in out Ticket_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load ticket action.
overriding
procedure Load (Bean : in out Ticket_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Tickets_Bean bean instance.
function Create_Ticket_Bean (Module : in Jason.Tickets.Modules.Ticket_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Bean that collects the list of tickets filtered by tag, priority and project.
-- ------------------------------
type Ticket_List_Bean is new Jason.Tickets.Models.Ticket_List_Bean with record
Module : Jason.Tickets.Modules.Ticket_Module_Access := null;
Project : Jason.Projects.Beans.Project_Bean_Access;
-- List of tickets.
Tickets : aliased Jason.Tickets.Models.List_Info_List_Bean;
Tickets_Bean : Jason.Tickets.Models.List_Info_List_Bean_Access;
-- List of tags associated with the tickets.
Tags : AWA.Tags.Beans.Entity_Tag_Map;
-- Whether the ticket type filter is enabled.
Type_Filter : Boolean := False;
Status_Filter : Ada.Strings.Unbounded.Unbounded_String;
Priority_Filter : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Ticket_List_Bean_Access is access all Ticket_List_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Ticket_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Ticket_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Load list of tickets.
overriding
procedure Load (Bean : in out Ticket_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Tickets_List_Bean bean instance.
function Create_Ticket_List_Bean (Module : in Jason.Tickets.Modules.Ticket_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- Get a select item list which contains a list of ticket status.
function Create_Status_List (Module : in Jason.Tickets.Modules.Ticket_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- Get a select item list which contains a list of ticket types.
function Create_Type_List (Module : in Jason.Tickets.Modules.Ticket_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
use type Jason.Tickets.Models.Ticket_Type;
type Ticket_Stat_Bean is new Models.Stat_Bean with record
Low : aliased Models.Stat_Bean;
High : aliased Models.Stat_Bean;
Medium : aliased Models.Stat_Bean;
Closed : aliased Models.Stat_Bean;
Progress : Natural := 0;
end record;
package Ticket_Stat_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Ticket_Stat_Bean);
package Ticket_Stat_Map is
new Ada.Containers.Ordered_Maps (Key_Type => Models.Ticket_Type,
Element_Type => Ticket_Stat_Bean,
"<" => Models."<",
"=" => "=");
type Ticket_Raw_Stat_Bean is new Ticket_Stat_Bean with record
Low_Bean : Util.Beans.Objects.Object;
High_Bean : Util.Beans.Objects.Object;
Medium_Bean : Util.Beans.Objects.Object;
Closed_Bean : Util.Beans.Objects.Object;
end record;
procedure Initialize (Object : in out Ticket_Raw_Stat_Bean);
-- Get the value identified by the name.
overriding
function Get_Value (From : in Ticket_Raw_Stat_Bean;
Name : in String) return Util.Beans.Objects.Object;
type Ticket_Report_Bean is new Jason.Tickets.Models.Report_Bean
and Util.Beans.Basic.List_Bean with record
Module : Jason.Tickets.Modules.Ticket_Module_Access := null;
Project : Jason.Projects.Beans.Project_Bean_Access;
Row : Util.Beans.Objects.Object;
Current : Ticket_Stat_Vectors.Cursor;
Current_Pos : Natural := 0;
Element : aliased Ticket_Raw_Stat_Bean;
Total : aliased Ticket_Raw_Stat_Bean;
Total_Bean : Util.Beans.Objects.Object;
List : Ticket_Stat_Map.Map;
Report : Ticket_Stat_Vectors.Vector;
end record;
type Ticket_Report_Bean_Access is access all Ticket_Report_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Ticket_Report_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Ticket_Report_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Get the number of elements in the list.
function Get_Count (From : Ticket_Report_Bean) return Natural;
-- Set the current row index. Valid row indexes start at 1.
overriding
procedure Set_Row_Index (From : in out Ticket_Report_Bean;
Index : in Natural);
-- Get the element at the current row index.
overriding
function Get_Row (From : in Ticket_Report_Bean) return Util.Beans.Objects.Object;
-- Load the information for the tickets.
overriding
procedure Load (Bean : in out Ticket_Report_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Tickets_Report_Bean bean instance.
function Create_Ticket_Report_Bean (Module : in Jason.Tickets.Modules.Ticket_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
end Jason.Tickets.Beans;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014-2015, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Web.Tag_Pages --
------------------------------------------------------------------------------
with Natools.S_Expressions.Atom_Refs;
with Natools.Web.Sites;
private with Natools.Web.Containers;
package Natools.Web.Tag_Pages is
type Page is new Sites.Page with private;
overriding procedure Respond
(Object : in out Page;
Exchange : in out Sites.Exchange;
Extra_Path : in S_Expressions.Atom);
type Loader is new Sites.Page_Loader with private;
overriding procedure Load
(Object : in out Loader;
Builder : in out Sites.Site_Builder;
Path : in S_Expressions.Atom);
function Create (File : in S_Expressions.Atom)
return Sites.Page_Loader'Class;
procedure Register_Loader (Site : in out Sites.Site);
private
type Page_Mode is (Slash_Index, Slashless_Index, Child);
type Element_Array is array (Page_Mode)
of Containers.Expression_Maps.Constant_Map;
type Boolean_Array is array (Page_Mode) of Boolean;
type Page is new Sites.Page with record
Root_Tag : S_Expressions.Atom_Refs.Immutable_Reference;
Elements : Element_Array;
Redirect : Boolean_Array := (others => False);
end record;
type Loader is new Sites.Page_Loader with record
File : S_Expressions.Atom_Refs.Immutable_Reference;
end record;
end Natools.Web.Tag_Pages;
|
-- This spec has been automatically generated from STM32L5x2.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.FDCAN is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype FDCAN_CREL_DAY_Field is HAL.UInt8;
subtype FDCAN_CREL_MON_Field is HAL.UInt8;
subtype FDCAN_CREL_YEAR_Field is HAL.UInt4;
subtype FDCAN_CREL_SUBSTEP_Field is HAL.UInt4;
subtype FDCAN_CREL_STEP_Field is HAL.UInt4;
subtype FDCAN_CREL_REL_Field is HAL.UInt4;
-- FDCAN Core Release Register
type FDCAN_CREL_Register is record
-- Read-only. Timestamp Day
DAY : FDCAN_CREL_DAY_Field;
-- Read-only. Timestamp Month
MON : FDCAN_CREL_MON_Field;
-- Read-only. Timestamp Year
YEAR : FDCAN_CREL_YEAR_Field;
-- Read-only. Sub-step of Core release
SUBSTEP : FDCAN_CREL_SUBSTEP_Field;
-- Read-only. Step of Core release
STEP : FDCAN_CREL_STEP_Field;
-- Read-only. Core release
REL : FDCAN_CREL_REL_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_CREL_Register use record
DAY at 0 range 0 .. 7;
MON at 0 range 8 .. 15;
YEAR at 0 range 16 .. 19;
SUBSTEP at 0 range 20 .. 23;
STEP at 0 range 24 .. 27;
REL at 0 range 28 .. 31;
end record;
subtype FDCAN_DBTP_DSJW_Field is HAL.UInt4;
subtype FDCAN_DBTP_DTSEG2_Field is HAL.UInt4;
subtype FDCAN_DBTP_DTSEG1_Field is HAL.UInt5;
subtype FDCAN_DBTP_DBRP_Field is HAL.UInt5;
-- FDCAN Data Bit Timing and Prescaler Register
type FDCAN_DBTP_Register is record
-- Synchronization Jump Width
DSJW : FDCAN_DBTP_DSJW_Field := 16#3#;
-- Data time segment after sample point
DTSEG2 : FDCAN_DBTP_DTSEG2_Field := 16#3#;
-- Data time segment after sample point
DTSEG1 : FDCAN_DBTP_DTSEG1_Field := 16#A#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Data BIt Rate Prescaler
DBRP : FDCAN_DBTP_DBRP_Field := 16#0#;
-- unspecified
Reserved_21_22 : HAL.UInt2 := 16#0#;
-- Transceiver Delay Compensation
TDC : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_DBTP_Register use record
DSJW at 0 range 0 .. 3;
DTSEG2 at 0 range 4 .. 7;
DTSEG1 at 0 range 8 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DBRP at 0 range 16 .. 20;
Reserved_21_22 at 0 range 21 .. 22;
TDC at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FDCAN_TEST_TX_Field is HAL.UInt2;
-- FDCAN Test Register
type FDCAN_TEST_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- Loop Back mode
LBCK : Boolean := True;
-- Loop Back mode
TX : FDCAN_TEST_TX_Field := 16#0#;
-- Read-only. Control of Transmit Pin
RX : 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 FDCAN_TEST_Register use record
Reserved_0_3 at 0 range 0 .. 3;
LBCK at 0 range 4 .. 4;
TX at 0 range 5 .. 6;
RX at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype FDCAN_RWD_WDC_Field is HAL.UInt8;
subtype FDCAN_RWD_WDV_Field is HAL.UInt8;
-- FDCAN RAM Watchdog Register
type FDCAN_RWD_Register is record
-- Watchdog configuration
WDC : FDCAN_RWD_WDC_Field := 16#0#;
-- Read-only. Watchdog value
WDV : FDCAN_RWD_WDV_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_RWD_Register use record
WDC at 0 range 0 .. 7;
WDV at 0 range 8 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- FDCAN CC Control Register
type FDCAN_CCCR_Register is record
-- Initialization
INIT : Boolean := True;
-- Configuration Change Enable
CCE : Boolean := False;
-- ASM Restricted Operation Mode
ASM : Boolean := False;
-- Clock Stop Acknowledge
CSA : Boolean := False;
-- Clock Stop Request
CSR : Boolean := False;
-- Bus Monitoring Mode
MON : Boolean := False;
-- Disable Automatic Retransmission
DAR : Boolean := False;
-- Test Mode Enable
TEST : Boolean := False;
-- FD Operation Enable
FDOE : Boolean := False;
-- FDCAN Bit Rate Switching
BSE : Boolean := False;
-- unspecified
Reserved_10_11 : HAL.UInt2 := 16#0#;
-- Protocol Exception Handling Disable
PXHD : Boolean := False;
-- Edge Filtering during Bus Integration
EFBI : Boolean := False;
-- TXP
TXP : Boolean := False;
-- Non ISO Operation
NISO : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_CCCR_Register use record
INIT at 0 range 0 .. 0;
CCE at 0 range 1 .. 1;
ASM at 0 range 2 .. 2;
CSA at 0 range 3 .. 3;
CSR at 0 range 4 .. 4;
MON at 0 range 5 .. 5;
DAR at 0 range 6 .. 6;
TEST at 0 range 7 .. 7;
FDOE at 0 range 8 .. 8;
BSE at 0 range 9 .. 9;
Reserved_10_11 at 0 range 10 .. 11;
PXHD at 0 range 12 .. 12;
EFBI at 0 range 13 .. 13;
TXP at 0 range 14 .. 14;
NISO at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FDCAN_NBTP_TSEG2_Field is HAL.UInt7;
subtype FDCAN_NBTP_NTSEG1_Field is HAL.UInt8;
subtype FDCAN_NBTP_NBRP_Field is HAL.UInt9;
subtype FDCAN_NBTP_NSJW_Field is HAL.UInt7;
-- FDCAN Nominal Bit Timing and Prescaler Register
type FDCAN_NBTP_Register is record
-- Nominal Time segment after sample point
TSEG2 : FDCAN_NBTP_TSEG2_Field := 16#3#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Nominal Time segment before sample point
NTSEG1 : FDCAN_NBTP_NTSEG1_Field := 16#A#;
-- Bit Rate Prescaler
NBRP : FDCAN_NBTP_NBRP_Field := 16#0#;
-- NSJW: Nominal (Re)Synchronization Jump Width
NSJW : FDCAN_NBTP_NSJW_Field := 16#3#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_NBTP_Register use record
TSEG2 at 0 range 0 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
NTSEG1 at 0 range 8 .. 15;
NBRP at 0 range 16 .. 24;
NSJW at 0 range 25 .. 31;
end record;
subtype FDCAN_TSCC_TSS_Field is HAL.UInt2;
subtype FDCAN_TSCC_TCP_Field is HAL.UInt4;
-- FDCAN Timestamp Counter Configuration Register
type FDCAN_TSCC_Register is record
-- Timestamp Select
TSS : FDCAN_TSCC_TSS_Field := 16#0#;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Timestamp Counter Prescaler
TCP : FDCAN_TSCC_TCP_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TSCC_Register use record
TSS at 0 range 0 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
TCP at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
subtype FDCAN_TSCV_TSC_Field is HAL.UInt16;
-- FDCAN Timestamp Counter Value Register
type FDCAN_TSCV_Register is record
-- Timestamp Counter
TSC : FDCAN_TSCV_TSC_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TSCV_Register use record
TSC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FDCAN_TOCC_TOS_Field is HAL.UInt2;
subtype FDCAN_TOCC_TOP_Field is HAL.UInt16;
-- FDCAN Timeout Counter Configuration Register
type FDCAN_TOCC_Register is record
-- Enable Timeout Counter
ETOC : Boolean := False;
-- Timeout Select
TOS : FDCAN_TOCC_TOS_Field := 16#0#;
-- unspecified
Reserved_3_15 : HAL.UInt13 := 16#0#;
-- Timeout Period
TOP : FDCAN_TOCC_TOP_Field := 16#FFFF#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TOCC_Register use record
ETOC at 0 range 0 .. 0;
TOS at 0 range 1 .. 2;
Reserved_3_15 at 0 range 3 .. 15;
TOP at 0 range 16 .. 31;
end record;
subtype FDCAN_TOCV_TOC_Field is HAL.UInt16;
-- FDCAN Timeout Counter Value Register
type FDCAN_TOCV_Register is record
-- Timeout Counter
TOC : FDCAN_TOCV_TOC_Field := 16#FFFF#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TOCV_Register use record
TOC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FDCAN_ECR_TEC_Field is HAL.UInt8;
subtype FDCAN_ECR_REC_Field is HAL.UInt7;
subtype FDCAN_ECR_CEL_Field is HAL.UInt8;
-- FDCAN Error Counter Register
type FDCAN_ECR_Register is record
-- Read-only. Transmit Error Counter
TEC : FDCAN_ECR_TEC_Field := 16#0#;
-- Read-only. Receive Error Counter
REC : FDCAN_ECR_REC_Field := 16#0#;
-- Receive Error Passive
RP : Boolean := False;
-- AN Error Logging
CEL : FDCAN_ECR_CEL_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_ECR_Register use record
TEC at 0 range 0 .. 7;
REC at 0 range 8 .. 14;
RP at 0 range 15 .. 15;
CEL at 0 range 16 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FDCAN_PSR_LEC_Field is HAL.UInt3;
subtype FDCAN_PSR_ACT_Field is HAL.UInt2;
subtype FDCAN_PSR_DLEC_Field is HAL.UInt3;
subtype FDCAN_PSR_TDCV_Field is HAL.UInt7;
-- FDCAN Protocol Status Register
type FDCAN_PSR_Register is record
-- Last Error Code
LEC : FDCAN_PSR_LEC_Field := 16#7#;
-- Read-only. Activity
ACT : FDCAN_PSR_ACT_Field := 16#0#;
-- Read-only. Error Passive
EP : Boolean := False;
-- Read-only. Warning Status
EW : Boolean := False;
-- Read-only. Bus_Off Status
BO : Boolean := False;
-- Data Last Error Code
DLEC : FDCAN_PSR_DLEC_Field := 16#7#;
-- ESI flag of last received FDCAN Message
RESI : Boolean := False;
-- BRS flag of last received FDCAN Message
RBRS : Boolean := False;
-- Received FDCAN Message
REDL : Boolean := False;
-- Protocol Exception Event
PXE : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Read-only. Transmitter Delay Compensation Value
TDCV : FDCAN_PSR_TDCV_Field := 16#0#;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_PSR_Register use record
LEC at 0 range 0 .. 2;
ACT at 0 range 3 .. 4;
EP at 0 range 5 .. 5;
EW at 0 range 6 .. 6;
BO at 0 range 7 .. 7;
DLEC at 0 range 8 .. 10;
RESI at 0 range 11 .. 11;
RBRS at 0 range 12 .. 12;
REDL at 0 range 13 .. 13;
PXE at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
TDCV at 0 range 16 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
subtype FDCAN_TDCR_TDCF_Field is HAL.UInt7;
subtype FDCAN_TDCR_TDCO_Field is HAL.UInt7;
-- FDCAN Transmitter Delay Compensation Register
type FDCAN_TDCR_Register is record
-- Transmitter Delay Compensation Filter Window Length
TDCF : FDCAN_TDCR_TDCF_Field := 16#0#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Transmitter Delay Compensation Offset
TDCO : FDCAN_TDCR_TDCO_Field := 16#0#;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TDCR_Register use record
TDCF at 0 range 0 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
TDCO at 0 range 8 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- FDCAN Interrupt Register
type FDCAN_IR_Register is record
-- RF0N
RF0N : Boolean := False;
-- RF0F
RF0F : Boolean := False;
-- RF0L
RF0L : Boolean := False;
-- RF1N
RF1N : Boolean := False;
-- RF1F
RF1F : Boolean := False;
-- RF1L
RF1L : Boolean := False;
-- HPM
HPM : Boolean := False;
-- TC
TC : Boolean := False;
-- TCF
TCF : Boolean := False;
-- TFE
TFE : Boolean := False;
-- TEFN
TEFN : Boolean := False;
-- TEFF
TEFF : Boolean := False;
-- TEFL
TEFL : Boolean := False;
-- TSW
TSW : Boolean := False;
-- MRAF
MRAF : Boolean := False;
-- TOO
TOO : Boolean := False;
-- ELO
ELO : Boolean := False;
-- EP
EP : Boolean := False;
-- EW
EW : Boolean := False;
-- BO
BO : Boolean := False;
-- WDI
WDI : Boolean := False;
-- PEA
PEA : Boolean := False;
-- PED
PED : Boolean := False;
-- ARA
ARA : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_IR_Register use record
RF0N at 0 range 0 .. 0;
RF0F at 0 range 1 .. 1;
RF0L at 0 range 2 .. 2;
RF1N at 0 range 3 .. 3;
RF1F at 0 range 4 .. 4;
RF1L at 0 range 5 .. 5;
HPM at 0 range 6 .. 6;
TC at 0 range 7 .. 7;
TCF at 0 range 8 .. 8;
TFE at 0 range 9 .. 9;
TEFN at 0 range 10 .. 10;
TEFF at 0 range 11 .. 11;
TEFL at 0 range 12 .. 12;
TSW at 0 range 13 .. 13;
MRAF at 0 range 14 .. 14;
TOO at 0 range 15 .. 15;
ELO at 0 range 16 .. 16;
EP at 0 range 17 .. 17;
EW at 0 range 18 .. 18;
BO at 0 range 19 .. 19;
WDI at 0 range 20 .. 20;
PEA at 0 range 21 .. 21;
PED at 0 range 22 .. 22;
ARA at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- FDCAN Interrupt Enable Register
type FDCAN_IE_Register is record
-- Rx FIFO 0 New Message Enable
RF0NE : Boolean := False;
-- Rx FIFO 0 Full Enable
RF0FE : Boolean := False;
-- Rx FIFO 0 Message Lost Enable
RF0LE : Boolean := False;
-- Rx FIFO 1 New Message Enable
RF1NE : Boolean := False;
-- Rx FIFO 1 Watermark Reached Enable
RF1FE : Boolean := False;
-- Rx FIFO 1 Message Lost Enable
RF1LE : Boolean := False;
-- High Priority Message Enable
HPME : Boolean := False;
-- Transmission Completed Enable
TCE : Boolean := False;
-- Transmission Cancellation Finished Enable
TCFE : Boolean := False;
-- Tx FIFO Empty Enable
TEFE : Boolean := False;
-- Tx Event FIFO New Entry Enable
TEFNE : Boolean := False;
-- Tx Event FIFO Full Enable
TEFFE : Boolean := False;
-- Tx Event FIFO Element Lost Enable
TEFLE : Boolean := False;
-- Message RAM Access Failure Enable
MRAFE : Boolean := False;
-- Timeout Occurred Enable
TOOE : Boolean := False;
-- Error Logging Overflow Enable
ELOE : Boolean := False;
-- Error Passive Enable
EPE : Boolean := False;
-- Warning Status Enable
EWE : Boolean := False;
-- Bus_Off Status Enable
BOE : Boolean := False;
-- Watchdog Interrupt Enable
WDIE : Boolean := False;
-- Protocol Error in Arbitration Phase Enable
PEAE : Boolean := False;
-- Protocol Error in Data Phase Enable
PEDE : Boolean := False;
-- Access to Reserved Address Enable
ARAE : Boolean := False;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_IE_Register use record
RF0NE at 0 range 0 .. 0;
RF0FE at 0 range 1 .. 1;
RF0LE at 0 range 2 .. 2;
RF1NE at 0 range 3 .. 3;
RF1FE at 0 range 4 .. 4;
RF1LE at 0 range 5 .. 5;
HPME at 0 range 6 .. 6;
TCE at 0 range 7 .. 7;
TCFE at 0 range 8 .. 8;
TEFE at 0 range 9 .. 9;
TEFNE at 0 range 10 .. 10;
TEFFE at 0 range 11 .. 11;
TEFLE at 0 range 12 .. 12;
MRAFE at 0 range 13 .. 13;
TOOE at 0 range 14 .. 14;
ELOE at 0 range 15 .. 15;
EPE at 0 range 16 .. 16;
EWE at 0 range 17 .. 17;
BOE at 0 range 18 .. 18;
WDIE at 0 range 19 .. 19;
PEAE at 0 range 20 .. 20;
PEDE at 0 range 21 .. 21;
ARAE at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- FDCAN_ILS_RxFIFO array
type FDCAN_ILS_RxFIFO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for FDCAN_ILS_RxFIFO
type FDCAN_ILS_RxFIFO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RxFIFO as a value
Val : HAL.UInt2;
when True =>
-- RxFIFO as an array
Arr : FDCAN_ILS_RxFIFO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for FDCAN_ILS_RxFIFO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- FDCAN Interrupt Line Select Register
type FDCAN_ILS_Register is record
-- RxFIFO0
RxFIFO : FDCAN_ILS_RxFIFO_Field :=
(As_Array => False, Val => 16#0#);
-- SMSG
SMSG : Boolean := False;
-- TFERR
TFERR : Boolean := False;
-- MISC
MISC : Boolean := False;
-- BERR
BERR : Boolean := False;
-- PERR
PERR : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_ILS_Register use record
RxFIFO at 0 range 0 .. 1;
SMSG at 0 range 2 .. 2;
TFERR at 0 range 3 .. 3;
MISC at 0 range 4 .. 4;
BERR at 0 range 5 .. 5;
PERR at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- FDCAN_ILE_EINT array
type FDCAN_ILE_EINT_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for FDCAN_ILE_EINT
type FDCAN_ILE_EINT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- EINT as a value
Val : HAL.UInt2;
when True =>
-- EINT as an array
Arr : FDCAN_ILE_EINT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for FDCAN_ILE_EINT_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- FDCAN Interrupt Line Enable Register
type FDCAN_ILE_Register is record
-- Enable Interrupt Line 0
EINT : FDCAN_ILE_EINT_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_ILE_Register use record
EINT at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype FDCAN_RXGFC_ANFE_Field is HAL.UInt2;
subtype FDCAN_RXGFC_ANFS_Field is HAL.UInt2;
subtype FDCAN_RXGFC_LSS_Field is HAL.UInt5;
subtype FDCAN_RXGFC_LSE_Field is HAL.UInt4;
-- FDCAN Global Filter Configuration Register
type FDCAN_RXGFC_Register is record
-- Reject Remote Frames Extended
RRFE : Boolean := False;
-- Reject Remote Frames Standard
RRFS : Boolean := False;
-- Accept Non-matching Frames Extended
ANFE : FDCAN_RXGFC_ANFE_Field := 16#0#;
-- Accept Non-matching Frames Standard
ANFS : FDCAN_RXGFC_ANFS_Field := 16#0#;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- F1OM
F1OM : Boolean := False;
-- F0OM
F0OM : Boolean := False;
-- unspecified
Reserved_10_15 : HAL.UInt6 := 16#0#;
-- LSS
LSS : FDCAN_RXGFC_LSS_Field := 16#0#;
-- unspecified
Reserved_21_23 : HAL.UInt3 := 16#0#;
-- LSE
LSE : FDCAN_RXGFC_LSE_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 FDCAN_RXGFC_Register use record
RRFE at 0 range 0 .. 0;
RRFS at 0 range 1 .. 1;
ANFE at 0 range 2 .. 3;
ANFS at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
F1OM at 0 range 8 .. 8;
F0OM at 0 range 9 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
LSS at 0 range 16 .. 20;
Reserved_21_23 at 0 range 21 .. 23;
LSE at 0 range 24 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype FDCAN_XIDAM_EIDM_Field is HAL.UInt29;
-- FDCAN Extended ID and Mask Register
type FDCAN_XIDAM_Register is record
-- Extended ID Mask
EIDM : FDCAN_XIDAM_EIDM_Field := 16#1FFFFFFF#;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_XIDAM_Register use record
EIDM at 0 range 0 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype FDCAN_HPMS_BIDX_Field is HAL.UInt3;
subtype FDCAN_HPMS_MSI_Field is HAL.UInt2;
subtype FDCAN_HPMS_FIDX_Field is HAL.UInt5;
-- FDCAN High Priority Message Status Register
type FDCAN_HPMS_Register is record
-- Read-only. Buffer Index
BIDX : FDCAN_HPMS_BIDX_Field;
-- unspecified
Reserved_3_5 : HAL.UInt3;
-- Read-only. Message Storage Indicator
MSI : FDCAN_HPMS_MSI_Field;
-- Read-only. Filter Index
FIDX : FDCAN_HPMS_FIDX_Field;
-- unspecified
Reserved_13_14 : HAL.UInt2;
-- Read-only. Filter List
FLST : Boolean;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_HPMS_Register use record
BIDX at 0 range 0 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
MSI at 0 range 6 .. 7;
FIDX at 0 range 8 .. 12;
Reserved_13_14 at 0 range 13 .. 14;
FLST at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FDCAN_RXF0S_F0FL_Field is HAL.UInt4;
subtype FDCAN_RXF0S_F0GI_Field is HAL.UInt2;
subtype FDCAN_RXF0S_F0PI_Field is HAL.UInt2;
-- FDCAN Rx FIFO 0 Status Register
type FDCAN_RXF0S_Register is record
-- Rx FIFO 0 Fill Level
F0FL : FDCAN_RXF0S_F0FL_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Rx FIFO 0 Get Index
F0GI : FDCAN_RXF0S_F0GI_Field := 16#0#;
-- unspecified
Reserved_10_15 : HAL.UInt6 := 16#0#;
-- Rx FIFO 0 Put Index
F0PI : FDCAN_RXF0S_F0PI_Field := 16#0#;
-- unspecified
Reserved_18_23 : HAL.UInt6 := 16#0#;
-- Rx FIFO 0 Full
F0F : Boolean := False;
-- Rx FIFO 0 Message Lost
RF0L : Boolean := False;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_RXF0S_Register use record
F0FL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
F0GI at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
F0PI at 0 range 16 .. 17;
Reserved_18_23 at 0 range 18 .. 23;
F0F at 0 range 24 .. 24;
RF0L at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype FDCAN_RXF0A_F0AI_Field is HAL.UInt3;
-- CAN Rx FIFO 0 Acknowledge Register
type FDCAN_RXF0A_Register is record
-- Rx FIFO 0 Acknowledge Index
F0AI : FDCAN_RXF0A_F0AI_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_RXF0A_Register use record
F0AI at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_RXF1S_F1FL_Field is HAL.UInt4;
subtype FDCAN_RXF1S_F1GI_Field is HAL.UInt2;
subtype FDCAN_RXF1S_F1PI_Field is HAL.UInt2;
-- FDCAN Rx FIFO 1 Status Register
type FDCAN_RXF1S_Register is record
-- Rx FIFO 1 Fill Level
F1FL : FDCAN_RXF1S_F1FL_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Read-only. Rx FIFO 1 Get Index
F1GI : FDCAN_RXF1S_F1GI_Field := 16#0#;
-- unspecified
Reserved_10_15 : HAL.UInt6 := 16#0#;
-- Read-only. Rx FIFO 1 Put Index
F1PI : FDCAN_RXF1S_F1PI_Field := 16#0#;
-- unspecified
Reserved_18_23 : HAL.UInt6 := 16#0#;
-- Read-only. Rx FIFO 1 Full
F1F : Boolean := False;
-- Read-only. Rx FIFO 1 Message Lost
RF1L : Boolean := False;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_RXF1S_Register use record
F1FL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
F1GI at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
F1PI at 0 range 16 .. 17;
Reserved_18_23 at 0 range 18 .. 23;
F1F at 0 range 24 .. 24;
RF1L at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype FDCAN_RXF1A_F1AI_Field is HAL.UInt3;
-- FDCAN Rx FIFO 1 Acknowledge Register
type FDCAN_RXF1A_Register is record
-- Rx FIFO 1 Acknowledge Index
F1AI : FDCAN_RXF1A_F1AI_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_RXF1A_Register use record
F1AI at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- FDCAN Tx buffer configuration register
type FDCAN_TXBC_Register is record
-- unspecified
Reserved_0_23 : HAL.UInt24 := 16#0#;
-- Tx FIFO/Queue Mode
TFQM : Boolean := False;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBC_Register use record
Reserved_0_23 at 0 range 0 .. 23;
TFQM at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype FDCAN_TXFQS_TFFL_Field is HAL.UInt3;
subtype FDCAN_TXFQS_TFGI_Field is HAL.UInt2;
subtype FDCAN_TXFQS_TFQPI_Field is HAL.UInt2;
-- FDCAN Tx FIFO/Queue Status Register
type FDCAN_TXFQS_Register is record
-- Read-only. Tx FIFO Free Level
TFFL : FDCAN_TXFQS_TFFL_Field;
-- unspecified
Reserved_3_7 : HAL.UInt5;
-- Read-only. TFGI
TFGI : FDCAN_TXFQS_TFGI_Field;
-- unspecified
Reserved_10_15 : HAL.UInt6;
-- Read-only. Tx FIFO/Queue Put Index
TFQPI : FDCAN_TXFQS_TFQPI_Field;
-- unspecified
Reserved_18_20 : HAL.UInt3;
-- Read-only. Tx FIFO/Queue Full
TFQF : Boolean;
-- unspecified
Reserved_22_31 : HAL.UInt10;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXFQS_Register use record
TFFL at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
TFGI at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
TFQPI at 0 range 16 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
TFQF at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype FDCAN_TXBRP_TRP_Field is HAL.UInt3;
-- FDCAN Tx Buffer Request Pending Register
type FDCAN_TXBRP_Register is record
-- Read-only. Transmission Request Pending
TRP : FDCAN_TXBRP_TRP_Field;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBRP_Register use record
TRP at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBAR_AR_Field is HAL.UInt3;
-- FDCAN Tx Buffer Add Request Register
type FDCAN_TXBAR_Register is record
-- Add Request
AR : FDCAN_TXBAR_AR_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBAR_Register use record
AR at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBCR_CR_Field is HAL.UInt3;
-- FDCAN Tx Buffer Cancellation Request Register
type FDCAN_TXBCR_Register is record
-- Cancellation Request
CR : FDCAN_TXBCR_CR_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBCR_Register use record
CR at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBTO_TO_Field is HAL.UInt3;
-- FDCAN Tx Buffer Transmission Occurred Register
type FDCAN_TXBTO_Register is record
-- Read-only. Transmission Occurred.
TO : FDCAN_TXBTO_TO_Field;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBTO_Register use record
TO at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBCF_CF_Field is HAL.UInt3;
-- FDCAN Tx Buffer Cancellation Finished Register
type FDCAN_TXBCF_Register is record
-- Read-only. Cancellation Finished
CF : FDCAN_TXBCF_CF_Field;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBCF_Register use record
CF at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBTIE_TIE_Field is HAL.UInt3;
-- FDCAN Tx Buffer Transmission Interrupt Enable Register
type FDCAN_TXBTIE_Register is record
-- Transmission Interrupt Enable
TIE : FDCAN_TXBTIE_TIE_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBTIE_Register use record
TIE at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXBCIE_CF_Field is HAL.UInt3;
-- FDCAN Tx Buffer Cancellation Finished Interrupt Enable Register
type FDCAN_TXBCIE_Register is record
-- Cancellation Finished Interrupt Enable
CF : FDCAN_TXBCIE_CF_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXBCIE_Register use record
CF at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FDCAN_TXEFS_EFFL_Field is HAL.UInt3;
subtype FDCAN_TXEFS_EFGI_Field is HAL.UInt2;
subtype FDCAN_TXEFS_EFPI_Field is HAL.UInt2;
-- FDCAN Tx Event FIFO Status Register
type FDCAN_TXEFS_Register is record
-- Read-only. Event FIFO Fill Level
EFFL : FDCAN_TXEFS_EFFL_Field;
-- unspecified
Reserved_3_7 : HAL.UInt5;
-- Read-only. Event FIFO Get Index.
EFGI : FDCAN_TXEFS_EFGI_Field;
-- unspecified
Reserved_10_15 : HAL.UInt6;
-- Read-only. Event FIFO Put Index
EFPI : FDCAN_TXEFS_EFPI_Field;
-- unspecified
Reserved_18_23 : HAL.UInt6;
-- Read-only. Event FIFO Full.
EFF : Boolean;
-- Read-only. Tx Event FIFO Element Lost.
TEFL : Boolean;
-- unspecified
Reserved_26_31 : HAL.UInt6;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXEFS_Register use record
EFFL at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
EFGI at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
EFPI at 0 range 16 .. 17;
Reserved_18_23 at 0 range 18 .. 23;
EFF at 0 range 24 .. 24;
TEFL at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype FDCAN_TXEFA_EFAI_Field is HAL.UInt2;
-- FDCAN Tx Event FIFO Acknowledge Register
type FDCAN_TXEFA_Register is record
-- Event FIFO Acknowledge Index
EFAI : FDCAN_TXEFA_EFAI_Field := 16#0#;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_TXEFA_Register use record
EFAI at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype FDCAN_CKDIV_PDIV_Field is HAL.UInt4;
-- FDCAN TT Trigger Memory Configuration Register
type FDCAN_CKDIV_Register is record
-- PDIV
PDIV : FDCAN_CKDIV_PDIV_Field := 16#0#;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FDCAN_CKDIV_Register use record
PDIV at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- FDCAN1
type FDCAN_Peripheral is record
-- FDCAN Core Release Register
FDCAN_CREL : aliased FDCAN_CREL_Register;
-- FDCAN Core Release Register
FDCAN_ENDN : aliased HAL.UInt32;
-- FDCAN Data Bit Timing and Prescaler Register
FDCAN_DBTP : aliased FDCAN_DBTP_Register;
-- FDCAN Test Register
FDCAN_TEST : aliased FDCAN_TEST_Register;
-- FDCAN RAM Watchdog Register
FDCAN_RWD : aliased FDCAN_RWD_Register;
-- FDCAN CC Control Register
FDCAN_CCCR : aliased FDCAN_CCCR_Register;
-- FDCAN Nominal Bit Timing and Prescaler Register
FDCAN_NBTP : aliased FDCAN_NBTP_Register;
-- FDCAN Timestamp Counter Configuration Register
FDCAN_TSCC : aliased FDCAN_TSCC_Register;
-- FDCAN Timestamp Counter Value Register
FDCAN_TSCV : aliased FDCAN_TSCV_Register;
-- FDCAN Timeout Counter Configuration Register
FDCAN_TOCC : aliased FDCAN_TOCC_Register;
-- FDCAN Timeout Counter Value Register
FDCAN_TOCV : aliased FDCAN_TOCV_Register;
-- FDCAN Error Counter Register
FDCAN_ECR : aliased FDCAN_ECR_Register;
-- FDCAN Protocol Status Register
FDCAN_PSR : aliased FDCAN_PSR_Register;
-- FDCAN Transmitter Delay Compensation Register
FDCAN_TDCR : aliased FDCAN_TDCR_Register;
-- FDCAN Interrupt Register
FDCAN_IR : aliased FDCAN_IR_Register;
-- FDCAN Interrupt Enable Register
FDCAN_IE : aliased FDCAN_IE_Register;
-- FDCAN Interrupt Line Select Register
FDCAN_ILS : aliased FDCAN_ILS_Register;
-- FDCAN Interrupt Line Enable Register
FDCAN_ILE : aliased FDCAN_ILE_Register;
-- FDCAN Global Filter Configuration Register
FDCAN_RXGFC : aliased FDCAN_RXGFC_Register;
-- FDCAN Extended ID and Mask Register
FDCAN_XIDAM : aliased FDCAN_XIDAM_Register;
-- FDCAN High Priority Message Status Register
FDCAN_HPMS : aliased FDCAN_HPMS_Register;
-- FDCAN Rx FIFO 0 Status Register
FDCAN_RXF0S : aliased FDCAN_RXF0S_Register;
-- CAN Rx FIFO 0 Acknowledge Register
FDCAN_RXF0A : aliased FDCAN_RXF0A_Register;
-- FDCAN Rx FIFO 1 Status Register
FDCAN_RXF1S : aliased FDCAN_RXF1S_Register;
-- FDCAN Rx FIFO 1 Acknowledge Register
FDCAN_RXF1A : aliased FDCAN_RXF1A_Register;
-- FDCAN Tx buffer configuration register
FDCAN_TXBC : aliased FDCAN_TXBC_Register;
-- FDCAN Tx FIFO/Queue Status Register
FDCAN_TXFQS : aliased FDCAN_TXFQS_Register;
-- FDCAN Tx Buffer Request Pending Register
FDCAN_TXBRP : aliased FDCAN_TXBRP_Register;
-- FDCAN Tx Buffer Add Request Register
FDCAN_TXBAR : aliased FDCAN_TXBAR_Register;
-- FDCAN Tx Buffer Cancellation Request Register
FDCAN_TXBCR : aliased FDCAN_TXBCR_Register;
-- FDCAN Tx Buffer Transmission Occurred Register
FDCAN_TXBTO : aliased FDCAN_TXBTO_Register;
-- FDCAN Tx Buffer Cancellation Finished Register
FDCAN_TXBCF : aliased FDCAN_TXBCF_Register;
-- FDCAN Tx Buffer Transmission Interrupt Enable Register
FDCAN_TXBTIE : aliased FDCAN_TXBTIE_Register;
-- FDCAN Tx Buffer Cancellation Finished Interrupt Enable Register
FDCAN_TXBCIE : aliased FDCAN_TXBCIE_Register;
-- FDCAN Tx Event FIFO Status Register
FDCAN_TXEFS : aliased FDCAN_TXEFS_Register;
-- FDCAN Tx Event FIFO Acknowledge Register
FDCAN_TXEFA : aliased FDCAN_TXEFA_Register;
-- FDCAN TT Trigger Memory Configuration Register
FDCAN_CKDIV : aliased FDCAN_CKDIV_Register;
end record
with Volatile;
for FDCAN_Peripheral use record
FDCAN_CREL at 16#0# range 0 .. 31;
FDCAN_ENDN at 16#4# range 0 .. 31;
FDCAN_DBTP at 16#C# range 0 .. 31;
FDCAN_TEST at 16#10# range 0 .. 31;
FDCAN_RWD at 16#14# range 0 .. 31;
FDCAN_CCCR at 16#18# range 0 .. 31;
FDCAN_NBTP at 16#1C# range 0 .. 31;
FDCAN_TSCC at 16#20# range 0 .. 31;
FDCAN_TSCV at 16#24# range 0 .. 31;
FDCAN_TOCC at 16#28# range 0 .. 31;
FDCAN_TOCV at 16#2C# range 0 .. 31;
FDCAN_ECR at 16#40# range 0 .. 31;
FDCAN_PSR at 16#44# range 0 .. 31;
FDCAN_TDCR at 16#48# range 0 .. 31;
FDCAN_IR at 16#50# range 0 .. 31;
FDCAN_IE at 16#54# range 0 .. 31;
FDCAN_ILS at 16#58# range 0 .. 31;
FDCAN_ILE at 16#5C# range 0 .. 31;
FDCAN_RXGFC at 16#80# range 0 .. 31;
FDCAN_XIDAM at 16#84# range 0 .. 31;
FDCAN_HPMS at 16#88# range 0 .. 31;
FDCAN_RXF0S at 16#90# range 0 .. 31;
FDCAN_RXF0A at 16#94# range 0 .. 31;
FDCAN_RXF1S at 16#98# range 0 .. 31;
FDCAN_RXF1A at 16#9C# range 0 .. 31;
FDCAN_TXBC at 16#C0# range 0 .. 31;
FDCAN_TXFQS at 16#C4# range 0 .. 31;
FDCAN_TXBRP at 16#C8# range 0 .. 31;
FDCAN_TXBAR at 16#CC# range 0 .. 31;
FDCAN_TXBCR at 16#D0# range 0 .. 31;
FDCAN_TXBTO at 16#D4# range 0 .. 31;
FDCAN_TXBCF at 16#D8# range 0 .. 31;
FDCAN_TXBTIE at 16#DC# range 0 .. 31;
FDCAN_TXBCIE at 16#E0# range 0 .. 31;
FDCAN_TXEFS at 16#E4# range 0 .. 31;
FDCAN_TXEFA at 16#E8# range 0 .. 31;
FDCAN_CKDIV at 16#100# range 0 .. 31;
end record;
-- FDCAN1
FDCAN1_Periph : aliased FDCAN_Peripheral
with Import, Address => System'To_Address (16#4000A400#);
-- FDCAN1
SEC_FDCAN1_Periph : aliased FDCAN_Peripheral
with Import, Address => System'To_Address (16#5000A400#);
end STM32_SVD.FDCAN;
|
-- Motherlode
-- Copyright (c) 2020 Fabien Chouteau
package Motherload is
procedure Run;
end Motherload;
|
-- AOC 2020, Day 4
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers; use Ada.Containers;
with Day; use Day;
procedure main is
batch : constant Passport_Vectors.Vector := load_batch("input.txt");
present : constant Count_Type := present_count(batch);
valid : constant Count_Type := valid_count(batch);
begin
put_line("Part 1: " & Count_Type'Image(present));
put_line("Part 2: " & Count_Type'Image(valid));
end main;
|
with
ada.Calendar;
package collada.Asset
--
-- Models a collada asset.
--
is
type Contributor is
record
Author : Text;
authoring_Tool : Text;
end record;
type Unit is
record
Name : Text;
Meter : Float;
end record;
type up_Direction is (X_up, Y_up, Z_up);
type Item is
record
Contributor : asset.Contributor;
Created : ada.Calendar.Time;
Modified : ada.Calendar.Time;
Unit : asset.Unit;
up_Axis : up_Direction;
end record;
end collada.Asset;
|
package body agar.gui.widget.scrollbar is
use type c.int;
package cbinds is
procedure set_size
(scrollbar : scrollbar_access_t;
size : c.int);
pragma import (c, set_size, "agar_gui_widget_scrollbar_set_size");
function get_size (scrollbar : scrollbar_access_t) return c.int;
pragma import (c, get_size, "agar_gui_widget_scrollbar_get_size");
function visible (scrollbar : scrollbar_access_t) return c.int;
pragma import (c, visible, "AG_ScrollbarVisible");
procedure set_int_increment
(scrollbar : scrollbar_access_t;
increment : c.int);
pragma import (c, set_int_increment, "AG_ScrollbarSetIntIncrement");
procedure set_real_increment
(scrollbar : scrollbar_access_t;
increment : c.double);
pragma import (c, set_real_increment, "AG_ScrollbarSetRealIncrement");
end cbinds;
procedure set_size
(scrollbar : scrollbar_access_t;
size : natural) is
begin
cbinds.set_size
(scrollbar => scrollbar,
size => c.int (size));
end set_size;
function get_size (scrollbar : scrollbar_access_t) return natural is
begin
return natural (cbinds.get_size (scrollbar));
end get_size;
function visible (scrollbar : scrollbar_access_t) return boolean is
begin
return cbinds.visible (scrollbar) = 1;
end visible;
procedure set_increment
(scrollbar : scrollbar_access_t;
increment : positive) is
begin
cbinds.set_int_increment
(scrollbar => scrollbar,
increment => c.int (increment));
end set_increment;
procedure set_increment
(scrollbar : scrollbar_access_t;
increment : long_float) is
begin
cbinds.set_real_increment
(scrollbar => scrollbar,
increment => c.double (increment));
end set_increment;
function widget (scrollbar : scrollbar_access_t) return widget_access_t is
begin
return scrollbar.widget'access;
end widget;
end agar.gui.widget.scrollbar;
|
-- --
-- package Object.Tasking Copyright (c) Dmitry A. Kazakov --
-- Implementation Luebeck --
-- Winter, 2009 --
-- Multiple tasking version --
-- Last revision : 10:33 11 May 2019 --
-- --
-- This library 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 2 of --
-- the License, 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. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. --
--____________________________________________________________________--
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Tags; use Ada.Tags;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
package body Object is
Decrement_Error : exception;
protected Lock is
procedure Decrement
( Object : in out Entity'Class;
New_Value : out Natural
);
procedure Increment (Object : in out Entity'Class);
private
pragma Inline (Decrement);
pragma Inline (Increment);
end Lock;
protected body Lock is
procedure Decrement
( Object : in out Entity'Class;
New_Value : out Natural
) is
begin
if Object.Use_Count = 0 then
raise Decrement_Error;
else
Object.Use_Count := Object.Use_Count - 1;
New_Value := Object.Use_Count;
end if;
end Decrement;
procedure Increment (Object : in out Entity'Class) is
begin
Object.Use_Count := Object.Use_Count + 1;
end Increment;
end Lock;
function Equal
( Left : Entity;
Right : Entity'Class;
Flag : Boolean := False
) return Boolean is
begin
if Flag or else Right in Entity then
return Left'Address = Right'Address;
else
return Equal (Right, Left, True);
end if;
end Equal;
procedure Finalize (Object : in out Entity) is
begin
if 0 /= Object.Use_Count then
Raise_Exception
( Program_Error'Identity,
( Ada.Tags.Expanded_Name (Entity'Class (Object)'Tag)
& " is still in use"
) );
end if;
end Finalize;
procedure Decrement_Count
( Object : in out Entity;
Use_Count : out Natural
) is
begin
Lock.Decrement (Object, Use_Count);
exception
when Decrement_Error =>
Raise_Exception
( Program_Error'Identity,
( Ada.Tags.Expanded_Name (Entity'Class (Object)'Tag)
& " has zero count"
) );
end Decrement_Count;
procedure Increment_Count (Object : in out Entity) is
begin
Lock.Increment (Object);
end Increment_Count;
procedure Initialize (Object : in out Entity) is
begin
null;
end Initialize;
function Less
( Left : Entity;
Right : Entity'Class;
Flag : Boolean := False
) return Boolean is
begin
if Flag or else Right in Entity then
return Left'Address < Right'Address;
else
return not ( Less (Right, Left, True)
or else
Equal (Right, Left, True)
);
end if;
end Less;
procedure Put_Traceback (Object : Entity'Class) is
begin
null;
end Put_Traceback;
procedure Release (Ptr : in out Entity_Ptr) is
procedure Free is new
Ada.Unchecked_Deallocation (Entity'Class, Entity_Ptr);
begin
if Ptr /= null then
declare
Object : Entity'Class renames Ptr.all;
Count : Natural;
begin
Decrement_Count (Object, Count);
if Count > 0 then
return;
end if;
end;
Free (Ptr);
end if;
end Release;
procedure Set_Trace_File (File : String) is
begin
null;
end Set_Trace_File;
end Object;
|
with MSPGD.UART.Peripheral;
with MSPGD.Clock; use MSPGD.Clock;
with MSPGD.Clock.Source;
package Board is
pragma Preelaborate;
package Clock is new MSPGD.Clock.Source (Source => SMCLK, Input => DCO, Frequency => 8_000_000);
package UART is new MSPGD.UART.Peripheral (Speed => 9600, Clock => Clock);
procedure Init;
end Board;
|
generic
type Item is private;
type View is access all Item;
pool_Size : Positive := 5_000;
package lace.fast_Pool
is
function new_Item return View;
procedure free (Self : in out View);
end lace.fast_Pool;
|
-- CD1C03I.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE RECORD SIZE AND THE COMPONENT POSITIONS AND
-- SIZES OF A DERIVED RECORD TYPE ARE INHERITED FROM THE
-- PARENT IF THOSE ASPECTS OF THE PARENT WERE DETERMINED BY THE
-- PRAGMA PACK.
-- HISTORY:
-- JET 09/17/87 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE CD1C03I IS
TYPE E_TYPE IS (RED, BLUE, GREEN);
TYPE PARENT_TYPE IS
RECORD
B1: BOOLEAN := TRUE;
I : INTEGER RANGE 0 .. 127 := 127;
C : CHARACTER := 'S';
B2: BOOLEAN := FALSE;
E : E_TYPE := BLUE;
END RECORD;
PRAGMA PACK (PARENT_TYPE);
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
P_REC : PARENT_TYPE;
REC : DERIVED_TYPE;
BEGIN
TEST("CD1C03I", "CHECK THAT THE RECORD SIZE AND THE COMPONENT " &
"POSITIONS AND SIZES OF A DERIVED RECORD " &
"TYPE ARE INHERITED FROM THE PARENT IF THOSE " &
"ASPECTS OF THE PARENT WERE DETERMINED BY " &
"THE PRAGMA PACK");
IF DERIVED_TYPE'SIZE /= PARENT_TYPE'SIZE THEN
FAILED ("DERIVED_TYPE'SIZE WAS NOT INHERITED FROM " &
"PARENT_TYPE");
END IF;
IF REC.I'SIZE /= P_REC.I'SIZE OR
REC.C'SIZE /= P_REC.C'SIZE OR
REC.B1'SIZE /= P_REC.B1'SIZE OR
REC.B2'SIZE /= P_REC.B2'SIZE OR
REC.E'SIZE /= P_REC.E'SIZE THEN
FAILED ("THE SIZES OF DERIVED_TYPE ELEMENTS WERE NOT " &
"INHERITED FROM PARENT_TYPE");
END IF;
REC := (FALSE, 12, 'T', TRUE, RED);
IF (REC.I /= 12) OR (REC.C /= 'T') OR
REC.B1 OR (NOT REC.B2) OR (REC.E /= RED) THEN
FAILED ("THE VALUES OF DERIVED_TYPE COMPONENTS WERE " &
"INCORRECT");
END IF;
IF REC.I'POSITION /= P_REC.I'POSITION OR
REC.C'POSITION /= P_REC.C'POSITION OR
REC.B1'POSITION /= P_REC.B1'POSITION OR
REC.B2'POSITION /= P_REC.B2'POSITION OR
REC.E'POSITION /= P_REC.E'POSITION THEN
FAILED ("THE POSITIONS OF DERIVED_TYPE COMPONENTS WERE " &
"NOT INHERITED FROM PARENT_TYPE");
END IF;
IF REC.I'FIRST_BIT /= P_REC.I'FIRST_BIT OR
REC.C'FIRST_BIT /= P_REC.C'FIRST_BIT OR
REC.B1'FIRST_BIT /= P_REC.B1'FIRST_BIT OR
REC.B2'FIRST_BIT /= P_REC.B2'FIRST_BIT OR
REC.E'FIRST_BIT /= P_REC.E'FIRST_BIT THEN
FAILED ("THE FIRST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
"NOT INHERITED FROM PARENT_TYPE");
END IF;
IF REC.I'LAST_BIT /= P_REC.I'LAST_BIT OR
REC.C'LAST_BIT /= P_REC.C'LAST_BIT OR
REC.B1'LAST_BIT /= P_REC.B1'LAST_BIT OR
REC.B2'LAST_BIT /= P_REC.B2'LAST_BIT OR
REC.E'LAST_BIT /= P_REC.E'LAST_BIT THEN
FAILED ("THE LAST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
"NOT INHERITED FROM PARENT_TYPE");
END IF;
RESULT;
END CD1C03I;
|
--------------------------------------------------------
-- E n c o d i n g s --
-- --
-- Tools for convertion strings between Unicode and --
-- national/vendor character sets. --
-- - - - - - - - - - --
-- Read copyright and license at the end of this file --
--------------------------------------------------------
with Ada.Strings.Maps;
with Ada.Strings.Fixed;
with Ada.Characters.Handling;
with Encodings.Maps.Linked;
package body Encodings is
------------
-- Decode --
------------
function Decode
(Text : Raw_String;
Map : Encoding)
return Wide_String
is
Text_Last : Natural;
Result_Last : Natural;
Result : Wide_String (Text'Range);
begin
Decode (Text, Text_Last, Result, Result_Last, Map);
if Text_Last /= Text'Last then
raise Invalid_Encoding;
end if;
return Result (Result'First .. Result_Last);
end Decode;
------------
-- Decode --
------------
procedure Decode
(Text : in Raw_String;
Text_Last : out Natural;
Result : out Wide_String;
Result_Last : out Natural;
Map : in Encoding)
is
begin
if Map = Unknown then
raise Invalid_Encoding;
elsif Decoder_List (Map) = null then
if Decoder_List (Unknown) = null then
raise Invalid_Encoding;
else
Decoder_List (Unknown).all
(Text, Text_Last, Result, Result_Last, Map);
end if;
else
Decoder_List (Map).all (Text, Text_Last, Result, Result_Last, Map);
end if;
end Decode;
------------
-- Encode --
------------
function Encode
(Text : Wide_String;
Map : Encoding)
return Raw_String
is
Text_Last : Natural;
Result_Last : Natural;
Result : Raw_String (1 .. 3 * Text'Length);
begin
Encode (Text, Text_Last, Result, Result_Last, Map);
if Text_Last /= Text'Last then
raise Invalid_Encoding;
end if;
return Result (Result'First .. Result_Last);
end Encode;
------------
-- Encode --
------------
procedure Encode
(Text : in Wide_String;
Text_Last : out Natural;
Result : out Raw_String;
Result_Last : out Natural;
Map : in Encoding)
is
begin
if Map = Unknown then
raise Invalid_Encoding;
elsif Encoder_List (Map) = null then
if Encoder_List (Unknown) = null then
raise Invalid_Encoding;
else
Encoder_List (Unknown).all
(Text, Text_Last, Result, Result_Last, Map);
end if;
else
Encoder_List (Map).all (Text, Text_Last, Result, Result_Last, Map);
end if;
end Encode;
-----------------
-- To_Encoding --
-----------------
Dash_To_Underscore : constant Ada.Strings.Maps.Character_Mapping :=
Ada.Strings.Maps.To_Mapping ("-", "_");
function To_Encoding (Name : String) return Encoding is
use Ada.Strings.Fixed;
use Ada.Characters.Handling;
function Fix (Name : String) return String is
begin
if Index (Name, "WINDOWS") = Name'First then
return Replace_Slice (Name, Name'First, Name'First + 6, "CP");
else
return Name;
end if;
end Fix;
Upper : constant String :=
Fix (Translate (To_Upper (Name), Dash_To_Underscore));
Result : Encoding;
begin
Result := Encoding'Value (Upper);
return Result;
exception
when Constraint_Error =>
raise Invalid_Encoding;
end To_Encoding;
end Encodings;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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 Maxim Reznik, 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 OWNER 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.
------------------------------------------------------------------------------
|
-- original: http://homepage2.nifty.com/m_kamada/math/gmp_ja.htm
with Ada.Command_Line;
with Ada.Real_Time;
with Ada.Text_IO;
with C.gmp;
procedure pi is
use type Ada.Real_Time.Time;
use C;
use C.gmp;
-- Function: void mpf_pi (mpf_t rop)
-- Set the value of pi.
--
-- Reference:
-- http://www.kurims.kyoto-u.ac.jp/~ooura/pi_fft-j.html
--
-- ---- a formula based on the AGM (Arithmetic-Geometric Mean) ----
-- c = sqrt(0.125);
-- a = 1 + 3 * c;
-- b = sqrt(a);
-- e = b - 0.625;
-- b = 2 * b;
-- c = e - c;
-- a = a + e;
-- npow = 4;
-- do {
-- npow = 2 * npow;
-- e = (a + b) / 2;
-- b = sqrt(a * b);
-- e = e - b;
-- b = 2 * b;
-- c = c - e;
-- a = e + b;
-- } while (e > SQRT_SQRT_EPSILON);
-- e = e * e / 4;
-- a = a + b;
-- pi = (a * a - e - e / 2) / (a * c - e) / npow;
-- ---- modification ----
-- This is a modified version of Gauss-Legendre formula
-- (by T.Ooura). It is faster than original version.
procedure mpf_pi (a : in out mpf_t) is
prec : mp_bitcnt_t;
SQRT_SQRT_EPSILON, c, b, e : mpf_t;
log2_npow : unsigned_long;
begin
prec := mpf_get_prec (a (0)'Access);
mpf_init2 (SQRT_SQRT_EPSILON (0)'Access, prec);
mpf_init2 (c (0)'Access, prec);
mpf_init2 (b (0)'Access, prec);
mpf_init2 (e (0)'Access, prec);
mpf_set_ui (SQRT_SQRT_EPSILON (0)'Access, 1);
mpf_div_2exp (
SQRT_SQRT_EPSILON (0)'Access,
SQRT_SQRT_EPSILON (0)'Access,
prec - 4);
-- c = sqrt(0.125);
mpf_set_d (c (0)'Access, 0.125);
mpf_sqrt (c (0)'Access, c (0)'Access);
-- a = 1 + 3 * c;
mpf_mul_ui (a (0)'Access, c (0)'Access, 3);
mpf_add_ui (a (0)'Access, a (0)'Access, 1);
-- b = sqrt(a);
mpf_sqrt (b (0)'Access, a (0)'Access);
-- e = b - 0.625;
mpf_set_d (e (0)'Access, 0.625);
mpf_sub (e (0)'Access, b (0)'Access, e (0)'Access);
-- b = 2 * b;
mpf_add (b (0)'Access, b (0)'Access, b (0)'Access);
-- c = e - c;
mpf_sub (c (0)'Access, e (0)'Access, c (0)'Access);
-- a = a + e;
mpf_add (a (0)'Access, a (0)'Access, e (0)'Access);
-- npow = 4;
log2_npow := 2;
loop
-- npow = 2 * npow;
log2_npow := log2_npow + 1;
-- e = (a + b) / 2;
mpf_add (e (0)'Access, a (0)'Access, b (0)'Access);
mpf_div_2exp (e (0)'Access, e (0)'Access, 1);
-- b = sqrt(a * b);
mpf_mul (b (0)'Access, a (0)'Access, b (0)'Access);
mpf_sqrt (b (0)'Access, b (0)'Access);
-- e = e - b;
mpf_sub (e (0)'Access, e (0)'Access, b (0)'Access);
-- b = 2 * b;
mpf_add (b (0)'Access, b (0)'Access, b (0)'Access);
-- c = c - e;
mpf_sub (c (0)'Access, c (0)'Access, e (0)'Access);
-- a = e + b;
mpf_add (a (0)'Access, e (0)'Access, b (0)'Access);
-- e > SQRT_SQRT_EPSILON
exit when not (mpf_cmp (e (0)'Access, SQRT_SQRT_EPSILON (0)'Access) > 0);
end loop;
-- e = e * e / 4;
mpf_mul (e (0)'Access, e (0)'Access, e (0)'Access);
mpf_div_2exp (e (0)'Access, e (0)'Access, 2);
-- a = a + b;
mpf_add (a (0)'Access, a (0)'Access, b (0)'Access);
-- pi = (a * a - e - e / 2) / (a * c - e) / npow;
mpf_mul (c (0)'Access, c (0)'Access, a (0)'Access);
mpf_sub (c (0)'Access, c (0)'Access, e (0)'Access);
mpf_mul (a (0)'Access, a (0)'Access, a (0)'Access);
mpf_sub (a (0)'Access, a (0)'Access, e (0)'Access);
mpf_div_2exp (e (0)'Access, e (0)'Access, 1);
mpf_sub (a (0)'Access, a (0)'Access, e (0)'Access);
mpf_div (a (0)'Access, a (0)'Access, c (0)'Access);
mpf_div_2exp (a (0)'Access, a (0)'Access, log2_npow);
mpf_clear (e (0)'Access);
mpf_clear (b (0)'Access);
mpf_clear (c (0)'Access);
mpf_clear (SQRT_SQRT_EPSILON (0)'Access);
end mpf_pi;
LOG_2_10 : constant := 3.32192809488736234787031942949;
output : Integer := 1;
prec10 : mp_bitcnt_t := 100;
pi : mpf_t;
start, stop : Ada.Real_Time.Time;
begin
begin
if Ada.Command_Line.Argument_Count in 1 .. 2 then
if Ada.Command_Line.Argument_Count = 2 then
output := Integer'Value (Ada.Command_Line.Argument (2));
end if;
prec10 := mp_bitcnt_t'Value (Ada.Command_Line.Argument (1));
if prec10 < 10 then
prec10 := 10;
end if;
else
raise Constraint_Error;
end if;
exception
when Constraint_Error =>
Ada.Text_IO.Put_Line (
"usage: " & Ada.Command_Line.Command_Name
& " precision(10-) output-flag(0-1)");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end;
mpf_init2 (
pi (0)'Access,
mp_bitcnt_t (Long_Long_Float (2 + prec10) * LOG_2_10 + 1.0));
stop := Ada.Real_Time.Clock;
loop
start := Ada.Real_Time.Clock;
exit when start /= stop;
end loop;
mpf_pi (pi);
stop := Ada.Real_Time.Clock;
Ada.Text_IO.Put_Line (
Duration'Image (Ada.Real_Time.To_Duration (stop - start)) & " sec.");
if output /= 0 then
declare
fmt : C.char_array := "%.*Ff" & C.char'Val (10) & C.char'Val (0);
begin
gmp_printf (fmt (0)'Access, C.size_t (prec10), pi (0)'Access);
end;
stop := Ada.Real_Time.Clock;
Ada.Text_IO.Put_Line (
Duration'Image (Ada.Real_Time.To_Duration (stop - start)) & " sec.");
end if;
mpf_clear (pi (0)'Access);
end pi;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, 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 System; use System;
package STM32.Eth is
procedure Initialize_RMII;
-- Initialize the driver using RMII configuration.
procedure Read_MMI (Reg : UInt5; Val : out Unsigned_16);
-- Read an MMI register.
procedure Init_Mac;
-- Initialize MAC layer.
procedure Start_Rx;
procedure Wait_Packet;
type TDES0_Type is record
Own : Bit;
Ic : Bit;
Ls : Bit;
Fs : Bit;
Dc : Bit;
Dp : Bit;
Ttse : Bit;
Reserved_1 : Bit;
Cic : UInt2;
Ter : Bit;
Tch : Bit;
Reserved_2 : UInt2;
Ttss : Bit;
Ihe : Bit;
Es : Bit;
Jt : Bit;
Ff : Bit;
Ipe : Bit;
Lca : Bit;
Nc : Bit;
Lco : Bit;
Ec : Bit;
Vf : Bit;
Cc : UInt4;
Ed : Bit;
Uf : Bit;
Db : Bit;
end record;
for TDES0_Type use record
Own at 0 range 31 .. 31;
Ic at 0 range 30 .. 30;
Ls at 0 range 29 .. 29;
Fs at 0 range 28 .. 28;
Dc at 0 range 27 .. 27;
Dp at 0 range 26 .. 26;
Ttse at 0 range 25 .. 25;
Reserved_1 at 0 range 24 .. 24;
Cic at 0 range 22 .. 23;
Ter at 0 range 21 .. 21;
Tch at 0 range 20 .. 20;
Reserved_2 at 0 range 18 .. 19;
Ttss at 0 range 17 .. 17;
Ihe at 0 range 16 .. 16;
Es at 0 range 15 .. 15;
Jt at 0 range 14 .. 14;
Ff at 0 range 13 .. 13;
Ipe at 0 range 12 .. 12;
Lca at 0 range 11 .. 11;
Nc at 0 range 10 .. 10;
Lco at 0 range 9 .. 9;
Ec at 0 range 8 .. 8;
Vf at 0 range 7 .. 7;
Cc at 0 range 3 .. 6;
Ed at 0 range 2 .. 2;
Uf at 0 range 1 .. 1;
Db at 0 range 0 .. 0;
end record;
type TDES1_Type is record
Tbs1 : UInt13;
Reserved_13_15 : UInt3;
Tbs2 : UInt13;
Reserved_29_31 : UInt3;
end record;
for TDES1_Type use record
Tbs1 at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
Tbs2 at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
type Tx_Desc_Type is record
Tdes0 : TDES0_Type;
Tdes1 : TDES1_Type;
Tdes2 : Address;
Tdes3 : Address;
end record;
for Tx_Desc_Type use record
Tdes0 at 0 range 0 .. 31;
Tdes1 at 4 range 0 .. 31;
Tdes2 at 8 range 0 .. 31;
Tdes3 at 12 range 0 .. 31;
end record;
type Rdes0_Type is record
Pce_Esa : Bit;
Ce : Bit;
Dre : Bit;
Re : Bit;
Rwt : Bit;
Ft : Bit;
Lco : Bit;
Iphce : Bit;
Ls : Bit;
Fs : Bit;
Vlan : Bit;
Oe : Bit;
Le : Bit;
Saf : Bit;
De : Bit;
Es : Bit;
Fl : UInt14;
Afm : Bit;
Own : Bit;
end record;
for Rdes0_Type use record
Pce_Esa at 0 range 0 .. 0;
Ce at 0 range 1 .. 1;
Dre at 0 range 2 .. 2;
Re at 0 range 3 .. 3;
Rwt at 0 range 4 .. 4;
Ft at 0 range 5 .. 5;
Lco at 0 range 6 .. 6;
Iphce at 0 range 7 .. 7;
Ls at 0 range 8 .. 8;
Fs at 0 range 9 .. 9;
Vlan at 0 range 10 .. 10;
Oe at 0 range 11 .. 11;
Le at 0 range 12 .. 12;
Saf at 0 range 13 .. 13;
De at 0 range 14 .. 14;
Es at 0 range 15 .. 15;
Fl at 0 range 16 .. 29;
Afm at 0 range 30 .. 30;
Own at 0 range 31 .. 31;
end record;
type Rdes1_Type is record
Rbs : UInt13;
Reserved_13 : Bit;
Rch : Bit;
Rer : Bit;
Rbs2 : UInt13;
Reserved_29_30 : UInt2;
Dic : Bit;
end record;
for Rdes1_Type use record
Rbs at 0 range 0 .. 12;
Reserved_13 at 0 range 13 .. 13;
Rch at 0 range 14 .. 14;
Rer at 0 range 15 .. 15;
Rbs2 at 0 range 16 .. 28;
Reserved_29_30 at 0 range 29 .. 30;
Dic at 0 range 31 .. 31;
end record;
type Rx_Desc_Type is record
Rdes0 : Rdes0_Type;
Rdes1 : Rdes1_Type;
Rdes2 : UInt32;
Rdes3 : UInt32;
end record;
for Rx_Desc_Type use record
Rdes0 at 0 range 0 .. 31;
Rdes1 at 4 range 0 .. 31;
Rdes2 at 8 range 0 .. 31;
Rdes3 at 12 range 0 .. 31;
end record;
end STM32.Eth;
|
-----------------------------------------------------------------------
-- are-generator-go -- Generator for Go
-- Copyright (C) 2021 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
private with Util.Strings.Vectors;
-- == Go Generator ==
-- The Go code generator produces for each resource description a Go
-- source file with the name of that resource. The header
-- contains the public declaration and the C source file contains the generated
-- files with an optional function that allows to query
-- and retrieve the file content. The C code generator is driven by the
-- resource description and also by the tool options.
--
-- The Go source file declares a structure that describes the content information.
-- The structure is declared public so that it is visible outside the Go package.
-- It gives access to the content, its size,
-- the modification time of the file and the target file format.
--
-- type Content struct {
-- Content []byte
-- Size int64
-- Modtime int64
-- Format int
-- }
--
-- This type definition gives access to a binary content and provides
-- enough information to also indicate the size of that content. Then when
-- the `--name-access` option is passed, the code generator declares and
-- implements the following function:
--
-- func Get_content(name string) (*Content)
--
-- That function will return either a pointer to the resource description
-- or null if the name was not found.
--
-- When the `--list-access` option is passed, the Go code generator
-- makes available the list of names by making the `Names` variable public:
--
-- var Names= []string {
-- ...
-- }
--
-- The generated array gives access to the list of file names embedded in
-- the resource. That list is sorted on the name so that a dichotomic
-- search can be used to find an entry.
--
private package Are.Generator.Go is
type Generator_Type is new Are.Generator.Generator_Type with private;
-- Generate the Go code for the resources that have been collected.
overriding
procedure Generate (Generator : in out Generator_Type;
Resources : in Resource_List;
Context : in out Are.Context_Type'Class);
-- Setup the command line configuration to accept specific generation options.
overriding
procedure Setup (Generator : in out Generator_Type;
Config : in out GC.Command_Line_Configuration) is null;
private
type Generator_Type is new Are.Generator.Generator_Type with record
Names : Util.Strings.Vectors.Vector;
end record;
-- Generate the source file.
procedure Generate_Source (Generator : in out Generator_Type;
Resource : in Are.Resource_Type;
Context : in out Are.Context_Type'Class);
end Are.Generator.Go;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.NUMERICS.GENERIC_REAL_ARRAYS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2020, 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 version of Generic_Real_Arrays avoids the use of BLAS and LAPACK. One
-- reason for this is new Ada 2012 requirements that prohibit algorithms such
-- as Strassen's algorithm, which may be used by some BLAS implementations. In
-- addition, some platforms lacked suitable compilers to compile the reference
-- BLAS/LAPACK implementation. Finally, on some platforms there are more
-- floating point types than supported by BLAS/LAPACK.
with Ada.Containers.Generic_Anonymous_Array_Sort; use Ada.Containers;
with System; use System;
with System.Generic_Array_Operations; use System.Generic_Array_Operations;
package body Ada.Numerics.Generic_Real_Arrays is
package Ops renames System.Generic_Array_Operations;
function Is_Non_Zero (X : Real'Base) return Boolean is (X /= 0.0);
procedure Back_Substitute is new Ops.Back_Substitute
(Scalar => Real'Base,
Matrix => Real_Matrix,
Is_Non_Zero => Is_Non_Zero);
function Diagonal is new Ops.Diagonal
(Scalar => Real'Base,
Vector => Real_Vector,
Matrix => Real_Matrix);
procedure Forward_Eliminate is new Ops.Forward_Eliminate
(Scalar => Real'Base,
Real => Real'Base,
Matrix => Real_Matrix,
Zero => 0.0,
One => 1.0);
procedure Swap_Column is new Ops.Swap_Column
(Scalar => Real'Base,
Matrix => Real_Matrix);
procedure Transpose is new Ops.Transpose
(Scalar => Real'Base,
Matrix => Real_Matrix);
function Is_Symmetric (A : Real_Matrix) return Boolean is
(Transpose (A) = A);
-- Return True iff A is symmetric, see RM G.3.1 (90).
function Is_Tiny (Value, Compared_To : Real) return Boolean is
(abs Compared_To + 100.0 * abs (Value) = abs Compared_To);
-- Return True iff the Value is much smaller in magnitude than the least
-- significant digit of Compared_To.
procedure Jacobi
(A : Real_Matrix;
Values : out Real_Vector;
Vectors : out Real_Matrix;
Compute_Vectors : Boolean := True);
-- Perform Jacobi's eigensystem algorithm on real symmetric matrix A
function Length is new Square_Matrix_Length (Real'Base, Real_Matrix);
-- Helper function that raises a Constraint_Error is the argument is
-- not a square matrix, and otherwise returns its length.
procedure Rotate (X, Y : in out Real; Sin, Tau : Real);
-- Perform a Givens rotation
procedure Sort_Eigensystem
(Values : in out Real_Vector;
Vectors : in out Real_Matrix);
-- Sort Values and associated Vectors by decreasing absolute value
procedure Swap (Left, Right : in out Real);
-- Exchange Left and Right
function Sqrt is new Ops.Sqrt (Real);
-- Instant a generic square root implementation here, in order to avoid
-- instantiating a complete copy of Generic_Elementary_Functions.
-- Speed of the square root is not a big concern here.
------------
-- Rotate --
------------
procedure Rotate (X, Y : in out Real; Sin, Tau : Real) is
Old_X : constant Real := X;
Old_Y : constant Real := Y;
begin
X := Old_X - Sin * (Old_Y + Old_X * Tau);
Y := Old_Y + Sin * (Old_X - Old_Y * Tau);
end Rotate;
----------
-- Swap --
----------
procedure Swap (Left, Right : in out Real) is
Temp : constant Real := Left;
begin
Left := Right;
Right := Temp;
end Swap;
-- Instantiating the following subprograms directly would lead to
-- name clashes, so use a local package.
package Instantiations is
function "+" is new
Vector_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "+");
function "+" is new
Matrix_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "+");
function "+" is new
Vector_Vector_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Right_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "+");
function "+" is new
Matrix_Matrix_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Matrix => Real_Matrix,
Right_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "+");
function "-" is new
Vector_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "-");
function "-" is new
Matrix_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "-");
function "-" is new
Vector_Vector_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Right_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "-");
function "-" is new
Matrix_Matrix_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Matrix => Real_Matrix,
Right_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "-");
function "*" is new
Scalar_Vector_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Right_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "*");
function "*" is new
Scalar_Matrix_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Right_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "*");
function "*" is new
Vector_Scalar_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "*");
function "*" is new
Matrix_Scalar_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "*");
function "*" is new
Outer_Product
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Right_Vector => Real_Vector,
Matrix => Real_Matrix);
function "*" is new
Inner_Product
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Right_Vector => Real_Vector,
Zero => 0.0);
function "*" is new
Matrix_Vector_Product
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Matrix => Real_Matrix,
Right_Vector => Real_Vector,
Result_Vector => Real_Vector,
Zero => 0.0);
function "*" is new
Vector_Matrix_Product
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Matrix => Real_Matrix,
Result_Vector => Real_Vector,
Zero => 0.0);
function "*" is new
Matrix_Matrix_Product
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Matrix => Real_Matrix,
Right_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Zero => 0.0);
function "/" is new
Vector_Scalar_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "/");
function "/" is new
Matrix_Scalar_Elementwise_Operation
(Left_Scalar => Real'Base,
Right_Scalar => Real'Base,
Result_Scalar => Real'Base,
Left_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "/");
function "abs" is new
L2_Norm
(X_Scalar => Real'Base,
Result_Real => Real'Base,
X_Vector => Real_Vector,
"abs" => "+");
-- While the L2_Norm by definition uses the absolute values of the
-- elements of X_Vector, for real values the subsequent squaring
-- makes this unnecessary, so we substitute the "+" identity function
-- instead.
function "abs" is new
Vector_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Vector => Real_Vector,
Result_Vector => Real_Vector,
Operation => "abs");
function "abs" is new
Matrix_Elementwise_Operation
(X_Scalar => Real'Base,
Result_Scalar => Real'Base,
X_Matrix => Real_Matrix,
Result_Matrix => Real_Matrix,
Operation => "abs");
function Solve is new
Matrix_Vector_Solution (Real'Base, 0.0, Real_Vector, Real_Matrix);
function Solve is new
Matrix_Matrix_Solution (Real'Base, 0.0, Real_Matrix);
function Unit_Matrix is new
Generic_Array_Operations.Unit_Matrix
(Scalar => Real'Base,
Matrix => Real_Matrix,
Zero => 0.0,
One => 1.0);
function Unit_Vector is new
Generic_Array_Operations.Unit_Vector
(Scalar => Real'Base,
Vector => Real_Vector,
Zero => 0.0,
One => 1.0);
end Instantiations;
---------
-- "+" --
---------
function "+" (Right : Real_Vector) return Real_Vector
renames Instantiations."+";
function "+" (Right : Real_Matrix) return Real_Matrix
renames Instantiations."+";
function "+" (Left, Right : Real_Vector) return Real_Vector
renames Instantiations."+";
function "+" (Left, Right : Real_Matrix) return Real_Matrix
renames Instantiations."+";
---------
-- "-" --
---------
function "-" (Right : Real_Vector) return Real_Vector
renames Instantiations."-";
function "-" (Right : Real_Matrix) return Real_Matrix
renames Instantiations."-";
function "-" (Left, Right : Real_Vector) return Real_Vector
renames Instantiations."-";
function "-" (Left, Right : Real_Matrix) return Real_Matrix
renames Instantiations."-";
---------
-- "*" --
---------
-- Scalar multiplication
function "*" (Left : Real'Base; Right : Real_Vector) return Real_Vector
renames Instantiations."*";
function "*" (Left : Real_Vector; Right : Real'Base) return Real_Vector
renames Instantiations."*";
function "*" (Left : Real'Base; Right : Real_Matrix) return Real_Matrix
renames Instantiations."*";
function "*" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix
renames Instantiations."*";
-- Vector multiplication
function "*" (Left, Right : Real_Vector) return Real'Base
renames Instantiations."*";
function "*" (Left, Right : Real_Vector) return Real_Matrix
renames Instantiations."*";
function "*" (Left : Real_Vector; Right : Real_Matrix) return Real_Vector
renames Instantiations."*";
function "*" (Left : Real_Matrix; Right : Real_Vector) return Real_Vector
renames Instantiations."*";
-- Matrix Multiplication
function "*" (Left, Right : Real_Matrix) return Real_Matrix
renames Instantiations."*";
---------
-- "/" --
---------
function "/" (Left : Real_Vector; Right : Real'Base) return Real_Vector
renames Instantiations."/";
function "/" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix
renames Instantiations."/";
-----------
-- "abs" --
-----------
function "abs" (Right : Real_Vector) return Real'Base
renames Instantiations."abs";
function "abs" (Right : Real_Vector) return Real_Vector
renames Instantiations."abs";
function "abs" (Right : Real_Matrix) return Real_Matrix
renames Instantiations."abs";
-----------------
-- Determinant --
-----------------
function Determinant (A : Real_Matrix) return Real'Base is
M : Real_Matrix := A;
B : Real_Matrix (A'Range (1), 1 .. 0);
R : Real'Base;
begin
Forward_Eliminate (M, B, R);
return R;
end Determinant;
-----------------
-- Eigensystem --
-----------------
procedure Eigensystem
(A : Real_Matrix;
Values : out Real_Vector;
Vectors : out Real_Matrix)
is
begin
Jacobi (A, Values, Vectors, Compute_Vectors => True);
Sort_Eigensystem (Values, Vectors);
end Eigensystem;
-----------------
-- Eigenvalues --
-----------------
function Eigenvalues (A : Real_Matrix) return Real_Vector is
begin
return Values : Real_Vector (A'Range (1)) do
declare
Vectors : Real_Matrix (1 .. 0, 1 .. 0);
begin
Jacobi (A, Values, Vectors, Compute_Vectors => False);
Sort_Eigensystem (Values, Vectors);
end;
end return;
end Eigenvalues;
-------------
-- Inverse --
-------------
function Inverse (A : Real_Matrix) return Real_Matrix is
(Solve (A, Unit_Matrix (Length (A),
First_1 => A'First (2),
First_2 => A'First (1))));
------------
-- Jacobi --
------------
procedure Jacobi
(A : Real_Matrix;
Values : out Real_Vector;
Vectors : out Real_Matrix;
Compute_Vectors : Boolean := True)
is
-- This subprogram uses Carl Gustav Jacob Jacobi's iterative method
-- for computing eigenvalues and eigenvectors and is based on
-- Rutishauser's implementation.
-- The given real symmetric matrix is transformed iteratively to
-- diagonal form through a sequence of appropriately chosen elementary
-- orthogonal transformations, called Jacobi rotations here.
-- The Jacobi method produces a systematic decrease of the sum of the
-- squares of off-diagonal elements. Convergence to zero is quadratic,
-- both for this implementation, as for the classic method that doesn't
-- use row-wise scanning for pivot selection.
-- The numerical stability and accuracy of Jacobi's method make it the
-- best choice here, even though for large matrices other methods will
-- be significantly more efficient in both time and space.
-- While the eigensystem computations are absolutely foolproof for all
-- real symmetric matrices, in presence of invalid values, or similar
-- exceptional situations it might not. In such cases the results cannot
-- be trusted and Constraint_Error is raised.
-- Note: this implementation needs temporary storage for 2 * N + N**2
-- values of type Real.
Max_Iterations : constant := 50;
N : constant Natural := Length (A);
subtype Square_Matrix is Real_Matrix (1 .. N, 1 .. N);
-- In order to annihilate the M (Row, Col) element, the
-- rotation parameters Cos and Sin are computed as
-- follows:
-- Theta = Cot (2.0 * Phi)
-- = (Diag (Col) - Diag (Row)) / (2.0 * M (Row, Col))
-- Then Tan (Phi) as the smaller root (in modulus) of
-- T**2 + 2 * T * Theta = 1 (or 0.5 / Theta, if Theta is large)
function Compute_Tan (Theta : Real) return Real is
(Real'Copy_Sign (1.0 / (abs Theta + Sqrt (1.0 + Theta**2)), Theta));
function Compute_Tan (P, H : Real) return Real is
(if Is_Tiny (P, Compared_To => H) then P / H
else Compute_Tan (Theta => H / (2.0 * P)));
pragma Annotate
(CodePeer, False_Positive, "divide by zero", "H, P /= 0");
function Sum_Strict_Upper (M : Square_Matrix) return Real;
-- Return the sum of all elements in the strict upper triangle of M
----------------------
-- Sum_Strict_Upper --
----------------------
function Sum_Strict_Upper (M : Square_Matrix) return Real is
Sum : Real := 0.0;
begin
for Row in 1 .. N - 1 loop
for Col in Row + 1 .. N loop
Sum := Sum + abs M (Row, Col);
end loop;
end loop;
return Sum;
end Sum_Strict_Upper;
M : Square_Matrix := A; -- Work space for solving eigensystem
Threshold : Real;
Sum : Real;
Diag : Real_Vector (1 .. N);
Diag_Adj : Real_Vector (1 .. N);
-- The vector Diag_Adj indicates the amount of change in each value,
-- while Diag tracks the value itself and Values holds the values as
-- they were at the beginning. As the changes typically will be small
-- compared to the absolute value of Diag, at the end of each iteration
-- Diag is computed as Diag + Diag_Adj thus avoiding accumulating
-- rounding errors. This technique is due to Rutishauser.
begin
if Compute_Vectors
and then (Vectors'Length (1) /= N or else Vectors'Length (2) /= N)
then
raise Constraint_Error with "incompatible matrix dimensions";
elsif Values'Length /= N then
raise Constraint_Error with "incompatible vector length";
elsif not Is_Symmetric (M) then
raise Constraint_Error with "matrix not symmetric";
end if;
-- Note: Only the locally declared matrix M and vectors (Diag, Diag_Adj)
-- have lower bound equal to 1. The Vectors matrix may have
-- different bounds, so take care indexing elements. Assignment
-- as a whole is fine as sliding is automatic in that case.
Vectors := (if not Compute_Vectors then (1 .. 0 => (1 .. 0 => 0.0))
else Unit_Matrix (Vectors'Length (1), Vectors'Length (2)));
Values := Diagonal (M);
Sweep : for Iteration in 1 .. Max_Iterations loop
-- The first three iterations, perform rotation for any non-zero
-- element. After this, rotate only for those that are not much
-- smaller than the average off-diagnal element. After the fifth
-- iteration, additionally zero out off-diagonal elements that are
-- very small compared to elements on the diagonal with the same
-- column or row index.
Sum := Sum_Strict_Upper (M);
exit Sweep when Sum = 0.0;
Threshold := (if Iteration < 4 then 0.2 * Sum / Real (N**2) else 0.0);
-- Iterate over all off-diagonal elements, rotating any that have
-- an absolute value that exceeds the threshold.
Diag := Values;
Diag_Adj := (others => 0.0); -- Accumulates adjustments to Diag
for Row in 1 .. N - 1 loop
for Col in Row + 1 .. N loop
-- If, before the rotation M (Row, Col) is tiny compared to
-- Diag (Row) and Diag (Col), rotation is skipped. This is
-- meaningful, as it produces no larger error than would be
-- produced anyhow if the rotation had been performed.
-- Suppress this optimization in the first four sweeps, so
-- that this procedure can be used for computing eigenvectors
-- of perturbed diagonal matrices.
if Iteration > 4
and then Is_Tiny (M (Row, Col), Compared_To => Diag (Row))
and then Is_Tiny (M (Row, Col), Compared_To => Diag (Col))
then
M (Row, Col) := 0.0;
elsif abs M (Row, Col) > Threshold then
Perform_Rotation : declare
Tan : constant Real := Compute_Tan (M (Row, Col),
Diag (Col) - Diag (Row));
Cos : constant Real := 1.0 / Sqrt (1.0 + Tan**2);
Sin : constant Real := Tan * Cos;
Tau : constant Real := Sin / (1.0 + Cos);
Adj : constant Real := Tan * M (Row, Col);
begin
Diag_Adj (Row) := Diag_Adj (Row) - Adj;
Diag_Adj (Col) := Diag_Adj (Col) + Adj;
Diag (Row) := Diag (Row) - Adj;
Diag (Col) := Diag (Col) + Adj;
M (Row, Col) := 0.0;
for J in 1 .. Row - 1 loop -- 1 <= J < Row
Rotate (M (J, Row), M (J, Col), Sin, Tau);
end loop;
for J in Row + 1 .. Col - 1 loop -- Row < J < Col
Rotate (M (Row, J), M (J, Col), Sin, Tau);
end loop;
for J in Col + 1 .. N loop -- Col < J <= N
Rotate (M (Row, J), M (Col, J), Sin, Tau);
end loop;
for J in Vectors'Range (1) loop
Rotate (Vectors (J, Row - 1 + Vectors'First (2)),
Vectors (J, Col - 1 + Vectors'First (2)),
Sin, Tau);
end loop;
end Perform_Rotation;
end if;
end loop;
end loop;
Values := Values + Diag_Adj;
end loop Sweep;
-- All normal matrices with valid values should converge perfectly.
if Sum /= 0.0 then
raise Constraint_Error with "eigensystem solution does not converge";
end if;
end Jacobi;
-----------
-- Solve --
-----------
function Solve (A : Real_Matrix; X : Real_Vector) return Real_Vector
renames Instantiations.Solve;
function Solve (A, X : Real_Matrix) return Real_Matrix
renames Instantiations.Solve;
----------------------
-- Sort_Eigensystem --
----------------------
procedure Sort_Eigensystem
(Values : in out Real_Vector;
Vectors : in out Real_Matrix)
is
procedure Swap (Left, Right : Integer);
-- Swap Values (Left) with Values (Right), and also swap the
-- corresponding eigenvectors. Note that lowerbounds may differ.
function Less (Left, Right : Integer) return Boolean is
(Values (Left) > Values (Right));
-- Sort by decreasing eigenvalue, see RM G.3.1 (76).
procedure Sort is new Generic_Anonymous_Array_Sort (Integer);
-- Sorts eigenvalues and eigenvectors by decreasing value
procedure Swap (Left, Right : Integer) is
begin
Swap (Values (Left), Values (Right));
Swap_Column (Vectors, Left - Values'First + Vectors'First (2),
Right - Values'First + Vectors'First (2));
end Swap;
begin
Sort (Values'First, Values'Last);
end Sort_Eigensystem;
---------------
-- Transpose --
---------------
function Transpose (X : Real_Matrix) return Real_Matrix is
begin
return R : Real_Matrix (X'Range (2), X'Range (1)) do
Transpose (X, R);
end return;
end Transpose;
-----------------
-- Unit_Matrix --
-----------------
function Unit_Matrix
(Order : Positive;
First_1 : Integer := 1;
First_2 : Integer := 1) return Real_Matrix
renames Instantiations.Unit_Matrix;
-----------------
-- Unit_Vector --
-----------------
function Unit_Vector
(Index : Integer;
Order : Positive;
First : Integer := 1) return Real_Vector
renames Instantiations.Unit_Vector;
end Ada.Numerics.Generic_Real_Arrays;
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- Scancodes
--
-- All the scan codes for SDL.
--------------------------------------------------------------------------------------------------------------------
package Scancodes is
pragma Pure;
type Scan_Codes is range 0 .. 512 with
Convention => C,
Size => 32;
Scan_Code_Unknown : constant Scan_Codes := 0;
Scan_Code_A : constant Scan_Codes := 4;
Scan_Code_B : constant Scan_Codes := 5;
Scan_Code_C : constant Scan_Codes := 6;
Scan_Code_D : constant Scan_Codes := 7;
Scan_Code_E : constant Scan_Codes := 8;
Scan_Code_F : constant Scan_Codes := 9;
Scan_Code_G : constant Scan_Codes := 10;
Scan_Code_H : constant Scan_Codes := 11;
Scan_Code_I : constant Scan_Codes := 12;
Scan_Code_J : constant Scan_Codes := 13;
Scan_Code_K : constant Scan_Codes := 14;
Scan_Code_L : constant Scan_Codes := 15;
Scan_Code_M : constant Scan_Codes := 16;
Scan_Code_N : constant Scan_Codes := 17;
Scan_Code_O : constant Scan_Codes := 18;
Scan_Code_P : constant Scan_Codes := 19;
Scan_Code_Q : constant Scan_Codes := 20;
Scan_Code_R : constant Scan_Codes := 21;
Scan_Code_S : constant Scan_Codes := 22;
Scan_Code_T : constant Scan_Codes := 23;
Scan_Code_U : constant Scan_Codes := 24;
Scan_Code_V : constant Scan_Codes := 25;
Scan_Code_W : constant Scan_Codes := 26;
Scan_Code_X : constant Scan_Codes := 27;
Scan_Code_Y : constant Scan_Codes := 28;
Scan_Code_Z : constant Scan_Codes := 29;
Scan_Code_1 : constant Scan_Codes := 30;
Scan_Code_2 : constant Scan_Codes := 31;
Scan_Code_3 : constant Scan_Codes := 32;
Scan_Code_4 : constant Scan_Codes := 33;
Scan_Code_5 : constant Scan_Codes := 34;
Scan_Code_6 : constant Scan_Codes := 35;
Scan_Code_7 : constant Scan_Codes := 36;
Scan_Code_8 : constant Scan_Codes := 37;
Scan_Code_9 : constant Scan_Codes := 38;
Scan_Code_0 : constant Scan_Codes := 39;
Scan_Code_Return : constant Scan_Codes := 40;
Scan_Code_Escape : constant Scan_Codes := 41;
Scan_Code_Backspace : constant Scan_Codes := 42;
Scan_Code_Tab : constant Scan_Codes := 43;
Scan_Code_Space : constant Scan_Codes := 44;
Scan_Code_Minus : constant Scan_Codes := 45;
Scan_Code_Equals : constant Scan_Codes := 46;
Scan_Code_Left_Bracket : constant Scan_Codes := 47;
Scan_Code_Right_Bracket : constant Scan_Codes := 48;
Scan_Code_Back_Slash : constant Scan_Codes := 49;
Scan_Code_Non_US_Hash : constant Scan_Codes := 50;
Scan_Code_Semi_Colon : constant Scan_Codes := 51;
Scan_Code_Apostrophe : constant Scan_Codes := 52;
Scan_Code_Grave : constant Scan_Codes := 53;
Scan_Code_Comma : constant Scan_Codes := 54;
Scan_Code_Period : constant Scan_Codes := 55;
Scan_Code_Slash : constant Scan_Codes := 56;
Scan_Code_Caps_Lock : constant Scan_Codes := 57;
Scan_Code_F1 : constant Scan_Codes := 58;
Scan_Code_F2 : constant Scan_Codes := 59;
Scan_Code_F3 : constant Scan_Codes := 60;
Scan_Code_F4 : constant Scan_Codes := 61;
Scan_Code_F5 : constant Scan_Codes := 62;
Scan_Code_F6 : constant Scan_Codes := 63;
Scan_Code_F7 : constant Scan_Codes := 64;
Scan_Code_F8 : constant Scan_Codes := 65;
Scan_Code_F9 : constant Scan_Codes := 66;
Scan_Code_F10 : constant Scan_Codes := 67;
Scan_Code_F11 : constant Scan_Codes := 68;
Scan_Code_F12 : constant Scan_Codes := 69;
Scan_Code_Print_Screen : constant Scan_Codes := 70;
Scan_Code_Scroll_Lock : constant Scan_Codes := 71;
Scan_Code_Pause : constant Scan_Codes := 72;
Scan_Code_Insert : constant Scan_Codes := 73;
Scan_Code_Home : constant Scan_Codes := 74;
Scan_Code_Page_Up : constant Scan_Codes := 75;
Scan_Code_Delete : constant Scan_Codes := 76;
Scan_Code_End : constant Scan_Codes := 77;
Scan_Code_Page_Down : constant Scan_Codes := 78;
Scan_Code_Right : constant Scan_Codes := 79;
Scan_Code_Left : constant Scan_Codes := 80;
Scan_Code_Down : constant Scan_Codes := 81;
Scan_Code_Up : constant Scan_Codes := 82;
Scan_Code_Num_Lock_Clear : constant Scan_Codes := 83;
Scan_Code_KP_Divide : constant Scan_Codes := 84;
Scan_Code_KP_Multiply : constant Scan_Codes := 85;
Scan_Code_KP_Minus : constant Scan_Codes := 86;
Scan_Code_KP_Plus : constant Scan_Codes := 87;
Scan_Code_KP_Enter : constant Scan_Codes := 88;
Scan_Code_KP_1 : constant Scan_Codes := 89;
Scan_Code_KP_2 : constant Scan_Codes := 90;
Scan_Code_KP_3 : constant Scan_Codes := 91;
Scan_Code_KP_4 : constant Scan_Codes := 92;
Scan_Code_KP_5 : constant Scan_Codes := 93;
Scan_Code_KP_6 : constant Scan_Codes := 94;
Scan_Code_KP_7 : constant Scan_Codes := 95;
Scan_Code_KP_8 : constant Scan_Codes := 96;
Scan_Code_KP_9 : constant Scan_Codes := 97;
Scan_Code_KP_0 : constant Scan_Codes := 98;
Scan_Code_KP_Period : constant Scan_Codes := 99;
Scan_Code_Non_US_Back_Slash : constant Scan_Codes := 100;
Scan_Code_Application : constant Scan_Codes := 101;
Scan_Code_Power : constant Scan_Codes := 102;
Scan_Code_KP_Equals : constant Scan_Codes := 103;
Scan_Code_F13 : constant Scan_Codes := 104;
Scan_Code_F14 : constant Scan_Codes := 105;
Scan_Code_F15 : constant Scan_Codes := 106;
Scan_Code_F16 : constant Scan_Codes := 107;
Scan_Code_F17 : constant Scan_Codes := 108;
Scan_Code_F18 : constant Scan_Codes := 109;
Scan_Code_F19 : constant Scan_Codes := 110;
Scan_Code_F20 : constant Scan_Codes := 111;
Scan_Code_F21 : constant Scan_Codes := 112;
Scan_Code_F22 : constant Scan_Codes := 113;
Scan_Code_F23 : constant Scan_Codes := 114;
Scan_Code_F24 : constant Scan_Codes := 115;
Scan_Code_Execute : constant Scan_Codes := 116;
Scan_Code_Help : constant Scan_Codes := 117;
Scan_Code_Menu : constant Scan_Codes := 118;
Scan_Code_Select : constant Scan_Codes := 119;
Scan_Code_Stop : constant Scan_Codes := 120;
Scan_Code_Again : constant Scan_Codes := 121;
Scan_Code_Undo : constant Scan_Codes := 122;
Scan_Code_Cut : constant Scan_Codes := 123;
Scan_Code_Copy : constant Scan_Codes := 124;
Scan_Code_Paste : constant Scan_Codes := 125;
Scan_Code_Find : constant Scan_Codes := 126;
Scan_Code_Mute : constant Scan_Codes := 127;
Scan_Code_Volume_Up : constant Scan_Codes := 128;
Scan_Code_Volume_Down : constant Scan_Codes := 129;
-- Scan_Code_Locking_Caps_Lock : constant Scan_Codes := 130;
-- Scan_Code_Locking_Num_Lock : constant Scan_Codes := 131;
-- Scan_Code_Locking_Scroll_Lock : constant Scan_Codes := 132;
Scan_Code_KP_Comma : constant Scan_Codes := 133;
Scan_Code_KP_Equals_AS400 : constant Scan_Codes := 134;
Scan_Code_International_1 : constant Scan_Codes := 135; -- Used on Asian keyboards.
Scan_Code_International_2 : constant Scan_Codes := 136;
Scan_Code_International_3 : constant Scan_Codes := 137; -- Yen
Scan_Code_International_4 : constant Scan_Codes := 138;
Scan_Code_International_5 : constant Scan_Codes := 139;
Scan_Code_International_6 : constant Scan_Codes := 140;
Scan_Code_International_7 : constant Scan_Codes := 141;
Scan_Code_International_8 : constant Scan_Codes := 142;
Scan_Code_International_9 : constant Scan_Codes := 143;
Scan_Code_Language_1 : constant Scan_Codes := 144; -- Hangul/En
Scan_Code_Language_2 : constant Scan_Codes := 145; -- Hanja con
Scan_Code_Language_3 : constant Scan_Codes := 146; -- Katakana.
Scan_Code_Language_4 : constant Scan_Codes := 147; -- Hiragana.
Scan_Code_Language_5 : constant Scan_Codes := 148; -- Zenkaku/H
Scan_Code_Language_6 : constant Scan_Codes := 149; -- Reserved.
Scan_Code_Language_7 : constant Scan_Codes := 150; -- Reserved.
Scan_Code_Language_8 : constant Scan_Codes := 151; -- Reserved.
Scan_Code_Language_9 : constant Scan_Codes := 152; -- Reserved.
Scan_Code_Alt_Erase : constant Scan_Codes := 153; -- Erase-ease.
Scan_Code_Sys_Req : constant Scan_Codes := 154;
Scan_Code_Cancel : constant Scan_Codes := 155;
Scan_Code_Clear : constant Scan_Codes := 156;
Scan_Code_Prior : constant Scan_Codes := 157;
Scan_Code_Return_2 : constant Scan_Codes := 158;
Scan_Code_Separator : constant Scan_Codes := 159;
Scan_Code_Out : constant Scan_Codes := 160;
Scan_Code_Oper : constant Scan_Codes := 161;
Scan_Code_Clear_Again : constant Scan_Codes := 162;
Scan_Code_CR_Sel : constant Scan_Codes := 163;
Scan_Code_EX_Sel : constant Scan_Codes := 164;
Scan_Code_KP_00 : constant Scan_Codes := 176;
Scan_Code_KP_000 : constant Scan_Codes := 177;
Scan_Code_Thousands_Separator : constant Scan_Codes := 178;
Scan_Code_Decimal_Separator : constant Scan_Codes := 179;
Scan_Code_Currency_Unit : constant Scan_Codes := 180;
Scan_Code_Currency_Subunit : constant Scan_Codes := 181;
Scan_Code_KP_Left_Parenthesis : constant Scan_Codes := 182;
Scan_Code_KP_Right_Parentheesis : constant Scan_Codes := 183;
Scan_Code_KP_Left_Brace : constant Scan_Codes := 184;
Scan_Code_KP_Right_Brace : constant Scan_Codes := 185;
Scan_Code_KP_Tab : constant Scan_Codes := 186;
Scan_Code_KP_Backspace : constant Scan_Codes := 187;
Scan_Code_KP_A : constant Scan_Codes := 188;
Scan_Code_KP_B : constant Scan_Codes := 189;
Scan_Code_KP_C : constant Scan_Codes := 190;
Scan_Code_KP_D : constant Scan_Codes := 191;
Scan_Code_KP_E : constant Scan_Codes := 192;
Scan_Code_KP_F : constant Scan_Codes := 193;
Scan_Code_KP_XOR : constant Scan_Codes := 194;
Scan_Code_KP_Power : constant Scan_Codes := 195;
Scan_Code_KP_Percent : constant Scan_Codes := 196;
Scan_Code_KP_Less : constant Scan_Codes := 197;
Scan_Code_KP_Greater : constant Scan_Codes := 198;
Scan_Code_KP_Ampersand : constant Scan_Codes := 199;
Scan_Code_KP_Double_Ampersand : constant Scan_Codes := 200;
Scan_Code_KP_Vertical_Bar : constant Scan_Codes := 201;
Scan_Code_KP_Double_Vertical_Bar : constant Scan_Codes := 202;
Scan_Code_KP_Colon : constant Scan_Codes := 203;
Scan_Code_KP_Hash : constant Scan_Codes := 204;
Scan_Code_KP_Space : constant Scan_Codes := 205;
Scan_Code_KP_At : constant Scan_Codes := 206;
Scan_Code_KP_Exclamation : constant Scan_Codes := 207;
Scan_Code_KP_Memory_Store : constant Scan_Codes := 208;
Scan_Code_KP_Memory_Recall : constant Scan_Codes := 209;
Scan_Code_KP_Memory_Clear : constant Scan_Codes := 210;
Scan_Code_KP_Memory_Add : constant Scan_Codes := 211;
Scan_Code_KP_Memory_Subtract : constant Scan_Codes := 212;
Scan_Code_KP_Memory_Multiply : constant Scan_Codes := 213;
Scan_Code_KP_Memory_Divide : constant Scan_Codes := 214;
Scan_Code_KP_Plus_Minus : constant Scan_Codes := 215;
Scan_Code_KP_Clear : constant Scan_Codes := 216;
Scan_Code_KP_Clear_Entry : constant Scan_Codes := 217;
Scan_Code_KP_Binary : constant Scan_Codes := 218;
Scan_Code_KP_Octal : constant Scan_Codes := 219;
Scan_Code_KP_Decimal : constant Scan_Codes := 220;
Scan_Code_KP_Hexadecimal : constant Scan_Codes := 221;
Scan_Code_Left_Control : constant Scan_Codes := 224;
Scan_Code_Left_Shift : constant Scan_Codes := 225;
Scan_Code_Left_Alt : constant Scan_Codes := 226; -- Alt, option, etc.
Scan_Code_Left_GUI : constant Scan_Codes := 227; -- Windows, Command (Apple), Meta, etc.
Scan_Code_Right_Control : constant Scan_Codes := 228;
Scan_Code_Right_Shift : constant Scan_Codes := 229;
Scan_Code_Right_Alt : constant Scan_Codes := 230; -- Alt gr, option, etc.
Scan_Code_Right_GUI : constant Scan_Codes := 231; -- Windows, Command (Apple), Meta, etc.
Scan_Code_Mode : constant Scan_Codes := 257;
-- Usage page in USB document.
Scan_Code_Audio_Next : constant Scan_Codes := 258;
Scan_Code_Audio_Previous : constant Scan_Codes := 259;
Scan_Code_Audio_Stop : constant Scan_Codes := 260;
Scan_Code_Audio_Play : constant Scan_Codes := 261;
Scan_Code_Audio_Mute : constant Scan_Codes := 262;
Scan_Code_Media_Select : constant Scan_Codes := 263;
Scan_Code_WWW : constant Scan_Codes := 264;
Scan_Code_Mail : constant Scan_Codes := 265;
Scan_Code_Calculator : constant Scan_Codes := 266;
Scan_Code_Computer : constant Scan_Codes := 267;
Scan_Code_AC_Search : constant Scan_Codes := 268;
Scan_Code_AC_Home : constant Scan_Codes := 269;
Scan_Code_AC_Back : constant Scan_Codes := 270;
Scan_Code_AC_Forward : constant Scan_Codes := 271;
Scan_Code_AC_Stop : constant Scan_Codes := 272;
Scan_Code_AC_Refresh : constant Scan_Codes := 273;
Scan_Code_AC_Bookmarks : constant Scan_Codes := 274;
-- Walther keys (for Mac?).
Scan_Code_Brightness_Up : constant Scan_Codes := 275;
Scan_Code_Brightness_Down : constant Scan_Codes := 276;
Scan_Code_Display_Switch : constant Scan_Codes := 277;
Scan_Code_Illumination_Toggle : constant Scan_Codes := 278;
Scan_Code_Illumination_Down : constant Scan_Codes := 279;
Scan_Code_Illumination_Up : constant Scan_Codes := 280;
Scan_Code_Eject : constant Scan_Codes := 281;
Scan_Code_Sleep : constant Scan_Codes := 282;
Scan_Code_Application_1 : constant Scan_Codes := 283;
Scan_Code_Application_2 : constant Scan_Codes := 284;
-- All other scan codes go here.
Scan_Code_Total : constant Scan_Codes := 512;
end Scancodes;
|
-----------------------------------------------------------------------
-- util-serialize-io-csv -- CSV Serialization Driver
-- Copyright (C) 2011, 2015, 2016, 2017, 2021 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Strings.Unbounded;
with Ada.Characters.Latin_1;
with Ada.IO_Exceptions;
with Ada.Containers;
with Util.Strings;
with Util.Dates.ISO8601;
package body Util.Serialize.IO.CSV is
-- ------------------------------
-- Set the field separator. The default field separator is the comma (',').
-- ------------------------------
procedure Set_Field_Separator (Stream : in out Output_Stream;
Separator : in Character) is
begin
Stream.Separator := Separator;
end Set_Field_Separator;
-- ------------------------------
-- Enable or disable the double quotes by default for strings.
-- ------------------------------
procedure Set_Quotes (Stream : in out Output_Stream;
Enable : in Boolean) is
begin
Stream.Quote := Enable;
end Set_Quotes;
-- ------------------------------
-- Write the value as a CSV cell. Special characters are escaped using the CSV
-- escape rules.
-- ------------------------------
procedure Write_Cell (Stream : in out Output_Stream;
Value : in String) is
begin
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
if Stream.Quote then
Stream.Write ('"');
end if;
for I in Value'Range loop
if Value (I) = '"' then
Stream.Write ("""""");
else
Stream.Write (Value (I));
end if;
end loop;
if Stream.Quote then
Stream.Write ('"');
end if;
end Write_Cell;
procedure Write_Cell (Stream : in out Output_Stream;
Value : in Integer) is
begin
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
Stream.Write (Util.Strings.Image (Value));
end Write_Cell;
procedure Write_Cell (Stream : in out Output_Stream;
Value : in Boolean) is
begin
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
if Value then
Stream.Write ("true");
else
Stream.Write ("false");
end if;
end Write_Cell;
procedure Write_Cell (Stream : in out Output_Stream;
Value : in Util.Beans.Objects.Object) is
use Util.Beans.Objects;
begin
case Util.Beans.Objects.Get_Type (Value) is
when TYPE_NULL =>
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
if Stream.Quote then
Stream.Write ("""null""");
else
Stream.Write ("null");
end if;
when TYPE_BOOLEAN =>
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
if Util.Beans.Objects.To_Boolean (Value) then
Stream.Write ("true");
else
Stream.Write ("false");
end if;
when TYPE_INTEGER =>
if Stream.Column > 1 then
Stream.Write (Stream.Separator);
end if;
Stream.Column := Stream.Column + 1;
-- Stream.Write ('"');
Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value));
-- Stream.Write ('"');
when others =>
Stream.Write_Cell (Util.Beans.Objects.To_String (Value));
end case;
end Write_Cell;
-- ------------------------------
-- Start a new row.
-- ------------------------------
procedure New_Row (Stream : in out Output_Stream) is
begin
while Stream.Column < Stream.Max_Columns loop
Stream.Write (Stream.Separator);
Stream.Column := Stream.Column + 1;
end loop;
Stream.Write (ASCII.CR);
Stream.Write (ASCII.LF);
Stream.Column := 1;
Stream.Row := Stream.Row + 1;
end New_Row;
-- -----------------------
-- Write the attribute name/value pair.
-- -----------------------
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Attribute;
overriding
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is
begin
null;
end Write_Wide_Attribute;
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Attribute;
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Attribute;
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Attribute;
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Entity;
-- -----------------------
-- Write the entity value.
-- -----------------------
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Entity;
overriding
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is
begin
null;
end Write_Wide_Entity;
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Entity;
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is
pragma Unreferenced (Name);
begin
Stream.Write_Cell (Value);
end Write_Entity;
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time) is
begin
Stream.Write_Entity (Name, Util.Dates.ISO8601.Image (Value, Util.Dates.ISO8601.SUBSECOND));
end Write_Entity;
overriding
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer) is
begin
null;
end Write_Long_Entity;
overriding
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
begin
Stream.Write_Entity (Name, Value);
end Write_Enum_Entity;
-- ------------------------------
-- Write the attribute with a null value.
-- ------------------------------
overriding
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String) is
begin
Stream.Write_Entity (Name, "");
end Write_Null_Attribute;
-- ------------------------------
-- Write an entity with a null value.
-- ------------------------------
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String) is
begin
Stream.Write_Null_Attribute (Name);
end Write_Null_Entity;
-- ------------------------------
-- Get the header name for the given column.
-- If there was no header line, build a default header for the column.
-- ------------------------------
function Get_Header_Name (Handler : in Parser;
Column : in Column_Type) return String is
use type Ada.Containers.Count_Type;
Default_Header : constant String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Result : String (1 .. 10);
N, R : Natural;
Pos : Positive := Result'Last;
begin
if Handler.Headers.Length >= Ada.Containers.Count_Type (Column) then
return Handler.Headers.Element (Positive (Column));
end if;
N := Natural (Column - 1);
loop
R := N mod 26;
N := N / 26;
Result (Pos) := Default_Header (R + 1);
exit when N = 0;
Pos := Pos - 1;
end loop;
return Result (Pos .. Result'Last);
end Get_Header_Name;
-- ------------------------------
-- Set the cell value at the given row and column.
-- The default implementation finds the column header name and
-- invokes <b>Write_Entity</b> with the header name and the value.
-- ------------------------------
procedure Set_Cell (Handler : in out Parser;
Value : in String;
Row : in Row_Type;
Column : in Column_Type) is
use Ada.Containers;
begin
if Row = 0 then
-- Build the headers table.
declare
Missing : constant Integer := Integer (Column) - Integer (Handler.Headers.Length);
begin
if Missing > 0 then
Handler.Headers.Set_Length (Handler.Headers.Length + Count_Type (Missing));
end if;
Handler.Headers.Replace_Element (Positive (Column), Value);
end;
else
declare
Name : constant String := Handler.Get_Header_Name (Column);
begin
-- Detect a new row. Close the current object and start a new one.
if Handler.Row /= Row then
if Row > 1 then
Handler.Sink.Finish_Object ("", Handler);
else
Handler.Sink.Start_Array ("", Handler);
end if;
Handler.Sink.Start_Object ("", Handler);
end if;
Handler.Row := Row;
Handler.Sink.Set_Member (Name, Util.Beans.Objects.To_Object (Value), Handler);
end;
end if;
end Set_Cell;
-- ------------------------------
-- Set the field separator. The default field separator is the comma (',').
-- ------------------------------
procedure Set_Field_Separator (Handler : in out Parser;
Separator : in Character) is
begin
Handler.Separator := Separator;
end Set_Field_Separator;
-- ------------------------------
-- Get the field separator.
-- ------------------------------
function Get_Field_Separator (Handler : in Parser) return Character is
begin
return Handler.Separator;
end Get_Field_Separator;
-- ------------------------------
-- Set the comment separator. When a comment separator is defined, a line which starts
-- with the comment separator will be ignored. The row number will not be incremented.
-- ------------------------------
procedure Set_Comment_Separator (Handler : in out Parser;
Separator : in Character) is
begin
Handler.Comment := Separator;
end Set_Comment_Separator;
-- ------------------------------
-- Get the comment separator. Returns ASCII.NUL if comments are not supported.
-- ------------------------------
function Get_Comment_Separator (Handler : in Parser) return Character is
begin
return Handler.Comment;
end Get_Comment_Separator;
-- ------------------------------
-- Setup the CSV parser and mapper to use the default column header names.
-- When activated, the first row is assumed to contain the first item to de-serialize.
-- ------------------------------
procedure Set_Default_Headers (Handler : in out Parser;
Mode : in Boolean := True) is
begin
Handler.Use_Default_Headers := Mode;
end Set_Default_Headers;
-- ------------------------------
-- Parse the stream using the CSV parser.
-- Call <b>Set_Cell</b> for each cell that has been parsed indicating the row and
-- column numbers as well as the cell value.
-- ------------------------------
overriding
procedure Parse (Handler : in out Parser;
Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class;
Sink : in out Reader'Class) is
use Ada.Strings.Unbounded;
C : Character;
Token : Unbounded_String;
Column : Column_Type := 1;
Row : Row_Type := 0;
In_Quote_Token : Boolean := False;
In_Escape : Boolean := False;
Ignore_Row : Boolean := False;
begin
if Handler.Use_Default_Headers then
Row := 1;
end if;
Handler.Headers.Clear;
Handler.Sink := Sink'Unchecked_Access;
loop
Stream.Read (Char => C);
if C = Ada.Characters.Latin_1.CR or C = Ada.Characters.Latin_1.LF then
if C = Ada.Characters.Latin_1.LF then
Handler.Line_Number := Handler.Line_Number + 1;
end if;
if not Ignore_Row then
if In_Quote_Token and not In_Escape then
Append (Token, C);
elsif Column > 1 or else Length (Token) > 0 then
Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column);
Set_Unbounded_String (Token, "");
Row := Row + 1;
Column := 1;
In_Quote_Token := False;
In_Escape := False;
end if;
else
Ignore_Row := False;
end if;
elsif C = Handler.Separator and not Ignore_Row then
if In_Quote_Token and not In_Escape then
Append (Token, C);
else
Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column);
Set_Unbounded_String (Token, "");
Column := Column + 1;
In_Quote_Token := False;
In_Escape := False;
end if;
elsif C = '"' and not Ignore_Row then
if In_Quote_Token then
In_Escape := True;
elsif In_Escape then
Append (Token, C);
In_Escape := False;
elsif Ada.Strings.Unbounded.Length (Token) = 0 then
In_Quote_Token := True;
else
Append (Token, C);
end if;
elsif C = Handler.Comment and Handler.Comment /= ASCII.NUL
and Column = 1 and Length (Token) = 0
then
Ignore_Row := True;
elsif not Ignore_Row then
Append (Token, C);
In_Escape := False;
end if;
end loop;
exception
when Ada.IO_Exceptions.Data_Error =>
Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column);
Handler.Sink := null;
return;
end Parse;
-- ------------------------------
-- Get the current location (file and line) to report an error message.
-- ------------------------------
overriding
function Get_Location (Handler : in Parser) return String is
begin
return Util.Strings.Image (Handler.Line_Number);
end Get_Location;
end Util.Serialize.IO.CSV;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
with Ada.Calendar.Time_Zones; use Ada.Calendar.Time_Zones;
with GPS; use GPS;
with Sunangle; use Sunangle;
procedure Calc is
Current_Angle : Angle_Type;
My_Position : GPS.Position_Type;
My_Time_Offset : Time_Offset;
Sunrise : Ada.Calendar.Time;
Sunset : Ada.Calendar.Time;
begin
My_Position := Get_Position;
Current_Angle := Calculate_Current_Angle (My_Position);
My_Time_Offset := UTC_Time_Offset (My_Position.Current_Time);
Put ("Current time: ");
Put (Ada.Calendar.Formatting.Image (My_Position.Current_Time, False,
My_Time_Offset));
New_Line;
Put ("UTC time: ");
Put (Ada.Calendar.Formatting.Image (My_Position.Current_Time, False,
0));
New_Line (2);
Put ("Az: ");
Put (Current_Angle.Azimuth, 0, 3, 0);
Put (" El: ");
Put (Current_Angle.Elevation, 0, 3, 0);
New_Line (2);
Sunrise := Calculate_Sunrise (My_Position);
Sunset := Calculate_Sunset (My_Position);
Put ("Sunrise: ");
Put (Ada.Calendar.Formatting.Image (Sunrise, False, My_Time_Offset));
New_Line;
Put ("Sunset: ");
Put (Ada.Calendar.Formatting.Image (Sunset, False, My_Time_Offset));
New_Line;
end Calc;
|
-----------------------------------------------------------------------
-- core-factory -- Factory for Core UI Components
-- Copyright (C) 2009, 2010, 2011, 2012, 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 ASF.Components.Base;
with ASF.Views.Nodes;
with ASF.Views.Nodes.Jsf;
with ASF.Components.Html.Selects;
with ASF.Components.Core.Views;
package body ASF.Components.Core.Factory is
function Create_View return Base.UIComponent_Access;
function Create_ViewAction return Base.UIComponent_Access;
function Create_ViewMetaData return Base.UIComponent_Access;
function Create_ViewParameter return Base.UIComponent_Access;
function Create_Parameter return Base.UIComponent_Access;
function Create_SelectItem return Base.UIComponent_Access;
function Create_SelectItems return Base.UIComponent_Access;
-- ------------------------------
-- Create an UIView component
-- ------------------------------
function Create_View return Base.UIComponent_Access is
begin
return new ASF.Components.Core.Views.UIView;
end Create_View;
-- ------------------------------
-- Create an UIViewAction component
-- ------------------------------
function Create_ViewAction return Base.UIComponent_Access is
begin
return new ASF.Components.Core.Views.UIViewAction;
end Create_ViewAction;
-- ------------------------------
-- Create an UIViewMetaData component
-- ------------------------------
function Create_ViewMetaData return Base.UIComponent_Access is
begin
return new ASF.Components.Core.Views.UIViewMetaData;
end Create_ViewMetaData;
-- ------------------------------
-- Create an UIViewParameter component
-- ------------------------------
function Create_ViewParameter return Base.UIComponent_Access is
begin
return new ASF.Components.Core.Views.UIViewParameter;
end Create_ViewParameter;
-- ------------------------------
-- Create an UIParameter component
-- ------------------------------
function Create_Parameter return Base.UIComponent_Access is
begin
return new ASF.Components.Core.UIParameter;
end Create_Parameter;
-- ------------------------------
-- Create an UISelectItem component
-- ------------------------------
function Create_SelectItem return Base.UIComponent_Access is
begin
return new ASF.Components.Html.Selects.UISelectItem;
end Create_SelectItem;
-- ------------------------------
-- Create an UISelectItems component
-- ------------------------------
function Create_SelectItems return Base.UIComponent_Access is
begin
return new ASF.Components.Html.Selects.UISelectItems;
end Create_SelectItems;
use ASF.Views.Nodes;
URI : aliased constant String := "http://java.sun.com/jsf/core";
ATTRIBUTE_TAG : aliased constant String := "attribute";
CONVERT_DATE_TIME_TAG : aliased constant String := "convertDateTime";
CONVERTER_TAG : aliased constant String := "converter";
FACET_TAG : aliased constant String := "facet";
METADATA_TAG : aliased constant String := "metadata";
PARAM_TAG : aliased constant String := "param";
SELECT_ITEM_TAG : aliased constant String := "selectItem";
SELECT_ITEMS_TAG : aliased constant String := "selectItems";
VALIDATE_LENGTH_TAG : aliased constant String := "validateLength";
VALIDATE_LONG_RANGE_TAG : aliased constant String := "validateLongRange";
VALIDATOR_TAG : aliased constant String := "validator";
VIEW_TAG : aliased constant String := "view";
VIEW_ACTION_TAG : aliased constant String := "viewAction";
VIEW_PARAM_TAG : aliased constant String := "viewParam";
Core_Bindings : aliased constant ASF.Factory.Binding_Array
:= (1 => (Name => ATTRIBUTE_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Attribute_Tag_Node'Access),
2 => (Name => CONVERT_DATE_TIME_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Convert_Date_Time_Tag_Node'Access),
3 => (Name => CONVERTER_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Converter_Tag_Node'Access),
4 => (Name => FACET_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Facet_Tag_Node'Access),
5 => (Name => METADATA_TAG'Access,
Component => Create_ViewMetaData'Access,
Tag => ASF.Views.Nodes.Jsf.Create_Metadata_Tag_Node'Access),
6 => (Name => PARAM_TAG'Access,
Component => Create_Parameter'Access,
Tag => Create_Component_Node'Access),
7 => (Name => SELECT_ITEM_TAG'Access,
Component => Create_SelectItem'Access,
Tag => Create_Component_Node'Access),
8 => (Name => SELECT_ITEMS_TAG'Access,
Component => Create_SelectItems'Access,
Tag => Create_Component_Node'Access),
9 => (Name => VALIDATE_LENGTH_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Length_Validator_Tag_Node'Access),
10 => (Name => VALIDATE_LONG_RANGE_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Range_Validator_Tag_Node'Access),
11 => (Name => VALIDATOR_TAG'Access,
Component => null,
Tag => ASF.Views.Nodes.Jsf.Create_Validator_Tag_Node'Access),
12 => (Name => VIEW_TAG'Access,
Component => Create_View'Access,
Tag => Create_Component_Node'Access),
13 => (Name => VIEW_ACTION_TAG'Access,
Component => Create_ViewAction'Access,
Tag => Create_Component_Node'Access),
14 => (Name => VIEW_PARAM_TAG'Access,
Component => Create_ViewParameter'Access,
Tag => Create_Component_Node'Access)
);
Core_Factory : aliased constant ASF.Factory.Factory_Bindings
:= (URI => URI'Access, Bindings => Core_Bindings'Access);
-- ------------------------------
-- Get the HTML component factory.
-- ------------------------------
function Definition return ASF.Factory.Factory_Bindings_Access is
begin
return Core_Factory'Access;
end Definition;
end ASF.Components.Core.Factory;
|
--
-- Jan & Uwe R. Zimmer, Australia, July 2011
--
with Ada.Numerics; use Ada.Numerics;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Strings.Bounded; use Ada.Strings.Bounded;
package body Vectors_xD is
package Real_Elementary_Functions is
new Ada.Numerics.Generic_Elementary_Functions (Real);
use Real_Elementary_Functions;
package Strings_255 is new Ada.Strings.Bounded.Generic_Bounded_Length (Max => 255);
use Strings_255;
--
function Image (V : Vector_xD) return String is
Image_String : Strings_255.Bounded_String := Strings_255.Null_Bounded_String;
begin
Image_String := Image_String & '(';
for Axes in Vector_xD'Range loop
Image_String := Image_String & Real'Image (V (Axes));
if Axes /= Vector_xD'Last then
Image_String := Image_String & ", ";
end if;
end loop;
Image_String := Image_String & ')';
return To_String (Image_String);
end Image;
--
function Norm (V : Vector_xD) return Vector_xD is
Abs_V : constant Real := abs (V);
begin
if Abs_V = 0.0 then
return Zero_Vector_xD;
else
return (V * (1.0 / Abs_V));
end if;
end Norm;
--
function "*" (Scalar : Real; V : Vector_xD) return Vector_xD is
Scaled_V : Vector_xD;
begin
for Axis in Vector_xD'Range loop
Scaled_V (Axis) := Scalar * V (Axis);
end loop;
return Scaled_V;
end "*";
--
function "*" (V : Vector_xD; Scalar : Real) return Vector_xD is (Scalar * V);
--
function "/" (V : Vector_xD; Scalar : Real) return Vector_xD is ((1.0 / Scalar) * V);
--
function "*" (V_Left, V_Right : Vector_xD) return Real is
Dot : Real := 0.0;
begin
for Axis in Vector_xD'Range loop
Dot := Dot + (V_Left (Axis) * V_Right (Axis));
end loop;
return Dot;
end "*";
--
function Angle_Between (V_Left, V_Right : Vector_xD) return Real is
Abs_Left : constant Real := abs (V_Left);
Abs_Right : constant Real := abs (V_Right);
begin
if Abs_Left = 0.0 or else Abs_Right = 0.0 then
return 0.0;
else
return Arccos (Real'Max (-1.0, Real'Min (1.0, (V_Left * V_Right) / (Abs_Left * Abs_Right))));
end if;
end Angle_Between;
--
function "+" (V_Left, V_Right : Vector_xD) return Vector_xD is
V_Result : Vector_xD;
begin
for Axis in Vector_xD'Range loop
V_Result (Axis) := V_Left (Axis) + V_Right (Axis);
end loop;
return V_Result;
end "+";
--
function "-" (V_Left, V_Right : Vector_xD) return Vector_xD is
V_Result : Vector_xD;
begin
for Axis in Vector_xD'Range loop
V_Result (Axis) := V_Left (Axis) - V_Right (Axis);
end loop;
return V_Result;
end "-";
--
function "abs" (V : Vector_xD) return Real is
Sum_Sqr : Real := 0.0;
begin
for Axis in Vector_xD'Range loop
Sum_Sqr := Sum_Sqr + V (Axis)**2;
end loop;
return Sqrt (Sum_Sqr);
end "abs";
--
end Vectors_xD;
|
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package emmintrin_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 SSE header files
-- SSE2
subtype uu_v2df is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:40
subtype uu_v2di is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:41
subtype uu_v2du is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:42
subtype uu_v4si is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:43
subtype uu_v4su is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:44
subtype uu_v8hi is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:45
subtype uu_v8hu is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:46
subtype uu_v16qi is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:47
subtype uu_v16qu is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:48
-- The Intel API is flexible enough that we must allow aliasing with other
-- vector types, and their scalar components.
subtype uu_m128i is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:52
subtype uu_m128d is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:53
-- Unaligned version of the same types.
subtype uu_m128i_u is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:56
subtype uu_m128d_u is <vector>; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\emmintrin.h:57
-- Create a selector for use with the SHUFPD instruction.
-- Create a vector with element 0 as F and the rest zero.
-- skipped func _mm_set_sd
-- Create a vector with both elements equal to F.
-- skipped func _mm_set1_pd
-- skipped func _mm_set_pd1
-- Create a vector with the lower value X and upper value W.
-- skipped func _mm_set_pd
-- Create a vector with the lower value W and upper value X.
-- skipped func _mm_setr_pd
-- Create an undefined vector.
-- skipped func _mm_undefined_pd
-- Create a vector of zeros.
-- skipped func _mm_setzero_pd
-- Sets the low DPFP value of A from the low value of B.
-- skipped func _mm_move_sd
-- Load two DPFP values from P. The address must be 16-byte aligned.
-- skipped func _mm_load_pd
-- Load two DPFP values from P. The address need not be 16-byte aligned.
-- skipped func _mm_loadu_pd
-- Create a vector with all two elements equal to *P.
-- skipped func _mm_load1_pd
-- Create a vector with element 0 as *P and the rest zero.
-- skipped func _mm_load_sd
-- skipped func _mm_load_pd1
-- Load two DPFP values in reverse order. The address must be aligned.
-- skipped func _mm_loadr_pd
-- Store two DPFP values. The address must be 16-byte aligned.
-- skipped func _mm_store_pd
-- Store two DPFP values. The address need not be 16-byte aligned.
-- skipped func _mm_storeu_pd
-- Stores the lower DPFP value.
-- skipped func _mm_store_sd
-- skipped func _mm_cvtsd_f64
-- skipped func _mm_storel_pd
-- Stores the upper DPFP value.
-- skipped func _mm_storeh_pd
-- Store the lower DPFP value across two words.
-- The address must be 16-byte aligned.
-- skipped func _mm_store1_pd
-- skipped func _mm_store_pd1
-- Store two DPFP values in reverse order. The address must be aligned.
-- skipped func _mm_storer_pd
-- skipped func _mm_cvtsi128_si32
-- Intel intrinsic.
-- skipped func _mm_cvtsi128_si64
-- Microsoft intrinsic.
-- skipped func _mm_cvtsi128_si64x
-- skipped func _mm_add_pd
-- skipped func _mm_add_sd
-- skipped func _mm_sub_pd
-- skipped func _mm_sub_sd
-- skipped func _mm_mul_pd
-- skipped func _mm_mul_sd
-- skipped func _mm_div_pd
-- skipped func _mm_div_sd
-- skipped func _mm_sqrt_pd
-- Return pair {sqrt (B[0]), A[1]}.
-- skipped func _mm_sqrt_sd
-- skipped func _mm_min_pd
-- skipped func _mm_min_sd
-- skipped func _mm_max_pd
-- skipped func _mm_max_sd
-- skipped func _mm_and_pd
-- skipped func _mm_andnot_pd
-- skipped func _mm_or_pd
-- skipped func _mm_xor_pd
-- skipped func _mm_cmpeq_pd
-- skipped func _mm_cmplt_pd
-- skipped func _mm_cmple_pd
-- skipped func _mm_cmpgt_pd
-- skipped func _mm_cmpge_pd
-- skipped func _mm_cmpneq_pd
-- skipped func _mm_cmpnlt_pd
-- skipped func _mm_cmpnle_pd
-- skipped func _mm_cmpngt_pd
-- skipped func _mm_cmpnge_pd
-- skipped func _mm_cmpord_pd
-- skipped func _mm_cmpunord_pd
-- skipped func _mm_cmpeq_sd
-- skipped func _mm_cmplt_sd
-- skipped func _mm_cmple_sd
-- skipped func _mm_cmpgt_sd
-- skipped func _mm_cmpge_sd
-- skipped func _mm_cmpneq_sd
-- skipped func _mm_cmpnlt_sd
-- skipped func _mm_cmpnle_sd
-- skipped func _mm_cmpngt_sd
-- skipped func _mm_cmpnge_sd
-- skipped func _mm_cmpord_sd
-- skipped func _mm_cmpunord_sd
-- skipped func _mm_comieq_sd
-- skipped func _mm_comilt_sd
-- skipped func _mm_comile_sd
-- skipped func _mm_comigt_sd
-- skipped func _mm_comige_sd
-- skipped func _mm_comineq_sd
-- skipped func _mm_ucomieq_sd
-- skipped func _mm_ucomilt_sd
-- skipped func _mm_ucomile_sd
-- skipped func _mm_ucomigt_sd
-- skipped func _mm_ucomige_sd
-- skipped func _mm_ucomineq_sd
-- Create a vector of Qi, where i is the element number.
-- skipped func _mm_set_epi64x
-- skipped func _mm_set_epi64
-- skipped func _mm_set_epi32
-- skipped func _mm_set_epi16
-- skipped func _mm_set_epi8
-- Set all of the elements of the vector to A.
-- skipped func _mm_set1_epi64x
-- skipped func _mm_set1_epi64
-- skipped func _mm_set1_epi32
-- skipped func _mm_set1_epi16
-- skipped func _mm_set1_epi8
-- Create a vector of Qi, where i is the element number.
-- The parameter order is reversed from the _mm_set_epi* functions.
-- skipped func _mm_setr_epi64
-- skipped func _mm_setr_epi32
-- skipped func _mm_setr_epi16
-- skipped func _mm_setr_epi8
-- Create a vector with element 0 as *P and the rest zero.
-- skipped func _mm_load_si128
-- skipped func _mm_loadu_si128
-- skipped func _mm_loadl_epi64
-- skipped func _mm_store_si128
-- skipped func _mm_storeu_si128
-- skipped func _mm_storel_epi64
-- skipped func _mm_movepi64_pi64
-- skipped func _mm_movpi64_epi64
-- skipped func _mm_move_epi64
-- Create an undefined vector.
-- skipped func _mm_undefined_si128
-- Create a vector of zeros.
-- skipped func _mm_setzero_si128
-- skipped func _mm_cvtepi32_pd
-- skipped func _mm_cvtepi32_ps
-- skipped func _mm_cvtpd_epi32
-- skipped func _mm_cvtpd_pi32
-- skipped func _mm_cvtpd_ps
-- skipped func _mm_cvttpd_epi32
-- skipped func _mm_cvttpd_pi32
-- skipped func _mm_cvtpi32_pd
-- skipped func _mm_cvtps_epi32
-- skipped func _mm_cvttps_epi32
-- skipped func _mm_cvtps_pd
-- skipped func _mm_cvtsd_si32
-- Intel intrinsic.
-- skipped func _mm_cvtsd_si64
-- Microsoft intrinsic.
-- skipped func _mm_cvtsd_si64x
-- skipped func _mm_cvttsd_si32
-- Intel intrinsic.
-- skipped func _mm_cvttsd_si64
-- Microsoft intrinsic.
-- skipped func _mm_cvttsd_si64x
-- skipped func _mm_cvtsd_ss
-- skipped func _mm_cvtsi32_sd
-- Intel intrinsic.
-- skipped func _mm_cvtsi64_sd
-- Microsoft intrinsic.
-- skipped func _mm_cvtsi64x_sd
-- skipped func _mm_cvtss_sd
-- skipped func _mm_unpackhi_pd
-- skipped func _mm_unpacklo_pd
-- skipped func _mm_loadh_pd
-- skipped func _mm_loadl_pd
-- skipped func _mm_movemask_pd
-- skipped func _mm_packs_epi16
-- skipped func _mm_packs_epi32
-- skipped func _mm_packus_epi16
-- skipped func _mm_unpackhi_epi8
-- skipped func _mm_unpackhi_epi16
-- skipped func _mm_unpackhi_epi32
-- skipped func _mm_unpackhi_epi64
-- skipped func _mm_unpacklo_epi8
-- skipped func _mm_unpacklo_epi16
-- skipped func _mm_unpacklo_epi32
-- skipped func _mm_unpacklo_epi64
-- skipped func _mm_add_epi8
-- skipped func _mm_add_epi16
-- skipped func _mm_add_epi32
-- skipped func _mm_add_epi64
-- skipped func _mm_adds_epi8
-- skipped func _mm_adds_epi16
-- skipped func _mm_adds_epu8
-- skipped func _mm_adds_epu16
-- skipped func _mm_sub_epi8
-- skipped func _mm_sub_epi16
-- skipped func _mm_sub_epi32
-- skipped func _mm_sub_epi64
-- skipped func _mm_subs_epi8
-- skipped func _mm_subs_epi16
-- skipped func _mm_subs_epu8
-- skipped func _mm_subs_epu16
-- skipped func _mm_madd_epi16
-- skipped func _mm_mulhi_epi16
-- skipped func _mm_mullo_epi16
-- skipped func _mm_mul_su32
-- skipped func _mm_mul_epu32
-- skipped func _mm_slli_epi16
-- skipped func _mm_slli_epi32
-- skipped func _mm_slli_epi64
-- skipped func _mm_srai_epi16
-- skipped func _mm_srai_epi32
-- skipped func _mm_srli_epi16
-- skipped func _mm_srli_epi32
-- skipped func _mm_srli_epi64
-- skipped func _mm_sll_epi16
-- skipped func _mm_sll_epi32
-- skipped func _mm_sll_epi64
-- skipped func _mm_sra_epi16
-- skipped func _mm_sra_epi32
-- skipped func _mm_srl_epi16
-- skipped func _mm_srl_epi32
-- skipped func _mm_srl_epi64
-- skipped func _mm_and_si128
-- skipped func _mm_andnot_si128
-- skipped func _mm_or_si128
-- skipped func _mm_xor_si128
-- skipped func _mm_cmpeq_epi8
-- skipped func _mm_cmpeq_epi16
-- skipped func _mm_cmpeq_epi32
-- skipped func _mm_cmplt_epi8
-- skipped func _mm_cmplt_epi16
-- skipped func _mm_cmplt_epi32
-- skipped func _mm_cmpgt_epi8
-- skipped func _mm_cmpgt_epi16
-- skipped func _mm_cmpgt_epi32
-- skipped func _mm_max_epi16
-- skipped func _mm_max_epu8
-- skipped func _mm_min_epi16
-- skipped func _mm_min_epu8
-- skipped func _mm_movemask_epi8
-- skipped func _mm_mulhi_epu16
-- skipped func _mm_maskmoveu_si128
-- skipped func _mm_avg_epu8
-- skipped func _mm_avg_epu16
-- skipped func _mm_sad_epu8
-- skipped func _mm_stream_si32
-- skipped func _mm_stream_si64
-- skipped func _mm_stream_si128
-- skipped func _mm_stream_pd
-- skipped func _mm_clflush
-- skipped func _mm_lfence
-- skipped func _mm_mfence
-- skipped func _mm_cvtsi32_si128
-- Intel intrinsic.
-- skipped func _mm_cvtsi64_si128
-- Microsoft intrinsic.
-- skipped func _mm_cvtsi64x_si128
-- Casts between various SP, DP, INT vector types. Note that these do no
-- conversion of values, they just change the type.
-- skipped func _mm_castpd_ps
-- skipped func _mm_castpd_si128
-- skipped func _mm_castps_pd
-- skipped func _mm_castps_si128
-- skipped func _mm_castsi128_ps
-- skipped func _mm_castsi128_pd
end emmintrin_h;
|
package Depends_Exercise is
Stack_Size : constant := 100;
type Pointer_Range is range 0 .. Stack_Size;
subtype Stack_Range is Pointer_Range range 1 .. Stack_Size;
Stack : array (Stack_Range) of Integer;
Stack_Pointer : Pointer_Range := 0;
-- Add suitable Global and Depends contracts
procedure Initialize;
-- Add suitable Global and Depends contracts
procedure Push (X : in Integer);
-- Add suitable Global and Depends contracts
-- Why might it be useful to put a Depends contract on a function?
function Is_Full return Boolean;
function Wait_X_Return_True (X : in Integer) return Boolean;
end Depends_Exercise;
|
-- Motherlode
-- Copyright (c) 2020 Fabien Chouteau
with GESTE;
with GESTE.Maths_Types; use GESTE.Maths_Types;
with HUD;
with Sound;
package body Player is
P : aliased Player_Type;
Going_Up : Boolean := False;
Going_Down : Boolean := False;
Going_Left : Boolean := False;
Going_Right : Boolean := False;
Facing_Left : Boolean := False with Unreferenced;
Using_Drill : Boolean := False;
type Drill_Anim_Rec is record
In_Progress : Boolean := False;
Steps : Natural := 0; -- Total number of steps for the animation
Rem_Steps : Natural := 0; -- Remaining number of steps in the animation
Target_CX : Natural := 0; -- X coord of the cell that is being drilled
Target_CY : Natural := 0; -- Y coord of the cell that is being drilled
Origin_PX : Natural := 0; -- X coord of the player when starting anim
Origin_PY : Natural := 0; -- Y coord of the player when starting anim
end record;
-- Data for the drill animation
Drill_Anim : Drill_Anim_Rec;
type Collision_Points is array (Natural range <>) of GESTE.Pix_Point;
-- Bounding Box points
BB_Top : constant Collision_Points :=
((-3, -4), (3, -4));
BB_Bottom : constant Collision_Points :=
((-3, 5), (3, 5));
BB_Left : constant Collision_Points :=
((-5, 5), (-5, -2));
BB_Right : constant Collision_Points :=
((5, 5), (5, -2));
-- Drill points
Drill_Bottom : constant Collision_Points :=
(0 => (0, 8));
Drill_Left : constant Collision_Points :=
(0 => (-8, 0));
Drill_Right : constant Collision_Points :=
(0 => (8, 0));
Grounded : Boolean := False;
function Collides (Points : Collision_Points) return Boolean;
--------------
-- Collides --
--------------
function Collides (Points : Collision_Points) return Boolean is
X : constant Integer := Integer (P.Position.X);
Y : constant Integer := Integer (P.Position.Y);
begin
for Pt of Points loop
if World.Collides (X + Pt.X, Y + Pt.Y) then
return True;
end if;
end loop;
return False;
end Collides;
-----------
-- Spawn --
-----------
procedure Spawn is
begin
P.Set_Mass (Parameters.Empty_Mass);
P.Set_Speed ((0.0, 0.0));
P.Money := 0;
P.Fuel := Parameters.Start_Fuel;
P.Equip_Level := (others => 1);
Move ((Parameters.Spawn_X, Parameters.Spawn_Y));
end Spawn;
----------
-- Move --
----------
procedure Move (Pt : GESTE.Pix_Point) is
begin
P.Set_Position (GESTE.Maths_Types.Point'(Value (Pt.X), Value (Pt.Y)));
P.Set_Speed ((0.0, 0.0));
end Move;
--------------
-- Position --
--------------
function Position return GESTE.Pix_Point
is ((Integer (P.Position.X), Integer (P.Position.Y)));
--------------
-- Quantity --
--------------
function Quantity (Kind : World.Valuable_Cell) return Natural
is (P.Cargo (Kind));
----------
-- Drop --
----------
procedure Drop (Kind : World.Valuable_Cell) is
Cnt : Natural renames P.Cargo (Kind);
begin
if Cnt > 0 then
Cnt := Cnt - 1;
P.Cargo_Sum := P.Cargo_Sum - 1;
P.Set_Mass (P.Mass - Value (Parameters.Weight (Kind)));
end if;
end Drop;
-----------
-- Level --
-----------
function Level (Kind : Parameters.Equipment)
return Parameters.Equipment_Level
is (P.Equip_Level (Kind));
-------------
-- Upgrade --
-------------
procedure Upgrade (Kind : Parameters.Equipment) is
use Parameters;
begin
if P.Equip_Level (Kind) /= Equipment_Level'Last then
declare
Next_Lvl : constant Equipment_Level := P.Equip_Level (Kind) + 1;
Cost : constant Natural := Parameters.Price (Kind, Next_Lvl);
begin
if Cost <= P.Money then
P.Money := P.Money - Cost;
P.Equip_Level (Kind) := Next_Lvl;
P.Cash_In := P.Cash_In - Cost;
P.Cash_In_TTL := 30 * 1;
end if;
end;
end if;
end Upgrade;
-----------
-- Money --
-----------
function Money return Natural
is (P.Money);
------------------
-- Put_In_Cargo --
------------------
procedure Put_In_Cargo (This : in out Player_Type;
Kind : World.Valuable_Cell)
is
use Parameters;
begin
if P.Cargo_Sum < Cargo_Capacity (This.Equip_Level (Cargo)) then
P.Cargo (Kind) := P.Cargo (Kind) + 1;
P.Cargo_Sum := P.Cargo_Sum + 1;
P.Set_Mass (P.Mass + GESTE.Maths_Types.Value (Weight (Kind)));
end if;
end Put_In_Cargo;
-----------------
-- Empty_Cargo --
-----------------
procedure Empty_Cargo (This : in out Player_Type) is
begin
if This.Cash_In_TTL /= 0 then
-- Do not empty cargo when still showing previous cash operation
return;
end if;
This.Cash_In := 0;
for Kind in World.Valuable_Cell loop
P.Cash_In := P.Cash_In + P.Cargo (Kind) * Parameters.Value (Kind);
P.Cargo (Kind) := 0;
end loop;
if This.Cash_In = 0 then
return;
end if;
P.Money := P.Money + P.Cash_In;
-- How many frames the cash in text will be displayed
P.Cash_In_TTL := 30 * 1;
P.Cargo_Sum := 0;
P.Set_Mass (Parameters.Empty_Mass);
Sound.Play_Coin;
end Empty_Cargo;
------------
-- Refuel --
------------
procedure Refuel (This : in out Player_Type) is
use Parameters;
Tank_Capa : constant Float :=
Float (Tank_Capacity (This.Equip_Level (Tank)));
Amount : constant Float :=
Float'Min (Tank_Capa - P.Fuel,
Float (P.Money) / Parameters.Fuel_Price);
Cost : constant Natural := Natural (Amount * Parameters.Fuel_Price);
begin
if This.Cash_In_TTL /= 0 or else Amount = 0.0 then
-- Do not refuel when still showing previous cash operation
return;
end if;
if Cost <= This.Money then
P.Fuel := P.Fuel + Amount;
P.Money := P.Money - Cost;
P.Cash_In := -Cost;
P.Cash_In_TTL := 30 * 1;
end if;
end Refuel;
---------------
-- Try_Drill --
---------------
procedure Try_Drill is
use World;
use Parameters;
PX : constant Integer := Integer (P.Position.X);
PY : constant Integer := Integer (P.Position.Y);
CX : Integer := PX / Cell_Size;
CY : Integer := PY / Cell_Size;
Drill : Boolean := False;
begin
if Using_Drill and then Grounded then
if Going_Down and Collides (Drill_Bottom) then
CY := CY + 1;
Drill := True;
elsif Going_Left and Collides (Drill_Left) then
CX := CX - 1;
Drill := True;
elsif Going_Right and Collides (Drill_Right) then
CX := CX + 1;
Drill := True;
end if;
if Drill
and then
CX in 0 .. World.Ground_Width - 1
and then
CY in 0 .. World.Ground_Depth - 1
then
declare
Kind : constant Cell_Kind := Ground (CX + CY * Ground_Width);
begin
if (Kind /= Gold or else P.Equip_Level (Parameters.Drill) > 1)
and then
(Kind /= Diamond or else P.Equip_Level (Parameters.Drill) > 2)
and then
(Kind /= Rock or else P.Equip_Level (Parameters.Drill) = 7)
then
Sound.Play_Drill;
if Kind in World.Valuable_Cell then
P.Put_In_Cargo (Kind);
end if;
Drill_Anim.Target_CX := CX;
Drill_Anim.Target_CY := CY;
Drill_Anim.Origin_PX := Position.X;
Drill_Anim.Origin_PY := Position.Y;
Drill_Anim.In_Progress := True;
Drill_Anim.Steps := (case Kind is
when Dirt => 15,
when Coal => 20,
when Iron => 30,
when Gold => 40,
when Diamond => 50,
when Rock => 80,
when others => raise Program_Error);
-- Faster drilling with a better drill...
Drill_Anim.Steps :=
Drill_Anim.Steps / Natural (P.Equip_Level (Parameters.Drill));
Drill_Anim.Rem_Steps := Drill_Anim.Steps;
end if;
end;
end if;
end if;
end Try_Drill;
-----------------------
-- Update_Drill_Anim --
-----------------------
procedure Update_Drill_Anim is
use World;
D : Drill_Anim_Rec renames Drill_Anim;
Target_PX : constant Natural := D.Target_CX * Cell_Size + Cell_Size / 2;
Target_PY : constant Natural := D.Target_CY * Cell_Size + Cell_Size / 2;
Shaking : constant array (0 .. 9) of Integer :=
(1, 0, 0, 1, 0, 1, 1, 0, 1, 0);
begin
if D.Rem_Steps = 0 then
D.In_Progress := False;
Ground (D.Target_CX + D.Target_CY * Ground_Width) := Empty;
Move ((Target_PX, Target_PY));
Using_Drill := False;
-- Kill speed
P.Set_Speed ((GESTE.Maths_Types.Value (0.0),
GESTE.Maths_Types.Value (0.0)));
else
-- Consume Fuel
P.Fuel := P.Fuel - Parameters.Fuel_Per_Step;
declare
Percent : constant Float :=
Float (D.Rem_Steps) / Float (D.Steps);
DX : Integer :=
Integer (Percent * Float (Target_PX - D.Origin_PX));
DY : Integer :=
Integer (Percent * Float (Target_PY - D.Origin_PY));
begin
-- Add a little bit of shaking
DX := DX + Shaking (D.Rem_Steps mod Shaking'Length);
DY := DY + Shaking ((D.Rem_Steps + 2) mod Shaking'Length);
Move ((Target_PX - DX, Target_PY - DY));
D.Rem_Steps := D.Rem_Steps - 1;
end;
end if;
end Update_Drill_Anim;
-------------------
-- Update_Motion --
-------------------
procedure Update_Motion is
Old : constant Point := P.Position;
Elapsed : constant Value := Value (1.0 / 60.0);
Collision_To_Fix : Boolean;
begin
if Going_Right then
Facing_Left := False;
elsif Going_Left then
Facing_Left := True;
end if;
if P.Fuel <= 0.0 then
P.Fuel := 0.0;
Going_Up := False;
Going_Down := False;
Going_Left := False;
Going_Right := False;
end if;
-- Lateral movements
if Grounded then
if Going_Right then
P.Apply_Force ((100_000.0, 0.0));
elsif Going_Left then
P.Apply_Force ((-100_000.0, 0.0));
else
-- Friction on the floor
P.Apply_Force (
(Value (Value (-2000.0) * P.Speed.X),
0.0));
end if;
else
if Going_Right then
P.Apply_Force ((70_000.0, 0.0));
elsif Going_Left then
P.Apply_Force ((-70_000.0, 0.0));
end if;
end if;
-- Gavity
if not Grounded then
P.Apply_Gravity (-Parameters.Gravity);
end if;
if Going_Up then
-- Thrust
P.Apply_Force ((0.0,
-Value (Parameters.Engine_Thrust
(P.Equip_Level (Parameters.Engine)))));
end if;
P.Step (Elapsed);
Grounded := False;
Collision_To_Fix := False;
if P.Speed.Y < 0.0 then
-- Going up
if Collides (BB_Top) then
Collision_To_Fix := True;
-- Touching a roof, kill vertical speed
P.Set_Speed ((P.Speed.X, Value (0.0)));
-- Going back to previous Y coord
P.Set_Position ((P.Position.X, Old.Y));
end if;
elsif P.Speed.Y > 0.0 then
-- Going down
if Collides (BB_Bottom) then
Collision_To_Fix := True;
Grounded := True;
-- Touching the ground, kill vertical speed
P.Set_Speed ((P.Speed.X, Value (0.0)));
-- Going back to previous Y coord
P.Set_Position ((P.Position.X, Old.Y));
end if;
end if;
if P.Speed.X > 0.0 then
-- Going right
if Collides (BB_Right) then
Collision_To_Fix := True;
-- Touching a wall, kill horizontal speed
P.Set_Speed ((Value (0.0), P.Speed.Y));
-- Going back to previos X coord
P.Set_Position ((Old.X, P.Position.Y));
end if;
elsif P.Speed.X < 0.0 then
-- Going left
if Collides (BB_Left) then
Collision_To_Fix := True;
-- Touching a wall, kill horizontal speed
P.Set_Speed ((Value (0.0), P.Speed.Y));
-- Going back to previous X coord
P.Set_Position ((Old.X, P.Position.Y));
end if;
end if;
-- Fix the collisions, one pixel at a time
while Collision_To_Fix loop
Collision_To_Fix := False;
if Collides (BB_Top) then
Collision_To_Fix := True;
-- Try a new Y coord that do not collides
P.Set_Position ((P.Position.X, P.Position.Y + 1.0));
elsif Collides (BB_Bottom) then
Collision_To_Fix := True;
-- Try a new Y coord that do not collides
P.Set_Position ((P.Position.X, P.Position.Y - 1.0));
end if;
if Collides (BB_Right) then
Collision_To_Fix := True;
-- Try to find X coord that do not collides
P.Set_Position ((P.Position.X - 1.0, P.Position.Y));
elsif Collides (BB_Left) then
Collision_To_Fix := True;
-- Try to find X coord that do not collides
P.Set_Position ((P.Position.X + 1.0, P.Position.Y));
end if;
end loop;
-- Consume Fuel
if Going_Right or else Going_Left or else Going_Up then
P.Fuel := P.Fuel - Parameters.Fuel_Per_Step;
end if;
Try_Drill;
-- Market
if Integer (P.Position.Y) in 16 * 2 .. 16 * 3
and then
Integer (P.Position.X) in 16 * 15 .. 16 * 16
then
P.Empty_Cargo;
end if;
-- Fuel pump
if Integer (P.Position.Y) in 16 * 2 .. 16 * 3
and then
Integer (P.Position.X) in 16 * 5 .. 16 * 6
then
P.Refuel;
end if;
end Update_Motion;
------------
-- Update --
------------
procedure Update is
begin
if Drill_Anim.In_Progress then
Update_Drill_Anim;
else
Update_Motion;
end if;
Going_Up := False;
Going_Down := False;
Going_Left := False;
Going_Right := False;
Using_Drill := False;
end Update;
----------
-- Draw --
----------
procedure Draw_Hud (FB : in out HAL.UInt16_Array) is
use Parameters;
begin
Hud.Draw (FB,
P.Money,
Natural (P.Fuel),
Tank_Capacity (P.Equip_Level (Tank)),
P.Cargo_Sum,
Cargo_Capacity (P.Equip_Level (Cargo)),
(-Integer (P.Position.Y) / World.Cell_Size) + 2,
P.Cash_In);
if P.Cash_In_TTL > 0 then
P.Cash_In_TTL := P.Cash_In_TTL - 1;
else
P.Cash_In := 0;
end if;
end Draw_Hud;
-------------
-- Move_Up --
-------------
procedure Move_Up is
begin
Going_Up := True;
end Move_Up;
---------------
-- Move_Down --
---------------
procedure Move_Down is
begin
Going_Down := True;
end Move_Down;
---------------
-- Move_Left --
---------------
procedure Move_Left is
begin
Going_Left := True;
end Move_Left;
----------------
-- Move_Right --
----------------
procedure Move_Right is
begin
Going_Right := True;
end Move_Right;
----------------
-- Drill --
----------------
procedure Drill is
begin
Using_Drill := True;
end Drill;
end Player;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . C A L E N D A R --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2014, 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. --
-- --
-- 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 Interfaces.C.Extensions;
package body GNAT.Calendar is
use Ada.Calendar;
use Interfaces;
-----------------
-- Day_In_Year --
-----------------
function Day_In_Year (Date : Time) return Day_In_Year_Number is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Day_Secs : Day_Duration;
pragma Unreferenced (Day_Secs);
begin
Split (Date, Year, Month, Day, Day_Secs);
return Julian_Day (Year, Month, Day) - Julian_Day (Year, 1, 1) + 1;
end Day_In_Year;
-----------------
-- Day_Of_Week --
-----------------
function Day_Of_Week (Date : Time) return Day_Name is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Day_Secs : Day_Duration;
pragma Unreferenced (Day_Secs);
begin
Split (Date, Year, Month, Day, Day_Secs);
return Day_Name'Val ((Julian_Day (Year, Month, Day)) mod 7);
end Day_Of_Week;
----------
-- Hour --
----------
function Hour (Date : Time) return Hour_Number is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration;
pragma Unreferenced (Year, Month, Day, Minute, Second, Sub_Second);
begin
Split (Date, Year, Month, Day, Hour, Minute, Second, Sub_Second);
return Hour;
end Hour;
----------------
-- Julian_Day --
----------------
-- Julian_Day is used to by Day_Of_Week and Day_In_Year. Note that this
-- implementation is not expensive.
function Julian_Day
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number) return Integer
is
Internal_Year : Integer;
Internal_Month : Integer;
Internal_Day : Integer;
Julian_Date : Integer;
C : Integer;
Ya : Integer;
begin
Internal_Year := Integer (Year);
Internal_Month := Integer (Month);
Internal_Day := Integer (Day);
if Internal_Month > 2 then
Internal_Month := Internal_Month - 3;
else
Internal_Month := Internal_Month + 9;
Internal_Year := Internal_Year - 1;
end if;
C := Internal_Year / 100;
Ya := Internal_Year - (100 * C);
Julian_Date := (146_097 * C) / 4 +
(1_461 * Ya) / 4 +
(153 * Internal_Month + 2) / 5 +
Internal_Day + 1_721_119;
return Julian_Date;
end Julian_Day;
------------
-- Minute --
------------
function Minute (Date : Time) return Minute_Number is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration;
pragma Unreferenced (Year, Month, Day, Hour, Second, Sub_Second);
begin
Split (Date, Year, Month, Day, Hour, Minute, Second, Sub_Second);
return Minute;
end Minute;
------------
-- Second --
------------
function Second (Date : Time) return Second_Number is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration;
pragma Unreferenced (Year, Month, Day, Hour, Minute, Sub_Second);
begin
Split (Date, Year, Month, Day, Hour, Minute, Second, Sub_Second);
return Second;
end Second;
-----------
-- Split --
-----------
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration)
is
Day_Secs : Day_Duration;
Secs : Natural;
begin
Split (Date, Year, Month, Day, Day_Secs);
Secs := (if Day_Secs = 0.0 then 0 else Natural (Day_Secs - 0.5));
Sub_Second := Second_Duration (Day_Secs - Day_Duration (Secs));
Hour := Hour_Number (Secs / 3_600);
Secs := Secs mod 3_600;
Minute := Minute_Number (Secs / 60);
Second := Second_Number (Secs mod 60);
end Split;
---------------------
-- Split_At_Locale --
---------------------
procedure Split_At_Locale
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration)
is
procedure Ada_Calendar_Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Day_Secs : out Day_Duration;
Hour : out Integer;
Minute : out Integer;
Second : out Integer;
Sub_Sec : out Duration;
Leap_Sec : out Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer);
pragma Import (Ada, Ada_Calendar_Split, "__gnat_split");
Ds : Day_Duration;
Le : Boolean;
pragma Unreferenced (Ds, Le);
begin
-- Even though the input time zone is UTC (0), the flag Use_TZ will
-- ensure that Split picks up the local time zone.
Ada_Calendar_Split
(Date => Date,
Year => Year,
Month => Month,
Day => Day,
Day_Secs => Ds,
Hour => Hour,
Minute => Minute,
Second => Second,
Sub_Sec => Sub_Second,
Leap_Sec => Le,
Use_TZ => False,
Is_Historic => False,
Time_Zone => 0);
end Split_At_Locale;
----------------
-- Sub_Second --
----------------
function Sub_Second (Date : Time) return Second_Duration is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration;
pragma Unreferenced (Year, Month, Day, Hour, Minute, Second);
begin
Split (Date, Year, Month, Day, Hour, Minute, Second, Sub_Second);
return Sub_Second;
end Sub_Second;
-------------
-- Time_Of --
-------------
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration := 0.0) return Time
is
Day_Secs : constant Day_Duration :=
Day_Duration (Hour * 3_600) +
Day_Duration (Minute * 60) +
Day_Duration (Second) +
Sub_Second;
begin
return Time_Of (Year, Month, Day, Day_Secs);
end Time_Of;
-----------------------
-- Time_Of_At_Locale --
-----------------------
function Time_Of_At_Locale
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration := 0.0) return Time
is
function Ada_Calendar_Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Day_Secs : Day_Duration;
Hour : Integer;
Minute : Integer;
Second : Integer;
Sub_Sec : Duration;
Leap_Sec : Boolean;
Use_Day_Secs : Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer) return Time;
pragma Import (Ada, Ada_Calendar_Time_Of, "__gnat_time_of");
begin
-- Even though the input time zone is UTC (0), the flag Use_TZ will
-- ensure that Split picks up the local time zone.
return
Ada_Calendar_Time_Of
(Year => Year,
Month => Month,
Day => Day,
Day_Secs => 0.0,
Hour => Hour,
Minute => Minute,
Second => Second,
Sub_Sec => Sub_Second,
Leap_Sec => False,
Use_Day_Secs => False,
Use_TZ => False,
Is_Historic => False,
Time_Zone => 0);
end Time_Of_At_Locale;
-----------------
-- To_Duration --
-----------------
function To_Duration (T : not null access timeval) return Duration is
procedure timeval_to_duration
(T : not null access timeval;
sec : not null access C.Extensions.long_long;
usec : not null access C.long);
pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
Micro : constant := 10**6;
sec : aliased C.Extensions.long_long;
usec : aliased C.long;
begin
timeval_to_duration (T, sec'Access, usec'Access);
return Duration (sec) + Duration (usec) / Micro;
end To_Duration;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return timeval is
procedure duration_to_timeval
(Sec : C.Extensions.long_long;
Usec : C.long;
T : not null access timeval);
pragma Import (C, duration_to_timeval, "__gnat_duration_to_timeval");
Micro : constant := 10**6;
Result : aliased timeval;
sec : C.Extensions.long_long;
usec : C.long;
begin
if D = 0.0 then
sec := 0;
usec := 0;
else
sec := C.Extensions.long_long (D - 0.5);
usec := C.long ((D - Duration (sec)) * Micro - 0.5);
end if;
duration_to_timeval (sec, usec, Result'Access);
return Result;
end To_Timeval;
------------------
-- Week_In_Year --
------------------
function Week_In_Year (Date : Time) return Week_In_Year_Number is
Year : Year_Number;
Week : Week_In_Year_Number;
pragma Unreferenced (Year);
begin
Year_Week_In_Year (Date, Year, Week);
return Week;
end Week_In_Year;
-----------------------
-- Year_Week_In_Year --
-----------------------
procedure Year_Week_In_Year
(Date : Time;
Year : out Year_Number;
Week : out Week_In_Year_Number)
is
Month : Month_Number;
Day : Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration;
Jan_1 : Day_Name;
Shift : Week_In_Year_Number;
Start_Week : Week_In_Year_Number;
pragma Unreferenced (Hour, Minute, Second, Sub_Second);
function Is_Leap (Year : Year_Number) return Boolean;
-- Return True if Year denotes a leap year. Leap centennial years are
-- properly handled.
function Jan_1_Day_Of_Week
(Jan_1 : Day_Name;
Year : Year_Number;
Last_Year : Boolean := False;
Next_Year : Boolean := False) return Day_Name;
-- Given the weekday of January 1 in Year, determine the weekday on
-- which January 1 fell last year or will fall next year as set by
-- the two flags. This routine does not call Time_Of or Split.
function Last_Year_Has_53_Weeks
(Jan_1 : Day_Name;
Year : Year_Number) return Boolean;
-- Given the weekday of January 1 in Year, determine whether last year
-- has 53 weeks. A False value implies that the year has 52 weeks.
-------------
-- Is_Leap --
-------------
function Is_Leap (Year : Year_Number) return Boolean is
begin
if Year mod 400 = 0 then
return True;
elsif Year mod 100 = 0 then
return False;
else
return Year mod 4 = 0;
end if;
end Is_Leap;
-----------------------
-- Jan_1_Day_Of_Week --
-----------------------
function Jan_1_Day_Of_Week
(Jan_1 : Day_Name;
Year : Year_Number;
Last_Year : Boolean := False;
Next_Year : Boolean := False) return Day_Name
is
Shift : Integer := 0;
begin
if Last_Year then
Shift := (if Is_Leap (Year - 1) then -2 else -1);
elsif Next_Year then
Shift := (if Is_Leap (Year) then 2 else 1);
end if;
return Day_Name'Val ((Day_Name'Pos (Jan_1) + Shift) mod 7);
end Jan_1_Day_Of_Week;
----------------------------
-- Last_Year_Has_53_Weeks --
----------------------------
function Last_Year_Has_53_Weeks
(Jan_1 : Day_Name;
Year : Year_Number) return Boolean
is
Last_Jan_1 : constant Day_Name :=
Jan_1_Day_Of_Week (Jan_1, Year, Last_Year => True);
begin
-- These two cases are illustrated in the table below
return
Last_Jan_1 = Thursday
or else (Last_Jan_1 = Wednesday and then Is_Leap (Year - 1));
end Last_Year_Has_53_Weeks;
-- Start of processing for Week_In_Year
begin
Split (Date, Year, Month, Day, Hour, Minute, Second, Sub_Second);
-- According to ISO 8601, the first week of year Y is the week that
-- contains the first Thursday in year Y. The following table contains
-- all possible combinations of years and weekdays along with examples.
-- +-------+------+-------+---------+
-- | Jan 1 | Leap | Weeks | Example |
-- +-------+------+-------+---------+
-- | Mon | No | 52 | 2007 |
-- +-------+------+-------+---------+
-- | Mon | Yes | 52 | 1996 |
-- +-------+------+-------+---------+
-- | Tue | No | 52 | 2002 |
-- +-------+------+-------+---------+
-- | Tue | Yes | 52 | 1980 |
-- +-------+------+-------+---------+
-- | Wed | No | 52 | 2003 |
-- +-------+------#########---------+
-- | Wed | Yes # 53 # 1992 |
-- +-------+------#-------#---------+
-- | Thu | No # 53 # 1998 |
-- +-------+------#-------#---------+
-- | Thu | Yes # 53 # 2004 |
-- +-------+------#########---------+
-- | Fri | No | 52 | 1999 |
-- +-------+------+-------+---------+
-- | Fri | Yes | 52 | 1988 |
-- +-------+------+-------+---------+
-- | Sat | No | 52 | 1994 |
-- +-------+------+-------+---------+
-- | Sat | Yes | 52 | 1972 |
-- +-------+------+-------+---------+
-- | Sun | No | 52 | 1995 |
-- +-------+------+-------+---------+
-- | Sun | Yes | 52 | 1956 |
-- +-------+------+-------+---------+
-- A small optimization, the input date is January 1. Note that this
-- is a key day since it determines the number of weeks and is used
-- when special casing the first week of January and the last week of
-- December.
Jan_1 := Day_Of_Week (if Day = 1 and then Month = 1
then Date
else (Time_Of (Year, 1, 1, 0.0)));
-- Special cases for January
if Month = 1 then
-- Special case 1: January 1, 2 and 3. These three days may belong
-- to last year's last week which can be week number 52 or 53.
-- +-----+-----+-----+=====+-----+-----+-----+
-- | Mon | Tue | Wed # Thu # Fri | Sat | Sun |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 26 | 27 | 28 # 29 # 30 | 31 | 1 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 27 | 28 | 29 # 30 # 31 | 1 | 2 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 28 | 29 | 30 # 31 # 1 | 2 | 3 |
-- +-----+-----+-----+=====+-----+-----+-----+
if (Day = 1 and then Jan_1 in Friday .. Sunday)
or else
(Day = 2 and then Jan_1 in Friday .. Saturday)
or else
(Day = 3 and then Jan_1 = Friday)
then
Week := (if Last_Year_Has_53_Weeks (Jan_1, Year) then 53 else 52);
-- January 1, 2 and 3 belong to the previous year
Year := Year - 1;
return;
-- Special case 2: January 1, 2, 3, 4, 5, 6 and 7 of the first week
-- +-----+-----+-----+=====+-----+-----+-----+
-- | Mon | Tue | Wed # Thu # Fri | Sat | Sun |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 29 | 30 | 31 # 1 # 2 | 3 | 4 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 30 | 31 | 1 # 2 # 3 | 4 | 5 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 31 | 1 | 2 # 3 # 4 | 5 | 6 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 1 | 2 | 3 # 4 # 5 | 6 | 7 |
-- +-----+-----+-----+=====+-----+-----+-----+
elsif (Day <= 4 and then Jan_1 in Monday .. Thursday)
or else
(Day = 5 and then Jan_1 in Monday .. Wednesday)
or else
(Day = 6 and then Jan_1 in Monday .. Tuesday)
or else
(Day = 7 and then Jan_1 = Monday)
then
Week := 1;
return;
end if;
-- Month other than 1
-- Special case 3: December 29, 30 and 31. These days may belong to
-- next year's first week.
-- +-----+-----+-----+=====+-----+-----+-----+
-- | Mon | Tue | Wed # Thu # Fri | Sat | Sun |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 29 | 30 | 31 # 1 # 2 | 3 | 4 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 30 | 31 | 1 # 2 # 3 | 4 | 5 |
-- +-----+-----+-----+-----+-----+-----+-----+
-- | 31 | 1 | 2 # 3 # 4 | 5 | 6 |
-- +-----+-----+-----+=====+-----+-----+-----+
elsif Month = 12 and then Day > 28 then
declare
Next_Jan_1 : constant Day_Name :=
Jan_1_Day_Of_Week (Jan_1, Year, Next_Year => True);
begin
if (Day = 29 and then Next_Jan_1 = Thursday)
or else
(Day = 30 and then Next_Jan_1 in Wednesday .. Thursday)
or else
(Day = 31 and then Next_Jan_1 in Tuesday .. Thursday)
then
Year := Year + 1;
Week := 1;
return;
end if;
end;
end if;
-- Determine the week from which to start counting. If January 1 does
-- not belong to the first week of the input year, then the next week
-- is the first week.
Start_Week := (if Jan_1 in Friday .. Sunday then 1 else 2);
-- At this point all special combinations have been accounted for and
-- the proper start week has been found. Since January 1 may not fall
-- on a Monday, shift 7 - Day_Name'Pos (Jan_1). This action ensures an
-- origin which falls on Monday.
Shift := 7 - Day_Name'Pos (Jan_1);
Week := Start_Week + (Day_In_Year (Date) - Shift - 1) / 7;
end Year_Week_In_Year;
end GNAT.Calendar;
|
with OpenAL.Buffer;
with OpenAL.Types;
package OpenAL.Extension.Float32 is
function Is_Present return Boolean;
--
-- This will most likely result in an IEEE single precision float
-- on the majority of platforms.
--
type Sample_Float_32_t is digits 6;
for Sample_Float_32_t'Size use 32;
type Sample_Array_Float_32_t is
array (Buffer.Sample_Size_t range <>) of aliased Sample_Float_32_t;
-- proc_map : alBufferData
procedure Set_Data_Mono_Float_32
(Buffer : in OpenAL.Buffer.Buffer_t;
Data : in Sample_Array_Float_32_t;
Frequency : in Types.Frequency_t);
-- proc_map : alBufferData
procedure Set_Data_Stereo_Float_32
(Buffer : in OpenAL.Buffer.Buffer_t;
Data : in Sample_Array_Float_32_t;
Frequency : in Types.Frequency_t);
end OpenAL.Extension.Float32;
|
with Ada.Text_IO, Ada.Integer_Text_IO, Datos;
use Datos;
procedure Esc ( L : in Lista ) is
-- pre:
-- post: Escribir el contenido de una lista
Actual : Lista;
begin
Ada.Text_Io.New_Line;
Ada.Text_Io.New_Line;
Ada.Text_Io.Put("el contenido de la lista es: ");
Ada.Text_Io.New_Line;
Ada.Text_Io.Put(" <");
Ada.Text_Io.New_Line;
Actual:= L;
while Actual /= null loop -- Igual: loop exit when Actual=null
Ada.Integer_Text_Io.Put(Actual.Info);
Ada.Text_Io.New_Line;
Actual:= Actual.Sig;
end loop;
Ada.Text_Io.Put(" >");
Ada.Text_Io.New_Line;
end Esc;
|
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_SDL_stdinc_h;
package SDL_SDL_active_h is
SDL_APPMOUSEFOCUS : constant := 16#01#; -- ../include/SDL/SDL_active.h:42
SDL_APPINPUTFOCUS : constant := 16#02#; -- ../include/SDL/SDL_active.h:43
SDL_APPACTIVE : constant := 16#04#; -- ../include/SDL/SDL_active.h:44
function SDL_GetAppState return SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_active.h:54
pragma Import (C, SDL_GetAppState, "SDL_GetAppState");
end SDL_SDL_active_h;
|
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure tuple is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
type tuple_int_int;
type tuple_int_int_PTR is access tuple_int_int;
type tuple_int_int is record
tuple_int_int_field_0 : Integer;
tuple_int_int_field_1 : Integer;
end record;
function f(tuple0 : in tuple_int_int_PTR) return tuple_int_int_PTR is
d : tuple_int_int_PTR;
c : tuple_int_int_PTR;
b : Integer;
a : Integer;
begin
c := tuple0;
a := c.tuple_int_int_field_0;
b := c.tuple_int_int_field_1;
d := new tuple_int_int;
d.tuple_int_int_field_0 := a + 1;
d.tuple_int_int_field_1 := b + 1;
return d;
end;
t : tuple_int_int_PTR;
g : tuple_int_int_PTR;
e : tuple_int_int_PTR;
b : Integer;
a : Integer;
begin
e := new tuple_int_int;
e.tuple_int_int_field_0 := 0;
e.tuple_int_int_field_1 := 1;
t := f(e);
g := t;
a := g.tuple_int_int_field_0;
b := g.tuple_int_int_field_1;
PInt(a);
PString(new char_array'( To_C(" -- ")));
PInt(b);
PString(new char_array'( To_C("--" & Character'Val(10))));
end;
|
with
any_Math.any_Geometry.any_d3.any_Modeller.any_Forge;
package float_math.Geometry.d3.Modeller.Forge is new float_Math.Geometry.d3.Modeller.any_Forge;
|
with Renaming8_Pkg2; use Renaming8_Pkg2;
package Renaming8_Pkg1 is
B: Boolean renames F.E(1);
end Renaming8_Pkg1;
|
-----------------------------------------------------------------------
-- gen-artifacts-hibernate -- Hibernate artifact for Code Generator
-- Copyright (C) 2011 - 2021 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Directories;
with Ada.Exceptions;
with Ada.Containers;
with Gen.Configs;
with Gen.Utils;
with Gen.Model.Enums;
with Gen.Model.Tables;
with Gen.Model.Projects;
with Gen.Model.Mappings;
with Util.Files;
with Util.Log.Loggers;
with Util.Strings.Sets;
with Util.Encoders;
package body Gen.Artifacts.Hibernate is
use Ada.Strings.Unbounded;
use Gen.Model;
use Gen.Model.Enums;
use Gen.Model.Tables;
use Gen.Configs;
use type DOM.Core.Node;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Gen.Artifacts.Hibernate");
-- ------------------------------
-- After the configuration file is read, processes the node whose root
-- is passed in <b>Node</b> and initializes the <b>Model</b> with the information.
-- ------------------------------
overriding
procedure Initialize (Handler : in out Artifact;
Path : in String;
Node : in DOM.Core.Node;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Context : in out Generator'Class) is
procedure Register_Mapping (Model : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
-- Register the column definition in the table
procedure Register_Column (Table : in out Table_Definition;
Column : in DOM.Core.Node);
-- Register the association definition in the table
procedure Register_Association (Table : in out Table_Definition;
Column : in DOM.Core.Node);
-- Register all the columns defined in the table
procedure Register_Columns (Table : in out Table_Definition;
Node : in DOM.Core.Node);
procedure Register_Class (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
-- Register a new enum definition in the model.
procedure Register_Enum (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
-- Register the value definition in the enum
procedure Register_Enum_Value (Enum : in out Enum_Definition;
Value : in DOM.Core.Node);
Is_Version : Boolean := False;
Is_Key : Boolean := False;
-- ------------------------------
-- Register the column definition in the table
-- ------------------------------
procedure Register_Column (Table : in out Table_Definition;
Column : in DOM.Core.Node) is
Name : constant UString := Gen.Utils.Get_Attribute (Column, "name");
G : constant DOM.Core.Node := Gen.Utils.Get_Child (Column, "generator");
C : Column_Definition_Access;
begin
Table.Add_Column (Name, C);
C.Initialize (Name, Column);
C.Set_Location (Path);
C.Is_Inserted := Gen.Utils.Get_Attribute (Column, "insert", True);
C.Is_Updated := Gen.Utils.Get_Attribute (Column, "update", True);
C.Is_Version := Is_Version;
C.Is_Key := Is_Key;
if G /= null then
C.Generator := Gen.Utils.Get_Attribute (G, "class");
end if;
-- Get the SQL mapping from an optional <column> element.
declare
N : DOM.Core.Node := Gen.Utils.Get_Child (Column, "column");
T : constant DOM.Core.Node := Gen.Utils.Get_Child (Column, "type");
begin
if T /= null then
C.Set_Type (Gen.Utils.Get_Normalized_Type (T, "name"));
else
C.Set_Type (Gen.Utils.Get_Normalized_Type (Column, "type"));
end if;
Log.Debug ("Register column {0} of type {1}", Name, To_String (C.Type_Name));
if N /= null then
C.Sql_Name := Gen.Utils.Get_Attribute (N, "name");
C.Sql_Type := Gen.Utils.Get_Attribute (N, "sql-type");
else
N := Column;
C.Sql_Name := Gen.Utils.Get_Attribute (N, "column");
C.Sql_Type := C.Type_Name;
end if;
if C.Is_Version then
C.Not_Null := True;
else
C.Not_Null := Gen.Utils.Get_Attribute (N, "not-null");
end if;
C.Unique := Gen.Utils.Get_Attribute (N, "unique");
end;
end Register_Column;
-- ------------------------------
-- Register the association definition in the table
-- ------------------------------
procedure Register_Association (Table : in out Table_Definition;
Column : in DOM.Core.Node) is
Name : constant UString := Gen.Utils.Get_Attribute (Column, "name");
C : Association_Definition_Access;
begin
Log.Debug ("Register association {0}", Name);
Table.Add_Association (Name, C);
C.Initialize (Name, Column);
C.Set_Location (Path);
-- Get the SQL mapping from an optional <column> element.
declare
N : DOM.Core.Node := Gen.Utils.Get_Child (Column, "column");
begin
C.Set_Type (Gen.Utils.Get_Attribute (Column, "class"));
if N /= null then
C.Sql_Name := Gen.Utils.Get_Attribute (N, "name");
C.Sql_Type := Gen.Utils.Get_Attribute (N, "sql-type");
else
N := Column;
C.Sql_Name := Gen.Utils.Get_Attribute (N, "column");
C.Sql_Type := C.Type_Name;
end if;
C.Not_Null := Gen.Utils.Get_Attribute (N, "not-null");
C.Unique := Gen.Utils.Get_Attribute (N, "unique");
end;
end Register_Association;
-- ------------------------------
-- Register all the columns defined in the table
-- ------------------------------
procedure Register_Columns (Table : in out Table_Definition;
Node : in DOM.Core.Node) is
procedure Iterate is
new Gen.Utils.Iterate_Nodes (T => Table_Definition,
Process => Register_Column);
procedure Iterate_Association is
new Gen.Utils.Iterate_Nodes (T => Table_Definition,
Process => Register_Association);
begin
Log.Debug ("Register columns from table {0}", Table.Name);
Is_Key := True;
Is_Version := False;
Iterate (Table, Node, "id");
Is_Key := False;
Is_Version := True;
Iterate (Table, Node, "version");
Is_Key := False;
Is_Version := False;
Iterate (Table, Node, "property");
Iterate_Association (Table, Node, "many-to-one");
end Register_Columns;
-- ------------------------------
-- Register a new class definition in the model.
-- ------------------------------
procedure Register_Class (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
Name : constant UString := Gen.Utils.Get_Attribute (Node, "name");
Table_Name : constant UString := Gen.Utils.Get_Attribute (Node, "table");
Table : constant Table_Definition_Access := Gen.Model.Tables.Create_Table (Name);
begin
Table.Initialize (Name, Node);
Table.Set_Location (Path);
Log.Debug ("Register class {0}", Table.Name);
if Length (Table_Name) > 0 then
Table.Table_Name := Table_Name;
end if;
Table.Has_List := Gen.Utils.Get_Attribute (Node, "list", True);
O.Register_Table (Table);
Register_Columns (Table_Definition (Table.all), Node);
end Register_Class;
-- ------------------------------
-- Register the value definition in the enum
-- ------------------------------
procedure Register_Enum_Value (Enum : in out Enum_Definition;
Value : in DOM.Core.Node) is
Name : constant UString := Gen.Utils.Get_Attribute (Value, "name");
V : Value_Definition_Access;
begin
Log.Debug ("Register enum value {0}", Name);
Enum.Add_Value (To_String (Name), V);
end Register_Enum_Value;
-- ------------------------------
-- Register a new enum definition in the model.
-- ------------------------------
procedure Register_Enum (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
procedure Iterate is
new Gen.Utils.Iterate_Nodes (T => Enum_Definition,
Process => Register_Enum_Value);
Name : constant UString := Gen.Utils.Get_Attribute (Node, "name");
Enum : constant Enum_Definition_Access := Gen.Model.Enums.Create_Enum (Name);
begin
Enum.Initialize (Name, Node);
Enum.Set_Location (Path);
Log.Debug ("Register enum {0}", Enum.Name);
O.Register_Enum (Enum);
Log.Debug ("Register enum values from enum {0}", Enum.Name);
Iterate (Enum_Definition (Enum.all), Node, "value");
end Register_Enum;
-- ------------------------------
-- Register a model mapping
-- ------------------------------
procedure Register_Mapping (Model : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
procedure Iterate is
new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Class);
procedure Iterate_Enum is
new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Enum);
begin
Iterate_Enum (Model, Node, "enum");
Iterate (Model, Node, "class");
Iterate (Model, Node, "subclass");
end Register_Mapping;
procedure Iterate is new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Mapping);
begin
Log.Debug ("Initializing hibernate artifact for the configuration");
Gen.Artifacts.Artifact (Handler).Initialize (Path, Node, Model, Context);
Iterate (Gen.Model.Packages.Model_Definition (Model), Node, "hibernate-mapping");
exception
when E : Name_Exist =>
Context.Error (Ada.Exceptions.Exception_Message (E));
end Initialize;
-- ------------------------------
-- Prepare the generation of the package:
-- o identify the column types which are used
-- o build a list of package for the with clauses.
-- ------------------------------
overriding
procedure Prepare (Handler : in out Artifact;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Project : in out Gen.Model.Projects.Project_Definition'Class;
Context : in out Generator'Class) is
pragma Unreferenced (Handler);
begin
Log.Debug ("Preparing the model for hibernate");
if Model.Has_Packages then
Context.Add_Generation (Name => GEN_PACKAGE_SPEC, Mode => ITERATION_PACKAGE,
Mapping => Gen.Model.Mappings.ADA_MAPPING);
Context.Add_Generation (Name => GEN_PACKAGE_BODY, Mode => ITERATION_PACKAGE,
Mapping => Gen.Model.Mappings.ADA_MAPPING);
if Project.Use_Mysql then
Context.Add_Generation (Name => GEN_MYSQL_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.MySQL_MAPPING);
Context.Add_Generation (Name => GEN_MYSQL_DROP_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.MySQL_MAPPING);
end if;
if Project.Use_Sqlite then
Context.Add_Generation (Name => GEN_SQLITE_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.SQLite_MAPPING);
Context.Add_Generation (Name => GEN_SQLITE_DROP_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.SQLite_MAPPING);
end if;
if Project.Use_Postgresql then
Context.Add_Generation (Name => GEN_POSTGRESQL_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.Postgresql_MAPPING);
Context.Add_Generation (Name => GEN_POSTGRESQL_DROP_SQL_FILE, Mode => ITERATION_TABLE,
Mapping => Gen.Model.Mappings.Postgresql_MAPPING);
end if;
end if;
end Prepare;
-- ------------------------------
-- After the generation, perform a finalization step for the generation process.
-- For each database SQL mapping, collect the schema files from the different modules
-- of the project and generate an SQL script that can be used to create the database tables.
-- ------------------------------
overriding
procedure Finish (Handler : in out Artifact;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Project : in out Gen.Model.Projects.Project_Definition'Class;
Context : in out Generator'Class) is
pragma Unreferenced (Handler, Context);
procedure Collect_SQL (Project : in Gen.Model.Projects.Project_Definition'Class;
Dir : in String;
Driver : in String;
Prefix : in String;
Dynamo : in String;
Content : in out UString);
procedure Build_SQL_Schemas (Driver : in String;
Prefix : in String;
Name : in String;
Is_Reverse : in Boolean);
procedure Print_Info;
use Util.Encoders;
SQL_Content : UString;
-- SHA for each SQL content that is appended in the SQL content.
-- This is used to avoid appending the same SQL file several times in the final SQL file.
-- (this happens due to the SQL path being different in some cases)
SHA_Files : Util.Strings.Sets.Set;
SHA_Encoder : constant Encoder := Util.Encoders.Create (Util.Encoders.HASH_SHA1);
-- The module names whose data model is imported by the current project.
-- This is only used to report a message to the user.
Modules : Util.Strings.Sets.Set;
Model_Dir : constant String := Model.Get_Model_Directory;
-- ------------------------------
-- Check if an SQL file exists for the given driver. If such file exist,
-- read the content and append it to the <b>Content</b> buffer.
-- ------------------------------
procedure Collect_SQL (Project : in Gen.Model.Projects.Project_Definition'Class;
Dir : in String;
Driver : in String;
Prefix : in String;
Dynamo : in String;
Content : in out UString) is
Name : constant String := Project.Get_Project_Name;
Dir2 : constant String := Util.Files.Compose (Dir, Driver);
Path : constant String := Util.Files.Compose (Dir2, Name & "-"
& Prefix & Driver & ".sql");
SQL : UString;
begin
Log.Debug ("Checking SQL file {0}", Path);
if Ada.Directories.Exists (Path) then
Util.Files.Read_File (Path => Path,
Into => SQL);
declare
H : constant String := SHA_Encoder.Encode (To_String (SQL));
begin
if not SHA_Files.Contains (H) then
if Dynamo'Length > 0 then
Modules.Include (Dynamo);
end if;
SHA_Files.Include (H);
Append (Content, "/* Copied from ");
Append (Content, Ada.Directories.Simple_Name (Path));
Append (Content, "*/");
Append (Content, ASCII.LF);
Append (Content, SQL);
end if;
end;
end if;
end Collect_SQL;
-- ------------------------------
-- Collect the SQL schemas defined by the projects and modules used by the main project.
-- ------------------------------
procedure Build_SQL_Schemas (Driver : in String;
Prefix : in String;
Name : in String;
Is_Reverse : in Boolean) is
use type Gen.Model.Projects.Project_Definition_Access;
Out_Dir : constant String := Util.Files.Compose (Model_Dir, Driver);
Path : constant String := Util.Files.Compose (Out_Dir, Name);
Pos : Integer;
Incr : Integer;
begin
SQL_Content := Null_Unbounded_String;
SHA_Files.Clear;
if Driver = "sqlite" then
Append (SQL_Content, "pragma synchronous=OFF;" & ASCII.LF);
end if;
if Prefix = "" then
Collect_SQL (Project, Model_Dir, Driver, "pre-", "", SQL_Content);
end if;
if Is_Reverse then
Pos := Project.Dynamo_Files.Last_Index;
Incr := -1;
Collect_SQL (Project, Model_Dir, Driver, Prefix, "", SQL_Content);
else
Pos := Project.Dynamo_Files.First_Index;
Incr := 1;
end if;
while Pos >= Project.Dynamo_Files.First_Index
and Pos <= Project.Dynamo_Files.Last_Index loop
declare
Name : constant String := Project.Dynamo_Files.Element (Pos);
Prj : constant Gen.Model.Projects.Project_Definition_Access
:= Project.Find_Project (Name);
begin
Log.Debug ("Checking project {0}", Name);
if Prj /= null then
Collect_SQL (Prj.all, Prj.Get_Database_Dir, Driver,
Prefix, Name, SQL_Content);
end if;
end;
Pos := Pos + Incr;
end loop;
if not Is_Reverse then
Collect_SQL (Project, Model_Dir, Driver, Prefix, "", SQL_Content);
end if;
if Prefix = "" then
Collect_SQL (Project, Model_Dir, Driver, "init-", "", SQL_Content);
end if;
Log.Info ("Generating " & Driver & " creation schema in '{0}'",
Path & "-" & Driver & ".sql");
Util.Files.Write_File (Path => Path & "-" & Driver & ".sql",
Content => SQL_Content);
end Build_SQL_Schemas;
-- ------------------------------
-- Print information about the generated SQLfiles.
-- ------------------------------
procedure Print_Info is
Iter : Util.Strings.Sets.Cursor := Modules.First;
begin
if Util.Strings.Sets.Has_Element (Iter) then
Log.Info ("Generated the SQL model from{0} Dynamo projects: ",
Ada.Containers.Count_Type'Image (Modules.Length));
while Util.Strings.Sets.Has_Element (Iter) loop
Log.Info (" {0}", Util.Strings.Sets.Element (Iter));
Util.Strings.Sets.Next (Iter);
end loop;
end if;
end Print_Info;
Name : constant String := Project.Get_Project_Name;
begin
if not Project.Is_Plugin then
if Project.Use_Mysql then
Build_SQL_Schemas ("mysql", "", "create-" & Name, False);
end if;
if Project.Use_Postgresql then
Build_SQL_Schemas ("postgresql", "", "create-" & Name, False);
end if;
if Project.Use_Sqlite then
Build_SQL_Schemas ("sqlite", "", "create-" & Name, False);
end if;
if Project.Use_Mysql then
Build_SQL_Schemas ("mysql", "drop-", "drop-" & Name, True);
end if;
if Project.Use_Postgresql then
Build_SQL_Schemas ("postgresql", "drop-", "drop-" & Name, True);
end if;
if Project.Use_Sqlite then
Build_SQL_Schemas ("sqlite", "drop-", "drop-" & Name, True);
end if;
Print_Info;
end if;
end Finish;
end Gen.Artifacts.Hibernate;
|
package Pack8_Pkg is
N : Natural := 1;
end Pack8_Pkg;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Operations is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Operation_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Operation
(AMF.UML.Operations.UML_Operation_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Operation_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Operation
(AMF.UML.Operations.UML_Operation_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Return_Result --
-------------------
overriding function Return_Result
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Parameters.Collections.Set_Of_UML_Parameter
is
use type AMF.UML.UML_Parameter_Direction_Kind;
Parameters : constant
AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter
:= Self.Get_Owned_Parameter;
The_Parameter : AMF.UML.Parameters.UML_Parameter_Access;
begin
return Result : AMF.UML.Parameters.Collections.Set_Of_UML_Parameter do
for J in 1 .. Parameters.Length loop
The_Parameter := Parameters.Element (J);
if The_Parameter.Get_Direction = AMF.UML.Return_Parameter then
Result.Add (The_Parameter);
end if;
end loop;
end return;
end Return_Result;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Operation_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Operation
(Visitor,
AMF.UML.Operations.UML_Operation_Access (Self),
Control);
end if;
end Visit_Element;
------------------------
-- Get_Body_Condition --
------------------------
overriding function Get_Body_Condition
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Constraints.UML_Constraint_Access is
begin
return
AMF.UML.Constraints.UML_Constraint_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Body_Condition
(Self.Element)));
end Get_Body_Condition;
------------------------
-- Set_Body_Condition --
------------------------
overriding procedure Set_Body_Condition
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Constraints.UML_Constraint_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Body_Condition
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Body_Condition;
---------------
-- Get_Class --
---------------
overriding function Get_Class
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Classes.UML_Class_Access is
begin
return
AMF.UML.Classes.UML_Class_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Class
(Self.Element)));
end Get_Class;
---------------
-- Set_Class --
---------------
overriding procedure Set_Class
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Classes.UML_Class_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Class
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Class;
------------------
-- Get_Datatype --
------------------
overriding function Get_Datatype
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Data_Types.UML_Data_Type_Access is
begin
return
AMF.UML.Data_Types.UML_Data_Type_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Datatype
(Self.Element)));
end Get_Datatype;
------------------
-- Set_Datatype --
------------------
overriding procedure Set_Datatype
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Data_Types.UML_Data_Type_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Datatype
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Datatype;
-------------------
-- Get_Interface --
-------------------
overriding function Get_Interface
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Interfaces.UML_Interface_Access is
begin
return
AMF.UML.Interfaces.UML_Interface_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface
(Self.Element)));
end Get_Interface;
-------------------
-- Set_Interface --
-------------------
overriding procedure Set_Interface
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Interfaces.UML_Interface_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Interface
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Interface;
--------------------
-- Get_Is_Ordered --
--------------------
overriding function Get_Is_Ordered
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Ordered
(Self.Element);
end Get_Is_Ordered;
------------------
-- Get_Is_Query --
------------------
overriding function Get_Is_Query
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Query
(Self.Element);
end Get_Is_Query;
------------------
-- Set_Is_Query --
------------------
overriding procedure Set_Is_Query
(Self : not null access UML_Operation_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Query
(Self.Element, To);
end Set_Is_Query;
-------------------
-- Get_Is_Unique --
-------------------
overriding function Get_Is_Unique
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Unique
(Self.Element);
end Get_Is_Unique;
---------------
-- Get_Lower --
---------------
overriding function Get_Lower
(Self : not null access constant UML_Operation_Proxy)
return AMF.Optional_Integer is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Lower
(Self.Element);
end Get_Lower;
-------------------------
-- Get_Owned_Parameter --
-------------------------
overriding function Get_Owned_Parameter
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is
begin
return
AMF.UML.Parameters.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter
(Self.Element)));
end Get_Owned_Parameter;
-----------------------
-- Get_Postcondition --
-----------------------
overriding function Get_Postcondition
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Postcondition
(Self.Element)));
end Get_Postcondition;
----------------------
-- Get_Precondition --
----------------------
overriding function Get_Precondition
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Precondition
(Self.Element)));
end Get_Precondition;
--------------------------
-- Get_Raised_Exception --
--------------------------
overriding function Get_Raised_Exception
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Types.Collections.Set_Of_UML_Type is
begin
return
AMF.UML.Types.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Raised_Exception
(Self.Element)));
end Get_Raised_Exception;
-----------------------------
-- Get_Redefined_Operation --
-----------------------------
overriding function Get_Redefined_Operation
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Operations.Collections.Set_Of_UML_Operation is
begin
return
AMF.UML.Operations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Operation
(Self.Element)));
end Get_Redefined_Operation;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access is
begin
return
AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Types.UML_Type_Access is
begin
return
AMF.UML.Types.UML_Type_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Type
(Self.Element)));
end Get_Type;
---------------
-- Get_Upper --
---------------
overriding function Get_Upper
(Self : not null access constant UML_Operation_Proxy)
return AMF.Optional_Unlimited_Natural is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Upper
(Self.Element);
end Get_Upper;
---------------------
-- Get_Concurrency --
---------------------
overriding function Get_Concurrency
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.UML_Call_Concurrency_Kind is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Concurrency
(Self.Element);
end Get_Concurrency;
---------------------
-- Set_Concurrency --
---------------------
overriding procedure Set_Concurrency
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.UML_Call_Concurrency_Kind) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Concurrency
(Self.Element, To);
end Set_Concurrency;
---------------------
-- Get_Is_Abstract --
---------------------
overriding function Get_Is_Abstract
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract
(Self.Element);
end Get_Is_Abstract;
---------------------
-- Set_Is_Abstract --
---------------------
overriding procedure Set_Is_Abstract
(Self : not null access UML_Operation_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Abstract
(Self.Element, To);
end Set_Is_Abstract;
----------------
-- Get_Method --
----------------
overriding function Get_Method
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is
begin
return
AMF.UML.Behaviors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Method
(Self.Element)));
end Get_Method;
-----------------------------
-- Get_Owned_Parameter_Set --
-----------------------------
overriding function Get_Owned_Parameter_Set
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set is
begin
return
AMF.UML.Parameter_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter_Set
(Self.Element)));
end Get_Owned_Parameter_Set;
------------------------------
-- Get_Featuring_Classifier --
------------------------------
overriding function Get_Featuring_Classifier
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Featuring_Classifier
(Self.Element)));
end Get_Featuring_Classifier;
-------------------
-- Get_Is_Static --
-------------------
overriding function Get_Is_Static
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Static
(Self.Element);
end Get_Is_Static;
-------------------
-- Set_Is_Static --
-------------------
overriding procedure Set_Is_Static
(Self : not null access UML_Operation_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Static
(Self.Element, To);
end Set_Is_Static;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Operation_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Operation_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
------------------------
-- Get_Element_Import --
------------------------
overriding function Get_Element_Import
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is
begin
return
AMF.UML.Element_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import
(Self.Element)));
end Get_Element_Import;
-------------------------
-- Get_Imported_Member --
-------------------------
overriding function Get_Imported_Member
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
return
AMF.UML.Packageable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member
(Self.Element)));
end Get_Imported_Member;
----------------
-- Get_Member --
----------------
overriding function Get_Member
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Member
(Self.Element)));
end Get_Member;
----------------------
-- Get_Owned_Member --
----------------------
overriding function Get_Owned_Member
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member
(Self.Element)));
end Get_Owned_Member;
--------------------
-- Get_Owned_Rule --
--------------------
overriding function Get_Owned_Rule
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule
(Self.Element)));
end Get_Owned_Rule;
------------------------
-- Get_Package_Import --
------------------------
overriding function Get_Package_Import
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is
begin
return
AMF.UML.Package_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import
(Self.Element)));
end Get_Package_Import;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
begin
return
AMF.UML.Template_Signatures.UML_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
--------------------------
-- Get_Template_Binding --
--------------------------
overriding function Get_Template_Binding
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is
begin
return
AMF.UML.Template_Bindings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding
(Self.Element)));
end Get_Template_Binding;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Operation_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Operation_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
----------------
-- Is_Ordered --
----------------
overriding function Is_Ordered
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Ordered unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Ordered";
return Is_Ordered (Self);
end Is_Ordered;
---------------
-- Is_Unique --
---------------
overriding function Is_Unique
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Unique unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Unique";
return Is_Unique (Self);
end Is_Unique;
-----------
-- Lower --
-----------
overriding function Lower
(Self : not null access constant UML_Operation_Proxy)
return Integer is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Lower unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Lower";
return Lower (Self);
end Lower;
-----------
-- Types --
-----------
overriding function Types
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Types.UML_Type_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Types unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Types";
return Types (Self);
end Types;
-----------
-- Upper --
-----------
overriding function Upper
(Self : not null access constant UML_Operation_Proxy)
return AMF.Unlimited_Natural is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Upper unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Upper";
return Upper (Self);
end Upper;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Operation_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Operation_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Namespace";
return Namespace (Self);
end Namespace;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant UML_Operation_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Exclude_Collisions";
return Exclude_Collisions (Self, Imps);
end Exclude_Collisions;
-------------------------
-- Get_Names_Of_Member --
-------------------------
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Operation_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Get_Names_Of_Member";
return Get_Names_Of_Member (Self, Element);
end Get_Names_Of_Member;
--------------------
-- Import_Members --
--------------------
overriding function Import_Members
(Self : not null access constant UML_Operation_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Import_Members";
return Import_Members (Self, Imps);
end Import_Members;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Imported_Member";
return Imported_Member (Self);
end Imported_Member;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Members_Are_Distinguishable";
return Members_Are_Distinguishable (Self);
end Members_Are_Distinguishable;
------------------
-- Owned_Member --
------------------
overriding function Owned_Member
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Owned_Member";
return Owned_Member (Self);
end Owned_Member;
-----------------
-- Is_Template --
-----------------
overriding function Is_Template
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Template";
return Is_Template (Self);
end Is_Template;
----------------------------
-- Parameterable_Elements --
----------------------------
overriding function Parameterable_Elements
(Self : not null access constant UML_Operation_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Parameterable_Elements";
return Parameterable_Elements (Self);
end Parameterable_Elements;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Operation_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Operation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Operations;
|
------------------------------------------------------------------------------
-- --
-- BAREBOARD EXAMPLE --
-- --
-- Copyright (C) 2011, AdaCore --
------------------------------------------------------------------------------
with Ada.Text_Io; use Ada.Text_Io;
with Interfaces; use Interfaces;
with System.Machine_Code; use System.Machine_Code;
procedure Info is
Hex_Digits : array (0 .. 15) of Character := "0123456789abcdef";
subtype String8 is String (1 .. 8);
subtype String4 is String (1 .. 4);
function Image8 (V : Unsigned_32) return String8 is
Res : String8;
begin
for I in Res'Range loop
Res (I) := Hex_Digits (Natural (Shift_Right (V, 4 * (8 - I)) and 15));
end loop;
return Res;
end Image8;
function Image4 (V : Unsigned_32) return String4 is
Res : String4;
begin
for I in Res'Range loop
Res (I) := Hex_Digits (Natural (Shift_Right (V, 4 * (4 - I)) and 15));
end loop;
return Res;
end Image4;
function Image1 (V : Unsigned_32) return Character is
begin
return Hex_Digits (Natural (V and 15));
end Image1;
generic
Spr : Natural;
function Get_Spr return Unsigned_32;
function Get_Spr return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mfspr %0,%1",
Inputs => Natural'Asm_Input ("K", Spr),
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Spr;
generic
Spr : Natural;
procedure Set_Spr (V : Unsigned_32);
procedure Set_Spr (V : Unsigned_32) is
begin
Asm ("mtspr %0,%1",
Inputs => (Natural'Asm_Input ("K", Spr),
Unsigned_32'Asm_Input ("r", V)));
end Set_Spr;
function Get_Pir is new Get_Spr (286);
function Get_Pvr is new Get_Spr (287);
function Get_Svr is new Get_Spr (1023);
function Get_Mmucfg is new Get_Spr (1015);
function Get_Pid0 is new Get_Spr (48);
function Get_Pid1 is new Get_Spr (633);
function Get_Pid2 is new Get_Spr (634);
function Get_Tlb0cfg is new Get_Spr (688);
function Get_Tlb1cfg is new Get_Spr (689);
procedure Set_Mas0 is new Set_Spr (624);
function Get_Mas1 is new Get_Spr (625);
function Get_Mas2 is new Get_Spr (626);
function Get_Mas3 is new Get_Spr (627);
function Field (V : Unsigned_32; F, L : Natural) return Unsigned_32 is
begin
return Shift_Right (V, 63 - L)
and Shift_Right (16#ffff_ffff#, 32 - (L - F + 1));
end Field;
procedure Put_Bit (V : Unsigned_32; F : Natural; Name : Character) is
begin
if Field (V, F, F) = 1 then
Put (Name);
else
Put ('-');
end if;
end Put_Bit;
procedure Os_Exit;
pragma Import (C, Os_Exit, "exit");
Val : Unsigned_32;
Npids : Unsigned_32;
Ntlbs : Unsigned_32;
Nent : Unsigned_32;
begin
Put_Line ("PIR: " & Image8 (Get_Pir));
Put_Line ("PVR: " & Image8 (Get_Pvr));
Put_Line ("SVR: " & Image8 (Get_Svr));
Val := Get_Mmucfg;
Put_Line ("MMUCFG: " & Image8 (Val));
Npids := Field (Val, 49, 52);
Ntlbs := 1 + Field (Val, 60, 61);
Put ("NPIDS: " & Image8 (Npids));
Put (", PIDSIZE: " & Image8 (1 + Field (Val, 53, 57)));
Put (", NTLBS: " & Image8 (Ntlbs));
Put (", MAVN: " & Image8 (1 + Field (Val, 62, 63)));
New_Line;
Put ("PID0: " & Image8 (Get_Pid0));
if Npids > 1 then
Put (", PID1: " & Image8 (Get_Pid1));
if Npids > 2 then
Put (", PID2: " & Image8 (Get_Pid2));
end if;
end if;
New_Line;
for I in 0 .. Ntlbs - 1 loop
case I is
when 0 => Val := Get_Tlb0cfg;
when 1 => Val := Get_Tlb1cfg;
when others => exit;
end case;
Put_Line ("TLB" & Character'Val (48 + I) & "CFG: " & Image8 (Val));
Put (" Assoc: " & Image4 (Field (Val, 32, 39)));
Put (", MinSz: " & Image1 (Field (Val, 40, 43)));
Put (", MaxSz: " & Image1 (Field (Val, 44, 47)));
Put (", Iprot: " & Image1 (Field (Val, 48, 48)));
Put (", Avail: " & Image1 (Field (Val, 49, 49)));
Put (", Nentry: " & Image4 (Field (Val, 52, 63)));
New_Line;
end loop;
New_Line;
Put_Line ("TLB1:");
Val := Get_Tlb1cfg;
Nent := Field (Val, 52, 63);
Put_Line (" #: P Pid S VA Flags PA U USUSUS");
for I in 0 .. Nent - 1 loop
Set_Mas0 (2 ** 28 + I * 2 ** 16);
Asm ("tlbre", Volatile => True);
Val := Get_Mas1;
if Field (Val, 32, 32) = 1 then
declare
Sz : Unsigned_32;
Mask : Unsigned_32;
begin
-- Valid
Put (Image4 (I) & ": ");
Put_Bit (Val, 33, 'P');
Put (' ');
Put (Image4 (Field (Val, 34, 47)));
Put (' ');
Put (Image1 (Field (Val, 51, 51)));
Put (' ');
Sz := Field (Val, 52, 55);
Mask := Shift_Right (16#ffff_ffff#, Natural (32 - (10 + 2 * Sz)));
Val := Get_Mas2;
Put (Image8 (Val and not Mask));
Put ('-');
Put (Image8 (Val or Mask));
Put (' ');
Put (Image1 (Field (Val, 56, 57)));
Put_Bit (Val, 58, 'V');
Put_Bit (Val, 59, 'W');
Put_Bit (Val, 60, 'I');
Put_Bit (Val, 61, 'M');
Put_Bit (Val, 62, 'G');
Put_Bit (Val, 63, 'E');
Put (' ');
Val := Get_Mas3;
Put (Image8 (Val and not Mask));
Put (' ');
Put (Image1 (Field (Val, 54, 57)));
Put (' ');
Put_Bit (Val, 58, 'x');
Put_Bit (Val, 59, 'X');
Put_Bit (Val, 60, 'w');
Put_Bit (Val, 61, 'W');
Put_Bit (Val, 62, 'r');
Put_Bit (Val, 63, 'R');
New_Line;
end;
end if;
end loop;
New_Line;
Os_Exit;
end Info;
|
-- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
-- 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
---------------------------------------------------------------------------
with Ada.Task_Identification;
with Ada.Exceptions;
package Ada.Task_Termination is
pragma Preelaborate(Task_Termination);
type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception);
type Termination_Handler is access protected procedure
(Cause : in Cause_Of_Termination;
T : in Ada.Task_Identification.Task_Id;
X : in Ada.Exceptions.Exception_Occurrence);
procedure Set_Dependents_Fallback_Handler
(Handler: in Termination_Handler);
function Current_Task_Fallback_Handler return Termination_Handler;
procedure Set_Specific_Handler
(T : in Ada.Task_Identification.Task_Id;
Handler : in Termination_Handler);
function Specific_Handler (T : Ada.Task_Identification.Task_Id)
return Termination_Handler;
end Ada.Task_Termination;
|
-----------------------------------------------------------------------
-- util-strings-transforms -- Various Text Transformation Utilities
-- Copyright (C) 2001, 2002, 2003, 2009, 2010, 2015, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Texts.Transforms;
with Ada.Strings.Unbounded;
with Ada.Characters.Handling;
package Util.Strings.Transforms is
pragma Preelaborate;
use Ada.Strings.Unbounded;
package TR is
new Util.Texts.Transforms (Stream => Unbounded_String,
Char => Character,
Input => String,
Put => Ada.Strings.Unbounded.Append,
To_Upper => Ada.Characters.Handling.To_Upper,
To_Lower => Ada.Characters.Handling.To_Lower);
-- Capitalize the string into the result stream.
procedure Capitalize (Content : in String;
Into : in out Unbounded_String)
renames TR.Capitalize;
function Capitalize (Content : String) return String
renames TR.Capitalize;
-- Translate the input string into an upper case string in the result stream.
procedure To_Upper_Case (Content : in String;
Into : in out Unbounded_String)
renames TR.To_Upper_Case;
function To_Upper_Case (Content : String) return String
renames TR.To_Upper_Case;
-- Translate the input string into a lower case string in the result stream.
procedure To_Lower_Case (Content : in String;
Into : in out Unbounded_String)
renames TR.To_Lower_Case;
function To_Lower_Case (Content : String) return String
renames TR.To_Lower_Case;
-- Write in the output stream the value as a \uNNNN encoding form.
procedure To_Hex (Into : in out Unbounded_String;
Value : in Character) renames TR.To_Hex;
-- Escape the content into the result stream using the JavaScript
-- escape rules.
procedure Escape_Javascript (Content : in String;
Into : in out Unbounded_String)
renames TR.Escape_Java_Script;
function Escape_Javascript (Content : String) return String;
-- Escape the content into the result stream using the Java
-- escape rules.
procedure Escape_Java (Content : in String;
Into : in out Unbounded_String)
renames TR.Escape_Java;
function Escape_Java (Content : String) return String;
-- Escape the content into the result stream using the XML
-- escape rules:
-- '<' -> '<'
-- '>' -> '>'
-- ''' -> '''
-- '&' -> '&'
-- -> '&#nnn;' if Character'Pos >= 128
procedure Escape_Xml (Content : in String;
Into : in out Unbounded_String)
renames TR.Escape_Xml;
function Escape_Xml (Content : String) return String;
procedure Translate_Xml_Entity (Entity : in String;
Into : in out Unbounded_String)
renames TR.Translate_Xml_Entity;
procedure Unescape_Xml (Content : in String;
Translator : not null access
procedure (Entity : in String;
Into : in out Unbounded_String)
:= Translate_Xml_Entity'Access;
Into : in out Unbounded_String)
renames TR.Unescape_Xml;
end Util.Strings.Transforms;
|
------------------------------------------------------------------------------
-- EMAIL: <darkestkhan@gmail.com> --
-- License: ISC License (see COPYING file) --
-- --
-- Copyright © 2014 - 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
----------------------------------------------------------------------------
-- This package implements functionality pertaining to XDG Base --
-- Directories Specification. --
-- <http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html> --
----------------------------------------------------------------------------
---------------------------------------------------------------------------
-- FIXME: Create_* and Delete_* subprograms should check if Directory passed
-- is valid directory inside appropriate place (that is, ie. to prevent
-- deletion of "../../").
---------------------------------------------------------------------------
package XDG is
----------------------------------------------------------------------------
-- NOTE: All functions returning pathname are making sure last character of
-- said pathname is '/' (or '\' in case of Windows).
----------------------------------------------------------------------------
-- Directory in which user specific data files should be stored.
function Data_Home return String;
-- As above but for configuration files.
function Config_Home return String;
-- As above but for non-essential data files.
function Cache_Home return String;
-- As above but for non-essential runtime files.
-- Returns null string in case XDG_RUNTIME_DIR is not set.
function Runtime_Dir return String;
----------------------------------------------------------------------------
-- Preference ordered set of base directories to search for data files
-- in addition to Data_Home. Directories are separated by ':'.
-- NOTE: Default value for Windows is "".
function Data_Dirs return String;
-- As above but for config files.
function Config_Dirs return String;
----------------------------------------------------------------------------
-- NOTE: Subprograms below work only within XDG base directories.
-- For example: Data_Home (Directory) will return path resultant of
-- ${XDG_DATA_HOME}/${DIRECTORY}.
-- NOTE: Subprogram operating on XDG_RUNTIME_DIR will raise No_Runtime_Dir
-- exception if there is no XDG_RUNTIME_DIR environment variable defined.
----------------------------------------------------------------------------
-- These functions return path to directory.
function Data_Home (Directory: in String) return String;
function Config_Home (Directory: in String) return String;
function Cache_Home (Directory: in String) return String;
function Runtime_Dir (Directory: in String) return String;
No_Runtime_Dir: exception;
----------------------------------------------------------------------------
-- These procedures create path to directory. If target Directory already
-- exists nothing will happen.
procedure Create_Data_Home (Directory: in String);
procedure Create_Config_Home (Directory: in String);
procedure Create_Cache_Home (Directory: in String);
procedure Create_Runtime_Dir (Directory: in String);
----------------------------------------------------------------------------
-- These procedures delete directory. If Empty_Only is true Directory will
-- be deleted only when empty, otherwise will delete Directory with its entire
-- content.
procedure Delete_Data_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Config_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Cache_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Runtime_Dir
( Directory : in String;
Empty_Only: in Boolean := True
);
----------------------------------------------------------------------------
-- These functions check if directory exists and if it actually is directory.
-- Returns false only when target file exists and is not directory. This way
-- you can check if Directory is valid location and if so you can create it
-- using one of the procedures available from this package.
function Is_Valid_Data_Home (Directory: in String) return Boolean;
function Is_Valid_Config_Home (Directory: in String) return Boolean;
function Is_Valid_Cache_Home (Directory: in String) return Boolean;
function Is_Valid_Runtime_Dir (Directory: in String) return Boolean;
----------------------------------------------------------------------------
end XDG;
|
with
openGL.Model,
openGL.Visual,
openGL.Light,
openGL.Palette,
openGL.Demo;
procedure launch_render_Models
--
-- Exercise the renderer with an example of all the models.
--
is
use openGL,
openGL.Math,
openGL.linear_Algebra_3D,
openGL.Palette;
begin
Demo.print_Usage ("Use space ' ' to cycle through models.");
Demo.define ("openGL 'Render Models' Demo");
Demo.Camera.Position_is ((0.0, 2.0, 10.0),
y_Rotation_from (to_Radians (0.0)));
declare
use openGL.Light;
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
begin
-- the_Light.Kind_is (Diffuse);
-- the_Light.Site_is ((0.0, 0.0, 5.0));
the_Light.Site_is ((5_000.0, 2_000.0, 5_000.0));
-- the_Light.Site_is ((000.0, 5_000.0, 000.0));
the_Light.Color_is (White);
-- the_Light.ambient_Coefficient_is (0.91);
Demo.Renderer.set (the_Light);
end;
-- Set the lights initial position to far behind and far to the left.
--
-- declare
-- use openGL.Palette;
--
-- initial_Site : constant openGL.Vector_3 := (0.0, 0.0, 15.0);
-- cone_Direction : constant openGL.Vector_3 := (0.0, 0.0, -1.0);
--
-- Light : openGL.Light.diffuse.item := Demo.Renderer.Light (Id => 1);
-- begin
-- Light.Color_is (Ambient => (Grey, Opaque),
-- Diffuse => (White, Opaque));
-- -- Specular => (White, Opaque));
--
-- Light.Position_is (initial_Site);
-- Light.cone_Direction_is (cone_Direction);
--
-- Demo.Renderer.Light_is (Id => 1, Now => Light);
-- end;
declare
-- The models.
--
the_Models : constant openGL.Model.views := openGL.Demo.Models;
-- The visuals.
--
use openGL.Visual.Forge;
the_Visuals : openGL.Visual.views (the_Models'Range);
Current : Integer := the_Visuals'First;
begin
for i in the_Visuals'Range
loop
the_Visuals (i) := new_Visual (the_Models (i));
end loop;
the_Visuals (3).Site_is ((0.0, 0.0, -50.0));
-- Main loop.
--
while not Demo.Done
loop
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
declare
Command : Character;
Avail : Boolean;
begin
Demo.Dolly.get_last_Character (Command, Avail);
if Avail
then
case Command
is
when ' ' =>
if Current = the_Visuals'Last
then Current := the_Visuals'First;
else Current := Current + 1;
end if;
when others =>
null;
end case;
end if;
end;
-- Render all visuals.
--
Demo.Camera.render ((1 => the_Visuals (Current)));
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
Demo.FPS_Counter.increment; -- Frames per second display.
delay 1.0 / 60.0;
end loop;
end;
Demo.destroy;
end launch_render_Models;
|
-----------------------------------------------------------------------
-- EL.Contexts -- Default contexts for evaluating an expression
-- Copyright (C) 2009, 2010, 2011, 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 EL.Variables;
with Ada.Finalization;
private with Util.Beans.Objects.Maps;
-- private with EL.Objects.Maps; creates Assert_Failure sem_ch10.adb:2691
package EL.Contexts.Default is
-- ------------------------------
-- Default Context
-- ------------------------------
-- Context information for expression evaluation.
type Default_Context is new Ada.Finalization.Controlled and ELContext with private;
type Default_Context_Access is access all Default_Context'Class;
overriding
procedure Finalize (Obj : in out Default_Context);
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : Default_Context) return ELResolver_Access;
-- Retrieves the VariableMapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : Default_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the FunctionMapper associated with this ELContext.
-- The FunctionMapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : Default_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Default_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the VariableMapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Default_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Set the ELResolver associated with this ELcontext.
procedure Set_Resolver (Context : in out Default_Context;
Resolver : in ELResolver_Access);
procedure Set_Variable (Context : in out Default_Context;
Name : in String;
Value : access Util.Beans.Basic.Readonly_Bean'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Default_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Guarded Context
-- ------------------------------
-- The <b>Guarded_Context</b> is a proxy context that allows to handle exceptions
-- raised when evaluating expressions. The <b>Handler</b> procedure will be called
-- when an exception is raised when the expression is evaluated. This allows to
-- report an error message and ignore or not the exception (See ASF).
type Guarded_Context (Handler : not null access
procedure (Ex : in Ada.Exceptions.Exception_Occurrence);
Context : ELContext_Access)
is new Ada.Finalization.Limited_Controlled and ELContext with null record;
type Guarded_Context_Access is access all Default_Context'Class;
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : in Guarded_Context) return ELResolver_Access;
-- Retrieves the Variable_Mapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : in Guarded_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the Function_Mapper associated with this ELContext.
-- The Function_Mapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : in Guarded_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the Variable_Mapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Guarded_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Default Resolver
-- ------------------------------
type Default_ELResolver is new ELResolver with private;
type Default_ELResolver_Access is access all Default_ELResolver'Class;
-- Get the value associated with a base object and a given property.
overriding
function Get_Value (Resolver : Default_ELResolver;
Context : ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return EL.Objects.Object;
-- Set the value associated with a base object and a given property.
overriding
procedure Set_Value (Resolver : in out Default_ELResolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Bean'Class;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in Util.Beans.Basic.Readonly_Bean_Access);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
private
type Default_Context is new Ada.Finalization.Controlled and ELContext with record
Var_Mapper : EL.Variables.Variable_Mapper_Access;
Resolver : ELResolver_Access;
Function_Mapper : EL.Functions.Function_Mapper_Access;
Var_Mapper_Created : Boolean := False;
end record;
type Default_ELResolver is new ELResolver with record
Map : EL.Objects.Maps.Map;
end record;
end EL.Contexts.Default;
|
package Opt48_Pkg2 is
pragma Pure;
type Rec (L : Natural) is record
S : String (1 .. L);
end record;
function F return Rec;
end Opt48_Pkg2;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S T A N D --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2014, 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 the declarations of entities in package Standard,
-- These values are initialized either by calling CStand.Create_Standard,
-- or by calling Stand.Tree_Read.
with Types; use Types;
package Stand is
-- Warning: the entities defined in this package are written out by the
-- Tree_Write routine, and read back in by the Tree_Read routine, so be
-- sure to modify these two routines if you add entities that are not
-- part of Standard_Entity.
type Standard_Entity_Type is (
-- This enumeration type contains an entry for each name in Standard
-- Package names
S_Standard,
S_ASCII,
-- Types and subtypes defined in package Standard (in the order in which
-- they appear in the RM, so that the declarations are in the right
-- order for the purposes of ASIS traversals
S_Boolean,
S_Short_Short_Integer,
S_Short_Integer,
S_Integer,
S_Long_Integer,
S_Long_Long_Integer,
S_Natural,
S_Positive,
S_Short_Float,
S_Float,
S_Long_Float,
S_Long_Long_Float,
S_Character,
S_Wide_Character,
S_Wide_Wide_Character,
S_String,
S_Wide_String,
S_Wide_Wide_String,
S_Duration,
-- Enumeration literals for type Boolean
S_False,
S_True,
-- Exceptions declared in package Standard
S_Constraint_Error,
S_Numeric_Error,
S_Program_Error,
S_Storage_Error,
S_Tasking_Error,
-- Binary Operators declared in package Standard
S_Op_Add,
S_Op_And,
S_Op_Concat,
S_Op_Concatw,
S_Op_Concatww,
S_Op_Divide,
S_Op_Eq,
S_Op_Expon,
S_Op_Ge,
S_Op_Gt,
S_Op_Le,
S_Op_Lt,
S_Op_Mod,
S_Op_Multiply,
S_Op_Ne,
S_Op_Or,
S_Op_Rem,
S_Op_Subtract,
S_Op_Xor,
-- Unary operators declared in package Standard
S_Op_Abs,
S_Op_Minus,
S_Op_Not,
S_Op_Plus,
-- Constants defined in package ASCII (with value in hex).
-- First the thirty-two C0 control characters)
S_NUL, -- 16#00#
S_SOH, -- 16#01#
S_STX, -- 16#02#
S_ETX, -- 16#03#
S_EOT, -- 16#04#
S_ENQ, -- 16#05#
S_ACK, -- 16#06#
S_BEL, -- 16#07#
S_BS, -- 16#08#
S_HT, -- 16#09#
S_LF, -- 16#0A#
S_VT, -- 16#0B#
S_FF, -- 16#0C#
S_CR, -- 16#0D#
S_SO, -- 16#0E#
S_SI, -- 16#0F#
S_DLE, -- 16#10#
S_DC1, -- 16#11#
S_DC2, -- 16#12#
S_DC3, -- 16#13#
S_DC4, -- 16#14#
S_NAK, -- 16#15#
S_SYN, -- 16#16#
S_ETB, -- 16#17#
S_CAN, -- 16#18#
S_EM, -- 16#19#
S_SUB, -- 16#1A#
S_ESC, -- 16#1B#
S_FS, -- 16#1C#
S_GS, -- 16#1D#
S_RS, -- 16#1E#
S_US, -- 16#1F#
-- Here are the ones for Colonel Whitaker's O26 keypunch
S_Exclam, -- 16#21#
S_Quotation, -- 16#22#
S_Sharp, -- 16#23#
S_Dollar, -- 16#24#
S_Percent, -- 16#25#
S_Ampersand, -- 16#26#
S_Colon, -- 16#3A#
S_Semicolon, -- 16#3B#
S_Query, -- 16#3F#
S_At_Sign, -- 16#40#
S_L_Bracket, -- 16#5B#
S_Back_Slash, -- 16#5C#
S_R_Bracket, -- 16#5D#
S_Circumflex, -- 16#5E#
S_Underline, -- 16#5F#
S_Grave, -- 16#60#
S_LC_A, -- 16#61#
S_LC_B, -- 16#62#
S_LC_C, -- 16#63#
S_LC_D, -- 16#64#
S_LC_E, -- 16#65#
S_LC_F, -- 16#66#
S_LC_G, -- 16#67#
S_LC_H, -- 16#68#
S_LC_I, -- 16#69#
S_LC_J, -- 16#6A#
S_LC_K, -- 16#6B#
S_LC_L, -- 16#6C#
S_LC_M, -- 16#6D#
S_LC_N, -- 16#6E#
S_LC_O, -- 16#6F#
S_LC_P, -- 16#70#
S_LC_Q, -- 16#71#
S_LC_R, -- 16#72#
S_LC_S, -- 16#73#
S_LC_T, -- 16#74#
S_LC_U, -- 16#75#
S_LC_V, -- 16#76#
S_LC_W, -- 16#77#
S_LC_X, -- 16#78#
S_LC_Y, -- 16#79#
S_LC_Z, -- 16#7A#
S_L_BRACE, -- 16#7B#
S_BAR, -- 16#7C#
S_R_BRACE, -- 16#7D#
S_TILDE, -- 16#7E#
-- And one more control character, all on its own
S_DEL); -- 16#7F#
subtype S_Types is
Standard_Entity_Type range S_Boolean .. S_Duration;
subtype S_Exceptions is
Standard_Entity_Type range S_Constraint_Error .. S_Tasking_Error;
subtype S_ASCII_Names is
Standard_Entity_Type range S_NUL .. S_DEL;
subtype S_Binary_Ops is
Standard_Entity_Type range S_Op_Add .. S_Op_Xor;
subtype S_Unary_Ops is
Standard_Entity_Type range S_Op_Abs .. S_Op_Plus;
type Standard_Entity_Array_Type is array (Standard_Entity_Type) of Node_Id;
Standard_Entity : Standard_Entity_Array_Type;
-- This array contains pointers to the Defining Identifier nodes for each
-- of the visible entities defined in Standard_Entities_Type. The array is
-- initialized by the Create_Standard procedure.
Standard_Package_Node : Node_Id;
-- Points to the N_Package_Declaration node for standard. Also
-- initialized by the Create_Standard procedure.
-- The following Entities are the pointers to the Defining Identifier
-- nodes for some visible entities defined in Standard_Entities_Type.
SE : Standard_Entity_Array_Type renames Standard_Entity;
Standard_Standard : Entity_Id renames SE (S_Standard);
Standard_ASCII : Entity_Id renames SE (S_ASCII);
Standard_Character : Entity_Id renames SE (S_Character);
Standard_Wide_Character : Entity_Id renames SE (S_Wide_Character);
Standard_Wide_Wide_Character : Entity_Id renames SE (S_Wide_Wide_Character);
Standard_String : Entity_Id renames SE (S_String);
Standard_Wide_String : Entity_Id renames SE (S_Wide_String);
Standard_Wide_Wide_String : Entity_Id renames SE (S_Wide_Wide_String);
Standard_Boolean : Entity_Id renames SE (S_Boolean);
Standard_False : Entity_Id renames SE (S_False);
Standard_True : Entity_Id renames SE (S_True);
Standard_Duration : Entity_Id renames SE (S_Duration);
Standard_Natural : Entity_Id renames SE (S_Natural);
Standard_Positive : Entity_Id renames SE (S_Positive);
Standard_Constraint_Error : Entity_Id renames SE (S_Constraint_Error);
Standard_Numeric_Error : Entity_Id renames SE (S_Numeric_Error);
Standard_Program_Error : Entity_Id renames SE (S_Program_Error);
Standard_Storage_Error : Entity_Id renames SE (S_Storage_Error);
Standard_Tasking_Error : Entity_Id renames SE (S_Tasking_Error);
Standard_Short_Float : Entity_Id renames SE (S_Short_Float);
Standard_Float : Entity_Id renames SE (S_Float);
Standard_Long_Float : Entity_Id renames SE (S_Long_Float);
Standard_Long_Long_Float : Entity_Id renames SE (S_Long_Long_Float);
Standard_Short_Short_Integer : Entity_Id renames SE (S_Short_Short_Integer);
Standard_Short_Integer : Entity_Id renames SE (S_Short_Integer);
Standard_Integer : Entity_Id renames SE (S_Integer);
Standard_Long_Integer : Entity_Id renames SE (S_Long_Integer);
Standard_Long_Long_Integer : Entity_Id renames SE (S_Long_Long_Integer);
Standard_Op_Add : Entity_Id renames SE (S_Op_Add);
Standard_Op_And : Entity_Id renames SE (S_Op_And);
Standard_Op_Concat : Entity_Id renames SE (S_Op_Concat);
Standard_Op_Concatw : Entity_Id renames SE (S_Op_Concatw);
Standard_Op_Concatww : Entity_Id renames SE (S_Op_Concatww);
Standard_Op_Divide : Entity_Id renames SE (S_Op_Divide);
Standard_Op_Eq : Entity_Id renames SE (S_Op_Eq);
Standard_Op_Expon : Entity_Id renames SE (S_Op_Expon);
Standard_Op_Ge : Entity_Id renames SE (S_Op_Ge);
Standard_Op_Gt : Entity_Id renames SE (S_Op_Gt);
Standard_Op_Le : Entity_Id renames SE (S_Op_Le);
Standard_Op_Lt : Entity_Id renames SE (S_Op_Lt);
Standard_Op_Mod : Entity_Id renames SE (S_Op_Mod);
Standard_Op_Multiply : Entity_Id renames SE (S_Op_Multiply);
Standard_Op_Ne : Entity_Id renames SE (S_Op_Ne);
Standard_Op_Or : Entity_Id renames SE (S_Op_Or);
Standard_Op_Rem : Entity_Id renames SE (S_Op_Rem);
Standard_Op_Subtract : Entity_Id renames SE (S_Op_Subtract);
Standard_Op_Xor : Entity_Id renames SE (S_Op_Xor);
Standard_Op_Abs : Entity_Id renames SE (S_Op_Abs);
Standard_Op_Minus : Entity_Id renames SE (S_Op_Minus);
Standard_Op_Not : Entity_Id renames SE (S_Op_Not);
Standard_Op_Plus : Entity_Id renames SE (S_Op_Plus);
Last_Standard_Node_Id : Node_Id;
-- Highest Node_Id value used by Standard
Last_Standard_List_Id : List_Id;
-- Highest List_Id value used by Standard (including those used by
-- normal list headers, element list headers, and list elements)
Boolean_Literals : array (Boolean) of Entity_Id;
-- Entities for the two boolean literals, used by the expander
-------------------------------------
-- Semantic Phase Special Entities --
-------------------------------------
-- The semantic phase needs a number of entities for internal processing
-- that are logically at the level of Standard, and hence defined in this
-- package. However, they are never visible to a program, and are not
-- chained on to the Decls list of Standard. The names of all these
-- types are relevant only in certain debugging and error message
-- situations. They have names that are suitable for use in such
-- error messages (see body for actual names used).
Standard_Void_Type : Entity_Id;
-- This is a type used to represent the return type of procedures
Standard_Exception_Type : Entity_Id;
-- This is a type used to represent the Etype of exceptions
Standard_A_String : Entity_Id;
-- An access to String type used for building elements of tables
-- carrying the enumeration literal names.
Standard_A_Char : Entity_Id;
-- Access to character, used as a component of the exception type to denote
-- a thin pointer component.
Standard_Debug_Renaming_Type : Entity_Id;
-- A zero-size subtype of Integer, used as the type of variables used to
-- provide the debugger with name encodings for renaming declarations.
Predefined_Float_Types : Elist_Id;
-- Entities for predefined floating point types. These are used by
-- the semantic phase to select appropriate types for floating point
-- declarations. This list is ordered by preference. All types up to
-- Long_Long_Float_Type are considered for plain "digits N" declarations,
-- while selection of later types requires a range specification and
-- possibly other attributes or pragmas.
-- The entities labeled Any_xxx are used in situations where the full
-- characteristics of an entity are not yet known, e.g. Any_Character
-- is used to label a character literal before resolution is complete.
-- These entities are also used to construct appropriate references in
-- error messages ("expecting an integer type").
Any_Id : Entity_Id;
-- Used to represent some unknown identifier. Used to label undefined
-- identifier references to prevent cascaded errors.
Any_Type : Entity_Id;
-- Used to represent some unknown type. Any_Type is the type of an
-- unresolved operator, and it is the type of a node where a type error
-- has been detected. Any_Type plays an important role in avoiding cascaded
-- errors, because it is compatible with all other types, and is propagated
-- to any expression that has a subexpression of Any_Type. When resolving
-- operators, Any_Type is the initial type of the node before any of its
-- candidate interpretations has been examined. If after examining all of
-- them the type is still Any_Type, the node has no possible interpretation
-- and an error can be emitted (and Any_Type will be propagated upwards).
Any_Access : Entity_Id;
-- Used to resolve the overloaded literal NULL
Any_Array : Entity_Id;
-- Used to represent some unknown array type
Any_Boolean : Entity_Id;
-- The context type of conditions in IF and WHILE statements
Any_Character : Entity_Id;
-- Any_Character is used to label character literals, which in general
-- will not have an explicit declaration (this is true of the predefined
-- character types).
Any_Composite : Entity_Id;
-- The type Any_Composite is used for aggregates before type resolution.
-- It is compatible with any array or non-limited record type.
Any_Discrete : Entity_Id;
-- Used to represent some unknown discrete type
Any_Fixed : Entity_Id;
-- Used to represent some unknown fixed-point type
Any_Integer : Entity_Id;
-- Used to represent some unknown integer type
Any_Modular : Entity_Id;
-- Used to represent the result type of a boolean operation on an integer
-- literal. The result is not Universal_Integer, because it is only legal
-- in a modular context.
Any_Numeric : Entity_Id;
-- Used to represent some unknown numeric type
Any_Real : Entity_Id;
-- Used to represent some unknown real type
Any_Scalar : Entity_Id;
-- Used to represent some unknown scalar type
Any_String : Entity_Id;
-- The type Any_String is used for string literals before type resolution.
-- It corresponds to array (Positive range <>) of character where the
-- component type is compatible with any character type, not just
-- Standard_Character.
Raise_Type : Entity_Id;
-- The type Raise_Type denotes the type of a Raise_Expression. It is
-- compatible with all other types, and must eventually resolve to a
-- concrete type that is imposed by the context.
--
-- Historical note: we used to use Any_Type for this purpose, but the
-- confusion of meanings (Any_Type normally indicates an error) caused
-- difficulties. In particular some needed expansions were skipped since
-- the nodes in question looked like they had an error.
Universal_Integer : Entity_Id;
-- Entity for universal integer type. The bounds of this type correspond
-- to the largest supported integer type (i.e. Long_Long_Integer). It is
-- the type used for runtime calculations in type universal integer.
Universal_Real : Entity_Id;
-- Entity for universal real type. The bounds of this type correspond to
-- to the largest supported real type (i.e. Long_Long_Float). It is the
-- type used for runtime calculations in type universal real. Note that
-- this type is always IEEE format.
Universal_Fixed : Entity_Id;
-- Entity for universal fixed type. This is a type with arbitrary
-- precision that can only appear in a context with a specific type.
-- Universal_Fixed labels the result of multiplication or division of
-- two fixed point numbers, and has no specified bounds (since, unlike
-- universal integer and universal real, it is never used for runtime
-- calculations).
Standard_Integer_8 : Entity_Id;
Standard_Integer_16 : Entity_Id;
Standard_Integer_32 : Entity_Id;
Standard_Integer_64 : Entity_Id;
-- These are signed integer types with the indicated sizes. Used for the
-- underlying implementation types for fixed-point and enumeration types.
Standard_Short_Short_Unsigned : Entity_Id;
Standard_Short_Unsigned : Entity_Id;
Standard_Unsigned : Entity_Id;
Standard_Long_Unsigned : Entity_Id;
Standard_Long_Long_Unsigned : Entity_Id;
-- Unsigned types with same Esize as corresponding signed integer types
Standard_Unsigned_64 : Entity_Id;
-- An unsigned type, mod 2 ** 64, size of 64 bits.
Abort_Signal : Entity_Id;
-- Entity for abort signal exception
Standard_Op_Rotate_Left : Entity_Id;
Standard_Op_Rotate_Right : Entity_Id;
Standard_Op_Shift_Left : Entity_Id;
Standard_Op_Shift_Right : Entity_Id;
Standard_Op_Shift_Right_Arithmetic : Entity_Id;
-- These entities are used for shift operators generated by the expander
-----------------
-- Subprograms --
-----------------
procedure Tree_Read;
-- Initializes entity values in this package from the current tree file
-- using Tree_IO. Note that Tree_Read includes all the initialization that
-- is carried out by Create_Standard.
procedure Tree_Write;
-- Writes out the entity values in this package to the current tree file
-- using Tree_IO.
end Stand;
|
Function INI.Section_Vector( Object : in Instance )
return NSO.Types.String_Vector.Vector is
use NSO.Types.String_Vector;
Begin
Return Result : Vector := Empty_Vector do
For Section in Object.Iterate loop
Declare
Key : String renames INI.KEY_SECTION_MAP.KEY(Section);
Begin
if Key'Length in Positive then
Result.Append( Key );
end if;
End;
end loop;
End return;
End INI.Section_Vector;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, 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 STMicroelectronics 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 file provides declarations for devices on the STM32F469 Discovery kits
-- manufactured by ST Microelectronics.
with STM32.Device; use STM32.Device;
with STM32.GPIO; use STM32.GPIO;
with STM32.FMC; use STM32.FMC;
with Ada.Interrupts.Names; use Ada.Interrupts;
use STM32; -- for base addresses
-- with STM32.I2C; use STM32.I2C;
with Framebuffer_OTM8009A;
with Touch_Panel_FT6x06;
package STM32.Board is
pragma Elaborate_Body;
subtype User_LED is GPIO_Point;
Green : User_LED renames PG6;
Orange : User_LED renames PD4;
Red : User_LED renames PD5;
Blue : User_LED renames PK3;
LCH_LED : User_LED renames Red;
All_LEDs : GPIO_Points := Green & Orange & Red & Blue;
procedure Initialize_LEDs;
-- MUST be called prior to any use of the LEDs
procedure Turn_On (This : in out User_LED)
renames STM32.GPIO.Clear;
procedure Turn_Off (This : in out User_LED)
renames STM32.GPIO.Set;
procedure All_LEDs_Off with Inline;
procedure All_LEDs_On with Inline;
procedure Toggle_LEDs (These : in out GPIO_Points)
renames STM32.GPIO.Toggle;
-- Gyro : Three_Axis_Gyroscope;
-- GPIO Pins for FMC
FMC_D : constant GPIO_Points :=
(PD0, PD1, PD8, PD9, PD10, PD14, PD15,
PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, PE15,
PH8, PH9, PH10, PH11, PH12, PH13, PH14, PH15,
PI0, PI1, PI2, PI3, PI6, PI7, PI9, PI10);
FMC_A : constant GPIO_Points :=
(PF0, PF1, PF2, PF3, PF4, PF5,
PF12, PF13, PF14, PF15, PG0, PG1, PG4, PG5);
FMC_SDNWE : GPIO_Point renames PC0;
FMC_SDNRAS : GPIO_Point renames PF11;
FMC_SDNCAS : GPIO_Point renames PG15;
FMC_SDNE0 : GPIO_Point renames PH3;
FMC_SDCKE0 : GPIO_Point renames PH2;
FMC_SDCLK : GPIO_Point renames PG8;
FMC_NBL0 : GPIO_Point renames PE0;
FMC_NBL1 : GPIO_Point renames PE1;
FMC_NBL2 : GPIO_Point renames PI4;
FMC_NBL3 : GPIO_Point renames PI5;
SDRAM_PINS : constant GPIO_Points :=
FMC_A & FMC_D &
FMC_SDNWE & FMC_SDNRAS & FMC_SDNCAS & FMC_SDCLK &
FMC_SDNE0 & FMC_SDCKE0 & FMC_NBL0 & FMC_NBL1 &
FMC_NBL2 & FMC_NBL3;
-- SDRAM CONFIGURATION Parameters
SDRAM_Base : constant := 16#C0000000#;
SDRAM_Size : constant := 16#800000#;
SDRAM_Bank : constant STM32.FMC.FMC_SDRAM_Cmd_Target_Bank :=
STM32.FMC.FMC_Bank1_SDRAM;
SDRAM_Mem_Width : constant STM32.FMC.FMC_SDRAM_Memory_Bus_Width :=
STM32.FMC.FMC_SDMemory_Width_32b;
SDRAM_Row_Bits : constant STM32.FMC.FMC_SDRAM_Row_Address_Bits :=
FMC_RowBits_Number_11b;
SDRAM_CAS_Latency : constant STM32.FMC.FMC_SDRAM_CAS_Latency :=
STM32.FMC.FMC_CAS_Latency_3;
SDRAM_CLOCK_Period : constant STM32.FMC.FMC_SDRAM_Clock_Configuration :=
STM32.FMC.FMC_SDClock_Period_2;
SDRAM_Read_Burst : constant STM32.FMC.FMC_SDRAM_Burst_Read :=
STM32.FMC.FMC_Read_Burst_Single;
SDRAM_Read_Pipe : constant STM32.FMC.FMC_SDRAM_Read_Pipe_Delay :=
STM32.FMC.FMC_ReadPipe_Delay_0;
SDRAM_Refresh_Cnt : constant := 16#0569#;
---------------
-- SPI5 Pins --
---------------
-- SPI5_SCK : GPIO_Point renames PF7;
-- SPI5_MISO : GPIO_Point renames PF8;
-- SPI5_MOSI : GPIO_Point renames PF9;
-- NCS_MEMS_SPI : GPIO_Point renames PC1;
-- MEMS_INT1 : GPIO_Point renames PA1;
-- MEMS_INT2 : GPIO_Point renames PA2;
-- LCD_SPI : SPI_Port renames SPI_5;
--------------------------------
-- Screen/Touch panel devices --
--------------------------------
LCD_Natural_Width : constant := Framebuffer_OTM8009A.LCD_Natural_Width;
LCD_Natural_Height : constant := Framebuffer_OTM8009A.LCD_Natural_Height;
Display : Framebuffer_OTM8009A.Frame_Buffer;
Touch_Panel : Touch_Panel_FT6x06.Touch_Panel;
-----------------
-- Touch Panel --
-----------------
I2C1_SCL : GPIO_Point renames PB8;
I2C1_SDA : GPIO_Point renames PB9;
TP_INT : GPIO_Point renames PJ5;
TP_Pins : constant GPIO_Points :=
(I2C1_SCL, I2C1_SDA);
-- User button
User_Button_Point : GPIO_Point renames PA0;
User_Button_Interrupt : constant Interrupt_ID := Names.EXTI0_Interrupt;
procedure Configure_User_Button_GPIO;
-- Configures the GPIO port/pin for the blue user button. Sufficient
-- for polling the button, and necessary for having the button generate
-- interrupts.
end STM32.Board;
|
-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Command_Line;
with Ada.Wide_Wide_Text_IO;
with League.Application;
with League.Strings;
with XML.SAX.Input_Sources.Streams.Files;
with XML.SAX.Pretty_Writers;
with XML.SAX.Simple_Readers;
with XML.SAX.String_Output_Destinations;
with XML.Templates.Streams;
with XML.SAX.Writers;
with Incr.Debug;
with Incr.Documents;
with Incr.Lexers.Batch_Lexers;
with Incr.Lexers.Incremental;
with Incr.Nodes.Tokens;
with Incr.Parsers.Incremental;
with Incr.Version_Trees;
with Tests.Commands;
with Tests.Lexers;
with Tests.Parser_Data.XML_Reader;
procedure Tests.Driver is
procedure Dump
(Document : Incr.Documents.Document'Class;
Result : out League.Strings.Universal_String);
function To_String
(Vector : XML.Templates.Streams.XML_Stream_Element_Vectors.Vector)
return League.Strings.Universal_String;
type Provider_Access is access all Tests.Parser_Data.Provider;
History : constant Incr.Version_Trees.Version_Tree_Access :=
new Incr.Version_Trees.Version_Tree;
Document : constant Incr.Documents.Document_Access :=
new Incr.Documents.Document (History);
Provider : constant Provider_Access :=
new Tests.Parser_Data.Provider (Document);
----------
-- Dump --
----------
procedure Dump
(Document : Incr.Documents.Document'Class;
Result : out League.Strings.Universal_String)
is
Output : aliased XML.SAX.String_Output_Destinations.
String_Output_Destination;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
begin
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Set_Offset (2);
Incr.Debug.Dump (Document, Provider.all, Writer);
Result := Output.Get_Text;
end Dump;
---------------
-- To_String --
---------------
function To_String
(Vector : XML.Templates.Streams.XML_Stream_Element_Vectors.Vector)
return League.Strings.Universal_String
is
use XML.Templates.Streams;
Output : aliased XML.SAX.String_Output_Destinations.
String_Output_Destination;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
begin
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Set_Offset (2);
Writer.Start_Document;
for V of Vector loop
case V.Kind is
when Start_Element =>
Writer.Start_Element
(Namespace_URI => V.Namespace_URI,
Qualified_Name => V.Qualified_Name,
Local_Name => V.Local_Name,
Attributes => V.Attributes);
when End_Element =>
Writer.End_Element
(Namespace_URI => V.Namespace_URI,
Qualified_Name => V.Qualified_Name,
Local_Name => V.Local_Name);
when Text =>
Writer.Characters (V.Text);
when others =>
null;
end case;
end loop;
Writer.End_Document;
return Output.Get_Text;
end To_String;
Batch_Lexer : constant Incr.Lexers.Batch_Lexers.Batch_Lexer_Access :=
new Tests.Lexers.Test_Lexers.Batch_Lexer;
Incr_Lexer : constant Incr.Lexers.Incremental.Incremental_Lexer_Access :=
new Incr.Lexers.Incremental.Incremental_Lexer;
Incr_Parser : constant Incr.Parsers.Incremental.Incremental_Parser_Access :=
new Incr.Parsers.Incremental.Incremental_Parser;
Ref : Incr.Version_Trees.Version := History.Parent (History.Changing);
Root : Incr.Nodes.Node_Access;
Input : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source;
Reader : XML.SAX.Simple_Readers.Simple_Reader;
Handler : aliased Tests.Parser_Data.XML_Reader.Reader (Provider);
begin
Input.Open_By_File_Name (League.Application.Arguments.Element (1));
Reader.Set_Content_Handler (Handler'Unchecked_Access);
Reader.Set_Input_Source (Input'Unchecked_Access);
Reader.Parse;
if Provider.Part_Counts (2) = 0 then
declare
Kind : Incr.Nodes.Node_Kind;
begin
Provider.Create_Node
(Prod => 2,
Children => (1 .. 0 => <>),
Node => Root,
Kind => Kind);
end;
end if;
Incr.Documents.Constructors.Initialize (Document.all, Root);
Incr_Lexer.Set_Batch_Lexer (Batch_Lexer);
for Command of Handler.Get_Commands loop
case Command.Kind is
when Tests.Commands.Commit =>
Document.Commit;
when Tests.Commands.Set_EOS_Text =>
Document.End_Of_Stream.Set_Text (Command.Text);
when Tests.Commands.Set_Token_Text =>
declare
Token : Incr.Nodes.Tokens.Token_Access :=
Document.Start_Of_Stream;
begin
for J in 2 .. Command.Token loop
Token := Token.Next_Token (History.Changing);
end loop;
Token.Set_Text (Command.Text);
end;
when Tests.Commands.Dump_Tree =>
declare
use type League.Strings.Universal_String;
Text : League.Strings.Universal_String;
Expect : League.Strings.Universal_String;
begin
Dump (Document.all, Text);
Expect := To_String (Command.Dump);
Ada.Wide_Wide_Text_IO.Put_Line
(Text.To_Wide_Wide_String);
if Text /= Expect then
Ada.Wide_Wide_Text_IO.Put_Line ("DOESN'T MATCH!!!");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
end;
when Tests.Commands.Run =>
Incr_Parser.Run
(Lexer => Incr_Lexer,
Provider => Provider.all'Unchecked_Access,
Factory => Provider.all'Unchecked_Access,
Document => Document,
Reference => Ref);
Ref := History.Changing;
end case;
end loop;
end Tests.Driver;
|
with Ada.Text_IO;
use Ada.Text_IO;
with Palindrome;
procedure Main is
res : Boolean := False;
test : String(1..1024);
len : Integer;
begin
Get_Line(test, len);
res := Palindrome(test(1..len));
if res then
Put_Line("true");
else
Put_Line("false");
end if;
end Main;
|
-----------------------------------------------------------------------
-- babel-files-buffers -- File buffer management
-- Copyright (C) 2014, 2015 Stephane.Carrez
-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Unchecked_Deallocation;
package body Babel.Files.Buffers is
-- ------------------------------
-- Allocate a buffer from the pool.
-- ------------------------------
procedure Get_Buffer (Pool : in out Buffer_Pool;
Buffer : out Buffer_Access) is
begin
Pool.Pool.Get_Instance (Buffer);
end Get_Buffer;
-- ------------------------------
-- Restore the buffer back to the owning pool.
-- ------------------------------
procedure Release (Buffer : in out Buffer_Access) is
begin
Buffer.Pool.Release (Buffer);
Buffer := null;
end Release;
-- ------------------------------
-- Create the buffer pool with a number of pre-allocated buffers of the given maximum size.
-- ------------------------------
procedure Create_Pool (Into : in out Buffer_Pool;
Size : in Positive;
Count : in Positive) is
begin
Into.Pool.Set_Size (Count);
for I in 1 .. Count loop
Into.Pool.Release (new Buffer (Max_Size => Ada.Streams.Stream_Element_Offset (Size),
Pool => Into.Pool'Unchecked_Access));
end loop;
end Create_Pool;
-- ------------------------------
-- Release the buffers allocated for the pool.
-- ------------------------------
overriding
procedure Finalize (Pool : in out Buffer_Pool) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Buffer,
Name => Buffer_Access);
Available : Natural;
Buffer : Buffer_Access;
begin
loop
Pool.Pool.Get_Available (Available);
exit when Available = 0;
Pool.Pool.Get_Instance (Buffer);
Free (Buffer);
end loop;
end Finalize;
end Babel.Files.Buffers;
|
with SPARKNaCl; use SPARKNaCl;
with SPARKNaCl.Core; use SPARKNaCl.Core;
with SPARKNaCl.Debug; use SPARKNaCl.Debug;
with SPARKNaCl.Stream; use SPARKNaCl.Stream;
with SPARKNaCl.Hashing; use SPARKNaCl.Hashing;
procedure Stream
is
Firstkey : constant Salsa20_Key :=
Construct ((16#1b#, 16#27#, 16#55#, 16#64#,
16#73#, 16#e9#, 16#85#, 16#d4#,
16#62#, 16#cd#, 16#51#, 16#19#,
16#7a#, 16#9a#, 16#46#, 16#c7#,
16#60#, 16#09#, 16#54#, 16#9e#,
16#ac#, 16#64#, 16#74#, 16#f2#,
16#06#, 16#c4#, 16#ee#, 16#08#,
16#44#, 16#f6#, 16#83#, 16#89#));
Nonce : constant HSalsa20_Nonce :=
(16#69#, 16#69#, 16#6e#, 16#e9#, 16#55#, 16#b6#, 16#2b#, 16#73#,
16#cd#, 16#62#, 16#bd#, 16#a8#, 16#75#, 16#fc#, 16#73#, 16#d6#,
16#82#, 16#19#, 16#e0#, 16#03#, 16#6b#, 16#7a#, 16#0b#, 16#37#);
Output : Byte_Seq (0 .. 4_194_303);
H : Bytes_64;
begin
HSalsa20 (Output, Nonce, Firstkey);
Hash (H, Output);
DH ("H is", H);
end Stream;
|
-- { dg-do run }
-- { dg-options "-O" }
with Opt59_Pkg; use Opt59_Pkg;
procedure Opt59 is
type Enum is (Zero, One, Two);
function Has_True (V : Boolean_Vector) return Boolean is
begin
for I in V'Range loop
if V (I) then
return True;
end if;
end loop;
return False;
end;
Data1 : constant Boolean_Vector := Get_BV1;
Data2 : constant Boolean_Vector := Get_BV2;
Result : Boolean_Vector;
function F return Enum is
Res : Enum := Zero;
Set1 : constant Boolean := Has_True (Data1);
Set2 : constant Boolean := Has_True (Data2);
begin
if Set1 then
Res := Two;
elsif Set2 then
Res := One;
end if;
return Res;
end;
Val : constant Enum := F;
begin
for I in Result'Range loop
Result (I) := Data1 (I) or Data2 (I);
end loop;
if Val /= Zero then
Test (Val = Two);
end if;
end;
|
package Complex1_Pkg is
procedure Coord (x,y : out Float);
end Complex1_Pkg;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> --
-- 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.CLDR.Collation_Rules_Parser;
package body Matreshka.CLDR.LDML_Parsers is
use type League.Strings.Universal_String;
Collation_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("collation");
Collations_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("collations");
Cr_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("cr");
Generation_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("generation");
Identity_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("identity");
Language_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("language");
LDML_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("ldml");
Settings_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("settings");
Suppress_Contractions_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("suppress_contractions");
Version_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("version");
Type_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("type");
Standard_Image : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("standard");
----------------
-- Characters --
----------------
overriding procedure Characters
(Self : in out LDML_Parser;
Text : League.Strings.Universal_String;
Success : in out Boolean) is
begin
Self.Text.Append (Text);
end Characters;
-----------------
-- End_Element --
-----------------
overriding procedure End_Element
(Self : in out LDML_Parser;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Ignore_Depth /= 0 then
Self.Ignore_Depth := Self.Ignore_Depth - 1;
elsif Qualified_Name = Cr_Tag then
Collation_Rules_Parser.Parse_Collation_Rules
(Self.Collations.all, Self.Text.To_Wide_Wide_String);
Self.Collect_Text := False;
elsif Qualified_Name = Suppress_Contractions_Tag then
for J in 2 .. Self.Text.Length - 1 loop
-- XXX This field must be parsed as Unicode Set.
Matreshka.CLDR.Collation_Data.Suppress_Contractions
(Self.Collations.all,
Wide_Wide_Character'Pos (Self.Text (J).To_Wide_Wide_Character));
end loop;
Self.Collect_Text := False;
end if;
end End_Element;
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : LDML_Parser) return League.Strings.Universal_String is
begin
return League.Strings.Empty_Universal_String;
end Error_String;
-------------------
-- Start_Element --
-------------------
overriding procedure Start_Element
(Self : in out LDML_Parser;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean) is
begin
if Self.Ignore_Depth /= 0 then
Self.Ignore_Depth := Self.Ignore_Depth + 1;
elsif Qualified_Name = Collations_Tag then
null;
elsif Qualified_Name = Collation_Tag then
if Attributes.Value (Type_Attribute) /= Standard_Image then
-- Ignore all collations except 'standard'.
Self.Ignore_Depth := 1;
end if;
elsif Qualified_Name = Cr_Tag then
Self.Collect_Text := True;
Self.Text.Clear;
elsif Qualified_Name = Generation_Tag then
null;
elsif Qualified_Name = Identity_Tag then
null;
elsif Qualified_Name = Language_Tag then
null;
elsif Qualified_Name = LDML_Tag then
null;
elsif Qualified_Name = Settings_Tag then
null;
elsif Qualified_Name = Suppress_Contractions_Tag then
Self.Collect_Text := True;
Self.Text.Clear;
elsif Qualified_Name = Version_Tag then
null;
else
raise Program_Error;
end if;
end Start_Element;
end Matreshka.CLDR.LDML_Parsers;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2018, Vadim Godunko <vgodunko@gmail.com> --
-- 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 Asis.Elements;
with Asis.Declarations;
with Asis.Definitions;
with Properties.Tools;
package body Properties.Definitions.Record_Type is
---------------
-- Alignment --
---------------
function Alignment
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Integer_Property) return Integer
is
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
Result : Integer := 1;
Down : Integer;
begin
for J in List'Range loop
Down := Engine.Integer.Get_Property (List (J), Name);
Result := Integer'Max (Result, Down);
end loop;
return Result;
end Alignment;
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
Decl : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Element);
Is_Array_Buffer : constant Boolean :=
Properties.Tools.Is_Array_Buffer (Decl);
Result : League.Strings.Universal_String;
Size : League.Strings.Universal_String;
begin
Result.Append ("(function (){"); -- Wrapper
Result.Append ("var _result = function ("); -- Type constructor
-- Declare type's discriminant
declare
List : constant Asis.Discriminant_Association_List :=
Properties.Tools.Corresponding_Type_Discriminants (Element);
begin
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append (Id);
if J /= List'Last or N /= Names'Last then
Result.Append (",");
end if;
end loop;
end;
end loop;
Result.Append ("){");
if Is_Array_Buffer then
Size := Engine.Text.Get_Property (Element, Engines.Size);
Result.Append ("this.A = new ArrayBuffer(");
Result.Append (Size);
Result.Append ("/8);");
Result.Append ("this._u8 = new Uint8Array(this.A);");
Result.Append ("this._f32 = new Float32Array(this.A);");
end if;
-- Copy type's discriminant
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
if not Asis.Elements.Is_Nil (Init) then
Result.Append ("if (typeof ");
Result.Append (Id);
Result.Append ("=== 'undefined')");
Result.Append (Id);
Result.Append ("=");
Result.Append (Engine.Text.Get_Property (Init, Name));
Result.Append (";");
end if;
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
Result.Append (Id);
Result.Append (";");
end loop;
end;
end loop;
end;
-- Initialize type's components
declare
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
begin
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Value : League.Strings.Universal_String;
begin
if not Asis.Elements.Is_Nil (Init) then
Value := Engine.Text.Get_Property (Init, Name);
end if;
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
if Asis.Elements.Is_Nil (Init) then
Result.Append
(Engine.Text.Get_Property
(List (J), Engines.Initialize));
else
Result.Append (Value);
end if;
Result.Append (";");
end loop;
end;
end loop;
end;
Result.Append ("};"); -- End of constructor
-- Limited types should also have _cast, so we need _assign
-- Update prototype with _assign
Result.Append ("_result.prototype._assign = function(src){");
declare
Down : League.Strings.Universal_String;
Def : constant Asis.Definition :=
Asis.Definitions.Record_Definition (Element);
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Def);
begin
Down := Engine.Text.Get_Property
(List => List,
Name => Engines.Assign,
Empty => League.Strings.Empty_Universal_String,
Sum => Properties.Tools.Join'Access);
Result.Append (Down);
Result.Append ("};"); -- End of _assign
end;
Result.Append ("_result._cast = function _cast (value){");
Result.Append ("var result = new _result(");
declare
Down : League.Strings.Universal_String;
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Discriminants (Element);
begin
for J in List'Range loop
declare
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for K in Names'Range loop
Down := Engine.Text.Get_Property (Names (K), Name);
Result.Append ("value.");
Result.Append (Down);
if K /= Names'Last or J /= List'Last then
Result.Append (",");
end if;
end loop;
end;
end loop;
end;
Result.Append (");");
Result.Append ("result._assign (value);");
Result.Append ("return result;");
Result.Append ("};");
Result.Append ("var props = {};");
declare
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
Prev : League.Strings.Universal_String;
begin
Prev.Append ("0");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Comp : constant Asis.Definition :=
Asis.Declarations.Object_Declaration_View (List (J));
Def : constant Asis.Definition :=
Asis.Definitions.Component_Definition_View (Comp);
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Down : League.Strings.Universal_String;
Comp_Size : League.Strings.Universal_String;
Is_Simple_Type : Boolean;
begin
if Is_Array_Buffer then
Comp_Size := Engine.Text.Get_Property
(List (J), Engines.Size);
Is_Simple_Type := Engine.Boolean.Get_Property
(Def, Engines.Is_Simple_Type);
if Is_Simple_Type then
Down := Engine.Text.Get_Property
(Def, Engines.Typed_Array_Item_Type);
else
Down := Engine.Text.Get_Property (Def, Name);
end if;
end if;
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append ("props._pos_");
Result.Append (Id);
Result.Append ("={value: ");
if Is_Array_Buffer then
Result.Append (Prev);
Result.Append ("};");
Result.Append ("props._size_");
Result.Append (Id);
Result.Append ("={value: ");
Result.Append (Comp_Size);
Result.Append ("}; props.");
Result.Append (Id);
Result.Append ("= {get: function(){ return ");
if Is_Simple_Type then
Result.Append ("this.");
Result.Append (Down);
Result.Append ("[");
Result.Append ("this._pos_");
Result.Append (Id);
Result.Append ("*8/this._size_");
Result.Append (Id);
Result.Append ("]");
else
Result.Append (Down);
Result.Append (".prototype._from_dataview (");
Result.Append ("new DataView (this.A,");
Result.Append ("this._u8.byteOffset+this._pos_");
Result.Append (Id);
Result.Append (",this._size_");
Result.Append (Id);
Result.Append ("/8))");
end if;
Result.Append (";},");
Result.Append ("set: function(_v){ ");
if Is_Simple_Type then
Result.Append ("this.");
Result.Append (Down);
Result.Append ("[");
Result.Append ("this._pos_");
Result.Append (Id);
Result.Append ("*8/this._size_");
Result.Append (Id);
Result.Append ("]=_v");
else
Result.Append (Down);
Result.Append (".prototype._from_dataview (");
Result.Append ("new DataView (this.A,");
Result.Append ("this._u8.byteOffset+this._pos_");
Result.Append (Id);
Result.Append (",this._size_");
Result.Append (Id);
Result.Append ("/8))._assign(_v)");
end if;
Result.Append (";}};");
Prev.Clear;
Prev.Append ("props._pos_");
Prev.Append (Id);
Prev.Append (".value+props._size_");
Prev.Append (Id);
Prev.Append (".value/8");
else
Result.Append ("'");
Result.Append (Id);
Result.Append ("'};");
end if;
end loop;
end;
end loop;
end;
Result.Append ("Object.defineProperties(_result.prototype, props);");
if Is_Array_Buffer then
-- Set _from_dataview
Result.Append
("_result._from_dataview = function _from_dataview(_u8){");
Result.Append ("var result = Object.create (_result.prototype);");
Result.Append ("result.A = _u8.buffer;");
Result.Append
("result._f32 = new Float32Array(_u8.buffer,_u8.byteOffset,");
Result.Append (Size);
Result.Append ("/8/4);");
Result.Append ("result._u8 = _u8;");
Result.Append ("return result;");
Result.Append ("};"); -- End of _from_dataview
end if;
Result.Append ("return _result;");
Result.Append ("})();"); -- End of Wrapper and call it
return Result;
end Code;
----------------
-- Initialize --
----------------
function Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property)
return League.Strings.Universal_String
is
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
Text : League.Strings.Universal_String;
Down : League.Strings.Universal_String;
begin
Text.Append ("{");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
Down := Engine.Text.Get_Property (List (J), Name);
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Engines.Code);
Text.Append (Id);
Text.Append (":");
Text.Append (Down);
if N /= Names'Last then
Text.Append (",");
end if;
end loop;
if J /= List'Last then
Text.Append (",");
end if;
end;
end loop;
Text.Append ("}");
return Text;
end Initialize;
----------
-- Size --
----------
function Size
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
Result : League.Strings.Universal_String;
Down : League.Strings.Universal_String;
begin
Result.Append ("(0");
for J in List'Range loop
Down := Engine.Text.Get_Property (List (J), Name);
Result.Append ("+");
Result.Append (Down);
end loop;
Result.Append (")");
return Result;
end Size;
end Properties.Definitions.Record_Type;
|
pragma License (Unrestricted);
with Ada.Text_IO;
package Ada.Short_Integer_Text_IO is new Text_IO.Integer_IO (Short_Integer);
|
-----------------------------------------------------------------------
-- asf-applications-main-tests - Unit tests for Applications
-- Copyright (C) 2011, 2012, 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Test_Caller;
with Util.Beans.Objects;
with Ada.Unchecked_Deallocation;
with EL.Contexts.Default;
with ASF.Applications.Tests;
with ASF.Applications.Main.Configs;
with ASF.Requests.Mockup;
package body ASF.Applications.Main.Tests is
use Util.Tests;
function Create_Form_Bean return Util.Beans.Basic.Readonly_Bean_Access;
package Caller is new Util.Test_Caller (Test, "Applications.Main");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Read_Configuration",
Test_Read_Configuration'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Create",
Test_Create_Bean'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Load_Bundle",
Test_Load_Bundle'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Register,Load_Bundle",
Test_Bundle_Configuration'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Get_Supported_Locales",
Test_Locales'Access);
end Add_Tests;
-- ------------------------------
-- Initialize the test application
-- ------------------------------
procedure Set_Up (T : in out Test) is
Fact : ASF.Applications.Main.Application_Factory;
C : ASF.Applications.Config;
begin
T.App := new ASF.Applications.Main.Application;
C.Copy (Util.Tests.Get_Properties);
T.App.Initialize (C, Fact);
T.App.Register ("layoutMsg", "layout");
end Set_Up;
-- ------------------------------
-- Deletes the application object
-- ------------------------------
overriding
procedure Tear_Down (T : in out Test) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Applications.Main.Application'Class,
Name => ASF.Applications.Main.Application_Access);
begin
Free (T.App);
end Tear_Down;
function Create_Form_Bean return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Applications.Tests.Form_Bean_Access := new Applications.Tests.Form_Bean;
begin
return Result.all'Access;
end Create_Form_Bean;
-- ------------------------------
-- Test creation of module
-- ------------------------------
procedure Test_Read_Configuration (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path ("config/empty.xml");
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
end Test_Read_Configuration;
-- ------------------------------
-- Test creation of a module and registration in an application.
-- ------------------------------
procedure Test_Create_Bean (T : in out Test) is
use type Util.Beans.Basic.Readonly_Bean_Access;
procedure Check (Name : in String;
Kind : in ASF.Beans.Scope_Type);
procedure Check (Name : in String;
Kind : in ASF.Beans.Scope_Type) is
Value : Util.Beans.Objects.Object;
Bean : Util.Beans.Basic.Readonly_Bean_Access;
Scope : ASF.Beans.Scope_Type;
Context : EL.Contexts.Default.Default_Context;
begin
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String (Name),
Context => Context,
Result => Bean,
Scope => Scope);
T.Assert (Kind = Scope, "Invalid scope for " & Name);
T.Assert (Bean /= null, "Invalid bean object");
Value := Util.Beans.Objects.To_Object (Bean);
T.Assert (not Util.Beans.Objects.Is_Null (Value), "Invalid bean");
-- Special test for the sessionForm bean which is initialized by configuration properties
if Name = "sessionForm" then
T.Assert_Equals ("John.Rambo@gmail.com",
Util.Beans.Objects.To_String (Bean.Get_Value ("email")),
"Session form not initialized");
end if;
end Check;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/test-module.xml");
begin
T.App.Register_Class ("ASF.Applications.Tests.Form_Bean", Create_Form_Bean'Access);
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
-- Check the 'regtests/config/test-module.xml' managed bean configuration.
Check ("applicationForm", ASF.Beans.APPLICATION_SCOPE);
Check ("sessionForm", ASF.Beans.SESSION_SCOPE);
Check ("requestForm", ASF.Beans.REQUEST_SCOPE);
end Test_Create_Bean;
-- ------------------------------
-- Test loading a resource bundle through the application.
-- ------------------------------
procedure Test_Load_Bundle (T : in out Test) is
use type Util.Beans.Basic.Readonly_Bean_Access;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/test-bundle.xml");
Bundle : ASF.Locales.Bundle;
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
T.App.Load_Bundle (Name => "samples",
Locale => "en",
Bundle => Bundle);
Util.Tests.Assert_Equals (T, "Help", String '(Bundle.Get ("layout_help_label")),
"Invalid bundle value");
T.App.Load_Bundle (Name => "asf",
Locale => "en",
Bundle => Bundle);
Util.Tests.Assert_Matches (T, ".*greater than.*",
String '(Bundle.Get ("validators.length.maximum")),
"Invalid bundle value");
end Test_Load_Bundle;
-- ------------------------------
-- Test application configuration and registration of resource bundles.
-- ------------------------------
procedure Test_Bundle_Configuration (T : in out Test) is
use type Util.Beans.Basic.Readonly_Bean_Access;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/test-bundle.xml");
Result : Util.Beans.Basic.Readonly_Bean_Access;
Context : aliased ASF.Contexts.Faces.Faces_Context;
Ctx : aliased EL.Contexts.Default.Default_Context;
Scope : Scope_Type;
begin
Context.Set_ELContext (Ctx'Unchecked_Access);
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
T.App.Set_Context (Context'Unchecked_Access);
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String ("samplesMsg"),
Context => Ctx,
Result => Result,
Scope => Scope);
T.Assert (Result /= null, "The samplesMsg bundle was not created");
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String ("defaultMsg"),
Context => Ctx,
Result => Result,
Scope => Scope);
T.Assert (Result /= null, "The defaultMsg bundle was not created");
end Test_Bundle_Configuration;
-- ------------------------------
-- Test locales.
-- ------------------------------
procedure Test_Locales (T : in out Test) is
use Util.Locales;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/test-locales.xml");
Req : aliased ASF.Requests.Mockup.Request;
View : constant access Applications.Views.View_Handler'Class := T.App.Get_View_Handler;
Context : aliased ASF.Contexts.Faces.Faces_Context;
ELContext : aliased EL.Contexts.Default.Default_Context;
Locale : Util.Locales.Locale;
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (T.App.Get_Default_Locale),
"Invalid default locale");
Context.Set_ELContext (ELContext'Unchecked_Access);
Context.Set_Request (Req'Unchecked_Access);
Req.Set_Header ("Accept-Language", "da, en-gb;q=0.3, fr;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, en-gb, en;q=0.8, fr;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, "en_GB",
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, fr;q=0.7, fr-fr;q=0.8");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, "fr_FR",
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, ru, it;q=0.8, de;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (Locale),
"Invalid calculated locale");
end Test_Locales;
end ASF.Applications.Main.Tests;
|
-- C93005A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT WHEN AN EXCEPTION IS RAISED IN A DECLARATIVE PART, A TASK
-- DECLARED IN THE SAME DECLARATIVE PART BECOMES TERMINATED.
-- CHECK THAT A TASK WAITING ON ENTRIES OF SUCH A
-- TERMINATED-BEFORE-ACTIVATION TASK RECEIVES TASKING_ERROR.
-- JEAN-PIERRE ROSEN 3/9/84
-- JBG 06/01/84
-- JBG 05/23/85
-- EG 10/29/85 ELIMINATE THE USE OF NUMERIC_ERROR IN TEST.
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH REPORT; USE REPORT;
WITH SYSTEM; USE SYSTEM;
PROCEDURE C93005A IS
BEGIN
TEST("C93005A", "EXCEPTIONS RAISED IN A DECLARATIVE PART " &
"CONTAINING TASKS");
BEGIN
DECLARE
TASK TYPE T1 IS -- CHECKS THAT T2 TERMINATES.
END T1;
TYPE AT1 IS ACCESS T1;
TASK T2 IS -- WILL NEVER BE ACTIVATED.
ENTRY E;
END T2;
PACKAGE RAISE_IT IS
END RAISE_IT;
TASK BODY T2 IS
BEGIN
FAILED ("T2 ACTIVATED");
-- IN CASE OF FAILURE
LOOP
SELECT
ACCEPT E;
OR
TERMINATE;
END SELECT;
END LOOP;
END T2;
TASK BODY T1 IS
BEGIN
DECLARE -- THIS BLOCK TO CHECK THAT T3 TERMINATES.
TASK T3 IS
END T3;
TASK BODY T3 IS
BEGIN
T2.E;
FAILED ("RENDEZVOUS COMPLETED WITHOUT " &
"ERROR - T3");
EXCEPTION
WHEN TASKING_ERROR =>
NULL;
WHEN OTHERS =>
FAILED("ABNORMAL EXCEPTION - T3");
END T3;
BEGIN
NULL;
END;
T2.E; --T2 IS NOW TERMINATED
FAILED ("RENDEZVOUS COMPLETED WITHOUT ERROR - T1");
EXCEPTION
WHEN TASKING_ERROR =>
NULL;
WHEN OTHERS =>
FAILED("ABNORMAL EXCEPTION - T1");
END;
PACKAGE BODY RAISE_IT IS
PT1 : AT1 := NEW T1;
I : POSITIVE := IDENT_INT(0); -- RAISE
-- CONSTRAINT_ERROR.
BEGIN
IF I /= IDENT_INT(2) OR I = IDENT_INT(1) + 1 THEN
FAILED ("PACKAGE DIDN'T RAISE EXCEPTION");
END IF;
END RAISE_IT;
BEGIN -- CAN'T LEAVE BLOCK UNTIL T1, T2, AND T3 ARE TERM.
FAILED ("EXCEPTION NOT RAISED");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN TASKING_ERROR =>
FAILED ("TASKING_ERROR IN MAIN PROGRAM");
WHEN OTHERS =>
FAILED ("ABNORMAL EXCEPTION IN MAIN-1");
END;
RESULT;
END C93005A;
|
generic
type Elem is private;
type Index is (<>);
type Tomb is array (Index range <>) of Elem;
function Duplication (T: in out Tomb) return Boolean;
|
-------------------------------------------------------------------------------
-- package body Gamma, Log of Gamma Function
-- Copyright (C) 1995-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
-- Thanks are due to Peter Luschny for the web page and discussion of
-- the Stieltjes continued fraction gamma function.
--
-- Parameter Error correction is based on visual inspection!
-- Parameter Error detection is based on procedure Test_Stieltjes_Coefficients.
with ada.numerics.generic_elementary_functions;
with Gamma_1_to_3;
package body Gamma is
package mathz is new ada.numerics.generic_elementary_functions(Real); use Mathz;
package Remez_Gamma is new Gamma_1_to_3(Real); use Remez_Gamma;
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Three : constant Real := +3.0;
Half_Log_Two_Pi : constant Real :=
+0.91893853320467274178032973640561763986139747363778341;
--+0.91893853320467274178032973640561763986139747363778341;
--+0.91893853320467274178032973640561763986139747363778341;
-- Coefficients for the Stieltjes continued fraction gamma function.
b00 : constant Real := Zero;
b01 : constant Real := One / (+12.0);
b02 : constant Real := One / (+30.0);
b03 : constant Real := (+53.0) / (+210.0);
b04 : constant Real := (+195.0) / (+371.0);
b05 : constant Real := (+22999.0) / (+22737.0);
b06 : constant Real := (+29944523.0) / (+19733142.0);
b07 : constant Real := (+109535241009.0) / (+48264275462.0);
b08 : constant Real :=
+3.00991738325939817007314073420771572737347407676490429;
--+3.00991738325939817007314073420771572737347407676490429;
--+3.00991738325939817007314073420771572737347407676490429;
b09 : constant Real :=
+4.02688719234390122616887595318144283632660221257447127;
--+4.02688719234390122616887595318144283632660221257447127;
--+4.02688719234390122616887595318144283632660221257447127;
b10 : constant Real :=
+5.00276808075403005168850241227618857481218316757980572;
--+5.00276808075403005168850241227618857481218316757980572;
--+5.00276808075403005168850241227618857481218316757980572;
b11 : constant Real :=
+6.28391137081578218007266315495164726427843982033318771;
--+6.28391137081578218007266315495164726427843982033318771;
--+6.28391137081578218007266315495164726427843982033318771;
b12 : constant Real :=
+7.49591912238403392975235470826750546574579869781542533;
--+7.49591912238403392975235470826750546574579869781542533;
--+7.49591912238403392975235470826750546574579869781542533;
type CF_Coeff_range is range 0 .. 12;
type CF_Coeff is array(CF_Coeff_range) of Real;
---------------------------------
-- Evaluate_Continued_Fraction --
---------------------------------
-- no attempt here to prevent overflow
-- CF_value := a0 + b1/(a1 + b2/(a2 + b3/( ...)))
procedure Evaluate_Continued_Fraction
(CF_value : out Real;
Truncation_Error : out Real;
a, b : in CF_Coeff;
Max_Term_in_Series : in CF_Coeff_Range := CF_Coeff_Range'Last;
Error_Estimate_Desired : in Boolean := False)
is
P, Q : array (-1 .. Max_Term_in_Series) of Real;
begin
Q(-1) := Zero;
Q(0) := One;
P(-1) := One;
P(0) := a(0);
for j in 1 .. Max_Term_in_Series loop
P(j) := a(j) * P(j-1) + b(j) * P(j-2);
Q(j) := a(j) * Q(j-1) + b(j) * Q(j-2);
end loop;
CF_value := P(Max_Term_in_Series) / Q(Max_Term_in_Series);
Truncation_Error := Zero;
if Error_Estimate_Desired then
Truncation_Error :=
CF_value - P(Max_Term_in_Series-1) / Q(Max_Term_in_Series-1);
end if;
end Evaluate_Continued_Fraction;
---------------
-- Log_Gamma --
---------------
-- For x < 14 uses rational polynomial approximations.
-- For x > 14, uses Stieltjes' continued fraction gamma:
--
-- gamma(N) := (N-1)!
-- gamma(m+1) := m!
--
-- Stieltjes' continued fraction gamma:
--
-- good to 16 sig figures for x > 4.5
-- good to 19 sig figures for x > 7
-- good to 21 sig figures for x > 10
--
-- based on trunc_error, and on comparison with rational poly-gamma function,
-- but very approximate!
-- Expect 32 sig figures at not much higher than x=12, but not yet measured.
--
function Log_Gamma (x : in Real) return Real
is
a : constant CF_Coeff := (Zero, others => x);
b : constant CF_Coeff :=
(b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12);
CF, Trunc_Error, Log_Kernal_x, Log_Gamma_x : real;
begin
if not x'Valid then raise Constraint_Error; end if;
-- In some cases, input of (say) inf or NaN will make numeric programs
-- hang rather than crash .. very difficult to diagnose, so this seems
-- best policy for function calls that are rarely found in time-sensitive
-- inner loops. Very nice feature, 'Valid!
if x <= Zero then
raise Constraint_Error; -- or is math arg error.
end if;
if x < 14.0 then
return Log_Gamma_0_to_16 (x);
end if;
-- For testing. these 3 should give identical answers:
-- CF := (1.0/12.0)/(x + (1.0/30.0)/(x + (53.0/210.0)/(x + (195.0/371.0)/x)));
-- CF := a(0) + b(1)/(a(1) + b(2)/(a(2) + b(3)/(a(3) + b(4)/(a(4)))));
-- Evaluate_Continued_Fraction (CF, Trunc_Error, a, b, 4, True);
Evaluate_Continued_Fraction (CF, Trunc_Error, a, b, CF_Coeff_range'Last, True);
-- text_io.put_line(Real'image(Trunc_Error));
Log_Kernal_x := Half_Log_Two_Pi + (x - 0.5)*Log (x) - x;
Log_Gamma_x := Log_Kernal_x + CF;
return Log_Gamma_x;
end Log_Gamma;
-- reduce argument from x > 3 to x in [2,3]
--
-- gamma (x + 1) = x * gamma(x) (gamma(i) = (i-1)!)
--
-- x in [3,4]:
-- log_gamma (x + 1) = log(x) + log_gamma(x)
-- log_gamma (x) = log((x-1)) + log_gamma(x-1)
--
-- x in [4,5]:
-- log_gamma (x + 2) = log(x+1) + log_gamma(x+1) = log((x)*(x+1)) + log_gamma(x)
-- log_gamma (x) = log((x-2)*(x-1)) + log_gamma(x-2)
--
-- x in [5,6]:
-- log_gamma (x + 3) = log(x+2) + log_gamma(x+2) = log((x)*(x+1)*(x+2)) + log_gamma(x)
-- log_gamma (x) = log((x-3)*(x-2)*(x-1)) + log_gamma(x-3)
--
function Log_Gamma_0_to_16 (x : in Real) return Real
is
Val, Arg, Prod : Real := Zero;
Steps : Integer;
begin
if x <= Zero then
raise Constraint_Error;
end if;
if x > +16.0 then
raise Constraint_Error;
end if;
if x > Three then
-- log_gamma (x) = log((x-1)) + log_gamma(x-1) x in [3,4]
-- log_gamma (x) = log((x-2)*(x-1)) + log_gamma(x-2) x in [4,5]
-- log_gamma (x) = log((x-3)*(x-2)*(x-1)) + log_gamma(x-3) x in [5,6]
Steps := 1 + Integer (x - Three);
Arg := x - Real(Steps);
Prod := Arg;
for i in 1..Steps-1 loop
Prod := Prod * (x - Real(i));
end loop;
Val := Log (Prod) + Log_Gamma_1_to_3 (Arg);
elsif x >= One then
Val := Log_Gamma_1_to_3 (x);
elsif x > Real_Epsilon then
-- x in [eps/8, 1]:
--
-- gamma (x + 1) = x * gamma(x)
-- log_gamma (x + 1) = Log(x) + log_gamma(x)
-- log_gamma (x) = -Log(x) + log_gamma(x+1)
Val := -Log (x) + Log_Gamma_1_to_3 (x + One);
else
Val := -Log (x);
end if;
return Val;
end Log_Gamma_0_to_16;
-- Just make sure that CF_Coeff's have not mutated:
procedure Test_Stieltjes_Coefficients
is
Difference : Real;
Numerator : constant CF_Coeff :=
(0.0, 1.0, 1.0, 53.0, 195.0, 22999.0, 29944523.0, 109535241009.0,
29404527905795295658.0,
455377030420113432210116914702.0,
26370812569397719001931992945645578779849.0,
152537496709054809881638897472985990866753853122697839.0,
100043420063777451042472529806266909090824649341814868347109676190691.0);
Denominator : constant CF_Coeff :=
(1.0, 12.0, 30.0, 210.0, 371.0, 22737.0, 19733142.0, 48264275462.0,
9769214287853155785.0,
113084128923675014537885725485.0,
5271244267917980801966553649147604697542.0,
24274291553105128438297398108902195365373879212227726.0,
13346384670164266280033479022693768890138348905413621178450736182873.0);
B_coeff : constant CF_Coeff :=
(b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12);
begin
for i in CF_Coeff_range loop
Difference := B_coeff(i) - Numerator(i) / Denominator(i);
if Abs Difference > 16.0 * Real_Epsilon then
raise Program_Error;
end if;
end loop;
end Test_Stieltjes_Coefficients;
end Gamma;
|
procedure Diff (X, Y : in Natural; Z : out Natural) with
SPARK_Mode,
Depends => (Z => (X, Y))
is
begin
Z := X + X;
end Diff;
|
with Ada.Unchecked_Deallocation;
with DOM.Core.Nodes;
with Ada.Text_IO; use Ada.Text_IO;
package body XML_Scanners is
-------------------
-- Child_Scanner --
-------------------
function Create_Child_Scanner
(Parent : DOM.Core.Node)
return XML_Scanner
is
use Ada.Finalization;
begin
return XML_Scanner'(Limited_Controlled with Acc =>
new XML_Scanner_Data'
(Nodes => DOM.Core.Nodes.Child_Nodes (Parent),
Cursor => 0));
end Create_Child_Scanner;
----------------------
-- No_More_Children --
----------------------
function No_More_Children
(Scanner : XML_Scanner)
return Boolean
is
begin
return Scanner.Acc.Cursor >= DOM.Core.Nodes.Length (Scanner.Acc.Nodes);
end No_More_Children;
function Remaining_Children (Scanner : XML_Scanner)
return Natural
is
begin
if Scanner.No_More_Children then
return 0;
else
return DOM.Core.Nodes.Length (Scanner.Acc.Nodes)-Scanner.Acc.Cursor;
end if;
end Remaining_Children;
---------------
-- Peek_Name --
---------------
function Peek_Name
(Scanner : XML_Scanner)
return String
is
use DOM.Core.Nodes;
begin
if Scanner.No_More_Children then
return No_Name;
else
return Node_Name (Item (Scanner.Acc.Nodes, Scanner.Acc.Cursor));
end if;
end Peek_Name;
function Peek_Node
(Scanner : XML_Scanner)
return DOM.Core.Node
is
use DOM.Core.Nodes;
begin
if Scanner.No_More_Children then
return null;
else
return Item (Scanner.Acc.Nodes, Scanner.Acc.Cursor);
end if;
end Peek_Node;
----------
-- Scan --
----------
function Scan
(Scanner : XML_Scanner)
return DOM.Core.Node
is
use DOM.Core;
begin
if Scanner.No_More_Children then
return null;
else
declare
Result : constant Node := Scanner.Peek_Node;
begin
Scanner.Acc.Cursor := Scanner.Acc.Cursor + 1;
return Result;
end;
end if;
end Scan;
procedure Expect (Scanner : XML_Scanner;
Name : String)
is
pragma Unreferenced (Name);
begin
if Scanner.Peek_Name /= "name" then
raise Unexpected_Node;
end if;
end Expect;
procedure Parse_Sequence
(Scanner : in out XML_Scanner;
Name : in String;
Callback : not null access procedure (N : DOM.Core.Node);
Min_Length : in Natural := 1;
Max_Length : in Natural := No_Limit)
is
Counter : Natural := 0;
begin
Put_Line ("PARSE SEQUENCE");
Dom.Core.Nodes.Print (Scanner.Peek_Node);
while Scanner.Peek_Name = Name loop
if Max_Length /= No_Limit and Counter = Max_Length then
raise Unexpected_Node;
end if;
Callback (Scanner.Scan);
Counter := Counter + 1;
end loop;
if Counter < Min_Length then
Put("[");
Dom.Core.Nodes.Print (Scanner.Peek_Node);
Put_Line ("]");
raise Unexpected_Node with "Expected '" & Name & "' found '" & Scanner.Peek_Name & "'" ;
end if;
end Parse_Sequence;
procedure Parse_Optional
(Scanner : in out XML_Scanner;
Name : in String;
Callback : not null access procedure (N : DOM.Core.Node))
is
begin
Scanner.Parse_Sequence (Name => Name,
Callback => Callback,
Min_Length => 0,
Max_Length => 1);
end Parse_Optional;
procedure Parse_Single_Node
(Scanner : in out XML_Scanner;
Name : in String;
Callback : not null access procedure (N : DOM.Core.Node))
is
begin
Scanner.Parse_Sequence (Name => Name,
Callback => Callback,
Min_Length => 1,
Max_Length => 1);
end Parse_Single_Node;
procedure Expect_End_Of_Children (Scanner : XML_Scanner)
is
begin
if not Scanner.No_More_Children then
raise Unexpected_Node;
end if;
end Expect_End_Of_Children;
function Parse_Text_Node (Scanner : XML_Scanner;
Name : String)
return String
is
use DOM.Core;
begin
if Scanner.Peek_Name /= Name then
raise Unexpected_Node;
end if;
declare
S : constant XML_Scanner := Create_Child_Scanner(Scanner.Scan);
begin
if S.Remaining_Children /= 1 or else S.Peek_Name /= "#text" then
raise Unexpected_Node;
end if;
return Nodes.Node_Value (S.Scan);
end;
end Parse_Text_Node;
procedure Process_Sequence
(Scanner : in out XML_Scanner;
Name : in String;
Processor : in out Abstract_Node_Processor'Class;
Min_Length : in Natural := 1;
Max_Length : in Natural := No_Limit)
is
procedure Call_Processor (N : DOM.Core.Node) is
begin
Processor.Process (N);
end Call_Processor;
begin
Scanner.Parse_Sequence (Name => Name,
Callback => Call_Processor'Access,
Min_Length => Min_Length,
Max_Length => Max_Length);
end Process_Sequence;
--------------
-- Finalize --
--------------
overriding procedure Finalize
(Object : in out XML_Scanner)
is
procedure Free is
new Ada.Unchecked_Deallocation (Object => XML_Scanner_Data,
Name => XML_Scanner_Data_Access);
begin
Free (Object.Acc);
end Finalize;
end XML_Scanners;
|
-----------------------------------------------------------------------
-- package body Clenshaw. Generates functions from recurrance relations.
-- Copyright (C) 2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
package body Clenshaw is
Zero : constant Real := +0.0;
-----------------
-- Evaluate_Qs --
-----------------
-- The recurrance relation for the Q's at X is easily written as matrix
-- equation. In the following, f(X) is the given function for Q_0:
--
-- Q(0) = Q_0(p,X);
-- Q(1) = 0 + Alpha_1*Q_0;
-- Q(2) = 0 + Alpha_2*Q_1 + Beta_2*Q_0;
-- Q(3) = 0 + Alpha_3*Q_2 + Beta_3*Q_1;
-- ...
-- Q(N) = 0 + Alpha_N*Q_N-1 + Beta_N*Q_N-2
--
-- In matrix form, M*Q = (f(X), 0, 0, ...) , this becomes:
--
-- | 1 0 0 0 | |Q(0)| | Q_0(p,X)| | C_0 |
-- | E_1 1 0 0 | |Q(1)| = | 0 | = | C_1 |
-- | B_2 E_2 1 0 | |Q(2)| | 0 | | C_2 |
-- | 0 B_3 E_3 1 | |Q(3)| | 0 | | C_3 |
--
-- where E_m = -Alpha_m, B_m = -Beta_m.
--
-- So Q = M_inverse * C is the desired solution, but there may be numerical
-- error in the calculation of M_inverse by back-substitution. The
-- solution vector Q can be improved numerically by iterative refinement
-- via Newton's method:
--
-- Q_new = Q_old + M_inverse * (C - M*Q_old)
--
-- where Q = M_inverse * C is the calculation of Q given at the top.
--
procedure Evaluate_Qs
(X : in Real;
Q : in out Poly_Values;
Max_Poly_ID : in Poly_ID_Type;
P : in Real := 0.0;
No_Of_Iterations : in Positive := 1)
is
Product, Del : Poly_Values;
m : Poly_ID_Type;
begin
--
-- Step 0. Initialize excess values of Q to Zero.
--
if Max_Poly_ID < Poly_ID_Type'Last then
for m in Max_Poly_ID+1 .. Poly_ID_Type'Last loop
Q(m) := Zero;
end loop;
end if;
--
-- Step 0. Want zeroth order poly Q_0(p,X). No work to do.
--
if Max_Poly_ID = Poly_ID_Type'First then
m := Poly_ID_Type'First;
Q(m) := Q_0(p,X);
end if;
--
-- Step 0b. Poly is 1st order. Almost no work to do.
-- Don't do any iteration.
--
if Max_Poly_ID = Poly_ID_Type'First + 1 then
m := Poly_ID_Type'First;
Q(m) := Q_0(p,X);
m := Poly_ID_Type'First+1;
Q(m) := Alpha(m,p,X) * Q(m-1);
end if;
--
-- Step 1. We now know that Max_Poly_ID > 1.
-- Start by getting starting value of Q by solving M*Q = f.
-- Use recurrence relation to get Q at X.
-- Start with special formulas for the 1st two Q's:
--
if Max_Poly_ID > Poly_ID_Type'First + 1 then
m := Poly_ID_Type'First;
Q(m) := Q_0(p,X);
m := Poly_ID_Type'First+1;
Q(m) := Alpha(m,p,X) * Q(m-1);
for m in Poly_ID_Type'First+2..Max_Poly_ID loop
Q(m) := Alpha(m,p,X) * Q(m-1)
+ Beta(m,p,X) * Q(m-2);
end loop;
--
-- Step 2. Improve Q numerically through Newton iteration.
-- Q_new = Q_old + M_inverse * (C - M*Q_old)
--
Iterate: for Iter in 2..No_Of_Iterations loop
-- Get Product = M*Q_old:
m := Poly_ID_Type'First;
Product(m) := Q(m);
m := Poly_ID_Type'First+1;
Product(m) := Q(m) - Alpha(m,p,X)*Q(m-1);
for m in Poly_ID_Type'First+2..Max_Poly_ID loop
Product(m) := Q(m) - Alpha(m,p,X)*Q(m-1)
- Beta(m,p,X)*Q(m-2);
end loop;
-- Get Residual = (Q_0(p,X), 0, ... , 0) - M*D_old. Reuse the
-- array Product to hold the value of Residual:
Product(Poly_ID_Type'First) := Zero;
-- Residual is always exactly 0.0 here
for m in Poly_ID_Type'First+1 .. Max_Poly_ID loop
Product(m) := - Product(m);
end loop;
-- Get Del = M_inverse * (C - M*Q_old) = M_inverse * Product:
m := Max_Poly_ID;
Del(m) := Product(m);
m := Max_Poly_ID - 1;
Del(m) := Product(m) + Alpha(m,p,X)*Del(m-1);
for m in Poly_ID_Type'First+2 .. Max_Poly_ID loop
Del(m) := Product(m) + Alpha(m,p,X)*Del(m-1)
+ Beta(m,p,X)*Del(m-2);
end loop;
-- Get Q_new = Q_old + Del;
for m in Poly_ID_Type'First..Max_Poly_ID loop
Q(m) := Q(m) + Del(m);
end loop;
end loop Iterate;
end if;
end Evaluate_Qs;
-------------
-- M_times --
-------------
-- M is Upper-Triangular.
-- The elements of M are 1 down the diagonal, and -Alpha(m,p,X) and
-- -Beta(m,p,X) down the the off-diagonals.
--
function M_times
(D : in Coefficients;
X : in Real;
P : in Real;
Sum_Limit : in Poly_ID_Type)
return Coefficients
is
Product : Coefficients;
m : Poly_ID_Type;
begin
-- These inits are amazingly slow!
for m in Sum_Limit .. Poly_ID_Type'Last loop
Product(m) := Zero;
end loop;
-- Get Product = M*D:
m := Sum_Limit;
Product(m) := D(m);
if Sum_Limit > Poly_ID_Type'First then
m := Sum_Limit - 1;
Product(m) := D(m) - Alpha(m+1,p,X)*D(m+1);
end if;
if Sum_Limit > Poly_ID_Type'First+1 then
for m in Poly_ID_Type'First .. Sum_Limit-2 loop
Product(m) := D(m) - Alpha(m+1,p,X)*D(m+1)
- Beta(m+2,p,X)*D(m+2);
end loop;
end if;
return Product;
end M_times;
pragma Inline (M_times);
---------------------
-- M_inverse_times --
---------------------
-- M is Upper-Triangular so solution is by back-substitution.
-- The elements of M are 1 down the diagonal, and -Alpha and
-- -Beta down the off-diagonals.
--
function M_inverse_times
(C : in Coefficients;
X : in Real;
P : in Real;
Sum_Limit : in Poly_ID_Type)
return Coefficients
is
Result : Coefficients;
m : Poly_ID_Type;
begin
-- These inits are amazingly slow!
for m in Sum_Limit .. Poly_ID_Type'Last loop
Result(m) := Zero;
end loop;
m := Sum_Limit;
Result(m) := C(m);
if Sum_Limit > Poly_ID_Type'First then
m := Sum_Limit - 1;
Result(m) := C(m) + Alpha(m+1,p,X) * Result(m+1);
end if;
if Sum_Limit > Poly_ID_Type'First+1 then
for m in reverse Poly_ID_Type'First .. Sum_Limit-2 loop
Result(m) := C(m) + Alpha(m+1,p,X) * Result(m+1)
+ Beta(m+2,p,X) * Result(m+2);
end loop;
end if;
return Result;
end M_inverse_times;
pragma Inline (M_inverse_times);
---------
-- Sum --
---------
-- This is easily written as matrix equation, with Sum = D(0):
--
-- D_n = C_n;
-- D_n-1 = C_n-1 + Alpha_n*D_n;
-- D_n-2 = C_n-2 + Alpha_n-1*D_n-1 + Beta_n-2*D_n-2;
-- ...
-- D_1 = C_1 + Alpha_2*D_2 + Beta_3*D_3
-- D_0 = C_0 + Alpha_1*D_1 + Beta_2*D_2
--
-- In matrix form, M*D = C, this becomes:
--
--
-- | 1 E_1 B_2 0 | |D(0) | | C(0) |
-- | 0 1 E_2 B_3 | |D(1) | | C(1) |
--
-- ...
--
-- | 1 E_n-2 B_n-1 0 | |D(n-3)| = | C(n-3) |
-- | 0 1 E_n-1 B_n | |D(n-2)| | C(n-2) |
-- | 0 0 1 E_n | |D(n-1)| | C(n-1) |
-- | 0 0 0 1 | |D(n) | | C(n) |
--
-- where E_m = -Alpha_m, B_m = -Beta_m.
--
-- Can attemp iterative refinement of D with Newton's
-- method:
-- D_new = D_old + M_inverse * (C - M*D_old)
--
-- where D = M_inverse * C is the calculation of D given at the top. if the
-- said calculation of D is numerically imperfect, then the iteration above
-- will produce improved values of D. Of course, if the Coefficients of
-- the polynomials C are numerically poor, then this effort may be wasted.
--
function Sum
(X : in Real;
C : in Coefficients;
Sum_Limit : in Poly_ID_Type;
P : in Real := 0.0;
No_Of_Iterations : in Positive := 1)
return Real
is
Product, Del : Coefficients; -- initialized by M_inverse_times and M_times.
D : Coefficients; -- initialized by M_inverse_times.
Result : Real := Zero;
begin
--
-- Step 1. Getting starting value of D (D_old) by solving M*D = C.
--
D := M_inverse_times (C, X, p, Sum_Limit);
--
-- Step 2. Improve D numerically through Newton iteration.
-- D_new = D_old + M_inverse * (C - M*D_old)
--
Iterate: for k in 2..No_Of_Iterations loop
-- Get Product = M*D_old:
Product := M_times (D, X, p, Sum_Limit);
-- Get Residual = C - M*D_old. Reuse the array Product
-- to hold the value of Residual:
for m in Poly_ID_Type'First..Sum_Limit loop
Product(m) := C(m) - Product(m);
end loop;
-- Get Del = M_inverse * (A - M*D_old) = M_inverse * Product:
Del := M_inverse_times (Product, X, p, Sum_Limit);
-- Get D_new = D_old + Del;
for m in Poly_ID_Type'First..Sum_Limit loop
D(m) := D(m) + Del(m);
end loop;
end loop Iterate;
Result := D(0) * Q_0 (p, X);
return Result;
end Sum;
end Clenshaw;
|
with System.BB.Threads.Queues;
use System.BB.Threads;
with System.Tasking;
use System.Tasking;
package body System.TTS_Support is
procedure Suspend_Thread (Thread : System.BB.Threads.Thread_Id);
procedure Resume_Thread (Thread : System.BB.Threads.Thread_Id);
procedure Hold (T : System.BB.Threads.Thread_Id;
Check_Protected_Action : Boolean := False) is
T_Id : constant Task_Id := To_Task_Id (T.ATCB);
begin
if not Is_Held (T) then
if T_Id.Common.Protected_Action_Nesting = 0 then
T_Id.Common.State := Asynchronous_Hold;
T.Hold_Signaled := False;
Suspend_Thread (T);
elsif Check_Protected_Action and then
T_Id.Common.Protected_Action_Nesting > 1
then
raise Program_Error with ("Hold requested in a PA");
else
T.Hold_Signaled := True;
end if;
end if;
end Hold;
procedure Continue (T : System.BB.Threads.Thread_Id) is
T_Id : constant Task_Id := To_Task_Id (T.ATCB);
begin
pragma Assert (Is_Held (T));
if Is_Held (T) then
T_Id.Common.State := Runnable;
Resume_Thread (T);
elsif T.Hold_Signaled then
T.Hold_Signaled := False;
end if;
end Continue;
function Is_Held (T : System.BB.Threads.Thread_Id)
return Boolean is
T_Id : constant Task_Id := To_Task_Id (T.ATCB);
begin
return (T_Id.Common.State = Asynchronous_Hold);
end Is_Held;
procedure Suspend_Thread (Thread : System.BB.Threads.Thread_Id) is
begin
Thread.State := Suspended;
Queues.Extract (Thread);
end Suspend_Thread;
procedure Resume_Thread (Thread : System.BB.Threads.Thread_Id) is
begin
Thread.State := Runnable;
Queues.Insert (Thread);
end Resume_Thread;
end System.TTS_Support;
|
-- { dg-do run }
-- { dg-options "-gnatws" }
with Text_IO;
procedure renaming2 is
type RealNodeData;
type RefRealNodeData is access RealNodeData;
type ExpressionEntry;
type RefExpression is access ExpressionEntry;
type RefDefUseEntry is access Natural;
type ExpressionEntry is
record
Number : RefDefUseEntry;
Id : Integer;
end record;
type RealNodeData is
record
Node : RefExpression;
Id : Integer;
end record;
for ExpressionEntry use
record
Number at 0 range 0 .. 63;
Id at 8 range 0 .. 31;
end record ;
for RealNodeData use
record
Node at 0 range 0 .. 63;
Id at 8 range 0 .. 31;
end record ;
U_Node : RefDefUseEntry := new Natural'(1);
E_Node : RefExpression := new ExpressionEntry'(Number => U_Node,
Id => 2);
R_Node : RefRealNodeData := new RealNodeData'(Node => E_Node,
Id => 3);
procedure test_routine (NodeRealData : RefRealNodeData)
is
OldHead : RefDefUseEntry renames NodeRealData.all.Node.all.Number;
OldHead1 : constant RefDefUseEntry := OldHead;
begin
NodeRealData.all.Node := new ExpressionEntry'(Number => null, Id => 4);
declare
OldHead2 : constant RefDefUseEntry := OldHead;
begin
if OldHead1 /= OldHead2
then
Text_IO.Put_Line (" OldHead changed !!!");
end if;
end;
end;
begin
test_routine (R_Node);
end;
|
-- C49022A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT NAMED NUMBER DECLARATIONS (INTEGER) MAY USE EXPRESSIONS
-- WITH INTEGERS.
-- BAW 29 SEPT 80
-- TBN 10/28/85 RENAMED FROM C4A001A.ADA. ADDED RELATIONAL
-- OPERATORS AND USE OF NAMED NUMBERS.
WITH REPORT;
PROCEDURE C49022A IS
USE REPORT;
ADD1 : CONSTANT := 1 + 1;
ADD2 : CONSTANT := 1 + (-1);
ADD3 : CONSTANT := (-1) + 1;
ADD4 : CONSTANT := (-1) + (-1);
SUB1 : CONSTANT := 1 - 1;
SUB2 : CONSTANT := 1 - (-1);
SUB3 : CONSTANT := (-1) - 1;
SUB4 : CONSTANT := (-1) - (-1);
MUL1 : CONSTANT := 1 * 1;
MUL2 : CONSTANT := 1 * (-1);
MUL3 : CONSTANT := (-1) * 1;
MUL4 : CONSTANT := (-1) * (-1);
DIV1 : CONSTANT := 1 / 1;
DIV2 : CONSTANT := 1 / (-1);
DIV3 : CONSTANT := (-1) / 1;
DIV4 : CONSTANT := (-1) / (-1);
REM1 : CONSTANT := 14 REM 5;
REM2 : CONSTANT := 14 REM(-5);
REM3 : CONSTANT :=(-14) REM 5;
REM4 : CONSTANT :=(-14) REM(-5);
MOD1 : CONSTANT := 4 MOD 3;
MOD2 : CONSTANT := 4 MOD (-3);
MOD3 : CONSTANT := (-4) MOD 3;
MOD4 : CONSTANT := (-4) MOD (-3);
EXP1 : CONSTANT := 1 ** 1;
EXP2 : CONSTANT := (-1) ** 1;
ABS1 : CONSTANT := ABS( - 10 );
ABS2 : CONSTANT := ABS( + 10 );
TOT1 : CONSTANT := ADD1 + SUB1 - MUL1 + DIV1 - REM3 + MOD2 - EXP1;
LES1 : CONSTANT := BOOLEAN'POS (1 < 2);
LES2 : CONSTANT := BOOLEAN'POS (1 < (-2));
LES3 : CONSTANT := BOOLEAN'POS ((-1) < (-2));
LES4 : CONSTANT := BOOLEAN'POS (ADD1 < SUB1);
GRE1 : CONSTANT := BOOLEAN'POS (2 > 1);
GRE2 : CONSTANT := BOOLEAN'POS ((-1) > 2);
GRE3 : CONSTANT := BOOLEAN'POS ((-1) > (-2));
GRE4 : CONSTANT := BOOLEAN'POS (ADD1 > SUB1);
LEQ1 : CONSTANT := BOOLEAN'POS (1 <= 1);
LEQ2 : CONSTANT := BOOLEAN'POS ((-1) <= 1);
LEQ3 : CONSTANT := BOOLEAN'POS ((-1) <= (-2));
LEQ4 : CONSTANT := BOOLEAN'POS (ADD2 <= SUB3);
GEQ1 : CONSTANT := BOOLEAN'POS (2 >= 1);
GEQ2 : CONSTANT := BOOLEAN'POS ((-2) >= 1);
GEQ3 : CONSTANT := BOOLEAN'POS ((-2) >= (-1));
GEQ4 : CONSTANT := BOOLEAN'POS (ADD2 >= SUB3);
EQU1 : CONSTANT := BOOLEAN'POS (2 = 2);
EQU2 : CONSTANT := BOOLEAN'POS ((-2) = 2);
EQU3 : CONSTANT := BOOLEAN'POS ((-2) = (-2));
EQU4 : CONSTANT := BOOLEAN'POS (ADD2 = SUB3);
NEQ1 : CONSTANT := BOOLEAN'POS (2 /= 2);
NEQ2 : CONSTANT := BOOLEAN'POS ((-2) /= 1);
NEQ3 : CONSTANT := BOOLEAN'POS ((-2) /= (-2));
NEQ4 : CONSTANT := BOOLEAN'POS (ADD2 /= SUB3);
BEGIN
TEST("C49022A","CHECK THAT NAMED NUMBER DECLARATIONS (INTEGER) " &
"MAY USE EXPRESSIONS WITH INTEGERS");
IF ADD1 /= 2 OR ADD2 /= 0 OR ADD3 /= 0 OR ADD4 /= -2 THEN
FAILED("ERROR IN THE ADDING OPERATOR +");
END IF;
IF SUB1 /= 0 OR SUB2 /= 2 OR SUB3 /= -2 OR SUB4 /= 0 THEN
FAILED("ERROR IN THE ADDING OPERATOR -");
END IF;
IF MUL1 /= 1 OR MUL2 /= -1 OR MUL3 /= -1 OR MUL4 /= 1 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR *");
END IF;
IF DIV1 /= 1 OR DIV2 /= -1 OR DIV3 /= -1 OR DIV4 /= 1 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR /");
END IF;
IF REM1 /= 4 OR REM2 /= 4 OR REM3 /= -4 OR REM4 /= -4 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR REM");
END IF;
IF MOD1 /= 1 OR MOD2 /= -2 OR MOD3 /= 2 OR MOD4 /= -1 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR MOD");
END IF;
IF EXP1 /= 1 OR EXP2 /= -1 THEN
FAILED("ERROR IN THE EXPONENTIATING OPERATOR");
END IF;
IF ABS1 /= 10 OR ABS2 /= 10 THEN
FAILED("ERROR IN THE ABS OPERATOR");
END IF;
IF TOT1 /= 3 THEN
FAILED("ERROR IN USING NAMED NUMBERS WITH OPERATORS");
END IF;
IF LES1 /= 1 OR LES2 /= 0 OR LES3 /= 0 OR LES4 /= 0 THEN
FAILED("ERROR IN THE LESS THAN OPERATOR");
END IF;
IF GRE1 /= 1 OR GRE2 /= 0 OR GRE3 /= 1 OR GRE4 /= 1 THEN
FAILED("ERROR IN THE GREATER THAN OPERATOR");
END IF;
IF LEQ1 /= 1 OR LEQ2 /= 1 OR LEQ3 /= 0 OR LEQ4 /= 0 THEN
FAILED("ERROR IN THE LESS THAN EQUAL OPERATOR");
END IF;
IF GEQ1 /= 1 OR GEQ2 /= 0 OR GEQ3 /= 0 OR GEQ4 /= 1 THEN
FAILED("ERROR IN THE GREATER THAN EQUAL OPERATOR");
END IF;
IF EQU1 /= 1 OR EQU2 /= 0 OR EQU3 /= 1 OR EQU4 /= 0 THEN
FAILED("ERROR IN THE EQUAL OPERATOR");
END IF;
IF NEQ1 /= 0 OR NEQ2 /= 1 OR NEQ3 /= 0 OR NEQ4 /= 1 THEN
FAILED("ERROR IN THE NOT EQUAL OPERATOR");
END IF;
RESULT;
END C49022A;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y M B O L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-2020, 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. --
-- --
------------------------------------------------------------------------------
-- This package allows the creation of symbol files to be used for linking
-- libraries. The format of symbol files depends on the platform, so there is
-- several implementations of the body.
with GNAT.Dynamic_Tables;
with System.OS_Lib; use System.OS_Lib;
package Symbols is
type Policy is
-- Symbol policy
(Autonomous,
-- Create a symbol file without considering any reference
Compliant,
-- Either create a symbol file with the same major and minor IDs if
-- all symbols are already found in the reference file or with an
-- incremented minor ID, if not.
Controlled,
-- Fail if symbols are not the same as those in the reference file
Restricted,
-- Restrict the symbols to those in the symbol file. Fail if some
-- symbols in the symbol file are not exported from the object files.
Direct);
-- The reference symbol file is copied to the symbol file
type Symbol_Kind is (Data, Proc);
-- To distinguish between the different kinds of symbols
type Symbol_Data is record
Name : String_Access;
Kind : Symbol_Kind := Data;
Present : Boolean := True;
end record;
-- Data (name and kind) for each of the symbols
package Symbol_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Symbol_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 100,
Table_Increment => 100);
-- The symbol tables
Original_Symbols : Symbol_Table.Instance;
-- The symbols, if any, found in the reference symbol table
Complete_Symbols : Symbol_Table.Instance;
-- The symbols, if any, found in the objects files
procedure Initialize
(Symbol_File : String;
Reference : String;
Symbol_Policy : Policy;
Quiet : Boolean;
Version : String;
Success : out Boolean);
-- Initialize a symbol file. This procedure must be called before
-- Processing any object file. Depending on the platforms and the
-- circumstances, additional messages may be issued if Quiet is False.
package Processing is
-- This package, containing a single visible procedure Process, exists
-- so that it can be a subunits, for some platforms, the body of package
-- Symbols is common, while the subunit Processing is not.
procedure Process
(Object_File : String;
Success : out Boolean);
-- Get the symbols from an object file. Success is set to True if the
-- object file exists and has the expected format.
end Processing;
procedure Finalize
(Quiet : Boolean;
Success : out Boolean);
-- Finalize the symbol file. This procedure should be called after
-- Initialize (once) and Process (one or more times). If Success is
-- True, the symbol file is written and closed, ready to be used for
-- linking the library. Depending on the platforms and the circumstances,
-- additional messages may be issued if Quiet is False.
end Symbols;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Loop_Parameter_Specifications;
with Program.Elements.Generalized_Iterator_Specifications;
with Program.Elements.Element_Iterator_Specifications;
package Program.Elements.Quantified_Expressions is
pragma Pure (Program.Elements.Quantified_Expressions);
type Quantified_Expression is
limited interface and Program.Elements.Expressions.Expression;
type Quantified_Expression_Access is access all Quantified_Expression'Class
with Storage_Size => 0;
not overriding function Parameter
(Self : Quantified_Expression)
return Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access is abstract;
not overriding function Generalized_Iterator
(Self : Quantified_Expression)
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access is abstract;
not overriding function Element_Iterator
(Self : Quantified_Expression)
return Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access is abstract;
not overriding function Predicate
(Self : Quantified_Expression)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Has_All
(Self : Quantified_Expression)
return Boolean is abstract;
not overriding function Has_Some
(Self : Quantified_Expression)
return Boolean is abstract;
type Quantified_Expression_Text is limited interface;
type Quantified_Expression_Text_Access is
access all Quantified_Expression_Text'Class with Storage_Size => 0;
not overriding function To_Quantified_Expression_Text
(Self : in out Quantified_Expression)
return Quantified_Expression_Text_Access is abstract;
not overriding function For_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Some_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Arrow_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Quantified_Expressions;
|
pragma License (Restricted);
--
-- Copyright (C) 2020 Jesper Quorning All Rights Reserved.
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
package SQL_Database is
procedure Open;
-- Open database.
-- Raise Program_Error on fail.
function Is_Valid
(File_Name : in String)
return Boolean;
-- True when File_Name designates valid database.
end SQL_Database;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.