entities
list | max_stars_repo_path
stringlengths 6
131
| max_stars_repo_name
stringlengths 9
67
| max_stars_count
int64 0
17k
| content
stringlengths 25
1M
| id
stringlengths 1
5
| new_content
stringlengths 17
1M
| modified
bool 1
class | references
stringlengths 32
1M
|
---|---|---|---|---|---|---|---|---|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2012 Felix Krause <[email protected]>\n--\n-- Licensed under the Apac",
"end": 78,
"score": 0.9998501539230347,
"start": 66,
"tag": "NAME",
"value": "Felix Krause"
},
{
"context": "pache-2.0\n--\n-- Copyright (c) 2012 Felix Krause <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 96,
"score": 0.9999315738677979,
"start": 80,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka/src/gl/implementation/gl-low_level-enums.ads
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package GL.Low_Level.Enums is
pragma Preelaborate;
-- Unlike GL.Enums, this package is not private and hosts enum types
-- that may be needed by third-party code or wrappers.
type Texture_Kind is (Texture_1D, Texture_2D, Texture_3D,
Texture_Rectangle, Texture_Cube_Map,
Texture_1D_Array, Texture_2D_Array,
Texture_Buffer, Texture_Cube_Map_Array,
Texture_2D_Multisample, Texture_2D_Multisample_Array);
type Resource_Type is
(Int_Type,
UInt_Type,
Single_Type,
Double_Type,
Single_Vec2,
Single_Vec3,
Single_Vec4,
Int_Vec2,
Int_Vec3,
Int_Vec4,
Bool_Type,
Bool_Vec2,
Bool_Vec3,
Bool_Vec4,
Single_Matrix2,
Single_Matrix3,
Single_Matrix4,
Sampler_1D,
Sampler_2D,
Sampler_3D,
Sampler_Cube,
Sampler_1D_Shadow,
Sampler_2D_Shadow,
Sampler_2D_Rect,
Sampler_2D_Rect_Shadow,
Single_Matrix2x3,
Single_Matrix2x4,
Single_Matrix3x2,
Single_Matrix3x4,
Single_Matrix4x2,
Single_Matrix4x3,
Sampler_1D_Array,
Sampler_2D_Array,
Sampler_Buffer,
Sampler_1D_Array_Shadow,
Sampler_2D_Array_Shadow,
Sampler_Cube_Shadow,
UInt_Vec2,
UInt_Vec3,
UInt_Vec4,
Int_Sampler_1D,
Int_Sampler_2D,
Int_Sampler_3D,
Int_Sampler_Cube,
Int_Sampler_2D_Rect,
Int_Sampler_1D_Array,
Int_Sampler_2D_Array,
Int_Sampler_Buffer,
UInt_Sampler_1D,
UInt_Sampler_2D,
UInt_Sampler_3D,
UInt_Sampler_Cube,
UInt_Sampler_2D_Rect,
UInt_Sampler_1D_Array,
UInt_Sampler_2D_Array,
UInt_Sampler_Buffer,
Double_Matrix2,
Double_Matrix3,
Double_Matrix4,
Double_Matrix2x3,
Double_Matrix2x4,
Double_Matrix3x2,
Double_Matrix3x4,
Double_Matrix4x2,
Double_Matrix4x3,
Double_Vec2,
Double_Vec3,
Double_Vec4,
Sampler_Cube_Array,
Sampler_Cube_Array_Shadow,
Int_Sampler_Cube_Array,
UInt_Sampler_Cube_Array,
Image_1D,
Image_2D,
Image_3D,
Image_2D_Rect,
Image_Cube,
Image_Buffer,
Image_1D_Array,
Image_2D_Array,
Image_Cube_Map_Array,
Image_2D_Multisample,
Image_2D_Multisample_Array,
Int_Image_1D,
Int_Image_2D,
Int_Image_3D,
Int_Image_2D_Rect,
Int_Image_Cube,
Int_Image_Buffer,
Int_Image_1D_Array,
Int_Image_2D_Array,
Int_Image_Cube_Map_Array,
Int_Image_2D_Multisample,
Int_Image_2D_Multisample_Array,
UInt_Image_1D,
UInt_Image_2D,
UInt_Image_3D,
UInt_Image_2D_Rect,
UInt_Image_Cube,
UInt_Image_Buffer,
UInt_Image_1D_Array,
UInt_Image_2D_Array,
UInt_Image_Cube_Map_Array,
UInt_Image_2D_Multisample,
UInt_Image_2D_Multisample_Array,
Sampler_2D_Multisample,
Int_Sampler_2D_Multisample,
UInt_Sampler_2D_Multisample,
Sampler_2D_Multisample_Array,
Int_Sampler_2D_Multisample_Array,
UInt_Sampler_2D_Multisample_Array);
private
for Texture_Kind use (Texture_1D => 16#0DE0#,
Texture_2D => 16#0DE1#,
Texture_3D => 16#806F#,
Texture_Rectangle => 16#84F5#,
Texture_Cube_Map => 16#8513#,
Texture_1D_Array => 16#8C18#,
Texture_2D_Array => 16#8C1A#,
Texture_Buffer => 16#8C2A#,
Texture_Cube_Map_Array => 16#9009#,
Texture_2D_Multisample => 16#9100#,
Texture_2D_Multisample_Array => 16#9102#);
for Texture_Kind'Size use Enum'Size;
for Resource_Type use
(Int_Type => 16#1404#,
UInt_Type => 16#1405#,
Single_Type => 16#1406#,
Double_Type => 16#140A#,
Single_Vec2 => 16#8B50#,
Single_Vec3 => 16#8B51#,
Single_Vec4 => 16#8B52#,
Int_Vec2 => 16#8B53#,
Int_Vec3 => 16#8B54#,
Int_Vec4 => 16#8B55#,
Bool_Type => 16#8B56#,
Bool_Vec2 => 16#8B57#,
Bool_Vec3 => 16#8B58#,
Bool_Vec4 => 16#8B59#,
Single_Matrix2 => 16#8B5A#,
Single_Matrix3 => 16#8B5B#,
Single_Matrix4 => 16#8B5C#,
Sampler_1D => 16#8B5D#,
Sampler_2D => 16#8B5E#,
Sampler_3D => 16#8B5F#,
Sampler_Cube => 16#8B60#,
Sampler_1D_Shadow => 16#8B61#,
Sampler_2D_Shadow => 16#8B62#,
Sampler_2D_Rect => 16#8B63#,
Sampler_2D_Rect_Shadow => 16#8B64#,
Single_Matrix2x3 => 16#8B65#,
Single_Matrix2x4 => 16#8B66#,
Single_Matrix3x2 => 16#8B67#,
Single_Matrix3x4 => 16#8B68#,
Single_Matrix4x2 => 16#8B69#,
Single_Matrix4x3 => 16#8B6A#,
Sampler_1D_Array => 16#8DC0#,
Sampler_2D_Array => 16#8DC1#,
Sampler_Buffer => 16#8DC2#,
Sampler_1D_Array_Shadow => 16#8DC3#,
Sampler_2D_Array_Shadow => 16#8DC4#,
Sampler_Cube_Shadow => 16#8DC5#,
UInt_Vec2 => 16#8DC6#,
UInt_Vec3 => 16#8DC7#,
UInt_Vec4 => 16#8DC8#,
Int_Sampler_1D => 16#8DC9#,
Int_Sampler_2D => 16#8DCA#,
Int_Sampler_3D => 16#8DCB#,
Int_Sampler_Cube => 16#8DCC#,
Int_Sampler_2D_Rect => 16#8DCD#,
Int_Sampler_1D_Array => 16#8DCE#,
Int_Sampler_2D_Array => 16#8DCF#,
Int_Sampler_Buffer => 16#8DD0#,
UInt_Sampler_1D => 16#8DD1#,
UInt_Sampler_2D => 16#8DD2#,
UInt_Sampler_3D => 16#8DD3#,
UInt_Sampler_Cube => 16#8DD4#,
UInt_Sampler_2D_Rect => 16#8DD5#,
UInt_Sampler_1D_Array => 16#8DD6#,
UInt_Sampler_2D_Array => 16#8DD7#,
UInt_Sampler_Buffer => 16#8DD8#,
Double_Matrix2 => 16#8F46#,
Double_Matrix3 => 16#8F47#,
Double_Matrix4 => 16#8F48#,
Double_Matrix2x3 => 16#8F49#,
Double_Matrix2x4 => 16#8F4A#,
Double_Matrix3x2 => 16#8F4B#,
Double_Matrix3x4 => 16#8F4C#,
Double_Matrix4x2 => 16#8F4D#,
Double_Matrix4x3 => 16#8F4E#,
Double_Vec2 => 16#8FFC#,
Double_Vec3 => 16#8FFD#,
Double_Vec4 => 16#8FFE#,
Sampler_Cube_Array => 16#900C#,
Sampler_Cube_Array_Shadow => 16#900D#,
Int_Sampler_Cube_Array => 16#900E#,
UInt_Sampler_Cube_Array => 16#900F#,
Image_1D => 16#904C#,
Image_2D => 16#904D#,
Image_3D => 16#904E#,
Image_2D_Rect => 16#904F#,
Image_Cube => 16#9050#,
Image_Buffer => 16#9051#,
Image_1D_Array => 16#9052#,
Image_2D_Array => 16#9053#,
Image_Cube_Map_Array => 16#9054#,
Image_2D_Multisample => 16#9055#,
Image_2D_Multisample_Array => 16#9056#,
Int_Image_1D => 16#9057#,
Int_Image_2D => 16#9058#,
Int_Image_3D => 16#9059#,
Int_Image_2D_Rect => 16#905A#,
Int_Image_Cube => 16#905B#,
Int_Image_Buffer => 16#905C#,
Int_Image_1D_Array => 16#905D#,
Int_Image_2D_Array => 16#905E#,
Int_Image_Cube_Map_Array => 16#905F#,
Int_Image_2D_Multisample => 16#9060#,
Int_Image_2D_Multisample_Array => 16#9061#,
UInt_Image_1D => 16#9062#,
UInt_Image_2D => 16#9063#,
UInt_Image_3D => 16#9064#,
UInt_Image_2D_Rect => 16#9065#,
UInt_Image_Cube => 16#9066#,
UInt_Image_Buffer => 16#9067#,
UInt_Image_1D_Array => 16#9068#,
UInt_Image_2D_Array => 16#9069#,
UInt_Image_Cube_Map_Array => 16#906A#,
UInt_Image_2D_Multisample => 16#906B#,
UInt_Image_2D_Multisample_Array => 16#906C#,
Sampler_2D_Multisample => 16#9108#,
Int_Sampler_2D_Multisample => 16#9109#,
UInt_Sampler_2D_Multisample => 16#910A#,
Sampler_2D_Multisample_Array => 16#910B#,
Int_Sampler_2D_Multisample_Array => 16#910C#,
UInt_Sampler_2D_Multisample_Array => 16#910D#);
for Resource_Type'Size use Enum'Size;
end GL.Low_Level.Enums;
|
25207
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package GL.Low_Level.Enums is
pragma Preelaborate;
-- Unlike GL.Enums, this package is not private and hosts enum types
-- that may be needed by third-party code or wrappers.
type Texture_Kind is (Texture_1D, Texture_2D, Texture_3D,
Texture_Rectangle, Texture_Cube_Map,
Texture_1D_Array, Texture_2D_Array,
Texture_Buffer, Texture_Cube_Map_Array,
Texture_2D_Multisample, Texture_2D_Multisample_Array);
type Resource_Type is
(Int_Type,
UInt_Type,
Single_Type,
Double_Type,
Single_Vec2,
Single_Vec3,
Single_Vec4,
Int_Vec2,
Int_Vec3,
Int_Vec4,
Bool_Type,
Bool_Vec2,
Bool_Vec3,
Bool_Vec4,
Single_Matrix2,
Single_Matrix3,
Single_Matrix4,
Sampler_1D,
Sampler_2D,
Sampler_3D,
Sampler_Cube,
Sampler_1D_Shadow,
Sampler_2D_Shadow,
Sampler_2D_Rect,
Sampler_2D_Rect_Shadow,
Single_Matrix2x3,
Single_Matrix2x4,
Single_Matrix3x2,
Single_Matrix3x4,
Single_Matrix4x2,
Single_Matrix4x3,
Sampler_1D_Array,
Sampler_2D_Array,
Sampler_Buffer,
Sampler_1D_Array_Shadow,
Sampler_2D_Array_Shadow,
Sampler_Cube_Shadow,
UInt_Vec2,
UInt_Vec3,
UInt_Vec4,
Int_Sampler_1D,
Int_Sampler_2D,
Int_Sampler_3D,
Int_Sampler_Cube,
Int_Sampler_2D_Rect,
Int_Sampler_1D_Array,
Int_Sampler_2D_Array,
Int_Sampler_Buffer,
UInt_Sampler_1D,
UInt_Sampler_2D,
UInt_Sampler_3D,
UInt_Sampler_Cube,
UInt_Sampler_2D_Rect,
UInt_Sampler_1D_Array,
UInt_Sampler_2D_Array,
UInt_Sampler_Buffer,
Double_Matrix2,
Double_Matrix3,
Double_Matrix4,
Double_Matrix2x3,
Double_Matrix2x4,
Double_Matrix3x2,
Double_Matrix3x4,
Double_Matrix4x2,
Double_Matrix4x3,
Double_Vec2,
Double_Vec3,
Double_Vec4,
Sampler_Cube_Array,
Sampler_Cube_Array_Shadow,
Int_Sampler_Cube_Array,
UInt_Sampler_Cube_Array,
Image_1D,
Image_2D,
Image_3D,
Image_2D_Rect,
Image_Cube,
Image_Buffer,
Image_1D_Array,
Image_2D_Array,
Image_Cube_Map_Array,
Image_2D_Multisample,
Image_2D_Multisample_Array,
Int_Image_1D,
Int_Image_2D,
Int_Image_3D,
Int_Image_2D_Rect,
Int_Image_Cube,
Int_Image_Buffer,
Int_Image_1D_Array,
Int_Image_2D_Array,
Int_Image_Cube_Map_Array,
Int_Image_2D_Multisample,
Int_Image_2D_Multisample_Array,
UInt_Image_1D,
UInt_Image_2D,
UInt_Image_3D,
UInt_Image_2D_Rect,
UInt_Image_Cube,
UInt_Image_Buffer,
UInt_Image_1D_Array,
UInt_Image_2D_Array,
UInt_Image_Cube_Map_Array,
UInt_Image_2D_Multisample,
UInt_Image_2D_Multisample_Array,
Sampler_2D_Multisample,
Int_Sampler_2D_Multisample,
UInt_Sampler_2D_Multisample,
Sampler_2D_Multisample_Array,
Int_Sampler_2D_Multisample_Array,
UInt_Sampler_2D_Multisample_Array);
private
for Texture_Kind use (Texture_1D => 16#0DE0#,
Texture_2D => 16#0DE1#,
Texture_3D => 16#806F#,
Texture_Rectangle => 16#84F5#,
Texture_Cube_Map => 16#8513#,
Texture_1D_Array => 16#8C18#,
Texture_2D_Array => 16#8C1A#,
Texture_Buffer => 16#8C2A#,
Texture_Cube_Map_Array => 16#9009#,
Texture_2D_Multisample => 16#9100#,
Texture_2D_Multisample_Array => 16#9102#);
for Texture_Kind'Size use Enum'Size;
for Resource_Type use
(Int_Type => 16#1404#,
UInt_Type => 16#1405#,
Single_Type => 16#1406#,
Double_Type => 16#140A#,
Single_Vec2 => 16#8B50#,
Single_Vec3 => 16#8B51#,
Single_Vec4 => 16#8B52#,
Int_Vec2 => 16#8B53#,
Int_Vec3 => 16#8B54#,
Int_Vec4 => 16#8B55#,
Bool_Type => 16#8B56#,
Bool_Vec2 => 16#8B57#,
Bool_Vec3 => 16#8B58#,
Bool_Vec4 => 16#8B59#,
Single_Matrix2 => 16#8B5A#,
Single_Matrix3 => 16#8B5B#,
Single_Matrix4 => 16#8B5C#,
Sampler_1D => 16#8B5D#,
Sampler_2D => 16#8B5E#,
Sampler_3D => 16#8B5F#,
Sampler_Cube => 16#8B60#,
Sampler_1D_Shadow => 16#8B61#,
Sampler_2D_Shadow => 16#8B62#,
Sampler_2D_Rect => 16#8B63#,
Sampler_2D_Rect_Shadow => 16#8B64#,
Single_Matrix2x3 => 16#8B65#,
Single_Matrix2x4 => 16#8B66#,
Single_Matrix3x2 => 16#8B67#,
Single_Matrix3x4 => 16#8B68#,
Single_Matrix4x2 => 16#8B69#,
Single_Matrix4x3 => 16#8B6A#,
Sampler_1D_Array => 16#8DC0#,
Sampler_2D_Array => 16#8DC1#,
Sampler_Buffer => 16#8DC2#,
Sampler_1D_Array_Shadow => 16#8DC3#,
Sampler_2D_Array_Shadow => 16#8DC4#,
Sampler_Cube_Shadow => 16#8DC5#,
UInt_Vec2 => 16#8DC6#,
UInt_Vec3 => 16#8DC7#,
UInt_Vec4 => 16#8DC8#,
Int_Sampler_1D => 16#8DC9#,
Int_Sampler_2D => 16#8DCA#,
Int_Sampler_3D => 16#8DCB#,
Int_Sampler_Cube => 16#8DCC#,
Int_Sampler_2D_Rect => 16#8DCD#,
Int_Sampler_1D_Array => 16#8DCE#,
Int_Sampler_2D_Array => 16#8DCF#,
Int_Sampler_Buffer => 16#8DD0#,
UInt_Sampler_1D => 16#8DD1#,
UInt_Sampler_2D => 16#8DD2#,
UInt_Sampler_3D => 16#8DD3#,
UInt_Sampler_Cube => 16#8DD4#,
UInt_Sampler_2D_Rect => 16#8DD5#,
UInt_Sampler_1D_Array => 16#8DD6#,
UInt_Sampler_2D_Array => 16#8DD7#,
UInt_Sampler_Buffer => 16#8DD8#,
Double_Matrix2 => 16#8F46#,
Double_Matrix3 => 16#8F47#,
Double_Matrix4 => 16#8F48#,
Double_Matrix2x3 => 16#8F49#,
Double_Matrix2x4 => 16#8F4A#,
Double_Matrix3x2 => 16#8F4B#,
Double_Matrix3x4 => 16#8F4C#,
Double_Matrix4x2 => 16#8F4D#,
Double_Matrix4x3 => 16#8F4E#,
Double_Vec2 => 16#8FFC#,
Double_Vec3 => 16#8FFD#,
Double_Vec4 => 16#8FFE#,
Sampler_Cube_Array => 16#900C#,
Sampler_Cube_Array_Shadow => 16#900D#,
Int_Sampler_Cube_Array => 16#900E#,
UInt_Sampler_Cube_Array => 16#900F#,
Image_1D => 16#904C#,
Image_2D => 16#904D#,
Image_3D => 16#904E#,
Image_2D_Rect => 16#904F#,
Image_Cube => 16#9050#,
Image_Buffer => 16#9051#,
Image_1D_Array => 16#9052#,
Image_2D_Array => 16#9053#,
Image_Cube_Map_Array => 16#9054#,
Image_2D_Multisample => 16#9055#,
Image_2D_Multisample_Array => 16#9056#,
Int_Image_1D => 16#9057#,
Int_Image_2D => 16#9058#,
Int_Image_3D => 16#9059#,
Int_Image_2D_Rect => 16#905A#,
Int_Image_Cube => 16#905B#,
Int_Image_Buffer => 16#905C#,
Int_Image_1D_Array => 16#905D#,
Int_Image_2D_Array => 16#905E#,
Int_Image_Cube_Map_Array => 16#905F#,
Int_Image_2D_Multisample => 16#9060#,
Int_Image_2D_Multisample_Array => 16#9061#,
UInt_Image_1D => 16#9062#,
UInt_Image_2D => 16#9063#,
UInt_Image_3D => 16#9064#,
UInt_Image_2D_Rect => 16#9065#,
UInt_Image_Cube => 16#9066#,
UInt_Image_Buffer => 16#9067#,
UInt_Image_1D_Array => 16#9068#,
UInt_Image_2D_Array => 16#9069#,
UInt_Image_Cube_Map_Array => 16#906A#,
UInt_Image_2D_Multisample => 16#906B#,
UInt_Image_2D_Multisample_Array => 16#906C#,
Sampler_2D_Multisample => 16#9108#,
Int_Sampler_2D_Multisample => 16#9109#,
UInt_Sampler_2D_Multisample => 16#910A#,
Sampler_2D_Multisample_Array => 16#910B#,
Int_Sampler_2D_Multisample_Array => 16#910C#,
UInt_Sampler_2D_Multisample_Array => 16#910D#);
for Resource_Type'Size use Enum'Size;
end GL.Low_Level.Enums;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package GL.Low_Level.Enums is
pragma Preelaborate;
-- Unlike GL.Enums, this package is not private and hosts enum types
-- that may be needed by third-party code or wrappers.
type Texture_Kind is (Texture_1D, Texture_2D, Texture_3D,
Texture_Rectangle, Texture_Cube_Map,
Texture_1D_Array, Texture_2D_Array,
Texture_Buffer, Texture_Cube_Map_Array,
Texture_2D_Multisample, Texture_2D_Multisample_Array);
type Resource_Type is
(Int_Type,
UInt_Type,
Single_Type,
Double_Type,
Single_Vec2,
Single_Vec3,
Single_Vec4,
Int_Vec2,
Int_Vec3,
Int_Vec4,
Bool_Type,
Bool_Vec2,
Bool_Vec3,
Bool_Vec4,
Single_Matrix2,
Single_Matrix3,
Single_Matrix4,
Sampler_1D,
Sampler_2D,
Sampler_3D,
Sampler_Cube,
Sampler_1D_Shadow,
Sampler_2D_Shadow,
Sampler_2D_Rect,
Sampler_2D_Rect_Shadow,
Single_Matrix2x3,
Single_Matrix2x4,
Single_Matrix3x2,
Single_Matrix3x4,
Single_Matrix4x2,
Single_Matrix4x3,
Sampler_1D_Array,
Sampler_2D_Array,
Sampler_Buffer,
Sampler_1D_Array_Shadow,
Sampler_2D_Array_Shadow,
Sampler_Cube_Shadow,
UInt_Vec2,
UInt_Vec3,
UInt_Vec4,
Int_Sampler_1D,
Int_Sampler_2D,
Int_Sampler_3D,
Int_Sampler_Cube,
Int_Sampler_2D_Rect,
Int_Sampler_1D_Array,
Int_Sampler_2D_Array,
Int_Sampler_Buffer,
UInt_Sampler_1D,
UInt_Sampler_2D,
UInt_Sampler_3D,
UInt_Sampler_Cube,
UInt_Sampler_2D_Rect,
UInt_Sampler_1D_Array,
UInt_Sampler_2D_Array,
UInt_Sampler_Buffer,
Double_Matrix2,
Double_Matrix3,
Double_Matrix4,
Double_Matrix2x3,
Double_Matrix2x4,
Double_Matrix3x2,
Double_Matrix3x4,
Double_Matrix4x2,
Double_Matrix4x3,
Double_Vec2,
Double_Vec3,
Double_Vec4,
Sampler_Cube_Array,
Sampler_Cube_Array_Shadow,
Int_Sampler_Cube_Array,
UInt_Sampler_Cube_Array,
Image_1D,
Image_2D,
Image_3D,
Image_2D_Rect,
Image_Cube,
Image_Buffer,
Image_1D_Array,
Image_2D_Array,
Image_Cube_Map_Array,
Image_2D_Multisample,
Image_2D_Multisample_Array,
Int_Image_1D,
Int_Image_2D,
Int_Image_3D,
Int_Image_2D_Rect,
Int_Image_Cube,
Int_Image_Buffer,
Int_Image_1D_Array,
Int_Image_2D_Array,
Int_Image_Cube_Map_Array,
Int_Image_2D_Multisample,
Int_Image_2D_Multisample_Array,
UInt_Image_1D,
UInt_Image_2D,
UInt_Image_3D,
UInt_Image_2D_Rect,
UInt_Image_Cube,
UInt_Image_Buffer,
UInt_Image_1D_Array,
UInt_Image_2D_Array,
UInt_Image_Cube_Map_Array,
UInt_Image_2D_Multisample,
UInt_Image_2D_Multisample_Array,
Sampler_2D_Multisample,
Int_Sampler_2D_Multisample,
UInt_Sampler_2D_Multisample,
Sampler_2D_Multisample_Array,
Int_Sampler_2D_Multisample_Array,
UInt_Sampler_2D_Multisample_Array);
private
for Texture_Kind use (Texture_1D => 16#0DE0#,
Texture_2D => 16#0DE1#,
Texture_3D => 16#806F#,
Texture_Rectangle => 16#84F5#,
Texture_Cube_Map => 16#8513#,
Texture_1D_Array => 16#8C18#,
Texture_2D_Array => 16#8C1A#,
Texture_Buffer => 16#8C2A#,
Texture_Cube_Map_Array => 16#9009#,
Texture_2D_Multisample => 16#9100#,
Texture_2D_Multisample_Array => 16#9102#);
for Texture_Kind'Size use Enum'Size;
for Resource_Type use
(Int_Type => 16#1404#,
UInt_Type => 16#1405#,
Single_Type => 16#1406#,
Double_Type => 16#140A#,
Single_Vec2 => 16#8B50#,
Single_Vec3 => 16#8B51#,
Single_Vec4 => 16#8B52#,
Int_Vec2 => 16#8B53#,
Int_Vec3 => 16#8B54#,
Int_Vec4 => 16#8B55#,
Bool_Type => 16#8B56#,
Bool_Vec2 => 16#8B57#,
Bool_Vec3 => 16#8B58#,
Bool_Vec4 => 16#8B59#,
Single_Matrix2 => 16#8B5A#,
Single_Matrix3 => 16#8B5B#,
Single_Matrix4 => 16#8B5C#,
Sampler_1D => 16#8B5D#,
Sampler_2D => 16#8B5E#,
Sampler_3D => 16#8B5F#,
Sampler_Cube => 16#8B60#,
Sampler_1D_Shadow => 16#8B61#,
Sampler_2D_Shadow => 16#8B62#,
Sampler_2D_Rect => 16#8B63#,
Sampler_2D_Rect_Shadow => 16#8B64#,
Single_Matrix2x3 => 16#8B65#,
Single_Matrix2x4 => 16#8B66#,
Single_Matrix3x2 => 16#8B67#,
Single_Matrix3x4 => 16#8B68#,
Single_Matrix4x2 => 16#8B69#,
Single_Matrix4x3 => 16#8B6A#,
Sampler_1D_Array => 16#8DC0#,
Sampler_2D_Array => 16#8DC1#,
Sampler_Buffer => 16#8DC2#,
Sampler_1D_Array_Shadow => 16#8DC3#,
Sampler_2D_Array_Shadow => 16#8DC4#,
Sampler_Cube_Shadow => 16#8DC5#,
UInt_Vec2 => 16#8DC6#,
UInt_Vec3 => 16#8DC7#,
UInt_Vec4 => 16#8DC8#,
Int_Sampler_1D => 16#8DC9#,
Int_Sampler_2D => 16#8DCA#,
Int_Sampler_3D => 16#8DCB#,
Int_Sampler_Cube => 16#8DCC#,
Int_Sampler_2D_Rect => 16#8DCD#,
Int_Sampler_1D_Array => 16#8DCE#,
Int_Sampler_2D_Array => 16#8DCF#,
Int_Sampler_Buffer => 16#8DD0#,
UInt_Sampler_1D => 16#8DD1#,
UInt_Sampler_2D => 16#8DD2#,
UInt_Sampler_3D => 16#8DD3#,
UInt_Sampler_Cube => 16#8DD4#,
UInt_Sampler_2D_Rect => 16#8DD5#,
UInt_Sampler_1D_Array => 16#8DD6#,
UInt_Sampler_2D_Array => 16#8DD7#,
UInt_Sampler_Buffer => 16#8DD8#,
Double_Matrix2 => 16#8F46#,
Double_Matrix3 => 16#8F47#,
Double_Matrix4 => 16#8F48#,
Double_Matrix2x3 => 16#8F49#,
Double_Matrix2x4 => 16#8F4A#,
Double_Matrix3x2 => 16#8F4B#,
Double_Matrix3x4 => 16#8F4C#,
Double_Matrix4x2 => 16#8F4D#,
Double_Matrix4x3 => 16#8F4E#,
Double_Vec2 => 16#8FFC#,
Double_Vec3 => 16#8FFD#,
Double_Vec4 => 16#8FFE#,
Sampler_Cube_Array => 16#900C#,
Sampler_Cube_Array_Shadow => 16#900D#,
Int_Sampler_Cube_Array => 16#900E#,
UInt_Sampler_Cube_Array => 16#900F#,
Image_1D => 16#904C#,
Image_2D => 16#904D#,
Image_3D => 16#904E#,
Image_2D_Rect => 16#904F#,
Image_Cube => 16#9050#,
Image_Buffer => 16#9051#,
Image_1D_Array => 16#9052#,
Image_2D_Array => 16#9053#,
Image_Cube_Map_Array => 16#9054#,
Image_2D_Multisample => 16#9055#,
Image_2D_Multisample_Array => 16#9056#,
Int_Image_1D => 16#9057#,
Int_Image_2D => 16#9058#,
Int_Image_3D => 16#9059#,
Int_Image_2D_Rect => 16#905A#,
Int_Image_Cube => 16#905B#,
Int_Image_Buffer => 16#905C#,
Int_Image_1D_Array => 16#905D#,
Int_Image_2D_Array => 16#905E#,
Int_Image_Cube_Map_Array => 16#905F#,
Int_Image_2D_Multisample => 16#9060#,
Int_Image_2D_Multisample_Array => 16#9061#,
UInt_Image_1D => 16#9062#,
UInt_Image_2D => 16#9063#,
UInt_Image_3D => 16#9064#,
UInt_Image_2D_Rect => 16#9065#,
UInt_Image_Cube => 16#9066#,
UInt_Image_Buffer => 16#9067#,
UInt_Image_1D_Array => 16#9068#,
UInt_Image_2D_Array => 16#9069#,
UInt_Image_Cube_Map_Array => 16#906A#,
UInt_Image_2D_Multisample => 16#906B#,
UInt_Image_2D_Multisample_Array => 16#906C#,
Sampler_2D_Multisample => 16#9108#,
Int_Sampler_2D_Multisample => 16#9109#,
UInt_Sampler_2D_Multisample => 16#910A#,
Sampler_2D_Multisample_Array => 16#910B#,
Int_Sampler_2D_Multisample_Array => 16#910C#,
UInt_Sampler_2D_Multisample_Array => 16#910D#);
for Resource_Type'Size use Enum'Size;
end GL.Low_Level.Enums;
|
[
{
"context": "A_QUEUE);\n -- GStreamer\n -- * Copyright (C) 2006 Edward Hervey <[email protected]>\n -- *\n -- * gstdataqueue.h",
"end": 1229,
"score": 0.9998524785041809,
"start": 1216,
"tag": "NAME",
"value": "Edward Hervey"
},
{
"context": "Streamer\n -- * Copyright (C) 2006 Edward Hervey <[email protected]>\n -- *\n -- * gstdataqueue.h:\n -- *\n -- * This",
"end": 1249,
"score": 0.9999291300773621,
"start": 1231,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_base_gstdataqueue_h.ads
|
persan/A-gst
| 1 |
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
-- with GStreamer.GST_Low_Level.glib_2_0_gobject_gobject_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h;
with System;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h is
-- unsupported macro: GST_TYPE_DATA_QUEUE (gst_data_queue_get_type())
-- arg-macro: function GST_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DATA_QUEUE,GstDataQueue);
-- arg-macro: function GST_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DATA_QUEUE,GstDataQueueClass);
-- arg-macro: function GST_IS_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DATA_QUEUE);
-- arg-macro: function GST_IS_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DATA_QUEUE);
-- GStreamer
-- * Copyright (C) 2006 Edward Hervey <[email protected]>
-- *
-- * gstdataqueue.h:
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library 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
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
type GstDataQueue;
type anon_311;
type anon_312 is record
waiting_add : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:140
waiting_del : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:141
end record;
pragma Convention (C_Pass_By_Copy, anon_312);
type u_GstDataQueue_u_gst_reserved_array is array (0 .. 1) of System.Address;
type anon_311 (discr : unsigned := 0) is record
case discr is
when 0 =>
ABI : aliased anon_312; -- gst/base/gstdataqueue.h:142
when others =>
u_gst_reserved : u_GstDataQueue_u_gst_reserved_array; -- gst/base/gstdataqueue.h:143
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_311);
pragma Unchecked_Union (anon_311);--subtype GstDataQueue is u_GstDataQueue; -- gst/base/gstdataqueue.h:39
type GstDataQueueClass;
type u_GstDataQueueClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstDataQueueClass is u_GstDataQueueClass; -- gst/base/gstdataqueue.h:40
type GstDataQueueSize;
--subtype GstDataQueueSize is u_GstDataQueueSize; -- gst/base/gstdataqueue.h:41
type GstDataQueueItem;
--subtype GstDataQueueItem is u_GstDataQueueItem; -- gst/base/gstdataqueue.h:42
--*
-- * GstDataQueueItem:
-- * @object: the #GstMiniObject to queue.
-- * @size: the size in bytes of the miniobject.
-- * @duration: the duration in #GstClockTime of the miniobject. Can not be
-- * #GST_CLOCK_TIME_NONE.
-- * @visible: #TRUE if @object should be considered as a visible object.
-- * @destroy: The #GDestroyNotify function to use to free the #GstDataQueueItem.
-- * This function should also drop the reference to @object the owner of the
-- * #GstDataQueueItem is assumed to hold.
-- *
-- * Structure used by #GstDataQueue. You can supply a different structure, as
-- * long as the top of the structure is identical to this structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueueItem is record
object : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObject; -- gst/base/gstdataqueue.h:63
size : aliased GLIB.guint; -- gst/base/gstdataqueue.h:64
duration : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:65
visible : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:66
destroy : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify; -- gst/base/gstdataqueue.h:69
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueItem); -- gst/base/gstdataqueue.h:61
-- user supplied destroy function
--*
-- * GstDataQueueSize:
-- * @visible: number of buffers
-- * @bytes: number of bytes
-- * @time: amount of time
-- *
-- * Structure describing the size of a queue.
-- *
-- * Since: 0.10.11
--
type GstDataQueueSize is record
visible : aliased GLIB.guint; -- gst/base/gstdataqueue.h:84
bytes : aliased GLIB.guint; -- gst/base/gstdataqueue.h:85
time : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:86
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueSize); -- gst/base/gstdataqueue.h:82
--*
-- * GstDataQueueCheckFullFunction:
-- * @queue: a #GstDataQueue.
-- * @visible: The number of visible items currently in the queue.
-- * @bytes: The amount of bytes currently in the queue.
-- * @time: The accumulated duration of the items currently in the queue.
-- * @checkdata: The #gpointer registered when the #GstDataQueue was created.
-- *
-- * The prototype of the function used to inform the queue that it should be
-- * considered as full.
-- *
-- * Returns: #TRUE if the queue should be considered full.
-- *
-- * Since: 0.10.11
--
type GstDataQueueCheckFullFunction is access function
(arg1 : access GstDataQueue;
arg2 : GLIB.guint;
arg3 : GLIB.guint;
arg4 : GLIB.guint64;
arg5 : System.Address) return GLIB.gboolean;
pragma Convention (C, GstDataQueueCheckFullFunction); -- gst/base/gstdataqueue.h:104
type GstDataQueueFullCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueFullCallback); -- gst/base/gstdataqueue.h:107
type GstDataQueueEmptyCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueEmptyCallback); -- gst/base/gstdataqueue.h:108
--*
-- * GstDataQueue:
-- * @object: the parent structure
-- *
-- * Opaque #GstDataQueue structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueue is record
object : aliased GLIB.Object.GObject; -- gst/base/gstdataqueue.h:120
queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/base/gstdataqueue.h:124
cur_level : aliased GstDataQueueSize; -- gst/base/gstdataqueue.h:126
checkfull : GstDataQueueCheckFullFunction; -- gst/base/gstdataqueue.h:127
checkdata : System.Address; -- gst/base/gstdataqueue.h:128
qlock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstdataqueue.h:130
item_add : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:131
item_del : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:132
flushing : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:133
fullcallback : GstDataQueueFullCallback; -- gst/base/gstdataqueue.h:135
emptycallback : GstDataQueueEmptyCallback; -- gst/base/gstdataqueue.h:136
abidata : aliased anon_311; -- gst/base/gstdataqueue.h:144
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueue); -- gst/base/gstdataqueue.h:118
--< private >
-- the queue of data we're keeping our grubby hands on
-- size of the queue
-- Callback to check if the queue is full
-- lock for queue (vs object lock)
-- signals buffers now available for reading
-- signals space now available for writing
-- indicates whether conditions where signalled because
-- * of external flushing
type GstDataQueueClass is record
parent_class : aliased GLIB.Object.GObject_Class; -- gst/base/gstdataqueue.h:149
empty : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:152
full : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:153
u_gst_reserved : u_GstDataQueueClass_u_gst_reserved_array; -- gst/base/gstdataqueue.h:155
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueClass); -- gst/base/gstdataqueue.h:147
-- signals
function gst_data_queue_get_type return GLIB.GType; -- gst/base/gstdataqueue.h:158
pragma Import (C, gst_data_queue_get_type, "gst_data_queue_get_type");
function gst_data_queue_new (checkfull : GstDataQueueCheckFullFunction; checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:160
pragma Import (C, gst_data_queue_new, "gst_data_queue_new");
function gst_data_queue_new_full
(checkfull : GstDataQueueCheckFullFunction;
fullcallback : GstDataQueueFullCallback;
emptycallback : GstDataQueueEmptyCallback;
checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:163
pragma Import (C, gst_data_queue_new_full, "gst_data_queue_new_full");
function gst_data_queue_push (queue : access GstDataQueue; item : access GstDataQueueItem) return GLIB.gboolean; -- gst/base/gstdataqueue.h:168
pragma Import (C, gst_data_queue_push, "gst_data_queue_push");
function gst_data_queue_pop (queue : access GstDataQueue; item : System.Address) return GLIB.gboolean; -- gst/base/gstdataqueue.h:169
pragma Import (C, gst_data_queue_pop, "gst_data_queue_pop");
procedure gst_data_queue_flush (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:171
pragma Import (C, gst_data_queue_flush, "gst_data_queue_flush");
procedure gst_data_queue_set_flushing (queue : access GstDataQueue; flushing : GLIB.gboolean); -- gst/base/gstdataqueue.h:172
pragma Import (C, gst_data_queue_set_flushing, "gst_data_queue_set_flushing");
function gst_data_queue_drop_head (queue : access GstDataQueue; c_type : GLIB.GType) return GLIB.gboolean; -- gst/base/gstdataqueue.h:174
pragma Import (C, gst_data_queue_drop_head, "gst_data_queue_drop_head");
function gst_data_queue_is_full (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:176
pragma Import (C, gst_data_queue_is_full, "gst_data_queue_is_full");
function gst_data_queue_is_empty (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:177
pragma Import (C, gst_data_queue_is_empty, "gst_data_queue_is_empty");
procedure gst_data_queue_get_level (queue : access GstDataQueue; level : access GstDataQueueSize); -- gst/base/gstdataqueue.h:179
pragma Import (C, gst_data_queue_get_level, "gst_data_queue_get_level");
procedure gst_data_queue_limits_changed (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:180
pragma Import (C, gst_data_queue_limits_changed, "gst_data_queue_limits_changed");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h;
|
18108
|
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
-- with GStreamer.GST_Low_Level.glib_2_0_gobject_gobject_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h;
with System;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h is
-- unsupported macro: GST_TYPE_DATA_QUEUE (gst_data_queue_get_type())
-- arg-macro: function GST_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DATA_QUEUE,GstDataQueue);
-- arg-macro: function GST_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DATA_QUEUE,GstDataQueueClass);
-- arg-macro: function GST_IS_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DATA_QUEUE);
-- arg-macro: function GST_IS_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DATA_QUEUE);
-- GStreamer
-- * Copyright (C) 2006 <NAME> <<EMAIL>>
-- *
-- * gstdataqueue.h:
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library 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
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
type GstDataQueue;
type anon_311;
type anon_312 is record
waiting_add : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:140
waiting_del : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:141
end record;
pragma Convention (C_Pass_By_Copy, anon_312);
type u_GstDataQueue_u_gst_reserved_array is array (0 .. 1) of System.Address;
type anon_311 (discr : unsigned := 0) is record
case discr is
when 0 =>
ABI : aliased anon_312; -- gst/base/gstdataqueue.h:142
when others =>
u_gst_reserved : u_GstDataQueue_u_gst_reserved_array; -- gst/base/gstdataqueue.h:143
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_311);
pragma Unchecked_Union (anon_311);--subtype GstDataQueue is u_GstDataQueue; -- gst/base/gstdataqueue.h:39
type GstDataQueueClass;
type u_GstDataQueueClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstDataQueueClass is u_GstDataQueueClass; -- gst/base/gstdataqueue.h:40
type GstDataQueueSize;
--subtype GstDataQueueSize is u_GstDataQueueSize; -- gst/base/gstdataqueue.h:41
type GstDataQueueItem;
--subtype GstDataQueueItem is u_GstDataQueueItem; -- gst/base/gstdataqueue.h:42
--*
-- * GstDataQueueItem:
-- * @object: the #GstMiniObject to queue.
-- * @size: the size in bytes of the miniobject.
-- * @duration: the duration in #GstClockTime of the miniobject. Can not be
-- * #GST_CLOCK_TIME_NONE.
-- * @visible: #TRUE if @object should be considered as a visible object.
-- * @destroy: The #GDestroyNotify function to use to free the #GstDataQueueItem.
-- * This function should also drop the reference to @object the owner of the
-- * #GstDataQueueItem is assumed to hold.
-- *
-- * Structure used by #GstDataQueue. You can supply a different structure, as
-- * long as the top of the structure is identical to this structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueueItem is record
object : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObject; -- gst/base/gstdataqueue.h:63
size : aliased GLIB.guint; -- gst/base/gstdataqueue.h:64
duration : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:65
visible : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:66
destroy : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify; -- gst/base/gstdataqueue.h:69
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueItem); -- gst/base/gstdataqueue.h:61
-- user supplied destroy function
--*
-- * GstDataQueueSize:
-- * @visible: number of buffers
-- * @bytes: number of bytes
-- * @time: amount of time
-- *
-- * Structure describing the size of a queue.
-- *
-- * Since: 0.10.11
--
type GstDataQueueSize is record
visible : aliased GLIB.guint; -- gst/base/gstdataqueue.h:84
bytes : aliased GLIB.guint; -- gst/base/gstdataqueue.h:85
time : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:86
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueSize); -- gst/base/gstdataqueue.h:82
--*
-- * GstDataQueueCheckFullFunction:
-- * @queue: a #GstDataQueue.
-- * @visible: The number of visible items currently in the queue.
-- * @bytes: The amount of bytes currently in the queue.
-- * @time: The accumulated duration of the items currently in the queue.
-- * @checkdata: The #gpointer registered when the #GstDataQueue was created.
-- *
-- * The prototype of the function used to inform the queue that it should be
-- * considered as full.
-- *
-- * Returns: #TRUE if the queue should be considered full.
-- *
-- * Since: 0.10.11
--
type GstDataQueueCheckFullFunction is access function
(arg1 : access GstDataQueue;
arg2 : GLIB.guint;
arg3 : GLIB.guint;
arg4 : GLIB.guint64;
arg5 : System.Address) return GLIB.gboolean;
pragma Convention (C, GstDataQueueCheckFullFunction); -- gst/base/gstdataqueue.h:104
type GstDataQueueFullCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueFullCallback); -- gst/base/gstdataqueue.h:107
type GstDataQueueEmptyCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueEmptyCallback); -- gst/base/gstdataqueue.h:108
--*
-- * GstDataQueue:
-- * @object: the parent structure
-- *
-- * Opaque #GstDataQueue structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueue is record
object : aliased GLIB.Object.GObject; -- gst/base/gstdataqueue.h:120
queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/base/gstdataqueue.h:124
cur_level : aliased GstDataQueueSize; -- gst/base/gstdataqueue.h:126
checkfull : GstDataQueueCheckFullFunction; -- gst/base/gstdataqueue.h:127
checkdata : System.Address; -- gst/base/gstdataqueue.h:128
qlock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstdataqueue.h:130
item_add : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:131
item_del : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:132
flushing : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:133
fullcallback : GstDataQueueFullCallback; -- gst/base/gstdataqueue.h:135
emptycallback : GstDataQueueEmptyCallback; -- gst/base/gstdataqueue.h:136
abidata : aliased anon_311; -- gst/base/gstdataqueue.h:144
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueue); -- gst/base/gstdataqueue.h:118
--< private >
-- the queue of data we're keeping our grubby hands on
-- size of the queue
-- Callback to check if the queue is full
-- lock for queue (vs object lock)
-- signals buffers now available for reading
-- signals space now available for writing
-- indicates whether conditions where signalled because
-- * of external flushing
type GstDataQueueClass is record
parent_class : aliased GLIB.Object.GObject_Class; -- gst/base/gstdataqueue.h:149
empty : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:152
full : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:153
u_gst_reserved : u_GstDataQueueClass_u_gst_reserved_array; -- gst/base/gstdataqueue.h:155
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueClass); -- gst/base/gstdataqueue.h:147
-- signals
function gst_data_queue_get_type return GLIB.GType; -- gst/base/gstdataqueue.h:158
pragma Import (C, gst_data_queue_get_type, "gst_data_queue_get_type");
function gst_data_queue_new (checkfull : GstDataQueueCheckFullFunction; checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:160
pragma Import (C, gst_data_queue_new, "gst_data_queue_new");
function gst_data_queue_new_full
(checkfull : GstDataQueueCheckFullFunction;
fullcallback : GstDataQueueFullCallback;
emptycallback : GstDataQueueEmptyCallback;
checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:163
pragma Import (C, gst_data_queue_new_full, "gst_data_queue_new_full");
function gst_data_queue_push (queue : access GstDataQueue; item : access GstDataQueueItem) return GLIB.gboolean; -- gst/base/gstdataqueue.h:168
pragma Import (C, gst_data_queue_push, "gst_data_queue_push");
function gst_data_queue_pop (queue : access GstDataQueue; item : System.Address) return GLIB.gboolean; -- gst/base/gstdataqueue.h:169
pragma Import (C, gst_data_queue_pop, "gst_data_queue_pop");
procedure gst_data_queue_flush (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:171
pragma Import (C, gst_data_queue_flush, "gst_data_queue_flush");
procedure gst_data_queue_set_flushing (queue : access GstDataQueue; flushing : GLIB.gboolean); -- gst/base/gstdataqueue.h:172
pragma Import (C, gst_data_queue_set_flushing, "gst_data_queue_set_flushing");
function gst_data_queue_drop_head (queue : access GstDataQueue; c_type : GLIB.GType) return GLIB.gboolean; -- gst/base/gstdataqueue.h:174
pragma Import (C, gst_data_queue_drop_head, "gst_data_queue_drop_head");
function gst_data_queue_is_full (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:176
pragma Import (C, gst_data_queue_is_full, "gst_data_queue_is_full");
function gst_data_queue_is_empty (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:177
pragma Import (C, gst_data_queue_is_empty, "gst_data_queue_is_empty");
procedure gst_data_queue_get_level (queue : access GstDataQueue; level : access GstDataQueueSize); -- gst/base/gstdataqueue.h:179
pragma Import (C, gst_data_queue_get_level, "gst_data_queue_get_level");
procedure gst_data_queue_limits_changed (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:180
pragma Import (C, gst_data_queue_limits_changed, "gst_data_queue_limits_changed");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h;
| true |
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
-- with GStreamer.GST_Low_Level.glib_2_0_gobject_gobject_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h;
with System;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h is
-- unsupported macro: GST_TYPE_DATA_QUEUE (gst_data_queue_get_type())
-- arg-macro: function GST_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DATA_QUEUE,GstDataQueue);
-- arg-macro: function GST_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DATA_QUEUE,GstDataQueueClass);
-- arg-macro: function GST_IS_DATA_QUEUE (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DATA_QUEUE);
-- arg-macro: function GST_IS_DATA_QUEUE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DATA_QUEUE);
-- GStreamer
-- * Copyright (C) 2006 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
-- *
-- * gstdataqueue.h:
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library 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
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
type GstDataQueue;
type anon_311;
type anon_312 is record
waiting_add : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:140
waiting_del : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:141
end record;
pragma Convention (C_Pass_By_Copy, anon_312);
type u_GstDataQueue_u_gst_reserved_array is array (0 .. 1) of System.Address;
type anon_311 (discr : unsigned := 0) is record
case discr is
when 0 =>
ABI : aliased anon_312; -- gst/base/gstdataqueue.h:142
when others =>
u_gst_reserved : u_GstDataQueue_u_gst_reserved_array; -- gst/base/gstdataqueue.h:143
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_311);
pragma Unchecked_Union (anon_311);--subtype GstDataQueue is u_GstDataQueue; -- gst/base/gstdataqueue.h:39
type GstDataQueueClass;
type u_GstDataQueueClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstDataQueueClass is u_GstDataQueueClass; -- gst/base/gstdataqueue.h:40
type GstDataQueueSize;
--subtype GstDataQueueSize is u_GstDataQueueSize; -- gst/base/gstdataqueue.h:41
type GstDataQueueItem;
--subtype GstDataQueueItem is u_GstDataQueueItem; -- gst/base/gstdataqueue.h:42
--*
-- * GstDataQueueItem:
-- * @object: the #GstMiniObject to queue.
-- * @size: the size in bytes of the miniobject.
-- * @duration: the duration in #GstClockTime of the miniobject. Can not be
-- * #GST_CLOCK_TIME_NONE.
-- * @visible: #TRUE if @object should be considered as a visible object.
-- * @destroy: The #GDestroyNotify function to use to free the #GstDataQueueItem.
-- * This function should also drop the reference to @object the owner of the
-- * #GstDataQueueItem is assumed to hold.
-- *
-- * Structure used by #GstDataQueue. You can supply a different structure, as
-- * long as the top of the structure is identical to this structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueueItem is record
object : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObject; -- gst/base/gstdataqueue.h:63
size : aliased GLIB.guint; -- gst/base/gstdataqueue.h:64
duration : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:65
visible : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:66
destroy : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify; -- gst/base/gstdataqueue.h:69
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueItem); -- gst/base/gstdataqueue.h:61
-- user supplied destroy function
--*
-- * GstDataQueueSize:
-- * @visible: number of buffers
-- * @bytes: number of bytes
-- * @time: amount of time
-- *
-- * Structure describing the size of a queue.
-- *
-- * Since: 0.10.11
--
type GstDataQueueSize is record
visible : aliased GLIB.guint; -- gst/base/gstdataqueue.h:84
bytes : aliased GLIB.guint; -- gst/base/gstdataqueue.h:85
time : aliased GLIB.guint64; -- gst/base/gstdataqueue.h:86
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueSize); -- gst/base/gstdataqueue.h:82
--*
-- * GstDataQueueCheckFullFunction:
-- * @queue: a #GstDataQueue.
-- * @visible: The number of visible items currently in the queue.
-- * @bytes: The amount of bytes currently in the queue.
-- * @time: The accumulated duration of the items currently in the queue.
-- * @checkdata: The #gpointer registered when the #GstDataQueue was created.
-- *
-- * The prototype of the function used to inform the queue that it should be
-- * considered as full.
-- *
-- * Returns: #TRUE if the queue should be considered full.
-- *
-- * Since: 0.10.11
--
type GstDataQueueCheckFullFunction is access function
(arg1 : access GstDataQueue;
arg2 : GLIB.guint;
arg3 : GLIB.guint;
arg4 : GLIB.guint64;
arg5 : System.Address) return GLIB.gboolean;
pragma Convention (C, GstDataQueueCheckFullFunction); -- gst/base/gstdataqueue.h:104
type GstDataQueueFullCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueFullCallback); -- gst/base/gstdataqueue.h:107
type GstDataQueueEmptyCallback is access procedure (arg1 : access GstDataQueue; arg2 : System.Address);
pragma Convention (C, GstDataQueueEmptyCallback); -- gst/base/gstdataqueue.h:108
--*
-- * GstDataQueue:
-- * @object: the parent structure
-- *
-- * Opaque #GstDataQueue structure.
-- *
-- * Since: 0.10.11
--
type GstDataQueue is record
object : aliased GLIB.Object.GObject; -- gst/base/gstdataqueue.h:120
queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/base/gstdataqueue.h:124
cur_level : aliased GstDataQueueSize; -- gst/base/gstdataqueue.h:126
checkfull : GstDataQueueCheckFullFunction; -- gst/base/gstdataqueue.h:127
checkdata : System.Address; -- gst/base/gstdataqueue.h:128
qlock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstdataqueue.h:130
item_add : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:131
item_del : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/base/gstdataqueue.h:132
flushing : aliased GLIB.gboolean; -- gst/base/gstdataqueue.h:133
fullcallback : GstDataQueueFullCallback; -- gst/base/gstdataqueue.h:135
emptycallback : GstDataQueueEmptyCallback; -- gst/base/gstdataqueue.h:136
abidata : aliased anon_311; -- gst/base/gstdataqueue.h:144
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueue); -- gst/base/gstdataqueue.h:118
--< private >
-- the queue of data we're keeping our grubby hands on
-- size of the queue
-- Callback to check if the queue is full
-- lock for queue (vs object lock)
-- signals buffers now available for reading
-- signals space now available for writing
-- indicates whether conditions where signalled because
-- * of external flushing
type GstDataQueueClass is record
parent_class : aliased GLIB.Object.GObject_Class; -- gst/base/gstdataqueue.h:149
empty : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:152
full : access procedure (arg1 : access GstDataQueue); -- gst/base/gstdataqueue.h:153
u_gst_reserved : u_GstDataQueueClass_u_gst_reserved_array; -- gst/base/gstdataqueue.h:155
end record;
pragma Convention (C_Pass_By_Copy, GstDataQueueClass); -- gst/base/gstdataqueue.h:147
-- signals
function gst_data_queue_get_type return GLIB.GType; -- gst/base/gstdataqueue.h:158
pragma Import (C, gst_data_queue_get_type, "gst_data_queue_get_type");
function gst_data_queue_new (checkfull : GstDataQueueCheckFullFunction; checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:160
pragma Import (C, gst_data_queue_new, "gst_data_queue_new");
function gst_data_queue_new_full
(checkfull : GstDataQueueCheckFullFunction;
fullcallback : GstDataQueueFullCallback;
emptycallback : GstDataQueueEmptyCallback;
checkdata : System.Address) return access GstDataQueue; -- gst/base/gstdataqueue.h:163
pragma Import (C, gst_data_queue_new_full, "gst_data_queue_new_full");
function gst_data_queue_push (queue : access GstDataQueue; item : access GstDataQueueItem) return GLIB.gboolean; -- gst/base/gstdataqueue.h:168
pragma Import (C, gst_data_queue_push, "gst_data_queue_push");
function gst_data_queue_pop (queue : access GstDataQueue; item : System.Address) return GLIB.gboolean; -- gst/base/gstdataqueue.h:169
pragma Import (C, gst_data_queue_pop, "gst_data_queue_pop");
procedure gst_data_queue_flush (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:171
pragma Import (C, gst_data_queue_flush, "gst_data_queue_flush");
procedure gst_data_queue_set_flushing (queue : access GstDataQueue; flushing : GLIB.gboolean); -- gst/base/gstdataqueue.h:172
pragma Import (C, gst_data_queue_set_flushing, "gst_data_queue_set_flushing");
function gst_data_queue_drop_head (queue : access GstDataQueue; c_type : GLIB.GType) return GLIB.gboolean; -- gst/base/gstdataqueue.h:174
pragma Import (C, gst_data_queue_drop_head, "gst_data_queue_drop_head");
function gst_data_queue_is_full (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:176
pragma Import (C, gst_data_queue_is_full, "gst_data_queue_is_full");
function gst_data_queue_is_empty (queue : access GstDataQueue) return GLIB.gboolean; -- gst/base/gstdataqueue.h:177
pragma Import (C, gst_data_queue_is_empty, "gst_data_queue_is_empty");
procedure gst_data_queue_get_level (queue : access GstDataQueue; level : access GstDataQueueSize); -- gst/base/gstdataqueue.h:179
pragma Import (C, gst_data_queue_get_level, "gst_data_queue_get_level");
procedure gst_data_queue_limits_changed (queue : access GstDataQueue); -- gst/base/gstdataqueue.h:180
pragma Import (C, gst_data_queue_limits_changed, "gst_data_queue_limits_changed");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstdataqueue_h;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998600482940674,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999296069145203,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/oasis/program-elements-function_body_stubs.ads
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Function_Body_Stubs is
pragma Pure (Program.Elements.Function_Body_Stubs);
type Function_Body_Stub is
limited interface and Program.Elements.Declarations.Declaration;
type Function_Body_Stub_Access is access all Function_Body_Stub'Class
with Storage_Size => 0;
not overriding function Name
(Self : Function_Body_Stub)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Parameters
(Self : Function_Body_Stub)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Result_Subtype
(Self : Function_Body_Stub)
return not null Program.Elements.Element_Access is abstract;
not overriding function Aspects
(Self : Function_Body_Stub)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
not overriding function Has_Not (Self : Function_Body_Stub) return Boolean
is abstract;
not overriding function Has_Overriding
(Self : Function_Body_Stub)
return Boolean is abstract;
not overriding function Has_Not_Null
(Self : Function_Body_Stub)
return Boolean is abstract;
type Function_Body_Stub_Text is limited interface;
type Function_Body_Stub_Text_Access is
access all Function_Body_Stub_Text'Class with Storage_Size => 0;
not overriding function To_Function_Body_Stub_Text
(Self : in out Function_Body_Stub)
return Function_Body_Stub_Text_Access is abstract;
not overriding function Not_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Overriding_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Function_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Return_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Not_Token_2
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Is_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Separate_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Function_Body_Stubs;
|
24423
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Function_Body_Stubs is
pragma Pure (Program.Elements.Function_Body_Stubs);
type Function_Body_Stub is
limited interface and Program.Elements.Declarations.Declaration;
type Function_Body_Stub_Access is access all Function_Body_Stub'Class
with Storage_Size => 0;
not overriding function Name
(Self : Function_Body_Stub)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Parameters
(Self : Function_Body_Stub)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Result_Subtype
(Self : Function_Body_Stub)
return not null Program.Elements.Element_Access is abstract;
not overriding function Aspects
(Self : Function_Body_Stub)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
not overriding function Has_Not (Self : Function_Body_Stub) return Boolean
is abstract;
not overriding function Has_Overriding
(Self : Function_Body_Stub)
return Boolean is abstract;
not overriding function Has_Not_Null
(Self : Function_Body_Stub)
return Boolean is abstract;
type Function_Body_Stub_Text is limited interface;
type Function_Body_Stub_Text_Access is
access all Function_Body_Stub_Text'Class with Storage_Size => 0;
not overriding function To_Function_Body_Stub_Text
(Self : in out Function_Body_Stub)
return Function_Body_Stub_Text_Access is abstract;
not overriding function Not_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Overriding_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Function_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Return_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Not_Token_2
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Is_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Separate_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Function_Body_Stubs;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Function_Body_Stubs is
pragma Pure (Program.Elements.Function_Body_Stubs);
type Function_Body_Stub is
limited interface and Program.Elements.Declarations.Declaration;
type Function_Body_Stub_Access is access all Function_Body_Stub'Class
with Storage_Size => 0;
not overriding function Name
(Self : Function_Body_Stub)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Parameters
(Self : Function_Body_Stub)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Result_Subtype
(Self : Function_Body_Stub)
return not null Program.Elements.Element_Access is abstract;
not overriding function Aspects
(Self : Function_Body_Stub)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
not overriding function Has_Not (Self : Function_Body_Stub) return Boolean
is abstract;
not overriding function Has_Overriding
(Self : Function_Body_Stub)
return Boolean is abstract;
not overriding function Has_Not_Null
(Self : Function_Body_Stub)
return Boolean is abstract;
type Function_Body_Stub_Text is limited interface;
type Function_Body_Stub_Text_Access is
access all Function_Body_Stub_Text'Class with Storage_Size => 0;
not overriding function To_Function_Body_Stub_Text
(Self : in out Function_Body_Stub)
return Function_Body_Stub_Text_Access is abstract;
not overriding function Not_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Overriding_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Function_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Return_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Not_Token_2
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Is_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Separate_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Function_Body_Stub_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Function_Body_Stub_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Function_Body_Stubs;
|
[
{
"context": "s -- Bean component utility\n-- Copyright (C) 2011 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 163,
"score": 0.9998725652694702,
"start": 148,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2011 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 194,
"score": 0.9998797178268433,
"start": 179,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 221,
"score": 0.9999250173568726,
"start": 196,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/asf-components-utils-beans.adb
|
Letractively/ada-asf
| 0 |
-----------------------------------------------------------------------
-- components-utils-beans -- Bean component utility
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ASF.Components.Utils.Beans is
-- ------------------------------
-- Evaluate the <b>value</b> attribute and set it in the value expression
-- referred to by the <b>var</b> attribute.
-- ------------------------------
overriding
procedure Encode_Begin (UI : in UISetBean;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
VE : constant EL.Expressions.Value_Expression := UI.Get_Value_Expression ("var");
begin
if VE.Is_Null then
UI.Log_Error ("Invalid value expression for 'var'");
return;
end if;
VE.Set_Value (Context => Context.Get_ELContext.all,
Value => UI.Get_Attribute (Context => Context, Name => "value"));
end Encode_Begin;
end ASF.Components.Utils.Beans;
|
12802
|
-----------------------------------------------------------------------
-- components-utils-beans -- Bean component utility
-- Copyright (C) 2011 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ASF.Components.Utils.Beans is
-- ------------------------------
-- Evaluate the <b>value</b> attribute and set it in the value expression
-- referred to by the <b>var</b> attribute.
-- ------------------------------
overriding
procedure Encode_Begin (UI : in UISetBean;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
VE : constant EL.Expressions.Value_Expression := UI.Get_Value_Expression ("var");
begin
if VE.Is_Null then
UI.Log_Error ("Invalid value expression for 'var'");
return;
end if;
VE.Set_Value (Context => Context.Get_ELContext.all,
Value => UI.Get_Attribute (Context => Context, Name => "value"));
end Encode_Begin;
end ASF.Components.Utils.Beans;
| true |
-----------------------------------------------------------------------
-- components-utils-beans -- Bean component utility
-- Copyright (C) 2011 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ASF.Components.Utils.Beans is
-- ------------------------------
-- Evaluate the <b>value</b> attribute and set it in the value expression
-- referred to by the <b>var</b> attribute.
-- ------------------------------
overriding
procedure Encode_Begin (UI : in UISetBean;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
VE : constant EL.Expressions.Value_Expression := UI.Get_Value_Expression ("var");
begin
if VE.Is_Null then
UI.Log_Error ("Invalid value expression for 'var'");
return;
end if;
VE.Set_Value (Context => Context.Get_ELContext.all,
Value => UI.Get_Attribute (Context => Context, Name => "value"));
end Encode_Begin;
end ASF.Components.Utils.Beans;
|
[
{
"context": "-- Copyright 2020-2021 Jeff Foley. All rights reserved.\n-- Use of this source code ",
"end": 33,
"score": 0.9998477697372437,
"start": 23,
"tag": "NAME",
"value": "Jeff Foley"
}
] |
resources/scripts/api/github.ads
|
Elon143/Amass
| 7,053 |
-- Copyright 2020-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "GitHub"
type = "api"
function start()
set_rate_limit(7)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
for i=1,100 do
local resp, err = request(ctx, {
['url']=build_url(domain, i),
headers={['Authorization']="token " .. c.key},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d['total_count'] == 0 or #(d.items) == 0) then
return
end
for _, item in pairs(d.items) do
search_item(ctx, item)
end
end
end
function search_item(ctx, item)
local info, err = request(ctx, {['url']=item.url})
if (err ~= nil and err ~= "") then
log(ctx, "first search_item request to service failed: " .. err)
return
end
local data = json.decode(info)
if (data == nil or data['download_url'] == nil) then
return
end
local content, err = request(ctx, {['url']=data['download_url']})
if err ~= nil and err ~= "" then
log(ctx, "second search_item request to service failed: " .. err)
end
send_names(ctx, content)
end
function build_url(domain, pagenum)
return "https://api.github.com/search/code?q=\"" .. domain .. "\"&page=" .. pagenum .. "&per_page=100"
end
|
24291
|
-- Copyright 2020-2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "GitHub"
type = "api"
function start()
set_rate_limit(7)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
for i=1,100 do
local resp, err = request(ctx, {
['url']=build_url(domain, i),
headers={['Authorization']="token " .. c.key},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d['total_count'] == 0 or #(d.items) == 0) then
return
end
for _, item in pairs(d.items) do
search_item(ctx, item)
end
end
end
function search_item(ctx, item)
local info, err = request(ctx, {['url']=item.url})
if (err ~= nil and err ~= "") then
log(ctx, "first search_item request to service failed: " .. err)
return
end
local data = json.decode(info)
if (data == nil or data['download_url'] == nil) then
return
end
local content, err = request(ctx, {['url']=data['download_url']})
if err ~= nil and err ~= "" then
log(ctx, "second search_item request to service failed: " .. err)
end
send_names(ctx, content)
end
function build_url(domain, pagenum)
return "https://api.github.com/search/code?q=\"" .. domain .. "\"&page=" .. pagenum .. "&per_page=100"
end
| true |
-- Copyright 2020-2021 PI:NAME:<NAME>END_PI. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "GitHub"
type = "api"
function start()
set_rate_limit(7)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
for i=1,100 do
local resp, err = request(ctx, {
['url']=build_url(domain, i),
headers={['Authorization']="token " .. c.key},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d['total_count'] == 0 or #(d.items) == 0) then
return
end
for _, item in pairs(d.items) do
search_item(ctx, item)
end
end
end
function search_item(ctx, item)
local info, err = request(ctx, {['url']=item.url})
if (err ~= nil and err ~= "") then
log(ctx, "first search_item request to service failed: " .. err)
return
end
local data = json.decode(info)
if (data == nil or data['download_url'] == nil) then
return
end
local content, err = request(ctx, {['url']=data['download_url']})
if err ~= nil and err ~= "" then
log(ctx, "second search_item request to service failed: " .. err)
end
send_names(ctx, content)
end
function build_url(domain, pagenum)
return "https://api.github.com/search/code?q=\"" .. domain .. "\"&page=" .. pagenum .. "&per_page=100"
end
|
[
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- Al",
"end": 824,
"score": 0.9998865127563477,
"start": 811,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 844,
"score": 0.999931812286377,
"start": 826,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/amf/dd/amf-dg-holders.adb
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DG.Holders.Close_Paths;
with AMF.DG.Holders.Cubic_Curve_Tos;
with AMF.DG.Holders.Elliptical_Arc_Tos;
with AMF.DG.Holders.Gradient_Stops;
with AMF.DG.Holders.Line_Tos;
with AMF.DG.Holders.Matrixs;
with AMF.DG.Holders.Move_Tos;
with AMF.DG.Holders.Path_Commands;
with AMF.DG.Holders.Quadratic_Curve_Tos;
with AMF.DG.Holders.Rotates;
with AMF.DG.Holders.Scales;
with AMF.DG.Holders.Skews;
with AMF.DG.Holders.Transforms;
with AMF.DG.Holders.Translates;
package body AMF.DG.Holders is
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Close_Path is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Close_Paths.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Close_Paths.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Cubic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Cubic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Elliptical_Arc_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Elliptical_Arc_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Gradient_Stop is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Gradient_Stops.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Gradient_Stops.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Line_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Line_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Line_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Matrix is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Matrixs.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Matrixs.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Move_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Move_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Move_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Path_Command is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Path_Commands.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Path_Commands.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Quadratic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Quadratic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Rotate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Rotates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Rotates.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Scale is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Scales.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Scales.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Skew is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Skews.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Skews.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Transform is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Transforms.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Transforms.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Translate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Translates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Translates.Element (Holder));
end if;
end Element;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Close_Path)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Close_Paths.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Close_Paths.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Cubic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Cubic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Elliptical_Arc_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Elliptical_Arc_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Gradient_Stop)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Gradient_Stops.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Gradient_Stops.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Line_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Line_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Line_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Matrix)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Matrixs.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Matrixs.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Move_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Move_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Move_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Path_Command)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Path_Commands.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Path_Commands.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Quadratic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Quadratic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Rotate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Rotates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Rotates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Scale)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Scales.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Scales.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Skew)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Skews.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Skews.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Transform)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Transforms.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Transforms.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Translate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Translates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Translates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
end AMF.DG.Holders;
|
11018
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DG.Holders.Close_Paths;
with AMF.DG.Holders.Cubic_Curve_Tos;
with AMF.DG.Holders.Elliptical_Arc_Tos;
with AMF.DG.Holders.Gradient_Stops;
with AMF.DG.Holders.Line_Tos;
with AMF.DG.Holders.Matrixs;
with AMF.DG.Holders.Move_Tos;
with AMF.DG.Holders.Path_Commands;
with AMF.DG.Holders.Quadratic_Curve_Tos;
with AMF.DG.Holders.Rotates;
with AMF.DG.Holders.Scales;
with AMF.DG.Holders.Skews;
with AMF.DG.Holders.Transforms;
with AMF.DG.Holders.Translates;
package body AMF.DG.Holders is
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Close_Path is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Close_Paths.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Close_Paths.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Cubic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Cubic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Elliptical_Arc_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Elliptical_Arc_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Gradient_Stop is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Gradient_Stops.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Gradient_Stops.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Line_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Line_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Line_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Matrix is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Matrixs.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Matrixs.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Move_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Move_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Move_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Path_Command is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Path_Commands.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Path_Commands.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Quadratic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Quadratic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Rotate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Rotates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Rotates.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Scale is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Scales.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Scales.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Skew is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Skews.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Skews.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Transform is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Transforms.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Transforms.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Translate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Translates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Translates.Element (Holder));
end if;
end Element;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Close_Path)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Close_Paths.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Close_Paths.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Cubic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Cubic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Elliptical_Arc_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Elliptical_Arc_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Gradient_Stop)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Gradient_Stops.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Gradient_Stops.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Line_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Line_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Line_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Matrix)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Matrixs.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Matrixs.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Move_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Move_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Move_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Path_Command)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Path_Commands.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Path_Commands.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Quadratic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Quadratic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Rotate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Rotates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Rotates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Scale)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Scales.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Scales.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Skew)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Skews.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Skews.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Transform)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Transforms.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Transforms.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Translate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Translates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Translates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
end AMF.DG.Holders;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DG.Holders.Close_Paths;
with AMF.DG.Holders.Cubic_Curve_Tos;
with AMF.DG.Holders.Elliptical_Arc_Tos;
with AMF.DG.Holders.Gradient_Stops;
with AMF.DG.Holders.Line_Tos;
with AMF.DG.Holders.Matrixs;
with AMF.DG.Holders.Move_Tos;
with AMF.DG.Holders.Path_Commands;
with AMF.DG.Holders.Quadratic_Curve_Tos;
with AMF.DG.Holders.Rotates;
with AMF.DG.Holders.Scales;
with AMF.DG.Holders.Skews;
with AMF.DG.Holders.Transforms;
with AMF.DG.Holders.Translates;
package body AMF.DG.Holders is
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Close_Path is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Close_Paths.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Close_Paths.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Cubic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Cubic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Elliptical_Arc_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Elliptical_Arc_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Gradient_Stop is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Gradient_Stops.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Gradient_Stops.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Line_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Line_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Line_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Matrix is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Matrixs.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Matrixs.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Move_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Move_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Move_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Path_Command is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Path_Commands.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Path_Commands.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Quadratic_Curve_To is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Quadratic_Curve_Tos.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Rotate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Rotates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Rotates.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Scale is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Scales.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Scales.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Skew is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Skews.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Skews.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Transform is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Transforms.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Transforms.Element (Holder));
end if;
end Element;
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.DG.Optional_DG_Translate is
begin
if not League.Holders.Has_Tag
(Holder, AMF.DG.Holders.Translates.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.DG.Holders.Translates.Element (Holder));
end if;
end Element;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Close_Path)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Close_Paths.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Close_Paths.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Cubic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Cubic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Cubic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Elliptical_Arc_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Elliptical_Arc_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Elliptical_Arc_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Gradient_Stop)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Gradient_Stops.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Gradient_Stops.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Line_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Line_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Line_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Matrix)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Matrixs.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Matrixs.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Move_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Move_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Move_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Path_Command)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Path_Commands.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Path_Commands.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Quadratic_Curve_To)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Quadratic_Curve_Tos.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Quadratic_Curve_Tos.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Rotate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Rotates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Rotates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Scale)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Scales.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Scales.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Skew)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Skews.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Skews.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Transform)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Transforms.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Transforms.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.DG.Optional_DG_Translate)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.DG.Holders.Translates.Value_Tag);
if not Element.Is_Empty then
AMF.DG.Holders.Translates.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
end AMF.DG.Holders;
|
[
{
"context": "- Tests for ASF navigation\n-- Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 164,
"score": 0.9998679161071777,
"start": 149,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 195,
"score": 0.9998771548271179,
"start": 180,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "3 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 222,
"score": 0.9999278783798218,
"start": 197,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "John\");\n Request.Set_Parameter (\"password\", \"12345\");\n Request.Set_Parameter (\"email\", \"john@gm",
"end": 3646,
"score": 0.9992216229438782,
"start": 3641,
"tag": "PASSWORD",
"value": "12345"
},
{
"context": " \"12345\");\n Request.Set_Parameter (\"email\", \"[email protected]\");\n Request.Set_Parameter (\"ok\", \"1\");\n ",
"end": 3703,
"score": 0.9999244809150696,
"start": 3689,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/asf-navigations-tests.adb
|
Letractively/ada-asf
| 0 |
-----------------------------------------------------------------------
-- asf-navigations-tests - Tests for ASF navigation
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Beans.Objects;
with ASF.Tests;
with ASF.Requests.Mockup;
with ASF.Responses.Mockup;
with ASF.Applications.Main;
with ASF.Applications.Main.Configs;
with ASF.Applications.Tests;
package body ASF.Navigations.Tests is
use Util.Beans.Objects;
use ASF.Tests;
package Caller is new Util.Test_Caller (Test, "Navigations");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test navigation exact match (view, outcome, action)",
Test_Exact_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation partial match (view, outcome)",
Test_Partial_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation exception match (view, outcome)",
Test_Exception_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation wildcard match (view, outcome)",
Test_Wildcard_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation condition match (view, outcome)",
Test_Conditional_Navigation'Access);
end Add_Tests;
-- ------------------------------
-- Initialize the test application
-- ------------------------------
overriding
procedure Set_Up (T : in out Test) is
pragma Unreferenced (T);
use type ASF.Applications.Main.Application_Access;
Fact : ASF.Applications.Main.Application_Factory;
begin
if ASF.Tests.Get_Application = null then
ASF.Tests.Initialize (Util.Tests.Get_Properties, Factory => Fact);
end if;
end Set_Up;
-- ------------------------------
-- Check the navigation for an URI and expect the result to match the regular expression.
-- ------------------------------
procedure Check_Navigation (T : in out Test;
Name : in String;
Match : in String;
Raise_Flag : in Boolean := False) is
Request : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
Form : aliased ASF.Applications.Tests.Form_Bean;
File : constant String := Util.Tests.Get_Path ("regtests/config/test-navigations.xml");
begin
Form.Perm_Error := Raise_Flag;
ASF.Applications.Main.Configs.Read_Configuration (ASF.Tests.Get_Application.all, File);
Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access,
Storage => STATIC));
Do_Get (Request, Reply, "/tests/" & Name & ".html", Name & ".txt");
Request.Set_Parameter ("formText", "1");
Request.Set_Parameter ("name", "John");
Request.Set_Parameter ("password", "12345");
Request.Set_Parameter ("email", "[email protected]");
Request.Set_Parameter ("ok", "1");
Do_Post (Request, Reply, "/tests/" & Name & ".html", Name & "form-navigation-exact.txt");
Assert_Matches (T, Match,
Reply, "Wrong generated content");
end Check_Navigation;
-- ------------------------------
-- Test a form navigation with an exact match (view, outcome, action).
-- ------------------------------
procedure Test_Exact_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav", ".*success.*");
end Test_Exact_Navigation;
-- ------------------------------
-- Test a form navigation with a partial match (view, outcome).
-- ------------------------------
procedure Test_Partial_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-partial", ".*success partial.*");
end Test_Partial_Navigation;
-- ------------------------------
-- Test a form navigation with a exception match (view, outcome).
-- ------------------------------
procedure Test_Exception_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-exception", ".*success exception.*", True);
end Test_Exception_Navigation;
-- ------------------------------
-- Test a form navigation with a wildcard match on the URI (view, outcome).
-- ------------------------------
procedure Test_Wildcard_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-wildcard", ".*success wildcard.*", False);
end Test_Wildcard_Navigation;
-- ------------------------------
-- Test a form navigation with a condition (view, outcome, condition).
-- ------------------------------
procedure Test_Conditional_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-condition", ".*success condition.*", False);
end Test_Conditional_Navigation;
end ASF.Navigations.Tests;
|
10092
|
-----------------------------------------------------------------------
-- asf-navigations-tests - Tests for ASF navigation
-- Copyright (C) 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 ASF.Tests;
with ASF.Requests.Mockup;
with ASF.Responses.Mockup;
with ASF.Applications.Main;
with ASF.Applications.Main.Configs;
with ASF.Applications.Tests;
package body ASF.Navigations.Tests is
use Util.Beans.Objects;
use ASF.Tests;
package Caller is new Util.Test_Caller (Test, "Navigations");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test navigation exact match (view, outcome, action)",
Test_Exact_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation partial match (view, outcome)",
Test_Partial_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation exception match (view, outcome)",
Test_Exception_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation wildcard match (view, outcome)",
Test_Wildcard_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation condition match (view, outcome)",
Test_Conditional_Navigation'Access);
end Add_Tests;
-- ------------------------------
-- Initialize the test application
-- ------------------------------
overriding
procedure Set_Up (T : in out Test) is
pragma Unreferenced (T);
use type ASF.Applications.Main.Application_Access;
Fact : ASF.Applications.Main.Application_Factory;
begin
if ASF.Tests.Get_Application = null then
ASF.Tests.Initialize (Util.Tests.Get_Properties, Factory => Fact);
end if;
end Set_Up;
-- ------------------------------
-- Check the navigation for an URI and expect the result to match the regular expression.
-- ------------------------------
procedure Check_Navigation (T : in out Test;
Name : in String;
Match : in String;
Raise_Flag : in Boolean := False) is
Request : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
Form : aliased ASF.Applications.Tests.Form_Bean;
File : constant String := Util.Tests.Get_Path ("regtests/config/test-navigations.xml");
begin
Form.Perm_Error := Raise_Flag;
ASF.Applications.Main.Configs.Read_Configuration (ASF.Tests.Get_Application.all, File);
Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access,
Storage => STATIC));
Do_Get (Request, Reply, "/tests/" & Name & ".html", Name & ".txt");
Request.Set_Parameter ("formText", "1");
Request.Set_Parameter ("name", "John");
Request.Set_Parameter ("password", "<PASSWORD>");
Request.Set_Parameter ("email", "<EMAIL>");
Request.Set_Parameter ("ok", "1");
Do_Post (Request, Reply, "/tests/" & Name & ".html", Name & "form-navigation-exact.txt");
Assert_Matches (T, Match,
Reply, "Wrong generated content");
end Check_Navigation;
-- ------------------------------
-- Test a form navigation with an exact match (view, outcome, action).
-- ------------------------------
procedure Test_Exact_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav", ".*success.*");
end Test_Exact_Navigation;
-- ------------------------------
-- Test a form navigation with a partial match (view, outcome).
-- ------------------------------
procedure Test_Partial_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-partial", ".*success partial.*");
end Test_Partial_Navigation;
-- ------------------------------
-- Test a form navigation with a exception match (view, outcome).
-- ------------------------------
procedure Test_Exception_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-exception", ".*success exception.*", True);
end Test_Exception_Navigation;
-- ------------------------------
-- Test a form navigation with a wildcard match on the URI (view, outcome).
-- ------------------------------
procedure Test_Wildcard_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-wildcard", ".*success wildcard.*", False);
end Test_Wildcard_Navigation;
-- ------------------------------
-- Test a form navigation with a condition (view, outcome, condition).
-- ------------------------------
procedure Test_Conditional_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-condition", ".*success condition.*", False);
end Test_Conditional_Navigation;
end ASF.Navigations.Tests;
| true |
-----------------------------------------------------------------------
-- asf-navigations-tests - Tests for ASF navigation
-- Copyright (C) 2013 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 ASF.Tests;
with ASF.Requests.Mockup;
with ASF.Responses.Mockup;
with ASF.Applications.Main;
with ASF.Applications.Main.Configs;
with ASF.Applications.Tests;
package body ASF.Navigations.Tests is
use Util.Beans.Objects;
use ASF.Tests;
package Caller is new Util.Test_Caller (Test, "Navigations");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test navigation exact match (view, outcome, action)",
Test_Exact_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation partial match (view, outcome)",
Test_Partial_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation exception match (view, outcome)",
Test_Exception_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation wildcard match (view, outcome)",
Test_Wildcard_Navigation'Access);
Caller.Add_Test (Suite, "Test navigation condition match (view, outcome)",
Test_Conditional_Navigation'Access);
end Add_Tests;
-- ------------------------------
-- Initialize the test application
-- ------------------------------
overriding
procedure Set_Up (T : in out Test) is
pragma Unreferenced (T);
use type ASF.Applications.Main.Application_Access;
Fact : ASF.Applications.Main.Application_Factory;
begin
if ASF.Tests.Get_Application = null then
ASF.Tests.Initialize (Util.Tests.Get_Properties, Factory => Fact);
end if;
end Set_Up;
-- ------------------------------
-- Check the navigation for an URI and expect the result to match the regular expression.
-- ------------------------------
procedure Check_Navigation (T : in out Test;
Name : in String;
Match : in String;
Raise_Flag : in Boolean := False) is
Request : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
Form : aliased ASF.Applications.Tests.Form_Bean;
File : constant String := Util.Tests.Get_Path ("regtests/config/test-navigations.xml");
begin
Form.Perm_Error := Raise_Flag;
ASF.Applications.Main.Configs.Read_Configuration (ASF.Tests.Get_Application.all, File);
Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access,
Storage => STATIC));
Do_Get (Request, Reply, "/tests/" & Name & ".html", Name & ".txt");
Request.Set_Parameter ("formText", "1");
Request.Set_Parameter ("name", "John");
Request.Set_Parameter ("password", "PI:PASSWORD:<PASSWORD>END_PI");
Request.Set_Parameter ("email", "PI:EMAIL:<EMAIL>END_PI");
Request.Set_Parameter ("ok", "1");
Do_Post (Request, Reply, "/tests/" & Name & ".html", Name & "form-navigation-exact.txt");
Assert_Matches (T, Match,
Reply, "Wrong generated content");
end Check_Navigation;
-- ------------------------------
-- Test a form navigation with an exact match (view, outcome, action).
-- ------------------------------
procedure Test_Exact_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav", ".*success.*");
end Test_Exact_Navigation;
-- ------------------------------
-- Test a form navigation with a partial match (view, outcome).
-- ------------------------------
procedure Test_Partial_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-partial", ".*success partial.*");
end Test_Partial_Navigation;
-- ------------------------------
-- Test a form navigation with a exception match (view, outcome).
-- ------------------------------
procedure Test_Exception_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-exception", ".*success exception.*", True);
end Test_Exception_Navigation;
-- ------------------------------
-- Test a form navigation with a wildcard match on the URI (view, outcome).
-- ------------------------------
procedure Test_Wildcard_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-wildcard", ".*success wildcard.*", False);
end Test_Wildcard_Navigation;
-- ------------------------------
-- Test a form navigation with a condition (view, outcome, condition).
-- ------------------------------
procedure Test_Conditional_Navigation (T : in out Test) is
begin
T.Check_Navigation ("form-nav-condition", ".*success condition.*", False);
end Test_Conditional_Navigation;
end ASF.Navigations.Tests;
|
[
{
"context": "-- part of OpenGLAda, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ",
"end": 44,
"score": 0.9998350143432617,
"start": 32,
"tag": "NAME",
"value": "Felix Krause"
}
] |
src/gl/implementation/gl-objects-textures-targets.adb
|
Roldak/OpenGLAda
| 79 |
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.API;
with GL.Enums.Textures;
package body GL.Objects.Textures.Targets is
function Buffer_Offset (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Offset, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Offset;
function Buffer_Size (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Size, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Size;
function Target_From_Kind (Kind : Low_Level.Enums.Texture_Kind)
return not null access constant Texture_Proxy'Class is
begin
case Kind is
when GL.Low_Level.Enums.Texture_1D => return Texture_1D'Access;
when GL.Low_Level.Enums.Texture_2D => return Texture_2D'Access;
when GL.Low_Level.Enums.Texture_3D => return Texture_3D'Access;
when GL.Low_Level.Enums.Proxy_Texture_1D =>
return Texture_1D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_2D =>
return Texture_2D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_3D =>
return Texture_3D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_Cube_Map =>
return Texture_Cube_Map_Proxy'Access;
when GL.Low_Level.Enums.Texture_Cube_Map =>
return Texture_Cube_Map'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_X =>
return Texture_Cube_Map_Positive_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_X =>
return Texture_Cube_Map_Negative_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Y =>
return Texture_Cube_Map_Positive_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Y =>
return Texture_Cube_Map_Negative_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Z =>
return Texture_Cube_Map_Positive_Z'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Z =>
return Texture_Cube_Map_Negative_Z'Access;
when GL.Low_Level.Enums.Texture_1D_Array |
GL.Low_Level.Enums.Texture_2D_Array |
GL.Low_Level.Enums.Proxy_Texture_1D_Array |
GL.Low_Level.Enums.Proxy_Texture_2D_Array =>
raise Not_Implemented_Exception with Kind'Img;
when GL.Low_Level.Enums.Texture_Buffer =>
return Texture_Buffer'Access;
end case;
end Target_From_Kind;
end GL.Objects.Textures.Targets;
|
27494
|
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with GL.API;
with GL.Enums.Textures;
package body GL.Objects.Textures.Targets is
function Buffer_Offset (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Offset, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Offset;
function Buffer_Size (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Size, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Size;
function Target_From_Kind (Kind : Low_Level.Enums.Texture_Kind)
return not null access constant Texture_Proxy'Class is
begin
case Kind is
when GL.Low_Level.Enums.Texture_1D => return Texture_1D'Access;
when GL.Low_Level.Enums.Texture_2D => return Texture_2D'Access;
when GL.Low_Level.Enums.Texture_3D => return Texture_3D'Access;
when GL.Low_Level.Enums.Proxy_Texture_1D =>
return Texture_1D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_2D =>
return Texture_2D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_3D =>
return Texture_3D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_Cube_Map =>
return Texture_Cube_Map_Proxy'Access;
when GL.Low_Level.Enums.Texture_Cube_Map =>
return Texture_Cube_Map'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_X =>
return Texture_Cube_Map_Positive_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_X =>
return Texture_Cube_Map_Negative_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Y =>
return Texture_Cube_Map_Positive_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Y =>
return Texture_Cube_Map_Negative_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Z =>
return Texture_Cube_Map_Positive_Z'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Z =>
return Texture_Cube_Map_Negative_Z'Access;
when GL.Low_Level.Enums.Texture_1D_Array |
GL.Low_Level.Enums.Texture_2D_Array |
GL.Low_Level.Enums.Proxy_Texture_1D_Array |
GL.Low_Level.Enums.Proxy_Texture_2D_Array =>
raise Not_Implemented_Exception with Kind'Img;
when GL.Low_Level.Enums.Texture_Buffer =>
return Texture_Buffer'Access;
end case;
end Target_From_Kind;
end GL.Objects.Textures.Targets;
| true |
-- part of OpenGLAda, (c) 2017 PI:NAME:<NAME>END_PI
-- released under the terms of the MIT license, see the file "COPYING"
with GL.API;
with GL.Enums.Textures;
package body GL.Objects.Textures.Targets is
function Buffer_Offset (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Offset, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Offset;
function Buffer_Size (Object : Texture_Buffer_Target;
Level : Mipmap_Level) return Size is
Ret : Size;
begin
API.Get_Tex_Level_Parameter_Size (Object.Kind, Level,
Enums.Textures.Buffer_Size, Ret);
Raise_Exception_On_OpenGL_Error;
return Ret;
end Buffer_Size;
function Target_From_Kind (Kind : Low_Level.Enums.Texture_Kind)
return not null access constant Texture_Proxy'Class is
begin
case Kind is
when GL.Low_Level.Enums.Texture_1D => return Texture_1D'Access;
when GL.Low_Level.Enums.Texture_2D => return Texture_2D'Access;
when GL.Low_Level.Enums.Texture_3D => return Texture_3D'Access;
when GL.Low_Level.Enums.Proxy_Texture_1D =>
return Texture_1D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_2D =>
return Texture_2D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_3D =>
return Texture_3D_Proxy'Access;
when GL.Low_Level.Enums.Proxy_Texture_Cube_Map =>
return Texture_Cube_Map_Proxy'Access;
when GL.Low_Level.Enums.Texture_Cube_Map =>
return Texture_Cube_Map'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_X =>
return Texture_Cube_Map_Positive_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_X =>
return Texture_Cube_Map_Negative_X'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Y =>
return Texture_Cube_Map_Positive_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Y =>
return Texture_Cube_Map_Negative_Y'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Positive_Z =>
return Texture_Cube_Map_Positive_Z'Access;
when GL.Low_Level.Enums.Texture_Cube_Map_Negative_Z =>
return Texture_Cube_Map_Negative_Z'Access;
when GL.Low_Level.Enums.Texture_1D_Array |
GL.Low_Level.Enums.Texture_2D_Array |
GL.Low_Level.Enums.Proxy_Texture_1D_Array |
GL.Low_Level.Enums.Proxy_Texture_2D_Array =>
raise Not_Implemented_Exception with Kind'Img;
when GL.Low_Level.Enums.Texture_Buffer =>
return Texture_Buffer'Access;
end case;
end Target_From_Kind;
end GL.Objects.Textures.Targets;
|
[
{
"context": "---------------------------\n-- Copyright (C) 2020 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 477,
"score": 0.9998726844787598,
"start": 462,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2020 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 508,
"score": 0.9998807907104492,
"start": 493,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "0 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 535,
"score": 0.9999278783798218,
"start": 510,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/model/regtests-audits-model.ads
|
My-Colaborations/ada-ado
| 0 |
-----------------------------------------------------------------------
-- Regtests.Audits.Model -- Regtests.Audits.Model
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with ADO.Audits;
pragma Warnings (On);
package Regtests.Audits.Model is
pragma Style_Checks ("-mr");
type Audit_Ref is new ADO.Objects.Object_Ref with null record;
type Email_Ref is new ADO.Objects.Object_Ref with null record;
type Property_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- This is the Audit_Info table
-- --------------------
-- Create an object key for Audit.
function Audit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Audit from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Audit_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Audit : constant Audit_Ref;
function "=" (Left, Right : Audit_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity id
procedure Set_Entity_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get the entity id
function Get_Entity_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity type
procedure Set_Entity_Type (Object : in out Audit_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type
function Get_Entity_Type (Object : in Audit_Ref)
return ADO.Entity_Type;
-- Set the old value
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the old value
function Get_Old_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_Old_Value (Object : in Audit_Ref)
return String;
-- Set the new value
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the new value
function Get_New_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_New_Value (Object : in Audit_Ref)
return String;
-- Set the audit date
procedure Set_Date (Object : in out Audit_Ref;
Value : in Ada.Calendar.Time);
-- Get the audit date
function Get_Date (Object : in Audit_Ref)
return Ada.Calendar.Time;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Audit_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Ref);
-- Copy of the object.
procedure Copy (Object : in Audit_Ref;
Into : in out Audit_Ref);
package Audit_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Audit_Ref,
"=" => "=");
subtype Audit_Vector is Audit_Vectors.Vector;
procedure List (Object : in out Audit_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- This is the User email table
-- --------------------
-- Create an object key for Email.
function Email_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Email from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Email_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Email : constant Email_Ref;
function "=" (Left, Right : Email_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Email_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Email_Ref)
return ADO.Identifier;
-- Set the user email address
procedure Set_Email (Object : in out Email_Ref;
Value : in ADO.Nullable_String);
procedure Set_Email (Object : in out Email_Ref;
Value : in String);
-- Get the user email address
function Get_Email (Object : in Email_Ref)
return ADO.Nullable_String;
function Get_Email (Object : in Email_Ref)
return String;
-- Set the user email status
procedure Set_Status (Object : in out Email_Ref;
Value : in ADO.Nullable_Integer);
-- Get the user email status
function Get_Status (Object : in Email_Ref)
return ADO.Nullable_Integer;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Email_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Email_Ref);
-- Copy of the object.
procedure Copy (Object : in Email_Ref;
Into : in out Email_Ref);
-- --------------------
-- This is a generic property
-- --------------------
-- Create an object key for Property.
function Property_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Property from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Property_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Property : constant Property_Ref;
function "=" (Left, Right : Property_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Property_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Id (Object : in out Property_Ref;
Value : in String);
-- Get null
function Get_Id (Object : in Property_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Id (Object : in Property_Ref)
return String;
-- Set the property value
procedure Set_Value (Object : in out Property_Ref;
Value : in ADO.Nullable_Integer);
-- Get the property value
function Get_Value (Object : in Property_Ref)
return ADO.Nullable_Integer;
-- Set a float property value
procedure Set_Float_Value (Object : in out Property_Ref;
Value : in Float);
-- Get a float property value
function Get_Float_Value (Object : in Property_Ref)
return Float;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Property_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Property_Ref);
-- Copy of the object.
procedure Copy (Object : in Property_Ref;
Into : in out Property_Ref);
private
AUDIT_NAME : aliased constant String := "audit_info";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "entity_id";
COL_2_1_NAME : aliased constant String := "entity_type";
COL_3_1_NAME : aliased constant String := "old_value";
COL_4_1_NAME : aliased constant String := "new_value";
COL_5_1_NAME : aliased constant String := "date";
AUDIT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 6,
Table => AUDIT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access)
);
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= AUDIT_DEF'Access;
Null_Audit : constant Audit_Ref
:= Audit_Ref'(ADO.Objects.Object_Ref with null record);
type Audit_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access)
with record
Entity_Id : ADO.Identifier;
Entity_Type : ADO.Entity_Type;
Old_Value : ADO.Nullable_String;
New_Value : ADO.Nullable_String;
Date : Ada.Calendar.Time;
end record;
type Audit_Access is access all Audit_Impl;
overriding
procedure Destroy (Object : access Audit_Impl);
overriding
procedure Find (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Audit_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Audit_Ref'Class;
Impl : out Audit_Access);
EMAIL_NAME : aliased constant String := "audit_email";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "user_email";
COL_2_2_NAME : aliased constant String := "email_status";
EMAIL_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => EMAIL_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access)
);
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= EMAIL_DEF'Access;
EMAIL_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => EMAIL_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
EMAIL_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= EMAIL_AUDIT_DEF'Access;
Null_Email : constant Email_Ref
:= Email_Ref'(ADO.Objects.Object_Ref with null record);
type Email_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => EMAIL_DEF'Access,
With_Audit => EMAIL_AUDIT_DEF'Access)
with record
Email : ADO.Nullable_String;
Status : ADO.Nullable_Integer;
end record;
type Email_Access is access all Email_Impl;
overriding
procedure Destroy (Object : access Email_Impl);
overriding
procedure Find (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Email_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Email_Ref'Class;
Impl : out Email_Access);
PROPERTY_NAME : aliased constant String := "audit_property";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "user_email";
COL_2_3_NAME : aliased constant String := "float_value";
PROPERTY_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => PROPERTY_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access)
);
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROPERTY_DEF'Access;
PROPERTY_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => PROPERTY_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
PROPERTY_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= PROPERTY_AUDIT_DEF'Access;
Null_Property : constant Property_Ref
:= Property_Ref'(ADO.Objects.Object_Ref with null record);
type Property_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_STRING,
Of_Class => PROPERTY_DEF'Access,
With_Audit => PROPERTY_AUDIT_DEF'Access)
with record
Value : ADO.Nullable_Integer;
Float_Value : Float;
end record;
type Property_Access is access all Property_Impl;
overriding
procedure Destroy (Object : access Property_Impl);
overriding
procedure Find (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Property_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Property_Ref'Class;
Impl : out Property_Access);
end Regtests.Audits.Model;
|
19416
|
-----------------------------------------------------------------------
-- Regtests.Audits.Model -- Regtests.Audits.Model
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with ADO.Audits;
pragma Warnings (On);
package Regtests.Audits.Model is
pragma Style_Checks ("-mr");
type Audit_Ref is new ADO.Objects.Object_Ref with null record;
type Email_Ref is new ADO.Objects.Object_Ref with null record;
type Property_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- This is the Audit_Info table
-- --------------------
-- Create an object key for Audit.
function Audit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Audit from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Audit_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Audit : constant Audit_Ref;
function "=" (Left, Right : Audit_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity id
procedure Set_Entity_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get the entity id
function Get_Entity_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity type
procedure Set_Entity_Type (Object : in out Audit_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type
function Get_Entity_Type (Object : in Audit_Ref)
return ADO.Entity_Type;
-- Set the old value
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the old value
function Get_Old_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_Old_Value (Object : in Audit_Ref)
return String;
-- Set the new value
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the new value
function Get_New_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_New_Value (Object : in Audit_Ref)
return String;
-- Set the audit date
procedure Set_Date (Object : in out Audit_Ref;
Value : in Ada.Calendar.Time);
-- Get the audit date
function Get_Date (Object : in Audit_Ref)
return Ada.Calendar.Time;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Audit_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Ref);
-- Copy of the object.
procedure Copy (Object : in Audit_Ref;
Into : in out Audit_Ref);
package Audit_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Audit_Ref,
"=" => "=");
subtype Audit_Vector is Audit_Vectors.Vector;
procedure List (Object : in out Audit_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- This is the User email table
-- --------------------
-- Create an object key for Email.
function Email_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Email from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Email_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Email : constant Email_Ref;
function "=" (Left, Right : Email_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Email_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Email_Ref)
return ADO.Identifier;
-- Set the user email address
procedure Set_Email (Object : in out Email_Ref;
Value : in ADO.Nullable_String);
procedure Set_Email (Object : in out Email_Ref;
Value : in String);
-- Get the user email address
function Get_Email (Object : in Email_Ref)
return ADO.Nullable_String;
function Get_Email (Object : in Email_Ref)
return String;
-- Set the user email status
procedure Set_Status (Object : in out Email_Ref;
Value : in ADO.Nullable_Integer);
-- Get the user email status
function Get_Status (Object : in Email_Ref)
return ADO.Nullable_Integer;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Email_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Email_Ref);
-- Copy of the object.
procedure Copy (Object : in Email_Ref;
Into : in out Email_Ref);
-- --------------------
-- This is a generic property
-- --------------------
-- Create an object key for Property.
function Property_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Property from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Property_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Property : constant Property_Ref;
function "=" (Left, Right : Property_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Property_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Id (Object : in out Property_Ref;
Value : in String);
-- Get null
function Get_Id (Object : in Property_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Id (Object : in Property_Ref)
return String;
-- Set the property value
procedure Set_Value (Object : in out Property_Ref;
Value : in ADO.Nullable_Integer);
-- Get the property value
function Get_Value (Object : in Property_Ref)
return ADO.Nullable_Integer;
-- Set a float property value
procedure Set_Float_Value (Object : in out Property_Ref;
Value : in Float);
-- Get a float property value
function Get_Float_Value (Object : in Property_Ref)
return Float;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Property_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Property_Ref);
-- Copy of the object.
procedure Copy (Object : in Property_Ref;
Into : in out Property_Ref);
private
AUDIT_NAME : aliased constant String := "audit_info";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "entity_id";
COL_2_1_NAME : aliased constant String := "entity_type";
COL_3_1_NAME : aliased constant String := "old_value";
COL_4_1_NAME : aliased constant String := "new_value";
COL_5_1_NAME : aliased constant String := "date";
AUDIT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 6,
Table => AUDIT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access)
);
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= AUDIT_DEF'Access;
Null_Audit : constant Audit_Ref
:= Audit_Ref'(ADO.Objects.Object_Ref with null record);
type Audit_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access)
with record
Entity_Id : ADO.Identifier;
Entity_Type : ADO.Entity_Type;
Old_Value : ADO.Nullable_String;
New_Value : ADO.Nullable_String;
Date : Ada.Calendar.Time;
end record;
type Audit_Access is access all Audit_Impl;
overriding
procedure Destroy (Object : access Audit_Impl);
overriding
procedure Find (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Audit_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Audit_Ref'Class;
Impl : out Audit_Access);
EMAIL_NAME : aliased constant String := "audit_email";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "user_email";
COL_2_2_NAME : aliased constant String := "email_status";
EMAIL_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => EMAIL_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access)
);
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= EMAIL_DEF'Access;
EMAIL_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => EMAIL_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
EMAIL_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= EMAIL_AUDIT_DEF'Access;
Null_Email : constant Email_Ref
:= Email_Ref'(ADO.Objects.Object_Ref with null record);
type Email_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => EMAIL_DEF'Access,
With_Audit => EMAIL_AUDIT_DEF'Access)
with record
Email : ADO.Nullable_String;
Status : ADO.Nullable_Integer;
end record;
type Email_Access is access all Email_Impl;
overriding
procedure Destroy (Object : access Email_Impl);
overriding
procedure Find (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Email_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Email_Ref'Class;
Impl : out Email_Access);
PROPERTY_NAME : aliased constant String := "audit_property";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "user_email";
COL_2_3_NAME : aliased constant String := "float_value";
PROPERTY_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => PROPERTY_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access)
);
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROPERTY_DEF'Access;
PROPERTY_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => PROPERTY_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
PROPERTY_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= PROPERTY_AUDIT_DEF'Access;
Null_Property : constant Property_Ref
:= Property_Ref'(ADO.Objects.Object_Ref with null record);
type Property_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_STRING,
Of_Class => PROPERTY_DEF'Access,
With_Audit => PROPERTY_AUDIT_DEF'Access)
with record
Value : ADO.Nullable_Integer;
Float_Value : Float;
end record;
type Property_Access is access all Property_Impl;
overriding
procedure Destroy (Object : access Property_Impl);
overriding
procedure Find (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Property_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Property_Ref'Class;
Impl : out Property_Access);
end Regtests.Audits.Model;
| true |
-----------------------------------------------------------------------
-- Regtests.Audits.Model -- Regtests.Audits.Model
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with ADO.Audits;
pragma Warnings (On);
package Regtests.Audits.Model is
pragma Style_Checks ("-mr");
type Audit_Ref is new ADO.Objects.Object_Ref with null record;
type Email_Ref is new ADO.Objects.Object_Ref with null record;
type Property_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- This is the Audit_Info table
-- --------------------
-- Create an object key for Audit.
function Audit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Audit from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Audit_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Audit : constant Audit_Ref;
function "=" (Left, Right : Audit_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity id
procedure Set_Entity_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier);
-- Get the entity id
function Get_Entity_Id (Object : in Audit_Ref)
return ADO.Identifier;
-- Set the entity type
procedure Set_Entity_Type (Object : in out Audit_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type
function Get_Entity_Type (Object : in Audit_Ref)
return ADO.Entity_Type;
-- Set the old value
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the old value
function Get_Old_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_Old_Value (Object : in Audit_Ref)
return String;
-- Set the new value
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String);
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in String);
-- Get the new value
function Get_New_Value (Object : in Audit_Ref)
return ADO.Nullable_String;
function Get_New_Value (Object : in Audit_Ref)
return String;
-- Set the audit date
procedure Set_Date (Object : in out Audit_Ref;
Value : in Ada.Calendar.Time);
-- Get the audit date
function Get_Date (Object : in Audit_Ref)
return Ada.Calendar.Time;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Audit_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Ref);
-- Copy of the object.
procedure Copy (Object : in Audit_Ref;
Into : in out Audit_Ref);
package Audit_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Audit_Ref,
"=" => "=");
subtype Audit_Vector is Audit_Vectors.Vector;
procedure List (Object : in out Audit_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- This is the User email table
-- --------------------
-- Create an object key for Email.
function Email_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Email from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Email_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Email : constant Email_Ref;
function "=" (Left, Right : Email_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Email_Ref;
Value : in ADO.Identifier);
-- Get null
function Get_Id (Object : in Email_Ref)
return ADO.Identifier;
-- Set the user email address
procedure Set_Email (Object : in out Email_Ref;
Value : in ADO.Nullable_String);
procedure Set_Email (Object : in out Email_Ref;
Value : in String);
-- Get the user email address
function Get_Email (Object : in Email_Ref)
return ADO.Nullable_String;
function Get_Email (Object : in Email_Ref)
return String;
-- Set the user email status
procedure Set_Status (Object : in out Email_Ref;
Value : in ADO.Nullable_Integer);
-- Get the user email status
function Get_Status (Object : in Email_Ref)
return ADO.Nullable_Integer;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Email_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Email_Ref);
-- Copy of the object.
procedure Copy (Object : in Email_Ref;
Into : in out Email_Ref);
-- --------------------
-- This is a generic property
-- --------------------
-- Create an object key for Property.
function Property_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Property from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Property_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Property : constant Property_Ref;
function "=" (Left, Right : Property_Ref'Class) return Boolean;
-- Set null
procedure Set_Id (Object : in out Property_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Id (Object : in out Property_Ref;
Value : in String);
-- Get null
function Get_Id (Object : in Property_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Id (Object : in Property_Ref)
return String;
-- Set the property value
procedure Set_Value (Object : in out Property_Ref;
Value : in ADO.Nullable_Integer);
-- Get the property value
function Get_Value (Object : in Property_Ref)
return ADO.Nullable_Integer;
-- Set a float property value
procedure Set_Float_Value (Object : in out Property_Ref;
Value : in Float);
-- Get a float property value
function Get_Float_Value (Object : in Property_Ref)
return Float;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Property_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Property_Ref);
-- Copy of the object.
procedure Copy (Object : in Property_Ref;
Into : in out Property_Ref);
private
AUDIT_NAME : aliased constant String := "audit_info";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "entity_id";
COL_2_1_NAME : aliased constant String := "entity_type";
COL_3_1_NAME : aliased constant String := "old_value";
COL_4_1_NAME : aliased constant String := "new_value";
COL_5_1_NAME : aliased constant String := "date";
AUDIT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 6,
Table => AUDIT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access)
);
AUDIT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= AUDIT_DEF'Access;
Null_Audit : constant Audit_Ref
:= Audit_Ref'(ADO.Objects.Object_Ref with null record);
type Audit_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access)
with record
Entity_Id : ADO.Identifier;
Entity_Type : ADO.Entity_Type;
Old_Value : ADO.Nullable_String;
New_Value : ADO.Nullable_String;
Date : Ada.Calendar.Time;
end record;
type Audit_Access is access all Audit_Impl;
overriding
procedure Destroy (Object : access Audit_Impl);
overriding
procedure Find (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Audit_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Audit_Ref'Class;
Impl : out Audit_Access);
EMAIL_NAME : aliased constant String := "audit_email";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "user_email";
COL_2_2_NAME : aliased constant String := "email_status";
EMAIL_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => EMAIL_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access)
);
EMAIL_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= EMAIL_DEF'Access;
EMAIL_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => EMAIL_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
EMAIL_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= EMAIL_AUDIT_DEF'Access;
Null_Email : constant Email_Ref
:= Email_Ref'(ADO.Objects.Object_Ref with null record);
type Email_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => EMAIL_DEF'Access,
With_Audit => EMAIL_AUDIT_DEF'Access)
with record
Email : ADO.Nullable_String;
Status : ADO.Nullable_Integer;
end record;
type Email_Access is access all Email_Impl;
overriding
procedure Destroy (Object : access Email_Impl);
overriding
procedure Find (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Email_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Email_Ref'Class;
Impl : out Email_Access);
PROPERTY_NAME : aliased constant String := "audit_property";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "user_email";
COL_2_3_NAME : aliased constant String := "float_value";
PROPERTY_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => PROPERTY_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access)
);
PROPERTY_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROPERTY_DEF'Access;
PROPERTY_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 2,
Of_Class => PROPERTY_DEF'Access,
Members => (
1 => 1,
2 => 2)
);
PROPERTY_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= PROPERTY_AUDIT_DEF'Access;
Null_Property : constant Property_Ref
:= Property_Ref'(ADO.Objects.Object_Ref with null record);
type Property_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_STRING,
Of_Class => PROPERTY_DEF'Access,
With_Audit => PROPERTY_AUDIT_DEF'Access)
with record
Value : ADO.Nullable_Integer;
Float_Value : Float;
end record;
type Property_Access is access all Property_Impl;
overriding
procedure Destroy (Object : access Property_Impl);
overriding
procedure Find (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Property_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Property_Ref'Class;
Impl : out Property_Access);
end Regtests.Audits.Model;
|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2017 onox <[email protected]>\n--\n-- Licensed under the A",
"end": 70,
"score": 0.9992308616638184,
"start": 66,
"tag": "USERNAME",
"value": "onox"
},
{
"context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2017 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 91,
"score": 0.9999241232872009,
"start": 72,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka_plugin_gltf/src/orka-gltf-scenes.adb
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.glTF.Scenes is
function Create_Nodes (Nodes : Types.JSON_Value) return Natural_Vectors.Vector is
Result : Natural_Vectors.Vector;
begin
for Node of Nodes loop
Result.Append (Natural (Long_Integer'(Node.Value)));
end loop;
return Result;
end Create_Nodes;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4
with Pre => Matrix.Length = 16;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4 is
Result : Transforms.Matrix4;
begin
for I in Index_Homogeneous loop
for J in Index_Homogeneous loop
declare
Column : constant Natural := Index_Homogeneous'Pos (I) * 4;
Row : constant Natural := Index_Homogeneous'Pos (J);
begin
Result (I) (J) := Matrix.Get (Column + Row + 1).Value;
end;
end loop;
end loop;
return Result;
end Get_Matrix;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 3;
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 4;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, 0.0));
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, Vector.Get (4).Value));
function Create_Node (Object : Types.JSON_Value) return Node is
Transform : constant Transform_Kind
:= (if Object.Contains ("matrix") then Matrix else TRS);
begin
return Result : Node (Transform) do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Children.Append (Create_Nodes (Object.Get_Array_Or_Empty ("children")));
Result.Mesh := Natural_Optional (Long_Integer'(Object.Get ("mesh", Undefined).Value));
case Transform is
when Matrix =>
Result.Matrix := Get_Matrix (Object.Get ("matrix"));
when TRS =>
if Object.Contains ("translation") then
Result.Translation := Get_Vector3 (Object.Get ("translation"));
end if;
if Object.Contains ("rotation") then
Result.Rotation := Get_Vector4 (Object.Get ("rotation"));
pragma Assert (for all E of Result.Rotation => E in -1.0 .. 1.0);
end if;
if Object.Contains ("scale") then
Result.Scale := Get_Vector3 (Object.Get ("scale"));
end if;
end case;
end return;
end Create_Node;
function Get_Nodes
(Nodes : Types.JSON_Value) return Node_Vectors.Vector
is
Result : Node_Vectors.Vector (Capacity => Nodes.Length);
begin
for Node of Nodes loop
Result.Append (Create_Node (Node));
end loop;
return Result;
end Get_Nodes;
function Create_Scene
(Object : Types.JSON_Value) return Scene is
begin
return Result : Scene do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Nodes.Append (Create_Nodes (Object.Get ("nodes")));
end return;
end Create_Scene;
function Get_Scenes
(Scenes : Types.JSON_Value) return Scene_Vectors.Vector
is
Result : Scene_Vectors.Vector (Capacity => Scenes.Length);
begin
for Scene of Scenes loop
Result.Append (Create_Scene (Scene));
end loop;
return Result;
end Get_Scenes;
end Orka.glTF.Scenes;
|
27035
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.glTF.Scenes is
function Create_Nodes (Nodes : Types.JSON_Value) return Natural_Vectors.Vector is
Result : Natural_Vectors.Vector;
begin
for Node of Nodes loop
Result.Append (Natural (Long_Integer'(Node.Value)));
end loop;
return Result;
end Create_Nodes;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4
with Pre => Matrix.Length = 16;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4 is
Result : Transforms.Matrix4;
begin
for I in Index_Homogeneous loop
for J in Index_Homogeneous loop
declare
Column : constant Natural := Index_Homogeneous'Pos (I) * 4;
Row : constant Natural := Index_Homogeneous'Pos (J);
begin
Result (I) (J) := Matrix.Get (Column + Row + 1).Value;
end;
end loop;
end loop;
return Result;
end Get_Matrix;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 3;
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 4;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, 0.0));
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, Vector.Get (4).Value));
function Create_Node (Object : Types.JSON_Value) return Node is
Transform : constant Transform_Kind
:= (if Object.Contains ("matrix") then Matrix else TRS);
begin
return Result : Node (Transform) do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Children.Append (Create_Nodes (Object.Get_Array_Or_Empty ("children")));
Result.Mesh := Natural_Optional (Long_Integer'(Object.Get ("mesh", Undefined).Value));
case Transform is
when Matrix =>
Result.Matrix := Get_Matrix (Object.Get ("matrix"));
when TRS =>
if Object.Contains ("translation") then
Result.Translation := Get_Vector3 (Object.Get ("translation"));
end if;
if Object.Contains ("rotation") then
Result.Rotation := Get_Vector4 (Object.Get ("rotation"));
pragma Assert (for all E of Result.Rotation => E in -1.0 .. 1.0);
end if;
if Object.Contains ("scale") then
Result.Scale := Get_Vector3 (Object.Get ("scale"));
end if;
end case;
end return;
end Create_Node;
function Get_Nodes
(Nodes : Types.JSON_Value) return Node_Vectors.Vector
is
Result : Node_Vectors.Vector (Capacity => Nodes.Length);
begin
for Node of Nodes loop
Result.Append (Create_Node (Node));
end loop;
return Result;
end Get_Nodes;
function Create_Scene
(Object : Types.JSON_Value) return Scene is
begin
return Result : Scene do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Nodes.Append (Create_Nodes (Object.Get ("nodes")));
end return;
end Create_Scene;
function Get_Scenes
(Scenes : Types.JSON_Value) return Scene_Vectors.Vector
is
Result : Scene_Vectors.Vector (Capacity => Scenes.Length);
begin
for Scene of Scenes loop
Result.Append (Create_Scene (Scene));
end loop;
return Result;
end Get_Scenes;
end Orka.glTF.Scenes;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <PI:EMAIL:<EMAIL>END_PI>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.glTF.Scenes is
function Create_Nodes (Nodes : Types.JSON_Value) return Natural_Vectors.Vector is
Result : Natural_Vectors.Vector;
begin
for Node of Nodes loop
Result.Append (Natural (Long_Integer'(Node.Value)));
end loop;
return Result;
end Create_Nodes;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4
with Pre => Matrix.Length = 16;
function Get_Matrix (Matrix : Types.JSON_Value) return Transforms.Matrix4 is
Result : Transforms.Matrix4;
begin
for I in Index_Homogeneous loop
for J in Index_Homogeneous loop
declare
Column : constant Natural := Index_Homogeneous'Pos (I) * 4;
Row : constant Natural := Index_Homogeneous'Pos (J);
begin
Result (I) (J) := Matrix.Get (Column + Row + 1).Value;
end;
end loop;
end loop;
return Result;
end Get_Matrix;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 3;
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4
with Pre => Vector.Length = 4;
function Get_Vector3 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, 0.0));
function Get_Vector4 (Vector : Types.JSON_Value) return Transforms.Vector4 is
((Vector.Get (1).Value, Vector.Get (2).Value, Vector.Get (3).Value, Vector.Get (4).Value));
function Create_Node (Object : Types.JSON_Value) return Node is
Transform : constant Transform_Kind
:= (if Object.Contains ("matrix") then Matrix else TRS);
begin
return Result : Node (Transform) do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Children.Append (Create_Nodes (Object.Get_Array_Or_Empty ("children")));
Result.Mesh := Natural_Optional (Long_Integer'(Object.Get ("mesh", Undefined).Value));
case Transform is
when Matrix =>
Result.Matrix := Get_Matrix (Object.Get ("matrix"));
when TRS =>
if Object.Contains ("translation") then
Result.Translation := Get_Vector3 (Object.Get ("translation"));
end if;
if Object.Contains ("rotation") then
Result.Rotation := Get_Vector4 (Object.Get ("rotation"));
pragma Assert (for all E of Result.Rotation => E in -1.0 .. 1.0);
end if;
if Object.Contains ("scale") then
Result.Scale := Get_Vector3 (Object.Get ("scale"));
end if;
end case;
end return;
end Create_Node;
function Get_Nodes
(Nodes : Types.JSON_Value) return Node_Vectors.Vector
is
Result : Node_Vectors.Vector (Capacity => Nodes.Length);
begin
for Node of Nodes loop
Result.Append (Create_Node (Node));
end loop;
return Result;
end Get_Nodes;
function Create_Scene
(Object : Types.JSON_Value) return Scene is
begin
return Result : Scene do
Result.Name := Name_Strings.To_Bounded_String (Object.Get ("name").Value);
Result.Nodes.Append (Create_Nodes (Object.Get ("nodes")));
end return;
end Create_Scene;
function Get_Scenes
(Scenes : Types.JSON_Value) return Scene_Vectors.Vector
is
Result : Scene_Vectors.Vector (Capacity => Scenes.Length);
begin
for Scene of Scenes loop
Result.Append (Create_Scene (Scene));
end loop;
return Result;
end Get_Scenes;
end Orka.glTF.Scenes;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.999859094619751,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999305009841919,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/nodes/program-nodes-package_declarations.ads
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Names;
with Program.Elements.Aspect_Specifications;
with Program.Element_Vectors;
with Program.Elements.Expressions;
with Program.Elements.Package_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Package_Declarations is
pragma Preelaborate;
type Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with private;
function Create
(Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Package_Declaration;
type Implicit_Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Package_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Package_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with record
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : in out Base_Package_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Package_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Package_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Aspects
(Self : Base_Package_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Visible_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Private_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function End_Name
(Self : Base_Package_Declaration)
return Program.Elements.Expressions.Expression_Access;
overriding function Is_Package_Declaration
(Self : Base_Package_Declaration)
return Boolean;
overriding function Is_Declaration
(Self : Base_Package_Declaration)
return Boolean;
type Package_Declaration is
new Base_Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with record
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Package_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Private_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Package_Declaration is
new Base_Package_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Implicit_Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Package_Declaration)
return Boolean;
end Program.Nodes.Package_Declarations;
|
12788
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Names;
with Program.Elements.Aspect_Specifications;
with Program.Element_Vectors;
with Program.Elements.Expressions;
with Program.Elements.Package_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Package_Declarations is
pragma Preelaborate;
type Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with private;
function Create
(Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Package_Declaration;
type Implicit_Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Package_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Package_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with record
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : in out Base_Package_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Package_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Package_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Aspects
(Self : Base_Package_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Visible_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Private_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function End_Name
(Self : Base_Package_Declaration)
return Program.Elements.Expressions.Expression_Access;
overriding function Is_Package_Declaration
(Self : Base_Package_Declaration)
return Boolean;
overriding function Is_Declaration
(Self : Base_Package_Declaration)
return Boolean;
type Package_Declaration is
new Base_Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with record
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Package_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Private_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Package_Declaration is
new Base_Package_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Implicit_Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Package_Declaration)
return Boolean;
end Program.Nodes.Package_Declarations;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Names;
with Program.Elements.Aspect_Specifications;
with Program.Element_Vectors;
with Program.Elements.Expressions;
with Program.Elements.Package_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Package_Declarations is
pragma Preelaborate;
type Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with private;
function Create
(Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Package_Declaration;
type Implicit_Package_Declaration is
new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Package_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Package_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Package_Declarations.Package_Declaration
with record
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : in out Base_Package_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Package_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Package_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Aspects
(Self : Base_Package_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Visible_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Private_Declarations
(Self : Base_Package_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function End_Name
(Self : Base_Package_Declaration)
return Program.Elements.Expressions.Expression_Access;
overriding function Is_Package_Declaration
(Self : Base_Package_Declaration)
return Boolean;
overriding function Is_Declaration
(Self : Base_Package_Declaration)
return Boolean;
type Package_Declaration is
new Base_Package_Declaration
and Program.Elements.Package_Declarations.Package_Declaration_Text
with record
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Package_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Private_Token
(Self : Package_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Package_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Package_Declaration is
new Base_Package_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Package_Declaration_Text
(Self : in out Implicit_Package_Declaration)
return Program.Elements.Package_Declarations
.Package_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Package_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Package_Declaration)
return Boolean;
end Program.Nodes.Package_Declarations;
|
[
{
"context": "-- Shoot'n'loot\n-- Copyright (c) 2020 Fabien Chouteau\n\npackage Sound is\n\n procedure Tick;\n\n procedu",
"end": 55,
"score": 0.999825656414032,
"start": 40,
"tag": "NAME",
"value": "Fabien Chouteau"
}
] |
src/sound.ads
|
thomas070605/shoot-n-loot
| 0 |
-- Shoot'n'loot
-- Copyright (c) 2020 Fabien Chouteau
package Sound is
procedure Tick;
procedure Play_Coin;
procedure Play_Monster_Dead;
procedure Play_Gun;
procedure Play_Jump;
procedure Play_Exit_Open;
procedure Play_Exit_Taken;
procedure Play_Gameover;
procedure Play_Victory;
procedure Play_Main_Theme;
procedure Play_Gameplay;
end Sound;
|
20896
|
-- Shoot'n'loot
-- Copyright (c) 2020 <NAME>
package Sound is
procedure Tick;
procedure Play_Coin;
procedure Play_Monster_Dead;
procedure Play_Gun;
procedure Play_Jump;
procedure Play_Exit_Open;
procedure Play_Exit_Taken;
procedure Play_Gameover;
procedure Play_Victory;
procedure Play_Main_Theme;
procedure Play_Gameplay;
end Sound;
| true |
-- Shoot'n'loot
-- Copyright (c) 2020 PI:NAME:<NAME>END_PI
package Sound is
procedure Tick;
procedure Play_Coin;
procedure Play_Monster_Dead;
procedure Play_Gun;
procedure Play_Jump;
procedure Play_Exit_Open;
procedure Play_Exit_Taken;
procedure Play_Gameover;
procedure Play_Victory;
procedure Play_Main_Theme;
procedure Play_Gameplay;
end Sound;
|
[
{
"context": " q_sound.adb\n--*\n--* AUTHOR: Manuel <mgrojo at github>\n--*\n--************************",
"end": 190,
"score": 0.9996687173843384,
"start": 184,
"tag": "NAME",
"value": "Manuel"
},
{
"context": " q_sound.adb\n--*\n--* AUTHOR: Manuel <mgrojo at github>\n--*\n--********************************",
"end": 198,
"score": 0.9993873238563538,
"start": 192,
"tag": "USERNAME",
"value": "mgrojo"
}
] |
src/q_sound.canberra.adb
|
jfuica/bingada
| 4 |
--*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_sound.adb
--*
--* AUTHOR: Manuel <mgrojo at github>
--*
--*****************************************************************************
-- External sound library
--
with Canberra;
with Ada.Directories;
with Ada.Strings.Fixed;
with Gtkada.Intl;
package body Q_Sound is
V_Context : Canberra.Context := Canberra.Create
(Name => "BingAda",
Id => "bingada.lovelace",
Icon => "applications-games");
--==================================================================
procedure P_Play_Number (V_Number : Positive) is
C_Number_Image : constant String := Ada.Strings.Fixed.Trim
(V_Number'Image, Ada.Strings.Left);
C_Path : constant String := "media/";
C_Extension : constant String := ".ogg";
C_Lang_Code_Last : constant := 2;
C_Locale : constant String := Gtkada.Intl.Getlocale;
C_Default_Lang : constant String := "en";
V_Lang : String (1 .. C_Lang_Code_Last) := C_Default_Lang;
V_Sound : Canberra.Sound;
begin
if C_Locale'Length >= C_Lang_Code_Last then
V_Lang := C_Locale (C_Locale'First ..
C_Locale'First + C_Lang_Code_Last - 1);
end if;
if not Ada.Directories.Exists
(C_Path & V_Lang & '/' & C_Number_Image & C_Extension) then
V_Lang := C_Default_Lang;
end if;
V_Context.Play_File
(File_Name => C_Path & V_Lang & '/' & C_Number_Image & C_Extension,
File_Sound => V_Sound,
Kind => Canberra.Music,
Name => "Number");
end P_Play_Number;
--==================================================================
-- Nothing to do in the canberra version
--
procedure P_Clean_Up is null;
end Q_Sound;
|
22884
|
--*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_sound.adb
--*
--* AUTHOR: <NAME> <mgrojo at github>
--*
--*****************************************************************************
-- External sound library
--
with Canberra;
with Ada.Directories;
with Ada.Strings.Fixed;
with Gtkada.Intl;
package body Q_Sound is
V_Context : Canberra.Context := Canberra.Create
(Name => "BingAda",
Id => "bingada.lovelace",
Icon => "applications-games");
--==================================================================
procedure P_Play_Number (V_Number : Positive) is
C_Number_Image : constant String := Ada.Strings.Fixed.Trim
(V_Number'Image, Ada.Strings.Left);
C_Path : constant String := "media/";
C_Extension : constant String := ".ogg";
C_Lang_Code_Last : constant := 2;
C_Locale : constant String := Gtkada.Intl.Getlocale;
C_Default_Lang : constant String := "en";
V_Lang : String (1 .. C_Lang_Code_Last) := C_Default_Lang;
V_Sound : Canberra.Sound;
begin
if C_Locale'Length >= C_Lang_Code_Last then
V_Lang := C_Locale (C_Locale'First ..
C_Locale'First + C_Lang_Code_Last - 1);
end if;
if not Ada.Directories.Exists
(C_Path & V_Lang & '/' & C_Number_Image & C_Extension) then
V_Lang := C_Default_Lang;
end if;
V_Context.Play_File
(File_Name => C_Path & V_Lang & '/' & C_Number_Image & C_Extension,
File_Sound => V_Sound,
Kind => Canberra.Music,
Name => "Number");
end P_Play_Number;
--==================================================================
-- Nothing to do in the canberra version
--
procedure P_Clean_Up is null;
end Q_Sound;
| true |
--*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_sound.adb
--*
--* AUTHOR: PI:NAME:<NAME>END_PI <mgrojo at github>
--*
--*****************************************************************************
-- External sound library
--
with Canberra;
with Ada.Directories;
with Ada.Strings.Fixed;
with Gtkada.Intl;
package body Q_Sound is
V_Context : Canberra.Context := Canberra.Create
(Name => "BingAda",
Id => "bingada.lovelace",
Icon => "applications-games");
--==================================================================
procedure P_Play_Number (V_Number : Positive) is
C_Number_Image : constant String := Ada.Strings.Fixed.Trim
(V_Number'Image, Ada.Strings.Left);
C_Path : constant String := "media/";
C_Extension : constant String := ".ogg";
C_Lang_Code_Last : constant := 2;
C_Locale : constant String := Gtkada.Intl.Getlocale;
C_Default_Lang : constant String := "en";
V_Lang : String (1 .. C_Lang_Code_Last) := C_Default_Lang;
V_Sound : Canberra.Sound;
begin
if C_Locale'Length >= C_Lang_Code_Last then
V_Lang := C_Locale (C_Locale'First ..
C_Locale'First + C_Lang_Code_Last - 1);
end if;
if not Ada.Directories.Exists
(C_Path & V_Lang & '/' & C_Number_Image & C_Extension) then
V_Lang := C_Default_Lang;
end if;
V_Context.Play_File
(File_Name => C_Path & V_Lang & '/' & C_Number_Image & C_Extension,
File_Sound => V_Sound,
Kind => Canberra.Music,
Name => "Number");
end P_Play_Number;
--==================================================================
-- Nothing to do in the canberra version
--
procedure P_Clean_Up is null;
end Q_Sound;
|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <[email protected]>\n--\n-- Licensed under the A",
"end": 70,
"score": 0.9987204670906067,
"start": 66,
"tag": "USERNAME",
"value": "onox"
},
{
"context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 91,
"score": 0.9999250173568726,
"start": 72,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka/src/orka/interface/orka-logging.ads
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Loggers;
with Orka.Transforms.Singles.Vectors;
with Orka.Transforms.Doubles.Vectors;
package Orka.Logging is
pragma Preelaborate;
subtype Source is Loggers.Source;
subtype Message_Type is Loggers.Message_Type;
subtype Severity is Loggers.Severity;
-----------------------------------------------------------------------------
function Image (Value : Duration) return String;
-- Return the image of the given duration with an appropriate suffix
function Image (Value : Orka.Transforms.Singles.Vectors.Vector4) return String;
function Image (Value : Orka.Transforms.Doubles.Vectors.Vector4) return String;
function Trim (Value : String) return String;
-----------------------------------------------------------------------------
procedure Set_Logger (Logger : Loggers.Logger_Ptr);
procedure Log
(From : Source;
Kind : Message_Type;
Level : Severity;
Message : String);
-- Log the message using the logger
--
-- If no logger has been set, it will log the message to the terminal.
generic
From : Source;
package Messages is
procedure Log (Level : Severity; Message : String);
end Messages;
end Orka.Logging;
|
29892
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <<EMAIL>>
--
-- 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.Loggers;
with Orka.Transforms.Singles.Vectors;
with Orka.Transforms.Doubles.Vectors;
package Orka.Logging is
pragma Preelaborate;
subtype Source is Loggers.Source;
subtype Message_Type is Loggers.Message_Type;
subtype Severity is Loggers.Severity;
-----------------------------------------------------------------------------
function Image (Value : Duration) return String;
-- Return the image of the given duration with an appropriate suffix
function Image (Value : Orka.Transforms.Singles.Vectors.Vector4) return String;
function Image (Value : Orka.Transforms.Doubles.Vectors.Vector4) return String;
function Trim (Value : String) return String;
-----------------------------------------------------------------------------
procedure Set_Logger (Logger : Loggers.Logger_Ptr);
procedure Log
(From : Source;
Kind : Message_Type;
Level : Severity;
Message : String);
-- Log the message using the logger
--
-- If no logger has been set, it will log the message to the terminal.
generic
From : Source;
package Messages is
procedure Log (Level : Severity; Message : String);
end Messages;
end Orka.Logging;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <PI:EMAIL:<EMAIL>END_PI>
--
-- 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.Loggers;
with Orka.Transforms.Singles.Vectors;
with Orka.Transforms.Doubles.Vectors;
package Orka.Logging is
pragma Preelaborate;
subtype Source is Loggers.Source;
subtype Message_Type is Loggers.Message_Type;
subtype Severity is Loggers.Severity;
-----------------------------------------------------------------------------
function Image (Value : Duration) return String;
-- Return the image of the given duration with an appropriate suffix
function Image (Value : Orka.Transforms.Singles.Vectors.Vector4) return String;
function Image (Value : Orka.Transforms.Doubles.Vectors.Vector4) return String;
function Trim (Value : String) return String;
-----------------------------------------------------------------------------
procedure Set_Logger (Logger : Loggers.Logger_Ptr);
procedure Log
(From : Source;
Kind : Message_Type;
Level : Severity;
Message : String);
-- Log the message using the logger
--
-- If no logger has been set, it will log the message to the terminal.
generic
From : Source;
package Messages is
procedure Log (Level : Severity; Message : String);
end Messages;
end Orka.Logging;
|
[
{
"context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 35,
"score": 0.9998558759689331,
"start": 23,
"tag": "NAME",
"value": "Maxim Reznik"
},
{
"context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-",
"end": 55,
"score": 0.999930739402771,
"start": 37,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/slim-messages-stat.ads
|
reznikmm/slimp
| 0 |
-- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.STAT is
type STAT_Message is new Message with private;
subtype Event_Kind is String (1 .. 4);
not overriding function Event (Self : STAT_Message) return Event_Kind;
not overriding function WiFi_Level (Self : STAT_Message) return Natural;
not overriding function Elapsed_Seconds
(Self : STAT_Message) return Natural;
private
subtype Byte is Ada.Streams.Stream_Element;
type STAT_Message is new Base_Message
(Max_8 => 4 + 3,
Max_16 => 3,
Max_32 => 8,
Max_64 => 1)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return STAT_Message;
overriding procedure Write
(Self : STAT_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access STAT_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.STAT;
|
16555
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.STAT is
type STAT_Message is new Message with private;
subtype Event_Kind is String (1 .. 4);
not overriding function Event (Self : STAT_Message) return Event_Kind;
not overriding function WiFi_Level (Self : STAT_Message) return Natural;
not overriding function Elapsed_Seconds
(Self : STAT_Message) return Natural;
private
subtype Byte is Ada.Streams.Stream_Element;
type STAT_Message is new Base_Message
(Max_8 => 4 + 3,
Max_16 => 3,
Max_32 => 8,
Max_64 => 1)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return STAT_Message;
overriding procedure Write
(Self : STAT_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access STAT_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.STAT;
| true |
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.STAT is
type STAT_Message is new Message with private;
subtype Event_Kind is String (1 .. 4);
not overriding function Event (Self : STAT_Message) return Event_Kind;
not overriding function WiFi_Level (Self : STAT_Message) return Natural;
not overriding function Elapsed_Seconds
(Self : STAT_Message) return Natural;
private
subtype Byte is Ada.Streams.Stream_Element;
type STAT_Message is new Base_Message
(Max_8 => 4 + 3,
Max_16 => 3,
Max_32 => 8,
Max_64 => 1)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return STAT_Message;
overriding procedure Write
(Self : STAT_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access STAT_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.STAT;
|
[
{
"context": "01, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 223,
"score": 0.9998825788497925,
"start": 208,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "9, 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 254,
"score": 0.9998868703842163,
"start": 239,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "2 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 281,
"score": 0.9999300837516785,
"start": 256,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/util-properties-bundles.ads
|
Letractively/ada-util
| 0 |
-----------------------------------------------------------------------
-- properties-bundles -- Generic name/value property management
-- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers;
with Ada.Finalization;
with Ada.Containers.Hashed_Maps;
with Util.Strings;
with Util.Concurrent.Locks;
package Util.Properties.Bundles is
NO_BUNDLE : exception;
NOT_WRITEABLE : exception;
type Manager is new Util.Properties.Manager with private;
-- ------------------------------
-- Bundle loader
-- ------------------------------
-- The <b>Loader</b> provides facilities for loading property bundles
-- and maintains a cache of bundles. The cache is thread-safe but the returned
-- bundles are not thread-safe.
type Loader is limited private;
type Loader_Access is access all Loader;
-- Initialize the bundle factory and specify where the property files are stored.
procedure Initialize (Factory : in out Loader;
Path : in String);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class);
private
procedure Add_Bundle (Self : in out Manager; Props : in Manager_Access);
-- Add a bundle
type Bundle_Manager_Access is access all Manager'Class;
type Manager is new Util.Properties.Manager with null record;
overriding
procedure Initialize (Object : in out Manager);
overriding
procedure Adjust (Object : in out Manager);
package Bundle_Map is
new Ada.Containers.Hashed_Maps
(Element_Type => Bundle_Manager_Access,
Key_Type => Util.Strings.Name_Access,
Hash => Util.Strings.Hash,
Equivalent_Keys => Util.Strings.Equivalent_Keys);
type Loader is new Ada.Finalization.Limited_Controlled with record
Lock : Util.Concurrent.Locks.RW_Lock;
Bundles : Bundle_Map.Map;
Path : Unbounded_String;
end record;
-- Finalize the bundle loader and clear the cache
overriding
procedure Finalize (Factory : in out Loader);
-- Clear the cache bundle
procedure Clear_Cache (Factory : in out Loader);
-- Find the bundle with the given name and for the given locale name.
procedure Find_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class;
Found : out Boolean);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Found : out Boolean);
end Util.Properties.Bundles;
|
3799
|
-----------------------------------------------------------------------
-- properties-bundles -- Generic name/value property management
-- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.Containers;
with Ada.Finalization;
with Ada.Containers.Hashed_Maps;
with Util.Strings;
with Util.Concurrent.Locks;
package Util.Properties.Bundles is
NO_BUNDLE : exception;
NOT_WRITEABLE : exception;
type Manager is new Util.Properties.Manager with private;
-- ------------------------------
-- Bundle loader
-- ------------------------------
-- The <b>Loader</b> provides facilities for loading property bundles
-- and maintains a cache of bundles. The cache is thread-safe but the returned
-- bundles are not thread-safe.
type Loader is limited private;
type Loader_Access is access all Loader;
-- Initialize the bundle factory and specify where the property files are stored.
procedure Initialize (Factory : in out Loader;
Path : in String);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class);
private
procedure Add_Bundle (Self : in out Manager; Props : in Manager_Access);
-- Add a bundle
type Bundle_Manager_Access is access all Manager'Class;
type Manager is new Util.Properties.Manager with null record;
overriding
procedure Initialize (Object : in out Manager);
overriding
procedure Adjust (Object : in out Manager);
package Bundle_Map is
new Ada.Containers.Hashed_Maps
(Element_Type => Bundle_Manager_Access,
Key_Type => Util.Strings.Name_Access,
Hash => Util.Strings.Hash,
Equivalent_Keys => Util.Strings.Equivalent_Keys);
type Loader is new Ada.Finalization.Limited_Controlled with record
Lock : Util.Concurrent.Locks.RW_Lock;
Bundles : Bundle_Map.Map;
Path : Unbounded_String;
end record;
-- Finalize the bundle loader and clear the cache
overriding
procedure Finalize (Factory : in out Loader);
-- Clear the cache bundle
procedure Clear_Cache (Factory : in out Loader);
-- Find the bundle with the given name and for the given locale name.
procedure Find_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class;
Found : out Boolean);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Found : out Boolean);
end Util.Properties.Bundles;
| true |
-----------------------------------------------------------------------
-- properties-bundles -- Generic name/value property management
-- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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.Containers;
with Ada.Finalization;
with Ada.Containers.Hashed_Maps;
with Util.Strings;
with Util.Concurrent.Locks;
package Util.Properties.Bundles is
NO_BUNDLE : exception;
NOT_WRITEABLE : exception;
type Manager is new Util.Properties.Manager with private;
-- ------------------------------
-- Bundle loader
-- ------------------------------
-- The <b>Loader</b> provides facilities for loading property bundles
-- and maintains a cache of bundles. The cache is thread-safe but the returned
-- bundles are not thread-safe.
type Loader is limited private;
type Loader_Access is access all Loader;
-- Initialize the bundle factory and specify where the property files are stored.
procedure Initialize (Factory : in out Loader;
Path : in String);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class);
private
procedure Add_Bundle (Self : in out Manager; Props : in Manager_Access);
-- Add a bundle
type Bundle_Manager_Access is access all Manager'Class;
type Manager is new Util.Properties.Manager with null record;
overriding
procedure Initialize (Object : in out Manager);
overriding
procedure Adjust (Object : in out Manager);
package Bundle_Map is
new Ada.Containers.Hashed_Maps
(Element_Type => Bundle_Manager_Access,
Key_Type => Util.Strings.Name_Access,
Hash => Util.Strings.Hash,
Equivalent_Keys => Util.Strings.Equivalent_Keys);
type Loader is new Ada.Finalization.Limited_Controlled with record
Lock : Util.Concurrent.Locks.RW_Lock;
Bundles : Bundle_Map.Map;
Path : Unbounded_String;
end record;
-- Finalize the bundle loader and clear the cache
overriding
procedure Finalize (Factory : in out Loader);
-- Clear the cache bundle
procedure Clear_Cache (Factory : in out Loader);
-- Find the bundle with the given name and for the given locale name.
procedure Find_Bundle (Factory : in out Loader;
Name : in String;
Locale : in String;
Bundle : out Manager'Class;
Found : out Boolean);
-- Load the bundle with the given name and for the given locale name.
procedure Load_Bundle (Factory : in out Loader;
Name : in String;
Found : out Boolean);
end Util.Properties.Bundles;
|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2015 onox <[email protected]>\n--\n-- Licensed under the A",
"end": 70,
"score": 0.9989218711853027,
"start": 66,
"tag": "USERNAME",
"value": "onox"
},
{
"context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2015 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 91,
"score": 0.9999246597290039,
"start": 72,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka/src/orka/implementation/orka-rendering-programs.adb
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2015 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Objects.Buffers;
with Orka.Rendering.Programs.Modules;
with Orka.Rendering.Programs.Uniforms;
package body Orka.Rendering.Programs is
function Create_Program (Modules : Programs.Modules.Module_Array;
Separable : Boolean := False) return Program is
use type GL.Types.Int;
begin
return Result : Program do
Result.GL_Program.Set_Separable (Separable);
-- Attach all shaders to the program before linking
Programs.Modules.Attach_Shaders (Modules, Result);
Result.GL_Program.Link;
Programs.Modules.Detach_Shaders (Modules, Result);
if not Result.GL_Program.Link_Status then
raise Program_Link_Error with Result.GL_Program.Info_Log;
end if;
end return;
end Create_Program;
function Create_Program (Module : Programs.Modules.Module;
Separable : Boolean := False) return Program is
begin
return Create_Program (Modules.Module_Array'(1 => Module), Separable);
end Create_Program;
procedure Use_Program (Object : in out Program) is
begin
Object.GL_Program.Use_Program;
end Use_Program;
function Compute_Work_Group_Size
(Object : Program) return GL.Types.Compute.Dimension_Size_Array
is (Object.GL_Program.Compute_Work_Group_Size);
function Uniform_Sampler (Object : Program; Name : String)
return Uniforms.Uniform_Sampler is
begin
return Uniforms.Create_Uniform_Sampler (Object, Name);
end Uniform_Sampler;
function Uniform_Image (Object : Program; Name : String)
return Uniforms.Uniform_Image is
begin
return Uniforms.Create_Uniform_Image (Object, Name);
end Uniform_Image;
function Uniform (Object : Program; Name : String)
return Uniforms.Uniform is
begin
return Uniforms.Create_Uniform_Variable (Object, Name);
end Uniform;
function Binding
(Object : Program;
Target : Buffers.Indexed_Buffer_Target;
Name : String) return Natural
is
use all type Buffers.Indexed_Buffer_Target;
begin
return Natural (Object.GL_Program.Buffer_Binding
((case Target is
when Uniform => GL.Objects.Buffers.Uniform,
when Shader_Storage => GL.Objects.Buffers.Shader_Storage,
when Atomic_Counter => GL.Objects.Buffers.Atomic_Counter),
Name));
end Binding;
end Orka.Rendering.Programs;
|
15003
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2015 onox <<EMAIL>>
--
-- 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 GL.Objects.Buffers;
with Orka.Rendering.Programs.Modules;
with Orka.Rendering.Programs.Uniforms;
package body Orka.Rendering.Programs is
function Create_Program (Modules : Programs.Modules.Module_Array;
Separable : Boolean := False) return Program is
use type GL.Types.Int;
begin
return Result : Program do
Result.GL_Program.Set_Separable (Separable);
-- Attach all shaders to the program before linking
Programs.Modules.Attach_Shaders (Modules, Result);
Result.GL_Program.Link;
Programs.Modules.Detach_Shaders (Modules, Result);
if not Result.GL_Program.Link_Status then
raise Program_Link_Error with Result.GL_Program.Info_Log;
end if;
end return;
end Create_Program;
function Create_Program (Module : Programs.Modules.Module;
Separable : Boolean := False) return Program is
begin
return Create_Program (Modules.Module_Array'(1 => Module), Separable);
end Create_Program;
procedure Use_Program (Object : in out Program) is
begin
Object.GL_Program.Use_Program;
end Use_Program;
function Compute_Work_Group_Size
(Object : Program) return GL.Types.Compute.Dimension_Size_Array
is (Object.GL_Program.Compute_Work_Group_Size);
function Uniform_Sampler (Object : Program; Name : String)
return Uniforms.Uniform_Sampler is
begin
return Uniforms.Create_Uniform_Sampler (Object, Name);
end Uniform_Sampler;
function Uniform_Image (Object : Program; Name : String)
return Uniforms.Uniform_Image is
begin
return Uniforms.Create_Uniform_Image (Object, Name);
end Uniform_Image;
function Uniform (Object : Program; Name : String)
return Uniforms.Uniform is
begin
return Uniforms.Create_Uniform_Variable (Object, Name);
end Uniform;
function Binding
(Object : Program;
Target : Buffers.Indexed_Buffer_Target;
Name : String) return Natural
is
use all type Buffers.Indexed_Buffer_Target;
begin
return Natural (Object.GL_Program.Buffer_Binding
((case Target is
when Uniform => GL.Objects.Buffers.Uniform,
when Shader_Storage => GL.Objects.Buffers.Shader_Storage,
when Atomic_Counter => GL.Objects.Buffers.Atomic_Counter),
Name));
end Binding;
end Orka.Rendering.Programs;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2015 onox <PI:EMAIL:<EMAIL>END_PI>
--
-- 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 GL.Objects.Buffers;
with Orka.Rendering.Programs.Modules;
with Orka.Rendering.Programs.Uniforms;
package body Orka.Rendering.Programs is
function Create_Program (Modules : Programs.Modules.Module_Array;
Separable : Boolean := False) return Program is
use type GL.Types.Int;
begin
return Result : Program do
Result.GL_Program.Set_Separable (Separable);
-- Attach all shaders to the program before linking
Programs.Modules.Attach_Shaders (Modules, Result);
Result.GL_Program.Link;
Programs.Modules.Detach_Shaders (Modules, Result);
if not Result.GL_Program.Link_Status then
raise Program_Link_Error with Result.GL_Program.Info_Log;
end if;
end return;
end Create_Program;
function Create_Program (Module : Programs.Modules.Module;
Separable : Boolean := False) return Program is
begin
return Create_Program (Modules.Module_Array'(1 => Module), Separable);
end Create_Program;
procedure Use_Program (Object : in out Program) is
begin
Object.GL_Program.Use_Program;
end Use_Program;
function Compute_Work_Group_Size
(Object : Program) return GL.Types.Compute.Dimension_Size_Array
is (Object.GL_Program.Compute_Work_Group_Size);
function Uniform_Sampler (Object : Program; Name : String)
return Uniforms.Uniform_Sampler is
begin
return Uniforms.Create_Uniform_Sampler (Object, Name);
end Uniform_Sampler;
function Uniform_Image (Object : Program; Name : String)
return Uniforms.Uniform_Image is
begin
return Uniforms.Create_Uniform_Image (Object, Name);
end Uniform_Image;
function Uniform (Object : Program; Name : String)
return Uniforms.Uniform is
begin
return Uniforms.Create_Uniform_Variable (Object, Name);
end Uniform;
function Binding
(Object : Program;
Target : Buffers.Indexed_Buffer_Target;
Name : String) return Natural
is
use all type Buffers.Indexed_Buffer_Target;
begin
return Natural (Object.GL_Program.Buffer_Binding
((case Target is
when Uniform => GL.Objects.Buffers.Uniform,
when Shader_Storage => GL.Objects.Buffers.Shader_Storage,
when Atomic_Counter => GL.Objects.Buffers.Atomic_Counter),
Name));
end Binding;
end Orka.Rendering.Programs;
|
[
{
"context": " --\n-- * Richard Wai (ANNEXI-STRAYLINE) ",
"end": 1044,
"score": 0.9997677803039551,
"start": 1033,
"tag": "NAME",
"value": "Richard Wai"
}
] |
configuration-step_3b.adb
|
annexi-strayline/AURA
| 13 |
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Streams;
with Ada.Directories;
with Ada.Strings.Bounded;
with Ada.Characters.Conversions;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Platform_Info;
with Child_Processes;
with Child_Processes.Path_Searching;
with Child_Processes.Wait_And_Buffer;
separate (Configuration)
procedure Step_3b (Target: in out Subsystem) is
package ACC renames Ada.Characters.Conversions;
package UTF_8 renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
package Subsystems renames Registrar.Subsystems;
Config_Package_Name: constant Wide_Wide_String
:= Config_Unit_Name (Target).To_String;
Config_Build_Root: constant String := "./.aura/cfg_tmp"
& '/' & ACC.To_String (Target.Name.To_String);
package Program_Paths renames Child_Processes.Path_Searching;
GNAT_Make_Program: aliased constant String := "gnatmake";
GNAT_Make: constant Program_Paths.Elaboration_Path_Search
:= Program_Paths.Initialize (GNAT_Make_Program);
-- Note that this is for the native gnatmake, not the target gnatmake.
-- We are using it to compile the generated extraction program that
-- retrieves the configuration values from the AURA package configuration,
-- hence we don't append the Toolchain_Prefix.
--
-- Obviously this is GNAT-specific, one day it might make sense to
-- hand-write an internal compile-bind-link subprogram to make AURA more
-- portable
-- Wait_And_Buffer instantiation
package Output_Buffers is
new Ada.Strings.Bounded.Generic_Bounded_Length (2048);
procedure Buffer_Append (Buffer: in out Output_Buffers.Bounded_String;
Item : in String)
is begin
Output_Buffers.Append (Source => Buffer, New_Item => Item);
end Buffer_Append;
procedure Wait_And_Buffer is new Child_Processes.Wait_And_Buffer
(Buffer_Type => Output_Buffers.Bounded_String,
Append => Buffer_Append,
Empty_Buffer => Output_Buffers.Null_Bounded_String);
-- These are to catch errors in the compilation process, mostly
package TIO renames Ada.Text_IO;
Out_File: TIO.File_Type;
Tab: constant String := (1 .. 4 => ' ');
procedure NL (File : in TIO.File_Type := Out_File;
Spacing: in TIO.Positive_Count := 1)
renames TIO.New_Line;
procedure Put (Item: in String;
File: in TIO.File_Type := Out_File)
is begin
TIO.Put (File, Item);
end Put;
procedure Gen_Loader (Package_Name: Wide_Wide_String;
Configs : Subsystems.Configuration_Vector)
is
-- String'Output (STDOUT, AURA.Subsystem.Package_Name.Element);
Target_Prefix: constant String
:= UTF_8.Encode (Config_Package_Name & '.' & Package_Name);
begin
for Item of Configs loop
Put (Tab & "String'Output (STDOUT, " & Target_Prefix & '.'
& UTF_8.Encode (WWU.To_Wide_Wide_String (Item.Name))
& ");");
NL;
end loop;
NL;
end Gen_Loader;
procedure Load
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Configs: in out Subsystems.Configuration_Vector)
is
use Subsystems.Configuration_Vectors;
begin
for Item of Configs loop
Item.Value := UBS.To_Unbounded_String (String'Input (Stream));
end loop;
-- Now remove any items with an empty value, start from the "bottom up"
-- to try to make it a little more efficient
for I in reverse Configs.First_Index .. Configs.Last_Index loop
if UBS.Length (Configs(I).Value) = 0 then
Configs.Delete (I);
end if;
end loop;
end Load;
begin
declare
use Ada.Directories;
begin
if Exists (Config_Build_Root) then
Delete_Tree (Config_Build_Root);
end if;
Create_Path (Config_Build_Root);
end;
-- Phase one: generate the extraction program
TIO.Create (File => Out_File,
Mode => TIO.Out_File,
Name => Config_Build_Root & '/' & "extract.adb");
Put ("with " & UTF_8.Encode (Config_Package_Name) & ';'); NL;
Put ("with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;"); NL;
NL;
Put ("procedure Extract is"); NL;
Put (Tab & "STDOUT: constant Stream_Access ");
Put (":= Stream (Ada.Text_IO.Standard_Output);"); NL;
Put ("begin"); NL;
NL;
Gen_Loader ("build.external_libraries",
Target.Configuration.External_Libraries);
Gen_Loader ("build.ada.compiler_options",
Target.Configuration.Ada_Compiler_Opts);
Gen_Loader ("build.c.compiler_options",
Target.Configuration.C_Compiler_Opts);
Gen_Loader ("build.c.preprocessor_definitions",
Target.Configuration.C_Definitions);
Gen_Loader ("codepaths",
Target.Configuration.Codepaths);
Gen_Loader ("information",
Target.Configuration.Information);
Put ("end Extract;"); NL;
TIO.Close (Out_File);
-- Phase two: compile the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDOUT, STDERR: Bounded_String;
Compiler: Child_Process'Class := Spawn_Process
(Image_Path => Program_Paths.Image_Path (GNAT_Make),
Arguments => "-I../../../ extract.adb",
Working_Directory => Config_Build_Root);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Wait_And_Buffer (Process => Compiler,
Poll_Rate => 0.1,
Timeout => 120.0,
Output => STDOUT,
Error => STDERR,
Timed_Out => Timed_Out,
Status => Status);
Assert (Check => not Timed_Out and then Status = Success,
Message => New_Line
& "Compilation of the configuration extraction "
& "program failed" & (if Timed_Out then
"(Timed out)"
else
"")
& ':' & New_Line
& To_String (STDERR));
end;
-- Phase three: run the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDERR_Buffer: Bounded_String;
Extractor: Child_Process'Class := Spawn_Process
(Image_Path => Config_Build_Root & "/extract",
Arguments => "",
Working_Directory => Ada.Directories.Current_Directory);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Extractor.Set_Stream_Timeout (Selector => Standard_Output,
Timeout => 30.0);
declare
STDOUT: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Output);
begin
Load (STDOUT, Target.Configuration.External_Libraries);
Load (STDOUT, Target.Configuration.Ada_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Definitions );
Load (STDOUT, Target.Configuration.Codepaths );
Load (STDOUT, Target.Configuration.Information );
end;
Extractor.Wait_Terminated (Timeout => 10.0,
Timed_Out => Timed_Out,
Status => Status);
if Timed_Out then
raise Ada.Assertions.Assertion_Error with
"Extractor program timed-out";
elsif Status /= Success then
-- Attempt to flush STDERR
declare
STDERR: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Error);
C: Character;
begin
loop
Character'Read (STDERR, C);
Append (Source => STDERR_Buffer,
New_Item => C);
end loop;
exception
when others => null;
end;
raise Ada.Assertions.Assertion_Error with
"Extractor program failed:" & New_Line
& To_String (STDERR_Buffer);
end if;
end;
Step_4 (Target);
end Step_3b;
|
30647
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Streams;
with Ada.Directories;
with Ada.Strings.Bounded;
with Ada.Characters.Conversions;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Platform_Info;
with Child_Processes;
with Child_Processes.Path_Searching;
with Child_Processes.Wait_And_Buffer;
separate (Configuration)
procedure Step_3b (Target: in out Subsystem) is
package ACC renames Ada.Characters.Conversions;
package UTF_8 renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
package Subsystems renames Registrar.Subsystems;
Config_Package_Name: constant Wide_Wide_String
:= Config_Unit_Name (Target).To_String;
Config_Build_Root: constant String := "./.aura/cfg_tmp"
& '/' & ACC.To_String (Target.Name.To_String);
package Program_Paths renames Child_Processes.Path_Searching;
GNAT_Make_Program: aliased constant String := "gnatmake";
GNAT_Make: constant Program_Paths.Elaboration_Path_Search
:= Program_Paths.Initialize (GNAT_Make_Program);
-- Note that this is for the native gnatmake, not the target gnatmake.
-- We are using it to compile the generated extraction program that
-- retrieves the configuration values from the AURA package configuration,
-- hence we don't append the Toolchain_Prefix.
--
-- Obviously this is GNAT-specific, one day it might make sense to
-- hand-write an internal compile-bind-link subprogram to make AURA more
-- portable
-- Wait_And_Buffer instantiation
package Output_Buffers is
new Ada.Strings.Bounded.Generic_Bounded_Length (2048);
procedure Buffer_Append (Buffer: in out Output_Buffers.Bounded_String;
Item : in String)
is begin
Output_Buffers.Append (Source => Buffer, New_Item => Item);
end Buffer_Append;
procedure Wait_And_Buffer is new Child_Processes.Wait_And_Buffer
(Buffer_Type => Output_Buffers.Bounded_String,
Append => Buffer_Append,
Empty_Buffer => Output_Buffers.Null_Bounded_String);
-- These are to catch errors in the compilation process, mostly
package TIO renames Ada.Text_IO;
Out_File: TIO.File_Type;
Tab: constant String := (1 .. 4 => ' ');
procedure NL (File : in TIO.File_Type := Out_File;
Spacing: in TIO.Positive_Count := 1)
renames TIO.New_Line;
procedure Put (Item: in String;
File: in TIO.File_Type := Out_File)
is begin
TIO.Put (File, Item);
end Put;
procedure Gen_Loader (Package_Name: Wide_Wide_String;
Configs : Subsystems.Configuration_Vector)
is
-- String'Output (STDOUT, AURA.Subsystem.Package_Name.Element);
Target_Prefix: constant String
:= UTF_8.Encode (Config_Package_Name & '.' & Package_Name);
begin
for Item of Configs loop
Put (Tab & "String'Output (STDOUT, " & Target_Prefix & '.'
& UTF_8.Encode (WWU.To_Wide_Wide_String (Item.Name))
& ");");
NL;
end loop;
NL;
end Gen_Loader;
procedure Load
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Configs: in out Subsystems.Configuration_Vector)
is
use Subsystems.Configuration_Vectors;
begin
for Item of Configs loop
Item.Value := UBS.To_Unbounded_String (String'Input (Stream));
end loop;
-- Now remove any items with an empty value, start from the "bottom up"
-- to try to make it a little more efficient
for I in reverse Configs.First_Index .. Configs.Last_Index loop
if UBS.Length (Configs(I).Value) = 0 then
Configs.Delete (I);
end if;
end loop;
end Load;
begin
declare
use Ada.Directories;
begin
if Exists (Config_Build_Root) then
Delete_Tree (Config_Build_Root);
end if;
Create_Path (Config_Build_Root);
end;
-- Phase one: generate the extraction program
TIO.Create (File => Out_File,
Mode => TIO.Out_File,
Name => Config_Build_Root & '/' & "extract.adb");
Put ("with " & UTF_8.Encode (Config_Package_Name) & ';'); NL;
Put ("with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;"); NL;
NL;
Put ("procedure Extract is"); NL;
Put (Tab & "STDOUT: constant Stream_Access ");
Put (":= Stream (Ada.Text_IO.Standard_Output);"); NL;
Put ("begin"); NL;
NL;
Gen_Loader ("build.external_libraries",
Target.Configuration.External_Libraries);
Gen_Loader ("build.ada.compiler_options",
Target.Configuration.Ada_Compiler_Opts);
Gen_Loader ("build.c.compiler_options",
Target.Configuration.C_Compiler_Opts);
Gen_Loader ("build.c.preprocessor_definitions",
Target.Configuration.C_Definitions);
Gen_Loader ("codepaths",
Target.Configuration.Codepaths);
Gen_Loader ("information",
Target.Configuration.Information);
Put ("end Extract;"); NL;
TIO.Close (Out_File);
-- Phase two: compile the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDOUT, STDERR: Bounded_String;
Compiler: Child_Process'Class := Spawn_Process
(Image_Path => Program_Paths.Image_Path (GNAT_Make),
Arguments => "-I../../../ extract.adb",
Working_Directory => Config_Build_Root);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Wait_And_Buffer (Process => Compiler,
Poll_Rate => 0.1,
Timeout => 120.0,
Output => STDOUT,
Error => STDERR,
Timed_Out => Timed_Out,
Status => Status);
Assert (Check => not Timed_Out and then Status = Success,
Message => New_Line
& "Compilation of the configuration extraction "
& "program failed" & (if Timed_Out then
"(Timed out)"
else
"")
& ':' & New_Line
& To_String (STDERR));
end;
-- Phase three: run the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDERR_Buffer: Bounded_String;
Extractor: Child_Process'Class := Spawn_Process
(Image_Path => Config_Build_Root & "/extract",
Arguments => "",
Working_Directory => Ada.Directories.Current_Directory);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Extractor.Set_Stream_Timeout (Selector => Standard_Output,
Timeout => 30.0);
declare
STDOUT: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Output);
begin
Load (STDOUT, Target.Configuration.External_Libraries);
Load (STDOUT, Target.Configuration.Ada_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Definitions );
Load (STDOUT, Target.Configuration.Codepaths );
Load (STDOUT, Target.Configuration.Information );
end;
Extractor.Wait_Terminated (Timeout => 10.0,
Timed_Out => Timed_Out,
Status => Status);
if Timed_Out then
raise Ada.Assertions.Assertion_Error with
"Extractor program timed-out";
elsif Status /= Success then
-- Attempt to flush STDERR
declare
STDERR: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Error);
C: Character;
begin
loop
Character'Read (STDERR, C);
Append (Source => STDERR_Buffer,
New_Item => C);
end loop;
exception
when others => null;
end;
raise Ada.Assertions.Assertion_Error with
"Extractor program failed:" & New_Line
& To_String (STDERR_Buffer);
end if;
end;
Step_4 (Target);
end Step_3b;
| true |
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * PI:NAME:<NAME>END_PI (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Streams;
with Ada.Directories;
with Ada.Strings.Bounded;
with Ada.Characters.Conversions;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Platform_Info;
with Child_Processes;
with Child_Processes.Path_Searching;
with Child_Processes.Wait_And_Buffer;
separate (Configuration)
procedure Step_3b (Target: in out Subsystem) is
package ACC renames Ada.Characters.Conversions;
package UTF_8 renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
package Subsystems renames Registrar.Subsystems;
Config_Package_Name: constant Wide_Wide_String
:= Config_Unit_Name (Target).To_String;
Config_Build_Root: constant String := "./.aura/cfg_tmp"
& '/' & ACC.To_String (Target.Name.To_String);
package Program_Paths renames Child_Processes.Path_Searching;
GNAT_Make_Program: aliased constant String := "gnatmake";
GNAT_Make: constant Program_Paths.Elaboration_Path_Search
:= Program_Paths.Initialize (GNAT_Make_Program);
-- Note that this is for the native gnatmake, not the target gnatmake.
-- We are using it to compile the generated extraction program that
-- retrieves the configuration values from the AURA package configuration,
-- hence we don't append the Toolchain_Prefix.
--
-- Obviously this is GNAT-specific, one day it might make sense to
-- hand-write an internal compile-bind-link subprogram to make AURA more
-- portable
-- Wait_And_Buffer instantiation
package Output_Buffers is
new Ada.Strings.Bounded.Generic_Bounded_Length (2048);
procedure Buffer_Append (Buffer: in out Output_Buffers.Bounded_String;
Item : in String)
is begin
Output_Buffers.Append (Source => Buffer, New_Item => Item);
end Buffer_Append;
procedure Wait_And_Buffer is new Child_Processes.Wait_And_Buffer
(Buffer_Type => Output_Buffers.Bounded_String,
Append => Buffer_Append,
Empty_Buffer => Output_Buffers.Null_Bounded_String);
-- These are to catch errors in the compilation process, mostly
package TIO renames Ada.Text_IO;
Out_File: TIO.File_Type;
Tab: constant String := (1 .. 4 => ' ');
procedure NL (File : in TIO.File_Type := Out_File;
Spacing: in TIO.Positive_Count := 1)
renames TIO.New_Line;
procedure Put (Item: in String;
File: in TIO.File_Type := Out_File)
is begin
TIO.Put (File, Item);
end Put;
procedure Gen_Loader (Package_Name: Wide_Wide_String;
Configs : Subsystems.Configuration_Vector)
is
-- String'Output (STDOUT, AURA.Subsystem.Package_Name.Element);
Target_Prefix: constant String
:= UTF_8.Encode (Config_Package_Name & '.' & Package_Name);
begin
for Item of Configs loop
Put (Tab & "String'Output (STDOUT, " & Target_Prefix & '.'
& UTF_8.Encode (WWU.To_Wide_Wide_String (Item.Name))
& ");");
NL;
end loop;
NL;
end Gen_Loader;
procedure Load
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Configs: in out Subsystems.Configuration_Vector)
is
use Subsystems.Configuration_Vectors;
begin
for Item of Configs loop
Item.Value := UBS.To_Unbounded_String (String'Input (Stream));
end loop;
-- Now remove any items with an empty value, start from the "bottom up"
-- to try to make it a little more efficient
for I in reverse Configs.First_Index .. Configs.Last_Index loop
if UBS.Length (Configs(I).Value) = 0 then
Configs.Delete (I);
end if;
end loop;
end Load;
begin
declare
use Ada.Directories;
begin
if Exists (Config_Build_Root) then
Delete_Tree (Config_Build_Root);
end if;
Create_Path (Config_Build_Root);
end;
-- Phase one: generate the extraction program
TIO.Create (File => Out_File,
Mode => TIO.Out_File,
Name => Config_Build_Root & '/' & "extract.adb");
Put ("with " & UTF_8.Encode (Config_Package_Name) & ';'); NL;
Put ("with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;"); NL;
NL;
Put ("procedure Extract is"); NL;
Put (Tab & "STDOUT: constant Stream_Access ");
Put (":= Stream (Ada.Text_IO.Standard_Output);"); NL;
Put ("begin"); NL;
NL;
Gen_Loader ("build.external_libraries",
Target.Configuration.External_Libraries);
Gen_Loader ("build.ada.compiler_options",
Target.Configuration.Ada_Compiler_Opts);
Gen_Loader ("build.c.compiler_options",
Target.Configuration.C_Compiler_Opts);
Gen_Loader ("build.c.preprocessor_definitions",
Target.Configuration.C_Definitions);
Gen_Loader ("codepaths",
Target.Configuration.Codepaths);
Gen_Loader ("information",
Target.Configuration.Information);
Put ("end Extract;"); NL;
TIO.Close (Out_File);
-- Phase two: compile the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDOUT, STDERR: Bounded_String;
Compiler: Child_Process'Class := Spawn_Process
(Image_Path => Program_Paths.Image_Path (GNAT_Make),
Arguments => "-I../../../ extract.adb",
Working_Directory => Config_Build_Root);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Wait_And_Buffer (Process => Compiler,
Poll_Rate => 0.1,
Timeout => 120.0,
Output => STDOUT,
Error => STDERR,
Timed_Out => Timed_Out,
Status => Status);
Assert (Check => not Timed_Out and then Status = Success,
Message => New_Line
& "Compilation of the configuration extraction "
& "program failed" & (if Timed_Out then
"(Timed out)"
else
"")
& ':' & New_Line
& To_String (STDERR));
end;
-- Phase three: run the extraction program
declare
use Child_Processes;
use Output_Buffers;
STDERR_Buffer: Bounded_String;
Extractor: Child_Process'Class := Spawn_Process
(Image_Path => Config_Build_Root & "/extract",
Arguments => "",
Working_Directory => Ada.Directories.Current_Directory);
Timed_Out: Boolean;
Status : Exit_Status;
begin
Extractor.Set_Stream_Timeout (Selector => Standard_Output,
Timeout => 30.0);
declare
STDOUT: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Output);
begin
Load (STDOUT, Target.Configuration.External_Libraries);
Load (STDOUT, Target.Configuration.Ada_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Compiler_Opts );
Load (STDOUT, Target.Configuration.C_Definitions );
Load (STDOUT, Target.Configuration.Codepaths );
Load (STDOUT, Target.Configuration.Information );
end;
Extractor.Wait_Terminated (Timeout => 10.0,
Timed_Out => Timed_Out,
Status => Status);
if Timed_Out then
raise Ada.Assertions.Assertion_Error with
"Extractor program timed-out";
elsif Status /= Success then
-- Attempt to flush STDERR
declare
STDERR: constant not null access Ada.Streams.Root_Stream_Type'Class
:= Extractor.IO_Stream (Standard_Error);
C: Character;
begin
loop
Character'Read (STDERR, C);
Append (Source => STDERR_Buffer,
New_Item => C);
end loop;
exception
when others => null;
end;
raise Ada.Assertions.Assertion_Error with
"Extractor program failed:" & New_Line
& To_String (STDERR_Buffer);
end if;
end;
Step_4 (Target);
end Step_3b;
|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2020 onox <[email protected]>\n--\n-- Licensed under the A",
"end": 70,
"score": 0.999363899230957,
"start": 66,
"tag": "USERNAME",
"value": "onox"
},
{
"context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2020 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 91,
"score": 0.9999229311943054,
"start": 72,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka/src/orka/interface/orka-timers.ads
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private with GL.Objects.Queries;
private with GL.Types;
package Orka.Timers is
pragma Preelaborate;
type State_Type is (Idle, Busy, Waiting);
type Timer is tagged private;
function Create_Timer return Timer;
function State (Object : Timer) return State_Type
with Inline;
procedure Start (Object : in out Timer)
with Pre => Object.State in Idle | Waiting,
Post => (case Object.State'Old is
when Idle => Object.State = Busy,
when Waiting => Object.State in Waiting | Busy,
when Busy => raise Program_Error);
-- Start measuring the duration of rendering commands on the GPU
--
-- If the timer is currently waiting for the GPU duration to become
-- available, then this procedure is a no-op.
procedure Stop (Object : in out Timer)
with Pre => Object.State in Busy | Waiting,
Post => Object.State = Waiting;
-- Stop measuring the duration of rendering commands on the GPU
--
-- If the timer is already waiting for the GPU duration to become
-- available, then this procedure is a no-op.
--
-- After this procedure has been called, the next restart of the timer
-- will update the GPU duration if the result has become available by
-- then.
--
-- If the timer is used once (not started and stopped repeatedly),
-- then procedure Wait_For_Result needs to be called to wait for the
-- result of the GPU duration to become available.
procedure Wait_For_Result (Object : in out Timer)
with Pre => Object.State = Waiting,
Post => Object.State = Idle;
-- Wait and stall the CPU until the result of the GPU duration is
-- available
--
-- This function is only needed for one-shot timers. If a timer is
-- started and stopped repeatedly (once per frame), then the GPU
-- duration will become available a few frames after the timer was
-- started.
function CPU_Duration (Object : Timer) return Duration;
function GPU_Duration (Object : Timer) return Duration;
private
type Timer is tagged record
Query_Start, Query_Stop : GL.Objects.Queries.Query (GL.Objects.Queries.Timestamp);
State : State_Type := Idle;
CPU_Start : GL.Types.Long := 0;
CPU_Duration : Duration := 0.0;
GPU_Duration : Duration := 0.0;
end record;
function State (Object : Timer) return State_Type is (Object.State);
end Orka.Timers;
|
5419
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<EMAIL>>
--
-- 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 GL.Objects.Queries;
private with GL.Types;
package Orka.Timers is
pragma Preelaborate;
type State_Type is (Idle, Busy, Waiting);
type Timer is tagged private;
function Create_Timer return Timer;
function State (Object : Timer) return State_Type
with Inline;
procedure Start (Object : in out Timer)
with Pre => Object.State in Idle | Waiting,
Post => (case Object.State'Old is
when Idle => Object.State = Busy,
when Waiting => Object.State in Waiting | Busy,
when Busy => raise Program_Error);
-- Start measuring the duration of rendering commands on the GPU
--
-- If the timer is currently waiting for the GPU duration to become
-- available, then this procedure is a no-op.
procedure Stop (Object : in out Timer)
with Pre => Object.State in Busy | Waiting,
Post => Object.State = Waiting;
-- Stop measuring the duration of rendering commands on the GPU
--
-- If the timer is already waiting for the GPU duration to become
-- available, then this procedure is a no-op.
--
-- After this procedure has been called, the next restart of the timer
-- will update the GPU duration if the result has become available by
-- then.
--
-- If the timer is used once (not started and stopped repeatedly),
-- then procedure Wait_For_Result needs to be called to wait for the
-- result of the GPU duration to become available.
procedure Wait_For_Result (Object : in out Timer)
with Pre => Object.State = Waiting,
Post => Object.State = Idle;
-- Wait and stall the CPU until the result of the GPU duration is
-- available
--
-- This function is only needed for one-shot timers. If a timer is
-- started and stopped repeatedly (once per frame), then the GPU
-- duration will become available a few frames after the timer was
-- started.
function CPU_Duration (Object : Timer) return Duration;
function GPU_Duration (Object : Timer) return Duration;
private
type Timer is tagged record
Query_Start, Query_Stop : GL.Objects.Queries.Query (GL.Objects.Queries.Timestamp);
State : State_Type := Idle;
CPU_Start : GL.Types.Long := 0;
CPU_Duration : Duration := 0.0;
GPU_Duration : Duration := 0.0;
end record;
function State (Object : Timer) return State_Type is (Object.State);
end Orka.Timers;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <PI:EMAIL:<EMAIL>END_PI>
--
-- 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 GL.Objects.Queries;
private with GL.Types;
package Orka.Timers is
pragma Preelaborate;
type State_Type is (Idle, Busy, Waiting);
type Timer is tagged private;
function Create_Timer return Timer;
function State (Object : Timer) return State_Type
with Inline;
procedure Start (Object : in out Timer)
with Pre => Object.State in Idle | Waiting,
Post => (case Object.State'Old is
when Idle => Object.State = Busy,
when Waiting => Object.State in Waiting | Busy,
when Busy => raise Program_Error);
-- Start measuring the duration of rendering commands on the GPU
--
-- If the timer is currently waiting for the GPU duration to become
-- available, then this procedure is a no-op.
procedure Stop (Object : in out Timer)
with Pre => Object.State in Busy | Waiting,
Post => Object.State = Waiting;
-- Stop measuring the duration of rendering commands on the GPU
--
-- If the timer is already waiting for the GPU duration to become
-- available, then this procedure is a no-op.
--
-- After this procedure has been called, the next restart of the timer
-- will update the GPU duration if the result has become available by
-- then.
--
-- If the timer is used once (not started and stopped repeatedly),
-- then procedure Wait_For_Result needs to be called to wait for the
-- result of the GPU duration to become available.
procedure Wait_For_Result (Object : in out Timer)
with Pre => Object.State = Waiting,
Post => Object.State = Idle;
-- Wait and stall the CPU until the result of the GPU duration is
-- available
--
-- This function is only needed for one-shot timers. If a timer is
-- started and stopped repeatedly (once per frame), then the GPU
-- duration will become available a few frames after the timer was
-- started.
function CPU_Duration (Object : Timer) return Duration;
function GPU_Duration (Object : Timer) return Duration;
private
type Timer is tagged record
Query_Start, Query_Stop : GL.Objects.Queries.Query (GL.Objects.Queries.Timestamp);
State : State_Type := Idle;
CPU_Start : GL.Types.Long := 0;
CPU_Duration : Duration := 0.0;
GPU_Duration : Duration := 0.0;
end record;
function State (Object : Timer) return State_Type is (Object.State);
end Orka.Timers;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019-2020 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 48,
"score": 0.9998542070388794,
"start": 38,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019-2020 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 68,
"score": 0.9999306201934814,
"start": 50,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/units/program-units-bodies.adb
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019-2020 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Units.Declarations;
package body Program.Units.Bodies is
--------------------
-- Append_Subunit --
--------------------
procedure Append_Subunit
(Self : in out Unit_Body;
Value : Program.Compilation_Units.Compilation_Unit_Access)
is
begin
Self.Subunits.Append (Value);
end Append_Subunit;
-------------------------------
-- Corresponding_Declaration --
-------------------------------
overriding function Corresponding_Declaration (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access is
begin
return Self.Declaration;
end Corresponding_Declaration;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Unit_Body;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access)
is
begin
Self.Initialize
(Compilation => Compilation,
Full_Name => Full_Name,
Context_Clause => Context_Clause,
Unit_Declaration => Unit_Declaration);
Self.Parent := Parent;
if Parent not in null then
Program.Units.Declarations.Unit_Declaration (Parent.all)
.Append_Child (Self'Unchecked_Access);
end if;
if Declaration not in null then
Program.Units.Declarations.Unit_Declaration (Declaration.all)
.Set_Body (Self'Unchecked_Access);
end if;
Self.Declaration := Declaration;
Self.Subunits.Clear;
end Initialize;
-------------------------------
-- Is_Library_Unit_Body_Unit --
-------------------------------
overriding function Is_Library_Unit_Body_Unit
(Self : Unit_Body) return Boolean
is
pragma Unreferenced (Self);
begin
return True;
end Is_Library_Unit_Body_Unit;
------------
-- Parent --
------------
overriding function Parent (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access
is
begin
return Self.Parent;
end Parent;
--------------
-- Subunits --
--------------
overriding function Subunits (Self : access Unit_Body)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access is
begin
if Self.Subunits.Is_Empty then
return null;
else
return Self.Subunits'Access;
end if;
end Subunits;
end Program.Units.Bodies;
|
22618
|
-- SPDX-FileCopyrightText: 2019-2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Units.Declarations;
package body Program.Units.Bodies is
--------------------
-- Append_Subunit --
--------------------
procedure Append_Subunit
(Self : in out Unit_Body;
Value : Program.Compilation_Units.Compilation_Unit_Access)
is
begin
Self.Subunits.Append (Value);
end Append_Subunit;
-------------------------------
-- Corresponding_Declaration --
-------------------------------
overriding function Corresponding_Declaration (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access is
begin
return Self.Declaration;
end Corresponding_Declaration;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Unit_Body;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access)
is
begin
Self.Initialize
(Compilation => Compilation,
Full_Name => Full_Name,
Context_Clause => Context_Clause,
Unit_Declaration => Unit_Declaration);
Self.Parent := Parent;
if Parent not in null then
Program.Units.Declarations.Unit_Declaration (Parent.all)
.Append_Child (Self'Unchecked_Access);
end if;
if Declaration not in null then
Program.Units.Declarations.Unit_Declaration (Declaration.all)
.Set_Body (Self'Unchecked_Access);
end if;
Self.Declaration := Declaration;
Self.Subunits.Clear;
end Initialize;
-------------------------------
-- Is_Library_Unit_Body_Unit --
-------------------------------
overriding function Is_Library_Unit_Body_Unit
(Self : Unit_Body) return Boolean
is
pragma Unreferenced (Self);
begin
return True;
end Is_Library_Unit_Body_Unit;
------------
-- Parent --
------------
overriding function Parent (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access
is
begin
return Self.Parent;
end Parent;
--------------
-- Subunits --
--------------
overriding function Subunits (Self : access Unit_Body)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access is
begin
if Self.Subunits.Is_Empty then
return null;
else
return Self.Subunits'Access;
end if;
end Subunits;
end Program.Units.Bodies;
| true |
-- SPDX-FileCopyrightText: 2019-2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Units.Declarations;
package body Program.Units.Bodies is
--------------------
-- Append_Subunit --
--------------------
procedure Append_Subunit
(Self : in out Unit_Body;
Value : Program.Compilation_Units.Compilation_Unit_Access)
is
begin
Self.Subunits.Append (Value);
end Append_Subunit;
-------------------------------
-- Corresponding_Declaration --
-------------------------------
overriding function Corresponding_Declaration (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access is
begin
return Self.Declaration;
end Corresponding_Declaration;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Unit_Body;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access)
is
begin
Self.Initialize
(Compilation => Compilation,
Full_Name => Full_Name,
Context_Clause => Context_Clause,
Unit_Declaration => Unit_Declaration);
Self.Parent := Parent;
if Parent not in null then
Program.Units.Declarations.Unit_Declaration (Parent.all)
.Append_Child (Self'Unchecked_Access);
end if;
if Declaration not in null then
Program.Units.Declarations.Unit_Declaration (Declaration.all)
.Set_Body (Self'Unchecked_Access);
end if;
Self.Declaration := Declaration;
Self.Subunits.Clear;
end Initialize;
-------------------------------
-- Is_Library_Unit_Body_Unit --
-------------------------------
overriding function Is_Library_Unit_Body_Unit
(Self : Unit_Body) return Boolean
is
pragma Unreferenced (Self);
begin
return True;
end Is_Library_Unit_Body_Unit;
------------
-- Parent --
------------
overriding function Parent (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access
is
begin
return Self.Parent;
end Parent;
--------------
-- Subunits --
--------------
overriding function Subunits (Self : access Unit_Body)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access is
begin
if Self.Subunits.Is_Empty then
return null;
else
return Self.Subunits'Access;
end if;
end Subunits;
end Program.Units.Bodies;
|
[
{
"context": "he file gate3_license.txt !!!\n--\n-- Copyright (c) F. J. FABIEN - 2013\n-- Berry\n-- FRANCE\n-- Send bug reports ",
"end": 178,
"score": 0.9998441338539124,
"start": 166,
"tag": "NAME",
"value": "F. J. FABIEN"
},
{
"context": "t !!!\n--\n-- Copyright (c) F. J. FABIEN - 2013\n-- Berry\n-- FRANCE\n-- Send bug reports or feedback t",
"end": 191,
"score": 0.5269104838371277,
"start": 190,
"tag": "NAME",
"value": "B"
},
{
"context": "- Copyright (c) F. J. FABIEN - 2013\n-- Berry\n-- FRANCE\n-- Send bug reports or feedback to : francois_fa",
"end": 206,
"score": 0.7667308449745178,
"start": 200,
"tag": "NAME",
"value": "FRANCE"
},
{
"context": "y\n-- FRANCE\n-- Send bug reports or feedback to : [email protected]\n--\n-- THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT ",
"end": 272,
"score": 0.9999356269836426,
"start": 245,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
tutorial/src/window1_callbacks.ads
|
Blady-Com/Gate3
| 1 |
-----------------------------------------------------------------------------
-- Legal licensing note : !!! Edit the file gate3_license.txt !!!
--
-- Copyright (c) F. J. FABIEN - 2013
-- Berry
-- FRANCE
-- Send bug reports or feedback to : [email protected]
--
-- 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.
-- NB: this is the MIT License, as found 12-Sep-2007 on the site
-- http://www.opensource.org/licenses/mit-license.php
-----------------------------------------------------------------------------
with Gtkada.Builder; use Gtkada.Builder;
package Window1_Callbacks is
function On_Window1_Delete_Event (Builder : access Gtkada_Builder_Record'Class)
return Boolean;
procedure Gtk_Main_Quit (Builder : access Gtkada_Builder_Record'Class);
procedure On_Button2_Clicked (Builder : access Gtkada_Builder_Record'Class);
end Window1_Callbacks;
|
27377
|
-----------------------------------------------------------------------------
-- Legal licensing note : !!! Edit the file gate3_license.txt !!!
--
-- Copyright (c) <NAME> - 2013
-- <NAME>erry
-- <NAME>
-- Send bug reports or feedback to : <EMAIL>
--
-- 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.
-- NB: this is the MIT License, as found 12-Sep-2007 on the site
-- http://www.opensource.org/licenses/mit-license.php
-----------------------------------------------------------------------------
with Gtkada.Builder; use Gtkada.Builder;
package Window1_Callbacks is
function On_Window1_Delete_Event (Builder : access Gtkada_Builder_Record'Class)
return Boolean;
procedure Gtk_Main_Quit (Builder : access Gtkada_Builder_Record'Class);
procedure On_Button2_Clicked (Builder : access Gtkada_Builder_Record'Class);
end Window1_Callbacks;
| true |
-----------------------------------------------------------------------------
-- Legal licensing note : !!! Edit the file gate3_license.txt !!!
--
-- Copyright (c) PI:NAME:<NAME>END_PI - 2013
-- PI:NAME:<NAME>END_PIerry
-- PI:NAME:<NAME>END_PI
-- Send bug reports or feedback to : PI:EMAIL:<EMAIL>END_PI
--
-- 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.
-- NB: this is the MIT License, as found 12-Sep-2007 on the site
-- http://www.opensource.org/licenses/mit-license.php
-----------------------------------------------------------------------------
with Gtkada.Builder; use Gtkada.Builder;
package Window1_Callbacks is
function On_Window1_Delete_Event (Builder : access Gtkada_Builder_Record'Class)
return Boolean;
procedure Gtk_Main_Quit (Builder : access Gtkada_Builder_Record'Class);
procedure On_Button2_Clicked (Builder : access Gtkada_Builder_Record'Class);
end Window1_Callbacks;
|
[
{
"context": "- Main display view manager\n-- Copyright (C) 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 163,
"score": 0.9998711347579956,
"start": 148,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 194,
"score": 0.9998776316642761,
"start": 179,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 221,
"score": 0.9999272227287292,
"start": 196,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/hestia-display-main.ads
|
stcarrez/hestia
| 2 |
-----------------------------------------------------------------------
-- hestia-display-main -- Main display view manager
-- Copyright (C) 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with HAL.Bitmap;
with HAL.Touch_Panel;
with Ada.Real_Time;
with Hestia.Time;
with UI.Buttons;
with UI.Displays;
package Hestia.Display.Main is
type Display_Type is limited new UI.Displays.Display_Type with private;
-- Draw the layout presentation frame.
overriding
procedure On_Restore (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class);
-- Refresh the current display.
overriding
procedure On_Refresh (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Deadline : out Ada.Real_Time.Time);
-- Handle touch events on the display.
overriding
procedure On_Touch (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
States : in HAL.Touch_Panel.TP_State);
private
type Display_Info is limited record
Hour : Hestia.Time.Hour_Number := 0;
Minute : Hestia.Time.Minute_Number := 0;
end record;
type Display_Info_Array is array (UI.Displays.Display_Buffer_Index) of Display_Info;
type Display_Type is limited new UI.Displays.Display_Type with record
Info : Display_Info_Array;
Zone1_Button : UI.Buttons.Button_Type;
Zone2_Button : UI.Buttons.Button_Type;
Info_Button : UI.Buttons.Button_Type;
Sched1_Button : UI.Buttons.Button_Type;
Sched2_Button : UI.Buttons.Button_Type;
end record;
end Hestia.Display.Main;
|
29374
|
-----------------------------------------------------------------------
-- hestia-display-main -- Main display view manager
-- Copyright (C) 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 HAL.Bitmap;
with HAL.Touch_Panel;
with Ada.Real_Time;
with Hestia.Time;
with UI.Buttons;
with UI.Displays;
package Hestia.Display.Main is
type Display_Type is limited new UI.Displays.Display_Type with private;
-- Draw the layout presentation frame.
overriding
procedure On_Restore (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class);
-- Refresh the current display.
overriding
procedure On_Refresh (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Deadline : out Ada.Real_Time.Time);
-- Handle touch events on the display.
overriding
procedure On_Touch (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
States : in HAL.Touch_Panel.TP_State);
private
type Display_Info is limited record
Hour : Hestia.Time.Hour_Number := 0;
Minute : Hestia.Time.Minute_Number := 0;
end record;
type Display_Info_Array is array (UI.Displays.Display_Buffer_Index) of Display_Info;
type Display_Type is limited new UI.Displays.Display_Type with record
Info : Display_Info_Array;
Zone1_Button : UI.Buttons.Button_Type;
Zone2_Button : UI.Buttons.Button_Type;
Info_Button : UI.Buttons.Button_Type;
Sched1_Button : UI.Buttons.Button_Type;
Sched2_Button : UI.Buttons.Button_Type;
end record;
end Hestia.Display.Main;
| true |
-----------------------------------------------------------------------
-- hestia-display-main -- Main display view manager
-- Copyright (C) 2018 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 HAL.Bitmap;
with HAL.Touch_Panel;
with Ada.Real_Time;
with Hestia.Time;
with UI.Buttons;
with UI.Displays;
package Hestia.Display.Main is
type Display_Type is limited new UI.Displays.Display_Type with private;
-- Draw the layout presentation frame.
overriding
procedure On_Restore (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class);
-- Refresh the current display.
overriding
procedure On_Refresh (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Deadline : out Ada.Real_Time.Time);
-- Handle touch events on the display.
overriding
procedure On_Touch (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
States : in HAL.Touch_Panel.TP_State);
private
type Display_Info is limited record
Hour : Hestia.Time.Hour_Number := 0;
Minute : Hestia.Time.Minute_Number := 0;
end record;
type Display_Info_Array is array (UI.Displays.Display_Buffer_Index) of Display_Info;
type Display_Type is limited new UI.Displays.Display_Type with record
Info : Display_Info_Array;
Zone1_Button : UI.Buttons.Button_Type;
Zone2_Button : UI.Buttons.Button_Type;
Info_Button : UI.Buttons.Button_Type;
Sched1_Button : UI.Buttons.Button_Type;
Sched2_Button : UI.Buttons.Button_Type;
end record;
end Hestia.Display.Main;
|
[
{
"context": "-- Copyright 2017 Steven Stewart-Gallus\n--\n-- Licensed under the Apache License, Version ",
"end": 39,
"score": 0.9983862638473511,
"start": 18,
"tag": "NAME",
"value": "Steven Stewart-Gallus"
}
] |
src/ada-core/src/linted-sched.adb
|
mstewartgallus/linted
| 0 |
-- Copyright 2017 Steven Stewart-Gallus
--
-- 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.Dispatching;
package body Linted.Sched is
High_Contention_Count : constant := 16;
procedure Backoff (State : in out Backoff_State) is
begin
if State < 20 then
Pause;
else
Ada.Dispatching.Yield;
end if;
if State /= Backoff_State'Last then
State := State + 1;
end if;
end Backoff;
procedure Success (C : in out Contention) is
begin
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
end Success;
procedure Backoff (C : in out Contention) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
else
Ada.Dispatching.Yield;
end if;
end Backoff;
procedure Backoff (C : in out Contention; Highly_Contended : out Boolean) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
Highly_Contended := False;
return;
end if;
Highly_Contended := True;
end Backoff;
end Linted.Sched;
|
15523
|
-- Copyright 2017 <NAME>
--
-- 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.Dispatching;
package body Linted.Sched is
High_Contention_Count : constant := 16;
procedure Backoff (State : in out Backoff_State) is
begin
if State < 20 then
Pause;
else
Ada.Dispatching.Yield;
end if;
if State /= Backoff_State'Last then
State := State + 1;
end if;
end Backoff;
procedure Success (C : in out Contention) is
begin
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
end Success;
procedure Backoff (C : in out Contention) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
else
Ada.Dispatching.Yield;
end if;
end Backoff;
procedure Backoff (C : in out Contention; Highly_Contended : out Boolean) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
Highly_Contended := False;
return;
end if;
Highly_Contended := True;
end Backoff;
end Linted.Sched;
| true |
-- Copyright 2017 PI:NAME:<NAME>END_PI
--
-- 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.Dispatching;
package body Linted.Sched is
High_Contention_Count : constant := 16;
procedure Backoff (State : in out Backoff_State) is
begin
if State < 20 then
Pause;
else
Ada.Dispatching.Yield;
end if;
if State /= Backoff_State'Last then
State := State + 1;
end if;
end Backoff;
procedure Success (C : in out Contention) is
begin
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
end Success;
procedure Backoff (C : in out Contention) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
else
Ada.Dispatching.Yield;
end if;
end Backoff;
procedure Backoff (C : in out Contention; Highly_Contended : out Boolean) is
My_Contention : Contention_T;
begin
Contention_Atomics.Get (Contention_Atomics.Atomic (C), My_Contention);
Contention_Atomics.Saturating_Decrement (Contention_Atomics.Atomic (C));
if My_Contention < High_Contention_Count then
Pause;
Highly_Contended := False;
return;
end if;
Highly_Contended := True;
end Backoff;
end Linted.Sched;
|
[
{
"context": " draw 4 x 4 box with spider - use loop\n--| Author: Michael B. Feldman, The George Washington University\n--| Last Modifi",
"end": 187,
"score": 0.9998485445976257,
"start": 169,
"tag": "NAME",
"value": "Michael B. Feldman"
}
] |
pnwtl/tests/schemesamples/ada.ada
|
Adept-Space/pn
| 0 |
WITH Spider;
PROCEDURE Draw_Box_with_1_Loop IS
------------------------------------------------------------------
--| draw 4 x 4 box with spider - use loop
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: July 1995
------------------------------------------------------------------
BEGIN -- Draw_Box_with_1_Loop
Spider.Start;
FOR Side IN 1..4 LOOP
Spider.Step;
Spider.Step;
Spider.Step;
Spider.Right;
END LOOP;
Spider.Quit;
END Draw_Box_with_1_Loop;
|
8922
|
WITH Spider;
PROCEDURE Draw_Box_with_1_Loop IS
------------------------------------------------------------------
--| draw 4 x 4 box with spider - use loop
--| Author: <NAME>, The George Washington University
--| Last Modified: July 1995
------------------------------------------------------------------
BEGIN -- Draw_Box_with_1_Loop
Spider.Start;
FOR Side IN 1..4 LOOP
Spider.Step;
Spider.Step;
Spider.Step;
Spider.Right;
END LOOP;
Spider.Quit;
END Draw_Box_with_1_Loop;
| true |
WITH Spider;
PROCEDURE Draw_Box_with_1_Loop IS
------------------------------------------------------------------
--| draw 4 x 4 box with spider - use loop
--| Author: PI:NAME:<NAME>END_PI, The George Washington University
--| Last Modified: July 1995
------------------------------------------------------------------
BEGIN -- Draw_Box_with_1_Loop
Spider.Start;
FOR Side IN 1..4 LOOP
Spider.Step;
Spider.Step;
Spider.Step;
Spider.Right;
END LOOP;
Spider.Quit;
END Draw_Box_with_1_Loop;
|
[
{
"context": "g example\n-- Copyright (C) 2015, 2016, 2020, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 165,
"score": 0.9998763799667358,
"start": 150,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "5, 2016, 2020, 2021 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 196,
"score": 0.9998754262924194,
"start": 181,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 223,
"score": 0.9999302625656128,
"start": 198,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
samples/render.adb
|
jquorning/ada-wiki
| 18 |
-----------------------------------------------------------------------
-- render -- Wiki rendering example
-- Copyright (C) 2015, 2016, 2020, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.IO_Exceptions;
with Ada.Strings.Unbounded;
with Ada.Directories;
with GNAT.Command_Line;
with Wiki.Documents;
with Wiki.Parsers;
with Wiki.Filters.TOC;
with Wiki.Filters.Html;
with Wiki.Filters.Autolink;
with Wiki.Plugins.Templates;
with Wiki.Render.Html;
with Wiki.Render.Text;
with Wiki.Streams.Text_IO;
with Wiki.Streams.Html.Text_IO;
procedure Render is
use GNAT.Command_Line;
use Ada.Strings.Unbounded;
procedure Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String);
procedure Render_Text (Doc : in out Wiki.Documents.Document);
procedure Usage is
begin
Ada.Text_IO.Put_Line ("Render a wiki text file into HTML (default) or text");
Ada.Text_IO.Put_Line ("Usage: render [-t] [-m] [-M] [-H] [-d] [-c] [-s style] {wiki-file}");
Ada.Text_IO.Put_Line (" -t Render to text only");
Ada.Text_IO.Put_Line (" -m Render a Markdown wiki content");
Ada.Text_IO.Put_Line (" -M Render a Mediawiki wiki content");
Ada.Text_IO.Put_Line (" -H Render a HTML wiki content");
Ada.Text_IO.Put_Line (" -d Render a Dotclear wiki content");
Ada.Text_IO.Put_Line (" -g Render a Google wiki content");
Ada.Text_IO.Put_Line (" -c Render a Creole wiki content");
Ada.Text_IO.Put_Line (" -s style Use the CSS style file");
end Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String) is
Output : aliased Wiki.Streams.Html.Text_IO.Html_Output_Stream;
Renderer : aliased Wiki.Render.Html.Html_Renderer;
begin
if Length (Style) > 0 then
Output.Start_Element ("html");
Output.Start_Element ("head");
Output.Start_Element ("link");
Output.Write_Attribute ("type", "text/css");
Output.Write_Attribute ("rel", "stylesheet");
Output.Write_Attribute ("href", To_String (Style));
Output.End_Element ("link");
Output.End_Element ("head");
Output.Start_Element ("body");
end if;
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Set_Render_TOC (True);
Renderer.Render (Doc);
if Length (Style) > 0 then
Output.End_Element ("body");
Output.End_Element ("html");
end if;
end Render_Html;
procedure Render_Text (Doc : in out Wiki.Documents.Document) is
Output : aliased Wiki.Streams.Text_IO.File_Output_Stream;
Renderer : aliased Wiki.Render.Text.Text_Renderer;
begin
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Render (Doc);
end Render_Text;
Count : Natural := 0;
Html_Mode : Boolean := True;
Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN;
Style : Unbounded_String;
begin
loop
case Getopt ("m M d c g t H s:") is
when 'm' =>
Syntax := Wiki.SYNTAX_MARKDOWN;
when 'M' =>
Syntax := Wiki.SYNTAX_MEDIA_WIKI;
when 'c' =>
Syntax := Wiki.SYNTAX_CREOLE;
when 'd' =>
Syntax := Wiki.SYNTAX_DOTCLEAR;
when 'H' =>
Syntax := Wiki.SYNTAX_HTML;
when 'g' =>
Syntax := Wiki.SYNTAX_GOOGLE;
when 't' =>
Html_Mode := False;
when 's' =>
Style := To_Unbounded_String (Parameter);
when others =>
exit;
end case;
end loop;
loop
declare
Name : constant String := GNAT.Command_Line.Get_Argument;
Input : aliased Wiki.Streams.Text_IO.File_Input_Stream;
Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
Autolink : aliased Wiki.Filters.Autolink.Autolink_Filter;
Template : aliased Wiki.Plugins.Templates.File_Template_Plugin;
TOC : aliased Wiki.Filters.TOC.TOC_Filter;
Doc : Wiki.Documents.Document;
Engine : Wiki.Parsers.Parser;
begin
if Name = "" then
if Count = 0 then
Usage;
end if;
return;
end if;
Count := Count + 1;
Template.Set_Template_Path (Ada.Directories.Containing_Directory (Name));
-- Open the file and parse it (assume UTF-8).
Input.Open (Name, "WCEM=8");
Engine.Set_Plugin_Factory (Template'Unchecked_Access);
Engine.Add_Filter (TOC'Unchecked_Access);
Engine.Add_Filter (Autolink'Unchecked_Access);
Engine.Add_Filter (Filter'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Input'Unchecked_Access, Doc);
-- Render the document in text or HTML.
if Html_Mode then
Render_Html (Doc, Style);
else
Render_Text (Doc);
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'");
end;
end loop;
exception
when Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option.");
Usage;
end Render;
|
11380
|
-----------------------------------------------------------------------
-- render -- Wiki rendering example
-- Copyright (C) 2015, 2016, 2020, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.Text_IO;
with Ada.IO_Exceptions;
with Ada.Strings.Unbounded;
with Ada.Directories;
with GNAT.Command_Line;
with Wiki.Documents;
with Wiki.Parsers;
with Wiki.Filters.TOC;
with Wiki.Filters.Html;
with Wiki.Filters.Autolink;
with Wiki.Plugins.Templates;
with Wiki.Render.Html;
with Wiki.Render.Text;
with Wiki.Streams.Text_IO;
with Wiki.Streams.Html.Text_IO;
procedure Render is
use GNAT.Command_Line;
use Ada.Strings.Unbounded;
procedure Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String);
procedure Render_Text (Doc : in out Wiki.Documents.Document);
procedure Usage is
begin
Ada.Text_IO.Put_Line ("Render a wiki text file into HTML (default) or text");
Ada.Text_IO.Put_Line ("Usage: render [-t] [-m] [-M] [-H] [-d] [-c] [-s style] {wiki-file}");
Ada.Text_IO.Put_Line (" -t Render to text only");
Ada.Text_IO.Put_Line (" -m Render a Markdown wiki content");
Ada.Text_IO.Put_Line (" -M Render a Mediawiki wiki content");
Ada.Text_IO.Put_Line (" -H Render a HTML wiki content");
Ada.Text_IO.Put_Line (" -d Render a Dotclear wiki content");
Ada.Text_IO.Put_Line (" -g Render a Google wiki content");
Ada.Text_IO.Put_Line (" -c Render a Creole wiki content");
Ada.Text_IO.Put_Line (" -s style Use the CSS style file");
end Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String) is
Output : aliased Wiki.Streams.Html.Text_IO.Html_Output_Stream;
Renderer : aliased Wiki.Render.Html.Html_Renderer;
begin
if Length (Style) > 0 then
Output.Start_Element ("html");
Output.Start_Element ("head");
Output.Start_Element ("link");
Output.Write_Attribute ("type", "text/css");
Output.Write_Attribute ("rel", "stylesheet");
Output.Write_Attribute ("href", To_String (Style));
Output.End_Element ("link");
Output.End_Element ("head");
Output.Start_Element ("body");
end if;
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Set_Render_TOC (True);
Renderer.Render (Doc);
if Length (Style) > 0 then
Output.End_Element ("body");
Output.End_Element ("html");
end if;
end Render_Html;
procedure Render_Text (Doc : in out Wiki.Documents.Document) is
Output : aliased Wiki.Streams.Text_IO.File_Output_Stream;
Renderer : aliased Wiki.Render.Text.Text_Renderer;
begin
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Render (Doc);
end Render_Text;
Count : Natural := 0;
Html_Mode : Boolean := True;
Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN;
Style : Unbounded_String;
begin
loop
case Getopt ("m M d c g t H s:") is
when 'm' =>
Syntax := Wiki.SYNTAX_MARKDOWN;
when 'M' =>
Syntax := Wiki.SYNTAX_MEDIA_WIKI;
when 'c' =>
Syntax := Wiki.SYNTAX_CREOLE;
when 'd' =>
Syntax := Wiki.SYNTAX_DOTCLEAR;
when 'H' =>
Syntax := Wiki.SYNTAX_HTML;
when 'g' =>
Syntax := Wiki.SYNTAX_GOOGLE;
when 't' =>
Html_Mode := False;
when 's' =>
Style := To_Unbounded_String (Parameter);
when others =>
exit;
end case;
end loop;
loop
declare
Name : constant String := GNAT.Command_Line.Get_Argument;
Input : aliased Wiki.Streams.Text_IO.File_Input_Stream;
Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
Autolink : aliased Wiki.Filters.Autolink.Autolink_Filter;
Template : aliased Wiki.Plugins.Templates.File_Template_Plugin;
TOC : aliased Wiki.Filters.TOC.TOC_Filter;
Doc : Wiki.Documents.Document;
Engine : Wiki.Parsers.Parser;
begin
if Name = "" then
if Count = 0 then
Usage;
end if;
return;
end if;
Count := Count + 1;
Template.Set_Template_Path (Ada.Directories.Containing_Directory (Name));
-- Open the file and parse it (assume UTF-8).
Input.Open (Name, "WCEM=8");
Engine.Set_Plugin_Factory (Template'Unchecked_Access);
Engine.Add_Filter (TOC'Unchecked_Access);
Engine.Add_Filter (Autolink'Unchecked_Access);
Engine.Add_Filter (Filter'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Input'Unchecked_Access, Doc);
-- Render the document in text or HTML.
if Html_Mode then
Render_Html (Doc, Style);
else
Render_Text (Doc);
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'");
end;
end loop;
exception
when Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option.");
Usage;
end Render;
| true |
-----------------------------------------------------------------------
-- render -- Wiki rendering example
-- Copyright (C) 2015, 2016, 2020, 2021 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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.Text_IO;
with Ada.IO_Exceptions;
with Ada.Strings.Unbounded;
with Ada.Directories;
with GNAT.Command_Line;
with Wiki.Documents;
with Wiki.Parsers;
with Wiki.Filters.TOC;
with Wiki.Filters.Html;
with Wiki.Filters.Autolink;
with Wiki.Plugins.Templates;
with Wiki.Render.Html;
with Wiki.Render.Text;
with Wiki.Streams.Text_IO;
with Wiki.Streams.Html.Text_IO;
procedure Render is
use GNAT.Command_Line;
use Ada.Strings.Unbounded;
procedure Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String);
procedure Render_Text (Doc : in out Wiki.Documents.Document);
procedure Usage is
begin
Ada.Text_IO.Put_Line ("Render a wiki text file into HTML (default) or text");
Ada.Text_IO.Put_Line ("Usage: render [-t] [-m] [-M] [-H] [-d] [-c] [-s style] {wiki-file}");
Ada.Text_IO.Put_Line (" -t Render to text only");
Ada.Text_IO.Put_Line (" -m Render a Markdown wiki content");
Ada.Text_IO.Put_Line (" -M Render a Mediawiki wiki content");
Ada.Text_IO.Put_Line (" -H Render a HTML wiki content");
Ada.Text_IO.Put_Line (" -d Render a Dotclear wiki content");
Ada.Text_IO.Put_Line (" -g Render a Google wiki content");
Ada.Text_IO.Put_Line (" -c Render a Creole wiki content");
Ada.Text_IO.Put_Line (" -s style Use the CSS style file");
end Usage;
procedure Render_Html (Doc : in out Wiki.Documents.Document;
Style : in Unbounded_String) is
Output : aliased Wiki.Streams.Html.Text_IO.Html_Output_Stream;
Renderer : aliased Wiki.Render.Html.Html_Renderer;
begin
if Length (Style) > 0 then
Output.Start_Element ("html");
Output.Start_Element ("head");
Output.Start_Element ("link");
Output.Write_Attribute ("type", "text/css");
Output.Write_Attribute ("rel", "stylesheet");
Output.Write_Attribute ("href", To_String (Style));
Output.End_Element ("link");
Output.End_Element ("head");
Output.Start_Element ("body");
end if;
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Set_Render_TOC (True);
Renderer.Render (Doc);
if Length (Style) > 0 then
Output.End_Element ("body");
Output.End_Element ("html");
end if;
end Render_Html;
procedure Render_Text (Doc : in out Wiki.Documents.Document) is
Output : aliased Wiki.Streams.Text_IO.File_Output_Stream;
Renderer : aliased Wiki.Render.Text.Text_Renderer;
begin
Renderer.Set_Output_Stream (Output'Unchecked_Access);
Renderer.Render (Doc);
end Render_Text;
Count : Natural := 0;
Html_Mode : Boolean := True;
Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN;
Style : Unbounded_String;
begin
loop
case Getopt ("m M d c g t H s:") is
when 'm' =>
Syntax := Wiki.SYNTAX_MARKDOWN;
when 'M' =>
Syntax := Wiki.SYNTAX_MEDIA_WIKI;
when 'c' =>
Syntax := Wiki.SYNTAX_CREOLE;
when 'd' =>
Syntax := Wiki.SYNTAX_DOTCLEAR;
when 'H' =>
Syntax := Wiki.SYNTAX_HTML;
when 'g' =>
Syntax := Wiki.SYNTAX_GOOGLE;
when 't' =>
Html_Mode := False;
when 's' =>
Style := To_Unbounded_String (Parameter);
when others =>
exit;
end case;
end loop;
loop
declare
Name : constant String := GNAT.Command_Line.Get_Argument;
Input : aliased Wiki.Streams.Text_IO.File_Input_Stream;
Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
Autolink : aliased Wiki.Filters.Autolink.Autolink_Filter;
Template : aliased Wiki.Plugins.Templates.File_Template_Plugin;
TOC : aliased Wiki.Filters.TOC.TOC_Filter;
Doc : Wiki.Documents.Document;
Engine : Wiki.Parsers.Parser;
begin
if Name = "" then
if Count = 0 then
Usage;
end if;
return;
end if;
Count := Count + 1;
Template.Set_Template_Path (Ada.Directories.Containing_Directory (Name));
-- Open the file and parse it (assume UTF-8).
Input.Open (Name, "WCEM=8");
Engine.Set_Plugin_Factory (Template'Unchecked_Access);
Engine.Add_Filter (TOC'Unchecked_Access);
Engine.Add_Filter (Autolink'Unchecked_Access);
Engine.Add_Filter (Filter'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Input'Unchecked_Access, Doc);
-- Render the document in text or HTML.
if Html_Mode then
Render_Html (Doc, Style);
else
Render_Text (Doc);
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'");
end;
end loop;
exception
when Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option.");
Usage;
end Render;
|
[
{
"context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 35,
"score": 0.9998542666435242,
"start": 23,
"tag": "NAME",
"value": "Maxim Reznik"
},
{
"context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-",
"end": 55,
"score": 0.9999309182167053,
"start": 37,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/oasis/program-elements-goto_statements.ads
|
optikos/oasis
| 0 |
-- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Goto_Statements is
pragma Pure (Program.Elements.Goto_Statements);
type Goto_Statement is
limited interface and Program.Elements.Statements.Statement;
type Goto_Statement_Access is access all Goto_Statement'Class
with Storage_Size => 0;
not overriding function Goto_Label
(Self : Goto_Statement)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
type Goto_Statement_Text is limited interface;
type Goto_Statement_Text_Access is access all Goto_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Goto_Statement_Text
(Self : aliased in out Goto_Statement)
return Goto_Statement_Text_Access is abstract;
not overriding function Goto_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Goto_Statements;
|
747
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Goto_Statements is
pragma Pure (Program.Elements.Goto_Statements);
type Goto_Statement is
limited interface and Program.Elements.Statements.Statement;
type Goto_Statement_Access is access all Goto_Statement'Class
with Storage_Size => 0;
not overriding function Goto_Label
(Self : Goto_Statement)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
type Goto_Statement_Text is limited interface;
type Goto_Statement_Text_Access is access all Goto_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Goto_Statement_Text
(Self : aliased in out Goto_Statement)
return Goto_Statement_Text_Access is abstract;
not overriding function Goto_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Goto_Statements;
| true |
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Goto_Statements is
pragma Pure (Program.Elements.Goto_Statements);
type Goto_Statement is
limited interface and Program.Elements.Statements.Statement;
type Goto_Statement_Access is access all Goto_Statement'Class
with Storage_Size => 0;
not overriding function Goto_Label
(Self : Goto_Statement)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
type Goto_Statement_Text is limited interface;
type Goto_Statement_Text_Access is access all Goto_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Goto_Statement_Text
(Self : aliased in out Goto_Statement)
return Goto_Statement_Text_Access is abstract;
not overriding function Goto_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Goto_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Goto_Statements;
|
[
{
"context": "-- package Copyright (c) Dmitry A. Kazakov --\r\n-- Parsers.Multiline_Source ",
"end": 142,
"score": 0.9998499751091003,
"start": 125,
"tag": "NAME",
"value": "Dmitry A. Kazakov"
}
] |
parsers-multiline_source.adb
|
jrcarter/Ada_GUI
| 19 |
-- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Parsers.Multiline_Source Luebeck --
-- Implementation Winter, 2004 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Parsers.Multiline_Source is
Initial_Size : constant Integer := 512;
function "<" (Left, Right : Position) return Boolean is
begin
return
( Left.Line < Right.Line
or else
( Left.Line = Right.Line
and then
Left.Column < Right.Column
) );
end "<";
procedure Finalize (Code : in out Source) is
begin
Free (Code.Buffer);
end Finalize;
function End_Of (Code : Source'Class) return Boolean is
begin
return Code.Buffer = null;
end End_Of;
function Get_Line (Code : Source'Class) return String is
begin
if Code.Buffer = null then
raise End_Error;
else
return Code.Buffer (1..Code.Length);
end if;
end Get_Line;
procedure Get_Line
( Code : Source'Class;
Line : out Line_Ptr;
Pointer : out Integer;
Last : out Integer
) is
begin
if Code.Buffer = null then
raise End_Error;
else
Line := Code.Buffer.all'Unchecked_Access;
Pointer := Code.Pointer;
Last := Code.Length;
end if;
end Get_Line;
function Get_Backup_Pointer (Code : Source'Class) return Integer is
begin
return Code.Last;
end Get_Backup_Pointer;
function Get_Location
( Message : String;
Prefix : String := "at "
) return Location is
Pointer : Integer := Message'Last;
Result : Location := ((0, 0), (0, 0));
begin
loop -- An occurence of Prefix
loop -- Searching backwards Message for Prefix
if Pointer < Message'First + Prefix'Length - 1 then
return Result;
end if;
exit when
Message (Pointer - Prefix'Length + 1..Pointer) = Prefix;
Pointer := Pointer - 1;
end loop;
Pointer := Pointer + 1;
-- After the prefix
begin
Get (Message, Pointer, Integer (Result.First.Line));
Result.Next.Line := Result.First.Line;
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
return Result;
end if;
-- Line:
Pointer := Pointer + 1;
begin
Get (Message, Pointer, Result.First.Column, First => 1);
exception
when others =>
return Result;
end;
-- Line:Column
Result.Next.Column := Result.First.Column;
if ( Pointer + 1 >= Message'Last
or else
Message (Pointer..Pointer + 1) /= ".."
)
then
return Result;
end if;
Pointer := Pointer + 2;
-- Line:Column..
begin
Get (Message, Pointer, Integer (Result.Next.Line));
exception
when others =>
return Result;
end;
-- Line:Column..Line
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end if;
Pointer := Pointer + 1;
-- Line:Column..Line:
begin
Get (Message, Pointer, Result.Next.Column);
-- Line:Column..Line:Column
return Result;
exception
when others =>
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end;
exception
when others =>
return Result;
end;
end loop;
end Get_Location;
function Get_Pointer (Code : Source'Class) return Integer is
begin
return Code.Pointer;
end Get_Pointer;
function Image (Link : Location) return String is
begin
if Link.First = Link.Next then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
);
elsif Link.First.Line = Link.Next.Line then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Link.Next.Column - 1)
);
else
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Integer (Link.Next.Line))
& ":"
& Image (Link.Next.Column - 1)
);
end if;
end Image;
procedure Initialize (Code : in out Source) is
begin
Code.Buffer := new String (1..Initial_Size);
Next_Line (Code);
exception
when Storage_Error =>
raise;
when others =>
null;
end Initialize;
function Link (Code : Source'Class) return Location is
begin
return ((Code.Line, Code.Last), (Code.Line, Code.Pointer));
end Link;
function "&" (Left, Right : Location) return Location is
Result : Location;
begin
if Left.First < Right.First then
Result.First := Left.First;
else
Result.First := Right.First;
end if;
if Left.Next < Right.Next then
Result.Next := Right.Next;
else
Result.Next := Left.Next;
end if;
return Result;
end "&";
procedure Next_Line (Code : in out Source'Class) is
begin
Code.Pointer := 1;
Code.Last := 1;
Get_Line (Code);
Code.Line := Code.Line + 1;
exception
when End_Error =>
Free (Code.Buffer);
raise;
end Next_Line;
procedure Reset_Pointer (Code : in out Source'Class) is
begin
Code.Pointer := Code.Last;
end Reset_Pointer;
procedure Set_Pointer
( Code : in out Source'Class;
Pointer : Integer
) is
begin
if Code.Buffer = null then
if Pointer /= 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
else
if Pointer not in Code.Last..Code.Length + 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
end if;
Code.Last := Code.Pointer;
Code.Pointer := Pointer;
end Set_Pointer;
procedure Skip (Code : in out Source'Class; Link : Location) is
begin
if Code.Line > Link.First.Line then
raise Ada.IO_Exceptions.Layout_Error;
end if;
while Code.Line < Link.First.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.First.Column);
while Code.Line < Link.Next.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.Next.Column);
end Skip;
end Parsers.Multiline_Source;
|
12595
|
-- --
-- package Copyright (c) <NAME> --
-- Parsers.Multiline_Source Luebeck --
-- Implementation Winter, 2004 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Parsers.Multiline_Source is
Initial_Size : constant Integer := 512;
function "<" (Left, Right : Position) return Boolean is
begin
return
( Left.Line < Right.Line
or else
( Left.Line = Right.Line
and then
Left.Column < Right.Column
) );
end "<";
procedure Finalize (Code : in out Source) is
begin
Free (Code.Buffer);
end Finalize;
function End_Of (Code : Source'Class) return Boolean is
begin
return Code.Buffer = null;
end End_Of;
function Get_Line (Code : Source'Class) return String is
begin
if Code.Buffer = null then
raise End_Error;
else
return Code.Buffer (1..Code.Length);
end if;
end Get_Line;
procedure Get_Line
( Code : Source'Class;
Line : out Line_Ptr;
Pointer : out Integer;
Last : out Integer
) is
begin
if Code.Buffer = null then
raise End_Error;
else
Line := Code.Buffer.all'Unchecked_Access;
Pointer := Code.Pointer;
Last := Code.Length;
end if;
end Get_Line;
function Get_Backup_Pointer (Code : Source'Class) return Integer is
begin
return Code.Last;
end Get_Backup_Pointer;
function Get_Location
( Message : String;
Prefix : String := "at "
) return Location is
Pointer : Integer := Message'Last;
Result : Location := ((0, 0), (0, 0));
begin
loop -- An occurence of Prefix
loop -- Searching backwards Message for Prefix
if Pointer < Message'First + Prefix'Length - 1 then
return Result;
end if;
exit when
Message (Pointer - Prefix'Length + 1..Pointer) = Prefix;
Pointer := Pointer - 1;
end loop;
Pointer := Pointer + 1;
-- After the prefix
begin
Get (Message, Pointer, Integer (Result.First.Line));
Result.Next.Line := Result.First.Line;
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
return Result;
end if;
-- Line:
Pointer := Pointer + 1;
begin
Get (Message, Pointer, Result.First.Column, First => 1);
exception
when others =>
return Result;
end;
-- Line:Column
Result.Next.Column := Result.First.Column;
if ( Pointer + 1 >= Message'Last
or else
Message (Pointer..Pointer + 1) /= ".."
)
then
return Result;
end if;
Pointer := Pointer + 2;
-- Line:Column..
begin
Get (Message, Pointer, Integer (Result.Next.Line));
exception
when others =>
return Result;
end;
-- Line:Column..Line
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end if;
Pointer := Pointer + 1;
-- Line:Column..Line:
begin
Get (Message, Pointer, Result.Next.Column);
-- Line:Column..Line:Column
return Result;
exception
when others =>
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end;
exception
when others =>
return Result;
end;
end loop;
end Get_Location;
function Get_Pointer (Code : Source'Class) return Integer is
begin
return Code.Pointer;
end Get_Pointer;
function Image (Link : Location) return String is
begin
if Link.First = Link.Next then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
);
elsif Link.First.Line = Link.Next.Line then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Link.Next.Column - 1)
);
else
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Integer (Link.Next.Line))
& ":"
& Image (Link.Next.Column - 1)
);
end if;
end Image;
procedure Initialize (Code : in out Source) is
begin
Code.Buffer := new String (1..Initial_Size);
Next_Line (Code);
exception
when Storage_Error =>
raise;
when others =>
null;
end Initialize;
function Link (Code : Source'Class) return Location is
begin
return ((Code.Line, Code.Last), (Code.Line, Code.Pointer));
end Link;
function "&" (Left, Right : Location) return Location is
Result : Location;
begin
if Left.First < Right.First then
Result.First := Left.First;
else
Result.First := Right.First;
end if;
if Left.Next < Right.Next then
Result.Next := Right.Next;
else
Result.Next := Left.Next;
end if;
return Result;
end "&";
procedure Next_Line (Code : in out Source'Class) is
begin
Code.Pointer := 1;
Code.Last := 1;
Get_Line (Code);
Code.Line := Code.Line + 1;
exception
when End_Error =>
Free (Code.Buffer);
raise;
end Next_Line;
procedure Reset_Pointer (Code : in out Source'Class) is
begin
Code.Pointer := Code.Last;
end Reset_Pointer;
procedure Set_Pointer
( Code : in out Source'Class;
Pointer : Integer
) is
begin
if Code.Buffer = null then
if Pointer /= 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
else
if Pointer not in Code.Last..Code.Length + 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
end if;
Code.Last := Code.Pointer;
Code.Pointer := Pointer;
end Set_Pointer;
procedure Skip (Code : in out Source'Class; Link : Location) is
begin
if Code.Line > Link.First.Line then
raise Ada.IO_Exceptions.Layout_Error;
end if;
while Code.Line < Link.First.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.First.Column);
while Code.Line < Link.Next.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.Next.Column);
end Skip;
end Parsers.Multiline_Source;
| true |
-- --
-- package Copyright (c) PI:NAME:<NAME>END_PI --
-- Parsers.Multiline_Source Luebeck --
-- Implementation Winter, 2004 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Parsers.Multiline_Source is
Initial_Size : constant Integer := 512;
function "<" (Left, Right : Position) return Boolean is
begin
return
( Left.Line < Right.Line
or else
( Left.Line = Right.Line
and then
Left.Column < Right.Column
) );
end "<";
procedure Finalize (Code : in out Source) is
begin
Free (Code.Buffer);
end Finalize;
function End_Of (Code : Source'Class) return Boolean is
begin
return Code.Buffer = null;
end End_Of;
function Get_Line (Code : Source'Class) return String is
begin
if Code.Buffer = null then
raise End_Error;
else
return Code.Buffer (1..Code.Length);
end if;
end Get_Line;
procedure Get_Line
( Code : Source'Class;
Line : out Line_Ptr;
Pointer : out Integer;
Last : out Integer
) is
begin
if Code.Buffer = null then
raise End_Error;
else
Line := Code.Buffer.all'Unchecked_Access;
Pointer := Code.Pointer;
Last := Code.Length;
end if;
end Get_Line;
function Get_Backup_Pointer (Code : Source'Class) return Integer is
begin
return Code.Last;
end Get_Backup_Pointer;
function Get_Location
( Message : String;
Prefix : String := "at "
) return Location is
Pointer : Integer := Message'Last;
Result : Location := ((0, 0), (0, 0));
begin
loop -- An occurence of Prefix
loop -- Searching backwards Message for Prefix
if Pointer < Message'First + Prefix'Length - 1 then
return Result;
end if;
exit when
Message (Pointer - Prefix'Length + 1..Pointer) = Prefix;
Pointer := Pointer - 1;
end loop;
Pointer := Pointer + 1;
-- After the prefix
begin
Get (Message, Pointer, Integer (Result.First.Line));
Result.Next.Line := Result.First.Line;
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
return Result;
end if;
-- Line:
Pointer := Pointer + 1;
begin
Get (Message, Pointer, Result.First.Column, First => 1);
exception
when others =>
return Result;
end;
-- Line:Column
Result.Next.Column := Result.First.Column;
if ( Pointer + 1 >= Message'Last
or else
Message (Pointer..Pointer + 1) /= ".."
)
then
return Result;
end if;
Pointer := Pointer + 2;
-- Line:Column..
begin
Get (Message, Pointer, Integer (Result.Next.Line));
exception
when others =>
return Result;
end;
-- Line:Column..Line
if ( Pointer >= Message'Last
or else
Message (Pointer) /= ':'
)
then
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end if;
Pointer := Pointer + 1;
-- Line:Column..Line:
begin
Get (Message, Pointer, Result.Next.Column);
-- Line:Column..Line:Column
return Result;
exception
when others =>
Result.Next.Column := Integer (Result.Next.Line);
Result.Next.Line := Result.First.Line;
return Result;
end;
exception
when others =>
return Result;
end;
end loop;
end Get_Location;
function Get_Pointer (Code : Source'Class) return Integer is
begin
return Code.Pointer;
end Get_Pointer;
function Image (Link : Location) return String is
begin
if Link.First = Link.Next then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
);
elsif Link.First.Line = Link.Next.Line then
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Link.Next.Column - 1)
);
else
return
( Image (Integer (Link.First.Line))
& ":"
& Image (Link.First.Column)
& ".."
& Image (Integer (Link.Next.Line))
& ":"
& Image (Link.Next.Column - 1)
);
end if;
end Image;
procedure Initialize (Code : in out Source) is
begin
Code.Buffer := new String (1..Initial_Size);
Next_Line (Code);
exception
when Storage_Error =>
raise;
when others =>
null;
end Initialize;
function Link (Code : Source'Class) return Location is
begin
return ((Code.Line, Code.Last), (Code.Line, Code.Pointer));
end Link;
function "&" (Left, Right : Location) return Location is
Result : Location;
begin
if Left.First < Right.First then
Result.First := Left.First;
else
Result.First := Right.First;
end if;
if Left.Next < Right.Next then
Result.Next := Right.Next;
else
Result.Next := Left.Next;
end if;
return Result;
end "&";
procedure Next_Line (Code : in out Source'Class) is
begin
Code.Pointer := 1;
Code.Last := 1;
Get_Line (Code);
Code.Line := Code.Line + 1;
exception
when End_Error =>
Free (Code.Buffer);
raise;
end Next_Line;
procedure Reset_Pointer (Code : in out Source'Class) is
begin
Code.Pointer := Code.Last;
end Reset_Pointer;
procedure Set_Pointer
( Code : in out Source'Class;
Pointer : Integer
) is
begin
if Code.Buffer = null then
if Pointer /= 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
else
if Pointer not in Code.Last..Code.Length + 1 then
raise Ada.IO_Exceptions.Layout_Error;
end if;
end if;
Code.Last := Code.Pointer;
Code.Pointer := Pointer;
end Set_Pointer;
procedure Skip (Code : in out Source'Class; Link : Location) is
begin
if Code.Line > Link.First.Line then
raise Ada.IO_Exceptions.Layout_Error;
end if;
while Code.Line < Link.First.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.First.Column);
while Code.Line < Link.Next.Line loop
Next_Line (Code);
end loop;
Set_Pointer (Code, Link.Next.Column);
end Skip;
end Parsers.Multiline_Source;
|
[
{
"context": "CSS pre-defined value types\n-- Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 180,
"score": 0.9998815655708313,
"start": 165,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 211,
"score": 0.9998871088027954,
"start": 196,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "7 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 238,
"score": 0.9999243021011353,
"start": 213,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
tools/css-analysis-rules-types.adb
|
stcarrez/ada-css
| 3 |
-----------------------------------------------------------------------
-- css-analysis-rules-types -- Rules for CSS pre-defined value types
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body CSS.Analysis.Rules.Types is
use CSS.Core.Values;
-- ------------------------------
-- Print the rule definition to the print stream.
-- ------------------------------
procedure Print (Rule : in Builtin_Rule_Type;
Stream : in out CSS.Printer.File_Type'Class) is
begin
Stream.Print (Ada.Strings.Unbounded.To_String (Rule.Name));
end Print;
-- ------------------------------
-- Check if the value represents an integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Integer_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a number or integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Number_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a percentage.
-- ------------------------------
overriding
function Match (Rule : in Percentage_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a length.
-- ------------------------------
overriding
function Match (Rule : in Length_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
if Get_Type (Value) /= VALUE_NUMBER then
return False;
end if;
if Get_Unit (Value) in Length_Unit_Type then
return True;
end if;
if Get_Unit (Value) /= UNIT_NONE then
return False;
end if;
return Get_Value (Value) = "0";
end Match;
-- ------------------------------
-- Check if the value represents a time.
-- ------------------------------
overriding
function Match (Rule : in Time_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Time_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a resolution.
-- ------------------------------
overriding
function Match (Rule : in Resolution_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_PI;
end Match;
-- ------------------------------
-- Check if the value represents an angle.
-- ------------------------------
overriding
function Match (Rule : in Angle_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Angle_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a string.
-- ------------------------------
overriding
function Match (Rule : in String_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_STRING;
end Match;
-- ------------------------------
-- Check if the value represents a url.
-- ------------------------------
overriding
function Match (Rule : in URL_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_URL;
end Match;
-- ------------------------------
-- Check if the value represents an hexadecimal color.
-- ------------------------------
overriding
function Match (Rule : in Color_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_COLOR;
end Match;
-- ------------------------------
-- Check if the value represents a custom identifier.
-- ------------------------------
overriding
function Match (Rule : in Identifier_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_IDENT;
end Match;
-- ------------------------------
-- Register the builtin type in the repository.
-- ------------------------------
procedure Register_Builtin (Repository : in out Repository_Type;
Name : in String;
Rule : in Builtin_Rule_Type_Access;
Kind : in CSS.Core.Values.Value_Kind) is
begin
Rule.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name);
Repository.Types.Insert (Name, Rule.all'Access);
end Register_Builtin;
Int_Rule : aliased Types.Integer_Rule_Type;
Percent_Rule : aliased Types.Percentage_Rule_Type;
Length_Rule : aliased Types.Length_Rule_Type;
Number_Rule : aliased Types.Number_Rule_Type;
Angle_Rule : aliased Types.Angle_Rule_Type;
String_Rule : aliased Types.String_Rule_Type;
URL_Rule : aliased Types.URL_Rule_Type;
Color_Rule : aliased Types.Color_Rule_Type;
Ident_Rule : aliased Types.Identifier_Rule_Type;
Resolution_Rule : aliased Types.Resolution_Rule_Type;
Time_Rule : aliased Types.Time_Rule_Type;
procedure Register (Repository : in out Repository_Type) is
begin
Register_Builtin (Repository, "<angle>", Angle_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<integer>", Int_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<number>", Number_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<length>", Length_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<percentage>", Percent_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<string>", String_Rule'Access, VALUE_STRING);
Register_Builtin (Repository, "<url>", URL_Rule'Access, VALUE_URL);
Register_Builtin (Repository, "<hex-color>", Color_Rule'Access, VALUE_COLOR);
Register_Builtin (Repository, "<custom-ident>", Ident_Rule'Access, VALUE_IDENT);
Register_Builtin (Repository, "<resolution>", Resolution_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<time>", Time_Rule'Access, VALUE_NUMBER);
end Register;
end CSS.Analysis.Rules.Types;
|
5487
|
-----------------------------------------------------------------------
-- css-analysis-rules-types -- Rules for CSS pre-defined value types
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body CSS.Analysis.Rules.Types is
use CSS.Core.Values;
-- ------------------------------
-- Print the rule definition to the print stream.
-- ------------------------------
procedure Print (Rule : in Builtin_Rule_Type;
Stream : in out CSS.Printer.File_Type'Class) is
begin
Stream.Print (Ada.Strings.Unbounded.To_String (Rule.Name));
end Print;
-- ------------------------------
-- Check if the value represents an integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Integer_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a number or integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Number_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a percentage.
-- ------------------------------
overriding
function Match (Rule : in Percentage_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a length.
-- ------------------------------
overriding
function Match (Rule : in Length_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
if Get_Type (Value) /= VALUE_NUMBER then
return False;
end if;
if Get_Unit (Value) in Length_Unit_Type then
return True;
end if;
if Get_Unit (Value) /= UNIT_NONE then
return False;
end if;
return Get_Value (Value) = "0";
end Match;
-- ------------------------------
-- Check if the value represents a time.
-- ------------------------------
overriding
function Match (Rule : in Time_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Time_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a resolution.
-- ------------------------------
overriding
function Match (Rule : in Resolution_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_PI;
end Match;
-- ------------------------------
-- Check if the value represents an angle.
-- ------------------------------
overriding
function Match (Rule : in Angle_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Angle_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a string.
-- ------------------------------
overriding
function Match (Rule : in String_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_STRING;
end Match;
-- ------------------------------
-- Check if the value represents a url.
-- ------------------------------
overriding
function Match (Rule : in URL_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_URL;
end Match;
-- ------------------------------
-- Check if the value represents an hexadecimal color.
-- ------------------------------
overriding
function Match (Rule : in Color_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_COLOR;
end Match;
-- ------------------------------
-- Check if the value represents a custom identifier.
-- ------------------------------
overriding
function Match (Rule : in Identifier_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_IDENT;
end Match;
-- ------------------------------
-- Register the builtin type in the repository.
-- ------------------------------
procedure Register_Builtin (Repository : in out Repository_Type;
Name : in String;
Rule : in Builtin_Rule_Type_Access;
Kind : in CSS.Core.Values.Value_Kind) is
begin
Rule.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name);
Repository.Types.Insert (Name, Rule.all'Access);
end Register_Builtin;
Int_Rule : aliased Types.Integer_Rule_Type;
Percent_Rule : aliased Types.Percentage_Rule_Type;
Length_Rule : aliased Types.Length_Rule_Type;
Number_Rule : aliased Types.Number_Rule_Type;
Angle_Rule : aliased Types.Angle_Rule_Type;
String_Rule : aliased Types.String_Rule_Type;
URL_Rule : aliased Types.URL_Rule_Type;
Color_Rule : aliased Types.Color_Rule_Type;
Ident_Rule : aliased Types.Identifier_Rule_Type;
Resolution_Rule : aliased Types.Resolution_Rule_Type;
Time_Rule : aliased Types.Time_Rule_Type;
procedure Register (Repository : in out Repository_Type) is
begin
Register_Builtin (Repository, "<angle>", Angle_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<integer>", Int_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<number>", Number_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<length>", Length_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<percentage>", Percent_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<string>", String_Rule'Access, VALUE_STRING);
Register_Builtin (Repository, "<url>", URL_Rule'Access, VALUE_URL);
Register_Builtin (Repository, "<hex-color>", Color_Rule'Access, VALUE_COLOR);
Register_Builtin (Repository, "<custom-ident>", Ident_Rule'Access, VALUE_IDENT);
Register_Builtin (Repository, "<resolution>", Resolution_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<time>", Time_Rule'Access, VALUE_NUMBER);
end Register;
end CSS.Analysis.Rules.Types;
| true |
-----------------------------------------------------------------------
-- css-analysis-rules-types -- Rules for CSS pre-defined value types
-- Copyright (C) 2017 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body CSS.Analysis.Rules.Types is
use CSS.Core.Values;
-- ------------------------------
-- Print the rule definition to the print stream.
-- ------------------------------
procedure Print (Rule : in Builtin_Rule_Type;
Stream : in out CSS.Printer.File_Type'Class) is
begin
Stream.Print (Ada.Strings.Unbounded.To_String (Rule.Name));
end Print;
-- ------------------------------
-- Check if the value represents an integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Integer_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a number or integer without unit.
-- ------------------------------
overriding
function Match (Rule : in Number_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a percentage.
-- ------------------------------
overriding
function Match (Rule : in Percentage_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE;
end Match;
-- ------------------------------
-- Check if the value represents a length.
-- ------------------------------
overriding
function Match (Rule : in Length_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
if Get_Type (Value) /= VALUE_NUMBER then
return False;
end if;
if Get_Unit (Value) in Length_Unit_Type then
return True;
end if;
if Get_Unit (Value) /= UNIT_NONE then
return False;
end if;
return Get_Value (Value) = "0";
end Match;
-- ------------------------------
-- Check if the value represents a time.
-- ------------------------------
overriding
function Match (Rule : in Time_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Time_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a resolution.
-- ------------------------------
overriding
function Match (Rule : in Resolution_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_PI;
end Match;
-- ------------------------------
-- Check if the value represents an angle.
-- ------------------------------
overriding
function Match (Rule : in Angle_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Angle_Unit_Type;
end Match;
-- ------------------------------
-- Check if the value represents a string.
-- ------------------------------
overriding
function Match (Rule : in String_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_STRING;
end Match;
-- ------------------------------
-- Check if the value represents a url.
-- ------------------------------
overriding
function Match (Rule : in URL_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_URL;
end Match;
-- ------------------------------
-- Check if the value represents an hexadecimal color.
-- ------------------------------
overriding
function Match (Rule : in Color_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_COLOR;
end Match;
-- ------------------------------
-- Check if the value represents a custom identifier.
-- ------------------------------
overriding
function Match (Rule : in Identifier_Rule_Type;
Value : in CSS.Core.Values.Value_Type) return Boolean is
pragma Unreferenced (Rule);
begin
return Get_Type (Value) = VALUE_IDENT;
end Match;
-- ------------------------------
-- Register the builtin type in the repository.
-- ------------------------------
procedure Register_Builtin (Repository : in out Repository_Type;
Name : in String;
Rule : in Builtin_Rule_Type_Access;
Kind : in CSS.Core.Values.Value_Kind) is
begin
Rule.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name);
Repository.Types.Insert (Name, Rule.all'Access);
end Register_Builtin;
Int_Rule : aliased Types.Integer_Rule_Type;
Percent_Rule : aliased Types.Percentage_Rule_Type;
Length_Rule : aliased Types.Length_Rule_Type;
Number_Rule : aliased Types.Number_Rule_Type;
Angle_Rule : aliased Types.Angle_Rule_Type;
String_Rule : aliased Types.String_Rule_Type;
URL_Rule : aliased Types.URL_Rule_Type;
Color_Rule : aliased Types.Color_Rule_Type;
Ident_Rule : aliased Types.Identifier_Rule_Type;
Resolution_Rule : aliased Types.Resolution_Rule_Type;
Time_Rule : aliased Types.Time_Rule_Type;
procedure Register (Repository : in out Repository_Type) is
begin
Register_Builtin (Repository, "<angle>", Angle_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<integer>", Int_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<number>", Number_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<length>", Length_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<percentage>", Percent_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<string>", String_Rule'Access, VALUE_STRING);
Register_Builtin (Repository, "<url>", URL_Rule'Access, VALUE_URL);
Register_Builtin (Repository, "<hex-color>", Color_Rule'Access, VALUE_COLOR);
Register_Builtin (Repository, "<custom-ident>", Ident_Rule'Access, VALUE_IDENT);
Register_Builtin (Repository, "<resolution>", Resolution_Rule'Access, VALUE_NUMBER);
Register_Builtin (Repository, "<time>", Time_Rule'Access, VALUE_NUMBER);
end Register;
end CSS.Analysis.Rules.Types;
|
[
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- Al",
"end": 824,
"score": 0.999889075756073,
"start": 811,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 844,
"score": 0.999931812286377,
"start": 826,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": " --\n-- * Neither the name of the Vadim Godunko, IE nor the names of its --\n-- contribu",
"end": 1939,
"score": 0.739057719707489,
"start": 1926,
"tag": "NAME",
"value": "Vadim Godunko"
}
] |
source/web/soap/web_services-soap-messages.adb
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Strings.Hash;
with Ada.Tags;
with Ada.Unchecked_Deallocation;
package body Web_Services.SOAP.Messages is
--------------
-- Finalize --
--------------
procedure Finalize (Self : in out SOAP_Message) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Headers.Abstract_SOAP_Header'Class,
Web_Services.SOAP.Headers.SOAP_Header_Access);
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Payloads.Abstract_SOAP_Payload'Class,
Web_Services.SOAP.Payloads.SOAP_Payload_Access);
Position : Header_Sets.Cursor;
Header : Web_Services.SOAP.Headers.SOAP_Header_Access;
begin
while not Self.Headers.Is_Empty loop
Position := Self.Headers.First;
Header := Header_Sets.Element (Position);
Self.Headers.Delete (Position);
Free (Header);
end loop;
Free (Self.Payload);
end Finalize;
----------
-- Free --
----------
procedure Free (Message : in out SOAP_Message_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Messages.SOAP_Message,
Web_Services.SOAP.Messages.SOAP_Message_Access);
begin
if Message /= null then
Finalize (Message.all);
Free (Message);
end if;
end Free;
----------
-- Hash --
----------
function Hash
(Item : Web_Services.SOAP.Headers.SOAP_Header_Access)
return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Hash (Ada.Tags.External_Tag (Item'Tag));
end Hash;
end Web_Services.SOAP.Messages;
|
10354
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- 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 <NAME>, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Strings.Hash;
with Ada.Tags;
with Ada.Unchecked_Deallocation;
package body Web_Services.SOAP.Messages is
--------------
-- Finalize --
--------------
procedure Finalize (Self : in out SOAP_Message) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Headers.Abstract_SOAP_Header'Class,
Web_Services.SOAP.Headers.SOAP_Header_Access);
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Payloads.Abstract_SOAP_Payload'Class,
Web_Services.SOAP.Payloads.SOAP_Payload_Access);
Position : Header_Sets.Cursor;
Header : Web_Services.SOAP.Headers.SOAP_Header_Access;
begin
while not Self.Headers.Is_Empty loop
Position := Self.Headers.First;
Header := Header_Sets.Element (Position);
Self.Headers.Delete (Position);
Free (Header);
end loop;
Free (Self.Payload);
end Finalize;
----------
-- Free --
----------
procedure Free (Message : in out SOAP_Message_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Messages.SOAP_Message,
Web_Services.SOAP.Messages.SOAP_Message_Access);
begin
if Message /= null then
Finalize (Message.all);
Free (Message);
end if;
end Free;
----------
-- Hash --
----------
function Hash
(Item : Web_Services.SOAP.Headers.SOAP_Header_Access)
return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Hash (Ada.Tags.External_Tag (Item'Tag));
end Hash;
end Web_Services.SOAP.Messages;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- 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 PI:NAME:<NAME>END_PI, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Strings.Hash;
with Ada.Tags;
with Ada.Unchecked_Deallocation;
package body Web_Services.SOAP.Messages is
--------------
-- Finalize --
--------------
procedure Finalize (Self : in out SOAP_Message) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Headers.Abstract_SOAP_Header'Class,
Web_Services.SOAP.Headers.SOAP_Header_Access);
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Payloads.Abstract_SOAP_Payload'Class,
Web_Services.SOAP.Payloads.SOAP_Payload_Access);
Position : Header_Sets.Cursor;
Header : Web_Services.SOAP.Headers.SOAP_Header_Access;
begin
while not Self.Headers.Is_Empty loop
Position := Self.Headers.First;
Header := Header_Sets.Element (Position);
Self.Headers.Delete (Position);
Free (Header);
end loop;
Free (Self.Payload);
end Finalize;
----------
-- Free --
----------
procedure Free (Message : in out SOAP_Message_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Web_Services.SOAP.Messages.SOAP_Message,
Web_Services.SOAP.Messages.SOAP_Message_Access);
begin
if Message /= null then
Finalize (Message.all);
Free (Message);
end if;
end Free;
----------
-- Hash --
----------
function Hash
(Item : Web_Services.SOAP.Headers.SOAP_Header_Access)
return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Hash (Ada.Tags.External_Tag (Item'Tag));
end Hash;
end Web_Services.SOAP.Messages;
|
[
{
"context": " --\n-- * Richard Wai (ANNEXI-STRAYLINE) ",
"end": 807,
"score": 0.9997877478599548,
"start": 796,
"tag": "NAME",
"value": "Richard Wai"
}
] |
cli-widgets-progress_bars.ads
|
annexi-strayline/ASAP-CLI
| 0 |
------------------------------------------------------------------------------
-- --
-- Command Line Interface Toolkit --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
package CLI.Widgets.Progress_Bars is
type Percentage is range 0 .. 100;
type Progress_Bar (Delimited: Boolean := True) is
record
Percent: Percentage := 0;
-- The percent value of the bar
Width: Positive := 10;
-- Width in chracters of the progress bar, not including
-- delimiters
Column: Natural := 1;
-- Which column the bar should be rendered at
Fill_Char : Wide_Wide_Character := '=';
Fill_Style: Text_Style := Neutral;
-- The character used to fill the "completed" area
Empty_Char : Wide_Wide_Character := ' ';
Empty_Style: Text_Style := Neutral;
case Delimited is
when True =>
Left_Delimiter: Wide_Wide_Character := '[';
Left_Delimiter_Style: Text_Style := Neutral;
Right_Delimiter: Wide_Wide_Character := ']';
Right_Delimiter_Style: Text_Style := Neutral;
when False =>
null;
end case;
-- All Wide_Wide_Characters will be encoded as UTF-8 when
-- output to the terminal
end record;
procedure Render (Bar : in out Progress_Bar;
Column: in Positive := Current_Column);
-- Sets the Bar's Column to Column and then Renders the Bar. The cursor is
-- moved (ends one column past the end of the bar)
procedure Update (Bar: in out Progress_Bar);
-- Re-renders an existing bar (typically when the progress property is
-- updated). This does not update delimiters.
end CLI.Widgets.Progress_Bars;
|
17234
|
------------------------------------------------------------------------------
-- --
-- Command Line Interface Toolkit --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
package CLI.Widgets.Progress_Bars is
type Percentage is range 0 .. 100;
type Progress_Bar (Delimited: Boolean := True) is
record
Percent: Percentage := 0;
-- The percent value of the bar
Width: Positive := 10;
-- Width in chracters of the progress bar, not including
-- delimiters
Column: Natural := 1;
-- Which column the bar should be rendered at
Fill_Char : Wide_Wide_Character := '=';
Fill_Style: Text_Style := Neutral;
-- The character used to fill the "completed" area
Empty_Char : Wide_Wide_Character := ' ';
Empty_Style: Text_Style := Neutral;
case Delimited is
when True =>
Left_Delimiter: Wide_Wide_Character := '[';
Left_Delimiter_Style: Text_Style := Neutral;
Right_Delimiter: Wide_Wide_Character := ']';
Right_Delimiter_Style: Text_Style := Neutral;
when False =>
null;
end case;
-- All Wide_Wide_Characters will be encoded as UTF-8 when
-- output to the terminal
end record;
procedure Render (Bar : in out Progress_Bar;
Column: in Positive := Current_Column);
-- Sets the Bar's Column to Column and then Renders the Bar. The cursor is
-- moved (ends one column past the end of the bar)
procedure Update (Bar: in out Progress_Bar);
-- Re-renders an existing bar (typically when the progress property is
-- updated). This does not update delimiters.
end CLI.Widgets.Progress_Bars;
| true |
------------------------------------------------------------------------------
-- --
-- Command Line Interface Toolkit --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * PI:NAME:<NAME>END_PI (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
package CLI.Widgets.Progress_Bars is
type Percentage is range 0 .. 100;
type Progress_Bar (Delimited: Boolean := True) is
record
Percent: Percentage := 0;
-- The percent value of the bar
Width: Positive := 10;
-- Width in chracters of the progress bar, not including
-- delimiters
Column: Natural := 1;
-- Which column the bar should be rendered at
Fill_Char : Wide_Wide_Character := '=';
Fill_Style: Text_Style := Neutral;
-- The character used to fill the "completed" area
Empty_Char : Wide_Wide_Character := ' ';
Empty_Style: Text_Style := Neutral;
case Delimited is
when True =>
Left_Delimiter: Wide_Wide_Character := '[';
Left_Delimiter_Style: Text_Style := Neutral;
Right_Delimiter: Wide_Wide_Character := ']';
Right_Delimiter_Style: Text_Style := Neutral;
when False =>
null;
end case;
-- All Wide_Wide_Characters will be encoded as UTF-8 when
-- output to the terminal
end record;
procedure Render (Bar : in out Progress_Bar;
Column: in Positive := Current_Column);
-- Sets the Bar's Column to Column and then Renders the Bar. The cursor is
-- moved (ends one column past the end of the bar)
procedure Update (Bar: in out Progress_Bar);
-- Re-renders an existing bar (typically when the progress property is
-- updated). This does not update delimiters.
end CLI.Widgets.Progress_Bars;
|
[
{
"context": " --\n-- @author Julio C. Gobbi --",
"end": 2635,
"score": 0.9998526573181152,
"start": 2621,
"tag": "NAME",
"value": "Julio C. Gobbi"
}
] |
ADL/devices/stm32-device.ads
|
JCGobbi/Nucleo-STM32F334R8
| 0 |
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, 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 is based on: --
-- --
-- @file stm32f334x8.h --
-- @author Julio C. Gobbi --
-- @version V1.0.0 --
-- @date 24-March-2021 --
-- @brief CMSIS STM32F334xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides declarations for devices on the STM32F334x8 MCUs
-- manufactured by ST Microelectronics. For example, an STM32F334R8.
with STM32_SVD; use STM32_SVD;
-- with STM32_SVD.SYSCFG; -- Enable for COMP and OPAMP
with STM32.GPIO; use STM32.GPIO;
with STM32.ADC; use STM32.ADC;
-- with STM32.DAC; use STM32.DAC;
-- with STM32.CRC; use STM32.CRC;
-- with STM32.DMA; use STM32.DMA;
-- with STM32.USARTs; use STM32.USARTs;
-- with STM32.SPI; use STM32.SPI;
-- with STM32.I2C; use STM32.I2C;
-- with STM32.RTC; use STM32.RTC;
with STM32.Timers; use STM32.Timers;
-- with STM32.HRTimers; use STM32.HRTimers;
-- with STM32.OPAMP; use STM32.OPAMP;
-- with STM32.COMP; use STM32.COMP;
-- with STM32.CAN; use STM32.CAN;
package STM32.Device is
pragma Elaborate_Body;
Unknown_Device : exception;
-- Raised by the routines below for a device passed as an actual parameter
-- when that device is not present on the given hardware instance.
-----------------------
-- CPU Clock Sources --
-----------------------
HSE_VALUE : constant := 8_000_000;
-- External oscillator in Hz
-- LSE_VALUE : constant := 32_768;
-- Low-Speed external oscillator in Hz
HSI_VALUE : constant := 8_000_000;
-- Internal oscillator in Hz
-- LSI_VALUE : constant := 40_000;
-- Low-Speed internal oscillator in Hz
----------
-- GPIO --
----------
procedure Enable_Clock (This : aliased GPIO_Port);
procedure Enable_Clock (Point : GPIO_Point);
procedure Enable_Clock (Points : GPIO_Points);
procedure Reset (This : aliased GPIO_Port)
with Inline;
procedure Reset (Point : GPIO_Point)
with Inline;
procedure Reset (Points : GPIO_Points)
with Inline;
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4
with Inline;
GPIO_A : aliased GPIO_Port with Import, Volatile, Address => GPIOA_Base;
GPIO_B : aliased GPIO_Port with Import, Volatile, Address => GPIOB_Base;
GPIO_C : aliased GPIO_Port with Import, Volatile, Address => GPIOC_Base;
GPIO_D : aliased GPIO_Port with Import, Volatile, Address => GPIOD_Base;
GPIO_F : aliased GPIO_Port with Import, Volatile, Address => GPIOF_Base;
PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0);
PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1);
PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2);
PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3);
PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4);
PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5);
PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6);
PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7);
PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8);
PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9);
PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10);
PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11);
PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12);
PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13);
PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14);
PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15);
PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0);
PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1);
PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2);
PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3);
PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4);
PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5);
PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6);
PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7);
PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8);
PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9);
PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10);
PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11);
PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12);
PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13);
PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14);
PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15);
PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0);
PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1);
PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2);
PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3);
PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4);
PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5);
PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6);
PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7);
PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8);
PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9);
PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10);
PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11);
PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12);
PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13);
PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14);
PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15);
PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0);
PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1);
PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2);
PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3);
PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4);
PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5);
PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6);
PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7);
PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8);
PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9);
PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10);
PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11);
PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12);
PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13);
PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14);
PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15);
PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0);
PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1);
PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2);
PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3);
PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4);
PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5);
PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6);
PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7);
PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8);
PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9);
PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10);
PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11);
PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12);
PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13);
PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14);
PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15);
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function;
---------
-- ADC --
---------
ADC_1 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC1_Base;
ADC_2 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC2_Base;
Temperature_Channel : constant Analog_Input_Channel := 16;
Temperature_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => Temperature_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VRef_Channel : constant Analog_Input_Channel := 18;
VRef_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VRef_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VBat_Channel : constant Analog_Input_Channel := 17;
VBat_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VBat_Channel);
VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel);
VBat_Bridge_Divisor : constant := 2;
-- The VBAT pin is internally connected to a bridge divider. The actual
-- voltage is the raw conversion value * the divisor. See section 13.3.31,
-- pg 276 of the RM.
VRef_OpAmp_2_Channel : constant Analog_Input_Channel := 17;
VRef_OpAmp_2_Sensor : constant ADC_Point :=
(ADC_2'Access, Channel => VRef_OpAmp_2_Channel);
-- see RM pg 224, section 13.3.11
procedure Enable_Clock (This : aliased Analog_To_Digital_Converter);
procedure Reset_All_ADC_Units;
type ADC_Clock_Source is (AHB, PLLCLK);
type ADC_Prescaler_Enum is
(DIV_1, DIV_2, DIV_4, DIV_6, DIV_8, DIV_10,
DIV_12, DIV_16, DIV_32, DIV_64, DIV_128, DIV_256)
with Size => 4;
type ADC_Prescaler is record
Enable : Boolean := False;
Value : ADC_Prescaler_Enum := ADC_Prescaler_Enum'First;
end record with Size => 5;
for ADC_Prescaler use record
Enable at 0 range 4 .. 4;
Value at 0 range 0 .. 3;
end record;
procedure Select_Clock_Source
(This : Analog_To_Digital_Converter;
Source : ADC_Clock_Source;
Prescaler : ADC_Prescaler := (Enable => False, Value => DIV_2));
-- Example to create a variable:
-- AHB_PRE : ADC_Prescaler := (Enable => True, Value => DIV2);
-- To disable (and use AHB) use:
-- AHB_PRE : ADC_Prescaler := (Enable => False, Value => DIV2);
---------
-- DAC --
---------
-- DAC_1 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC1_Base;
-- DAC_2 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC2_Base;
--
-- DAC_Channel_1_IO : GPIO_Point renames PA4;
-- DAC_Channel_2_IO : GPIO_Point renames PA5;
--
-- procedure Enable_Clock
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
--
-- procedure Reset
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
---------
-- CRC --
---------
-- CRC_Unit : CRC_32 with Import, Volatile, Address => CRC_Base;
-- procedure Enable_Clock (This : CRC_32) with Inline;
-- procedure Disable_Clock (This : CRC_32) with Inline;
-- procedure Reset (This : CRC_32);
---------
-- DMA --
---------
-- DMA_1 : aliased DMA_Controller
-- with Import, Volatile, Address => DMA_Base;
--
-- procedure Enable_Clock (This : aliased DMA_Controller);
-- procedure Reset (This : aliased DMA_Controller);
-----------
-- USART --
-----------
-- Internal_USART_1 : aliased Internal_USART
-- with Import, Volatile, Address => USART1_Base;
-- Internal_USART_2 : aliased Internal_USART
-- with Import, Volatile, Address => USART2_Base;
-- Internal_USART_3 : aliased Internal_USART
-- with Import, Volatile, Address => USART3_Base;
-- USART_1 : aliased USART (Internal_USART_1'Access);
-- USART_2 : aliased USART (Internal_USART_2'Access);
-- USART_3 : aliased USART (Internal_USART_3'Access);
-- procedure Enable_Clock (This : aliased USART);
-- procedure Reset (This : aliased USART);
-- type USART_Clock_Source is (PCLK, SYSCLK, LSE, HSI);
-- procedure Select_Clock_Source
-- (This : USART;
-- Source : USART_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for USART1.
-- function Read_Clock_Source (This : USART) return USART_Clock_Source;
---------
-- CAN --
---------
-- CAN_1 : aliased CAN_Controller with Volatile, Import, Address => CAN_Base;
-- procedure Enable_Clock (This : aliased CAN_Controller);
-- procedure Reset (This : aliased CAN_Controller);
---------
-- I2C --
---------
-- Internal_I2C_Port_1 : aliased Internal_I2C_Port
-- with Import, Volatile, Address => I2C_Base;
--
-- type I2C_Port_Id is (I2C_Id_1);
--
-- I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access);
--
-- -- I2C_1_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_1'Access);
--
-- function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline;
--
-- procedure Enable_Clock (This : aliased I2C_Port'Class);
-- procedure Enable_Clock (This : I2C_Port_Id);
--
-- procedure Reset (This : I2C_Port'Class);
-- procedure Reset (This : I2C_Port_Id);
-- type I2C_Clock_Source is (HSI, SYSCLK);
--
-- procedure Select_Clock_Source (This : I2C_Port'Class;
-- Source : I2C_Clock_Source);
--
-- procedure Select_Clock_Source (This : I2C_Port_Id;
-- Source : I2C_Clock_Source);
-- -- Set I2C Clock Mux source.
--
-- function Read_Clock_Source (This : I2C_Port'Class) return I2C_Clock_Source;
--
-- function Read_Clock_Source (This : I2C_Port_Id) return I2C_Clock_Source;
-- -- Return I2C Clock Mux source.
---------
-- SPI --
---------
-- Internal_SPI_1 : aliased Internal_SPI_Port
-- with Import, Volatile, Address => SPI_Base;
-- SPI_1 : aliased SPI_Port (Internal_SPI_1'Access);
-- SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access);
-- procedure Enable_Clock (This : SPI_Port'Class);
-- procedure Reset (This : SPI_Port'Class);
---------
-- RTC --
---------
-- RTC : aliased RTC_Device;
-- procedure Enable_Clock (This : RTC_Device);
--
-- type RTC_Clock_Source is (No_Clock, LSE, LSI, HSE)
-- with Size => 2;
--
-- procedure Select_Clock_Source
-- (This : RTC_Device;
-- Source : RTC_Clock_Source)
-- with Post => Source = Read_Clock_Source (This);
-- -- Set RTC Clock Mux source. Once the RTC clock source has been selected,
-- -- it cannot be changed anymore unless the RTC domain is reset, or unless
-- -- a failure is detected on LSE (LSECSSD is set). The BDRST bit can be used
-- -- to reset them.
-- -- The HSE clock is divided by 32 before entering the RTC to assure it is
-- -- < 1 MHz.
--
-- function Read_Clock_Source (This : RTC_Device) return RTC_Clock_Source;
-- -- Return RTC Clock Mux source.
-----------
-- Timer --
-----------
Timer_1 : aliased Timer with Import, Volatile, Address => TIM1_Base;
Timer_2 : aliased Timer with Import, Volatile, Address => TIM2_Base;
Timer_3 : aliased Timer with Import, Volatile, Address => TIM3_Base;
Timer_6 : aliased Timer with Import, Volatile, Address => TIM6_Base;
Timer_7 : aliased Timer with Import, Volatile, Address => TIM7_Base;
Timer_15 : aliased Timer with Import, Volatile, Address => TIM15_Base;
Timer_16 : aliased Timer with Import, Volatile, Address => TIM16_Base;
Timer_17 : aliased Timer with Import, Volatile, Address => TIM17_Base;
procedure Enable_Clock (This : Timer);
procedure Reset (This : Timer);
type Timer_Clock_Source is (PCLK2, PLLCLK);
procedure Select_Clock_Source
(This : Timer;
Source : Timer_Clock_Source)
with Post => Read_Clock_Source (This) = Source;
-- Set the clock for TIM1 to 2 x PLLCLK or PCLK2.
function Read_Clock_Source (This : Timer) return Timer_Clock_Source;
function Get_Clock_Frequency (This : Timer) return UInt32;
-- Returns the timer input frequency in Hz.
-------------
-- HRTimer --
-------------
-- HRTimer_M : aliased HRTimer_Master
-- with Import, Volatile, Address => HRTIM_Master_Base;
--
-- HRTimer_A : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMA_Base;
-- HRTimer_B : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMB_Base;
-- HRTimer_C : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMC_Base;
-- HRTimer_D : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMD_Base;
-- HRTimer_E : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIME_Base;
--
-- procedure Enable_Clock (This : HRTimer_Master);
--
-- procedure Enable_Clock (This : HRTimer_Channel);
--
-- procedure Reset (This : HRTimer_Master);
--
-- procedure Reset (This : HRTimer_Channel);
--
-- procedure Select_Clock_Source
-- (This : HRTimer_Master;
-- Source : Timer_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for HRTIM1 to 2 x PLLCLK or PCLK2.
--
-- function Read_Clock_Source (This : HRTimer_Master) return Timer_Clock_Source;
--
-- function Get_Clock_Frequency (This : HRTimer_Master) return UInt32;
-- -- Returns the timer input frequency in Hz.
--
-- function Get_Clock_Frequency (This : HRTimer_Channel) return UInt32;
-- -- Returns the HRTIM1 input frequency in Hz.
----------------
-- Comparator --
----------------
-- Comp_2 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP2_CSR'Address;
-- Comp_4 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP4_CSR'Address;
-- Comp_6 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP6_CSR'Address;
-----------
-- OpAmp --
-----------
-- Opamp_2 : aliased Operational_Amplifier
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.OPAMP2_CSR'Address;
-----------------------------
-- Reset and Clock Control --
-----------------------------
-- See RM pg. 107 for clock tree
type RCC_System_Clocks is record
SYSCLK : UInt32;
HCLK : UInt32;
PCLK1 : UInt32;
PCLK2 : UInt32;
TIMCLK1 : UInt32; -- For TIMs 2, 3, 6, 7
TIMCLK2 : UInt32; -- For TIMs 15, 16, 17
TIM1CLK : UInt32; -- For TIM1
HRTIM1CLK : UInt32; -- For HRTIM1
I2CCLK : UInt32;
end record;
function System_Clock_Frequencies return RCC_System_Clocks;
-- Returns each RCC system clock frequency in Hz.
private
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15;
end STM32.Device;
|
7977
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, 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 is based on: --
-- --
-- @file stm32f334x8.h --
-- @author <NAME> --
-- @version V1.0.0 --
-- @date 24-March-2021 --
-- @brief CMSIS STM32F334xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides declarations for devices on the STM32F334x8 MCUs
-- manufactured by ST Microelectronics. For example, an STM32F334R8.
with STM32_SVD; use STM32_SVD;
-- with STM32_SVD.SYSCFG; -- Enable for COMP and OPAMP
with STM32.GPIO; use STM32.GPIO;
with STM32.ADC; use STM32.ADC;
-- with STM32.DAC; use STM32.DAC;
-- with STM32.CRC; use STM32.CRC;
-- with STM32.DMA; use STM32.DMA;
-- with STM32.USARTs; use STM32.USARTs;
-- with STM32.SPI; use STM32.SPI;
-- with STM32.I2C; use STM32.I2C;
-- with STM32.RTC; use STM32.RTC;
with STM32.Timers; use STM32.Timers;
-- with STM32.HRTimers; use STM32.HRTimers;
-- with STM32.OPAMP; use STM32.OPAMP;
-- with STM32.COMP; use STM32.COMP;
-- with STM32.CAN; use STM32.CAN;
package STM32.Device is
pragma Elaborate_Body;
Unknown_Device : exception;
-- Raised by the routines below for a device passed as an actual parameter
-- when that device is not present on the given hardware instance.
-----------------------
-- CPU Clock Sources --
-----------------------
HSE_VALUE : constant := 8_000_000;
-- External oscillator in Hz
-- LSE_VALUE : constant := 32_768;
-- Low-Speed external oscillator in Hz
HSI_VALUE : constant := 8_000_000;
-- Internal oscillator in Hz
-- LSI_VALUE : constant := 40_000;
-- Low-Speed internal oscillator in Hz
----------
-- GPIO --
----------
procedure Enable_Clock (This : aliased GPIO_Port);
procedure Enable_Clock (Point : GPIO_Point);
procedure Enable_Clock (Points : GPIO_Points);
procedure Reset (This : aliased GPIO_Port)
with Inline;
procedure Reset (Point : GPIO_Point)
with Inline;
procedure Reset (Points : GPIO_Points)
with Inline;
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4
with Inline;
GPIO_A : aliased GPIO_Port with Import, Volatile, Address => GPIOA_Base;
GPIO_B : aliased GPIO_Port with Import, Volatile, Address => GPIOB_Base;
GPIO_C : aliased GPIO_Port with Import, Volatile, Address => GPIOC_Base;
GPIO_D : aliased GPIO_Port with Import, Volatile, Address => GPIOD_Base;
GPIO_F : aliased GPIO_Port with Import, Volatile, Address => GPIOF_Base;
PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0);
PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1);
PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2);
PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3);
PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4);
PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5);
PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6);
PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7);
PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8);
PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9);
PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10);
PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11);
PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12);
PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13);
PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14);
PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15);
PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0);
PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1);
PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2);
PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3);
PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4);
PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5);
PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6);
PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7);
PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8);
PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9);
PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10);
PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11);
PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12);
PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13);
PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14);
PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15);
PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0);
PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1);
PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2);
PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3);
PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4);
PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5);
PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6);
PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7);
PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8);
PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9);
PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10);
PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11);
PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12);
PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13);
PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14);
PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15);
PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0);
PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1);
PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2);
PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3);
PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4);
PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5);
PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6);
PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7);
PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8);
PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9);
PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10);
PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11);
PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12);
PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13);
PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14);
PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15);
PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0);
PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1);
PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2);
PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3);
PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4);
PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5);
PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6);
PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7);
PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8);
PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9);
PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10);
PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11);
PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12);
PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13);
PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14);
PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15);
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function;
---------
-- ADC --
---------
ADC_1 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC1_Base;
ADC_2 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC2_Base;
Temperature_Channel : constant Analog_Input_Channel := 16;
Temperature_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => Temperature_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VRef_Channel : constant Analog_Input_Channel := 18;
VRef_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VRef_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VBat_Channel : constant Analog_Input_Channel := 17;
VBat_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VBat_Channel);
VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel);
VBat_Bridge_Divisor : constant := 2;
-- The VBAT pin is internally connected to a bridge divider. The actual
-- voltage is the raw conversion value * the divisor. See section 13.3.31,
-- pg 276 of the RM.
VRef_OpAmp_2_Channel : constant Analog_Input_Channel := 17;
VRef_OpAmp_2_Sensor : constant ADC_Point :=
(ADC_2'Access, Channel => VRef_OpAmp_2_Channel);
-- see RM pg 224, section 13.3.11
procedure Enable_Clock (This : aliased Analog_To_Digital_Converter);
procedure Reset_All_ADC_Units;
type ADC_Clock_Source is (AHB, PLLCLK);
type ADC_Prescaler_Enum is
(DIV_1, DIV_2, DIV_4, DIV_6, DIV_8, DIV_10,
DIV_12, DIV_16, DIV_32, DIV_64, DIV_128, DIV_256)
with Size => 4;
type ADC_Prescaler is record
Enable : Boolean := False;
Value : ADC_Prescaler_Enum := ADC_Prescaler_Enum'First;
end record with Size => 5;
for ADC_Prescaler use record
Enable at 0 range 4 .. 4;
Value at 0 range 0 .. 3;
end record;
procedure Select_Clock_Source
(This : Analog_To_Digital_Converter;
Source : ADC_Clock_Source;
Prescaler : ADC_Prescaler := (Enable => False, Value => DIV_2));
-- Example to create a variable:
-- AHB_PRE : ADC_Prescaler := (Enable => True, Value => DIV2);
-- To disable (and use AHB) use:
-- AHB_PRE : ADC_Prescaler := (Enable => False, Value => DIV2);
---------
-- DAC --
---------
-- DAC_1 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC1_Base;
-- DAC_2 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC2_Base;
--
-- DAC_Channel_1_IO : GPIO_Point renames PA4;
-- DAC_Channel_2_IO : GPIO_Point renames PA5;
--
-- procedure Enable_Clock
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
--
-- procedure Reset
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
---------
-- CRC --
---------
-- CRC_Unit : CRC_32 with Import, Volatile, Address => CRC_Base;
-- procedure Enable_Clock (This : CRC_32) with Inline;
-- procedure Disable_Clock (This : CRC_32) with Inline;
-- procedure Reset (This : CRC_32);
---------
-- DMA --
---------
-- DMA_1 : aliased DMA_Controller
-- with Import, Volatile, Address => DMA_Base;
--
-- procedure Enable_Clock (This : aliased DMA_Controller);
-- procedure Reset (This : aliased DMA_Controller);
-----------
-- USART --
-----------
-- Internal_USART_1 : aliased Internal_USART
-- with Import, Volatile, Address => USART1_Base;
-- Internal_USART_2 : aliased Internal_USART
-- with Import, Volatile, Address => USART2_Base;
-- Internal_USART_3 : aliased Internal_USART
-- with Import, Volatile, Address => USART3_Base;
-- USART_1 : aliased USART (Internal_USART_1'Access);
-- USART_2 : aliased USART (Internal_USART_2'Access);
-- USART_3 : aliased USART (Internal_USART_3'Access);
-- procedure Enable_Clock (This : aliased USART);
-- procedure Reset (This : aliased USART);
-- type USART_Clock_Source is (PCLK, SYSCLK, LSE, HSI);
-- procedure Select_Clock_Source
-- (This : USART;
-- Source : USART_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for USART1.
-- function Read_Clock_Source (This : USART) return USART_Clock_Source;
---------
-- CAN --
---------
-- CAN_1 : aliased CAN_Controller with Volatile, Import, Address => CAN_Base;
-- procedure Enable_Clock (This : aliased CAN_Controller);
-- procedure Reset (This : aliased CAN_Controller);
---------
-- I2C --
---------
-- Internal_I2C_Port_1 : aliased Internal_I2C_Port
-- with Import, Volatile, Address => I2C_Base;
--
-- type I2C_Port_Id is (I2C_Id_1);
--
-- I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access);
--
-- -- I2C_1_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_1'Access);
--
-- function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline;
--
-- procedure Enable_Clock (This : aliased I2C_Port'Class);
-- procedure Enable_Clock (This : I2C_Port_Id);
--
-- procedure Reset (This : I2C_Port'Class);
-- procedure Reset (This : I2C_Port_Id);
-- type I2C_Clock_Source is (HSI, SYSCLK);
--
-- procedure Select_Clock_Source (This : I2C_Port'Class;
-- Source : I2C_Clock_Source);
--
-- procedure Select_Clock_Source (This : I2C_Port_Id;
-- Source : I2C_Clock_Source);
-- -- Set I2C Clock Mux source.
--
-- function Read_Clock_Source (This : I2C_Port'Class) return I2C_Clock_Source;
--
-- function Read_Clock_Source (This : I2C_Port_Id) return I2C_Clock_Source;
-- -- Return I2C Clock Mux source.
---------
-- SPI --
---------
-- Internal_SPI_1 : aliased Internal_SPI_Port
-- with Import, Volatile, Address => SPI_Base;
-- SPI_1 : aliased SPI_Port (Internal_SPI_1'Access);
-- SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access);
-- procedure Enable_Clock (This : SPI_Port'Class);
-- procedure Reset (This : SPI_Port'Class);
---------
-- RTC --
---------
-- RTC : aliased RTC_Device;
-- procedure Enable_Clock (This : RTC_Device);
--
-- type RTC_Clock_Source is (No_Clock, LSE, LSI, HSE)
-- with Size => 2;
--
-- procedure Select_Clock_Source
-- (This : RTC_Device;
-- Source : RTC_Clock_Source)
-- with Post => Source = Read_Clock_Source (This);
-- -- Set RTC Clock Mux source. Once the RTC clock source has been selected,
-- -- it cannot be changed anymore unless the RTC domain is reset, or unless
-- -- a failure is detected on LSE (LSECSSD is set). The BDRST bit can be used
-- -- to reset them.
-- -- The HSE clock is divided by 32 before entering the RTC to assure it is
-- -- < 1 MHz.
--
-- function Read_Clock_Source (This : RTC_Device) return RTC_Clock_Source;
-- -- Return RTC Clock Mux source.
-----------
-- Timer --
-----------
Timer_1 : aliased Timer with Import, Volatile, Address => TIM1_Base;
Timer_2 : aliased Timer with Import, Volatile, Address => TIM2_Base;
Timer_3 : aliased Timer with Import, Volatile, Address => TIM3_Base;
Timer_6 : aliased Timer with Import, Volatile, Address => TIM6_Base;
Timer_7 : aliased Timer with Import, Volatile, Address => TIM7_Base;
Timer_15 : aliased Timer with Import, Volatile, Address => TIM15_Base;
Timer_16 : aliased Timer with Import, Volatile, Address => TIM16_Base;
Timer_17 : aliased Timer with Import, Volatile, Address => TIM17_Base;
procedure Enable_Clock (This : Timer);
procedure Reset (This : Timer);
type Timer_Clock_Source is (PCLK2, PLLCLK);
procedure Select_Clock_Source
(This : Timer;
Source : Timer_Clock_Source)
with Post => Read_Clock_Source (This) = Source;
-- Set the clock for TIM1 to 2 x PLLCLK or PCLK2.
function Read_Clock_Source (This : Timer) return Timer_Clock_Source;
function Get_Clock_Frequency (This : Timer) return UInt32;
-- Returns the timer input frequency in Hz.
-------------
-- HRTimer --
-------------
-- HRTimer_M : aliased HRTimer_Master
-- with Import, Volatile, Address => HRTIM_Master_Base;
--
-- HRTimer_A : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMA_Base;
-- HRTimer_B : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMB_Base;
-- HRTimer_C : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMC_Base;
-- HRTimer_D : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMD_Base;
-- HRTimer_E : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIME_Base;
--
-- procedure Enable_Clock (This : HRTimer_Master);
--
-- procedure Enable_Clock (This : HRTimer_Channel);
--
-- procedure Reset (This : HRTimer_Master);
--
-- procedure Reset (This : HRTimer_Channel);
--
-- procedure Select_Clock_Source
-- (This : HRTimer_Master;
-- Source : Timer_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for HRTIM1 to 2 x PLLCLK or PCLK2.
--
-- function Read_Clock_Source (This : HRTimer_Master) return Timer_Clock_Source;
--
-- function Get_Clock_Frequency (This : HRTimer_Master) return UInt32;
-- -- Returns the timer input frequency in Hz.
--
-- function Get_Clock_Frequency (This : HRTimer_Channel) return UInt32;
-- -- Returns the HRTIM1 input frequency in Hz.
----------------
-- Comparator --
----------------
-- Comp_2 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP2_CSR'Address;
-- Comp_4 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP4_CSR'Address;
-- Comp_6 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP6_CSR'Address;
-----------
-- OpAmp --
-----------
-- Opamp_2 : aliased Operational_Amplifier
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.OPAMP2_CSR'Address;
-----------------------------
-- Reset and Clock Control --
-----------------------------
-- See RM pg. 107 for clock tree
type RCC_System_Clocks is record
SYSCLK : UInt32;
HCLK : UInt32;
PCLK1 : UInt32;
PCLK2 : UInt32;
TIMCLK1 : UInt32; -- For TIMs 2, 3, 6, 7
TIMCLK2 : UInt32; -- For TIMs 15, 16, 17
TIM1CLK : UInt32; -- For TIM1
HRTIM1CLK : UInt32; -- For HRTIM1
I2CCLK : UInt32;
end record;
function System_Clock_Frequencies return RCC_System_Clocks;
-- Returns each RCC system clock frequency in Hz.
private
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15;
end STM32.Device;
| true |
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, 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 is based on: --
-- --
-- @file stm32f334x8.h --
-- @author PI:NAME:<NAME>END_PI --
-- @version V1.0.0 --
-- @date 24-March-2021 --
-- @brief CMSIS STM32F334xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides declarations for devices on the STM32F334x8 MCUs
-- manufactured by ST Microelectronics. For example, an STM32F334R8.
with STM32_SVD; use STM32_SVD;
-- with STM32_SVD.SYSCFG; -- Enable for COMP and OPAMP
with STM32.GPIO; use STM32.GPIO;
with STM32.ADC; use STM32.ADC;
-- with STM32.DAC; use STM32.DAC;
-- with STM32.CRC; use STM32.CRC;
-- with STM32.DMA; use STM32.DMA;
-- with STM32.USARTs; use STM32.USARTs;
-- with STM32.SPI; use STM32.SPI;
-- with STM32.I2C; use STM32.I2C;
-- with STM32.RTC; use STM32.RTC;
with STM32.Timers; use STM32.Timers;
-- with STM32.HRTimers; use STM32.HRTimers;
-- with STM32.OPAMP; use STM32.OPAMP;
-- with STM32.COMP; use STM32.COMP;
-- with STM32.CAN; use STM32.CAN;
package STM32.Device is
pragma Elaborate_Body;
Unknown_Device : exception;
-- Raised by the routines below for a device passed as an actual parameter
-- when that device is not present on the given hardware instance.
-----------------------
-- CPU Clock Sources --
-----------------------
HSE_VALUE : constant := 8_000_000;
-- External oscillator in Hz
-- LSE_VALUE : constant := 32_768;
-- Low-Speed external oscillator in Hz
HSI_VALUE : constant := 8_000_000;
-- Internal oscillator in Hz
-- LSI_VALUE : constant := 40_000;
-- Low-Speed internal oscillator in Hz
----------
-- GPIO --
----------
procedure Enable_Clock (This : aliased GPIO_Port);
procedure Enable_Clock (Point : GPIO_Point);
procedure Enable_Clock (Points : GPIO_Points);
procedure Reset (This : aliased GPIO_Port)
with Inline;
procedure Reset (Point : GPIO_Point)
with Inline;
procedure Reset (Points : GPIO_Points)
with Inline;
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4
with Inline;
GPIO_A : aliased GPIO_Port with Import, Volatile, Address => GPIOA_Base;
GPIO_B : aliased GPIO_Port with Import, Volatile, Address => GPIOB_Base;
GPIO_C : aliased GPIO_Port with Import, Volatile, Address => GPIOC_Base;
GPIO_D : aliased GPIO_Port with Import, Volatile, Address => GPIOD_Base;
GPIO_F : aliased GPIO_Port with Import, Volatile, Address => GPIOF_Base;
PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0);
PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1);
PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2);
PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3);
PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4);
PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5);
PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6);
PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7);
PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8);
PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9);
PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10);
PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11);
PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12);
PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13);
PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14);
PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15);
PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0);
PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1);
PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2);
PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3);
PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4);
PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5);
PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6);
PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7);
PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8);
PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9);
PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10);
PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11);
PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12);
PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13);
PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14);
PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15);
PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0);
PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1);
PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2);
PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3);
PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4);
PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5);
PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6);
PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7);
PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8);
PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9);
PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10);
PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11);
PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12);
PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13);
PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14);
PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15);
PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0);
PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1);
PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2);
PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3);
PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4);
PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5);
PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6);
PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7);
PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8);
PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9);
PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10);
PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11);
PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12);
PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13);
PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14);
PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15);
PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0);
PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1);
PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2);
PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3);
PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4);
PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5);
PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6);
PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7);
PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8);
PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9);
PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10);
PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11);
PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12);
PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13);
PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14);
PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15);
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function;
---------
-- ADC --
---------
ADC_1 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC1_Base;
ADC_2 : aliased Analog_To_Digital_Converter
with Volatile, Import, Address => ADC2_Base;
Temperature_Channel : constant Analog_Input_Channel := 16;
Temperature_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => Temperature_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VRef_Channel : constant Analog_Input_Channel := 18;
VRef_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VRef_Channel);
-- see RM pg 274, section 13.3.30, also pg 214
VBat_Channel : constant Analog_Input_Channel := 17;
VBat_Sensor : constant ADC_Point :=
(ADC_1'Access, Channel => VBat_Channel);
VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel);
VBat_Bridge_Divisor : constant := 2;
-- The VBAT pin is internally connected to a bridge divider. The actual
-- voltage is the raw conversion value * the divisor. See section 13.3.31,
-- pg 276 of the RM.
VRef_OpAmp_2_Channel : constant Analog_Input_Channel := 17;
VRef_OpAmp_2_Sensor : constant ADC_Point :=
(ADC_2'Access, Channel => VRef_OpAmp_2_Channel);
-- see RM pg 224, section 13.3.11
procedure Enable_Clock (This : aliased Analog_To_Digital_Converter);
procedure Reset_All_ADC_Units;
type ADC_Clock_Source is (AHB, PLLCLK);
type ADC_Prescaler_Enum is
(DIV_1, DIV_2, DIV_4, DIV_6, DIV_8, DIV_10,
DIV_12, DIV_16, DIV_32, DIV_64, DIV_128, DIV_256)
with Size => 4;
type ADC_Prescaler is record
Enable : Boolean := False;
Value : ADC_Prescaler_Enum := ADC_Prescaler_Enum'First;
end record with Size => 5;
for ADC_Prescaler use record
Enable at 0 range 4 .. 4;
Value at 0 range 0 .. 3;
end record;
procedure Select_Clock_Source
(This : Analog_To_Digital_Converter;
Source : ADC_Clock_Source;
Prescaler : ADC_Prescaler := (Enable => False, Value => DIV_2));
-- Example to create a variable:
-- AHB_PRE : ADC_Prescaler := (Enable => True, Value => DIV2);
-- To disable (and use AHB) use:
-- AHB_PRE : ADC_Prescaler := (Enable => False, Value => DIV2);
---------
-- DAC --
---------
-- DAC_1 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC1_Base;
-- DAC_2 : aliased Digital_To_Analog_Converter
-- with Import, Volatile, Address => DAC2_Base;
--
-- DAC_Channel_1_IO : GPIO_Point renames PA4;
-- DAC_Channel_2_IO : GPIO_Point renames PA5;
--
-- procedure Enable_Clock
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
--
-- procedure Reset
-- (This : aliased Digital_To_Analog_Converter)
-- with Inline;
---------
-- CRC --
---------
-- CRC_Unit : CRC_32 with Import, Volatile, Address => CRC_Base;
-- procedure Enable_Clock (This : CRC_32) with Inline;
-- procedure Disable_Clock (This : CRC_32) with Inline;
-- procedure Reset (This : CRC_32);
---------
-- DMA --
---------
-- DMA_1 : aliased DMA_Controller
-- with Import, Volatile, Address => DMA_Base;
--
-- procedure Enable_Clock (This : aliased DMA_Controller);
-- procedure Reset (This : aliased DMA_Controller);
-----------
-- USART --
-----------
-- Internal_USART_1 : aliased Internal_USART
-- with Import, Volatile, Address => USART1_Base;
-- Internal_USART_2 : aliased Internal_USART
-- with Import, Volatile, Address => USART2_Base;
-- Internal_USART_3 : aliased Internal_USART
-- with Import, Volatile, Address => USART3_Base;
-- USART_1 : aliased USART (Internal_USART_1'Access);
-- USART_2 : aliased USART (Internal_USART_2'Access);
-- USART_3 : aliased USART (Internal_USART_3'Access);
-- procedure Enable_Clock (This : aliased USART);
-- procedure Reset (This : aliased USART);
-- type USART_Clock_Source is (PCLK, SYSCLK, LSE, HSI);
-- procedure Select_Clock_Source
-- (This : USART;
-- Source : USART_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for USART1.
-- function Read_Clock_Source (This : USART) return USART_Clock_Source;
---------
-- CAN --
---------
-- CAN_1 : aliased CAN_Controller with Volatile, Import, Address => CAN_Base;
-- procedure Enable_Clock (This : aliased CAN_Controller);
-- procedure Reset (This : aliased CAN_Controller);
---------
-- I2C --
---------
-- Internal_I2C_Port_1 : aliased Internal_I2C_Port
-- with Import, Volatile, Address => I2C_Base;
--
-- type I2C_Port_Id is (I2C_Id_1);
--
-- I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access);
--
-- -- I2C_1_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_1'Access);
--
-- function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline;
--
-- procedure Enable_Clock (This : aliased I2C_Port'Class);
-- procedure Enable_Clock (This : I2C_Port_Id);
--
-- procedure Reset (This : I2C_Port'Class);
-- procedure Reset (This : I2C_Port_Id);
-- type I2C_Clock_Source is (HSI, SYSCLK);
--
-- procedure Select_Clock_Source (This : I2C_Port'Class;
-- Source : I2C_Clock_Source);
--
-- procedure Select_Clock_Source (This : I2C_Port_Id;
-- Source : I2C_Clock_Source);
-- -- Set I2C Clock Mux source.
--
-- function Read_Clock_Source (This : I2C_Port'Class) return I2C_Clock_Source;
--
-- function Read_Clock_Source (This : I2C_Port_Id) return I2C_Clock_Source;
-- -- Return I2C Clock Mux source.
---------
-- SPI --
---------
-- Internal_SPI_1 : aliased Internal_SPI_Port
-- with Import, Volatile, Address => SPI_Base;
-- SPI_1 : aliased SPI_Port (Internal_SPI_1'Access);
-- SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access);
-- procedure Enable_Clock (This : SPI_Port'Class);
-- procedure Reset (This : SPI_Port'Class);
---------
-- RTC --
---------
-- RTC : aliased RTC_Device;
-- procedure Enable_Clock (This : RTC_Device);
--
-- type RTC_Clock_Source is (No_Clock, LSE, LSI, HSE)
-- with Size => 2;
--
-- procedure Select_Clock_Source
-- (This : RTC_Device;
-- Source : RTC_Clock_Source)
-- with Post => Source = Read_Clock_Source (This);
-- -- Set RTC Clock Mux source. Once the RTC clock source has been selected,
-- -- it cannot be changed anymore unless the RTC domain is reset, or unless
-- -- a failure is detected on LSE (LSECSSD is set). The BDRST bit can be used
-- -- to reset them.
-- -- The HSE clock is divided by 32 before entering the RTC to assure it is
-- -- < 1 MHz.
--
-- function Read_Clock_Source (This : RTC_Device) return RTC_Clock_Source;
-- -- Return RTC Clock Mux source.
-----------
-- Timer --
-----------
Timer_1 : aliased Timer with Import, Volatile, Address => TIM1_Base;
Timer_2 : aliased Timer with Import, Volatile, Address => TIM2_Base;
Timer_3 : aliased Timer with Import, Volatile, Address => TIM3_Base;
Timer_6 : aliased Timer with Import, Volatile, Address => TIM6_Base;
Timer_7 : aliased Timer with Import, Volatile, Address => TIM7_Base;
Timer_15 : aliased Timer with Import, Volatile, Address => TIM15_Base;
Timer_16 : aliased Timer with Import, Volatile, Address => TIM16_Base;
Timer_17 : aliased Timer with Import, Volatile, Address => TIM17_Base;
procedure Enable_Clock (This : Timer);
procedure Reset (This : Timer);
type Timer_Clock_Source is (PCLK2, PLLCLK);
procedure Select_Clock_Source
(This : Timer;
Source : Timer_Clock_Source)
with Post => Read_Clock_Source (This) = Source;
-- Set the clock for TIM1 to 2 x PLLCLK or PCLK2.
function Read_Clock_Source (This : Timer) return Timer_Clock_Source;
function Get_Clock_Frequency (This : Timer) return UInt32;
-- Returns the timer input frequency in Hz.
-------------
-- HRTimer --
-------------
-- HRTimer_M : aliased HRTimer_Master
-- with Import, Volatile, Address => HRTIM_Master_Base;
--
-- HRTimer_A : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMA_Base;
-- HRTimer_B : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMB_Base;
-- HRTimer_C : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMC_Base;
-- HRTimer_D : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIMD_Base;
-- HRTimer_E : aliased HRTimer_Channel
-- with Import, Volatile, Address => HRTIM_TIME_Base;
--
-- procedure Enable_Clock (This : HRTimer_Master);
--
-- procedure Enable_Clock (This : HRTimer_Channel);
--
-- procedure Reset (This : HRTimer_Master);
--
-- procedure Reset (This : HRTimer_Channel);
--
-- procedure Select_Clock_Source
-- (This : HRTimer_Master;
-- Source : Timer_Clock_Source)
-- with Post => Read_Clock_Source (This) = Source;
-- -- Set the clock for HRTIM1 to 2 x PLLCLK or PCLK2.
--
-- function Read_Clock_Source (This : HRTimer_Master) return Timer_Clock_Source;
--
-- function Get_Clock_Frequency (This : HRTimer_Master) return UInt32;
-- -- Returns the timer input frequency in Hz.
--
-- function Get_Clock_Frequency (This : HRTimer_Channel) return UInt32;
-- -- Returns the HRTIM1 input frequency in Hz.
----------------
-- Comparator --
----------------
-- Comp_2 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP2_CSR'Address;
-- Comp_4 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP4_CSR'Address;
-- Comp_6 : aliased Comparator
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.COMP6_CSR'Address;
-----------
-- OpAmp --
-----------
-- Opamp_2 : aliased Operational_Amplifier
-- with Import, Volatile,
-- Address => STM32_SVD.SYSCFG.SYSCFG_COMP_OPAMP_Periph.OPAMP2_CSR'Address;
-----------------------------
-- Reset and Clock Control --
-----------------------------
-- See RM pg. 107 for clock tree
type RCC_System_Clocks is record
SYSCLK : UInt32;
HCLK : UInt32;
PCLK1 : UInt32;
PCLK2 : UInt32;
TIMCLK1 : UInt32; -- For TIMs 2, 3, 6, 7
TIMCLK2 : UInt32; -- For TIMs 15, 16, 17
TIM1CLK : UInt32; -- For TIM1
HRTIM1CLK : UInt32; -- For HRTIM1
I2CCLK : UInt32;
end record;
function System_Clock_Frequencies return RCC_System_Clocks;
-- Returns each RCC system clock frequency in Hz.
private
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM15_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM16_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM17_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_EVENT_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM1_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM15_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM16_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_HRTIM1_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TSC_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_TIM1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_INFRARED_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_TIM1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_INFRARED_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP6_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_COMP2_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP4_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_COMP6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_CAN_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM1_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM15_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM2_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM3_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM17_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_TIM1_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_HRTIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_TIM1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_HRTIM1_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_OPAMP2_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15;
end STM32.Device;
|
[
{
"context": "---------------------------\n-- Copyright (c) 2013, Felix Krause <[email protected]>\n--\n-- Permission to use, copy,",
"end": 116,
"score": 0.9998548626899719,
"start": 104,
"tag": "NAME",
"value": "Felix Krause"
},
{
"context": "------------\n-- Copyright (c) 2013, Felix Krause <[email protected]>\n--\n-- Permission to use, copy, modify, and/or di",
"end": 134,
"score": 0.9999304413795471,
"start": 118,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/implementation/cl.adb
|
flyx/OpenCLAda
| 8 |
--------------------------------------------------------------------------------
-- Copyright (c) 2013, Felix Krause <[email protected]>
--
-- 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 Ada.Strings.Fixed;
with Ada.Strings;
package body CL is
use Ada.Strings;
use Ada.Strings.Fixed;
function "=" (Left, Right : CL_Object) return Boolean is
use type System.Address;
begin
return Left.Location = Right.Location;
end "=";
function Initialized (Object : Runtime_Object) return Boolean is
use type System.Address;
begin
return Object.Location /= System.Null_Address;
end Initialized;
function Raw (Source : Runtime_Object) return System.Address is
begin
return Source.Location;
end Raw;
function To_String (Value : Char) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Short) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Int) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Long) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UChar) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UShort) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UInt) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : ULong) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : CL.Float) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function Float_Equals (Left, Right : Float) return Boolean is
begin
return abs (Left - Right) <= Epsilon;
end Float_Equals;
end CL;
|
15407
|
--------------------------------------------------------------------------------
-- Copyright (c) 2013, <NAME> <<EMAIL>>
--
-- 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 Ada.Strings.Fixed;
with Ada.Strings;
package body CL is
use Ada.Strings;
use Ada.Strings.Fixed;
function "=" (Left, Right : CL_Object) return Boolean is
use type System.Address;
begin
return Left.Location = Right.Location;
end "=";
function Initialized (Object : Runtime_Object) return Boolean is
use type System.Address;
begin
return Object.Location /= System.Null_Address;
end Initialized;
function Raw (Source : Runtime_Object) return System.Address is
begin
return Source.Location;
end Raw;
function To_String (Value : Char) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Short) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Int) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Long) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UChar) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UShort) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UInt) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : ULong) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : CL.Float) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function Float_Equals (Left, Right : Float) return Boolean is
begin
return abs (Left - Right) <= Epsilon;
end Float_Equals;
end CL;
| true |
--------------------------------------------------------------------------------
-- Copyright (c) 2013, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- 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 Ada.Strings.Fixed;
with Ada.Strings;
package body CL is
use Ada.Strings;
use Ada.Strings.Fixed;
function "=" (Left, Right : CL_Object) return Boolean is
use type System.Address;
begin
return Left.Location = Right.Location;
end "=";
function Initialized (Object : Runtime_Object) return Boolean is
use type System.Address;
begin
return Object.Location /= System.Null_Address;
end Initialized;
function Raw (Source : Runtime_Object) return System.Address is
begin
return Source.Location;
end Raw;
function To_String (Value : Char) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Short) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Int) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : Long) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UChar) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UShort) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : UInt) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : ULong) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function To_String (Value : CL.Float) return String is
begin
return Trim (Value'Img, Both);
end To_String;
function Float_Equals (Left, Right : Float) return Boolean is
begin
return abs (Left - Right) <= Epsilon;
end Float_Equals;
end CL;
|
[
{
"context": "-- Test AKT with GPG2\n-- Copyright (C) 2019, 2020 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 161,
"score": 0.9998839497566223,
"start": 146,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "ight (C) 2019, 2020 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 192,
"score": 0.9998865127563477,
"start": 177,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "0 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 219,
"score": 0.9999263882637024,
"start": 194,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "te (Tool (User_1) & \" create -k \" & Path & \" --gpg [email protected]\",\n Result);\n T.Assert (Ada.D",
"end": 5885,
"score": 0.9998716711997986,
"start": 5858,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "te (Tool (User_1) & \" create -k \" & Path & \" --gpg [email protected] \" &\n \"[email protected]",
"end": 7617,
"score": 0.9998989105224609,
"start": 7590,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "[email protected] \" &\n \"[email protected] [email protected]\",\n Re",
"end": 7667,
"score": 0.9998734593391418,
"start": 7640,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": " \" &\n \"[email protected] [email protected]\",\n Result);\n T.Assert (Ada.D",
"end": 7695,
"score": 0.999894917011261,
"start": 7668,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "\" & Path &\n \" -p gpg-admin --gpg [email protected]\",\n Result);\n\n -- Set proper",
"end": 11243,
"score": 0.9980010390281677,
"start": 11216,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "ed result\");\n\n -- Add again GPG password for User_2\n T.Execute (Tool (User_2) & \" password-add \"",
"end": 13208,
"score": 0.6551571488380432,
"start": 13202,
"tag": "USERNAME",
"value": "User_2"
},
{
"context": "\" & Path &\n \" -p gpg-admin --gpg [email protected]\",\n Result);\n\n end Test_Remove_P",
"end": 13335,
"score": 0.9997650980949402,
"start": 13308,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/keystore-gpg_tests.adb
|
My-Colaborations/ada-keystore
| 0 |
-----------------------------------------------------------------------
-- keystore-gpg_tests -- Test AKT with GPG2
-- Copyright (C) 2019, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Directories;
with Util.Test_Caller;
with Util.Encoders.AES;
with Util.Log.Loggers;
with Util.Processes;
with Util.Streams.Buffered;
with Util.Streams.Pipes;
with Keystore.Tests;
package body Keystore.GPG_Tests is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.GPG_Tests");
TEST_TOOL_PATH : constant String := "regtests/result/test-gpg-1.akt";
TEST_TOOL2_PATH : constant String := "regtests/result/test-gpg-2.akt";
TEST_TOOL3_PATH : constant String := "regtests/result/test-gpg-3.akt";
type User_Type is (User_1, User_2, User_3);
function Tool (User : in User_Type) return String;
package Caller is new Util.Test_Caller (Test, "AKT.GPG");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG)",
Test_Create'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG++)",
Test_Create_Multi_User'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Info (GPG)",
Test_Info'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password (GPG)",
Test_Add_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password.Remove (GPG)",
Test_Remove_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (Update)",
Test_Update_File'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (GPG Error)",
Test_GPG_Error'Access);
end Add_Tests;
-- ------------------------------
-- Get the tool command for a given user
-- ------------------------------
function Tool (User : in User_Type) return String is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
begin
case User is
when User_1 =>
return "bin/akt --config " & Path & "user1-akt.properties";
when User_2 =>
return "bin/akt --config " & Path & "user2-akt.properties";
when User_3 =>
return "bin/akt --config " & Path & "user3-akt.properties";
end case;
end Tool;
-- ------------------------------
-- Execute the command and get the output in a string.
-- ------------------------------
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
P : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
begin
if Input'Length > 0 then
Log.Info ("Execute: {0} < {1}", Command, Input);
elsif Output'Length > 0 then
Log.Info ("Execute: {0} > {1}", Command, Output);
else
Log.Info ("Execute: {0}", Command);
end if;
P.Set_Input_Stream (Input);
P.Set_Output_Stream (Output);
P.Open (Command, Util.Processes.READ_ALL);
-- Write on the process input stream.
Result := Ada.Strings.Unbounded.Null_Unbounded_String;
Buffer.Initialize (P'Unchecked_Access, 8192);
Buffer.Read (Result);
P.Close;
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String (Result));
Log.Info ("Command result: {0}", Result);
Util.Tests.Assert_Equals (T, Status, P.Get_Exit_Status, "Command '" & Command & "' failed");
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
begin
T.Execute (Command, "", "", Result, Status);
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Expect : in String;
Status : in Natural := 0) is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/expect/" & Expect);
Output : constant String := Util.Tests.Get_Test_Path ("regtests/result/" & Expect);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Command, "", Output, Result, Status);
Util.Tests.Assert_Equal_Files (T, Path, Output, "Command '" & Command & "' invalid output");
end Execute;
-- ------------------------------
-- Test the akt keystore creation.
-- ------------------------------
procedure Test_Create (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg [email protected]",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result, "list command failed");
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
T.Execute (Tool (User_1) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result, "get command failed");
-- List content => one entry
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed");
-- Open keystore with another user GPG configuration should fail
T.Execute (Tool (User_2) & " list -k " & Path, Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "list command failed");
end Test_Create;
-- ------------------------------
-- Test the akt keystore for several users each having their own GPG key.
-- ------------------------------
procedure Test_Create_Multi_User (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg [email protected] " &
"[email protected] [email protected]",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result,
"list command failed for " & User_Type'Image (User));
end loop;
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
for User in User_Type'Range loop
T.Execute (Tool (User) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result,
"get command failed for " & User_Type'Image (User));
end loop;
-- List content => one entry
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result,
"list command failed for " & User_Type'Image (User));
end loop;
end Test_Create_Multi_User;
-- ------------------------------
-- Test the akt info command on the GPG protected keystore.
-- ------------------------------
procedure Test_Info (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Get info about the keystore file.
for User in User_Type'Range loop
T.Execute (Tool (User) & " info -k " & Path, Result);
Util.Tests.Assert_Matches (T, " 1 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 2 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 3 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Entry count: +1", Result,
"invalid number of entries for " &
User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Key slots used: *1 2 3", Result,
"invalid number of used key slots for " &
User_Type'Image (User));
end loop;
end Test_Info;
-- ------------------------------
-- Test the akt password-add command to add a GPG key to a keystore.
-- ------------------------------
procedure Test_Add_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore with a password
T.Execute (Tool (User_1) & " create " & Path & " -p gpg-admin -c 10:100",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- Add GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg [email protected]",
Result);
-- Set property from User_2
T.Execute (Tool (User_2) & " set " & Path & " testing akt-user2-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Set property from User_1
T.Execute (Tool (User_2) & " set " & Path & " -p gpg-admin testing2 akt-user1-value",
Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
end Test_Add_Password;
-- ------------------------------
-- Test the akt password-remove command to remove a GPG key from the keystore.
-- ------------------------------
procedure Test_Remove_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
Test_Add_Password (T);
-- Remove GPG key for user2
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 2",
Result);
-- User_2 must not have access to the keystore
T.Execute (Tool (User_2) & " get " & Path & " testing2",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "get command returned unexpected result");
-- Try remove current key
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 1",
Result, 1);
Util.Tests.Assert_Matches (T, "^Refusing to erase the key slot",
Result, "password-remove command returned unexpected result");
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 0",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid key slot number",
Result, "password-remove command returned unexpected result");
-- Add again GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg [email protected]",
Result);
end Test_Remove_Password;
-- ------------------------------
-- Test update content with store command
-- ------------------------------
procedure Test_Update_File (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool (User_2) & " store " & Path & " LICENSE.txt",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"configure", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"bin/akt" & Keystore.Tests.EXE, "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result);
end Test_Update_File;
-- ------------------------------
-- Test when gpg execution fails
-- ------------------------------
procedure Test_GPG_Error (T : in out Test) is
Config : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute ("bin/akt --config " & Config & "bad-list-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
T.Execute ("bin/akt --config " & Config & "bad-decrypt-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
end Test_GPG_Error;
end Keystore.GPG_Tests;
|
19743
|
-----------------------------------------------------------------------
-- keystore-gpg_tests -- Test AKT with GPG2
-- Copyright (C) 2019, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.Text_IO;
with Ada.Directories;
with Util.Test_Caller;
with Util.Encoders.AES;
with Util.Log.Loggers;
with Util.Processes;
with Util.Streams.Buffered;
with Util.Streams.Pipes;
with Keystore.Tests;
package body Keystore.GPG_Tests is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.GPG_Tests");
TEST_TOOL_PATH : constant String := "regtests/result/test-gpg-1.akt";
TEST_TOOL2_PATH : constant String := "regtests/result/test-gpg-2.akt";
TEST_TOOL3_PATH : constant String := "regtests/result/test-gpg-3.akt";
type User_Type is (User_1, User_2, User_3);
function Tool (User : in User_Type) return String;
package Caller is new Util.Test_Caller (Test, "AKT.GPG");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG)",
Test_Create'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG++)",
Test_Create_Multi_User'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Info (GPG)",
Test_Info'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password (GPG)",
Test_Add_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password.Remove (GPG)",
Test_Remove_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (Update)",
Test_Update_File'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (GPG Error)",
Test_GPG_Error'Access);
end Add_Tests;
-- ------------------------------
-- Get the tool command for a given user
-- ------------------------------
function Tool (User : in User_Type) return String is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
begin
case User is
when User_1 =>
return "bin/akt --config " & Path & "user1-akt.properties";
when User_2 =>
return "bin/akt --config " & Path & "user2-akt.properties";
when User_3 =>
return "bin/akt --config " & Path & "user3-akt.properties";
end case;
end Tool;
-- ------------------------------
-- Execute the command and get the output in a string.
-- ------------------------------
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
P : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
begin
if Input'Length > 0 then
Log.Info ("Execute: {0} < {1}", Command, Input);
elsif Output'Length > 0 then
Log.Info ("Execute: {0} > {1}", Command, Output);
else
Log.Info ("Execute: {0}", Command);
end if;
P.Set_Input_Stream (Input);
P.Set_Output_Stream (Output);
P.Open (Command, Util.Processes.READ_ALL);
-- Write on the process input stream.
Result := Ada.Strings.Unbounded.Null_Unbounded_String;
Buffer.Initialize (P'Unchecked_Access, 8192);
Buffer.Read (Result);
P.Close;
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String (Result));
Log.Info ("Command result: {0}", Result);
Util.Tests.Assert_Equals (T, Status, P.Get_Exit_Status, "Command '" & Command & "' failed");
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
begin
T.Execute (Command, "", "", Result, Status);
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Expect : in String;
Status : in Natural := 0) is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/expect/" & Expect);
Output : constant String := Util.Tests.Get_Test_Path ("regtests/result/" & Expect);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Command, "", Output, Result, Status);
Util.Tests.Assert_Equal_Files (T, Path, Output, "Command '" & Command & "' invalid output");
end Execute;
-- ------------------------------
-- Test the akt keystore creation.
-- ------------------------------
procedure Test_Create (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg <EMAIL>",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result, "list command failed");
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
T.Execute (Tool (User_1) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result, "get command failed");
-- List content => one entry
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed");
-- Open keystore with another user GPG configuration should fail
T.Execute (Tool (User_2) & " list -k " & Path, Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "list command failed");
end Test_Create;
-- ------------------------------
-- Test the akt keystore for several users each having their own GPG key.
-- ------------------------------
procedure Test_Create_Multi_User (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg <EMAIL> " &
"<EMAIL> <EMAIL>",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result,
"list command failed for " & User_Type'Image (User));
end loop;
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
for User in User_Type'Range loop
T.Execute (Tool (User) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result,
"get command failed for " & User_Type'Image (User));
end loop;
-- List content => one entry
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result,
"list command failed for " & User_Type'Image (User));
end loop;
end Test_Create_Multi_User;
-- ------------------------------
-- Test the akt info command on the GPG protected keystore.
-- ------------------------------
procedure Test_Info (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Get info about the keystore file.
for User in User_Type'Range loop
T.Execute (Tool (User) & " info -k " & Path, Result);
Util.Tests.Assert_Matches (T, " 1 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 2 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 3 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Entry count: +1", Result,
"invalid number of entries for " &
User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Key slots used: *1 2 3", Result,
"invalid number of used key slots for " &
User_Type'Image (User));
end loop;
end Test_Info;
-- ------------------------------
-- Test the akt password-add command to add a GPG key to a keystore.
-- ------------------------------
procedure Test_Add_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore with a password
T.Execute (Tool (User_1) & " create " & Path & " -p gpg-admin -c 10:100",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- Add GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg <EMAIL>",
Result);
-- Set property from User_2
T.Execute (Tool (User_2) & " set " & Path & " testing akt-user2-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Set property from User_1
T.Execute (Tool (User_2) & " set " & Path & " -p gpg-admin testing2 akt-user1-value",
Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
end Test_Add_Password;
-- ------------------------------
-- Test the akt password-remove command to remove a GPG key from the keystore.
-- ------------------------------
procedure Test_Remove_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
Test_Add_Password (T);
-- Remove GPG key for user2
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 2",
Result);
-- User_2 must not have access to the keystore
T.Execute (Tool (User_2) & " get " & Path & " testing2",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "get command returned unexpected result");
-- Try remove current key
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 1",
Result, 1);
Util.Tests.Assert_Matches (T, "^Refusing to erase the key slot",
Result, "password-remove command returned unexpected result");
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 0",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid key slot number",
Result, "password-remove command returned unexpected result");
-- Add again GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg <EMAIL>",
Result);
end Test_Remove_Password;
-- ------------------------------
-- Test update content with store command
-- ------------------------------
procedure Test_Update_File (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool (User_2) & " store " & Path & " LICENSE.txt",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"configure", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"bin/akt" & Keystore.Tests.EXE, "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result);
end Test_Update_File;
-- ------------------------------
-- Test when gpg execution fails
-- ------------------------------
procedure Test_GPG_Error (T : in out Test) is
Config : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute ("bin/akt --config " & Config & "bad-list-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
T.Execute ("bin/akt --config " & Config & "bad-decrypt-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
end Test_GPG_Error;
end Keystore.GPG_Tests;
| true |
-----------------------------------------------------------------------
-- keystore-gpg_tests -- Test AKT with GPG2
-- Copyright (C) 2019, 2020 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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.Text_IO;
with Ada.Directories;
with Util.Test_Caller;
with Util.Encoders.AES;
with Util.Log.Loggers;
with Util.Processes;
with Util.Streams.Buffered;
with Util.Streams.Pipes;
with Keystore.Tests;
package body Keystore.GPG_Tests is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.GPG_Tests");
TEST_TOOL_PATH : constant String := "regtests/result/test-gpg-1.akt";
TEST_TOOL2_PATH : constant String := "regtests/result/test-gpg-2.akt";
TEST_TOOL3_PATH : constant String := "regtests/result/test-gpg-3.akt";
type User_Type is (User_1, User_2, User_3);
function Tool (User : in User_Type) return String;
package Caller is new Util.Test_Caller (Test, "AKT.GPG");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG)",
Test_Create'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Create (GPG++)",
Test_Create_Multi_User'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Info (GPG)",
Test_Info'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password (GPG)",
Test_Add_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Password.Remove (GPG)",
Test_Remove_Password'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (Update)",
Test_Update_File'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Store (GPG Error)",
Test_GPG_Error'Access);
end Add_Tests;
-- ------------------------------
-- Get the tool command for a given user
-- ------------------------------
function Tool (User : in User_Type) return String is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
begin
case User is
when User_1 =>
return "bin/akt --config " & Path & "user1-akt.properties";
when User_2 =>
return "bin/akt --config " & Path & "user2-akt.properties";
when User_3 =>
return "bin/akt --config " & Path & "user3-akt.properties";
end case;
end Tool;
-- ------------------------------
-- Execute the command and get the output in a string.
-- ------------------------------
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
P : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
begin
if Input'Length > 0 then
Log.Info ("Execute: {0} < {1}", Command, Input);
elsif Output'Length > 0 then
Log.Info ("Execute: {0} > {1}", Command, Output);
else
Log.Info ("Execute: {0}", Command);
end if;
P.Set_Input_Stream (Input);
P.Set_Output_Stream (Output);
P.Open (Command, Util.Processes.READ_ALL);
-- Write on the process input stream.
Result := Ada.Strings.Unbounded.Null_Unbounded_String;
Buffer.Initialize (P'Unchecked_Access, 8192);
Buffer.Read (Result);
P.Close;
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String (Result));
Log.Info ("Command result: {0}", Result);
Util.Tests.Assert_Equals (T, Status, P.Get_Exit_Status, "Command '" & Command & "' failed");
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
begin
T.Execute (Command, "", "", Result, Status);
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Expect : in String;
Status : in Natural := 0) is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/expect/" & Expect);
Output : constant String := Util.Tests.Get_Test_Path ("regtests/result/" & Expect);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Command, "", Output, Result, Status);
Util.Tests.Assert_Equal_Files (T, Path, Output, "Command '" & Command & "' invalid output");
end Execute;
-- ------------------------------
-- Test the akt keystore creation.
-- ------------------------------
procedure Test_Create (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg PI:EMAIL:<EMAIL>END_PI",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result, "list command failed");
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
T.Execute (Tool (User_1) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result, "get command failed");
-- List content => one entry
T.Execute (Tool (User_1) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed");
-- Open keystore with another user GPG configuration should fail
T.Execute (Tool (User_2) & " list -k " & Path, Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "list command failed");
end Test_Create;
-- ------------------------------
-- Test the akt keystore for several users each having their own GPG key.
-- ------------------------------
procedure Test_Create_Multi_User (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore
T.Execute (Tool (User_1) & " create -k " & Path & " --gpg PI:EMAIL:<EMAIL>END_PI " &
"PI:EMAIL:<EMAIL>END_PI PI:EMAIL:<EMAIL>END_PI",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- List content => empty result
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Equals (T, "", Result,
"list command failed for " & User_Type'Image (User));
end loop;
-- Set property
T.Execute (Tool (User_1) & " set -k " & Path & " testing my-testing-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Get property
for User in User_Type'Range loop
T.Execute (Tool (User) & " get -k " & Path & " testing", Result);
Util.Tests.Assert_Matches (T, "^my-testing-value", Result,
"get command failed for " & User_Type'Image (User));
end loop;
-- List content => one entry
for User in User_Type'Range loop
T.Execute (Tool (User) & " list -k " & Path, Result);
Util.Tests.Assert_Matches (T, "^testing", Result,
"list command failed for " & User_Type'Image (User));
end loop;
end Test_Create_Multi_User;
-- ------------------------------
-- Test the akt info command on the GPG protected keystore.
-- ------------------------------
procedure Test_Info (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Get info about the keystore file.
for User in User_Type'Range loop
T.Execute (Tool (User) & " info -k " & Path, Result);
Util.Tests.Assert_Matches (T, " 1 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 2 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, " 3 Kind.*2.*[0-9]+ .* [0-9A-F]+", Result,
"info command failed for " & User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Entry count: +1", Result,
"invalid number of entries for " &
User_Type'Image (User));
Util.Tests.Assert_Matches (T, "Key slots used: *1 2 3", Result,
"invalid number of used key slots for " &
User_Type'Image (User));
end loop;
end Test_Info;
-- ------------------------------
-- Test the akt password-add command to add a GPG key to a keystore.
-- ------------------------------
procedure Test_Add_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
-- Create keystore with a password
T.Execute (Tool (User_1) & " create " & Path & " -p gpg-admin -c 10:100",
Result);
T.Assert (Ada.Directories.Exists (Path),
"Keystore file does not exist");
-- Add GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg PI:EMAIL:<EMAIL>END_PI",
Result);
-- Set property from User_2
T.Execute (Tool (User_2) & " set " & Path & " testing akt-user2-value", Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
-- Set property from User_1
T.Execute (Tool (User_2) & " set " & Path & " -p gpg-admin testing2 akt-user1-value",
Result);
Util.Tests.Assert_Equals (T, "", Result, "set command failed");
end Test_Add_Password;
-- ------------------------------
-- Test the akt password-remove command to remove a GPG key from the keystore.
-- ------------------------------
procedure Test_Remove_Password (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
Test_Add_Password (T);
-- Remove GPG key for user2
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 2",
Result);
-- User_2 must not have access to the keystore
T.Execute (Tool (User_2) & " get " & Path & " testing2",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "get command returned unexpected result");
-- Try remove current key
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 1",
Result, 1);
Util.Tests.Assert_Matches (T, "^Refusing to erase the key slot",
Result, "password-remove command returned unexpected result");
T.Execute (Tool (User_1) & " password-remove " & Path & " -p gpg-admin --slot 0",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid key slot number",
Result, "password-remove command returned unexpected result");
-- Add again GPG password for User_2
T.Execute (Tool (User_2) & " password-add " & Path &
" -p gpg-admin --gpg PI:EMAIL:<EMAIL>END_PI",
Result);
end Test_Remove_Password;
-- ------------------------------
-- Test update content with store command
-- ------------------------------
procedure Test_Update_File (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool (User_2) & " store " & Path & " LICENSE.txt",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"configure", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile", "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"bin/akt" & Keystore.Tests.EXE, "",
Result);
T.Execute (Tool (User_2) & " store " & Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result);
end Test_Update_File;
-- ------------------------------
-- Test when gpg execution fails
-- ------------------------------
procedure Test_GPG_Error (T : in out Test) is
Config : constant String := Util.Tests.Get_Test_Path ("regtests/files/gnupg/");
Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute ("bin/akt --config " & Config & "bad-list-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
T.Execute ("bin/akt --config " & Config & "bad-decrypt-user1-akt.properties store "
& Path & " -- LICENSE.txt",
"Makefile.conf", "",
Result, 1);
Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file",
Result, "password-set command failed");
end Test_GPG_Error;
end Keystore.GPG_Tests;
|
[
{
"context": "52.adb GAP library of id's Hans Ulrich Besche\n##\n\nID_GROUP_TREE.next[1152].next[1].next[106]:=\n",
"end": 158,
"score": 0.999880850315094,
"start": 140,
"tag": "NAME",
"value": "Hans Ulrich Besche"
}
] |
id6/id1152.adb
|
hulpke/smallgrp
| 5 |
#############################################################################
##
#W id1152.adb GAP library of id's Hans Ulrich Besche
##
ID_GROUP_TREE.next[1152].next[1].next[106]:=
rec(
fp:= [ 106, 606, 1106, 1606, 2106 ],
next:= [ rec(
fp:= [ 63784, 82153, 87342, 98487 ],
next:= [ rec(
fp:= [ 39538, 68271 ],
level:= 4,
next:= [ 6273, 6270 ] ), rec(
fp:= [ 21735, 27646, 35197 ],
level:= 4,
next:= [ 6281, 6283, 6282 ] ), rec(
fp:= [ 4902, 7646, 15703, 22675, 23367, 27646, 36829, 49340, 89954 ],
level:= 4,
next:= [ 6272, 6269, 6276, 6275, 6278, 6280, 6277, 6279, 6274 ] ), rec(
fp:= [ 22258, 47720 ],
level:= 4,
next:= [ 6271, 6268 ] ) ] ), rec(
fp:= [ 53654, 57341, 66772, 73536 ],
next:= [ rec(
fp:= [ 2156, 16427, 52737, 62019, 82102 ],
level:= 4,
next:= [ 21341, 21340, 21342, 21338, 21339 ] ), rec(
fp:= [ 23062, 28727, 43592, 71496, 80072 ],
level:= 4,
next:= [ 21309, 21312, 21318, 21321, 21315 ] ), rec(
fp:= [ 6742, 27935, 63399, 70939, 98863 ],
level:= 4,
next:= [ 21320, 21314, 21311, 21317, 21323 ] ), rec(
fp:= [ 2147, 3583, 4842, 12948, 24608, 26871, 30889, 42313, 47228,
53959, 60072, 67612, 73084, 74343, 75152, 81883, 82692, 97772 ],
level:= 4,
next:= [ 21322, 21316, 21328, 21324, 21327, 21331, 21313, 21319, 21325,
21326, 21332, 21335, 21310, 21334, 21329, rec(
fp:= [ 11448, 40715 ],
next:= [ 21336, 21330 ] ), 21333, 21337 ] ) ] ), rec(
fp:= [ 24844, 38843, 83671 ],
next:= [ rec(
fp:= [ 39334, 58951, 78568 ],
level:= 4,
next:= [ rec(
fp:= [ 53703, 89304 ],
next:= [ 41517, 41508 ] ), rec(
fp:= [ 2652, 34846 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 414, 612 ],
next:= [ 41511, 41505 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41514, 41523 ] ) ] ), rec(
fp:= [ 31147, 88750 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 16, 412 ],
next:= [ 41529, 41520 ] ), 41526 ] ) ] ), rec(
fp:= [ 7892, 27509, 31405, 47126, 48702, 52598, 68319, 73791, 81583,
89512 ],
level:= 4,
next:= [ rec(
fp:= [ 4434, 19547, 24441, 24514, 30734, 44076, 62706, 93125 ],
next:= [ rec(
desc:= [ 114007 ],
fp:= [ 8, 414 ],
next:= [ 41565, 41586 ] ), 41537, 41554, 41532, rec(
desc:= [ 111003 ],
fp:= [ 6, 214, 412 ],
next:= [ 41559, 41544, rec(
desc:= [ 120007 ],
fp:= [ 16, 1214 ],
next:= [ 41570, 41568 ] ) ] ), 41551, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41557, 41567 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 41547, 41539 ] ) ] ), rec(
fp:= [ 12957, 32216, 44685, 51865, 52282, 93540 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41562, 41581 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41579, 41535 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41575, 41548 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41534, 41578 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41560, 41573 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41576, 41550 ] ) ] ), rec(
fp:= [ 46102, 83562 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41528, 41519 ] ), 41525 ] ), rec(
fp:= [ 32888, 56496 ],
next:= [ 41583, rec(
desc:= [ 108003 ],
fp:= [ 8, 414 ],
next:= [ 41584, 41585 ] ) ] ), rec(
fp:= [ 2295, 19305, 27378, 63619, 70159, 84785, 86649, 91965 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41546, 41540 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41545, 41541 ] ), rec(
desc:= [ 109003 ],
fp:= [ 214, 412 ],
next:= [ 41564, 41566 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41555, 41556 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41543, 41571 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41542, 41572 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41552, 41553 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41531, 41533 ] ) ] ), rec(
fp:= [ 17014, 58133 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41510, 41504 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41513, 41522 ] ) ] ), rec(
fp:= [ 16605, 55484, 74859 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41563, 41582 ] ), rec(
desc:= [ 109003 ],
fp:= [ 8, 414 ],
next:= [ 41561, 41574 ] ), rec(
desc:= [ 302019 ],
fp:= [ 685, 79261 ],
next:= [ 41577, rec(
desc:= [ 112003 ],
fp:= [ 8, 414 ],
next:= [ 41549, rec(
desc:= [ 215003 ],
fp:= [ 4, 212 ],
next:= [ 41536, 41580 ] ) ] ) ] ) ] ), rec(
fp:= [ 75625, 98476 ],
next:= [ 41507, 41516 ] ), 41530, rec(
fp:= [ 32136, 39292, 59246 ],
next:= [ 41587, 41538, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41558, 41569 ] ) ] ) ] ), rec(
fp:= [ 20009, 65775, 73904 ],
level:= 4,
next:= [ rec(
fp:= [ 72944, 90804 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41509, 41503 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41512, 41521 ] ) ] ), rec(
fp:= [ 37820, 86777 ],
next:= [ 41524, rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41527, 41518 ] ) ] ), rec(
fp:= [ 65403, 65518 ],
next:= [ 41515, 41506 ] ) ] ) ] ), rec(
fp:= [ 10152, 69984, 90768 ],
next:= [ rec(
fp:= [ 3027, 7206, 27289, 45413, 47115, 52953, 56723, 62195, 62836,
73139, 76360, 77916, 98918 ],
level:= 4,
next:= [ rec(
fp:= [ 14037, 29860, 76898 ],
next:= [ 91282, 91284, 91288 ] ), 91274, 91275, rec(
fp:= [ 24666, 46326, 48323, 49190 ],
next:= [ 91287, 91285, 91281, 91279 ] ), 91262, rec(
fp:= [ 35418, 36496, 66197, 76185, 76862, 83496, 99248 ],
next:= [ 91295, 91292, 91293, 91294, 91278, 91277, 91276 ] ), rec(
fp:= [ 29916, 52456 ],
next:= [ 91280, 91286 ] ), rec(
fp:= [ 31792, 50079, 68017 ],
next:= [ 91271, 91259, 91265 ] ), 91291, 91273, 91268, rec(
fp:= [ 24710, 54354 ],
next:= [ 91289, 91283 ] ), 91290 ] ), rec(
fp:= [ 9506, 30699, 34469 ],
level:= 4,
next:= [ 91269, 91263, rec(
fp:= [ 63223, 70631, 74821 ],
next:= [ 91272, 91260, 91266 ] ) ] ), rec(
fp:= [ 53154, 55484, 81659 ],
level:= 4,
next:= [ 91261, 91267, rec(
fp:= [ 10529, 15969, 81804 ],
next:= [ 91270, 91258, 91264 ] ) ] ) ] ), rec(
fp:= [ 41564, 44549, 45277, 70047 ],
next:= [ rec(
fp:= [ 10643, 31836, 71070 ],
level:= 4,
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 17, 215 ],
next:= [ 130648, 130636 ] ), 130654, rec(
fp:= [ 14365, 19181, 19959, 25774, 36702, 41374 ],
next:= [ 130663, 130639, 130651, 130642, rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130660, 130645 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130633, 130657 ] ) ] ) ] ), rec(
fp:= [ 26492, 31830, 54670 ],
level:= 4,
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130646, 130634 ] ), 130652, rec(
fp:= [ 9809, 15602, 18172, 56570, 86418, 87386 ],
next:= [ 130640, 130649, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130658, 130643 ] ), 130637, 130661, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130631, 130655 ] ) ] ) ] ), rec(
fp:= [ 3546, 12170, 21197, 24739, 42780, 63973, 69445, 82014, 85710 ],
level:= 4,
next:= [ rec(
fp:= [ 28252, 29419, 34201, 42496, 46015, 49763, 50625, 51792, 53800,
54960, 63114, 67998, 71384, 81624, 84374, 92294 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130726, 130707 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130713, 130683 ] ), rec(
desc:= [ 114005 ],
fp:= [ 2, 12 ],
next:= [ 130711, 130717 ] ), 130720, 130718, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130727, 130676 ] ), rec(
desc:= [ 120007 ],
fp:= [ 14, 212 ],
next:= [ 130709, 130724 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130715, 130681 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130714, 130682 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130712, 130710 ] ), 130685, 130719, 130716, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130708, 130725 ] ), 130684, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130728, 130677 ] ) ] ), 130653, rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130647, 130635 ] ), rec(
fp:= [ 9771, 15962, 48700, 50306, 86499, 89853 ],
next:= [ 130699, 130673, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130706, 130705 ] ), 130675, rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130669, 130667 ] ), 130700 ] ), rec(
fp:= [ 17668, 68185, 77686 ],
next:= [ rec(
desc:= [ 113005 ],
fp:= [ 2, 12 ],
next:= [ 130668, 130674 ] ), 130698, 130704 ] ), rec(
fp:= [ 8424, 39848, 41169, 54644, 97946 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130702, 130695 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 130690, 130689 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130693, 130686 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130722, 130665 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130679, 130671 ] ) ] ), rec(
fp:= [ 29996, 64926, 86729, 91200, 93674, 96076 ],
next:= [ 130641, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130659, 130644 ] ), 130638, 130662, 130650, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130632, 130656 ] ) ] ), rec(
fp:= [ 13286, 19540, 21323, 29422, 36819, 49436, 50326, 75472 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130694, 130688 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130692, 130687 ] ), rec(
desc:= [ 109003 ],
fp:= [ 15, 213 ],
next:= [ 130723, 130664 ] ), rec(
desc:= [ 108003 ],
fp:= [ 16, 214 ],
next:= [ 130701, 130696 ] ), rec(
desc:= [ 118007 ],
fp:= [ 18, 414 ],
next:= [ 130666, 130721 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130678, 130672 ] ), rec(
desc:= [ 117011 ],
fp:= [ 8, 414 ],
next:= [ 130697, 130703 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130680, 130670 ] ) ] ), 130691 ] ), rec(
fp:= [ 35444, 98126 ],
level:= 5,
next:= [ rec(
desc:= [ 113007 ],
fp:= [ 18, 414 ],
next:= [ 130729, 130730 ] ), 130731 ] ) ] ) ] );
|
2897
|
#############################################################################
##
#W id1152.adb GAP library of id's <NAME>
##
ID_GROUP_TREE.next[1152].next[1].next[106]:=
rec(
fp:= [ 106, 606, 1106, 1606, 2106 ],
next:= [ rec(
fp:= [ 63784, 82153, 87342, 98487 ],
next:= [ rec(
fp:= [ 39538, 68271 ],
level:= 4,
next:= [ 6273, 6270 ] ), rec(
fp:= [ 21735, 27646, 35197 ],
level:= 4,
next:= [ 6281, 6283, 6282 ] ), rec(
fp:= [ 4902, 7646, 15703, 22675, 23367, 27646, 36829, 49340, 89954 ],
level:= 4,
next:= [ 6272, 6269, 6276, 6275, 6278, 6280, 6277, 6279, 6274 ] ), rec(
fp:= [ 22258, 47720 ],
level:= 4,
next:= [ 6271, 6268 ] ) ] ), rec(
fp:= [ 53654, 57341, 66772, 73536 ],
next:= [ rec(
fp:= [ 2156, 16427, 52737, 62019, 82102 ],
level:= 4,
next:= [ 21341, 21340, 21342, 21338, 21339 ] ), rec(
fp:= [ 23062, 28727, 43592, 71496, 80072 ],
level:= 4,
next:= [ 21309, 21312, 21318, 21321, 21315 ] ), rec(
fp:= [ 6742, 27935, 63399, 70939, 98863 ],
level:= 4,
next:= [ 21320, 21314, 21311, 21317, 21323 ] ), rec(
fp:= [ 2147, 3583, 4842, 12948, 24608, 26871, 30889, 42313, 47228,
53959, 60072, 67612, 73084, 74343, 75152, 81883, 82692, 97772 ],
level:= 4,
next:= [ 21322, 21316, 21328, 21324, 21327, 21331, 21313, 21319, 21325,
21326, 21332, 21335, 21310, 21334, 21329, rec(
fp:= [ 11448, 40715 ],
next:= [ 21336, 21330 ] ), 21333, 21337 ] ) ] ), rec(
fp:= [ 24844, 38843, 83671 ],
next:= [ rec(
fp:= [ 39334, 58951, 78568 ],
level:= 4,
next:= [ rec(
fp:= [ 53703, 89304 ],
next:= [ 41517, 41508 ] ), rec(
fp:= [ 2652, 34846 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 414, 612 ],
next:= [ 41511, 41505 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41514, 41523 ] ) ] ), rec(
fp:= [ 31147, 88750 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 16, 412 ],
next:= [ 41529, 41520 ] ), 41526 ] ) ] ), rec(
fp:= [ 7892, 27509, 31405, 47126, 48702, 52598, 68319, 73791, 81583,
89512 ],
level:= 4,
next:= [ rec(
fp:= [ 4434, 19547, 24441, 24514, 30734, 44076, 62706, 93125 ],
next:= [ rec(
desc:= [ 114007 ],
fp:= [ 8, 414 ],
next:= [ 41565, 41586 ] ), 41537, 41554, 41532, rec(
desc:= [ 111003 ],
fp:= [ 6, 214, 412 ],
next:= [ 41559, 41544, rec(
desc:= [ 120007 ],
fp:= [ 16, 1214 ],
next:= [ 41570, 41568 ] ) ] ), 41551, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41557, 41567 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 41547, 41539 ] ) ] ), rec(
fp:= [ 12957, 32216, 44685, 51865, 52282, 93540 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41562, 41581 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41579, 41535 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41575, 41548 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41534, 41578 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41560, 41573 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41576, 41550 ] ) ] ), rec(
fp:= [ 46102, 83562 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41528, 41519 ] ), 41525 ] ), rec(
fp:= [ 32888, 56496 ],
next:= [ 41583, rec(
desc:= [ 108003 ],
fp:= [ 8, 414 ],
next:= [ 41584, 41585 ] ) ] ), rec(
fp:= [ 2295, 19305, 27378, 63619, 70159, 84785, 86649, 91965 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41546, 41540 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41545, 41541 ] ), rec(
desc:= [ 109003 ],
fp:= [ 214, 412 ],
next:= [ 41564, 41566 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41555, 41556 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41543, 41571 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41542, 41572 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41552, 41553 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41531, 41533 ] ) ] ), rec(
fp:= [ 17014, 58133 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41510, 41504 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41513, 41522 ] ) ] ), rec(
fp:= [ 16605, 55484, 74859 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41563, 41582 ] ), rec(
desc:= [ 109003 ],
fp:= [ 8, 414 ],
next:= [ 41561, 41574 ] ), rec(
desc:= [ 302019 ],
fp:= [ 685, 79261 ],
next:= [ 41577, rec(
desc:= [ 112003 ],
fp:= [ 8, 414 ],
next:= [ 41549, rec(
desc:= [ 215003 ],
fp:= [ 4, 212 ],
next:= [ 41536, 41580 ] ) ] ) ] ) ] ), rec(
fp:= [ 75625, 98476 ],
next:= [ 41507, 41516 ] ), 41530, rec(
fp:= [ 32136, 39292, 59246 ],
next:= [ 41587, 41538, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41558, 41569 ] ) ] ) ] ), rec(
fp:= [ 20009, 65775, 73904 ],
level:= 4,
next:= [ rec(
fp:= [ 72944, 90804 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41509, 41503 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41512, 41521 ] ) ] ), rec(
fp:= [ 37820, 86777 ],
next:= [ 41524, rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41527, 41518 ] ) ] ), rec(
fp:= [ 65403, 65518 ],
next:= [ 41515, 41506 ] ) ] ) ] ), rec(
fp:= [ 10152, 69984, 90768 ],
next:= [ rec(
fp:= [ 3027, 7206, 27289, 45413, 47115, 52953, 56723, 62195, 62836,
73139, 76360, 77916, 98918 ],
level:= 4,
next:= [ rec(
fp:= [ 14037, 29860, 76898 ],
next:= [ 91282, 91284, 91288 ] ), 91274, 91275, rec(
fp:= [ 24666, 46326, 48323, 49190 ],
next:= [ 91287, 91285, 91281, 91279 ] ), 91262, rec(
fp:= [ 35418, 36496, 66197, 76185, 76862, 83496, 99248 ],
next:= [ 91295, 91292, 91293, 91294, 91278, 91277, 91276 ] ), rec(
fp:= [ 29916, 52456 ],
next:= [ 91280, 91286 ] ), rec(
fp:= [ 31792, 50079, 68017 ],
next:= [ 91271, 91259, 91265 ] ), 91291, 91273, 91268, rec(
fp:= [ 24710, 54354 ],
next:= [ 91289, 91283 ] ), 91290 ] ), rec(
fp:= [ 9506, 30699, 34469 ],
level:= 4,
next:= [ 91269, 91263, rec(
fp:= [ 63223, 70631, 74821 ],
next:= [ 91272, 91260, 91266 ] ) ] ), rec(
fp:= [ 53154, 55484, 81659 ],
level:= 4,
next:= [ 91261, 91267, rec(
fp:= [ 10529, 15969, 81804 ],
next:= [ 91270, 91258, 91264 ] ) ] ) ] ), rec(
fp:= [ 41564, 44549, 45277, 70047 ],
next:= [ rec(
fp:= [ 10643, 31836, 71070 ],
level:= 4,
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 17, 215 ],
next:= [ 130648, 130636 ] ), 130654, rec(
fp:= [ 14365, 19181, 19959, 25774, 36702, 41374 ],
next:= [ 130663, 130639, 130651, 130642, rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130660, 130645 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130633, 130657 ] ) ] ) ] ), rec(
fp:= [ 26492, 31830, 54670 ],
level:= 4,
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130646, 130634 ] ), 130652, rec(
fp:= [ 9809, 15602, 18172, 56570, 86418, 87386 ],
next:= [ 130640, 130649, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130658, 130643 ] ), 130637, 130661, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130631, 130655 ] ) ] ) ] ), rec(
fp:= [ 3546, 12170, 21197, 24739, 42780, 63973, 69445, 82014, 85710 ],
level:= 4,
next:= [ rec(
fp:= [ 28252, 29419, 34201, 42496, 46015, 49763, 50625, 51792, 53800,
54960, 63114, 67998, 71384, 81624, 84374, 92294 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130726, 130707 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130713, 130683 ] ), rec(
desc:= [ 114005 ],
fp:= [ 2, 12 ],
next:= [ 130711, 130717 ] ), 130720, 130718, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130727, 130676 ] ), rec(
desc:= [ 120007 ],
fp:= [ 14, 212 ],
next:= [ 130709, 130724 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130715, 130681 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130714, 130682 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130712, 130710 ] ), 130685, 130719, 130716, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130708, 130725 ] ), 130684, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130728, 130677 ] ) ] ), 130653, rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130647, 130635 ] ), rec(
fp:= [ 9771, 15962, 48700, 50306, 86499, 89853 ],
next:= [ 130699, 130673, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130706, 130705 ] ), 130675, rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130669, 130667 ] ), 130700 ] ), rec(
fp:= [ 17668, 68185, 77686 ],
next:= [ rec(
desc:= [ 113005 ],
fp:= [ 2, 12 ],
next:= [ 130668, 130674 ] ), 130698, 130704 ] ), rec(
fp:= [ 8424, 39848, 41169, 54644, 97946 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130702, 130695 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 130690, 130689 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130693, 130686 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130722, 130665 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130679, 130671 ] ) ] ), rec(
fp:= [ 29996, 64926, 86729, 91200, 93674, 96076 ],
next:= [ 130641, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130659, 130644 ] ), 130638, 130662, 130650, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130632, 130656 ] ) ] ), rec(
fp:= [ 13286, 19540, 21323, 29422, 36819, 49436, 50326, 75472 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130694, 130688 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130692, 130687 ] ), rec(
desc:= [ 109003 ],
fp:= [ 15, 213 ],
next:= [ 130723, 130664 ] ), rec(
desc:= [ 108003 ],
fp:= [ 16, 214 ],
next:= [ 130701, 130696 ] ), rec(
desc:= [ 118007 ],
fp:= [ 18, 414 ],
next:= [ 130666, 130721 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130678, 130672 ] ), rec(
desc:= [ 117011 ],
fp:= [ 8, 414 ],
next:= [ 130697, 130703 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130680, 130670 ] ) ] ), 130691 ] ), rec(
fp:= [ 35444, 98126 ],
level:= 5,
next:= [ rec(
desc:= [ 113007 ],
fp:= [ 18, 414 ],
next:= [ 130729, 130730 ] ), 130731 ] ) ] ) ] );
| true |
#############################################################################
##
#W id1152.adb GAP library of id's PI:NAME:<NAME>END_PI
##
ID_GROUP_TREE.next[1152].next[1].next[106]:=
rec(
fp:= [ 106, 606, 1106, 1606, 2106 ],
next:= [ rec(
fp:= [ 63784, 82153, 87342, 98487 ],
next:= [ rec(
fp:= [ 39538, 68271 ],
level:= 4,
next:= [ 6273, 6270 ] ), rec(
fp:= [ 21735, 27646, 35197 ],
level:= 4,
next:= [ 6281, 6283, 6282 ] ), rec(
fp:= [ 4902, 7646, 15703, 22675, 23367, 27646, 36829, 49340, 89954 ],
level:= 4,
next:= [ 6272, 6269, 6276, 6275, 6278, 6280, 6277, 6279, 6274 ] ), rec(
fp:= [ 22258, 47720 ],
level:= 4,
next:= [ 6271, 6268 ] ) ] ), rec(
fp:= [ 53654, 57341, 66772, 73536 ],
next:= [ rec(
fp:= [ 2156, 16427, 52737, 62019, 82102 ],
level:= 4,
next:= [ 21341, 21340, 21342, 21338, 21339 ] ), rec(
fp:= [ 23062, 28727, 43592, 71496, 80072 ],
level:= 4,
next:= [ 21309, 21312, 21318, 21321, 21315 ] ), rec(
fp:= [ 6742, 27935, 63399, 70939, 98863 ],
level:= 4,
next:= [ 21320, 21314, 21311, 21317, 21323 ] ), rec(
fp:= [ 2147, 3583, 4842, 12948, 24608, 26871, 30889, 42313, 47228,
53959, 60072, 67612, 73084, 74343, 75152, 81883, 82692, 97772 ],
level:= 4,
next:= [ 21322, 21316, 21328, 21324, 21327, 21331, 21313, 21319, 21325,
21326, 21332, 21335, 21310, 21334, 21329, rec(
fp:= [ 11448, 40715 ],
next:= [ 21336, 21330 ] ), 21333, 21337 ] ) ] ), rec(
fp:= [ 24844, 38843, 83671 ],
next:= [ rec(
fp:= [ 39334, 58951, 78568 ],
level:= 4,
next:= [ rec(
fp:= [ 53703, 89304 ],
next:= [ 41517, 41508 ] ), rec(
fp:= [ 2652, 34846 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 414, 612 ],
next:= [ 41511, 41505 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41514, 41523 ] ) ] ), rec(
fp:= [ 31147, 88750 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 16, 412 ],
next:= [ 41529, 41520 ] ), 41526 ] ) ] ), rec(
fp:= [ 7892, 27509, 31405, 47126, 48702, 52598, 68319, 73791, 81583,
89512 ],
level:= 4,
next:= [ rec(
fp:= [ 4434, 19547, 24441, 24514, 30734, 44076, 62706, 93125 ],
next:= [ rec(
desc:= [ 114007 ],
fp:= [ 8, 414 ],
next:= [ 41565, 41586 ] ), 41537, 41554, 41532, rec(
desc:= [ 111003 ],
fp:= [ 6, 214, 412 ],
next:= [ 41559, 41544, rec(
desc:= [ 120007 ],
fp:= [ 16, 1214 ],
next:= [ 41570, 41568 ] ) ] ), 41551, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41557, 41567 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 41547, 41539 ] ) ] ), rec(
fp:= [ 12957, 32216, 44685, 51865, 52282, 93540 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41562, 41581 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41579, 41535 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41575, 41548 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41534, 41578 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41560, 41573 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41576, 41550 ] ) ] ), rec(
fp:= [ 46102, 83562 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41528, 41519 ] ), 41525 ] ), rec(
fp:= [ 32888, 56496 ],
next:= [ 41583, rec(
desc:= [ 108003 ],
fp:= [ 8, 414 ],
next:= [ 41584, 41585 ] ) ] ), rec(
fp:= [ 2295, 19305, 27378, 63619, 70159, 84785, 86649, 91965 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41546, 41540 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 41545, 41541 ] ), rec(
desc:= [ 109003 ],
fp:= [ 214, 412 ],
next:= [ 41564, 41566 ] ), rec(
desc:= [ 110003 ],
fp:= [ 416, 614 ],
next:= [ 41555, 41556 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41543, 41571 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 41542, 41572 ] ), rec(
desc:= [ 109003 ],
fp:= [ 416, 614 ],
next:= [ 41552, 41553 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 41531, 41533 ] ) ] ), rec(
fp:= [ 17014, 58133 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41510, 41504 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41513, 41522 ] ) ] ), rec(
fp:= [ 16605, 55484, 74859 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 14 ],
next:= [ 41563, 41582 ] ), rec(
desc:= [ 109003 ],
fp:= [ 8, 414 ],
next:= [ 41561, 41574 ] ), rec(
desc:= [ 302019 ],
fp:= [ 685, 79261 ],
next:= [ 41577, rec(
desc:= [ 112003 ],
fp:= [ 8, 414 ],
next:= [ 41549, rec(
desc:= [ 215003 ],
fp:= [ 4, 212 ],
next:= [ 41536, 41580 ] ) ] ) ] ) ] ), rec(
fp:= [ 75625, 98476 ],
next:= [ 41507, 41516 ] ), 41530, rec(
fp:= [ 32136, 39292, 59246 ],
next:= [ 41587, 41538, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 41558, 41569 ] ) ] ) ] ), rec(
fp:= [ 20009, 65775, 73904 ],
level:= 4,
next:= [ rec(
fp:= [ 72944, 90804 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 41509, 41503 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 41512, 41521 ] ) ] ), rec(
fp:= [ 37820, 86777 ],
next:= [ 41524, rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 41527, 41518 ] ) ] ), rec(
fp:= [ 65403, 65518 ],
next:= [ 41515, 41506 ] ) ] ) ] ), rec(
fp:= [ 10152, 69984, 90768 ],
next:= [ rec(
fp:= [ 3027, 7206, 27289, 45413, 47115, 52953, 56723, 62195, 62836,
73139, 76360, 77916, 98918 ],
level:= 4,
next:= [ rec(
fp:= [ 14037, 29860, 76898 ],
next:= [ 91282, 91284, 91288 ] ), 91274, 91275, rec(
fp:= [ 24666, 46326, 48323, 49190 ],
next:= [ 91287, 91285, 91281, 91279 ] ), 91262, rec(
fp:= [ 35418, 36496, 66197, 76185, 76862, 83496, 99248 ],
next:= [ 91295, 91292, 91293, 91294, 91278, 91277, 91276 ] ), rec(
fp:= [ 29916, 52456 ],
next:= [ 91280, 91286 ] ), rec(
fp:= [ 31792, 50079, 68017 ],
next:= [ 91271, 91259, 91265 ] ), 91291, 91273, 91268, rec(
fp:= [ 24710, 54354 ],
next:= [ 91289, 91283 ] ), 91290 ] ), rec(
fp:= [ 9506, 30699, 34469 ],
level:= 4,
next:= [ 91269, 91263, rec(
fp:= [ 63223, 70631, 74821 ],
next:= [ 91272, 91260, 91266 ] ) ] ), rec(
fp:= [ 53154, 55484, 81659 ],
level:= 4,
next:= [ 91261, 91267, rec(
fp:= [ 10529, 15969, 81804 ],
next:= [ 91270, 91258, 91264 ] ) ] ) ] ), rec(
fp:= [ 41564, 44549, 45277, 70047 ],
next:= [ rec(
fp:= [ 10643, 31836, 71070 ],
level:= 4,
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 17, 215 ],
next:= [ 130648, 130636 ] ), 130654, rec(
fp:= [ 14365, 19181, 19959, 25774, 36702, 41374 ],
next:= [ 130663, 130639, 130651, 130642, rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130660, 130645 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130633, 130657 ] ) ] ) ] ), rec(
fp:= [ 26492, 31830, 54670 ],
level:= 4,
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130646, 130634 ] ), 130652, rec(
fp:= [ 9809, 15602, 18172, 56570, 86418, 87386 ],
next:= [ 130640, 130649, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130658, 130643 ] ), 130637, 130661, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130631, 130655 ] ) ] ) ] ), rec(
fp:= [ 3546, 12170, 21197, 24739, 42780, 63973, 69445, 82014, 85710 ],
level:= 4,
next:= [ rec(
fp:= [ 28252, 29419, 34201, 42496, 46015, 49763, 50625, 51792, 53800,
54960, 63114, 67998, 71384, 81624, 84374, 92294 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130726, 130707 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130713, 130683 ] ), rec(
desc:= [ 114005 ],
fp:= [ 2, 12 ],
next:= [ 130711, 130717 ] ), 130720, 130718, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130727, 130676 ] ), rec(
desc:= [ 120007 ],
fp:= [ 14, 212 ],
next:= [ 130709, 130724 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130715, 130681 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130714, 130682 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130712, 130710 ] ), 130685, 130719, 130716, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130708, 130725 ] ), 130684, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 130728, 130677 ] ) ] ), 130653, rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 130647, 130635 ] ), rec(
fp:= [ 9771, 15962, 48700, 50306, 86499, 89853 ],
next:= [ 130699, 130673, rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 130706, 130705 ] ), 130675, rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 130669, 130667 ] ), 130700 ] ), rec(
fp:= [ 17668, 68185, 77686 ],
next:= [ rec(
desc:= [ 113005 ],
fp:= [ 2, 12 ],
next:= [ 130668, 130674 ] ), 130698, 130704 ] ), rec(
fp:= [ 8424, 39848, 41169, 54644, 97946 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130702, 130695 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 130690, 130689 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130693, 130686 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 130722, 130665 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130679, 130671 ] ) ] ), rec(
fp:= [ 29996, 64926, 86729, 91200, 93674, 96076 ],
next:= [ 130641, rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 130659, 130644 ] ), 130638, 130662, 130650, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 130632, 130656 ] ) ] ), rec(
fp:= [ 13286, 19540, 21323, 29422, 36819, 49436, 50326, 75472 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130694, 130688 ] ), rec(
desc:= [ 106003 ],
fp:= [ 13, 211 ],
next:= [ 130692, 130687 ] ), rec(
desc:= [ 109003 ],
fp:= [ 15, 213 ],
next:= [ 130723, 130664 ] ), rec(
desc:= [ 108003 ],
fp:= [ 16, 214 ],
next:= [ 130701, 130696 ] ), rec(
desc:= [ 118007 ],
fp:= [ 18, 414 ],
next:= [ 130666, 130721 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130678, 130672 ] ), rec(
desc:= [ 117011 ],
fp:= [ 8, 414 ],
next:= [ 130697, 130703 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 130680, 130670 ] ) ] ), 130691 ] ), rec(
fp:= [ 35444, 98126 ],
level:= 5,
next:= [ rec(
desc:= [ 113007 ],
fp:= [ 18, 414 ],
next:= [ 130729, 130730 ] ), 130731 ] ) ] ) ] );
|
[
{
"context": "---------------------\n-- G E L A A S I S --\n-",
"end": 109,
"score": 0.6759924292564392,
"start": 108,
"tag": "NAME",
"value": "G"
},
{
"context": "--------------------------\n-- Copyright (c) 2006, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an",
"end": 3772,
"score": 0.9997199773788452,
"start": 3760,
"tag": "NAME",
"value": "Maxim Reznik"
},
{
"context": "the distribution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contributors ma",
"end": 4373,
"score": 0.9998500943183899,
"start": 4361,
"tag": "NAME",
"value": "Maxim Reznik"
}
] |
source/libgela/gela-embeded_links-double_lists.ads
|
faelys/gela-asis
| 4 |
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- This is effective implementation of double linked list container.
-- Item of the list contains embeded link to next and prev elements, so
-- + no memory allocation required
-- + limited undefinite types allowed as items of list
-- - it can't be in more then one list at once.
-- - easy to break list if pass element to wrong list
with Gela.Embeded_Links.Lists;
generic
type Element_Type (<>) is limited private;
type Element_Access is access all Element_Type;
-- get embeded link of element
with function Get_Next (Item : Element_Access) return Element_Access is <>;
with function Get_Prev (Item : Element_Access) return Element_Access is <>;
-- set embeded link of element
with procedure Set_Next (Item, Next : Element_Access) is <>;
with procedure Set_Prev (Item, Prev : Element_Access) is <>;
package Gela.Embeded_Links.Double_Lists is
package Simple_Lists is
new Gela.Embeded_Links.Lists (Element_Type, Element_Access);
type List is new Simple_Lists.List;
-- Empty_List : List renames List (Simple_Lists.Empty_List); ???
procedure Clear (Container : in out List);
procedure Insert_After
(Container : in out List;
After : in Element_Access;
New_Item : in Element_Access);
procedure Insert
(Container : in out List;
Before : in Element_Access;
New_Item : in Element_Access);
procedure Append
(Container : in out List;
New_Item : in Element_Access);
procedure Prepend
(Container : in out List;
New_Item : in Element_Access);
procedure Delete
(Container : in out List;
Item : in Element_Access);
procedure Delete_Next
(Container : in out List;
After : in Element_Access;
Removed : out Element_Access);
procedure Delete_First
(Container : in out List;
Removed : out Element_Access);
procedure Delete_Last
(Container : in out List;
Removed : out Element_Access);
procedure Splice_After
(Target : in out List;
Source : in out List;
After : in Element_Access := null);
generic package Generic_Search renames Simple_Lists.Generic_Search;
generic procedure For_Each renames Simple_Lists.For_Each;
generic procedure For_Each_With_Param
renames Simple_Lists.For_Each_With_Param;
generic function To_Array renames Simple_Lists.To_Array;
generic function Agreed_To_Array renames Simple_Lists.Agreed_To_Array;
generic function Agreed_To_Array_With_Param
renames Simple_Lists.Agreed_To_Array_With_Param;
private
-- Empty_List : constant List := (Tail => null);
pragma Inline (Insert);
pragma Inline (Insert_After);
pragma Inline (Append);
pragma Inline (Prepend);
pragma Inline (Delete);
pragma Inline (Delete_Next);
pragma Inline (Delete_First);
pragma Inline (Delete_Last);
pragma Inline (Splice_After);
end Gela.Embeded_Links.Double_Lists;
------------------------------------------------------------------------------
-- Copyright (c) 2006, 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.
------------------------------------------------------------------------------
|
4679
|
------------------------------------------------------------------------------
-- <NAME> E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- This is effective implementation of double linked list container.
-- Item of the list contains embeded link to next and prev elements, so
-- + no memory allocation required
-- + limited undefinite types allowed as items of list
-- - it can't be in more then one list at once.
-- - easy to break list if pass element to wrong list
with Gela.Embeded_Links.Lists;
generic
type Element_Type (<>) is limited private;
type Element_Access is access all Element_Type;
-- get embeded link of element
with function Get_Next (Item : Element_Access) return Element_Access is <>;
with function Get_Prev (Item : Element_Access) return Element_Access is <>;
-- set embeded link of element
with procedure Set_Next (Item, Next : Element_Access) is <>;
with procedure Set_Prev (Item, Prev : Element_Access) is <>;
package Gela.Embeded_Links.Double_Lists is
package Simple_Lists is
new Gela.Embeded_Links.Lists (Element_Type, Element_Access);
type List is new Simple_Lists.List;
-- Empty_List : List renames List (Simple_Lists.Empty_List); ???
procedure Clear (Container : in out List);
procedure Insert_After
(Container : in out List;
After : in Element_Access;
New_Item : in Element_Access);
procedure Insert
(Container : in out List;
Before : in Element_Access;
New_Item : in Element_Access);
procedure Append
(Container : in out List;
New_Item : in Element_Access);
procedure Prepend
(Container : in out List;
New_Item : in Element_Access);
procedure Delete
(Container : in out List;
Item : in Element_Access);
procedure Delete_Next
(Container : in out List;
After : in Element_Access;
Removed : out Element_Access);
procedure Delete_First
(Container : in out List;
Removed : out Element_Access);
procedure Delete_Last
(Container : in out List;
Removed : out Element_Access);
procedure Splice_After
(Target : in out List;
Source : in out List;
After : in Element_Access := null);
generic package Generic_Search renames Simple_Lists.Generic_Search;
generic procedure For_Each renames Simple_Lists.For_Each;
generic procedure For_Each_With_Param
renames Simple_Lists.For_Each_With_Param;
generic function To_Array renames Simple_Lists.To_Array;
generic function Agreed_To_Array renames Simple_Lists.Agreed_To_Array;
generic function Agreed_To_Array_With_Param
renames Simple_Lists.Agreed_To_Array_With_Param;
private
-- Empty_List : constant List := (Tail => null);
pragma Inline (Insert);
pragma Inline (Insert_After);
pragma Inline (Append);
pragma Inline (Prepend);
pragma Inline (Delete);
pragma Inline (Delete_Next);
pragma Inline (Delete_First);
pragma Inline (Delete_Last);
pragma Inline (Splice_After);
end Gela.Embeded_Links.Double_Lists;
------------------------------------------------------------------------------
-- Copyright (c) 2006, <NAME>
-- 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 <NAME>, 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.
------------------------------------------------------------------------------
| true |
------------------------------------------------------------------------------
-- PI:NAME:<NAME>END_PI E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- This is effective implementation of double linked list container.
-- Item of the list contains embeded link to next and prev elements, so
-- + no memory allocation required
-- + limited undefinite types allowed as items of list
-- - it can't be in more then one list at once.
-- - easy to break list if pass element to wrong list
with Gela.Embeded_Links.Lists;
generic
type Element_Type (<>) is limited private;
type Element_Access is access all Element_Type;
-- get embeded link of element
with function Get_Next (Item : Element_Access) return Element_Access is <>;
with function Get_Prev (Item : Element_Access) return Element_Access is <>;
-- set embeded link of element
with procedure Set_Next (Item, Next : Element_Access) is <>;
with procedure Set_Prev (Item, Prev : Element_Access) is <>;
package Gela.Embeded_Links.Double_Lists is
package Simple_Lists is
new Gela.Embeded_Links.Lists (Element_Type, Element_Access);
type List is new Simple_Lists.List;
-- Empty_List : List renames List (Simple_Lists.Empty_List); ???
procedure Clear (Container : in out List);
procedure Insert_After
(Container : in out List;
After : in Element_Access;
New_Item : in Element_Access);
procedure Insert
(Container : in out List;
Before : in Element_Access;
New_Item : in Element_Access);
procedure Append
(Container : in out List;
New_Item : in Element_Access);
procedure Prepend
(Container : in out List;
New_Item : in Element_Access);
procedure Delete
(Container : in out List;
Item : in Element_Access);
procedure Delete_Next
(Container : in out List;
After : in Element_Access;
Removed : out Element_Access);
procedure Delete_First
(Container : in out List;
Removed : out Element_Access);
procedure Delete_Last
(Container : in out List;
Removed : out Element_Access);
procedure Splice_After
(Target : in out List;
Source : in out List;
After : in Element_Access := null);
generic package Generic_Search renames Simple_Lists.Generic_Search;
generic procedure For_Each renames Simple_Lists.For_Each;
generic procedure For_Each_With_Param
renames Simple_Lists.For_Each_With_Param;
generic function To_Array renames Simple_Lists.To_Array;
generic function Agreed_To_Array renames Simple_Lists.Agreed_To_Array;
generic function Agreed_To_Array_With_Param
renames Simple_Lists.Agreed_To_Array_With_Param;
private
-- Empty_List : constant List := (Tail => null);
pragma Inline (Insert);
pragma Inline (Insert_After);
pragma Inline (Append);
pragma Inline (Prepend);
pragma Inline (Delete);
pragma Inline (Delete_Next);
pragma Inline (Delete_First);
pragma Inline (Delete_Last);
pragma Inline (Splice_After);
end Gela.Embeded_Links.Double_Lists;
------------------------------------------------------------------------------
-- Copyright (c) 2006, PI:NAME:<NAME>END_PI
-- 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 PI:NAME:<NAME>END_PI, 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.
------------------------------------------------------------------------------
|
[
{
"context": " data structure.\n--\n-- Original implementation by Nathanael Presson.\n--\nis\n\n type Item is tagged limited private;\n ",
"end": 736,
"score": 0.9998851418495178,
"start": 719,
"tag": "NAME",
"value": "Nathanael Presson"
}
] |
3-mid/impact/source/3d/collision/broadphase/impact-d3-collision-bounding_volume_tree.ads
|
charlie5/lace
| 20 |
with impact.d3.aabb_Util,
ada.containers.Indefinite_Vectors,
Interfaces;
with ada.containers.Vectors;
package impact.d3.collision.bounding_volume_Tree
--
-- The impact.d3.collision.bounding_volume_Tree class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree).
-- This impact.d3.collision.bounding_volume_Tree is used for soft body collision detection and for the impact.d3.collision.bounding_volume_TreeBroadphase. It has a fast insert, remove and update of nodes.
-- Unlike the impact.d3.collision.quantized_Bvh, nodes can be dynamically moved around, which allows for change in topology of the underlying data structure.
--
-- Original implementation by Nathanael Presson.
--
is
type Item is tagged limited private;
type View is access all Item'Class;
--- Defaults volumes
--
type Vector_3_view_array is array (Positive range <>) of access math.Vector_3;
-- impact.d3.collision.bounding_volume_TreeAabbMm
--
type AabbMm is tagged private;
function FromCE (c, e : in math.Vector_3 ) return AabbMm;
function FromCR (c : in math.Vector_3; r : in math.Real) return AabbMm;
function FromMM (mi, mx : in math.Vector_3) return AabbMm;
function FromPoints (pts : in Vector_3_array) return AabbMm;
function FromPoints (ppts : in Vector_3_view_array; n : in Integer) return AabbMm;
function Center (Self : in AabbMm) return math.Vector_3;
function Lengths (Self : in AabbMm) return math.Vector_3;
function Extents (Self : in AabbMm) return math.Vector_3;
function Mins (Self : in AabbMm) return math.Vector_3;
function Maxs (Self : in AabbMm) return math.Vector_3;
procedure Expand (Self : in out AabbMm; e : in math.Vector_3);
procedure SignedExpand (Self : in out AabbMm; e : in math.Vector_3);
function Contain (Self : in AabbMm'Class; a : in AabbMm'Class) return Boolean;
function Classify (Self : in AabbMm; n : in math.Vector_3;
o : in math.Real;
s : in Integer) return Integer;
function ProjectMinimum (Self : access AabbMm; v : in math.Vector_3;
signs : in interfaces.Unsigned_32) return math.Real;
function Intersect (a, b : in AabbMm'Class) return Boolean;
function Intersect (a : in AabbMm;
b : in math.Vector_3) return Boolean;
function Proximity (a, b : in AabbMm) return math.Real;
function do_Select (o, a, b : in AabbMm) return Integer;
procedure Merge (a, b : in AabbMm;
r : out AabbMm);
function NotEqual (a, b : in AabbMm) return Boolean;
-- impact.d3.collision.bounding_volume_TreeNode
--
type Node is tagged;
subtype Volume is AabbMm;
-- Container
--
type Node_view is access all Node'Class;
type Node_views is array (1 .. 2) of aliased Node_view;
package Node_Vectors is new ada.containers.Vectors (Positive, Node_view);
subtype Node_Vector is Node_Vectors.Vector;
-- type union_Kind is (use_childs, use_data, use_dataAsInt);
--
-- type Union (Kind : union_Kind := use_childs) is
-- record
-- case Kind
-- is
-- when use_childs => childs : impact.d3.collision.bounding_volume_TreeNode_views;
-- when use_data => data : access bullet.Any'Class;
-- when use_dataAsInt => dataAsInt : Integer;
-- end case;
-- end record;
type Union is
record
childs : Node_views;
data : access Any'Class;
dataAsInt : Integer;
end record;
type Node is tagged
record
volume : aliased bounding_volume_Tree.Volume;
parent : Node_view;
state : Union;
end record;
function isleaf (Self : in Node) return Boolean;
function isinternal (Self : in Node) return Boolean;
--- Policies/Interfaces
--
-- ICollide
--
type ICollide is tagged null record;
procedure destruct (Self : in out ICollide) is null;
procedure Process (Self : in out ICollide; n1, n2 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n1 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n : access Node'Class; a : in math.Real);
function Descent (Self : in ICollide; n : in Node'Class) return Boolean;
function AllLeaves (Self : in ICollide; n : in Node'Class) return Boolean;
-- IWriter
--
type IWriter is abstract tagged null record;
procedure destruct (Self : in out IWriter) is null;
procedure Prepare (Self : in out IWriter; root : in Node'Class;
numnodes : in Integer ) is abstract;
procedure WriteNode (Self : in out IWriter; n : in Node'Class;
index,
parent,
child0,
child1 : in Integer ) is abstract;
procedure WriteLeaf (Self : in out IWriter; n : in Node'Class;
index,
parent : in Integer ) is abstract;
-- IClone
--
type IClone is tagged null record;
procedure destruct (Self : in out IClone) is null;
procedure CloneLeaf (Self : in out IClone; n : in Node'Class) is null;
--- impact.d3.collision.bounding_volume_Tree
--
procedure destruct (Self : in out Item);
procedure clear (Self : in out Item);
function empty (Self : in Item) return Boolean;
procedure optimizeBottomUp (Self : in out Item);
procedure optimizeTopDown (Self : in out Item; bu_treshold : Integer := 128);
procedure optimizeIncremental (Self : in out Item; pass_Count : Integer);
function insert (Self : access Item; volume : in bounding_volume_Tree.Volume'Class;
data : access Any 'Class) return access Node'Class;
procedure update (Self : in out Item; leaf : access Node'Class;
lookahead : in Integer := -1);
procedure update (Self : in out Item; leaf : access Node 'Class;
volume : in bounding_volume_Tree.Volume'Class);
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3;
margin : in math.Real ) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
margin : in math.Real ) return Boolean;
procedure remove (Self : in out Item; leaf : access Node 'Class);
procedure write (Self : in Item; iwriter : access bounding_volume_Tree.IWriter'Class);
procedure clone (Self : in Item; dest : access Item'Class;
iclone : access impact.d3.collision.bounding_volume_Tree.IClone'Class := null);
function maxdepth (node : access bounding_volume_Tree.Node) return Integer;
function countLeaves (node : in bounding_volume_Tree.Node) return Integer;
procedure extractLeaves (node : access bounding_volume_Tree.Node; leaves : out Node_Vector);
-- DBVT_IPOLICY must support ICollide policy/interface
--
procedure enumNodes (root : access Node; policy : access ICollide'Class);
procedure enumLeaves (root : access Node; policy : access ICollide'Class);
procedure collideTT (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTTpersistentStack (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTV (Self : in Item; root : access Node'Class;
vol : in Volume'Class;
policy : access ICollide 'Class);
-- rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc)
-- rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time
--
procedure rayTest (root : access Node;
rayFrom,
rayTo : in math.Vector_3;
policy : access ICollide'Class);
-- rayTestInternal is faster than rayTest, because it uses a persistent stack (to reduce dynamic memory allocations to a minimum) and it uses precomputed signs/rayInverseDirections
-- rayTestInternal is used by impact.d3.collision.bounding_volume_TreeBroadphase to accelerate world ray casts
--
procedure rayTestInternal (Self : in out Item; root : access Node'Class;
rayFrom,
rayTo,
rayDirectionInverse : in math.Vector_3;
signs : in impact.d3.aabb_Util.Signs;
lambda_max : in math.Real;
aabbMin, aabbMax : in math.Vector_3;
policy : access ICollide'Class);
procedure collideKDOP (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
count : in Integer;
policy : access ICollide'Class);
procedure collideOCL (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
sortaxis : in math.Vector_3;
count : in Integer;
policy : access ICollide'Class;
fullsort : in Boolean := True);
procedure collideTU (root : access Node;
policy : access ICollide'Class);
-- Stack element
--
-- type sStkNN (a, b : access impact.d3.collision.bounding_volume_TreeNode) is null record;
type sStkNN is
record
a, b : access Node;
end record;
-- type sStkNP (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkNP is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
end record;
type sStkNPS is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
value : math.Real;
end record;
-- type sStkCLN (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkCLN is
record
node : access bounding_volume_Tree.Node;
parent : access bounding_volume_Tree.Node;
end record;
type sStkNPS_array is array (Positive range <>) of sStkNPS;
-- Helpers
--
package integer_Vectors is new ada.containers.Vectors (Positive, Integer);
subtype integer_Vector is integer_Vectors.Vector;
package sStkNPS_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNPS);
subtype sStkNPS_Vector is sStkNPS_Vectors.Vector;
package sStkNP_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNP);
subtype sStkNP_Vector is sStkNP_Vectors.Vector;
package sStkCLN_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkCLN);
subtype sStkCLN_Vector is sStkCLN_Vectors.Vector;
function nearest (i : in Integer_Vector;
a : in sStkNPS_Vector;
v : in math.Real;
the_l,
the_h : in Integer) return Integer;
function allocate (ifree : access Integer_Vector;
stock : access sStkNPS_Vector;
value : in sStkNPS ) return Integer;
function Root (Self : in Item) return Node_view;
function Leaves (Self : in Item) return Integer;
private
type AabbMm is tagged
record
mi, mx : aliased math.Vector_3;
end record;
procedure AddSpan (Self : in AabbMm; d : in math.Vector_3;
smi, smx : in out math.Real);
-- Constants
--
SIMPLE_STACKSIZE : constant := 64;
DOUBLE_STACKSIZE : constant := SIMPLE_STACKSIZE * 2;
package sStkNN_Vectors is new ada.containers.Indefinite_Vectors (Positive, sStkNN);
subtype sStkNN_Vector is sStkNN_Vectors.Vector;
type Item is tagged limited
record
m_root : aliased Node_view;
m_free : Node_view;
m_lkhd : Integer := -1;
m_leaves : Integer := 0;
m_opath : interfaces.Unsigned_32 := 0;
m_stkStack : sStkNN_Vector;
end record;
end impact.d3.collision.bounding_volume_Tree;
|
6879
|
with impact.d3.aabb_Util,
ada.containers.Indefinite_Vectors,
Interfaces;
with ada.containers.Vectors;
package impact.d3.collision.bounding_volume_Tree
--
-- The impact.d3.collision.bounding_volume_Tree class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree).
-- This impact.d3.collision.bounding_volume_Tree is used for soft body collision detection and for the impact.d3.collision.bounding_volume_TreeBroadphase. It has a fast insert, remove and update of nodes.
-- Unlike the impact.d3.collision.quantized_Bvh, nodes can be dynamically moved around, which allows for change in topology of the underlying data structure.
--
-- Original implementation by <NAME>.
--
is
type Item is tagged limited private;
type View is access all Item'Class;
--- Defaults volumes
--
type Vector_3_view_array is array (Positive range <>) of access math.Vector_3;
-- impact.d3.collision.bounding_volume_TreeAabbMm
--
type AabbMm is tagged private;
function FromCE (c, e : in math.Vector_3 ) return AabbMm;
function FromCR (c : in math.Vector_3; r : in math.Real) return AabbMm;
function FromMM (mi, mx : in math.Vector_3) return AabbMm;
function FromPoints (pts : in Vector_3_array) return AabbMm;
function FromPoints (ppts : in Vector_3_view_array; n : in Integer) return AabbMm;
function Center (Self : in AabbMm) return math.Vector_3;
function Lengths (Self : in AabbMm) return math.Vector_3;
function Extents (Self : in AabbMm) return math.Vector_3;
function Mins (Self : in AabbMm) return math.Vector_3;
function Maxs (Self : in AabbMm) return math.Vector_3;
procedure Expand (Self : in out AabbMm; e : in math.Vector_3);
procedure SignedExpand (Self : in out AabbMm; e : in math.Vector_3);
function Contain (Self : in AabbMm'Class; a : in AabbMm'Class) return Boolean;
function Classify (Self : in AabbMm; n : in math.Vector_3;
o : in math.Real;
s : in Integer) return Integer;
function ProjectMinimum (Self : access AabbMm; v : in math.Vector_3;
signs : in interfaces.Unsigned_32) return math.Real;
function Intersect (a, b : in AabbMm'Class) return Boolean;
function Intersect (a : in AabbMm;
b : in math.Vector_3) return Boolean;
function Proximity (a, b : in AabbMm) return math.Real;
function do_Select (o, a, b : in AabbMm) return Integer;
procedure Merge (a, b : in AabbMm;
r : out AabbMm);
function NotEqual (a, b : in AabbMm) return Boolean;
-- impact.d3.collision.bounding_volume_TreeNode
--
type Node is tagged;
subtype Volume is AabbMm;
-- Container
--
type Node_view is access all Node'Class;
type Node_views is array (1 .. 2) of aliased Node_view;
package Node_Vectors is new ada.containers.Vectors (Positive, Node_view);
subtype Node_Vector is Node_Vectors.Vector;
-- type union_Kind is (use_childs, use_data, use_dataAsInt);
--
-- type Union (Kind : union_Kind := use_childs) is
-- record
-- case Kind
-- is
-- when use_childs => childs : impact.d3.collision.bounding_volume_TreeNode_views;
-- when use_data => data : access bullet.Any'Class;
-- when use_dataAsInt => dataAsInt : Integer;
-- end case;
-- end record;
type Union is
record
childs : Node_views;
data : access Any'Class;
dataAsInt : Integer;
end record;
type Node is tagged
record
volume : aliased bounding_volume_Tree.Volume;
parent : Node_view;
state : Union;
end record;
function isleaf (Self : in Node) return Boolean;
function isinternal (Self : in Node) return Boolean;
--- Policies/Interfaces
--
-- ICollide
--
type ICollide is tagged null record;
procedure destruct (Self : in out ICollide) is null;
procedure Process (Self : in out ICollide; n1, n2 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n1 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n : access Node'Class; a : in math.Real);
function Descent (Self : in ICollide; n : in Node'Class) return Boolean;
function AllLeaves (Self : in ICollide; n : in Node'Class) return Boolean;
-- IWriter
--
type IWriter is abstract tagged null record;
procedure destruct (Self : in out IWriter) is null;
procedure Prepare (Self : in out IWriter; root : in Node'Class;
numnodes : in Integer ) is abstract;
procedure WriteNode (Self : in out IWriter; n : in Node'Class;
index,
parent,
child0,
child1 : in Integer ) is abstract;
procedure WriteLeaf (Self : in out IWriter; n : in Node'Class;
index,
parent : in Integer ) is abstract;
-- IClone
--
type IClone is tagged null record;
procedure destruct (Self : in out IClone) is null;
procedure CloneLeaf (Self : in out IClone; n : in Node'Class) is null;
--- impact.d3.collision.bounding_volume_Tree
--
procedure destruct (Self : in out Item);
procedure clear (Self : in out Item);
function empty (Self : in Item) return Boolean;
procedure optimizeBottomUp (Self : in out Item);
procedure optimizeTopDown (Self : in out Item; bu_treshold : Integer := 128);
procedure optimizeIncremental (Self : in out Item; pass_Count : Integer);
function insert (Self : access Item; volume : in bounding_volume_Tree.Volume'Class;
data : access Any 'Class) return access Node'Class;
procedure update (Self : in out Item; leaf : access Node'Class;
lookahead : in Integer := -1);
procedure update (Self : in out Item; leaf : access Node 'Class;
volume : in bounding_volume_Tree.Volume'Class);
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3;
margin : in math.Real ) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
margin : in math.Real ) return Boolean;
procedure remove (Self : in out Item; leaf : access Node 'Class);
procedure write (Self : in Item; iwriter : access bounding_volume_Tree.IWriter'Class);
procedure clone (Self : in Item; dest : access Item'Class;
iclone : access impact.d3.collision.bounding_volume_Tree.IClone'Class := null);
function maxdepth (node : access bounding_volume_Tree.Node) return Integer;
function countLeaves (node : in bounding_volume_Tree.Node) return Integer;
procedure extractLeaves (node : access bounding_volume_Tree.Node; leaves : out Node_Vector);
-- DBVT_IPOLICY must support ICollide policy/interface
--
procedure enumNodes (root : access Node; policy : access ICollide'Class);
procedure enumLeaves (root : access Node; policy : access ICollide'Class);
procedure collideTT (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTTpersistentStack (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTV (Self : in Item; root : access Node'Class;
vol : in Volume'Class;
policy : access ICollide 'Class);
-- rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc)
-- rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time
--
procedure rayTest (root : access Node;
rayFrom,
rayTo : in math.Vector_3;
policy : access ICollide'Class);
-- rayTestInternal is faster than rayTest, because it uses a persistent stack (to reduce dynamic memory allocations to a minimum) and it uses precomputed signs/rayInverseDirections
-- rayTestInternal is used by impact.d3.collision.bounding_volume_TreeBroadphase to accelerate world ray casts
--
procedure rayTestInternal (Self : in out Item; root : access Node'Class;
rayFrom,
rayTo,
rayDirectionInverse : in math.Vector_3;
signs : in impact.d3.aabb_Util.Signs;
lambda_max : in math.Real;
aabbMin, aabbMax : in math.Vector_3;
policy : access ICollide'Class);
procedure collideKDOP (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
count : in Integer;
policy : access ICollide'Class);
procedure collideOCL (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
sortaxis : in math.Vector_3;
count : in Integer;
policy : access ICollide'Class;
fullsort : in Boolean := True);
procedure collideTU (root : access Node;
policy : access ICollide'Class);
-- Stack element
--
-- type sStkNN (a, b : access impact.d3.collision.bounding_volume_TreeNode) is null record;
type sStkNN is
record
a, b : access Node;
end record;
-- type sStkNP (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkNP is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
end record;
type sStkNPS is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
value : math.Real;
end record;
-- type sStkCLN (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkCLN is
record
node : access bounding_volume_Tree.Node;
parent : access bounding_volume_Tree.Node;
end record;
type sStkNPS_array is array (Positive range <>) of sStkNPS;
-- Helpers
--
package integer_Vectors is new ada.containers.Vectors (Positive, Integer);
subtype integer_Vector is integer_Vectors.Vector;
package sStkNPS_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNPS);
subtype sStkNPS_Vector is sStkNPS_Vectors.Vector;
package sStkNP_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNP);
subtype sStkNP_Vector is sStkNP_Vectors.Vector;
package sStkCLN_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkCLN);
subtype sStkCLN_Vector is sStkCLN_Vectors.Vector;
function nearest (i : in Integer_Vector;
a : in sStkNPS_Vector;
v : in math.Real;
the_l,
the_h : in Integer) return Integer;
function allocate (ifree : access Integer_Vector;
stock : access sStkNPS_Vector;
value : in sStkNPS ) return Integer;
function Root (Self : in Item) return Node_view;
function Leaves (Self : in Item) return Integer;
private
type AabbMm is tagged
record
mi, mx : aliased math.Vector_3;
end record;
procedure AddSpan (Self : in AabbMm; d : in math.Vector_3;
smi, smx : in out math.Real);
-- Constants
--
SIMPLE_STACKSIZE : constant := 64;
DOUBLE_STACKSIZE : constant := SIMPLE_STACKSIZE * 2;
package sStkNN_Vectors is new ada.containers.Indefinite_Vectors (Positive, sStkNN);
subtype sStkNN_Vector is sStkNN_Vectors.Vector;
type Item is tagged limited
record
m_root : aliased Node_view;
m_free : Node_view;
m_lkhd : Integer := -1;
m_leaves : Integer := 0;
m_opath : interfaces.Unsigned_32 := 0;
m_stkStack : sStkNN_Vector;
end record;
end impact.d3.collision.bounding_volume_Tree;
| true |
with impact.d3.aabb_Util,
ada.containers.Indefinite_Vectors,
Interfaces;
with ada.containers.Vectors;
package impact.d3.collision.bounding_volume_Tree
--
-- The impact.d3.collision.bounding_volume_Tree class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree).
-- This impact.d3.collision.bounding_volume_Tree is used for soft body collision detection and for the impact.d3.collision.bounding_volume_TreeBroadphase. It has a fast insert, remove and update of nodes.
-- Unlike the impact.d3.collision.quantized_Bvh, nodes can be dynamically moved around, which allows for change in topology of the underlying data structure.
--
-- Original implementation by PI:NAME:<NAME>END_PI.
--
is
type Item is tagged limited private;
type View is access all Item'Class;
--- Defaults volumes
--
type Vector_3_view_array is array (Positive range <>) of access math.Vector_3;
-- impact.d3.collision.bounding_volume_TreeAabbMm
--
type AabbMm is tagged private;
function FromCE (c, e : in math.Vector_3 ) return AabbMm;
function FromCR (c : in math.Vector_3; r : in math.Real) return AabbMm;
function FromMM (mi, mx : in math.Vector_3) return AabbMm;
function FromPoints (pts : in Vector_3_array) return AabbMm;
function FromPoints (ppts : in Vector_3_view_array; n : in Integer) return AabbMm;
function Center (Self : in AabbMm) return math.Vector_3;
function Lengths (Self : in AabbMm) return math.Vector_3;
function Extents (Self : in AabbMm) return math.Vector_3;
function Mins (Self : in AabbMm) return math.Vector_3;
function Maxs (Self : in AabbMm) return math.Vector_3;
procedure Expand (Self : in out AabbMm; e : in math.Vector_3);
procedure SignedExpand (Self : in out AabbMm; e : in math.Vector_3);
function Contain (Self : in AabbMm'Class; a : in AabbMm'Class) return Boolean;
function Classify (Self : in AabbMm; n : in math.Vector_3;
o : in math.Real;
s : in Integer) return Integer;
function ProjectMinimum (Self : access AabbMm; v : in math.Vector_3;
signs : in interfaces.Unsigned_32) return math.Real;
function Intersect (a, b : in AabbMm'Class) return Boolean;
function Intersect (a : in AabbMm;
b : in math.Vector_3) return Boolean;
function Proximity (a, b : in AabbMm) return math.Real;
function do_Select (o, a, b : in AabbMm) return Integer;
procedure Merge (a, b : in AabbMm;
r : out AabbMm);
function NotEqual (a, b : in AabbMm) return Boolean;
-- impact.d3.collision.bounding_volume_TreeNode
--
type Node is tagged;
subtype Volume is AabbMm;
-- Container
--
type Node_view is access all Node'Class;
type Node_views is array (1 .. 2) of aliased Node_view;
package Node_Vectors is new ada.containers.Vectors (Positive, Node_view);
subtype Node_Vector is Node_Vectors.Vector;
-- type union_Kind is (use_childs, use_data, use_dataAsInt);
--
-- type Union (Kind : union_Kind := use_childs) is
-- record
-- case Kind
-- is
-- when use_childs => childs : impact.d3.collision.bounding_volume_TreeNode_views;
-- when use_data => data : access bullet.Any'Class;
-- when use_dataAsInt => dataAsInt : Integer;
-- end case;
-- end record;
type Union is
record
childs : Node_views;
data : access Any'Class;
dataAsInt : Integer;
end record;
type Node is tagged
record
volume : aliased bounding_volume_Tree.Volume;
parent : Node_view;
state : Union;
end record;
function isleaf (Self : in Node) return Boolean;
function isinternal (Self : in Node) return Boolean;
--- Policies/Interfaces
--
-- ICollide
--
type ICollide is tagged null record;
procedure destruct (Self : in out ICollide) is null;
procedure Process (Self : in out ICollide; n1, n2 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n1 : access Node'Class) is null;
procedure Process (Self : in out ICollide; n : access Node'Class; a : in math.Real);
function Descent (Self : in ICollide; n : in Node'Class) return Boolean;
function AllLeaves (Self : in ICollide; n : in Node'Class) return Boolean;
-- IWriter
--
type IWriter is abstract tagged null record;
procedure destruct (Self : in out IWriter) is null;
procedure Prepare (Self : in out IWriter; root : in Node'Class;
numnodes : in Integer ) is abstract;
procedure WriteNode (Self : in out IWriter; n : in Node'Class;
index,
parent,
child0,
child1 : in Integer ) is abstract;
procedure WriteLeaf (Self : in out IWriter; n : in Node'Class;
index,
parent : in Integer ) is abstract;
-- IClone
--
type IClone is tagged null record;
procedure destruct (Self : in out IClone) is null;
procedure CloneLeaf (Self : in out IClone; n : in Node'Class) is null;
--- impact.d3.collision.bounding_volume_Tree
--
procedure destruct (Self : in out Item);
procedure clear (Self : in out Item);
function empty (Self : in Item) return Boolean;
procedure optimizeBottomUp (Self : in out Item);
procedure optimizeTopDown (Self : in out Item; bu_treshold : Integer := 128);
procedure optimizeIncremental (Self : in out Item; pass_Count : Integer);
function insert (Self : access Item; volume : in bounding_volume_Tree.Volume'Class;
data : access Any 'Class) return access Node'Class;
procedure update (Self : in out Item; leaf : access Node'Class;
lookahead : in Integer := -1);
procedure update (Self : in out Item; leaf : access Node 'Class;
volume : in bounding_volume_Tree.Volume'Class);
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3;
margin : in math.Real ) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
velocity : in math.Vector_3) return Boolean;
function update (Self : access Item; leaf : access Node 'Class;
volume : access bounding_volume_Tree.Volume'Class;
margin : in math.Real ) return Boolean;
procedure remove (Self : in out Item; leaf : access Node 'Class);
procedure write (Self : in Item; iwriter : access bounding_volume_Tree.IWriter'Class);
procedure clone (Self : in Item; dest : access Item'Class;
iclone : access impact.d3.collision.bounding_volume_Tree.IClone'Class := null);
function maxdepth (node : access bounding_volume_Tree.Node) return Integer;
function countLeaves (node : in bounding_volume_Tree.Node) return Integer;
procedure extractLeaves (node : access bounding_volume_Tree.Node; leaves : out Node_Vector);
-- DBVT_IPOLICY must support ICollide policy/interface
--
procedure enumNodes (root : access Node; policy : access ICollide'Class);
procedure enumLeaves (root : access Node; policy : access ICollide'Class);
procedure collideTT (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTTpersistentStack (Self : in out Item; root0, root1 : access Node'Class;
policy : access ICollide 'Class);
procedure collideTV (Self : in Item; root : access Node'Class;
vol : in Volume'Class;
policy : access ICollide 'Class);
-- rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc)
-- rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time
--
procedure rayTest (root : access Node;
rayFrom,
rayTo : in math.Vector_3;
policy : access ICollide'Class);
-- rayTestInternal is faster than rayTest, because it uses a persistent stack (to reduce dynamic memory allocations to a minimum) and it uses precomputed signs/rayInverseDirections
-- rayTestInternal is used by impact.d3.collision.bounding_volume_TreeBroadphase to accelerate world ray casts
--
procedure rayTestInternal (Self : in out Item; root : access Node'Class;
rayFrom,
rayTo,
rayDirectionInverse : in math.Vector_3;
signs : in impact.d3.aabb_Util.Signs;
lambda_max : in math.Real;
aabbMin, aabbMax : in math.Vector_3;
policy : access ICollide'Class);
procedure collideKDOP (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
count : in Integer;
policy : access ICollide'Class);
procedure collideOCL (root : access Node;
normals : in Vector_3_array;
offsets : in math.Vector;
sortaxis : in math.Vector_3;
count : in Integer;
policy : access ICollide'Class;
fullsort : in Boolean := True);
procedure collideTU (root : access Node;
policy : access ICollide'Class);
-- Stack element
--
-- type sStkNN (a, b : access impact.d3.collision.bounding_volume_TreeNode) is null record;
type sStkNN is
record
a, b : access Node;
end record;
-- type sStkNP (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkNP is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
end record;
type sStkNPS is
record
node : access bounding_volume_Tree.Node;
mask : Flags;
value : math.Real;
end record;
-- type sStkCLN (node : access impact.d3.collision.bounding_volume_TreeNode) is
type sStkCLN is
record
node : access bounding_volume_Tree.Node;
parent : access bounding_volume_Tree.Node;
end record;
type sStkNPS_array is array (Positive range <>) of sStkNPS;
-- Helpers
--
package integer_Vectors is new ada.containers.Vectors (Positive, Integer);
subtype integer_Vector is integer_Vectors.Vector;
package sStkNPS_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNPS);
subtype sStkNPS_Vector is sStkNPS_Vectors.Vector;
package sStkNP_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkNP);
subtype sStkNP_Vector is sStkNP_Vectors.Vector;
package sStkCLN_Vectors is new ada.containers.indefinite_Vectors (Positive, sStkCLN);
subtype sStkCLN_Vector is sStkCLN_Vectors.Vector;
function nearest (i : in Integer_Vector;
a : in sStkNPS_Vector;
v : in math.Real;
the_l,
the_h : in Integer) return Integer;
function allocate (ifree : access Integer_Vector;
stock : access sStkNPS_Vector;
value : in sStkNPS ) return Integer;
function Root (Self : in Item) return Node_view;
function Leaves (Self : in Item) return Integer;
private
type AabbMm is tagged
record
mi, mx : aliased math.Vector_3;
end record;
procedure AddSpan (Self : in AabbMm; d : in math.Vector_3;
smi, smx : in out math.Real);
-- Constants
--
SIMPLE_STACKSIZE : constant := 64;
DOUBLE_STACKSIZE : constant := SIMPLE_STACKSIZE * 2;
package sStkNN_Vectors is new ada.containers.Indefinite_Vectors (Positive, sStkNN);
subtype sStkNN_Vector is sStkNN_Vectors.Vector;
type Item is tagged limited
record
m_root : aliased Node_view;
m_free : Node_view;
m_lkhd : Integer := -1;
m_leaves : Integer := 0;
m_opath : interfaces.Unsigned_32 := 0;
m_stkStack : sStkNN_Vector;
end record;
end impact.d3.collision.bounding_volume_Tree;
|
[
{
"context": "RAYS WITHIN GENERIC PROGRAM UNITS.\n\n-- HISTROY\n-- EDWARD V. BERARD, 9 AUGUST 1990\n\nWITH REPORT ;\nWITH SYST",
"end": 1461,
"score": 0.9890238642692566,
"start": 1455,
"tag": "NAME",
"value": "EDWARD"
},
{
"context": "THIN GENERIC PROGRAM UNITS.\n\n-- HISTROY\n-- EDWARD V. BERARD, 9 AUGUST 1990\n\nWITH REPORT ;\nWITH SYSTEM ;\n\nPROC",
"end": 1471,
"score": 0.9452441334724426,
"start": 1462,
"tag": "NAME",
"value": "V. BERARD"
}
] |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36204d.ada
|
best08618/asylo
| 7 |
-- C36204D.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 EACH ARRAY ATTRIBUTE YIELDS THE CORRECT VALUES.
-- BOTH ARRAY OBJECTS AND TYPES ARE CHECKED. THIS TEST CHECKS
-- THE ABOVE FOR ARRAYS WITHIN GENERIC PROGRAM UNITS.
-- HISTROY
-- EDWARD V. BERARD, 9 AUGUST 1990
WITH REPORT ;
WITH SYSTEM ;
PROCEDURE C36204D IS
SHORT_START : CONSTANT := -10 ;
SHORT_END : CONSTANT := 10 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SHORT_LENGTH : CONSTANT NATURAL := (SHORT_END - SHORT_START + 1) ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE MID_YEAR IS MONTH_TYPE RANGE MAY .. AUG ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 10,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
FUNCTION "=" (LEFT : IN SYSTEM.ADDRESS ;
RIGHT : IN SYSTEM.ADDRESS ) RETURN BOOLEAN
RENAMES SYSTEM."=" ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PACKAGE ARRAY_ATTRIBUTE_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
END ARRAY_ATTRIBUTE_TEST ;
PACKAGE BODY ARRAY_ATTRIBUTE_TEST IS
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- ARRAY_ATTRIBUTE_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST - PACKAGE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST - PACKAGE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PACKAGE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
END ARRAY_ATTRIBUTE_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PROCEDURE PROC_ARRAY_ATT_TEST ;
PROCEDURE PROC_ARRAY_ATT_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- PROC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- PROCEDURE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- PROCEDURE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PROCEDURE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
END PROC_ARRAY_ATT_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- FUNC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- FUNCTION") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- FUNCTION") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- FUNCTION") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
RETURN TRUE ;
END FUNC_ARRAY_ATT_TEST ;
BEGIN -- C36204D
REPORT.TEST ("C36204D", "ARRAY ATTRIBUTES RETURN CORRECT " &
"VALUES WITHIN GENERIC PROGRAM UNITS.") ;
LOCAL_BLOCK:
DECLARE
DUMMY : BOOLEAN := FALSE ;
PACKAGE NEW_ARRAY_ATTRIBUTE_TEST IS NEW ARRAY_ATTRIBUTE_TEST (
FIRST_INDEX => SHORT_RANGE,
FIRST_INDEX_LENGTH => SHORT_LENGTH,
FIRST_TEST_VALUE => -7,
SECOND_INDEX => MONTH_TYPE,
SECOND_INDEX_LENGTH => 12,
SECOND_TEST_VALUE => AUG,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => MONTH_TYPE,
FIRST_DEFAULT_VALUE => JAN,
SECOND_DEFAULT_VALUE => DEC,
SECOND_COMPONENT_TYPE => DATE,
THIRD_DEFAULT_VALUE => TODAY,
FOURTH_DEFAULT_VALUE => FIRST_DATE) ;
PROCEDURE NEW_PROC_ARRAY_ATT_TEST IS NEW PROC_ARRAY_ATT_TEST (
FIRST_INDEX => MONTH_TYPE,
FIRST_INDEX_LENGTH => 12,
FIRST_TEST_VALUE => AUG,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
FUNCTION NEW_FUNC_ARRAY_ATT_TEST IS NEW FUNC_ARRAY_ATT_TEST (
FIRST_INDEX => DAY_TYPE,
FIRST_INDEX_LENGTH => 31,
FIRST_TEST_VALUE => 25,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => MID_YEAR,
THIRD_INDEX_LENGTH => 4,
THIRD_TEST_VALUE => JUL,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
BEGIN -- LOCAL_BLOCK
NEW_PROC_ARRAY_ATT_TEST ;
DUMMY := NEW_FUNC_ARRAY_ATT_TEST ;
IF NOT DUMMY THEN
REPORT.FAILED ("WRONG VALUE RETURNED BY FUNCTION.") ;
END IF ;
END LOCAL_BLOCK ;
REPORT.RESULT ;
END C36204D ;
|
10286
|
-- C36204D.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 EACH ARRAY ATTRIBUTE YIELDS THE CORRECT VALUES.
-- BOTH ARRAY OBJECTS AND TYPES ARE CHECKED. THIS TEST CHECKS
-- THE ABOVE FOR ARRAYS WITHIN GENERIC PROGRAM UNITS.
-- HISTROY
-- <NAME> <NAME>, 9 AUGUST 1990
WITH REPORT ;
WITH SYSTEM ;
PROCEDURE C36204D IS
SHORT_START : CONSTANT := -10 ;
SHORT_END : CONSTANT := 10 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SHORT_LENGTH : CONSTANT NATURAL := (SHORT_END - SHORT_START + 1) ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE MID_YEAR IS MONTH_TYPE RANGE MAY .. AUG ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 10,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
FUNCTION "=" (LEFT : IN SYSTEM.ADDRESS ;
RIGHT : IN SYSTEM.ADDRESS ) RETURN BOOLEAN
RENAMES SYSTEM."=" ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PACKAGE ARRAY_ATTRIBUTE_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
END ARRAY_ATTRIBUTE_TEST ;
PACKAGE BODY ARRAY_ATTRIBUTE_TEST IS
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- ARRAY_ATTRIBUTE_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST - PACKAGE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST - PACKAGE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PACKAGE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
END ARRAY_ATTRIBUTE_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PROCEDURE PROC_ARRAY_ATT_TEST ;
PROCEDURE PROC_ARRAY_ATT_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- PROC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- PROCEDURE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- PROCEDURE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PROCEDURE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
END PROC_ARRAY_ATT_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- FUNC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- FUNCTION") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- FUNCTION") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- FUNCTION") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
RETURN TRUE ;
END FUNC_ARRAY_ATT_TEST ;
BEGIN -- C36204D
REPORT.TEST ("C36204D", "ARRAY ATTRIBUTES RETURN CORRECT " &
"VALUES WITHIN GENERIC PROGRAM UNITS.") ;
LOCAL_BLOCK:
DECLARE
DUMMY : BOOLEAN := FALSE ;
PACKAGE NEW_ARRAY_ATTRIBUTE_TEST IS NEW ARRAY_ATTRIBUTE_TEST (
FIRST_INDEX => SHORT_RANGE,
FIRST_INDEX_LENGTH => SHORT_LENGTH,
FIRST_TEST_VALUE => -7,
SECOND_INDEX => MONTH_TYPE,
SECOND_INDEX_LENGTH => 12,
SECOND_TEST_VALUE => AUG,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => MONTH_TYPE,
FIRST_DEFAULT_VALUE => JAN,
SECOND_DEFAULT_VALUE => DEC,
SECOND_COMPONENT_TYPE => DATE,
THIRD_DEFAULT_VALUE => TODAY,
FOURTH_DEFAULT_VALUE => FIRST_DATE) ;
PROCEDURE NEW_PROC_ARRAY_ATT_TEST IS NEW PROC_ARRAY_ATT_TEST (
FIRST_INDEX => MONTH_TYPE,
FIRST_INDEX_LENGTH => 12,
FIRST_TEST_VALUE => AUG,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
FUNCTION NEW_FUNC_ARRAY_ATT_TEST IS NEW FUNC_ARRAY_ATT_TEST (
FIRST_INDEX => DAY_TYPE,
FIRST_INDEX_LENGTH => 31,
FIRST_TEST_VALUE => 25,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => MID_YEAR,
THIRD_INDEX_LENGTH => 4,
THIRD_TEST_VALUE => JUL,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
BEGIN -- LOCAL_BLOCK
NEW_PROC_ARRAY_ATT_TEST ;
DUMMY := NEW_FUNC_ARRAY_ATT_TEST ;
IF NOT DUMMY THEN
REPORT.FAILED ("WRONG VALUE RETURNED BY FUNCTION.") ;
END IF ;
END LOCAL_BLOCK ;
REPORT.RESULT ;
END C36204D ;
| true |
-- C36204D.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 EACH ARRAY ATTRIBUTE YIELDS THE CORRECT VALUES.
-- BOTH ARRAY OBJECTS AND TYPES ARE CHECKED. THIS TEST CHECKS
-- THE ABOVE FOR ARRAYS WITHIN GENERIC PROGRAM UNITS.
-- HISTROY
-- PI:NAME:<NAME>END_PI PI:NAME:<NAME>END_PI, 9 AUGUST 1990
WITH REPORT ;
WITH SYSTEM ;
PROCEDURE C36204D IS
SHORT_START : CONSTANT := -10 ;
SHORT_END : CONSTANT := 10 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SHORT_LENGTH : CONSTANT NATURAL := (SHORT_END - SHORT_START + 1) ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE MID_YEAR IS MONTH_TYPE RANGE MAY .. AUG ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 10,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
FUNCTION "=" (LEFT : IN SYSTEM.ADDRESS ;
RIGHT : IN SYSTEM.ADDRESS ) RETURN BOOLEAN
RENAMES SYSTEM."=" ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PACKAGE ARRAY_ATTRIBUTE_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
END ARRAY_ATTRIBUTE_TEST ;
PACKAGE BODY ARRAY_ATTRIBUTE_TEST IS
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- ARRAY_ATTRIBUTE_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST - PACKAGE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST - PACKAGE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PACKAGE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PACKAGE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PACKAGE") ;
END IF ;
END ARRAY_ATTRIBUTE_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
PROCEDURE PROC_ARRAY_ATT_TEST ;
PROCEDURE PROC_ARRAY_ATT_TEST IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- PROC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- PROCEDURE") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- PROCEDURE") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - PROCEDURE") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- PROCEDURE") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- PROCEDURE") ;
END IF ;
END PROC_ARRAY_ATT_TEST ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
FIRST_INDEX_LENGTH : IN NATURAL ;
FIRST_TEST_VALUE : IN FIRST_INDEX ;
TYPE SECOND_INDEX IS (<>) ;
SECOND_INDEX_LENGTH : IN NATURAL ;
SECOND_TEST_VALUE : IN SECOND_INDEX ;
TYPE THIRD_INDEX IS (<>) ;
THIRD_INDEX_LENGTH : IN NATURAL ;
THIRD_TEST_VALUE : IN THIRD_INDEX ;
TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN ;
FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN IS
TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
OF FIRST_COMPONENT_TYPE ;
TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
OF SECOND_COMPONENT_TYPE ;
FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
FIRST_DEFAULT_VALUE)) ;
SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
THIRD_DEFAULT_VALUE))) ;
THIRD_ARRAY : CONSTANT MATRIX
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
SECOND_DEFAULT_VALUE)) ;
FOURTH_ARRAY : CONSTANT CUBE
:= (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
(SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
(THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
FOURTH_DEFAULT_VALUE))) ;
FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
CUBE_SIZE : NATURAL := CUBE'SIZE ;
FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
BEGIN -- FUNC_ARRAY_ATT_TEST
IF (FA1 /= FIRST_INDEX'FIRST) OR
(FA3 /= SECOND_INDEX'FIRST) OR
(SA1 /= FIRST_INDEX'FIRST) OR
(SA3 /= SECOND_INDEX'FIRST) OR
(SA5 /= THIRD_INDEX'FIRST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
"- FUNCTION") ;
END IF ;
IF (FA2 /= FIRST_INDEX'LAST) OR
(FA4 /= SECOND_INDEX'LAST) OR
(SA2 /= FIRST_INDEX'LAST) OR
(SA4 /= SECOND_INDEX'LAST) OR
(SA6 /= THIRD_INDEX'LAST) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
"- FUNCTION") ;
END IF ;
IF (FAL1 /= FIRST_INDEX_LENGTH) OR
(FAL2 /= SECOND_INDEX_LENGTH) OR
(SAL1 /= FIRST_INDEX_LENGTH) OR
(SAL2 /= SECOND_INDEX_LENGTH) OR
(SAL3 /= THIRD_INDEX_LENGTH) THEN
REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
"- FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
SECOND_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
IF FIRST_ARRAY /= THIRD_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 2-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
:= FOURTH_DEFAULT_VALUE ;
END LOOP ;
END LOOP ;
END LOOP ;
IF SECOND_ARRAY /= FOURTH_ARRAY THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"FOR 3-DIMENSIONAL ARRAY. - FUNCTION") ;
END IF ;
IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
(FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
(SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
(SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
(THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
"- FUNCTION") ;
END IF ;
IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
OR (SAA = TAA) OR (TAA = FRAA) THEN
REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
"- FUNCTION") ;
END IF ;
RETURN TRUE ;
END FUNC_ARRAY_ATT_TEST ;
BEGIN -- C36204D
REPORT.TEST ("C36204D", "ARRAY ATTRIBUTES RETURN CORRECT " &
"VALUES WITHIN GENERIC PROGRAM UNITS.") ;
LOCAL_BLOCK:
DECLARE
DUMMY : BOOLEAN := FALSE ;
PACKAGE NEW_ARRAY_ATTRIBUTE_TEST IS NEW ARRAY_ATTRIBUTE_TEST (
FIRST_INDEX => SHORT_RANGE,
FIRST_INDEX_LENGTH => SHORT_LENGTH,
FIRST_TEST_VALUE => -7,
SECOND_INDEX => MONTH_TYPE,
SECOND_INDEX_LENGTH => 12,
SECOND_TEST_VALUE => AUG,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => MONTH_TYPE,
FIRST_DEFAULT_VALUE => JAN,
SECOND_DEFAULT_VALUE => DEC,
SECOND_COMPONENT_TYPE => DATE,
THIRD_DEFAULT_VALUE => TODAY,
FOURTH_DEFAULT_VALUE => FIRST_DATE) ;
PROCEDURE NEW_PROC_ARRAY_ATT_TEST IS NEW PROC_ARRAY_ATT_TEST (
FIRST_INDEX => MONTH_TYPE,
FIRST_INDEX_LENGTH => 12,
FIRST_TEST_VALUE => AUG,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => BOOLEAN,
THIRD_INDEX_LENGTH => 2,
THIRD_TEST_VALUE => FALSE,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
FUNCTION NEW_FUNC_ARRAY_ATT_TEST IS NEW FUNC_ARRAY_ATT_TEST (
FIRST_INDEX => DAY_TYPE,
FIRST_INDEX_LENGTH => 31,
FIRST_TEST_VALUE => 25,
SECOND_INDEX => SHORT_RANGE,
SECOND_INDEX_LENGTH => SHORT_LENGTH,
SECOND_TEST_VALUE => -7,
THIRD_INDEX => MID_YEAR,
THIRD_INDEX_LENGTH => 4,
THIRD_TEST_VALUE => JUL,
FIRST_COMPONENT_TYPE => DATE,
FIRST_DEFAULT_VALUE => TODAY,
SECOND_DEFAULT_VALUE => FIRST_DATE,
SECOND_COMPONENT_TYPE => MONTH_TYPE,
THIRD_DEFAULT_VALUE => JAN,
FOURTH_DEFAULT_VALUE => DEC) ;
BEGIN -- LOCAL_BLOCK
NEW_PROC_ARRAY_ATT_TEST ;
DUMMY := NEW_FUNC_ARRAY_ATT_TEST ;
IF NOT DUMMY THEN
REPORT.FAILED ("WRONG VALUE RETURNED BY FUNCTION.") ;
END IF ;
END LOCAL_BLOCK ;
REPORT.RESULT ;
END C36204D ;
|
[
{
"context": "-----------\n-- LSE -- L-System Editor\n-- Author: Heziode\n--\n-- License:\n-- MIT License\n--\n-- Copyr",
"end": 121,
"score": 0.9521209597587585,
"start": 119,
"tag": "USERNAME",
"value": "He"
},
{
"context": "--------\n-- LSE -- L-System Editor\n-- Author: Heziode\n--\n-- License:\n-- MIT License\n--\n-- Copyright ",
"end": 126,
"score": 0.7619874477386475,
"start": 121,
"tag": "NAME",
"value": "ziode"
},
{
"context": "License:\n-- MIT License\n--\n-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>\n--\n-- Permiss",
"end": 200,
"score": 0.9998976588249207,
"start": 185,
"tag": "NAME",
"value": "Quentin Dauprat"
},
{
"context": "icense\n--\n-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>\n--\n-- Permission is he",
"end": 209,
"score": 0.9976673722267151,
"start": 202,
"tag": "USERNAME",
"value": "Heziode"
},
{
"context": "-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>\n--\n-- Permission is hereby granted, free of cha",
"end": 234,
"score": 0.9999322891235352,
"start": 212,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/model/io/lse-model-io-turtle.adb
|
Heziode/lsystem-editor
| 2 |
-------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- 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 Ada.Float_Text_IO;
with Ada.Numerics;
with Ada.Numerics.Elementary_Functions;
with Ada.Text_IO;
with LSE.Utils.Coordinate_2D;
with LSE.Utils.Coordinate_2D_Ptr;
with LSE.Utils.Utils;
package body LSE.Model.IO.Turtle is
function Initialize return Instance
is
This : Instance;
begin
return This;
end Initialize;
procedure Set_Width (This : out Instance; Value : Positive)
is
begin
This.Width := Value;
end Set_Width;
procedure Set_Height (This : out Instance; Value : Positive)
is
begin
This.Height := Value;
end Set_Height;
procedure Set_Background_Color (This : out Instance;
Value : String)
is
begin
This.Background_Color := To_Unbounded_String (Value);
end Set_Background_Color;
procedure Set_Foreground_Color (This : out Instance; Value : String)
is
begin
This.Foreground_Color := To_Unbounded_String (Value);
end Set_Foreground_Color;
procedure Set_Angle (This : out Instance;
Value : LSE.Utils.Angle.Angle)
is
begin
This.Angle := Value;
end Set_Angle;
function Get_Width (This : Instance) return Positive
is
begin
return This.Width;
end Get_Width;
function Get_Height (This : Instance) return Positive
is
begin
return This.Height;
end Get_Height;
function Get_Background_Color (This : Instance) return String
is
begin
return To_String (This.Background_Color);
end Get_Background_Color;
function Get_Foreground_Color (This : Instance) return String
is
begin
return To_String (This.Foreground_Color);
end Get_Foreground_Color;
function Get_Offset_X (This : Instance) return Float
is
begin
return This.Offset_X;
end Get_Offset_X;
function Get_Offset_Y (This : Instance) return Float
is
begin
return This.Offset_Y;
end Get_Offset_Y;
function Get_Max_X (This : Instance) return Float
is
begin
return This.Max_X;
end Get_Max_X;
function Get_Max_Y (This : Instance) return Float
is
begin
return This.Max_Y;
end Get_Max_Y;
function Get_Min_X (This : Instance) return Float
is
begin
return This.Min_X;
end Get_Min_X;
function Get_Min_Y (This : Instance) return Float
is
begin
return This.Min_Y;
end Get_Min_Y;
procedure Set_Max_X (This : out Instance; Value : Float)
is
begin
This.Max_X := Value;
end Set_Max_X;
procedure Set_Max_Y (This : out Instance; Value : Float)
is
begin
This.Max_Y := Value;
end Set_Max_Y;
procedure Set_Min_X (This : out Instance; Value : Float)
is
begin
This.Min_X := Value;
end Set_Min_X;
procedure Set_Min_Y (This : out Instance; Value : Float)
is
begin
This.Min_Y := Value;
end Set_Min_Y;
function Get_Margin_Top (This : Instance) return Float
is
begin
return This.Margin_Top;
end Get_Margin_Top;
function Get_Margin_Right (This : Instance) return Float
is
begin
return This.Margin_Right;
end Get_Margin_Right;
function Get_Margin_Bottom (This : Instance) return Float
is
begin
return This.Margin_Bottom;
end Get_Margin_Bottom;
function Get_Margin_Left (This : Instance) return Float
is
begin
return This.Margin_Left;
end Get_Margin_Left;
function Get_Medium (This : Instance)
return LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder
is
begin
return This.Medium;
end Get_Medium;
procedure Set_Margin_Top (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
end Set_Margin_Top;
procedure Set_Margin_Right (This : out Instance; Value : Natural)
is
begin
This.Margin_Right := Float (Value);
end Set_Margin_Right;
procedure Set_Margin_Bottom (This : out Instance; Value : Natural)
is
begin
This.Margin_Bottom := Float (Value);
end Set_Margin_Bottom;
procedure Set_Margin_Left (This : out Instance; Value : Natural)
is
begin
This.Margin_Left := Float (Value);
end Set_Margin_Left;
procedure Set_Margin (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
This.Margin_Right := Float (Value);
This.Margin_Bottom := Float (Value);
This.Margin_Left := Float (Value);
end Set_Margin;
procedure Set_Medium (This : out Instance;
Value : LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder)
is
begin
This.Medium := Value;
end Set_Medium;
procedure Set_Dry_Run (This : out Instance; Value : Boolean)
is
begin
This.Dry_Run := Value;
end Set_Dry_Run;
procedure Put (This : Instance)
is
use Ada.Text_IO;
use Ada.Float_Text_IO;
begin
Put_Line ("Turtle:");
Put_Line (" Width :" & Positive'Image (This.Width));
Put_Line (" Height :" & Positive'Image (This.Height));
Put_Line (" Background_Color : " & To_String (This.Background_Color));
Put_Line (" Foreground_Color : " & To_String (This.Foreground_Color));
Put (" Line_Size : ");
Put (Item => This.Line_Size, Aft => 2, Exp => 0);
New_Line;
Put (" Angle :");
Put (Item => Float (This.Angle), Aft => 2, Exp => 0);
New_Line;
Put (" Max_X :");
Put (Item => This.Max_X, Aft => 2, Exp => 0);
New_Line;
Put (" Max_Y :");
Put (Item => This.Max_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Min_X :");
Put (Item => This.Min_X, Aft => 2, Exp => 0);
New_Line;
Put (" Min_Y :");
Put (Item => This.Min_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Ratio :");
Put (Item => This.Ratio, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_X :");
Put (Item => This.Offset_X, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_Y :");
Put (Item => This.Offset_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Top :");
Put (Item => This.Margin_Top, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Right :");
Put (Item => This.Margin_Right, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Bottom :");
Put (Item => This.Margin_Bottom, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Left :");
Put (Item => This.Margin_Left, Aft => 2, Exp => 0);
New_Line;
end Put;
procedure Make_Offset (This : in out Instance)
is
Boxed_Width : constant Float :=
Float (This.Width) - This.Margin_Right - This.Margin_Left;
Boxed_Height : constant Float :=
Float (This.Height) - This.Margin_Top - This.Margin_Bottom;
begin
if (This.Max_X - This.Min_X) = 0.0 or (This.Max_Y - This.Min_Y) = 0.0
then
raise Divide_By_Zero;
end if;
if Boxed_Width / (This.Max_X - This.Min_X) <=
Boxed_Height / (This.Max_Y - This.Min_Y)
then
-- X has the smallest delta
This.Ratio := Boxed_Width / (This.Max_X - This.Min_X);
else
-- Y has the smallest delta
This.Ratio := Boxed_Height / (This.Max_Y - This.Min_Y);
end if;
This.Offset_X := (Boxed_Width / 2.0) -
(((This.Ratio * This.Max_X
- This.Ratio * This.Min_X) / 2.0)
+ This.Ratio * This.Min_X);
This.Offset_Y := (Boxed_Height / 2.0) -
(((This.Ratio * This.Max_Y
- This.Ratio * This.Min_Y) / 2.0)
+ This.Ratio * This.Min_Y);
end Make_Offset;
procedure Configure (This : in out Instance)
is
use Ada.Strings;
begin
if not This.Dry_Run then
This.Make_Offset;
end if;
This.Stack_Angle.Clear;
This.Stack_Coordinate.Clear;
if This.Dry_Run then
This.Max_X := 0.0;
This.Max_Y := 0.0;
This.Min_X := 0.0;
This.Min_Y := 0.0;
else
-- Configure the medium
This.Medium.Reference.Configure (This);
end if;
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (90.0));
This.Stack_Coordinate.Append (
LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
end Configure;
procedure Draw (This : in out Instance)
is
begin
if not This.Dry_Run then
This.Medium.Reference.Draw;
end if;
end Draw;
procedure Forward (This : in out Instance; Trace : Boolean := False)
is
use Ada.Float_Text_IO;
use Ada.Numerics.Elementary_Functions;
------------------------
-- Methods prototype --
------------------------
-- Callback of Update_Element of Stack_Coordinate
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder);
-- Update all corners of the L-System edges
procedure Update_Corners (This : in out Instance);
-----------------------------
-- Declaration of methods --
-----------------------------
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder)
is
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder := Item;
X : constant Float := This.Ratio *
This.Line_Size * Cos (This.Stack_Angle.Last_Element, Degrees_Cycle);
Y : constant Float := This.Ratio *
This.Line_Size * Sin (This.Stack_Angle.Last_Element, Degrees_Cycle);
begin
Copy.Reference.Set_X (X);
Copy.Reference.Set_Y (Y);
Item.Move (Copy);
end Update;
procedure Update_Corners (This : in out Instance)
is
X, Y : Float := 0.0;
begin
for H of reverse This.Stack_Coordinate loop
X := X + H.Reference.Get_X;
Y := Y + H.Reference.Get_Y;
end loop;
if X < This.Min_X then
This.Min_X := X;
elsif X > This.Max_X then
This.Max_X := X;
end if;
if Y < This.Min_Y then
This.Min_Y := Y;
elsif Y > This.Max_Y then
This.Max_Y := Y;
end if;
end Update_Corners;
---------------
-- Variables --
---------------
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder :=
This.Stack_Coordinate.Last_Element.Copy;
begin
This.Stack_Coordinate.Update_Element
(Index => This.Stack_Coordinate.Last_Index,
Process => Update'Access);
if not This.Dry_Run then
This.Medium.Reference.Forward
(This.Stack_Coordinate.Last_Element.Element, Trace);
end if;
Copy.Reference.Set_X (This.Stack_Coordinate.Last_Element.Element.Get_X +
Copy.Reference.Get_X);
Copy.Reference.Set_Y (This.Stack_Coordinate.Last_Element.Element.Get_Y +
Copy.Reference.Get_Y);
This.Stack_Coordinate.Delete_Last;
This.Stack_Coordinate.Append (Copy);
if This.Dry_Run then
Update_Corners (This);
end if;
end Forward;
procedure Rotate_Clockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element - This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Clockwise;
end if;
end Rotate_Clockwise;
procedure Rotate_Anticlockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Anticlockwise;
end if;
end Rotate_Anticlockwise;
procedure UTurn (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + 180.0));
if not This.Dry_Run then
This.Medium.Reference.UTurn;
end if;
end UTurn;
procedure Position_Save (This : in out Instance)
is
begin
This.Stack_Coordinate.Append (LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (
This.Stack_Angle.Last_Element));
if not This.Dry_Run then
This.Medium.Reference.Position_Save;
end if;
end Position_Save;
procedure Position_Restore (This : in out Instance)
is
use LSE.Utils.Utils;
Item : LSE.Utils.Coordinate_2D_Ptr.Holder;
X : Fixed_Point;
Y : Fixed_Point;
begin
Item := This.Stack_Coordinate.Last_Element;
X := -Fixed_Point (Item.Element.Get_X);
Y := -Fixed_Point (Item.Element.Get_Y);
This.Stack_Angle.Delete_Last;
This.Stack_Coordinate.Delete_Last;
if not This.Dry_Run then
This.Medium.Reference.Position_Restore (X, Y);
end if;
end Position_Restore;
end LSE.Model.IO.Turtle;
|
2106
|
-------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: He<NAME>
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 <NAME> (Heziode) <<EMAIL>>
--
-- 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 Ada.Float_Text_IO;
with Ada.Numerics;
with Ada.Numerics.Elementary_Functions;
with Ada.Text_IO;
with LSE.Utils.Coordinate_2D;
with LSE.Utils.Coordinate_2D_Ptr;
with LSE.Utils.Utils;
package body LSE.Model.IO.Turtle is
function Initialize return Instance
is
This : Instance;
begin
return This;
end Initialize;
procedure Set_Width (This : out Instance; Value : Positive)
is
begin
This.Width := Value;
end Set_Width;
procedure Set_Height (This : out Instance; Value : Positive)
is
begin
This.Height := Value;
end Set_Height;
procedure Set_Background_Color (This : out Instance;
Value : String)
is
begin
This.Background_Color := To_Unbounded_String (Value);
end Set_Background_Color;
procedure Set_Foreground_Color (This : out Instance; Value : String)
is
begin
This.Foreground_Color := To_Unbounded_String (Value);
end Set_Foreground_Color;
procedure Set_Angle (This : out Instance;
Value : LSE.Utils.Angle.Angle)
is
begin
This.Angle := Value;
end Set_Angle;
function Get_Width (This : Instance) return Positive
is
begin
return This.Width;
end Get_Width;
function Get_Height (This : Instance) return Positive
is
begin
return This.Height;
end Get_Height;
function Get_Background_Color (This : Instance) return String
is
begin
return To_String (This.Background_Color);
end Get_Background_Color;
function Get_Foreground_Color (This : Instance) return String
is
begin
return To_String (This.Foreground_Color);
end Get_Foreground_Color;
function Get_Offset_X (This : Instance) return Float
is
begin
return This.Offset_X;
end Get_Offset_X;
function Get_Offset_Y (This : Instance) return Float
is
begin
return This.Offset_Y;
end Get_Offset_Y;
function Get_Max_X (This : Instance) return Float
is
begin
return This.Max_X;
end Get_Max_X;
function Get_Max_Y (This : Instance) return Float
is
begin
return This.Max_Y;
end Get_Max_Y;
function Get_Min_X (This : Instance) return Float
is
begin
return This.Min_X;
end Get_Min_X;
function Get_Min_Y (This : Instance) return Float
is
begin
return This.Min_Y;
end Get_Min_Y;
procedure Set_Max_X (This : out Instance; Value : Float)
is
begin
This.Max_X := Value;
end Set_Max_X;
procedure Set_Max_Y (This : out Instance; Value : Float)
is
begin
This.Max_Y := Value;
end Set_Max_Y;
procedure Set_Min_X (This : out Instance; Value : Float)
is
begin
This.Min_X := Value;
end Set_Min_X;
procedure Set_Min_Y (This : out Instance; Value : Float)
is
begin
This.Min_Y := Value;
end Set_Min_Y;
function Get_Margin_Top (This : Instance) return Float
is
begin
return This.Margin_Top;
end Get_Margin_Top;
function Get_Margin_Right (This : Instance) return Float
is
begin
return This.Margin_Right;
end Get_Margin_Right;
function Get_Margin_Bottom (This : Instance) return Float
is
begin
return This.Margin_Bottom;
end Get_Margin_Bottom;
function Get_Margin_Left (This : Instance) return Float
is
begin
return This.Margin_Left;
end Get_Margin_Left;
function Get_Medium (This : Instance)
return LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder
is
begin
return This.Medium;
end Get_Medium;
procedure Set_Margin_Top (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
end Set_Margin_Top;
procedure Set_Margin_Right (This : out Instance; Value : Natural)
is
begin
This.Margin_Right := Float (Value);
end Set_Margin_Right;
procedure Set_Margin_Bottom (This : out Instance; Value : Natural)
is
begin
This.Margin_Bottom := Float (Value);
end Set_Margin_Bottom;
procedure Set_Margin_Left (This : out Instance; Value : Natural)
is
begin
This.Margin_Left := Float (Value);
end Set_Margin_Left;
procedure Set_Margin (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
This.Margin_Right := Float (Value);
This.Margin_Bottom := Float (Value);
This.Margin_Left := Float (Value);
end Set_Margin;
procedure Set_Medium (This : out Instance;
Value : LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder)
is
begin
This.Medium := Value;
end Set_Medium;
procedure Set_Dry_Run (This : out Instance; Value : Boolean)
is
begin
This.Dry_Run := Value;
end Set_Dry_Run;
procedure Put (This : Instance)
is
use Ada.Text_IO;
use Ada.Float_Text_IO;
begin
Put_Line ("Turtle:");
Put_Line (" Width :" & Positive'Image (This.Width));
Put_Line (" Height :" & Positive'Image (This.Height));
Put_Line (" Background_Color : " & To_String (This.Background_Color));
Put_Line (" Foreground_Color : " & To_String (This.Foreground_Color));
Put (" Line_Size : ");
Put (Item => This.Line_Size, Aft => 2, Exp => 0);
New_Line;
Put (" Angle :");
Put (Item => Float (This.Angle), Aft => 2, Exp => 0);
New_Line;
Put (" Max_X :");
Put (Item => This.Max_X, Aft => 2, Exp => 0);
New_Line;
Put (" Max_Y :");
Put (Item => This.Max_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Min_X :");
Put (Item => This.Min_X, Aft => 2, Exp => 0);
New_Line;
Put (" Min_Y :");
Put (Item => This.Min_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Ratio :");
Put (Item => This.Ratio, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_X :");
Put (Item => This.Offset_X, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_Y :");
Put (Item => This.Offset_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Top :");
Put (Item => This.Margin_Top, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Right :");
Put (Item => This.Margin_Right, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Bottom :");
Put (Item => This.Margin_Bottom, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Left :");
Put (Item => This.Margin_Left, Aft => 2, Exp => 0);
New_Line;
end Put;
procedure Make_Offset (This : in out Instance)
is
Boxed_Width : constant Float :=
Float (This.Width) - This.Margin_Right - This.Margin_Left;
Boxed_Height : constant Float :=
Float (This.Height) - This.Margin_Top - This.Margin_Bottom;
begin
if (This.Max_X - This.Min_X) = 0.0 or (This.Max_Y - This.Min_Y) = 0.0
then
raise Divide_By_Zero;
end if;
if Boxed_Width / (This.Max_X - This.Min_X) <=
Boxed_Height / (This.Max_Y - This.Min_Y)
then
-- X has the smallest delta
This.Ratio := Boxed_Width / (This.Max_X - This.Min_X);
else
-- Y has the smallest delta
This.Ratio := Boxed_Height / (This.Max_Y - This.Min_Y);
end if;
This.Offset_X := (Boxed_Width / 2.0) -
(((This.Ratio * This.Max_X
- This.Ratio * This.Min_X) / 2.0)
+ This.Ratio * This.Min_X);
This.Offset_Y := (Boxed_Height / 2.0) -
(((This.Ratio * This.Max_Y
- This.Ratio * This.Min_Y) / 2.0)
+ This.Ratio * This.Min_Y);
end Make_Offset;
procedure Configure (This : in out Instance)
is
use Ada.Strings;
begin
if not This.Dry_Run then
This.Make_Offset;
end if;
This.Stack_Angle.Clear;
This.Stack_Coordinate.Clear;
if This.Dry_Run then
This.Max_X := 0.0;
This.Max_Y := 0.0;
This.Min_X := 0.0;
This.Min_Y := 0.0;
else
-- Configure the medium
This.Medium.Reference.Configure (This);
end if;
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (90.0));
This.Stack_Coordinate.Append (
LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
end Configure;
procedure Draw (This : in out Instance)
is
begin
if not This.Dry_Run then
This.Medium.Reference.Draw;
end if;
end Draw;
procedure Forward (This : in out Instance; Trace : Boolean := False)
is
use Ada.Float_Text_IO;
use Ada.Numerics.Elementary_Functions;
------------------------
-- Methods prototype --
------------------------
-- Callback of Update_Element of Stack_Coordinate
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder);
-- Update all corners of the L-System edges
procedure Update_Corners (This : in out Instance);
-----------------------------
-- Declaration of methods --
-----------------------------
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder)
is
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder := Item;
X : constant Float := This.Ratio *
This.Line_Size * Cos (This.Stack_Angle.Last_Element, Degrees_Cycle);
Y : constant Float := This.Ratio *
This.Line_Size * Sin (This.Stack_Angle.Last_Element, Degrees_Cycle);
begin
Copy.Reference.Set_X (X);
Copy.Reference.Set_Y (Y);
Item.Move (Copy);
end Update;
procedure Update_Corners (This : in out Instance)
is
X, Y : Float := 0.0;
begin
for H of reverse This.Stack_Coordinate loop
X := X + H.Reference.Get_X;
Y := Y + H.Reference.Get_Y;
end loop;
if X < This.Min_X then
This.Min_X := X;
elsif X > This.Max_X then
This.Max_X := X;
end if;
if Y < This.Min_Y then
This.Min_Y := Y;
elsif Y > This.Max_Y then
This.Max_Y := Y;
end if;
end Update_Corners;
---------------
-- Variables --
---------------
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder :=
This.Stack_Coordinate.Last_Element.Copy;
begin
This.Stack_Coordinate.Update_Element
(Index => This.Stack_Coordinate.Last_Index,
Process => Update'Access);
if not This.Dry_Run then
This.Medium.Reference.Forward
(This.Stack_Coordinate.Last_Element.Element, Trace);
end if;
Copy.Reference.Set_X (This.Stack_Coordinate.Last_Element.Element.Get_X +
Copy.Reference.Get_X);
Copy.Reference.Set_Y (This.Stack_Coordinate.Last_Element.Element.Get_Y +
Copy.Reference.Get_Y);
This.Stack_Coordinate.Delete_Last;
This.Stack_Coordinate.Append (Copy);
if This.Dry_Run then
Update_Corners (This);
end if;
end Forward;
procedure Rotate_Clockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element - This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Clockwise;
end if;
end Rotate_Clockwise;
procedure Rotate_Anticlockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Anticlockwise;
end if;
end Rotate_Anticlockwise;
procedure UTurn (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + 180.0));
if not This.Dry_Run then
This.Medium.Reference.UTurn;
end if;
end UTurn;
procedure Position_Save (This : in out Instance)
is
begin
This.Stack_Coordinate.Append (LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (
This.Stack_Angle.Last_Element));
if not This.Dry_Run then
This.Medium.Reference.Position_Save;
end if;
end Position_Save;
procedure Position_Restore (This : in out Instance)
is
use LSE.Utils.Utils;
Item : LSE.Utils.Coordinate_2D_Ptr.Holder;
X : Fixed_Point;
Y : Fixed_Point;
begin
Item := This.Stack_Coordinate.Last_Element;
X := -Fixed_Point (Item.Element.Get_X);
Y := -Fixed_Point (Item.Element.Get_Y);
This.Stack_Angle.Delete_Last;
This.Stack_Coordinate.Delete_Last;
if not This.Dry_Run then
This.Medium.Reference.Position_Restore (X, Y);
end if;
end Position_Restore;
end LSE.Model.IO.Turtle;
| true |
-------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: HePI:NAME:<NAME>END_PI
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 PI:NAME:<NAME>END_PI (Heziode) <PI:EMAIL:<EMAIL>END_PI>
--
-- 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 Ada.Float_Text_IO;
with Ada.Numerics;
with Ada.Numerics.Elementary_Functions;
with Ada.Text_IO;
with LSE.Utils.Coordinate_2D;
with LSE.Utils.Coordinate_2D_Ptr;
with LSE.Utils.Utils;
package body LSE.Model.IO.Turtle is
function Initialize return Instance
is
This : Instance;
begin
return This;
end Initialize;
procedure Set_Width (This : out Instance; Value : Positive)
is
begin
This.Width := Value;
end Set_Width;
procedure Set_Height (This : out Instance; Value : Positive)
is
begin
This.Height := Value;
end Set_Height;
procedure Set_Background_Color (This : out Instance;
Value : String)
is
begin
This.Background_Color := To_Unbounded_String (Value);
end Set_Background_Color;
procedure Set_Foreground_Color (This : out Instance; Value : String)
is
begin
This.Foreground_Color := To_Unbounded_String (Value);
end Set_Foreground_Color;
procedure Set_Angle (This : out Instance;
Value : LSE.Utils.Angle.Angle)
is
begin
This.Angle := Value;
end Set_Angle;
function Get_Width (This : Instance) return Positive
is
begin
return This.Width;
end Get_Width;
function Get_Height (This : Instance) return Positive
is
begin
return This.Height;
end Get_Height;
function Get_Background_Color (This : Instance) return String
is
begin
return To_String (This.Background_Color);
end Get_Background_Color;
function Get_Foreground_Color (This : Instance) return String
is
begin
return To_String (This.Foreground_Color);
end Get_Foreground_Color;
function Get_Offset_X (This : Instance) return Float
is
begin
return This.Offset_X;
end Get_Offset_X;
function Get_Offset_Y (This : Instance) return Float
is
begin
return This.Offset_Y;
end Get_Offset_Y;
function Get_Max_X (This : Instance) return Float
is
begin
return This.Max_X;
end Get_Max_X;
function Get_Max_Y (This : Instance) return Float
is
begin
return This.Max_Y;
end Get_Max_Y;
function Get_Min_X (This : Instance) return Float
is
begin
return This.Min_X;
end Get_Min_X;
function Get_Min_Y (This : Instance) return Float
is
begin
return This.Min_Y;
end Get_Min_Y;
procedure Set_Max_X (This : out Instance; Value : Float)
is
begin
This.Max_X := Value;
end Set_Max_X;
procedure Set_Max_Y (This : out Instance; Value : Float)
is
begin
This.Max_Y := Value;
end Set_Max_Y;
procedure Set_Min_X (This : out Instance; Value : Float)
is
begin
This.Min_X := Value;
end Set_Min_X;
procedure Set_Min_Y (This : out Instance; Value : Float)
is
begin
This.Min_Y := Value;
end Set_Min_Y;
function Get_Margin_Top (This : Instance) return Float
is
begin
return This.Margin_Top;
end Get_Margin_Top;
function Get_Margin_Right (This : Instance) return Float
is
begin
return This.Margin_Right;
end Get_Margin_Right;
function Get_Margin_Bottom (This : Instance) return Float
is
begin
return This.Margin_Bottom;
end Get_Margin_Bottom;
function Get_Margin_Left (This : Instance) return Float
is
begin
return This.Margin_Left;
end Get_Margin_Left;
function Get_Medium (This : Instance)
return LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder
is
begin
return This.Medium;
end Get_Medium;
procedure Set_Margin_Top (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
end Set_Margin_Top;
procedure Set_Margin_Right (This : out Instance; Value : Natural)
is
begin
This.Margin_Right := Float (Value);
end Set_Margin_Right;
procedure Set_Margin_Bottom (This : out Instance; Value : Natural)
is
begin
This.Margin_Bottom := Float (Value);
end Set_Margin_Bottom;
procedure Set_Margin_Left (This : out Instance; Value : Natural)
is
begin
This.Margin_Left := Float (Value);
end Set_Margin_Left;
procedure Set_Margin (This : out Instance; Value : Natural)
is
begin
This.Margin_Top := Float (Value);
This.Margin_Right := Float (Value);
This.Margin_Bottom := Float (Value);
This.Margin_Left := Float (Value);
end Set_Margin;
procedure Set_Medium (This : out Instance;
Value : LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder)
is
begin
This.Medium := Value;
end Set_Medium;
procedure Set_Dry_Run (This : out Instance; Value : Boolean)
is
begin
This.Dry_Run := Value;
end Set_Dry_Run;
procedure Put (This : Instance)
is
use Ada.Text_IO;
use Ada.Float_Text_IO;
begin
Put_Line ("Turtle:");
Put_Line (" Width :" & Positive'Image (This.Width));
Put_Line (" Height :" & Positive'Image (This.Height));
Put_Line (" Background_Color : " & To_String (This.Background_Color));
Put_Line (" Foreground_Color : " & To_String (This.Foreground_Color));
Put (" Line_Size : ");
Put (Item => This.Line_Size, Aft => 2, Exp => 0);
New_Line;
Put (" Angle :");
Put (Item => Float (This.Angle), Aft => 2, Exp => 0);
New_Line;
Put (" Max_X :");
Put (Item => This.Max_X, Aft => 2, Exp => 0);
New_Line;
Put (" Max_Y :");
Put (Item => This.Max_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Min_X :");
Put (Item => This.Min_X, Aft => 2, Exp => 0);
New_Line;
Put (" Min_Y :");
Put (Item => This.Min_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Ratio :");
Put (Item => This.Ratio, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_X :");
Put (Item => This.Offset_X, Aft => 2, Exp => 0);
New_Line;
Put (" Offset_Y :");
Put (Item => This.Offset_Y, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Top :");
Put (Item => This.Margin_Top, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Right :");
Put (Item => This.Margin_Right, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Bottom :");
Put (Item => This.Margin_Bottom, Aft => 2, Exp => 0);
New_Line;
Put (" Margin_Left :");
Put (Item => This.Margin_Left, Aft => 2, Exp => 0);
New_Line;
end Put;
procedure Make_Offset (This : in out Instance)
is
Boxed_Width : constant Float :=
Float (This.Width) - This.Margin_Right - This.Margin_Left;
Boxed_Height : constant Float :=
Float (This.Height) - This.Margin_Top - This.Margin_Bottom;
begin
if (This.Max_X - This.Min_X) = 0.0 or (This.Max_Y - This.Min_Y) = 0.0
then
raise Divide_By_Zero;
end if;
if Boxed_Width / (This.Max_X - This.Min_X) <=
Boxed_Height / (This.Max_Y - This.Min_Y)
then
-- X has the smallest delta
This.Ratio := Boxed_Width / (This.Max_X - This.Min_X);
else
-- Y has the smallest delta
This.Ratio := Boxed_Height / (This.Max_Y - This.Min_Y);
end if;
This.Offset_X := (Boxed_Width / 2.0) -
(((This.Ratio * This.Max_X
- This.Ratio * This.Min_X) / 2.0)
+ This.Ratio * This.Min_X);
This.Offset_Y := (Boxed_Height / 2.0) -
(((This.Ratio * This.Max_Y
- This.Ratio * This.Min_Y) / 2.0)
+ This.Ratio * This.Min_Y);
end Make_Offset;
procedure Configure (This : in out Instance)
is
use Ada.Strings;
begin
if not This.Dry_Run then
This.Make_Offset;
end if;
This.Stack_Angle.Clear;
This.Stack_Coordinate.Clear;
if This.Dry_Run then
This.Max_X := 0.0;
This.Max_Y := 0.0;
This.Min_X := 0.0;
This.Min_Y := 0.0;
else
-- Configure the medium
This.Medium.Reference.Configure (This);
end if;
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (90.0));
This.Stack_Coordinate.Append (
LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
end Configure;
procedure Draw (This : in out Instance)
is
begin
if not This.Dry_Run then
This.Medium.Reference.Draw;
end if;
end Draw;
procedure Forward (This : in out Instance; Trace : Boolean := False)
is
use Ada.Float_Text_IO;
use Ada.Numerics.Elementary_Functions;
------------------------
-- Methods prototype --
------------------------
-- Callback of Update_Element of Stack_Coordinate
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder);
-- Update all corners of the L-System edges
procedure Update_Corners (This : in out Instance);
-----------------------------
-- Declaration of methods --
-----------------------------
procedure Update (Item : in out LSE.Utils.Coordinate_2D_Ptr.Holder)
is
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder := Item;
X : constant Float := This.Ratio *
This.Line_Size * Cos (This.Stack_Angle.Last_Element, Degrees_Cycle);
Y : constant Float := This.Ratio *
This.Line_Size * Sin (This.Stack_Angle.Last_Element, Degrees_Cycle);
begin
Copy.Reference.Set_X (X);
Copy.Reference.Set_Y (Y);
Item.Move (Copy);
end Update;
procedure Update_Corners (This : in out Instance)
is
X, Y : Float := 0.0;
begin
for H of reverse This.Stack_Coordinate loop
X := X + H.Reference.Get_X;
Y := Y + H.Reference.Get_Y;
end loop;
if X < This.Min_X then
This.Min_X := X;
elsif X > This.Max_X then
This.Max_X := X;
end if;
if Y < This.Min_Y then
This.Min_Y := Y;
elsif Y > This.Max_Y then
This.Max_Y := Y;
end if;
end Update_Corners;
---------------
-- Variables --
---------------
Copy : LSE.Utils.Coordinate_2D_Ptr.Holder :=
This.Stack_Coordinate.Last_Element.Copy;
begin
This.Stack_Coordinate.Update_Element
(Index => This.Stack_Coordinate.Last_Index,
Process => Update'Access);
if not This.Dry_Run then
This.Medium.Reference.Forward
(This.Stack_Coordinate.Last_Element.Element, Trace);
end if;
Copy.Reference.Set_X (This.Stack_Coordinate.Last_Element.Element.Get_X +
Copy.Reference.Get_X);
Copy.Reference.Set_Y (This.Stack_Coordinate.Last_Element.Element.Get_Y +
Copy.Reference.Get_Y);
This.Stack_Coordinate.Delete_Last;
This.Stack_Coordinate.Append (Copy);
if This.Dry_Run then
Update_Corners (This);
end if;
end Forward;
procedure Rotate_Clockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element - This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Clockwise;
end if;
end Rotate_Clockwise;
procedure Rotate_Anticlockwise (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + This.Angle));
if not This.Dry_Run then
This.Medium.Reference.Rotate_Anticlockwise;
end if;
end Rotate_Anticlockwise;
procedure UTurn (This : in out Instance)
is
begin
This.Stack_Angle.Replace_Element
(This.Stack_Angle.Last,
To_Angle (This.Stack_Angle.Last_Element + 180.0));
if not This.Dry_Run then
This.Medium.Reference.UTurn;
end if;
end UTurn;
procedure Position_Save (This : in out Instance)
is
begin
This.Stack_Coordinate.Append (LSE.Utils.Coordinate_2D_Ptr.To_Holder (
LSE.Utils.Coordinate_2D.Initialize));
This.Stack_Angle.Append (LSE.Utils.Angle.To_Angle (
This.Stack_Angle.Last_Element));
if not This.Dry_Run then
This.Medium.Reference.Position_Save;
end if;
end Position_Save;
procedure Position_Restore (This : in out Instance)
is
use LSE.Utils.Utils;
Item : LSE.Utils.Coordinate_2D_Ptr.Holder;
X : Fixed_Point;
Y : Fixed_Point;
begin
Item := This.Stack_Coordinate.Last_Element;
X := -Fixed_Point (Item.Element.Get_X);
Y := -Fixed_Point (Item.Element.Get_Y);
This.Stack_Angle.Delete_Last;
This.Stack_Coordinate.Delete_Last;
if not This.Dry_Run then
This.Medium.Reference.Position_Restore (X, Y);
end if;
end Position_Restore;
end LSE.Model.IO.Turtle;
|
[
{
"context": "---------------------------\n-- Copyright (C) 2020 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@g",
"end": 477,
"score": 0.9998638033866882,
"start": 462,
"tag": "NAME",
"value": "Stephane.Carrez"
},
{
"context": " Copyright (C) 2020 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under",
"end": 508,
"score": 0.9998673796653748,
"start": 493,
"tag": "NAME",
"value": "Stephane.Carrez"
},
{
"context": "0 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 535,
"score": 0.9999278783798218,
"start": 510,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/model/jason-projects-models.ads
|
stcarrez/jason
| 2 |
-----------------------------------------------------------------------
-- Jason.Projects.Models -- Jason.Projects.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 Stephane.Carrez
-- Written by Stephane.Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
with AWA.Wikis.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package Jason.Projects.Models is
pragma Style_Checks ("-mr");
type Status_Type is (OPEN, CLOSED, ON_HOLD);
for Status_Type use (OPEN => 0, CLOSED => 1, ON_HOLD => 2);
package Status_Type_Objects is
new Util.Beans.Objects.Enums (Status_Type);
type Nullable_Status_Type is record
Is_Null : Boolean := True;
Value : Status_Type;
end record;
type Project_Ref is new ADO.Objects.Object_Ref with null record;
type Attribute_Definition_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The project describes the base information for the project management.
-- --------------------
-- Create an object key for Project.
function Project_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Project from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Project_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Project : constant Project_Ref;
function "=" (Left, Right : Project_Ref'Class) return Boolean;
-- Set the project identifier
procedure Set_Id (Object : in out Project_Ref;
Value : in ADO.Identifier);
-- Get the project identifier
function Get_Id (Object : in Project_Ref)
return ADO.Identifier;
-- Get the optimistic lock version
function Get_Version (Object : in Project_Ref)
return Integer;
-- Set the project name
procedure Set_Name (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Project_Ref;
Value : in String);
-- Get the project name
function Get_Name (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Project_Ref)
return String;
-- Set the project creation date.
procedure Set_Create_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
-- Get the project creation date.
function Get_Create_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project status.
procedure Set_Status (Object : in out Project_Ref;
Value : in Jason.Projects.Models.Status_Type);
-- Get the project status.
function Get_Status (Object : in Project_Ref)
return Jason.Projects.Models.Status_Type;
-- Set the last ticket number that was allocated.
procedure Set_Last_Ticket (Object : in out Project_Ref;
Value : in Integer);
-- Get the last ticket number that was allocated.
function Get_Last_Ticket (Object : in Project_Ref)
return Integer;
--
procedure Set_Update_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
--
function Get_Update_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project description.
procedure Set_Description (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Project_Ref;
Value : in String);
-- Get the project description.
function Get_Description (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Project_Ref)
return String;
--
procedure Set_Wiki (Object : in out Project_Ref;
Value : in AWA.Wikis.Models.Wiki_Space_Ref'Class);
--
function Get_Wiki (Object : in Project_Ref)
return AWA.Wikis.Models.Wiki_Space_Ref'Class;
-- Set the project owner.
procedure Set_Owner (Object : in out Project_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the project owner.
function Get_Owner (Object : in Project_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Project_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Project_Ref);
-- Copy of the object.
procedure Copy (Object : in Project_Ref;
Into : in out Project_Ref);
package Project_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Project_Ref,
"=" => "=");
subtype Project_Vector is Project_Vectors.Vector;
procedure List (Object : in out Project_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- Create an object key for Attribute_Definition.
function Attribute_Definition_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Attribute_Definition from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Attribute_Definition_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Attribute_Definition : constant Attribute_Definition_Ref;
function "=" (Left, Right : Attribute_Definition_Ref'Class) return Boolean;
-- Set the attribute identifier.
procedure Set_Id (Object : in out Attribute_Definition_Ref;
Value : in ADO.Identifier);
-- Get the attribute identifier.
function Get_Id (Object : in Attribute_Definition_Ref)
return ADO.Identifier;
-- Get the optimistic lock version.
function Get_Version (Object : in Attribute_Definition_Ref)
return Integer;
-- Set the attribute name or label.
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the attribute name or label.
function Get_Name (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Attribute_Definition_Ref)
return String;
-- Set the default value.
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the default value.
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return String;
--
procedure Set_Project (Object : in out Attribute_Definition_Ref;
Value : in Jason.Projects.Models.Project_Ref'Class);
--
function Get_Project (Object : in Attribute_Definition_Ref)
return Jason.Projects.Models.Project_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Attribute_Definition_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Attribute_Definition_Ref);
-- Copy of the object.
procedure Copy (Object : in Attribute_Definition_Ref;
Into : in out Attribute_Definition_Ref);
package Attribute_Definition_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Attribute_Definition_Ref,
"=" => "=");
subtype Attribute_Definition_Vector is Attribute_Definition_Vectors.Vector;
procedure List (Object : in out Attribute_Definition_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The list of projects.
-- --------------------
type List_Info is
new Util.Beans.Basic.Bean with record
-- the project identifier.
Id : ADO.Identifier;
-- the project title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- the project status.
Status : Jason.Projects.Models.Status_Type;
-- the project creation date.
Create_Date : Ada.Calendar.Time;
-- the total duration for tickets.
Total_Duration : Natural;
-- the total progress time.
Total_Done : Float;
-- the number of tickets closed.
Close_Count : Natural;
-- the number of tickets opened.
Open_Count : Natural;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in List_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out List_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package List_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => List_Info);
package List_Info_Vectors renames List_Info_Beans.Vectors;
subtype List_Info_List_Bean is List_Info_Beans.List_Bean;
type List_Info_List_Bean_Access is access all List_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype List_Info_Vector is List_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_List : constant ADO.Queries.Query_Definition_Access;
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- create the wiki space associated with the project.
-- --------------------
type Project_Bean is abstract new Jason.Projects.Models.Project_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Save (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Load_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
-- --------------------
-- load the project list.
-- --------------------
type Project_List_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the current page number for the pagination.
Page : Integer;
-- the number of projects in a page.
Page_Size : Integer;
-- the number of projects.
Count : Integer;
-- the optional tag to filter the list of projects.
Tag : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_List_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Project_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
PROJECT_NAME : aliased constant String := "jason_project";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "name";
COL_3_1_NAME : aliased constant String := "create_date";
COL_4_1_NAME : aliased constant String := "status";
COL_5_1_NAME : aliased constant String := "last_ticket";
COL_6_1_NAME : aliased constant String := "update_date";
COL_7_1_NAME : aliased constant String := "description";
COL_8_1_NAME : aliased constant String := "wiki_id";
COL_9_1_NAME : aliased constant String := "owner_id";
PROJECT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 10,
Table => PROJECT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access)
);
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROJECT_DEF'Access;
Null_Project : constant Project_Ref
:= Project_Ref'(ADO.Objects.Object_Ref with null record);
type Project_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => PROJECT_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Create_Date : Ada.Calendar.Time;
Status : Jason.Projects.Models.Status_Type;
Last_Ticket : Integer;
Update_Date : Ada.Calendar.Time;
Description : Ada.Strings.Unbounded.Unbounded_String;
Wiki : AWA.Wikis.Models.Wiki_Space_Ref;
Owner : AWA.Users.Models.User_Ref;
end record;
type Project_Access is access all Project_Impl;
overriding
procedure Destroy (Object : access Project_Impl);
overriding
procedure Find (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Project_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Project_Ref'Class;
Impl : out Project_Access);
ATTRIBUTE_DEFINITION_NAME : aliased constant String := "jason_attribute_definition";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "version";
COL_2_2_NAME : aliased constant String := "name";
COL_3_2_NAME : aliased constant String := "default_value";
COL_4_2_NAME : aliased constant String := "project_id";
ATTRIBUTE_DEFINITION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 5,
Table => ATTRIBUTE_DEFINITION_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access)
);
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= ATTRIBUTE_DEFINITION_DEF'Access;
Null_Attribute_Definition : constant Attribute_Definition_Ref
:= Attribute_Definition_Ref'(ADO.Objects.Object_Ref with null record);
type Attribute_Definition_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ATTRIBUTE_DEFINITION_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Default_Value : Ada.Strings.Unbounded.Unbounded_String;
Project : Jason.Projects.Models.Project_Ref;
end record;
type Attribute_Definition_Access is access all Attribute_Definition_Impl;
overriding
procedure Destroy (Object : access Attribute_Definition_Impl);
overriding
procedure Find (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Attribute_Definition_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Attribute_Definition_Ref'Class;
Impl : out Attribute_Definition_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "projects-list.xml",
Sha1 => "E126AC9B625FA8FD3B0E06D629189B96BB880B5C");
package Def_Listinfo_List is
new ADO.Queries.Loaders.Query (Name => "list",
File => File_1.File'Access);
Query_List : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List.Query'Access;
package Def_Listinfo_List_Tag_Filter is
new ADO.Queries.Loaders.Query (Name => "list-tag-filter",
File => File_1.File'Access);
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List_Tag_Filter.Query'Access;
end Jason.Projects.Models;
|
26803
|
-----------------------------------------------------------------------
-- Jason.Projects.Models -- Jason.Projects.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
with AWA.Wikis.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package Jason.Projects.Models is
pragma Style_Checks ("-mr");
type Status_Type is (OPEN, CLOSED, ON_HOLD);
for Status_Type use (OPEN => 0, CLOSED => 1, ON_HOLD => 2);
package Status_Type_Objects is
new Util.Beans.Objects.Enums (Status_Type);
type Nullable_Status_Type is record
Is_Null : Boolean := True;
Value : Status_Type;
end record;
type Project_Ref is new ADO.Objects.Object_Ref with null record;
type Attribute_Definition_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The project describes the base information for the project management.
-- --------------------
-- Create an object key for Project.
function Project_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Project from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Project_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Project : constant Project_Ref;
function "=" (Left, Right : Project_Ref'Class) return Boolean;
-- Set the project identifier
procedure Set_Id (Object : in out Project_Ref;
Value : in ADO.Identifier);
-- Get the project identifier
function Get_Id (Object : in Project_Ref)
return ADO.Identifier;
-- Get the optimistic lock version
function Get_Version (Object : in Project_Ref)
return Integer;
-- Set the project name
procedure Set_Name (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Project_Ref;
Value : in String);
-- Get the project name
function Get_Name (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Project_Ref)
return String;
-- Set the project creation date.
procedure Set_Create_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
-- Get the project creation date.
function Get_Create_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project status.
procedure Set_Status (Object : in out Project_Ref;
Value : in Jason.Projects.Models.Status_Type);
-- Get the project status.
function Get_Status (Object : in Project_Ref)
return Jason.Projects.Models.Status_Type;
-- Set the last ticket number that was allocated.
procedure Set_Last_Ticket (Object : in out Project_Ref;
Value : in Integer);
-- Get the last ticket number that was allocated.
function Get_Last_Ticket (Object : in Project_Ref)
return Integer;
--
procedure Set_Update_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
--
function Get_Update_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project description.
procedure Set_Description (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Project_Ref;
Value : in String);
-- Get the project description.
function Get_Description (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Project_Ref)
return String;
--
procedure Set_Wiki (Object : in out Project_Ref;
Value : in AWA.Wikis.Models.Wiki_Space_Ref'Class);
--
function Get_Wiki (Object : in Project_Ref)
return AWA.Wikis.Models.Wiki_Space_Ref'Class;
-- Set the project owner.
procedure Set_Owner (Object : in out Project_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the project owner.
function Get_Owner (Object : in Project_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Project_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Project_Ref);
-- Copy of the object.
procedure Copy (Object : in Project_Ref;
Into : in out Project_Ref);
package Project_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Project_Ref,
"=" => "=");
subtype Project_Vector is Project_Vectors.Vector;
procedure List (Object : in out Project_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- Create an object key for Attribute_Definition.
function Attribute_Definition_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Attribute_Definition from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Attribute_Definition_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Attribute_Definition : constant Attribute_Definition_Ref;
function "=" (Left, Right : Attribute_Definition_Ref'Class) return Boolean;
-- Set the attribute identifier.
procedure Set_Id (Object : in out Attribute_Definition_Ref;
Value : in ADO.Identifier);
-- Get the attribute identifier.
function Get_Id (Object : in Attribute_Definition_Ref)
return ADO.Identifier;
-- Get the optimistic lock version.
function Get_Version (Object : in Attribute_Definition_Ref)
return Integer;
-- Set the attribute name or label.
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the attribute name or label.
function Get_Name (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Attribute_Definition_Ref)
return String;
-- Set the default value.
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the default value.
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return String;
--
procedure Set_Project (Object : in out Attribute_Definition_Ref;
Value : in Jason.Projects.Models.Project_Ref'Class);
--
function Get_Project (Object : in Attribute_Definition_Ref)
return Jason.Projects.Models.Project_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Attribute_Definition_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Attribute_Definition_Ref);
-- Copy of the object.
procedure Copy (Object : in Attribute_Definition_Ref;
Into : in out Attribute_Definition_Ref);
package Attribute_Definition_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Attribute_Definition_Ref,
"=" => "=");
subtype Attribute_Definition_Vector is Attribute_Definition_Vectors.Vector;
procedure List (Object : in out Attribute_Definition_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The list of projects.
-- --------------------
type List_Info is
new Util.Beans.Basic.Bean with record
-- the project identifier.
Id : ADO.Identifier;
-- the project title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- the project status.
Status : Jason.Projects.Models.Status_Type;
-- the project creation date.
Create_Date : Ada.Calendar.Time;
-- the total duration for tickets.
Total_Duration : Natural;
-- the total progress time.
Total_Done : Float;
-- the number of tickets closed.
Close_Count : Natural;
-- the number of tickets opened.
Open_Count : Natural;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in List_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out List_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package List_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => List_Info);
package List_Info_Vectors renames List_Info_Beans.Vectors;
subtype List_Info_List_Bean is List_Info_Beans.List_Bean;
type List_Info_List_Bean_Access is access all List_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype List_Info_Vector is List_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_List : constant ADO.Queries.Query_Definition_Access;
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- create the wiki space associated with the project.
-- --------------------
type Project_Bean is abstract new Jason.Projects.Models.Project_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Save (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Load_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
-- --------------------
-- load the project list.
-- --------------------
type Project_List_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the current page number for the pagination.
Page : Integer;
-- the number of projects in a page.
Page_Size : Integer;
-- the number of projects.
Count : Integer;
-- the optional tag to filter the list of projects.
Tag : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_List_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Project_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
PROJECT_NAME : aliased constant String := "jason_project";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "name";
COL_3_1_NAME : aliased constant String := "create_date";
COL_4_1_NAME : aliased constant String := "status";
COL_5_1_NAME : aliased constant String := "last_ticket";
COL_6_1_NAME : aliased constant String := "update_date";
COL_7_1_NAME : aliased constant String := "description";
COL_8_1_NAME : aliased constant String := "wiki_id";
COL_9_1_NAME : aliased constant String := "owner_id";
PROJECT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 10,
Table => PROJECT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access)
);
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROJECT_DEF'Access;
Null_Project : constant Project_Ref
:= Project_Ref'(ADO.Objects.Object_Ref with null record);
type Project_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => PROJECT_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Create_Date : Ada.Calendar.Time;
Status : Jason.Projects.Models.Status_Type;
Last_Ticket : Integer;
Update_Date : Ada.Calendar.Time;
Description : Ada.Strings.Unbounded.Unbounded_String;
Wiki : AWA.Wikis.Models.Wiki_Space_Ref;
Owner : AWA.Users.Models.User_Ref;
end record;
type Project_Access is access all Project_Impl;
overriding
procedure Destroy (Object : access Project_Impl);
overriding
procedure Find (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Project_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Project_Ref'Class;
Impl : out Project_Access);
ATTRIBUTE_DEFINITION_NAME : aliased constant String := "jason_attribute_definition";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "version";
COL_2_2_NAME : aliased constant String := "name";
COL_3_2_NAME : aliased constant String := "default_value";
COL_4_2_NAME : aliased constant String := "project_id";
ATTRIBUTE_DEFINITION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 5,
Table => ATTRIBUTE_DEFINITION_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access)
);
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= ATTRIBUTE_DEFINITION_DEF'Access;
Null_Attribute_Definition : constant Attribute_Definition_Ref
:= Attribute_Definition_Ref'(ADO.Objects.Object_Ref with null record);
type Attribute_Definition_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ATTRIBUTE_DEFINITION_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Default_Value : Ada.Strings.Unbounded.Unbounded_String;
Project : Jason.Projects.Models.Project_Ref;
end record;
type Attribute_Definition_Access is access all Attribute_Definition_Impl;
overriding
procedure Destroy (Object : access Attribute_Definition_Impl);
overriding
procedure Find (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Attribute_Definition_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Attribute_Definition_Ref'Class;
Impl : out Attribute_Definition_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "projects-list.xml",
Sha1 => "E126AC9B625FA8FD3B0E06D629189B96BB880B5C");
package Def_Listinfo_List is
new ADO.Queries.Loaders.Query (Name => "list",
File => File_1.File'Access);
Query_List : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List.Query'Access;
package Def_Listinfo_List_Tag_Filter is
new ADO.Queries.Loaders.Query (Name => "list-tag-filter",
File => File_1.File'Access);
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List_Tag_Filter.Query'Access;
end Jason.Projects.Models;
| true |
-----------------------------------------------------------------------
-- Jason.Projects.Models -- Jason.Projects.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2020 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
with AWA.Wikis.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package Jason.Projects.Models is
pragma Style_Checks ("-mr");
type Status_Type is (OPEN, CLOSED, ON_HOLD);
for Status_Type use (OPEN => 0, CLOSED => 1, ON_HOLD => 2);
package Status_Type_Objects is
new Util.Beans.Objects.Enums (Status_Type);
type Nullable_Status_Type is record
Is_Null : Boolean := True;
Value : Status_Type;
end record;
type Project_Ref is new ADO.Objects.Object_Ref with null record;
type Attribute_Definition_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The project describes the base information for the project management.
-- --------------------
-- Create an object key for Project.
function Project_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Project from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Project_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Project : constant Project_Ref;
function "=" (Left, Right : Project_Ref'Class) return Boolean;
-- Set the project identifier
procedure Set_Id (Object : in out Project_Ref;
Value : in ADO.Identifier);
-- Get the project identifier
function Get_Id (Object : in Project_Ref)
return ADO.Identifier;
-- Get the optimistic lock version
function Get_Version (Object : in Project_Ref)
return Integer;
-- Set the project name
procedure Set_Name (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Project_Ref;
Value : in String);
-- Get the project name
function Get_Name (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Project_Ref)
return String;
-- Set the project creation date.
procedure Set_Create_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
-- Get the project creation date.
function Get_Create_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project status.
procedure Set_Status (Object : in out Project_Ref;
Value : in Jason.Projects.Models.Status_Type);
-- Get the project status.
function Get_Status (Object : in Project_Ref)
return Jason.Projects.Models.Status_Type;
-- Set the last ticket number that was allocated.
procedure Set_Last_Ticket (Object : in out Project_Ref;
Value : in Integer);
-- Get the last ticket number that was allocated.
function Get_Last_Ticket (Object : in Project_Ref)
return Integer;
--
procedure Set_Update_Date (Object : in out Project_Ref;
Value : in Ada.Calendar.Time);
--
function Get_Update_Date (Object : in Project_Ref)
return Ada.Calendar.Time;
-- Set the project description.
procedure Set_Description (Object : in out Project_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Project_Ref;
Value : in String);
-- Get the project description.
function Get_Description (Object : in Project_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Project_Ref)
return String;
--
procedure Set_Wiki (Object : in out Project_Ref;
Value : in AWA.Wikis.Models.Wiki_Space_Ref'Class);
--
function Get_Wiki (Object : in Project_Ref)
return AWA.Wikis.Models.Wiki_Space_Ref'Class;
-- Set the project owner.
procedure Set_Owner (Object : in out Project_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the project owner.
function Get_Owner (Object : in Project_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Project_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Project_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Project_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Project_Ref);
-- Copy of the object.
procedure Copy (Object : in Project_Ref;
Into : in out Project_Ref);
package Project_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Project_Ref,
"=" => "=");
subtype Project_Vector is Project_Vectors.Vector;
procedure List (Object : in out Project_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- Create an object key for Attribute_Definition.
function Attribute_Definition_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Attribute_Definition from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Attribute_Definition_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Attribute_Definition : constant Attribute_Definition_Ref;
function "=" (Left, Right : Attribute_Definition_Ref'Class) return Boolean;
-- Set the attribute identifier.
procedure Set_Id (Object : in out Attribute_Definition_Ref;
Value : in ADO.Identifier);
-- Get the attribute identifier.
function Get_Id (Object : in Attribute_Definition_Ref)
return ADO.Identifier;
-- Get the optimistic lock version.
function Get_Version (Object : in Attribute_Definition_Ref)
return Integer;
-- Set the attribute name or label.
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the attribute name or label.
function Get_Name (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Attribute_Definition_Ref)
return String;
-- Set the default value.
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Default_Value (Object : in out Attribute_Definition_Ref;
Value : in String);
-- Get the default value.
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Default_Value (Object : in Attribute_Definition_Ref)
return String;
--
procedure Set_Project (Object : in out Attribute_Definition_Ref;
Value : in Jason.Projects.Models.Project_Ref'Class);
--
function Get_Project (Object : in Attribute_Definition_Ref)
return Jason.Projects.Models.Project_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Attribute_Definition_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Attribute_Definition_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Attribute_Definition_Ref);
-- Copy of the object.
procedure Copy (Object : in Attribute_Definition_Ref;
Into : in out Attribute_Definition_Ref);
package Attribute_Definition_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Attribute_Definition_Ref,
"=" => "=");
subtype Attribute_Definition_Vector is Attribute_Definition_Vectors.Vector;
procedure List (Object : in out Attribute_Definition_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The list of projects.
-- --------------------
type List_Info is
new Util.Beans.Basic.Bean with record
-- the project identifier.
Id : ADO.Identifier;
-- the project title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- the project status.
Status : Jason.Projects.Models.Status_Type;
-- the project creation date.
Create_Date : Ada.Calendar.Time;
-- the total duration for tickets.
Total_Duration : Natural;
-- the total progress time.
Total_Done : Float;
-- the number of tickets closed.
Close_Count : Natural;
-- the number of tickets opened.
Open_Count : Natural;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in List_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out List_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package List_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => List_Info);
package List_Info_Vectors renames List_Info_Beans.Vectors;
subtype List_Info_List_Bean is List_Info_Beans.List_Bean;
type List_Info_List_Bean_Access is access all List_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype List_Info_Vector is List_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out List_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_List : constant ADO.Queries.Query_Definition_Access;
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- create the wiki space associated with the project.
-- --------------------
type Project_Bean is abstract new Jason.Projects.Models.Project_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Save (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Create_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Load_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
-- --------------------
-- load the project list.
-- --------------------
type Project_List_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the current page number for the pagination.
Page : Integer;
-- the number of projects in a page.
Page_Size : Integer;
-- the number of projects.
Count : Integer;
-- the optional tag to filter the list of projects.
Tag : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Project_List_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Project_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Project_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Project_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
PROJECT_NAME : aliased constant String := "jason_project";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "name";
COL_3_1_NAME : aliased constant String := "create_date";
COL_4_1_NAME : aliased constant String := "status";
COL_5_1_NAME : aliased constant String := "last_ticket";
COL_6_1_NAME : aliased constant String := "update_date";
COL_7_1_NAME : aliased constant String := "description";
COL_8_1_NAME : aliased constant String := "wiki_id";
COL_9_1_NAME : aliased constant String := "owner_id";
PROJECT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 10,
Table => PROJECT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access)
);
PROJECT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PROJECT_DEF'Access;
Null_Project : constant Project_Ref
:= Project_Ref'(ADO.Objects.Object_Ref with null record);
type Project_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => PROJECT_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Create_Date : Ada.Calendar.Time;
Status : Jason.Projects.Models.Status_Type;
Last_Ticket : Integer;
Update_Date : Ada.Calendar.Time;
Description : Ada.Strings.Unbounded.Unbounded_String;
Wiki : AWA.Wikis.Models.Wiki_Space_Ref;
Owner : AWA.Users.Models.User_Ref;
end record;
type Project_Access is access all Project_Impl;
overriding
procedure Destroy (Object : access Project_Impl);
overriding
procedure Find (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Project_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Project_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Project_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Project_Ref'Class;
Impl : out Project_Access);
ATTRIBUTE_DEFINITION_NAME : aliased constant String := "jason_attribute_definition";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "version";
COL_2_2_NAME : aliased constant String := "name";
COL_3_2_NAME : aliased constant String := "default_value";
COL_4_2_NAME : aliased constant String := "project_id";
ATTRIBUTE_DEFINITION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 5,
Table => ATTRIBUTE_DEFINITION_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access)
);
ATTRIBUTE_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= ATTRIBUTE_DEFINITION_DEF'Access;
Null_Attribute_Definition : constant Attribute_Definition_Ref
:= Attribute_Definition_Ref'(ADO.Objects.Object_Ref with null record);
type Attribute_Definition_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ATTRIBUTE_DEFINITION_DEF'Access)
with record
Version : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
Default_Value : Ada.Strings.Unbounded.Unbounded_String;
Project : Jason.Projects.Models.Project_Ref;
end record;
type Attribute_Definition_Access is access all Attribute_Definition_Impl;
overriding
procedure Destroy (Object : access Attribute_Definition_Impl);
overriding
procedure Find (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Attribute_Definition_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Attribute_Definition_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Attribute_Definition_Ref'Class;
Impl : out Attribute_Definition_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "projects-list.xml",
Sha1 => "E126AC9B625FA8FD3B0E06D629189B96BB880B5C");
package Def_Listinfo_List is
new ADO.Queries.Loaders.Query (Name => "list",
File => File_1.File'Access);
Query_List : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List.Query'Access;
package Def_Listinfo_List_Tag_Filter is
new ADO.Queries.Loaders.Query (Name => "list-tag-filter",
File => File_1.File'Access);
Query_List_Tag_Filter : constant ADO.Queries.Query_Definition_Access
:= Def_Listinfo_List_Tag_Filter.Query'Access;
end Jason.Projects.Models;
|
[
{
"context": "-- DHH 09/19/88 CREATED ORIGINAL TEST.\n-- EDWARD V. BERARD, 14 AUGUST 1990 ADDED CHECKS FOR MULTI-\n-- ",
"end": 1536,
"score": 0.9995565414428711,
"start": 1520,
"tag": "NAME",
"value": "EDWARD V. BERARD"
}
] |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc3224a.ada
|
best08618/asylo
| 7 |
-- CC3224A.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 A FORMAL ARRAY TYPE DENOTES ITS ACTUAL
-- PARAMETER, AND THAT OPERATIONS OF THE FORMAL TYPE ARE THOSE
-- IDENTIFIED WITH THE CORRESPONDING OPERATIONS OF THE ACTUAL TYPE.
-- HISTORY:
-- DHH 09/19/88 CREATED ORIGINAL TEST.
-- EDWARD V. BERARD, 14 AUGUST 1990 ADDED CHECKS FOR MULTI-
-- DIMENSIONAL ARRAYS
-- PWN 11/30/94 REMOVED 'BASE USE ILLEGAL IN ADA 9X.
WITH REPORT ;
PROCEDURE CC3224A IS
SUBTYPE INT IS INTEGER RANGE 1 .. 3;
TYPE ARR IS ARRAY(1 .. 3) OF INTEGER;
TYPE B_ARR IS ARRAY(1 .. 3) OF BOOLEAN;
Q : ARR;
R : B_ARR;
GENERIC
TYPE T IS ARRAY(INT) OF INTEGER;
PACKAGE P IS
SUBTYPE SUB_T IS T;
X : SUB_T := (1, 2, 3);
END P;
GENERIC
TYPE T IS ARRAY(INT) OF BOOLEAN;
PACKAGE BOOL IS
SUBTYPE SUB_T IS T;
END BOOL;
SHORT_START : CONSTANT := -100 ;
SHORT_END : CONSTANT := 100 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SUBTYPE REALLY_SHORT IS SHORT_RANGE RANGE -9 .. 0 ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE FIRST_HALF IS MONTH_TYPE RANGE JAN .. JUN ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 8,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
WALL_DATE : DATE := (MONTH => NOV,
DAY => 9,
YEAR => 1989) ;
SUBTYPE FIRST_FIVE IS CHARACTER RANGE 'A' .. 'E' ;
TYPE THREE_DIMENSIONAL IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
TD_ARRAY : THREE_DIMENSIONAL ;
SECOND_TD_ARRAY : THREE_DIMENSIONAL ;
GENERIC
TYPE CUBE IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
PACKAGE TD_ARRAY_PACKAGE IS
SUBTYPE SUB_CUBE IS CUBE ;
TEST_3D_ARRAY : SUB_CUBE := (THREE_DIMENSIONAL'RANGE =>
(THREE_DIMENSIONAL'RANGE (2) =>
(THREE_DIMENSIONAL'RANGE (3) =>
TODAY))) ;
END TD_ARRAY_PACKAGE ;
BEGIN -- CC3224A
REPORT.TEST ("CC3224A", "CHECK THAT A FORMAL ARRAY TYPE DENOTES " &
"ITS ACTUAL PARAMETER, AND THAT OPERATIONS OF " &
"THE FORMAL TYPE ARE THOSE IDENTIFIED WITH THE " &
"CORRESPONDING OPERATIONS OF THE ACTUAL TYPE");
ONE_DIMENSIONAL:
DECLARE
PACKAGE P1 IS NEW P (ARR);
TYPE NEW_T IS NEW P1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- ONE_DIMENSIONAL
IF NEW_T'FIRST /= ARR'FIRST THEN
REPORT.FAILED("'FIRST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LAST /= ARR'LAST THEN
REPORT.FAILED("'LAST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'FIRST(1) /= ARR'FIRST(1) THEN
REPORT.FAILED("'FIRST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NOT (NEW_T'LAST(1) = ARR'LAST(1)) THEN
REPORT.FAILED("'LAST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF 2 NOT IN NEW_T'RANGE THEN
REPORT.FAILED("'RANGE ATTRIBUTE REPORT.FAILED");
END IF;
IF 3 NOT IN NEW_T'RANGE(1) THEN
REPORT.FAILED("'RANGE(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH /= ARR'LENGTH THEN
REPORT.FAILED("'LENGTH ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH(1) /= ARR'LENGTH(1) THEN
REPORT.FAILED("'LENGTH(N) ATTRIBUTE REPORT.FAILED");
END IF;
OBJ_NEWT := (1, 2, 3);
IF REPORT.IDENT_INT(3) /= OBJ_NEWT(3) THEN
REPORT.FAILED("ASSIGNMENT REPORT.FAILED");
END IF;
IF NEW_T'(1, 2, 3) NOT IN NEW_T THEN
REPORT.FAILED("QUALIFIED EXPRESSION REPORT.FAILED");
END IF;
Q := (1, 2, 3);
IF NEW_T(Q) /= OBJ_NEWT THEN
REPORT.FAILED("EXPLICIT CONVERSION REPORT.FAILED");
END IF;
IF Q(1) /= OBJ_NEWT(1) THEN
REPORT.FAILED("INDEXING REPORT.FAILED");
END IF;
IF (1, 2) /= OBJ_NEWT(1 .. 2) THEN
REPORT.FAILED("SLICE REPORT.FAILED");
END IF;
IF (1, 2) & OBJ_NEWT(3) /= NEW_T(Q)THEN
REPORT.FAILED("CATENATION REPORT.FAILED");
END IF;
IF NOT (P1.X IN ARR) THEN
REPORT.FAILED ("FORMAL DOES NOT DENOTE ACTUAL");
END IF;
END ONE_DIMENSIONAL ;
BOOLEAN_ONE_DIMENSIONAL:
DECLARE
PACKAGE B1 IS NEW BOOL (B_ARR);
TYPE NEW_T IS NEW B1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- BOOLEAN_ONE_DIMENSIONAL
OBJ_NEWT := (TRUE, TRUE, TRUE);
R := (TRUE, TRUE, TRUE);
IF (NEW_T'((TRUE, TRUE, TRUE)) XOR OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, FALSE)) THEN
REPORT.FAILED("XOR REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, TRUE)) AND OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, TRUE)) THEN
REPORT.FAILED("AND REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, FALSE)) OR OBJ_NEWT) /=
NEW_T'((TRUE, TRUE, TRUE)) THEN
REPORT.FAILED("OR REPORT.FAILED - BOOLEAN") ;
END IF ;
END BOOLEAN_ONE_DIMENSIONAL ;
THREE_DIMENSIONAL_TEST:
DECLARE
PACKAGE TD IS NEW TD_ARRAY_PACKAGE (CUBE => THREE_DIMENSIONAL) ;
TYPE NEW_CUBE IS NEW TD.SUB_CUBE ;
NEW_CUBE_OBJECT : NEW_CUBE ;
BEGIN -- THREE_DIMENSIONAL_TEST
IF (NEW_CUBE'FIRST /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (1) /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (2) /= THREE_DIMENSIONAL'FIRST (2)) OR
(NEW_CUBE'FIRST (3) /= THREE_DIMENSIONAL'FIRST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'FIRST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LAST /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (1) /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (2) /= THREE_DIMENSIONAL'LAST (2)) OR
(NEW_CUBE'LAST (3) /= THREE_DIMENSIONAL'LAST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LAST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (-5 NOT IN NEW_CUBE'RANGE) OR
(-3 NOT IN NEW_CUBE'RANGE (1)) OR
(FEB NOT IN NEW_CUBE'RANGE (2)) OR
('C' NOT IN NEW_CUBE'RANGE (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'RANGE FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LENGTH /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (1) /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (2) /= THREE_DIMENSIONAL'LENGTH (2)) OR
(NEW_CUBE'LENGTH (3) /= THREE_DIMENSIONAL'LENGTH (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LENGTH FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
NEW_CUBE_OBJECT := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF FIRST_DATE /= NEW_CUBE_OBJECT (-3, MAR, 'D') THEN
REPORT.FAILED ("ASSIGNMENT FOR MULTI-DIMENSIONAL " &
"ARRAYS FAILED.") ;
END IF ;
IF NEW_CUBE'(NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
WALL_DATE))) NOT IN NEW_CUBE THEN
REPORT.FAILED ("QUALIFIED EXPRESSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
SECOND_TD_ARRAY := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF NEW_CUBE (SECOND_TD_ARRAY) /= NEW_CUBE_OBJECT THEN
REPORT.FAILED ("EXPLICIT CONVERSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF SECOND_TD_ARRAY (-2, FEB, 'B')
/= NEW_CUBE_OBJECT (-2, FEB, 'B') THEN
REPORT.FAILED ("INDEXING FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF NOT (TD.TEST_3D_ARRAY IN THREE_DIMENSIONAL) THEN
REPORT.FAILED ("FORMAL MULTI-DIMENSIONAL ARRAY " &
"DOES NOT DENOTE ACTUAL.") ;
END IF ;
END THREE_DIMENSIONAL_TEST ;
REPORT.RESULT ;
END CC3224A ;
|
29564
|
-- CC3224A.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 A FORMAL ARRAY TYPE DENOTES ITS ACTUAL
-- PARAMETER, AND THAT OPERATIONS OF THE FORMAL TYPE ARE THOSE
-- IDENTIFIED WITH THE CORRESPONDING OPERATIONS OF THE ACTUAL TYPE.
-- HISTORY:
-- DHH 09/19/88 CREATED ORIGINAL TEST.
-- <NAME>, 14 AUGUST 1990 ADDED CHECKS FOR MULTI-
-- DIMENSIONAL ARRAYS
-- PWN 11/30/94 REMOVED 'BASE USE ILLEGAL IN ADA 9X.
WITH REPORT ;
PROCEDURE CC3224A IS
SUBTYPE INT IS INTEGER RANGE 1 .. 3;
TYPE ARR IS ARRAY(1 .. 3) OF INTEGER;
TYPE B_ARR IS ARRAY(1 .. 3) OF BOOLEAN;
Q : ARR;
R : B_ARR;
GENERIC
TYPE T IS ARRAY(INT) OF INTEGER;
PACKAGE P IS
SUBTYPE SUB_T IS T;
X : SUB_T := (1, 2, 3);
END P;
GENERIC
TYPE T IS ARRAY(INT) OF BOOLEAN;
PACKAGE BOOL IS
SUBTYPE SUB_T IS T;
END BOOL;
SHORT_START : CONSTANT := -100 ;
SHORT_END : CONSTANT := 100 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SUBTYPE REALLY_SHORT IS SHORT_RANGE RANGE -9 .. 0 ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE FIRST_HALF IS MONTH_TYPE RANGE JAN .. JUN ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 8,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
WALL_DATE : DATE := (MONTH => NOV,
DAY => 9,
YEAR => 1989) ;
SUBTYPE FIRST_FIVE IS CHARACTER RANGE 'A' .. 'E' ;
TYPE THREE_DIMENSIONAL IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
TD_ARRAY : THREE_DIMENSIONAL ;
SECOND_TD_ARRAY : THREE_DIMENSIONAL ;
GENERIC
TYPE CUBE IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
PACKAGE TD_ARRAY_PACKAGE IS
SUBTYPE SUB_CUBE IS CUBE ;
TEST_3D_ARRAY : SUB_CUBE := (THREE_DIMENSIONAL'RANGE =>
(THREE_DIMENSIONAL'RANGE (2) =>
(THREE_DIMENSIONAL'RANGE (3) =>
TODAY))) ;
END TD_ARRAY_PACKAGE ;
BEGIN -- CC3224A
REPORT.TEST ("CC3224A", "CHECK THAT A FORMAL ARRAY TYPE DENOTES " &
"ITS ACTUAL PARAMETER, AND THAT OPERATIONS OF " &
"THE FORMAL TYPE ARE THOSE IDENTIFIED WITH THE " &
"CORRESPONDING OPERATIONS OF THE ACTUAL TYPE");
ONE_DIMENSIONAL:
DECLARE
PACKAGE P1 IS NEW P (ARR);
TYPE NEW_T IS NEW P1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- ONE_DIMENSIONAL
IF NEW_T'FIRST /= ARR'FIRST THEN
REPORT.FAILED("'FIRST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LAST /= ARR'LAST THEN
REPORT.FAILED("'LAST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'FIRST(1) /= ARR'FIRST(1) THEN
REPORT.FAILED("'FIRST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NOT (NEW_T'LAST(1) = ARR'LAST(1)) THEN
REPORT.FAILED("'LAST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF 2 NOT IN NEW_T'RANGE THEN
REPORT.FAILED("'RANGE ATTRIBUTE REPORT.FAILED");
END IF;
IF 3 NOT IN NEW_T'RANGE(1) THEN
REPORT.FAILED("'RANGE(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH /= ARR'LENGTH THEN
REPORT.FAILED("'LENGTH ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH(1) /= ARR'LENGTH(1) THEN
REPORT.FAILED("'LENGTH(N) ATTRIBUTE REPORT.FAILED");
END IF;
OBJ_NEWT := (1, 2, 3);
IF REPORT.IDENT_INT(3) /= OBJ_NEWT(3) THEN
REPORT.FAILED("ASSIGNMENT REPORT.FAILED");
END IF;
IF NEW_T'(1, 2, 3) NOT IN NEW_T THEN
REPORT.FAILED("QUALIFIED EXPRESSION REPORT.FAILED");
END IF;
Q := (1, 2, 3);
IF NEW_T(Q) /= OBJ_NEWT THEN
REPORT.FAILED("EXPLICIT CONVERSION REPORT.FAILED");
END IF;
IF Q(1) /= OBJ_NEWT(1) THEN
REPORT.FAILED("INDEXING REPORT.FAILED");
END IF;
IF (1, 2) /= OBJ_NEWT(1 .. 2) THEN
REPORT.FAILED("SLICE REPORT.FAILED");
END IF;
IF (1, 2) & OBJ_NEWT(3) /= NEW_T(Q)THEN
REPORT.FAILED("CATENATION REPORT.FAILED");
END IF;
IF NOT (P1.X IN ARR) THEN
REPORT.FAILED ("FORMAL DOES NOT DENOTE ACTUAL");
END IF;
END ONE_DIMENSIONAL ;
BOOLEAN_ONE_DIMENSIONAL:
DECLARE
PACKAGE B1 IS NEW BOOL (B_ARR);
TYPE NEW_T IS NEW B1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- BOOLEAN_ONE_DIMENSIONAL
OBJ_NEWT := (TRUE, TRUE, TRUE);
R := (TRUE, TRUE, TRUE);
IF (NEW_T'((TRUE, TRUE, TRUE)) XOR OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, FALSE)) THEN
REPORT.FAILED("XOR REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, TRUE)) AND OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, TRUE)) THEN
REPORT.FAILED("AND REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, FALSE)) OR OBJ_NEWT) /=
NEW_T'((TRUE, TRUE, TRUE)) THEN
REPORT.FAILED("OR REPORT.FAILED - BOOLEAN") ;
END IF ;
END BOOLEAN_ONE_DIMENSIONAL ;
THREE_DIMENSIONAL_TEST:
DECLARE
PACKAGE TD IS NEW TD_ARRAY_PACKAGE (CUBE => THREE_DIMENSIONAL) ;
TYPE NEW_CUBE IS NEW TD.SUB_CUBE ;
NEW_CUBE_OBJECT : NEW_CUBE ;
BEGIN -- THREE_DIMENSIONAL_TEST
IF (NEW_CUBE'FIRST /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (1) /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (2) /= THREE_DIMENSIONAL'FIRST (2)) OR
(NEW_CUBE'FIRST (3) /= THREE_DIMENSIONAL'FIRST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'FIRST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LAST /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (1) /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (2) /= THREE_DIMENSIONAL'LAST (2)) OR
(NEW_CUBE'LAST (3) /= THREE_DIMENSIONAL'LAST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LAST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (-5 NOT IN NEW_CUBE'RANGE) OR
(-3 NOT IN NEW_CUBE'RANGE (1)) OR
(FEB NOT IN NEW_CUBE'RANGE (2)) OR
('C' NOT IN NEW_CUBE'RANGE (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'RANGE FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LENGTH /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (1) /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (2) /= THREE_DIMENSIONAL'LENGTH (2)) OR
(NEW_CUBE'LENGTH (3) /= THREE_DIMENSIONAL'LENGTH (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LENGTH FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
NEW_CUBE_OBJECT := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF FIRST_DATE /= NEW_CUBE_OBJECT (-3, MAR, 'D') THEN
REPORT.FAILED ("ASSIGNMENT FOR MULTI-DIMENSIONAL " &
"ARRAYS FAILED.") ;
END IF ;
IF NEW_CUBE'(NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
WALL_DATE))) NOT IN NEW_CUBE THEN
REPORT.FAILED ("QUALIFIED EXPRESSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
SECOND_TD_ARRAY := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF NEW_CUBE (SECOND_TD_ARRAY) /= NEW_CUBE_OBJECT THEN
REPORT.FAILED ("EXPLICIT CONVERSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF SECOND_TD_ARRAY (-2, FEB, 'B')
/= NEW_CUBE_OBJECT (-2, FEB, 'B') THEN
REPORT.FAILED ("INDEXING FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF NOT (TD.TEST_3D_ARRAY IN THREE_DIMENSIONAL) THEN
REPORT.FAILED ("FORMAL MULTI-DIMENSIONAL ARRAY " &
"DOES NOT DENOTE ACTUAL.") ;
END IF ;
END THREE_DIMENSIONAL_TEST ;
REPORT.RESULT ;
END CC3224A ;
| true |
-- CC3224A.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 A FORMAL ARRAY TYPE DENOTES ITS ACTUAL
-- PARAMETER, AND THAT OPERATIONS OF THE FORMAL TYPE ARE THOSE
-- IDENTIFIED WITH THE CORRESPONDING OPERATIONS OF THE ACTUAL TYPE.
-- HISTORY:
-- DHH 09/19/88 CREATED ORIGINAL TEST.
-- PI:NAME:<NAME>END_PI, 14 AUGUST 1990 ADDED CHECKS FOR MULTI-
-- DIMENSIONAL ARRAYS
-- PWN 11/30/94 REMOVED 'BASE USE ILLEGAL IN ADA 9X.
WITH REPORT ;
PROCEDURE CC3224A IS
SUBTYPE INT IS INTEGER RANGE 1 .. 3;
TYPE ARR IS ARRAY(1 .. 3) OF INTEGER;
TYPE B_ARR IS ARRAY(1 .. 3) OF BOOLEAN;
Q : ARR;
R : B_ARR;
GENERIC
TYPE T IS ARRAY(INT) OF INTEGER;
PACKAGE P IS
SUBTYPE SUB_T IS T;
X : SUB_T := (1, 2, 3);
END P;
GENERIC
TYPE T IS ARRAY(INT) OF BOOLEAN;
PACKAGE BOOL IS
SUBTYPE SUB_T IS T;
END BOOL;
SHORT_START : CONSTANT := -100 ;
SHORT_END : CONSTANT := 100 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SUBTYPE REALLY_SHORT IS SHORT_RANGE RANGE -9 .. 0 ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
SUBTYPE FIRST_HALF IS MONTH_TYPE RANGE JAN .. JUN ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 8,
YEAR => 1990) ;
FIRST_DATE : DATE := (DAY => 6,
MONTH => JUN,
YEAR => 1967) ;
WALL_DATE : DATE := (MONTH => NOV,
DAY => 9,
YEAR => 1989) ;
SUBTYPE FIRST_FIVE IS CHARACTER RANGE 'A' .. 'E' ;
TYPE THREE_DIMENSIONAL IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
TD_ARRAY : THREE_DIMENSIONAL ;
SECOND_TD_ARRAY : THREE_DIMENSIONAL ;
GENERIC
TYPE CUBE IS ARRAY (REALLY_SHORT,
FIRST_HALF,
FIRST_FIVE) OF DATE ;
PACKAGE TD_ARRAY_PACKAGE IS
SUBTYPE SUB_CUBE IS CUBE ;
TEST_3D_ARRAY : SUB_CUBE := (THREE_DIMENSIONAL'RANGE =>
(THREE_DIMENSIONAL'RANGE (2) =>
(THREE_DIMENSIONAL'RANGE (3) =>
TODAY))) ;
END TD_ARRAY_PACKAGE ;
BEGIN -- CC3224A
REPORT.TEST ("CC3224A", "CHECK THAT A FORMAL ARRAY TYPE DENOTES " &
"ITS ACTUAL PARAMETER, AND THAT OPERATIONS OF " &
"THE FORMAL TYPE ARE THOSE IDENTIFIED WITH THE " &
"CORRESPONDING OPERATIONS OF THE ACTUAL TYPE");
ONE_DIMENSIONAL:
DECLARE
PACKAGE P1 IS NEW P (ARR);
TYPE NEW_T IS NEW P1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- ONE_DIMENSIONAL
IF NEW_T'FIRST /= ARR'FIRST THEN
REPORT.FAILED("'FIRST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LAST /= ARR'LAST THEN
REPORT.FAILED("'LAST ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'FIRST(1) /= ARR'FIRST(1) THEN
REPORT.FAILED("'FIRST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NOT (NEW_T'LAST(1) = ARR'LAST(1)) THEN
REPORT.FAILED("'LAST(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF 2 NOT IN NEW_T'RANGE THEN
REPORT.FAILED("'RANGE ATTRIBUTE REPORT.FAILED");
END IF;
IF 3 NOT IN NEW_T'RANGE(1) THEN
REPORT.FAILED("'RANGE(N) ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH /= ARR'LENGTH THEN
REPORT.FAILED("'LENGTH ATTRIBUTE REPORT.FAILED");
END IF;
IF NEW_T'LENGTH(1) /= ARR'LENGTH(1) THEN
REPORT.FAILED("'LENGTH(N) ATTRIBUTE REPORT.FAILED");
END IF;
OBJ_NEWT := (1, 2, 3);
IF REPORT.IDENT_INT(3) /= OBJ_NEWT(3) THEN
REPORT.FAILED("ASSIGNMENT REPORT.FAILED");
END IF;
IF NEW_T'(1, 2, 3) NOT IN NEW_T THEN
REPORT.FAILED("QUALIFIED EXPRESSION REPORT.FAILED");
END IF;
Q := (1, 2, 3);
IF NEW_T(Q) /= OBJ_NEWT THEN
REPORT.FAILED("EXPLICIT CONVERSION REPORT.FAILED");
END IF;
IF Q(1) /= OBJ_NEWT(1) THEN
REPORT.FAILED("INDEXING REPORT.FAILED");
END IF;
IF (1, 2) /= OBJ_NEWT(1 .. 2) THEN
REPORT.FAILED("SLICE REPORT.FAILED");
END IF;
IF (1, 2) & OBJ_NEWT(3) /= NEW_T(Q)THEN
REPORT.FAILED("CATENATION REPORT.FAILED");
END IF;
IF NOT (P1.X IN ARR) THEN
REPORT.FAILED ("FORMAL DOES NOT DENOTE ACTUAL");
END IF;
END ONE_DIMENSIONAL ;
BOOLEAN_ONE_DIMENSIONAL:
DECLARE
PACKAGE B1 IS NEW BOOL (B_ARR);
TYPE NEW_T IS NEW B1.SUB_T;
OBJ_NEWT : NEW_T;
BEGIN -- BOOLEAN_ONE_DIMENSIONAL
OBJ_NEWT := (TRUE, TRUE, TRUE);
R := (TRUE, TRUE, TRUE);
IF (NEW_T'((TRUE, TRUE, TRUE)) XOR OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, FALSE)) THEN
REPORT.FAILED("XOR REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, TRUE)) AND OBJ_NEWT) /=
NEW_T'((FALSE, FALSE, TRUE)) THEN
REPORT.FAILED("AND REPORT.FAILED - BOOLEAN") ;
END IF;
IF (NEW_T'((FALSE, FALSE, FALSE)) OR OBJ_NEWT) /=
NEW_T'((TRUE, TRUE, TRUE)) THEN
REPORT.FAILED("OR REPORT.FAILED - BOOLEAN") ;
END IF ;
END BOOLEAN_ONE_DIMENSIONAL ;
THREE_DIMENSIONAL_TEST:
DECLARE
PACKAGE TD IS NEW TD_ARRAY_PACKAGE (CUBE => THREE_DIMENSIONAL) ;
TYPE NEW_CUBE IS NEW TD.SUB_CUBE ;
NEW_CUBE_OBJECT : NEW_CUBE ;
BEGIN -- THREE_DIMENSIONAL_TEST
IF (NEW_CUBE'FIRST /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (1) /= THREE_DIMENSIONAL'FIRST) OR
(NEW_CUBE'FIRST (2) /= THREE_DIMENSIONAL'FIRST (2)) OR
(NEW_CUBE'FIRST (3) /= THREE_DIMENSIONAL'FIRST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'FIRST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LAST /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (1) /= THREE_DIMENSIONAL'LAST) OR
(NEW_CUBE'LAST (2) /= THREE_DIMENSIONAL'LAST (2)) OR
(NEW_CUBE'LAST (3) /= THREE_DIMENSIONAL'LAST (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LAST FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (-5 NOT IN NEW_CUBE'RANGE) OR
(-3 NOT IN NEW_CUBE'RANGE (1)) OR
(FEB NOT IN NEW_CUBE'RANGE (2)) OR
('C' NOT IN NEW_CUBE'RANGE (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'RANGE FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
IF (NEW_CUBE'LENGTH /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (1) /= THREE_DIMENSIONAL'LENGTH) OR
(NEW_CUBE'LENGTH (2) /= THREE_DIMENSIONAL'LENGTH (2)) OR
(NEW_CUBE'LENGTH (3) /= THREE_DIMENSIONAL'LENGTH (3)) THEN
REPORT.FAILED ("PROBLEMS WITH 'LENGTH FOR MULTI-" &
"DIMENSIONAL ARRAYS.") ;
END IF ;
NEW_CUBE_OBJECT := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF FIRST_DATE /= NEW_CUBE_OBJECT (-3, MAR, 'D') THEN
REPORT.FAILED ("ASSIGNMENT FOR MULTI-DIMENSIONAL " &
"ARRAYS FAILED.") ;
END IF ;
IF NEW_CUBE'(NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
WALL_DATE))) NOT IN NEW_CUBE THEN
REPORT.FAILED ("QUALIFIED EXPRESSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
SECOND_TD_ARRAY := (NEW_CUBE'RANGE =>
(NEW_CUBE'RANGE (2) =>
(NEW_CUBE'RANGE (3) =>
FIRST_DATE))) ;
IF NEW_CUBE (SECOND_TD_ARRAY) /= NEW_CUBE_OBJECT THEN
REPORT.FAILED ("EXPLICIT CONVERSION FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF SECOND_TD_ARRAY (-2, FEB, 'B')
/= NEW_CUBE_OBJECT (-2, FEB, 'B') THEN
REPORT.FAILED ("INDEXING FOR MULTI-" &
"DIMENSIONAL ARRAYS FAILED.") ;
END IF ;
IF NOT (TD.TEST_3D_ARRAY IN THREE_DIMENSIONAL) THEN
REPORT.FAILED ("FORMAL MULTI-DIMENSIONAL ARRAY " &
"DOES NOT DENOTE ACTUAL.") ;
END IF ;
END THREE_DIMENSIONAL_TEST ;
REPORT.RESULT ;
END CC3224A ;
|
[
{
"context": "-- Copyright (c) 2017 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 35,
"score": 0.9998510479927063,
"start": 23,
"tag": "NAME",
"value": "Maxim Reznik"
},
{
"context": "-- Copyright (c) 2017 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-",
"end": 55,
"score": 0.9999313950538635,
"start": 37,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/protocol/lsp-notification_dispatchers.ads
|
reznikmm/ada_lsp
| 11 |
-- Copyright (c) 2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
with Ada.Streams;
with League.Strings;
private with League.Strings.Hash;
with LSP.Message_Handlers;
with LSP.Types;
package LSP.Notification_Dispatchers is
pragma Preelaborate;
type Notification_Dispatcher is tagged limited private;
type Parameter_Handler_Access is access procedure
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
not overriding procedure Register
(Self : in out Notification_Dispatcher;
Method : League.Strings.Universal_String;
Value : Parameter_Handler_Access);
not overriding procedure Dispatch
(Self : in out Notification_Dispatcher;
Method : LSP.Types.LSP_String;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
private
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => Parameter_Handler_Access,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => "=");
type Notification_Dispatcher is tagged limited record
Map : Maps.Map;
Value : LSP.Message_Handlers.Notification_Handler_Access;
end record;
end LSP.Notification_Dispatchers;
|
24916
|
-- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
with Ada.Streams;
with League.Strings;
private with League.Strings.Hash;
with LSP.Message_Handlers;
with LSP.Types;
package LSP.Notification_Dispatchers is
pragma Preelaborate;
type Notification_Dispatcher is tagged limited private;
type Parameter_Handler_Access is access procedure
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
not overriding procedure Register
(Self : in out Notification_Dispatcher;
Method : League.Strings.Universal_String;
Value : Parameter_Handler_Access);
not overriding procedure Dispatch
(Self : in out Notification_Dispatcher;
Method : LSP.Types.LSP_String;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
private
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => Parameter_Handler_Access,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => "=");
type Notification_Dispatcher is tagged limited record
Map : Maps.Map;
Value : LSP.Message_Handlers.Notification_Handler_Access;
end record;
end LSP.Notification_Dispatchers;
| true |
-- Copyright (c) 2017 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
with Ada.Streams;
with League.Strings;
private with League.Strings.Hash;
with LSP.Message_Handlers;
with LSP.Types;
package LSP.Notification_Dispatchers is
pragma Preelaborate;
type Notification_Dispatcher is tagged limited private;
type Parameter_Handler_Access is access procedure
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
not overriding procedure Register
(Self : in out Notification_Dispatcher;
Method : League.Strings.Universal_String;
Value : Parameter_Handler_Access);
not overriding procedure Dispatch
(Self : in out Notification_Dispatcher;
Method : LSP.Types.LSP_String;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Notification_Handler_Access);
private
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => Parameter_Handler_Access,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => "=");
type Notification_Dispatcher is tagged limited record
Map : Maps.Map;
Value : LSP.Message_Handlers.Notification_Handler_Access;
end record;
end LSP.Notification_Dispatchers;
|
[
{
"context": "Core --\n-- (http://www.adacore.com). ",
"end": 2791,
"score": 0.9978340268135071,
"start": 2788,
"tag": "EMAIL",
"value": "com"
}
] |
src/asis/a4g-skip_tb.adb
|
My-Colaborations/dynamo
| 15 |
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . S K I P _ T B --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Asis.Definitions; use Asis.Definitions;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
with Atree; use Atree;
with Output; use Output;
with Sinfo; use Sinfo;
package body A4G.Skip_TB is
-- In fact, there is a very few different cases of skipping the "syntax
-- sugar", but we implement this skipping by means of look-up table
-- for ease of maintenance.
-------------------------------
-- Specific Serach Functions --
-------------------------------
type Find_Source_Location_Type is access
function (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- All the specific search functions are of the designated profile of
-- this access-to-function type. We need the Element parameter to
-- define the presennce or absence of optional component, because
-- such optional components may have trailing brackets specific for
-- them
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- No seaqrch is made, the argument is returned
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the right-most ')' is returned. The search is started
-- the position S + 1, so if S itself points to ')', S will not be
-- returned
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- Version of the previous function for a qualified expression. If the
-- argument is an aggregate which does not Needs_Extra_Parentheses, this
-- function is equivalent to No_Brackets, otherwise is the same as
-- Search_Right_Parenthesis
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E has a static expression as part of attribute designator,
-- this function looks for the location of the right-most ')'.
-- otherwise it makes no search.
-- E should be of A_First_Attribute, A_Last_Attribute, A_Length_Attribute,
-- A_Range_Attribute, An_Implementation_Defined_Attribute or
-- An_Unknown_Attribute kind only, otherwise ASIS_Inappropriate_Element
-- will be raised
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- This is a somewhat special case: a task/protected declaration ends
-- with "end [identifier];", but the corresponding definition ends
-- with "end [identifier]", that is, *without* ";" .
-- When this function is called, it is supposed, that S points
-- to the trailing semicolon of the last component of a task/protected
-- definition or to the first character of the trailing end in case
-- if there is no component
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the rigt-most ';' is returned, starting from the
-- position next to S, but not S itself
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- For a function call we have to make a differenve between an infix
-- call (no trailing brackets to skip) and prefix call, and in the
-- latter case - between the case when there is no parameter (no
-- trailing brackets to skip) and the case when there is(are) a
-- parameter(s) (a ')' should be skipped)
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function handles a special case with
-- A_Formal_Derived_Type_Definition: in skips 'with private"
-- keywords, if any
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E may contain a box as the end of its text image, this function
-- returns the location of the '>' that is the end of this box, otherwise
-- it returns S. It is supposed that there is no other '<' between S and
-- the end of box except '<' that is the beginning of the box to look for.
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function should never be called. We need it for "others"
-- choise in the aggregate initializing the look-up table for those
-- values of Internal_Element_Kinds which should never be processed
-- (they correspond to implicit root and universal types). This
-- function raises Internal_Implementation_Error
------------------
-- Serach Array --
------------------
Skip_Switch : constant array (Internal_Element_Kinds) of
Find_Source_Location_Type :=
(An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma
-- An_Atomic_Pragma
-- An_Atomic_Components_Pragma
-- An_Attach_Handler_Pragma
-- A_Controlled_Pragma
-- A_Convention_Pragma
-- An_Elaborate_All_Pragma
-- An_Elaborate_Body_Pragma
-- An_Export_Pragma
-- An_Import_Pragma
-- An_Inline_Pragma
-- An_Inspection_Point_Pragma
-- An_Interrupt_Handler_Pragma
-- An_Interrupt_Priority_Pragma
-- A_List_Pragma
-- A_Locking_Policy_Pragma
-- A_Normalize_Scalars_Pragma
-- An_Optimize_Pragma
-- A_Pack_Pragma
-- A_Page_Pragma
-- A_Preelaborate_Pragma
-- A_Priority_Pragma
-- A_Pure_Pragma
-- A_Queuing_Policy_Pragma
-- A_Remote_Call_Interface_Pragma
-- A_Remote_Types_Pragma
-- A_Restrictions_Pragma
-- A_Reviewable_Pragma
-- A_Shared_Passive_Pragma
-- A_Suppress_Pragma
-- A_Task_Dispatching_Policy_Pragma
-- A_Volatile_Pragma
-- A_Volatile_Components_Pragma
-- An_Implementation_Defined_Pragma
An_Unknown_Pragma => Search_Semicolon'Access,
A_Defining_Identifier ..
-- A_Defining_Character_Literal
-- A_Defining_Enumeration_Literal
-- A_Defining_And_Operator
-- A_Defining_Or_Operator
-- A_Defining_Xor_Operator
-- A_Defining_Equal_Operator
-- A_Defining_Not_Equal_Operator
-- A_Defining_Less_Than_Operator
-- A_Defining_Less_Than_Or_Equal_Operator
-- A_Defining_Greater_Than_Operator
-- A_Defining_Greater_Than_Or_Equal_Operator
-- A_Defining_Plus_Operator
-- A_Defining_Minus_Operator
-- A_Defining_Concatenate_Operator
-- A_Defining_Unary_Plus_Operator
-- A_Defining_Unary_Minus_Operator
-- A_Defining_Multiply_Operator
-- A_Defining_Divide_Operator
-- A_Defining_Mod_Operator
-- A_Defining_Rem_Operator
-- A_Defining_Exponentiate_Operator
-- A_Defining_Abs_Operator
-- A_Defining_Not_Operator
A_Defining_Expanded_Name => No_Brackets'Access,
An_Ordinary_Type_Declaration ..
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
-- An_Integer_Number_Declaration
A_Real_Number_Declaration => Search_Semicolon'Access,
An_Enumeration_Literal_Specification => No_Brackets'Access,
A_Discriminant_Specification => No_Brackets'Access,
A_Component_Declaration => Search_Semicolon'Access,
A_Loop_Parameter_Specification => No_Brackets'Access,
A_Generalized_Iterator_Specification => No_Brackets'Access,
An_Element_Iterator_Specification => No_Brackets'Access,
A_Procedure_Declaration => Search_Semicolon'Access,
A_Function_Declaration => Search_Semicolon'Access,
A_Parameter_Specification => No_Brackets'Access,
A_Procedure_Body_Declaration ..
A_Function_Body_Declaration => Search_Semicolon'Access,
A_Return_Variable_Specification => No_Brackets'Access,
A_Return_Constant_Specification => No_Brackets'Access,
A_Null_Procedure_Declaration ..
-- An_Expression_Function_Declaration
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- A_Package_Body_Declaration
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
-- An_Entry_Declaration
An_Entry_Body_Declaration => Search_Semicolon'Access,
An_Entry_Index_Specification => No_Brackets'Access,
A_Procedure_Body_Stub ..
-- A_Function_Body_Stub
-- A_Package_Body_Stub
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
An_Exception_Declaration => Search_Semicolon'Access,
A_Choice_Parameter_Specification => No_Brackets'Access,
A_Generic_Procedure_Declaration ..
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Function_Instantiation
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
A_Formal_Package_Declaration_With_Box => Search_Semicolon'Access,
A_Derived_Type_Definition => No_Brackets'Access,
A_Derived_Record_Extension_Definition => No_Brackets'Access,
An_Enumeration_Type_Definition => Search_Right_Parenthesis'Access,
A_Signed_Integer_Type_Definition ..
-- A_Modular_Type_Definition
---------------------------------------------------------
-- !!! They all are implicit and cannot have image
-- |
-- |-> A_Root_Integer_Definition
-- |-> A_Root_Real_Definition
-- |-> A_Root_Fixed_Definition
-- |-> A_Universal_Integer_Definition
-- |-> A_Universal_Real_Definition
-- +-> A_Universal_Fixed_Definition
---------------------------------------------------------
-- A_Floating_Point_Definition
-- An_Ordinary_Fixed_Point_Definition
-- A_Decimal_Fixed_Point_Definition
-- An_Unconstrained_Array_Definition
-- A_Constrained_Array_Definition
-- A_Record_Type_Definition
-- A_Tagged_Record_Type_Definition
-- A_Pool_Specific_Access_To_Variable
-- An_Access_To_Variable
An_Access_To_Constant => No_Brackets'Access,
An_Access_To_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Protected_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Function ..
-- An_Access_To_Protected_Function
-- A_Subtype_Indication
-- A_Range_Attribute_Reference
-- A_Simple_Expression_Range
-- A_Digits_Constraint
A_Delta_Constraint => No_Brackets'Access,
An_Index_Constraint => Search_Right_Parenthesis'Access,
A_Discriminant_Constraint => Search_Right_Parenthesis'Access,
A_Component_Definition ..
-- A_Discrete_Subtype_Indication_As_Subtype_Definition
-- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition
-- A_Discrete_Simple_Expression_Range_As_Subtype_Definition
-- A_Discrete_Subtype_Indication
-- A_Discrete_Range_Attribute_Reference
-- A_Discrete_Simple_Expression_Range
An_Unknown_Discriminant_Part => No_Brackets'Access,
A_Known_Discriminant_Part => Search_Right_Parenthesis'Access,
A_Record_Definition => No_Brackets'Access,
A_Null_Record_Definition => No_Brackets'Access,
A_Null_Component => Search_Semicolon'Access,
A_Variant_Part => Search_Semicolon'Access,
A_Variant ..
An_Others_Choice => No_Brackets'Access,
-- --|A2005 start
An_Anonymous_Access_To_Variable ..
An_Anonymous_Access_To_Constant => No_Brackets'Access,
An_Anonymous_Access_To_Procedure ..
An_Anonymous_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
An_Anonymous_Access_To_Function ..
An_Anonymous_Access_To_Protected_Function => No_Brackets'Access,
-- --|A2005 end
A_Private_Type_Definition ..
-- A_Tagged_Private_Type_Definition
A_Private_Extension_Definition => No_Brackets'Access,
A_Task_Definition ..
A_Protected_Definition => Search_Before_Semicolon'Access,
A_Formal_Private_Type_Definition ..
A_Formal_Tagged_Private_Type_Definition => No_Brackets'Access,
A_Formal_Derived_Type_Definition => Skip_WP'Access,
A_Formal_Discrete_Type_Definition ..
-- A_Formal_Signed_Integer_Type_Definition
-- A_Formal_Modular_Type_Definition
-- A_Formal_Floating_Point_Definition
-- A_Formal_Ordinary_Fixed_Point_Definition
-- A_Formal_Decimal_Fixed_Point_Definition
-- A_Formal_Unconstrained_Array_Definition
-- A_Formal_Constrained_Array_Definition
-- A_Formal_Pool_Specific_Access_To_Variable
-- A_Formal_Access_To_Variable
A_Formal_Access_To_Constant => No_Brackets'Access,
A_Formal_Access_To_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Function ..
-- A_Formal_Access_To_Protected_Function
-- An_Integer_Literal
-- A_Real_Literal
-- A_String_Literal
-- An_Identifier
-- An_And_Operator
-- An_Or_Operator
-- An_Xor_Operator
-- An_Equal_Operator
-- A_Not_Equal_Operator
-- A_Less_Than_Operator
-- A_Less_Than_Or_Equal_Operator
-- A_Greater_Than_Operator
-- A_Greater_Than_Or_Equal_Operator
-- A_Plus_Operator
-- A_Minus_Operator
-- A_Concatenate_Operator
-- A_Unary_Plus_Operator
-- A_Unary_Minus_Operator
-- A_Multiply_Operator
-- A_Divide_Operator
-- A_Mod_Operator
-- A_Rem_Operator
-- An_Exponentiate_Operator
-- An_Abs_Operator
-- A_Not_Operator
-- A_Character_Literal
-- An_Enumeration_Literal
An_Explicit_Dereference => No_Brackets'Access,
A_Function_Call => Clear_After_Funcion_Call'Access,
An_Indexed_Component ..
A_Slice => Search_Right_Parenthesis'Access,
A_Selected_Component => No_Brackets'Access,
An_Access_Attribute ..
-- An_Address_Attribute
-- An_Adjacent_Attribute
-- An_Aft_Attribute
-- An_Alignment_Attribute
-- A_Base_Attribute
-- A_Bit_Order_Attribute
-- A_Body_Version_Attribute
-- A_Callable_Attribute
-- A_Caller_Attribute
-- A_Ceiling_Attribute
-- A_Class_Attribute
-- A_Component_Size_Attribute
-- A_Compose_Attribute
-- A_Constrained_Attribute
-- A_Copy_Sign_Attribute
-- A_Count_Attribute
-- A_Definite_Attribute
-- A_Delta_Attribute
-- A_Denorm_Attribute
-- A_Digits_Attribute
-- An_Exponent_Attribute
An_External_Tag_Attribute => No_Brackets'Access,
A_First_Attribute => Search_Attr_Right_Parenthesis'Access,
A_First_Bit_Attribute ..
-- A_Floor_Attribute
-- A_Fore_Attribute
-- A_Fraction_Attribute
-- An_Identity_Attribute
-- An_Image_Attribute
An_Input_Attribute => No_Brackets'Access,
A_Last_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Last_Bit_Attribute => No_Brackets'Access,
A_Leading_Part_Attribute => No_Brackets'Access,
A_Length_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Machine_Attribute ..
-- A_Machine_Emax_Attribute
-- A_Machine_Emin_Attribute
-- A_Machine_Mantissa_Attribute
-- A_Machine_Overflows_Attribute
-- A_Machine_Radix_Attribute
-- A_Machine_Rounds_Attribute
-- A_Max_Attribute
-- A_Max_Size_In_Storage_Elements_Attribute
-- A_Min_Attribute
-- A_Model_Attribute
-- A_Model_Emin_Attribute
-- A_Model_Epsilon_Attribute
-- A_Model_Mantissa_Attribute
-- A_Model_Small_Attribute
-- A_Modulus_Attribute
-- An_Output_Attribute
-- A_Partition_ID_Attribute
-- A_Pos_Attribute
-- A_Position_Attribute
A_Pred_Attribute => No_Brackets'Access,
A_Range_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Read_Attribute ..
-- A_Remainder_Attribute
-- A_Round_Attribute
-- A_Rounding_Attribute
-- A_Safe_First_Attribute
-- A_Safe_Last_Attribute
-- A_Scale_Attribute
-- A_Scaling_Attribute
-- A_Signed_Zeros_Attribute
-- A_Size_Attribute
-- A_Small_Attribute
-- A_Storage_Pool_Attribute
-- A_Storage_Size_Attribute
-- A_Succ_Attribute
-- A_Tag_Attribute
-- A_Terminated_Attribute
-- A_Truncation_Attribute
-- An_Unbiased_Rounding_Attribute
-- An_Unchecked_Access_Attribute
-- A_Val_Attribute
-- A_Valid_Attribute
-- A_Value_Attribute
-- A_Version_Attribute
-- A_Wide_Image_Attribute
-- A_Wide_Value_Attribute
-- A_Wide_Width_Attribute
-- A_Width_Attribute
-- A_Write_Attribute
-- |A2006 start
-- New Ada 2005 attributes. To be alphabetically ordered later
-- A_Machine_Rounding_Attribute
-- A_Mod_Attribute
-- A_Priority_Attribute
-- A_Stream_Size_Attribute
-- A_Wide_Wide_Image_Attribute
-- A_Wide_Wide_Value_Attribute
A_Wide_Wide_Width_Attribute => No_Brackets'Access,
-- |A2006 end
An_Implementation_Defined_Attribute ..
An_Unknown_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Record_Aggregate ..
-- An_Extension_Aggregate
-- A_Positional_Array_Aggregate
A_Named_Array_Aggregate => Search_Right_Parenthesis'Access,
An_And_Then_Short_Circuit ..
-- An_Or_Else_Short_Circuit
-- An_In_Range_Membership_Test
-- A_Not_In_Range_Membership_Test
-- An_In_Type_Membership_Test
-- A_Not_In_Type_Membership_Test
A_Null_Literal => No_Brackets'Access,
A_Parenthesized_Expression ..
A_Type_Conversion => Search_Right_Parenthesis'Access,
A_Qualified_Expression => Search_QE_Right_Parenthesis'Access,
An_Allocation_From_Subtype ..
An_Allocation_From_Qualified_Expression => No_Brackets'Access,
A_Case_Expression => No_Brackets'Access, -- Ada 2012
An_If_Expression => No_Brackets'Access, -- Ada 2012
A_For_All_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_For_Some_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_Pragma_Argument_Association ..
-- A_Discriminant_Association
-- A_Record_Component_Association
-- An_Array_Component_Association
A_Parameter_Association => No_Brackets'Access,
A_Generic_Association => Search_End_Of_Box'Access,
A_Null_Statement ..
-- An_Assignment_Statement
-- An_If_Statement
-- A_Case_Statement
-- A_Loop_Statement
-- A_While_Loop_Statement
-- A_For_Loop_Statement
-- A_Block_Statement
-- An_Exit_Statement
-- A_Goto_Statement
-- A_Procedure_Call_Statement
-- A_Return_Statement
-- An_Accept_Statement
-- An_Entry_Call_Statement
-- A_Requeue_Statement
-- A_Requeue_Statement_With_Abort
-- A_Delay_Until_Statement
-- A_Delay_Relative_Statement
-- A_Terminate_Alternative_Statement
-- A_Selective_Accept_Statement
-- A_Timed_Entry_Call_Statement
-- A_Conditional_Entry_Call_Statement
-- An_Asynchronous_Select_Statement
-- An_Abort_Statement
-- A_Raise_Statement
A_Code_Statement => Search_Semicolon'Access,
An_If_Path ..
-- An_Elsif_Path
-- An_Else_Path
-- A_Case_Path
-- A_Select_Path
-- An_Or_Path
-- A_Then_Abort_Path
-- A_Case_Expression_Path -- ASIS 2012
-- An_If_Expression_Path -- ASIS 2012
-- An_Elsif_Expression_Path -- ASIS 2012
An_Else_Expression_Path => No_Brackets'Access, -- Ada 2012
A_Use_Package_Clause ..
-- A_Use_Type_Clause
-- A_Use_All_Type_Clause -- Ada 2012
-- A_With_Clause
-- An_Attribute_Definition_Clause
-- An_Enumeration_Representation_Clause
-- A_Record_Representation_Clause
-- An_At_Clause
A_Component_Clause => Search_Semicolon'Access,
An_Exception_Handler => No_Brackets'Access,
others => A_Bug'Access);
-----------
-- A_Bug --
-----------
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
-- This function should never be called
raise Internal_Implementation_Error;
return S;
end A_Bug;
------------------------------
-- Clear_After_Funcion_Call --
------------------------------
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Prefix_Call (E) then
if Is_Nil (Function_Call_Parameters (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
else
return No_Brackets (E, S);
end if;
end Clear_After_Funcion_Call;
-----------------------------
-- Needs_Extra_Parentheses --
-----------------------------
function Needs_Extra_Parentheses (E : Asis.Element) return Boolean is
Result : Boolean := False;
N : Node_Id;
begin
if Int_Kind (E) in A_Record_Aggregate .. A_Named_Array_Aggregate then
N := R_Node (E);
if Paren_Count (N) = 1 and then
Nkind (Parent (N)) = N_Qualified_Expression
then
Result := True;
end if;
end if;
return Result;
end Needs_Extra_Parentheses;
-----------------
-- No_Brackets --
-----------------
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
return S;
end No_Brackets;
-----------------------------------
-- Search_Attr_Right_Parenthesis --
-----------------------------------
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Nil (Attribute_Designator_Expressions (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
end Search_Attr_Right_Parenthesis;
-----------------------------
-- Search_Before_Semicolon --
-----------------------------
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
S_P : Source_Ptr;
Result : Source_Ptr;
begin
-- first, we have to check where we are: at ';' or at the beginning of
-- the reserved word "end" in case if there is no components,
-- and if we are at ';', we have to go to "end":
if Get_Character (S) = ';' then
S_P := Next_Identifier (S);
elsif Asis.Definitions.Is_Private_Present (E) then
-- patological case of empty efinition with private part
S_P := S + 7;
else
S_P := S;
S_P := Rightmost_Non_Blank (S_P);
end if;
Result := S_P + 2;
-- the last character of "end"
S_P := S_P + 3;
-- the first character after "end"
S_P := Rightmost_Non_Blank (S_P);
-- and the final check - what follows the final "end"
if Get_Character (S_P) /= ';' then
-- there is an identifier after "end"
Result := Get_Word_End (P => S_P,
In_Word => In_Identifier'Access);
end if;
return Result;
end Search_Before_Semicolon;
-----------------------
-- Search_End_Of_Box --
-----------------------
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
begin
case Int_Kind (E) is
when A_Generic_Association =>
if Is_Nil (Actual_Parameter (E)) then
Result := Search_Rightmost_Symbol (S, '<');
Result := Result + 1;
end if;
when others =>
null;
end case;
return Result;
end Search_End_Of_Box;
---------------------------------
-- Search_QE_Right_Parenthesis --
---------------------------------
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
Tmp : constant Asis.Element := Converted_Or_Qualified_Expression (E);
begin
if Int_Kind (Tmp) not in A_Record_Aggregate .. A_Named_Array_Aggregate
or else Needs_Extra_Parentheses (Tmp)
then
Result := Search_Rightmost_Symbol (S + 1, ')');
end if;
return Result;
end Search_QE_Right_Parenthesis;
------------------------------
-- Search_Right_Parenthesis --
------------------------------
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
pragma Unreferenced (E);
return Search_Rightmost_Symbol (S + 1, ')');
end Search_Right_Parenthesis;
----------------------
-- Search_Semicolon --
----------------------
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
pragma Unreferenced (E);
S_P : Source_Ptr;
begin
S_P := Search_Rightmost_Symbol (S + 1, ';');
return S_P;
end Search_Semicolon;
-------------
-- Skip_WP --
-------------
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr;
begin
-- just jump to the trailing semicolon, and then - to the end of
-- the previous word, this should handle properly cases where there
-- are and where there are not "with private" keywords
S_P := Search_Semicolon (E, S);
S_P := Search_Prev_Word (S_P);
return S_P;
end Skip_WP;
----------------------------
-- Skip_Trailing_Brackets --
----------------------------
function Skip_Trailing_Brackets
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
-- all that this function does is switching to the function
-- implementing the specific processing for the given element
-- kind
if Debug_Flag_X then
Write_Str (" Skip_Trailing_Brackets - called for ");
Write_Str (Internal_Element_Kinds'Image (Int_Kind (E)));
Write_Eol;
Write_Eol;
end if;
return Skip_Switch (Int_Kind (E)) (E, S);
end Skip_Trailing_Brackets;
end A4G.Skip_TB;
|
28002
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . S K I P _ T B --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.<EMAIL>). --
-- --
------------------------------------------------------------------------------
with Asis.Definitions; use Asis.Definitions;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
with Atree; use Atree;
with Output; use Output;
with Sinfo; use Sinfo;
package body A4G.Skip_TB is
-- In fact, there is a very few different cases of skipping the "syntax
-- sugar", but we implement this skipping by means of look-up table
-- for ease of maintenance.
-------------------------------
-- Specific Serach Functions --
-------------------------------
type Find_Source_Location_Type is access
function (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- All the specific search functions are of the designated profile of
-- this access-to-function type. We need the Element parameter to
-- define the presennce or absence of optional component, because
-- such optional components may have trailing brackets specific for
-- them
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- No seaqrch is made, the argument is returned
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the right-most ')' is returned. The search is started
-- the position S + 1, so if S itself points to ')', S will not be
-- returned
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- Version of the previous function for a qualified expression. If the
-- argument is an aggregate which does not Needs_Extra_Parentheses, this
-- function is equivalent to No_Brackets, otherwise is the same as
-- Search_Right_Parenthesis
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E has a static expression as part of attribute designator,
-- this function looks for the location of the right-most ')'.
-- otherwise it makes no search.
-- E should be of A_First_Attribute, A_Last_Attribute, A_Length_Attribute,
-- A_Range_Attribute, An_Implementation_Defined_Attribute or
-- An_Unknown_Attribute kind only, otherwise ASIS_Inappropriate_Element
-- will be raised
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- This is a somewhat special case: a task/protected declaration ends
-- with "end [identifier];", but the corresponding definition ends
-- with "end [identifier]", that is, *without* ";" .
-- When this function is called, it is supposed, that S points
-- to the trailing semicolon of the last component of a task/protected
-- definition or to the first character of the trailing end in case
-- if there is no component
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the rigt-most ';' is returned, starting from the
-- position next to S, but not S itself
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- For a function call we have to make a differenve between an infix
-- call (no trailing brackets to skip) and prefix call, and in the
-- latter case - between the case when there is no parameter (no
-- trailing brackets to skip) and the case when there is(are) a
-- parameter(s) (a ')' should be skipped)
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function handles a special case with
-- A_Formal_Derived_Type_Definition: in skips 'with private"
-- keywords, if any
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E may contain a box as the end of its text image, this function
-- returns the location of the '>' that is the end of this box, otherwise
-- it returns S. It is supposed that there is no other '<' between S and
-- the end of box except '<' that is the beginning of the box to look for.
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function should never be called. We need it for "others"
-- choise in the aggregate initializing the look-up table for those
-- values of Internal_Element_Kinds which should never be processed
-- (they correspond to implicit root and universal types). This
-- function raises Internal_Implementation_Error
------------------
-- Serach Array --
------------------
Skip_Switch : constant array (Internal_Element_Kinds) of
Find_Source_Location_Type :=
(An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma
-- An_Atomic_Pragma
-- An_Atomic_Components_Pragma
-- An_Attach_Handler_Pragma
-- A_Controlled_Pragma
-- A_Convention_Pragma
-- An_Elaborate_All_Pragma
-- An_Elaborate_Body_Pragma
-- An_Export_Pragma
-- An_Import_Pragma
-- An_Inline_Pragma
-- An_Inspection_Point_Pragma
-- An_Interrupt_Handler_Pragma
-- An_Interrupt_Priority_Pragma
-- A_List_Pragma
-- A_Locking_Policy_Pragma
-- A_Normalize_Scalars_Pragma
-- An_Optimize_Pragma
-- A_Pack_Pragma
-- A_Page_Pragma
-- A_Preelaborate_Pragma
-- A_Priority_Pragma
-- A_Pure_Pragma
-- A_Queuing_Policy_Pragma
-- A_Remote_Call_Interface_Pragma
-- A_Remote_Types_Pragma
-- A_Restrictions_Pragma
-- A_Reviewable_Pragma
-- A_Shared_Passive_Pragma
-- A_Suppress_Pragma
-- A_Task_Dispatching_Policy_Pragma
-- A_Volatile_Pragma
-- A_Volatile_Components_Pragma
-- An_Implementation_Defined_Pragma
An_Unknown_Pragma => Search_Semicolon'Access,
A_Defining_Identifier ..
-- A_Defining_Character_Literal
-- A_Defining_Enumeration_Literal
-- A_Defining_And_Operator
-- A_Defining_Or_Operator
-- A_Defining_Xor_Operator
-- A_Defining_Equal_Operator
-- A_Defining_Not_Equal_Operator
-- A_Defining_Less_Than_Operator
-- A_Defining_Less_Than_Or_Equal_Operator
-- A_Defining_Greater_Than_Operator
-- A_Defining_Greater_Than_Or_Equal_Operator
-- A_Defining_Plus_Operator
-- A_Defining_Minus_Operator
-- A_Defining_Concatenate_Operator
-- A_Defining_Unary_Plus_Operator
-- A_Defining_Unary_Minus_Operator
-- A_Defining_Multiply_Operator
-- A_Defining_Divide_Operator
-- A_Defining_Mod_Operator
-- A_Defining_Rem_Operator
-- A_Defining_Exponentiate_Operator
-- A_Defining_Abs_Operator
-- A_Defining_Not_Operator
A_Defining_Expanded_Name => No_Brackets'Access,
An_Ordinary_Type_Declaration ..
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
-- An_Integer_Number_Declaration
A_Real_Number_Declaration => Search_Semicolon'Access,
An_Enumeration_Literal_Specification => No_Brackets'Access,
A_Discriminant_Specification => No_Brackets'Access,
A_Component_Declaration => Search_Semicolon'Access,
A_Loop_Parameter_Specification => No_Brackets'Access,
A_Generalized_Iterator_Specification => No_Brackets'Access,
An_Element_Iterator_Specification => No_Brackets'Access,
A_Procedure_Declaration => Search_Semicolon'Access,
A_Function_Declaration => Search_Semicolon'Access,
A_Parameter_Specification => No_Brackets'Access,
A_Procedure_Body_Declaration ..
A_Function_Body_Declaration => Search_Semicolon'Access,
A_Return_Variable_Specification => No_Brackets'Access,
A_Return_Constant_Specification => No_Brackets'Access,
A_Null_Procedure_Declaration ..
-- An_Expression_Function_Declaration
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- A_Package_Body_Declaration
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
-- An_Entry_Declaration
An_Entry_Body_Declaration => Search_Semicolon'Access,
An_Entry_Index_Specification => No_Brackets'Access,
A_Procedure_Body_Stub ..
-- A_Function_Body_Stub
-- A_Package_Body_Stub
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
An_Exception_Declaration => Search_Semicolon'Access,
A_Choice_Parameter_Specification => No_Brackets'Access,
A_Generic_Procedure_Declaration ..
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Function_Instantiation
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
A_Formal_Package_Declaration_With_Box => Search_Semicolon'Access,
A_Derived_Type_Definition => No_Brackets'Access,
A_Derived_Record_Extension_Definition => No_Brackets'Access,
An_Enumeration_Type_Definition => Search_Right_Parenthesis'Access,
A_Signed_Integer_Type_Definition ..
-- A_Modular_Type_Definition
---------------------------------------------------------
-- !!! They all are implicit and cannot have image
-- |
-- |-> A_Root_Integer_Definition
-- |-> A_Root_Real_Definition
-- |-> A_Root_Fixed_Definition
-- |-> A_Universal_Integer_Definition
-- |-> A_Universal_Real_Definition
-- +-> A_Universal_Fixed_Definition
---------------------------------------------------------
-- A_Floating_Point_Definition
-- An_Ordinary_Fixed_Point_Definition
-- A_Decimal_Fixed_Point_Definition
-- An_Unconstrained_Array_Definition
-- A_Constrained_Array_Definition
-- A_Record_Type_Definition
-- A_Tagged_Record_Type_Definition
-- A_Pool_Specific_Access_To_Variable
-- An_Access_To_Variable
An_Access_To_Constant => No_Brackets'Access,
An_Access_To_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Protected_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Function ..
-- An_Access_To_Protected_Function
-- A_Subtype_Indication
-- A_Range_Attribute_Reference
-- A_Simple_Expression_Range
-- A_Digits_Constraint
A_Delta_Constraint => No_Brackets'Access,
An_Index_Constraint => Search_Right_Parenthesis'Access,
A_Discriminant_Constraint => Search_Right_Parenthesis'Access,
A_Component_Definition ..
-- A_Discrete_Subtype_Indication_As_Subtype_Definition
-- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition
-- A_Discrete_Simple_Expression_Range_As_Subtype_Definition
-- A_Discrete_Subtype_Indication
-- A_Discrete_Range_Attribute_Reference
-- A_Discrete_Simple_Expression_Range
An_Unknown_Discriminant_Part => No_Brackets'Access,
A_Known_Discriminant_Part => Search_Right_Parenthesis'Access,
A_Record_Definition => No_Brackets'Access,
A_Null_Record_Definition => No_Brackets'Access,
A_Null_Component => Search_Semicolon'Access,
A_Variant_Part => Search_Semicolon'Access,
A_Variant ..
An_Others_Choice => No_Brackets'Access,
-- --|A2005 start
An_Anonymous_Access_To_Variable ..
An_Anonymous_Access_To_Constant => No_Brackets'Access,
An_Anonymous_Access_To_Procedure ..
An_Anonymous_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
An_Anonymous_Access_To_Function ..
An_Anonymous_Access_To_Protected_Function => No_Brackets'Access,
-- --|A2005 end
A_Private_Type_Definition ..
-- A_Tagged_Private_Type_Definition
A_Private_Extension_Definition => No_Brackets'Access,
A_Task_Definition ..
A_Protected_Definition => Search_Before_Semicolon'Access,
A_Formal_Private_Type_Definition ..
A_Formal_Tagged_Private_Type_Definition => No_Brackets'Access,
A_Formal_Derived_Type_Definition => Skip_WP'Access,
A_Formal_Discrete_Type_Definition ..
-- A_Formal_Signed_Integer_Type_Definition
-- A_Formal_Modular_Type_Definition
-- A_Formal_Floating_Point_Definition
-- A_Formal_Ordinary_Fixed_Point_Definition
-- A_Formal_Decimal_Fixed_Point_Definition
-- A_Formal_Unconstrained_Array_Definition
-- A_Formal_Constrained_Array_Definition
-- A_Formal_Pool_Specific_Access_To_Variable
-- A_Formal_Access_To_Variable
A_Formal_Access_To_Constant => No_Brackets'Access,
A_Formal_Access_To_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Function ..
-- A_Formal_Access_To_Protected_Function
-- An_Integer_Literal
-- A_Real_Literal
-- A_String_Literal
-- An_Identifier
-- An_And_Operator
-- An_Or_Operator
-- An_Xor_Operator
-- An_Equal_Operator
-- A_Not_Equal_Operator
-- A_Less_Than_Operator
-- A_Less_Than_Or_Equal_Operator
-- A_Greater_Than_Operator
-- A_Greater_Than_Or_Equal_Operator
-- A_Plus_Operator
-- A_Minus_Operator
-- A_Concatenate_Operator
-- A_Unary_Plus_Operator
-- A_Unary_Minus_Operator
-- A_Multiply_Operator
-- A_Divide_Operator
-- A_Mod_Operator
-- A_Rem_Operator
-- An_Exponentiate_Operator
-- An_Abs_Operator
-- A_Not_Operator
-- A_Character_Literal
-- An_Enumeration_Literal
An_Explicit_Dereference => No_Brackets'Access,
A_Function_Call => Clear_After_Funcion_Call'Access,
An_Indexed_Component ..
A_Slice => Search_Right_Parenthesis'Access,
A_Selected_Component => No_Brackets'Access,
An_Access_Attribute ..
-- An_Address_Attribute
-- An_Adjacent_Attribute
-- An_Aft_Attribute
-- An_Alignment_Attribute
-- A_Base_Attribute
-- A_Bit_Order_Attribute
-- A_Body_Version_Attribute
-- A_Callable_Attribute
-- A_Caller_Attribute
-- A_Ceiling_Attribute
-- A_Class_Attribute
-- A_Component_Size_Attribute
-- A_Compose_Attribute
-- A_Constrained_Attribute
-- A_Copy_Sign_Attribute
-- A_Count_Attribute
-- A_Definite_Attribute
-- A_Delta_Attribute
-- A_Denorm_Attribute
-- A_Digits_Attribute
-- An_Exponent_Attribute
An_External_Tag_Attribute => No_Brackets'Access,
A_First_Attribute => Search_Attr_Right_Parenthesis'Access,
A_First_Bit_Attribute ..
-- A_Floor_Attribute
-- A_Fore_Attribute
-- A_Fraction_Attribute
-- An_Identity_Attribute
-- An_Image_Attribute
An_Input_Attribute => No_Brackets'Access,
A_Last_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Last_Bit_Attribute => No_Brackets'Access,
A_Leading_Part_Attribute => No_Brackets'Access,
A_Length_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Machine_Attribute ..
-- A_Machine_Emax_Attribute
-- A_Machine_Emin_Attribute
-- A_Machine_Mantissa_Attribute
-- A_Machine_Overflows_Attribute
-- A_Machine_Radix_Attribute
-- A_Machine_Rounds_Attribute
-- A_Max_Attribute
-- A_Max_Size_In_Storage_Elements_Attribute
-- A_Min_Attribute
-- A_Model_Attribute
-- A_Model_Emin_Attribute
-- A_Model_Epsilon_Attribute
-- A_Model_Mantissa_Attribute
-- A_Model_Small_Attribute
-- A_Modulus_Attribute
-- An_Output_Attribute
-- A_Partition_ID_Attribute
-- A_Pos_Attribute
-- A_Position_Attribute
A_Pred_Attribute => No_Brackets'Access,
A_Range_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Read_Attribute ..
-- A_Remainder_Attribute
-- A_Round_Attribute
-- A_Rounding_Attribute
-- A_Safe_First_Attribute
-- A_Safe_Last_Attribute
-- A_Scale_Attribute
-- A_Scaling_Attribute
-- A_Signed_Zeros_Attribute
-- A_Size_Attribute
-- A_Small_Attribute
-- A_Storage_Pool_Attribute
-- A_Storage_Size_Attribute
-- A_Succ_Attribute
-- A_Tag_Attribute
-- A_Terminated_Attribute
-- A_Truncation_Attribute
-- An_Unbiased_Rounding_Attribute
-- An_Unchecked_Access_Attribute
-- A_Val_Attribute
-- A_Valid_Attribute
-- A_Value_Attribute
-- A_Version_Attribute
-- A_Wide_Image_Attribute
-- A_Wide_Value_Attribute
-- A_Wide_Width_Attribute
-- A_Width_Attribute
-- A_Write_Attribute
-- |A2006 start
-- New Ada 2005 attributes. To be alphabetically ordered later
-- A_Machine_Rounding_Attribute
-- A_Mod_Attribute
-- A_Priority_Attribute
-- A_Stream_Size_Attribute
-- A_Wide_Wide_Image_Attribute
-- A_Wide_Wide_Value_Attribute
A_Wide_Wide_Width_Attribute => No_Brackets'Access,
-- |A2006 end
An_Implementation_Defined_Attribute ..
An_Unknown_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Record_Aggregate ..
-- An_Extension_Aggregate
-- A_Positional_Array_Aggregate
A_Named_Array_Aggregate => Search_Right_Parenthesis'Access,
An_And_Then_Short_Circuit ..
-- An_Or_Else_Short_Circuit
-- An_In_Range_Membership_Test
-- A_Not_In_Range_Membership_Test
-- An_In_Type_Membership_Test
-- A_Not_In_Type_Membership_Test
A_Null_Literal => No_Brackets'Access,
A_Parenthesized_Expression ..
A_Type_Conversion => Search_Right_Parenthesis'Access,
A_Qualified_Expression => Search_QE_Right_Parenthesis'Access,
An_Allocation_From_Subtype ..
An_Allocation_From_Qualified_Expression => No_Brackets'Access,
A_Case_Expression => No_Brackets'Access, -- Ada 2012
An_If_Expression => No_Brackets'Access, -- Ada 2012
A_For_All_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_For_Some_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_Pragma_Argument_Association ..
-- A_Discriminant_Association
-- A_Record_Component_Association
-- An_Array_Component_Association
A_Parameter_Association => No_Brackets'Access,
A_Generic_Association => Search_End_Of_Box'Access,
A_Null_Statement ..
-- An_Assignment_Statement
-- An_If_Statement
-- A_Case_Statement
-- A_Loop_Statement
-- A_While_Loop_Statement
-- A_For_Loop_Statement
-- A_Block_Statement
-- An_Exit_Statement
-- A_Goto_Statement
-- A_Procedure_Call_Statement
-- A_Return_Statement
-- An_Accept_Statement
-- An_Entry_Call_Statement
-- A_Requeue_Statement
-- A_Requeue_Statement_With_Abort
-- A_Delay_Until_Statement
-- A_Delay_Relative_Statement
-- A_Terminate_Alternative_Statement
-- A_Selective_Accept_Statement
-- A_Timed_Entry_Call_Statement
-- A_Conditional_Entry_Call_Statement
-- An_Asynchronous_Select_Statement
-- An_Abort_Statement
-- A_Raise_Statement
A_Code_Statement => Search_Semicolon'Access,
An_If_Path ..
-- An_Elsif_Path
-- An_Else_Path
-- A_Case_Path
-- A_Select_Path
-- An_Or_Path
-- A_Then_Abort_Path
-- A_Case_Expression_Path -- ASIS 2012
-- An_If_Expression_Path -- ASIS 2012
-- An_Elsif_Expression_Path -- ASIS 2012
An_Else_Expression_Path => No_Brackets'Access, -- Ada 2012
A_Use_Package_Clause ..
-- A_Use_Type_Clause
-- A_Use_All_Type_Clause -- Ada 2012
-- A_With_Clause
-- An_Attribute_Definition_Clause
-- An_Enumeration_Representation_Clause
-- A_Record_Representation_Clause
-- An_At_Clause
A_Component_Clause => Search_Semicolon'Access,
An_Exception_Handler => No_Brackets'Access,
others => A_Bug'Access);
-----------
-- A_Bug --
-----------
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
-- This function should never be called
raise Internal_Implementation_Error;
return S;
end A_Bug;
------------------------------
-- Clear_After_Funcion_Call --
------------------------------
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Prefix_Call (E) then
if Is_Nil (Function_Call_Parameters (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
else
return No_Brackets (E, S);
end if;
end Clear_After_Funcion_Call;
-----------------------------
-- Needs_Extra_Parentheses --
-----------------------------
function Needs_Extra_Parentheses (E : Asis.Element) return Boolean is
Result : Boolean := False;
N : Node_Id;
begin
if Int_Kind (E) in A_Record_Aggregate .. A_Named_Array_Aggregate then
N := R_Node (E);
if Paren_Count (N) = 1 and then
Nkind (Parent (N)) = N_Qualified_Expression
then
Result := True;
end if;
end if;
return Result;
end Needs_Extra_Parentheses;
-----------------
-- No_Brackets --
-----------------
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
return S;
end No_Brackets;
-----------------------------------
-- Search_Attr_Right_Parenthesis --
-----------------------------------
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Nil (Attribute_Designator_Expressions (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
end Search_Attr_Right_Parenthesis;
-----------------------------
-- Search_Before_Semicolon --
-----------------------------
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
S_P : Source_Ptr;
Result : Source_Ptr;
begin
-- first, we have to check where we are: at ';' or at the beginning of
-- the reserved word "end" in case if there is no components,
-- and if we are at ';', we have to go to "end":
if Get_Character (S) = ';' then
S_P := Next_Identifier (S);
elsif Asis.Definitions.Is_Private_Present (E) then
-- patological case of empty efinition with private part
S_P := S + 7;
else
S_P := S;
S_P := Rightmost_Non_Blank (S_P);
end if;
Result := S_P + 2;
-- the last character of "end"
S_P := S_P + 3;
-- the first character after "end"
S_P := Rightmost_Non_Blank (S_P);
-- and the final check - what follows the final "end"
if Get_Character (S_P) /= ';' then
-- there is an identifier after "end"
Result := Get_Word_End (P => S_P,
In_Word => In_Identifier'Access);
end if;
return Result;
end Search_Before_Semicolon;
-----------------------
-- Search_End_Of_Box --
-----------------------
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
begin
case Int_Kind (E) is
when A_Generic_Association =>
if Is_Nil (Actual_Parameter (E)) then
Result := Search_Rightmost_Symbol (S, '<');
Result := Result + 1;
end if;
when others =>
null;
end case;
return Result;
end Search_End_Of_Box;
---------------------------------
-- Search_QE_Right_Parenthesis --
---------------------------------
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
Tmp : constant Asis.Element := Converted_Or_Qualified_Expression (E);
begin
if Int_Kind (Tmp) not in A_Record_Aggregate .. A_Named_Array_Aggregate
or else Needs_Extra_Parentheses (Tmp)
then
Result := Search_Rightmost_Symbol (S + 1, ')');
end if;
return Result;
end Search_QE_Right_Parenthesis;
------------------------------
-- Search_Right_Parenthesis --
------------------------------
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
pragma Unreferenced (E);
return Search_Rightmost_Symbol (S + 1, ')');
end Search_Right_Parenthesis;
----------------------
-- Search_Semicolon --
----------------------
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
pragma Unreferenced (E);
S_P : Source_Ptr;
begin
S_P := Search_Rightmost_Symbol (S + 1, ';');
return S_P;
end Search_Semicolon;
-------------
-- Skip_WP --
-------------
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr;
begin
-- just jump to the trailing semicolon, and then - to the end of
-- the previous word, this should handle properly cases where there
-- are and where there are not "with private" keywords
S_P := Search_Semicolon (E, S);
S_P := Search_Prev_Word (S_P);
return S_P;
end Skip_WP;
----------------------------
-- Skip_Trailing_Brackets --
----------------------------
function Skip_Trailing_Brackets
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
-- all that this function does is switching to the function
-- implementing the specific processing for the given element
-- kind
if Debug_Flag_X then
Write_Str (" Skip_Trailing_Brackets - called for ");
Write_Str (Internal_Element_Kinds'Image (Int_Kind (E)));
Write_Eol;
Write_Eol;
end if;
return Skip_Switch (Int_Kind (E)) (E, S);
end Skip_Trailing_Brackets;
end A4G.Skip_TB;
| true |
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . S K I P _ T B --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.PI:EMAIL:<EMAIL>END_PI). --
-- --
------------------------------------------------------------------------------
with Asis.Definitions; use Asis.Definitions;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
with Atree; use Atree;
with Output; use Output;
with Sinfo; use Sinfo;
package body A4G.Skip_TB is
-- In fact, there is a very few different cases of skipping the "syntax
-- sugar", but we implement this skipping by means of look-up table
-- for ease of maintenance.
-------------------------------
-- Specific Serach Functions --
-------------------------------
type Find_Source_Location_Type is access
function (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- All the specific search functions are of the designated profile of
-- this access-to-function type. We need the Element parameter to
-- define the presennce or absence of optional component, because
-- such optional components may have trailing brackets specific for
-- them
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- No seaqrch is made, the argument is returned
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the right-most ')' is returned. The search is started
-- the position S + 1, so if S itself points to ')', S will not be
-- returned
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- Version of the previous function for a qualified expression. If the
-- argument is an aggregate which does not Needs_Extra_Parentheses, this
-- function is equivalent to No_Brackets, otherwise is the same as
-- Search_Right_Parenthesis
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E has a static expression as part of attribute designator,
-- this function looks for the location of the right-most ')'.
-- otherwise it makes no search.
-- E should be of A_First_Attribute, A_Last_Attribute, A_Length_Attribute,
-- A_Range_Attribute, An_Implementation_Defined_Attribute or
-- An_Unknown_Attribute kind only, otherwise ASIS_Inappropriate_Element
-- will be raised
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- This is a somewhat special case: a task/protected declaration ends
-- with "end [identifier];", but the corresponding definition ends
-- with "end [identifier]", that is, *without* ";" .
-- When this function is called, it is supposed, that S points
-- to the trailing semicolon of the last component of a task/protected
-- definition or to the first character of the trailing end in case
-- if there is no component
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- The location of the rigt-most ';' is returned, starting from the
-- position next to S, but not S itself
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- For a function call we have to make a differenve between an infix
-- call (no trailing brackets to skip) and prefix call, and in the
-- latter case - between the case when there is no parameter (no
-- trailing brackets to skip) and the case when there is(are) a
-- parameter(s) (a ')' should be skipped)
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function handles a special case with
-- A_Formal_Derived_Type_Definition: in skips 'with private"
-- keywords, if any
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr;
-- If E may contain a box as the end of its text image, this function
-- returns the location of the '>' that is the end of this box, otherwise
-- it returns S. It is supposed that there is no other '<' between S and
-- the end of box except '<' that is the beginning of the box to look for.
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr;
-- This function should never be called. We need it for "others"
-- choise in the aggregate initializing the look-up table for those
-- values of Internal_Element_Kinds which should never be processed
-- (they correspond to implicit root and universal types). This
-- function raises Internal_Implementation_Error
------------------
-- Serach Array --
------------------
Skip_Switch : constant array (Internal_Element_Kinds) of
Find_Source_Location_Type :=
(An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma
-- An_Atomic_Pragma
-- An_Atomic_Components_Pragma
-- An_Attach_Handler_Pragma
-- A_Controlled_Pragma
-- A_Convention_Pragma
-- An_Elaborate_All_Pragma
-- An_Elaborate_Body_Pragma
-- An_Export_Pragma
-- An_Import_Pragma
-- An_Inline_Pragma
-- An_Inspection_Point_Pragma
-- An_Interrupt_Handler_Pragma
-- An_Interrupt_Priority_Pragma
-- A_List_Pragma
-- A_Locking_Policy_Pragma
-- A_Normalize_Scalars_Pragma
-- An_Optimize_Pragma
-- A_Pack_Pragma
-- A_Page_Pragma
-- A_Preelaborate_Pragma
-- A_Priority_Pragma
-- A_Pure_Pragma
-- A_Queuing_Policy_Pragma
-- A_Remote_Call_Interface_Pragma
-- A_Remote_Types_Pragma
-- A_Restrictions_Pragma
-- A_Reviewable_Pragma
-- A_Shared_Passive_Pragma
-- A_Suppress_Pragma
-- A_Task_Dispatching_Policy_Pragma
-- A_Volatile_Pragma
-- A_Volatile_Components_Pragma
-- An_Implementation_Defined_Pragma
An_Unknown_Pragma => Search_Semicolon'Access,
A_Defining_Identifier ..
-- A_Defining_Character_Literal
-- A_Defining_Enumeration_Literal
-- A_Defining_And_Operator
-- A_Defining_Or_Operator
-- A_Defining_Xor_Operator
-- A_Defining_Equal_Operator
-- A_Defining_Not_Equal_Operator
-- A_Defining_Less_Than_Operator
-- A_Defining_Less_Than_Or_Equal_Operator
-- A_Defining_Greater_Than_Operator
-- A_Defining_Greater_Than_Or_Equal_Operator
-- A_Defining_Plus_Operator
-- A_Defining_Minus_Operator
-- A_Defining_Concatenate_Operator
-- A_Defining_Unary_Plus_Operator
-- A_Defining_Unary_Minus_Operator
-- A_Defining_Multiply_Operator
-- A_Defining_Divide_Operator
-- A_Defining_Mod_Operator
-- A_Defining_Rem_Operator
-- A_Defining_Exponentiate_Operator
-- A_Defining_Abs_Operator
-- A_Defining_Not_Operator
A_Defining_Expanded_Name => No_Brackets'Access,
An_Ordinary_Type_Declaration ..
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
-- An_Integer_Number_Declaration
A_Real_Number_Declaration => Search_Semicolon'Access,
An_Enumeration_Literal_Specification => No_Brackets'Access,
A_Discriminant_Specification => No_Brackets'Access,
A_Component_Declaration => Search_Semicolon'Access,
A_Loop_Parameter_Specification => No_Brackets'Access,
A_Generalized_Iterator_Specification => No_Brackets'Access,
An_Element_Iterator_Specification => No_Brackets'Access,
A_Procedure_Declaration => Search_Semicolon'Access,
A_Function_Declaration => Search_Semicolon'Access,
A_Parameter_Specification => No_Brackets'Access,
A_Procedure_Body_Declaration ..
A_Function_Body_Declaration => Search_Semicolon'Access,
A_Return_Variable_Specification => No_Brackets'Access,
A_Return_Constant_Specification => No_Brackets'Access,
A_Null_Procedure_Declaration ..
-- An_Expression_Function_Declaration
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- A_Package_Body_Declaration
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
-- An_Entry_Declaration
An_Entry_Body_Declaration => Search_Semicolon'Access,
An_Entry_Index_Specification => No_Brackets'Access,
A_Procedure_Body_Stub ..
-- A_Function_Body_Stub
-- A_Package_Body_Stub
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
An_Exception_Declaration => Search_Semicolon'Access,
A_Choice_Parameter_Specification => No_Brackets'Access,
A_Generic_Procedure_Declaration ..
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Function_Instantiation
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
A_Formal_Package_Declaration_With_Box => Search_Semicolon'Access,
A_Derived_Type_Definition => No_Brackets'Access,
A_Derived_Record_Extension_Definition => No_Brackets'Access,
An_Enumeration_Type_Definition => Search_Right_Parenthesis'Access,
A_Signed_Integer_Type_Definition ..
-- A_Modular_Type_Definition
---------------------------------------------------------
-- !!! They all are implicit and cannot have image
-- |
-- |-> A_Root_Integer_Definition
-- |-> A_Root_Real_Definition
-- |-> A_Root_Fixed_Definition
-- |-> A_Universal_Integer_Definition
-- |-> A_Universal_Real_Definition
-- +-> A_Universal_Fixed_Definition
---------------------------------------------------------
-- A_Floating_Point_Definition
-- An_Ordinary_Fixed_Point_Definition
-- A_Decimal_Fixed_Point_Definition
-- An_Unconstrained_Array_Definition
-- A_Constrained_Array_Definition
-- A_Record_Type_Definition
-- A_Tagged_Record_Type_Definition
-- A_Pool_Specific_Access_To_Variable
-- An_Access_To_Variable
An_Access_To_Constant => No_Brackets'Access,
An_Access_To_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Protected_Procedure => Search_Right_Parenthesis'Access,
An_Access_To_Function ..
-- An_Access_To_Protected_Function
-- A_Subtype_Indication
-- A_Range_Attribute_Reference
-- A_Simple_Expression_Range
-- A_Digits_Constraint
A_Delta_Constraint => No_Brackets'Access,
An_Index_Constraint => Search_Right_Parenthesis'Access,
A_Discriminant_Constraint => Search_Right_Parenthesis'Access,
A_Component_Definition ..
-- A_Discrete_Subtype_Indication_As_Subtype_Definition
-- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition
-- A_Discrete_Simple_Expression_Range_As_Subtype_Definition
-- A_Discrete_Subtype_Indication
-- A_Discrete_Range_Attribute_Reference
-- A_Discrete_Simple_Expression_Range
An_Unknown_Discriminant_Part => No_Brackets'Access,
A_Known_Discriminant_Part => Search_Right_Parenthesis'Access,
A_Record_Definition => No_Brackets'Access,
A_Null_Record_Definition => No_Brackets'Access,
A_Null_Component => Search_Semicolon'Access,
A_Variant_Part => Search_Semicolon'Access,
A_Variant ..
An_Others_Choice => No_Brackets'Access,
-- --|A2005 start
An_Anonymous_Access_To_Variable ..
An_Anonymous_Access_To_Constant => No_Brackets'Access,
An_Anonymous_Access_To_Procedure ..
An_Anonymous_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
An_Anonymous_Access_To_Function ..
An_Anonymous_Access_To_Protected_Function => No_Brackets'Access,
-- --|A2005 end
A_Private_Type_Definition ..
-- A_Tagged_Private_Type_Definition
A_Private_Extension_Definition => No_Brackets'Access,
A_Task_Definition ..
A_Protected_Definition => Search_Before_Semicolon'Access,
A_Formal_Private_Type_Definition ..
A_Formal_Tagged_Private_Type_Definition => No_Brackets'Access,
A_Formal_Derived_Type_Definition => Skip_WP'Access,
A_Formal_Discrete_Type_Definition ..
-- A_Formal_Signed_Integer_Type_Definition
-- A_Formal_Modular_Type_Definition
-- A_Formal_Floating_Point_Definition
-- A_Formal_Ordinary_Fixed_Point_Definition
-- A_Formal_Decimal_Fixed_Point_Definition
-- A_Formal_Unconstrained_Array_Definition
-- A_Formal_Constrained_Array_Definition
-- A_Formal_Pool_Specific_Access_To_Variable
-- A_Formal_Access_To_Variable
A_Formal_Access_To_Constant => No_Brackets'Access,
A_Formal_Access_To_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Protected_Procedure =>
Search_Right_Parenthesis'Access,
A_Formal_Access_To_Function ..
-- A_Formal_Access_To_Protected_Function
-- An_Integer_Literal
-- A_Real_Literal
-- A_String_Literal
-- An_Identifier
-- An_And_Operator
-- An_Or_Operator
-- An_Xor_Operator
-- An_Equal_Operator
-- A_Not_Equal_Operator
-- A_Less_Than_Operator
-- A_Less_Than_Or_Equal_Operator
-- A_Greater_Than_Operator
-- A_Greater_Than_Or_Equal_Operator
-- A_Plus_Operator
-- A_Minus_Operator
-- A_Concatenate_Operator
-- A_Unary_Plus_Operator
-- A_Unary_Minus_Operator
-- A_Multiply_Operator
-- A_Divide_Operator
-- A_Mod_Operator
-- A_Rem_Operator
-- An_Exponentiate_Operator
-- An_Abs_Operator
-- A_Not_Operator
-- A_Character_Literal
-- An_Enumeration_Literal
An_Explicit_Dereference => No_Brackets'Access,
A_Function_Call => Clear_After_Funcion_Call'Access,
An_Indexed_Component ..
A_Slice => Search_Right_Parenthesis'Access,
A_Selected_Component => No_Brackets'Access,
An_Access_Attribute ..
-- An_Address_Attribute
-- An_Adjacent_Attribute
-- An_Aft_Attribute
-- An_Alignment_Attribute
-- A_Base_Attribute
-- A_Bit_Order_Attribute
-- A_Body_Version_Attribute
-- A_Callable_Attribute
-- A_Caller_Attribute
-- A_Ceiling_Attribute
-- A_Class_Attribute
-- A_Component_Size_Attribute
-- A_Compose_Attribute
-- A_Constrained_Attribute
-- A_Copy_Sign_Attribute
-- A_Count_Attribute
-- A_Definite_Attribute
-- A_Delta_Attribute
-- A_Denorm_Attribute
-- A_Digits_Attribute
-- An_Exponent_Attribute
An_External_Tag_Attribute => No_Brackets'Access,
A_First_Attribute => Search_Attr_Right_Parenthesis'Access,
A_First_Bit_Attribute ..
-- A_Floor_Attribute
-- A_Fore_Attribute
-- A_Fraction_Attribute
-- An_Identity_Attribute
-- An_Image_Attribute
An_Input_Attribute => No_Brackets'Access,
A_Last_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Last_Bit_Attribute => No_Brackets'Access,
A_Leading_Part_Attribute => No_Brackets'Access,
A_Length_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Machine_Attribute ..
-- A_Machine_Emax_Attribute
-- A_Machine_Emin_Attribute
-- A_Machine_Mantissa_Attribute
-- A_Machine_Overflows_Attribute
-- A_Machine_Radix_Attribute
-- A_Machine_Rounds_Attribute
-- A_Max_Attribute
-- A_Max_Size_In_Storage_Elements_Attribute
-- A_Min_Attribute
-- A_Model_Attribute
-- A_Model_Emin_Attribute
-- A_Model_Epsilon_Attribute
-- A_Model_Mantissa_Attribute
-- A_Model_Small_Attribute
-- A_Modulus_Attribute
-- An_Output_Attribute
-- A_Partition_ID_Attribute
-- A_Pos_Attribute
-- A_Position_Attribute
A_Pred_Attribute => No_Brackets'Access,
A_Range_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Read_Attribute ..
-- A_Remainder_Attribute
-- A_Round_Attribute
-- A_Rounding_Attribute
-- A_Safe_First_Attribute
-- A_Safe_Last_Attribute
-- A_Scale_Attribute
-- A_Scaling_Attribute
-- A_Signed_Zeros_Attribute
-- A_Size_Attribute
-- A_Small_Attribute
-- A_Storage_Pool_Attribute
-- A_Storage_Size_Attribute
-- A_Succ_Attribute
-- A_Tag_Attribute
-- A_Terminated_Attribute
-- A_Truncation_Attribute
-- An_Unbiased_Rounding_Attribute
-- An_Unchecked_Access_Attribute
-- A_Val_Attribute
-- A_Valid_Attribute
-- A_Value_Attribute
-- A_Version_Attribute
-- A_Wide_Image_Attribute
-- A_Wide_Value_Attribute
-- A_Wide_Width_Attribute
-- A_Width_Attribute
-- A_Write_Attribute
-- |A2006 start
-- New Ada 2005 attributes. To be alphabetically ordered later
-- A_Machine_Rounding_Attribute
-- A_Mod_Attribute
-- A_Priority_Attribute
-- A_Stream_Size_Attribute
-- A_Wide_Wide_Image_Attribute
-- A_Wide_Wide_Value_Attribute
A_Wide_Wide_Width_Attribute => No_Brackets'Access,
-- |A2006 end
An_Implementation_Defined_Attribute ..
An_Unknown_Attribute => Search_Attr_Right_Parenthesis'Access,
A_Record_Aggregate ..
-- An_Extension_Aggregate
-- A_Positional_Array_Aggregate
A_Named_Array_Aggregate => Search_Right_Parenthesis'Access,
An_And_Then_Short_Circuit ..
-- An_Or_Else_Short_Circuit
-- An_In_Range_Membership_Test
-- A_Not_In_Range_Membership_Test
-- An_In_Type_Membership_Test
-- A_Not_In_Type_Membership_Test
A_Null_Literal => No_Brackets'Access,
A_Parenthesized_Expression ..
A_Type_Conversion => Search_Right_Parenthesis'Access,
A_Qualified_Expression => Search_QE_Right_Parenthesis'Access,
An_Allocation_From_Subtype ..
An_Allocation_From_Qualified_Expression => No_Brackets'Access,
A_Case_Expression => No_Brackets'Access, -- Ada 2012
An_If_Expression => No_Brackets'Access, -- Ada 2012
A_For_All_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_For_Some_Quantified_Expression => No_Brackets'Access, -- Ada 2012
A_Pragma_Argument_Association ..
-- A_Discriminant_Association
-- A_Record_Component_Association
-- An_Array_Component_Association
A_Parameter_Association => No_Brackets'Access,
A_Generic_Association => Search_End_Of_Box'Access,
A_Null_Statement ..
-- An_Assignment_Statement
-- An_If_Statement
-- A_Case_Statement
-- A_Loop_Statement
-- A_While_Loop_Statement
-- A_For_Loop_Statement
-- A_Block_Statement
-- An_Exit_Statement
-- A_Goto_Statement
-- A_Procedure_Call_Statement
-- A_Return_Statement
-- An_Accept_Statement
-- An_Entry_Call_Statement
-- A_Requeue_Statement
-- A_Requeue_Statement_With_Abort
-- A_Delay_Until_Statement
-- A_Delay_Relative_Statement
-- A_Terminate_Alternative_Statement
-- A_Selective_Accept_Statement
-- A_Timed_Entry_Call_Statement
-- A_Conditional_Entry_Call_Statement
-- An_Asynchronous_Select_Statement
-- An_Abort_Statement
-- A_Raise_Statement
A_Code_Statement => Search_Semicolon'Access,
An_If_Path ..
-- An_Elsif_Path
-- An_Else_Path
-- A_Case_Path
-- A_Select_Path
-- An_Or_Path
-- A_Then_Abort_Path
-- A_Case_Expression_Path -- ASIS 2012
-- An_If_Expression_Path -- ASIS 2012
-- An_Elsif_Expression_Path -- ASIS 2012
An_Else_Expression_Path => No_Brackets'Access, -- Ada 2012
A_Use_Package_Clause ..
-- A_Use_Type_Clause
-- A_Use_All_Type_Clause -- Ada 2012
-- A_With_Clause
-- An_Attribute_Definition_Clause
-- An_Enumeration_Representation_Clause
-- A_Record_Representation_Clause
-- An_At_Clause
A_Component_Clause => Search_Semicolon'Access,
An_Exception_Handler => No_Brackets'Access,
others => A_Bug'Access);
-----------
-- A_Bug --
-----------
function A_Bug (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
-- This function should never be called
raise Internal_Implementation_Error;
return S;
end A_Bug;
------------------------------
-- Clear_After_Funcion_Call --
------------------------------
function Clear_After_Funcion_Call
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Prefix_Call (E) then
if Is_Nil (Function_Call_Parameters (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
else
return No_Brackets (E, S);
end if;
end Clear_After_Funcion_Call;
-----------------------------
-- Needs_Extra_Parentheses --
-----------------------------
function Needs_Extra_Parentheses (E : Asis.Element) return Boolean is
Result : Boolean := False;
N : Node_Id;
begin
if Int_Kind (E) in A_Record_Aggregate .. A_Named_Array_Aggregate then
N := R_Node (E);
if Paren_Count (N) = 1 and then
Nkind (Parent (N)) = N_Qualified_Expression
then
Result := True;
end if;
end if;
return Result;
end Needs_Extra_Parentheses;
-----------------
-- No_Brackets --
-----------------
function No_Brackets (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
begin
pragma Unreferenced (E);
return S;
end No_Brackets;
-----------------------------------
-- Search_Attr_Right_Parenthesis --
-----------------------------------
function Search_Attr_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
if Is_Nil (Attribute_Designator_Expressions (E)) then
return No_Brackets (E, S);
else
return Search_Right_Parenthesis (E, S);
end if;
end Search_Attr_Right_Parenthesis;
-----------------------------
-- Search_Before_Semicolon --
-----------------------------
function Search_Before_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
S_P : Source_Ptr;
Result : Source_Ptr;
begin
-- first, we have to check where we are: at ';' or at the beginning of
-- the reserved word "end" in case if there is no components,
-- and if we are at ';', we have to go to "end":
if Get_Character (S) = ';' then
S_P := Next_Identifier (S);
elsif Asis.Definitions.Is_Private_Present (E) then
-- patological case of empty efinition with private part
S_P := S + 7;
else
S_P := S;
S_P := Rightmost_Non_Blank (S_P);
end if;
Result := S_P + 2;
-- the last character of "end"
S_P := S_P + 3;
-- the first character after "end"
S_P := Rightmost_Non_Blank (S_P);
-- and the final check - what follows the final "end"
if Get_Character (S_P) /= ';' then
-- there is an identifier after "end"
Result := Get_Word_End (P => S_P,
In_Word => In_Identifier'Access);
end if;
return Result;
end Search_Before_Semicolon;
-----------------------
-- Search_End_Of_Box --
-----------------------
function Search_End_Of_Box
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
begin
case Int_Kind (E) is
when A_Generic_Association =>
if Is_Nil (Actual_Parameter (E)) then
Result := Search_Rightmost_Symbol (S, '<');
Result := Result + 1;
end if;
when others =>
null;
end case;
return Result;
end Search_End_Of_Box;
---------------------------------
-- Search_QE_Right_Parenthesis --
---------------------------------
function Search_QE_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
Result : Source_Ptr := S;
Tmp : constant Asis.Element := Converted_Or_Qualified_Expression (E);
begin
if Int_Kind (Tmp) not in A_Record_Aggregate .. A_Named_Array_Aggregate
or else Needs_Extra_Parentheses (Tmp)
then
Result := Search_Rightmost_Symbol (S + 1, ')');
end if;
return Result;
end Search_QE_Right_Parenthesis;
------------------------------
-- Search_Right_Parenthesis --
------------------------------
function Search_Right_Parenthesis
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
pragma Unreferenced (E);
return Search_Rightmost_Symbol (S + 1, ')');
end Search_Right_Parenthesis;
----------------------
-- Search_Semicolon --
----------------------
function Search_Semicolon
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
pragma Unreferenced (E);
S_P : Source_Ptr;
begin
S_P := Search_Rightmost_Symbol (S + 1, ';');
return S_P;
end Search_Semicolon;
-------------
-- Skip_WP --
-------------
function Skip_WP (E : Asis.Element; S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr;
begin
-- just jump to the trailing semicolon, and then - to the end of
-- the previous word, this should handle properly cases where there
-- are and where there are not "with private" keywords
S_P := Search_Semicolon (E, S);
S_P := Search_Prev_Word (S_P);
return S_P;
end Skip_WP;
----------------------------
-- Skip_Trailing_Brackets --
----------------------------
function Skip_Trailing_Brackets
(E : Asis.Element;
S : Source_Ptr)
return Source_Ptr
is
begin
-- all that this function does is switching to the function
-- implementing the specific processing for the given element
-- kind
if Debug_Flag_X then
Write_Str (" Skip_Trailing_Brackets - called for ");
Write_Str (Internal_Element_Kinds'Image (Int_Kind (E)));
Write_Eol;
Write_Eol;
end if;
return Skip_Switch (Int_Kind (E)) (E, S);
end Skip_Trailing_Brackets;
end A4G.Skip_TB;
|
[
{
"context": "sts -- Tests for tokenizers\n-- Copyright (C) 2020 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 162,
"score": 0.999873161315918,
"start": 147,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2020 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 193,
"score": 0.9998807907104492,
"start": 178,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "0 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 220,
"score": 0.9999299049377441,
"start": 195,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/search-tokenizers-tests.ads
|
stcarrez/ada-search
| 9 |
-----------------------------------------------------------------------
-- search-tokenizers-tests -- Tests for tokenizers
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with Util.Strings.Sets;
package Search.Tokenizers.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test and Consumer_Type With record
Set : Util.Strings.Sets.Set;
end record;
overriding
procedure Push_Token (Filter : in out Test;
Token : in String;
Consumer : not null
access procedure (Token : in String));
procedure Test_Simple_Tokenizer (T : in out Test);
end Search.Tokenizers.Tests;
|
3429
|
-----------------------------------------------------------------------
-- search-tokenizers-tests -- Tests for tokenizers
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with Util.Strings.Sets;
package Search.Tokenizers.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test and Consumer_Type With record
Set : Util.Strings.Sets.Set;
end record;
overriding
procedure Push_Token (Filter : in out Test;
Token : in String;
Consumer : not null
access procedure (Token : in String));
procedure Test_Simple_Tokenizer (T : in out Test);
end Search.Tokenizers.Tests;
| true |
-----------------------------------------------------------------------
-- search-tokenizers-tests -- Tests for tokenizers
-- Copyright (C) 2020 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with Util.Strings.Sets;
package Search.Tokenizers.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test and Consumer_Type With record
Set : Util.Strings.Sets.Set;
end record;
overriding
procedure Push_Token (Filter : in out Test;
Token : in String;
Consumer : not null
access procedure (Token : in String));
procedure Test_Simple_Tokenizer (T : in out Test);
end Search.Tokenizers.Tests;
|
[
{
"context": "THIS TEST IN CONJUNCTION\n-- WITH TEST B35801C.\n\n-- R.WILLIAMS 8/21/86\n\nWITH REPORT; USE REPORT;\nPROCEDURE A3580",
"end": 1513,
"score": 0.9998774528503418,
"start": 1503,
"tag": "NAME",
"value": "R.WILLIAMS"
}
] |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/a35801f.ada
|
best08618/asylo
| 7 |
-- A35801F.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 THE ATTRIBUTES FIRST AND LAST RETURN VALUES HAVING THE
-- SAME BASE TYPE AS THE PREFIX WHEN THE PREFIX IS A FLOATING POINT
-- TYPE.
-- THIS CHECK IS PROVIDED THROUGH THE USE OF THIS TEST IN CONJUNCTION
-- WITH TEST B35801C.
-- R.WILLIAMS 8/21/86
WITH REPORT; USE REPORT;
PROCEDURE A35801F IS
TYPE REAL IS DIGITS 3 RANGE -100.0 .. 100.0;
SUBTYPE SURREAL IS REAL RANGE -50.0 .. 50.0;
TYPE NFLT IS NEW FLOAT;
SUBTYPE UNIT IS NFLT RANGE -1.0 .. 1.0;
SUBTYPE EMPTY IS FLOAT RANGE 1.0 .. -1.0;
R1 : REAL := SURREAL'FIRST; -- OK.
R2 : REAL := SURREAL'LAST; -- OK.
N1 : NFLT := UNIT'FIRST; -- OK.
N2 : NFLT := UNIT'LAST; -- OK.
F1 : FLOAT := FLOAT'FIRST; -- OK.
F2 : FLOAT := FLOAT'LAST; -- OK.
E1 : FLOAT := EMPTY'FIRST; -- OK.
E2 : FLOAT := EMPTY'LAST; -- OK.
BEGIN
TEST ( "A35801F", "CHECK THAT THE ATTRIBUTES FIRST AND LAST " &
"RETURN VALUES HAVING THE SAME BASE TYPE AS " &
"THE PREFIX WHEN THE PREFIX IS A FLOATING " &
"POINT TYPE" );
RESULT;
END A35801F;
|
1216
|
-- A35801F.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 THE ATTRIBUTES FIRST AND LAST RETURN VALUES HAVING THE
-- SAME BASE TYPE AS THE PREFIX WHEN THE PREFIX IS A FLOATING POINT
-- TYPE.
-- THIS CHECK IS PROVIDED THROUGH THE USE OF THIS TEST IN CONJUNCTION
-- WITH TEST B35801C.
-- <NAME> 8/21/86
WITH REPORT; USE REPORT;
PROCEDURE A35801F IS
TYPE REAL IS DIGITS 3 RANGE -100.0 .. 100.0;
SUBTYPE SURREAL IS REAL RANGE -50.0 .. 50.0;
TYPE NFLT IS NEW FLOAT;
SUBTYPE UNIT IS NFLT RANGE -1.0 .. 1.0;
SUBTYPE EMPTY IS FLOAT RANGE 1.0 .. -1.0;
R1 : REAL := SURREAL'FIRST; -- OK.
R2 : REAL := SURREAL'LAST; -- OK.
N1 : NFLT := UNIT'FIRST; -- OK.
N2 : NFLT := UNIT'LAST; -- OK.
F1 : FLOAT := FLOAT'FIRST; -- OK.
F2 : FLOAT := FLOAT'LAST; -- OK.
E1 : FLOAT := EMPTY'FIRST; -- OK.
E2 : FLOAT := EMPTY'LAST; -- OK.
BEGIN
TEST ( "A35801F", "CHECK THAT THE ATTRIBUTES FIRST AND LAST " &
"RETURN VALUES HAVING THE SAME BASE TYPE AS " &
"THE PREFIX WHEN THE PREFIX IS A FLOATING " &
"POINT TYPE" );
RESULT;
END A35801F;
| true |
-- A35801F.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 THE ATTRIBUTES FIRST AND LAST RETURN VALUES HAVING THE
-- SAME BASE TYPE AS THE PREFIX WHEN THE PREFIX IS A FLOATING POINT
-- TYPE.
-- THIS CHECK IS PROVIDED THROUGH THE USE OF THIS TEST IN CONJUNCTION
-- WITH TEST B35801C.
-- PI:NAME:<NAME>END_PI 8/21/86
WITH REPORT; USE REPORT;
PROCEDURE A35801F IS
TYPE REAL IS DIGITS 3 RANGE -100.0 .. 100.0;
SUBTYPE SURREAL IS REAL RANGE -50.0 .. 50.0;
TYPE NFLT IS NEW FLOAT;
SUBTYPE UNIT IS NFLT RANGE -1.0 .. 1.0;
SUBTYPE EMPTY IS FLOAT RANGE 1.0 .. -1.0;
R1 : REAL := SURREAL'FIRST; -- OK.
R2 : REAL := SURREAL'LAST; -- OK.
N1 : NFLT := UNIT'FIRST; -- OK.
N2 : NFLT := UNIT'LAST; -- OK.
F1 : FLOAT := FLOAT'FIRST; -- OK.
F2 : FLOAT := FLOAT'LAST; -- OK.
E1 : FLOAT := EMPTY'FIRST; -- OK.
E2 : FLOAT := EMPTY'LAST; -- OK.
BEGIN
TEST ( "A35801F", "CHECK THAT THE ATTRIBUTES FIRST AND LAST " &
"RETURN VALUES HAVING THE SAME BASE TYPE AS " &
"THE PREFIX WHEN THE PREFIX IS A FLOATING " &
"POINT TYPE" );
RESULT;
END A35801F;
|
[
{
"context": " --\n-- |___/_|\\_\\_|_|____| by: Timm Felden, Dennis Przytarski --\n-- ",
"end": 284,
"score": 0.9998725056648254,
"start": 273,
"tag": "NAME",
"value": "Timm Felden"
},
{
"context": " --\n-- |___/_|\\_\\_|_|____| by: Timm Felden, Dennis Przytarski --\n-- ",
"end": 303,
"score": 0.9998584389686584,
"start": 286,
"tag": "NAME",
"value": "Dennis Przytarski"
}
] |
src/skill-streams-writer.adb
|
skill-lang/adaCommon
| 0 |
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ stream to skill tokens --
-- |___/_|\_\_|_|____| by: Timm Felden, Dennis Przytarski --
-- --
pragma Ada_2012;
with Ada.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces;
with Skill.Types;
with Interfaces.C.Strings;
with System;
with Skill.Errors;
with Interfaces.C_Streams;
with System.Storage_Elements;
with System.Address_To_Access_Conversions;
with System.Address_Image;
package body Skill.Streams.Writer is
use Skill;
use Interfaces;
use type System.Address;
--- common type conversions ---
-- @note they are required at this level, because otherwise inlining will crash
function Cast is new Ada.Unchecked_Conversion (Types.v64, Types.Uv64);
package Casts is new System.Address_To_Access_Conversions (C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
function Open
(Path : not null Types.String_Access;
Mode : String) return Output_Stream
is
F : Interfaces.C_Streams.FILEs :=
C_Streams.fopen (C.To_C (Path.all)'Address, Mode'Address);
R : Output_Stream;
-- throwaway value required by ada ...
U : Integer;
use System.Storage_Elements;
begin
if C_Streams.NULL_Stream = F then
raise Skill.Errors.Skill_Error
with "failed to write file: " & Path.all;
end if;
U := C_Streams.Fseek(F, 0, C_Streams.SEEK_END);
R :=
new Output_Stream_T'
(Path => Path,
File => F,
Map => Invalid_Pointer,
Base => Invalid_Pointer,
EOF => Invalid_Pointer,
Bytes_Written => Types.V64(C_Streams.Ftell(F)),
Buffer => <>,
Block_Map_Mode => False,
Client_Map => Invalid_Pointer,
Client_Base => Invalid_Pointer,
Client_EOF => Invalid_Pointer);
R.Map := Convert (Casts.To_Pointer (R.Buffer'Address));
R.Base := Convert (Casts.To_Pointer (R.Buffer'Address));
R.EOF := Convert (Casts.To_Pointer (R.Buffer'Address + 1024));
return R;
end Open;
procedure Flush_Buffer (This : access Output_Stream_T) is
use type Map_Pointer;
use type C_Streams.size_t;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
Length : C_Streams.size_t := C_Streams.size_t (This.Map - This.Base);
begin
if 0 /= Length then
if Length /=
Interfaces.C_Streams.fwrite
(Casts.To_Address (Convert (This.Base)),
1,
Length,
This.File)
then
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
This.Map := This.Base;
end if;
end Flush_Buffer;
-- creates a map for a block and enables usage of map function
procedure Begin_Block_Map
(This : access Output_Stream_T;
Size : Types.v64)
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Map : Uchar.Pointer;
begin
pragma Assert (not This.Block_Map_Mode);
This.Block_Map_Mode := True;
-- Save Our Buffer To Disk
Flush_Buffer (This);
if 0 = Size then
This.Client_Map := Invalid_Pointer;
This.Client_Base := Invalid_Pointer;
This.Client_EOF := Invalid_Pointer;
else
Map := MMap_Write_Map (This.File, Size) + C.ptrdiff_t (This.Position);
if null = Map then
raise Skill.Errors.Skill_Error
with "failed to create map of size" &
Long_Long_Integer'Image (Long_Long_Integer (Size)) &
" in file: " &
This.Path.all;
end if;
-- Advance File Pointer
-- @Note: File Position Was Updated By C Code
This.Bytes_Written := This.Bytes_Written + Size;
This.Client_Map := Map_Pointer (Map);
This.Client_Base := Map_Pointer (Map);
This.Client_EOF := Map_Pointer (Map) + C.ptrdiff_t (Size);
end if;
end Begin_Block_Map;
-- unmaps backing memory map
procedure End_Block_Map (This : access Output_Stream_T) is
use type Uchar.Pointer;
begin
pragma Assert (This.Block_Map_Mode);
This.Block_Map_Mode := False;
if Invalid_Pointer /= This.Client_Base then
MMap_Unmap (This.Client_Base, This.Client_EOF);
end if;
end End_Block_Map;
function Map
(This : access Output_Stream_T;
Size : Types.v64) return Sub_Stream
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Result : Sub_Stream;
begin
pragma Assert (This.Block_Map_Mode);
Result :=
new Sub_Stream_T'
(Map => This.Client_Map,
Base => This.Client_Map,
EOF => This.Client_Map + C.ptrdiff_t (Size));
This.Client_Map := Result.EOF;
return Result;
end Map;
procedure Close (This : access Output_Stream_T) is
type S is access all Output_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Output_Stream_T, S);
D : S := S (This);
Exit_Code : Integer;
begin
-- do Pending Writes
Flush_Buffer (This);
Exit_Code := Interfaces.C_Streams.fclose (This.File);
Delete (D);
end Close;
procedure Close (This : access Sub_Stream_T) is
type S is access all Sub_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Sub_Stream_T, S);
D : S := S (This);
begin
Delete (D);
end Close;
function Position (This : access Output_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return This.Bytes_Written + Types.v64 (This.Map - This.Base);
end Position;
function Position (This : access Sub_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return Types.v64 (This.Map - This.Base);
end Position;
function Remaining_Bytes
(This : access Abstract_Stream'Class) return Skill.Types.v64
is
use type Map_Pointer;
begin
return Types.v64 (This.EOF - This.Map);
end Remaining_Bytes;
function Eof (This : access Sub_Stream_T) return Boolean is
use C;
function Cast is new Ada.Unchecked_Conversion (Uchar.Pointer, Types.i64);
use type Interfaces.Integer_64;
begin
return Cast (This.Map) >= Cast (This.EOF);
end Eof;
procedure Advance (P : in out Map_Pointer) is
use C;
use Uchar;
use System.Storage_Elements;
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + 1));
end Advance;
pragma Inline_Always (Advance);
procedure Advance
(P : in out Map_Pointer;
Diff : System.Storage_Elements.Storage_Offset)
is
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + Diff));
end Advance;
procedure Ensure_Size
(This : not null access Output_Stream_T;
V : C.ptrdiff_t)
is
use type Map_Pointer;
use type C.ptrdiff_t;
use type C_Streams.size_t;
begin
if This.EOF - This.Map < 1 + V then
Flush_Buffer (This);
end if;
end Ensure_Size;
function Cast is new Ada.Unchecked_Conversion (Types.i8, C.unsigned_char);
procedure I8 (This : access Output_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (1);
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure I8 (This : access Sub_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := This.Map;
begin
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure Bool (This : access Sub_Stream_T; V : Boolean) is
P : Map_Pointer := This.Map;
begin
if V then
P.all := 16#ff#;
else
P.all := 0;
end if;
Advance (P);
This.Map := P;
end Bool;
procedure I16 (This : access Output_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (2);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I16 (This : access Sub_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I32 (This : access Output_Stream_T; V : Skill.Types.i32) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (4);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I32 (This : access Sub_Stream_T; V : Skill.Types.i32) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I64 (This : access Output_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (8);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure I64 (This : access Sub_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure F32 (This : access Sub_Stream_T; V : Skill.Types.F32) is
function Cast is new Ada.Unchecked_Conversion (Types.F32, Types.i32);
begin
This.I32 (Cast (V));
end F32;
procedure F64 (This : access Sub_Stream_T; V : Skill.Types.F64) is
function Cast is new Ada.Unchecked_Conversion (Types.F64, Types.i64);
begin
This.I64 (Cast (V));
end F64;
function To_Byte is new Ada.Unchecked_Conversion
(Skill.Types.Uv64,
C.unsigned_char);
procedure V64 (This : access Output_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (9);
P := This.Map;
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
procedure V64 (This : access Sub_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := This.Map;
begin
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
use type Interfaces.C.Ptrdiff_T;
function Cast is new Ada.Unchecked_Conversion (Character, C.unsigned_char);
procedure Put_Plain_String
(This : access Output_Stream_T;
V : Skill.Types.String_Access)
is
P : Map_Pointer := Invalid_Pointer;
begin
if(V.all'Length >= Buffer_Size) then
Flush_Buffer (This);
declare
use C_Streams;
use C.Strings;
Str : chars_ptr := New_String(V.all);
function Convert is new Ada.Unchecked_Conversion(Chars_Ptr, Voids);
Length : Size_T := Size_T(Strlen(Str));
use type Size_T;
begin
if Length /=
Interfaces.C_Streams.fwrite
(Convert(Str),
1,
Length,
This.File)
then
Free(Str);
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
Free(Str);
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
end;
else
This.Ensure_Size (V.all'Length);
P := This.Map;
for C of V.all loop
P.all := Cast (C);
Advance (P);
end loop;
This.Map := P;
end if;
end Put_Plain_String;
end Skill.Streams.Writer;
|
5833
|
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ stream to skill tokens --
-- |___/_|\_\_|_|____| by: <NAME>, <NAME> --
-- --
pragma Ada_2012;
with Ada.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces;
with Skill.Types;
with Interfaces.C.Strings;
with System;
with Skill.Errors;
with Interfaces.C_Streams;
with System.Storage_Elements;
with System.Address_To_Access_Conversions;
with System.Address_Image;
package body Skill.Streams.Writer is
use Skill;
use Interfaces;
use type System.Address;
--- common type conversions ---
-- @note they are required at this level, because otherwise inlining will crash
function Cast is new Ada.Unchecked_Conversion (Types.v64, Types.Uv64);
package Casts is new System.Address_To_Access_Conversions (C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
function Open
(Path : not null Types.String_Access;
Mode : String) return Output_Stream
is
F : Interfaces.C_Streams.FILEs :=
C_Streams.fopen (C.To_C (Path.all)'Address, Mode'Address);
R : Output_Stream;
-- throwaway value required by ada ...
U : Integer;
use System.Storage_Elements;
begin
if C_Streams.NULL_Stream = F then
raise Skill.Errors.Skill_Error
with "failed to write file: " & Path.all;
end if;
U := C_Streams.Fseek(F, 0, C_Streams.SEEK_END);
R :=
new Output_Stream_T'
(Path => Path,
File => F,
Map => Invalid_Pointer,
Base => Invalid_Pointer,
EOF => Invalid_Pointer,
Bytes_Written => Types.V64(C_Streams.Ftell(F)),
Buffer => <>,
Block_Map_Mode => False,
Client_Map => Invalid_Pointer,
Client_Base => Invalid_Pointer,
Client_EOF => Invalid_Pointer);
R.Map := Convert (Casts.To_Pointer (R.Buffer'Address));
R.Base := Convert (Casts.To_Pointer (R.Buffer'Address));
R.EOF := Convert (Casts.To_Pointer (R.Buffer'Address + 1024));
return R;
end Open;
procedure Flush_Buffer (This : access Output_Stream_T) is
use type Map_Pointer;
use type C_Streams.size_t;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
Length : C_Streams.size_t := C_Streams.size_t (This.Map - This.Base);
begin
if 0 /= Length then
if Length /=
Interfaces.C_Streams.fwrite
(Casts.To_Address (Convert (This.Base)),
1,
Length,
This.File)
then
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
This.Map := This.Base;
end if;
end Flush_Buffer;
-- creates a map for a block and enables usage of map function
procedure Begin_Block_Map
(This : access Output_Stream_T;
Size : Types.v64)
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Map : Uchar.Pointer;
begin
pragma Assert (not This.Block_Map_Mode);
This.Block_Map_Mode := True;
-- Save Our Buffer To Disk
Flush_Buffer (This);
if 0 = Size then
This.Client_Map := Invalid_Pointer;
This.Client_Base := Invalid_Pointer;
This.Client_EOF := Invalid_Pointer;
else
Map := MMap_Write_Map (This.File, Size) + C.ptrdiff_t (This.Position);
if null = Map then
raise Skill.Errors.Skill_Error
with "failed to create map of size" &
Long_Long_Integer'Image (Long_Long_Integer (Size)) &
" in file: " &
This.Path.all;
end if;
-- Advance File Pointer
-- @Note: File Position Was Updated By C Code
This.Bytes_Written := This.Bytes_Written + Size;
This.Client_Map := Map_Pointer (Map);
This.Client_Base := Map_Pointer (Map);
This.Client_EOF := Map_Pointer (Map) + C.ptrdiff_t (Size);
end if;
end Begin_Block_Map;
-- unmaps backing memory map
procedure End_Block_Map (This : access Output_Stream_T) is
use type Uchar.Pointer;
begin
pragma Assert (This.Block_Map_Mode);
This.Block_Map_Mode := False;
if Invalid_Pointer /= This.Client_Base then
MMap_Unmap (This.Client_Base, This.Client_EOF);
end if;
end End_Block_Map;
function Map
(This : access Output_Stream_T;
Size : Types.v64) return Sub_Stream
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Result : Sub_Stream;
begin
pragma Assert (This.Block_Map_Mode);
Result :=
new Sub_Stream_T'
(Map => This.Client_Map,
Base => This.Client_Map,
EOF => This.Client_Map + C.ptrdiff_t (Size));
This.Client_Map := Result.EOF;
return Result;
end Map;
procedure Close (This : access Output_Stream_T) is
type S is access all Output_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Output_Stream_T, S);
D : S := S (This);
Exit_Code : Integer;
begin
-- do Pending Writes
Flush_Buffer (This);
Exit_Code := Interfaces.C_Streams.fclose (This.File);
Delete (D);
end Close;
procedure Close (This : access Sub_Stream_T) is
type S is access all Sub_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Sub_Stream_T, S);
D : S := S (This);
begin
Delete (D);
end Close;
function Position (This : access Output_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return This.Bytes_Written + Types.v64 (This.Map - This.Base);
end Position;
function Position (This : access Sub_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return Types.v64 (This.Map - This.Base);
end Position;
function Remaining_Bytes
(This : access Abstract_Stream'Class) return Skill.Types.v64
is
use type Map_Pointer;
begin
return Types.v64 (This.EOF - This.Map);
end Remaining_Bytes;
function Eof (This : access Sub_Stream_T) return Boolean is
use C;
function Cast is new Ada.Unchecked_Conversion (Uchar.Pointer, Types.i64);
use type Interfaces.Integer_64;
begin
return Cast (This.Map) >= Cast (This.EOF);
end Eof;
procedure Advance (P : in out Map_Pointer) is
use C;
use Uchar;
use System.Storage_Elements;
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + 1));
end Advance;
pragma Inline_Always (Advance);
procedure Advance
(P : in out Map_Pointer;
Diff : System.Storage_Elements.Storage_Offset)
is
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + Diff));
end Advance;
procedure Ensure_Size
(This : not null access Output_Stream_T;
V : C.ptrdiff_t)
is
use type Map_Pointer;
use type C.ptrdiff_t;
use type C_Streams.size_t;
begin
if This.EOF - This.Map < 1 + V then
Flush_Buffer (This);
end if;
end Ensure_Size;
function Cast is new Ada.Unchecked_Conversion (Types.i8, C.unsigned_char);
procedure I8 (This : access Output_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (1);
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure I8 (This : access Sub_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := This.Map;
begin
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure Bool (This : access Sub_Stream_T; V : Boolean) is
P : Map_Pointer := This.Map;
begin
if V then
P.all := 16#ff#;
else
P.all := 0;
end if;
Advance (P);
This.Map := P;
end Bool;
procedure I16 (This : access Output_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (2);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I16 (This : access Sub_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I32 (This : access Output_Stream_T; V : Skill.Types.i32) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (4);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I32 (This : access Sub_Stream_T; V : Skill.Types.i32) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I64 (This : access Output_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (8);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure I64 (This : access Sub_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure F32 (This : access Sub_Stream_T; V : Skill.Types.F32) is
function Cast is new Ada.Unchecked_Conversion (Types.F32, Types.i32);
begin
This.I32 (Cast (V));
end F32;
procedure F64 (This : access Sub_Stream_T; V : Skill.Types.F64) is
function Cast is new Ada.Unchecked_Conversion (Types.F64, Types.i64);
begin
This.I64 (Cast (V));
end F64;
function To_Byte is new Ada.Unchecked_Conversion
(Skill.Types.Uv64,
C.unsigned_char);
procedure V64 (This : access Output_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (9);
P := This.Map;
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
procedure V64 (This : access Sub_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := This.Map;
begin
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
use type Interfaces.C.Ptrdiff_T;
function Cast is new Ada.Unchecked_Conversion (Character, C.unsigned_char);
procedure Put_Plain_String
(This : access Output_Stream_T;
V : Skill.Types.String_Access)
is
P : Map_Pointer := Invalid_Pointer;
begin
if(V.all'Length >= Buffer_Size) then
Flush_Buffer (This);
declare
use C_Streams;
use C.Strings;
Str : chars_ptr := New_String(V.all);
function Convert is new Ada.Unchecked_Conversion(Chars_Ptr, Voids);
Length : Size_T := Size_T(Strlen(Str));
use type Size_T;
begin
if Length /=
Interfaces.C_Streams.fwrite
(Convert(Str),
1,
Length,
This.File)
then
Free(Str);
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
Free(Str);
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
end;
else
This.Ensure_Size (V.all'Length);
P := This.Map;
for C of V.all loop
P.all := Cast (C);
Advance (P);
end loop;
This.Map := P;
end if;
end Put_Plain_String;
end Skill.Streams.Writer;
| true |
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ stream to skill tokens --
-- |___/_|\_\_|_|____| by: PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI --
-- --
pragma Ada_2012;
with Ada.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces;
with Skill.Types;
with Interfaces.C.Strings;
with System;
with Skill.Errors;
with Interfaces.C_Streams;
with System.Storage_Elements;
with System.Address_To_Access_Conversions;
with System.Address_Image;
package body Skill.Streams.Writer is
use Skill;
use Interfaces;
use type System.Address;
--- common type conversions ---
-- @note they are required at this level, because otherwise inlining will crash
function Cast is new Ada.Unchecked_Conversion (Types.v64, Types.Uv64);
package Casts is new System.Address_To_Access_Conversions (C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
function Open
(Path : not null Types.String_Access;
Mode : String) return Output_Stream
is
F : Interfaces.C_Streams.FILEs :=
C_Streams.fopen (C.To_C (Path.all)'Address, Mode'Address);
R : Output_Stream;
-- throwaway value required by ada ...
U : Integer;
use System.Storage_Elements;
begin
if C_Streams.NULL_Stream = F then
raise Skill.Errors.Skill_Error
with "failed to write file: " & Path.all;
end if;
U := C_Streams.Fseek(F, 0, C_Streams.SEEK_END);
R :=
new Output_Stream_T'
(Path => Path,
File => F,
Map => Invalid_Pointer,
Base => Invalid_Pointer,
EOF => Invalid_Pointer,
Bytes_Written => Types.V64(C_Streams.Ftell(F)),
Buffer => <>,
Block_Map_Mode => False,
Client_Map => Invalid_Pointer,
Client_Base => Invalid_Pointer,
Client_EOF => Invalid_Pointer);
R.Map := Convert (Casts.To_Pointer (R.Buffer'Address));
R.Base := Convert (Casts.To_Pointer (R.Buffer'Address));
R.EOF := Convert (Casts.To_Pointer (R.Buffer'Address + 1024));
return R;
end Open;
procedure Flush_Buffer (This : access Output_Stream_T) is
use type Map_Pointer;
use type C_Streams.size_t;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
Length : C_Streams.size_t := C_Streams.size_t (This.Map - This.Base);
begin
if 0 /= Length then
if Length /=
Interfaces.C_Streams.fwrite
(Casts.To_Address (Convert (This.Base)),
1,
Length,
This.File)
then
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
This.Map := This.Base;
end if;
end Flush_Buffer;
-- creates a map for a block and enables usage of map function
procedure Begin_Block_Map
(This : access Output_Stream_T;
Size : Types.v64)
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Map : Uchar.Pointer;
begin
pragma Assert (not This.Block_Map_Mode);
This.Block_Map_Mode := True;
-- Save Our Buffer To Disk
Flush_Buffer (This);
if 0 = Size then
This.Client_Map := Invalid_Pointer;
This.Client_Base := Invalid_Pointer;
This.Client_EOF := Invalid_Pointer;
else
Map := MMap_Write_Map (This.File, Size) + C.ptrdiff_t (This.Position);
if null = Map then
raise Skill.Errors.Skill_Error
with "failed to create map of size" &
Long_Long_Integer'Image (Long_Long_Integer (Size)) &
" in file: " &
This.Path.all;
end if;
-- Advance File Pointer
-- @Note: File Position Was Updated By C Code
This.Bytes_Written := This.Bytes_Written + Size;
This.Client_Map := Map_Pointer (Map);
This.Client_Base := Map_Pointer (Map);
This.Client_EOF := Map_Pointer (Map) + C.ptrdiff_t (Size);
end if;
end Begin_Block_Map;
-- unmaps backing memory map
procedure End_Block_Map (This : access Output_Stream_T) is
use type Uchar.Pointer;
begin
pragma Assert (This.Block_Map_Mode);
This.Block_Map_Mode := False;
if Invalid_Pointer /= This.Client_Base then
MMap_Unmap (This.Client_Base, This.Client_EOF);
end if;
end End_Block_Map;
function Map
(This : access Output_Stream_T;
Size : Types.v64) return Sub_Stream
is
use type Uchar.Pointer;
use type Interfaces.Integer_64;
Result : Sub_Stream;
begin
pragma Assert (This.Block_Map_Mode);
Result :=
new Sub_Stream_T'
(Map => This.Client_Map,
Base => This.Client_Map,
EOF => This.Client_Map + C.ptrdiff_t (Size));
This.Client_Map := Result.EOF;
return Result;
end Map;
procedure Close (This : access Output_Stream_T) is
type S is access all Output_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Output_Stream_T, S);
D : S := S (This);
Exit_Code : Integer;
begin
-- do Pending Writes
Flush_Buffer (This);
Exit_Code := Interfaces.C_Streams.fclose (This.File);
Delete (D);
end Close;
procedure Close (This : access Sub_Stream_T) is
type S is access all Sub_Stream_T;
procedure Delete is new Ada.Unchecked_Deallocation (Sub_Stream_T, S);
D : S := S (This);
begin
Delete (D);
end Close;
function Position (This : access Output_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return This.Bytes_Written + Types.v64 (This.Map - This.Base);
end Position;
function Position (This : access Sub_Stream_T) return Skill.Types.v64 is
use type Map_Pointer;
begin
return Types.v64 (This.Map - This.Base);
end Position;
function Remaining_Bytes
(This : access Abstract_Stream'Class) return Skill.Types.v64
is
use type Map_Pointer;
begin
return Types.v64 (This.EOF - This.Map);
end Remaining_Bytes;
function Eof (This : access Sub_Stream_T) return Boolean is
use C;
function Cast is new Ada.Unchecked_Conversion (Uchar.Pointer, Types.i64);
use type Interfaces.Integer_64;
begin
return Cast (This.Map) >= Cast (This.EOF);
end Eof;
procedure Advance (P : in out Map_Pointer) is
use C;
use Uchar;
use System.Storage_Elements;
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + 1));
end Advance;
pragma Inline_Always (Advance);
procedure Advance
(P : in out Map_Pointer;
Diff : System.Storage_Elements.Storage_Offset)
is
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
begin
P := Convert (Casts.To_Pointer (Casts.To_Address (Convert (P)) + Diff));
end Advance;
procedure Ensure_Size
(This : not null access Output_Stream_T;
V : C.ptrdiff_t)
is
use type Map_Pointer;
use type C.ptrdiff_t;
use type C_Streams.size_t;
begin
if This.EOF - This.Map < 1 + V then
Flush_Buffer (This);
end if;
end Ensure_Size;
function Cast is new Ada.Unchecked_Conversion (Types.i8, C.unsigned_char);
procedure I8 (This : access Output_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (1);
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure I8 (This : access Sub_Stream_T; V : Skill.Types.i8) is
P : Map_Pointer := This.Map;
begin
P := This.Map;
P.all := Cast (V);
Advance (P);
This.Map := P;
end I8;
procedure Bool (This : access Sub_Stream_T; V : Boolean) is
P : Map_Pointer := This.Map;
begin
if V then
P.all := 16#ff#;
else
P.all := 0;
end if;
Advance (P);
This.Map := P;
end Bool;
procedure I16 (This : access Output_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (2);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I16 (This : access Sub_Stream_T; V : Skill.Types.i16) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_16,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i16, Unsigned_16);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I16;
procedure I32 (This : access Output_Stream_T; V : Skill.Types.i32) is
pragma Warnings (Off);
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (4);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I32 (This : access Sub_Stream_T; V : Skill.Types.i32) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_32,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i32, Unsigned_32);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I32;
procedure I64 (This : access Output_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (8);
P := This.Map;
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure I64 (This : access Sub_Stream_T; V : Skill.Types.i64) is
use C;
use Uchar;
function Cast is new Ada.Unchecked_Conversion
(Unsigned_64,
C.unsigned_char);
function Cast is new Ada.Unchecked_Conversion (Types.i64, Unsigned_64);
P : Map_Pointer := This.Map;
begin
P.all := Cast (Interfaces.Shift_Right (Cast (V), 56));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 48));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 40));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 32));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 24));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 16));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 8));
Advance (P);
P.all := Cast (Interfaces.Shift_Right (Cast (V), 0));
Advance (P);
This.Map := P;
end I64;
procedure F32 (This : access Sub_Stream_T; V : Skill.Types.F32) is
function Cast is new Ada.Unchecked_Conversion (Types.F32, Types.i32);
begin
This.I32 (Cast (V));
end F32;
procedure F64 (This : access Sub_Stream_T; V : Skill.Types.F64) is
function Cast is new Ada.Unchecked_Conversion (Types.F64, Types.i64);
begin
This.I64 (Cast (V));
end F64;
function To_Byte is new Ada.Unchecked_Conversion
(Skill.Types.Uv64,
C.unsigned_char);
procedure V64 (This : access Output_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := Invalid_Pointer;
begin
This.Ensure_Size (9);
P := This.Map;
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
procedure V64 (This : access Sub_Stream_T; Value : Skill.Types.v64) is
V : Types.Uv64 := Cast (Value);
use C;
use Uchar;
use System.Storage_Elements;
package Casts is new System.Address_To_Access_Conversions
(C.unsigned_char);
function Convert is new Ada.Unchecked_Conversion
(Interfaces.C.unsigned_char,
Skill.Types.i8);
function Convert is new Ada.Unchecked_Conversion
(Casts.Object_Pointer,
Map_Pointer);
function Convert is new Ada.Unchecked_Conversion
(Map_Pointer,
Casts.Object_Pointer);
P : Map_Pointer := This.Map;
begin
if 0 = (V and 16#FFFFFFFFFFFFFF80#) then
P.all := To_Byte (V);
Advance (P);
else
P.all := To_Byte (16#80# or V);
Advance (P);
if 0 = (V and 16#FFFFFFFFFFFFC000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 7));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 7));
Advance (P);
if 0 = (V and 16#FFFFFFFFFFE00000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 14));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 14));
Advance (P);
if 0 = (V and 16#FFFFFFFFF0000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 21));
Advance (P);
else
P.all := To_Byte (16#80# or Interfaces.Shift_Right (V, 21));
Advance (P);
if 0 = (V and 16#FFFFFFF800000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 28));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 28));
Advance (P);
if 0 = (V and 16#FFFFFC0000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 35));
Advance (P);
else
P.all :=
To_Byte (16#80# or Interfaces.Shift_Right (V, 35));
Advance (P);
if 0 = (V and 16#FFFE000000000000#) then
P.all := To_Byte (Interfaces.Shift_Right (V, 42));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 42));
Advance (P);
if 0 = (V and 16#FF00000000000000#) then
P.all :=
To_Byte (Interfaces.Shift_Right (V, 49));
Advance (P);
else
P.all :=
To_Byte
(16#80# or Interfaces.Shift_Right (V, 49));
Advance (P);
P.all :=
To_Byte (Interfaces.Shift_Right (V, 56));
Advance (P);
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
This.Map := P;
end V64;
use type Interfaces.C.Ptrdiff_T;
function Cast is new Ada.Unchecked_Conversion (Character, C.unsigned_char);
procedure Put_Plain_String
(This : access Output_Stream_T;
V : Skill.Types.String_Access)
is
P : Map_Pointer := Invalid_Pointer;
begin
if(V.all'Length >= Buffer_Size) then
Flush_Buffer (This);
declare
use C_Streams;
use C.Strings;
Str : chars_ptr := New_String(V.all);
function Convert is new Ada.Unchecked_Conversion(Chars_Ptr, Voids);
Length : Size_T := Size_T(Strlen(Str));
use type Size_T;
begin
if Length /=
Interfaces.C_Streams.fwrite
(Convert(Str),
1,
Length,
This.File)
then
Free(Str);
raise Skill.Errors.Skill_Error
with "something went sideways while flushing a buffer";
end if;
Free(Str);
This.Bytes_Written := This.Bytes_Written + Types.v64 (Length);
end;
else
This.Ensure_Size (V.all'Length);
P := This.Map;
for C of V.all loop
P.all := Cast (C);
Advance (P);
end loop;
This.Map := P;
end if;
end Put_Plain_String;
end Skill.Streams.Writer;
|
[
{
"context": "-----------------\n-- Copyright (C) 2010-2020 by <[email protected]> --\n-- ",
"end": 127,
"score": 0.9999297857284546,
"start": 105,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
test/tests.adb
|
Jellix/virtual_clocks
| 0 |
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by <[email protected]> --
-- --
-- This work is free. You can redistribute it and/or modify it under --
-- the terms of the Do What The Fuck You Want To Public License, --
-- Version 2, as published by Sam Hocevar. See the LICENSE file for --
-- more details. --
------------------------------------------------------------------------
pragma License (Unrestricted);
with Test_Clocks;
------------------------------------------------------------------------
-- Tests
------------------------------------------------------------------------
procedure Tests is
begin
Test_Clocks.Run;
end Tests;
|
29589
|
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by <<EMAIL>> --
-- --
-- This work is free. You can redistribute it and/or modify it under --
-- the terms of the Do What The Fuck You Want To Public License, --
-- Version 2, as published by Sam Hocevar. See the LICENSE file for --
-- more details. --
------------------------------------------------------------------------
pragma License (Unrestricted);
with Test_Clocks;
------------------------------------------------------------------------
-- Tests
------------------------------------------------------------------------
procedure Tests is
begin
Test_Clocks.Run;
end Tests;
| true |
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by <PI:EMAIL:<EMAIL>END_PI> --
-- --
-- This work is free. You can redistribute it and/or modify it under --
-- the terms of the Do What The Fuck You Want To Public License, --
-- Version 2, as published by Sam Hocevar. See the LICENSE file for --
-- more details. --
------------------------------------------------------------------------
pragma License (Unrestricted);
with Test_Clocks;
------------------------------------------------------------------------
-- Tests
------------------------------------------------------------------------
procedure Tests is
begin
Test_Clocks.Run;
end Tests;
|
[
{
"context": "u est issue\n -- d'un papier de recherche de Kaspar FISCHER\n -- nommé Piecewise Linear Approximation o",
"end": 4482,
"score": 0.9998449683189392,
"start": 4468,
"tag": "NAME",
"value": "Kaspar FISCHER"
}
] |
src/interpolations_lineaires.adb
|
SKNZ/BezierToSTL
| 0 |
with Helper; use Helper;
with Ada.Text_IO; use Ada.Text_IO;
package body Interpolations_Lineaires is
-- Interpole toutes les courbes d'une liste
procedure Interpolation_Lineaire(
Courbes : Liste_Courbes.Liste;
Segments : in out Liste;
Nombre_Points : Positive;
Interpoler_Droites : Boolean := False;
Utiliser_DeCasteljau : Boolean := False;
Tolerance_DeCasteljau : Tolerance := 0.5)
is
-- Instanciation du package de l'interpolateur avec les bons paramètres
package Interpolateur is new Visiteur_Interpolateur
(Segments,
Nombre_Points,
Interpoler_Droites,
Utiliser_DeCasteljau,
Tolerance_DeCasteljau);
-- Instanciation du visiteur même
V : Interpolateur.Interpolateur_Lineaire;
procedure Interpoler_Helper (C : in out Courbe_Ptr) is
begin
-- On fait visiter la courbe par l'interpolateur
C.Accepter (V);
end;
-- Générique permettant d'appliquer le helper à la liste
procedure Traiter_Liste is new Liste_Courbes.Parcourir(Traiter => Interpoler_Helper);
begin
Debug("Courbes à traiter: " & Integer'Image(Liste_Courbes.Taille(Courbes)));
Debug("Paramétrage:");
Debug("- Nombre de points: " & Integer'Image(Nombre_Points));
Debug("- Interpolation manuelle des droites: " & (if Interpoler_Droites then "oui" else "non"));
Debug("- Algorithme de De Casteljau: " & (if Utiliser_DeCasteljau then "actif" else "inactif"));
if Utiliser_DeCasteljau then
Debug("- Tolérance pour De Casteljau: " & Float'Image(Tolerance_DeCasteljau));
end if;
if Utiliser_DeCasteljau and then Interpoler_Droites then
New_Line;
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!! De Casteljau & Interpolation Manuelle ON !!!");
Put_Line("!!!!!!!!!!!!!!!! PAS RECOMMANDÉ !!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
New_Line;
end if;
Debug;
-- Appel de l'helper sur chaque courbe
Traiter_Liste(Courbes);
Debug("Fin interpolation");
Debug;
end;
-- Param génériques: Segments (Liste_Points), Nombre_Points (Positive)
package body Visiteur_Interpolateur is
-- Interpolation linéaire d'une courbe en N points
overriding procedure Visiter(Self : Interpolateur_Lineaire; C : Courbe) is
-- Pas de l'interpolation
Pas : constant Float := 1.0 / float(Nombre_Points);
-- On récupère le class-wide
-- pour le redispatching
CC : constant Courbe'Class := C;
begin
for I in 0 .. Nombre_Points - 1 loop
declare
-- Et la bim, redispatching !
P : constant Point2D := CC.Obtenir_Point(float(I) * Pas);
begin
-- On ajoute le point calculé à la fin
Insertion_Queue(Segments, P);
end;
end loop;
end;
-- Cas particulier : la droite
-- La droite n'a pas besoin d'être interpolée ici
-- Les logiciels d'affichage sont capables de les rendre sans interpoler
overriding procedure Visiter(Self : Interpolateur_Lineaire; D : Droite) is
begin
if Interpoler_Droites then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(D));
return;
end;
else
-- On n'enregistre que les deux points
-- de début et de fin
Insertion_Queue(Segments, D.Obtenir_Debut);
Insertion_Queue(Segments, D.Obtenir_Fin);
end if;
end;
-- Cas particulier : bezier cubique
-- Uniquement particulier si on utilise
-- l'algo de De Casteljau
-- RQ: La version De Casteljau est issue
-- d'un papier de recherche de Kaspar FISCHER
-- nommé Piecewise Linear Approximation of Bezier Curves
-- Le lien est dispo dans le README
-- Ceci en est juste une implémentation
overriding procedure Visiter(Self : Interpolateur_Lineaire; BC : Bezier_Cubique) is
begin
-- Remarque: cas d'utilisation pour pattern strategy
if not Utiliser_DeCasteljau then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(BC));
return;
end;
end if;
-- Le principe de la version de De Casteljau est:
-- On a une courbe de bezier quadratique.
-- Est elle "suffisamment plate" ?
-- Oui -> interpolation comme une droite
-- Sinon:
-- Division en deux courbes de Bezier cubiques
-- Dont la "somme" équivaut la première
-- On recommence l'algo sur ces deux courbes
-- Test "plate"
declare
U : Point2D :=
(3.0 * BC.Obtenir_Controle1
- 2.0 * BC.Obtenir_Debut
- BC.Obtenir_Fin) ** 2;
V : constant Point2D :=
(3.0 * BC.Obtenir_Controle2
- 2.0 * BC.Obtenir_Fin
- BC.Obtenir_Debut) ** 2;
begin
if U(U'First) < V(V'First) then
U(U'First) := V(V'First);
end if;
if U(U'Last) < V(V'Last) then
U(U'Last) := V(V'Last);
end if;
-- Si la courbe est dans les côtes
if U(U'First) + U(U'Last) <= 16.0 * (Tolerance_DeCasteljau ** 2) then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme une droite
CSelf.Visiter ( Ctor_Droite (BC.Obtenir_Debut, BC.Obtenir_Fin));
return;
end;
end if;
end;
declare
-- On divise notre courbe de Bezier
-- en deux courbes de Bezier plus simples
-- Une dite "gauche" et l'autre "droite"
Milieu_Controles : constant Point2D := (BC.Obtenir_Controle1 + BC.Obtenir_Controle2) / 2.0;
-- Gauche
Gauche_Debut : constant Point2D := BC.Obtenir_Debut;
Gauche_C1 : constant Point2D := (BC.Obtenir_Debut + BC.Obtenir_Controle1) / 2.0;
Gauche_C2 : constant Point2D := (Gauche_C1 + Milieu_Controles) / 2.0;
-- Droite
Droite_Fin : constant Point2D := BC.Obtenir_Fin;
Droite_C2 : constant Point2D := (BC.Obtenir_Fin + BC.Obtenir_Controle2) / 2.0;
Droite_C1 : constant Point2D := (Droite_C2 + Milieu_Controles) / 2.0;
-- Gauche Debut & Droite Fin
Gauche_Fin, Droite_Debut : constant Point2D := (Droite_C1 + Gauche_C2) / 2.0;
Gauche : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Gauche_Debut,
Gauche_Fin,
Gauche_C1,
Gauche_C2);
Droite : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Droite_Debut,
Droite_Fin,
Droite_C1,
Droite_C2);
begin
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- Algorithme récursif sur la portion gauche
CSelf.Visiter(Gauche);
-- Algorithme récursif sur la portion droite
CSelf.Visiter(Droite);
return;
end;
end;
end;
-- Cas particulier : le singleton
overriding procedure Visiter(Self : Interpolateur_Lineaire; S : Singleton) is
begin
-- Le singleton étant un point unique
-- On ajoute juste le point à la liste
Insertion_Queue(Segments, S.Obtenir_Debut);
end;
end Visiteur_Interpolateur;
end Interpolations_Lineaires;
|
8830
|
with Helper; use Helper;
with Ada.Text_IO; use Ada.Text_IO;
package body Interpolations_Lineaires is
-- Interpole toutes les courbes d'une liste
procedure Interpolation_Lineaire(
Courbes : Liste_Courbes.Liste;
Segments : in out Liste;
Nombre_Points : Positive;
Interpoler_Droites : Boolean := False;
Utiliser_DeCasteljau : Boolean := False;
Tolerance_DeCasteljau : Tolerance := 0.5)
is
-- Instanciation du package de l'interpolateur avec les bons paramètres
package Interpolateur is new Visiteur_Interpolateur
(Segments,
Nombre_Points,
Interpoler_Droites,
Utiliser_DeCasteljau,
Tolerance_DeCasteljau);
-- Instanciation du visiteur même
V : Interpolateur.Interpolateur_Lineaire;
procedure Interpoler_Helper (C : in out Courbe_Ptr) is
begin
-- On fait visiter la courbe par l'interpolateur
C.Accepter (V);
end;
-- Générique permettant d'appliquer le helper à la liste
procedure Traiter_Liste is new Liste_Courbes.Parcourir(Traiter => Interpoler_Helper);
begin
Debug("Courbes à traiter: " & Integer'Image(Liste_Courbes.Taille(Courbes)));
Debug("Paramétrage:");
Debug("- Nombre de points: " & Integer'Image(Nombre_Points));
Debug("- Interpolation manuelle des droites: " & (if Interpoler_Droites then "oui" else "non"));
Debug("- Algorithme de De Casteljau: " & (if Utiliser_DeCasteljau then "actif" else "inactif"));
if Utiliser_DeCasteljau then
Debug("- Tolérance pour De Casteljau: " & Float'Image(Tolerance_DeCasteljau));
end if;
if Utiliser_DeCasteljau and then Interpoler_Droites then
New_Line;
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!! De Casteljau & Interpolation Manuelle ON !!!");
Put_Line("!!!!!!!!!!!!!!!! PAS RECOMMANDÉ !!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
New_Line;
end if;
Debug;
-- Appel de l'helper sur chaque courbe
Traiter_Liste(Courbes);
Debug("Fin interpolation");
Debug;
end;
-- Param génériques: Segments (Liste_Points), Nombre_Points (Positive)
package body Visiteur_Interpolateur is
-- Interpolation linéaire d'une courbe en N points
overriding procedure Visiter(Self : Interpolateur_Lineaire; C : Courbe) is
-- Pas de l'interpolation
Pas : constant Float := 1.0 / float(Nombre_Points);
-- On récupère le class-wide
-- pour le redispatching
CC : constant Courbe'Class := C;
begin
for I in 0 .. Nombre_Points - 1 loop
declare
-- Et la bim, redispatching !
P : constant Point2D := CC.Obtenir_Point(float(I) * Pas);
begin
-- On ajoute le point calculé à la fin
Insertion_Queue(Segments, P);
end;
end loop;
end;
-- Cas particulier : la droite
-- La droite n'a pas besoin d'être interpolée ici
-- Les logiciels d'affichage sont capables de les rendre sans interpoler
overriding procedure Visiter(Self : Interpolateur_Lineaire; D : Droite) is
begin
if Interpoler_Droites then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(D));
return;
end;
else
-- On n'enregistre que les deux points
-- de début et de fin
Insertion_Queue(Segments, D.Obtenir_Debut);
Insertion_Queue(Segments, D.Obtenir_Fin);
end if;
end;
-- Cas particulier : bezier cubique
-- Uniquement particulier si on utilise
-- l'algo de De Casteljau
-- RQ: La version De Casteljau est issue
-- d'un papier de recherche de <NAME>
-- nommé Piecewise Linear Approximation of Bezier Curves
-- Le lien est dispo dans le README
-- Ceci en est juste une implémentation
overriding procedure Visiter(Self : Interpolateur_Lineaire; BC : Bezier_Cubique) is
begin
-- Remarque: cas d'utilisation pour pattern strategy
if not Utiliser_DeCasteljau then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(BC));
return;
end;
end if;
-- Le principe de la version de De Casteljau est:
-- On a une courbe de bezier quadratique.
-- Est elle "suffisamment plate" ?
-- Oui -> interpolation comme une droite
-- Sinon:
-- Division en deux courbes de Bezier cubiques
-- Dont la "somme" équivaut la première
-- On recommence l'algo sur ces deux courbes
-- Test "plate"
declare
U : Point2D :=
(3.0 * BC.Obtenir_Controle1
- 2.0 * BC.Obtenir_Debut
- BC.Obtenir_Fin) ** 2;
V : constant Point2D :=
(3.0 * BC.Obtenir_Controle2
- 2.0 * BC.Obtenir_Fin
- BC.Obtenir_Debut) ** 2;
begin
if U(U'First) < V(V'First) then
U(U'First) := V(V'First);
end if;
if U(U'Last) < V(V'Last) then
U(U'Last) := V(V'Last);
end if;
-- Si la courbe est dans les côtes
if U(U'First) + U(U'Last) <= 16.0 * (Tolerance_DeCasteljau ** 2) then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme une droite
CSelf.Visiter ( Ctor_Droite (BC.Obtenir_Debut, BC.Obtenir_Fin));
return;
end;
end if;
end;
declare
-- On divise notre courbe de Bezier
-- en deux courbes de Bezier plus simples
-- Une dite "gauche" et l'autre "droite"
Milieu_Controles : constant Point2D := (BC.Obtenir_Controle1 + BC.Obtenir_Controle2) / 2.0;
-- Gauche
Gauche_Debut : constant Point2D := BC.Obtenir_Debut;
Gauche_C1 : constant Point2D := (BC.Obtenir_Debut + BC.Obtenir_Controle1) / 2.0;
Gauche_C2 : constant Point2D := (Gauche_C1 + Milieu_Controles) / 2.0;
-- Droite
Droite_Fin : constant Point2D := BC.Obtenir_Fin;
Droite_C2 : constant Point2D := (BC.Obtenir_Fin + BC.Obtenir_Controle2) / 2.0;
Droite_C1 : constant Point2D := (Droite_C2 + Milieu_Controles) / 2.0;
-- Gauche Debut & Droite Fin
Gauche_Fin, Droite_Debut : constant Point2D := (Droite_C1 + Gauche_C2) / 2.0;
Gauche : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Gauche_Debut,
Gauche_Fin,
Gauche_C1,
Gauche_C2);
Droite : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Droite_Debut,
Droite_Fin,
Droite_C1,
Droite_C2);
begin
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- Algorithme récursif sur la portion gauche
CSelf.Visiter(Gauche);
-- Algorithme récursif sur la portion droite
CSelf.Visiter(Droite);
return;
end;
end;
end;
-- Cas particulier : le singleton
overriding procedure Visiter(Self : Interpolateur_Lineaire; S : Singleton) is
begin
-- Le singleton étant un point unique
-- On ajoute juste le point à la liste
Insertion_Queue(Segments, S.Obtenir_Debut);
end;
end Visiteur_Interpolateur;
end Interpolations_Lineaires;
| true |
with Helper; use Helper;
with Ada.Text_IO; use Ada.Text_IO;
package body Interpolations_Lineaires is
-- Interpole toutes les courbes d'une liste
procedure Interpolation_Lineaire(
Courbes : Liste_Courbes.Liste;
Segments : in out Liste;
Nombre_Points : Positive;
Interpoler_Droites : Boolean := False;
Utiliser_DeCasteljau : Boolean := False;
Tolerance_DeCasteljau : Tolerance := 0.5)
is
-- Instanciation du package de l'interpolateur avec les bons paramètres
package Interpolateur is new Visiteur_Interpolateur
(Segments,
Nombre_Points,
Interpoler_Droites,
Utiliser_DeCasteljau,
Tolerance_DeCasteljau);
-- Instanciation du visiteur même
V : Interpolateur.Interpolateur_Lineaire;
procedure Interpoler_Helper (C : in out Courbe_Ptr) is
begin
-- On fait visiter la courbe par l'interpolateur
C.Accepter (V);
end;
-- Générique permettant d'appliquer le helper à la liste
procedure Traiter_Liste is new Liste_Courbes.Parcourir(Traiter => Interpoler_Helper);
begin
Debug("Courbes à traiter: " & Integer'Image(Liste_Courbes.Taille(Courbes)));
Debug("Paramétrage:");
Debug("- Nombre de points: " & Integer'Image(Nombre_Points));
Debug("- Interpolation manuelle des droites: " & (if Interpoler_Droites then "oui" else "non"));
Debug("- Algorithme de De Casteljau: " & (if Utiliser_DeCasteljau then "actif" else "inactif"));
if Utiliser_DeCasteljau then
Debug("- Tolérance pour De Casteljau: " & Float'Image(Tolerance_DeCasteljau));
end if;
if Utiliser_DeCasteljau and then Interpoler_Droites then
New_Line;
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!! De Casteljau & Interpolation Manuelle ON !!!");
Put_Line("!!!!!!!!!!!!!!!! PAS RECOMMANDÉ !!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Put_Line("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
New_Line;
end if;
Debug;
-- Appel de l'helper sur chaque courbe
Traiter_Liste(Courbes);
Debug("Fin interpolation");
Debug;
end;
-- Param génériques: Segments (Liste_Points), Nombre_Points (Positive)
package body Visiteur_Interpolateur is
-- Interpolation linéaire d'une courbe en N points
overriding procedure Visiter(Self : Interpolateur_Lineaire; C : Courbe) is
-- Pas de l'interpolation
Pas : constant Float := 1.0 / float(Nombre_Points);
-- On récupère le class-wide
-- pour le redispatching
CC : constant Courbe'Class := C;
begin
for I in 0 .. Nombre_Points - 1 loop
declare
-- Et la bim, redispatching !
P : constant Point2D := CC.Obtenir_Point(float(I) * Pas);
begin
-- On ajoute le point calculé à la fin
Insertion_Queue(Segments, P);
end;
end loop;
end;
-- Cas particulier : la droite
-- La droite n'a pas besoin d'être interpolée ici
-- Les logiciels d'affichage sont capables de les rendre sans interpoler
overriding procedure Visiter(Self : Interpolateur_Lineaire; D : Droite) is
begin
if Interpoler_Droites then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(D));
return;
end;
else
-- On n'enregistre que les deux points
-- de début et de fin
Insertion_Queue(Segments, D.Obtenir_Debut);
Insertion_Queue(Segments, D.Obtenir_Fin);
end if;
end;
-- Cas particulier : bezier cubique
-- Uniquement particulier si on utilise
-- l'algo de De Casteljau
-- RQ: La version De Casteljau est issue
-- d'un papier de recherche de PI:NAME:<NAME>END_PI
-- nommé Piecewise Linear Approximation of Bezier Curves
-- Le lien est dispo dans le README
-- Ceci en est juste une implémentation
overriding procedure Visiter(Self : Interpolateur_Lineaire; BC : Bezier_Cubique) is
begin
-- Remarque: cas d'utilisation pour pattern strategy
if not Utiliser_DeCasteljau then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme n'importe quelle autre courbe
CSelf.Visiter(Courbe(BC));
return;
end;
end if;
-- Le principe de la version de De Casteljau est:
-- On a une courbe de bezier quadratique.
-- Est elle "suffisamment plate" ?
-- Oui -> interpolation comme une droite
-- Sinon:
-- Division en deux courbes de Bezier cubiques
-- Dont la "somme" équivaut la première
-- On recommence l'algo sur ces deux courbes
-- Test "plate"
declare
U : Point2D :=
(3.0 * BC.Obtenir_Controle1
- 2.0 * BC.Obtenir_Debut
- BC.Obtenir_Fin) ** 2;
V : constant Point2D :=
(3.0 * BC.Obtenir_Controle2
- 2.0 * BC.Obtenir_Fin
- BC.Obtenir_Debut) ** 2;
begin
if U(U'First) < V(V'First) then
U(U'First) := V(V'First);
end if;
if U(U'Last) < V(V'Last) then
U(U'Last) := V(V'Last);
end if;
-- Si la courbe est dans les côtes
if U(U'First) + U(U'Last) <= 16.0 * (Tolerance_DeCasteljau ** 2) then
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- On l'interpole comme une droite
CSelf.Visiter ( Ctor_Droite (BC.Obtenir_Debut, BC.Obtenir_Fin));
return;
end;
end if;
end;
declare
-- On divise notre courbe de Bezier
-- en deux courbes de Bezier plus simples
-- Une dite "gauche" et l'autre "droite"
Milieu_Controles : constant Point2D := (BC.Obtenir_Controle1 + BC.Obtenir_Controle2) / 2.0;
-- Gauche
Gauche_Debut : constant Point2D := BC.Obtenir_Debut;
Gauche_C1 : constant Point2D := (BC.Obtenir_Debut + BC.Obtenir_Controle1) / 2.0;
Gauche_C2 : constant Point2D := (Gauche_C1 + Milieu_Controles) / 2.0;
-- Droite
Droite_Fin : constant Point2D := BC.Obtenir_Fin;
Droite_C2 : constant Point2D := (BC.Obtenir_Fin + BC.Obtenir_Controle2) / 2.0;
Droite_C1 : constant Point2D := (Droite_C2 + Milieu_Controles) / 2.0;
-- Gauche Debut & Droite Fin
Gauche_Fin, Droite_Debut : constant Point2D := (Droite_C1 + Gauche_C2) / 2.0;
Gauche : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Gauche_Debut,
Gauche_Fin,
Gauche_C1,
Gauche_C2);
Droite : constant Bezier_Cubique := Ctor_Bezier_Cubique
(Droite_Debut,
Droite_Fin,
Droite_C1,
Droite_C2);
begin
declare
-- Redispatch
CSelf : constant Interpolateur_Lineaire'Class := Self;
begin
-- Algorithme récursif sur la portion gauche
CSelf.Visiter(Gauche);
-- Algorithme récursif sur la portion droite
CSelf.Visiter(Droite);
return;
end;
end;
end;
-- Cas particulier : le singleton
overriding procedure Visiter(Self : Interpolateur_Lineaire; S : Singleton) is
begin
-- Le singleton étant un point unique
-- On ajoute juste le point à la liste
Insertion_Queue(Segments, S.Obtenir_Debut);
end;
end Visiteur_Interpolateur;
end Interpolations_Lineaires;
|
[
{
"context": "nd then manually tidied up\n\n-- Copyright (c) 2015, James Humphry\n\n-- Derived from the original Lua work\n-- Copyrig",
"end": 185,
"score": 0.9998549222946167,
"start": 172,
"tag": "NAME",
"value": "James Humphry"
}
] |
internal/lua-auxinternal.ads
|
jhumphry/aLua
| 0 |
-- Lua.Interface
-- Contains the raw interfaces with the Lua auxiliary library written in C
-- Generated from lauxlib.h and then manually tidied up
-- Copyright (c) 2015, James Humphry
-- Derived from the original Lua work
-- Copyright (C) 1994-2015 Lua.org, PUC-Rio.
-- See LICENSE for details
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with Lua.Internal;
private package Lua.AuxInternal is
-- unsupported macro: LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
-- arg-macro: procedure luaL_checkversion (L)
-- luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
LUA_NOREF : constant := (-2); -- /usr/include/lauxlib.h:69
LUA_REFNIL : constant := (-1); -- /usr/include/lauxlib.h:70
-- arg-macro: procedure luaL_loadfile (L, f)
-- luaL_loadfilex(L,f,NULL)
-- arg-macro: procedure luaL_newlibtable (L, l)
-- lua_createtable(L, 0, sizeof(l)/sizeof((l)(0)) - 1)
-- arg-macro: function luaL_newlib (L, l)
-- return luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0);
-- arg-macro: function luaL_argcheck (L, cond, arg, e((void)((cond) or else luaL_argerror(L, (arg), (extramsg)))
-- return (void)((cond) or else luaL_argerror(L, (arg), (extramsg)));
-- arg-macro: function luaL_checkstring (L, n)
-- return luaL_checklstring(L, (n), NULL);
-- arg-macro: function luaL_optstring (L, n, d)
-- return luaL_optlstring(L, (n), (d), NULL);
-- arg-macro: procedure luaL_typename (L, i)
-- lua_typename(L, lua_type(L,(i)))
-- arg-macro: function luaL_dofile (L, fn)
-- return luaL_loadfile(L, fn) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_dostring (L, s)
-- return luaL_loadstring(L, s) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_getmetatable (L, n)
-- return lua_getfield(L, LUA_REGISTRYINDEX, (n));
-- arg-macro: function luaL_opt (L, f, n, d)
-- return lua_isnoneornil(L,(n)) ? (d) : f(L,(n));
-- arg-macro: procedure luaL_loadbuffer (L, s, sz, n)
-- luaL_loadbufferx(L,s,sz,n,NULL)
-- arg-macro: function luaL_addchar (B, c)
-- return (void)((B).n < (B).size or else luaL_prepbuffsize((B), 1)), ((B).b((B).n++) := (c));
-- arg-macro: function luaL_addsize (B, s)
-- return (B).n += (s);
-- arg-macro: procedure luaL_prepbuffer (B)
-- luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
LUA_FILEHANDLE : aliased constant String := "FILE*" & ASCII.NUL; -- /usr/include/lauxlib.h:182
-- arg-macro: procedure lua_writestring (s, l)
-- fwrite((s), sizeof(char), (l), stdout)
-- arg-macro: function lua_writeline ()
-- return lua_writestring("" & ASCII.LF & "", 1), fflush(stdout);
-- arg-macro: function lua_writestringerror (s, p)
-- return fprintf(stderr, (s), (p)), fflush(stderr);
type luaL_Reg is record
name : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:24
func : Internal.lua_CFunction; -- /usr/include/lauxlib.h:25
end record;
pragma Convention (C_Pass_By_Copy, luaL_Reg); -- /usr/include/lauxlib.h:23
procedure luaL_checkversion_u
(arg1 : System.Address;
arg2 : Internal.lua_Number;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:31
pragma Import (C, luaL_checkversion_u, "luaL_checkversion_");
function luaL_getmetafield
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:35
pragma Import (C, luaL_getmetafield, "luaL_getmetafield");
function luaL_callmeta
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:36
pragma Import (C, luaL_callmeta, "luaL_callmeta");
function luaL_tolstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:37
pragma Import (C, luaL_tolstring, "luaL_tolstring");
function luaL_argerror
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:38
pragma Import (C, luaL_argerror, "luaL_argerror");
function luaL_checklstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:39
pragma Import (C, luaL_checklstring, "luaL_checklstring");
function luaL_optlstring
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:41
pragma Import (C, luaL_optlstring, "luaL_optlstring");
function luaL_checknumber (arg1 : System.Address; arg2 : int) return Internal.lua_Number; -- /usr/include/lauxlib.h:43
pragma Import (C, luaL_checknumber, "luaL_checknumber");
function luaL_optnumber
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Number) return Internal.lua_Number; -- /usr/include/lauxlib.h:44
pragma Import (C, luaL_optnumber, "luaL_optnumber");
function luaL_checkinteger (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:46
pragma Import (C, luaL_checkinteger, "luaL_checkinteger");
function luaL_optinteger
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Integer) return Internal.lua_Integer; -- /usr/include/lauxlib.h:47
pragma Import (C, luaL_optinteger, "luaL_optinteger");
procedure luaL_checkstack
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:50
pragma Import (C, luaL_checkstack, "luaL_checkstack");
procedure luaL_checktype
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:51
pragma Import (C, luaL_checktype, "luaL_checktype");
procedure luaL_checkany (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:52
pragma Import (C, luaL_checkany, "luaL_checkany");
function luaL_newmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:54
pragma Import (C, luaL_newmetatable, "luaL_newmetatable");
procedure luaL_setmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:55
pragma Import (C, luaL_setmetatable, "luaL_setmetatable");
function luaL_testudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:56
pragma Import (C, luaL_testudata, "luaL_testudata");
function luaL_checkudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:57
pragma Import (C, luaL_checkudata, "luaL_checkudata");
procedure luaL_where (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:59
pragma Import (C, luaL_where, "luaL_where");
function luaL_error (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- /usr/include/lauxlib.h:60
pragma Import (C, luaL_error, "luaL_error");
function luaL_checkoption
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : System.Address) return int; -- /usr/include/lauxlib.h:62
pragma Import (C, luaL_checkoption, "luaL_checkoption");
function luaL_fileresult
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:65
pragma Import (C, luaL_fileresult, "luaL_fileresult");
function luaL_execresult (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:66
pragma Import (C, luaL_execresult, "luaL_execresult");
-- pre-defined references
function luaL_ref (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:72
pragma Import (C, luaL_ref, "luaL_ref");
procedure luaL_unref
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:73
pragma Import (C, luaL_unref, "luaL_unref");
function luaL_loadfilex
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:75
pragma Import (C, luaL_loadfilex, "luaL_loadfilex");
function luaL_loadbufferx
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:80
pragma Import (C, luaL_loadbufferx, "luaL_loadbufferx");
function luaL_loadstring (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:82
pragma Import (C, luaL_loadstring, "luaL_loadstring");
function luaL_newstate return System.Address; -- /usr/include/lauxlib.h:84
pragma Import (C, luaL_newstate, "luaL_newstate");
function luaL_len (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:86
pragma Import (C, luaL_len, "luaL_len");
function luaL_gsub
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:88
pragma Import (C, luaL_gsub, "luaL_gsub");
procedure luaL_setfuncs
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int); -- /usr/include/lauxlib.h:91
pragma Import (C, luaL_setfuncs, "luaL_setfuncs");
function luaL_getsubtable
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:93
pragma Import (C, luaL_getsubtable, "luaL_getsubtable");
procedure luaL_traceback
(arg1 : System.Address;
arg2 : System.Address;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : int); -- /usr/include/lauxlib.h:95
pragma Import (C, luaL_traceback, "luaL_traceback");
procedure luaL_requiref
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Internal.lua_CFunction;
arg4 : int); -- /usr/include/lauxlib.h:98
pragma Import (C, luaL_requiref, "luaL_requiref");
--** {======================================================
--** Generic Buffer manipulation
--** =======================================================
--
-- buffer address
subtype anon1660_anon1662_array is Interfaces.C.char_array (0 .. 8191);
type luaL_Buffer is record
b : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:141
size : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:142
n : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:143
L : System.Address; -- /usr/include/lauxlib.h:144
initb : aliased anon1660_anon1662_array; -- /usr/include/lauxlib.h:145
end record;
pragma Convention (C_Pass_By_Copy, luaL_Buffer); -- /usr/include/lauxlib.h:140
-- buffer size
-- number of characters in buffer
-- initial buffer
procedure luaL_buffinit (arg1 : System.Address; arg2 : access luaL_Buffer); -- /usr/include/lauxlib.h:155
pragma Import (C, luaL_buffinit, "luaL_buffinit");
function luaL_prepbuffsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:156
pragma Import (C, luaL_prepbuffsize, "luaL_prepbuffsize");
procedure luaL_addlstring
(arg1 : access luaL_Buffer;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:157
pragma Import (C, luaL_addlstring, "luaL_addlstring");
procedure luaL_addstring (arg1 : access luaL_Buffer; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:158
pragma Import (C, luaL_addstring, "luaL_addstring");
procedure luaL_addvalue (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:159
pragma Import (C, luaL_addvalue, "luaL_addvalue");
procedure luaL_pushresult (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:160
pragma Import (C, luaL_pushresult, "luaL_pushresult");
procedure luaL_pushresultsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:161
pragma Import (C, luaL_pushresultsize, "luaL_pushresultsize");
function luaL_buffinitsize
(arg1 : System.Address;
arg2 : access luaL_Buffer;
arg3 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:162
pragma Import (C, luaL_buffinitsize, "luaL_buffinitsize");
end Lua.AuxInternal;
|
28213
|
-- Lua.Interface
-- Contains the raw interfaces with the Lua auxiliary library written in C
-- Generated from lauxlib.h and then manually tidied up
-- Copyright (c) 2015, <NAME>
-- Derived from the original Lua work
-- Copyright (C) 1994-2015 Lua.org, PUC-Rio.
-- See LICENSE for details
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with Lua.Internal;
private package Lua.AuxInternal is
-- unsupported macro: LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
-- arg-macro: procedure luaL_checkversion (L)
-- luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
LUA_NOREF : constant := (-2); -- /usr/include/lauxlib.h:69
LUA_REFNIL : constant := (-1); -- /usr/include/lauxlib.h:70
-- arg-macro: procedure luaL_loadfile (L, f)
-- luaL_loadfilex(L,f,NULL)
-- arg-macro: procedure luaL_newlibtable (L, l)
-- lua_createtable(L, 0, sizeof(l)/sizeof((l)(0)) - 1)
-- arg-macro: function luaL_newlib (L, l)
-- return luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0);
-- arg-macro: function luaL_argcheck (L, cond, arg, e((void)((cond) or else luaL_argerror(L, (arg), (extramsg)))
-- return (void)((cond) or else luaL_argerror(L, (arg), (extramsg)));
-- arg-macro: function luaL_checkstring (L, n)
-- return luaL_checklstring(L, (n), NULL);
-- arg-macro: function luaL_optstring (L, n, d)
-- return luaL_optlstring(L, (n), (d), NULL);
-- arg-macro: procedure luaL_typename (L, i)
-- lua_typename(L, lua_type(L,(i)))
-- arg-macro: function luaL_dofile (L, fn)
-- return luaL_loadfile(L, fn) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_dostring (L, s)
-- return luaL_loadstring(L, s) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_getmetatable (L, n)
-- return lua_getfield(L, LUA_REGISTRYINDEX, (n));
-- arg-macro: function luaL_opt (L, f, n, d)
-- return lua_isnoneornil(L,(n)) ? (d) : f(L,(n));
-- arg-macro: procedure luaL_loadbuffer (L, s, sz, n)
-- luaL_loadbufferx(L,s,sz,n,NULL)
-- arg-macro: function luaL_addchar (B, c)
-- return (void)((B).n < (B).size or else luaL_prepbuffsize((B), 1)), ((B).b((B).n++) := (c));
-- arg-macro: function luaL_addsize (B, s)
-- return (B).n += (s);
-- arg-macro: procedure luaL_prepbuffer (B)
-- luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
LUA_FILEHANDLE : aliased constant String := "FILE*" & ASCII.NUL; -- /usr/include/lauxlib.h:182
-- arg-macro: procedure lua_writestring (s, l)
-- fwrite((s), sizeof(char), (l), stdout)
-- arg-macro: function lua_writeline ()
-- return lua_writestring("" & ASCII.LF & "", 1), fflush(stdout);
-- arg-macro: function lua_writestringerror (s, p)
-- return fprintf(stderr, (s), (p)), fflush(stderr);
type luaL_Reg is record
name : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:24
func : Internal.lua_CFunction; -- /usr/include/lauxlib.h:25
end record;
pragma Convention (C_Pass_By_Copy, luaL_Reg); -- /usr/include/lauxlib.h:23
procedure luaL_checkversion_u
(arg1 : System.Address;
arg2 : Internal.lua_Number;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:31
pragma Import (C, luaL_checkversion_u, "luaL_checkversion_");
function luaL_getmetafield
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:35
pragma Import (C, luaL_getmetafield, "luaL_getmetafield");
function luaL_callmeta
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:36
pragma Import (C, luaL_callmeta, "luaL_callmeta");
function luaL_tolstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:37
pragma Import (C, luaL_tolstring, "luaL_tolstring");
function luaL_argerror
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:38
pragma Import (C, luaL_argerror, "luaL_argerror");
function luaL_checklstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:39
pragma Import (C, luaL_checklstring, "luaL_checklstring");
function luaL_optlstring
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:41
pragma Import (C, luaL_optlstring, "luaL_optlstring");
function luaL_checknumber (arg1 : System.Address; arg2 : int) return Internal.lua_Number; -- /usr/include/lauxlib.h:43
pragma Import (C, luaL_checknumber, "luaL_checknumber");
function luaL_optnumber
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Number) return Internal.lua_Number; -- /usr/include/lauxlib.h:44
pragma Import (C, luaL_optnumber, "luaL_optnumber");
function luaL_checkinteger (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:46
pragma Import (C, luaL_checkinteger, "luaL_checkinteger");
function luaL_optinteger
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Integer) return Internal.lua_Integer; -- /usr/include/lauxlib.h:47
pragma Import (C, luaL_optinteger, "luaL_optinteger");
procedure luaL_checkstack
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:50
pragma Import (C, luaL_checkstack, "luaL_checkstack");
procedure luaL_checktype
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:51
pragma Import (C, luaL_checktype, "luaL_checktype");
procedure luaL_checkany (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:52
pragma Import (C, luaL_checkany, "luaL_checkany");
function luaL_newmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:54
pragma Import (C, luaL_newmetatable, "luaL_newmetatable");
procedure luaL_setmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:55
pragma Import (C, luaL_setmetatable, "luaL_setmetatable");
function luaL_testudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:56
pragma Import (C, luaL_testudata, "luaL_testudata");
function luaL_checkudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:57
pragma Import (C, luaL_checkudata, "luaL_checkudata");
procedure luaL_where (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:59
pragma Import (C, luaL_where, "luaL_where");
function luaL_error (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- /usr/include/lauxlib.h:60
pragma Import (C, luaL_error, "luaL_error");
function luaL_checkoption
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : System.Address) return int; -- /usr/include/lauxlib.h:62
pragma Import (C, luaL_checkoption, "luaL_checkoption");
function luaL_fileresult
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:65
pragma Import (C, luaL_fileresult, "luaL_fileresult");
function luaL_execresult (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:66
pragma Import (C, luaL_execresult, "luaL_execresult");
-- pre-defined references
function luaL_ref (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:72
pragma Import (C, luaL_ref, "luaL_ref");
procedure luaL_unref
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:73
pragma Import (C, luaL_unref, "luaL_unref");
function luaL_loadfilex
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:75
pragma Import (C, luaL_loadfilex, "luaL_loadfilex");
function luaL_loadbufferx
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:80
pragma Import (C, luaL_loadbufferx, "luaL_loadbufferx");
function luaL_loadstring (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:82
pragma Import (C, luaL_loadstring, "luaL_loadstring");
function luaL_newstate return System.Address; -- /usr/include/lauxlib.h:84
pragma Import (C, luaL_newstate, "luaL_newstate");
function luaL_len (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:86
pragma Import (C, luaL_len, "luaL_len");
function luaL_gsub
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:88
pragma Import (C, luaL_gsub, "luaL_gsub");
procedure luaL_setfuncs
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int); -- /usr/include/lauxlib.h:91
pragma Import (C, luaL_setfuncs, "luaL_setfuncs");
function luaL_getsubtable
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:93
pragma Import (C, luaL_getsubtable, "luaL_getsubtable");
procedure luaL_traceback
(arg1 : System.Address;
arg2 : System.Address;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : int); -- /usr/include/lauxlib.h:95
pragma Import (C, luaL_traceback, "luaL_traceback");
procedure luaL_requiref
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Internal.lua_CFunction;
arg4 : int); -- /usr/include/lauxlib.h:98
pragma Import (C, luaL_requiref, "luaL_requiref");
--** {======================================================
--** Generic Buffer manipulation
--** =======================================================
--
-- buffer address
subtype anon1660_anon1662_array is Interfaces.C.char_array (0 .. 8191);
type luaL_Buffer is record
b : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:141
size : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:142
n : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:143
L : System.Address; -- /usr/include/lauxlib.h:144
initb : aliased anon1660_anon1662_array; -- /usr/include/lauxlib.h:145
end record;
pragma Convention (C_Pass_By_Copy, luaL_Buffer); -- /usr/include/lauxlib.h:140
-- buffer size
-- number of characters in buffer
-- initial buffer
procedure luaL_buffinit (arg1 : System.Address; arg2 : access luaL_Buffer); -- /usr/include/lauxlib.h:155
pragma Import (C, luaL_buffinit, "luaL_buffinit");
function luaL_prepbuffsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:156
pragma Import (C, luaL_prepbuffsize, "luaL_prepbuffsize");
procedure luaL_addlstring
(arg1 : access luaL_Buffer;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:157
pragma Import (C, luaL_addlstring, "luaL_addlstring");
procedure luaL_addstring (arg1 : access luaL_Buffer; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:158
pragma Import (C, luaL_addstring, "luaL_addstring");
procedure luaL_addvalue (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:159
pragma Import (C, luaL_addvalue, "luaL_addvalue");
procedure luaL_pushresult (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:160
pragma Import (C, luaL_pushresult, "luaL_pushresult");
procedure luaL_pushresultsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:161
pragma Import (C, luaL_pushresultsize, "luaL_pushresultsize");
function luaL_buffinitsize
(arg1 : System.Address;
arg2 : access luaL_Buffer;
arg3 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:162
pragma Import (C, luaL_buffinitsize, "luaL_buffinitsize");
end Lua.AuxInternal;
| true |
-- Lua.Interface
-- Contains the raw interfaces with the Lua auxiliary library written in C
-- Generated from lauxlib.h and then manually tidied up
-- Copyright (c) 2015, PI:NAME:<NAME>END_PI
-- Derived from the original Lua work
-- Copyright (C) 1994-2015 Lua.org, PUC-Rio.
-- See LICENSE for details
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with Lua.Internal;
private package Lua.AuxInternal is
-- unsupported macro: LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
-- arg-macro: procedure luaL_checkversion (L)
-- luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
LUA_NOREF : constant := (-2); -- /usr/include/lauxlib.h:69
LUA_REFNIL : constant := (-1); -- /usr/include/lauxlib.h:70
-- arg-macro: procedure luaL_loadfile (L, f)
-- luaL_loadfilex(L,f,NULL)
-- arg-macro: procedure luaL_newlibtable (L, l)
-- lua_createtable(L, 0, sizeof(l)/sizeof((l)(0)) - 1)
-- arg-macro: function luaL_newlib (L, l)
-- return luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0);
-- arg-macro: function luaL_argcheck (L, cond, arg, e((void)((cond) or else luaL_argerror(L, (arg), (extramsg)))
-- return (void)((cond) or else luaL_argerror(L, (arg), (extramsg)));
-- arg-macro: function luaL_checkstring (L, n)
-- return luaL_checklstring(L, (n), NULL);
-- arg-macro: function luaL_optstring (L, n, d)
-- return luaL_optlstring(L, (n), (d), NULL);
-- arg-macro: procedure luaL_typename (L, i)
-- lua_typename(L, lua_type(L,(i)))
-- arg-macro: function luaL_dofile (L, fn)
-- return luaL_loadfile(L, fn) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_dostring (L, s)
-- return luaL_loadstring(L, s) or else lua_pcall(L, 0, LUA_MULTRET, 0);
-- arg-macro: function luaL_getmetatable (L, n)
-- return lua_getfield(L, LUA_REGISTRYINDEX, (n));
-- arg-macro: function luaL_opt (L, f, n, d)
-- return lua_isnoneornil(L,(n)) ? (d) : f(L,(n));
-- arg-macro: procedure luaL_loadbuffer (L, s, sz, n)
-- luaL_loadbufferx(L,s,sz,n,NULL)
-- arg-macro: function luaL_addchar (B, c)
-- return (void)((B).n < (B).size or else luaL_prepbuffsize((B), 1)), ((B).b((B).n++) := (c));
-- arg-macro: function luaL_addsize (B, s)
-- return (B).n += (s);
-- arg-macro: procedure luaL_prepbuffer (B)
-- luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
LUA_FILEHANDLE : aliased constant String := "FILE*" & ASCII.NUL; -- /usr/include/lauxlib.h:182
-- arg-macro: procedure lua_writestring (s, l)
-- fwrite((s), sizeof(char), (l), stdout)
-- arg-macro: function lua_writeline ()
-- return lua_writestring("" & ASCII.LF & "", 1), fflush(stdout);
-- arg-macro: function lua_writestringerror (s, p)
-- return fprintf(stderr, (s), (p)), fflush(stderr);
type luaL_Reg is record
name : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:24
func : Internal.lua_CFunction; -- /usr/include/lauxlib.h:25
end record;
pragma Convention (C_Pass_By_Copy, luaL_Reg); -- /usr/include/lauxlib.h:23
procedure luaL_checkversion_u
(arg1 : System.Address;
arg2 : Internal.lua_Number;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:31
pragma Import (C, luaL_checkversion_u, "luaL_checkversion_");
function luaL_getmetafield
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:35
pragma Import (C, luaL_getmetafield, "luaL_getmetafield");
function luaL_callmeta
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:36
pragma Import (C, luaL_callmeta, "luaL_callmeta");
function luaL_tolstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:37
pragma Import (C, luaL_tolstring, "luaL_tolstring");
function luaL_argerror
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:38
pragma Import (C, luaL_argerror, "luaL_argerror");
function luaL_checklstring
(arg1 : System.Address;
arg2 : int;
arg3 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:39
pragma Import (C, luaL_checklstring, "luaL_checklstring");
function luaL_optlstring
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : access Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:41
pragma Import (C, luaL_optlstring, "luaL_optlstring");
function luaL_checknumber (arg1 : System.Address; arg2 : int) return Internal.lua_Number; -- /usr/include/lauxlib.h:43
pragma Import (C, luaL_checknumber, "luaL_checknumber");
function luaL_optnumber
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Number) return Internal.lua_Number; -- /usr/include/lauxlib.h:44
pragma Import (C, luaL_optnumber, "luaL_optnumber");
function luaL_checkinteger (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:46
pragma Import (C, luaL_checkinteger, "luaL_checkinteger");
function luaL_optinteger
(arg1 : System.Address;
arg2 : int;
arg3 : Internal.lua_Integer) return Internal.lua_Integer; -- /usr/include/lauxlib.h:47
pragma Import (C, luaL_optinteger, "luaL_optinteger");
procedure luaL_checkstack
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:50
pragma Import (C, luaL_checkstack, "luaL_checkstack");
procedure luaL_checktype
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:51
pragma Import (C, luaL_checktype, "luaL_checktype");
procedure luaL_checkany (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:52
pragma Import (C, luaL_checkany, "luaL_checkany");
function luaL_newmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:54
pragma Import (C, luaL_newmetatable, "luaL_newmetatable");
procedure luaL_setmetatable (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:55
pragma Import (C, luaL_setmetatable, "luaL_setmetatable");
function luaL_testudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:56
pragma Import (C, luaL_testudata, "luaL_testudata");
function luaL_checkudata
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/lauxlib.h:57
pragma Import (C, luaL_checkudata, "luaL_checkudata");
procedure luaL_where (arg1 : System.Address; arg2 : int); -- /usr/include/lauxlib.h:59
pragma Import (C, luaL_where, "luaL_where");
function luaL_error (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- /usr/include/lauxlib.h:60
pragma Import (C, luaL_error, "luaL_error");
function luaL_checkoption
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : System.Address) return int; -- /usr/include/lauxlib.h:62
pragma Import (C, luaL_checkoption, "luaL_checkoption");
function luaL_fileresult
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:65
pragma Import (C, luaL_fileresult, "luaL_fileresult");
function luaL_execresult (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:66
pragma Import (C, luaL_execresult, "luaL_execresult");
-- pre-defined references
function luaL_ref (arg1 : System.Address; arg2 : int) return int; -- /usr/include/lauxlib.h:72
pragma Import (C, luaL_ref, "luaL_ref");
procedure luaL_unref
(arg1 : System.Address;
arg2 : int;
arg3 : int); -- /usr/include/lauxlib.h:73
pragma Import (C, luaL_unref, "luaL_unref");
function luaL_loadfilex
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:75
pragma Import (C, luaL_loadfilex, "luaL_loadfilex");
function luaL_loadbufferx
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:80
pragma Import (C, luaL_loadbufferx, "luaL_loadbufferx");
function luaL_loadstring (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:82
pragma Import (C, luaL_loadstring, "luaL_loadstring");
function luaL_newstate return System.Address; -- /usr/include/lauxlib.h:84
pragma Import (C, luaL_newstate, "luaL_newstate");
function luaL_len (arg1 : System.Address; arg2 : int) return Internal.lua_Integer; -- /usr/include/lauxlib.h:86
pragma Import (C, luaL_len, "luaL_len");
function luaL_gsub
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:88
pragma Import (C, luaL_gsub, "luaL_gsub");
procedure luaL_setfuncs
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int); -- /usr/include/lauxlib.h:91
pragma Import (C, luaL_setfuncs, "luaL_setfuncs");
function luaL_getsubtable
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/lauxlib.h:93
pragma Import (C, luaL_getsubtable, "luaL_getsubtable");
procedure luaL_traceback
(arg1 : System.Address;
arg2 : System.Address;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : int); -- /usr/include/lauxlib.h:95
pragma Import (C, luaL_traceback, "luaL_traceback");
procedure luaL_requiref
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Internal.lua_CFunction;
arg4 : int); -- /usr/include/lauxlib.h:98
pragma Import (C, luaL_requiref, "luaL_requiref");
--** {======================================================
--** Generic Buffer manipulation
--** =======================================================
--
-- buffer address
subtype anon1660_anon1662_array is Interfaces.C.char_array (0 .. 8191);
type luaL_Buffer is record
b : Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:141
size : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:142
n : aliased Interfaces.C.size_t; -- /usr/include/lauxlib.h:143
L : System.Address; -- /usr/include/lauxlib.h:144
initb : aliased anon1660_anon1662_array; -- /usr/include/lauxlib.h:145
end record;
pragma Convention (C_Pass_By_Copy, luaL_Buffer); -- /usr/include/lauxlib.h:140
-- buffer size
-- number of characters in buffer
-- initial buffer
procedure luaL_buffinit (arg1 : System.Address; arg2 : access luaL_Buffer); -- /usr/include/lauxlib.h:155
pragma Import (C, luaL_buffinit, "luaL_buffinit");
function luaL_prepbuffsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:156
pragma Import (C, luaL_prepbuffsize, "luaL_prepbuffsize");
procedure luaL_addlstring
(arg1 : access luaL_Buffer;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:157
pragma Import (C, luaL_addlstring, "luaL_addlstring");
procedure luaL_addstring (arg1 : access luaL_Buffer; arg2 : Interfaces.C.Strings.chars_ptr); -- /usr/include/lauxlib.h:158
pragma Import (C, luaL_addstring, "luaL_addstring");
procedure luaL_addvalue (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:159
pragma Import (C, luaL_addvalue, "luaL_addvalue");
procedure luaL_pushresult (arg1 : access luaL_Buffer); -- /usr/include/lauxlib.h:160
pragma Import (C, luaL_pushresult, "luaL_pushresult");
procedure luaL_pushresultsize (arg1 : access luaL_Buffer; arg2 : Interfaces.C.size_t); -- /usr/include/lauxlib.h:161
pragma Import (C, luaL_pushresultsize, "luaL_pushresultsize");
function luaL_buffinitsize
(arg1 : System.Address;
arg2 : access luaL_Buffer;
arg3 : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/lauxlib.h:162
pragma Import (C, luaL_buffinitsize, "luaL_buffinitsize");
end Lua.AuxInternal;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998587369918823,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999306201934814,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/nodes/program-nodes-digits_constraints.adb
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Digits_Constraints is
function Create
(Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Range_Token : Program.Lexical_Elements.Lexical_Element_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access)
return Digits_Constraint is
begin
return Result : Digits_Constraint :=
(Digits_Token => Digits_Token, Digits_Expression => Digits_Expression,
Range_Token => Range_Token,
Real_Range_Constraint => Real_Range_Constraint,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Digits_Constraint is
begin
return Result : Implicit_Digits_Constraint :=
(Digits_Expression => Digits_Expression,
Real_Range_Constraint => Real_Range_Constraint,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Digits_Expression
(Self : Base_Digits_Constraint)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Digits_Expression;
end Digits_Expression;
overriding function Real_Range_Constraint
(Self : Base_Digits_Constraint)
return Program.Elements.Constraints.Constraint_Access is
begin
return Self.Real_Range_Constraint;
end Real_Range_Constraint;
overriding function Digits_Token
(Self : Digits_Constraint)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Digits_Token;
end Digits_Token;
overriding function Range_Token
(Self : Digits_Constraint)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Range_Token;
end Range_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Digits_Constraint'Class) is
begin
Set_Enclosing_Element (Self.Digits_Expression, Self'Unchecked_Access);
if Self.Real_Range_Constraint.Assigned then
Set_Enclosing_Element
(Self.Real_Range_Constraint, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Digits_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Digits_Constraint;
overriding function Is_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Constraint;
overriding function Is_Definition
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Digits_Constraint;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Digits_Constraint (Self);
end Visit;
overriding function To_Digits_Constraint_Text
(Self : in out Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
begin
return Self'Unchecked_Access;
end To_Digits_Constraint_Text;
overriding function To_Digits_Constraint_Text
(Self : in out Implicit_Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Digits_Constraint_Text;
end Program.Nodes.Digits_Constraints;
|
26886
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Digits_Constraints is
function Create
(Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Range_Token : Program.Lexical_Elements.Lexical_Element_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access)
return Digits_Constraint is
begin
return Result : Digits_Constraint :=
(Digits_Token => Digits_Token, Digits_Expression => Digits_Expression,
Range_Token => Range_Token,
Real_Range_Constraint => Real_Range_Constraint,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Digits_Constraint is
begin
return Result : Implicit_Digits_Constraint :=
(Digits_Expression => Digits_Expression,
Real_Range_Constraint => Real_Range_Constraint,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Digits_Expression
(Self : Base_Digits_Constraint)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Digits_Expression;
end Digits_Expression;
overriding function Real_Range_Constraint
(Self : Base_Digits_Constraint)
return Program.Elements.Constraints.Constraint_Access is
begin
return Self.Real_Range_Constraint;
end Real_Range_Constraint;
overriding function Digits_Token
(Self : Digits_Constraint)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Digits_Token;
end Digits_Token;
overriding function Range_Token
(Self : Digits_Constraint)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Range_Token;
end Range_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Digits_Constraint'Class) is
begin
Set_Enclosing_Element (Self.Digits_Expression, Self'Unchecked_Access);
if Self.Real_Range_Constraint.Assigned then
Set_Enclosing_Element
(Self.Real_Range_Constraint, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Digits_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Digits_Constraint;
overriding function Is_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Constraint;
overriding function Is_Definition
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Digits_Constraint;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Digits_Constraint (Self);
end Visit;
overriding function To_Digits_Constraint_Text
(Self : in out Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
begin
return Self'Unchecked_Access;
end To_Digits_Constraint_Text;
overriding function To_Digits_Constraint_Text
(Self : in out Implicit_Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Digits_Constraint_Text;
end Program.Nodes.Digits_Constraints;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Digits_Constraints is
function Create
(Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Range_Token : Program.Lexical_Elements.Lexical_Element_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access)
return Digits_Constraint is
begin
return Result : Digits_Constraint :=
(Digits_Token => Digits_Token, Digits_Expression => Digits_Expression,
Range_Token => Range_Token,
Real_Range_Constraint => Real_Range_Constraint,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Digits_Constraint is
begin
return Result : Implicit_Digits_Constraint :=
(Digits_Expression => Digits_Expression,
Real_Range_Constraint => Real_Range_Constraint,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Digits_Expression
(Self : Base_Digits_Constraint)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Digits_Expression;
end Digits_Expression;
overriding function Real_Range_Constraint
(Self : Base_Digits_Constraint)
return Program.Elements.Constraints.Constraint_Access is
begin
return Self.Real_Range_Constraint;
end Real_Range_Constraint;
overriding function Digits_Token
(Self : Digits_Constraint)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Digits_Token;
end Digits_Token;
overriding function Range_Token
(Self : Digits_Constraint)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Range_Token;
end Range_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Digits_Constraint)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Digits_Constraint'Class) is
begin
Set_Enclosing_Element (Self.Digits_Expression, Self'Unchecked_Access);
if Self.Real_Range_Constraint.Assigned then
Set_Enclosing_Element
(Self.Real_Range_Constraint, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Digits_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Digits_Constraint;
overriding function Is_Constraint
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Constraint;
overriding function Is_Definition
(Self : Base_Digits_Constraint)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Digits_Constraint;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Digits_Constraint (Self);
end Visit;
overriding function To_Digits_Constraint_Text
(Self : in out Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
begin
return Self'Unchecked_Access;
end To_Digits_Constraint_Text;
overriding function To_Digits_Constraint_Text
(Self : in out Implicit_Digits_Constraint)
return Program.Elements.Digits_Constraints
.Digits_Constraint_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Digits_Constraint_Text;
end Program.Nodes.Digits_Constraints;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998623132705688,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999294281005859,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/oasis/program-elements-anonymous_access_to_objects.ads
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Anonymous_Access_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
package Program.Elements.Anonymous_Access_To_Objects is
pragma Pure (Program.Elements.Anonymous_Access_To_Objects);
type Anonymous_Access_To_Object is
limited interface
and Program.Elements.Anonymous_Access_Definitions
.Anonymous_Access_Definition;
type Anonymous_Access_To_Object_Access is
access all Anonymous_Access_To_Object'Class with Storage_Size => 0;
not overriding function Subtype_Indication
(Self : Anonymous_Access_To_Object)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Has_Not_Null
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_All
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_Constant
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
type Anonymous_Access_To_Object_Text is limited interface;
type Anonymous_Access_To_Object_Text_Access is
access all Anonymous_Access_To_Object_Text'Class with Storage_Size => 0;
not overriding function To_Anonymous_Access_To_Object_Text
(Self : in out Anonymous_Access_To_Object)
return Anonymous_Access_To_Object_Text_Access is abstract;
not overriding function Not_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Anonymous_Access_To_Object_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Constant_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Anonymous_Access_To_Objects;
|
5625
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Anonymous_Access_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
package Program.Elements.Anonymous_Access_To_Objects is
pragma Pure (Program.Elements.Anonymous_Access_To_Objects);
type Anonymous_Access_To_Object is
limited interface
and Program.Elements.Anonymous_Access_Definitions
.Anonymous_Access_Definition;
type Anonymous_Access_To_Object_Access is
access all Anonymous_Access_To_Object'Class with Storage_Size => 0;
not overriding function Subtype_Indication
(Self : Anonymous_Access_To_Object)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Has_Not_Null
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_All
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_Constant
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
type Anonymous_Access_To_Object_Text is limited interface;
type Anonymous_Access_To_Object_Text_Access is
access all Anonymous_Access_To_Object_Text'Class with Storage_Size => 0;
not overriding function To_Anonymous_Access_To_Object_Text
(Self : in out Anonymous_Access_To_Object)
return Anonymous_Access_To_Object_Text_Access is abstract;
not overriding function Not_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Anonymous_Access_To_Object_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Constant_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Anonymous_Access_To_Objects;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Anonymous_Access_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
package Program.Elements.Anonymous_Access_To_Objects is
pragma Pure (Program.Elements.Anonymous_Access_To_Objects);
type Anonymous_Access_To_Object is
limited interface
and Program.Elements.Anonymous_Access_Definitions
.Anonymous_Access_Definition;
type Anonymous_Access_To_Object_Access is
access all Anonymous_Access_To_Object'Class with Storage_Size => 0;
not overriding function Subtype_Indication
(Self : Anonymous_Access_To_Object)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Has_Not_Null
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_All
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
not overriding function Has_Constant
(Self : Anonymous_Access_To_Object)
return Boolean is abstract;
type Anonymous_Access_To_Object_Text is limited interface;
type Anonymous_Access_To_Object_Text_Access is
access all Anonymous_Access_To_Object_Text'Class with Storage_Size => 0;
not overriding function To_Anonymous_Access_To_Object_Text
(Self : in out Anonymous_Access_To_Object)
return Anonymous_Access_To_Object_Text_Access is abstract;
not overriding function Not_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Anonymous_Access_To_Object_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Constant_Token
(Self : Anonymous_Access_To_Object_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Anonymous_Access_To_Objects;
|
[
{
"context": "----------------------\n-- Copyright (c) 2015-2017, Natacha Porté --\n-- ",
"end": 120,
"score": 0.9998592138290405,
"start": 107,
"tag": "NAME",
"value": "Natacha Porté"
}
] |
tools/timekey.adb
|
faelys/natools
| 0 |
------------------------------------------------------------------------------
-- Copyright (c) 2015-2017, 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. --
------------------------------------------------------------------------------
with Ada.Calendar;
with Ada.Command_Line;
with Ada.Text_IO;
with Natools.Time_IO.RFC_3339;
with Natools.Time_Keys;
procedure Timekey is
procedure Process (Line : in String);
-- Guess the type of Line and convert it to or from type.
procedure Process_Input;
-- Read lines from current input and process them.
Input_Processed : Boolean := False;
Empty : Boolean := True;
Verbose : Boolean := False;
Subsecond_Digits : Natural := Duration'Aft;
procedure Process (Line : in String) is
begin
if Verbose then
Ada.Text_IO.Put (Line);
end if;
if Natools.Time_Keys.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_IO.RFC_3339.Image
(Natools.Time_Keys.To_Time (Line), Subsecond_Digits, False));
elsif Natools.Time_IO.RFC_3339.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_Keys.To_Key (Natools.Time_IO.RFC_3339.Value (Line)));
end if;
end Process;
procedure Process_Input is
begin
if Input_Processed then
return;
else
Input_Processed := True;
end if;
begin
loop
Process (Ada.Text_IO.Get_Line);
end loop;
exception
when Ada.Text_IO.End_Error => null;
end;
end Process_Input;
begin
for I in 1 .. Ada.Command_Line.Argument_Count loop
declare
Arg : constant String := Ada.Command_Line.Argument (I);
begin
if Arg = "-" then
Empty := False;
Process_Input;
elsif Arg = "-v" then
Verbose := True;
elsif Arg'Length = 2
and then Arg (Arg'First) = '-'
and then Arg (Arg'Last) in '0' .. '9'
then
Subsecond_Digits := Character'Pos (Arg (Arg'Last))
- Character'Pos ('0');
else
Empty := False;
Process (Arg);
end if;
end;
end loop;
if Empty then
declare
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
if Verbose then
Ada.Text_IO.Put
(Natools.Time_IO.RFC_3339.Image (Now, Subsecond_Digits, False)
& " => ");
end if;
Ada.Text_IO.Put_Line (Natools.Time_Keys.To_Key (Now));
end;
end if;
end Timekey;
|
18107
|
------------------------------------------------------------------------------
-- Copyright (c) 2015-2017, <NAME> --
-- --
-- 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. --
------------------------------------------------------------------------------
with Ada.Calendar;
with Ada.Command_Line;
with Ada.Text_IO;
with Natools.Time_IO.RFC_3339;
with Natools.Time_Keys;
procedure Timekey is
procedure Process (Line : in String);
-- Guess the type of Line and convert it to or from type.
procedure Process_Input;
-- Read lines from current input and process them.
Input_Processed : Boolean := False;
Empty : Boolean := True;
Verbose : Boolean := False;
Subsecond_Digits : Natural := Duration'Aft;
procedure Process (Line : in String) is
begin
if Verbose then
Ada.Text_IO.Put (Line);
end if;
if Natools.Time_Keys.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_IO.RFC_3339.Image
(Natools.Time_Keys.To_Time (Line), Subsecond_Digits, False));
elsif Natools.Time_IO.RFC_3339.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_Keys.To_Key (Natools.Time_IO.RFC_3339.Value (Line)));
end if;
end Process;
procedure Process_Input is
begin
if Input_Processed then
return;
else
Input_Processed := True;
end if;
begin
loop
Process (Ada.Text_IO.Get_Line);
end loop;
exception
when Ada.Text_IO.End_Error => null;
end;
end Process_Input;
begin
for I in 1 .. Ada.Command_Line.Argument_Count loop
declare
Arg : constant String := Ada.Command_Line.Argument (I);
begin
if Arg = "-" then
Empty := False;
Process_Input;
elsif Arg = "-v" then
Verbose := True;
elsif Arg'Length = 2
and then Arg (Arg'First) = '-'
and then Arg (Arg'Last) in '0' .. '9'
then
Subsecond_Digits := Character'Pos (Arg (Arg'Last))
- Character'Pos ('0');
else
Empty := False;
Process (Arg);
end if;
end;
end loop;
if Empty then
declare
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
if Verbose then
Ada.Text_IO.Put
(Natools.Time_IO.RFC_3339.Image (Now, Subsecond_Digits, False)
& " => ");
end if;
Ada.Text_IO.Put_Line (Natools.Time_Keys.To_Key (Now));
end;
end if;
end Timekey;
| true |
------------------------------------------------------------------------------
-- Copyright (c) 2015-2017, PI:NAME:<NAME>END_PI --
-- --
-- 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. --
------------------------------------------------------------------------------
with Ada.Calendar;
with Ada.Command_Line;
with Ada.Text_IO;
with Natools.Time_IO.RFC_3339;
with Natools.Time_Keys;
procedure Timekey is
procedure Process (Line : in String);
-- Guess the type of Line and convert it to or from type.
procedure Process_Input;
-- Read lines from current input and process them.
Input_Processed : Boolean := False;
Empty : Boolean := True;
Verbose : Boolean := False;
Subsecond_Digits : Natural := Duration'Aft;
procedure Process (Line : in String) is
begin
if Verbose then
Ada.Text_IO.Put (Line);
end if;
if Natools.Time_Keys.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_IO.RFC_3339.Image
(Natools.Time_Keys.To_Time (Line), Subsecond_Digits, False));
elsif Natools.Time_IO.RFC_3339.Is_Valid (Line) then
if Verbose then
Ada.Text_IO.Put (" => ");
end if;
Ada.Text_IO.Put_Line
(Natools.Time_Keys.To_Key (Natools.Time_IO.RFC_3339.Value (Line)));
end if;
end Process;
procedure Process_Input is
begin
if Input_Processed then
return;
else
Input_Processed := True;
end if;
begin
loop
Process (Ada.Text_IO.Get_Line);
end loop;
exception
when Ada.Text_IO.End_Error => null;
end;
end Process_Input;
begin
for I in 1 .. Ada.Command_Line.Argument_Count loop
declare
Arg : constant String := Ada.Command_Line.Argument (I);
begin
if Arg = "-" then
Empty := False;
Process_Input;
elsif Arg = "-v" then
Verbose := True;
elsif Arg'Length = 2
and then Arg (Arg'First) = '-'
and then Arg (Arg'Last) in '0' .. '9'
then
Subsecond_Digits := Character'Pos (Arg (Arg'Last))
- Character'Pos ('0');
else
Empty := False;
Process (Arg);
end if;
end;
end loop;
if Empty then
declare
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
if Verbose then
Ada.Text_IO.Put
(Natools.Time_IO.RFC_3339.Image (Now, Subsecond_Digits, False)
& " => ");
end if;
Ada.Text_IO.Put_Line (Natools.Time_Keys.To_Key (Now));
end;
end if;
end Timekey;
|
[
{
"context": "tor\n-- Copyright (C) 2009, 2010, 2011, 2012, 2015 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 179,
"score": 0.9998754262924194,
"start": 164,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "0, 2011, 2012, 2015 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 210,
"score": 0.9998840093612671,
"start": 195,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "5 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 237,
"score": 0.9999295473098755,
"start": 212,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/ado-tests.ads
|
My-Colaborations/ada-ado
| 0 |
-----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2015 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with record
I1 : Integer;
I2 : Integer;
end record;
procedure Set_Up (T : in out Test);
procedure Test_Load (T : in out Test);
procedure Test_Create_Load (T : in out Test);
procedure Test_Not_Open (T : in out Test);
procedure Test_Allocate (T : in out Test);
procedure Test_Create_Save (T : in out Test);
procedure Test_Perf_Create_Save (T : in out Test);
procedure Test_Delete_All (T : in out Test);
-- Test string insert.
procedure Test_String (T : in out Test);
-- Test blob insert.
procedure Test_Blob (T : in out Test);
-- Test the To_Object and To_Identifier operations.
procedure Test_Identifier_To_Object (T : in out Test);
end ADO.Tests;
|
4226
|
-----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with record
I1 : Integer;
I2 : Integer;
end record;
procedure Set_Up (T : in out Test);
procedure Test_Load (T : in out Test);
procedure Test_Create_Load (T : in out Test);
procedure Test_Not_Open (T : in out Test);
procedure Test_Allocate (T : in out Test);
procedure Test_Create_Save (T : in out Test);
procedure Test_Perf_Create_Save (T : in out Test);
procedure Test_Delete_All (T : in out Test);
-- Test string insert.
procedure Test_String (T : in out Test);
-- Test blob insert.
procedure Test_Blob (T : in out Test);
-- Test the To_Object and To_Identifier operations.
procedure Test_Identifier_To_Object (T : in out Test);
end ADO.Tests;
| true |
-----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2015 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with record
I1 : Integer;
I2 : Integer;
end record;
procedure Set_Up (T : in out Test);
procedure Test_Load (T : in out Test);
procedure Test_Create_Load (T : in out Test);
procedure Test_Not_Open (T : in out Test);
procedure Test_Allocate (T : in out Test);
procedure Test_Create_Save (T : in out Test);
procedure Test_Perf_Create_Save (T : in out Test);
procedure Test_Delete_All (T : in out Test);
-- Test string insert.
procedure Test_String (T : in out Test);
-- Test blob insert.
procedure Test_Blob (T : in out Test);
-- Test the To_Object and To_Identifier operations.
procedure Test_Identifier_To_Object (T : in out Test);
end ADO.Tests;
|
[
{
"context": " --\n-- Copyright (C) 2018 Fabien Chouteau --\n-- ",
"end": 372,
"score": 0.9998399615287781,
"start": 357,
"tag": "NAME",
"value": "Fabien Chouteau"
}
] |
src/tcg-palette.adb
|
Fabien-Chouteau/tiled-code-gen
| 1 |
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 Fabien Chouteau --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Vectors;
use Ada.Containers;
with Interfaces; use Interfaces;
package body TCG.Palette is
function ID_Hashed (C : ARGB_Color) return Hash_Type;
package Color_Hashmap is new Ada.Containers.Hashed_Maps
(Key_Type => ARGB_Color,
Element_Type => Color_Id,
Hash => ID_Hashed,
Equivalent_Keys => "=");
use Color_Hashmap;
package Color_Id_Vector is new Ada.Containers.Vectors
(Index_Type => Color_Id,
Element_Type => ARGB_Color);
use Color_Id_Vector;
Convert_Vect : Color_Id_Vector.Vector;
Hashmap : Color_Hashmap.Map;
Transparent_Color : ARGB_Color;
Transparent_Color_Id : Color_Id;
Transparent_Has_Definition : Boolean := False;
type String_Access is access all String;
Format_Strings : constant array (Output_Color_Format) of String_Access
:= (ARGB => new String'("ARGB"),
RGB565 => new String'("RGB565"),
RGB565_Swap => new String'("RGB565_Swap"),
RGB555 => new String'("RGB555"),
RGB888 => new String'("RGB888"));
---------------
-- ID_Hashed --
---------------
function ID_Hashed (C : ARGB_Color) return Hash_Type is
begin
return Hash_Type'Val (C.A + C.R + C.G + C.B);
end ID_Hashed;
---------------
-- Add_Color --
---------------
function Add_Color (C : ARGB_Color) return Color_Id is
Id : Color_Id;
begin
if In_Palette (C) then
Id := Element (Hashmap.Find (C));
else
Convert_Vect.Append (C);
Id := Convert_Vect.Last_Index;
Hashmap.Insert (C, Id);
end if;
return Id;
end Add_Color;
-------------
-- Convert --
-------------
function Convert (Id : Color_Id) return ARGB_Color
is (Convert_Vect.Element (Id));
----------------
-- In_Palette --
----------------
function In_Palette (C : ARGB_Color) return Boolean
is (Hashmap.Contains (C));
-------------------------
-- Transparent_Defined --
-------------------------
function Transparent_Defined return Boolean
is (Transparent_Has_Definition);
-----------------
-- Transparent --
-----------------
function Transparent return Color_Id
is (Transparent_Color_Id);
function Transparent return ARGB_Color
is (Transparent_Color);
---------------------
-- Set_Transparent --
---------------------
procedure Set_Transparent (C : ARGB_Color) is
begin
if Transparent_Has_Definition and then Transparent_Color /= C then
raise Program_Error with
"Incompatible new definition of transparent color";
end if;
-- Transparent_Color_Id := Add_Color (C);
Convert_Vect.Replace_Element (Transparent_Color_Id, C);
Hashmap.Insert (C, Transparent_Color_Id);
Transparent_Color := C;
Transparent_Has_Definition := True;
end Set_Transparent;
----------------------
-- Number_Of_Colors --
----------------------
function Number_Of_Colors return Natural
is (Natural (Convert_Vect.Length));
--------------
-- First_Id --
--------------
function First_Id return Color_Id
is (Convert_Vect.First_Index);
-------------
-- Last_Id --
-------------
function Last_Id return Color_Id
is (Convert_Vect.Last_Index);
-----------
-- Image --
-----------
function Image (Id : Color_Id) return String
is (Id'Img);
-------------
-- To_ARGB --
-------------
function To_ARGB (Str : String) return ARGB_Color is
R : constant String := Str (Str'First .. Str'First + 1);
G : constant String := Str (Str'First + 2 .. Str'First + 3);
B : constant String := Str (Str'First + 4 .. Str'First + 5);
begin
return (A => 255,
R => Component'Value ("16#" & R & "#"),
G => Component'Value ("16#" & G & "#"),
B => Component'Value ("16#" & B & "#"));
end To_ARGB;
---------------
-- To_RGB565 --
---------------
function To_RGB565 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 2) and 16#3F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (R, 11) or Shift_Left (G, 5) or B);
end To_RGB565;
--------------------
-- To_RGB565_Swap --
--------------------
function To_RGB565_Swap (C : ARGB_Color) return Unsigned_16 is
RGB : constant Unsigned_16 := To_RGB565 (C);
begin
return Shift_Right (RGB and 16#FF00#, 8) or
(Shift_Left (RGB, 8) and 16#FF00#);
end To_RGB565_Swap;
---------------
-- To_RGB888 --
---------------
function To_RGB888 (C : ARGB_Color) return Unsigned_32 is
R : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.R), 16);
G : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.G), 8);
B : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.B), 0);
begin
return R or G or B;
end To_RGB888;
---------------
-- To_RGB555 --
---------------
function To_RGB555 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 3) and 16#1F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (B, 10) or Shift_Left (G, 5) or R);
end To_RGB555;
-----------
-- Image --
-----------
function Image (C : ARGB_Color;
Format : Output_Color_Format)
return String
is
begin
case Format is
when ARGB =>
return Image (C);
when RGB565 =>
return To_RGB565 (C)'Img;
when RGB565_Swap =>
return To_RGB565_Swap (C)'Img;
when RGB555 =>
return To_RGB555 (C)'Img;
when RGB888 =>
return To_RGB888 (C)'Img;
end case;
end Image;
----------------------
-- Format_Supported --
----------------------
function Format_Supported (Fmt : String)
return Boolean
is (for some Str of Format_Strings => Str.all = Fmt);
-----------------------
-- Supported_Formats --
-----------------------
function Supported_Formats return String
is (Format_Strings (ARGB).all & ", " &
Format_Strings (RGB565).all & ", " &
Format_Strings (RGB565_Swap).all);
-------------
-- Convert --
-------------
function Convert (Fmt : String) return Output_Color_Format
is
begin
for Format in Output_Color_Format loop
if Fmt = Format_Strings (Format).all then
return Format;
end if;
end loop;
raise Program_Error with "Invalid output color format: " & Fmt;
end Convert;
---------
-- Put --
---------
procedure Put is
begin
Put_Line ("Palette ->");
Put_Line ("Number_Of_Colors: " & Length (Hashmap)'Img);
Put_Line ("Transparent color: " & Image (Transparent_Color));
for Cur in Convert_Vect.Iterate loop
Put_Line (To_Index (Cur)'Img & " => " & Image (Element (Cur)));
end loop;
end Put;
-----------
-- Image --
-----------
function Image (C : ARGB_Color) return String
is ("(" & C.A'Img & "," & C.R'Img & "," &
C.G'Img & "," & C.B'Img & ")");
begin
Transparent_Color_Id := Add_Color ((0, 0, 0, 0));
if Transparent_Color_Id /= 0 then
raise Program_Error with "Transparent_Color_Id should be zero";
end if;
end TCG.Palette;
|
17151
|
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Vectors;
use Ada.Containers;
with Interfaces; use Interfaces;
package body TCG.Palette is
function ID_Hashed (C : ARGB_Color) return Hash_Type;
package Color_Hashmap is new Ada.Containers.Hashed_Maps
(Key_Type => ARGB_Color,
Element_Type => Color_Id,
Hash => ID_Hashed,
Equivalent_Keys => "=");
use Color_Hashmap;
package Color_Id_Vector is new Ada.Containers.Vectors
(Index_Type => Color_Id,
Element_Type => ARGB_Color);
use Color_Id_Vector;
Convert_Vect : Color_Id_Vector.Vector;
Hashmap : Color_Hashmap.Map;
Transparent_Color : ARGB_Color;
Transparent_Color_Id : Color_Id;
Transparent_Has_Definition : Boolean := False;
type String_Access is access all String;
Format_Strings : constant array (Output_Color_Format) of String_Access
:= (ARGB => new String'("ARGB"),
RGB565 => new String'("RGB565"),
RGB565_Swap => new String'("RGB565_Swap"),
RGB555 => new String'("RGB555"),
RGB888 => new String'("RGB888"));
---------------
-- ID_Hashed --
---------------
function ID_Hashed (C : ARGB_Color) return Hash_Type is
begin
return Hash_Type'Val (C.A + C.R + C.G + C.B);
end ID_Hashed;
---------------
-- Add_Color --
---------------
function Add_Color (C : ARGB_Color) return Color_Id is
Id : Color_Id;
begin
if In_Palette (C) then
Id := Element (Hashmap.Find (C));
else
Convert_Vect.Append (C);
Id := Convert_Vect.Last_Index;
Hashmap.Insert (C, Id);
end if;
return Id;
end Add_Color;
-------------
-- Convert --
-------------
function Convert (Id : Color_Id) return ARGB_Color
is (Convert_Vect.Element (Id));
----------------
-- In_Palette --
----------------
function In_Palette (C : ARGB_Color) return Boolean
is (Hashmap.Contains (C));
-------------------------
-- Transparent_Defined --
-------------------------
function Transparent_Defined return Boolean
is (Transparent_Has_Definition);
-----------------
-- Transparent --
-----------------
function Transparent return Color_Id
is (Transparent_Color_Id);
function Transparent return ARGB_Color
is (Transparent_Color);
---------------------
-- Set_Transparent --
---------------------
procedure Set_Transparent (C : ARGB_Color) is
begin
if Transparent_Has_Definition and then Transparent_Color /= C then
raise Program_Error with
"Incompatible new definition of transparent color";
end if;
-- Transparent_Color_Id := Add_Color (C);
Convert_Vect.Replace_Element (Transparent_Color_Id, C);
Hashmap.Insert (C, Transparent_Color_Id);
Transparent_Color := C;
Transparent_Has_Definition := True;
end Set_Transparent;
----------------------
-- Number_Of_Colors --
----------------------
function Number_Of_Colors return Natural
is (Natural (Convert_Vect.Length));
--------------
-- First_Id --
--------------
function First_Id return Color_Id
is (Convert_Vect.First_Index);
-------------
-- Last_Id --
-------------
function Last_Id return Color_Id
is (Convert_Vect.Last_Index);
-----------
-- Image --
-----------
function Image (Id : Color_Id) return String
is (Id'Img);
-------------
-- To_ARGB --
-------------
function To_ARGB (Str : String) return ARGB_Color is
R : constant String := Str (Str'First .. Str'First + 1);
G : constant String := Str (Str'First + 2 .. Str'First + 3);
B : constant String := Str (Str'First + 4 .. Str'First + 5);
begin
return (A => 255,
R => Component'Value ("16#" & R & "#"),
G => Component'Value ("16#" & G & "#"),
B => Component'Value ("16#" & B & "#"));
end To_ARGB;
---------------
-- To_RGB565 --
---------------
function To_RGB565 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 2) and 16#3F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (R, 11) or Shift_Left (G, 5) or B);
end To_RGB565;
--------------------
-- To_RGB565_Swap --
--------------------
function To_RGB565_Swap (C : ARGB_Color) return Unsigned_16 is
RGB : constant Unsigned_16 := To_RGB565 (C);
begin
return Shift_Right (RGB and 16#FF00#, 8) or
(Shift_Left (RGB, 8) and 16#FF00#);
end To_RGB565_Swap;
---------------
-- To_RGB888 --
---------------
function To_RGB888 (C : ARGB_Color) return Unsigned_32 is
R : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.R), 16);
G : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.G), 8);
B : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.B), 0);
begin
return R or G or B;
end To_RGB888;
---------------
-- To_RGB555 --
---------------
function To_RGB555 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 3) and 16#1F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (B, 10) or Shift_Left (G, 5) or R);
end To_RGB555;
-----------
-- Image --
-----------
function Image (C : ARGB_Color;
Format : Output_Color_Format)
return String
is
begin
case Format is
when ARGB =>
return Image (C);
when RGB565 =>
return To_RGB565 (C)'Img;
when RGB565_Swap =>
return To_RGB565_Swap (C)'Img;
when RGB555 =>
return To_RGB555 (C)'Img;
when RGB888 =>
return To_RGB888 (C)'Img;
end case;
end Image;
----------------------
-- Format_Supported --
----------------------
function Format_Supported (Fmt : String)
return Boolean
is (for some Str of Format_Strings => Str.all = Fmt);
-----------------------
-- Supported_Formats --
-----------------------
function Supported_Formats return String
is (Format_Strings (ARGB).all & ", " &
Format_Strings (RGB565).all & ", " &
Format_Strings (RGB565_Swap).all);
-------------
-- Convert --
-------------
function Convert (Fmt : String) return Output_Color_Format
is
begin
for Format in Output_Color_Format loop
if Fmt = Format_Strings (Format).all then
return Format;
end if;
end loop;
raise Program_Error with "Invalid output color format: " & Fmt;
end Convert;
---------
-- Put --
---------
procedure Put is
begin
Put_Line ("Palette ->");
Put_Line ("Number_Of_Colors: " & Length (Hashmap)'Img);
Put_Line ("Transparent color: " & Image (Transparent_Color));
for Cur in Convert_Vect.Iterate loop
Put_Line (To_Index (Cur)'Img & " => " & Image (Element (Cur)));
end loop;
end Put;
-----------
-- Image --
-----------
function Image (C : ARGB_Color) return String
is ("(" & C.A'Img & "," & C.R'Img & "," &
C.G'Img & "," & C.B'Img & ")");
begin
Transparent_Color_Id := Add_Color ((0, 0, 0, 0));
if Transparent_Color_Id /= 0 then
raise Program_Error with "Transparent_Color_Id should be zero";
end if;
end TCG.Palette;
| true |
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 PI:NAME:<NAME>END_PI --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Vectors;
use Ada.Containers;
with Interfaces; use Interfaces;
package body TCG.Palette is
function ID_Hashed (C : ARGB_Color) return Hash_Type;
package Color_Hashmap is new Ada.Containers.Hashed_Maps
(Key_Type => ARGB_Color,
Element_Type => Color_Id,
Hash => ID_Hashed,
Equivalent_Keys => "=");
use Color_Hashmap;
package Color_Id_Vector is new Ada.Containers.Vectors
(Index_Type => Color_Id,
Element_Type => ARGB_Color);
use Color_Id_Vector;
Convert_Vect : Color_Id_Vector.Vector;
Hashmap : Color_Hashmap.Map;
Transparent_Color : ARGB_Color;
Transparent_Color_Id : Color_Id;
Transparent_Has_Definition : Boolean := False;
type String_Access is access all String;
Format_Strings : constant array (Output_Color_Format) of String_Access
:= (ARGB => new String'("ARGB"),
RGB565 => new String'("RGB565"),
RGB565_Swap => new String'("RGB565_Swap"),
RGB555 => new String'("RGB555"),
RGB888 => new String'("RGB888"));
---------------
-- ID_Hashed --
---------------
function ID_Hashed (C : ARGB_Color) return Hash_Type is
begin
return Hash_Type'Val (C.A + C.R + C.G + C.B);
end ID_Hashed;
---------------
-- Add_Color --
---------------
function Add_Color (C : ARGB_Color) return Color_Id is
Id : Color_Id;
begin
if In_Palette (C) then
Id := Element (Hashmap.Find (C));
else
Convert_Vect.Append (C);
Id := Convert_Vect.Last_Index;
Hashmap.Insert (C, Id);
end if;
return Id;
end Add_Color;
-------------
-- Convert --
-------------
function Convert (Id : Color_Id) return ARGB_Color
is (Convert_Vect.Element (Id));
----------------
-- In_Palette --
----------------
function In_Palette (C : ARGB_Color) return Boolean
is (Hashmap.Contains (C));
-------------------------
-- Transparent_Defined --
-------------------------
function Transparent_Defined return Boolean
is (Transparent_Has_Definition);
-----------------
-- Transparent --
-----------------
function Transparent return Color_Id
is (Transparent_Color_Id);
function Transparent return ARGB_Color
is (Transparent_Color);
---------------------
-- Set_Transparent --
---------------------
procedure Set_Transparent (C : ARGB_Color) is
begin
if Transparent_Has_Definition and then Transparent_Color /= C then
raise Program_Error with
"Incompatible new definition of transparent color";
end if;
-- Transparent_Color_Id := Add_Color (C);
Convert_Vect.Replace_Element (Transparent_Color_Id, C);
Hashmap.Insert (C, Transparent_Color_Id);
Transparent_Color := C;
Transparent_Has_Definition := True;
end Set_Transparent;
----------------------
-- Number_Of_Colors --
----------------------
function Number_Of_Colors return Natural
is (Natural (Convert_Vect.Length));
--------------
-- First_Id --
--------------
function First_Id return Color_Id
is (Convert_Vect.First_Index);
-------------
-- Last_Id --
-------------
function Last_Id return Color_Id
is (Convert_Vect.Last_Index);
-----------
-- Image --
-----------
function Image (Id : Color_Id) return String
is (Id'Img);
-------------
-- To_ARGB --
-------------
function To_ARGB (Str : String) return ARGB_Color is
R : constant String := Str (Str'First .. Str'First + 1);
G : constant String := Str (Str'First + 2 .. Str'First + 3);
B : constant String := Str (Str'First + 4 .. Str'First + 5);
begin
return (A => 255,
R => Component'Value ("16#" & R & "#"),
G => Component'Value ("16#" & G & "#"),
B => Component'Value ("16#" & B & "#"));
end To_ARGB;
---------------
-- To_RGB565 --
---------------
function To_RGB565 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 2) and 16#3F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (R, 11) or Shift_Left (G, 5) or B);
end To_RGB565;
--------------------
-- To_RGB565_Swap --
--------------------
function To_RGB565_Swap (C : ARGB_Color) return Unsigned_16 is
RGB : constant Unsigned_16 := To_RGB565 (C);
begin
return Shift_Right (RGB and 16#FF00#, 8) or
(Shift_Left (RGB, 8) and 16#FF00#);
end To_RGB565_Swap;
---------------
-- To_RGB888 --
---------------
function To_RGB888 (C : ARGB_Color) return Unsigned_32 is
R : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.R), 16);
G : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.G), 8);
B : constant Unsigned_32 := Shift_Left (Unsigned_32 (C.B), 0);
begin
return R or G or B;
end To_RGB888;
---------------
-- To_RGB555 --
---------------
function To_RGB555 (C : ARGB_Color) return Unsigned_16 is
R : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.R), 3) and 16#1F#;
G : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.G), 3) and 16#1F#;
B : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (C.B), 3) and 16#1F#;
begin
return (Shift_Left (B, 10) or Shift_Left (G, 5) or R);
end To_RGB555;
-----------
-- Image --
-----------
function Image (C : ARGB_Color;
Format : Output_Color_Format)
return String
is
begin
case Format is
when ARGB =>
return Image (C);
when RGB565 =>
return To_RGB565 (C)'Img;
when RGB565_Swap =>
return To_RGB565_Swap (C)'Img;
when RGB555 =>
return To_RGB555 (C)'Img;
when RGB888 =>
return To_RGB888 (C)'Img;
end case;
end Image;
----------------------
-- Format_Supported --
----------------------
function Format_Supported (Fmt : String)
return Boolean
is (for some Str of Format_Strings => Str.all = Fmt);
-----------------------
-- Supported_Formats --
-----------------------
function Supported_Formats return String
is (Format_Strings (ARGB).all & ", " &
Format_Strings (RGB565).all & ", " &
Format_Strings (RGB565_Swap).all);
-------------
-- Convert --
-------------
function Convert (Fmt : String) return Output_Color_Format
is
begin
for Format in Output_Color_Format loop
if Fmt = Format_Strings (Format).all then
return Format;
end if;
end loop;
raise Program_Error with "Invalid output color format: " & Fmt;
end Convert;
---------
-- Put --
---------
procedure Put is
begin
Put_Line ("Palette ->");
Put_Line ("Number_Of_Colors: " & Length (Hashmap)'Img);
Put_Line ("Transparent color: " & Image (Transparent_Color));
for Cur in Convert_Vect.Iterate loop
Put_Line (To_Index (Cur)'Img & " => " & Image (Element (Cur)));
end loop;
end Put;
-----------
-- Image --
-----------
function Image (C : ARGB_Color) return String
is ("(" & C.A'Img & "," & C.R'Img & "," &
C.G'Img & "," & C.B'Img & ")");
begin
Transparent_Color_Id := Add_Color ((0, 0, 0, 0));
if Transparent_Color_Id /= 0 then
raise Program_Error with "Transparent_Color_Id should be zero";
end if;
end TCG.Palette;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998605251312256,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999299049377441,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/nodes/program-nodes-case_paths.adb
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Case_Paths is
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Case_Path is
begin
return Result : Case_Path :=
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Statements => Statements,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Path is
begin
return Result : Implicit_Case_Path :=
(Choices => Choices, Statements => Statements,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Choices
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Statements
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Statements;
end Statements;
overriding function When_Token
(Self : Case_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.When_Token;
end When_Token;
overriding function Arrow_Token
(Self : Case_Path)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Arrow_Token;
end Arrow_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Case_Path'Class) is
begin
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Statements.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Case_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Case_Path;
overriding function Is_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Path;
overriding procedure Visit
(Self : not null access Base_Case_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Case_Path (Self);
end Visit;
overriding function To_Case_Path_Text
(Self : in out Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
begin
return Self'Unchecked_Access;
end To_Case_Path_Text;
overriding function To_Case_Path_Text
(Self : in out Implicit_Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Case_Path_Text;
end Program.Nodes.Case_Paths;
|
5445
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Case_Paths is
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Case_Path is
begin
return Result : Case_Path :=
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Statements => Statements,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Path is
begin
return Result : Implicit_Case_Path :=
(Choices => Choices, Statements => Statements,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Choices
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Statements
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Statements;
end Statements;
overriding function When_Token
(Self : Case_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.When_Token;
end When_Token;
overriding function Arrow_Token
(Self : Case_Path)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Arrow_Token;
end Arrow_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Case_Path'Class) is
begin
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Statements.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Case_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Case_Path;
overriding function Is_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Path;
overriding procedure Visit
(Self : not null access Base_Case_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Case_Path (Self);
end Visit;
overriding function To_Case_Path_Text
(Self : in out Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
begin
return Self'Unchecked_Access;
end To_Case_Path_Text;
overriding function To_Case_Path_Text
(Self : in out Implicit_Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Case_Path_Text;
end Program.Nodes.Case_Paths;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Case_Paths is
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Case_Path is
begin
return Result : Case_Path :=
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Statements => Statements,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Path is
begin
return Result : Implicit_Case_Path :=
(Choices => Choices, Statements => Statements,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Choices
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Statements
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Statements;
end Statements;
overriding function When_Token
(Self : Case_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.When_Token;
end When_Token;
overriding function Arrow_Token
(Self : Case_Path)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Arrow_Token;
end Arrow_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Case_Path'Class) is
begin
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Statements.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Case_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Case_Path;
overriding function Is_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Path;
overriding procedure Visit
(Self : not null access Base_Case_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Case_Path (Self);
end Visit;
overriding function To_Case_Path_Text
(Self : in out Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
begin
return Self'Unchecked_Access;
end To_Case_Path_Text;
overriding function To_Case_Path_Text
(Self : in out Implicit_Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Case_Path_Text;
end Program.Nodes.Case_Paths;
|
[
{
"context": "---------------------------\n-- Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 465,
"score": 0.9998711347579956,
"start": 450,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 496,
"score": 0.9998787641525269,
"start": 481,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "9 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 523,
"score": 0.9999284744262695,
"start": 498,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
awa/plugins/awa-tags/src/model/awa-tags-models.adb
|
twdroeger/ada-awa
| 0 |
-----------------------------------------------------------------------
-- AWA.Tags.Models -- AWA.Tags.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body AWA.Tags.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Tag_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function Tag_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function "=" (Left, Right : Tag_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tag_Ref'Class;
Impl : out Tag_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tag_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tag_Ref) is
Impl : Tag_Access;
begin
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tag
-- ----------------------------------------
procedure Set_Id (Object : in out Tag_Ref;
Value : in ADO.Identifier) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tag_Ref)
return ADO.Identifier is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Name (Object : in out Tag_Ref;
Value : in String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Tag_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Tag_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Tag_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Tag_Ref;
Into : in out Tag_Ref) is
Result : Tag_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tag_Access
:= new Tag_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tag_Access := new Tag_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tag_Impl) is
type Tag_Impl_Ptr is access all Tag_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tag_Impl, Tag_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tag_Impl_Ptr := Tag_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAG_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tag_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tag_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tag_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
Tag_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tag_Ref;
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tag_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Unbounded_String (1);
ADO.Objects.Set_Created (Object);
end Load;
function Tagged_Entity_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function Tagged_Entity_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function "=" (Left, Right : Tagged_Entity_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tagged_Entity_Ref'Class;
Impl : out Tagged_Entity_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tagged_Entity_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tagged_Entity_Ref) is
Impl : Tagged_Entity_Access;
begin
Impl := new Tagged_Entity_Impl;
Impl.For_Entity_Id := ADO.NO_IDENTIFIER;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tagged_Entity
-- ----------------------------------------
procedure Set_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_For_Entity_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 2, Impl.For_Entity_Id, Value);
end Set_For_Entity_Id;
function Get_For_Entity_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.For_Entity_Id;
end Get_For_Entity_Id;
procedure Set_Entity_Type (Object : in out Tagged_Entity_Ref;
Value : in ADO.Entity_Type) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Tagged_Entity_Ref)
return ADO.Entity_Type is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
procedure Set_Tag (Object : in out Tagged_Entity_Ref;
Value : in AWA.Tags.Models.Tag_Ref'Class) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Tag, Value);
end Set_Tag;
function Get_Tag (Object : in Tagged_Entity_Ref)
return AWA.Tags.Models.Tag_Ref'Class is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Tag;
end Get_Tag;
-- Copy of the object.
procedure Copy (Object : in Tagged_Entity_Ref;
Into : in out Tagged_Entity_Ref) is
Result : Tagged_Entity_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tagged_Entity_Access
:= new Tagged_Entity_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.For_Entity_Id := Impl.For_Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Tag := Impl.Tag;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tagged_Entity_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tagged_Entity_Impl) is
type Tagged_Entity_Impl_Ptr is access all Tagged_Entity_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tagged_Entity_Impl, Tagged_Entity_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tagged_Entity_Impl_Ptr := Tagged_Entity_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Object.Clear_Modified (4);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Query.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tagged_Entity_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tagged_Entity_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tagged_Entity_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "for_entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.For_Entity_Id));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tagged_Entity_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
Tagged_Entity_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tagged_Entity_Ref;
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tagged_Entity_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.For_Entity_Id := Stmt.Get_Identifier (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
if not Stmt.Is_Null (3) then
Object.Tag.Set_Key_Value (Stmt.Get_Identifier (3), Session);
end if;
ADO.Objects.Set_Created (Object);
end Load;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "tag" then
return Util.Beans.Objects.To_Object (From.Tag);
elsif Name = "count" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Tag_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "tag" then
Item.Tag := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "count" then
Item.Count := Util.Beans.Objects.To_Integer (Value);
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out Tag_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The tag information.
-- --------------------
procedure List (Object : in out Tag_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out Tag_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out Tag_Info) is
begin
Into.Tag := Stmt.Get_Unbounded_String (0);
Into.Count := Stmt.Get_Natural (1);
end Read;
begin
Stmt.Execute;
Tag_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
end AWA.Tags.Models;
|
1708
|
-----------------------------------------------------------------------
-- AWA.Tags.Models -- AWA.Tags.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 AWA.Tags.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Tag_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function Tag_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function "=" (Left, Right : Tag_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tag_Ref'Class;
Impl : out Tag_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tag_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tag_Ref) is
Impl : Tag_Access;
begin
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tag
-- ----------------------------------------
procedure Set_Id (Object : in out Tag_Ref;
Value : in ADO.Identifier) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tag_Ref)
return ADO.Identifier is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Name (Object : in out Tag_Ref;
Value : in String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Tag_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Tag_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Tag_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Tag_Ref;
Into : in out Tag_Ref) is
Result : Tag_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tag_Access
:= new Tag_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tag_Access := new Tag_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tag_Impl) is
type Tag_Impl_Ptr is access all Tag_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tag_Impl, Tag_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tag_Impl_Ptr := Tag_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAG_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tag_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tag_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tag_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
Tag_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tag_Ref;
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tag_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Unbounded_String (1);
ADO.Objects.Set_Created (Object);
end Load;
function Tagged_Entity_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function Tagged_Entity_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function "=" (Left, Right : Tagged_Entity_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tagged_Entity_Ref'Class;
Impl : out Tagged_Entity_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tagged_Entity_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tagged_Entity_Ref) is
Impl : Tagged_Entity_Access;
begin
Impl := new Tagged_Entity_Impl;
Impl.For_Entity_Id := ADO.NO_IDENTIFIER;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tagged_Entity
-- ----------------------------------------
procedure Set_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_For_Entity_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 2, Impl.For_Entity_Id, Value);
end Set_For_Entity_Id;
function Get_For_Entity_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.For_Entity_Id;
end Get_For_Entity_Id;
procedure Set_Entity_Type (Object : in out Tagged_Entity_Ref;
Value : in ADO.Entity_Type) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Tagged_Entity_Ref)
return ADO.Entity_Type is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
procedure Set_Tag (Object : in out Tagged_Entity_Ref;
Value : in AWA.Tags.Models.Tag_Ref'Class) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Tag, Value);
end Set_Tag;
function Get_Tag (Object : in Tagged_Entity_Ref)
return AWA.Tags.Models.Tag_Ref'Class is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Tag;
end Get_Tag;
-- Copy of the object.
procedure Copy (Object : in Tagged_Entity_Ref;
Into : in out Tagged_Entity_Ref) is
Result : Tagged_Entity_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tagged_Entity_Access
:= new Tagged_Entity_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.For_Entity_Id := Impl.For_Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Tag := Impl.Tag;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tagged_Entity_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tagged_Entity_Impl) is
type Tagged_Entity_Impl_Ptr is access all Tagged_Entity_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tagged_Entity_Impl, Tagged_Entity_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tagged_Entity_Impl_Ptr := Tagged_Entity_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Object.Clear_Modified (4);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Query.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tagged_Entity_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tagged_Entity_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tagged_Entity_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "for_entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.For_Entity_Id));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tagged_Entity_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
Tagged_Entity_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tagged_Entity_Ref;
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tagged_Entity_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.For_Entity_Id := Stmt.Get_Identifier (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
if not Stmt.Is_Null (3) then
Object.Tag.Set_Key_Value (Stmt.Get_Identifier (3), Session);
end if;
ADO.Objects.Set_Created (Object);
end Load;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "tag" then
return Util.Beans.Objects.To_Object (From.Tag);
elsif Name = "count" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Tag_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "tag" then
Item.Tag := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "count" then
Item.Count := Util.Beans.Objects.To_Integer (Value);
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out Tag_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The tag information.
-- --------------------
procedure List (Object : in out Tag_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out Tag_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out Tag_Info) is
begin
Into.Tag := Stmt.Get_Unbounded_String (0);
Into.Count := Stmt.Get_Natural (1);
end Read;
begin
Stmt.Execute;
Tag_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
end AWA.Tags.Models;
| true |
-----------------------------------------------------------------------
-- AWA.Tags.Models -- AWA.Tags.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 AWA.Tags.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Tag_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function Tag_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function "=" (Left, Right : Tag_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tag_Ref'Class;
Impl : out Tag_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tag_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tag_Ref) is
Impl : Tag_Access;
begin
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tag
-- ----------------------------------------
procedure Set_Id (Object : in out Tag_Ref;
Value : in ADO.Identifier) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tag_Ref)
return ADO.Identifier is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Name (Object : in out Tag_Ref;
Value : in String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Tag_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Tag_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Tag_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Tag_Ref;
Into : in out Tag_Ref) is
Result : Tag_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tag_Access
:= new Tag_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tag_Access := new Tag_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tag_Impl) is
type Tag_Impl_Ptr is access all Tag_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tag_Impl, Tag_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tag_Impl_Ptr := Tag_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAG_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tag_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tag_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tag_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
Tag_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tag_Ref;
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tag_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Unbounded_String (1);
ADO.Objects.Set_Created (Object);
end Load;
function Tagged_Entity_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function Tagged_Entity_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function "=" (Left, Right : Tagged_Entity_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tagged_Entity_Ref'Class;
Impl : out Tagged_Entity_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tagged_Entity_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Tagged_Entity_Ref) is
Impl : Tagged_Entity_Access;
begin
Impl := new Tagged_Entity_Impl;
Impl.For_Entity_Id := ADO.NO_IDENTIFIER;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tagged_Entity
-- ----------------------------------------
procedure Set_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_For_Entity_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 2, Impl.For_Entity_Id, Value);
end Set_For_Entity_Id;
function Get_For_Entity_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.For_Entity_Id;
end Get_For_Entity_Id;
procedure Set_Entity_Type (Object : in out Tagged_Entity_Ref;
Value : in ADO.Entity_Type) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Tagged_Entity_Ref)
return ADO.Entity_Type is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
procedure Set_Tag (Object : in out Tagged_Entity_Ref;
Value : in AWA.Tags.Models.Tag_Ref'Class) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Tag, Value);
end Set_Tag;
function Get_Tag (Object : in Tagged_Entity_Ref)
return AWA.Tags.Models.Tag_Ref'Class is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Tag;
end Get_Tag;
-- Copy of the object.
procedure Copy (Object : in Tagged_Entity_Ref;
Into : in out Tagged_Entity_Ref) is
Result : Tagged_Entity_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tagged_Entity_Access
:= new Tagged_Entity_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.For_Entity_Id := Impl.For_Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Tag := Impl.Tag;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tagged_Entity_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Tagged_Entity_Impl) is
type Tagged_Entity_Impl_Ptr is access all Tagged_Entity_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tagged_Entity_Impl, Tagged_Entity_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tagged_Entity_Impl_Ptr := Tagged_Entity_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Object.Clear_Modified (4);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Query.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tagged_Entity_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tagged_Entity_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tagged_Entity_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "for_entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.For_Entity_Id));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tagged_Entity_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
Tagged_Entity_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tagged_Entity_Ref;
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tagged_Entity_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.For_Entity_Id := Stmt.Get_Identifier (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
if not Stmt.Is_Null (3) then
Object.Tag.Set_Key_Value (Stmt.Get_Identifier (3), Session);
end if;
ADO.Objects.Set_Created (Object);
end Load;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "tag" then
return Util.Beans.Objects.To_Object (From.Tag);
elsif Name = "count" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Tag_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "tag" then
Item.Tag := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "count" then
Item.Count := Util.Beans.Objects.To_Integer (Value);
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out Tag_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The tag information.
-- --------------------
procedure List (Object : in out Tag_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out Tag_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out Tag_Info) is
begin
Into.Tag := Stmt.Get_Unbounded_String (0);
Into.Count := Stmt.Get_Natural (1);
end Read;
begin
Stmt.Execute;
Tag_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
end AWA.Tags.Models;
|
[
{
"context": "n Fast Inverse Square Root article by\n -- Chris Lomont (http://www.lomont.org/Math/Papers/2003/InvSqrt.p",
"end": 3899,
"score": 0.9998515844345093,
"start": 3887,
"tag": "NAME",
"value": "Chris Lomont"
}
] |
runtime/ravenscar-sfp-stm32f427/math/s-lidosq.adb
|
TUM-EI-RCS/StratoX
| 12 |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . L I B M _ D O U B L E . S Q R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2014-2015, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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 is the Ada Cert Math specific implementation of sqrt (powerpc)
with Ada.Unchecked_Conversion;
with System.Machine_Code;
package body System.Libm_Double.Squareroot is
function Rsqrt (X : Long_Float) return Long_Float;
-- Compute the reciprocal square root. There are two reasons for computing
-- the reciprocal square root instead of computing directly the square
-- root: PowerPc provides an instruction (fsqrte) to compute an estimate of
-- the reciprocal (with 5 bits of precision), and the Newton-Raphson method
-- is more efficient on the reciprocal than on the direct root (because the
-- direct root needs divisions, while the reciprocal does not). Note that
-- PowerPc core e300 doesn't support the direct square root operation.
-----------
-- Rsqrt --
-----------
function Rsqrt (X : Long_Float) return Long_Float is
X_Half : constant Long_Float := X * 0.5;
Y, Y1 : Long_Float;
begin
if Standard'Target_Name = "powerpc-elf" then
-- On powerpc, the precision of fsqrte is at least 5 binary digits
System.Machine_Code.Asm ("frsqrte %0,%1",
Outputs => Long_Float'Asm_Output ("=f", Y),
Inputs => Long_Float'Asm_Input ("f", X));
else
-- Provide the exact result for 1.0
if X = 1.0 then
return X;
end if;
-- Use the method described in Fast Inverse Square Root article by
-- Chris Lomont (http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf),
-- although the code was known before that article.
declare
type Unsigned_Long is mod 2**64;
function To_Unsigned_Long is new Ada.Unchecked_Conversion
(Long_Float, Unsigned_Long);
function From_Unsigned_Long is new Ada.Unchecked_Conversion
(Unsigned_Long, Long_Float);
U : Unsigned_Long;
begin
U := To_Unsigned_Long (X);
U := 16#5fe6ec85_e7de30da# - (U / 2);
Y := From_Unsigned_Long (U);
-- Precision is about 4 digits
end;
end if;
-- Newton iterations: X <- X - F(X)/F'(X)
-- Here F(X) = 1/X^2 - A, so F'(X) = -2/X^3
-- So: X <- X - (1/X^2 - A) / (-2/X^3)
-- <- X + .5(X - A*X^3)
-- <- X + .5*X*(1 - A*X^2)
-- <- X (1 + .5 - .5*A*X^2)
-- <- X(1.5 - .5*A*X^2)
-- Precision is doubled at each iteration.
-- Refine: 10 digits (PowerPc) or 8 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 20 digits (PowerPc) or 16 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 40 digits (PowerPc) or 32 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine (beyond the precision of Long_Float)
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
-- Empirical tests show the above iterations are inadequate in some
-- cases and that two more iterations are needed to converge. Other
-- algorithms may need to be explored. ???
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
Y := Y * (1.5 - X_Half * Y * Y);
-- This algorithm doesn't always provide exact results. For example,
-- Sqrt (25.0) /= 5.0 exactly (it's wrong in the last bit).
return Y;
end Rsqrt;
----------
-- Sqrt --
----------
function Sqrt (X : Long_Float) return Long_Float is
begin
if X <= 0.0 then
if X = 0.0 then
return X;
else
return NaN;
end if;
elsif not Long_Float'Machine_Overflows and then X = Infinity then
-- Note that if Machine_Overflow is True Infinity won't return.
-- But in that case, we can assume that X is not infinity.
return X;
else
return X * Rsqrt (X);
end if;
end Sqrt;
end System.Libm_Double.Squareroot;
|
28164
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . L I B M _ D O U B L E . S Q R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2014-2015, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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 is the Ada Cert Math specific implementation of sqrt (powerpc)
with Ada.Unchecked_Conversion;
with System.Machine_Code;
package body System.Libm_Double.Squareroot is
function Rsqrt (X : Long_Float) return Long_Float;
-- Compute the reciprocal square root. There are two reasons for computing
-- the reciprocal square root instead of computing directly the square
-- root: PowerPc provides an instruction (fsqrte) to compute an estimate of
-- the reciprocal (with 5 bits of precision), and the Newton-Raphson method
-- is more efficient on the reciprocal than on the direct root (because the
-- direct root needs divisions, while the reciprocal does not). Note that
-- PowerPc core e300 doesn't support the direct square root operation.
-----------
-- Rsqrt --
-----------
function Rsqrt (X : Long_Float) return Long_Float is
X_Half : constant Long_Float := X * 0.5;
Y, Y1 : Long_Float;
begin
if Standard'Target_Name = "powerpc-elf" then
-- On powerpc, the precision of fsqrte is at least 5 binary digits
System.Machine_Code.Asm ("frsqrte %0,%1",
Outputs => Long_Float'Asm_Output ("=f", Y),
Inputs => Long_Float'Asm_Input ("f", X));
else
-- Provide the exact result for 1.0
if X = 1.0 then
return X;
end if;
-- Use the method described in Fast Inverse Square Root article by
-- <NAME> (http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf),
-- although the code was known before that article.
declare
type Unsigned_Long is mod 2**64;
function To_Unsigned_Long is new Ada.Unchecked_Conversion
(Long_Float, Unsigned_Long);
function From_Unsigned_Long is new Ada.Unchecked_Conversion
(Unsigned_Long, Long_Float);
U : Unsigned_Long;
begin
U := To_Unsigned_Long (X);
U := 16#5fe6ec85_e7de30da# - (U / 2);
Y := From_Unsigned_Long (U);
-- Precision is about 4 digits
end;
end if;
-- Newton iterations: X <- X - F(X)/F'(X)
-- Here F(X) = 1/X^2 - A, so F'(X) = -2/X^3
-- So: X <- X - (1/X^2 - A) / (-2/X^3)
-- <- X + .5(X - A*X^3)
-- <- X + .5*X*(1 - A*X^2)
-- <- X (1 + .5 - .5*A*X^2)
-- <- X(1.5 - .5*A*X^2)
-- Precision is doubled at each iteration.
-- Refine: 10 digits (PowerPc) or 8 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 20 digits (PowerPc) or 16 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 40 digits (PowerPc) or 32 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine (beyond the precision of Long_Float)
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
-- Empirical tests show the above iterations are inadequate in some
-- cases and that two more iterations are needed to converge. Other
-- algorithms may need to be explored. ???
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
Y := Y * (1.5 - X_Half * Y * Y);
-- This algorithm doesn't always provide exact results. For example,
-- Sqrt (25.0) /= 5.0 exactly (it's wrong in the last bit).
return Y;
end Rsqrt;
----------
-- Sqrt --
----------
function Sqrt (X : Long_Float) return Long_Float is
begin
if X <= 0.0 then
if X = 0.0 then
return X;
else
return NaN;
end if;
elsif not Long_Float'Machine_Overflows and then X = Infinity then
-- Note that if Machine_Overflow is True Infinity won't return.
-- But in that case, we can assume that X is not infinity.
return X;
else
return X * Rsqrt (X);
end if;
end Sqrt;
end System.Libm_Double.Squareroot;
| true |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . L I B M _ D O U B L E . S Q R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2014-2015, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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 is the Ada Cert Math specific implementation of sqrt (powerpc)
with Ada.Unchecked_Conversion;
with System.Machine_Code;
package body System.Libm_Double.Squareroot is
function Rsqrt (X : Long_Float) return Long_Float;
-- Compute the reciprocal square root. There are two reasons for computing
-- the reciprocal square root instead of computing directly the square
-- root: PowerPc provides an instruction (fsqrte) to compute an estimate of
-- the reciprocal (with 5 bits of precision), and the Newton-Raphson method
-- is more efficient on the reciprocal than on the direct root (because the
-- direct root needs divisions, while the reciprocal does not). Note that
-- PowerPc core e300 doesn't support the direct square root operation.
-----------
-- Rsqrt --
-----------
function Rsqrt (X : Long_Float) return Long_Float is
X_Half : constant Long_Float := X * 0.5;
Y, Y1 : Long_Float;
begin
if Standard'Target_Name = "powerpc-elf" then
-- On powerpc, the precision of fsqrte is at least 5 binary digits
System.Machine_Code.Asm ("frsqrte %0,%1",
Outputs => Long_Float'Asm_Output ("=f", Y),
Inputs => Long_Float'Asm_Input ("f", X));
else
-- Provide the exact result for 1.0
if X = 1.0 then
return X;
end if;
-- Use the method described in Fast Inverse Square Root article by
-- PI:NAME:<NAME>END_PI (http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf),
-- although the code was known before that article.
declare
type Unsigned_Long is mod 2**64;
function To_Unsigned_Long is new Ada.Unchecked_Conversion
(Long_Float, Unsigned_Long);
function From_Unsigned_Long is new Ada.Unchecked_Conversion
(Unsigned_Long, Long_Float);
U : Unsigned_Long;
begin
U := To_Unsigned_Long (X);
U := 16#5fe6ec85_e7de30da# - (U / 2);
Y := From_Unsigned_Long (U);
-- Precision is about 4 digits
end;
end if;
-- Newton iterations: X <- X - F(X)/F'(X)
-- Here F(X) = 1/X^2 - A, so F'(X) = -2/X^3
-- So: X <- X - (1/X^2 - A) / (-2/X^3)
-- <- X + .5(X - A*X^3)
-- <- X + .5*X*(1 - A*X^2)
-- <- X (1 + .5 - .5*A*X^2)
-- <- X(1.5 - .5*A*X^2)
-- Precision is doubled at each iteration.
-- Refine: 10 digits (PowerPc) or 8 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 20 digits (PowerPc) or 16 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 40 digits (PowerPc) or 32 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine (beyond the precision of Long_Float)
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
-- Empirical tests show the above iterations are inadequate in some
-- cases and that two more iterations are needed to converge. Other
-- algorithms may need to be explored. ???
Y1 := Y * (1.5 - X_Half * Y * Y);
if Y = Y1 then
return Y1;
else
Y := Y1;
end if;
Y := Y * (1.5 - X_Half * Y * Y);
-- This algorithm doesn't always provide exact results. For example,
-- Sqrt (25.0) /= 5.0 exactly (it's wrong in the last bit).
return Y;
end Rsqrt;
----------
-- Sqrt --
----------
function Sqrt (X : Long_Float) return Long_Float is
begin
if X <= 0.0 then
if X = 0.0 then
return X;
else
return NaN;
end if;
elsif not Long_Float'Machine_Overflows and then X = Infinity then
-- Note that if Machine_Overflow is True Infinity won't return.
-- But in that case, we can assume that X is not infinity.
return X;
else
return X * Rsqrt (X);
end if;
end Sqrt;
end System.Libm_Double.Squareroot;
|
[
{
"context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- Licensed under the Apac",
"end": 44,
"score": 0.999879002571106,
"start": 22,
"tag": "NAME",
"value": "Bartek thindil Jasicki"
},
{
"context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- Licensed under the Apache License, Version",
"end": 63,
"score": 0.9999344944953918,
"start": 46,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/tk/tk-ttkwidget.adb
|
thindil/tashy2
| 2 |
-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings;
with Tcl.Lists; use Tcl.Lists;
package body Tk.TtkWidget is
procedure Option_Image
(Name: String; Value: Compound_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= EMPTY then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Compound_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Disabled_State_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= NONE then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Disabled_State_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Ttk_Image_Option;
Options_String: in out Unbounded_String) is
begin
if Value = Default_Ttk_Image_Option then
return;
end if;
Append
(Source => Options_String,
New_Item => " -" & Name & " {" & To_String(Source => Value.Default));
if Value.Active /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " active " & To_String(Source => Value.Active));
end if;
if Value.Disabled /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " disabled " & To_String(Source => Value.Disabled));
end if;
if Value.Focus /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " focus " & To_String(Source => Value.Focus));
end if;
if Value.Pressed /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " pressed " & To_String(Source => Value.Pressed));
end if;
if Value.Selected /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " selected " & To_String(Source => Value.Selected));
end if;
if Value.Background /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item =>
" background " & To_String(Source => Value.Background));
end if;
if Value.Readonly /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " readonly " & To_String(Source => Value.Readonly));
end if;
if Value.Alternate /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " alternate " & To_String(Source => Value.Alternate));
end if;
if Value.Invalid /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " invalid " & To_String(Source => Value.Invalid));
end if;
if Value.Hover /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " hover " & To_String(Source => Value.Hover));
end if;
Append(Source => Options_String, New_Item => "}");
end Option_Image;
procedure Option_Image
(Name: String; Value: Padding_Data;
Options_String: in out Unbounded_String) is
use Ada.Strings;
First: Boolean := True;
procedure Append_Value
(New_Value: Pixel_Data; Is_First: in out Boolean) is
begin
if New_Value.Value > -1.0 then
if Is_First then
Append
(Source => Options_String, New_Item => " -" & Name & " {");
Is_First := False;
end if;
Append
(Source => Options_String,
New_Item => Pixel_Data_Image(Value => New_Value) & " ");
end if;
end Append_Value;
begin
Append_Value(New_Value => Value.Left, Is_First => First);
Append_Value(New_Value => Value.Top, Is_First => First);
Append_Value(New_Value => Value.Right, Is_First => First);
Append_Value(New_Value => Value.Bottom, Is_First => First);
if not First then
Trim(Source => Options_String, Side => Right);
Append(Source => Options_String, New_Item => "}");
end if;
end Option_Image;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Compound_Type is
Result: constant String :=
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget", Options => "-" & Name)
.Result;
begin
if Result'Length = 0 then
return EMPTY;
end if;
return Compound_Type'Value(Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Disabled_State_Type is
begin
return
Disabled_State_Type'Value
(Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Ttk_Image_Option is
Options: Ttk_Image_Option := Default_Ttk_Image_Option;
Options_Array: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
Index: Positive := 2;
begin
if Options_Array'Length < 1 then
return Options;
end if;
Options.Default :=
To_Tcl_String(Source => To_String(Source => Options_Array(1)));
Set_Options_Loop :
while Index <= Options_Array'Length loop
if Options_Array(Index) = To_Tcl_String(Source => "active") then
Options.Active := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "disabled") then
Options.Disabled := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "focus") then
Options.Focus := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "pressed") then
Options.Pressed := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "selected") then
Options.Selected := Options_Array(Index + 1);
elsif Options_Array(Index) =
To_Tcl_String(Source => "background") then
Options.Background := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "readonly") then
Options.Readonly := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "alternate") then
Options.Alternate := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "invalid") then
Options.Invalid := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "hover") then
Options.Hover := Options_Array(Index + 1);
end if;
Index := Index + 2;
end loop Set_Options_Loop;
return Options;
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Padding_Data is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
if Result_List'Length = 0 then
return Empty_Padding_Data;
end if;
return Padding: Padding_Data := Empty_Padding_Data do
Padding.Left :=
Pixel_Data_Value(Value => To_Ada_String(Source => Result_List(1)));
if Result_List'Length > 1 then
Padding.Top :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(2)));
end if;
if Result_List'Length > 2 then
Padding.Right :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(3)));
end if;
if Result_List'Length = 4 then
Padding.Bottom :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(4)));
end if;
end return;
end Option_Value;
function In_State
(Ttk_Widgt: Ttk_Widget; State_Ttk: Ttk_State_Type) return Boolean is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options => To_Lower(Item => Ttk_State_Type'Image(State_Ttk)));
if Tcl_Get_Result(Interpreter => Tk_Interp(Widgt => Ttk_Widgt)) = 1 then
return True;
end if;
return False;
end In_State;
procedure In_State
(Ttk_Widgt: Ttk_Widget; State_Type: Ttk_State_Type;
Tcl_Script: Tcl_String) is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options =>
To_Lower(Item => Ttk_State_Type'Image(State_Type)) & " " &
To_String(Source => Tcl_Script));
end In_State;
procedure Set_State
(Ttk_Widgt: Ttk_Widget; Widget_State: Ttk_State_Type;
Disable: Boolean := False) is
begin
if Disable then
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options =>
"!" & To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
else
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options => To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
end if;
end Set_State;
function Get_States(Ttk_Widgt: Ttk_Widget) return Ttk_State_Array is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state")
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
return
States: Ttk_State_Array(1 .. Result_List'Last) :=
(others => Default_Ttk_State) do
Fill_Return_Value_Loop :
for I in 1 .. Result_List'Last loop
States(I) :=
Ttk_State_Type'Value(To_Ada_String(Source => Result_List(I)));
end loop Fill_Return_Value_Loop;
end return;
end Get_States;
end Tk.TtkWidget;
|
988
|
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- 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.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings;
with Tcl.Lists; use Tcl.Lists;
package body Tk.TtkWidget is
procedure Option_Image
(Name: String; Value: Compound_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= EMPTY then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Compound_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Disabled_State_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= NONE then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Disabled_State_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Ttk_Image_Option;
Options_String: in out Unbounded_String) is
begin
if Value = Default_Ttk_Image_Option then
return;
end if;
Append
(Source => Options_String,
New_Item => " -" & Name & " {" & To_String(Source => Value.Default));
if Value.Active /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " active " & To_String(Source => Value.Active));
end if;
if Value.Disabled /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " disabled " & To_String(Source => Value.Disabled));
end if;
if Value.Focus /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " focus " & To_String(Source => Value.Focus));
end if;
if Value.Pressed /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " pressed " & To_String(Source => Value.Pressed));
end if;
if Value.Selected /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " selected " & To_String(Source => Value.Selected));
end if;
if Value.Background /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item =>
" background " & To_String(Source => Value.Background));
end if;
if Value.Readonly /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " readonly " & To_String(Source => Value.Readonly));
end if;
if Value.Alternate /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " alternate " & To_String(Source => Value.Alternate));
end if;
if Value.Invalid /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " invalid " & To_String(Source => Value.Invalid));
end if;
if Value.Hover /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " hover " & To_String(Source => Value.Hover));
end if;
Append(Source => Options_String, New_Item => "}");
end Option_Image;
procedure Option_Image
(Name: String; Value: Padding_Data;
Options_String: in out Unbounded_String) is
use Ada.Strings;
First: Boolean := True;
procedure Append_Value
(New_Value: Pixel_Data; Is_First: in out Boolean) is
begin
if New_Value.Value > -1.0 then
if Is_First then
Append
(Source => Options_String, New_Item => " -" & Name & " {");
Is_First := False;
end if;
Append
(Source => Options_String,
New_Item => Pixel_Data_Image(Value => New_Value) & " ");
end if;
end Append_Value;
begin
Append_Value(New_Value => Value.Left, Is_First => First);
Append_Value(New_Value => Value.Top, Is_First => First);
Append_Value(New_Value => Value.Right, Is_First => First);
Append_Value(New_Value => Value.Bottom, Is_First => First);
if not First then
Trim(Source => Options_String, Side => Right);
Append(Source => Options_String, New_Item => "}");
end if;
end Option_Image;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Compound_Type is
Result: constant String :=
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget", Options => "-" & Name)
.Result;
begin
if Result'Length = 0 then
return EMPTY;
end if;
return Compound_Type'Value(Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Disabled_State_Type is
begin
return
Disabled_State_Type'Value
(Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Ttk_Image_Option is
Options: Ttk_Image_Option := Default_Ttk_Image_Option;
Options_Array: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
Index: Positive := 2;
begin
if Options_Array'Length < 1 then
return Options;
end if;
Options.Default :=
To_Tcl_String(Source => To_String(Source => Options_Array(1)));
Set_Options_Loop :
while Index <= Options_Array'Length loop
if Options_Array(Index) = To_Tcl_String(Source => "active") then
Options.Active := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "disabled") then
Options.Disabled := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "focus") then
Options.Focus := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "pressed") then
Options.Pressed := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "selected") then
Options.Selected := Options_Array(Index + 1);
elsif Options_Array(Index) =
To_Tcl_String(Source => "background") then
Options.Background := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "readonly") then
Options.Readonly := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "alternate") then
Options.Alternate := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "invalid") then
Options.Invalid := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "hover") then
Options.Hover := Options_Array(Index + 1);
end if;
Index := Index + 2;
end loop Set_Options_Loop;
return Options;
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Padding_Data is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
if Result_List'Length = 0 then
return Empty_Padding_Data;
end if;
return Padding: Padding_Data := Empty_Padding_Data do
Padding.Left :=
Pixel_Data_Value(Value => To_Ada_String(Source => Result_List(1)));
if Result_List'Length > 1 then
Padding.Top :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(2)));
end if;
if Result_List'Length > 2 then
Padding.Right :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(3)));
end if;
if Result_List'Length = 4 then
Padding.Bottom :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(4)));
end if;
end return;
end Option_Value;
function In_State
(Ttk_Widgt: Ttk_Widget; State_Ttk: Ttk_State_Type) return Boolean is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options => To_Lower(Item => Ttk_State_Type'Image(State_Ttk)));
if Tcl_Get_Result(Interpreter => Tk_Interp(Widgt => Ttk_Widgt)) = 1 then
return True;
end if;
return False;
end In_State;
procedure In_State
(Ttk_Widgt: Ttk_Widget; State_Type: Ttk_State_Type;
Tcl_Script: Tcl_String) is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options =>
To_Lower(Item => Ttk_State_Type'Image(State_Type)) & " " &
To_String(Source => Tcl_Script));
end In_State;
procedure Set_State
(Ttk_Widgt: Ttk_Widget; Widget_State: Ttk_State_Type;
Disable: Boolean := False) is
begin
if Disable then
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options =>
"!" & To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
else
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options => To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
end if;
end Set_State;
function Get_States(Ttk_Widgt: Ttk_Widget) return Ttk_State_Array is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state")
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
return
States: Ttk_State_Array(1 .. Result_List'Last) :=
(others => Default_Ttk_State) do
Fill_Return_Value_Loop :
for I in 1 .. Result_List'Last loop
States(I) :=
Ttk_State_Type'Value(To_Ada_String(Source => Result_List(I)));
end loop Fill_Return_Value_Loop;
end return;
end Get_States;
end Tk.TtkWidget;
| true |
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- 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.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings;
with Tcl.Lists; use Tcl.Lists;
package body Tk.TtkWidget is
procedure Option_Image
(Name: String; Value: Compound_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= EMPTY then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Compound_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Disabled_State_Type;
Options_String: in out Unbounded_String) is
begin
if Value /= NONE then
Append
(Source => Options_String,
New_Item =>
" -" & Name & " " &
To_Lower(Item => Disabled_State_Type'Image(Value)));
end if;
end Option_Image;
procedure Option_Image
(Name: String; Value: Ttk_Image_Option;
Options_String: in out Unbounded_String) is
begin
if Value = Default_Ttk_Image_Option then
return;
end if;
Append
(Source => Options_String,
New_Item => " -" & Name & " {" & To_String(Source => Value.Default));
if Value.Active /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " active " & To_String(Source => Value.Active));
end if;
if Value.Disabled /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " disabled " & To_String(Source => Value.Disabled));
end if;
if Value.Focus /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " focus " & To_String(Source => Value.Focus));
end if;
if Value.Pressed /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " pressed " & To_String(Source => Value.Pressed));
end if;
if Value.Selected /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " selected " & To_String(Source => Value.Selected));
end if;
if Value.Background /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item =>
" background " & To_String(Source => Value.Background));
end if;
if Value.Readonly /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " readonly " & To_String(Source => Value.Readonly));
end if;
if Value.Alternate /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " alternate " & To_String(Source => Value.Alternate));
end if;
if Value.Invalid /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " invalid " & To_String(Source => Value.Invalid));
end if;
if Value.Hover /= Tcl_String(Null_Unbounded_String) then
Append
(Source => Options_String,
New_Item => " hover " & To_String(Source => Value.Hover));
end if;
Append(Source => Options_String, New_Item => "}");
end Option_Image;
procedure Option_Image
(Name: String; Value: Padding_Data;
Options_String: in out Unbounded_String) is
use Ada.Strings;
First: Boolean := True;
procedure Append_Value
(New_Value: Pixel_Data; Is_First: in out Boolean) is
begin
if New_Value.Value > -1.0 then
if Is_First then
Append
(Source => Options_String, New_Item => " -" & Name & " {");
Is_First := False;
end if;
Append
(Source => Options_String,
New_Item => Pixel_Data_Image(Value => New_Value) & " ");
end if;
end Append_Value;
begin
Append_Value(New_Value => Value.Left, Is_First => First);
Append_Value(New_Value => Value.Top, Is_First => First);
Append_Value(New_Value => Value.Right, Is_First => First);
Append_Value(New_Value => Value.Bottom, Is_First => First);
if not First then
Trim(Source => Options_String, Side => Right);
Append(Source => Options_String, New_Item => "}");
end if;
end Option_Image;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Compound_Type is
Result: constant String :=
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget", Options => "-" & Name)
.Result;
begin
if Result'Length = 0 then
return EMPTY;
end if;
return Compound_Type'Value(Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Disabled_State_Type is
begin
return
Disabled_State_Type'Value
(Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result);
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Ttk_Image_Option is
Options: Ttk_Image_Option := Default_Ttk_Image_Option;
Options_Array: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
Index: Positive := 2;
begin
if Options_Array'Length < 1 then
return Options;
end if;
Options.Default :=
To_Tcl_String(Source => To_String(Source => Options_Array(1)));
Set_Options_Loop :
while Index <= Options_Array'Length loop
if Options_Array(Index) = To_Tcl_String(Source => "active") then
Options.Active := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "disabled") then
Options.Disabled := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "focus") then
Options.Focus := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "pressed") then
Options.Pressed := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "selected") then
Options.Selected := Options_Array(Index + 1);
elsif Options_Array(Index) =
To_Tcl_String(Source => "background") then
Options.Background := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "readonly") then
Options.Readonly := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "alternate") then
Options.Alternate := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "invalid") then
Options.Invalid := Options_Array(Index + 1);
elsif Options_Array(Index) = To_Tcl_String(Source => "hover") then
Options.Hover := Options_Array(Index + 1);
end if;
Index := Index + 2;
end loop Set_Options_Loop;
return Options;
end Option_Value;
function Option_Value
(Ttk_Widgt: Ttk_Widget; Name: String) return Padding_Data is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "cget",
Options => "-" & Name)
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
if Result_List'Length = 0 then
return Empty_Padding_Data;
end if;
return Padding: Padding_Data := Empty_Padding_Data do
Padding.Left :=
Pixel_Data_Value(Value => To_Ada_String(Source => Result_List(1)));
if Result_List'Length > 1 then
Padding.Top :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(2)));
end if;
if Result_List'Length > 2 then
Padding.Right :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(3)));
end if;
if Result_List'Length = 4 then
Padding.Bottom :=
Pixel_Data_Value
(Value => To_Ada_String(Source => Result_List(4)));
end if;
end return;
end Option_Value;
function In_State
(Ttk_Widgt: Ttk_Widget; State_Ttk: Ttk_State_Type) return Boolean is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options => To_Lower(Item => Ttk_State_Type'Image(State_Ttk)));
if Tcl_Get_Result(Interpreter => Tk_Interp(Widgt => Ttk_Widgt)) = 1 then
return True;
end if;
return False;
end In_State;
procedure In_State
(Ttk_Widgt: Ttk_Widget; State_Type: Ttk_State_Type;
Tcl_Script: Tcl_String) is
begin
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "instate",
Options =>
To_Lower(Item => Ttk_State_Type'Image(State_Type)) & " " &
To_String(Source => Tcl_Script));
end In_State;
procedure Set_State
(Ttk_Widgt: Ttk_Widget; Widget_State: Ttk_State_Type;
Disable: Boolean := False) is
begin
if Disable then
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options =>
"!" & To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
else
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state",
Options => To_Lower(Item => Ttk_State_Type'Image(Widget_State)));
end if;
end Set_State;
function Get_States(Ttk_Widgt: Ttk_Widget) return Ttk_State_Array is
Result_List: constant Array_List :=
Split_List
(List =>
Execute_Widget_Command
(Widgt => Ttk_Widgt, Command_Name => "state")
.Result,
Interpreter => Tk_Interp(Widgt => Ttk_Widgt));
begin
return
States: Ttk_State_Array(1 .. Result_List'Last) :=
(others => Default_Ttk_State) do
Fill_Return_Value_Loop :
for I in 1 .. Result_List'Last loop
States(I) :=
Ttk_State_Type'Value(To_Ada_String(Source => Result_List(I)));
end loop Fill_Return_Value_Loop;
end return;
end Get_States;
end Tk.TtkWidget;
|
[
{
"context": "Generic ADT for one-way linked lists\n-- | Author: Michael B. Feldman, The George Washington University\n-- | Last Modi",
"end": 4333,
"score": 0.9998524188995361,
"start": 4315,
"tag": "NAME",
"value": "Michael B. Feldman"
}
] |
source/list.ads
|
bracke/Meaning
| 0 |
--------------------------------------------------------------------------------
-- --
-- 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 List types and methods.
-- $Author$
-- $Date$
-- $Revision$
with HandlerList; use HandlerList;
package List is
type Position is private;
type List is limited private;
type ListPointer is access List;
-- raised if no space left for a new node
OutOfSpace : exception;
-- raised if a Position is past the end
PastEnd : exception;
-- raised if a Position is before the begin
PastBegin : exception;
EmptyList : exception;
--
-- Pre: L and X are defined
-- Post: a node containing X is inserted
-- at the front or rear of L, respectively
--
procedure AddToRear (L : in out List; X : HandlerList.ListPointer);
function First (L : List) return Position;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: returns the value of the element at position P
-- Raises: EmptyList if L is empty
-- PastBegin if P points before the beginning of L
-- PastEnd if P points beyond the end of L
--
function Retrieve (L : in List; P : in Position)
return HandlerList.ListPointer;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: the node at position P of L is deleted
-- Raises: EmptyList if L is empty
-- PastBegin if P is NULL
--
procedure Delete (L : in out List; P : Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is advanced to designate the next node of L
-- Raises: EmptyList if L is empty
-- PastEnd if P points beyond the end of L
--
procedure GoAhead (L : List; P : in out Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is moved to designate the previous node of L
-- Raises: EmptyList if L is empty
-- PastBegin if P points beyond the end of L
--
procedure GoBack (L : List; P : in out Position);
function IsEmpty (L : List) return Boolean;
function IsFirst (L : List; P : Position) return Boolean;
function IsLast (L : List; P : Position) return Boolean;
function IsPastEnd (L : List; P : Position) return Boolean;
--
-- Pre: L and P are defined
-- Post: return True iff the condition is met; False otherwise
--
function IsPastBegin (L : List; P : Position) return Boolean;
private
type Node;
type Position is access Node;
type Node is record
Info : HandlerList.Listpointer;
Link : Position;
end record;
type List is record
Head : Position;
Tail : Position;
end record;
------------------------------------------------------------------------
-- | Generic ADT for one-way linked lists
-- | Author: Michael B. Feldman, The George Washington University
-- | Last Modified: January 1996
------------------------------------------------------------------------
end List;
|
9120
|
--------------------------------------------------------------------------------
-- --
-- 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 List types and methods.
-- $Author$
-- $Date$
-- $Revision$
with HandlerList; use HandlerList;
package List is
type Position is private;
type List is limited private;
type ListPointer is access List;
-- raised if no space left for a new node
OutOfSpace : exception;
-- raised if a Position is past the end
PastEnd : exception;
-- raised if a Position is before the begin
PastBegin : exception;
EmptyList : exception;
--
-- Pre: L and X are defined
-- Post: a node containing X is inserted
-- at the front or rear of L, respectively
--
procedure AddToRear (L : in out List; X : HandlerList.ListPointer);
function First (L : List) return Position;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: returns the value of the element at position P
-- Raises: EmptyList if L is empty
-- PastBegin if P points before the beginning of L
-- PastEnd if P points beyond the end of L
--
function Retrieve (L : in List; P : in Position)
return HandlerList.ListPointer;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: the node at position P of L is deleted
-- Raises: EmptyList if L is empty
-- PastBegin if P is NULL
--
procedure Delete (L : in out List; P : Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is advanced to designate the next node of L
-- Raises: EmptyList if L is empty
-- PastEnd if P points beyond the end of L
--
procedure GoAhead (L : List; P : in out Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is moved to designate the previous node of L
-- Raises: EmptyList if L is empty
-- PastBegin if P points beyond the end of L
--
procedure GoBack (L : List; P : in out Position);
function IsEmpty (L : List) return Boolean;
function IsFirst (L : List; P : Position) return Boolean;
function IsLast (L : List; P : Position) return Boolean;
function IsPastEnd (L : List; P : Position) return Boolean;
--
-- Pre: L and P are defined
-- Post: return True iff the condition is met; False otherwise
--
function IsPastBegin (L : List; P : Position) return Boolean;
private
type Node;
type Position is access Node;
type Node is record
Info : HandlerList.Listpointer;
Link : Position;
end record;
type List is record
Head : Position;
Tail : Position;
end record;
------------------------------------------------------------------------
-- | Generic ADT for one-way linked lists
-- | Author: <NAME>, The George Washington University
-- | Last Modified: January 1996
------------------------------------------------------------------------
end List;
| true |
--------------------------------------------------------------------------------
-- --
-- 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 List types and methods.
-- $Author$
-- $Date$
-- $Revision$
with HandlerList; use HandlerList;
package List is
type Position is private;
type List is limited private;
type ListPointer is access List;
-- raised if no space left for a new node
OutOfSpace : exception;
-- raised if a Position is past the end
PastEnd : exception;
-- raised if a Position is before the begin
PastBegin : exception;
EmptyList : exception;
--
-- Pre: L and X are defined
-- Post: a node containing X is inserted
-- at the front or rear of L, respectively
--
procedure AddToRear (L : in out List; X : HandlerList.ListPointer);
function First (L : List) return Position;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: returns the value of the element at position P
-- Raises: EmptyList if L is empty
-- PastBegin if P points before the beginning of L
-- PastEnd if P points beyond the end of L
--
function Retrieve (L : in List; P : in Position)
return HandlerList.ListPointer;
--
-- Pre: L and P are defined; P designates a node in L
-- Post: the node at position P of L is deleted
-- Raises: EmptyList if L is empty
-- PastBegin if P is NULL
--
procedure Delete (L : in out List; P : Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is advanced to designate the next node of L
-- Raises: EmptyList if L is empty
-- PastEnd if P points beyond the end of L
--
procedure GoAhead (L : List; P : in out Position);
--
-- Pre: L and P are defined; P designates a node in L
-- Post: P is moved to designate the previous node of L
-- Raises: EmptyList if L is empty
-- PastBegin if P points beyond the end of L
--
procedure GoBack (L : List; P : in out Position);
function IsEmpty (L : List) return Boolean;
function IsFirst (L : List; P : Position) return Boolean;
function IsLast (L : List; P : Position) return Boolean;
function IsPastEnd (L : List; P : Position) return Boolean;
--
-- Pre: L and P are defined
-- Post: return True iff the condition is met; False otherwise
--
function IsPastBegin (L : List; P : Position) return Boolean;
private
type Node;
type Position is access Node;
type Node is record
Info : HandlerList.Listpointer;
Link : Position;
end record;
type List is record
Head : Position;
Tail : Position;
end record;
------------------------------------------------------------------------
-- | Generic ADT for one-way linked lists
-- | Author: PI:NAME:<NAME>END_PI, The George Washington University
-- | Last Modified: January 1996
------------------------------------------------------------------------
end List;
|
[
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- Al",
"end": 824,
"score": 0.9998825192451477,
"start": 811,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 844,
"score": 0.9999333024024963,
"start": 826,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/league/codecs/matreshka-internals-text_codecs-iso88595.adb
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Internals.Strings.Configuration;
with Matreshka.Internals.Unicode.Characters.Latin;
with Matreshka.Internals.Utf16;
package body Matreshka.Internals.Text_Codecs.ISO88595 is
use Matreshka.Internals.Strings.Configuration;
use Matreshka.Internals.Unicode.Characters.Latin;
use type Matreshka.Internals.Unicode.Code_Unit_32;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
-------------------
-- Decode_Append --
-------------------
overriding procedure Decode_Append
(Self : in out ISO88595_Decoder;
Data : Ada.Streams.Stream_Element_Array;
String : in out Matreshka.Internals.Strings.Shared_String_Access) is
begin
Matreshka.Internals.Strings.Mutate (String, String.Unused + Data'Length);
for J in Data'Range loop
case Data (J) is
when 16#00# .. 16#A0# | 16#AD# =>
-- Directly mapped.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J)));
when 16#F0# =>
-- NUMERO SIGN
Self.Unchecked_Append (Self, String, 16#2116#);
when 16#FD# =>
-- SECTION SIGN
Self.Unchecked_Append (Self, String, 16#A7#);
when 16#A1# .. 16#AC#
| 16#AE# .. 16#EF#
| 16#F1# .. 16#FC#
| 16#FE# .. 16#FF#
=>
-- Computed.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J))
- 16#A0# + 16#0400#);
end case;
end loop;
String_Handler.Fill_Null_Terminator (String);
end Decode_Append;
-------------
-- Decoder --
-------------
function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class is
begin
case Mode is
when Raw =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_Raw'Access);
when XML_1_0 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML10'Access);
when XML_1_1 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML11'Access);
end case;
end Decoder;
------------
-- Encode --
------------
overriding procedure Encode
(Self : in out ISO88595_Encoder;
String : not null Matreshka.Internals.Strings.Shared_String_Access;
Buffer : out MISEV.Shared_Stream_Element_Vector_Access)
is
pragma Unreferenced (Self);
use Matreshka.Internals.Stream_Element_Vectors;
use Ada.Streams;
Code : Matreshka.Internals.Unicode.Code_Point;
Position : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
Element : Ada.Streams.Stream_Element;
begin
if String.Unused = 0 then
Buffer := Empty_Shared_Stream_Element_Vector'Access;
else
Buffer :=
Allocate (Ada.Streams.Stream_Element_Offset (String.Unused));
while Position < String.Unused loop
Matreshka.Internals.Utf16.Unchecked_Next
(String.Value, Position, Code);
if Code in 16#0000# .. 16#00A0# then
-- Direct mapping.
Element := Stream_Element (Code);
elsif Code = 16#00A7# then
Element := 16#FD#; -- SECTION SIGN
elsif Code = 16#00AD# then
Element := 16#AD#; -- SOFT HYPHEN
elsif Code = 16#2116# then
Element := 16#F0#; -- NUMERO SIGN
elsif Code in 16#0401# .. 16#40C#
or Code in 16#040E# .. 16#044F#
or Code in 16#0451# .. 16#045C#
or Code in 16#045E# .. 16#045F#
then
-- Computable mapping.
Element := Stream_Element (Code - 16#0400#) + 16#A0#;
else
Element := Question_Mark;
end if;
Buffer.Value (Buffer.Length) := Element;
Buffer.Length := Buffer.Length + 1;
end loop;
end if;
end Encode;
-------------
-- Encoder --
-------------
function Encoder return Abstract_Encoder'Class is
begin
return ISO88595_Encoder'(null record);
end Encoder;
--------------
-- Is_Error --
--------------
overriding function Is_Error (Self : ISO88595_Decoder) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Error;
-------------------
-- Is_Mailformed --
-------------------
overriding function Is_Mailformed
(Self : ISO88595_Decoder) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Mailformed;
end Matreshka.Internals.Text_Codecs.ISO88595;
|
8669
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- 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.Internals.Strings.Configuration;
with Matreshka.Internals.Unicode.Characters.Latin;
with Matreshka.Internals.Utf16;
package body Matreshka.Internals.Text_Codecs.ISO88595 is
use Matreshka.Internals.Strings.Configuration;
use Matreshka.Internals.Unicode.Characters.Latin;
use type Matreshka.Internals.Unicode.Code_Unit_32;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
-------------------
-- Decode_Append --
-------------------
overriding procedure Decode_Append
(Self : in out ISO88595_Decoder;
Data : Ada.Streams.Stream_Element_Array;
String : in out Matreshka.Internals.Strings.Shared_String_Access) is
begin
Matreshka.Internals.Strings.Mutate (String, String.Unused + Data'Length);
for J in Data'Range loop
case Data (J) is
when 16#00# .. 16#A0# | 16#AD# =>
-- Directly mapped.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J)));
when 16#F0# =>
-- NUMERO SIGN
Self.Unchecked_Append (Self, String, 16#2116#);
when 16#FD# =>
-- SECTION SIGN
Self.Unchecked_Append (Self, String, 16#A7#);
when 16#A1# .. 16#AC#
| 16#AE# .. 16#EF#
| 16#F1# .. 16#FC#
| 16#FE# .. 16#FF#
=>
-- Computed.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J))
- 16#A0# + 16#0400#);
end case;
end loop;
String_Handler.Fill_Null_Terminator (String);
end Decode_Append;
-------------
-- Decoder --
-------------
function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class is
begin
case Mode is
when Raw =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_Raw'Access);
when XML_1_0 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML10'Access);
when XML_1_1 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML11'Access);
end case;
end Decoder;
------------
-- Encode --
------------
overriding procedure Encode
(Self : in out ISO88595_Encoder;
String : not null Matreshka.Internals.Strings.Shared_String_Access;
Buffer : out MISEV.Shared_Stream_Element_Vector_Access)
is
pragma Unreferenced (Self);
use Matreshka.Internals.Stream_Element_Vectors;
use Ada.Streams;
Code : Matreshka.Internals.Unicode.Code_Point;
Position : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
Element : Ada.Streams.Stream_Element;
begin
if String.Unused = 0 then
Buffer := Empty_Shared_Stream_Element_Vector'Access;
else
Buffer :=
Allocate (Ada.Streams.Stream_Element_Offset (String.Unused));
while Position < String.Unused loop
Matreshka.Internals.Utf16.Unchecked_Next
(String.Value, Position, Code);
if Code in 16#0000# .. 16#00A0# then
-- Direct mapping.
Element := Stream_Element (Code);
elsif Code = 16#00A7# then
Element := 16#FD#; -- SECTION SIGN
elsif Code = 16#00AD# then
Element := 16#AD#; -- SOFT HYPHEN
elsif Code = 16#2116# then
Element := 16#F0#; -- NUMERO SIGN
elsif Code in 16#0401# .. 16#40C#
or Code in 16#040E# .. 16#044F#
or Code in 16#0451# .. 16#045C#
or Code in 16#045E# .. 16#045F#
then
-- Computable mapping.
Element := Stream_Element (Code - 16#0400#) + 16#A0#;
else
Element := Question_Mark;
end if;
Buffer.Value (Buffer.Length) := Element;
Buffer.Length := Buffer.Length + 1;
end loop;
end if;
end Encode;
-------------
-- Encoder --
-------------
function Encoder return Abstract_Encoder'Class is
begin
return ISO88595_Encoder'(null record);
end Encoder;
--------------
-- Is_Error --
--------------
overriding function Is_Error (Self : ISO88595_Decoder) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Error;
-------------------
-- Is_Mailformed --
-------------------
overriding function Is_Mailformed
(Self : ISO88595_Decoder) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Mailformed;
end Matreshka.Internals.Text_Codecs.ISO88595;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- 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.Internals.Strings.Configuration;
with Matreshka.Internals.Unicode.Characters.Latin;
with Matreshka.Internals.Utf16;
package body Matreshka.Internals.Text_Codecs.ISO88595 is
use Matreshka.Internals.Strings.Configuration;
use Matreshka.Internals.Unicode.Characters.Latin;
use type Matreshka.Internals.Unicode.Code_Unit_32;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
-------------------
-- Decode_Append --
-------------------
overriding procedure Decode_Append
(Self : in out ISO88595_Decoder;
Data : Ada.Streams.Stream_Element_Array;
String : in out Matreshka.Internals.Strings.Shared_String_Access) is
begin
Matreshka.Internals.Strings.Mutate (String, String.Unused + Data'Length);
for J in Data'Range loop
case Data (J) is
when 16#00# .. 16#A0# | 16#AD# =>
-- Directly mapped.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J)));
when 16#F0# =>
-- NUMERO SIGN
Self.Unchecked_Append (Self, String, 16#2116#);
when 16#FD# =>
-- SECTION SIGN
Self.Unchecked_Append (Self, String, 16#A7#);
when 16#A1# .. 16#AC#
| 16#AE# .. 16#EF#
| 16#F1# .. 16#FC#
| 16#FE# .. 16#FF#
=>
-- Computed.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J))
- 16#A0# + 16#0400#);
end case;
end loop;
String_Handler.Fill_Null_Terminator (String);
end Decode_Append;
-------------
-- Decoder --
-------------
function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class is
begin
case Mode is
when Raw =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_Raw'Access);
when XML_1_0 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML10'Access);
when XML_1_1 =>
return
ISO88595_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML11'Access);
end case;
end Decoder;
------------
-- Encode --
------------
overriding procedure Encode
(Self : in out ISO88595_Encoder;
String : not null Matreshka.Internals.Strings.Shared_String_Access;
Buffer : out MISEV.Shared_Stream_Element_Vector_Access)
is
pragma Unreferenced (Self);
use Matreshka.Internals.Stream_Element_Vectors;
use Ada.Streams;
Code : Matreshka.Internals.Unicode.Code_Point;
Position : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
Element : Ada.Streams.Stream_Element;
begin
if String.Unused = 0 then
Buffer := Empty_Shared_Stream_Element_Vector'Access;
else
Buffer :=
Allocate (Ada.Streams.Stream_Element_Offset (String.Unused));
while Position < String.Unused loop
Matreshka.Internals.Utf16.Unchecked_Next
(String.Value, Position, Code);
if Code in 16#0000# .. 16#00A0# then
-- Direct mapping.
Element := Stream_Element (Code);
elsif Code = 16#00A7# then
Element := 16#FD#; -- SECTION SIGN
elsif Code = 16#00AD# then
Element := 16#AD#; -- SOFT HYPHEN
elsif Code = 16#2116# then
Element := 16#F0#; -- NUMERO SIGN
elsif Code in 16#0401# .. 16#40C#
or Code in 16#040E# .. 16#044F#
or Code in 16#0451# .. 16#045C#
or Code in 16#045E# .. 16#045F#
then
-- Computable mapping.
Element := Stream_Element (Code - 16#0400#) + 16#A0#;
else
Element := Question_Mark;
end if;
Buffer.Value (Buffer.Length) := Element;
Buffer.Length := Buffer.Length + 1;
end loop;
end if;
end Encode;
-------------
-- Encoder --
-------------
function Encoder return Abstract_Encoder'Class is
begin
return ISO88595_Encoder'(null record);
end Encoder;
--------------
-- Is_Error --
--------------
overriding function Is_Error (Self : ISO88595_Decoder) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Error;
-------------------
-- Is_Mailformed --
-------------------
overriding function Is_Mailformed
(Self : ISO88595_Decoder) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Mailformed;
end Matreshka.Internals.Text_Codecs.ISO88595;
|
[
{
"context": "ems (RCS)\n-- Project: StratoX\n--\n-- Authors: Martin Becker ([email protected])\nwith HIL.Buzzer;\nwith Ada.",
"end": 153,
"score": 0.9998466372489929,
"start": 140,
"tag": "NAME",
"value": "Martin Becker"
},
{
"context": "oject: StratoX\n--\n-- Authors: Martin Becker ([email protected])\nwith HIL.Buzzer;\nwith Ada.Real_Time; use Ada.Rea",
"end": 175,
"score": 0.9999324679374695,
"start": 155,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
software/modules/buzzer_manager.adb
|
TUM-EI-RCS/StratoX
| 12 |
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: Martin Becker ([email protected])
with HIL.Buzzer;
with Ada.Real_Time; use Ada.Real_Time;
with Types;
-- @summary
-- Interface to use a buzzer/beeper.
package body Buzzer_Manager with SPARK_Mode is
type state is (BOFF, BINIT, BDUTY, BWAIT);
--------------------
-- internal state
--------------------
cur_state : state := BOFF;
cur_length_ms : Natural := 100;
cur_pause_ms : Natural := 1900;
cur_freq : Frequency_Type := 1000.0 * Hertz;
cur_reps : Natural := 0;
infinite : Boolean := False;
t_next : Ada.Real_Time.Time;
is_configured : Boolean := False;
--------------
-- specs
--------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time);
procedure Set_Freq (f : in Frequency_Type) with Pre => Valid_Frequency (f);
procedure Enable_Statemachine;
procedure Disable_Statemachine;
-------------------------
-- Enable_Statemachine --
-------------------------
procedure Enable_Statemachine is
begin
if is_configured and cur_state = BOFF then
cur_state := BINIT;
t_next := Ada.Real_Time.Clock;
end if;
end Enable_Statemachine;
------------------
-- Change_State --
------------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time) is
cand_newstate : state := newstate;
begin
if cur_state /= newstate then
case newstate is
when BDUTY =>
if not infinite then
-- finite mode...countdown
if cur_reps > 0 then
cur_reps := cur_reps - 1;
HIL.Buzzer.Enable;
else
HIL.Buzzer.Disable;
cand_newstate := BOFF;
end if;
else
-- infinite mode
HIL.Buzzer.Enable;
end if;
t_next := now + Milliseconds (cur_length_ms);
when others =>
HIL.Buzzer.Disable;
t_next := now + Milliseconds (cur_pause_ms);
end case;
cur_state := cand_newstate;
end if;
end Change_State;
----------
-- Tick --
----------
procedure Tick is
next_state : state;
now : Ada.Real_Time.Time;
begin
if cur_state /= BOFF then
now := Ada.Real_Time.Clock;
if now >= t_next then
case cur_state is
when BWAIT => next_state := BDUTY;
when BDUTY => next_state := BWAIT;
when others => next_state := BDUTY;
end case;
Change_State (next_state, now);
end if;
end if;
end Tick;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
HIL.Buzzer.Initialize;
Reconfigure_Buzzer; -- apply defaults
HIL.Buzzer.Disable;
end Initialize;
--------------------------
-- Disable_Statemachine --
--------------------------
procedure Disable_Statemachine is
now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock;
begin
infinite := False;
Change_State (BOFF, now);
end Disable_Statemachine;
------------------------
-- Reconfigure_Buzzer --
------------------------
procedure Reconfigure_Buzzer is
begin
if HIL.Buzzer.Valid_Frequency (cur_freq) then
HIL.Buzzer.Set_Frequency (cur_freq);
is_configured := True;
end if;
end Reconfigure_Buzzer;
-- function Tone_To_Frequency (tone : Tone_Type) return Frequency_Type is
-- f : Frequency_Type;
-- subtype octave_modifier is Unit_Type;
-- o : constant octave_modifier := octave_modifier (tone.octave - 2);
-- begin
-- -- frequencies for octave 3 (small octave)
-- case tone.name is
-- when 'c' => f := 130.813 * Hertz;
-- when 'd' => f := 146.832 * Hertz;
-- when 'e' => f := 164.814 * Hertz;
-- when 'f' => f := 174.614 * Hertz;
-- when 'g' => f := 195.998 * Hertz;
-- when 'a' => f := 220.000 * Hertz;
-- when 'b' => f := 246.942 * Hertz;
-- end case;
-- -- now multiply with octave above 3
-- f := f * o;
-- return f;
-- end Tone_To_Frequency;
--
-- procedure Set_Tone (t : Tone_Type) is
-- f : constant Frequency_Type := Tone_To_Frequency (t);
-- begin
-- Set_Freq (f);
-- end Set_Tone;
--------------
-- Set_Freq --
--------------
procedure Set_Freq (f : in Frequency_Type) is
begin
cur_freq := f;
Reconfigure_Buzzer;
end Set_Freq;
----------
-- Beep --
----------
procedure Beep
(f : in Frequency_Type;
Reps : Natural;
Period : Time_Type;
Length : in Time_Type)
is
function Sat_Sub_Time is new
Units.Saturated_Subtraction (Time_Type);
function To_Millisec (t : Time_Type) return Natural;
function To_Millisec (t : Time_Type) return Natural is
ms : Float;
begin
if abs (Float (t)) >= Float'Last / 1000.0 then
ms := Float'Last;
else
ms := Float (t) * 1000.0;
end if;
return Types.Sat_Cast_Natural (ms);
end To_Millisec;
begin
if not Valid_Frequency (f) or
Period <= Length or
Period = 0.0 * Second or
Length = 0.0 * Second
then
Disable_Statemachine;
return;
end if;
cur_reps := Reps;
infinite := (Reps = 0);
declare
cur_pause : constant Time_Type := Sat_Sub_Time (Period, Length);
cur_length : constant Time_Type := Length;
begin
cur_pause_ms := To_Millisec (cur_pause);
cur_length_ms := To_Millisec (cur_length);
end;
if f /= cur_freq then
Set_Freq (f);
end if;
Enable_Statemachine;
end Beep;
end Buzzer_Manager;
|
5811
|
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: <NAME> (<EMAIL>)
with HIL.Buzzer;
with Ada.Real_Time; use Ada.Real_Time;
with Types;
-- @summary
-- Interface to use a buzzer/beeper.
package body Buzzer_Manager with SPARK_Mode is
type state is (BOFF, BINIT, BDUTY, BWAIT);
--------------------
-- internal state
--------------------
cur_state : state := BOFF;
cur_length_ms : Natural := 100;
cur_pause_ms : Natural := 1900;
cur_freq : Frequency_Type := 1000.0 * Hertz;
cur_reps : Natural := 0;
infinite : Boolean := False;
t_next : Ada.Real_Time.Time;
is_configured : Boolean := False;
--------------
-- specs
--------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time);
procedure Set_Freq (f : in Frequency_Type) with Pre => Valid_Frequency (f);
procedure Enable_Statemachine;
procedure Disable_Statemachine;
-------------------------
-- Enable_Statemachine --
-------------------------
procedure Enable_Statemachine is
begin
if is_configured and cur_state = BOFF then
cur_state := BINIT;
t_next := Ada.Real_Time.Clock;
end if;
end Enable_Statemachine;
------------------
-- Change_State --
------------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time) is
cand_newstate : state := newstate;
begin
if cur_state /= newstate then
case newstate is
when BDUTY =>
if not infinite then
-- finite mode...countdown
if cur_reps > 0 then
cur_reps := cur_reps - 1;
HIL.Buzzer.Enable;
else
HIL.Buzzer.Disable;
cand_newstate := BOFF;
end if;
else
-- infinite mode
HIL.Buzzer.Enable;
end if;
t_next := now + Milliseconds (cur_length_ms);
when others =>
HIL.Buzzer.Disable;
t_next := now + Milliseconds (cur_pause_ms);
end case;
cur_state := cand_newstate;
end if;
end Change_State;
----------
-- Tick --
----------
procedure Tick is
next_state : state;
now : Ada.Real_Time.Time;
begin
if cur_state /= BOFF then
now := Ada.Real_Time.Clock;
if now >= t_next then
case cur_state is
when BWAIT => next_state := BDUTY;
when BDUTY => next_state := BWAIT;
when others => next_state := BDUTY;
end case;
Change_State (next_state, now);
end if;
end if;
end Tick;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
HIL.Buzzer.Initialize;
Reconfigure_Buzzer; -- apply defaults
HIL.Buzzer.Disable;
end Initialize;
--------------------------
-- Disable_Statemachine --
--------------------------
procedure Disable_Statemachine is
now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock;
begin
infinite := False;
Change_State (BOFF, now);
end Disable_Statemachine;
------------------------
-- Reconfigure_Buzzer --
------------------------
procedure Reconfigure_Buzzer is
begin
if HIL.Buzzer.Valid_Frequency (cur_freq) then
HIL.Buzzer.Set_Frequency (cur_freq);
is_configured := True;
end if;
end Reconfigure_Buzzer;
-- function Tone_To_Frequency (tone : Tone_Type) return Frequency_Type is
-- f : Frequency_Type;
-- subtype octave_modifier is Unit_Type;
-- o : constant octave_modifier := octave_modifier (tone.octave - 2);
-- begin
-- -- frequencies for octave 3 (small octave)
-- case tone.name is
-- when 'c' => f := 130.813 * Hertz;
-- when 'd' => f := 146.832 * Hertz;
-- when 'e' => f := 164.814 * Hertz;
-- when 'f' => f := 174.614 * Hertz;
-- when 'g' => f := 195.998 * Hertz;
-- when 'a' => f := 220.000 * Hertz;
-- when 'b' => f := 246.942 * Hertz;
-- end case;
-- -- now multiply with octave above 3
-- f := f * o;
-- return f;
-- end Tone_To_Frequency;
--
-- procedure Set_Tone (t : Tone_Type) is
-- f : constant Frequency_Type := Tone_To_Frequency (t);
-- begin
-- Set_Freq (f);
-- end Set_Tone;
--------------
-- Set_Freq --
--------------
procedure Set_Freq (f : in Frequency_Type) is
begin
cur_freq := f;
Reconfigure_Buzzer;
end Set_Freq;
----------
-- Beep --
----------
procedure Beep
(f : in Frequency_Type;
Reps : Natural;
Period : Time_Type;
Length : in Time_Type)
is
function Sat_Sub_Time is new
Units.Saturated_Subtraction (Time_Type);
function To_Millisec (t : Time_Type) return Natural;
function To_Millisec (t : Time_Type) return Natural is
ms : Float;
begin
if abs (Float (t)) >= Float'Last / 1000.0 then
ms := Float'Last;
else
ms := Float (t) * 1000.0;
end if;
return Types.Sat_Cast_Natural (ms);
end To_Millisec;
begin
if not Valid_Frequency (f) or
Period <= Length or
Period = 0.0 * Second or
Length = 0.0 * Second
then
Disable_Statemachine;
return;
end if;
cur_reps := Reps;
infinite := (Reps = 0);
declare
cur_pause : constant Time_Type := Sat_Sub_Time (Period, Length);
cur_length : constant Time_Type := Length;
begin
cur_pause_ms := To_Millisec (cur_pause);
cur_length_ms := To_Millisec (cur_length);
end;
if f /= cur_freq then
Set_Freq (f);
end if;
Enable_Statemachine;
end Beep;
end Buzzer_Manager;
| true |
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
with HIL.Buzzer;
with Ada.Real_Time; use Ada.Real_Time;
with Types;
-- @summary
-- Interface to use a buzzer/beeper.
package body Buzzer_Manager with SPARK_Mode is
type state is (BOFF, BINIT, BDUTY, BWAIT);
--------------------
-- internal state
--------------------
cur_state : state := BOFF;
cur_length_ms : Natural := 100;
cur_pause_ms : Natural := 1900;
cur_freq : Frequency_Type := 1000.0 * Hertz;
cur_reps : Natural := 0;
infinite : Boolean := False;
t_next : Ada.Real_Time.Time;
is_configured : Boolean := False;
--------------
-- specs
--------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time);
procedure Set_Freq (f : in Frequency_Type) with Pre => Valid_Frequency (f);
procedure Enable_Statemachine;
procedure Disable_Statemachine;
-------------------------
-- Enable_Statemachine --
-------------------------
procedure Enable_Statemachine is
begin
if is_configured and cur_state = BOFF then
cur_state := BINIT;
t_next := Ada.Real_Time.Clock;
end if;
end Enable_Statemachine;
------------------
-- Change_State --
------------------
procedure Change_State (newstate : state; now : Ada.Real_Time.Time) is
cand_newstate : state := newstate;
begin
if cur_state /= newstate then
case newstate is
when BDUTY =>
if not infinite then
-- finite mode...countdown
if cur_reps > 0 then
cur_reps := cur_reps - 1;
HIL.Buzzer.Enable;
else
HIL.Buzzer.Disable;
cand_newstate := BOFF;
end if;
else
-- infinite mode
HIL.Buzzer.Enable;
end if;
t_next := now + Milliseconds (cur_length_ms);
when others =>
HIL.Buzzer.Disable;
t_next := now + Milliseconds (cur_pause_ms);
end case;
cur_state := cand_newstate;
end if;
end Change_State;
----------
-- Tick --
----------
procedure Tick is
next_state : state;
now : Ada.Real_Time.Time;
begin
if cur_state /= BOFF then
now := Ada.Real_Time.Clock;
if now >= t_next then
case cur_state is
when BWAIT => next_state := BDUTY;
when BDUTY => next_state := BWAIT;
when others => next_state := BDUTY;
end case;
Change_State (next_state, now);
end if;
end if;
end Tick;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
HIL.Buzzer.Initialize;
Reconfigure_Buzzer; -- apply defaults
HIL.Buzzer.Disable;
end Initialize;
--------------------------
-- Disable_Statemachine --
--------------------------
procedure Disable_Statemachine is
now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock;
begin
infinite := False;
Change_State (BOFF, now);
end Disable_Statemachine;
------------------------
-- Reconfigure_Buzzer --
------------------------
procedure Reconfigure_Buzzer is
begin
if HIL.Buzzer.Valid_Frequency (cur_freq) then
HIL.Buzzer.Set_Frequency (cur_freq);
is_configured := True;
end if;
end Reconfigure_Buzzer;
-- function Tone_To_Frequency (tone : Tone_Type) return Frequency_Type is
-- f : Frequency_Type;
-- subtype octave_modifier is Unit_Type;
-- o : constant octave_modifier := octave_modifier (tone.octave - 2);
-- begin
-- -- frequencies for octave 3 (small octave)
-- case tone.name is
-- when 'c' => f := 130.813 * Hertz;
-- when 'd' => f := 146.832 * Hertz;
-- when 'e' => f := 164.814 * Hertz;
-- when 'f' => f := 174.614 * Hertz;
-- when 'g' => f := 195.998 * Hertz;
-- when 'a' => f := 220.000 * Hertz;
-- when 'b' => f := 246.942 * Hertz;
-- end case;
-- -- now multiply with octave above 3
-- f := f * o;
-- return f;
-- end Tone_To_Frequency;
--
-- procedure Set_Tone (t : Tone_Type) is
-- f : constant Frequency_Type := Tone_To_Frequency (t);
-- begin
-- Set_Freq (f);
-- end Set_Tone;
--------------
-- Set_Freq --
--------------
procedure Set_Freq (f : in Frequency_Type) is
begin
cur_freq := f;
Reconfigure_Buzzer;
end Set_Freq;
----------
-- Beep --
----------
procedure Beep
(f : in Frequency_Type;
Reps : Natural;
Period : Time_Type;
Length : in Time_Type)
is
function Sat_Sub_Time is new
Units.Saturated_Subtraction (Time_Type);
function To_Millisec (t : Time_Type) return Natural;
function To_Millisec (t : Time_Type) return Natural is
ms : Float;
begin
if abs (Float (t)) >= Float'Last / 1000.0 then
ms := Float'Last;
else
ms := Float (t) * 1000.0;
end if;
return Types.Sat_Cast_Natural (ms);
end To_Millisec;
begin
if not Valid_Frequency (f) or
Period <= Length or
Period = 0.0 * Second or
Length = 0.0 * Second
then
Disable_Statemachine;
return;
end if;
cur_reps := Reps;
infinite := (Reps = 0);
declare
cur_pause : constant Time_Type := Sat_Sub_Time (Period, Length);
cur_length : constant Time_Type := Length;
begin
cur_pause_ms := To_Millisec (cur_pause);
cur_length_ms := To_Millisec (cur_length);
end;
if f /= cur_freq then
Set_Freq (f);
end if;
Enable_Statemachine;
end Beep;
end Buzzer_Manager;
|
[
{
"context": "---------------------------\n-- Copyright (c) 2014, Natacha Porté --\n-- ",
"end": 115,
"score": 0.9998630285263062,
"start": 102,
"tag": "NAME",
"value": "Natacha Porté"
}
] |
tests/natools-s_expressions-templates-tests-integers.ads
|
faelys/natools
| 0 |
------------------------------------------------------------------------------
-- Copyright (c) 2014, 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.S_Expressions.Templates.Tests.Integers provides a test suite for --
-- integer S-expression template system. --
------------------------------------------------------------------------------
package Natools.S_Expressions.Templates.Tests.Integers is
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Alignment (Report : in out NT.Reporter'Class);
procedure Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Images (Report : in out NT.Reporter'Class);
procedure Explicit_Sign (Report : in out NT.Reporter'Class);
procedure Hexadecimal (Report : in out NT.Reporter'Class);
procedure Overflow (Report : in out NT.Reporter'Class);
procedure Parse_Errors (Report : in out NT.Reporter'Class);
procedure Prefix_And_Suffix (Report : in out NT.Reporter'Class);
procedure Static_Hash_Map (Report : in out NT.Reporter'Class);
end Natools.S_Expressions.Templates.Tests.Integers;
|
22287
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, <NAME> --
-- --
-- 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.S_Expressions.Templates.Tests.Integers provides a test suite for --
-- integer S-expression template system. --
------------------------------------------------------------------------------
package Natools.S_Expressions.Templates.Tests.Integers is
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Alignment (Report : in out NT.Reporter'Class);
procedure Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Images (Report : in out NT.Reporter'Class);
procedure Explicit_Sign (Report : in out NT.Reporter'Class);
procedure Hexadecimal (Report : in out NT.Reporter'Class);
procedure Overflow (Report : in out NT.Reporter'Class);
procedure Parse_Errors (Report : in out NT.Reporter'Class);
procedure Prefix_And_Suffix (Report : in out NT.Reporter'Class);
procedure Static_Hash_Map (Report : in out NT.Reporter'Class);
end Natools.S_Expressions.Templates.Tests.Integers;
| true |
------------------------------------------------------------------------------
-- Copyright (c) 2014, PI:NAME:<NAME>END_PI --
-- --
-- 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.S_Expressions.Templates.Tests.Integers provides a test suite for --
-- integer S-expression template system. --
------------------------------------------------------------------------------
package Natools.S_Expressions.Templates.Tests.Integers is
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Alignment (Report : in out NT.Reporter'Class);
procedure Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Default_Format (Report : in out NT.Reporter'Class);
procedure Explicit_Images (Report : in out NT.Reporter'Class);
procedure Explicit_Sign (Report : in out NT.Reporter'Class);
procedure Hexadecimal (Report : in out NT.Reporter'Class);
procedure Overflow (Report : in out NT.Reporter'Class);
procedure Parse_Errors (Report : in out NT.Reporter'Class);
procedure Prefix_And_Suffix (Report : in out NT.Reporter'Class);
procedure Static_Hash_Map (Report : in out NT.Reporter'Class);
end Natools.S_Expressions.Templates.Tests.Integers;
|
[
{
"context": " loop;\n end Symbol_Allocate;\n\n\n -- 2019-09-06 JQ\n -- Simply try to make a vector for symbols\n ",
"end": 2252,
"score": 0.8666455745697021,
"start": 2250,
"tag": "NAME",
"value": "JQ"
}
] |
source/symbols.adb
|
jquorning/CELLE
| 0 |
--
-- 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 body Symbols is
function "<" (Left : in Symbol_Record;
Right : in Symbol_Record)
return Boolean
is
use type Types.Symbol_Index;
function Value_Of (Item : in Symbol_Record) return Integer;
function Value_Of (Item : in Symbol_Record) return Integer
is
Kind : constant Symbol_Kind := Item.Kind;
Name : constant String := To_String (Item.Name);
Char : constant Character := Name (Name'First);
begin
if Kind = Multi_Terminal then
return 3;
elsif Char > 'Z' then
return 2;
else
return 1;
end if;
end Value_Of;
I_Left : constant Integer := Value_Of (Left);
I_Right : constant Integer := Value_Of (Right);
begin
if I_Left = I_Right then
return Left.Index - Right.Index > 0;
else
return I_Left - I_Right > 0;
end if;
end "<";
procedure Symbol_Init is
begin
null;
end Symbol_Init;
-- Return an array of pointers to all data in the table.
-- The array is obtained from malloc. Return NULL if memory allocation
-- problems, or if the array is empty.
procedure Symbol_Allocate (Count : in Ada.Containers.Count_Type) is
begin
-- Symbol_Lists (Ada.Containers.Doubly_Linked_Lists) does not nave
-- operation for setting length or capacity
-- Symbol_Maps (Ada.Containers.Ordered_Maps does not nave
-- operation for setting length or capacity
null;
-- Symbol_Lists.Set_Length (Extra.Symbol_Vector, Count);
-- Symbol_Maps.
-- Extras.Symbol_Map := Symbols_Maps.Empty_Map;
-- for Index in
-- Symbol_Vectors.First (Extra.Symbol_Vector) ..
-- Symbol_Vectors.Last (Extra.Symbol_Vector)
-- loop
-- Symbol_Maps.Replace_Element (Extras.Symbol_Map,
-- end loop;
end Symbol_Allocate;
-- 2019-09-06 JQ
-- Simply try to make a vector for symbols
package Symbol_Bases is
new Ada.Containers.Vectors (Index_Type => Types.Symbol_Index,
Element_Type => Symbol_Access);
Base : Symbol_Bases.Vector;
procedure Count_Symbols_And_Terminals (Symbol_Count : out Natural;
Terminal_Count : out Natural)
is
use Types;
Index : Symbol_Index;
begin
Symbol_Count := Natural'First;
Terminal_Count := Natural'First;
-- Sequential index of symbols
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
while Base (Index - 1).all.Kind = Multi_Terminal loop
Index := Index - 1;
end loop;
pragma Assert (To_String (Base (Index - 1).Name) = "{default}");
Symbol_Count := Natural (Index - 1);
Index := 1;
while
To_String (Base (Index).all.Name) (1) in 'A' .. 'Z'
loop
Index := Index + 1;
end loop;
Terminal_Count := Natural (Index);
end Count_Symbols_And_Terminals;
function Create (Name : in String)
return Symbol_Access
is
Symbol : Symbol_Access := Find (Name);
begin
if Symbol = null then
Symbol := new Symbol_Record;
Symbol.Name := To_Unbounded_String (Name);
if Name (Name'First) in 'A' .. 'Z' then
Symbol.Kind := Terminal;
else
Symbol.Kind := Non_Terminal;
end if;
Symbol.Rule := null;
Symbol.Fallback := null;
Symbol.Precedence := -1;
Symbol.Association := Unknown_Association;
Symbol.First_Set := Symbol_Sets.Null_Set;
Symbol.Lambda := False;
Symbol.Destructor := Null_Unbounded_String;
Symbol.Dest_Lineno := 0;
Symbol.Data_Type := Null_Unbounded_String;
Symbol.Use_Count := 0;
Symbol_Bases.Append (Base, Symbol);
end if;
Symbol.Use_Count := Symbol.Use_Count + 1;
return Symbol;
end Create;
function Find (Name : in String)
return Symbol_Access
is
begin
for Symbol of Base loop
if Symbol.all.Name = Name then
return Symbol;
end if;
end loop;
return null;
end Find;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean
is
use Types;
L : Symbol_Record renames Left.all;
R : Symbol_Record renames Right.all;
L_I : constant Integer
:= (if L.Kind = Multi_Terminal then 3 else
(if To_String (L.Name) (1) > 'Z' then 2 else 1));
R_I : constant Integer
:= (if R.Kind = Multi_Terminal then 3 else
(if To_String (R.Name) (1) > 'Z' then 2 else 1));
begin
if L_I = R_I then
return L.Index < R.Index;
else
return L_I < R_I;
end if;
end Symbol_Compare;
package Symbol_Sorting is
new Symbol_Bases.Generic_Sorting (Symbol_Compare);
procedure Sort
is
use Types;
Index : Symbol_Index;
begin
-- Set index field in symbols in symbol table
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
Symbol_Sorting.Sort (Base);
end Sort;
procedure Set_Lambda_False_And_Set_Firstset (First : in Natural;
Last : in Natural)
is
begin
for Symbol of Base loop
Symbol.Lambda := False;
end loop;
for I in First .. Last loop
declare
Symbol : constant Symbol_Access := Base.Element (Symbol_Index (I));
begin
Symbol.all.First_Set := Symbol_Sets.Set_New;
Base (Symbol_Index (I)) := Symbol;
end;
end loop;
end Set_Lambda_False_And_Set_Firstset;
function Last_Index return Types.Symbol_Index is
begin
return Base.Last_Index;
end Last_Index;
function Element_At (Index : in Types.Symbol_Index) return Symbol_Access
is
begin
return Base.Element (Index);
end Element_At;
end Symbols;
|
9858
|
--
-- 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 body Symbols is
function "<" (Left : in Symbol_Record;
Right : in Symbol_Record)
return Boolean
is
use type Types.Symbol_Index;
function Value_Of (Item : in Symbol_Record) return Integer;
function Value_Of (Item : in Symbol_Record) return Integer
is
Kind : constant Symbol_Kind := Item.Kind;
Name : constant String := To_String (Item.Name);
Char : constant Character := Name (Name'First);
begin
if Kind = Multi_Terminal then
return 3;
elsif Char > 'Z' then
return 2;
else
return 1;
end if;
end Value_Of;
I_Left : constant Integer := Value_Of (Left);
I_Right : constant Integer := Value_Of (Right);
begin
if I_Left = I_Right then
return Left.Index - Right.Index > 0;
else
return I_Left - I_Right > 0;
end if;
end "<";
procedure Symbol_Init is
begin
null;
end Symbol_Init;
-- Return an array of pointers to all data in the table.
-- The array is obtained from malloc. Return NULL if memory allocation
-- problems, or if the array is empty.
procedure Symbol_Allocate (Count : in Ada.Containers.Count_Type) is
begin
-- Symbol_Lists (Ada.Containers.Doubly_Linked_Lists) does not nave
-- operation for setting length or capacity
-- Symbol_Maps (Ada.Containers.Ordered_Maps does not nave
-- operation for setting length or capacity
null;
-- Symbol_Lists.Set_Length (Extra.Symbol_Vector, Count);
-- Symbol_Maps.
-- Extras.Symbol_Map := Symbols_Maps.Empty_Map;
-- for Index in
-- Symbol_Vectors.First (Extra.Symbol_Vector) ..
-- Symbol_Vectors.Last (Extra.Symbol_Vector)
-- loop
-- Symbol_Maps.Replace_Element (Extras.Symbol_Map,
-- end loop;
end Symbol_Allocate;
-- 2019-09-06 <NAME>
-- Simply try to make a vector for symbols
package Symbol_Bases is
new Ada.Containers.Vectors (Index_Type => Types.Symbol_Index,
Element_Type => Symbol_Access);
Base : Symbol_Bases.Vector;
procedure Count_Symbols_And_Terminals (Symbol_Count : out Natural;
Terminal_Count : out Natural)
is
use Types;
Index : Symbol_Index;
begin
Symbol_Count := Natural'First;
Terminal_Count := Natural'First;
-- Sequential index of symbols
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
while Base (Index - 1).all.Kind = Multi_Terminal loop
Index := Index - 1;
end loop;
pragma Assert (To_String (Base (Index - 1).Name) = "{default}");
Symbol_Count := Natural (Index - 1);
Index := 1;
while
To_String (Base (Index).all.Name) (1) in 'A' .. 'Z'
loop
Index := Index + 1;
end loop;
Terminal_Count := Natural (Index);
end Count_Symbols_And_Terminals;
function Create (Name : in String)
return Symbol_Access
is
Symbol : Symbol_Access := Find (Name);
begin
if Symbol = null then
Symbol := new Symbol_Record;
Symbol.Name := To_Unbounded_String (Name);
if Name (Name'First) in 'A' .. 'Z' then
Symbol.Kind := Terminal;
else
Symbol.Kind := Non_Terminal;
end if;
Symbol.Rule := null;
Symbol.Fallback := null;
Symbol.Precedence := -1;
Symbol.Association := Unknown_Association;
Symbol.First_Set := Symbol_Sets.Null_Set;
Symbol.Lambda := False;
Symbol.Destructor := Null_Unbounded_String;
Symbol.Dest_Lineno := 0;
Symbol.Data_Type := Null_Unbounded_String;
Symbol.Use_Count := 0;
Symbol_Bases.Append (Base, Symbol);
end if;
Symbol.Use_Count := Symbol.Use_Count + 1;
return Symbol;
end Create;
function Find (Name : in String)
return Symbol_Access
is
begin
for Symbol of Base loop
if Symbol.all.Name = Name then
return Symbol;
end if;
end loop;
return null;
end Find;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean
is
use Types;
L : Symbol_Record renames Left.all;
R : Symbol_Record renames Right.all;
L_I : constant Integer
:= (if L.Kind = Multi_Terminal then 3 else
(if To_String (L.Name) (1) > 'Z' then 2 else 1));
R_I : constant Integer
:= (if R.Kind = Multi_Terminal then 3 else
(if To_String (R.Name) (1) > 'Z' then 2 else 1));
begin
if L_I = R_I then
return L.Index < R.Index;
else
return L_I < R_I;
end if;
end Symbol_Compare;
package Symbol_Sorting is
new Symbol_Bases.Generic_Sorting (Symbol_Compare);
procedure Sort
is
use Types;
Index : Symbol_Index;
begin
-- Set index field in symbols in symbol table
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
Symbol_Sorting.Sort (Base);
end Sort;
procedure Set_Lambda_False_And_Set_Firstset (First : in Natural;
Last : in Natural)
is
begin
for Symbol of Base loop
Symbol.Lambda := False;
end loop;
for I in First .. Last loop
declare
Symbol : constant Symbol_Access := Base.Element (Symbol_Index (I));
begin
Symbol.all.First_Set := Symbol_Sets.Set_New;
Base (Symbol_Index (I)) := Symbol;
end;
end loop;
end Set_Lambda_False_And_Set_Firstset;
function Last_Index return Types.Symbol_Index is
begin
return Base.Last_Index;
end Last_Index;
function Element_At (Index : in Types.Symbol_Index) return Symbol_Access
is
begin
return Base.Element (Index);
end Element_At;
end Symbols;
| true |
--
-- 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 body Symbols is
function "<" (Left : in Symbol_Record;
Right : in Symbol_Record)
return Boolean
is
use type Types.Symbol_Index;
function Value_Of (Item : in Symbol_Record) return Integer;
function Value_Of (Item : in Symbol_Record) return Integer
is
Kind : constant Symbol_Kind := Item.Kind;
Name : constant String := To_String (Item.Name);
Char : constant Character := Name (Name'First);
begin
if Kind = Multi_Terminal then
return 3;
elsif Char > 'Z' then
return 2;
else
return 1;
end if;
end Value_Of;
I_Left : constant Integer := Value_Of (Left);
I_Right : constant Integer := Value_Of (Right);
begin
if I_Left = I_Right then
return Left.Index - Right.Index > 0;
else
return I_Left - I_Right > 0;
end if;
end "<";
procedure Symbol_Init is
begin
null;
end Symbol_Init;
-- Return an array of pointers to all data in the table.
-- The array is obtained from malloc. Return NULL if memory allocation
-- problems, or if the array is empty.
procedure Symbol_Allocate (Count : in Ada.Containers.Count_Type) is
begin
-- Symbol_Lists (Ada.Containers.Doubly_Linked_Lists) does not nave
-- operation for setting length or capacity
-- Symbol_Maps (Ada.Containers.Ordered_Maps does not nave
-- operation for setting length or capacity
null;
-- Symbol_Lists.Set_Length (Extra.Symbol_Vector, Count);
-- Symbol_Maps.
-- Extras.Symbol_Map := Symbols_Maps.Empty_Map;
-- for Index in
-- Symbol_Vectors.First (Extra.Symbol_Vector) ..
-- Symbol_Vectors.Last (Extra.Symbol_Vector)
-- loop
-- Symbol_Maps.Replace_Element (Extras.Symbol_Map,
-- end loop;
end Symbol_Allocate;
-- 2019-09-06 PI:NAME:<NAME>END_PI
-- Simply try to make a vector for symbols
package Symbol_Bases is
new Ada.Containers.Vectors (Index_Type => Types.Symbol_Index,
Element_Type => Symbol_Access);
Base : Symbol_Bases.Vector;
procedure Count_Symbols_And_Terminals (Symbol_Count : out Natural;
Terminal_Count : out Natural)
is
use Types;
Index : Symbol_Index;
begin
Symbol_Count := Natural'First;
Terminal_Count := Natural'First;
-- Sequential index of symbols
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
while Base (Index - 1).all.Kind = Multi_Terminal loop
Index := Index - 1;
end loop;
pragma Assert (To_String (Base (Index - 1).Name) = "{default}");
Symbol_Count := Natural (Index - 1);
Index := 1;
while
To_String (Base (Index).all.Name) (1) in 'A' .. 'Z'
loop
Index := Index + 1;
end loop;
Terminal_Count := Natural (Index);
end Count_Symbols_And_Terminals;
function Create (Name : in String)
return Symbol_Access
is
Symbol : Symbol_Access := Find (Name);
begin
if Symbol = null then
Symbol := new Symbol_Record;
Symbol.Name := To_Unbounded_String (Name);
if Name (Name'First) in 'A' .. 'Z' then
Symbol.Kind := Terminal;
else
Symbol.Kind := Non_Terminal;
end if;
Symbol.Rule := null;
Symbol.Fallback := null;
Symbol.Precedence := -1;
Symbol.Association := Unknown_Association;
Symbol.First_Set := Symbol_Sets.Null_Set;
Symbol.Lambda := False;
Symbol.Destructor := Null_Unbounded_String;
Symbol.Dest_Lineno := 0;
Symbol.Data_Type := Null_Unbounded_String;
Symbol.Use_Count := 0;
Symbol_Bases.Append (Base, Symbol);
end if;
Symbol.Use_Count := Symbol.Use_Count + 1;
return Symbol;
end Create;
function Find (Name : in String)
return Symbol_Access
is
begin
for Symbol of Base loop
if Symbol.all.Name = Name then
return Symbol;
end if;
end loop;
return null;
end Find;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean;
function Symbol_Compare (Left : in Symbol_Access;
Right : in Symbol_Access)
return Boolean
is
use Types;
L : Symbol_Record renames Left.all;
R : Symbol_Record renames Right.all;
L_I : constant Integer
:= (if L.Kind = Multi_Terminal then 3 else
(if To_String (L.Name) (1) > 'Z' then 2 else 1));
R_I : constant Integer
:= (if R.Kind = Multi_Terminal then 3 else
(if To_String (R.Name) (1) > 'Z' then 2 else 1));
begin
if L_I = R_I then
return L.Index < R.Index;
else
return L_I < R_I;
end if;
end Symbol_Compare;
package Symbol_Sorting is
new Symbol_Bases.Generic_Sorting (Symbol_Compare);
procedure Sort
is
use Types;
Index : Symbol_Index;
begin
-- Set index field in symbols in symbol table
Index := 0;
for Symbol of Base loop
Symbol.all.Index := Index;
Index := Index + 1;
end loop;
Symbol_Sorting.Sort (Base);
end Sort;
procedure Set_Lambda_False_And_Set_Firstset (First : in Natural;
Last : in Natural)
is
begin
for Symbol of Base loop
Symbol.Lambda := False;
end loop;
for I in First .. Last loop
declare
Symbol : constant Symbol_Access := Base.Element (Symbol_Index (I));
begin
Symbol.all.First_Set := Symbol_Sets.Set_New;
Base (Symbol_Index (I)) := Symbol;
end;
end loop;
end Set_Lambda_False_And_Set_Firstset;
function Last_Index return Types.Symbol_Index is
begin
return Base.Last_Index;
end Last_Index;
function Element_At (Index : in Types.Symbol_Index) return Symbol_Access
is
begin
return Base.Element (Index);
end Element_At;
end Symbols;
|
[
{
"context": "----------\n-- MIT License\n--\n-- Copyright (c) 2021 Zane Myers\n--\n-- Permission is hereby granted, free of charg",
"end": 131,
"score": 0.999773383140564,
"start": 121,
"tag": "NAME",
"value": "Zane Myers"
}
] |
test/dmat/vulkan-math-dmat4x4-test.adb
|
zrmyers/VulkanAda
| 1 |
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Ada.Text_IO;
with Vulkan.Test.Framework;
with Vulkan.Math.GenDMatrix;
with Vulkan.Math.Dmat4x4;
with Vulkan.Math.Dmat2x4;
with Vulkan.Math.Dmat4x2;
with Vulkan.Math.GenDType;
with Vulkan.Math.Dvec4;
with Vulkan.Math.Operators;
use Ada.Text_IO;
use Vulkan.Test.Framework;
use Vulkan.Math.Dmat4x4;
use Vulkan.Math.Dmat2x4;
use Vulkan.Math.Dmat4x2;
use Vulkan.Math.GenDType;
use Vulkan.Math.Dvec4;
use Vulkan.Math.Operators;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides tests for single precision floating point mat4x4.
--------------------------------------------------------------------------------
package body Vulkan.Math.Dmat4x4.Test is
-- Test Mat4x4
procedure Test_Dmat4x4 is
vec1 : Vkm_Dvec4 :=
Make_Dvec4(1.0, 2.0, 3.0, 4.0);
mat1 : Vkm_Dmat4x4 :=
Make_Dmat4x4;
mat2 : Vkm_Dmat4x4 :=
Make_Dmat4x4(diag => 2.0);
mat3 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1);
mat4 : Vkm_Dmat4x4 :=
Make_Dmat4x4(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
mat5 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1, -vec1, vec1 / 2.0, -vec1 / 2.0);
mat6 : Vkm_Dmat4x4 :=
Make_Dmat4x4(mat4);
mat7 : Vkm_Dmat2x4 :=
Make_Dmat2x4(1.0, 2.0,
3.0, 4.0,
5.0, 6.0,
7.0, 8.0);
mat8 : Vkm_Dmat4x2 :=
Make_Dmat4x2(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0);
begin
Put_Line("Testing Mat4x4 Constructors...");
Put_Line("mat1 " & mat1.Image);
Assert_Dmat4x4_Equals(mat1, 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
Put_Line("mat2 " & mat2.Image);
Assert_Dmat4x4_Equals(mat2, 2.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 2.0, 0.0,
0.0, 0.0, 0.0, 2.0);
Put_Line("mat3 " & mat3.Image);
Assert_Dmat4x4_Equals(mat3, 1.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 3.0, 0.0,
0.0, 0.0, 0.0, 4.0);
Put_Line("mat4 " & mat4.Image);
Assert_Dmat4x4_Equals(mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("mat5 " & mat5.Image);
Assert_Dmat4x4_Equals(mat5, 1.0, 2.0, 3.0, 4.0,
-1.0, -2.0, -3.0, -4.0,
0.5, 1.0, 1.5, 2.0,
-0.5, -1.0, -1.5, -2.0);
Put_Line("mat6 " & mat6.Image);
Assert_Dmat4x4_Equals(mat6, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '=' operator...");
Put_Line(" mat2 != mat3");
Assert_Vkm_Bool_Equals(mat2 = mat3, False);
Put_Line(" mat4 != mat5");
Assert_Vkm_Bool_Equals(mat4 = mat5, False);
Put_Line(" mat4 = mat6");
Assert_Vkm_Bool_Equals(mat4 = mat6, True);
Put_Line(" Testing unary '+/-' operator");
Put_Line(" + mat4 = " & Image(+ mat4));
Assert_Dmat4x4_Equals(+mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line(" - mat4 = " & Image(- mat4));
Assert_Dmat4x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("+ ( - mat4) = " & Image(+(- mat4)));
Assert_Dmat4x4_Equals(+(-mat4), -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("Testing 'abs' operator...");
Put_Line(" abs( - mat4) = " & Image(abs(-mat4)));
Assert_Dmat4x4_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '+' operator...");
Put_Line(" mat4 + mat5 = " & Image(mat4 + mat5));
Assert_Dmat4x4_Equals(mat4 + mat5, 1.0, 3.0, 5.0, 7.0,
3.0, 3.0, 3.0, 3.0,
8.5, 10.0, 11.5, 13.0,
11.5, 12.0, 12.5, 13.0);
Put_Line("Testing '-' operator...");
Put_Line(" mat4 - mat5 = " & Image(mat4 -mat5));
Assert_Dmat4x4_Equals(mat4 - mat5, -1.0, -1.0, -1.0, -1.0,
5.0, 7.0, 9.0, 11.0,
7.5, 8.0, 8.5, 9.0,
12.5, 14.0, 15.5, 17.0);
Put_Line("Testing '*' operator...");
Put_Line(" mat4 * mat8 = " & Image(mat4 * mat8));
Assert_Dmat4x2_Equals(mat4 * mat8, 34.0, 40.0,
98.0, 120.0,
162.0, 200.0,
226.0, 280.0);
Put_Line(" mat7 * mat4 = " & Image(mat7 * mat4));
Assert_Dmat2x4_Equals(mat7*mat4, 80.0, 90.0,
100.0, 110.0,
176.0, 202.0,
228.0, 254.0);
Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4));
Assert_Dvec4_Equals(vec1 * mat4, 80.0, 90.0, 100.0, 110.0);
Put_Line(" mat4 * vec1 = " & Image(mat4 * vec1));
Assert_Dvec4_Equals(mat4 * vec1, 20.0, 60.0, 100.0, 140.0);
end Test_Dmat4x4;
end Vulkan.Math.Dmat4x4.Test;
|
2834
|
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 <NAME>
--
-- 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 Ada.Text_IO;
with Vulkan.Test.Framework;
with Vulkan.Math.GenDMatrix;
with Vulkan.Math.Dmat4x4;
with Vulkan.Math.Dmat2x4;
with Vulkan.Math.Dmat4x2;
with Vulkan.Math.GenDType;
with Vulkan.Math.Dvec4;
with Vulkan.Math.Operators;
use Ada.Text_IO;
use Vulkan.Test.Framework;
use Vulkan.Math.Dmat4x4;
use Vulkan.Math.Dmat2x4;
use Vulkan.Math.Dmat4x2;
use Vulkan.Math.GenDType;
use Vulkan.Math.Dvec4;
use Vulkan.Math.Operators;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides tests for single precision floating point mat4x4.
--------------------------------------------------------------------------------
package body Vulkan.Math.Dmat4x4.Test is
-- Test Mat4x4
procedure Test_Dmat4x4 is
vec1 : Vkm_Dvec4 :=
Make_Dvec4(1.0, 2.0, 3.0, 4.0);
mat1 : Vkm_Dmat4x4 :=
Make_Dmat4x4;
mat2 : Vkm_Dmat4x4 :=
Make_Dmat4x4(diag => 2.0);
mat3 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1);
mat4 : Vkm_Dmat4x4 :=
Make_Dmat4x4(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
mat5 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1, -vec1, vec1 / 2.0, -vec1 / 2.0);
mat6 : Vkm_Dmat4x4 :=
Make_Dmat4x4(mat4);
mat7 : Vkm_Dmat2x4 :=
Make_Dmat2x4(1.0, 2.0,
3.0, 4.0,
5.0, 6.0,
7.0, 8.0);
mat8 : Vkm_Dmat4x2 :=
Make_Dmat4x2(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0);
begin
Put_Line("Testing Mat4x4 Constructors...");
Put_Line("mat1 " & mat1.Image);
Assert_Dmat4x4_Equals(mat1, 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
Put_Line("mat2 " & mat2.Image);
Assert_Dmat4x4_Equals(mat2, 2.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 2.0, 0.0,
0.0, 0.0, 0.0, 2.0);
Put_Line("mat3 " & mat3.Image);
Assert_Dmat4x4_Equals(mat3, 1.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 3.0, 0.0,
0.0, 0.0, 0.0, 4.0);
Put_Line("mat4 " & mat4.Image);
Assert_Dmat4x4_Equals(mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("mat5 " & mat5.Image);
Assert_Dmat4x4_Equals(mat5, 1.0, 2.0, 3.0, 4.0,
-1.0, -2.0, -3.0, -4.0,
0.5, 1.0, 1.5, 2.0,
-0.5, -1.0, -1.5, -2.0);
Put_Line("mat6 " & mat6.Image);
Assert_Dmat4x4_Equals(mat6, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '=' operator...");
Put_Line(" mat2 != mat3");
Assert_Vkm_Bool_Equals(mat2 = mat3, False);
Put_Line(" mat4 != mat5");
Assert_Vkm_Bool_Equals(mat4 = mat5, False);
Put_Line(" mat4 = mat6");
Assert_Vkm_Bool_Equals(mat4 = mat6, True);
Put_Line(" Testing unary '+/-' operator");
Put_Line(" + mat4 = " & Image(+ mat4));
Assert_Dmat4x4_Equals(+mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line(" - mat4 = " & Image(- mat4));
Assert_Dmat4x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("+ ( - mat4) = " & Image(+(- mat4)));
Assert_Dmat4x4_Equals(+(-mat4), -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("Testing 'abs' operator...");
Put_Line(" abs( - mat4) = " & Image(abs(-mat4)));
Assert_Dmat4x4_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '+' operator...");
Put_Line(" mat4 + mat5 = " & Image(mat4 + mat5));
Assert_Dmat4x4_Equals(mat4 + mat5, 1.0, 3.0, 5.0, 7.0,
3.0, 3.0, 3.0, 3.0,
8.5, 10.0, 11.5, 13.0,
11.5, 12.0, 12.5, 13.0);
Put_Line("Testing '-' operator...");
Put_Line(" mat4 - mat5 = " & Image(mat4 -mat5));
Assert_Dmat4x4_Equals(mat4 - mat5, -1.0, -1.0, -1.0, -1.0,
5.0, 7.0, 9.0, 11.0,
7.5, 8.0, 8.5, 9.0,
12.5, 14.0, 15.5, 17.0);
Put_Line("Testing '*' operator...");
Put_Line(" mat4 * mat8 = " & Image(mat4 * mat8));
Assert_Dmat4x2_Equals(mat4 * mat8, 34.0, 40.0,
98.0, 120.0,
162.0, 200.0,
226.0, 280.0);
Put_Line(" mat7 * mat4 = " & Image(mat7 * mat4));
Assert_Dmat2x4_Equals(mat7*mat4, 80.0, 90.0,
100.0, 110.0,
176.0, 202.0,
228.0, 254.0);
Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4));
Assert_Dvec4_Equals(vec1 * mat4, 80.0, 90.0, 100.0, 110.0);
Put_Line(" mat4 * vec1 = " & Image(mat4 * vec1));
Assert_Dvec4_Equals(mat4 * vec1, 20.0, 60.0, 100.0, 140.0);
end Test_Dmat4x4;
end Vulkan.Math.Dmat4x4.Test;
| true |
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI
--
-- 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 Ada.Text_IO;
with Vulkan.Test.Framework;
with Vulkan.Math.GenDMatrix;
with Vulkan.Math.Dmat4x4;
with Vulkan.Math.Dmat2x4;
with Vulkan.Math.Dmat4x2;
with Vulkan.Math.GenDType;
with Vulkan.Math.Dvec4;
with Vulkan.Math.Operators;
use Ada.Text_IO;
use Vulkan.Test.Framework;
use Vulkan.Math.Dmat4x4;
use Vulkan.Math.Dmat2x4;
use Vulkan.Math.Dmat4x2;
use Vulkan.Math.GenDType;
use Vulkan.Math.Dvec4;
use Vulkan.Math.Operators;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides tests for single precision floating point mat4x4.
--------------------------------------------------------------------------------
package body Vulkan.Math.Dmat4x4.Test is
-- Test Mat4x4
procedure Test_Dmat4x4 is
vec1 : Vkm_Dvec4 :=
Make_Dvec4(1.0, 2.0, 3.0, 4.0);
mat1 : Vkm_Dmat4x4 :=
Make_Dmat4x4;
mat2 : Vkm_Dmat4x4 :=
Make_Dmat4x4(diag => 2.0);
mat3 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1);
mat4 : Vkm_Dmat4x4 :=
Make_Dmat4x4(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
mat5 : Vkm_Dmat4x4 :=
Make_Dmat4x4(vec1, -vec1, vec1 / 2.0, -vec1 / 2.0);
mat6 : Vkm_Dmat4x4 :=
Make_Dmat4x4(mat4);
mat7 : Vkm_Dmat2x4 :=
Make_Dmat2x4(1.0, 2.0,
3.0, 4.0,
5.0, 6.0,
7.0, 8.0);
mat8 : Vkm_Dmat4x2 :=
Make_Dmat4x2(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0);
begin
Put_Line("Testing Mat4x4 Constructors...");
Put_Line("mat1 " & mat1.Image);
Assert_Dmat4x4_Equals(mat1, 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
Put_Line("mat2 " & mat2.Image);
Assert_Dmat4x4_Equals(mat2, 2.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 2.0, 0.0,
0.0, 0.0, 0.0, 2.0);
Put_Line("mat3 " & mat3.Image);
Assert_Dmat4x4_Equals(mat3, 1.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 3.0, 0.0,
0.0, 0.0, 0.0, 4.0);
Put_Line("mat4 " & mat4.Image);
Assert_Dmat4x4_Equals(mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("mat5 " & mat5.Image);
Assert_Dmat4x4_Equals(mat5, 1.0, 2.0, 3.0, 4.0,
-1.0, -2.0, -3.0, -4.0,
0.5, 1.0, 1.5, 2.0,
-0.5, -1.0, -1.5, -2.0);
Put_Line("mat6 " & mat6.Image);
Assert_Dmat4x4_Equals(mat6, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '=' operator...");
Put_Line(" mat2 != mat3");
Assert_Vkm_Bool_Equals(mat2 = mat3, False);
Put_Line(" mat4 != mat5");
Assert_Vkm_Bool_Equals(mat4 = mat5, False);
Put_Line(" mat4 = mat6");
Assert_Vkm_Bool_Equals(mat4 = mat6, True);
Put_Line(" Testing unary '+/-' operator");
Put_Line(" + mat4 = " & Image(+ mat4));
Assert_Dmat4x4_Equals(+mat4, 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line(" - mat4 = " & Image(- mat4));
Assert_Dmat4x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("+ ( - mat4) = " & Image(+(- mat4)));
Assert_Dmat4x4_Equals(+(-mat4), -0.0, -1.0, -2.0, -3.0,
-4.0, -5.0, -6.0, -7.0,
-8.0, -9.0, -10.0, -11.0,
-12.0, -13.0, -14.0, -15.0);
Put_Line("Testing 'abs' operator...");
Put_Line(" abs( - mat4) = " & Image(abs(-mat4)));
Assert_Dmat4x4_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0);
Put_Line("Testing '+' operator...");
Put_Line(" mat4 + mat5 = " & Image(mat4 + mat5));
Assert_Dmat4x4_Equals(mat4 + mat5, 1.0, 3.0, 5.0, 7.0,
3.0, 3.0, 3.0, 3.0,
8.5, 10.0, 11.5, 13.0,
11.5, 12.0, 12.5, 13.0);
Put_Line("Testing '-' operator...");
Put_Line(" mat4 - mat5 = " & Image(mat4 -mat5));
Assert_Dmat4x4_Equals(mat4 - mat5, -1.0, -1.0, -1.0, -1.0,
5.0, 7.0, 9.0, 11.0,
7.5, 8.0, 8.5, 9.0,
12.5, 14.0, 15.5, 17.0);
Put_Line("Testing '*' operator...");
Put_Line(" mat4 * mat8 = " & Image(mat4 * mat8));
Assert_Dmat4x2_Equals(mat4 * mat8, 34.0, 40.0,
98.0, 120.0,
162.0, 200.0,
226.0, 280.0);
Put_Line(" mat7 * mat4 = " & Image(mat7 * mat4));
Assert_Dmat2x4_Equals(mat7*mat4, 80.0, 90.0,
100.0, 110.0,
176.0, 202.0,
228.0, 254.0);
Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4));
Assert_Dvec4_Equals(vec1 * mat4, 80.0, 90.0, 100.0, 110.0);
Put_Line(" mat4 * vec1 = " & Image(mat4 * vec1));
Assert_Dvec4_Equals(mat4 * vec1, 20.0, 60.0, 100.0, 140.0);
end Test_Dmat4x4;
end Vulkan.Math.Dmat4x4.Test;
|
[
{
"context": " --\n-- Copyright © 2011-2013, Vadim Godunko <[email protected]> --\n-- All rig",
"end": 829,
"score": 0.9998909831047058,
"start": 816,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2011-2013, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 849,
"score": 0.9999299049377441,
"start": 831,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/league/arch/arm/matreshka-simd-arm-neon.adb
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Matreshka.SIMD.ARM.NEON is
function builtin_neon_vaddv8qi
(A : int8x8_t; B : int8x8_t; C : Interfaces.Integer_32) return int8x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8qi, "__builtin_neon_vaddv8qi");
function builtin_neon_vaddv4hi
(A : int16x4_t; B : int16x4_t; C : Interfaces.Integer_32) return int16x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4hi, "__builtin_neon_vaddv4hi");
function builtin_neon_vaddv2si
(A : int32x2_t; B : int32x2_t; C : Interfaces.Integer_32) return int32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2si, "__builtin_neon_vaddv2si");
function builtin_neon_vadddi
(A : int64x1_t; B : int64x1_t; C : Interfaces.Integer_32) return int64x1_t;
pragma Import (Intrinsic, builtin_neon_vadddi, "__builtin_neon_vadddi");
function builtin_neon_vaddv2sf
(A : float32x2_t;
B : float32x2_t;
C : Interfaces.Integer_32) return float32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2sf, "__builtin_neon_vaddv2sf");
function builtin_neon_vaddv16qi
(A : int8x16_t; B : int8x16_t; C : Interfaces.Integer_32) return int8x16_t;
pragma Import (Intrinsic, builtin_neon_vaddv16qi, "__builtin_neon_vaddv16qi");
function builtin_neon_vaddv8hi
(A : int16x8_t; B : int16x8_t; C : Interfaces.Integer_32) return int16x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8hi, "__builtin_neon_vaddv8hi");
function builtin_neon_vaddv4si
(A : int32x4_t; B : int32x4_t; C : Interfaces.Integer_32) return int32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4si, "__builtin_neon_vaddv4si");
function builtin_neon_vaddv2di
(A : int64x2_t; B : int64x2_t; C : Interfaces.Integer_32) return int64x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2di, "__builtin_neon_vaddv2di");
function builtin_neon_vaddv4sf
(A : float32x4_t;
B : float32x4_t;
C : Interfaces.Integer_32) return float32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4sf, "__builtin_neon_vaddv4sf");
--------------
-- vadd_f32 --
--------------
function vadd_f32 (A : float32x2_t; B : float32x2_t) return float32x2_t is
begin
return builtin_neon_vaddv2sf (A, B, 3);
end vadd_f32;
--------------
-- vadd_s16 --
--------------
function vadd_s16 (A : int16x4_t; B : int16x4_t) return int16x4_t is
begin
return builtin_neon_vaddv4hi (A, B, 1);
end vadd_s16;
--------------
-- vadd_s32 --
--------------
function vadd_s32 (A : int32x2_t; B : int32x2_t) return int32x2_t is
begin
return builtin_neon_vaddv2si (A, B, 1);
end vadd_s32;
--------------
-- vadd_s64 --
--------------
-- function vadd_s64 (A : int64x1_t; B : int64x1_t) return int64x1_t is
-- begin
-- return builtin_neon_vadddi (A, B, 1);
-- end vadd_s64;
-------------
-- vadd_s8 --
-------------
function vadd_s8 (A : int8x8_t; B : int8x8_t) return int8x8_t is
begin
return builtin_neon_vaddv8qi (A, B, 1);
end vadd_s8;
--------------
-- vadd_u16 --
--------------
function vadd_u16 (A : uint16x4_t; B : uint16x4_t) return uint16x4_t is
begin
return
To_uint16x4_t
(builtin_neon_vaddv4hi (To_int16x4_t (A), To_int16x4_t (B), 0));
end vadd_u16;
--------------
-- vadd_u32 --
--------------
function vadd_u32 (A : uint32x2_t; B : uint32x2_t) return uint32x2_t is
begin
return
To_uint32x2_t
(builtin_neon_vaddv2si (To_int32x2_t (A), To_int32x2_t (B), 0));
end vadd_u32;
--------------
-- vadd_u64 --
--------------
function vadd_u64 (A : uint64x1_t; B : uint64x1_t) return uint64x1_t is
begin
return
To_uint64x1_t
(builtin_neon_vadddi (To_int64x1_t (A), To_int64x1_t (B), 0));
end vadd_u64;
-------------
-- vadd_u8 --
-------------
function vadd_u8 (A : uint8x8_t; B : uint8x8_t) return uint8x8_t is
begin
return
To_uint8x8_t
(builtin_neon_vaddv8qi (To_int8x8_t (A), To_int8x8_t (B), 0));
end vadd_u8;
---------------
-- vaddq_f32 --
---------------
function vaddq_f32 (A : float32x4_t; B : float32x4_t) return float32x4_t is
begin
return builtin_neon_vaddv4sf (A, B, 3);
end vaddq_f32;
---------------
-- vaddq_s16 --
---------------
function vaddq_s16 (A : int16x8_t; B : int16x8_t) return int16x8_t is
begin
return builtin_neon_vaddv8hi (A, B, 1);
end vaddq_s16;
---------------
-- vaddq_s32 --
---------------
function vaddq_s32 (A : int32x4_t; B : int32x4_t) return int32x4_t is
begin
return builtin_neon_vaddv4si (A, B, 1);
end vaddq_s32;
---------------
-- vaddq_s64 --
---------------
function vaddq_s64 (A : int64x2_t; B : int64x2_t) return int64x2_t is
begin
return builtin_neon_vaddv2di (A, B, 1);
end vaddq_s64;
--------------
-- vaddq_s8 --
--------------
function vaddq_s8 (A : int8x16_t; B : int8x16_t) return int8x16_t is
begin
return builtin_neon_vaddv16qi (A, B, 1);
end vaddq_s8;
end Matreshka.SIMD.ARM.NEON;
|
1038
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2013, <NAME> <<EMAIL>> --
-- 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$
------------------------------------------------------------------------------
package body Matreshka.SIMD.ARM.NEON is
function builtin_neon_vaddv8qi
(A : int8x8_t; B : int8x8_t; C : Interfaces.Integer_32) return int8x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8qi, "__builtin_neon_vaddv8qi");
function builtin_neon_vaddv4hi
(A : int16x4_t; B : int16x4_t; C : Interfaces.Integer_32) return int16x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4hi, "__builtin_neon_vaddv4hi");
function builtin_neon_vaddv2si
(A : int32x2_t; B : int32x2_t; C : Interfaces.Integer_32) return int32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2si, "__builtin_neon_vaddv2si");
function builtin_neon_vadddi
(A : int64x1_t; B : int64x1_t; C : Interfaces.Integer_32) return int64x1_t;
pragma Import (Intrinsic, builtin_neon_vadddi, "__builtin_neon_vadddi");
function builtin_neon_vaddv2sf
(A : float32x2_t;
B : float32x2_t;
C : Interfaces.Integer_32) return float32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2sf, "__builtin_neon_vaddv2sf");
function builtin_neon_vaddv16qi
(A : int8x16_t; B : int8x16_t; C : Interfaces.Integer_32) return int8x16_t;
pragma Import (Intrinsic, builtin_neon_vaddv16qi, "__builtin_neon_vaddv16qi");
function builtin_neon_vaddv8hi
(A : int16x8_t; B : int16x8_t; C : Interfaces.Integer_32) return int16x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8hi, "__builtin_neon_vaddv8hi");
function builtin_neon_vaddv4si
(A : int32x4_t; B : int32x4_t; C : Interfaces.Integer_32) return int32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4si, "__builtin_neon_vaddv4si");
function builtin_neon_vaddv2di
(A : int64x2_t; B : int64x2_t; C : Interfaces.Integer_32) return int64x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2di, "__builtin_neon_vaddv2di");
function builtin_neon_vaddv4sf
(A : float32x4_t;
B : float32x4_t;
C : Interfaces.Integer_32) return float32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4sf, "__builtin_neon_vaddv4sf");
--------------
-- vadd_f32 --
--------------
function vadd_f32 (A : float32x2_t; B : float32x2_t) return float32x2_t is
begin
return builtin_neon_vaddv2sf (A, B, 3);
end vadd_f32;
--------------
-- vadd_s16 --
--------------
function vadd_s16 (A : int16x4_t; B : int16x4_t) return int16x4_t is
begin
return builtin_neon_vaddv4hi (A, B, 1);
end vadd_s16;
--------------
-- vadd_s32 --
--------------
function vadd_s32 (A : int32x2_t; B : int32x2_t) return int32x2_t is
begin
return builtin_neon_vaddv2si (A, B, 1);
end vadd_s32;
--------------
-- vadd_s64 --
--------------
-- function vadd_s64 (A : int64x1_t; B : int64x1_t) return int64x1_t is
-- begin
-- return builtin_neon_vadddi (A, B, 1);
-- end vadd_s64;
-------------
-- vadd_s8 --
-------------
function vadd_s8 (A : int8x8_t; B : int8x8_t) return int8x8_t is
begin
return builtin_neon_vaddv8qi (A, B, 1);
end vadd_s8;
--------------
-- vadd_u16 --
--------------
function vadd_u16 (A : uint16x4_t; B : uint16x4_t) return uint16x4_t is
begin
return
To_uint16x4_t
(builtin_neon_vaddv4hi (To_int16x4_t (A), To_int16x4_t (B), 0));
end vadd_u16;
--------------
-- vadd_u32 --
--------------
function vadd_u32 (A : uint32x2_t; B : uint32x2_t) return uint32x2_t is
begin
return
To_uint32x2_t
(builtin_neon_vaddv2si (To_int32x2_t (A), To_int32x2_t (B), 0));
end vadd_u32;
--------------
-- vadd_u64 --
--------------
function vadd_u64 (A : uint64x1_t; B : uint64x1_t) return uint64x1_t is
begin
return
To_uint64x1_t
(builtin_neon_vadddi (To_int64x1_t (A), To_int64x1_t (B), 0));
end vadd_u64;
-------------
-- vadd_u8 --
-------------
function vadd_u8 (A : uint8x8_t; B : uint8x8_t) return uint8x8_t is
begin
return
To_uint8x8_t
(builtin_neon_vaddv8qi (To_int8x8_t (A), To_int8x8_t (B), 0));
end vadd_u8;
---------------
-- vaddq_f32 --
---------------
function vaddq_f32 (A : float32x4_t; B : float32x4_t) return float32x4_t is
begin
return builtin_neon_vaddv4sf (A, B, 3);
end vaddq_f32;
---------------
-- vaddq_s16 --
---------------
function vaddq_s16 (A : int16x8_t; B : int16x8_t) return int16x8_t is
begin
return builtin_neon_vaddv8hi (A, B, 1);
end vaddq_s16;
---------------
-- vaddq_s32 --
---------------
function vaddq_s32 (A : int32x4_t; B : int32x4_t) return int32x4_t is
begin
return builtin_neon_vaddv4si (A, B, 1);
end vaddq_s32;
---------------
-- vaddq_s64 --
---------------
function vaddq_s64 (A : int64x2_t; B : int64x2_t) return int64x2_t is
begin
return builtin_neon_vaddv2di (A, B, 1);
end vaddq_s64;
--------------
-- vaddq_s8 --
--------------
function vaddq_s8 (A : int8x16_t; B : int8x16_t) return int8x16_t is
begin
return builtin_neon_vaddv16qi (A, B, 1);
end vaddq_s8;
end Matreshka.SIMD.ARM.NEON;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2013, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- 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$
------------------------------------------------------------------------------
package body Matreshka.SIMD.ARM.NEON is
function builtin_neon_vaddv8qi
(A : int8x8_t; B : int8x8_t; C : Interfaces.Integer_32) return int8x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8qi, "__builtin_neon_vaddv8qi");
function builtin_neon_vaddv4hi
(A : int16x4_t; B : int16x4_t; C : Interfaces.Integer_32) return int16x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4hi, "__builtin_neon_vaddv4hi");
function builtin_neon_vaddv2si
(A : int32x2_t; B : int32x2_t; C : Interfaces.Integer_32) return int32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2si, "__builtin_neon_vaddv2si");
function builtin_neon_vadddi
(A : int64x1_t; B : int64x1_t; C : Interfaces.Integer_32) return int64x1_t;
pragma Import (Intrinsic, builtin_neon_vadddi, "__builtin_neon_vadddi");
function builtin_neon_vaddv2sf
(A : float32x2_t;
B : float32x2_t;
C : Interfaces.Integer_32) return float32x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2sf, "__builtin_neon_vaddv2sf");
function builtin_neon_vaddv16qi
(A : int8x16_t; B : int8x16_t; C : Interfaces.Integer_32) return int8x16_t;
pragma Import (Intrinsic, builtin_neon_vaddv16qi, "__builtin_neon_vaddv16qi");
function builtin_neon_vaddv8hi
(A : int16x8_t; B : int16x8_t; C : Interfaces.Integer_32) return int16x8_t;
pragma Import (Intrinsic, builtin_neon_vaddv8hi, "__builtin_neon_vaddv8hi");
function builtin_neon_vaddv4si
(A : int32x4_t; B : int32x4_t; C : Interfaces.Integer_32) return int32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4si, "__builtin_neon_vaddv4si");
function builtin_neon_vaddv2di
(A : int64x2_t; B : int64x2_t; C : Interfaces.Integer_32) return int64x2_t;
pragma Import (Intrinsic, builtin_neon_vaddv2di, "__builtin_neon_vaddv2di");
function builtin_neon_vaddv4sf
(A : float32x4_t;
B : float32x4_t;
C : Interfaces.Integer_32) return float32x4_t;
pragma Import (Intrinsic, builtin_neon_vaddv4sf, "__builtin_neon_vaddv4sf");
--------------
-- vadd_f32 --
--------------
function vadd_f32 (A : float32x2_t; B : float32x2_t) return float32x2_t is
begin
return builtin_neon_vaddv2sf (A, B, 3);
end vadd_f32;
--------------
-- vadd_s16 --
--------------
function vadd_s16 (A : int16x4_t; B : int16x4_t) return int16x4_t is
begin
return builtin_neon_vaddv4hi (A, B, 1);
end vadd_s16;
--------------
-- vadd_s32 --
--------------
function vadd_s32 (A : int32x2_t; B : int32x2_t) return int32x2_t is
begin
return builtin_neon_vaddv2si (A, B, 1);
end vadd_s32;
--------------
-- vadd_s64 --
--------------
-- function vadd_s64 (A : int64x1_t; B : int64x1_t) return int64x1_t is
-- begin
-- return builtin_neon_vadddi (A, B, 1);
-- end vadd_s64;
-------------
-- vadd_s8 --
-------------
function vadd_s8 (A : int8x8_t; B : int8x8_t) return int8x8_t is
begin
return builtin_neon_vaddv8qi (A, B, 1);
end vadd_s8;
--------------
-- vadd_u16 --
--------------
function vadd_u16 (A : uint16x4_t; B : uint16x4_t) return uint16x4_t is
begin
return
To_uint16x4_t
(builtin_neon_vaddv4hi (To_int16x4_t (A), To_int16x4_t (B), 0));
end vadd_u16;
--------------
-- vadd_u32 --
--------------
function vadd_u32 (A : uint32x2_t; B : uint32x2_t) return uint32x2_t is
begin
return
To_uint32x2_t
(builtin_neon_vaddv2si (To_int32x2_t (A), To_int32x2_t (B), 0));
end vadd_u32;
--------------
-- vadd_u64 --
--------------
function vadd_u64 (A : uint64x1_t; B : uint64x1_t) return uint64x1_t is
begin
return
To_uint64x1_t
(builtin_neon_vadddi (To_int64x1_t (A), To_int64x1_t (B), 0));
end vadd_u64;
-------------
-- vadd_u8 --
-------------
function vadd_u8 (A : uint8x8_t; B : uint8x8_t) return uint8x8_t is
begin
return
To_uint8x8_t
(builtin_neon_vaddv8qi (To_int8x8_t (A), To_int8x8_t (B), 0));
end vadd_u8;
---------------
-- vaddq_f32 --
---------------
function vaddq_f32 (A : float32x4_t; B : float32x4_t) return float32x4_t is
begin
return builtin_neon_vaddv4sf (A, B, 3);
end vaddq_f32;
---------------
-- vaddq_s16 --
---------------
function vaddq_s16 (A : int16x8_t; B : int16x8_t) return int16x8_t is
begin
return builtin_neon_vaddv8hi (A, B, 1);
end vaddq_s16;
---------------
-- vaddq_s32 --
---------------
function vaddq_s32 (A : int32x4_t; B : int32x4_t) return int32x4_t is
begin
return builtin_neon_vaddv4si (A, B, 1);
end vaddq_s32;
---------------
-- vaddq_s64 --
---------------
function vaddq_s64 (A : int64x2_t; B : int64x2_t) return int64x2_t is
begin
return builtin_neon_vaddv2di (A, B, 1);
end vaddq_s64;
--------------
-- vaddq_s8 --
--------------
function vaddq_s8 (A : int8x16_t; B : int8x16_t) return int8x16_t is
begin
return builtin_neon_vaddv16qi (A, B, 1);
end vaddq_s8;
end Matreshka.SIMD.ARM.NEON;
|
[
{
"context": "-- Copyright 2015,2016,2017 Steven Stewart-Gallus\n--\n-- Licensed under the Apache License, Version ",
"end": 49,
"score": 0.9933673143386841,
"start": 28,
"tag": "NAME",
"value": "Steven Stewart-Gallus"
}
] |
src/ada-core/src/linted-stdio.adb
|
mstewartgallus/linted
| 0 |
-- Copyright 2015,2016,2017 Steven Stewart-Gallus
--
-- 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.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Linted.Writer;
with Linted.Triggers;
package body Linted.Stdio is
package C renames Interfaces.C;
use Linted.Errors;
use Linted.KOs;
procedure Write_Line (Object : KO; Str : String) is
Dummy : Error;
begin
Write_String (Object, Str & Ada.Characters.Latin_1.LF, Dummy);
end Write_Line;
procedure Write_String (Object : KO; Str : String; Err : out Error) with
Spark_Mode => Off is
X : C.char_array := C.To_C (Str);
Bytes_Written : C.size_t;
begin
Write (Object, X (X'First)'Address, X'Length, Bytes_Written, Err);
end Write_String;
procedure Write
(Object : KO;
Buf : System.Address;
Count : C.size_t;
Bytes_Written : out C.size_t;
Err : out Error)
is
Future : Writer.Future;
Event : Writer.Event;
begin
Writer.Write (Object, Buf, Count, Triggers.Null_Signaller, Future);
Writer.Write_Wait (Future, Event);
Bytes_Written := Event.Bytes_Written;
Err := Event.Err;
end Write;
end Linted.Stdio;
|
25364
|
-- Copyright 2015,2016,2017 <NAME>
--
-- 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.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Linted.Writer;
with Linted.Triggers;
package body Linted.Stdio is
package C renames Interfaces.C;
use Linted.Errors;
use Linted.KOs;
procedure Write_Line (Object : KO; Str : String) is
Dummy : Error;
begin
Write_String (Object, Str & Ada.Characters.Latin_1.LF, Dummy);
end Write_Line;
procedure Write_String (Object : KO; Str : String; Err : out Error) with
Spark_Mode => Off is
X : C.char_array := C.To_C (Str);
Bytes_Written : C.size_t;
begin
Write (Object, X (X'First)'Address, X'Length, Bytes_Written, Err);
end Write_String;
procedure Write
(Object : KO;
Buf : System.Address;
Count : C.size_t;
Bytes_Written : out C.size_t;
Err : out Error)
is
Future : Writer.Future;
Event : Writer.Event;
begin
Writer.Write (Object, Buf, Count, Triggers.Null_Signaller, Future);
Writer.Write_Wait (Future, Event);
Bytes_Written := Event.Bytes_Written;
Err := Event.Err;
end Write;
end Linted.Stdio;
| true |
-- Copyright 2015,2016,2017 PI:NAME:<NAME>END_PI
--
-- 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.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Linted.Writer;
with Linted.Triggers;
package body Linted.Stdio is
package C renames Interfaces.C;
use Linted.Errors;
use Linted.KOs;
procedure Write_Line (Object : KO; Str : String) is
Dummy : Error;
begin
Write_String (Object, Str & Ada.Characters.Latin_1.LF, Dummy);
end Write_Line;
procedure Write_String (Object : KO; Str : String; Err : out Error) with
Spark_Mode => Off is
X : C.char_array := C.To_C (Str);
Bytes_Written : C.size_t;
begin
Write (Object, X (X'First)'Address, X'Length, Bytes_Written, Err);
end Write_String;
procedure Write
(Object : KO;
Buf : System.Address;
Count : C.size_t;
Bytes_Written : out C.size_t;
Err : out Error)
is
Future : Writer.Future;
Event : Writer.Event;
begin
Writer.Write (Object, Buf, Count, Triggers.Null_Signaller, Future);
Writer.Write_Wait (Future, Event);
Bytes_Written := Event.Bytes_Written;
Err := Event.Err;
end Write;
end Linted.Stdio;
|
[
{
"context": "-- Swaggy Jenkins\n-- Jenkins API clients generated from Swagger / ",
"end": 18,
"score": 0.9998458027839661,
"start": 4,
"tag": "NAME",
"value": "Swaggy Jenkins"
}
] |
clients/ada-server/generated/src/-servers.ads
|
cliffano/jenkins-api-clients-generator
| 0 |
-- Swaggy Jenkins
-- Jenkins API clients generated from Swagger / Open API specification
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/-servers.ads
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
with Swagger.Servers;
with .Models;
with .Skeletons;
package .Servers is
pragma Warnings (Off, "*use clause for package*");
use .Models;
type Server_Type is limited new .Skeletons.Server_Type with null record;
--
-- Retrieve CSRF protection token
overriding
procedure Get_Crumb
(Server : in out Server_Type
;
Result : out .Models.DefaultCrumbIssuer_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete queue item from an organization pipeline queue
overriding
procedure Delete_Pipeline_Queue_Item
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Queue : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve authenticated user details for an organization
overriding
procedure Get_Authenticated_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get a list of class names supported by a given class
overriding
procedure Get_Classes
(Server : in out Server_Type;
Class : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Key
overriding
procedure Get_Json_Web_Key
(Server : in out Server_Type;
Key : in Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Token
overriding
procedure Get_Json_Web_Token
(Server : in out Server_Type;
Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Max_Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve organization details
overriding
procedure Get_Organisation
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Organisation_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all organizations details
overriding
procedure Get_Organisations
(Server : in out Server_Type
;
Result : out .Models.Organisation_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization
overriding
procedure Get_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.Pipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all activities details for an organization pipeline
overriding
procedure Get_Pipeline_Activities
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineActivity_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch details for an organization pipeline
overriding
procedure Get_Pipeline_Branch
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Result : out .Models.BranchImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch run details for an organization pipeline
overriding
procedure Get_Pipeline_Branch_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all branches details for an organization pipeline
overriding
procedure Get_Pipeline_Branches
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.MultibranchPipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline folder for an organization
overriding
procedure Get_Pipeline_Folder
(Server : in out Server_Type;
Organization : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineFolderImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization folder
overriding
procedure Get_Pipeline_Folder_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details for an organization pipeline
overriding
procedure Get_Pipeline_Queue
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run details for an organization pipeline
overriding
procedure Get_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run
overriding
procedure Get_Pipeline_Run_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Start : in Swagger.Nullable_Integer;
Download : in Swagger.Nullable_Boolean;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Step
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run node step
overriding
procedure Get_Pipeline_Run_Node_Step_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node steps details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Steps
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run nodes details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Nodes
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all runs details for an organization pipeline
overriding
procedure Get_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineRun_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all pipelines details for an organization
overriding
procedure Get_Pipelines
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Pipeline_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM details for an organization
overriding
procedure Get_SCM
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Result : out .Models.GithubScm_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repositories details for an organization
overriding
procedure Get_SCMOrganisation_Repositories
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Page_Size : in Swagger.Nullable_Integer;
Page_Number : in Swagger.Nullable_Integer;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repository details for an organization
overriding
procedure Get_SCMOrganisation_Repository
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Repository : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organizations details for an organization
overriding
procedure Get_SCMOrganisations
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user details for an organization
overriding
procedure Get_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
User : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user favorites details for an organization
overriding
procedure Get_User_Favorites
(Server : in out Server_Type;
User : in Swagger.UString;
Result : out .Models.FavoriteImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve users details for an organization
overriding
procedure Get_Users
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Replay an organization pipeline run
overriding
procedure Post_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Start a build for an organization pipeline
overriding
procedure Post_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Favorite/unfavorite a pipeline
overriding
procedure Put_Pipeline_Favorite
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
P_Body : in Boolean;
Result : out .Models.FavoriteImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a build of an organization pipeline
overriding
procedure Put_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Blocking : in Swagger.Nullable_UString;
Time_Out_In_Secs : in Swagger.Nullable_Integer;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Search for any resource details
overriding
procedure Search
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Get classes details
overriding
procedure Search_Classes
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve computer details
overriding
procedure Get_Computer
(Server : in out Server_Type;
Depth : in Integer;
Result : out .Models.ComputerSet_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins details
overriding
procedure Get_Jenkins
(Server : in out Server_Type
;
Result : out .Models.Hudson_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job details
overriding
procedure Get_Job
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleProject_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job configuration
overriding
procedure Get_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's last build details
overriding
procedure Get_Job_Last_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleBuild_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's build progressive text output
overriding
procedure Get_Job_Progressive_Text
(Server : in out Server_Type;
Name : in Swagger.UString;
Number : in Swagger.UString;
Start : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details
overriding
procedure Get_Queue
(Server : in out Server_Type
;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queued item details
overriding
procedure Get_Queue_Item
(Server : in out Server_Type;
Number : in Swagger.UString;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view details
overriding
procedure Get_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.ListView_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view configuration
overriding
procedure Get_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins headers
overriding
procedure Head_Jenkins
(Server : in out Server_Type
;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new job using job configuration, or copied from an existing job
overriding
procedure Post_Create_Item
(Server : in out Server_Type;
Name : in Swagger.UString;
From : in Swagger.Nullable_UString;
Mode : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new view using view configuration
overriding
procedure Post_Create_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Build a job
overriding
procedure Post_Job_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Json : in Swagger.UString;
Token : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update job configuration
overriding
procedure Post_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete a job
overriding
procedure Post_Job_Delete
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Disable a job
overriding
procedure Post_Job_Disable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Enable a job
overriding
procedure Post_Job_Enable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a job
overriding
procedure Post_Job_Last_Build_Stop
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update view configuration
overriding
procedure Post_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
package Server_Impl is
new .Skeletons.Shared_Instance (Server_Type);
end .Servers;
|
19719
|
-- <NAME>
-- Jenkins API clients generated from Swagger / Open API specification
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/-servers.ads
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
with Swagger.Servers;
with .Models;
with .Skeletons;
package .Servers is
pragma Warnings (Off, "*use clause for package*");
use .Models;
type Server_Type is limited new .Skeletons.Server_Type with null record;
--
-- Retrieve CSRF protection token
overriding
procedure Get_Crumb
(Server : in out Server_Type
;
Result : out .Models.DefaultCrumbIssuer_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete queue item from an organization pipeline queue
overriding
procedure Delete_Pipeline_Queue_Item
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Queue : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve authenticated user details for an organization
overriding
procedure Get_Authenticated_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get a list of class names supported by a given class
overriding
procedure Get_Classes
(Server : in out Server_Type;
Class : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Key
overriding
procedure Get_Json_Web_Key
(Server : in out Server_Type;
Key : in Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Token
overriding
procedure Get_Json_Web_Token
(Server : in out Server_Type;
Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Max_Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve organization details
overriding
procedure Get_Organisation
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Organisation_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all organizations details
overriding
procedure Get_Organisations
(Server : in out Server_Type
;
Result : out .Models.Organisation_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization
overriding
procedure Get_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.Pipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all activities details for an organization pipeline
overriding
procedure Get_Pipeline_Activities
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineActivity_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch details for an organization pipeline
overriding
procedure Get_Pipeline_Branch
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Result : out .Models.BranchImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch run details for an organization pipeline
overriding
procedure Get_Pipeline_Branch_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all branches details for an organization pipeline
overriding
procedure Get_Pipeline_Branches
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.MultibranchPipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline folder for an organization
overriding
procedure Get_Pipeline_Folder
(Server : in out Server_Type;
Organization : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineFolderImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization folder
overriding
procedure Get_Pipeline_Folder_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details for an organization pipeline
overriding
procedure Get_Pipeline_Queue
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run details for an organization pipeline
overriding
procedure Get_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run
overriding
procedure Get_Pipeline_Run_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Start : in Swagger.Nullable_Integer;
Download : in Swagger.Nullable_Boolean;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Step
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run node step
overriding
procedure Get_Pipeline_Run_Node_Step_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node steps details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Steps
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run nodes details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Nodes
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all runs details for an organization pipeline
overriding
procedure Get_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineRun_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all pipelines details for an organization
overriding
procedure Get_Pipelines
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Pipeline_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM details for an organization
overriding
procedure Get_SCM
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Result : out .Models.GithubScm_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repositories details for an organization
overriding
procedure Get_SCMOrganisation_Repositories
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Page_Size : in Swagger.Nullable_Integer;
Page_Number : in Swagger.Nullable_Integer;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repository details for an organization
overriding
procedure Get_SCMOrganisation_Repository
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Repository : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organizations details for an organization
overriding
procedure Get_SCMOrganisations
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user details for an organization
overriding
procedure Get_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
User : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user favorites details for an organization
overriding
procedure Get_User_Favorites
(Server : in out Server_Type;
User : in Swagger.UString;
Result : out .Models.FavoriteImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve users details for an organization
overriding
procedure Get_Users
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Replay an organization pipeline run
overriding
procedure Post_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Start a build for an organization pipeline
overriding
procedure Post_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Favorite/unfavorite a pipeline
overriding
procedure Put_Pipeline_Favorite
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
P_Body : in Boolean;
Result : out .Models.FavoriteImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a build of an organization pipeline
overriding
procedure Put_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Blocking : in Swagger.Nullable_UString;
Time_Out_In_Secs : in Swagger.Nullable_Integer;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Search for any resource details
overriding
procedure Search
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Get classes details
overriding
procedure Search_Classes
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve computer details
overriding
procedure Get_Computer
(Server : in out Server_Type;
Depth : in Integer;
Result : out .Models.ComputerSet_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins details
overriding
procedure Get_Jenkins
(Server : in out Server_Type
;
Result : out .Models.Hudson_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job details
overriding
procedure Get_Job
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleProject_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job configuration
overriding
procedure Get_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's last build details
overriding
procedure Get_Job_Last_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleBuild_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's build progressive text output
overriding
procedure Get_Job_Progressive_Text
(Server : in out Server_Type;
Name : in Swagger.UString;
Number : in Swagger.UString;
Start : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details
overriding
procedure Get_Queue
(Server : in out Server_Type
;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queued item details
overriding
procedure Get_Queue_Item
(Server : in out Server_Type;
Number : in Swagger.UString;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view details
overriding
procedure Get_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.ListView_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view configuration
overriding
procedure Get_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins headers
overriding
procedure Head_Jenkins
(Server : in out Server_Type
;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new job using job configuration, or copied from an existing job
overriding
procedure Post_Create_Item
(Server : in out Server_Type;
Name : in Swagger.UString;
From : in Swagger.Nullable_UString;
Mode : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new view using view configuration
overriding
procedure Post_Create_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Build a job
overriding
procedure Post_Job_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Json : in Swagger.UString;
Token : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update job configuration
overriding
procedure Post_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete a job
overriding
procedure Post_Job_Delete
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Disable a job
overriding
procedure Post_Job_Disable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Enable a job
overriding
procedure Post_Job_Enable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a job
overriding
procedure Post_Job_Last_Build_Stop
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update view configuration
overriding
procedure Post_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
package Server_Impl is
new .Skeletons.Shared_Instance (Server_Type);
end .Servers;
| true |
-- PI:NAME:<NAME>END_PI
-- Jenkins API clients generated from Swagger / Open API specification
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/-servers.ads
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
with Swagger.Servers;
with .Models;
with .Skeletons;
package .Servers is
pragma Warnings (Off, "*use clause for package*");
use .Models;
type Server_Type is limited new .Skeletons.Server_Type with null record;
--
-- Retrieve CSRF protection token
overriding
procedure Get_Crumb
(Server : in out Server_Type
;
Result : out .Models.DefaultCrumbIssuer_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete queue item from an organization pipeline queue
overriding
procedure Delete_Pipeline_Queue_Item
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Queue : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve authenticated user details for an organization
overriding
procedure Get_Authenticated_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get a list of class names supported by a given class
overriding
procedure Get_Classes
(Server : in out Server_Type;
Class : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Key
overriding
procedure Get_Json_Web_Key
(Server : in out Server_Type;
Key : in Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve JSON Web Token
overriding
procedure Get_Json_Web_Token
(Server : in out Server_Type;
Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Max_Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve organization details
overriding
procedure Get_Organisation
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Organisation_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all organizations details
overriding
procedure Get_Organisations
(Server : in out Server_Type
;
Result : out .Models.Organisation_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization
overriding
procedure Get_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.Pipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all activities details for an organization pipeline
overriding
procedure Get_Pipeline_Activities
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineActivity_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch details for an organization pipeline
overriding
procedure Get_Pipeline_Branch
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Result : out .Models.BranchImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve branch run details for an organization pipeline
overriding
procedure Get_Pipeline_Branch_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all branches details for an organization pipeline
overriding
procedure Get_Pipeline_Branches
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.MultibranchPipeline_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline folder for an organization
overriding
procedure Get_Pipeline_Folder
(Server : in out Server_Type;
Organization : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineFolderImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve pipeline details for an organization folder
overriding
procedure Get_Pipeline_Folder_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details for an organization pipeline
overriding
procedure Get_Pipeline_Queue
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run details for an organization pipeline
overriding
procedure Get_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run
overriding
procedure Get_Pipeline_Run_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Start : in Swagger.Nullable_Integer;
Download : in Swagger.Nullable_Boolean;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Step
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Get log for a pipeline run node step
overriding
procedure Get_Pipeline_Run_Node_Step_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run node steps details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Steps
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve run nodes details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Nodes
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all runs details for an organization pipeline
overriding
procedure Get_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineRun_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve all pipelines details for an organization
overriding
procedure Get_Pipelines
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Pipeline_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM details for an organization
overriding
procedure Get_SCM
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Result : out .Models.GithubScm_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repositories details for an organization
overriding
procedure Get_SCMOrganisation_Repositories
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Page_Size : in Swagger.Nullable_Integer;
Page_Number : in Swagger.Nullable_Integer;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organization repository details for an organization
overriding
procedure Get_SCMOrganisation_Repository
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Repository : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve SCM organizations details for an organization
overriding
procedure Get_SCMOrganisations
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.GithubOrganization_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user details for an organization
overriding
procedure Get_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
User : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve user favorites details for an organization
overriding
procedure Get_User_Favorites
(Server : in out Server_Type;
User : in Swagger.UString;
Result : out .Models.FavoriteImpl_Type_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve users details for an organization
overriding
procedure Get_Users
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Replay an organization pipeline run
overriding
procedure Post_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Start a build for an organization pipeline
overriding
procedure Post_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Favorite/unfavorite a pipeline
overriding
procedure Put_Pipeline_Favorite
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
P_Body : in Boolean;
Result : out .Models.FavoriteImpl_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a build of an organization pipeline
overriding
procedure Put_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Blocking : in Swagger.Nullable_UString;
Time_Out_In_Secs : in Swagger.Nullable_Integer;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Search for any resource details
overriding
procedure Search
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Get classes details
overriding
procedure Search_Classes
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve computer details
overriding
procedure Get_Computer
(Server : in out Server_Type;
Depth : in Integer;
Result : out .Models.ComputerSet_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins details
overriding
procedure Get_Jenkins
(Server : in out Server_Type
;
Result : out .Models.Hudson_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job details
overriding
procedure Get_Job
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleProject_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job configuration
overriding
procedure Get_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's last build details
overriding
procedure Get_Job_Last_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleBuild_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve job's build progressive text output
overriding
procedure Get_Job_Progressive_Text
(Server : in out Server_Type;
Name : in Swagger.UString;
Number : in Swagger.UString;
Start : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queue details
overriding
procedure Get_Queue
(Server : in out Server_Type
;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve queued item details
overriding
procedure Get_Queue_Item
(Server : in out Server_Type;
Number : in Swagger.UString;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view details
overriding
procedure Get_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.ListView_Type;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve view configuration
overriding
procedure Get_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Retrieve Jenkins headers
overriding
procedure Head_Jenkins
(Server : in out Server_Type
;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new job using job configuration, or copied from an existing job
overriding
procedure Post_Create_Item
(Server : in out Server_Type;
Name : in Swagger.UString;
From : in Swagger.Nullable_UString;
Mode : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Create a new view using view configuration
overriding
procedure Post_Create_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Build a job
overriding
procedure Post_Job_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Json : in Swagger.UString;
Token : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update job configuration
overriding
procedure Post_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Delete a job
overriding
procedure Post_Job_Delete
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Disable a job
overriding
procedure Post_Job_Disable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Enable a job
overriding
procedure Post_Job_Enable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Stop a job
overriding
procedure Post_Job_Last_Build_Stop
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
-- Update view configuration
overriding
procedure Post_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
package Server_Impl is
new .Skeletons.Shared_Instance (Server_Type);
end .Servers;
|
[
{
"context": "-- Shoot'n'loot\n-- Copyright (c) 2020 Fabien Chouteau\n\nwith HAL; use HAL;\n\nwith Levels;\nwith Player;\nwi",
"end": 55,
"score": 0.9997922778129578,
"start": 40,
"tag": "NAME",
"value": "Fabien Chouteau"
}
] |
src/game.adb
|
thomas070605/shoot-n-loot
| 0 |
-- Shoot'n'loot
-- Copyright (c) 2020 Fabien Chouteau
with HAL; use HAL;
with Levels;
with Player;
with Render;
with Monsters;
with Chests;
with Score_Display;
with Sound;
with PyGamer.Controls;
use PyGamer;
with GESTE_Config; use GESTE_Config;
with GESTE;
with GESTE.Tile_Bank;
with GESTE.Grid;
with Game_Assets;
with Game_Assets.Tileset;
with Game_Assets.Tileset_Collisions;
with Game_Assets.title_screen;
package body Game is
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
Game_Assets.Tileset_Collisions.Tiles'Access,
Game_Assets.Palette'Access);
Gameover_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Gameover.Data'Access,
Tile_Bank'Access);
Victory_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Victory.Data'Access,
Tile_Bank'Access);
Back_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Back.Data'Access,
Tile_Bank'Access);
procedure Game_Over;
procedure Victory (Time_In_Game : Time.Time_Ms);
---------------
-- Game_Over --
---------------
procedure Game_Over is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Gameover;
Gameover_Grid.Move ((0, 0));
GESTE.Add (Gameover_Grid'Access, 10);
Render.Render_All (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
GESTE.Remove_All;
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Game_Over;
-------------
-- Victory --
-------------
procedure Victory (Time_In_Game : Time.Time_Ms) is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Victory;
GESTE.Remove_All;
Back_Grid.Move ((0, 0));
GESTE.Add (Back_Grid'Access, 1);
Victory_Grid.Move ((0, 0));
GESTE.Add (Victory_Grid'Access, 2);
Score_Display.Init ((10 * Tile_Size, 12 * Tile_Size));
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Victory;
---------------
-- Game_Loop --
---------------
function Game_Loop (Time_In_Game : in out PyGamer.Time.Time_Ms)
return Boolean
is
use type Levels.Level_Id;
Current_Level : Levels.Level_Id := Levels.Lvl_0;
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
Frame_Count : UInt32 := 0;
Exit_Open : Boolean := False;
begin
Time_In_Game := 0;
Levels.Enter (Current_Level);
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
-- Check game-over
if not Player.Is_Alive then
Game_Over;
return False;
end if;
-- Open exit and check victory
if not Exit_Open
and then
Chests.All_Open
and then
Monsters.All_Killed
then
Exit_Open := True;
Levels.Open_Exit;
end if;
if Exit_Open then
if Levels.Test_Exit (Player.Position) then
Sound.Play_Exit_Taken;
if Current_Level = Levels.Level_Id'Last then
Victory (Time_In_Game);
return True;
end if;
Current_Level := Levels.Level_Id'Succ (Current_Level);
Levels.Enter (Current_Level);
Exit_Open := False;
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
end if;
end if;
Controls.Scan;
if Controls.Falling (Controls.A) then
Player.Jump;
end if;
if Controls.Falling (Controls.B) then
Player.Fire;
end if;
if Controls.Pressed (Controls.Left) then
Player.Move_Left;
end if;
if Controls.Pressed (Controls.Right) then
Player.Move_Right;
end if;
Player.Update;
Monsters.Update;
Chests.Check_Chest_Found (Player.Position);
Chests.Update;
Score_Display.Update (Time_In_Game);
Render.Render_Dirty (Render.Background_Color);
Frame_Count := Frame_Count + 1;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
Time_In_Game := Time_In_Game + Period;
end loop;
end Game_Loop;
end Game;
|
28855
|
-- Shoot'n'loot
-- Copyright (c) 2020 <NAME>
with HAL; use HAL;
with Levels;
with Player;
with Render;
with Monsters;
with Chests;
with Score_Display;
with Sound;
with PyGamer.Controls;
use PyGamer;
with GESTE_Config; use GESTE_Config;
with GESTE;
with GESTE.Tile_Bank;
with GESTE.Grid;
with Game_Assets;
with Game_Assets.Tileset;
with Game_Assets.Tileset_Collisions;
with Game_Assets.title_screen;
package body Game is
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
Game_Assets.Tileset_Collisions.Tiles'Access,
Game_Assets.Palette'Access);
Gameover_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Gameover.Data'Access,
Tile_Bank'Access);
Victory_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Victory.Data'Access,
Tile_Bank'Access);
Back_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Back.Data'Access,
Tile_Bank'Access);
procedure Game_Over;
procedure Victory (Time_In_Game : Time.Time_Ms);
---------------
-- Game_Over --
---------------
procedure Game_Over is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Gameover;
Gameover_Grid.Move ((0, 0));
GESTE.Add (Gameover_Grid'Access, 10);
Render.Render_All (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
GESTE.Remove_All;
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Game_Over;
-------------
-- Victory --
-------------
procedure Victory (Time_In_Game : Time.Time_Ms) is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Victory;
GESTE.Remove_All;
Back_Grid.Move ((0, 0));
GESTE.Add (Back_Grid'Access, 1);
Victory_Grid.Move ((0, 0));
GESTE.Add (Victory_Grid'Access, 2);
Score_Display.Init ((10 * Tile_Size, 12 * Tile_Size));
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Victory;
---------------
-- Game_Loop --
---------------
function Game_Loop (Time_In_Game : in out PyGamer.Time.Time_Ms)
return Boolean
is
use type Levels.Level_Id;
Current_Level : Levels.Level_Id := Levels.Lvl_0;
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
Frame_Count : UInt32 := 0;
Exit_Open : Boolean := False;
begin
Time_In_Game := 0;
Levels.Enter (Current_Level);
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
-- Check game-over
if not Player.Is_Alive then
Game_Over;
return False;
end if;
-- Open exit and check victory
if not Exit_Open
and then
Chests.All_Open
and then
Monsters.All_Killed
then
Exit_Open := True;
Levels.Open_Exit;
end if;
if Exit_Open then
if Levels.Test_Exit (Player.Position) then
Sound.Play_Exit_Taken;
if Current_Level = Levels.Level_Id'Last then
Victory (Time_In_Game);
return True;
end if;
Current_Level := Levels.Level_Id'Succ (Current_Level);
Levels.Enter (Current_Level);
Exit_Open := False;
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
end if;
end if;
Controls.Scan;
if Controls.Falling (Controls.A) then
Player.Jump;
end if;
if Controls.Falling (Controls.B) then
Player.Fire;
end if;
if Controls.Pressed (Controls.Left) then
Player.Move_Left;
end if;
if Controls.Pressed (Controls.Right) then
Player.Move_Right;
end if;
Player.Update;
Monsters.Update;
Chests.Check_Chest_Found (Player.Position);
Chests.Update;
Score_Display.Update (Time_In_Game);
Render.Render_Dirty (Render.Background_Color);
Frame_Count := Frame_Count + 1;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
Time_In_Game := Time_In_Game + Period;
end loop;
end Game_Loop;
end Game;
| true |
-- Shoot'n'loot
-- Copyright (c) 2020 PI:NAME:<NAME>END_PI
with HAL; use HAL;
with Levels;
with Player;
with Render;
with Monsters;
with Chests;
with Score_Display;
with Sound;
with PyGamer.Controls;
use PyGamer;
with GESTE_Config; use GESTE_Config;
with GESTE;
with GESTE.Tile_Bank;
with GESTE.Grid;
with Game_Assets;
with Game_Assets.Tileset;
with Game_Assets.Tileset_Collisions;
with Game_Assets.title_screen;
package body Game is
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
Game_Assets.Tileset_Collisions.Tiles'Access,
Game_Assets.Palette'Access);
Gameover_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Gameover.Data'Access,
Tile_Bank'Access);
Victory_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Victory.Data'Access,
Tile_Bank'Access);
Back_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Back.Data'Access,
Tile_Bank'Access);
procedure Game_Over;
procedure Victory (Time_In_Game : Time.Time_Ms);
---------------
-- Game_Over --
---------------
procedure Game_Over is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Gameover;
Gameover_Grid.Move ((0, 0));
GESTE.Add (Gameover_Grid'Access, 10);
Render.Render_All (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
GESTE.Remove_All;
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Game_Over;
-------------
-- Victory --
-------------
procedure Victory (Time_In_Game : Time.Time_Ms) is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Sound.Play_Victory;
GESTE.Remove_All;
Back_Grid.Move ((0, 0));
GESTE.Add (Back_Grid'Access, 1);
Victory_Grid.Move ((0, 0));
GESTE.Add (Victory_Grid'Access, 2);
Score_Display.Init ((10 * Tile_Size, 12 * Tile_Size));
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
Controls.Scan;
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
return;
end if;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Victory;
---------------
-- Game_Loop --
---------------
function Game_Loop (Time_In_Game : in out PyGamer.Time.Time_Ms)
return Boolean
is
use type Levels.Level_Id;
Current_Level : Levels.Level_Id := Levels.Lvl_0;
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
Frame_Count : UInt32 := 0;
Exit_Open : Boolean := False;
begin
Time_In_Game := 0;
Levels.Enter (Current_Level);
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
loop
-- Check game-over
if not Player.Is_Alive then
Game_Over;
return False;
end if;
-- Open exit and check victory
if not Exit_Open
and then
Chests.All_Open
and then
Monsters.All_Killed
then
Exit_Open := True;
Levels.Open_Exit;
end if;
if Exit_Open then
if Levels.Test_Exit (Player.Position) then
Sound.Play_Exit_Taken;
if Current_Level = Levels.Level_Id'Last then
Victory (Time_In_Game);
return True;
end if;
Current_Level := Levels.Level_Id'Succ (Current_Level);
Levels.Enter (Current_Level);
Exit_Open := False;
Score_Display.Update (Time_In_Game);
Render.Scroll_New_Scene (Render.Background_Color);
Next_Release := Time.Clock + Period;
end if;
end if;
Controls.Scan;
if Controls.Falling (Controls.A) then
Player.Jump;
end if;
if Controls.Falling (Controls.B) then
Player.Fire;
end if;
if Controls.Pressed (Controls.Left) then
Player.Move_Left;
end if;
if Controls.Pressed (Controls.Right) then
Player.Move_Right;
end if;
Player.Update;
Monsters.Update;
Chests.Check_Chest_Found (Player.Position);
Chests.Update;
Score_Display.Update (Time_In_Game);
Render.Render_Dirty (Render.Background_Color);
Frame_Count := Frame_Count + 1;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
Time_In_Game := Time_In_Game + Period;
end loop;
end Game_Loop;
end Game;
|
[
{
"context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- This program is free so",
"end": 44,
"score": 0.9998735189437866,
"start": 22,
"tag": "NAME",
"value": "Bartek thindil Jasicki"
},
{
"context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- This program is free software: you can red",
"end": 63,
"score": 0.9999356865882874,
"start": 46,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/ui/table.adb
|
thindil/steamsky
| 80 |
-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Interfaces.C;
with GNAT.String_Split; use GNAT.String_Split;
with CArgv;
with Tcl; use Tcl;
with Tcl.Ada; use Tcl.Ada;
with Tcl.Tk.Ada; use Tcl.Tk.Ada;
with Tcl.Tk.Ada.Grid;
with Tcl.Tk.Ada.Pack;
with Tcl.Tk.Ada.TtkStyle; use Tcl.Tk.Ada.TtkStyle;
with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets;
with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton;
with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame;
with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo;
with Tcl.Tklib.Ada.Autoscroll; use Tcl.Tklib.Ada.Autoscroll;
with Tcl.Tklib.Ada.Tooltip; use Tcl.Tklib.Ada.Tooltip;
with Config; use Config;
with Utils.UI; use Utils.UI;
package body Table is
function CreateTable
(Parent: String; Headers: Headers_Array;
Scrollbar: Ttk_Scrollbar := Get_Widget(".");
Command, Tooltip: String := "") return Table_Widget is
Canvas: Tk_Canvas;
YScroll: Ttk_Scrollbar;
XScroll: Ttk_Scrollbar;
Table: Table_Widget (Headers'Length);
X: Natural := 5;
Tokens: Slice_Set;
Master: constant Tk_Canvas := Get_Widget(Parent);
Header_Id: Unbounded_String;
begin
if Widget_Image(Scrollbar) = "." then
YScroll :=
Create
(Parent & ".scrolly",
"-orient vertical -command [list " & Parent & ".table yview]");
XScroll :=
Create
(Parent & ".scrollx",
"-orient horizontal -command [list " & Parent & ".table xview]");
Canvas :=
Create
(Parent & ".table",
"-yscrollcommand [list " & Parent &
".scrolly set] -xscrollcommand [list " & Parent &
".scrollx set]");
Tcl.Tk.Ada.Pack.Pack(YScroll, "-side right -fill y");
Tcl.Tk.Ada.Pack.Pack(Canvas, "-side top -fill both -padx {5 0}");
Tcl.Tk.Ada.Pack.Pack(XScroll, "-side bottom -fill x");
Autoscroll(XScroll);
Autoscroll(YScroll);
Table.Scrollbar := YScroll;
else
Canvas := Create(Parent & ".table");
Tcl.Tk.Ada.Grid.Grid(Canvas, "-sticky nwes -padx {5 0}");
Tcl.Tk.Ada.Grid.Column_Configure(Master, Canvas, "-weight 1");
Tcl.Tk.Ada.Grid.Row_Configure(Master, Canvas, "-weight 1");
Table.Scrollbar := Scrollbar;
end if;
Create_Headers_Loop :
for I in Headers'Range loop
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "text",
Trim(Natural'Image(X), Left) & " 2 -anchor nw -text {" &
To_String(Headers(I)) &
"} -font InterfaceFont -justify center -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) &
" -foreground] -tags [list header" &
Trim(Positive'Image(I), Left) & "]"));
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Create
(Tokens, BBox(Canvas, "header" & Trim(Positive'Image(I), Left)),
" ");
X := Positive'Value(Slice(Tokens, 3)) + 10;
Table.Columns_Width(I) := X - Positive'Value(Slice(Tokens, 1));
if I = 1 then
Table.Row_Height := Positive'Value(Slice(Tokens, 4)) + 5;
end if;
end loop Create_Headers_Loop;
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "rectangle",
"0 0" & Positive'Image(X) &
Positive'Image(Table.Row_Height - 3) & " -fill " &
Style_Lookup("Table", "-headercolor") & " -outline " &
Style_Lookup("Table", "-rowcolor") &
" -width 2 -tags [list headerback]"));
Lower(Canvas, "headerback");
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Table.Canvas := Canvas;
Tcl_Eval
(Get_Context,
"SetScrollbarBindings " & Table.Canvas & " " & Table.Scrollbar);
Bind
(Table.Canvas, "<Up>",
"{UpdateCurrentRow " & Table.Canvas & " lower}");
Bind
(Table.Canvas, "<Down>",
"{UpdateCurrentRow " & Table.Canvas & " raise}");
Bind
(Table.Canvas, "<Key-space>",
"{ExecuteCurrentRow " & Table.Canvas & "}");
Bind
(Table.Canvas, "<FocusOut>", "{HideCurrentRow " & Table.Canvas & "}");
Bind(Table.Canvas, "<Leave>", "{HideCurrentRow " & Table.Canvas & "}");
return Table;
end CreateTable;
procedure ClearTable(Table: in out Table_Widget) is
ButtonsFrame: Ttk_Frame := Get_Widget(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if Winfo_Get(ButtonsFrame, "exists") = "1" then
Button := Get_Widget(ButtonsFrame & ".previous");
Destroy(Button);
Button := Get_Widget(ButtonsFrame & ".next");
Destroy(Button);
Destroy(ButtonsFrame);
end if;
Clear_Rows_Loop :
for Row in 1 .. Table.Row loop
Clear_Columns_Loop :
for Column in 1 .. Table.Amount loop
Delete
(Table.Canvas,
"row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Positive'Image(Column), Left));
Delete(Table.Canvas, "row" & Trim(Positive'Image(Row), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Positive'Image(Column), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Positive'Image(Column), Left));
end loop Clear_Columns_Loop;
end loop Clear_Rows_Loop;
Table.Row := 1;
end ClearTable;
-- ****if* Table/Add_Bindings
-- FUNCTION
-- Add events to the selected element of the Table_Widget
-- PARAMETERS
-- Canvas - Tk_Canvas in which the events will be added
-- ItemId - The id of the item to which the events will be added
-- Row - The number of row in which the events will be added
-- Command - The Tcl command which will be executed on mouse button event
-- HISTORY
-- 6.6 - Added
-- SOURCE
procedure Add_Bindings
(Canvas: Tk_Canvas; ItemId, Row, Command, Color: String) is
-- ****
begin
Bind
(Canvas, ItemId, "<Enter>",
"{" & Canvas & " itemconfigure row$currentrow -fill " & Color & ";" &
Canvas & " itemconfigure row" & Row & " -fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground") &
(if Command'Length > 0 then ";" & Canvas & " configure -cursor hand1"
else "") &
";set currentrow " & Row & "}");
Bind
(Canvas, ItemId, "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
if Command'Length > 0 then
Bind
(Canvas, ItemId,
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">",
"{" & Command & "}");
end if;
end Add_Bindings;
-- ****if* Table/Table.AddBackground
-- FUNCTION
-- Add a proper background color to the item in the table and return the
-- name of used color
-- PARAMETERS
-- Table - The Table_Widget in which background will be added
-- NewRow - If True, add the background, otherwise just return the color
-- which will be used
-- Command - Tcl command which will be executed when the background was
-- clicked
-- RESULT
-- The String with the name of the color used for set background for the
-- item
-- SOURCE
function AddBackground
(Table: Table_Widget; NewRow: Boolean; Command: String) return String is
-- ****
ItemId: Unbounded_String;
Color: constant String :=
(if Table.Row rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
if not NewRow then
return Color;
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
" 0" & Positive'Image((Table.Row * Table.Row_Height)) & " 10" &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height)) &
" -fill " & Color & " -width 0 -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "]"));
Lower(Table.Canvas, To_String(ItemId));
Add_Bindings
(Table.Canvas, "row" & Trim(Positive'Image(Table.Row), Left),
Trim(Positive'Image(Table.Row), Left), Command, Color);
return Color;
end AddBackground;
procedure AddButton
(Table: in out Table_Widget; Text, Tooltip, Command: String;
Column: Positive; NewRow: Boolean := False; Color: String := "") is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Text_Color: constant String :=
(if Color'Length > 0 then Color
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-foreground"));
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "text",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -text {" & Text & "} -font InterfaceFont -fill " &
Text_Color & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddButton;
procedure UpdateTable
(Table: in out Table_Widget; Grab_Focus: Boolean := True) is
Tag: Unbounded_String;
NewX: Natural := Table.Columns_Width(1) + 20;
NewY: Natural := 2;
begin
Update_Columns_Loop :
for Column in 2 .. Table.Amount loop
Tag :=
To_Unbounded_String("header" & Trim(Natural'Image(Column), Left));
Coords
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX), Left) & Positive'Image(NewY));
Update_Rows_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String
("row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY + 5), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX + 2), Left),
Trim(Positive'Image(NewY + 7), Left));
end loop Update_Rows_Loop;
NewX := NewX + Table.Columns_Width(Column) + 20;
NewY := 2;
end loop Update_Columns_Loop;
declare
Tokens: Slice_Set;
begin
Create(Tokens, BBox(Table.Canvas, "all"), " ");
-- if no scrollbars, resize the table
if Winfo_Get(Table.Canvas, "parent") /=
Winfo_Get(Table.Scrollbar, "parent") then
configure
(Table.Canvas,
"-height [expr " & Slice(Tokens, 4) & " - " & Slice(Tokens, 2) &
"] -width [expr " & Slice(Tokens, 3) & " - " &
Slice(Tokens, 1) & " + 5]");
end if;
Coords
(Table.Canvas, "headerback",
"0 0" & Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(Table.Row_Height - 3));
NewY := Table.Row_Height;
Resize_Background_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String("row" & Trim(Positive'Image(Row), Left));
Coords
(Table.Canvas, To_String(Tag),
"0" & Positive'Image(NewY - Table.Row_Height) &
Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(NewY));
end loop Resize_Background_Loop;
end;
Tcl_SetVar(Get_Context, "currentrow", "1");
Bind
(Table.Canvas, "<FocusIn>",
"{set maxrows" & Natural'Image(Table.Row) &
";if {$currentrow > $maxrows} {set currentrow 1};" & Table.Canvas &
" itemconfigure row$currentrow -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) & " -selectbackground]}");
if Grab_Focus then
Widgets.Focus(Table.Canvas);
end if;
end UpdateTable;
procedure AddProgressBar
(Table: in out Table_Widget; Value: Natural; MaxValue: Positive;
Tooltip, Command: String; Column: Positive;
NewRow, InvertColors: Boolean := False) is
X: Natural := 0;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Length: constant Natural :=
Natural
(100.0 +
((Float(Value) - Float(MaxValue)) / Float(MaxValue) * 100.0));
Color: Unbounded_String;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 5) &
Positive'Image(X + 102) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 10)) &
" -fill " & Style_Lookup("TProgressbar", "-troughcolor") &
" -outline " & Style_Lookup("TProgressbar", "-bordercolor") &
" -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "back" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if not InvertColors then
Color :=
To_Unbounded_String
(if Length > 74 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
else
Color :=
To_Unbounded_String
(if Length < 25 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 and Length < 75 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X + 2), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 7) &
Positive'Image(X + Length) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 12)) &
" -fill " & To_String(Color) & " -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "bar" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddProgressBar;
procedure AddPagination
(Table: in out Table_Widget; PreviousCommand, NextCommand: String) is
ButtonsFrame: constant Ttk_Frame :=
Create(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if PreviousCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".previous",
"-text Previous -command {" & PreviousCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky w");
Add(Button, "Previous page");
end if;
if NextCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".next",
"-text Next -command {" & NextCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky e -row 0 -column 1");
Add(Button, "Next page");
end if;
Tcl_Eval(Get_Interp(Table.Canvas), "update");
Canvas_Create
(Table.Canvas, "window",
"0" & Positive'Image(Table.Row * Table.Row_Height) &
" -anchor nw -window " & ButtonsFrame);
end AddPagination;
procedure AddCheckButton
(Table: in out Table_Widget; Tooltip, Command: String; Checked: Boolean;
Column: Positive; NewRow: Boolean := False) is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
ImageName: constant String :=
"${ttk::theme::" & Theme_Use & "::I(checkbox-" &
(if Checked then "checked" else "unchecked") & ")}";
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "image",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -image " & ImageName & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if Command'Length > 0 then
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddCheckButton;
function Get_Column_Number
(Table: Table_Widget; X_Position: Natural) return Positive is
Position: Positive := X_Position;
begin
for I in Table.Columns_Width'Range loop
if Position < Table.Columns_Width(I) + 20 then
return I;
end if;
Position := Position - Table.Columns_Width(I) - 20;
end loop;
return 1;
end Get_Column_Number;
procedure Update_Headers_Command(Table: Table_Widget; Command: String) is
begin
if Command'Length > 0 then
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{" & Command & " %x}");
end loop;
Bind
(Table.Canvas, "headerback", "<Enter>",
"{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "headerback", "<Leave>",
"{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "headerback", "<Button-1>", "{" & Command & " %x}");
else
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{}");
end loop;
Bind(Table.Canvas, "headerback", "<Enter>", "{}");
Bind(Table.Canvas, "headerback", "<Leave>", "{}");
Bind(Table.Canvas, "headerback", "<Button-1>", "{}");
end if;
end Update_Headers_Command;
-- ****o* Table/Table.Update_Current_Row_Command
-- FUNCTION
-- Update Tcl variable currentrow and show the currently selected row in
-- the table
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- UpdateCurrentRow canvas action
-- Canvas is the name of Table Tk_Canvas in which the current row will
-- be updated, action is the name of action which will be taken. Can be
-- raise or lower
-- SOURCE
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
CurrentRow: Natural := Natural'Value(Tcl_GetVar(Interp, "currentrow"));
MaxRows: constant Natural :=
Natural'Value(Tcl_GetVar(Interp, "maxrows")) - 1;
Color: constant String :=
(if CurrentRow rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
if CArgv.Arg(Argv, 2) = "lower" then
CurrentRow := CurrentRow - 1;
if CurrentRow = 0 then
CurrentRow := 1;
end if;
else
CurrentRow := CurrentRow + 1;
if CurrentRow > MaxRows then
CurrentRow := MaxRows;
end if;
end if;
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
Item_Configure
(Canvas, "row" & Trim(Natural'Image(CurrentRow), Left),
"-fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground"));
Tcl_SetVar(Interp, "currentrow", Trim(Natural'Image(CurrentRow), Left));
return TCL_OK;
end Update_Current_Row_Command;
-- ****o* Table/Table.Execute_Current_Row_Command
-- FUNCTION
-- Execute the Tcl command associated with the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ExecuteCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the Tcl command related
-- to the current row will be executed
-- SOURCE
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
Tcl_Eval
(Interp,
Bind
(Canvas, "row$currentrow",
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">"));
return TCL_OK;
end Execute_Current_Row_Command;
-- ****o* Table/Table.Hide_Current_Row_Command
-- FUNCTION
-- Set the normal background color for the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- HideCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the selected row
-- background will be recolored
-- SOURCE
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
Color: constant String :=
(if Natural'Value(Tcl_GetVar(Interp, "currentrow")) rem 2 > 0 then
Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
return TCL_OK;
end Hide_Current_Row_Command;
procedure AddCommands is
begin
Add_Command("UpdateCurrentRow", Update_Current_Row_Command'Access);
Add_Command("ExecuteCurrentRow", Execute_Current_Row_Command'Access);
Add_Command("HideCurrentRow", Hide_Current_Row_Command'Access);
end AddCommands;
end Table;
|
4719
|
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Interfaces.C;
with GNAT.String_Split; use GNAT.String_Split;
with CArgv;
with Tcl; use Tcl;
with Tcl.Ada; use Tcl.Ada;
with Tcl.Tk.Ada; use Tcl.Tk.Ada;
with Tcl.Tk.Ada.Grid;
with Tcl.Tk.Ada.Pack;
with Tcl.Tk.Ada.TtkStyle; use Tcl.Tk.Ada.TtkStyle;
with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets;
with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton;
with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame;
with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo;
with Tcl.Tklib.Ada.Autoscroll; use Tcl.Tklib.Ada.Autoscroll;
with Tcl.Tklib.Ada.Tooltip; use Tcl.Tklib.Ada.Tooltip;
with Config; use Config;
with Utils.UI; use Utils.UI;
package body Table is
function CreateTable
(Parent: String; Headers: Headers_Array;
Scrollbar: Ttk_Scrollbar := Get_Widget(".");
Command, Tooltip: String := "") return Table_Widget is
Canvas: Tk_Canvas;
YScroll: Ttk_Scrollbar;
XScroll: Ttk_Scrollbar;
Table: Table_Widget (Headers'Length);
X: Natural := 5;
Tokens: Slice_Set;
Master: constant Tk_Canvas := Get_Widget(Parent);
Header_Id: Unbounded_String;
begin
if Widget_Image(Scrollbar) = "." then
YScroll :=
Create
(Parent & ".scrolly",
"-orient vertical -command [list " & Parent & ".table yview]");
XScroll :=
Create
(Parent & ".scrollx",
"-orient horizontal -command [list " & Parent & ".table xview]");
Canvas :=
Create
(Parent & ".table",
"-yscrollcommand [list " & Parent &
".scrolly set] -xscrollcommand [list " & Parent &
".scrollx set]");
Tcl.Tk.Ada.Pack.Pack(YScroll, "-side right -fill y");
Tcl.Tk.Ada.Pack.Pack(Canvas, "-side top -fill both -padx {5 0}");
Tcl.Tk.Ada.Pack.Pack(XScroll, "-side bottom -fill x");
Autoscroll(XScroll);
Autoscroll(YScroll);
Table.Scrollbar := YScroll;
else
Canvas := Create(Parent & ".table");
Tcl.Tk.Ada.Grid.Grid(Canvas, "-sticky nwes -padx {5 0}");
Tcl.Tk.Ada.Grid.Column_Configure(Master, Canvas, "-weight 1");
Tcl.Tk.Ada.Grid.Row_Configure(Master, Canvas, "-weight 1");
Table.Scrollbar := Scrollbar;
end if;
Create_Headers_Loop :
for I in Headers'Range loop
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "text",
Trim(Natural'Image(X), Left) & " 2 -anchor nw -text {" &
To_String(Headers(I)) &
"} -font InterfaceFont -justify center -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) &
" -foreground] -tags [list header" &
Trim(Positive'Image(I), Left) & "]"));
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Create
(Tokens, BBox(Canvas, "header" & Trim(Positive'Image(I), Left)),
" ");
X := Positive'Value(Slice(Tokens, 3)) + 10;
Table.Columns_Width(I) := X - Positive'Value(Slice(Tokens, 1));
if I = 1 then
Table.Row_Height := Positive'Value(Slice(Tokens, 4)) + 5;
end if;
end loop Create_Headers_Loop;
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "rectangle",
"0 0" & Positive'Image(X) &
Positive'Image(Table.Row_Height - 3) & " -fill " &
Style_Lookup("Table", "-headercolor") & " -outline " &
Style_Lookup("Table", "-rowcolor") &
" -width 2 -tags [list headerback]"));
Lower(Canvas, "headerback");
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Table.Canvas := Canvas;
Tcl_Eval
(Get_Context,
"SetScrollbarBindings " & Table.Canvas & " " & Table.Scrollbar);
Bind
(Table.Canvas, "<Up>",
"{UpdateCurrentRow " & Table.Canvas & " lower}");
Bind
(Table.Canvas, "<Down>",
"{UpdateCurrentRow " & Table.Canvas & " raise}");
Bind
(Table.Canvas, "<Key-space>",
"{ExecuteCurrentRow " & Table.Canvas & "}");
Bind
(Table.Canvas, "<FocusOut>", "{HideCurrentRow " & Table.Canvas & "}");
Bind(Table.Canvas, "<Leave>", "{HideCurrentRow " & Table.Canvas & "}");
return Table;
end CreateTable;
procedure ClearTable(Table: in out Table_Widget) is
ButtonsFrame: Ttk_Frame := Get_Widget(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if Winfo_Get(ButtonsFrame, "exists") = "1" then
Button := Get_Widget(ButtonsFrame & ".previous");
Destroy(Button);
Button := Get_Widget(ButtonsFrame & ".next");
Destroy(Button);
Destroy(ButtonsFrame);
end if;
Clear_Rows_Loop :
for Row in 1 .. Table.Row loop
Clear_Columns_Loop :
for Column in 1 .. Table.Amount loop
Delete
(Table.Canvas,
"row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Positive'Image(Column), Left));
Delete(Table.Canvas, "row" & Trim(Positive'Image(Row), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Positive'Image(Column), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Positive'Image(Column), Left));
end loop Clear_Columns_Loop;
end loop Clear_Rows_Loop;
Table.Row := 1;
end ClearTable;
-- ****if* Table/Add_Bindings
-- FUNCTION
-- Add events to the selected element of the Table_Widget
-- PARAMETERS
-- Canvas - Tk_Canvas in which the events will be added
-- ItemId - The id of the item to which the events will be added
-- Row - The number of row in which the events will be added
-- Command - The Tcl command which will be executed on mouse button event
-- HISTORY
-- 6.6 - Added
-- SOURCE
procedure Add_Bindings
(Canvas: Tk_Canvas; ItemId, Row, Command, Color: String) is
-- ****
begin
Bind
(Canvas, ItemId, "<Enter>",
"{" & Canvas & " itemconfigure row$currentrow -fill " & Color & ";" &
Canvas & " itemconfigure row" & Row & " -fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground") &
(if Command'Length > 0 then ";" & Canvas & " configure -cursor hand1"
else "") &
";set currentrow " & Row & "}");
Bind
(Canvas, ItemId, "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
if Command'Length > 0 then
Bind
(Canvas, ItemId,
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">",
"{" & Command & "}");
end if;
end Add_Bindings;
-- ****if* Table/Table.AddBackground
-- FUNCTION
-- Add a proper background color to the item in the table and return the
-- name of used color
-- PARAMETERS
-- Table - The Table_Widget in which background will be added
-- NewRow - If True, add the background, otherwise just return the color
-- which will be used
-- Command - Tcl command which will be executed when the background was
-- clicked
-- RESULT
-- The String with the name of the color used for set background for the
-- item
-- SOURCE
function AddBackground
(Table: Table_Widget; NewRow: Boolean; Command: String) return String is
-- ****
ItemId: Unbounded_String;
Color: constant String :=
(if Table.Row rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
if not NewRow then
return Color;
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
" 0" & Positive'Image((Table.Row * Table.Row_Height)) & " 10" &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height)) &
" -fill " & Color & " -width 0 -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "]"));
Lower(Table.Canvas, To_String(ItemId));
Add_Bindings
(Table.Canvas, "row" & Trim(Positive'Image(Table.Row), Left),
Trim(Positive'Image(Table.Row), Left), Command, Color);
return Color;
end AddBackground;
procedure AddButton
(Table: in out Table_Widget; Text, Tooltip, Command: String;
Column: Positive; NewRow: Boolean := False; Color: String := "") is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Text_Color: constant String :=
(if Color'Length > 0 then Color
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-foreground"));
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "text",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -text {" & Text & "} -font InterfaceFont -fill " &
Text_Color & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddButton;
procedure UpdateTable
(Table: in out Table_Widget; Grab_Focus: Boolean := True) is
Tag: Unbounded_String;
NewX: Natural := Table.Columns_Width(1) + 20;
NewY: Natural := 2;
begin
Update_Columns_Loop :
for Column in 2 .. Table.Amount loop
Tag :=
To_Unbounded_String("header" & Trim(Natural'Image(Column), Left));
Coords
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX), Left) & Positive'Image(NewY));
Update_Rows_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String
("row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY + 5), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX + 2), Left),
Trim(Positive'Image(NewY + 7), Left));
end loop Update_Rows_Loop;
NewX := NewX + Table.Columns_Width(Column) + 20;
NewY := 2;
end loop Update_Columns_Loop;
declare
Tokens: Slice_Set;
begin
Create(Tokens, BBox(Table.Canvas, "all"), " ");
-- if no scrollbars, resize the table
if Winfo_Get(Table.Canvas, "parent") /=
Winfo_Get(Table.Scrollbar, "parent") then
configure
(Table.Canvas,
"-height [expr " & Slice(Tokens, 4) & " - " & Slice(Tokens, 2) &
"] -width [expr " & Slice(Tokens, 3) & " - " &
Slice(Tokens, 1) & " + 5]");
end if;
Coords
(Table.Canvas, "headerback",
"0 0" & Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(Table.Row_Height - 3));
NewY := Table.Row_Height;
Resize_Background_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String("row" & Trim(Positive'Image(Row), Left));
Coords
(Table.Canvas, To_String(Tag),
"0" & Positive'Image(NewY - Table.Row_Height) &
Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(NewY));
end loop Resize_Background_Loop;
end;
Tcl_SetVar(Get_Context, "currentrow", "1");
Bind
(Table.Canvas, "<FocusIn>",
"{set maxrows" & Natural'Image(Table.Row) &
";if {$currentrow > $maxrows} {set currentrow 1};" & Table.Canvas &
" itemconfigure row$currentrow -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) & " -selectbackground]}");
if Grab_Focus then
Widgets.Focus(Table.Canvas);
end if;
end UpdateTable;
procedure AddProgressBar
(Table: in out Table_Widget; Value: Natural; MaxValue: Positive;
Tooltip, Command: String; Column: Positive;
NewRow, InvertColors: Boolean := False) is
X: Natural := 0;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Length: constant Natural :=
Natural
(100.0 +
((Float(Value) - Float(MaxValue)) / Float(MaxValue) * 100.0));
Color: Unbounded_String;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 5) &
Positive'Image(X + 102) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 10)) &
" -fill " & Style_Lookup("TProgressbar", "-troughcolor") &
" -outline " & Style_Lookup("TProgressbar", "-bordercolor") &
" -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "back" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if not InvertColors then
Color :=
To_Unbounded_String
(if Length > 74 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
else
Color :=
To_Unbounded_String
(if Length < 25 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 and Length < 75 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X + 2), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 7) &
Positive'Image(X + Length) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 12)) &
" -fill " & To_String(Color) & " -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "bar" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddProgressBar;
procedure AddPagination
(Table: in out Table_Widget; PreviousCommand, NextCommand: String) is
ButtonsFrame: constant Ttk_Frame :=
Create(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if PreviousCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".previous",
"-text Previous -command {" & PreviousCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky w");
Add(Button, "Previous page");
end if;
if NextCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".next",
"-text Next -command {" & NextCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky e -row 0 -column 1");
Add(Button, "Next page");
end if;
Tcl_Eval(Get_Interp(Table.Canvas), "update");
Canvas_Create
(Table.Canvas, "window",
"0" & Positive'Image(Table.Row * Table.Row_Height) &
" -anchor nw -window " & ButtonsFrame);
end AddPagination;
procedure AddCheckButton
(Table: in out Table_Widget; Tooltip, Command: String; Checked: Boolean;
Column: Positive; NewRow: Boolean := False) is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
ImageName: constant String :=
"${ttk::theme::" & Theme_Use & "::I(checkbox-" &
(if Checked then "checked" else "unchecked") & ")}";
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "image",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -image " & ImageName & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if Command'Length > 0 then
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddCheckButton;
function Get_Column_Number
(Table: Table_Widget; X_Position: Natural) return Positive is
Position: Positive := X_Position;
begin
for I in Table.Columns_Width'Range loop
if Position < Table.Columns_Width(I) + 20 then
return I;
end if;
Position := Position - Table.Columns_Width(I) - 20;
end loop;
return 1;
end Get_Column_Number;
procedure Update_Headers_Command(Table: Table_Widget; Command: String) is
begin
if Command'Length > 0 then
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{" & Command & " %x}");
end loop;
Bind
(Table.Canvas, "headerback", "<Enter>",
"{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "headerback", "<Leave>",
"{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "headerback", "<Button-1>", "{" & Command & " %x}");
else
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{}");
end loop;
Bind(Table.Canvas, "headerback", "<Enter>", "{}");
Bind(Table.Canvas, "headerback", "<Leave>", "{}");
Bind(Table.Canvas, "headerback", "<Button-1>", "{}");
end if;
end Update_Headers_Command;
-- ****o* Table/Table.Update_Current_Row_Command
-- FUNCTION
-- Update Tcl variable currentrow and show the currently selected row in
-- the table
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- UpdateCurrentRow canvas action
-- Canvas is the name of Table Tk_Canvas in which the current row will
-- be updated, action is the name of action which will be taken. Can be
-- raise or lower
-- SOURCE
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
CurrentRow: Natural := Natural'Value(Tcl_GetVar(Interp, "currentrow"));
MaxRows: constant Natural :=
Natural'Value(Tcl_GetVar(Interp, "maxrows")) - 1;
Color: constant String :=
(if CurrentRow rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
if CArgv.Arg(Argv, 2) = "lower" then
CurrentRow := CurrentRow - 1;
if CurrentRow = 0 then
CurrentRow := 1;
end if;
else
CurrentRow := CurrentRow + 1;
if CurrentRow > MaxRows then
CurrentRow := MaxRows;
end if;
end if;
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
Item_Configure
(Canvas, "row" & Trim(Natural'Image(CurrentRow), Left),
"-fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground"));
Tcl_SetVar(Interp, "currentrow", Trim(Natural'Image(CurrentRow), Left));
return TCL_OK;
end Update_Current_Row_Command;
-- ****o* Table/Table.Execute_Current_Row_Command
-- FUNCTION
-- Execute the Tcl command associated with the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ExecuteCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the Tcl command related
-- to the current row will be executed
-- SOURCE
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
Tcl_Eval
(Interp,
Bind
(Canvas, "row$currentrow",
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">"));
return TCL_OK;
end Execute_Current_Row_Command;
-- ****o* Table/Table.Hide_Current_Row_Command
-- FUNCTION
-- Set the normal background color for the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- HideCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the selected row
-- background will be recolored
-- SOURCE
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
Color: constant String :=
(if Natural'Value(Tcl_GetVar(Interp, "currentrow")) rem 2 > 0 then
Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
return TCL_OK;
end Hide_Current_Row_Command;
procedure AddCommands is
begin
Add_Command("UpdateCurrentRow", Update_Current_Row_Command'Access);
Add_Command("ExecuteCurrentRow", Execute_Current_Row_Command'Access);
Add_Command("HideCurrentRow", Hide_Current_Row_Command'Access);
end AddCommands;
end Table;
| true |
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Interfaces.C;
with GNAT.String_Split; use GNAT.String_Split;
with CArgv;
with Tcl; use Tcl;
with Tcl.Ada; use Tcl.Ada;
with Tcl.Tk.Ada; use Tcl.Tk.Ada;
with Tcl.Tk.Ada.Grid;
with Tcl.Tk.Ada.Pack;
with Tcl.Tk.Ada.TtkStyle; use Tcl.Tk.Ada.TtkStyle;
with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets;
with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton;
with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame;
with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo;
with Tcl.Tklib.Ada.Autoscroll; use Tcl.Tklib.Ada.Autoscroll;
with Tcl.Tklib.Ada.Tooltip; use Tcl.Tklib.Ada.Tooltip;
with Config; use Config;
with Utils.UI; use Utils.UI;
package body Table is
function CreateTable
(Parent: String; Headers: Headers_Array;
Scrollbar: Ttk_Scrollbar := Get_Widget(".");
Command, Tooltip: String := "") return Table_Widget is
Canvas: Tk_Canvas;
YScroll: Ttk_Scrollbar;
XScroll: Ttk_Scrollbar;
Table: Table_Widget (Headers'Length);
X: Natural := 5;
Tokens: Slice_Set;
Master: constant Tk_Canvas := Get_Widget(Parent);
Header_Id: Unbounded_String;
begin
if Widget_Image(Scrollbar) = "." then
YScroll :=
Create
(Parent & ".scrolly",
"-orient vertical -command [list " & Parent & ".table yview]");
XScroll :=
Create
(Parent & ".scrollx",
"-orient horizontal -command [list " & Parent & ".table xview]");
Canvas :=
Create
(Parent & ".table",
"-yscrollcommand [list " & Parent &
".scrolly set] -xscrollcommand [list " & Parent &
".scrollx set]");
Tcl.Tk.Ada.Pack.Pack(YScroll, "-side right -fill y");
Tcl.Tk.Ada.Pack.Pack(Canvas, "-side top -fill both -padx {5 0}");
Tcl.Tk.Ada.Pack.Pack(XScroll, "-side bottom -fill x");
Autoscroll(XScroll);
Autoscroll(YScroll);
Table.Scrollbar := YScroll;
else
Canvas := Create(Parent & ".table");
Tcl.Tk.Ada.Grid.Grid(Canvas, "-sticky nwes -padx {5 0}");
Tcl.Tk.Ada.Grid.Column_Configure(Master, Canvas, "-weight 1");
Tcl.Tk.Ada.Grid.Row_Configure(Master, Canvas, "-weight 1");
Table.Scrollbar := Scrollbar;
end if;
Create_Headers_Loop :
for I in Headers'Range loop
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "text",
Trim(Natural'Image(X), Left) & " 2 -anchor nw -text {" &
To_String(Headers(I)) &
"} -font InterfaceFont -justify center -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) &
" -foreground] -tags [list header" &
Trim(Positive'Image(I), Left) & "]"));
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Create
(Tokens, BBox(Canvas, "header" & Trim(Positive'Image(I), Left)),
" ");
X := Positive'Value(Slice(Tokens, 3)) + 10;
Table.Columns_Width(I) := X - Positive'Value(Slice(Tokens, 1));
if I = 1 then
Table.Row_Height := Positive'Value(Slice(Tokens, 4)) + 5;
end if;
end loop Create_Headers_Loop;
Header_Id :=
To_Unbounded_String
(Canvas_Create
(Canvas, "rectangle",
"0 0" & Positive'Image(X) &
Positive'Image(Table.Row_Height - 3) & " -fill " &
Style_Lookup("Table", "-headercolor") & " -outline " &
Style_Lookup("Table", "-rowcolor") &
" -width 2 -tags [list headerback]"));
Lower(Canvas, "headerback");
if Command'Length > 0 then
Bind
(Canvas, To_String(Header_Id), "<Enter>",
"{" & Canvas & " configure -cursor hand1}");
Bind
(Canvas, To_String(Header_Id), "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
Bind
(Canvas, To_String(Header_Id), "<Button-1>",
"{" & Command & " %x}");
end if;
if Tooltip'Length > 0 then
Add(Canvas, Tooltip, "-item " & To_String(Header_Id));
end if;
Table.Canvas := Canvas;
Tcl_Eval
(Get_Context,
"SetScrollbarBindings " & Table.Canvas & " " & Table.Scrollbar);
Bind
(Table.Canvas, "<Up>",
"{UpdateCurrentRow " & Table.Canvas & " lower}");
Bind
(Table.Canvas, "<Down>",
"{UpdateCurrentRow " & Table.Canvas & " raise}");
Bind
(Table.Canvas, "<Key-space>",
"{ExecuteCurrentRow " & Table.Canvas & "}");
Bind
(Table.Canvas, "<FocusOut>", "{HideCurrentRow " & Table.Canvas & "}");
Bind(Table.Canvas, "<Leave>", "{HideCurrentRow " & Table.Canvas & "}");
return Table;
end CreateTable;
procedure ClearTable(Table: in out Table_Widget) is
ButtonsFrame: Ttk_Frame := Get_Widget(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if Winfo_Get(ButtonsFrame, "exists") = "1" then
Button := Get_Widget(ButtonsFrame & ".previous");
Destroy(Button);
Button := Get_Widget(ButtonsFrame & ".next");
Destroy(Button);
Destroy(ButtonsFrame);
end if;
Clear_Rows_Loop :
for Row in 1 .. Table.Row loop
Clear_Columns_Loop :
for Column in 1 .. Table.Amount loop
Delete
(Table.Canvas,
"row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Positive'Image(Column), Left));
Delete(Table.Canvas, "row" & Trim(Positive'Image(Row), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Positive'Image(Column), Left));
Delete
(Table.Canvas,
"progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Positive'Image(Column), Left));
end loop Clear_Columns_Loop;
end loop Clear_Rows_Loop;
Table.Row := 1;
end ClearTable;
-- ****if* Table/Add_Bindings
-- FUNCTION
-- Add events to the selected element of the Table_Widget
-- PARAMETERS
-- Canvas - Tk_Canvas in which the events will be added
-- ItemId - The id of the item to which the events will be added
-- Row - The number of row in which the events will be added
-- Command - The Tcl command which will be executed on mouse button event
-- HISTORY
-- 6.6 - Added
-- SOURCE
procedure Add_Bindings
(Canvas: Tk_Canvas; ItemId, Row, Command, Color: String) is
-- ****
begin
Bind
(Canvas, ItemId, "<Enter>",
"{" & Canvas & " itemconfigure row$currentrow -fill " & Color & ";" &
Canvas & " itemconfigure row" & Row & " -fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground") &
(if Command'Length > 0 then ";" & Canvas & " configure -cursor hand1"
else "") &
";set currentrow " & Row & "}");
Bind
(Canvas, ItemId, "<Leave>",
"{" & Canvas & " configure -cursor left_ptr}");
if Command'Length > 0 then
Bind
(Canvas, ItemId,
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">",
"{" & Command & "}");
end if;
end Add_Bindings;
-- ****if* Table/Table.AddBackground
-- FUNCTION
-- Add a proper background color to the item in the table and return the
-- name of used color
-- PARAMETERS
-- Table - The Table_Widget in which background will be added
-- NewRow - If True, add the background, otherwise just return the color
-- which will be used
-- Command - Tcl command which will be executed when the background was
-- clicked
-- RESULT
-- The String with the name of the color used for set background for the
-- item
-- SOURCE
function AddBackground
(Table: Table_Widget; NewRow: Boolean; Command: String) return String is
-- ****
ItemId: Unbounded_String;
Color: constant String :=
(if Table.Row rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
if not NewRow then
return Color;
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
" 0" & Positive'Image((Table.Row * Table.Row_Height)) & " 10" &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height)) &
" -fill " & Color & " -width 0 -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "]"));
Lower(Table.Canvas, To_String(ItemId));
Add_Bindings
(Table.Canvas, "row" & Trim(Positive'Image(Table.Row), Left),
Trim(Positive'Image(Table.Row), Left), Command, Color);
return Color;
end AddBackground;
procedure AddButton
(Table: in out Table_Widget; Text, Tooltip, Command: String;
Column: Positive; NewRow: Boolean := False; Color: String := "") is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Text_Color: constant String :=
(if Color'Length > 0 then Color
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-foreground"));
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "text",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -text {" & Text & "} -font InterfaceFont -fill " &
Text_Color & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddButton;
procedure UpdateTable
(Table: in out Table_Widget; Grab_Focus: Boolean := True) is
Tag: Unbounded_String;
NewX: Natural := Table.Columns_Width(1) + 20;
NewY: Natural := 2;
begin
Update_Columns_Loop :
for Column in 2 .. Table.Amount loop
Tag :=
To_Unbounded_String("header" & Trim(Natural'Image(Column), Left));
Coords
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX), Left) & Positive'Image(NewY));
Update_Rows_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String
("row" & Trim(Positive'Image(Row), Left) & "col" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "back" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag), Trim(Positive'Image(NewX), Left),
Trim(Positive'Image(NewY + 5), Left));
Tag :=
To_Unbounded_String
("progressbar" & Trim(Positive'Image(Row), Left) & "bar" &
Trim(Natural'Image(Column), Left));
MoveTo
(Table.Canvas, To_String(Tag),
Trim(Positive'Image(NewX + 2), Left),
Trim(Positive'Image(NewY + 7), Left));
end loop Update_Rows_Loop;
NewX := NewX + Table.Columns_Width(Column) + 20;
NewY := 2;
end loop Update_Columns_Loop;
declare
Tokens: Slice_Set;
begin
Create(Tokens, BBox(Table.Canvas, "all"), " ");
-- if no scrollbars, resize the table
if Winfo_Get(Table.Canvas, "parent") /=
Winfo_Get(Table.Scrollbar, "parent") then
configure
(Table.Canvas,
"-height [expr " & Slice(Tokens, 4) & " - " & Slice(Tokens, 2) &
"] -width [expr " & Slice(Tokens, 3) & " - " &
Slice(Tokens, 1) & " + 5]");
end if;
Coords
(Table.Canvas, "headerback",
"0 0" & Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(Table.Row_Height - 3));
NewY := Table.Row_Height;
Resize_Background_Loop :
for Row in 1 .. Table.Row loop
NewY := NewY + Table.Row_Height;
Tag :=
To_Unbounded_String("row" & Trim(Positive'Image(Row), Left));
Coords
(Table.Canvas, To_String(Tag),
"0" & Positive'Image(NewY - Table.Row_Height) &
Positive'Image(Positive'Value(Slice(Tokens, 3)) - 1) &
Positive'Image(NewY));
end loop Resize_Background_Loop;
end;
Tcl_SetVar(Get_Context, "currentrow", "1");
Bind
(Table.Canvas, "<FocusIn>",
"{set maxrows" & Natural'Image(Table.Row) &
";if {$currentrow > $maxrows} {set currentrow 1};" & Table.Canvas &
" itemconfigure row$currentrow -fill [ttk::style lookup " &
To_String(Game_Settings.Interface_Theme) & " -selectbackground]}");
if Grab_Focus then
Widgets.Focus(Table.Canvas);
end if;
end UpdateTable;
procedure AddProgressBar
(Table: in out Table_Widget; Value: Natural; MaxValue: Positive;
Tooltip, Command: String; Column: Positive;
NewRow, InvertColors: Boolean := False) is
X: Natural := 0;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Length: constant Natural :=
Natural
(100.0 +
((Float(Value) - Float(MaxValue)) / Float(MaxValue) * 100.0));
Color: Unbounded_String;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 5) &
Positive'Image(X + 102) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 10)) &
" -fill " & Style_Lookup("TProgressbar", "-troughcolor") &
" -outline " & Style_Lookup("TProgressbar", "-bordercolor") &
" -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "back" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if not InvertColors then
Color :=
To_Unbounded_String
(if Length > 74 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
else
Color :=
To_Unbounded_String
(if Length < 25 then
Style_Lookup("green.Horizontal.TProgressbar", "-background")
elsif Length > 24 and Length < 75 then
Style_Lookup("yellow.Horizontal.TProgressbar", "-background")
else Style_Lookup("TProgressbar", "-background"));
end if;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "rectangle",
Trim(Natural'Image(X + 2), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 7) &
Positive'Image(X + Length) &
Positive'Image
((Table.Row * Table.Row_Height) + (Table.Row_Height - 12)) &
" -fill " & To_String(Color) & " -tags [list progressbar" &
Trim(Positive'Image(Table.Row), Left) & "bar" &
Trim(Positive'Image(Column), Left) & "]"));
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddProgressBar;
procedure AddPagination
(Table: in out Table_Widget; PreviousCommand, NextCommand: String) is
ButtonsFrame: constant Ttk_Frame :=
Create(Table.Canvas & ".buttonframe");
Button: Ttk_Button;
begin
if PreviousCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".previous",
"-text Previous -command {" & PreviousCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky w");
Add(Button, "Previous page");
end if;
if NextCommand'Length > 0 then
Button :=
Create
(ButtonsFrame & ".next",
"-text Next -command {" & NextCommand & "}");
Tcl.Tk.Ada.Grid.Grid(Button, "-sticky e -row 0 -column 1");
Add(Button, "Next page");
end if;
Tcl_Eval(Get_Interp(Table.Canvas), "update");
Canvas_Create
(Table.Canvas, "window",
"0" & Positive'Image(Table.Row * Table.Row_Height) &
" -anchor nw -window " & ButtonsFrame);
end AddPagination;
procedure AddCheckButton
(Table: in out Table_Widget; Tooltip, Command: String; Checked: Boolean;
Column: Positive; NewRow: Boolean := False) is
X: Natural := 5;
ItemId: Unbounded_String;
Tokens: Slice_Set;
Background_Color: constant String :=
AddBackground(Table, NewRow, Command);
ImageName: constant String :=
"${ttk::theme::" & Theme_Use & "::I(checkbox-" &
(if Checked then "checked" else "unchecked") & ")}";
begin
Count_X_Loop :
for I in 1 .. Column - 1 loop
X := X + Table.Columns_Width(I);
end loop Count_X_Loop;
ItemId :=
To_Unbounded_String
(Canvas_Create
(Table.Canvas, "image",
Trim(Natural'Image(X), Left) &
Positive'Image((Table.Row * Table.Row_Height) + 2) &
" -anchor nw -image " & ImageName & " -tags [list row" &
Trim(Positive'Image(Table.Row), Left) & "col" &
Trim(Positive'Image(Column), Left) & "]"));
if Tooltip'Length > 0 then
Add(Table.Canvas, Tooltip, "-item " & To_String(ItemId));
end if;
Create(Tokens, BBox(Table.Canvas, To_String(ItemId)), " ");
X :=
(Positive'Value(Slice(Tokens, 3)) + 10) -
Positive'Value(Slice(Tokens, 1));
if X > Table.Columns_Width(Column) then
Table.Columns_Width(Column) := X;
end if;
if Command'Length > 0 then
Add_Bindings
(Table.Canvas, To_String(ItemId),
Trim(Positive'Image(Table.Row), Left), Command, Background_Color);
end if;
if NewRow then
Table.Row := Table.Row + 1;
end if;
end AddCheckButton;
function Get_Column_Number
(Table: Table_Widget; X_Position: Natural) return Positive is
Position: Positive := X_Position;
begin
for I in Table.Columns_Width'Range loop
if Position < Table.Columns_Width(I) + 20 then
return I;
end if;
Position := Position - Table.Columns_Width(I) - 20;
end loop;
return 1;
end Get_Column_Number;
procedure Update_Headers_Command(Table: Table_Widget; Command: String) is
begin
if Command'Length > 0 then
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{" & Command & " %x}");
end loop;
Bind
(Table.Canvas, "headerback", "<Enter>",
"{" & Table.Canvas & " configure -cursor hand1}");
Bind
(Table.Canvas, "headerback", "<Leave>",
"{" & Table.Canvas & " configure -cursor left_ptr}");
Bind
(Table.Canvas, "headerback", "<Button-1>", "{" & Command & " %x}");
else
for I in Table.Columns_Width'Range loop
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Enter>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Leave>", "{}");
Bind
(Table.Canvas, "header" & Trim(Positive'Image(I), Left),
"<Button-1>", "{}");
end loop;
Bind(Table.Canvas, "headerback", "<Enter>", "{}");
Bind(Table.Canvas, "headerback", "<Leave>", "{}");
Bind(Table.Canvas, "headerback", "<Button-1>", "{}");
end if;
end Update_Headers_Command;
-- ****o* Table/Table.Update_Current_Row_Command
-- FUNCTION
-- Update Tcl variable currentrow and show the currently selected row in
-- the table
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- UpdateCurrentRow canvas action
-- Canvas is the name of Table Tk_Canvas in which the current row will
-- be updated, action is the name of action which will be taken. Can be
-- raise or lower
-- SOURCE
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Update_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
CurrentRow: Natural := Natural'Value(Tcl_GetVar(Interp, "currentrow"));
MaxRows: constant Natural :=
Natural'Value(Tcl_GetVar(Interp, "maxrows")) - 1;
Color: constant String :=
(if CurrentRow rem 2 > 0 then Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
if CArgv.Arg(Argv, 2) = "lower" then
CurrentRow := CurrentRow - 1;
if CurrentRow = 0 then
CurrentRow := 1;
end if;
else
CurrentRow := CurrentRow + 1;
if CurrentRow > MaxRows then
CurrentRow := MaxRows;
end if;
end if;
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
Item_Configure
(Canvas, "row" & Trim(Natural'Image(CurrentRow), Left),
"-fill " &
Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-selectbackground"));
Tcl_SetVar(Interp, "currentrow", Trim(Natural'Image(CurrentRow), Left));
return TCL_OK;
end Update_Current_Row_Command;
-- ****o* Table/Table.Execute_Current_Row_Command
-- FUNCTION
-- Execute the Tcl command associated with the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ExecuteCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the Tcl command related
-- to the current row will be executed
-- SOURCE
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Execute_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
begin
Tcl_Eval
(Interp,
Bind
(Canvas, "row$currentrow",
"<Button-" & (if Game_Settings.Right_Button then "3" else "1") &
">"));
return TCL_OK;
end Execute_Current_Row_Command;
-- ****o* Table/Table.Hide_Current_Row_Command
-- FUNCTION
-- Set the normal background color for the current row in the selected
-- Table_Widget
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- HideCurrentRow canvas
-- Canvas is the name of Table Tk_Canvas in which the selected row
-- background will be recolored
-- SOURCE
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Hide_Current_Row_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
Canvas: constant Tk_Canvas := Get_Widget(CArgv.Arg(Argv, 1), Interp);
Color: constant String :=
(if Natural'Value(Tcl_GetVar(Interp, "currentrow")) rem 2 > 0 then
Style_Lookup("Table", "-rowcolor")
else Style_Lookup
(To_String(Game_Settings.Interface_Theme), "-background"));
begin
Item_Configure(Canvas, "row$currentrow", "-fill " & Color);
return TCL_OK;
end Hide_Current_Row_Command;
procedure AddCommands is
begin
Add_Command("UpdateCurrentRow", Update_Current_Row_Command'Access);
Add_Command("ExecuteCurrentRow", Execute_Current_Row_Command'Access);
Add_Command("HideCurrentRow", Hide_Current_Row_Command'Access);
end AddCommands;
end Table;
|
[
{
"context": "---------------------------\n-- Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 465,
"score": 0.999870777130127,
"start": 450,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 496,
"score": 0.9998772740364075,
"start": 481,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "9 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 523,
"score": 0.9999274015426636,
"start": 498,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
awa/plugins/awa-jobs/src/model/awa-jobs-models.adb
|
twdroeger/ada-awa
| 0 |
-----------------------------------------------------------------------
-- AWA.Jobs.Models -- AWA.Jobs.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
package body AWA.Jobs.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Job_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function Job_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function "=" (Left, Right : Job_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Job_Ref'Class;
Impl : out Job_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Job_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Job_Ref) is
Impl : Job_Access;
begin
Impl := new Job_Impl;
Impl.Status := AWA.Jobs.Models.Job_Status_Type'First;
Impl.Start_Date.Is_Null := True;
Impl.Create_Date := ADO.DEFAULT_TIME;
Impl.Finish_Date.Is_Null := True;
Impl.Progress := 0;
Impl.Version := 0;
Impl.Priority := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Job
-- ----------------------------------------
procedure Set_Id (Object : in out Job_Ref;
Value : in ADO.Identifier) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Job_Ref)
return ADO.Identifier is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Status (Object : in out Job_Ref;
Value : in AWA.Jobs.Models.Job_Status_Type) is
procedure Set_Field_Enum is
new ADO.Objects.Set_Field_Operation (Job_Status_Type);
Impl : Job_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 2, Impl.Status, Value);
end Set_Status;
function Get_Status (Object : in Job_Ref)
return AWA.Jobs.Models.Job_Status_Type is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Status;
end Get_Status;
procedure Set_Name (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Start_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 4, Impl.Start_Date, Value);
end Set_Start_Date;
function Get_Start_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Start_Date;
end Get_Start_Date;
procedure Set_Create_Date (Object : in out Job_Ref;
Value : in Ada.Calendar.Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value);
end Set_Create_Date;
function Get_Create_Date (Object : in Job_Ref)
return Ada.Calendar.Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Create_Date;
end Get_Create_Date;
procedure Set_Finish_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 6, Impl.Finish_Date, Value);
end Set_Finish_Date;
function Get_Finish_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Finish_Date;
end Get_Finish_Date;
procedure Set_Progress (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Progress, Value);
end Set_Progress;
function Get_Progress (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Progress;
end Get_Progress;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
function Get_Parameters (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Parameters);
end Get_Parameters;
function Get_Parameters (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Parameters;
end Get_Parameters;
procedure Set_Results (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
procedure Set_Results (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
function Get_Results (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Results);
end Get_Results;
function Get_Results (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Results;
end Get_Results;
function Get_Version (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Priority (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 11, Impl.Priority, Value);
end Set_Priority;
function Get_Priority (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Priority;
end Get_Priority;
procedure Set_User (Object : in out Job_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 12, Impl.User, Value);
end Set_User;
function Get_User (Object : in Job_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
procedure Set_Event (Object : in out Job_Ref;
Value : in AWA.Events.Models.Message_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 13, Impl.Event, Value);
end Set_Event;
function Get_Event (Object : in Job_Ref)
return AWA.Events.Models.Message_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Event;
end Get_Event;
procedure Set_Session (Object : in out Job_Ref;
Value : in AWA.Users.Models.Session_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 14, Impl.Session, Value);
end Set_Session;
function Get_Session (Object : in Job_Ref)
return AWA.Users.Models.Session_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Session;
end Get_Session;
-- Copy of the object.
procedure Copy (Object : in Job_Ref;
Into : in out Job_Ref) is
Result : Job_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Job_Access
:= new Job_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Status := Impl.Status;
Copy.Name := Impl.Name;
Copy.Start_Date := Impl.Start_Date;
Copy.Create_Date := Impl.Create_Date;
Copy.Finish_Date := Impl.Finish_Date;
Copy.Progress := Impl.Progress;
Copy.Parameters := Impl.Parameters;
Copy.Results := Impl.Results;
Copy.Version := Impl.Version;
Copy.Priority := Impl.Priority;
Copy.User := Impl.User;
Copy.Event := Impl.Event;
Copy.Session := Impl.Session;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Job_Access := new Job_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Job_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Job_Impl) is
type Job_Impl_Ptr is access all Job_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Job_Impl, Job_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Job_Impl_Ptr := Job_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, JOB_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Object.Clear_Modified (8);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Object.Clear_Modified (9);
end if;
if Object.Is_Modified (11) then
Stmt.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Object.Clear_Modified (11);
end if;
if Object.Is_Modified (12) then
Stmt.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (12);
end if;
if Object.Is_Modified (13) then
Stmt.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Object.Clear_Modified (13);
end if;
if Object.Is_Modified (14) then
Stmt.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Object.Clear_Modified (14);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (JOB_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Query.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Query.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Query.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Query.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Query.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Query.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Query.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Query.Save_Field (Name => COL_9_1_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Query.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Query.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Query.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Job_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Job_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Job_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "status" then
return AWA.Jobs.Models.Job_Status_Type_Objects.To_Object (Impl.Status);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
elsif Name = "start_date" then
if Impl.Start_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Start_Date.Value);
end if;
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (Impl.Create_Date);
elsif Name = "finish_date" then
if Impl.Finish_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Finish_Date.Value);
end if;
elsif Name = "progress" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Progress));
elsif Name = "parameters" then
return Util.Beans.Objects.To_Object (Impl.Parameters);
elsif Name = "results" then
return Util.Beans.Objects.To_Object (Impl.Results);
elsif Name = "priority" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Priority));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Job_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Status := Job_Status_Type'Val (Stmt.Get_Integer (1));
Object.Name := Stmt.Get_Unbounded_String (2);
Object.Start_Date := Stmt.Get_Nullable_Time (3);
Object.Create_Date := Stmt.Get_Time (4);
Object.Finish_Date := Stmt.Get_Nullable_Time (5);
Object.Progress := Stmt.Get_Integer (6);
Object.Parameters := Stmt.Get_Unbounded_String (7);
Object.Results := Stmt.Get_Unbounded_String (8);
Object.Priority := Stmt.Get_Integer (10);
if not Stmt.Is_Null (11) then
Object.User.Set_Key_Value (Stmt.Get_Identifier (11), Session);
end if;
if not Stmt.Is_Null (12) then
Object.Event.Set_Key_Value (Stmt.Get_Identifier (12), Session);
end if;
if not Stmt.Is_Null (13) then
Object.Session.Set_Key_Value (Stmt.Get_Identifier (13), Session);
end if;
Object.Version := Stmt.Get_Integer (9);
ADO.Objects.Set_Created (Object);
end Load;
end AWA.Jobs.Models;
|
12104
|
-----------------------------------------------------------------------
-- AWA.Jobs.Models -- AWA.Jobs.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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;
with Util.Beans.Objects.Time;
package body AWA.Jobs.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Job_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function Job_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function "=" (Left, Right : Job_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Job_Ref'Class;
Impl : out Job_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Job_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Job_Ref) is
Impl : Job_Access;
begin
Impl := new Job_Impl;
Impl.Status := AWA.Jobs.Models.Job_Status_Type'First;
Impl.Start_Date.Is_Null := True;
Impl.Create_Date := ADO.DEFAULT_TIME;
Impl.Finish_Date.Is_Null := True;
Impl.Progress := 0;
Impl.Version := 0;
Impl.Priority := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Job
-- ----------------------------------------
procedure Set_Id (Object : in out Job_Ref;
Value : in ADO.Identifier) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Job_Ref)
return ADO.Identifier is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Status (Object : in out Job_Ref;
Value : in AWA.Jobs.Models.Job_Status_Type) is
procedure Set_Field_Enum is
new ADO.Objects.Set_Field_Operation (Job_Status_Type);
Impl : Job_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 2, Impl.Status, Value);
end Set_Status;
function Get_Status (Object : in Job_Ref)
return AWA.Jobs.Models.Job_Status_Type is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Status;
end Get_Status;
procedure Set_Name (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Start_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 4, Impl.Start_Date, Value);
end Set_Start_Date;
function Get_Start_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Start_Date;
end Get_Start_Date;
procedure Set_Create_Date (Object : in out Job_Ref;
Value : in Ada.Calendar.Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value);
end Set_Create_Date;
function Get_Create_Date (Object : in Job_Ref)
return Ada.Calendar.Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Create_Date;
end Get_Create_Date;
procedure Set_Finish_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 6, Impl.Finish_Date, Value);
end Set_Finish_Date;
function Get_Finish_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Finish_Date;
end Get_Finish_Date;
procedure Set_Progress (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Progress, Value);
end Set_Progress;
function Get_Progress (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Progress;
end Get_Progress;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
function Get_Parameters (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Parameters);
end Get_Parameters;
function Get_Parameters (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Parameters;
end Get_Parameters;
procedure Set_Results (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
procedure Set_Results (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
function Get_Results (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Results);
end Get_Results;
function Get_Results (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Results;
end Get_Results;
function Get_Version (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Priority (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 11, Impl.Priority, Value);
end Set_Priority;
function Get_Priority (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Priority;
end Get_Priority;
procedure Set_User (Object : in out Job_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 12, Impl.User, Value);
end Set_User;
function Get_User (Object : in Job_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
procedure Set_Event (Object : in out Job_Ref;
Value : in AWA.Events.Models.Message_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 13, Impl.Event, Value);
end Set_Event;
function Get_Event (Object : in Job_Ref)
return AWA.Events.Models.Message_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Event;
end Get_Event;
procedure Set_Session (Object : in out Job_Ref;
Value : in AWA.Users.Models.Session_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 14, Impl.Session, Value);
end Set_Session;
function Get_Session (Object : in Job_Ref)
return AWA.Users.Models.Session_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Session;
end Get_Session;
-- Copy of the object.
procedure Copy (Object : in Job_Ref;
Into : in out Job_Ref) is
Result : Job_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Job_Access
:= new Job_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Status := Impl.Status;
Copy.Name := Impl.Name;
Copy.Start_Date := Impl.Start_Date;
Copy.Create_Date := Impl.Create_Date;
Copy.Finish_Date := Impl.Finish_Date;
Copy.Progress := Impl.Progress;
Copy.Parameters := Impl.Parameters;
Copy.Results := Impl.Results;
Copy.Version := Impl.Version;
Copy.Priority := Impl.Priority;
Copy.User := Impl.User;
Copy.Event := Impl.Event;
Copy.Session := Impl.Session;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Job_Access := new Job_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Job_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Job_Impl) is
type Job_Impl_Ptr is access all Job_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Job_Impl, Job_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Job_Impl_Ptr := Job_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, JOB_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Object.Clear_Modified (8);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Object.Clear_Modified (9);
end if;
if Object.Is_Modified (11) then
Stmt.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Object.Clear_Modified (11);
end if;
if Object.Is_Modified (12) then
Stmt.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (12);
end if;
if Object.Is_Modified (13) then
Stmt.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Object.Clear_Modified (13);
end if;
if Object.Is_Modified (14) then
Stmt.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Object.Clear_Modified (14);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (JOB_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Query.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Query.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Query.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Query.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Query.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Query.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Query.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Query.Save_Field (Name => COL_9_1_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Query.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Query.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Query.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Job_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Job_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Job_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "status" then
return AWA.Jobs.Models.Job_Status_Type_Objects.To_Object (Impl.Status);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
elsif Name = "start_date" then
if Impl.Start_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Start_Date.Value);
end if;
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (Impl.Create_Date);
elsif Name = "finish_date" then
if Impl.Finish_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Finish_Date.Value);
end if;
elsif Name = "progress" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Progress));
elsif Name = "parameters" then
return Util.Beans.Objects.To_Object (Impl.Parameters);
elsif Name = "results" then
return Util.Beans.Objects.To_Object (Impl.Results);
elsif Name = "priority" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Priority));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Job_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Status := Job_Status_Type'Val (Stmt.Get_Integer (1));
Object.Name := Stmt.Get_Unbounded_String (2);
Object.Start_Date := Stmt.Get_Nullable_Time (3);
Object.Create_Date := Stmt.Get_Time (4);
Object.Finish_Date := Stmt.Get_Nullable_Time (5);
Object.Progress := Stmt.Get_Integer (6);
Object.Parameters := Stmt.Get_Unbounded_String (7);
Object.Results := Stmt.Get_Unbounded_String (8);
Object.Priority := Stmt.Get_Integer (10);
if not Stmt.Is_Null (11) then
Object.User.Set_Key_Value (Stmt.Get_Identifier (11), Session);
end if;
if not Stmt.Is_Null (12) then
Object.Event.Set_Key_Value (Stmt.Get_Identifier (12), Session);
end if;
if not Stmt.Is_Null (13) then
Object.Session.Set_Key_Value (Stmt.Get_Identifier (13), Session);
end if;
Object.Version := Stmt.Get_Integer (9);
ADO.Objects.Set_Created (Object);
end Load;
end AWA.Jobs.Models;
| true |
-----------------------------------------------------------------------
-- AWA.Jobs.Models -- AWA.Jobs.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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;
with Util.Beans.Objects.Time;
package body AWA.Jobs.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
function Job_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function Job_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => JOB_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Job_Key;
function "=" (Left, Right : Job_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Job_Ref'Class;
Impl : out Job_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Job_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Job_Ref) is
Impl : Job_Access;
begin
Impl := new Job_Impl;
Impl.Status := AWA.Jobs.Models.Job_Status_Type'First;
Impl.Start_Date.Is_Null := True;
Impl.Create_Date := ADO.DEFAULT_TIME;
Impl.Finish_Date.Is_Null := True;
Impl.Progress := 0;
Impl.Version := 0;
Impl.Priority := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Job
-- ----------------------------------------
procedure Set_Id (Object : in out Job_Ref;
Value : in ADO.Identifier) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Job_Ref)
return ADO.Identifier is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Status (Object : in out Job_Ref;
Value : in AWA.Jobs.Models.Job_Status_Type) is
procedure Set_Field_Enum is
new ADO.Objects.Set_Field_Operation (Job_Status_Type);
Impl : Job_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 2, Impl.Status, Value);
end Set_Status;
function Get_Status (Object : in Job_Ref)
return AWA.Jobs.Models.Job_Status_Type is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Status;
end Get_Status;
procedure Set_Name (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Start_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 4, Impl.Start_Date, Value);
end Set_Start_Date;
function Get_Start_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Start_Date;
end Get_Start_Date;
procedure Set_Create_Date (Object : in out Job_Ref;
Value : in Ada.Calendar.Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value);
end Set_Create_Date;
function Get_Create_Date (Object : in Job_Ref)
return Ada.Calendar.Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Create_Date;
end Get_Create_Date;
procedure Set_Finish_Date (Object : in out Job_Ref;
Value : in ADO.Nullable_Time) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 6, Impl.Finish_Date, Value);
end Set_Finish_Date;
function Get_Finish_Date (Object : in Job_Ref)
return ADO.Nullable_Time is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Finish_Date;
end Get_Finish_Date;
procedure Set_Progress (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Progress, Value);
end Set_Progress;
function Get_Progress (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Progress;
end Get_Progress;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
procedure Set_Parameters (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 8, Impl.Parameters, Value);
end Set_Parameters;
function Get_Parameters (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Parameters);
end Get_Parameters;
function Get_Parameters (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Parameters;
end Get_Parameters;
procedure Set_Results (Object : in out Job_Ref;
Value : in String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
procedure Set_Results (Object : in out Job_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 9, Impl.Results, Value);
end Set_Results;
function Get_Results (Object : in Job_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Results);
end Get_Results;
function Get_Results (Object : in Job_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Results;
end Get_Results;
function Get_Version (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Priority (Object : in out Job_Ref;
Value : in Integer) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 11, Impl.Priority, Value);
end Set_Priority;
function Get_Priority (Object : in Job_Ref)
return Integer is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Priority;
end Get_Priority;
procedure Set_User (Object : in out Job_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 12, Impl.User, Value);
end Set_User;
function Get_User (Object : in Job_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
procedure Set_Event (Object : in out Job_Ref;
Value : in AWA.Events.Models.Message_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 13, Impl.Event, Value);
end Set_Event;
function Get_Event (Object : in Job_Ref)
return AWA.Events.Models.Message_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Event;
end Get_Event;
procedure Set_Session (Object : in out Job_Ref;
Value : in AWA.Users.Models.Session_Ref'Class) is
Impl : Job_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 14, Impl.Session, Value);
end Set_Session;
function Get_Session (Object : in Job_Ref)
return AWA.Users.Models.Session_Ref'Class is
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Session;
end Get_Session;
-- Copy of the object.
procedure Copy (Object : in Job_Ref;
Into : in out Job_Ref) is
Result : Job_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Job_Access
:= Job_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Job_Access
:= new Job_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Status := Impl.Status;
Copy.Name := Impl.Name;
Copy.Start_Date := Impl.Start_Date;
Copy.Create_Date := Impl.Create_Date;
Copy.Finish_Date := Impl.Finish_Date;
Copy.Progress := Impl.Progress;
Copy.Parameters := Impl.Parameters;
Copy.Results := Impl.Results;
Copy.Version := Impl.Version;
Copy.Priority := Impl.Priority;
Copy.User := Impl.User;
Copy.Event := Impl.Event;
Copy.Session := Impl.Session;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Job_Access := new Job_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Job_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Job_Access := new Job_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Job_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Job_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Job_Impl) is
type Job_Impl_Ptr is access all Job_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Job_Impl, Job_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Job_Impl_Ptr := Job_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, JOB_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Job_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Object.Clear_Modified (8);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Object.Clear_Modified (9);
end if;
if Object.Is_Modified (11) then
Stmt.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Object.Clear_Modified (11);
end if;
if Object.Is_Modified (12) then
Stmt.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (12);
end if;
if Object.Is_Modified (13) then
Stmt.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Object.Clear_Modified (13);
end if;
if Object.Is_Modified (14) then
Stmt.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Object.Clear_Modified (14);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (JOB_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- status
Value => Integer (Job_Status_Type'Pos (Object.Status)));
Query.Save_Field (Name => COL_2_1_NAME, -- name
Value => Object.Name);
Query.Save_Field (Name => COL_3_1_NAME, -- start_date
Value => Object.Start_Date);
Query.Save_Field (Name => COL_4_1_NAME, -- create_date
Value => Object.Create_Date);
Query.Save_Field (Name => COL_5_1_NAME, -- finish_date
Value => Object.Finish_Date);
Query.Save_Field (Name => COL_6_1_NAME, -- progress
Value => Object.Progress);
Query.Save_Field (Name => COL_7_1_NAME, -- parameters
Value => Object.Parameters);
Query.Save_Field (Name => COL_8_1_NAME, -- results
Value => Object.Results);
Query.Save_Field (Name => COL_9_1_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_10_1_NAME, -- priority
Value => Object.Priority);
Query.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Query.Save_Field (Name => COL_12_1_NAME, -- event_id
Value => Object.Event);
Query.Save_Field (Name => COL_13_1_NAME, -- session_id
Value => Object.Session);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Job_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (JOB_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Job_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Job_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Job_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "status" then
return AWA.Jobs.Models.Job_Status_Type_Objects.To_Object (Impl.Status);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
elsif Name = "start_date" then
if Impl.Start_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Start_Date.Value);
end if;
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (Impl.Create_Date);
elsif Name = "finish_date" then
if Impl.Finish_Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Finish_Date.Value);
end if;
elsif Name = "progress" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Progress));
elsif Name = "parameters" then
return Util.Beans.Objects.To_Object (Impl.Parameters);
elsif Name = "results" then
return Util.Beans.Objects.To_Object (Impl.Results);
elsif Name = "priority" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Priority));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Job_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Status := Job_Status_Type'Val (Stmt.Get_Integer (1));
Object.Name := Stmt.Get_Unbounded_String (2);
Object.Start_Date := Stmt.Get_Nullable_Time (3);
Object.Create_Date := Stmt.Get_Time (4);
Object.Finish_Date := Stmt.Get_Nullable_Time (5);
Object.Progress := Stmt.Get_Integer (6);
Object.Parameters := Stmt.Get_Unbounded_String (7);
Object.Results := Stmt.Get_Unbounded_String (8);
Object.Priority := Stmt.Get_Integer (10);
if not Stmt.Is_Null (11) then
Object.User.Set_Key_Value (Stmt.Get_Identifier (11), Session);
end if;
if not Stmt.Is_Null (12) then
Object.Event.Set_Key_Value (Stmt.Get_Identifier (12), Session);
end if;
if not Stmt.Is_Null (13) then
Object.Session.Set_Key_Value (Stmt.Get_Identifier (13), Session);
end if;
Object.Version := Stmt.Get_Integer (9);
ADO.Objects.Set_Created (Object);
end Load;
end AWA.Jobs.Models;
|
[
{
"context": "========================\n--\n-- Copyright 2022 (C) Holger Rodriguez\n--\n-- SPDX-License-Identifier: BSD-3-Clause\n--\nw",
"end": 270,
"score": 0.9998360276222229,
"start": 254,
"tag": "NAME",
"value": "Holger Rodriguez"
}
] |
examples/src/spi_master_16.adb
|
hgrodriguez/tiny_rp2040_bsp
| 0 |
--===========================================================================
--
-- This is the main master program for the Tiny as an SPI Master
--
--===========================================================================
--
-- Copyright 2022 (C) Holger Rodriguez
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL;
with HAL.SPI;
with RP.GPIO;
with RP.SPI;
with RP.Device;
with Tiny;
procedure SPI_Master_16 is
Data_Out_16 : HAL.SPI.SPI_Data_16b (1 .. 1);
Status_Out : HAL.SPI.SPI_Status;
Data_In_16 : HAL.SPI.SPI_Data_16b (1 .. 1) := (others => 0);
Status_In : HAL.SPI.SPI_Status;
Word : HAL.UInt16;
use HAL;
use HAL.SPI;
use RP.SPI;
-----------------------------------------------------------------------
SPI : RP.SPI.SPI_Port renames Tiny.SPI;
-- Master section 0
SCK_0 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_2;
NSS_0 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_1;
MOSI_0 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_3;
MISO_0 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_0;
-- Master section 1
SCK_1 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_6;
NSS_1 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_5;
MOSI_1 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_7;
MISO_1 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_4;
-----------------------------------------------------------------------
-- Renaming section
SCK : RP.GPIO.GPIO_Point renames SCK_1;
NSS : RP.GPIO.GPIO_Point renames NSS_1;
MOSI : RP.GPIO.GPIO_Point renames MOSI_1;
MISO : RP.GPIO.GPIO_Point renames MISO_1;
-----------------------------------------------------------------------
-- Configuration for the master part for the Tiny
Config : constant RP.SPI.SPI_Configuration
:= (Role => RP.SPI.Master,
Baud => 10_000_000,
Data_Size => HAL.SPI.Data_Size_16b,
others => <>);
-----------------------------------------------------------------------
-- Initializes the Tiny as master SPI
procedure SPI_Initialize is
begin
SCK.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
NSS.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MOSI.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MISO.Configure (RP.GPIO.Input, RP.GPIO.Floating, RP.GPIO.SPI);
SPI.Configure (Config);
end SPI_Initialize;
begin
Tiny.Initialize;
SPI_Initialize;
loop
-- construct the values for the transmission
for Higher_Byte in HAL.UInt8'Range loop
for Lower_Byte in HAL.UInt8'Range loop
Word := Shift_Left (Value => HAL.UInt16 (Higher_Byte),
Amount => 8) or HAL.UInt16 (Lower_Byte);
Data_Out_16 (1) := Word;
SPI.Transmit (Data_Out_16, Status_Out);
SPI.Receive (Data_In_16, Status_In, 0);
RP.Device.Timer.Delay_Milliseconds (100);
Tiny.LED_Red.Toggle;
end loop;
end loop;
end loop;
end SPI_Master_16;
|
3237
|
--===========================================================================
--
-- This is the main master program for the Tiny as an SPI Master
--
--===========================================================================
--
-- Copyright 2022 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL;
with HAL.SPI;
with RP.GPIO;
with RP.SPI;
with RP.Device;
with Tiny;
procedure SPI_Master_16 is
Data_Out_16 : HAL.SPI.SPI_Data_16b (1 .. 1);
Status_Out : HAL.SPI.SPI_Status;
Data_In_16 : HAL.SPI.SPI_Data_16b (1 .. 1) := (others => 0);
Status_In : HAL.SPI.SPI_Status;
Word : HAL.UInt16;
use HAL;
use HAL.SPI;
use RP.SPI;
-----------------------------------------------------------------------
SPI : RP.SPI.SPI_Port renames Tiny.SPI;
-- Master section 0
SCK_0 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_2;
NSS_0 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_1;
MOSI_0 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_3;
MISO_0 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_0;
-- Master section 1
SCK_1 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_6;
NSS_1 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_5;
MOSI_1 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_7;
MISO_1 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_4;
-----------------------------------------------------------------------
-- Renaming section
SCK : RP.GPIO.GPIO_Point renames SCK_1;
NSS : RP.GPIO.GPIO_Point renames NSS_1;
MOSI : RP.GPIO.GPIO_Point renames MOSI_1;
MISO : RP.GPIO.GPIO_Point renames MISO_1;
-----------------------------------------------------------------------
-- Configuration for the master part for the Tiny
Config : constant RP.SPI.SPI_Configuration
:= (Role => RP.SPI.Master,
Baud => 10_000_000,
Data_Size => HAL.SPI.Data_Size_16b,
others => <>);
-----------------------------------------------------------------------
-- Initializes the Tiny as master SPI
procedure SPI_Initialize is
begin
SCK.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
NSS.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MOSI.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MISO.Configure (RP.GPIO.Input, RP.GPIO.Floating, RP.GPIO.SPI);
SPI.Configure (Config);
end SPI_Initialize;
begin
Tiny.Initialize;
SPI_Initialize;
loop
-- construct the values for the transmission
for Higher_Byte in HAL.UInt8'Range loop
for Lower_Byte in HAL.UInt8'Range loop
Word := Shift_Left (Value => HAL.UInt16 (Higher_Byte),
Amount => 8) or HAL.UInt16 (Lower_Byte);
Data_Out_16 (1) := Word;
SPI.Transmit (Data_Out_16, Status_Out);
SPI.Receive (Data_In_16, Status_In, 0);
RP.Device.Timer.Delay_Milliseconds (100);
Tiny.LED_Red.Toggle;
end loop;
end loop;
end loop;
end SPI_Master_16;
| true |
--===========================================================================
--
-- This is the main master program for the Tiny as an SPI Master
--
--===========================================================================
--
-- Copyright 2022 (C) PI:NAME:<NAME>END_PI
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL;
with HAL.SPI;
with RP.GPIO;
with RP.SPI;
with RP.Device;
with Tiny;
procedure SPI_Master_16 is
Data_Out_16 : HAL.SPI.SPI_Data_16b (1 .. 1);
Status_Out : HAL.SPI.SPI_Status;
Data_In_16 : HAL.SPI.SPI_Data_16b (1 .. 1) := (others => 0);
Status_In : HAL.SPI.SPI_Status;
Word : HAL.UInt16;
use HAL;
use HAL.SPI;
use RP.SPI;
-----------------------------------------------------------------------
SPI : RP.SPI.SPI_Port renames Tiny.SPI;
-- Master section 0
SCK_0 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_2;
NSS_0 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_1;
MOSI_0 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_3;
MISO_0 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_0;
-- Master section 1
SCK_1 : RP.GPIO.GPIO_Point renames Tiny.SCK_0_6;
NSS_1 : RP.GPIO.GPIO_Point renames Tiny.NSS_0_5;
MOSI_1 : RP.GPIO.GPIO_Point renames Tiny.MOSI_0_7;
MISO_1 : RP.GPIO.GPIO_Point renames Tiny.MISO_0_4;
-----------------------------------------------------------------------
-- Renaming section
SCK : RP.GPIO.GPIO_Point renames SCK_1;
NSS : RP.GPIO.GPIO_Point renames NSS_1;
MOSI : RP.GPIO.GPIO_Point renames MOSI_1;
MISO : RP.GPIO.GPIO_Point renames MISO_1;
-----------------------------------------------------------------------
-- Configuration for the master part for the Tiny
Config : constant RP.SPI.SPI_Configuration
:= (Role => RP.SPI.Master,
Baud => 10_000_000,
Data_Size => HAL.SPI.Data_Size_16b,
others => <>);
-----------------------------------------------------------------------
-- Initializes the Tiny as master SPI
procedure SPI_Initialize is
begin
SCK.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
NSS.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MOSI.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.SPI);
MISO.Configure (RP.GPIO.Input, RP.GPIO.Floating, RP.GPIO.SPI);
SPI.Configure (Config);
end SPI_Initialize;
begin
Tiny.Initialize;
SPI_Initialize;
loop
-- construct the values for the transmission
for Higher_Byte in HAL.UInt8'Range loop
for Lower_Byte in HAL.UInt8'Range loop
Word := Shift_Left (Value => HAL.UInt16 (Higher_Byte),
Amount => 8) or HAL.UInt16 (Lower_Byte);
Data_Out_16 (1) := Word;
SPI.Transmit (Data_Out_16, Status_Out);
SPI.Receive (Data_In_16, Status_In, 0);
RP.Device.Timer.Delay_Milliseconds (100);
Tiny.LED_Red.Toggle;
end loop;
end loop;
end loop;
end SPI_Master_16;
|
[
{
"context": "--\n-- Copyright (C) 2010-2020 by Heisenbug Ltd. ([email protected])\n--\n-- This work is free. You can redistribute i",
"end": 139,
"score": 0.9999293684959412,
"start": 120,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
extra/msg_passing.ads
|
HeisenbugLtd/msg_passing
| 0 |
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. ([email protected])
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- Msg_Passing
--
-- Root package for the several message passing algorithms, like
-- blackboards, whiteboards, and queues.
--
------------------------------------------------------------------------
generic
-- Type of message being exchanged.
-- May be any constrained type.
type Letter is private;
package Msg_Passing is
pragma Pure;
---------------------------------------------------------------------
-- The messenger object
---------------------------------------------------------------------
type Object is abstract tagged limited private;
---------------------------------------------------------------------
-- Object.Read
---------------------------------------------------------------------
procedure Read (Instance : in out Object;
Message : out Letter) is abstract;
---------------------------------------------------------------------
-- Object.Write
---------------------------------------------------------------------
procedure Write (Instance : in out Object;
Message : in Letter) is abstract;
private
type Object is abstract tagged limited null record;
end Msg_Passing;
|
10374
|
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- Msg_Passing
--
-- Root package for the several message passing algorithms, like
-- blackboards, whiteboards, and queues.
--
------------------------------------------------------------------------
generic
-- Type of message being exchanged.
-- May be any constrained type.
type Letter is private;
package Msg_Passing is
pragma Pure;
---------------------------------------------------------------------
-- The messenger object
---------------------------------------------------------------------
type Object is abstract tagged limited private;
---------------------------------------------------------------------
-- Object.Read
---------------------------------------------------------------------
procedure Read (Instance : in out Object;
Message : out Letter) is abstract;
---------------------------------------------------------------------
-- Object.Write
---------------------------------------------------------------------
procedure Write (Instance : in out Object;
Message : in Letter) is abstract;
private
type Object is abstract tagged limited null record;
end Msg_Passing;
| true |
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (PI:EMAIL:<EMAIL>END_PI)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- Msg_Passing
--
-- Root package for the several message passing algorithms, like
-- blackboards, whiteboards, and queues.
--
------------------------------------------------------------------------
generic
-- Type of message being exchanged.
-- May be any constrained type.
type Letter is private;
package Msg_Passing is
pragma Pure;
---------------------------------------------------------------------
-- The messenger object
---------------------------------------------------------------------
type Object is abstract tagged limited private;
---------------------------------------------------------------------
-- Object.Read
---------------------------------------------------------------------
procedure Read (Instance : in out Object;
Message : out Letter) is abstract;
---------------------------------------------------------------------
-- Object.Write
---------------------------------------------------------------------
procedure Write (Instance : in out Object;
Message : in Letter) is abstract;
private
type Object is abstract tagged limited null record;
end Msg_Passing;
|
[
{
"context": "Date Converters\n-- Copyright (C) 2011, 2014, 2016 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 166,
"score": 0.9998760223388672,
"start": 151,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "C) 2011, 2014, 2016 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 197,
"score": 0.9998798370361328,
"start": 182,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "6 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 224,
"score": 0.9999296069145203,
"start": 199,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/asf-converters-dates.ads
|
jquorning/ada-asf
| 12 |
-----------------------------------------------------------------------
-- asf-converters-dates -- Date Converters
-- Copyright (C) 2011, 2014, 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Locales;
with ASF.Components.Base;
with ASF.Contexts.Faces;
with ASF.Locales;
-- The <b>ASF.Converters.Dates</b> defines the date converter to format a date object
-- into a localized representation.
--
-- See JSR 314 - JavaServer Faces Specification 9.4.3 <f:convertDateTime>
-- (To_String is the JSF getAsString method and To_Object is the JSF getAsObject method)
package ASF.Converters.Dates is
type Style_Type is (DEFAULT, SHORT, MEDIUM, LONG, FULL);
type Format_Type is (DATE, TIME, BOTH, CONVERTER_PATTERN, COMPONENT_FORMAT);
-- ------------------------------
-- Converter
-- ------------------------------
-- The <b>Date_Converter</b> translates the object value which holds an Ada.Calendar
-- into a printable date representation. It translates a string into an Ada Calendar time.
-- Unlike the Java implementation, the instance will be shared by multiple
-- views and requests.
type Date_Converter is new Converter with private;
type Date_Converter_Access is access all Date_Converter'Class;
-- Convert the object value into a string. The object value is associated
-- with the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_String (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in Util.Beans.Objects.Object) return String;
-- Convert the date string into an object for the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_Object (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in String) return Util.Beans.Objects.Object;
-- Get the date format pattern that must be used for formatting a date on the given component.
function Get_Pattern (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Bundle : in ASF.Locales.Bundle;
Component : in ASF.Components.Base.UIComponent'Class) return String;
-- Get the locale that must be used to format the date.
function Get_Locale (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Util.Locales.Locale;
-- Create a date converter.
function Create_Date_Converter (Date : in Style_Type;
Time : in Style_Type;
Format : in Format_Type;
Locale : in String;
Pattern : in String) return Date_Converter_Access;
private
type Date_Converter is new Converter with record
Date_Style : Style_Type := DEFAULT;
Time_Style : Style_Type := DEFAULT;
Format : Format_Type := BOTH;
Locale : Util.Locales.Locale;
Pattern : Ada.Strings.Unbounded.Unbounded_String;
end record;
end ASF.Converters.Dates;
|
3329
|
-----------------------------------------------------------------------
-- asf-converters-dates -- Date Converters
-- Copyright (C) 2011, 2014, 2016 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 Util.Beans.Objects;
with Util.Locales;
with ASF.Components.Base;
with ASF.Contexts.Faces;
with ASF.Locales;
-- The <b>ASF.Converters.Dates</b> defines the date converter to format a date object
-- into a localized representation.
--
-- See JSR 314 - JavaServer Faces Specification 9.4.3 <f:convertDateTime>
-- (To_String is the JSF getAsString method and To_Object is the JSF getAsObject method)
package ASF.Converters.Dates is
type Style_Type is (DEFAULT, SHORT, MEDIUM, LONG, FULL);
type Format_Type is (DATE, TIME, BOTH, CONVERTER_PATTERN, COMPONENT_FORMAT);
-- ------------------------------
-- Converter
-- ------------------------------
-- The <b>Date_Converter</b> translates the object value which holds an Ada.Calendar
-- into a printable date representation. It translates a string into an Ada Calendar time.
-- Unlike the Java implementation, the instance will be shared by multiple
-- views and requests.
type Date_Converter is new Converter with private;
type Date_Converter_Access is access all Date_Converter'Class;
-- Convert the object value into a string. The object value is associated
-- with the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_String (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in Util.Beans.Objects.Object) return String;
-- Convert the date string into an object for the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_Object (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in String) return Util.Beans.Objects.Object;
-- Get the date format pattern that must be used for formatting a date on the given component.
function Get_Pattern (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Bundle : in ASF.Locales.Bundle;
Component : in ASF.Components.Base.UIComponent'Class) return String;
-- Get the locale that must be used to format the date.
function Get_Locale (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Util.Locales.Locale;
-- Create a date converter.
function Create_Date_Converter (Date : in Style_Type;
Time : in Style_Type;
Format : in Format_Type;
Locale : in String;
Pattern : in String) return Date_Converter_Access;
private
type Date_Converter is new Converter with record
Date_Style : Style_Type := DEFAULT;
Time_Style : Style_Type := DEFAULT;
Format : Format_Type := BOTH;
Locale : Util.Locales.Locale;
Pattern : Ada.Strings.Unbounded.Unbounded_String;
end record;
end ASF.Converters.Dates;
| true |
-----------------------------------------------------------------------
-- asf-converters-dates -- Date Converters
-- Copyright (C) 2011, 2014, 2016 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 Util.Beans.Objects;
with Util.Locales;
with ASF.Components.Base;
with ASF.Contexts.Faces;
with ASF.Locales;
-- The <b>ASF.Converters.Dates</b> defines the date converter to format a date object
-- into a localized representation.
--
-- See JSR 314 - JavaServer Faces Specification 9.4.3 <f:convertDateTime>
-- (To_String is the JSF getAsString method and To_Object is the JSF getAsObject method)
package ASF.Converters.Dates is
type Style_Type is (DEFAULT, SHORT, MEDIUM, LONG, FULL);
type Format_Type is (DATE, TIME, BOTH, CONVERTER_PATTERN, COMPONENT_FORMAT);
-- ------------------------------
-- Converter
-- ------------------------------
-- The <b>Date_Converter</b> translates the object value which holds an Ada.Calendar
-- into a printable date representation. It translates a string into an Ada Calendar time.
-- Unlike the Java implementation, the instance will be shared by multiple
-- views and requests.
type Date_Converter is new Converter with private;
type Date_Converter_Access is access all Date_Converter'Class;
-- Convert the object value into a string. The object value is associated
-- with the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_String (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in Util.Beans.Objects.Object) return String;
-- Convert the date string into an object for the specified component.
-- If the string cannot be converted, the Invalid_Conversion exception should be raised.
function To_Object (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Component : in ASF.Components.Base.UIComponent'Class;
Value : in String) return Util.Beans.Objects.Object;
-- Get the date format pattern that must be used for formatting a date on the given component.
function Get_Pattern (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
Bundle : in ASF.Locales.Bundle;
Component : in ASF.Components.Base.UIComponent'Class) return String;
-- Get the locale that must be used to format the date.
function Get_Locale (Convert : in Date_Converter;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Util.Locales.Locale;
-- Create a date converter.
function Create_Date_Converter (Date : in Style_Type;
Time : in Style_Type;
Format : in Format_Type;
Locale : in String;
Pattern : in String) return Date_Converter_Access;
private
type Date_Converter is new Converter with record
Date_Style : Style_Type := DEFAULT;
Time_Style : Style_Type := DEFAULT;
Format : Format_Type := BOTH;
Locale : Util.Locales.Locale;
Pattern : Ada.Strings.Unbounded.Unbounded_String;
end record;
end ASF.Converters.Dates;
|
[
{
"context": "----------------------------\n-- Copyright (c) 2016 Daniel King\n--\n-- Permission is hereby granted, free of charg",
"end": 113,
"score": 0.9996711611747742,
"start": 102,
"tag": "NAME",
"value": "Daniel King"
}
] |
src/verhoeff.adb
|
damaki/Verhoeff
| 0 |
-------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- 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.
-------------------------------------------------------------------------------
package body Verhoeff
with SPARK_Mode => On
is
type Digit_Number is new Natural range 0 .. 9;
D : constant array(Digit_Number, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
(2, 3, 4, 0, 1, 7, 8, 9, 5, 6),
(3, 4, 0, 1, 2, 8, 9, 5, 6, 7),
(4, 0, 1, 2, 3, 9, 5, 6, 7, 8),
(5, 9, 8, 7, 6, 0, 4, 3, 2, 1),
(6, 5, 9, 8, 7, 1, 0, 4, 3, 2),
(7, 6, 5, 9, 8, 2, 1, 0, 4, 3),
(8, 7, 6, 5, 9, 3, 2, 1, 0, 4),
(9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
Inv : constant array(Digit_Number) of Digit_Number :=
(0, 4, 3, 2, 1, 5, 6, 7, 8, 9);
P : constant array(Digit_Number range 0 .. 7, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 5, 7, 6, 2, 8, 3, 0, 9, 4),
(5, 8, 0, 3, 7, 9, 6, 1, 4, 2),
(8, 9, 1, 6, 0, 4, 3, 5, 2, 7),
(9, 4, 5, 3, 1, 2, 6, 8, 7, 0),
(4, 2, 8, 6, 5, 7, 3, 9, 0, 1),
(2, 7, 9, 3, 8, 0, 6, 4, 1, 5),
(7, 0, 4, 6, 9, 1, 3, 2, 5, 8));
-- Check that Inv(Inv(j)) == j
pragma Assert(for all J in Digit_Number => Inv(Inv(J)) = J);
-- Check that D(j, Inv(j)) = 0
pragma Assert(for all J in Digit_Number => D(J, Inv(J)) = 0);
-- Check that P(i+j, n) = P(i, P(j, n))
pragma Assert(for all I in Digit_Number =>
(for all J in Digit_Number =>
(for all N in Digit_Number =>
P((I+J) mod 8, N) = P(I mod 8, P(J mod 8, N))
)
)
);
function To_Digit_Number(Value : in Digit_Character) return Digit_Number
is (Digit_Number(Digit_Character'Pos(Value) - Digit_Character'Pos('0')))
with Inline;
function To_Digit_Character(Value : in Digit_Number) return Digit_Character
is (Digit_Character'Val(Digit_Character'Pos('0') + Integer(Value)))
with Inline;
function Compute_Verhoeff(Seq : in String;
Initial : in Digit_Character) return Digit_Number
with Pre => (for all I in Seq'Range => (Seq(I) in Digit_Character))
is
C : Digit_Number := To_Digit_Number(Initial);
I : Natural := 0;
X : Natural := Seq'Length;
begin
while X > 0 loop
pragma Loop_Variant(Decreases => X);
pragma Loop_Invariant((I+X) = Seq'Length);
I := I + 1;
X := X - 1;
C := D(C, P(Digit_Number(I mod 8), To_Digit_Number(Seq(Seq'First + X))));
end loop;
return C;
end Compute_Verhoeff;
function Check_Digit(Seq : in String) return Digit_Character
is
begin
return To_Digit_Character(Inv(Compute_Verhoeff(Seq, '0')));
end Check_Digit;
function Is_Valid(Seq : in String) return Boolean
is
begin
return 0 = Compute_Verhoeff(Seq(Seq'First .. Seq'Last - 1), Seq(Seq'Last));
end Is_Valid;
end Verhoeff;
|
30105
|
-------------------------------------------------------------------------------
-- Copyright (c) 2016 <NAME>
--
-- 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.
-------------------------------------------------------------------------------
package body Verhoeff
with SPARK_Mode => On
is
type Digit_Number is new Natural range 0 .. 9;
D : constant array(Digit_Number, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
(2, 3, 4, 0, 1, 7, 8, 9, 5, 6),
(3, 4, 0, 1, 2, 8, 9, 5, 6, 7),
(4, 0, 1, 2, 3, 9, 5, 6, 7, 8),
(5, 9, 8, 7, 6, 0, 4, 3, 2, 1),
(6, 5, 9, 8, 7, 1, 0, 4, 3, 2),
(7, 6, 5, 9, 8, 2, 1, 0, 4, 3),
(8, 7, 6, 5, 9, 3, 2, 1, 0, 4),
(9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
Inv : constant array(Digit_Number) of Digit_Number :=
(0, 4, 3, 2, 1, 5, 6, 7, 8, 9);
P : constant array(Digit_Number range 0 .. 7, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 5, 7, 6, 2, 8, 3, 0, 9, 4),
(5, 8, 0, 3, 7, 9, 6, 1, 4, 2),
(8, 9, 1, 6, 0, 4, 3, 5, 2, 7),
(9, 4, 5, 3, 1, 2, 6, 8, 7, 0),
(4, 2, 8, 6, 5, 7, 3, 9, 0, 1),
(2, 7, 9, 3, 8, 0, 6, 4, 1, 5),
(7, 0, 4, 6, 9, 1, 3, 2, 5, 8));
-- Check that Inv(Inv(j)) == j
pragma Assert(for all J in Digit_Number => Inv(Inv(J)) = J);
-- Check that D(j, Inv(j)) = 0
pragma Assert(for all J in Digit_Number => D(J, Inv(J)) = 0);
-- Check that P(i+j, n) = P(i, P(j, n))
pragma Assert(for all I in Digit_Number =>
(for all J in Digit_Number =>
(for all N in Digit_Number =>
P((I+J) mod 8, N) = P(I mod 8, P(J mod 8, N))
)
)
);
function To_Digit_Number(Value : in Digit_Character) return Digit_Number
is (Digit_Number(Digit_Character'Pos(Value) - Digit_Character'Pos('0')))
with Inline;
function To_Digit_Character(Value : in Digit_Number) return Digit_Character
is (Digit_Character'Val(Digit_Character'Pos('0') + Integer(Value)))
with Inline;
function Compute_Verhoeff(Seq : in String;
Initial : in Digit_Character) return Digit_Number
with Pre => (for all I in Seq'Range => (Seq(I) in Digit_Character))
is
C : Digit_Number := To_Digit_Number(Initial);
I : Natural := 0;
X : Natural := Seq'Length;
begin
while X > 0 loop
pragma Loop_Variant(Decreases => X);
pragma Loop_Invariant((I+X) = Seq'Length);
I := I + 1;
X := X - 1;
C := D(C, P(Digit_Number(I mod 8), To_Digit_Number(Seq(Seq'First + X))));
end loop;
return C;
end Compute_Verhoeff;
function Check_Digit(Seq : in String) return Digit_Character
is
begin
return To_Digit_Character(Inv(Compute_Verhoeff(Seq, '0')));
end Check_Digit;
function Is_Valid(Seq : in String) return Boolean
is
begin
return 0 = Compute_Verhoeff(Seq(Seq'First .. Seq'Last - 1), Seq(Seq'Last));
end Is_Valid;
end Verhoeff;
| true |
-------------------------------------------------------------------------------
-- Copyright (c) 2016 PI:NAME:<NAME>END_PI
--
-- 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.
-------------------------------------------------------------------------------
package body Verhoeff
with SPARK_Mode => On
is
type Digit_Number is new Natural range 0 .. 9;
D : constant array(Digit_Number, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
(2, 3, 4, 0, 1, 7, 8, 9, 5, 6),
(3, 4, 0, 1, 2, 8, 9, 5, 6, 7),
(4, 0, 1, 2, 3, 9, 5, 6, 7, 8),
(5, 9, 8, 7, 6, 0, 4, 3, 2, 1),
(6, 5, 9, 8, 7, 1, 0, 4, 3, 2),
(7, 6, 5, 9, 8, 2, 1, 0, 4, 3),
(8, 7, 6, 5, 9, 3, 2, 1, 0, 4),
(9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
Inv : constant array(Digit_Number) of Digit_Number :=
(0, 4, 3, 2, 1, 5, 6, 7, 8, 9);
P : constant array(Digit_Number range 0 .. 7, Digit_Number) of Digit_Number :=
((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 5, 7, 6, 2, 8, 3, 0, 9, 4),
(5, 8, 0, 3, 7, 9, 6, 1, 4, 2),
(8, 9, 1, 6, 0, 4, 3, 5, 2, 7),
(9, 4, 5, 3, 1, 2, 6, 8, 7, 0),
(4, 2, 8, 6, 5, 7, 3, 9, 0, 1),
(2, 7, 9, 3, 8, 0, 6, 4, 1, 5),
(7, 0, 4, 6, 9, 1, 3, 2, 5, 8));
-- Check that Inv(Inv(j)) == j
pragma Assert(for all J in Digit_Number => Inv(Inv(J)) = J);
-- Check that D(j, Inv(j)) = 0
pragma Assert(for all J in Digit_Number => D(J, Inv(J)) = 0);
-- Check that P(i+j, n) = P(i, P(j, n))
pragma Assert(for all I in Digit_Number =>
(for all J in Digit_Number =>
(for all N in Digit_Number =>
P((I+J) mod 8, N) = P(I mod 8, P(J mod 8, N))
)
)
);
function To_Digit_Number(Value : in Digit_Character) return Digit_Number
is (Digit_Number(Digit_Character'Pos(Value) - Digit_Character'Pos('0')))
with Inline;
function To_Digit_Character(Value : in Digit_Number) return Digit_Character
is (Digit_Character'Val(Digit_Character'Pos('0') + Integer(Value)))
with Inline;
function Compute_Verhoeff(Seq : in String;
Initial : in Digit_Character) return Digit_Number
with Pre => (for all I in Seq'Range => (Seq(I) in Digit_Character))
is
C : Digit_Number := To_Digit_Number(Initial);
I : Natural := 0;
X : Natural := Seq'Length;
begin
while X > 0 loop
pragma Loop_Variant(Decreases => X);
pragma Loop_Invariant((I+X) = Seq'Length);
I := I + 1;
X := X - 1;
C := D(C, P(Digit_Number(I mod 8), To_Digit_Number(Seq(Seq'First + X))));
end loop;
return C;
end Compute_Verhoeff;
function Check_Digit(Seq : in String) return Digit_Character
is
begin
return To_Digit_Character(Inv(Compute_Verhoeff(Seq, '0')));
end Check_Digit;
function Is_Valid(Seq : in String) return Boolean
is
begin
return 0 = Compute_Verhoeff(Seq(Seq'First .. Seq'Last - 1), Seq(Seq'Last));
end Is_Valid;
end Verhoeff;
|
[
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- Al",
"end": 824,
"score": 0.9998877644538879,
"start": 811,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 844,
"score": 0.999931812286377,
"start": 826,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/amf/uml/amf-internals-tables-standard_profile_l2_metamodel-properties.adb
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.CMOF;
with AMF.Internals.Tables.CMOF_Attributes;
with AMF.Internals.Tables.Standard_Profile_L2_String_Data_00;
package body AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties is
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_1;
Initialize_2;
Initialize_3;
Initialize_4;
Initialize_5;
Initialize_6;
Initialize_7;
Initialize_8;
Initialize_9;
Initialize_10;
Initialize_11;
Initialize_12;
Initialize_13;
Initialize_14;
Initialize_15;
Initialize_16;
Initialize_17;
Initialize_18;
Initialize_19;
Initialize_20;
Initialize_21;
Initialize_22;
Initialize_23;
Initialize_24;
Initialize_25;
Initialize_26;
Initialize_27;
Initialize_28;
Initialize_29;
Initialize_30;
Initialize_31;
Initialize_32;
Initialize_33;
Initialize_34;
Initialize_35;
Initialize_36;
Initialize_37;
Initialize_38;
Initialize_39;
Initialize_40;
Initialize_41;
Initialize_42;
Initialize_43;
Initialize_44;
Initialize_45;
Initialize_46;
Initialize_47;
Initialize_48;
Initialize_49;
Initialize_50;
Initialize_51;
Initialize_52;
Initialize_53;
Initialize_54;
Initialize_55;
Initialize_56;
Initialize_57;
Initialize_58;
Initialize_59;
Initialize_60;
Initialize_61;
Initialize_62;
Initialize_63;
Initialize_64;
Initialize_65;
Initialize_66;
Initialize_67;
Initialize_68;
Initialize_69;
Initialize_70;
Initialize_71;
Initialize_72;
Initialize_73;
Initialize_74;
Initialize_75;
Initialize_76;
Initialize_77;
Initialize_78;
Initialize_79;
Initialize_80;
Initialize_81;
Initialize_82;
Initialize_83;
Initialize_84;
Initialize_85;
Initialize_86;
Initialize_87;
Initialize_88;
Initialize_89;
Initialize_90;
Initialize_91;
Initialize_92;
Initialize_93;
Initialize_94;
Initialize_95;
Initialize_96;
Initialize_97;
Initialize_98;
Initialize_99;
Initialize_100;
Initialize_101;
Initialize_102;
Initialize_103;
Initialize_104;
Initialize_105;
Initialize_106;
Initialize_107;
Initialize_108;
Initialize_109;
Initialize_110;
Initialize_111;
Initialize_112;
Initialize_113;
Initialize_114;
Initialize_115;
Initialize_116;
Initialize_117;
Initialize_118;
Initialize_119;
Initialize_120;
Initialize_121;
Initialize_122;
Initialize_123;
Initialize_124;
Initialize_125;
Initialize_126;
Initialize_127;
Initialize_128;
Initialize_129;
Initialize_130;
Initialize_131;
Initialize_132;
Initialize_133;
Initialize_134;
Initialize_135;
Initialize_136;
Initialize_137;
Initialize_138;
Initialize_139;
Initialize_140;
Initialize_141;
Initialize_142;
Initialize_143;
Initialize_144;
Initialize_145;
Initialize_146;
Initialize_147;
Initialize_148;
Initialize_149;
Initialize_150;
Initialize_151;
Initialize_152;
Initialize_153;
Initialize_154;
Initialize_155;
Initialize_156;
Initialize_157;
Initialize_158;
Initialize_159;
Initialize_160;
Initialize_161;
Initialize_162;
Initialize_163;
Initialize_164;
Initialize_165;
Initialize_166;
Initialize_167;
Initialize_168;
Initialize_169;
Initialize_170;
Initialize_171;
Initialize_172;
Initialize_173;
Initialize_174;
Initialize_175;
Initialize_176;
Initialize_177;
Initialize_178;
Initialize_179;
Initialize_180;
end Initialize;
------------------
-- Initialize_1 --
------------------
procedure Initialize_1 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 1,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0029'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 1, (Is_Empty => True));
end Initialize_1;
------------------
-- Initialize_2 --
------------------
procedure Initialize_2 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 2,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 2, (Is_Empty => True));
end Initialize_2;
------------------
-- Initialize_3 --
------------------
procedure Initialize_3 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 3,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 3, (Is_Empty => True));
end Initialize_3;
------------------
-- Initialize_4 --
------------------
procedure Initialize_4 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 4,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0088'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 4, (Is_Empty => True));
end Initialize_4;
------------------
-- Initialize_5 --
------------------
procedure Initialize_5 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 5,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 5, (Is_Empty => True));
end Initialize_5;
------------------
-- Initialize_6 --
------------------
procedure Initialize_6 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 6,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0013'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 6, (Is_Empty => True));
end Initialize_6;
------------------
-- Initialize_7 --
------------------
procedure Initialize_7 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 7,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0071'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 7, (Is_Empty => True));
end Initialize_7;
------------------
-- Initialize_8 --
------------------
procedure Initialize_8 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 8,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0003'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 8, (Is_Empty => True));
end Initialize_8;
------------------
-- Initialize_9 --
------------------
procedure Initialize_9 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 9, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 9,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0010'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 9, (Is_Empty => True));
end Initialize_9;
-------------------
-- Initialize_10 --
-------------------
procedure Initialize_10 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 10,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0076'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 10, (Is_Empty => True));
end Initialize_10;
-------------------
-- Initialize_11 --
-------------------
procedure Initialize_11 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 11,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0007'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 11, (Is_Empty => True));
end Initialize_11;
-------------------
-- Initialize_12 --
-------------------
procedure Initialize_12 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 12,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0036'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 12, (Is_Empty => True));
end Initialize_12;
-------------------
-- Initialize_13 --
-------------------
procedure Initialize_13 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 13,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0033'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 13, (Is_Empty => True));
end Initialize_13;
-------------------
-- Initialize_14 --
-------------------
procedure Initialize_14 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 14,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0079'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 14, (Is_Empty => True));
end Initialize_14;
-------------------
-- Initialize_15 --
-------------------
procedure Initialize_15 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 15,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0040'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 15, (Is_Empty => True));
end Initialize_15;
-------------------
-- Initialize_16 --
-------------------
procedure Initialize_16 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 16,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 16, (Is_Empty => True));
end Initialize_16;
-------------------
-- Initialize_17 --
-------------------
procedure Initialize_17 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 17,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0052'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 17, (Is_Empty => True));
end Initialize_17;
-------------------
-- Initialize_18 --
-------------------
procedure Initialize_18 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 18,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 18, (Is_Empty => True));
end Initialize_18;
-------------------
-- Initialize_19 --
-------------------
procedure Initialize_19 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 19,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 19, (Is_Empty => True));
end Initialize_19;
-------------------
-- Initialize_20 --
-------------------
procedure Initialize_20 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 20,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0082'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 20, (Is_Empty => True));
end Initialize_20;
-------------------
-- Initialize_21 --
-------------------
procedure Initialize_21 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 21,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0055'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 21, (Is_Empty => True));
end Initialize_21;
-------------------
-- Initialize_22 --
-------------------
procedure Initialize_22 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 22,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 22, (Is_Empty => True));
end Initialize_22;
-------------------
-- Initialize_23 --
-------------------
procedure Initialize_23 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 23,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0062'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 23, (Is_Empty => True));
end Initialize_23;
-------------------
-- Initialize_24 --
-------------------
procedure Initialize_24 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 24,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 24, (Is_Empty => True));
end Initialize_24;
-------------------
-- Initialize_25 --
-------------------
procedure Initialize_25 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 25,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 25, (Is_Empty => True));
end Initialize_25;
-------------------
-- Initialize_26 --
-------------------
procedure Initialize_26 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 26,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0014'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 26, (Is_Empty => True));
end Initialize_26;
-------------------
-- Initialize_27 --
-------------------
procedure Initialize_27 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 27,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0051'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 27, (Is_Empty => True));
end Initialize_27;
-------------------
-- Initialize_28 --
-------------------
procedure Initialize_28 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 28,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 28, (Is_Empty => True));
end Initialize_28;
-------------------
-- Initialize_29 --
-------------------
procedure Initialize_29 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 29,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 29, (Is_Empty => True));
end Initialize_29;
-------------------
-- Initialize_30 --
-------------------
procedure Initialize_30 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 30,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0022'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 30, (Is_Empty => True));
end Initialize_30;
-------------------
-- Initialize_31 --
-------------------
procedure Initialize_31 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 31,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 31, (False, AMF.CMOF.Public_Visibility));
end Initialize_31;
-------------------
-- Initialize_32 --
-------------------
procedure Initialize_32 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 32,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 32, (False, AMF.CMOF.Public_Visibility));
end Initialize_32;
-------------------
-- Initialize_33 --
-------------------
procedure Initialize_33 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 33,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 33, (False, AMF.CMOF.Public_Visibility));
end Initialize_33;
-------------------
-- Initialize_34 --
-------------------
procedure Initialize_34 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 34,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 34, (False, AMF.CMOF.Public_Visibility));
end Initialize_34;
-------------------
-- Initialize_35 --
-------------------
procedure Initialize_35 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 35,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 35, (False, AMF.CMOF.Public_Visibility));
end Initialize_35;
-------------------
-- Initialize_36 --
-------------------
procedure Initialize_36 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 36, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 36,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0015'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 36, (False, AMF.CMOF.Public_Visibility));
end Initialize_36;
-------------------
-- Initialize_37 --
-------------------
procedure Initialize_37 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 37,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 37, (False, AMF.CMOF.Public_Visibility));
end Initialize_37;
-------------------
-- Initialize_38 --
-------------------
procedure Initialize_38 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 38,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 38, (False, AMF.CMOF.Public_Visibility));
end Initialize_38;
-------------------
-- Initialize_39 --
-------------------
procedure Initialize_39 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 39,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 39, (False, AMF.CMOF.Public_Visibility));
end Initialize_39;
-------------------
-- Initialize_40 --
-------------------
procedure Initialize_40 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 40,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 40, (False, AMF.CMOF.Public_Visibility));
end Initialize_40;
-------------------
-- Initialize_41 --
-------------------
procedure Initialize_41 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 41,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 41, (False, AMF.CMOF.Public_Visibility));
end Initialize_41;
-------------------
-- Initialize_42 --
-------------------
procedure Initialize_42 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 42,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 42, (False, AMF.CMOF.Public_Visibility));
end Initialize_42;
-------------------
-- Initialize_43 --
-------------------
procedure Initialize_43 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 43,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 43, (False, AMF.CMOF.Public_Visibility));
end Initialize_43;
-------------------
-- Initialize_44 --
-------------------
procedure Initialize_44 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 44,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 44, (False, AMF.CMOF.Public_Visibility));
end Initialize_44;
-------------------
-- Initialize_45 --
-------------------
procedure Initialize_45 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 45,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 45, (False, AMF.CMOF.Public_Visibility));
end Initialize_45;
-------------------
-- Initialize_46 --
-------------------
procedure Initialize_46 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 46,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 46, (False, AMF.CMOF.Public_Visibility));
end Initialize_46;
-------------------
-- Initialize_47 --
-------------------
procedure Initialize_47 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 47,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 47, (False, AMF.CMOF.Public_Visibility));
end Initialize_47;
-------------------
-- Initialize_48 --
-------------------
procedure Initialize_48 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 48,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 48, (False, AMF.CMOF.Public_Visibility));
end Initialize_48;
-------------------
-- Initialize_49 --
-------------------
procedure Initialize_49 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 49,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 49, (False, AMF.CMOF.Public_Visibility));
end Initialize_49;
-------------------
-- Initialize_50 --
-------------------
procedure Initialize_50 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 50,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 50, (False, AMF.CMOF.Public_Visibility));
end Initialize_50;
-------------------
-- Initialize_51 --
-------------------
procedure Initialize_51 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 51,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 51, (False, AMF.CMOF.Public_Visibility));
end Initialize_51;
-------------------
-- Initialize_52 --
-------------------
procedure Initialize_52 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 52,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 52, (False, AMF.CMOF.Public_Visibility));
end Initialize_52;
-------------------
-- Initialize_53 --
-------------------
procedure Initialize_53 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 53,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 53, (False, AMF.CMOF.Public_Visibility));
end Initialize_53;
-------------------
-- Initialize_54 --
-------------------
procedure Initialize_54 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 54,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 54, (False, AMF.CMOF.Public_Visibility));
end Initialize_54;
-------------------
-- Initialize_55 --
-------------------
procedure Initialize_55 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 55,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 55, (False, AMF.CMOF.Public_Visibility));
end Initialize_55;
-------------------
-- Initialize_56 --
-------------------
procedure Initialize_56 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 56,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 56, (False, AMF.CMOF.Public_Visibility));
end Initialize_56;
-------------------
-- Initialize_57 --
-------------------
procedure Initialize_57 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 57,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 57, (False, AMF.CMOF.Public_Visibility));
end Initialize_57;
-------------------
-- Initialize_58 --
-------------------
procedure Initialize_58 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 58,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 58, (False, AMF.CMOF.Public_Visibility));
end Initialize_58;
-------------------
-- Initialize_59 --
-------------------
procedure Initialize_59 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 59,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 59, (False, AMF.CMOF.Public_Visibility));
end Initialize_59;
-------------------
-- Initialize_60 --
-------------------
procedure Initialize_60 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 60,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 60, (False, AMF.CMOF.Public_Visibility));
end Initialize_60;
-------------------
-- Initialize_61 --
-------------------
procedure Initialize_61 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 61,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 61, (False, AMF.CMOF.Public_Visibility));
end Initialize_61;
-------------------
-- Initialize_62 --
-------------------
procedure Initialize_62 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 62,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 62, (False, AMF.CMOF.Public_Visibility));
end Initialize_62;
-------------------
-- Initialize_63 --
-------------------
procedure Initialize_63 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 63,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0042'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 63, (Is_Empty => True));
end Initialize_63;
-------------------
-- Initialize_64 --
-------------------
procedure Initialize_64 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 64,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 64, (Is_Empty => True));
end Initialize_64;
-------------------
-- Initialize_65 --
-------------------
procedure Initialize_65 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 65,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 65, (Is_Empty => True));
end Initialize_65;
-------------------
-- Initialize_66 --
-------------------
procedure Initialize_66 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 66,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0017'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 66, (Is_Empty => True));
end Initialize_66;
-------------------
-- Initialize_67 --
-------------------
procedure Initialize_67 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 67,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 67, (Is_Empty => True));
end Initialize_67;
-------------------
-- Initialize_68 --
-------------------
procedure Initialize_68 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 68,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0020'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 68, (Is_Empty => True));
end Initialize_68;
-------------------
-- Initialize_69 --
-------------------
procedure Initialize_69 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 69,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0069'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 69, (Is_Empty => True));
end Initialize_69;
-------------------
-- Initialize_70 --
-------------------
procedure Initialize_70 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 70,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 70, (Is_Empty => True));
end Initialize_70;
-------------------
-- Initialize_71 --
-------------------
procedure Initialize_71 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 71,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0074'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 71, (Is_Empty => True));
end Initialize_71;
-------------------
-- Initialize_72 --
-------------------
procedure Initialize_72 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 72,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0032'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 72, (Is_Empty => True));
end Initialize_72;
-------------------
-- Initialize_73 --
-------------------
procedure Initialize_73 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 73,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 73, (Is_Empty => True));
end Initialize_73;
-------------------
-- Initialize_74 --
-------------------
procedure Initialize_74 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 74,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0063'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 74, (Is_Empty => True));
end Initialize_74;
-------------------
-- Initialize_75 --
-------------------
procedure Initialize_75 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 75,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0059'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 75, (Is_Empty => True));
end Initialize_75;
-------------------
-- Initialize_76 --
-------------------
procedure Initialize_76 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 76,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0070'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 76, (Is_Empty => True));
end Initialize_76;
-------------------
-- Initialize_77 --
-------------------
procedure Initialize_77 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 77,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0068'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 77, (Is_Empty => True));
end Initialize_77;
-------------------
-- Initialize_78 --
-------------------
procedure Initialize_78 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 78,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0006'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 78, (Is_Empty => True));
end Initialize_78;
-------------------
-- Initialize_79 --
-------------------
procedure Initialize_79 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 79,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0054'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 79, (Is_Empty => True));
end Initialize_79;
-------------------
-- Initialize_80 --
-------------------
procedure Initialize_80 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 80,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 80, (Is_Empty => True));
end Initialize_80;
-------------------
-- Initialize_81 --
-------------------
procedure Initialize_81 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 81,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 81, (Is_Empty => True));
end Initialize_81;
-------------------
-- Initialize_82 --
-------------------
procedure Initialize_82 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 82,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 82, (Is_Empty => True));
end Initialize_82;
-------------------
-- Initialize_83 --
-------------------
procedure Initialize_83 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 83,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0050'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 83, (Is_Empty => True));
end Initialize_83;
-------------------
-- Initialize_84 --
-------------------
procedure Initialize_84 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 84,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0028'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 84, (Is_Empty => True));
end Initialize_84;
-------------------
-- Initialize_85 --
-------------------
procedure Initialize_85 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 85,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 85, (Is_Empty => True));
end Initialize_85;
-------------------
-- Initialize_86 --
-------------------
procedure Initialize_86 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 86,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0077'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 86, (Is_Empty => True));
end Initialize_86;
-------------------
-- Initialize_87 --
-------------------
procedure Initialize_87 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 87,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0027'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 87, (Is_Empty => True));
end Initialize_87;
-------------------
-- Initialize_88 --
-------------------
procedure Initialize_88 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 88,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 88, (Is_Empty => True));
end Initialize_88;
-------------------
-- Initialize_89 --
-------------------
procedure Initialize_89 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 89,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 89, (Is_Empty => True));
end Initialize_89;
-------------------
-- Initialize_90 --
-------------------
procedure Initialize_90 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 90,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0038'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 90, (Is_Empty => True));
end Initialize_90;
-------------------
-- Initialize_91 --
-------------------
procedure Initialize_91 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 91,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0067'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 91, (Is_Empty => True));
end Initialize_91;
-------------------
-- Initialize_92 --
-------------------
procedure Initialize_92 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 92,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 92, (Is_Empty => True));
end Initialize_92;
-------------------
-- Initialize_93 --
-------------------
procedure Initialize_93 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 93,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0061'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 93, (Is_Empty => True));
end Initialize_93;
-------------------
-- Initialize_94 --
-------------------
procedure Initialize_94 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 94,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0030'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 94, (Is_Empty => True));
end Initialize_94;
-------------------
-- Initialize_95 --
-------------------
procedure Initialize_95 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Uri
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0049'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 95, (Is_Empty => True));
end Initialize_95;
-------------------
-- Initialize_96 --
-------------------
procedure Initialize_96 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 96, AMF.CMOF.Public_Visibility);
end Initialize_96;
-------------------
-- Initialize_97 --
-------------------
procedure Initialize_97 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 97, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 97, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 97,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 97, (False, AMF.CMOF.Public_Visibility));
end Initialize_97;
-------------------
-- Initialize_98 --
-------------------
procedure Initialize_98 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 98, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 98, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 98,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0073'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 98, (False, AMF.CMOF.Public_Visibility));
end Initialize_98;
-------------------
-- Initialize_99 --
-------------------
procedure Initialize_99 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 99, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 99, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 99,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0041'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 99, (False, AMF.CMOF.Public_Visibility));
end Initialize_99;
--------------------
-- Initialize_100 --
--------------------
procedure Initialize_100 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 100, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 100, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 100,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0008'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 100, (False, AMF.CMOF.Public_Visibility));
end Initialize_100;
--------------------
-- Initialize_101 --
--------------------
procedure Initialize_101 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 101, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 101, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 101,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0056'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 101, (False, AMF.CMOF.Public_Visibility));
end Initialize_101;
--------------------
-- Initialize_102 --
--------------------
procedure Initialize_102 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 102, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 102, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 102,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 102, (False, AMF.CMOF.Public_Visibility));
end Initialize_102;
--------------------
-- Initialize_103 --
--------------------
procedure Initialize_103 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 103, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 103, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 103,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0000'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 103, (False, AMF.CMOF.Public_Visibility));
end Initialize_103;
--------------------
-- Initialize_104 --
--------------------
procedure Initialize_104 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 104, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 104, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 104,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 104, (False, AMF.CMOF.Public_Visibility));
end Initialize_104;
--------------------
-- Initialize_105 --
--------------------
procedure Initialize_105 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 105, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 105, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 105,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0075'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 105, (False, AMF.CMOF.Public_Visibility));
end Initialize_105;
--------------------
-- Initialize_106 --
--------------------
procedure Initialize_106 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 106, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 106, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 106,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 106, (False, AMF.CMOF.Public_Visibility));
end Initialize_106;
--------------------
-- Initialize_107 --
--------------------
procedure Initialize_107 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 107, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 107, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 107,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 107, (False, AMF.CMOF.Public_Visibility));
end Initialize_107;
--------------------
-- Initialize_108 --
--------------------
procedure Initialize_108 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 108, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 108, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 108,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 108, (False, AMF.CMOF.Public_Visibility));
end Initialize_108;
--------------------
-- Initialize_109 --
--------------------
procedure Initialize_109 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 109, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 109, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 109,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0081'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 109, (False, AMF.CMOF.Public_Visibility));
end Initialize_109;
--------------------
-- Initialize_110 --
--------------------
procedure Initialize_110 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 110, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 110, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 110,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0001'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 110, (False, AMF.CMOF.Public_Visibility));
end Initialize_110;
--------------------
-- Initialize_111 --
--------------------
procedure Initialize_111 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 111, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 111, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 111,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0016'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 111, (False, AMF.CMOF.Public_Visibility));
end Initialize_111;
--------------------
-- Initialize_112 --
--------------------
procedure Initialize_112 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 112, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 112, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 112,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0005'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 112, (False, AMF.CMOF.Public_Visibility));
end Initialize_112;
--------------------
-- Initialize_113 --
--------------------
procedure Initialize_113 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 113, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 113, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 113,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0064'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 113, (False, AMF.CMOF.Public_Visibility));
end Initialize_113;
--------------------
-- Initialize_114 --
--------------------
procedure Initialize_114 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 114, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 114, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 114,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0080'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 114, (False, AMF.CMOF.Public_Visibility));
end Initialize_114;
--------------------
-- Initialize_115 --
--------------------
procedure Initialize_115 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 115, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 115, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 115,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0045'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 115, (False, AMF.CMOF.Public_Visibility));
end Initialize_115;
--------------------
-- Initialize_116 --
--------------------
procedure Initialize_116 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 116, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 116, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 116,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0065'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 116, (False, AMF.CMOF.Public_Visibility));
end Initialize_116;
--------------------
-- Initialize_117 --
--------------------
procedure Initialize_117 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 117, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 117, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 117,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0025'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 117, (False, AMF.CMOF.Public_Visibility));
end Initialize_117;
--------------------
-- Initialize_118 --
--------------------
procedure Initialize_118 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 118, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 118, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 118,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0012'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 118, (False, AMF.CMOF.Public_Visibility));
end Initialize_118;
--------------------
-- Initialize_119 --
--------------------
procedure Initialize_119 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 119, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 119, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 119,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0035'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 119, (False, AMF.CMOF.Public_Visibility));
end Initialize_119;
--------------------
-- Initialize_120 --
--------------------
procedure Initialize_120 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 120, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 120, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 120,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0089'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 120, (False, AMF.CMOF.Public_Visibility));
end Initialize_120;
--------------------
-- Initialize_121 --
--------------------
procedure Initialize_121 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 121, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 121, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 121,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0044'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 121, (False, AMF.CMOF.Public_Visibility));
end Initialize_121;
--------------------
-- Initialize_122 --
--------------------
procedure Initialize_122 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 122, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 122, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 122,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 122, (False, AMF.CMOF.Public_Visibility));
end Initialize_122;
--------------------
-- Initialize_123 --
--------------------
procedure Initialize_123 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 123, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 123, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 123,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0084'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 123, (False, AMF.CMOF.Public_Visibility));
end Initialize_123;
--------------------
-- Initialize_124 --
--------------------
procedure Initialize_124 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 124, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 124, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 124,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 124, (False, AMF.CMOF.Public_Visibility));
end Initialize_124;
--------------------
-- Initialize_125 --
--------------------
procedure Initialize_125 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 125, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 125, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 125,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 125, (False, AMF.CMOF.Public_Visibility));
end Initialize_125;
--------------------
-- Initialize_126 --
--------------------
procedure Initialize_126 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 126, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 126, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 126,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 126, (False, AMF.CMOF.Public_Visibility));
end Initialize_126;
--------------------
-- Initialize_127 --
--------------------
procedure Initialize_127 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 127, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 127, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 127,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 127, (False, AMF.CMOF.Public_Visibility));
end Initialize_127;
--------------------
-- Initialize_128 --
--------------------
procedure Initialize_128 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 128, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 128, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 128,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 128, (False, AMF.CMOF.Public_Visibility));
end Initialize_128;
--------------------
-- Initialize_129 --
--------------------
procedure Initialize_129 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 129,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0072'Access);
end Initialize_129;
--------------------
-- Initialize_130 --
--------------------
procedure Initialize_130 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 130,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0048'Access);
end Initialize_130;
--------------------
-- Initialize_131 --
--------------------
procedure Initialize_131 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 131,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 131, (Is_Empty => True));
end Initialize_131;
--------------------
-- Initialize_132 --
--------------------
procedure Initialize_132 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 132, (Is_Empty => True));
end Initialize_132;
--------------------
-- Initialize_133 --
--------------------
procedure Initialize_133 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 133,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002A'Access);
end Initialize_133;
--------------------
-- Initialize_134 --
--------------------
procedure Initialize_134 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 134,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 134, (Is_Empty => True));
end Initialize_134;
--------------------
-- Initialize_135 --
--------------------
procedure Initialize_135 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 135, (Is_Empty => True));
end Initialize_135;
--------------------
-- Initialize_136 --
--------------------
procedure Initialize_136 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 136,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008B'Access);
end Initialize_136;
--------------------
-- Initialize_137 --
--------------------
procedure Initialize_137 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 137,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001C'Access);
end Initialize_137;
--------------------
-- Initialize_138 --
--------------------
procedure Initialize_138 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 138,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000F'Access);
end Initialize_138;
--------------------
-- Initialize_139 --
--------------------
procedure Initialize_139 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 139,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0046'Access);
end Initialize_139;
--------------------
-- Initialize_140 --
--------------------
procedure Initialize_140 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 140,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0009'Access);
end Initialize_140;
--------------------
-- Initialize_141 --
--------------------
procedure Initialize_141 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 141,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0031'Access);
end Initialize_141;
--------------------
-- Initialize_142 --
--------------------
procedure Initialize_142 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 142,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0004'Access);
end Initialize_142;
--------------------
-- Initialize_143 --
--------------------
procedure Initialize_143 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 143,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0047'Access);
end Initialize_143;
--------------------
-- Initialize_144 --
--------------------
procedure Initialize_144 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 144,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0039'Access);
end Initialize_144;
--------------------
-- Initialize_145 --
--------------------
procedure Initialize_145 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 145,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0034'Access);
end Initialize_145;
--------------------
-- Initialize_146 --
--------------------
procedure Initialize_146 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 146,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0087'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 146, (Is_Empty => True));
end Initialize_146;
--------------------
-- Initialize_147 --
--------------------
procedure Initialize_147 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 147, (Is_Empty => True));
end Initialize_147;
--------------------
-- Initialize_148 --
--------------------
procedure Initialize_148 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 148,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0018'Access);
end Initialize_148;
--------------------
-- Initialize_149 --
--------------------
procedure Initialize_149 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 149,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 149, (Is_Empty => True));
end Initialize_149;
--------------------
-- Initialize_150 --
--------------------
procedure Initialize_150 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 150, (Is_Empty => True));
end Initialize_150;
--------------------
-- Initialize_151 --
--------------------
procedure Initialize_151 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 151,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0066'Access);
end Initialize_151;
--------------------
-- Initialize_152 --
--------------------
procedure Initialize_152 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 152,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 152, (Is_Empty => True));
end Initialize_152;
--------------------
-- Initialize_153 --
--------------------
procedure Initialize_153 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 153, (Is_Empty => True));
end Initialize_153;
--------------------
-- Initialize_154 --
--------------------
procedure Initialize_154 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 154,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006C'Access);
end Initialize_154;
--------------------
-- Initialize_155 --
--------------------
procedure Initialize_155 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 155,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0086'Access);
end Initialize_155;
--------------------
-- Initialize_156 --
--------------------
procedure Initialize_156 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 156,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0083'Access);
end Initialize_156;
--------------------
-- Initialize_157 --
--------------------
procedure Initialize_157 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 157,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003F'Access);
end Initialize_157;
--------------------
-- Initialize_158 --
--------------------
procedure Initialize_158 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 158,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0058'Access);
end Initialize_158;
--------------------
-- Initialize_159 --
--------------------
procedure Initialize_159 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 159,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 159, (Is_Empty => True));
end Initialize_159;
--------------------
-- Initialize_160 --
--------------------
procedure Initialize_160 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 160, (Is_Empty => True));
end Initialize_160;
--------------------
-- Initialize_161 --
--------------------
procedure Initialize_161 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 161,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0002'Access);
end Initialize_161;
--------------------
-- Initialize_162 --
--------------------
procedure Initialize_162 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 162,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003A'Access);
end Initialize_162;
--------------------
-- Initialize_163 --
--------------------
procedure Initialize_163 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 163,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007A'Access);
end Initialize_163;
--------------------
-- Initialize_164 --
--------------------
procedure Initialize_164 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 164,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0024'Access);
end Initialize_164;
--------------------
-- Initialize_165 --
--------------------
procedure Initialize_165 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 165,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 165, (Is_Empty => True));
end Initialize_165;
--------------------
-- Initialize_166 --
--------------------
procedure Initialize_166 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 166, (Is_Empty => True));
end Initialize_166;
--------------------
-- Initialize_167 --
--------------------
procedure Initialize_167 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 167,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002E'Access);
end Initialize_167;
--------------------
-- Initialize_168 --
--------------------
procedure Initialize_168 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 168,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005E'Access);
end Initialize_168;
--------------------
-- Initialize_169 --
--------------------
procedure Initialize_169 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 169,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_169;
--------------------
-- Initialize_170 --
--------------------
procedure Initialize_170 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 170,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 170, (Is_Empty => True));
end Initialize_170;
--------------------
-- Initialize_171 --
--------------------
procedure Initialize_171 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 171, (Is_Empty => True));
end Initialize_171;
--------------------
-- Initialize_172 --
--------------------
procedure Initialize_172 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 172,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0026'Access);
end Initialize_172;
--------------------
-- Initialize_173 --
--------------------
procedure Initialize_173 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 173,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0019'Access);
end Initialize_173;
--------------------
-- Initialize_174 --
--------------------
procedure Initialize_174 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 174,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_174;
--------------------
-- Initialize_175 --
--------------------
procedure Initialize_175 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 175,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 175, (Is_Empty => True));
end Initialize_175;
--------------------
-- Initialize_176 --
--------------------
procedure Initialize_176 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 176, (Is_Empty => True));
end Initialize_176;
--------------------
-- Initialize_177 --
--------------------
procedure Initialize_177 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 177,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0057'Access);
end Initialize_177;
--------------------
-- Initialize_178 --
--------------------
procedure Initialize_178 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 178,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0023'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 178, (Is_Empty => True));
end Initialize_178;
--------------------
-- Initialize_179 --
--------------------
procedure Initialize_179 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 179, (Is_Empty => True));
end Initialize_179;
--------------------
-- Initialize_180 --
--------------------
procedure Initialize_180 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Value
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
end Initialize_180;
end AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties;
|
13939
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.CMOF;
with AMF.Internals.Tables.CMOF_Attributes;
with AMF.Internals.Tables.Standard_Profile_L2_String_Data_00;
package body AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties is
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_1;
Initialize_2;
Initialize_3;
Initialize_4;
Initialize_5;
Initialize_6;
Initialize_7;
Initialize_8;
Initialize_9;
Initialize_10;
Initialize_11;
Initialize_12;
Initialize_13;
Initialize_14;
Initialize_15;
Initialize_16;
Initialize_17;
Initialize_18;
Initialize_19;
Initialize_20;
Initialize_21;
Initialize_22;
Initialize_23;
Initialize_24;
Initialize_25;
Initialize_26;
Initialize_27;
Initialize_28;
Initialize_29;
Initialize_30;
Initialize_31;
Initialize_32;
Initialize_33;
Initialize_34;
Initialize_35;
Initialize_36;
Initialize_37;
Initialize_38;
Initialize_39;
Initialize_40;
Initialize_41;
Initialize_42;
Initialize_43;
Initialize_44;
Initialize_45;
Initialize_46;
Initialize_47;
Initialize_48;
Initialize_49;
Initialize_50;
Initialize_51;
Initialize_52;
Initialize_53;
Initialize_54;
Initialize_55;
Initialize_56;
Initialize_57;
Initialize_58;
Initialize_59;
Initialize_60;
Initialize_61;
Initialize_62;
Initialize_63;
Initialize_64;
Initialize_65;
Initialize_66;
Initialize_67;
Initialize_68;
Initialize_69;
Initialize_70;
Initialize_71;
Initialize_72;
Initialize_73;
Initialize_74;
Initialize_75;
Initialize_76;
Initialize_77;
Initialize_78;
Initialize_79;
Initialize_80;
Initialize_81;
Initialize_82;
Initialize_83;
Initialize_84;
Initialize_85;
Initialize_86;
Initialize_87;
Initialize_88;
Initialize_89;
Initialize_90;
Initialize_91;
Initialize_92;
Initialize_93;
Initialize_94;
Initialize_95;
Initialize_96;
Initialize_97;
Initialize_98;
Initialize_99;
Initialize_100;
Initialize_101;
Initialize_102;
Initialize_103;
Initialize_104;
Initialize_105;
Initialize_106;
Initialize_107;
Initialize_108;
Initialize_109;
Initialize_110;
Initialize_111;
Initialize_112;
Initialize_113;
Initialize_114;
Initialize_115;
Initialize_116;
Initialize_117;
Initialize_118;
Initialize_119;
Initialize_120;
Initialize_121;
Initialize_122;
Initialize_123;
Initialize_124;
Initialize_125;
Initialize_126;
Initialize_127;
Initialize_128;
Initialize_129;
Initialize_130;
Initialize_131;
Initialize_132;
Initialize_133;
Initialize_134;
Initialize_135;
Initialize_136;
Initialize_137;
Initialize_138;
Initialize_139;
Initialize_140;
Initialize_141;
Initialize_142;
Initialize_143;
Initialize_144;
Initialize_145;
Initialize_146;
Initialize_147;
Initialize_148;
Initialize_149;
Initialize_150;
Initialize_151;
Initialize_152;
Initialize_153;
Initialize_154;
Initialize_155;
Initialize_156;
Initialize_157;
Initialize_158;
Initialize_159;
Initialize_160;
Initialize_161;
Initialize_162;
Initialize_163;
Initialize_164;
Initialize_165;
Initialize_166;
Initialize_167;
Initialize_168;
Initialize_169;
Initialize_170;
Initialize_171;
Initialize_172;
Initialize_173;
Initialize_174;
Initialize_175;
Initialize_176;
Initialize_177;
Initialize_178;
Initialize_179;
Initialize_180;
end Initialize;
------------------
-- Initialize_1 --
------------------
procedure Initialize_1 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 1,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0029'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 1, (Is_Empty => True));
end Initialize_1;
------------------
-- Initialize_2 --
------------------
procedure Initialize_2 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 2,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 2, (Is_Empty => True));
end Initialize_2;
------------------
-- Initialize_3 --
------------------
procedure Initialize_3 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 3,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 3, (Is_Empty => True));
end Initialize_3;
------------------
-- Initialize_4 --
------------------
procedure Initialize_4 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 4,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0088'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 4, (Is_Empty => True));
end Initialize_4;
------------------
-- Initialize_5 --
------------------
procedure Initialize_5 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 5,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 5, (Is_Empty => True));
end Initialize_5;
------------------
-- Initialize_6 --
------------------
procedure Initialize_6 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 6,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0013'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 6, (Is_Empty => True));
end Initialize_6;
------------------
-- Initialize_7 --
------------------
procedure Initialize_7 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 7,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0071'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 7, (Is_Empty => True));
end Initialize_7;
------------------
-- Initialize_8 --
------------------
procedure Initialize_8 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 8,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0003'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 8, (Is_Empty => True));
end Initialize_8;
------------------
-- Initialize_9 --
------------------
procedure Initialize_9 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 9, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 9,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0010'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 9, (Is_Empty => True));
end Initialize_9;
-------------------
-- Initialize_10 --
-------------------
procedure Initialize_10 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 10,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0076'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 10, (Is_Empty => True));
end Initialize_10;
-------------------
-- Initialize_11 --
-------------------
procedure Initialize_11 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 11,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0007'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 11, (Is_Empty => True));
end Initialize_11;
-------------------
-- Initialize_12 --
-------------------
procedure Initialize_12 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 12,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0036'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 12, (Is_Empty => True));
end Initialize_12;
-------------------
-- Initialize_13 --
-------------------
procedure Initialize_13 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 13,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0033'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 13, (Is_Empty => True));
end Initialize_13;
-------------------
-- Initialize_14 --
-------------------
procedure Initialize_14 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 14,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0079'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 14, (Is_Empty => True));
end Initialize_14;
-------------------
-- Initialize_15 --
-------------------
procedure Initialize_15 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 15,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0040'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 15, (Is_Empty => True));
end Initialize_15;
-------------------
-- Initialize_16 --
-------------------
procedure Initialize_16 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 16,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 16, (Is_Empty => True));
end Initialize_16;
-------------------
-- Initialize_17 --
-------------------
procedure Initialize_17 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 17,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0052'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 17, (Is_Empty => True));
end Initialize_17;
-------------------
-- Initialize_18 --
-------------------
procedure Initialize_18 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 18,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 18, (Is_Empty => True));
end Initialize_18;
-------------------
-- Initialize_19 --
-------------------
procedure Initialize_19 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 19,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 19, (Is_Empty => True));
end Initialize_19;
-------------------
-- Initialize_20 --
-------------------
procedure Initialize_20 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 20,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0082'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 20, (Is_Empty => True));
end Initialize_20;
-------------------
-- Initialize_21 --
-------------------
procedure Initialize_21 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 21,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0055'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 21, (Is_Empty => True));
end Initialize_21;
-------------------
-- Initialize_22 --
-------------------
procedure Initialize_22 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 22,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 22, (Is_Empty => True));
end Initialize_22;
-------------------
-- Initialize_23 --
-------------------
procedure Initialize_23 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 23,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0062'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 23, (Is_Empty => True));
end Initialize_23;
-------------------
-- Initialize_24 --
-------------------
procedure Initialize_24 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 24,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 24, (Is_Empty => True));
end Initialize_24;
-------------------
-- Initialize_25 --
-------------------
procedure Initialize_25 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 25,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 25, (Is_Empty => True));
end Initialize_25;
-------------------
-- Initialize_26 --
-------------------
procedure Initialize_26 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 26,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0014'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 26, (Is_Empty => True));
end Initialize_26;
-------------------
-- Initialize_27 --
-------------------
procedure Initialize_27 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 27,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0051'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 27, (Is_Empty => True));
end Initialize_27;
-------------------
-- Initialize_28 --
-------------------
procedure Initialize_28 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 28,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 28, (Is_Empty => True));
end Initialize_28;
-------------------
-- Initialize_29 --
-------------------
procedure Initialize_29 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 29,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 29, (Is_Empty => True));
end Initialize_29;
-------------------
-- Initialize_30 --
-------------------
procedure Initialize_30 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 30,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0022'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 30, (Is_Empty => True));
end Initialize_30;
-------------------
-- Initialize_31 --
-------------------
procedure Initialize_31 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 31,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 31, (False, AMF.CMOF.Public_Visibility));
end Initialize_31;
-------------------
-- Initialize_32 --
-------------------
procedure Initialize_32 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 32,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 32, (False, AMF.CMOF.Public_Visibility));
end Initialize_32;
-------------------
-- Initialize_33 --
-------------------
procedure Initialize_33 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 33,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 33, (False, AMF.CMOF.Public_Visibility));
end Initialize_33;
-------------------
-- Initialize_34 --
-------------------
procedure Initialize_34 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 34,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 34, (False, AMF.CMOF.Public_Visibility));
end Initialize_34;
-------------------
-- Initialize_35 --
-------------------
procedure Initialize_35 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 35,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 35, (False, AMF.CMOF.Public_Visibility));
end Initialize_35;
-------------------
-- Initialize_36 --
-------------------
procedure Initialize_36 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 36, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 36,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0015'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 36, (False, AMF.CMOF.Public_Visibility));
end Initialize_36;
-------------------
-- Initialize_37 --
-------------------
procedure Initialize_37 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 37,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 37, (False, AMF.CMOF.Public_Visibility));
end Initialize_37;
-------------------
-- Initialize_38 --
-------------------
procedure Initialize_38 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 38,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 38, (False, AMF.CMOF.Public_Visibility));
end Initialize_38;
-------------------
-- Initialize_39 --
-------------------
procedure Initialize_39 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 39,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 39, (False, AMF.CMOF.Public_Visibility));
end Initialize_39;
-------------------
-- Initialize_40 --
-------------------
procedure Initialize_40 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 40,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 40, (False, AMF.CMOF.Public_Visibility));
end Initialize_40;
-------------------
-- Initialize_41 --
-------------------
procedure Initialize_41 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 41,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 41, (False, AMF.CMOF.Public_Visibility));
end Initialize_41;
-------------------
-- Initialize_42 --
-------------------
procedure Initialize_42 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 42,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 42, (False, AMF.CMOF.Public_Visibility));
end Initialize_42;
-------------------
-- Initialize_43 --
-------------------
procedure Initialize_43 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 43,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 43, (False, AMF.CMOF.Public_Visibility));
end Initialize_43;
-------------------
-- Initialize_44 --
-------------------
procedure Initialize_44 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 44,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 44, (False, AMF.CMOF.Public_Visibility));
end Initialize_44;
-------------------
-- Initialize_45 --
-------------------
procedure Initialize_45 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 45,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 45, (False, AMF.CMOF.Public_Visibility));
end Initialize_45;
-------------------
-- Initialize_46 --
-------------------
procedure Initialize_46 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 46,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 46, (False, AMF.CMOF.Public_Visibility));
end Initialize_46;
-------------------
-- Initialize_47 --
-------------------
procedure Initialize_47 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 47,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 47, (False, AMF.CMOF.Public_Visibility));
end Initialize_47;
-------------------
-- Initialize_48 --
-------------------
procedure Initialize_48 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 48,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 48, (False, AMF.CMOF.Public_Visibility));
end Initialize_48;
-------------------
-- Initialize_49 --
-------------------
procedure Initialize_49 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 49,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 49, (False, AMF.CMOF.Public_Visibility));
end Initialize_49;
-------------------
-- Initialize_50 --
-------------------
procedure Initialize_50 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 50,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 50, (False, AMF.CMOF.Public_Visibility));
end Initialize_50;
-------------------
-- Initialize_51 --
-------------------
procedure Initialize_51 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 51,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 51, (False, AMF.CMOF.Public_Visibility));
end Initialize_51;
-------------------
-- Initialize_52 --
-------------------
procedure Initialize_52 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 52,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 52, (False, AMF.CMOF.Public_Visibility));
end Initialize_52;
-------------------
-- Initialize_53 --
-------------------
procedure Initialize_53 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 53,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 53, (False, AMF.CMOF.Public_Visibility));
end Initialize_53;
-------------------
-- Initialize_54 --
-------------------
procedure Initialize_54 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 54,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 54, (False, AMF.CMOF.Public_Visibility));
end Initialize_54;
-------------------
-- Initialize_55 --
-------------------
procedure Initialize_55 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 55,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 55, (False, AMF.CMOF.Public_Visibility));
end Initialize_55;
-------------------
-- Initialize_56 --
-------------------
procedure Initialize_56 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 56,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 56, (False, AMF.CMOF.Public_Visibility));
end Initialize_56;
-------------------
-- Initialize_57 --
-------------------
procedure Initialize_57 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 57,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 57, (False, AMF.CMOF.Public_Visibility));
end Initialize_57;
-------------------
-- Initialize_58 --
-------------------
procedure Initialize_58 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 58,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 58, (False, AMF.CMOF.Public_Visibility));
end Initialize_58;
-------------------
-- Initialize_59 --
-------------------
procedure Initialize_59 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 59,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 59, (False, AMF.CMOF.Public_Visibility));
end Initialize_59;
-------------------
-- Initialize_60 --
-------------------
procedure Initialize_60 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 60,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 60, (False, AMF.CMOF.Public_Visibility));
end Initialize_60;
-------------------
-- Initialize_61 --
-------------------
procedure Initialize_61 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 61,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 61, (False, AMF.CMOF.Public_Visibility));
end Initialize_61;
-------------------
-- Initialize_62 --
-------------------
procedure Initialize_62 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 62,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 62, (False, AMF.CMOF.Public_Visibility));
end Initialize_62;
-------------------
-- Initialize_63 --
-------------------
procedure Initialize_63 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 63,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0042'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 63, (Is_Empty => True));
end Initialize_63;
-------------------
-- Initialize_64 --
-------------------
procedure Initialize_64 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 64,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 64, (Is_Empty => True));
end Initialize_64;
-------------------
-- Initialize_65 --
-------------------
procedure Initialize_65 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 65,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 65, (Is_Empty => True));
end Initialize_65;
-------------------
-- Initialize_66 --
-------------------
procedure Initialize_66 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 66,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0017'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 66, (Is_Empty => True));
end Initialize_66;
-------------------
-- Initialize_67 --
-------------------
procedure Initialize_67 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 67,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 67, (Is_Empty => True));
end Initialize_67;
-------------------
-- Initialize_68 --
-------------------
procedure Initialize_68 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 68,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0020'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 68, (Is_Empty => True));
end Initialize_68;
-------------------
-- Initialize_69 --
-------------------
procedure Initialize_69 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 69,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0069'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 69, (Is_Empty => True));
end Initialize_69;
-------------------
-- Initialize_70 --
-------------------
procedure Initialize_70 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 70,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 70, (Is_Empty => True));
end Initialize_70;
-------------------
-- Initialize_71 --
-------------------
procedure Initialize_71 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 71,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0074'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 71, (Is_Empty => True));
end Initialize_71;
-------------------
-- Initialize_72 --
-------------------
procedure Initialize_72 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 72,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0032'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 72, (Is_Empty => True));
end Initialize_72;
-------------------
-- Initialize_73 --
-------------------
procedure Initialize_73 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 73,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 73, (Is_Empty => True));
end Initialize_73;
-------------------
-- Initialize_74 --
-------------------
procedure Initialize_74 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 74,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0063'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 74, (Is_Empty => True));
end Initialize_74;
-------------------
-- Initialize_75 --
-------------------
procedure Initialize_75 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 75,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0059'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 75, (Is_Empty => True));
end Initialize_75;
-------------------
-- Initialize_76 --
-------------------
procedure Initialize_76 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 76,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0070'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 76, (Is_Empty => True));
end Initialize_76;
-------------------
-- Initialize_77 --
-------------------
procedure Initialize_77 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 77,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0068'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 77, (Is_Empty => True));
end Initialize_77;
-------------------
-- Initialize_78 --
-------------------
procedure Initialize_78 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 78,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0006'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 78, (Is_Empty => True));
end Initialize_78;
-------------------
-- Initialize_79 --
-------------------
procedure Initialize_79 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 79,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0054'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 79, (Is_Empty => True));
end Initialize_79;
-------------------
-- Initialize_80 --
-------------------
procedure Initialize_80 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 80,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 80, (Is_Empty => True));
end Initialize_80;
-------------------
-- Initialize_81 --
-------------------
procedure Initialize_81 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 81,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 81, (Is_Empty => True));
end Initialize_81;
-------------------
-- Initialize_82 --
-------------------
procedure Initialize_82 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 82,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 82, (Is_Empty => True));
end Initialize_82;
-------------------
-- Initialize_83 --
-------------------
procedure Initialize_83 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 83,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0050'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 83, (Is_Empty => True));
end Initialize_83;
-------------------
-- Initialize_84 --
-------------------
procedure Initialize_84 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 84,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0028'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 84, (Is_Empty => True));
end Initialize_84;
-------------------
-- Initialize_85 --
-------------------
procedure Initialize_85 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 85,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 85, (Is_Empty => True));
end Initialize_85;
-------------------
-- Initialize_86 --
-------------------
procedure Initialize_86 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 86,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0077'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 86, (Is_Empty => True));
end Initialize_86;
-------------------
-- Initialize_87 --
-------------------
procedure Initialize_87 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 87,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0027'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 87, (Is_Empty => True));
end Initialize_87;
-------------------
-- Initialize_88 --
-------------------
procedure Initialize_88 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 88,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 88, (Is_Empty => True));
end Initialize_88;
-------------------
-- Initialize_89 --
-------------------
procedure Initialize_89 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 89,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 89, (Is_Empty => True));
end Initialize_89;
-------------------
-- Initialize_90 --
-------------------
procedure Initialize_90 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 90,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0038'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 90, (Is_Empty => True));
end Initialize_90;
-------------------
-- Initialize_91 --
-------------------
procedure Initialize_91 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 91,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0067'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 91, (Is_Empty => True));
end Initialize_91;
-------------------
-- Initialize_92 --
-------------------
procedure Initialize_92 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 92,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 92, (Is_Empty => True));
end Initialize_92;
-------------------
-- Initialize_93 --
-------------------
procedure Initialize_93 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 93,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0061'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 93, (Is_Empty => True));
end Initialize_93;
-------------------
-- Initialize_94 --
-------------------
procedure Initialize_94 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 94,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0030'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 94, (Is_Empty => True));
end Initialize_94;
-------------------
-- Initialize_95 --
-------------------
procedure Initialize_95 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Uri
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0049'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 95, (Is_Empty => True));
end Initialize_95;
-------------------
-- Initialize_96 --
-------------------
procedure Initialize_96 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 96, AMF.CMOF.Public_Visibility);
end Initialize_96;
-------------------
-- Initialize_97 --
-------------------
procedure Initialize_97 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 97, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 97, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 97,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 97, (False, AMF.CMOF.Public_Visibility));
end Initialize_97;
-------------------
-- Initialize_98 --
-------------------
procedure Initialize_98 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 98, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 98, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 98,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0073'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 98, (False, AMF.CMOF.Public_Visibility));
end Initialize_98;
-------------------
-- Initialize_99 --
-------------------
procedure Initialize_99 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 99, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 99, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 99,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0041'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 99, (False, AMF.CMOF.Public_Visibility));
end Initialize_99;
--------------------
-- Initialize_100 --
--------------------
procedure Initialize_100 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 100, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 100, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 100,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0008'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 100, (False, AMF.CMOF.Public_Visibility));
end Initialize_100;
--------------------
-- Initialize_101 --
--------------------
procedure Initialize_101 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 101, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 101, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 101,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0056'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 101, (False, AMF.CMOF.Public_Visibility));
end Initialize_101;
--------------------
-- Initialize_102 --
--------------------
procedure Initialize_102 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 102, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 102, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 102,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 102, (False, AMF.CMOF.Public_Visibility));
end Initialize_102;
--------------------
-- Initialize_103 --
--------------------
procedure Initialize_103 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 103, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 103, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 103,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0000'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 103, (False, AMF.CMOF.Public_Visibility));
end Initialize_103;
--------------------
-- Initialize_104 --
--------------------
procedure Initialize_104 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 104, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 104, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 104,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 104, (False, AMF.CMOF.Public_Visibility));
end Initialize_104;
--------------------
-- Initialize_105 --
--------------------
procedure Initialize_105 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 105, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 105, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 105,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0075'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 105, (False, AMF.CMOF.Public_Visibility));
end Initialize_105;
--------------------
-- Initialize_106 --
--------------------
procedure Initialize_106 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 106, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 106, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 106,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 106, (False, AMF.CMOF.Public_Visibility));
end Initialize_106;
--------------------
-- Initialize_107 --
--------------------
procedure Initialize_107 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 107, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 107, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 107,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 107, (False, AMF.CMOF.Public_Visibility));
end Initialize_107;
--------------------
-- Initialize_108 --
--------------------
procedure Initialize_108 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 108, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 108, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 108,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 108, (False, AMF.CMOF.Public_Visibility));
end Initialize_108;
--------------------
-- Initialize_109 --
--------------------
procedure Initialize_109 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 109, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 109, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 109,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0081'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 109, (False, AMF.CMOF.Public_Visibility));
end Initialize_109;
--------------------
-- Initialize_110 --
--------------------
procedure Initialize_110 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 110, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 110, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 110,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0001'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 110, (False, AMF.CMOF.Public_Visibility));
end Initialize_110;
--------------------
-- Initialize_111 --
--------------------
procedure Initialize_111 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 111, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 111, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 111,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0016'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 111, (False, AMF.CMOF.Public_Visibility));
end Initialize_111;
--------------------
-- Initialize_112 --
--------------------
procedure Initialize_112 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 112, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 112, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 112,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0005'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 112, (False, AMF.CMOF.Public_Visibility));
end Initialize_112;
--------------------
-- Initialize_113 --
--------------------
procedure Initialize_113 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 113, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 113, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 113,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0064'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 113, (False, AMF.CMOF.Public_Visibility));
end Initialize_113;
--------------------
-- Initialize_114 --
--------------------
procedure Initialize_114 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 114, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 114, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 114,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0080'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 114, (False, AMF.CMOF.Public_Visibility));
end Initialize_114;
--------------------
-- Initialize_115 --
--------------------
procedure Initialize_115 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 115, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 115, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 115,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0045'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 115, (False, AMF.CMOF.Public_Visibility));
end Initialize_115;
--------------------
-- Initialize_116 --
--------------------
procedure Initialize_116 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 116, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 116, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 116,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0065'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 116, (False, AMF.CMOF.Public_Visibility));
end Initialize_116;
--------------------
-- Initialize_117 --
--------------------
procedure Initialize_117 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 117, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 117, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 117,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0025'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 117, (False, AMF.CMOF.Public_Visibility));
end Initialize_117;
--------------------
-- Initialize_118 --
--------------------
procedure Initialize_118 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 118, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 118, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 118,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0012'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 118, (False, AMF.CMOF.Public_Visibility));
end Initialize_118;
--------------------
-- Initialize_119 --
--------------------
procedure Initialize_119 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 119, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 119, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 119,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0035'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 119, (False, AMF.CMOF.Public_Visibility));
end Initialize_119;
--------------------
-- Initialize_120 --
--------------------
procedure Initialize_120 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 120, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 120, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 120,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0089'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 120, (False, AMF.CMOF.Public_Visibility));
end Initialize_120;
--------------------
-- Initialize_121 --
--------------------
procedure Initialize_121 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 121, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 121, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 121,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0044'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 121, (False, AMF.CMOF.Public_Visibility));
end Initialize_121;
--------------------
-- Initialize_122 --
--------------------
procedure Initialize_122 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 122, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 122, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 122,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 122, (False, AMF.CMOF.Public_Visibility));
end Initialize_122;
--------------------
-- Initialize_123 --
--------------------
procedure Initialize_123 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 123, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 123, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 123,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0084'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 123, (False, AMF.CMOF.Public_Visibility));
end Initialize_123;
--------------------
-- Initialize_124 --
--------------------
procedure Initialize_124 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 124, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 124, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 124,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 124, (False, AMF.CMOF.Public_Visibility));
end Initialize_124;
--------------------
-- Initialize_125 --
--------------------
procedure Initialize_125 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 125, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 125, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 125,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 125, (False, AMF.CMOF.Public_Visibility));
end Initialize_125;
--------------------
-- Initialize_126 --
--------------------
procedure Initialize_126 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 126, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 126, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 126,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 126, (False, AMF.CMOF.Public_Visibility));
end Initialize_126;
--------------------
-- Initialize_127 --
--------------------
procedure Initialize_127 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 127, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 127, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 127,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 127, (False, AMF.CMOF.Public_Visibility));
end Initialize_127;
--------------------
-- Initialize_128 --
--------------------
procedure Initialize_128 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 128, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 128, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 128,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 128, (False, AMF.CMOF.Public_Visibility));
end Initialize_128;
--------------------
-- Initialize_129 --
--------------------
procedure Initialize_129 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 129,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0072'Access);
end Initialize_129;
--------------------
-- Initialize_130 --
--------------------
procedure Initialize_130 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 130,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0048'Access);
end Initialize_130;
--------------------
-- Initialize_131 --
--------------------
procedure Initialize_131 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 131,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 131, (Is_Empty => True));
end Initialize_131;
--------------------
-- Initialize_132 --
--------------------
procedure Initialize_132 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 132, (Is_Empty => True));
end Initialize_132;
--------------------
-- Initialize_133 --
--------------------
procedure Initialize_133 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 133,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002A'Access);
end Initialize_133;
--------------------
-- Initialize_134 --
--------------------
procedure Initialize_134 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 134,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 134, (Is_Empty => True));
end Initialize_134;
--------------------
-- Initialize_135 --
--------------------
procedure Initialize_135 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 135, (Is_Empty => True));
end Initialize_135;
--------------------
-- Initialize_136 --
--------------------
procedure Initialize_136 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 136,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008B'Access);
end Initialize_136;
--------------------
-- Initialize_137 --
--------------------
procedure Initialize_137 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 137,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001C'Access);
end Initialize_137;
--------------------
-- Initialize_138 --
--------------------
procedure Initialize_138 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 138,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000F'Access);
end Initialize_138;
--------------------
-- Initialize_139 --
--------------------
procedure Initialize_139 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 139,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0046'Access);
end Initialize_139;
--------------------
-- Initialize_140 --
--------------------
procedure Initialize_140 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 140,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0009'Access);
end Initialize_140;
--------------------
-- Initialize_141 --
--------------------
procedure Initialize_141 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 141,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0031'Access);
end Initialize_141;
--------------------
-- Initialize_142 --
--------------------
procedure Initialize_142 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 142,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0004'Access);
end Initialize_142;
--------------------
-- Initialize_143 --
--------------------
procedure Initialize_143 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 143,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0047'Access);
end Initialize_143;
--------------------
-- Initialize_144 --
--------------------
procedure Initialize_144 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 144,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0039'Access);
end Initialize_144;
--------------------
-- Initialize_145 --
--------------------
procedure Initialize_145 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 145,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0034'Access);
end Initialize_145;
--------------------
-- Initialize_146 --
--------------------
procedure Initialize_146 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 146,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0087'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 146, (Is_Empty => True));
end Initialize_146;
--------------------
-- Initialize_147 --
--------------------
procedure Initialize_147 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 147, (Is_Empty => True));
end Initialize_147;
--------------------
-- Initialize_148 --
--------------------
procedure Initialize_148 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 148,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0018'Access);
end Initialize_148;
--------------------
-- Initialize_149 --
--------------------
procedure Initialize_149 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 149,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 149, (Is_Empty => True));
end Initialize_149;
--------------------
-- Initialize_150 --
--------------------
procedure Initialize_150 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 150, (Is_Empty => True));
end Initialize_150;
--------------------
-- Initialize_151 --
--------------------
procedure Initialize_151 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 151,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0066'Access);
end Initialize_151;
--------------------
-- Initialize_152 --
--------------------
procedure Initialize_152 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 152,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 152, (Is_Empty => True));
end Initialize_152;
--------------------
-- Initialize_153 --
--------------------
procedure Initialize_153 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 153, (Is_Empty => True));
end Initialize_153;
--------------------
-- Initialize_154 --
--------------------
procedure Initialize_154 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 154,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006C'Access);
end Initialize_154;
--------------------
-- Initialize_155 --
--------------------
procedure Initialize_155 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 155,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0086'Access);
end Initialize_155;
--------------------
-- Initialize_156 --
--------------------
procedure Initialize_156 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 156,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0083'Access);
end Initialize_156;
--------------------
-- Initialize_157 --
--------------------
procedure Initialize_157 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 157,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003F'Access);
end Initialize_157;
--------------------
-- Initialize_158 --
--------------------
procedure Initialize_158 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 158,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0058'Access);
end Initialize_158;
--------------------
-- Initialize_159 --
--------------------
procedure Initialize_159 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 159,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 159, (Is_Empty => True));
end Initialize_159;
--------------------
-- Initialize_160 --
--------------------
procedure Initialize_160 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 160, (Is_Empty => True));
end Initialize_160;
--------------------
-- Initialize_161 --
--------------------
procedure Initialize_161 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 161,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0002'Access);
end Initialize_161;
--------------------
-- Initialize_162 --
--------------------
procedure Initialize_162 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 162,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003A'Access);
end Initialize_162;
--------------------
-- Initialize_163 --
--------------------
procedure Initialize_163 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 163,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007A'Access);
end Initialize_163;
--------------------
-- Initialize_164 --
--------------------
procedure Initialize_164 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 164,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0024'Access);
end Initialize_164;
--------------------
-- Initialize_165 --
--------------------
procedure Initialize_165 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 165,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 165, (Is_Empty => True));
end Initialize_165;
--------------------
-- Initialize_166 --
--------------------
procedure Initialize_166 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 166, (Is_Empty => True));
end Initialize_166;
--------------------
-- Initialize_167 --
--------------------
procedure Initialize_167 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 167,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002E'Access);
end Initialize_167;
--------------------
-- Initialize_168 --
--------------------
procedure Initialize_168 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 168,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005E'Access);
end Initialize_168;
--------------------
-- Initialize_169 --
--------------------
procedure Initialize_169 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 169,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_169;
--------------------
-- Initialize_170 --
--------------------
procedure Initialize_170 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 170,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 170, (Is_Empty => True));
end Initialize_170;
--------------------
-- Initialize_171 --
--------------------
procedure Initialize_171 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 171, (Is_Empty => True));
end Initialize_171;
--------------------
-- Initialize_172 --
--------------------
procedure Initialize_172 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 172,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0026'Access);
end Initialize_172;
--------------------
-- Initialize_173 --
--------------------
procedure Initialize_173 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 173,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0019'Access);
end Initialize_173;
--------------------
-- Initialize_174 --
--------------------
procedure Initialize_174 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 174,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_174;
--------------------
-- Initialize_175 --
--------------------
procedure Initialize_175 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 175,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 175, (Is_Empty => True));
end Initialize_175;
--------------------
-- Initialize_176 --
--------------------
procedure Initialize_176 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 176, (Is_Empty => True));
end Initialize_176;
--------------------
-- Initialize_177 --
--------------------
procedure Initialize_177 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 177,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0057'Access);
end Initialize_177;
--------------------
-- Initialize_178 --
--------------------
procedure Initialize_178 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 178,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0023'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 178, (Is_Empty => True));
end Initialize_178;
--------------------
-- Initialize_179 --
--------------------
procedure Initialize_179 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 179, (Is_Empty => True));
end Initialize_179;
--------------------
-- Initialize_180 --
--------------------
procedure Initialize_180 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Value
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
end Initialize_180;
end AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.CMOF;
with AMF.Internals.Tables.CMOF_Attributes;
with AMF.Internals.Tables.Standard_Profile_L2_String_Data_00;
package body AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties is
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_1;
Initialize_2;
Initialize_3;
Initialize_4;
Initialize_5;
Initialize_6;
Initialize_7;
Initialize_8;
Initialize_9;
Initialize_10;
Initialize_11;
Initialize_12;
Initialize_13;
Initialize_14;
Initialize_15;
Initialize_16;
Initialize_17;
Initialize_18;
Initialize_19;
Initialize_20;
Initialize_21;
Initialize_22;
Initialize_23;
Initialize_24;
Initialize_25;
Initialize_26;
Initialize_27;
Initialize_28;
Initialize_29;
Initialize_30;
Initialize_31;
Initialize_32;
Initialize_33;
Initialize_34;
Initialize_35;
Initialize_36;
Initialize_37;
Initialize_38;
Initialize_39;
Initialize_40;
Initialize_41;
Initialize_42;
Initialize_43;
Initialize_44;
Initialize_45;
Initialize_46;
Initialize_47;
Initialize_48;
Initialize_49;
Initialize_50;
Initialize_51;
Initialize_52;
Initialize_53;
Initialize_54;
Initialize_55;
Initialize_56;
Initialize_57;
Initialize_58;
Initialize_59;
Initialize_60;
Initialize_61;
Initialize_62;
Initialize_63;
Initialize_64;
Initialize_65;
Initialize_66;
Initialize_67;
Initialize_68;
Initialize_69;
Initialize_70;
Initialize_71;
Initialize_72;
Initialize_73;
Initialize_74;
Initialize_75;
Initialize_76;
Initialize_77;
Initialize_78;
Initialize_79;
Initialize_80;
Initialize_81;
Initialize_82;
Initialize_83;
Initialize_84;
Initialize_85;
Initialize_86;
Initialize_87;
Initialize_88;
Initialize_89;
Initialize_90;
Initialize_91;
Initialize_92;
Initialize_93;
Initialize_94;
Initialize_95;
Initialize_96;
Initialize_97;
Initialize_98;
Initialize_99;
Initialize_100;
Initialize_101;
Initialize_102;
Initialize_103;
Initialize_104;
Initialize_105;
Initialize_106;
Initialize_107;
Initialize_108;
Initialize_109;
Initialize_110;
Initialize_111;
Initialize_112;
Initialize_113;
Initialize_114;
Initialize_115;
Initialize_116;
Initialize_117;
Initialize_118;
Initialize_119;
Initialize_120;
Initialize_121;
Initialize_122;
Initialize_123;
Initialize_124;
Initialize_125;
Initialize_126;
Initialize_127;
Initialize_128;
Initialize_129;
Initialize_130;
Initialize_131;
Initialize_132;
Initialize_133;
Initialize_134;
Initialize_135;
Initialize_136;
Initialize_137;
Initialize_138;
Initialize_139;
Initialize_140;
Initialize_141;
Initialize_142;
Initialize_143;
Initialize_144;
Initialize_145;
Initialize_146;
Initialize_147;
Initialize_148;
Initialize_149;
Initialize_150;
Initialize_151;
Initialize_152;
Initialize_153;
Initialize_154;
Initialize_155;
Initialize_156;
Initialize_157;
Initialize_158;
Initialize_159;
Initialize_160;
Initialize_161;
Initialize_162;
Initialize_163;
Initialize_164;
Initialize_165;
Initialize_166;
Initialize_167;
Initialize_168;
Initialize_169;
Initialize_170;
Initialize_171;
Initialize_172;
Initialize_173;
Initialize_174;
Initialize_175;
Initialize_176;
Initialize_177;
Initialize_178;
Initialize_179;
Initialize_180;
end Initialize;
------------------
-- Initialize_1 --
------------------
procedure Initialize_1 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 1,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0029'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 1, (Is_Empty => True));
end Initialize_1;
------------------
-- Initialize_2 --
------------------
procedure Initialize_2 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 2,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 2, (Is_Empty => True));
end Initialize_2;
------------------
-- Initialize_3 --
------------------
procedure Initialize_3 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 3,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 3, (Is_Empty => True));
end Initialize_3;
------------------
-- Initialize_4 --
------------------
procedure Initialize_4 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 4,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0088'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 4, (Is_Empty => True));
end Initialize_4;
------------------
-- Initialize_5 --
------------------
procedure Initialize_5 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 5,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 5, (Is_Empty => True));
end Initialize_5;
------------------
-- Initialize_6 --
------------------
procedure Initialize_6 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 6,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0013'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 6, (Is_Empty => True));
end Initialize_6;
------------------
-- Initialize_7 --
------------------
procedure Initialize_7 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 7,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0071'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 7, (Is_Empty => True));
end Initialize_7;
------------------
-- Initialize_8 --
------------------
procedure Initialize_8 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 8,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0003'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 8, (Is_Empty => True));
end Initialize_8;
------------------
-- Initialize_9 --
------------------
procedure Initialize_9 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 9, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 9,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0010'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 9, (Is_Empty => True));
end Initialize_9;
-------------------
-- Initialize_10 --
-------------------
procedure Initialize_10 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 10,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0076'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 10, (Is_Empty => True));
end Initialize_10;
-------------------
-- Initialize_11 --
-------------------
procedure Initialize_11 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 11,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0007'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 11, (Is_Empty => True));
end Initialize_11;
-------------------
-- Initialize_12 --
-------------------
procedure Initialize_12 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 12,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0036'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 12, (Is_Empty => True));
end Initialize_12;
-------------------
-- Initialize_13 --
-------------------
procedure Initialize_13 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 13,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0033'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 13, (Is_Empty => True));
end Initialize_13;
-------------------
-- Initialize_14 --
-------------------
procedure Initialize_14 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 14,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0079'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 14, (Is_Empty => True));
end Initialize_14;
-------------------
-- Initialize_15 --
-------------------
procedure Initialize_15 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 15,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0040'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 15, (Is_Empty => True));
end Initialize_15;
-------------------
-- Initialize_16 --
-------------------
procedure Initialize_16 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 16,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 16, (Is_Empty => True));
end Initialize_16;
-------------------
-- Initialize_17 --
-------------------
procedure Initialize_17 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 17,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0052'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 17, (Is_Empty => True));
end Initialize_17;
-------------------
-- Initialize_18 --
-------------------
procedure Initialize_18 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 18,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 18, (Is_Empty => True));
end Initialize_18;
-------------------
-- Initialize_19 --
-------------------
procedure Initialize_19 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 19,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 19, (Is_Empty => True));
end Initialize_19;
-------------------
-- Initialize_20 --
-------------------
procedure Initialize_20 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 20,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0082'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 20, (Is_Empty => True));
end Initialize_20;
-------------------
-- Initialize_21 --
-------------------
procedure Initialize_21 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 21,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0055'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 21, (Is_Empty => True));
end Initialize_21;
-------------------
-- Initialize_22 --
-------------------
procedure Initialize_22 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 22,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 22, (Is_Empty => True));
end Initialize_22;
-------------------
-- Initialize_23 --
-------------------
procedure Initialize_23 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 23,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0062'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 23, (Is_Empty => True));
end Initialize_23;
-------------------
-- Initialize_24 --
-------------------
procedure Initialize_24 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 24,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 24, (Is_Empty => True));
end Initialize_24;
-------------------
-- Initialize_25 --
-------------------
procedure Initialize_25 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 25,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 25, (Is_Empty => True));
end Initialize_25;
-------------------
-- Initialize_26 --
-------------------
procedure Initialize_26 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 26,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0014'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 26, (Is_Empty => True));
end Initialize_26;
-------------------
-- Initialize_27 --
-------------------
procedure Initialize_27 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 27,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0051'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 27, (Is_Empty => True));
end Initialize_27;
-------------------
-- Initialize_28 --
-------------------
procedure Initialize_28 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 28,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 28, (Is_Empty => True));
end Initialize_28;
-------------------
-- Initialize_29 --
-------------------
procedure Initialize_29 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 29,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 29, (Is_Empty => True));
end Initialize_29;
-------------------
-- Initialize_30 --
-------------------
procedure Initialize_30 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 30,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0022'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 30, (Is_Empty => True));
end Initialize_30;
-------------------
-- Initialize_31 --
-------------------
procedure Initialize_31 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 31,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 31, (False, AMF.CMOF.Public_Visibility));
end Initialize_31;
-------------------
-- Initialize_32 --
-------------------
procedure Initialize_32 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 32,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 32, (False, AMF.CMOF.Public_Visibility));
end Initialize_32;
-------------------
-- Initialize_33 --
-------------------
procedure Initialize_33 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 33,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 33, (False, AMF.CMOF.Public_Visibility));
end Initialize_33;
-------------------
-- Initialize_34 --
-------------------
procedure Initialize_34 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 34,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 34, (False, AMF.CMOF.Public_Visibility));
end Initialize_34;
-------------------
-- Initialize_35 --
-------------------
procedure Initialize_35 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 35,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 35, (False, AMF.CMOF.Public_Visibility));
end Initialize_35;
-------------------
-- Initialize_36 --
-------------------
procedure Initialize_36 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 36, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 36,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0015'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 36, (False, AMF.CMOF.Public_Visibility));
end Initialize_36;
-------------------
-- Initialize_37 --
-------------------
procedure Initialize_37 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 37,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0085'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 37, (False, AMF.CMOF.Public_Visibility));
end Initialize_37;
-------------------
-- Initialize_38 --
-------------------
procedure Initialize_38 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 38,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 38, (False, AMF.CMOF.Public_Visibility));
end Initialize_38;
-------------------
-- Initialize_39 --
-------------------
procedure Initialize_39 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 39,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 39, (False, AMF.CMOF.Public_Visibility));
end Initialize_39;
-------------------
-- Initialize_40 --
-------------------
procedure Initialize_40 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 40,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 40, (False, AMF.CMOF.Public_Visibility));
end Initialize_40;
-------------------
-- Initialize_41 --
-------------------
procedure Initialize_41 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 41,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 41, (False, AMF.CMOF.Public_Visibility));
end Initialize_41;
-------------------
-- Initialize_42 --
-------------------
procedure Initialize_42 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 42,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 42, (False, AMF.CMOF.Public_Visibility));
end Initialize_42;
-------------------
-- Initialize_43 --
-------------------
procedure Initialize_43 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 43,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 43, (False, AMF.CMOF.Public_Visibility));
end Initialize_43;
-------------------
-- Initialize_44 --
-------------------
procedure Initialize_44 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 44,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 44, (False, AMF.CMOF.Public_Visibility));
end Initialize_44;
-------------------
-- Initialize_45 --
-------------------
procedure Initialize_45 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 45,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 45, (False, AMF.CMOF.Public_Visibility));
end Initialize_45;
-------------------
-- Initialize_46 --
-------------------
procedure Initialize_46 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 46,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 46, (False, AMF.CMOF.Public_Visibility));
end Initialize_46;
-------------------
-- Initialize_47 --
-------------------
procedure Initialize_47 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 47,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 47, (False, AMF.CMOF.Public_Visibility));
end Initialize_47;
-------------------
-- Initialize_48 --
-------------------
procedure Initialize_48 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 48,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 48, (False, AMF.CMOF.Public_Visibility));
end Initialize_48;
-------------------
-- Initialize_49 --
-------------------
procedure Initialize_49 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 49,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 49, (False, AMF.CMOF.Public_Visibility));
end Initialize_49;
-------------------
-- Initialize_50 --
-------------------
procedure Initialize_50 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 50,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 50, (False, AMF.CMOF.Public_Visibility));
end Initialize_50;
-------------------
-- Initialize_51 --
-------------------
procedure Initialize_51 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 51,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 51, (False, AMF.CMOF.Public_Visibility));
end Initialize_51;
-------------------
-- Initialize_52 --
-------------------
procedure Initialize_52 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 52,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 52, (False, AMF.CMOF.Public_Visibility));
end Initialize_52;
-------------------
-- Initialize_53 --
-------------------
procedure Initialize_53 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 53,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 53, (False, AMF.CMOF.Public_Visibility));
end Initialize_53;
-------------------
-- Initialize_54 --
-------------------
procedure Initialize_54 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 54,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 54, (False, AMF.CMOF.Public_Visibility));
end Initialize_54;
-------------------
-- Initialize_55 --
-------------------
procedure Initialize_55 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 55,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 55, (False, AMF.CMOF.Public_Visibility));
end Initialize_55;
-------------------
-- Initialize_56 --
-------------------
procedure Initialize_56 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 56,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 56, (False, AMF.CMOF.Public_Visibility));
end Initialize_56;
-------------------
-- Initialize_57 --
-------------------
procedure Initialize_57 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 57,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0011'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 57, (False, AMF.CMOF.Public_Visibility));
end Initialize_57;
-------------------
-- Initialize_58 --
-------------------
procedure Initialize_58 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 58,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0043'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 58, (False, AMF.CMOF.Public_Visibility));
end Initialize_58;
-------------------
-- Initialize_59 --
-------------------
procedure Initialize_59 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 59,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0037'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 59, (False, AMF.CMOF.Public_Visibility));
end Initialize_59;
-------------------
-- Initialize_60 --
-------------------
procedure Initialize_60 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 60,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0078'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 60, (False, AMF.CMOF.Public_Visibility));
end Initialize_60;
-------------------
-- Initialize_61 --
-------------------
procedure Initialize_61 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 61,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 61, (False, AMF.CMOF.Public_Visibility));
end Initialize_61;
-------------------
-- Initialize_62 --
-------------------
procedure Initialize_62 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 62,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 62, (False, AMF.CMOF.Public_Visibility));
end Initialize_62;
-------------------
-- Initialize_63 --
-------------------
procedure Initialize_63 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 63,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0042'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 63, (Is_Empty => True));
end Initialize_63;
-------------------
-- Initialize_64 --
-------------------
procedure Initialize_64 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 64,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 64, (Is_Empty => True));
end Initialize_64;
-------------------
-- Initialize_65 --
-------------------
procedure Initialize_65 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 65,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 65, (Is_Empty => True));
end Initialize_65;
-------------------
-- Initialize_66 --
-------------------
procedure Initialize_66 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 66,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0017'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 66, (Is_Empty => True));
end Initialize_66;
-------------------
-- Initialize_67 --
-------------------
procedure Initialize_67 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 67,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 67, (Is_Empty => True));
end Initialize_67;
-------------------
-- Initialize_68 --
-------------------
procedure Initialize_68 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 68,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0020'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 68, (Is_Empty => True));
end Initialize_68;
-------------------
-- Initialize_69 --
-------------------
procedure Initialize_69 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 69,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0069'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 69, (Is_Empty => True));
end Initialize_69;
-------------------
-- Initialize_70 --
-------------------
procedure Initialize_70 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 70,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 70, (Is_Empty => True));
end Initialize_70;
-------------------
-- Initialize_71 --
-------------------
procedure Initialize_71 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 71,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0074'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 71, (Is_Empty => True));
end Initialize_71;
-------------------
-- Initialize_72 --
-------------------
procedure Initialize_72 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 72,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0032'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 72, (Is_Empty => True));
end Initialize_72;
-------------------
-- Initialize_73 --
-------------------
procedure Initialize_73 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 73,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 73, (Is_Empty => True));
end Initialize_73;
-------------------
-- Initialize_74 --
-------------------
procedure Initialize_74 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 74,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0063'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 74, (Is_Empty => True));
end Initialize_74;
-------------------
-- Initialize_75 --
-------------------
procedure Initialize_75 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 75,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0059'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 75, (Is_Empty => True));
end Initialize_75;
-------------------
-- Initialize_76 --
-------------------
procedure Initialize_76 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 76,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0070'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 76, (Is_Empty => True));
end Initialize_76;
-------------------
-- Initialize_77 --
-------------------
procedure Initialize_77 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 77,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0068'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 77, (Is_Empty => True));
end Initialize_77;
-------------------
-- Initialize_78 --
-------------------
procedure Initialize_78 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 78,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0006'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 78, (Is_Empty => True));
end Initialize_78;
-------------------
-- Initialize_79 --
-------------------
procedure Initialize_79 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 79,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0054'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 79, (Is_Empty => True));
end Initialize_79;
-------------------
-- Initialize_80 --
-------------------
procedure Initialize_80 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 80,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 80, (Is_Empty => True));
end Initialize_80;
-------------------
-- Initialize_81 --
-------------------
procedure Initialize_81 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 81,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 81, (Is_Empty => True));
end Initialize_81;
-------------------
-- Initialize_82 --
-------------------
procedure Initialize_82 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 82,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 82, (Is_Empty => True));
end Initialize_82;
-------------------
-- Initialize_83 --
-------------------
procedure Initialize_83 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 83,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0050'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 83, (Is_Empty => True));
end Initialize_83;
-------------------
-- Initialize_84 --
-------------------
procedure Initialize_84 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 84,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0028'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 84, (Is_Empty => True));
end Initialize_84;
-------------------
-- Initialize_85 --
-------------------
procedure Initialize_85 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 85,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 85, (Is_Empty => True));
end Initialize_85;
-------------------
-- Initialize_86 --
-------------------
procedure Initialize_86 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 86,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0077'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 86, (Is_Empty => True));
end Initialize_86;
-------------------
-- Initialize_87 --
-------------------
procedure Initialize_87 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 87,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0027'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 87, (Is_Empty => True));
end Initialize_87;
-------------------
-- Initialize_88 --
-------------------
procedure Initialize_88 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 88,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 88, (Is_Empty => True));
end Initialize_88;
-------------------
-- Initialize_89 --
-------------------
procedure Initialize_89 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 89,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 89, (Is_Empty => True));
end Initialize_89;
-------------------
-- Initialize_90 --
-------------------
procedure Initialize_90 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 90,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0038'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 90, (Is_Empty => True));
end Initialize_90;
-------------------
-- Initialize_91 --
-------------------
procedure Initialize_91 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 91,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0067'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 91, (Is_Empty => True));
end Initialize_91;
-------------------
-- Initialize_92 --
-------------------
procedure Initialize_92 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 92,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 92, (Is_Empty => True));
end Initialize_92;
-------------------
-- Initialize_93 --
-------------------
procedure Initialize_93 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 93,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0061'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 93, (Is_Empty => True));
end Initialize_93;
-------------------
-- Initialize_94 --
-------------------
procedure Initialize_94 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 94,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0030'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 94, (Is_Empty => True));
end Initialize_94;
-------------------
-- Initialize_95 --
-------------------
procedure Initialize_95 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Uri
(Base + 95,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0049'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 95, (Is_Empty => True));
end Initialize_95;
-------------------
-- Initialize_96 --
-------------------
procedure Initialize_96 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 96, AMF.CMOF.Public_Visibility);
end Initialize_96;
-------------------
-- Initialize_97 --
-------------------
procedure Initialize_97 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 97, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 97, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 97,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 97, (False, AMF.CMOF.Public_Visibility));
end Initialize_97;
-------------------
-- Initialize_98 --
-------------------
procedure Initialize_98 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 98, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 98, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 98,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0073'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 98, (False, AMF.CMOF.Public_Visibility));
end Initialize_98;
-------------------
-- Initialize_99 --
-------------------
procedure Initialize_99 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 99, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 99, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 99,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0041'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 99, (False, AMF.CMOF.Public_Visibility));
end Initialize_99;
--------------------
-- Initialize_100 --
--------------------
procedure Initialize_100 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 100, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 100, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 100,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0008'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 100, (False, AMF.CMOF.Public_Visibility));
end Initialize_100;
--------------------
-- Initialize_101 --
--------------------
procedure Initialize_101 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 101, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 101, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 101,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0056'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 101, (False, AMF.CMOF.Public_Visibility));
end Initialize_101;
--------------------
-- Initialize_102 --
--------------------
procedure Initialize_102 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 102, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 102, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 102,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 102, (False, AMF.CMOF.Public_Visibility));
end Initialize_102;
--------------------
-- Initialize_103 --
--------------------
procedure Initialize_103 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 103, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 103, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 103,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0000'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 103, (False, AMF.CMOF.Public_Visibility));
end Initialize_103;
--------------------
-- Initialize_104 --
--------------------
procedure Initialize_104 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 104, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 104, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 104,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 104, (False, AMF.CMOF.Public_Visibility));
end Initialize_104;
--------------------
-- Initialize_105 --
--------------------
procedure Initialize_105 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 105, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 105, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 105,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0075'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 105, (False, AMF.CMOF.Public_Visibility));
end Initialize_105;
--------------------
-- Initialize_106 --
--------------------
procedure Initialize_106 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 106, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 106, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 106,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 106, (False, AMF.CMOF.Public_Visibility));
end Initialize_106;
--------------------
-- Initialize_107 --
--------------------
procedure Initialize_107 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 107, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 107, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 107,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 107, (False, AMF.CMOF.Public_Visibility));
end Initialize_107;
--------------------
-- Initialize_108 --
--------------------
procedure Initialize_108 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 108, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 108, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 108,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 108, (False, AMF.CMOF.Public_Visibility));
end Initialize_108;
--------------------
-- Initialize_109 --
--------------------
procedure Initialize_109 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 109, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 109, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 109,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0081'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 109, (False, AMF.CMOF.Public_Visibility));
end Initialize_109;
--------------------
-- Initialize_110 --
--------------------
procedure Initialize_110 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 110, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 110, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 110,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0001'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 110, (False, AMF.CMOF.Public_Visibility));
end Initialize_110;
--------------------
-- Initialize_111 --
--------------------
procedure Initialize_111 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 111, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 111, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 111,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0016'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 111, (False, AMF.CMOF.Public_Visibility));
end Initialize_111;
--------------------
-- Initialize_112 --
--------------------
procedure Initialize_112 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 112, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 112, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 112,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0005'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 112, (False, AMF.CMOF.Public_Visibility));
end Initialize_112;
--------------------
-- Initialize_113 --
--------------------
procedure Initialize_113 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 113, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 113, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 113,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0064'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 113, (False, AMF.CMOF.Public_Visibility));
end Initialize_113;
--------------------
-- Initialize_114 --
--------------------
procedure Initialize_114 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 114, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 114, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 114,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0080'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 114, (False, AMF.CMOF.Public_Visibility));
end Initialize_114;
--------------------
-- Initialize_115 --
--------------------
procedure Initialize_115 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 115, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 115, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 115,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0045'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 115, (False, AMF.CMOF.Public_Visibility));
end Initialize_115;
--------------------
-- Initialize_116 --
--------------------
procedure Initialize_116 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 116, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 116, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 116,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0065'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 116, (False, AMF.CMOF.Public_Visibility));
end Initialize_116;
--------------------
-- Initialize_117 --
--------------------
procedure Initialize_117 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 117, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 117, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 117,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0025'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 117, (False, AMF.CMOF.Public_Visibility));
end Initialize_117;
--------------------
-- Initialize_118 --
--------------------
procedure Initialize_118 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 118, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 118, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 118,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0012'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 118, (False, AMF.CMOF.Public_Visibility));
end Initialize_118;
--------------------
-- Initialize_119 --
--------------------
procedure Initialize_119 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 119, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 119, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 119,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0035'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 119, (False, AMF.CMOF.Public_Visibility));
end Initialize_119;
--------------------
-- Initialize_120 --
--------------------
procedure Initialize_120 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 120, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 120, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 120,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0089'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 120, (False, AMF.CMOF.Public_Visibility));
end Initialize_120;
--------------------
-- Initialize_121 --
--------------------
procedure Initialize_121 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 121, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 121, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 121,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0044'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 121, (False, AMF.CMOF.Public_Visibility));
end Initialize_121;
--------------------
-- Initialize_122 --
--------------------
procedure Initialize_122 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 122, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 122, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 122,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 122, (False, AMF.CMOF.Public_Visibility));
end Initialize_122;
--------------------
-- Initialize_123 --
--------------------
procedure Initialize_123 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 123, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 123, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 123,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0084'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 123, (False, AMF.CMOF.Public_Visibility));
end Initialize_123;
--------------------
-- Initialize_124 --
--------------------
procedure Initialize_124 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 124, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 124, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 124,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 124, (False, AMF.CMOF.Public_Visibility));
end Initialize_124;
--------------------
-- Initialize_125 --
--------------------
procedure Initialize_125 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 125, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 125, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 125,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0060'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 125, (False, AMF.CMOF.Public_Visibility));
end Initialize_125;
--------------------
-- Initialize_126 --
--------------------
procedure Initialize_126 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 126, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 126, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 126,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 126, (False, AMF.CMOF.Public_Visibility));
end Initialize_126;
--------------------
-- Initialize_127 --
--------------------
procedure Initialize_127 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 127, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 127, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 127,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 127, (False, AMF.CMOF.Public_Visibility));
end Initialize_127;
--------------------
-- Initialize_128 --
--------------------
procedure Initialize_128 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 128, True);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 128, (False, 0));
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 128,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002B'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 128, (False, AMF.CMOF.Public_Visibility));
end Initialize_128;
--------------------
-- Initialize_129 --
--------------------
procedure Initialize_129 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 129,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0072'Access);
end Initialize_129;
--------------------
-- Initialize_130 --
--------------------
procedure Initialize_130 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 130,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0048'Access);
end Initialize_130;
--------------------
-- Initialize_131 --
--------------------
procedure Initialize_131 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 131,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_004D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 131, (Is_Empty => True));
end Initialize_131;
--------------------
-- Initialize_132 --
--------------------
procedure Initialize_132 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 132, (Is_Empty => True));
end Initialize_132;
--------------------
-- Initialize_133 --
--------------------
procedure Initialize_133 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 133,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002A'Access);
end Initialize_133;
--------------------
-- Initialize_134 --
--------------------
procedure Initialize_134 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 134,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 134, (Is_Empty => True));
end Initialize_134;
--------------------
-- Initialize_135 --
--------------------
procedure Initialize_135 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 135, (Is_Empty => True));
end Initialize_135;
--------------------
-- Initialize_136 --
--------------------
procedure Initialize_136 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 136,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008B'Access);
end Initialize_136;
--------------------
-- Initialize_137 --
--------------------
procedure Initialize_137 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 137,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_001C'Access);
end Initialize_137;
--------------------
-- Initialize_138 --
--------------------
procedure Initialize_138 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 138,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_000F'Access);
end Initialize_138;
--------------------
-- Initialize_139 --
--------------------
procedure Initialize_139 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 139,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0046'Access);
end Initialize_139;
--------------------
-- Initialize_140 --
--------------------
procedure Initialize_140 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 140,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0009'Access);
end Initialize_140;
--------------------
-- Initialize_141 --
--------------------
procedure Initialize_141 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 141,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0031'Access);
end Initialize_141;
--------------------
-- Initialize_142 --
--------------------
procedure Initialize_142 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 142,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0004'Access);
end Initialize_142;
--------------------
-- Initialize_143 --
--------------------
procedure Initialize_143 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 143,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0047'Access);
end Initialize_143;
--------------------
-- Initialize_144 --
--------------------
procedure Initialize_144 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 144,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0039'Access);
end Initialize_144;
--------------------
-- Initialize_145 --
--------------------
procedure Initialize_145 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 145,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0034'Access);
end Initialize_145;
--------------------
-- Initialize_146 --
--------------------
procedure Initialize_146 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 146,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0087'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 146, (Is_Empty => True));
end Initialize_146;
--------------------
-- Initialize_147 --
--------------------
procedure Initialize_147 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 147, (Is_Empty => True));
end Initialize_147;
--------------------
-- Initialize_148 --
--------------------
procedure Initialize_148 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 148,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0018'Access);
end Initialize_148;
--------------------
-- Initialize_149 --
--------------------
procedure Initialize_149 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 149,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_008E'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 149, (Is_Empty => True));
end Initialize_149;
--------------------
-- Initialize_150 --
--------------------
procedure Initialize_150 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 150, (Is_Empty => True));
end Initialize_150;
--------------------
-- Initialize_151 --
--------------------
procedure Initialize_151 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 151,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0066'Access);
end Initialize_151;
--------------------
-- Initialize_152 --
--------------------
procedure Initialize_152 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 152,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0053'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 152, (Is_Empty => True));
end Initialize_152;
--------------------
-- Initialize_153 --
--------------------
procedure Initialize_153 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 153, (Is_Empty => True));
end Initialize_153;
--------------------
-- Initialize_154 --
--------------------
procedure Initialize_154 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 154,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_006C'Access);
end Initialize_154;
--------------------
-- Initialize_155 --
--------------------
procedure Initialize_155 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 155,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0086'Access);
end Initialize_155;
--------------------
-- Initialize_156 --
--------------------
procedure Initialize_156 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 156,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0083'Access);
end Initialize_156;
--------------------
-- Initialize_157 --
--------------------
procedure Initialize_157 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 157,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003F'Access);
end Initialize_157;
--------------------
-- Initialize_158 --
--------------------
procedure Initialize_158 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 158,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0058'Access);
end Initialize_158;
--------------------
-- Initialize_159 --
--------------------
procedure Initialize_159 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 159,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005F'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 159, (Is_Empty => True));
end Initialize_159;
--------------------
-- Initialize_160 --
--------------------
procedure Initialize_160 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 160, (Is_Empty => True));
end Initialize_160;
--------------------
-- Initialize_161 --
--------------------
procedure Initialize_161 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 161,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0002'Access);
end Initialize_161;
--------------------
-- Initialize_162 --
--------------------
procedure Initialize_162 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 162,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003A'Access);
end Initialize_162;
--------------------
-- Initialize_163 --
--------------------
procedure Initialize_163 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 163,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007A'Access);
end Initialize_163;
--------------------
-- Initialize_164 --
--------------------
procedure Initialize_164 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 164,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0024'Access);
end Initialize_164;
--------------------
-- Initialize_165 --
--------------------
procedure Initialize_165 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 165,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002D'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 165, (Is_Empty => True));
end Initialize_165;
--------------------
-- Initialize_166 --
--------------------
procedure Initialize_166 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 166, (Is_Empty => True));
end Initialize_166;
--------------------
-- Initialize_167 --
--------------------
procedure Initialize_167 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 167,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002E'Access);
end Initialize_167;
--------------------
-- Initialize_168 --
--------------------
procedure Initialize_168 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 168,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005E'Access);
end Initialize_168;
--------------------
-- Initialize_169 --
--------------------
procedure Initialize_169 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 169,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_169;
--------------------
-- Initialize_170 --
--------------------
procedure Initialize_170 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 170,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_005A'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 170, (Is_Empty => True));
end Initialize_170;
--------------------
-- Initialize_171 --
--------------------
procedure Initialize_171 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 171, (Is_Empty => True));
end Initialize_171;
--------------------
-- Initialize_172 --
--------------------
procedure Initialize_172 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 172,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0026'Access);
end Initialize_172;
--------------------
-- Initialize_173 --
--------------------
procedure Initialize_173 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 173,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0019'Access);
end Initialize_173;
--------------------
-- Initialize_174 --
--------------------
procedure Initialize_174 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 174,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0021'Access);
end Initialize_174;
--------------------
-- Initialize_175 --
--------------------
procedure Initialize_175 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 175,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_002C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 175, (Is_Empty => True));
end Initialize_175;
--------------------
-- Initialize_176 --
--------------------
procedure Initialize_176 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 176, (Is_Empty => True));
end Initialize_176;
--------------------
-- Initialize_177 --
--------------------
procedure Initialize_177 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body
(Base + 177,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0057'Access);
end Initialize_177;
--------------------
-- Initialize_178 --
--------------------
procedure Initialize_178 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 178,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0023'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 178, (Is_Empty => True));
end Initialize_178;
--------------------
-- Initialize_179 --
--------------------
procedure Initialize_179 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 179, (Is_Empty => True));
end Initialize_179;
--------------------
-- Initialize_180 --
--------------------
procedure Initialize_180 is
begin
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_003C'Access);
AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Value
(Base + 180,
AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_007D'Access);
end Initialize_180;
end AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties;
|
[
{
"context": "-- Wiki writers\n-- Copyright (C) 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 160,
"score": 0.9998796582221985,
"start": 145,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "C) 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 191,
"score": 0.9998817443847656,
"start": 176,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "3 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 218,
"score": 0.9999294281005859,
"start": 193,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
awa/src/awa-wikis-writers.adb
|
Letractively/ada-awa
| 0 |
-----------------------------------------------------------------------
-- awa-wikis-writers -- Wiki writers
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with ASF.Contexts.Writer.String;
with AWA.Wikis.Writers.Html;
with AWA.Wikis.Writers.Text;
package body AWA.Wikis.Writers is
-- ------------------------------
-- Render the wiki text according to the wiki syntax in an HTML string.
-- ------------------------------
function To_Html (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Html : aliased AWA.Wikis.Writers.Html.Html_Writer;
begin
Html.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Html'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Html;
-- ------------------------------
-- Render the wiki text according to the wiki syntax in a text string.
-- Wiki formatting and decoration are removed.
-- ------------------------------
function To_Text (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Renderer : aliased AWA.Wikis.Writers.Text.Text_Writer;
begin
Renderer.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Renderer'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Text;
end AWA.Wikis.Writers;
|
16200
|
-----------------------------------------------------------------------
-- awa-wikis-writers -- Wiki writers
-- Copyright (C) 2011, 2012, 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 ASF.Contexts.Writer.String;
with AWA.Wikis.Writers.Html;
with AWA.Wikis.Writers.Text;
package body AWA.Wikis.Writers is
-- ------------------------------
-- Render the wiki text according to the wiki syntax in an HTML string.
-- ------------------------------
function To_Html (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Html : aliased AWA.Wikis.Writers.Html.Html_Writer;
begin
Html.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Html'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Html;
-- ------------------------------
-- Render the wiki text according to the wiki syntax in a text string.
-- Wiki formatting and decoration are removed.
-- ------------------------------
function To_Text (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Renderer : aliased AWA.Wikis.Writers.Text.Text_Writer;
begin
Renderer.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Renderer'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Text;
end AWA.Wikis.Writers;
| true |
-----------------------------------------------------------------------
-- awa-wikis-writers -- Wiki writers
-- Copyright (C) 2011, 2012, 2013 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 ASF.Contexts.Writer.String;
with AWA.Wikis.Writers.Html;
with AWA.Wikis.Writers.Text;
package body AWA.Wikis.Writers is
-- ------------------------------
-- Render the wiki text according to the wiki syntax in an HTML string.
-- ------------------------------
function To_Html (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Html : aliased AWA.Wikis.Writers.Html.Html_Writer;
begin
Html.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Html'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Html;
-- ------------------------------
-- Render the wiki text according to the wiki syntax in a text string.
-- Wiki formatting and decoration are removed.
-- ------------------------------
function To_Text (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String is
Writer : aliased ASF.Contexts.Writer.String.String_Writer;
Renderer : aliased AWA.Wikis.Writers.Text.Text_Writer;
begin
Renderer.Set_Writer (Writer'Unchecked_Access);
AWA.Wikis.Parsers.Parse (Renderer'Unchecked_Access, Text, Syntax);
return Ada.Strings.Unbounded.To_String (Writer.Get_Response);
end To_Text;
end AWA.Wikis.Writers;
|
[
{
"context": "nagement for discrete types\n-- Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 179,
"score": 0.9998690485954285,
"start": 164,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 210,
"score": 0.9998770952224731,
"start": 195,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "7 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 237,
"score": 0.9999257326126099,
"start": 212,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/ado-caches-discrete.adb
|
My-Colaborations/ada-ado
| 0 |
-----------------------------------------------------------------------
-- ado-cache-discrete -- Simple cache management for discrete types
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ADO.Caches.Discrete is
-- ------------------------------
-- Expand the name into a target parameter value to be used in the SQL query.
-- The Expander can return a T_NULL when a value is not found or
-- it may also raise some exception.
-- ------------------------------
overriding
function Expand (Instance : in out Cache_Type;
Name : in String) return ADO.Parameters.Parameter is
Value : Element_Type;
begin
Value := Instance.Find (Name);
return ADO.Parameters.Parameter '(T => ADO.Parameters.T_LONG_INTEGER,
Len => 0, Value_Len => 0, Position => 0,
Name => "",
Long_Num => Element_Type'Pos (Value));
end Expand;
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Cache : in out Cache_Type;
Name : in String) return Element_Type is
begin
return Cache.Controller.Find (Name);
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Cache : in out Cache_Type;
Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
begin
Cache.Controller.Insert (Name, Value, Override);
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Cache : in out Cache_Type;
Name : in String;
Ignore : in Boolean := False) is
begin
Cache.Controller.Delete (Name, Ignore);
end Delete;
-- ------------------------------
-- Initialize the entity cache by reading the database entity table.
-- ------------------------------
procedure Initialize (Cache : in out Cache_Type;
Session : in out ADO.Sessions.Session'Class) is
begin
null;
end Initialize;
protected body Cache_Controller is
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Name : in String) return Element_Type is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
return Cache_Map.Element (Pos);
else
Log.Info ("Unknown cached value {0}", Name);
raise No_Value with "Value '" & Name & "' not found";
end if;
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
if not Override then
raise No_Value;
end if;
Values.Replace_Element (Pos, Value);
else
Values.Insert (Name, Value);
end if;
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Name : in String;
Ignore : in Boolean := False) is
Pos : Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
Values.Delete (Pos);
elsif not Ignore then
raise No_Value;
end if;
end Delete;
end Cache_Controller;
end ADO.Caches.Discrete;
|
20230
|
-----------------------------------------------------------------------
-- ado-cache-discrete -- Simple cache management for discrete types
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ADO.Caches.Discrete is
-- ------------------------------
-- Expand the name into a target parameter value to be used in the SQL query.
-- The Expander can return a T_NULL when a value is not found or
-- it may also raise some exception.
-- ------------------------------
overriding
function Expand (Instance : in out Cache_Type;
Name : in String) return ADO.Parameters.Parameter is
Value : Element_Type;
begin
Value := Instance.Find (Name);
return ADO.Parameters.Parameter '(T => ADO.Parameters.T_LONG_INTEGER,
Len => 0, Value_Len => 0, Position => 0,
Name => "",
Long_Num => Element_Type'Pos (Value));
end Expand;
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Cache : in out Cache_Type;
Name : in String) return Element_Type is
begin
return Cache.Controller.Find (Name);
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Cache : in out Cache_Type;
Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
begin
Cache.Controller.Insert (Name, Value, Override);
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Cache : in out Cache_Type;
Name : in String;
Ignore : in Boolean := False) is
begin
Cache.Controller.Delete (Name, Ignore);
end Delete;
-- ------------------------------
-- Initialize the entity cache by reading the database entity table.
-- ------------------------------
procedure Initialize (Cache : in out Cache_Type;
Session : in out ADO.Sessions.Session'Class) is
begin
null;
end Initialize;
protected body Cache_Controller is
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Name : in String) return Element_Type is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
return Cache_Map.Element (Pos);
else
Log.Info ("Unknown cached value {0}", Name);
raise No_Value with "Value '" & Name & "' not found";
end if;
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
if not Override then
raise No_Value;
end if;
Values.Replace_Element (Pos, Value);
else
Values.Insert (Name, Value);
end if;
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Name : in String;
Ignore : in Boolean := False) is
Pos : Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
Values.Delete (Pos);
elsif not Ignore then
raise No_Value;
end if;
end Delete;
end Cache_Controller;
end ADO.Caches.Discrete;
| true |
-----------------------------------------------------------------------
-- ado-cache-discrete -- Simple cache management for discrete types
-- Copyright (C) 2017 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ADO.Caches.Discrete is
-- ------------------------------
-- Expand the name into a target parameter value to be used in the SQL query.
-- The Expander can return a T_NULL when a value is not found or
-- it may also raise some exception.
-- ------------------------------
overriding
function Expand (Instance : in out Cache_Type;
Name : in String) return ADO.Parameters.Parameter is
Value : Element_Type;
begin
Value := Instance.Find (Name);
return ADO.Parameters.Parameter '(T => ADO.Parameters.T_LONG_INTEGER,
Len => 0, Value_Len => 0, Position => 0,
Name => "",
Long_Num => Element_Type'Pos (Value));
end Expand;
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Cache : in out Cache_Type;
Name : in String) return Element_Type is
begin
return Cache.Controller.Find (Name);
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Cache : in out Cache_Type;
Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
begin
Cache.Controller.Insert (Name, Value, Override);
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Cache : in out Cache_Type;
Name : in String;
Ignore : in Boolean := False) is
begin
Cache.Controller.Delete (Name, Ignore);
end Delete;
-- ------------------------------
-- Initialize the entity cache by reading the database entity table.
-- ------------------------------
procedure Initialize (Cache : in out Cache_Type;
Session : in out ADO.Sessions.Session'Class) is
begin
null;
end Initialize;
protected body Cache_Controller is
-- ------------------------------
-- Find the value associated with the given name.
-- Raises the No_Value exception if no such mapping exist.
-- ------------------------------
function Find (Name : in String) return Element_Type is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
return Cache_Map.Element (Pos);
else
Log.Info ("Unknown cached value {0}", Name);
raise No_Value with "Value '" & Name & "' not found";
end if;
end Find;
-- ------------------------------
-- Insert the value associated with the given name in the cache.
-- When <tt>Override</tt> is set, override existing values otherwise raise an exception.
-- ------------------------------
procedure Insert (Name : in String;
Value : in Element_Type;
Override : in Boolean := False) is
Pos : constant Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
if not Override then
raise No_Value;
end if;
Values.Replace_Element (Pos, Value);
else
Values.Insert (Name, Value);
end if;
end Insert;
-- ------------------------------
-- Delete the value associated with the given name in the cache.
-- Raise the No_Value exception if the value is not found and <tt>Ignore</tt> is not set.
-- ------------------------------
procedure Delete (Name : in String;
Ignore : in Boolean := False) is
Pos : Cache_Map.Cursor := Values.Find (Name);
begin
if Cache_Map.Has_Element (Pos) then
Values.Delete (Pos);
elsif not Ignore then
raise No_Value;
end if;
end Delete;
end Cache_Controller;
end ADO.Caches.Discrete;
|
[
{
"context": "---------------------\n-- Copyright (c) 2013-2020, Luke A. Guest\n--\n-- This software is provided 'as-is', without",
"end": 159,
"score": 0.9997133016586304,
"start": 146,
"tag": "NAME",
"value": "Luke A. Guest"
}
] |
src/sdl-inputs-joysticks-game_controllers.adb
|
Fabien-Chouteau/sdlada
| 1 |
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, 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.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C.Strings;
with SDL.Error;
with SDL.RWops;
package body SDL.Inputs.Joysticks.Game_Controllers is
package C renames Interfaces.C;
use type C.int;
use type C.Strings.chars_ptr;
procedure Add_Mapping (Data : in String; Updated_Existing : out Boolean) is
function SDL_Game_Controller_Add_Mapping (Buffer : in C.char_array) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMapping";
Result : C.int := SDL_Game_Controller_Add_Mapping (C.To_C (Data));
begin
if Result = -1 then
raise Mapping_Error with SDL.Error.Get;
end if;
Updated_Existing := (Result = 0);
end Add_Mapping;
procedure Add_Mappings_From_File (Database_Filename : in String; Number_Added : out Natural) is
function SDL_Game_Controller_Add_Mappings_From_RW
(RW : SDL.RWops.RWops;
FreeRW : C.int) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMappingsFromRW";
RW : SDL.RWops.RWops := SDL.RWops.From_File (Database_Filename,
Mode => SDL.RWops.Read);
Result : constant Integer
:= Integer (SDL_Game_Controller_Add_Mappings_From_RW (RW,
FreeRW => 1));
begin
if Result < 0 then
raise Mapping_Error with SDL.Error.Get;
end if;
Number_Added := Result;
end Add_Mappings_From_File;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
procedure Close (Self : in out Game_Controller) is
procedure SDL_Game_Controller_Close (Controller : in SDL.C_Pointers.Game_Controller_Pointer) with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerClose";
begin
SDL_Game_Controller_Close (Self.Internal);
-- Reinitialise the object so it's actually a Null_Game_Controller.
Self.Internal := null;
Self.Owns := True;
end Close;
function Get_Axis (Axis : in String) return SDL.Events.Joysticks.Game_Controllers.Axes is
function SDL_Game_Controller_Get_Axis_From_String (Axis : in C.char_array)
return SDL.Events.Joysticks.Game_Controllers.Axes with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxisFromString";
begin
return SDL_Game_Controller_Get_Axis_From_String (C.To_C (Axis));
end Get_Axis;
function Get_Binding (Self : in Game_Controller; Axis : in SDL.Events.Joysticks.Game_Controllers.Axes)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Axis
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForAxis";
begin
return SDL_Game_Controller_Get_Bind_For_Axis (Self.Internal, Axis);
end Get_Binding;
function Get_Binding (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Game_Controllers.Buttons)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Button
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForButton";
begin
return SDL_Game_Controller_Get_Bind_For_Button (Self.Internal, Button);
end Get_Binding;
function Get_Button (Button_Name : in String) return SDL.Events.Joysticks.Game_Controllers.Buttons is
function SDL_Game_Controller_Get_Button_From_String
(Buffer : in C.char_array) return SDL.Events.Joysticks.Game_Controllers.Buttons with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetButtonFromString";
begin
return SDL.Events.Joysticks.Game_Controllers.Buttons
(SDL_Game_Controller_Get_Button_From_String (C.To_C (Button_Name)));
end Get_Button;
function Get_Joystick (Self : in Game_Controller) return Joystick is
function SDL_Game_Controller_Get_Joystick
(Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL.C_Pointers.Joystick_Pointer with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetJoystick";
begin
return J : Joystick := (Ada.Finalization.Limited_Controlled with
Internal => SDL_Game_Controller_Get_Joystick (Self.Internal), Owns => False) do
null;
end return;
end Get_Joystick;
function Get_Mapping (Self : in Game_Controller) return String is
function SDL_Game_Controller_Mapping
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMapping";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Mapping (Controller : in GUIDs) return String is
function SDL_Game_Controller_Mapping_For_GUID (Controller : in GUIDs) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMappingForGUID";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping_For_GUID (Controller);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Name (Self : in Game_Controller) return String is
function SDL_Game_Controller_Name
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerName";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Get_Name (Device : in Devices) return String is
function SDL_Game_Controller_Name_For_Index (Index : in C.int) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerNameForIndex";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name_For_Index (C.int (Device) - 1);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Image (Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return String is
function SDL_Game_Controller_Get_String_For_Axis
(Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForAxis";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Axis (Axis);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Image (Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return String is
function SDL_Game_Controller_Get_String_For_Button
(Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForButton";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Button (Button);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Is_Attached (Self : in Game_Controller) return Boolean is
function SDL_Game_Controller_Is_Attached (Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAttached";
begin
return SDL_Game_Controller_Is_Attached (Self.Internal) = SDL_True;
end Is_Attached;
function Is_Button_Pressed (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State is
function SDL_Game_Controller_Get_Button (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetButton";
begin
return SDL_Game_Controller_Get_Button (Self.Internal, Button);
end Is_Button_Pressed;
function Is_Game_Controller (Device : in Devices) return Boolean is
function SDL_Is_Game_Controller (Device : in C.int) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_IsGameController";
begin
return SDL_Is_Game_Controller (C.int (Device) - 1) = SDL_True;
end Is_Game_Controller;
end SDL.Inputs.Joysticks.Game_Controllers;
|
8478
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- 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.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C.Strings;
with SDL.Error;
with SDL.RWops;
package body SDL.Inputs.Joysticks.Game_Controllers is
package C renames Interfaces.C;
use type C.int;
use type C.Strings.chars_ptr;
procedure Add_Mapping (Data : in String; Updated_Existing : out Boolean) is
function SDL_Game_Controller_Add_Mapping (Buffer : in C.char_array) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMapping";
Result : C.int := SDL_Game_Controller_Add_Mapping (C.To_C (Data));
begin
if Result = -1 then
raise Mapping_Error with SDL.Error.Get;
end if;
Updated_Existing := (Result = 0);
end Add_Mapping;
procedure Add_Mappings_From_File (Database_Filename : in String; Number_Added : out Natural) is
function SDL_Game_Controller_Add_Mappings_From_RW
(RW : SDL.RWops.RWops;
FreeRW : C.int) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMappingsFromRW";
RW : SDL.RWops.RWops := SDL.RWops.From_File (Database_Filename,
Mode => SDL.RWops.Read);
Result : constant Integer
:= Integer (SDL_Game_Controller_Add_Mappings_From_RW (RW,
FreeRW => 1));
begin
if Result < 0 then
raise Mapping_Error with SDL.Error.Get;
end if;
Number_Added := Result;
end Add_Mappings_From_File;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
procedure Close (Self : in out Game_Controller) is
procedure SDL_Game_Controller_Close (Controller : in SDL.C_Pointers.Game_Controller_Pointer) with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerClose";
begin
SDL_Game_Controller_Close (Self.Internal);
-- Reinitialise the object so it's actually a Null_Game_Controller.
Self.Internal := null;
Self.Owns := True;
end Close;
function Get_Axis (Axis : in String) return SDL.Events.Joysticks.Game_Controllers.Axes is
function SDL_Game_Controller_Get_Axis_From_String (Axis : in C.char_array)
return SDL.Events.Joysticks.Game_Controllers.Axes with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxisFromString";
begin
return SDL_Game_Controller_Get_Axis_From_String (C.To_C (Axis));
end Get_Axis;
function Get_Binding (Self : in Game_Controller; Axis : in SDL.Events.Joysticks.Game_Controllers.Axes)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Axis
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForAxis";
begin
return SDL_Game_Controller_Get_Bind_For_Axis (Self.Internal, Axis);
end Get_Binding;
function Get_Binding (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Game_Controllers.Buttons)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Button
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForButton";
begin
return SDL_Game_Controller_Get_Bind_For_Button (Self.Internal, Button);
end Get_Binding;
function Get_Button (Button_Name : in String) return SDL.Events.Joysticks.Game_Controllers.Buttons is
function SDL_Game_Controller_Get_Button_From_String
(Buffer : in C.char_array) return SDL.Events.Joysticks.Game_Controllers.Buttons with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetButtonFromString";
begin
return SDL.Events.Joysticks.Game_Controllers.Buttons
(SDL_Game_Controller_Get_Button_From_String (C.To_C (Button_Name)));
end Get_Button;
function Get_Joystick (Self : in Game_Controller) return Joystick is
function SDL_Game_Controller_Get_Joystick
(Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL.C_Pointers.Joystick_Pointer with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetJoystick";
begin
return J : Joystick := (Ada.Finalization.Limited_Controlled with
Internal => SDL_Game_Controller_Get_Joystick (Self.Internal), Owns => False) do
null;
end return;
end Get_Joystick;
function Get_Mapping (Self : in Game_Controller) return String is
function SDL_Game_Controller_Mapping
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMapping";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Mapping (Controller : in GUIDs) return String is
function SDL_Game_Controller_Mapping_For_GUID (Controller : in GUIDs) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMappingForGUID";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping_For_GUID (Controller);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Name (Self : in Game_Controller) return String is
function SDL_Game_Controller_Name
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerName";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Get_Name (Device : in Devices) return String is
function SDL_Game_Controller_Name_For_Index (Index : in C.int) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerNameForIndex";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name_For_Index (C.int (Device) - 1);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Image (Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return String is
function SDL_Game_Controller_Get_String_For_Axis
(Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForAxis";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Axis (Axis);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Image (Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return String is
function SDL_Game_Controller_Get_String_For_Button
(Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForButton";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Button (Button);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Is_Attached (Self : in Game_Controller) return Boolean is
function SDL_Game_Controller_Is_Attached (Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAttached";
begin
return SDL_Game_Controller_Is_Attached (Self.Internal) = SDL_True;
end Is_Attached;
function Is_Button_Pressed (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State is
function SDL_Game_Controller_Get_Button (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetButton";
begin
return SDL_Game_Controller_Get_Button (Self.Internal, Button);
end Is_Button_Pressed;
function Is_Game_Controller (Device : in Devices) return Boolean is
function SDL_Is_Game_Controller (Device : in C.int) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_IsGameController";
begin
return SDL_Is_Game_Controller (C.int (Device) - 1) = SDL_True;
end Is_Game_Controller;
end SDL.Inputs.Joysticks.Game_Controllers;
| true |
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, PI:NAME:<NAME>END_PI
--
-- 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.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C.Strings;
with SDL.Error;
with SDL.RWops;
package body SDL.Inputs.Joysticks.Game_Controllers is
package C renames Interfaces.C;
use type C.int;
use type C.Strings.chars_ptr;
procedure Add_Mapping (Data : in String; Updated_Existing : out Boolean) is
function SDL_Game_Controller_Add_Mapping (Buffer : in C.char_array) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMapping";
Result : C.int := SDL_Game_Controller_Add_Mapping (C.To_C (Data));
begin
if Result = -1 then
raise Mapping_Error with SDL.Error.Get;
end if;
Updated_Existing := (Result = 0);
end Add_Mapping;
procedure Add_Mappings_From_File (Database_Filename : in String; Number_Added : out Natural) is
function SDL_Game_Controller_Add_Mappings_From_RW
(RW : SDL.RWops.RWops;
FreeRW : C.int) return C.int with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerAddMappingsFromRW";
RW : SDL.RWops.RWops := SDL.RWops.From_File (Database_Filename,
Mode => SDL.RWops.Read);
Result : constant Integer
:= Integer (SDL_Game_Controller_Add_Mappings_From_RW (RW,
FreeRW => 1));
begin
if Result < 0 then
raise Mapping_Error with SDL.Error.Get;
end if;
Number_Added := Result;
end Add_Mappings_From_File;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.LR_Axes)
return SDL.Events.Joysticks.Game_Controllers.LR_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
function Axis_Value (Self : in Game_Controller;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values is
function SDL_Game_Controller_Get_Axis (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Trigger_Axes)
return SDL.Events.Joysticks.Game_Controllers.Trigger_Axes_Values with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxis";
begin
return SDL_Game_Controller_Get_Axis (Self.Internal, Axis);
end Axis_Value;
procedure Close (Self : in out Game_Controller) is
procedure SDL_Game_Controller_Close (Controller : in SDL.C_Pointers.Game_Controller_Pointer) with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerClose";
begin
SDL_Game_Controller_Close (Self.Internal);
-- Reinitialise the object so it's actually a Null_Game_Controller.
Self.Internal := null;
Self.Owns := True;
end Close;
function Get_Axis (Axis : in String) return SDL.Events.Joysticks.Game_Controllers.Axes is
function SDL_Game_Controller_Get_Axis_From_String (Axis : in C.char_array)
return SDL.Events.Joysticks.Game_Controllers.Axes with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAxisFromString";
begin
return SDL_Game_Controller_Get_Axis_From_String (C.To_C (Axis));
end Get_Axis;
function Get_Binding (Self : in Game_Controller; Axis : in SDL.Events.Joysticks.Game_Controllers.Axes)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Axis
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForAxis";
begin
return SDL_Game_Controller_Get_Bind_For_Axis (Self.Internal, Axis);
end Get_Binding;
function Get_Binding (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Game_Controllers.Buttons)
return Bindings is
function SDL_Game_Controller_Get_Bind_For_Button
(Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return Bindings with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetBindForButton";
begin
return SDL_Game_Controller_Get_Bind_For_Button (Self.Internal, Button);
end Get_Binding;
function Get_Button (Button_Name : in String) return SDL.Events.Joysticks.Game_Controllers.Buttons is
function SDL_Game_Controller_Get_Button_From_String
(Buffer : in C.char_array) return SDL.Events.Joysticks.Game_Controllers.Buttons with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetButtonFromString";
begin
return SDL.Events.Joysticks.Game_Controllers.Buttons
(SDL_Game_Controller_Get_Button_From_String (C.To_C (Button_Name)));
end Get_Button;
function Get_Joystick (Self : in Game_Controller) return Joystick is
function SDL_Game_Controller_Get_Joystick
(Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL.C_Pointers.Joystick_Pointer with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetJoystick";
begin
return J : Joystick := (Ada.Finalization.Limited_Controlled with
Internal => SDL_Game_Controller_Get_Joystick (Self.Internal), Owns => False) do
null;
end return;
end Get_Joystick;
function Get_Mapping (Self : in Game_Controller) return String is
function SDL_Game_Controller_Mapping
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMapping";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Mapping (Controller : in GUIDs) return String is
function SDL_Game_Controller_Mapping_For_GUID (Controller : in GUIDs) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerMappingForGUID";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Mapping_For_GUID (Controller);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Mapping;
function Get_Name (Self : in Game_Controller) return String is
function SDL_Game_Controller_Name
(Controller : in SDL.C_Pointers.Game_Controller_Pointer) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerName";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name (Self.Internal);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Get_Name (Device : in Devices) return String is
function SDL_Game_Controller_Name_For_Index (Index : in C.int) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerNameForIndex";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Name_For_Index (C.int (Device) - 1);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Get_Name;
function Image (Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return String is
function SDL_Game_Controller_Get_String_For_Axis
(Axis : in SDL.Events.Joysticks.Game_Controllers.Axes) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForAxis";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Axis (Axis);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Image (Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return String is
function SDL_Game_Controller_Get_String_For_Button
(Button : in SDL.Events.Joysticks.Game_Controllers.Buttons) return C.Strings.chars_ptr with
Convention => C,
Import => True,
External_Name => "SDL_GameControllerGetStringForButton";
Result : C.Strings.chars_ptr := SDL_Game_Controller_Get_String_For_Button (Button);
begin
if Result = C.Strings.Null_Ptr then
return "";
end if;
return C.Strings.Value (Result);
end Image;
function Is_Attached (Self : in Game_Controller) return Boolean is
function SDL_Game_Controller_Is_Attached (Controller : in SDL.C_Pointers.Game_Controller_Pointer)
return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetAttached";
begin
return SDL_Game_Controller_Is_Attached (Self.Internal) = SDL_True;
end Is_Attached;
function Is_Button_Pressed (Self : in Game_Controller; Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State is
function SDL_Game_Controller_Get_Button (Controller : in SDL.C_Pointers.Game_Controller_Pointer;
Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State with
Import => True,
Convention => C,
External_Name => "SDL_GameControllerGetButton";
begin
return SDL_Game_Controller_Get_Button (Self.Internal, Button);
end Is_Button_Pressed;
function Is_Game_Controller (Device : in Devices) return Boolean is
function SDL_Is_Game_Controller (Device : in C.int) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_IsGameController";
begin
return SDL_Is_Game_Controller (C.int (Device) - 1) = SDL_True;
end Is_Game_Controller;
end SDL.Inputs.Joysticks.Game_Controllers;
|
[
{
"context": "pes --\n-- |___/_|\\_\\_|_|____| by: Timm Felden --\n-- ",
"end": 284,
"score": 0.9998804926872253,
"start": 273,
"tag": "NAME",
"value": "Timm Felden"
}
] |
src/skill-field_types-builtin-string_type_p.adb
|
skill-lang/adaCommon
| 0 |
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ implementation of builtin field types --
-- |___/_|\_\_|_|____| by: Timm Felden --
-- --
pragma Ada_2012;
with Ada.Containers;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Hashed_Sets;
with Ada.Containers.Vectors;
with Skill.Types;
with Skill.Hashes; use Skill.Hashes;
with Skill.Types.Pools;
with Ada.Tags;
package body Skill.Field_Types.Builtin.String_Type_P is
function Get_Id_Map (THis : access Field_Type_T) return ID_Map is
begin
return THis.String_IDs'Access;
end Get_Id_Map;
procedure Write_Box
(This : access Field_Type_T;
Output : Streams.Writer.Sub_Stream;
Target : Types.Box)
is
V : Types.String_Access := Unboxed (Target);
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (This.String_IDs.Element (V)));
end if;
end Write_Box;
procedure Write_Single_Field
(THis : access Field_Type_T;
V : Types.String_Access;
Output : Skill.Streams.Writer.Sub_Stream)
is
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (THis.String_IDs.Element (V)));
end if;
end Write_Single_Field;
end Skill.Field_Types.Builtin.String_Type_P;
|
30436
|
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ implementation of builtin field types --
-- |___/_|\_\_|_|____| by: <NAME> --
-- --
pragma Ada_2012;
with Ada.Containers;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Hashed_Sets;
with Ada.Containers.Vectors;
with Skill.Types;
with Skill.Hashes; use Skill.Hashes;
with Skill.Types.Pools;
with Ada.Tags;
package body Skill.Field_Types.Builtin.String_Type_P is
function Get_Id_Map (THis : access Field_Type_T) return ID_Map is
begin
return THis.String_IDs'Access;
end Get_Id_Map;
procedure Write_Box
(This : access Field_Type_T;
Output : Streams.Writer.Sub_Stream;
Target : Types.Box)
is
V : Types.String_Access := Unboxed (Target);
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (This.String_IDs.Element (V)));
end if;
end Write_Box;
procedure Write_Single_Field
(THis : access Field_Type_T;
V : Types.String_Access;
Output : Skill.Streams.Writer.Sub_Stream)
is
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (THis.String_IDs.Element (V)));
end if;
end Write_Single_Field;
end Skill.Field_Types.Builtin.String_Type_P;
| true |
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ implementation of builtin field types --
-- |___/_|\_\_|_|____| by: PI:NAME:<NAME>END_PI --
-- --
pragma Ada_2012;
with Ada.Containers;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Hashed_Sets;
with Ada.Containers.Vectors;
with Skill.Types;
with Skill.Hashes; use Skill.Hashes;
with Skill.Types.Pools;
with Ada.Tags;
package body Skill.Field_Types.Builtin.String_Type_P is
function Get_Id_Map (THis : access Field_Type_T) return ID_Map is
begin
return THis.String_IDs'Access;
end Get_Id_Map;
procedure Write_Box
(This : access Field_Type_T;
Output : Streams.Writer.Sub_Stream;
Target : Types.Box)
is
V : Types.String_Access := Unboxed (Target);
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (This.String_IDs.Element (V)));
end if;
end Write_Box;
procedure Write_Single_Field
(THis : access Field_Type_T;
V : Types.String_Access;
Output : Skill.Streams.Writer.Sub_Stream)
is
use type Types.String_Access;
begin
if null = V then
Output.I8 (0);
else
Output.V64 (Types.v64 (THis.String_IDs.Element (V)));
end if;
end Write_Single_Field;
end Skill.Field_Types.Builtin.String_Type_P;
|
[
{
"context": "-- Ada regular expression library\n-- (c) Kristian Klomsten Skordal 2020 <[email protected]>\n-- Report",
"end": 68,
"score": 0.9998844861984253,
"start": 43,
"tag": "NAME",
"value": "Kristian Klomsten Skordal"
},
{
"context": "n library\n-- (c) Kristian Klomsten Skordal 2020 <[email protected]>\n-- Report bugs and issues on <https://github.co",
"end": 106,
"score": 0.999934732913971,
"start": 75,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
tests/regex_test.adb
|
skordal/ada-regex
| 2 |
-- Ada regular expression library
-- (c) Kristian Klomsten Skordal 2020 <[email protected]>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with AUnit.Run;
with AUnit.Reporter.Text;
with Regex_Test_Suite;
with Utilities_Test_Suite;
procedure Regex_Test is
procedure Regex_Test_Runner is new AUnit.Run.Test_Runner (Regex_Test_Suite.Test_Suite);
procedure Utilities_Test_Runner is new AUnit.Run.Test_Runner (Utilities_Test_Suite.Test_Suite);
Test_Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Regex_Test_Runner (Test_Reporter);
Utilities_Test_Runner (Test_Reporter);
end Regex_Test;
|
23412
|
-- Ada regular expression library
-- (c) <NAME> 2020 <<EMAIL>>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with AUnit.Run;
with AUnit.Reporter.Text;
with Regex_Test_Suite;
with Utilities_Test_Suite;
procedure Regex_Test is
procedure Regex_Test_Runner is new AUnit.Run.Test_Runner (Regex_Test_Suite.Test_Suite);
procedure Utilities_Test_Runner is new AUnit.Run.Test_Runner (Utilities_Test_Suite.Test_Suite);
Test_Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Regex_Test_Runner (Test_Reporter);
Utilities_Test_Runner (Test_Reporter);
end Regex_Test;
| true |
-- Ada regular expression library
-- (c) PI:NAME:<NAME>END_PI 2020 <PI:EMAIL:<EMAIL>END_PI>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with AUnit.Run;
with AUnit.Reporter.Text;
with Regex_Test_Suite;
with Utilities_Test_Suite;
procedure Regex_Test is
procedure Regex_Test_Runner is new AUnit.Run.Test_Runner (Regex_Test_Suite.Test_Suite);
procedure Utilities_Test_Runner is new AUnit.Run.Test_Runner (Utilities_Test_Suite.Test_Suite);
Test_Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Regex_Test_Runner (Test_Reporter);
Utilities_Test_Runner (Test_Reporter);
end Regex_Test;
|
[
{
"context": "----------------------\n-- Copyright (c) 2016-2017, Natacha Porté --\n-- ",
"end": 120,
"score": 0.9998493194580078,
"start": 107,
"tag": "NAME",
"value": "Natacha Porté"
}
] |
src/natools-smaz_4096.ads
|
faelys/natools
| 0 |
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, 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.Smaz_4096 provides the subprograms needed to instantiate --
-- Natools.Smaz_Generic into a variant of the Smaz compression algorithm --
-- that output directly base-64 printable symbols, but with a dictionary --
-- indexed by two symbols, allowing a maximum size of 4095 entries. --
------------------------------------------------------------------------------
with Natools.Smaz_Generic;
with Natools.Smaz_Implementations.Base_4096;
package Natools.Smaz_4096 is new Natools.Smaz_Generic
(Dictionary_Code => Natools.Smaz_Implementations.Base_4096.Base_4096_Digit,
Read_Code => Natools.Smaz_Implementations.Base_4096.Read_Code,
Read_Verbatim => Natools.Smaz_Implementations.Base_4096.Read_Verbatim,
Skip_Verbatim => Natools.Smaz_Implementations.Base_4096.Skip_Verbatim,
Verbatim_Size => Natools.Smaz_Implementations.Base_4096.Verbatim_Size,
Write_Code => Natools.Smaz_Implementations.Base_4096.Write_Code,
Write_Verbatim => Natools.Smaz_Implementations.Base_4096.Write_Verbatim);
pragma Pure (Natools.Smaz_4096);
|
21641
|
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, <NAME> --
-- --
-- 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.Smaz_4096 provides the subprograms needed to instantiate --
-- Natools.Smaz_Generic into a variant of the Smaz compression algorithm --
-- that output directly base-64 printable symbols, but with a dictionary --
-- indexed by two symbols, allowing a maximum size of 4095 entries. --
------------------------------------------------------------------------------
with Natools.Smaz_Generic;
with Natools.Smaz_Implementations.Base_4096;
package Natools.Smaz_4096 is new Natools.Smaz_Generic
(Dictionary_Code => Natools.Smaz_Implementations.Base_4096.Base_4096_Digit,
Read_Code => Natools.Smaz_Implementations.Base_4096.Read_Code,
Read_Verbatim => Natools.Smaz_Implementations.Base_4096.Read_Verbatim,
Skip_Verbatim => Natools.Smaz_Implementations.Base_4096.Skip_Verbatim,
Verbatim_Size => Natools.Smaz_Implementations.Base_4096.Verbatim_Size,
Write_Code => Natools.Smaz_Implementations.Base_4096.Write_Code,
Write_Verbatim => Natools.Smaz_Implementations.Base_4096.Write_Verbatim);
pragma Pure (Natools.Smaz_4096);
| true |
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, PI:NAME:<NAME>END_PI --
-- --
-- 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.Smaz_4096 provides the subprograms needed to instantiate --
-- Natools.Smaz_Generic into a variant of the Smaz compression algorithm --
-- that output directly base-64 printable symbols, but with a dictionary --
-- indexed by two symbols, allowing a maximum size of 4095 entries. --
------------------------------------------------------------------------------
with Natools.Smaz_Generic;
with Natools.Smaz_Implementations.Base_4096;
package Natools.Smaz_4096 is new Natools.Smaz_Generic
(Dictionary_Code => Natools.Smaz_Implementations.Base_4096.Base_4096_Digit,
Read_Code => Natools.Smaz_Implementations.Base_4096.Read_Code,
Read_Verbatim => Natools.Smaz_Implementations.Base_4096.Read_Verbatim,
Skip_Verbatim => Natools.Smaz_Implementations.Base_4096.Skip_Verbatim,
Verbatim_Size => Natools.Smaz_Implementations.Base_4096.Verbatim_Size,
Write_Code => Natools.Smaz_Implementations.Base_4096.Write_Code,
Write_Verbatim => Natools.Smaz_Implementations.Base_4096.Write_Verbatim);
pragma Pure (Natools.Smaz_4096);
|
[
{
"context": "ses\n-- Copyright (C) 2011, 2016, 2018, 2019, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 180,
"score": 0.9998733401298523,
"start": 165,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "6, 2018, 2019, 2021 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 211,
"score": 0.9998871684074402,
"start": 196,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 238,
"score": 0.9999275207519531,
"start": 213,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
regtests/util-processes-tests.ads
|
yrashk/ada-util
| 0 |
-----------------------------------------------------------------------
-- util-processes-tests - Test for processes
-- Copyright (C) 2011, 2016, 2018, 2019, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Processes.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Tests when the process is not launched
procedure Test_No_Process (T : in out Test);
-- Test executing a process
procedure Test_Spawn (T : in out Test);
-- Test output pipe redirection: read the process standard output
procedure Test_Output_Pipe (T : in out Test);
-- Test input pipe redirection: write the process standard input
procedure Test_Input_Pipe (T : in out Test);
-- Test error pipe redirection: read the process standard error
procedure Test_Error_Pipe (T : in out Test);
-- Test shell splitting.
procedure Test_Shell_Splitting_Pipe (T : in out Test);
-- Test launching several processes through pipes in several threads.
procedure Test_Multi_Spawn (T : in out Test);
-- Test output file redirection.
procedure Test_Output_Redirect (T : in out Test);
-- Test input file redirection.
procedure Test_Input_Redirect (T : in out Test);
-- Test changing working directory.
procedure Test_Set_Working_Directory (T : in out Test);
-- Test various errors.
procedure Test_Errors (T : in out Test);
-- Test launching and stopping a process.
procedure Test_Stop (T : in out Test);
-- Test various errors (pipe streams).
procedure Test_Pipe_Errors (T : in out Test);
-- Test launching and stopping a process (pipe streams).
procedure Test_Pipe_Stop (T : in out Test);
-- Test the Tools.Execute operation.
procedure Test_Tools_Execute (T : in out Test);
end Util.Processes.Tests;
|
1850
|
-----------------------------------------------------------------------
-- util-processes-tests - Test for processes
-- Copyright (C) 2011, 2016, 2018, 2019, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Processes.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Tests when the process is not launched
procedure Test_No_Process (T : in out Test);
-- Test executing a process
procedure Test_Spawn (T : in out Test);
-- Test output pipe redirection: read the process standard output
procedure Test_Output_Pipe (T : in out Test);
-- Test input pipe redirection: write the process standard input
procedure Test_Input_Pipe (T : in out Test);
-- Test error pipe redirection: read the process standard error
procedure Test_Error_Pipe (T : in out Test);
-- Test shell splitting.
procedure Test_Shell_Splitting_Pipe (T : in out Test);
-- Test launching several processes through pipes in several threads.
procedure Test_Multi_Spawn (T : in out Test);
-- Test output file redirection.
procedure Test_Output_Redirect (T : in out Test);
-- Test input file redirection.
procedure Test_Input_Redirect (T : in out Test);
-- Test changing working directory.
procedure Test_Set_Working_Directory (T : in out Test);
-- Test various errors.
procedure Test_Errors (T : in out Test);
-- Test launching and stopping a process.
procedure Test_Stop (T : in out Test);
-- Test various errors (pipe streams).
procedure Test_Pipe_Errors (T : in out Test);
-- Test launching and stopping a process (pipe streams).
procedure Test_Pipe_Stop (T : in out Test);
-- Test the Tools.Execute operation.
procedure Test_Tools_Execute (T : in out Test);
end Util.Processes.Tests;
| true |
-----------------------------------------------------------------------
-- util-processes-tests - Test for processes
-- Copyright (C) 2011, 2016, 2018, 2019, 2021 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Processes.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Tests when the process is not launched
procedure Test_No_Process (T : in out Test);
-- Test executing a process
procedure Test_Spawn (T : in out Test);
-- Test output pipe redirection: read the process standard output
procedure Test_Output_Pipe (T : in out Test);
-- Test input pipe redirection: write the process standard input
procedure Test_Input_Pipe (T : in out Test);
-- Test error pipe redirection: read the process standard error
procedure Test_Error_Pipe (T : in out Test);
-- Test shell splitting.
procedure Test_Shell_Splitting_Pipe (T : in out Test);
-- Test launching several processes through pipes in several threads.
procedure Test_Multi_Spawn (T : in out Test);
-- Test output file redirection.
procedure Test_Output_Redirect (T : in out Test);
-- Test input file redirection.
procedure Test_Input_Redirect (T : in out Test);
-- Test changing working directory.
procedure Test_Set_Working_Directory (T : in out Test);
-- Test various errors.
procedure Test_Errors (T : in out Test);
-- Test launching and stopping a process.
procedure Test_Stop (T : in out Test);
-- Test various errors (pipe streams).
procedure Test_Pipe_Errors (T : in out Test);
-- Test launching and stopping a process (pipe streams).
procedure Test_Pipe_Stop (T : in out Test);
-- Test the Tools.Execute operation.
procedure Test_Tools_Execute (T : in out Test);
end Util.Processes.Tests;
|
[
{
"context": "--\n-- Copyright 2018 The wookey project team <[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michel",
"end": 64,
"score": 0.9999328851699829,
"start": 46,
"tag": "EMAIL",
"value": "[email protected]"
},
{
"context": "he wookey project team <[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard",
"end": 91,
"score": 0.9987169504165649,
"start": 73,
"tag": "NAME",
"value": "Ryad Benadjila"
},
{
"context": "[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n--",
"end": 118,
"score": 0.9586367011070251,
"start": 99,
"tag": "NAME",
"value": "Arnauld Michelizza"
},
{
"context": "ad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet",
"end": 141,
"score": 0.9437824487686157,
"start": 126,
"tag": "NAME",
"value": "Mathieu Renard"
},
{
"context": " Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under th",
"end": 165,
"score": 0.9998204112052917,
"start": 149,
"tag": "NAME",
"value": "Philippe Thierry"
},
{
"context": " - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under the Apache License, Version ",
"end": 191,
"score": 0.9998638033866882,
"start": 173,
"tag": "NAME",
"value": "Philippe Trebuchet"
}
] |
src/Ada/ewok-ipc.adb
|
wookey-project/ewok-legacy
| 0 |
--
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- 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_conversion;
package body ewok.ipc
with spark_mode => off
is
function to_task_id
(eid : t_extended_task_id) return ewok.tasks_shared.t_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(t_extended_task_id, ewok.tasks_shared.t_task_id);
pragma warnings (on);
ret : constant ewok.tasks_shared.t_task_id := convert (eid);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_task_id;
function to_ext_task_id
(id : ewok.tasks_shared.t_task_id) return t_extended_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(ewok.tasks_shared.t_task_id, t_extended_task_id);
pragma warnings (on);
ret : constant t_extended_task_id := convert (id);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_ext_task_id;
procedure init_endpoint
(ep : in out t_endpoint)
is
begin
ep.from := ewok.ipc.ID_UNUSED;
ep.to := ewok.ipc.ID_UNUSED;
ep.state := FREE;
ep.size := 0;
for i in ep.data'range loop
ep.data(i) := 0;
end loop;
end init_endpoint;
procedure init_endpoints
is
begin
for i in ipc_endpoints'range loop
init_endpoint (ipc_endpoints(i));
end loop;
end init_endpoints;
procedure get_endpoint
(endpoint_a : out t_endpoint_access;
success : out boolean)
is
begin
for i in ipc_endpoints'range loop
if ipc_endpoints(i).state = FREE then
ipc_endpoints(i).state := READY;
endpoint_a := ipc_endpoints(i)'access;
success := true;
return;
end if;
end loop;
endpoint_a := NULL;
success := false;
end get_endpoint;
procedure release_endpoint
(endpoint_a : in t_endpoint_access)
is
begin
init_endpoint (endpoint_a.all);
end release_endpoint;
end ewok.ipc;
|
27783
|
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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_conversion;
package body ewok.ipc
with spark_mode => off
is
function to_task_id
(eid : t_extended_task_id) return ewok.tasks_shared.t_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(t_extended_task_id, ewok.tasks_shared.t_task_id);
pragma warnings (on);
ret : constant ewok.tasks_shared.t_task_id := convert (eid);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_task_id;
function to_ext_task_id
(id : ewok.tasks_shared.t_task_id) return t_extended_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(ewok.tasks_shared.t_task_id, t_extended_task_id);
pragma warnings (on);
ret : constant t_extended_task_id := convert (id);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_ext_task_id;
procedure init_endpoint
(ep : in out t_endpoint)
is
begin
ep.from := ewok.ipc.ID_UNUSED;
ep.to := ewok.ipc.ID_UNUSED;
ep.state := FREE;
ep.size := 0;
for i in ep.data'range loop
ep.data(i) := 0;
end loop;
end init_endpoint;
procedure init_endpoints
is
begin
for i in ipc_endpoints'range loop
init_endpoint (ipc_endpoints(i));
end loop;
end init_endpoints;
procedure get_endpoint
(endpoint_a : out t_endpoint_access;
success : out boolean)
is
begin
for i in ipc_endpoints'range loop
if ipc_endpoints(i).state = FREE then
ipc_endpoints(i).state := READY;
endpoint_a := ipc_endpoints(i)'access;
success := true;
return;
end if;
end loop;
endpoint_a := NULL;
success := false;
end get_endpoint;
procedure release_endpoint
(endpoint_a : in t_endpoint_access)
is
begin
init_endpoint (endpoint_a.all);
end release_endpoint;
end ewok.ipc;
| true |
--
-- Copyright 2018 The wookey project team <PI:EMAIL:<EMAIL>END_PI>
-- - PI:NAME:<NAME>END_PI
-- - PI:NAME:<NAME>END_PI
-- - PI:NAME:<NAME>END_PI
-- - PI:NAME:<NAME>END_PI
-- - PI:NAME:<NAME>END_PI
--
-- 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_conversion;
package body ewok.ipc
with spark_mode => off
is
function to_task_id
(eid : t_extended_task_id) return ewok.tasks_shared.t_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(t_extended_task_id, ewok.tasks_shared.t_task_id);
pragma warnings (on);
ret : constant ewok.tasks_shared.t_task_id := convert (eid);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_task_id;
function to_ext_task_id
(id : ewok.tasks_shared.t_task_id) return t_extended_task_id
is
pragma warnings (off); -- size may differ
function convert is new ada.unchecked_conversion
(ewok.tasks_shared.t_task_id, t_extended_task_id);
pragma warnings (on);
ret : constant t_extended_task_id := convert (id);
begin
if ret'valid then
return ret;
else
raise constraint_error;
end if;
end to_ext_task_id;
procedure init_endpoint
(ep : in out t_endpoint)
is
begin
ep.from := ewok.ipc.ID_UNUSED;
ep.to := ewok.ipc.ID_UNUSED;
ep.state := FREE;
ep.size := 0;
for i in ep.data'range loop
ep.data(i) := 0;
end loop;
end init_endpoint;
procedure init_endpoints
is
begin
for i in ipc_endpoints'range loop
init_endpoint (ipc_endpoints(i));
end loop;
end init_endpoints;
procedure get_endpoint
(endpoint_a : out t_endpoint_access;
success : out boolean)
is
begin
for i in ipc_endpoints'range loop
if ipc_endpoints(i).state = FREE then
ipc_endpoints(i).state := READY;
endpoint_a := ipc_endpoints(i)'access;
success := true;
return;
end if;
end loop;
endpoint_a := NULL;
success := false;
end get_endpoint;
procedure release_endpoint
(endpoint_a : in t_endpoint_access)
is
begin
init_endpoint (endpoint_a.all);
end release_endpoint;
end ewok.ipc;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 48,
"score": 0.9998515844345093,
"start": 38,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 68,
"score": 0.9999308586120605,
"start": 50,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/contexts/plain/program-plain_compilations.adb
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019-2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Handlers;
with Program.Scanner_Destinations;
with Program.Scanners;
with Program.Symbols;
package body Program.Plain_Compilations is
type Scanner_Destination
(Comp : not null access Compilation;
Scanner : not null access Program.Scanners.Scanner)
is
new Program.Scanner_Destinations.Scanner_Destination with
record
Line_From : Positive := 1;
end record;
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive);
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token);
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access);
-------------
-- Context --
-------------
overriding function Context
(Self : Compilation) return not null Program.Contexts.Context_Access is
begin
return Program.Contexts.Context_Access (Self.Context);
end Context;
--------------
-- Get_Span --
--------------
overriding procedure Get_Span
(Self : Compilation;
Span : Program.Source_Buffers.Span;
From_Line : out Positive;
To_Line : out Positive;
From_Column : out Positive;
To_Column : out Positive) is
begin
for J in Self.Line_Spans.First_Index .. Self.Line_Spans.Last_Index loop
declare
SJ : constant Program.Source_Buffers.Span := Self.Line_Spans (J);
begin
if Span.From in SJ.From .. SJ.To then
From_Line := J;
From_Column := Span.From - SJ.From + 1;
for K in J .. Self.Line_Spans.Last_Index loop
declare
SK : constant Source_Buffers.Span := Self.Line_Spans (K);
begin
if Span.To in SK.From .. SK.To then
To_Line := K;
To_Column := Span.To - SK.From + 1;
return;
end if;
end;
end loop;
end if;
end;
end loop;
raise Constraint_Error;
end Get_Span;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Compilation'Class;
Context : not null Program.Contexts.Context_Access) is
begin
Self.Context := Plain_Context_Access (Context);
end Initialize;
---------------------
-- Lexical_Element --
---------------------
overriding function Lexical_Element
(Self : Compilation;
Index : Positive)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Tokens.Element (Index);
end Lexical_Element;
---------------------------
-- Lexical_Element_Count --
---------------------------
overriding function Lexical_Element_Count
(Self : Compilation) return Natural is
begin
return Self.Tokens.Length;
end Lexical_Element_Count;
----------
-- Line --
----------
overriding function Line
(Self : Compilation;
Index : Positive) return Program.Text is
begin
return Self.Buffer.Text (Self.Line_Spans (Index));
end Line;
----------------
-- Line_Count --
----------------
overriding function Line_Count (Self : Compilation) return Natural is
begin
return Self.Line_Spans.Last_Index;
end Line_Count;
--------------
-- New_Line --
--------------
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive)
is
Span : constant Program.Source_Buffers.Span :=
Self.Scanner.Get_Span;
begin
Self.Comp.Line_Spans.Append
((From => Self.Line_From,
To => Span.From - 1));
Self.Line_From := Span.To + 1;
end New_Line;
---------------
-- New_Token --
---------------
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token)
is
use all type Program.Lexical_Elements.Lexical_Element_Kind;
Symbol : Program.Symbols.Symbol := Program.Symbols.No_Symbol;
begin
if Token.Kind = Identifier then
Self.Comp.Context.Find_Or_Create_Symbol
(Self.Comp.Buffer'Unchecked_Access, Token.Span, Symbol);
elsif Token.Kind in Character_Literal | String_Literal then
Symbol := Self.Comp.Context.Find (Self.Comp.Buffer.Text (Token.Span));
elsif Token.Kind in Program.Lexical_Elements.Operator_Kind then
Symbol := Program.Symbols.To_Symbol (Token.Kind);
end if;
Self.Comp.Tokens.Append
(Token.Span,
Token.Kind,
Symbol);
end New_Token;
-----------------
-- Object_Name --
-----------------
overriding function Object_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Object_Name);
end Object_Name;
----------------
-- Parse_File --
----------------
not overriding procedure Parse_File
(Self : aliased in out Compilation;
Text_Name : Program.Text;
Units : out Program.Parsers.Unit_Vectors.Vector;
Pragmas : out Program.Parsers.Element_Vectors.Vector;
Standard : Boolean := False) is
begin
Self.Text_Name := Ada.Strings.Wide_Wide_Unbounded.
To_Unbounded_Wide_Wide_String (Text_Name);
Self.Buffer.Initialize (Text_Name);
Self.Read_All_Tokens (Self.Buffer'Unchecked_Access);
Program.Parsers.Parse
(Self'Unchecked_Access,
Self.Tokens'Unchecked_Access,
Self.Subpool,
Units,
Pragmas,
Standard);
end Parse_File;
---------------------
-- Read_All_Tokens --
---------------------
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access)
is
Token : Program.Lexical_Elements.Lexical_Element_Kind;
Scanner : aliased Program.Scanners.Scanner;
Dest : aliased Scanner_Destination (Self, Scanner'Access);
Handler : aliased Program.Lexical_Handlers.Handler (Dest'Access);
begin
Buffer.Rewind;
Scanner.Set_Source (Buffer);
Scanner.Set_Handler (Handler'Unchecked_Access);
loop
Scanner.Get_Token (Token);
exit when Token in Program.Lexical_Elements.End_Of_Input;
end loop;
end Read_All_Tokens;
----------
-- Text --
----------
overriding function Text
(Self : Compilation;
Span : Program.Source_Buffers.Span) return Program.Text is
begin
return Self.Buffer.Text (Span);
end Text;
---------------
-- Text_Name --
---------------
overriding function Text_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Text_Name);
end Text_Name;
end Program.Plain_Compilations;
|
4694
|
-- SPDX-FileCopyrightText: 2019-2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Handlers;
with Program.Scanner_Destinations;
with Program.Scanners;
with Program.Symbols;
package body Program.Plain_Compilations is
type Scanner_Destination
(Comp : not null access Compilation;
Scanner : not null access Program.Scanners.Scanner)
is
new Program.Scanner_Destinations.Scanner_Destination with
record
Line_From : Positive := 1;
end record;
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive);
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token);
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access);
-------------
-- Context --
-------------
overriding function Context
(Self : Compilation) return not null Program.Contexts.Context_Access is
begin
return Program.Contexts.Context_Access (Self.Context);
end Context;
--------------
-- Get_Span --
--------------
overriding procedure Get_Span
(Self : Compilation;
Span : Program.Source_Buffers.Span;
From_Line : out Positive;
To_Line : out Positive;
From_Column : out Positive;
To_Column : out Positive) is
begin
for J in Self.Line_Spans.First_Index .. Self.Line_Spans.Last_Index loop
declare
SJ : constant Program.Source_Buffers.Span := Self.Line_Spans (J);
begin
if Span.From in SJ.From .. SJ.To then
From_Line := J;
From_Column := Span.From - SJ.From + 1;
for K in J .. Self.Line_Spans.Last_Index loop
declare
SK : constant Source_Buffers.Span := Self.Line_Spans (K);
begin
if Span.To in SK.From .. SK.To then
To_Line := K;
To_Column := Span.To - SK.From + 1;
return;
end if;
end;
end loop;
end if;
end;
end loop;
raise Constraint_Error;
end Get_Span;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Compilation'Class;
Context : not null Program.Contexts.Context_Access) is
begin
Self.Context := Plain_Context_Access (Context);
end Initialize;
---------------------
-- Lexical_Element --
---------------------
overriding function Lexical_Element
(Self : Compilation;
Index : Positive)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Tokens.Element (Index);
end Lexical_Element;
---------------------------
-- Lexical_Element_Count --
---------------------------
overriding function Lexical_Element_Count
(Self : Compilation) return Natural is
begin
return Self.Tokens.Length;
end Lexical_Element_Count;
----------
-- Line --
----------
overriding function Line
(Self : Compilation;
Index : Positive) return Program.Text is
begin
return Self.Buffer.Text (Self.Line_Spans (Index));
end Line;
----------------
-- Line_Count --
----------------
overriding function Line_Count (Self : Compilation) return Natural is
begin
return Self.Line_Spans.Last_Index;
end Line_Count;
--------------
-- New_Line --
--------------
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive)
is
Span : constant Program.Source_Buffers.Span :=
Self.Scanner.Get_Span;
begin
Self.Comp.Line_Spans.Append
((From => Self.Line_From,
To => Span.From - 1));
Self.Line_From := Span.To + 1;
end New_Line;
---------------
-- New_Token --
---------------
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token)
is
use all type Program.Lexical_Elements.Lexical_Element_Kind;
Symbol : Program.Symbols.Symbol := Program.Symbols.No_Symbol;
begin
if Token.Kind = Identifier then
Self.Comp.Context.Find_Or_Create_Symbol
(Self.Comp.Buffer'Unchecked_Access, Token.Span, Symbol);
elsif Token.Kind in Character_Literal | String_Literal then
Symbol := Self.Comp.Context.Find (Self.Comp.Buffer.Text (Token.Span));
elsif Token.Kind in Program.Lexical_Elements.Operator_Kind then
Symbol := Program.Symbols.To_Symbol (Token.Kind);
end if;
Self.Comp.Tokens.Append
(Token.Span,
Token.Kind,
Symbol);
end New_Token;
-----------------
-- Object_Name --
-----------------
overriding function Object_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Object_Name);
end Object_Name;
----------------
-- Parse_File --
----------------
not overriding procedure Parse_File
(Self : aliased in out Compilation;
Text_Name : Program.Text;
Units : out Program.Parsers.Unit_Vectors.Vector;
Pragmas : out Program.Parsers.Element_Vectors.Vector;
Standard : Boolean := False) is
begin
Self.Text_Name := Ada.Strings.Wide_Wide_Unbounded.
To_Unbounded_Wide_Wide_String (Text_Name);
Self.Buffer.Initialize (Text_Name);
Self.Read_All_Tokens (Self.Buffer'Unchecked_Access);
Program.Parsers.Parse
(Self'Unchecked_Access,
Self.Tokens'Unchecked_Access,
Self.Subpool,
Units,
Pragmas,
Standard);
end Parse_File;
---------------------
-- Read_All_Tokens --
---------------------
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access)
is
Token : Program.Lexical_Elements.Lexical_Element_Kind;
Scanner : aliased Program.Scanners.Scanner;
Dest : aliased Scanner_Destination (Self, Scanner'Access);
Handler : aliased Program.Lexical_Handlers.Handler (Dest'Access);
begin
Buffer.Rewind;
Scanner.Set_Source (Buffer);
Scanner.Set_Handler (Handler'Unchecked_Access);
loop
Scanner.Get_Token (Token);
exit when Token in Program.Lexical_Elements.End_Of_Input;
end loop;
end Read_All_Tokens;
----------
-- Text --
----------
overriding function Text
(Self : Compilation;
Span : Program.Source_Buffers.Span) return Program.Text is
begin
return Self.Buffer.Text (Span);
end Text;
---------------
-- Text_Name --
---------------
overriding function Text_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Text_Name);
end Text_Name;
end Program.Plain_Compilations;
| true |
-- SPDX-FileCopyrightText: 2019-2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Handlers;
with Program.Scanner_Destinations;
with Program.Scanners;
with Program.Symbols;
package body Program.Plain_Compilations is
type Scanner_Destination
(Comp : not null access Compilation;
Scanner : not null access Program.Scanners.Scanner)
is
new Program.Scanner_Destinations.Scanner_Destination with
record
Line_From : Positive := 1;
end record;
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive);
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token);
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access);
-------------
-- Context --
-------------
overriding function Context
(Self : Compilation) return not null Program.Contexts.Context_Access is
begin
return Program.Contexts.Context_Access (Self.Context);
end Context;
--------------
-- Get_Span --
--------------
overriding procedure Get_Span
(Self : Compilation;
Span : Program.Source_Buffers.Span;
From_Line : out Positive;
To_Line : out Positive;
From_Column : out Positive;
To_Column : out Positive) is
begin
for J in Self.Line_Spans.First_Index .. Self.Line_Spans.Last_Index loop
declare
SJ : constant Program.Source_Buffers.Span := Self.Line_Spans (J);
begin
if Span.From in SJ.From .. SJ.To then
From_Line := J;
From_Column := Span.From - SJ.From + 1;
for K in J .. Self.Line_Spans.Last_Index loop
declare
SK : constant Source_Buffers.Span := Self.Line_Spans (K);
begin
if Span.To in SK.From .. SK.To then
To_Line := K;
To_Column := Span.To - SK.From + 1;
return;
end if;
end;
end loop;
end if;
end;
end loop;
raise Constraint_Error;
end Get_Span;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Compilation'Class;
Context : not null Program.Contexts.Context_Access) is
begin
Self.Context := Plain_Context_Access (Context);
end Initialize;
---------------------
-- Lexical_Element --
---------------------
overriding function Lexical_Element
(Self : Compilation;
Index : Positive)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Tokens.Element (Index);
end Lexical_Element;
---------------------------
-- Lexical_Element_Count --
---------------------------
overriding function Lexical_Element_Count
(Self : Compilation) return Natural is
begin
return Self.Tokens.Length;
end Lexical_Element_Count;
----------
-- Line --
----------
overriding function Line
(Self : Compilation;
Index : Positive) return Program.Text is
begin
return Self.Buffer.Text (Self.Line_Spans (Index));
end Line;
----------------
-- Line_Count --
----------------
overriding function Line_Count (Self : Compilation) return Natural is
begin
return Self.Line_Spans.Last_Index;
end Line_Count;
--------------
-- New_Line --
--------------
overriding procedure New_Line
(Self : in out Scanner_Destination;
Unused : Positive)
is
Span : constant Program.Source_Buffers.Span :=
Self.Scanner.Get_Span;
begin
Self.Comp.Line_Spans.Append
((From => Self.Line_From,
To => Span.From - 1));
Self.Line_From := Span.To + 1;
end New_Line;
---------------
-- New_Token --
---------------
overriding procedure New_Token
(Self : in out Scanner_Destination;
Token : Program.Scanner_Destinations.Token)
is
use all type Program.Lexical_Elements.Lexical_Element_Kind;
Symbol : Program.Symbols.Symbol := Program.Symbols.No_Symbol;
begin
if Token.Kind = Identifier then
Self.Comp.Context.Find_Or_Create_Symbol
(Self.Comp.Buffer'Unchecked_Access, Token.Span, Symbol);
elsif Token.Kind in Character_Literal | String_Literal then
Symbol := Self.Comp.Context.Find (Self.Comp.Buffer.Text (Token.Span));
elsif Token.Kind in Program.Lexical_Elements.Operator_Kind then
Symbol := Program.Symbols.To_Symbol (Token.Kind);
end if;
Self.Comp.Tokens.Append
(Token.Span,
Token.Kind,
Symbol);
end New_Token;
-----------------
-- Object_Name --
-----------------
overriding function Object_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Object_Name);
end Object_Name;
----------------
-- Parse_File --
----------------
not overriding procedure Parse_File
(Self : aliased in out Compilation;
Text_Name : Program.Text;
Units : out Program.Parsers.Unit_Vectors.Vector;
Pragmas : out Program.Parsers.Element_Vectors.Vector;
Standard : Boolean := False) is
begin
Self.Text_Name := Ada.Strings.Wide_Wide_Unbounded.
To_Unbounded_Wide_Wide_String (Text_Name);
Self.Buffer.Initialize (Text_Name);
Self.Read_All_Tokens (Self.Buffer'Unchecked_Access);
Program.Parsers.Parse
(Self'Unchecked_Access,
Self.Tokens'Unchecked_Access,
Self.Subpool,
Units,
Pragmas,
Standard);
end Parse_File;
---------------------
-- Read_All_Tokens --
---------------------
procedure Read_All_Tokens
(Self : access Compilation;
Buffer : Program.Source_Buffers.Source_Buffer_Access)
is
Token : Program.Lexical_Elements.Lexical_Element_Kind;
Scanner : aliased Program.Scanners.Scanner;
Dest : aliased Scanner_Destination (Self, Scanner'Access);
Handler : aliased Program.Lexical_Handlers.Handler (Dest'Access);
begin
Buffer.Rewind;
Scanner.Set_Source (Buffer);
Scanner.Set_Handler (Handler'Unchecked_Access);
loop
Scanner.Get_Token (Token);
exit when Token in Program.Lexical_Elements.End_Of_Input;
end loop;
end Read_All_Tokens;
----------
-- Text --
----------
overriding function Text
(Self : Compilation;
Span : Program.Source_Buffers.Span) return Program.Text is
begin
return Self.Buffer.Text (Span);
end Text;
---------------
-- Text_Name --
---------------
overriding function Text_Name (Self : Compilation) return Program.Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Text_Name);
end Text_Name;
end Program.Plain_Compilations;
|
[
{
"context": "-- Copyright (c) 2021 Devin Hill\n-- zlib License -- see LICENSE for details.\n\n\npac",
"end": 32,
"score": 0.9998228549957275,
"start": 22,
"tag": "NAME",
"value": "Devin Hill"
}
] |
src/GBA.Display.Backgrounds.Refs.adb
|
98devin/ada-gba-dev
| 7 |
-- Copyright (c) 2021 Devin Hill
-- zlib License -- see LICENSE for details.
package body GBA.Display.Backgrounds.Refs is
function ID (This : BG_Ref'Class) return BG_ID is
( This.ID );
function Priority (This : BG_Ref'Class) return Display_Priority is
( This.Control.Priority );
function Mosaic_Enabled (This : BG_Ref'Class) return Boolean is
( This.Control.Enable_Mosaic );
procedure Set_Priority
(This : in out BG_Ref'Class; Priority : Display_Priority) is
begin
This.Control.Priority := Priority;
end;
procedure Enable_Mosaic
(This : in out BG_Ref'Class; Enable : Boolean := True) is
begin
This.Control.Enable_Mosaic := Enable;
end;
procedure Update_Control_Info (This : in out BG_Ref'Class) is
begin
Update (BG_Control_Info (This.Control.all));
end;
procedure Refresh_Offset_Register (This : in out Reg_BG_Ref'Class)
with Inline_Always is
begin
Set_Offset (This.ID, This.Offset);
end;
function Offset (This : Reg_BG_Ref'Class) return BG_Offset_Info is
( This.Offset );
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; Offset : BG_Offset_Info ) is
begin
This.Offset := Offset;
Refresh_Offset_Register (This);
end;
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; X, Y : BG_Scroll_Offset ) is
begin
This.Offset := (X => X, Y => Y);
Refresh_Offset_Register (This);
end;
procedure Set_Offset_X
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.X := Value;
Refresh_Offset_Register (This);
end;
procedure Set_Offset_Y
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.Y := Value;
Refresh_Offset_Register (This);
end;
procedure Move_Offset
(This : in out Reg_BG_Ref'Class; DX, DY : BG_Scroll_Offset := 0) is
begin
This.Offset :=
( X => This.Offset.X + DX
, Y => This.Offset.Y + DY
);
Refresh_Offset_Register (This);
end;
procedure Update_Offset (This : in out Reg_BG_Ref'Class) is
begin
Update (This.Offset);
Refresh_Offset_Register (This);
end;
procedure Refresh_Transform_Info (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Transform (This.ID, This.Transform_Info);
end;
procedure Refresh_Affine_Matrix (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Affine_Matrix (This.ID, This.Transform_Info.Affine_Matrix);
end;
procedure Refresh_Reference_Point (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Reference_Point (This.ID, This.Transform_Info.Reference_Point);
end;
function Transform (This : Aff_BG_Ref'Class)
return Affine_Transform_Matrix is
begin
return This.Transform_Info.Affine_Matrix;
end;
function Reference_Point (This : Aff_BG_Ref'Class)
return BG_Reference_Point is
begin
return This.Transform_Info.Reference_Point;
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class;
Reference_Point : BG_Reference_Point) is
begin
This.Transform_Info.Reference_Point := Reference_Point;
Refresh_Reference_Point (This);
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class; X, Y : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point := (X => X, Y => Y);
Refresh_Reference_Point (This);
end;
procedure Set_Reference_X
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.X := Value;
Set_Reference_X (This.ID, Value);
end;
procedure Set_Reference_Y
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.Y := Value;
Set_Reference_Y (This.ID, Value);
end;
procedure Move_Reference_Point
(This : in out Aff_BG_Ref'Class; DX, DY : BG_Reference_Point_Coordinate := 0.0) is
RP : BG_Reference_Point renames This.Transform_Info.Reference_Point;
begin
RP := (X => RP.X + DX, Y => RP.Y + DY);
Refresh_Reference_Point (This);
end;
procedure Update_Transform (This : in out Aff_BG_Ref'Class) is
begin
Update (This.Transform_Info);
Refresh_Transform_Info (This);
end;
end GBA.Display.Backgrounds.Refs;
|
30611
|
-- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
package body GBA.Display.Backgrounds.Refs is
function ID (This : BG_Ref'Class) return BG_ID is
( This.ID );
function Priority (This : BG_Ref'Class) return Display_Priority is
( This.Control.Priority );
function Mosaic_Enabled (This : BG_Ref'Class) return Boolean is
( This.Control.Enable_Mosaic );
procedure Set_Priority
(This : in out BG_Ref'Class; Priority : Display_Priority) is
begin
This.Control.Priority := Priority;
end;
procedure Enable_Mosaic
(This : in out BG_Ref'Class; Enable : Boolean := True) is
begin
This.Control.Enable_Mosaic := Enable;
end;
procedure Update_Control_Info (This : in out BG_Ref'Class) is
begin
Update (BG_Control_Info (This.Control.all));
end;
procedure Refresh_Offset_Register (This : in out Reg_BG_Ref'Class)
with Inline_Always is
begin
Set_Offset (This.ID, This.Offset);
end;
function Offset (This : Reg_BG_Ref'Class) return BG_Offset_Info is
( This.Offset );
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; Offset : BG_Offset_Info ) is
begin
This.Offset := Offset;
Refresh_Offset_Register (This);
end;
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; X, Y : BG_Scroll_Offset ) is
begin
This.Offset := (X => X, Y => Y);
Refresh_Offset_Register (This);
end;
procedure Set_Offset_X
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.X := Value;
Refresh_Offset_Register (This);
end;
procedure Set_Offset_Y
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.Y := Value;
Refresh_Offset_Register (This);
end;
procedure Move_Offset
(This : in out Reg_BG_Ref'Class; DX, DY : BG_Scroll_Offset := 0) is
begin
This.Offset :=
( X => This.Offset.X + DX
, Y => This.Offset.Y + DY
);
Refresh_Offset_Register (This);
end;
procedure Update_Offset (This : in out Reg_BG_Ref'Class) is
begin
Update (This.Offset);
Refresh_Offset_Register (This);
end;
procedure Refresh_Transform_Info (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Transform (This.ID, This.Transform_Info);
end;
procedure Refresh_Affine_Matrix (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Affine_Matrix (This.ID, This.Transform_Info.Affine_Matrix);
end;
procedure Refresh_Reference_Point (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Reference_Point (This.ID, This.Transform_Info.Reference_Point);
end;
function Transform (This : Aff_BG_Ref'Class)
return Affine_Transform_Matrix is
begin
return This.Transform_Info.Affine_Matrix;
end;
function Reference_Point (This : Aff_BG_Ref'Class)
return BG_Reference_Point is
begin
return This.Transform_Info.Reference_Point;
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class;
Reference_Point : BG_Reference_Point) is
begin
This.Transform_Info.Reference_Point := Reference_Point;
Refresh_Reference_Point (This);
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class; X, Y : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point := (X => X, Y => Y);
Refresh_Reference_Point (This);
end;
procedure Set_Reference_X
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.X := Value;
Set_Reference_X (This.ID, Value);
end;
procedure Set_Reference_Y
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.Y := Value;
Set_Reference_Y (This.ID, Value);
end;
procedure Move_Reference_Point
(This : in out Aff_BG_Ref'Class; DX, DY : BG_Reference_Point_Coordinate := 0.0) is
RP : BG_Reference_Point renames This.Transform_Info.Reference_Point;
begin
RP := (X => RP.X + DX, Y => RP.Y + DY);
Refresh_Reference_Point (This);
end;
procedure Update_Transform (This : in out Aff_BG_Ref'Class) is
begin
Update (This.Transform_Info);
Refresh_Transform_Info (This);
end;
end GBA.Display.Backgrounds.Refs;
| true |
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI
-- zlib License -- see LICENSE for details.
package body GBA.Display.Backgrounds.Refs is
function ID (This : BG_Ref'Class) return BG_ID is
( This.ID );
function Priority (This : BG_Ref'Class) return Display_Priority is
( This.Control.Priority );
function Mosaic_Enabled (This : BG_Ref'Class) return Boolean is
( This.Control.Enable_Mosaic );
procedure Set_Priority
(This : in out BG_Ref'Class; Priority : Display_Priority) is
begin
This.Control.Priority := Priority;
end;
procedure Enable_Mosaic
(This : in out BG_Ref'Class; Enable : Boolean := True) is
begin
This.Control.Enable_Mosaic := Enable;
end;
procedure Update_Control_Info (This : in out BG_Ref'Class) is
begin
Update (BG_Control_Info (This.Control.all));
end;
procedure Refresh_Offset_Register (This : in out Reg_BG_Ref'Class)
with Inline_Always is
begin
Set_Offset (This.ID, This.Offset);
end;
function Offset (This : Reg_BG_Ref'Class) return BG_Offset_Info is
( This.Offset );
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; Offset : BG_Offset_Info ) is
begin
This.Offset := Offset;
Refresh_Offset_Register (This);
end;
procedure Set_Offset
( This : in out Reg_BG_Ref'Class; X, Y : BG_Scroll_Offset ) is
begin
This.Offset := (X => X, Y => Y);
Refresh_Offset_Register (This);
end;
procedure Set_Offset_X
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.X := Value;
Refresh_Offset_Register (This);
end;
procedure Set_Offset_Y
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset) is
begin
This.Offset.Y := Value;
Refresh_Offset_Register (This);
end;
procedure Move_Offset
(This : in out Reg_BG_Ref'Class; DX, DY : BG_Scroll_Offset := 0) is
begin
This.Offset :=
( X => This.Offset.X + DX
, Y => This.Offset.Y + DY
);
Refresh_Offset_Register (This);
end;
procedure Update_Offset (This : in out Reg_BG_Ref'Class) is
begin
Update (This.Offset);
Refresh_Offset_Register (This);
end;
procedure Refresh_Transform_Info (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Transform (This.ID, This.Transform_Info);
end;
procedure Refresh_Affine_Matrix (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Affine_Matrix (This.ID, This.Transform_Info.Affine_Matrix);
end;
procedure Refresh_Reference_Point (This : Aff_BG_Ref'Class)
with Inline_Always is
begin
Set_Reference_Point (This.ID, This.Transform_Info.Reference_Point);
end;
function Transform (This : Aff_BG_Ref'Class)
return Affine_Transform_Matrix is
begin
return This.Transform_Info.Affine_Matrix;
end;
function Reference_Point (This : Aff_BG_Ref'Class)
return BG_Reference_Point is
begin
return This.Transform_Info.Reference_Point;
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class;
Reference_Point : BG_Reference_Point) is
begin
This.Transform_Info.Reference_Point := Reference_Point;
Refresh_Reference_Point (This);
end;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class; X, Y : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point := (X => X, Y => Y);
Refresh_Reference_Point (This);
end;
procedure Set_Reference_X
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.X := Value;
Set_Reference_X (This.ID, Value);
end;
procedure Set_Reference_Y
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate) is
begin
This.Transform_Info.Reference_Point.Y := Value;
Set_Reference_Y (This.ID, Value);
end;
procedure Move_Reference_Point
(This : in out Aff_BG_Ref'Class; DX, DY : BG_Reference_Point_Coordinate := 0.0) is
RP : BG_Reference_Point renames This.Transform_Info.Reference_Point;
begin
RP := (X => RP.X + DX, Y => RP.Y + DY);
Refresh_Reference_Point (This);
end;
procedure Update_Transform (This : in out Aff_BG_Ref'Class) is
begin
Update (This.Transform_Info);
Refresh_Transform_Info (This);
end;
end GBA.Display.Backgrounds.Refs;
|
[
{
"context": "-- Copyright (C) 2019 Thierry Rascle <[email protected]>\n-- MIT license. Please refer t",
"end": 36,
"score": 0.9998739361763,
"start": 22,
"tag": "NAME",
"value": "Thierry Rascle"
},
{
"context": "-- Copyright (C) 2019 Thierry Rascle <[email protected]>\n-- MIT license. Please refer to the LICENSE file",
"end": 54,
"score": 0.9999340176582336,
"start": 38,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/apsepp-test_reporter_class-stub-create.ads
|
thierr26/ada-apsepp
| 0 |
-- Copyright (C) 2019 Thierry Rascle <[email protected]>
-- MIT license. Please refer to the LICENSE file.
function Apsepp.Test_Reporter_Class.Stub.Create return Test_Reporter_Stub;
|
9325
|
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
function Apsepp.Test_Reporter_Class.Stub.Create return Test_Reporter_Stub;
| true |
-- Copyright (C) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
-- MIT license. Please refer to the LICENSE file.
function Apsepp.Test_Reporter_Class.Stub.Create return Test_Reporter_Stub;
|
[
{
"context": " --\n-- Copyright © 2011, Vadim Godunko <[email protected]> --\n-- Al",
"end": 824,
"score": 0.9998863339424133,
"start": 811,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2011, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 844,
"score": 0.9999321699142456,
"start": 826,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/league/matreshka-internals-settings.ads
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Holders;
with League.Strings;
with Matreshka.Atomics.Counters;
package Matreshka.Internals.Settings is
pragma Preelaborate;
type Abstract_Manager is abstract tagged limited null record;
type Manager_Access is access all Abstract_Manager'Class;
type Abstract_Settings (Manager : not null access Abstract_Manager'Class) is
abstract tagged limited
record
Counter : Matreshka.Atomics.Counters.Counter;
end record;
not overriding function Contains
(Self : Abstract_Settings;
Key : League.Strings.Universal_String) return Boolean is abstract;
not overriding procedure Finalize
(Self : not null access Abstract_Settings) is null;
not overriding function Name
(Self : not null access Abstract_Settings)
return League.Strings.Universal_String is abstract;
-- Returns name of the storage. For INI file storage it is name of the
-- file, for Windows Registry storage it is system registry path.
not overriding procedure Remove
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String) is abstract;
not overriding procedure Set_Value
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String;
Value : League.Holders.Holder) is abstract;
not overriding procedure Sync (Self : in out Abstract_Settings) is abstract;
not overriding function Value
(Self : Abstract_Settings;
Key : League.Strings.Universal_String)
return League.Holders.Holder is abstract;
type Settings_Access is access all Abstract_Settings'Class;
procedure Reference (Self : not null Settings_Access);
-- Increments reference counter.
procedure Dereference (Self : in out Settings_Access);
-- Decrements reference counter. Call Finalize and deallocate memory when
-- reference counter reach zero. Always sets Self to null.
----------------------
-- Abstract_Manager --
----------------------
not overriding function Create
(Self : not null access Abstract_Manager)
return not null Settings_Access is abstract;
-- Creates fallbacks proxy and set of underling settings storages.
not overriding function Create
(Self : not null access Abstract_Manager;
File_Name : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified file.
not overriding function Create
(Self : not null access Abstract_Manager;
Organization_Name : League.Strings.Universal_String;
Organization_Domain : League.Strings.Universal_String;
Application : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified organization and application.
not overriding function To_Storage_Key
(Self : not null access Abstract_Manager;
Key : League.Strings.Universal_String)
return League.Strings.Universal_String is abstract;
-- Converts specified key from user's representation into storage specific
-- representation.
end Matreshka.Internals.Settings;
|
12120
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, <NAME> <<EMAIL>> --
-- 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 League.Holders;
with League.Strings;
with Matreshka.Atomics.Counters;
package Matreshka.Internals.Settings is
pragma Preelaborate;
type Abstract_Manager is abstract tagged limited null record;
type Manager_Access is access all Abstract_Manager'Class;
type Abstract_Settings (Manager : not null access Abstract_Manager'Class) is
abstract tagged limited
record
Counter : Matreshka.Atomics.Counters.Counter;
end record;
not overriding function Contains
(Self : Abstract_Settings;
Key : League.Strings.Universal_String) return Boolean is abstract;
not overriding procedure Finalize
(Self : not null access Abstract_Settings) is null;
not overriding function Name
(Self : not null access Abstract_Settings)
return League.Strings.Universal_String is abstract;
-- Returns name of the storage. For INI file storage it is name of the
-- file, for Windows Registry storage it is system registry path.
not overriding procedure Remove
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String) is abstract;
not overriding procedure Set_Value
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String;
Value : League.Holders.Holder) is abstract;
not overriding procedure Sync (Self : in out Abstract_Settings) is abstract;
not overriding function Value
(Self : Abstract_Settings;
Key : League.Strings.Universal_String)
return League.Holders.Holder is abstract;
type Settings_Access is access all Abstract_Settings'Class;
procedure Reference (Self : not null Settings_Access);
-- Increments reference counter.
procedure Dereference (Self : in out Settings_Access);
-- Decrements reference counter. Call Finalize and deallocate memory when
-- reference counter reach zero. Always sets Self to null.
----------------------
-- Abstract_Manager --
----------------------
not overriding function Create
(Self : not null access Abstract_Manager)
return not null Settings_Access is abstract;
-- Creates fallbacks proxy and set of underling settings storages.
not overriding function Create
(Self : not null access Abstract_Manager;
File_Name : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified file.
not overriding function Create
(Self : not null access Abstract_Manager;
Organization_Name : League.Strings.Universal_String;
Organization_Domain : League.Strings.Universal_String;
Application : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified organization and application.
not overriding function To_Storage_Key
(Self : not null access Abstract_Manager;
Key : League.Strings.Universal_String)
return League.Strings.Universal_String is abstract;
-- Converts specified key from user's representation into storage specific
-- representation.
end Matreshka.Internals.Settings;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- 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 League.Holders;
with League.Strings;
with Matreshka.Atomics.Counters;
package Matreshka.Internals.Settings is
pragma Preelaborate;
type Abstract_Manager is abstract tagged limited null record;
type Manager_Access is access all Abstract_Manager'Class;
type Abstract_Settings (Manager : not null access Abstract_Manager'Class) is
abstract tagged limited
record
Counter : Matreshka.Atomics.Counters.Counter;
end record;
not overriding function Contains
(Self : Abstract_Settings;
Key : League.Strings.Universal_String) return Boolean is abstract;
not overriding procedure Finalize
(Self : not null access Abstract_Settings) is null;
not overriding function Name
(Self : not null access Abstract_Settings)
return League.Strings.Universal_String is abstract;
-- Returns name of the storage. For INI file storage it is name of the
-- file, for Windows Registry storage it is system registry path.
not overriding procedure Remove
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String) is abstract;
not overriding procedure Set_Value
(Self : in out Abstract_Settings;
Key : League.Strings.Universal_String;
Value : League.Holders.Holder) is abstract;
not overriding procedure Sync (Self : in out Abstract_Settings) is abstract;
not overriding function Value
(Self : Abstract_Settings;
Key : League.Strings.Universal_String)
return League.Holders.Holder is abstract;
type Settings_Access is access all Abstract_Settings'Class;
procedure Reference (Self : not null Settings_Access);
-- Increments reference counter.
procedure Dereference (Self : in out Settings_Access);
-- Decrements reference counter. Call Finalize and deallocate memory when
-- reference counter reach zero. Always sets Self to null.
----------------------
-- Abstract_Manager --
----------------------
not overriding function Create
(Self : not null access Abstract_Manager)
return not null Settings_Access is abstract;
-- Creates fallbacks proxy and set of underling settings storages.
not overriding function Create
(Self : not null access Abstract_Manager;
File_Name : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified file.
not overriding function Create
(Self : not null access Abstract_Manager;
Organization_Name : League.Strings.Universal_String;
Organization_Domain : League.Strings.Universal_String;
Application : League.Strings.Universal_String)
return not null Settings_Access is abstract;
-- Creates settings storage for the specified organization and application.
not overriding function To_Storage_Key
(Self : not null access Abstract_Manager;
Key : League.Strings.Universal_String)
return League.Strings.Universal_String is abstract;
-- Converts specified key from user's representation into storage specific
-- representation.
end Matreshka.Internals.Settings;
|
[
{
"context": "-- Copyright 2016 Steven Stewart-Gallus\n--\n-- Licensed under the Apache License, Version ",
"end": 39,
"score": 0.9996208548545837,
"start": 18,
"tag": "NAME",
"value": "Steven Stewart-Gallus"
}
] |
src/ada-pulse/src/pulse-context.ads
|
mstewartgallus/linted
| 0 |
-- Copyright 2016 Steven Stewart-Gallus
--
-- 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 System;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Libc.Stdint;
with Libc.Stddef;
with Pulse.Mainloop.API;
with Pulse.Def;
with Pulse.Proplist;
with Pulse.Sample;
package Pulse.Context with
Spark_Mode => Off is
type pa_context is limited private;
type pa_context_access is access all pa_context;
type pa_context_notify_cb_t is access procedure
(c : pa_context_access;
userdata : System.Address);
pragma Convention
(C,
pa_context_notify_cb_t); -- /usr/include/pulse/context.h:159
type pa_context_success_cb_t is access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
pragma Convention
(C,
pa_context_success_cb_t); -- /usr/include/pulse/context.h:162
type pa_context_event_cb_t is access procedure
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : System.Address;
arg4 : System.Address);
pragma Convention
(C,
pa_context_event_cb_t); -- /usr/include/pulse/context.h:169
function pa_context_new
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr)
return pa_context_access; -- /usr/include/pulse/context.h:174
pragma Import (C, pa_context_new, "pa_context_new");
function pa_context_new_with_proplist
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr;
proplist : Pulse.Proplist.pa_proplist_access)
return pa_context_access; -- /usr/include/pulse/context.h:179
pragma Import
(C,
pa_context_new_with_proplist,
"pa_context_new_with_proplist");
procedure pa_context_unref
(c : pa_context_access); -- /usr/include/pulse/context.h:182
pragma Import (C, pa_context_unref, "pa_context_unref");
function pa_context_ref
(c : pa_context_access)
return System.Address; -- /usr/include/pulse/context.h:185
pragma Import (C, pa_context_ref, "pa_context_ref");
procedure pa_context_set_state_callback
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:188
pragma Import
(C,
pa_context_set_state_callback,
"pa_context_set_state_callback");
procedure pa_context_set_event_callback
(p : System.Address;
cb : pa_context_event_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:192
pragma Import
(C,
pa_context_set_event_callback,
"pa_context_set_event_callback");
function pa_context_errno
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:195
pragma Import (C, pa_context_errno, "pa_context_errno");
function pa_context_is_pending
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:198
pragma Import (C, pa_context_is_pending, "pa_context_is_pending");
function pa_context_get_state
(c : pa_context_access)
return Pulse.Def.pa_context_state_t; -- /usr/include/pulse/context.h:201
pragma Import (C, pa_context_get_state, "pa_context_get_state");
function pa_context_connect
(c : pa_context_access;
server : Interfaces.C.Strings.chars_ptr;
flags : Pulse.Def.pa_context_flags_t;
api : access constant Pulse.Def.pa_spawn_api)
return int; -- /usr/include/pulse/context.h:211
pragma Import (C, pa_context_connect, "pa_context_connect");
procedure pa_context_disconnect
(c : pa_context_access); -- /usr/include/pulse/context.h:214
pragma Import (C, pa_context_disconnect, "pa_context_disconnect");
function pa_context_drain
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:217
pragma Import (C, pa_context_drain, "pa_context_drain");
function pa_context_exit_daemon
(c : pa_context_access;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:222
pragma Import (C, pa_context_exit_daemon, "pa_context_exit_daemon");
function pa_context_set_default_sink
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:225
pragma Import
(C,
pa_context_set_default_sink,
"pa_context_set_default_sink");
function pa_context_set_default_source
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:228
pragma Import
(C,
pa_context_set_default_source,
"pa_context_set_default_source");
function pa_context_is_local
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:231
pragma Import (C, pa_context_is_local, "pa_context_is_local");
function pa_context_set_name
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:234
pragma Import (C, pa_context_set_name, "pa_context_set_name");
function pa_context_get_server
(c : pa_context_access)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/context.h:237
pragma Import (C, pa_context_get_server, "pa_context_get_server");
function pa_context_get_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:240
pragma Import
(C,
pa_context_get_protocol_version,
"pa_context_get_protocol_version");
function pa_context_get_server_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:243
pragma Import
(C,
pa_context_get_server_protocol_version,
"pa_context_get_server_protocol_version");
function pa_context_proplist_update
(c : pa_context_access;
mode : Pulse.Proplist.pa_update_mode_t;
p : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:250
pragma Import (C, pa_context_proplist_update, "pa_context_proplist_update");
function pa_context_proplist_remove
(c : pa_context_access;
keys : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:253
pragma Import (C, pa_context_proplist_remove, "pa_context_proplist_remove");
function pa_context_get_index
(s : System.Address)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:258
pragma Import (C, pa_context_get_index, "pa_context_get_index");
function pa_context_rttime_new
(c : pa_context_access;
usec : Pulse.Sample.pa_usec_t;
cb : Pulse.Mainloop.API.pa_time_event_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:262
pragma Import (C, pa_context_rttime_new, "pa_context_rttime_new");
procedure pa_context_rttime_restart
(c : pa_context_access;
e : System.Address;
usec : Pulse.Sample.pa_usec_t); -- /usr/include/pulse/context.h:266
pragma Import (C, pa_context_rttime_restart, "pa_context_rttime_restart");
function pa_context_get_tile_size
(c : pa_context_access;
ss : access constant Pulse.Sample.pa_sample_spec)
return Libc.Stddef.size_t; -- /usr/include/pulse/context.h:281
pragma Import (C, pa_context_get_tile_size, "pa_context_get_tile_size");
private
type pa_context is limited record
null;
end record;
end Pulse.Context;
|
16620
|
-- Copyright 2016 <NAME>
--
-- 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 System;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Libc.Stdint;
with Libc.Stddef;
with Pulse.Mainloop.API;
with Pulse.Def;
with Pulse.Proplist;
with Pulse.Sample;
package Pulse.Context with
Spark_Mode => Off is
type pa_context is limited private;
type pa_context_access is access all pa_context;
type pa_context_notify_cb_t is access procedure
(c : pa_context_access;
userdata : System.Address);
pragma Convention
(C,
pa_context_notify_cb_t); -- /usr/include/pulse/context.h:159
type pa_context_success_cb_t is access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
pragma Convention
(C,
pa_context_success_cb_t); -- /usr/include/pulse/context.h:162
type pa_context_event_cb_t is access procedure
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : System.Address;
arg4 : System.Address);
pragma Convention
(C,
pa_context_event_cb_t); -- /usr/include/pulse/context.h:169
function pa_context_new
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr)
return pa_context_access; -- /usr/include/pulse/context.h:174
pragma Import (C, pa_context_new, "pa_context_new");
function pa_context_new_with_proplist
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr;
proplist : Pulse.Proplist.pa_proplist_access)
return pa_context_access; -- /usr/include/pulse/context.h:179
pragma Import
(C,
pa_context_new_with_proplist,
"pa_context_new_with_proplist");
procedure pa_context_unref
(c : pa_context_access); -- /usr/include/pulse/context.h:182
pragma Import (C, pa_context_unref, "pa_context_unref");
function pa_context_ref
(c : pa_context_access)
return System.Address; -- /usr/include/pulse/context.h:185
pragma Import (C, pa_context_ref, "pa_context_ref");
procedure pa_context_set_state_callback
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:188
pragma Import
(C,
pa_context_set_state_callback,
"pa_context_set_state_callback");
procedure pa_context_set_event_callback
(p : System.Address;
cb : pa_context_event_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:192
pragma Import
(C,
pa_context_set_event_callback,
"pa_context_set_event_callback");
function pa_context_errno
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:195
pragma Import (C, pa_context_errno, "pa_context_errno");
function pa_context_is_pending
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:198
pragma Import (C, pa_context_is_pending, "pa_context_is_pending");
function pa_context_get_state
(c : pa_context_access)
return Pulse.Def.pa_context_state_t; -- /usr/include/pulse/context.h:201
pragma Import (C, pa_context_get_state, "pa_context_get_state");
function pa_context_connect
(c : pa_context_access;
server : Interfaces.C.Strings.chars_ptr;
flags : Pulse.Def.pa_context_flags_t;
api : access constant Pulse.Def.pa_spawn_api)
return int; -- /usr/include/pulse/context.h:211
pragma Import (C, pa_context_connect, "pa_context_connect");
procedure pa_context_disconnect
(c : pa_context_access); -- /usr/include/pulse/context.h:214
pragma Import (C, pa_context_disconnect, "pa_context_disconnect");
function pa_context_drain
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:217
pragma Import (C, pa_context_drain, "pa_context_drain");
function pa_context_exit_daemon
(c : pa_context_access;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:222
pragma Import (C, pa_context_exit_daemon, "pa_context_exit_daemon");
function pa_context_set_default_sink
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:225
pragma Import
(C,
pa_context_set_default_sink,
"pa_context_set_default_sink");
function pa_context_set_default_source
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:228
pragma Import
(C,
pa_context_set_default_source,
"pa_context_set_default_source");
function pa_context_is_local
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:231
pragma Import (C, pa_context_is_local, "pa_context_is_local");
function pa_context_set_name
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:234
pragma Import (C, pa_context_set_name, "pa_context_set_name");
function pa_context_get_server
(c : pa_context_access)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/context.h:237
pragma Import (C, pa_context_get_server, "pa_context_get_server");
function pa_context_get_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:240
pragma Import
(C,
pa_context_get_protocol_version,
"pa_context_get_protocol_version");
function pa_context_get_server_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:243
pragma Import
(C,
pa_context_get_server_protocol_version,
"pa_context_get_server_protocol_version");
function pa_context_proplist_update
(c : pa_context_access;
mode : Pulse.Proplist.pa_update_mode_t;
p : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:250
pragma Import (C, pa_context_proplist_update, "pa_context_proplist_update");
function pa_context_proplist_remove
(c : pa_context_access;
keys : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:253
pragma Import (C, pa_context_proplist_remove, "pa_context_proplist_remove");
function pa_context_get_index
(s : System.Address)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:258
pragma Import (C, pa_context_get_index, "pa_context_get_index");
function pa_context_rttime_new
(c : pa_context_access;
usec : Pulse.Sample.pa_usec_t;
cb : Pulse.Mainloop.API.pa_time_event_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:262
pragma Import (C, pa_context_rttime_new, "pa_context_rttime_new");
procedure pa_context_rttime_restart
(c : pa_context_access;
e : System.Address;
usec : Pulse.Sample.pa_usec_t); -- /usr/include/pulse/context.h:266
pragma Import (C, pa_context_rttime_restart, "pa_context_rttime_restart");
function pa_context_get_tile_size
(c : pa_context_access;
ss : access constant Pulse.Sample.pa_sample_spec)
return Libc.Stddef.size_t; -- /usr/include/pulse/context.h:281
pragma Import (C, pa_context_get_tile_size, "pa_context_get_tile_size");
private
type pa_context is limited record
null;
end record;
end Pulse.Context;
| true |
-- Copyright 2016 PI:NAME:<NAME>END_PI
--
-- 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 System;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Libc.Stdint;
with Libc.Stddef;
with Pulse.Mainloop.API;
with Pulse.Def;
with Pulse.Proplist;
with Pulse.Sample;
package Pulse.Context with
Spark_Mode => Off is
type pa_context is limited private;
type pa_context_access is access all pa_context;
type pa_context_notify_cb_t is access procedure
(c : pa_context_access;
userdata : System.Address);
pragma Convention
(C,
pa_context_notify_cb_t); -- /usr/include/pulse/context.h:159
type pa_context_success_cb_t is access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
pragma Convention
(C,
pa_context_success_cb_t); -- /usr/include/pulse/context.h:162
type pa_context_event_cb_t is access procedure
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : System.Address;
arg4 : System.Address);
pragma Convention
(C,
pa_context_event_cb_t); -- /usr/include/pulse/context.h:169
function pa_context_new
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr)
return pa_context_access; -- /usr/include/pulse/context.h:174
pragma Import (C, pa_context_new, "pa_context_new");
function pa_context_new_with_proplist
(mainloop : access Pulse.Mainloop.API.pa_mainloop_api;
name : Interfaces.C.Strings.chars_ptr;
proplist : Pulse.Proplist.pa_proplist_access)
return pa_context_access; -- /usr/include/pulse/context.h:179
pragma Import
(C,
pa_context_new_with_proplist,
"pa_context_new_with_proplist");
procedure pa_context_unref
(c : pa_context_access); -- /usr/include/pulse/context.h:182
pragma Import (C, pa_context_unref, "pa_context_unref");
function pa_context_ref
(c : pa_context_access)
return System.Address; -- /usr/include/pulse/context.h:185
pragma Import (C, pa_context_ref, "pa_context_ref");
procedure pa_context_set_state_callback
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:188
pragma Import
(C,
pa_context_set_state_callback,
"pa_context_set_state_callback");
procedure pa_context_set_event_callback
(p : System.Address;
cb : pa_context_event_cb_t;
userdata : System.Address); -- /usr/include/pulse/context.h:192
pragma Import
(C,
pa_context_set_event_callback,
"pa_context_set_event_callback");
function pa_context_errno
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:195
pragma Import (C, pa_context_errno, "pa_context_errno");
function pa_context_is_pending
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:198
pragma Import (C, pa_context_is_pending, "pa_context_is_pending");
function pa_context_get_state
(c : pa_context_access)
return Pulse.Def.pa_context_state_t; -- /usr/include/pulse/context.h:201
pragma Import (C, pa_context_get_state, "pa_context_get_state");
function pa_context_connect
(c : pa_context_access;
server : Interfaces.C.Strings.chars_ptr;
flags : Pulse.Def.pa_context_flags_t;
api : access constant Pulse.Def.pa_spawn_api)
return int; -- /usr/include/pulse/context.h:211
pragma Import (C, pa_context_connect, "pa_context_connect");
procedure pa_context_disconnect
(c : pa_context_access); -- /usr/include/pulse/context.h:214
pragma Import (C, pa_context_disconnect, "pa_context_disconnect");
function pa_context_drain
(c : pa_context_access;
cb : pa_context_notify_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:217
pragma Import (C, pa_context_drain, "pa_context_drain");
function pa_context_exit_daemon
(c : pa_context_access;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:222
pragma Import (C, pa_context_exit_daemon, "pa_context_exit_daemon");
function pa_context_set_default_sink
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:225
pragma Import
(C,
pa_context_set_default_sink,
"pa_context_set_default_sink");
function pa_context_set_default_source
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:228
pragma Import
(C,
pa_context_set_default_source,
"pa_context_set_default_source");
function pa_context_is_local
(c : pa_context_access) return int; -- /usr/include/pulse/context.h:231
pragma Import (C, pa_context_is_local, "pa_context_is_local");
function pa_context_set_name
(c : pa_context_access;
name : Interfaces.C.Strings.chars_ptr;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:234
pragma Import (C, pa_context_set_name, "pa_context_set_name");
function pa_context_get_server
(c : pa_context_access)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/context.h:237
pragma Import (C, pa_context_get_server, "pa_context_get_server");
function pa_context_get_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:240
pragma Import
(C,
pa_context_get_protocol_version,
"pa_context_get_protocol_version");
function pa_context_get_server_protocol_version
(c : pa_context_access)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:243
pragma Import
(C,
pa_context_get_server_protocol_version,
"pa_context_get_server_protocol_version");
function pa_context_proplist_update
(c : pa_context_access;
mode : Pulse.Proplist.pa_update_mode_t;
p : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:250
pragma Import (C, pa_context_proplist_update, "pa_context_proplist_update");
function pa_context_proplist_remove
(c : pa_context_access;
keys : System.Address;
cb : pa_context_success_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:253
pragma Import (C, pa_context_proplist_remove, "pa_context_proplist_remove");
function pa_context_get_index
(s : System.Address)
return Libc.Stdint.uint32_t; -- /usr/include/pulse/context.h:258
pragma Import (C, pa_context_get_index, "pa_context_get_index");
function pa_context_rttime_new
(c : pa_context_access;
usec : Pulse.Sample.pa_usec_t;
cb : Pulse.Mainloop.API.pa_time_event_cb_t;
userdata : System.Address)
return System.Address; -- /usr/include/pulse/context.h:262
pragma Import (C, pa_context_rttime_new, "pa_context_rttime_new");
procedure pa_context_rttime_restart
(c : pa_context_access;
e : System.Address;
usec : Pulse.Sample.pa_usec_t); -- /usr/include/pulse/context.h:266
pragma Import (C, pa_context_rttime_restart, "pa_context_rttime_restart");
function pa_context_get_tile_size
(c : pa_context_access;
ss : access constant Pulse.Sample.pa_sample_spec)
return Libc.Stddef.size_t; -- /usr/include/pulse/context.h:281
pragma Import (C, pa_context_get_tile_size, "pa_context_get_tile_size");
private
type pa_context is limited record
null;
end record;
end Pulse.Context;
|
[
{
"context": "age stemmer with Snowball generator\n-- Written by Stephane Carrez ([email protected])\n-- All rights reserv",
"end": 164,
"score": 0.9998618364334106,
"start": 149,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "nowball generator\n-- Written by Stephane Carrez ([email protected])\n-- All rights reserved.\n--\n-- Redistribution a",
"end": 191,
"score": 0.9999262094497681,
"start": 166,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
ada/src/stemmer.ads
|
Klabauterman/snowball
| 547 |
-----------------------------------------------------------------------
-- stemmer -- Multi-language stemmer with Snowball generator
-- Written by Stephane Carrez ([email protected])
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
--
-- 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 Snowball project 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.
-----------------------------------------------------------------------
package Stemmer with SPARK_Mode is
pragma Preelaborate;
WORD_MAX_LENGTH : constant := 1024;
type Context_Type is abstract tagged private;
-- Apply the stemming algorithm on the word initialized in the context.
procedure Stem (Context : in out Context_Type;
Result : out Boolean) is abstract;
-- Stem the word and return True if it was reduced.
procedure Stem_Word (Context : in out Context_Type'Class;
Word : in String;
Result : out Boolean) with
Global => null,
Pre => Word'Length < WORD_MAX_LENGTH;
-- Get the stem or the input word unmodified.
function Get_Result (Context : in Context_Type'Class) return String with
Global => null,
Post => Get_Result'Result'Length < WORD_MAX_LENGTH;
private
type Mask_Type is mod 2**32;
-- A 32-bit character value that was read from UTF-8 sequence.
-- A modular value is used because shift and logical arithmetic is necessary.
type Utf8_Type is mod 2**32;
-- Index of the Grouping_Array. The index comes from the 32-bit character value
-- minus a starting offset. We don't expect large tables and we check against
-- a maximum value.
subtype Grouping_Index is Utf8_Type range 0 .. 16384;
type Grouping_Array is array (Grouping_Index range <>) of Boolean with Pack;
subtype Among_Index is Natural range 0 .. 65535;
subtype Among_Start_Index is Among_Index range 1 .. Among_Index'Last;
subtype Operation_Index is Natural range 0 .. 65535;
subtype Result_Index is Integer range -1 .. WORD_MAX_LENGTH - 1;
subtype Char_Index is Result_Index range 0 .. Result_Index'Last;
type Among_Type is record
First : Among_Start_Index;
Last : Among_Index;
Substring_I : Integer;
Result : Integer;
Operation : Operation_Index;
end record;
type Among_Array_Type is array (Natural range <>) of Among_Type;
function Eq_S (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S'Result = 0 or Eq_S'Result = S'Length;
function Eq_S_Backward (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S_Backward'Result = 0 or Eq_S_Backward'Result = S'Length;
procedure Find_Among (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
procedure Find_Among_Backward (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
function Skip_Utf8 (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8 (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
procedure Get_Utf8 (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
procedure Get_Utf8_Backward (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
function Length (Context : in Context_Type'Class) return Natural;
function Length_Utf8 (Context : in Context_Type'Class) return Natural;
function Check_Among (Context : in Context_Type'Class;
Pos : in Char_Index;
Shift : in Natural;
Mask : in Mask_Type) return Boolean;
procedure Out_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Out_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Replace (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String;
Adjustment : out Integer) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
procedure Slice_Del (Context : in out Context_Type'Class) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L;
procedure Slice_From (Context : in out Context_Type'Class;
Text : in String) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L
and Context.L - Context.Lb + Text'Length + Context.Ket - Context.Bra < Context.P'Length;
function Slice_To (Context : in Context_Type'Class) return String;
procedure Insert (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
-- The context indexes follow the C paradigm: they start at 0 for the first character.
-- This is necessary because several algorithms rely on this when they compare the
-- cursor position ('C') or setup some markers from the cursor.
type Context_Type is abstract tagged record
C : Char_Index := 0;
L : Char_Index := 0;
Lb : Char_Index := 0;
Bra : Char_Index := 0;
Ket : Char_Index := 0;
P : String (1 .. WORD_MAX_LENGTH);
end record;
end Stemmer;
|
21816
|
-----------------------------------------------------------------------
-- stemmer -- Multi-language stemmer with Snowball generator
-- Written by <NAME> (<EMAIL>)
-- All rights reserved.
--
-- 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 Snowball project 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.
-----------------------------------------------------------------------
package Stemmer with SPARK_Mode is
pragma Preelaborate;
WORD_MAX_LENGTH : constant := 1024;
type Context_Type is abstract tagged private;
-- Apply the stemming algorithm on the word initialized in the context.
procedure Stem (Context : in out Context_Type;
Result : out Boolean) is abstract;
-- Stem the word and return True if it was reduced.
procedure Stem_Word (Context : in out Context_Type'Class;
Word : in String;
Result : out Boolean) with
Global => null,
Pre => Word'Length < WORD_MAX_LENGTH;
-- Get the stem or the input word unmodified.
function Get_Result (Context : in Context_Type'Class) return String with
Global => null,
Post => Get_Result'Result'Length < WORD_MAX_LENGTH;
private
type Mask_Type is mod 2**32;
-- A 32-bit character value that was read from UTF-8 sequence.
-- A modular value is used because shift and logical arithmetic is necessary.
type Utf8_Type is mod 2**32;
-- Index of the Grouping_Array. The index comes from the 32-bit character value
-- minus a starting offset. We don't expect large tables and we check against
-- a maximum value.
subtype Grouping_Index is Utf8_Type range 0 .. 16384;
type Grouping_Array is array (Grouping_Index range <>) of Boolean with Pack;
subtype Among_Index is Natural range 0 .. 65535;
subtype Among_Start_Index is Among_Index range 1 .. Among_Index'Last;
subtype Operation_Index is Natural range 0 .. 65535;
subtype Result_Index is Integer range -1 .. WORD_MAX_LENGTH - 1;
subtype Char_Index is Result_Index range 0 .. Result_Index'Last;
type Among_Type is record
First : Among_Start_Index;
Last : Among_Index;
Substring_I : Integer;
Result : Integer;
Operation : Operation_Index;
end record;
type Among_Array_Type is array (Natural range <>) of Among_Type;
function Eq_S (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S'Result = 0 or Eq_S'Result = S'Length;
function Eq_S_Backward (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S_Backward'Result = 0 or Eq_S_Backward'Result = S'Length;
procedure Find_Among (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
procedure Find_Among_Backward (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
function Skip_Utf8 (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8 (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
procedure Get_Utf8 (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
procedure Get_Utf8_Backward (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
function Length (Context : in Context_Type'Class) return Natural;
function Length_Utf8 (Context : in Context_Type'Class) return Natural;
function Check_Among (Context : in Context_Type'Class;
Pos : in Char_Index;
Shift : in Natural;
Mask : in Mask_Type) return Boolean;
procedure Out_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Out_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Replace (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String;
Adjustment : out Integer) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
procedure Slice_Del (Context : in out Context_Type'Class) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L;
procedure Slice_From (Context : in out Context_Type'Class;
Text : in String) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L
and Context.L - Context.Lb + Text'Length + Context.Ket - Context.Bra < Context.P'Length;
function Slice_To (Context : in Context_Type'Class) return String;
procedure Insert (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
-- The context indexes follow the C paradigm: they start at 0 for the first character.
-- This is necessary because several algorithms rely on this when they compare the
-- cursor position ('C') or setup some markers from the cursor.
type Context_Type is abstract tagged record
C : Char_Index := 0;
L : Char_Index := 0;
Lb : Char_Index := 0;
Bra : Char_Index := 0;
Ket : Char_Index := 0;
P : String (1 .. WORD_MAX_LENGTH);
end record;
end Stemmer;
| true |
-----------------------------------------------------------------------
-- stemmer -- Multi-language stemmer with Snowball generator
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
-- All rights reserved.
--
-- 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 Snowball project 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.
-----------------------------------------------------------------------
package Stemmer with SPARK_Mode is
pragma Preelaborate;
WORD_MAX_LENGTH : constant := 1024;
type Context_Type is abstract tagged private;
-- Apply the stemming algorithm on the word initialized in the context.
procedure Stem (Context : in out Context_Type;
Result : out Boolean) is abstract;
-- Stem the word and return True if it was reduced.
procedure Stem_Word (Context : in out Context_Type'Class;
Word : in String;
Result : out Boolean) with
Global => null,
Pre => Word'Length < WORD_MAX_LENGTH;
-- Get the stem or the input word unmodified.
function Get_Result (Context : in Context_Type'Class) return String with
Global => null,
Post => Get_Result'Result'Length < WORD_MAX_LENGTH;
private
type Mask_Type is mod 2**32;
-- A 32-bit character value that was read from UTF-8 sequence.
-- A modular value is used because shift and logical arithmetic is necessary.
type Utf8_Type is mod 2**32;
-- Index of the Grouping_Array. The index comes from the 32-bit character value
-- minus a starting offset. We don't expect large tables and we check against
-- a maximum value.
subtype Grouping_Index is Utf8_Type range 0 .. 16384;
type Grouping_Array is array (Grouping_Index range <>) of Boolean with Pack;
subtype Among_Index is Natural range 0 .. 65535;
subtype Among_Start_Index is Among_Index range 1 .. Among_Index'Last;
subtype Operation_Index is Natural range 0 .. 65535;
subtype Result_Index is Integer range -1 .. WORD_MAX_LENGTH - 1;
subtype Char_Index is Result_Index range 0 .. Result_Index'Last;
type Among_Type is record
First : Among_Start_Index;
Last : Among_Index;
Substring_I : Integer;
Result : Integer;
Operation : Operation_Index;
end record;
type Among_Array_Type is array (Natural range <>) of Among_Type;
function Eq_S (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S'Result = 0 or Eq_S'Result = S'Length;
function Eq_S_Backward (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S_Backward'Result = 0 or Eq_S_Backward'Result = S'Length;
procedure Find_Among (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
procedure Find_Among_Backward (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
function Skip_Utf8 (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8 (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
procedure Get_Utf8 (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
procedure Get_Utf8_Backward (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
function Length (Context : in Context_Type'Class) return Natural;
function Length_Utf8 (Context : in Context_Type'Class) return Natural;
function Check_Among (Context : in Context_Type'Class;
Pos : in Char_Index;
Shift : in Natural;
Mask : in Mask_Type) return Boolean;
procedure Out_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Out_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Replace (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String;
Adjustment : out Integer) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
procedure Slice_Del (Context : in out Context_Type'Class) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L;
procedure Slice_From (Context : in out Context_Type'Class;
Text : in String) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L
and Context.L - Context.Lb + Text'Length + Context.Ket - Context.Bra < Context.P'Length;
function Slice_To (Context : in Context_Type'Class) return String;
procedure Insert (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
-- The context indexes follow the C paradigm: they start at 0 for the first character.
-- This is necessary because several algorithms rely on this when they compare the
-- cursor position ('C') or setup some markers from the cursor.
type Context_Type is abstract tagged record
C : Char_Index := 0;
L : Char_Index := 0;
Lb : Char_Index := 0;
Bra : Char_Index := 0;
Ket : Char_Index := 0;
P : String (1 .. WORD_MAX_LENGTH);
end record;
end Stemmer;
|
[
{
"context": "Network buffers\n-- Copyright (C) 2016, 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 157,
"score": 0.9998830556869507,
"start": 142,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "C) 2016, 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 188,
"score": 0.9998876452445984,
"start": 173,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 215,
"score": 0.9999269247055054,
"start": 190,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/net-buffers.ads
|
stcarrez/ada-enet
| 16 |
-----------------------------------------------------------------------
-- net-buffers -- Network buffers
-- Copyright (C) 2016, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with System;
with Net.Headers;
-- === Network Buffers ===
-- The <b>Net.Buffers</b> package provides support for network buffer management.
-- A network buffer can hold a single packet frame so that it is limited to 1500 bytes
-- of payload with 14 or 16 bytes for the Ethernet header. The network buffers are
-- allocated by the Ethernet driver during the initialization to setup the
-- Ethernet receive queue. The allocation of network buffers for the transmission
-- is under the responsibility of the application.
--
-- Before receiving a packet, the application also has to allocate a network buffer.
-- Upon successful reception of a packet by the <b>Receive</b> procedure, the allocated
-- network buffer will be given to the Ethernet receive queue and the application
-- will get back the received buffer. There is no memory copy.
--
-- The package defines two important types: <b>Buffer_Type</b> and <b>Buffer_List</b>.
-- These two types are limited types to forbid copies and force a strict design to
-- applications. The <b>Buffer_Type</b> describes the packet frame and it provides
-- various operations to access the buffer. The <b>Buffer_List</b> defines a list of buffers.
--
-- The network buffers are kept within a single linked list managed by a protected object.
-- Because interrupt handlers can release a buffer, that protected object has the priority
-- <b>System.Max_Interrupt_Priority</b>. The protected operations are very basic and are
-- in O(1) complexity so that their execution is bounded in time whatever the arguments.
--
-- Before anything, the network buffers have to be allocated. The application can do this
-- by reserving some memory region (using <b>STM32.SDRAM.Reserve</b>) and adding the region with
-- the <b>Add_Region</b> procedure. The region must be a multiple of <b>NET_ALLOC_SIZE</b>
-- constant. To allocate 32 buffers, you can do the following:
--
-- NET_BUFFER_SIZE : constant Interfaces.Unsigned_32 := Net.Buffers.NET_ALLOC_SIZE * 32;
-- ...
-- Net.Buffers.Add_Region (STM32.SDRAM.Reserve (Amount => NET_BUFFER_SIZE), NET_BUFFER_SIZE);
--
-- An application will allocate a buffer by using the <b>Allocate</b> operation and this is as
-- easy as:
--
-- Packet : Net.Buffers.Buffer_Type;
-- ...
-- Net.Buffers.Allocate (Packet);
--
-- What happens if there is no available buffer? No exception is raised because the networks
-- stack is intended to be used in embedded systems where exceptions are not available.
-- You have to check if the allocation succeeded by using the <b>Is_Null</b> function:
--
-- if Packet.Is_Null then
-- null; -- Oops
-- end if;
--
-- === Serialization ===
-- Several serialization operations are provided to build or extract information from a packet.
-- Before proceeding to the serialization, it is necessary to set the packet type. The packet
-- type is necessary to reserve room for the protocol headers. To build a UDP packet, the
-- <tt>UDP_PACKET</tt> type will be used:
--
-- Packet.Set_Type (Net.Buffers.UDP_PACKET);
--
-- Then, several <tt>Put</tt> operations are provided to serialize the data. By default
-- integers are serialized in network byte order. The <tt>Put_Uint8</tt> serializes one byte,
-- the <tt>Put_Uint16</tt> two bytes, the <tt>Put_Uint32</tt> four bytes. The <tt>Put_String</tt>
-- operation will serialize a string. A NUL byte is optional and can be added when the
-- <tt>With_Null</tt> optional parameter is set. The example below creates a DNS query packet:
--
-- Packet.Put_Uint16 (1234); -- XID
-- Packet.Put_Uint16 (16#0100#); -- Flags
-- Packet.Put_Uint16 (1); -- # queries
-- Packet.Put_Uint16 (0);
-- Packet.Put_Uint32 (0);
-- Packet.Put_Uint8 (16#3#); -- Query
-- Packet.Put_String ("www.google.fr", With_Null => True);
-- Packet.Put_Uint16 (16#1#); -- A record
-- Packet.Put_Uint16 (16#1#); -- IN class
--
-- After a packet is serialized, the length get be obtained by using the
--
-- Len : Net.Uint16 := Packet.Get_Data_Length;
package Net.Buffers is
pragma Preelaborate;
-- The size of a packet buffer for memory allocation.
NET_ALLOC_SIZE : constant Uint32;
-- The maximum available size of the packet buffer for the application.
-- We always have NET_BUF_SIZE < NET_ALLOC_SIZE.
NET_BUF_SIZE : constant Uint32;
-- The packet type identifies the content of the packet for the serialization/deserialization.
type Packet_Type is (RAW_PACKET, ETHER_PACKET, ARP_PACKET, IP_PACKET, UDP_PACKET, ICMP_PACKET,
DHCP_PACKET);
type Data_Type is array (Net.Uint16 range 0 .. 1500 + 31) of aliased Uint8 with
Alignment => 32;
type Buffer_Type is tagged limited private;
-- Returns true if the buffer is null (allocation failed).
function Is_Null (Buf : in Buffer_Type) return Boolean;
-- Allocate a buffer from the pool. No exception is raised if there is no available buffer.
-- The <tt>Is_Null</tt> operation must be used to check the buffer allocation.
procedure Allocate (Buf : out Buffer_Type);
-- Release the buffer back to the pool.
procedure Release (Buf : in out Buffer_Type) with
Post => Buf.Is_Null;
-- Transfer the ownership of the buffer from <tt>From</tt> to <tt>To</tt>.
-- If the destination has a buffer, it is first released.
procedure Transfer (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null,
Post => From.Is_Null and not To.Is_Null;
-- Switch the ownership of the two buffers. The typical usage is on the Ethernet receive
-- ring to peek a received packet and install a new buffer on the ring so that there is
-- always a buffer on the ring.
procedure Switch (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null and not To.Is_Null,
Post => not From.Is_Null and not To.Is_Null;
--
function Get_Data_Address (Buf : in Buffer_Type) return System.Address;
function Get_Data_Size (Buf : in Buffer_Type;
Kind : in Packet_Type) return Uint16;
procedure Set_Data_Size (Buf : in out Buffer_Type; Size : in Uint16);
function Get_Length (Buf : in Buffer_Type) return Uint16;
procedure Set_Length (Buf : in out Buffer_Type; Size : in Uint16);
-- Set the packet type.
procedure Set_Type (Buf : in out Buffer_Type;
Kind : in Packet_Type);
-- Add a byte to the buffer data, moving the buffer write position.
procedure Put_Uint8 (Buf : in out Buffer_Type;
Value : in Net.Uint8) with
Pre => not Buf.Is_Null;
-- Add a 16-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint16 (Buf : in out Buffer_Type;
Value : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Add a 32-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint32 (Buf : in out Buffer_Type;
Value : in Net.Uint32) with
Pre => not Buf.Is_Null;
-- Add a string to the buffer data, moving the buffer write position.
-- When <tt>With_Null</tt> is set, a NUL byte is added after the string.
procedure Put_String (Buf : in out Buffer_Type;
Value : in String;
With_Null : in Boolean := False) with
Pre => not Buf.Is_Null;
-- Add an IP address to the buffer data, moving the buffer write position.
procedure Put_Ip (Buf : in out Buffer_Type;
Value : in Ip_Addr) with
Pre => not Buf.Is_Null;
-- Get a byte from the buffer, moving the buffer read position.
function Get_Uint8 (Buf : in out Buffer_Type) return Net.Uint8 with
Pre => not Buf.Is_Null;
-- Get a 16-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint16 (Buf : in out Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get a 32-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint32 (Buf : in out Buffer_Type) return Net.Uint32 with
Pre => not Buf.Is_Null;
-- Get an IPv4 value from the buffer, moving the buffer read position.
function Get_Ip (Buf : in out Buffer_Type) return Net.Ip_Addr with
Pre => not Buf.Is_Null;
-- Get a string whose length is specified by the target value.
procedure Get_String (Buf : in out Buffer_Type;
Into : out String) with
Pre => not Buf.Is_Null;
-- Skip a number of bytes in the buffer, moving the buffer position <tt>Size<tt> bytes ahead.
procedure Skip (Buf : in out Buffer_Type;
Size : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Get the number of bytes still available when reading the packet.
function Available (Buf : in Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get access to the Ethernet header.
function Ethernet (Buf : in Buffer_Type) return Net.Headers.Ether_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ARP packet.
function Arp (Buf : in Buffer_Type) return Net.Headers.Arp_Packet_Access with
Pre => not Buf.Is_Null;
-- Get access to the IPv4 header.
function IP (Buf : in Buffer_Type) return Net.Headers.IP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the UDP header.
function UDP (Buf : in Buffer_Type) return Net.Headers.UDP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the TCP header.
function TCP (Buf : in Buffer_Type) return Net.Headers.TCP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the IGMP header.
function IGMP (Buf : in Buffer_Type) return Net.Headers.IGMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ICMP header.
function ICMP (Buf : in Buffer_Type) return Net.Headers.ICMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the DHCP header.
function DHCP (Buf : in Buffer_Type) return Net.Headers.DHCP_Header_Access with
Pre => not Buf.Is_Null;
-- The <tt>Buffer_List</tt> holds a set of network buffers.
type Buffer_List is limited private;
-- Returns True if the list is empty.
function Is_Empty (List : in Buffer_List) return Boolean;
-- Insert the buffer to the list.
procedure Insert (Into : in out Buffer_List;
Buf : in out Buffer_Type) with
Pre => not Buf.Is_Null,
Post => Buf.Is_Null and not Is_Empty (Into);
-- Release all the buffers held by the list.
procedure Release (List : in out Buffer_List);
-- Allocate <tt>Count</tt> buffers and add them to the list.
-- There is no guarantee that the required number of buffers will be allocated.
procedure Allocate (List : in out Buffer_List;
Count : in Natural);
-- Peek a buffer from the list.
procedure Peek (From : in out Buffer_List;
Buf : in out Buffer_Type);
-- Transfer the list of buffers held by <tt>From</tt> at end of the list held
-- by <tt>To</tt>. After the transfer, the <tt>From</tt> list is empty.
-- The complexity is in O(1).
procedure Transfer (To : in out Buffer_List;
From : in out Buffer_List) with
Post => Is_Empty (From);
use type System.Address;
-- Add a memory region to the buffer pool.
procedure Add_Region (Addr : in System.Address;
Size : in Uint32) with
Pre => Size mod NET_ALLOC_SIZE = 0 and Size > 0 and Addr /= System.Null_Address;
private
type Packet_Buffer;
type Packet_Buffer_Access is access all Packet_Buffer;
type Packet_Buffer is limited record
Next : Packet_Buffer_Access;
Size : Uint16;
Data : aliased Data_Type;
end record;
type Buffer_Type is tagged limited record
Kind : Packet_Type := RAW_PACKET;
Size : Uint16 := 0;
Pos : Uint16 := 0;
Packet : Packet_Buffer_Access;
end record;
type Buffer_List is limited record
Head : Packet_Buffer_Access := null;
Tail : Packet_Buffer_Access := null;
end record;
NET_ALLOC_SIZE : constant Uint32 := 4 + (Packet_Buffer'Size / 8);
NET_BUF_SIZE : constant Uint32 := Data_Type'Size / 8;
end Net.Buffers;
|
26605
|
-----------------------------------------------------------------------
-- net-buffers -- Network buffers
-- Copyright (C) 2016, 2017, 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 System;
with Net.Headers;
-- === Network Buffers ===
-- The <b>Net.Buffers</b> package provides support for network buffer management.
-- A network buffer can hold a single packet frame so that it is limited to 1500 bytes
-- of payload with 14 or 16 bytes for the Ethernet header. The network buffers are
-- allocated by the Ethernet driver during the initialization to setup the
-- Ethernet receive queue. The allocation of network buffers for the transmission
-- is under the responsibility of the application.
--
-- Before receiving a packet, the application also has to allocate a network buffer.
-- Upon successful reception of a packet by the <b>Receive</b> procedure, the allocated
-- network buffer will be given to the Ethernet receive queue and the application
-- will get back the received buffer. There is no memory copy.
--
-- The package defines two important types: <b>Buffer_Type</b> and <b>Buffer_List</b>.
-- These two types are limited types to forbid copies and force a strict design to
-- applications. The <b>Buffer_Type</b> describes the packet frame and it provides
-- various operations to access the buffer. The <b>Buffer_List</b> defines a list of buffers.
--
-- The network buffers are kept within a single linked list managed by a protected object.
-- Because interrupt handlers can release a buffer, that protected object has the priority
-- <b>System.Max_Interrupt_Priority</b>. The protected operations are very basic and are
-- in O(1) complexity so that their execution is bounded in time whatever the arguments.
--
-- Before anything, the network buffers have to be allocated. The application can do this
-- by reserving some memory region (using <b>STM32.SDRAM.Reserve</b>) and adding the region with
-- the <b>Add_Region</b> procedure. The region must be a multiple of <b>NET_ALLOC_SIZE</b>
-- constant. To allocate 32 buffers, you can do the following:
--
-- NET_BUFFER_SIZE : constant Interfaces.Unsigned_32 := Net.Buffers.NET_ALLOC_SIZE * 32;
-- ...
-- Net.Buffers.Add_Region (STM32.SDRAM.Reserve (Amount => NET_BUFFER_SIZE), NET_BUFFER_SIZE);
--
-- An application will allocate a buffer by using the <b>Allocate</b> operation and this is as
-- easy as:
--
-- Packet : Net.Buffers.Buffer_Type;
-- ...
-- Net.Buffers.Allocate (Packet);
--
-- What happens if there is no available buffer? No exception is raised because the networks
-- stack is intended to be used in embedded systems where exceptions are not available.
-- You have to check if the allocation succeeded by using the <b>Is_Null</b> function:
--
-- if Packet.Is_Null then
-- null; -- Oops
-- end if;
--
-- === Serialization ===
-- Several serialization operations are provided to build or extract information from a packet.
-- Before proceeding to the serialization, it is necessary to set the packet type. The packet
-- type is necessary to reserve room for the protocol headers. To build a UDP packet, the
-- <tt>UDP_PACKET</tt> type will be used:
--
-- Packet.Set_Type (Net.Buffers.UDP_PACKET);
--
-- Then, several <tt>Put</tt> operations are provided to serialize the data. By default
-- integers are serialized in network byte order. The <tt>Put_Uint8</tt> serializes one byte,
-- the <tt>Put_Uint16</tt> two bytes, the <tt>Put_Uint32</tt> four bytes. The <tt>Put_String</tt>
-- operation will serialize a string. A NUL byte is optional and can be added when the
-- <tt>With_Null</tt> optional parameter is set. The example below creates a DNS query packet:
--
-- Packet.Put_Uint16 (1234); -- XID
-- Packet.Put_Uint16 (16#0100#); -- Flags
-- Packet.Put_Uint16 (1); -- # queries
-- Packet.Put_Uint16 (0);
-- Packet.Put_Uint32 (0);
-- Packet.Put_Uint8 (16#3#); -- Query
-- Packet.Put_String ("www.google.fr", With_Null => True);
-- Packet.Put_Uint16 (16#1#); -- A record
-- Packet.Put_Uint16 (16#1#); -- IN class
--
-- After a packet is serialized, the length get be obtained by using the
--
-- Len : Net.Uint16 := Packet.Get_Data_Length;
package Net.Buffers is
pragma Preelaborate;
-- The size of a packet buffer for memory allocation.
NET_ALLOC_SIZE : constant Uint32;
-- The maximum available size of the packet buffer for the application.
-- We always have NET_BUF_SIZE < NET_ALLOC_SIZE.
NET_BUF_SIZE : constant Uint32;
-- The packet type identifies the content of the packet for the serialization/deserialization.
type Packet_Type is (RAW_PACKET, ETHER_PACKET, ARP_PACKET, IP_PACKET, UDP_PACKET, ICMP_PACKET,
DHCP_PACKET);
type Data_Type is array (Net.Uint16 range 0 .. 1500 + 31) of aliased Uint8 with
Alignment => 32;
type Buffer_Type is tagged limited private;
-- Returns true if the buffer is null (allocation failed).
function Is_Null (Buf : in Buffer_Type) return Boolean;
-- Allocate a buffer from the pool. No exception is raised if there is no available buffer.
-- The <tt>Is_Null</tt> operation must be used to check the buffer allocation.
procedure Allocate (Buf : out Buffer_Type);
-- Release the buffer back to the pool.
procedure Release (Buf : in out Buffer_Type) with
Post => Buf.Is_Null;
-- Transfer the ownership of the buffer from <tt>From</tt> to <tt>To</tt>.
-- If the destination has a buffer, it is first released.
procedure Transfer (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null,
Post => From.Is_Null and not To.Is_Null;
-- Switch the ownership of the two buffers. The typical usage is on the Ethernet receive
-- ring to peek a received packet and install a new buffer on the ring so that there is
-- always a buffer on the ring.
procedure Switch (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null and not To.Is_Null,
Post => not From.Is_Null and not To.Is_Null;
--
function Get_Data_Address (Buf : in Buffer_Type) return System.Address;
function Get_Data_Size (Buf : in Buffer_Type;
Kind : in Packet_Type) return Uint16;
procedure Set_Data_Size (Buf : in out Buffer_Type; Size : in Uint16);
function Get_Length (Buf : in Buffer_Type) return Uint16;
procedure Set_Length (Buf : in out Buffer_Type; Size : in Uint16);
-- Set the packet type.
procedure Set_Type (Buf : in out Buffer_Type;
Kind : in Packet_Type);
-- Add a byte to the buffer data, moving the buffer write position.
procedure Put_Uint8 (Buf : in out Buffer_Type;
Value : in Net.Uint8) with
Pre => not Buf.Is_Null;
-- Add a 16-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint16 (Buf : in out Buffer_Type;
Value : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Add a 32-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint32 (Buf : in out Buffer_Type;
Value : in Net.Uint32) with
Pre => not Buf.Is_Null;
-- Add a string to the buffer data, moving the buffer write position.
-- When <tt>With_Null</tt> is set, a NUL byte is added after the string.
procedure Put_String (Buf : in out Buffer_Type;
Value : in String;
With_Null : in Boolean := False) with
Pre => not Buf.Is_Null;
-- Add an IP address to the buffer data, moving the buffer write position.
procedure Put_Ip (Buf : in out Buffer_Type;
Value : in Ip_Addr) with
Pre => not Buf.Is_Null;
-- Get a byte from the buffer, moving the buffer read position.
function Get_Uint8 (Buf : in out Buffer_Type) return Net.Uint8 with
Pre => not Buf.Is_Null;
-- Get a 16-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint16 (Buf : in out Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get a 32-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint32 (Buf : in out Buffer_Type) return Net.Uint32 with
Pre => not Buf.Is_Null;
-- Get an IPv4 value from the buffer, moving the buffer read position.
function Get_Ip (Buf : in out Buffer_Type) return Net.Ip_Addr with
Pre => not Buf.Is_Null;
-- Get a string whose length is specified by the target value.
procedure Get_String (Buf : in out Buffer_Type;
Into : out String) with
Pre => not Buf.Is_Null;
-- Skip a number of bytes in the buffer, moving the buffer position <tt>Size<tt> bytes ahead.
procedure Skip (Buf : in out Buffer_Type;
Size : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Get the number of bytes still available when reading the packet.
function Available (Buf : in Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get access to the Ethernet header.
function Ethernet (Buf : in Buffer_Type) return Net.Headers.Ether_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ARP packet.
function Arp (Buf : in Buffer_Type) return Net.Headers.Arp_Packet_Access with
Pre => not Buf.Is_Null;
-- Get access to the IPv4 header.
function IP (Buf : in Buffer_Type) return Net.Headers.IP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the UDP header.
function UDP (Buf : in Buffer_Type) return Net.Headers.UDP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the TCP header.
function TCP (Buf : in Buffer_Type) return Net.Headers.TCP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the IGMP header.
function IGMP (Buf : in Buffer_Type) return Net.Headers.IGMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ICMP header.
function ICMP (Buf : in Buffer_Type) return Net.Headers.ICMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the DHCP header.
function DHCP (Buf : in Buffer_Type) return Net.Headers.DHCP_Header_Access with
Pre => not Buf.Is_Null;
-- The <tt>Buffer_List</tt> holds a set of network buffers.
type Buffer_List is limited private;
-- Returns True if the list is empty.
function Is_Empty (List : in Buffer_List) return Boolean;
-- Insert the buffer to the list.
procedure Insert (Into : in out Buffer_List;
Buf : in out Buffer_Type) with
Pre => not Buf.Is_Null,
Post => Buf.Is_Null and not Is_Empty (Into);
-- Release all the buffers held by the list.
procedure Release (List : in out Buffer_List);
-- Allocate <tt>Count</tt> buffers and add them to the list.
-- There is no guarantee that the required number of buffers will be allocated.
procedure Allocate (List : in out Buffer_List;
Count : in Natural);
-- Peek a buffer from the list.
procedure Peek (From : in out Buffer_List;
Buf : in out Buffer_Type);
-- Transfer the list of buffers held by <tt>From</tt> at end of the list held
-- by <tt>To</tt>. After the transfer, the <tt>From</tt> list is empty.
-- The complexity is in O(1).
procedure Transfer (To : in out Buffer_List;
From : in out Buffer_List) with
Post => Is_Empty (From);
use type System.Address;
-- Add a memory region to the buffer pool.
procedure Add_Region (Addr : in System.Address;
Size : in Uint32) with
Pre => Size mod NET_ALLOC_SIZE = 0 and Size > 0 and Addr /= System.Null_Address;
private
type Packet_Buffer;
type Packet_Buffer_Access is access all Packet_Buffer;
type Packet_Buffer is limited record
Next : Packet_Buffer_Access;
Size : Uint16;
Data : aliased Data_Type;
end record;
type Buffer_Type is tagged limited record
Kind : Packet_Type := RAW_PACKET;
Size : Uint16 := 0;
Pos : Uint16 := 0;
Packet : Packet_Buffer_Access;
end record;
type Buffer_List is limited record
Head : Packet_Buffer_Access := null;
Tail : Packet_Buffer_Access := null;
end record;
NET_ALLOC_SIZE : constant Uint32 := 4 + (Packet_Buffer'Size / 8);
NET_BUF_SIZE : constant Uint32 := Data_Type'Size / 8;
end Net.Buffers;
| true |
-----------------------------------------------------------------------
-- net-buffers -- Network buffers
-- Copyright (C) 2016, 2017, 2018 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 System;
with Net.Headers;
-- === Network Buffers ===
-- The <b>Net.Buffers</b> package provides support for network buffer management.
-- A network buffer can hold a single packet frame so that it is limited to 1500 bytes
-- of payload with 14 or 16 bytes for the Ethernet header. The network buffers are
-- allocated by the Ethernet driver during the initialization to setup the
-- Ethernet receive queue. The allocation of network buffers for the transmission
-- is under the responsibility of the application.
--
-- Before receiving a packet, the application also has to allocate a network buffer.
-- Upon successful reception of a packet by the <b>Receive</b> procedure, the allocated
-- network buffer will be given to the Ethernet receive queue and the application
-- will get back the received buffer. There is no memory copy.
--
-- The package defines two important types: <b>Buffer_Type</b> and <b>Buffer_List</b>.
-- These two types are limited types to forbid copies and force a strict design to
-- applications. The <b>Buffer_Type</b> describes the packet frame and it provides
-- various operations to access the buffer. The <b>Buffer_List</b> defines a list of buffers.
--
-- The network buffers are kept within a single linked list managed by a protected object.
-- Because interrupt handlers can release a buffer, that protected object has the priority
-- <b>System.Max_Interrupt_Priority</b>. The protected operations are very basic and are
-- in O(1) complexity so that their execution is bounded in time whatever the arguments.
--
-- Before anything, the network buffers have to be allocated. The application can do this
-- by reserving some memory region (using <b>STM32.SDRAM.Reserve</b>) and adding the region with
-- the <b>Add_Region</b> procedure. The region must be a multiple of <b>NET_ALLOC_SIZE</b>
-- constant. To allocate 32 buffers, you can do the following:
--
-- NET_BUFFER_SIZE : constant Interfaces.Unsigned_32 := Net.Buffers.NET_ALLOC_SIZE * 32;
-- ...
-- Net.Buffers.Add_Region (STM32.SDRAM.Reserve (Amount => NET_BUFFER_SIZE), NET_BUFFER_SIZE);
--
-- An application will allocate a buffer by using the <b>Allocate</b> operation and this is as
-- easy as:
--
-- Packet : Net.Buffers.Buffer_Type;
-- ...
-- Net.Buffers.Allocate (Packet);
--
-- What happens if there is no available buffer? No exception is raised because the networks
-- stack is intended to be used in embedded systems where exceptions are not available.
-- You have to check if the allocation succeeded by using the <b>Is_Null</b> function:
--
-- if Packet.Is_Null then
-- null; -- Oops
-- end if;
--
-- === Serialization ===
-- Several serialization operations are provided to build or extract information from a packet.
-- Before proceeding to the serialization, it is necessary to set the packet type. The packet
-- type is necessary to reserve room for the protocol headers. To build a UDP packet, the
-- <tt>UDP_PACKET</tt> type will be used:
--
-- Packet.Set_Type (Net.Buffers.UDP_PACKET);
--
-- Then, several <tt>Put</tt> operations are provided to serialize the data. By default
-- integers are serialized in network byte order. The <tt>Put_Uint8</tt> serializes one byte,
-- the <tt>Put_Uint16</tt> two bytes, the <tt>Put_Uint32</tt> four bytes. The <tt>Put_String</tt>
-- operation will serialize a string. A NUL byte is optional and can be added when the
-- <tt>With_Null</tt> optional parameter is set. The example below creates a DNS query packet:
--
-- Packet.Put_Uint16 (1234); -- XID
-- Packet.Put_Uint16 (16#0100#); -- Flags
-- Packet.Put_Uint16 (1); -- # queries
-- Packet.Put_Uint16 (0);
-- Packet.Put_Uint32 (0);
-- Packet.Put_Uint8 (16#3#); -- Query
-- Packet.Put_String ("www.google.fr", With_Null => True);
-- Packet.Put_Uint16 (16#1#); -- A record
-- Packet.Put_Uint16 (16#1#); -- IN class
--
-- After a packet is serialized, the length get be obtained by using the
--
-- Len : Net.Uint16 := Packet.Get_Data_Length;
package Net.Buffers is
pragma Preelaborate;
-- The size of a packet buffer for memory allocation.
NET_ALLOC_SIZE : constant Uint32;
-- The maximum available size of the packet buffer for the application.
-- We always have NET_BUF_SIZE < NET_ALLOC_SIZE.
NET_BUF_SIZE : constant Uint32;
-- The packet type identifies the content of the packet for the serialization/deserialization.
type Packet_Type is (RAW_PACKET, ETHER_PACKET, ARP_PACKET, IP_PACKET, UDP_PACKET, ICMP_PACKET,
DHCP_PACKET);
type Data_Type is array (Net.Uint16 range 0 .. 1500 + 31) of aliased Uint8 with
Alignment => 32;
type Buffer_Type is tagged limited private;
-- Returns true if the buffer is null (allocation failed).
function Is_Null (Buf : in Buffer_Type) return Boolean;
-- Allocate a buffer from the pool. No exception is raised if there is no available buffer.
-- The <tt>Is_Null</tt> operation must be used to check the buffer allocation.
procedure Allocate (Buf : out Buffer_Type);
-- Release the buffer back to the pool.
procedure Release (Buf : in out Buffer_Type) with
Post => Buf.Is_Null;
-- Transfer the ownership of the buffer from <tt>From</tt> to <tt>To</tt>.
-- If the destination has a buffer, it is first released.
procedure Transfer (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null,
Post => From.Is_Null and not To.Is_Null;
-- Switch the ownership of the two buffers. The typical usage is on the Ethernet receive
-- ring to peek a received packet and install a new buffer on the ring so that there is
-- always a buffer on the ring.
procedure Switch (To : in out Buffer_Type;
From : in out Buffer_Type) with
Pre => not From.Is_Null and not To.Is_Null,
Post => not From.Is_Null and not To.Is_Null;
--
function Get_Data_Address (Buf : in Buffer_Type) return System.Address;
function Get_Data_Size (Buf : in Buffer_Type;
Kind : in Packet_Type) return Uint16;
procedure Set_Data_Size (Buf : in out Buffer_Type; Size : in Uint16);
function Get_Length (Buf : in Buffer_Type) return Uint16;
procedure Set_Length (Buf : in out Buffer_Type; Size : in Uint16);
-- Set the packet type.
procedure Set_Type (Buf : in out Buffer_Type;
Kind : in Packet_Type);
-- Add a byte to the buffer data, moving the buffer write position.
procedure Put_Uint8 (Buf : in out Buffer_Type;
Value : in Net.Uint8) with
Pre => not Buf.Is_Null;
-- Add a 16-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint16 (Buf : in out Buffer_Type;
Value : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Add a 32-bit value in network byte order to the buffer data,
-- moving the buffer write position.
procedure Put_Uint32 (Buf : in out Buffer_Type;
Value : in Net.Uint32) with
Pre => not Buf.Is_Null;
-- Add a string to the buffer data, moving the buffer write position.
-- When <tt>With_Null</tt> is set, a NUL byte is added after the string.
procedure Put_String (Buf : in out Buffer_Type;
Value : in String;
With_Null : in Boolean := False) with
Pre => not Buf.Is_Null;
-- Add an IP address to the buffer data, moving the buffer write position.
procedure Put_Ip (Buf : in out Buffer_Type;
Value : in Ip_Addr) with
Pre => not Buf.Is_Null;
-- Get a byte from the buffer, moving the buffer read position.
function Get_Uint8 (Buf : in out Buffer_Type) return Net.Uint8 with
Pre => not Buf.Is_Null;
-- Get a 16-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint16 (Buf : in out Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get a 32-bit value in network byte order from the buffer, moving the buffer read position.
function Get_Uint32 (Buf : in out Buffer_Type) return Net.Uint32 with
Pre => not Buf.Is_Null;
-- Get an IPv4 value from the buffer, moving the buffer read position.
function Get_Ip (Buf : in out Buffer_Type) return Net.Ip_Addr with
Pre => not Buf.Is_Null;
-- Get a string whose length is specified by the target value.
procedure Get_String (Buf : in out Buffer_Type;
Into : out String) with
Pre => not Buf.Is_Null;
-- Skip a number of bytes in the buffer, moving the buffer position <tt>Size<tt> bytes ahead.
procedure Skip (Buf : in out Buffer_Type;
Size : in Net.Uint16) with
Pre => not Buf.Is_Null;
-- Get the number of bytes still available when reading the packet.
function Available (Buf : in Buffer_Type) return Net.Uint16 with
Pre => not Buf.Is_Null;
-- Get access to the Ethernet header.
function Ethernet (Buf : in Buffer_Type) return Net.Headers.Ether_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ARP packet.
function Arp (Buf : in Buffer_Type) return Net.Headers.Arp_Packet_Access with
Pre => not Buf.Is_Null;
-- Get access to the IPv4 header.
function IP (Buf : in Buffer_Type) return Net.Headers.IP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the UDP header.
function UDP (Buf : in Buffer_Type) return Net.Headers.UDP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the TCP header.
function TCP (Buf : in Buffer_Type) return Net.Headers.TCP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the IGMP header.
function IGMP (Buf : in Buffer_Type) return Net.Headers.IGMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the ICMP header.
function ICMP (Buf : in Buffer_Type) return Net.Headers.ICMP_Header_Access with
Pre => not Buf.Is_Null;
-- Get access to the DHCP header.
function DHCP (Buf : in Buffer_Type) return Net.Headers.DHCP_Header_Access with
Pre => not Buf.Is_Null;
-- The <tt>Buffer_List</tt> holds a set of network buffers.
type Buffer_List is limited private;
-- Returns True if the list is empty.
function Is_Empty (List : in Buffer_List) return Boolean;
-- Insert the buffer to the list.
procedure Insert (Into : in out Buffer_List;
Buf : in out Buffer_Type) with
Pre => not Buf.Is_Null,
Post => Buf.Is_Null and not Is_Empty (Into);
-- Release all the buffers held by the list.
procedure Release (List : in out Buffer_List);
-- Allocate <tt>Count</tt> buffers and add them to the list.
-- There is no guarantee that the required number of buffers will be allocated.
procedure Allocate (List : in out Buffer_List;
Count : in Natural);
-- Peek a buffer from the list.
procedure Peek (From : in out Buffer_List;
Buf : in out Buffer_Type);
-- Transfer the list of buffers held by <tt>From</tt> at end of the list held
-- by <tt>To</tt>. After the transfer, the <tt>From</tt> list is empty.
-- The complexity is in O(1).
procedure Transfer (To : in out Buffer_List;
From : in out Buffer_List) with
Post => Is_Empty (From);
use type System.Address;
-- Add a memory region to the buffer pool.
procedure Add_Region (Addr : in System.Address;
Size : in Uint32) with
Pre => Size mod NET_ALLOC_SIZE = 0 and Size > 0 and Addr /= System.Null_Address;
private
type Packet_Buffer;
type Packet_Buffer_Access is access all Packet_Buffer;
type Packet_Buffer is limited record
Next : Packet_Buffer_Access;
Size : Uint16;
Data : aliased Data_Type;
end record;
type Buffer_Type is tagged limited record
Kind : Packet_Type := RAW_PACKET;
Size : Uint16 := 0;
Pos : Uint16 := 0;
Packet : Packet_Buffer_Access;
end record;
type Buffer_List is limited record
Head : Packet_Buffer_Access := null;
Tail : Packet_Buffer_Access := null;
end record;
NET_ALLOC_SIZE : constant Uint32 := 4 + (Packet_Buffer'Size / 8);
NET_BUF_SIZE : constant Uint32 := Data_Type'Size / 8;
end Net.Buffers;
|
[
{
"context": "--\n-- Raytracer implementation in Ada\n-- by John Perry (github: johnperry-math)\n-- 2021\n--\n-- main progr",
"end": 54,
"score": 0.9998834133148193,
"start": 44,
"tag": "NAME",
"value": "John Perry"
},
{
"context": "er implementation in Ada\n-- by John Perry (github: johnperry-math)\n-- 2021\n--\n-- main program\n--\n\n-- Ada packages\n\n",
"end": 78,
"score": 0.9990541934967041,
"start": 64,
"tag": "USERNAME",
"value": "johnperry-math"
}
] |
ada/src/main.adb
|
alkalinin/raytracer
| 45 |
--
-- Raytracer implementation in Ada
-- by John Perry (github: johnperry-math)
-- 2021
--
-- main program
--
-- Ada packages
with Ada.Text_IO; use Ada.Text_IO; -- I/O
with Ada.Real_Time; -- timing
-- local packages
with Bitmap;
with Cameras;
with Colors;
with Lights;
with Objects;
with RayTracer;
with Vectors;
with RayTracing_Constants; use RayTracing_Constants;
-- @summary
-- creates, draws, and saves a 500px x 500px image of two shiny balls
-- on a checkerboard
procedure Main is
Start, Stop: Ada.Real_Time.Time; -- clock times at start, stop of render
Difference: Ada.Real_Time.Time_Span; -- difference between Start and Stop
Width: Int32 := 500; -- image width
Height: Int32 := 500; -- image height
Bmp: Bitmap.Bitmap_Data( 1 .. Integer( Width * Height ) ); -- bitmap to save
function "-"(First, Second: Ada.Real_Time.Time)
return Ada.Real_Time.Time_Span
renames Ada.Real_Time."-";
-- make the predefined subtraction operator available for time
package L renames Lights;
Lights: L.Light_Array( 1 .. 4 ); -- lights shining on the image
Things: Objects.Thing_Array( 1 .. 3 ); -- things present in the image
Camera: Cameras.Camera_Type;
Scene: RayTracer.Scene_Type(
Light_Count => Lights'Length,
Thing_Count => Things'Length
);
-- the scene to display
begin
-- set up the objects in the scene, the lights, and the Camera_Type
Objects.Create_Plane(
Things(1),
Vectors.Create_Vector(0.0, 1.0, 0.0),
0.0,
Objects.Checkerboard
);
Objects.Create_Sphere(
Things(2),
Vectors.Create_Vector(0.0, 1.0, -0.25),
1.0,
Objects.Shiny
);
Objects.Create_Sphere(
Things(3),
Vectors.Create_Vector(-1.0, 0.5, 1.5),
0.5,
Objects.Shiny
);
Lights(1) := L.Create_Light(
Vectors.Create_Vector(-2.0, 2.5, 0.0),
Colors.Create_Color(0.49, 0.07, 0.07)
);
Lights(2) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, 1.5),
Colors.Create_Color(0.07, 0.07, 0.49)
);
Lights(3) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, -1.5),
Colors.Create_Color(0.07, 0.49, 0.071)
);
Lights(4) := L.Create_Light(
Vectors.Create_Vector(0.0, 3.5, 0.0),
Colors.Create_Color(0.21, 0.21, 0.35)
);
Camera := Cameras.Create_Camera(
Vectors.Create_Vector(3.0, 2.0, 4.0),
Vectors.Create_Vector(-1.0, 0.5, 0.0)
);
RayTracer.Create_Scene(Scene, Things, Lights, Camera, 5);
-- render and time the rendering
Put_Line("started");
Start := Ada.Real_Time.Clock;
RayTracer.Render_Scene(Scene, Bmp, Width, Height);
Stop := Ada.Real_Time.Clock;
Difference := Stop - Start;
-- report time, then save output
Put_Line(
"Completed in"
& Duration'Image( Ada.Real_Time.To_Duration(Difference))
& " seconds"
);
Bitmap.Save_RGB_Bitmap(Bmp, Width, Height, 32, "ada-raytracer.bmp");
end Main;
|
7926
|
--
-- Raytracer implementation in Ada
-- by <NAME> (github: johnperry-math)
-- 2021
--
-- main program
--
-- Ada packages
with Ada.Text_IO; use Ada.Text_IO; -- I/O
with Ada.Real_Time; -- timing
-- local packages
with Bitmap;
with Cameras;
with Colors;
with Lights;
with Objects;
with RayTracer;
with Vectors;
with RayTracing_Constants; use RayTracing_Constants;
-- @summary
-- creates, draws, and saves a 500px x 500px image of two shiny balls
-- on a checkerboard
procedure Main is
Start, Stop: Ada.Real_Time.Time; -- clock times at start, stop of render
Difference: Ada.Real_Time.Time_Span; -- difference between Start and Stop
Width: Int32 := 500; -- image width
Height: Int32 := 500; -- image height
Bmp: Bitmap.Bitmap_Data( 1 .. Integer( Width * Height ) ); -- bitmap to save
function "-"(First, Second: Ada.Real_Time.Time)
return Ada.Real_Time.Time_Span
renames Ada.Real_Time."-";
-- make the predefined subtraction operator available for time
package L renames Lights;
Lights: L.Light_Array( 1 .. 4 ); -- lights shining on the image
Things: Objects.Thing_Array( 1 .. 3 ); -- things present in the image
Camera: Cameras.Camera_Type;
Scene: RayTracer.Scene_Type(
Light_Count => Lights'Length,
Thing_Count => Things'Length
);
-- the scene to display
begin
-- set up the objects in the scene, the lights, and the Camera_Type
Objects.Create_Plane(
Things(1),
Vectors.Create_Vector(0.0, 1.0, 0.0),
0.0,
Objects.Checkerboard
);
Objects.Create_Sphere(
Things(2),
Vectors.Create_Vector(0.0, 1.0, -0.25),
1.0,
Objects.Shiny
);
Objects.Create_Sphere(
Things(3),
Vectors.Create_Vector(-1.0, 0.5, 1.5),
0.5,
Objects.Shiny
);
Lights(1) := L.Create_Light(
Vectors.Create_Vector(-2.0, 2.5, 0.0),
Colors.Create_Color(0.49, 0.07, 0.07)
);
Lights(2) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, 1.5),
Colors.Create_Color(0.07, 0.07, 0.49)
);
Lights(3) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, -1.5),
Colors.Create_Color(0.07, 0.49, 0.071)
);
Lights(4) := L.Create_Light(
Vectors.Create_Vector(0.0, 3.5, 0.0),
Colors.Create_Color(0.21, 0.21, 0.35)
);
Camera := Cameras.Create_Camera(
Vectors.Create_Vector(3.0, 2.0, 4.0),
Vectors.Create_Vector(-1.0, 0.5, 0.0)
);
RayTracer.Create_Scene(Scene, Things, Lights, Camera, 5);
-- render and time the rendering
Put_Line("started");
Start := Ada.Real_Time.Clock;
RayTracer.Render_Scene(Scene, Bmp, Width, Height);
Stop := Ada.Real_Time.Clock;
Difference := Stop - Start;
-- report time, then save output
Put_Line(
"Completed in"
& Duration'Image( Ada.Real_Time.To_Duration(Difference))
& " seconds"
);
Bitmap.Save_RGB_Bitmap(Bmp, Width, Height, 32, "ada-raytracer.bmp");
end Main;
| true |
--
-- Raytracer implementation in Ada
-- by PI:NAME:<NAME>END_PI (github: johnperry-math)
-- 2021
--
-- main program
--
-- Ada packages
with Ada.Text_IO; use Ada.Text_IO; -- I/O
with Ada.Real_Time; -- timing
-- local packages
with Bitmap;
with Cameras;
with Colors;
with Lights;
with Objects;
with RayTracer;
with Vectors;
with RayTracing_Constants; use RayTracing_Constants;
-- @summary
-- creates, draws, and saves a 500px x 500px image of two shiny balls
-- on a checkerboard
procedure Main is
Start, Stop: Ada.Real_Time.Time; -- clock times at start, stop of render
Difference: Ada.Real_Time.Time_Span; -- difference between Start and Stop
Width: Int32 := 500; -- image width
Height: Int32 := 500; -- image height
Bmp: Bitmap.Bitmap_Data( 1 .. Integer( Width * Height ) ); -- bitmap to save
function "-"(First, Second: Ada.Real_Time.Time)
return Ada.Real_Time.Time_Span
renames Ada.Real_Time."-";
-- make the predefined subtraction operator available for time
package L renames Lights;
Lights: L.Light_Array( 1 .. 4 ); -- lights shining on the image
Things: Objects.Thing_Array( 1 .. 3 ); -- things present in the image
Camera: Cameras.Camera_Type;
Scene: RayTracer.Scene_Type(
Light_Count => Lights'Length,
Thing_Count => Things'Length
);
-- the scene to display
begin
-- set up the objects in the scene, the lights, and the Camera_Type
Objects.Create_Plane(
Things(1),
Vectors.Create_Vector(0.0, 1.0, 0.0),
0.0,
Objects.Checkerboard
);
Objects.Create_Sphere(
Things(2),
Vectors.Create_Vector(0.0, 1.0, -0.25),
1.0,
Objects.Shiny
);
Objects.Create_Sphere(
Things(3),
Vectors.Create_Vector(-1.0, 0.5, 1.5),
0.5,
Objects.Shiny
);
Lights(1) := L.Create_Light(
Vectors.Create_Vector(-2.0, 2.5, 0.0),
Colors.Create_Color(0.49, 0.07, 0.07)
);
Lights(2) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, 1.5),
Colors.Create_Color(0.07, 0.07, 0.49)
);
Lights(3) := L.Create_Light(
Vectors.Create_Vector(1.5, 2.5, -1.5),
Colors.Create_Color(0.07, 0.49, 0.071)
);
Lights(4) := L.Create_Light(
Vectors.Create_Vector(0.0, 3.5, 0.0),
Colors.Create_Color(0.21, 0.21, 0.35)
);
Camera := Cameras.Create_Camera(
Vectors.Create_Vector(3.0, 2.0, 4.0),
Vectors.Create_Vector(-1.0, 0.5, 0.0)
);
RayTracer.Create_Scene(Scene, Things, Lights, Camera, 5);
-- render and time the rendering
Put_Line("started");
Start := Ada.Real_Time.Clock;
RayTracer.Render_Scene(Scene, Bmp, Width, Height);
Stop := Ada.Real_Time.Clock;
Difference := Stop - Start;
-- report time, then save output
Put_Line(
"Completed in"
& Duration'Image( Ada.Real_Time.To_Duration(Difference))
& " seconds"
);
Bitmap.Save_RGB_Bitmap(Bmp, Width, Height, 32, "ada-raytracer.bmp");
end Main;
|
[
{
"context": "S (CHECKS FOR \"=\" AND \"/=\" ARE IN\n-- CC3601C).\n\n-- R.WILLIAMS 10/9/86\n-- JRL 11/15/95 Added unknown disc",
"end": 1411,
"score": 0.9998325705528259,
"start": 1401,
"tag": "NAME",
"value": "R.WILLIAMS"
}
] |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc3601a.ada
|
best08618/asylo
| 7 |
-- CC3601A.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 PREDEFINED OPERATORS MAY BE PASSED AS ACTUAL
-- GENERIC SUBPROGRAM PARAMETERS (CHECKS FOR "=" AND "/=" ARE IN
-- CC3601C).
-- R.WILLIAMS 10/9/86
-- JRL 11/15/95 Added unknown discriminant part to all formal
-- private types.
WITH REPORT; USE REPORT;
PROCEDURE CC3601A IS
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1 : T;
KIND : STRING;
WITH FUNCTION F1 (X : IN T) RETURN T;
PACKAGE GP1 IS
R : BOOLEAN := F1 (V) = V1;
END GP1;
PACKAGE BODY GP1 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR UNARY OP - " & KIND);
END IF;
END GP1;
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1, V2 : IN T;
KIND : STRING;
WITH FUNCTION F1 (P1 : IN T; P2 : IN T) RETURN T;
PACKAGE GP2 IS
R : BOOLEAN := V /= F1 (V1, V2);
END GP2;
PACKAGE BODY GP2 IS
BEGIN
IF IDENT_BOOL (R) THEN
FAILED ( "INCORRECT VALUE FOR BINARY OP - " & KIND);
END IF;
END GP2;
GENERIC
TYPE T1 (<>) IS PRIVATE;
TYPE T2 (<>) IS PRIVATE;
V1 : T1;
V2 : T2;
KIND : STRING;
WITH FUNCTION F1 (X : IN T1) RETURN T2;
PACKAGE GP3 IS
R : BOOLEAN := F1 (V1) = V2;
END GP3;
PACKAGE BODY GP3 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR OP - " & KIND);
END IF;
END GP3;
BEGIN
TEST ( "CC3601A", "CHECK THAT PREDEFINED OPERATORS MAY BE " &
"PASSED AS ACTUAL GENERIC SUBPROGRAM " &
"PARAMETERS" );
BEGIN -- CHECKS WITH RELATIONAL OPERATORS AND LOGICAL OPERATORS AS
-- ACTUAL PARAMETERS.
FOR I1 IN BOOLEAN LOOP
FOR I2 IN BOOLEAN LOOP
COMMENT ( "B1 = " & BOOLEAN'IMAGE (I1) & " AND " &
"B2 = " & BOOLEAN'IMAGE (I2) );
DECLARE
B1 : BOOLEAN := IDENT_BOOL (I1);
B2 : BOOLEAN := IDENT_BOOL (I2);
PACKAGE P1 IS
NEW GP1 (BOOLEAN, NOT B2, B2,
"""NOT"" - 1", "NOT");
PACKAGE P2 IS
NEW GP2 (BOOLEAN, B1 OR B2, B1, B2,
"OR", "OR");
PACKAGE P3 IS
NEW GP2 (BOOLEAN, B1 AND B2, B2, B1,
"AND", "AND");
PACKAGE P4 IS
NEW GP2 (BOOLEAN, B1 /= B2, B1, B2,
"XOR", "XOR");
PACKAGE P5 IS
NEW GP2 (BOOLEAN, B1 < B2, B1, B2,
"<", "<");
PACKAGE P6 IS
NEW GP2 (BOOLEAN, B1 <= B2, B1, B2,
"<=", "<=");
PACKAGE P7 IS
NEW GP2 (BOOLEAN, B1 > B2, B1, B2,
">", ">");
PACKAGE P8 IS
NEW GP2 (BOOLEAN, B1 >= B2, B1, B2,
">=", ">=");
TYPE AB IS ARRAY (BOOLEAN RANGE <> )
OF BOOLEAN;
AB1 : AB (BOOLEAN) := (B1, B2);
AB2 : AB (BOOLEAN) := (B2, B1);
T : AB (B1 .. B2) := (B1 .. B2 => TRUE);
F : AB (B1 .. B2) := (B1 .. B2 => FALSE);
VB1 : AB (B1 .. B1) := (B1 => B2);
VB2 : AB (B2 .. B2) := (B2 => B1);
PACKAGE P9 IS
NEW GP1 (AB, AB1, NOT AB1,
"""NOT"" - 2", "NOT");
PACKAGE P10 IS
NEW GP1 (AB, T, F,
"""NOT"" - 3", "NOT");
PACKAGE P11 IS
NEW GP1 (AB, VB2, (B2 => NOT B1),
"""NOT"" - 4", "NOT");
PACKAGE P12 IS
NEW GP2 (AB, AB1 AND AB2, AB1, AB2,
"AND", "AND");
BEGIN
NULL;
END;
END LOOP;
END LOOP;
END;
DECLARE -- CHECKS WITH ADDING AND MULTIPLYING OPERATORS, "**",
-- AND "ABS".
PACKAGE P1 IS NEW GP1 (INTEGER, -4, -4, """+"" - 1", "+");
PACKAGE P2 IS NEW GP1 (FLOAT, 4.0, 4.0, """+"" - 2", "+");
PACKAGE P3 IS NEW GP1 (DURATION, -4.0, -4.0, """+"" - 3",
"+");
PACKAGE P4 IS NEW GP1 (INTEGER, -4, 4, """-"" - 1", "-");
PACKAGE P5 IS NEW GP1 (FLOAT, 0.0, 0.0, """-"" - 2", "-");
PACKAGE P6 IS NEW GP1 (DURATION, 1.0, -1.0, """-"" - 3",
"-");
PACKAGE P7 IS NEW GP2 (INTEGER, 6, 1, 5, """+"" - 1", "+");
PACKAGE P8 IS NEW GP2 (FLOAT, 6.0, 1.0, 5.0, """+"" - 2",
"+");
PACKAGE P9 IS NEW GP2 (DURATION, 6.0, 1.0, 5.0, """+"" - 3",
"+");
PACKAGE P10 IS NEW GP2 (INTEGER, 1, 6, 5, """-"" - 1",
"-" );
PACKAGE P11 IS NEW GP2 (DURATION, 11.0, 6.0,-5.0,
"""-"" - 2", "-");
PACKAGE P12 IS NEW GP2 (FLOAT, 1.0, 6.0, 5.0, """-"" - 3",
"-");
SUBTYPE SUBINT IS INTEGER RANGE 0 .. 2;
TYPE STR IS ARRAY (SUBINT RANGE <>) OF CHARACTER;
VSTR : STR (0 .. 1) := "AB";
PACKAGE P13 IS NEW GP2 (STR, VSTR (0 .. 0) &
VSTR (1 .. 1),
VSTR (0 .. 0),
VSTR (1 .. 1), """&"" - 1", "&");
PACKAGE P14 IS NEW GP2 (STR, VSTR (1 .. 1) &
VSTR (0 .. 0),
VSTR (1 .. 1),
VSTR (0 .. 0), """&"" - 2", "&");
PACKAGE P15 IS NEW GP2 (INTEGER, 0, -1, 0, """*"" - 1", "*");
PACKAGE P16 IS NEW GP2 (FLOAT, 6.0, 3.0, 2.0, """*"" - 2",
"*");
PACKAGE P17 IS NEW GP2 (INTEGER, 0, 0, 6, """/"" - 1", "/");
PACKAGE P18 IS NEW GP2 (FLOAT, 3.0, 6.0, 2.0, """/"" - 2",
"/");
PACKAGE P19 IS NEW GP2 (INTEGER, -1, -11, 5, "REM", "REM");
PACKAGE P20 IS NEW GP2 (INTEGER, 4, -11, 5, "MOD", "MOD");
PACKAGE P21 IS NEW GP1 (INTEGER, 5, 5, """ABS"" - 1", "ABS");
PACKAGE P22 IS NEW GP1 (FLOAT, -5.0, 5.0, """ABS"" - 2",
"ABS");
PACKAGE P23 IS NEW GP1 (DURATION, 0.0, 0.0, """ABS"" - 3",
"ABS");
PACKAGE P24 IS NEW GP2 (INTEGER, 9, 3, 2, """**"" - 1",
"**");
PACKAGE P25 IS NEW GP2 (INTEGER, 1, 5, 0, """**"" - 2",
"**");
BEGIN
NULL;
END;
DECLARE -- CHECKS WITH ATTRIBUTES.
TYPE WEEKDAY IS (MON, TUES, WED, THUR, FRI);
PACKAGE P1 IS NEW GP1 (WEEKDAY, TUES, WED, "WEEKDAY'SUCC",
WEEKDAY'SUCC);
PACKAGE P2 IS NEW GP1 (WEEKDAY, TUES, MON, "WEEKDAY'PRED",
WEEKDAY'PRED);
PACKAGE P3 IS NEW GP3 (WEEKDAY, STRING, THUR, "THUR",
"WEEKDAY'IMAGE", WEEKDAY'IMAGE);
PACKAGE P4 IS NEW GP3 (STRING, WEEKDAY, "FRI", FRI,
"WEEKDAY'VALUE", WEEKDAY'VALUE);
BEGIN
NULL;
END;
RESULT;
END CC3601A;
|
9507
|
-- CC3601A.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 PREDEFINED OPERATORS MAY BE PASSED AS ACTUAL
-- GENERIC SUBPROGRAM PARAMETERS (CHECKS FOR "=" AND "/=" ARE IN
-- CC3601C).
-- <NAME> 10/9/86
-- JRL 11/15/95 Added unknown discriminant part to all formal
-- private types.
WITH REPORT; USE REPORT;
PROCEDURE CC3601A IS
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1 : T;
KIND : STRING;
WITH FUNCTION F1 (X : IN T) RETURN T;
PACKAGE GP1 IS
R : BOOLEAN := F1 (V) = V1;
END GP1;
PACKAGE BODY GP1 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR UNARY OP - " & KIND);
END IF;
END GP1;
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1, V2 : IN T;
KIND : STRING;
WITH FUNCTION F1 (P1 : IN T; P2 : IN T) RETURN T;
PACKAGE GP2 IS
R : BOOLEAN := V /= F1 (V1, V2);
END GP2;
PACKAGE BODY GP2 IS
BEGIN
IF IDENT_BOOL (R) THEN
FAILED ( "INCORRECT VALUE FOR BINARY OP - " & KIND);
END IF;
END GP2;
GENERIC
TYPE T1 (<>) IS PRIVATE;
TYPE T2 (<>) IS PRIVATE;
V1 : T1;
V2 : T2;
KIND : STRING;
WITH FUNCTION F1 (X : IN T1) RETURN T2;
PACKAGE GP3 IS
R : BOOLEAN := F1 (V1) = V2;
END GP3;
PACKAGE BODY GP3 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR OP - " & KIND);
END IF;
END GP3;
BEGIN
TEST ( "CC3601A", "CHECK THAT PREDEFINED OPERATORS MAY BE " &
"PASSED AS ACTUAL GENERIC SUBPROGRAM " &
"PARAMETERS" );
BEGIN -- CHECKS WITH RELATIONAL OPERATORS AND LOGICAL OPERATORS AS
-- ACTUAL PARAMETERS.
FOR I1 IN BOOLEAN LOOP
FOR I2 IN BOOLEAN LOOP
COMMENT ( "B1 = " & BOOLEAN'IMAGE (I1) & " AND " &
"B2 = " & BOOLEAN'IMAGE (I2) );
DECLARE
B1 : BOOLEAN := IDENT_BOOL (I1);
B2 : BOOLEAN := IDENT_BOOL (I2);
PACKAGE P1 IS
NEW GP1 (BOOLEAN, NOT B2, B2,
"""NOT"" - 1", "NOT");
PACKAGE P2 IS
NEW GP2 (BOOLEAN, B1 OR B2, B1, B2,
"OR", "OR");
PACKAGE P3 IS
NEW GP2 (BOOLEAN, B1 AND B2, B2, B1,
"AND", "AND");
PACKAGE P4 IS
NEW GP2 (BOOLEAN, B1 /= B2, B1, B2,
"XOR", "XOR");
PACKAGE P5 IS
NEW GP2 (BOOLEAN, B1 < B2, B1, B2,
"<", "<");
PACKAGE P6 IS
NEW GP2 (BOOLEAN, B1 <= B2, B1, B2,
"<=", "<=");
PACKAGE P7 IS
NEW GP2 (BOOLEAN, B1 > B2, B1, B2,
">", ">");
PACKAGE P8 IS
NEW GP2 (BOOLEAN, B1 >= B2, B1, B2,
">=", ">=");
TYPE AB IS ARRAY (BOOLEAN RANGE <> )
OF BOOLEAN;
AB1 : AB (BOOLEAN) := (B1, B2);
AB2 : AB (BOOLEAN) := (B2, B1);
T : AB (B1 .. B2) := (B1 .. B2 => TRUE);
F : AB (B1 .. B2) := (B1 .. B2 => FALSE);
VB1 : AB (B1 .. B1) := (B1 => B2);
VB2 : AB (B2 .. B2) := (B2 => B1);
PACKAGE P9 IS
NEW GP1 (AB, AB1, NOT AB1,
"""NOT"" - 2", "NOT");
PACKAGE P10 IS
NEW GP1 (AB, T, F,
"""NOT"" - 3", "NOT");
PACKAGE P11 IS
NEW GP1 (AB, VB2, (B2 => NOT B1),
"""NOT"" - 4", "NOT");
PACKAGE P12 IS
NEW GP2 (AB, AB1 AND AB2, AB1, AB2,
"AND", "AND");
BEGIN
NULL;
END;
END LOOP;
END LOOP;
END;
DECLARE -- CHECKS WITH ADDING AND MULTIPLYING OPERATORS, "**",
-- AND "ABS".
PACKAGE P1 IS NEW GP1 (INTEGER, -4, -4, """+"" - 1", "+");
PACKAGE P2 IS NEW GP1 (FLOAT, 4.0, 4.0, """+"" - 2", "+");
PACKAGE P3 IS NEW GP1 (DURATION, -4.0, -4.0, """+"" - 3",
"+");
PACKAGE P4 IS NEW GP1 (INTEGER, -4, 4, """-"" - 1", "-");
PACKAGE P5 IS NEW GP1 (FLOAT, 0.0, 0.0, """-"" - 2", "-");
PACKAGE P6 IS NEW GP1 (DURATION, 1.0, -1.0, """-"" - 3",
"-");
PACKAGE P7 IS NEW GP2 (INTEGER, 6, 1, 5, """+"" - 1", "+");
PACKAGE P8 IS NEW GP2 (FLOAT, 6.0, 1.0, 5.0, """+"" - 2",
"+");
PACKAGE P9 IS NEW GP2 (DURATION, 6.0, 1.0, 5.0, """+"" - 3",
"+");
PACKAGE P10 IS NEW GP2 (INTEGER, 1, 6, 5, """-"" - 1",
"-" );
PACKAGE P11 IS NEW GP2 (DURATION, 11.0, 6.0,-5.0,
"""-"" - 2", "-");
PACKAGE P12 IS NEW GP2 (FLOAT, 1.0, 6.0, 5.0, """-"" - 3",
"-");
SUBTYPE SUBINT IS INTEGER RANGE 0 .. 2;
TYPE STR IS ARRAY (SUBINT RANGE <>) OF CHARACTER;
VSTR : STR (0 .. 1) := "AB";
PACKAGE P13 IS NEW GP2 (STR, VSTR (0 .. 0) &
VSTR (1 .. 1),
VSTR (0 .. 0),
VSTR (1 .. 1), """&"" - 1", "&");
PACKAGE P14 IS NEW GP2 (STR, VSTR (1 .. 1) &
VSTR (0 .. 0),
VSTR (1 .. 1),
VSTR (0 .. 0), """&"" - 2", "&");
PACKAGE P15 IS NEW GP2 (INTEGER, 0, -1, 0, """*"" - 1", "*");
PACKAGE P16 IS NEW GP2 (FLOAT, 6.0, 3.0, 2.0, """*"" - 2",
"*");
PACKAGE P17 IS NEW GP2 (INTEGER, 0, 0, 6, """/"" - 1", "/");
PACKAGE P18 IS NEW GP2 (FLOAT, 3.0, 6.0, 2.0, """/"" - 2",
"/");
PACKAGE P19 IS NEW GP2 (INTEGER, -1, -11, 5, "REM", "REM");
PACKAGE P20 IS NEW GP2 (INTEGER, 4, -11, 5, "MOD", "MOD");
PACKAGE P21 IS NEW GP1 (INTEGER, 5, 5, """ABS"" - 1", "ABS");
PACKAGE P22 IS NEW GP1 (FLOAT, -5.0, 5.0, """ABS"" - 2",
"ABS");
PACKAGE P23 IS NEW GP1 (DURATION, 0.0, 0.0, """ABS"" - 3",
"ABS");
PACKAGE P24 IS NEW GP2 (INTEGER, 9, 3, 2, """**"" - 1",
"**");
PACKAGE P25 IS NEW GP2 (INTEGER, 1, 5, 0, """**"" - 2",
"**");
BEGIN
NULL;
END;
DECLARE -- CHECKS WITH ATTRIBUTES.
TYPE WEEKDAY IS (MON, TUES, WED, THUR, FRI);
PACKAGE P1 IS NEW GP1 (WEEKDAY, TUES, WED, "WEEKDAY'SUCC",
WEEKDAY'SUCC);
PACKAGE P2 IS NEW GP1 (WEEKDAY, TUES, MON, "WEEKDAY'PRED",
WEEKDAY'PRED);
PACKAGE P3 IS NEW GP3 (WEEKDAY, STRING, THUR, "THUR",
"WEEKDAY'IMAGE", WEEKDAY'IMAGE);
PACKAGE P4 IS NEW GP3 (STRING, WEEKDAY, "FRI", FRI,
"WEEKDAY'VALUE", WEEKDAY'VALUE);
BEGIN
NULL;
END;
RESULT;
END CC3601A;
| true |
-- CC3601A.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 PREDEFINED OPERATORS MAY BE PASSED AS ACTUAL
-- GENERIC SUBPROGRAM PARAMETERS (CHECKS FOR "=" AND "/=" ARE IN
-- CC3601C).
-- PI:NAME:<NAME>END_PI 10/9/86
-- JRL 11/15/95 Added unknown discriminant part to all formal
-- private types.
WITH REPORT; USE REPORT;
PROCEDURE CC3601A IS
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1 : T;
KIND : STRING;
WITH FUNCTION F1 (X : IN T) RETURN T;
PACKAGE GP1 IS
R : BOOLEAN := F1 (V) = V1;
END GP1;
PACKAGE BODY GP1 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR UNARY OP - " & KIND);
END IF;
END GP1;
GENERIC
TYPE T (<>) IS PRIVATE;
V, V1, V2 : IN T;
KIND : STRING;
WITH FUNCTION F1 (P1 : IN T; P2 : IN T) RETURN T;
PACKAGE GP2 IS
R : BOOLEAN := V /= F1 (V1, V2);
END GP2;
PACKAGE BODY GP2 IS
BEGIN
IF IDENT_BOOL (R) THEN
FAILED ( "INCORRECT VALUE FOR BINARY OP - " & KIND);
END IF;
END GP2;
GENERIC
TYPE T1 (<>) IS PRIVATE;
TYPE T2 (<>) IS PRIVATE;
V1 : T1;
V2 : T2;
KIND : STRING;
WITH FUNCTION F1 (X : IN T1) RETURN T2;
PACKAGE GP3 IS
R : BOOLEAN := F1 (V1) = V2;
END GP3;
PACKAGE BODY GP3 IS
BEGIN
IF NOT (IDENT_BOOL(R)) THEN
FAILED ( "INCORRECT VALUE FOR OP - " & KIND);
END IF;
END GP3;
BEGIN
TEST ( "CC3601A", "CHECK THAT PREDEFINED OPERATORS MAY BE " &
"PASSED AS ACTUAL GENERIC SUBPROGRAM " &
"PARAMETERS" );
BEGIN -- CHECKS WITH RELATIONAL OPERATORS AND LOGICAL OPERATORS AS
-- ACTUAL PARAMETERS.
FOR I1 IN BOOLEAN LOOP
FOR I2 IN BOOLEAN LOOP
COMMENT ( "B1 = " & BOOLEAN'IMAGE (I1) & " AND " &
"B2 = " & BOOLEAN'IMAGE (I2) );
DECLARE
B1 : BOOLEAN := IDENT_BOOL (I1);
B2 : BOOLEAN := IDENT_BOOL (I2);
PACKAGE P1 IS
NEW GP1 (BOOLEAN, NOT B2, B2,
"""NOT"" - 1", "NOT");
PACKAGE P2 IS
NEW GP2 (BOOLEAN, B1 OR B2, B1, B2,
"OR", "OR");
PACKAGE P3 IS
NEW GP2 (BOOLEAN, B1 AND B2, B2, B1,
"AND", "AND");
PACKAGE P4 IS
NEW GP2 (BOOLEAN, B1 /= B2, B1, B2,
"XOR", "XOR");
PACKAGE P5 IS
NEW GP2 (BOOLEAN, B1 < B2, B1, B2,
"<", "<");
PACKAGE P6 IS
NEW GP2 (BOOLEAN, B1 <= B2, B1, B2,
"<=", "<=");
PACKAGE P7 IS
NEW GP2 (BOOLEAN, B1 > B2, B1, B2,
">", ">");
PACKAGE P8 IS
NEW GP2 (BOOLEAN, B1 >= B2, B1, B2,
">=", ">=");
TYPE AB IS ARRAY (BOOLEAN RANGE <> )
OF BOOLEAN;
AB1 : AB (BOOLEAN) := (B1, B2);
AB2 : AB (BOOLEAN) := (B2, B1);
T : AB (B1 .. B2) := (B1 .. B2 => TRUE);
F : AB (B1 .. B2) := (B1 .. B2 => FALSE);
VB1 : AB (B1 .. B1) := (B1 => B2);
VB2 : AB (B2 .. B2) := (B2 => B1);
PACKAGE P9 IS
NEW GP1 (AB, AB1, NOT AB1,
"""NOT"" - 2", "NOT");
PACKAGE P10 IS
NEW GP1 (AB, T, F,
"""NOT"" - 3", "NOT");
PACKAGE P11 IS
NEW GP1 (AB, VB2, (B2 => NOT B1),
"""NOT"" - 4", "NOT");
PACKAGE P12 IS
NEW GP2 (AB, AB1 AND AB2, AB1, AB2,
"AND", "AND");
BEGIN
NULL;
END;
END LOOP;
END LOOP;
END;
DECLARE -- CHECKS WITH ADDING AND MULTIPLYING OPERATORS, "**",
-- AND "ABS".
PACKAGE P1 IS NEW GP1 (INTEGER, -4, -4, """+"" - 1", "+");
PACKAGE P2 IS NEW GP1 (FLOAT, 4.0, 4.0, """+"" - 2", "+");
PACKAGE P3 IS NEW GP1 (DURATION, -4.0, -4.0, """+"" - 3",
"+");
PACKAGE P4 IS NEW GP1 (INTEGER, -4, 4, """-"" - 1", "-");
PACKAGE P5 IS NEW GP1 (FLOAT, 0.0, 0.0, """-"" - 2", "-");
PACKAGE P6 IS NEW GP1 (DURATION, 1.0, -1.0, """-"" - 3",
"-");
PACKAGE P7 IS NEW GP2 (INTEGER, 6, 1, 5, """+"" - 1", "+");
PACKAGE P8 IS NEW GP2 (FLOAT, 6.0, 1.0, 5.0, """+"" - 2",
"+");
PACKAGE P9 IS NEW GP2 (DURATION, 6.0, 1.0, 5.0, """+"" - 3",
"+");
PACKAGE P10 IS NEW GP2 (INTEGER, 1, 6, 5, """-"" - 1",
"-" );
PACKAGE P11 IS NEW GP2 (DURATION, 11.0, 6.0,-5.0,
"""-"" - 2", "-");
PACKAGE P12 IS NEW GP2 (FLOAT, 1.0, 6.0, 5.0, """-"" - 3",
"-");
SUBTYPE SUBINT IS INTEGER RANGE 0 .. 2;
TYPE STR IS ARRAY (SUBINT RANGE <>) OF CHARACTER;
VSTR : STR (0 .. 1) := "AB";
PACKAGE P13 IS NEW GP2 (STR, VSTR (0 .. 0) &
VSTR (1 .. 1),
VSTR (0 .. 0),
VSTR (1 .. 1), """&"" - 1", "&");
PACKAGE P14 IS NEW GP2 (STR, VSTR (1 .. 1) &
VSTR (0 .. 0),
VSTR (1 .. 1),
VSTR (0 .. 0), """&"" - 2", "&");
PACKAGE P15 IS NEW GP2 (INTEGER, 0, -1, 0, """*"" - 1", "*");
PACKAGE P16 IS NEW GP2 (FLOAT, 6.0, 3.0, 2.0, """*"" - 2",
"*");
PACKAGE P17 IS NEW GP2 (INTEGER, 0, 0, 6, """/"" - 1", "/");
PACKAGE P18 IS NEW GP2 (FLOAT, 3.0, 6.0, 2.0, """/"" - 2",
"/");
PACKAGE P19 IS NEW GP2 (INTEGER, -1, -11, 5, "REM", "REM");
PACKAGE P20 IS NEW GP2 (INTEGER, 4, -11, 5, "MOD", "MOD");
PACKAGE P21 IS NEW GP1 (INTEGER, 5, 5, """ABS"" - 1", "ABS");
PACKAGE P22 IS NEW GP1 (FLOAT, -5.0, 5.0, """ABS"" - 2",
"ABS");
PACKAGE P23 IS NEW GP1 (DURATION, 0.0, 0.0, """ABS"" - 3",
"ABS");
PACKAGE P24 IS NEW GP2 (INTEGER, 9, 3, 2, """**"" - 1",
"**");
PACKAGE P25 IS NEW GP2 (INTEGER, 1, 5, 0, """**"" - 2",
"**");
BEGIN
NULL;
END;
DECLARE -- CHECKS WITH ATTRIBUTES.
TYPE WEEKDAY IS (MON, TUES, WED, THUR, FRI);
PACKAGE P1 IS NEW GP1 (WEEKDAY, TUES, WED, "WEEKDAY'SUCC",
WEEKDAY'SUCC);
PACKAGE P2 IS NEW GP1 (WEEKDAY, TUES, MON, "WEEKDAY'PRED",
WEEKDAY'PRED);
PACKAGE P3 IS NEW GP3 (WEEKDAY, STRING, THUR, "THUR",
"WEEKDAY'IMAGE", WEEKDAY'IMAGE);
PACKAGE P4 IS NEW GP3 (STRING, WEEKDAY, "FRI", FRI,
"WEEKDAY'VALUE", WEEKDAY'VALUE);
BEGIN
NULL;
END;
RESULT;
END CC3601A;
|
[
{
"context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2016 onox <[email protected]>\n--\n-- Licensed under the A",
"end": 70,
"score": 0.9991413354873657,
"start": 66,
"tag": "USERNAME",
"value": "onox"
},
{
"context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2016 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio",
"end": 91,
"score": 0.9999242424964905,
"start": 72,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
orka/src/orka/interface/orka-rendering-buffers.ads
|
onox/orka
| 52 |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Objects.Buffers;
with GL.Types.Indirect;
with Orka.Types;
package Orka.Rendering.Buffers is
pragma Preelaborate;
subtype Storage_Bits is GL.Objects.Buffers.Storage_Bits;
use GL.Types;
use all type Orka.Types.Element_Type;
-----------------------------------------------------------------------------
type Bindable_Buffer is interface;
type Indexed_Buffer_Target is (Atomic_Counter, Shader_Storage, Uniform);
-- Buffer targets that can be read/written in shaders
type Buffer_Target is
(Index, Dispatch_Indirect, Draw_Indirect, Parameter, Pixel_Pack, Pixel_Unpack, Query);
procedure Bind
(Object : Bindable_Buffer;
Target : Indexed_Buffer_Target;
Index : Natural) is abstract;
-- Bind the buffer object to the binding point at the given index of
-- the target
procedure Bind
(Object : Bindable_Buffer;
Target : Buffer_Target) is abstract;
-- Bind the buffer object to the target
function Length (Object : Bindable_Buffer) return Natural is abstract;
-----------------------------------------------------------------------------
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with private;
function Create_Buffer
(Flags : Storage_Bits;
Kind : Types.Element_Type;
Length : Natural) return Buffer;
-----------------------------------------------------------------------------
function Create_Buffer
(Flags : Storage_Bits;
Data : Half_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Single_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Double_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Int_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : UInt_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Arrays_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Elements_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Dispatch_Indirect_Command_Array) return Buffer;
-----------------------------------------------------------------------------
overriding
function Length (Object : Buffer) return Natural
with Inline;
overriding
procedure Bind (Object : Buffer; Target : Indexed_Buffer_Target; Index : Natural);
-- Bind the buffer object to the binding point at the given index of
-- the target
overriding
procedure Bind (Object : Buffer; Target : Buffer_Target);
-- Bind the buffer object to the target
-----------------------------------------------------------------------------
procedure Set_Data
(Object : Buffer;
Data : Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Arrays_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Arrays_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Elements_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Elements_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Dispatch_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Dispatch_Command_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Clear_Data
(Object : Buffer;
Data : Int_Array)
with Pre => Object.Kind = Int_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : UInt_Array)
with Pre => Object.Kind = UInt_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Single_Array)
with Pre => Object.Kind = Single_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4)
with Pre => Object.Kind = Single_Vector_Type
or else (Object.Kind = Single_Type and Object.Length mod 4 = 0);
-----------------------------------------------------------------------------
procedure Copy_Data
(Object : Buffer;
Target : Buffer)
with Pre => Object.Kind = Target.Kind and then Object.Length = Target.Length;
private
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with record
Buffer : GL.Objects.Buffers.Buffer;
Length : Natural;
end record;
end Orka.Rendering.Buffers;
|
2691
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <<EMAIL>>
--
-- 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 GL.Objects.Buffers;
with GL.Types.Indirect;
with Orka.Types;
package Orka.Rendering.Buffers is
pragma Preelaborate;
subtype Storage_Bits is GL.Objects.Buffers.Storage_Bits;
use GL.Types;
use all type Orka.Types.Element_Type;
-----------------------------------------------------------------------------
type Bindable_Buffer is interface;
type Indexed_Buffer_Target is (Atomic_Counter, Shader_Storage, Uniform);
-- Buffer targets that can be read/written in shaders
type Buffer_Target is
(Index, Dispatch_Indirect, Draw_Indirect, Parameter, Pixel_Pack, Pixel_Unpack, Query);
procedure Bind
(Object : Bindable_Buffer;
Target : Indexed_Buffer_Target;
Index : Natural) is abstract;
-- Bind the buffer object to the binding point at the given index of
-- the target
procedure Bind
(Object : Bindable_Buffer;
Target : Buffer_Target) is abstract;
-- Bind the buffer object to the target
function Length (Object : Bindable_Buffer) return Natural is abstract;
-----------------------------------------------------------------------------
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with private;
function Create_Buffer
(Flags : Storage_Bits;
Kind : Types.Element_Type;
Length : Natural) return Buffer;
-----------------------------------------------------------------------------
function Create_Buffer
(Flags : Storage_Bits;
Data : Half_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Single_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Double_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Int_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : UInt_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Arrays_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Elements_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Dispatch_Indirect_Command_Array) return Buffer;
-----------------------------------------------------------------------------
overriding
function Length (Object : Buffer) return Natural
with Inline;
overriding
procedure Bind (Object : Buffer; Target : Indexed_Buffer_Target; Index : Natural);
-- Bind the buffer object to the binding point at the given index of
-- the target
overriding
procedure Bind (Object : Buffer; Target : Buffer_Target);
-- Bind the buffer object to the target
-----------------------------------------------------------------------------
procedure Set_Data
(Object : Buffer;
Data : Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Arrays_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Arrays_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Elements_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Elements_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Dispatch_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Dispatch_Command_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Clear_Data
(Object : Buffer;
Data : Int_Array)
with Pre => Object.Kind = Int_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : UInt_Array)
with Pre => Object.Kind = UInt_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Single_Array)
with Pre => Object.Kind = Single_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4)
with Pre => Object.Kind = Single_Vector_Type
or else (Object.Kind = Single_Type and Object.Length mod 4 = 0);
-----------------------------------------------------------------------------
procedure Copy_Data
(Object : Buffer;
Target : Buffer)
with Pre => Object.Kind = Target.Kind and then Object.Length = Target.Length;
private
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with record
Buffer : GL.Objects.Buffers.Buffer;
Length : Natural;
end record;
end Orka.Rendering.Buffers;
| true |
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <PI:EMAIL:<EMAIL>END_PI>
--
-- 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 GL.Objects.Buffers;
with GL.Types.Indirect;
with Orka.Types;
package Orka.Rendering.Buffers is
pragma Preelaborate;
subtype Storage_Bits is GL.Objects.Buffers.Storage_Bits;
use GL.Types;
use all type Orka.Types.Element_Type;
-----------------------------------------------------------------------------
type Bindable_Buffer is interface;
type Indexed_Buffer_Target is (Atomic_Counter, Shader_Storage, Uniform);
-- Buffer targets that can be read/written in shaders
type Buffer_Target is
(Index, Dispatch_Indirect, Draw_Indirect, Parameter, Pixel_Pack, Pixel_Unpack, Query);
procedure Bind
(Object : Bindable_Buffer;
Target : Indexed_Buffer_Target;
Index : Natural) is abstract;
-- Bind the buffer object to the binding point at the given index of
-- the target
procedure Bind
(Object : Bindable_Buffer;
Target : Buffer_Target) is abstract;
-- Bind the buffer object to the target
function Length (Object : Bindable_Buffer) return Natural is abstract;
-----------------------------------------------------------------------------
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with private;
function Create_Buffer
(Flags : Storage_Bits;
Kind : Types.Element_Type;
Length : Natural) return Buffer;
-----------------------------------------------------------------------------
function Create_Buffer
(Flags : Storage_Bits;
Data : Half_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Single_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Double_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Int_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : UInt_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Arrays_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Elements_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Dispatch_Indirect_Command_Array) return Buffer;
-----------------------------------------------------------------------------
overriding
function Length (Object : Buffer) return Natural
with Inline;
overriding
procedure Bind (Object : Buffer; Target : Indexed_Buffer_Target; Index : Natural);
-- Bind the buffer object to the binding point at the given index of
-- the target
overriding
procedure Bind (Object : Buffer; Target : Buffer_Target);
-- Bind the buffer object to the target
-----------------------------------------------------------------------------
procedure Set_Data
(Object : Buffer;
Data : Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Arrays_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Arrays_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Elements_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Elements_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Dispatch_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Dispatch_Command_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Clear_Data
(Object : Buffer;
Data : Int_Array)
with Pre => Object.Kind = Int_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : UInt_Array)
with Pre => Object.Kind = UInt_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Single_Array)
with Pre => Object.Kind = Single_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4)
with Pre => Object.Kind = Single_Vector_Type
or else (Object.Kind = Single_Type and Object.Length mod 4 = 0);
-----------------------------------------------------------------------------
procedure Copy_Data
(Object : Buffer;
Target : Buffer)
with Pre => Object.Kind = Target.Kind and then Object.Length = Target.Length;
private
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with record
Buffer : GL.Objects.Buffers.Buffer;
Length : Natural;
end record;
end Orka.Rendering.Buffers;
|
[
{
"context": "pper for record types\n-- Copyright (C) 2010, 2011 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g",
"end": 184,
"score": 0.9998729825019836,
"start": 169,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "ight (C) 2010, 2011 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under",
"end": 215,
"score": 0.9998801350593567,
"start": 200,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio",
"end": 242,
"score": 0.9999290704727173,
"start": 217,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
src/util-serialize-mappers-record_mapper.adb
|
Letractively/ada-util
| 60 |
-----------------------------------------------------------------------
-- Util.Serialize.Mappers.Record_Mapper -- Mapper for record types
-- Copyright (C) 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Serialize.Contexts;
with Util.Strings.Transforms;
with Util.Log.Loggers;
package body Util.Serialize.Mappers.Record_Mapper is
use Util.Log;
Key : Util.Serialize.Contexts.Data_Key;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Serialize.Mappers.Record_Mapper",
Util.Log.WARN_LEVEL);
-- -----------------------
-- Get the element object.
-- -----------------------
function Get_Element (Data : in Element_Data) return Element_Type_Access is
begin
return Data.Element;
end Get_Element;
-- -----------------------
-- Set the element object. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Element (Data : in out Element_Data;
Element : in Element_Type_Access;
Release : in Boolean := False) is
begin
Data.Element := Element;
Data.Release := Release;
end Set_Element;
-- -----------------------
-- Finalize the object when it is removed from the reader context.
-- If the
-- -----------------------
overriding
procedure Finalize (Data : in out Element_Data) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Element_Type,
Name => Element_Type_Access);
begin
if Data.Release then
Free (Data.Element);
end if;
end Finalize;
-- -----------------------
-- Execute the mapping operation on the object associated with the current context.
-- The object is extracted from the context and the <b>Execute</b> operation is called.
-- -----------------------
procedure Execute (Handler : in Mapper;
Map : in Mapping'Class;
Ctx : in out Util.Serialize.Contexts.Context'Class;
Value : in Util.Beans.Objects.Object) is
D : constant Contexts.Data_Access := Ctx.Get_Data (Key);
begin
if not (D.all in Element_Data'Class) then
raise Util.Serialize.Contexts.No_Data;
end if;
declare
DE : constant Element_Data_Access := Element_Data'Class (D.all)'Access;
begin
if DE.Element = null then
raise Util.Serialize.Contexts.No_Data;
end if;
Handler.Execute (Map, DE.Element.all, Value);
end;
end Execute;
-- -----------------------
-- Add a mapping for setting a member. When the attribute rule defined by <b>Path</b>
-- is matched, the <b>Set_Member</b> procedure will be called with the value and the
-- <b>Field</b> identification.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Field : in Fields) is
Map : constant Attribute_Mapping_Access := new Attribute_Mapping;
begin
Map.Index := Field;
Into.Add_Mapping (Path, Map.all'Unchecked_Access);
end Add_Mapping;
-- -----------------------
-- Add a mapping associated with the path and described by a mapper object.
-- The <b>Proxy</b> procedure is in charge of giving access to the target
-- object used by the <b>Map</b> mapper.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Map : in Util.Serialize.Mappers.Mapper_Access;
Proxy : in Proxy_Object) is
M : constant Proxy_Mapper_Access := new Proxy_Mapper;
begin
M.Mapper := Map;
M.Execute := Proxy;
M.Is_Proxy_Mapper := True;
Into.Add_Mapping (Path, M.all'Unchecked_Access);
end Add_Mapping;
--
procedure Bind (Into : in out Mapper;
Getter : in Get_Member_Access) is
begin
Into.Get_Member := Getter;
end Bind;
procedure Bind (Into : in out Mapper;
From : in Mapper_Access) is
begin
Into.Get_Member := From.Get_Member;
end Bind;
function Get_Getter (From : in Mapper) return Get_Member_Access is
begin
return From.Get_Member;
end Get_Getter;
procedure Set_Member (Attr : in Attribute_Mapping;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
Set_Member (Element, Attr.Index, Value);
end Set_Member;
-- -----------------------
-- Set the attribute member described by the <b>Attr</b> mapping
-- into the value passed in <b>Element</b>. This operation will call
-- the package parameter function of the same name.
-- -----------------------
procedure Set_Member (Attr : in Mapping'Class;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
if not (Attr in Attribute_Mapping) then
Log.Error ("Mapping is not an Attribute_Mapping");
raise Mapping_Error;
end if;
Attribute_Mapping (Attr).Set_Member (Element, Value);
end Set_Member;
-- -----------------------
-- Set the element in the context. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class;
Element : in Element_Type_Access;
Release : in Boolean := False) is
Data_Context : constant Element_Data_Access := new Element_Data;
begin
Data_Context.Element := Element;
Data_Context.Release := Release;
Ctx.Set_Data (Key => Key, Content => Data_Context.all'Unchecked_Access);
end Set_Context;
-- -----------------------
-- Find the mapper associated with the given name.
-- Returns null if there is no mapper.
-- -----------------------
overriding
function Find_Mapper (Controller : in Proxy_Mapper;
Name : in String;
Attribute : in Boolean := False) return Mappers.Mapper_Access is
Result : constant Mappers.Mapper_Access := Controller.Mapper.Find_Mapper (Name, Attribute);
begin
if Result /= null then
return Result;
else
return Util.Serialize.Mappers.Mapper (Controller).Find_Mapper (Name, Attribute);
end if;
end Find_Mapper;
-- -----------------------
-- Build a default mapping based on the <b>Fields</b> enumeration.
-- The enumeration name is used for the mapping name with the optional <b>FIELD_</b>
-- prefix stripped.
-- -----------------------
procedure Add_Default_Mapping (Into : in out Mapper) is
use Util.Strings.Transforms;
begin
for Field in Fields'Range loop
declare
Name : constant String := To_Lower_Case (Fields'Image (Field));
begin
if Name (Name'First .. Name'First + 5) = "field_" then
Into.Add_Mapping (Name (Name'First + 6 .. Name'Last), Field);
else
Into.Add_Mapping (Name, Field);
end if;
end;
end loop;
end Add_Default_Mapping;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Mapper;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
begin
if Handler.Get_Member = null then
Log.Error ("The mapper has a null Get_Member function");
raise Mapping_Error with "The mapper has a null Get_Member function";
end if;
Write (Handler, Handler.Get_Member, Stream, Element);
end Write;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Util.Serialize.Mappers.Mapper'Class;
Getter : in Get_Member_Access;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
use Ada.Strings.Unbounded;
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class);
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class) is
Name : constant String := To_String (Map.Name);
begin
if Map.Mapping /= null then
declare
M : constant Attribute_Mapping_Access
:= Attribute_Mapping'Class (Map.Mapping.all)'Access;
Val : constant Util.Beans.Objects.Object := Getter (Element, M.Index);
begin
if M.Is_Attribute then
Stream.Write_Attribute (Name => Name, Value => Val);
else
Stream.Write_Entity (Name => Name, Value => Val);
end if;
end;
else
Stream.Start_Entity (Name);
Map.Iterate (Write'Access);
Stream.End_Entity (Name);
end if;
end Write;
begin
Handler.Iterate (Write'Access);
end Write;
-- -----------------------
-- Clone the <b>Handler</b> instance and get a copy of that single object.
-- -----------------------
function Clone (Handler : in Mapper) return Util.Serialize.Mappers.Mapper_Access is
Result : constant Mapper_Access := new Mapper;
begin
Result.Name := Handler.Name;
Result.Mapper := Handler.Mapper;
Result.Mapping := Handler.Mapping;
Result.Is_Proxy_Mapper := Handler.Is_Proxy_Mapper;
Result.Is_Wildcard := Handler.Is_Wildcard;
Result.Is_Deep_Wildcard := Handler.Is_Deep_Wildcard;
Result.Get_Member := Handler.Get_Member;
Result.Execute := Handler.Execute;
return Result.all'Unchecked_Access;
end Clone;
begin
-- Allocate the unique data key.
Util.Serialize.Contexts.Allocate (Key);
end Util.Serialize.Mappers.Record_Mapper;
|
7461
|
-----------------------------------------------------------------------
-- Util.Serialize.Mappers.Record_Mapper -- Mapper for record types
-- Copyright (C) 2010, 2011 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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;
with Util.Serialize.Contexts;
with Util.Strings.Transforms;
with Util.Log.Loggers;
package body Util.Serialize.Mappers.Record_Mapper is
use Util.Log;
Key : Util.Serialize.Contexts.Data_Key;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Serialize.Mappers.Record_Mapper",
Util.Log.WARN_LEVEL);
-- -----------------------
-- Get the element object.
-- -----------------------
function Get_Element (Data : in Element_Data) return Element_Type_Access is
begin
return Data.Element;
end Get_Element;
-- -----------------------
-- Set the element object. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Element (Data : in out Element_Data;
Element : in Element_Type_Access;
Release : in Boolean := False) is
begin
Data.Element := Element;
Data.Release := Release;
end Set_Element;
-- -----------------------
-- Finalize the object when it is removed from the reader context.
-- If the
-- -----------------------
overriding
procedure Finalize (Data : in out Element_Data) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Element_Type,
Name => Element_Type_Access);
begin
if Data.Release then
Free (Data.Element);
end if;
end Finalize;
-- -----------------------
-- Execute the mapping operation on the object associated with the current context.
-- The object is extracted from the context and the <b>Execute</b> operation is called.
-- -----------------------
procedure Execute (Handler : in Mapper;
Map : in Mapping'Class;
Ctx : in out Util.Serialize.Contexts.Context'Class;
Value : in Util.Beans.Objects.Object) is
D : constant Contexts.Data_Access := Ctx.Get_Data (Key);
begin
if not (D.all in Element_Data'Class) then
raise Util.Serialize.Contexts.No_Data;
end if;
declare
DE : constant Element_Data_Access := Element_Data'Class (D.all)'Access;
begin
if DE.Element = null then
raise Util.Serialize.Contexts.No_Data;
end if;
Handler.Execute (Map, DE.Element.all, Value);
end;
end Execute;
-- -----------------------
-- Add a mapping for setting a member. When the attribute rule defined by <b>Path</b>
-- is matched, the <b>Set_Member</b> procedure will be called with the value and the
-- <b>Field</b> identification.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Field : in Fields) is
Map : constant Attribute_Mapping_Access := new Attribute_Mapping;
begin
Map.Index := Field;
Into.Add_Mapping (Path, Map.all'Unchecked_Access);
end Add_Mapping;
-- -----------------------
-- Add a mapping associated with the path and described by a mapper object.
-- The <b>Proxy</b> procedure is in charge of giving access to the target
-- object used by the <b>Map</b> mapper.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Map : in Util.Serialize.Mappers.Mapper_Access;
Proxy : in Proxy_Object) is
M : constant Proxy_Mapper_Access := new Proxy_Mapper;
begin
M.Mapper := Map;
M.Execute := Proxy;
M.Is_Proxy_Mapper := True;
Into.Add_Mapping (Path, M.all'Unchecked_Access);
end Add_Mapping;
--
procedure Bind (Into : in out Mapper;
Getter : in Get_Member_Access) is
begin
Into.Get_Member := Getter;
end Bind;
procedure Bind (Into : in out Mapper;
From : in Mapper_Access) is
begin
Into.Get_Member := From.Get_Member;
end Bind;
function Get_Getter (From : in Mapper) return Get_Member_Access is
begin
return From.Get_Member;
end Get_Getter;
procedure Set_Member (Attr : in Attribute_Mapping;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
Set_Member (Element, Attr.Index, Value);
end Set_Member;
-- -----------------------
-- Set the attribute member described by the <b>Attr</b> mapping
-- into the value passed in <b>Element</b>. This operation will call
-- the package parameter function of the same name.
-- -----------------------
procedure Set_Member (Attr : in Mapping'Class;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
if not (Attr in Attribute_Mapping) then
Log.Error ("Mapping is not an Attribute_Mapping");
raise Mapping_Error;
end if;
Attribute_Mapping (Attr).Set_Member (Element, Value);
end Set_Member;
-- -----------------------
-- Set the element in the context. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class;
Element : in Element_Type_Access;
Release : in Boolean := False) is
Data_Context : constant Element_Data_Access := new Element_Data;
begin
Data_Context.Element := Element;
Data_Context.Release := Release;
Ctx.Set_Data (Key => Key, Content => Data_Context.all'Unchecked_Access);
end Set_Context;
-- -----------------------
-- Find the mapper associated with the given name.
-- Returns null if there is no mapper.
-- -----------------------
overriding
function Find_Mapper (Controller : in Proxy_Mapper;
Name : in String;
Attribute : in Boolean := False) return Mappers.Mapper_Access is
Result : constant Mappers.Mapper_Access := Controller.Mapper.Find_Mapper (Name, Attribute);
begin
if Result /= null then
return Result;
else
return Util.Serialize.Mappers.Mapper (Controller).Find_Mapper (Name, Attribute);
end if;
end Find_Mapper;
-- -----------------------
-- Build a default mapping based on the <b>Fields</b> enumeration.
-- The enumeration name is used for the mapping name with the optional <b>FIELD_</b>
-- prefix stripped.
-- -----------------------
procedure Add_Default_Mapping (Into : in out Mapper) is
use Util.Strings.Transforms;
begin
for Field in Fields'Range loop
declare
Name : constant String := To_Lower_Case (Fields'Image (Field));
begin
if Name (Name'First .. Name'First + 5) = "field_" then
Into.Add_Mapping (Name (Name'First + 6 .. Name'Last), Field);
else
Into.Add_Mapping (Name, Field);
end if;
end;
end loop;
end Add_Default_Mapping;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Mapper;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
begin
if Handler.Get_Member = null then
Log.Error ("The mapper has a null Get_Member function");
raise Mapping_Error with "The mapper has a null Get_Member function";
end if;
Write (Handler, Handler.Get_Member, Stream, Element);
end Write;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Util.Serialize.Mappers.Mapper'Class;
Getter : in Get_Member_Access;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
use Ada.Strings.Unbounded;
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class);
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class) is
Name : constant String := To_String (Map.Name);
begin
if Map.Mapping /= null then
declare
M : constant Attribute_Mapping_Access
:= Attribute_Mapping'Class (Map.Mapping.all)'Access;
Val : constant Util.Beans.Objects.Object := Getter (Element, M.Index);
begin
if M.Is_Attribute then
Stream.Write_Attribute (Name => Name, Value => Val);
else
Stream.Write_Entity (Name => Name, Value => Val);
end if;
end;
else
Stream.Start_Entity (Name);
Map.Iterate (Write'Access);
Stream.End_Entity (Name);
end if;
end Write;
begin
Handler.Iterate (Write'Access);
end Write;
-- -----------------------
-- Clone the <b>Handler</b> instance and get a copy of that single object.
-- -----------------------
function Clone (Handler : in Mapper) return Util.Serialize.Mappers.Mapper_Access is
Result : constant Mapper_Access := new Mapper;
begin
Result.Name := Handler.Name;
Result.Mapper := Handler.Mapper;
Result.Mapping := Handler.Mapping;
Result.Is_Proxy_Mapper := Handler.Is_Proxy_Mapper;
Result.Is_Wildcard := Handler.Is_Wildcard;
Result.Is_Deep_Wildcard := Handler.Is_Deep_Wildcard;
Result.Get_Member := Handler.Get_Member;
Result.Execute := Handler.Execute;
return Result.all'Unchecked_Access;
end Clone;
begin
-- Allocate the unique data key.
Util.Serialize.Contexts.Allocate (Key);
end Util.Serialize.Mappers.Record_Mapper;
| true |
-----------------------------------------------------------------------
-- Util.Serialize.Mappers.Record_Mapper -- Mapper for record types
-- Copyright (C) 2010, 2011 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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;
with Util.Serialize.Contexts;
with Util.Strings.Transforms;
with Util.Log.Loggers;
package body Util.Serialize.Mappers.Record_Mapper is
use Util.Log;
Key : Util.Serialize.Contexts.Data_Key;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Serialize.Mappers.Record_Mapper",
Util.Log.WARN_LEVEL);
-- -----------------------
-- Get the element object.
-- -----------------------
function Get_Element (Data : in Element_Data) return Element_Type_Access is
begin
return Data.Element;
end Get_Element;
-- -----------------------
-- Set the element object. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Element (Data : in out Element_Data;
Element : in Element_Type_Access;
Release : in Boolean := False) is
begin
Data.Element := Element;
Data.Release := Release;
end Set_Element;
-- -----------------------
-- Finalize the object when it is removed from the reader context.
-- If the
-- -----------------------
overriding
procedure Finalize (Data : in out Element_Data) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Element_Type,
Name => Element_Type_Access);
begin
if Data.Release then
Free (Data.Element);
end if;
end Finalize;
-- -----------------------
-- Execute the mapping operation on the object associated with the current context.
-- The object is extracted from the context and the <b>Execute</b> operation is called.
-- -----------------------
procedure Execute (Handler : in Mapper;
Map : in Mapping'Class;
Ctx : in out Util.Serialize.Contexts.Context'Class;
Value : in Util.Beans.Objects.Object) is
D : constant Contexts.Data_Access := Ctx.Get_Data (Key);
begin
if not (D.all in Element_Data'Class) then
raise Util.Serialize.Contexts.No_Data;
end if;
declare
DE : constant Element_Data_Access := Element_Data'Class (D.all)'Access;
begin
if DE.Element = null then
raise Util.Serialize.Contexts.No_Data;
end if;
Handler.Execute (Map, DE.Element.all, Value);
end;
end Execute;
-- -----------------------
-- Add a mapping for setting a member. When the attribute rule defined by <b>Path</b>
-- is matched, the <b>Set_Member</b> procedure will be called with the value and the
-- <b>Field</b> identification.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Field : in Fields) is
Map : constant Attribute_Mapping_Access := new Attribute_Mapping;
begin
Map.Index := Field;
Into.Add_Mapping (Path, Map.all'Unchecked_Access);
end Add_Mapping;
-- -----------------------
-- Add a mapping associated with the path and described by a mapper object.
-- The <b>Proxy</b> procedure is in charge of giving access to the target
-- object used by the <b>Map</b> mapper.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Map : in Util.Serialize.Mappers.Mapper_Access;
Proxy : in Proxy_Object) is
M : constant Proxy_Mapper_Access := new Proxy_Mapper;
begin
M.Mapper := Map;
M.Execute := Proxy;
M.Is_Proxy_Mapper := True;
Into.Add_Mapping (Path, M.all'Unchecked_Access);
end Add_Mapping;
--
procedure Bind (Into : in out Mapper;
Getter : in Get_Member_Access) is
begin
Into.Get_Member := Getter;
end Bind;
procedure Bind (Into : in out Mapper;
From : in Mapper_Access) is
begin
Into.Get_Member := From.Get_Member;
end Bind;
function Get_Getter (From : in Mapper) return Get_Member_Access is
begin
return From.Get_Member;
end Get_Getter;
procedure Set_Member (Attr : in Attribute_Mapping;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
Set_Member (Element, Attr.Index, Value);
end Set_Member;
-- -----------------------
-- Set the attribute member described by the <b>Attr</b> mapping
-- into the value passed in <b>Element</b>. This operation will call
-- the package parameter function of the same name.
-- -----------------------
procedure Set_Member (Attr : in Mapping'Class;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
if not (Attr in Attribute_Mapping) then
Log.Error ("Mapping is not an Attribute_Mapping");
raise Mapping_Error;
end if;
Attribute_Mapping (Attr).Set_Member (Element, Value);
end Set_Member;
-- -----------------------
-- Set the element in the context. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class;
Element : in Element_Type_Access;
Release : in Boolean := False) is
Data_Context : constant Element_Data_Access := new Element_Data;
begin
Data_Context.Element := Element;
Data_Context.Release := Release;
Ctx.Set_Data (Key => Key, Content => Data_Context.all'Unchecked_Access);
end Set_Context;
-- -----------------------
-- Find the mapper associated with the given name.
-- Returns null if there is no mapper.
-- -----------------------
overriding
function Find_Mapper (Controller : in Proxy_Mapper;
Name : in String;
Attribute : in Boolean := False) return Mappers.Mapper_Access is
Result : constant Mappers.Mapper_Access := Controller.Mapper.Find_Mapper (Name, Attribute);
begin
if Result /= null then
return Result;
else
return Util.Serialize.Mappers.Mapper (Controller).Find_Mapper (Name, Attribute);
end if;
end Find_Mapper;
-- -----------------------
-- Build a default mapping based on the <b>Fields</b> enumeration.
-- The enumeration name is used for the mapping name with the optional <b>FIELD_</b>
-- prefix stripped.
-- -----------------------
procedure Add_Default_Mapping (Into : in out Mapper) is
use Util.Strings.Transforms;
begin
for Field in Fields'Range loop
declare
Name : constant String := To_Lower_Case (Fields'Image (Field));
begin
if Name (Name'First .. Name'First + 5) = "field_" then
Into.Add_Mapping (Name (Name'First + 6 .. Name'Last), Field);
else
Into.Add_Mapping (Name, Field);
end if;
end;
end loop;
end Add_Default_Mapping;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Mapper;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
begin
if Handler.Get_Member = null then
Log.Error ("The mapper has a null Get_Member function");
raise Mapping_Error with "The mapper has a null Get_Member function";
end if;
Write (Handler, Handler.Get_Member, Stream, Element);
end Write;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Util.Serialize.Mappers.Mapper'Class;
Getter : in Get_Member_Access;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
use Ada.Strings.Unbounded;
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class);
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class) is
Name : constant String := To_String (Map.Name);
begin
if Map.Mapping /= null then
declare
M : constant Attribute_Mapping_Access
:= Attribute_Mapping'Class (Map.Mapping.all)'Access;
Val : constant Util.Beans.Objects.Object := Getter (Element, M.Index);
begin
if M.Is_Attribute then
Stream.Write_Attribute (Name => Name, Value => Val);
else
Stream.Write_Entity (Name => Name, Value => Val);
end if;
end;
else
Stream.Start_Entity (Name);
Map.Iterate (Write'Access);
Stream.End_Entity (Name);
end if;
end Write;
begin
Handler.Iterate (Write'Access);
end Write;
-- -----------------------
-- Clone the <b>Handler</b> instance and get a copy of that single object.
-- -----------------------
function Clone (Handler : in Mapper) return Util.Serialize.Mappers.Mapper_Access is
Result : constant Mapper_Access := new Mapper;
begin
Result.Name := Handler.Name;
Result.Mapper := Handler.Mapper;
Result.Mapping := Handler.Mapping;
Result.Is_Proxy_Mapper := Handler.Is_Proxy_Mapper;
Result.Is_Wildcard := Handler.Is_Wildcard;
Result.Is_Deep_Wildcard := Handler.Is_Deep_Wildcard;
Result.Get_Member := Handler.Get_Member;
Result.Execute := Handler.Execute;
return Result.all'Unchecked_Access;
end Clone;
begin
-- Allocate the unique data key.
Util.Serialize.Contexts.Allocate (Key);
end Util.Serialize.Mappers.Record_Mapper;
|
[
{
"context": "-------------------------------\n-- Copyright 2021 Lev Kujawski --\n-- ",
"end": 103,
"score": 0.9998310208320618,
"start": 91,
"tag": "NAME",
"value": "Lev Kujawski"
},
{
"context": " Ada (1987) [2] --\n-- Author: Lev Kujawski --\n-- Descr",
"end": 1759,
"score": 0.99983811378479,
"start": 1747,
"tag": "NAME",
"value": "Lev Kujawski"
}
] |
common/octearra.ads
|
lkujaw/ada-blake2
| 1 |
-----------------------------------------------------------------------
-- Copyright 2021 Lev Kujawski --
-- --
-- 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 sell --
-- copies of the Software, and to permit persons to whom the --
-- Software is furnished to do so. --
-- --
-- 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. --
-- --
-- SPDX-License-Identifier: MIT-0 --
-- --
-- File: octearra.ads (Ada Package Specification) --
-- Language: SPARK83 [1] subset of Ada (1987) [2] --
-- Author: Lev Kujawski --
-- Description: Specification of the Octet_Arrays type --
-- --
-- References: --
-- [1] SPARK Team, SPARK83 - The SPADE Ada83 Kernel, --
-- Altran Praxis, 17 Oct. 2011. --
-- [2] Programming languages - Ada, ISO/IEC 8652:1987, --
-- 15 Jun. 1987. --
-----------------------------------------------------------------------
with Octets;
--# inherit Octets;
package Octet_Arrays is
pragma Pure;
type T is array (Positive range <>) of Octets.T;
pragma Pack (T);
end Octet_Arrays;
|
7633
|
-----------------------------------------------------------------------
-- Copyright 2021 <NAME> --
-- --
-- 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 sell --
-- copies of the Software, and to permit persons to whom the --
-- Software is furnished to do so. --
-- --
-- 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. --
-- --
-- SPDX-License-Identifier: MIT-0 --
-- --
-- File: octearra.ads (Ada Package Specification) --
-- Language: SPARK83 [1] subset of Ada (1987) [2] --
-- Author: <NAME> --
-- Description: Specification of the Octet_Arrays type --
-- --
-- References: --
-- [1] SPARK Team, SPARK83 - The SPADE Ada83 Kernel, --
-- Altran Praxis, 17 Oct. 2011. --
-- [2] Programming languages - Ada, ISO/IEC 8652:1987, --
-- 15 Jun. 1987. --
-----------------------------------------------------------------------
with Octets;
--# inherit Octets;
package Octet_Arrays is
pragma Pure;
type T is array (Positive range <>) of Octets.T;
pragma Pack (T);
end Octet_Arrays;
| true |
-----------------------------------------------------------------------
-- Copyright 2021 PI:NAME:<NAME>END_PI --
-- --
-- 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 sell --
-- copies of the Software, and to permit persons to whom the --
-- Software is furnished to do so. --
-- --
-- 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. --
-- --
-- SPDX-License-Identifier: MIT-0 --
-- --
-- File: octearra.ads (Ada Package Specification) --
-- Language: SPARK83 [1] subset of Ada (1987) [2] --
-- Author: PI:NAME:<NAME>END_PI --
-- Description: Specification of the Octet_Arrays type --
-- --
-- References: --
-- [1] SPARK Team, SPARK83 - The SPADE Ada83 Kernel, --
-- Altran Praxis, 17 Oct. 2011. --
-- [2] Programming languages - Ada, ISO/IEC 8652:1987, --
-- 15 Jun. 1987. --
-----------------------------------------------------------------------
with Octets;
--# inherit Octets;
package Octet_Arrays is
pragma Pure;
type T is array (Positive range <>) of Octets.T;
pragma Pack (T);
end Octet_Arrays;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998608827590942,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999299049377441,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/nodes/program-nodes-infix_operators.adb
|
reznikmm/gela
| 0 |
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Infix_Operators is
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return Infix_Operator is
begin
return Result : Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Infix_Operator is
begin
return Result : Implicit_Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Left
(Self : Base_Infix_Operator)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Left;
end Left;
overriding function Operator
(Self : Base_Infix_Operator)
return not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access is
begin
return Self.Operator;
end Operator;
overriding function Right
(Self : Base_Infix_Operator)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Right;
end Right;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Infix_Operator'Class) is
begin
if Self.Left.Assigned then
Set_Enclosing_Element (Self.Left, Self'Unchecked_Access);
end if;
Set_Enclosing_Element (Self.Operator, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Right, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Infix_Operator
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Infix_Operator;
overriding function Is_Expression
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression;
overriding procedure Visit
(Self : not null access Base_Infix_Operator;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Infix_Operator (Self);
end Visit;
overriding function To_Infix_Operator_Text
(Self : in out Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
begin
return Self'Unchecked_Access;
end To_Infix_Operator_Text;
overriding function To_Infix_Operator_Text
(Self : in out Implicit_Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Infix_Operator_Text;
end Program.Nodes.Infix_Operators;
|
15830
|
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Infix_Operators is
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return Infix_Operator is
begin
return Result : Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Infix_Operator is
begin
return Result : Implicit_Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Left
(Self : Base_Infix_Operator)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Left;
end Left;
overriding function Operator
(Self : Base_Infix_Operator)
return not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access is
begin
return Self.Operator;
end Operator;
overriding function Right
(Self : Base_Infix_Operator)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Right;
end Right;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Infix_Operator'Class) is
begin
if Self.Left.Assigned then
Set_Enclosing_Element (Self.Left, Self'Unchecked_Access);
end if;
Set_Enclosing_Element (Self.Operator, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Right, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Infix_Operator
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Infix_Operator;
overriding function Is_Expression
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression;
overriding procedure Visit
(Self : not null access Base_Infix_Operator;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Infix_Operator (Self);
end Visit;
overriding function To_Infix_Operator_Text
(Self : in out Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
begin
return Self'Unchecked_Access;
end To_Infix_Operator_Text;
overriding function To_Infix_Operator_Text
(Self : in out Implicit_Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Infix_Operator_Text;
end Program.Nodes.Infix_Operators;
| true |
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Infix_Operators is
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return Infix_Operator is
begin
return Result : Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Infix_Operator is
begin
return Result : Implicit_Infix_Operator :=
(Left => Left, Operator => Operator, Right => Right,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Left
(Self : Base_Infix_Operator)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Left;
end Left;
overriding function Operator
(Self : Base_Infix_Operator)
return not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access is
begin
return Self.Operator;
end Operator;
overriding function Right
(Self : Base_Infix_Operator)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Right;
end Right;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Infix_Operator)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Infix_Operator'Class) is
begin
if Self.Left.Assigned then
Set_Enclosing_Element (Self.Left, Self'Unchecked_Access);
end if;
Set_Enclosing_Element (Self.Operator, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Right, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Infix_Operator
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Infix_Operator;
overriding function Is_Expression
(Self : Base_Infix_Operator)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression;
overriding procedure Visit
(Self : not null access Base_Infix_Operator;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Infix_Operator (Self);
end Visit;
overriding function To_Infix_Operator_Text
(Self : in out Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
begin
return Self'Unchecked_Access;
end To_Infix_Operator_Text;
overriding function To_Infix_Operator_Text
(Self : in out Implicit_Infix_Operator)
return Program.Elements.Infix_Operators.Infix_Operator_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Infix_Operator_Text;
end Program.Nodes.Infix_Operators;
|
[
{
"context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rig",
"end": 829,
"score": 0.9998870491981506,
"start": 816,
"tag": "NAME",
"value": "Vadim Godunko"
},
{
"context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ",
"end": 849,
"score": 0.9999327063560486,
"start": 831,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/amf/uml/amf-uml-execution_specifications.ads
|
svn2github/matreshka
| 24 |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An execution specification is a specification of the execution of a unit
-- of behavior or action within the lifeline. The duration of an execution
-- specification is represented by two cccurrence specifications, the start
-- occurrence specification and the finish occurrence specification.
------------------------------------------------------------------------------
with AMF.UML.Interaction_Fragments;
limited with AMF.UML.Occurrence_Specifications;
package AMF.UML.Execution_Specifications is
pragma Preelaborate;
type UML_Execution_Specification is limited interface
and AMF.UML.Interaction_Fragments.UML_Interaction_Fragment;
type UML_Execution_Specification_Access is
access all UML_Execution_Specification'Class;
for UML_Execution_Specification_Access'Storage_Size use 0;
not overriding function Get_Finish
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding procedure Set_Finish
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding function Get_Start
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
not overriding procedure Set_Start
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
end AMF.UML.Execution_Specifications;
|
24678
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An execution specification is a specification of the execution of a unit
-- of behavior or action within the lifeline. The duration of an execution
-- specification is represented by two cccurrence specifications, the start
-- occurrence specification and the finish occurrence specification.
------------------------------------------------------------------------------
with AMF.UML.Interaction_Fragments;
limited with AMF.UML.Occurrence_Specifications;
package AMF.UML.Execution_Specifications is
pragma Preelaborate;
type UML_Execution_Specification is limited interface
and AMF.UML.Interaction_Fragments.UML_Interaction_Fragment;
type UML_Execution_Specification_Access is
access all UML_Execution_Specification'Class;
for UML_Execution_Specification_Access'Storage_Size use 0;
not overriding function Get_Finish
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding procedure Set_Finish
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding function Get_Start
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
not overriding procedure Set_Start
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
end AMF.UML.Execution_Specifications;
| true |
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An execution specification is a specification of the execution of a unit
-- of behavior or action within the lifeline. The duration of an execution
-- specification is represented by two cccurrence specifications, the start
-- occurrence specification and the finish occurrence specification.
------------------------------------------------------------------------------
with AMF.UML.Interaction_Fragments;
limited with AMF.UML.Occurrence_Specifications;
package AMF.UML.Execution_Specifications is
pragma Preelaborate;
type UML_Execution_Specification is limited interface
and AMF.UML.Interaction_Fragments.UML_Interaction_Fragment;
type UML_Execution_Specification_Access is
access all UML_Execution_Specification'Class;
for UML_Execution_Specification_Access'Storage_Size use 0;
not overriding function Get_Finish
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding procedure Set_Finish
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::finish.
--
-- References the OccurrenceSpecification that designates the finish of
-- the Action or Behavior.
not overriding function Get_Start
(Self : not null access constant UML_Execution_Specification)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract;
-- Getter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
not overriding procedure Set_Start
(Self : not null access UML_Execution_Specification;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is abstract;
-- Setter of ExecutionSpecification::start.
--
-- References the OccurrenceSpecification that designates the start of the
-- Action or Behavior
end AMF.UML.Execution_Specifications;
|
[
{
"context": "-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi",
"end": 43,
"score": 0.9998571276664734,
"start": 33,
"tag": "NAME",
"value": "Max Reznik"
},
{
"context": "-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------",
"end": 63,
"score": 0.9999312162399292,
"start": 45,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
source/network-connections.adb
|
reznikmm/network
| 1 |
-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Network.Connections is
------------------
-- Set_Listener --
------------------
procedure Set_Listener
(Self : in out Connection'Class;
Value : Listener_Access)
is
begin
Self.Set_Input_Listener
(Network.Streams.Input_Listener_Access (Value));
Self.Set_Output_Listener
(Network.Streams.Output_Listener_Access (Value));
end Set_Listener;
end Network.Connections;
|
11697
|
-- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Network.Connections is
------------------
-- Set_Listener --
------------------
procedure Set_Listener
(Self : in out Connection'Class;
Value : Listener_Access)
is
begin
Self.Set_Input_Listener
(Network.Streams.Input_Listener_Access (Value));
Self.Set_Output_Listener
(Network.Streams.Output_Listener_Access (Value));
end Set_Listener;
end Network.Connections;
| true |
-- SPDX-FileCopyrightText: 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Network.Connections is
------------------
-- Set_Listener --
------------------
procedure Set_Listener
(Self : in out Connection'Class;
Value : Listener_Access)
is
begin
Self.Set_Input_Listener
(Network.Streams.Input_Listener_Access (Value));
Self.Set_Output_Listener
(Network.Streams.Output_Listener_Access (Value));
end Set_Listener;
end Network.Connections;
|
[
{
"context": "for unit tests\r\n-- Copyright (C) 2012, 2013, 2014 Stephane Carrez\r\n-- Written by Stephane Carrez (Stephane.Carrez@",
"end": 214,
"score": 0.999874472618103,
"start": 199,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": ") 2012, 2013, 2014 Stephane Carrez\r\n-- Written by Stephane Carrez ([email protected])\r\n--\r\n-- Licensed und",
"end": 246,
"score": 0.9998943209648132,
"start": 231,
"tag": "NAME",
"value": "Stephane Carrez"
},
{
"context": " Stephane Carrez\r\n-- Written by Stephane Carrez ([email protected])\r\n--\r\n-- Licensed under the Apache License, Vers",
"end": 273,
"score": 0.9999276399612427,
"start": 248,
"tag": "EMAIL",
"value": "[email protected]"
}
] |
testutil/util-tests-servers.adb
|
Letractively/ada-util
| 60 |
-----------------------------------------------------------------------
-- util-tests-server - A small non-compliant-inefficient HTTP server used for unit tests
-- Copyright (C) 2012, 2013, 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with GNAT.Sockets;
with Util.Log.Loggers;
package body Util.Tests.Servers is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Tests.Server");
-- ------------------------------
-- Get the server port.
-- ------------------------------
function Get_Port (From : in Server) return Natural is
begin
return From.Port;
end Get_Port;
-- ------------------------------
-- Get the server name.
-- ------------------------------
function Get_Host (From : in Server) return String is
pragma Unreferenced (From);
begin
return GNAT.Sockets.Host_Name;
end Get_Host;
-- ------------------------------
-- Start the server task.
-- ------------------------------
procedure Start (S : in out Server) is
begin
S.Server.Start (S'Unchecked_Access);
end Start;
-- ------------------------------
-- Stop the server task.
-- ------------------------------
procedure Stop (S : in out Server) is
begin
S.Need_Shutdown := True;
for I in 1 .. 10 loop
delay 0.1;
if S.Server'Terminated then
return;
end if;
end loop;
abort S.Server;
end Stop;
-- ------------------------------
-- Process the line received by the server.
-- ------------------------------
procedure Process_Line (Into : in out Server;
Line : in Ada.Strings.Unbounded.Unbounded_String;
Stream : in out Util.Streams.Texts.Reader_Stream'Class;
Client : in out Util.Streams.Sockets.Socket_Stream'Class) is
pragma Unreferenced (Into, Line, Stream);
begin
null;
end Process_Line;
task body Server_Task is
use GNAT.Sockets;
Address : Sock_Addr_Type;
Server : Socket_Type;
Socket : Socket_Type;
Instance : Server_Access := null;
Status : Selector_Status;
begin
Address.Port := 0;
Create_Socket (Server);
select
accept Start (S : in Server_Access) do
Instance := S;
Address.Addr := Addresses (Get_Host_By_Name (S.Get_Host), 1);
Bind_Socket (Server, Address);
Address := GNAT.Sockets.Get_Socket_Name (Server);
Listen_Socket (Server);
Instance.Port := Natural (Address.Port);
end Start;
or
terminate;
end select;
Log.Info ("Internal HTTP server started at port {0}", Port_Type'Image (Address.Port));
while not Instance.Need_Shutdown loop
Accept_Socket (Server, Socket, Address, 1.0, null, Status);
if Socket /= No_Socket then
Log.Info ("Accepted connection");
declare
Input : Util.Streams.Texts.Reader_Stream;
begin
Instance.Client.Open (Socket);
Input.Initialize (From => Instance.Client'Access);
while not Input.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
Instance.Process_Line (Line, Input, Instance.Client);
end;
end loop;
exception
when E : others =>
Log.Error ("Exception: ", E);
end;
Instance.Client.Close;
end if;
end loop;
GNAT.Sockets.Close_Socket (Server);
exception
when E : others =>
Log.Error ("Exception", E);
end Server_Task;
end Util.Tests.Servers;
|
5488
|
-----------------------------------------------------------------------
-- util-tests-server - A small non-compliant-inefficient HTTP server used for unit tests
-- Copyright (C) 2012, 2013, 2014 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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 GNAT.Sockets;
with Util.Log.Loggers;
package body Util.Tests.Servers is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Tests.Server");
-- ------------------------------
-- Get the server port.
-- ------------------------------
function Get_Port (From : in Server) return Natural is
begin
return From.Port;
end Get_Port;
-- ------------------------------
-- Get the server name.
-- ------------------------------
function Get_Host (From : in Server) return String is
pragma Unreferenced (From);
begin
return GNAT.Sockets.Host_Name;
end Get_Host;
-- ------------------------------
-- Start the server task.
-- ------------------------------
procedure Start (S : in out Server) is
begin
S.Server.Start (S'Unchecked_Access);
end Start;
-- ------------------------------
-- Stop the server task.
-- ------------------------------
procedure Stop (S : in out Server) is
begin
S.Need_Shutdown := True;
for I in 1 .. 10 loop
delay 0.1;
if S.Server'Terminated then
return;
end if;
end loop;
abort S.Server;
end Stop;
-- ------------------------------
-- Process the line received by the server.
-- ------------------------------
procedure Process_Line (Into : in out Server;
Line : in Ada.Strings.Unbounded.Unbounded_String;
Stream : in out Util.Streams.Texts.Reader_Stream'Class;
Client : in out Util.Streams.Sockets.Socket_Stream'Class) is
pragma Unreferenced (Into, Line, Stream);
begin
null;
end Process_Line;
task body Server_Task is
use GNAT.Sockets;
Address : Sock_Addr_Type;
Server : Socket_Type;
Socket : Socket_Type;
Instance : Server_Access := null;
Status : Selector_Status;
begin
Address.Port := 0;
Create_Socket (Server);
select
accept Start (S : in Server_Access) do
Instance := S;
Address.Addr := Addresses (Get_Host_By_Name (S.Get_Host), 1);
Bind_Socket (Server, Address);
Address := GNAT.Sockets.Get_Socket_Name (Server);
Listen_Socket (Server);
Instance.Port := Natural (Address.Port);
end Start;
or
terminate;
end select;
Log.Info ("Internal HTTP server started at port {0}", Port_Type'Image (Address.Port));
while not Instance.Need_Shutdown loop
Accept_Socket (Server, Socket, Address, 1.0, null, Status);
if Socket /= No_Socket then
Log.Info ("Accepted connection");
declare
Input : Util.Streams.Texts.Reader_Stream;
begin
Instance.Client.Open (Socket);
Input.Initialize (From => Instance.Client'Access);
while not Input.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
Instance.Process_Line (Line, Input, Instance.Client);
end;
end loop;
exception
when E : others =>
Log.Error ("Exception: ", E);
end;
Instance.Client.Close;
end if;
end loop;
GNAT.Sockets.Close_Socket (Server);
exception
when E : others =>
Log.Error ("Exception", E);
end Server_Task;
end Util.Tests.Servers;
| true |
-----------------------------------------------------------------------
-- util-tests-server - A small non-compliant-inefficient HTTP server used for unit tests
-- Copyright (C) 2012, 2013, 2014 PI:NAME:<NAME>END_PI
-- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI)
--
-- 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 GNAT.Sockets;
with Util.Log.Loggers;
package body Util.Tests.Servers is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Tests.Server");
-- ------------------------------
-- Get the server port.
-- ------------------------------
function Get_Port (From : in Server) return Natural is
begin
return From.Port;
end Get_Port;
-- ------------------------------
-- Get the server name.
-- ------------------------------
function Get_Host (From : in Server) return String is
pragma Unreferenced (From);
begin
return GNAT.Sockets.Host_Name;
end Get_Host;
-- ------------------------------
-- Start the server task.
-- ------------------------------
procedure Start (S : in out Server) is
begin
S.Server.Start (S'Unchecked_Access);
end Start;
-- ------------------------------
-- Stop the server task.
-- ------------------------------
procedure Stop (S : in out Server) is
begin
S.Need_Shutdown := True;
for I in 1 .. 10 loop
delay 0.1;
if S.Server'Terminated then
return;
end if;
end loop;
abort S.Server;
end Stop;
-- ------------------------------
-- Process the line received by the server.
-- ------------------------------
procedure Process_Line (Into : in out Server;
Line : in Ada.Strings.Unbounded.Unbounded_String;
Stream : in out Util.Streams.Texts.Reader_Stream'Class;
Client : in out Util.Streams.Sockets.Socket_Stream'Class) is
pragma Unreferenced (Into, Line, Stream);
begin
null;
end Process_Line;
task body Server_Task is
use GNAT.Sockets;
Address : Sock_Addr_Type;
Server : Socket_Type;
Socket : Socket_Type;
Instance : Server_Access := null;
Status : Selector_Status;
begin
Address.Port := 0;
Create_Socket (Server);
select
accept Start (S : in Server_Access) do
Instance := S;
Address.Addr := Addresses (Get_Host_By_Name (S.Get_Host), 1);
Bind_Socket (Server, Address);
Address := GNAT.Sockets.Get_Socket_Name (Server);
Listen_Socket (Server);
Instance.Port := Natural (Address.Port);
end Start;
or
terminate;
end select;
Log.Info ("Internal HTTP server started at port {0}", Port_Type'Image (Address.Port));
while not Instance.Need_Shutdown loop
Accept_Socket (Server, Socket, Address, 1.0, null, Status);
if Socket /= No_Socket then
Log.Info ("Accepted connection");
declare
Input : Util.Streams.Texts.Reader_Stream;
begin
Instance.Client.Open (Socket);
Input.Initialize (From => Instance.Client'Access);
while not Input.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
Instance.Process_Line (Line, Input, Instance.Client);
end;
end loop;
exception
when E : others =>
Log.Error ("Exception: ", E);
end;
Instance.Client.Close;
end if;
end loop;
GNAT.Sockets.Close_Socket (Server);
exception
when E : others =>
Log.Error ("Exception", E);
end Server_Task;
end Util.Tests.Servers;
|
[
{
"context": "-- package Copyright (c) Dmitry A. Kazakov --\r\n-- Strings_Edit.Time_Conversions ",
"end": 142,
"score": 0.9998530149459839,
"start": 125,
"tag": "NAME",
"value": "Dmitry A. Kazakov"
}
] |
strings_edit-time_conversions.adb
|
jrcarter/Ada_GUI
| 19 |
-- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Strings_Edit.Time_Conversions Luebeck --
-- Implementation Summer, 2016 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Strings_Edit.Time_Conversions is
procedure Check_Spelling (Name : String) is
begin
null;
end Check_Spelling;
function Check_Matched
( Source : String;
Pointer : Integer
) return Boolean is
begin
case Source (Pointer) is
when '0'..'9' | 'A'..'Z' | 'a'..'z' =>
return False;
when others =>
return True;
end case;
end Check_Matched;
function To_String (Date : Time) return String is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration;
function Day_Of_Week return String is
begin
case Day_Of_Week (Date) is
when Monday => return "Mon";
when Tuesday => return "Tue";
when Wednesday => return "Wed";
when Thursday => return "Thu";
when Friday => return "Fri";
when Saturday => return "Sat";
when Sunday => return "Sun";
end case;
end Day_Of_Week;
function Month_Name return String is
begin
case Month is
when 1 => return "Jan";
when 2 => return "Feb";
when 3 => return "Mar";
when 4 => return "Apr";
when 5 => return "May";
when 6 => return "Jun";
when 7 => return "Jul";
when 8 => return "Aug";
when 9 => return "Sep";
when 10 => return "Oct";
when 11 => return "Nov";
when 12 => return "Dec";
end case;
end Month_Name;
function Zone return String is
begin
declare
Offset : Time_Offset := UTC_Time_Offset (Date);
Pointer : Integer := 2;
Text : String (1..5);
begin
if Offset >= 0 then
Text (1) := '+';
else
Offset := -Offset;
Text (1) := '-';
end if;
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset / 60),
Field => 2,
Justify => Right,
Fill => '0'
);
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset rem 60),
Field => 2,
Justify => Right,
Fill => '0'
);
return Text;
end;
exception
when Unknown_Zone_Error =>
return "GMT";
end Zone;
begin
Split (Date, Year, Month, Day, Seconds);
return
( Day_Of_Week
& ", "
& Image (Integer (Day))
& ' '
& Month_Name
& ' '
& Image (Integer (Year))
& ' '
& Image (Duration (Seconds))
& ' '
& Zone
);
end To_String;
function To_Time (Date : String) return Time is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Week_Day : Day_Name;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Zone : Time_Zones.Time_Offset;
Got_It : Boolean;
Pointer : Integer := Date'First;
procedure Get_Year (Expand : Boolean) is
Value : Integer;
begin
Get (Date, Pointer, Value);
if Expand then
if Value < 50 then
Year := Year_Number (Value + 2000);
elsif Value < 100 then
Year := Year_Number (Value + 1900);
end if;
else
Year := Year_Number (Value);
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing year number"
);
end Get_Year;
procedure Get_Day is
begin
Get (Date, Pointer, Integer (Day));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing day number"
);
end Get_Day;
procedure Get_Month is
begin
Get (Date, Pointer, Months, Month, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing month name"
);
end if;
end Get_Month;
procedure Get_Time is
begin
begin
Get (Date, Pointer, Integer (Hour));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing hour number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Minute));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing minute number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Second));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing second number"
);
end;
end Get_Time;
procedure Get_Zone is
procedure Get_Offset is
begin
Zone :=
Time_Offset
( Integer'(Value (Date (Pointer - 3..Pointer - 3)))
+ Integer'(Value (Date (Pointer - 2..Pointer - 1)))
);
if Date (Pointer - 4) = '-' then
Zone := -Zone;
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end Get_Offset;
begin
Get (Date, Pointer, Zones, Zone, Got_It);
if not Got_It then
if Pointer + 4 < Date'Last then
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end if;
if Date (Pointer) = '+' or else Date (Pointer) = '-' then
Pointer := Pointer + 5;
Get_Offset;
else
Raise_Exception
( Data_Error'Identity,
"Missing sign of time zone offset"
);
end if;
end if;
end Get_Zone;
begin
Get (Date, Pointer, Week_Days, Week_Day, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing week day: " & Date (Pointer..Date'Last)
);
end if;
if Date (Pointer) = ',' then
Pointer := Pointer + 1;
end if;
Get (Date, Pointer);
Get (Date, Pointer, Months, Month, Got_It); -- Dec 31 23:59:59
if Got_It then
Get (Date, Pointer);
Get_Day;
else -- No month
Get_Day;
if Date (Pointer) = '-' then -- 31-Dec-99 23:59:59 GMT
Pointer := Pointer + 1;
Get_Month;
if Date (Pointer) = '-' then
Pointer := Pointer + 1;
else
Raise_Exception
( Data_Error'Identity,
"Hyphen is expected after the month name"
);
end if;
Get_Year (True);
else -- 31 Dec 1999 23:59:59 GMT
Get (Date, Pointer);
Get_Month;
Get (Date, Pointer);
Get_Year (False);
end if;
Get (Date, Pointer);
Get_Time;
Get (Date, Pointer);
Get_Zone;
end if;
return
Time_Of
( Year => Year,
Month => Month,
Day => Day,
Hour => Hour,
Minute => Minute,
Second => Second,
Time_Zone => Zone
);
exception
when Time_Error =>
Raise_Exception
( Data_Error'Identity,
"Illegal date specification"
);
end To_Time;
begin
Add (Week_Days, "Fri", Friday);
Add (Week_Days, "Friday", Friday);
Add (Week_Days, "Mon", Monday);
Add (Week_Days, "Monday", Monday);
Add (Week_Days, "Sat", Saturday);
Add (Week_Days, "Saturday", Saturday);
Add (Week_Days, "Sun", Sunday);
Add (Week_Days, "Sunday", Sunday);
Add (Week_Days, "Thu", Thursday);
Add (Week_Days, "Thursday", Thursday);
Add (Week_Days, "Tue", Tuesday);
Add (Week_Days, "Tuesday", Tuesday);
Add (Week_Days, "Wed", Wednesday);
Add (Week_Days, "Wednesday", Wednesday);
Add (Months, "Apr", 4);
Add (Months, "April", 4);
Add (Months, "Aug", 8);
Add (Months, "August", 8);
Add (Months, "Dec", 12);
Add (Months, "December", 12);
Add (Months, "Feb", 2);
Add (Months, "February", 2);
Add (Months, "Jan", 1);
Add (Months, "January", 1);
Add (Months, "Jul", 7);
Add (Months, "July", 7);
Add (Months, "Jun", 6);
Add (Months, "June", 6);
Add (Months, "Mar", 3);
Add (Months, "March", 3);
Add (Months, "May", 5);
Add (Months, "Nov", 11);
Add (Months, "November", 11);
Add (Months, "Oct", 10);
Add (Months, "October", 10);
Add (Months, "Sep", 9);
Add (Months, "September", 9);
Add (Zones, "UT", 0);
Add (Zones, "GMT", 0);
Add (Zones, "EDT", -4*60);
Add (Zones, "EST", -5*60);
Add (Zones, "CDT", -5*60);
Add (Zones, "CST", -6*60);
Add (Zones, "MDT", -6*60);
Add (Zones, "MST", -7*60);
Add (Zones, "PDT", -7*60);
Add (Zones, "PST", -8*60);
Add (Zones, "Z", 0);
Add (Zones, "A", -1*60);
Add (Zones, "M", -12*60);
Add (Zones, "N", 1*60);
Add (Zones, "Y", 12*60);
end Strings_Edit.Time_Conversions;
|
27792
|
-- --
-- package Copyright (c) <NAME> --
-- Strings_Edit.Time_Conversions Luebeck --
-- Implementation Summer, 2016 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Strings_Edit.Time_Conversions is
procedure Check_Spelling (Name : String) is
begin
null;
end Check_Spelling;
function Check_Matched
( Source : String;
Pointer : Integer
) return Boolean is
begin
case Source (Pointer) is
when '0'..'9' | 'A'..'Z' | 'a'..'z' =>
return False;
when others =>
return True;
end case;
end Check_Matched;
function To_String (Date : Time) return String is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration;
function Day_Of_Week return String is
begin
case Day_Of_Week (Date) is
when Monday => return "Mon";
when Tuesday => return "Tue";
when Wednesday => return "Wed";
when Thursday => return "Thu";
when Friday => return "Fri";
when Saturday => return "Sat";
when Sunday => return "Sun";
end case;
end Day_Of_Week;
function Month_Name return String is
begin
case Month is
when 1 => return "Jan";
when 2 => return "Feb";
when 3 => return "Mar";
when 4 => return "Apr";
when 5 => return "May";
when 6 => return "Jun";
when 7 => return "Jul";
when 8 => return "Aug";
when 9 => return "Sep";
when 10 => return "Oct";
when 11 => return "Nov";
when 12 => return "Dec";
end case;
end Month_Name;
function Zone return String is
begin
declare
Offset : Time_Offset := UTC_Time_Offset (Date);
Pointer : Integer := 2;
Text : String (1..5);
begin
if Offset >= 0 then
Text (1) := '+';
else
Offset := -Offset;
Text (1) := '-';
end if;
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset / 60),
Field => 2,
Justify => Right,
Fill => '0'
);
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset rem 60),
Field => 2,
Justify => Right,
Fill => '0'
);
return Text;
end;
exception
when Unknown_Zone_Error =>
return "GMT";
end Zone;
begin
Split (Date, Year, Month, Day, Seconds);
return
( Day_Of_Week
& ", "
& Image (Integer (Day))
& ' '
& Month_Name
& ' '
& Image (Integer (Year))
& ' '
& Image (Duration (Seconds))
& ' '
& Zone
);
end To_String;
function To_Time (Date : String) return Time is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Week_Day : Day_Name;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Zone : Time_Zones.Time_Offset;
Got_It : Boolean;
Pointer : Integer := Date'First;
procedure Get_Year (Expand : Boolean) is
Value : Integer;
begin
Get (Date, Pointer, Value);
if Expand then
if Value < 50 then
Year := Year_Number (Value + 2000);
elsif Value < 100 then
Year := Year_Number (Value + 1900);
end if;
else
Year := Year_Number (Value);
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing year number"
);
end Get_Year;
procedure Get_Day is
begin
Get (Date, Pointer, Integer (Day));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing day number"
);
end Get_Day;
procedure Get_Month is
begin
Get (Date, Pointer, Months, Month, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing month name"
);
end if;
end Get_Month;
procedure Get_Time is
begin
begin
Get (Date, Pointer, Integer (Hour));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing hour number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Minute));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing minute number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Second));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing second number"
);
end;
end Get_Time;
procedure Get_Zone is
procedure Get_Offset is
begin
Zone :=
Time_Offset
( Integer'(Value (Date (Pointer - 3..Pointer - 3)))
+ Integer'(Value (Date (Pointer - 2..Pointer - 1)))
);
if Date (Pointer - 4) = '-' then
Zone := -Zone;
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end Get_Offset;
begin
Get (Date, Pointer, Zones, Zone, Got_It);
if not Got_It then
if Pointer + 4 < Date'Last then
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end if;
if Date (Pointer) = '+' or else Date (Pointer) = '-' then
Pointer := Pointer + 5;
Get_Offset;
else
Raise_Exception
( Data_Error'Identity,
"Missing sign of time zone offset"
);
end if;
end if;
end Get_Zone;
begin
Get (Date, Pointer, Week_Days, Week_Day, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing week day: " & Date (Pointer..Date'Last)
);
end if;
if Date (Pointer) = ',' then
Pointer := Pointer + 1;
end if;
Get (Date, Pointer);
Get (Date, Pointer, Months, Month, Got_It); -- Dec 31 23:59:59
if Got_It then
Get (Date, Pointer);
Get_Day;
else -- No month
Get_Day;
if Date (Pointer) = '-' then -- 31-Dec-99 23:59:59 GMT
Pointer := Pointer + 1;
Get_Month;
if Date (Pointer) = '-' then
Pointer := Pointer + 1;
else
Raise_Exception
( Data_Error'Identity,
"Hyphen is expected after the month name"
);
end if;
Get_Year (True);
else -- 31 Dec 1999 23:59:59 GMT
Get (Date, Pointer);
Get_Month;
Get (Date, Pointer);
Get_Year (False);
end if;
Get (Date, Pointer);
Get_Time;
Get (Date, Pointer);
Get_Zone;
end if;
return
Time_Of
( Year => Year,
Month => Month,
Day => Day,
Hour => Hour,
Minute => Minute,
Second => Second,
Time_Zone => Zone
);
exception
when Time_Error =>
Raise_Exception
( Data_Error'Identity,
"Illegal date specification"
);
end To_Time;
begin
Add (Week_Days, "Fri", Friday);
Add (Week_Days, "Friday", Friday);
Add (Week_Days, "Mon", Monday);
Add (Week_Days, "Monday", Monday);
Add (Week_Days, "Sat", Saturday);
Add (Week_Days, "Saturday", Saturday);
Add (Week_Days, "Sun", Sunday);
Add (Week_Days, "Sunday", Sunday);
Add (Week_Days, "Thu", Thursday);
Add (Week_Days, "Thursday", Thursday);
Add (Week_Days, "Tue", Tuesday);
Add (Week_Days, "Tuesday", Tuesday);
Add (Week_Days, "Wed", Wednesday);
Add (Week_Days, "Wednesday", Wednesday);
Add (Months, "Apr", 4);
Add (Months, "April", 4);
Add (Months, "Aug", 8);
Add (Months, "August", 8);
Add (Months, "Dec", 12);
Add (Months, "December", 12);
Add (Months, "Feb", 2);
Add (Months, "February", 2);
Add (Months, "Jan", 1);
Add (Months, "January", 1);
Add (Months, "Jul", 7);
Add (Months, "July", 7);
Add (Months, "Jun", 6);
Add (Months, "June", 6);
Add (Months, "Mar", 3);
Add (Months, "March", 3);
Add (Months, "May", 5);
Add (Months, "Nov", 11);
Add (Months, "November", 11);
Add (Months, "Oct", 10);
Add (Months, "October", 10);
Add (Months, "Sep", 9);
Add (Months, "September", 9);
Add (Zones, "UT", 0);
Add (Zones, "GMT", 0);
Add (Zones, "EDT", -4*60);
Add (Zones, "EST", -5*60);
Add (Zones, "CDT", -5*60);
Add (Zones, "CST", -6*60);
Add (Zones, "MDT", -6*60);
Add (Zones, "MST", -7*60);
Add (Zones, "PDT", -7*60);
Add (Zones, "PST", -8*60);
Add (Zones, "Z", 0);
Add (Zones, "A", -1*60);
Add (Zones, "M", -12*60);
Add (Zones, "N", 1*60);
Add (Zones, "Y", 12*60);
end Strings_Edit.Time_Conversions;
| true |
-- --
-- package Copyright (c) PI:NAME:<NAME>END_PI --
-- Strings_Edit.Time_Conversions Luebeck --
-- Implementation Summer, 2016 --
-- --
-- Last revision : 13:13 14 Sep 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.IO_Exceptions; use Ada.IO_Exceptions;
with Strings_Edit.Integers; use Strings_Edit.Integers;
package body Strings_Edit.Time_Conversions is
procedure Check_Spelling (Name : String) is
begin
null;
end Check_Spelling;
function Check_Matched
( Source : String;
Pointer : Integer
) return Boolean is
begin
case Source (Pointer) is
when '0'..'9' | 'A'..'Z' | 'a'..'z' =>
return False;
when others =>
return True;
end case;
end Check_Matched;
function To_String (Date : Time) return String is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration;
function Day_Of_Week return String is
begin
case Day_Of_Week (Date) is
when Monday => return "Mon";
when Tuesday => return "Tue";
when Wednesday => return "Wed";
when Thursday => return "Thu";
when Friday => return "Fri";
when Saturday => return "Sat";
when Sunday => return "Sun";
end case;
end Day_Of_Week;
function Month_Name return String is
begin
case Month is
when 1 => return "Jan";
when 2 => return "Feb";
when 3 => return "Mar";
when 4 => return "Apr";
when 5 => return "May";
when 6 => return "Jun";
when 7 => return "Jul";
when 8 => return "Aug";
when 9 => return "Sep";
when 10 => return "Oct";
when 11 => return "Nov";
when 12 => return "Dec";
end case;
end Month_Name;
function Zone return String is
begin
declare
Offset : Time_Offset := UTC_Time_Offset (Date);
Pointer : Integer := 2;
Text : String (1..5);
begin
if Offset >= 0 then
Text (1) := '+';
else
Offset := -Offset;
Text (1) := '-';
end if;
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset / 60),
Field => 2,
Justify => Right,
Fill => '0'
);
Put
( Destination => Text,
Pointer => Pointer,
Value => Integer (Offset rem 60),
Field => 2,
Justify => Right,
Fill => '0'
);
return Text;
end;
exception
when Unknown_Zone_Error =>
return "GMT";
end Zone;
begin
Split (Date, Year, Month, Day, Seconds);
return
( Day_Of_Week
& ", "
& Image (Integer (Day))
& ' '
& Month_Name
& ' '
& Image (Integer (Year))
& ' '
& Image (Duration (Seconds))
& ' '
& Zone
);
end To_String;
function To_Time (Date : String) return Time is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Week_Day : Day_Name;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Zone : Time_Zones.Time_Offset;
Got_It : Boolean;
Pointer : Integer := Date'First;
procedure Get_Year (Expand : Boolean) is
Value : Integer;
begin
Get (Date, Pointer, Value);
if Expand then
if Value < 50 then
Year := Year_Number (Value + 2000);
elsif Value < 100 then
Year := Year_Number (Value + 1900);
end if;
else
Year := Year_Number (Value);
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing year number"
);
end Get_Year;
procedure Get_Day is
begin
Get (Date, Pointer, Integer (Day));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing day number"
);
end Get_Day;
procedure Get_Month is
begin
Get (Date, Pointer, Months, Month, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing month name"
);
end if;
end Get_Month;
procedure Get_Time is
begin
begin
Get (Date, Pointer, Integer (Hour));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing hour number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Minute));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing minute number"
);
end;
if Date (Pointer) = ':' then
Pointer := Pointer + 1;
else
Raise_Exception (Data_Error'Identity, "Colon is expected");
end if;
begin
Get (Date, Pointer, Integer (Second));
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong or missing second number"
);
end;
end Get_Time;
procedure Get_Zone is
procedure Get_Offset is
begin
Zone :=
Time_Offset
( Integer'(Value (Date (Pointer - 3..Pointer - 3)))
+ Integer'(Value (Date (Pointer - 2..Pointer - 1)))
);
if Date (Pointer - 4) = '-' then
Zone := -Zone;
end if;
exception
when others =>
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end Get_Offset;
begin
Get (Date, Pointer, Zones, Zone, Got_It);
if not Got_It then
if Pointer + 4 < Date'Last then
Raise_Exception
( Data_Error'Identity,
"Wrong time zone offset"
);
end if;
if Date (Pointer) = '+' or else Date (Pointer) = '-' then
Pointer := Pointer + 5;
Get_Offset;
else
Raise_Exception
( Data_Error'Identity,
"Missing sign of time zone offset"
);
end if;
end if;
end Get_Zone;
begin
Get (Date, Pointer, Week_Days, Week_Day, Got_It);
if not Got_It then
Raise_Exception
( Data_Error'Identity,
"Wrong or missing week day: " & Date (Pointer..Date'Last)
);
end if;
if Date (Pointer) = ',' then
Pointer := Pointer + 1;
end if;
Get (Date, Pointer);
Get (Date, Pointer, Months, Month, Got_It); -- Dec 31 23:59:59
if Got_It then
Get (Date, Pointer);
Get_Day;
else -- No month
Get_Day;
if Date (Pointer) = '-' then -- 31-Dec-99 23:59:59 GMT
Pointer := Pointer + 1;
Get_Month;
if Date (Pointer) = '-' then
Pointer := Pointer + 1;
else
Raise_Exception
( Data_Error'Identity,
"Hyphen is expected after the month name"
);
end if;
Get_Year (True);
else -- 31 Dec 1999 23:59:59 GMT
Get (Date, Pointer);
Get_Month;
Get (Date, Pointer);
Get_Year (False);
end if;
Get (Date, Pointer);
Get_Time;
Get (Date, Pointer);
Get_Zone;
end if;
return
Time_Of
( Year => Year,
Month => Month,
Day => Day,
Hour => Hour,
Minute => Minute,
Second => Second,
Time_Zone => Zone
);
exception
when Time_Error =>
Raise_Exception
( Data_Error'Identity,
"Illegal date specification"
);
end To_Time;
begin
Add (Week_Days, "Fri", Friday);
Add (Week_Days, "Friday", Friday);
Add (Week_Days, "Mon", Monday);
Add (Week_Days, "Monday", Monday);
Add (Week_Days, "Sat", Saturday);
Add (Week_Days, "Saturday", Saturday);
Add (Week_Days, "Sun", Sunday);
Add (Week_Days, "Sunday", Sunday);
Add (Week_Days, "Thu", Thursday);
Add (Week_Days, "Thursday", Thursday);
Add (Week_Days, "Tue", Tuesday);
Add (Week_Days, "Tuesday", Tuesday);
Add (Week_Days, "Wed", Wednesday);
Add (Week_Days, "Wednesday", Wednesday);
Add (Months, "Apr", 4);
Add (Months, "April", 4);
Add (Months, "Aug", 8);
Add (Months, "August", 8);
Add (Months, "Dec", 12);
Add (Months, "December", 12);
Add (Months, "Feb", 2);
Add (Months, "February", 2);
Add (Months, "Jan", 1);
Add (Months, "January", 1);
Add (Months, "Jul", 7);
Add (Months, "July", 7);
Add (Months, "Jun", 6);
Add (Months, "June", 6);
Add (Months, "Mar", 3);
Add (Months, "March", 3);
Add (Months, "May", 5);
Add (Months, "Nov", 11);
Add (Months, "November", 11);
Add (Months, "Oct", 10);
Add (Months, "October", 10);
Add (Months, "Sep", 9);
Add (Months, "September", 9);
Add (Zones, "UT", 0);
Add (Zones, "GMT", 0);
Add (Zones, "EDT", -4*60);
Add (Zones, "EST", -5*60);
Add (Zones, "CDT", -5*60);
Add (Zones, "CST", -6*60);
Add (Zones, "MDT", -6*60);
Add (Zones, "MST", -7*60);
Add (Zones, "PDT", -7*60);
Add (Zones, "PST", -8*60);
Add (Zones, "Z", 0);
Add (Zones, "A", -1*60);
Add (Zones, "M", -12*60);
Add (Zones, "N", 1*60);
Add (Zones, "Y", 12*60);
end Strings_Edit.Time_Conversions;
|
[
{
"context": "---------------------\n-- G E L A A S I S --\n-- ",
"end": 113,
"score": 0.668555498123169,
"start": 108,
"tag": "NAME",
"value": "G E L"
},
{
"context": "--------------------------\n-- Copyright (c) 2006, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an",
"end": 6715,
"score": 0.9998218417167664,
"start": 6703,
"tag": "NAME",
"value": "Maxim Reznik"
}
] |
tools/xml2ayacc/gramar_items.ads
|
faelys/gela-asis
| 4 |
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Strings.Unbounded;
package Gramar_Items is
-------------
-- Wrapper --
-------------
type Wrapper is private;
function Node_Name (Object : Wrapper) return String;
function Parent (Object : Wrapper) return Wrapper;
function Item_Index (Object : Wrapper) return Natural;
function Object_Name (Object : Wrapper) return String;
function User_Attr_Name (Object : Wrapper) return String;
function Top (Object : Wrapper) return Boolean;
function Position (Object : Wrapper) return String;
function Wrapper_Index (Object : Wrapper) return Natural;
----------
-- Item --
----------
type Item is abstract tagged limited private;
type Item_Ptr is access all Item'Class;
function Item_Name (Object : Item) return String is abstract;
function Node_Name (Object : Item) return String;
function User_Attr (Object : Item) return String;
function Choise (Object : Item) return String;
function Parent (Object : Item) return Wrapper;
function Create_Node (Object : Item) return String;
function Trait_Name (Object : Item) return String;
function Value (Object : Item) return String;
--------------
-- Sequence --
--------------
type Sequence is private;
function Count (Item : Sequence) return Natural;
function Get_Item
(Object : Sequence;
Index : Positive)
return Item_Ptr;
function Pass_Through (Item : Sequence) return Boolean;
function Node_Name (Item : Sequence) return String;
function Infix (Item : Sequence) return String;
function True_Node (Item : Sequence) return String;
function False_Node (Item : Sequence) return String;
function Find_First_Reference (Item : Sequence) return Natural;
function Find_First_List (Item : Sequence) return Natural;
function Choise_Item_Index (Item : Sequence) return Natural;
function Rule_Name (Seq : Sequence) return String;
function Is_Item_And_List (Seq : Sequence) return Boolean;
function Item_Of_List_Index (Seq : Sequence) return Natural;
function List_For_Item_Index (Seq : Sequence) return Natural;
function Wrap_Count (Item : Sequence) return Natural;
function Get_Wrapper
(Seq : Sequence;
Index : Positive) return Wrapper;
----------
-- Rule --
----------
type Rule is private;
function Name (Item : Rule) return String;
function Count (Item : Rule) return Natural;
function Get_Alternative
(Item : Rule;
Index : Positive)
return Sequence;
function Node_Name (Item : Rule) return String;
---------------
-- Reference --
---------------
type Reference is new Item with private;
function Name (Item : Reference) return String;
function Is_Token (Item : Reference) return Boolean;
function Item_Name (Object : Reference) return String;
function Node_Name (Object : Reference) return String;
----------
-- Body --
----------
type Option is new Item with private;
function Items
(Item : Option;
Index : Positive := 1) return Sequence;
function Count (Item : Option) return Natural;
function Separate_Option (Item : Option) return Boolean;
function Inline_Option (Item : Option) return Boolean;
function Item_Name (Object : Option) return String;
function Node_Name (Object : Option) return String;
function Alternative_Node_Name (Item : Option) return String;
----------
-- List --
----------
type List is new Item with private;
function Items (Item : List) return Sequence;
function Item_Name (Object : List) return String;
function Node_Name (Object : List) return String;
function List_Item_Node_Name (Object : List) return String;
-------------
-- Keyword --
-------------
type Keyword is new Item with private;
function Item_Name (Object : Keyword) return String;
function Text (Item : Keyword) return String;
---------------
-- Delimiter --
---------------
type Delimiter is new Item with private;
function Item_Name (Object : Delimiter) return String;
function Text (Item : Delimiter) return String;
procedure Read_File (Name : String);
function Rule_Count return Natural;
function Get_Rule (Index : Positive) return Rule;
function Get_Rule (Name : String) return Rule;
Not_Found : exception;
function To_String (X : Natural) return String;
private
use Ada.Strings.Unbounded;
type Rule_Node;
type Rule is access all Rule_Node'Class;
type Sequence_Node;
type Sequence is access all Sequence_Node'Class;
type Item is abstract tagged limited record
Next : Item_Ptr;
Parent : Sequence;
Instance : Positive := 1;
end record;
procedure Set_Sequence
(Object : in out Item;
Child : in Sequence);
type Reference is new Item with record
Name : Unbounded_String;
Is_Token : Boolean := False;
end record;
type Option_Node;
type Option_Node_Ptr is access all Option_Node;
type Option is new Item with record
Node : Option_Node_Ptr;
end record;
procedure Set_Sequence
(Object : in out Option;
Child : in Sequence);
type List is new Item with record
Items : Sequence;
end record;
procedure Set_Sequence
(Object : in out List;
Child : in Sequence);
type Keyword is new Item with record
Text : Unbounded_String;
end record;
type Delimiter is new Item with record
Text : Unbounded_String;
end record;
type Wrapper is record
Node_Name : Unbounded_String;
Attr_Name : Unbounded_String;
Object_Name : Unbounded_String;
Position : Unbounded_String;
Parent : Natural;
Item_Index : Natural;
Seq : Sequence;
Index : Natural;
end record;
end Gramar_Items;
------------------------------------------------------------------------------
-- Copyright (c) 2006, 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.
------------------------------------------------------------------------------
|
20518
|
------------------------------------------------------------------------------
-- <NAME> A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Strings.Unbounded;
package Gramar_Items is
-------------
-- Wrapper --
-------------
type Wrapper is private;
function Node_Name (Object : Wrapper) return String;
function Parent (Object : Wrapper) return Wrapper;
function Item_Index (Object : Wrapper) return Natural;
function Object_Name (Object : Wrapper) return String;
function User_Attr_Name (Object : Wrapper) return String;
function Top (Object : Wrapper) return Boolean;
function Position (Object : Wrapper) return String;
function Wrapper_Index (Object : Wrapper) return Natural;
----------
-- Item --
----------
type Item is abstract tagged limited private;
type Item_Ptr is access all Item'Class;
function Item_Name (Object : Item) return String is abstract;
function Node_Name (Object : Item) return String;
function User_Attr (Object : Item) return String;
function Choise (Object : Item) return String;
function Parent (Object : Item) return Wrapper;
function Create_Node (Object : Item) return String;
function Trait_Name (Object : Item) return String;
function Value (Object : Item) return String;
--------------
-- Sequence --
--------------
type Sequence is private;
function Count (Item : Sequence) return Natural;
function Get_Item
(Object : Sequence;
Index : Positive)
return Item_Ptr;
function Pass_Through (Item : Sequence) return Boolean;
function Node_Name (Item : Sequence) return String;
function Infix (Item : Sequence) return String;
function True_Node (Item : Sequence) return String;
function False_Node (Item : Sequence) return String;
function Find_First_Reference (Item : Sequence) return Natural;
function Find_First_List (Item : Sequence) return Natural;
function Choise_Item_Index (Item : Sequence) return Natural;
function Rule_Name (Seq : Sequence) return String;
function Is_Item_And_List (Seq : Sequence) return Boolean;
function Item_Of_List_Index (Seq : Sequence) return Natural;
function List_For_Item_Index (Seq : Sequence) return Natural;
function Wrap_Count (Item : Sequence) return Natural;
function Get_Wrapper
(Seq : Sequence;
Index : Positive) return Wrapper;
----------
-- Rule --
----------
type Rule is private;
function Name (Item : Rule) return String;
function Count (Item : Rule) return Natural;
function Get_Alternative
(Item : Rule;
Index : Positive)
return Sequence;
function Node_Name (Item : Rule) return String;
---------------
-- Reference --
---------------
type Reference is new Item with private;
function Name (Item : Reference) return String;
function Is_Token (Item : Reference) return Boolean;
function Item_Name (Object : Reference) return String;
function Node_Name (Object : Reference) return String;
----------
-- Body --
----------
type Option is new Item with private;
function Items
(Item : Option;
Index : Positive := 1) return Sequence;
function Count (Item : Option) return Natural;
function Separate_Option (Item : Option) return Boolean;
function Inline_Option (Item : Option) return Boolean;
function Item_Name (Object : Option) return String;
function Node_Name (Object : Option) return String;
function Alternative_Node_Name (Item : Option) return String;
----------
-- List --
----------
type List is new Item with private;
function Items (Item : List) return Sequence;
function Item_Name (Object : List) return String;
function Node_Name (Object : List) return String;
function List_Item_Node_Name (Object : List) return String;
-------------
-- Keyword --
-------------
type Keyword is new Item with private;
function Item_Name (Object : Keyword) return String;
function Text (Item : Keyword) return String;
---------------
-- Delimiter --
---------------
type Delimiter is new Item with private;
function Item_Name (Object : Delimiter) return String;
function Text (Item : Delimiter) return String;
procedure Read_File (Name : String);
function Rule_Count return Natural;
function Get_Rule (Index : Positive) return Rule;
function Get_Rule (Name : String) return Rule;
Not_Found : exception;
function To_String (X : Natural) return String;
private
use Ada.Strings.Unbounded;
type Rule_Node;
type Rule is access all Rule_Node'Class;
type Sequence_Node;
type Sequence is access all Sequence_Node'Class;
type Item is abstract tagged limited record
Next : Item_Ptr;
Parent : Sequence;
Instance : Positive := 1;
end record;
procedure Set_Sequence
(Object : in out Item;
Child : in Sequence);
type Reference is new Item with record
Name : Unbounded_String;
Is_Token : Boolean := False;
end record;
type Option_Node;
type Option_Node_Ptr is access all Option_Node;
type Option is new Item with record
Node : Option_Node_Ptr;
end record;
procedure Set_Sequence
(Object : in out Option;
Child : in Sequence);
type List is new Item with record
Items : Sequence;
end record;
procedure Set_Sequence
(Object : in out List;
Child : in Sequence);
type Keyword is new Item with record
Text : Unbounded_String;
end record;
type Delimiter is new Item with record
Text : Unbounded_String;
end record;
type Wrapper is record
Node_Name : Unbounded_String;
Attr_Name : Unbounded_String;
Object_Name : Unbounded_String;
Position : Unbounded_String;
Parent : Natural;
Item_Index : Natural;
Seq : Sequence;
Index : Natural;
end record;
end Gramar_Items;
------------------------------------------------------------------------------
-- Copyright (c) 2006, <NAME>
-- 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.
------------------------------------------------------------------------------
| true |
------------------------------------------------------------------------------
-- PI:NAME:<NAME>END_PI A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Strings.Unbounded;
package Gramar_Items is
-------------
-- Wrapper --
-------------
type Wrapper is private;
function Node_Name (Object : Wrapper) return String;
function Parent (Object : Wrapper) return Wrapper;
function Item_Index (Object : Wrapper) return Natural;
function Object_Name (Object : Wrapper) return String;
function User_Attr_Name (Object : Wrapper) return String;
function Top (Object : Wrapper) return Boolean;
function Position (Object : Wrapper) return String;
function Wrapper_Index (Object : Wrapper) return Natural;
----------
-- Item --
----------
type Item is abstract tagged limited private;
type Item_Ptr is access all Item'Class;
function Item_Name (Object : Item) return String is abstract;
function Node_Name (Object : Item) return String;
function User_Attr (Object : Item) return String;
function Choise (Object : Item) return String;
function Parent (Object : Item) return Wrapper;
function Create_Node (Object : Item) return String;
function Trait_Name (Object : Item) return String;
function Value (Object : Item) return String;
--------------
-- Sequence --
--------------
type Sequence is private;
function Count (Item : Sequence) return Natural;
function Get_Item
(Object : Sequence;
Index : Positive)
return Item_Ptr;
function Pass_Through (Item : Sequence) return Boolean;
function Node_Name (Item : Sequence) return String;
function Infix (Item : Sequence) return String;
function True_Node (Item : Sequence) return String;
function False_Node (Item : Sequence) return String;
function Find_First_Reference (Item : Sequence) return Natural;
function Find_First_List (Item : Sequence) return Natural;
function Choise_Item_Index (Item : Sequence) return Natural;
function Rule_Name (Seq : Sequence) return String;
function Is_Item_And_List (Seq : Sequence) return Boolean;
function Item_Of_List_Index (Seq : Sequence) return Natural;
function List_For_Item_Index (Seq : Sequence) return Natural;
function Wrap_Count (Item : Sequence) return Natural;
function Get_Wrapper
(Seq : Sequence;
Index : Positive) return Wrapper;
----------
-- Rule --
----------
type Rule is private;
function Name (Item : Rule) return String;
function Count (Item : Rule) return Natural;
function Get_Alternative
(Item : Rule;
Index : Positive)
return Sequence;
function Node_Name (Item : Rule) return String;
---------------
-- Reference --
---------------
type Reference is new Item with private;
function Name (Item : Reference) return String;
function Is_Token (Item : Reference) return Boolean;
function Item_Name (Object : Reference) return String;
function Node_Name (Object : Reference) return String;
----------
-- Body --
----------
type Option is new Item with private;
function Items
(Item : Option;
Index : Positive := 1) return Sequence;
function Count (Item : Option) return Natural;
function Separate_Option (Item : Option) return Boolean;
function Inline_Option (Item : Option) return Boolean;
function Item_Name (Object : Option) return String;
function Node_Name (Object : Option) return String;
function Alternative_Node_Name (Item : Option) return String;
----------
-- List --
----------
type List is new Item with private;
function Items (Item : List) return Sequence;
function Item_Name (Object : List) return String;
function Node_Name (Object : List) return String;
function List_Item_Node_Name (Object : List) return String;
-------------
-- Keyword --
-------------
type Keyword is new Item with private;
function Item_Name (Object : Keyword) return String;
function Text (Item : Keyword) return String;
---------------
-- Delimiter --
---------------
type Delimiter is new Item with private;
function Item_Name (Object : Delimiter) return String;
function Text (Item : Delimiter) return String;
procedure Read_File (Name : String);
function Rule_Count return Natural;
function Get_Rule (Index : Positive) return Rule;
function Get_Rule (Name : String) return Rule;
Not_Found : exception;
function To_String (X : Natural) return String;
private
use Ada.Strings.Unbounded;
type Rule_Node;
type Rule is access all Rule_Node'Class;
type Sequence_Node;
type Sequence is access all Sequence_Node'Class;
type Item is abstract tagged limited record
Next : Item_Ptr;
Parent : Sequence;
Instance : Positive := 1;
end record;
procedure Set_Sequence
(Object : in out Item;
Child : in Sequence);
type Reference is new Item with record
Name : Unbounded_String;
Is_Token : Boolean := False;
end record;
type Option_Node;
type Option_Node_Ptr is access all Option_Node;
type Option is new Item with record
Node : Option_Node_Ptr;
end record;
procedure Set_Sequence
(Object : in out Option;
Child : in Sequence);
type List is new Item with record
Items : Sequence;
end record;
procedure Set_Sequence
(Object : in out List;
Child : in Sequence);
type Keyword is new Item with record
Text : Unbounded_String;
end record;
type Delimiter is new Item with record
Text : Unbounded_String;
end record;
type Wrapper is record
Node_Name : Unbounded_String;
Attr_Name : Unbounded_String;
Object_Name : Unbounded_String;
Position : Unbounded_String;
Parent : Natural;
Item_Index : Natural;
Seq : Sequence;
Index : Natural;
end record;
end Gramar_Items;
------------------------------------------------------------------------------
-- Copyright (c) 2006, PI:NAME:<NAME>END_PI
-- 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.
------------------------------------------------------------------------------
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.