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 |
|---|---|---|---|---|
mac/get_foregroundterminal_proclist.scpt | albertz/foreground_app_info | 2 | 3524 | <gh_stars>1-10
tell application "Terminal"
do shell script "fuser " & (tty of front tab of front window)
end tell
|
src/Finite-subset/Listed.agda | nad/equality | 3 | 3737 | <filename>src/Finite-subset/Listed.agda
------------------------------------------------------------------------
-- Listed finite subsets
------------------------------------------------------------------------
-- Based on Frumin, Geuvers, Gondelman and <NAME>'s "Finite
-- Sets in Homotopy Type Theory".
{-# OPTIONS --cubical --safe #-}
import Equality.Path as P
module Finite-subset.Listed
{e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where
open P.Derived-definitions-and-properties eq hiding (elim)
open import Dec
open import Logical-equivalence using (_⇔_)
open import Prelude as P hiding ([_,_]; swap)
open import Bag-equivalence equality-with-J as BE using (_∼[_]_; set)
open import Bijection equality-with-J as Bijection using (_↔_)
open import Equality.Decision-procedures equality-with-J
open import Equality.Path.Isomorphisms eq
open import Equality.Path.Isomorphisms.Univalence eq
open import Equivalence equality-with-J as Eq using (_≃_)
open import Erased.Cubical eq as EC
using (Erased; [_]; Dec-Erased; Dec→Dec-Erased)
open import Function-universe equality-with-J as F hiding (id; _∘_)
open import H-level equality-with-J
open import H-level.Closure equality-with-J
open import H-level.Truncation.Propositional eq as Trunc
using (∥_∥; ∣_∣; _∥⊎∥_)
open import Injection equality-with-J using (Injective)
import List equality-with-J as L
import Maybe equality-with-J as Maybe
open import Monad equality-with-J as M using (Raw-monad; Monad; _=<<_)
open import Nat equality-with-J as Nat using (_<_)
open import Quotient eq as Q using (_/_)
open import Surjection equality-with-J using (_↠_)
import Univalence-axiom equality-with-J as Univ
private
variable
a b : Level
A B : Type a
H ms p q x x₁ x₂ xs y y₁ y₂ ys z _≟_ : A
P : A → Type p
f g : (x : A) → P x
m n : ℕ
------------------------------------------------------------------------
-- Listed finite subsets
-- Listed finite subsets of a given type.
infixr 5 _∷_
data Finite-subset-of (A : Type a) : Type a where
[] : Finite-subset-of A
_∷_ : A → Finite-subset-of A → Finite-subset-of A
dropᴾ : x ∷ x ∷ y P.≡ x ∷ y
swapᴾ : x ∷ y ∷ z P.≡ y ∷ x ∷ z
is-setᴾ : P.Is-set (Finite-subset-of A)
-- Variants of some of the constructors.
drop :
{x : A} {y : Finite-subset-of A} →
x ∷ x ∷ y ≡ x ∷ y
drop = _↔_.from ≡↔≡ dropᴾ
swap :
{x y : A} {z : Finite-subset-of A} →
x ∷ y ∷ z ≡ y ∷ x ∷ z
swap = _↔_.from ≡↔≡ swapᴾ
is-set : Is-set (Finite-subset-of A)
is-set =
_↔_.from (H-level↔H-level 2) Finite-subset-of.is-setᴾ
------------------------------------------------------------------------
-- Eliminators
-- A dependent eliminator, expressed using paths.
record Elimᴾ {A : Type a} (P : Finite-subset-of A → Type p) :
Type (a ⊔ p) where
no-eta-equality
field
[]ʳ : P []
∷ʳ : ∀ x → P y → P (x ∷ y)
dropʳ : ∀ x (p : P y) →
P.[ (λ i → P (dropᴾ {x = x} {y = y} i)) ]
∷ʳ x (∷ʳ x p) ≡ ∷ʳ x p
swapʳ : ∀ x y (p : P z) →
P.[ (λ i → P (swapᴾ {x = x} {y = y} {z = z} i)) ]
∷ʳ x (∷ʳ y p) ≡ ∷ʳ y (∷ʳ x p)
is-setʳ : ∀ x → P.Is-set (P x)
open Elimᴾ public
elimᴾ : Elimᴾ P → (x : Finite-subset-of A) → P x
elimᴾ {A = A} {P = P} e = helper
where
module E = Elimᴾ e
helper : (x : Finite-subset-of A) → P x
helper [] = E.[]ʳ
helper (x ∷ y) = E.∷ʳ x (helper y)
helper (dropᴾ {x = x} {y = y} i) =
E.dropʳ x (helper y) i
helper (swapᴾ {x = x} {y = y} {z = z} i) =
E.swapʳ x y (helper z) i
helper (is-setᴾ x y i j) =
P.heterogeneous-UIP
E.is-setʳ (Finite-subset-of.is-setᴾ x y)
(λ i → helper (x i)) (λ i → helper (y i)) i j
-- A non-dependent eliminator, expressed using paths.
record Recᴾ (A : Type a) (B : Type b) : Type (a ⊔ b) where
no-eta-equality
field
[]ʳ : B
∷ʳ : A → Finite-subset-of A → B → B
dropʳ : ∀ x y p →
∷ʳ x (x ∷ y) (∷ʳ x y p) P.≡ ∷ʳ x y p
swapʳ : ∀ x y z p →
∷ʳ x (y ∷ z) (∷ʳ y z p) P.≡ ∷ʳ y (x ∷ z) (∷ʳ x z p)
is-setʳ : P.Is-set B
open Recᴾ public
recᴾ : Recᴾ A B → Finite-subset-of A → B
recᴾ r = elimᴾ e
where
module R = Recᴾ r
e : Elimᴾ _
e .[]ʳ = R.[]ʳ
e .∷ʳ {y = y} x = R.∷ʳ x y
e .dropʳ {y = y} x = R.dropʳ x y
e .swapʳ {z = z} x y = R.swapʳ x y z
e .is-setʳ _ = R.is-setʳ
-- A dependent eliminator, expressed using equality.
record Elim {A : Type a} (P : Finite-subset-of A → Type p) :
Type (a ⊔ p) where
no-eta-equality
field
[]ʳ : P []
∷ʳ : ∀ x → P y → P (x ∷ y)
dropʳ : ∀ x (p : P y) →
subst P (drop {x = x} {y = y}) (∷ʳ x (∷ʳ x p)) ≡ ∷ʳ x p
swapʳ : ∀ x y (p : P z) →
subst P (swap {x = x} {y = y} {z = z}) (∷ʳ x (∷ʳ y p)) ≡
∷ʳ y (∷ʳ x p)
is-setʳ : ∀ x → Is-set (P x)
open Elim public
elim : Elim P → (x : Finite-subset-of A) → P x
elim e = elimᴾ e′
where
module E = Elim e
e′ : Elimᴾ _
e′ .[]ʳ = E.[]ʳ
e′ .∷ʳ = E.∷ʳ
e′ .dropʳ x p = subst≡→[]≡ (E.dropʳ x p)
e′ .swapʳ x y p = subst≡→[]≡ (E.swapʳ x y p)
e′ .is-setʳ x = _↔_.to (H-level↔H-level 2) (E.is-setʳ x)
-- A non-dependent eliminator, expressed using equality.
record Rec (A : Type a) (B : Type b) : Type (a ⊔ b) where
no-eta-equality
field
[]ʳ : B
∷ʳ : A → Finite-subset-of A → B → B
dropʳ : ∀ x y p →
∷ʳ x (x ∷ y) (∷ʳ x y p) ≡ ∷ʳ x y p
swapʳ : ∀ x y z p →
∷ʳ x (y ∷ z) (∷ʳ y z p) ≡ ∷ʳ y (x ∷ z) (∷ʳ x z p)
is-setʳ : Is-set B
open Rec public
rec : Rec A B → Finite-subset-of A → B
rec r = recᴾ r′
where
module R = Rec r
r′ : Recᴾ _ _
r′ .[]ʳ = R.[]ʳ
r′ .∷ʳ = R.∷ʳ
r′ .dropʳ x y p = _↔_.to ≡↔≡ (R.dropʳ x y p)
r′ .swapʳ x y z p = _↔_.to ≡↔≡ (R.swapʳ x y z p)
r′ .is-setʳ = _↔_.to (H-level↔H-level 2) R.is-setʳ
-- A dependent eliminator for propositions.
record Elim-prop
{A : Type a} (P : Finite-subset-of A → Type p) :
Type (a ⊔ p) where
no-eta-equality
field
[]ʳ : P []
∷ʳ : ∀ x → P y → P (x ∷ y)
is-propositionʳ : ∀ x → Is-proposition (P x)
open Elim-prop public
elim-prop : Elim-prop P → (x : Finite-subset-of A) → P x
elim-prop e = elim e′
where
module E = Elim-prop e
e′ : Elim _
e′ .[]ʳ = E.[]ʳ
e′ .∷ʳ = E.∷ʳ
e′ .dropʳ _ _ = E.is-propositionʳ _ _ _
e′ .swapʳ _ _ _ = E.is-propositionʳ _ _ _
e′ .is-setʳ _ = mono₁ 1 (E.is-propositionʳ _)
-- A non-dependent eliminator for propositions.
record Rec-prop (A : Type a) (B : Type b) : Type (a ⊔ b) where
no-eta-equality
field
[]ʳ : B
∷ʳ : A → Finite-subset-of A → B → B
is-propositionʳ : Is-proposition B
open Rec-prop public
rec-prop : Rec-prop A B → Finite-subset-of A → B
rec-prop r = elim-prop e
where
module R = Rec-prop r
e : Elim-prop _
e .[]ʳ = R.[]ʳ
e .∷ʳ {y = y} x = R.∷ʳ x y
e .is-propositionʳ _ = R.is-propositionʳ
------------------------------------------------------------------------
-- Some operations
-- Singleton subsets.
singleton : A → Finite-subset-of A
singleton x = x ∷ []
-- The union of two finite subsets.
infixr 5 _∪_
_∪_ :
Finite-subset-of A → Finite-subset-of A →
Finite-subset-of A
[] ∪ y = y
(x ∷ y) ∪ z = x ∷ (y ∪ z)
dropᴾ {x = x} {y = y} i ∪ z =
dropᴾ {x = x} {y = y ∪ z} i
swapᴾ {x = x} {y = y} {z = z} i ∪ u =
swapᴾ {x = x} {y = y} {z = z ∪ u} i
is-setᴾ x y i j ∪ z =
is-setᴾ (λ i → x i ∪ z) (λ i → y i ∪ z) i j
-- [] is a right identity for _∪_.
∪[] :
(x : Finite-subset-of A) →
x ∪ [] ≡ x
∪[] = elim-prop e
where
e : Elim-prop _
e .is-propositionʳ _ = is-set
e .[]ʳ = refl _
e .∷ʳ {y = y} x hyp =
x ∷ y ∪ [] ≡⟨ cong (x ∷_) hyp ⟩∎
x ∷ y ∎
-- A lemma relating _∪_ and _∷_.
∪∷ :
(x : Finite-subset-of A) →
x ∪ (y ∷ z) ≡ y ∷ x ∪ z
∪∷ {y = y} {z = z} = elim-prop e
where
e : Elim-prop _
e .is-propositionʳ _ = is-set
e .[]ʳ = refl _
e .∷ʳ {y = u} x hyp =
(x ∷ u) ∪ (y ∷ z) ≡⟨⟩
x ∷ u ∪ (y ∷ z) ≡⟨ cong (x ∷_) hyp ⟩
x ∷ y ∷ u ∪ z ≡⟨ swap ⟩
y ∷ x ∷ u ∪ z ≡⟨⟩
y ∷ (x ∷ u) ∪ z ∎
-- Union is associative.
assoc :
(x : Finite-subset-of A) →
x ∪ (y ∪ z) ≡ (x ∪ y) ∪ z
assoc {y = y} {z = z} = elim-prop e
where
e : Elim-prop _
e .is-propositionʳ _ = is-set
e .[]ʳ = refl _
e .∷ʳ {y = u} x hyp =
x ∷ u ∪ (y ∪ z) ≡⟨ cong (x ∷_) hyp ⟩∎
x ∷ (u ∪ y) ∪ z ∎
-- Union is commutative.
comm :
(x : Finite-subset-of A) →
x ∪ y ≡ y ∪ x
comm {y = y} = elim-prop e
where
e : Elim-prop _
e .is-propositionʳ _ = is-set
e .[]ʳ =
[] ∪ y ≡⟨⟩
y ≡⟨ sym (∪[] y) ⟩∎
y ∪ [] ∎
e .∷ʳ {y = z} x hyp =
x ∷ z ∪ y ≡⟨ cong (x ∷_) hyp ⟩
x ∷ y ∪ z ≡⟨ sym (∪∷ y) ⟩∎
y ∪ (x ∷ z) ∎
-- Union is idempotent.
idem : (x : Finite-subset-of A) → x ∪ x ≡ x
idem = elim-prop e
where
e : Elim-prop _
e .[]ʳ =
[] ∪ [] ≡⟨⟩
[] ∎
e .∷ʳ {y = y} x hyp =
(x ∷ y) ∪ (x ∷ y) ≡⟨⟩
x ∷ y ∪ x ∷ y ≡⟨ cong (_ ∷_) (∪∷ y) ⟩
x ∷ x ∷ y ∪ y ≡⟨ drop ⟩
x ∷ y ∪ y ≡⟨ cong (_ ∷_) hyp ⟩∎
x ∷ y ∎
e .is-propositionʳ = λ _ → is-set
-- Union distributes from the left and right over union.
∪-distrib-left : ∀ x → x ∪ (y ∪ z) ≡ (x ∪ y) ∪ (x ∪ z)
∪-distrib-left {y = y} {z = z} x =
x ∪ (y ∪ z) ≡⟨ cong (_∪ _) $ sym (idem x) ⟩
(x ∪ x) ∪ (y ∪ z) ≡⟨ sym $ assoc x ⟩
x ∪ (x ∪ (y ∪ z)) ≡⟨ cong (x ∪_) $ assoc x ⟩
x ∪ ((x ∪ y) ∪ z) ≡⟨ cong ((x ∪_) ∘ (_∪ _)) $ comm x ⟩
x ∪ ((y ∪ x) ∪ z) ≡⟨ cong (x ∪_) $ sym $ assoc y ⟩
x ∪ (y ∪ (x ∪ z)) ≡⟨ assoc x ⟩∎
(x ∪ y) ∪ (x ∪ z) ∎
∪-distrib-right : ∀ x → (x ∪ y) ∪ z ≡ (x ∪ z) ∪ (y ∪ z)
∪-distrib-right {y = y} {z = z} x =
(x ∪ y) ∪ z ≡⟨ comm (x ∪ _) ⟩
z ∪ (x ∪ y) ≡⟨ ∪-distrib-left z ⟩
(z ∪ x) ∪ (z ∪ y) ≡⟨ cong₂ _∪_ (comm z) (comm z) ⟩∎
(x ∪ z) ∪ (y ∪ z) ∎
-- A map function.
map : (A → B) → Finite-subset-of A → Finite-subset-of B
map f = recᴾ r
where
r : Recᴾ _ _
r .[]ʳ = []
r .∷ʳ x _ y = f x ∷ y
r .dropʳ _ _ _ = dropᴾ
r .swapʳ _ _ _ _ = swapᴾ
r .is-setʳ = is-setᴾ
-- Join.
join : Finite-subset-of (Finite-subset-of A) → Finite-subset-of A
join = rec r
where
r : Rec _ _
r .[]ʳ = []
r .∷ʳ x _ = x ∪_
r .dropʳ x y z = x ∪ x ∪ z ≡⟨ assoc x ⟩
(x ∪ x) ∪ z ≡⟨ cong (_∪ _) (idem x) ⟩∎
x ∪ z ∎
r .swapʳ x y z u = x ∪ y ∪ u ≡⟨ assoc x ⟩
(x ∪ y) ∪ u ≡⟨ cong (_∪ _) (comm x) ⟩
(y ∪ x) ∪ u ≡⟨ sym (assoc y) ⟩∎
y ∪ x ∪ u ∎
r .is-setʳ = is-set
-- A universe-polymorphic variant of bind.
infixl 5 _>>=′_
_>>=′_ :
Finite-subset-of A → (A → Finite-subset-of B) → Finite-subset-of B
x >>=′ f = join (map f x)
-- Bind distributes from the right over union.
>>=-right-distributive :
∀ x → (x ∪ y) >>=′ f ≡ (x >>=′ f) ∪ (y >>=′ f)
>>=-right-distributive {y = y} {f = f} = elim-prop e
where
e : Elim-prop _
e .[]ʳ = refl _
e .is-propositionʳ _ = is-set
e .∷ʳ {y = z} x hyp =
((x ∷ z) ∪ y) >>=′ f ≡⟨⟩
f x ∪ ((z ∪ y) >>=′ f) ≡⟨ cong (f x ∪_) hyp ⟩
f x ∪ ((z >>=′ f) ∪ (y >>=′ f)) ≡⟨ assoc (f x) ⟩
(f x ∪ (z >>=′ f)) ∪ (y >>=′ f) ≡⟨⟩
((x ∷ z) >>=′ f) ∪ (y >>=′ f) ∎
-- Bind distributes from the left over union.
>>=-left-distributive :
∀ x → (x >>=′ λ x → f x ∪ g x) ≡ (x >>=′ f) ∪ (x >>=′ g)
>>=-left-distributive {f = f} {g = g} = elim-prop e
where
e : Elim-prop _
e .[]ʳ = refl _
e .is-propositionʳ _ = is-set
e .∷ʳ {y = y} x hyp =
(x ∷ y) >>=′ (λ x → f x ∪ g x) ≡⟨⟩
(f x ∪ g x) ∪ (y >>=′ λ x → f x ∪ g x) ≡⟨ cong ((f x ∪ g x) ∪_) hyp ⟩
(f x ∪ g x) ∪ ((y >>=′ f) ∪ (y >>=′ g)) ≡⟨ sym (assoc (f x)) ⟩
f x ∪ (g x ∪ ((y >>=′ f) ∪ (y >>=′ g))) ≡⟨ cong (f x ∪_) (assoc (g x)) ⟩
f x ∪ ((g x ∪ (y >>=′ f)) ∪ (y >>=′ g)) ≡⟨ cong ((f x ∪_) ∘ (_∪ (y >>=′ g))) (comm (g x)) ⟩
f x ∪ (((y >>=′ f) ∪ g x) ∪ (y >>=′ g)) ≡⟨ cong (f x ∪_) (sym (assoc (y >>=′ f))) ⟩
f x ∪ ((y >>=′ f) ∪ (g x ∪ (y >>=′ g))) ≡⟨ assoc (f x) ⟩
(f x ∪ (y >>=′ f)) ∪ (g x ∪ (y >>=′ g)) ≡⟨⟩
((x ∷ y) >>=′ f) ∪ ((x ∷ y) >>=′ g) ∎
-- Monad laws.
singleton->>= :
(f : A → Finite-subset-of B) →
singleton x >>=′ f ≡ f x
singleton->>= {x = x} f =
f x ∪ [] ≡⟨ ∪[] _ ⟩∎
f x ∎
>>=-singleton : x >>=′ singleton ≡ x
>>=-singleton = elim-prop e _
where
e : Elim-prop (λ x → x >>=′ singleton ≡ x)
e .[]ʳ = refl _
e .is-propositionʳ _ = is-set
e .∷ʳ {y = y} x hyp =
x ∷ (y >>=′ singleton) ≡⟨ cong (_ ∷_) hyp ⟩∎
x ∷ y ∎
>>=-assoc : ∀ x → x >>=′ (λ x → f x >>=′ g) ≡ x >>=′ f >>=′ g
>>=-assoc {f = f} {g = g} = elim-prop e
where
e : Elim-prop _
e .[]ʳ = refl _
e .is-propositionʳ _ = is-set
e .∷ʳ {y = y} x hyp =
(x ∷ y) >>=′ (λ x → f x >>=′ g) ≡⟨⟩
(f x >>=′ g) ∪ (y >>=′ λ x → f x >>=′ g) ≡⟨ cong ((f x >>=′ g) ∪_) hyp ⟩
(f x >>=′ g) ∪ (y >>=′ f >>=′ g) ≡⟨ sym (>>=-right-distributive (f x)) ⟩
(f x ∪ (y >>=′ f)) >>=′ g ≡⟨⟩
(x ∷ y) >>=′ f >>=′ g ∎
-- A monad instance.
instance
raw-monad : Raw-monad {d = a} Finite-subset-of
raw-monad .M.return = singleton
raw-monad .M._>>=_ = _>>=′_
monad : Monad {d = a} Finite-subset-of
monad .M.Monad.raw-monad = raw-monad
monad .M.Monad.left-identity _ = singleton->>=
monad .M.Monad.right-identity _ = >>=-singleton
monad .M.Monad.associativity x _ _ = >>=-assoc x
------------------------------------------------------------------------
-- Membership
private
-- Membership is used to define _∈_ and ∈-propositional below.
Membership : {A : Type a} → A → Finite-subset-of A → Proposition a
Membership x = rec r
where
r : Rec _ _
r .[]ʳ = ⊥ , ⊥-propositional
r .∷ʳ y z (x∈z , _) =
(x ≡ y ∥⊎∥ x∈z) , Trunc.truncation-is-proposition
r .dropʳ y z (P , P-prop) =
_↔_.to (ignore-propositional-component
(H-level-propositional ext 1)) $
Univ.≃⇒≡ univ
(x ≡ y ∥⊎∥ x ≡ y ∥⊎∥ P ↔⟨ Trunc.∥⊎∥-assoc ⟩
(x ≡ y ∥⊎∥ x ≡ y) ∥⊎∥ P ↔⟨ Trunc.idempotent Trunc.∥⊎∥-cong F.id ⟩
∥ x ≡ y ∥ ∥⊎∥ P ↔⟨ inverse Trunc.truncate-left-∥⊎∥ ⟩□
x ≡ y ∥⊎∥ P □)
r .swapʳ y z u (P , P-prop) =
_↔_.to (ignore-propositional-component
(H-level-propositional ext 1)) $
Univ.≃⇒≡ univ
(x ≡ y ∥⊎∥ x ≡ z ∥⊎∥ P ↔⟨ Trunc.∥⊎∥-assoc ⟩
(x ≡ y ∥⊎∥ x ≡ z) ∥⊎∥ P ↔⟨ (Trunc.∥⊎∥-comm Trunc.∥⊎∥-cong F.id) ⟩
(x ≡ z ∥⊎∥ x ≡ y) ∥⊎∥ P ↔⟨ inverse Trunc.∥⊎∥-assoc ⟩□
x ≡ z ∥⊎∥ x ≡ y ∥⊎∥ P □)
r .is-setʳ = Univ.∃-H-level-H-level-1+ ext univ 1
-- Membership.
--
-- The type is wrapped to make it easier for Agda to infer the subset
-- argument.
private
module Dummy where
infix 4 _∈_
record _∈_ {A : Type a} (x : A) (y : Finite-subset-of A) : Type a where
constructor box
field
unbox : proj₁ (Membership x y)
open Dummy public using (_∈_) hiding (module _∈_)
-- The negation of membership.
infix 4 _∉_
_∉_ : {A : Type a} → A → Finite-subset-of A → Type a
x ∉ y = ¬ x ∈ y
private
-- An unfolding lemma.
∈≃ : (x ∈ y) ≃ proj₁ (Membership x y)
∈≃ = Eq.↔⇒≃ (record
{ surjection = record
{ logical-equivalence = record
{ to = Dummy._∈_.unbox
; from = Dummy.box
}
; right-inverse-of = refl
}
; left-inverse-of = refl
})
-- Membership is propositional.
∈-propositional : Is-proposition (x ∈ y)
∈-propositional {x = x} {y = y} = $⟨ proj₂ (Membership x y) ⟩
Is-proposition (proj₁ (Membership x y)) ↝⟨ H-level-cong _ 1 (inverse ∈≃) ⦂ (_ → _) ⟩□
Is-proposition (x ∈ y) □
-- A lemma characterising [].
∈[]≃ : (x ∈ []) ≃ ⊥₀
∈[]≃ {x = x} =
x ∈ [] ↝⟨ ∈≃ ⟩
⊥ ↔⟨ ⊥↔⊥ ⟩□
⊥₀ □
-- A lemma characterising _∷_.
∈∷≃ : (x ∈ y ∷ z) ≃ (x ≡ y ∥⊎∥ x ∈ z)
∈∷≃ {x = x} {y = y} {z = z} =
x ∈ y ∷ z ↝⟨ ∈≃ ⟩
x ≡ y ∥⊎∥ proj₁ (Membership x z) ↝⟨ F.id Trunc.∥⊎∥-cong inverse ∈≃ ⟩□
x ≡ y ∥⊎∥ x ∈ z □
-- A variant.
∈≢∷≃ : x ≢ y → (x ∈ y ∷ z) ≃ (x ∈ z)
∈≢∷≃ {x = x} {y = y} {z = z} x≢y =
x ∈ y ∷ z ↝⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ z ↔⟨ Trunc.drop-⊥-left-∥⊎∥ ∈-propositional x≢y ⟩□
x ∈ z □
-- A lemma characterising singleton.
∈singleton≃ :
(x ∈ singleton y) ≃ ∥ x ≡ y ∥
∈singleton≃ {x = x} {y = y} =
x ∈ singleton y ↝⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ [] ↔⟨ Trunc.∥∥-cong $ drop-⊥-right ∈[]≃ ⟩□
∥ x ≡ y ∥ □
-- Some "introduction rules" for _∈_.
∈→∈∷ : x ∈ z → x ∈ y ∷ z
∈→∈∷ {x = x} {z = z} {y = y} =
x ∈ z ↝⟨ ∣_∣ ∘ inj₂ ⟩
x ≡ y ∥⊎∥ x ∈ z ↔⟨ inverse ∈∷≃ ⟩□
x ∈ y ∷ z □
∥≡∥→∈∷ : ∥ x ≡ y ∥ → x ∈ y ∷ z
∥≡∥→∈∷ {x = x} {y = y} {z = z} =
∥ x ≡ y ∥ ↝⟨ Trunc.∥∥-map inj₁ ⟩
x ≡ y ∥⊎∥ x ∈ z ↔⟨ inverse ∈∷≃ ⟩□
x ∈ y ∷ z □
≡→∈∷ : x ≡ y → x ∈ y ∷ z
≡→∈∷ = ∥≡∥→∈∷ ∘ ∣_∣
∥≡∥→∈singleton : ∥ x ≡ y ∥ → x ∈ singleton y
∥≡∥→∈singleton = ∥≡∥→∈∷
≡→∈singleton : x ≡ y → x ∈ singleton y
≡→∈singleton = ≡→∈∷
-- Membership of a union of two subsets can be expressed in terms of
-- membership of the subsets.
∈∪≃ : (x ∈ y ∪ z) ≃ (x ∈ y ∥⊎∥ x ∈ z)
∈∪≃ {x = x} {y = y} {z = z} = elim-prop e y
where
e : Elim-prop (λ y → (x ∈ y ∪ z) ≃ (x ∈ y ∥⊎∥ x ∈ z))
e .[]ʳ =
x ∈ z ↔⟨ inverse $ Trunc.∥∥↔ ∈-propositional ⟩
∥ x ∈ z ∥ ↔⟨ Trunc.∥∥-cong (inverse $ drop-⊥-left ∈[]≃) ⟩□
x ∈ [] ∥⊎∥ x ∈ z □
e .∷ʳ {y = u} y hyp =
x ∈ y ∷ u ∪ z ↝⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ u ∪ z ↝⟨ F.id Trunc.∥⊎∥-cong hyp ⟩
x ≡ y ∥⊎∥ x ∈ u ∥⊎∥ x ∈ z ↔⟨ Trunc.∥⊎∥-assoc ⟩
(x ≡ y ∥⊎∥ x ∈ u) ∥⊎∥ x ∈ z ↝⟨ Trunc.∥∥-cong (inverse ∈∷≃ ⊎-cong F.id) ⟩□
x ∈ y ∷ u ∥⊎∥ x ∈ z □
e .is-propositionʳ _ =
Eq.left-closure ext 0 ∈-propositional
-- More "introduction rules".
∈→∈∪ˡ : x ∈ y → x ∈ y ∪ z
∈→∈∪ˡ {x = x} {y = y} {z = z} =
x ∈ y ↝⟨ ∣_∣ ∘ inj₁ ⟩
x ∈ y ∥⊎∥ x ∈ z ↔⟨ inverse ∈∪≃ ⟩□
x ∈ y ∪ z □
∈→∈∪ʳ : ∀ y → x ∈ z → x ∈ y ∪ z
∈→∈∪ʳ {x = x} {z = z} y =
x ∈ z ↝⟨ ∈→∈∪ˡ ⟩
x ∈ z ∪ y ↝⟨ ≡⇒↝ _ (cong (_ ∈_) (comm z)) ⟩□
x ∈ y ∪ z □
-- A lemma characterising join.
∈join≃ : (x ∈ join z) ≃ ∥ (∃ λ y → x ∈ y × y ∈ z) ∥
∈join≃ {x = x} = elim-prop e _
where
e : Elim-prop (λ z → (x ∈ join z) ≃ ∥ (∃ λ y → x ∈ y × y ∈ z) ∥)
e .[]ʳ =
x ∈ join [] ↔⟨⟩
x ∈ [] ↝⟨ ∈[]≃ ⟩
⊥ ↔⟨ inverse $ Trunc.∥∥↔ ⊥-propositional ⟩
∥ ⊥ ∥ ↔⟨ Trunc.∥∥-cong (inverse (×-right-zero {ℓ₁ = lzero} F.∘
∃-cong (λ _ → ×-right-zero))) ⟩
∥ (∃ λ y → x ∈ y × ⊥) ∥ ↝⟨ Trunc.∥∥-cong (∃-cong λ _ → ∃-cong λ _ → inverse ∈[]≃) ⟩□
∥ (∃ λ y → x ∈ y × y ∈ []) ∥ □
e .∷ʳ {y = z} u hyp =
x ∈ join (u ∷ z) ↔⟨⟩
x ∈ u ∪ join z ↝⟨ ∈∪≃ ⟩
x ∈ u ∥⊎∥ x ∈ join z ↝⟨ F.id Trunc.∥⊎∥-cong hyp ⟩
x ∈ u ∥⊎∥ ∥ (∃ λ y → x ∈ y × y ∈ z) ∥ ↔⟨ inverse Trunc.truncate-right-∥⊎∥ ⟩
x ∈ u ∥⊎∥ (∃ λ y → x ∈ y × y ∈ z) ↔⟨ ∃-intro _ _ Trunc.∥⊎∥-cong F.id ⟩
(∃ λ y → x ∈ y × y ≡ u) ∥⊎∥ (∃ λ y → x ∈ y × y ∈ z) ↔⟨ Trunc.∥∥-cong $ inverse $
∃-⊎-distrib-left F.∘
(∃-cong λ _ → ∃-⊎-distrib-left) ⟩
∥ (∃ λ y → x ∈ y × (y ≡ u ⊎ y ∈ z)) ∥ ↔⟨ inverse $
Trunc.flatten′
(λ F → ∃ λ y → x ∈ y × F (y ≡ u ⊎ y ∈ z))
(λ f → Σ-map id (Σ-map id f))
(λ (y , p , q) → Trunc.∥∥-map (λ q → y , p , q) q) ⟩
∥ (∃ λ y → x ∈ y × (y ≡ u ∥⊎∥ y ∈ z)) ∥ ↝⟨ (Trunc.∥∥-cong $ ∃-cong λ _ → ∃-cong λ _ → inverse ∈∷≃) ⟩□
∥ (∃ λ y → x ∈ y × y ∈ u ∷ z) ∥ □
e .is-propositionʳ _ =
Eq.left-closure ext 0 ∈-propositional
-- If truncated equality is decidable, then membership is also
-- decidable.
member? :
((x y : A) → Dec ∥ x ≡ y ∥) →
(x : A) (y : Finite-subset-of A) → Dec (x ∈ y)
member? equal? x = elim-prop e
where
e : Elim-prop _
e .[]ʳ = no λ ()
e .∷ʳ {y = z} y = case equal? x y of λ where
(yes ∥x≡y∥) _ → yes (∥≡∥→∈∷ ∥x≡y∥)
(no ¬∥x≡y∥) →
P.[ (λ x∈z → yes (∈→∈∷ x∈z))
, (λ x∉z → no (
x ∈ y ∷ z ↔⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ z ↝⟨ Trunc.∥∥-map P.[ ¬∥x≡y∥ ∘ ∣_∣ , x∉z ] ⟩
∥ ⊥ ∥ ↔⟨ Trunc.not-inhabited⇒∥∥↔⊥ id ⟩□
⊥ □))
]
e .is-propositionʳ y =
Dec-closure-propositional ext ∈-propositional
-- A variant that uses Dec-Erased instead of Dec.
member?ᴱ :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
(x : A) (y : Finite-subset-of A) → Dec-Erased (x ∈ y)
member?ᴱ equal? x = elim-prop e
where
e : Elim-prop _
e .[]ʳ = no [ (λ ()) ]
e .∷ʳ {y = z} y = case equal? x y of λ where
(yes [ ∥x≡y∥ ]) _ → yes [ ∥≡∥→∈∷ ∥x≡y∥ ]
(no [ ¬∥x≡y∥ ]) →
P.[ (λ ([ x∈z ]) → yes [ ∈→∈∷ x∈z ])
, (λ ([ x∉z ]) → no [
x ∈ y ∷ z ↔⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ z ↝⟨ Trunc.∥∥-map P.[ ¬∥x≡y∥ ∘ ∣_∣ , x∉z ] ⟩
∥ ⊥ ∥ ↔⟨ Trunc.not-inhabited⇒∥∥↔⊥ id ⟩□
⊥ □ ])
]
e .is-propositionʳ y =
EC.Is-proposition-Dec-Erased ext ∈-propositional
-- If x is a member of y, then x ∷ y is equal to y.
∈→∷≡ : x ∈ y → x ∷ y ≡ y
∈→∷≡ {x = x} = elim-prop e _
where
e : Elim-prop (λ y → x ∈ y → x ∷ y ≡ y)
e .∷ʳ {y = y} z hyp =
x ∈ z ∷ y ↔⟨ ∈∷≃ ⟩
x ≡ z ∥⊎∥ x ∈ y ↝⟨ id Trunc.∥⊎∥-cong hyp ⟩
x ≡ z ∥⊎∥ x ∷ y ≡ y ↝⟨ Trunc.rec is-set
P.[ (λ x≡z →
x ∷ z ∷ y ≡⟨ cong (λ x → x ∷ _) x≡z ⟩
z ∷ z ∷ y ≡⟨ drop ⟩∎
z ∷ y ∎)
, (λ x∷y≡y →
x ∷ z ∷ y ≡⟨ swap ⟩
z ∷ x ∷ y ≡⟨ cong (_ ∷_) x∷y≡y ⟩∎
z ∷ y ∎)
] ⟩□
x ∷ z ∷ y ≡ z ∷ y □
e .is-propositionʳ _ =
Π-closure ext 1 λ _ →
is-set
------------------------------------------------------------------------
-- Subsets of subsets
-- Subsets.
infix 4 _⊆_
_⊆_ : {A : Type a} → Finite-subset-of A → Finite-subset-of A → Type a
x ⊆ y = ∀ z → z ∈ x → z ∈ y
-- _⊆_ is pointwise propositional.
⊆-propositional : Is-proposition (x ⊆ y)
⊆-propositional =
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
∈-propositional
-- The subset property can be expressed using _∪_ and _≡_.
⊆≃∪≡ : ∀ x → (x ⊆ y) ≃ (x ∪ y ≡ y)
⊆≃∪≡ {y = y} x =
_↠_.from
(Eq.≃↠⇔
(Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
∈-propositional)
is-set)
(record
{ to = elim-prop e x
; from = λ p z →
z ∈ x ↝⟨ ∈→∈∪ˡ ⟩
z ∈ x ∪ y ↝⟨ ≡⇒↝ _ (cong (z ∈_) p) ⟩□
z ∈ y □
})
where
e : Elim-prop (λ x → x ⊆ y → x ∪ y ≡ y)
e .[]ʳ _ =
[] ∪ y ≡⟨⟩
y ∎
e .∷ʳ {y = z} x hyp x∷z⊆y =
x ∷ z ∪ y ≡⟨ cong (x ∷_) (hyp (λ _ → x∷z⊆y _ ∘ ∈→∈∷)) ⟩
x ∷ y ≡⟨ ∈→∷≡ (x∷z⊆y x (≡→∈∷ (refl _))) ⟩∎
y ∎
e .is-propositionʳ _ =
Π-closure ext 1 λ _ →
is-set
-- Extensionality.
extensionality :
(x ≡ y) ≃ (∀ z → z ∈ x ⇔ z ∈ y)
extensionality {x = x} {y = y} =
_↠_.from
(Eq.≃↠⇔
is-set
(Π-closure ext 1 λ _ →
⇔-closure ext 1
∈-propositional
∈-propositional))
(record
{ to = λ x≡y z → ≡⇒↝ _ (cong (z ∈_) x≡y)
; from =
(∀ z → z ∈ x ⇔ z ∈ y) ↝⟨ (λ p → _⇔_.to ∘ p , _⇔_.from ∘ p) ⟩
x ⊆ y × y ⊆ x ↔⟨ ⊆≃∪≡ x ×-cong ⊆≃∪≡ y ⟩
x ∪ y ≡ y × y ∪ x ≡ x ↝⟨ (λ (p , q) → trans (sym q) (trans (comm y) p)) ⟩□
x ≡ y □
})
-- Another way to characterise equality.
≡≃⊆×⊇ : (x ≡ y) ≃ (x ⊆ y × y ⊆ x)
≡≃⊆×⊇ {x = x} {y = y} =
x ≡ y ↝⟨ extensionality ⟩
(∀ z → z ∈ x ⇔ z ∈ y) ↝⟨ Eq.⇔→≃
(Π-closure ext 1 λ _ →
⇔-closure ext 1
∈-propositional
∈-propositional)
(×-closure 1 ⊆-propositional ⊆-propositional)
(λ hyp → _⇔_.to ∘ hyp , _⇔_.from ∘ hyp)
(λ (x⊆y , y⊆x) z → record { to = x⊆y z ; from = y⊆x z }) ⟩□
x ⊆ y × y ⊆ x □
-- _⊆_ is a partial order.
⊆-refl : x ⊆ x
⊆-refl _ = id
⊆-trans : x ⊆ y → y ⊆ z → x ⊆ z
⊆-trans x⊆y y⊆z _ = y⊆z _ ∘ x⊆y _
⊆-antisymmetric : x ⊆ y → y ⊆ x → x ≡ y
⊆-antisymmetric = curry (_≃_.from ≡≃⊆×⊇)
-- If truncated equality is decidable, then _⊆_ is also decidable.
subset? :
((x y : A) → Dec ∥ x ≡ y ∥) →
(x y : Finite-subset-of A) → Dec (x ⊆ y)
subset? equal? x y = elim-prop r x
where
r : Elim-prop (λ x → Dec (x ⊆ y))
r .[]ʳ = yes λ z →
z ∈ [] ↔⟨ ∈[]≃ ⟩
⊥ ↝⟨ ⊥-elim ⟩□
z ∈ y □
r .∷ʳ {y = x} z =
Dec (x ⊆ y) ↝⟨ member? equal? z y ,_ ⟩
Dec (z ∈ y) × Dec (x ⊆ y) ↝⟨ uncurry
P.[ (λ u∈y → Dec-map (
x ⊆ y ↝⟨ record
{ to = λ x⊆y u →
P.[ (λ z≡u → subst (_∈ y) (sym z≡u) u∈y)
, x⊆y u
]
; from = λ hyp u → hyp u ∘ inj₂
} ⟩
(∀ u → u ≡ z ⊎ u ∈ x → u ∈ y) ↔⟨ (∀-cong ext λ _ → inverse $
Trunc.universal-property ∈-propositional) ⟩
(∀ u → u ≡ z ∥⊎∥ u ∈ x → u ∈ y) ↝⟨ (∀-cong _ λ _ → →-cong₁ _ (inverse ∈∷≃)) ⟩
(∀ u → u ∈ z ∷ x → u ∈ y) ↔⟨⟩
z ∷ x ⊆ y □))
, (λ u∉y _ → no (
z ∷ x ⊆ y ↝⟨ (λ u∷x⊆y → u∷x⊆y z (≡→∈∷ (refl _))) ⟩
z ∈ y ↝⟨ u∉y ⟩□
⊥ □))
] ⟩□
Dec (z ∷ x ⊆ y) □
r .is-propositionʳ _ =
Dec-closure-propositional ext ⊆-propositional
-- A variant of subset? that uses Dec-Erased.
subset?ᴱ :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
(x y : Finite-subset-of A) → Dec-Erased (x ⊆ y)
subset?ᴱ equal? x y = elim-prop r x
where
r : Elim-prop (λ x → Dec-Erased (x ⊆ y))
r .[]ʳ = yes [ (λ z →
z ∈ [] ↔⟨ ∈[]≃ ⟩
⊥ ↝⟨ ⊥-elim ⟩□
z ∈ y □ )]
r .∷ʳ {y = x} z =
Dec-Erased (x ⊆ y) ↝⟨ member?ᴱ equal? z y ,_ ⟩
Dec-Erased (z ∈ y) × Dec-Erased (x ⊆ y) ↝⟨ uncurry
P.[ (λ ([ u∈y ]) → EC.Dec-Erased-map (
x ⊆ y ↝⟨ record
{ to = λ x⊆y u →
P.[ (λ z≡u → subst (_∈ y) (sym z≡u) u∈y)
, x⊆y u
]
; from = λ hyp u → hyp u ∘ inj₂
} ⟩
(∀ u → u ≡ z ⊎ u ∈ x → u ∈ y) ↔⟨ (∀-cong ext λ _ → inverse $
Trunc.universal-property ∈-propositional) ⟩
(∀ u → u ≡ z ∥⊎∥ u ∈ x → u ∈ y) ↝⟨ (∀-cong _ λ _ → →-cong₁ _ (inverse ∈∷≃)) ⟩
(∀ u → u ∈ z ∷ x → u ∈ y) ↔⟨⟩
z ∷ x ⊆ y □))
, (λ ([ u∉y ]) _ → no [
z ∷ x ⊆ y ↝⟨ (λ u∷x⊆y → u∷x⊆y z (≡→∈∷ (refl _))) ⟩
z ∈ y ↝⟨ u∉y ⟩□
⊥ □ ])
] ⟩□
Dec-Erased (z ∷ x ⊆ y) □
r .is-propositionʳ _ =
EC.Is-proposition-Dec-Erased ext ⊆-propositional
-- If truncated equality is decidable, then _≡_ is also decidable.
equal? :
((x y : A) → Dec ∥ x ≡ y ∥) →
(x y : Finite-subset-of A) → Dec (x ≡ y)
equal? eq? x y = $⟨ subset? eq? x y , subset? eq? y x ⟩
Dec (x ⊆ y) × Dec (y ⊆ x) ↝⟨ uncurry Dec-× ⟩
Dec (x ⊆ y × y ⊆ x) ↝⟨ Dec-map (from-equivalence $ inverse ≡≃⊆×⊇) ⟩□
Dec (x ≡ y) □
-- A variant of equal? that uses Dec-Erased.
equal?ᴱ :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
(x y : Finite-subset-of A) → Dec-Erased (x ≡ y)
equal?ᴱ eq? x y = $⟨ subset?ᴱ eq? x y , subset?ᴱ eq? y x ⟩
Dec-Erased (x ⊆ y) × Dec-Erased (y ⊆ x) ↝⟨ EC.Dec-Erased↔Dec-Erased _ ×-cong EC.Dec-Erased↔Dec-Erased _ ⟩
Dec (Erased (x ⊆ y)) × Dec (Erased (y ⊆ x)) ↝⟨ uncurry Dec-× ⟩
Dec (Erased (x ⊆ y) × Erased (y ⊆ x)) ↝⟨ Dec-map (from-isomorphism $ inverse EC.Erased-Σ↔Σ) ⟩
Dec (Erased (x ⊆ y × y ⊆ x)) ↝⟨ _⇔_.from $ EC.Dec-Erased↔Dec-Erased _ ⟩
Dec-Erased (x ⊆ y × y ⊆ x) ↝⟨ EC.Dec-Erased-map (from-equivalence $ inverse ≡≃⊆×⊇) ⟩□
Dec-Erased (x ≡ y) □
------------------------------------------------------------------------
-- The functions map-Maybe, filter, minus and delete
private
-- A function used to define map-Maybe.
map-Maybe-cons : Maybe B → Finite-subset-of B → Finite-subset-of B
map-Maybe-cons nothing y = y
map-Maybe-cons (just x) y = x ∷ y
-- A combination of map and filter.
map-Maybe : (A → Maybe B) → Finite-subset-of A → Finite-subset-of B
map-Maybe f = rec r
where
r : Rec _ _
r .[]ʳ = []
r .∷ʳ x _ y = map-Maybe-cons (f x) y
r .is-setʳ = is-set
r .dropʳ x _ y = lemma (f x)
where
lemma :
∀ m → map-Maybe-cons m (map-Maybe-cons m y) ≡ map-Maybe-cons m y
lemma nothing = refl _
lemma (just _) = drop
r .swapʳ x y _ z = lemma (f x) (f y)
where
lemma :
∀ m₁ m₂ →
map-Maybe-cons m₁ (map-Maybe-cons m₂ z) ≡
map-Maybe-cons m₂ (map-Maybe-cons m₁ z)
lemma (just _) (just _) = swap
lemma _ nothing = refl _
lemma nothing _ = refl _
-- A lemma characterising map-Maybe.
∈map-Maybe≃ :
(x ∈ map-Maybe f y) ≃ ∥ (∃ λ z → z ∈ y × f z ≡ just x) ∥
∈map-Maybe≃ {x = x} {f = f} = elim-prop e _
where
e : Elim-prop (λ y → (x ∈ map-Maybe f y) ≃
∥ (∃ λ z → z ∈ y × f z ≡ just x) ∥)
e .[]ʳ =
x ∈ map-Maybe f [] ↝⟨ ∈[]≃ ⟩
⊥ ↔⟨ inverse $ Trunc.∥∥↔ ⊥-propositional ⟩
∥ ⊥ ∥ ↔⟨ Trunc.∥∥-cong (inverse (×-right-zero {ℓ₁ = lzero} F.∘
∃-cong (λ _ → ×-left-zero))) ⟩
∥ (∃ λ z → ⊥ × f z ≡ just x) ∥ ↝⟨ Trunc.∥∥-cong (∃-cong λ _ → inverse ∈[]≃ ×-cong F.id) ⟩□
∥ (∃ λ z → z ∈ [] × f z ≡ just x) ∥ □
e .∷ʳ {y = y} z hyp =
(x ∈ map-Maybe f (z ∷ y)) ↝⟨ lemma _ _ ⟩
f z ≡ just x ∥⊎∥ (x ∈ map-Maybe f y) ↝⟨ from-isomorphism (inverse Trunc.truncate-right-∥⊎∥) F.∘
(F.id Trunc.∥⊎∥-cong hyp) ⟩
f z ≡ just x ∥⊎∥ (∃ λ u → u ∈ y × f u ≡ just x) ↔⟨ inverse $
drop-⊤-left-Σ (_⇔_.to contractible⇔↔⊤ $ singleton-contractible _) F.∘
Σ-assoc
Trunc.∥⊎∥-cong
F.id ⟩
(∃ λ u → u ≡ z × f u ≡ just x) ∥⊎∥ (∃ λ u → u ∈ y × f u ≡ just x) ↔⟨ Trunc.∥∥-cong $ inverse ∃-⊎-distrib-left ⟩
∥ (∃ λ u → u ≡ z × f u ≡ just x ⊎ u ∈ y × f u ≡ just x) ∥ ↔⟨ Trunc.∥∥-cong (∃-cong λ _ → inverse ∃-⊎-distrib-right) ⟩
∥ (∃ λ u → (u ≡ z ⊎ u ∈ y) × f u ≡ just x) ∥ ↔⟨ inverse $
Trunc.flatten′
(λ F → (∃ λ u → F (u ≡ z ⊎ u ∈ y) × f u ≡ just x))
(λ f → Σ-map id (Σ-map f id))
(λ (u , p , q) → Trunc.∥∥-map (λ p → u , p , q) p) ⟩
∥ (∃ λ u → (u ≡ z ∥⊎∥ u ∈ y) × f u ≡ just x) ∥ ↝⟨ Trunc.∥∥-cong (∃-cong λ _ → ×-cong₁ λ _ → inverse ∈∷≃) ⟩□
∥ (∃ λ u → u ∈ z ∷ y × f u ≡ just x) ∥ □
where
lemma : ∀ m y → (x ∈ map-Maybe-cons m y) ≃ (m ≡ just x ∥⊎∥ x ∈ y)
lemma nothing y =
x ∈ map-Maybe-cons nothing y ↔⟨⟩
x ∈ y ↔⟨ inverse $ Trunc.drop-⊥-left-∥⊎∥ ∈-propositional ⊎.inj₁≢inj₂ ⟩□
(nothing ≡ just x ∥⊎∥ x ∈ y) □
lemma (just z) y =
x ∈ map-Maybe-cons (just z) y ↔⟨⟩
x ∈ z ∷ y ↝⟨ ∈∷≃ ⟩
x ≡ z ∥⊎∥ x ∈ y ↔⟨ (Bijection.≡↔inj₂≡inj₂ F.∘ ≡-comm) Trunc.∥⊎∥-cong F.id ⟩□
just z ≡ just x ∥⊎∥ x ∈ y □
e .is-propositionʳ y =
Eq.left-closure ext 0 ∈-propositional
-- The function map-Maybe f commutes with map-Maybe g if f commutes
-- with g in a certain way.
map-Maybe-comm :
{A : Type a} {f g : A → Maybe A} →
(∀ x → f =<< g x ≡ g =<< f x) →
∀ x → map-Maybe f (map-Maybe g x) ≡ map-Maybe g (map-Maybe f x)
map-Maybe-comm {A = A} {f = f} {g = g}
hyp x = _≃_.from extensionality λ y →
y ∈ map-Maybe f (map-Maybe g x) ↝⟨ lemma₂ ⟩
∥ (∃ λ u → u ∈ x × f =<< g u ≡ just y) ∥ ↝⟨ Trunc.∥∥-cong (∃-cong λ _ → ∃-cong λ _ → ≡⇒↝ _ $ cong (_≡ _) $ hyp _) ⟩
∥ (∃ λ u → u ∈ x × g =<< f u ≡ just y) ∥ ↝⟨ inverse lemma₂ ⟩
y ∈ map-Maybe g (map-Maybe f x) □
where
lemma₁ :
∀ (f {g} : A → Maybe A) {x z} →
(∃ λ y → f x ≡ just y × g y ≡ just z) ⇔ (g =<< f x ≡ just z)
lemma₁ f {g = g} {x = x} {z = z} = record
{ to = λ (y , f≡ , g≡) →
g =<< f x ≡⟨⟩
Maybe.maybe g nothing (f x) ≡⟨ cong (Maybe.maybe g nothing) f≡ ⟩
g y ≡⟨ g≡ ⟩∎
just z ∎
; from = from (f x)
}
where
from :
(fx : Maybe A) →
g =<< fx ≡ just z →
∃ λ y → fx ≡ just y × g y ≡ just z
from nothing = ⊥-elim ∘ ⊎.inj₁≢inj₂
from (just y) = (y ,_) ∘ (refl _ ,_)
lemma₂ :
{f g : A → Maybe A} →
y ∈ map-Maybe f (map-Maybe g x) ⇔
∥ (∃ λ u → u ∈ x × f =<< g u ≡ just y) ∥
lemma₂ {y = y} {f = f} {g = g} =
y ∈ map-Maybe f (map-Maybe g x) ↔⟨ Trunc.∥∥-cong (∃-cong λ _ → ∈map-Maybe≃ ×-cong F.id) F.∘ ∈map-Maybe≃ ⟩
∥ (∃ λ z → ∥ (∃ λ u → u ∈ x × g u ≡ just z) ∥ × f z ≡ just y) ∥ ↔⟨ Trunc.flatten′
(λ F → ∃ λ z → F (∃ λ u → u ∈ x × _) × _)
(λ f → Σ-map id (Σ-map f id))
(λ (z , p , q) → Trunc.∥∥-map (λ p → z , p , q) p) ⟩
∥ (∃ λ z → (∃ λ u → u ∈ x × g u ≡ just z) × f z ≡ just y) ∥ ↔⟨ Trunc.∥∥-cong (∃-cong λ _ → inverse $ Σ-assoc F.∘ ∃-cong λ _ → Σ-assoc) ⟩
∥ (∃ λ z → ∃ λ u → u ∈ x × g u ≡ just z × f z ≡ just y) ∥ ↔⟨ Trunc.∥∥-cong ((∃-cong λ _ → ∃-comm) F.∘ ∃-comm) ⟩
∥ (∃ λ u → u ∈ x × ∃ λ z → g u ≡ just z × f z ≡ just y) ∥ ↝⟨ Trunc.∥∥-cong (∃-cong λ _ → ∃-cong λ _ → lemma₁ g) ⟩□
∥ (∃ λ u → u ∈ x × f =<< g u ≡ just y) ∥ □
-- The function map-Maybe commutes with union.
map-Maybe-∪ :
∀ x → map-Maybe f (x ∪ y) ≡ map-Maybe f x ∪ map-Maybe f y
map-Maybe-∪ {f = f} {y = y} x = _≃_.from extensionality λ z →
z ∈ map-Maybe f (x ∪ y) ↔⟨ (Trunc.∥∥-cong (∃-cong λ _ → ∈∪≃ ×-cong F.id)) F.∘ ∈map-Maybe≃ ⟩
∥ (∃ λ u → (u ∈ x ∥⊎∥ u ∈ y) × f u ≡ just z) ∥ ↔⟨ Trunc.flatten′
(λ F → ∃ λ u → F (u ∈ x ⊎ u ∈ y) × _)
(λ f → Σ-map id (Σ-map f id))
(λ (u , p , q) → Trunc.∥∥-map (λ p → u , p , q) p) ⟩
∥ (∃ λ u → (u ∈ x ⊎ u ∈ y) × f u ≡ just z) ∥ ↔⟨ Trunc.∥∥-cong (∃-cong λ _ → ∃-⊎-distrib-right) ⟩
∥ (∃ λ u → u ∈ x × f u ≡ just z ⊎ u ∈ y × f u ≡ just z) ∥ ↔⟨ Trunc.∥∥-cong ∃-⊎-distrib-left ⟩
(∃ λ u → u ∈ x × f u ≡ just z) ∥⊎∥
(∃ λ u → u ∈ y × f u ≡ just z) ↔⟨ inverse $
Trunc.flatten′ (λ F → F _ ⊎ F _) (λ f → ⊎-map f f)
P.[ Trunc.∥∥-map inj₁ , Trunc.∥∥-map inj₂ ] ⟩
∥ (∃ λ u → u ∈ x × f u ≡ just z) ∥ ∥⊎∥
∥ (∃ λ u → u ∈ y × f u ≡ just z) ∥ ↔⟨ inverse $ (∈map-Maybe≃ Trunc.∥⊎∥-cong ∈map-Maybe≃) F.∘ ∈∪≃ ⟩□
z ∈ map-Maybe f x ∪ map-Maybe f y □
-- One can express map using map-Maybe.
map≡map-Maybe-just :
(x : Finite-subset-of A) →
map f x ≡ map-Maybe (just ∘ f) x
map≡map-Maybe-just {f = f} = elim-prop e
where
e : Elim-prop _
e .[]ʳ = refl _
e .∷ʳ x = cong (f x ∷_)
e .is-propositionʳ _ = is-set
-- A lemma characterising map.
∈map≃ : (x ∈ map f y) ≃ ∥ (∃ λ z → z ∈ y × f z ≡ x) ∥
∈map≃ {x = x} {f = f} {y = y} =
x ∈ map f y ↝⟨ ≡⇒↝ _ $ cong (_ ∈_) $ map≡map-Maybe-just y ⟩
x ∈ map-Maybe (just ∘ f) y ↝⟨ ∈map-Maybe≃ ⟩
∥ (∃ λ z → z ∈ y × just (f z) ≡ just x) ∥ ↔⟨ Trunc.∥∥-cong (∃-cong λ _ → ∃-cong λ _ → inverse Bijection.≡↔inj₂≡inj₂) ⟩□
∥ (∃ λ z → z ∈ y × f z ≡ x) ∥ □
-- Some consequences of the characterisation of map.
∈→∈map :
{f : A → B} →
x ∈ y → f x ∈ map f y
∈→∈map {x = x} {y = y} {f = f} =
x ∈ y ↝⟨ (λ x∈y → ∣ x , x∈y , refl _ ∣) ⟩
∥ (∃ λ z → z ∈ y × f z ≡ f x) ∥ ↔⟨ inverse ∈map≃ ⟩□
f x ∈ map f y □
Injective→∈map≃ :
{f : A → B} →
Injective f →
(f x ∈ map f y) ≃ (x ∈ y)
Injective→∈map≃ {x = x} {y = y} {f = f} inj =
f x ∈ map f y ↝⟨ ∈map≃ ⟩
∥ (∃ λ z → z ∈ y × f z ≡ f x) ∥ ↝⟨ (Trunc.∥∥-cong-⇔ $ ∃-cong λ _ → ∃-cong λ _ →
record { to = inj; from = cong f }) ⟩
∥ (∃ λ z → z ∈ y × z ≡ x) ∥ ↔⟨ Trunc.∥∥-cong $ inverse $ ∃-intro _ _ ⟩
∥ x ∈ y ∥ ↔⟨ Trunc.∥∥↔ ∈-propositional ⟩□
x ∈ y □
-- The function map commutes with union.
map-∪ : ∀ x → map f (x ∪ y) ≡ map f x ∪ map f y
map-∪ {f = f} {y = y} x =
map f (x ∪ y) ≡⟨ map≡map-Maybe-just (x ∪ y) ⟩
map-Maybe (just ∘ f) (x ∪ y) ≡⟨ map-Maybe-∪ x ⟩
map-Maybe (just ∘ f) x ∪ map-Maybe (just ∘ f) y ≡⟨ sym $ cong₂ _∪_ (map≡map-Maybe-just x) (map≡map-Maybe-just y) ⟩∎
map f x ∪ map f y ∎
-- A filter function.
filter : (A → Bool) → Finite-subset-of A → Finite-subset-of A
filter p = map-Maybe (λ x → if p x then just x else nothing)
-- A lemma characterising filter.
∈filter≃ :
∀ p → (x ∈ filter p y) ≃ (T (p x) × x ∈ y)
∈filter≃ {x = x} {y = y} p =
x ∈ map-Maybe (λ x → if p x then just x else nothing) y ↝⟨ ∈map-Maybe≃ ⟩
∥ (∃ λ z → z ∈ y × if p z then just z else nothing ≡ just x) ∥ ↝⟨ (Trunc.∥∥-cong $ ∃-cong λ _ → ∃-cong λ _ → lemma _ (refl _)) ⟩
∥ (∃ λ z → z ∈ y × T (p z) × z ≡ x) ∥ ↔⟨ (Trunc.∥∥-cong $ ∃-cong λ _ →
(×-cong₁ λ z≡x → ≡⇒↝ _ $ cong (λ z → z ∈ y × T (p z)) z≡x) F.∘
Σ-assoc) ⟩
∥ (∃ λ z → (x ∈ y × T (p x)) × z ≡ x) ∥ ↔⟨ inverse Σ-assoc F.∘
(×-cong₁ λ _ →
×-comm F.∘
Trunc.∥∥↔ (×-closure 1 ∈-propositional (T-propositional (p x)))) F.∘
inverse Trunc.∥∥×∥∥↔∥×∥ F.∘
Trunc.∥∥-cong ∃-comm ⟩
T (p x) × x ∈ y × ∥ (∃ λ z → z ≡ x) ∥ ↔⟨ (∃-cong λ _ → drop-⊤-right λ _ →
_⇔_.to contractible⇔↔⊤ (singleton-contractible _) F.∘
Trunc.∥∥↔ (mono₁ 0 $ singleton-contractible _)) ⟩□
T (p x) × x ∈ y □
where
lemma :
∀ b → p z ≡ b →
(if b then just z else nothing ≡ just x) ≃
(T b × z ≡ x)
lemma {z = z} true eq =
just z ≡ just x ↔⟨ inverse Bijection.≡↔inj₂≡inj₂ ⟩
z ≡ x ↔⟨ inverse ×-left-identity ⟩□
⊤ × z ≡ x □
lemma {z = z} false eq =
nothing ≡ just x ↔⟨ Bijection.≡↔⊎ ⟩
⊥ ↔⟨ inverse ×-left-zero ⟩□
⊥ × z ≡ x □
-- The result of filtering is a subset of the original subset.
filter⊆ : ∀ p → filter p x ⊆ x
filter⊆ {x = x} p z =
z ∈ filter p x ↔⟨ ∈filter≃ p ⟩
T (p z) × z ∈ x ↝⟨ proj₂ ⟩□
z ∈ x □
-- Filtering commutes with itself.
filter-comm :
∀ (p q : A → Bool) x →
filter p (filter q x) ≡ filter q (filter p x)
filter-comm p q x = _≃_.from extensionality λ y →
y ∈ filter p (filter q x) ↔⟨ from-isomorphism Σ-assoc F.∘ (F.id ×-cong ∈filter≃ q) F.∘ ∈filter≃ p ⟩
(T (p y) × T (q y)) × y ∈ x ↔⟨ ×-comm ×-cong F.id ⟩
(T (q y) × T (p y)) × y ∈ x ↔⟨ inverse $ from-isomorphism Σ-assoc F.∘ (F.id ×-cong ∈filter≃ p) F.∘ ∈filter≃ q ⟩□
y ∈ filter q (filter p x) □
-- Filtering commutes with union.
filter-∪ :
∀ p x → filter p (x ∪ y) ≡ filter p x ∪ filter p y
filter-∪ _ = map-Maybe-∪
-- If erased truncated equality is decidable, then one subset can be
-- removed from another.
minus :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
Finite-subset-of A → Finite-subset-of A → Finite-subset-of A
minus _≟_ x y =
filter (λ z → if member?ᴱ _≟_ z y then false else true) x
-- A lemma characterising minus.
∈minus≃ : (x ∈ minus _≟_ y z) ≃ (x ∈ y × x ∉ z)
∈minus≃ {x = x} {_≟_ = _≟_} {y = y} {z = z} =
x ∈ minus _≟_ y z ↝⟨ ∈filter≃ (λ _ → if member?ᴱ _ _ z then _ else _) ⟩
T (if member?ᴱ _≟_ x z then false else true) × x ∈ y ↔⟨ lemma (member?ᴱ _≟_ x z) ×-cong F.id ⟩
x ∉ z × x ∈ y ↔⟨ ×-comm ⟩□
x ∈ y × x ∉ z □
where
lemma :
(d : Dec-Erased A) →
T (if d then false else true) ↔ ¬ A
lemma {A = A} d@(yes a) =
T (if d then false else true) ↔⟨⟩
⊥ ↝⟨ Bijection.⊥↔uninhabited (_$ a) ⟩
¬ EC.Erased A ↝⟨ EC.¬-Erased↔¬ ext ⟩□
¬ A □
lemma {A = A} d@(no ¬a) =
T (if d then false else true) ↔⟨⟩
⊤ ↝⟨ inverse $
_⇔_.to contractible⇔↔⊤ $
propositional⇒inhabited⇒contractible
(¬-propositional ext)
(EC.Stable-¬ ¬a) ⟩□
¬ A □
-- The result of minus is a subset of the original subset.
minus⊆ : ∀ y → minus _≟_ x y ⊆ x
minus⊆ y =
filter⊆ (λ _ → if member?ᴱ _ _ y then _ else _)
-- Minus commutes with itself (in a certain sense).
minus-comm :
∀ x y z →
minus _≟_ (minus _≟_ x y) z ≡ minus _≟_ (minus _≟_ x z) y
minus-comm x y z =
filter-comm
(λ _ → if member?ᴱ _ _ z then _ else _)
(λ _ → if member?ᴱ _ _ y then _ else _)
x
-- Minus commutes with union (in a certain sense).
minus-∪ :
∀ x z →
minus _≟_ (x ∪ y) z ≡ minus _≟_ x z ∪ minus _≟_ y z
minus-∪ x z = filter-∪ (λ _ → if member?ᴱ _ _ z then _ else _) x
-- A lemma relating minus, _⊆_ and _∪_.
minus⊆≃ :
{_≟_ : (x y : A) → Dec ∥ x ≡ y ∥} →
∀ y →
(minus (λ x y → Dec→Dec-Erased (x ≟ y)) x y ⊆ z) ≃
(x ⊆ y ∪ z)
minus⊆≃ {x = x} {z = z} {_≟_ = _≟_} y =
_↠_.from (Eq.≃↠⇔ ⊆-propositional ⊆-propositional) $ record
{ to = λ x-y⊆z u →
u ∈ x ↝⟨ (λ u∈x →
case member? _≟_ u y of
P.[ Trunc.∣inj₁∣ , Trunc.∣inj₂∣ ∘ (u∈x ,_) ]) ⟩
u ∈ y ∥⊎∥ (u ∈ x × u ∉ y) ↔⟨ F.id Trunc.∥⊎∥-cong inverse ∈minus≃ ⟩
u ∈ y ∥⊎∥ u ∈ minus _≟′_ x y ↝⟨ id Trunc.∥⊎∥-cong x-y⊆z u ⟩
u ∈ y ∥⊎∥ u ∈ z ↔⟨ inverse ∈∪≃ ⟩□
u ∈ y ∪ z □
; from = λ x⊆y∪z u →
u ∈ minus _≟′_ x y ↔⟨ ∈minus≃ ⟩
u ∈ x × u ∉ y ↝⟨ Σ-map (x⊆y∪z _) id ⟩
u ∈ y ∪ z × u ∉ y ↔⟨ ∈∪≃ ×-cong F.id ⟩
(u ∈ y ∥⊎∥ u ∈ z) × u ∉ y ↔⟨ (×-cong₁ λ u∉y → Trunc.drop-⊥-left-∥⊎∥ ∈-propositional u∉y) ⟩
u ∈ z × u ∉ y ↝⟨ proj₁ ⟩□
u ∈ z □
}
where
_≟′_ = λ x y → Dec→Dec-Erased (x ≟ y)
-- If erased truncated equality is decidable, then elements can be
-- removed from a subset.
delete :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
A → Finite-subset-of A → Finite-subset-of A
delete _≟_ x y = minus _≟_ y (singleton x)
-- A lemma characterising delete.
∈delete≃ : ∀ _≟_ → (x ∈ delete _≟_ y z) ≃ (x ≢ y × x ∈ z)
∈delete≃ {x = x} {y = y} {z = z} _≟_ =
x ∈ delete _≟_ y z ↝⟨ ∈minus≃ {_≟_ = _≟_} ⟩
x ∈ z × x ∉ singleton y ↝⟨ F.id ×-cong →-cong₁ ext ∈singleton≃ ⟩
x ∈ z × ¬ ∥ x ≡ y ∥ ↔⟨ F.id ×-cong Trunc.¬∥∥↔¬ ⟩
x ∈ z × x ≢ y ↔⟨ ×-comm ⟩□
x ≢ y × x ∈ z □
-- A deleted element is no longer a member of the set.
∉delete : ∀ _≟_ y → x ∉ delete _≟_ x y
∉delete {x = x} _≟_ y =
x ∈ delete _≟_ x y ↔⟨ ∈delete≃ _≟_ ⟩
x ≢ x × x ∈ y ↝⟨ (_$ refl _) ∘ proj₁ ⟩□
⊥ □
-- Deletion commutes with itself (in a certain sense).
delete-comm :
∀ _≟_ z →
delete _≟_ x (delete _≟_ y z) ≡ delete _≟_ y (delete _≟_ x z)
delete-comm _≟_ z =
minus-comm {_≟_ = _≟_} z (singleton _) (singleton _)
-- Deletion commutes with union.
delete-∪ :
∀ _≟_ y →
delete _≟_ x (y ∪ z) ≡ delete _≟_ x y ∪ delete _≟_ x z
delete-∪ _≟_ y = minus-∪ {_≟_ = _≟_} y (singleton _)
-- A lemma relating delete, _⊆_ and _∷_.
delete⊆≃ :
(_≟_ : (x y : A) → Dec ∥ x ≡ y ∥) →
(delete (λ x y → Dec→Dec-Erased (x ≟ y)) x y ⊆ z) ≃ (y ⊆ x ∷ z)
delete⊆≃ _≟_ = minus⊆≃ {_≟_ = _≟_} (singleton _)
------------------------------------------------------------------------
-- Some preservation lemmas for _⊆_
-- Various operations preserve _⊆_.
∷-cong-⊆ : y ⊆ z → x ∷ y ⊆ x ∷ z
∷-cong-⊆ {y = y} {z = z} {x = x} y⊆z u =
u ∈ x ∷ y ↔⟨ ∈∷≃ ⟩
u ≡ x ∥⊎∥ u ∈ y ↝⟨ id Trunc.∥⊎∥-cong y⊆z _ ⟩
u ≡ x ∥⊎∥ u ∈ z ↔⟨ inverse ∈∷≃ ⟩□
u ∈ x ∷ z □
∪-cong-⊆ : x₁ ⊆ x₂ → y₁ ⊆ y₂ → x₁ ∪ y₁ ⊆ x₂ ∪ y₂
∪-cong-⊆ {x₁ = x₁} {x₂ = x₂} {y₁ = y₁} {y₂ = y₂} x₁⊆x₂ y₁⊆y₂ z =
z ∈ x₁ ∪ y₁ ↔⟨ ∈∪≃ ⟩
z ∈ x₁ ∥⊎∥ z ∈ y₁ ↝⟨ x₁⊆x₂ _ Trunc.∥⊎∥-cong y₁⊆y₂ _ ⟩
z ∈ x₂ ∥⊎∥ z ∈ y₂ ↔⟨ inverse ∈∪≃ ⟩□
z ∈ x₂ ∪ y₂ □
filter-cong-⊆ :
(∀ z → T (p z) → T (q z)) →
x ⊆ y → filter p x ⊆ filter q y
filter-cong-⊆ {p = p} {q = q} {x = x} {y = y} p⇒q x⊆y z =
z ∈ filter p x ↔⟨ ∈filter≃ p ⟩
T (p z) × z ∈ x ↝⟨ Σ-map (p⇒q _) (x⊆y _) ⟩
T (q z) × z ∈ y ↔⟨ inverse $ ∈filter≃ q ⟩□
z ∈ filter q y □
minus-cong-⊆ : x₁ ⊆ x₂ → y₂ ⊆ y₁ → minus _≟_ x₁ y₁ ⊆ minus _≟_ x₂ y₂
minus-cong-⊆ {x₁ = x₁} {x₂ = x₂} {y₂ = y₂} {y₁ = y₁} {_≟_ = _≟_}
x₁⊆x₂ y₂⊆y₁ z =
z ∈ minus _≟_ x₁ y₁ ↔⟨ ∈minus≃ ⟩
z ∈ x₁ × z ∉ y₁ ↝⟨ Σ-map (x₁⊆x₂ _) (_∘ y₂⊆y₁ _) ⟩
z ∈ x₂ × z ∉ y₂ ↔⟨ inverse ∈minus≃ ⟩□
z ∈ minus _≟_ x₂ y₂ □
delete-cong-⊆ : ∀ _≟_ → y ⊆ z → delete _≟_ x y ⊆ delete _≟_ x z
delete-cong-⊆ _≟_ y⊆z =
minus-cong-⊆ {_≟_ = _≟_} y⊆z (⊆-refl {x = singleton _})
------------------------------------------------------------------------
-- Size
private
-- This definition is used to define ∣_∣≡ and ∣∣≡-propositional
-- below.
--
-- This definition is not taken from "Finite Sets in Homotopy Type
-- Theory", but it is based on the size function in that paper.
Size : {A : Type a} → Finite-subset-of A → ℕ → Proposition a
Size {a = a} {A = A} = rec r
where
mutual
-- The size of x ∷ y is equal to the size of y if x is a member
-- of y, and otherwise it is equal to the successor of the size
-- of y.
Cons′ :
A → Finite-subset-of A →
(ℕ → Proposition a) → (ℕ → Type a)
Cons′ x y ∣y∣≡ n =
x ∈ y × proj₁ (∣y∣≡ n)
⊎
Cons″ x y ∣y∣≡ n
Cons″ :
A → Finite-subset-of A →
(ℕ → Proposition a) → (ℕ → Type a)
Cons″ x y ∣y∣≡ zero = ⊥
Cons″ x y ∣y∣≡ (suc n) = x ∉ y × proj₁ (∣y∣≡ n)
Cons′-propositional :
∀ Hyp n → Is-proposition (Cons′ x y Hyp n)
Cons′-propositional Hyp zero =
⊎-closure-propositional
(λ _ ())
(×-closure 1 ∈-propositional (proj₂ (Hyp 0)))
⊥-propositional
Cons′-propositional Hyp (suc n) =
⊎-closure-propositional
(λ (x∈y , _) (x∉y , _) → x∉y x∈y)
(×-closure 1 ∈-propositional (proj₂ (Hyp (suc n))))
(×-closure 1 (¬-propositional ext) (proj₂ (Hyp n)))
Cons :
A → Finite-subset-of A →
(ℕ → Proposition a) → (ℕ → Proposition a)
Cons x y Hyp n =
Cons′ x y Hyp n
, Cons′-propositional _ _
drop-lemma :
Cons′ x (x ∷ y) (Cons x y H) n ≃ Cons′ x y H n
drop-lemma {x = x} {y = y} {H = H} {n = n} =
Cons′ x (x ∷ y) (Cons x y H) n ↔⟨⟩
x ∈ x ∷ y × Cons′ x y H n ⊎ C n ↔⟨ drop-⊥-right (C↔⊥ n) ⟩
x ∈ x ∷ y × Cons′ x y H n ↔⟨ drop-⊤-left-× (λ _ → x∈x∷y↔⊤) ⟩
Cons′ x y H n □
where
C = Cons″ x (x ∷ y) (Cons x y H)
x∈x∷y↔⊤ : x ∈ x ∷ y ↔ ⊤
x∈x∷y↔⊤ =
x ∈ x ∷ y ↔⟨ ∈∷≃ ⟩
x ≡ x ∥⊎∥ x ∈ y ↝⟨ Trunc.inhabited⇒∥∥↔⊤ ∣ inj₁ (refl _) ∣ ⟩□
⊤ □
C↔⊥ : ∀ n → C n ↔ ⊥
C↔⊥ zero = ⊥↔⊥
C↔⊥ (suc n) =
x ∉ x ∷ y × Cons′ x y H n ↝⟨ →-cong ext x∈x∷y↔⊤ F.id ×-cong F.id ⟩
¬ ⊤ × Cons′ x y H n ↝⟨ inverse (Bijection.⊥↔uninhabited (_$ _)) ×-cong F.id ⟩
⊥₀ × Cons′ x y H n ↝⟨ ×-left-zero ⟩□
⊥ □
swap-lemma′ :
∀ n →
x ∈ y ∷ z × Cons′ y z H n ⊎ Cons″ x (y ∷ z) (Cons y z H) n →
y ∈ x ∷ z × Cons′ x z H n ⊎ Cons″ y (x ∷ z) (Cons x z H) n
swap-lemma′ {x = x} {y = y} {z = z} {H = H} = λ where
n (inj₁ (x∈y∷z , inj₁ (y∈z , p))) →
inj₁ ( ∈→∈∷ y∈z
, inj₁
( ( $⟨ x∈y∷z ⟩
x ∈ y ∷ z ↔⟨ ∈∷≃ ⟩
x ≡ y ∥⊎∥ x ∈ z ↝⟨ Trunc.∥∥-map P.[ (flip (subst (_∈ z)) y∈z ∘ sym) , id ] ⟩
∥ x ∈ z ∥ ↔⟨ Trunc.∥∥↔ ∈-propositional ⟩□
x ∈ z □)
, p
)
)
(suc n) (inj₁ (x∈y∷z , inj₂ (y∉z , p))) →
Trunc.rec (Cons′-propositional (Cons x z H) _)
P.[ (λ x≡y →
inj₁ ( ≡→∈∷ (sym x≡y)
, inj₂ ( (x ∈ z ↝⟨ subst (_∈ z) x≡y ⟩
y ∈ z ↝⟨ y∉z ⟩□
⊥ □)
, p
)
))
, (λ x∈z →
inj₂ ( (y ∈ x ∷ z ↔⟨ ∈∷≃ ⟩
y ≡ x ∥⊎∥ y ∈ z ↝⟨ Trunc.∥∥-map P.[ flip (subst (_∈ z)) x∈z ∘ sym , id ] ⟩
∥ y ∈ z ∥ ↝⟨ Trunc.∥∥-map y∉z ⟩
∥ ⊥ ∥ ↔⟨ Trunc.∥∥↔ ⊥-propositional ⟩□
⊥ □)
, inj₁ (x∈z , p)
))
]
(_≃_.to ∈∷≃ x∈y∷z)
(suc n) (inj₂ (x∉y∷z , inj₁ (y∈z , p))) →
inj₁ ( ∈→∈∷ y∈z
, inj₂ ( (x ∈ z ↝⟨ ∈→∈∷ ⟩
x ∈ y ∷ z ↝⟨ x∉y∷z ⟩□
⊥ □)
, p
)
)
(suc (suc n)) (inj₂ (x∉y∷z , inj₂ (y∉z , p))) →
inj₂ ( (y ∈ x ∷ z ↔⟨ ∈∷≃ ⟩
y ≡ x ∥⊎∥ y ∈ z ↝⟨ ≡→∈∷ ∘ sym Trunc.∥⊎∥-cong id ⟩
x ∈ y ∷ z ∥⊎∥ y ∈ z ↝⟨ Trunc.∥∥-map P.[ x∉y∷z , y∉z ] ⟩
∥ ⊥ ∥ ↔⟨ Trunc.∥∥↔ ⊥-propositional ⟩□
⊥ □)
, inj₂ ( (x ∈ z ↝⟨ ∈→∈∷ ⟩
x ∈ y ∷ z ↝⟨ x∉y∷z ⟩□
⊥ □)
, p
)
)
swap-lemma :
Cons′ x (y ∷ z) (Cons y z H) n ≃
Cons′ y (x ∷ z) (Cons x z H) n
swap-lemma {x = x} {y = y} {z = z} {H = H} {n = n} =
_↠_.from
(Eq.≃↠⇔
(Cons′-propositional _ _)
(Cons′-propositional _ _))
(record { to = swap-lemma′ _; from = swap-lemma′ _ })
r : Rec A (ℕ → Proposition a)
r .[]ʳ n = ↑ _ (n ≡ 0) , ↑-closure 1 ℕ-set
r .∷ʳ = Cons
r .dropʳ x y Hyp = ⟨ext⟩ λ _ →
_↔_.to (ignore-propositional-component
(H-level-propositional ext 1)) $
Univ.≃⇒≡ univ drop-lemma
r .swapʳ x y z Hyp = ⟨ext⟩ λ _ →
_↔_.to (ignore-propositional-component
(H-level-propositional ext 1)) $
Univ.≃⇒≡ univ swap-lemma
r .is-setʳ =
Π-closure ext 2 λ _ →
Univ.∃-H-level-H-level-1+ ext univ 1
-- Size.
infix 4 ∣_∣≡_
∣_∣≡_ : {A : Type a} → Finite-subset-of A → ℕ → Type a
∣ x ∣≡ n = proj₁ (Size x n)
-- The size predicate is propositional.
∣∣≡-propositional :
(x : Finite-subset-of A) → Is-proposition (∣ x ∣≡ n)
∣∣≡-propositional x = proj₂ (Size x _)
-- Unit tests documenting the computational behaviour of ∣_∣≡_.
_ : (∣ [] {A = A} ∣≡ n) ≡ ↑ _ (n ≡ 0)
_ = refl _
_ : ∀ {A : Type a} {x : A} {y} →
(∣ x ∷ y ∣≡ zero) ≡ (x ∈ y × ∣ y ∣≡ zero ⊎ ⊥)
_ = refl _
_ : (∣ x ∷ y ∣≡ suc n) ≡ (x ∈ y × ∣ y ∣≡ suc n ⊎ x ∉ y × ∣ y ∣≡ n)
_ = refl _
-- The size predicate is functional.
∣∣≡-functional :
(x : Finite-subset-of A) → ∣ x ∣≡ m → ∣ x ∣≡ n → m ≡ n
∣∣≡-functional x = elim-prop e x _ _
where
e : Elim-prop (λ x → ∀ m n → ∣ x ∣≡ m → ∣ x ∣≡ n → m ≡ n)
e .[]ʳ m n (lift m≡0) (lift n≡0) =
m ≡⟨ m≡0 ⟩
0 ≡⟨ sym n≡0 ⟩∎
n ∎
e .∷ʳ {y = y} x hyp = λ where
m n (inj₁ (x∈y , ∣y∣≡m)) (inj₁ (x∈y′ , ∣y∣≡n)) →
hyp m n ∣y∣≡m ∣y∣≡n
(suc m) (suc n) (inj₂ (x∉y , ∣y∣≡m)) (inj₂ (x∉y′ , ∣y∣≡n)) →
cong suc (hyp m n ∣y∣≡m ∣y∣≡n)
_ (suc _) (inj₁ (x∈y , _)) (inj₂ (x∉y , _)) → ⊥-elim (x∉y x∈y)
(suc _) _ (inj₂ (x∉y , _)) (inj₁ (x∈y , _)) → ⊥-elim (x∉y x∈y)
e .is-propositionʳ _ =
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
ℕ-set
-- If truncated equality is decidable, then one can compute the size
-- of a finite subset.
size :
((x y : A) → Dec ∥ x ≡ y ∥) →
(x : Finite-subset-of A) → ∃ λ n → ∣ x ∣≡ n
size equal? = elim-prop e
where
e : Elim-prop _
e .[]ʳ = 0 , lift (refl _)
e .∷ʳ {y = y} x (n , ∣y∣≡n) =
case member? equal? x y of λ x∈?y →
if x∈?y then n else suc n
, lemma ∣y∣≡n x∈?y
where
lemma :
∣ y ∣≡ n →
(x∈?y : Dec (x ∈ y)) →
∣ x ∷ y ∣≡ if x∈?y then n else suc n
lemma ∣y∣≡n (yes x∈y) = inj₁ (x∈y , ∣y∣≡n)
lemma ∣y∣≡n (no x∉y) = inj₂ (x∉y , ∣y∣≡n)
e .is-propositionʳ x (m , ∣x∣≡m) (n , ∣x∣≡n) =
Σ-≡,≡→≡ (m ≡⟨ ∣∣≡-functional x ∣x∣≡m ∣x∣≡n ⟩∎
n ∎)
(∣∣≡-propositional x _ _)
-- A variant of size that uses Erased.
sizeᴱ :
((x y : A) → Dec-Erased ∥ x ≡ y ∥) →
(x : Finite-subset-of A) → ∃ λ n → Erased (∣ x ∣≡ n)
sizeᴱ equal? = elim-prop e
where
e : Elim-prop _
e .[]ʳ = 0 , [ lift (refl _) ]
e .∷ʳ {y = y} x (n , [ ∣y∣≡n ]) =
case member?ᴱ equal? x y of λ x∈?y →
if x∈?y then n else suc n
, [ lemma ∣y∣≡n x∈?y ]
where
@0 lemma :
∣ y ∣≡ n →
(x∈?y : Dec-Erased (x ∈ y)) →
∣ x ∷ y ∣≡ if x∈?y then n else suc n
lemma ∣y∣≡n (yes [ x∈y ]) = inj₁ (x∈y , ∣y∣≡n)
lemma ∣y∣≡n (no [ x∉y ]) = inj₂ (x∉y , ∣y∣≡n)
e .is-propositionʳ x (m , [ ∣x∣≡m ]) (n , [ ∣x∣≡n ]) =
Σ-≡,≡→≡ (m ≡⟨ EC.Very-stable→Stable 1
(EC.Decidable-equality→Very-stable-≡ Nat._≟_)
_ _
[ ∣∣≡-functional x ∣x∣≡m ∣x∣≡n ] ⟩∎
n ∎)
(EC.H-level-Erased 1 (∣∣≡-propositional x) _ _)
------------------------------------------------------------------------
-- Finite types
-- A type is finite if there is some finite subset of the type for
-- which every element of the type is a member of the subset.
is-finite : Type a → Type a
is-finite A = ∃ λ (s : Finite-subset-of A) → ∀ x → x ∈ s
-- The is-finite predicate is propositional.
is-finite-propositional : Is-proposition (is-finite A)
is-finite-propositional (x , p) (y , q) =
$⟨ (λ z → record { to = λ _ → q z; from = λ _ → p z }) ⟩
(∀ z → z ∈ x ⇔ z ∈ y) ↔⟨ inverse extensionality ⟩
x ≡ y ↝⟨ ignore-propositional-component (Π-closure ext 1 (λ _ → ∈-propositional)) ⟩□
(x , p) ≡ (y , q) □
------------------------------------------------------------------------
-- Lists can be converted to finite subsets
-- Converts lists to finite subsets.
from-List : List A → Finite-subset-of A
from-List = L.foldr _∷_ []
-- Membership in the resulting set is equivalent to truncated
-- membership in the list.
∥∈∥≃∈-from-List : ∥ x BE.∈ ys ∥ ≃ (x ∈ from-List ys)
∥∈∥≃∈-from-List {x = x} {ys = ys} = _↠_.from
(Eq.≃↠⇔
Trunc.truncation-is-proposition
∈-propositional)
(record { to = to _; from = from _ })
where
to : ∀ ys → ∥ x BE.∈ ys ∥ → x ∈ from-List ys
to [] = Trunc.rec ∈-propositional (λ ())
to (y ∷ ys) = Trunc.rec ∈-propositional
P.[ ≡→∈∷ , ∈→∈∷ ∘ to ys ∘ ∣_∣ ]
from : ∀ ys → x ∈ from-List ys → ∥ x BE.∈ ys ∥
from [] ()
from (y ∷ ys) =
Trunc.rec
Trunc.truncation-is-proposition
P.[ ∣_∣ ∘ inj₁ , Trunc.∥∥-map inj₂ ∘ from ys ] ∘
_≃_.to ∈∷≃
------------------------------------------------------------------------
-- Some definitions related to the definitions in Bag-equivalence
-- Finite subsets can be expressed as lists quotiented by set
-- equivalence.
≃List/∼ : Finite-subset-of A ≃ List A / _∼[ set ]_
≃List/∼ = from-bijection (record
{ surjection = record
{ logical-equivalence = record
{ to = to
; from = from
}
; right-inverse-of = to∘from
}
; left-inverse-of = from∘to
})
where
cons : A → List A / _∼[ set ]_ → List A / _∼[ set ]_
cons x = (x ∷_) Q./-map λ _ _ → refl _ BE.∷-cong_
to : Finite-subset-of A → List A / _∼[ set ]_
to = rec r
where
r : Rec _ _
r .[]ʳ = Q.[ [] ]
r .∷ʳ x _ y = cons x y
r .is-setʳ = Q./-is-set
r .dropʳ x _ = Q.elim-prop λ where
.Q.[]ʳ xs → Q.[]-respects-relation λ z →
z BE.∈ x ∷ x ∷ xs ↝⟨ record { to = P.[ inj₁ , id ]; from = inj₂ } ⟩□
z BE.∈ x ∷ xs □
.Q.is-propositionʳ _ → Q./-is-set
r .swapʳ x y _ = Q.elim-prop λ where
.Q.[]ʳ xs → Q.[]-respects-relation λ z →
z BE.∈ x ∷ y ∷ xs ↔⟨ BE.swap-first-two z ⟩□
z BE.∈ y ∷ x ∷ xs □
.Q.is-propositionʳ _ → Q./-is-set
from : List A / _∼[ set ]_ → Finite-subset-of A
from {A = A} = Q.rec λ where
.Q.[]ʳ → from-List
.Q.[]-respects-relationʳ {x = xs} {y = ys} xs∼ys →
_≃_.from extensionality λ z →
z ∈ from-List xs ↔⟨ inverse ∥∈∥≃∈-from-List ⟩
∥ z BE.∈ xs ∥ ↔⟨ Trunc.∥∥-cong-⇔ {k = bijection} (xs∼ys z) ⟩
∥ z BE.∈ ys ∥ ↔⟨ ∥∈∥≃∈-from-List ⟩□
z ∈ from-List ys □
.Q.is-setʳ → is-set
to∘from : ∀ x → to (from x) ≡ x
to∘from = Q.elim-prop λ where
.Q.[]ʳ → lemma
.Q.is-propositionʳ _ → Q./-is-set
where
lemma : ∀ xs → to (from-List xs) ≡ Q.[ xs ]
lemma [] = refl _
lemma (x ∷ xs) =
to (from-List (x ∷ xs)) ≡⟨⟩
((x ∷_) Q./-map _) (to (from-List xs)) ≡⟨ cong ((x ∷_) Q./-map _) (lemma xs) ⟩
((x ∷_) Q./-map λ _ _ → refl _ BE.∷-cong_) Q.[ xs ] ≡⟨⟩
Q.[ x ∷ xs ] ∎
from∘to : ∀ x → from (to x) ≡ x
from∘to = elim-prop e
where
e : Elim-prop _
e .[]ʳ = refl _
e .∷ʳ {y = y} x hyp =
from (to (x ∷ y)) ≡⟨⟩
from (cons x (to y)) ≡⟨ Q.elim-prop
{P = λ y → from (cons x y) ≡ x ∷ from y}
(λ where
.Q.[]ʳ _ → refl _
.Q.is-propositionʳ _ → is-set)
(to y) ⟩
x ∷ from (to y) ≡⟨ cong (x ∷_) hyp ⟩∎
x ∷ y ∎
e .is-propositionʳ _ = is-set
-- A truncated variant of the proof-relevant membership relation from
-- Bag-equivalence can be expressed in terms of _∈_.
∥∈∥≃∈ : ∥ x BE.∈ ys ∥ ≃ (x ∈ _≃_.from ≃List/∼ Q.[ ys ])
∥∈∥≃∈ = ∥∈∥≃∈-from-List
------------------------------------------------------------------------
-- Fresh numbers
-- One can always find a natural number that is distinct from those in
-- a given finite set of natural numbers.
fresh :
(ns : Finite-subset-of ℕ) →
∃ λ (n : ℕ) → n ∉ ns
fresh ns =
Σ-map id
(λ {m} →
Erased (∀ n → n ∈ ns → n < m) ↝⟨ EC.map (_$ m) ⟩
Erased (m ∈ ns → m < m) ↝⟨ EC.map (∀-cong _ λ _ → Nat.+≮ 0) ⟩
Erased (m ∉ ns) ↝⟨ EC.Stable-¬ ⟩□
m ∉ ns □)
(elim e ns)
where
OK : @0 Finite-subset-of ℕ → @0 ℕ → Type
OK ms m = Erased (∀ n → n ∈ ms → n < m)
prop : Is-proposition (OK ms m)
prop =
EC.H-level-Erased 1 (
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
≤-propositional)
∷-max-suc :
∀ {ms n m} →
OK ms n →
OK (m ∷ ms) (Nat.max (suc m) n)
∷-max-suc {ms = ms} {n = n} {m = m} [ ub ] =
[ (λ o →
o ∈ m ∷ ms ↔⟨ ∈∷≃ ⟩
o ≡ m ∥⊎∥ o ∈ ms ↝⟨ Nat.≤-refl′ ∘ cong suc ∘ id Trunc.∥⊎∥-cong ub o ⟩
o Nat.< suc m ∥⊎∥ o Nat.< n ↝⟨ Trunc.rec ≤-propositional
P.[ flip Nat.≤-trans (Nat.ˡ≤max _ n)
, flip Nat.≤-trans (Nat.ʳ≤max (suc m) _)
] ⟩□
o Nat.< Nat.max (suc m) n □)
]
e : Elim (λ ms → ∃ λ m → OK ms m)
e .[]ʳ =
0 , [ (λ _ ()) ]
e .∷ʳ m (n , ub) =
Nat.max (suc m) n , ∷-max-suc ub
e .dropʳ {y = ns} m (n , ub) =
_↔_.to (ignore-propositional-component prop)
(proj₁ (subst (λ ms → ∃ λ m → OK ms m)
(drop {x = m} {y = ns})
( Nat.max (suc m) (Nat.max (suc m) n)
, ∷-max-suc (∷-max-suc ub)
)) ≡⟨ cong proj₁ $
push-subst-pair-× {y≡z = drop {x = m} {y = ns}} _
(λ (ms , m) → OK ms m)
{p = _ , ∷-max-suc (∷-max-suc ub)} ⟩
Nat.max (suc m) (Nat.max (suc m) n) ≡⟨ Nat.max-assoc (suc m) {n = suc m} {o = n} ⟩
Nat.max (Nat.max (suc m) (suc m)) n ≡⟨ cong (λ m → Nat.max m n) $ Nat.max-idempotent (suc m) ⟩∎
Nat.max (suc m) n ∎)
e .swapʳ {z = ns} m n (o , ub) =
_↔_.to (ignore-propositional-component prop)
(proj₁ (subst (λ xs → ∃ λ m → OK xs m)
(swap {x = m} {y = n} {z = ns})
( Nat.max (suc m) (Nat.max (suc n) o)
, ∷-max-suc (∷-max-suc ub)
)) ≡⟨ cong proj₁ $
push-subst-pair-× {y≡z = swap {x = m} {y = n} {z = ns}} _
(λ (ms , m) → OK ms m)
{p = _ , ∷-max-suc (∷-max-suc ub)} ⟩
Nat.max (suc m) (Nat.max (suc n) o) ≡⟨ Nat.max-assoc (suc m) {n = suc n} {o = o} ⟩
Nat.max (Nat.max (suc m) (suc n)) o ≡⟨ cong (λ m → Nat.max m o) $ Nat.max-comm (suc m) (suc n) ⟩
Nat.max (Nat.max (suc n) (suc m)) o ≡⟨ sym $ Nat.max-assoc (suc n) {n = suc m} {o = o} ⟩∎
Nat.max (suc n) (Nat.max (suc m) o) ∎)
e .is-setʳ _ =
Σ-closure 2 ℕ-set λ _ →
mono₁ 1 prop
|
data/pokemon/base_stats/mawile.asm | AtmaBuster/pokeplat-gen2 | 6 | 105474 | <gh_stars>1-10
db 0 ; species ID placeholder
db 50, 85, 85, 50, 55, 55
; hp atk def spd sat sdf
db STEEL, STEEL ; type
db 45 ; catch rate
db 98 ; base exp
db NO_ITEM, BERRY ; items
db GENDER_F50 ; gender ratio
db 20 ; step cycles to hatch
INCBIN "gfx/pokemon/mawile/front.dimensions"
db GROWTH_FAST ; growth rate
dn EGG_GROUND, EGG_FAIRY ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm FOCUS_PUNCH, TOXIC, HIDDEN_POWER, SUNNY_DAY, TAUNT, ICE_BEAM, HYPER_BEAM, PROTECT, RAIN_DANCE, FRUSTRATION, SOLARBEAM, RETURN, SHADOW_BALL, BRICK_BREAK, DOUBLE_TEAM, FLAMETHROWER, SLUDGE_BOMB, SANDSTORM, FIRE_BLAST, ROCK_TOMB, TORMENT, FACADE, SECRET_POWER, REST, ATTRACT, FOCUS_BLAST, FLING, CHARGE_BEAM, ENDURE, EMBARGO, PAYBACK, GIGA_IMPACT, SWORDS_DANCE, CAPTIVATE, DARK_PULSE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, GRASS_KNOT, SWAGGER, SUBSTITUTE, FLASH_CANNON, STRENGTH, ROCK_SMASH, ANCIENTPOWER, ICE_PUNCH, ICY_WIND, IRON_DEFENSE, IRON_HEAD, KNOCK_OFF, MAGNET_RISE, MUD_SLAP, SNORE, SUCKER_PUNCH, THUNDERPUNCH
; end
|
data/maps/objects/ViridianGym.asm | opiter09/ASM-Machina | 1 | 87810 | ViridianGym_Object:
db $3 ; border block
def_warps
warp 16, 17, 4, LAST_MAP
warp 17, 17, 4, LAST_MAP
def_signs
def_objects
object SPRITE_GIOVANNI, 2, 1, STAY, DOWN, 1, OPP_GIOVANNI, 3
object SPRITE_COOLTRAINER_M, 12, 7, STAY, DOWN, 2, OPP_COOLTRAINER_M, 9
object SPRITE_HIKER, 11, 11, STAY, UP, 3, OPP_BLACKBELT, 6
object SPRITE_ROCKER, 10, 7, STAY, DOWN, 4, OPP_TAMER, 3
object SPRITE_HIKER, 3, 7, STAY, LEFT, 5, OPP_BLACKBELT, 7
object SPRITE_COOLTRAINER_M, 13, 5, STAY, RIGHT, 6, OPP_COOLTRAINER_M, 10
object SPRITE_HIKER, 10, 1, STAY, DOWN, 7, OPP_BLACKBELT, 8
object SPRITE_ROCKER, 2, 16, STAY, RIGHT, 8, OPP_TAMER, 4
object SPRITE_COOLTRAINER_M, 6, 5, STAY, DOWN, 9, OPP_COOLTRAINER_M, 1
object SPRITE_GYM_GUIDE, 16, 15, STAY, DOWN, 10 ; person
object SPRITE_POKE_BALL, 16, 9, STAY, NONE, 11, REVIVE
def_warps_to VIRIDIAN_GYM
|
doc/icfp20/code/Main.agda | halfaya/MusicTools | 28 | 8370 | <reponame>halfaya/MusicTools
{-# OPTIONS --without-K #-}
module Main where
open import Data.List
open import Midi
open import Note
open import Frog
open import Piston
main : IO Unit
main =
let channel = 0
ticksPerBeat = 4 -- 16th notes
file = "/tmp/test.mid"
-- counterpoint
song = cfcpTracks1
-- song = cfcpTracks2
-- harmony
-- song = testHTracks
in exportTracks file ticksPerBeat (map track→htrack song)
|
Lab Assessment Submission/Lab Assessment 2/lA2.1_1812918642.asm | MohammadSakiL/CSE331L-Section-1-Fall20-NSU | 0 | 7342 | <filename>Lab Assessment Submission/Lab Assessment 2/lA2.1_1812918642.asm
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
A DB 5 DUP(?)
MOV BX,OFFSET ARRO
MOV [BX] ,1
MOV [BX+1] ,2
MOV [BX+2] ,3
MOV [BX+3] ,4
MOV [BX+4] ,5
ret
|
programs/oeis/046/A046670.asm | neoneye/loda | 22 | 17236 | ; A046670: Partial sums of A006530.
; 1,3,6,8,13,16,23,25,28,33,44,47,60,67,72,74,91,94,113,118,125,136,159,162,167,180,183,190,219,224,255,257,268,285,292,295,332,351,364,369,410,417,460,471,476,499,546,549,556,561,578,591,644,647,658,665,684,713,772,777,838,869,876,878,891,902,969,986,1009,1016,1087,1090,1163,1200,1205,1224,1235,1248,1327,1332,1335,1376,1459,1466,1483,1526,1555,1566,1655,1660,1673,1696,1727,1774,1793,1796,1893,1900,1911,1916
lpb $0
mov $2,$0
sub $0,1
seq $2,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
add $1,$2
lpe
add $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c94004b.ada | best08618/asylo | 7 | 10974 | -- C94004B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT A MAIN PROGRAM TERMINATES WITHOUT WAITING FOR TASKS THAT
-- DEPEND ON A LIBRARY PACKAGE AND THAT SUCH TASKS ARE NOT TERMINATED BY
-- MAIN PROGRAM TERMINATION.
-- CASE B: ACCESS TO TASK TYPE DECLARED IN LIBRARY PACKAGE; TASK
-- ACTIVATED IN MAIN PROGRAM.
-- JRK 10/8/81
-- SPS 11/21/82
-- JBG 12/6/84
-- JRK 11/21/85 RENAMED FROM C94004B-B.ADA; REVISED ACCORDING TO
-- AI-00399.
-- JRK 10/24/86 RENAMED FROM E94004B-B.ADA; REVISED ACCORDING TO
-- REVISED AI-00399.
-- PWN 09/11/94 REMOVED PRAGMA PRIORITY FOR ADA 9X.
WITH SYSTEM; USE SYSTEM;
PACKAGE C94004B_PKG IS
TASK TYPE TT IS
ENTRY E;
END TT;
END C94004B_PKG;
with Impdef;
WITH REPORT; USE REPORT;
PRAGMA ELABORATE (REPORT);
PACKAGE BODY C94004B_PKG IS
TASK BODY TT IS
I : INTEGER := IDENT_INT (120);
BEGIN
ACCEPT E;
COMMENT ("DELAY LIBRARY TASK FOR TWO MINUTES");
DELAY DURATION(I) * Impdef.One_Second;
-- MAIN PROGRAM SHOULD NOW BE TERMINATED.
RESULT;
END TT;
END C94004B_PKG;
WITH C94004B_PKG; USE C94004B_PKG;
PRAGMA ELABORATE (C94004B_PKG);
PACKAGE C94004B_TASK IS
TYPE ACC_TASK IS ACCESS C94004B_PKG.TT;
END;
WITH SYSTEM; USE SYSTEM;
WITH REPORT; USE REPORT;
WITH C94004B_TASK; WITH C94004B_PKG;
PROCEDURE C94004B IS
T : C94004B_TASK.ACC_TASK;
BEGIN
TEST ("C94004B", "CHECK THAT A MAIN PROGRAM TERMINATES " &
"WITHOUT WAITING FOR TASKS THAT DEPEND " &
"ON A LIBRARY PACKAGE AND THAT SUCH TASKS " &
"CONTINUE TO EXECUTE");
COMMENT ("THE INVOKING SYSTEM'S JOB CONTROL LOG MUST BE " &
"EXAMINED TO SEE IF THIS TEST REALLY TERMINATES");
T := NEW C94004B_PKG.TT;
T.E; -- ALLOW TASK TO PROCEED.
IF T'TERMINATED THEN
FAILED ("LIBRARY DECLARED TASK PREMATURELY TERMINATED");
END IF;
-- RESULT PROCEDURE IS CALLED BY LIBRARY TASK.
END C94004B;
|
vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm | mrchapp/libvpx | 1 | 26367 | <reponame>mrchapp/libvpx
;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_sub_pixel_variance16x16s_4_0_neon|
EXPORT |vp8_sub_pixel_variance16x16s_0_4_neon|
EXPORT |vp8_sub_pixel_variance16x16s_4_4_neon|
EXPORT |vp8_sub_pixel_variance16x16s_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
;================================================
;unsigned int vp8_sub_pixel_variance16x16s_4_0_neon
;(
; unsigned char *src_ptr, r0
; int src_pixels_per_line, r1
; unsigned char *dst_ptr, r2
; int dst_pixels_per_line, r3
; unsigned int *sse
;);
;================================================
|vp8_sub_pixel_variance16x16s_4_0_neon| PROC
push {lr}
mov r12, #4 ;loop counter
ldr lr, [sp, #4] ;load *sse from stack
vmov.i8 q8, #0 ;q8 - sum
vmov.i8 q9, #0 ;q9, q10 - sse
vmov.i8 q10, #0
;First Pass: output_height lines x output_width columns (16x16)
vp8_filt_fpo16x16s_4_0_loop_neon
vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
vld1.8 {q11}, [r2], r3
vld1.u8 {d4, d5, d6, d7}, [r0], r1
vld1.8 {q12}, [r2], r3
vld1.u8 {d8, d9, d10, d11}, [r0], r1
vld1.8 {q13}, [r2], r3
vld1.u8 {d12, d13, d14, d15}, [r0], r1
;pld [r0]
;pld [r0, r1]
;pld [r0, r1, lsl #1]
vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
vext.8 q3, q2, q3, #1
vext.8 q5, q4, q5, #1
vext.8 q7, q6, q7, #1
vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
vld1.8 {q14}, [r2], r3
vrhadd.u8 q1, q2, q3
vrhadd.u8 q2, q4, q5
vrhadd.u8 q3, q6, q7
vsubl.u8 q4, d0, d22 ;diff
vsubl.u8 q5, d1, d23
vsubl.u8 q6, d2, d24
vsubl.u8 q7, d3, d25
vsubl.u8 q0, d4, d26
vsubl.u8 q1, d5, d27
vsubl.u8 q2, d6, d28
vsubl.u8 q3, d7, d29
vpadal.s16 q8, q4 ;sum
vmlal.s16 q9, d8, d8 ;sse
vmlal.s16 q10, d9, d9
subs r12, r12, #1
vpadal.s16 q8, q5
vmlal.s16 q9, d10, d10
vmlal.s16 q10, d11, d11
vpadal.s16 q8, q6
vmlal.s16 q9, d12, d12
vmlal.s16 q10, d13, d13
vpadal.s16 q8, q7
vmlal.s16 q9, d14, d14
vmlal.s16 q10, d15, d15
vpadal.s16 q8, q0 ;sum
vmlal.s16 q9, d0, d0 ;sse
vmlal.s16 q10, d1, d1
vpadal.s16 q8, q1
vmlal.s16 q9, d2, d2
vmlal.s16 q10, d3, d3
vpadal.s16 q8, q2
vmlal.s16 q9, d4, d4
vmlal.s16 q10, d5, d5
vpadal.s16 q8, q3
vmlal.s16 q9, d6, d6
vmlal.s16 q10, d7, d7
bne vp8_filt_fpo16x16s_4_0_loop_neon
vadd.u32 q10, q9, q10 ;accumulate sse
vpaddl.s32 q0, q8 ;accumulate sum
vpaddl.u32 q1, q10
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [lr] ;store sse
vshr.s32 d10, d10, #8
vsub.s32 d0, d1, d10
vmov.32 r0, d0[0] ;return
pop {pc}
ENDP
;================================================
;unsigned int vp8_sub_pixel_variance16x16s_0_4_neon
;(
; unsigned char *src_ptr, r0
; int src_pixels_per_line, r1
; unsigned char *dst_ptr, r2
; int dst_pixels_per_line, r3
; unsigned int *sse
;);
;================================================
|vp8_sub_pixel_variance16x16s_0_4_neon| PROC
push {lr}
mov r12, #4 ;loop counter
vld1.u8 {q0}, [r0], r1 ;load src data
ldr lr, [sp, #4] ;load *sse from stack
vmov.i8 q8, #0 ;q8 - sum
vmov.i8 q9, #0 ;q9, q10 - sse
vmov.i8 q10, #0
vp8_filt_spo16x16s_0_4_loop_neon
vld1.u8 {q2}, [r0], r1
vld1.8 {q1}, [r2], r3
vld1.u8 {q4}, [r0], r1
vld1.8 {q3}, [r2], r3
vld1.u8 {q6}, [r0], r1
vld1.8 {q5}, [r2], r3
vld1.u8 {q15}, [r0], r1
vrhadd.u8 q0, q0, q2
vld1.8 {q7}, [r2], r3
vrhadd.u8 q2, q2, q4
vrhadd.u8 q4, q4, q6
vrhadd.u8 q6, q6, q15
vsubl.u8 q11, d0, d2 ;diff
vsubl.u8 q12, d1, d3
vsubl.u8 q13, d4, d6
vsubl.u8 q14, d5, d7
vsubl.u8 q0, d8, d10
vsubl.u8 q1, d9, d11
vsubl.u8 q2, d12, d14
vsubl.u8 q3, d13, d15
vpadal.s16 q8, q11 ;sum
vmlal.s16 q9, d22, d22 ;sse
vmlal.s16 q10, d23, d23
subs r12, r12, #1
vpadal.s16 q8, q12
vmlal.s16 q9, d24, d24
vmlal.s16 q10, d25, d25
vpadal.s16 q8, q13
vmlal.s16 q9, d26, d26
vmlal.s16 q10, d27, d27
vpadal.s16 q8, q14
vmlal.s16 q9, d28, d28
vmlal.s16 q10, d29, d29
vpadal.s16 q8, q0 ;sum
vmlal.s16 q9, d0, d0 ;sse
vmlal.s16 q10, d1, d1
vpadal.s16 q8, q1
vmlal.s16 q9, d2, d2
vmlal.s16 q10, d3, d3
vpadal.s16 q8, q2
vmlal.s16 q9, d4, d4
vmlal.s16 q10, d5, d5
vmov q0, q15
vpadal.s16 q8, q3
vmlal.s16 q9, d6, d6
vmlal.s16 q10, d7, d7
bne vp8_filt_spo16x16s_0_4_loop_neon
vadd.u32 q10, q9, q10 ;accumulate sse
vpaddl.s32 q0, q8 ;accumulate sum
vpaddl.u32 q1, q10
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [lr] ;store sse
vshr.s32 d10, d10, #8
vsub.s32 d0, d1, d10
vmov.32 r0, d0[0] ;return
pop {pc}
ENDP
;================================================
;unsigned int vp8_sub_pixel_variance16x16s_4_4_neon
;(
; unsigned char *src_ptr, r0
; int src_pixels_per_line, r1
; unsigned char *dst_ptr, r2
; int dst_pixels_per_line, r3
; unsigned int *sse
;);
;================================================
|vp8_sub_pixel_variance16x16s_4_4_neon| PROC
push {lr}
vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
ldr lr, [sp, #4] ;load *sse from stack
vmov.i8 q13, #0 ;q8 - sum
vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
vmov.i8 q14, #0 ;q9, q10 - sse
vmov.i8 q15, #0
mov r12, #4 ;loop counter
vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
;First Pass: output_height lines x output_width columns (17x16)
vp8_filt16x16s_4_4_loop_neon
vld1.u8 {d4, d5, d6, d7}, [r0], r1
vld1.u8 {d8, d9, d10, d11}, [r0], r1
vld1.u8 {d12, d13, d14, d15}, [r0], r1
vld1.u8 {d16, d17, d18, d19}, [r0], r1
;pld [r0]
;pld [r0, r1]
;pld [r0, r1, lsl #1]
vext.8 q3, q2, q3, #1 ;construct src_ptr[1]
vext.8 q5, q4, q5, #1
vext.8 q7, q6, q7, #1
vext.8 q9, q8, q9, #1
vrhadd.u8 q1, q2, q3 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
vrhadd.u8 q2, q4, q5
vrhadd.u8 q3, q6, q7
vrhadd.u8 q4, q8, q9
vld1.8 {q5}, [r2], r3
vrhadd.u8 q0, q0, q1
vld1.8 {q6}, [r2], r3
vrhadd.u8 q1, q1, q2
vld1.8 {q7}, [r2], r3
vrhadd.u8 q2, q2, q3
vld1.8 {q8}, [r2], r3
vrhadd.u8 q3, q3, q4
vsubl.u8 q9, d0, d10 ;diff
vsubl.u8 q10, d1, d11
vsubl.u8 q11, d2, d12
vsubl.u8 q12, d3, d13
vsubl.u8 q0, d4, d14 ;diff
vsubl.u8 q1, d5, d15
vsubl.u8 q5, d6, d16
vsubl.u8 q6, d7, d17
vpadal.s16 q13, q9 ;sum
vmlal.s16 q14, d18, d18 ;sse
vmlal.s16 q15, d19, d19
vpadal.s16 q13, q10 ;sum
vmlal.s16 q14, d20, d20 ;sse
vmlal.s16 q15, d21, d21
vpadal.s16 q13, q11 ;sum
vmlal.s16 q14, d22, d22 ;sse
vmlal.s16 q15, d23, d23
vpadal.s16 q13, q12 ;sum
vmlal.s16 q14, d24, d24 ;sse
vmlal.s16 q15, d25, d25
subs r12, r12, #1
vpadal.s16 q13, q0 ;sum
vmlal.s16 q14, d0, d0 ;sse
vmlal.s16 q15, d1, d1
vpadal.s16 q13, q1 ;sum
vmlal.s16 q14, d2, d2 ;sse
vmlal.s16 q15, d3, d3
vpadal.s16 q13, q5 ;sum
vmlal.s16 q14, d10, d10 ;sse
vmlal.s16 q15, d11, d11
vmov q0, q4
vpadal.s16 q13, q6 ;sum
vmlal.s16 q14, d12, d12 ;sse
vmlal.s16 q15, d13, d13
bne vp8_filt16x16s_4_4_loop_neon
vadd.u32 q15, q14, q15 ;accumulate sse
vpaddl.s32 q0, q13 ;accumulate sum
vpaddl.u32 q1, q15
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [lr] ;store sse
vshr.s32 d10, d10, #8
vsub.s32 d0, d1, d10
vmov.32 r0, d0[0] ;return
pop {pc}
ENDP
;==============================
; r0 unsigned char *src_ptr,
; r1 int src_pixels_per_line,
; r2 int xoffset,
; r3 int yoffset,
; stack unsigned char *dst_ptr,
; stack int dst_pixels_per_line,
; stack unsigned int *sse
;note: in vp8_find_best_half_pixel_step()(called when 8<Speed<15), and first call of vp8_find_best_sub_pixel_step()
;(called when speed<=8). xoffset/yoffset can only be 4 or 0, which means either by pass the filter,
;or filter coeff is {64, 64}. This simplified program only works in this situation.
;note: It happens that both xoffset and yoffset are zero. This can be handled in c code later.
|vp8_sub_pixel_variance16x16s_neon| PROC
push {r4, lr}
ldr r4, [sp, #8] ;load *dst_ptr from stack
ldr r12, [sp, #12] ;load dst_pixels_per_line from stack
ldr lr, [sp, #16] ;load *sse from stack
cmp r2, #0 ;skip first_pass filter if xoffset=0
beq secondpass_bfilter16x16s_only
cmp r3, #0 ;skip second_pass filter if yoffset=0
beq firstpass_bfilter16x16s_only
vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
sub sp, sp, #256 ;reserve space on stack for temporary storage
vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
mov r3, sp
mov r2, #4 ;loop counter
vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
;First Pass: output_height lines x output_width columns (17x16)
vp8e_filt_blk2d_fp16x16s_loop_neon
vld1.u8 {d4, d5, d6, d7}, [r0], r1
vld1.u8 {d8, d9, d10, d11}, [r0], r1
vld1.u8 {d12, d13, d14, d15}, [r0], r1
vld1.u8 {d16, d17, d18, d19}, [r0], r1
;pld [r0]
;pld [r0, r1]
;pld [r0, r1, lsl #1]
vext.8 q3, q2, q3, #1 ;construct src_ptr[1]
vext.8 q5, q4, q5, #1
vext.8 q7, q6, q7, #1
vext.8 q9, q8, q9, #1
vrhadd.u8 q1, q2, q3 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
vrhadd.u8 q2, q4, q5
vrhadd.u8 q3, q6, q7
vrhadd.u8 q4, q8, q9
vrhadd.u8 q0, q0, q1
vrhadd.u8 q1, q1, q2
vrhadd.u8 q2, q2, q3
vrhadd.u8 q3, q3, q4
subs r2, r2, #1
vst1.u8 {d0, d1 ,d2, d3}, [r3]! ;store result
vmov q0, q4
vst1.u8 {d4, d5, d6, d7}, [r3]!
bne vp8e_filt_blk2d_fp16x16s_loop_neon
b sub_pixel_variance16x16s_neon
;--------------------
firstpass_bfilter16x16s_only
mov r2, #2 ;loop counter
sub sp, sp, #256 ;reserve space on stack for temporary storage
mov r3, sp
;First Pass: output_height lines x output_width columns (16x16)
vp8e_filt_blk2d_fpo16x16s_loop_neon
vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
vld1.u8 {d4, d5, d6, d7}, [r0], r1
vld1.u8 {d8, d9, d10, d11}, [r0], r1
vld1.u8 {d12, d13, d14, d15}, [r0], r1
;pld [r0]
;pld [r0, r1]
;pld [r0, r1, lsl #1]
vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
vld1.u8 {d16, d17, d18, d19}, [r0], r1
vext.8 q3, q2, q3, #1
vld1.u8 {d20, d21, d22, d23}, [r0], r1
vext.8 q5, q4, q5, #1
vld1.u8 {d24, d25, d26, d27}, [r0], r1
vext.8 q7, q6, q7, #1
vld1.u8 {d28, d29, d30, d31}, [r0], r1
vext.8 q9, q8, q9, #1
vext.8 q11, q10, q11, #1
vext.8 q13, q12, q13, #1
vext.8 q15, q14, q15, #1
vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
vrhadd.u8 q1, q2, q3
vrhadd.u8 q2, q4, q5
vrhadd.u8 q3, q6, q7
vrhadd.u8 q4, q8, q9
vrhadd.u8 q5, q10, q11
vrhadd.u8 q6, q12, q13
vrhadd.u8 q7, q14, q15
subs r2, r2, #1
vst1.u8 {d0, d1, d2, d3}, [r3]! ;store result
vst1.u8 {d4, d5, d6, d7}, [r3]!
vst1.u8 {d8, d9, d10, d11}, [r3]!
vst1.u8 {d12, d13, d14, d15}, [r3]!
bne vp8e_filt_blk2d_fpo16x16s_loop_neon
b sub_pixel_variance16x16s_neon
;---------------------
secondpass_bfilter16x16s_only
sub sp, sp, #256 ;reserve space on stack for temporary storage
mov r2, #2 ;loop counter
vld1.u8 {d0, d1}, [r0], r1 ;load src data
mov r3, sp
vp8e_filt_blk2d_spo16x16s_loop_neon
vld1.u8 {d2, d3}, [r0], r1
vld1.u8 {d4, d5}, [r0], r1
vld1.u8 {d6, d7}, [r0], r1
vld1.u8 {d8, d9}, [r0], r1
vrhadd.u8 q0, q0, q1
vld1.u8 {d10, d11}, [r0], r1
vrhadd.u8 q1, q1, q2
vld1.u8 {d12, d13}, [r0], r1
vrhadd.u8 q2, q2, q3
vld1.u8 {d14, d15}, [r0], r1
vrhadd.u8 q3, q3, q4
vld1.u8 {d16, d17}, [r0], r1
vrhadd.u8 q4, q4, q5
vrhadd.u8 q5, q5, q6
vrhadd.u8 q6, q6, q7
vrhadd.u8 q7, q7, q8
subs r2, r2, #1
vst1.u8 {d0, d1, d2, d3}, [r3]! ;store result
vmov q0, q8
vst1.u8 {d4, d5, d6, d7}, [r3]!
vst1.u8 {d8, d9, d10, d11}, [r3]! ;store result
vst1.u8 {d12, d13, d14, d15}, [r3]!
bne vp8e_filt_blk2d_spo16x16s_loop_neon
b sub_pixel_variance16x16s_neon
;----------------------------
;variance16x16
sub_pixel_variance16x16s_neon
vmov.i8 q8, #0 ;q8 - sum
vmov.i8 q9, #0 ;q9, q10 - sse
vmov.i8 q10, #0
sub r3, r3, #256
mov r2, #4
sub_pixel_variance16x16s_neon_loop
vld1.8 {q0}, [r3]! ;Load up source and reference
vld1.8 {q1}, [r4], r12
vld1.8 {q2}, [r3]!
vld1.8 {q3}, [r4], r12
vld1.8 {q4}, [r3]!
vld1.8 {q5}, [r4], r12
vld1.8 {q6}, [r3]!
vld1.8 {q7}, [r4], r12
vsubl.u8 q11, d0, d2 ;diff
vsubl.u8 q12, d1, d3
vsubl.u8 q13, d4, d6
vsubl.u8 q14, d5, d7
vsubl.u8 q0, d8, d10
vsubl.u8 q1, d9, d11
vsubl.u8 q2, d12, d14
vsubl.u8 q3, d13, d15
vpadal.s16 q8, q11 ;sum
vmlal.s16 q9, d22, d22 ;sse
vmlal.s16 q10, d23, d23
subs r2, r2, #1
vpadal.s16 q8, q12
vmlal.s16 q9, d24, d24
vmlal.s16 q10, d25, d25
vpadal.s16 q8, q13
vmlal.s16 q9, d26, d26
vmlal.s16 q10, d27, d27
vpadal.s16 q8, q14
vmlal.s16 q9, d28, d28
vmlal.s16 q10, d29, d29
vpadal.s16 q8, q0 ;sum
vmlal.s16 q9, d0, d0 ;sse
vmlal.s16 q10, d1, d1
vpadal.s16 q8, q1
vmlal.s16 q9, d2, d2
vmlal.s16 q10, d3, d3
vpadal.s16 q8, q2
vmlal.s16 q9, d4, d4
vmlal.s16 q10, d5, d5
vpadal.s16 q8, q3
vmlal.s16 q9, d6, d6
vmlal.s16 q10, d7, d7
bne sub_pixel_variance16x16s_neon_loop
vadd.u32 q10, q9, q10 ;accumulate sse
vpaddl.s32 q0, q8 ;accumulate sum
vpaddl.u32 q1, q10
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [lr] ;store sse
vshr.s32 d10, d10, #8
vsub.s32 d0, d1, d10
add sp, sp, #256
vmov.32 r0, d0[0] ;return
pop {r4, pc}
ENDP
END
|
programs/oeis/010/A010060.asm | jmorken/loda | 1 | 241695 | ; A010060: Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 0 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's.
; 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0
lpb $0
add $1,$0
div $0,2
lpe
mod $1,2
|
3-mid/impact/source/3d/dynamics/impact-d3-space-dynamic-simple.adb | charlie5/lace | 20 | 19851 | <reponame>charlie5/lace<filename>3-mid/impact/source/3d/dynamics/impact-d3-space-dynamic-simple.adb<gh_stars>10-100
package body impact.d3.Space.dynamic.simple is
overriding function stepSimulation (Self : access Item;
timeStep : in Real;
maxSubSteps : in Integer := 1;
fixedTimeStep : in Real := 1.0 / 60.0) return Integer
is
pragma Unreferenced (Self, timeStep, maxSubSteps, fixedTimeStep);
Stub : Integer;
begin
return Stub;
end stepSimulation;
overriding procedure setGravity (Self : in out Item;
gravity : in Vector_3)
is
begin
-- Self.m_gravity := gravity;
-- for I in 1 .. Integer (Self.get_m_collisionObjects.Length) loop
-- declare
-- colObj : impact.d3.Object_view := Self.m_get_collisionObject.Element (I).all'access;
-- the_body : impact.d3.Object.rigid_view := impact.d3.Object.rigid_view (colObj);
-- begin
-- if the_body /= null then
-- the_body.setGravity (gravity);
-- end if;
-- end;
-- end loop;
null;
end setGravity;
-- void impact.d3.Space.dynamic.simple::setGravity(const impact.d3.Vector& gravity)
-- {
-- m_gravity = gravity;
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body)
-- {
-- body->setGravity(gravity);
-- }
-- }
-- }
overriding function getGravity (Self : in Item) return Vector_3
is
begin
return Self.m_gravity;
end getGravity;
-- impact.d3.Vector impact.d3.Space.dynamic.simple::getGravity () const
-- {
-- return m_gravity;
-- }
overriding procedure addRigidBody (Self : in out Item;
the_body : access impact.d3.Object.rigid.Item'Class)
is
begin
null;
end addRigidBody;
procedure addRigidBody (the_body : access impact.d3.Object.rigid.Item'Class;
group, mask : in Flags )
is
begin
null;
end addRigidBody;
procedure removeRigidBody (Self : in out Item;
the_body : access impact.d3.Object.rigid.Item'Class)
is
begin
Self.removeCollisionObject (the_body);
end removeRigidBody;
-- void impact.d3.Space.dynamic.simple::removeRigidBody(impact.d3.Object.rigid* body)
-- {
-- impact.d3.Space::removeCollisionObject(body);
-- }
procedure debugDrawWorld (Self : in out Item)
is
begin
null;
end debugDrawWorld;
-- void impact.d3.Space.dynamic.simple::debugDrawWorld()
-- {
-- }
--- tbd: leave these for the time being (rak) ...
--
-- procedure addAction (Self : in out Item;
-- action : access impact.d3.Action.Item'Class) is begin null; end addAction;
-- void impact.d3.Space.dynamic.simple::addAction(impact.d3.Action* action)
-- {
-- }
--
-- procedure removeAction (Self : in out Item;
-- action : access impact.d3.Action.Item'Class) is begin null; end removeAction;
-- void impact.d3.Space.dynamic.simple::removeAction(impact.d3.Action* action)
-- {
-- }
procedure removeCollisionObject (Self : in out Item;
collisionObject : access impact.d3.Object.view)
is
-- the_body : impact.d3.Object.rigid_view := impact.d3.Object.rigid_view (collisionObject);
begin
-- if the_body /= null then
-- Self.removeRigidBody (the_body);
-- else
-- Self.removeCollisionObject (collisionObject);
-- end if;
null;
end removeCollisionObject;
-- void impact.d3.Space.dynamic.simple::removeCollisionObject(impact.d3.Object* collisionObject)
-- {
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(collisionObject);
-- if (body)
-- removeRigidBody(body);
-- else
-- impact.d3.Space::removeCollisionObject(collisionObject);
-- }
overriding procedure updateAabbs (Self : in out Item)
is
begin
null;
end updateAabbs;
overriding procedure synchronizeMotionStates (Self : in out Item)
is
begin
null;
end synchronizeMotionStates;
procedure setConstraintSolver (solver : access impact.d3.constraint_Solver.Item'Class)
is
begin
null;
end setConstraintSolver;
overriding function getConstraintSolver (Self : in Item) return access impact.d3.constraint_Solver.Item'Class
is
pragma Unreferenced (Self);
Stub : impact.d3.constraint_Solver.view;
begin
return Stub;
end getConstraintSolver;
overriding function getWorldType (Self : in Item) return impact.d3.Space.dynamic.Kind
is
pragma Unreferenced (Self);
Stub : impact.d3.Space.dynamic.Kind;
begin
return Stub;
end getWorldType;
overriding procedure clearForces (Self : in out Item)
is
begin
null;
end clearForces;
procedure predictUnconstraintMotion (Self : in out Item;
timeStep : in Real)
is
begin
null;
end predictUnconstraintMotion;
procedure integrateTransforms (Self : in out Item;
timeStep : in Real)
is
begin
null;
end integrateTransforms;
end impact.d3.Space.dynamic.simple;
-- #include "impact.d3.Space.dynamic.simple.h"
-- #include "BulletCollision/CollisionDispatch/impact.d3.Dispatcher.collision.h"
-- #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
-- #include "BulletCollision/CollisionShapes/impact.d3.Shape.h"
-- #include "BulletDynamics/Dynamics/impact.d3.Object.rigid.h"
-- #include "BulletDynamics/ConstraintSolver/impact.d3.constraint_Solver.sequential_impulse.h"
-- #include "BulletDynamics/ConstraintSolver/impact.d3.contact_solver_Info.h"
-- /*
-- Make sure this dummy function never changes so that it
-- can be used by probes that are checking whether the
-- library is actually installed.
-- */
-- extern "C"
-- {
-- void btBulletDynamicsProbe ();
-- void btBulletDynamicsProbe () {}
-- }
-- impact.d3.Space.dynamic.simple::impact.d3.Space.dynamic.simple(impact.d3.Dispatcher* dispatcher,impact.d3.collision.Broadphase* pairCache,impact.d3.constraint_Solver* constraintSolver,impact.d3.collision.Configuration* collisionConfiguration)
-- :impact.d3.Space.dynamic(dispatcher,pairCache,collisionConfiguration),
-- m_constraintSolver(constraintSolver),
-- m_ownsConstraintSolver(false),
-- m_gravity(0,0,-10)
-- {
-- }
-- impact.d3.Space.dynamic.simple::~impact.d3.Space.dynamic.simple()
-- {
-- if (m_ownsConstraintSolver)
-- btAlignedFree( m_constraintSolver);
-- }
-- int impact.d3.Space.dynamic.simple::stepSimulation( impact.d3.Scalar timeStep,int maxSubSteps, impact.d3.Scalar fixedTimeStep)
-- {
-- (void)fixedTimeStep;
-- (void)maxSubSteps;
-- ///apply gravity, predict motion
-- predictUnconstraintMotion(timeStep);
-- impact.d3.DispatcherInfo& dispatchInfo = getDispatchInfo();
-- dispatchInfo.m_timeStep = timeStep;
-- dispatchInfo.m_stepCount = 0;
-- dispatchInfo.m_debugDraw = getDebugDrawer();
-- ///perform collision detection
-- performDiscreteCollisionDetection();
-- ///solve contact constraints
-- int numManifolds = m_dispatcher1->getNumManifolds();
-- if (numManifolds)
-- {
-- impact.d3.Manifold** manifoldPtr = ((impact.d3.Dispatcher.collision*)m_dispatcher1)->getInternalManifoldPointer();
-- impact.d3.contact_solver_Info infoGlobal;
-- infoGlobal.m_timeStep = timeStep;
-- m_constraintSolver->prepareSolve(0,numManifolds);
-- m_constraintSolver->solveGroup(&getCollisionObjectArray()[0],getNumCollisionObjects(),manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1);
-- m_constraintSolver->allSolved(infoGlobal,m_debugDrawer, m_stackAlloc);
-- }
-- ///integrate transforms
-- integrateTransforms(timeStep);
-- updateAabbs();
-- synchronizeMotionStates();
-- clearForces();
-- return 1;
-- }
-- void impact.d3.Space.dynamic.simple::clearForces()
-- {
-- ///@todo: iterate over awake simulation islands!
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body)
-- {
-- body->clearForces();
-- }
-- }
-- }
-- void impact.d3.Space.dynamic.simple::addRigidBody(impact.d3.Object.rigid* body)
-- {
-- body->setGravity(m_gravity);
-- if (body->getCollisionShape())
-- {
-- addCollisionObject(body);
-- }
-- }
-- void impact.d3.Space.dynamic.simple::addRigidBody(impact.d3.Object.rigid* body, short group, short mask)
-- {
-- body->setGravity(m_gravity);
-- if (body->getCollisionShape())
-- {
-- addCollisionObject(body,group,mask);
-- }
-- }
-- void impact.d3.Space.dynamic.simple::updateAabbs()
-- {
-- impact.d3.Transform predictedTrans;
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body)
-- {
-- if (body->isActive() && (!body->isStaticObject()))
-- {
-- impact.d3.Vector minAabb,maxAabb;
-- colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
-- impact.d3.collision.Broadphase* bp = getBroadphase();
-- bp->setAabb(body->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
-- }
-- }
-- }
-- }
-- void impact.d3.Space.dynamic.simple::integrateTransforms(impact.d3.Scalar timeStep)
-- {
-- impact.d3.Transform predictedTrans;
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body)
-- {
-- if (body->isActive() && (!body->isStaticObject()))
-- {
-- body->predictIntegratedTransform(timeStep, predictedTrans);
-- body->proceedToTransform( predictedTrans);
-- }
-- }
-- }
-- }
-- void impact.d3.Space.dynamic.simple::predictUnconstraintMotion(impact.d3.Scalar timeStep)
-- {
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body)
-- {
-- if (!body->isStaticObject())
-- {
-- if (body->isActive())
-- {
-- body->applyGravity();
-- body->integrateVelocities( timeStep);
-- body->applyDamping(timeStep);
-- body->predictIntegratedTransform(timeStep,body->getInterpolationWorldTransform());
-- }
-- }
-- }
-- }
-- }
-- void impact.d3.Space.dynamic.simple::synchronizeMotionStates()
-- {
-- ///@todo: iterate over awake simulation islands!
-- for ( int i=0;i<m_collisionObjects.size();i++)
-- {
-- impact.d3.Object* colObj = m_collisionObjects[i];
-- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj);
-- if (body && body->getMotionState())
-- {
-- if (body->getActivationState() != ISLAND_SLEEPING)
-- {
-- body->getMotionState()->setWorldTransform(body->getWorldTransform());
-- }
-- }
-- }
-- }
-- void impact.d3.Space.dynamic.simple::setConstraintSolver(impact.d3.constraint_Solver* solver)
-- {
-- if (m_ownsConstraintSolver)
-- {
-- btAlignedFree(m_constraintSolver);
-- }
-- m_ownsConstraintSolver = false;
-- m_constraintSolver = solver;
-- }
-- impact.d3.constraint_Solver* impact.d3.Space.dynamic.simple::getConstraintSolver()
-- {
-- return m_constraintSolver;
-- }
|
stress/sparknacl-tests.adb | yannickmoy/SPARKNaCl | 76 | 305 | <gh_stars>10-100
with SPARKNaCl.PDebug;
with SPARKNaCl.Debug;
with SPARKNaCl.Utils;
with SPARKNaCl.Car;
with Ada.Text_IO; use Ada.Text_IO;
package body SPARKNaCl.Tests
is
GF_2 : constant Normal_GF := (2, others => 0);
P : constant Normal_GF := (0 => 16#FFED#,
15 => 16#7FFF#,
others => 16#FFFF#);
P_Minus_1 : constant Normal_GF := (0 => 16#FFEC#,
15 => 16#7FFF#,
others => 16#FFFF#);
P_Plus_1 : constant Normal_GF := (0 => 16#FFEE#,
15 => 16#7FFF#,
others => 16#FFFF#);
procedure GF_Stress
is
A, B, C : Normal_GF;
C2 : GF32;
D : Product_GF;
begin
Put_Line ("GF_Stress case 1 - 0 * 0");
A := (others => 0);
B := (others => 0);
C := A * B;
PDebug.DH16 ("Result is", C);
Put_Line ("GF_Stress case 2 - FFFF * FFFF");
A := (others => 16#FFFF#);
B := (others => 16#FFFF#);
C := A * B;
PDebug.DH16 ("Result is", C);
Put_Line ("GF_Stress case 3 - Seminormal Product GF Max");
D := (0 => 132_051_011, others => 16#FFFF#);
C2 := Car.Product_To_Seminormal (D);
PDebug.DH32 ("Result is", C2);
Put_Line ("GF_Stress case 4 - Seminormal Product tricky case");
D := (0 => 131_071, others => 16#FFFF#);
C2 := Car.Product_To_Seminormal (D);
PDebug.DH32 ("Result is", C2);
end GF_Stress;
procedure Car_Stress
is
A : GF64;
C : Product_GF;
SN : Seminormal_GF;
NGF : Nearlynormal_GF;
R : Normal_GF;
begin
-- Case 1 - using typed API
A := (0 .. 14 => 65535, 15 => 65535 + 2**32);
PDebug.DH64 ("Case 1 - A is", A);
SN := Car.Product_To_Seminormal (A);
PDebug.DH32 ("Case 1 - SN is", SN);
NGF := Car.Seminormal_To_Nearlynormal (SN);
PDebug.DH32 ("Case 1 - NGF is", NGF);
R := Car.Nearlynormal_To_Normal (NGF);
PDebug.DH16 ("Case 1 - R is", R);
-- Case 2 Upper bounds on all limbs of a Product_GF
C := (0 => MGFLC * MGFLP,
1 => (MGFLC - 37 * 1) * MGFLP,
2 => (MGFLC - 37 * 2) * MGFLP,
3 => (MGFLC - 37 * 3) * MGFLP,
4 => (MGFLC - 37 * 4) * MGFLP,
5 => (MGFLC - 37 * 5) * MGFLP,
6 => (MGFLC - 37 * 6) * MGFLP,
7 => (MGFLC - 37 * 7) * MGFLP,
8 => (MGFLC - 37 * 8) * MGFLP,
9 => (MGFLC - 37 * 9) * MGFLP,
10 => (MGFLC - 37 * 10) * MGFLP,
11 => (MGFLC - 37 * 11) * MGFLP,
12 => (MGFLC - 37 * 12) * MGFLP,
13 => (MGFLC - 37 * 13) * MGFLP,
14 => (MGFLC - 37 * 14) * MGFLP,
15 => (MGFLC - 37 * 15) * MGFLP);
PDebug.DH64 ("Case 2 - C is", C);
SN := Car.Product_To_Seminormal (C);
PDebug.DH32 ("Case 2 - SN is", SN);
NGF := Car.Seminormal_To_Nearlynormal (SN);
PDebug.DH32 ("Case 2 - NGF is", NGF);
R := Car.Nearlynormal_To_Normal (NGF);
PDebug.DH16 ("Case 2 - R is", R);
-- Intermediate (pre-normalization) result of
-- Square (Normal_GF'(others => 16#FFFF))
A := (16#23AFB8A023B#,
16#215FBD40216#,
16#1F0FC1E01F1#,
16#1CBFC6801CC#,
16#1A6FCB201A7#,
16#181FCFC0182#,
16#15CFD46015D#,
16#137FD900138#,
16#112FDDA0113#,
16#EDFE2400EE#,
16#C8FE6E00C9#,
16#A3FEB800A4#,
16#7EFF02007F#,
16#59FF4C005A#,
16#34FF960035#,
16#FFFE00010#);
PDebug.DH64 ("Case 3 - A is", A);
SN := Car.Product_To_Seminormal (A);
PDebug.DH32 ("Case 3 - SN is", SN);
NGF := Car.Seminormal_To_Nearlynormal (SN);
PDebug.DH32 ("Case 3 - NGF is", NGF);
R := Car.Nearlynormal_To_Normal (NGF);
PDebug.DH16 ("Case 3 - R is", R);
end Car_Stress;
procedure Diff_Car_Stress
is
C : Nearlynormal_GF;
R : Normal_GF;
begin
C := (others => 0);
PDebug.DH32 ("Case 1 - C is", C);
R := Car.Nearlynormal_To_Normal (C);
PDebug.DH16 ("Case 1 - R is", R);
C := (others => 16#ffff#);
PDebug.DH32 ("Case 2 - C is", C);
R := Car.Nearlynormal_To_Normal (C);
PDebug.DH16 ("Case 2 - R is", R);
for I in I32 range 65536 .. 65573 loop
C (0) := I;
PDebug.DH32 ("Case 3," & I'Img & " C is", C);
R := Car.Nearlynormal_To_Normal (C);
PDebug.DH16 ("Case 3 - R is", R);
end loop;
C := (others => 0);
for I in I32 range -38 .. -1 loop
C (0) := I;
PDebug.DH32 ("Case 4," & I'Img & " C is", C);
R := Car.Nearlynormal_To_Normal (C);
PDebug.DH16 ("Case 4 - R is", R);
end loop;
end Diff_Car_Stress;
procedure Pack_Stress
is
A : Normal_GF;
R : Bytes_32;
Two_P : constant Normal_GF := P * GF_2;
Two_P_Minus_1 : constant Normal_GF := Two_P - GF_1;
Two_P_Plus_1 : constant Normal_GF := Two_P + GF_1;
begin
A := (others => 0);
PDebug.DH16 ("Pack Stress - Case 1 - A is", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 1 - R is", R);
A := (others => 65535);
PDebug.DH16 ("Pack Stress - Case 2 - A is", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 2 - R is", R);
A := P;
PDebug.DH16 ("Pack Stress - Case 3 - A is P", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 3 - R is", R);
A := P_Minus_1;
PDebug.DH16 ("Pack Stress - Case 4 - A is P_Minus_1", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 4 - R is", R);
A := P_Plus_1;
PDebug.DH16 ("Pack Stress - Case 5 - A is P_Plus_1", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 5 - R is", R);
A := Two_P;
PDebug.DH16 ("Pack Stress - Case 6 - A is Two_P", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 6 - R is", R);
A := Two_P_Minus_1;
PDebug.DH16 ("Pack Stress - Case 7 - A is Two_P_Minus_1", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 7 - R is", R);
A := Two_P_Plus_1;
PDebug.DH16 ("Pack Stress - Case 8 - A is Two_P_Plus_1", A);
R := Utils.Pack_25519 (A);
Debug.DH ("Pack Stress - Case 8 - R is", R);
end Pack_Stress;
end SPARKNaCl.Tests;
|
oeis/131/A131381.asm | neoneye/loda-programs | 11 | 164214 | ; A131381: a(n) = binomial(2*n,n) mod (n+2), with n>=1.
; 2,2,0,4,0,4,3,0,0,4,0,0,5,8,0,0,0,0,0,0,0,0,0,0,9,0,0,10,0,16,11,0,0,24,0,0,26,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,0,0,28,0,0,29,0,0,60,0,0,62,0,0,64,0,0,0,0,0,0
add $0,1
mov $1,$0
mul $0,2
bin $0,$1
add $1,2
mod $0,$1
|
Etapa 01/Aula 03 - Registradores e Instr. MOV/codes/a03e04.asm | bellorini/unioeste | 6 | 4859 | <reponame>bellorini/unioeste
; Aula 03 - Registradores e MOV
; arquivo: a03e04.asm
; objetivo: calculo de enderecamento MOV e LEA
; nasm -f elf64 a03e04.asm ; ld a03e04.o -o a03e04.x
section .data
; int vetorInt[10] = {42,1, 2, 3, 4, 5, 6, 7, 8, 9};
vetorInt : dd 42, 1, 2, 3, 4, 96, 6, 7, 8, 9
section .text
global _start
_start:
; ponteiro para o vetorInt
; *vetorInt
; cuidado: x86_64 contem endereços de 8 bytes
lea r8, [vetorInt]
; primeiro elemento do vetorInt
; vetorInt[0]
; cuidado: inteiro em x86_64 contem 4 bytes
mov eax, [vetorInt]
; como pegar o segundo elemento?
; vetorInt[1]
; deslocar o ponteiro vetorInt em 4 bytes, que eh o tamanho de um inteiro
; calculo de endereco de vetorInt[1] com LEA
lea r9, [vetorInt + 4] ; adiciona-se 4 bytes ao end. vetorInt
; busca do segundo elemento com MOV
mov ebx, [r9] ; r9 aponta para vetorInt+4 -> vetorInt[1]
; eh possivel indexar esse LEA?
; sim!!!!!
; Regra: o calculo de endereco eh no formato [base + indexador * deslocamento]
; por exemplo, para recuperar o vetorInt[5], usa-se
; [base=vetorInt + indice=5 * tamanhoInteiro=4]
lea r10, [vetorInt + 5 * 4]
mov ecx, [r10]
; porem, eh possivel executar a busca diretamente com MOV
mov edx, [vetorInt + 5 * 4]
; para futuras aulas: LEA não altera FLAGS!!!!
; o que mantem a consistencia da instrução CMP utilizado nos saltos condicionais
; visto na Aula 07
fim:
mov rax, 60
mov rdi, 0
syscall
|
oeis/021/A021977.asm | neoneye/loda-programs | 11 | 163105 | <reponame>neoneye/loda-programs
; A021977: Decimal expansion of 1/973.
; Submitted by <NAME>
; 0,0,1,0,2,7,7,4,9,2,2,9,1,8,8,0,7,8,1,0,8,9,4,1,4,1,8,2,9,3,9,3,6,2,7,9,5,4,7,7,9,0,3,3,9,1,5,7,2,4,5,6,3,2,0,6,5,7,7,5,9,5,0,6,6,8,0,3,6,9,9,8,9,7,2,2,5,0,7,7,0,8,1,1,9,2,1,8,9,1,0,5,8,5,8,1,7,0,6
seq $0,83811 ; Numbers n such that 2n+1 is the digit reversal of n+1.
div $0,3892
mod $0,10
|
oeis/110/A110322.asm | neoneye/loda-programs | 11 | 18356 | ; A110322: Row sums of a number triangle related to the Jacobsthal numbers.
; Submitted by <NAME>
; 1,2,9,52,425,4206,50737,708464,11350257,204171130,4084757561,89849981772,2156575777369,56068679418662,1569955094823585,47098171778191816,1507149193966389857,51242941744764975474,1844748258113200151017,70100389057570046093540,2804016457317433036643721,117768672412024932488091742,5181821999625856640596816529,238363802472363934411675623072,11441462746923680157099100401745,572073131639928725221488257730026,29747802993638931059987525223249177,1606381357650711068830632694880684284
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
sub $3,$1
mul $1,$0
mov $6,$0
mul $6,$3
mov $3,$5
mul $6,2
sub $3,$6
add $3,1
add $1,$3
lpe
mov $0,$1
|
alloy4fun_models/trashltl/models/11/PXLGmdj3jZNta8KhK.als | Kaixi26/org.alloytools.alloy | 0 | 3483 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idPXLGmdj3jZNta8KhK_prop12 {
some f : File | f not in Trash until (eventually f in Trash => eventually f not in Trash)
}
pred __repair { idPXLGmdj3jZNta8KhK_prop12 }
check __repair { idPXLGmdj3jZNta8KhK_prop12 <=> prop12o } |
ADA_RC_Car/src/steeringcontrol.ads | Intelligente-sanntidssystemer/Ada-prosjekt | 0 | 9814 | with NRF52_DK.IOs;
package SteeringControl is --Servo and Motor controls --
procedure Servocontrol(ServoPin : NRF52_DK.IOs.Pin_Id; Value : NRF52_DK.IOs.Analog_Value); --- Servo--
procedure Direction_Controller; --Left or right write to servo to turn car --
procedure Motor_Controller; --Motor forward/backward --
procedure Crash_Stop_Forward; --When triggering emergency stop --
procedure Crash_Stop_Backward; --When triggering emergency stop --
end SteeringControl;
|
programs/oeis/168/A168183.asm | neoneye/loda | 22 | 22155 | ; A168183: Numbers that are not multiples of 9.
; 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,37,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,91,92,93,94,95,96,97,98,100,101,102,103,104,105,106,107,109,110,111,112
mov $1,9
mul $1,$0
div $1,8
add $1,1
mov $0,$1
|
ReJIT/Intrinsics/rdtscp.asm | damageboy/ReJit | 14 | 28898 | <gh_stars>10-100
BITS 64
[MAP all]
trampoline_size EQU 10
jit:
; Push the stuff we need to preserve by ABI
push rbx
; Store the return address in RBX
mov rbx,qword [rsp+08]
push rsi
push rdi
; Block copy all the LEA insn
lea rsi, [rel start]
lea rdi, [rbx-trampoline_size]
mov rcx, end - start
rep movsb
mov rcx,rbx
sub rcx,rdi
mov al,0x90
rep stosb
; Pop in reverse
pop rdi
pop rsi
sub rbx,trampoline_size
mov qword [rsp+08h],rbx
pop rbx
ret
start:
rdtscp
shl rdx,32
or rax,rdx
end:
|
data/pokemon/base_stats/sinnoh/turtwig.asm | Dev727/ancientplatinum | 0 | 4014 | <reponame>Dev727/ancientplatinum
db 0 ; 387 DEX NO
db 55, 68, 64, 31, 45, 55
; hp atk def spd sat sdf
db GRASS, GRASS ; type
db 45 ; catch rate
db 64 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F12_5 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/sinnoh/turtwig/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_SLOW ; growth rate
dn EGG_MONSTER, EGG_PLANT ; egg groups
; tm/hm learnset
tmhm
; end
|
Task/Last-letter-first-letter/Ada/last-letter-first-letter.ada | LaudateCorpus1/RosettaCodeData | 1 | 22169 | <filename>Task/Last-letter-first-letter/Ada/last-letter-first-letter.ada
with Ada.Containers.Indefinite_Vectors, Ada.Text_IO;
procedure Lalefile is
package Word_Vec is new Ada.Containers.Indefinite_Vectors
(Index_Type => Positive,
Element_Type => String);
use type Word_Vec.Vector, Ada.Containers.Count_Type;
type Words_Type is array (Character) of Word_Vec.Vector;
procedure Read(Words: out Words_Type) is
F: Ada.Text_IO.File_Type;
begin
Ada.Text_IO.Open(File => F,
Name => "pokemon70.txt",
Mode => Ada.Text_IO.In_File);
loop
declare
Word: String := Ada.Text_IO.Get_Line(F);
begin
exit when Word = "";
Words(Word(Word'First)).Append(Word);
end;
end loop;
exception
when Ada.Text_IO.End_Error => null;
end Read;
procedure Write (List: Word_Vec.Vector; Prefix: String := " ") is
Copy: Word_Vec.Vector := List;
begin
loop
exit when Copy.Is_Empty;
Ada.Text_IO.Put_Line(Prefix & Copy.First_Element);
Copy.Delete_First;
end loop;
end Write;
function Run(Start: Character; Words: Words_Type) return Word_Vec.Vector is
Result: Word_Vec.Vector := Word_Vec.Empty_Vector;
begin
for I in Words(Start).First_Index .. Words(Start).Last_Index loop
declare
Word: String := Words(Start).Element(I);
Dupl: Words_Type := Words;
Alternative : Word_Vec.Vector;
begin
Dupl(Start).Delete(I);
Alternative := Word & Run(Word(Word'Last), Dupl);
if Alternative.Length > Result.Length then
Result := Alternative;
end if;
end;
end loop;
return Result;
end Run;
W: Words_Type;
A_Vector: Word_Vec.Vector;
Best: Word_Vec.Vector := Word_Vec.Empty_Vector;
begin
Read(W);
Ada.Text_IO.Put("Processing ");
for Ch in Character range 'a' .. 'z' loop
Ada.Text_IO.Put(Ch & ", ");
A_Vector := Run(Ch, W);
if A_Vector.Length > Best.Length then
Best := A_Vector;
end if;
end loop;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line("Length of longest Path:" &
Integer'Image(Integer(Best.Length)));
Ada.Text_IO.Put_Line("One such path:");
Write(Best);
end Lalefile;
|
oeis/259/A259455.asm | neoneye/loda-programs | 11 | 16090 | <gh_stars>10-100
; A259455: n Sum_n Sum_n Sum_n.
; Submitted by <NAME>
; 1,30,270,1400,5250,15876,41160,95040,200475,393250,726726,1277640,2153060,3498600,5508000,8434176,12601845,18421830,26407150,37191000,51546726,70409900,94902600,126360000,166359375,216751626,279695430,357694120,453635400,570834000,713077376,884674560,1090508265,1336090350,1627620750,1972049976,2377145290,2851560660,3404910600,4047848000,4792146051,5650784370,6638039430,7769579400,9062563500,10535745976,12209584800,14106355200,16250268125,18667593750,21386790126,24438637080,27856375470
add $0,1
mov $2,$0
pow $0,2
sub $1,$2
bin $1,4
mul $1,$0
add $2,1
mul $1,$2
mov $0,$1
div $0,2
|
programs/oeis/107/A107044.asm | karttu/loda | 0 | 242061 | <reponame>karttu/loda
; A107044: A symmetric factorial triangle, read by rows: T(n,k) = min(n,k)!.
; 1,1,1,1,2,1,1,2,2,1,1,2,6,2,1,1,2,6,6,2,1,1,2,6,24,6,2,1,1,2,6,24,24,6,2,1,1,2,6,24,120,24,6,2,1,1,2,6,24,120,120,24,6,2,1,1,2,6,24,120,720,120,24,6,2,1,1,2,6,24,120,720,720,120,24,6,2,1
cal $0,3983 ; Array read by antidiagonals with T(n,k) = min(n,k).
fac $0
mov $1,$0
|
tp_01_07/bootld.asm | mjFer/TDIII-UTN-FRBA-TPS-2014 | 2 | 19140 | <reponame>mjFer/TDIII-UTN-FRBA-TPS-2014<gh_stars>1-10
[ORG 0x7C00];BIOS loads bootsector here
%ifndef KERNEL_MEMORY
%error "Kernel start address not defined"
;kernel_memory must be 16 byte aligned
%endif
%ifndef KERNEL_SIZE_SECTORS
%error "Kernel size (in sectors) not defined"
%endif
[BITS 16] ;for real mode; 16-bit instructions
cli ;clear interrupts
;-----------------------------------------------------------
; INITIALIZATION PROCEDURES
mov ah, 02h ; load int 13h function (read sector)
mov al,KERNEL_SIZE_SECTORS ; load how many sectors will be read
mov cx, 02h ; starting from track 0, sector 2
mov dh, 0 ; load head = 0
mov dl, 0 ; drive 0 (A:)
mov ebx, KERNEL_MEMORY ; load linear destination address at ebx
shr ebx,4 ; shift right ebx (result at BX will be the segment)
mov es,bx ; load destination segment
mov bx, 0 ; load 0 offset
int 13h ; read disk
;---------------------------------------------------------------------------
jc error ; if carry is set, int 13h didn't work
jmp (KERNEL_MEMORY>>4):0 ; jmp to the kernel code
error:
hlt
times 510-($-$$) db 0 ;fill the space till 510
;with zeroes
dw 0xAA55 ;boot sector identifier
|
libsrc/_DEVELOPMENT/threads/mutex/c/sdcc_iy/spinlock_tryacquire.asm | meesokim/z88dk | 0 | 160165 |
; int spinlock_tryacquire(char *spinlock)
SECTION code_threads_mutex
PUBLIC _spinlock_tryacquire
EXTERN _spinlock_tryacquire_fastcall
_spinlock_tryacquire:
pop af
pop hl
push hl
push af
jp _spinlock_tryacquire_fastcall
|
models/lists.als | trojan321/AlloyViz | 0 | 1980 | /*
* a simple List1 module
* which demonstrates how to create predicates and fields that mirror each other
* thus allowing recursive constraints (even though recursive predicates are not
* currently supported by Alloy)
* author: <NAME>
*/
module List1
sig Thing {}
fact NoStrayThings {Thing in List1.car}
abstract sig List1 {
equivTo: set List1,
prefixes: set List1
}
sig NonEmptyList1 extends List1 {
car: one Thing,
cdr: one List1
}
sig EmptyList1 extends List1 {}
pred isFinite [L:List1] {some e: EmptyList1 | e in L.*cdr}
fact finite {all L: List1 | isFinite[L]}
fact Equivalence {
all a,b: List1 | (a in b.equivTo) <=> ((a.car = b.car and b.cdr in a.cdr.equivTo) and (#a.*cdr = #b.*cdr))
}
assert reflexive {all L: List1 | L in L.equivTo}
check reflexive for 6 expect 0
assert symmetric {all a,b: List1 | a in b.equivTo <=> b in a.equivTo}
check symmetric for 6 expect 0
assert empties {all a,b: EmptyList1 | a in b.equivTo}
check empties for 6 expect 0
fact prefix { //a is a prefix of b
all e: EmptyList1, L:List1 | e in L.prefixes
all a,b: NonEmptyList1 | (a in b.prefixes) <=> (a.car = b.car
and a.cdr in b.cdr.prefixes
and #a.*cdr < #b.*cdr)
}
pred show {
some a, b: NonEmptyList1 | a!=b && b in a.prefixes
}
run show for 4 expect 1
|
programs/oeis/027/A027772.asm | neoneye/loda | 22 | 23266 | <reponame>neoneye/loda
; A027772: (n+1)*C(n+1,12).
; 12,169,1274,6825,29120,105196,334152,957372,2519400,6172530,14226212,31097794,64899744,130007500,251100200,469364220,851809140,1504982115,2594796750,4374736275,7225370880,11708971560,18644037360,29205813000,45060397200,68541870852,102884055624,152521100004,223474139200,323844851720,464440909296,659563165352,927990034972,1294200978525,1789888412130,2455815839997,3344089654464,4520923006964,6069982555000,8096422884900,10731729157240,14139506192630,18522371993580,24130135779750,31269465208800,40315274787060,51724097781720,66049737482820,83961530698500,106265597186775,133929493634742,168110740112679,210189740995584,261807681517200,324910045780320,401796472591696,495177742341152,608240771745672,744722584096400,908994321169480,1106156469704832,1342146590859984,1623860965874784,1959291705930000,2357681019469100,2829694486727185,3387615359552970,4045562085528145,4819731449624000,5728669934960700,6793576127456040,8038637228107980,9491402992223880,11183200688000250,13149594958418100,15430896781436682,18072726054967584,21126632686156764,24650781440200200,28710706203417420,33380139739797396,38741925470948427,44889018287608222,51925581907929275,59968190835022080,69147145535137592,79607910059873104,91512681972415704,105042105110670000,120397136430780300,137801078924734680,157501793397167660,179774102720954560,204922403070567000,233283497558347600,265229668673835320,301172006952065340,341564014375476165,386905502147843250,437746803669749925
mov $1,$0
add $0,12
bin $0,$1
add $1,12
mul $0,$1
|
alloy4fun_models/trainstlt/models/2/LQptHZt26zqaLRGCX.als | Kaixi26/org.alloytools.alloy | 0 | 5210 | open main
pred idLQptHZt26zqaLRGCX_prop3 {
always all t: Train | always t not in Track
}
pred __repair { idLQptHZt26zqaLRGCX_prop3 }
check __repair { idLQptHZt26zqaLRGCX_prop3 <=> prop3o } |
components/src/motion/mma8653/mma8653.adb | rocher/Ada_Drivers_Library | 192 | 1074 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body MMA8653 is
function To_Axis_Data is new Ada.Unchecked_Conversion (UInt10, Axis_Data);
function Read_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss) return UInt8;
procedure Write_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8);
-------------------
-- Read_Register --
-------------------
function Read_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss) return UInt8
is
Data : I2C_Data (1 .. 1);
Status : I2C_Status;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
return Data (Data'First);
end Read_Register;
--------------------
-- Write_Register --
--------------------
procedure Write_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8)
is
Status : I2C_Status;
begin
This.Port.Mem_Write (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => (1 => Val),
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
end Write_Register;
---------------
-- Configure --
---------------
procedure Configure (This : in out MMA8653_Accelerometer;
Dyna_Range : Dynamic_Range;
Sleep_Oversampling : Oversampling_Mode;
Active_Oversampling : Oversampling_Mode)
is
CTRL1 : CTRL_REG1_Register;
CTRL2 : CTRL_REG2_Register;
begin
-- Enter standby mode to be able to set configuration
CTRL1.Active := False;
This.Write_Register (CTRL_REG1, To_UInt8 (CTRL1));
CTRL2.MODS := Active_Oversampling'Enum_Rep;
CTRL2.SMODS := Sleep_Oversampling'Enum_Rep;
This.Write_Register (CTRL_REG2, To_UInt8 (CTRL2));
This.Write_Register (XYZ_DATA_CFG, Dyna_Range'Enum_Rep);
CTRL1.Active := True;
This.Write_Register (CTRL_REG1, To_UInt8 (CTRL1));
end Configure;
---------------------
-- Check_Device_Id --
---------------------
function Check_Device_Id (This : MMA8653_Accelerometer) return Boolean is
begin
return Read_Register (This, Who_Am_I) = Device_Id;
end Check_Device_Id;
---------------
-- Read_Data --
---------------
function Read_Data (This : MMA8653_Accelerometer) return All_Axes_Data is
function Convert (MSB, LSB : UInt8) return Axis_Data;
-------------
-- Convert --
-------------
function Convert (MSB, LSB : UInt8) return Axis_Data is
Tmp : UInt10;
begin
Tmp := UInt10 (Shift_Right (LSB, 6));
Tmp := Tmp or UInt10 (MSB) * 2**2;
return To_Axis_Data (Tmp);
end Convert;
Status : I2C_Status;
Data : I2C_Data (1 .. 7);
Ret : All_Axes_Data;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (DATA_STATUS),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
Ret.X := Convert (Data (2), Data (3));
Ret.Y := Convert (Data (4), Data (5));
Ret.Z := Convert (Data (6), Data (7));
return Ret;
end Read_Data;
end MMA8653;
|
libsrc/_DEVELOPMENT/font/font_4x8/_font_4x8_default.asm | teknoplop/z88dk | 0 | 241429 | <gh_stars>0
SECTION rodata_font
SECTION rodata_font_4x8
PUBLIC _font_4x8_default
_font_4x8_default:
BINARY "font/font_4x8/font_4x8_default.bin"
|
src/Data/Union/Relation/Binary/Subtype/Instances.agda | johnyob/agda-union | 0 | 5594 | module Data.Union.Relation.Binary.Subtype.Instances where
open import Data.List using (List)
open import Data.List.Relation.Binary.Subset.Propositional.Instances using (⦅_⊆_⦆; [_])
open import Data.Union using (Union)
open import Data.Union.Relation.Binary.Subtype
using (_≼_; _,_⊢_≼_; refl; trans; generalize; function)
open import Level using (Level; _⊔_)
private
variable
a b c d f : Level
A : Set a
B : Set b
C : Set c
D : Set d
F : A → Set f
ts ts′ : List A
-- ----------------------------------------------------------------------
-- Wrapped subtypes
infix 4 ⦅_≼_⦆ ⦅_,_⊢_≼_⦆
data ⦅_≼_⦆ {a b} : Set a → Set b → Set (a ⊔ b) where
[_] : A ≼ B → ⦅ A ≼ B ⦆
⦅_,_⊢_≼_⦆ : (A : Set a) → (B : A → Set b) → List A → List A → Set (a ⊔ b)
⦅ A , B ⊢ ts ≼ ts′ ⦆ = ⦅ Union A B ts ≼ Union A B ts′ ⦆
proj : ⦅ A ≼ B ⦆ → A ≼ B
proj [ A≼B ] = A≼B
⊢proj : ⦅ A , F ⊢ ts ≼ ts′ ⦆ → A , F ⊢ ts ≼ ts′
⊢proj [ A,F⊢ts≼ts′ ] = A,F⊢ts≼ts′
-- ----------------------------------------------------------------------
-- Instances
instance
⦃refl⦄ : ⦅ A ≼ A ⦆
⦃refl⦄ = [ refl ]
-- Removed since the transitivity of ⊆ provides this
-- Also now allows for syntax directed instance search :)
-- ⦃trans⦄ : ⦃ ⦅ A ≼ B ⦆ ⦄ → ⦃ ⦅ B ≼ C ⦆ ⦄ → ⦅ A ≼ C ⦆
-- ⦃trans⦄ ⦃ [ A≼B ] ⦄ ⦃ [ B≼C ] ⦄ = [ trans A≼B B≼C ]
⦃generalize⦄ : ⦃ ⦅ ts ⊆ ts′ ⦆ ⦄ → ⦅ A , F ⊢ ts ≼ ts′ ⦆
⦃generalize⦄ ⦃ [ ts⊆ts′ ] ⦄ = [ generalize ts⊆ts′ ]
⦃function⦄ : ⦃ ⦅ C ≼ A ⦆ ⦄ → ⦃ ⦅ B ≼ D ⦆ ⦄ → ⦅ (A → B) ≼ (C → D) ⦆
⦃function⦄ ⦃ [ C≼A ] ⦄ ⦃ [ B≼D ] ⦄ = [ function C≼A B≼D ]
-- ----------------------------------------------------------------------
-- Coercion using instance search
⌊_⌋ : ⦃ ⦅ A ≼ B ⦆ ⦄ → A → B
⌊_⌋ ⦃ [ A≼B ] ⦄ A = A≼B A |
systemrdl/parser/SystemRDL.g4 | bdmagnuson/systemrdl-compiler | 13 | 7214 | <reponame>bdmagnuson/systemrdl-compiler<filename>systemrdl/parser/SystemRDL.g4
grammar SystemRDL;
root: (root_elem ';')* EOF;
root_elem : component_def
| enum_def
| udp_def
| struct_def
| constraint_def
| explicit_component_inst
| local_property_assignment
| dynamic_property_assignment
;
//------------------------------------------------------------------------------
// Components
//------------------------------------------------------------------------------
component_def : component_named_def ( (component_inst_type component_insts)
| component_insts?
)
| component_anon_def ( (component_inst_type component_insts)
| component_insts
)
| component_inst_type component_named_def component_insts
| component_inst_type component_anon_def component_insts
;
explicit_component_inst : component_inst_type? component_inst_alias? ID component_insts;
component_inst_alias: ALIAS_kw ID;
component_named_def : component_type ID param_def? component_body;
component_anon_def : component_type component_body;
component_body: '{' (component_body_elem ';')* '}';
component_body_elem : component_def
| enum_def
| struct_def
| constraint_def
| explicit_component_inst
| local_property_assignment
| dynamic_property_assignment
;
component_insts: param_inst? component_inst (',' component_inst)*;
component_inst: ID ( array_suffix+ | range_suffix )? field_inst_reset?
inst_addr_fixed?
inst_addr_stride?
inst_addr_align?
;
field_inst_reset: op=ASSIGN expr;
inst_addr_fixed : op=AT expr;
inst_addr_stride: op=INC expr;
inst_addr_align: op=ALIGN expr;
component_inst_type : kw=(EXTERNAL_kw | INTERNAL_kw);
component_type: component_type_primary
| kw=SIGNAL_kw
;
component_type_primary: kw=( ADDRMAP_kw
| REGFILE_kw
| REG_kw
| FIELD_kw
| MEM_kw
)
;
//------------------------------------------------------------------------------
// Parameters
//------------------------------------------------------------------------------
// Parameter definition
param_def: '#' '(' param_def_elem (',' param_def_elem)* ')';
param_def_elem : data_type ID array_type_suffix? (ASSIGN expr)?;
// Parameter assignment list in instantiation
param_inst: '#' '(' param_assignment (',' param_assignment)* ')';
param_assignment: '.' ID '(' expr ')';
//------------------------------------------------------------------------------
// Expressions
//------------------------------------------------------------------------------
expr: op=(PLUS|MINUS|BNOT|NOT|AND|NAND|OR|NOR|XOR|XNOR) expr_primary #UnaryExpr
| expr op=EXP expr #BinaryExpr
| expr op=(MULT|DIV|MOD) expr #BinaryExpr
| expr op=(PLUS|MINUS) expr #BinaryExpr
| expr op=(LSHIFT|RSHIFT) expr #BinaryExpr
| expr op=(LT|LEQ|GT|GEQ) expr #BinaryExpr
| expr op=(EQ|NEQ) expr #BinaryExpr
| expr op=AND expr #BinaryExpr
| expr op=(XOR|XNOR) expr #BinaryExpr
| expr op=OR expr #BinaryExpr
| expr op=BAND expr #BinaryExpr
| expr op=BOR expr #BinaryExpr
| <assoc=right> expr op='?' expr ':' expr #TernaryExpr
| expr_primary #NOP
;
expr_primary : literal
| concatenate
| replicate
| paren_expr
| cast
| prop_ref
| instance_ref
| struct_literal
| array_literal
;
concatenate : '{' expr (',' expr)* '}';
replicate : '{' expr concatenate '}';
paren_expr: '(' expr ')';
cast : typ=(BOOLEAN_kw|BIT_kw|LONGINT_kw) op='\'' '(' expr ')' #CastType
| cast_width_expr op='\'' '(' expr ')' #CastWidth
;
cast_width_expr : literal
| paren_expr
;
//------------------------------------------------------------------------------
// Array and Range
//------------------------------------------------------------------------------
range_suffix: '[' expr ':' expr ']';
array_suffix: '[' expr ']';
array_type_suffix: '[' ']';
//------------------------------------------------------------------------------
// Data Types
//------------------------------------------------------------------------------
data_type : basic_data_type
| kw=(ACCESSTYPE_kw|ADDRESSINGTYPE_kw|ONREADTYPE_kw|ONWRITETYPE_kw)
;
basic_data_type : kw=(BIT_kw|LONGINT_kw) UNSIGNED_kw?
| kw=(STRING_kw|BOOLEAN_kw|ID)
;
//------------------------------------------------------------------------------
// Literals
//------------------------------------------------------------------------------
literal : number
| string_literal
| boolean_literal
| accesstype_literal
| onreadtype_literal
| onwritetype_literal
| addressingtype_literal
| precedencetype_literal
| enum_literal
;
number : INT #NumberInt
| HEX_INT #NumberHex
| VLOG_INT #NumberVerilog
;
string_literal : STRING;
boolean_literal : val=(TRUE_kw|FALSE_kw);
array_literal : '\'' '{' '}'
| '\'' '{' expr (',' expr )* '}';
struct_literal : ID '\'' '{' struct_kv (',' struct_kv)* '}';
struct_kv : ID ':' expr ;
enum_literal : ID '::' ID;
accesstype_literal : kw=(NA_kw|RW_kw|WR_kw|R_kw|W_kw|RW1_kw|W1_kw);
onreadtype_literal : kw=(RCLR_kw|RSET_kw|RUSER_kw);
onwritetype_literal : kw=(WOSET_kw|WOCLR_kw|WOT_kw|WZS_kw|WZC_kw|WZT_kw|WCLR_kw|WSET_kw|WUSER_kw);
addressingtype_literal : kw=(COMPACT_kw|REGALIGN_kw|FULLALIGN_kw);
precedencetype_literal : kw=(HW_kw|SW_kw);
//------------------------------------------------------------------------------
// References
//------------------------------------------------------------------------------
instance_ref: instance_ref_element ('.' instance_ref_element)*;
instance_ref_element: ID array_suffix*;
prop_ref: instance_ref '->' (prop_keyword | ID);
//------------------------------------------------------------------------------
// Properties
//------------------------------------------------------------------------------
local_property_assignment : DEFAULT_kw? normal_prop_assign
| DEFAULT_kw? encode_prop_assign
| DEFAULT_kw? prop_mod_assign
;
dynamic_property_assignment : instance_ref '->' normal_prop_assign
| instance_ref '->' encode_prop_assign
;
normal_prop_assign: (prop_keyword | ID) ( ASSIGN prop_assignment_rhs )?;
encode_prop_assign: ENCODE_kw ASSIGN ID;
prop_mod_assign : prop_mod ID;
prop_assignment_rhs : precedencetype_literal
| expr
;
prop_keyword: kw=(SW_kw|HW_kw|RCLR_kw|RSET_kw|WOCLR_kw|WOSET_kw);
prop_mod : kw=(POSEDGE_kw|NEGEDGE_kw|BOTHEDGE_kw|LEVEL_kw|NONSTICKY_kw);
//------------------------------------------------------------------------------
// User-defined properties
//------------------------------------------------------------------------------
udp_def : PROPERTY_kw ID '{' (udp_attr ';')+ '}';
udp_attr: udp_type
| udp_usage
| udp_default
| udp_constraint
;
udp_type : TYPE_kw ASSIGN udp_data_type array_type_suffix?;
udp_data_type : component_type_primary
| kw=(REF_kw|NUMBER_kw)
| basic_data_type
;
udp_usage : COMPONENT_kw ASSIGN udp_comp_type (OR udp_comp_type)*;
udp_comp_type : component_type
| kw=(CONSTRAINT_kw|ALL_kw)
;
udp_default : DEFAULT_kw ASSIGN expr;
udp_constraint : CONSTRAINT_kw ASSIGN COMPONENTWIDTH_kw;
//------------------------------------------------------------------------------
// User-defined enumerations
//------------------------------------------------------------------------------
enum_def: ENUM_kw ID '{' (enum_entry ';')+ '}';
enum_entry: ID (ASSIGN expr)? ('{' (enum_prop_assign ';')* '}')?;
// Only 'name' and 'desc' properties are allowed in enums
// No need to invoke the rest of the grammar for property assignments here.
enum_prop_assign: ID ASSIGN expr;
//------------------------------------------------------------------------------
// User-defined structs
//------------------------------------------------------------------------------
struct_def: ABSTRACT_kw? STRUCT_kw name=ID (':' base=ID)? '{' (struct_elem ';')* '}';
struct_elem: struct_type ID array_type_suffix?;
struct_type : data_type
| component_type
;
//------------------------------------------------------------------------------
// Constraints
//------------------------------------------------------------------------------
constraint_def: constraint_named_def constraint_insts?
| constraint_anon_def constraint_insts
;
constraint_named_def: CONSTRAINT_kw ID constraint_body;
constraint_anon_def: CONSTRAINT_kw constraint_body;
constraint_body: '{' (constraint_body_elem ';')* '}';
constraint_body_elem: constr_relational
| constr_prop_assign
| constr_inside_values
| constr_inside_enum
;
constraint_insts: ID (',' ID)*;
constr_relational: expr op=(LT|LEQ|GT|GEQ|EQ|NEQ) expr;
constr_prop_assign: ID ASSIGN expr;
constr_inside_values: constr_lhs INSIDE_kw '{' constr_inside_value (',' constr_inside_value)*'}';
constr_inside_enum: constr_lhs INSIDE_kw ID;
constr_lhs: THIS_kw
| instance_ref
;
constr_inside_value : val=expr
| '[' l_val=expr ':' r_val=expr ']'
;
//==============================================================================
// Lexer
//==============================================================================
SL_COMMENT : ( '//' ~[\r\n]* '\r'? '\n') -> skip;
ML_COMMENT : ( '/*' .*? '*/' ) -> skip;
//------------------------------------------------------------------------------
// Keywords
//------------------------------------------------------------------------------
BOOLEAN_kw : 'boolean';
BIT_kw : 'bit';
LONGINT_kw : 'longint';
UNSIGNED_kw : 'unsigned';
STRING_kw : 'string';
ACCESSTYPE_kw : 'accesstype';
ADDRESSINGTYPE_kw : 'addressingtype';
ONREADTYPE_kw : 'onreadtype';
ONWRITETYPE_kw : 'onwritetype';
ALIAS_kw : 'alias';
EXTERNAL_kw : 'external';
INTERNAL_kw : 'internal';
ADDRMAP_kw : 'addrmap';
REGFILE_kw : 'regfile';
REG_kw : 'reg';
FIELD_kw : 'field';
MEM_kw : 'mem';
SIGNAL_kw : 'signal';
// Boolean Literals
TRUE_kw : 'true';
FALSE_kw : 'false';
// Special RDL enum-like literals
NA_kw : 'na';
RW_kw : 'rw';
WR_kw : 'wr';
R_kw : 'r';
W_kw : 'w';
RW1_kw : 'rw1';
W1_kw : 'w1';
RCLR_kw : 'rclr';
RSET_kw : 'rset';
RUSER_kw : 'ruser';
WOSET_kw : 'woset';
WOCLR_kw : 'woclr';
WOT_kw : 'wot';
WZS_kw : 'wzs';
WZC_kw : 'wzc';
WZT_kw : 'wzt';
WCLR_kw : 'wclr';
WSET_kw : 'wset';
WUSER_kw : 'wuser';
COMPACT_kw : 'compact';
REGALIGN_kw : 'regalign';
FULLALIGN_kw : 'fullalign';
HW_kw : 'hw';
SW_kw : 'sw';
// Property Modifier keywords
POSEDGE_kw : 'posedge';
NEGEDGE_kw : 'negedge';
BOTHEDGE_kw : 'bothedge';
LEVEL_kw : 'level';
NONSTICKY_kw : 'nonsticky';
// Other keywords from 4.4 not covered by above
ABSTRACT_kw : 'abstract';
ALL_kw : 'all';
COMPONENT_kw : 'component';
COMPONENTWIDTH_kw : 'componentwidth';
CONSTRAINT_kw : 'constraint';
DEFAULT_kw : 'default';
ENUM_kw : 'enum';
ENCODE_kw : 'encode';
INSIDE_kw : 'inside';
NUMBER_kw : 'number';
PROPERTY_kw : 'property';
REF_kw : 'ref';
STRUCT_kw : 'struct';
THIS_kw : 'this';
TYPE_kw : 'type';
// Reserved keywords from Annex D
ALTERNATE_kw : 'alternate';
BYTE_kw : 'byte';
INT_kw : 'int';
PRECEDENCETYPE_kw : 'precedencetype';
REAL_kw : 'real';
SHORTINT_kw : 'shortint';
SHORTREAL_kw : 'shortreal';
SIGNED_kw : 'signed';
WITH_kw : 'with';
WITHIN_kw : 'within';
//------------------------------------------------------------------------------
// Literals
//------------------------------------------------------------------------------
// Numbers
fragment NUM_BIN : [0-1] [0-1_]* ;
fragment NUM_DEC : [0-9] [0-9_]* ;
fragment NUM_HEX : [0-9a-fA-F] [0-9a-fA-F_]* ;
INT : NUM_DEC ;
HEX_INT : ('0x'|'0X') NUM_HEX ;
VLOG_INT: [0-9]+ '\'' ( ([bB] NUM_BIN)
| ([dD] NUM_DEC)
| ([hH] NUM_HEX)
)
;
fragment ESC : '\\"' | '\\\\' ;
STRING : '"' (ESC | ~('"'|'\\'))* '"' ;
//------------------------------------------------------------------------------
// Operators
//------------------------------------------------------------------------------
PLUS : '+' ;
MINUS : '-' ;
BNOT : '!' ;
NOT : '~' ;
BAND : '&&' ;
NAND : '~&' ;
AND : '&' ;
OR : '|' ;
BOR : '||' ;
NOR : '~|' ;
XOR : '^' ;
XNOR : '~^' | '^~' ;
LSHIFT : '<<' ;
RSHIFT : '>>' ;
MULT : '*' ;
EXP : '**' ;
DIV : '/' ;
MOD : '%' ;
EQ : '==' ;
ASSIGN : '=' ;
NEQ : '!=' ;
LEQ : '<=' ;
LT : '<' ;
GEQ : '>=' ;
GT : '>' ;
AT : '@';
INC : '+=';
ALIGN : '%=';
//------------------------------------------------------------------------------
WS : [ \t\r\n]+ -> skip ;
ID : ('\\')? [a-zA-Z_] [a-zA-Z0-9_]* ;
|
programs/oeis/052/A052796.asm | karttu/loda | 1 | 100406 | <reponame>karttu/loda<filename>programs/oeis/052/A052796.asm
; A052796: E.g.f.: x^4*exp(x)^2.
; 0,0,0,0,24,240,1440,6720,26880,96768,322560,1013760,3041280,8785920,24600576,67092480,178913280,467927040,1203240960,3048210432,7620526080,18827182080,46022000640,111421685760,267412045824,636695347200,1504916275200,3533281689600,8244323942400,19126831546368,44138842030080,101355859476480,231670535946240,527250185256960,1195100419915776,2698613851422720,6071881165701120
mov $1,2
pow $1,$0
bin $0,4
mul $1,$0
div $1,16
mul $1,24
|
awa/plugins/awa-images/src/awa-images-modules.adb | fuzzysloth/ada-awa | 0 | 10807 | <gh_stars>0
-----------------------------------------------------------------------
-- awa-images-modules -- Image management module
-- Copyright (C) 2012, 2016 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with AWA.Modules.Get;
with AWA.Applications;
with AWA.Storages.Modules;
with AWA.Services.Contexts;
with AWA.Modules.Beans;
with AWA.Images.Beans;
with ADO.Sessions;
with Util.Strings;
with Util.Log.Loggers;
package body AWA.Images.Modules is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Images.Module");
package Register is new AWA.Modules.Beans (Module => Image_Module,
Module_Access => Image_Module_Access);
-- ------------------------------
-- Job worker procedure to identify an image and generate its thumnbnail.
-- ------------------------------
procedure Thumbnail_Worker (Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is
Module : constant Image_Module_Access := Get_Image_Module;
begin
Module.Do_Thumbnail_Job (Job);
end Thumbnail_Worker;
-- ------------------------------
-- Initialize the image module.
-- ------------------------------
overriding
procedure Initialize (Plugin : in out Image_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config) is
begin
Log.Info ("Initializing the image module");
-- Setup the resource bundles.
App.Register ("imageMsg", "images");
Register.Register (Plugin => Plugin,
Name => "AWA.Images.Beans.Image_List_Bean",
Handler => AWA.Images.Beans.Create_Image_List_Bean'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Images.Beans.Image_Bean",
Handler => AWA.Images.Beans.Create_Image_Bean'Access);
App.Add_Servlet ("image", Plugin.Image_Servlet'Unchecked_Access);
AWA.Modules.Module (Plugin).Initialize (App, Props);
Plugin.Add_Listener (AWA.Storages.Modules.NAME, Plugin'Unchecked_Access);
end Initialize;
-- ------------------------------
-- Configures the module after its initialization and after having read its XML configuration.
-- ------------------------------
overriding
procedure Configure (Plugin : in out Image_Module;
Props : in ASF.Applications.Config) is
pragma Unreferenced (Props);
use type AWA.Jobs.Modules.Job_Module_Access;
begin
-- Create the image manager when everything is initialized.
Plugin.Manager := Plugin.Create_Image_Manager;
Plugin.Job_Module := AWA.Jobs.Modules.Get_Job_Module;
if Plugin.Job_Module = null then
Log.Error ("Cannot find the AWA Job module for the image thumbnail generation");
else
Plugin.Job_Module.Register (Definition => Thumbnail_Job_Definition.Factory);
end if;
end Configure;
-- ------------------------------
-- Get the image manager.
-- ------------------------------
function Get_Image_Manager (Plugin : in Image_Module)
return Services.Image_Service_Access is
begin
return Plugin.Manager;
end Get_Image_Manager;
-- ------------------------------
-- Create an image manager. This operation can be overridden to provide another
-- image service implementation.
-- ------------------------------
function Create_Image_Manager (Plugin : in Image_Module)
return Services.Image_Service_Access is
Result : constant Services.Image_Service_Access := new Services.Image_Service;
begin
Result.Initialize (Plugin);
return Result;
end Create_Image_Manager;
-- ------------------------------
-- Create a thumbnail job for the image.
-- ------------------------------
procedure Make_Thumbnail_Job (Plugin : in Image_Module;
Image : in AWA.Images.Models.Image_Ref'Class) is
pragma Unreferenced (Plugin);
J : AWA.Jobs.Services.Job_Type;
begin
J.Set_Parameter ("image_id", Image);
J.Schedule (Thumbnail_Job_Definition.Factory.all);
end Make_Thumbnail_Job;
-- ------------------------------
-- Returns true if the storage file has an image mime type.
-- ------------------------------
function Is_Image (File : in AWA.Storages.Models.Storage_Ref'Class) return Boolean is
Mime : constant String := File.Get_Mime_Type;
Pos : constant Natural := Util.Strings.Index (Mime, '/');
begin
if Pos = 0 then
return False;
else
return Mime (Mime'First .. Pos - 1) = "image";
end if;
end Is_Image;
-- ------------------------------
-- Create an image instance.
-- ------------------------------
procedure Create_Image (Plugin : in Image_Module;
File : in AWA.Storages.Models.Storage_Ref'Class) is
begin
if File.Get_Original.Is_Null then
declare
Ctx : constant AWA.Services.Contexts.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Img : AWA.Images.Models.Image_Ref;
begin
Img.Set_Width (0);
Img.Set_Height (0);
Img.Set_Thumb_Height (0);
Img.Set_Thumb_Width (0);
Img.Set_Storage (File);
Img.Set_Folder (File.Get_Folder);
Img.Set_Owner (File.Get_Owner);
Img.Save (DB);
Plugin.Make_Thumbnail_Job (Img);
end;
end if;
end Create_Image;
-- ------------------------------
-- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the item.
-- ------------------------------
overriding
procedure On_Create (Instance : in Image_Module;
Item : in AWA.Storages.Models.Storage_Ref'Class) is
begin
if Is_Image (Item) then
Instance.Create_Image (Item);
end if;
end On_Create;
-- ------------------------------
-- The `On_Update` procedure is called by `Notify_Update` to notify the update of the item.
-- ------------------------------
overriding
procedure On_Update (Instance : in Image_Module;
Item : in AWA.Storages.Models.Storage_Ref'Class) is
begin
if Is_Image (Item) then
Instance.Create_Image (Item);
else
Instance.Manager.Delete_Image (Item);
end if;
end On_Update;
-- ------------------------------
-- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the item.
-- ------------------------------
overriding
procedure On_Delete (Instance : in Image_Module;
Item : in AWA.Storages.Models.Storage_Ref'Class) is
begin
Instance.Manager.Delete_Image (Item);
end On_Delete;
-- ------------------------------
-- Thumbnail job to identify the image dimension and produce a thumbnail.
-- ------------------------------
procedure Do_Thumbnail_Job (Plugin : in Image_Module;
Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is
Image_Id : constant ADO.Identifier := Job.Get_Parameter ("image_id");
begin
Plugin.Manager.Build_Thumbnail (Image_Id);
end Do_Thumbnail_Job;
-- ------------------------------
-- Get the image module instance associated with the current application.
-- ------------------------------
function Get_Image_Module return Image_Module_Access is
function Get is new AWA.Modules.Get (Image_Module, Image_Module_Access, NAME);
begin
return Get;
end Get_Image_Module;
-- ------------------------------
-- Get the image manager instance associated with the current application.
-- ------------------------------
function Get_Image_Manager return Services.Image_Service_Access is
Module : constant Image_Module_Access := Get_Image_Module;
begin
if Module = null then
Log.Error ("There is no active Storage_Module");
return null;
else
return Module.Get_Image_Manager;
end if;
end Get_Image_Manager;
end AWA.Images.Modules;
|
Task/Long-multiplication/Ada/long-multiplication-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 16490 | with Ada.Text_IO;
with Long_Multiplication;
procedure Test_Long_Multiplication is
use Ada.Text_IO, Long_Multiplication;
N : Number := Value ("18446744073709551616");
M : Number := N * N;
begin
Put_Line (Image (N) & " * " & Image (N) & " = " & Image (M));
end Test_Long_Multiplication;
|
equality/groupoid.agda | HoTT/M-types | 27 | 3302 | {-# OPTIONS --without-K #-}
module equality.groupoid where
open import equality.core
_⁻¹ : ∀ {i}{X : Set i}{x y : X} → x ≡ y → y ≡ x
_⁻¹ = sym
left-unit : ∀ {i}{X : Set i}{x y : X}
→ (p : x ≡ y)
→ p · refl ≡ p
left-unit refl = refl
right-unit : ∀ {i}{X : Set i}{x y : X}
→ (p : x ≡ y)
→ refl · p ≡ p
right-unit refl = refl
associativity : ∀ {i}{X : Set i}{x y z w : X}
→ (p : x ≡ y)(q : y ≡ z)(r : z ≡ w)
→ p · q · r ≡ p · (q · r)
associativity refl _ _ = refl
left-inverse : ∀ {i}{X : Set i}{x y : X}
→ (p : x ≡ y)
→ p · p ⁻¹ ≡ refl
left-inverse refl = refl
right-inverse : ∀ {i}{X : Set i}{x y : X}
→ (p : x ≡ y)
→ p ⁻¹ · p ≡ refl
right-inverse refl = refl
|
programs/oeis/017/A017413.asm | karttu/loda | 1 | 5962 | <reponame>karttu/loda
; A017413: a(n) = 11*n + 2.
; 2,13,24,35,46,57,68,79,90,101,112,123,134,145,156,167,178,189,200,211,222,233,244,255,266,277,288,299,310,321,332,343,354,365,376,387,398,409,420,431,442,453,464,475,486,497,508,519,530,541,552,563,574,585,596,607,618,629,640,651,662,673,684,695,706,717,728,739,750,761,772,783,794,805,816,827,838,849,860,871,882,893,904,915,926,937,948,959,970,981,992,1003,1014,1025,1036,1047,1058,1069,1080,1091,1102,1113,1124,1135,1146,1157,1168,1179,1190,1201,1212,1223,1234,1245,1256,1267,1278,1289,1300,1311,1322,1333,1344,1355,1366,1377,1388,1399,1410,1421,1432,1443,1454,1465,1476,1487,1498,1509,1520,1531,1542,1553,1564,1575,1586,1597,1608,1619,1630,1641,1652,1663,1674,1685,1696,1707,1718,1729,1740,1751,1762,1773,1784,1795,1806,1817,1828,1839,1850,1861,1872,1883,1894,1905,1916,1927,1938,1949,1960,1971,1982,1993,2004,2015,2026,2037,2048,2059,2070,2081,2092,2103,2114,2125,2136,2147,2158,2169,2180,2191,2202,2213,2224,2235,2246,2257,2268,2279,2290,2301,2312,2323,2334,2345,2356,2367,2378,2389,2400,2411,2422,2433,2444,2455,2466,2477,2488,2499,2510,2521,2532,2543,2554,2565,2576,2587,2598,2609,2620,2631,2642,2653,2664,2675,2686,2697,2708,2719,2730,2741
mov $1,$0
mul $1,11
add $1,2
|
Games/banchorce/source/boss.asm | CiaranGruber/Ti-84-Calculator | 1 | 242527 | <filename>Games/banchorce/source/boss.asm<gh_stars>1-10
;---------------------------------------------------------------;
; ;
; Banchor ;
; Boss Routines ;
; ;
;---------------------------------------------------------------;
;------------------------------------------------
; iniBoss - start a boss encounter
; input: HL => x coord entry in warp
;------------------------------------------------
iniBoss:
ld a,(hl)
srl a
srl a
srl a
ld (demon),a
dec a
push af
call loadBossGfx
call clearAnimTable
call clearBulletTable
call clearDemonTable
call clearEnemyTable
REDRAW_HUD()
xor a
ld (hurt),a
ld (playerDir),a
ld (dCnt),a
ld (dFlags),a
ld (dHurt),a
ld hl,B_INI_YX
ld (y),hl
pop hl
ld l,3
mlt hl
ld de,bossIniTable
add hl,de
ld de,(hl)
ex de,hl
ld de,finishIniBoss
push de
jp (hl)
finishIniBoss:
#ifndef INVINCIBLE
ld (__demonDamage),a
ld a,b
ld (__demonBulletDamage),a
#endif
ld (__doDemon),ix
ld (__drawDemon),de
ld (__finishedDemon),hl
; do warp animation
call fadeOut
call drawMap
call vramFlip
call fadeIn
; fall through to mainBossLoop
;------------------------------------------------
; main boss loop
;------------------------------------------------
mainBossLoop:
ld hl,frame
inc (hl)
ld hl,mainBossLoop
ld (__pauseJump),hl
call keyScan
ld hl,hurt
ld a,(hl)
or a
jr z,mdlAfterHurt
dec (hl)
mdlAfterHurt:
ld a,(attacking)
or a
jr z,checkPlayerMovementD
inc a
jr nz,afterPlayerMovementD
checkPlayerMovementD:
ld a,(kbdG7)
push af
bit kbitUp,a
call nz,dPlayerUp
pop af
push af
bit kbitDown,a
call nz,dPlayerDown
pop af
push af
bit kbitLeft,a
call nz,dPlayerLeft
pop af
push af
bit kbitRight,a
call nz,dPlayerRight
pop af
or a
jr z,afterPlayerMovementD
ld hl,walkCnt
inc (hl)
afterPlayerMovementD:
ld a,(kbdG1)
bit kbitMode,a
jp nz,pauseGame
#ifdef BOSS_ESCAPE
; demon escape key for debugging purposes
bit kbitGraph,a
jp nz,demonFinished
#endif
bit kbit2nd,a
ld hl,afterAttackingDemon
jp nz,tryAttacking
xor a
ld (attacking),a
afterAttackingDemon:
; Move demon
__doDemon = $+1
call $000000
; Check sword/demon collisions
call loadDemonToCollide2
ld hl,dHurt
ld a,(attacking)
or a
jr z,playerNotAttackingDemon
inc a
jr z,playerNotAttackingDemon
push hl
call loadSwordToCollide1
call checkCollision
pop hl
jr nc,playerNotAttackingDemon
inc (hl)
ld a,(attackStrength)
ld de,0 \ ld e,a
ld hl,(dHealth)
or a
sbc hl,de
ld (dHealth),hl
jp c,demonFinished
jr afterCheckSDCollision
playerNotAttackingDemon:
ld (hl),0
afterCheckSDCollision:
; Check player/demon collisions
call loadPlayerToCollide1
call checkCollision
jr nc,afterCheckPDCollision
ld a,(hurt)
or a
jr nz,afterCheckPDCollision
#ifndef INVINCIBLE
__demonDamage = $+1
ld b,$00
call calculateDamage
call decPlayerHearts
ld a,INI_HURT
ld (hurt),a
#endif
afterCheckPDCollision:
; Check player/demon object collisions
ld b,MAX_DEMON_OBJECTS
ld ix,demonTable
checkPDCollisions:
push bc
ld a,(ix+D_DIR)
or a
jr z,endCheckPDCollisions
call loadBulletToCollide2
call checkCollision
jr nc,endCheckPDCollisions
ld a,(hurt)
or a
jr nz,endCheckPDCollisions
#ifndef INVINCIBLE
__demonBulletDamage = $+1
ld b,$00
call calculateDamage
call decPlayerHearts
ld a,INI_HURT
ld (hurt),a
#endif
endCheckPDCollisions:
pop bc
ld de,DEMON_ENTRY_SIZE
add ix,de
djnz checkPDCollisions
call drawMap
__drawDemon = $+1
call $000000
call drawDemonObjects
call drawPlayer
ld a,(__redrawHud)
or a
call nz,drawHud
call vramFlip
ld a,(hearts)
or a
jp nz,mainBossLoop
jp playerDead
;------------------------------------------------
; Finished
;------------------------------------------------
demonFinished:
xor a
ld (attacking),a
ld (demon),a
ld (frame),a
ld hl,(__drawDemon)
ld (__drawDemonDeath),hl
; boss death animation
; first, pause for a bit
call drawMap
__drawDemonDeath = $+1
call $000000
call drawPlayer
call vramFlip
ld bc,100000
call waitBC
; do some explosions
call clearAnimTable
ld bc,16*256+0
ld hl,bossExplodeTable
bossExplodeLoop:
bit 0,b
jr nz,noNewBossExplosion
ld a,c
cp 4
jr nc,noNewBossExplosion
inc c
push bc
ld bc,(dy)
add a,(hl)
add a,b
ld b,a
inc hl
ld a,(hl)
add a,c
ld c,a
inc hl
push hl
call newAnim
pop hl
pop bc
noNewBossExplosion:
push bc
push hl
call drawMap
call drawPlayer
call drawAnims
call vramFlip
call updateAnims
ld bc,10000
call waitBC
pop hl
pop bc
djnz bossExplodeLoop
ld bc,100000
call waitBC
; run routine to get all demon finished values (different for each demon)
__finishedDemon = $+1
call $000000
ld hl,demonWarp
ld (hl),a
inc hl
ld (hl),b
inc hl
ld (hl),c
ex de,hl
call addGold
ld a,(ix) ; A = Number of change list entries to add
or a
jr z,noDemonChanges
ld b,a
inc ix
doDemonChanges:
push bc
ld a,(ix+0)
ld b,(ix+1)
ld c,(ix+2)
call addToChangeList
pop bc
ld de,3
add ix,de
djnz doDemonChanges
noDemonChanges:
; player health to max
ld a,(maxHearts)
ld (hearts),a
ld a,INI_HEART_LEVEL
ld (heartLevel),a
; open top of boss room
ld hl,map+COLS+COLS+1
ld de,map+1
ld bc,COLS-2
ldir
; walk the player out of the room
xor a
ld (playerDir),a
bossVictoryWalk:
call drawMap
ld a,HUD_COUNT_MAX
call drawHud
call drawPlayer
call vramFlip
ld hl,walkCnt
inc (hl)
ld a,(y)
dec a
ld (y),a
jr nz,bossVictoryWalk
; reload standard tileset
call loadStdGfx
; warp back to dungeon
ld hl,demonWarp-1
jp warpToMap
;------------------------------------------------
; drawBoss - Draw 16x16 demon sprite
; input: HL => Sprite
; output: none
;------------------------------------------------
drawBoss:
ld a,(dHurt)
or a ; is the boss being attacked?
jr z,drawBossStart ; if not, draw normally
ld a,(frame)
and %00000001
jr z,drawBossStart ; only flash boss white every 2nd frame
; modify the boss sprite to be all white
ld de,tempSprite
push de
ld b,0 ; actually 256 LOL
drawBossModify:
ld a,(hl)
or a
jr z,drawBossModifyWrite
ld a,COLOUR_WHITE
drawBossModifyWrite:
ld (de),a
inc hl
inc de
djnz drawBossModify
pop hl
drawBossStart:
ld b,4
ld de,(dy)
ld ix,bossDrawTable
drawBossLoop:
push bc
push hl
push de
push ix
ld b,d
ld d,e
ld e,b
call drawSprite
pop ix
pop de
ld a,d
add a,(ix)
ld d,a
ld a,e
add a,(ix+1)
ld e,a
inc ix
inc ix
pop hl
ld bc,64
add hl,bc
pop bc
djnz drawBossLoop
ret
;------------------------------------------------
; drawDemonObjects - Draw demon objects
; input: none
; output: none
;------------------------------------------------
drawDemonObjects:
ld ix,demonTable
ld b,MAX_DEMON_OBJECTS
drawDemonObjectsLoop:
push bc
push ix
ld a,(ix+D_DIR)
or a
jr z,endDrawDemonObjectsLoop
ld e,(ix+D_X)
ld d,(ix+D_Y)
ld hl,sprBossBullet
call drawSprite
endDrawDemonObjectsLoop:
pop ix
pop bc
ld de,DEMON_ENTRY_SIZE
add ix,de
djnz drawDemonObjectsLoop
ret
;------------------------------------------------
; loadDemonToCollide2 - Load demon info to (collide2)
; input: none
; output: none
;------------------------------------------------
loadDemonToCollide2:
ld hl,collide2
ld a,(dx)
ld (hl),a
inc hl
ld (hl),16
inc hl
ld a,(dy)
ld (hl),a
inc hl
ld (hl),16
ret
;------------------------------------------------
; clearDemonTable - Clear demonTable
; input: none
; output: none
;------------------------------------------------
clearDemonTable:
ld hl,demonTable
ld b,MAX_DEMON_OBJECTS*DEMON_ENTRY_SIZE
jp _ld_hl_bz
;------------------------------------------------
; getEmptyDemonEntry - Try to find an empty entry in demonTable
; input: none
; output: HL => Start of entry (if one was found)
; CA = 1 if no entry was empty
;------------------------------------------------
getEmptyDemonEntry:
ld hl,demonTable
ld b,MAX_DEMON_OBJECTS
ld de,DEMON_ENTRY_SIZE
findEmptyDemonEntry:
ld a,(hl)
or a
ret z
add hl,de
djnz findEmptyDemonEntry
scf
ret
;------------------------------------------------
; getNumBossObjects - check the number of active boss objects/bullets
; input: none
; output: A = result
;------------------------------------------------
getNumBossObjects:
ld hl,demonTable
ld bc,MAX_DEMON_OBJECTS*256+0
ld de,DEMON_ENTRY_SIZE
countBossObjects:
ld a,(hl)
or a
jr z,countBossObjectsNext
inc c
countBossObjectsNext:
add hl,de
djnz countBossObjects
ld a,c
ret
;------------------------------------------------
; moveDemonObjectsNormal - Move all demon objects with standard angle code
; input: C = speed (same as values used in moveDir16)
; output: none
;------------------------------------------------
moveDemonObjectsNormal:
ld b,MAX_DEMON_OBJECTS
ld ix,demonTable
moveDemonObjectsLoop:
push bc
ld b,c
ld a,(ix+D_DIR)
or a
jr z,endMoveDemonObjectsLoop
call moveDemonObject
endMoveDemonObjectsLoop:
pop bc
ld de,DEMON_ENTRY_SIZE
add ix,de
djnz moveDemonObjectsLoop
ret
;------------------------------------------------
; moveDemonObject - Move a demon object
; input: IX => Start of object entry
; B = speed (same as values used in moveDir16)
; output: IX => Start of object entry
;------------------------------------------------
moveDemonObject:
ld a,(ix+D_DIR)
dec a
call moveDir16
ld a,(ix+E_X)
cp COLS*8
jr c,demonObjectCheckY
cp -8
jr c,demonObjectOffScreen
demonObjectCheckY:
ld a,(ix+D_Y)
cp ROWS*8
ret c
cp -8
ret nc
demonObjectOffScreen:
ld (ix+D_DIR),0
ret
;------------------------------------------------
; getDemonAngle - Get angle between demon & player
; input: none
; output: A = Angle
;------------------------------------------------
getDemonAngle:
call swapDemonXY
ld ix,dy-1
call getAngle
; Fall through to swapDemonXY and return
;------------------------------------------------
; swapDemonXY - Swap Demon X & Y coordinates
; input: none
; output: none
;------------------------------------------------
swapDemonXY:
ld hl,(dy)
ld e,l
ld l,h
ld h,e
ld (dy),hl
ret
;------------------------------------------------
; checkBossOnScreen - check to make sure boss is properly on-screen
; input: none
; output: none
;------------------------------------------------
checkBossOnScreen:
ld hl,dy
ld a,(hl)
cp (ROWS*8)-16
jr c,bossOnScreen1
ld (hl),(ROWS*8)-16
bossOnScreen1:
cp 8
jr nc,bossOnScreen2
ld (hl),8
bossOnScreen2:
inc hl ; HL => Demon X pos
ld a,(hl)
cp (COLS*8)-16-8
jr c,bossOnScreen3
ld (hl),(COLS*8)-16-8
bossOnScreen3:
cp 8
ret nc
ld (hl),8
ret
;------------------------------------------------
; loadBossGfx - load the tile data, load the boss sprites, load the boss room to (map)
; input: A = boss #
; output: none
;------------------------------------------------
loadBossGfx:
push af
add a,GFX_FILE_BOSS_FLOORS
push af
call getGfxFile
pop bc
ld hl,tileset
ex de,hl
push hl
ld ix,huffTree
call huffExtr ; unpack floor tiles
pop hl
ld de,tileset+(4*64)
ld b,GFX_FILE_BOSS_WALLS
ld ix,huffTree
call huffExtr ; unpack wall tiles
pop af
add a,GFX_FILE_BOSS_SPRITES
push af
call getGfxFile
pop bc
ld hl,sprBoss
ex de,hl
ld ix,huffTree
call huffExtr ; unpack boss sprites
ld hl,bossRoom
ld de,map
ld bc,TILE_DATA_SIZE
ldir
ret
;------------------------------------------------
; Initialisation routine pointers
;------------------------------------------------
bossIniTable:
.dl iniHeath,iniDezemon,iniWendeg,iniBelkath,iniAnazar,iniMargoth,iniDurcrux,iniBanchor
.end
|
tier-1/speech_tools/source/thin/speech_tools_c-pointers.ads | charlie5/cBound | 2 | 21928 | <filename>tier-1/speech_tools/source/thin/speech_tools_c-pointers.ads
-- This file is generated by SWIG. Please do *not* modify by hand.
--
with interfaces.C;
package speech_tools_c.Pointers
is
-- EST_Wave_Pointer
--
type EST_Wave_Pointer is access all speech_tools_c.EST_Wave;
-- EST_Wave_Pointers
--
type EST_Wave_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Wave_Pointer;
-- EST_String_Pointer
--
type EST_String_Pointer is access all speech_tools_c.EST_String;
-- EST_String_Pointers
--
type EST_String_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_String_Pointer;
-- EST_Item_featfunc_Pointer
--
type EST_Item_featfunc_Pointer is access all speech_tools_c.EST_Item_featfunc;
-- EST_Item_featfunc_Pointers
--
type EST_Item_featfunc_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Item_featfunc_Pointer;
-- EST_Item_Pointer
--
type EST_Item_Pointer is access all speech_tools_c.EST_Item;
-- EST_Item_Pointers
--
type EST_Item_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Item_Pointer;
-- EST_Val_Pointer
--
type EST_Val_Pointer is access all speech_tools_c.EST_Val;
-- EST_Val_Pointers
--
type EST_Val_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Val_Pointer;
-- LISP_Pointer
--
type LISP_Pointer is access all speech_tools_c.LISP;
-- LISP_Pointers
--
type LISP_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.LISP_Pointer;
-- EST_Ngrammar_Pointer
--
type EST_Ngrammar_Pointer is access all speech_tools_c.EST_Ngrammar;
-- EST_Ngrammar_Pointers
--
type EST_Ngrammar_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Ngrammar_Pointer;
-- EST_WFST_Pointer
--
type EST_WFST_Pointer is access all speech_tools_c.EST_WFST;
-- EST_WFST_Pointers
--
type EST_WFST_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_WFST_Pointer;
-- EST_Utterance_Pointer
--
type EST_Utterance_Pointer is access all speech_tools_c.EST_Utterance;
-- EST_Utterance_Pointers
--
type EST_Utterance_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.EST_Utterance_Pointer;
-- UnitDatabase_Pointer
--
type UnitDatabase_Pointer is access all speech_tools_c.UnitDatabase;
-- UnitDatabase_Pointers
--
type UnitDatabase_Pointers is array (interfaces.C.Size_t range <>) of aliased speech_tools_c.Pointers.UnitDatabase_Pointer;
end speech_tools_c.Pointers;
|
libsrc/_DEVELOPMENT/adt/p_list/c/sdcc_iy/p_list_remove_after_callee.asm | jpoikela/z88dk | 640 | 85066 | <gh_stars>100-1000
; void *p_list_remove_after_callee(p_list_t *list, void *list_item)
SECTION code_clib
SECTION code_adt_p_list
PUBLIC _p_list_remove_after_callee
EXTERN asm_p_list_remove_after
_p_list_remove_after_callee:
pop hl
pop bc
ex (sp),hl
jp asm_p_list_remove_after
|
test/Succeed/Issue4269.agda | shlevy/agda | 1,989 | 2004 | <filename>test/Succeed/Issue4269.agda
-- Reported by <NAME> on 2019-12-07
open import Agda.Primitive
postulate
i : Level
X : Set i
mutual
j : Level
j = _
Y : Set j
Y = X
-- WAS: unsolved constraint i = _2
-- SHOULD: succeed with everything solved
|
programs/oeis/053/A053186.asm | neoneye/loda | 22 | 27872 | <reponame>neoneye/loda<filename>programs/oeis/053/A053186.asm
; A053186: Square excess of n: difference between n and largest square <= n.
; 0,0,1,2,0,1,2,3,4,0,1,2,3,4,5,6,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
mov $3,$0
mov $0,-1
lpb $2,4
add $0,2
sub $3,$0
trn $2,$3
lpe
mov $0,$3
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/forward_vla.adb | best08618/asylo | 7 | 26094 | <gh_stars>1-10
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -Wuninitialized" }
procedure Forward_Vla is
function N return Natural is begin return 1; end;
type Sequence;
type Sequence_Access is access all Sequence;
Ptr : Sequence_Access := null; -- freeze access type
Sequence_Length : Natural := N;
type Sequence is array (1 .. Sequence_Length) of Natural;
Seq : Sequence;
begin
Seq (1) := 0;
end;
|
source/image/required/s-imguns.ads | ytomino/drake | 33 | 14771 | <reponame>ytomino/drake
pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Long_Long_Integer_Types;
with System.Unsigned_Types;
package System.Img_Uns is
pragma Pure;
-- required for Modular'Image by compiler (s-imguns.ads)
procedure Image_Unsigned (
V : Unsigned_Types.Unsigned;
S : in out String;
P : out Natural);
-- helper
procedure Image (
V : Long_Long_Integer_Types.Word_Unsigned;
S : in out String;
P : out Natural);
end System.Img_Uns;
|
test/Succeed/Issue2822ParseWithPatternWithOperatorNames.agda | shlevy/agda | 1,989 | 6467 | -- Andreas, 2017-11-04, while refactoring for issue #2822
-- This is a test case for a with-pattern that overloads operator names
postulate
A : Set
_<_ _>_ : A → A → A
data D : Set where
c : A → A → D
postulate
f : D
bla : D → Set
bla (c < >) = A
test : Set
test with f
test | c < > = A
-- This triggers a call to Agda.Syntax.Concrete.Operators.validConPattern, case WithP
-- Should parse.
|
Appl/Saver/Fades/fades.asm | steakknife/pcgeos | 504 | 170603 | <filename>Appl/Saver/Fades/fades.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC/GEOS
MODULE: fades
FILE: fades.asm
AUTHOR: <NAME>, Sep 11, 1991
REVISION HISTORY:
Name Date Description
---- ---- -----------
Gene 9/11/91 Initial revision
DESCRIPTION:
fades & wipes specific screen-saver library
$Id: fades.asm,v 1.1 97/04/04 16:44:53 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include stdapp.def
include timer.def
include initfile.def
UseLib ui.def
UseLib saver.def
;==============================================================================
;
; CONSTANTS AND DATA TYPES
;
;==============================================================================
include fades.def
;=============================================================================
;
; OBJECT CLASSES
;
;=============================================================================
FadesApplicationClass class SaverApplicationClass
MSG_FADES_APP_DRAW message
;
; Start drawing the fade (sent by timer).
;
; Pass: nothing
; Return: nothing
;
FAI_speed word SAVER_FADE_MEDIUM_SPEED
FAI_type word FADE_WIPE_TO_0000
FAI_timerHandle hptr 0
noreloc FAI_timerHandle
FAI_timerID word 0
FadesApplicationClass endc
FadesProcessClass class GenProcessClass
FadesProcessClass endc
;==============================================================================
;
; VARIABLES
;
;==============================================================================
include fades.rdef
ForceRef FadesApp
udata segment
udata ends
idata segment
FadesProcessClass mask CLASSF_NEVER_SAVED
FadesApplicationClass
idata ends
FadesCode segment resource
.warn -private
fadesOptionTable SAOptionTable <
fadesCategory, length fadesOptions
>
fadesOptions SAOptionDesc <
fadesSpeedKey, size FAI_speed, offset FAI_speed
>, <
fadesTypeKey, size FAI_type, offset FAI_type
>
.warn @private
fadesCategory char 'fades', 0
fadesSpeedKey char 'speed', 0
fadesTypeKey char 'type', 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FadesLoadOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Load our options from the ini file.
CALLED BY: MSG_META_LOAD_OPTIONS
PASS: *ds:si = FadesApplicationClass object
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FadesLoadOptions method dynamic FadesApplicationClass,
MSG_META_LOAD_OPTIONS
uses ax, es
.enter
segmov es, cs
mov bx, offset fadesOptionTable
call SaverApplicationGetOptions
.leave
mov di, offset FadesApplicationClass
GOTO ObjCallSuperNoLock
FadesLoadOptions endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FadesAppSetWin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Record the window & gstate to use, and start things going.
CALLED BY: MSG_SAVER_APP_SET_WIN
PASS: *ds:si = FadesApplicationClass object
dx = window
bp = gstate
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FadesAppSetWin method dynamic FadesApplicationClass,
MSG_SAVER_APP_SET_WIN
;
; Let the superclass do its little thing.
;
mov di, offset FadesApplicationClass
call ObjCallSuperNoLock
;
; Do the fade.
;
mov di, ds:[si]
add di, ds:[di].FadesApplication_offset
call FadesStart
ret
FadesAppSetWin endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FadesAppGetWinColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Makes sure the window is transparent.
CALLED BY: MSG_SAVER_APP_GET_WIN_COLOR
PASS: *ds:si = FadesApplicationClass object
ds:di = FadesApplicationClass instance data
RETURN: ax = WinColorFlags
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FadesAppGetWinColor method dynamic FadesApplicationClass,
MSG_SAVER_APP_GET_WIN_COLOR
;
; Let the superclass do its thing.
;
mov di, offset FadesApplicationClass
call ObjCallSuperNoLock
ornf ah, mask WCF_TRANSPARENT
ret
FadesAppGetWinColor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FadesStart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Start saving the screen in our own little way
CALLED BY: FadesAppSetWin
PASS: ds:[di] = FadesApplicationInstance
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/92 port to 2.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FadesStart proc near
class FadesApplicationClass
;
; We fade to black
;
mov bp, di ; bp = instance data
mov di, ds:[di].SAI_curGState
mov ax, C_BLACK or (CF_INDEX shl 8)
call GrSetAreaColor
mov di, bp ; di = instance data
;
; Fade me jesus
;
clrdw axbx ; window left & top
mov cx, ds:[di].SAI_bounds.R_right ; cx <- window right
mov dx, ds:[di].SAI_bounds.R_bottom ; dx <- window bottom
mov si, ds:[di].FAI_type ; si <- FadeTypes
cmp si, FADE_WIPE_TO_LTRB
jbe doFadeWipe
;
; A "normal" fade or wipe -- table drive it...
;
sub si, FADE_WIPE_TO_LTRB+1
shl si, 1 ; table of words
mov bp, cs:fadeRoutines[si] ; bp <- routine to call
mov si, ds:[di].FAI_speed ; si <- SaverFadeSpeeds
mov di, ds:[di].SAI_curGState ; di = gstate
call bp
done:
ret
doFadeWipe:
mov bp, ds:[di].FAI_type ; bp <- SaverWipeTypes
mov si, ds:[di].FAI_speed ; si <- SaverFadeSpeeds
mov di, ds:[di].SAI_curGState ; di = gstate
call SaverFadeWipe
jmp short done
FadesStart endp
CheckHack <FADE_WIPE_TO_0000 eq 0>
CheckHack <FADE_WIPE_TO_LTRB eq 15>
CheckHack <FADE_PATTERN eq 16>
fadeRoutines nptr \
FadePatternFade
FadePatternFade proc near
call SaverFadePatternFade
ret
FadePatternFade endp
FadesCode ends
|
agda/sn-calculus-compatconf/split.agda | florence/esterel-calculus | 3 | 9019 | module sn-calculus-compatconf.split where
open import sn-calculus-compatconf.base
open import sn-calculus
open import utility renaming (_U̬_ to _∪_)
open import context-properties
using (unwrap-rho ; wrap-rho ; ->E-view ; plugc ; unplugc)
open import Esterel.Lang
open import Esterel.Lang.Properties
open import Esterel.Lang.Binding
open import Esterel.Lang.CanFunction
using (Can ; Canₛ ; Canₛₕ ; Canₖ ; module CodeSet)
open import Esterel.Environment as Env
using (Env ; Θ ; _←_ ; Dom ; module SigMap ; module ShrMap ; module VarMap)
open import Esterel.Context
using (EvaluationContext ; EvaluationContext1 ; _⟦_⟧e ; _≐_⟦_⟧e ;
Context ; Context1 ; _⟦_⟧c ; _≐_⟦_⟧c)
open import Esterel.CompletionCode as Code
using () renaming (CompletionCode to Code)
open import Esterel.Variable.Signal as Signal
using (Signal ; _ₛ)
open import Esterel.Variable.Shared as SharedVar
using (SharedVar ; _ₛₕ)
open import Esterel.Variable.Sequential as SeqVar
using (SeqVar ; _ᵥ)
open import Relation.Nullary
using (¬_ ; Dec ; yes ; no)
open import Relation.Binary.PropositionalEquality
using (_≡_ ; refl ; sym ; cong ; trans ; subst ; module ≡-Reasoning)
open import Data.Bool
using (Bool ; if_then_else_)
open import Data.Empty
using (⊥ ; ⊥-elim)
open import Data.List
using (List ; _∷_ ; [] ; _++_)
open import Data.List.Any
using (Any ; any ; here ; there)
open import Data.List.Any.Properties
using ()
renaming (++⁺ˡ to ++ˡ ; ++⁺ʳ to ++ʳ)
open import Data.Maybe
using (Maybe ; just ; nothing)
open import Data.Nat
using (ℕ ; zero ; suc ; _+_) renaming (_⊔_ to _⊔ℕ_)
open import Data.Product
using (Σ-syntax ; Σ ; _,_ ; _,′_ ; proj₁ ; proj₂ ; _×_ ; ∃)
open import Data.Sum
using (_⊎_ ; inj₁ ; inj₂ ; map)
open import Function using (_∘_ ; id ; _∋_)
open import Data.OrderedListMap Signal Signal.unwrap Signal.Status as SigM
open import Data.OrderedListMap SharedVar SharedVar.unwrap (Σ SharedVar.Status (λ _ → ℕ)) as ShrM
open import Data.OrderedListMap SeqVar SeqVar.unwrap ℕ as SeqM
open ->E-view
open EvaluationContext1
open _≐_⟦_⟧e
open Context1
open _≐_⟦_⟧c
open ListSet Data.Nat._≟_
{-
Base case where (E, C) = ([], _∷_).
Simply switch the reductions. Note that since E = [], the rmerge rule
at LHS is actually ρθ.ρθ'.qin sn⟶₁ ρ(θ←θ').qin. Since C = _∷_, the
reduction at RHS must go inside ρθ' so it's easy to handle.
p
ρθ. E⟦ qin ⟧ -- sn⟶₁ -> ρθq. E⟦ qo ⟧
(ρθ) E⟦C⟦rin⟧⟧ -- sn⟶₁ -> (ρθ) E⟦C⟦ro⟧⟧
-}
1-steplρ-E-view-ecsplit : ∀{E C p qin q qo rin r ro θ θq BV FV A Aq} →
{ρθ·psn⟶₁ρθq·q : ρ⟨ θ , A ⟩· p sn⟶₁ ρ⟨ θq , Aq ⟩· q} →
CorrectBinding p BV FV →
two-roads-diverged E C →
(p≐E⟦qin⟧ : p ≐ E ⟦ qin ⟧e) →
(q≐E⟦qo⟧ : q ≐ E ⟦ qo ⟧e) →
->E-view ρθ·psn⟶₁ρθq·q p≐E⟦qin⟧ q≐E⟦qo⟧ →
(p≐E⟦rin⟧ : p ≐ C ⟦ rin ⟧c) →
(r≐E⟦ro⟧ : r ≐ C ⟦ ro ⟧c) →
(rinsn⟶₁ro : rin sn⟶₁ ro) →
∃ λ po →
-- LHS: 0 or 1 step (ρθ) C⟦qo⟧ sn⟶* (ρθ) C⟦poq⟧ reduction inside ρθ [ ]
(q ≡ po ⊎ q sn⟶ po)
×
-- RHS: ρθ. E'⟦ro'⟧ sn⟶₁ ρθq. E'⟦por⟧
Σ (EvaluationContext × Term × Term) λ { (E' , ro' , por) →
Σ[ r≐E'⟦ro'⟧ ∈ r ≐ E' ⟦ ro' ⟧e ]
Σ[ po≐E'⟦por⟧ ∈ po ≐ E' ⟦ por ⟧e ]
Σ[ ρθ·rsn⟶₁ρθq·po ∈ ρ⟨ θ , A ⟩· r sn⟶₁ ρ⟨ θq , Aq ⟩· po ]
->E-view ρθ·rsn⟶₁ρθq·po r≐E'⟦ro'⟧ po≐E'⟦por⟧
}
1-steplρ-E-view-ecsplit cb divout-disjoint dehole dehole
vemit () r≐C⟦ro⟧ rinsn⟶₁ro
1-steplρ-E-view-ecsplit cb divout-disjoint dehole dehole
vset-shared-value-old () r≐C⟦ro⟧ rinsn⟶₁ro
1-steplρ-E-view-ecsplit cb divout-disjoint dehole dehole
vset-shared-value-new () r≐C⟦ro⟧ rinsn⟶₁ro
1-steplρ-E-view-ecsplit cb divout-disjoint dehole dehole
vset-var () r≐C⟦ro⟧ rinsn⟶₁ro
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·psn⟶₁ρθq·q} cb
divout-disjoint dehole dehole vmerge
ρθp≐C⟦rin⟧ ρθr≐C⟦ro⟧ rinsn⟶₁ro
with ρθp≐C⟦rin⟧ | ρθr≐C⟦ro⟧
... | dcenv p≐C⟦rin⟧ | dcenv r≐C⟦ro⟧ with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ p≐C⟦rin⟧ rinsn⟶₁ro) ,′
_ , dehole , dehole , rmerge dehole , vmerge
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ris-present {_} {S} S∈ θS≡present dehole} cb
divout-disjoint dehole dehole vis-present
(dcpresent₁ p≐C⟦rin⟧) (dcpresent₁ r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ p≐C⟦rin⟧ rinsn⟶₁ro) ,′
_ , dehole , dehole , ris-present {_} {S} S∈ θS≡present dehole , vis-present
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ris-present {_} {S} S∈ θS≡present dehole} cb
divout-disjoint dehole dehole vis-present
(dcpresent₂ p≐C⟦rin⟧) (dcpresent₂ r≐C⟦ro⟧) rinsn⟶₁ro =
_ , inj₁ refl ,′
_ , dehole , dehole , ris-present {_} {S} S∈ θS≡present dehole , vis-present
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ris-absent {_} {S} S∈ θS≡absent dehole} cb
divout-disjoint dehole dehole vis-absent
(dcpresent₁ p≐C⟦rin⟧) (dcpresent₁ r≐C⟦ro⟧) rinsn⟶₁ro =
_ , inj₁ refl ,′
_ , dehole , dehole , ris-absent {_} {S} S∈ θS≡absent dehole , vis-absent
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ris-absent {_} {S} S∈ θS≡absent dehole} cb
divout-disjoint dehole dehole vis-absent
(dcpresent₂ p≐C⟦rin⟧) (dcpresent₂ r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ p≐C⟦rin⟧ rinsn⟶₁ro) ,′
_ , dehole , dehole , ris-absent {_} {S} S∈ θS≡absent dehole , vis-absent
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rraise-shared {_} {_} {s} _ _} cb
divout-disjoint dehole dehole vraise-shared
(dcshared p≐C⟦rin⟧) (dcshared r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcenv p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , dehole , dehole , rraise-shared {_} {_} {s} _ _ , vraise-shared
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rraise-var {_} {_} {x} _ _} cb
divout-disjoint dehole dehole vraise-var
(dcvar p≐C⟦rin⟧) (dcvar r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcenv p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , dehole , dehole , rraise-var {_} {_} {x} _ _ , vraise-var
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rif-false {x = x} x∈ θx≡zero dehole} cb
divout-disjoint dehole dehole vif-false
(dcif₁ p≐C⟦rin⟧) (dcif₁ r≐C⟦ro⟧) rinsn⟶₁ro =
_ , inj₁ refl ,′
_ , dehole , dehole , rif-false {x = x} x∈ θx≡zero dehole , vif-false
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rif-false {x = x} x∈ θx≡zero dehole} cb
divout-disjoint dehole dehole vif-false
(dcif₂ p≐C⟦rin⟧) (dcif₂ r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ p≐C⟦rin⟧ rinsn⟶₁ro) ,′
_ , dehole , dehole , rif-false {x = x} x∈ θx≡zero dehole , vif-false
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rif-true {θ} {x = x} x∈ θx≡suc dehole} cb
divout-disjoint dehole dehole vif-true
(dcif₁ p≐C⟦rin⟧) (dcif₁ r≐C⟦ro⟧) rinsn⟶₁ro with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ p≐C⟦rin⟧ rinsn⟶₁ro) ,′
_ , dehole , dehole , rif-true {x = x} x∈ θx≡suc dehole , vif-true
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = rif-true {x = x} x∈ θx≡suc dehole} cb
divout-disjoint dehole dehole vif-true
(dcif₂ p≐C⟦rin⟧) (dcif₂ r≐C⟦ro⟧) rinsn⟶₁ro =
_ , inj₁ refl ,′
_ , dehole , dehole , rif-true {x = x} x∈ θx≡suc dehole , vif-true
1-steplρ-E-view-ecsplit cb divpar-split₁
(depar₁ p₁≐E⟦qin⟧) (depar₁ q≐E⟦qo⟧) e-view
(dcpar₂ p≐C⟦rin⟧) (dcpar₂ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho _ _ _ p₁≐E⟦qin⟧ q≐E⟦qo⟧ e-view
... | ρθ·p₁sn⟶₁ρθq·q , e-view' with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcpar₂ p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , _ , _ , wrap-rho ρθ·p₁sn⟶₁ρθq·q _ _ e-view' _ (depar₁ p₁≐E⟦qin⟧) (depar₁ q≐E⟦qo⟧)
1-steplρ-E-view-ecsplit cb divpar-split₂
(depar₂ p₂≐E⟦qin⟧) (depar₂ q≐E⟦qo⟧) e-view
(dcpar₁ p≐C⟦rin⟧) (dcpar₁ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho _ _ _ p₂≐E⟦qin⟧ q≐E⟦qo⟧ e-view
... | ρθ·p₂sn⟶₁ρθq·q , e-view' with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcpar₁ p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , _ , _ , wrap-rho ρθ·p₂sn⟶₁ρθq·q _ _ e-view' _ (depar₂ p₂≐E⟦qin⟧) (depar₂ q≐E⟦qo⟧)
1-steplρ-E-view-ecsplit cb divseq-split
(deseq p₁≐E⟦qin⟧) (deseq q≐E⟦qo⟧) e-view
(dcseq₂ p≐C⟦rin⟧) (dcseq₂ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho _ _ _ p₁≐E⟦qin⟧ q≐E⟦qo⟧ e-view
... | ρθ·p₁sn⟶₁ρθq·q , e-view' with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcseq₂ p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , _ , _ , wrap-rho ρθ·p₁sn⟶₁ρθq·q _ _ e-view' _ (deseq p₁≐E⟦qin⟧) (deseq q≐E⟦qo⟧)
1-steplρ-E-view-ecsplit cb divloopˢ-split
(deloopˢ p₁≐E⟦qin⟧) (deloopˢ q≐E⟦qo⟧) e-view
(dcloopˢ₂ p≐C⟦rin⟧) (dcloopˢ₂ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho _ _ _ p₁≐E⟦qin⟧ q≐E⟦qo⟧ e-view
... | ρθ·p₁sn⟶₁ρθq·q , e-view' with sym (unplugc r≐C⟦ro⟧)
... | refl
= _ , inj₂ (rcontext _ (dcloopˢ₂ p≐C⟦rin⟧) rinsn⟶₁ro) ,′
_ , _ , _ , wrap-rho ρθ·p₁sn⟶₁ρθq·q _ _ e-view' _ (deloopˢ p₁≐E⟦qin⟧) (deloopˢ q≐E⟦qo⟧)
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBpar cbp cbq _ _ _ _) (divin div)
(depar₁ p≐E⟦qin⟧) (depar₁ q≐E⟦qo⟧) e-view-E₁
(dcpar₁ p≐C⟦rin⟧) (dcpar₁ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (depar₁ p≐E⟦qin⟧) (depar₁ q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cbp div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval (epar₁ _))) qsn⟶po? ,′
_ , depar₁ r≐E'⟦qin⟧ , depar₁ po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBpar cbp cbq _ _ _ _) (divin div)
(depar₂ p≐E⟦qin⟧) (depar₂ q≐E⟦qo⟧) e-view-E₁
(dcpar₂ p≐C⟦rin⟧) (dcpar₂ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (depar₂ p≐E⟦qin⟧) (depar₂ q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cbq div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval (epar₂ _))) qsn⟶po? ,′
_ , depar₂ r≐E'⟦qin⟧ , depar₂ po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBseq cbp cbq _) (divin div)
(deseq p≐E⟦qin⟧) (deseq q≐E⟦qo⟧) e-view-E₁
(dcseq₁ p≐C⟦rin⟧) (dcseq₁ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (deseq p≐E⟦qin⟧) (deseq q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cbp div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval (eseq _))) qsn⟶po? ,′
_ , deseq r≐E'⟦qin⟧ , deseq po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBloopˢ cbp cbq _ _) (divin div)
(deloopˢ p≐E⟦qin⟧) (deloopˢ q≐E⟦qo⟧) e-view-E₁
(dcloopˢ₁ p≐C⟦rin⟧) (dcloopˢ₁ r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (deloopˢ p≐E⟦qin⟧) (deloopˢ q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cbp div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval (eloopˢ _))) qsn⟶po? ,′
_ , deloopˢ r≐E'⟦qin⟧ , deloopˢ po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBsusp cb' _) (divin div)
(desuspend p≐E⟦qin⟧) (desuspend q≐E⟦qo⟧) e-view-E₁
(dcsuspend p≐C⟦rin⟧) (dcsuspend r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (desuspend p≐E⟦qin⟧) (desuspend q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cb' div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval (esuspend _))) qsn⟶po? ,′
_ , desuspend r≐E'⟦qin⟧ , desuspend po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
1-steplρ-E-view-ecsplit {ρθ·psn⟶₁ρθq·q = ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧}
cb@(CBtrap cb') (divin div)
(detrap p≐E⟦qin⟧) (detrap q≐E⟦qo⟧) e-view-E₁
(dctrap p≐C⟦rin⟧) (dctrap r≐C⟦ro⟧) rinsn⟶₁ro
with unwrap-rho ρθ·E₁⟦p⟧sn⟶₁ρθq·E₁⟦q⟧ (detrap p≐E⟦qin⟧) (detrap q≐E⟦qo⟧) p≐E⟦qin⟧ q≐E⟦qo⟧ e-view-E₁
... | (ρθ·psn⟶₁ρθq·q , e-view)
with 1-steplρ-E-view-ecsplit cb' div p≐E⟦qin⟧ q≐E⟦qo⟧ e-view p≐C⟦rin⟧ r≐C⟦ro⟧ rinsn⟶₁ro
... | _ , qsn⟶po? , _ , r≐E'⟦qin⟧ , po≐E'⟦qo⟧ , _ , e-view' =
_ , map (cong _) (Context1-sn⟶ (ceval etrap)) qsn⟶po? ,′
_ , detrap r≐E'⟦qin⟧ , detrap po≐E'⟦qo⟧ , wrap-rho _ _ _ e-view' _ _ _
|
P6/data_P6_2/MDTest73.asm | alxzzhou/BUAA_CO_2020 | 1 | 28455 | <gh_stars>1-10
ori $ra,$ra,0xf
div $6,$ra
lui $5,1893
mflo $5
sll $4,$4,7
srav $1,$0,$4
multu $4,$4
divu $4,$ra
sll $0,$4,18
srav $4,$2,$4
addiu $4,$2,19942
sb $5,5($0)
lui $5,9502
lb $6,10($0)
ori $5,$0,56128
mfhi $5
sb $6,5($0)
sb $5,0($0)
divu $6,$ra
ori $5,$2,28752
multu $4,$5
divu $5,$ra
srav $1,$0,$2
sb $5,16($0)
sll $2,$2,20
addu $5,$5,$2
divu $5,$ra
mthi $3
mult $5,$4
mfhi $4
sll $1,$1,2
mthi $4
mflo $4
addu $0,$0,$0
mtlo $1
addu $1,$4,$1
mthi $1
sll $4,$2,10
ori $5,$5,59924
lui $5,43780
divu $1,$ra
lb $3,9($0)
mult $0,$6
divu $1,$ra
mult $4,$4
addu $1,$1,$2
sll $3,$3,16
mthi $4
sb $6,5($0)
mflo $4
lb $6,11($0)
mflo $4
sll $4,$4,20
addu $0,$4,$0
div $1,$ra
addu $4,$0,$4
srav $2,$2,$3
sll $3,$3,28
lui $6,54815
mflo $4
lb $6,0($0)
sll $5,$4,16
multu $2,$1
sb $3,12($0)
addiu $5,$4,21267
mtlo $1
sll $2,$2,29
lb $0,13($0)
sb $5,16($0)
div $5,$ra
addiu $4,$2,-29992
multu $5,$6
mult $4,$1
lui $2,3660
srav $4,$4,$4
mfhi $1
mult $6,$6
divu $4,$ra
srav $1,$4,$4
addu $5,$5,$4
addu $6,$6,$3
addu $5,$5,$4
divu $3,$ra
mflo $4
divu $6,$ra
lui $1,17119
mflo $5
mult $1,$5
mflo $5
multu $6,$2
divu $4,$ra
div $5,$ra
sll $0,$3,16
mfhi $5
mult $4,$4
mflo $2
srav $0,$2,$4
sll $1,$0,18
addiu $0,$2,-1417
sb $4,12($0)
lui $4,13143
sb $4,3($0)
div $5,$ra
multu $1,$5
addiu $4,$3,25160
mflo $5
srav $1,$0,$2
srav $0,$4,$4
srav $3,$4,$3
ori $5,$5,14019
multu $2,$2
ori $4,$4,22711
addiu $5,$5,7569
addu $4,$0,$0
mthi $4
multu $1,$4
sll $4,$2,12
div $5,$ra
mthi $4
mfhi $3
srav $5,$6,$5
lb $5,3($0)
ori $1,$5,22526
addu $1,$4,$6
sb $3,7($0)
mtlo $2
mfhi $0
mthi $5
mtlo $0
div $5,$ra
lb $1,8($0)
mfhi $0
div $1,$ra
lb $6,10($0)
sll $1,$1,13
mfhi $4
mflo $2
addiu $4,$4,-28229
divu $0,$ra
lb $5,5($0)
lui $2,44302
lb $1,3($0)
addu $6,$5,$6
mtlo $2
mflo $6
srav $0,$5,$2
addu $4,$2,$4
mtlo $2
mult $1,$2
lui $6,38898
mthi $2
mult $4,$4
divu $4,$ra
srav $4,$1,$2
ori $4,$1,23667
ori $4,$0,42196
lb $4,4($0)
mfhi $5
div $4,$ra
mthi $0
ori $0,$4,44338
mfhi $4
mtlo $1
addu $0,$5,$5
multu $3,$1
mtlo $0
mtlo $5
sb $5,5($0)
ori $4,$2,38793
div $2,$ra
lb $5,8($0)
multu $3,$5
multu $5,$4
lui $0,34812
sb $1,3($0)
ori $4,$6,18445
lui $5,58708
div $0,$ra
addu $4,$4,$4
lb $1,8($0)
div $5,$ra
mtlo $5
srav $0,$2,$3
addiu $4,$5,-25053
srav $4,$6,$4
ori $1,$2,1548
divu $4,$ra
mthi $4
mflo $5
lb $4,1($0)
srav $5,$3,$3
mtlo $4
addiu $4,$4,8906
div $3,$ra
mthi $5
lb $1,9($0)
divu $5,$ra
mult $0,$0
srav $4,$6,$6
mflo $6
divu $4,$ra
mfhi $5
ori $4,$4,15092
div $6,$ra
mflo $5
div $1,$ra
multu $4,$1
mthi $3
addiu $1,$2,26828
multu $5,$6
multu $1,$4
sll $4,$5,13
sb $5,8($0)
lb $6,3($0)
addiu $5,$4,1063
div $6,$ra
mflo $0
addu $2,$4,$2
lb $5,9($0)
mflo $2
ori $3,$3,21520
addiu $1,$4,-9921
mflo $4
multu $0,$0
lui $4,48765
mult $3,$0
div $6,$ra
mult $4,$2
multu $5,$1
div $1,$ra
addiu $1,$4,19204
mult $2,$2
addiu $1,$4,-26500
sll $5,$5,4
sll $4,$4,2
mflo $1
addu $2,$6,$2
addu $1,$2,$3
sb $4,1($0)
lui $6,58251
ori $3,$3,15665
multu $6,$4
lb $0,9($0)
mthi $0
div $1,$ra
div $0,$ra
mult $5,$1
srav $2,$2,$4
lui $1,7941
addu $4,$4,$4
multu $4,$6
sll $6,$1,8
lb $4,1($0)
lui $5,21667
div $0,$ra
lb $2,1($0)
mflo $5
srav $4,$5,$5
lui $3,13652
sb $1,14($0)
divu $4,$ra
srav $3,$4,$3
multu $0,$4
mthi $4
srav $0,$6,$1
lb $4,2($0)
mthi $1
div $6,$ra
srav $4,$4,$4
lui $6,41616
multu $5,$4
mult $0,$3
mult $1,$2
lb $4,5($0)
addu $4,$0,$0
addiu $5,$5,476
divu $5,$ra
multu $3,$4
mthi $1
mtlo $4
ori $6,$5,27426
lb $4,2($0)
mult $0,$2
mfhi $6
multu $4,$2
div $4,$ra
sll $5,$2,3
srav $4,$4,$4
mtlo $4
lui $1,1701
addiu $5,$1,3564
sb $4,0($0)
addu $5,$5,$5
mthi $2
multu $1,$1
mtlo $4
addiu $4,$0,-944
divu $5,$ra
addiu $5,$6,-25250
mthi $5
ori $2,$2,50733
divu $3,$ra
mult $4,$4
lb $3,6($0)
ori $1,$2,5781
divu $0,$ra
lb $4,14($0)
ori $4,$4,63578
srav $1,$1,$5
addiu $3,$4,30773
addu $4,$0,$3
addiu $6,$6,5381
divu $6,$ra
mflo $3
lb $4,8($0)
div $4,$ra
sb $0,2($0)
mfhi $1
srav $1,$6,$4
mthi $5
sll $6,$6,26
lui $6,8979
divu $1,$ra
mfhi $4
addiu $1,$1,-30613
ori $4,$4,2125
mult $0,$2
lb $0,16($0)
mflo $0
srav $2,$2,$3
multu $4,$5
addiu $1,$1,21787
mflo $1
mflo $4
addu $5,$3,$3
multu $4,$1
sll $6,$6,13
multu $3,$4
multu $3,$4
ori $6,$0,19075
lb $6,7($0)
sb $1,15($0)
ori $5,$4,4265
addiu $4,$6,-3921
addiu $5,$6,10149
multu $1,$1
divu $4,$ra
mult $6,$0
addiu $5,$5,6423
multu $3,$3
srav $0,$5,$6
lui $4,59585
mflo $0
mult $6,$6
mult $2,$2
lui $4,35650
mult $1,$1
addu $4,$2,$2
srav $2,$2,$5
mtlo $1
mthi $3
sll $2,$2,12
mthi $4
divu $4,$ra
multu $4,$2
addiu $5,$5,1373
sll $5,$5,15
mfhi $5
divu $5,$ra
lb $4,12($0)
multu $5,$5
mfhi $4
mthi $1
addu $4,$1,$4
sb $2,13($0)
addu $1,$4,$2
sb $2,10($0)
mthi $4
div $1,$ra
lb $1,3($0)
srav $1,$1,$1
mfhi $0
sb $5,13($0)
divu $6,$ra
mtlo $4
mflo $0
srav $4,$1,$1
multu $2,$1
mthi $1
addiu $4,$1,14920
lb $5,15($0)
lb $6,12($0)
sb $4,3($0)
mfhi $1
mthi $4
lb $6,8($0)
srav $3,$3,$3
mfhi $1
sll $5,$2,12
addu $6,$5,$2
ori $0,$4,59702
lb $6,12($0)
mthi $6
addu $5,$5,$5
addiu $1,$1,6521
div $1,$ra
multu $1,$2
addu $2,$1,$2
lui $1,35718
div $4,$ra
lui $4,58039
mfhi $6
mfhi $6
ori $0,$0,27448
multu $0,$0
addiu $1,$2,-16310
lb $1,0($0)
lui $4,28812
lui $2,29890
mflo $4
sll $1,$4,3
lb $4,5($0)
addu $1,$2,$3
sll $1,$1,28
lui $4,4587
multu $0,$2
mflo $4
mtlo $0
div $6,$ra
srav $5,$2,$4
mult $0,$6
sll $4,$4,23
sll $0,$4,10
sll $4,$4,31
lb $4,2($0)
div $4,$ra
srav $2,$2,$2
mult $4,$2
addu $4,$4,$4
mthi $5
mtlo $6
addiu $4,$4,-4278
addiu $4,$1,29803
srav $5,$2,$2
mthi $4
sb $5,16($0)
ori $1,$0,36123
divu $2,$ra
mthi $0
div $6,$ra
divu $5,$ra
multu $5,$2
addu $0,$0,$6
multu $0,$5
srav $4,$2,$2
ori $1,$5,19958
mult $4,$2
mfhi $4
lui $3,28746
mfhi $1
lb $1,9($0)
div $1,$ra
mtlo $1
addu $4,$6,$4
mfhi $4
lui $1,11862
sll $4,$2,14
srav $5,$2,$2
srav $6,$4,$2
multu $2,$2
addu $5,$6,$2
multu $4,$4
sll $4,$4,12
lui $1,53752
mflo $5
srav $4,$6,$6
lui $1,41060
srav $4,$1,$1
addiu $0,$6,14525
addu $6,$5,$2
sll $1,$3,13
divu $6,$ra
sb $4,12($0)
mthi $4
ori $5,$5,12397
ori $6,$6,56721
mtlo $4
divu $0,$ra
sll $3,$6,5
sll $4,$5,2
srav $3,$1,$3
mult $5,$5
addiu $5,$4,7083
mthi $0
mflo $5
mflo $5
sll $5,$2,10
mfhi $2
srav $1,$2,$4
srav $4,$4,$5
mfhi $4
mfhi $2
lui $0,25189
mflo $1
mflo $6
mfhi $4
mthi $1
addiu $4,$4,23854
mtlo $4
mfhi $5
mtlo $6
sb $6,1($0)
div $1,$ra
addiu $5,$5,14362
lui $1,53792
div $0,$ra
multu $2,$2
mfhi $1
ori $5,$2,8163
mtlo $6
sll $1,$4,28
sb $4,11($0)
mfhi $4
addiu $5,$5,15689
mthi $4
addu $2,$2,$4
mult $4,$4
mflo $4
srav $5,$4,$5
div $4,$ra
sb $4,6($0)
div $0,$ra
srav $6,$0,$3
mtlo $5
divu $4,$ra
mflo $5
addu $4,$2,$3
lui $1,49512
srav $5,$3,$3
mflo $4
lui $6,22317
mthi $5
addiu $4,$4,-9640
addu $5,$4,$4
mfhi $5
div $1,$ra
addu $3,$1,$3
sb $5,11($0)
addiu $5,$6,-20373
sb $4,5($0)
lui $5,34047
mfhi $0
mthi $1
lui $5,45189
ori $4,$0,10888
srav $4,$4,$4
divu $6,$ra
divu $5,$ra
mthi $0
multu $2,$2
mflo $4
mfhi $4
addu $4,$6,$6
lb $6,12($0)
multu $3,$1
sb $4,0($0)
sll $5,$3,3
mfhi $4
srav $5,$4,$2
addu $0,$0,$0
sll $1,$0,5
sb $1,11($0)
mult $3,$3
sll $6,$5,17
mthi $5
mflo $0
addiu $6,$4,-1915
sll $1,$6,1
addiu $6,$1,-21116
mtlo $4
lui $4,2278
sb $4,13($0)
mtlo $5
div $4,$ra
ori $6,$6,28855
mfhi $4
multu $5,$1
lb $2,1($0)
srav $1,$2,$2
div $2,$ra
divu $5,$ra
sll $0,$2,27
sll $3,$3,15
srav $3,$3,$3
mult $4,$4
lb $4,3($0)
ori $0,$2,18569
sll $6,$6,14
srav $1,$1,$3
lb $2,2($0)
lb $1,2($0)
lui $5,59887
addiu $1,$1,29582
mfhi $6
lui $0,31857
lui $2,42935
sll $4,$4,15
lui $1,62551
addiu $1,$1,-2527
srav $5,$5,$6
mtlo $4
multu $3,$3
sb $1,11($0)
multu $4,$4
mult $2,$2
lb $4,16($0)
lb $2,11($0)
mfhi $4
mthi $5
lui $4,39324
mfhi $5
addiu $0,$0,-1420
addu $3,$3,$3
addiu $1,$6,20219
div $6,$ra
divu $6,$ra
div $6,$ra
mfhi $4
mfhi $0
div $1,$ra
ori $0,$1,52242
lb $4,6($0)
sll $4,$4,28
mfhi $3
lb $4,13($0)
lui $4,14280
lb $4,0($0)
divu $1,$ra
sb $4,2($0)
multu $4,$5
sb $1,10($0)
mflo $4
addu $5,$5,$5
mthi $4
lb $4,6($0)
mtlo $5
lb $4,9($0)
srav $4,$2,$2
mthi $4
sb $1,3($0)
addiu $1,$1,13707
multu $5,$6
multu $4,$1
mthi $4
sb $1,7($0)
addu $6,$4,$4
div $4,$ra
mflo $1
srav $4,$2,$2
srav $1,$2,$1
sll $5,$2,15
div $6,$ra
mtlo $6
addu $4,$4,$2
sb $4,10($0)
divu $4,$ra
srav $1,$5,$5
divu $1,$ra
ori $1,$6,18476
sb $5,16($0)
lui $1,2362
addu $4,$4,$4
sll $0,$2,25
addiu $5,$6,-19147
srav $4,$1,$1
mtlo $5
sll $4,$5,14
div $1,$ra
addu $5,$5,$3
addu $1,$0,$4
sb $4,2($0)
mflo $5
multu $2,$1
divu $4,$ra
srav $1,$0,$3
mult $4,$0
divu $2,$ra
multu $1,$4
mfhi $5
div $1,$ra
srav $5,$4,$4
ori $2,$2,13640
div $6,$ra
mthi $4
divu $4,$ra
srav $4,$2,$6
lui $4,14243
lb $4,16($0)
sll $3,$3,0
mtlo $2
mtlo $3
mthi $1
mthi $2
sb $5,0($0)
mflo $5
mfhi $4
lui $5,26707
div $4,$ra
multu $0,$0
ori $3,$3,52034
ori $5,$2,9274
divu $2,$ra
multu $1,$0
mthi $2
sb $3,1($0)
sb $4,8($0)
ori $2,$2,12160
mfhi $4
sll $1,$2,25
lb $5,14($0)
div $5,$ra
sb $0,12($0)
mfhi $6
lui $0,35575
div $0,$ra
div $5,$ra
div $4,$ra
ori $5,$4,57225
mflo $5
addu $5,$2,$5
lb $4,5($0)
mtlo $1
mthi $2
lb $3,5($0)
mfhi $5
lb $1,14($0)
multu $5,$4
mult $5,$4
mfhi $4
mtlo $5
multu $1,$0
lb $6,2($0)
sll $4,$1,13
ori $6,$1,30425
sll $5,$4,16
mtlo $1
ori $0,$0,45444
mfhi $1
div $4,$ra
mult $3,$0
mfhi $2
lui $6,13042
lb $5,6($0)
mtlo $1
lb $4,6($0)
mult $5,$2
addiu $4,$1,-15400
lui $5,18129
mtlo $1
div $5,$ra
multu $1,$0
mult $5,$2
addu $4,$1,$1
lui $4,17934
mtlo $4
addiu $6,$2,3033
addu $3,$1,$3
mtlo $4
srav $2,$2,$2
divu $4,$ra
mfhi $4
divu $5,$ra
divu $4,$ra
multu $5,$4
lb $5,15($0)
addiu $1,$2,-15707
div $4,$ra
divu $6,$ra
mfhi $4
divu $4,$ra
addu $1,$4,$3
srav $0,$2,$1
sb $3,9($0)
mfhi $1
lui $1,30693
mthi $1
sb $4,5($0)
multu $3,$0
addu $4,$5,$5
div $4,$ra
divu $4,$ra
divu $4,$ra
ori $0,$0,23923
div $2,$ra
sll $5,$5,4
multu $4,$6
mult $2,$2
ori $5,$5,1022
lb $3,5($0)
lui $3,9303
mthi $6
mflo $6
sll $4,$0,6
div $5,$ra
lui $5,6201
sb $5,2($0)
multu $4,$3
mtlo $0
srav $2,$1,$2
sll $1,$5,6
mflo $5
divu $4,$ra
mtlo $4
divu $0,$ra
mult $4,$2
mult $2,$0
srav $5,$6,$2
mtlo $2
ori $1,$1,27075
srav $4,$5,$4
mtlo $4
mthi $4
lui $4,28412
mflo $3
div $0,$ra
ori $1,$4,60883
sll $1,$5,19
mult $3,$0
lui $5,63455
multu $4,$4
multu $4,$1
mthi $1
mflo $4
mtlo $1
srav $1,$1,$1
divu $5,$ra
lui $4,61291
divu $6,$ra
addu $4,$2,$3
mult $3,$3
mfhi $6
mtlo $4
sb $3,7($0)
mthi $4
divu $6,$ra
mfhi $5
div $6,$ra
srav $1,$2,$2
lui $0,41037
sll $1,$1,28
srav $4,$4,$2
divu $4,$ra
div $4,$ra
sll $4,$4,30
sll $2,$6,9
ori $4,$2,59159
mfhi $1
srav $2,$2,$6
mflo $5
addu $4,$2,$0
ori $2,$0,37763
multu $6,$6
sll $4,$4,17
srav $4,$2,$3
lui $2,47790
addu $4,$5,$4
div $1,$ra
ori $0,$1,31107
sb $1,6($0)
multu $4,$2
lui $2,50435
srav $3,$6,$3
sll $0,$3,17
ori $1,$4,40699
sll $1,$2,17
sll $4,$6,10
addiu $4,$4,-18120
lb $2,11($0)
sll $5,$5,7
multu $5,$5
addiu $5,$5,-11172
mthi $1
addu $6,$6,$6
mtlo $6
divu $4,$ra
mthi $1
mfhi $1
mflo $3
mflo $2
|
testbed/pgm1.asm | findhamza/Compilers | 0 | 20986 | <reponame>findhamza/Compilers
%include "IOSR.asm"
global _start
section .data
M DW 13
N DW 56
lit97 DW 97
lit18 DW 18
section .bss
X RESW 1
Y RESW 1
Z RESW 1
temp0 RESW 1
temp1 RESW 1
temp2 RESW 1
temp3 RESW 1
section .txt
_start:
mov ax, [lit97]
mov [Y], ax
mov ax, [M]
mul word [N]
mov [temp0], ax
mov ax, [temp0]
add ax, [lit18]
mov [temp1], ax
mov ax, [temp1]
sub ax, [Y]
mov [temp2], ax
mov ax, [temp2]
mov [X], ax
mov ax, [X]
call ConvertIntegerToString
mov eax, 4
mov ebx, 1
mov ecx, Result
mov edx, ResultEnd
int 80h
call fini
|
sys/arch/x86/boot/gdt.asm | NeoBSD/tunix | 0 | 97483 | <reponame>NeoBSD/tunix<gh_stars>0
; Copyright (c) 2021, <NAME>
; All rights reserved.
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
gdt_start: ; don't remove the labels, they're needed to compute sizes and jumps
; the GDT starts with a null 8-byte
dd 0x0 ; 4 byte
dd 0x0 ; 4 byte
; GDT for code segment. base = 0x00000000, length = 0xfffff
; for flags, refer to os-dev.pdf document, page 36
gdt_code:
dw 0xffff ; segment length, bits 0-15
dw 0x0 ; segment base, bits 0-15
db 0x0 ; segment base, bits 16-23
db 10011010b ; flags (8 bits)
db 11001111b ; flags (4 bits) + segment length, bits 16-19
db 0x0 ; segment base, bits 24-31
; GDT for data segment. base and length identical to code segment
; some flags changed, again, refer to os-dev.pdf
gdt_data:
dw 0xffff
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
gdt_end:
; GDT descriptor
gdt_descriptor:
dw gdt_end - gdt_start - 1 ; size (16 bit), always one less of its true size
dd gdt_start ; address (32 bit)
; define some constants for later use
CODE_SEG equ gdt_code - gdt_start
DATA_SEG equ gdt_data - gdt_start
|
libsrc/target/gb/gbdk/banked_call.asm | ahjelm/z88dk | 640 | 13522 |
MODULE banked_call
SECTION code_driver
PUBLIC banked_call
EXTERN CLIB_BANKING_STACK_SIZE
INCLUDE "target/gb/def/gb_globals.def"
;; Performs a long call.
;; Basically:
;; call banked_call
;; .dw low
;; .dw bank
;; remainder of the code
banked_call:
pop de ; Get the return address
; Switch to the temporary stack
ld (mainsp),sp
ld hl,tempsp
ld a,(hl+)
ld h,(hl)
ld l,a
ld sp,hl
ld a,(__current_bank)
push af ; Push the current bank onto the stack
ld l,e
ld h,d
ld e,(hl) ; Fetch the call address
inc hl
ld d,(hl)
inc hl
ld c,(hl) ; ...and page
inc hl
inc hl ; Yes this should be here
push hl ; Push the real return address
; Switch back to the main stack from the temporary stack
ld (tempsp),sp
ld hl,mainsp
ld a,(hl+)
ld h,(hl)
ld l,a
ld sp,hl
ld a,c
ld (__current_bank),a
ld (MBC1_ROM_PAGE),a ; Perform the switch
ld l,e
ld h,d
rst $20
push hl
ld (mainsp),sp
ld hl,tempsp
ld a,(hl+)
ld h,(hl)
ld l,a
ld sp,hl
pop bc ; Get the return address
pop af ; Pop the old bank
ld (tempsp),sp
ld (MBC1_ROM_PAGE),a
ld (__current_bank),a
ld hl,mainsp
ld a,(hl+)
ld h,(hl)
ld l,a
ld sp,hl
pop hl
push bc
ret
SECTION code_crt_init
pop bc
ld hl,sp+0
ex de,hl
ld hl,tempsp
ld (hl),e
inc hl
ld (hl),d
add sp,-CLIB_BANKING_STACK_SIZE
push bc
SECTION bss_driver
__current_bank: defw 0
tempsp: defw 0
mainsp: defw 0
|
tools-src/gnu/gcc/gcc/ada/memroot.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 13489 | <filename>tools-src/gnu/gcc/gcc/ada/memroot.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M E M R O O T --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1997-2001 Ada Core Technologies, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with GNAT.Table;
with GNAT.HTable; use GNAT.HTable;
with Ada.Text_IO; use Ada.Text_IO;
package body Memroot is
-------------
-- Name_Id --
-------------
package Chars is new GNAT.Table (
Table_Component_Type => Character,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 10_000,
Table_Increment => 100);
-- The actual character container for names
type Name is record
First, Last : Integer;
end record;
package Names is new GNAT.Table (
Table_Component_Type => Name,
Table_Index_Type => Name_Id,
Table_Low_Bound => 0,
Table_Initial => 400,
Table_Increment => 100);
type Name_Range is range 1 .. 1023;
function Name_Eq (N1, N2 : Name) return Boolean;
-- compare 2 names
function H (N : Name) return Name_Range;
package Name_HTable is new GNAT.HTable.Simple_HTable (
Header_Num => Name_Range,
Element => Name_Id,
No_Element => No_Name_Id,
Key => Name,
Hash => H,
Equal => Name_Eq);
--------------
-- Frame_Id --
--------------
type Frame is record
Name, File, Line : Name_Id;
end record;
function Image
(F : Frame_Id;
Max_Fil : Integer;
Max_Lin : Integer)
return String;
-- Returns an image for F containing the file name, the Line number,
-- and the subprogram name. When possible, spaces are inserted between
-- the line number and the subprogram name in order to align images of the
-- same frame. Alignement is cimputed with Max_Fil & Max_Lin representing
-- the max number of character in a filename or length in a given frame.
package Frames is new GNAT.Table (
Table_Component_Type => Frame,
Table_Index_Type => Frame_Id,
Table_Low_Bound => 1,
Table_Initial => 400,
Table_Increment => 100);
type Frame_Range is range 1 .. 513;
function H (N : Frame) return Frame_Range;
package Frame_HTable is new GNAT.HTable.Simple_HTable (
Header_Num => Frame_Range,
Element => Frame_Id,
No_Element => No_Frame_Id,
Key => Frame,
Hash => H,
Equal => "=");
-------------
-- Root_Id --
-------------
type Root is record
First, Last : Integer;
Nb_Alloc : Integer;
Alloc_Size : Storage_Count;
High_Water_Mark : Storage_Count;
end record;
package Frames_In_Root is new GNAT.Table (
Table_Component_Type => Frame_Id,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 400,
Table_Increment => 100);
package Roots is new GNAT.Table (
Table_Component_Type => Root,
Table_Index_Type => Root_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
type Root_Range is range 1 .. 513;
function Root_Eq (N1, N2 : Root) return Boolean;
function H (B : Root) return Root_Range;
package Root_HTable is new GNAT.HTable.Simple_HTable (
Header_Num => Root_Range,
Element => Root_Id,
No_Element => No_Root_Id,
Key => Root,
Hash => H,
Equal => Root_Eq);
----------------
-- Alloc_Size --
----------------
function Alloc_Size (B : Root_Id) return Storage_Count is
begin
return Roots.Table (B).Alloc_Size;
end Alloc_Size;
-----------------
-- Enter_Frame --
-----------------
function Enter_Frame (Name, File, Line : Name_Id) return Frame_Id is
Res : Frame_Id;
begin
Frames.Increment_Last;
Frames.Table (Frames.Last) := Frame'(Name, File, Line);
Res := Frame_HTable.Get (Frames.Table (Frames.Last));
if Res /= No_Frame_Id then
Frames.Decrement_Last;
return Res;
else
Frame_HTable.Set (Frames.Table (Frames.Last), Frames.Last);
return Frames.Last;
end if;
end Enter_Frame;
----------------
-- Enter_Name --
----------------
function Enter_Name (S : String) return Name_Id is
Old_L : constant Integer := Chars.Last;
Len : constant Integer := S'Length;
F : constant Integer := Chars.Allocate (Len);
Res : Name_Id;
begin
Chars.Table (F .. F + Len - 1) := Chars.Table_Type (S);
Names.Increment_Last;
Names.Table (Names.Last) := Name'(F, F + Len - 1);
Res := Name_HTable.Get (Names.Table (Names.Last));
if Res /= No_Name_Id then
Names.Decrement_Last;
Chars.Set_Last (Old_L);
return Res;
else
Name_HTable.Set (Names.Table (Names.Last), Names.Last);
return Names.Last;
end if;
end Enter_Name;
----------------
-- Enter_Root --
----------------
function Enter_Root (Fr : Frame_Array) return Root_Id is
Old_L : constant Integer := Frames_In_Root.Last;
Len : constant Integer := Fr'Length;
F : constant Integer := Frames_In_Root.Allocate (Len);
Res : Root_Id;
begin
Frames_In_Root.Table (F .. F + Len - 1) :=
Frames_In_Root.Table_Type (Fr);
Roots.Increment_Last;
Roots.Table (Roots.Last) := Root'(F, F + Len - 1, 0, 0, 0);
Res := Root_HTable.Get (Roots.Table (Roots.Last));
if Res /= No_Root_Id then
Frames_In_Root.Set_Last (Old_L);
Roots.Decrement_Last;
return Res;
else
Root_HTable.Set (Roots.Table (Roots.Last), Roots.Last);
return Roots.Last;
end if;
end Enter_Root;
---------------
-- Frames_Of --
---------------
function Frames_Of (B : Root_Id) return Frame_Array is
begin
return Frame_Array (
Frames_In_Root.Table (Roots.Table (B).First .. Roots.Table (B).Last));
end Frames_Of;
---------------
-- Get_First --
---------------
function Get_First return Root_Id is
begin
return Root_HTable.Get_First;
end Get_First;
--------------
-- Get_Next --
--------------
function Get_Next return Root_Id is
begin
return Root_HTable.Get_Next;
end Get_Next;
-------
-- H --
-------
function H (B : Root) return Root_Range is
type Uns is mod 2 ** 32;
function Rotate_Left (Value : Uns; Amount : Natural) return Uns;
pragma Import (Intrinsic, Rotate_Left);
Tmp : Uns := 0;
begin
for J in B.First .. B.Last loop
Tmp := Rotate_Left (Tmp, 1) + Uns (Frames_In_Root.Table (J));
end loop;
return Root_Range'First
+ Root_Range'Base (Tmp mod Root_Range'Range_Length);
end H;
function H (N : Name) return Name_Range is
function H is new Hash (Name_Range);
begin
return H (String (Chars.Table (N.First .. N.Last)));
end H;
function H (N : Frame) return Frame_Range is
begin
return Frame_Range (1 + (7 * N.Name + 13 * N.File + 17 * N.Line)
mod Frame_Range'Range_Length);
end H;
---------------------
-- High_Water_Mark --
---------------------
function High_Water_Mark (B : Root_Id) return Storage_Count is
begin
return Roots.Table (B).High_Water_Mark;
end High_Water_Mark;
-----------
-- Image --
-----------
function Image (N : Name_Id) return String is
Nam : Name renames Names.Table (N);
begin
return String (Chars.Table (Nam.First .. Nam.Last));
end Image;
function Image
(F : Frame_Id;
Max_Fil : Integer;
Max_Lin : Integer)
return String is
Fram : Frame renames Frames.Table (F);
Fil : Name renames Names.Table (Fram.File);
Lin : Name renames Names.Table (Fram.Line);
Nam : Name renames Names.Table (Fram.Name);
Fil_Len : constant Integer := Fil.Last - Fil.First + 1;
Lin_Len : constant Integer := Lin.Last - Lin.First + 1;
use type Chars.Table_Type;
Spaces : constant String (1 .. 80) := (1 .. 80 => ' ');
begin
return String (Chars.Table (Fil.First .. Fil.Last))
& ':'
& String (Chars.Table (Lin.First .. Lin.Last))
& Spaces (1 .. 1 + Max_Fil - Fil_Len + Max_Lin - Lin_Len)
& String (Chars.Table (Nam.First .. Nam.Last));
end Image;
-------------
-- Name_Eq --
-------------
function Name_Eq (N1, N2 : Name) return Boolean is
use type Chars.Table_Type;
begin
return
Chars.Table (N1.First .. N1.Last) = Chars.Table (N2.First .. N2.Last);
end Name_Eq;
--------------
-- Nb_Alloc --
--------------
function Nb_Alloc (B : Root_Id) return Integer is
begin
return Roots.Table (B).Nb_Alloc;
end Nb_Alloc;
--------------
-- Print_BT --
--------------
procedure Print_BT (B : Root_Id) is
Max_Col_Width : constant := 35;
-- Largest filename length for which backtraces will be
-- properly aligned. Frames containing longer names won't be
-- truncated but they won't be properly aligned either.
F : constant Frame_Array := Frames_Of (B);
Max_Fil : Integer;
Max_Lin : Integer;
begin
Max_Fil := 0;
Max_Lin := 0;
for J in F'Range loop
declare
Fram : Frame renames Frames.Table (F (J));
Fil : Name renames Names.Table (Fram.File);
Lin : Name renames Names.Table (Fram.Line);
begin
Max_Fil := Integer'Max (Max_Fil, Fil.Last - Fil.First + 1);
Max_Lin := Integer'Max (Max_Lin, Lin.Last - Lin.First + 1);
end;
end loop;
Max_Fil := Integer'Min (Max_Fil, Max_Col_Width);
for J in F'Range loop
Put (" ");
Put_Line (Image (F (J), Max_Fil, Max_Lin));
end loop;
end Print_BT;
-------------
-- Read_BT --
-------------
function Read_BT (BT_Depth : Integer; FT : File_Type) return Root_Id is
Max_Line : constant Integer := 500;
Curs1 : Integer;
Curs2 : Integer;
Line : String (1 .. Max_Line);
Last : Integer := 0;
Frames : Frame_Array (1 .. BT_Depth);
F : Integer := Frames'First;
Nam : Name_Id;
Fil : Name_Id;
Lin : Name_Id;
No_File : Boolean := False;
Main_Found : Boolean := False;
procedure Find_File;
-- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains
-- the file name. The file name may not be on the current line since
-- a frame may be printed on more than one line when there is a lot
-- of parameters or names are long, so this subprogram can read new
-- lines of input.
procedure Find_Line;
-- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains
-- the line number.
procedure Find_Name;
-- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains
-- the subprogram name.
procedure Gmem_Read_BT_Frame (Buf : out String; Last : out Natural);
-- GMEM functionality binding
---------------
-- Find_File --
---------------
procedure Find_File is
Match_Parent : Integer;
begin
-- Skip parameters
Curs1 := Curs2 + 3;
Match_Parent := 1;
while Curs1 <= Last loop
if Line (Curs1) = '(' then
Match_Parent := Match_Parent + 1;
elsif Line (Curs1) = ')' then
Match_Parent := Match_Parent - 1;
exit when Match_Parent = 0;
end if;
Curs1 := Curs1 + 1;
end loop;
-- Skip " at "
Curs1 := Curs1 + 5;
if Curs1 >= Last then
-- Maybe the file reference is on one of the next lines
Read : loop
Get_Line (FT, Line, Last);
-- If we have another Frame or if the backtrace is finished
-- the file reference was just missing
if Last <= 1 or else Line (1) = '#' then
No_File := True;
Curs2 := Curs1 - 1;
return;
else
Curs1 := 1;
while Curs1 <= Last - 2 loop
if Line (Curs1) = '(' then
Match_Parent := Match_Parent + 1;
elsif Line (Curs1) = ')' then
Match_Parent := Match_Parent - 1;
end if;
if Match_Parent = 0
and then Line (Curs1 .. Curs1 + 1) = "at"
then
Curs1 := Curs1 + 3;
exit Read;
end if;
Curs1 := Curs1 + 1;
end loop;
end if;
end loop Read;
end if;
-- Let's assume that the filename length is greater than 1
-- it simplifies dealing with the potential drive ':' on
-- windows systems
Curs2 := Curs1 + 1;
while Line (Curs2 + 1) /= ':' loop Curs2 := Curs2 + 1; end loop;
end Find_File;
---------------
-- Find_Line --
---------------
procedure Find_Line is
begin
Curs1 := Curs2 + 2;
Curs2 := Last;
if Curs2 - Curs1 > 5 then
raise Constraint_Error;
end if;
end Find_Line;
---------------
-- Find_Name --
---------------
procedure Find_Name is
begin
Curs1 := 3;
-- Skip Frame #
while Line (Curs1) /= ' ' loop Curs1 := Curs1 + 1; end loop;
-- Skip spaces
while Line (Curs1) = ' ' loop Curs1 := Curs1 + 1; end loop;
Curs2 := Curs1;
while Line (Curs2 + 1) /= ' ' loop Curs2 := Curs2 + 1; end loop;
end Find_Name;
------------------------
-- Gmem_Read_BT_Frame --
------------------------
procedure Gmem_Read_BT_Frame (Buf : out String; Last : out Natural) is
procedure Read_BT_Frame (buf : System.Address);
pragma Import (C, Read_BT_Frame, "__gnat_gmem_read_bt_frame");
function Strlen (chars : System.Address) return Natural;
pragma Import (C, Strlen, "strlen");
S : String (1 .. 1000);
begin
Read_BT_Frame (S'Address);
Last := Strlen (S'Address);
Buf (1 .. Last) := S (1 .. Last);
end Gmem_Read_BT_Frame;
-- Start of processing for Read_BT
begin
if Gmem_Mode then
Gmem_Read_BT_Frame (Line, Last);
else
Line (1) := ' ';
while Line (1) /= '#' loop
Get_Line (FT, Line, Last);
end loop;
end if;
while Last >= 1 and then Line (1) = '#' and then not Main_Found loop
if F <= BT_Depth then
Find_Name;
Nam := Enter_Name (Line (Curs1 .. Curs2));
Main_Found := Line (Curs1 .. Curs2) = "main";
Find_File;
if No_File then
Fil := No_Name_Id;
Lin := No_Name_Id;
else
Fil := Enter_Name (Line (Curs1 .. Curs2));
Find_Line;
Lin := Enter_Name (Line (Curs1 .. Curs2));
end if;
Frames (F) := Enter_Frame (Nam, Fil, Lin);
F := F + 1;
end if;
if No_File then
-- If no file reference was found, the next line has already
-- been read because, it may sometimes be found on the next
-- line
No_File := False;
else
if Gmem_Mode then
Gmem_Read_BT_Frame (Line, Last);
else
Get_Line (FT, Line, Last);
exit when End_Of_File (FT);
end if;
end if;
end loop;
return Enter_Root (Frames (1 .. F - 1));
end Read_BT;
-------------
-- Root_Eq --
-------------
function Root_Eq (N1, N2 : Root) return Boolean is
use type Frames_In_Root.Table_Type;
begin
return
Frames_In_Root.Table (N1.First .. N1.Last)
= Frames_In_Root.Table (N2.First .. N2.Last);
end Root_Eq;
--------------------
-- Set_Alloc_Size --
--------------------
procedure Set_Alloc_Size (B : Root_Id; V : Storage_Count) is
begin
Roots.Table (B).Alloc_Size := V;
end Set_Alloc_Size;
-------------------------
-- Set_High_Water_Mark --
-------------------------
procedure Set_High_Water_Mark (B : Root_Id; V : Storage_Count) is
begin
Roots.Table (B).High_Water_Mark := V;
end Set_High_Water_Mark;
------------------
-- Set_Nb_Alloc --
------------------
procedure Set_Nb_Alloc (B : Root_Id; V : Integer) is
begin
Roots.Table (B).Nb_Alloc := V;
end Set_Nb_Alloc;
begin
-- Initialize name for No_Name_ID
Names.Increment_Last;
Names.Table (Names.Last) := Name'(1, 0);
end Memroot;
|
source/league/league-iris.ads | svn2github/matreshka | 24 | 2143 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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$
------------------------------------------------------------------------------
-- This package provides a convenient interface for working with
-- Internationalized Resource Identifiers (IRIs), as defined by RFC 3987; and
-- Uniform Resource Identifier (URI), as defined by RFC 3986.
--
-- All IRI components are represented without any escaping or encoding, except
-- subprograms with identifiers with word 'Encoded'. All Set_ subprograms
-- without word 'Encoded' attempt to decode/unescape provided value when
-- possible; while 'Encoded' variants assumes what value is properly encoded.
------------------------------------------------------------------------------
private with Ada.Finalization;
with League.Stream_Element_Vectors;
with League.String_Vectors;
with League.Strings;
package League.IRIs is
pragma Preelaborate;
pragma Remote_Types;
type IRI is tagged private;
-- pragma Preelaborable_Initialization (IRI);
function From_Universal_String
(Item : League.Strings.Universal_String) return IRI;
function From_Encoded
(Item : League.Stream_Element_Vectors.Stream_Element_Vector) return IRI;
function To_Universal_String
(Self : IRI'Class) return League.Strings.Universal_String;
function To_Encoded
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_IRI
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Is_Valid (Self : IRI'Class) return Boolean;
procedure Clear (Self : in out IRI'Class);
function Get_Scheme
(Self : IRI'Class) return League.Strings.Universal_String
with Inline;
-- Returns the scheme of the URL. If an empty string is returned, this
-- means the scheme is undefined and the URL is then relative.
function Encoded_Scheme
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Scheme
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded_Scheme
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Is_Absolute (Self : IRI'Class) return Boolean;
-- Returns True when object represents absolute IRI.
function Authority
(Self : IRI'Class) return League.Strings.Universal_String;
function Encoded_Authority
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Authority
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded_Authority
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function User_Info
(Self : IRI'Class) return League.Strings.Universal_String;
function Encoded_User_Info
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_User_Info
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded_User_Info
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Get_Host (Self : IRI'Class) return League.Strings.Universal_String
with Inline;
-- Returns the host of the URL if it is defined; otherwise an empty string
-- is returned.
procedure Set_Host
(Self : in out IRI'Class; To : League.Strings.Universal_String);
-- Sets the host of the URL to host. The host is part of the authority.
function Encoded_Host
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Encoded_Host
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Get_Port (Self : IRI'Class; Default : Natural := 0) return Natural
with Inline;
-- Returns the port of the URL.
procedure Set_Port (Self : in out IRI'Class; To : Natural);
-- Sets the port of the URL to port. The port is part of the authority of
-- the URL.
function Get_Path
(Self : IRI'Class) return League.String_Vectors.Universal_String_Vector
with Inline;
-- Returns the path of the URL.
procedure Set_Absolute_Path
(Self : in out IRI'Class;
To : League.String_Vectors.Universal_String_Vector);
procedure Set_Relative_Path
(Self : in out IRI'Class;
To : League.String_Vectors.Universal_String_Vector);
-- Sets the path of the URL.
function Is_Path_Absolute (Self : IRI'Class) return Boolean;
-- Returns True if path component represents absolute path.
procedure Set_Path_Absolute (Self : in out IRI'Class; To : Boolean);
-- Mark path as absolute.
function Encoded_Path
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Encoded_Path
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Query (Self : IRI'Class) return League.Strings.Universal_String;
function Encoded_Query
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Query
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded_Query
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Fragment (Self : IRI'Class) return League.Strings.Universal_String;
function Encoded_Fragment
(Self : IRI'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
procedure Set_Fragment
(Self : in out IRI'Class; To : League.Strings.Universal_String);
procedure Set_Encoded_Fragment
(Self : in out IRI'Class;
To : League.Stream_Element_Vectors.Stream_Element_Vector);
function Resolve (Self : IRI'Class; Relative : IRI'Class) return IRI;
-- Returns the result of the merge of this IRI with Relative. This IRI is
-- used as a base to convert relative to an absolute IRI.
--
-- If Relative is not a relative IRI, this function will return Relative
-- directly. Otherwise, the paths of the two IRIs are merged, and the new
-- IRI returned has the scheme and authority of the base IRI, but with the
-- merged path.
function "=" (Left : IRI; Right : IRI) return Boolean;
procedure Append_Segment
(Self : in out IRI'Class;
Segment : League.Strings.Universal_String);
-- Appends specified segment to IRI's path.
private
type IRI is new Ada.Finalization.Controlled with record
Scheme : League.Strings.Universal_String;
Has_Authority : Boolean := False;
User_Info : League.Strings.Universal_String;
Host : League.Strings.Universal_String;
Port : Natural := 0;
Path_Is_Absolute : Boolean := True;
Path : League.String_Vectors.Universal_String_Vector;
Query : League.Strings.Universal_String;
Fragment : League.Strings.Universal_String;
end record;
end League.IRIs;
|
boot/x86_64-stivale/Stivale2Header.asm | DeanoBurrito/minos | 3 | 98716 | .code64
.section .stivale2hdr
stivale2_header_tag_base:
.quad 0
.quad 0
.quad 0
.quad stivale2_header_tag_any_video
.section .rodata
stivale2_header_tag_any_video:
.quad 0xc75c9fa92a44c4db
.quad stivale2_header_tag_framebuffer
#preference = 0, meaning pixel-based buffer (rather than character-based)
.quad 0
stivale2_header_tag_framebuffer:
.quad 0x3ecc1bc43d0f7971
.quad stivale2_header_tag_smp
#requested w/h/bpp, or 0 if we dont care
.word 0
.word 0
.word 0
#reserved bit, required for padding
.word 0
stivale2_header_tag_smp:
.quad 0x1ab015085f3273df
.quad 0
#set bit 1 to request x2apic over xapic (if avail)
.quad 0
|
bb-runtimes/examples/sam4s-xplained/tetris/oled.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 1637 | <filename>bb-runtimes/examples/sam4s-xplained/tetris/oled.ads
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
package Oled is
-- Initialize the Oled. Must be done once
procedure Oled_Init;
-- Clear the screen
procedure Oled_Clear;
-- Number of pixels per byte
Oled_Pixels_Per_Byte : constant := 8;
-- Set the current page (and clear column)
procedure Oled_Set_Page (Page : Unsigned_8);
-- Draw 8 pixels at current position and increase position to the next
-- line.
procedure Oled_Draw (B : Unsigned_8);
end Oled;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr25.adb | best08618/asylo | 7 | 30744 | -- { dg-do compile }
with Discr25_Pkg;
procedure Discr25 (N : Natural) is
package Test_Set is new Discr25_Pkg (N);
begin
null;
end;
|
programs/oeis/138/A138100.asm | karttu/loda | 0 | 3815 | ; A138100: The atomic numbers read along the odd-indexed rows of the Janet table of the elements.
; 1,2,5,6,7,8,9,10,11,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88
mov $3,$0
trn $0,1
mov $1,2
lpb $0,1
add $2,$1
add $2,1
add $1,$2
mul $2,2
sub $0,$2
trn $0,2
add $2,1
sub $2,$1
lpe
trn $1,3
add $1,4
lpb $3,1
add $1,1
sub $3,1
lpe
sub $1,3
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver2/sfc/ys_w44.asm | prismotizm/gigaleak | 0 | 103520 | Name: ys_w44.asm
Type: file
Size: 25275
Last-Modified: '2016-05-13T04:51:45Z'
SHA-1: 2DAF4EDFBC190533F4114EFE9880F3BAEDD6D4A3
Description: null
|
oeis/099/A099159.asm | neoneye/loda-programs | 11 | 171098 | <reponame>neoneye/loda-programs
; A099159: (L(n-2)+2*3^n)/5.
; Submitted by <NAME>
; 1,1,4,11,33,98,293,877,2628,7879,23629,70874,212601,637769,1913252,5739667,17218857,51656338,154968637,464905301,1394714916,4184143151,12552426869,37657276426,112971822513,338915456593,1016746352068
mov $1,2
mov $2,1
mov $4,2
lpb $0
sub $0,1
mov $3,$2
mul $2,3
add $2,2
add $3,$4
mov $4,$1
add $1,$3
lpe
mov $0,$4
sub $0,1
|
alloy4fun_models/trashltl/models/7/KDHhkyLsbLdJyY9aB.als | Kaixi26/org.alloytools.alloy | 0 | 225 | <gh_stars>0
open main
pred idKDHhkyLsbLdJyY9aB_prop8 {
always all l : File.link | eventually l in File.link implies l in Trash
}
pred __repair { idKDHhkyLsbLdJyY9aB_prop8 }
check __repair { idKDHhkyLsbLdJyY9aB_prop8 <=> prop8o } |
3-mid/opengl/source/lean/text/opengl-glyph-container.adb | charlie5/lace | 20 | 14668 | with
ada.unchecked_Deallocation;
package body openGL.Glyph.Container
is
---------
--- Forge
--
function to_glyph_Container (parent_Face : in freetype.Face.view) return openGL.glyph.Container.item
is
Self : openGL.glyph.Container.item;
begin
Self.Face := parent_Face;
Self.Err := 0;
Self.charMap := new freetype.charMap.Item' (freetype.charMap.to_charMap (Self.Face));
return Self;
end to_glyph_Container;
procedure destruct (Self : in out Item)
is
use Glyph_Vectors;
procedure deallocate is new ada.unchecked_Deallocation (openGL.Glyph.item'Class, Glyph_view);
procedure deallocate is new ada.unchecked_Deallocation (freetype.charMap.item'Class, charMap_view);
Cursor : Glyph_Vectors.Cursor := Self.Glyphs.First;
the_Glyph : Glyph_view;
begin
while has_Element (Cursor)
loop
the_Glyph := Element (Cursor);
deallocate (the_Glyph);
next (Cursor);
end loop;
Self.Glyphs .clear;
Self.charMap.destruct;
deallocate (Self.charMap);
end destruct;
--------------
-- Attributes
--
function CharMap (Self : access Item; Encoding : in freeType_c.FT_Encoding) return Boolean
is
Result : constant Boolean := Self.charMap.CharMap (Encoding);
begin
Self.Err := Self.charMap.Error;
return Result;
end CharMap;
function FontIndex (Self : in Item; Character : in freetype.charMap.characterCode) return Natural
is
begin
return Natural (Self.charMap.FontIndex (Character));
end FontIndex;
procedure add (Self : in out Item; Glyph : in Glyph_view;
Character : in freetype.charMap.characterCode)
is
begin
Self.glyphs.append (Glyph);
Self.charMap.insertIndex (Character, Self.Glyphs.Length);
end add;
function Glyph (Self : in Item; Character : in freetype.charMap.characterCode) return Glyph_view
is
use type freetype.charMap.glyphIndex;
Index : constant freetype.charMap.glyphIndex := Self.charMap.GlyphListIndex (Character);
begin
if Index = -1
then return null;
else return Self.Glyphs.Element (Integer (Index));
end if;
end Glyph;
function BBox (Self : in Item; Character : in freetype.charMap.characterCode) return Bounds
is
begin
return Self.Glyph (Character).BBox;
end BBox;
function Advance (Self : in Item; Character : in freetype.charMap.characterCode;
nextCharacterCode : in freetype.charMap.characterCode) return Real
is
Left : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (Character);
Right : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (nextCharacterCode);
begin
return Real (Self.Face.KernAdvance (Integer (Left),
Integer (Right)) (1) + Float (Self.Glyph (Character).Advance));
end Advance;
function Error (Self : in Item) return freetype_c.FT_Error
is
begin
return Self.Err;
end Error;
--------------
-- Operations
--
function render (Self : access Item; Character : in freetype.charMap.characterCode;
nextCharacterCode : in freetype.charMap.characterCode;
penPosition : in Vector_3;
renderMode : in Integer) return Vector_3
is
use type freetype_c.FT_Error,
freetype.charMap.glyphIndex;
Left : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (Character) - 0;
Right : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (nextCharacterCode) - 0;
ft_kernAdvance : constant freetype.Vector_3 := Self.Face.KernAdvance (Integer (Left),
Integer (Right));
kernAdvance : Vector_3 := (ft_kernAdvance (1),
ft_kernAdvance (2),
ft_kernAdvance (3));
Index : freetype.charMap.glyphIndex;
begin
if Self.Face.Error = 0
then
Index := Self.charMap.GlyphListIndex (Character);
kernAdvance := kernAdvance + Self.Glyphs.Element (Integer (Index)).Render (penPosition,
renderMode);
else
raise openGL.Error with "Unable to render character '" & Character'Image & "'";
end if;
return kernAdvance;
end Render;
end openGL.Glyph.Container;
|
testsuite/league/grapheme_cluster_cursor_test.adb | svn2github/matreshka | 24 | 21521 | <filename>testsuite/league/grapheme_cluster_cursor_test.adb
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Command_Line;
with Ada.Unchecked_Deallocation;
with Ada.Wide_Wide_Text_IO;
with League.Application;
with League.Characters;
with League.Strings.Cursors.Grapheme_Clusters;
procedure Grapheme_Cluster_Cursor_Test is
use League.Strings;
use League.Strings.Cursors.Grapheme_Clusters;
Break_Character : constant Wide_Wide_Character := '÷';
No_Break_Character : constant Wide_Wide_Character := '×';
type Wide_Wide_String_Access is access all Wide_Wide_String;
type Test_Data is array (Positive range <>) of Wide_Wide_String_Access;
type Test_Data_Access is access all Test_Data;
procedure Free is
new Ada.Unchecked_Deallocation
(Wide_Wide_String, Wide_Wide_String_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Test_Data, Test_Data_Access);
procedure Read_Test_Data
(File_Name : String;
Process : not null access procedure
(Item : in out Universal_String;
Data : Test_Data));
procedure Deep_Free (X : in out Test_Data_Access);
procedure Do_Test (Item : in out Universal_String; Data : Test_Data);
---------------
-- Deep_Free --
---------------
procedure Deep_Free (X : in out Test_Data_Access) is
begin
for J in X'Range loop
Free (X (J));
end loop;
Free (X);
end Deep_Free;
-------------
-- Do_Test --
-------------
procedure Do_Test (Item : in out Universal_String; Data : Test_Data) is
J : Grapheme_Cluster_Cursor;
N : Natural := 1;
begin
-- Test forward-backward iterator
J.First (Item);
while J.Has_Element loop
if J.Element.To_Wide_Wide_String /= Data (N).all then
raise Program_Error;
end if;
J.Next;
N := N + 1;
end loop;
J.Previous;
N := N - 1;
while J.Has_Element loop
if J.Element.To_Wide_Wide_String /= Data (N).all then
raise Program_Error;
end if;
J.Previous;
N := N - 1;
end loop;
-- Test backward-forward iterator
J.Last (Item);
N := Data'Last;
while J.Has_Element loop
if J.Element.To_Wide_Wide_String /= Data (N).all then
raise Program_Error;
end if;
J.Previous;
N := N - 1;
end loop;
J.Next;
N := N + 1;
while J.Has_Element loop
if J.Element.To_Wide_Wide_String /= Data (N).all then
raise Program_Error;
end if;
J.Next;
N := N + 1;
end loop;
end Do_Test;
--------------------
-- Read_Test_Data --
--------------------
procedure Read_Test_Data
(File_Name : String;
Process : not null access procedure
(Item : in out Universal_String;
Data : Test_Data))
is
File : Ada.Wide_Wide_Text_IO.File_Type;
Line : Wide_Wide_String (1 .. 1_024);
Last : Natural;
begin
Ada.Wide_Wide_Text_IO.Open
(File, Ada.Wide_Wide_Text_IO.In_File, File_Name, "wcem=8");
while not Ada.Wide_Wide_Text_IO.End_Of_File (File) loop
Ada.Wide_Wide_Text_IO.Get_Line (File, Line, Last);
-- Remove comment
for J in 1 .. Last loop
if Line (J) = '#' then
Last := J - 1;
exit;
end if;
end loop;
-- Remove trailing spaces
for J in reverse 1 .. Last loop
if Line (J) /= ' ' then
Last := J - 1;
exit;
end if;
end loop;
if Last /= 0 then
declare
Token_First : Positive := 1;
Item : Wide_Wide_String_Access;
Data : Test_Data_Access;
Source : Wide_Wide_String_Access;
X : Universal_String;
procedure Skip_Spaces;
procedure Parse_Break_Indicator;
procedure Parse_Code_Point;
---------------------------
-- Parse_Break_Indicator --
---------------------------
procedure Parse_Break_Indicator is
Aux : Test_Data_Access := Data;
begin
Skip_Spaces;
case Line (Token_First) is
when Break_Character =>
if Item /= null then
if Data = null then
Data := new Test_Data (1 .. 1);
else
Data := new Test_Data (1 .. Aux'Last + 1);
Data (Aux'Range) := Aux.all;
Free (Aux);
end if;
Data (Data'Last) := Item;
Item := null;
end if;
when No_Break_Character =>
null;
when others =>
raise Constraint_Error with "Wrong format of the file";
end case;
Token_First := Token_First + 1;
end Parse_Break_Indicator;
----------------------
-- Parse_Code_Point --
----------------------
procedure Parse_Code_Point is
Token_Last : Positive;
Aux : Wide_Wide_String_Access := Item;
begin
Skip_Spaces;
Token_Last := Token_First;
while Token_Last <= Last loop
case Line (Token_Last) is
when '0' .. '9' | 'A' .. 'F' =>
null;
when ' ' =>
Token_Last := Token_Last - 1;
exit;
when others =>
raise Constraint_Error
with "Wrong format of the file";
end case;
Token_Last := Token_Last + 1;
end loop;
if Item = null then
Item := new Wide_Wide_String (1 .. 1);
else
Item := new Wide_Wide_String (1 .. Aux'Last + 1);
Item (Aux'Range) := Aux.all;
Free (Aux);
end if;
Item (Item'Last) :=
Wide_Wide_Character'Val
(Integer'Wide_Wide_Value
("16#" & Line (Token_First .. Token_Last) & '#'));
if Source = null then
Source := new Wide_Wide_String (1 .. 1);
else
Aux := Source;
Source := new Wide_Wide_String (1 .. Aux'Last + 1);
Source (Aux'Range) := Aux.all;
Free (Aux);
end if;
Source (Source'Last) :=
Wide_Wide_Character'Val
(Integer'Wide_Wide_Value
("16#" & Line (Token_First .. Token_Last) & '#'));
Token_First := Token_Last + 1;
end Parse_Code_Point;
-----------------
-- Skip_Spaces --
-----------------
procedure Skip_Spaces is
begin
for J in Token_First .. Last loop
if Line (J) /= ' ' then
Token_First := J;
exit;
end if;
end loop;
end Skip_Spaces;
OK : Boolean := True;
begin
Parse_Break_Indicator;
while Token_First <= Last loop
Parse_Code_Point;
Parse_Break_Indicator;
end loop;
-- Check whether all source characters are valid Unicode
-- characters. Unicode 6.1.0 introduce use of surrogate code
-- points in test data, these tests can't be used to check
-- Matreshka, because such data is invalid.
for J in Source'Range loop
if not League.Characters.To_Universal_Character
(Source (J)).Is_Valid
then
OK := False;
exit;
end if;
end loop;
if OK then
X := To_Universal_String (Source.all);
Process (X, Data.all);
end if;
Deep_Free (Data);
Free (Source);
end;
end if;
end loop;
Ada.Wide_Wide_Text_IO.Close (File);
end Read_Test_Data;
begin
Read_Test_Data
(Ada.Command_Line.Argument (1) & '/' & "auxiliary/GraphemeBreakTest.txt",
Do_Test'Access);
end Grapheme_Cluster_Cursor_Test;
|
tests/parsing/string_expressions_db.asm | cizo2000/sjasmplus | 220 | 38 | <gh_stars>100-1000
OUTPUT "string_expressions_db.bin"
DB 'A','A'+1,2|'A',3+'A' ; ABCD (41 42 43 44)
DB 'A'|4,'F'&$46, $47&'G', 9^'A' ; EFGH (45 46 47 48)
DB 'A'^8, low 'AJ', high 'KA', 'M'-1 ; IJKL (49 4A 4B 4C)
DB 'M'*1, 'N'/1, 'O'%128, '('<<1 ; MNOP (4D 4E 4F 50)
DB 'Q'<?'Z', 'R'>?'A', 'S'%'T',~~'T' ; QRST (51 52 53 54)
|
Appl/Art/Decks/GeoDeck/LCDiamondQ.asm | steakknife/pcgeos | 504 | 247546 | <reponame>steakknife/pcgeos
LCDiamondQ label byte
word C_BLACK
Bitmap <71,100,BMC_PACKBITS,BMF_4BIT or mask BMT_MASK>
db 0x00, 0x1f, 0xfa, 0xff, 0x00, 0xf0
db 0x01, 0xdd, 0xd0, 0xe1, 0x00, 0x01, 0xdd, 0xd0
db 0x00, 0x7f, 0xfa, 0xff, 0x00, 0xfc
db 0x01, 0xd0, 0x0f, 0xe1, 0xff, 0x01, 0x00, 0xd0
db 0x00, 0x7f, 0xfa, 0xff, 0x00, 0xfc
db 0x00, 0xd0, 0xe0, 0xff, 0x01, 0xf0, 0xd0
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xdf, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xff, 0xfe, 0xcc, 0xe3, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xfc, 0xfe, 0xcc, 0x00, 0xcf, 0xe4,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf0,
0xff, 0x00, 0xf0, 0xf6, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf0,
0xff, 0x02, 0x00, 0xff, 0xf7, 0xf8, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf1,
0xff, 0x03, 0xf0, 0x4e, 0x0f, 0x77, 0xf8, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf1,
0xff, 0x04, 0x0c, 0x44, 0x40, 0x77, 0x7f, 0xf9,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf4,
0xff, 0x07, 0xf0, 0x00, 0x00, 0xce, 0x4e, 0x4e,
0x00, 0x77, 0xf9, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf5,
0xff, 0x00, 0xf0, 0xfe, 0x00, 0x05, 0x0c, 0xc4,
0x4e, 0xee, 0x00, 0x77, 0xfa, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x05, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0xf0,
0x00, 0x06, 0xec, 0xe4, 0x44, 0xee, 0x00, 0x00,
0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0x0f,
0xf7, 0xff, 0x00, 0xf0, 0xfd, 0x0f, 0x07, 0x00,
0x0c, 0x44, 0xe4, 0xee, 0x0f, 0xff, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0x0f,
0xfe, 0xff, 0x00, 0xcf, 0xfb, 0xff, 0x00, 0x00,
0xfc, 0xf0, 0x06, 0x0c, 0xe4, 0x44, 0xee, 0x0f,
0xff, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x0a, 0x0f, 0xfc, 0xcf, 0xff, 0xfc, 0xcf, 0x0f,
0xff, 0xff, 0xfc, 0xcc, 0xfb, 0xff, 0xfb, 0x0f,
0x06, 0x00, 0xc4, 0xee, 0xee, 0x0f, 0xff, 0x0f,
0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x0b, 0x0f, 0xfc, 0xcf, 0xcc, 0xfc, 0xcf, 0x0f,
0xff, 0xff, 0xcc, 0xfc, 0xcf, 0xfd, 0xff, 0x03,
0xf0, 0x00, 0xf0, 0xff, 0xfe, 0xf0, 0x06, 0x00,
0xcc, 0x44, 0x44, 0x0f, 0xff, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xfc, 0xfe, 0xcc, 0x06, 0xcf, 0x0f,
0xff, 0xfc, 0xcf, 0xcc, 0xcc, 0xfd, 0xff, 0x0d,
0xf0, 0x0f, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00,
0x0e, 0x44, 0xe4, 0xe0, 0xff, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xff, 0xfe, 0xcc, 0x07, 0xff, 0x0f,
0xff, 0xcc, 0xfc, 0xcc, 0xcc, 0xcf, 0xfe, 0xff,
0x01, 0xf0, 0x00, 0xfe, 0xff, 0x08, 0xf0, 0x00,
0x90, 0x0c, 0xcc, 0x44, 0xe0, 0xff, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x04, 0xcc, 0xcf, 0x0f,
0xfc, 0xcf, 0xfd, 0xcc, 0xfe, 0xff, 0x01, 0x0e,
0x0f, 0xfd, 0xff, 0x07, 0xf0, 0xf0, 0x00, 0xce,
0x4e, 0xe0, 0xff, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x04, 0xfc, 0xcf, 0x0f,
0xfc, 0xfc, 0xfd, 0xcc, 0xfe, 0xff, 0x0d, 0x0e,
0x0f, 0x00, 0xff, 0x00, 0xff, 0xf0, 0x0f, 0x00,
0xcc, 0x44, 0x4e, 0x0f, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xff, 0xff, 0xcf, 0xff, 0xff, 0x0f,
0xfb, 0xcc, 0x10, 0xcf, 0xff, 0xff, 0x0e, 0x00,
0x0f, 0x00, 0x0f, 0xff, 0xff, 0x09, 0x00, 0x0c,
0x00, 0x00, 0x0f, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xff, 0xfc, 0xcc, 0xff, 0xff, 0x0f,
0xfc, 0xfc, 0xcc, 0x06, 0xff, 0xff, 0xf0, 0xe0,
0x0f, 0xff, 0x0f, 0xfe, 0xff, 0x02, 0x0f, 0x00,
0x00, 0xfe, 0xff, 0x00, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xff, 0xcc, 0xfc, 0xcf, 0xff, 0x0f,
0xfc, 0xfc, 0xcc, 0x05, 0xff, 0xff, 0xf0, 0xe0,
0x0f, 0xf0, 0xfd, 0xff, 0x02, 0x0f, 0x00, 0x00,
0xfe, 0xff, 0x00, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xfc, 0xcf, 0xcc, 0xcc, 0xff, 0x0f,
0xff, 0xfd, 0xcc, 0x06, 0xcf, 0xff, 0xff, 0x0e,
0x0c, 0x0f, 0xf0, 0xfd, 0xff, 0x06, 0x09, 0xf0,
0x00, 0x0f, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x08, 0x0f, 0xfc, 0xfc, 0xcc, 0xcc, 0xff, 0x0f,
0xff, 0xfc, 0xfe, 0xcc, 0x05, 0xff, 0xff, 0xf0,
0xe0, 0xc0, 0x0f, 0xfc, 0xff, 0x06, 0x00, 0xf0,
0x00, 0x00, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfd, 0xcc, 0x18, 0xcf, 0x0f, 0xff,
0xff, 0xcc, 0xcc, 0xcf, 0xff, 0xff, 0x0e, 0x0c,
0xc0, 0x0f, 0xf0, 0x0f, 0xff, 0xff, 0xf0, 0x00,
0xf9, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xfc, 0xfe, 0xcc, 0x0c, 0xff, 0x0f,
0xff, 0xff, 0xfc, 0xcc, 0xff, 0xff, 0xf0, 0xe0,
0xcc, 0xc0, 0x0f, 0xfd, 0xff, 0x07, 0x0e, 0xe0,
0x9f, 0x00, 0x00, 0x0f, 0xff, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x01, 0x0f, 0xfc, 0xfe, 0xcc, 0x01, 0xff, 0x0f,
0xfe, 0xff, 0x07, 0xcf, 0xff, 0xff, 0x0e, 0x0c,
0xcc, 0x00, 0x00, 0xfe, 0xff, 0x08, 0xf0, 0xee,
0xee, 0x0f, 0xf0, 0x00, 0x0f, 0xff, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xff, 0xcc, 0xcc, 0xcf, 0xff, 0x0f,
0xfb, 0xff, 0x10, 0x0e, 0x0c, 0xcc, 0x00, 0xee,
0x0f, 0xff, 0x00, 0x0e, 0xee, 0xee, 0x0f, 0x90,
0x00, 0x00, 0xff, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xff, 0xfc, 0xcc, 0xff, 0xff, 0x0f,
0xfc, 0xff, 0x07, 0xf0, 0xe0, 0xcc, 0xc0, 0x00,
0xee, 0xe0, 0x00, 0xfe, 0xee, 0x06, 0xe0, 0x09,
0xff, 0x00, 0x00, 0xff, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x06, 0x0f, 0xff, 0xff, 0xcf, 0xff, 0xff, 0x0f,
0xfc, 0xff, 0x05, 0xf0, 0xe0, 0xcc, 0xc0, 0xe0,
0x00, 0xfd, 0xee, 0x07, 0x00, 0x0e, 0x00, 0xff,
0x00, 0x00, 0x0f, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x00, 0x0f, 0xfc, 0xff,
0x05, 0xf0, 0xe0, 0xcc, 0x00, 0xe0, 0xee, 0xfd,
0x00, 0x07, 0xee, 0xe0, 0xe0, 0xf9, 0xf0, 0x00,
0x0f, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfd, 0xff, 0x01, 0x00, 0x0f, 0xfc,
0xff, 0x11, 0xf0, 0xe0, 0xcc, 0x0e, 0x0e, 0xe0,
0xee, 0xe0, 0xee, 0xe0, 0xee, 0x0e, 0x00, 0x9f,
0xf0, 0x00, 0x00, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xff, 0xff, 0xf0, 0x00, 0xee, 0x00,
0x0f, 0xfd, 0xff, 0x04, 0xf0, 0xe0, 0x00, 0x0e,
0xee, 0xfb, 0x0e, 0x06, 0xe0, 0xe0, 0x0f, 0xf9,
0x00, 0x00, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xff, 0xff, 0xf0, 0xe0, 0xee, 0x0e,
0x0f, 0xfc, 0xff, 0x10, 0x0e, 0x00, 0xc0, 0xee,
0xe0, 0xee, 0xe0, 0xee, 0xe0, 0xee, 0xe0, 0x0c,
0x0f, 0x9f, 0xf0, 0x00, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x07, 0x0f, 0xff, 0xff, 0xf0, 0x0e, 0xcc, 0xe0,
0x0e, 0xfc, 0xff, 0x03, 0x0e, 0x09, 0x0c, 0x00,
0xfd, 0xee, 0x00, 0xe0, 0xfd, 0x00, 0x03, 0xff,
0xf9, 0x00, 0x0f, 0xfc, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x10, 0x0f, 0xff, 0xff, 0x0e, 0xec, 0xee, 0xce,
0xe0, 0xff, 0x00, 0x0f, 0xff, 0xff, 0xf0, 0x99,
0x90, 0xcc, 0xfd, 0x00, 0x08, 0x0c, 0xcc, 0xcc,
0x00, 0xee, 0x0f, 0x9f, 0xff, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x10, 0x0f, 0xff, 0xff, 0x0e, 0xec, 0xee, 0xce,
0xe0, 0xf0, 0xaa, 0x00, 0xff, 0xff, 0x00, 0x00,
0x99, 0x00, 0xfd, 0xcc, 0x00, 0xc0, 0xfe, 0x00,
0x04, 0x0e, 0xe0, 0x00, 0x00, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x10, 0x0f, 0xff, 0xff, 0xf0, 0x0e, 0xcc, 0xe0,
0x0f, 0x0a, 0xa0, 0x22, 0x0f, 0xff, 0x09, 0x00,
0x99, 0x0e, 0xfc, 0x00, 0x07, 0xcf, 0xcc, 0xc0,
0x00, 0xee, 0x99, 0x9e, 0x0f, 0xfc, 0xff, 0x00,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x1d, 0x0f, 0xff, 0xff, 0xf0, 0xe0, 0xee, 0x0e,
0x00, 0xf0, 0x0f, 0x02, 0x0f, 0xf0, 0x9c, 0x90,
0x00, 0xee, 0x0e, 0x0e, 0xe0, 0xe0, 0x0f, 0xcc,
0xcf, 0xcc, 0x00, 0x0e, 0xee, 0x9e, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x1d, 0x0f, 0xff, 0xff, 0xf0, 0x00, 0xee, 0x00,
0x00, 0x0f, 0xff, 0xf0, 0xff, 0x09, 0xc9, 0xc0,
0x0e, 0xe0, 0xe0, 0xee, 0xe0, 0xe0, 0x0c, 0xcf,
0xcc, 0xcf, 0x0e, 0x00, 0xee, 0x99, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x02, 0xf7, 0x00, 0xaa,
0xfe, 0x00, 0x06, 0xff, 0xff, 0x00, 0x9c, 0x90,
0x0e, 0xee, 0xfe, 0x0e, 0x09, 0x00, 0xcf, 0xcc,
0xcf, 0xcc, 0x0e, 0xe0, 0x0e, 0xee, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x19, 0xf0, 0xaa, 0xa0,
0xf0, 0xf0, 0xff, 0x00, 0xf0, 0xee, 0x09, 0x00,
0xee, 0xe0, 0xe0, 0xee, 0x0e, 0x00, 0xcc, 0xcf,
0xcc, 0xcf, 0x0e, 0x0e, 0x00, 0xee, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x0c, 0x0a, 0xaa, 0x0f,
0xf0, 0x00, 0x0f, 0xff, 0x00, 0x0e, 0xe0, 0x00,
0xee, 0xee, 0xfe, 0x0e, 0x09, 0x00, 0xcf, 0xcc,
0xcf, 0xc0, 0xe0, 0x00, 0xe0, 0x0e, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x19, 0x0a, 0xa0, 0x0f,
0x0f, 0xff, 0xf0, 0xf0, 0x0e, 0x00, 0xee, 0x00,
0x00, 0xe0, 0xe0, 0xee, 0x0e, 0x00, 0xcc, 0xcf,
0xcc, 0xc0, 0xe0, 0x00, 0x0e, 0x00, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x0d, 0x0f, 0xff, 0xff, 0xf0, 0xaa, 0x07, 0x0f,
0x00, 0x00, 0x0f, 0x00, 0xe0, 0x0e, 0xe0, 0xfe,
0x00, 0xfe, 0x0e, 0x09, 0x00, 0xcf, 0xcc, 0xcf,
0xc0, 0xe0, 0x00, 0x00, 0xe0, 0x0f, 0xfc, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x0f, 0x0f, 0xff, 0xff, 0xf0, 0xa0, 0x77, 0x00,
0xff, 0xff, 0xf0, 0xe0, 0x00, 0xee, 0x00, 0xe0,
0x09, 0xfe, 0x00, 0x0a, 0x0e, 0x00, 0xcc, 0xcf,
0xcc, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x0f, 0xfc,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x08, 0x0f, 0xff, 0xff, 0xf0, 0xa0, 0x77, 0x0f,
0x00, 0x00, 0xfe, 0x0e, 0x13, 0xe0, 0x00, 0x0e,
0x00, 0x99, 0x00, 0x00, 0x0e, 0x00, 0xcf, 0xcc,
0xcf, 0x0e, 0x00, 0xe0, 0xe0, 0x00, 0x0f, 0xff,
0x0f, 0xfe, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x23, 0x0f, 0xff, 0xff, 0xf0, 0x07, 0x77, 0x0f,
0x0f, 0xf0, 0x00, 0xe0, 0xee, 0x0c, 0xcf, 0x00,
0xe0, 0xf9, 0x9f, 0x99, 0x90, 0xe0, 0x0c, 0xcf,
0xc0, 0xe0, 0x00, 0x0e, 0x00, 0xff, 0x0f, 0xff,
0x0f, 0x7f, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x0b, 0x0f, 0x77, 0x0f,
0xf0, 0x0e, 0x00, 0x00, 0xe0, 0xcf, 0xcc, 0x00,
0xe0, 0xfe, 0x99, 0x10, 0xf0, 0xe0, 0x0f, 0xcc,
0x0e, 0xe0, 0xe0, 0x00, 0xff, 0x0f, 0x0f, 0xff,
0x00, 0x7f, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfe, 0xff, 0x1f, 0x0f, 0x7f, 0x00,
0x00, 0xe0, 0xe0, 0x0e, 0x0f, 0xcc, 0xcf, 0xc0,
0x0e, 0x00, 0x00, 0x09, 0x90, 0x0e, 0x00, 0x00,
0xee, 0x0e, 0x0e, 0x00, 0x00, 0x0f, 0x0f, 0xf0,
0xa0, 0x77, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfd, 0xff, 0x0a, 0x7f, 0x0e, 0x00,
0x0e, 0x00, 0x0e, 0x0c, 0xcf, 0xcc, 0xc0, 0x0e,
0xfe, 0x00, 0x10, 0x09, 0x00, 0xe0, 0x0e, 0xe0,
0x00, 0xe0, 0xff, 0xff, 0xf0, 0x0f, 0xf0, 0xa0,
0x77, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfd, 0xff, 0x09, 0x7f, 0x00, 0xe0,
0x00, 0x00, 0xe0, 0xcf, 0xcc, 0xcf, 0xc0, 0xfe,
0x0e, 0xfd, 0x00, 0x0d, 0xee, 0x00, 0xe0, 0x0f,
0x00, 0x00, 0x0f, 0x0f, 0x0a, 0xa0, 0x77, 0xff,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x0a, 0x00, 0x0e, 0x00,
0x00, 0xe0, 0xcc, 0xcf, 0xcc, 0xc0, 0x0e, 0x0e,
0xfe, 0xe0, 0x0f, 0x00, 0x0e, 0xe0, 0x0e, 0x00,
0xf0, 0xff, 0xff, 0x0f, 0x00, 0xaa, 0x07, 0x77,
0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x08, 0x0e, 0x00, 0xe0,
0x00, 0xe0, 0xcf, 0xcc, 0xcf, 0xc0, 0xfd, 0x0e,
0x10, 0xee, 0xe0, 0x00, 0xee, 0x00, 0x0f, 0xff,
0x00, 0x00, 0xff, 0x0a, 0xaa, 0x07, 0x7f, 0xff,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x13, 0x0e, 0xe0, 0x0e,
0x0e, 0x0f, 0xcc, 0xcf, 0xcc, 0xc0, 0x0e, 0x0e,
0xe0, 0xe0, 0xee, 0xe0, 0x09, 0x0e, 0xe0, 0xf0,
0x0f, 0xfe, 0xf0, 0x06, 0xaa, 0xa0, 0x77, 0x7f,
0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x08, 0x0e, 0xee, 0x00,
0xee, 0x0c, 0xcf, 0xcc, 0xcf, 0xc0, 0xfd, 0x0e,
0x0c, 0xee, 0x00, 0x9c, 0x90, 0x0f, 0xff, 0xf0,
0x00, 0x00, 0x0a, 0xa0, 0x07, 0x77, 0xfe, 0xff,
0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x19, 0x09, 0x9e, 0xe0,
0x0e, 0x0f, 0xcc, 0xcf, 0xcc, 0x00, 0xe0, 0xee,
0xe0, 0xe0, 0xee, 0x00, 0xc9, 0xc9, 0x0f, 0xf0,
0xff, 0xff, 0x00, 0x00, 0x0e, 0xe0, 0x00, 0xfe,
0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x1d, 0x0e, 0x9e, 0xee,
0x00, 0x0c, 0xcf, 0xcc, 0xcf, 0x00, 0xe0, 0xee,
0x0e, 0x0e, 0xe0, 0x00, 0x9c, 0x90, 0xff, 0x02,
0x0f, 0x00, 0xf0, 0x0b, 0x0e, 0xe0, 0xb0, 0x77,
0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0e, 0x99, 0x9e,
0xe0, 0x00, 0xcc, 0xcf, 0xc0, 0xfd, 0x00, 0x11,
0x0e, 0x09, 0x90, 0x09, 0x0f, 0xff, 0x02, 0x20,
0xaa, 0x0f, 0x00, 0xec, 0xce, 0x00, 0x77, 0xff,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0xfe, 0x00, 0x00, 0xee,
0xfd, 0x00, 0xfd, 0xcc, 0x11, 0xc0, 0x09, 0x90,
0x00, 0x0f, 0xff, 0xf0, 0x0a, 0xa0, 0xf0, 0xee,
0xce, 0xec, 0xee, 0x07, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0xff, 0x9f,
0x0e, 0xe0, 0x0c, 0xcc, 0xcc, 0xfd, 0x00, 0x03,
0x0c, 0xc0, 0x99, 0x90, 0xfe, 0xff, 0x0a, 0x00,
0x0f, 0xf0, 0xee, 0xce, 0xec, 0xee, 0x07, 0x7f,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x03, 0x00, 0x09, 0xff,
0xf0, 0xfd, 0x00, 0xfd, 0xee, 0x04, 0xe0, 0x0c,
0x09, 0x0e, 0x0f, 0xfd, 0xff, 0x08, 0xfe, 0x00,
0xec, 0xce, 0x00, 0x77, 0x7f, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x10, 0x00, 0x00, 0xff,
0x9f, 0x0c, 0x00, 0xee, 0xe0, 0xee, 0xe0, 0xee,
0xe0, 0xee, 0xe0, 0xc0, 0x0e, 0x0f, 0xfc, 0xff,
0x07, 0x0b, 0x0e, 0xe0, 0xb0, 0x77, 0xff, 0xff,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x00, 0x00, 0x09,
0xff, 0x00, 0xe0, 0xee, 0xfb, 0x0e, 0x03, 0xee,
0x00, 0x00, 0xe0, 0xfc, 0xff, 0x07, 0x00, 0x0e,
0xe0, 0x00, 0x77, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0xfe, 0x00, 0x0d, 0xff,
0x90, 0x0e, 0x0e, 0xe0, 0xee, 0xe0, 0xee, 0xe0,
0xee, 0x0e, 0x0c, 0xc0, 0xe0, 0xfb, 0xff, 0x06,
0x00, 0x07, 0x77, 0x77, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0x00, 0x00,
0xf9, 0xf0, 0xe0, 0xee, 0xe0, 0xfe, 0x00, 0x05,
0x0e, 0xe0, 0xe0, 0x0c, 0xc0, 0xe0, 0xfb, 0xff,
0x02, 0x07, 0x77, 0x7f, 0xfe, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0x00, 0x00,
0x0f, 0xf0, 0x0e, 0x00, 0x0e, 0xfe, 0xee, 0x05,
0xe0, 0x00, 0xe0, 0xcc, 0xc0, 0xe0, 0xfb, 0xff,
0x06, 0x0f, 0x77, 0xff, 0xcf, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x05, 0x0f, 0xf0, 0x00,
0x0f, 0xf9, 0x00, 0xfe, 0xee, 0x07, 0xe0, 0x00,
0xee, 0xe0, 0x00, 0xcc, 0xc0, 0xe0, 0xfb, 0xff,
0x06, 0x0f, 0xff, 0xfc, 0xcc, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x10, 0x0f, 0xf0, 0x00,
0x00, 0x9f, 0x0e, 0xee, 0xee, 0x00, 0x0f, 0xff,
0x0e, 0xe0, 0x0c, 0xcc, 0x0e, 0x0f, 0xfb, 0xff,
0x06, 0x0f, 0xff, 0xcc, 0xfc, 0xcf, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0xff, 0x00,
0x00, 0xff, 0x0e, 0xee, 0xe0, 0xfe, 0xff, 0x08,
0xf0, 0x00, 0x0c, 0xcc, 0x0e, 0x0f, 0xff, 0xff,
0xcf, 0xfe, 0xff, 0x06, 0x0f, 0xfc, 0xcf, 0xcc,
0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0xff, 0x00,
0x00, 0x0f, 0x90, 0xee, 0x0f, 0xfd, 0xff, 0x07,
0x00, 0xcc, 0xc0, 0xe0, 0xff, 0xff, 0xfc, 0xcc,
0xfe, 0xff, 0x06, 0x0f, 0xfc, 0xfc, 0xcc, 0xcc,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0xf0,
0x00, 0x09, 0xf0, 0x00, 0xfe, 0xff, 0x0d, 0x00,
0xff, 0x00, 0xcc, 0x0e, 0x0f, 0xff, 0xff, 0xcc,
0xfc, 0xcf, 0xff, 0xff, 0x0f, 0xfd, 0xcc, 0x01,
0xcf, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0xf0,
0x00, 0x00, 0xf0, 0x0f, 0xfc, 0xff, 0x0c, 0x00,
0xc0, 0xe0, 0xff, 0xff, 0xfc, 0xcf, 0xcc, 0xcc,
0xff, 0xff, 0x0f, 0xfc, 0xfe, 0xcc, 0x01, 0xff,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0xff,
0x00, 0x00, 0xf9, 0x0f, 0xfe, 0xff, 0x0e, 0xf0,
0xff, 0x0c, 0x0e, 0x0f, 0xff, 0xff, 0xcc, 0xfc,
0xcc, 0xcc, 0xcf, 0xff, 0x0f, 0xfc, 0xfe, 0xcc,
0x01, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0xff,
0xf0, 0x00, 0x0f, 0x0f, 0xfe, 0xff, 0x07, 0xf0,
0xff, 0x00, 0xe0, 0xff, 0xff, 0xfc, 0xcf, 0xfd,
0xcc, 0x07, 0xff, 0x0f, 0xff, 0xcc, 0xcc, 0xcf,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0xff,
0xf0, 0x00, 0x0f, 0x0f, 0xfe, 0xff, 0x07, 0x0f,
0xff, 0x00, 0xe0, 0xff, 0xff, 0xfc, 0xfc, 0xfd,
0xcc, 0x07, 0xff, 0x0f, 0xff, 0xfc, 0xcc, 0xff,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x0f, 0x0f, 0x00, 0x00,
0x0c, 0x00, 0x09, 0x0f, 0xff, 0xff, 0x00, 0x0f,
0x00, 0x0e, 0x0f, 0xff, 0xff, 0xfb, 0xcc, 0x07,
0xcf, 0x0f, 0xff, 0xff, 0xcf, 0xff, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x10, 0x0f, 0x0e, 0x44,
0x4c, 0xc0, 0x0f, 0x00, 0xff, 0xf0, 0x0f, 0xf0,
0x0f, 0x0e, 0x0f, 0xff, 0xff, 0xfc, 0xfc, 0xcc,
0x02, 0xff, 0x0f, 0xcc, 0xfd, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xf0, 0xee,
0x4e, 0xc0, 0x00, 0xf0, 0xfc, 0xff, 0x04, 0x0e,
0x0f, 0xff, 0xff, 0xfc, 0xfc, 0xcc, 0x03, 0xff,
0x0f, 0xcc, 0xcf, 0xfe, 0xff, 0x00, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x07, 0x0f, 0xf0, 0xe4,
0x4c, 0xcc, 0x00, 0x90, 0x00, 0xfe, 0xff, 0x01,
0xf0, 0x00, 0xfd, 0xff, 0xfd, 0xcc, 0x08, 0xcf,
0xff, 0x0f, 0xfc, 0xcc, 0xcc, 0xcf, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x0c, 0x0f, 0xf0, 0xe4,
0xe4, 0x4e, 0x00, 0x00, 0x0f, 0x0f, 0xff, 0xff,
0x0f, 0x00, 0xfd, 0xff, 0x00, 0xfc, 0xfe, 0xcc,
0x02, 0xff, 0xff, 0x0f, 0xfd, 0xcc, 0x01, 0xff,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x0c, 0x0f, 0xff, 0x04,
0x44, 0x4c, 0xc0, 0x00, 0xf0, 0xf0, 0xff, 0xf0,
0xf0, 0x00, 0xfc, 0xff, 0x0b, 0xcc, 0xcc, 0xcf,
0xff, 0xff, 0x0f, 0xcc, 0xfc, 0xcf, 0xcc, 0xff,
0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x05, 0x0f, 0xff, 0x0e,
0xee, 0xe4, 0xc0, 0xfa, 0x0f, 0xfc, 0xff, 0x01,
0xfc, 0xcc, 0xfe, 0xff, 0x06, 0x0f, 0xcc, 0xff,
0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0x0e,
0xe4, 0x44, 0xec, 0x00, 0xfc, 0xf0, 0x00, 0x0f,
0xfb, 0xff, 0x00, 0xcf, 0xfe, 0xff, 0x06, 0x0f,
0xcc, 0xff, 0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x0f, 0xff, 0x0e,
0xe4, 0xe4, 0x4c, 0x00, 0xfd, 0x0f, 0x00, 0x00,
0xf6, 0xff, 0x06, 0x0f, 0xcc, 0xff, 0xff, 0xcc,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfc, 0xff, 0x06, 0x00, 0x00, 0x0e,
0xe4, 0x44, 0xec, 0xe0, 0xf1, 0x00, 0x06, 0x0f,
0xcc, 0xff, 0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xfa, 0xff, 0x04, 0xf0, 0x0e, 0xee,
0x44, 0xcc, 0xfd, 0x00, 0x01, 0x77, 0x77, 0xf6,
0xff, 0x05, 0xcc, 0xff, 0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf9, 0xff, 0x09, 0xf0, 0x0e, 0x4e,
0x4e, 0xc0, 0x00, 0x00, 0x77, 0x77, 0x7f, 0xf6,
0xff, 0x05, 0xcc, 0xff, 0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf8, 0xff, 0x03, 0xf0, 0x44, 0x4c,
0x07, 0xfe, 0x77, 0x00, 0x7f, 0xf5, 0xff, 0x05,
0xcc, 0xff, 0xff, 0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf7, 0xff, 0x04, 0x0e, 0x40, 0x77,
0x77, 0x7f, 0xf3, 0xff, 0x05, 0xcc, 0xff, 0xff,
0xcc, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf7, 0xff, 0x03, 0xf0, 0x0f, 0x77,
0x77, 0xf2, 0xff, 0x05, 0xcc, 0xff, 0xff, 0xcc,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf7, 0xff, 0x03, 0xf0, 0xff, 0xf7,
0x7f, 0xf2, 0xff, 0x05, 0xcc, 0xff, 0xff, 0xcc,
0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xf5, 0xff, 0x00, 0xf7, 0xf1, 0xff,
0xfd, 0xcc, 0x01, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xe4, 0xff, 0x05, 0xfc, 0xcc, 0xcc,
0xcf, 0xff, 0x00
db 0xf9, 0xff, 0x00, 0xfe
db 0x00, 0x0f, 0xdf, 0xff, 0x00, 0x00
db 0x00, 0x7f, 0xfa, 0xff, 0x00, 0xfc
db 0x00, 0xd0, 0xe0, 0xff, 0x01, 0xf0, 0xd0
db 0x00, 0x7f, 0xfa, 0xff, 0x00, 0xfc
db 0x01, 0xd0, 0x0f, 0xe1, 0xff, 0x01, 0x00, 0xd0
db 0x00, 0x1f, 0xfa, 0xff, 0x00, 0xf0
db 0x01, 0xdd, 0xd0, 0xe1, 0x00, 0x01, 0xdd, 0xd0
|
oeis/290/A290593.asm | neoneye/loda-programs | 11 | 22115 | ; A290593: Number of maximal independent vertex sets (and minimal vertex covers) in the n-antiprism graph.
; Submitted by <NAME>
; 3,12,15,31,49,92,156,279,484,855,1495,2629,4608,8092,14195,24916,43719,76727,134641,236284,414644,727655,1276940,2240879,3932463,6900997,12110400,21252276,37295139,65448412,114853951,201554639,353703729,620706780,1089264460,1911525879
mov $4,-2
mov $5,6
lpb $0
sub $0,1
add $1,$5
sub $3,$4
sub $3,2
mov $4,$2
mov $2,3
add $2,$1
mov $1,$3
add $4,3
add $5,$4
mov $3,$5
lpe
mov $0,$2
add $0,3
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2392.asm | ljhsiun2/medusa | 9 | 93397 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2392.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1147f, %rsi
nop
nop
cmp $25264, %r10
movups (%rsi), %xmm1
vpextrq $1, %xmm1, %r14
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_UC_ht+0x197d7, %r12
nop
nop
nop
add $30521, %r14
mov $0x6162636465666768, %rbx
movq %rbx, %xmm3
vmovups %ymm3, (%r12)
inc %r9
lea addresses_WT_ht+0xca77, %r10
nop
cmp $59471, %r12
movb $0x61, (%r10)
nop
nop
nop
inc %r12
lea addresses_A_ht+0x14857, %r12
nop
nop
nop
nop
nop
add $32515, %r10
mov (%r12), %r14w
nop
nop
and %r10, %r10
lea addresses_A_ht+0x145d7, %r10
nop
nop
nop
nop
xor %rsi, %rsi
movw $0x6162, (%r10)
nop
nop
nop
xor %r9, %r9
lea addresses_UC_ht+0x6997, %rsi
lea addresses_normal_ht+0xd057, %rdi
clflush (%rsi)
nop
nop
nop
nop
xor %r9, %r9
mov $90, %rcx
rep movsb
nop
nop
nop
cmp $62869, %r10
lea addresses_A_ht+0x11c60, %rsi
lea addresses_UC_ht+0x16457, %rdi
add $61606, %r9
mov $26, %rcx
rep movsl
nop
nop
nop
cmp %r10, %r10
lea addresses_normal_ht+0xb757, %r9
nop
nop
nop
nop
nop
xor $18044, %rsi
mov (%r9), %bx
nop
nop
xor $52153, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %rcx
push %rdx
push %rsi
// Faulty Load
lea addresses_normal+0x1ac57, %rsi
nop
nop
nop
cmp $56803, %r8
movb (%rsi), %r13b
lea oracles, %rcx
and $0xff, %r13
shlq $12, %r13
mov (%rcx,%r13,1), %r13
pop %rsi
pop %rdx
pop %rcx
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'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
*/
|
include/sf-graphics-font.ads | danva994/ASFML-1.6 | 1 | 16048 | -- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 <NAME> (<EMAIL>)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Sf.Config;
with Sf.Graphics.Glyph;
with Sf.Graphics.Types;
package Sf.Graphics.Font is
use Sf.Config;
use Sf.Graphics.Glyph;
use Sf.Graphics.Types;
-- ////////////////////////////////////////////////////////////
-- /// Create a new empty font
-- ///
-- /// \return A new sfFont object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfFont_Create return sfFont_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new font from a file
-- ///
-- /// \param Filename : Path of the font file to load
-- /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality
-- /// \param Charset : Characters set to generate (just pass NULL to get the default charset)
-- ///
-- /// \return A new sfFont object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfFont_CreateFromFile
(Filename : String;
CharSize : sfUint32;
Charset : sfUint32_Ptr)
return sfFont_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new image font a file in memory
-- ///
-- /// \param Data : Pointer to the file data in memory
-- /// \param SizeInBytes : Size of the data to load, in bytes
-- /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality
-- /// \param Charset : Characters set to generate (just pass NULL to get the default charset)
-- ///
-- /// \return A new sfFont object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfFont_CreateFromMemory
(Data : sfInt8_Ptr;
SizeInBytes : sfSize_t;
CharSize : sfUint32;
Charset : sfUint32_Ptr)
return sfFont_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Destroy an existing font
-- ///
-- /// \param Font : Font to delete
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfFont_Destroy (Font : sfFont_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Get the base size of characters in a font;
-- /// All glyphs dimensions are based on this value
-- ///
-- /// \param Font : Font object
-- ///
-- /// \return Base size of characters
-- ///
-- ////////////////////////////////////////////////////////////
function sfFont_GetCharacterSize (Font : sfFont_Ptr) return sfUint32;
-- ////////////////////////////////////////////////////////////
-- /// Get the built-in default font (Arial)
-- ///
-- /// \return Pointer to the default font
-- ///
-- ////////////////////////////////////////////////////////////
function sfFont_GetDefaultFont return sfFont_Ptr;
private
pragma Import (C, sfFont_Create, "sfFont_Create");
pragma Import (C, sfFont_CreateFromMemory, "sfFont_CreateFromMemory");
pragma Import (C, sfFont_Destroy, "sfFont_Destroy");
pragma Import (C, sfFont_GetCharacterSize, "sfFont_GetCharacterSize");
pragma Import (C, sfFont_GetDefaultFont, "sfFont_GetDefaultFont");
end Sf.Graphics.Font;
|
test/Fail/DataParameterPolarity.agda | cruhland/agda | 1,989 | 9413 | <gh_stars>1000+
-- Andreas, 2012-09-07
module DataParameterPolarity where
data Bool : Set where
true false : Bool
data ⊥ : Set where
record ⊤ : Set where
-- True uses its first argument.
True : Bool → Set
True true = ⊤
True false = ⊥
-- Hence, D also uses its first argument.
-- A buggy polarity analysis may consider D as constant.
data D (b : Bool) : Set where
c : True b → D b
d : {b : Bool} → D b → True b
d (c x) = x
-- This cast is fatal, possible if D is considered constant.
cast : (a b : Bool) → D a → D b
cast a b x = x
bot : ⊥
bot = d (cast true false (c _))
|
shared_data.ads | oysteinlondal/Inverted-Pendulum | 0 | 10462 | <filename>shared_data.ads
with Type_Lib; use Type_Lib;
package Shared_Data is
protected type Sensor_Reading is
procedure Set (Meassured_Value : in Float);
entry Get (Value : out Float);
private
Updated : Boolean := False;
Current_Value : Float;
end Sensor_Reading;
protected type Actuator_Write is
procedure Set (Calculated_Value : in RPM; Motor : in Motor_Direction);
entry Get (Value : out RPM; Motor : out Motor_Direction);
private
Updated : Boolean := False;
Current_Value : RPM;
Current_Motor : Motor_Direction;
end Actuator_Write;
end Shared_Data; |
data/pokemon/dex_entries/lotad.asm | AtmaBuster/pokeplat-gen2 | 6 | 17024 | db "WATER WEED@" ; species name
db "Its leaf grew too"
next "large for it to"
next "live on land. This"
page "is why it chose to"
next "live by floating"
next "on water.@"
|
spaceship/src/spaceship_gui.adb | kndtime/ada-spaceship | 0 | 12914 | <gh_stars>0
with STM32.Board; use STM32.Board;
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Numerics.Discrete_Random;
with STM32.DMA2D_Bitmap; use STM32.DMA2D_Bitmap;
with HAL.Bitmap; use HAL.Bitmap;
with HAL.Touch_Panel; use HAL.Touch_Panel;
with Spaceship; use Spaceship;
with Missile; use Missile;
with Ennmie; use Ennmie;
procedure spaceship_gui
is
X_Coord : Integer := 0;
Y_Coord : Integer := 0;
-- 480x272
Width : Natural; -- 240
Height : Natural; -- 320
MAX_WIDTH : constant Natural := 480;
MAX_HEIGHT : constant Natural := 272;
count : Integer := 0;
subtype RGN_H is Integer range 25 ..( MAX_HEIGHT - 25);
package Random_H is new Ada.Numerics.Discrete_Random (RGN_H); use Random_H;
G : Generator;
Period : constant Time_Span := Milliseconds (1);
Next_Release : Time := Clock;
Next_missile : Integer := 0;
Next_Ennmie : Integer := 0;
Next_Enemie_Move : Integer := 0;
function Bitmap_Buffer return not null Any_Bitmap_Buffer;
Missiles : array (1 .. 15) of Missile.Missile;
Ennmies : array (1 .. 8) of Ennmie.Ennmie;
space : Spaceship.Spaceship;
-------------------
-- Bitmap_Buffer --
-------------------
function Bitmap_Buffer return not null Any_Bitmap_Buffer is
begin
if Display.Hidden_Buffer (1).all not in DMA2D_Bitmap_Buffer then
raise Program_Error with "We expect a DM2D buffer here";
end if;
return Display.Hidden_Buffer (1);
end Bitmap_Buffer;
procedure ishit(m : in out Missile. Missile; e: in out Ennmie.Ennmie) is
begin
if m.X > e.X and m.X < (e.X + 25) and m.Y > e.Y then
e.State := DMG_DEALT;
m.State := TOUCHED;
end if;
end ishit;
procedure update_Enn is
begin
if Next_Ennmie = 0 then
for i in Ennmies'First .. Ennmies'Last loop
if Ennmies(i).State = DEAD then
Ennmie.appear_enn(Ennmies(i), RANDOM(G), MAX_HEIGHT -5 , MAX_HEIGHT, MAX_WIDTH);
exit;
end if;
end loop;
Next_Ennmie := 50;
else
Next_Ennmie := Next_Ennmie - 1;
end if;
if Next_Enemie_Move = 0 then
for i in Ennmies'First .. Ennmies'Last loop
if Ennmies(i).State = DMG_DEALT then
Ennmies(i).State := DEAD;
end if;
if Ennmies(i).State /= DEAD then
Ennmie.move_enn(Ennmies(i));
end if;
end loop;
Next_Enemie_Move := 2;
else
Next_Enemie_Move := Next_Enemie_Move - 1;
end if;
end update_Enn;
procedure update(X : Integer; Y : Integer) is
begin
if Next_missile = 0 then
for i in Missiles'First .. Missiles'Last loop
if Missiles(i).State = DEAD then
Missile.appear_mis(Missiles(i), space.X, space.Y, Height);
exit;
end if;
end loop;
Next_missile := 20;
else
Next_missile := Next_missile - 1;
end if;
for i in Missiles'First .. Missiles'Last loop
if Missiles(i).State /= DEAD then
Missile.move_mis(Missiles(i));
end if;
if Missiles(i).State = TOUCHED then
Missiles(i).State := DEAD;
end if;
end loop;
update_Enn;
for i in Missiles'First .. Missiles'Last loop
if Missiles(i).State = ALIVE then
for j in Ennmies'First .. Ennmies'Last loop
if Ennmies(j).State = ALIVE then
ishit(Missiles(i), Ennmies(j));
end if;
end loop;
end if;
end loop;
if X = 0 then
return;
end if;
space.X := X;
space.Y := Y;
end update;
procedure draw_mis(s : in Missile.Missile) is
begin
if s.State = DEAD then
return;
end if;
Bitmap_Buffer.Set_Source (HAL.Bitmap.Yellow);
Bitmap_Buffer.Fill_Rect ((Position => (s.X, s.Y),
Width => Width / 80,
Height => Height / 80));
end draw_mis;
procedure draw_space(s : in out Spaceship.Spaceship; X : Integer; Y : Integer) is
begin
s.X := X;
s.Y := Y;
if s.State = ALIVE then
Bitmap_Buffer.Set_Source (HAL.Bitmap.Blue);
else if s.State = DMG_DEALT then
Bitmap_Buffer.Set_Source (HAL.Bitmap.White);
end if;
end if;
Bitmap_Buffer.Fill_Rect ((Position => (X, Y),
Width => Width / 8,
Height => Height / 8));
end draw_space;
procedure draw_enn(e : in Ennmie.Ennmie) is
begin
if e.State = DEAD then
return;
end if;
if e.State = ALIVE then
Bitmap_Buffer.Set_Source (HAL.Bitmap.Red);
else if e.State = DMG_DEALT then
Bitmap_Buffer.Set_Source (HAL.Bitmap.White);
end if;
end if;
Bitmap_Buffer.Fill_Rect ((Position => (e.X, e.Y),
Width => Width / 12,
Height => Height / 12));
end draw_enn;
procedure draw(X : Integer; Y : Integer) is
begin
draw_space(space, X, Y);
for i in Missiles'First .. Missiles'Last loop
draw_mis(Missiles(i));
end loop;
for i in Ennmies'First .. Ennmies'Last loop
draw_enn(Ennmies(i));
end loop;
end draw;
begin
Reset(G);
-- Initialize LCD
Display.Initialize;
Display.Initialize_Layer (1, HAL.Bitmap.ARGB_8888);
Touch_Panel.Initialize;
Width := Bitmap_Buffer.Width;
Height := Bitmap_Buffer.Height;
space.Y := 20;
space.X := Width/2;
loop
declare
State : constant TP_State := Touch_Panel.Get_All_Touch_Points;
begin
if State'Length > 0 then
X_Coord := State (State'First).X;
Y_Coord := State (State'First).Y;
end if;
end;
Bitmap_Buffer.Set_Source (HAL.Bitmap.Black);
Bitmap_Buffer.Fill;
update(X_Coord, Y_Coord);
if X_Coord /= 0 then
draw(X_Coord, Y_Coord);
else
draw(space.X, space.Y);
end if;
count := count + 10;
Display.Update_Layers;
Next_Release := Next_Release + Period;
delay until Next_Release;
end loop;
end spaceship_gui;
|
programs/oeis/195/A195035.asm | neoneye/loda | 22 | 940 | ; A195035: Multiples of 15 and of 8 interleaved: a(2n-1) = 15n, a(2n) = 8n.
; 15,8,30,16,45,24,60,32,75,40,90,48,105,56,120,64,135,72,150,80,165,88,180,96,195,104,210,112,225,120,240,128,255,136,270,144,285,152,300,160,315,168,330,176,345,184,360,192,375,200,390,208,405,216,420,224,435,232,450,240,465,248,480,256,495,264,510,272,525,280,540,288,555,296,570,304,585,312,600,320,615,328,630,336,645,344,660,352,675,360,690,368,705,376,720,384,735,392,750,400
mov $2,$0
add $0,3
mul $0,5
mov $4,$0
add $0,1
mul $0,7
div $0,10
mov $1,$4
mod $1,2
mul $1,$0
add $1,4
mov $3,$2
mul $3,4
add $1,$3
mov $0,$1
|
agda/Frog.agda | halfaya/MusicTools | 28 | 13417 | {-# OPTIONS --cubical #-}
-- First and second species counterpoint for Frog's song
module Frog where
open import Data.Fin
open import Data.List using (List; []; _∷_; _++_; map)
open import Data.Maybe using (fromMaybe)
open import Data.Nat
open import Data.Product using (_×_; _,_; proj₁; proj₂)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality using (refl)
open import Counterpoint
open import Note
open import Music
open import MidiEvent
open import Pitch
open import Interval
open import Util
-- First species counterpoint (musical content)
first : PitchInterval
first = (c 5 , per8)
middle : List PitchInterval
middle = (d 5 , maj6) ∷ (e 5 , min6) ∷ (f 5 , maj3) ∷ (e 5 , min3) ∷ (d 5 , maj6) ∷ []
middle' : List PitchInterval
middle' = (d 5 , per8) ∷ (e 5 , min6) ∷ (f 5 , maj3) ∷ (e 5 , min3) ∷ (d 5 , maj6) ∷ []
last : PitchInterval
last = (c 5 , per8)
-- Second species counterpoint (musical content)
first2 : PitchInterval
first2 = (c 5 , per5)
middle2 : List PitchInterval2
middle2 = (d 5 , min3 , per5) ∷ (e 5 , min3 , min6) ∷ (f 5 , maj3 , aug4) ∷
(e 5 , min6 , per1) ∷ (d 5 , min3 , maj6) ∷ []
last2 : PitchInterval
last2 = (c 5 , per8)
-- Correct first species counterpoint
fs : FirstSpecies
fs = firstSpecies first middle last refl refl refl refl
{-
-- Parallel octave example from Section 3.3; ill-typed
fs' : FirstSpecies
fs' = firstSpecies first middle' last refl refl refl refl
-}
-- Correct second species counterpoint
ss : SecondSpecies
ss = secondSpecies first2 middle2 last2 refl refl refl refl refl
-- Music as list of notes
cf cp1 cp2 : List Note
cf =
tone whole (proj₁ (FirstSpecies.firstBar fs)) ∷
map (tone whole ∘ proj₁ ∘ pitchIntervalToPitchPair) (FirstSpecies.middleBars fs) ++
tone whole (proj₁ (FirstSpecies.lastBar fs)) ∷
[]
cp1 =
tone whole ((proj₂ ∘ pitchIntervalToPitchPair) (FirstSpecies.firstBar fs)) ∷
map (tone whole ∘ proj₂ ∘ pitchIntervalToPitchPair) (FirstSpecies.middleBars fs) ++
tone whole ((proj₂ ∘ pitchIntervalToPitchPair) (FirstSpecies.lastBar fs)) ∷
[]
cp2 =
rest half ∷
(tone half ((proj₂ ∘ pitchIntervalToPitchPair) (SecondSpecies.firstBar ss))) ∷
map (tone half ∘ proj₂ ∘ pitchIntervalToPitchPair) (expandPitchIntervals2 (SecondSpecies.middleBars ss)) ++
tone whole ((proj₂ ∘ pitchIntervalToPitchPair) (SecondSpecies.lastBar ss)) ∷
[]
----
-- MIDI generation
piano marimba : InstrumentNumber-1
piano = # 0
marimba = # 12
channel1 channel2 : Channel-1
channel1 = # 0
channel2 = # 1
tempo : ℕ
tempo = 120
cfVelocity cpVelocity : Velocity
cfVelocity = # 60
cpVelocity = # 30
cfTrack : MidiTrack
cfTrack = track "Cantus Firmus" piano channel1 tempo (notes→events cfVelocity cf)
cpTrack1 : MidiTrack
cpTrack1 = track "Counterpoint 1" piano channel2 tempo (notes→events cpVelocity cp1)
cfcpTracks1 : List MidiTrack
cfcpTracks1 = cpTrack1 ∷ cfTrack ∷ []
cpTrack2 : MidiTrack
cpTrack2 = track "Counterpoint 2" piano channel2 tempo (notes→events cpVelocity cp2)
cfcpTracks2 : List MidiTrack
cfcpTracks2 = cpTrack2 ∷ cfTrack ∷ []
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_117_3035.asm | ljhsiun2/medusa | 9 | 4865 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1b97e, %rsi
lea addresses_WT_ht+0x1bb62, %rdi
nop
nop
nop
dec %r10
mov $64, %rcx
rep movsl
nop
nop
nop
nop
add $42904, %rbx
lea addresses_WC_ht+0xf9e2, %rsi
nop
add %rbp, %rbp
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
sub %rbx, %rbx
lea addresses_normal_ht+0xcde2, %rsi
lea addresses_normal_ht+0x1aa02, %rdi
nop
sub $1822, %r9
mov $98, %rcx
rep movsw
add $55330, %rbx
lea addresses_WT_ht+0xb952, %rbx
clflush (%rbx)
nop
nop
xor $21981, %rdi
mov (%rbx), %cx
and $11961, %rdi
lea addresses_D_ht+0x15da2, %rdi
nop
add %rcx, %rcx
mov (%rdi), %si
nop
nop
nop
sub %rbp, %rbp
lea addresses_A_ht+0xe3e, %rdi
nop
nop
cmp %rcx, %rcx
movl $0x61626364, (%rdi)
nop
nop
cmp $31248, %r10
lea addresses_WT_ht+0xa262, %rdi
nop
nop
add $52893, %rbx
movb $0x61, (%rdi)
and $9550, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r9
push %rax
push %rbx
push %rdi
push %rdx
// Store
mov $0x3cb63900000008e2, %r9
nop
add $22666, %rdi
mov $0x5152535455565758, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
nop
nop
xor $22588, %rbx
// Faulty Load
lea addresses_PSE+0x19de2, %r14
nop
nop
nop
nop
nop
and $48094, %r11
movups (%r14), %xmm4
vpextrq $0, %xmm4, %r9
lea oracles, %rbx
and $0xff, %r9
shlq $12, %r9
mov (%rbx,%r9,1), %r9
pop %rdx
pop %rdi
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'33': 117}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/ada-libc/src/libc-stdio.ads | mstewartgallus/linted | 0 | 17078 | <gh_stars>0
-- Copyright 2015,2017 <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-- implied. See the License for the specific language governing
-- permissions and limitations under the License.
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
package Libc.Stdio with
Spark_Mode => Off is
pragma Preelaborate;
-- unsupported macro: BUFSIZ _IO_BUFSIZ
SEEK_SET : constant := 0;
SEEK_CUR : constant := 1;
type FILE is limited private;
-- subtype off_t is Libc.Sys.Types.uu_off_t; -- /usr/include/stdio.h:90
-- subtype off64_t is Libc.Sys.Types.uu_off64_t; -- /usr/include/stdio.h:97
-- subtype ssize_t is Libc.Sys.Types.uu_ssize_t; -- /usr/include/stdio.h:102
-- subtype fpos_t is Libc.uG_config_h.u_G_fpos_t;
-- subtype fpos64_t is Libc.uG_config_h.u_G_fpos64_t;
stdin : access FILE; -- /usr/include/stdio.h:168
pragma Import (C, stdin, "stdin");
stdout : access FILE; -- /usr/include/stdio.h:169
pragma Import (C, stdout, "stdout");
stderr : access FILE; -- /usr/include/stdio.h:170
pragma Import (C, stderr, "stderr");
function remove
(filename : Interfaces.C.Strings.chars_ptr)
return int; -- /usr/include/stdio.h:178
pragma Import (C, remove, "remove");
function rename
(old : Interfaces.C.Strings.chars_ptr;
uu_new : Interfaces.C.Strings.chars_ptr)
return int; -- /usr/include/stdio.h:180
pragma Import (C, rename, "rename");
function tmpfile return access FILE; -- /usr/include/stdio.h:195
pragma Import (C, tmpfile, "tmpfile");
function tmpnam
(s : Interfaces.C.Strings.chars_ptr)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/stdio.h:209
pragma Import (C, tmpnam, "tmpnam");
function fclose
(stream : access FILE) return int; -- /usr/include/stdio.h:237
pragma Import (C, fclose, "fclose");
function fflush
(stream : access FILE) return int; -- /usr/include/stdio.h:242
pragma Import (C, fflush, "fflush");
function fopen
(filename : Interfaces.C.Strings.chars_ptr;
modes : Interfaces.C.Strings.chars_ptr)
return access FILE; -- /usr/include/stdio.h:272
pragma Import (C, fopen, "fopen");
function freopen
(filename : Interfaces.C.Strings.chars_ptr;
modes : Interfaces.C.Strings.chars_ptr;
stream : access FILE) return access FILE; -- /usr/include/stdio.h:278
pragma Import (C, freopen, "freopen");
procedure setbuf
(stream : access FILE;
buf : Interfaces.C.Strings.chars_ptr); -- /usr/include/stdio.h:332
pragma Import (C, setbuf, "setbuf");
function setvbuf
(stream : access FILE;
buf : Interfaces.C.Strings.chars_ptr;
modes : int;
n : size_t) return int; -- /usr/include/stdio.h:336
pragma Import (C, setvbuf, "setvbuf");
procedure setbuffer
(stream : access FILE;
buf : Interfaces.C.Strings.chars_ptr;
size : size_t); -- /usr/include/stdio.h:343
pragma Import (C, setbuffer, "setbuffer");
function vfprintf
(s : access FILE;
format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:371
pragma Import (C, vfprintf, "vfprintf");
function vprintf
(format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:377
pragma Import (C, vprintf, "vprintf");
function vsprintf
(s : Interfaces.C.Strings.chars_ptr;
format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:379
pragma Import (C, vsprintf, "vsprintf");
function vsnprintf
(s : Interfaces.C.Strings.chars_ptr;
maxlen : size_t;
format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:390
pragma Import (C, vsnprintf, "vsnprintf");
function vasprintf
(ptr : System.Address;
f : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:399
pragma Import (C, vasprintf, "vasprintf");
function vdprintf
(fd : int;
fmt : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:412
pragma Import (C, vdprintf, "vdprintf");
function vfscanf
(s : access FILE;
format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:471
pragma Import (C, vfscanf, "vfscanf");
function vscanf
(format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:479
pragma Import (C, vscanf, "vscanf");
function vsscanf
(s : Interfaces.C.Strings.chars_ptr;
format : Interfaces.C.Strings.chars_ptr;
arg : access System.Address) return int; -- /usr/include/stdio.h:483
pragma Import (C, vsscanf, "vsscanf");
function fgetc
(stream : access FILE) return int; -- /usr/include/stdio.h:531
pragma Import (C, fgetc, "fgetc");
function getc
(stream : access FILE) return int; -- /usr/include/stdio.h:532
pragma Import (C, getc, "getc");
function getchar return int; -- /usr/include/stdio.h:538
pragma Import (C, getchar, "getchar");
function fputc
(c : int;
stream : access FILE) return int; -- /usr/include/stdio.h:573
pragma Import (C, fputc, "fputc");
function putc
(c : int;
stream : access FILE) return int; -- /usr/include/stdio.h:574
pragma Import (C, putc, "putc");
function putchar (c : int) return int; -- /usr/include/stdio.h:580
pragma Import (C, putchar, "putchar");
function fgets
(s : Interfaces.C.Strings.chars_ptr;
n : int;
stream : access FILE)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/stdio.h:622
pragma Import (C, fgets, "fgets");
function gets
(s : Interfaces.C.Strings.chars_ptr)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/stdio.h:638
pragma Import (C, gets, "gets");
function fputs
(s : Interfaces.C.Strings.chars_ptr;
stream : access FILE) return int; -- /usr/include/stdio.h:689
pragma Import (C, fputs, "fputs");
function puts
(s : Interfaces.C.Strings.chars_ptr)
return int; -- /usr/include/stdio.h:695
pragma Import (C, puts, "puts");
function ungetc
(c : int;
stream : access FILE) return int; -- /usr/include/stdio.h:702
pragma Import (C, ungetc, "ungetc");
function fread
(ptr : System.Address;
size : size_t;
n : size_t;
stream : access FILE) return size_t; -- /usr/include/stdio.h:709
pragma Import (C, fread, "fread");
function fwrite
(ptr : System.Address;
size : size_t;
n : size_t;
s : access FILE) return size_t; -- /usr/include/stdio.h:715
pragma Import (C, fwrite, "fwrite");
function fseek
(stream : access FILE;
off : long;
whence : int) return int; -- /usr/include/stdio.h:749
pragma Import (C, fseek, "fseek");
function ftell
(stream : access FILE) return long; -- /usr/include/stdio.h:754
pragma Import (C, ftell, "ftell");
procedure rewind (stream : access FILE); -- /usr/include/stdio.h:759
pragma Import (C, rewind, "rewind");
-- function fseeko
-- (stream : access FILE;
-- off : Libc.Sys.Types.off_t;
-- whence : int) return int; -- /usr/include/stdio.h:773
-- pragma Import (C, fseeko, "fseeko");
-- function ftello (stream : access FILE) return Libc.Sys.Types.off_t; -- /usr/include/stdio.h:778
-- pragma Import (C, ftello, "ftello");
-- function fgetpos (stream : access FILE; pos : access fpos_t) return int; -- /usr/include/stdio.h:798
-- pragma Import (C, fgetpos, "fgetpos");
-- function fsetpos (stream : access FILE; pos : access fpos_t) return int; -- /usr/include/stdio.h:803
-- pragma Import (C, fsetpos, "fsetpos");
procedure clearerr (stream : access FILE); -- /usr/include/stdio.h:826
pragma Import (C, clearerr, "clearerr");
function feof
(stream : access FILE) return int; -- /usr/include/stdio.h:828
pragma Import (C, feof, "feof");
function ferror
(stream : access FILE) return int; -- /usr/include/stdio.h:830
pragma Import (C, ferror, "ferror");
procedure perror
(s : Interfaces.C.Strings.chars_ptr); -- /usr/include/stdio.h:846
pragma Import (C, perror, "perror");
private
type FILE is record
null;
end record;
pragma Convention (C_Pass_By_Copy, FILE);
end Libc.Stdio;
|
third_party/antlr_grammars_v4/stellaris/stellaris.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 4 | 6256 | grammar stellaris;
content:
expr+
;
expr:
keyval+
;
keyval:
key ('=' | '>' | '<')+ val
;
key:
id | attrib
;
val:
id | attrib | group
;
attrib:
id accessor (attrib| id)
;
accessor:
'.'|'@'|':'
;
group:
'{' (expr* | id) '}'
;
id:
IDENTIFIER | STRING | INTEGER
;
IDENTIFIER:
IDENITIFIERHEAD IDENITIFIERBODY*
;
INTEGER:
[+-]? INTEGERFRAG
;
fragment INTEGERFRAG:
[0-9]+
;
fragment IDENITIFIERHEAD:
[a-zA-Z]
;
fragment IDENITIFIERBODY
: IDENITIFIERHEAD | [0-9_]
;
STRING:
'"' ~["\r\n]* '"'
;
COMMENT:
'#' ~[\r\n]* -> channel(HIDDEN)
;
SPACE:
[ \t\f] -> channel(HIDDEN)
;
NL:
[\r\n] -> channel(HIDDEN)
;
|
Copy paste and Open Save As between FT MD and FTML/FTSaveAsFTML.applescript | RobTrew/txtquery-tools | 69 | 2415 | function run() {
'use strict';
/* jshint multistr: true */
var pTitle = "FT save as FT for Atom ftml (html) outline",
pVer = "0.17",
pAuthor = "<NAME>",
pSite = "https://github.com/RobTrew/txtquery-tools",
pComment =
"\
- Preserves the FoldingText outlining expansion state in the ul.\
- Each <li> has a <p> element, and may have a nested <ul>\
- FoldingText @key(value) pairs become <li> attributes with string values\
- FoldingText @tags with no value ? <li> attributes with value 1\
- This version uses CommonMark rather than FT line type names \
",
pblnDebug = 0,
pblnToFile = 1, // SAVE AS AN FTML FILE ?
pblnToClipboard = 0; // COPY FTML TO CLIPBOARD ?
//OPTIONS:
//Export the whole document, or just the subtree(s) of any selected line(s) ?
var pblnWholeDoc = true;
// Default folder for Save As dialog ?
//var pOutFolder = appSA.pathTo('desktop');
// or e.g.
// var pOutFolder=Path("/Users/houthakker/docs")
var pOutFolder = null; // defaults to most recent folder
// FoldingText code (to be passed as string, with options, to FT.evaluate() ...)
var fnScript =
function (editor, options) {
// FoldingText code here
// SHARED REGEXES
var rgxAmp = /&/g,
rgxApos = /\'/g,
rgxQuot = /\"/g,
rgxLt = /</g,
rgxGt = />/g,
rgxCode = /`([^\n\r]+)`/g,
rgxBold = /\*\*([^\*\n\r]+)\*\*/g,
rgxItalic = /[\*_]([^\*_\n\r]+)[\*_]/g,
rgxImage = /!\[([^\]]*)]\(([^(]+)\)/g,
rgxLink = /\[([^\]]+)]\(([^(]+)\)/g;
// FIND THE ROOT NODES AMONG THE SELECTED LINES
// (Ignoring any children of lines already seen)
// editorState --> [ftNode]
function selectedRoots() {
var lstRoots = [],
lstSeen = [];
editor.selectedRange().forEachNodeInRange(function (oNode) {
if (oNode.type() !== 'empty') {
if (lstSeen.indexOf(oNode.parent.id) === -1) lstRoots.push(oNode);
lstSeen.push(oNode.id);
}
});
return lstRoots;
}
// Intermediate JSO format used in various scripts
// [ftNode] --> [{text:strText, nest:[<recursive>, , ], fold:bool}]
function textNest(lstNodes, oParent) {
var lstNest = [],
lstKeys, dctKeyVal,
dctNode, oNode, dctTags, strKey, k;
for (var i = 0, lng = lstNodes.length; i < lng; i++) {
oNode = lstNodes[i];
if (oNode.type() !== 'empty') {
dctNode = {
text: oNode.text(),
line: oNode.line(),
posn: oNode.lineTextStart(),
type: oNode.type(),
parent: oParent
};
dctTags = oNode.tags();
for (k in dctTags) { // ie only if object not empty
dctNode.tags = dctTags;
break; // one test only - no loop
}
if (oNode.hasChildren()) {
dctNode.fold = editor.isCollapsed(oNode);
dctNode.nest = textNest(oNode.children(), oNode);
}
lstNest.push(dctNode);
}
}
return lstNest;
}
// TRANSLATE A LIST OF {txt, chiln} NODES AND THEIR DESCENDANTS INTO UL
function ulTranslation(lstRoots) {
var lstUlHead = [
'<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">',
' <head>',
' <meta name="expandedItems" content="'
],
lstUlPostExpand = [
'" />',
' <meta charset="UTF-8" />',
' <style type="text/css">p { white-space: pre-wrap; }</style>',
' </head>',
' <body>',
' <ul id="FoldingText">\n'
],
lstUlTail = [
' </ul>',
' </body>',
'</html>'
],
strUlStart = '<ul>\n',
strUlClose = '</ul>\n',
strLiStart = '<li',
strLiClose = '</li>\n',
strPStart = '<p>',
strClose = '>\n',
strPClose = '</p>\n',
strLeafClose = '/>\n',
strParentClose = '>\n',
strHead = lstUlHead.join('\n'),
strTail = lstUlTail.join('\n'),
strOutline = '',
strUL, lstUL,
lngRoots = lstRoots.length,
i,
lstFolds = [],
iLine = 0;
// REWRITE TO RECURSE WITH CHILD RANGES RATHER THAN PARENTS - LESS RECURSION NEEDED
// WRITE OUT A LIST OF NODES AS ELEMENTS, WRAPPING ANY CHILDREN AS UL
// <li> contains a <p> and may contain a <ul> wrapping an <li> child sequence
function ulOutline(lstNest, strIndent, blnHidden) {
var strOut = '',
strDeeper = strIndent + ' ',
strChildIndent = strDeeper + ' ',
blnCollapsed = blnHidden,
blnFencing = false,
dctTags, lstChiln, dctNode, oChild,
strKey, strID, strTypePfx, strType, strText, strLang;
for (var i = 0, lng = lstNest.length; i < lng; i++) {
dctNode = lstNest[i];
// Locally unique identifier [A-Za-z0-9_]{8}
strID = localUID(8);
strOut = strOut + strIndent + strLiStart + ' id="' + strID + '"';
// Any CommonMark name of FT type of node
strType = cmName(dctNode.type);
if (strType)
strOut = strOut + ' data-type="' + strType + '"';
strTypePfx = strType.substring(0, 2);
if (blnFencing || strTypePfx === 'fe') {
if (strType.length > 10) {
strText = '';
blnFencing = (strType === 'fencedcodetopboundary');
if (blnFencing) {
strLang = dctNode.text.substring(3).trim();
if (strLang)
strOut = strOut + ' data-language="' + strLang + '"';
}
} else strText = entityEncoded(dctNode.line);
} else strText = mdHTML(dctNode.text);
// ANY FURTHER ATTRIBUTES OF THE LI
dctTags = dctNode.tags;
if (dctTags) {
for (strKey in dctTags) {
if (strKey !== 'language') { //??
strOut = strOut + ' data-' + strKey +
'=' + quoteAttr(dctTags[strKey]);
}
}
}
strOut = strOut + strParentClose + strDeeper +
strPStart + strText + strPClose;
// wrap any children in a <ul> before closing the <li>
lstChiln = dctNode.nest;
if (lstChiln) {
// Collect any ul ExpansionState id
if (!blnHidden && !dctNode.fold) lstFolds.push(strID);
else blnCollapsed = true;
iLine++; // before the recursive descent
// wrap child <li> sequence in <ul> ... </ul>
strOut = strOut +
strDeeper + strUlStart +
ulOutline(lstChiln, strChildIndent, blnCollapsed) +
strDeeper + strUlClose;
} else iLine++;
strOut = strOut + strIndent + strLiClose;
}
return strOut;
}
// WALK THROUGH THE TREE, BUILDING AN ul OUTLINE STRING
strOutline = ulOutline(lstRoots, ' ', false);
// ASSEMBLE THE HEADER,
// INCLUDING THE EXPANSION DIGITS COLLECTED DURING RECURSION
strHead = strHead + lstFolds.join(' ') + lstUlPostExpand.join('\n');
// AND COMBINE HEAD BODY AND TAIL
strUL = [strHead, strOutline, strTail].join('');
//strUl = strOutline;
return strUL;
}
// Letters at start of FT type names [for cmName()]
var C = 99,
E = 101,
F = 102,
H = 104,
L = 108,
N = 110,
O = 111,
R = 114;
// strFoldingTextTypeName --> strCommonMarkTypeName
function cmName(str) {
var iInit = str.charCodeAt(0),
iNext = str.charCodeAt(1),
strName = '';
if (iInit > H) {
if (iInit > O && (iNext === N)) strName = 'Bullet';
else if (iNext === R) strName = 'Ordered';
} else if (iInit < H) {
if (iInit === F && (iNext === E)) strName = 'CodeBlock';
else if (iInit < C) {
if (iNext === L) strName = 'BlockQuote';
else if (iNext === O) strName = 'Paragraph';
} else if (iInit === C) strName = 'CodeBlock';
} else {
if (iNext < O) strName = 'Header';
else if (iNext > O) strName = 'HtmlBlock';
else strName = 'HorizontalRule';
}
return strName;
}
// strMDLink.replace.match --> strOut
function fnLinkMD2HTML(match, p1, p2) {
return '<a href=' + quoteAttr(p2) + '>' + p1 + '</a>';
}
// strMDImg.replace.match --> strOut
function fnImgMD2HTML(match, p1, p2) {
return '<img alt=' + p1 + ' src=' + quoteAttr(p2) + '>';
}
// ** --> <b>; * --> <i>, ` --> <code>, []() --> <a> ![]() --> <img>
function mdHTML(strMD) {
if (strMD !== '```') {
return entityEncoded(
strMD.replace(
rgxBold, '<b>$1</b>'
).replace(
rgxItalic, '<i>$1</i>'
).replace(
rgxCode, '<code>$1</code>'
).replace(
rgxImage, fnImgMD2HTML
).replace(
rgxLink, fnLinkMD2HTML
)
);
} else return '';
}
// n --> strRandom (first alphabetic, then AlphaNumeric | '_'
function localUID(lngChars) {
var strAlphaSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
strOtherSet = "0123456789_",
strFullSet = strAlphaSet + strOtherSet,
lngFull = strFullSet.length,
str = strAlphaSet.charAt(Math.random() * strAlphaSet.length | 0),
lngRest = lngChars - 1;
while (lngRest--)
str = str + strFullSet.charAt(Math.random() * lngFull | 0);
return str;
}
// str --> str
function quoteAttr(s) {
return '"' + (('' + s) /* Forces the conversion to string. */
.replace(rgxAmp, '&') /* This MUST be the 1st replacement. */
.replace(rgxApos, ''') /* The 4 other predefined entities, required. */
.replace(rgxQuot, '"')
.replace(rgxLt, '<')
.replace(rgxGt, '>')) + '"';
}
// str --> str
function entityEncoded(str) {
return str.replace(/[\u00A0-\u9999<>\&]/gim, function (i) {
return '&#' + i.charCodeAt(0) + ';';
});
}
//////// FT MAIN
var lstRoots; //, lstTextTree; //, strHTML;
// EXPORT WHOLE DOC ? OR JUST THE SELECTED LINE(S) AND ALL ITS/THEIR DESCENDANTS ?
if (options.wholedoc)
lstRoots = editor.tree().evaluateNodePath('/@type!=empty');
else lstRoots = selectedRoots();
//lstTextTree = textNest(lstRoots);
// strHTML = ulTranslation(
// textNest(lstRoots), quoteAttr(options.title)
// );
return ulTranslation(
textNest(lstRoots)
);
};
//// run() FUNCTION(S)
function chooseOutPath(oApp, oDocPath, strExtn) {
var oFM = $.NSFileManager.defaultManager,
pathLocn = pOutFolder, //module default
pathOut = null,
strName = oFM.displayNameAtPath(oDocPath.toString()).js,
lstName = strName.split('.'),
lngName = lstName.length,
lstStem = lstName.slice(0, lngName - 1),
strStem = lstName[0];
if (!pathLocn || !oFM.fileExistsAtPathIsDirectory(pathLocn.toString(), null))
pathLocn = oDocPath;
// draft new name by substituting or affixing strExtn
if (1 < lngName) {
lstStem.push(strExtn);
strName = lstStem.join('.');
} else strName += '.' + strExtn;
// show file name dialog
oApp.activate();
pathOut = oApp.chooseFileName({
withPrompt: pTitle,
defaultName: strName,
defaultLocation: pathLocn
});
return [pathOut, strStem];
}
//////// run() MAIN
var appFT = new Application("FoldingText"),
app = Application.currentApplication(),
lstDocs = appFT.documents(),
oDoc = lstDocs.length ? lstDocs[0] : null,
fnProcess,
oPath,
strBaseName,
strFTPath, pathOML = null,
lstPathStem = [null, null],
pathul = null,
strUL,
nsul = null,
strUlPath = '',
strMsg = '';
app.includeStandardAdditions = true
if (oDoc) {
appFT.activate();
appFT.includeStandardAdditions = true;
fnProcess = (pblnDebug ? oDoc.debug : oDoc.evaluate);
strUL = fnProcess({
script: fnScript.toString(),
withOptions: {
wholedoc: pblnWholeDoc
}
});
if (strUL.indexOf('<!DOCTYPE html>' !== 1)) {
if (pblnToClipboard) {
app.activate();
app.setTheClipboardTo(strUL);
app.displayNotification(oDoc.name(), {
withTitle: "FoldingText to FTML",
subtitle: "Copied to clipboard as FTML (HTML <UL> nest)",
sound: "Glass"
});
}
if (pblnToFile) {
// PROMPT FOR AN EXPORT FILE PATH
oPath = oDoc.file();
if (oPath) {
lstPathStem = chooseOutPath(appFT, oPath, 'ftml');
pathul = lstPathStem[0];
if (pathul) {
strUlPath = pathul.toString();
nsul = $.NSString.alloc.initWithUTF8String(strUL);
nsul.writeToFileAtomicallyEncodingError(
strUlPath, false, $.NSUTF8StringEncoding, null);
}
} else strMsg =
"Save active file before exporting to FTML (HTML <UL>) outline ...";
}
} else strMsg = strUL;
} else strMsg = "No FoldingText documents open ...";
if (strMsg) {
var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.displayDialog(strMsg, {
withTitle: [pTitle, pVer].join('\t'),
buttons: ["OK"],
defaultButton: "OK"
});
return false;
}
return "Saved to " + strUlPath;
} |
Applications/Terminal/do script/do script.applescript | looking-for-a-job/applescript-examples | 1 | 476 | <reponame>looking-for-a-job/applescript-examples<filename>Applications/Terminal/do script/do script.applescript
tell application "Terminal"
#set newTab to do script # create a new window with no initial command
end tell
tell application "Terminal"
#set newTab to do script "ls"
end tell
tell application "Terminal"
activate
set t to do script with command "error command"
return get contents of (get properties of t)
end tell
#return get contents of (get properties of t) |
tests/bank_simple/5.asm | NullMember/customasm | 414 | 163103 | <filename>tests/bank_simple/5.asm
#ruledef test
{
loop => 0x5555 @ $`16
}
#bankdef a
{
#addr 0xaa00
#size 0x0010
#outp 8 * 0x0000
}
#bankdef b
{
#addr 0xbb00
#size 0x0010
#outp 8 * 0x0010
}
loop
loop
#bank a
loop
loop
#bank b
loop
loop
#bank a
loop
loop
; = 0x5555aa00
; = 0x5555aa04
; = 0x5555aa08
; = 0x5555aa0c
; = 0x5555bb00
; = 0x5555bb04
; = 0x5555bb08
; = 0x5555bb0c |
examples/factorial/factorial.pre.asm | enoua5/IOTA-C0 | 0 | 3259 | <gh_stars>0
#uses draft 3, which added pre and post processor
JMP &start_program
.var results[8]
.var n
.var tot
.lbl fact
#init factorial
MOV :tot 1
#start the body of the function
.lbl fact_body
#check if n is at or below 1
.var fact_reached_1
LOE :n 1 :fact_reached_1
#if it is, exit the function
.var fact_jump_loc
TNA :fact_reached_1 &fact_ret &fact_mult :fact_jump_loc
QJP :fact_jump_loc
#otherwise, tot=tot*(n--)
.lbl fact_mult
MUL :n :tot :tot
DEC :n :n
#recursion!
CAL &fact_body
#the exit
.lbl fact_ret
RET
.lbl start_program
#for i=1
.var i
MOV :i 1
.var for_loop
LBL :for_loop
#i<=8
.var end_of_array
LOE :i 8 :end_of_array
.var for_jump
TNA :end_of_array &continue_for &exit_for :for_jump
QJP :for_jump
.lbl continue_for
#get i factorial into tot
MOV :n :i
CAL &fact
#put it into results
.var addr
ADD :results :i :addr
DEC :addr :addr
ADR :addr :addr
SET :addr :tot
#i++
INC :i :i
QJP :for_loop
.lbl exit_for
.lbl exit_program
JMP &exit_program
|
oeis/000/A000056.asm | neoneye/loda-programs | 11 | 242624 | ; A000056: Order of the group SL(2,Z_n).
; Submitted by <NAME>
; 1,6,24,48,120,144,336,384,648,720,1320,1152,2184,2016,2880,3072,4896,3888,6840,5760,8064,7920,12144,9216,15000,13104,17496,16128,24360,17280,29760,24576,31680,29376,40320,31104,50616,41040,52416,46080,68880,48384,79464,63360,77760,72864,103776,73728,115248,90000,117504,104832,148824,104976,158400,129024,164160,146160,205320,138240,226920,178560,217728,196608,262080,190080,300696,235008,291456,241920,357840,248832,388944,303696,360000,328320,443520,314496,492960,368640,472392,413280,571704
mov $1,$0
add $0,1
seq $1,7434 ; Jordan function J_2(n) (a generalization of phi(n)).
mul $1,$0
mov $0,$1
|
programs/oeis/053/A053127.asm | neoneye/loda | 22 | 83252 | ; A053127: Binomial coefficients C(2*n-4,5).
; 6,56,252,792,2002,4368,8568,15504,26334,42504,65780,98280,142506,201376,278256,376992,501942,658008,850668,1086008,1370754,1712304,2118760,2598960,3162510,3819816,4582116,5461512,6471002,7624512,8936928,10424128,12103014,13991544,16108764,18474840,21111090,24040016,27285336,30872016,34826302,39175752,43949268,49177128,54891018,61124064,67910864,75287520,83291670,91962520,101340876,111469176,122391522,134153712,146803272,160389488,174963438,190578024,207288004,225150024,244222650,264566400,286243776,309319296,333859526,359933112,387610812,416965528,448072338,481008528,515853624,552689424,591600030,632671880,675993780,721656936,769754986,820384032,873642672,929632032,988455798,1050220248,1115034284,1183009464,1254260034,1328902960,1407057960,1488847536,1574397006,1663834536,1757291172,1854900872,1956800538,2063130048,2174032288,2289653184,2410141734,2535650040,2666333340,2802350040
mul $0,2
add $0,6
bin $0,5
|
software/hal/boards/components/MPU6000/mpu6000.ads | TUM-EI-RCS/StratoX | 12 | 8552 | <gh_stars>10-100
package MPU6000 with SPARK_Mode is
end MPU6000;
|
asm/bubble_sort.asm | kcotugno/ratio | 0 | 26606 | <reponame>kcotugno/ratio
;------------------------------------------------------------------------------
; Copyright (C) 2017 <NAME>
; All rights reserved
;
; Distributed under the terms of the MIT software license. See the
; accompanying LICENSE file or http://www.opensource.org/licenses/MIT.
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; This program uses Linux system calls and can therefore only be run there
;
; build: nasm -f elf64 asm/bubble_sort.asm
; link: ld asm/bubble_sort.o -o bubble_sort
;------------------------------------------------------------------------------
section .text
global _start
;-------------------------------------------------------------------------------
; _start: Program entry point
;-------------------------------------------------------------------------------
_start:
mov rax, 1 ; Print the initial question
mov rdi, 1
mov rsi, amount
mov rdx, amount.len
syscall
sub rsp, 0x100
mov rsi, rsp ; Allocate space to hold the user input
mov rax, 0 ; Recieve user input
mov rdi, 0
mov rdx, 0x100
syscall
dec rax ; Remove the new line
jz .end ; If there are no chars exit
mov rsi, rsp
mov rdx, rax
call atol ; Convert the input to an integer
mov r8, rax ; Move it so we can do some multiplication
mov rdx, 8
mul rdx
sub rsp, rax
push rax
push r8
mov rax, r8 ; Get the values to sort
mov rdi, rsp
add rdi, 16
call getelements
mov rax, 1 ; Print the unsorted array
mov rdi, 1
mov rsi, unsorted
mov rdx, unsorted.len
syscall
mov rax, [rsp] ; Convert the unsorted array to a string
mov rsi, rsp
add rsi, 16
sub rsp, 0x20
mov rdi, rsp
mov rdx, 0x20
call arrayltostr
mov byte [rsp+rax], 10 ; Add a new line
add rax, 1
mov rdx, rax ; Print the unsorted array
mov rax, 1
mov rdi, 1
mov rsi, rsp
syscall
add rsp, 0x20
mov rax, [rsp] ; Retreive the count
mov rsi, rsp
add rsi, 16
call bubblesort
mov rax, 1 ; Print the unsorted array
mov rdi, 1
mov rsi, sorted
mov rdx, sorted.len
syscall
pop rax ; Retreive the count
mov rsi, rsp ; Convert the sorted array to a string
add rsi, 8
sub rsp, 0x20
mov rdi, rsp
mov rdx, 0x20
call arrayltostr
mov byte [rsp+rax], 10 ; Add a new line
add rax, 1
mov rdx, rax ; Print the sorted array
mov rax, 1
mov rdi, 1
mov rsi, rsp
syscall
add rsp, 0x20
pop rax
add rsp, rax
.end:
add rsp, 0x100 ; Reset the stack
mov rax, 60 ; Exit
syscall
;-------------------------------------------------------------------------------
; end _start
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; bubblesort: Sort an array
;
; rax: The number of elements
; rsi: The elements
;-------------------------------------------------------------------------------
bubblesort:
mov r10, 8
mul r10 ; Get the number of elements times the size
mov rcx, rax
cmp rcx, 0
jle .end
.loop:
cmp rcx, 0 ; Check if we're done
jl .end
push rcx
push rax
sub rax, rcx ; Don't check already sorted elements
sub rax, 8
.loop2:
cmp rax, 8
jl .el2
mov r10, rsi ; Get a copy of the pointer
add r10, rax ; And set it to the current index
sub rax, 8 ; Move to the next element
mov r8, [r10] ; Copy the current values
mov r9, [r10-8]
cmp r8, r9 ; Check if the switch should be made
jg .loop2
mov [r10], r9 ; Switch
mov [r10-8], r8
jmp .loop2
.el2:
pop rax
pop rcx
sub rcx, 8 ; Next
jmp .loop
.end:
ret
;-------------------------------------------------------------------------------
; end bubblesort
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; getelements: Get the element for the sorting
;
; rax: The number of elements for which to ask
; rdi: The array to hold them in.
;-------------------------------------------------------------------------------
getelements:
sub rsp, 0x20 ; A place for the message
xor r9, r9
.loop:
cmp rax, 0
jz .end
dec rax
inc r9
push rax
push r9
push rdi
mov rax, 1
mov rdi, 1
mov rsi, element
mov rdx, element.len
syscall
mov rax, [rsp+8] ; Get the element number for the message
mov rdi, rsp
add rdi, 24
mov rdx, 0x20
call ltostr
mov r9, rsp ; Get the base address to add the colon
add r9, 24
add r9, rax ; Add the current number of chars
mov byte [r9], 58
mov byte [r9+1], 32
mov rdx, rax ; Set the length for printing
add rdx, 2
mov rax, 1 ; Print the number
mov rdi, 1
mov rsi, rsp
add rsi, 24
syscall
mov rax, 0 ; Get an element
mov rdi, 0
mov rsi, rsp
add rsi, 24
mov rdx, 0x20
syscall
dec rax
jz .end
mov rsi, rsp ; Convert it to a long
add rsi, 24
mov rdx, rax
call atol
pop rdi
mov [rdi], rax ; Add long to the array
add rdi, 8
pop r9
pop rax
jmp .loop
.end:
add rsp, 0x20
ret
;-------------------------------------------------------------------------------
; end getelements
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; arrayltostr: Array of longs to string
;
; rax: Number of elements
; rsi: Pointer to bottom of array
; rdi: Pointer to buttom of destination
; rdx: Max size of destination
;
; rax: Number of chars
;-------------------------------------------------------------------------------
arrayltostr:
mov rcx, rax
xor r9, r9
cmp rdx, 2
jl .end
mov byte [rdi], 91 ; Add an opening bracket
inc r9
inc rdi
.loop:
push rcx
push rdi
push rdx
push rsi
push r9
mov rax, [rsi] ; Convert the long
call ltostr
pop r9 ; Increase the char count
add r9, rax
pop rsi
add rsi, 8
pop rdx
sub rdx, rax ; Less room in the buffer
pop rdi
add rdi, rax ; Move up the destination
pop rcx
dec rcx ; Transverse the array
jz .end
mov byte [rdi], 44 ; Add the comma and space
mov byte [rdi+1], 32
add r9, 2 ; Increase the counts by 2
sub rdx, 2
add rdi, 2
jmp .loop
.end:
mov byte [rdi], 93 ; Add a closing bracket
add r9, 1
mov rax, r9
ret
;-------------------------------------------------------------------------------
; end arrayltostr
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; atol: String to long
;
; rax: The number of chars in the buffer
; rsi: Pointer to the buffer
;
; rax: The long from the string
;-------------------------------------------------------------------------------
atol:
mov rcx, rdx
xor rax, rax
.tolloop:
push rcx
push rax
mov rax, 1
.dec: ; Set the tenths place
dec rcx
jz .conv ; If there's only one char skip
mov rdx, 10
mul rdx
jmp .dec
.conv: ; Convert the input
xor rdx, rdx
mov dl, byte [rsi]
sub rdx, 48
mul rdx
pop rdx
add rax, rdx
add rsi, 1 ; Move to the next element
pop rcx
dec rcx
jne .tolloop
ret
;-------------------------------------------------------------------------------
; end atol
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; ltostr: Long to string
;
; rax: The long to convert
; rdi: Buffer to hold the chars
; rdx: The size of the buffer
;
; rax: Number of chars
;-------------------------------------------------------------------------------
ltostr:
push rdi
mov r8, 10
xor r9, r9 ; Hold the char count
.tostrloop:
push rdx
inc r9 ; Increment the char count
xor rdx, rdx ; Don't accidently make the number bigger
div r8 ; rax always has the dividend
add rdx, 48 ; Add 48 to the remainder
mov [rdi], dl
inc rdi
pop rdx ; Stop if we've hit the top of the buffer
cmp r9, rdx
je .end
cmp rax, 0
jnz .tostrloop
.end:
pop rdi
push r9
mov rdx, r9
call flip ; Flip the bytes
pop rax
ret
;-------------------------------------------------------------------------------
; end ltostr
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; flip: Flip a given number of bytes
;
; rdi: Bottom of bytes to flip
; rdx: Number of bytes
;-------------------------------------------------------------------------------
flip:
mov rsi, rdi ; Copy the stack pointer
add rsi, rdx ; Set the copy to the top
dec rsi ; We're one too high
.loop:
cmp rdx, 2 ; See if we're done
jl .end
mov byte r8b, [rdi] ; Flip the bytes!
mov byte r9b, [rsi]
mov byte [rsi], r8b
mov byte [rdi], r9b
inc rdi ; Increment the bottom buffer pointer
dec rsi ; Recrement the top buffer pointer
sub rdx, 2 ; Subtract the count
jmp .loop
.end:
ret
;-------------------------------------------------------------------------------
; end flip
;-------------------------------------------------------------------------------
section .data
amount db 'How many elements? ', 0
.len equ $-amount
element db 'Enter element ', 0
.len equ $-element
unsorted db 'Unsorted: '
.len equ $-unsorted
sorted db 'Sorted: '
.len equ $-sorted
|
programs/oeis/131/A131026.asm | neoneye/loda | 22 | 103941 | ; A131026: Periodic sequence (2, 2, 1, 0, 0, 1).
; 2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0
sub $0,728
dif $0,2
gcd $0,$0
add $0,1
mod $0,3
|
server-core/src/main/java/io/onedev/server/search/buildmetric/BuildMetricQuery.g4 | sasaie/onedev | 7,137 | 4439 | grammar BuildMetricQuery;
query
: WS* criteria WS* EOF
;
criteria
: operator=(BuildIsSuccessful|BuildIsFailed) #OperatorCriteria
| criteriaField=Quoted WS+ operator=IsEmpty #FieldOperatorCriteria
| operator=(Since|Until) WS+ criteriaValue=Quoted #OperatorValueCriteria
| criteriaField=Quoted WS+ operator=Is WS+ criteriaValue=Quoted #FieldOperatorValueCriteria
| criteria WS+ And WS+ criteria #AndCriteria
| criteria WS+ Or WS+ criteria #OrCriteria
| Not WS* LParens WS* criteria WS* RParens #NotCriteria
| LParens WS* criteria WS* RParens #ParensCriteria
;
BuildIsSuccessful
: 'build' WS+ 'is' WS+ 'successful'
;
BuildIsFailed
: 'build' WS+ 'is' WS+ 'failed'
;
Is
: 'is'
;
IsEmpty
: 'is' WS+ 'empty'
;
Since
: 'since'
;
Until
: 'until'
;
And
: 'and'
;
Or
: 'or'
;
Not
: 'not'
;
LParens
: '('
;
RParens
: ')'
;
Quoted
: '"' ('\\'.|~[\\"])+? '"'
;
WS
: ' '
;
Identifier
: [a-zA-Z0-9:_/\\+\-;]+
;
|
oeis/173/A173997.asm | neoneye/loda-programs | 11 | 11672 | <reponame>neoneye/loda-programs<filename>oeis/173/A173997.asm
; A173997: Irregular triangular by columns derived from (1, 2, 3,...) * (1, 2, 3,...).
; Submitted by <NAME>
; 1,2,3,2,4,4,5,6,3,6,8,6,7,10,9,4,8,12,12,8,9,14,15,12,5,10,16,18,16,10,11,18,21,20,15,6,12,20,24,24,20,12
lpb $0
add $1,$2
sub $0,$1
cmp $2,0
sub $0,$2
lpe
add $0,1
mul $1,2
add $2,2
sub $2,$0
add $1,$2
add $1,1
sub $1,$0
mul $0,$1
|
LibraBFT/Concrete/Properties/LockedRound.agda | lisandrasilva/bft-consensus-agda-1 | 0 | 2917 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import Optics.All
open import LibraBFT.Prelude
open import LibraBFT.Hash
open import LibraBFT.Lemmas
open import LibraBFT.Base.KVMap
open import LibraBFT.Base.PKCS
open import LibraBFT.Abstract.Types
open EpochConfig
open import LibraBFT.Impl.NetworkMsg
open import LibraBFT.Impl.Consensus.Types
open import LibraBFT.Impl.Util.Crypto
open import LibraBFT.Impl.Handle sha256 sha256-cr
open import LibraBFT.Concrete.System.Parameters
open import LibraBFT.Yasm.Base
open import LibraBFT.Yasm.AvailableEpochs using (AvailableEpochs ; lookup'; lookup'')
open import LibraBFT.Yasm.System ConcSysParms
open import LibraBFT.Yasm.Properties ConcSysParms
-- This module contains placeholders for the future analog of the
-- corresponding VotesOnce property. Defining the implementation
-- obligation and proving that it is an invariant of an implementation
-- is a substantial undertaking. We are working first on proving the
-- simpler VotesOnce property to settle down the structural aspects
-- before tackling the harder semantic issues.
module LibraBFT.Concrete.Properties.LockedRound where
-- TODO-3: define the implementation obligation
ImplObligation₁ : Set
ImplObligation₁ = Unit
-- Next, we prove that given the necessary obligations,
module Proof
(sps-corr : StepPeerState-AllValidParts)
(Impl-LR1 : ImplObligation₁)
where
-- Any reachable state satisfies the LR rule for any epoch in the system.
module _ {e}(st : SystemState e)(r : ReachableSystemState st)(eid : Fin e) where
-- Bring in 'unwind', 'ext-unforgeability' and friends
open Structural sps-corr
-- Bring in ConcSystemState
open import LibraBFT.Concrete.System sps-corr
open PerState st r
open PerEpoch eid
open import LibraBFT.Abstract.Obligations.LockedRound 𝓔 Hash _≟Hash_ (ConcreteVoteEvidence 𝓔) as LR
postulate -- TODO-3: prove it
lrr : LR.Type ConcSystemState
|
hmi_sdk/hmi_sdk/Tools/ffmpeg-2.6.2/libavfilter/x86/vf_yadif.asm | APCVSRepo/android_packet | 4 | 93185 | <filename>hmi_sdk/hmi_sdk/Tools/ffmpeg-2.6.2/libavfilter/x86/vf_yadif.asm
;*****************************************************************************
;* x86-optimized functions for yadif filter
;*
;* Copyright (C) 2006 <NAME> <<EMAIL>>
;* Copyright (c) 2013 <NAME> <<EMAIL>>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
pb_1: times 16 db 1
pw_1: times 8 dw 1
SECTION .text
%macro CHECK 2
movu m2, [curq+t1+%1]
movu m3, [curq+t0+%2]
mova m4, m2
mova m5, m2
pxor m4, m3
pavgb m5, m3
pand m4, [pb_1]
psubusb m5, m4
RSHIFT m5, 1
punpcklbw m5, m7
mova m4, m2
psubusb m2, m3
psubusb m3, m4
pmaxub m2, m3
mova m3, m2
mova m4, m2
RSHIFT m3, 1
RSHIFT m4, 2
punpcklbw m2, m7
punpcklbw m3, m7
punpcklbw m4, m7
paddw m2, m3
paddw m2, m4
%endmacro
%macro CHECK1 0
mova m3, m0
pcmpgtw m3, m2
pminsw m0, m2
mova m6, m3
pand m5, m3
pandn m3, m1
por m3, m5
mova m1, m3
%endmacro
%macro CHECK2 0
paddw m6, [pw_1]
psllw m6, 14
paddsw m2, m6
mova m3, m0
pcmpgtw m3, m2
pminsw m0, m2
pand m5, m3
pandn m3, m1
por m3, m5
mova m1, m3
%endmacro
%macro LOAD 2
movh %1, %2
punpcklbw %1, m7
%endmacro
%macro FILTER 3
.loop%1:
pxor m7, m7
LOAD m0, [curq+t1]
LOAD m1, [curq+t0]
LOAD m2, [%2]
LOAD m3, [%3]
mova m4, m3
paddw m3, m2
psraw m3, 1
mova [rsp+ 0], m0
mova [rsp+16], m3
mova [rsp+32], m1
psubw m2, m4
ABS1 m2, m4
LOAD m3, [prevq+t1]
LOAD m4, [prevq+t0]
psubw m3, m0
psubw m4, m1
ABS1 m3, m5
ABS1 m4, m5
paddw m3, m4
psrlw m2, 1
psrlw m3, 1
pmaxsw m2, m3
LOAD m3, [nextq+t1]
LOAD m4, [nextq+t0]
psubw m3, m0
psubw m4, m1
ABS1 m3, m5
ABS1 m4, m5
paddw m3, m4
psrlw m3, 1
pmaxsw m2, m3
mova [rsp+48], m2
paddw m1, m0
paddw m0, m0
psubw m0, m1
psrlw m1, 1
ABS1 m0, m2
movu m2, [curq+t1-1]
movu m3, [curq+t0-1]
mova m4, m2
psubusb m2, m3
psubusb m3, m4
pmaxub m2, m3
%if mmsize == 16
mova m3, m2
psrldq m3, 2
%else
pshufw m3, m2, q0021
%endif
punpcklbw m2, m7
punpcklbw m3, m7
paddw m0, m2
paddw m0, m3
psubw m0, [pw_1]
CHECK -2, 0
CHECK1
CHECK -3, 1
CHECK2
CHECK 0, -2
CHECK1
CHECK 1, -3
CHECK2
mova m6, [rsp+48]
cmp DWORD r8m, 2
jge .end%1
LOAD m2, [%2+t1*2]
LOAD m4, [%3+t1*2]
LOAD m3, [%2+t0*2]
LOAD m5, [%3+t0*2]
paddw m2, m4
paddw m3, m5
psrlw m2, 1
psrlw m3, 1
mova m4, [rsp+ 0]
mova m5, [rsp+16]
mova m7, [rsp+32]
psubw m2, m4
psubw m3, m7
mova m0, m5
psubw m5, m4
psubw m0, m7
mova m4, m2
pminsw m2, m3
pmaxsw m3, m4
pmaxsw m2, m5
pminsw m3, m5
pmaxsw m2, m0
pminsw m3, m0
pxor m4, m4
pmaxsw m6, m3
psubw m4, m2
pmaxsw m6, m4
.end%1:
mova m2, [rsp+16]
mova m3, m2
psubw m2, m6
paddw m3, m6
pmaxsw m1, m2
pminsw m1, m3
packuswb m1, m1
movh [dstq], m1
add dstq, mmsize/2
add prevq, mmsize/2
add curq, mmsize/2
add nextq, mmsize/2
sub DWORD r4m, mmsize/2
jg .loop%1
%endmacro
%macro YADIF 0
%if ARCH_X86_32
cglobal yadif_filter_line, 4, 6, 8, 80, dst, prev, cur, next, w, prefs, \
mrefs, parity, mode
%else
cglobal yadif_filter_line, 4, 7, 8, 80, dst, prev, cur, next, w, prefs, \
mrefs, parity, mode
%endif
%if ARCH_X86_32
mov r4, r5mp
mov r5, r6mp
DECLARE_REG_TMP 4,5
%else
movsxd r5, DWORD r5m
movsxd r6, DWORD r6m
DECLARE_REG_TMP 5,6
%endif
cmp DWORD paritym, 0
je .parity0
FILTER 1, prevq, curq
jmp .ret
.parity0:
FILTER 0, curq, nextq
.ret:
RET
%endmacro
INIT_XMM ssse3
YADIF
INIT_XMM sse2
YADIF
%if ARCH_X86_32
INIT_MMX mmxext
YADIF
%endif
|
src/split_string.ads | reinertk/cpros | 1 | 14422 | --------------------------------------------------------------------------------------
--
-- Copyright (c) 2016 <NAME>
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
--
-- NB: this is the MIT License, as found 2016-09-27 on the site
-- http://www.opensource.org/licenses/mit-license.php
--------------------------------------------------------------------------------------
-- Change log:
--
--------------------------------------------------------------------------------------
with Ada.Characters.Latin_1;
package split_string is
command_white_space1 : constant String := " ,|" & Ada.Characters.Latin_1.HT;
-- command_single1 : constant String := "&";
function number_of_words
(fs : String;
ws : String := command_white_space1) return Natural;
function word
(fs : in String;
word_number : Natural;
ws : String := command_white_space1) return String;
function last_word
(fs : String;
ws : String := command_white_space1) return String;
function first_word
(fs : String;
ws : String := command_white_space1) return String;
function collect1
(fs : String;
from_word_number : Natural;
ws : String := command_white_space1) return String;
function remove_comment1 (fs : String; cc : String := "#") return String;
function expand1 (fs : String; singles : String) return String;
end split_string;
|
alloy4fun_models/trashltl/models/5/7Cra2HnK7RiLwnRwz.als | Kaixi26/org.alloytools.alloy | 0 | 2501 | open main
pred id7Cra2HnK7RiLwnRwz_prop6 {
all f:File | f in Trash implies always (f in Trash)
}
pred __repair { id7Cra2HnK7RiLwnRwz_prop6 }
check __repair { id7Cra2HnK7RiLwnRwz_prop6 <=> prop6o } |
src/extraction-source_files_from_projects.ads | TNO/Dependency_Graph_Extractor-Ada | 1 | 12019 | <gh_stars>1-10
with Extraction.Graph_Operations;
with Extraction.Utilities;
private package Extraction.Source_Files_From_Projects is
procedure Extract_Nodes
(Project : GPR.Project_Type;
Graph : Graph_Operations.Graph_Context);
procedure Extract_Edges
(Project : GPR.Project_Type;
Context : Utilities.Project_Context;
Recurse_Projects : Boolean;
Graph : Graph_Operations.Graph_Context);
end Extraction.Source_Files_From_Projects;
|
oeis/111/A111394.asm | neoneye/loda-programs | 11 | 244170 | <reponame>neoneye/loda-programs
; A111394: a(n) = product of first n integers not divisible by 3.
; Submitted by <NAME>
; 1,2,8,40,280,2240,22400,246400,3203200,44844800,717516800,12197785600,231757926400,4635158528000,101973487616000,2345390215168000,58634755379200000,1524503639859200000,42686101916057600000,1237896955565670400000,38374805622535782400000,1227993779921145036800000,41751788517318931251200000,1461312598106162593792000000,54068566129928015970304000000,2054605512937264606871552000000,82184220517490584274862080000000,3369553041217113955269345280000000,144890780772335900076581847040000000
mov $1,1
lpb $0
mov $2,$0
sub $0,1
mul $2,3
div $2,2
mul $2,$1
add $1,$2
lpe
mov $0,$1
|
.emacs.d/elpa/wisi-3.0.1/gen_run_wisi_lr_text_rep_parse.adb | caqg/linux-home | 0 | 26785 | <filename>.emacs.d/elpa/wisi-3.0.1/gen_run_wisi_lr_text_rep_parse.adb
-- Abstract :
--
-- See spec.
--
-- Copyright (C) 2017 - 2019 All Rights Reserved.
--
-- This program is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file COPYING. If not, write to
-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
-- MA 02110-1335, USA.
pragma License (GPL);
with Ada.Command_Line;
with Ada.Directories;
with Run_Wisi_Common_Parse;
with WisiToken.Text_IO_Trace;
procedure Gen_Run_Wisi_LR_Text_Rep_Parse
is
Trace : aliased WisiToken.Text_IO_Trace.Trace (Descriptor'Unrestricted_Access);
Parser : WisiToken.Parse.LR.Parser.Parser;
Parse_Data : aliased Parse_Data_Type (Parser.Line_Begin_Token'Access);
begin
-- Create parser first so Put_Usage has defaults from Parser.Table,
-- and Get_CL_Params can override them.
declare
use Ada.Command_Line;
begin
-- text_rep file is in same directory as exectuable.
Create_Parser
(Parser, Language_Fixes, Language_Matching_Begin_Tokens, Language_String_ID_Set,
Trace'Unrestricted_Access, Parse_Data'Unchecked_Access,
Ada.Directories.Containing_Directory (Command_Name) & "/" & Text_Rep_File_Name);
Run_Wisi_Common_Parse.Parse_File (Parser, Parse_Data, Descriptor);
end;
end Gen_Run_Wisi_LR_Text_Rep_Parse;
|
programs/oeis/135/A135908.asm | karttu/loda | 0 | 246257 | <reponame>karttu/loda
; A135908: Clique number of commuting graph of symmetric group S_n.
; 0,0,0,2,3,5,8,11,17,26,35,53,80,107,161,242,323,485,728,971,1457,2186,2915,4373,6560,8747,13121,19682,26243,39365,59048,78731,118097,177146,236195,354293,531440,708587,1062881,1594322,2125763,3188645,4782968,6377291,9565937
lpb $0,1
sub $0,1
mov $3,$0
pow $3,4
lpb $3,1
mov $0,$3
mov $3,$2
lpe
lpe
cal $0,792 ; a(n) = max{(n - i)*a(i) : i < n}; a(0) = 1.
mov $1,$0
sub $1,1
|
awa/plugins/awa-mail/src/awa-mail-components-factory.adb | My-Colaborations/ada-awa | 81 | 19480 | <filename>awa/plugins/awa-mail/src/awa-mail-components-factory.adb
-----------------------------------------------------------------------
-- awa-mail-components-factory -- Mail UI Component Factory
-- Copyright (C) 2012, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Views.Nodes;
with ASF.Components.Base;
with AWA.Mail.Modules;
with AWA.Mail.Components.Messages;
with AWA.Mail.Components.Recipients;
with AWA.Mail.Components.Attachments;
package body AWA.Mail.Components.Factory is
use ASF.Components.Base;
use ASF.Views.Nodes;
function Create_Bcc return UIComponent_Access;
function Create_Body return UIComponent_Access;
function Create_Cc return UIComponent_Access;
function Create_From return UIComponent_Access;
function Create_Message return UIComponent_Access;
function Create_To return UIComponent_Access;
function Create_Subject return UIComponent_Access;
function Create_Attachment return UIComponent_Access;
URI : aliased constant String := "http://code.google.com/p/ada-awa/mail";
BCC_TAG : aliased constant String := "bcc";
BODY_TAG : aliased constant String := "body";
CC_TAG : aliased constant String := "cc";
FROM_TAG : aliased constant String := "from";
MESSAGE_TAG : aliased constant String := "message";
SUBJECT_TAG : aliased constant String := "subject";
TO_TAG : aliased constant String := "to";
ATTACHMENT_TAG : aliased constant String := "attachment";
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_Bcc return UIComponent_Access is
Result : constant Recipients.UIMailRecipient_Access := new Recipients.UIMailRecipient;
begin
Result.Set_Recipient (AWA.Mail.Clients.BCC);
return Result.all'Access;
end Create_Bcc;
-- ------------------------------
-- Create an UIMailBody component
-- ------------------------------
function Create_Body return UIComponent_Access is
begin
return new Messages.UIMailBody;
end Create_Body;
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_Cc return UIComponent_Access is
Result : constant Recipients.UIMailRecipient_Access := new Recipients.UIMailRecipient;
begin
Result.Set_Recipient (AWA.Mail.Clients.CC);
return Result.all'Access;
end Create_Cc;
-- ------------------------------
-- Create an UISender component
-- ------------------------------
function Create_From return UIComponent_Access is
begin
return new Recipients.UISender;
end Create_From;
-- ------------------------------
-- Create an UIMailMessage component
-- ------------------------------
function Create_Message return UIComponent_Access is
use type AWA.Mail.Modules.Mail_Module_Access;
Result : constant Messages.UIMailMessage_Access := new Messages.UIMailMessage;
Module : constant AWA.Mail.Modules.Mail_Module_Access := AWA.Mail.Modules.Get_Mail_Module;
begin
if Module = null then
return null;
end if;
Result.Set_Message (Module.Create_Message);
return Result.all'Access;
end Create_Message;
-- ------------------------------
-- Create an UIMailSubject component
-- ------------------------------
function Create_Subject return UIComponent_Access is
begin
return new Messages.UIMailSubject;
end Create_Subject;
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_To return UIComponent_Access is
begin
return new Recipients.UIMailRecipient;
end Create_To;
-- ------------------------------
-- Create an UIMailAttachment component
-- ------------------------------
function Create_Attachment return UIComponent_Access is
begin
return new Attachments.UIMailAttachment;
end Create_Attachment;
Bindings : aliased constant ASF.Factory.Binding_Array
:= (1 => (Name => ATTACHMENT_TAG'Access,
Component => Create_Attachment'Access,
Tag => Create_Component_Node'Access),
2 => (Name => BCC_TAG'Access,
Component => Create_Bcc'Access,
Tag => Create_Component_Node'Access),
3 => (Name => BODY_TAG'Access,
Component => Create_Body'Access,
Tag => Create_Component_Node'Access),
4 => (Name => CC_TAG'Access,
Component => Create_Cc'Access,
Tag => Create_Component_Node'Access),
5 => (Name => FROM_TAG'Access,
Component => Create_From'Access,
Tag => Create_Component_Node'Access),
6 => (Name => MESSAGE_TAG'Access,
Component => Create_Message'Access,
Tag => Create_Component_Node'Access),
7 => (Name => SUBJECT_TAG'Access,
Component => Create_Subject'Access,
Tag => Create_Component_Node'Access),
8 => (Name => TO_TAG'Access,
Component => Create_To'Access,
Tag => Create_Component_Node'Access)
);
Mail_Factory : aliased constant ASF.Factory.Factory_Bindings
:= (URI => URI'Access, Bindings => Bindings'Access);
-- ------------------------------
-- Get the AWA Mail component factory.
-- ------------------------------
function Definition return ASF.Factory.Factory_Bindings_Access is
begin
return Mail_Factory'Access;
end Definition;
end AWA.Mail.Components.Factory;
|
Sample/Cpu/Pentium/CpuIo/RuntimeDxe/x64/CpuIoAccess.asm | bitcrystal/edk | 14 | 161301 | title CpuIoAccess.asm
;------------------------------------------------------------------------------
;*
;* Copyright (c) 2005 - 2007, Intel Corporation
;* All rights reserved. This program and the accompanying materials
;* are licensed and made available under the terms and conditions of the BSD License
;* which accompanies this distribution. The full text of the license may be found at
;* http://opensource.org/licenses/bsd-license.php
;*
;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;*
;* Module Name:
;* CpuIoAccess.asm
;*
;* Abstract:
;* Supports x64 CPU IO operation
;*
;------------------------------------------------------------------------------
;
;
;
; Abstract:
;
;
;------------------------------------------------------------------------------
.CODE
;------------------------------------------------------------------------------
; UINT8
; CpuIoRead8 (
; UINT16 Port // rcx
; )
;------------------------------------------------------------------------------
CpuIoRead8 PROC PUBLIC
xor eax, eax
mov dx, cx
in al, dx
ret
CpuIoRead8 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite8 (
; UINT16 Port, // rcx
; UINT32 Data // rdx
; )
;------------------------------------------------------------------------------
CpuIoWrite8 PROC PUBLIC
mov eax, edx
mov dx, cx
out dx, al
ret
CpuIoWrite8 ENDP
;------------------------------------------------------------------------------
; UINT16
; CpuIoRead16 (
; UINT16 Port // rcx
; )
;------------------------------------------------------------------------------
CpuIoRead16 PROC PUBLIC
xor eax, eax
mov dx, cx
in ax, dx
ret
CpuIoRead16 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite16 (
; UINT16 Port, // rcx
; UINT32 Data // rdx
; )
;------------------------------------------------------------------------------
CpuIoWrite16 PROC PUBLIC
mov eax, edx
mov dx, cx
out dx, ax
ret
CpuIoWrite16 ENDP
;------------------------------------------------------------------------------
; UINT32
; CpuIoRead32 (
; UINT16 Port // rcx
; )
;------------------------------------------------------------------------------
CpuIoRead32 PROC PUBLIC
mov dx, cx
in eax, dx
ret
CpuIoRead32 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite32 (
; UINT16 Port, // rcx
; UINT32 Data // rdx
; )
;------------------------------------------------------------------------------
CpuIoWrite32 PROC PUBLIC
mov eax, edx
mov dx, cx
out dx, eax
ret
CpuIoWrite32 ENDP
END
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w62.asm | prismotizm/gigaleak | 0 | 93050 | Name: ys_w62.asm
Type: file
Size: 14343
Last-Modified: '2016-05-13T04:51:16Z'
SHA-1: D2CF80AA4F0C13B0B64A78D6B47930644928576E
Description: null
|
src/wiki-utils.adb | jquorning/ada-wiki | 18 | 21155 | -----------------------------------------------------------------------
-- wiki-utils -- Wiki utility operations
-- Copyright (C) 2015, 2016, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Parsers;
with Wiki.Render.Text;
with Wiki.Render.Html;
with Wiki.Filters.Html;
with Wiki.Filters.TOC;
with Wiki.Streams.Builders;
with Wiki.Streams.Html.Builders;
with Wiki.Documents;
package body Wiki.Utils is
-- ------------------------------
-- Render the wiki text according to the wiki syntax in HTML into a string.
-- ------------------------------
function To_Html (Text : in Wiki.Strings.WString;
Syntax : in Wiki.Wiki_Syntax) return String is
Stream : aliased Wiki.Streams.Html.Builders.Html_Output_Stream;
Renderer : aliased Wiki.Render.Html.Html_Renderer;
Doc : Wiki.Documents.Document;
Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
TOC : aliased Wiki.Filters.TOC.TOC_Filter;
Engine : Wiki.Parsers.Parser;
begin
Renderer.Set_Output_Stream (Stream'Unchecked_Access);
Renderer.Set_Render_TOC (True);
Engine.Add_Filter (TOC'Unchecked_Access);
Engine.Add_Filter (Filter'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Text, Doc);
Renderer.Render (Doc);
return Stream.To_String;
end To_Html;
-- ------------------------------
-- Render the wiki text according to the wiki syntax in text into a string.
-- Wiki formatting and decoration are removed.
-- ------------------------------
function To_Text (Text : in Wiki.Strings.WString;
Syntax : in Wiki.Wiki_Syntax) return String is
Stream : aliased Wiki.Streams.Builders.Output_Builder_Stream;
Doc : Wiki.Documents.Document;
Renderer : aliased Wiki.Render.Text.Text_Renderer;
Engine : Wiki.Parsers.Parser;
begin
Renderer.Set_Output_Stream (Stream'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Text, Doc);
Renderer.Render (Doc);
return Stream.To_String;
end To_Text;
end Wiki.Utils;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.