CombinedText
stringlengths
4
3.42M
with impact.d3.Shape.convex.internal.sphere; with Interfaces.C; with impact.d3.Transform; with impact.d3.Quaternions; with impact.d3.Matrix; with Interfaces; with impact.d3.Vector; with impact.d3.collision.gjk_epa; with impact.d3.Scalar; -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.internal.h" -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.internal.sphere.h" package body impact.d3.collision.gjk_epa is package gjkepa2_impl is ----------- --- Config -- --- GJK -- GJK_MAX_ITERATIONS : constant := 128; GJK_ACCURARY : constant := 0.0001; GJK_MIN_DISTANCE : constant := 0.0001; GJK_DUPLICATED_EPS : constant := 0.0001; GJK_SIMPLEX2_EPS : constant := 0.0; GJK_SIMPLEX3_EPS : constant := 0.0; GJK_SIMPLEX4_EPS : constant := 0.0; --- EPA -- EPA_MAX_VERTICES : constant := 64; EPA_MAX_FACES : constant := EPA_MAX_VERTICES * 2; EPA_MAX_ITERATIONS : constant := 255; EPA_ACCURACY : constant := 0.0001; EPA_FALLBACK : constant := 10 * EPA_ACCURACY; EPA_PLANE_EPS : constant := 0.00001; EPA_INSIDE_EPS : constant := 0.01; --- Shorthands -- subtype U is interfaces.Unsigned_64; subtype U1 is interfaces.c.unsigned_char; type u1_array is array (Positive range <>) of U1; --- MinkowskiDiff -- type convex_shape_Pair is array (1 .. 2) of impact.d3.Shape.convex.view; type Ls_function is access function (Self : impact.d3.Shape.convex.item'Class; vec : in math.Vector_3) return math.Vector_3; type MinkowskiDiff is tagged record m_shapes : convex_shape_Pair; m_toshape1 : math.Matrix_3x3; m_toshape0 : Transform_3d; Ls : Ls_function; -- impact.d3.Vector (impact.d3.Shape.convex::*Ls)(const impact.d3.Vector&) const; end record; procedure EnableMargin (Self : in out MinkowskiDiff; enable : in Boolean); function Support0 (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3; function Support1 (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3; function Support (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3; function Support (Self : in MinkowskiDiff; d : in math.Vector_3; index : in U ) return math.Vector_3; subtype tShape is MinkowskiDiff; --- GJK -- type sSV is record d, w : aliased math.Vector_3; end record; type sSV_array is array (Positive range <>) of aliased sSV; type sSV_view is access all sSV; type sSV_views is array (Positive range <>) of sSV_view; type sSimplex is record c : sSV_array (1 .. 4); p : math.Vector_4; rank : U; end record; type sSimplex_array is array (Positive range <>) of aliased sSimplex; type eStatus is (Valid, Inside, Failed); type GJK is tagged record m_shape : tShape; m_ray : math.Vector_3; m_distance : math.Real; m_simplices : sSimplex_array (1 .. 2); m_store : sSV_array (1 .. 4); m_free : sSV_views (1 .. 4); m_nfree : U; m_current : U; m_simplex : access sSimplex; m_status : eStatus; end record; function to_GJK return GJK; procedure Initialize (Self : in out GJK); function EncloseOrigin (Self : access GJK) return Boolean; function Evaluate (Self : access GJK; shapearg : in tShape'Class; guess : in math.Vector_3) return eStatus; procedure appendvertice (Self : in out GJK; simplex : access sSimplex; v : in math.Vector_3); procedure removevertice (Self : in out GJK; simplex : access sSimplex); -------- --- EPA -- -- Types -- type sFace; type sFace_view is access all sFace; type sFace_views is array (Positive range <>) of sFace_view; type sFace is record n : math.Vector_3; d, p : math.Real; c : sSV_views (1 .. 3); f : sFace_views (1 .. 3); l : sFace_views (1 .. 2); e : U1_array (1 .. 3); pass : U1; end record; type sFace_array is array (Positive range <>) of aliased sFace; type sList is record root : sFace_view; count : U := 0; end record; type sHorizon is record cf, ff : sFace_view; nf : U := 0; end record; type eStatus_EPA is (Valid, Touching, Degenerated, NonConvex, InvalidHull, OutOfFaces, OutOfVertices, AccuraryReached, FallBack, Failed); pragma Unreferenced (Touching); type EPA is tagged record m_status : eStatus_EPA; m_result : sSimplex; m_normal : math.Vector_3; m_depth : math.Real; m_sv_store : sSV_array (1 .. EPA_MAX_VERTICES); m_fc_store : sFace_array (1 .. EPA_MAX_FACES); m_nextsv : U; m_hull : sList; m_stock : sList; end record; function to_EPA return EPA; procedure Initialize (Self : access EPA); function Evaluate (Self : in out EPA; gjk : in out gjkepa2_impl.GJK'Class; guess : in math.Vector_3) return eStatus_EPA; function newface (Self : access EPA; a, b, c : in sSV_view; forced : in Boolean) return sFace_view; function findbest (Self : access EPA) return sFace_view; function expand (Self : access EPA; pass : in U; w : in sSV_view; f : in sFace_view; e : in U; horizon : access sHorizon) return Boolean; --- Utility -- procedure Initialize (shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; shape1 : in impact.d3.Shape.convex.view; wtrs1 : in Transform_3d; results : out impact.d3.collision.gjk_epa.btGjkEpaSolver2.sResults; shape : in out tShape; withmargins : in Boolean); end gjkepa2_impl; package body gjkepa2_impl is ------------------ --- MinkowskiDiff -- procedure EnableMargin (Self : in out MinkowskiDiff; enable : in Boolean) is begin if enable then Self.Ls := impact.d3.Shape.convex.localGetSupportVertexNonVirtual'Access; else Self.Ls := impact.d3.Shape.convex.localGetSupportVertexWithoutMarginNonVirtual'Access; end if; end EnableMargin; function Support0 (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3 is begin return Self.Ls (Self.m_shapes (1).all, d); end Support0; function Support1 (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3 is use linear_Algebra_3d, impact.d3.Transform, math.Vectors; begin return Self.m_toshape0 * Self.Ls (Self.m_shapes (2).all, Self.m_toshape1 * d); end Support1; function Support (Self : in MinkowskiDiff; d : in math.Vector_3) return math.Vector_3 is begin return Self.Support0 (d) - Self.Support1 (-d); end Support; function Support (Self : in MinkowskiDiff; d : in math.Vector_3; index : in U ) return math.Vector_3 is use type Interfaces.Unsigned_64; begin if index /= 0 then -- tbd: '0' or '1' ? return Self.Support1 (d); else return Self.Support0 (d); end if; end Support; -------- --- GJK -- function projectorigin (a, b : access math.Vector_3; w : access math.Vector; m : access U) return math.Real; function projectorigin (a, b, c : access math.Vector_3; w : access math.Vector; m : access U) return math.Real; function projectorigin (a, b, c, d : access math.Vector_3; w : access math.Vector; m : access U) return math.Real; -- Internals -- procedure getsupport (Self : in GJK'Class; d : in math.Vector_3; sv : out sSV) is use impact.d3.Vector, math.Vectors; begin sv.d := d / length (d); sv.w := Self.m_shape.Support (sv.d); end getsupport; function det (a, b, c : in math.Vector_3) return math.Real is begin return a (2) * b (3) * c (1) + a (3) * b (1) * c (2) - a (1) * b (3) * c (2) - a (2) * b (1) * c (3) + a (1) * b (2) * c (3) - a (3) * b (2) * c (1); end det; procedure Initialize (Self : in out GJK) is begin Self.m_ray := (0.0, 0.0, 0.0); Self.m_nfree := 1; -- or 0 ? Self.m_status := Failed; Self.m_current := 1; -- or 0 ? Self.m_distance := 0.0; end Initialize; function to_GJK return GJK is Self : GJK; begin Self.Initialize; return Self; end to_GJK; function Evaluate (Self : access GJK; shapearg : in tShape'Class; guess : in math.Vector_3) return eStatus is use impact.d3.Vector; use type U; iterations : U := 0; sqdist : math.Real := 0.0; alpha : math.Real := 0.0; lastw : Vector_3_array (1 .. 4); clastw : U := 0; sqrl : math.Real; begin -- Initialize solver -- Self.m_free (1) := Self.m_store (1)'Unchecked_Access; Self.m_free (2) := Self.m_store (2)'Unchecked_Access; Self.m_free (3) := Self.m_store (3)'Unchecked_Access; Self.m_free (4) := Self.m_store (4)'Unchecked_Access; Self.m_nfree := 5; -- or 4 ? Self.m_current := 1; -- or 0 ? Self.m_status := Valid; Self.m_shape := tShape (shapearg); Self.m_distance := 0.0; -- Initialize simplex -- Self.m_simplices (1).rank := 1; -- or 0 ? Self.m_ray := guess; sqrl := length2 (Self.m_ray); Self.appendvertice (Self.m_simplices (1)'Access, (if sqrl > 0.0 then -Self.m_ray else (1.0, 0.0, 0.0))); Self.m_simplices (1).p (1) := 1.0; Self.m_ray := Self.m_simplices (1).c (1).w; sqdist := sqrl; lastw (1) := Self.m_ray; lastw (2) := Self.m_ray; lastw (3) := Self.m_ray; lastw (4) := Self.m_ray; -- Loop loop declare next : constant U := 3 - Self.m_current; -- or 1 - m_current ? cs : access sSimplex := Self.m_simplices (Integer (Self.m_current))'Access; -- or m_current+1 ? ns : constant access sSimplex := Self.m_simplices (Integer (next ))'Access; -- or next+1 ? -- Check zero rl : constant math.Real := length (Self.m_ray); w : math.Vector_3; found : Boolean; omega : math.Real; -- weights : aliased math.Vector_4; weights : aliased math.Vector := (1 .. 4 => <>); mask : aliased U; begin if rl < GJK_MIN_DISTANCE then -- Touching or inside Self.m_status := Inside; exit; end if; -- Append new vertice in -'v' direction -- Self.appendvertice (cs, -Self.m_ray); w := cs.c (Integer (cs.rank - 1)).w; -- or -0 ? found := False; for i in U'(1) .. 4 loop if length2 (w - lastw (Integer (i))) < GJK_DUPLICATED_EPS then found := True; exit; end if; end loop; if found then -- Return old simplex Self.removevertice (Self.m_simplices (Integer (Self.m_current))'Access); -- or m_current+1 ? exit; else -- Update lastw clastw := (clastw + 1) and 3; lastw (Integer (clastw) + 1) := w; end if; -- Check for termination -- omega := dot (Self.m_ray, w) / rl; alpha := math.Real'Max (omega, alpha); if ((rl - alpha) - (GJK_ACCURARY * rl)) <= 0.0 then -- Return old simplex Self.removevertice (Self.m_simplices (Integer (Self.m_current))'Access); exit; end if; -- Reduce simplex -- mask := 0; case cs.rank is when 3 => sqdist := projectorigin (cs.c (1).w'Access, cs.c (2).w'Access, weights'Access, mask'Access); when 4 => sqdist := projectorigin (cs.c (1).w'Access, cs.c (2).w'Access, cs.c (3).w'Access, weights'Access, mask'Access); when 5 => sqdist := projectorigin (cs.c (1).w'Access, cs.c (2).w'Access, cs.c (3).w'Access, cs.c (4).w'Access, weights'Access, mask'Access); when others => null; end case; if sqdist >= 0.0 then -- Valid ns.rank := 1; Self.m_ray := (0.0, 0.0, 0.0); Self.m_current := next; for i in 1 .. Integer (cs.rank - 1) loop if (mask and (2**(i - 1))) /= 0 then ns.c (Integer (ns.rank)) := cs.c (i); ns.p (Integer (ns.rank)) := weights (i); ns.rank := ns.rank + 1; Self.m_ray := Self.m_ray + cs.c (i).w * weights (i); else Self.m_free (Integer (Self.m_nfree)) := cs.c (i)'Access; Self.m_nfree := Self.m_nfree + 1; end if; end loop; if mask = 15 then Self.m_status := Inside; end if; else -- Return old simplex Self.removevertice (Self.m_simplices (Integer (Self.m_current))'Access); exit; end if; iterations := iterations + 1; Self.m_status := (if iterations <= GJK_MAX_ITERATIONS then Self.m_status else Failed); exit when Self.m_status /= Valid; end; end loop; Self.m_simplex := Self.m_simplices (Integer (Self.m_current))'Unchecked_Access; case Self.m_status is when Valid => Self.m_distance := length (Self.m_ray); when Inside => Self.m_distance := 0.0; when others => null; end case; return Self.m_status; end Evaluate; -- /* Loop */ -- do { -- const U next=1-m_current; -- sSimplex& cs=m_simplices[m_current]; -- sSimplex& ns=m_simplices[next]; -- /* Check zero */ -- const btScalar rl=m_ray.length(); -- if(rl<GJK_MIN_DISTANCE) -- {/* Touching or inside */ -- m_status=eStatus::Inside; -- break; -- } -- /* Append new vertice in -'v' direction */ -- appendvertice(cs,-m_ray); -- const btVector3& w=cs.c[cs.rank-1]->w; -- bool found=false; -- for(U i=0;i<4;++i) -- { -- if((w-lastw[i]).length2()<GJK_DUPLICATED_EPS) -- { found=true;break; } -- } -- if(found) -- {/* Return old simplex */ -- removevertice(m_simplices[m_current]); -- break; -- } -- else -- {/* Update lastw */ -- lastw[clastw=(clastw+1)&3]=w; -- } -- /* Check for termination */ -- const btScalar omega=btDot(m_ray,w)/rl; -- alpha=btMax(omega,alpha); -- if(((rl-alpha)-(GJK_ACCURARY*rl))<=0) -- {/* Return old simplex */ -- removevertice(m_simplices[m_current]); -- break; -- } -- /* Reduce simplex */ -- btScalar weights[4]; -- U mask=0; -- switch(cs.rank) -- { -- case 2: sqdist=projectorigin( cs.c[0]->w, -- cs.c[1]->w, -- weights,mask);break; -- case 3: sqdist=projectorigin( cs.c[0]->w, -- cs.c[1]->w, -- cs.c[2]->w, -- weights,mask);break; -- case 4: sqdist=projectorigin( cs.c[0]->w, -- cs.c[1]->w, -- cs.c[2]->w, -- cs.c[3]->w, -- weights,mask);break; -- } -- if(sqdist>=0) -- {/* Valid */ -- ns.rank = 0; -- m_ray = btVector3(0,0,0); -- m_current = next; -- for(U i=0,ni=cs.rank;i<ni;++i) -- { -- if(mask&(1<<i)) -- { -- ns.c[ns.rank] = cs.c[i]; -- ns.p[ns.rank++] = weights[i]; -- m_ray += cs.c[i]->w*weights[i]; -- } -- else -- { -- m_free[m_nfree++] = cs.c[i]; -- } -- } -- if(mask==15) m_status=eStatus::Inside; -- } -- else -- {/* Return old simplex */ -- removevertice(m_simplices[m_current]); -- break; -- } -- m_status=((++iterations)<GJK_MAX_ITERATIONS)?m_status:eStatus::Failed; -- } while(m_status==eStatus::Valid); -- m_simplex=&m_simplices[m_current]; -- switch(m_status) -- { -- case eStatus::Valid: m_distance=m_ray.length();break; -- case eStatus::Inside: m_distance=0;break; -- default: -- { -- } -- } -- return(m_status); ------ TBD: Check this whole file against C equiv. procedure appendvertice (Self : in out GJK; simplex : access sSimplex; v : in math.Vector_3) is use type interfaces.Unsigned_64; begin simplex.p (Integer (simplex.rank)) := 0.0; Self.m_nfree := Self.m_nfree - 1; simplex.c (Integer (simplex.rank)) := Self.m_free (Integer (Self.m_nfree)).all; getsupport (Self, v, simplex.c (Integer (simplex.rank))); simplex.rank := simplex.rank + 1; end appendvertice; -- void appendvertice(sSimplex& simplex,const btVector3& v) -- { -- simplex.p[simplex.rank]=0; -- simplex.c[simplex.rank]=m_free[--m_nfree]; -- getsupport(v,*simplex.c[simplex.rank++]); -- } procedure removevertice (Self : in out GJK; simplex : access sSimplex) is use type U; begin simplex.rank := simplex.rank - 1; Self.m_free (Integer (Self.m_nfree)) := simplex.c (Integer (simplex.rank))'Access; Self.m_nfree := Self.m_nfree + 1; end removevertice; -- void removevertice(sSimplex& simplex) -- { -- m_free[m_nfree++] = simplex.c[--simplex.rank]; -- } function projectorigin (a, b : access math.Vector_3; w : access math.Vector; m : access U) return math.Real is use impact.d3.Vector; d : constant math.Vector_3 := b.all - a.all; l : constant math.Real := length2 (d); t : math.Real; begin if l > GJK_SIMPLEX2_EPS then t := (if l > 0.0 then -dot (a.all, d) / l else 0.0); if t >= 1.0 then w (1) := 0.0; w (2) := 1.0; m.all := 2; return length2 (b.all); elsif t <= 0.0 then w (1) := 1.0; w (2) := 0.0; m.all := 1; return length2 (a.all); else w (2) := t; w (1) := 1.0 - w (2); m.all := 3; return length2 (a.all + d*t); end if; end if; return -1.0; end projectorigin; function projectorigin (a, b, c : access math.Vector_3; w : access math.Vector; m : access U) return math.Real is use impact.d3.Vector, math.Vectors; use type U; imd3 : constant array (1 .. 3) of U := (1, 2, 0); vt : constant array (1 .. 3) of access math.Vector_3 := (a, b, c); dl : constant array (1 .. 3) of math.Vector_3 := (a.all - b.all, b.all - c.all, c.all - a.all); n : constant math.Vector_3 := cross (dl (1), dl (2)); l : constant math.Real := length2 (n); begin if l > GJK_SIMPLEX3_EPS then declare mindist : math.Real := -1.0; subw : aliased math.Vector := (1 .. 2 => 0.0); subm : aliased U := 0; begin for i in U'(1) .. 3 loop if dot (vt (Integer (i)).all, cross (dl (Integer (i)), n)) > 0.0 then declare j : constant U := imd3 (Integer (i)); subd : constant math.Real := projectorigin (vt (Integer (i)), vt (Integer (j + 1)), subw'Access, subm'Access); begin if mindist < 0.0 or else subd < mindist then mindist := subd; m.all := U ( (if (subm and 1) /= 0 then 2**Integer (i - 1) else 0) + (if (subm and 2) /= 0 then 2**Integer (j) else 0)); w (Integer (i)) := subw (1); w (Integer (j + 1)) := subw (2); w (Integer (imd3 (Integer (j + 1)) + 1)) := 0.0; end if; end; end if; end loop; if mindist < 0.0 then declare use math.Functions; d : constant math.Real := dot (a.all, n); s : constant math.Real := sqRt (l); p : constant math.Vector_3 := n * (d / l); begin mindist := length2 (p); m.all := 7; -- tbd: 7'7 or '8' ? w (1) := length (cross (dl (2), b.all - p)) / s; w (2) := length (cross (dl (3), c.all - p)) / s; w (3) := 1.0 - (w (1) + w (2)); end; end if; return mindist; end; end if; return -1.0; end projectorigin; function projectorigin (a, b, c, d : access math.Vector_3; w : access math.Vector; m : access U) return math.Real is use impact.d3.Vector; use type U; imd3 : constant array (1 .. 3) of U := (1, 2, 0); vt : constant array (1 .. 4) of access math.Vector_3 := (a, b, c, d); dl : constant array (1 .. 3) of math.Vector_3 := (a.all - d.all, b.all - d.all, c.all - d.all); vl : math.Real := det (dl (1), dl (2), dl (3)); ng : constant Boolean := (vl * dot (a.all, cross (b.all - c.all, a.all - b.all))) <= 0.0; mindist : math.Real; subw : aliased math.Vector := (1 .. 3 => <>); subm : aliased U; begin if ng and then abs (vl) > GJK_SIMPLEX4_EPS then mindist := -1.0; subw := (0.0, 0.0, 0.0); subm := 0; for i in U'(1) .. 3 loop declare use math.Vectors; j : constant U := imd3 (Integer (i)) + 1; s : constant math.Real := vl * dot (d.all, cross (dl (Integer (i)), dl (Integer (j)))); subd : aliased math.Real; begin if s > 0.0 then subd := projectorigin (vt (Integer (i)), vt (Integer (j)), d, subw'Access, subm'Access); if mindist < 0.0 or else subd < mindist then mindist := subd; m.all := U ((if (subm and 1) /= 0 then 2**Natural (i) else 0) + (if (subm and 2) /= 0 then 2**Natural (j) else 0) + (if (subm and 4) /= 0 then 8 else 0)); w (Integer (i)) := subw (1); w (Integer (j)) := subw (2); w (Integer (imd3 (Integer (j)) + 1)) := 0.0; w (4) := subw (3); end if; end if; end; end loop; if mindist < 0.0 then mindist := 0.0; m.all := 15; w (1) := det (c.all, b.all, d.all) / vl; w (2) := det (a.all, c.all, d.all) / vl; w (3) := det (b.all, a.all, d.all) / vl; w (4) := 1.0 - (w (1) + w (2) + w (3)); end if; return mindist; end if; return -1.0; end projectorigin; function EncloseOrigin (Self : access GJK) return Boolean is use impact.d3.Vector; axis, d, p, n : math.Vector_3; begin case Self.m_simplex.rank is when 2 => for i in U'(1) .. 3 loop axis := (0.0, 0.0, 0.0); axis (Integer (i)) := 1.0; Self.appendvertice (Self.m_simplex, axis); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); Self.appendvertice (Self.m_simplex, -axis); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); end loop; when 3 => d := Self.m_simplex.c (2).w - Self.m_simplex.c (1).w; for i in U'(1) .. 3 loop axis := (0.0, 0.0, 0.0); axis (Integer (i)) := 1.0; p := cross (d, axis); if length2 (p) > 0.0 then Self.appendvertice (Self.m_simplex, p); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); Self.appendvertice (Self.m_simplex, -p); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); end if; end loop; when 4 => n := cross (Self.m_simplex.c (2).w - Self.m_simplex.c (1).w, Self.m_simplex.c (3).w - Self.m_simplex.c (1).w); if length2 (n) > 0.0 then Self.appendvertice (Self.m_simplex, n); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); Self.appendvertice (Self.m_simplex, -n); if Self.EncloseOrigin then return True; end if; Self.removevertice (Self.m_simplex); end if; when 5 => if abs (det (Self.m_simplex.c (1).w - Self.m_simplex.c (4).w, Self.m_simplex.c (2).w - Self.m_simplex.c (4).w, Self.m_simplex.c (3).w - Self.m_simplex.c (4).w)) > 0.0 then return True; end if; when others => raise Program_Error; end case; return False; end EncloseOrigin; -------- --- EPA -- function to_EPA return EPA is Self : aliased EPA; begin Self.Initialize; return Self; end to_EPA; procedure bind (fa : in sFace_view; ea : in U; fb : in sFace_view; eb : in U) is use type U; begin fa.e (Integer (ea) + 1) := U1 (eb + 1); fa.f (Integer (ea) + 1) := fb; fb.e (Integer (eb) + 1) := U1 (ea + 1); fb.f (Integer (eb) + 1) := fa; end bind; procedure append (list : in out sList; face : in sFace_view) is use type U; begin face.l (1) := null; face.l (2) := list.root; if list.root /= null then list.root.l (1) := face; end if; list.root := face; list.count := list.count + 1; end append; procedure remove (list : in out sList; face : in sFace_view) is use type U; begin if face.l (2) /= null then face.l (2).l (1) := face.l (1); end if; if face.l (1) /= null then face.l (1).l (2) := face.l (2); end if; if face = list.root then list.root := face.l (2); end if; list.count := list.count - 1; end remove; function newface (Self : access EPA; a, b, c : in sSV_view; forced : in Boolean) return sFace_view is use impact.d3.Vector; face : sFace_view; l : math.Real; v : Boolean; begin if Self.m_stock.root /= null then face := Self.m_stock.root; remove (Self.m_stock, face); append (Self.m_hull, face); face.pass := 0; face.c (1) := a; face.c (2) := b; face.c (3) := c; face.n := cross (b.w - a.w, c.w - a.w); l := length (face.n); v := l > EPA_ACCURACY; face.p := math.Real'Min (math.Real'Min (dot (a.w, cross (face.n, a.w - b.w)), dot (b.w, cross (face.n, b.w - c.w))), dot (c.w, cross (face.n, c.w - a.w))) / (if v then l else 1.0); face.p := (if face.p >= -EPA_INSIDE_EPS then 0.0 else face.p); if v then face.d := dot (a.w, face.n) / l; face.n := face.n / l; if forced or else (face.d >= -EPA_PLANE_EPS) then return face; else Self.m_status := NonConvex; end if; else Self.m_status := Degenerated; end if; remove (Self.m_hull, face); append (Self.m_stock, face); return null; end if; Self.m_status := (if Self.m_stock.root /= null then OutOfVertices else OutOfFaces); return null; end newface; function findbest (Self : access EPA) return sFace_view is -- use impact.d3.Vector, math.Vectors; minf : sFace_view := Self.m_hull.root; mind : math.Real := minf.d * minf.d; maxp : math.Real := minf.p; f : sFace_view := minf.l (2); sqd : math.Real; begin while f /= null loop sqd := f.d * f.d; if f.p >= maxp and then sqd < mind then minf := f; mind := sqd; maxp := f.p; end if; f := f.l (2); end loop; return minf; end findbest; function expand (Self : access EPA; pass : in U; w : in sSV_view; f : in sFace_view; e : in U; horizon : access sHorizon) return Boolean is use impact.d3.Vector; use type U, U1; i1m3 : constant array (1 .. 3) of U := (1, 2, 0); i2m3 : constant array (1 .. 3) of U := (2, 0, 1); e1, e2 : U; nf : sFace_view; begin if f.pass /= U1 (pass) then e1 := i1m3 (Integer (e)) + 1; if dot (f.n, w.w) - f.d < -EPA_PLANE_EPS then nf := Self.newface (f.c (Integer (e1)), f.c (Integer (e)), w, False); if nf /= null then bind (nf, 0, f, e - 1); if horizon.cf /= null then bind (horizon.cf, 1, nf, 2); else horizon.ff := nf; end if; horizon.cf := nf; horizon.nf := horizon.nf + 1; return True; end if; else e2 := i2m3 (Integer (e)) + 1; f.pass := U1 (pass); if Self.expand (pass, w, f.f (Integer (e1)), U (f.e (Integer (e1))), horizon) and then Self.expand (pass, w, f.f (Integer (e2)), U (f.e (Integer (e2))), horizon) then remove (Self.m_hull, f); append (Self.m_stock, f); return True; end if; end if; end if; return False; end expand; procedure Initialize (Self : access EPA) is begin Self.m_status := Failed; Self.m_normal := (0.0, 0.0, 0.0); Self.m_depth := 0.0; Self.m_nextsv := 0; for i in 1 .. EPA_MAX_FACES loop append (Self.m_stock, Self.m_fc_store (EPA_MAX_FACES - (i - 1))'Unchecked_Access); end loop; end Initialize; function Evaluate (Self : in out EPA; gjk : in out gjkepa2_impl.GJK'Class; guess : in math.Vector_3) return eStatus_EPA is use type U; simplex : sSimplex renames gjk.m_simplex.all; tetra : sFace_views (1 .. 4); begin if simplex.rank > 1 and then gjk.EncloseOrigin then -- Clean up -- while Self.m_hull.root /= null loop declare f : constant sFace_view := Self.m_hull.root; begin remove (Self.m_hull, f); append (Self.m_stock, f); end; end loop; Self.m_status := Valid; Self.m_nextsv := 0; -- Orient simplex -- if det (simplex.c (1).w - simplex.c (4).w, simplex.c (2).w - simplex.c (4).w, simplex.c (3).w - simplex.c (4).w) < 0.0 then declare Pad1 : constant sSV := simplex.c (1); Pad2 : math.Real; begin simplex.c (1) := simplex.c (2); -- swap simplex.c (2) := Pad1; Pad2 := simplex.p (1); -- swap simplex.p (1) := simplex.p (2); simplex.p (2) := Pad2; end; end if; -- Build initial hull -- tetra := (Self.newface (simplex.c (1)'Access, simplex.c (2)'Access, simplex.c (3)'Access, True), Self.newface (simplex.c (2)'Access, simplex.c (1)'Access, simplex.c (4)'Access, True), Self.newface (simplex.c (3)'Access, simplex.c (2)'Access, simplex.c (4)'Access, True), Self.newface (simplex.c (1)'Access, simplex.c (3)'Access, simplex.c (4)'Access, True)); if Self.m_hull.count = 4 then declare use impact.d3.Vector; best : sFace_view := Self.findbest; outer : sFace := best.all; pass : U := 0; iterations : U := 0; projection : math.Vector_3; sum : math.Real; begin bind (tetra (1), 0, tetra (2), 0); bind (tetra (1), 1, tetra (3), 0); bind (tetra (1), 2, tetra (4), 0); bind (tetra (2), 1, tetra (4), 2); bind (tetra (2), 2, tetra (3), 1); bind (tetra (3), 2, tetra (4), 1); Self.m_status := Valid; while iterations < EPA_MAX_ITERATIONS loop if Self.m_nextsv < EPA_MAX_VERTICES then declare horizon : aliased sHorizon; w : constant sSV_view := Self.m_sv_store (Integer (Self.m_nextsv) + 1)'Unchecked_Access; valid : Boolean := True; wdist : math.Real; begin Self.m_nextsv := Self.m_nextsv + 1; pass := pass + 1; best.pass := U1 (pass); getsupport (gjk, best.n, w.all); wdist := dot (best.n, w.w) - best.d; if wdist > EPA_ACCURACY then for j in U'(1) .. 3 loop valid := valid and Self.expand (pass, w, best.f (Integer (j)), U (best.e (Integer (j))), horizon'Access); exit when not Valid; end loop; if valid and then horizon.nf >= 3 then bind (horizon.cf, 1, horizon.ff, 2); remove (Self.m_hull, best); append (Self.m_stock, best); best := Self.findbest; if best.p >= outer.p then outer := best.all; end if; else Self.m_status := InvalidHull; exit; end if; else Self.m_status := AccuraryReached; exit; end if; end; else Self.m_status := OutOfVertices; exit; end if; iterations := iterations + 1; end loop; projection := outer.n * outer.d; Self.m_normal := outer.n; Self.m_depth := outer.d; Self.m_result.rank := 3; Self.m_result.c (1) := outer.c (1).all; Self.m_result.c (2) := outer.c (2).all; Self.m_result.c (3) := outer.c (3).all; Self.m_result.p (1) := length (cross (outer.c (2).w - projection, outer.c (3).w - projection)); Self.m_result.p (2) := length (cross (outer.c (3).w - projection, outer.c (1).w - projection)); Self.m_result.p (3) := length (cross (outer.c (1).w - projection, outer.c (2).w - projection)); sum := Self.m_result.p (1) + Self.m_result.p (2) + Self.m_result.p (3); Self.m_result.p (1) := Self.m_result.p (1) / sum; Self.m_result.p (2) := Self.m_result.p (2) / sum; Self.m_result.p (3) := Self.m_result.p (3) / sum; return Self.m_status; end; end if; end if; -- Fallback -- Self.m_status := FallBack; Self.m_normal := -guess; declare use impact.d3.Vector; nl : constant math.Real := length (Self.m_normal); begin if nl > 0.0 then Self.m_normal := Self.m_normal / nl; else Self.m_normal := (1.0, 0.0, 0.0); end if; end; Self.m_depth := 0.0; Self.m_result.rank := 1; Self.m_result.c (1) := simplex.c (1); Self.m_result.p (1) := 1.0; return Self.m_status; end Evaluate; procedure Initialize (shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; shape1 : in impact.d3.Shape.convex.view; wtrs1 : in Transform_3d; results : out impact.d3.collision.gjk_epa.btGjkEpaSolver2.sResults; shape : in out tShape; withmargins : in Boolean) is use impact.d3.Transform, impact.d3.Matrix; begin -- Results -- results.witnesses (1) := (0.0, 0.0, 0.0); results.witnesses (2) := (0.0, 0.0, 0.0); results.status := impact.d3.collision.gjk_epa.btGjkEpaSolver2.Separated; -- Shape -- shape.m_shapes (1) := shape0; shape.m_shapes (2) := shape1; shape.m_toshape1 := transposeTimes (getBasis (wtrs1), getBasis (wtrs0)); shape.m_toshape0 := inverseTimes (wtrs0, wtrs1); shape.EnableMargin (withmargins); end Initialize; end gjkepa2_impl; package body btGjkEpaSolver2 is use gjkepa2_impl; function StackSizeRequirement return Integer is begin return (GJK'Size + EPA'Size) / 8; end StackSizeRequirement; function Distance (shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; shape1 : in impact.d3.Shape.convex.view; wtrs1 : in Transform_3d; guess : in math.Vector_3; results : access sResults) return Boolean is shape : tShape; begin gjkepa2_impl.Initialize (shape0, wtrs0, shape1, wtrs1, results.all, shape, False); declare use linear_Algebra_3d, impact.d3.Vector, impact.d3.Transform; gjk : aliased gjkepa2_impl.GJK; gjk_status : constant gjkepa2_impl.eStatus := gjk.Evaluate (shape, guess); w0, w1 : math.Vector_3; p : math.Real; begin if gjk_status = Valid then w0 := (0.0, 0.0, 0.0); w1 := (0.0, 0.0, 0.0); for i in U'(1) .. gjk.m_simplex.rank loop p := gjk.m_simplex.p (Integer (i)); w0 := w0 + shape.Support (gjk.m_simplex.c (Integer (i)).d, 0) * p; w1 := w1 + shape.Support (-gjk.m_simplex.c (Integer (i)).d, 1) * p; end loop; results.witnesses (1) := wtrs0 * w0; results.witnesses (2) := wtrs0 * w1; results.normal := w0 - w1; results.distance := length (results.normal); results.normal := results.normal / (if results.distance > GJK_MIN_DISTANCE then results.distance else 1.0); return True; else results.status := (if gjk_status = Inside then Penetrating else GJK_Failed); return False; end if; end; end Distance; function Penetration (shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; shape1 : in impact.d3.Shape.convex.view; wtrs1 : in Transform_3d; guess : in math.Vector_3; results : access sResults; usemargins : in Boolean := True) return Boolean is shape : tShape; begin gjkepa2_impl.Initialize (shape0, wtrs0, shape1, wtrs1, results.all, shape, usemargins); declare gjk : aliased gjkepa2_impl.GJK; gjk_status : constant gjkepa2_impl.eStatus := gjk.Evaluate (shape, -guess); begin case gjk_status is when Inside => declare use impact.d3.Transform, linear_Algebra_3d; epa : gjkepa2_impl.EPA := to_EPA; epa_status : constant eStatus_EPA := epa.Evaluate (gjk, -guess); w0 : math.Vector_3; begin if epa_status /= Failed then w0 := (0.0, 0.0, 0.0); for i in U'(1) .. epa.m_result.rank loop w0 := w0 + shape.Support (epa.m_result.c (Integer (i)).d, 0) * epa.m_result.p (Integer (i)); end loop; results.status := Penetrating; results.witnesses (1) := wtrs0 * w0; results.witnesses (2) := wtrs0 * (w0 - epa.m_normal*epa.m_depth); results.normal := -epa.m_normal; results.distance := -epa.m_depth; return True; else results.status := EPA_Failed; end if; end; when Failed => results.status := GJK_Failed; when others => null; end case; return False; end; end Penetration; function SignedDistance (position : in math.Vector_3; margin : in math.Real; shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; results : access sResults) return math.Real is shape : tShape; shape1 : aliased impact.d3.Shape.convex.internal.sphere.item := impact.d3.Shape.convex.internal.sphere.to_sphere_Shape (margin); wtrs1 : constant Transform_3d := impact.d3.Transform.to_Transform (impact.d3.Quaternions.to_Quaternion (0.0, 0.0, 0.0, 1.0), position); begin Initialize (shape0, wtrs0, shape1'Unchecked_Access, wtrs1, results.all, shape, False); declare use linear_Algebra_3d, impact.d3.Transform, impact.d3.Vector; gjk : aliased gjkepa2_impl.GJK; gjk_status : constant gjkepa2_impl.eStatus := gjk.Evaluate (shape, (1.0, 1.0, 1.0)); w0, w1 : math.Vector_3; the_delta : math.Vector_3; margin, length, p : math.Real; begin if gjk_status = Valid then w0 := (0.0, 0.0, 0.0); w1 := (0.0, 0.0, 0.0); for i in U'(1) .. gjk.m_simplex.rank loop p := gjk.m_simplex.p (Integer (i)); w0 := w0 + shape.Support (gjk.m_simplex.c (Integer (i)).d, 0) * p; w1 := w1 + shape.Support (-gjk.m_simplex.c (Integer (i)).d, 1) * p; end loop; results.witnesses (1) := wtrs0 * w0; results.witnesses (2) := wtrs0 * w1; the_delta := results.witnesses (2) - results.witnesses (1); margin := shape0.getMarginNonVirtual + shape1.getMarginNonVirtual; length := impact.d3.Vector.length (the_delta); results.normal := the_delta / length; results.witnesses (1) := results.witnesses (1) + results.normal * margin; return length - margin; else if gjk_status = Inside then if Penetration (shape0, wtrs0, shape1'Unchecked_Access, wtrs1, gjk.m_ray, results) then the_delta := results.witnesses (1) - results.witnesses (2); length := impact.d3.Vector.length (the_delta); if length >= impact.d3.Scalar.SIMD_EPSILON then results.normal := the_delta / length; end if; return -length; end if; end if; end if; return impact.d3.Scalar.SIMD_INFINITY; end; end SignedDistance; function SignedDistance (shape0 : in impact.d3.Shape.convex.view; wtrs0 : in Transform_3d; shape1 : in impact.d3.Shape.convex.view; wtrs1 : in Transform_3d; guess : in math.Vector_3; results : access sResults) return Boolean is begin if not Distance (shape0, wtrs0, shape1, wtrs1, guess, results) then return Penetration (shape0, wtrs0, shape1, wtrs1, guess, results, False); else return True; end if; end SignedDistance; end btGjkEpaSolver2; end impact.d3.collision.gjk_epa;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UMLDI.UML_Diagram_Elements.Hash is new AMF.Elements.Generic_Hash (UMLDI_UML_Diagram_Element, UMLDI_UML_Diagram_Element_Access);
-- Copyright 2016-2020 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; package body Pkg is procedure Flip (Bits : in out Bits_Type; I : Natural) is begin -- Create a new scope to check that the scope match algorithm is fine in -- the front-end. declare Rename_Subscript_Param_B : Boolean renames Bits (I); begin Rename_Subscript_Param_B := not Rename_Subscript_Param_B; -- BREAK Do_Nothing (Bits'Address); end; end Flip; end Pkg;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . N U M E R I C S . D I S C R E T E _ R A N D O M -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Calendar; with Interfaces; use Interfaces; package body Ada.Numerics.Discrete_Random is ------------------------- -- Implementation Note -- ------------------------- -- The design of this spec is very awkward, as a result of Ada 95 not -- permitting in-out parameters for function formals (most naturally -- Generator values would be passed this way). In pure Ada 95, the only -- solution is to use the heap and pointers, and, to avoid memory leaks, -- controlled types. -- This is awfully heavy, so what we do is to use Unrestricted_Access to -- get a pointer to the state in the passed Generator. This works because -- Generator is a limited type and will thus always be passed by reference. type Pointer is access all State; Need_64 : constant Boolean := Rst'Pos (Rst'Last) > Int'Last; -- Set if we need more than 32 bits in the result. In practice we will -- only use the meaningful 48 bits of any 64 bit number generated, since -- if more than 48 bits are required, we split the computation into two -- separate parts, since the algorithm does not behave above 48 bits. ----------------------- -- Local Subprograms -- ----------------------- function Square_Mod_N (X, N : Int) return Int; pragma Inline (Square_Mod_N); -- Computes X**2 mod N avoiding intermediate overflow ----------- -- Image -- ----------- function Image (Of_State : State) return String is begin return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2) & ',' & Int'Image (Of_State.Q); end Image; ------------ -- Random -- ------------ function Random (Gen : Generator) return Rst is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; Temp : Int; TF : Flt; begin -- Check for flat range here, since we are typically run with checks -- off, note that in practice, this condition will usually be static -- so we will not actually generate any code for the normal case. if Rst'Last < Rst'First then raise Constraint_Error; end if; -- Continue with computation if non-flat range Genp.X1 := Square_Mod_N (Genp.X1, Genp.P); Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q); Temp := Genp.X2 - Genp.X1; -- Following duplication is not an error, it is a loop unwinding! if Temp < 0 then Temp := Temp + Genp.Q; end if; if Temp < 0 then Temp := Temp + Genp.Q; end if; TF := Offs + (Flt (Temp) * Flt (Genp.P) + Flt (Genp.X1)) * Genp.Scl; -- Pathological, but there do exist cases where the rounding implicit -- in calculating the scale factor will cause rounding to 'Last + 1. -- In those cases, returning 'First results in the least bias. if TF >= Flt (Rst'Pos (Rst'Last)) + 0.5 then return Rst'First; elsif Need_64 then return Rst'Val (Interfaces.Integer_64 (TF)); else return Rst'Val (Int (TF)); end if; end Random; ----------- -- Reset -- ----------- procedure Reset (Gen : Generator; Initiator : Integer) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; X1, X2 : Int; begin X1 := 2 + Int (Initiator) mod (K1 - 3); X2 := 2 + Int (Initiator) mod (K2 - 3); for J in 1 .. 5 loop X1 := Square_Mod_N (X1, K1); X2 := Square_Mod_N (X2, K2); end loop; -- Eliminate effects of small Initiators Genp.all := (X1 => X1, X2 => X2, P => K1, Q => K2, FP => K1F, Scl => Scal); end Reset; ----------- -- Reset -- ----------- procedure Reset (Gen : Generator) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; Now : constant Calendar.Time := Calendar.Clock; X1 : Int; X2 : Int; begin X1 := Int (Calendar.Year (Now)) * 12 * 31 + Int (Calendar.Month (Now) * 31) + Int (Calendar.Day (Now)); X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); X1 := 2 + X1 mod (K1 - 3); X2 := 2 + X2 mod (K2 - 3); -- Eliminate visible effects of same day starts for J in 1 .. 5 loop X1 := Square_Mod_N (X1, K1); X2 := Square_Mod_N (X2, K2); end loop; Genp.all := (X1 => X1, X2 => X2, P => K1, Q => K2, FP => K1F, Scl => Scal); end Reset; ----------- -- Reset -- ----------- procedure Reset (Gen : Generator; From_State : State) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; begin Genp.all := From_State; end Reset; ---------- -- Save -- ---------- procedure Save (Gen : Generator; To_State : out State) is begin To_State := Gen.Gen_State; end Save; ------------------ -- Square_Mod_N -- ------------------ function Square_Mod_N (X, N : Int) return Int is begin return Int ((Integer_64 (X) ** 2) mod (Integer_64 (N))); end Square_Mod_N; ----------- -- Value -- ----------- function Value (Coded_State : String) return State is Last : constant Natural := Coded_State'Last; Start : Positive := Coded_State'First; Stop : Positive := Coded_State'First; Outs : State; begin while Stop <= Last and then Coded_State (Stop) /= ',' loop Stop := Stop + 1; end loop; if Stop > Last then raise Constraint_Error; end if; Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); Start := Stop + 1; loop Stop := Stop + 1; exit when Stop > Last or else Coded_State (Stop) = ','; end loop; if Stop > Last then raise Constraint_Error; end if; Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); Outs.P := Outs.Q * 2 + 1; Outs.FP := Flt (Outs.P); Outs.Scl := (RstL - RstF + 1.0) / (Flt (Outs.P) * Flt (Outs.Q)); -- Now do *some* sanity checks if Outs.Q < 31 or else Outs.X1 not in 2 .. Outs.P - 1 or else Outs.X2 not in 2 .. Outs.Q - 1 then raise Constraint_Error; end if; return Outs; end Value; end Ada.Numerics.Discrete_Random;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.CMOF.Elements; with AMF.DI.Styles; with AMF.Internals.UMLDI_UML_Labels; with AMF.UML.Elements.Collections; with AMF.UMLDI.UML_Keyword_Labels; with AMF.UMLDI.UML_Styles; with AMF.Visitors; with League.Strings; package AMF.Internals.UMLDI_UML_Keyword_Labels is type UMLDI_UML_Keyword_Label_Proxy is limited new AMF.Internals.UMLDI_UML_Labels.UMLDI_UML_Label_Proxy and AMF.UMLDI.UML_Keyword_Labels.UMLDI_UML_Keyword_Label with null record; overriding function Get_Text (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return League.Strings.Universal_String; -- Getter of UMLLabel::text. -- -- String to be rendered. overriding procedure Set_Text (Self : not null access UMLDI_UML_Keyword_Label_Proxy; To : League.Strings.Universal_String); -- Setter of UMLLabel::text. -- -- String to be rendered. overriding function Get_Is_Icon (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return Boolean; -- Getter of UMLDiagramElement::isIcon. -- -- For modelElements that have an option to be shown with shapes other -- than rectangles, such as Actors, or with other identifying shapes -- inside them, such as arrows distinguishing InputPins and OutputPins, or -- edges that have an option to be shown with lines other than solid with -- open arrow heads, such as Realization. A value of true for isIcon -- indicates the alternative notation shall be shown. overriding procedure Set_Is_Icon (Self : not null access UMLDI_UML_Keyword_Label_Proxy; To : Boolean); -- Setter of UMLDiagramElement::isIcon. -- -- For modelElements that have an option to be shown with shapes other -- than rectangles, such as Actors, or with other identifying shapes -- inside them, such as arrows distinguishing InputPins and OutputPins, or -- edges that have an option to be shown with lines other than solid with -- open arrow heads, such as Realization. A value of true for isIcon -- indicates the alternative notation shall be shown. overriding function Get_Local_Style (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access; -- Getter of UMLDiagramElement::localStyle. -- -- Restricts owned styles to UMLStyles. overriding procedure Set_Local_Style (Self : not null access UMLDI_UML_Keyword_Label_Proxy; To : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access); -- Setter of UMLDiagramElement::localStyle. -- -- Restricts owned styles to UMLStyles. overriding function Get_Model_Element (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of UMLDiagramElement::modelElement. -- -- Restricts UMLDiagramElements to show UML Elements, rather than other -- language elements. overriding function Get_Model_Element (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return AMF.CMOF.Elements.CMOF_Element_Access; -- Getter of DiagramElement::modelElement. -- -- a reference to a depicted model element, which can be any MOF-based -- element overriding function Get_Local_Style (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy) return AMF.DI.Styles.DI_Style_Access; -- Getter of DiagramElement::localStyle. -- -- a reference to an optional locally-owned style for this diagram element. overriding procedure Set_Local_Style (Self : not null access UMLDI_UML_Keyword_Label_Proxy; To : AMF.DI.Styles.DI_Style_Access); -- Setter of DiagramElement::localStyle. -- -- a reference to an optional locally-owned style for this diagram element. overriding procedure Enter_Element (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant UMLDI_UML_Keyword_Label_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.UMLDI_UML_Keyword_Labels;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . D E B U G _ U T I L I T I E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2010, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Debugging utilities -- This package provides some useful utility subprograms for use in writing -- routines that generate debugging output. with System; package GNAT.Debug_Utilities is pragma Pure; Address_64 : constant Boolean := Standard'Address_Size = 64; -- Set true if 64 bit addresses (assumes only 32 and 64 are possible) Address_Image_Length : constant := 13 + 10 * Boolean'Pos (Address_64); -- Length of string returned by Image function for an address subtype Image_String is String (1 .. Address_Image_Length); -- Subtype returned by Image function for an address Address_Image_C_Length : constant := 10 + 8 * Boolean'Pos (Address_64); -- Length of string returned by Image_C function subtype Image_C_String is String (1 .. Address_Image_C_Length); -- Subtype returned by Image_C function function Image (S : String) return String; -- Returns a string image of S, obtained by prepending and appending -- quote (") characters and doubling any quote characters in the string. -- The maximum length of the result is thus 2 ** S'Length + 2. function Image (A : System.Address) return Image_String; -- Returns a string of the form 16#hhhh_hhhh# for 32-bit addresses -- or 16#hhhh_hhhh_hhhh_hhhh# for 64-bit addresses. Hex characters -- are in upper case. function Image_C (A : System.Address) return Image_C_String; -- Returns a string of the form 0xhhhhhhhh for 32 bit addresses or -- 0xhhhhhhhhhhhhhhhh for 64-bit addresses. Hex characters are in -- upper case. function Value (S : String) return System.Address; -- Given a valid integer literal in any form, including the form returned -- by the Image function in this package, yields the corresponding address. -- Note that this routine will handle any Ada integer format, and will -- also handle hex constants in C format (0xhh..hhh). Constraint_Error -- may be raised for obviously incorrect data, but the routine is fairly -- permissive, and in particular, all underscores in whatever position -- are simply ignored completely. end GNAT.Debug_Utilities;
with Ada.Containers.Ordered_Maps; with Ada.Strings.Unbounded; with External; use External; package EdgeRegistry is package HMP is new Ada.Containers.Ordered_Maps( Key_Type => MString, Element_Type => Boolean, "<" => Ada.Strings.Unbounded."<" ); subtype HashMap is HMP.Map; procedure Register(map: in out HashMap; a: Natural; b: Natural); function Exists(map: HashMap; a: Natural; b: Natural) return Boolean; private function Key(a: Natural; b: Natural) return MString; end EdgeRegistry;
generic type element_t is private; package generic_linked_list is -- Exception levée en l'absence de noeud no_node : exception; -- Forward declaration du type node_t -- car celui contient de pointeur de son type -- et qu'on souhaite utiliser l'alias node_ptr type node_t is private; -- Déclaration du type pointeur vers node_t type node_ptr is access node_t; -- Créer une liste chaine avec un élément -- Renvoie le noeud de la chaine crée -- ATTENTION: destroy la liste une fois son utilisation terminée -- sinon risque de fuite mémoire function create(element : element_t) return node_ptr; -- Ajoute un élément à la fin de la liste chainée function add_after(node : node_ptr; element : element_t) return node_ptr; procedure add_after(node : node_ptr; element : element_t); -- Retire l'élement suivant l'élément passé en -- paramètre de la liste chainée -- Exception: no_node si aucun noeud suivant procedure remove_next(node : node_ptr); -- Indique si la liste contient un élément suivant function has_next(node : node_ptr) return boolean; -- Avance au noeud suivant -- Exception: no_node si aucun noeud suivant function move_next(node : node_ptr) return node_ptr; -- Renvoie l'élément porté par le noeud function elem(node : node_ptr) return element_t; -- Détruit la liste (noeud courrant & noeuds suivants) -- Les noeuds avant le noeud passé en paramètre sont ignorés procedure destroy(node : in out node_ptr); -- Définit un pointeur de fonction pour une fonction to_string sur element_t type to_string_function_t is access function (elem : element_t) return string; -- Donne une représentation textuelle de la liste (chacun des éléments) function to_string(node : node_ptr; to_string : to_string_function_t) return string; private -- Implémentation du type node_t -- privé type node_t is record -- l'élément porté par le noeud element : element_t; -- le noeud suivant next_node : node_ptr; end record; end generic_linked_list;
-- MIT License -- -- Copyright (c) 2020 Max Reznik -- -- 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.Unchecked_Deallocation; package body PB_Support.Vectors is procedure Free is new Ada.Unchecked_Deallocation (Element_Array, Element_Array_Access); ------------ -- Adjust -- ------------ overriding procedure Adjust (Self : in out Vector) is begin if Self.Length > 0 then Self.Data := new Element_Array'(Self.Data (1 .. Self.Length)); end if; end Adjust; ------------ -- Append -- ------------ procedure Append (Self : in out Vector; Value : Element_Type) is Old : Element_Array_Access := Self.Data; Init_Length : constant Positive := Positive'Max (1, 256 / Natural'Max (1, Element_Type'Size)); begin if Self.Length = 0 then Self.Data := new Element_Array (1 .. Init_Length); elsif Self.Length = Self.Data'Last then Self.Data := new Element_Array' (Old.all & (1 .. Self.Length => <>)); Free (Old); end if; Self.Length := Self.Length + 1; Self.Data (Self.Length) := Value; end Append; ----------- -- Clear -- ----------- procedure Clear (Self : in out Vector) is begin Self.Length := 0; end Clear; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : in out Vector) is begin if Self.Data /= null then Free (Self.Data); end if; end Finalize; --------- -- Get -- --------- function Get (Self : Vector; Index : Positive) return Element_Type is begin return Self.Data (Index); end Get; ------------ -- Length -- ------------ function Length (Self : Vector) return Natural is begin return Self.Length; end Length; end PB_Support.Vectors;
----------------------------------------------------------------------- -- AWA.Events.Models -- AWA.Events.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) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- 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; pragma Warnings (On); package AWA.Events.Models is pragma Style_Checks ("-mr"); type Message_Status_Type is (QUEUED, PROCESSING, PROCESSED); for Message_Status_Type use (QUEUED => 0, PROCESSING => 1, PROCESSED => 2); package Message_Status_Type_Objects is new Util.Beans.Objects.Enums (Message_Status_Type); type Message_Type_Ref is new ADO.Objects.Object_Ref with null record; type Queue_Ref is new ADO.Objects.Object_Ref with null record; type Message_Ref is new ADO.Objects.Object_Ref with null record; -- Create an object key for Message_Type. function Message_Type_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Message_Type from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Message_Type_Key (Id : in String) return ADO.Objects.Object_Key; Null_Message_Type : constant Message_Type_Ref; function "=" (Left, Right : Message_Type_Ref'Class) return Boolean; -- procedure Set_Id (Object : in out Message_Type_Ref; Value : in ADO.Identifier); -- function Get_Id (Object : in Message_Type_Ref) return ADO.Identifier; -- Set the message type name procedure Set_Name (Object : in out Message_Type_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Name (Object : in out Message_Type_Ref; Value : in String); -- Get the message type name function Get_Name (Object : in Message_Type_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Name (Object : in Message_Type_Ref) return String; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Message_Type_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 Message_Type_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 Message_Type_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 Message_Type_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Message_Type_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition MESSAGE_TYPE_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Message_Type_Ref); -- Copy of the object. procedure Copy (Object : in Message_Type_Ref; Into : in out Message_Type_Ref); package Message_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Message_Type_Ref, "=" => "="); subtype Message_Type_Vector is Message_Type_Vectors.Vector; procedure List (Object : in out Message_Type_Vector; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class); -- -------------------- -- The message queue tracks the event messages that must be dispatched by -- a given server. -- -------------------- -- Create an object key for Queue. function Queue_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Queue from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Queue_Key (Id : in String) return ADO.Objects.Object_Key; Null_Queue : constant Queue_Ref; function "=" (Left, Right : Queue_Ref'Class) return Boolean; -- procedure Set_Id (Object : in out Queue_Ref; Value : in ADO.Identifier); -- function Get_Id (Object : in Queue_Ref) return ADO.Identifier; -- procedure Set_Server_Id (Object : in out Queue_Ref; Value : in Integer); -- function Get_Server_Id (Object : in Queue_Ref) return Integer; -- Set the message queue name procedure Set_Name (Object : in out Queue_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Name (Object : in out Queue_Ref; Value : in String); -- Get the message queue name function Get_Name (Object : in Queue_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Name (Object : in Queue_Ref) return String; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Queue_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 Queue_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 Queue_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 Queue_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Queue_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Queue_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition QUEUE_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Queue_Ref); -- Copy of the object. procedure Copy (Object : in Queue_Ref; Into : in out Queue_Ref); -- Create an object key for Message. function Message_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Message from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Message_Key (Id : in String) return ADO.Objects.Object_Key; Null_Message : constant Message_Ref; function "=" (Left, Right : Message_Ref'Class) return Boolean; -- Set the message identifier procedure Set_Id (Object : in out Message_Ref; Value : in ADO.Identifier); -- Get the message identifier function Get_Id (Object : in Message_Ref) return ADO.Identifier; -- Set the message creation date procedure Set_Create_Date (Object : in out Message_Ref; Value : in Ada.Calendar.Time); -- Get the message creation date function Get_Create_Date (Object : in Message_Ref) return Ada.Calendar.Time; -- Set the message priority procedure Set_Priority (Object : in out Message_Ref; Value : in Integer); -- Get the message priority function Get_Priority (Object : in Message_Ref) return Integer; -- Set the message count procedure Set_Count (Object : in out Message_Ref; Value : in Integer); -- Get the message count function Get_Count (Object : in Message_Ref) return Integer; -- Set the message parameters procedure Set_Parameters (Object : in out Message_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Parameters (Object : in out Message_Ref; Value : in String); -- Get the message parameters function Get_Parameters (Object : in Message_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Parameters (Object : in Message_Ref) return String; -- Set the server identifier which processes the message procedure Set_Server_Id (Object : in out Message_Ref; Value : in Integer); -- Get the server identifier which processes the message function Get_Server_Id (Object : in Message_Ref) return Integer; -- Set the task identfier on the server which processes the message procedure Set_Task_Id (Object : in out Message_Ref; Value : in Integer); -- Get the task identfier on the server which processes the message function Get_Task_Id (Object : in Message_Ref) return Integer; -- Set the message status procedure Set_Status (Object : in out Message_Ref; Value : in AWA.Events.Models.Message_Status_Type); -- Get the message status function Get_Status (Object : in Message_Ref) return AWA.Events.Models.Message_Status_Type; -- Set the message processing date procedure Set_Processing_Date (Object : in out Message_Ref; Value : in ADO.Nullable_Time); -- Get the message processing date function Get_Processing_Date (Object : in Message_Ref) return ADO.Nullable_Time; -- function Get_Version (Object : in Message_Ref) return Integer; -- Set the entity identifier to which this event is associated. procedure Set_Entity_Id (Object : in out Message_Ref; Value : in ADO.Identifier); -- Get the entity identifier to which this event is associated. function Get_Entity_Id (Object : in Message_Ref) return ADO.Identifier; -- Set the entity type of the entity identifier to which this event is associated. procedure Set_Entity_Type (Object : in out Message_Ref; Value : in ADO.Entity_Type); -- Get the entity type of the entity identifier to which this event is associated. function Get_Entity_Type (Object : in Message_Ref) return ADO.Entity_Type; -- Set the date and time when the event was finished to be processed. procedure Set_Finish_Date (Object : in out Message_Ref; Value : in ADO.Nullable_Time); -- Get the date and time when the event was finished to be processed. function Get_Finish_Date (Object : in Message_Ref) return ADO.Nullable_Time; -- procedure Set_Queue (Object : in out Message_Ref; Value : in AWA.Events.Models.Queue_Ref'Class); -- function Get_Queue (Object : in Message_Ref) return AWA.Events.Models.Queue_Ref'Class; -- Set the message type procedure Set_Message_Type (Object : in out Message_Ref; Value : in AWA.Events.Models.Message_Type_Ref'Class); -- Get the message type function Get_Message_Type (Object : in Message_Ref) return AWA.Events.Models.Message_Type_Ref'Class; -- Set the optional user who triggered the event message creation procedure Set_User (Object : in out Message_Ref; Value : in AWA.Users.Models.User_Ref'Class); -- Get the optional user who triggered the event message creation function Get_User (Object : in Message_Ref) return AWA.Users.Models.User_Ref'Class; -- Set the optional user session that triggered the message creation procedure Set_Session (Object : in out Message_Ref; Value : in AWA.Users.Models.Session_Ref'Class); -- Get the optional user session that triggered the message creation function Get_Session (Object : in Message_Ref) return AWA.Users.Models.Session_Ref'Class; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Message_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 Message_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 Message_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 Message_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Message_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Message_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition MESSAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Message_Ref); -- Copy of the object. procedure Copy (Object : in Message_Ref; Into : in out Message_Ref); package Message_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Message_Ref, "=" => "="); subtype Message_Vector is Message_Vectors.Vector; procedure List (Object : in out Message_Vector; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class); Query_Queue_Pending_Message : constant ADO.Queries.Query_Definition_Access; private MESSAGE_TYPE_NAME : aliased constant String := "awa_message_type"; COL_0_1_NAME : aliased constant String := "id"; COL_1_1_NAME : aliased constant String := "name"; MESSAGE_TYPE_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 2, Table => MESSAGE_TYPE_NAME'Access, Members => ( 1 => COL_0_1_NAME'Access, 2 => COL_1_1_NAME'Access ) ); MESSAGE_TYPE_TABLE : constant ADO.Schemas.Class_Mapping_Access := MESSAGE_TYPE_DEF'Access; Null_Message_Type : constant Message_Type_Ref := Message_Type_Ref'(ADO.Objects.Object_Ref with null record); type Message_Type_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_TYPE_DEF'Access) with record Name : Ada.Strings.Unbounded.Unbounded_String; end record; type Message_Type_Access is access all Message_Type_Impl; overriding procedure Destroy (Object : access Message_Type_Impl); overriding procedure Find (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Message_Type_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Message_Type_Ref'Class; Impl : out Message_Type_Access); QUEUE_NAME : aliased constant String := "awa_queue"; COL_0_2_NAME : aliased constant String := "id"; COL_1_2_NAME : aliased constant String := "server_id"; COL_2_2_NAME : aliased constant String := "name"; QUEUE_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 3, Table => QUEUE_NAME'Access, Members => ( 1 => COL_0_2_NAME'Access, 2 => COL_1_2_NAME'Access, 3 => COL_2_2_NAME'Access ) ); QUEUE_TABLE : constant ADO.Schemas.Class_Mapping_Access := QUEUE_DEF'Access; Null_Queue : constant Queue_Ref := Queue_Ref'(ADO.Objects.Object_Ref with null record); type Queue_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => QUEUE_DEF'Access) with record Server_Id : Integer; Name : Ada.Strings.Unbounded.Unbounded_String; end record; type Queue_Access is access all Queue_Impl; overriding procedure Destroy (Object : access Queue_Impl); overriding procedure Find (Object : in out Queue_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Queue_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Queue_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Queue_Ref'Class; Impl : out Queue_Access); MESSAGE_NAME : aliased constant String := "awa_message"; COL_0_3_NAME : aliased constant String := "id"; COL_1_3_NAME : aliased constant String := "create_date"; COL_2_3_NAME : aliased constant String := "priority"; COL_3_3_NAME : aliased constant String := "count"; COL_4_3_NAME : aliased constant String := "parameters"; COL_5_3_NAME : aliased constant String := "server_id"; COL_6_3_NAME : aliased constant String := "task_id"; COL_7_3_NAME : aliased constant String := "status"; COL_8_3_NAME : aliased constant String := "processing_date"; COL_9_3_NAME : aliased constant String := "version"; COL_10_3_NAME : aliased constant String := "entity_id"; COL_11_3_NAME : aliased constant String := "entity_type"; COL_12_3_NAME : aliased constant String := "finish_date"; COL_13_3_NAME : aliased constant String := "queue_id"; COL_14_3_NAME : aliased constant String := "message_type_id"; COL_15_3_NAME : aliased constant String := "user_id"; COL_16_3_NAME : aliased constant String := "session_id"; MESSAGE_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 17, Table => MESSAGE_NAME'Access, Members => ( 1 => COL_0_3_NAME'Access, 2 => COL_1_3_NAME'Access, 3 => COL_2_3_NAME'Access, 4 => COL_3_3_NAME'Access, 5 => COL_4_3_NAME'Access, 6 => COL_5_3_NAME'Access, 7 => COL_6_3_NAME'Access, 8 => COL_7_3_NAME'Access, 9 => COL_8_3_NAME'Access, 10 => COL_9_3_NAME'Access, 11 => COL_10_3_NAME'Access, 12 => COL_11_3_NAME'Access, 13 => COL_12_3_NAME'Access, 14 => COL_13_3_NAME'Access, 15 => COL_14_3_NAME'Access, 16 => COL_15_3_NAME'Access, 17 => COL_16_3_NAME'Access ) ); MESSAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access := MESSAGE_DEF'Access; Null_Message : constant Message_Ref := Message_Ref'(ADO.Objects.Object_Ref with null record); type Message_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_DEF'Access) with record Create_Date : Ada.Calendar.Time; Priority : Integer; Count : Integer; Parameters : Ada.Strings.Unbounded.Unbounded_String; Server_Id : Integer; Task_Id : Integer; Status : AWA.Events.Models.Message_Status_Type; Processing_Date : ADO.Nullable_Time; Version : Integer; Entity_Id : ADO.Identifier; Entity_Type : ADO.Entity_Type; Finish_Date : ADO.Nullable_Time; Queue : AWA.Events.Models.Queue_Ref; Message_Type : AWA.Events.Models.Message_Type_Ref; User : AWA.Users.Models.User_Ref; Session : AWA.Users.Models.Session_Ref; end record; type Message_Access is access all Message_Impl; overriding procedure Destroy (Object : access Message_Impl); overriding procedure Find (Object : in out Message_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Message_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Message_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Message_Ref'Class; Impl : out Message_Access); package File_1 is new ADO.Queries.Loaders.File (Path => "queue-messages.xml", Sha1 => "9B2B599473F75F92CB5AB5045675E4CCEF926543"); package Def_Queue_Pending_Message is new ADO.Queries.Loaders.Query (Name => "queue-pending-message", File => File_1.File'Access); Query_Queue_Pending_Message : constant ADO.Queries.Query_Definition_Access := Def_Queue_Pending_Message.Query'Access; end AWA.Events.Models;
package Sub_Derived_Types is subtype smallSub is Integer range -10 .. 10; type smallDerived is new Integer range -10 .. 10; type smallRange is range -10 .. 10; subtype bigSub is Integer; type bigDerived is new Integer; type bigRange is range -2**10 .. 2**10; end Sub_Derived_Types;
-- This spec has been automatically generated from STM32F7x9.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.LTDC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype SSCR_VSH_Field is HAL.UInt11; subtype SSCR_HSW_Field is HAL.UInt10; -- Synchronization Size Configuration Register type SSCR_Register is record -- Vertical Synchronization Height (in units of horizontal scan line) VSH : SSCR_VSH_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Horizontal Synchronization Width (in units of pixel clock period) HSW : SSCR_HSW_Field := 16#0#; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SSCR_Register use record VSH at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; HSW at 0 range 16 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype BPCR_AVBP_Field is HAL.UInt11; subtype BPCR_AHBP_Field is HAL.UInt10; -- Back Porch Configuration Register type BPCR_Register is record -- Accumulated Vertical back porch (in units of horizontal scan line) AVBP : BPCR_AVBP_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Accumulated Horizontal back porch (in units of pixel clock period) AHBP : BPCR_AHBP_Field := 16#0#; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BPCR_Register use record AVBP at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; AHBP at 0 range 16 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype AWCR_AAH_Field is HAL.UInt11; subtype AWCR_AAW_Field is HAL.UInt10; -- Active Width Configuration Register type AWCR_Register is record -- Accumulated Active Height (in units of horizontal scan line) AAH : AWCR_AAH_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Accumulated Active Width AAW : AWCR_AAW_Field := 16#0#; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AWCR_Register use record AAH at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; AAW at 0 range 16 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype TWCR_TOTALH_Field is HAL.UInt11; subtype TWCR_TOTALW_Field is HAL.UInt10; -- Total Width Configuration Register type TWCR_Register is record -- Total Height (in units of horizontal scan line) TOTALH : TWCR_TOTALH_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Total Width (in units of pixel clock period) TOTALW : TWCR_TOTALW_Field := 16#0#; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TWCR_Register use record TOTALH at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; TOTALW at 0 range 16 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype GCR_DBW_Field is HAL.UInt3; subtype GCR_DGW_Field is HAL.UInt3; subtype GCR_DRW_Field is HAL.UInt3; -- Global Control Register type GCR_Register is record -- LCD-TFT controller enable bit LTDCEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- Read-only. Dither Blue Width DBW : GCR_DBW_Field := 16#2#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Read-only. Dither Green Width DGW : GCR_DGW_Field := 16#2#; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; -- Read-only. Dither Red Width DRW : GCR_DRW_Field := 16#2#; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- Dither Enable DEN : Boolean := False; -- unspecified Reserved_17_27 : HAL.UInt11 := 16#0#; -- Pixel Clock Polarity PCPOL : Boolean := False; -- Data Enable Polarity DEPOL : Boolean := False; -- Vertical Synchronization Polarity VSPOL : Boolean := False; -- Horizontal Synchronization Polarity HSPOL : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for GCR_Register use record LTDCEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DBW at 0 range 4 .. 6; Reserved_7_7 at 0 range 7 .. 7; DGW at 0 range 8 .. 10; Reserved_11_11 at 0 range 11 .. 11; DRW at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; DEN at 0 range 16 .. 16; Reserved_17_27 at 0 range 17 .. 27; PCPOL at 0 range 28 .. 28; DEPOL at 0 range 29 .. 29; VSPOL at 0 range 30 .. 30; HSPOL at 0 range 31 .. 31; end record; -- Shadow Reload Configuration Register type SRCR_Register is record -- Immediate Reload IMR : Boolean := False; -- Vertical Blanking Reload VBR : Boolean := False; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SRCR_Register use record IMR at 0 range 0 .. 0; VBR at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; subtype BCCR_BC_Field is HAL.UInt24; -- Background Color Configuration Register type BCCR_Register is record -- Background Color Red value BC : BCCR_BC_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BCCR_Register use record BC at 0 range 0 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- Interrupt Enable Register type IER_Register is record -- Line Interrupt Enable LIE : Boolean := False; -- FIFO Underrun Interrupt Enable FUIE : Boolean := False; -- Transfer Error Interrupt Enable TERRIE : Boolean := False; -- Register Reload interrupt enable RRIE : Boolean := False; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER_Register use record LIE at 0 range 0 .. 0; FUIE at 0 range 1 .. 1; TERRIE at 0 range 2 .. 2; RRIE at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- Interrupt Status Register type ISR_Register is record -- Read-only. Line Interrupt flag LIF : Boolean; -- Read-only. FIFO Underrun Interrupt flag FUIF : Boolean; -- Read-only. Transfer Error interrupt flag TERRIF : Boolean; -- Read-only. Register Reload Interrupt Flag RRIF : Boolean; -- unspecified Reserved_4_31 : HAL.UInt28; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record LIF at 0 range 0 .. 0; FUIF at 0 range 1 .. 1; TERRIF at 0 range 2 .. 2; RRIF at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- Interrupt Clear Register type ICR_Register is record -- Write-only. Clears the Line Interrupt Flag CLIF : Boolean := False; -- Write-only. Clears the FIFO Underrun Interrupt flag CFUIF : Boolean := False; -- Write-only. Clears the Transfer Error Interrupt Flag CTERRIF : Boolean := False; -- Write-only. Clears Register Reload Interrupt Flag CRRIF : Boolean := False; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record CLIF at 0 range 0 .. 0; CFUIF at 0 range 1 .. 1; CTERRIF at 0 range 2 .. 2; CRRIF at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; subtype LIPCR_LIPOS_Field is HAL.UInt11; -- Line Interrupt Position Configuration Register type LIPCR_Register is record -- Line Interrupt Position LIPOS : LIPCR_LIPOS_Field := 16#0#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for LIPCR_Register use record LIPOS at 0 range 0 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype CPSR_CYPOS_Field is HAL.UInt16; subtype CPSR_CXPOS_Field is HAL.UInt16; -- Current Position Status Register type CPSR_Register is record -- Read-only. Current Y Position CYPOS : CPSR_CYPOS_Field; -- Read-only. Current X Position CXPOS : CPSR_CXPOS_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CPSR_Register use record CYPOS at 0 range 0 .. 15; CXPOS at 0 range 16 .. 31; end record; -- Current Display Status Register type CDSR_Register is record -- Read-only. Vertical Data Enable display Status VDES : Boolean; -- Read-only. Horizontal Data Enable display Status HDES : Boolean; -- Read-only. Vertical Synchronization display Status VSYNCS : Boolean; -- Read-only. Horizontal Synchronization display Status HSYNCS : Boolean; -- unspecified Reserved_4_31 : HAL.UInt28; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CDSR_Register use record VDES at 0 range 0 .. 0; HDES at 0 range 1 .. 1; VSYNCS at 0 range 2 .. 2; HSYNCS at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- Layerx Control Register type L1CR_Register is record -- Layer Enable LEN : Boolean := False; -- Color Keying Enable COLKEN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Color Look-Up Table Enable CLUTEN : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CR_Register use record LEN at 0 range 0 .. 0; COLKEN at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; CLUTEN at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; subtype L1WHPCR_WHSTPOS_Field is HAL.UInt12; subtype L1WHPCR_WHSPPOS_Field is HAL.UInt12; -- Layerx Window Horizontal Position Configuration Register type L1WHPCR_Register is record -- Window Horizontal Start Position WHSTPOS : L1WHPCR_WHSTPOS_Field := 16#0#; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; -- Window Horizontal Stop Position WHSPPOS : L1WHPCR_WHSPPOS_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1WHPCR_Register use record WHSTPOS at 0 range 0 .. 11; Reserved_12_15 at 0 range 12 .. 15; WHSPPOS at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype L1WVPCR_WVSTPOS_Field is HAL.UInt11; subtype L1WVPCR_WVSPPOS_Field is HAL.UInt11; -- Layerx Window Vertical Position Configuration Register type L1WVPCR_Register is record -- Window Vertical Start Position WVSTPOS : L1WVPCR_WVSTPOS_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Window Vertical Stop Position WVSPPOS : L1WVPCR_WVSPPOS_Field := 16#0#; -- unspecified Reserved_27_31 : HAL.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1WVPCR_Register use record WVSTPOS at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; WVSPPOS at 0 range 16 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; subtype L1CKCR_CKBLUE_Field is HAL.UInt8; subtype L1CKCR_CKGREEN_Field is HAL.UInt8; subtype L1CKCR_CKRED_Field is HAL.UInt8; -- Layerx Color Keying Configuration Register type L1CKCR_Register is record -- Color Key Blue value CKBLUE : L1CKCR_CKBLUE_Field := 16#0#; -- Color Key Green value CKGREEN : L1CKCR_CKGREEN_Field := 16#0#; -- Color Key Red value CKRED : L1CKCR_CKRED_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CKCR_Register use record CKBLUE at 0 range 0 .. 7; CKGREEN at 0 range 8 .. 15; CKRED at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype L1PFCR_PF_Field is HAL.UInt3; -- Layerx Pixel Format Configuration Register type L1PFCR_Register is record -- Pixel Format PF : L1PFCR_PF_Field := 16#0#; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1PFCR_Register use record PF at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype L1CACR_CONSTA_Field is HAL.UInt8; -- Layerx Constant Alpha Configuration Register type L1CACR_Register is record -- Constant Alpha CONSTA : L1CACR_CONSTA_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CACR_Register use record CONSTA at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype L1DCCR_DCBLUE_Field is HAL.UInt8; subtype L1DCCR_DCGREEN_Field is HAL.UInt8; subtype L1DCCR_DCRED_Field is HAL.UInt8; subtype L1DCCR_DCALPHA_Field is HAL.UInt8; -- Layerx Default Color Configuration Register type L1DCCR_Register is record -- Default Color Blue DCBLUE : L1DCCR_DCBLUE_Field := 16#0#; -- Default Color Green DCGREEN : L1DCCR_DCGREEN_Field := 16#0#; -- Default Color Red DCRED : L1DCCR_DCRED_Field := 16#0#; -- Default Color Alpha DCALPHA : L1DCCR_DCALPHA_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1DCCR_Register use record DCBLUE at 0 range 0 .. 7; DCGREEN at 0 range 8 .. 15; DCRED at 0 range 16 .. 23; DCALPHA at 0 range 24 .. 31; end record; subtype L1BFCR_BF2_Field is HAL.UInt3; subtype L1BFCR_BF1_Field is HAL.UInt3; -- Layerx Blending Factors Configuration Register type L1BFCR_Register is record -- Blending Factor 2 BF2 : L1BFCR_BF2_Field := 16#7#; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- Blending Factor 1 BF1 : L1BFCR_BF1_Field := 16#6#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1BFCR_Register use record BF2 at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; BF1 at 0 range 8 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype L1CFBLR_CFBLL_Field is HAL.UInt13; subtype L1CFBLR_CFBP_Field is HAL.UInt13; -- Layerx Color Frame Buffer Length Register type L1CFBLR_Register is record -- Color Frame Buffer Line Length CFBLL : L1CFBLR_CFBLL_Field := 16#0#; -- unspecified Reserved_13_15 : HAL.UInt3 := 16#0#; -- Color Frame Buffer Pitch in bytes CFBP : L1CFBLR_CFBP_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CFBLR_Register use record CFBLL at 0 range 0 .. 12; Reserved_13_15 at 0 range 13 .. 15; CFBP at 0 range 16 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype L1CFBLNR_CFBLNBR_Field is HAL.UInt11; -- Layerx ColorFrame Buffer Line Number Register type L1CFBLNR_Register is record -- Frame Buffer Line Number CFBLNBR : L1CFBLNR_CFBLNBR_Field := 16#0#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CFBLNR_Register use record CFBLNBR at 0 range 0 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype L1CLUTWR_BLUE_Field is HAL.UInt8; subtype L1CLUTWR_GREEN_Field is HAL.UInt8; subtype L1CLUTWR_RED_Field is HAL.UInt8; subtype L1CLUTWR_CLUTADD_Field is HAL.UInt8; -- Layerx CLUT Write Register type L1CLUTWR_Register is record -- Write-only. Blue value BLUE : L1CLUTWR_BLUE_Field := 16#0#; -- Write-only. Green value GREEN : L1CLUTWR_GREEN_Field := 16#0#; -- Write-only. Red value RED : L1CLUTWR_RED_Field := 16#0#; -- Write-only. CLUT Address CLUTADD : L1CLUTWR_CLUTADD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L1CLUTWR_Register use record BLUE at 0 range 0 .. 7; GREEN at 0 range 8 .. 15; RED at 0 range 16 .. 23; CLUTADD at 0 range 24 .. 31; end record; -- Layerx Control Register type L2CR_Register is record -- Layer Enable LEN : Boolean := False; -- Color Keying Enable COLKEN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Color Look-Up Table Enable CLUTEN : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CR_Register use record LEN at 0 range 0 .. 0; COLKEN at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; CLUTEN at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; subtype L2WHPCR_WHSTPOS_Field is HAL.UInt12; subtype L2WHPCR_WHSPPOS_Field is HAL.UInt12; -- Layerx Window Horizontal Position Configuration Register type L2WHPCR_Register is record -- Window Horizontal Start Position WHSTPOS : L2WHPCR_WHSTPOS_Field := 16#0#; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; -- Window Horizontal Stop Position WHSPPOS : L2WHPCR_WHSPPOS_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2WHPCR_Register use record WHSTPOS at 0 range 0 .. 11; Reserved_12_15 at 0 range 12 .. 15; WHSPPOS at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype L2WVPCR_WVSTPOS_Field is HAL.UInt11; subtype L2WVPCR_WVSPPOS_Field is HAL.UInt11; -- Layerx Window Vertical Position Configuration Register type L2WVPCR_Register is record -- Window Vertical Start Position WVSTPOS : L2WVPCR_WVSTPOS_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- Window Vertical Stop Position WVSPPOS : L2WVPCR_WVSPPOS_Field := 16#0#; -- unspecified Reserved_27_31 : HAL.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2WVPCR_Register use record WVSTPOS at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; WVSPPOS at 0 range 16 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; subtype L2CKCR_CKBLUE_Field is HAL.UInt8; subtype L2CKCR_CKGREEN_Field is HAL.UInt7; subtype L2CKCR_CKRED_Field is HAL.UInt9; -- Layerx Color Keying Configuration Register type L2CKCR_Register is record -- Color Key Blue value CKBLUE : L2CKCR_CKBLUE_Field := 16#0#; -- Color Key Green value CKGREEN : L2CKCR_CKGREEN_Field := 16#0#; -- Color Key Red value CKRED : L2CKCR_CKRED_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CKCR_Register use record CKBLUE at 0 range 0 .. 7; CKGREEN at 0 range 8 .. 14; CKRED at 0 range 15 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype L2PFCR_PF_Field is HAL.UInt3; -- Layerx Pixel Format Configuration Register type L2PFCR_Register is record -- Pixel Format PF : L2PFCR_PF_Field := 16#0#; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2PFCR_Register use record PF at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype L2CACR_CONSTA_Field is HAL.UInt8; -- Layerx Constant Alpha Configuration Register type L2CACR_Register is record -- Constant Alpha CONSTA : L2CACR_CONSTA_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CACR_Register use record CONSTA at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype L2DCCR_DCBLUE_Field is HAL.UInt8; subtype L2DCCR_DCGREEN_Field is HAL.UInt8; subtype L2DCCR_DCRED_Field is HAL.UInt8; subtype L2DCCR_DCALPHA_Field is HAL.UInt8; -- Layerx Default Color Configuration Register type L2DCCR_Register is record -- Default Color Blue DCBLUE : L2DCCR_DCBLUE_Field := 16#0#; -- Default Color Green DCGREEN : L2DCCR_DCGREEN_Field := 16#0#; -- Default Color Red DCRED : L2DCCR_DCRED_Field := 16#0#; -- Default Color Alpha DCALPHA : L2DCCR_DCALPHA_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2DCCR_Register use record DCBLUE at 0 range 0 .. 7; DCGREEN at 0 range 8 .. 15; DCRED at 0 range 16 .. 23; DCALPHA at 0 range 24 .. 31; end record; subtype L2BFCR_BF2_Field is HAL.UInt3; subtype L2BFCR_BF1_Field is HAL.UInt3; -- Layerx Blending Factors Configuration Register type L2BFCR_Register is record -- Blending Factor 2 BF2 : L2BFCR_BF2_Field := 16#7#; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- Blending Factor 1 BF1 : L2BFCR_BF1_Field := 16#6#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2BFCR_Register use record BF2 at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; BF1 at 0 range 8 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype L2CFBLR_CFBLL_Field is HAL.UInt13; subtype L2CFBLR_CFBP_Field is HAL.UInt13; -- Layerx Color Frame Buffer Length Register type L2CFBLR_Register is record -- Color Frame Buffer Line Length CFBLL : L2CFBLR_CFBLL_Field := 16#0#; -- unspecified Reserved_13_15 : HAL.UInt3 := 16#0#; -- Color Frame Buffer Pitch in bytes CFBP : L2CFBLR_CFBP_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CFBLR_Register use record CFBLL at 0 range 0 .. 12; Reserved_13_15 at 0 range 13 .. 15; CFBP at 0 range 16 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype L2CFBLNR_CFBLNBR_Field is HAL.UInt11; -- Layerx ColorFrame Buffer Line Number Register type L2CFBLNR_Register is record -- Frame Buffer Line Number CFBLNBR : L2CFBLNR_CFBLNBR_Field := 16#0#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CFBLNR_Register use record CFBLNBR at 0 range 0 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype L2CLUTWR_BLUE_Field is HAL.UInt8; subtype L2CLUTWR_GREEN_Field is HAL.UInt8; subtype L2CLUTWR_RED_Field is HAL.UInt8; subtype L2CLUTWR_CLUTADD_Field is HAL.UInt8; -- Layerx CLUT Write Register type L2CLUTWR_Register is record -- Write-only. Blue value BLUE : L2CLUTWR_BLUE_Field := 16#0#; -- Write-only. Green value GREEN : L2CLUTWR_GREEN_Field := 16#0#; -- Write-only. Red value RED : L2CLUTWR_RED_Field := 16#0#; -- Write-only. CLUT Address CLUTADD : L2CLUTWR_CLUTADD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for L2CLUTWR_Register use record BLUE at 0 range 0 .. 7; GREEN at 0 range 8 .. 15; RED at 0 range 16 .. 23; CLUTADD at 0 range 24 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- LCD-TFT Controller type LTDC_Peripheral is record -- Synchronization Size Configuration Register SSCR : aliased SSCR_Register; -- Back Porch Configuration Register BPCR : aliased BPCR_Register; -- Active Width Configuration Register AWCR : aliased AWCR_Register; -- Total Width Configuration Register TWCR : aliased TWCR_Register; -- Global Control Register GCR : aliased GCR_Register; -- Shadow Reload Configuration Register SRCR : aliased SRCR_Register; -- Background Color Configuration Register BCCR : aliased BCCR_Register; -- Interrupt Enable Register IER : aliased IER_Register; -- Interrupt Status Register ISR : aliased ISR_Register; -- Interrupt Clear Register ICR : aliased ICR_Register; -- Line Interrupt Position Configuration Register LIPCR : aliased LIPCR_Register; -- Current Position Status Register CPSR : aliased CPSR_Register; -- Current Display Status Register CDSR : aliased CDSR_Register; -- Layerx Control Register L1CR : aliased L1CR_Register; -- Layerx Window Horizontal Position Configuration Register L1WHPCR : aliased L1WHPCR_Register; -- Layerx Window Vertical Position Configuration Register L1WVPCR : aliased L1WVPCR_Register; -- Layerx Color Keying Configuration Register L1CKCR : aliased L1CKCR_Register; -- Layerx Pixel Format Configuration Register L1PFCR : aliased L1PFCR_Register; -- Layerx Constant Alpha Configuration Register L1CACR : aliased L1CACR_Register; -- Layerx Default Color Configuration Register L1DCCR : aliased L1DCCR_Register; -- Layerx Blending Factors Configuration Register L1BFCR : aliased L1BFCR_Register; -- Layerx Color Frame Buffer Address Register L1CFBAR : aliased HAL.UInt32; -- Layerx Color Frame Buffer Length Register L1CFBLR : aliased L1CFBLR_Register; -- Layerx ColorFrame Buffer Line Number Register L1CFBLNR : aliased L1CFBLNR_Register; -- Layerx CLUT Write Register L1CLUTWR : aliased L1CLUTWR_Register; -- Layerx Control Register L2CR : aliased L2CR_Register; -- Layerx Window Horizontal Position Configuration Register L2WHPCR : aliased L2WHPCR_Register; -- Layerx Window Vertical Position Configuration Register L2WVPCR : aliased L2WVPCR_Register; -- Layerx Color Keying Configuration Register L2CKCR : aliased L2CKCR_Register; -- Layerx Pixel Format Configuration Register L2PFCR : aliased L2PFCR_Register; -- Layerx Constant Alpha Configuration Register L2CACR : aliased L2CACR_Register; -- Layerx Default Color Configuration Register L2DCCR : aliased L2DCCR_Register; -- Layerx Blending Factors Configuration Register L2BFCR : aliased L2BFCR_Register; -- Layerx Color Frame Buffer Address Register L2CFBAR : aliased HAL.UInt32; -- Layerx Color Frame Buffer Length Register L2CFBLR : aliased L2CFBLR_Register; -- Layerx ColorFrame Buffer Line Number Register L2CFBLNR : aliased L2CFBLNR_Register; -- Layerx CLUT Write Register L2CLUTWR : aliased L2CLUTWR_Register; end record with Volatile; for LTDC_Peripheral use record SSCR at 16#8# range 0 .. 31; BPCR at 16#C# range 0 .. 31; AWCR at 16#10# range 0 .. 31; TWCR at 16#14# range 0 .. 31; GCR at 16#18# range 0 .. 31; SRCR at 16#24# range 0 .. 31; BCCR at 16#2C# range 0 .. 31; IER at 16#34# range 0 .. 31; ISR at 16#38# range 0 .. 31; ICR at 16#3C# range 0 .. 31; LIPCR at 16#40# range 0 .. 31; CPSR at 16#44# range 0 .. 31; CDSR at 16#48# range 0 .. 31; L1CR at 16#84# range 0 .. 31; L1WHPCR at 16#88# range 0 .. 31; L1WVPCR at 16#8C# range 0 .. 31; L1CKCR at 16#90# range 0 .. 31; L1PFCR at 16#94# range 0 .. 31; L1CACR at 16#98# range 0 .. 31; L1DCCR at 16#9C# range 0 .. 31; L1BFCR at 16#A0# range 0 .. 31; L1CFBAR at 16#AC# range 0 .. 31; L1CFBLR at 16#B0# range 0 .. 31; L1CFBLNR at 16#B4# range 0 .. 31; L1CLUTWR at 16#C4# range 0 .. 31; L2CR at 16#104# range 0 .. 31; L2WHPCR at 16#108# range 0 .. 31; L2WVPCR at 16#10C# range 0 .. 31; L2CKCR at 16#110# range 0 .. 31; L2PFCR at 16#114# range 0 .. 31; L2CACR at 16#118# range 0 .. 31; L2DCCR at 16#11C# range 0 .. 31; L2BFCR at 16#120# range 0 .. 31; L2CFBAR at 16#12C# range 0 .. 31; L2CFBLR at 16#130# range 0 .. 31; L2CFBLNR at 16#134# range 0 .. 31; L2CLUTWR at 16#144# range 0 .. 31; end record; -- LCD-TFT Controller LTDC_Periph : aliased LTDC_Peripheral with Import, Address => System'To_Address (16#40016800#); end STM32_SVD.LTDC;
with Ada.Text_IO; use Ada.Text_IO; with Buffer_Package; use Buffer_Package; with Termbox_Package; use Termbox_Package; package body Command_Package is function Command (E : in out Editor; V : in out View; F : Cmd_Flag_Type; Func : Cmd_Func_Type; A : Arg) return Boolean is Flags : Cmd_Flag_Type := F; B : Buffer := V.B; P : Pos := V.P; OL : Integer := P.L; Has_Line : Boolean := V.B.N /= 0; begin if (Flags = NEEDSBLOCK) and (V.BS = NONE or V.BE = NONE or not Has_Line) then E.Error := To_Unbounded_String ("No Blocks Marked"); return False; end if; if Flags = MARK then Mark_Func (V.B); end if; Func (E, V, A); Fix_Block (E.Doc_View); Fix_Cursor (E); if Flags = CLEARSBLOCK then Clear_Tag (V.B, BLOCK); V.BS := NONE; V.BE := NONE; end if; if not (Flags = SETSHILITE) then Clear_Tag (V.B, HIGHLIGHT); end if; if V.P.L /= OL then V.EX := False; end if; if not (Flags = NOLOCATOR) then V.GB := V.P; end if; return True; end Command; procedure Run_File (E : Editor; V : in out View; A : Arg) is Result : constant Boolean := Read_File (A.S1); pragma Unreferenced (E); pragma Unreferenced (V); begin if Result then Put ("Read Success"); else Put ("Read Failure"); end if; end Run_File; procedure Cmd_Insert_File (E : in out Editor; V : in out View; A : Arg) is Result : Boolean := Read_File (A.S1, V); begin if not Result then E.Error := "Could not open file: " & A.S1; end if; end Cmd_Insert_File; function Test_None (V : View) return Boolean is begin if V.BS = NONE or V.BE = NONE then return False; end if; return True; end Test_None; procedure Fix_Block (V : in out View) is begin Clear_Tag (V.B, BLOCK); declare TN : Boolean := Test_None (V); begin if TN then if V.BS > V.BE then declare L : Integer := V.BS; begin V.BS := V.BE; V.BE := L; end; end if; Set_Tag (V.B, BLOCK, (V.BS, 0), (V.BE, NONE), TB_REVERSE); end if; end; end Fix_Block; end Command_Package;
-- Copyright 2018-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Ver is type Wrapper is record A : Integer; end record; u00045 : constant Wrapper := (A => 16#060287af#); pragma Export (C, u00045, "symada__cS"); end Ver;
package Natools.Static_Maps.Web.Simple_Pages.Components is pragma Pure; function Hash (S : String) return Natural; end Natools.Static_Maps.Web.Simple_Pages.Components;
package Natools.S_Expressions.Printers.Pretty.Config.Commands.SC is pragma Preelaborate; function Hash (S : String) return Natural; end Natools.S_Expressions.Printers.Pretty.Config.Commands.SC;
with FLTK.Menu_Items; package FLTK.Widgets.Menus.Menu_Buttons is type Menu_Button is new Menu with private; type Menu_Button_Reference (Data : access Menu_Button'Class) is limited null record with Implicit_Dereference => Data; -- signifies which mouse buttons cause the menu to appear type Popup_Buttons is (No_Popup, Popup1, Popup2, Popup12, Popup3, Popup13, Popup23, Popup123); package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Menu_Button; end Forge; procedure Set_Popup_Kind (This : in out Menu_Button; Pop : in Popup_Buttons); function Popup (This : in out Menu_Button) return FLTK.Menu_Items.Menu_Item; procedure Draw (This : in out Menu_Button); function Handle (This : in out Menu_Button; Event : in Event_Kind) return Event_Outcome; private type Menu_Button is new Menu with null record; overriding procedure Finalize (This : in out Menu_Button); pragma Inline (Set_Popup_Kind); pragma Inline (Popup); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Menus.Menu_Buttons;
-- POK header -- -- The following file is a part of the POK project. Any modification should -- be made according to the POK licence. You CANNOT use this file or a part -- of a file for your own project. -- -- For more information on the POK licence, please see our LICENCE FILE -- -- Please follow the coding guidelines described in doc/CODING_GUIDELINES -- -- Copyright (c) 2007-2021 POK team pragma No_Run_Time; with Interfaces.C; with APEX; use APEX; with APEX.Processes; use APEX.Processes; with APEX.Partitions; use APEX.Partitions; with Activity; package Main is procedure Compute; procedure Main; pragma Export (C, Main, "main"); end Main;
------------------------------------------------------------------------------ -- 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) $ package body XML_IO.Internals is --------------- -- Get_Class -- --------------- function Get_Class (Char : in Unicode_Character) return Character_Class is begin case Char is when 9 | 10 | 13 | 32 => return ' '; when 33 => return '!'; when 34 => return '"'; when 35 => return '#'; when 36 .. 37 | 40 .. 44 | 64 | 92 | 94 | 96 | 123 .. 182 | 184 .. 191 | 215 | 247 | 306 .. 307 | 319 .. 320 | 329 | 383 | 452 .. 460 | 497 .. 499 | 502 .. 505 | 536 .. 591 | 681 .. 698 | 706 .. 719 | 722 .. 767 | 838 .. 863 | 866 .. 901 | 907 | 909 | 930 | 975 | 983 .. 985 | 987 | 989 | 991 | 993 | 1012 .. 1024 | 1037 | 1104 | 1117 | 1154 | 1159 .. 1167 | 1221 .. 1222 | 1225 .. 1226 | 1229 .. 1231 | 1260 .. 1261 | 1270 .. 1271 | 1274 .. 1328 | 1367 .. 1368 | 1370 .. 1376 | 1415 .. 1424 | 1442 | 1466 | 1470 | 1472 | 1475 | 1477 .. 1487 | 1515 .. 1519 | 1523 .. 1568 | 1595 .. 1599 | 1619 .. 1631 | 1642 .. 1647 | 1720 .. 1721 | 1727 | 1743 | 1748 | 1769 | 1774 .. 1775 | 1786 .. 2304 | 2308 | 2362 .. 2363 | 2382 .. 2384 | 2389 .. 2391 | 2404 .. 2405 | 2416 .. 2432 | 2436 | 2445 .. 2446 | 2449 .. 2450 | 2473 | 2481 | 2483 .. 2485 | 2490 .. 2491 | 2493 | 2501 .. 2502 | 2505 .. 2506 | 2510 .. 2518 | 2520 .. 2523 | 2526 | 2532 .. 2533 | 2546 .. 2561 | 2563 .. 2564 | 2571 .. 2574 | 2577 .. 2578 | 2601 | 2609 | 2612 | 2615 | 2618 .. 2619 | 2621 | 2627 .. 2630 | 2633 .. 2634 | 2638 .. 2648 | 2653 | 2655 .. 2661 | 2677 .. 2688 | 2692 | 2700 | 2702 | 2706 | 2729 | 2737 | 2740 | 2746 .. 2747 | 2758 | 2762 | 2766 .. 2783 | 2785 .. 2789 | 2800 .. 2816 | 2820 | 2829 .. 2830 | 2833 .. 2834 | 2857 | 2865 | 2868 .. 2869 | 2874 .. 2875 | 2884 .. 2886 | 2889 .. 2890 | 2894 .. 2901 | 2904 .. 2907 | 2910 | 2914 .. 2917 | 2928 .. 2945 | 2948 | 2955 .. 2957 | 2961 | 2966 .. 2968 | 2971 | 2973 | 2976 .. 2978 | 2981 .. 2983 | 2987 .. 2989 | 2998 | 3002 .. 3005 | 3011 .. 3013 | 3017 | 3022 .. 3030 | 3032 .. 3046 | 3056 .. 3072 | 3076 | 3085 | 3089 | 3113 | 3124 | 3130 .. 3133 | 3141 | 3145 | 3150 .. 3156 | 3159 .. 3167 | 3170 .. 3173 | 3184 .. 3201 | 3204 | 3213 | 3217 | 3241 | 3252 | 3258 .. 3261 | 3269 | 3273 | 3278 .. 3284 | 3287 .. 3293 | 3295 | 3298 .. 3301 | 3312 .. 3329 | 3332 | 3341 | 3345 | 3369 | 3386 .. 3389 | 3396 .. 3397 | 3401 | 3406 .. 3414 | 3416 .. 3423 | 3426 .. 3429 | 3440 .. 3584 | 3631 | 3643 .. 3647 | 3663 | 3674 .. 3712 | 3715 | 3717 .. 3718 | 3721 | 3723 .. 3724 | 3726 .. 3731 | 3736 | 3744 | 3748 | 3750 | 3752 .. 3753 | 3756 | 3759 | 3770 | 3774 .. 3775 | 3781 | 3783 | 3790 .. 3791 | 3802 .. 3863 | 3866 .. 3871 | 3882 .. 3892 | 3894 | 3896 | 3898 .. 3901 | 3912 | 3946 .. 3952 | 3973 | 3980 .. 3983 | 3990 | 3992 | 4014 .. 4016 | 4024 | 4026 .. 4255 | 4294 .. 4303 | 4343 .. 4351 | 4353 | 4356 | 4360 | 4362 | 4365 | 4371 .. 4411 | 4413 | 4415 | 4417 .. 4427 | 4429 | 4431 | 4433 .. 4435 | 4438 .. 4440 | 4442 .. 4446 | 4450 | 4452 | 4454 | 4456 | 4458 .. 4460 | 4463 .. 4465 | 4468 | 4470 .. 4509 | 4511 .. 4519 | 4521 .. 4522 | 4524 .. 4525 | 4528 .. 4534 | 4537 | 4539 | 4547 .. 4586 | 4588 .. 4591 | 4593 .. 4600 | 4602 .. 7679 | 7836 .. 7839 | 7930 .. 7935 | 7958 .. 7959 | 7966 .. 7967 | 8006 .. 8007 | 8014 .. 8015 | 8024 | 8026 | 8028 | 8030 | 8062 .. 8063 | 8117 | 8125 | 8127 .. 8129 | 8133 | 8141 .. 8143 | 8148 .. 8149 | 8156 .. 8159 | 8173 .. 8177 | 8181 | 8189 .. 8399 | 8413 .. 8416 | 8418 .. 8485 | 8487 .. 8489 | 8492 .. 8493 | 8495 .. 8575 | 8579 .. 12292 | 12294 | 12296 .. 12320 | 12336 | 12342 .. 12352 | 12437 .. 12440 | 12443 .. 12444 | 12447 .. 12448 | 12539 | 12543 .. 12548 | 12589 .. 19967 | 40870 .. 44031 | 55204 .. 55295 | 57344 .. 65533 | 65536 .. 1114111 => return '$'; when 38 => return '&'; when 39 => return '''; when 45 => return '-'; when 46 | 183 | 720 | 721 | 768 .. 837 | 864 .. 865 | 903 | 1155 .. 1158 | 1425 .. 1441 | 1443 .. 1465 | 1467 .. 1469 | 1471 | 1473 .. 1474 | 1476 | 1600 | 1611 .. 1618 | 1632 .. 1641 | 1648 | 1750 .. 1756 | 1757 .. 1759 | 1760 .. 1764 | 1767 .. 1768 | 1770 .. 1773 | 1776 .. 1785 | 2305 .. 2307 | 2364 | 2366 .. 2380 | 2381 | 2385 .. 2388 | 2402 .. 2403 | 2406 .. 2415 | 2433 .. 2435 | 2492 | 2494 | 2495 | 2496 .. 2500 | 2503 .. 2504 | 2507 .. 2509 | 2519 | 2530 .. 2531 | 2534 .. 2543 | 2562 | 2620 | 2622 | 2623 | 2624 .. 2626 | 2631 .. 2632 | 2635 .. 2637 | 2662 .. 2671 | 2672 .. 2673 | 2689 .. 2691 | 2748 | 2750 .. 2757 | 2759 .. 2761 | 2763 .. 2765 | 2790 .. 2799 | 2817 .. 2819 | 2876 | 2878 .. 2883 | 2887 .. 2888 | 2891 .. 2893 | 2902 .. 2903 | 2918 .. 2927 | 2946 .. 2947 | 3006 .. 3010 | 3014 .. 3016 | 3018 .. 3021 | 3031 | 3047 .. 3055 | 3073 .. 3075 | 3134 .. 3140 | 3142 .. 3144 | 3146 .. 3149 | 3157 .. 3158 | 3174 .. 3183 | 3202 .. 3203 | 3262 .. 3268 | 3270 .. 3272 | 3274 .. 3277 | 3285 .. 3286 | 3302 .. 3311 | 3330 .. 3331 | 3390 .. 3395 | 3398 .. 3400 | 3402 .. 3405 | 3415 | 3430 .. 3439 | 3633 | 3636 .. 3642 | 3654 | 3655 .. 3662 | 3664 .. 3673 | 3761 | 3764 .. 3769 | 3771 .. 3772 | 3782 | 3784 .. 3789 | 3792 .. 3801 | 3864 .. 3865 | 3872 .. 3881 | 3893 | 3895 | 3897 | 3902 | 3903 | 3953 .. 3972 | 3974 .. 3979 | 3984 .. 3989 | 3991 | 3993 .. 4013 | 4017 .. 4023 | 4025 | 8400 .. 8412 | 8417 | 12293 | 12330 .. 12335 | 12337 .. 12341 | 12441 | 12442 | 12445 .. 12446 | 12540 .. 12542 => return '.'; when 47 => return '/'; when 48 .. 57 => return '0'; when 59 => return ';'; when 60 => return '<'; when 61 => return '='; when 62 => return '>'; when 63 => return '?'; when 65 .. 70 | 97 .. 102 => return 'A'; when 58 | 71 .. 90 | 95 | 103 .. 119 | 192 .. 214 | 216 .. 246 | 248 .. 255 | 256 .. 305 | 308 .. 318 | 321 .. 328 | 330 .. 382 | 384 .. 451 | 461 .. 496 | 500 .. 501 | 506 .. 535 | 592 .. 680 | 699 .. 705 | 902 | 904 .. 906 | 908 | 910 .. 929 | 931 .. 974 | 976 .. 982 | 986 | 988 | 990 | 992 | 994 .. 1011 | 1025 .. 1036 | 1038 .. 1103 | 1105 .. 1116 | 1118 .. 1153 | 1168 .. 1220 | 1223 .. 1224 | 1227 .. 1228 | 1232 .. 1259 | 1262 .. 1269 | 1272 .. 1273 | 1329 .. 1366 | 1369 | 1377 .. 1414 | 1488 .. 1514 | 1520 .. 1522 | 1569 .. 1594 | 1601 .. 1610 | 1649 .. 1719 | 1722 .. 1726 | 1728 .. 1742 | 1744 .. 1747 | 1749 | 1765 .. 1766 | 2309 .. 2361 | 2365 | 2392 .. 2401 | 2437 .. 2444 | 2447 .. 2448 | 2451 .. 2472 | 2474 .. 2480 | 2482 | 2486 .. 2489 | 2524 .. 2525 | 2527 .. 2529 | 2544 .. 2545 | 2565 .. 2570 | 2575 .. 2576 | 2579 .. 2600 | 2602 .. 2608 | 2610 .. 2611 | 2613 .. 2614 | 2616 .. 2617 | 2649 .. 2652 | 2654 | 2674 .. 2676 | 2693 .. 2699 | 2701 | 2703 .. 2705 | 2707 .. 2728 | 2730 .. 2736 | 2738 .. 2739 | 2741 .. 2745 | 2749 | 2784 | 2821 .. 2828 | 2831 .. 2832 | 2835 .. 2856 | 2858 .. 2864 | 2866 .. 2867 | 2870 .. 2873 | 2877 | 2908 .. 2909 | 2911 .. 2913 | 2949 .. 2954 | 2958 .. 2960 | 2962 .. 2965 | 2969 .. 2970 | 2972 | 2974 .. 2975 | 2979 .. 2980 | 2984 .. 2986 | 2990 .. 2997 | 2999 .. 3001 | 3077 .. 3084 | 3086 .. 3088 | 3090 .. 3112 | 3114 .. 3123 | 3125 .. 3129 | 3168 .. 3169 | 3205 .. 3212 | 3214 .. 3216 | 3218 .. 3240 | 3242 .. 3251 | 3253 .. 3257 | 3294 | 3296 .. 3297 | 3333 .. 3340 | 3342 .. 3344 | 3346 .. 3368 | 3370 .. 3385 | 3424 .. 3425 | 3585 .. 3630 | 3632 | 3634 .. 3635 | 3648 .. 3653 | 3713 .. 3714 | 3716 | 3719 .. 3720 | 3722 | 3725 | 3732 .. 3735 | 3737 .. 3743 | 3745 .. 3747 | 3749 | 3751 | 3754 .. 3755 | 3757 .. 3758 | 3760 | 3762 .. 3763 | 3773 | 3776 .. 3780 | 3904 .. 3911 | 3913 .. 3945 | 4256 .. 4293 | 4304 .. 4342 | 4352 | 4354 .. 4355 | 4357 .. 4359 | 4361 | 4363 .. 4364 | 4366 .. 4370 | 4412 | 4414 | 4416 | 4428 | 4430 | 4432 | 4436 .. 4437 | 4441 | 4447 .. 4449 | 4451 | 4453 | 4455 | 4457 | 4461 .. 4462 | 4466 .. 4467 | 4469 | 4510 | 4520 | 4523 | 4526 .. 4527 | 4535 .. 4536 | 4538 | 4540 .. 4546 | 4587 | 4592 | 4601 | 7680 .. 7835 | 7840 .. 7929 | 7936 .. 7957 | 7960 .. 7965 | 7968 .. 8005 | 8008 .. 8013 | 8016 .. 8023 | 8025 | 8027 | 8029 | 8031 .. 8061 | 8064 .. 8116 | 8118 .. 8124 | 8126 | 8130 .. 8132 | 8134 .. 8140 | 8144 .. 8147 | 8150 .. 8155 | 8160 .. 8172 | 8178 .. 8180 | 8182 .. 8188 | 8486 | 8490 .. 8491 | 8494 | 8576 .. 8578 | 12295 | 12321 .. 12329 | 12353 .. 12436 | 12449 .. 12538 | 12549 .. 12588 | 19968 .. 40869 | 44032 .. 55203 => return 'X'; when 91 => return '['; when 93 => return ']'; when 120 => return 'x'; when 121 .. 122 => return 'z'; when others => return Bad_Character; end case; end Get_Class; -------------------- -- Implementation -- -------------------- package body Implementation is procedure Invalidate (Buffer : in XML_String; State : in out Reader_State'Class; From : in Positive; To : in Positive); procedure Invalidate (Value : in out Token_Value; Buffer : in XML_String; From : in Positive; To : in Positive); procedure Next_Class (Buffer : in out XML_String; Parser : in out Reader'Class; Result : out Character_Class); procedure Next_Token (Buffer : in out XML_String; Parser : in out Reader'Class); Xml_Literal : constant XML_Unbounded := To_XML_String ("xml"); Doctype_Literal : constant XML_Unbounded := To_XML_String ("DOCTYPE"); Cdata_Literal : constant XML_Unbounded := To_XML_String ("CDATA"); Version_Literal : constant XML_Unbounded := To_XML_String ("version"); Encoding_Literal : constant XML_Unbounded := To_XML_String ("encoding"); Standalone_Literal : constant XML_Unbounded := To_XML_String ("standalone"); Yes_Literal : constant XML_Unbounded := To_XML_String ("yes"); No_Literal : constant XML_Unbounded := To_XML_String ("no"); One_Dot_Zero_Literal : constant XML_Unbounded := To_XML_String ("1.0"); Lt_Literal : constant XML_Unbounded := To_XML_String ("&lt;"); Gt_Literal : constant XML_Unbounded := To_XML_String ("&gt;"); Amp_Literal : constant XML_Unbounded := To_XML_String ("&amp;"); Empty : constant Token_Value := (0, 0, To_Unbounded_String (Nil_Literal)); --------------------- -- Attribute_Count -- --------------------- function Attribute_Count (Parser : in Reader) return List_Count is begin return Parser.The.Piece.Count; end Attribute_Count; -------------------- -- Attribute_Name -- -------------------- function Attribute_Name (Parser : in Reader; Index : in List_Index) return Token_Value is begin if Index > Parser.The.Piece.Count then raise Constraint_Error; elsif Index <= Embeded_Attr then return Parser.The.Piece.Names (Index); else return Parser.The.Extra_Names (Index); end if; end Attribute_Name; --------------------- -- Attribute_Value -- --------------------- function Attribute_Value (Parser : in Reader; Index : in List_Index) return Token_Value is begin if Index > Parser.The.Piece.Count then raise Constraint_Error; elsif Index <= Embeded_Attr then return Parser.The.Piece.Values (Index); else return Parser.The.Extra_Values (Index); end if; end Attribute_Value; -------------- -- Encoding -- -------------- function Encoding (Parser : in Reader) return Token_Value is begin return Parser.The.Piece.Encoding; end Encoding; -------------- -- Encoding -- -------------- function Encoding (Parser : in Reader) return Encodings.Encoding is begin return Parser.The.Input.Encoding; end Encoding; ---------------- -- Initialize -- ---------------- procedure Initialize (Buffer : in out XML_String; Parser : in out Reader) is begin Parser.The.Input.Encoding := Encodings.UTF_8; Parser.The.Input.Index := Buffer'First; Parser.The.Input.Free := Buffer'First; Parser.The.Token.Prev := End_Of_Buffer; Parser.The.Token.X := 0; Parser.The.In_State := In_Misc; Parser.The.Deep := 0; Next (Buffer, Parser); end Initialize; ---------------- -- Invalidate -- ---------------- procedure Invalidate (Value : in out Token_Value; Buffer : in XML_String; From : in Positive; To : in Positive) is begin if Value.From in From .. To then if Value.To in From .. To then Value.Stored := Value.Stored & Buffer (Value.From .. Value.To); Value.From := 0; else Value.Stored := Value.Stored & Buffer (Value.From .. To); if To = Buffer'Last then Value.From := Buffer'First; else Value.From := To + 1; end if; end if; end if; end Invalidate; ---------------- -- Invalidate -- ---------------- procedure Invalidate (Buffer : in XML_String; State : in out Reader_State'Class; From : in Positive; To : in Positive) is procedure Invalidate (Value : in out Token_Value) is begin Invalidate (Value, Buffer, From, To); end Invalidate; begin Invalidate (State.Token.Value); Invalidate (State.Token.Amp); case State.Piece.Kind is when Start_Document => Invalidate (State.Piece.Encoding); when Start_Element | Entity_Reference | End_Element | Processing_Instruction | Attribute | Namespace => Invalidate (State.Piece.Name); case State.Piece.Kind is when Start_Element => for I in 1 .. State.Piece.Count loop if I <= Embeded_Attr then Invalidate (State.Piece.Names (I)); Invalidate (State.Piece.Values (I)); else Invalidate (State.Extra_Names (I)); Invalidate (State.Extra_Values (I)); end if; end loop; when Processing_Instruction => Invalidate (State.Piece.PI_Text); when Attribute | Namespace => Invalidate (State.Piece.Value); when others => null; end case; when Comment | Characters | CDATA_Section => Invalidate (State.Piece.Text); when DTD | End_Document => null; end case; end Invalidate; ----------------- -- More_Pieces -- ----------------- function More_Pieces (Parser : in Reader) return Boolean is begin return Parser.The.Piece.Kind /= End_Document; end More_Pieces; ---------- -- Name -- ---------- function Name (Parser : in Reader) return Token_Value is begin return Parser.The.Piece.Name; end Name; ---------- -- Next -- ---------- procedure Next (Buffer : in out XML_String; Parser : in out Reader) is use type XML_String; procedure Error is X : exception; begin raise X; end Error; procedure Check_Token (Next : Token) is begin if Parser.The.Token.Kind /= Next then Error; end if; end Check_Token; function Val return Xml_String is begin return Value (Buffer, Parser.The.Token.Value); end Val; function Token_Kind return Token is begin return Parser.The.Token.Kind; end Token_Kind; procedure Skip_Space is begin if Token_Kind = Space_Token then -- Allow_XML_Decl := False; Next_Token (Buffer, Parser); end if; end Skip_Space; procedure Do_Eq_Value is begin Next_Token (Buffer, Parser); Skip_Space; Check_Token (Eq_Token); Next_Token (Buffer, Parser); Skip_Space; if Token_Kind = Apostrophe_Token then Parser.The.In_State := In_Apostrophes; elsif Token_Kind = Quote_Token then Parser.The.In_State := In_Quotes; else Error; end if; Next_Token (Buffer, Parser); Check_Token (Value_Token); Parser.The.In_State := In_Element; end Do_Eq_Value; procedure Do_Pi is Prev_State : constant Internal_State := Parser.The.In_State; begin Parser.The.In_State := In_Element; Next_Token (Buffer, Parser); Check_Token (Name_Token); if Val = Xml_Literal then Parser.The.Piece := (Kind => Start_Document, Standalone => True, Encoding => Empty); Next_Token (Buffer, Parser); Skip_Space; Check_Token (Name_Token); if Val = Version_Literal then Do_Eq_Value; if Val = One_Dot_Zero_Literal then Next_Token (Buffer, Parser); Skip_Space; else Error; end if; else Error; end if; if Token_Kind = Name_Token and then Val = Encoding_Literal then Do_Eq_Value; Parser.The.Piece.Encoding := Parser.The.Token.Value; Parser.The.Input.Encoding := To_Encoding (Val); Next_Token (Buffer, Parser); Skip_Space; end if; if Token_Kind = Name_Token and then Val = Standalone_Literal then Do_Eq_Value; if Val = Yes_Literal then Parser.The.Piece.Standalone := True; elsif Val = No_Literal then Parser.The.Piece.Standalone := False; else Error; end if; Next_Token (Buffer, Parser); Skip_Space; end if; Check_Token (PI_End_Token); else Parser.The.Piece := (Kind => Processing_Instruction, Name => Parser.The.Token.Value, PI_Text => Empty); Next_Token (Buffer, Parser); Parser.The.In_State := In_PI; Skip_Space; case Token_Kind is when PI_End_Token => null; when PI_Text_Token => Parser.The.Piece.PI_Text := Parser.The.Token.Value; when others => Error; end case; end if; Parser.The.In_State := Prev_State; end Do_Pi; procedure Do_Comment is Prev_State : constant Internal_State := Parser.The.In_State; begin Parser.The.In_State := In_Comment; Next_Token (Buffer, Parser); Check_Token (Comment_Text_Token); Parser.The.Piece := (Kind => Comment, Text => Parser.The.Token.Value); Parser.The.In_State := Prev_State; end Do_Comment; procedure Do_Element is Count : List_Count := 0; begin Parser.The.In_State := In_Element; Next_Token (Buffer, Parser); Check_Token (Name_Token); Parser.The.Piece := (Kind => Start_Element, Name => Parser.The.Token.Value, Count => Count, Names => (others => Empty), Values => (others => Empty)); Next_Token (Buffer, Parser); Skip_Space; while Token_Kind = Name_Token loop Count := Count + 1; Parser.The.Piece.Count := Count; Parser.The.Piece.Names (Count) := Parser.The.Token.Value; Do_Eq_Value; Parser.The.Piece.Values (Count) := Parser.The.Token.Value; Next_Token (Buffer, Parser); Skip_Space; end loop; if Token_Kind = End_Token then Parser.The.Deep := Parser.The.Deep + 1; Parser.The.In_State := In_Content; elsif Token_Kind = Empty_End_Token then Parser.The.In_State := In_Empty_Element; else Error; end if; end Do_Element; procedure Do_Document_Def is begin Parser.The.In_State := In_Element; while Token_Kind /= End_Token loop Next_Token (Buffer, Parser); end loop; Parser.The.In_State := In_Misc; Parser.The.Piece := (Kind => DTD); end Do_Document_Def; procedure Do_Misc is begin Skip_Space; case Token_Kind is when PI_Token => Do_Pi; when Comment_Token => Do_Comment; when Start_Token => Do_Element; when Doctype_Token => Do_Document_Def; when End_Of_Buffer => Parser.The.Piece := (Kind => End_Document); when others => Error; end case; end Do_Misc; procedure Do_End_Element is begin Parser.The.In_State := In_Element; Next_Token (Buffer, Parser); Check_Token (Name_Token); Parser.The.Piece := (Kind => End_Element, Name => Parser.The.Token.Value); Next_Token (Buffer, Parser); Skip_Space; Check_Token (End_Token); if Parser.The.Deep = 0 then Parser.The.In_State := In_Misc; else Parser.The.In_State := In_Content; end if; end Do_End_Element; procedure Do_CData is begin Parser.The.In_State := In_Element; Next_Token (Buffer, Parser); Check_Token (Name_Token); if Val /= Cdata_Literal then Error; end if; Parser.The.In_State := In_CD_Start; Next_Token (Buffer, Parser); Check_Token (Square_Token); Parser.The.In_State := In_CD; Next_Token (Buffer, Parser); Check_Token (CData_Token); Parser.The.Piece := (CDATA_Section, Parser.The.Token.Value); Parser.The.In_State := In_Content; end Do_CData; procedure Do_Content is begin case Token_Kind is when PI_Token => Do_Pi; when Comment_Token => Do_Comment; when Start_Token => Do_Element; when End_Of_Buffer => Parser.The.Piece := (Kind => End_Document); when Char_Data_Token => Parser.The.Piece := (Characters, Parser.The.Token.Value); when Entity_Reference_Token => Parser.The.Piece := (Entity_Reference, Parser.The.Token.Value); when Char_Reference_Token => Parser.The.Piece := (Characters, Parser.The.Token.Value); when CD_Start_Token => Do_CData; when End_Element_Token => Do_End_Element; when others => Error; end case; end Do_Content; begin if Parser.The.In_State = In_Empty_Element then Parser.The.Piece := (Kind => End_Element, Name => Parser.The.Piece.Name); if Parser.The.Deep = 0 then Parser.The.In_State := In_Misc; else Parser.The.In_State := In_Content; end if; return; end if; Next_Token (Buffer, Parser); case Parser.The.In_State is when In_Misc => Do_Misc; when In_Content => Do_Content; when others => Error; end case; end Next; ---------------- -- Next_Class -- ---------------- procedure Next_Class (Buffer : in out XML_String; Parser : in out Reader'Class; Result : out Character_Class) is use type Unicode_Character; Index : Positive renames Parser.The.Input.Index; Free : Positive renames Parser.The.Input.Free; Char : Unicode_Character; begin loop if Index /= Free then Parser.The.Input.Prev := Index; Decode (Buffer, Index, Free, Encoding => Parser.The.Input.Encoding, Char => Char); else Char := Invalid_Character; end if; if Char /= Invalid_Character then Result := Get_Class (Char); return; end if; Read_Some_Data : declare Half : constant Positive := (Buffer'First + Buffer'Last) / 2; Next : Positive; begin if Free <= Half then if Free = 1 then Invalidate (Buffer, Parser.The, Free, Half); end if; Read (Parser, Buffer (Free .. Half), Next); else if Free = Half + 1 then Invalidate (Buffer, Parser.The, Free, Buffer'Last); end if; Read (Parser, Buffer (Free .. Buffer'Last), Next); end if; if Next < Free then Result := End_Of_Buffer; return; elsif Next = Buffer'Last then Free := Buffer'First; else Free := Next + 1; end if; end Read_Some_Data; end loop; end Next_Class; ---------------- -- Next_Token -- ---------------- procedure Next_Token (Buffer : in out XML_String; Parser : in out Reader'Class) is procedure Start_Token is begin Parser.The.Token.Value := Empty; Parser.The.Token.Value.From := Parser.The.Input.Prev; end Start_Token; procedure End_Token (Back : Integer) is begin -- Actualy Back is in XML_Characters not in Characters. FIXME if Parser.The.Input.Prev + Back < Buffer'First then Parser.The.Token.Value.To := Buffer'Last + Parser.The.Input.Prev + Back; else Parser.The.Token.Value.To := Parser.The.Input.Prev + Back; end if; end End_Token; procedure On_Reference is function Value return XML_Unbounded is Val : constant XML_String := Value (Buffer, Parser.The.Token.Value); begin if Val = Lt_Literal then return To_XML_String ("<"); elsif Val = Gt_Literal then return To_XML_String (">"); elsif Val = Amp_Literal then return To_XML_String ("&"); else return To_Unbounded_String (Val); end if; end Value; begin Invalidate (Parser.The.Token.Amp, Buffer, Buffer'First, Buffer'Last); Parser.The.Token.Value.Stored := Parser.The.Token.Amp.Stored & Value; Parser.The.Token.Value.From := Parser.The.Input.Index; Parser.The.Token.Value.To := 0; Parser.The.Token.Amp.From := 0; end On_Reference; Char : Character_Class; Data : Tokenizer_State renames Parser.The.Token; begin loop if Data.Prev = End_Of_Buffer then Next_Class (Buffer, Parser, Char); if Char = End_Of_Buffer then Data.Kind := End_Of_Buffer; return; end if; else Char := Data.Prev; Data.Prev := End_Of_Buffer; end if; case Parser.The.In_State is when In_Empty_Element => Data.Kind := Error; exit; when In_Misc => case Data.X is when 0 => case Char is when ' ' => Data.X := 1; when '<' => Data.X := 2; when others => Data.Kind := Error; exit; end case; when 1 => -- ' ' if Char /= ' ' then Data.Prev := Char; Data.Kind := Space_Token; exit; end if; when 2 => -- '<' case Char is when '?' => Data.Kind := PI_Token; exit; when '!' => Data.X := 3; when others => Data.Prev := Char; Data.Kind := Start_Token; exit; end case; when 3 => -- '<!' case Char is when '-' => Data.X := 4; when others => Data.Prev := Char; Data.Kind := Doctype_Token; exit; end case; when 4 => -- '<!-' if Char = '-' then Data.Kind := Comment_Token; exit; else Data.Kind := Error; exit; end if; when others => Data.Kind := Error; exit; end case; when In_Element => case Data.X is when 0 => case Char is when ' ' => Data.X := 1; when '=' => Data.Kind := Eq_Token; exit; when ''' => Data.Kind := Apostrophe_Token; exit; when '"' => Data.Kind := Quote_Token; exit; when '?' => Data.X := 2; when '/' => Data.X := 4; when '>' => Data.Kind := End_Token; exit; when 'A' | 'X' | 'x' | 'z' => Start_Token; Data.X := 3; when others => Data.Kind := Error; exit; end case; when 1 => -- ' ' if Char /= ' ' then Data.Prev := Char; Data.Kind := Space_Token; exit; end if; when 2 => -- '?' if Char = '>' then Data.Kind := PI_End_Token; exit; else Data.Kind := Error; exit; end if; when 3 => -- 'X' case Char is when 'A' | 'X' | 'x' | 'z' | '0' | '.' | '-' => null; when others => Data.Prev := Char; Data.Kind := Name_Token; End_Token (-1); exit; end case; when 4 => -- '/' if Char = '>' then Data.Kind := Empty_End_Token; exit; else Data.Kind := Error; exit; end if; when others => Data.Kind := Error; exit; end case; when In_PI => case Data.X is when 0 => Start_Token; case Char is when '?' => Data.X := 1; when others => Data.X := 2; end case; when 1 => -- '?' if Char = '>' then Data.Kind := PI_End_Token; End_Token (-2); exit; else Data.X := 2; end if; when 2 => -- ...[^?] if Char = '?' then Data.X := 3; end if; when 3 => -- ...? if Char = '>' then Data.Kind := PI_Text_Token; End_Token (-2); exit; else Data.X := 2; end if; when others => Data.Kind := Error; exit; end case; when In_Content => case Data.X is when 0 => case Char is when '<' => Data.X := 1; when '&' => Start_Token; Data.X := 4; when ']' => Data.X := 11; when others => Start_Token; Data.X := 10; end case; when 1 => -- '<' case Char is when '?' => Data.Kind := PI_Token; exit; when '/' => Data.Kind := End_Element_Token; exit; when '!' => Data.X := 2; when others => Data.Prev := Char; Data.Kind := Start_Token; exit; end case; when 2 => -- '<!' case Char is when '-' => Data.X := 3; when '[' => Data.Kind := CD_Start_Token; exit; when others => Data.Prev := Char; Data.Kind := Doctype_Token; exit; end case; when 3 => -- '<!-' if Char = '-' then Data.Kind := Comment_Token; exit; else Data.Kind := Error; exit; end if; when 4 => -- '&' case Char is when '#' => Data.X := 5; when 'A' | 'X' | 'x' | 'z' => Data.X := 9; Start_Token; when others => Data.Kind := Error; End_Token (0); exit; end case; when 5 => -- '&#' case Char is when '0' => Data.X := 6; when 'x' => Data.X := 7; when others => Data.Kind := Error; exit; end case; when 6 => -- '&#[0-9]+' case Char is when '0' => null; when ';' => Data.Kind := Char_Reference_Token; End_Token (0); exit; when others => Data.Kind := Error; End_Token (0); exit; end case; when 7 => -- '&#x' case Char is when '0' | 'A' => Data.X := 8; when others => Data.Kind := Error; exit; end case; when 8 => -- '&#[0-9A-Fa-f]+' case Char is when '0' | 'A' => null; when ';' => Data.Kind := Char_Reference_Token; End_Token (0); exit; when others => Data.Kind := Error; End_Token (0); exit; end case; when 9 => -- &X+ case Char is when 'A' | 'X' | 'x' | 'z' | '0' | '.' | '-' => null; when ';' => Data.Kind := Entity_Reference_Token; End_Token (-1); exit; when others => Data.Kind := Error; End_Token (0); exit; end case; when 10 => -- ^] case Char is when ']' => Data.X := 11; when '<' | '&' => Data.Prev := Char; Data.Kind := Char_Data_Token; End_Token (-1); exit; when others => null; end case; when 11 => -- .] case Char is when ']' => Data.X := 12; when '<' | '&' => Data.Prev := Char; Data.Kind := Char_Data_Token; End_Token (-1); exit; when others => Data.X := 10; end case; when 12 => -- .]] case Char is when ']' => null; when '<' | '&' => Data.Prev := Char; Data.Kind := Char_Data_Token; End_Token (-3); exit; when '>' => Data.Kind := Error; End_Token (0); exit; when others => Data.X := 10; end case; when others => Data.Kind := Error; exit; end case; when In_Comment => case Data.X is when 0 => Start_Token; case Char is when '-' => Data.X := 1; when others => Data.X := 3; end case; when 1 => -- - case Char is when '-' => Data.X := 2; when others => Data.X := 3; end case; when 2 => -- -- case Char is when '>' => Data.Kind := Comment_Text_Token; End_Token (-3); exit; when others => End_Token (0); Data.Kind := Error; exit; end case; when 3 => case Char is when '-'=> Data.X := 1; when others => null; end case; when others => Data.Kind := Error; exit; end case; when In_CD_Start => if Char = '[' then Data.Kind := Square_Token; exit; else Data.Kind := Error; exit; end if; when In_CD => case Data.X is when 0 => Start_Token; case Char is when ']' => Data.X := 1; when others => Data.X := 3; end case; when 1 => -- .] case Char is when ']' => Data.X := 2; when others => Data.X := 3; end case; when 2 => -- .]] case Char is when ']' => null; when '>' => Data.Kind := CData_Token; End_Token (-3); exit; when others => Data.X := 3; end case; when 3 => case Char is when ']' => Data.X := 1; when others => null; end case; when others => Data.Kind := Error; exit; end case; when In_Apostrophes | In_Quotes => case Data.X is when 0 => Start_Token; case Char is when '<' => Data.Kind := Error; End_Token (0); exit; when '&' => End_Token (-1); Parser.The.Token.Amp := Parser.The.Token.Value; Start_Token; Data.X := 4; when ''' => if Parser.The.In_State = In_Apostrophes then Data.Kind := Value_Token; End_Token (-1); exit; else Data.X := 1; end if; when '"' => if Parser.The.In_State = In_Quotes then Data.Kind := Value_Token; End_Token (-1); exit; else Data.X := 1; end if; when others => Data.X := 1; end case; when 1 => case Char is when '<' => Data.Kind := Error; End_Token (0); exit; when '&' => End_Token (-1); Parser.The.Token.Amp := Parser.The.Token.Value; Start_Token; Data.X := 4; when ''' => if Parser.The.In_State = In_Apostrophes then Data.Kind := Value_Token; End_Token (-1); exit; end if; when '"' => if Parser.The.In_State = In_Quotes then Data.Kind := Value_Token; End_Token (-1); exit; end if; when others => null; end case; when 4 => -- '&' case Char is when '#' => Data.X := 5; when 'A' | 'X' | 'x' | 'z' => Data.X := 9; when others => Data.Kind := Error; End_Token (0); exit; end case; when 5 => -- '&#' case Char is when '0' => Data.X := 6; when 'x' => Data.X := 7; when others => Data.Kind := Error; End_Token (0); exit; end case; when 6 => -- '&#[0-9]+' case Char is when '0' => null; when ';' => End_Token (0); On_Reference; Data.X := 1; when others => Data.Kind := Error; End_Token (0); exit; end case; when 7 => -- '&#x' case Char is when '0' | 'A' => Data.X := 8; when others => Data.Kind := Error; End_Token (0); exit; end case; when 8 => -- '&#[0-9A-Fa-f]+' case Char is when '0' | 'A' => null; when ';' => End_Token (0); On_Reference; Data.X := 1; when others => Data.Kind := Error; End_Token (0); exit; end case; when 9 => -- &X+ case Char is when 'A' | 'X' | 'x' | 'z' | '0' | '.' | '-' => null; when ';' => End_Token (0); On_Reference; Data.X := 1; when others => Data.Kind := Error; End_Token (0); exit; end case; when others => Data.Kind := Error; exit; end case; end case; end loop; Data.X := 0; end Next_Token; ---------------- -- Piece_Kind -- ---------------- function Piece_Kind (Parser : in Reader) return Piece_Kinds is begin return Parser.The.Piece.Kind; end Piece_Kind; ---------------- -- Standalone -- ---------------- function Standalone (Parser : in Reader) return Boolean is begin return Parser.The.Piece.Standalone; end Standalone; ---------- -- Text -- ---------- function Text (Parser : in Reader) return Token_Value is begin if Parser.The.Piece.Kind = Processing_Instruction then return Parser.The.Piece.PI_Text; else return Parser.The.Piece.Text; end if; end Text; ----------- -- Value -- ----------- function Value (Buffer : in XML_String; Data : in Token_Value) return XML_String is use type XML_String; begin if Data.From = 0 then return To_String (Data.Stored); elsif Nil_Literal /= Data.Stored then return To_String (Data.Stored & Buffer (Data.From .. Data.To)); elsif Data.From > Data.To then return Buffer (Data.From .. Buffer'Last) & Buffer (Buffer'First .. Data.To); else return Buffer (Data.From .. Data.To); end if; end Value; end Implementation; end XML_IO.Internals; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
with AdaM.Any, Ada.Containers.Vectors, Ada.Streams; package AdaM.program_Library is type Item is new Any.item with private; -- View -- type View is access all Item'Class; procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; -- Vector -- package Vectors is new ada.Containers.Vectors (Positive, View); subtype Vector is Vectors.Vector; -- Forge -- function new_Subprogram return program_Library.view; procedure free (Self : in out program_Library.view); procedure destruct (Self : in out program_Library.item); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; private type Item is new Any.item with record null; end record; end AdaM.program_Library;
package body Lto7_Pkg is procedure op1 (this : Root) is begin null; end; procedure op2 (this : DT) is begin null; end; end Lto7_Pkg;
----------------------------------------------------------------------- -- keystore-tests -- Tests for akt command -- Copyright (C) 2019, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Directories; with Ada.Streams.Stream_IO; with Ada.Environment_Variables; with GNAT.Regpat; with Util.Files; with Util.Strings; with Util.Test_Caller; with Util.Encoders.AES; with Util.Log.Loggers; with Util.Processes; with Util.Streams.Buffered; with Util.Streams.Pipes; with Util.Streams.Texts; with Util.Streams.Files; package body Keystore.Tests is use type Ada.Directories.File_Size; use type Ada.Streams.Stream_Element_Offset; use type Ada.Streams.Stream_Element_Array; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Tool"); TEST_CONFIG_PATH : constant String := "regtests/result/test-config.properties"; TEST_TOOL_PATH : constant String := "regtests/result/test-tool.akt"; TEST_TOOL2_PATH : constant String := "regtests/result/test-tool-2.akt"; TEST_TOOL3_PATH : constant String := "regtests/result/test-tool-3.akt"; DATA_TOOL3_PATH : constant String := "regtests/result/test-tool-3"; TEST_TOOL4_PATH : constant String := "regtests/result/test-tool-4.akt"; TEST_TOOL5_PATH : constant String := "regtests/result/test-tool-5.akt"; TEST_WALLET_KEY_PATH : constant String := "regtests/result/keys/wallet.keys"; TEST_CORRUPTED_1_PATH : constant String := "regtests/files/test-corrupted-1.akt"; TEST_CORRUPTED_2_PATH : constant String := "regtests/files/test-corrupted-2.akt"; TEST_WALLET_PATH : constant String := "regtests/files/test-wallet.akt"; TEST_SPLIT_PATH : constant String := "regtests/files/test-split.akt"; function Tool return String; function Compare (Path1 : in String; Path2 : in String) return Boolean; package Caller is new Util.Test_Caller (Test, "AKT.Tools"); generic Command : String; procedure Test_Help_Command (T : in out Test); procedure Test_Help_Command (T : in out Test) is begin T.Execute (Tool & " help " & Command, "akt-help-" & Command & ".txt"); end Test_Help_Command; procedure Test_Tool_Help_Create is new Test_Help_Command ("create"); procedure Test_Tool_Help_Edit is new Test_Help_Command ("edit"); procedure Test_Tool_Help_Get is new Test_Help_Command ("get"); procedure Test_Tool_Help_List is new Test_Help_Command ("list"); procedure Test_Tool_Help_Remove is new Test_Help_Command ("remove"); procedure Test_Tool_Help_Set is new Test_Help_Command ("set"); procedure Test_Tool_Help_Set_Password is new Test_Help_Command ("password-set"); procedure Test_Tool_Help_Add_Password is new Test_Help_Command ("password-add"); procedure Test_Tool_Help_Remove_Password is new Test_Help_Command ("password-remove"); procedure Test_Tool_Help_Store is new Test_Help_Command ("store"); procedure Test_Tool_Help_Extract is new Test_Help_Command ("extract"); procedure Test_Tool_Help_Config is new Test_Help_Command ("config"); procedure Test_Tool_Help_Info is new Test_Help_Command ("info"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test AKT.Commands.Help", Test_Tool_Help'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Create", Test_Tool_Create'Access); Caller.Add_Test (Suite, "Test AKT.Main", Test_Tool_Invalid'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Create (password-file)", Test_Tool_Create_Password_File'Access); if not Is_Windows then Caller.Add_Test (Suite, "Test AKT.Commands.Create (password-cmd)", Test_Tool_Create_Password_Command'Access); end if; Caller.Add_Test (Suite, "Test AKT.Commands.Create (Error)", Test_Tool_Create_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Remove", Test_Tool_Set_Remove'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Set+Remove", Test_Tool_Set_Remove_2'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Set", Test_Tool_Set_Big'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Get", Test_Tool_Get'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Create (help)", Test_Tool_Help_Create'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Edit (help)", Test_Tool_Help_Edit'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Get (help)", Test_Tool_Help_Get'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Set (help)", Test_Tool_Help_Set'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Remove (help)", Test_Tool_Help_Remove'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Info (help)", Test_Tool_Help_Info'Access); Caller.Add_Test (Suite, "Test AKT.Commands.List (help)", Test_Tool_Help_List'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Password.Add (help)", Test_Tool_Help_Add_Password'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Password.Set (help)", Test_Tool_Help_Set_Password'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Password.Remove (help)", Test_Tool_Help_Remove_Password'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Store (help)", Test_Tool_Help_Store'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Extract (help)", Test_Tool_Help_Extract'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Config (help)", Test_Tool_Help_Config'Access); if not Is_Windows then -- The test must be adapted for Windows. Caller.Add_Test (Suite, "Test AKT.Commands.Edit", Test_Tool_Edit'Access); end if; Caller.Add_Test (Suite, "Test AKT.Commands.Store+Extract", Test_Tool_Store_Extract'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Store+Extract (Dir tree)", Test_Tool_Store_Extract_Tree'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Store (Error)", Test_Tool_Store_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Get (error)", Test_Tool_Get_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Get (interactive password)", Test_Tool_Interactive_Password'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Password", Test_Tool_Password_Set'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Create (separate data)", Test_Tool_Separate_Data'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Config", Test_Tool_Set_Config'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Extract (Error)", Test_Tool_Extract_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Info", Test_Tool_Info'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Info (Error)", Test_Tool_Info_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Create (Wallet_Key)", Test_Tool_With_Wallet_Key_File'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Password (Slot limit)", Test_Tool_Password_Add_Limit'Access); Caller.Add_Test (Suite, "Test AKT.Commands.List (No file provided)", Test_Tool_List_Error'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Open (Corrupted)", Test_Tool_Corrupted_1'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Open (Corrupted data)", Test_Tool_Corrupted_2'Access); Caller.Add_Test (Suite, "Test AKT.Commands.Open (Missing Storage)", Test_Tool_Missing_Storage'Access); Caller.Add_Test (Suite, "Test AKT.Commands (-V)", Test_Tool_Version'Access); Caller.Add_Test (Suite, "Test AKT.Commands (Invalid file)", Test_Tool_Bad_File'Access); Caller.Add_Test (Suite, "Test AKT.Commands.List (Nested wallet)", Test_Tool_Nested_Wallet'Access); end Add_Tests; -- ------------------------------ -- Get the dynamo executable path. -- ------------------------------ function Tool return String is begin return "bin/akt"; 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; function Compare (Path1 : in String; Path2 : in String) return Boolean is In1 : Util.Streams.Files.File_Stream; In2 : Util.Streams.Files.File_Stream; Buf1 : Ada.Streams.Stream_Element_Array (1 .. 8192); Buf2 : Ada.Streams.Stream_Element_Array (1 .. 8192); Last1 : Ada.Streams.Stream_Element_Offset; Last2 : Ada.Streams.Stream_Element_Offset; begin In1.Open (Ada.Streams.Stream_IO.In_File, Path1); In2.Open (Ada.Streams.Stream_IO.In_File, Path2); loop In1.Read (Buf1, Last1); In2.Read (Buf2, Last2); if Last1 /= Last2 then return False; end if; exit when Last1 < Buf1'First; if Buf1 (Buf1'First .. Last1) /= Buf2 (Buf2'First .. Last2) then return False; end if; end loop; return True; exception when others => return False; end Compare; procedure Store_Extract (T : in out Test; Command : in String; Name : in String; Path : in String) is Output_Path : constant String := Util.Tests.Get_Test_Path ("regtests/result/" & Name); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " store " & Command & " -- " & Name, Path, "", Result); T.Execute (Tool & " extract " & Command & " -- " & Name, "", Output_Path, Result); T.Assert (Compare (Path, Output_Path), "store+extract invalid for " & Name); end Store_Extract; -- ------------------------------ -- Test the akt help command. -- ------------------------------ procedure Test_Tool_Help (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " help", Result); Util.Tests.Assert_Matches (T, ".*tool to store and protect your sensitive data", Result, "Invalid help"); end Test_Tool_Help; -- ------------------------------ -- Test the akt keystore creation. -- ------------------------------ procedure Test_Tool_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 & " create " & Path & " -p admin --counter-range 10:100", Result); Util.Tests.Assert_Equals (T, "", Result, "create command failed"); T.Assert (Ada.Directories.Exists (Path), "Keystore file does not exist"); -- List content => empty result T.Execute (Tool & " list " & Path & " -p admin", Result); Util.Tests.Assert_Equals (T, "", Result, "list command failed"); -- Set property T.Execute (Tool & " set " & Path & " -p admin testing my-testing-value", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); -- Get property T.Execute (Tool & " get " & Path & " -p admin testing", Result); Util.Tests.Assert_Matches (T, "^my-testing-value", Result, "get command failed"); -- List content => one entry T.Execute (Tool & " list " & Path & " -p admin", Result); Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed"); -- Open keystore with invalid password T.Execute (Tool & " list " & Path & " -p admin2", Result, 1); Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file", Result, "list command failed"); end Test_Tool_Create; -- ------------------------------ -- Test the akt keystore creation. -- ------------------------------ procedure Test_Tool_Create_Error (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin -- Wrong option --counter-range T.Execute (Tool & " create " & Path & " -p admin --counter-range bob", Result, 1); Util.Tests.Assert_Matches (T, "Invalid counter range: bob", Result, "Invalid message"); -- Wrong range T.Execute (Tool & " create " & Path & " -p admin --counter-range 100:1", Result, 1); Util.Tests.Assert_Matches (T, "The min counter is greater than max counter", Result, "Invalid message"); T.Execute (Tool & " create " & Path & " -p admin --counter-range 100000000000", Result, 1); Util.Tests.Assert_Matches (T, "Invalid counter range: 100000000000", Result, "Invalid message"); T.Execute (Tool & " create " & Path & " -p admin --counter-range -1000", Result, 1); Util.Tests.Assert_Matches (T, "Value is out of range", Result, "Invalid message"); end Test_Tool_Create_Error; -- ------------------------------ -- Test the akt keystore creation with password file. -- ------------------------------ procedure Test_Tool_Create_Password_File (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 -- file.key must have rw------- mode (600) -- regtests/files must have rwx------ (700) T.Execute (Tool & " create -k " & Path & " --passfile regtests/files/file.key " & "--counter-range 100:200", Result, 0); Util.Tests.Assert_Equals (T, "", Result, "create command failed"); T.Assert (Ada.Directories.Exists (Path), "Keystore file does not exist"); -- Set property T.Execute (Tool & " set -k " & Path & " --passfile regtests/files/file.key " & "testing my-testing-value", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); -- List content => one entry T.Execute (Tool & " list -k " & Path & " --passfile regtests/files/file.key", Result); Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed"); end Test_Tool_Create_Password_File; -- ------------------------------ -- Test the akt keystore creation with password file. -- ------------------------------ procedure Test_Tool_Create_Password_Command (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; T.Execute (Tool & " create -k " & Path & " --passcmd 'echo -n admin' " & "--counter-range 100:200", Result, 0); Util.Tests.Assert_Equals (T, "", Result, "create command failed"); T.Assert (Ada.Directories.Exists (Path), "Keystore file does not exist"); -- Set property T.Execute (Tool & " set -k " & Path & " --passcmd 'echo -n admin' " & "testing my-testing-value", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); -- List content => one entry T.Execute (Tool & " list -k " & Path & " --passcmd 'echo -n admin'", Result); Util.Tests.Assert_Matches (T, "^testing", Result, "list command failed"); -- Try using an invalid command T.Execute (Tool & " list -k " & Path & " --passcmd 'missing-command'", Result, 1); Util.Tests.Assert_Matches (T, "Invalid password to unlock the keystore file", Result, "no error reported"); -- Try using a command that produces an empty password T.Execute (Tool & " list -k " & Path & " --passcmd true", Result, 1); Util.Tests.Assert_Matches (T, "Invalid password to unlock the keystore file", Result, "no error reported"); end Test_Tool_Create_Password_Command; -- ------------------------------ -- Test the akt command adding and removing values. -- ------------------------------ procedure Test_Tool_Set_Remove (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin Test_Tool_Create (T); -- Set property T.Execute (Tool & " set -k " & Path & " -p admin " & "testing my-new-testing-value", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); -- Remove property T.Execute (Tool & " remove " & Path & " -p admin " & "testing", Result); Util.Tests.Assert_Equals (T, "", Result, "remove command failed"); T.Execute (Tool & " remove " & Path & " -p admin", Result, 1); end Test_Tool_Set_Remove; -- ------------------------------ -- Test the akt command adding and removing values. -- ------------------------------ procedure Test_Tool_Set_Remove_2 (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL2_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; Size : Ada.Directories.File_Size; begin if Ada.Directories.Exists (Path) then Ada.Directories.Delete_File (Path); end if; -- Create keystore T.Execute (Tool & " create -k " & Path & " -p admin --counter-range 10:100", Result); Util.Tests.Assert_Equals (T, "", Result, "create command failed"); T.Assert (Ada.Directories.Exists (Path), "Keystore file does not exist"); -- Set property with configure file (128K file or more). T.Execute (Tool & " store -k " & Path & " -p admin " & "configure", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); Size := Ada.Directories.Size (Path); T.Assert (Size > 100_000, "Keystore file looks too small"); -- Remove property. T.Execute (Tool & " remove -k " & Path & " -p admin " & "configure", Result); Util.Tests.Assert_Equals (T, "", Result, "remove command failed"); Size := Ada.Directories.Size (Path); T.Assert (Size < 13_000, "Keystore file was not truncated after removal of large content"); T.Execute (Tool & " remove -k " & Path & " -p admin", Result, 1); end Test_Tool_Set_Remove_2; -- ------------------------------ -- Test the akt command setting a big file. -- ------------------------------ procedure Test_Tool_Set_Big (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Path2 : constant String := Util.Tests.Get_Test_Path ("regtests/result/big-content.txt"); Result : Ada.Strings.Unbounded.Unbounded_String; begin Test_Tool_Create (T); -- Set property T.Execute (Tool & " store " & Path & " -p admin " & "LICENSE.txt", Result); Util.Tests.Assert_Equals (T, "", Result, "store <file> command failed"); -- Get the property T.Execute (Tool & " get -k " & Path & " -p admin LICENSE.txt", Result); Util.Files.Write_File (Path => Path2, Content => Result); Util.Tests.Assert_Equal_Files (T, "LICENSE.txt", Path2, "set/get big file failed"); end Test_Tool_Set_Big; -- ------------------------------ -- Test the akt get command. -- ------------------------------ procedure Test_Tool_Get (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/test-keystore.akt"); Output : constant String := Util.Tests.Get_Path ("regtests/result/test-get.txt"); Expect : constant String := Util.Tests.Get_Test_Path ("regtests/expect/test-stream.txt"); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " get -k " & Path & " -p mypassword -n list-1 list-2 list-3 list-4 LICENSE.txt ", "", Output, Result, 0); Util.Tests.Assert_Equals (T, "", Result, "get -n command failed"); Util.Tests.Assert_Equal_Files (T, Expect, Output, "akt get command returned invalid content"); end Test_Tool_Get; -- ------------------------------ -- Test the akt get command with errors. -- ------------------------------ procedure Test_Tool_Get_Error (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/test-keystore.akt"); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " get -k " & Path & " -p mypassword", Result, 1); T.Execute (Tool & " get -k " & Path & " -p mypassword missing-property", Result, 1); end Test_Tool_Get_Error; -- ------------------------------ -- Test the akt command with invalid parameters. -- ------------------------------ procedure Test_Tool_Invalid (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " unkown-cmd -k " & Path & " -p admin", Result, 1); Util.Tests.Assert_Matches (T, "^Unkown command 'unkown-cmd'", Result, "Wrong message when command was not found"); T.Execute (Tool & " create -k " & Path & " -p admin -q", Result, 1); Util.Tests.Assert_Matches (T, "^akt" & EXE & ": unrecognized option '-q'", Result, "Wrong message for invalid option"); -- Create keystore with a missing key file. T.Execute (Tool & " create -k " & Path & " --force --passfile regtests/missing.key", Result, 1); Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file", Result, "Wrong message when command was not found"); -- Create keystore with a key file that does not satisfy the security constraints. T.Execute (Tool & " create -k " & Path & " --passfile src/keystore.ads", Result, 1); Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file", Result, "Wrong message when command was not found"); T.Execute (Tool & " set -k " & Path & " -p admin", Result, 1); T.Execute (Tool & " set -k " & Path & " -p admin a b c", Result, 1); T.Execute (Tool & " set -k " & Path & " -p admin -f test", Result, 1); T.Execute (Tool & " set -k " & Path & " -p admin -f test c d", Result, 1); T.Execute (Tool & " set -k " & Path & " -p admin", Result, 1); T.Execute (Tool & " -k " & Path & " -p admin", Result, 1); T.Execute (Tool & " -vv get -k " & Path & " -p admin testing", Result, 0); T.Execute (Tool & " -v get -k " & Path & " -p admin testing", Result, 0); T.Execute (Tool & " get -k x" & Path & " -p admin testing", Result, 1); end Test_Tool_Invalid; -- ------------------------------ -- Test the akt edit command. -- ------------------------------ procedure Test_Tool_Edit (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " edit -k " & Path & " -p admin -e bad-command testing", Result, 1); T.Execute (Tool & " edit -k " & Path & " -p admin -e ./regtests/files/fake-editor edit", Result, 0); T.Execute (Tool & " get -k " & Path & " -p admin edit", Result, 0); Util.Tests.Assert_Matches (T, "fake editor .*VALUE.txt.*", Result, "Invalid value after edit"); -- Setup EDITOR environment variable. Ada.Environment_Variables.Set ("EDITOR", "./regtests/files/fake-editor"); T.Execute (Tool & " edit -k " & Path & " -p admin edit-env-test", Result, 0); T.Execute (Tool & " get -k " & Path & " -p admin edit-env-test", Result, 0); Util.Tests.Assert_Matches (T, "fake editor .*VALUE.txt.*", Result, "Invalid value after edit"); end Test_Tool_Edit; -- ------------------------------ -- Test the akt store and akt extract commands. -- ------------------------------ procedure Test_Tool_Store_Extract (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " create -k " & Path & " -p admin -c 1:10 --force", Result, 0); T.Execute (Tool & " store -k " & Path & " -p admin -- store-extract", "bin/akt" & EXE, "", Result, 0); T.Execute (Tool & " extract -k " & Path & " -p admin -- store-extract", "", "regtests/result/akt", Result, 0); -- Check extract command with invalid value T.Execute (Tool & " extract -k " & Path & " -p admin missing", Result, 1); Util.Tests.Assert_Matches (T, "^Value 'missing' not found", Result, "Invalid value for extract command"); -- Check extract command with missing parameter T.Execute (Tool & " extract -k " & Path & " -p admin", Result, 1); Util.Tests.Assert_Matches (T, "Missing file or directory to extract", Result, "Expecting usage print for extract command"); end Test_Tool_Store_Extract; -- ------------------------------ -- Test the akt store and akt extract commands. -- ------------------------------ procedure Test_Tool_Store_Extract_Tree (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " create " & Path & " -p admin -c 1:10 --force", Result, 0); T.Execute (Tool & " store " & Path & " -p admin obj bin", Result, 0); T.Execute (Tool & " extract " & Path & " -p admin -o regtests/result/extract bin", Result, 0); T.Assert (Compare ("bin/akt" & EXE, "regtests/result/extract/bin/akt" & EXE), "store+extract failed for bin/akt"); T.Assert (Compare ("bin/keystore_harness" & EXE, "regtests/result/extract/bin/keystore_harness" & EXE), "store+extract failed for bin/keystore_harness"); T.Execute (Tool & " extract " & Path & " -p admin -o regtests/result/extract-obj obj", Result, 0); T.Assert (Compare ("obj/akt.o", "regtests/result/extract-obj/obj/akt.o"), "store+extract failed for obj/akt.o"); T.Assert (Compare ("obj/akt-commands.o", "regtests/result/extract-obj/obj/akt-commands.o"), "store+extract failed for obj/akt-commands.o"); end Test_Tool_Store_Extract_Tree; -- ------------------------------ -- Test the akt store command with errors. -- ------------------------------ procedure Test_Tool_Store_Error (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " create " & Path & " -p admin -c 1:10 --force", Result, 0); T.Execute (Tool & " store " & Path & " -p admin --", Result, 1); T.Execute (Tool & " store " & Path & " -p admin this-file-does-not-exist", Result, 1); T.Execute (Tool & " store " & Path & " -p admin /dev/null", Result, 1); end Test_Tool_Store_Error; procedure Test_Tool_Extract_Error (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL4_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " create " & Path & " -p admin -c 1:10 --force", Result, 0); T.Execute (Tool & " extract " & Path & " -p admin missing-1", Result, 1); Util.Tests.Assert_Matches (T, "^Value 'missing-1' not found", Result, "Invalid value for extract command"); T.Execute (Tool & " extract " & Path & " -p admin -- missing-2", Result, 1); Util.Tests.Assert_Matches (T, "^Value 'missing-2' not found", Result, "Invalid value for extract command"); end Test_Tool_Extract_Error; -- ------------------------------ -- Test the akt password-set command. -- ------------------------------ procedure Test_Tool_Password_Set (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " password-set -k " & Path & " -p admin --new-password admin-second " & " --counter-range 10:100", Result, 0); Util.Tests.Assert_Equals (T, "", Result, "Bad output for password-set command"); -- Check using old password. T.Execute (Tool & " password-set -k " & Path & " -p admin --new-password admin-ko", Result, 1); Util.Tests.Assert_Matches (T, "^Invalid password to unlock the keystore file", Result, "password-set command failed"); -- Add new password T.Execute (Tool & " password-add -k " & Path & " -p admin-second --new-password admin " & " --counter-range 10:100", Result, 0); Util.Tests.Assert_Equals (T, "", Result, "Bad output for password-set command"); -- Remove added password T.Execute (Tool & " password-remove -k " & Path & " -p admin-second --slot 2", Result, 0); Util.Tests.Assert_Matches (T, "^The password was successfully removed.", Result, "Bad output for password-remove command"); end Test_Tool_Password_Set; -- ------------------------------ -- Test the akt password-add command reaching the limit. -- ------------------------------ procedure Test_Tool_Password_Add_Limit (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin for I in 1 .. 6 loop T.Execute (Tool & " password-add " & Path & " -p admin-second --new-password " & "admin-" & Util.Strings.Image (I) & " --counter-range 10:100", Result, 0); end loop; T.Execute (Tool & " password-add " & Path & " -p admin-second --new-password " & "admin-8 --counter-range 10:100", Result, 1); Util.Tests.Assert_Matches (T, "^There is no available key slot to add the password", Result, "Bad output for password-add command"); end Test_Tool_Password_Add_Limit; -- ------------------------------ -- Test the akt with an interactive password. -- ------------------------------ procedure Test_Tool_Interactive_Password (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL_PATH); P : aliased Util.Streams.Pipes.Pipe_Stream; Buffer : Util.Streams.Texts.Print_Stream; begin P.Open (Tool & " list -k " & Path, Util.Processes.WRITE); Buffer.Initialize (P'Unchecked_Access, 8192); Buffer.Write ("admin"); Buffer.Flush; P.Close; Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Failed to pass the password as interactive"); P.Open (Tool & " list -k " & Path, Util.Processes.WRITE); Buffer.Write ("invalid"); Buffer.Flush; P.Close; Util.Tests.Assert_Equals (T, 1, P.Get_Exit_Status, "Failed to pass the password as interactive"); end Test_Tool_Interactive_Password; -- ------------------------------ -- Test the akt with data blocks written in separate files. -- ------------------------------ procedure Test_Tool_Separate_Data (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH); Data : constant String := Util.Tests.Get_Test_Path (DATA_TOOL3_PATH); P : aliased Util.Streams.Pipes.Pipe_Stream; Buffer : Util.Streams.Texts.Print_Stream; begin if not Ada.Directories.Exists (Data) then Ada.Directories.Create_Path (Data); end if; P.Open (Tool & " create -k " & Path & " -d " & Data & " -c 10:20 --force", Util.Processes.WRITE); Buffer.Initialize (P'Unchecked_Access, 8192); Buffer.Write ("admin"); Buffer.Flush; P.Close; Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Failed to pass the password as interactive"); T.Store_Extract (" -k " & Path & " -d " & Data & " -p admin ", "data-makefile", "Makefile"); T.Store_Extract (" -k " & Path & " -d " & Data & " -p admin ", "data-configure", "configure"); T.Store_Extract (" -k " & Path & " -d " & Data & " -p admin ", "data-license.txt", "LICENSE.txt"); T.Store_Extract (" -k " & Path & " -d " & Data & " -p admin ", "data-bin-akt", "bin/akt" & EXE); end Test_Tool_Separate_Data; -- ------------------------------ -- Test the akt config command. -- ------------------------------ procedure Test_Tool_Set_Config (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_CONFIG_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin if Ada.Directories.Exists (Path) then Ada.Directories.Delete_File (Path); end if; T.Execute (Tool & " --config " & Path & " config fill-zero no", Result, 0); Util.Tests.Assert_Equals (T, "", Result, "Bad output for config command"); T.Assert (Ada.Directories.Exists (Path), "Config file '" & Path & "' does not exist after test"); end Test_Tool_Set_Config; -- ------------------------------ -- Test the akt info command on several keystore files. -- ------------------------------ procedure Test_Tool_Info (T : in out Test) is function Extract_UUID (Content : in String) return String; Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL3_PATH); Dir : constant String := Util.Tests.Get_Test_Path (DATA_TOOL3_PATH); function Extract_UUID (Content : in String) return String is REGEX : constant String := ".*UUID +([0-9A-F-]*).*"; Pattern : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (REGEX); Matches : GNAT.Regpat.Match_Array (0 .. 1); begin T.Assert (GNAT.Regpat.Match (Pattern, Content), "akt info output does not match UUID pattern"); GNAT.Regpat.Match (Pattern, Content, Matches); return Content (Matches (1).First .. Matches (1).Last); end Extract_UUID; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " info " & Path & " -p admin", Result, 0); declare Id : constant String := Extract_UUID (Ada.Strings.Unbounded.To_String (Result)); begin T.Execute (Tool & " info " & Dir & "/" & Id & "-1.dkt -p admin", Result, 0); end; end Test_Tool_Info; procedure Test_Tool_Info_Error (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " info Makefile", Result, 1); T.Execute (Tool & " info some-missing-file", Result, 1); end Test_Tool_Info_Error; procedure Test_Tool_List_Error (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " list -p admin", Result, 1); Util.Tests.Assert_Matches (T, "^Missing the keystore file name", Result, "Bad output for list command"); end Test_Tool_List_Error; -- ------------------------------ -- Test the akt commands with --wallet-key-file -- ------------------------------ procedure Test_Tool_With_Wallet_Key_File (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_TOOL5_PATH); Keys : constant String := Util.Tests.Get_Test_Path (TEST_WALLET_KEY_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 & " create " & Path & " --wallet-key-file " & Keys & " -p admin --counter-range 10:100", Result); Util.Tests.Assert_Equals (T, "", Result, "create command failed"); T.Assert (Ada.Directories.Exists (Path), "Keystore file does not exist"); -- List content => empty result T.Execute (Tool & " list " & Path & " --wallet-key-file " & Keys & " -p admin", Result); Util.Tests.Assert_Equals (T, "", Result, "list command failed"); -- Set property T.Execute (Tool & " set " & Path & " --wallet-key-file " & Keys & " -p admin testing my-testing-value", Result); Util.Tests.Assert_Equals (T, "", Result, "set command failed"); -- Even with good password, unlocking should fail because of missing wallet-key-file. T.Execute (Tool & " list " & Path & " -p admin testing my-testing-value", Result, 1); Util.Tests.Assert_Matches (T, "Invalid password to unlock the keystore file", Result, "list command failed"); end Test_Tool_With_Wallet_Key_File; procedure Test_Tool_Corrupted_1 (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_CORRUPTED_1_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " list " & Path & " -p mypassword", Result, 1); Util.Tests.Assert_Matches (T, "The keystore file is corrupted: invalid meta data content", Result, "list command failed"); end Test_Tool_Corrupted_1; procedure Test_Tool_Corrupted_2 (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_CORRUPTED_2_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin -- This keystore file was corrupted while implementing the Write procedure. -- The data HMAC is invalid but every block is correctly signed and encrypted. T.Execute (Tool & " get " & Path & " -p mypassword Update_Stream", Result, 1); Util.Tests.Assert_Matches (T, "The keystore file is corrupted: invalid meta data content", Result, "list command failed"); end Test_Tool_Corrupted_2; procedure Test_Tool_Missing_Storage (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_SPLIT_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " list " & Path & " -p admin", Result, 1); Util.Tests.Assert_Matches (T, "The keystore file is corrupted: invalid or missing storage file", Result, "list command failed"); end Test_Tool_Missing_Storage; procedure Test_Tool_Version (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -V", Result, 0); Util.Tests.Assert_Matches (T, "Ada Keystore Tool 1.[0-9].[0-9]", Result, "akt -V option"); end Test_Tool_Version; procedure Test_Tool_Bad_File (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " list Makefile", Result, 1); Util.Tests.Assert_Matches (T, "The file is not a keystore", Result, "akt on an invalid file"); end Test_Tool_Bad_File; procedure Test_Tool_Nested_Wallet (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path (TEST_WALLET_PATH); Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " list " & Path & " -p mypassword", Result, 0); Util.Tests.Assert_Matches (T, "^property.*5.*", Result, "list command failed"); Util.Tests.Assert_Matches (T, "wallet.*0 .*", Result, "list command failed"); T.Execute (Tool & " get " & Path & " -p mypassword wallet", Result, 1); Util.Tests.Assert_Matches (T, "No content for an item of type wallet", Result, "get command on wallet"); end Test_Tool_Nested_Wallet; end Keystore.Tests;
----------------------------------------------------------------------- -- gen-testsuite -- Testsuite for gen -- Copyright (C) 2012, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Ada.Strings.Unbounded; with Gen.Artifacts.XMI.Tests; with Gen.Artifacts.Yaml.Tests; with Gen.Integration.Tests; package body Gen.Testsuite is Tests : aliased Util.Tests.Test_Suite; Dir : Ada.Strings.Unbounded.Unbounded_String; function Suite return Util.Tests.Access_Test_Suite is Result : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Gen.Artifacts.XMI.Tests.Add_Tests (Result); Gen.Artifacts.Yaml.Tests.Add_Tests (Result); Gen.Integration.Tests.Add_Tests (Result); return Result; end Suite; -- ------------------------------ -- Get the test root directory. -- ------------------------------ function Get_Test_Directory return String is begin return Ada.Strings.Unbounded.To_String (Dir); end Get_Test_Directory; procedure Initialize (Props : in Util.Properties.Manager) is pragma Unreferenced (Props); begin Dir := Ada.Strings.Unbounded.To_Unbounded_String (Ada.Directories.Current_Directory); end Initialize; end Gen.Testsuite;
with Ada.Text_Io, Ada.Integer_Text_Io; use Ada.Text_Io, Ada.Integer_Text_Io; with datos; use datos; procedure escribir_lista (L : in Lista_Enteros ) is --Pre: --Post: se han escrito en pantalla los valores de L -- desde 1 hasta L.Cont begin for pos in 1 .. L.Cont loop Put(L.Numeros(pos), width => 3); end loop; new_line; end escribir_lista;
package Dsp is subtype Normalized_Frequency is Float range 0.0 .. 1.0; subtype Radius is Float range 0.0 .. Float'Last; subtype Stable_Radius is Radius range 0.0 .. 1.0; end Dsp;
-- [ dg-do compile } package body Pack13 is procedure Set (Myself : Object_Ptr; The_Data : Thirty_Two_Bits.Object) is begin Myself.Something.Data_1 := The_Data; end; end Pack13;
-- -- Copyright (C) 2017 Nico Huber <nico.h@gmx.de> -- -- 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 2 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. -- with Interfaces.C; with Interfaces.C.Strings; with Ada.Directories; with HW.Debug; use Interfaces.C; use Interfaces.C.Strings; package body HW.File is READ : constant := 16#01#; WRITE : constant := 16#02#; function c_map (addr : out Word64; path : chars_ptr; len : Word32; off : Word32; mode : Word32; copy : int) return int; pragma Import (C, c_map, "hw_file_map"); procedure Map (Addr : out Word64; Path : in String; Len : in Natural := 0; Offset : in Natural := 0; Readable : in Boolean := False; Writable : in Boolean := False; Map_Copy : in Boolean := False; Success : out Boolean) is use type HW.Word32; cpath : chars_ptr := New_String (Path); ret : constant int := c_map (addr => Addr, path => cpath, len => Word32 (Len), off => Word32 (Offset), mode => (if Readable then READ else 0) or (if Writable then WRITE else 0), copy => (if Map_Copy then 1 else 0)); begin pragma Warnings(GNAT, Off, """cpath"" modified*, but* referenced", Reason => "Free() demands to set it to null_ptr"); Free (cpath); pragma Warnings(GNAT, On, """cpath"" modified*, but* referenced"); Success := ret = 0; pragma Debug (not Success, Debug.Put ("Mapping failed: ")); pragma Debug (not Success, Debug.Put_Int32 (Int32 (ret))); pragma Debug (not Success, Debug.New_Line); end Map; procedure Size (Length : out Natural; Path : String) with SPARK_Mode => Off is use type Ada.Directories.File_Size; Res_Size : Ada.Directories.File_Size; begin Res_Size := Ada.Directories.Size (Path); Length := Natural (Res_Size); exception when others => Length := 0; end Size; end HW.File;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Definitions; with Program.Lexical_Elements; with Program.Elements.Subtype_Indications; with Program.Elements.Expressions; package Program.Elements.Private_Extension_Definitions is pragma Pure (Program.Elements.Private_Extension_Definitions); type Private_Extension_Definition is limited interface and Program.Elements.Definitions.Definition; type Private_Extension_Definition_Access is access all Private_Extension_Definition'Class with Storage_Size => 0; not overriding function Ancestor (Self : Private_Extension_Definition) return not null Program.Elements.Subtype_Indications .Subtype_Indication_Access is abstract; not overriding function Progenitors (Self : Private_Extension_Definition) return Program.Elements.Expressions.Expression_Vector_Access is abstract; not overriding function Has_Abstract (Self : Private_Extension_Definition) return Boolean is abstract; not overriding function Has_Limited (Self : Private_Extension_Definition) return Boolean is abstract; not overriding function Has_Synchronized (Self : Private_Extension_Definition) return Boolean is abstract; type Private_Extension_Definition_Text is limited interface; type Private_Extension_Definition_Text_Access is access all Private_Extension_Definition_Text'Class with Storage_Size => 0; not overriding function To_Private_Extension_Definition_Text (Self : in out Private_Extension_Definition) return Private_Extension_Definition_Text_Access is abstract; not overriding function Abstract_Token (Self : Private_Extension_Definition_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Limited_Token (Self : Private_Extension_Definition_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Synchronized_Token (Self : Private_Extension_Definition_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function New_Token (Self : Private_Extension_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function And_Token (Self : Private_Extension_Definition_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function With_Token (Self : Private_Extension_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Private_Token (Self : Private_Extension_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Private_Extension_Definitions;
with Ada.Strings; with Interfaces.C; with System; package dl_loader is pragma Assertion_Policy (Pre => Check, Post => Check, Type_Invariant => Check); type Handle is limited private; function Open(path: in String; h: in out Handle) return Boolean; function Is_Valid(h: in Handle) return Boolean; function Get_Symbol(h: in Handle; name: in String) return System.Address; procedure Close(h: in out Handle) with Post => Is_Valid(h) = False; private type Handle is limited record h: System.Address := System.Null_Address; end record; end dl_loader;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Check_Positive is N : Integer; begin Put_Line ("Enter an integer value: "); Get (N); if N > 0 then Put_Line (N); Put_Line (" is a positive number"); end if; end Check_Positive;
with Ada.Text_IO; with GNAT.OS_Lib; package body GPR_Tools.Gprslaves.Configuration is HOME : GNAT.OS_Lib.String_Access := GNAT.OS_Lib.Getenv ("HOME"); Config_File_Path : constant String := Ada.Directories.Compose (HOME.all, Config_File_Name); --------------- -- Trace_Log -- --------------- procedure Trace_Log (Level : Verbose_Level; Message : VString) is begin Trace_Log (Level => Level, Message => S (Message)); end Trace_Log; --------------- -- Trace_Log -- --------------- procedure Trace_Log (Level : Verbose_Level; Message : String) is begin if Level > Verbosity then Ada.Text_IO.Put_Line (Message); end if; end Trace_Log; procedure Read (F : String) is begin if Exists (Config_File_Name) then Read (Config_File_Name); elsif Exists (Config_File_Path) then Read (Config_File_Path); end if; end GPR_Tools.Gprslaves.Configuration;
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- Continuous test for ZLib multithreading. If the test would fail -- we should provide thread safe allocation routines for the Z_Stream. -- -- $Id: mtest.adb,val 1.4 2004/07/23 07:49:54 vagul Exp $ with ZLib; with Ada.Streams; with Ada.Numerics.Discrete_Random; with Ada.Text_IO; with Ada.Exceptions; with Ada.Task_Identification; procedure MTest is use Ada.Streams; use ZLib; Stop : Boolean := False; pragma Atomic (Stop); subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; package Random_Elements is new Ada.Numerics.Discrete_Random (Visible_Symbols); task type Test_Task; task body Test_Task is Buffer : Stream_Element_Array (1 .. 100_000); Gen : Random_Elements.Generator; Buffer_First : Stream_Element_Offset; Compare_First : Stream_Element_Offset; Deflate : Filter_Type; Inflate : Filter_Type; procedure Further (Item : in Stream_Element_Array); procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); ------------- -- Further -- ------------- procedure Further (Item : in Stream_Element_Array) is procedure Compare (Item : in Stream_Element_Array); ------------- -- Compare -- ------------- procedure Compare (Item : in Stream_Element_Array) is Next_First : Stream_Element_Offset := Compare_First + Item'Length; begin if Buffer (Compare_First .. Next_First - 1) /= Item then raise Program_Error; end if; Compare_First := Next_First; end Compare; procedure Compare_Write is new ZLib.Write (Write => Compare); begin Compare_Write (Inflate, Item, No_Flush); end Further; ----------------- -- Read_Buffer -- ----------------- procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; Next_First : Stream_Element_Offset; begin if Item'Length <= Buff_Diff then Last := Item'Last; Next_First := Buffer_First + Item'Length; Item := Buffer (Buffer_First .. Next_First - 1); Buffer_First := Next_First; else Last := Item'First + Buff_Diff; Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); Buffer_First := Buffer'Last + 1; end if; end Read_Buffer; procedure Translate is new Generic_Translate (Data_In => Read_Buffer, Data_Out => Further); begin Random_Elements.Reset (Gen); Buffer := (others => 20); Main : loop for J in Buffer'Range loop Buffer (J) := Random_Elements.Random (Gen); Deflate_Init (Deflate); Inflate_Init (Inflate); Buffer_First := Buffer'First; Compare_First := Buffer'First; Translate (Deflate); if Compare_First /= Buffer'Last + 1 then raise Program_Error; end if; Ada.Text_IO.Put_Line (Ada.Task_Identification.Image (Ada.Task_Identification.Current_Task) & Stream_Element_Offset'Image (J) & ZLib.Count'Image (Total_Out (Deflate))); Close (Deflate); Close (Inflate); exit Main when Stop; end loop; end loop Main; exception when E : others => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); Stop := True; end Test_Task; Test : array (1 .. 4) of Test_Task; pragma Unreferenced (Test); Dummy : Character; begin Ada.Text_IO.Get_Immediate (Dummy); Stop := True; end MTest;
package GESTE_Fonts.FreeSansBoldOblique8pt7b is Font : constant Bitmap_Font_Ref; private FreeSansBoldOblique8pt7bBitmaps : aliased constant Font_Bitmap := ( 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#19#, 16#80#, 16#19#, 16#80#, 16#19#, 16#80#, 16#11#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#C0#, 16#0C#, 16#80#, 16#3F#, 16#C0#, 16#3F#, 16#C0#, 16#19#, 16#00#, 16#13#, 16#00#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#26#, 16#00#, 16#6C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#0F#, 16#80#, 16#1A#, 16#C0#, 16#32#, 16#C0#, 16#36#, 16#00#, 16#3C#, 16#00#, 16#1F#, 16#00#, 16#07#, 16#80#, 16#05#, 16#80#, 16#6D#, 16#80#, 16#7B#, 16#00#, 16#3E#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#08#, 16#1F#, 16#10#, 16#33#, 16#30#, 16#33#, 16#20#, 16#33#, 16#40#, 16#3E#, 16#80#, 16#1D#, 16#80#, 16#01#, 16#3C#, 16#02#, 16#7C#, 16#04#, 16#C4#, 16#0C#, 16#7C#, 16#08#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#07#, 16#C0#, 16#0C#, 16#C0#, 16#0C#, 16#C0#, 16#0F#, 16#80#, 16#0E#, 16#00#, 16#1F#, 16#60#, 16#33#, 16#E0#, 16#71#, 16#C0#, 16#73#, 16#C0#, 16#3F#, 16#C0#, 16#1E#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#20#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#08#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#08#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#04#, 16#00#, 16#17#, 16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#, 16#14#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#3F#, 16#80#, 16#7F#, 16#80#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#04#, 16#00#, 16#04#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#40#, 16#00#, 16#40#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#0F#, 16#80#, 16#19#, 16#C0#, 16#38#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#71#, 16#80#, 16#71#, 16#80#, 16#73#, 16#00#, 16#3F#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#1F#, 16#00#, 16#1F#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#18#, 16#C0#, 16#30#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#30#, 16#00#, 16#7F#, 16#80#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#01#, 16#C0#, 16#01#, 16#80#, 16#07#, 16#00#, 16#07#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#63#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#03#, 16#80#, 16#05#, 16#80#, 16#0B#, 16#80#, 16#13#, 16#00#, 16#23#, 16#00#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#0F#, 16#C0#, 16#18#, 16#00#, 16#17#, 16#00#, 16#3F#, 16#80#, 16#31#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#0F#, 16#C0#, 16#18#, 16#C0#, 16#18#, 16#00#, 16#37#, 16#00#, 16#3F#, 16#80#, 16#31#, 16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#73#, 16#80#, 16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#1F#, 16#E0#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#18#, 16#C0#, 16#19#, 16#C0#, 16#1F#, 16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#61#, 16#80#, 16#61#, 16#80#, 16#73#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#1F#, 16#80#, 16#19#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#3F#, 16#80#, 16#1D#, 16#80#, 16#03#, 16#80#, 16#63#, 16#00#, 16#7E#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#03#, 16#C0#, 16#0F#, 16#80#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#3F#, 16#00#, 16#07#, 16#80#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C0#, 16#3F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#3C#, 16#00#, 16#1F#, 16#80#, 16#03#, 16#C0#, 16#07#, 16#80#, 16#3E#, 16#00#, 16#78#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#0F#, 16#C0#, 16#1C#, 16#E0#, 16#18#, 16#E0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#06#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#03#, 16#FE#, 16#07#, 16#07#, 16#0C#, 16#03#, 16#18#, 16#01#, 16#30#, 16#E9#, 16#33#, 16#19#, 16#62#, 16#11#, 16#66#, 16#23#, 16#66#, 16#66#, 16#67#, 16#BE#, 16#23#, 16#38#, 16#30#, 16#00#, 16#18#, 16#20#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#C0#, 16#03#, 16#C0#, 16#07#, 16#C0#, 16#0E#, 16#C0#, 16#0E#, 16#C0#, 16#1C#, 16#E0#, 16#1C#, 16#E0#, 16#3F#, 16#E0#, 16#3F#, 16#E0#, 16#70#, 16#60#, 16#60#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#1F#, 16#F0#, 16#1C#, 16#30#, 16#18#, 16#30#, 16#18#, 16#70#, 16#1F#, 16#E0#, 16#3F#, 16#E0#, 16#38#, 16#60#, 16#30#, 16#60#, 16#30#, 16#60#, 16#3F#, 16#C0#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F0#, 16#0C#, 16#38#, 16#18#, 16#38#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#70#, 16#38#, 16#E0#, 16#1F#, 16#C0#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#1F#, 16#F0#, 16#1C#, 16#70#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#38#, 16#30#, 16#38#, 16#70#, 16#30#, 16#60#, 16#30#, 16#E0#, 16#3F#, 16#C0#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#1F#, 16#E0#, 16#3F#, 16#C0#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#3F#, 16#C0#, 16#7F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#1F#, 16#C0#, 16#3F#, 16#C0#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F8#, 16#1C#, 16#18#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#F8#, 16#30#, 16#F0#, 16#30#, 16#30#, 16#30#, 16#30#, 16#38#, 16#70#, 16#1F#, 16#F0#, 16#0F#, 16#A0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#38#, 16#1C#, 16#38#, 16#1C#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#3F#, 16#F0#, 16#3F#, 16#F0#, 16#30#, 16#60#, 16#30#, 16#60#, 16#30#, 16#60#, 16#70#, 16#E0#, 16#70#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#01#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#73#, 16#80#, 16#63#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#38#, 16#1C#, 16#70#, 16#1C#, 16#E0#, 16#19#, 16#C0#, 16#1B#, 16#80#, 16#1F#, 16#00#, 16#3F#, 16#00#, 16#3B#, 16#80#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#70#, 16#E0#, 16#70#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#3F#, 16#C0#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#1E#, 16#1E#, 16#1E#, 16#1E#, 16#3C#, 16#1E#, 16#3C#, 16#1E#, 16#6C#, 16#3E#, 16#6C#, 16#36#, 16#5C#, 16#36#, 16#D8#, 16#32#, 16#98#, 16#33#, 16#98#, 16#73#, 16#B8#, 16#63#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#18#, 16#1E#, 16#38#, 16#1E#, 16#38#, 16#1E#, 16#30#, 16#1F#, 16#30#, 16#3B#, 16#30#, 16#3B#, 16#70#, 16#31#, 16#F0#, 16#31#, 16#E0#, 16#31#, 16#E0#, 16#70#, 16#E0#, 16#60#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F0#, 16#0C#, 16#38#, 16#18#, 16#18#, 16#38#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#38#, 16#30#, 16#30#, 16#38#, 16#60#, 16#1F#, 16#E0#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#1F#, 16#F0#, 16#1C#, 16#70#, 16#18#, 16#30#, 16#18#, 16#70#, 16#18#, 16#60#, 16#3F#, 16#E0#, 16#3F#, 16#80#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F0#, 16#0C#, 16#38#, 16#18#, 16#18#, 16#38#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#B8#, 16#31#, 16#F0#, 16#38#, 16#E0#, 16#1F#, 16#E0#, 16#0F#, 16#B0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#38#, 16#18#, 16#30#, 16#18#, 16#30#, 16#1F#, 16#E0#, 16#3F#, 16#E0#, 16#38#, 16#60#, 16#30#, 16#60#, 16#30#, 16#E0#, 16#30#, 16#E0#, 16#70#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#0F#, 16#E0#, 16#18#, 16#70#, 16#38#, 16#70#, 16#38#, 16#00#, 16#1F#, 16#80#, 16#0F#, 16#E0#, 16#00#, 16#E0#, 16#70#, 16#60#, 16#70#, 16#C0#, 16#3F#, 16#C0#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F0#, 16#3F#, 16#F0#, 16#03#, 16#00#, 16#03#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#38#, 16#1C#, 16#38#, 16#1C#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#70#, 16#38#, 16#70#, 16#38#, 16#60#, 16#30#, 16#60#, 16#38#, 16#E0#, 16#3F#, 16#C0#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#38#, 16#18#, 16#30#, 16#18#, 16#60#, 16#1C#, 16#60#, 16#1C#, 16#C0#, 16#0C#, 16#C0#, 16#0D#, 16#80#, 16#0D#, 16#80#, 16#0F#, 16#00#, 16#0F#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#61#, 16#18#, 16#E3#, 16#18#, 16#E3#, 16#19#, 16#E7#, 16#19#, 16#E6#, 16#19#, 16#66#, 16#1B#, 16#6C#, 16#1B#, 16#6C#, 16#1E#, 16#78#, 16#1E#, 16#78#, 16#1C#, 16#30#, 16#1C#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#30#, 16#0C#, 16#70#, 16#0E#, 16#E0#, 16#0F#, 16#C0#, 16#07#, 16#80#, 16#07#, 16#00#, 16#07#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#80#, 16#39#, 16#80#, 16#31#, 16#C0#, 16#71#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#38#, 16#1C#, 16#70#, 16#0C#, 16#60#, 16#0C#, 16#C0#, 16#0F#, 16#C0#, 16#07#, 16#80#, 16#07#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F0#, 16#1F#, 16#E0#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#7F#, 16#C0#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#30#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#07#, 16#00#, 16#0D#, 16#00#, 16#0D#, 16#80#, 16#19#, 16#80#, 16#11#, 16#80#, 16#31#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#01#, 16#80#, 16#3F#, 16#80#, 16#73#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#, 16#3B#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#1B#, 16#80#, 16#3F#, 16#C0#, 16#38#, 16#C0#, 16#30#, 16#C0#, 16#30#, 16#C0#, 16#30#, 16#C0#, 16#71#, 16#80#, 16#7F#, 16#80#, 16#6E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#80#, 16#39#, 16#C0#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#73#, 16#80#, 16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#0F#, 16#C0#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#, 16#73#, 16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#60#, 16#00#, 16#73#, 16#80#, 16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#C0#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#30#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#, 16#73#, 16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#03#, 16#80#, 16#E3#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#1B#, 16#80#, 16#1F#, 16#C0#, 16#38#, 16#C0#, 16#38#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#31#, 16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#19#, 16#C0#, 16#3B#, 16#80#, 16#3F#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#36#, 16#00#, 16#77#, 16#00#, 16#73#, 16#00#, 16#63#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#9C#, 16#3F#, 16#FC#, 16#39#, 16#CE#, 16#31#, 16#8C#, 16#31#, 16#8C#, 16#31#, 16#8C#, 16#71#, 16#9C#, 16#73#, 16#9C#, 16#63#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#80#, 16#1F#, 16#C0#, 16#38#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#31#, 16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#30#, 16#C0#, 16#70#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#, 16#3F#, 16#80#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#80#, 16#3F#, 16#C0#, 16#38#, 16#C0#, 16#30#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#80#, 16#7F#, 16#80#, 16#6E#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#C0#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#C0#, 16#61#, 16#80#, 16#73#, 16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#03#, 16#80#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#00#, 16#1E#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#80#, 16#39#, 16#80#, 16#38#, 16#00#, 16#3F#, 16#00#, 16#0F#, 16#80#, 16#61#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#3E#, 16#00#, 16#3C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#C0#, 16#38#, 16#C0#, 16#38#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#73#, 16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#39#, 16#C0#, 16#39#, 16#80#, 16#1B#, 16#80#, 16#1B#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#31#, 16#8C#, 16#33#, 16#98#, 16#33#, 16#98#, 16#37#, 16#B0#, 16#37#, 16#B0#, 16#34#, 16#B0#, 16#3C#, 16#E0#, 16#38#, 16#E0#, 16#38#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#39#, 16#C0#, 16#19#, 16#80#, 16#1F#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#1E#, 16#00#, 16#3E#, 16#00#, 16#77#, 16#00#, 16#63#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#39#, 16#C0#, 16#39#, 16#80#, 16#39#, 16#80#, 16#1B#, 16#00#, 16#1B#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#3F#, 16#80#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#7F#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#18#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#1C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#2C#, 16#80#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#); Font_D : aliased constant Bitmap_Font := ( Bytes_Per_Glyph => 38, Glyph_Width => 16, Glyph_Height => 19, Data => FreeSansBoldOblique8pt7bBitmaps'Access); Font : constant Bitmap_Font_Ref := Font_D'Access; end GESTE_Fonts.FreeSansBoldOblique8pt7b;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 4 9 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 49 package System.Pack_49 is pragma Preelaborate; Bits : constant := 49; type Bits_49 is mod 2 ** Bits; for Bits_49'Size use Bits; function Get_49 (Arr : System.Address; N : Natural) return Bits_49; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_49 (Arr : System.Address; N : Natural; E : Bits_49); -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_49;
package Renaming8_Pkg3 is function Last_Index return Integer; end Renaming8_Pkg3;
-- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with GNATtest_Generated; package Tk.TopLevel.Toplevel_Create_Options_Test_Data .Toplevel_Create_Options_Tests is type Test_Toplevel_Create_Options is new GNATtest_Generated .GNATtest_Standard .Tk .TopLevel .Toplevel_Create_Options_Test_Data .Test_Toplevel_Create_Options with null record; procedure Test_Create_32e405_9db90c (Gnattest_T: in out Test_Toplevel_Create_Options); -- tk-toplevel.ads:135:4:Create:Test_Create_TopLevel1 procedure Test_Create_ebbdc1_055047 (Gnattest_T: in out Test_Toplevel_Create_Options); -- tk-toplevel.ads:168:4:Create:Test_Create_TopLevel2 procedure Test_Get_Options_ded36e_2e13ca (Gnattest_T: in out Test_Toplevel_Create_Options); -- tk-toplevel.ads:192:4:Get_Options:Test_Get_Options_TopLevel end Tk.TopLevel.Toplevel_Create_Options_Test_Data .Toplevel_Create_Options_Tests; -- end read only
with Ada.Finalization; with Lexer.Source; package Lexer.Base is pragma Preelaborate; Default_Initial_Buffer_Size : constant := 8192; type Buffer_Type is access all String; type Private_Values is limited private; type Instance is limited new Ada.Finalization.Limited_Controlled with record Cur_Line : Positive := 1; -- index of the line at the current position Line_Start : Positive := 1; -- the buffer index where the current line started Prev_Lines_Chars : Natural := 0; -- number of characters in all previous lines, -- used for calculating index. Pos : Positive := 1; -- position of the next character to be read from the buffer Buffer : Buffer_Type; -- input buffer. filled from the source. Internal : Private_Values; end record; procedure Init (Object : in out Instance; Input : Source.Pointer; Initial_Buffer_Size : Positive := Default_Initial_Buffer_Size); procedure Init (Object : in out Instance; Input : String); subtype Rune is Wide_Wide_Character; function Next (Object : in out Instance) return Character with Inline; procedure Handle_CR (L : in out Instance); procedure Handle_LF (L : in out Instance); End_Of_Input : constant Character := Character'Val (4); Line_Feed : constant Character := Character'Val (10); Carriage_Return : constant Character := Character'Val (13); private type Private_Values is limited record Input : Source.Pointer; -- input provider Sentinel : Positive; -- the position at which, when reached, the buffer must be refilled end record; overriding procedure Finalize (Object : in out Instance); procedure Refill_Buffer (L : in out Instance); end Lexer.Base;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_0000 is pragma Preelaborate; Group_0000 : aliased constant Core_Second_Stage := (16#09# => -- 0009 (Control, Neutral, Control, Other, Sp, Break_After, (Pattern_White_Space | White_Space => True, others => False)), 16#0A# => -- 000A (Control, Neutral, LF, LF, LF, Line_Feed, (Pattern_White_Space | White_Space => True, others => False)), 16#0B# .. 16#0C# => -- 000B .. 000C (Control, Neutral, Control, Newline, Sp, Mandatory_Break, (Pattern_White_Space | White_Space => True, others => False)), 16#0D# => -- 000D (Control, Neutral, CR, CR, CR, Carriage_Return, (Pattern_White_Space | White_Space => True, others => False)), 16#20# => -- 0020 (Space_Separator, Narrow, Other, Other, Sp, Space, (Pattern_White_Space | White_Space | Grapheme_Base => True, others => False)), 16#21# => -- 0021 (Other_Punctuation, Narrow, Other, Other, S_Term, Exclamation, (Pattern_Syntax | STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#22# => -- 0022 (Other_Punctuation, Narrow, Other, Double_Quote, Close, Quotation, (Pattern_Syntax | Quotation_Mark | Grapheme_Base => True, others => False)), 16#23# => -- 0023 (Other_Punctuation, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#24# => -- 0024 (Currency_Symbol, Narrow, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#25# => -- 0025 (Other_Punctuation, Narrow, Other, Other, Other, Postfix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#26# => -- 0026 (Other_Punctuation, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#27# => -- 0027 (Other_Punctuation, Narrow, Other, Single_Quote, Close, Quotation, (Pattern_Syntax | Quotation_Mark | Case_Ignorable | Grapheme_Base => True, others => False)), 16#28# => -- 0028 (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#29# => -- 0029 (Close_Punctuation, Narrow, Other, Other, Close, Close_Parenthesis, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#2A# => -- 002A (Other_Punctuation, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#2B# => -- 002B (Math_Symbol, Narrow, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#2C# => -- 002C (Other_Punctuation, Narrow, Other, Mid_Num, S_Continue, Infix_Numeric, (Pattern_Syntax | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#2D# => -- 002D (Dash_Punctuation, Narrow, Other, Other, S_Continue, Hyphen, (Dash | Hyphen | Pattern_Syntax | Grapheme_Base => True, others => False)), 16#2E# => -- 002E (Other_Punctuation, Narrow, Other, Mid_Num_Let, A_Term, Infix_Numeric, (Pattern_Syntax | STerm | Terminal_Punctuation | Case_Ignorable | Grapheme_Base => True, others => False)), 16#2F# => -- 002F (Other_Punctuation, Narrow, Other, Other, Other, Break_Symbols, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#30# .. 16#39# => -- 0030 .. 0039 (Decimal_Number, Narrow, Other, Numeric, Numeric, Numeric, (ASCII_Hex_Digit | Hex_Digit | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#3A# => -- 003A (Other_Punctuation, Narrow, Other, Mid_Letter, S_Continue, Infix_Numeric, (Pattern_Syntax | Terminal_Punctuation | Case_Ignorable | Grapheme_Base => True, others => False)), 16#3B# => -- 003B (Other_Punctuation, Narrow, Other, Mid_Num, Other, Infix_Numeric, (Pattern_Syntax | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#3C# .. 16#3E# => -- 003C .. 003E (Math_Symbol, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#3F# => -- 003F (Other_Punctuation, Narrow, Other, Other, S_Term, Exclamation, (Pattern_Syntax | STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#40# => -- 0040 (Other_Punctuation, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#41# .. 16#46# => -- 0041 .. 0046 (Uppercase_Letter, Narrow, Other, A_Letter, Upper, Alphabetic, (ASCII_Hex_Digit | Hex_Digit | Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#47# .. 16#5A# => -- 0047 .. 005A (Uppercase_Letter, Narrow, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#5B# => -- 005B (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#5C# => -- 005C (Other_Punctuation, Narrow, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#5D# => -- 005D (Close_Punctuation, Narrow, Other, Other, Close, Close_Parenthesis, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#5E# => -- 005E (Modifier_Symbol, Narrow, Other, Other, Other, Alphabetic, (Diacritic | Other_Math | Pattern_Syntax | Case_Ignorable | Grapheme_Base | Math => True, others => False)), 16#5F# => -- 005F (Connector_Punctuation, Narrow, Other, Extend_Num_Let, Other, Alphabetic, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#60# => -- 0060 (Modifier_Symbol, Narrow, Other, Other, Other, Alphabetic, (Diacritic | Pattern_Syntax | Case_Ignorable | Grapheme_Base => True, others => False)), 16#61# .. 16#66# => -- 0061 .. 0066 (Lowercase_Letter, Narrow, Other, A_Letter, Lower, Alphabetic, (ASCII_Hex_Digit | Hex_Digit | Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#67# .. 16#68# => -- 0067 .. 0068 (Lowercase_Letter, Narrow, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#69# .. 16#6A# => -- 0069 .. 006A (Lowercase_Letter, Narrow, Other, A_Letter, Lower, Alphabetic, (Soft_Dotted | Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#6B# .. 16#7A# => -- 006B .. 007A (Lowercase_Letter, Narrow, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#7B# => -- 007B (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#7C# => -- 007C (Math_Symbol, Narrow, Other, Other, Other, Break_After, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#7D# => -- 007D (Close_Punctuation, Narrow, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#7E# => -- 007E (Math_Symbol, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#85# => -- 0085 (Control, Neutral, Control, Newline, Sep, Next_Line, (Pattern_White_Space | White_Space => True, others => False)), 16#A0# => -- 00A0 (Space_Separator, Neutral, Other, Other, Sp, Glue, (White_Space | Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#A1# => -- 00A1 (Other_Punctuation, Ambiguous, Other, Other, Other, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A2# => -- 00A2 (Currency_Symbol, Narrow, Other, Other, Other, Postfix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A3# => -- 00A3 (Currency_Symbol, Narrow, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A4# => -- 00A4 (Currency_Symbol, Ambiguous, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A5# => -- 00A5 (Currency_Symbol, Narrow, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A6# => -- 00A6 (Other_Symbol, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A7# => -- 00A7 (Other_Punctuation, Ambiguous, Other, Other, Other, Ambiguous, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#A8# => -- 00A8 (Modifier_Symbol, Ambiguous, Other, Other, Other, Ambiguous, (Diacritic | Case_Ignorable | Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#A9# => -- 00A9 (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#AA# => -- 00AA (Other_Letter, Ambiguous, Other, A_Letter, Lower, Ambiguous, (Other_Lowercase | Alphabetic | Cased | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#AB# => -- 00AB (Initial_Punctuation, Neutral, Other, Other, Close, Quotation, (Pattern_Syntax | Quotation_Mark | Grapheme_Base => True, others => False)), 16#AC# => -- 00AC (Math_Symbol, Narrow, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#AD# => -- 00AD (Format, Ambiguous, Control, Format, Format, Break_After, (Hyphen | Case_Ignorable | Default_Ignorable_Code_Point | Changes_When_NFKC_Casefolded => True, others => False)), 16#AE# => -- 00AE (Other_Symbol, Ambiguous, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#AF# => -- 00AF (Modifier_Symbol, Narrow, Other, Other, Other, Alphabetic, (Diacritic | Case_Ignorable | Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#B0# => -- 00B0 (Other_Symbol, Ambiguous, Other, Other, Other, Postfix_Numeric, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#B1# => -- 00B1 (Math_Symbol, Ambiguous, Other, Other, Other, Prefix_Numeric, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#B2# .. 16#B3# => -- 00B2 .. 00B3 (Other_Number, Ambiguous, Other, Other, Other, Ambiguous, (Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#B4# => -- 00B4 (Modifier_Symbol, Ambiguous, Other, Other, Other, Break_Before, (Diacritic | Case_Ignorable | Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#B5# => -- 00B5 (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#B6# => -- 00B6 (Other_Punctuation, Ambiguous, Other, Other, Other, Ambiguous, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#B7# => -- 00B7 (Other_Punctuation, Ambiguous, Other, Mid_Letter, Other, Ambiguous, (Diacritic | Extender | Other_ID_Continue | Case_Ignorable | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#B8# => -- 00B8 (Modifier_Symbol, Ambiguous, Other, Other, Other, Ambiguous, (Diacritic | Case_Ignorable | Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#B9# => -- 00B9 (Other_Number, Ambiguous, Other, Other, Other, Ambiguous, (Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#BA# => -- 00BA (Other_Letter, Ambiguous, Other, A_Letter, Lower, Ambiguous, (Other_Lowercase | Alphabetic | Cased | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#BB# => -- 00BB (Final_Punctuation, Neutral, Other, Other, Close, Quotation, (Pattern_Syntax | Quotation_Mark | Grapheme_Base => True, others => False)), 16#BC# .. 16#BE# => -- 00BC .. 00BE (Other_Number, Ambiguous, Other, Other, Other, Ambiguous, (Grapheme_Base | Changes_When_NFKC_Casefolded => True, others => False)), 16#BF# => -- 00BF (Other_Punctuation, Ambiguous, Other, Other, Other, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#C0# .. 16#C5# => -- 00C0 .. 00C5 (Uppercase_Letter, Neutral, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#C6# => -- 00C6 (Uppercase_Letter, Ambiguous, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#C7# .. 16#CF# => -- 00C7 .. 00CF (Uppercase_Letter, Neutral, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#D0# => -- 00D0 (Uppercase_Letter, Ambiguous, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#D1# .. 16#D6# => -- 00D1 .. 00D6 (Uppercase_Letter, Neutral, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#D7# => -- 00D7 (Math_Symbol, Ambiguous, Other, Other, Other, Ambiguous, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#D8# => -- 00D8 (Uppercase_Letter, Ambiguous, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#D9# .. 16#DD# => -- 00D9 .. 00DD (Uppercase_Letter, Neutral, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#DE# => -- 00DE (Uppercase_Letter, Ambiguous, Other, A_Letter, Upper, Alphabetic, (Alphabetic | Cased | Changes_When_Lowercased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Uppercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#DF# => -- 00DF (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casefolded | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start | Changes_When_NFKC_Casefolded => True, others => False)), 16#E0# .. 16#E1# => -- 00E0 .. 00E1 (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#E2# .. 16#E5# => -- 00E2 .. 00E5 (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#E6# => -- 00E6 (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#E7# => -- 00E7 (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#E8# .. 16#EA# => -- 00E8 .. 00EA (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#EB# => -- 00EB (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#EC# .. 16#ED# => -- 00EC .. 00ED (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#EE# .. 16#EF# => -- 00EE .. 00EF (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#F0# => -- 00F0 (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#F1# => -- 00F1 (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#F2# .. 16#F3# => -- 00F2 .. 00F3 (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#F4# .. 16#F6# => -- 00F4 .. 00F6 (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#F7# => -- 00F7 (Math_Symbol, Ambiguous, Other, Other, Other, Ambiguous, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#F8# .. 16#FA# => -- 00F8 .. 00FA (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#FB# => -- 00FB (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#FC# => -- 00FC (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#FD# => -- 00FD (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#FE# => -- 00FE (Lowercase_Letter, Ambiguous, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), 16#FF# => -- 00FF (Lowercase_Letter, Neutral, Other, A_Letter, Lower, Alphabetic, (Alphabetic | Cased | Changes_When_Uppercased | Changes_When_Titlecased | Changes_When_Casemapped | Grapheme_Base | ID_Continue | ID_Start | Lowercase | XID_Continue | XID_Start => True, others => False)), others => (Control, Neutral, Control, Other, Other, Combining_Mark, (others => False))); end Matreshka.Internals.Unicode.Ucd.Core_0000;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Casing; use Casing; with Debug; use Debug; with Elists; use Elists; with Errout; use Errout; with Fname; use Fname; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Output; use Output; with Scans; use Scans; with Scn; use Scn; with Sinput; use Sinput; with Sinput.L; use Sinput.L; with Sinfo; use Sinfo; with Snames; use Snames; with Style; with Table; with Tbuild; use Tbuild; --------- -- Par -- --------- function Par (Configuration_Pragmas : Boolean; From_Limited_With : Boolean := False) return List_Id is Num_Library_Units : Natural := 0; -- Count number of units parsed (relevant only in syntax check only mode, -- since in semantics check mode only a single unit is permitted anyway) Save_Config_Switches : Config_Switches_Type; -- Variable used to save values of config switches while we parse the -- new unit, to be restored on exit for proper recursive behavior. Loop_Block_Count : Nat := 0; -- Counter used for constructing loop/block names (see the routine -- Par.Ch5.Get_Loop_Block_Name) -------------------- -- Error Recovery -- -------------------- -- When an error is encountered, a call is made to one of the Error_Msg -- routines to record the error. If the syntax scan is not derailed by the -- error (e.g. a complaint that logical operators are inconsistent in an -- EXPRESSION), then control returns from the Error_Msg call, and the -- parse continues unimpeded. -- If on the other hand, the Error_Msg represents a situation from which -- the parser cannot recover locally, the exception Error_Resync is raised -- immediately after the call to Error_Msg. Handlers for Error_Resync -- are located at strategic points to resynchronize the parse. For example, -- when an error occurs in a statement, the handler skips to the next -- semicolon and continues the scan from there. -- Each parsing procedure contains a note with the heading "Error recovery" -- which shows if it can propagate the Error_Resync exception. In order -- not to propagate the exception, a procedure must either contain its own -- handler for this exception, or it must not call any other routines which -- propagate the exception. -- Note: the arrangement of Error_Resync handlers is such that it should -- never be possible to transfer control through a procedure which made -- an entry in the scope stack, invalidating the contents of the stack. Error_Resync : exception; -- Exception raised on error that is not handled locally, see above Last_Resync_Point : Source_Ptr; -- The resynchronization routines in Par.Sync run a risk of getting -- stuck in an infinite loop if they do not skip a token, and the caller -- keeps repeating the same resync call. On the other hand, if they skip -- a token unconditionally, some recovery opportunities are missed. The -- variable Last_Resync_Point records the token location previously set -- by a Resync call, and if a subsequent Resync call occurs at the same -- location, then the Resync routine does guarantee to skip a token. -------------------------------------------- -- Handling Semicolon Used in Place of IS -- -------------------------------------------- -- The following global variables are used in handling the error situation -- of using a semicolon in place of IS in a subprogram declaration as in: -- procedure X (Y : Integer); -- Q : Integer; -- begin -- ... -- end; -- The two contexts in which this can appear are at the outer level, and -- within a declarative region. At the outer level, we know something is -- wrong as soon as we see the Q (or begin, if there are no declarations), -- and we can immediately decide that the semicolon should have been IS. -- The situation in a declarative region is more complex. The declaration -- of Q could belong to the outer region, and we do not know that we have -- an error until we hit the begin. It is still not clear at this point -- from a syntactic point of view that something is wrong, because the -- begin could belong to the enclosing subprogram or package. However, we -- can incorporate a bit of semantic knowledge and note that the body of -- X is missing, so we definitely DO have an error. We diagnose this error -- as semicolon in place of IS on the subprogram line. -- There are two styles for this diagnostic. If the begin immediately -- follows the semicolon, then we can place a flag (IS expected) right -- on the semicolon. Otherwise we do not detect the error until we hit -- the begin which refers back to the line with the semicolon. -- To control the process in the second case, the following global -- variables are set to indicate that we have a subprogram declaration -- whose body is required and has not yet been found. The prefix SIS -- stands for "Subprogram IS" handling. SIS_Entry_Active : Boolean; -- Set True to indicate that an entry is active (i.e. that a subprogram -- declaration has been encountered, and no body for this subprogram has -- been encountered). The remaining fields are valid only if this is True. SIS_Labl : Node_Id; -- Subprogram designator SIS_Sloc : Source_Ptr; -- Source location of FUNCTION/PROCEDURE keyword SIS_Ecol : Column_Number; -- Column number of FUNCTION/PROCEDURE keyword SIS_Semicolon_Sloc : Source_Ptr; -- Source location of semicolon at end of subprogram declaration SIS_Declaration_Node : Node_Id; -- Pointer to tree node for subprogram declaration SIS_Missing_Semicolon_Message : Error_Msg_Id; -- Used to save message ID of missing semicolon message (which will be -- modified to missing IS if necessary). Set to No_Error_Msg in the -- normal (non-error) case. -- Five things can happen to an active SIS entry -- 1. If a BEGIN is encountered with an SIS entry active, then we have -- exactly the situation in which we know the body of the subprogram is -- missing. After posting an error message, we change the spec to a body, -- rechaining the declarations that intervened between the spec and BEGIN. -- 2. Another subprogram declaration or body is encountered. In this -- case the entry gets overwritten with the information for the new -- subprogram declaration. We don't catch some nested cases this way, -- but it doesn't seem worth the effort. -- 3. A nested declarative region (e.g. package declaration or package -- body) is encountered. The SIS active indication is reset at the start -- of such a nested region. Again, like case 2, this causes us to miss -- some nested cases, but it doesn't seen worth the effort to stack and -- unstack the SIS information. Maybe we will reconsider this if we ever -- get a complaint about a missed case :-) -- 4. We encounter a valid pragma INTERFACE or IMPORT that effectively -- supplies the missing body. In this case we reset the entry. -- 5. We encounter the end of the declarative region without encoutering -- a BEGIN first. In this situation we simply reset the entry. We know -- that there is a missing body, but it seems more reasonable to let the -- later semantic checking discover this. ---------------------------------------------------- -- Handling of Reserved Words Used as Identifiers -- ---------------------------------------------------- -- Note: throughout the parser, the terms reserved word and keyword -- are used interchangably to refer to the same set of reserved -- keywords (including until, protected, etc). -- If a reserved word is used in place of an identifier, the parser -- where possible tries to recover gracefully. In particular, if the -- keyword is clearly spelled using identifier casing, e.g. Until in -- a source program using mixed case identifiers and lower case keywords, -- then the keyword is treated as an identifier if it appears in a place -- where an identifier is required. -- The situation is more complex if the keyword is spelled with normal -- keyword casing. In this case, the parser is more reluctant to -- consider it to be intended as an identifier, unless it has some -- further confirmation. -- In the case of an identifier appearing in the identifier list of a -- declaration, the appearence of a comma or colon right after the -- keyword on the same line is taken as confirmation. For an enumeration -- literal, a comma or right paren right after the identifier is also -- treated as adequate confirmation. -- The following type is used in calls to Is_Reserved_Identifier and -- also to P_Defining_Identifier and P_Identifier. The default for all -- these functins is that reserved words in reserved word case are not -- considered to be reserved identifiers. The Id_Check value indicates -- tokens, which if they appear immediately after the identifier, are -- taken as confirming that the use of an identifier was expected type Id_Check is (None, -- Default, no special token test C_Comma_Right_Paren, -- Consider as identifier if followed by comma or right paren C_Comma_Colon, -- Consider as identifier if followed by comma or colon C_Do, -- Consider as identifier if followed by DO C_Dot, -- Consider as identifier if followed by period C_Greater_Greater, -- Consider as identifier if followed by >> C_In, -- Consider as identifier if followed by IN C_Is, -- Consider as identifier if followed by IS C_Left_Paren_Semicolon, -- Consider as identifier if followed by left paren or semicolon C_Use, -- Consider as identifier if followed by USE C_Vertical_Bar_Arrow); -- Consider as identifier if followed by | or => -------------------------------------------- -- Handling IS Used in Place of Semicolon -- -------------------------------------------- -- This is a somewhat trickier situation, and we can't catch it in all -- cases, but we do our best to detect common situations resulting from -- a "cut and paste" operation which forgets to change the IS to semicolon. -- Consider the following example: -- package body X is -- procedure A; -- procedure B is -- procedure C; -- ... -- procedure D is -- begin -- ... -- end; -- begin -- ... -- end; -- The trouble is that the section of text from PROCEDURE B through END; -- consitutes a valid procedure body, and the danger is that we find out -- far too late that something is wrong (indeed most compilers will behave -- uncomfortably on the above example). -- We have two approaches to helping to control this situation. First we -- make every attempt to avoid swallowing the last END; if we can be -- sure that some error will result from doing so. In particular, we won't -- accept the END; unless it is exactly correct (in particular it must not -- have incorrect name tokens), and we won't accept it if it is immediately -- followed by end of file, WITH or SEPARATE (all tokens that unmistakeably -- signal the start of a compilation unit, and which therefore allow us to -- reserve the END; for the outer level.) For more details on this aspect -- of the handling, see package Par.Endh. -- If we can avoid eating up the END; then the result in the absense of -- any additional steps would be to post a missing END referring back to -- the subprogram with the bogus IS. Similarly, if the enclosing package -- has no BEGIN, then the result is a missing BEGIN message, which again -- refers back to the subprogram header. -- Such an error message is not too bad (it's already a big improvement -- over what many parsers do), but it's not ideal, because the declarations -- following the IS have been absorbed into the wrong scope. In the above -- case, this could result for example in a bogus complaint that the body -- of D was missing from the package. -- To catch at least some of these cases, we take the following additional -- steps. First, a subprogram body is marked as having a suspicious IS if -- the declaration line is followed by a line which starts with a symbol -- that can start a declaration in the same column, or to the left of the -- column in which the FUNCTION or PROCEDURE starts (normal style is to -- indent any declarations which really belong a subprogram). If such a -- subprogram encounters a missing BEGIN or missing END, then we decide -- that the IS should have been a semicolon, and the subprogram body node -- is marked (by setting the Bad_Is_Detected flag true. Note that we do -- not do this for library level procedures, only for nested procedures, -- since for library level procedures, we must have a body. -- The processing for a declarative part checks to see if the last -- declaration scanned is marked in this way, and if it is, the tree -- is modified to reflect the IS being interpreted as a semicolon. --------------------------------------------------- -- Parser Type Definitions and Control Variables -- --------------------------------------------------- -- The following variable and associated type declaration are used by the -- expression parsing routines to return more detailed information about -- the categorization of a parsed expression. type Expr_Form_Type is ( EF_Simple_Name, -- Simple name, i.e. possibly qualified identifier EF_Name, -- Simple expression which could also be a name EF_Simple, -- Simple expression which is not call or name EF_Range_Attr, -- Range attribute reference EF_Non_Simple); -- Expression that is not a simple expression Expr_Form : Expr_Form_Type; -- The following type is used for calls to P_Subprogram, P_Package, P_Task, -- P_Protected to indicate which of several possibilities is acceptable. type Pf_Rec is record Spcn : Boolean; -- True if specification OK Decl : Boolean; -- True if declaration OK Gins : Boolean; -- True if generic instantiation OK Pbod : Boolean; -- True if proper body OK Rnam : Boolean; -- True if renaming declaration OK Stub : Boolean; -- True if body stub OK Fil1 : Boolean; -- Filler to fill to 8 bits Fil2 : Boolean; -- Filler to fill to 8 bits end record; pragma Pack (Pf_Rec); function T return Boolean renames True; function F return Boolean renames False; Pf_Decl_Gins_Pbod_Rnam_Stub : constant Pf_Rec := Pf_Rec'(F, T, T, T, T, T, F, F); Pf_Decl : constant Pf_Rec := Pf_Rec'(F, T, F, F, F, F, F, F); Pf_Decl_Gins_Pbod_Rnam : constant Pf_Rec := Pf_Rec'(F, T, T, T, T, F, F, F); Pf_Decl_Pbod : constant Pf_Rec := Pf_Rec'(F, T, F, T, F, F, F, F); Pf_Pbod : constant Pf_Rec := Pf_Rec'(F, F, F, T, F, F, F, F); Pf_Spcn : constant Pf_Rec := Pf_Rec'(T, F, F, F, F, F, F, F); -- The above are the only allowed values of Pf_Rec arguments type SS_Rec is record Eftm : Boolean; -- ELSIF can terminate sequence Eltm : Boolean; -- ELSE can terminate sequence Extm : Boolean; -- EXCEPTION can terminate sequence Ortm : Boolean; -- OR can terminate sequence Sreq : Boolean; -- at least one statement required Tatm : Boolean; -- THEN ABORT can terminate sequence Whtm : Boolean; -- WHEN can terminate sequence Unco : Boolean; -- Unconditional terminate after one statement end record; pragma Pack (SS_Rec); SS_Eftm_Eltm_Sreq : constant SS_Rec := SS_Rec'(T, T, F, F, T, F, F, F); SS_Eltm_Ortm_Tatm : constant SS_Rec := SS_Rec'(F, T, F, T, F, T, F, F); SS_Extm_Sreq : constant SS_Rec := SS_Rec'(F, F, T, F, T, F, F, F); SS_None : constant SS_Rec := SS_Rec'(F, F, F, F, F, F, F, F); SS_Ortm_Sreq : constant SS_Rec := SS_Rec'(F, F, F, T, T, F, F, F); SS_Sreq : constant SS_Rec := SS_Rec'(F, F, F, F, T, F, F, F); SS_Sreq_Whtm : constant SS_Rec := SS_Rec'(F, F, F, F, T, F, T, F); SS_Whtm : constant SS_Rec := SS_Rec'(F, F, F, F, F, F, T, F); SS_Unco : constant SS_Rec := SS_Rec'(F, F, F, F, F, F, F, T); Goto_List : Elist_Id; -- List of goto nodes appearing in the current compilation. Used to -- recognize natural loops and convert them into bona fide loops for -- optimization purposes. Label_List : Elist_Id; -- List of label nodes for labels appearing in the current compilation. -- Used by Par.Labl to construct the corresponding implicit declarations. ----------------- -- Scope Table -- ----------------- -- The scope table, also referred to as the scope stack, is used to -- record the current scope context. It is organized as a stack, with -- inner nested entries corresponding to higher entries on the stack. -- An entry is made when the parser encounters the opening of a nested -- construct (such as a record, task, package etc.), and then package -- Par.Endh uses this stack to deal with END lines (including properly -- dealing with END nesting errors). type SS_End_Type is -- Type of end entry required for this scope. The last two entries are -- used only in the subprogram body case to mark the case of a suspicious -- IS, or a bad IS (i.e. suspicions confirmed by missing BEGIN or END). -- See separate section on dealing with IS used in place of semicolon. -- Note that for many purposes E_Name, E_Suspicious_Is and E_Bad_Is are -- treated the same (E_Suspicious_Is and E_Bad_Is are simply special cases -- of E_Name). They are placed at the end of the enumeration so that a -- test for >= E_Name catches all three cases efficiently. (E_Dummy, -- dummy entry at outer level E_Case, -- END CASE; E_If, -- END IF; E_Loop, -- END LOOP; E_Record, -- END RECORD; E_Select, -- END SELECT; E_Name, -- END [name]; E_Suspicious_Is, -- END [name]; (case of suspicious IS) E_Bad_Is); -- END [name]; (case of bad IS) -- The following describes a single entry in the scope table type Scope_Table_Entry is record Etyp : SS_End_Type; -- Type of end entry, as per above description Lreq : Boolean; -- A flag indicating whether the label, if present, is required to -- appear on the end line. It is referenced only in the case of -- Etyp = E_Name or E_Suspicious_Is where the name may or may not be -- required (yes for labeled block, no in other cases). Note that for -- all cases except begin, the question of whether a label is required -- can be determined from the other fields (for loop, it is required if -- it is present, and for the other constructs it is never required or -- allowed). Ecol : Column_Number; -- Contains the absolute column number (with tabs expanded) of the -- the expected column of the end assuming normal Ada indentation -- usage. If the RM_Column_Check mode is set, this value is used for -- generating error messages about indentation. Otherwise it is used -- only to control heuristic error recovery actions. Labl : Node_Id; -- This field is used only for the LOOP and BEGIN cases, and is the -- Node_Id value of the label name. For all cases except child units, -- this value is an entity whose Chars field contains the name pointer -- that identifies the label uniquely. For the child unit case the Labl -- field references an N_Defining_Program_Unit_Name node for the name. -- For cases other than LOOP or BEGIN, the Label field is set to Error, -- indicating that it is an error to have a label on the end line. -- (this is really a misuse of Error since there is no Error ???) Decl : List_Id; -- Points to the list of declarations (i.e. the declarative part) -- associated with this construct. It is set only in the END [name] -- cases, and is set to No_List for all other cases which do not have a -- declarative unit associated with them. This is used for determining -- the proper location for implicit label declarations. Node : Node_Id; -- Empty except in the case of entries for IF and CASE statements, -- in which case it contains the N_If_Statement or N_Case_Statement -- node. This is used for setting the End_Span field. Sloc : Source_Ptr; -- Source location of the opening token of the construct. This is -- used to refer back to this line in error messages (such as missing -- or incorrect end lines). The Sloc field is not used, and is not set, -- if a label is present (the Labl field provides the text name of the -- label in this case, which is fine for error messages). S_Is : Source_Ptr; -- S_Is is relevant only if Etyp is set to E_Suspicious_Is or -- E_Bad_Is. It records the location of the IS that is considered -- to be suspicious. Junk : Boolean; -- A boolean flag that is set true if the opening entry is the dubious -- result of some prior error, e.g. a record entry where the record -- keyword was missing. It is used to suppress the issuing of a -- corresponding junk complaint about the end line (we do not want -- to complain about a missing end record when there was no record). end record; -- The following declares the scope table itself. The Last field is the -- stack pointer, so that Scope.Table (Scope.Last) is the top entry. The -- oldest entry, at Scope_Stack (0), is a dummy entry with Etyp set to -- E_Dummy, and the other fields undefined. This dummy entry ensures that -- Scope_Stack (Scope_Stack_Ptr).Etyp can always be tested, and that the -- scope stack pointer is always in range. package Scope is new Table.Table ( Table_Component_Type => Scope_Table_Entry, Table_Index_Type => Int, Table_Low_Bound => 0, Table_Initial => 50, Table_Increment => 100, Table_Name => "Scope"); --------------------------------- -- Parsing Routines by Chapter -- --------------------------------- -- Uncommented declarations in this section simply parse the construct -- corresponding to their name, and return an ID value for the Node or -- List that is created. ------------- -- Par.Ch2 -- ------------- package Ch2 is function P_Pragma return Node_Id; function P_Identifier (C : Id_Check := None) return Node_Id; -- Scans out an identifier. The parameter C determines the treatment -- of reserved identifiers. See declaration of Id_Check for details. function P_Pragmas_Opt return List_Id; -- This function scans for a sequence of pragmas in other than a -- declaration sequence or statement sequence context. All pragmas -- can appear except pragmas Assert and Debug, which are only allowed -- in a declaration or statement sequence context. procedure P_Pragmas_Misplaced; -- Skips misplaced pragmas with a complaint procedure P_Pragmas_Opt (List : List_Id); -- Parses optional pragmas and appends them to the List end Ch2; ------------- -- Par.Ch3 -- ------------- package Ch3 is Missing_Begin_Msg : Error_Msg_Id; -- This variable is set by a call to P_Declarative_Part. Normally it -- is set to No_Error_Msg, indicating that no special processing is -- required by the caller. The special case arises when a statement -- is found in the sequence of declarations. In this case the Id of -- the message issued ("declaration expected") is preserved in this -- variable, then the caller can change it to an appropriate missing -- begin message if indeed the BEGIN is missing. function P_Array_Type_Definition return Node_Id; function P_Basic_Declarative_Items return List_Id; function P_Constraint_Opt return Node_Id; function P_Declarative_Part return List_Id; function P_Discrete_Choice_List return List_Id; function P_Discrete_Range return Node_Id; function P_Discrete_Subtype_Definition return Node_Id; function P_Known_Discriminant_Part_Opt return List_Id; function P_Signed_Integer_Type_Definition return Node_Id; function P_Range return Node_Id; function P_Range_Or_Subtype_Mark return Node_Id; function P_Range_Constraint return Node_Id; function P_Record_Definition return Node_Id; function P_Subtype_Mark return Node_Id; function P_Subtype_Mark_Resync return Node_Id; function P_Unknown_Discriminant_Part_Opt return Boolean; function P_Access_Definition (Null_Exclusion_Present : Boolean) return Node_Id; -- Ada 2005 (AI-231/AI-254): The caller parses the null-exclusion part -- and indicates if it was present function P_Access_Type_Definition (Header_Already_Parsed : Boolean := False) return Node_Id; -- Ada 2005 (AI-254): The formal is used to indicate if the caller has -- parsed the null_exclusion part. In this case the caller has also -- removed the ACCESS token procedure P_Component_Items (Decls : List_Id); -- Scan out one or more component items and append them to the -- given list. Only scans out more than one declaration in the -- case where the source has a single declaration with multiple -- defining identifiers. function P_Defining_Identifier (C : Id_Check := None) return Node_Id; -- Scan out a defining identifier. The parameter C controls the -- treatment of errors in case a reserved word is scanned. See the -- declaration of this type for details. function P_Interface_Type_Definition (Is_Synchronized : Boolean) return Node_Id; -- Ada 2005 (AI-251): Parse the interface type definition part. The -- parameter Is_Synchronized is True in case of task interfaces, -- protected interfaces, and synchronized interfaces; it is used to -- generate a record_definition node. In the rest of cases (limited -- interfaces and interfaces) we generate a record_definition node if -- the list of interfaces is empty; otherwise we generate a -- derived_type_definition node (the first interface in this list is the -- ancestor interface). function P_Null_Exclusion return Boolean; -- Ada 2005 (AI-231): Parse the null-excluding part. True indicates -- that the null-excluding part was present. function P_Subtype_Indication (Not_Null_Present : Boolean := False) return Node_Id; -- Ada 2005 (AI-231): The flag Not_Null_Present indicates that the -- null-excluding part has been scanned out and it was present. function Init_Expr_Opt (P : Boolean := False) return Node_Id; -- If an initialization expression is present (:= expression), then -- it is scanned out and returned, otherwise Empty is returned if no -- initialization expression is present. This procedure also handles -- certain common error cases cleanly. The parameter P indicates if -- a right paren can follow the expression (default = no right paren -- allowed). procedure Skip_Declaration (S : List_Id); -- Used when scanning statements to skip past a mispaced declaration -- The declaration is scanned out and appended to the given list. -- Token is known to be a declaration token (in Token_Class_Declk) -- on entry, so there definition is a declaration to be scanned. function P_Subtype_Indication (Subtype_Mark : Node_Id; Not_Null_Present : Boolean := False) return Node_Id; -- This version of P_Subtype_Indication is called when the caller has -- already scanned out the subtype mark which is passed as a parameter. -- Ada 2005 (AI-231): The flag Not_Null_Present indicates that the -- null-excluding part has been scanned out and it was present. function P_Subtype_Mark_Attribute (Type_Node : Node_Id) return Node_Id; -- Parse a subtype mark attribute. The caller has already parsed the -- subtype mark, which is passed in as the argument, and has checked -- that the current token is apostrophe. end Ch3; ------------- -- Par.Ch4 -- ------------- package Ch4 is function P_Aggregate return Node_Id; function P_Expression return Node_Id; function P_Expression_No_Right_Paren return Node_Id; function P_Expression_Or_Range_Attribute return Node_Id; function P_Function_Name return Node_Id; function P_Name return Node_Id; function P_Qualified_Simple_Name return Node_Id; function P_Qualified_Simple_Name_Resync return Node_Id; function P_Simple_Expression return Node_Id; function P_Simple_Expression_Or_Range_Attribute return Node_Id; function P_Qualified_Expression (Subtype_Mark : Node_Id) return Node_Id; -- This routine scans out a qualified expression when the caller has -- already scanned out the name and apostrophe of the construct. end Ch4; ------------- -- Par.Ch5 -- ------------- package Ch5 is function P_Statement_Name (Name_Node : Node_Id) return Node_Id; -- Given a node representing a name (which is a call), converts it -- to the syntactically corresponding procedure call statement. function P_Sequence_Of_Statements (SS_Flags : SS_Rec) return List_Id; -- The argument indicates the acceptable termination tokens. -- See body in Par.Ch5 for details of the use of this parameter. procedure Parse_Decls_Begin_End (Parent : Node_Id); -- Parses declarations and handled statement sequence, setting -- fields of Parent node appropriately. end Ch5; ------------- -- Par.Ch6 -- ------------- package Ch6 is function P_Designator return Node_Id; function P_Defining_Program_Unit_Name return Node_Id; function P_Formal_Part return List_Id; function P_Parameter_Profile return List_Id; function P_Return_Statement return Node_Id; function P_Subprogram_Specification return Node_Id; procedure P_Mode (Node : Node_Id); -- Sets In_Present and/or Out_Present flags in Node scanning past -- IN, OUT or IN OUT tokens in the source. function P_Subprogram (Pf_Flags : Pf_Rec) return Node_Id; -- Scans out any construct starting with either of the keywords -- PROCEDURE or FUNCTION. The parameter indicates which possible -- possible kinds of construct (body, spec, instantiation etc.) -- are permissible in the current context. end Ch6; ------------- -- Par.Ch7 -- ------------- package Ch7 is function P_Package (Pf_Flags : Pf_Rec) return Node_Id; -- Scans out any construct starting with the keyword PACKAGE. The -- parameter indicates which possible kinds of construct (body, spec, -- instantiation etc.) are permissible in the current context. end Ch7; ------------- -- Par.Ch8 -- ------------- package Ch8 is function P_Use_Clause return Node_Id; end Ch8; ------------- -- Par.Ch9 -- ------------- package Ch9 is function P_Abort_Statement return Node_Id; function P_Abortable_Part return Node_Id; function P_Accept_Statement return Node_Id; function P_Delay_Statement return Node_Id; function P_Entry_Body return Node_Id; function P_Protected return Node_Id; function P_Requeue_Statement return Node_Id; function P_Select_Statement return Node_Id; function P_Task return Node_Id; function P_Terminate_Alternative return Node_Id; end Ch9; -------------- -- Par.Ch10 -- -------------- package Ch10 is function P_Compilation_Unit return Node_Id; -- Note: this function scans a single compilation unit, and -- checks that an end of file follows this unit, diagnosing -- any unexpected input as an error, and then skipping it, so -- that Token is set to Tok_EOF on return. An exception is in -- syntax-only mode, where multiple compilation units are -- permitted. In this case, P_Compilation_Unit does not check -- for end of file and there may be more compilation units to -- scan. The caller can uniquely detect this situation by the -- fact that Token is not set to Tok_EOF on return. -- -- The Ignore parameter is normally set False. It is set True -- in multiple unit per file mode if we are skipping past a unit -- that we are not interested in. end Ch10; -------------- -- Par.Ch11 -- -------------- package Ch11 is function P_Handled_Sequence_Of_Statements return Node_Id; function P_Raise_Statement return Node_Id; function Parse_Exception_Handlers return List_Id; -- Parses the partial construct EXCEPTION followed by a list of -- exception handlers which appears in a number of productions, -- and returns the list of exception handlers. end Ch11; -------------- -- Par.Ch12 -- -------------- package Ch12 is function P_Generic return Node_Id; function P_Generic_Actual_Part_Opt return List_Id; end Ch12; -------------- -- Par.Ch13 -- -------------- package Ch13 is function P_Representation_Clause return Node_Id; function P_Code_Statement (Subtype_Mark : Node_Id) return Node_Id; -- Function to parse a code statement. The caller has scanned out -- the name to be used as the subtype mark (but has not checked that -- it is suitable for use as a subtype mark, i.e. is either an -- identifier or a selected component). The current token is an -- apostrophe and the following token is either a left paren or -- RANGE (the latter being an error to be caught by P_Code_Statement. end Ch13; -- Note: the parsing for annexe J features (i.e. obsolescent features) -- is found in the logical section where these features would be if -- they were not obsolescent. In particular: -- Delta constraint is parsed by P_Delta_Constraint (3.5.9) -- At clause is parsed by P_At_Clause (13.1) -- Mod clause is parsed by P_Mod_Clause (13.5.1) -------------- -- Par.Endh -- -------------- -- Routines for handling end lines, including scope recovery package Endh is function Check_End return Boolean; -- Called when an end sequence is required. In the absence of an error -- situation, Token contains Tok_End on entry, but in a missing end -- case, this may not be the case. Pop_End_Context is used to determine -- the appropriate action to be taken. The returned result is True if -- an End sequence was encountered and False if no End sequence was -- present. This occurs if the END keyword encountered was determined -- to be improper and deleted (i.e. Pop_End_Context set End_Action to -- Skip_And_Reject). Note that the END sequence includes a semicolon, -- except in the case of END RECORD, where a semicolon follows the END -- RECORD, but is not part of the record type definition itself. procedure End_Skip; -- Skip past an end sequence. On entry Token contains Tok_End, and we -- we know that the end sequence is syntactically incorrect, and that -- an appropriate error message has already been posted. The mission -- is simply to position the scan pointer to be the best guess of the -- position after the end sequence. We do not issue any additional -- error messages while carrying this out. procedure End_Statements (Parent : Node_Id := Empty); -- Called when an end is required or expected to terminate a sequence -- of statements. The caller has already made an appropriate entry in -- the Scope.Table to describe the expected form of the end. This can -- only be used in cases where the only appropriate terminator is end. -- If Parent is non-empty, then if a correct END line is encountered, -- the End_Label field of Parent is set appropriately. end Endh; -------------- -- Par.Sync -- -------------- -- These procedures are used to resynchronize after errors. Following an -- error which is not immediately locally recoverable, the exception -- Error_Resync is raised. The handler for Error_Resync typically calls -- one of these recovery procedures to resynchronize the source position -- to a point from which parsing can be restarted. -- Note: these procedures output an information message that tokens are -- being skipped, but this message is output only if the option for -- Multiple_Errors_Per_Line is set in Options. package Sync is procedure Resync_Choice; -- Used if an error occurs scanning a choice. The scan pointer is -- advanced to the next vertical bar, arrow, or semicolon, whichever -- comes first. We also quit if we encounter an end of file. procedure Resync_Expression; -- Used if an error is detected during the parsing of an expression. -- It skips past tokens until either a token which cannot be part of -- an expression is encountered (an expression terminator), or if a -- comma or right parenthesis or vertical bar is encountered at the -- current parenthesis level (a parenthesis level counter is maintained -- to carry out this test). procedure Resync_Past_Semicolon; -- Used if an error occurs while scanning a sequence of declarations. -- The scan pointer is positioned past the next semicolon and the scan -- resumes. The scan is also resumed on encountering a token which -- starts a declaration (but we make sure to skip at least one token -- in this case, to avoid getting stuck in a loop). procedure Resync_To_Semicolon; -- Similar to Resync_Past_Semicolon, except that the scan pointer is -- left pointing to the semicolon rather than past it. procedure Resync_Past_Semicolon_Or_To_Loop_Or_Then; -- Used if an error occurs while scanning a sequence of statements. -- The scan pointer is positioned past the next semicolon, or to the -- next occurrence of either then or loop, and the scan resumes. procedure Resync_To_When; -- Used when an error occurs scanning an entry index specification. -- The scan pointer is positioned to the next WHEN (or to IS or -- semicolon if either of these appear before WHEN, indicating -- another error has occurred). procedure Resync_Semicolon_List; -- Used if an error occurs while scanning a parenthesized list of items -- separated by semicolons. The scan pointer is advanced to the next -- semicolon or right parenthesis at the outer parenthesis level, or -- to the next is or RETURN keyword occurence, whichever comes first. procedure Resync_Cunit; -- Synchronize to next token which could be the start of a compilation -- unit, or to the end of file token. end Sync; -------------- -- Par.Tchk -- -------------- -- Routines to check for expected tokens package Tchk is -- Procedures with names of the form T_xxx, where Tok_xxx is a token -- name, check that the current token matches the required token, and -- if so, scan past it. If not, an error is issued indicating that -- the required token is not present (xxx expected). In most cases, the -- scan pointer is not moved in the not-found case, but there are some -- exceptions to this, see for example T_Id, where the scan pointer is -- moved across a literal appearing where an identifier is expected. procedure T_Abort; procedure T_Arrow; procedure T_At; procedure T_Body; procedure T_Box; procedure T_Colon; procedure T_Colon_Equal; procedure T_Comma; procedure T_Dot_Dot; procedure T_For; procedure T_Greater_Greater; procedure T_Identifier; procedure T_In; procedure T_Is; procedure T_Left_Paren; procedure T_Loop; procedure T_Mod; procedure T_New; procedure T_Of; procedure T_Or; procedure T_Private; procedure T_Range; procedure T_Record; procedure T_Right_Paren; procedure T_Semicolon; procedure T_Then; procedure T_Type; procedure T_Use; procedure T_When; procedure T_With; -- Procedures have names of the form TF_xxx, where Tok_xxx is a token -- name check that the current token matches the required token, and -- if so, scan past it. If not, an error message is issued indicating -- that the required token is not present (xxx expected). -- If the missing token is at the end of the line, then control returns -- immediately after posting the message. If there are remaining tokens -- on the current line, a search is conducted to see if the token -- appears later on the current line, as follows: -- A call to Scan_Save is issued and a forward search for the token -- is carried out. If the token is found on the current line before a -- semicolon, then it is scanned out and the scan continues from that -- point. If not the scan is restored to the point where it was missing. procedure TF_Arrow; procedure TF_Is; procedure TF_Loop; procedure TF_Return; procedure TF_Semicolon; procedure TF_Then; procedure TF_Use; end Tchk; -------------- -- Par.Util -- -------------- package Util is function Bad_Spelling_Of (T : Token_Type) return Boolean; -- This function is called in an error situation. It checks if the -- current token is an identifier whose name is a plausible bad -- spelling of the given keyword token, and if so, issues an error -- message, sets Token from T, and returns True. Otherwise Token is -- unchanged, and False is returned. procedure Check_Bad_Layout; -- Check for bad indentation in RM checking mode. Used for statements -- and declarations. Checks if current token is at start of line and -- is exdented from the current expected end column, and if so an -- error message is generated. procedure Check_Misspelling_Of (T : Token_Type); pragma Inline (Check_Misspelling_Of); -- This is similar to the function above, except that it does not -- return a result. It is typically used in a situation where any -- identifier is an error, and it makes sense to simply convert it -- to the given token if it is a plausible misspelling of it. procedure Check_95_Keyword (Token_95, Next : Token_Type); -- This routine checks if the token after the current one matches the -- Next argument. If so, the scan is backed up to the current token -- and Token_Type is changed to Token_95 after issuing an appropriate -- error message ("(Ada 83) keyword xx cannot be used"). If not, -- the scan is backed up with Token_Type unchanged. This routine -- is used to deal with an attempt to use a 95 keyword in Ada 83 -- mode. The caller has typically checked that the current token, -- an identifier, matches one of the 95 keywords. procedure Check_Simple_Expression (E : Node_Id); -- Given an expression E, that has just been scanned, so that Expr_Form -- is still set, outputs an error if E is a non-simple expression. E is -- not modified by this call. procedure Check_Simple_Expression_In_Ada_83 (E : Node_Id); -- Like Check_Simple_Expression, except that the error message is only -- given when operating in Ada 83 mode, and includes "in Ada 83". function Check_Subtype_Mark (Mark : Node_Id) return Node_Id; -- Called to check that a node representing a name (or call) is -- suitable for a subtype mark, i.e, that it is an identifier or -- a selected component. If so, or if it is already Error, then -- it is returned unchanged. Otherwise an error message is issued -- and Error is returned. function Comma_Present return Boolean; -- Used in comma delimited lists to determine if a comma is present, or -- can reasonably be assumed to have been present (an error message is -- generated in the latter case). If True is returned, the scan has been -- positioned past the comma. If False is returned, the scan position -- is unchanged. Note that all comma-delimited lists are terminated by -- a right paren, so the only legitimate tokens when Comma_Present is -- called are right paren and comma. If some other token is found, then -- Comma_Present has the job of deciding whether it is better to pretend -- a comma was present, post a message for a missing comma and return -- True, or return False and let the caller diagnose the missing right -- parenthesis. procedure Discard_Junk_Node (N : Node_Id); procedure Discard_Junk_List (L : List_Id); pragma Inline (Discard_Junk_Node); pragma Inline (Discard_Junk_List); -- These procedures do nothing at all, their effect is simply to discard -- the argument. A typical use is to skip by some junk that is not -- expected in the current context. procedure Ignore (T : Token_Type); -- If current token matches T, then give an error message and skip -- past it, otherwise the call has no effect at all. T may be any -- reserved word token, or comma, left or right paren, or semicolon. function Is_Reserved_Identifier (C : Id_Check := None) return Boolean; -- Test if current token is a reserved identifier. This test is based -- on the token being a keyword and being spelled in typical identifier -- style (i.e. starting with an upper case letter). The parameter C -- determines the special treatment if a reserved word is encountered -- that has the normal casing of a reserved word. procedure Merge_Identifier (Prev : Node_Id; Nxt : Token_Type); -- Called when the previous token is an identifier (whose Token_Node -- value is given by Prev) to check if current token is an identifier -- that can be merged with the previous one adding an underscore. The -- merge is only attempted if the following token matches Nxt. If all -- conditions are met, an error message is issued, and the merge is -- carried out, modifying the Chars field of Prev. procedure No_Constraint; -- Called in a place where no constraint is allowed, but one might -- appear due to a common error (e.g. after the type mark in a procedure -- parameter. If a constraint is present, an error message is posted, -- and the constraint is scanned and discarded. function No_Right_Paren (Expr : Node_Id) return Node_Id; -- Function to check for no right paren at end of expression, returns -- its argument if no right paren, else flags paren and returns Error. procedure Push_Scope_Stack; pragma Inline (Push_Scope_Stack); -- Push a new entry onto the scope stack. Scope.Last (the stack pointer) -- is incremented. The Junk field is preinitialized to False. The caller -- is expected to fill in all remaining entries of the new new top stack -- entry at Scope.Table (Scope.Last). procedure Pop_Scope_Stack; -- Pop an entry off the top of the scope stack. Scope_Last (the scope -- table stack pointer) is decremented by one. It is a fatal error to -- try to pop off the dummy entry at the bottom of the stack (i.e. -- Scope.Last must be non-zero at the time of call). function Separate_Present return Boolean; -- Determines if the current token is either Tok_Separate, or an -- identifier that is a possible misspelling of "separate" followed -- by a semicolon. True is returned if so, otherwise False. procedure Signal_Bad_Attribute; -- The current token is an identifier that is supposed to be an -- attribute identifier but is not. This routine posts appropriate -- error messages, including a check for a near misspelling. function Token_Is_At_Start_Of_Line return Boolean; pragma Inline (Token_Is_At_Start_Of_Line); -- Determines if the current token is the first token on the line function Token_Is_At_End_Of_Line return Boolean; -- Determines if the current token is the last token on the line end Util; -------------- -- Par.Prag -- -------------- -- The processing for pragmas is split off from chapter 2 function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id; -- This function is passed a tree for a pragma that has been scanned out. -- The pragma is syntactically well formed according to the general syntax -- for pragmas and the pragma identifier is for one of the recognized -- pragmas. It performs specific syntactic checks for specific pragmas. -- The result is the input node if it is OK, or Error otherwise. The -- reason that this is separated out is to facilitate the addition -- of implementation defined pragmas. The second parameter records the -- location of the semicolon following the pragma (this is needed for -- correct processing of the List and Page pragmas). The returned value -- is a copy of Pragma_Node, or Error if an error is found. Note that -- at the point where Prag is called, the right paren ending the pragma -- has been scanned out, and except in the case of pragma Style_Checks, -- so has the following semicolon. For Style_Checks, the caller delays -- the scanning of the semicolon so that it will be scanned using the -- settings from the Style_Checks pragma preceding it. -------------- -- Par.Labl -- -------------- procedure Labl; -- This procedure creates implicit label declarations for all label that -- are declared in the current unit. Note that this could conceptually -- be done at the point where the labels are declared, but it is tricky -- to do it then, since the tree is not hooked up at the point where the -- label is declared (e.g. a sequence of statements is not yet attached -- to its containing scope at the point a label in the sequence is found) -------------- -- Par.Load -- -------------- procedure Load; -- This procedure loads all subsidiary units that are required by this -- unit, including with'ed units, specs for bodies, and parents for child -- units. It does not load bodies for inlined procedures and generics, -- since we don't know till semantic analysis is complete what is needed. ----------- -- Stubs -- ----------- -- The package bodies can see all routines defined in all other subpackages use Ch2; use Ch3; use Ch4; use Ch5; use Ch6; use Ch7; use Ch8; use Ch9; use Ch10; use Ch11; use Ch12; use Ch13; use Endh; use Tchk; use Sync; use Util; package body Ch2 is separate; package body Ch3 is separate; package body Ch4 is separate; package body Ch5 is separate; package body Ch6 is separate; package body Ch7 is separate; package body Ch8 is separate; package body Ch9 is separate; package body Ch10 is separate; package body Ch11 is separate; package body Ch12 is separate; package body Ch13 is separate; package body Endh is separate; package body Tchk is separate; package body Sync is separate; package body Util is separate; function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is separate; procedure Labl is separate; procedure Load is separate; -- Start of processing for Par begin -- Deal with configuration pragmas case first if Configuration_Pragmas then declare Pragmas : constant List_Id := Empty_List; P_Node : Node_Id; begin loop if Token = Tok_EOF then return Pragmas; elsif Token /= Tok_Pragma then Error_Msg_SC ("only pragmas allowed in configuration file"); return Error_List; else P_Node := P_Pragma; if Nkind (P_Node) = N_Pragma then -- Give error if bad pragma if Chars (P_Node) > Last_Configuration_Pragma_Name and then Chars (P_Node) /= Name_Source_Reference then if Is_Pragma_Name (Chars (P_Node)) then Error_Msg_N ("only configuration pragmas allowed " & "in configuration file", P_Node); else Error_Msg_N ("unrecognized pragma in configuration file", P_Node); end if; -- Pragma is OK config pragma, so collect it else Append (P_Node, Pragmas); end if; end if; end if; end loop; end; -- Normal case of compilation unit else Save_Opt_Config_Switches (Save_Config_Switches); -- The following loop runs more than once in syntax check mode -- where we allow multiple compilation units in the same file -- and in Multiple_Unit_Per_file mode where we skip units till -- we get to the unit we want. for Ucount in Pos loop Set_Opt_Config_Switches (Is_Internal_File_Name (File_Name (Current_Source_File)), Current_Source_Unit = Main_Unit); -- Initialize scope table and other parser control variables Compiler_State := Parsing; Scope.Init; Scope.Increment_Last; Scope.Table (0).Etyp := E_Dummy; SIS_Entry_Active := False; Last_Resync_Point := No_Location; Goto_List := New_Elmt_List; Label_List := New_Elmt_List; -- If in multiple unit per file mode, skip past ignored unit if Ucount < Multiple_Unit_Index then -- We skip in syntax check only mode, since we don't want -- to do anything more than skip past the unit and ignore it. -- This causes processing like setting up a unit table entry -- to be skipped. declare Save_Operating_Mode : constant Operating_Mode_Type := Operating_Mode; Save_Style_Check : constant Boolean := Style_Check; begin Operating_Mode := Check_Syntax; Style_Check := False; Discard_Node (P_Compilation_Unit); Operating_Mode := Save_Operating_Mode; Style_Check := Save_Style_Check; -- If we are at an end of file, and not yet at the right -- unit, then we have a fatal error. The unit is missing. if Token = Tok_EOF then Error_Msg_SC ("file has too few compilation units"); raise Unrecoverable_Error; end if; end; -- Here if we are not skipping a file in multiple unit per file -- mode. Parse the unit that we are interested in. Note that in -- check syntax mode we are interested in all units in the file. else declare Comp_Unit_Node : constant Node_Id := P_Compilation_Unit; begin -- If parsing was successful and we are not in check syntax -- mode, check that language defined units are compiled in -- GNAT mode. For this purpose we do NOT consider renamings -- in annex J as predefined. That allows users to compile -- their own versions of these files, and in particular, -- in the VMS implementation, the DEC versions can be -- substituted for the standard Ada 95 versions. Another -- exception is System.RPC and its children. This allows -- a user to supply their own communication layer. if Comp_Unit_Node /= Error and then Operating_Mode = Generate_Code and then Current_Source_Unit = Main_Unit and then not GNAT_Mode then declare Uname : constant String := Get_Name_String (Unit_Name (Current_Source_Unit)); Name : String (1 .. Uname'Length - 2); begin -- Because Unit_Name includes "%s" or "%b", we need to -- strip the last two characters to get the real unit -- name. Name := Uname (Uname'First .. Uname'Last - 2); if Name = "ada" or else Name = "calendar" or else Name = "interfaces" or else Name = "system" or else Name = "machine_code" or else Name = "unchecked_conversion" or else Name = "unchecked_deallocation" then Error_Msg ("language defined units may not be recompiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 4 and then Name (Name'First .. Name'First + 3) = "ada." then Error_Msg ("descendents of package Ada " & "may not be compiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 11 and then Name (Name'First .. Name'First + 10) = "interfaces." then Error_Msg ("descendents of package Interfaces " & "may not be compiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 7 and then Name (Name'First .. Name'First + 6) = "system." and then Name /= "system.rpc" and then (Name'Length < 11 or else Name (Name'First .. Name'First + 10) /= "system.rpc.") then Error_Msg ("descendents of package System " & "may not be compiled", Sloc (Unit (Comp_Unit_Node))); end if; end; end if; end; -- All done if at end of file exit when Token = Tok_EOF; -- If we are not at an end of file, it means we are in syntax -- check only mode, and we keep the loop going to parse all -- remaining units in the file. end if; Restore_Opt_Config_Switches (Save_Config_Switches); end loop; -- Now that we have completely parsed the source file, we can -- complete the source file table entry. Complete_Source_File_Entry; -- An internal error check, the scope stack should now be empty pragma Assert (Scope.Last = 0); -- Remaining steps are to create implicit label declarations and to -- load required subsidiary sources. These steps are required only -- if we are doing semantic checking. if Operating_Mode /= Check_Syntax or else Debug_Flag_F then Par.Labl; Par.Load; end if; -- Restore settings of switches saved on entry Restore_Opt_Config_Switches (Save_Config_Switches); Set_Comes_From_Source_Default (False); return Empty_List; end if; end Par;
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstplugin_h; with glib; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h is -- unsupported macro: GST_TYPE_PLUGIN_FEATURE (gst_plugin_feature_get_type()) -- arg-macro: function GST_PLUGIN_FEATURE (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeature); -- arg-macro: function GST_IS_PLUGIN_FEATURE (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN_FEATURE); -- arg-macro: function GST_PLUGIN_FEATURE_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass); -- arg-macro: function GST_IS_PLUGIN_FEATURE_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN_FEATURE); -- arg-macro: function GST_PLUGIN_FEATURE_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass); -- arg-macro: function GST_PLUGIN_FEATURE_CAST (obj) -- return (GstPluginFeature*)(obj); -- arg-macro: function GST_PLUGIN_FEATURE_NAME (feature) -- return GST_PLUGIN_FEATURE (feature).name; -- arg-macro: procedure GST_PLUGIN_FEATURE_LIST_DEBUG (list) -- gst_plugin_feature_list_debug(list) -- GStreamer -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> -- * 2000 Wim Taymans <wtay@chello.be> -- * -- * gstpluginfeature.h: Header for base GstPluginFeature -- * -- * 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. -- --* -- * GST_PLUGIN_FEATURE_NAME: -- * @feature: The feature to query -- * -- * Get the name of the feature -- type GstPluginFeature; type u_GstPluginFeature_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstPluginFeature is u_GstPluginFeature; -- gst/gstpluginfeature.h:49 type GstPluginFeatureClass; type u_GstPluginFeatureClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstPluginFeatureClass is u_GstPluginFeatureClass; -- gst/gstpluginfeature.h:50 --* -- * GstRank: -- * @GST_RANK_NONE: will be chosen last or not at all -- * @GST_RANK_MARGINAL: unlikely to be chosen -- * @GST_RANK_SECONDARY: likely to be chosen -- * @GST_RANK_PRIMARY: will be chosen first -- * -- * Element priority ranks. Defines the order in which the autoplugger (or -- * similar rank-picking mechanisms, such as e.g. gst_element_make_from_uri()) -- * will choose this element over an alternative one with the same function. -- * -- * These constants serve as a rough guidance for defining the rank of a -- * #GstPluginFeature. Any value is valid, including values bigger than -- * @GST_RANK_PRIMARY. -- subtype GstRank is unsigned; GST_RANK_NONE : constant GstRank := 0; GST_RANK_MARGINAL : constant GstRank := 64; GST_RANK_SECONDARY : constant GstRank := 128; GST_RANK_PRIMARY : constant GstRank := 256; -- gst/gstpluginfeature.h:72 --* -- * GstPluginFeature: -- * -- * Opaque #GstPluginFeature structure. -- type GstPluginFeature is record object : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; -- gst/gstpluginfeature.h:80 loaded : aliased GLIB.gboolean; -- gst/gstpluginfeature.h:83 name : access GLIB.gchar; -- gst/gstpluginfeature.h:84 rank : aliased GLIB.guint; -- gst/gstpluginfeature.h:85 plugin_name : access GLIB.gchar; -- gst/gstpluginfeature.h:87 plugin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstplugin_h.GstPlugin; -- gst/gstpluginfeature.h:88 u_gst_reserved : u_GstPluginFeature_u_gst_reserved_array; -- gst/gstpluginfeature.h:91 end record; pragma Convention (C_Pass_By_Copy, GstPluginFeature); -- gst/gstpluginfeature.h:79 --< private > -- FIXME-0.11: remove variable, we use GstObject:name -- weak ref --< private > type GstPluginFeatureClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObjectClass; -- gst/gstpluginfeature.h:95 u_gst_reserved : u_GstPluginFeatureClass_u_gst_reserved_array; -- gst/gstpluginfeature.h:98 end record; pragma Convention (C_Pass_By_Copy, GstPluginFeatureClass); -- gst/gstpluginfeature.h:94 --< private > --* -- * GstTypeNameData: -- * @name: a name -- * @type: a GType -- * -- * Structure used for filtering based on @name and @type. -- type GstTypeNameData is record name : access GLIB.gchar; -- gst/gstpluginfeature.h:110 c_type : aliased GLIB.GType; -- gst/gstpluginfeature.h:111 end record; pragma Convention (C_Pass_By_Copy, GstTypeNameData); -- gst/gstpluginfeature.h:112 -- skipped anonymous struct anon_217 --* -- * GstPluginFeatureFilter: -- * @feature: the pluginfeature to check -- * @user_data: the user_data that has been passed on e.g. -- * gst_registry_feature_filter() -- * -- * A function that can be used with e.g. gst_registry_feature_filter() -- * to get a list of pluginfeature that match certain criteria. -- * -- * Returns: %TRUE for a positive match, %FALSE otherwise -- type GstPluginFeatureFilter is access function (arg1 : access GstPluginFeature; arg2 : System.Address) return GLIB.gboolean; pragma Convention (C, GstPluginFeatureFilter); -- gst/gstpluginfeature.h:126 -- normal GObject stuff function gst_plugin_feature_get_type return GLIB.GType; -- gst/gstpluginfeature.h:130 pragma Import (C, gst_plugin_feature_get_type, "gst_plugin_feature_get_type"); function gst_plugin_feature_load (feature : access GstPluginFeature) return access GstPluginFeature; -- gst/gstpluginfeature.h:133 pragma Import (C, gst_plugin_feature_load, "gst_plugin_feature_load"); function gst_plugin_feature_type_name_filter (feature : access GstPluginFeature; data : access GstTypeNameData) return GLIB.gboolean; -- gst/gstpluginfeature.h:136 pragma Import (C, gst_plugin_feature_type_name_filter, "gst_plugin_feature_type_name_filter"); procedure gst_plugin_feature_set_rank (feature : access GstPluginFeature; rank : GLIB.guint); -- gst/gstpluginfeature.h:140 pragma Import (C, gst_plugin_feature_set_rank, "gst_plugin_feature_set_rank"); procedure gst_plugin_feature_set_name (feature : access GstPluginFeature; name : access GLIB.gchar); -- gst/gstpluginfeature.h:141 pragma Import (C, gst_plugin_feature_set_name, "gst_plugin_feature_set_name"); function gst_plugin_feature_get_rank (feature : access GstPluginFeature) return GLIB.guint; -- gst/gstpluginfeature.h:142 pragma Import (C, gst_plugin_feature_get_rank, "gst_plugin_feature_get_rank"); function gst_plugin_feature_get_name (feature : access GstPluginFeature) return access GLIB.gchar; -- gst/gstpluginfeature.h:143 pragma Import (C, gst_plugin_feature_get_name, "gst_plugin_feature_get_name"); procedure gst_plugin_feature_list_free (list : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList); -- gst/gstpluginfeature.h:145 pragma Import (C, gst_plugin_feature_list_free, "gst_plugin_feature_list_free"); function gst_plugin_feature_list_copy (list : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList) return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gstpluginfeature.h:146 pragma Import (C, gst_plugin_feature_list_copy, "gst_plugin_feature_list_copy"); procedure gst_plugin_feature_list_debug (list : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList); -- gst/gstpluginfeature.h:147 pragma Import (C, gst_plugin_feature_list_debug, "gst_plugin_feature_list_debug"); --* -- * GST_PLUGIN_FEATURE_LIST_DEBUG: -- * @list: (transfer none) (element-type Gst.PluginFeature): a #GList of -- * plugin features -- * -- * Debug the plugin feature names in @list. -- * -- * Since: 0.10.31 -- function gst_plugin_feature_check_version (feature : access GstPluginFeature; min_major : GLIB.guint; min_minor : GLIB.guint; min_micro : GLIB.guint) return GLIB.gboolean; -- gst/gstpluginfeature.h:164 pragma Import (C, gst_plugin_feature_check_version, "gst_plugin_feature_check_version"); function gst_plugin_feature_rank_compare_func (p1 : Interfaces.C.Extensions.void_ptr; p2 : Interfaces.C.Extensions.void_ptr) return GLIB.gint; -- gst/gstpluginfeature.h:168 pragma Import (C, gst_plugin_feature_rank_compare_func, "gst_plugin_feature_rank_compare_func"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h;
-- Abstract : -- -- see spec. -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- As a special exception under Section 7 of GPL version 3, you are granted -- additional permissions described in the GCC Runtime Library Exception, -- version 3.1, as published by the Free Software Foundation. pragma License (Modified_GPL); with Ada.Strings.Fixed; with Ada_Process_Actions; -- token_enum_id package body Wisi.Ada is use WisiToken; function Indent_Record (Data : in out Parse_Data_Type; Anchor_Token : in Augmented_Token; Record_Token : in Augmented_Token; Indenting_Token : in Augmented_Token; Indenting_Comment : in Boolean; Offset : in Integer) return Wisi.Delta_Type is use Ada_Process_Actions; begin -- [1] ada-wisi-elisp-parse--indent-record-1. if Anchor_Token.Byte_Region = Null_Buffer_Region or Record_Token.Byte_Region = Null_Buffer_Region or Indenting_Token.Byte_Region = Null_Buffer_Region then return Null_Delta; end if; if not Indenting_Comment and Indenting_Token.ID = +RECORD_ID then -- Indenting 'record' return Indent_Anchored_2 (Data, Anchor_Token.Line, Record_Token.Last_Line (Indenting_Comment), Ada_Indent_Record_Rel_Type, Accumulate => True); else -- Indenting comment, component or 'end' -- -- Ensure 'record' line is anchored. if not (Data.Indents (Record_Token.Line).Label = Anchored or Data.Indents (Record_Token.Line).Label = Anchor_Anchored) then if Anchor_Token.Line /= Record_Token.Line then -- We don't pass Indenting_Comment here, because 'record' is code. Indent_Token_1 (Data, Record_Token, Indent_Anchored_2 (Data, Anchor_Token.Line, Record_Token.Last_Line (Indenting_Comment => False), Ada_Indent_Record_Rel_Type, Accumulate => True), Indenting_Comment => False); end if; end if; -- from [2] wisi-elisp-parse--anchored-1 return Indent_Anchored_2 (Data, Anchor_Line => Anchor_Token.Line, Last_Line => Indenting_Token.Last_Line (Indenting_Comment), Offset => Current_Indent_Offset (Data, Anchor_Token, Offset => (if Anchor_Token.Line = Record_Token.Line then Offset else Offset + Ada_Indent_Record_Rel_Type)), Accumulate => True); end if; end Indent_Record; ---------- -- Public subprograms overriding procedure Initialize (Data : in out Parse_Data_Type; Descriptor : access constant WisiToken.Descriptor; Source_File_Name : in String; Post_Parse_Action : in Post_Parse_Action_Type; Begin_Line : in WisiToken.Line_Number_Type; End_Line : in WisiToken.Line_Number_Type; Begin_Indent : in Integer; Params : in String) is use Standard.Ada.Strings.Fixed; use all type Ada_Process_Actions.Token_Enum_ID; First : Integer := Params'First; Last : Integer := Index (Params, " "); begin Wisi.Initialize (Wisi.Parse_Data_Type (Data), Descriptor, Source_File_Name, Post_Parse_Action, Begin_Line, End_Line, Begin_Indent, ""); Data.First_Comment_ID := +COMMENT_ID; Data.Last_Comment_ID := WisiToken.Invalid_Token_ID; Data.Left_Paren_ID := +LEFT_PAREN_ID; Data.Right_Paren_ID := +RIGHT_PAREN_ID; Data.Embedded_Quote_Escape_Doubled := True; if Params /= "" then Ada_Indent := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Broken := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := First + 1; Ada_Indent_Comment_Col_0 := Params (First) = '1'; First := Last + 1; Last := First + 1; Ada_Indent_Comment_GNAT := Params (First) = '1'; First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Label := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Record_Rel_Type := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Renames := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Return := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_Use := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_When := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := Index (Params, " ", First); Ada_Indent_With := Integer'Value (Params (First .. Last - 1)); First := Last + 1; Last := First + 1; Ada_Indent_Hanging_Rel_Exp := Params (First) = '1'; First := Last + 1; Last := First + 1; End_Names_Optional := Params (First) = '1'; end if; Data.Indent_Comment_Col_0 := Ada_Indent_Comment_Col_0; end Initialize; overriding function Indent_Hanging_1 (Data : in out Parse_Data_Type; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Delta_1 : in Simple_Indent_Param; Delta_2 : in Simple_Indent_Param; Option : in Boolean; Accumulate : in Boolean) return Delta_Type is use all type Syntax_Trees.Node_Index; Indenting_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tree_Indenting); function Result (Delta_1 : in Simple_Indent_Param; Delta_2 : in Simple_Delta_Type) return Delta_Type is begin return (Hanging, Hanging_First_Line => Indenting_Token.Line, Hanging_Paren_State => Indenting_Token.Paren_State, Hanging_Delta_1 => Indent_Compute_Delta (Data, Tree, Tokens, (Simple, Delta_1), Tree_Indenting, Indenting_Comment).Simple_Delta, Hanging_Delta_2 => Delta_2, Hanging_Accumulate => Accumulate); end Result; function Result (Delta_1 : in Simple_Delta_Type) return Delta_Type is begin return (Hanging, Hanging_First_Line => Indenting_Token.Line, Hanging_Paren_State => Indenting_Token.Paren_State, Hanging_Delta_1 => Delta_1, Hanging_Delta_2 => Delta_1, Hanging_Accumulate => Accumulate); end Result; function Comment_Result (D : in Simple_Indent_Param) return Delta_Type is begin return Indent_Compute_Delta (Data, Tree, Tokens, (Simple, D), Tree_Indenting, Indenting_Comment => False); end Comment_Result; use Ada_Process_Actions; begin if Tree.ID (Tree.Parent (Tree_Indenting)) = +association_opt_ID and then Syntax_Trees.Invalid_Node_Index /= Tree.Find_Ancestor (Tree_Indenting, +aspect_specification_opt_ID) then -- In aspect_specification_opt -- See ada.wy association_opt for test cases if not Indenting_Comment then return Result (Delta_1, Indent_Anchored_2 (Data, Indenting_Token.Line, Indenting_Token.Last_Indent_Line, Current_Indent_Offset (Data, Indenting_Token, 0), Accumulate => False).Simple_Delta); else -- Test case in test/aspects.ads return Result (Indent_Compute_Delta (Data, Tree, Tokens, (Simple, Delta_1), Tree_Indenting, Indenting_Comment).Simple_Delta); end if; elsif Ada_Indent_Hanging_Rel_Exp then declare New_Delta_2 : constant Simple_Delta_Type := Indent_Anchored_2 (Data, Indenting_Token.Line, Indenting_Token.Last_Indent_Line, Current_Indent_Offset (Data, Indenting_Token, Ada_Indent_Broken), Accumulate => False).Simple_Delta; begin if not Option or Indenting_Token.Line = Indenting_Token.First_Indent_Line then return Result (Delta_1, New_Delta_2); else return Result (New_Delta_2); end if; end; elsif Indenting_Comment then -- Use delta for last line of Indenting_Token. -- Test cases in test/ada_mode-parens.adb Hello declare First_Terminal : Augmented_Token renames Data.Terminals (Indenting_Token.First_Terminals_Index); begin if Option then -- Test cases with "Item => ..." if First_Terminal.First then if Indenting_Token.First_Indent_Line = Indenting_Token.Last_Indent_Line then return Comment_Result (Delta_1); else return Comment_Result (Delta_2); end if; else if Indenting_Token.First_Indent_Line = Invalid_Line_Number then return Comment_Result ((Int, 0)); else return Comment_Result (Delta_1); end if; end if; else if First_Terminal.First then if Indenting_Token.First_Indent_Line = Indenting_Token.Last_Indent_Line then return Comment_Result (Delta_1); else return Comment_Result (Delta_2); end if; else if Indenting_Token.First_Indent_Line = Invalid_Line_Number then -- Comment is after first line in token return Comment_Result (Delta_1); else return Comment_Result (Delta_2); end if; end if; end if; end; elsif not Option or Indenting_Token.Line = Indenting_Token.First_Indent_Line then return Result (Delta_1, Indent_Compute_Delta (Data, Tree, Tokens, (Simple, Delta_2), Tree_Indenting, Indenting_Comment).Simple_Delta); else return Result (Indent_Compute_Delta (Data, Tree, Tokens, (Simple, Delta_1), Tree_Indenting, Indenting_Comment).Simple_Delta); end if; end Indent_Hanging_1; function Ada_Indent_Aggregate (Data : in out Wisi.Parse_Data_Type'Class; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Args : in Wisi.Indent_Arg_Arrays.Vector) return Wisi.Delta_Type is pragma Unreferenced (Data); pragma Unreferenced (Indenting_Comment); pragma Unreferenced (Args); pragma Unreferenced (Tokens); use all type Syntax_Trees.Node_Index; use Ada_Process_Actions; -- In our grammar, 'aggregate' can be an Ada aggregate, or a -- parenthesized expression. -- -- We always want an 'aggregate' to be indented by -- ada-indent-broken. However, in some places in the grammar, -- 'aggregate' is indented by ada-indent. The following checks for -- those places, and returns a correction value. Expression : constant Syntax_Trees.Node_Index := Tree.Find_Ancestor (Tree_Indenting, +expression_opt_ID); begin if Expression = Syntax_Trees.Invalid_Node_Index or else Tree.Parent (Expression) = Syntax_Trees.Invalid_Node_Index then return Null_Delta; elsif Tree.ID (Tree.Parent (Expression)) in +if_expression_ID | +elsif_expression_item_ID | +case_expression_alternative_ID then -- The controlling boolean expression in 'if_expression' and -- 'elsif_expression_item' cannot be an aggregate in legal Ada -- syntax. return (Simple, (Int, Ada_Indent_Broken - Ada_Indent)); else return Null_Delta; end if; end Ada_Indent_Aggregate; function Ada_Indent_Renames_0 (Data : in out Wisi.Parse_Data_Type'Class; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Args : in Indent_Arg_Arrays.Vector) return Wisi.Delta_Type is Subp_Tok : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tokens (Positive_Index_Type (Integer'(Args (1))))); Renames_Tok : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tree_Indenting); Paren_I : Base_Token_Index; begin if Subp_Tok.Char_Region = Null_Buffer_Region then -- built from entirely virtual tokens return Null_Delta; end if; Paren_I := Data.Find (Data.Left_Paren_ID, Subp_Tok); if Paren_I /= Augmented_Token_Arrays.No_Index then -- paren is present declare Paren_Tok : Augmented_Token renames Data.Terminals (Paren_I); begin if Ada_Indent_Renames > 0 then return Indent_Anchored_2 (Data, Anchor_Line => Subp_Tok.Line, Last_Line => Renames_Tok.Last_Line (Indenting_Comment), Offset => Ada_Indent_Renames, Accumulate => True); else return Indent_Anchored_2 (Data, Anchor_Line => Paren_Tok.Line, Last_Line => Renames_Tok.Last_Line (Indenting_Comment), Offset => Current_Indent_Offset (Data, Paren_Tok, abs Ada_Indent_Renames), Accumulate => True); end if; end; else return Indent_Anchored_2 (Data, Anchor_Line => Subp_Tok.Line, Last_Line => Renames_Tok.Last_Line (Indenting_Comment), Offset => Ada_Indent_Broken, Accumulate => True); end if; end Ada_Indent_Renames_0; function Ada_Indent_Return_0 (Data : in out Wisi.Parse_Data_Type'Class; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Args : in Wisi.Indent_Arg_Arrays.Vector) return Wisi.Delta_Type is use all type Ada_Process_Actions.Token_Enum_ID; -- Tokens (Args (1)) = 'formal_part' -- Indenting = 'result_profile' -- Args (2) = delta (= 0!) -- -- We are indenting 'result_profile' in -- 'parameter_and_result_profile'. The indent depends on whether the -- 'formal_part' is present, and the location of 'FUNCTION'. Parameter_And_Result_Profile : constant Syntax_Trees.Valid_Node_Index := Tree.Parent (Tree_Indenting); Indenting : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tree_Indenting); begin if Indenting.Line = Indenting.First_Indent_Line then if Ada_Indent_Return <= 0 then declare Anchor_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tokens (Positive_Index_Type (Integer'(Args (1))))); begin return Indent_Anchored_2 (Data, Anchor_Line => Anchor_Token.Line, Last_Line => Indenting.Last_Line (Indenting_Comment), Offset => Current_Indent_Offset (Data, Anchor_Token, Args (2) + abs Ada_Indent_Return), Accumulate => True); end; else declare Function_N : constant Syntax_Trees.Valid_Node_Index := Tree.Find_Sibling (Parameter_And_Result_Profile, +FUNCTION_ID); Anchor_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Function_N); begin return Indent_Anchored_2 (Data, Anchor_Line => Anchor_Token.Line, Last_Line => Indenting.Last_Line (Indenting_Comment), Offset => Current_Indent_Offset (Data, Anchor_Token, Args (2) + abs Ada_Indent_Return), Accumulate => True); end; end if; else return Null_Delta; end if; end Ada_Indent_Return_0; function Ada_Indent_Record_0 (Data : in out Wisi.Parse_Data_Type'Class; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Args : in Wisi.Indent_Arg_Arrays.Vector) return Wisi.Delta_Type is begin return Indent_Record (Parse_Data_Type (Data), Anchor_Token => Get_Aug_Token (Data, Tree, Tokens (Positive_Index_Type (Integer'(Args (1))))), Record_Token => Get_Aug_Token (Data, Tree, Tokens (Positive_Index_Type (Integer'(Args (2))))), Offset => Args (3), Indenting_Token => Get_Aug_Token (Data, Tree, Tree_Indenting), Indenting_Comment => Indenting_Comment); end Ada_Indent_Record_0; function Ada_Indent_Record_1 (Data : in out Wisi.Parse_Data_Type'Class; Tree : in Syntax_Trees.Tree; Tokens : in Syntax_Trees.Valid_Node_Index_Array; Tree_Indenting : in Syntax_Trees.Valid_Node_Index; Indenting_Comment : in Boolean; Args : in Wisi.Indent_Arg_Arrays.Vector) return Wisi.Delta_Type is -- We are indenting a token in 'record_definition'. -- -- Args (1) is the token ID of the anchor (= TYPE); it appears as a -- direct child in an ancestor 'full_type_declaration'. use all type WisiToken.Syntax_Trees.Node_Label; use Ada_Process_Actions; Full_Type_Declaration : constant Syntax_Trees.Valid_Node_Index := Tree.Find_Ancestor (Tree_Indenting, +full_type_declaration_ID); Tree_Anchor : constant Syntax_Trees.Valid_Node_Index := Tree.Find_Child (Full_Type_Declaration, Token_ID (Integer'(Args (1)))); begin if Tree.Label (Tree_Anchor) /= WisiToken.Syntax_Trees.Shared_Terminal then -- Anchor is virtual; Indent_Record would return Null_Delta return Null_Delta; end if; declare Anchor_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tree_Anchor); -- Args (2) is the index of RECORD in Tokens Record_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tokens (Positive_Index_Type (Integer'(Args (2))))); Indenting_Token : constant Aug_Token_Ref := Get_Aug_Token (Data, Tree, Tree_Indenting); begin -- Args (3) is the offset return Indent_Record (Parse_Data_Type (Data), Anchor_Token, Record_Token, Indenting_Token, Indenting_Comment, Args (3)); end; end Ada_Indent_Record_1; end Wisi.Ada;
-- generated parser support file. -- command line: wisitoken-bnf-generate.exe --generate LR1 Ada_Emacs re2c PROCESS gpr.wy -- -- Copyright (C) 2013 - 2019 Free Software Foundation, Inc. -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. -- -- This software 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. with Wisi; use Wisi; with Wisi.Gpr; use Wisi.Gpr; package body Gpr_Process_Actions is use WisiToken.Semantic_Checks; procedure aggregate_g_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => null; when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Anchored_0, 1, 1))), (False, (Simple, (Anchored_0, 1, 0))))); end case; end aggregate_g_0; procedure attribute_declaration_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (5, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, (1 => (2, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end attribute_declaration_0; procedure attribute_declaration_1 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (8, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, (1 => (2, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end attribute_declaration_1; procedure attribute_declaration_2 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (10, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, (1 => (2, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end attribute_declaration_2; procedure attribute_declaration_3 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (8, Statement_End))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken - 1))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end attribute_declaration_3; procedure case_statement_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (7, Statement_End))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, Gpr_Indent_When)), (Simple, (Int, Gpr_Indent_When))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end case_statement_0; procedure case_item_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, (1 => (1, Motion))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent))), (False, (Simple, (Int, Gpr_Indent))))); end case; end case_item_0; procedure compilation_unit_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => null; when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, 0)), (Simple, (Int, 0))))); end case; end compilation_unit_0; function identifier_opt_1_check (Lexer : access constant WisiToken.Lexer.Instance'Class; Nonterm : in out WisiToken.Recover_Token; Tokens : in WisiToken.Recover_Token_Array; Recover_Active : in Boolean) return WisiToken.Semantic_Checks.Check_Status is pragma Unreferenced (Lexer, Recover_Active); begin return Propagate_Name (Nonterm, Tokens, 1); end identifier_opt_1_check; procedure package_spec_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (7, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, ((2, 2, 0), (6, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, Gpr_Indent)), (Simple, (Int, Gpr_Indent))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end package_spec_0; function package_spec_0_check (Lexer : access constant WisiToken.Lexer.Instance'Class; Nonterm : in out WisiToken.Recover_Token; Tokens : in WisiToken.Recover_Token_Array; Recover_Active : in Boolean) return WisiToken.Semantic_Checks.Check_Status is pragma Unreferenced (Nonterm, Recover_Active); begin return Match_Names (Lexer, Descriptor, Tokens, 2, 6, End_Names_Optional); end package_spec_0_check; procedure package_extension_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (9, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, ((2, 2, 0), (8, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, Gpr_Indent)), (Simple, (Int, Gpr_Indent))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end package_extension_0; function package_extension_0_check (Lexer : access constant WisiToken.Lexer.Instance'Class; Nonterm : in out WisiToken.Recover_Token; Tokens : in WisiToken.Recover_Token_Array; Recover_Active : in Boolean) return WisiToken.Semantic_Checks.Check_Status is pragma Unreferenced (Nonterm, Recover_Active); begin return Match_Names (Lexer, Descriptor, Tokens, 2, 8, End_Names_Optional); end package_extension_0_check; procedure package_renaming_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (5, Statement_End))); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, ((2, 2, 0), (4, 2, 0))); when Indent => null; end case; end package_renaming_0; procedure project_extension_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (9, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, 2, 1), (2, 2, 0), (8, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, Gpr_Indent)), (Simple, (Int, Gpr_Indent))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end project_extension_0; function project_extension_0_check (Lexer : access constant WisiToken.Lexer.Instance'Class; Nonterm : in out WisiToken.Recover_Token; Tokens : in WisiToken.Recover_Token_Array; Recover_Active : in Boolean) return WisiToken.Semantic_Checks.Check_Status is pragma Unreferenced (Nonterm, Recover_Active); begin return Match_Names (Lexer, Descriptor, Tokens, 2, 8, End_Names_Optional); end project_extension_0_check; procedure simple_declarative_item_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (4, Statement_End))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end simple_declarative_item_0; procedure simple_declarative_item_1 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (6, Statement_End))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end simple_declarative_item_1; procedure simple_declarative_item_4 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (2, Statement_End))); when Face => null; when Indent => null; end case; end simple_declarative_item_4; procedure simple_project_declaration_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (7, Statement_End))); Name_Action (Parse_Data, Tree, Nonterm, Tokens, 2); when Face => Face_Apply_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, 2, 1), (2, 2, 0), (6, 2, 0))); when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))), (True, (Simple, (Int, Gpr_Indent)), (Simple, (Int, Gpr_Indent))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))), (False, (Simple, (Int, 0))))); end case; end simple_project_declaration_0; function simple_project_declaration_0_check (Lexer : access constant WisiToken.Lexer.Instance'Class; Nonterm : in out WisiToken.Recover_Token; Tokens : in WisiToken.Recover_Token_Array; Recover_Active : in Boolean) return WisiToken.Semantic_Checks.Check_Status is pragma Unreferenced (Nonterm, Recover_Active); begin return Match_Names (Lexer, Descriptor, Tokens, 2, 6, End_Names_Optional); end simple_project_declaration_0_check; procedure typed_string_declaration_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index; Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array) is Parse_Data : Wisi.Parse_Data_Type renames Wisi.Parse_Data_Type (User_Data); begin case Parse_Data.Post_Parse_Action is when Navigate => Statement_Action (Parse_Data, Tree, Nonterm, Tokens, ((1, Statement_Start), (5, Statement_End))); when Face => null; when Indent => Indent_Action_0 (Parse_Data, Tree, Nonterm, Tokens, ((False, (Simple, (Int, 0))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, Gpr_Indent_Broken))), (False, (Simple, (Int, 0))))); end case; end typed_string_declaration_0; end Gpr_Process_Actions;
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - 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. -- -- package body default_handlers with spark_mode => off is procedure dummy is begin null; end dummy; end default_handlers;
------------------------------------------------------------------------------ -- G E L A X 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.Fixed; with Ada.Strings.Maps.Constants; package body XASIS.Fractions is use XASIS.Integers; function Val (X : Integer) return I.Value; function NOD (X, Y : I.Value) return I.Value; procedure Simplify (X : in out Fraction); --------- -- Val -- --------- function Val (X : Integer) return I.Value is begin return Literal (Integer'Image (X)); end Val; --------- -- "*" -- --------- function "*" (Left, Right : Fraction) return Fraction is Result : Fraction := (Left.Numerator * Right.Numerator, Left.Denominator * Right.Denominator, Left.Exponent + Right.Exponent); begin Simplify (Result); return Result; end "*"; ---------- -- "**" -- ---------- function "**" (Left : Fraction; Right : I.Value) return Fraction is begin if Right > I.Zero then return (Left.Numerator ** Right, Left.Denominator ** Right, Left.Exponent * Right); else return (One / Left) ** (-Right); end if; end "**"; --------- -- "+" -- --------- function "+" (Left, Right : Fraction) return Fraction is Min_Exp : I.Value := Left.Exponent; L : Fraction := Left; R : Fraction := Right; Result : Fraction; begin if Min_Exp > Right.Exponent then Min_Exp := Right.Exponent; end if; if L.Exponent > Min_Exp then L.Numerator := L.Numerator * Ten ** (L.Exponent - Min_Exp); elsif R.Exponent > Min_Exp then R.Numerator := R.Numerator * Ten ** (R.Exponent - Min_Exp); end if; Result := (L.Numerator * R.Denominator + R.Numerator * L.Denominator, L.Denominator * R.Denominator, Min_Exp); Simplify (Result); return Result; end "+"; --------- -- "-" -- --------- function "-" (Left : Fraction) return Fraction is begin return (-Left.Numerator, Left.Denominator, Left.Exponent); end "-"; --------- -- "-" -- --------- function "-" (Left, Right : Fraction) return Fraction is begin return Left + (-Right); end "-"; --------- -- "/" -- --------- function "/" (Left, Right : Fraction) return Fraction is Reciprocal : constant Fraction := (Right.Denominator, abs Right.Numerator, -Right.Exponent); begin if Right.Numerator = I.Zero then raise Constraint_Error; elsif Right.Numerator < I.Zero then return -(Left * Reciprocal); else return Left * Reciprocal; end if; end "/"; --------- -- "<" -- --------- function "<" (Left, Right : Fraction) return Boolean is Diff : constant Fraction := Left - Right; begin return Diff.Numerator < I.Zero; end "<"; ---------- -- "<=" -- ---------- function "<=" (Left, Right : Fraction) return Boolean is Diff : constant Fraction := Left - Right; begin return Diff.Numerator <= I.Zero; end "<="; --------- -- "=" -- --------- function "=" (Left, Right : Fraction) return Boolean is Diff : constant Fraction := Left - Right; begin return Diff.Numerator = I.Zero; end "="; --------- -- ">" -- --------- function ">" (Left, Right : Fraction) return Boolean is Diff : constant Fraction := Left - Right; begin return Diff.Numerator > I.Zero; end ">"; ---------- -- ">=" -- ---------- function ">=" (Left, Right : Fraction) return Boolean is Diff : constant Fraction := Left - Right; begin return Diff.Numerator >= I.Zero; end ">="; ----------- -- "abs" -- ----------- function "abs" (Left : Fraction) return Fraction is begin return (abs Left.Numerator, Left.Denominator, Left.Exponent); end "abs"; ----------- -- Image -- ----------- function Image (Left : Fraction) return String is begin return Image (Left.Numerator) & 'e' & Image (Left.Exponent) & '/' & Image (Left.Denominator); end Image; --------- -- Int -- --------- function Int (Value : I.Value) return Fraction is begin return (Value, I.One, I.Zero); end Int; --------- -- NOD -- --------- function NOD (X, Y : I.Value) return I.Value is U : I.Value := X; V : I.Value := Y; R : I.Value; begin while V /= I.Zero loop R := U mod V; U := V; V := R; end loop; return U; end NOD; -------------- -- Simplify -- -------------- procedure Simplify (X : in out Fraction) is N : I.Value; begin if X.Numerator = I.Zero then X := Zero; return; else N := NOD (abs X.Numerator, X.Denominator); end if; if N > I.One then X.Numerator := X.Numerator / N; X.Denominator := X.Denominator / N; end if; while X.Numerator mod Ten = I.Zero loop X.Numerator := X.Numerator / Ten; X.Exponent := X.Exponent + I.One; end loop; while X.Denominator mod Ten = I.Zero loop X.Denominator := X.Denominator / Ten; X.Exponent := X.Exponent - I.One; end loop; end Simplify; -------------- -- Truncate -- -------------- function Truncate (X : Fraction) return I.Value is begin if X.Exponent >= I.Zero then return X.Numerator * Ten ** X.Exponent / X.Denominator; else return X.Numerator / Ten ** (-X.Exponent) / X.Denominator; end if; end Truncate; ----------- -- Value -- ----------- function Value (Text : String) return Fraction is use Ada.Strings.Fixed; use Ada.Strings.Maps.Constants; Result : Fraction; Base : Positive := 10; Sharp : Natural := Index (Text, "#"); Dot : Natural := Index (Text, "."); E : Natural := Index (Text, "E", Mapping => Upper_Case_Map); function Count_Denominator (Text : String) return I.Value is Count : Natural := 0; begin for J in Text'Range loop if Text (J) /= '_' then Count := Count + 1; end if; end loop; return Val (Count); end Count_Denominator; begin if Sharp /= 0 then Base := Positive'Value (Text (Text'First .. Sharp - 1)); else Sharp := Text'First - 1; end if; if E = 0 then Result.Numerator := Literal (Text (Sharp + 1 .. Text'Last)); else Result.Numerator := Literal (Text (Sharp + 1 .. E - 1)); end if; if Base = 10 then if E = 0 then Result.Exponent := I.Zero - Count_Denominator (Text (Dot + 1 .. Text'Last)); else Result.Exponent := Literal (Text (E + 1 .. Text'Last)) - Count_Denominator (Text (Dot + 1 .. E - 1)); end if; Result.Denominator := I.One; else if E = 0 then Result.Denominator := Val (Base) ** Count_Denominator (Text (Dot + 1 .. Text'Last)); else Result.Denominator := Val (Base) ** Count_Denominator (Text (Dot + 1 .. E - 1)); end if; Result.Exponent := I.Zero; end if; Simplify (Result); return Result; end Value; end XASIS.Fractions; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
-- Contributed by ITEC - NXP Semiconductors -- June 2008 -- -- The Zip_Streams package defines an abstract stream -- type, Root_Zipstream_Type, with name, time and an index for random access. -- In addition, this package provides two ready - to - use derivations: -- -- - Memory_Zipstream, for using in - memory streaming -- -- - File_Zipstream, for accessing files -- -- Change log: -- ========== -- -- 20 - Jul - 2011 : GdM/JH : - Underscore in Get_Name, Set_Name, Get_Time, Set_Time -- - The 4 methods above are not anymore abstract -- - Name and Modification_Time fields moved to Root_Zipstream_Type -- - Unbounded_Stream becomes Memory_Zipstream -- - ZipFile_Stream becomes File_Zipstream -- 17 - Jul - 2011 : JH : Added Set_Unicode_Name_Flag, Is_Unicode_Name -- 25 - Nov - 2009 : GdM : Added an own time type - > it is possible to bypass Ada.Calendar -- 18 - Jan - 2009 : GdM : Fixed Zip_Streams.Read which did read -- only Item's first element with Ada.Streams; use Ada.Streams; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Calendar, Interfaces; package Zip_Streams is type Time is private; -- ^ we define an own Time (Ada.Calendar's body can be very time - consuming!) -- See subpackage Calendar below for own Split, Time_Of and Convert from/to -- Ada.Calendar.Time. ---------------------------------------------------- -- Root_Zipstream_Type : root abstract stream type -- ---------------------------------------------------- type Root_Zipstream_Type is abstract new Ada.Streams.Root_Stream_Type with private; type Zipstream_Class is access all Root_Zipstream_Type'Class; -- Set the index on the stream procedure Set_Index (S : access Root_Zipstream_Type; To : Positive) is abstract; -- returns the index of the stream function Index (S : access Root_Zipstream_Type) return Integer is abstract; -- returns the Size of the stream function Size (S : access Root_Zipstream_Type) return Integer is abstract; -- this procedure sets the name of the stream procedure Set_Name (S : access Root_Zipstream_Type; Stream_Name : String); procedure SetName (S : access Root_Zipstream_Type; Stream_Name : String) renames Set_Name; pragma Obsolescent (SetName); -- this procedure returns the name of the stream function Get_Name (S : access Root_Zipstream_Type) return String; function GetName (S : access Root_Zipstream_Type) return String renames Get_Name; pragma Obsolescent (GetName); procedure Set_Unicode_Name_Flag (S : access Root_Zipstream_Type; Value : Boolean); function Is_Unicode_Name (S : access Root_Zipstream_Type) return Boolean; -- this procedure sets the Modification_Time of the stream procedure Set_Time (S : access Root_Zipstream_Type; Modification_Time : Time); procedure SetTime (S : access Root_Zipstream_Type; Modification_Time : Time) renames Set_Time; pragma Obsolescent (SetTime); -- same, with the standard Time type procedure Set_Time (S : Zipstream_Class; Modification_Time : Ada.Calendar.Time); procedure SetTime (S : Zipstream_Class; Modification_Time : Ada.Calendar.Time) renames Set_Time; pragma Obsolescent (SetTime); -- this procedure returns the ModificationTime of the stream function Get_Time (S : access Root_Zipstream_Type) return Time; function GetTime (S : access Root_Zipstream_Type) return Time renames Get_Time; pragma Obsolescent (GetTime); -- same, with the standard Time type function Get_Time (S : Zipstream_Class) return Ada.Calendar.Time; function GetTime (S : Zipstream_Class) return Ada.Calendar.Time renames Get_Time; pragma Obsolescent (GetTime); -- returns true if the index is at the end of the stream, else false function End_Of_Stream (S : access Root_Zipstream_Type) return Boolean is abstract; --------------------------------------------------------------------- -- Unbounded_Stream : stream based on an in - memory Unbounded_String -- --------------------------------------------------------------------- type Memory_Zipstream is new Root_Zipstream_Type with private; subtype Unbounded_Stream is Memory_Zipstream; pragma Obsolescent (Unbounded_Stream); -- Get the complete value of the stream procedure Get (Str : Memory_Zipstream; Unb : out Unbounded_String); -- Set a value in the stream, the index will be set -- to null and old data in the stream will be lost. procedure Set (Str : in out Memory_Zipstream; Unb : Unbounded_String); -------------------------------------------- -- File_Zipstream : stream based on a file -- -------------------------------------------- type File_Zipstream is new Root_Zipstream_Type with private; subtype ZipFile_Stream is File_Zipstream; pragma Obsolescent (ZipFile_Stream); -- Open the File_Zipstream -- PRE : Str.Name must be set procedure Open (Str : in out File_Zipstream; Zipfile_Mode : File_Mode); -- Creates a file on the disk -- PRE : Str.Name must be set procedure Create (Str : in out File_Zipstream; Zipfile_Mode : File_Mode); -- Close the File_Zipstream procedure Close (Str : in out File_Zipstream); -------------------------- -- Routines around Time -- -------------------------- package Calendar is -- function Convert (date : Ada.Calendar.Time) return Time; function Convert (date : Time) return Ada.Calendar.Time; -- subtype DOS_Time is Interfaces.Unsigned_32; function Convert (date : DOS_Time) return Time; function Convert (date : Time) return DOS_Time; -- use Ada.Calendar; -- procedure Split (Date : Time; Year_Num : out Year_Number; Month_Num : out Month_Number; Day_Num : out Day_Number; No_of_Seconds : out Day_Duration); -- function Time_Of (Year_Num : Year_Number; Month_Num : Month_Number; Day_Num : Day_Number; No_of_Seconds : Day_Duration := 0.0) return Time; -- end Calendar; private type Time is new Interfaces.Unsigned_32; -- Currently : DOS format (pkzip appnote.txt : part V., J.), as stored -- in zip archives. Subject to change, this is why this type is private. some_time : constant Time := 16789 * 65536; type Root_Zipstream_Type is abstract new Ada.Streams.Root_Stream_Type with record Name : Unbounded_String; Modification_Time : Time := some_time; Is_Unicode_Name : Boolean := False; end record; -- Memory_Zipstream spec type Memory_Zipstream is new Root_Zipstream_Type with record Unb : Unbounded_String; Loc : Integer := 1; end record; -- Read data from the stream. overriding procedure Read (Zip_Stream : in out Memory_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); -- write data to the stream, starting from the current index. -- Data will be overwritten from index is already available. overriding procedure Write (Zip_Stream : in out Memory_Zipstream; Item : Stream_Element_Array); -- Set the index on the stream overriding procedure Set_Index (S : access Memory_Zipstream; To : Positive); -- returns the index of the stream overriding function Index (S : access Memory_Zipstream) return Integer; -- returns the Size of the stream overriding function Size (S : access Memory_Zipstream) return Integer; -- returns true if the index is at the end of the stream overriding function End_Of_Stream (S : access Memory_Zipstream) return Boolean; -- File_Zipstream spec type File_Zipstream is new Root_Zipstream_Type with record File : File_Type; end record; -- Read data from the stream. overriding procedure Read (Zip_Stream : in out File_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); -- write data to the stream, starting from the current index. -- Data will be overwritten from index is already available. overriding procedure Write (Zip_Stream : in out File_Zipstream; Item : Stream_Element_Array); -- Set the index on the stream overriding procedure Set_Index (S : access File_Zipstream; To : Positive); -- returns the index of the stream overriding function Index (S : access File_Zipstream) return Integer; -- returns the Size of the stream overriding function Size (S : access File_Zipstream) return Integer; -- returns true if the index is at the end of the stream overriding function End_Of_Stream (S : access File_Zipstream) return Boolean; end Zip_Streams;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_get_keyboard_control_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_get_keyboard_control_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_get_keyboard_control_request_t.Item, Element_Array => xcb.xcb_get_keyboard_control_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_get_keyboard_control_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_get_keyboard_control_request_t.Pointer, Element_Array => xcb.xcb_get_keyboard_control_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_get_keyboard_control_request_t;
with Ada.Text_IO; use Ada.Text_IO; procedure Test is function F return integer is begin put('b'); end; begin put('a'); end;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . S T O R A G E _ P O O L S . S U B P O O L S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2019, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Finalization; with System.Finalization_Masters; with System.Storage_Elements; package System.Storage_Pools.Subpools is pragma Preelaborate; type Root_Storage_Pool_With_Subpools is abstract new Root_Storage_Pool with private; -- The base for all implementations of Storage_Pool_With_Subpools. This -- type is Limited_Controlled by derivation. To use subpools, an access -- type must be associated with an implementation descending from type -- Root_Storage_Pool_With_Subpools. type Root_Subpool is abstract tagged limited private; -- The base for all implementations of Subpool. Objects of this type are -- managed by the pool_with_subpools. type Subpool_Handle is access all Root_Subpool'Class; for Subpool_Handle'Storage_Size use 0; -- Since subpools are limited types by definition, a handle is instead used -- to manage subpool abstractions. overriding procedure Allocate (Pool : in out Root_Storage_Pool_With_Subpools; Storage_Address : out System.Address; Size_In_Storage_Elements : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count); -- Allocate an object described by Size_In_Storage_Elements and Alignment -- on the default subpool of Pool. Controlled types allocated through this -- routine will NOT be handled properly. procedure Allocate_From_Subpool (Pool : in out Root_Storage_Pool_With_Subpools; Storage_Address : out System.Address; Size_In_Storage_Elements : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count; Subpool : not null Subpool_Handle) is abstract; -- ??? This precondition causes errors in simple tests, disabled for now -- with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access; -- This routine requires implementation. Allocate an object described by -- Size_In_Storage_Elements and Alignment on a subpool. function Create_Subpool (Pool : in out Root_Storage_Pool_With_Subpools) return not null Subpool_Handle is abstract; -- This routine requires implementation. Create a subpool within the given -- pool_with_subpools. overriding procedure Deallocate (Pool : in out Root_Storage_Pool_With_Subpools; Storage_Address : System.Address; Size_In_Storage_Elements : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count) is null; procedure Deallocate_Subpool (Pool : in out Root_Storage_Pool_With_Subpools; Subpool : in out Subpool_Handle) is abstract; -- This precondition causes errors in simple tests, disabled for now??? -- with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access; -- This routine requires implementation. Reclaim the storage a particular -- subpool occupies in a pool_with_subpools. This routine is called by -- Ada.Unchecked_Deallocate_Subpool. function Default_Subpool_For_Pool (Pool : in out Root_Storage_Pool_With_Subpools) return not null Subpool_Handle; -- Return a common subpool which is used for object allocations without a -- Subpool_Handle_Name in the allocator. The default implementation of this -- routine raises Program_Error. function Pool_Of_Subpool (Subpool : not null Subpool_Handle) return access Root_Storage_Pool_With_Subpools'Class; -- Return the owner of the subpool procedure Set_Pool_Of_Subpool (Subpool : not null Subpool_Handle; To : in out Root_Storage_Pool_With_Subpools'Class); -- Set the owner of the subpool. This is intended to be called from -- Create_Subpool or similar subpool constructors. Raises Program_Error -- if the subpool already belongs to a pool. overriding function Storage_Size (Pool : Root_Storage_Pool_With_Subpools) return System.Storage_Elements.Storage_Count is (System.Storage_Elements.Storage_Count'Last); private -- Model -- Pool_With_Subpools SP_Node SP_Node SP_Node -- +-->+--------------------+ +-----+ +-----+ +-----+ -- | | Subpools -------->| ------->| ------->| -------> -- | +--------------------+ +-----+ +-----+ +-----+ -- | |Finalization_Started|<------ |<------- |<------- |<--- -- | +--------------------+ +-----+ +-----+ +-----+ -- +--- Controller.Encl_Pool| | nul | | + | | + | -- | +--------------------+ +-----+ +--|--+ +--:--+ -- | : : Dummy | ^ : -- | : : | | : -- | Root_Subpool V | -- | +-------------+ | -- +-------------------------------- Owner | | -- FM_Node FM_Node +-------------+ | -- +-----+ +-----+<-- Master.Objects| | -- <------ |<------ | +-------------+ | -- +-----+ +-----+ | Node -------+ -- | ------>| -----> +-------------+ -- +-----+ +-----+ : : -- |ctrl | Dummy : : -- | obj | -- +-----+ -- -- SP_Nodes are created on the heap. FM_Nodes and associated objects are -- created on the pool_with_subpools. type Any_Storage_Pool_With_Subpools_Ptr is access all Root_Storage_Pool_With_Subpools'Class; for Any_Storage_Pool_With_Subpools_Ptr'Storage_Size use 0; -- A pool controller is a special controlled object which ensures the -- proper initialization and finalization of the enclosing pool. type Pool_Controller (Enclosing_Pool : Any_Storage_Pool_With_Subpools_Ptr) is new Ada.Finalization.Limited_Controlled with null record; -- Subpool list types. Each pool_with_subpools contains a list of subpools. -- This is an indirect doubly linked list since subpools are not supposed -- to be allocatable by language design. type SP_Node; type SP_Node_Ptr is access all SP_Node; type SP_Node is record Prev : SP_Node_Ptr := null; Next : SP_Node_Ptr := null; Subpool : Subpool_Handle := null; end record; -- Root_Storage_Pool_With_Subpools internal structure. The type uses a -- special controller to perform initialization and finalization actions -- on itself. This is necessary because the end user of this package may -- decide to override Initialize and Finalize, thus disabling the desired -- behavior. -- Pool_With_Subpools SP_Node SP_Node SP_Node -- +-->+--------------------+ +-----+ +-----+ +-----+ -- | | Subpools -------->| ------->| ------->| -------> -- | +--------------------+ +-----+ +-----+ +-----+ -- | |Finalization_Started| : : : : : : -- | +--------------------+ -- +--- Controller.Encl_Pool| -- +--------------------+ -- : End-user : -- : components : type Root_Storage_Pool_With_Subpools is abstract new Root_Storage_Pool with record Subpools : aliased SP_Node; -- A doubly linked list of subpools Finalization_Started : Boolean := False; pragma Atomic (Finalization_Started); -- A flag which prevents the creation of new subpools while the master -- pool is being finalized. The flag needs to be atomic because it is -- accessed without Lock_Task / Unlock_Task. Controller : Pool_Controller (Root_Storage_Pool_With_Subpools'Unchecked_Access); -- A component which ensures that the enclosing pool is initialized and -- finalized at the appropriate places. end record; -- A subpool is an abstraction layer which sits on top of a pool. It -- contains links to all controlled objects allocated on a particular -- subpool. -- Pool_With_Subpools SP_Node SP_Node SP_Node -- +-->+----------------+ +-----+ +-----+ +-----+ -- | | Subpools ------>| ------->| ------->| -------> -- | +----------------+ +-----+ +-----+ +-----+ -- | : :<------ |<------- |<------- | -- | : : +-----+ +-----+ +-----+ -- | |null | | + | | + | -- | +-----+ +--|--+ +--:--+ -- | | ^ : -- | Root_Subpool V | -- | +-------------+ | -- +---------------------------- Owner | | -- +-------------+ | -- .......... Master | | -- +-------------+ | -- | Node -------+ -- +-------------+ -- : End-user : -- : components : type Root_Subpool is abstract tagged limited record Owner : Any_Storage_Pool_With_Subpools_Ptr := null; -- A reference to the master pool_with_subpools Master : aliased System.Finalization_Masters.Finalization_Master; -- A heterogeneous collection of controlled objects Node : SP_Node_Ptr := null; -- A link to the doubly linked list node which contains the subpool. -- This back pointer is used in subpool deallocation. end record; procedure Adjust_Controlled_Dereference (Addr : in out System.Address; Storage_Size : in out System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count); -- Given the memory attributes of a heap-allocated object that is known to -- be controlled, adjust the address and size of the object to include the -- two hidden pointers inserted by the finalization machinery. -- ??? Once Storage_Pools.Allocate_Any is removed, this should be renamed -- to Allocate_Any. procedure Allocate_Any_Controlled (Pool : in out Root_Storage_Pool'Class; Context_Subpool : Subpool_Handle; Context_Master : Finalization_Masters.Finalization_Master_Ptr; Fin_Address : Finalization_Masters.Finalize_Address_Ptr; Addr : out System.Address; Storage_Size : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count; Is_Controlled : Boolean; On_Subpool : Boolean); -- Compiler interface. This version of Allocate handles all possible cases, -- either on a pool or a pool_with_subpools, regardless of the controlled -- status of the allocated object. Parameter usage: -- -- * Pool - The pool associated with the access type. Pool can be any -- derivation from Root_Storage_Pool, including a pool_with_subpools. -- -- * Context_Subpool - The subpool handle name of an allocator. If no -- subpool handle is present at the point of allocation, the actual -- would be null. -- -- * Context_Master - The finalization master associated with the access -- type. If the access type's designated type is not controlled, the -- actual would be null. -- -- * Fin_Address - TSS routine Finalize_Address of the designated type. -- If the designated type is not controlled, the actual would be null. -- -- * Addr - The address of the allocated object. -- -- * Storage_Size - The size of the allocated object. -- -- * Alignment - The alignment of the allocated object. -- -- * Is_Controlled - A flag which determines whether the allocated object -- is controlled. When set to True, the machinery generates additional -- data. -- -- * On_Subpool - A flag which determines whether the a subpool handle -- name is present at the point of allocation. This is used for error -- diagnostics. procedure Deallocate_Any_Controlled (Pool : in out Root_Storage_Pool'Class; Addr : System.Address; Storage_Size : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count; Is_Controlled : Boolean); -- Compiler interface. This version of Deallocate handles all possible -- cases, either from a pool or a pool_with_subpools, regardless of the -- controlled status of the deallocated object. Parameter usage: -- -- * Pool - The pool associated with the access type. Pool can be any -- derivation from Root_Storage_Pool, including a pool_with_subpools. -- -- * Addr - The address of the allocated object. -- -- * Storage_Size - The size of the allocated object. -- -- * Alignment - The alignment of the allocated object. -- -- * Is_Controlled - A flag which determines whether the allocated object -- is controlled. When set to True, the machinery generates additional -- data. procedure Detach (N : not null SP_Node_Ptr); -- Unhook a subpool node from an arbitrary subpool list overriding procedure Finalize (Controller : in out Pool_Controller); -- Buffer routine, calls Finalize_Pool procedure Finalize_Pool (Pool : in out Root_Storage_Pool_With_Subpools); -- Iterate over all subpools of Pool, detach them one by one and finalize -- their masters. This action first detaches a controlled object from a -- particular master, then invokes its Finalize_Address primitive. function Header_Size_With_Padding (Alignment : System.Storage_Elements.Storage_Count) return System.Storage_Elements.Storage_Count; -- Given an arbitrary alignment, calculate the size of the header which -- precedes a controlled object as the nearest multiple rounded up of the -- alignment. overriding procedure Initialize (Controller : in out Pool_Controller); -- Buffer routine, calls Initialize_Pool procedure Initialize_Pool (Pool : in out Root_Storage_Pool_With_Subpools); -- Setup the doubly linked list of subpools procedure Print_Pool (Pool : Root_Storage_Pool_With_Subpools); -- Debug routine, output the contents of a pool_with_subpools procedure Print_Subpool (Subpool : Subpool_Handle); -- Debug routine, output the contents of a subpool end System.Storage_Pools.Subpools;
-- C52010A.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 RECORD ASSIGNMENTS USE "COPY" SEMANTICS. (PART I). -- FACTORS AFFECTING THE SITUATION TO BE TESTED: -- -- COMPONENT TYPE * INTEGER -- * BOOLEAN (OMITTED) -- * CHARACTER (OMITTED) -- * USER-DEFINED ENUMERATION -- -- DERIVED VS. NON-DERIVED -- -- TYPE VS. SUBTYPE -- -- ORDER OF COMPONENT ASSIGNMENTS * LEFT-TO-RIGHT -- * RIGHT-TO-LEFT -- * INSIDE-OUT -- * OUTSIDE IN -- RM 02/23/80 -- SPS 3/21/83 WITH REPORT; PROCEDURE C52010A IS USE REPORT; TYPE ENUM IS ( AA , BB , CC , DD , EE , FF , GG , HH , II , JJ , KK , LL , MM , NN , PP , QQ , TT , UU , VV , WW , XX , YY ); BEGIN TEST ( "C52010A" , "CHECK THAT RECORD ASSIGNMENTS USE ""COPY""" & " SEMANTICS" ); DECLARE TYPE REC IS RECORD X , Y : INTEGER ; END RECORD; R : REC ; BEGIN R := ( 5 , 8 ) ; R := ( X => 1 , Y => R.X ) ; IF R /= ( 1 , 5 ) THEN FAILED ( "WRONG VALUE (1)" ); END IF; R := ( 5 , 8 ) ; R := ( Y => 1 , X => R.Y ) ; IF R /= ( 8 , 1 ) THEN FAILED ( "WRONG VALUE (2)" ); END IF; R := ( 5 , 8 ) ; R := ( R.Y+1 , R.X+1 ) ; IF R /= ( 9 , 6 ) THEN FAILED ( "WRONG VALUE (3)" ); END IF; END; DECLARE TYPE REC3 IS RECORD DEEP0 : INTEGER ; DEEP : INTEGER ; END RECORD; TYPE REC2 IS RECORD YX : REC3 ; MODERATE : INTEGER ; END RECORD; TYPE REC IS RECORD SHALLOW : INTEGER ; YZ : REC2 ; END RECORD; R : REC ; BEGIN R := ( 0 , ((5, 1 ), 2 )); R := ( R.YZ.MODERATE+8, ((7, R.SHALLOW+1),R.YZ.YX.DEEP+99)); IF R/= ( 10, ((7, 1), 100)) THEN FAILED ( "WRONG VALUE (4)" ); END IF; END; DECLARE TYPE SUB_ENUM IS NEW ENUM RANGE AA..DD ; TYPE REC IS RECORD X , Y : SUB_ENUM ; END RECORD; R : REC ; BEGIN R := ( AA , CC ) ; R := ( X => BB , Y => R.X ) ; IF R /= ( BB , AA ) THEN FAILED ( "WRONG VALUE (5)" ); END IF; R := ( AA , CC ) ; R := ( Y => BB , X => R.Y ) ; IF R /= ( CC , BB ) THEN FAILED ( "WRONG VALUE (6)" ); END IF; R := ( AA , CC ) ; R := ( SUB_ENUM'SUCC( R.Y ) , SUB_ENUM'SUCC( R.X ) ) ; IF R /= ( DD , BB ) THEN FAILED ( "WRONG VALUE (7)" ); END IF; END; DECLARE TYPE REC3 IS RECORD DEEP0 : ENUM ; DEEP : ENUM ; END RECORD; TYPE REC2 IS RECORD YX : REC3 ; MODERATE : ENUM ; END RECORD; TYPE REC IS RECORD SHALLOW : ENUM ; YZ : REC2 ; END RECORD; R : REC ; BEGIN R := ( TT , (( YY , II ) , AA ) ) ; R := ( ENUM'SUCC(ENUM'SUCC( R.YZ.MODERATE )) , (( AA , ENUM'SUCC( R.SHALLOW ) ) , ( ENUM'SUCC(ENUM'SUCC(ENUM'SUCC(ENUM'SUCC( R.YZ.YX.DEEP )))) ) ) ) ; IF R/= ( CC , (( AA , UU ) , MM ) ) THEN FAILED ( "WRONG VALUE (8)" ); END IF; END; RESULT ; END C52010A ;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . C P U _ P R I M I T I V E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2004 The European Space Agency -- -- Copyright (C) 2003-2021, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------ -- This package contains the primitives which are dependent on the -- underlying processor. pragma Restrictions (No_Elaboration_Code); with System; with System.Storage_Elements; with System.BB.Parameters; package System.BB.CPU_Primitives is pragma Preelaborate; type Word is mod 2**System.Word_Size; ------------------------ -- Context management -- ------------------------ -- The context buffer is an abstract type that holds all values indexed by -- Context_Id that make up a thread's state which are not otherwise stored -- in main memory. This typically includes all user-visible registers, and -- possibly some other status as well. -- In case different contexts have different amounts of state (for example, -- due to absence of a floating-point unit in a particular configuration, -- or just the FPU not being used), it is expected that these details -- are handled in the implementation, which should ignore updates of -- unsupported state and return a default value for queries of such state. type Context_Buffer is private; type Context_Id is range 0 .. Parameters.Context_Buffer_Capacity - 1; -- Type used for accessing to the different elements in the context buffer procedure Context_Switch; pragma Inline (Context_Switch); -- Perform the context switch between the running_thread and the -- first_thread. The value of running_thread will be updated. function Get_Context (Context : Context_Buffer; Index : Context_Id) return Word; pragma Inline (Get_Context); -- Returns item of the specified context procedure Set_Context (Context : in out Context_Buffer; Index : Context_Id; Value : Word); pragma Inline (Set_Context); -- Updates the given context. procedure Initialize_Context (Buffer : not null access Context_Buffer; Program_Counter : System.Address; Argument : System.Address; Stack_Pointer : System.Address); pragma Inline (Initialize_Context); -- Initialize_Context initializes the context buffer with the default -- values for each register. The values for program counter, the argument -- to be passed and the stack pointer are provided as parameters. procedure Initialize_Stack (Base : Address; Size : Storage_Elements.Storage_Offset; Stack_Pointer : out Address); -- Initialize a stack which spans BASE .. BASE + SIZE - 1. Set -- STACK_POINTER to the address to be used by the processor. --------------------------------- -- Interrupt and trap handling -- --------------------------------- type Vector_Id is range 0 .. Parameters.Trap_Vectors - 1; procedure Install_Error_Handlers; pragma Inline (Install_Error_Handlers); -- Called at system initialization time to install a CPU specific -- trap handler, GNAT_Error_Handler, that converts synchronous traps -- to appropriate exceptions. procedure Install_Trap_Handler (Service_Routine : System.Address; Vector : Vector_Id; Synchronous : Boolean := False); -- Install a new handler in the trap table, both for synchronous and -- asynchronous traps. Interrupts must be disabled before the trap -- handler is called. procedure Disable_Interrupts; pragma Inline (Disable_Interrupts); -- All external interrupts (asynchronous traps) are disabled. Note -- that this will take care of the CPU specific part of enabling and -- disabling the interrupts. For systems were this is not sufficient, the -- Board_Support.Set_Current_Priority routine must also be implemented in -- order to do the board-specific enable/disable operations. procedure Enable_Interrupts (Level : Integer); pragma Inline (Enable_Interrupts); -- Interrupts are enabled if they are above the value given by Level procedure Initialize_CPU; pragma Inline (Initialize_CPU); -- Set the CPU up to use the proper stack for interrupts, initialize and -- enable system trap handlers. private Context_Buffer_Size : constant := Parameters.Context_Buffer_Capacity * System.Word_Size; -- Size calculated taking into account that the components are 32-bit, and -- that we want them aligned on 64-bit boundaries. type Context_Buffer is array (Context_Id) of System.Address; for Context_Buffer'Size use Context_Buffer_Size; for Context_Buffer'Alignment use 8; -- This array contains all the registers that the thread needs to save -- within its thread descriptor. Using double word boundaries allows us -- to use double word loads and stores safely in the context switch. end System.BB.CPU_Primitives;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Web_Services.SOAP.Messages; with League.Strings; package Web_Services.SOAP.Modules is type Abstract_SOAP_Module is abstract tagged limited null record; type SOAP_Module_Access is access all Abstract_SOAP_Module'Class; not overriding procedure Receive_Request (Self : in out Abstract_SOAP_Module; Message : in out Web_Services.SOAP.Messages.SOAP_Message; Output : in out Web_Services.SOAP.Messages.SOAP_Message_Access) is abstract; not overriding procedure Send_Request (Self : in out Abstract_SOAP_Module; Message : in out Web_Services.SOAP.Messages.SOAP_Message; User : League.Strings.Universal_String; Password : League.Strings.Universal_String) is abstract; -- Sending request to server from client's part end Web_Services.SOAP.Modules;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. with Ada.Text_IO; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names; with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package; with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package; with Words_Engine.English_Support_Package; use Words_Engine.English_Support_Package; with Weed; with Weed_All; with Support_Utils.Dictionary_Form; with Latin_Utils.General; use Latin_Utils; procedure Makeewds is package Integer_IO is new Ada.Text_IO.Integer_IO (Integer); use Ada.Text_IO; use Integer_IO; use Dictionary_Entry_IO; use Part_Entry_IO; use Part_Of_Speech_Type_IO; use Age_Type_IO; use Area_Type_IO; use Geo_Type_IO; use Frequency_Type_IO; use Source_Type_IO; use Ewds_Record_Io; Porting : constant Boolean := False; Checking : constant Boolean := True; D_K : Dictionary_Kind := Xxx; -- ###################### Start_Stem_1 : constant := 1; Start_Stem_2 : constant := Start_Stem_1 + Max_Stem_Size + 1; Start_Stem_3 : constant := Start_Stem_2 + Max_Stem_Size + 1; Start_Stem_4 : constant := Start_Stem_3 + Max_Stem_Size + 1; Start_Part : constant := Start_Stem_4 + Max_Stem_Size + 1; Line_Number : Integer := 0; subtype Line_Type is String (1 .. 400); N : Integer := 0; Input, Output, Check : Ada.Text_IO.File_Type; De : Dictionary_Entry; S, Line : Line_Type := (others => ' '); Blank_Line : constant Line_Type := (others => ' '); L, Last : Integer := 0; Ewa : Ewds_Array (1 .. 40) := (others => Null_Ewds_Record); Ewr : Ewds_Record := Null_Ewds_Record; -- First we supplement MEAN with singles of any hyphenated words -- In principle this could be done in the main EXTRACT, much same logic/code -- However this is difficult code for an old man, EXTRACT was hard -- when I was a bit younger, and I cannot remember anything about it. -- Separating them out makes it much easier to test function Add_Hyphenated (S : String) return String is -------- I tried to do something with hyphenated but so far it -------- does not work -- Find hyphenated words and add them to MEAN with a / connector, -- right before the parse so one has both the individual words (may -- be more than two) and a single combined word -- counting-board -> counting board/countingboard -- Cannot be bigger: T : String (1 .. Max_Meaning_Size * 2 + 20) := (others => ' '); Word_Start : Integer := 1; Word_End : Integer := 0; I, J, Jmax : Integer := 0; Hyphenated : Boolean := False; begin --PUT_LINE (S); while I < S'Last loop I := I + 1; J := J + 1; Word_End := 0; --PUT (INTEGER'IMAGE (I) & "-"); -- First clear away or ignore all the non-words stuff if S (I) = '|' then -- Skip continuation |'s Word_Start := I + 1; T (J) := S (I); J := J + 1; Jmax := Jmax + 1; null; I := I + 1; elsif S (I) = '"' then -- Skip "'S Word_Start := I + 1; T (J) := S (I); J := J + 1; Jmax := Jmax + 1; null; I := I + 1; else if S (I) = '(' then -- ( .. .) not to be parsed T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; while S (I) /= ')' loop T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; end loop; Word_Start := I + 2; -- Skip }; Word_End := 0; elsif S (I) = '[' then -- ( .. .) not to be parsed T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; while S (I - 1 .. I) /= "=>" loop T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; end loop; Word_Start := I + 2; Word_End := 0; end if; -- Finished with the non-word stuff if S (I) = '-' then Word_End := I - 1; -- if (I /= S'FIRST) and then -- Not -word -- ( (S (I-1) /= ' ') and -- (S (I-1) /= '/') ) then -- HYPHENATED := TRUE; -- end if; end if; if S (I) = ' ' or S (I) = '/' or S (I) = ',' or S (I) = ';' or S (I) = '!' or S (I) = '?' or S (I) = '+' or S (I) = '*' or S (I) = '"' or S (I) = '(' then Word_End := I - 1; if Hyphenated then T (J) := '/'; J := J + 1; Jmax := Jmax + 1; for K in Word_Start .. Word_End loop if S (K) /= '-' then T (J) := S (K); J := J + 1; Jmax := Jmax + 1; end if; end loop; Hyphenated := False; end if; end if; if --WORD_END /= 0 and then S (I) = ' ' or S (I) = '/' then Word_Start := I + 1; Word_End := 0; end if; end if; -- On '|' -- Set up the Output to return --PUT ('|' & INTEGER'IMAGE (J) & '/' & INTEGER'IMAGE (I)); T (J) := S (I); Jmax := Jmax + 1; end loop; -- Over S'RANGE return T (1 .. Jmax); exception when others => Put_Line ("ADD_HYPHENATED Exception LINE = " & Integer'Image (Line_Number)); Put_Line (S); Put (De); New_Line; return T (1 .. Jmax); end Add_Hyphenated; procedure Extract_Words (S : in String; Pofs : in Part_Of_Speech_Type; N : out Integer; Ewa : out Ewds_Array) is -- i, j, js, k, l, m, im, ic : Integer := 0; J, K, L, M, Im, Ic : Integer := 0; End_Semi : constant Integer := 1; -- Have to expand type to take care of hyphenated subtype X_Meaning_Type is String (1 .. Max_Meaning_Size * 2 + 20); Null_X_Meaning_Type : constant X_Meaning_Type := (others => ' '); Semi, Comma : X_Meaning_Type := Null_X_Meaning_Type; Ww : Integer := 0; -- For debug begin -- i := 1; -- Element Position in line, per SEMI J := 1; -- Position in word K := 0; -- SEMI - Division in line L := 1; -- Position in MEAN, for EXTRACTing SEMI M := 1; -- COMMA in SEMI N := 1; -- Word number Im := 0; -- Position in SEMI Ic := 0; -- Position in COMMA Ewa (N) := Null_Ewds_Record; -- Slightly disparage extension if S (S'First) = '|' then K := 3; end if; while L <= S'Last loop -- loop over MEAN if S (L) = ' ' then -- Clear initial blanks L := L + 1; end if; Semi := Null_X_Meaning_Type; Im := 1; Extract_Semi : loop if S (L) = '|' then null; -- Ignore continuation flag | as word elsif S (L) in '0' .. '9' then null; -- Ignore numbers elsif S (L) = ';' then -- Division Terminator K := K + 1; --PUT ('+'); L := L + 1; -- Clear ; exit Extract_Semi; elsif S (L) = '(' then -- Skip ( .. .) ! while S (L) /= ')' loop --PUT ('+'); --PUT (INTEGER'IMAGE (L)); --PUT (S (L)); exit when L = S'Last; -- Run out L := L + 1; end loop; -- L := L + 1; -- Clear the ')' --PUT ('^'); --PUT (INTEGER'IMAGE (L)); --PUT (S (L)); if L > S'Last then L := S'Last; else if S (L) = ';' then -- ); exit Extract_Semi; end if; end if; --PUT (']'); if L >= S'Last then -- Ends in ) -- PUT ('!'); exit Extract_Semi; end if; --PUT ('+'); --L := L + 1; -- Clear the ')' elsif L = S'Last then --PUT ('|'); L := L + 1; -- To end the loop exit Extract_Semi; else Semi (Im) := S (L); Im := Im + 1; end if; --PUT ('+'); --IM := IM + 1; -- To next Character L := L + 1; -- To next Character end loop Extract_Semi; Ww := 10; Process_Semi : declare St : constant String := Trim (Semi); Sm : constant String (St'First .. St'Last) := St; begin if St'Length > 0 then Comma := Null_X_Meaning_Type; Im := Sm'First; M := 0; --I := SM'FIRST; --while I <= ST'LAST loop --PUT (S (I)); --PUT ('*'); --COMMA := NULL_X_MEANING_TYPE; Ic := 1; Loop_Over_Semi : while Im <= Sm'Last loop Comma := Null_X_Meaning_Type; Ww := 20; Find_Comma : loop --PUT (INTEGER'IMAGE (IM) & " ( " & SM (IM)); if Sm (Im) = '(' then -- Skip ( .. .) ! while Sm (Im) /= ')' loop Im := Im + 1; end loop; Im := Im + 1; -- Clear the ')' -- IM := IM + 1; -- Go to next Character if Im >= End_Semi then exit Find_Comma; end if; if (Sm (Im) = ';') or (Sm (Im) = ',') then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear ;, exit Find_Comma; elsif Sm (Im) = ' ' then Im := Im + 1; end if; --PUT_LINE ("------------------------"); end if; if Sm (Im) = '[' then -- Take end of [=>] while Sm (Im) /= '>' loop exit when Sm (Im) = ']'; -- If no > Im := Im + 1; end loop; Im := Im + 1; -- Clear the '>' or ']' if Sm (Im) = ';' then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear ; exit Find_Comma; elsif Sm (Im) = ' ' then Im := Im + 1; end if; end if; -- But could be 2 =>! --PUT_LINE ("Through ()[] I = " & INTEGER'IMAGE (I)); exit Find_Comma when Im > Sm'Last; --PUT (INTEGER'IMAGE (IM) & " ) " & SM (IM)); if Sm (Im) = ',' then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear , exit Find_Comma; elsif Im >= Sm'Last or Im = S'Last then -- Foumd COMMA Comma (Ic) := Sm (Im); M := M + 1; Ic := 1; exit Find_Comma; else Comma (Ic) := Sm (Im); Im := Im + 1; Ic := Ic + 1; end if; --PUT (INTEGER'IMAGE (IM) & " ! " & SM (IM)); end loop Find_Comma; Im := Im + 1; Ww := 30; Process_Comma : declare Ct : constant String := Trim (Comma); Cs : String (Ct'First .. Ct'Last) := Ct; Pure : Boolean := True; W_Start, W_End : Integer := 0; begin Ww := 31; if Ct'Length > 0 then -- Is COMMA non empty -- Are there any blanks? -- If not then it is a pure word -- Or words with / for Ip in Cs'Range loop if Cs (Ip) = ' ' then Pure := False; end if; end loop; Ww := 32; -- Check for WEED words and eliminate them W_Start := Cs'First; W_End := Cs'Last; for Iw in Cs'Range loop --PUT ('-'); --PUT (CS (IW)); if (Cs (Iw) = '(') or (Cs (Iw) = '[') then Ww := 33; W_Start := Iw + 1; else Ww := 34; if (Cs (Iw) = ' ') or (Cs (Iw) = '_') or (Cs (Iw) = '-') or (Cs (Iw) = ''') or (Cs (Iw) = '!') or (Cs (Iw) = '/') or (Cs (Iw) = ':') or (Cs (Iw) = '.') or (Cs (Iw) = '!') or (Cs (Iw) = ')') or (Cs (Iw) = ']') or (Iw = Cs'Last) then Ww := 35; if Iw = Cs'Last then W_End := Iw; elsif Iw /= Cs'First then W_End := Iw - 1; end if; Ww := 36; -- KLUDGE if Cs (W_Start) = '"' then Ww := 361; W_Start := W_Start + 1; Ww := 362; elsif Cs (W_End) = '"' then Ww := 364; W_End := W_End - 1; Ww := 365; end if; Ww := 37; --& " " & CS (W_START .. W_END) --); Weed_All (Cs (W_Start .. W_End)); if not Pure then Weed (Cs (W_Start .. W_End), Pofs); end if; W_Start := Iw + 1; end if; Ww := 38; end if; Ww := 39; end loop; -- On CS'RANGE --PUT_LINE (INTEGER'IMAGE (LINE_NUMBER) & "WEED done"); Ww := 40; -- Main process of COMMA Ic := 1; J := 1; while Ic <= Cs'Last loop --PUT (CS (IC)); if Cs (Ic) = '"' or -- Skip all " Cs (Ic) = '(' or -- Skip initial ( Cs (Ic) = '?' or -- Ignore ? Cs (Ic) = '~' or -- Ignore about ~ Cs (Ic) = '*' or Cs (Ic) = '%' or -- Ignore % unless word Cs (Ic) = '.' or -- Ignore . .. Cs (Ic) = '\' or -- Ignore weed (Cs (Ic) in '0' .. '9') then -- Skip numbers Ic := Ic + 1; Ww := 50; ----PUT ('-'); else if Cs (Ic) = '/' or Cs (Ic) = ' ' or Cs (Ic) = ''' or -- Ignore all ' incl 's ??? Cs (Ic) = '-' or -- Hyphen causes 2 words XXX Cs (Ic) = '+' or -- Plus causes 2 words Cs (Ic) = '_' or -- Underscore causes 2 words Cs (Ic) = '=' or -- = space/terminates Cs (Ic) = '>' or Cs (Ic) = ')' or Cs (Ic) = ']' or Cs (Ic) = '!' or Cs (Ic) = '?' or Cs (Ic) = '+' or Cs (Ic) = ':' or Cs (Ic) = ']' then -- Found word Ww := 60; --PUT ('/'); Ewa (N).Semi := K; if Pure then if K = 1 then Ewa (N).Kind := 15; else Ewa (N).Kind := 10; end if; else Ewa (N).Kind := 0; end if; Ww := 70; N := N + 1; -- Start new word in COMMA Ic := Ic + 1; J := 1; Ewa (N) := Null_Ewds_Record; elsif Ic = Cs'Last then -- Order of if important -- End, Found word --PUT ('!'); Ewa (N).W (J) := Cs (Ic); Ewa (N).Semi := K; if Pure then if K = 1 then Ewa (N).Kind := 15; else Ewa (N).Kind := 10; end if; else Ewa (N).Kind := 0; end if; N := N + 1; -- Start new word/COMMA Ewa (N) := Null_Ewds_Record; exit; else Ww := 80; --PUT ('+'); Ewa (N).W (J) := Cs (Ic); J := J + 1; Ic := Ic + 1; end if; end if; Ww := 90; end loop; end if; -- On COMMA being empty end Process_Comma; --PUT_LINE ("COMMA Processed "); end loop Loop_Over_Semi; --PUT_LINE ("LOOP OVER SEMI Processed "); end if; -- On ST'LENGTH > 0 --PUT_LINE ("LOOP OVER SEMI after ST'LENGTH 0 "); end Process_Semi; --PUT_LINE ("SEMI Processed "); -- I = " & INTEGER'IMAGE (I) --& " S (I) = " & S (I) --); if (L < S'Last) and then (S (L) = ';') then -- ?????? --PUT_LINE ("Clear L = " & INTEGER'IMAGE (L)); L := L + 1; end if; -- investigate this: -- js := l; -- Odd but necessary ????? for J in L .. S'Last loop exit when J = S'Last; if S (J) = ' ' then L := L + 1; else exit; end if; end loop; exit when L >= S'Last; end loop; -- loop over MEAN --PUT_LINE ("SEMI loop Processed"); DROP_DUPES : for Z in Ewa'Range loop if Ewa (Z).W /= Null_Eword then INNER_LOOP : for ZZ in (Z + 1) .. Ewa'Last loop if Ewa (Z).W = Ewa (ZZ).W then Ewa (ZZ).W := Null_Eword; end if; end loop INNER_LOOP; end if; end loop DROP_DUPES; if Ewa (N) = Null_Ewds_Record then N := N - 1; -- Clean up danglers end if; if Ewa (N) = Null_Ewds_Record then -- AGAIN!!!!!! N := N - 1; -- Clean up danglers end if; exception when others => if (S (S'Last) /= ')') or (S (S'Last) /= ']') then -- KLUDGE New_Line; Put_Line ("Extract Exception WW = " & Integer'Image (Ww) & " LINE = " & Integer'Image (Line_Number)); Put_Line (S); Put (De); New_Line; end if; end Extract_Words; begin Put_Line ("Takes a DICTLINE.D_K and produces a EWDSLIST.D_K "); Latin_Utils.General.Load_Dictionary (Line, Last, D_K); Open (Input, In_File, Add_File_Name_Extension (Dict_Line_Name, Dictionary_Kind'Image (D_K))); --PUT_LINE ("OPEN"); if not Porting then --PUT_LINE ("CREATING"); Create (Output, Out_File, Add_File_Name_Extension ("EWDSLIST", Dictionary_Kind'Image (D_K))); if Checking then Create (Check, Out_File, "CHECKEWD."); end if; --PUT_LINE ("CREATED"); end if; -- Now do the rest Over_Lines : while not End_Of_File (Input) loop S := Blank_Line; Get_Line (Input, S, Last); if Trim (S (1 .. Last)) /= "" then -- If non-blank line L := 0; Form_De : begin De.Stems (1) := S (Start_Stem_1 .. Max_Stem_Size); --NEW_LINE; PUT (DE.STEMS (1)); De.Stems (2) := S (Start_Stem_2 .. Start_Stem_2 + Max_Stem_Size - 1); De.Stems (3) := S (Start_Stem_3 .. Start_Stem_3 + Max_Stem_Size - 1); De.Stems (4) := S (Start_Stem_4 .. Start_Stem_4 + Max_Stem_Size - 1); --PUT ('#'); PUT (INTEGER'IMAGE (L)); PUT (INTEGER'IMAGE (LAST)); --PUT ('@'); Get (S (Start_Part .. Last), De.Part, L); --PUT ('%'); PUT (INTEGER'IMAGE (L)); PUT (INTEGER'IMAGE (LAST)); --PUT ('&'); PUT (S (L+1 .. LAST)); PUT ('3'); --GET (S (L+1 .. LAST), DE.PART.POFS, DE.KIND, L); -- FIXME: Why not Translation_Record_IO.Put ? Get (S (L + 1 .. Last), De.Tran.Age, L); Get (S (L + 1 .. Last), De.Tran.Area, L); Get (S (L + 1 .. Last), De.Tran.Geo, L); Get (S (L + 1 .. Last), De.Tran.Freq, L); Get (S (L + 1 .. Last), De.Tran.Source, L); De.Mean := Head (S (L + 2 .. Last), Max_Meaning_Size); -- Note that this allows initial blanks -- L+2 skips over the SPACER, required because -- this is STRING, not ENUM exception when others => New_Line; Put_Line ("GET Exception LAST = " & Integer'Image (Last)); Put_Line (S (1 .. Last)); Integer_IO.Put (Line_Number); New_Line; Put (De); New_Line; end Form_De; Line_Number := Line_Number + 1; if De.Part.Pofs = V and then De.Part.V.Con.Which = 8 then -- V 8 is a kludge for variant forms of verbs -- that have regular forms elsewhere null; else -- Extract words Extract_Words (Add_Hyphenated (Trim (De.Mean)), De.Part.Pofs, N, Ewa); -- EWORD_SIZE : constant := 38; -- AUX_WORD_SIZE : constant := 9; -- LINE_NUMBER_WIDTH : constant := 10; -- -- type EWDS_RECORD is -- record -- POFS : PART_OF_SPEECH_TYPE := X; -- W : STRING (1 .. EWORD_SIZE); -- AUX : STRING (1 .. AUX_WORD_SIZE); -- N : INTEGER; -- end record; for I in 1 .. N loop if Trim (Ewa (I).W)'Length /= 0 then Ewr.W := Head (Trim (Ewa (I).W), Eword_Size); Ewr.Aux := Head ("", Aux_Word_Size); Ewr.N := Line_Number; Ewr.Pofs := De.Part.Pofs; Ewr.Freq := De.Tran.Freq; Ewr.Semi := Ewa (I).Semi; Ewr.Kind := Ewa (I).Kind; Ewr.Rank := 80 - Frequency_Type'Pos (Ewr.Freq) * 10 + Ewr.Kind + (Ewr.Semi - 1) * (-3); if Ewr.Freq = Inflections_Package.N then Ewr.Rank := Ewr.Rank + 25; end if; --PUT (EWA (I)); NEW_LINE; --PUT (EWR); NEW_LINE; Put (Output, Ewr); -- SET_COL (OUTPUT, 71); -- INTEGER_IO.PUT (OUTPUT, I, 2); New_Line (Output); if Checking then -- Now make the CHECK file Put (Check, Ewr.W); Set_Col (Check, 25); declare Df : constant String := Support_Utils.Dictionary_Form (De); Ii : Integer := 1; begin if Df'Length > 0 then while Df (Ii) /= ' ' and Df (Ii) /= '.' and Df (Ii) /= ',' loop Put (Check, Df (Ii)); Ii := Ii + 1; exit when Ii = 19; end loop; end if; end; Set_Col (Check, 44); Put (Check, Ewr.N, 6); Put (Check, ' '); Put (Check, Ewr.Pofs); Put (Check, ' '); Put (Check, Ewr.Freq); Put (Check, ' '); Put (Check, Ewr.Semi, 5); Put (Check, ' '); Put (Check, Ewr.Kind, 5); Put (Check, ' '); Put (Check, Ewr.Rank, 5); Put (Check, ' '); Put (Check, De.Mean); New_Line (Check); end if; end if; end loop; end if; -- If non-blank line end if; end loop Over_Lines; Put_Line ("NUMBER_OF_LINES = " & Integer'Image (Line_Number)); if not Porting then Close (Output); if Checking then Close (Check); end if; end if; exception when Ada.Text_IO.Data_Error => null; when others => Put_Line (S (1 .. Last)); Integer_IO.Put (Line_Number); New_Line; Close (Output); if Checking then Close (Check); end if; end Makeewds;
-- Copyright 2008-2015 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package body Pck is function Ident (I : Integer) return Integer is begin return I; end Ident; procedure Do_Nothing (A : System.Address) is begin null; end Do_Nothing; end Pck;
--////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) -- // -- // 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. -- // --////////////////////////////////////////////////////////// --/ @summary --/ Audio module --/ --/ @description --/ Sounds, streaming (musics or custom sources), recording, --/ spatialization. --/ package Sf.Audio is type sfMusic is null record; type sfMusic_Ptr is access all sfMusic; type sfSound is null record; type sfSound_Ptr is access all sfSound; type sfSoundBuffer is null record; type sfSoundBuffer_Ptr is access all sfSoundBuffer; type sfSoundBufferRecorder is null record; type sfSoundBufferRecorder_Ptr is access all sfSoundBufferRecorder; type sfSoundRecorder is null record; type sfSoundRecorder_Ptr is access all sfSoundRecorder; type sfSoundStream is null record; type sfSoundStream_Ptr is access all sfSoundStream; private pragma Convention (C, sfMusic); pragma Convention (C, sfMusic_Ptr); pragma Convention (C, sfSound); pragma Convention (C, sfSound_Ptr); pragma Convention (C, sfSoundBuffer); pragma Convention (C, sfSoundBuffer_Ptr); pragma Convention (C, sfSoundBufferRecorder); pragma Convention (C, sfSoundBufferRecorder_Ptr); pragma Convention (C, sfSoundRecorder); pragma Convention (C, sfSoundRecorder_Ptr); pragma Convention (C, sfSoundStream); pragma Convention (C, sfSoundStream_Ptr); end Sf.Audio;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017-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. -- -- -- ------------------------------------------------------------------------------ private package AGATE.Scheduler.Context_Switch is procedure Switch; end AGATE.Scheduler.Context_Switch;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2005, AdaCore -- -- -- -- GNARL 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 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a DCE version of this package. -- Currently HP-UX and SNI use this file pragma Polling (Off); -- Turn off polling, we do not want ATC polling to take place during -- tasking operations. It causes infinite loops and other problems. -- This package encapsulates all direct interfaces to OS services -- that are needed by children of System. with Interfaces.C; use Interfaces.C; package body System.OS_Interface is ----------------- -- To_Duration -- ----------------- function To_Duration (TS : timespec) return Duration is begin return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; ----------------- -- To_Timespec -- ----------------- function To_Timespec (D : Duration) return timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return timespec'(tv_sec => S, tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; function To_Duration (TV : struct_timeval) return Duration is begin return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; end To_Duration; function To_Timeval (D : Duration) return struct_timeval is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timeval' (tv_sec => S, tv_usec => time_t (Long_Long_Integer (F * 10#1#E6))); end To_Timeval; ------------------------- -- POSIX.1c Section 3 -- ------------------------- function sigwait (set : access sigset_t; sig : access Signal) return int is Result : int; begin Result := sigwait (set); if Result = -1 then sig.all := 0; return errno; end if; sig.all := Signal (Result); return 0; end sigwait; -- DCE_THREADS does not have pthread_kill. Instead, we just ignore it. function pthread_kill (thread : pthread_t; sig : Signal) return int is pragma Unreferenced (thread, sig); begin return 0; end pthread_kill; -------------------------- -- POSIX.1c Section 11 -- -------------------------- -- For all following functions, DCE Threads has a non standard behavior. -- It sets errno but the standard Posix requires it to be returned. function pthread_mutexattr_init (attr : access pthread_mutexattr_t) return int is function pthread_mutexattr_create (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_create, "pthread_mutexattr_create"); begin if pthread_mutexattr_create (attr) /= 0 then return errno; else return 0; end if; end pthread_mutexattr_init; function pthread_mutexattr_destroy (attr : access pthread_mutexattr_t) return int is function pthread_mutexattr_delete (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_delete, "pthread_mutexattr_delete"); begin if pthread_mutexattr_delete (attr) /= 0 then return errno; else return 0; end if; end pthread_mutexattr_destroy; function pthread_mutex_init (mutex : access pthread_mutex_t; attr : access pthread_mutexattr_t) return int is function pthread_mutex_init_base (mutex : access pthread_mutex_t; attr : pthread_mutexattr_t) return int; pragma Import (C, pthread_mutex_init_base, "pthread_mutex_init"); begin if pthread_mutex_init_base (mutex, attr.all) /= 0 then return errno; else return 0; end if; end pthread_mutex_init; function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int is function pthread_mutex_destroy_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_destroy_base, "pthread_mutex_destroy"); begin if pthread_mutex_destroy_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_destroy; function pthread_mutex_lock (mutex : access pthread_mutex_t) return int is function pthread_mutex_lock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_lock_base, "pthread_mutex_lock"); begin if pthread_mutex_lock_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_lock; function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int is function pthread_mutex_unlock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_unlock_base, "pthread_mutex_unlock"); begin if pthread_mutex_unlock_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_unlock; function pthread_condattr_init (attr : access pthread_condattr_t) return int is function pthread_condattr_create (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_create, "pthread_condattr_create"); begin if pthread_condattr_create (attr) /= 0 then return errno; else return 0; end if; end pthread_condattr_init; function pthread_condattr_destroy (attr : access pthread_condattr_t) return int is function pthread_condattr_delete (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_delete, "pthread_condattr_delete"); begin if pthread_condattr_delete (attr) /= 0 then return errno; else return 0; end if; end pthread_condattr_destroy; function pthread_cond_init (cond : access pthread_cond_t; attr : access pthread_condattr_t) return int is function pthread_cond_init_base (cond : access pthread_cond_t; attr : pthread_condattr_t) return int; pragma Import (C, pthread_cond_init_base, "pthread_cond_init"); begin if pthread_cond_init_base (cond, attr.all) /= 0 then return errno; else return 0; end if; end pthread_cond_init; function pthread_cond_destroy (cond : access pthread_cond_t) return int is function pthread_cond_destroy_base (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_destroy_base, "pthread_cond_destroy"); begin if pthread_cond_destroy_base (cond) /= 0 then return errno; else return 0; end if; end pthread_cond_destroy; function pthread_cond_signal (cond : access pthread_cond_t) return int is function pthread_cond_signal_base (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_signal_base, "pthread_cond_signal"); begin if pthread_cond_signal_base (cond) /= 0 then return errno; else return 0; end if; end pthread_cond_signal; function pthread_cond_wait (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int is function pthread_cond_wait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_cond_wait_base, "pthread_cond_wait"); begin if pthread_cond_wait_base (cond, mutex) /= 0 then return errno; else return 0; end if; end pthread_cond_wait; function pthread_cond_timedwait (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int is function pthread_cond_timedwait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int; pragma Import (C, pthread_cond_timedwait_base, "pthread_cond_timedwait"); begin if pthread_cond_timedwait_base (cond, mutex, abstime) /= 0 then if errno = EAGAIN then return ETIMEDOUT; else return errno; end if; else return 0; end if; end pthread_cond_timedwait; ---------------------------- -- POSIX.1c Section 13 -- ---------------------------- function pthread_setschedparam (thread : pthread_t; policy : int; param : access struct_sched_param) return int is function pthread_setscheduler (thread : pthread_t; policy : int; priority : int) return int; pragma Import (C, pthread_setscheduler, "pthread_setscheduler"); begin if pthread_setscheduler (thread, policy, param.sched_priority) = -1 then return errno; else return 0; end if; end pthread_setschedparam; function sched_yield return int is procedure pthread_yield; pragma Import (C, pthread_yield, "pthread_yield"); begin pthread_yield; return 0; end sched_yield; ----------------------------- -- P1003.1c - Section 16 -- ----------------------------- function pthread_attr_init (attributes : access pthread_attr_t) return int is function pthread_attr_create (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_create, "pthread_attr_create"); begin if pthread_attr_create (attributes) /= 0 then return errno; else return 0; end if; end pthread_attr_init; function pthread_attr_destroy (attributes : access pthread_attr_t) return int is function pthread_attr_delete (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_delete, "pthread_attr_delete"); begin if pthread_attr_delete (attributes) /= 0 then return errno; else return 0; end if; end pthread_attr_destroy; function pthread_attr_setstacksize (attr : access pthread_attr_t; stacksize : size_t) return int is function pthread_attr_setstacksize_base (attr : access pthread_attr_t; stacksize : size_t) return int; pragma Import (C, pthread_attr_setstacksize_base, "pthread_attr_setstacksize"); begin if pthread_attr_setstacksize_base (attr, stacksize) /= 0 then return errno; else return 0; end if; end pthread_attr_setstacksize; function pthread_create (thread : access pthread_t; attributes : access pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int is function pthread_create_base (thread : access pthread_t; attributes : pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int; pragma Import (C, pthread_create_base, "pthread_create"); begin if pthread_create_base (thread, attributes.all, start_routine, arg) /= 0 then return errno; else return 0; end if; end pthread_create; -------------------------- -- POSIX.1c Section 17 -- -------------------------- function pthread_setspecific (key : pthread_key_t; value : System.Address) return int is function pthread_setspecific_base (key : pthread_key_t; value : System.Address) return int; pragma Import (C, pthread_setspecific_base, "pthread_setspecific"); begin if pthread_setspecific_base (key, value) /= 0 then return errno; else return 0; end if; end pthread_setspecific; function pthread_getspecific (key : pthread_key_t) return System.Address is function pthread_getspecific_base (key : pthread_key_t; value : access System.Address) return int; pragma Import (C, pthread_getspecific_base, "pthread_getspecific"); Addr : aliased System.Address; begin if pthread_getspecific_base (key, Addr'Access) /= 0 then return System.Null_Address; else return Addr; end if; end pthread_getspecific; function pthread_key_create (key : access pthread_key_t; destructor : destructor_pointer) return int is function pthread_keycreate (key : access pthread_key_t; destructor : destructor_pointer) return int; pragma Import (C, pthread_keycreate, "pthread_keycreate"); begin if pthread_keycreate (key, destructor) /= 0 then return errno; else return 0; end if; end pthread_key_create; function Get_Stack_Base (thread : pthread_t) return Address is pragma Warnings (Off, thread); begin return Null_Address; end Get_Stack_Base; procedure pthread_init is begin null; end pthread_init; function intr_attach (sig : int; handler : isr_address) return long is function c_signal (sig : int; handler : isr_address) return long; pragma Import (C, c_signal, "signal"); begin return c_signal (sig, handler); end intr_attach; end System.OS_Interface;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- O U T P U T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains low level output routines used by the compiler for -- writing error messages and informational output. It is also used by the -- debug source file output routines (see Sprint.Print_Debug_Line). with Hostparm; use Hostparm; with Types; use Types; pragma Warnings (Off); -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; pragma Warnings (On); package Output is pragma Elaborate_Body; type Output_Proc is access procedure (S : String); -- This type is used for the Set_Special_Output procedure. If Output_Proc -- is called, then instead of lines being written to standard error or -- standard output, a call is made to the given procedure for each line, -- passing the line with an end of line character (which is a single -- ASCII.LF character, even in systems which normally use CR/LF or some -- other sequence for line end). ----------------- -- Subprograms -- ----------------- procedure Set_Special_Output (P : Output_Proc); -- Sets subsequent output to call procedure P. If P is null, then the call -- cancels the effect of a previous call, reverting the output to standard -- error or standard output depending on the mode at the time of previous -- call. Any exception generated by by calls to P is simply propagated to -- the caller of the routine causing the write operation. procedure Cancel_Special_Output; -- Cancels the effect of a call to Set_Special_Output, if any. The output -- is then directed to standard error or standard output depending on the -- last call to Set_Standard_Error or Set_Standard_Output. It is never an -- error to call Cancel_Special_Output. It has the same effect as calling -- Set_Special_Output (null). procedure Ignore_Output (S : String); -- Does nothing. To disable output, pass Ignore_Output'Access to -- Set_Special_Output. procedure Set_Standard_Error; -- Sets subsequent output to appear on the standard error file (whatever -- that might mean for the host operating system, if anything) when -- no special output is in effect. When a special output is in effect, -- the output will appear on standard error only after special output -- has been cancelled. procedure Set_Standard_Output; -- Sets subsequent output to appear on the standard output file (whatever -- that might mean for the host operating system, if anything) when no -- special output is in effect. When a special output is in effect, the -- output will appear on standard output only after special output has been -- cancelled. Output to standard output is the default mode before any call -- to either of the Set procedures. procedure Set_Output (FD : File_Descriptor); -- Sets subsequent output to appear on the given file descriptor when no -- special output is in effect. When a special output is in effect, the -- output will appear on the given file descriptor only after special -- output has been cancelled. procedure Indent; -- Increases the current indentation level. Whenever a line is written -- (triggered by Eol), an appropriate amount of whitespace is added to the -- beginning of the line, wrapping around if it gets too long. procedure Outdent; -- Decreases the current indentation level procedure Write_Char (C : Character); -- Write one character to the standard output file. If the character is LF, -- this is equivalent to Write_Eol. procedure Write_Erase_Char (C : Character); -- If last character in buffer matches C, erase it, otherwise no effect procedure Write_Eol; -- Write an end of line (whatever is required by the system in use, e.g. -- CR/LF for DOS, or LF for Unix) to the standard output file. This routine -- also empties the line buffer, actually writing it to the file. Note that -- Write_Eol is the only routine that causes any actual output to be -- written. Trailing spaces are removed. procedure Write_Eol_Keep_Blanks; -- Similar as Write_Eol, except that trailing spaces are not removed procedure Write_Int (Val : Int); -- Write an integer value with no leading blanks or zeroes. Negative values -- are preceded by a minus sign). procedure Write_Spaces (N : Nat); -- Write N spaces procedure Write_Str (S : String); -- Write a string of characters to the standard output file. Note that -- end of line is normally handled separately using WRITE_EOL, but it is -- allowable for the string to contain LF (but not CR) characters, which -- are properly interpreted as end of line characters. The string may also -- contain horizontal tab characters. procedure Write_Line (S : String); -- Equivalent to Write_Str (S) followed by Write_Eol; function Column return Pos; pragma Inline (Column); -- Returns the number of the column about to be written (e.g. a value of 1 -- means the current line is empty). ------------------------- -- Buffer Save/Restore -- ------------------------- -- This facility allows the current line buffer to be saved and restored type Saved_Output_Buffer is private; -- Type used for Save/Restore_Buffer Buffer_Max : constant := Hostparm.Max_Line_Length; -- Maximal size of a buffered output line function Save_Output_Buffer return Saved_Output_Buffer; -- Save current line buffer and reset line buffer to empty procedure Restore_Output_Buffer (S : Saved_Output_Buffer); -- Restore previously saved output buffer. The value in S is not affected -- so it is legitimate to restore a buffer more than once. -------------------------- -- Debugging Procedures -- -------------------------- -- The following procedures are intended only for debugging purposes, -- for temporary insertion into the text in environments where a debugger -- is not available. They all have non-standard very short lower case -- names, precisely to make sure that they are only used for debugging! procedure w (C : Character); -- Dump quote, character, quote, followed by line return procedure w (S : String); -- Dump string followed by line return procedure w (V : Int); -- Dump integer followed by line return procedure w (B : Boolean); -- Dump Boolean followed by line return procedure w (L : String; C : Character); -- Dump contents of string followed by blank, quote, character, quote procedure w (L : String; S : String); -- Dump two strings separated by blanks, followed by line return procedure w (L : String; V : Int); -- Dump contents of string followed by blank, integer, line return procedure w (L : String; B : Boolean); -- Dump contents of string followed by blank, Boolean, line return private -- Note: the following buffer and column position are maintained by the -- subprograms defined in this package, and cannot be directly modified or -- accessed by a client. Buffer : String (1 .. Buffer_Max + 1) := (others => '*'); for Buffer'Alignment use 4; -- Buffer used to build output line. We do line buffering because it -- is needed for the support of the debug-generated-code option (-gnatD). -- Historically it was first added because on VMS, line buffering is -- needed with certain file formats. So in any case line buffering must -- be retained for this purpose, even if other reasons disappear. Note -- any attempt to write more output to a line than can fit in the buffer -- will be silently ignored. The alignment clause improves the efficiency -- of the save/restore procedures. Next_Col : Positive range 1 .. Buffer'Length + 1 := 1; -- Column about to be written type Saved_Output_Buffer is record Buffer : String (1 .. Buffer_Max + 1); Next_Col : Positive; Cur_Indentation : Natural; end record; end Output;
----------------------------------------------------------------------- -- Frames - Representation of stack frames -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; procedure MAT.Frames.Print (File : in File_Type; F : in Frame_Type);
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.SIMD.SSE.Singles.Arithmetic is pragma Pure; function "*" (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_mulps"; function "*" (Left, Right : m128_Array) return m128_Array with Inline; -- Multiplies the left matrix with the right matrix. Matrix multiplication -- is associative, but not commutative. function "*" (Left : m128_Array; Right : m128) return m128 with Inline; -- Multiplies the left matrix with the right vector. Matrix multiplication -- is associative, but not commutative. function "/" (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_divps"; function Divide_Or_Zero (Left, Right : m128) return m128 with Inline; function "+" (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_addps"; function "-" (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_subps"; function "-" (Elements : m128) return m128 is ((0.0, 0.0, 0.0, 0.0) - Elements) with Inline; function "abs" (Elements : m128) return m128 with Inline; function Sum (Elements : m128) return Float_32 with Inline; end Orka.SIMD.SSE.Singles.Arithmetic;
pragma Warnings (Off); pragma Ada_95; with System; with System.Parameters; with System.Secondary_Stack; package ada_main is gnat_argc : Integer; gnat_argv : System.Address; gnat_envp : System.Address; pragma Import (C, gnat_argc); pragma Import (C, gnat_argv); pragma Import (C, gnat_envp); gnat_exit_status : Integer; pragma Import (C, gnat_exit_status); GNAT_Version : constant String := "GNAT Version: 10.2.0" & ASCII.NUL; pragma Export (C, GNAT_Version, "__gnat_version"); Ada_Main_Program_Name : constant String := "_ada_main" & ASCII.NUL; pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name"); procedure adainit; pragma Export (C, adainit, "adainit"); procedure adafinal; pragma Export (C, adafinal, "adafinal"); function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer; pragma Export (C, main, "main"); type Version_32 is mod 2 ** 32; u00001 : constant Version_32 := 16#f55a3727#; pragma Export (C, u00001, "mainB"); u00002 : constant Version_32 := 16#050ff2f0#; pragma Export (C, u00002, "system__standard_libraryB"); u00003 : constant Version_32 := 16#4113f22b#; pragma Export (C, u00003, "system__standard_libraryS"); u00004 : constant Version_32 := 16#5d91da9f#; pragma Export (C, u00004, "ada__tagsB"); u00005 : constant Version_32 := 16#12a0afb8#; pragma Export (C, u00005, "ada__tagsS"); u00006 : constant Version_32 := 16#76789da1#; pragma Export (C, u00006, "adaS"); u00007 : constant Version_32 := 16#185015e7#; pragma Export (C, u00007, "ada__exceptionsB"); u00008 : constant Version_32 := 16#d6578bab#; pragma Export (C, u00008, "ada__exceptionsS"); u00009 : constant Version_32 := 16#5726abed#; pragma Export (C, u00009, "ada__exceptions__last_chance_handlerB"); u00010 : constant Version_32 := 16#cfec26ee#; pragma Export (C, u00010, "ada__exceptions__last_chance_handlerS"); u00011 : constant Version_32 := 16#4635ec04#; pragma Export (C, u00011, "systemS"); u00012 : constant Version_32 := 16#ae860117#; pragma Export (C, u00012, "system__soft_linksB"); u00013 : constant Version_32 := 16#8d3f9472#; pragma Export (C, u00013, "system__soft_linksS"); u00014 : constant Version_32 := 16#f32b4133#; pragma Export (C, u00014, "system__secondary_stackB"); u00015 : constant Version_32 := 16#03a1141d#; pragma Export (C, u00015, "system__secondary_stackS"); u00016 : constant Version_32 := 16#86dbf443#; pragma Export (C, u00016, "system__parametersB"); u00017 : constant Version_32 := 16#0ed9b82f#; pragma Export (C, u00017, "system__parametersS"); u00018 : constant Version_32 := 16#ced09590#; pragma Export (C, u00018, "system__storage_elementsB"); u00019 : constant Version_32 := 16#6bf6a600#; pragma Export (C, u00019, "system__storage_elementsS"); u00020 : constant Version_32 := 16#75bf515c#; pragma Export (C, u00020, "system__soft_links__initializeB"); u00021 : constant Version_32 := 16#5697fc2b#; pragma Export (C, u00021, "system__soft_links__initializeS"); u00022 : constant Version_32 := 16#41837d1e#; pragma Export (C, u00022, "system__stack_checkingB"); u00023 : constant Version_32 := 16#c88a87ec#; pragma Export (C, u00023, "system__stack_checkingS"); u00024 : constant Version_32 := 16#34742901#; pragma Export (C, u00024, "system__exception_tableB"); u00025 : constant Version_32 := 16#1b9b8546#; pragma Export (C, u00025, "system__exception_tableS"); u00026 : constant Version_32 := 16#ce4af020#; pragma Export (C, u00026, "system__exceptionsB"); u00027 : constant Version_32 := 16#2e5681f2#; pragma Export (C, u00027, "system__exceptionsS"); u00028 : constant Version_32 := 16#69416224#; pragma Export (C, u00028, "system__exceptions__machineB"); u00029 : constant Version_32 := 16#5c74e542#; pragma Export (C, u00029, "system__exceptions__machineS"); u00030 : constant Version_32 := 16#aa0563fc#; pragma Export (C, u00030, "system__exceptions_debugB"); u00031 : constant Version_32 := 16#38bf15c0#; pragma Export (C, u00031, "system__exceptions_debugS"); u00032 : constant Version_32 := 16#6c2f8802#; pragma Export (C, u00032, "system__img_intB"); u00033 : constant Version_32 := 16#44ee0cc6#; pragma Export (C, u00033, "system__img_intS"); u00034 : constant Version_32 := 16#39df8c17#; pragma Export (C, u00034, "system__tracebackB"); u00035 : constant Version_32 := 16#181732c0#; pragma Export (C, u00035, "system__tracebackS"); u00036 : constant Version_32 := 16#9ed49525#; pragma Export (C, u00036, "system__traceback_entriesB"); u00037 : constant Version_32 := 16#466e1a74#; pragma Export (C, u00037, "system__traceback_entriesS"); u00038 : constant Version_32 := 16#448e9548#; pragma Export (C, u00038, "system__traceback__symbolicB"); u00039 : constant Version_32 := 16#46491211#; pragma Export (C, u00039, "system__traceback__symbolicS"); u00040 : constant Version_32 := 16#179d7d28#; pragma Export (C, u00040, "ada__containersS"); u00041 : constant Version_32 := 16#701f9d88#; pragma Export (C, u00041, "ada__exceptions__tracebackB"); u00042 : constant Version_32 := 16#ae2d2db5#; pragma Export (C, u00042, "ada__exceptions__tracebackS"); u00043 : constant Version_32 := 16#5ab55268#; pragma Export (C, u00043, "interfacesS"); u00044 : constant Version_32 := 16#769e25e6#; pragma Export (C, u00044, "interfaces__cB"); u00045 : constant Version_32 := 16#467817d8#; pragma Export (C, u00045, "interfaces__cS"); u00046 : constant Version_32 := 16#e865e681#; pragma Export (C, u00046, "system__bounded_stringsB"); u00047 : constant Version_32 := 16#31c8cd1d#; pragma Export (C, u00047, "system__bounded_stringsS"); u00048 : constant Version_32 := 16#0062635e#; pragma Export (C, u00048, "system__crtlS"); u00049 : constant Version_32 := 16#bba79bcb#; pragma Export (C, u00049, "system__dwarf_linesB"); u00050 : constant Version_32 := 16#9a78d181#; pragma Export (C, u00050, "system__dwarf_linesS"); u00051 : constant Version_32 := 16#5b4659fa#; pragma Export (C, u00051, "ada__charactersS"); u00052 : constant Version_32 := 16#8f637df8#; pragma Export (C, u00052, "ada__characters__handlingB"); u00053 : constant Version_32 := 16#3b3f6154#; pragma Export (C, u00053, "ada__characters__handlingS"); u00054 : constant Version_32 := 16#4b7bb96a#; pragma Export (C, u00054, "ada__characters__latin_1S"); u00055 : constant Version_32 := 16#e6d4fa36#; pragma Export (C, u00055, "ada__stringsS"); u00056 : constant Version_32 := 16#96df1a3f#; pragma Export (C, u00056, "ada__strings__mapsB"); u00057 : constant Version_32 := 16#1e526bec#; pragma Export (C, u00057, "ada__strings__mapsS"); u00058 : constant Version_32 := 16#5886cb31#; pragma Export (C, u00058, "system__bit_opsB"); u00059 : constant Version_32 := 16#0765e3a3#; pragma Export (C, u00059, "system__bit_opsS"); u00060 : constant Version_32 := 16#72b39087#; pragma Export (C, u00060, "system__unsigned_typesS"); u00061 : constant Version_32 := 16#92f05f13#; pragma Export (C, u00061, "ada__strings__maps__constantsS"); u00062 : constant Version_32 := 16#a0d3d22b#; pragma Export (C, u00062, "system__address_imageB"); u00063 : constant Version_32 := 16#e7d9713e#; pragma Export (C, u00063, "system__address_imageS"); u00064 : constant Version_32 := 16#ec78c2bf#; pragma Export (C, u00064, "system__img_unsB"); u00065 : constant Version_32 := 16#ed47ac70#; pragma Export (C, u00065, "system__img_unsS"); u00066 : constant Version_32 := 16#d7aac20c#; pragma Export (C, u00066, "system__ioB"); u00067 : constant Version_32 := 16#d8771b4b#; pragma Export (C, u00067, "system__ioS"); u00068 : constant Version_32 := 16#f790d1ef#; pragma Export (C, u00068, "system__mmapB"); u00069 : constant Version_32 := 16#7c445363#; pragma Export (C, u00069, "system__mmapS"); u00070 : constant Version_32 := 16#92d882c5#; pragma Export (C, u00070, "ada__io_exceptionsS"); u00071 : constant Version_32 := 16#91eaca2e#; pragma Export (C, u00071, "system__mmap__os_interfaceB"); u00072 : constant Version_32 := 16#1fc2f713#; pragma Export (C, u00072, "system__mmap__os_interfaceS"); u00073 : constant Version_32 := 16#1e7d913a#; pragma Export (C, u00073, "system__mmap__unixS"); u00074 : constant Version_32 := 16#54420b60#; pragma Export (C, u00074, "system__os_libB"); u00075 : constant Version_32 := 16#d872da39#; pragma Export (C, u00075, "system__os_libS"); u00076 : constant Version_32 := 16#ec4d5631#; pragma Export (C, u00076, "system__case_utilB"); u00077 : constant Version_32 := 16#79e05a50#; pragma Export (C, u00077, "system__case_utilS"); u00078 : constant Version_32 := 16#2a8e89ad#; pragma Export (C, u00078, "system__stringsB"); u00079 : constant Version_32 := 16#2623c091#; pragma Export (C, u00079, "system__stringsS"); u00080 : constant Version_32 := 16#5a3f5337#; pragma Export (C, u00080, "system__object_readerB"); u00081 : constant Version_32 := 16#82413105#; pragma Export (C, u00081, "system__object_readerS"); u00082 : constant Version_32 := 16#fb020d94#; pragma Export (C, u00082, "system__val_lliB"); u00083 : constant Version_32 := 16#2a5b7ef4#; pragma Export (C, u00083, "system__val_lliS"); u00084 : constant Version_32 := 16#b8e72903#; pragma Export (C, u00084, "system__val_lluB"); u00085 : constant Version_32 := 16#1f7d1d65#; pragma Export (C, u00085, "system__val_lluS"); u00086 : constant Version_32 := 16#269742a9#; pragma Export (C, u00086, "system__val_utilB"); u00087 : constant Version_32 := 16#ea955afa#; pragma Export (C, u00087, "system__val_utilS"); u00088 : constant Version_32 := 16#d7bf3f29#; pragma Export (C, u00088, "system__exception_tracesB"); u00089 : constant Version_32 := 16#62eacc9e#; pragma Export (C, u00089, "system__exception_tracesS"); u00090 : constant Version_32 := 16#8c33a517#; pragma Export (C, u00090, "system__wch_conB"); u00091 : constant Version_32 := 16#5d48ced6#; pragma Export (C, u00091, "system__wch_conS"); u00092 : constant Version_32 := 16#9721e840#; pragma Export (C, u00092, "system__wch_stwB"); u00093 : constant Version_32 := 16#7059e2d7#; pragma Export (C, u00093, "system__wch_stwS"); u00094 : constant Version_32 := 16#a831679c#; pragma Export (C, u00094, "system__wch_cnvB"); u00095 : constant Version_32 := 16#52ff7425#; pragma Export (C, u00095, "system__wch_cnvS"); u00096 : constant Version_32 := 16#ece6fdb6#; pragma Export (C, u00096, "system__wch_jisB"); u00097 : constant Version_32 := 16#d28f6d04#; pragma Export (C, u00097, "system__wch_jisS"); u00098 : constant Version_32 := 16#796f31f1#; pragma Export (C, u00098, "system__htableB"); u00099 : constant Version_32 := 16#c2f75fee#; pragma Export (C, u00099, "system__htableS"); u00100 : constant Version_32 := 16#089f5cd0#; pragma Export (C, u00100, "system__string_hashB"); u00101 : constant Version_32 := 16#60a93490#; pragma Export (C, u00101, "system__string_hashS"); u00102 : constant Version_32 := 16#92b1d698#; pragma Export (C, u00102, "rcpS"); u00103 : constant Version_32 := 16#356e3808#; pragma Export (C, u00103, "rcp__controlB"); u00104 : constant Version_32 := 16#b7f71bac#; pragma Export (C, u00104, "rcp__controlS"); u00105 : constant Version_32 := 16#f4e097a7#; pragma Export (C, u00105, "ada__text_ioB"); u00106 : constant Version_32 := 16#777d5329#; pragma Export (C, u00106, "ada__text_ioS"); u00107 : constant Version_32 := 16#10558b11#; pragma Export (C, u00107, "ada__streamsB"); u00108 : constant Version_32 := 16#67e31212#; pragma Export (C, u00108, "ada__streamsS"); u00109 : constant Version_32 := 16#73d2d764#; pragma Export (C, u00109, "interfaces__c_streamsB"); u00110 : constant Version_32 := 16#b1330297#; pragma Export (C, u00110, "interfaces__c_streamsS"); u00111 : constant Version_32 := 16#ec9c64c3#; pragma Export (C, u00111, "system__file_ioB"); u00112 : constant Version_32 := 16#e1440d61#; pragma Export (C, u00112, "system__file_ioS"); u00113 : constant Version_32 := 16#86c56e5a#; pragma Export (C, u00113, "ada__finalizationS"); u00114 : constant Version_32 := 16#95817ed8#; pragma Export (C, u00114, "system__finalization_rootB"); u00115 : constant Version_32 := 16#09c79f94#; pragma Export (C, u00115, "system__finalization_rootS"); u00116 : constant Version_32 := 16#bbaa76ac#; pragma Export (C, u00116, "system__file_control_blockS"); u00117 : constant Version_32 := 16#2b70b149#; pragma Export (C, u00117, "system__concat_3B"); u00118 : constant Version_32 := 16#4d45b0a1#; pragma Export (C, u00118, "system__concat_3S"); u00119 : constant Version_32 := 16#fd83e873#; pragma Export (C, u00119, "system__concat_2B"); u00120 : constant Version_32 := 16#44953bd4#; pragma Export (C, u00120, "system__concat_2S"); u00121 : constant Version_32 := 16#7f6ff536#; pragma Export (C, u00121, "system__tasking__protected_objectsB"); u00122 : constant Version_32 := 16#15001baf#; pragma Export (C, u00122, "system__tasking__protected_objectsS"); u00123 : constant Version_32 := 16#55e88911#; pragma Export (C, u00123, "system__soft_links__taskingB"); u00124 : constant Version_32 := 16#e939497e#; pragma Export (C, u00124, "system__soft_links__taskingS"); u00125 : constant Version_32 := 16#3880736e#; pragma Export (C, u00125, "ada__exceptions__is_null_occurrenceB"); u00126 : constant Version_32 := 16#6fde25af#; pragma Export (C, u00126, "ada__exceptions__is_null_occurrenceS"); u00127 : constant Version_32 := 16#0894e9be#; pragma Export (C, u00127, "system__task_primitivesS"); u00128 : constant Version_32 := 16#c9728a70#; pragma Export (C, u00128, "system__os_interfaceB"); u00129 : constant Version_32 := 16#668bffb5#; pragma Export (C, u00129, "system__os_interfaceS"); u00130 : constant Version_32 := 16#ff1f7771#; pragma Export (C, u00130, "system__linuxS"); u00131 : constant Version_32 := 16#3fb09703#; pragma Export (C, u00131, "system__os_constantsS"); u00132 : constant Version_32 := 16#88b9bc12#; pragma Export (C, u00132, "system__task_primitives__operationsB"); u00133 : constant Version_32 := 16#a249a2c5#; pragma Export (C, u00133, "system__task_primitives__operationsS"); u00134 : constant Version_32 := 16#71c5de81#; pragma Export (C, u00134, "system__interrupt_managementB"); u00135 : constant Version_32 := 16#ef0526ae#; pragma Export (C, u00135, "system__interrupt_managementS"); u00136 : constant Version_32 := 16#f65595cf#; pragma Export (C, u00136, "system__multiprocessorsB"); u00137 : constant Version_32 := 16#7e997377#; pragma Export (C, u00137, "system__multiprocessorsS"); u00138 : constant Version_32 := 16#51f2d040#; pragma Export (C, u00138, "system__os_primitivesB"); u00139 : constant Version_32 := 16#41c889f2#; pragma Export (C, u00139, "system__os_primitivesS"); u00140 : constant Version_32 := 16#375a3ef7#; pragma Export (C, u00140, "system__task_infoB"); u00141 : constant Version_32 := 16#d7a1ab61#; pragma Export (C, u00141, "system__task_infoS"); u00142 : constant Version_32 := 16#c2216981#; pragma Export (C, u00142, "system__taskingB"); u00143 : constant Version_32 := 16#5f56b18c#; pragma Export (C, u00143, "system__taskingS"); u00144 : constant Version_32 := 16#6ec3c867#; pragma Export (C, u00144, "system__stack_usageB"); u00145 : constant Version_32 := 16#3a3ac346#; pragma Export (C, u00145, "system__stack_usageS"); u00146 : constant Version_32 := 16#f0965c7b#; pragma Export (C, u00146, "system__tasking__debugB"); u00147 : constant Version_32 := 16#6502a0c1#; pragma Export (C, u00147, "system__tasking__debugS"); u00148 : constant Version_32 := 16#b31a5821#; pragma Export (C, u00148, "system__img_enum_newB"); u00149 : constant Version_32 := 16#2779eac4#; pragma Export (C, u00149, "system__img_enum_newS"); u00150 : constant Version_32 := 16#9dca6636#; pragma Export (C, u00150, "system__img_lliB"); u00151 : constant Version_32 := 16#577ab9d5#; pragma Export (C, u00151, "system__img_lliS"); u00152 : constant Version_32 := 16#726dd94b#; pragma Export (C, u00152, "system__tasking__protected_objects__entriesB"); u00153 : constant Version_32 := 16#7daf93e7#; pragma Export (C, u00153, "system__tasking__protected_objects__entriesS"); u00154 : constant Version_32 := 16#100eaf58#; pragma Export (C, u00154, "system__restrictionsB"); u00155 : constant Version_32 := 16#0d473555#; pragma Export (C, u00155, "system__restrictionsS"); u00156 : constant Version_32 := 16#4e315ff7#; pragma Export (C, u00156, "system__tasking__initializationB"); u00157 : constant Version_32 := 16#fc2303e6#; pragma Export (C, u00157, "system__tasking__initializationS"); u00158 : constant Version_32 := 16#263e126a#; pragma Export (C, u00158, "system__tasking__task_attributesB"); u00159 : constant Version_32 := 16#4c97674c#; pragma Export (C, u00159, "system__tasking__task_attributesS"); u00160 : constant Version_32 := 16#83c8fb63#; pragma Export (C, u00160, "system__tasking__protected_objects__operationsB"); u00161 : constant Version_32 := 16#343fde45#; pragma Export (C, u00161, "system__tasking__protected_objects__operationsS"); u00162 : constant Version_32 := 16#69bd1289#; pragma Export (C, u00162, "system__tasking__entry_callsB"); u00163 : constant Version_32 := 16#6342024e#; pragma Export (C, u00163, "system__tasking__entry_callsS"); u00164 : constant Version_32 := 16#cee82bbd#; pragma Export (C, u00164, "system__tasking__queuingB"); u00165 : constant Version_32 := 16#6dba2805#; pragma Export (C, u00165, "system__tasking__queuingS"); u00166 : constant Version_32 := 16#eb894f1f#; pragma Export (C, u00166, "system__tasking__utilitiesB"); u00167 : constant Version_32 := 16#0f670827#; pragma Export (C, u00167, "system__tasking__utilitiesS"); u00168 : constant Version_32 := 16#9322406a#; pragma Export (C, u00168, "system__tasking__rendezvousB"); u00169 : constant Version_32 := 16#d811d710#; pragma Export (C, u00169, "system__tasking__rendezvousS"); u00170 : constant Version_32 := 16#ec5e1e40#; pragma Export (C, u00170, "rcp__userB"); u00171 : constant Version_32 := 16#3bf185fd#; pragma Export (C, u00171, "rcp__userS"); u00172 : constant Version_32 := 16#357666d8#; pragma Export (C, u00172, "ada__calendar__delaysB"); u00173 : constant Version_32 := 16#d86d2f1d#; pragma Export (C, u00173, "ada__calendar__delaysS"); u00174 : constant Version_32 := 16#fc54e290#; pragma Export (C, u00174, "ada__calendarB"); u00175 : constant Version_32 := 16#31350a81#; pragma Export (C, u00175, "ada__calendarS"); u00176 : constant Version_32 := 16#932a4690#; pragma Export (C, u00176, "system__concat_4B"); u00177 : constant Version_32 := 16#3851c724#; pragma Export (C, u00177, "system__concat_4S"); u00178 : constant Version_32 := 16#608e2cd1#; pragma Export (C, u00178, "system__concat_5B"); u00179 : constant Version_32 := 16#c16baf2a#; pragma Export (C, u00179, "system__concat_5S"); u00180 : constant Version_32 := 16#0780a76b#; pragma Export (C, u00180, "system__tasking__stagesB"); u00181 : constant Version_32 := 16#14e0647c#; pragma Export (C, u00181, "system__tasking__stagesS"); u00182 : constant Version_32 := 16#e932e590#; pragma Export (C, u00182, "ada__real_timeB"); u00183 : constant Version_32 := 16#69ea8064#; pragma Export (C, u00183, "ada__real_timeS"); u00184 : constant Version_32 := 16#e31b7c4e#; pragma Export (C, u00184, "system__memoryB"); u00185 : constant Version_32 := 16#1f488a30#; pragma Export (C, u00185, "system__memoryS"); -- BEGIN ELABORATION ORDER -- ada%s -- ada.characters%s -- ada.characters.latin_1%s -- interfaces%s -- system%s -- system.img_enum_new%s -- system.img_enum_new%b -- system.img_int%s -- system.img_int%b -- system.img_lli%s -- system.img_lli%b -- system.io%s -- system.io%b -- system.os_primitives%s -- system.os_primitives%b -- system.parameters%s -- system.parameters%b -- system.crtl%s -- interfaces.c_streams%s -- interfaces.c_streams%b -- system.restrictions%s -- system.restrictions%b -- system.storage_elements%s -- system.storage_elements%b -- system.stack_checking%s -- system.stack_checking%b -- system.stack_usage%s -- system.stack_usage%b -- system.string_hash%s -- system.string_hash%b -- system.htable%s -- system.htable%b -- system.strings%s -- system.strings%b -- system.traceback_entries%s -- system.traceback_entries%b -- system.unsigned_types%s -- system.img_uns%s -- system.img_uns%b -- system.wch_con%s -- system.wch_con%b -- system.wch_jis%s -- system.wch_jis%b -- system.wch_cnv%s -- system.wch_cnv%b -- system.concat_2%s -- system.concat_2%b -- system.concat_3%s -- system.concat_3%b -- system.concat_4%s -- system.concat_4%b -- system.concat_5%s -- system.concat_5%b -- system.traceback%s -- system.traceback%b -- ada.characters.handling%s -- system.case_util%s -- system.os_lib%s -- system.secondary_stack%s -- system.standard_library%s -- ada.exceptions%s -- system.exceptions_debug%s -- system.exceptions_debug%b -- system.soft_links%s -- system.val_lli%s -- system.val_llu%s -- system.val_util%s -- system.val_util%b -- system.wch_stw%s -- system.wch_stw%b -- ada.exceptions.last_chance_handler%s -- ada.exceptions.last_chance_handler%b -- ada.exceptions.traceback%s -- ada.exceptions.traceback%b -- system.address_image%s -- system.address_image%b -- system.bit_ops%s -- system.bit_ops%b -- system.bounded_strings%s -- system.bounded_strings%b -- system.case_util%b -- system.exception_table%s -- system.exception_table%b -- ada.containers%s -- ada.io_exceptions%s -- ada.strings%s -- ada.strings.maps%s -- ada.strings.maps%b -- ada.strings.maps.constants%s -- interfaces.c%s -- interfaces.c%b -- system.exceptions%s -- system.exceptions%b -- system.exceptions.machine%s -- system.exceptions.machine%b -- ada.characters.handling%b -- system.exception_traces%s -- system.exception_traces%b -- system.memory%s -- system.memory%b -- system.mmap%s -- system.mmap.os_interface%s -- system.mmap%b -- system.mmap.unix%s -- system.mmap.os_interface%b -- system.object_reader%s -- system.object_reader%b -- system.dwarf_lines%s -- system.dwarf_lines%b -- system.os_lib%b -- system.secondary_stack%b -- system.soft_links.initialize%s -- system.soft_links.initialize%b -- system.soft_links%b -- system.standard_library%b -- system.traceback.symbolic%s -- system.traceback.symbolic%b -- ada.exceptions%b -- system.val_lli%b -- system.val_llu%b -- ada.exceptions.is_null_occurrence%s -- ada.exceptions.is_null_occurrence%b -- ada.tags%s -- ada.tags%b -- ada.streams%s -- ada.streams%b -- system.file_control_block%s -- system.finalization_root%s -- system.finalization_root%b -- ada.finalization%s -- system.file_io%s -- system.file_io%b -- system.linux%s -- system.multiprocessors%s -- system.multiprocessors%b -- system.os_constants%s -- system.os_interface%s -- system.os_interface%b -- system.task_info%s -- system.task_info%b -- system.task_primitives%s -- system.interrupt_management%s -- system.interrupt_management%b -- system.tasking%s -- system.task_primitives.operations%s -- system.tasking.debug%s -- system.tasking.debug%b -- system.task_primitives.operations%b -- system.tasking%b -- ada.calendar%s -- ada.calendar%b -- ada.calendar.delays%s -- ada.calendar.delays%b -- ada.real_time%s -- ada.real_time%b -- ada.text_io%s -- ada.text_io%b -- system.soft_links.tasking%s -- system.soft_links.tasking%b -- system.tasking.initialization%s -- system.tasking.task_attributes%s -- system.tasking.task_attributes%b -- system.tasking.initialization%b -- system.tasking.protected_objects%s -- system.tasking.protected_objects%b -- system.tasking.protected_objects.entries%s -- system.tasking.protected_objects.entries%b -- system.tasking.queuing%s -- system.tasking.queuing%b -- system.tasking.utilities%s -- system.tasking.utilities%b -- system.tasking.entry_calls%s -- system.tasking.rendezvous%s -- system.tasking.protected_objects.operations%s -- system.tasking.protected_objects.operations%b -- system.tasking.entry_calls%b -- system.tasking.rendezvous%b -- system.tasking.stages%s -- system.tasking.stages%b -- rcp%s -- rcp.control%s -- rcp.control%b -- rcp.user%s -- rcp.user%b -- main%b -- END ELABORATION ORDER end ada_main;
with System;use System; package Blinker is -- type Cmd_Type is (START, STOP, QUIT); type Cmd_Type is (STOP, START); type Id_Type is ( R, L, E); type Command_To_Type is record Cmd : Cmd_Type; Receiver : Id_Type; end record; Id : Id_Type; -- type Cmd_Ptr_Type is access all Cmd_Type; -- Cmd_Ptr : constant Cmd_Ptr_Type := Command'Access; protected type Cmd_Type_Access is procedure Send( Cmd : Command_To_Type ); entry Receive( Cmd : out COmmand_To_Type); private Command_To : Command_To_Type; Command_Is_New : Boolean := False; end Cmd_Type_Access; task type Blinker_Type is --pragma Priority (System.Priority'Last); end Blinker_Type; Protected_Command : Cmd_Type_Access; end Blinker;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. with Ada.Exceptions, Ada.Unchecked_Deallocation, Apsepp.Generic_Shared_Instance.Access_Setter, Apsepp.Test_Node_Class.Private_Test_Reporter; package body Apsepp.Test_Node_Class.Runner_Sequential.W_Slave_Nodes is use Ada.Exceptions; ---------------------------------------------------------------------------- task type Slave_Node_Task is entry Start_Run (Node : Test_Node_Access); entry Get_Outcome_And_E (Outcome : out Test_Outcome; E : out Exception_Occurrence_Access); end Slave_Node_Task; type Slave_Node_Task_Array is array (Test_Node_Index range <>) of Slave_Node_Task; ----------------------------------------------------- task body Slave_Node_Task is Nod : access Apsepp.Test_Node_Class.Test_Node_Interfa'Class; Outc : Test_Outcome; Ex : Exception_Occurrence_Access; begin accept Start_Run (Node : Test_Node_Access) do Nod := Node; end Start_Run; begin Nod.Run (Outc); exception when E : others => Ex := Save_Occurrence (E); end; accept Get_Outcome_And_E (Outcome : out Test_Outcome; E : out Exception_Occurrence_Access) do Outcome := Outc; E := Ex; end Get_Outcome_And_E; end Slave_Node_Task; ---------------------------------------------------------------------------- overriding procedure Finalize (Obj : in out Controlled_Slaves_Array_Access) is procedure Free is new Ada.Unchecked_Deallocation (Object => Test_Node_Array, Name => Test_Node_Array_Access); begin Free (Obj.A); end Finalize; ---------------------------------------------------------------------------- overriding procedure Run (Obj : in out Test_Runner_Sequential_W_Slave_Tasks; Outcome : out Test_Outcome; Kind : Run_Kind := Assert_Cond_And_Run_Test) is use Private_Test_Reporter; R_A : constant Shared_Instance.Instance_Type_Access := Shared_Instance.Instance_Type_Access (Obj.Reporter_Access); procedure CB is new SB_Lock_CB_procedure (SBLCB_Access => Obj.R_A_S_CB); package Test_Reporter_Access_Setter is new Shared_Instance.Access_Setter (Inst_Access => R_A, CB => CB); pragma Unreferenced (Test_Reporter_Access_Setter); ----------------------------------------------------- procedure Run_Test is Node_Task : Slave_Node_Task_Array (Obj.Slaves.A'Range); Ex : Exception_Occurrence_Access; procedure Free is new Ada.Unchecked_Deallocation (Object => Exception_Occurrence, Name => Exception_Occurrence_Access); begin for K in Node_Task'Range loop Node_Task(K).Start_Run (Obj.Slaves.A(K)); end loop; Test_Runner_Sequential (Obj).Run (Outcome); -- Inherited procedure call. for Ta of Node_Task loop declare Outc : Test_Outcome; E : Exception_Occurrence_Access; begin Ta.Get_Outcome_And_E (Outc, E); if Ex /= null and then E /= null then Free (E); elsif E /= null then Ex := E; -- Ex will be freed later. end if; case Outc is when Failed => Outcome := Failed; when Passed => null; end case; end; end loop; if Ex /= null then begin Reraise_Occurrence (Ex.all); exception when others => Free (Ex); raise; end; end if; exception when others => for Ta of Node_Task loop abort Ta; end loop; raise; end Run_Test; ----------------------------------------------------- begin case Kind is when Check_Cond => Test_Runner_Sequential (Obj).Run (Outcome, Kind); -- Inherited procedure call. when Assert_Cond_And_Run_Test => Run_Test; end case; end Run; ---------------------------------------------------------------------------- end Apsepp.Test_Node_Class.Runner_Sequential.W_Slave_Nodes;
-- C55B03A.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 LOOP_PARAMETER IS ASSIGNED VALUES IN ASCENDING ORDER -- IF REVERSE IS ABSENT, AND DESCENDING ORDER IF REVERSE IS PRESENT. -- DAS 1/12/81 -- SPS 3/2/83 WITH REPORT; PROCEDURE C55B03A IS USE REPORT; I1 : INTEGER; BEGIN TEST( "C55B03A" , "CHECK CORRECT ORDER OF VALUE SEQUENCING" & " FOR A LOOP_PARAMETER" ); I1 := 0; FOR I IN IDENT_INT(1)..IDENT_INT(5) LOOP I1 := I1 + 1; IF ( I /= I1 ) THEN FAILED ( "LOOP_PARAMETER ASCENDING INCORRECTLY" ); END IF; END LOOP; I1 := 6; FOR I IN REVERSE IDENT_INT(1)..IDENT_INT(5) LOOP I1 := I1 - 1; IF ( I /= I1 ) THEN FAILED ( "LOOP_PARAMETER DESCENDING INCORRECTLY" ); END IF; END LOOP; RESULT; END C55B03A;
-- for the Real type with Support; use Support; -- for text io with Ada.Text_IO; use Ada.Text_IO; with Support.Strings; use Support.Strings; -- for data io with BSSNBase.Data_IO; -- for parsing of the command line arguments with Support.RegEx; use Support.RegEx; with Support.CmdLine; use Support.CmdLine; -- for evolution of initial data with BSSNBase; use BSSNBase; with BSSNBase.Evolve; with BSSNBase.Runge; procedure BSSNEvolve is package Real_IO is new Ada.Text_IO.Float_IO (Real); use Real_IO; package Integer_IO is new Ada.Text_IO.Integer_IO (Integer); use Integer_IO; procedure initialize is re_intg : String := "([-+]?[0-9]+)"; re_real : String := "([-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?)"; -- note counts as 2 groups (1.234(e+56)) re_intg_seq : String := re_intg&"x"&re_intg&"x"&re_intg; re_real_seq_1 : String := re_real; re_real_seq_2 : String := re_real&":"&re_real; re_real_seq_3 : String := re_real&":"&re_real&":"&re_real; begin if find_command_arg('h') then Put_Line (" Usage: bssnevolve [-Cc:cmin] [-pNum] [-PInterval] [-Mmax] [-Ncores] \"); Put_Line (" [-tEndTime] [-Fdt] [-Ddata] [-Oresults] [-h]"); Put_Line (" -Cc:cmin : Set the Courant factor to c with minimum cmin, default: c=0.25, cmin=0.025"); Put_Line (" -pNum : Report results every Num time steps, default: p=10"); Put_Line (" -PInterval : Report results after Interval time, default: P=1000.0"); Put_line (" -Mmax : Halt after max time steps, default: M=1000"); Put_Line (" -NNumCores : Use NumCores on multi-core cpus, default: max. number of cores"); Put_Line (" -tEndTime : Halt at this time, default: t=11.0"); Put_Line (" -Fdt : Force fixed time steps of dt, default: variable time step set by Courant"); Put_Line (" -Ddata : Where to find the initial data, default: data/"); Put_Line (" -Oresults : Where to save the results, default: results/"); Put_Line (" -h : This message."); Support.Halt (0); else courant := grep (read_command_arg ('C',"0.25"),re_real_seq_1,1,fail=>0.25); courant_min := grep (read_command_arg ('C',"0.25:0.025"),re_real_seq_2,3,fail=>0.025); print_cycle := read_command_arg ('p',10); print_time_step := read_command_arg ('P',0.10); max_loop := read_command_arg ('M',1000); end_time := read_command_arg ('t',11.0); constant_time_step := read_command_arg ('F',1.0e66); end if; end initialize; begin initialize; echo_command_line; -- two data formats: must match choice with that in adminitial.adb -- data in binary format -- BSSNBase.Data_IO.read_grid; -- BSSNBase.Data_IO.read_data; -- data in plain text format BSSNBase.Data_IO.read_grid_fmt; BSSNBase.Data_IO.read_data_fmt; BSSNBase.Evolve.evolve_data; end BSSNEvolve;
----------------------------------------------------------------------- -- gen-model-xmi -- UML-XMI model -- Copyright (C) 2012, 2013, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Hash; with Ada.Containers.Vectors; with Util.Beans.Objects; with Util.Strings.Sets; package Gen.Model.XMI is use Ada.Strings.Unbounded; type Element_Type is (XMI_UNKNOWN, XMI_PACKAGE, XMI_CLASS, XMI_GENERALIZATION, XMI_ASSOCIATION, XMI_ASSOCIATION_END, XMI_ATTRIBUTE, XMI_OPERATION, XMI_PARAMETER, XMI_ENUMERATION, XMI_ENUMERATION_LITERAL, XMI_TAGGED_VALUE, XMI_TAG_DEFINITION, XMI_DATA_TYPE, XMI_STEREOTYPE, XMI_COMMENT); -- Defines the visibility of an element (a package, class, attribute, operation). type Visibility_Type is (VISIBILITY_PUBLIC, VISIBILITY_PACKAGE, VISIBILITY_PROTECTED, VISIBILITY_PRIVATE); -- Defines whether an attribute or association changes. type Changeability_Type is (CHANGEABILITY_INSERT, CHANGEABILITY_CHANGEABLE, CHANGEABILITY_FROZEN); type Parameter_Type is (PARAM_IN, PARAM_OUT, PARAM_INOUT, PARAM_RETURN); type Model_Element; type Tagged_Value_Element; type Tag_Definition_Element; type Model_Element_Access is access all Model_Element'Class; type Tagged_Value_Element_Access is access all Tagged_Value_Element'Class; type Tag_Definition_Element_Access is access all Tag_Definition_Element'Class; -- Define a list of model elements. package Model_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Model_Element_Access); subtype Model_Vector is Model_Vectors.Vector; subtype Model_Cursor is Model_Vectors.Cursor; -- Define a map to search an element from its XMI ID. package Model_Map is new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Model_Element_Access, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); subtype Model_Map_Cursor is Model_Map.Cursor; type Model_Map_Access is access all Model_Map.Map; -- Returns true if the table cursor contains a valid table function Has_Element (Position : in Model_Map_Cursor) return Boolean renames Model_Map.Has_Element; -- Returns the table definition. function Element (Position : in Model_Map_Cursor) return Model_Element_Access renames Model_Map.Element; -- Move the iterator to the next table definition. procedure Next (Position : in out Model_Map_Cursor) renames Model_Map.Next; -- Iterate on the model element of the type <tt>On</tt> and execute the <tt>Process</tt> -- procedure. procedure Iterate (Model : in Model_Map.Map; On : in Element_Type; Process : not null access procedure (Id : in Unbounded_String; Node : in Model_Element_Access)); -- Generic procedure to iterate over the XMI elements of a vector -- and having the entity name <b>name</b>. generic type T (<>) is limited private; procedure Iterate_Elements (Closure : in out T; List : in Model_Vector; Process : not null access procedure (Closure : in out T; Node : in Model_Element_Access)); -- Map of UML models indexed on the model name. package UML_Model_Map is new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Model_Map.Map, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "=", "=" => Model_Map."="); subtype UML_Model is UML_Model_Map.Map; type UML_Model_Access is access all UML_Model; type Search_Type is (BY_NAME, BY_ID); -- Find the model element with the given XMI id. -- Returns null if the model element is not found. function Find (Model : in Model_Map.Map; Key : in String; Mode : in Search_Type := BY_ID) return Model_Element_Access; -- Find the model element within all loaded UML models. -- Returns null if the model element is not found. function Find (Model : in UML_Model; Current : in Model_Map.Map; Id : in Ada.Strings.Unbounded.Unbounded_String) return Model_Element_Access; -- Dump the XMI model elements. procedure Dump (Map : in Model_Map.Map); -- Reconcile all the UML model elements by resolving all the references to UML elements. procedure Reconcile (Model : in out UML_Model; Debug : in Boolean := False); -- ------------------------------ -- Model Element -- ------------------------------ type Model_Element (Model : Model_Map_Access) is abstract new Definition with record -- Element XMI id. XMI_Id : Ada.Strings.Unbounded.Unbounded_String; -- List of tagged values for the element. Tagged_Values : Model_Vector; -- Elements contained. Elements : Model_Vector; -- Stereotypes associated with the element. Stereotypes : Model_Vector; -- The parent model element; Parent : Model_Element_Access; end record; -- Get the element type. function Get_Type (Node : in Model_Element) return Element_Type is abstract; -- Reconcile the element by resolving the references to other elements in the model. procedure Reconcile (Node : in out Model_Element; Model : in UML_Model); -- Find the element with the given name. If the name is a qualified name, navigate -- down the package/class to find the appropriate element. -- Returns null if the element was not found. function Find (Node : in Model_Element; Name : in String) return Model_Element_Access; -- Set the model name. procedure Set_Name (Node : in out Model_Element; Value : in Util.Beans.Objects.Object); -- Set the model XMI unique id. procedure Set_XMI_Id (Node : in out Model_Element; Value : in Util.Beans.Objects.Object); -- Validate the node definition as much as we can before the reconcile phase. -- If an error is detected, return a message. Returns an empty string if everything is ok. function Get_Error_Message (Node : in Model_Element) return String; -- Find the tag value element with the given name. -- Returns null if there is no such tag. function Find_Tag_Value (Node : in Model_Element; Name : in String) return Tagged_Value_Element_Access; -- Find the tag value associated with the given tag definition. -- Returns the tag value if it was found, otherwise returns the default function Find_Tag_Value (Node : in Model_Element; Definition : in Tag_Definition_Element_Access; Default : in String := "") return String; -- Get the documentation and comment associated with the model element. -- Returns the empty string if there is no comment. function Get_Comment (Node : in Model_Element) return String; -- Get the full qualified name for the element. function Get_Qualified_Name (Node : in Model_Element) return String; -- Dump the node to get some debugging description about it. procedure Dump (Node : in Model_Element); -- Find from the model file identified by <tt>Name</tt>, the model element with the -- identifier or name represented by <tt>Key</tt>. -- Returns null if the model element is not found. generic type Element_Type is new Model_Element with private; type Element_Type_Access is access all Element_Type'Class; function Find_Element (Model : in UML_Model; Name : in String; Key : in String; Mode : in Search_Type := BY_ID) return Element_Type_Access; -- ------------------------------ -- Data type -- ------------------------------ type Ref_Type_Element is new Model_Element with record Ref_Id : Unbounded_String; Ref : Model_Element_Access; end record; type Ref_Type_Element_Access is access all Ref_Type_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Ref_Type_Element) return Element_Type; -- Reconcile the element by resolving the references to other elements in the model. overriding procedure Reconcile (Node : in out Ref_Type_Element; Model : in UML_Model); -- Set the reference id and collect in the profiles set the UML profiles that must -- be loaded to get the reference. procedure Set_Reference_Id (Node : in out Ref_Type_Element; Ref : in String; Profiles : in out Util.Strings.Sets.Set); -- ------------------------------ -- Data type -- ------------------------------ type Data_Type_Element is new Model_Element with null record; type Data_Type_Element_Access is access all Data_Type_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Data_Type_Element) return Element_Type; -- ------------------------------ -- Enum -- ------------------------------ type Enum_Element is new Data_Type_Element with null record; type Enum_Element_Access is access all Enum_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Enum_Element) return Element_Type; -- Validate the node definition as much as we can before the reconcile phase. -- An enum must not be empty, it must have at least one literal. -- If an error is detected, return a message. Returns an empty string if everything is ok. overriding function Get_Error_Message (Node : in Enum_Element) return String; -- ------------------------------ -- Literal -- ------------------------------ -- The literal describes a possible value for an enum. type Literal_Element is new Model_Element with null record; type Literal_Element_Access is access all Literal_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Literal_Element) return Element_Type; -- Create an enum literal and add it to the enum. procedure Add_Literal (Node : in out Enum_Element; Id : in Util.Beans.Objects.Object; Name : in Util.Beans.Objects.Object; Literal : out Literal_Element_Access); -- ------------------------------ -- Stereotype -- ------------------------------ type Stereotype_Element is new Model_Element with null record; type Stereotype_Element_Access is access all Stereotype_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Stereotype_Element) return Element_Type; -- Returns True if the model element has the stereotype with the given name. function Has_Stereotype (Node : in Model_Element'Class; Stereotype : in Stereotype_Element_Access) return Boolean; -- ------------------------------ -- Comment -- ------------------------------ type Comment_Element is new Model_Element with record Text : Ada.Strings.Unbounded.Unbounded_String; Ref_Id : Ada.Strings.Unbounded.Unbounded_String; end record; type Comment_Element_Access is access all Comment_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Comment_Element) return Element_Type; -- ------------------------------ -- An operation -- ------------------------------ type Operation_Element is new Model_Element with record Visibility : Visibility_Type := VISIBILITY_PUBLIC; end record; type Operation_Element_Access is access all Operation_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Operation_Element) return Element_Type; -- ------------------------------ -- An attribute -- ------------------------------ type Attribute_Element is new Ref_Type_Element with record Data_Type : Data_Type_Element_Access; Visibility : Visibility_Type := VISIBILITY_PUBLIC; Changeability : Changeability_Type := CHANGEABILITY_CHANGEABLE; Initial_Value : Util.Beans.Objects.Object; Multiplicity_Lower : Integer := 0; Multiplicity_Upper : Integer := 1; end record; type Attribute_Element_Access is access all Attribute_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Attribute_Element) return Element_Type; -- Reconcile the element by resolving the references to other elements in the model. overriding procedure Reconcile (Node : in out Attribute_Element; Model : in UML_Model); -- ------------------------------ -- A parameter -- ------------------------------ type Parameter_Element is new Attribute_Element with record Kind : Parameter_Type := PARAM_IN; end record; type Parameter_Element_Access is access all Parameter_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Parameter_Element) return Element_Type; -- ------------------------------ -- An association end -- ------------------------------ type Association_End_Element is new Ref_Type_Element with record Visibility : Visibility_Type := VISIBILITY_PUBLIC; Multiplicity_Lower : Integer := 0; Multiplicity_Upper : Integer := 0; Target_Element : Model_Element_Access; Source_Element : Model_Element_Access; Navigable : Boolean := True; end record; type Association_End_Element_Access is access all Association_End_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Association_End_Element) return Element_Type; -- Get the documentation and comment associated with the model element. -- Integrates the comment from the association itself as well as this association end. -- Returns the empty string if there is no comment. overriding function Get_Comment (Node : in Association_End_Element) return String; -- Reconcile the element by resolving the references to other elements in the model. overriding procedure Reconcile (Node : in out Association_End_Element; Model : in UML_Model); -- Make the association between the two ends. procedure Make_Association (From : in out Association_End_Element; To : in out Association_End_Element'Class; Model : in UML_Model); -- ------------------------------ -- An association -- ------------------------------ type Association_Element is new Model_Element with record Visibility : Visibility_Type := VISIBILITY_PUBLIC; Connections : Model_Vector; end record; type Association_Element_Access is access all Association_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Association_Element) return Element_Type; -- Validate the node definition as much as we can before the reconcile phase. -- An association must contain two ends and a name is necessary on the navigable ends. -- If an error is detected, return a message. Returns an empty string if everything is ok. overriding function Get_Error_Message (Node : in Association_Element) return String; -- Reconcile the association between classes in the package. Find the association -- ends and add the necessary links to the corresponding class elements. overriding procedure Reconcile (Node : in out Association_Element; Model : in UML_Model); -- ------------------------------ -- An association -- ------------------------------ type Generalization_Element is new Ref_Type_Element with record Child_Class : Model_Element_Access; Child_Id : Ada.Strings.Unbounded.Unbounded_String; end record; type Generalization_Element_Access is access all Generalization_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Generalization_Element) return Element_Type; -- Reconcile the association between classes in the package. Find the association -- ends and add the necessary links to the corresponding class elements. overriding procedure Reconcile (Node : in out Generalization_Element; Model : in UML_Model); -- ------------------------------ -- Tag Definition -- ------------------------------ TAG_DOCUMENTATION : constant String := "documentation"; TAG_AUTHOR : constant String := "author"; type Tag_Definition_Element is new Model_Element with record Multiplicity_Lower : Natural := 0; Multiplicity_Upper : Natural := 0; end record; -- Get the element type. overriding function Get_Type (Node : in Tag_Definition_Element) return Element_Type; -- ------------------------------ -- Tagged value -- ------------------------------ type Tagged_Value_Element is new Ref_Type_Element with record Value : Ada.Strings.Unbounded.Unbounded_String; Value_Type : Ada.Strings.Unbounded.Unbounded_String; Tag_Def : Tag_Definition_Element_Access; end record; -- Get the element type. overriding function Get_Type (Node : in Tagged_Value_Element) return Element_Type; -- Reconcile the element by resolving the references to other elements in the model. overriding procedure Reconcile (Node : in out Tagged_Value_Element; Model : in UML_Model); -- ------------------------------ -- A class -- ------------------------------ type Class_Element is new Data_Type_Element with record Operations : Model_Vector; Attributes : Model_Vector; Associations : Model_Vector; Visibility : Visibility_Type := VISIBILITY_PUBLIC; Parent_Class : Ref_Type_Element_Access; end record; type Class_Element_Access is access all Class_Element'Class; -- Get the element type. overriding function Get_Type (Node : in Class_Element) return Element_Type; -- Reconcile the element by resolving the references to other elements in the model. overriding procedure Reconcile (Node : in out Class_Element; Model : in UML_Model); -- ------------------------------ -- A package -- ------------------------------ type Package_Element; type Package_Element_Access is access all Package_Element'Class; type Package_Element is new Model_Element with record Classes : Model_Vector; Enums : Model_Vector; Associations : Model_Vector; Is_Profile : Boolean := False; end record; -- Get the element type. overriding function Get_Type (Node : in Package_Element) return Element_Type; end Gen.Model.XMI;
------------------------------------------------------------------------------ -- AGAR CORE LIBRARY -- -- A G A R . O B J E C T -- -- S p e c -- ------------------------------------------------------------------------------ with Agar.Data_Source; with Agar.Event; with Agar.Timer; with Agar.Types; use Agar.Types; with Interfaces; with Interfaces.C; with Interfaces.C.Strings; with System; -- -- Interface to the Agar Object System. This defines the base type, Agar.Object. -- It maps transparently to AG_Object(3) in C. This allows new Agar object -- classes to be written in Ada (and subclasses of Ada-implemented classes -- to be written also in Ada, or again in C). -- -- In C, Agar objects are structs derived from AG_Object. Similarly in Ada, -- Agar object instances are limited records which derive from Agar.Object. -- -- Shared, class-wide data is represented by limited records which derive -- from Agar.Class (equivalent to AG_ObjectClass in C). -- package Agar.Object is package C renames Interfaces.C; package CS renames Interfaces.C.Strings; package DS renames Agar.Data_Source; package EV renames Agar.Event; package TMR renames Agar.Timer; NAME_MAX : constant Natural := $AG_OBJECT_NAME_MAX; HIERARCHY_MAX : constant Natural := $AG_OBJECT_HIER_MAX; TYPE_MAX : constant Natural := $AG_OBJECT_TYPE_MAX; LIBRARIES_MAX : constant Natural := $AG_OBJECT_LIBS_MAX; ---------------- -- Base Types -- ---------------- type Signed_8 is range -127 .. 127 with Convention => C; for Signed_8'Size use 8; type Signed_16 is range -(2 **15) .. +(2 **15 - 1) with Convention => C; for Signed_16'Size use 16; type Signed_32 is range -(2 **31) .. +(2 **31 - 1) with Convention => C; for Signed_32'Size use 32; type Signed_64 is range -(2 **63) .. +(2 **63 - 1) with Convention => C; for Signed_64'Size use 64; subtype Unsigned_8 is Interfaces.Unsigned_8; subtype Unsigned_16 is Interfaces.Unsigned_16; subtype Unsigned_32 is Interfaces.Unsigned_32; subtype Unsigned_64 is Interfaces.Unsigned_64; #if HAVE_FLOAT subtype Float is Interfaces.C.C_float; subtype Double is Interfaces.C.double; # if HAVE_LONG_DOUBLE subtype Long_Double is Interfaces.C.long_double; # end if; #end if; -------------------------- -- Agar Object variable -- -------------------------- type Variable is array (1 .. $SIZEOF_AG_Variable) of aliased Interfaces.Unsigned_8 with Convention => C; for Variable'Size use $SIZEOF_AG_Variable * System.Storage_Unit; type Variable_Access is access all Variable with Convention => C; subtype Variable_not_null_Access is not null Variable_Access; ------------------------------- -- Serialized Object version -- ------------------------------- type Version_t is record Major : Interfaces.Unsigned_32; Minor : Interfaces.Unsigned_32; end record with Convention => C; type Version_Access is access all Version_t with Convention => C; -------------------------- -- Agar Object Instance -- -------------------------- type Object; type Object_Access is access all Object with Convention => C; subtype Object_not_null_Access is not null Object_Access; type Object_Name is array (1 .. NAME_MAX) of aliased c.char with Convention => C; type Class; type Class_Access is access all Class with Convention => C; subtype Class_not_null_Access is not null Class_Access; type Dependency is array (1 .. $SIZEOF_AG_ObjectDep) of aliased Interfaces.Unsigned_8 with Convention => C; for Dependency'Size use $SIZEOF_Ag_ObjectDep * System.Storage_Unit; type Dependency_Access is access all Dependency with Convention => C; subtype Dependency_not_null_Access is not null Dependency_Access; type Dependency_List is limited record First : Dependency_Access; Last : access Dependency_Access; end record with Convention => C; type Event_List is limited record First : EV.Event_Access; Last : access EV.Event_Access; end record with Convention => C; type Timer_List is limited record First : TMR.Timer_Access; Last : access TMR.Timer_Access; end record with Convention => C; type Variable_List is limited record First : Variable_Access; Last : access Variable_Access; end record with Convention => C; type Children_List is limited record First : Object_Access; Last : access Object_Access; end record with Convention => C; type Entry_in_Parent_t is limited record Next : Object_Access; Prev : access Object_Access; end record with Convention => C; type Object_Private is array (1 .. $SIZEOF_AG_ObjectPvt) of aliased Interfaces.Unsigned_8 with Convention => C; for Object_Private'Size use $SIZEOF_AG_ObjectPvt * System.Storage_Unit; OBJECT_FLOATING_VARIABLES : constant C.unsigned := 16#0_0001#; OBJECT_NON_PERSISTENT : constant C.unsigned := 16#0_0002#; OBJECT_INDESTRUCTIBLE : constant C.unsigned := 16#0_0004#; OBJECT_RESIDENT : constant C.unsigned := 16#0_0008#; OBJECT_PRESERVE_DEPENDENCIES : constant C.unsigned := 16#0_0010#; OBJECT_STATIC : constant C.unsigned := 16#0_0020#; OBJECT_READ_ONLY : constant C.unsigned := 16#0_0040#; OBJECT_WAS_RESIDENT : constant C.unsigned := 16#0_0080#; OBJECT_REOPEN_ON_LOAD : constant C.unsigned := 16#0_0200#; OBJECT_REMAIN_DATA : constant C.unsigned := 16#0_0400#; OBJECT_DEBUG : constant C.unsigned := 16#0_0800#; OBJECT_NAME_ON_ATTACH : constant C.unsigned := 16#0_1000#; OBJECT_CHILD_AUTO_SAVE : constant C.unsigned := 16#0_2000#; OBJECT_DEBUG_DATA : constant C.unsigned := 16#0_4000#; OBJECT_IN_ATTACH_ROUTINE : constant C.unsigned := 16#0_8000#; OBJECT_IN_DETACH_ROUTINE : constant C.unsigned := 16#1_0000#; OBJECT_BOUND_EVENTS : constant C.unsigned := 16#2_0000#; type Object is limited record Name : Object_Name; -- TODO 1.6 archivePath/savePfx are going away Archive_Path : CS.chars_ptr; Save_Prefix : CS.chars_ptr; Class : Class_not_null_Access; Flags : C.unsigned; Events : Event_List; Timers : Timer_List; Variables : Variable_List; Dependencies : Dependency_List; Children : Children_List; Entry_in_Parent : Entry_in_Parent_t; Parent : Object_Access; Root : Object_Access; Private_Data : Object_Private; end record with Convention => C; ------------------------------------- -- Accesses to Base Object Methods -- ------------------------------------- type Init_Func_Access is access procedure (Object : Object_Access) with Convention => C; type Reset_Func_Access is access procedure (Object : Object_Access) with Convention => C; type Destroy_Func_Access is access procedure (Object : Object_Access) with Convention => C; type Load_Func_Access is access function (Object : Object_Access; Source : DS.Data_Source_Access; Version : Version_Access) return C.int with Convention => C; type Save_Func_Access is access function (Object : Object_Access; Dest : DS.Data_Source_Access) return C.int with Convention => C; type Edit_Func_Access is access function (Object : Object_Access) return System.Address with Convention => C; ------------------------------ -- Object Class Description -- ------------------------------ type Class_Name is array (1 .. TYPE_MAX) of aliased c.char with Convention => C; type Class_Hierarchy is array (1 .. HIERARCHY_MAX) of aliased c.char with Convention => C; type Class_Private is array (1 .. $SIZEOF_AG_ObjectClassPvt) of aliased Interfaces.Unsigned_8 with Convention => C; for Class_Private'Size use $SIZEOF_AG_ObjectClassPvt * System.Storage_Unit; type Class_Private_Access is access all Class_Private with Convention => C; type Class is limited record Hierarchy : Class_Hierarchy; Size : AG_Size; Version : Version_t; Init_Func : Init_Func_Access; Reset_Func : Reset_Func_Access; Destroy_Func : Destroy_Func_Access; Load_Func : Load_Func_Access; Save_Func : Save_Func_Access; Edit_Func : Edit_Func_Access; -- Generated fields -- Name : Class_Name; Superclass : Class_Access; Private_Data : Class_Private; end record with Convention => C; --------------------------------- -- Serialized Object Signature -- --------------------------------- type Object_Header is array (1 .. $SIZEOF_AG_ObjectHeader) of aliased Interfaces.Unsigned_8 with Convention => C; for Object_Header'Size use $SIZEOF_AG_ObjectHeader * System.Storage_Unit; type Header_Access is access all Object_Header with Convention => C; subtype Header_not_null_Access is not null Header_Access; ----------------------- -- Virtual Functions -- ----------------------- type Function_Access is access all EV.Event with Convention => C; subtype Function_not_null_Access is not null Function_Access; type Event_Func_Access is not null access procedure (Event : EV.Event_Access) with Convention => C; -- -- Create a new instance of Class under Parent with the given name. Fail -- and return null if an object of the same name already exists. -- function New_Object (Parent : in Object_Access; Name : in String; Class : in Class_not_null_Access) return Object_Access; -- -- Create a new instance of Class under Parent, without naming the object. -- function New_Object (Parent : in Object_Access; Class : in Class_not_null_Access) return Object_Access; -- -- Create a new instance of Class not attached to any parent. -- function New_Object (Class : in Class_not_null_Access) return Object_Access; -- -- Initialize an Agar Object. Used internally by New_Object. Static should be -- set unless Object points to auto-allocated and Agar-freeable memory. -- procedure Init_Object (Object : in Object_not_null_Access; Class : in Class_not_null_Access; Static : in Boolean := False); -- -- Make Object a child of Parent. -- procedure Attach (Parent : in Object_Access; Child : in Object_not_null_Access); -- -- Detach Object from its current Parent (if any). -- procedure Detach (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectDetach"; -- -- Change an object's position within its parent's list of child objects. -- This list is ordered and the order is preserved by serialization. -- procedure Move_Up (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectMoveUp"; procedure Move_Down (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectMoveDown"; procedure Move_To_Head (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectMoveToHead"; procedure Move_To_Tail (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectMoveToTail"; -- Shorthand for Detach and Destroy. --procedure Delete (Object : in Object_not_null_Access) -- with Import, Convention => C, Link_Name => "AG_ObjectDelete"; -- -- Return the root object of the VFS that Object is part of. -- May return the Object itself if Object is the VFS root. -- function Root (Object : in Object_not_null_Access) return Object_not_null_Access with Import, Convention => C, Link_Name => "AG_ObjectRoot"; -- -- Return an access to the Parent of an Object (which can be Null). -- function Parent (Object : in Object_not_null_Access) return Object_Access with Import, Convention => C, Link_Name => "AG_ObjectParent"; -- -- Lookup an object using an absolute path name (relative to the root of -- the VFS which has object Root as its root). -- function Find (Root : in Object_not_null_Access; Path : in String) return Object_Access; -- -- Search for a parent object matching Name and Object_Type. -- function Find_Parent (Object : in Object_not_null_Access; Name : in String; Class : in String) return Object_Access; -- -- Return Parent's first immediate child object called Name. -- function Find_Child (Parent : in Object_not_null_Access; Name : in String) return Object_Access; -- -- Return the fully qualified path name of Object (within its parent VFS). -- The "/" character is used as path separator. -- function Get_Name (Object : in Object_not_null_Access) return String; -- -- Acquire or release the general-purpose mutex lock protecting Object's data. -- This lock is always held implicitely during event processing. -- procedure Lock (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "ag_object_lock"; procedure Unlock (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "ag_object_unlock"; -- -- Acquire or release the mutex lock protecting the entire VFS. -- procedure Lock_VFS (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "ag_lock_vfs"; procedure Unlock_VFS(Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "ag_unlock_vfs"; -- -- Rename the object. Does not check for potential conflict. -- procedure Set_Name (Object : in Object_not_null_Access; Name : in String); -- -- Return a unique (relative to its Parent) name for the Object. -- With a class argument, use the form : "<Class name> #123" -- With a Prefix string, use the form : "<Prefix> #123" -- function Generate_Name (Object : in Object_not_null_Access; Class : in Class_not_null_Access) return String; function Generate_Name (Object : in Object_not_null_Access; Prefix : in String) return String; -- -- Register a new class given a class description. -- procedure Register_Class (Class : Class_not_null_Access) with Import, Convention => C, Link_Name => "AG_RegisterClass"; -- -- Delete an existing class. -- procedure Unregister_Class (Class : Class_not_null_Access) with Import, Convention => C, Link_Name => "AG_UnregisterClass"; -- -- Register a new Agar object class. -- function Create_Class (Hierarchy : in String; Object_Size : in Natural; Class_Size : in Natural; Major : in Natural := 1; Minor : in Natural := 0; Init_Func : in Init_Func_Access := null; Reset_Func : in Reset_Func_Access := null; Destroy_Func : in Destroy_Func_Access := null; Load_Func : in Load_Func_Access := null; Save_Func : in Save_Func_Access := null; Edit_Func : in Edit_Func_Access := null) return Class_not_null_Access; -- -- Remove and deallocate an Agar object class. -- procedure Destroy_Class (Class : Class_not_null_Access) with Import, Convention => C, Link_Name => "AG_DestroyClass"; -- -- Modify the initialization procedure of a class. -- procedure Class_Set_Init (Class : in Class_not_null_Access; Init_Func : in Init_Func_Access); function Class_Set_Init (Class : in Class_not_null_Access; Init_Func : in Init_Func_Access) return Init_Func_Access; -- -- Modify the reset procedure of a class. -- procedure Class_Set_Reset (Class : in Class_not_null_Access; Reset_Func : in Reset_Func_Access); function Class_Set_Reset (Class : in Class_not_null_Access; Reset_Func : in Reset_Func_Access) return Reset_Func_Access; -- -- Modify the finalization procedure of a class. -- procedure Class_Set_Destroy (Class : in Class_not_null_Access; Destroy_Func : in Destroy_Func_Access); function Class_Set_Destroy (Class : in Class_not_null_Access; Destroy_Func : in Destroy_Func_Access) return Destroy_Func_Access; -- -- Modify the deserialization function of a class. -- procedure Class_Set_Load (Class : in Class_not_null_Access; Load_Func : in Load_Func_Access); function Class_Set_Load (Class : in Class_not_null_Access; Load_Func : in Load_Func_Access) return Load_Func_Access; -- -- Modify the serialization function of a class. -- procedure Class_Set_Save (Class : in Class_not_null_Access; Save_Func : in Save_Func_Access); function Class_Set_Save (Class : in Class_not_null_Access; Save_Func : in Save_Func_Access) return Save_Func_Access; -- -- Modify the (application-specific) edit function of a class. -- procedure Class_Set_Edit (Class : in Class_not_null_Access; Edit_Func : in Edit_Func_Access); function Class_Set_Edit (Class : in Class_not_null_Access; Edit_Func : in Edit_Func_Access) return Edit_Func_Access; -- -- Register a new namespace and prefix. This is used for expanding inheritance -- hierarchy strings such as "Agar(Foo:Bar)" to "AG_Foo:AG_Bar". -- For example, ("Agar", "AG_", "http://libagar.org/"). -- procedure Register_Namespace (Name : in String; Prefix : in String; URL : in String); procedure Unregister_Namespace (Name : in String); -- -- Return access to the registered class described by a hierarchy string. -- function Lookup_Class (Class : in String) return Class_Access; -- -- Load any module (and register any class) required to satisfy the given -- inheritance hierarchy. Modules are specified as a comma-separated list -- following '@'. For example: "MySuper:MySubclass@mymodule" specifies -- that Load_Class should scan the registered Module Directories for a DSO -- such as mymodule.so. If found, it expects to find a symbol "mySubclass" -- pointing to an initialized Class describing MySubclass. -- function Load_Class (Class : in String) return Class_Access; -- -- Add or remove directories to the search path used by Load_Class. -- procedure Register_Module_Directory (Path : in String); procedure Unregister_Module_Directory (Path : in String); -- -- Test if Object is a member of the class described by a String pattern. -- Pattern describes an inheritance hierarchy with possible wildcards ("*"). -- "Vehicle:Car" <= True if this is a Car (but not a subclass of Car). -- "Vehicle:Car:*" <= True if this is a Car (or a subclass of Car). -- function Is_Of_Class (Object : in Object_not_null_Access; Pattern : in String) return Boolean; function Is_A (Object : in Object_not_null_Access; Pattern : in String) return Boolean; -- -- Test if an object is being referenced by another object in the same VFS. -- function In_Use (Object : in Object_not_null_Access) return Boolean; -- -- Add Dependency to Object's dependency table. If Persistent is True, -- mark the reference as serializable. -- function Add_Dependency (Object : in Object_not_null_Access; Dependency : in Object_not_null_Access; Persistent : in Boolean := False) return Dependency_Access; -- -- Remove Dependency from Object's dependency table. -- procedure Delete_Dependency (Object : in Object_not_null_Access; Dependency : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectDelDep"; -- -- Return a serializable handle uniquely identifying the entry corresponding -- to the object Dependency within Object's dependency table. -- function Encode_Dependency (Object : in Object_not_null_Access; Dependency : in Object_not_null_Access) return Interfaces.Unsigned_32 with Import, Convention => C, Link_Name => "AG_ObjectEncodeName"; -- -- Resolve a dependency handle previously generated by Encode_Dependency. If -- successful, return access to the resolved Object in Pointer. -- function Find_Dependency (Object : in Object_not_null_Access; Index : in Interfaces.Unsigned_32; Pointer : access Object_not_null_Access) return Boolean; -- -- Free an Object instance from memory. -- procedure Destroy (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectDestroy"; -- -- Restore the Object to an initial state. Invoked by both Load and Destroy. -- procedure Reset (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectReset"; -- -- Clear the registered event handlers, Variables and Dependencies. -- procedure Free_Events (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectFreeEvents"; procedure Free_Variables (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectFreeVariables"; procedure Free_Dependencies (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectFreeDeps"; -- -- Remove any dependencies with a reference count of 0. -- procedure Clean_Up_Dependencies (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectFreeDummyDeps"; -- -- Detach and Destroy all child objects. -- procedure Free_Children (Object : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectFreeChildren"; -- -- Load the state of an object from serialized storage. -- -- If File is not given, load from the application's default data directory -- (see: Agar.Init.Init_Core arguments Program_Name, Create_Directory). -- function Load (Object : in Object_not_null_Access) return Boolean; function Load (Object : in Object_not_null_Access; File : in String) return Boolean; -- -- Load an Object's data part only (ignoring the generic Object part). -- function Load_Data (Object : in Object_not_null_Access) return Boolean; function Load_Data (Object : in Object_not_null_Access; File : in String) return Boolean; -- -- Load an Object's generic part only (ignoring its data part). -- function Load_Generic (Object : in Object_not_null_Access) return Boolean; function Load_Generic (Object : in Object_not_null_Access; File : in String) return Boolean; -- -- Save the state of an object to serialized storage. -- -- If File is not given, save to the application's default data directory -- (see: Agar.Init.Init_Core arguments Program_Name, Create_Directory). -- function Save (Object : in Object_not_null_Access) return Boolean; function Save (Object : in Object_not_null_Access; File : in String) return Boolean; -- -- Save the state of an Object and all of its descendants to the default -- data directory. -- function Save_All (Object : in Object_not_null_Access) return Boolean; -- -- Transfer a serialized representation of an object from/to an Agar data -- source (which could be a file, memory, network stream, etc). -- function Serialize (Object : in Object_not_null_Access; Source : in DS.Data_Source_not_null_Access) return Boolean; function Unserialize (Object : in Object_not_null_Access; Source : in DS.Data_Source_not_null_Access) return Boolean; -- -- Try reading an Agar object signature from a data source. If successful -- (True), return signature information in Header. -- function Read_Header (Source : in DS.Data_Source_not_null_Access; Header : in Header_Access) return Boolean; -- -- Page the data of an object in or out of serialized storage. -- function Page_In (Object : in Object_not_null_Access) return Boolean; function Page_Out (Object : in Object_not_null_Access) return Boolean; -- -- Set a callback routine for handling an event. The function forms -- returns an Event access which can be used to specify arguments -- (see Agar.Event). Set_Event does not allow more than one callback -- per event. -- -- Async => True : Process events in a separate thread. -- Propagate => True : Broadcast events to all child objects. -- function Set_Event (Object : in Object_not_null_Access; Event : in String; Func : in Event_Func_Access; Async : in Boolean := False; Propagate : in Boolean := False) return EV.Event_not_null_Access; procedure Set_Event (Object : in Object_not_null_Access; Event : in String; Func : in Event_Func_Access; Async : in Boolean := False; Propagate : in Boolean := False); -- -- Variant of Set_Event which allows more than one callback per Event. -- Instead of replacing an existing Event, Add_Event appends the callback -- the list. All registered callbacks will be invoked by Post_Event. -- function Add_Event (Object : in Object_not_null_Access; Event : in String; Func : in Event_Func_Access; Async : in Boolean := False; Propagate : in Boolean := False) return EV.Event_not_null_Access; procedure Add_Event (Object : in Object_not_null_Access; Event : in String; Func : in Event_Func_Access; Async : in Boolean := False; Propagate : in Boolean := False); -- -- Post an Event to a Target object. -- Message-passing style with specified Source object. -- procedure Post_Event (Source : in Object_Access; Target : in Object_not_null_Access; Event : in String); procedure Post_Event (Source : in Object_Access; Target : in Object_not_null_Access; Event : in EV.Event_not_null_Access); -- -- Post an Event to a Target object. -- Anonymous style without specified Source. -- procedure Post_Event (Target : in Object_not_null_Access; Event : in String); procedure Post_Event (Target : in Object_not_null_Access; Event : in EV.Event_not_null_Access); -- -- Log object name and message to the console for debugging purposes. -- procedure Debug (Object : in Object_Access; Message : in String); -- -- Attach an initialized timer to an object and activate it. The callback -- routine will be executed after the timer expires in Interval milliseconds. -- Timer will be restarted or deleted based on the callback's return value. -- function Add_Timer (Object : in Object_Access; Timer : in TMR.Timer_not_null_Access; Interval : in Interfaces.Unsigned_32; Func : in TMR.Timer_Callback) return Boolean; -- -- Auto-allocated alternative to Init_Timer and Add_Timer. The timer structure -- will be auto allocated and freed implicitely. -- function Add_Timer (Object : in Object_Access; Interval : in Interfaces.Unsigned_32; Func : in TMR.Timer_Callback) return TMR.Timer_Access; -- -- Cancel and delete an active timer. -- procedure Delete_Timer (Object : in Object_not_null_Access; Timer : in TMR.Timer_not_null_Access) with Import, Convention => C, Link_Name => "AG_DelTimer"; -- -- Evaluate whether a variable is set. -- function Defined (Object : in Object_not_null_Access; Variable : in String) return Boolean; -- -- Compare two variables with no dereference. Discrete types are compared -- by value. Strings are compared case-sensitively. Reference types are -- compared by their pointer value. -- function "=" (Left, Right : in Variable_not_null_Access) return Boolean; private -- -- AG_Object(3) -- function AG_ObjectNew (Parent : in System.Address; Name : in CS.chars_ptr; Class : in Class_not_null_Access) return Object_Access with Import, Convention => C, Link_Name => "AG_ObjectNew"; procedure AG_ObjectInit (Object : in Object_not_null_Access; Class : in Class_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectInit"; procedure AG_ObjectInitStatic (Object : in Object_not_null_Access; Class : in Class_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectInitStatic"; procedure AG_ObjectAttach (Parent : in Object_Access; Child : in Object_not_null_Access) with Import, Convention => C, Link_Name => "AG_ObjectAttach"; function AG_ObjectFindS (Root : in Object_not_null_Access; Path : in CS.chars_ptr) return Object_Access with Import, Convention => C, Link_Name => "AG_ObjectFindS"; function AG_ObjectFindParent (Object : in Object_not_null_Access; Name : in CS.chars_ptr; Class : in CS.chars_ptr) return Object_Access with Import, Convention => C, Link_Name => "AG_ObjectFindParent"; function AG_ObjectFindChild (Parent : in Object_not_null_Access; Name : in CS.chars_ptr) return Object_Access with Import, Convention => C, Link_Name => "ag_object_find_child"; function AG_ObjectCopyName (Object : in Object_not_null_Access; Buffer : in System.Address; Size : in AG_Size) return C.int with Import, Convention => C, Link_Name => "AG_ObjectCopyName"; procedure AG_ObjectSetNameS (Object : in Object_not_null_Access; Name : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_ObjectSetNameS"; procedure AG_ObjectGenName (Object : in Object_not_null_Access; Class : in Class_not_null_Access; Buffer : in System.Address; Size : in AG_Size) with Import, Convention => C, Link_Name => "AG_ObjectGenName"; procedure AG_ObjectGenNamePfx (Object : in Object_not_null_Access; Prefix : in CS.chars_ptr; Buffer : in System.Address; Size : in AG_Size) with Import, Convention => C, Link_Name => "AG_ObjectGenNamePfx"; function AG_CreateClass (Hierarchy : in CS.chars_ptr; Object_Size : in AG_Size; Class_Size : in AG_Size; Major : in C.unsigned; Minor : in C.unsigned) return Class_not_null_Access with Import, Convention => C, Link_Name => "AG_CreateClass"; procedure AG_ClassSetInit (Class : in Class_not_null_Access; Init_Func : in Init_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetInit"; function AG_ClassSetInit (Class : in Class_not_null_Access; Init_Func : in Init_Func_Access) return Init_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetInit"; procedure AG_ClassSetReset (Class : in Class_not_null_Access; Reset_Func : in Reset_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetReset"; function AG_ClassSetReset (Class : in Class_not_null_Access; Reset_Func : in Reset_Func_Access) return Reset_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetReset"; procedure AG_ClassSetDestroy (Class : in Class_not_null_Access; Destroy_Func : in Destroy_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetDestroy"; function AG_ClassSetDestroy (Class : in Class_not_null_Access; Destroy_Func : in Destroy_Func_Access) return Destroy_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetDestroy"; procedure AG_ClassSetLoad (Class : in Class_not_null_Access; Load_Func : in Load_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetLoad"; function AG_ClassSetLoad (Class : in Class_not_null_Access; Load_Func : in Load_Func_Access) return Load_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetLoad"; procedure AG_ClassSetSave (Class : in Class_not_null_Access; Save_Func : in Save_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetSave"; function AG_ClassSetSave (Class : in Class_not_null_Access; Save_Func : in Save_Func_Access) return Save_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetSave"; procedure AG_ClassSetEdit (Class : in Class_not_null_Access; Edit_Func : in Edit_Func_Access) with Import, Convention => C, Link_Name => "AG_ClassSetEdit"; function AG_ClassSetEdit (Class : in Class_not_null_Access; Edit_Func : in Edit_Func_Access) return Edit_Func_Access with Import, Convention => C, Link_Name => "AG_ClassSetEdit"; procedure AG_RegisterNamespace (Name : in CS.chars_ptr; Prefix : in CS.chars_ptr; URL : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_RegisterNamespace"; procedure AG_UnregisterNamespace (Name : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_UnregisterNamespace"; function AG_LookupClass (Class : in CS.chars_ptr) return Class_Access with Import, Convention => C, Link_Name => "AG_LookupClass"; function AG_LoadClass (Class : in CS.chars_ptr) return Class_Access with Import, Convention => C, Link_Name => "AG_LoadClass"; procedure AG_RegisterModuleDirectory (Path : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_RegisterModuleDirectory"; procedure AG_UnregisterModuleDirectory (Path : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_UnregisterModuleDirectory"; function AG_OfClass (Object : in Object_not_null_Access; Pattern : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "ag_of_class"; function AG_ObjectInUse (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectInUse"; function AG_ObjectAddDep (Object : in Object_not_null_Access; Dependency : in Object_not_null_Access; Persistent : in C.int) return Dependency_Access with Import, Convention => C, Link_Name => "AG_ObjectAddDep"; function AG_ObjectFindDep (Object : in Object_not_null_Access; Index : in Interfaces.Unsigned_32; Pointer : access Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectFindDep"; function AG_ObjectLoad (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoad"; function AG_ObjectLoadFromFile (Object : in Object_not_null_Access; File : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoadFromFile"; function AG_ObjectLoadData (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoadData"; function AG_ObjectLoadDataFromFile (Object : in Object_not_null_Access; File : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoadDataFromFile"; function AG_ObjectLoadGeneric (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoadGeneric"; function AG_ObjectLoadGenericFromFile (Object : in Object_not_null_Access; File : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "AG_ObjectLoadGenericFromFile"; function AG_ObjectSave (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectSave"; function AG_ObjectSaveAll (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectSaveAll"; function AG_ObjectSaveToFile (Object : in Object_not_null_Access; File : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "AG_ObjectSaveToFile"; function AG_ObjectSerialize (Object : in Object_not_null_Access; Source : in DS.Data_Source_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectSerialize"; function AG_ObjectUnserialize (Object : in Object_not_null_Access; Source : in DS.Data_Source_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectUnserialize"; function AG_ObjectReadHeader (Object : in DS.Data_Source_not_null_Access; Header : in Header_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectReadHeader"; function AG_ObjectPageIn (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectPageIn"; function AG_ObjectPageOut (Object : in Object_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_ObjectPageOut"; procedure AG_Debug (Object : in Object_Access; Format : in CS.chars_ptr; Message : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_Debug"; -- -- AG_Event(3) -- function AG_SetEvent (Object : in Object_not_null_Access; Event : in CS.chars_ptr; Func : in Event_Func_Access; Format : in CS.chars_ptr) return EV.Event_not_null_Access with Import, Convention => C, Link_Name => "AG_SetEvent"; procedure AG_SetEvent (Object : in Object_not_null_Access; Event : in CS.chars_ptr; Func : in Event_Func_Access; Format : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_SetEvent"; function AG_AddEvent (Object : in Object_not_null_Access; Event : in CS.chars_ptr; Func : in Event_Func_Access; Format : in CS.chars_ptr) return EV.Event_not_null_Access with Import, Convention => C, Link_Name => "AG_AddEvent"; procedure AG_AddEvent (Object : in Object_not_null_Access; Event : in CS.chars_ptr; Func : in Event_Func_Access; Format : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_AddEvent"; function AG_PostEvent (Source : in Object_Access; Target : in Object_not_null_Access; Event : in CS.chars_ptr; Format : in CS.chars_ptr) return EV.Event_not_null_Access with Import, Convention => C, Link_Name => "AG_PostEvent"; procedure AG_PostEvent (Source : in Object_Access; Target : in Object_not_null_Access; Event : in CS.chars_ptr; Format : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_PostEvent"; procedure AG_PostEventByPtr (Source : in Object_Access; Target : in Object_not_null_Access; Event : in EV.Event_Access; Format : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_PostEventByPtr"; -- -- AG_Timer(3) -- function AG_AddTimer (Object : in Object_Access; Timer : in TMR.Timer_not_null_Access; Interval : in Interfaces.Unsigned_32; Func : in TMR.Timer_Callback; Flags : in C.unsigned; Format : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "AG_AddTimer"; function AG_AddTimerAuto (Object : in Object_Access; Interval : in Interfaces.Unsigned_32; Func : in TMR.Timer_Callback; Format : in CS.chars_ptr) return TMR.Timer_Access with Import, Convention => C, Link_Name => "AG_AddTimerAuto"; -------------------- -- AG_Variable(3) -- -------------------- function AG_Defined (Object : in Object_not_null_Access; Name : in CS.chars_ptr) return C.int with Import, Convention => C, Link_Name => "ag_defined"; procedure AG_CopyVariable (Destination : in Variable_not_null_Access; Source : in Variable_not_null_Access) with Import, Convention => C, Link_Name => "AG_CopyVariable"; procedure AG_Unset (Object : in Object_not_null_Access; Name : in System.Address) with Import, Convention => C, Link_Name => "AG_Unset"; procedure AG_GetUint8 (Object : in Object_not_null_Access; Name : in System.Address) with Import, Convention => C, Link_Name => "AG_GetUint8"; function AG_SetUint8 (Object : in System.Address; Name : in System.Address; Value : in Interfaces.Unsigned_8) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetUint8"; function AG_BindUint8 (Object : in System.Address; Name : in System.Address; Value : access Interfaces.Unsigned_8) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindUint8"; function AG_GetSint8 (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetSint8"; function AG_SetSint8 (Object : in System.Address; Name : in System.Address; Value : in Signed_8) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetSint8"; function AG_BindSint8 (Object : in System.Address; Name : in System.Address; Value : access Signed_8) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindSint8"; procedure AG_GetUint16 (Object : in System.Address; Name : in System.Address) with Import, Convention => C, Link_Name => "AG_GetUint16"; function AG_SetUint16 (Object : in System.Address; Name : in System.Address; Value : in Interfaces.Unsigned_16) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetUint16"; function AG_BindUint16 (Object : in System.Address; Name : in System.Address; Value : access Interfaces.Unsigned_16) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindUint16"; function AG_GetSint16 (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetSint16"; function AG_SetSint16 (Object : in System.Address; Name : in System.Address; Value : in Signed_16) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetSint16"; function AG_BindSint16 (Object : in System.Address; Name : in System.Address; Value : access Signed_16) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindSint16"; procedure AG_GetUint32 (Object : in System.Address; Name : in System.Address) with Import, Convention => C, Link_Name => "AG_GetUint32"; function AG_SetUint32 (Object : in System.Address; Name : in System.Address; Value : in Interfaces.Unsigned_32) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetUint32"; function AG_BindUint32 (Object : in System.Address; Name : in System.Address; Value : access Interfaces.Unsigned_32) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindUint32"; function AG_GetSint32 (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetSint32"; function AG_SetSint32 (Object : in System.Address; Name : in System.Address; Value : in Signed_32) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetSint32"; function AG_BindSint32 (Object : in System.Address; Name : in System.Address; Value : access Signed_32) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindSint32"; #if HAVE_64BIT procedure AG_GetUint64 (Object : in System.Address; Name : in System.Address) with Import, Convention => C, Link_Name => "AG_GetUint64"; function AG_SetUint64 (Object : in System.Address; Name : in System.Address; Value : in Interfaces.Unsigned_64) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetUint64"; function AG_BindUint64 (Object : in System.Address; Name : in System.Address; Value : access Interfaces.Unsigned_64) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindUint64"; function AG_GetSint64 (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetSint64"; function AG_SetSint64 (Object : in System.Address; Name : in System.Address; Value : in Signed_64) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetSint64"; function AG_BindSint64 (Object : in System.Address; Name : in System.Address; Value : access Signed_64) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindSint64"; #end if; #if HAVE_FLOAT function AG_GetFloat (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetFloat"; function AG_SetFloat (Object : in System.Address; Name : in System.Address; Value : in Float) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetFloat"; function AG_BindFloat (Object : in System.Address; Name : in System.Address; Value : access Float) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindFloat"; function AG_GetDouble (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetDouble"; function AG_SetDouble (Object : in System.Address; Name : in System.Address; Value : in Double) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetDouble"; function AG_BindDouble (Object : in System.Address; Name : in System.Address; Value : access Double) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindDouble"; # if HAVE_LONG_DOUBLE function AG_GetLongDouble (Object : in System.Address; Name : in System.Address) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_GetLongDouble"; function AG_SetLongDouble (Object : in System.Address; Name : in System.Address; Value : in Long_Double) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_SetLongDouble"; function AG_BindLongDouble (Object : in System.Address; Name : in System.Address; Value : access Long_Double) return Variable_not_null_Access with Import, Convention => C, Link_Name => "AG_BindLongDouble"; # end if; #end if; function AG_GetString (Object : in System.Address; Name : in System.Address; Buffer : in System.Address; Size : in AG_Size) return AG_Size with Import, Convention => C, Link_Name => "AG_GetString"; function AG_GetStringDup (Object : in System.Address; Name : in System.Address) return System.Address with Import, Convention => C, Link_Name => "AG_GetStringDup"; function AG_SetString (Variable : in Variable_not_null_Access; Name : in System.Address; Data : in System.Address) return Variable_Access with Import, Convention => C, Link_Name => "AG_SetString"; function AG_BindString (Variable : in Variable_not_null_Access; Name : in System.Address; Data : in System.Address; Size : in AG_Size) return Variable_Access with Import, Convention => C, Link_Name => "AG_BindString"; function AG_GetPointer (Object : in System.Address; Name : in System.Address) return System.Address with Import, Convention => C, Link_Name => "AG_GetPointer"; function AG_SetPointer (Variable : in Variable_not_null_Access; Name : in System.Address; Data : in System.Address) return Variable_Access with Import, Convention => C, Link_Name => "AG_SetPointer"; function AG_BindPointer (Variable : in Variable_not_null_Access; Name : in System.Address; Data : access System.Address) return Variable_Access with Import, Convention => C, Link_Name => "AG_BindPointer"; function AG_CompareVariables (Left, Right : in Variable_not_null_Access) return C.int with Import, Convention => C, Link_Name => "AG_CompareVariables"; end Agar.Object;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S I N F O . C N -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This child package of Sinfo contains some routines that permit in place -- alteration of existing tree nodes by changing the value in the Nkind -- field. Since Nkind functions logically in a manner similart to a variant -- record discriminant part, such alterations cannot be permitted in a -- general manner, but in some specific cases, the fields of related nodes -- have been deliberately layed out in a manner that permits such alteration. -- that determin with Atree; use Atree; package body Sinfo.CN is use Atree.Unchecked_Access; -- This package is one of the few packages which is allowed to make direct -- references to tree nodes (since it is in the business of providing a -- higher level of tree access which other clients are expected to use and -- which implements checks). ------------------------------------------------------------ -- Change_Character_Literal_To_Defining_Character_Literal -- ------------------------------------------------------------ procedure Change_Character_Literal_To_Defining_Character_Literal (N : in out Node_Id) is begin Set_Nkind (N, N_Defining_Character_Literal); N := Extend_Node (N); end Change_Character_Literal_To_Defining_Character_Literal; ------------------------------------ -- Change_Conversion_To_Unchecked -- ------------------------------------ procedure Change_Conversion_To_Unchecked (N : Node_Id) is begin Set_Do_Overflow_Check (N, False); Set_Do_Tag_Check (N, False); Set_Do_Length_Check (N, False); Set_Nkind (N, N_Unchecked_Type_Conversion); end Change_Conversion_To_Unchecked; ---------------------------------------------- -- Change_Identifier_To_Defining_Identifier -- ---------------------------------------------- procedure Change_Identifier_To_Defining_Identifier (N : in out Node_Id) is begin Set_Nkind (N, N_Defining_Identifier); N := Extend_Node (N); end Change_Identifier_To_Defining_Identifier; -------------------------------------------------------- -- Change_Operator_Symbol_To_Defining_Operator_Symbol -- -------------------------------------------------------- procedure Change_Operator_Symbol_To_Defining_Operator_Symbol (N : in out Node_Id) is begin Set_Nkind (N, N_Defining_Operator_Symbol); Set_Node2 (N, Empty); -- Clear unused Str2 field N := Extend_Node (N); end Change_Operator_Symbol_To_Defining_Operator_Symbol; ---------------------------------------------- -- Change_Operator_Symbol_To_String_Literal -- ---------------------------------------------- procedure Change_Operator_Symbol_To_String_Literal (N : Node_Id) is begin Set_Nkind (N, N_String_Literal); Set_Node1 (N, Empty); -- clear Name1 field end Change_Operator_Symbol_To_String_Literal; ------------------------------------------------ -- Change_Selected_Component_To_Expanded_Name -- ------------------------------------------------ procedure Change_Selected_Component_To_Expanded_Name (N : Node_Id) is begin Set_Nkind (N, N_Expanded_Name); Set_Chars (N, Chars (Selector_Name (N))); end Change_Selected_Component_To_Expanded_Name; end Sinfo.CN;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ T E X T _ I O . C _ S T R E A M S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces.C_Streams; use Interfaces.C_Streams; with System.File_IO; with System.File_Control_Block; with Ada.Unchecked_Conversion; package body Ada.Wide_Text_IO.C_Streams is package FIO renames System.File_IO; package FCB renames System.File_Control_Block; subtype AP is FCB.AFCB_Ptr; function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode); -------------- -- C_Stream -- -------------- function C_Stream (F : File_Type) return FILEs is begin FIO.Check_File_Open (AP (F)); return F.Stream; end C_Stream; ---------- -- Open -- ---------- procedure Open (File : in out File_Type; Mode : File_Mode; C_Stream : FILEs; Form : String := ""; Name : String := "") is Dummy_File_Control_Block : Wide_Text_AFCB; pragma Warnings (Off, Dummy_File_Control_Block); -- Yes, we know this is never assigned a value, only the tag -- is used for dispatching purposes, so that's expected. begin FIO.Open (File_Ptr => AP (File), Dummy_FCB => Dummy_File_Control_Block, Mode => To_FCB (Mode), Name => Name, Form => Form, Amethod => 'W', Creat => False, Text => True, C_Stream => C_Stream); end Open; end Ada.Wide_Text_IO.C_Streams;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . D I M . I N T E G E R _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides output routines for integer dimensioned types. All -- Put routines are modeled after those in package Ada.Text_IO.Integer_IO -- with the addition of an extra default parameter. All Put_Dim_Of routines -- output the dimension of Item in a symbolic manner. -- Parameter Symbol may be used in the following manner (all the examples are -- based on the MKS system of units as defined in package System.Dim.Mks): -- type Mks_Type is new Integer -- with -- Dimension_System => ( -- (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'), -- (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'), -- (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'), -- (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'), -- (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => "Θ"), -- (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'), -- (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J')); -- Case 1. A value is supplied for Symbol -- * Put : The string appears as a suffix of Item -- * Put_Dim_Of : The string appears alone -- Obj : Mks_Type := 2; -- Put (Obj, Symbols => "dimensionless"); -- Put_Dim_Of (Obj, Symbols => "dimensionless"); -- The corresponding outputs are: -- $2 dimensionless -- $dimensionless -- Case 2. No value is supplied for Symbol and Item is dimensionless -- * Put : Item appears without a suffix -- * Put_Dim_Of : the output is [] -- Obj : Mks_Type := 2; -- Put (Obj); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $2 -- $[] -- Case 3. No value is supplied for Symbol and Item has a dimension -- * Put : If the type of Item is a dimensioned subtype whose -- symbol is not empty, then the symbol appears as a suffix. -- Otherwise, a new string is created and appears as a -- suffix of Item. This string results in the successive -- concatenations between each unit symbol raised by its -- corresponding dimension power from the dimensions of Item. -- * Put_Dim_Of : The output is a new string resulting in the successive -- concatenations between each dimension symbol raised by its -- corresponding dimension power from the dimensions of Item. -- subtype Length is Mks_Type -- with -- Dimension => ('m', -- Meter => 1, -- others => 0); -- Obj : Length := 2; -- Put (Obj); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $2 m -- $[L] -- subtype Random is Mks_Type -- with -- Dimension => ("", -- Meter => 3, -- Candela => 2, -- others => 0); -- Obj : Random := 5; -- Put (Obj); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $5 m**3.cd**2 -- $[L**3.J**2] with Ada.Text_IO; use Ada.Text_IO; generic type Num_Dim_Integer is range <>; package System.Dim.Integer_IO is Default_Width : Field := Num_Dim_Integer'Width; Default_Base : Number_Base := 10; procedure Put (File : File_Type; Item : Num_Dim_Integer; Width : Field := Default_Width; Base : Number_Base := Default_Base; Symbol : String := ""); procedure Put (Item : Num_Dim_Integer; Width : Field := Default_Width; Base : Number_Base := Default_Base; Symbol : String := ""); procedure Put (To : out String; Item : Num_Dim_Integer; Base : Number_Base := Default_Base; Symbol : String := ""); procedure Put_Dim_Of (File : File_Type; Item : Num_Dim_Integer; Symbol : String := ""); procedure Put_Dim_Of (Item : Num_Dim_Integer; Symbol : String := ""); procedure Put_Dim_Of (To : out String; Item : Num_Dim_Integer; Symbol : String := ""); pragma Inline (Put); pragma Inline (Put_Dim_Of); end System.Dim.Integer_IO;
pragma License (Unrestricted); -- extended unit with Ada.Strings.Wide_Wide_Functions.Maps; package Ada.Strings.Bounded_Wide_Wide_Strings.Functions.Maps is new Generic_Maps (Wide_Wide_Functions.Maps); pragma Preelaborate (Ada.Strings.Bounded_Wide_Wide_Strings.Functions.Maps);
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Parameter_Specifications; with Program.Elements.Formal_Procedure_Access_Types; with Program.Element_Visitors; package Program.Nodes.Formal_Procedure_Access_Types is pragma Preelaborate; type Formal_Procedure_Access_Type is new Program.Nodes.Node and Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type and Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text with private; function Create (Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return Formal_Procedure_Access_Type; type Implicit_Formal_Procedure_Access_Type is new Program.Nodes.Node and Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type with private; function Create (Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not_Null : Boolean := False; Has_Protected : Boolean := False) return Implicit_Formal_Procedure_Access_Type with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Formal_Procedure_Access_Type is abstract new Program.Nodes.Node and Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type with record Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; end record; procedure Initialize (Self : in out Base_Formal_Procedure_Access_Type'Class); overriding procedure Visit (Self : not null access Base_Formal_Procedure_Access_Type; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Parameters (Self : Base_Formal_Procedure_Access_Type) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; overriding function Is_Formal_Procedure_Access_Type (Self : Base_Formal_Procedure_Access_Type) return Boolean; overriding function Is_Formal_Access_Type (Self : Base_Formal_Procedure_Access_Type) return Boolean; overriding function Is_Formal_Type_Definition (Self : Base_Formal_Procedure_Access_Type) return Boolean; overriding function Is_Definition (Self : Base_Formal_Procedure_Access_Type) return Boolean; type Formal_Procedure_Access_Type is new Base_Formal_Procedure_Access_Type and Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text with record Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Formal_Procedure_Access_Type_Text (Self : in out Formal_Procedure_Access_Type) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text_Access; overriding function Not_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Null_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Access_Token (Self : Formal_Procedure_Access_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Protected_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Procedure_Token (Self : Formal_Procedure_Access_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Left_Bracket_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Has_Not_Null (Self : Formal_Procedure_Access_Type) return Boolean; overriding function Has_Protected (Self : Formal_Procedure_Access_Type) return Boolean; type Implicit_Formal_Procedure_Access_Type is new Base_Formal_Procedure_Access_Type with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; Has_Not_Null : Boolean; Has_Protected : Boolean; end record; overriding function To_Formal_Procedure_Access_Type_Text (Self : in out Implicit_Formal_Procedure_Access_Type) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Formal_Procedure_Access_Type) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Formal_Procedure_Access_Type) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Formal_Procedure_Access_Type) return Boolean; overriding function Has_Not_Null (Self : Implicit_Formal_Procedure_Access_Type) return Boolean; overriding function Has_Protected (Self : Implicit_Formal_Procedure_Access_Type) return Boolean; end Program.Nodes.Formal_Procedure_Access_Types;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ C H A R A C T E R T S . U N I C O D E -- -- -- -- S p e c -- -- -- -- Copyright (C) 2005, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Unicode categorization routines for Wide_Wide_Character with GNAT.UTF_32; package Ada.Wide_Wide_Characters.Unicode is -- The following type defines the categories from the unicode definitions. -- The one addition we make is Fe, which represents the characters FFFE -- and FFFF in any of the planes. type Category is new GNAT.UTF_32.Category; -- Cc Other, Control -- Cf Other, Format -- Cn Other, Not Assigned -- Co Other, Private Use -- Cs Other, Surrogate -- Ll Letter, Lowercase -- Lm Letter, Modifier -- Lo Letter, Other -- Lt Letter, Titlecase -- Lu Letter, Uppercase -- Mc Mark, Spacing Combining -- Me Mark, Enclosing -- Mn Mark, Nonspacing -- Nd Number, Decimal Digit -- Nl Number, Letter -- No Number, Other -- Pc Punctuation, Connector -- Pd Punctuation, Dash -- Pe Punctuation, Close -- Pf Punctuation, Final quote -- Pi Punctuation, Initial quote -- Po Punctuation, Other -- Ps Punctuation, Open -- Sc Symbol, Currency -- Sk Symbol, Modifier -- Sm Symbol, Math -- So Symbol, Other -- Zl Separator, Line -- Zp Separator, Paragraph -- Zs Separator, Space -- Fe relative position FFFE/FFFF in plane function Get_Category (U : Wide_Wide_Character) return Category; pragma Inline (Get_Category); -- Given a Wide_Wide_Character, returns corresponding Category, or Cn if -- the code does not have an assigned unicode category. -- The following functions perform category tests corresponding to lexical -- classes defined in the Ada standard. There are two interfaces for each -- function. The second takes a Category (e.g. returned by Get_Category). -- The first takes a Wide_Wide_Character. The form taking the -- Wide_Wide_Character is typically more efficient than calling -- Get_Category, but if several different tests are to be performed on the -- same code, it is more efficient to use Get_Category to get the category, -- then test the resulting category. function Is_Letter (U : Wide_Wide_Character) return Boolean; function Is_Letter (C : Category) return Boolean; pragma Inline (Is_Letter); -- Returns true iff U is a letter that can be used to start an identifier, -- or if C is one of the corresponding categories, which are the following: -- Letter, Uppercase (Lu) -- Letter, Lowercase (Ll) -- Letter, Titlecase (Lt) -- Letter, Modifier (Lm) -- Letter, Other (Lo) -- Number, Letter (Nl) function Is_Digit (U : Wide_Wide_Character) return Boolean; function Is_Digit (C : Category) return Boolean; pragma Inline (Is_Digit); -- Returns true iff U is a digit that can be used to extend an identifer, -- or if C is one of the corresponding categories, which are the following: -- Number, Decimal_Digit (Nd) function Is_Line_Terminator (U : Wide_Wide_Character) return Boolean; pragma Inline (Is_Line_Terminator); -- Returns true iff U is an allowed line terminator for source programs, -- if U is in the category Zp (Separator, Paragaph), or Zs (Separator, -- Line), or if U is a conventional line terminator (CR, LF, VT, FF). -- There is no category version for this function, since the set of -- characters does not correspond to a set of Unicode categories. function Is_Mark (U : Wide_Wide_Character) return Boolean; function Is_Mark (C : Category) return Boolean; pragma Inline (Is_Mark); -- Returns true iff U is a mark character which can be used to extend an -- identifier, or if C is one of the corresponding categories, which are -- the following: -- Mark, Non-Spacing (Mn) -- Mark, Spacing Combining (Mc) function Is_Other (U : Wide_Wide_Character) return Boolean; function Is_Other (C : Category) return Boolean; pragma Inline (Is_Other); -- Returns true iff U is an other format character, which means that it -- can be used to extend an identifier, but is ignored for the purposes of -- matching of identiers, or if C is one of the corresponding categories, -- which are the following: -- Other, Format (Cf) function Is_Punctuation (U : Wide_Wide_Character) return Boolean; function Is_Punctuation (C : Category) return Boolean; pragma Inline (Is_Punctuation); -- Returns true iff U is a punctuation character that can be used to -- separate pices of an identifier, or if C is one of the corresponding -- categories, which are the following: -- Punctuation, Connector (Pc) function Is_Space (U : Wide_Wide_Character) return Boolean; function Is_Space (C : Category) return Boolean; pragma Inline (Is_Space); -- Returns true iff U is considered a space to be ignored, or if C is one -- of the corresponding categories, which are the following: -- Separator, Space (Zs) function Is_Non_Graphic (U : Wide_Wide_Character) return Boolean; function Is_Non_Graphic (C : Category) return Boolean; pragma Inline (Is_Non_Graphic); -- Returns true iff U is considered to be a non-graphic character, or if C -- is one of the corresponding categories, which are the following: -- Other, Control (Cc) -- Other, Private Use (Co) -- Other, Surrogate (Cs) -- Separator, Line (Zl) -- Separator, Paragraph (Zp) -- FFFE or FFFF positions in any plane (Fe) -- -- Note that the Ada category format effector is subsumed by the above -- list of Unicode categories. -- -- Note that Other, Unassiged (Cn) is quite deliberately not included -- in the list of categories above. This means that should any of these -- code positions be defined in future with graphic characters they will -- be allowed without a need to change implementations or the standard. -- -- Note that Other, Format (Cf) is also quite deliberately not included -- in the list of categories above. This means that these characters can -- be included in character and string literals. -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all -- letters to upper case using this routine. function To_Upper_Case (U : Wide_Wide_Character) return Wide_Wide_Character; pragma Inline (To_Upper_Case); -- If U represents a lower case letter, returns the corresponding upper -- case letter, otherwise U is returned unchanged. The folding is locale -- independent as defined by documents referenced in the note in section -- 1 of ISO/IEC 10646:2003 end Ada.Wide_Wide_Characters.Unicode;
-- -- Convert any image or animation file to BMP file(s). -- -- Middle-size test/demo for the GID (Generic Image Decoder) package. -- -- Supports: -- - Transparency (blends transparent or partially opaque areas with a -- background image, gid.gif, or a fixed, predefined colour) -- - Display orientation (JPEG EXIF informations from digital cameras) -- -- For a smaller and simpler example, look for mini.adb . -- with GID; with Ada.Calendar; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces; procedure To_BMP is default_bkg_name: constant String:= "gid.gif"; procedure Blurb is begin Put_Line(Standard_Error, "To_BMP * Converts any image file to a BMP file"); Put_Line(Standard_Error, "Simple test for the GID (Generic Image Decoder) package"); Put_Line(Standard_Error, "Package version " & GID.version & " dated " & GID.reference); Put_Line(Standard_Error, "URL: " & GID.web); New_Line(Standard_Error); Put_Line(Standard_Error, "Syntax:"); Put_Line(Standard_Error, "to_bmp [-] [-<background_image_name>] <image_1> [<image_2>...]"); New_Line(Standard_Error); Put_Line(Standard_Error, "Options:"); Put_Line(Standard_Error, " '-': don't output image (testing only)"); Put_Line(Standard_Error, " '-<background_image_name>':"); Put_Line(Standard_Error, " use specifed background to mix with transparent images"); Put_Line(Standard_Error, " (otherwise, trying with '"& default_bkg_name &"' or single color)"); New_Line(Standard_Error); Put_Line(Standard_Error, "Output: "".dib"" is added the full input name(s)"); Put_Line(Standard_Error, " Reason of "".dib"": unknown synonym of "".bmp"";"); Put_Line(Standard_Error, " just do ""del *.dib"" for cleanup"); New_Line(Standard_Error); end Blurb; -- Image used as background for displaying images having transparency background_image_name: Unbounded_String:= Null_Unbounded_String; use Interfaces; type Byte_Array is array(Integer range <>) of Unsigned_8; type p_Byte_Array is access Byte_Array; procedure Dispose is new Ada.Unchecked_Deallocation(Byte_Array, p_Byte_Array); forgive_errors: constant Boolean:= False; error: Boolean; img_buf, bkg_buf: p_Byte_Array:= null; bkg: GID.Image_descriptor; generic correct_orientation: GID.Orientation; -- Load image into a 24-bit truecolor BGR raw bitmap (for a BMP output) procedure Load_raw_image( image : in out GID.Image_descriptor; buffer: in out p_Byte_Array; next_frame: out Ada.Calendar.Day_Duration ); -- procedure Load_raw_image( image : in out GID.Image_descriptor; buffer: in out p_Byte_Array; next_frame: out Ada.Calendar.Day_Duration ) is subtype Primary_color_range is Unsigned_8; subtype U16 is Unsigned_16; image_width: constant Positive:= GID.Pixel_width(image); image_height: constant Positive:= GID.Pixel_height(image); padded_line_size_x: constant Positive:= 4 * Integer(Float'Ceiling(Float(image_width) * 3.0 / 4.0)); padded_line_size_y: constant Positive:= 4 * Integer(Float'Ceiling(Float(image_height) * 3.0 / 4.0)); -- (in bytes) idx: Integer; mem_x, mem_y: Natural; bkg_padded_line_size: Positive; bkg_width, bkg_height: Natural; -- procedure Set_X_Y (x, y: Natural) is pragma Inline(Set_X_Y); use GID; rev_x: constant Natural:= image_width - (x+1); rev_y: constant Natural:= image_height - (y+1); begin case correct_orientation is when Unchanged => idx:= 3 * x + padded_line_size_x * y; when Rotation_90 => idx:= 3 * rev_y + padded_line_size_y * x; when Rotation_180 => idx:= 3 * rev_x + padded_line_size_x * rev_y; when Rotation_270 => idx:= 3 * y + padded_line_size_y * rev_x; end case; mem_x:= x; mem_y:= y; end Set_X_Y; -- -- No background version of Put_Pixel -- procedure Put_Pixel_without_bkg ( red, green, blue : Primary_color_range; alpha : Primary_color_range ) is pragma Inline(Put_Pixel_without_bkg); pragma Warnings(off, alpha); -- alpha is just ignored use GID; begin buffer(idx..idx+2):= (blue, green, red); -- GID requires us to look to next pixel for next time: case correct_orientation is when Unchanged => idx:= idx + 3; when Rotation_90 => idx:= idx + padded_line_size_y; when Rotation_180 => idx:= idx - 3; when Rotation_270 => idx:= idx - padded_line_size_y; end case; end Put_Pixel_without_bkg; -- -- Unicolor background version of Put_Pixel -- procedure Put_Pixel_with_unicolor_bkg ( red, green, blue : Primary_color_range; alpha : Primary_color_range ) is pragma Inline(Put_Pixel_with_unicolor_bkg); u_red : constant:= 200; u_green: constant:= 133; u_blue : constant:= 32; begin if alpha = 255 then buffer(idx..idx+2):= (blue, green, red); else -- blend with bckground color buffer(idx) := Primary_color_range((U16(alpha) * U16(blue) + U16(255-alpha) * u_blue )/255); buffer(idx+1):= Primary_color_range((U16(alpha) * U16(green) + U16(255-alpha) * u_green)/255); buffer(idx+2):= Primary_color_range((U16(alpha) * U16(red) + U16(255-alpha) * u_red )/255); end if; idx:= idx + 3; -- ^ GID requires us to look to next pixel on the right for next time. end Put_Pixel_with_unicolor_bkg; -- -- Background image version of Put_Pixel -- procedure Put_Pixel_with_image_bkg ( red, green, blue : Primary_color_range; alpha : Primary_color_range ) is pragma Inline(Put_Pixel_with_image_bkg); b_red, b_green, b_blue : Primary_color_range; bkg_idx: Natural; begin if alpha = 255 then buffer(idx..idx+2):= (blue, green, red); else -- blend with background image bkg_idx:= 3 * (mem_x mod bkg_width) + bkg_padded_line_size * (mem_y mod bkg_height); b_blue := bkg_buf(bkg_idx); b_green:= bkg_buf(bkg_idx+1); b_red := bkg_buf(bkg_idx+2); buffer(idx) := Primary_color_range((U16(alpha) * U16(blue) + U16(255-alpha) * U16(b_blue) )/255); buffer(idx+1):= Primary_color_range((U16(alpha) * U16(green) + U16(255-alpha) * U16(b_green))/255); buffer(idx+2):= Primary_color_range((U16(alpha) * U16(red) + U16(255-alpha) * U16(b_red) )/255); end if; idx:= idx + 3; -- ^ GID requires us to look to next pixel on the right for next time. mem_x:= mem_x + 1; end Put_Pixel_with_image_bkg; stars: Natural:= 0; procedure Feedback(percents: Natural) is so_far: constant Natural:= percents / 5; begin for i in stars+1..so_far loop Put( Standard_Error, '*'); end loop; stars:= so_far; end Feedback; -- Here, the exciting thing: the instanciation of -- GID.Load_image_contents. In our case, we load the image -- into a 24-bit bitmap (because we provide a Put_Pixel -- that does that with the pixels), but we could do plenty -- of other things instead, like display the image live on a GUI. -- More exciting: for tuning performance, we have 3 different -- instances of GID.Load_image_contents (each of them with the full -- decoders for all formats, own specialized generic instances, inlines, -- etc.) depending on the transparency features. procedure BMP24_Load_without_bkg is new GID.Load_image_contents( Primary_color_range, Set_X_Y, Put_Pixel_without_bkg, Feedback, GID.fast ); procedure BMP24_Load_with_unicolor_bkg is new GID.Load_image_contents( Primary_color_range, Set_X_Y, Put_Pixel_with_unicolor_bkg, Feedback, GID.fast ); procedure BMP24_Load_with_image_bkg is new GID.Load_image_contents( Primary_color_range, Set_X_Y, Put_Pixel_with_image_bkg, Feedback, GID.fast ); begin error:= False; Dispose(buffer); case correct_orientation is when GID.Unchanged | GID.Rotation_180 => buffer:= new Byte_Array(0..padded_line_size_x * GID.Pixel_height(image) - 1); when GID.Rotation_90 | GID.Rotation_270 => buffer:= new Byte_Array(0..padded_line_size_y * GID.Pixel_width(image) - 1); end case; if GID.Expect_transparency(image) then if background_image_name = Null_Unbounded_String then BMP24_Load_with_unicolor_bkg(image, next_frame); else bkg_width:= GID.Pixel_width(bkg); bkg_height:= GID.Pixel_height(bkg); bkg_padded_line_size:= 4 * Integer(Float'Ceiling(Float(bkg_width) * 3.0 / 4.0)); BMP24_Load_with_image_bkg(image, next_frame); end if; else BMP24_Load_without_bkg(image, next_frame); end if; -- -- For testing: white rectangle with a red half-frame. -- buffer.all:= (others => 255); -- for x in 0..GID.Pixel_width(image)-1 loop -- Put_Pixel_with_unicolor_bkg(x,0,255,0,0,255); -- end loop; -- for y in 0..GID.Pixel_height(image)-1 loop -- Put_Pixel_with_unicolor_bkg(0,y,255,0,0,255); -- end loop; exception when others => if forgive_errors then error:= True; next_frame:= 0.0; else raise; end if; end Load_raw_image; procedure Load_raw_image_0 is new Load_raw_image(GID.Unchanged); procedure Load_raw_image_90 is new Load_raw_image(GID.Rotation_90); procedure Load_raw_image_180 is new Load_raw_image(GID.Rotation_180); procedure Load_raw_image_270 is new Load_raw_image(GID.Rotation_270); procedure Dump_BMP_24(name: String; i: GID.Image_descriptor) is f: Ada.Streams.Stream_IO.File_Type; type BITMAPFILEHEADER is record bfType : Unsigned_16; bfSize : Unsigned_32; bfReserved1: Unsigned_16:= 0; bfReserved2: Unsigned_16:= 0; bfOffBits : Unsigned_32; end record; -- ^ No packing needed BITMAPFILEHEADER_Bytes: constant:= 14; type BITMAPINFOHEADER is record biSize : Unsigned_32; biWidth : Unsigned_32; biHeight : Unsigned_32; biPlanes : Unsigned_16:= 1; biBitCount : Unsigned_16; biCompression : Unsigned_32:= 0; biSizeImage : Unsigned_32; biXPelsPerMeter: Unsigned_32:= 0; biYPelsPerMeter: Unsigned_32:= 0; biClrUsed : Unsigned_32:= 0; biClrImportant : Unsigned_32:= 0; end record; -- ^ No packing needed BITMAPINFOHEADER_Bytes: constant:= 40; FileInfo : BITMAPINFOHEADER; FileHeader: BITMAPFILEHEADER; -- generic type Number is mod <>; procedure Write_Intel_x86_number(n: in Number); procedure Write_Intel_x86_number(n: in Number) is m: Number:= n; bytes: constant Integer:= Number'Size/8; begin for i in 1..bytes loop Unsigned_8'Write(Stream(f), Unsigned_8(m and 255)); m:= m / 256; end loop; end Write_Intel_x86_number; procedure Write_Intel is new Write_Intel_x86_number( Unsigned_16 ); procedure Write_Intel is new Write_Intel_x86_number( Unsigned_32 ); begin FileHeader.bfType := 16#4D42#; -- 'BM' FileHeader.bfOffBits := BITMAPINFOHEADER_Bytes + BITMAPFILEHEADER_Bytes; FileInfo.biSize := BITMAPINFOHEADER_Bytes; case GID.Display_orientation(i) is when GID.Unchanged | GID.Rotation_180 => FileInfo.biWidth := Unsigned_32(GID.Pixel_width(i)); FileInfo.biHeight := Unsigned_32(GID.Pixel_height(i)); when GID.Rotation_90 | GID.Rotation_270 => FileInfo.biWidth := Unsigned_32(GID.Pixel_height(i)); FileInfo.biHeight := Unsigned_32(GID.Pixel_width(i)); end case; FileInfo.biBitCount := 24; FileInfo.biSizeImage := Unsigned_32(img_buf.all'Length); FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.biSizeImage; Create(f, Out_File, name & ".dib"); -- BMP Header, endian-safe: Write_Intel(FileHeader.bfType); Write_Intel(FileHeader.bfSize); Write_Intel(FileHeader.bfReserved1); Write_Intel(FileHeader.bfReserved2); Write_Intel(FileHeader.bfOffBits); -- Write_Intel(FileInfo.biSize); Write_Intel(FileInfo.biWidth); Write_Intel(FileInfo.biHeight); Write_Intel(FileInfo.biPlanes); Write_Intel(FileInfo.biBitCount); Write_Intel(FileInfo.biCompression); Write_Intel(FileInfo.biSizeImage); Write_Intel(FileInfo.biXPelsPerMeter); Write_Intel(FileInfo.biYPelsPerMeter); Write_Intel(FileInfo.biClrUsed); Write_Intel(FileInfo.biClrImportant); -- BMP raw BGR image: declare -- Workaround for the severe xxx'Read xxx'Write performance -- problems in the GNAT and ObjectAda compilers (as in 2009) -- This is possible if and only if Byte = Stream_Element and -- arrays types are both packed the same way. -- subtype Size_test_a is Byte_Array(1..19); subtype Size_test_b is Ada.Streams.Stream_Element_Array(1..19); workaround_possible: constant Boolean:= Size_test_a'Size = Size_test_b'Size and then Size_test_a'Alignment = Size_test_b'Alignment; -- begin if workaround_possible then declare use Ada.Streams; SE_Buffer : Stream_Element_Array (0..Stream_Element_Offset(img_buf'Length-1)); for SE_Buffer'Address use img_buf.all'Address; pragma Import (Ada, SE_Buffer); begin Ada.Streams.Write(Stream(f).all, SE_Buffer(0..Stream_Element_Offset(img_buf'Length-1))); end; else Byte_Array'Write(Stream(f), img_buf.all); -- the workaround is about this line... end if; end; Close(f); end Dump_BMP_24; procedure Process(name: String; as_background, test_only: Boolean) is f: Ada.Streams.Stream_IO.File_Type; i: GID.Image_descriptor; up_name: constant String:= To_Upper(name); -- next_frame, current_frame: Ada.Calendar.Day_Duration:= 0.0; begin -- -- Load the image in its original format -- Open(f, In_File, name); Put_Line(Standard_Error, "Processing " & name & "..."); -- GID.Load_image_header( i, Stream(f).all, try_tga => name'Length >= 4 and then up_name(up_name'Last-3..up_name'Last) = ".TGA" ); Put_Line(Standard_Error, " Image format: " & GID.Image_format_type'Image(GID.Format(i)) ); Put_Line(Standard_Error, " Image detailed format: " & GID.Detailed_format(i) ); Put_Line(Standard_Error, " Image sub-format ID (if any): " & Integer'Image(GID.Subformat(i)) ); Put_Line(Standard_Error, " Dimensions in pixels: " & Integer'Image(GID.Pixel_width(i)) & " x" & Integer'Image(GID.Pixel_height(i)) ); Put_Line(Standard_Error, " Display orientation: " & GID.Orientation'Image(GID.Display_orientation(i)) ); Put(Standard_Error, " Color depth: " & Integer'Image(GID.Bits_per_pixel(i)) & " bits" ); if GID.Bits_per_pixel(i) <= 24 then Put_Line(Standard_Error, ',' & Integer'Image(2**GID.Bits_per_pixel(i)) & " colors" ); else New_Line(Standard_Error); end if; Put_Line(Standard_Error, " Palette: " & Boolean'Image(GID.Has_palette(i)) ); Put_Line(Standard_Error, " Greyscale: " & Boolean'Image(GID.Greyscale(i)) ); Put_Line(Standard_Error, " RLE encoding (if any): " & Boolean'Image(GID.RLE_encoded(i)) ); Put_Line(Standard_Error, " Interlaced (GIF: each frame's choice): " & Boolean'Image(GID.Interlaced(i)) ); Put_Line(Standard_Error, " Expect transparency: " & Boolean'Image(GID.Expect_transparency(i)) ); Put_Line(Standard_Error, "1........10........20"); Put_Line(Standard_Error, " | | "); -- if as_background then case GID.Display_orientation(i) is when GID.Unchanged => Load_raw_image_0(i, bkg_buf, next_frame); when GID.Rotation_90 => Load_raw_image_90(i, bkg_buf, next_frame); when GID.Rotation_180 => Load_raw_image_180(i, bkg_buf, next_frame); when GID.Rotation_270 => Load_raw_image_270(i, bkg_buf, next_frame); end case; bkg:= i; New_Line(Standard_Error); Close(f); return; end if; loop case GID.Display_orientation(i) is when GID.Unchanged => Load_raw_image_0(i, img_buf, next_frame); when GID.Rotation_90 => Load_raw_image_90(i, img_buf, next_frame); when GID.Rotation_180 => Load_raw_image_180(i, img_buf, next_frame); when GID.Rotation_270 => Load_raw_image_270(i, img_buf, next_frame); end case; if not test_only then Dump_BMP_24(name & Duration'Image(current_frame), i); end if; New_Line(Standard_Error); if error then Put_Line(Standard_Error, "Error!"); end if; exit when next_frame = 0.0; current_frame:= next_frame; end loop; Close(f); exception when GID.unknown_image_format => Put_Line(Standard_Error, " Image format is unknown!"); if Is_Open(f) then Close(f); end if; end Process; test_only: Boolean:= False; begin if Argument_Count=0 then Blurb; return; end if; Put_Line(Standard_Error, "To_BMP, using GID version " & GID.version & " dated " & GID.reference); begin Process(default_bkg_name, True, False); -- if success: background_image_name:= To_Unbounded_String(default_bkg_name); exception when Ada.Text_IO.Name_Error => null; -- nothing bad, just couldn't find default background end; for i in 1..Argument_Count loop declare arg: constant String:= Argument(i); begin if arg /= "" and then arg(arg'First)='-' then declare opt: constant String:= arg(arg'First+1..arg'Last); begin if opt = "" then test_only:= True; else Put_Line(Standard_Error, "Background image is " & opt); Process(opt, True, False); -- define this only after processing, otherwise -- a transparent background will try to use -- an undefined background background_image_name:= To_Unbounded_String(opt); end if; end; else Process(arg, False, test_only); end if; end; end loop; end To_BMP;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- The most general class for UMLDiagrams depicting behavioral elements. ------------------------------------------------------------------------------ limited with AMF.UML.Behaviors; with AMF.UMLDI.UML_Diagrams; package AMF.UMLDI.UML_Behavior_Diagrams is pragma Preelaborate; type UMLDI_UML_Behavior_Diagram is limited interface and AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram; type UMLDI_UML_Behavior_Diagram_Access is access all UMLDI_UML_Behavior_Diagram'Class; for UMLDI_UML_Behavior_Diagram_Access'Storage_Size use 0; not overriding function Get_Model_Element (Self : not null access constant UMLDI_UML_Behavior_Diagram) return AMF.UML.Behaviors.UML_Behavior_Access is abstract; -- Getter of UMLBehaviorDiagram::modelElement. -- -- Restricts UMLBehaviorDiagrams to showing Behaviors. not overriding procedure Set_Model_Element (Self : not null access UMLDI_UML_Behavior_Diagram; To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract; -- Setter of UMLBehaviorDiagram::modelElement. -- -- Restricts UMLBehaviorDiagrams to showing Behaviors. end AMF.UMLDI.UML_Behavior_Diagrams;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of 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 lis3dsh.c -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief This file provides a set of functions needed to manage the -- -- LIS3DSH MEMS Accelerometer. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with System; with Interfaces; use Interfaces; package body LIS3DSH is Full_Scale_Selection_Mask : constant UInt8 := 2#0011_1000#; -- bits 3..5 of CTRL5 Data_Rate_Selection_Mask : constant UInt8 := 2#0111_0000#; -- bits 4..6 of CTRL4 procedure Loc_IO_Write (This : in out Three_Axis_Accelerometer; Value : UInt8; WriteAddr : Register_Address) with Inline_Always; procedure Loc_IO_Read (This : Three_Axis_Accelerometer; Value : out UInt8; ReadAddr : Register_Address) with Inline_Always; ------------------ -- Loc_IO_Write -- ------------------ procedure Loc_IO_Write (This : in out Three_Axis_Accelerometer; Value : UInt8; WriteAddr : Register_Address) is begin IO_Write (Three_Axis_Accelerometer'Class (This), Value, WriteAddr); end Loc_IO_Write; ----------------- -- Loc_IO_Read -- ----------------- procedure Loc_IO_Read (This : Three_Axis_Accelerometer; Value : out UInt8; ReadAddr : Register_Address) is begin IO_Read (Three_Axis_Accelerometer'Class (This), Value, ReadAddr); end Loc_IO_Read; ---------------- -- Configured -- ---------------- function Configured (This : Three_Axis_Accelerometer) return Boolean is (This.Device_Configured); ----------------------- -- Get_Accelerations -- ----------------------- procedure Get_Accelerations (This : Three_Axis_Accelerometer; Axes : out Axes_Accelerations) is Buffer : array (0 .. 5) of UInt8 with Alignment => 2, Size => 48; Scaled : Float; type Integer16_Pointer is access all Integer_16 with Storage_Size => 0; function As_Pointer is new Ada.Unchecked_Conversion (Source => System.Address, Target => Integer16_Pointer); -- So that we can treat the address of a UInt8 as a pointer to a two-UInt8 -- sequence representing a signed Integer_16 quantity begin This.Loc_IO_Read (Buffer (0), OUT_X_L); This.Loc_IO_Read (Buffer (1), OUT_X_H); This.Loc_IO_Read (Buffer (2), OUT_Y_L); This.Loc_IO_Read (Buffer (3), OUT_Y_H); This.Loc_IO_Read (Buffer (4), OUT_Z_L); This.Loc_IO_Read (Buffer (5), OUT_Z_H); Get_X : declare Raw : Integer_16 renames As_Pointer (Buffer (0)'Address).all; begin Scaled := Float (Raw) * This.Sensitivity; Axes.X := Axis_Acceleration (Scaled); end Get_X; Get_Y : declare Raw : Integer_16 renames As_Pointer (Buffer (2)'Address).all; begin Scaled := Float (Raw) * This.Sensitivity; Axes.Y := Axis_Acceleration (Scaled); end Get_Y; Get_Z : declare Raw : Integer_16 renames As_Pointer (Buffer (4)'Address).all; begin Scaled := Float (Raw) * This.Sensitivity; Axes.Z := Axis_Acceleration (Scaled); end Get_Z; end Get_Accelerations; --------------- -- Configure -- --------------- procedure Configure (This : in out Three_Axis_Accelerometer; Output_DataRate : Data_Rate_Power_Mode_Selection; Axes_Enable : Direction_XYZ_Selection; SPI_Wire : SPI_Serial_Interface_Mode_Selection; Self_Test : Self_Test_Selection; Full_Scale : Full_Scale_Selection; Filter_BW : Anti_Aliasing_Filter_Bandwidth) is Temp : UInt16; Value : UInt8; begin Temp := Output_DataRate'Enum_Rep or Axes_Enable'Enum_Rep or SPI_Wire'Enum_Rep or Self_Test'Enum_Rep or Full_Scale'Enum_Rep or Filter_BW'Enum_Rep; Value := UInt8 (Temp); -- the low UInt8 of the half-word This.Loc_IO_Write (Value, CTRL_REG4); Value := UInt8 (Shift_Right (Temp, 8)); -- the high UInt8 This.Loc_IO_Write (Value, CTRL_REG5); case Full_Scale is when Fullscale_2g => This.Sensitivity := Sensitivity_0_06mg; when Fullscale_4g => This.Sensitivity := Sensitivity_0_12mg; when Fullscale_6g => This.Sensitivity := Sensitivity_0_18mg; when Fullscale_8g => This.Sensitivity := Sensitivity_0_24mg; when Fullscale_16g => This.Sensitivity := Sensitivity_0_73mg; end case; This.Device_Configured := True; end Configure; --------------- -- Device_Id -- --------------- function Device_Id (This : Three_Axis_Accelerometer) return UInt8 is Response : UInt8; begin This.Loc_IO_Read (Response, WHO_AM_I); return Response; end Device_Id; ------------ -- Reboot -- ------------ procedure Reboot (This : in out Three_Axis_Accelerometer) is Value : UInt8; Force_Reboot : constant UInt8 := 2#1000_0000#; begin This.Loc_IO_Read (Value, CTRL_REG6); Value := Value or Force_Reboot; This.Loc_IO_Write (Value, CTRL_REG6); end Reboot; -------------------------- -- Configure_Interrupts -- -------------------------- procedure Configure_Interrupts (This : in out Three_Axis_Accelerometer; Interrupt_Request : Interrupt_Request_Selection; Interrupt_Selection_Enable : Interrupt_Selection_Enablers; Interrupt_Signal : Interrupt_Signal_Active_Selection; State_Machine1_Enable : Boolean; State_Machine1_Interrupt : State_Machine_Routed_Interrupt; State_Machine2_Enable : Boolean; State_Machine2_Interrupt : State_Machine_Routed_Interrupt) is CTRL : UInt8; begin CTRL := Interrupt_Selection_Enable'Enum_Rep or Interrupt_Request'Enum_Rep or Interrupt_Signal'Enum_Rep; This.Loc_IO_Write (CTRL, CTRL_REG3); -- configure State Machine 1 CTRL := State_Machine1_Enable'Enum_Rep or State_Machine1_Interrupt'Enum_Rep; This.Loc_IO_Write (CTRL, CTRL_REG1); -- configure State Machine 2 CTRL := State_Machine2_Enable'Enum_Rep or State_Machine2_Interrupt'Enum_Rep; This.Loc_IO_Write (CTRL, CTRL_REG2); end Configure_Interrupts; ------------------------------- -- Configure_Click_Interrupt -- ------------------------------- procedure Configure_Click_Interrupt (This : in out Three_Axis_Accelerometer) is begin Configure_Interrupts (This, Interrupt_Request => Interrupt_Request_Latched, Interrupt_Selection_Enable => Interrupt_2_Enable, Interrupt_Signal => Interrupt_Signal_High, State_Machine1_Enable => False, State_Machine1_Interrupt => SM_INT1, -- Ignored State_Machine2_Enable => True, State_Machine2_Interrupt => SM_INT1); -- configure state machines This.Loc_IO_Write (3, TIM2_1_L); This.Loc_IO_Write (16#C8#, TIM1_1_L); This.Loc_IO_Write (16#45#, THRS2_1); This.Loc_IO_Write (16#FC#, MASK1_A); This.Loc_IO_Write (16#A1#, SETT1); This.Loc_IO_Write (16#1#, PR1); This.Loc_IO_Write (16#1#, SETT2); -- configure State Machine 2 to detect single click This.Loc_IO_Write (16#1#, ST2_1); This.Loc_IO_Write (16#6#, ST2_2); This.Loc_IO_Write (16#28#, ST2_3); This.Loc_IO_Write (16#11#, ST2_4); end Configure_Click_Interrupt; ------------------- -- Set_Low_Power -- ------------------- procedure Set_Low_Power (This : in out Three_Axis_Accelerometer; Mode : Data_Rate_Power_Mode_Selection) is Value : UInt8; begin This.Loc_IO_Read (Value, CTRL_REG4); Value := Value and (not Data_Rate_Selection_Mask); -- clear bits Value := Value or Mode'Enum_Rep; This.Loc_IO_Write (Value, CTRL_REG4); end Set_Low_Power; ------------------- -- Set_Data_Rate -- ------------------- procedure Set_Data_Rate (This : in out Three_Axis_Accelerometer; DataRate : Data_Rate_Power_Mode_Selection) is Value : UInt8; begin This.Loc_IO_Read (Value, CTRL_REG4); Value := Value and (not Data_Rate_Selection_Mask); -- clear bits Value := Value or DataRate'Enum_Rep; This.Loc_IO_Write (Value, CTRL_REG4); end Set_Data_Rate; -------------------- -- Set_Full_Scale -- -------------------- procedure Set_Full_Scale (This : in out Three_Axis_Accelerometer; Scale : Full_Scale_Selection) is Value : UInt8; begin This.Loc_IO_Read (Value, CTRL_REG5); Value := Value and (not Full_Scale_Selection_Mask); -- clear bits Value := Value or Scale'Enum_Rep; This.Loc_IO_Write (Value, CTRL_REG5); end Set_Full_Scale; ------------------- -- As_Full_Scale -- ------------------- function As_Full_Scale is new Ada.Unchecked_Conversion (Source => UInt8, Target => Full_Scale_Selection); -------------------------- -- Selected_Sensitivity -- -------------------------- function Selected_Sensitivity (This : Three_Axis_Accelerometer) return Float is CTRL5 : UInt8; begin This.Loc_IO_Read (CTRL5, CTRL_REG5); case As_Full_Scale (CTRL5 and Full_Scale_Selection_Mask) is when Fullscale_2g => return Sensitivity_0_06mg; when Fullscale_4g => return Sensitivity_0_12mg; when Fullscale_6g => return Sensitivity_0_18mg; when Fullscale_8g => return Sensitivity_0_24mg; when Fullscale_16g => return Sensitivity_0_73mg; end case; end Selected_Sensitivity; ----------------- -- Temperature -- ----------------- function Temperature (This : Three_Axis_Accelerometer) return UInt8 is Result : UInt8; begin This.Loc_IO_Read (Result, Out_T); return Result; end Temperature; end LIS3DSH;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2020 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Numerics.Generic_Elementary_Functions; with GL.Types; with Orka.Transforms.Singles.Matrices; package body Orka.Features.Terrain.Spheres is function Plane_To_Sphere (Vertex : Orka.Transforms.Singles.Vectors.Vector4; Parameters : Orka.Features.Terrain.Spheroid_Parameters) return Orka.Transforms.Singles.Vectors.Vector4 is package EF is new Ada.Numerics.Generic_Elementary_Functions (GL.Types.Single); use Orka.Transforms.Singles.Vectors; Axis : GL.Types.Single renames Parameters (1); E2 : GL.Types.Single renames Parameters (2); Y_Mask : GL.Types.Single renames Parameters (3); Z_Mask : GL.Types.Single renames Parameters (4); Unit : Vector4 := Vertex * (2.0, 2.0, 1.0, 1.0) - (1.0, 1.0, 0.0, 0.0); -- Centers the plane begin -- World matrix assumes ECEF, meaning: -- -- z -- | -- o--y -- / -- x -- -- So the 3rd element (1.0) must be moved to the 'x' position, -- and the first two elements (H and V) must be moved to 'y' and 'z'. Unit := Normalize ((Unit (Z), Unit (X), Unit (Y), 0.0)); Unit (W) := 1.0; declare Height : constant GL.Types.Single := Length ((Unit (Y), Unit (Z), 0.0, 0.0) * (Y_Mask, Z_Mask, 0.0, 0.0)); N : constant GL.Types.Single := Axis / EF.Sqrt (1.0 - E2 * Height * Height); Scale : Vector4 := ((1.0, 1.0, 1.0, 1.0) - E2 * (0.0, Y_Mask, Z_Mask, 0.0)) * N; begin Scale (W) := 1.0; return Scale * Unit; end; end Plane_To_Sphere; function Get_Sphere_Visibilities (Parameters : Spheroid_Parameters; Front, Back, World, View : Orka.Types.Singles.Matrix4) return GL.Types.Single_Array is use Orka.Transforms.Singles.Matrices; World_View : constant Orka.Types.Singles.Matrix4 := View * World; Vertices : constant array (GL.Types.Size range 0 .. 3) of Orka.Types.Singles.Vector4 := (Plane_To_Sphere ((0.0, 0.0, 1.0, 1.0), Parameters), Plane_To_Sphere ((1.0, 0.0, 1.0, 1.0), Parameters), Plane_To_Sphere ((0.0, 1.0, 1.0, 1.0), Parameters), Plane_To_Sphere ((1.0, 1.0, 1.0, 1.0), Parameters)); Faces : constant array (GL.Types.Size range 0 .. 1) of Orka.Types.Singles.Matrix4 := (Front, Back); Result : GL.Types.Single_Array (0 .. 7); use Orka.Transforms.Singles.Vectors; use all type GL.Types.Int; begin for Index in Result'Range loop declare V : Orka.Types.Singles.Vector4 renames Vertices (Index mod 4); F : Orka.Types.Singles.Matrix4 renames Faces (Index / 4); -- Vector pointing to vertex from camera or sphere V_From_C : constant Orka.Types.Singles.Vector4 := World_View * (F * V); V_From_S : constant Orka.Types.Singles.Vector4 := View * (F * V); begin Result (Index) := Dot (Normalize (V_From_C), Normalize (V_From_S)); end; end loop; return Result; end Get_Sphere_Visibilities; ----------------------------------------------------------------------------- subtype Tile_Index is Positive range 1 .. 6; subtype Vertex_Index is GL.Types.Size range 0 .. 7; type Edge_Index is range 1 .. 12; type Edge_Index_Array is array (Positive range 1 .. 4) of Edge_Index; type Vertex_Index_Array is array (Positive range 1 .. 2) of Vertex_Index; type Tile_Index_Array is array (Positive range <>) of Tile_Index; type Tile_3_Array is array (Vertex_Index) of Tile_Index_Array (1 .. 3); type Tile_2_Array is array (Edge_Index) of Tile_Index_Array (1 .. 2); type Edges_Array is array (Tile_Index) of Edge_Index_Array; type Vertices_Array is array (Edge_Index) of Vertex_Index_Array; -- The three tiles that are visible when a particular -- vertex is visible Vertex_Buffer_Indices : constant Tile_3_Array := (0 => (1, 4, 6), 1 => (1, 2, 6), 2 => (1, 4, 5), 3 => (1, 2, 5), 4 => (2, 3, 6), 5 => (3, 4, 6), 6 => (2, 3, 5), 7 => (3, 4, 5)); -- The vertices that form each edge Edge_Vertex_Indices : constant Vertices_Array := (1 => (0, 2), 2 => (1, 3), 3 => (2, 3), 4 => (0, 1), 5 => (4, 6), 6 => (5, 7), 7 => (6, 7), 8 => (4, 5), 9 => (2, 7), 10 => (3, 6), 11 => (0, 5), 12 => (1, 4)); -- The two tiles to which each edge belongs Edge_Tiles_Indices : constant Tile_2_Array := (1 => (1, 4), 2 => (1, 2), 3 => (1, 5), 4 => (1, 6), 5 => (3, 2), 6 => (3, 4), 7 => (3, 5), 8 => (3, 6), 9 => (4, 5), 10 => (2, 5), 11 => (4, 6), 12 => (2, 6)); -- The four edges of each tile Tile_Edge_Indices : constant Edges_Array := (1 => (1, 2, 3, 4), 2 => (2, 5, 10, 12), 3 => (5, 6, 7, 8), 4 => (1, 6, 9, 11), 5 => (3, 7, 9, 10), 6 => (4, 8, 11, 12)); Threshold_A : constant := 0.55; Threshold_B : constant := 0.25; function Get_Visible_Tiles (Visibilities : GL.Types.Single_Array) return Visible_Tile_Array is Visible_Tile_Count : array (Tile_Index) of Natural := (others => 0); Vertex_Visible : Boolean := False; Result : Visible_Tile_Array := (Tile_Index => False); begin -- Heuristic 1: a tile is visible if it surrounds a vertex that is -- pointing towards the camera for Vertex in Vertex_Buffer_Indices'Range loop if Visibilities (Vertex) < 0.0 then for Tile of Vertex_Buffer_Indices (Vertex) loop Result (Tile) := True; end loop; Vertex_Visible := True; end if; end loop; -- If all vertices point away from the camera, the camera is usually -- close to some of the tiles if not Vertex_Visible then -- Heuristic 2: an edge is visible if the maximum vertex visibility -- is less than some threshold for Edge in Edge_Vertex_Indices'Range loop if (for all Vertex of Edge_Vertex_Indices (Edge) => Visibilities (Vertex) < Threshold_A) then for Tile of Edge_Tiles_Indices (Edge) loop Visible_Tile_Count (Tile) := Visible_Tile_Count (Tile) + 1; end loop; end if; end loop; declare Max_Count : Natural := 0; function Average_Visibility (Vertices : Vertex_Index_Array) return GL.Types.Single is Sum : GL.Types.Single := 0.0; begin for Vertex of Vertices loop Sum := Sum + Visibilities (Vertex); end loop; return Sum / GL.Types.Single (Vertices'Length); end Average_Visibility; begin for Tile in Visible_Tile_Count'Range loop Max_Count := Natural'Max (Max_Count, Visible_Tile_Count (Tile)); end loop; -- A tile is visible if it has the highest number (1, 2, or 4) -- of visible edges -- -- For example, tile 1 might have a count of 4, while its surrounding -- tiles (2, 4, 5, and 6) have a count of 1. In that case choose to -- display tile 1. for Tile in Visible_Tile_Count'Range loop if Visible_Tile_Count (Tile) = Max_Count then Result (Tile) := True; end if; end loop; -- Sometimes the camera might be positioned above a tile with count 4 -- and looking at some of its edges. In that case we should render the -- adjacent tiles as well if those tiles are 'likely' to be visible. if Max_Count in 2 | 4 then for Tile in Tile_Edge_Indices'Range loop if Result (Tile) then -- Heuristic 3: all tiles that surround an edge of a visible tile -- with an average vertex visibility less than some threshold -- are visible as well for Edge of Tile_Edge_Indices (Tile) loop if Average_Visibility (Edge_Vertex_Indices (Edge)) < Threshold_B then for Tile of Edge_Tiles_Indices (Edge) loop Result (Tile) := True; end loop; end if; end loop; end if; end loop; end if; end; end if; return Result; end Get_Visible_Tiles; end Orka.Features.Terrain.Spheres;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; package XML.SAX.Parse_Exceptions.Internals is pragma Preelaborate; function Create (Public_Id : League.Strings.Universal_String; System_Id : League.Strings.Universal_String; Line : Natural; Column : Natural; Message : League.Strings.Universal_String) return XML.SAX.Parse_Exceptions.SAX_Parse_Exception; end XML.SAX.Parse_Exceptions.Internals;
-- Copyright 2018-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Bla is S : String := "test"; begin Call_Me (S); end Bla;
-- Copyright 2012-2020 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is procedure Archive; type Action is (Archive, Extract); function Get_Action return Action; end Pck;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . W I D _ C H A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, 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. -- -- -- ------------------------------------------------------------------------------ package body System.Wid_Char is --------------------- -- Width_Character -- --------------------- function Width_Character (Lo, Hi : Character) return Natural is W : Natural; begin W := 0; for C in Lo .. Hi loop declare S : constant String := Character'Image (C); begin W := Natural'Max (W, S'Length); end; end loop; return W; end Width_Character; end System.Wid_Char;
-- This package is intended to set up and tear down the test environment. -- Once created by GNATtest, this package will never be overwritten -- automatically. Contents of this package can be modified in any way -- except for sections surrounded by a 'read only' marker. with Ada.Containers.Vectors.Test_Data; with Ada.Containers.Vectors.Test_Data.Tests; package Ships.Test_Data.Tests.Proto_Crew_Container.Test_Data is -- begin read only type Test is new AUnit.Test_Fixtures.Test_Fixture -- end read only with null record; procedure Set_Up(Gnattest_T: in out Test); procedure Tear_Down(Gnattest_T: in out Test); -- begin read only package Gnattest_Data_Inst is new GNATtest_Generated.GNATtest_Standard.Ships .Proto_Crew_Container .Test_Data (Test); package Gnattest_Tests_Inst is new Gnattest_Data_Inst.Tests; type New_Test is new Gnattest_Tests_Inst.Test with null record; -- end read only procedure User_Set_Up(Gnattest_T: in out New_Test); procedure User_Tear_Down(Gnattest_T: in out New_Test); end Ships.Test_Data.Tests.Proto_Crew_Container.Test_Data;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 3 9 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 39 package System.Pack_39 is pragma Preelaborate; Bits : constant := 39; type Bits_39 is mod 2 ** Bits; for Bits_39'Size use Bits; function Get_39 (Arr : System.Address; N : Natural) return Bits_39; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_39 (Arr : System.Address; N : Natural; E : Bits_39); -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_39;
package body any_Math.any_Geometry.any_d2 is --------- -- Sites -- function Distance (From, To : Site) return Real is use Functions; begin return SqRt ( (To (1) - From (1)) ** 2 + (To (2) - From (2)) ** 2); end Distance; function to_Polar (Self : in Site) return polar_Site is use any_Math.complex_Reals; the_Complex : constant Complex := compose_from_Cartesian (Self (1), Self (2)); begin return (Angle => Argument (the_Complex), Extent => Modulus (the_Complex)); end to_Polar; function to_Site (Self : in polar_Site) return Site is use any_Math.complex_Reals; the_Complex : constant Complex := compose_from_Polar (Modulus => Self.Extent, Argument => Self.Angle); begin return (the_Complex.Re, the_Complex.Im); end to_Site; function Angle (Self : in Site) return Radians is use any_Math.complex_Reals; the_Complex : constant Complex := compose_from_Cartesian (Self (1), Self (2)); begin return Argument (the_Complex); end Angle; function Extent (Self : in Site) return Real is use any_Math.complex_Reals; the_Complex : constant Complex := compose_from_Cartesian (Self (1), Self (2)); begin return Modulus (the_Complex); end Extent; --------- -- Lines -- function to_Line (Anchor : in Site; Angle : in Radians) return Line is use Functions; begin return (Kind => anchored_Gradient, Anchor => Anchor, Gradient => Tan (Angle)); -- TODO: What about infinite gradient ? ie 90 and 270 degrees ? end to_Line; function to_Line (Site_1, Site_2 : in Site) return Line is begin return (Kind => two_Points, Sites => (Site_1, Site_2)); end to_Line; function X_of (Self : in Line; Y : in Real) return Real is begin return (Y - Self.Anchor (2)) / Self.Gradient + Self.Anchor (1); end X_of; function Y_of (Self : in Line; X : in Real) return Real is begin return Self.Gradient * (X - Self.Anchor (1)) + Self.Anchor (2); end Y_of; function Gradient (Self : in Line) return Real is Run : constant Real := Self.Sites (2)(1) - Self.Sites (1)(1); begin if Run = 0.0 then return Real'Last; else return (Self.Sites (2) (2) - Self.Sites (1) (2)) / Run; end if; end Gradient; ---------- -- Bounds -- function to_bounding_Box (Self : Sites) return bounding_Box is Result : bounding_Box := null_Bounds; begin for Each in Self'Range loop Result.Lower (1) := Real'Min (Result.Lower (1), Self (Each)(1)); Result.Lower (2) := Real'Min (Result.Lower (2), Self (Each)(2)); Result.Upper (1) := Real'Max (Result.Upper (1), Self (Each)(1)); Result.Upper (2) := Real'Max (Result.Upper (2), Self (Each)(2)); end loop; return Result; end to_bounding_Box; function Extent (Self : in bounding_Box; Dimension : in Index) return Real is begin return Self.Upper (Dimension) - Self.Lower (Dimension); end Extent; function "or" (Left : in bounding_Box; Right : in Site) return bounding_Box is Result : bounding_Box; begin for i in Right'Range loop if Right (i) < Left.Lower (i) then Result.Lower (i) := Right (i); else Result.Lower (i) := Left.Lower (i); end if; if Right (i) > Left.Upper (i) then Result.Upper (i) := Right (i); else Result.Upper (i) := Left.Upper (i); end if; end loop; return Result; end "or"; function "or" (Left : in bounding_Box; Right : in bounding_Box) return bounding_Box is Result : bounding_Box := Left or Right.Lower; begin Result := Result or Right.Upper; return Result; end "or"; function "+" (Left : in bounding_Box; Right : in Vector_2) return bounding_Box is begin return (Left.Lower + Right, Left.Upper + Right); end "+"; function Image (Self : bounding_Box) return String is begin return "(Lower => " & Image (Self.Lower) & ", Upper => " & Image (Self.Upper) & ")"; end Image; ------------ -- Triangles -- procedure check (Self : in Triangle) is begin if Self.Vertices (1) = Self.Vertices (2) or Self.Vertices (1) = Self.Vertices (3) or Self.Vertices (2) = Self.Vertices (3) then raise Degenerate; end if; declare L1 : constant Line := to_Line (Self.Vertices (1), Self.Vertices (2)); L2 : constant Line := to_Line (Self.Vertices (2), Self.Vertices (3)); L3 : constant Line := to_Line (Self.Vertices (3), Self.Vertices (1)); M1 : constant Real := Gradient (L1); M2 : constant Real := Gradient (L2); M3 : constant Real := Gradient (L3); begin if M1 = M2 or M1 = M3 or M2 = M3 then raise Colinear with " G1: " & Image (M1) & " G2: " & Image (M2) & " G3: " & Image (M3); end if; end; end check; function Area (Self : in Triangle) return Real -- -- This is an immplementation of Heron's formula. -- It is numerically unstable with very small angles. -- is use Functions; A : constant Real := Distance (Self.Vertices (1), Self.Vertices (2)); B : constant Real := Distance (Self.Vertices (2), Self.Vertices (3)); C : constant Real := Distance (Self.Vertices (3), Self.Vertices (1)); S : constant Real := (A + B + C) / 2.0; -- Semi-perimeter. begin return Real (SqRt (S * (S - A) * (S - B) * (S - C))); -- Herons formula. end Area; function Perimeter (Self : Triangle) return Real is begin return Distance (Self.Vertices (1), Self.Vertices (2)) + Distance (Self.Vertices (2), Self.Vertices (3)) + Distance (Self.Vertices (3), Self.Vertices (1)); end Perimeter; function prior_Vertex (Self : in Triangle; to_Vertex : in Positive) return Site is begin if to_Vertex = 1 then return Self.Vertices (3); else return Self.Vertices (to_Vertex - 1); end if; end prior_Vertex; function next_Vertex (Self : in Triangle; to_Vertex : in Positive) return Site is begin if to_Vertex = 3 then return Self.Vertices (1); else return Self.Vertices (to_Vertex + 1); end if; end next_Vertex; function Angle (Self : in Triangle; at_Vertex : in Positive) return Radians is use Functions; a : constant Real := Distance (next_Vertex (Self, to_vertex => at_Vertex), prior_Vertex (Self, to_vertex => at_Vertex)); b : constant Real := Distance (Self.Vertices (at_Vertex), next_Vertex (Self, to_vertex => at_Vertex)); c : constant Real := Distance (Self.Vertices (at_Vertex), prior_Vertex (Self, to_vertex => at_Vertex)); cos_A : constant Real := (b**2 + c**2 - a**2) / (2.0 * b * c); begin if cos_A < -1.0 then return to_Radians (180.0); elsif cos_A > 1.0 then return 0.0; else return arcCos (cos_A); end if; end Angle; ---------- -- Circles -- function Area (Self : Circle) return Real is begin return Pi * Self.Radius**2; end Area; function Perimeter (Self : Circle) return Real is begin return 2.0 * Pi * Self.Radius; end Perimeter; ----------- -- Polygons -- function Centroid (Self : in Polygon) return Site is Result : Site := Origin_2d; begin for i in 1 .. Self.Vertex_Count loop Result := Result + Self.Vertices (i); end loop; Result := Result / Real (Self.Vertex_Count); return Result; end Centroid; procedure center (Self : in out Polygon) is Center : constant Site := Centroid (Self); begin for i in 1 .. Self.Vertex_Count loop Self.Vertices (i) := Self.Vertices (i) - Center; end loop; end center; function prior_Vertex (Self : in Polygon; to_Vertex : in Positive) return Site is begin if To_Vertex = 1 then return Self.Vertices (Self.Vertex_Count); else return Self.Vertices (to_Vertex - 1); end if; end prior_Vertex; function next_Vertex (Self : in Polygon; to_Vertex : in Positive) return Site is begin if to_Vertex = Self.Vertex_Count then return Self.Vertices (1); else return Self.Vertices (to_Vertex + 1); end if; end next_Vertex; function is_Triangle (Self : in Polygon) return Boolean is begin return Self.Vertex_Count = 3; end is_Triangle; function is_Clockwise (Self : in Polygon) return Boolean is i : constant Site := Self.Vertices (1); j : constant Site := Self.Vertices (1); k : constant Site := Self.Vertices (1); z : Real := (j (1) - i (1)) * (k (2) - j (2)); begin z := z - (j (2) - i (2)) * (k (1) - j (1)); return z < 0.0; end is_Clockwise; function is_Convex (Self : in Polygon) return Boolean is negative_Found, positive_Found : Boolean := False; begin if is_Triangle (Self) then return True; -- All triangles are convex. end if; for i in 1 .. Self.Vertex_Count loop declare k0 : constant Site := Self.Vertices (i); function get_k1 return Site is begin if i = Self.Vertex_Count then return Self.Vertices (1); else return Self.Vertices (i + 1); end if; end get_k1; k1 : constant Site := get_k1; function get_k2 return Site is begin if i = Self.Vertex_Count - 1 then return Self.Vertices (1); elsif i = Self.Vertex_Count then return Self.Vertices (2); else return Self.Vertices (i + 2); end if; end get_k2; k2 : constant Site := get_k2; function get_Crossproduct return Real is dx1 : constant Real := k1 (1) - k0 (1); dy1 : constant Real := k1 (2) - k0 (2); dx2 : constant Real := k2 (1) - k1 (1); dy2 : constant Real := k2 (2) - k1 (2); begin return dx1 * dy2 - dy1 * dx2; end get_Crossproduct; Crossproduct : constant Real := get_Crossproduct; begin if Crossproduct > 0.0 then if negative_Found then return False; end if; positive_Found := True; elsif Crossproduct < 0.0 then if positive_Found then return False; end if; negative_Found := True; end if; end; end loop; return True; end is_Convex; function Area (Self : Polygon) return Real is Result : Real := 0.0; begin for i in 2 .. Self.Vertex_Count - 1 loop Result := Result + Area (Triangle' (Vertices => (Self.Vertices (1), Self.Vertices (i), Self.Vertices (i + 1)))); end loop; return Result; end Area; function Perimeter (Self : Polygon) return Real is Result : Real := Distance (Self.Vertices (1), Self.Vertices (Self.Vertex_Count)); begin for i in 1 .. Self.Vertex_Count - 1 loop Result := Result + Distance (Self.Vertices (i), Self.Vertices (i + 1)); end loop; return Result; end Perimeter; function Angle (Self : in Polygon; at_Vertex : in Positive) return Radians is Tri : constant Triangle := (vertices => (Self.Vertices (at_Vertex), next_Vertex (Self, at_Vertex), prior_Vertex (Self, at_Vertex))); begin return Angle (Tri, 1); end Angle; function Image (Self : in Polygon) return String is begin return "Polygon image (TODO)"; end Image; end any_Math.any_Geometry.any_d2;
-- -- Jan & Uwe R. Zimmer, Australia, July 2011 -- with Real_Type; use Real_Type; with Vectors_xD; pragma Elaborate_All (Vectors_xD); package Vectors_4D is type xy_Coordinates is (x, y, z, t); package Vectors_4Di is new Vectors_xD (Real, xy_Coordinates); subtype Vector_4D is Vectors_4Di.Vector_xD; Zero_Vector_4D : constant Vector_4D := Vectors_4Di.Zero_Vector_xD; function Image (V : Vector_4D) return String renames Vectors_4Di.Image; function Norm (V : Vector_4D) return Vector_4D renames Vectors_4Di.Norm; function "*" (Scalar : Real; V : Vector_4D) return Vector_4D renames Vectors_4Di."*"; function "*" (V : Vector_4D; Scalar : Real) return Vector_4D renames Vectors_4Di."*"; function "/" (V : Vector_4D; Scalar : Real) return Vector_4D renames Vectors_4Di."/"; function "*" (V_Left, V_Right : Vector_4D) return Real renames Vectors_4Di."*"; function Angle_Between (V_Left, V_Right : Vector_4D) return Real renames Vectors_4Di.Angle_Between; function "+" (V_Left, V_Right : Vector_4D) return Vector_4D renames Vectors_4Di."+"; function "-" (V_Left, V_Right : Vector_4D) return Vector_4D renames Vectors_4Di."-"; function "abs" (V : Vector_4D) return Real renames Vectors_4Di."abs"; end Vectors_4D;
package body Benchmark.Tree is function Create_Tree return Benchmark_Pointer is begin return new Tree_Type; end Create_Tree; procedure Set_Argument(benchmark : in out Tree_Type; arg : in String) is value : constant String := Extract_Argument(arg); begin if Check_Argument(arg, "size") then benchmark.size := Positive'Value(value); elsif Check_Argument(arg, "iterations") then benchmark.iterations := Positive'Value(value); else Set_Argument(Benchmark_Type(benchmark), arg); end if; exception when others => raise Invalid_Argument; end Set_Argument; procedure Insert(benchmark : in Tree_Type; offset : in out Natural; value : in Integer) is ptr : Integer := 0; next : Integer; begin Write_Value(benchmark, offset + 0, value); Write_Value(benchmark, offset + 4, -1); Write_Value(benchmark, offset + 8, -1); loop if value < Read_Value(benchmark, ptr) then next := ptr + 4; else next := ptr + 8; end if; ptr := Read_Value(benchmark, next); exit when ptr < 0; end loop; Write_Value(benchmark, next, offset); offset := offset + 12; end Insert; procedure Find(benchmark : in Tree_Type; value : in Integer) is ptr : Integer := 0; temp : Integer; begin while ptr >= 0 loop temp := Read_Value(benchmark, ptr + 0); if value < temp then ptr := Read_Value(benchmark, ptr + 4); elsif value > temp then ptr := Read_Value(benchmark, ptr + 8); else return; end if; end loop; end Find; procedure Run(benchmark : in Tree_Type) is function Rand return Integer is begin return Get_Random(benchmark) mod benchmark.size; end Rand; offset : Natural := 0; begin -- Each node is 12 bytes: -- 4 byte value -- 4 byte left pointer -- 4 byte right pointer -- Initialize the root. Write_Value(benchmark, offset + 0, Rand); Write_Value(benchmark, offset + 4, -1); Write_Value(benchmark, offset + 8, -1); offset := offset + 12; -- Build the tree (root is already set). for i in 2 .. benchmark.size loop Insert(benchmark, offset, Rand); end loop; -- Look up items in the tree. for i in 1 .. benchmark.iterations loop Find(benchmark, Rand); end loop; end Run; end Benchmark.Tree;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2016, Free Software Foundation, Inc. -- -- -- -- GNARL 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. GNARL 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/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- Ravenscar version of this package for bare board targets -- This package encapsulates all direct interfaces to OS services that are -- needed by the tasking run-time (libgnarl). pragma Restrictions (No_Elaboration_Code); -- This could use a comment, why is it here??? with System.Multiprocessors; with System.Storage_Elements; with System.BB.Threads.Queues; with System.BB.Time; with System.BB.Interrupts; with System.BB.Board_Support; with System.BB.Parameters; with System.BB.CPU_Primitives.Multiprocessors; package System.OS_Interface with SPARK_Mode => Off is pragma Preelaborate; ---------------- -- Interrupts -- ---------------- Max_Interrupt : constant := System.BB.Interrupts.Max_Interrupt; -- Number of asynchronous interrupts subtype Interrupt_ID is System.BB.Interrupts.Interrupt_ID; -- Interrupt identifiers No_Interrupt : constant Interrupt_ID := System.BB.Interrupts.No_Interrupt; -- Special value indicating no interrupt subtype Interrupt_Handler is System.BB.Interrupts.Interrupt_Handler; -- Interrupt handlers -------------------------- -- Interrupt processing -- -------------------------- function Current_Interrupt return Interrupt_ID renames System.BB.Interrupts.Current_Interrupt; -- Function that returns the hardware interrupt currently being -- handled (if any). In case no hardware interrupt is being handled -- the returned value is No_Interrupt. procedure Attach_Handler (Handler : Interrupt_Handler; Id : Interrupt_ID; PO_Prio : Interrupt_Priority) renames System.BB.Interrupts.Attach_Handler; -- Attach a handler to a hardware interrupt procedure Power_Down renames System.BB.Board_Support.Power_Down; -- Put current CPU in power-down mode ---------- -- Time -- ---------- subtype Time is System.BB.Time.Time; -- Representation of the time in the underlying tasking system subtype Time_Span is System.BB.Time.Time_Span; -- Represents the length of time intervals in the underlying tasking -- system. Ticks_Per_Second : constant := System.BB.Parameters.Ticks_Per_Second; -- Number of clock ticks per second function Clock return Time renames System.BB.Time.Clock; -- Get the number of ticks elapsed since startup procedure Delay_Until (T : Time) renames System.BB.Time.Delay_Until; -- Suspend the calling task until the absolute time specified by T ------------- -- Threads -- ------------- subtype Thread_Descriptor is System.BB.Threads.Thread_Descriptor; -- Type that contains the information about a thread (registers, -- priority, etc.). subtype Thread_Id is System.BB.Threads.Thread_Id; -- Identifiers for the underlying threads Null_Thread_Id : constant Thread_Id := System.BB.Threads.Null_Thread_Id; -- Identifier for a non valid thread Lwp_Self : constant System.Address := Null_Address; -- LWP is not used by gdb on ravenscar procedure Initialize (Environment_Thread : Thread_Id; Main_Priority : System.Any_Priority) renames System.BB.Threads.Initialize; -- Procedure for initializing the underlying tasking system procedure Initialize_Slave (Idle_Thread : Thread_Id; Idle_Priority : Integer; Stack_Address : System.Address; Stack_Size : System.Storage_Elements.Storage_Offset) renames System.BB.Threads.Initialize_Slave; -- Procedure to initialize the idle thread procedure Thread_Create (Id : Thread_Id; Code : System.Address; Arg : System.Address; Priority : Integer; Base_CPU : System.Multiprocessors.CPU_Range; Stack_Address : System.Address; Stack_Size : System.Storage_Elements.Storage_Offset) renames System.BB.Threads.Thread_Create; -- Create a new thread function Thread_Self return Thread_Id renames System.BB.Threads.Thread_Self; -- Return the thread identifier for the calling task ---------- -- ATCB -- ---------- procedure Set_ATCB (Id : Thread_Id; ATCB : System.Address) renames System.BB.Threads.Set_ATCB; -- Associate the specified ATCB to the thread ID function Get_ATCB return System.Address renames System.BB.Threads.Get_ATCB; -- Get the ATCB associated to the currently running thread ---------------- -- Scheduling -- ---------------- procedure Set_Priority (Priority : Integer) renames System.BB.Threads.Set_Priority; -- Set the active priority of the executing thread to the given value function Get_Priority (Id : Thread_Id) return Integer renames System.BB.Threads.Get_Priority; -- Get the current base priority of a thread procedure Sleep renames System.BB.Threads.Sleep; -- The calling thread is unconditionally suspended procedure Wakeup (Id : Thread_Id) renames System.BB.Threads.Wakeup; -- The referred thread becomes ready (the thread must be suspended) --------------------- -- Multiprocessors -- --------------------- function Get_Affinity (Id : Thread_Id) return Multiprocessors.CPU_Range renames System.BB.Threads.Get_Affinity; -- Return CPU affinity of the given thread (maybe Not_A_Specific_CPU) function Get_CPU (Id : Thread_Id) return Multiprocessors.CPU renames System.BB.Threads.Get_CPU; -- Return the CPU in charge of the given thread (always a valid CPU) function Current_Priority (CPU_Id : Multiprocessors.CPU) return System.Any_Priority renames System.BB.Threads.Queues.Current_Priority; -- Return the active priority of the current thread or -- System.Any_Priority'First if no threads are running. function Current_CPU return Multiprocessors.CPU renames System.BB.CPU_Primitives.Multiprocessors.Current_CPU; -- Return the id of the current CPU end System.OS_Interface;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2019, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with STM32.Device; package body Feather_STM32F405.LED is Red_LED : GPIO_Point renames STM32.Device.PC1; ------------- -- Turn_On -- ------------- procedure Turn_On is begin Red_LED.Set; end Turn_On; -------------- -- Turn_Off -- -------------- procedure Turn_Off is begin Red_LED.Clear; end Turn_Off; ------------ -- Toggle -- ------------ procedure Toggle is begin Red_LED.Toggle; end Toggle; begin STM32.Device.Enable_Clock (Red_LED); Red_LED.Configure_IO ((Mode_Out, Pull_Down, Push_Pull, Speed_Low)); end Feather_STM32F405.LED;
-------------------------------------------------------------------------------------------------------------------- -- 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. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Windows -- -- Window specific events. -------------------------------------------------------------------------------------------------------------------- with SDL.Video.Windows; package SDL.Events.Windows is pragma Preelaborate; -- Window events. Window : constant Event_Types := 16#0000_0200#; System_Window_Manager : constant Event_Types := Window + 1; type Window_Event_ID is (None, Shown, Hidden, Exposed, Moved, Resized, Size_Changed, Minimised, Maximised, Restored, Enter, Leave, Focus_Gained, Focus_Lost, Close, Take_Focus, Hit_Test) with Convention => C; type Window_Events is record Event_Type : Event_Types; -- Will be set to Window. Time_Stamp : Time_Stamps; ID : SDL.Video.Windows.ID; Event_ID : Window_Event_ID; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Data_1 : Interfaces.Integer_32; Data_2 : Interfaces.Integer_32; end record with Convention => C; private for Window_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; ID at 2 * SDL.Word range 0 .. 31; Event_ID at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Data_1 at 4 * SDL.Word range 0 .. 31; Data_2 at 5 * SDL.Word range 0 .. 31; end record; end SDL.Events.Windows;
-- Copyright (C) 2011-2020 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is function Ident (I : Integer) return Integer; end Pck;
-- CA1013A1.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. --* -- WKB 7/20/81 GENERIC TYPE INDEX IS RANGE <>; PROCEDURE CA1013A1 (I : IN OUT INDEX); PROCEDURE CA1013A1 (I : IN OUT INDEX) IS BEGIN I := I + 1; END CA1013A1;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- SYSTEM.TASKING.PROTECTED_OBJECTS.ENTRIES -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-2016, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains all the simple primitives related to protected -- objects with entries (i.e init, lock, unlock). -- The handling of protected objects with no entries is done in -- System.Tasking.Protected_Objects, the complex routines for protected -- objects with entries in System.Tasking.Protected_Objects.Operations. -- The split between Entries and Operations is needed to break circular -- dependencies inside the run time. -- Note: the compiler generates direct calls to this interface, via Rtsfind with System.Task_Primitives.Operations; with System.Restrictions; with System.Parameters; with System.Tasking.Initialization; pragma Elaborate_All (System.Tasking.Initialization); -- To insure that tasking is initialized if any protected objects are created package body System.Tasking.Protected_Objects.Entries is package STPO renames System.Task_Primitives.Operations; use Parameters; use Task_Primitives.Operations; ---------------- -- Local Data -- ---------------- Locking_Policy : Character; pragma Import (C, Locking_Policy, "__gl_locking_policy"); -------------- -- Finalize -- -------------- overriding procedure Finalize (Object : in out Protection_Entries) is Entry_Call : Entry_Call_Link; Caller : Task_Id; Ceiling_Violation : Boolean; Self_ID : constant Task_Id := STPO.Self; Old_Base_Priority : System.Any_Priority; begin if Object.Finalized then return; end if; STPO.Write_Lock (Object.L'Unrestricted_Access, Ceiling_Violation); if Single_Lock then Lock_RTS; end if; if Ceiling_Violation then -- Dip our own priority down to ceiling of lock. See similar code in -- Tasking.Entry_Calls.Lock_Server. STPO.Write_Lock (Self_ID); Old_Base_Priority := Self_ID.Common.Base_Priority; Self_ID.New_Base_Priority := Object.Ceiling; Initialization.Change_Base_Priority (Self_ID); STPO.Unlock (Self_ID); if Single_Lock then Unlock_RTS; end if; STPO.Write_Lock (Object.L'Unrestricted_Access, Ceiling_Violation); if Ceiling_Violation then raise Program_Error with "ceiling violation"; end if; if Single_Lock then Lock_RTS; end if; Object.Old_Base_Priority := Old_Base_Priority; Object.Pending_Action := True; end if; -- Send program_error to all tasks still queued on this object for E in Object.Entry_Queues'Range loop Entry_Call := Object.Entry_Queues (E).Head; while Entry_Call /= null loop Caller := Entry_Call.Self; Entry_Call.Exception_To_Raise := Program_Error'Identity; STPO.Write_Lock (Caller); Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done); STPO.Unlock (Caller); exit when Entry_Call = Object.Entry_Queues (E).Tail; Entry_Call := Entry_Call.Next; end loop; end loop; Object.Finalized := True; if Single_Lock then Unlock_RTS; end if; STPO.Unlock (Object.L'Unrestricted_Access); STPO.Finalize_Lock (Object.L'Unrestricted_Access); end Finalize; ----------------- -- Get_Ceiling -- ----------------- function Get_Ceiling (Object : Protection_Entries_Access) return System.Any_Priority is begin return Object.New_Ceiling; end Get_Ceiling; ------------------------------------- -- Has_Interrupt_Or_Attach_Handler -- ------------------------------------- function Has_Interrupt_Or_Attach_Handler (Object : Protection_Entries_Access) return Boolean is pragma Warnings (Off, Object); begin return False; end Has_Interrupt_Or_Attach_Handler; ----------------------------------- -- Initialize_Protection_Entries -- ----------------------------------- procedure Initialize_Protection_Entries (Object : Protection_Entries_Access; Ceiling_Priority : Integer; Compiler_Info : System.Address; Entry_Queue_Maxes : Protected_Entry_Queue_Max_Access; Entry_Bodies : Protected_Entry_Body_Access; Find_Body_Index : Find_Body_Index_Access) is Init_Priority : Integer := Ceiling_Priority; Self_ID : constant Task_Id := STPO.Self; begin if Init_Priority = Unspecified_Priority then Init_Priority := System.Priority'Last; end if; if Locking_Policy = 'C' and then Has_Interrupt_Or_Attach_Handler (Object) and then Init_Priority not in System.Interrupt_Priority then -- Required by C.3.1(11) raise Program_Error; end if; -- If a PO is created from a controlled operation, abort is already -- deferred at this point, so we need to use Defer_Abort_Nestable. In -- some cases, the following assertion can help to spot inconsistencies, -- outside the above scenario involving controlled types. -- pragma Assert (Self_Id.Deferral_Level = 0); Initialization.Defer_Abort_Nestable (Self_ID); Initialize_Lock (Init_Priority, Object.L'Access); Initialization.Undefer_Abort_Nestable (Self_ID); Object.Ceiling := System.Any_Priority (Init_Priority); Object.New_Ceiling := System.Any_Priority (Init_Priority); Object.Owner := Null_Task; Object.Compiler_Info := Compiler_Info; Object.Pending_Action := False; Object.Call_In_Progress := null; Object.Entry_Queue_Maxes := Entry_Queue_Maxes; Object.Entry_Bodies := Entry_Bodies; Object.Find_Body_Index := Find_Body_Index; for E in Object.Entry_Queues'Range loop Object.Entry_Queues (E).Head := null; Object.Entry_Queues (E).Tail := null; end loop; end Initialize_Protection_Entries; ------------------ -- Lock_Entries -- ------------------ procedure Lock_Entries (Object : Protection_Entries_Access) is Ceiling_Violation : Boolean; begin Lock_Entries_With_Status (Object, Ceiling_Violation); if Ceiling_Violation then raise Program_Error with "ceiling violation"; end if; end Lock_Entries; ------------------------------ -- Lock_Entries_With_Status -- ------------------------------ procedure Lock_Entries_With_Status (Object : Protection_Entries_Access; Ceiling_Violation : out Boolean) is begin if Object.Finalized then raise Program_Error with "protected object is finalized"; end if; -- If pragma Detect_Blocking is active then, as described in the ARM -- 9.5.1, par. 15, we must check whether this is an external call on a -- protected subprogram with the same target object as that of the -- protected action that is currently in progress (i.e., if the caller -- is already the protected object's owner). If this is the case hence -- Program_Error must be raised. if Detect_Blocking and then Object.Owner = Self then raise Program_Error; end if; -- The lock is made without deferring abort -- Therefore the abort has to be deferred before calling this routine. -- This means that the compiler has to generate a Defer_Abort call -- before the call to Lock. -- The caller is responsible for undeferring abort, and compiler -- generated calls must be protected with cleanup handlers to ensure -- that abort is undeferred in all cases. pragma Assert (STPO.Self.Deferral_Level > 0 or else not Restrictions.Abort_Allowed); Write_Lock (Object.L'Access, Ceiling_Violation); -- We are entering in a protected action, so that we increase the -- protected object nesting level (if pragma Detect_Blocking is -- active), and update the protected object's owner. if Detect_Blocking then declare Self_Id : constant Task_Id := Self; begin -- Update the protected object's owner Object.Owner := Self_Id; -- Increase protected object nesting level Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting + 1; end; end if; end Lock_Entries_With_Status; ---------------------------- -- Lock_Read_Only_Entries -- ---------------------------- procedure Lock_Read_Only_Entries (Object : Protection_Entries_Access) is Ceiling_Violation : Boolean; begin if Object.Finalized then raise Program_Error with "protected object is finalized"; end if; -- If pragma Detect_Blocking is active then, as described in the ARM -- 9.5.1, par. 15, we must check whether this is an external call on a -- protected subprogram with the same target object as that of the -- protected action that is currently in progress (i.e., if the caller -- is already the protected object's owner). If this is the case hence -- Program_Error must be raised. -- Note that in this case (getting read access), several tasks may -- have read ownership of the protected object, so that this method of -- storing the (single) protected object's owner does not work -- reliably for read locks. However, this is the approach taken for two -- major reasons: first, this function is not currently being used (it -- is provided for possible future use), and second, it largely -- simplifies the implementation. if Detect_Blocking and then Object.Owner = Self then raise Program_Error; end if; Read_Lock (Object.L'Access, Ceiling_Violation); if Ceiling_Violation then raise Program_Error with "ceiling violation"; end if; -- We are entering in a protected action, so that we increase the -- protected object nesting level (if pragma Detect_Blocking is -- active), and update the protected object's owner. if Detect_Blocking then declare Self_Id : constant Task_Id := Self; begin -- Update the protected object's owner Object.Owner := Self_Id; -- Increase protected object nesting level Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting + 1; end; end if; end Lock_Read_Only_Entries; ----------------------- -- Number_Of_Entries -- ----------------------- function Number_Of_Entries (Object : Protection_Entries_Access) return Entry_Index is begin return Entry_Index (Object.Num_Entries); end Number_Of_Entries; ----------------- -- Set_Ceiling -- ----------------- procedure Set_Ceiling (Object : Protection_Entries_Access; Prio : System.Any_Priority) is begin Object.New_Ceiling := Prio; end Set_Ceiling; -------------------- -- Unlock_Entries -- -------------------- procedure Unlock_Entries (Object : Protection_Entries_Access) is begin -- We are exiting from a protected action, so that we decrease the -- protected object nesting level (if pragma Detect_Blocking is -- active), and remove ownership of the protected object. if Detect_Blocking then declare Self_Id : constant Task_Id := Self; begin -- Calls to this procedure can only take place when being within -- a protected action and when the caller is the protected -- object's owner. pragma Assert (Self_Id.Common.Protected_Action_Nesting > 0 and then Object.Owner = Self_Id); -- Remove ownership of the protected object Object.Owner := Null_Task; Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting - 1; end; end if; -- Before releasing the mutex we must actually update its ceiling -- priority if it has been changed. if Object.New_Ceiling /= Object.Ceiling then if Locking_Policy = 'C' then System.Task_Primitives.Operations.Set_Ceiling (Object.L'Access, Object.New_Ceiling); end if; Object.Ceiling := Object.New_Ceiling; end if; Unlock (Object.L'Access); end Unlock_Entries; end System.Tasking.Protected_Objects.Entries;
with Ada.Text_IO; use Ada.Text_IO; procedure Man_Or_Boy is function Zero return Integer is ( 0); function One return Integer is ( 1); function Neg return Integer is (-1); function A (K: Integer; X1, X2, X3, X4, X5: access function return Integer) return Integer is M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of K Res_A: Integer; function B return Integer is begin M := M - 1; Res_A := A (M, B'Access, X1, X2, X3, X4); -- set result of A return Res_A; end B; begin if M <= 0 then return X4.all + X5.all; else declare Dummy: constant Integer := B; -- throw away begin return Res_A; end; end if; end A; begin Put_Line (Integer'Image (A (K => 10, X1 => One 'Access, X2 => Neg 'Access, X3 => Neg 'Access, X4 => One 'Access, X5 => Zero'Access))); end Man_Or_Boy;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-2001 Free Software Foundation, Inc. -- -- -- -- GNARL 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 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a UnixWare (Native THREADS) version of this package. -- This package encapsulates all direct interfaces to OS services -- that are needed by children of System. -- PLEASE DO NOT add any with-clauses to this package -- or remove the pragma Elaborate_Body. -- It is designed to be a bottom-level (leaf) package. with Interfaces.C; package System.OS_Interface is pragma Preelaborate; pragma Linker_Options ("-lthread"); subtype int is Interfaces.C.int; subtype char is Interfaces.C.char; subtype short is Interfaces.C.short; subtype long is Interfaces.C.long; subtype unsigned is Interfaces.C.unsigned; subtype unsigned_short is Interfaces.C.unsigned_short; subtype unsigned_long is Interfaces.C.unsigned_long; subtype unsigned_char is Interfaces.C.unsigned_char; subtype plain_char is Interfaces.C.plain_char; subtype size_t is Interfaces.C.size_t; ----------- -- Errno -- ----------- function errno return int; pragma Import (C, errno, "__get_errno"); EAGAIN : constant := 11; EINTR : constant := 4; EINVAL : constant := 22; ENOMEM : constant := 12; ETIMEDOUT : constant := 145; ------------- -- Signals -- ------------- Max_Interrupt : constant := 34; type Signal is new int range 0 .. Max_Interrupt; for Signal'Size use int'Size; SIGHUP : constant := 1; -- hangup SIGINT : constant := 2; -- interrupt (rubout) SIGQUIT : constant := 3; -- quit (ASCD FS) SIGILL : constant := 4; -- illegal instruction (not reset) SIGTRAP : constant := 5; -- trace trap (not reset) SIGIOT : constant := 6; -- IOT instruction SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future SIGEMT : constant := 7; -- EMT instruction SIGFPE : constant := 8; -- floating point exception SIGKILL : constant := 9; -- kill (cannot be caught or ignored) SIGBUS : constant := 10; -- bus error SIGSEGV : constant := 11; -- segmentation violation SIGSYS : constant := 12; -- bad argument to system call SIGPIPE : constant := 13; -- write on a pipe with no one to read it SIGALRM : constant := 14; -- alarm clock SIGTERM : constant := 15; -- software termination signal from kill SIGUSR1 : constant := 16; -- user defined signal 1 SIGUSR2 : constant := 17; -- user defined signal 2 SIGCLD : constant := 18; -- alias for SIGCHLD SIGCHLD : constant := 18; -- child status change SIGPWR : constant := 19; -- power-fail restart SIGWINCH : constant := 20; -- window size change SIGURG : constant := 21; -- urgent condition on IO channel SIGPOLL : constant := 22; -- pollable event occurred SIGIO : constant := 22; -- I/O possible (Solaris SIGPOLL alias) SIGSTOP : constant := 23; -- stop (cannot be caught or ignored) SIGTSTP : constant := 24; -- user stop requested from tty SIGCONT : constant := 25; -- stopped process has been continued SIGTTIN : constant := 26; -- background tty read attempted SIGTTOU : constant := 27; -- background tty write attempted SIGVTALRM : constant := 28; -- virtual timer expired SIGPROF : constant := 29; -- profiling timer expired SIGXCPU : constant := 30; -- CPU time limit exceeded SIGXFSZ : constant := 31; -- filesize limit exceeded SIGWAITING : constant := 32; -- all LWPs blocked interruptibly notific. SIGLWP : constant := 33; -- signal reserved for thread lib impl. SIGAIO : constant := 34; -- Asynchronous I/O signal SIGADAABORT : constant := SIGABRT; -- Change this if you want to use another signal for task abort. -- SIGTERM might be a good one. type Signal_Set is array (Natural range <>) of Signal; Unmasked : constant Signal_Set := (SIGTRAP, SIGLWP, SIGWAITING, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF); Reserved : constant Signal_Set := (SIGABRT, SIGKILL, SIGSTOP); type sigset_t is private; function sigaddset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigaddset, "sigaddset"); function sigdelset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigdelset, "sigdelset"); function sigfillset (set : access sigset_t) return int; pragma Import (C, sigfillset, "sigfillset"); function sigismember (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigismember, "sigismember"); function sigemptyset (set : access sigset_t) return int; pragma Import (C, sigemptyset, "sigemptyset"); type struct_sigaction is record sa_flags : int; sa_handler : System.Address; sa_mask : sigset_t; sa_resv1 : int; sa_resv2 : int; end record; pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; SIG_BLOCK : constant := 1; SIG_UNBLOCK : constant := 2; SIG_SETMASK : constant := 3; SIG_DFL : constant := 0; SIG_IGN : constant := 1; -- SIG_ERR : constant := -1; -- not used function sigaction (sig : Signal; act : struct_sigaction_ptr; oact : struct_sigaction_ptr) return int; pragma Import (C, sigaction, "sigaction"); ---------- -- Time -- ---------- Time_Slice_Supported : constant Boolean := False; -- Indicates wether time slicing is supported type timespec is private; type clockid_t is private; CLOCK_REALTIME : constant clockid_t; function clock_gettime (clock_id : clockid_t; tp : access timespec) return int; -- UnixWare threads don't have clock_gettime -- We instead use gettimeofday() function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); type struct_timezone is record tz_minuteswest : int; tz_dsttime : int; end record; pragma Convention (C, struct_timezone); type struct_timezone_ptr is access all struct_timezone; type struct_timeval is private; -- This is needed on systems that do not have clock_gettime() -- but do have gettimeofday(). function To_Duration (TV : struct_timeval) return Duration; pragma Inline (To_Duration); function To_Timeval (D : Duration) return struct_timeval; pragma Inline (To_Timeval); ------------------------- -- Priority Scheduling -- ------------------------- SCHED_FIFO : constant := 2; SCHED_RR : constant := 3; SCHED_OTHER : constant := 1; ------------- -- Process -- ------------- type pid_t is private; function kill (pid : pid_t; sig : Signal) return int; pragma Import (C, kill, "kill"); function getpid return pid_t; pragma Import (C, getpid, "getpid"); --------- -- LWP -- --------- function lwp_self return System.Address; pragma Import (C, lwp_self, "_lwp_self"); ------------- -- Threads -- ------------- type Thread_Body is access function (arg : System.Address) return System.Address; type pthread_t is private; subtype Thread_Id is pthread_t; type pthread_mutex_t is limited private; type pthread_cond_t is limited private; type pthread_attr_t is limited private; type pthread_mutexattr_t is limited private; type pthread_condattr_t is limited private; type pthread_key_t is private; PTHREAD_CREATE_DETACHED : constant := 0; ----------- -- Stack -- ----------- Stack_Base_Available : constant Boolean := False; -- Indicates wether the stack base is available on this target. function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); -- returns the stack base of the specified thread. -- Only call this function when Stack_Base_Available is True. function Get_Page_Size return size_t; function Get_Page_Size return Address; pragma Import (C, Get_Page_Size, "getpagesize"); -- returns the size of a page, or 0 if this is not relevant on this -- target PROT_NONE : constant := 0; PROT_READ : constant := 1; PROT_WRITE : constant := 2; PROT_EXEC : constant := 4; PROT_USER : constant := 8; PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC + PROT_USER; PROT_ON : constant := PROT_READ; PROT_OFF : constant := PROT_ALL; function mprotect (addr : Address; len : size_t; prot : int) return int; pragma Import (C, mprotect); ------------------------- -- POSIX.1c Section 3 -- ------------------------- function sigwait (set : access sigset_t; sig : access Signal) return int; pragma Inline (sigwait); -- UnixWare provides a non standard sigwait function pthread_kill (thread : pthread_t; sig : Signal) return int; pragma Inline (pthread_kill); -- UnixWare provides a non standard pthread_kill type sigset_t_ptr is access all sigset_t; function pthread_sigmask (how : int; set : sigset_t_ptr; oset : sigset_t_ptr) return int; pragma Import (C, pthread_sigmask, "pthread_sigmask"); -------------------------- -- POSIX.1c Section 11 -- -------------------------- function pthread_mutexattr_init (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); function pthread_mutexattr_destroy (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); function pthread_mutex_init (mutex : access pthread_mutex_t; attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); function pthread_condattr_init (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); function pthread_condattr_destroy (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); function pthread_cond_init (cond : access pthread_cond_t; attr : access pthread_condattr_t) return int; pragma Import (C, pthread_cond_init, "pthread_cond_init"); function pthread_cond_destroy (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); function pthread_cond_signal (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); function pthread_cond_wait (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); function pthread_cond_timedwait (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int; pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); Relative_Timed_Wait : constant Boolean := False; -- pthread_cond_timedwait requires an absolute delay time -------------------------- -- POSIX.1c Section 13 -- -------------------------- PTHREAD_PRIO_NONE : constant := 1; PTHREAD_PRIO_INHERIT : constant := 2; PTHREAD_PRIO_PROTECT : constant := 3; function pthread_mutexattr_setprotocol (attr : access pthread_mutexattr_t; protocol : int) return int; pragma Import (C, pthread_mutexattr_setprotocol); function pthread_mutexattr_setprioceiling (attr : access pthread_mutexattr_t; prioceiling : int) return int; pragma Import (C, pthread_mutexattr_setprioceiling); type sched_union is record sched_fifo : int; sched_fcfs : int; sched_other : int; sched_ts : int; policy_params : long; end record; type struct_sched_param is record sched_priority : int; sched_other_stuff : sched_union; end record; function pthread_setschedparam (thread : pthread_t; policy : int; param : access struct_sched_param) return int; pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); function pthread_attr_setscope (attr : access pthread_attr_t; contentionscope : int) return int; pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); function pthread_attr_setinheritsched (attr : access pthread_attr_t; inheritsched : int) return int; pragma Import (C, pthread_attr_setinheritsched); function pthread_attr_setschedpolicy (attr : access pthread_attr_t; policy : int) return int; pragma Import (C, pthread_attr_setschedpolicy); function sched_yield return int; pragma Import (C, sched_yield, "sched_yield"); --------------------------- -- P1003.1c - Section 16 -- --------------------------- function pthread_attr_init (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_init, "pthread_attr_init"); function pthread_attr_destroy (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); function pthread_attr_setdetachstate (attr : access pthread_attr_t; detachstate : int) return int; pragma Import (C, pthread_attr_setdetachstate); function pthread_attr_setstacksize (attr : access pthread_attr_t; stacksize : size_t) return int; pragma Import (C, pthread_attr_setstacksize); function pthread_create (thread : access pthread_t; attributes : access pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int; pragma Import (C, pthread_create, "pthread_create"); procedure pthread_exit (status : System.Address); pragma Import (C, pthread_exit, "pthread_exit"); function pthread_self return pthread_t; pragma Import (C, pthread_self, "pthread_self"); -------------------------- -- POSIX.1c Section 17 -- -------------------------- function pthread_setspecific (key : pthread_key_t; value : System.Address) return int; pragma Import (C, pthread_setspecific, "pthread_setspecific"); function pthread_getspecific (key : pthread_key_t) return System.Address; pragma Import (C, pthread_getspecific, "pthread_getspecific"); type destructor_pointer is access procedure (arg : System.Address); function pthread_key_create (key : access pthread_key_t; destructor : destructor_pointer) return int; pragma Import (C, pthread_key_create, "pthread_key_create"); procedure pthread_init; -- This is a dummy procedure to share some GNULLI files private type sigbit_array is array (1 .. 4) of unsigned; type sigset_t is record sa_sigbits : sigbit_array; end record; pragma Convention (C_Pass_By_Copy, sigset_t); type pid_t is new unsigned; type time_t is new long; type timespec is record tv_sec : time_t; tv_nsec : long; end record; pragma Convention (C, timespec); type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; type struct_timeval is record tv_sec : long; tv_usec : long; end record; pragma Convention (C, struct_timeval); type pthread_attr_t is record pt_attr_status : int; pt_attr_stacksize : size_t; pt_attr_stackaddr : System.Address; pt_attr_detachstate : int; pt_attr_contentionscope : int; pt_attr_inheritsched : int; pt_attr_schedpolicy : int; pt_attr_sched_param : struct_sched_param; pt_attr_tlflags : int; end record; pragma Convention (C, pthread_attr_t); type pthread_condattr_t is record pt_condattr_status : int; pt_condattr_pshared : int; end record; pragma Convention (C, pthread_condattr_t); type pthread_mutexattr_t is record pt_mutexattr_status : int; pt_mutexattr_pshared : int; pt_mutexattr_type : int; end record; pragma Convention (C, pthread_mutexattr_t); type thread_t is new long; type pthread_t is new thread_t; type thrq_elt_t; type thrq_elt_t_ptr is access all thrq_elt_t; type thrq_elt_t is record thrq_next : thrq_elt_t_ptr; thrq_prev : thrq_elt_t_ptr; end record; pragma Convention (C, thrq_elt_t); type lwp_mutex_t is record wanted : char; lock : unsigned_char; end record; pragma Convention (C, lwp_mutex_t); pragma Volatile (lwp_mutex_t); type mutex_t is record m_lmutex : lwp_mutex_t; m_sync_lock : lwp_mutex_t; m_type : int; m_sleepq : thrq_elt_t; filler1 : int; filler2 : int; end record; pragma Convention (C, mutex_t); pragma Volatile (mutex_t); type pthread_mutex_t is record pt_mutex_mutex : mutex_t; pt_mutex_pid : pid_t; pt_mutex_owner : thread_t; pt_mutex_depth : int; pt_mutex_attr : pthread_mutexattr_t; end record; pragma Convention (C, pthread_mutex_t); type lwp_cond_t is record wanted : char; end record; pragma Convention (C, lwp_cond_t); pragma Volatile (lwp_cond_t); type cond_t is record c_lcond : lwp_cond_t; c_sync_lock : lwp_mutex_t; c_type : int; c_syncq : thrq_elt_t; end record; pragma Convention (C, cond_t); pragma Volatile (cond_t); type pthread_cond_t is record pt_cond_cond : cond_t; pt_cond_attr : pthread_condattr_t; end record; pragma Convention (C, pthread_cond_t); type pthread_key_t is new unsigned; end System.OS_Interface;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . F A T _ I E E E _ L O N G _ F L O A T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains an instantiation of the floating-point attribute -- runtime routines for IEEE long float. This is used on VMS targest where -- we can't just use Long_Float, since this may have been mapped to Vax_Float -- using a Float_Representation configuration pragma. with System.Fat_Gen; package System.Fat_IEEE_Long_Float is pragma Pure; type Fat_IEEE_Long is digits 15; pragma Float_Representation (IEEE_Float, Fat_IEEE_Long); -- Note the only entity from this package that is acccessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. package Attr_IEEE_Long is new System.Fat_Gen (Fat_IEEE_Long); end System.Fat_IEEE_Long_Float;
----------------------------------------------------------------------- -- servlet-filters.dump -- Filter to dump the request information -- Copyright (C) 2010, 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; with Servlet.Requests.Tools; -- The <b>Servlet.Filters.Dump</b> package provides a debugging filter which -- can be activated in the request flow to dump the request content into -- some log file before processing the request. package body Servlet.Filters.Dump is -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Servlet.Filters.Dump"); -- ------------------------------ -- The Do_Filter method of the Filter is called by the container each time -- a request/response pair is passed through the chain due to a client request -- for a resource at the end of the chain. The Filter_Chain passed in to this -- method allows the Filter to pass on the request and response to the next -- entity in the chain. -- -- A typical implementation of this method would follow the following pattern: -- 1. Examine the request -- 2. Optionally wrap the request object with a custom implementation to -- filter content or headers for input filtering -- 3. Optionally wrap the response object with a custom implementation to -- filter content or headers for output filtering -- 4. Either invoke the next entity in the chain using the FilterChain -- object (chain.Do_Filter()), -- or, not pass on the request/response pair to the next entity in the -- filter chain to block the request processing -- 5. Directly set headers on the response after invocation of the next -- entity in the filter chain. -- ------------------------------ procedure Do_Filter (F : in Dump_Filter; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class; Chain : in out Servlet.Core.Filter_Chain) is pragma Unreferenced (F); Info : constant String := Servlet.Requests.Tools.To_String (Req => Request, Html => False, Print_Headers => True, Print_Attributes => True); begin Log.Info ("Request {0}", Info); Servlet.Core.Do_Filter (Chain => Chain, Request => Request, Response => Response); end Do_Filter; end Servlet.Filters.Dump;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body Message_Buffers is ------------- -- Content -- ------------- function Content (This : Message) return String is begin return This.Content (1 .. This.Length); end Content; ---------------- -- Content_At -- ---------------- function Content_At (This : Message; Index : Positive) return Character is begin return This.Content (Index); end Content_At; ------------ -- Length -- ------------ function Length (This : Message) return Natural is begin return This.Length; end Length; ----------- -- Clear -- ----------- procedure Clear (This : in out Message) is begin This.Length := 0; end Clear; ------------ -- Append -- ------------ procedure Append (This : in out Message; Value : Character) is begin This.Length := This.Length + 1; This.Content (This.Length) := Value; end Append; --------- -- Set -- --------- procedure Set (This : in out Message; To : String) is begin This.Content (1 .. To'Length) := To; This.Length := To'Length; end Set; --------- -- Set -- --------- procedure Set (This : in out Message; To : Character) is begin This.Content (1) := To; This.Length := 1; end Set; -------------------- -- Set_Terminator -- -------------------- procedure Set_Terminator (This : in out Message; To : Character) is begin This.Terminator := To; end Set_Terminator; ---------------- -- Terminator -- ---------------- function Terminator (This : Message) return Character is begin return This.Terminator; end Terminator; --------------------------------- -- Await_Transmission_Complete -- --------------------------------- procedure Await_Transmission_Complete (This : in out Message) is begin Suspend_Until_True (This.Transmission_Complete); end Await_Transmission_Complete; ------------------------------ -- Await_Reception_Complete -- ------------------------------ procedure Await_Reception_Complete (This : in out Message) is begin Suspend_Until_True (This.Reception_Complete); end Await_Reception_Complete; ---------------------------------- -- Signal_Transmission_Complete -- ---------------------------------- procedure Signal_Transmission_Complete (This : in out Message) is begin Set_True (This.Transmission_Complete); end Signal_Transmission_Complete; ------------------------------- -- Signal_Reception_Complete -- ------------------------------- procedure Signal_Reception_Complete (This : in out Message) is begin Set_True (This.Reception_Complete); end Signal_Reception_Complete; ---------------- -- Note_Error -- ---------------- procedure Note_Error (This : in out Message; Condition : Error_Conditions) is begin This.Error_Status := This.Error_Status or Condition; end Note_Error; --------------------- -- Errors_Detected -- --------------------- function Errors_Detected (This : Message) return Error_Conditions is begin return This.Error_Status; end Errors_Detected; ------------------ -- Clear_Errors -- ------------------ procedure Clear_Errors (This : in out Message) is begin This.Error_Status := No_Error_Detected; end Clear_Errors; --------------- -- Has_Error -- --------------- function Has_Error (This : Message; Condition : Error_Conditions) return Boolean is begin return (This.Error_Status and Condition) /= 0; end Has_Error; end Message_Buffers;
package Real_Typedecl is type FloatT is digits 10; IndianaPi : FloatT := 3.2; end Real_Typedecl;
-- C34014T.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A DERIVED OPERATOR IS VISIBLE AND FURTHER DERIVABLE -- UNDER APPROPRIATE CIRCUMSTANCES. -- CHECK WHEN THE DERIVED OPERATOR IS IMPLICITLY DECLARED IN THE -- VISIBLE PART OF A PACKAGE AND NO HOMOGRAPHIC OPERATOR IS LATER -- DECLARED EXPLICITLY. -- HISTORY: -- JRK 09/22/87 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C34014T IS PACKAGE P IS TYPE T IS RANGE -100 .. 100; FUNCTION "+" (X : T) RETURN T; END P; USE P; PACKAGE BODY P IS FUNCTION "+" (X : T) RETURN T IS BEGIN RETURN X + T (IDENT_INT (1)); END "+"; END P; BEGIN TEST ("C34014T", "CHECK THAT A DERIVED OPERATOR IS VISIBLE " & "AND FURTHER DERIVABLE UNDER APPROPRIATE " & "CIRCUMSTANCES. CHECK WHEN THE DERIVED " & "OPERATOR IS IMPLICITLY DECLARED IN THE " & "VISIBLE PART OF A PACKAGE AND NO HOMOGRAPHIC " & "OPERATOR IS LATER DECLARED EXPLICITLY"); ----------------------------------------------------------------- COMMENT ("NO NEW OPERATOR DECLARED EXPLICITLY"); DECLARE PACKAGE Q IS TYPE QT IS NEW T; X : QT := +0; PRIVATE TYPE QS IS NEW QT; Z : QS := +0; END Q; USE Q; PACKAGE BODY Q IS BEGIN IF X /= 1 THEN FAILED ("OLD OPERATOR NOT VISIBLE - 1"); END IF; IF Z /= 1 THEN FAILED ("OLD OPERATOR NOT DERIVED - 1"); END IF; END Q; PACKAGE R IS Y : QT := +0; TYPE RT IS NEW QT; Z : RT := +0; END R; USE R; BEGIN IF Y /= 1 THEN FAILED ("OLD OPERATOR NOT VISIBLE - 2"); END IF; IF Z /= 1 THEN FAILED ("OLD OPERATOR NOT DERIVED - 2"); END IF; END; ----------------------------------------------------------------- RESULT; END C34014T;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- I N T E R F A C E S . C . P O I N T E R S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-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. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces.C.Strings; use Interfaces.C.Strings; with System; use System; with Ada.Unchecked_Conversion; package body Interfaces.C.Pointers is type Addr is mod 2 ** System.Parameters.ptr_bits; function To_Pointer is new Ada.Unchecked_Conversion (Addr, Pointer); function To_Addr is new Ada.Unchecked_Conversion (Pointer, Addr); function To_Addr is new Ada.Unchecked_Conversion (ptrdiff_t, Addr); function To_Ptrdiff is new Ada.Unchecked_Conversion (Addr, ptrdiff_t); Elmt_Size : constant ptrdiff_t := (Element_Array'Component_Size + Storage_Unit - 1) / Storage_Unit; subtype Index_Base is Index'Base; --------- -- "+" -- --------- function "+" (Left : Pointer; Right : ptrdiff_t) return Pointer is begin if Left = null then raise Pointer_Error; end if; return To_Pointer (To_Addr (Left) + To_Addr (Elmt_Size * Right)); end "+"; function "+" (Left : ptrdiff_t; Right : Pointer) return Pointer is begin if Right = null then raise Pointer_Error; end if; return To_Pointer (To_Addr (Elmt_Size * Left) + To_Addr (Right)); end "+"; --------- -- "-" -- --------- function "-" (Left : Pointer; Right : ptrdiff_t) return Pointer is begin if Left = null then raise Pointer_Error; end if; return To_Pointer (To_Addr (Left) - To_Addr (Right * Elmt_Size)); end "-"; function "-" (Left : Pointer; Right : Pointer) return ptrdiff_t is begin if Left = null or else Right = null then raise Pointer_Error; end if; return To_Ptrdiff (To_Addr (Left) - To_Addr (Right)) / Elmt_Size; end "-"; ---------------- -- Copy_Array -- ---------------- procedure Copy_Array (Source : Pointer; Target : Pointer; Length : ptrdiff_t) is T : Pointer; S : Pointer; begin if Source = null or else Target = null then raise Dereference_Error; -- Forward copy elsif To_Addr (Target) <= To_Addr (Source) then T := Target; S := Source; for J in 1 .. Length loop T.all := S.all; Increment (T); Increment (S); end loop; -- Backward copy else T := Target + Length; S := Source + Length; for J in 1 .. Length loop Decrement (T); Decrement (S); T.all := S.all; end loop; end if; end Copy_Array; --------------------------- -- Copy_Terminated_Array -- --------------------------- procedure Copy_Terminated_Array (Source : Pointer; Target : Pointer; Limit : ptrdiff_t := ptrdiff_t'Last; Terminator : Element := Default_Terminator) is L : ptrdiff_t; S : Pointer := Source; begin if Source = null or Target = null then raise Dereference_Error; end if; -- Compute array limited length (including the terminator) L := 0; while L < Limit loop L := L + 1; exit when S.all = Terminator; Increment (S); end loop; Copy_Array (Source, Target, L); end Copy_Terminated_Array; --------------- -- Decrement -- --------------- procedure Decrement (Ref : in out Pointer) is begin Ref := Ref - 1; end Decrement; --------------- -- Increment -- --------------- procedure Increment (Ref : in out Pointer) is begin Ref := Ref + 1; end Increment; ----------- -- Value -- ----------- function Value (Ref : Pointer; Terminator : Element := Default_Terminator) return Element_Array is P : Pointer; L : constant Index_Base := Index'First; H : Index_Base; begin if Ref = null then raise Dereference_Error; else H := L; P := Ref; loop exit when P.all = Terminator; H := Index_Base'Succ (H); Increment (P); end loop; declare subtype A is Element_Array (L .. H); type PA is access A; for PA'Size use System.Parameters.ptr_bits; function To_PA is new Ada.Unchecked_Conversion (Pointer, PA); begin return To_PA (Ref).all; end; end if; end Value; function Value (Ref : Pointer; Length : ptrdiff_t) return Element_Array is L : Index_Base; H : Index_Base; begin if Ref = null then raise Dereference_Error; -- For length zero, we need to return a null slice, but we can't make -- the bounds of this slice Index'First, since this could cause a -- Constraint_Error if Index'First = Index'Base'First. elsif Length <= 0 then declare pragma Warnings (Off); -- kill warnings since X not assigned X : Element_Array (Index'Succ (Index'First) .. Index'First); pragma Warnings (On); begin return X; end; -- Normal case (length non-zero) else L := Index'First; H := Index'Val (Index'Pos (Index'First) + Length - 1); declare subtype A is Element_Array (L .. H); type PA is access A; for PA'Size use System.Parameters.ptr_bits; function To_PA is new Ada.Unchecked_Conversion (Pointer, PA); begin return To_PA (Ref).all; end; end if; end Value; -------------------- -- Virtual_Length -- -------------------- function Virtual_Length (Ref : Pointer; Terminator : Element := Default_Terminator) return ptrdiff_t is P : Pointer; C : ptrdiff_t; begin if Ref = null then raise Dereference_Error; else C := 0; P := Ref; while P.all /= Terminator loop C := C + 1; Increment (P); end loop; return C; end if; end Virtual_Length; end Interfaces.C.Pointers;
----------------------------------------------------------------------- -- gen-commands-distrib -- Distrib command for dynamo -- Copyright (C) 2012, 2013, 2014, 2017, 2018, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Text_IO; with GNAT.Regpat; with Util.Strings; package body Gen.Commands.Distrib is use Ada.Strings.Unbounded; procedure Increment_Build (Generator : in out Gen.Generator.Handler); procedure Increment_Build (Generator : in out Gen.Generator.Handler) is Pattern : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (".*([0-9]+).*"); Matches : GNAT.Regpat.Match_Array (0 .. 1); Build : constant String := Generator.Get_Project_Property ("build", "1"); Number : Natural := 0; Result : Unbounded_String; begin if GNAT.Regpat.Match (Pattern, Build) then GNAT.Regpat.Match (Pattern, Build, Matches); Number := Natural'Value (Build (Matches (1).First .. Matches (1).Last)); Number := Number + 1; if Matches (1).First > Build'First then Append (Result, Build (Build'First .. Matches (1).First - 1)); end if; Append (Result, Util.Strings.Image (Number)); if Matches (1).Last < Build'Last then Append (Result, Build (Matches (1).Last + 1 .. Build'Last)); end if; Generator.Set_Project_Property ("build", To_String (Result)); end if; Generator.Save_Project; end Increment_Build; -- ------------------------------ -- Execute the command with the arguments. -- ------------------------------ overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd, Name); begin if Args.Get_Count = 0 or Args.Get_Count > 2 then Generator.Error ("Missing target directory"); return; end if; Generator.Read_Project ("dynamo.xml", True); Increment_Build (Generator); -- Setup the target directory where the distribution is created. Generator.Set_Result_Directory (Args.Get_Argument (1)); -- Read the package description. if Args.Get_Count = 2 then Gen.Generator.Read_Package (Generator, Args.Get_Argument (2)); else Gen.Generator.Read_Package (Generator, "package.xml"); end if; -- Run the generation. Gen.Generator.Prepare (Generator); Gen.Generator.Generate_All (Generator); Gen.Generator.Finish (Generator); end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd, Name, Generator); use Ada.Text_IO; begin Put_Line ("dist: Build the distribution files to prepare the server installation"); Put_Line ("Usage: dist target-dir [package.xml]"); New_Line; Put_Line (" The dist command reads the XML package description to build the" & " distribution tree."); Put_Line (" This command is intended to be used after the project is built. It prepares"); Put_Line (" the files for their installation on the target server in a " & "production environment."); Put_Line (" The package.xml describes what files are necessary on the server."); Put_Line (" It allows to make transformations such as compressing Javascript, CSS and " & "images"); end Help; end Gen.Commands.Distrib;