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 |
|---|---|---|---|---|
first.asm | jacmba/nerdy-nights | 0 | 87098 | .inesprg 1
.ineschr 1
.inesmap 0
.inesmir 1
.bank 0
.org $8000
RESET:
sei
cld
lda #%10000000
sta $2001
FOREVER:
jmp FOREVER
.bank 1
.org $FFFA
.dw 0, RESET, 0
|
deBruijn/Substitution/Function/Simple.agda | nad/dependently-typed-syntax | 5 | 6789 | ------------------------------------------------------------------------
-- Some simple substitution combinators
------------------------------------------------------------------------
-- Given a term type which supports weakening and transformation of
-- variables to terms various substitutions are defined and various
-- lemmas proved.
open import Data.Universe.Indexed
module deBruijn.Substitution.Function.Simple
{i u e} {Uni : IndexedUniverse i u e} where
import deBruijn.Context; open deBruijn.Context Uni
open import deBruijn.Substitution.Function.Basics
open import deBruijn.Substitution.Function.Map
open import Function as F using (_$_)
open import Level using (_⊔_)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open P.≡-Reasoning
-- Simple substitutions.
record Simple {t} (T : Term-like t) : Set (i ⊔ u ⊔ e ⊔ t) where
open Term-like T
field
-- Weakens terms.
weaken : ∀ {Γ} {σ : Type Γ} → [ T ⟶ T ] ŵk[ σ ]
-- A synonym.
weaken[_] : ∀ {Γ} (σ : Type Γ) → [ T ⟶ T ] ŵk[ σ ]
weaken[_] _ = weaken
field
-- Takes variables to terms.
var : [ Var ⟶⁼ T ]
-- A property relating weaken and var.
weaken-var : ∀ {Γ σ τ} (x : Γ ∋ τ) →
weaken[ σ ] · (var · x) ≅-⊢ var · suc[ σ ] x
-- Weakens substitutions.
wk-subst : ∀ {Γ Δ σ} {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → Sub T (ρ̂ ∘̂ ŵk[ σ ])
wk-subst ρ = map weaken ρ
wk-subst[_] : ∀ {Γ Δ} σ {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → Sub T (ρ̂ ∘̂ ŵk[ σ ])
wk-subst[ _ ] = wk-subst
-- N-ary weakening of substitutions.
wk-subst⁺ : ∀ {Γ Δ} Δ⁺ {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → Sub T (ρ̂ ∘̂ ŵk⁺ Δ⁺)
wk-subst⁺ ε ρ = ρ
wk-subst⁺ (Δ⁺ ▻ σ) ρ = wk-subst (wk-subst⁺ Δ⁺ ρ)
wk-subst₊ : ∀ {Γ Δ} Δ₊ {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → Sub T (ρ̂ ∘̂ ŵk₊ Δ₊)
wk-subst₊ ε ρ = ρ
wk-subst₊ (σ ◅ Δ₊) ρ = wk-subst₊ Δ₊ (wk-subst ρ)
-- Lifting.
infixl 10 _↑_
infix 10 _↑
_↑_ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → ∀ σ → Sub T (ρ̂ ↑̂ σ)
ρ ↑ _ =
P.subst (Sub T)
(≅-⇨̂-⇒-≡ $ ▻̂-cong P.refl P.refl
(P.sym $ corresponds var zero))
(wk-subst ρ ▻⇨ var · zero)
_↑ : ∀ {Γ Δ σ} {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → Sub T (ρ̂ ↑̂ σ)
ρ ↑ = ρ ↑ _
-- N-ary lifting.
infixl 10 _↑⁺_ _↑₊_
_↑⁺_ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → ∀ Γ⁺ → Sub T (ρ̂ ↑̂⁺ Γ⁺)
ρ ↑⁺ ε = ρ
ρ ↑⁺ (Γ⁺ ▻ σ) = (ρ ↑⁺ Γ⁺) ↑
_↑₊_ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} → Sub T ρ̂ → ∀ Γ₊ → Sub T (ρ̂ ↑̂₊ Γ₊)
ρ ↑₊ ε = ρ
ρ ↑₊ (σ ◅ Γ₊) = ρ ↑ ↑₊ Γ₊
-- The identity substitution.
id[_] : ∀ Γ → Sub T îd[ Γ ]
id[ ε ] = ε⇨
id[ Γ ▻ σ ] = id[ Γ ] ↑
id : ∀ {Γ} → Sub T îd[ Γ ]
id = id[ _ ]
-- N-ary weakening.
wk⁺ : ∀ {Γ} (Γ⁺ : Ctxt⁺ Γ) → Sub T (ŵk⁺ Γ⁺)
wk⁺ ε = id
wk⁺ (Γ⁺ ▻ σ) = wk-subst (wk⁺ Γ⁺)
wk₊ : ∀ {Γ} (Γ₊ : Ctxt₊ Γ) → Sub T (ŵk₊ Γ₊)
wk₊ Γ₊ = wk-subst₊ Γ₊ id
-- Weakening.
wk[_] : ∀ {Γ} (σ : Type Γ) → Sub T ŵk[ σ ]
wk[ σ ] = wk⁺ (ε ▻ σ)
wk : ∀ {Γ} {σ : Type Γ} → Sub T ŵk[ σ ]
wk = wk[ _ ]
private
-- Three possible definitions of wk coincide definitionally.
coincide₁ : ∀ {Γ} {σ : Type Γ} → wk⁺ (ε ▻ σ) ≡ wk₊ (σ ◅ ε)
coincide₁ = P.refl
coincide₂ : ∀ {Γ} {σ : Type Γ} → wk⁺ (ε ▻ σ) ≡ wk-subst id
coincide₂ = P.refl
-- A substitution which only replaces the first variable.
sub : ∀ {Γ σ} (t : Γ ⊢ σ) → Sub T (ŝub ⟦ t ⟧)
sub t = id ▻⇨ t
abstract
-- Unfolding lemma for _↑.
unfold-↑ : ∀ {Γ Δ σ} {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T ρ̂) →
ρ ↑ σ ≅-⇨ wk-subst[ σ / ρ ] ρ ▻⇨[ σ ] var · zero
unfold-↑ _ =
drop-subst-Sub F.id
(≅-⇨̂-⇒-≡ $ ▻̂-cong P.refl P.refl (P.sym $ corresponds var zero))
-- Some congruence lemmas.
weaken-cong : ∀ {Γ₁ σ₁ τ₁} {t₁ : Γ₁ ⊢ τ₁}
{Γ₂ σ₂ τ₂} {t₂ : Γ₂ ⊢ τ₂} →
σ₁ ≅-Type σ₂ → t₁ ≅-⊢ t₂ →
weaken[ σ₁ ] · t₁ ≅-⊢ weaken[ σ₂ ] · t₂
weaken-cong P.refl P.refl = P.refl
var-cong : ∀ {Γ₁ σ₁} {x₁ : Γ₁ ∋ σ₁}
{Γ₂ σ₂} {x₂ : Γ₂ ∋ σ₂} →
x₁ ≅-∋ x₂ → var · x₁ ≅-⊢ var · x₂
var-cong P.refl = P.refl
wk-subst-cong : ∀ {Γ₁ Δ₁ σ₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁}
{Γ₂ Δ₂ σ₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} →
σ₁ ≅-Type σ₂ → ρ₁ ≅-⇨ ρ₂ →
wk-subst[ σ₁ ] ρ₁ ≅-⇨ wk-subst[ σ₂ ] ρ₂
wk-subst-cong {ρ₁ = _ , _} {ρ₂ = ._ , _} P.refl [ P.refl ] =
[ P.refl ]
abstract
wk-subst⁺-cong : ∀ {Γ₁ Δ₁ Γ⁺₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁}
{Γ₂ Δ₂ Γ⁺₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} →
Γ⁺₁ ≅-Ctxt⁺ Γ⁺₂ → ρ₁ ≅-⇨ ρ₂ →
wk-subst⁺ Γ⁺₁ ρ₁ ≅-⇨ wk-subst⁺ Γ⁺₂ ρ₂
wk-subst⁺-cong {Γ⁺₁ = ε} {ρ₁ = _ , _} {ρ₂ = ._ , _} P.refl [ P.refl ] =
[ P.refl ]
wk-subst⁺-cong {Γ⁺₁ = Γ⁺₁ ▻ σ} P.refl ρ₁≅ρ₂ =
wk-subst-cong (P.refl {x = [ σ ]})
(wk-subst⁺-cong (P.refl {x = [ Γ⁺₁ ]}) ρ₁≅ρ₂)
wk-subst₊-cong : ∀ {Γ₁ Δ₁ Γ₊₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁}
{Γ₂ Δ₂ Γ₊₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} →
Γ₊₁ ≅-Ctxt₊ Γ₊₂ → ρ₁ ≅-⇨ ρ₂ →
wk-subst₊ Γ₊₁ ρ₁ ≅-⇨ wk-subst₊ Γ₊₂ ρ₂
wk-subst₊-cong {Γ₊₁ = ε} {ρ₁ = _ , _} {ρ₂ = ._ , _} P.refl [ P.refl ] =
[ P.refl ]
wk-subst₊-cong {Γ₊₁ = σ ◅ Γ₊₁} P.refl ρ₁≅ρ₂ =
wk-subst₊-cong (P.refl {x = [ Γ₊₁ ]}) (wk-subst-cong P.refl ρ₁≅ρ₂)
↑-cong : ∀ {Γ₁ Δ₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁} {σ₁}
{Γ₂ Δ₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} {σ₂} →
ρ₁ ≅-⇨ ρ₂ → σ₁ ≅-Type σ₂ → ρ₁ ↑ σ₁ ≅-⇨ ρ₂ ↑ σ₂
↑-cong {ρ₁ = ρ₁} {σ₁} {ρ₂ = ρ₂} {σ₂} ρ₁≅ρ₂ σ₁≅σ₂ =
let lemma = /-cong σ₁≅σ₂ ρ₁≅ρ₂ in
ρ₁ ↑ σ₁ ≅-⟶⟨ unfold-↑ ρ₁ ⟩
wk-subst ρ₁ ▻⇨ var · zero[ σ₁ / ρ₁ ] ≅-⟶⟨ ▻⇨-cong σ₁≅σ₂ (wk-subst-cong lemma ρ₁≅ρ₂) (var-cong (zero-cong lemma)) ⟩
wk-subst ρ₂ ▻⇨ var · zero[ σ₂ / ρ₂ ] ≅-⟶⟨ sym-⟶ $ unfold-↑ ρ₂ ⟩
ρ₂ ↑ σ₂ ∎-⟶
↑⁺-cong : ∀ {Γ₁ Δ₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁} {Γ⁺₁}
{Γ₂ Δ₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} {Γ⁺₂} →
ρ₁ ≅-⇨ ρ₂ → Γ⁺₁ ≅-Ctxt⁺ Γ⁺₂ → ρ₁ ↑⁺ Γ⁺₁ ≅-⇨ ρ₂ ↑⁺ Γ⁺₂
↑⁺-cong {ρ₁ = _ , _} {Γ⁺₁ = ε} {ρ₂ = ._ , _} [ P.refl ] P.refl =
[ P.refl ]
↑⁺-cong {Γ⁺₁ = Γ⁺ ▻ σ} ρ₁≅ρ₂ P.refl =
↑-cong (↑⁺-cong ρ₁≅ρ₂ (P.refl {x = [ Γ⁺ ]})) P.refl
↑₊-cong : ∀ {Γ₁ Δ₁} {ρ̂₁ : Γ₁ ⇨̂ Δ₁} {ρ₁ : Sub T ρ̂₁} {Γ₊₁}
{Γ₂ Δ₂} {ρ̂₂ : Γ₂ ⇨̂ Δ₂} {ρ₂ : Sub T ρ̂₂} {Γ₊₂} →
ρ₁ ≅-⇨ ρ₂ → Γ₊₁ ≅-Ctxt₊ Γ₊₂ → ρ₁ ↑₊ Γ₊₁ ≅-⇨ ρ₂ ↑₊ Γ₊₂
↑₊-cong {ρ₁ = _ , _} {Γ₊₁ = ε} {ρ₂ = ._ , _} [ P.refl ] P.refl =
[ P.refl ]
↑₊-cong {Γ₊₁ = σ ◅ Γ₊} ρ₁≅ρ₂ P.refl =
↑₊-cong (↑-cong ρ₁≅ρ₂ P.refl) (P.refl {x = [ Γ₊ ]})
id-cong : ∀ {Γ₁ Γ₂} → Γ₁ ≅-Ctxt Γ₂ → id[ Γ₁ ] ≅-⇨ id[ Γ₂ ]
id-cong P.refl = [ P.refl ]
wk⁺-cong : ∀ {Γ₁} {Γ⁺₁ : Ctxt⁺ Γ₁} {Γ₂} {Γ⁺₂ : Ctxt⁺ Γ₂} →
Γ⁺₁ ≅-Ctxt⁺ Γ⁺₂ → wk⁺ Γ⁺₁ ≅-⇨ wk⁺ Γ⁺₂
wk⁺-cong P.refl = [ P.refl ]
wk₊-cong : ∀ {Γ₁} {Γ₊₁ : Ctxt₊ Γ₁} {Γ₂} {Γ₊₂ : Ctxt₊ Γ₂} →
Γ₊₁ ≅-Ctxt₊ Γ₊₂ → wk₊ Γ₊₁ ≅-⇨ wk₊ Γ₊₂
wk₊-cong P.refl = [ P.refl ]
wk-cong : ∀ {Γ₁} {σ₁ : Type Γ₁} {Γ₂} {σ₂ : Type Γ₂} →
σ₁ ≅-Type σ₂ → wk[ σ₁ ] ≅-⇨ wk[ σ₂ ]
wk-cong P.refl = [ P.refl ]
sub-cong : ∀ {Γ₁ σ₁} {t₁ : Γ₁ ⊢ σ₁} {Γ₂ σ₂} {t₂ : Γ₂ ⊢ σ₂} →
t₁ ≅-⊢ t₂ → sub t₁ ≅-⇨ sub t₂
sub-cong P.refl = [ P.refl ]
abstract
-- Some lemmas relating variables to lifting.
/∋-↑ : ∀ {Γ Δ σ τ} {ρ̂ : Γ ⇨̂ Δ} (x : Γ ▻ σ ∋ τ) (ρ : Sub T ρ̂) →
x /∋ ρ ↑ ≅-⊢ x /∋ (wk-subst[ σ / ρ ] ρ ▻⇨ var · zero)
/∋-↑ x ρ = /∋-cong (P.refl {x = [ x ]}) (unfold-↑ ρ)
zero-/∋-↑ : ∀ {Γ Δ} σ {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T ρ̂) →
zero[ σ ] /∋ ρ ↑ ≅-⊢ var · zero[ σ / ρ ]
zero-/∋-↑ σ ρ = begin
[ zero[ σ ] /∋ ρ ↑ ] ≡⟨ /∋-↑ zero[ σ ] ρ ⟩
[ zero[ σ ] /∋ (wk-subst ρ ▻⇨ var · zero) ] ≡⟨ P.refl ⟩
[ var · zero ] ∎
suc-/∋-↑ : ∀ {Γ Δ τ} σ {ρ̂ : Γ ⇨̂ Δ} (x : Γ ∋ τ) (ρ : Sub T ρ̂) →
suc[ σ ] x /∋ ρ ↑ ≅-⊢ x /∋ wk-subst[ σ / ρ ] ρ
suc-/∋-↑ σ x ρ = begin
[ suc[ σ ] x /∋ ρ ↑ ] ≡⟨ /∋-↑ (suc[ σ ] x) ρ ⟩
[ suc[ σ ] x /∋ (wk-subst ρ ▻⇨ var · zero) ] ≡⟨ P.refl ⟩
[ x /∋ wk-subst ρ ] ∎
-- One can weaken either before or after looking up a variable.
-- (Note that this lemma holds definitionally, unlike the
-- corresponding lemma in deBruijn.Substitution.Data.Simple.)
/∋-wk-subst : ∀ {Γ Δ σ τ} {ρ̂ : Γ ⇨̂ Δ} (x : Γ ∋ τ) (ρ : Sub T ρ̂) →
x /∋ wk-subst[ σ ] ρ ≅-⊢ weaken[ σ ] · (x /∋ ρ)
/∋-wk-subst x ρ = P.refl
abstract
-- A corollary.
/∋-wk-subst-var :
∀ {Γ Δ σ τ} {ρ̂ : Γ ⇨̂ Δ}
(ρ : Sub T ρ̂) (x : Γ ∋ τ) (y : Δ ∋ τ / ρ) →
x /∋ ρ ≅-⊢ var · y →
x /∋ wk-subst[ σ ] ρ ≅-⊢ var · suc[ σ ] y
/∋-wk-subst-var ρ x y hyp = begin
[ x /∋ wk-subst ρ ] ≡⟨ P.refl ⟩
[ weaken · (x /∋ ρ) ] ≡⟨ weaken-cong P.refl hyp ⟩
[ weaken · (var · y) ] ≡⟨ weaken-var y ⟩
[ var · suc y ] ∎
-- The identity substitution has no effect.
/-id : ∀ {Γ} (σ : Type Γ) → σ / id ≅-Type σ
/-id σ = P.refl
/⁺-id : ∀ {Γ} (Γ⁺ : Ctxt⁺ Γ) → Γ⁺ /⁺ id ≅-Ctxt⁺ Γ⁺
/⁺-id Γ⁺ = begin
[ Γ⁺ /⁺ id ] ≡⟨ P.refl ⟩
[ Γ⁺ /̂⁺ îd ] ≡⟨ /̂⁺-îd Γ⁺ ⟩
[ Γ⁺ ] ∎
/₊-id : ∀ {Γ} (Γ₊ : Ctxt₊ Γ) → Γ₊ /₊ id ≅-Ctxt₊ Γ₊
/₊-id Γ₊ = begin
[ Γ₊ /₊ id ] ≡⟨ P.refl ⟩
[ Γ₊ /̂₊ îd ] ≡⟨ /̂₊-îd Γ₊ ⟩
[ Γ₊ ] ∎
mutual
/∋-id : ∀ {Γ σ} (x : Γ ∋ σ) → x /∋ id ≅-⊢ var · x
/∋-id {Γ = ε} ()
/∋-id {Γ = Γ ▻ σ} x = begin
[ x /∋ id ↑ ] ≡⟨ /∋-↑ x id ⟩
[ x /∋ (wk ▻⇨ var · zero) ] ≡⟨ lemma x ⟩
[ var · x ] ∎
where
lemma : ∀ {τ} (x : Γ ▻ σ ∋ τ) →
x /∋ (wk[ σ ] ▻⇨ var · zero) ≅-⊢ var · x
lemma zero = P.refl
lemma (suc x) = /∋-wk x
-- Weakening a variable is equivalent to incrementing it.
/∋-wk : ∀ {Γ σ τ} (x : Γ ∋ τ) →
x /∋ wk[ σ ] ≅-⊢ var · suc[ σ ] x
/∋-wk x = /∋-wk-subst-var id x x (/∋-id x)
-- The n-ary lifting of the identity substitution is the identity
-- substitution.
id-↑⁺ : ∀ {Γ} (Γ⁺ : Ctxt⁺ Γ) → id ↑⁺ Γ⁺ ≅-⇨ id[ Γ ++⁺ Γ⁺ ]
id-↑⁺ ε = id ∎-⟶
id-↑⁺ (Γ⁺ ▻ σ) =
(id ↑⁺ Γ⁺) ↑ ≅-⟶⟨ ↑-cong (id-↑⁺ Γ⁺) P.refl ⟩
id ↑ ∎-⟶
id-↑₊ : ∀ {Γ} (Γ₊ : Ctxt₊ Γ) → id ↑₊ Γ₊ ≅-⇨ id[ Γ ++₊ Γ₊ ]
id-↑₊ ε = id ∎-⟶
id-↑₊ (σ ◅ Γ₊) =
id ↑ ↑₊ Γ₊ ≅-⟶⟨ [ P.refl ] ⟩
id ↑₊ Γ₊ ≅-⟶⟨ id-↑₊ Γ₊ ⟩
id ∎-⟶
-- The identity substitution has no effect even if lifted.
/∋-id-↑⁺ : ∀ {Γ} Γ⁺ {σ} (x : Γ ++⁺ Γ⁺ ∋ σ) →
x /∋ id ↑⁺ Γ⁺ ≅-⊢ var · x
/∋-id-↑⁺ Γ⁺ x = begin
[ x /∋ id ↑⁺ Γ⁺ ] ≡⟨ /∋-cong (P.refl {x = [ x ]}) (id-↑⁺ Γ⁺) ⟩
[ x /∋ id ] ≡⟨ /∋-id x ⟩
[ var · x ] ∎
/∋-id-↑₊ : ∀ {Γ} Γ₊ {σ} (x : Γ ++₊ Γ₊ ∋ σ) →
x /∋ id ↑₊ Γ₊ ≅-⊢ var · x
/∋-id-↑₊ Γ₊ x = begin
[ x /∋ id ↑₊ Γ₊ ] ≡⟨ /∋-cong (P.refl {x = [ x ]}) (id-↑₊ Γ₊) ⟩
[ x /∋ id ] ≡⟨ /∋-id x ⟩
[ var · x ] ∎
-- If ρ is morally a renaming, then "deep application" of ρ to a
-- variable is still a variable.
/∋-↑⁺ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ}
(ρ : Sub T ρ̂) (f : [ Var ⟶ Var ] ρ̂) →
(∀ {σ} (x : Γ ∋ σ) → x /∋ ρ ≅-⊢ var · (f · x)) →
∀ Γ⁺ {σ} (x : Γ ++⁺ Γ⁺ ∋ σ) →
x /∋ ρ ↑⁺ Γ⁺ ≅-⊢ var · (lift f Γ⁺ · x)
/∋-↑⁺ ρ f hyp ε x = hyp x
/∋-↑⁺ ρ f hyp (Γ⁺ ▻ σ) zero = begin
[ zero[ σ ] /∋ (ρ ↑⁺ Γ⁺) ↑ ] ≡⟨ zero-/∋-↑ σ (ρ ↑⁺ Γ⁺) ⟩
[ var · zero ] ∎
/∋-↑⁺ ρ f hyp (Γ⁺ ▻ σ) (suc x) = begin
[ suc[ σ ] x /∋ (ρ ↑⁺ Γ⁺) ↑ ] ≡⟨ suc-/∋-↑ σ x (ρ ↑⁺ Γ⁺) ⟩
[ x /∋ wk-subst (ρ ↑⁺ Γ⁺) ] ≡⟨ P.refl ⟩
[ weaken · (x /∋ ρ ↑⁺ Γ⁺) ] ≡⟨ weaken-cong P.refl (/∋-↑⁺ ρ f hyp Γ⁺ x) ⟩
[ weaken · (var · (lift f Γ⁺ · x)) ] ≡⟨ weaken-var (lift f Γ⁺ · x) ⟩
[ var · suc (lift f Γ⁺ · x) ] ∎
-- "Deep weakening" of a variable can be expressed without
-- reference to the weaken function.
/∋-wk-↑⁺ : ∀ {Γ σ} Γ⁺ {τ} (x : Γ ++⁺ Γ⁺ ∋ τ) →
x /∋ wk[ σ ] ↑⁺ Γ⁺ ≅-⊢
var · (lift weaken∋[ σ ] Γ⁺ · x)
/∋-wk-↑⁺ = /∋-↑⁺ wk weaken∋ /∋-wk
/∋-wk-↑⁺-↑⁺ : ∀ {Γ σ} Γ⁺ Γ⁺⁺ {τ} (x : Γ ++⁺ Γ⁺ ++⁺ Γ⁺⁺ ∋ τ) →
x /∋ wk[ σ ] ↑⁺ Γ⁺ ↑⁺ Γ⁺⁺ ≅-⊢
var · (lift (lift weaken∋[ σ ] Γ⁺) Γ⁺⁺ · x)
/∋-wk-↑⁺-↑⁺ Γ⁺ = /∋-↑⁺ (wk ↑⁺ Γ⁺) (lift weaken∋ Γ⁺) (/∋-wk-↑⁺ Γ⁺)
-- Two n-ary liftings can be merged into one.
↑⁺-⁺++⁺ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T ρ̂) Γ⁺ Γ⁺⁺ →
ρ ↑⁺ (Γ⁺ ⁺++⁺ Γ⁺⁺) ≅-⇨ ρ ↑⁺ Γ⁺ ↑⁺ Γ⁺⁺
↑⁺-⁺++⁺ ρ Γ⁺ ε = ρ ↑⁺ Γ⁺ ∎-⟶
↑⁺-⁺++⁺ ρ Γ⁺ (Γ⁺⁺ ▻ σ) =
(ρ ↑⁺ (Γ⁺ ⁺++⁺ Γ⁺⁺)) ↑ ≅-⟶⟨ ↑-cong (↑⁺-⁺++⁺ ρ Γ⁺ Γ⁺⁺)
(drop-subst-Type F.id (++⁺-++⁺ Γ⁺ Γ⁺⁺)) ⟩
(ρ ↑⁺ Γ⁺ ↑⁺ Γ⁺⁺) ↑ ∎-⟶
↑₊-₊++₊ : ∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T ρ̂) Γ₊ Γ₊₊ →
ρ ↑₊ (Γ₊ ₊++₊ Γ₊₊) ≅-⇨ ρ ↑₊ Γ₊ ↑₊ Γ₊₊
↑₊-₊++₊ ρ ε Γ₊₊ = ρ ↑₊ Γ₊₊ ∎-⟶
↑₊-₊++₊ ρ (σ ◅ Γ₊) Γ₊₊ =
ρ ↑ ↑₊ (Γ₊ ₊++₊ Γ₊₊) ≅-⟶⟨ ↑₊-₊++₊ (ρ ↑) Γ₊ Γ₊₊ ⟩
ρ ↑ ↑₊ Γ₊ ↑₊ Γ₊₊ ∎-⟶
|
src/main/antlr4/cz/martinendler/chess/pgn/antlr4/PGN.g4 | pokusew/chess | 0 | 5182 | /*
* The MIT License (MIT)
*
* Copyright (c) 2013-2014 by <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.
*
* Project : A Portable Game Notation (PGN) ANTLR 4 grammar
* and parser.
* Developed by : <NAME>, <EMAIL>
* Source URL : https://github.com/antlr/grammars-v4/blob/master/pgn/PGN.g4
* Also see : https://github.com/bkiers/PGN-parser
*/
//
// A Portable Game Notation (PGN) grammar based on:
// http://www.thechessdrum.net/PGN_Reference.txt
//
// The inline comments starting with "///" in this grammar are direct
// copy-pastes from the PGN reference linked above.
//
grammar PGN;
// The entry point of the grammar.
parse
: pgn_database EOF
;
/// <PGN-database> ::= <PGN-game> <PGN-database>
/// <empty>
pgn_database
: pgn_game*
;
/// <PGN-game> ::= <tag-section> <movetext-section>
pgn_game
: tag_section movetext_section
;
/// <tag-section> ::= <tag-pair> <tag-section>
/// <empty>
tag_section
: tag_pair*
;
/// <tag-pair> ::= [ <tag-name> <tag-value> ]
tag_pair
: LEFT_BRACKET tag_name tag_value RIGHT_BRACKET
;
/// <tag-name> ::= <identifier>
tag_name
: SYMBOL
;
/// <tag-value> ::= <string>
tag_value
: STRING
;
/// <movetext-section> ::= <element-sequence> <game-termination>
movetext_section
: element_sequence game_termination
;
/// <element-sequence> ::= <element> <element-sequence>
/// <recursive-variation> <element-sequence>
/// <empty>
element_sequence
: (element | recursive_variation)*
;
/// <element> ::= <move-number-indication>
/// <SAN-move>
/// <numeric-annotation-glyph>
element
: move_number_indication
| san_move
| NUMERIC_ANNOTATION_GLYPH
;
move_number_indication
: INTEGER PERIOD?
;
san_move
: SYMBOL
;
/// <recursive-variation> ::= ( <element-sequence> )
recursive_variation
: LEFT_PARENTHESIS element_sequence RIGHT_PARENTHESIS
;
/// <game-termination> ::= 1-0
/// 0-1
/// 1/2-1/2
/// *
game_termination
: WHITE_WINS
| BLACK_WINS
| DRAWN_GAME
| ASTERISK
;
WHITE_WINS
: '1-0'
;
BLACK_WINS
: '0-1'
;
DRAWN_GAME
: '1/2-1/2'
;
/// Comment text may appear in PGN data. There are two kinds of comments. The
/// first kind is the "rest of line" comment; this comment type starts with a
/// semicolon character and continues to the end of the line. The second kind
/// starts with a left brace character and continues to the next right brace
/// character. Comments cannot appear inside any token.
REST_OF_LINE_COMMENT
: ';' ~[\r\n]* -> skip
;
/// Brace comments do not nest; a left brace character appearing in a brace comment
/// loses its special meaning and is ignored. A semicolon appearing inside of a
/// brace comment loses its special meaning and is ignored. Braces appearing
/// inside of a semicolon comments lose their special meaning and are ignored.
BRACE_COMMENT
: '{' ~'}'* '}' -> skip
;
/// There is a special escape mechanism for PGN data. This mechanism is triggered
/// by a percent sign character ("%") appearing in the first column of a line; the
/// data on the rest of the line is ignored by publicly available PGN scanning
/// software. This escape convention is intended for the private use of software
/// developers and researchers to embed non-PGN commands and data in PGN streams.
///
/// A percent sign appearing in any other place other than the first position in a
/// line does not trigger the escape mechanism.
ESCAPE
: {getCharPositionInLine() == 0}? '%' ~[\r\n]* -> skip
;
SPACES
: [ \t\r\n]+ -> skip
;
/// A string token is a sequence of zero or more printing characters delimited by a
/// pair of quote characters (ASCII decimal value 34, hexadecimal value 0x22). An
/// empty string is represented by two adjacent quotes. (Note: an apostrophe is
/// not a quote.) A quote inside a string is represented by the backslash
/// immediately followed by a quote. A backslash inside a string is represented by
/// two adjacent backslashes. Strings are commonly used as tag pair values (see
/// below). Non-printing characters like newline and tab are not permitted inside
/// of strings. A string token is terminated by its closing quote. Currently, a
/// string is limited to a maximum of 255 characters of data.
STRING
: '"' ('\\\\' | '\\"' | ~[\\"])* '"'
;
/// An integer token is a sequence of one or more decimal digit characters. It is
/// a special case of the more general "symbol" token class described below.
/// Integer tokens are used to help represent move number indications (see below).
/// An integer token is terminated just prior to the first non-symbol character
/// following the integer digit sequence.
INTEGER
: [0-9]+
;
/// A period character (".") is a token by itself. It is used for move number
/// indications (see below). It is self terminating.
PERIOD
: '.'
;
/// An asterisk character ("*") is a token by itself. It is used as one of the
/// possible game termination markers (see below); it indicates an incomplete game
/// or a game with an unknown or otherwise unavailable result. It is self
/// terminating.
ASTERISK
: '*'
;
/// The left and right bracket characters ("[" and "]") are tokens. They are used
/// to delimit tag pairs (see below). Both are self terminating.
LEFT_BRACKET
: '['
;
RIGHT_BRACKET
: ']'
;
/// The left and right parenthesis characters ("(" and ")") are tokens. They are
/// used to delimit Recursive Annotation Variations (see below). Both are self
/// terminating.
LEFT_PARENTHESIS
: '('
;
RIGHT_PARENTHESIS
: ')'
;
/// The left and right angle bracket characters ("<" and ">") are tokens. They are
/// reserved for future expansion. Both are self terminating.
LEFT_ANGLE_BRACKET
: '<'
;
RIGHT_ANGLE_BRACKET
: '>'
;
/// A Numeric Annotation Glyph ("NAG", see below) is a token; it is composed of a
/// dollar sign character ("$") immediately followed by one or more digit
/// characters. It is terminated just prior to the first non-digit character
/// following the digit sequence.
NUMERIC_ANNOTATION_GLYPH
: '$' [0-9]+
;
/// A symbol token starts with a letter or digit character and is immediately
/// followed by a sequence of zero or more symbol continuation characters. These
/// continuation characters are letter characters ("A-Za-z"), digit characters
/// ("0-9"), the underscore ("_"), the plus sign ("+"), the octothorpe sign ("#"),
/// the equal sign ("="), the colon (":"), and the hyphen ("-"). Symbols are used
/// for a variety of purposes. All characters in a symbol are significant. A
/// symbol token is terminated just prior to the first non-symbol character
/// following the symbol character sequence. Currently, a symbol is limited to a
/// maximum of 255 characters in length.
SYMBOL
: [a-zA-Z0-9] [a-zA-Z0-9_+#=:-]*
;
/// Import format PGN allows for the use of traditional suffix annotations for
/// moves. There are exactly six such annotations available: "!", "?", "!!", "!?",
/// "?!", and "??". At most one such suffix annotation may appear per move, and if
/// present, it is always the last part of the move symbol.
SUFFIX_ANNOTATION
: [?!] [?!]?
;
// A fall through rule that will catch any character not matched by any of the
// previous lexer rules.
UNEXPECTED_CHAR
: .
;
|
lib/core/conv/_long.asm | locodarwin/xc-basic3 | 11 | 169970 | <gh_stars>10-100
PROCESSOR 6502
; Convert long int on stack to byte
MAC F_cbyte_long
pla
pla
ENDM
; Convert long int on stack to word
MAC F_cword_long
pla
ENDM
; Convert long int on stack to int
MAC F_cint_long
pla
ENDM
; Convert long int on stack to float
MAC F_cfloat_long ; @pull @push
IF !FPULL
pla
sta FAC + 1
eor #$FF
rol
pla
sta FAC + 2
pla
sta FAC + 3
ELSE
sta FAC + 3
sty FAC + 2
stx FAC + 1
txa
eor #$FF
rol
ENDIF
import I_LTOF
jsr LTOF
pfac
ENDM
IFCONST I_LTOF_IMPORTED
LTOF SUBROUTINE
ldx #$98
stx FAC
lda #$00
sta FACEXTENSION
sta FACSIGN
import I_FPLIB
jmp NORMALIZE_FAC1
ENDIF |
programs/oeis/287/A287803.asm | neoneye/loda | 22 | 167849 | ; A287803: Positions of 1 in A287801; complement of A287802.
; 1,6,7,10,15,16,21,22,25,30,31,34,39,40,45,46,49,54,55,60,61,64,69,70,73,78,79,84,85,88,93,94,97,102,103,108,109,112,117,118,123,124,127,132,133,136,141,142,147,148,151,156,157,162,163,166,171,172,175,180,181,186,187,190,195,196,199,204,205,210,211,214,219,220,225,226,229,234,235,238,243,244,249,250,253,258,259,262,267,268,273,274,277,282,283,288,289,292,297,298
mov $2,$0
seq $0,14675 ; The infinite Fibonacci word (start with 1, apply 1->2, 2->21, take limit).
sub $1,$0
mov $3,$0
mov $0,9
mul $3,5
div $0,$3
lpb $3
add $1,$0
mul $3,$1
lpe
add $1,3
mov $4,$2
mul $4,3
add $1,$4
mov $0,$1
|
source/nodes/program-relative_access_types.adb | reznikmm/gela | 0 | 7453 | <filename>source/nodes/program-relative_access_types.adb
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with System.Storage_Elements;
with System.Address_To_Access_Conversions;
package body Program.Relative_Access_Types is
package Conversions is new System.Address_To_Access_Conversions (Object);
use System.Storage_Elements;
---------
-- "+" --
---------
function "+" (Value : Object_Access) return Relative_Access is
begin
return Result : Relative_Access do
if Value = null then
Result := Relative_Access'First;
else
declare
Value_Address : constant Integer_Address :=
To_Integer (Value.all'Address);
Result_Address : constant Integer_Address :=
To_Integer (Result'Address);
begin
if Value_Address > Result_Address then
Result := Relative_Access (Value_Address - Result_Address);
else
Result := -Relative_Access (Result_Address - Value_Address);
end if;
end;
end if;
end return;
end "+";
---------
-- "-" --
---------
function "-" (Value : Relative_Access) return Object_Access is
Self : constant Integer_Address := To_Integer (Value'Address);
begin
if Value = Relative_Access'First then
return null;
elsif Value > 0 then
return Object_Access
(Conversions.To_Pointer
(To_Address (Self + Integer_Address (Value))));
else
return Object_Access
(Conversions.To_Pointer
(To_Address (Self - Integer_Address (abs Value))));
end if;
end "-";
end Program.Relative_Access_Types;
|
oeis/254/A254474.asm | neoneye/loda-programs | 11 | 245871 | ; A254474: 30-gonal numbers: a(n) = n*(14*n-13).
; 0,1,30,87,172,285,426,595,792,1017,1270,1551,1860,2197,2562,2955,3376,3825,4302,4807,5340,5901,6490,7107,7752,8425,9126,9855,10612,11397,12210,13051,13920,14817,15742,16695,17676,18685,19722,20787,21880,23001,24150,25327,26532,27765,29026,30315,31632,32977,34350,35751,37180,38637,40122,41635,43176,44745,46342,47967,49620,51301,53010,54747,56512,58305,60126,61975,63852,65757,67690,69651,71640,73657,75702,77775,79876,82005,84162,86347,88560,90801,93070,95367,97692,100045,102426,104835,107272
mov $1,$0
bin $1,2
mul $1,28
add $0,$1
|
agda/Midi.agda | halfaya/MusicTools | 28 | 3586 | <gh_stars>10-100
{-# OPTIONS --erased-cubical #-}
module Midi where
open import Agda.Builtin.String using (String)
open import Data.Fin using (toℕ)
open import Data.Nat using (ℕ)
open import Data.List using (List; []; _∷_; concatMap)
open import Data.Product using (_,_)
open import Data.Unit using (⊤)
open import MidiEvent using (Tick; MidiEvent; midiEvent; MidiTrack; track)
{-# FOREIGN GHC
import System.Environment (getArgs)
import Codec.Midi
import Data.Text (Text, unpack, pack)
import Data.List (sort, map)
import Text.Read (readMaybe)
type HsTicksPerBeat = Integer
type HsTicks = Integer
type HsKey = Integer
type HsVelocity = Integer
type HsPreset = Integer
type HsChannel = Integer
type HsTempo = Integer
type HsAbsTime = Integer
type HsTrackName = Text
-- convert beats per minute to microseconds per beat
bpmToTempo :: Int -> Tempo
bpmToTempo bpm = round $ 1000000 * 60 / fromIntegral bpm
data HsMidiMessage = HsNoteOn HsVelocity HsTicks HsKey | HsNoteOff HsVelocity HsTicks HsKey
deriving Eq
getTicks :: HsMidiMessage -> HsTicks
getTicks (HsNoteOn _ t _) = t
getTicks (HsNoteOff _ t _) = t
instance Ord HsMidiMessage where
a <= b = getTicks a <= getTicks b
data HsMidiTrack = HsMidiTrack HsTrackName HsPreset HsChannel HsTempo [HsMidiMessage]
fi = fromInteger
makeTrack :: Channel -> HsAbsTime -> [HsMidiMessage] -> (Track Ticks , HsAbsTime)
makeTrack c t [] = ([(0, TrackEnd)], t)
makeTrack c t (HsNoteOn v t' k : ms) = let (rest, t'') = makeTrack c t' ms
in ((fi (t' - t), NoteOn c (fi k) (fi v)) : rest, t'')
makeTrack c t (HsNoteOff v t' k : ms) = let (rest, t'') = makeTrack c t' ms
in ((fi (t' - t), NoteOff c (fi k) (fi v)) : rest, t'')
toTrack :: HsMidiTrack -> Track Ticks
toTrack (HsMidiTrack name preset channel tempo messages) =
(0, TrackName (unpack name)) :
(0, ProgramChange (fi channel) (fi preset)) :
(0, TempoChange (bpmToTempo (fi tempo))) :
fst (makeTrack (fi channel) 0 (sort messages))
toMidi :: HsTicksPerBeat -> [HsMidiTrack] -> Midi
toMidi ticks tracks = let mtracks = map toTrack tracks
in Midi MultiTrack (TicksPerBeat (fi ticks)) mtracks
exportTracks :: Text -> HsTicksPerBeat -> [HsMidiTrack] -> IO ()
exportTracks filePath ticksPerBeat tracks = do
let path = unpack filePath
--putStrLn $ "Writing file " ++ path
--putStrLn $ show $ toMidi ticksPerBeat tracks
exportFile path (toMidi ticksPerBeat tracks)
-- Returns n+1 if s parses as natural number n, or 0 for any failure
readNat :: Text -> Integer
readNat s = case (readMaybe (unpack s) :: Maybe Integer) of
Just n -> if n >= 0 then n+1 else 0
Nothing -> 0
#-}
postulate
IO : Set → Set
putStrLn : String -> IO ⊤
getArgs : IO (List String)
_>>=_ : {A B : Set} -> IO A -> (A -> IO B) -> IO B
{-# BUILTIN IO IO #-}
{-# COMPILE GHC IO = type IO #-}
{-# COMPILE GHC putStrLn = putStrLn . unpack #-}
{-# COMPILE GHC getArgs = fmap (fmap pack) getArgs #-}
{-# COMPILE GHC _>>=_ = \_ _ -> (>>=) :: IO a -> (a -> IO b) -> IO b #-}
FilePath = String
data Pair (A : Set) (B : Set) : Set where
pair : A → B → Pair A B
{-# COMPILE GHC Pair = data (,) ((,)) #-}
HInstrument HPitch HVelocity : Set
HInstrument = ℕ
HPitch = ℕ
HVelocity = ℕ
HChannel = ℕ
HTempo = ℕ
data MidiMessage : Set where
noteOn : HVelocity → Tick → HPitch → MidiMessage
noteOff : HVelocity → Tick → HPitch → MidiMessage
{-# COMPILE GHC MidiMessage = data HsMidiMessage (HsNoteOn | HsNoteOff) #-}
event→messages : MidiEvent → List MidiMessage
event→messages (midiEvent p start stop v) =
let v' = toℕ v
in noteOn v' start p ∷ noteOff v' stop p ∷ []
data HMidiTrack : Set where
htrack : String → HInstrument → HChannel → HTempo → List MidiMessage → HMidiTrack
{-# COMPILE GHC HMidiTrack = data HsMidiTrack (HsMidiTrack) #-}
track→htrack : MidiTrack → HMidiTrack
track→htrack (track n i c t m) = htrack n (toℕ i) (toℕ c) t (concatMap event→messages m)
postulate
exportTracks : FilePath → -- path to the file to save the MIDI data to
ℕ → -- number of ticks per beat (by default a beat is a quarter note)
List HMidiTrack → -- tracks, one per instrument
IO ⊤
{-# COMPILE GHC exportTracks = exportTracks #-}
postulate
readNat : String → ℕ
{-# COMPILE GHC readNat = readNat #-}
|
src/inline_print.asm | pmwasson/apple2 | 4 | 707 | <reponame>pmwasson/apple2<gh_stars>1-10
;-----------------------------------------------------------------------------
; <NAME> - 2021
;-----------------------------------------------------------------------------
; inline_print - display following string to COUT
;-----------------------------------------------------------------------------
; Uses stack pointer to find string
; clobbers A,X,Y
;
; Example:
; jsr inline_print
; .byte "HELLO WORLD!",0
; <next instruction>
; Zero page usage
stringPtr0 := $58
stringPtr1 := $59
.proc inline_print
; Pop return address to find string
pla
sta stringPtr0
pla
sta stringPtr1
ldy #0
; Print characters until 0 (end-of-string)
printLoop:
iny
bne :+ ; Allow strings > 255
inc stringPtr1
:
tya
pha
lda (stringPtr0),y
beq printExit
ora #$80 ; not inverse/flashing
jsr COUT
pla
tay
jmp printLoop
printExit:
pla ; clean up stack
; calculate return address after print string
clc
tya
adc stringPtr0 ; add low-byte first
tax ; save in X
lda stringPtr1 ; carry to high-byte
adc #0
pha ; push return high-byte
txa
pha ; push return low-byte
rts ; return
.endproc ; print
|
src/any/ppu_timing/statcount.asm | Hacktix/TixTest-GB | 5 | 246754 | <gh_stars>1-10
; ===== Makefile Headers =====
; MBC 0x00
; RAM 0x00
INCLUDE "hardware.inc"
INCLUDE "font.inc"
INCLUDE "common.inc"
SCROLL_INIT_COOLDOWN EQU 20
SCROLL_ITER_COOLDOWN EQU 3
SECTION "Header", ROM0[0]
ds $40 - @
VBlank:
jp HandleVBlank
ds $100 - @
SECTION "Test", ROM0[$100]
EntryPoint::
jr Main
ds $150 - @
;----------------------------------------------------------------------------
; This Test ROM ROM is intended as an emulator debugging tool to assist with
; PPU timings. It allows for running a variable amount of machine cycles
; (referred to as NOPs) before storing the status of the STAT register.
;----------------------------------------------------------------------------
Main::
;====================================================
; Wait for VBlank & Stop PPU
ld a, [rLY]
cp SCRN_Y
jr c, Main
xor a
ldh [rLCDC], a
;====================================================
; Initialize Palettes
; DMG Palettes
ld a, %11100100
ldh [rBGP], a
; CGB Palettes
ld a, BCPSF_AUTOINC
ldh [rBCPS], a
ld c, LOW(rBCPD)
ld hl, defaultPalette
call LoadPalette
ld hl, errorPalette
call LoadPalette
ld hl, passPalette
call LoadPalette
;====================================================
; Initialize important Variables
ld sp, $DFFF
xor a
ld [wReadSTAT], a
ld [wJoypadScrollCooldown], a
ld [wJoypadCooldown], a
inc a
ld [wCountNOP], a
; Set LYC to FF so that the coincidence bit isn't set
ld a, $FF
ldh [rLYC], a
;====================================================
; Clear VRAM before anything
ld hl, $8000
ld de, $2000
.vramClearLoop
xor a
ld [hli], a
dec de
ld a, d
or e
jr nz, .vramClearLoop
;====================================================
; Load Font Data & Tilemap into VRAM
; Font Tiles
call LoadFont
; "NOPs" String
ld hl, $9821
ld de, strNOPs
call Strcpy
; "NOPs" String
ld hl, $9861
ld de, strRead
call Strcpy
; "Exp." String
ld hl, $98A1
ld de, strExpected
call Strcpy
; "Press Start" String
ld hl, $9A01
ld de, strPressStart
call Strcpy
;====================================================
; Re-enable LCD & Interrupts
xor a
ldh [rIF], a
ld a, IEF_VBLANK
ldh [rIE], a
ei
ld a, LCDCF_ON | LCDCF_BG8800 | LCDCF_BGON
ldh [rLCDC], a
.mainLoop
;====================================================
; Main Loop - Fetch input state and HALT
; Fetch D-Pad bits
ld c, LOW(rP1)
ld a, $20
ldh [c], a
ldh a, [c]
or $F0
ld b, a
swap b
; Fetch Button bits
ld a, $10
ldh [c], a
ldh a, [c]
or $F0
xor b
ld b, a
; Release joypad
ld a, $30
ldh [c], a
; Update HRAM Variables
ldh a, [hHeldKeys]
cpl
and b
ldh [hPressedKeys], a
ld a, b
ldh [hHeldKeys], a
; Wait for VBlank
halt
jr .mainLoop
;----------------------------------------------------------------------------
; Called when the START Button is pressed. Starts a test run and prints
; the results to screen, then returns to the main loop.
;----------------------------------------------------------------------------
RunTest::
;====================================================
; Turn off LCD & Interrupts
xor a
ldh [rLCDC], a
ldh [rIE], a
di
;====================================================
; Prepare C for STAT Read, check if 1 NOP selected
ld c, LOW(rSTAT)
ld a, [wCountNOP]
dec a
jr z, .singleNopTest
;====================================================
; Calculate jump address
ld hl, ClockslideBase
ld a, [wCountNOP]
ld b, a
ld a, $FF
sub b
add l
ld l, a
adc h
sub l
ld h, a
;====================================================
; Enable LCD and start test
ld a, LCDCF_ON
ldh [rLCDC], a
jp hl
.singleNopTest
;====================================================
; Enable LCD and immediately read from STAT
ld a, LCDCF_ON
ldh [rLCDC], a
ld a, [$ff00+c]
;====================================================
; Store variables in memory and end test run
ld [wReadSTAT], a
jp ClockslideBase.postTestCleanup
;----------------------------------------------------------------------------
; 253 NOPs followed by code to store STAT in RAM
; - 1 Cycle timeout by JP HL
; - n Cycles timeout by NOPs
; - 1 Cycle timeout by LD A, [$FF00+C]
; => 253 NOP instructions for 255 NOPs
;----------------------------------------------------------------------------
ClockslideBase::
REPT $FD
nop
ENDR
;====================================================
; Store variables in memory and end test run
ld a, [$ff00+c]
ld [wReadSTAT], a
.postTestCleanup
;====================================================
; Wait for VBlank & Stop PPU
ld a, [rLY]
cp SCRN_Y
jr c, .postTestCleanup
xor a
ldh [rLCDC], a
;====================================================
; Print read STAT value to screen
ld a, [wReadSTAT]
call ConvertToASCII
ld hl, $9867
ld a, d
ld [hli], a
ld a, e
ld [hl], a
;====================================================
; Fetch & Print expected value
; Fetch Expected Value from Result Table
ld a, [wCountNOP]
ld hl, Expected
add l
ld l, a
adc h
sub l
ld h, a
ld a, [hl]
push af ; Preserve expected value for comparison
; Print value
call ConvertToASCII
ld hl, $98A7
ld a, d
ld [hli], a
ld a, e
ld [hl], a
;====================================================
; Compare values and print PASS/FAIL
; Pre-emptively load PASS String & initialize VRAM Bank 1 with pass palette
ld a, 1
ldh [rVBK], a
inc a
ld hl, $98E7
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld de, strPass
; Fetch expected value from stack & compare to RAM value
pop bc
ld a, [wReadSTAT]
cp b
jr z, .noFail
; If values don't match, load FAIL string & fail palette
ld de, strFail
ld a, 1
ld hl, $98E7
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
.noFail
; Reset to VRAM Bank 0
xor a
ldh [rVBK], a
; Print to screen
ld hl, $98E7
call Strcpy
;====================================================
; Turn on LCD & interrupts and return to main loop
xor a
ldh [rIF], a
ld a, IEF_VBLANK
ldh [rIE], a
ei
ld a, LCDCF_ON | LCDCF_BG8800 | LCDCF_BGON
ldh [rLCDC], a
jp Main.mainLoop
;----------------------------------------------------------------------------
; Called whenever a VBlank interrupt occurs. Handles all variable-updating
; and is in charge of starting tests if the START button is pressed.
;----------------------------------------------------------------------------
HandleVBlank::
;====================================================
; Check if test should be started
ldh a, [hPressedKeys]
and $08
jp nz, RunTest
;====================================================
; Handle fresh D-Pad up/down inputs
; Check if D-Pad Up was just pressed
ldh a, [hPressedKeys]
and $40
jr z, .noUpPressed
; Increment wCountNOP by 1, set to 1 if result is 0
ld hl, wCountNOP
inc [hl]
jr nz, .noZeroIncNOP
inc [hl]
.noZeroIncNOP
; Update Scroll Cooldown & Continue
ld a, SCROLL_INIT_COOLDOWN
ld [wJoypadScrollCooldown], a
xor a
ld [wJoypadCooldown], a
jr .noDownHeld
.noUpPressed
; Check if D-Pad Down was just pressed
ldh a, [hPressedKeys]
and $80
jr z, .noDownPressed
; Decrement wCountNOP by 1, set to $FF if result is 0
ld hl, wCountNOP
dec [hl]
jr nz, .noZeroDecNOP
dec [hl]
.noZeroDecNOP
; Update Scroll Cooldown & Continue
ld a, SCROLL_INIT_COOLDOWN
ld [wJoypadScrollCooldown], a
xor a
ld [wJoypadCooldown], a
jr .noDownHeld
.noDownPressed
;====================================================
; Handle held D-Pad up/down inputs
; Check if D-Pad Up is held
ldh a, [hHeldKeys]
and $40
jr z, .noUpHeld
; Check if scroll cooldown is over
ld hl, wJoypadScrollCooldown
dec [hl]
jr nz, .noDownHeld
; Increment scroll cooldown & check value change cooldown
inc [hl]
ld a, [wJoypadCooldown]
inc a
ld [wJoypadCooldown], a
cp SCROLL_ITER_COOLDOWN
jr nz, .noDownHeld
; Reset value change cooldown & handle NOP count increment logic
xor a
ld [wJoypadCooldown], a
ld hl, wCountNOP
inc [hl]
jr nz, .noUpHeld
inc [hl]
.noUpHeld
; Check if D-Pad Down is held
ldh a, [hHeldKeys]
and $80
jr z, .noDownHeld
; Check if scroll cooldown is over
ld hl, wJoypadScrollCooldown
dec [hl]
jr nz, .noDownHeld
; Increment scroll cooldown & check value change cooldown
inc [hl]
ld a, [wJoypadCooldown]
inc a
ld [wJoypadCooldown], a
cp SCROLL_ITER_COOLDOWN
jr nz, .noDownHeld
; Reset value change cooldown & handle NOP count decrement logic
xor a
ld [wJoypadCooldown], a
ld hl, wCountNOP
dec [hl]
jr nz, .noDownHeld
dec [hl]
.noDownHeld
;====================================================
; Print new NOP Count to screen
ld a, [wCountNOP]
call ConvertToASCII
ld hl, $9827
ld a, d
ld [hli], a
ld a, e
ld [hl], a
reti
SECTION "Expected Results", ROM0
Expected::
; Scanline 0
db $FF ; NOP 0 cannot be read => unknown
REPT 18 ; 18 M-cycles of mode 0 (First-scanline-after-LCD-on-quirk)
db $80
ENDR
REPT 43 ; 43 M-cycles of drawing
db $83
ENDR
REPT 51 ; 51 M-cycles of HBlank
db $80
ENDR
; Scanline 1
REPT 20 ; 20 M-cycles of OAM-scan
db $82
ENDR
REPT 43 ; 43 M-cycles of drawing
db $83
ENDR
REPT 51 ; 51 M-cycles of HBlank
db $80
ENDR
; Scanline 2
REPT 20 ; 20 M-cycles of OAM-scan
db $82
ENDR
REPT 9 ; 43 M-cycles of drawing, but cannot test further than 9 M-cycles into scanline 2
db $83
ENDR
SECTION "Strings", ROM0
strNOPs: db "NOPs: 01h", 0
strRead: db "Read: --h", 0
strExpected: db "Exp.: --h", 0
strPressStart: db "Press START to run", 0
strPass: db "PASS!", 0
strFail: db "FAIL!", 0
SECTION "CGB Palettes", ROM0
defaultPalette: dw $FFFF, $0000, $0000, $0000
errorPalette: dw $FFFF, $001F, $001F, $001F
passPalette: dw $FFFF, $03E0, $03E0, $03E0
SECTION "WRAM", WRAM0
wCountNOP: db
wReadSTAT: db
wJoypadScrollCooldown: db
wJoypadCooldown: db
SECTION "HRAM", HRAM
hHeldKeys:: db
hPressedKeys:: db |
programs/oeis/096/A096946.asm | neoneye/loda | 22 | 6951 | ; A096946: Ninth column of (1,5)-Pascal triangle A096940.
; 5,41,189,645,1815,4455,9867,20163,38610,70070,121550,202878,327522,513570,784890,1172490,1716099,2465991,3485075,4851275,6660225,9028305,12096045,16031925,21036600,27347580,35244396,45054284,57158420
lpb $0
mov $2,$0
sub $0,1
seq $2,96945 ; Eighth column of (1,5)-Pascal triangle A096940.
add $1,$2
lpe
add $1,5
mov $0,$1
|
source/amf/mofext/amf-internals-mof_tags.ads | svn2github/matreshka | 24 | 20771 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Internals.MOF_Elements;
with AMF.MOF.Tags;
with AMF.UML.Comments.Collections;
with AMF.UML.Elements.Collections;
with AMF.Visitors;
package AMF.Internals.MOF_Tags is
type MOF_Tag_Proxy is
limited new AMF.Internals.MOF_Elements.MOF_Element_Proxy
and AMF.MOF.Tags.MOF_Tag with null record;
overriding function Get_Name
(Self : not null access constant MOF_Tag_Proxy)
return League.Strings.Universal_String;
-- Getter of Tag::name.
--
overriding procedure Set_Name
(Self : not null access MOF_Tag_Proxy;
To : League.Strings.Universal_String);
-- Setter of Tag::name.
--
overriding function Get_Value
(Self : not null access constant MOF_Tag_Proxy)
return League.Strings.Universal_String;
-- Getter of Tag::value.
--
overriding procedure Set_Value
(Self : not null access MOF_Tag_Proxy;
To : League.Strings.Universal_String);
-- Setter of Tag::value.
--
overriding function Get_Element
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Tag::element.
--
overriding function Get_Tag_Owner
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Elements.UML_Element_Access;
-- Getter of Tag::tagOwner.
--
overriding procedure Set_Tag_Owner
(Self : not null access MOF_Tag_Proxy;
To : AMF.UML.Elements.UML_Element_Access);
-- Setter of Tag::tagOwner.
--
overriding function Get_Owned_Comment
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment;
-- Getter of Element::ownedComment.
--
-- The Comments owned by this element.
overriding function Get_Owned_Element
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Element::ownedElement.
--
-- The Elements owned by this element.
overriding function Get_Owner
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Elements.UML_Element_Access;
-- Getter of Element::owner.
--
-- The Element that owns this element.
overriding function All_Owned_Elements
(Self : not null access constant MOF_Tag_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Operation Element::allOwnedElements.
--
-- The query allOwnedElements() gives all of the direct and indirect owned
-- elements of an element.
overriding function Must_Be_Owned
(Self : not null access constant MOF_Tag_Proxy)
return Boolean;
-- Operation Element::mustBeOwned.
--
-- The query mustBeOwned() indicates whether elements of this type must
-- have an owner. Subclasses of Element that do not require an owner must
-- override this operation.
overriding procedure Enter_Element
(Self : not null access constant MOF_Tag_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant MOF_Tag_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant MOF_Tag_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.MOF_Tags;
|
sound/sfxasm/95.asm | NatsumiFox/Sonic-3-93-Nov-03 | 7 | 25393 | <gh_stars>1-10
95_Header:
sHeaderInit ; Z80 offset is $D0E4
sHeaderPatch 95_Patches
sHeaderTick $01
sHeaderCh $02
sHeaderSFX $80, $05, 95_FM5, $CC, $00
sHeaderSFX $80, $C0, 95_PSG3, $00, $02
95_FM5:
sPatFM $00
ssModZ80 $02, $01, $99, $E1
dc.b nCs0, $18
saVolFM $0E
sLoop $00, $03, 95_FM5
sStop
95_PSG3:
sNoisePSG $E7
ssModZ80 $01, $01, $04, $01
dc.b nC0, $0F
saVolPSG $05
sLoop $00, $03, 95_PSG3
sStop
95_Patches:
; Patch $00
; $F2
; $2A, $30, $00, $22, $0E, $11, $15, $1F
; $05, $00, $11, $02, $0B, $07, $10, $05
; $1F, $0F, $4F, $2F, $33, $10, $00, $80
spAlgorithm $02
spFeedback $06
spDetune $02, $00, $03, $02
spMultiple $0A, $00, $00, $02
spRateScale $00, $00, $00, $00
spAttackRt $0E, $15, $11, $1F
spAmpMod $00, $00, $00, $00
spSustainRt $05, $11, $00, $02
spSustainLv $01, $04, $00, $02
spDecayRt $0B, $10, $07, $05
spReleaseRt $0F, $0F, $0F, $0F
spTotalLv $33, $00, $10, $00
|
src/loader_main.asm | LittleFox94/Nyanix | 23 | 18359 |
; Copyright (c) 2019, k4m1 <<EMAIL>>
; All rights reserved. See /LICENSE for full license agreement.
;
; This code is responsible of loading the kernel from boot device, and
; then relocating it to 0x100000.
;
%include "src/consoles.asm"
%include "src/bioscall.asm"
USED_SECTORS equ (SECTOR_CNT + 1)
kernel_sectors_left:
dd 0
kernel_entry_offset:
dw 0
current_target_addr:
dd 0x100000
current_sector:
db 0
loader_main:
push bp
mov bp, sp
; sector offset on disk is set to be amount of sectors this bootloader
; uses, so that we don't waste time looking for kernel header from
; within the bootloader.
mov byte [current_sector], USED_SECTORS
; normal disk read is used to first find the kernel header, only
; then after that we'll make use of extended disk read.
;
xor ecx, ecx
mov cl, 10
.kernel_load_loop:
call load_sector
call parse_kernel_header
jc .kernel_found
add byte [current_sector], 1
loop .kernel_load_loop
; kernel was not found, notify user and halt
mov si, msg_no_kernel
call panic
.kernel_found:
; load kernel expects 3 values to be set, all these are
; set by parse_kernel_header.
; - kernel_sectors_left: size of kernel
; - kernel_entry_offset: offset to kernel entry incase there's
; junk between bootloader & kernel
; - current_target_addr: address where to read disk to, this
; starts at 0x100000
;
pusha
mov eax, dword [kernel_sectors_left]
call write_serial_hex
shr eax, 16
call write_serial_hex
popa
call load_kernel
; prepare kernel entry address to EBX & setup 32-bit protected
; mode with simple GDT & disabled interrupts
mov ebx, 0x100000
add ebx, 8 ; sizeof kernel header
cli
lgdt [gdt32]
mov eax, cr0
or al, 1
mov cr0, eax
jmp 0x08:.protected_mode_entry
.protected_mode_entry:
mov ax, 0x10
mov es, ax
mov fs, ax
mov ds, ax
mov gs, ax
mov ss, ax
jmp [ebx]
; =================================================================== ;
; End of main "logic", rest is helper functions 'n stuff ;
; =================================================================== ;
; This function loads single sector from disk to memory, sector to read
; is choosen by [current_sector]
;
load_sector:
push bp
mov bp, sp
pusha
; do disk read (int 0x13, ax = 0x0210), target = 0x2000
mov bx, 0x2000
xor cx, cx
mov cl, byte [current_sector]
xor dx, dx
mov dl, byte [boot_device] ; this we get from code at mbr.asm
.read_start:
mov di, 5
.read:
mov ax, 0x0210
call do_bios_call_13h
jnc .read_done
dec di
test di, di
jnz .read
mov si, msg_disk_read_fail
call panic
.read_done:
popa
mov sp, bp
pop bp
ret
; This function parses kernel header, setting DAP and other
; variables accordingly.
;
parse_kernel_header:
push bp
mov bp, sp
clc ; clear carry flag, we'll set it if kernel is found
pusha
mov si, 0x2000
.search:
cmp dword [si], 'nyan'
je .found_hdr
inc si
cmp si, 0x2200 ; sector size = 0x200
jl .search
; kernel was not found :(
popa
.ret:
mov sp, bp
pop bp
ret
.found_hdr:
; kernel was found :)
mov eax, dword [si+4]
mov dword [kernel_sectors_left], eax
sub si, 0x2000
mov word [kernel_entry_offset], si
mov si, msg_kernel_found
call write_serial
popa
stc
jmp .ret
; load_kernel function is basicly a loop going through
; extended disk read untill we've loaded the whole kernel.
load_kernel:
push bp
mov bp, sp
pusha
.start:
; reads happen 0x28 sectors at time MAX.
cmp dword [kernel_sectors_left], 0x28
jle .final_iteration
mov word [DAP.sector_count], 0x28
jmp .do_read
.final_iteration:
mov ax, word [kernel_sectors_left]
mov word [DAP.sector_count], ax
.do_read:
; extended disk read: int=0x13, al=0x42
mov dword [DAP.transfer_buffer], 0x2000
mov dl, byte [boot_device]
mov al, 0x42
mov si, DAP
call do_bios_call_13h
jc .fail
mov si, msg_loaded_block
call write_serial
; relocate sectors to 0x100000 onwards
; reloaction adjusts target address for us
call kernel_relocate
; adjust remaining sector count
xor eax, eax
mov ax, word [DAP.sector_count]
sub dword [kernel_sectors_left], eax
cmp dword [kernel_sectors_left], 0
jne .start
; kernel has been loaded
popa
mov sp, bp
pop bp
ret
.fail:
mov si, msg_disk_read_fail
call panic
kernel_relocate:
push bp
mov bp, sp
pusha
; relocate sectors to 0x100000 onwards
; We could also relocate less than 0x28 sectors on last read but
; it's less logic, easier code when it's like this,
; someday, and that day might never come, but someday I will optimize
; this and make it better
mov ecx, ((0x28 * 512) / 4) ; amount of dwords to reloacte
; I'd much more prefer movsd here, but that'd mean we'd need to
; either constantly swap between 32 and 16 bit mode, as atleast on
; qemu movsN does use ds:si, es:di on 32-bit unreal mode too. This
; practically means we could only load to address 0xF:FFFF at most,
; which is still in MMI/O space (usually MOBO BIOS ROM to be exact).
; swap to 32-bit mode would allow us to use esi, edi, but that'd mean
; we'd need to load our whole kernel to low memory first,
; and find enough space to somehow fit it here..
; that'd limit us a *LOT*.
;
; One way would be that constant swap between 16 and 32 bit mode,
; but that's not something I want to do.
;
.relocation_loop_start:
mov edx, dword [current_target_addr]
mov ebx, 0x2000
.loop:
mov eax, dword [ebx]
mov dword [edx], eax
add ebx, 4
add edx, 4
loop .loop
; adjust target address
inc edx
mov dword [current_target_addr], edx
popa
mov sp, bp
pop bp
ret
; Some pretty messages to print
msg_no_kernel:
db "Bootloader did not find kernel from disk :(", 0x0
msg_disk_read_fail:
db "Failed to read disk, firmware bug?", 0x0
msg_kernel_found:
db "Found kernel, loading...", 0x0A, 0x0D, 0
msg_loaded_block:
db "Loaded up to 20kb of kernel/os from disk...", 0x0A, 0x0D, 0
; =================================================================== ;
; Disk Address Packet format: ;
; ;
; Offset | Size | Desc ;
; 0 | 1 | Packet size ;
; 1 | 1 | Zero ;
; 2 | 2 | Sectors to read/write ;
; 4 | 4 | transfer-buffer 0xffff:0xffff ;
; 8 | 4 | lower 32-bits of 48-bit starting LBA ;
; 12 | 4 | upper 32-bits of 48-bit starting LBAs ;
; =================================================================== ;
DAP:
.size:
db 0x10
.zero:
db 0x00
.sector_count:
dw 0x0000
.transfer_buffer:
dd 0x00000000
.lower_lba:
dd 0x00000000
.higher_lba:
dd 0x00000000
times (USED_SECTORS * 512) - ($ - $$) db 0
|
programs/oeis/322/A322489.asm | neoneye/loda | 22 | 98720 | <reponame>neoneye/loda
; A322489: Numbers k such that k^k ends with 4.
; 2,18,22,38,42,58,62,78,82,98,102,118,122,138,142,158,162,178,182,198,202,218,222,238,242,258,262,278,282,298,302,318,322,338,342,358,362,378,382,398,402,418,422,438,442,458,462,478,482,498,502,518,522,538,542,558,562,578,582,598,602,618,622,638,642,658,662,678,682,698,702,718,722,738,742,758,762,778,782,798,802,818,822,838,842,858,862,878,882,898,902,918,922,938,942,958,962,978,982,998
mov $1,$0
add $0,1
div $0,2
mul $0,3
add $0,$1
mul $0,4
add $0,2
|
testsuite/ubivm/output/attr_real_1.asm | alexgarzao/UOP | 0 | 174411 | <reponame>alexgarzao/UOP
.constant_pool
.const 0 string [start]
.const 1 string [constructor]
.const 2 string [var1]
.const 3 real [10.990000]
.end
.entity start
.valid_context_when (always)
.method constructor
.var 0 real var1
ldconst 3 --> [10.990000]
stvar 0 --> [var1]
exit
.end
.end
|
3-mid/impact/source/2d/dynamics/joints/impact-d2-joint-distance.ads | charlie5/lace | 20 | 11237 | package impact.d2.Joint.distance
--
-- A distance joint constrains two points on two bodies
-- to remain at a fixed distance from each other. You can view
-- this as a massless, rigid rod.
--
is
type b2DistanceJoint is new b2Joint with private;
-- Distance joint definition.
-- This requires defining an anchor point on both bodies and the non-zero length of the
-- distance joint. The definition uses local anchor points so that the initial configuration
-- can violate the constraint slightly. This helps when saving and loading a game.
--
-- Warning: Do not use a zero or short length.
--
type b2DistanceJointDef is new b2JointDef with
record
localAnchorA : b2Vec2; -- The local anchor point relative to body1's origin.
localAnchorB : b2Vec2; -- The local anchor point relative to body2's origin.
length : float32; -- The natural length between the anchor points.
frequencyHz : float32; -- The mass-spring-damper frequency in Hertz.
dampingRatio : float32; -- The damping ratio. 0 = no damping, 1 = critical damping.
end record;
function to_b2DistanceJointDef return b2DistanceJointDef;
-- Initialize the bodies, anchors, and length using the world anchors.
--
procedure initialize (Self : in out b2DistanceJointDef; bodyA, bodyB : Solid_view;
anchorA, anchorB : in b2Vec2);
overriding function GetAnchorA (Self : in b2DistanceJoint) return b2Vec2;
overriding function GetAnchorB (Self : in b2DistanceJoint) return b2Vec2;
overriding function GetReactionForce (Self : in b2DistanceJoint; inv_dt : in float32) return b2Vec2;
overriding function GetReactionTorque (Self : in b2DistanceJoint; inv_dt : in float32) return float32;
-- Set/get the natural length.
-- Manipulating the length can lead to non-physical behavior when the frequency is zero.
--
function GetLength (Self : in b2DistanceJoint) return float32;
procedure SetLength (Self : in out b2DistanceJoint; length : in float32);
-- Set/get frequency in Hz.
--
function GetFrequency (Self : in b2DistanceJoint) return float32;
procedure SetFrequency (Self : in out b2DistanceJoint; hz : in float32);
-- Set/get damping ratio.
--
function GetDampingRatio (Self : in b2DistanceJoint) return float32;
procedure SetDampingRatio (Self : in out b2DistanceJoint; ratio : in float32);
function to_b2DistanceJoint (def : in b2DistanceJointDef'Class) return b2DistanceJoint;
--- 'protected' declarations
--
overriding procedure InitVelocityConstraints (Self : in out b2DistanceJoint; step : in b2TimeStep);
overriding procedure SolveVelocityConstraints (Self : in out b2DistanceJoint; step : in b2TimeStep);
overriding function SolvePositionConstraints (Self : access b2DistanceJoint; baumgarte : in float32) return Boolean;
private
type b2DistanceJoint is new b2Joint with
record
m_localAnchor1 : b2Vec2;
m_localAnchor2 : b2Vec2;
m_u : b2Vec2;
m_frequencyHz : float32;
m_dampingRatio : float32;
m_gamma : float32;
m_bias : float32;
m_impulse : float32;
m_mass : float32;
m_length : float32;
end record;
end impact.d2.Joint.distance;
|
src/net-dns.adb | stcarrez/ada-enet | 16 | 20893 | <gh_stars>10-100
-----------------------------------------------------------------------
-- net-dns -- DNS Network utilities
-- Copyright (C) 2016, 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces; use Interfaces;
with Net.Headers;
with Net.Utils;
package body Net.DNS is
-- The IN class for the DNS response (RFC 1035, 3.2.4. CLASS values).
-- Other classes are not meaningly to us.
IN_CLASS : constant Net.Uint16 := 16#0001#;
procedure Skip_Query (Packet : in out Net.Buffers.Buffer_Type);
protected body Request is
procedure Set_Result (Addr : in Net.Ip_Addr;
Time : in Net.Uint32) is
begin
Ip := Addr;
Ttl := Time;
Status := NOERROR;
end Set_Result;
procedure Set_Status (State : in Status_Type) is
begin
Status := State;
end Set_Status;
function Get_IP return Net.Ip_Addr is
begin
return Ip;
end Get_IP;
function Get_Status return Status_Type is
begin
return Status;
end Get_Status;
function Get_TTL return Net.Uint32 is
begin
return Ttl;
end Get_TTL;
end Request;
function Get_Status (Request : in Query) return Status_Type is
begin
return Request.Result.Get_Status;
end Get_Status;
-- ------------------------------
-- Get the name defined for the DNS query.
-- ------------------------------
function Get_Name (Request : in Query) return String is
begin
return Request.Name (1 .. Request.Name_Len);
end Get_Name;
-- ------------------------------
-- Get the IP address that was resolved by the DNS query.
-- ------------------------------
function Get_Ip (Request : in Query) return Net.Ip_Addr is
begin
return Request.Result.Get_IP;
end Get_Ip;
-- ------------------------------
-- Get the TTL associated with the response.
-- ------------------------------
function Get_Ttl (Request : in Query) return Net.Uint32 is
begin
return Request.Result.Get_TTL;
end Get_Ttl;
-- ------------------------------
-- Start a DNS resolution for the given hostname.
-- ------------------------------
procedure Resolve (Request : access Query;
Ifnet : access Net.Interfaces.Ifnet_Type'Class;
Name : in String;
Status : out Error_Code;
Timeout : in Duration := 10.0) is
use type Ada.Real_Time.Time;
Xid : constant Uint32 := Net.Utils.Random;
Addr : Net.Sockets.Sockaddr_In;
To : Net.Sockets.Sockaddr_In;
Buf : Net.Buffers.Buffer_Type;
C : Character;
Cnt : Net.Uint8;
begin
Request.Name_Len := Name'Length;
Request.Name (1 .. Name'Length) := Name;
Request.Result.Set_Status (PENDING);
Addr.Port := Net.Uint16 (Shift_Right (Xid, 16));
Request.Xid := Net.Uint16 (Xid and 16#0ffff#);
Request.Bind (Ifnet, Addr);
Request.Deadline := Ada.Real_Time.Clock + Ada.Real_Time.To_Time_Span (Timeout);
Net.Buffers.Allocate (Buf);
Buf.Set_Type (Net.Buffers.UDP_PACKET);
Buf.Put_Uint16 (Request.Xid);
Buf.Put_Uint16 (16#0100#);
Buf.Put_Uint16 (1);
Buf.Put_Uint16 (0);
Buf.Put_Uint16 (0);
Buf.Put_Uint16 (0);
for I in 1 .. Request.Name_Len loop
C := Request.Name (I);
if C = '.' or I = 1 then
Cnt := (if I = 1 then 1 else 0);
for J in I + 1 .. Request.Name_Len loop
C := Request.Name (J);
exit when C = '.';
Cnt := Cnt + 1;
end loop;
Buf.Put_Uint8 (Cnt);
if I = 1 then
Buf.Put_Uint8 (Character'Pos (Request.Name (1)));
end if;
else
Buf.Put_Uint8 (Character'Pos (C));
end if;
end loop;
Buf.Put_Uint8 (0);
Buf.Put_Uint16 (Net.Uint16 (A_RR));
Buf.Put_Uint16 (IN_CLASS);
To.Port := Net.Headers.To_Network (53);
To.Addr := Ifnet.Dns;
Request.Send (To, Buf, Status);
end Resolve;
-- ------------------------------
-- Save the answer received from the DNS server. This operation is called for each answer
-- found in the DNS response packet. The Index is incremented at each answer. For example
-- a DNS server can return a CNAME_RR answer followed by an A_RR: the operation is called
-- two times.
--
-- This operation can be overriden to implement specific actions when an answer is received.
-- ------------------------------
procedure Answer (Request : in out Query;
Status : in Status_Type;
Response : in Response_Type;
Index : in Natural) is
pragma Unreferenced (Index);
begin
if Status /= NOERROR then
Request.Result.Set_Status (Status);
elsif Response.Of_Type = A_RR then
Request.Result.Set_Result (Response.Ip, Response.Ttl);
end if;
end Answer;
procedure Skip_Query (Packet : in out Net.Buffers.Buffer_Type) is
Cnt : Net.Uint8;
begin
loop
Cnt := Packet.Get_Uint8;
exit when Cnt = 0;
Packet.Skip (Net.Uint16 (Cnt));
end loop;
-- Skip QTYPE and QCLASS in query.
Packet.Skip (2);
Packet.Skip (2);
end Skip_Query;
overriding
procedure Receive (Request : in out Query;
From : in Net.Sockets.Sockaddr_In;
Packet : in out Net.Buffers.Buffer_Type) is
pragma Unreferenced (From);
Val : Net.Uint16;
Answers : Net.Uint16;
Ttl : Net.Uint32;
Len : Net.Uint16;
Cls : Net.Uint16;
Status : Status_Type;
begin
Val := Packet.Get_Uint16;
if Val /= Request.Xid then
return;
end if;
Val := Packet.Get_Uint16;
if (Val and 16#ff00#) /= 16#8100# then
return;
end if;
if (Val and 16#0F#) /= 0 then
case Val and 16#0F# is
when 1 =>
Status := FORMERR;
when 2 =>
Status := SERVFAIL;
when 3 =>
Status := NXDOMAIN;
when 4 =>
Status := NOTIMP;
when 5 =>
Status := REFUSED;
when others =>
Status := OTHERERROR;
end case;
Query'Class (Request).Answer (Status, Response_Type '(Kind => V_NONE, Len => 0,
Class => 0,
Of_Type => 0, Ttl => 0), 0);
return;
end if;
Val := Packet.Get_Uint16;
Answers := Packet.Get_Uint16;
if Val /= 1 or else Answers = 0 then
Query'Class (Request).Answer (SERVFAIL, Response_Type '(Kind => V_NONE, Len => 0,
Class => 0,
Of_Type => 0, Ttl => 0), 0);
return;
end if;
Packet.Skip (4);
Skip_Query (Packet);
for I in 1 .. Answers loop
Packet.Skip (2);
Val := Packet.Get_Uint16;
Cls := Packet.Get_Uint16;
Ttl := Packet.Get_Uint32;
Len := Packet.Get_Uint16;
if Cls = IN_CLASS and Len < Net.Uint16 (DNS_VALUE_MAX_LENGTH) then
case RR_Type (Val) is
when A_RR =>
declare
Response : constant Response_Type
:= Response_Type '(Kind => V_IPV4, Len => Natural (Len),
Of_Type => RR_Type (Val), Ttl => Ttl,
Class => Cls, Ip => Packet.Get_Ip);
begin
Query'Class (Request).Answer (NOERROR, Response, Natural (I));
end;
when CNAME_RR | TXT_RR | MX_RR | NS_RR | PTR_RR =>
declare
Response : Response_Type
:= Response_Type '(Kind => V_TEXT, Len => Natural (Len),
Of_Type => RR_Type (Val), Ttl => Ttl,
Class => Cls, others => <>);
begin
for J in Response.Text'Range loop
Response.Text (J) := Character'Val (Packet.Get_Uint8);
end loop;
Query'Class (Request).Answer (NOERROR, Response, Natural (I));
end;
when others =>
-- Ignore this answer: we don't know its type.
Packet.Skip (Len);
end case;
else
-- Ignore this anwser.
Packet.Skip (Len);
end if;
end loop;
end Receive;
end Net.DNS;
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-cgideb.adb | orb-zhuchen/Orb | 0 | 29359 | <filename>support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-cgideb.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . C G I . D E B U G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2000-2019, 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 Ada.Strings.Unbounded;
package body GNAT.CGI.Debug is
use Ada.Strings.Unbounded;
-- Define the abstract type which act as a template for all debug IO modes.
-- To create a new IO mode you must:
-- 1. create a new package spec
-- 2. create a new type derived from IO.Format
-- 3. implement all the abstract routines in IO
package IO is
type Format is abstract tagged null record;
function Output (Mode : Format'Class) return String;
function Variable
(Mode : Format;
Name : String;
Value : String) return String is abstract;
-- Returns variable Name and its associated value
function New_Line (Mode : Format) return String is abstract;
-- Returns a new line such as this concatenated between two strings
-- will display the strings on two lines.
function Title (Mode : Format; Str : String) return String is abstract;
-- Returns Str as a Title. A title must be alone and centered on a
-- line. Next output will be on the following line.
function Header
(Mode : Format;
Str : String) return String is abstract;
-- Returns Str as an Header. An header must be alone on its line. Next
-- output will be on the following line.
end IO;
----------------------
-- IO for HTML Mode --
----------------------
package HTML_IO is
-- See IO for comments about these routines
type Format is new IO.Format with null record;
function Variable
(IO : Format;
Name : String;
Value : String) return String;
function New_Line (IO : Format) return String;
function Title (IO : Format; Str : String) return String;
function Header (IO : Format; Str : String) return String;
end HTML_IO;
----------------------------
-- IO for Plain Text Mode --
----------------------------
package Text_IO is
-- See IO for comments about these routines
type Format is new IO.Format with null record;
function Variable
(IO : Format;
Name : String;
Value : String) return String;
function New_Line (IO : Format) return String;
function Title (IO : Format; Str : String) return String;
function Header (IO : Format; Str : String) return String;
end Text_IO;
--------------
-- Debug_IO --
--------------
package body IO is
------------
-- Output --
------------
function Output (Mode : Format'Class) return String is
Result : Unbounded_String;
begin
Result :=
To_Unbounded_String
(Title (Mode, "CGI complete runtime environment")
& Header (Mode, "CGI parameters:")
& New_Line (Mode));
for K in 1 .. Argument_Count loop
Result := Result
& Variable (Mode, Key (K), Value (K))
& New_Line (Mode);
end loop;
Result := Result
& New_Line (Mode)
& Header (Mode, "CGI environment variables (Metavariables):")
& New_Line (Mode);
for P in Metavariable_Name'Range loop
if Metavariable_Exists (P) then
Result := Result
& Variable (Mode,
Metavariable_Name'Image (P),
Metavariable (P))
& New_Line (Mode);
end if;
end loop;
return To_String (Result);
end Output;
end IO;
-------------
-- HTML_IO --
-------------
package body HTML_IO is
NL : constant String := (1 => ASCII.LF);
function Bold (S : String) return String;
-- Returns S as an HTML bold string
function Italic (S : String) return String;
-- Returns S as an HTML italic string
----------
-- Bold --
----------
function Bold (S : String) return String is
begin
return "<b>" & S & "</b>";
end Bold;
------------
-- Header --
------------
function Header (IO : Format; Str : String) return String is
pragma Unreferenced (IO);
begin
return "<h2>" & Str & "</h2>" & NL;
end Header;
------------
-- Italic --
------------
function Italic (S : String) return String is
begin
return "<i>" & S & "</i>";
end Italic;
--------------
-- New_Line --
--------------
function New_Line (IO : Format) return String is
pragma Unreferenced (IO);
begin
return "<br>" & NL;
end New_Line;
-----------
-- Title --
-----------
function Title (IO : Format; Str : String) return String is
pragma Unreferenced (IO);
begin
return "<p align=center><font size=+2>" & Str & "</font></p>" & NL;
end Title;
--------------
-- Variable --
--------------
function Variable
(IO : Format;
Name : String;
Value : String) return String
is
pragma Unreferenced (IO);
begin
return Bold (Name) & " = " & Italic (Value);
end Variable;
end HTML_IO;
-------------
-- Text_IO --
-------------
package body Text_IO is
------------
-- Header --
------------
function Header (IO : Format; Str : String) return String is
begin
return "*** " & Str & New_Line (IO);
end Header;
--------------
-- New_Line --
--------------
function New_Line (IO : Format) return String is
pragma Unreferenced (IO);
begin
return String'(1 => ASCII.LF);
end New_Line;
-----------
-- Title --
-----------
function Title (IO : Format; Str : String) return String is
Spaces : constant Natural := (80 - Str'Length) / 2;
Indent : constant String (1 .. Spaces) := (others => ' ');
begin
return Indent & Str & New_Line (IO);
end Title;
--------------
-- Variable --
--------------
function Variable
(IO : Format;
Name : String;
Value : String) return String
is
pragma Unreferenced (IO);
begin
return " " & Name & " = " & Value;
end Variable;
end Text_IO;
-----------------
-- HTML_Output --
-----------------
function HTML_Output return String is
HTML : HTML_IO.Format;
begin
return IO.Output (Mode => HTML);
end HTML_Output;
-----------------
-- Text_Output --
-----------------
function Text_Output return String is
Text : Text_IO.Format;
begin
return IO.Output (Mode => Text);
end Text_Output;
end GNAT.CGI.Debug;
|
oeis/278/A278692.asm | neoneye/loda-programs | 11 | 15437 | ; A278692: Pisot sequence T(4,14).
; Submitted by <NAME>
; 4,14,49,171,596,2077,7238,25223,87897,306303,1067403,3719680,12962320,45171020,157411717,548547468,1911575138,6661446313,23213770727,80895217952,281903201529,982374694626,3423373822671,11929753885009,41572739387791,144872448909191,504850696923520,1759300875378480
add $0,3
lpb $0
sub $0,1
mov $2,$1
add $1,$3
max $2,2
trn $5,3
add $5,2
add $5,$4
mov $3,$5
add $4,$1
add $5,$2
add $1,$5
add $5,1
lpe
mov $0,$4
div $0,6
|
4-high/gel/source/concrete/gel-mouse-local.adb | charlie5/lace | 20 | 26993 | with
ada.unchecked_Deallocation;
package body gel.Mouse.local
is
package body Forge
is
function to_Mouse (of_Name : in String) return Item
is
begin
return Self : constant Item := (lace.Subject.local.Forge.to_Subject (of_Name)
with null record)
do
null;
end return;
end to_Mouse;
function new_Mouse (of_Name : in String) return View
is
begin
return new Item' (to_Mouse (of_Name));
end new_Mouse;
end Forge;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
Self.destroy;
deallocate (Self);
end free;
end gel.Mouse.local;
|
external/source/shellcode/windows/msf2/win32_stage_uploadexec.asm | madhavarao-yejarla/VoIP | 35 | 21118 | ; Title: Win32 Network Shell
; Platforms: Windows NT 4.0, Windows 2000, Windows XP, Windows 2003
; Author: <EMAIL>[<EMAIL>
[BITS 32]
%ifndef FN_RECV
%define FN_RECV [ebp + 24]
%endif
%define BLOCKSZ 32
; [ebp + 0] = kernel32.dll base
; [ebp + 4] = LGetProcAddress
; [ebp + 8] = LoadLibraryA
; edi = socket
; ebx = handle of temp file
; esi = bytes left to read
; [ebp+100] = CreateFileA
; [ebp+104] = WriteFile
; [ebp+108] = CloseHandle
; [ebp+112] = file name
; [ebp+116] = recv buffer
; [ebp+120] = remaining bytes
; [ebp+124] = storage space
LLoadFileAPI:
push dword [ebp]
push 0x7c0017a5 ; CreateFileA
call [ebp + 4]
mov [ebp+100], eax
push dword [ebp]
push 0xe80a791f ; WriteFile
call [ebp + 4]
mov [ebp+104], eax
push dword [ebp]
push 0x0ffd97fb ; CloseHandle
call [ebp + 4]
mov [ebp+108], eax
LReadFileLength: ; recv(s, buff, 4, 0)
lea eax, [ebp+120]
push byte 0x00 ; flags
push 4 ; length
push eax ; buffer
push dword edi ; socket
call FN_RECV ; recv()
mov eax, [ebp+120] ; remaining bytes
call LGetFileName ; get ptr to file name
; temporary file name
db "C:\metasploit.exe", 0x00
LGetFileName:
pop ecx
mov [ebp+112], ecx
LCreateFile:
push byte 0 ; template
push byte 6 ; FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM
push byte 4 ; OPEN_ALWAYS
push byte 0 ; lpSecurityAttributes=null
push byte 7 ; FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;
push 0xe0000000 ; GENERIC_EXECUTE | GENERIC_READ | GENERIC_WRITE
push ecx ; file name
call [ebp+100]
mov ebx, eax ; Handle in ebx
LConfigBuffer:
; lea eax, [esp-BLOCKSZ-200] ; leave some room
sub esp, BLOCKSZ - 200
; shr eax, 2
; shl eax, 2
mov [ebp+116], esp ; store it away
LReadSocket: ; recv(s, buff, 4096, 0)
mov eax, [ebp+116] ; recv buffer ptr
push byte 0x00 ; flags
push BLOCKSZ ; length
push eax ; buffer
push dword edi ; socket
call FN_RECV ; recv()
mov ecx, [ebp+120] ; remaining bytes
sub ecx, eax ; subtract recv
mov [ebp+120], ecx ; put it back
LWriteFile:
push esp ; create storage
mov ecx, esp ; get storage space
push byte 0 ; not overlapped
push ecx ; &written
push eax ; recv len
push dword [ebp+116] ; source buffer
push ebx ; file handle
call [ebp+104] ; WriteFile
pop ecx ; remove storage
mov eax, [ebp+120] ; remaining bytes
test eax, eax ; are we at zero?
jnz LReadSocket ; go read some more
LCloseHandle:
push ebx
call [ebp+108]
LCreateProcessStructs:
xchg edi, edx ; save edi to edx
xor eax,eax ; overwrite with null
lea edi, [esp-84] ; struct sizes
push byte 21 ; 21 * 4 = 84
pop ecx ; set counter
LBZero:
rep stosd ; overwrite with null
xchg edi, edx ; restore edi
LCreateStructs:
sub esp, 84
mov byte [esp + 16], 68 ; si.cb = sizeof(si)
mov word [esp + 60], 0x0101 ; si.dwflags
; socket handles
mov [esp + 16 + 56], edi
mov [esp + 16 + 60], edi
mov [esp + 16 + 64], edi
lea eax, [esp + 16] ; si
push esp ; pi
push eax
push ecx
push ecx
push ecx
inc ecx
push ecx
dec ecx
push ecx
push ecx
push dword [ebp+112]
push ecx
LCreateProcessA:
push dword [ebp] ; kernel32.dll
push 0x16b3fe72 ; CreateProcessA
call [ebp + 4]
call eax
mov esi, esp
LWaitForSingleObject:
push dword [ebp] ; kernel32.dll
push 0xce05d9ad ; WaitForSingleObject
call [ebp + 4]
mov ebx, eax
push 0xFFFFFFFF
push dword [esi]
call ebx
LDeathBecomesYou:
push dword [ebp] ; kernel32.dll
push 0x73e2d87e ; ExitProcess
call [ebp + 4]
xor ebx, ebx
push ebx
call eax
|
_build/dispatcher/jmp_ippsECCPGetSizeStd128r2_5e98172d.asm | zyktrcn/ippcp | 1 | 24539 | <reponame>zyktrcn/ippcp
extern m7_ippsECCPGetSizeStd128r2:function
extern n8_ippsECCPGetSizeStd128r2:function
extern y8_ippsECCPGetSizeStd128r2:function
extern e9_ippsECCPGetSizeStd128r2:function
extern l9_ippsECCPGetSizeStd128r2:function
extern n0_ippsECCPGetSizeStd128r2:function
extern k0_ippsECCPGetSizeStd128r2:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsECCPGetSizeStd128r2
.Larraddr_ippsECCPGetSizeStd128r2:
dq m7_ippsECCPGetSizeStd128r2
dq n8_ippsECCPGetSizeStd128r2
dq y8_ippsECCPGetSizeStd128r2
dq e9_ippsECCPGetSizeStd128r2
dq l9_ippsECCPGetSizeStd128r2
dq n0_ippsECCPGetSizeStd128r2
dq k0_ippsECCPGetSizeStd128r2
segment .text
global ippsECCPGetSizeStd128r2:function (ippsECCPGetSizeStd128r2.LEndippsECCPGetSizeStd128r2 - ippsECCPGetSizeStd128r2)
.Lin_ippsECCPGetSizeStd128r2:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsECCPGetSizeStd128r2:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsECCPGetSizeStd128r2]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsECCPGetSizeStd128r2:
|
alloy4fun_models/trashltl/models/5/wMuQiqnKJru8rqRJ3.als | Kaixi26/org.alloytools.alloy | 0 | 9 | <gh_stars>0
open main
pred idwMuQiqnKJru8rqRJ3_prop6 {
once File in Trash since File in Trash
}
pred __repair { idwMuQiqnKJru8rqRJ3_prop6 }
check __repair { idwMuQiqnKJru8rqRJ3_prop6 <=> prop6o } |
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_482.asm | ljhsiun2/medusa | 9 | 23471 | <filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_482.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xcc65, %rsi
lea addresses_UC_ht+0x106a5, %rdi
nop
nop
cmp %r11, %r11
mov $81, %rcx
rep movsw
nop
nop
nop
nop
sub %r9, %r9
lea addresses_WT_ht+0x159dd, %r10
dec %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
movups %xmm0, (%r10)
nop
nop
nop
nop
nop
sub %r9, %r9
lea addresses_WC_ht+0x8d5d, %r10
nop
xor %r8, %r8
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
cmp %rdi, %rdi
lea addresses_WC_ht+0xbc1d, %rsi
lea addresses_WT_ht+0xbc5d, %rdi
nop
nop
nop
sub %r8, %r8
mov $69, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp $18959, %r10
lea addresses_WT_ht+0xc95d, %rsi
lea addresses_normal_ht+0x120fd, %rdi
add $19483, %r14
mov $81, %rcx
rep movsw
nop
and $47547, %r10
lea addresses_normal_ht+0xcb7c, %r8
dec %rdi
vmovups (%r8), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r14
nop
nop
nop
nop
nop
lfence
lea addresses_normal_ht+0xcd5d, %r11
nop
nop
nop
nop
dec %r10
mov $0x6162636465666768, %r8
movq %r8, %xmm1
and $0xffffffffffffffc0, %r11
movaps %xmm1, (%r11)
nop
nop
sub $24137, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %rcx
push %rdi
// Faulty Load
mov $0x12cd2c000000015d, %rcx
nop
nop
nop
xor %r11, %r11
mov (%rcx), %r15w
lea oracles, %r12
and $0xff, %r15
shlq $12, %r15
mov (%r12,%r15,1), %r15
pop %rdi
pop %rcx
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_186.asm | ljhsiun2/medusa | 9 | 179671 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x11d88, %rsi
lea addresses_WT_ht+0x1a7e8, %rdi
add %r13, %r13
mov $11, %rcx
rep movsl
sub $3631, %r9
lea addresses_UC_ht+0xc3a8, %rbx
add $4352, %rdx
movups (%rbx), %xmm5
vpextrq $0, %xmm5, %rdi
nop
nop
nop
nop
cmp $62068, %r13
lea addresses_normal_ht+0x5db8, %rbx
nop
nop
nop
inc %r13
mov $0x6162636465666768, %rdx
movq %rdx, (%rbx)
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x5ee8, %r9
nop
nop
and %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, %xmm2
movups %xmm2, (%r9)
nop
nop
mfence
lea addresses_WT_ht+0x15688, %rsi
lea addresses_UC_ht+0x15168, %rdi
clflush (%rsi)
xor %rdx, %rdx
mov $4, %rcx
rep movsl
nop
nop
nop
nop
xor $27682, %rdi
lea addresses_A_ht+0x1bde8, %rdx
nop
nop
nop
nop
nop
and $7263, %r13
mov $0x6162636465666768, %rdi
movq %rdi, (%rdx)
nop
nop
nop
xor %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %rbx
push %rcx
push %rdx
push %rsi
// Store
lea addresses_UC+0x75e8, %rsi
nop
nop
nop
nop
lfence
movw $0x5152, (%rsi)
nop
nop
nop
nop
sub %r10, %r10
// Faulty Load
lea addresses_UC+0x75e8, %rsi
xor $37968, %r8
mov (%rsi), %r10
lea oracles, %rcx
and $0xff, %r10
shlq $12, %r10
mov (%rcx,%r10,1), %r10
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
programs/oeis/100/A100156.asm | neoneye/loda | 22 | 9407 | <filename>programs/oeis/100/A100156.asm<gh_stars>10-100
; A100156: Structured truncated tetrahedral numbers.
; 1,12,44,108,215,376,602,904,1293,1780,2376,3092,3939,4928,6070,7376,8857,10524,12388,14460,16751,19272,22034,25048,28325,31876,35712,39844,44283,49040,54126,59552,65329,71468,77980,84876,92167,99864,107978,116520,125501,134932,144824,155188,166035,177376,189222,201584,214473,227900,241876,256412,271519,287208,303490,320376,337877,356004,374768,394180,414251,434992,456414,478528,501345,524876,549132,574124,599863,626360,653626,681672,710509,740148,770600,801876,833987,866944,900758,935440,971001,1007452,1044804,1083068,1122255,1162376,1203442,1245464,1288453,1332420,1377376,1423332,1470299,1518288,1567310,1617376,1668497,1720684,1773948,1828300
mov $2,1
lpb $0
add $2,5
trn $3,$0
add $4,5
add $2,$4
add $3,1
sub $0,$3
add $1,$2
add $4,6
lpe
add $1,1
mov $0,$1
|
y2s2/csa/tutorials/t9-code/t9q6.asm | ouldevloper/university | 8 | 97158 | .MODEL SMALL
.STACK 100
.DATA
INPROMPT DB "Please enter 5 decimal digits >> $"
OUTPROMPT DB "The largest value in the list is >> $"
NL DB 13,10,'$'
DIGITS LABEL BYTE
MAXN DB 6
ACTN DB ?
ACTSTR DB 20 DUP('$')
LARGEST DB ?
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
; ASK FOR 5 DIGITS
MOV AH, 09H
LEA DX, INPROMPT
INT 21H
MOV AH, 0AH
LEA DX, DIGITS
INT 21H
MOV AH, 09H
LEA DX, NL
INT 21H
; MOVE LAST NUMBER IN
LEA DI, ACTSTR
MOV BL, [DI]
MOV LARGEST, BL
INC DI
; CHECK-AND-COMPARE
MOV CX, 4
MAX:
MOV BL, [DI]
CMP BL, LARGEST
JLE CONTINUE
; IF LARGEST, MOVE IN
MOV BL, [DI]
MOV LARGEST, BL
; ELSE, JUST CONT
CONTINUE:
INC DI
LOOP MAX
; DISPLAY LARGEST VALUE
MOV AH, 9H
LEA DX, OUTPROMPT
INT 21H
MOV AH, 02H
MOV DL, LARGEST
INT 21H
MOV AX,4C00H
INT 21H
MAIN ENDP
END MAIN |
programs/oeis/047/A047283.asm | karttu/loda | 0 | 83711 | <reponame>karttu/loda
; A047283: Numbers that are congruent to {0, 1, 3, 6} mod 7.
; 0,1,3,6,7,8,10,13,14,15,17,20,21,22,24,27,28,29,31,34,35,36,38,41,42,43,45,48,49,50,52,55,56,57,59,62,63,64,66,69,70,71,73,76,77,78,80,83,84,85,87,90,91,92,94,97,98,99,101,104,105,106,108,111
add $0,5
mov $1,$0
div $1,4
mul $1,2
mov $2,$0
lpb $2,1
mov $3,$0
add $3,1
mov $0,$3
sub $2,4
lpe
add $1,$0
sub $1,8
|
Exam/2017-08/P2.agda | nicolabotta/DSLsofMath | 248 | 10126 | -- Problem 2: Multiplication for matrices (from the matrix algebra DSL).
module P2 where
-- 2a: Type the variables in the text.
-- (This answer uses Agda syntax, but that is not required.)
postulate Nat : Set
postulate V : Nat -> Set -> Set
postulate Fin : Nat -> Set
Op : Set -> Set
Op a = a -> a -> a
postulate sum : {n : Nat} {a : Set} -> Op a -> V n a -> a
postulate zipWith : {n : Nat} {a : Set} -> Op a -> V n a -> V n a -> V n a
data M (m n : Nat) (a : Set) : Set where
matrix : (Fin m -> Fin n -> a) -> M m n a
record Dummy (a : Set) : Set where
field
m : Nat
n : Nat
A : M m n a
p : Nat
B : M n p a
i : Fin m
j : Fin p
-- 2b: Type |mul| and |proj|
postulate
proj : {m n : Nat} {a : Set} -> Fin m -> Fin n -> M m n a -> a
mul : {m n p : Nat} {a : Set} -> Op a -> Op a ->
M m n a -> M n p a -> M m p a
-- 2c: Implement |mul|.
postulate
row : {m n : Nat} {a : Set} -> Fin m -> M m n a -> V n a
col : {m n : Nat} {a : Set} -> Fin n -> M m n a -> V m a
mul addE mulE A B = matrix (\i j ->
sum addE (zipWith mulE (row i A) (col j B)))
|
nasm assembly/assgnment 3/qs_5.asm | AI-Factor-y/NASM-library | 0 | 89505 | section .data
msg2 : db 'enter a string : '
l2 : equ $-msg2
msg3 : db 'number of spaces is : '
l3 : equ $-msg3
space:db ' '
newline:db '',10
nwl :db ' ',10
nwl_l : equ $-nwl
section .bss
string_len : resd 1
string_1: resb 50
num: resd 1
strlen: resd 1
temp : resb 1
section .text
global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, msg2
mov edx, l2
int 80h
mov ebx, string_1
call read_array_string
mov ebx, string_1
call count_spaces
mov eax, 4
mov ebx, 1
mov ecx, nwl
mov edx, nwl_l
int 80h
exit:
mov eax, 1
mov ebx, 0
int 80h
;; section for procedures
;;--------------------------
count_spaces:
; the two strings should be in ebx and ecx
; the resut of concatenation is stored in result_concat_string
section .bss
count_val : resd 1
counter_i : resd 1
section .text
push rax
push rbx
push rcx
mov word[counter_i],0
mov dword[count_val],0
space_loop:
mov eax,[counter_i]
mov cl, byte[ebx+eax]
cmp cl, 0
je exit_space_loop
cmp cl,' '
jne not_space
inc dword[count_val]
not_space:
inc dword[counter_i]
jmp space_loop
exit_space_loop:
mov eax, 4
mov ebx, 1
mov ecx, msg3
mov edx, l3
int 80h
mov ax,word[count_val]
mov word[num],ax
call print_num
pop rcx
pop rbx
pop rax
ret
debugger:
section .data
msg_debugger : db 'debug here --',10
msg_debugger_l : equ $-msg_debugger
section .text
push rax
push rbx
push rcx
; debug----
mov eax, 4
mov ebx, 1
mov ecx, msg_debugger
mov edx, msg_debugger_l
int 80h
;debug ---
pop rcx
pop rbx
pop rax
; action
ret
print_num:
;usage
;------
; 1: create a variable num(word)
; 2: move number to print to num (word)
section .data
nwl_for_printnum :db ' ',10
nwl_l_printnum : equ $-nwl_for_printnum
section .bss
count_printnum : resb 10
temp_printnum : resb 1
section .text
push rax ; push all
push rbx
push rcx
mov byte[count_printnum],0
;call push_reg
extract_no:
cmp word[num], 0
je print_no
inc byte[count_printnum]
mov dx, 0
mov ax, word[num]
mov bx, 10
div bx
push dx ; recursion here
mov word[num], ax
jmp extract_no
print_no:
cmp byte[count_printnum], 0
je end_print
dec byte[count_printnum]
pop dx
mov byte[temp_printnum], dl ; dx is further divided into dh and dl
add byte[temp_printnum], 30h
mov eax, 4
mov ebx, 1
mov ecx, temp_printnum
mov edx, 1
int 80h
jmp print_no
end_print:
mov eax,4
mov ebx,1
mov ecx,nwl_for_printnum
mov edx,nwl_l_printnum
int 80h
;;The memory location ’newline’ should be declared with the ASCII key for new popa
;call pop_reg
pop rcx
pop rbx
pop rax ; pop all
ret
read_array_string:
;; usage
;--------
; 1: string is read and stored in string variable
; 2: string length is stored in string_len
push rax
push rbx
push rcx
mov word[string_len],0
reading:
push rbx
mov eax, 3
mov ebx, 0
mov ecx, temp
mov edx, 1
int 80h
pop rbx
cmp byte[temp], 10 ;; check if the input is ’Enter’
je end_reading
inc byte[string_len]
mov al,byte[temp]
mov byte[ebx], al
inc ebx
jmp reading
end_reading:
;; Similar to putting a null character at the end of a string
mov byte[ebx], 0
pop rcx
pop rbx
pop rax
ret
print_array_string:
;; usage
;-----------
; 1: base address of string to print is stored in ebx
push rax
push rbx
push rcx
printing:
mov al, byte[ebx]
mov byte[temp], al
cmp byte[temp], 0 ;; checks if the character is NULL character
je end_printing
push rbx
mov eax, 4
mov ebx, 1
mov ecx, temp
mov edx, 1
int 80h
pop rbx
inc ebx
jmp printing
end_printing:
pop rcx
pop rbx
pop rax
ret
|
source/oasis/program-elements-incomplete_type_definitions.ads | optikos/oasis | 0 | 28663 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Lexical_Elements;
package Program.Elements.Incomplete_Type_Definitions is
pragma Pure (Program.Elements.Incomplete_Type_Definitions);
type Incomplete_Type_Definition is
limited interface and Program.Elements.Definitions.Definition;
type Incomplete_Type_Definition_Access is
access all Incomplete_Type_Definition'Class with Storage_Size => 0;
not overriding function Has_Tagged
(Self : Incomplete_Type_Definition)
return Boolean is abstract;
type Incomplete_Type_Definition_Text is limited interface;
type Incomplete_Type_Definition_Text_Access is
access all Incomplete_Type_Definition_Text'Class with Storage_Size => 0;
not overriding function To_Incomplete_Type_Definition_Text
(Self : aliased in out Incomplete_Type_Definition)
return Incomplete_Type_Definition_Text_Access is abstract;
not overriding function Tagged_Token
(Self : Incomplete_Type_Definition_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Incomplete_Type_Definitions;
|
oeis/017/A017766.asm | neoneye/loda-programs | 11 | 105509 | <reponame>neoneye/loda-programs
; A017766: Binomial coefficients C(50,n).
; 1,50,1225,19600,230300,2118760,15890700,99884400,536878650,2505433700,10272278170,37353738800,121399651100,354860518600,937845656300,2250829575120,4923689695575,9847379391150,18053528883775,30405943383200,47129212243960,67327446062800,88749815264600,108043253365600,121548660036300,126410606437752,121548660036300,108043253365600,88749815264600,67327446062800,47129212243960,30405943383200,18053528883775,9847379391150,4923689695575,2250829575120,937845656300,354860518600,121399651100,37353738800
mov $1,50
bin $1,$0
mov $0,$1
|
1-base/lace/source/environ/lace-environ-paths.adb | charlie5/lace | 20 | 27848 | with
lace.Environ.OS_Commands,
lace.Text.utility,
posix.file_Status,
posix.Calendar,
shell.Directory_Iteration,
lace.Text.all_Tokens,
ada.Strings.fixed,
ada.Characters.handling,
ada.Directories,
ada.Direct_IO,
ada.Tags,
ada.Text_IO,
ada.IO_Exceptions;
package body lace.Environ.Paths
is
-----------
--- General
--
function "+" (Source : in unbounded_String) return String
renames to_String;
function expand_GLOB (GLOB : in String) return String
is
use ada.Text_IO;
FileName : constant File := +"/tmp/lace_environ_temporary_shell.sh";
File : File_Type;
begin
create (File, out_File, +Filename);
put_Line (File, "echo " & GLOB);
close (File);
change_Mode (Path (Filename), to => "a+rwx");
declare
use lace.Environ.OS_Commands;
Output : constant String := run_OS ("bash " & (+Filename));
begin
rid_File (Filename);
return Output;
end;
end expand_GLOB;
---------
--- Paths
--
function to_String (Self : in Path'Class) return String
is
begin
return to_String (Self.Name);
end to_String;
procedure check (Self : in Path'Class)
is
use ada.Tags,
ada.Strings.fixed,
ada.Characters.handling;
Tag_full_Name : constant String := to_Lower (ada.Tags.expanded_Name (Self'Tag));
Tag_Name : constant String := (if Self'Tag = Folder'Tag then Tail (Tag_full_Name, 6)
else Tail (Tag_full_Name, 4));
begin
if Self.Name = ""
then
raise Error with "No " & Tag_Name & " specified.";
end if;
if not Exists (Self)
then
raise Error with Tag_Name & " '" & (+Self) & "' does not exist.";
end if;
end check;
procedure link (Self, To : in Path)
is
begin
check (Self);
declare
use lace.Environ.OS_Commands;
Output : constant String := run_OS ( "ln -s "
& (+Self)
& " "
& (+To));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
end link;
procedure change_Mode (Self : in Path;
To : in String)
is
begin
check (Self);
declare
use lace.Environ.OS_Commands;
Output : constant String := run_OS ("chmod -R " & To & " " & (+Self));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
end change_Mode;
procedure change_Owner (Self : in Path;
To : in String)
is
begin
check (Self);
declare
use lace.Environ.OS_Commands;
Output : constant String := run_OS ("chown -R " & To & " " & (+Self));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
end change_Owner;
function Exists (Self : in Path) return Boolean
is
begin
if +Self = ""
then
raise Error with "No path specified.";
end if;
return ada.Directories.Exists (+Self);
end Exists;
function is_Folder (Self : in Path) return Boolean
is
use ada.Directories;
begin
check (Self);
return Kind (+Self) = Directory;
end is_Folder;
function is_File (Self : in Path) return Boolean
is
use ada.Directories;
begin
check (Self);
return Kind (+Self) = Ordinary_File;
end is_File;
function is_Special (Self : in Path) return Boolean
is
use ada.Directories;
begin
check (Self);
return Kind (+Self) = Special_File;
end is_Special;
function is_Absolute (Self : in Path) return Boolean
is
begin
if Length (Self.Name) = 0
then
return False;
end if;
return Element (Self.Name, 1) = '/';
end is_Absolute;
function is_Relative (Self : in Path) return Boolean
is
begin
return not is_Absolute (Self);
end is_Relative;
function modify_Time (Self : in Path) return ada.Calendar.Time
is
begin
check (Self);
declare
use POSIX,
POSIX.Calendar,
POSIX.File_Status;
the_Status : constant Status := get_File_Status (pathname => to_POSIX_String (+Self));
Time : constant POSIX_Time := last_modification_Time_of (the_Status);
begin
return to_Time (Time);
end;
end modify_Time;
function Parent (Self : in Path'Class) return Folder
is
begin
declare
use ada.Strings;
Index : constant Natural := fixed.Index (+Self, "/", going => Backward);
begin
if Index = 0
then
return no_Folder;
elsif Index = 1
then
return +"/";
end if;
declare
Result : Folder;
begin
Result.Name := Head (Self.Name,
Count => Index - 1);
return Result;
end;
end;
end Parent;
function Name (Self : in Path) return String
is
begin
return +Self.Name;
end Name;
function Simple (Self : in Path) return String
is
begin
check (Self);
declare
use ada.Strings;
Idx : constant Natural := Index (Self.Name, "/", going => Backward);
Last : constant Natural := Length (Self.Name);
begin
if Idx = 0
then
return +Self;
else
return Slice (Self.Name, Low => Idx + 1,
High => Last);
end if;
end;
end Simple;
-----------
--- Folders
--
function to_Folder (Name : in String) return Folder
is
begin
return (Name => To_Unbounded_String (Name));
end to_Folder;
function "+" (Left : in Folder; Right : in Folder) return Folder
is
R_Folder : constant String := (if Right.is_Absolute then Right.Simple
else +Right);
Result : Folder;
begin
Result.Name := Left.Name;
append (Result.Name, "/" & R_Folder);
return Result;
end "+";
function "+" (Left : in Folder'Class;
Right : in File 'Class) return File
is
R_File : constant String := (if Right.is_Absolute then Right.Simple
else +Right);
Result : File;
begin
Result.Name := Left.Name;
append (Result.Name, "/" & R_File);
return Result;
end "+";
function current_Folder return Folder
is
begin
return +ada.Directories.current_Directory;
end current_Folder;
protected folder_Lock
is
entry change (To : in Folder);
procedure clear;
private
Locked : Boolean := False;
end folder_Lock;
protected body folder_Lock
is
entry change (To : in Folder)
when not Locked
is
begin
check (To);
ada.Directories.set_Directory (+To);
Locked := True;
end change;
procedure clear
is
begin
Locked := False;
end clear;
end folder_Lock;
procedure go_to_Folder (Self : in Folder;
Lock : in Boolean := False)
is
begin
check (Self);
if Lock
then
folder_Lock.change (Self);
else
ada.Directories.set_Directory (+Self);
end if;
end go_to_Folder;
procedure unlock_Folder
is
begin
folder_Lock.clear;
end unlock_Folder;
function contents_Count (Self : in Folder;
Recurse : in Boolean := False) return Natural
is
use Shell.Directory_Iteration,
Ada.Directories;
Count : Natural := 0;
begin
check (Self);
for Each of To_Directory (+Self, Recurse)
loop
declare
Name : constant String := Simple_Name (Each);
begin
if not (Name = "." or Name = "..")
then
Count := Count + 1;
end if;
end;
end loop;
return Count;
end contents_Count;
function is_Empty (Self : in Folder) return Boolean
is
begin
check (Self);
return contents_Count (Self) = 0;
end is_Empty;
procedure rid_Folder (Self : in Folder)
is
begin
check (Self);
ada.Directories.delete_Tree (+Self);
exception
when ada.IO_Exceptions.name_Error =>
null;
end rid_Folder;
procedure copy_Folder (Self : in Folder; To : in Folder)
is
use lace.Environ.OS_Commands;
begin
check (Self);
check (To);
run_OS ("cp -fr " & (+Self) & " " & (+To));
end copy_Folder;
procedure move_Folder (Self : in Folder; To : in Folder)
is
use lace.Environ.OS_Commands;
begin
check (Self);
check (To);
run_OS ("mv " & (+Self) & " " & (+To));
end move_Folder;
procedure rename_Folder (Self : in Folder; To : in Folder)
is
begin
check (Self);
ada.Directories.rename (+Self, +To);
end rename_Folder;
procedure ensure_Folder (Self : in Folder)
is
begin
if Self.Name = ""
then
raise Error with "No folder specified.";
end if;
ada.Directories.create_Path (+Self);
end ensure_Folder;
function Relative (Self : in Folder; To : in Folder'Class) return Folder
is
use lace.Text,
lace.Text.utility;
Filename : constant lace.Text.item := to_Text (+Self);
relative_Folder : constant lace.Text.item := replace (Filename, pattern => +To & "/",
by => "");
begin
return to_Folder (+relative_Folder);
end Relative;
-------------------
--- Folder Contexts
--
procedure push_Folder (Context : in out folder_Context;
goto_Folder : in Folder'Class)
is
begin
check (goto_Folder);
Context.folder_Stack.append (current_Folder);
go_to_Folder (goto_Folder);
end push_Folder;
procedure pop_Folder (Context : in out folder_Context)
is
begin
if Context.folder_Stack.is_Empty
then
raise Error with "'pop_Folder': No prior folder exists.";
end if;
declare
prior_Folder : constant Folder := Context.folder_Stack.last_Element;
begin
Context.folder_Stack.delete_Last;
go_to_Folder (prior_Folder);
end;
end pop_Folder;
procedure pop_All (Context : in out folder_Context)
is
begin
if Context.folder_Stack.is_Empty
then
raise Error with "'pop_All': No initial folder exists.";
end if;
go_to_Folder (Context.folder_Stack.Element (1));
Context.folder_Stack.clear;
end pop_All;
---------
--- Files
--
function to_File (Name : in String) return File
is
Self : File;
begin
set_unbounded_String (Self.Name, Name);
return Self;
end to_File;
function "+" (Left : in File'Class;
Right : in File_Extension) return File
is
begin
return to_File (+Left & "." & String (Right));
end "+";
function Extension (Self : in File) return File_Extension
is
use ada.Directories;
begin
return File_Extension (Extension (+Self.Name));
end Extension;
procedure save (Self : in File;
Text : in String;
Binary : in Boolean := False)
is
begin
if Binary
then
declare
type binary_String is new String (Text'Range);
package Binary_IO is new ada.Direct_IO (binary_String);
use Binary_IO;
File : File_Type;
begin
create (File, out_File, +Self);
write (File, binary_String (Text));
close (File);
end;
else
declare
use ada.Text_IO;
File : File_Type;
begin
create (File, out_File, +Self);
put (File, Text);
close (File);
end;
end if;
end save;
procedure save (Self : in File;
Data : in environ.Data)
is
begin
check (Self);
declare
type Element_Array is new environ.Data (Data'Range);
package Binary_IO is new ada.Direct_IO (Element_Array);
use Binary_IO;
File : File_Type;
begin
create (File, out_File, +Self);
write (File, Element_Array (Data));
close (File);
end;
end save;
function load (Self : in File) return String
is
use type ada.Directories.File_Size;
Size : ada.Directories.File_Size;
begin
check (Self);
Size := ada.Directories.Size (+Self);
if Size = 0
then
return "";
end if;
declare
type my_String is new String (1 .. Natural (Size));
package String_IO is new ada.Direct_IO (my_String);
use String_IO;
File : File_Type;
Result : my_String;
begin
open (File, in_File, +Self);
read (File, Result);
close (File);
return String (Result);
end;
exception
when ada.IO_Exceptions.Name_Error =>
raise Error with "Cannot load missing file: '" & (+Self) & "'";
end load;
function load (Self : in File) return Data
is
begin
check (Self);
declare
use ada.Streams;
Size : constant ada.Directories.File_Size := ada.Directories.Size (+Self);
type Element_Array is new Data (0 .. Stream_Element_Offset (Size) - 1);
package Binary_IO is new ada.Direct_IO (Element_Array);
use Binary_IO;
File : Binary_IO.File_Type;
Result : Element_Array;
begin
open (File, out_File, +Self);
read (File, Result);
close (File);
return Data (Result);
end;
exception
when ada.IO_Exceptions.Name_Error =>
raise Error with "Cannot load missing file: '" & (+Self) & "'";
end load;
procedure copy_File (Self : in File; To : in File)
is
begin
check (Self);
check (To);
ada.Directories.copy_File (+Self, +To);
end copy_File;
procedure copy_Files (Named : in String; To : in Folder)
is
use lace.Text,
lace.Text.all_Tokens,
ada.Strings.fixed;
all_Files : constant String := (if Index (Named, "*") /= 0 then Expand_GLOB (Named)
else Named);
file_List : constant Text.items_1k := Tokens (to_Text (all_Files));
begin
check (To);
for Each of file_List
loop
declare
use ada.Directories;
Name : constant String := +Each;
begin
if Kind (Name) = Directory
then
copy_Folder (+Name,
To);
else
copy_File (to_File (Name),
To + to_File (simple_Name (Name)));
end if;
end;
end loop;
end copy_Files;
procedure move_File (Self : in File; To : in File)
is
begin
check (Self);
check (To);
-- 'Ada.Directories.Rename' fails when the file is moved across a device.
-- For instance Rename ("/tmp/a_file", "/home/user/a_file");
ada.Directories.copy_File (+Self, +To);
rid_File (Self);
end move_File;
procedure move_Files (Named : in String; To : in Folder)
is
begin
check (To);
declare
use lace.Text,
lace.Text.all_Tokens,
ada.Strings.fixed;
all_Files : constant String := (if Index (Named, "*") /= 0 then Expand_GLOB (Named)
else Named);
file_List : constant Text.items_1k := Tokens (to_Text (all_Files));
begin
for Each of file_List
loop
if +Each /= +To -- Don't move a directory to a subdirectory of itself.
then
declare
use ada.Directories;
Name : constant String := +Each;
begin
if Kind (Name) = Directory
then
move_Folder (+Name,
To);
else
move_File (to_File (Name),
To + to_File (simple_Name (Name)));
end if;
end;
end if;
end loop;
end;
end move_Files;
procedure append (Self : in File; Text : in String)
is
begin
check (Self);
declare
use ada.Text_IO;
Target : File_type;
begin
open (Target, append_File, Name => +Self);
put (Target, Text);
close (Target);
end;
end append;
procedure append_File (Self : in File; To : in File)
is
begin
check (Self);
check (To);
declare
use ada.Text_IO;
Text : constant String := load (Self);
Target : File_type;
begin
open (Target, append_File, Name => +To);
put (Target, Text);
close (Target);
end;
end append_File;
procedure rid_File (Self : in File)
is
begin
check (Self);
ada.Directories.delete_File (+Self);
end rid_File;
procedure rid_Files (Named : in String)
is
use lace.Text,
lace.Text.all_Tokens,
ada.Strings.fixed;
all_Files : constant String := (if Index (Named, "*") /= 0 then Expand_GLOB (Named)
else Named);
file_List : constant Text.items_1k := Tokens (to_Text (all_Files));
begin
for Each of file_List
loop
check (to_File (+Each));
rid_File (to_File (+Each));
end loop;
end rid_Files;
procedure touch (Self : in File)
is
use lace.Environ.OS_Commands;
Output : constant String := run_OS ("touch " & (+Self));
begin
if Output /= ""
then
raise Error with Output;
end if;
end touch;
function Relative (Self : in File; To : in Folder'Class) return File
is
use lace.Text,
lace.Text.utility;
Filename : constant lace.Text.item := to_Text (+Self);
relative_File : constant lace.Text.item := replace (Filename, pattern => +To & "/",
by => "");
begin
return to_File (+relative_File);
end Relative;
function rid_Extension (Self : in File) return File
is
use ada.Directories;
Parent : constant Folder := Self.Parent;
Name : constant String := base_Name (+Self.Name);
begin
return Parent + to_File (Name);
end rid_Extension;
---------------
--- Compression
--
procedure compress (the_Path : in Path'Class;
the_Format : in compress_Format := Tar_Xz;
the_Level : in compress_Level := 6)
is
use lace.Environ.OS_Commands;
function level_Flag return String
is
use ada.Strings,
ada.Strings.fixed;
begin
return " -"
& Trim (compress_Level'Image (the_Level),
Left)
& " ";
end level_Flag;
begin
check (the_Path);
case the_Format
is
when Tar |Tar_Bz2 | Tar_Gz | Tar_Xz =>
declare
Options : constant String := (case the_Format
is
when Tar => "-cf",
when Tar_Bz2 => "-cjf",
when Tar_Gz => "-czf",
when Tar_Xz => "-cJf",
when others => raise program_Error);
Output : constant String := run_OS ( "tar " & Options
& " " & (+the_Path) & format_Suffix (the_Format)
& " " & (+the_Path));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Gz =>
declare
Output : constant String := run_OS ( "gzip --force --keep --rsyncable"
& level_Flag
& " " & (+the_Path));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Bz2 =>
declare
Output : constant String := run_OS ( "bzip2 --force --keep"
& level_Flag
& " " & (+the_Path));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Xz =>
declare
Output : constant String := run_OS ("xz --force --keep --threads=0 " & (+the_Path));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
end case;
end compress;
procedure decompress (Name : in File)
is
use lace.Environ.OS_Commands;
begin
check (Name);
declare
use ada.Strings.fixed;
the_Format : constant compress_Format := (if Tail (+Name, 4) = ".tar" then Tar
elsif Tail (+Name, 8) = ".tar.bz2" then Tar_Bz2
elsif Tail (+Name, 7) = ".tar.gz"
or Tail (+Name, 4) = ".tgz" then Tar_Gz
elsif Tail (+Name, 7) = ".tar.xz" then Tar_Xz
elsif Tail (+Name, 3) = ".gz" then Gz
elsif Tail (+Name, 4) = ".bz2" then Bz2
elsif Tail (+Name, 3) = ".xz" then Xz
else raise Error with "Unknown decompress format: " & (+Name));
begin
case the_Format
is
when Tar |Tar_Bz2 | Tar_Gz | Tar_Xz =>
declare
Options : aliased constant String := (case the_Format
is
when Tar => "-xf",
when Tar_Bz2 => "-xjf",
when Tar_Gz => "-xzf",
when Tar_Xz => "-xJf",
when others => raise program_Error);
Output : constant String := run_OS ("tar " & Options & " " & (+Name));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Gz =>
declare
Output : constant String := run_OS ("gunzip --force --keep " & (+Name));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Bz2 =>
declare
Output : constant String := run_OS ("bunzip2 --force --keep " & (+Name));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
when Xz =>
declare
Output : constant String := run_OS ("xz --decompress --force --keep " & (+Name));
begin
if Output /= ""
then
raise Error with Output;
end if;
end;
end case;
end;
end decompress;
function format_Suffix (Format : compress_Format) return String
is
begin
case Format
is
when Tar => return ".tar";
when Tar_Bz2 => return ".tar.bz2";
when Tar_Gz => return ".tar.gz";
when Tar_Xz => return ".tar.xz";
when Bz2 => return ".bz2";
when Gz => return ".gz";
when Xz => return ".xz";
end case;
end format_Suffix;
end lace.Environ.Paths;
|
Library/Kernel/FSD/fsdManager.asm | steakknife/pcgeos | 504 | 17977 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC/GEOS
MODULE: Kernel -- FSD
FILE: fsdManager.asm
AUTHOR: <NAME>, July 18, 1991
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 07/18/91 Initial revision.
DESCRIPTION:
Manager for this module.
$Id: fsdManager.asm,v 1.1 97/04/05 01:17:41 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
_FSD = 1
;------------------------------------------------------------------------------
; Include definitions.
;------------------------------------------------------------------------------
include kernelGeode.def
include sem.def
include localize.def
include gcnlist.def
include object.def
include Internal/interrup.def
include Internal/geodeStr.def
include Internal/fileStr.def
include Internal/timerInt.def ; For counting durations of operations
include kernelFS.def
;------------------------------------------------------------------------------
; Local variables.
;------------------------------------------------------------------------------
include fsdConstant.def
include fsdVariable.def
;------------------------------------------------------------------------------
; Here comes the code...
;------------------------------------------------------------------------------
include fsdDisk.asm ; Disk-related FSD support code
include fsdDrive.asm ; Drive-related FSD support code
include fsdFile.asm ; File-related FSD support code
include fsdSkeleton.asm ; Skeleton filesystem driver.
include fsdUtils.asm ; Various utility routines
include fsdEC.asm ; Error-checking routines
include fsdInit.asm
end
|
programs/oeis/225/A225539.asm | neoneye/loda | 22 | 7576 | <reponame>neoneye/loda
; A225539: Numbers n where 2^n and n have the same digital root.
; 5,16,23,34,41,52,59,70,77,88,95,106,113,124,131,142,149,160,167,178,185,196,203,214,221,232,239,250,257,268,275,286,293,304,311,322,329,340,347,358,365,376,383,394,401,412,419,430,437,448
add $0,3
mul $0,9
mov $1,-1
bin $1,$0
add $1,$0
sub $1,21
mov $0,$1
|
ch5.agda | asajeffrey/tapl | 3 | 16402 | <filename>ch5.agda
open import prelude renaming (_≟String_ to _≟_)
infixl 5 _$_
-- Copied pretty much verbatim
Var = String
data Term : Set where
var : Var → Term
fun : Var → Term → Term
_$_ : Term → Term → Term
data Value : Term → Set where
fun : (x : Var) → (t : Term) → Value(fun x t)
-- Free variables of a term.
-- (Turns out to be easiest to define when a variable isn't free rather than when it is.)
data _∉FV_ : Var → Term → Set where
var : ∀ {x y} →
x ≢ y →
-------------
x ∉FV(var y)
fun₁ : ∀ {x y t} →
(x ≡ y) →
---------------
x ∉FV(fun y t)
fun₂ : ∀ {x y t} →
(x ∉FV(t)) →
---------------
x ∉FV(fun y t)
app : ∀ {x t₁ t₂} →
(x ∉FV(t₁)) →
(x ∉FV(t₂)) →
-----------------
(x ∉FV(t₁ $ t₂))
-- Substitution
-- TAPL defines substitution as a partial function, which Agda doesn't implement.
-- So instead we keep track of the derivation tree.
data [_↦_]_is_ : Var → Term → Term → Term → Set where
yes : ∀ {x y s} →
(x ≡ y) →
----------------------
[ x ↦ s ] (var y) is s
no : ∀ {x y s} →
(x ≢ y) →
----------------------------
[ x ↦ s ] (var y) is (var y)
fun₁ : ∀ {x y s t} →
(x ≡ y) →
--------------------------------
[ x ↦ s ] (fun y t) is (fun y t)
fun₂ : ∀ {x y s t t′} →
(x ≢ y) →
(y ∉FV(s)) →
[ x ↦ s ] t is t′ →
---------------------------------
[ x ↦ s ] (fun y t) is (fun y t′)
app : ∀ {x s t₁ t₁′ t₂ t₂′} →
[ x ↦ s ] t₁ is t₁′ →
[ x ↦ s ] t₂ is t₂′ →
---------------------------------
[ x ↦ s ] (t₁ $ t₂) is (t₁′ $ t₂′)
-- Reduction is as per TAPL
data _⟶_ : Term → Term → Set where
E─App1 : ∀ {t₁ t₁′ t₂} →
(t₁ ⟶ t₁′) →
------------------------
(t₁ $ t₂) ⟶ (t₁′ $ t₂)
E─App2 : ∀ {t₁ t₂ t₂′} →
(t₂ ⟶ t₂′) →
------------------------
(t₁ $ t₂) ⟶ (t₁ $ t₂′)
E─AppAbs : ∀ {x t₁ t₂ t₃} →
[ x ↦ t₂ ] t₁ is t₃ →
----------------------
(fun x t₁ $ t₂) ⟶ t₃
-- A redex is a term which can reduce
data Redex : Term → Set where
redex : ∀ {t t′} →
t ⟶ t′ →
--------
Redex(t)
-- A closed term is one with no free variables
Closed : Term → Set
Closed(t) = ∀ {x} → x ∉FV(t)
-- Proving that substitution is well-defined for closed terms
data [_↦_]_⇓ : Var → Term → Term → Set where
subst : ∀ {x s t t′} →
([ x ↦ s ] t is t′) →
([ x ↦ s ] t ⇓)
substDef : (x : Var) → (s t : Term) → Closed(s) → ([ x ↦ s ] t ⇓)
substDef x s (var y) c = helper (x ≟ y) where
helper : Dec(x ≡ y) → ([ x ↦ s ] (var y) ⇓)
helper (yes p) = subst (yes p)
helper (no p) = subst (no p)
substDef x s (fun y t) c = helper₁ (x ≟ y) where
helper₂ : (x ≢ y) → ([ x ↦ s ] t ⇓) → ([ x ↦ s ] (fun y t) ⇓)
helper₂ p (subst s) = subst (fun₂ p c s)
helper₁ : Dec(x ≡ y) → ([ x ↦ s ] (fun y t) ⇓)
helper₁ (yes p) = subst (fun₁ p)
helper₁ (no p) = helper₂ p (substDef x s t c)
substDef x s (t₁ $ t₂) c = helper (substDef x s t₁ c) (substDef x s t₂ c) where
helper : ([ x ↦ s ] t₁ ⇓) → ([ x ↦ s ] t₂ ⇓) → ([ x ↦ s ] (t₁ $ t₂) ⇓)
helper (subst s₁) (subst s₂) = subst (app s₁ s₂)
-- Proving that closed terms stay closed
closed₁ : ∀ {t₁ t₂ x} → (x ∉FV(t₁ $ t₂)) → (x ∉FV(t₁))
closed₁ (app p₁ p₂) = p₁
closed₂ : ∀ {t₁ t₂ x} → (x ∉FV(t₁ $ t₂)) → (x ∉FV(t₂))
closed₂ (app p₁ p₂) = p₂
substClosed₁ : ∀ {y s t t′} → (y ∉FV(s)) → ([ y ↦ s ] t is t′) → (y ∉FV(t′))
substClosed₁ p (yes refl) = p
substClosed₁ p (no q) = var q
substClosed₁ p (fun₁ q) = fun₁ q
substClosed₁ p (fun₂ x x₁ q) = fun₂ (substClosed₁ p q)
substClosed₁ p (app q₁ q₂) = app (substClosed₁ p q₁) (substClosed₁ p q₂)
substClosed₂ : ∀ {x y s t t′} → (x ∉FV(t)) → (x ∉FV(s)) → ([ y ↦ s ] t is t′) → (x ∉FV(t′))
substClosed₂ p q (yes refl) = q
substClosed₂ p q (no r) = p
substClosed₂ p q (fun₁ refl) = p
substClosed₂ (fun₁ p) q (fun₂ x x₁ r) = fun₁ p
substClosed₂ (fun₂ p) q (fun₂ x x₁ r) = fun₂ (substClosed₂ p q r)
substClosed₂ (app p₁ p₂) q (app r₁ r₂) = app (substClosed₂ p₁ q r₁) (substClosed₂ p₂ q r₂)
substClosed₃ : ∀ {x y s t t′} → x ∉FV(fun y t) → x ∉FV(s) → ([ y ↦ s ] t is t′) → x ∉FV(t′)
substClosed₃ (fun₁ refl) q r = substClosed₁ q r
substClosed₃ (fun₂ p) q r = substClosed₂ p q r
redexClosed : ∀ {t t′} → Closed(t) → (t ⟶ t′) → Closed(t′)
redexClosed c (E─App1 r) = app (redexClosed (closed₁ c) r) (closed₂ c)
redexClosed c (E─App2 r) = app (closed₁ c) (redexClosed (closed₂ c) r)
redexClosed c (E─AppAbs s) = substClosed₃ (closed₁ c) (closed₂ c) s
-- Proving that every closed term is a value or a redex
data ValueOrRedex : Term → Set where
value : ∀ {t} →
(Value(t)) →
---------------
ValueOrRedex(t)
redex : ∀ {t t′} →
t ⟶ t′ →
---------------
ValueOrRedex(t)
valueOrRedex : (t : Term) → Closed(t) → ValueOrRedex(t)
valueOrRedex (var x) c = CONTRADICTION (helper c) where
helper : (x ∉FV(var x)) → FALSE
helper (var p) = p refl
valueOrRedex (fun x t) c = value (fun x t)
valueOrRedex (t₁ $ t₂) c = helper₁ (valueOrRedex t₁ (closed₁ c)) where
helper₃ : ∀ {x s t} → ([ x ↦ s ] t ⇓) → ValueOrRedex((fun x t) $ s)
helper₃ (subst s) = redex (E─AppAbs s)
helper₂ : ∀ {t₁} → Value(t₁) → ValueOrRedex(t₂) → ValueOrRedex(t₁ $ t₂)
helper₂ (fun x t) (value v) = helper₃ (substDef x t₂ t (closed₂ c))
helper₂ (fun x t) (redex r) = redex (E─App2 r)
helper₁ : ValueOrRedex(t₁) → ValueOrRedex(t₁ $ t₂)
helper₁ (value v₁) = helper₂ v₁ (valueOrRedex t₂ (closed₂ c))
helper₁ (redex r) = redex (E─App1 r)
-- Interpreter!
data _⟶*_ : Term → Term → Set where
done : ∀ {t} →
--------
t ⟶* t
redex : ∀ {t t′ t″} →
t ⟶ t′ →
t′ ⟶* t″ →
----------
t ⟶* t″
-- An interpreter result
data Result : Term → Set where
result : ∀ {t t′} →
t ⟶* t′ →
Value(t′) →
---------
Result(t)
-- The interpreter just calls `valueOrRedex` until it is a value.
-- This might bot terminate!
{-# NON_TERMINATING #-}
interp : (t : Term) → Closed(t) → Result(t)
interp t c = helper₂ (valueOrRedex t c) where
helper₁ : ∀ {t′} → (t ⟶ t′) → Result(t′) → Result(t)
helper₁ r (result s v) = result (redex r s) v
helper₂ : ValueOrRedex(t) → Result(t)
helper₂ (value v) = result done v
helper₂ (redex {t′ = t′} r) = helper₁ r (interp t′ (redexClosed c r))
-- Examples
zer : Term
zer = fun "z" (fun "s" (var "z"))
succ : Term
succ = fun "x" (fun "z" (fun "s" (var "s" $ var "x")))
add : Term
add = fun "x" (fun "y" (var "x" $ var "y" $ succ))
two : Term
two = succ $ (succ $ zer)
four : Term
four = add $ two $ two
zerC : Closed(zer)
zerC {x} with (x ≟ "z")
... | yes refl = fun₁ refl
... | no p = fun₂ (fun₂ (var p))
succC : Closed(succ)
succC {x} with (x ≟ "x") | (x ≟ "s")
... | yes refl | _ = fun₁ refl
... | no p | yes refl = fun₂ (fun₂ (fun₁ refl))
... | no p | no q = fun₂ (fun₂ (fun₂ (app (var q) (var p))))
addC : Closed(add)
addC {x} with (x ≟ "x") | (x ≟ "y")
... | yes refl | _ = fun₁ refl
... | no p | yes refl = fun₂ (fun₁ refl)
... | no p | no q = fun₂ (fun₂ (app (app (var p) (var q)) succC))
twoC : Closed(two)
twoC = app succC (app succC zerC)
fourC : Closed(four)
fourC = app (app addC twoC) twoC
|
awa/plugins/awa-images/src/awa-images-services.adb | Letractively/ada-awa | 0 | 9807 | -----------------------------------------------------------------------
-- awa-images-services -- Image service
-- Copyright (C) 2012, 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Processes;
with Util.Beans.Objects;
with Util.Log.Loggers;
with Util.Streams.Pipes;
with Util.Streams.Texts;
with ADO;
with ADO.Sessions;
with AWA.Images.Models;
with AWA.Services.Contexts;
with AWA.Storages.Services;
with AWA.Storages.Modules;
with Ada.Strings.Unbounded;
with EL.Variables.Default;
with EL.Contexts.Default;
-- == Storage Service ==
-- The <tt>Storage_Service</tt> provides the operations to access and use the persisent storage.
-- It controls the permissions that grant access to the service for users.
--
-- Other modules can be notified of storage changes by registering a listener
-- on the storage module.
package body AWA.Images.Services is
package ASC renames AWA.Services.Contexts;
-- ------------------------------
-- Image Service
-- ------------------------------
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Images.Services");
-- ------------------------------
-- Initializes the storage service.
-- ------------------------------
overriding
procedure Initialize (Service : in out Image_Service;
Module : in AWA.Modules.Module'Class) is
begin
AWA.Modules.Module_Manager (Service).Initialize (Module);
declare
Ctx : EL.Contexts.Default.Default_Context;
Command : constant String := Module.Get_Config (PARAM_THUMBNAIL_COMMAND);
begin
Service.Thumbnail_Command := EL.Expressions.Create_Expression (Command, Ctx);
exception
when E : others =>
Log.Error ("Invalid thumbnail command: ", E, True);
end;
end Initialize;
procedure Create_Thumbnail (Service : in Image_Service;
Source : in String;
Into : in String;
Width : out Natural;
Height : out Natural) is
Ctx : EL.Contexts.Default.Default_Context;
Variables : aliased EL.Variables.Default.Default_Variable_Mapper;
Proc : Util.Processes.Process;
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
begin
Variables.Bind ("src", Util.Beans.Objects.To_Object (Source));
Variables.Bind ("dst", Util.Beans.Objects.To_Object (Into));
Ctx.Set_Variable_Mapper (Variables'Unchecked_Access);
declare
Cmd : constant Util.Beans.Objects.Object := Service.Thumbnail_Command.Get_Value (Ctx);
Command : constant String := Util.Beans.Objects.To_String (Cmd);
Input : Util.Streams.Texts.Reader_Stream;
begin
Width := 0;
Height := 0;
Pipe.Open (Command, Util.Processes.READ);
Input.Initialize (null, Pipe'Unchecked_Access, 1024);
while not Input.Is_Eof loop
declare
use Ada.Strings;
Line : Ada.Strings.Unbounded.Unbounded_String;
Pos : Natural;
Sep : Natural;
Last : Natural;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
-- The '-verbose' option of ImageMagick reports information about the original
-- image. Extract the picture width and height.
-- image.png PNG 120x282 120x282+0+0 8-bit DirectClass 34.4KB 0.000u 0:00.018
Pos := Ada.Strings.Unbounded.Index (Line, " ");
if Pos > 0 and Width = 0 then
Pos := Ada.Strings.Unbounded.Index (Line, " ", Pos + 1);
if Pos > 0 then
Sep := Ada.Strings.Unbounded.Index (Line, "x", Pos + 1);
Last := Ada.Strings.Unbounded.Index (Line, "=", Pos + 1);
if Sep > 0 and Sep < Last then
Log.Info ("Dimension {0} - {1}..{2}",
Ada.Strings.Unbounded.Slice (Line, Pos, Last),
Natural'Image (Pos), Natural'Image (Last));
Width := Natural'Value (Unbounded.Slice (Line, Pos + 1, Sep - 1));
Height := Natural'Value (Unbounded.Slice (Line, Sep + 1, Last - 1));
end if;
end if;
end if;
end;
end loop;
Pipe.Close;
Util.Processes.Wait (Proc);
if Pipe.Get_Exit_Status /= 0 then
Log.Error ("Command {0} exited with status {1}", Command,
Integer'Image (Pipe.Get_Exit_Status));
end if;
end;
end Create_Thumbnail;
-- Save the data object contained in the <b>Data</b> part element into the
-- target storage represented by <b>Into</b>.
procedure Build_Thumbnail (Service : in Image_Service;
Id : in ADO.Identifier;
File : in AWA.Storages.Models.Storage_Ref'Class) is
pragma Unreferenced (File);
Storage_Service : constant AWA.Storages.Services.Storage_Service_Access
:= AWA.Storages.Modules.Get_Storage_Manager;
Ctx : constant ASC.Service_Context_Access := ASC.Current;
DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx);
Img : AWA.Images.Models.Image_Ref;
Target_File : AWA.Storages.Storage_File;
Local_File : AWA.Storages.Storage_File;
Width : Natural;
Height : Natural;
begin
Img.Load (DB, Id);
Storage_Service.Get_Local_File (From => Img.Get_Storage.Get_Id, Into => Local_File);
Storage_Service.Create_Local_File (Target_File);
Service.Create_Thumbnail (AWA.Storages.Get_Path (Local_File),
AWA.Storages.Get_Path (Target_File), Width, Height);
Img.Set_Width (Width);
Img.Set_Height (Height);
Img.Set_Thumb_Width (64);
Img.Set_Thumb_Height (64);
Ctx.Start;
Img.Save (DB);
-- Storage_Service.Save (Target_File);
Ctx.Commit;
end Build_Thumbnail;
-- Save the data object contained in the <b>Data</b> part element into the
-- target storage represented by <b>Into</b>.
procedure Create_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class) is
pragma Unreferenced (Service);
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
Ctx.Start;
Img.Set_Width (0);
Img.Set_Height (0);
Img.Set_Thumb_Height (0);
Img.Set_Thumb_Width (0);
Img.Set_Storage (File);
Img.Save (DB);
Ctx.Commit;
end Create_Image;
-- Deletes the storage instance.
procedure Delete_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class) is
begin
null;
end Delete_Image;
end AWA.Images.Services;
|
Algebra/Group/Group.agda | esoeylemez/agda-simple | 1 | 2148 | <reponame>esoeylemez/agda-simple
-- Copyright: (c) 2016 <NAME>
-- License: BSD3
-- Maintainer: <NAME> <<EMAIL>>
module Algebra.Group.Group where
open import Algebra.Category
open import Algebra.Group.Monoid
open import Algebra.Group.Semigroup
open import Core
-- A group is a monoid where every element has an inverse.
record IsGroup {a r} (S : Semigroup {a} {r}) : Set (a ⊔ r) where
open Semigroup S
field isMonoid : IsMonoid S
open IsMonoid isMonoid
field iso : ∀ x → Iso x
inv : A → A
inv x = Iso.inv (iso x)
field inv-cong : ∀ {x y} → x ≈ y → inv x ≈ inv y
groupoid : Groupoid
groupoid =
record {
category = category;
iso = iso;
inv-cong = inv-cong
}
open Groupoid groupoid public
using (inv-invol)
record Group {a r} : Set (lsuc (a ⊔ r)) where
field semigroup : Semigroup {a} {r}
open Semigroup semigroup public
field isGroup : IsGroup semigroup
open IsGroup isGroup public
monoid : Monoid
monoid =
record {
semigroup = semigroup;
isMonoid = isMonoid
}
-- A group morphism is a function that maps the elements of one group to
-- another while preserving the compositional structure, the identity
-- and all inverses.
record GroupMorphism
{ga gr ha hr}
(G : Group {ga} {gr})
(H : Group {ha} {hr})
: Set (ga ⊔ gr ⊔ ha ⊔ hr)
where
private
module G = Group G
module H = Group H
field monoidMorphism : MonoidMorphism G.monoid H.monoid
open MonoidMorphism monoidMorphism public
field inv-preserving : ∀ x → map (G.inv x) H.≈ H.inv (map x)
|
archive/agda-3/src/Test/ConfusionAboutExtension.agda | m0davis/oscar | 0 | 12357 | <gh_stars>0
import Oscar.Class.Transextensionality.Proposequality -- FIXME why not use the instance here?
open import Oscar.Class
open import Oscar.Class.IsPrecategory
open import Oscar.Class.Transextensionality
open import Oscar.Class.Transitivity
open import Oscar.Data.Proposequality
open import Oscar.Prelude
open import Oscar.Property.Setoid.Proposequality
module Test.ConfusionAboutExtension where
module _
{a} {A : Ø a}
where
instance
𝓣ransextensionalityProposequality : Transextensionality.class Proposequality⟦ A ⟧ Proposequality transitivity
-- 𝓣ransextensionalityProposequality = Oscar.Class.Transextensionality.Proposequality.𝓣ransextensionalityProposequality -- using this instead avoids the below-mentioned errors
𝓣ransextensionalityProposequality .⋆ ∅ ∅ = !
module _
{a} {A : Ø a}
where
testme : Transextensionality.class Proposequality⟦ A ⟧ (Proposequality) (transitivity)
testme = ! -- errors
instance
IsPrecategoryExtension : IsPrecategory Proposequality⟦ A ⟧ Proposequality transitivity
IsPrecategoryExtension .IsPrecategory.`𝓣ransextensionality = {!!!} -- FIXME I'd like to use instance search to find this instance, but this errors b/c of
IsPrecategoryExtension .IsPrecategory.`𝓣ransassociativity = magic
|
boot.asm | AtieP/bareos | 3 | 163074 | <reponame>AtieP/bareos
org 0x7c00
bits 16
cpu 8086
main:
cli
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7c00
mov bp, sp
test al, 0x70
je read_sectors
mov al, 0x80 ; Reject floppy, embrace hard disk
read_sectors:
; Load 512-byte kernel right after the bootloader
mov ah, 0x41
mov bx, 0x55AA
int 0x13
jc disk_error
cmp bx, 0xAA55
jne disk_error
; Nice, running in an 386+
cpu 386
; Now load
mov ax, (2 << 8) | 1 ; AH = 0x02, AL = 0x01
mov bx, eof
mov cx, 0x02
xor dh, dh
int 0x13
jc disk_error
test ah, ah
jnz disk_error
cmp al, 1
jne disk_error
enable_a20:
; Enable A20 gate
call ps2_wait_write
mov al, 0xAD
out 0x64, al
call ps2_wait_write
mov al, 0xD0
out 0x64, al
call ps2_wait_read
in al, 0x60
mov bl, al
call ps2_wait_write
mov al, 0xD1
out 0x64, al
call ps2_wait_write
mov al, bl
or al, 2
out 0x60, al
call ps2_wait_write
mov al, 0xAE
out 0x64, al
load_gdt:
cli
lgdt [gdt.descriptor]
set_protected_bit:
mov eax, cr0
or eax, 1
mov cr0, eax
jmp code_segment:protected_mode
disk_error:
mov si, .string
call print_string
jmp restart
.string: db "Disk error, press any key to restart...",0x00
; ------------------
; PS/2 functions
; ------------------
ps2_wait_read:
push ax
.check:
in al, 0x64
test al, 1
jz .check
pop ax
ret
ps2_wait_write:
push ax
.check:
in al, 0x64
test al, 2
jnz .check
pop ax
ret
; ------------------
; Miscelaneous functions
; ------------------
print_string:
mov ah, 0x0e
.print_loop:
lodsb
test al, al
jz .end
int 0x10
jmp .print_loop
.end:
ret
restart:
xor ah, ah
int 0x16
.send_byte:
call ps2_wait_write
mov al, 0xFE
out 0x64, al
jmp .send_byte
; ------------------
; GDT
; ------------------
gdt:
.null:
dq 0x0
.code:
dw 0xffff
dw 0x0000
db 0x00
db 10011010b
db 11001111b
db 0x00
.data:
dw 0xffff
dw 0x0000
db 0x00
db 10010010b
db 11001111b
db 0x00
.end:
.descriptor:
dw .end - gdt - 1
dd gdt
code_segment equ gdt.code - gdt
data_segment equ gdt.data - gdt
; This code is running in protected mode
bits 32
protected_mode:
; Reload segments
mov ax, data_segment
mov ds, ax
mov es, ax
mov ss, ax
mov fs, ax
mov gs, ax
jmp 0x7e00
times 510 - ($ - $$) db 0x00
dw 0xAA55
eof:
incbin "kernel.bin"
times (512 - (($ - $$ + 0x7c00) & 511) + 1) / 2 db 0x00 ; Pad (thanks midn)
|
src/Categories/Object/Subobject/Properties.agda | bblfish/agda-categories | 5 | 9545 | <gh_stars>1-10
{-# OPTIONS --without-K --safe #-}
module Categories.Object.Subobject.Properties where
open import Level
open import Data.Product
open import Data.Unit
open import Function using (_$_)
open import Relation.Binary using (_=[_]⇒_)
open import Relation.Binary.Bundles
open import Relation.Binary.OrderMorphism
open import Categories.Category
open import Categories.Functor
open import Categories.Functor.Presheaf
open import Categories.Category.Slice
open import Categories.Object.Subobject
open import Categories.Diagram.Pullback renaming (glue to glue-pullback)
open import Categories.Diagram.Pullback.Properties
open import Categories.Category.Instance.Posets
open import Categories.Category.Instance.Setoids
open import Categories.Adjoint.Instance.PosetCore
import Categories.Morphism as Mor
import Categories.Morphism.Reasoning as MR
open import Categories.Morphism.Notation
module _ {o ℓ e} {𝒞 : Category o ℓ e} (has-pullbacks : ∀ {A B X} → (f : 𝒞 [ A , X ]) → (g : 𝒞 [ B , X ]) → Pullback 𝒞 f g) where
private
module 𝒞 = Category 𝒞
open 𝒞.HomReasoning
open 𝒞.Equiv
open Mor 𝒞
open MR 𝒞
open _↣_
-- The Subobject functor, into the category of posets
Subₚ : Presheaf 𝒞 (Posets (o ⊔ ℓ ⊔ e) (ℓ ⊔ e) (ℓ ⊔ e))
Subₚ = record
{ F₀ = Subobjects 𝒞
; F₁ = λ f → record
{ fun = morphism f
; monotone = λ {(α , m) (β , n)} h → monotone f {(α , m)} {β , n} h
}
; identity = λ {A} {(α , m)} →
let pid = has-pullbacks 𝒞.id (mor m)
in record
{ from = record
{ h = Pullback.p₂ pid
; △ = ⟺ (Pullback.commute pid) ○ 𝒞.identityˡ
}
; to = record
{ h = Pullback.universal pid id-comm-sym
; △ = Pullback.p₁∘universal≈h₁ pid
}
; iso = record
{ isoˡ = pullback-identity 𝒞 pid
; isoʳ = Pullback.p₂∘universal≈h₂ pid
}
}
; homomorphism = λ {X} {Y} {Z} {f} {g} {(α , m)} →
let pfg = has-pullbacks (𝒞 [ f ∘ g ]) (mor m)
pf = has-pullbacks f (mor m)
pg = has-pullbacks g (Pullback.p₁ pf)
iso = up-to-iso 𝒞 pfg (glue-pullback 𝒞 pf pg)
module iso = _≅_ iso
in record
{ from = record
{ h = iso.from
; △ = Pullback.p₁∘universal≈h₁ pg
}
; to = record
{ h = iso.to
; △ = Pullback.p₁∘universal≈h₁ pfg
}
; iso = record
{ isoˡ = iso.isoˡ
; isoʳ = iso.isoʳ
}
}
; F-resp-≈ = λ {A B f g} eq {(α , m)} →
let pf = has-pullbacks f (mor m)
pg = has-pullbacks g (mor m)
iso = up-to-iso 𝒞 pf (pullback-resp-≈ 𝒞 pg (sym eq) refl)
module iso = _≅_ iso
in record
{ from = record
{ h = iso.from
; △ = Pullback.p₁∘universal≈h₁ pg
}
; to = record
{ h = iso.to
; △ = Pullback.p₁∘universal≈h₁ pf
}
; iso = record
{ isoˡ = iso.isoˡ
; isoʳ = iso.isoʳ
}
}
}
where
morphism : ∀ {A B} → (f : 𝒞 [ B , A ]) → Σ[ α ∈ 𝒞.Obj ] (α ↣ A) → Σ[ β ∈ 𝒞.Obj ] (β ↣ B)
morphism f (α , m) =
let pb = has-pullbacks f (mor m)
in Pullback.P pb , record
{ mor = Pullback.p₁ pb
; mono = Pullback-resp-Mono 𝒞 pb (mono m)
}
monotone : ∀ {A B} (f : 𝒞 [ B , A ]) → Poset._≤_ (Subobjects 𝒞 A) =[ morphism f ]⇒ Poset._≤_ (Subobjects 𝒞 B)
monotone f {(α , m)} {(β , n)} h =
let pm = has-pullbacks f (mor m)
pn = has-pullbacks f (mor n)
in record
{ h = Pullback.universal pn $ begin
𝒞 [ f ∘ Pullback.p₁ pm ] ≈⟨ Pullback.commute pm ⟩
𝒞 [ mor m ∘ Pullback.p₂ pm ] ≈⟨ pushˡ (⟺ (Slice⇒.△ h)) ⟩
𝒞 [ mor n ∘ 𝒞 [ Slice⇒.h h ∘ Pullback.p₂ pm ] ] ∎
; △ = Pullback.p₁∘universal≈h₁ pn
}
-- The subobject functor as a presheaf on Setoids.
-- This is just Subₚ composed with the 'Core'
Sub : Presheaf 𝒞 (Setoids (o ⊔ ℓ ⊔ e) (ℓ ⊔ e))
Sub = Core ∘F Subₚ
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2197.asm | ljhsiun2/medusa | 9 | 173621 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xc8c2, %rbp
nop
nop
xor %rdx, %rdx
movups (%rbp), %xmm7
vpextrq $1, %xmm7, %r12
nop
nop
add $16685, %r15
lea addresses_WT_ht+0xd742, %rsi
lea addresses_WC_ht+0x8102, %rdi
xor $24493, %r9
mov $62, %rcx
rep movsw
cmp $5441, %r9
lea addresses_D_ht+0x14682, %rsi
lea addresses_D_ht+0xe126, %rdi
clflush (%rsi)
nop
add $28304, %rdx
mov $116, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_D_ht+0x122c2, %r15
sub %rdi, %rdi
mov $0x6162636465666768, %r9
movq %r9, %xmm5
movups %xmm5, (%r15)
nop
nop
nop
xor $44778, %r12
lea addresses_WC_ht+0x169a, %rcx
nop
nop
nop
nop
nop
cmp %rdx, %rdx
movw $0x6162, (%rcx)
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x9d82, %rsi
lea addresses_normal_ht+0x1cc82, %rdi
nop
nop
cmp $30357, %r9
mov $60, %rcx
rep movsl
nop
nop
nop
sub %rbp, %rbp
lea addresses_WT_ht+0x3c82, %rsi
nop
nop
nop
xor $34769, %r15
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm3
vpextrq $1, %xmm3, %r12
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x56f2, %rsi
lea addresses_D_ht+0x23ea, %rdi
nop
and %rdx, %rdx
mov $118, %rcx
rep movsq
nop
nop
nop
xor %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r8
push %rbp
push %rbx
push %rdx
// Store
lea addresses_A+0x1de42, %rbx
sub %r14, %r14
mov $0x5152535455565758, %r13
movq %r13, (%rbx)
nop
nop
nop
nop
nop
sub $64262, %r12
// Store
lea addresses_A+0x1cb82, %r13
add $10014, %rbp
mov $0x5152535455565758, %r12
movq %r12, %xmm2
movups %xmm2, (%r13)
nop
nop
nop
sub $4223, %r14
// Load
lea addresses_US+0xe588, %r13
nop
nop
nop
add %rdx, %rdx
movups (%r13), %xmm3
vpextrq $1, %xmm3, %rbx
nop
nop
nop
nop
sub %rdx, %rdx
// Faulty Load
lea addresses_UC+0x8c82, %r13
clflush (%r13)
dec %rbp
mov (%r13), %bx
lea oracles, %r12
and $0xff, %rbx
shlq $12, %rbx
mov (%r12,%rbx,1), %rbx
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
source/runtime/pb_support-memory_streams.ads | mgrojo/protobuf | 12 | 24210 | <reponame>mgrojo/protobuf
-- MIT License
--
-- Copyright (c) 2020 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
with Ada.Streams;
with League.Stream_Element_Vectors;
package PB_Support.Memory_Streams is
type Memory_Stream is new Ada.Streams.Root_Stream_Type with private;
procedure Clear (Self : in out Memory_Stream'Class);
function Written
(Self : Memory_Stream'Class) return Ada.Streams.Stream_Element_Count;
function Data (Self : Memory_Stream'Class)
return League.Stream_Element_Vectors.Stream_Element_Vector;
private
type Memory_Stream is new Ada.Streams.Root_Stream_Type with record
Data : League.Stream_Element_Vectors.Stream_Element_Vector;
Read : Ada.Streams.Stream_Element_Count := 0;
end record;
overriding procedure Read
(Self : in out Memory_Stream;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
overriding procedure Write
(Self : in out Memory_Stream;
Item : Ada.Streams.Stream_Element_Array);
end PB_Support.Memory_Streams;
|
oeis/002/A002472.asm | neoneye/loda-programs | 11 | 97894 | <filename>oeis/002/A002472.asm
; A002472: Number of pairs x,y such that y-x=2, (x,n)=1, (y,n)=1 and 1 <= x <= n.
; Submitted by <NAME>
; 1,1,1,2,3,1,5,4,3,3,9,2,11,5,3,8,15,3,17,6,5,9,21,4,15,11,9,10,27,3,29,16,9,15,15,6,35,17,11,12,39,5,41,18,9,21,45,8,35,15,15,22,51,9,27,20,17,27,57,6,59,29,15,32,33,9,65,30,21,15,69,12,71,35,15,34,45,11,77,24,27,39,81,10,45,41,27,36,87,9,55,42,29,45,51,16,95,35,27,30
add $0,1
mov $2,$0
lpb $2
mov $3,$2
sub $2,1
bin $3,2
gcd $3,$0
cmp $3,1
add $4,$3
lpe
mov $0,$4
|
smsq/qxl/comm/messpr.asm | olifink/smsqe | 0 | 240009 | ; SMS (QXL) Message Processing 1998 <NAME>
; 2005.01.10 1.01 added QXL restart (BC)
; 2006.10.01 1.02 added led updates, creates qmp_kbd_llck & uses it (BC)
; 2006.10.20 1.03 BLAT macro definitions commented out - macro wasn't used (wl)
section comm
xdef qxl_mess_pr
xdef qxl_mess_prnext
xdef qmp_updt_led
xref spp_rxser
xref cv_dtmrt
xref ioq_pbyt
xref kbd_pc84x
xref qxl_mess_add
xref pt_xmode
xref cn_copy_clear
include 'dev8_smsq_qxl_keys'
include 'dev8_smsq_qxl_comm_keys'
include 'dev8_keys_qdos_sms'
include 'dev8_keys_sys'
include 'dev8_keys_con'
include 'dev8_mac_assert'
qmp.reg reg d0/d1/a1-a3
* xref blatt
*blat macro blv
* move.b [blv],-(sp)
* jsr blatt
* add.w #2,sp
* endm
* xref blattl
*blatl macro blv
* move.l [blv],-(sp)
* jsr blattl
* addq.l #4,sp
* endm
;+++
; This routine processes the messages received
;
; a6 c p system variable base
;
;---
qxl_mess_pr
move.l qxl_pcqx_mess,a4 ; messages received
qxl_mess_prnext
qmp_loop
moveq #0,d0
move.b (a4),d0
beq.s qmp_exit
move.w qmp_table-1(pc,d0.w),d0
jmp qmp_table(pc,d0.w)
qmp_table
dc.w qmp_setup-qmp_table ; PC setup $01
dc.w qmp_flow-qmp_table ; Flow control
dc.w qmp_rtcu-qmp_table ; RTC
dc.w qmp_kbdd-qmp_table ; Keyboard data
dc.w qmp_vmack-qmp_table ; Video mode set acknowledge
dc.w qmp_rstrt-qmp_table ; QXL restart
dc.w qmp_exit-qmp_table ; nop
dc.w qmp_exit-qmp_table ; nop
dc.w qmp_nop4-qmp_table ; port opened $11
dc.w qmp_nop4-qmp_table ; port closed!
dc.w qmp_nop4-qmp_table ; port status
dc.w spp_rxser-qmp_table ; rx data
dc.w qmp_physr-qmp_table ; physical sector read
dc.w qmp_rpfail-qmp_table ; physical sector read failed
dc.w qmp_physw-qmp_table ; physical sector written
dc.w qmp_wpfail-qmp_table ; physical sector write failed
dc.w qmp_exit-qmp_table ; report plug-in $21
dc.w qmp_exit-qmp_table ; message from plug-in
dc.w qmp_exit-qmp_table ; channel opened
dc.w qmp_exit-qmp_table ; nop
dc.w qmp_exit-qmp_table ; data read
dc.w qmp_exit-qmp_table ; data read failed
dc.w qmp_exit-qmp_table ; data written
dc.w qmp_exit-qmp_table ; data write failed
dc.w qmp_drivf-qmp_table ; drive formatted $31
dc.w qmp_mouse-qmp_table ; mouse update
qmp_exit
move.l qxl_pcqx_mess,a4
clr.w (a4) ; unnecessary, but shows that we have done
rts
qmp_nop4
addq.l #4,a4
bra qmp_loop
qmp_setup ; *** do not junk setup messages
move.l qxl_message,a5 ; copy message to save area
; tst.b $2817f
; beq.s xx
; blat (a4)
; blatl a5
;xx
move.l (a4)+,qxl_ms_pcset(a5)
move.l (a4)+,qxl_ms_pcset+4(a5)
bra qmp_loop
qmp_flow
move.l (a4)+,d1
addq.l #4,a4
move.l qxl_spp_link,d0 ; put ser/par flow control in spp link
beq qmp_loop
move.l d0,a3
move.l d1,spd_qxlflow(a3)
bra qmp_loop
qmp_rtcu
lea (a4),a1 ; date
add.w #1980-qxm.rtcu<<8,(a4) ; adjust year
jsr cv_dtmrt ; set date
move.l d1,sys_rtc(a6)
addq.l #8,a4
bra qmp_loop
qmp_kbdd
lea (a4),a0
move.w (a0)+,d2
moveq #0,d0
move.b d2,d0
addq.w #5,d0
and.w #$fc,d0
add.l d0,a4 ; next message
move.l qxl_kbd_link,d0
beq qmp_loop
move.l d0,a3
qmp_kbdloop
move.b (a0)+,d0
jsr kbd_pc84x ; convert AT keyboard byte
subq.b #1,d2
bne.s qmp_kbdloop
bra qmp_loop
qmp_vmack
addq.l #4,a4 ; next message
move.l qxl_scr_work,a2
clr.b qxl_vhold(a2) ; display updates no longer held
lea qmp_qrt_flg(pc),a5
tst.b (a5) ; QXL restart?
beq qmp_loop ; no
cmp.b #ptd.16,qxl_vcolr(a2) ; 16 bit depth?
beq qmp_loop ; yes
move.l sys_clnk(a6),a3 ; console linkage
move.b pt_dmode(a3),d1
jsr pt_xmode
lea qmp_kbd_llck(pc),a2
st (a2) ; force led update at restart
bsr.s qmp_updt_led
sf (a5) ; QXL restart finished
bra qmp_loop
;+++
; This routine sends the qxm.flowqx message when a led update is needed
;
; a6 c p system variable base
;
;---
qmp_updt_led
movem.l qmp.reg,-(sp)
move.w sys_caps(a6),d0 ; read sys_caps...
move.b sys_dfrz(a6),d0 ; ...and sys_dfrz
rol.w #1,d0
and.b #$03,d0
lea qmp_kbd_llck(pc),a2
cmp.b (a2),d0 ; status change?
beq.s qmp_updt_led_exit ; no
move.b d0,(a2) ; save current status
move.l qxl_message,a3
lea qxl_ms_flow+qxl_ms_len(a3),a1
move.l #qxm.flowlen<<16+qxm.flowqx<<8,(a1) ; ... msg length and key
move.b d0,qxm_fkbd-qxl_ms_len(a1)
qmp_updt_led_exit
movem.l (sp)+,qmp.reg
rts
qmp_kbd_llck
dc.b $00 ; last kbd lock status
qmp_qrt_flg
dc.b $00
qmp_rstrt
addq.l #4,a4 ; next message
lea qmp_qrt_flg(pc),a5 ; QXL restart...
st (a5) ; ...in progress
move.l qxl_scr_work,a2 ; screen work area
st qxl_vhold(a2) ; hold display updates
jsr cn_copy_clear
move.l qxl_message,a3 ; message area
lea qxl_ms_vmode+qxl_ms_len(a3),a1 ; mode message length
move.l #4<<16+qxm.vmode<<8,(a1) ; ... message length and key
move.b qxl_vcolr(a2),d0 ; internal colour
beq.s qrt_sclr ; QL mode
subq.b #1,d0 ; VGA mode is one different
qrt_sclr
move.b d0,qxm_vclr-qxl_ms_len(a1) ; set colour
move.b qxl_vsize(a2),d0
bpl.s qrt_ssiz ; QL mode?
addq.b #1,d0 ; yes
qrt_ssiz
move.b d0,qxm_vres-qxl_ms_len(a1) ; set size
jsr qxl_mess_add ; add message to queue
bra qmp_loop
;
; Physical sector successfully read
;
qmp_physr
move.l qxl_message,a5
lea qxl_ms_phys(a5),a2
assert qxm_rdata,4
move.l (a4)+,(a2)+ ; the message
moveq #512/16-1,d0
qpr_loop
move.l (a4)+,(a2)+
move.l (a4)+,(a2)+
move.l (a4)+,(a2)+
move.l (a4)+,(a2)+
dbra d0,qpr_loop
qmp_physack
tst.b qxl_junk
bne qmp_loop ; if junking messages, do not mark it
st qxl_ms_len+qxl_ms_phys(a5) ; done flag
bra qmp_loop
;
; Physical sector read fail or physical sector write ack
;
qmp_rpfail
qmp_physw
qmp_wpfail
move.l qxl_message,a5
move.l (a4)+,qxl_ms_phys(a5) ; the message
bra qmp_physack
;
; Format ack
;
qmp_drivf
move.l qxl_message,a5
lea qxl_ms_phys(a5),a2
move.l (a4)+,(a2)+ ; the message
move.l (a4)+,(a2)+ ; the total
move.l (a4)+,(a2)+ ; good
bra qmp_physack
;
; Mouse update
;
qmp_mouse
move.l qxl_message,a5
lea qxl_ms_mouse(a5),a2
move.w (a4)+,(a2)+ ; the message and the buttons
move.l (a4)+,d0
add.l d0,(a2)+ ; update the totals
addq.l #2,a4 ; the spare at the end
bra qmp_loop
end
|
antlr/src/main/antlr/xyz/chph/toy/antlr/Toy.g4 | QQ876684433/ToyLang | 1 | 5415 | //header
grammar Toy;
@header {
package xyz.chph.toy.antlr;
}
//RULES
compilationUnit
: importDeclaration* classDeclaration
EOF
;
importDeclaration
: 'import' importList 'from' qualifiedName
;
importList
: importReference (',' importReference)*
| '{' importReference (',' importReference)* '}'
;
importReference
: ID ('as' ID)?
;
classDeclaration
: className '{' classBody '}'
;
className : qualifiedName ;
classBody : field* function* ;
field : type name;
function : functionDeclaration block;
functionDeclaration : (type)? functionName '('? parametersList? ')'? ;
parametersList: parameter (',' parameter)*
| parameter (',' parameterWithDefaultValue)*
| parameterWithDefaultValue (',' parameterWithDefaultValue)* ;
functionName : ID ;
parameter : type ID ;
parameterWithDefaultValue : type ID '=' defaultValue=expression ;
type : primitiveType
| classType ;
primitiveType
: 'boolean' ('[' ']')*
| 'string' ('[' ']')*
| 'char' ('[' ']')*
| 'byte' ('[' ']')*
| 'short' ('[' ']')*
| 'int' ('[' ']')*
| 'long' ('[' ']')*
| 'float' ('[' ']')*
| 'double' ('[' ']')*
| 'void' ('[' ']')*
;
classType : qualifiedName ('[' ']')* ;
block : '{' statement* '}' ;
statement : block
| variableDeclaration
| assignment
| printStatement
| forStatement
| returnStatement
| ifStatement
| expression ;
variableDeclaration : VARIABLE name EQUALS expression ;
assignment : name EQUALS expression;
printStatement
: PRINT expression
| PRINTLN expression
;
returnStatement : 'return' expression #ReturnWithValue
| 'return' #ReturnVoid ;
ifStatement: 'if' ('(')? expression (')')? trueStatement=statement ('else' falseStatement=statement)?;
forStatement : 'for' ('(')? forConditions (')')? statement ;
forConditions : iterator=variableReference 'from' startExpr=expression range='to' endExpr=expression ;
name : ID ;
argumentList : argument? (',' a=argument)* #UnnamedArgumentsList
| namedArgument? (',' namedArgument)* #NamedArgumentsList ;
argument : expression ;
namedArgument : name '->' expression ;
expression : variableReference #VarReference
| owner=expression '.' functionName '(' argumentList ')' #FunctionCall
| functionName '(' argumentList ')' #FunctionCall
| superCall='super' '('argumentList ')' #Supercall
| newCall='new' className '('argumentList ')' #ConstructorCall
| literal #ValueExpr
| '('expression '*' expression')' #Multiply
| expression '*' expression #Multiply
| '(' expression '/' expression ')' #Divide
| expression '/' expression #Divide
| '(' expression '+' expression ')' #Add
| expression '+' expression #Add
| '(' expression '-' expression ')' #Substract
| expression '-' expression #Substract
| expression cmp='>' expression #ConditionalExpression
| expression cmp='<' expression #ConditionalExpression
| expression cmp='==' expression #ConditionalExpression
| expression cmp='!=' expression #ConditionalExpression
| expression cmp='>=' expression #ConditionalExpression
| expression cmp='<=' expression #ConditionalExpression
;
variableReference : ID ;
literal
: integerLiteral
| FloatingPointLiteral
| booleanLiteral
| StringLiteral
| CharacterLiteral
;
qualifiedName : ID ('.' ID)*;
integerLiteral
: HexLiteral
| OctalLiteral
| DecimalLiteral
;
booleanLiteral
: 'true'
| 'false'
;
//////////////////////////////////////////////////////////////////////////////////////
// LEXER
//////////////////////////////////////////////////////////////////////////////////////
FloatingPointLiteral
: ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
| '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
| ('0'..'9')+ Exponent FloatTypeSuffix?
| ('0'..'9')+ FloatTypeSuffix
| ('0x' | '0X') (HexDigit )*
('.' (HexDigit)*)?
( 'p' | 'P' )
( '+' | '-' )?
( '0' .. '9' )+
FloatTypeSuffix?
;
fragment
Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
fragment
FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
HexLiteral : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
OctalLiteral : '0' ('0'..'7')+ IntegerTypeSuffix? ;
fragment
HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment
IntegerTypeSuffix : ('l'|'L') ;
StringLiteral
: '"' ( EscapeSequence | ~('\\'|'"') )* '"'
;
CharacterLiteral
: '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
;
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| UnicodeEscape
| OctalEscape
;
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
VARIABLE : 'var' ;
PRINT : 'print' ;
PRINTLN : 'println';
EQUALS : '=' ;
STRING : '"'~('\r' | '\n' | '"')*'"' ;
ID : [a-zA-Z0-9]+ ;
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN) // match anything between /* and */
;
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
;
LINE_COMMENT
: '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
; |
old/old.adb | twinbee/lamportsBakery | 0 | 30026 | <reponame>twinbee/lamportsBakery<gh_stars>0
----------------------------csc410/prog5/as5.adb----------------------------
-- Author: <NAME>
-- Class: CSC410 Burgess
-- Date: 11-01-04 Modified: 11-01-04
-- Due: 11-7-04
-- Desc: Assignment 5: LAMPORT'S ALGORITHM FOR VIRTUAL TOPOLOGY NETWORKS
--
-- a nonproduction implementation of
-- LAMPORT's "bakery" algorithm which utilizes clocks (a 'ticketing' system
-- like in the bakery or at the dept of motor vehicles) to determine which
-- process may go into the critical section next.
--
-- LAMPORT implemented as described in
-- "Algorithms FOR Mutual Exclusion", <NAME>
-- MIT PRESS Cambridge, 1986 ISBN: 0-262-18119-3
-- with additional revisions due to message passing across a virtual topology
----------------------------------------------------------------------------
-- Refactorings 10-05-04: (deNOTed @FIX@)
-- (4) linked list of processes instread of array
----------------------------------------------------------------
-- dependencies
WITH ADA.TEXT_IO; USE ADA.TEXT_IO;
WITH ADA.INTEGER_TEXT_IO; USE ADA.INTEGER_TEXT_IO;
WITH ADA.NUMERICS.FLOAT_RANDOM; USE ADA.NUMERICS.FLOAT_RANDOM;
WITH ADA.CALENDAR; -- (provides cast: natural -> time FOR input into delay)
WITH ADA.STRINGS; USE ADA.STRINGS;
PROCEDURE Main IS
G : Generator;
MAX_NEIGHBORS : Constant := 25;
TYPE RX_TASK;
TYPE RX_Ptr IS ACCESS RX_TASK;
TYPE Myarray IS ARRAY (0..MAX_NEIGHBORS) of Integer;
--this is needed bc anonymous types are not allowed in declarations
TYPE Node;
TYPE Node_Ptr IS ACCESS Node;
TYPE Node IS RECORD
m_Value : Integer;
Next : Node_Ptr := NULL;
Prev : Node_Ptr := NULL;
END RECORD;
TASKarray : ARRAY (0..MAX_NEIGHBORS) of RX_Ptr;
--keep up with tasks thrown off
PROCEDURE Enqueue (Head : IN OUT Node_Ptr;
Value : IN Integer) IS
Item : Node_Ptr;
BEGIN
Item := new Node;
Item.m_Value := Value;
IF (Head = NULL) THEN Head := Item;
ELSE -- Insert at the beginning
Item.Next := Head;
Head.Prev := Item;
Head := Item;
END IF;
END Enqueue;
PROCEDURE Dequeue(Head : IN out Node_Ptr; Value : out Integer) IS Curr : Node_Ptr;
BEGIN
Curr := Head;
IF (Head = NULL) THEN -- We have an empty queue
put ("Error : Empty Queue Encountered");
ELSE
WHILE (Curr.Next /= NULL) --iterate to end of list
LOOP
Curr := Curr.Next;
END LOOP;
IF (Curr.Prev = NULL) THEN Head := NULL;
ELSE Curr.Prev.Next := NULL; END IF;
Value := Curr.m_Value;
END IF;
END Dequeue;
FUNCTION IsEmpty (Head : Node_Ptr) RETURN Boolean IS
BEGIN
IF (Head = NULL) THEN RETURN TRUE;
ELSE RETURN FALSE; END IF;
END IsEmpty;
-- BEGIN Receive TASK Declaration --
TASK TYPE RX_TASK IS
ENTRY Start( myid : Integer; hold : Integer; Neighbor : Myarray);
ENTRY Send (mesgTYPE : Character; FromId : Integer; ToId : Integer);
END RX_TASK;
-- BEGIN Receive TASK Definition --
TASK BODY RX_TASK IS
Neighborarray : ARRAY (0..MAX_NEIGHBORS) of Integer;
HOLDER : Integer;
USING : Boolean := FALSE;
REQUEST_Q : Node_Ptr := NULL;
ASKED : Boolean := FALSE;
SELF : Integer;
TYPE Message;
TYPE Message_Ptr IS ACCESS Message;
TYPE Message IS RECORD
m_mesgTYPE : Character;
m_fromId : Integer;
m_toId : Integer;
Next,Prev : Message_Ptr := NULL;
END RECORD;
MESG_Q : Message_Ptr := NULL;
-- FUNCTIONs FOR Enqueuing AND Dequeuing a Message Queue --------------
PROCEDURE Message_Enqueue(
Head : IN OUT Message_Ptr;
mesgTYPE : Character;
fromId : Integer;
toId : Integer) IS
Item : Message_Ptr;
BEGIN
Item := new Message;
Item.m_mesgTYPE := mesgTYPE;
Item.m_fromId := fromId;
Item.m_toId := toId;
IF (Head = NULL) THEN -- We have an empty queue
Head := Item;
ELSE -- Insert at the beginning
Item.Next := Head;
Head.Prev := Item;
Head := Item;
END IF;
END Message_Enqueue;
PROCEDURE Message_Dequeue(
Head : IN out Message_Ptr;
tempMesg : out Message)
IS Curr : Message_Ptr;
BEGIN
Curr := Head;
IF (Head = NULL) THEN -- We have an empty queue
put ("Error : Empty Message Queue Encountered");
ELSE
WHILE (Curr.Next /= NULL) LOOP Curr := Curr.Next; END LOOP;
-- Curr should now point to the last element IN the list --
IF (Curr.Prev = NULL)
THEN Head := NULL;
ELSE Curr.Prev.Next := NULL;
END IF;
tempMesg.m_mesgTYPE := Curr.m_mesgTYPE;
tempMesg.m_fromId := Curr.m_fromId;
tempMesg.m_toId := Curr.m_toId;
END IF;
END Message_Dequeue;
FUNCTION Message_IsEmpty (Head : Message_Ptr) RETURN Boolean IS
BEGIN
IF (Head = NULL) THEN RETURN TRUE;
ELSE RETURN FALSE;
END IF;
END Message_IsEmpty;
-- FUNCTIONs FOR ASSIGN_PRIVILEGE AND MAKE REQUEST ---------
PROCEDURE ASSIGN_PRIVILEGE IS
BEGIN
IF (HOLDER = SELF) AND (NOT USING) AND (NOT IsEmpty(REQUEST_Q)) THEN
Dequeue(REQUEST_Q, HOLDER);
ASKED := FALSE;
IF HOLDER = SELF THEN
USING := TRUE;
-- Critical Section
Put (SELF, (1+(4*SELF))); Put (" IN CS"); New_Line;
delay (Standard.Duration(Random(G) * 4.0));
Put (SELF, (1+(4*SELF))); Put (" out CS"); New_Line;
ELSE
TASKarray(HOLDER).Send('P', SELF, HOLDER);
END IF;
END IF;
END ASSIGN_PRIVILEGE;
PROCEDURE MAKE_REQUEST IS
BEGIN
IF (HOLDER /= SELF) AND (NOT IsEmpty(REQUEST_Q)) AND (NOT ASKED) THEN
TASKarray(HOLDER).Send('R', SELF, HOLDER);
ASKED := TRUE;
END IF;
END MAKE_REQUEST;
TASK TYPE AL_TASK IS END AL_TASK;
TASK BODY AL_TASK IS
currMessage : Message;
BEGIN
LOOP
-- Only attempt to enter the critical section 35% of time
IF ((Random(g) * 10.0) > 7.0) THEN
Delay (Standard.Duration(Random(G) * 3.0));
-- Node wishes to enter the critical Section --
Enqueue(REQUEST_Q, SELF);
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
-- Node exits the critical section --
USING := FALSE;
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END IF;
-- Process any messages IN the message queue --
IF (NOT Message_IsEmpty(MESG_Q)) THEN
Message_Dequeue(MESG_Q, currMessage);
case currMessage.m_mesgTYPE IS
WHEN 'P' =>
BEGIN
HOLDER := SELF;
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END;
WHEN 'R' =>
BEGIN
Enqueue(REQUEST_Q, currMessage.m_FromId);
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END;
WHEN Others => NULL; --make ada happy
END Case;
ELSE -- We delay a bit longer, as to let others through
Delay (Standard.Duration(Random(G) * 6.0));
END IF;
END LOOP;
END AL_TASK;
TYPE AL_Ptr IS ACCESS AL_TASK;
aPtr : AL_Ptr;
--------------------------------------------------------------
-- BEGIN THE RECEIEVE TASK DEFINITION --
BEGIN
-- ACCEPT creation messages --
ACCEPT Start(
myid : Integer;
hold : Integer;
Neighbor : Myarray)
DO
FOR I IN Neighbor'First..Neighbor'Last
LOOP
Neighborarray(I) := Neighbor(I);
END LOOP;
HOLDER := hold;
SELF := myid;
END Start;
aPtr := new AL_TASK; -- Start Algorithm LOOP
-- Start Message Receiving LOOP --
LOOP
ACCEPT Send (mesgTYPE : Character; FromId : Integer; ToId : Integer)
DO
Message_Enqueue (MESG_Q,mesgTYPE, fromId, ToId);
put (SELF, (1+(4*SELF)));
IF (MesgTYPE = 'P') THEN put (" Priv ");
ELSE put (" Request "); END IF;
Put (FromId, 0);
Put (","); Put (ToId,0); New_Line;
END Send;
END LOOP; -- RX LOOP
END RX_TASK;
PROCEDURE Driver IS
infile : FILE_TYPE; --ada.standard.textIO type for reading ascii and iso-8XXX
taskId : Integer;
holder : Integer;
neighArray : myArray;
neighCount : Integer := 0;
BEGIN
Open (inFile, IN_FILE, "input.txt");
--open as read only ascii and use reference infile
--file format is: nodeID neighbor neighbor neighbor ...neighbor[MAX_NEIGHBORS]
WHILE NOT END_OF_FILE(infile)
LOOP
Get(infile, TASKId);
Get(infile, Holder);
WHILE NOT END_OF_LINE(infile) --there are neighbors coming on the line
LOOP
Get( infile, neighArray(neighCount) );
neighCount := neighCount + 1;
END LOOP;
TASKarray(TASKId) := new RX_TASK;
TASKarray(TASKId).Start(taskId, holder, neighArray);
END LOOP;
END Driver;
BEGIN Driver; END Main;
|
programs/oeis/256/A256302.asm | neoneye/loda | 22 | 3290 | <reponame>neoneye/loda<gh_stars>10-100
; A256302: Least prime p such that p+3*k*(k+1) is prime for all k=0,...,n.
; 2,5,5,5,11,11,11,11,11,11,23,23,23,23,23,23,23,23,23,23,23,23
mov $1,3
lpb $0
trn $0,$1
mul $1,2
lpe
sub $1,1
mov $0,$1
|
include/sf-window-input.ads | danva994/ASFML-1.6 | 1 | 14860 | <filename>include/sf-window-input.ads
-- ////////////////////////////////////////////////////////////
-- //
-- // 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.Window.Types;
with Sf.Window.Event;
package Sf.Window.Input is
use Sf.Config;
use Sf.Window.Types;
use Sf.Window.Event;
-- ////////////////////////////////////////////////////////////
-- /// Get the state of a key
-- ///
-- /// \param Input : Input object
-- /// \param KeyCode : Key to check
-- ///
-- /// \return sfTrue if key is down, sfFalse if key is up
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_IsKeyDown (Input : sfInput_Ptr; KeyCode : sfKeyCode) return sfBool;
-- ////////////////////////////////////////////////////////////
-- /// Get the state of a mouse button
-- ///
-- /// \param Input : Input object
-- /// \param Button : Button to check
-- ///
-- /// \return sfTrue if button is down, sfFalse if button is up
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_IsMouseButtonDown (Input : sfInput_Ptr; Button : sfMouseButton) return sfBool;
-- ////////////////////////////////////////////////////////////
-- /// Get the state of a joystick button
-- ///
-- /// \param Input : Input object
-- /// \param JoyId : Identifier of the joystick to check (0 or 1)
-- /// \param Button : Button to check
-- ///
-- /// \return sfTrue if button is down, sfFalse if button is up
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_IsJoystickButtonDown
(Input : sfInput_Ptr;
JoyId : sfUint32;
Button : sfUint32)
return sfBool;
-- ////////////////////////////////////////////////////////////
-- /// Get the mouse X position
-- ///
-- /// \param Input : Input object
-- ///
-- /// \return Current mouse left position, relative to owner window
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_GetMouseX (Input : sfInput_Ptr) return Integer;
-- ////////////////////////////////////////////////////////////
-- /// Get the mouse Y position
-- ///
-- /// \param Input : Input object
-- ///
-- /// \return Current mouse top position, relative to owner window
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_GetMouseY (Input : sfInput_Ptr) return Integer;
-- ////////////////////////////////////////////////////////////
-- /// Get the joystick position on a given axis
-- ///
-- /// \param Input : Input object
-- /// \param JoyId : Identifier of the joystick to check (0 or 1)
-- /// \param Axis : Identifier of the axis to read
-- ///
-- /// \return Current joystick position, in the range [-100, 100]
-- ///
-- ////////////////////////////////////////////////////////////
function sfInput_GetJoystickAxis
(Input : sfInput_Ptr;
JoyId : sfUint32;
Axis : sfJoyAxis)
return Float;
private
pragma Import (C, sfInput_IsKeyDown, "sfInput_IsKeyDown");
pragma Import (C, sfInput_IsMouseButtonDown, "sfInput_IsMouseButtonDown");
pragma Import (C, sfInput_IsJoystickButtonDown, "sfInput_IsMouseButtonDown");
pragma Import (C, sfInput_GetMouseX, "sfInput_GetMouseX");
pragma Import (C, sfInput_GetMouseY, "sfInput_GetMouseY");
pragma Import (C, sfInput_GetJoystickAxis, "sfInput_GetJoystickAxis");
end Sf.Window.Input;
|
Lab0/lab0.adb | albinjal/ada_basic | 3 | 30493 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure Lab0 is
I: Integer;
F: Float;
C: Character;
S: String(1..5);
begin
Put("Skriv in ett heltal: "); Get(I);
Put("Du skrev in talet: "); Put(I,2);
New_Line(1);
Skip_Line;
Put("Skriv in fem heltal: "); Get(I); Get(C);
Put("Du skrev in talen: "); Put(I,2); Put(C); Get(I); Put(I,2); Put(C);
Get(I); Put(I,2); Put(C); Get(I); Put(I,2); Put(C); Get(I); Put(I,2);
New_Line(1);
Skip_Line;
Put("Skriv in ett flyttal: "); Get(F);
Put("Du skrev in flyttalet: "); Put(F,2,3,0);
New_Line(1);
Skip_Line;
Put("Skriv in ett heltal och ett flyttal: "); Get(I);
Put("Du skrev in heltalet: "); Put(I,9);
New_Line(1);
Put("Du skrev in flyttalet: "); Get(F); Put(F,3,4,0);
New_Line(1);
Skip_Line;
Put("Skriv in ett tecken: "); Get(C);
Put("Du skrev in tecknet: "); Put(C);
New_Line(1);
Skip_Line;
Put("Skriv in en sträng med 5 tecken: "); Get(S);
Put("Du skrev in strängen: "); Put(S);
New_Line(1);
Skip_Line;
Put("Skriv in en sträng med 3 tecken: ");
Get_Line(S,I);
Put("Du skrev in strängen: "); Put(S(1..3));
New_Line(1);
Put("Skriv in ett heltal och en sträng med 5 tecken: ");
Get(I);
Put("Du skrev in talet |"); Put(I,1); Put("| och strängen |");
Get(C);
Get_Line(S, I);
Put(S(1..5));
Put("|.");
New_Line(1);
Skip_Line;
Put("Skriv in en sträng med 3 tecken och ett flyttal: ");
Get(S(1..3));
Get(F);
Put("Du skrev in """); Put(F, 2, 3, 0); Put(""" och """); Put(S(1..3)); Put("""");
Skip_Line;
New_Line;
Put("Skriv in en sträng som är maximalt 5 tecken: "); Get_Line(S,I);
Put("Du skrev in strängen: ");
if I = 5 then
Put(S(1..5));
Skip_Line;
else
Put(S(1..I));
end if;
New_Line;
Put("Skriv in en sträng som är maximalt 5 tecken: "); Get_Line(S,I);
Put("Du skrev in strängen: ");
if I > 5 then
Put(S(1..5));
else
Put(S(1..I));
end if;
New_Line(1);
end Lab0;
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_interfaces_mixer_h.ads | persan/A-gst | 1 | 12544 | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with glib;
with System;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixer_h is
-- unsupported macro: GST_TYPE_MIXER (gst_mixer_get_type ())
-- arg-macro: function GST_MIXER (obj)
-- return GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer);
-- arg-macro: function GST_MIXER_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass);
-- arg-macro: function GST_IS_MIXER (obj)
-- return GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER);
-- arg-macro: function GST_IS_MIXER_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER);
-- arg-macro: function GST_MIXER_GET_CLASS (inst)
-- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass);
-- arg-macro: function GST_MIXER_TYPE (klass)
-- return klass.mixer_type;
-- GStreamer Mixer
-- * Copyright (C) 2003 <NAME> <<EMAIL>>
-- *
-- * mixer.h: mixer interface design
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- skipped empty struct u_GstMixer
-- skipped empty struct GstMixer
type GstMixerClass;
-- type GstMixerFlags;
type u_GstMixerClass_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstMixerClass is u_GstMixerClass; -- gst/interfaces/mixer.h:48
--*
-- * GstMixerType:
-- * @GST_MIXER_HARDWARE: mixing is implemented with dedicated hardware.
-- * @GST_MIXER_SOFTWARE: mixing is implemented via software processing.
-- *
-- * Mixer classification.
--
type GstMixerType is
(GST_MIXER_HARDWARE,
GST_MIXER_SOFTWARE);
pragma Convention (C, GstMixerType); -- gst/interfaces/mixer.h:61
--*
-- * GstMixerMessageType:
-- * @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
-- * @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
-- * @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
-- * @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
-- * @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
-- * @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
-- * GstMixer message, posted when the list of available options for a
-- * GstMixerOptions object has changed (Since: 0.10.18)
-- * @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
-- * when the list of available mixer tracks has changed. The application
-- * should re-build its interface in this case (Since: 0.10.18)
-- *
-- * An enumeration for the type of a GstMixer message received on the bus
-- *
-- * Since: 0.10.14
--
type GstMixerMessageType is
(GST_MIXER_MESSAGE_INVALID,
GST_MIXER_MESSAGE_MUTE_TOGGLED,
GST_MIXER_MESSAGE_RECORD_TOGGLED,
GST_MIXER_MESSAGE_VOLUME_CHANGED,
GST_MIXER_MESSAGE_OPTION_CHANGED,
GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
GST_MIXER_MESSAGE_MIXER_CHANGED);
pragma Convention (C, GstMixerMessageType); -- gst/interfaces/mixer.h:90
--*
-- * GstMixerFlags:
-- * @GST_MIXER_FLAG_NONE: No flags
-- * @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
-- * sends notification messages.
-- * @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
-- * should be displayed by default (whitelisted). Since: 0.10.23
-- * @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
-- * marked without either input or output. Controls marked as input or
-- * output should be grouped with input & output sliders, even if they
-- * are options or bare switches. Since: 0.10.23
-- *
-- * Flags indicating which optional features are supported by a mixer
-- * implementation.
-- *
-- * Since: 0.10.14
--
subtype GstMixerFlags is unsigned;
GST_MIXER_FLAG_NONE : constant GstMixerFlags := 0;
GST_MIXER_FLAG_AUTO_NOTIFICATIONS : constant GstMixerFlags := 1;
GST_MIXER_FLAG_HAS_WHITELIST : constant GstMixerFlags := 2;
GST_MIXER_FLAG_GROUPING : constant GstMixerFlags := 4; -- gst/interfaces/mixer.h:115
type GstMixerClass is record
klass : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/mixer.h:118
mixer_type : aliased GstMixerType; -- gst/interfaces/mixer.h:120
list_tracks : access function (arg1 : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/mixer.h:123
set_volume : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:127
get_volume : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:130
set_mute : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:134
set_record : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:137
mute_toggled : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:142
record_toggled : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:145
volume_changed : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:148
set_option : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
arg3 : access GLIB.gchar); -- gst/interfaces/mixer.h:155
get_option : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions) return access GLIB.gchar; -- gst/interfaces/mixer.h:157
option_changed : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
arg3 : access GLIB.gchar); -- gst/interfaces/mixer.h:162
get_mixer_flags : access function (arg1 : System.Address) return GstMixerFlags; -- gst/interfaces/mixer.h:167
u_gst_reserved : u_GstMixerClass_u_gst_reserved_array; -- gst/interfaces/mixer.h:170
end record;
pragma Convention (C_Pass_By_Copy, GstMixerClass); -- gst/interfaces/mixer.h:117
-- virtual functions
-- signals (deprecated)
--< private >
function gst_mixer_get_type return GLIB.GType; -- gst/interfaces/mixer.h:173
pragma Import (C, gst_mixer_get_type, "gst_mixer_get_type");
-- virtual class function wrappers
function gst_mixer_list_tracks (mixer : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/mixer.h:176
pragma Import (C, gst_mixer_list_tracks, "gst_mixer_list_tracks");
procedure gst_mixer_set_volume
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:177
pragma Import (C, gst_mixer_set_volume, "gst_mixer_set_volume");
procedure gst_mixer_get_volume
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:180
pragma Import (C, gst_mixer_get_volume, "gst_mixer_get_volume");
procedure gst_mixer_set_mute
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
mute : GLIB.gboolean); -- gst/interfaces/mixer.h:183
pragma Import (C, gst_mixer_set_mute, "gst_mixer_set_mute");
procedure gst_mixer_set_record
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
c_record : GLIB.gboolean); -- gst/interfaces/mixer.h:186
pragma Import (C, gst_mixer_set_record, "gst_mixer_set_record");
procedure gst_mixer_set_option
(mixer : System.Address;
opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
value : access GLIB.gchar); -- gst/interfaces/mixer.h:189
pragma Import (C, gst_mixer_set_option, "gst_mixer_set_option");
function gst_mixer_get_option (mixer : System.Address; opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions) return access GLIB.gchar; -- gst/interfaces/mixer.h:192
pragma Import (C, gst_mixer_get_option, "gst_mixer_get_option");
-- trigger bus messages
procedure gst_mixer_mute_toggled
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
mute : GLIB.gboolean); -- gst/interfaces/mixer.h:196
pragma Import (C, gst_mixer_mute_toggled, "gst_mixer_mute_toggled");
procedure gst_mixer_record_toggled
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
c_record : GLIB.gboolean); -- gst/interfaces/mixer.h:199
pragma Import (C, gst_mixer_record_toggled, "gst_mixer_record_toggled");
procedure gst_mixer_volume_changed
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:202
pragma Import (C, gst_mixer_volume_changed, "gst_mixer_volume_changed");
procedure gst_mixer_option_changed
(mixer : System.Address;
opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
value : access GLIB.gchar); -- gst/interfaces/mixer.h:205
pragma Import (C, gst_mixer_option_changed, "gst_mixer_option_changed");
procedure gst_mixer_mixer_changed (mixer : System.Address); -- gst/interfaces/mixer.h:209
pragma Import (C, gst_mixer_mixer_changed, "gst_mixer_mixer_changed");
procedure gst_mixer_options_list_changed (mixer : System.Address; opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions); -- gst/interfaces/mixer.h:211
pragma Import (C, gst_mixer_options_list_changed, "gst_mixer_options_list_changed");
function gst_mixer_get_mixer_type (mixer : System.Address) return GstMixerType; -- gst/interfaces/mixer.h:214
pragma Import (C, gst_mixer_get_mixer_type, "gst_mixer_get_mixer_type");
function gst_mixer_get_mixer_flags (mixer : System.Address) return GstMixerFlags; -- gst/interfaces/mixer.h:216
pragma Import (C, gst_mixer_get_mixer_flags, "gst_mixer_get_mixer_flags");
-- Functions for recognising and parsing GstMixerMessages on the bus
function gst_mixer_message_get_type (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage) return GstMixerMessageType; -- gst/interfaces/mixer.h:219
pragma Import (C, gst_mixer_message_get_type, "gst_mixer_message_get_type");
procedure gst_mixer_message_parse_mute_toggled
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
mute : access GLIB.gboolean); -- gst/interfaces/mixer.h:220
pragma Import (C, gst_mixer_message_parse_mute_toggled, "gst_mixer_message_parse_mute_toggled");
procedure gst_mixer_message_parse_record_toggled
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
c_record : access GLIB.gboolean); -- gst/interfaces/mixer.h:223
pragma Import (C, gst_mixer_message_parse_record_toggled, "gst_mixer_message_parse_record_toggled");
procedure gst_mixer_message_parse_volume_changed
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
volumes : System.Address;
num_channels : access GLIB.gint); -- gst/interfaces/mixer.h:226
pragma Import (C, gst_mixer_message_parse_volume_changed, "gst_mixer_message_parse_volume_changed");
procedure gst_mixer_message_parse_option_changed
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
options : System.Address;
value : System.Address); -- gst/interfaces/mixer.h:230
pragma Import (C, gst_mixer_message_parse_option_changed, "gst_mixer_message_parse_option_changed");
procedure gst_mixer_message_parse_options_list_changed (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; options : System.Address); -- gst/interfaces/mixer.h:233
pragma Import (C, gst_mixer_message_parse_options_list_changed, "gst_mixer_message_parse_options_list_changed");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixer_h;
|
examples/grammars/HTMLParser.g4 | vglavnyy/grammarinator | 1 | 3885 | <reponame>vglavnyy/grammarinator
/*
[The "BSD licence"]
Copyright (c) 2013 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// TEST-PROCESS: {grammar}Parser.g4 {grammar}Lexer.g4 -o {tmpdir}
// TEST-GENERATE: -p {grammar}Unparser.py -l {grammar}Unlexer.py -r htmlDocument -t HTMLUnparser.html_space_transformer -n 5 -o {tmpdir}/{grammar}G%d.html
// TEST-GENERATE: -p ../fuzzer/{grammar}CustomUnparser.py -l ../fuzzer/{grammar}CustomUnlexer.py -r htmlDocument -t HTMLUnparser.html_space_transformer -n 5 -o {tmpdir}/{grammar}C%d.html
parser grammar HTMLParser;
options { tokenVocab=HTMLLexer;
dot=any_unicode_char;}
@header {
def html_space_transformer(node):
for child in node.children:
html_space_transformer(child)
if isinstance(node, UnparserRule):
new_children = []
for child in node.children:
new_children.append(child)
if child.name == 'htmlTagName' and child.right_sibling and child.right_sibling.name == 'htmlAttribute' \
or child.name == 'htmlAttribute' \
or isinstance(child, UnlexerRule) and child.src and child.src.endswith(('<script', '<style', '<?xml')):
new_children.append(UnlexerRule(src=' '))
node.children = new_children
return node
}
@parser::member {
def endOfHtmlElement(self):
pass
}
htmlDocument
: (scriptlet | SEA_WS)* xml? (scriptlet | SEA_WS)* dtd? (scriptlet | SEA_WS)* htmlElements*
;
htmlElements
: htmlMisc* htmlElement htmlMisc*
;
htmlElement
: TAG_OPEN open_tag=htmlTagName htmlAttribute* TAG_CLOSE htmlContent TAG_OPEN TAG_SLASH htmlTagName {current.last_child = $open_tag.deepcopy()} TAG_CLOSE {self.endOfHtmlElement()}
| TAG_OPEN open_tag=htmlTagName htmlAttribute* TAG_SLASH_CLOSE {self.endOfHtmlElement()}
| TAG_OPEN open_tag=htmlTagName htmlAttribute* TAG_CLOSE {self.endOfHtmlElement()}
| scriptlet
| script
| style
;
htmlContent
: htmlChardata? ((htmlElement | xhtmlCDATA | htmlComment) htmlChardata?)*
;
htmlAttribute
: attr_name=htmlAttributeName TAG_EQUALS htmlAttributeValue
| attr_name=htmlAttributeName
;
htmlAttributeName
: TAG_NAME
;
htmlAttributeValue
: ATTVALUE_VALUE
;
htmlTagName
: TAG_NAME
;
htmlChardata
: HTML_TEXT
| SEA_WS
;
htmlMisc
: htmlComment
| SEA_WS
;
htmlComment
: HTML_COMMENT
| HTML_CONDITIONAL_COMMENT
;
xhtmlCDATA
: CDATA
;
dtd
: DTD
;
xml
: XML_DECLARATION
;
scriptlet
: SCRIPTLET
;
script
: SCRIPT_OPEN ( SCRIPT_BODY | SCRIPT_SHORT_BODY)
;
style
: STYLE_OPEN ( STYLE_BODY | STYLE_SHORT_BODY)
;
|
OCR-PDFpen.applescript | MirkoLenz/DEVONthink-Scripts | 3 | 15 | <filename>OCR-PDFpen.applescript
on run
tell application id "DNtp"
set _records to selection
repeat with _record in _records
set _file to path of _record
tell application "PDFpenPro"
open (POSIX file _file) as alias
tell document 1
if needs ocr then
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
else
close without saving
end if
end tell
end tell
end repeat
end tell
end run
|
poom-services-domain/src/main/antlr4/org/codingmatters/poom/services/domain/property/query/parsers/PropertyFilter.g4 | nelt/poom-services | 0 | 7630 | grammar PropertyFilter;
/* Lexical rules */
NOT : '!' ;
AND : '&&' ;
OR : '||' ;
LPAR : '(';
RPAR : ')';
COMMA : ',';
TRUE : T R U E ;
FALSE : F A L S E ;
NULL : N U L L ;
IS_EMPTY : I S ' ' E M P T Y;
IS_NOT_EMPTY : I S ' ' N O T ' ' E M P T Y;
GT : '>' ;
GTE : '>=' ;
LT : '<' ;
LTE : '<=' ;
EQ : '==' ;
NEQ : '!=' ;
STARTS_WITH : S T A R T S ' ' W I T H;
ENDS_WITH : E N D S ' ' W I T H;
CONTAINS : C O N T A I N S;
IN : I N;
STARTS_WITH_ANY : S T A R T S ' ' W I T H' ' A N Y;
ENDS_WITH_ANY : E N D S ' ' W I T H ' ' A N Y;
CONTAINS_ANY : C O N T A I N S ' ' A N Y;
CONTAINS_ALL : C O N T A I N S ' ' A L L;
/* Dates and times : watchout, order matters */
ZONED_DATETIME_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9]'.'[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[+\-][0-9][0-9]':'[0-9][0-9];
UTC_DATETIME_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9]'.'[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?'Z';
DATETIME_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9]'.'[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?;
DATE_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9];
TIME_LITERAL: [0-9][0-9]':'[0-9][0-9]':'[0-9][0-9]'.'[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?;
ZONED_DATETIME_WITHOUT_SFRAC_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9][+\-][0-9][0-9]':'[0-9][0-9];
UTC_DATETIME_WITHOUT_SFRAC_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9]'Z';
DATETIME_WITHOUT_SFRAC_LITERAL: [0-9][0-9][0-9][0-9]'-'[0-9][0-9]'-'[0-9][0-9]'T'[0-9][0-9]':'[0-9][0-9]':'[0-9][0-9];
TIME_WITHOUT_SFRAC_LITERAL: [0-9][0-9]':'[0-9][0-9]':'[0-9][0-9];
DECIMAL : '-'?[0-9]+('.'[0-9]+)? ;
IDENTIFIER : [a-zA-Z_\-.0-9]+ ;
QUOTED_STRING: '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'';
WS : [ \r\t\u000C\n]+ -> skip ;
/* Grammar rules */
criterion
: expression EOF
;
expression
: LPAR expression RPAR #parenthesized
| NOT expression #negation
| left=expression AND right=expression #and
| left=expression OR right=expression #or
| IDENTIFIER IS_EMPTY #isEmpty
| IDENTIFIER IS_NOT_EMPTY #isNotEmpty
| IDENTIFIER operator operand #comparison
| IDENTIFIER IN LPAR operand_list RPAR #in
| IDENTIFIER STARTS_WITH_ANY LPAR operand_list RPAR #startsWithAny
| IDENTIFIER ENDS_WITH_ANY LPAR operand_list RPAR #endsWithAny
| IDENTIFIER CONTAINS_ANY LPAR operand_list RPAR #containsAny
| IDENTIFIER CONTAINS_ALL LPAR operand_list RPAR #containsAll
;
operand
: IDENTIFIER #propertyOperand
| DECIMAL #decimalOperand
| QUOTED_STRING #stringOperand
| TRUE #trueOperand
| FALSE #falseOperand
| NULL #nullOperand
| TIME_LITERAL #timeOperand
| TIME_WITHOUT_SFRAC_LITERAL #timeOperand
| DATETIME_LITERAL #datetimeOperand
| DATETIME_WITHOUT_SFRAC_LITERAL #datetimeOperand
| UTC_DATETIME_LITERAL #utcDatetimeOperand
| UTC_DATETIME_WITHOUT_SFRAC_LITERAL #utcDatetimeOperand
| ZONED_DATETIME_LITERAL #zonedDatetimeOperand
| ZONED_DATETIME_WITHOUT_SFRAC_LITERAL #zonedDatetimeOperand
| DATE_LITERAL #dateOperand
;
operand_list
: operand
| operand_list COMMA operand
;
operator
: GT
| GTE
| LT
| LTE
| EQ
| NEQ
| STARTS_WITH
| ENDS_WITH
| CONTAINS
;
fragment A : [aA]; // match either an 'a' or 'A'
fragment B : [bB];
fragment C : [cC];
fragment D : [dD];
fragment E : [eE];
fragment F : [fF];
fragment G : [gG];
fragment H : [hH];
fragment I : [iI];
fragment J : [jJ];
fragment K : [kK];
fragment L : [lL];
fragment M : [mM];
fragment N : [nN];
fragment O : [oO];
fragment P : [pP];
fragment Q : [qQ];
fragment R : [rR];
fragment S : [sS];
fragment T : [tT];
fragment U : [uU];
fragment V : [vV];
fragment W : [wW];
fragment X : [xX];
fragment Y : [yY];
fragment Z : [zZ]; |
P6/P6Judger - 100 testpoints/testpoint/testpoint60.asm | flyinglandlord/BUAA-CO-2021 | 5 | 84106 | <reponame>flyinglandlord/BUAA-CO-2021<gh_stars>1-10
ori $1, $0, 3
ori $2, $0, 9
ori $3, $0, 7
ori $4, $0, 9
sw $2, 0($0)
sw $4, 4($0)
sw $3, 8($0)
sw $2, 12($0)
sw $2, 16($0)
sw $3, 20($0)
sw $1, 24($0)
sw $3, 28($0)
sw $4, 32($0)
sw $1, 36($0)
sw $4, 40($0)
sw $1, 44($0)
sw $3, 48($0)
sw $3, 52($0)
sw $3, 56($0)
sw $1, 60($0)
sw $3, 64($0)
sw $3, 68($0)
sw $3, 72($0)
sw $1, 76($0)
sw $2, 80($0)
sw $2, 84($0)
sw $2, 88($0)
sw $4, 92($0)
sw $1, 96($0)
sw $4, 100($0)
sw $1, 104($0)
sw $4, 108($0)
sw $2, 112($0)
sw $2, 116($0)
sw $4, 120($0)
sw $3, 124($0)
beq $2, $2, TAG1
mflo $2
mtlo $2
lui $1, 11
TAG1:
bne $1, $1, TAG2
mthi $1
bne $1, $1, TAG2
sb $1, 0($1)
TAG2:
bltz $1, TAG3
lb $4, 0($1)
sb $4, 0($4)
bltz $1, TAG3
TAG3:
lui $3, 0
mult $4, $3
addu $3, $3, $4
mtlo $3
TAG4:
multu $3, $3
sb $3, 0($3)
mflo $2
sb $3, 0($3)
TAG5:
lui $4, 14
mult $2, $4
div $2, $4
xori $2, $4, 3
TAG6:
mflo $4
bgez $4, TAG7
mtlo $4
blez $2, TAG7
TAG7:
sh $4, 0($4)
mthi $4
beq $4, $4, TAG8
mult $4, $4
TAG8:
lb $4, 0($4)
bgez $4, TAG9
multu $4, $4
slt $3, $4, $4
TAG9:
lui $3, 7
bgez $3, TAG10
sll $0, $0, 0
mthi $3
TAG10:
mult $4, $4
lui $1, 2
mfhi $4
mtlo $4
TAG11:
mtlo $4
mflo $3
xor $2, $3, $4
bgez $3, TAG12
TAG12:
mflo $2
slt $1, $2, $2
mthi $2
mflo $2
TAG13:
mult $2, $2
bgtz $2, TAG14
mult $2, $2
slt $3, $2, $2
TAG14:
sb $3, 0($3)
mult $3, $3
lui $2, 14
blez $3, TAG15
TAG15:
sllv $2, $2, $2
sltiu $4, $2, 7
andi $4, $4, 7
mult $4, $4
TAG16:
lui $4, 2
bne $4, $4, TAG17
mflo $1
mthi $4
TAG17:
lw $2, 0($1)
slt $2, $1, $2
mflo $3
multu $2, $1
TAG18:
sh $3, 0($3)
mult $3, $3
multu $3, $3
beq $3, $3, TAG19
TAG19:
sra $4, $3, 3
lhu $1, 0($4)
mult $3, $3
sh $1, 0($1)
TAG20:
bgtz $1, TAG21
multu $1, $1
sll $4, $1, 6
mfhi $2
TAG21:
mfhi $3
sltu $4, $2, $2
mtlo $2
sllv $4, $3, $4
TAG22:
lui $1, 11
sh $4, 0($4)
sll $0, $0, 0
addu $1, $4, $4
TAG23:
lui $2, 11
beq $2, $1, TAG24
mult $1, $2
lui $1, 15
TAG24:
sll $0, $0, 0
multu $1, $4
sllv $4, $1, $1
or $1, $1, $4
TAG25:
blez $1, TAG26
mfhi $1
multu $1, $1
beq $1, $1, TAG26
TAG26:
mthi $1
lw $3, 0($1)
sltiu $3, $3, 0
slti $1, $3, 2
TAG27:
lui $1, 2
mtlo $1
srl $2, $1, 6
div $1, $1
TAG28:
xori $1, $2, 12
sb $2, -2048($2)
sllv $3, $2, $1
mtlo $2
TAG29:
beq $3, $3, TAG30
sll $0, $0, 0
mfhi $1
blez $3, TAG30
TAG30:
mflo $2
sh $2, -2060($1)
mfhi $3
sh $3, -2048($2)
TAG31:
mtlo $3
bne $3, $3, TAG32
lb $3, 0($3)
multu $3, $3
TAG32:
srl $2, $3, 0
lb $2, 0($3)
lui $3, 2
beq $2, $3, TAG33
TAG33:
sll $0, $0, 0
sll $0, $0, 0
lui $3, 15
addiu $1, $3, 4
TAG34:
bne $1, $1, TAG35
lui $2, 5
beq $2, $2, TAG35
mflo $3
TAG35:
beq $3, $3, TAG36
lui $1, 2
mtlo $1
sh $1, 0($3)
TAG36:
lui $3, 10
sll $0, $0, 0
sll $4, $1, 0
addiu $4, $4, 3
TAG37:
mthi $4
div $4, $4
mthi $4
div $4, $4
TAG38:
mthi $4
srav $2, $4, $4
bne $2, $4, TAG39
mfhi $2
TAG39:
beq $2, $2, TAG40
subu $2, $2, $2
bne $2, $2, TAG40
mthi $2
TAG40:
lui $1, 13
mfhi $4
lui $1, 3
multu $1, $1
TAG41:
bne $1, $1, TAG42
mthi $1
lui $1, 10
lui $1, 5
TAG42:
bgtz $1, TAG43
mthi $1
lui $1, 0
div $1, $1
TAG43:
mflo $1
mfhi $3
bltz $1, TAG44
sll $0, $0, 0
TAG44:
mtlo $3
mfhi $4
sll $0, $0, 0
sll $0, $0, 0
TAG45:
or $4, $2, $2
sltu $1, $2, $4
xori $1, $1, 11
mthi $2
TAG46:
lbu $4, 0($1)
blez $1, TAG47
mtlo $4
beq $4, $4, TAG47
TAG47:
mflo $1
sw $1, 0($4)
bne $1, $1, TAG48
mflo $1
TAG48:
lb $4, 0($1)
bltz $1, TAG49
lui $4, 14
lui $1, 11
TAG49:
bgtz $1, TAG50
lui $4, 2
mtlo $4
lhu $3, 0($1)
TAG50:
or $3, $3, $3
mthi $3
bne $3, $3, TAG51
srav $1, $3, $3
TAG51:
bgtz $1, TAG52
sll $0, $0, 0
lw $3, 0($1)
bgtz $1, TAG52
TAG52:
sll $2, $3, 6
subu $4, $3, $2
beq $3, $4, TAG53
mtlo $4
TAG53:
lui $4, 12
beq $4, $4, TAG54
sll $0, $0, 0
sltu $3, $4, $4
TAG54:
bgez $3, TAG55
mflo $1
mflo $1
sh $3, 0($1)
TAG55:
mult $1, $1
lui $3, 3
xori $2, $1, 5
sll $0, $0, 0
TAG56:
addu $4, $2, $2
lui $4, 11
subu $2, $4, $4
bne $2, $2, TAG57
TAG57:
sltiu $3, $2, 12
mult $2, $2
lbu $1, 0($2)
lui $2, 9
TAG58:
lui $2, 1
beq $2, $2, TAG59
srl $3, $2, 6
addi $1, $2, 13
TAG59:
addi $2, $1, 15
mflo $2
beq $2, $1, TAG60
andi $2, $2, 11
TAG60:
mult $2, $2
lui $3, 15
lui $3, 11
lbu $4, 0($2)
TAG61:
lbu $4, 0($4)
multu $4, $4
beq $4, $4, TAG62
lui $3, 15
TAG62:
sll $0, $0, 0
bne $3, $3, TAG63
addiu $2, $3, 3
lui $2, 7
TAG63:
bgtz $2, TAG64
srl $3, $2, 3
div $2, $2
bne $3, $2, TAG64
TAG64:
mthi $3
bgtz $3, TAG65
nor $4, $3, $3
sltiu $1, $4, 14
TAG65:
lb $4, 0($1)
mflo $2
mult $2, $4
beq $1, $2, TAG66
TAG66:
mthi $2
mfhi $3
lbu $3, 0($2)
bne $3, $3, TAG67
TAG67:
sll $3, $3, 12
lui $3, 2
bgez $3, TAG68
lui $1, 5
TAG68:
mtlo $1
mthi $1
mtlo $1
mflo $2
TAG69:
sll $0, $0, 0
mflo $2
bltz $1, TAG70
sll $0, $0, 0
TAG70:
mtlo $2
mfhi $3
mtlo $2
and $3, $2, $3
TAG71:
mflo $2
bgtz $2, TAG72
mflo $2
lw $4, 0($2)
TAG72:
xor $2, $4, $4
lui $4, 13
mflo $2
bgez $2, TAG73
TAG73:
sll $0, $0, 0
mtlo $2
sll $0, $0, 0
addu $4, $2, $2
TAG74:
mfhi $4
bltz $4, TAG75
sll $0, $0, 0
xori $1, $4, 3
TAG75:
sra $3, $1, 2
sll $0, $0, 0
multu $3, $3
mult $3, $3
TAG76:
div $3, $3
sltiu $3, $3, 11
multu $3, $3
lui $4, 6
TAG77:
nor $3, $4, $4
mfhi $3
lh $3, 0($3)
mflo $2
TAG78:
ori $4, $2, 0
bgez $2, TAG79
sb $2, 0($4)
or $2, $4, $4
TAG79:
lui $3, 7
sh $2, 0($2)
mtlo $2
mthi $2
TAG80:
divu $3, $3
sll $0, $0, 0
sll $0, $0, 0
sra $2, $3, 11
TAG81:
ori $4, $2, 8
slti $4, $2, 0
beq $4, $4, TAG82
div $4, $2
TAG82:
lhu $2, 0($4)
addiu $3, $4, 7
lb $2, 0($4)
mtlo $4
TAG83:
slti $1, $2, 7
bne $1, $1, TAG84
lhu $4, 0($2)
divu $1, $1
TAG84:
bgtz $4, TAG85
sll $4, $4, 7
bltz $4, TAG85
lh $4, 0($4)
TAG85:
lhu $1, 0($4)
addiu $2, $1, 2
bgez $4, TAG86
multu $1, $4
TAG86:
bne $2, $2, TAG87
lbu $3, 0($2)
mult $2, $2
slt $2, $2, $3
TAG87:
sb $2, 0($2)
mult $2, $2
multu $2, $2
multu $2, $2
TAG88:
multu $2, $2
sltiu $4, $2, 12
bltz $4, TAG89
lui $4, 14
TAG89:
mfhi $3
beq $4, $3, TAG90
mthi $4
mult $3, $3
TAG90:
bltz $3, TAG91
lhu $4, 0($3)
bgez $3, TAG91
srlv $3, $3, $4
TAG91:
bgtz $3, TAG92
srlv $3, $3, $3
lui $2, 10
sw $3, 0($3)
TAG92:
mtlo $2
mtlo $2
xor $4, $2, $2
blez $2, TAG93
TAG93:
mult $4, $4
nor $3, $4, $4
beq $4, $3, TAG94
mflo $1
TAG94:
sw $1, 0($1)
bgtz $1, TAG95
mtlo $1
lb $3, 0($1)
TAG95:
blez $3, TAG96
sub $1, $3, $3
sw $1, 0($1)
ori $4, $1, 11
TAG96:
and $2, $4, $4
lh $4, 0($2)
lw $1, 0($4)
lh $3, 0($4)
TAG97:
blez $3, TAG98
lui $4, 10
addi $2, $3, 2
ori $1, $2, 1
TAG98:
mtlo $1
subu $4, $1, $1
beq $1, $4, TAG99
lhu $3, 0($1)
TAG99:
sltiu $3, $3, 13
lui $2, 6
blez $2, TAG100
sltiu $3, $3, 12
TAG100:
mtlo $3
mthi $3
lui $1, 10
sb $3, 0($3)
TAG101:
mfhi $1
beq $1, $1, TAG102
sb $1, 0($1)
mfhi $2
TAG102:
sll $0, $0, 0
lui $2, 10
bne $2, $2, TAG103
sll $0, $0, 0
TAG103:
mult $3, $3
mfhi $4
sub $2, $4, $4
bgtz $2, TAG104
TAG104:
lh $3, 0($2)
sb $3, -256($3)
div $3, $3
bgez $2, TAG105
TAG105:
lui $2, 10
sb $2, -256($3)
addiu $3, $3, 4
lh $1, -260($3)
TAG106:
ori $3, $1, 13
mflo $4
sh $3, -256($1)
sb $1, 0($4)
TAG107:
sb $4, 0($4)
addu $2, $4, $4
bgtz $2, TAG108
sb $4, 0($4)
TAG108:
mflo $1
lh $1, 0($2)
beq $1, $1, TAG109
lbu $4, 0($1)
TAG109:
lb $4, 0($4)
or $2, $4, $4
mflo $1
lw $1, 0($4)
TAG110:
mtlo $1
sh $1, -269($1)
lbu $3, -269($1)
beq $1, $1, TAG111
TAG111:
lbu $3, 0($3)
addiu $2, $3, 4
xori $1, $3, 4
mtlo $3
TAG112:
lbu $1, 0($1)
beq $1, $1, TAG113
sra $2, $1, 8
mflo $2
TAG113:
mflo $1
lui $1, 13
sw $2, 0($2)
addi $4, $2, 14
TAG114:
bgtz $4, TAG115
addiu $2, $4, 2
sltiu $4, $2, 2
sw $2, 0($4)
TAG115:
nor $3, $4, $4
subu $4, $3, $3
bne $3, $3, TAG116
sb $4, 0($4)
TAG116:
multu $4, $4
mtlo $4
sw $4, 0($4)
addi $1, $4, 11
TAG117:
nor $2, $1, $1
mtlo $2
blez $1, TAG118
slt $3, $2, $1
TAG118:
divu $3, $3
blez $3, TAG119
sll $1, $3, 6
bltz $3, TAG119
TAG119:
lui $3, 7
mflo $3
div $1, $3
bne $3, $1, TAG120
TAG120:
mflo $2
mtlo $2
lhu $1, 0($2)
mtlo $3
TAG121:
srl $1, $1, 6
srl $1, $1, 14
and $4, $1, $1
bne $1, $4, TAG122
TAG122:
mflo $4
sb $4, 0($4)
lb $4, 0($4)
addiu $2, $4, 1
TAG123:
bne $2, $2, TAG124
mtlo $2
mtlo $2
bne $2, $2, TAG124
TAG124:
xori $2, $2, 7
sb $2, 0($2)
sllv $1, $2, $2
sb $2, 0($2)
TAG125:
mthi $1
mult $1, $1
mtlo $1
sb $1, -160($1)
TAG126:
mtlo $1
lh $2, -160($1)
lbu $1, -160($1)
mfhi $2
TAG127:
lui $3, 0
multu $3, $3
lw $1, 0($3)
sb $2, 0($2)
TAG128:
sw $1, -416($1)
lhu $1, -416($1)
bne $1, $1, TAG129
sw $1, -416($1)
TAG129:
mtlo $1
div $1, $1
mult $1, $1
mthi $1
TAG130:
and $3, $1, $1
bne $3, $3, TAG131
lui $2, 3
addu $4, $2, $1
TAG131:
sll $0, $0, 0
sll $0, $0, 0
div $4, $4
srlv $3, $4, $4
TAG132:
or $4, $3, $3
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
TAG133:
bgez $4, TAG134
mthi $4
bne $4, $4, TAG134
sllv $1, $4, $4
TAG134:
srlv $4, $1, $1
bgtz $1, TAG135
lb $1, -416($4)
lh $1, 0($1)
TAG135:
mflo $4
bgtz $4, TAG136
srl $4, $1, 13
lw $4, 0($4)
TAG136:
mtlo $4
multu $4, $4
beq $4, $4, TAG137
mthi $4
TAG137:
addu $1, $4, $4
beq $1, $4, TAG138
lui $3, 7
bgez $1, TAG138
TAG138:
andi $1, $3, 1
subu $3, $1, $1
lui $2, 2
mtlo $1
TAG139:
beq $2, $2, TAG140
xori $4, $2, 14
mflo $1
bltz $4, TAG140
TAG140:
and $2, $1, $1
mult $1, $2
mthi $1
sllv $3, $2, $2
TAG141:
mult $3, $3
beq $3, $3, TAG142
sb $3, 0($3)
mflo $1
TAG142:
sra $1, $1, 2
sh $1, 0($1)
mtlo $1
lui $1, 2
TAG143:
sllv $1, $1, $1
mult $1, $1
sll $0, $0, 0
andi $3, $1, 15
TAG144:
sll $4, $3, 6
sw $4, 0($3)
lui $2, 11
mult $3, $4
TAG145:
lui $1, 5
mthi $2
mtlo $2
mfhi $2
TAG146:
addiu $3, $2, 12
bltz $2, TAG147
sltu $4, $2, $3
sll $0, $0, 0
TAG147:
bne $2, $2, TAG148
multu $2, $2
mflo $3
mflo $2
TAG148:
mtlo $2
sw $2, 0($2)
mtlo $2
bltz $2, TAG149
TAG149:
sw $2, 0($2)
mtlo $2
bgez $2, TAG150
addi $4, $2, 4
TAG150:
mfhi $4
mfhi $1
lb $1, 0($1)
sw $4, 0($1)
TAG151:
sra $1, $1, 6
mult $1, $1
mtlo $1
beq $1, $1, TAG152
TAG152:
lui $3, 3
bne $1, $3, TAG153
lui $1, 11
lui $4, 0
TAG153:
mfhi $4
mthi $4
bne $4, $4, TAG154
slt $4, $4, $4
TAG154:
sra $2, $4, 3
bgez $2, TAG155
sh $4, 0($4)
sltiu $3, $4, 3
TAG155:
sll $0, $0, 0
sra $3, $3, 0
sll $0, $0, 0
div $3, $3
TAG156:
bne $2, $2, TAG157
lui $3, 11
multu $2, $2
sll $0, $0, 0
TAG157:
mfhi $4
mtlo $4
bgez $4, TAG158
and $4, $4, $4
TAG158:
sll $1, $4, 8
bgtz $1, TAG159
mflo $1
addiu $3, $1, 15
TAG159:
sb $3, 0($3)
andi $1, $3, 12
andi $3, $3, 1
bne $3, $3, TAG160
TAG160:
sb $3, 0($3)
mfhi $4
mtlo $4
sb $4, 0($3)
TAG161:
mult $4, $4
xori $2, $4, 5
lb $1, 0($2)
lb $2, 0($4)
TAG162:
mfhi $2
multu $2, $2
and $1, $2, $2
mflo $3
TAG163:
bgtz $3, TAG164
mflo $3
sll $3, $3, 10
lb $3, 0($3)
TAG164:
lb $4, 0($3)
mfhi $1
lui $3, 4
bltz $1, TAG165
TAG165:
mtlo $3
lui $3, 13
div $3, $3
bne $3, $3, TAG166
TAG166:
sll $0, $0, 0
lui $3, 13
xori $3, $3, 0
nor $3, $3, $3
TAG167:
srl $3, $3, 1
lui $2, 14
mthi $3
lui $2, 4
TAG168:
addu $2, $2, $2
sll $0, $0, 0
sll $0, $0, 0
slti $1, $2, 15
TAG169:
lhu $1, 0($1)
lbu $4, 0($1)
beq $1, $1, TAG170
mult $4, $1
TAG170:
sb $4, 0($4)
sltiu $2, $4, 1
lui $3, 0
addu $4, $4, $4
TAG171:
sw $4, 0($4)
mfhi $1
sb $4, 0($1)
lui $4, 10
TAG172:
multu $4, $4
lui $2, 3
sll $0, $0, 0
addiu $2, $4, 9
TAG173:
addiu $2, $2, 15
lui $1, 10
bne $1, $2, TAG174
sll $0, $0, 0
TAG174:
srlv $4, $1, $1
bne $1, $4, TAG175
lui $3, 2
mult $4, $4
TAG175:
sll $0, $0, 0
mfhi $4
mult $4, $4
mthi $4
TAG176:
lb $2, 0($4)
slti $2, $4, 0
blez $2, TAG177
lbu $3, 0($2)
TAG177:
bgez $3, TAG178
mfhi $2
lhu $3, 0($2)
multu $3, $3
TAG178:
lh $1, 0($3)
mflo $3
divu $3, $3
lw $2, -10000($3)
TAG179:
addi $1, $2, 6
bltz $2, TAG180
mult $2, $2
beq $2, $2, TAG180
TAG180:
mflo $1
sh $1, 0($1)
mtlo $1
or $2, $1, $1
TAG181:
blez $2, TAG182
sra $2, $2, 5
mflo $4
sw $2, 0($2)
TAG182:
sh $4, 0($4)
lui $3, 7
sb $4, 0($4)
mtlo $3
TAG183:
sll $0, $0, 0
slt $4, $3, $3
bgez $3, TAG184
mfhi $4
TAG184:
mult $4, $4
multu $4, $4
mflo $4
beq $4, $4, TAG185
TAG185:
srav $3, $4, $4
xor $4, $3, $3
mthi $4
sb $4, 0($4)
TAG186:
mtlo $4
mult $4, $4
beq $4, $4, TAG187
xor $2, $4, $4
TAG187:
lh $4, 0($2)
bne $2, $2, TAG188
lui $1, 4
nor $1, $4, $4
TAG188:
addiu $2, $1, 4
mtlo $1
sw $2, 1($1)
srl $1, $2, 3
TAG189:
bltz $1, TAG190
mthi $1
sw $1, 0($1)
bne $1, $1, TAG190
TAG190:
mult $1, $1
ori $3, $1, 1
sb $1, 0($3)
div $3, $3
TAG191:
bgez $3, TAG192
ori $2, $3, 15
div $3, $2
lui $4, 14
TAG192:
sllv $3, $4, $4
sw $4, 0($3)
slti $3, $4, 15
sllv $4, $3, $3
TAG193:
mtlo $4
andi $3, $4, 3
sb $3, 0($4)
mthi $3
TAG194:
blez $3, TAG195
addiu $4, $3, 9
bgez $4, TAG195
divu $4, $4
TAG195:
mflo $4
bgez $4, TAG196
sb $4, 0($4)
beq $4, $4, TAG196
TAG196:
lui $2, 2
lb $2, 0($4)
addu $1, $4, $4
sb $2, 0($4)
TAG197:
lbu $4, 0($1)
sh $4, 0($4)
sh $4, 0($4)
mult $4, $4
TAG198:
bgtz $4, TAG199
mflo $3
lui $1, 10
bne $1, $3, TAG199
TAG199:
mult $1, $1
beq $1, $1, TAG200
mflo $3
addi $1, $3, 13
TAG200:
sb $1, 0($1)
mthi $1
sra $4, $1, 5
mthi $4
TAG201:
mfhi $2
addu $4, $2, $2
mflo $3
lw $4, 0($2)
TAG202:
blez $4, TAG203
mflo $3
sll $0, $0, 0
sllv $2, $4, $4
TAG203:
xor $1, $2, $2
lui $4, 12
lui $1, 3
bgez $1, TAG204
TAG204:
xori $2, $1, 9
bgtz $1, TAG205
addu $3, $1, $2
bne $2, $1, TAG205
TAG205:
srl $2, $3, 8
addu $2, $3, $3
bltz $2, TAG206
ori $1, $2, 7
TAG206:
slti $4, $1, 12
div $4, $1
mfhi $1
mfhi $4
TAG207:
lui $3, 10
sltiu $3, $3, 7
lbu $4, 0($3)
andi $2, $3, 6
TAG208:
mthi $2
srl $2, $2, 15
sh $2, 0($2)
sw $2, 0($2)
TAG209:
mflo $4
mthi $2
multu $4, $4
mflo $2
TAG210:
mflo $1
mult $2, $2
sb $1, 0($1)
mflo $1
TAG211:
mult $1, $1
sw $1, 0($1)
sh $1, 0($1)
xori $3, $1, 13
TAG212:
bgtz $3, TAG213
mult $3, $3
lh $2, 0($3)
bgtz $3, TAG213
TAG213:
sw $2, 0($2)
blez $2, TAG214
lui $1, 11
mult $1, $1
TAG214:
addu $3, $1, $1
sll $0, $0, 0
divu $1, $1
ori $4, $1, 3
TAG215:
lui $1, 10
srl $3, $4, 3
mtlo $1
mflo $2
TAG216:
sll $0, $0, 0
srl $1, $2, 4
srl $1, $2, 15
lh $1, 0($1)
TAG217:
mtlo $1
or $1, $1, $1
mtlo $1
sb $1, 0($1)
TAG218:
multu $1, $1
bltz $1, TAG219
mthi $1
mflo $3
TAG219:
sb $3, 0($3)
lbu $4, 0($3)
srl $3, $3, 10
mult $3, $3
TAG220:
bltz $3, TAG221
mult $3, $3
lh $1, 0($3)
addu $3, $3, $1
TAG221:
mfhi $2
blez $3, TAG222
sh $2, 0($3)
bgez $2, TAG222
TAG222:
sw $2, 0($2)
lb $1, 0($2)
multu $1, $1
bltz $1, TAG223
TAG223:
sb $1, 0($1)
lhu $3, 0($1)
addi $2, $1, 12
divu $1, $2
TAG224:
mflo $1
slti $2, $1, 11
lbu $3, 0($2)
lui $1, 15
TAG225:
lui $4, 12
bgtz $1, TAG226
mtlo $1
lui $2, 1
TAG226:
xori $1, $2, 15
bgez $2, TAG227
mthi $2
sltiu $3, $2, 5
TAG227:
mfhi $3
lb $3, 0($3)
mult $3, $3
bgtz $3, TAG228
TAG228:
srav $2, $3, $3
beq $2, $3, TAG229
sw $2, 0($3)
divu $3, $2
TAG229:
sra $1, $2, 3
lui $3, 0
ori $4, $1, 12
sw $3, 0($3)
TAG230:
lw $3, 0($4)
mfhi $3
divu $4, $4
mtlo $4
TAG231:
mtlo $3
sw $3, 0($3)
mflo $4
bgtz $3, TAG232
TAG232:
mthi $4
bne $4, $4, TAG233
lui $4, 9
mfhi $3
TAG233:
sh $3, 0($3)
lbu $2, 0($3)
mthi $3
xori $1, $2, 8
TAG234:
bne $1, $1, TAG235
addu $2, $1, $1
bltz $1, TAG235
lui $4, 3
TAG235:
slti $2, $4, 2
srav $4, $4, $2
bne $4, $4, TAG236
sltu $4, $2, $4
TAG236:
bgtz $4, TAG237
mfhi $1
sb $4, 0($1)
bgtz $1, TAG237
TAG237:
mult $1, $1
sb $1, 0($1)
sh $1, 0($1)
lh $1, 0($1)
TAG238:
multu $1, $1
bgez $1, TAG239
multu $1, $1
blez $1, TAG239
TAG239:
lui $3, 1
sll $4, $3, 2
lui $4, 12
addu $3, $4, $4
TAG240:
sltu $3, $3, $3
mflo $4
mflo $3
mflo $1
TAG241:
bne $1, $1, TAG242
multu $1, $1
lh $2, 0($1)
sw $2, 0($1)
TAG242:
lb $1, 0($2)
mfhi $4
mult $1, $4
mtlo $2
TAG243:
mtlo $4
mfhi $3
mtlo $4
lhu $2, 0($3)
TAG244:
sb $2, 0($2)
lhu $3, 0($2)
mfhi $3
sub $3, $3, $3
TAG245:
lw $1, 0($3)
bgtz $3, TAG246
mfhi $2
blez $2, TAG246
TAG246:
sb $2, 0($2)
mthi $2
addu $3, $2, $2
lui $2, 13
TAG247:
sll $0, $0, 0
sll $0, $0, 0
mfhi $4
lw $1, 0($4)
TAG248:
bne $1, $1, TAG249
xor $4, $1, $1
mult $4, $1
sb $1, 0($4)
TAG249:
slt $1, $4, $4
bltz $1, TAG250
lw $2, 0($1)
subu $1, $1, $2
TAG250:
lh $4, 0($1)
bne $1, $4, TAG251
sub $3, $1, $1
lui $3, 7
TAG251:
xori $1, $3, 11
sll $0, $0, 0
lui $2, 3
addu $1, $2, $1
TAG252:
sll $0, $0, 0
sb $1, 0($4)
mfhi $4
andi $2, $4, 10
TAG253:
sh $2, 0($2)
beq $2, $2, TAG254
ori $1, $2, 11
lh $1, 0($2)
TAG254:
sb $1, 0($1)
mfhi $4
sw $4, 0($4)
lbu $2, 0($1)
TAG255:
mult $2, $2
mfhi $2
mtlo $2
mflo $2
TAG256:
multu $2, $2
mflo $1
mflo $4
sltiu $4, $4, 2
TAG257:
bltz $4, TAG258
sb $4, 0($4)
lb $4, 0($4)
mfhi $1
TAG258:
sb $1, 0($1)
lui $4, 12
bgtz $4, TAG259
mtlo $1
TAG259:
sll $0, $0, 0
bltz $4, TAG260
mult $4, $4
sllv $4, $4, $4
TAG260:
sll $0, $0, 0
sra $3, $4, 1
div $3, $4
mult $3, $3
TAG261:
lui $4, 2
lui $1, 7
lui $3, 14
beq $3, $3, TAG262
TAG262:
mflo $4
mtlo $3
sll $0, $0, 0
beq $3, $4, TAG263
TAG263:
mult $4, $4
lhu $4, 0($4)
divu $4, $4
mfhi $2
TAG264:
mfhi $4
multu $4, $2
slt $2, $4, $2
lhu $4, 0($2)
TAG265:
srl $2, $4, 4
blez $4, TAG266
mfhi $3
and $3, $3, $4
TAG266:
ori $4, $3, 10
lhu $1, 0($4)
sb $4, 0($4)
mthi $1
TAG267:
beq $1, $1, TAG268
mult $1, $1
sll $3, $1, 7
bne $3, $1, TAG268
TAG268:
lw $2, 0($3)
multu $3, $2
lb $4, -256($2)
mult $3, $3
TAG269:
mflo $3
srl $1, $3, 12
bgez $3, TAG270
mflo $1
TAG270:
mtlo $1
bgtz $1, TAG271
slti $2, $1, 11
and $4, $1, $2
TAG271:
sh $4, 0($4)
mfhi $1
beq $4, $4, TAG272
lui $1, 8
TAG272:
mtlo $1
bne $1, $1, TAG273
mthi $1
mthi $1
TAG273:
mult $1, $1
mtlo $1
addiu $2, $1, 9
xori $2, $2, 8
TAG274:
xor $3, $2, $2
beq $2, $2, TAG275
addu $3, $3, $3
mfhi $3
TAG275:
bgez $3, TAG276
lui $3, 6
bgtz $3, TAG276
mthi $3
TAG276:
div $3, $3
beq $3, $3, TAG277
div $3, $3
mult $3, $3
TAG277:
bltz $3, TAG278
div $3, $3
mflo $1
lbu $1, 0($1)
TAG278:
beq $1, $1, TAG279
lhu $2, 0($1)
sw $1, 0($1)
bltz $1, TAG279
TAG279:
lh $2, 0($2)
lw $4, 0($2)
subu $1, $2, $2
lui $1, 2
TAG280:
mfhi $2
mtlo $1
lui $1, 8
beq $1, $2, TAG281
TAG281:
divu $1, $1
addu $2, $1, $1
sra $1, $2, 3
sll $0, $0, 0
TAG282:
blez $2, TAG283
sll $0, $0, 0
beq $2, $2, TAG283
lui $4, 7
TAG283:
blez $4, TAG284
multu $4, $4
bgez $4, TAG284
sll $1, $4, 14
TAG284:
mult $1, $1
mflo $3
bgez $1, TAG285
mfhi $2
TAG285:
sll $0, $0, 0
sll $0, $0, 0
div $2, $2
sll $0, $0, 0
TAG286:
lui $1, 10
bne $1, $1, TAG287
mfhi $4
mthi $4
TAG287:
mthi $4
bne $4, $4, TAG288
mflo $2
sh $2, 0($4)
TAG288:
sb $2, 0($2)
mthi $2
mult $2, $2
xor $3, $2, $2
TAG289:
beq $3, $3, TAG290
slti $4, $3, 10
bgtz $3, TAG290
add $2, $3, $3
TAG290:
andi $2, $2, 10
mult $2, $2
sllv $3, $2, $2
bltz $3, TAG291
TAG291:
sra $4, $3, 9
lh $2, 0($4)
mfhi $2
blez $3, TAG292
TAG292:
mtlo $2
blez $2, TAG293
sra $2, $2, 15
addi $2, $2, 7
TAG293:
sw $2, 0($2)
multu $2, $2
lui $2, 4
bgez $2, TAG294
TAG294:
mtlo $2
lui $3, 14
sll $0, $0, 0
div $3, $3
TAG295:
lui $4, 2
andi $3, $4, 2
lui $2, 0
and $4, $4, $2
TAG296:
mthi $4
beq $4, $4, TAG297
lb $3, 0($4)
mtlo $3
TAG297:
sh $3, 0($3)
sw $3, 0($3)
srl $1, $3, 5
beq $1, $3, TAG298
TAG298:
mult $1, $1
bgtz $1, TAG299
mult $1, $1
mthi $1
TAG299:
lb $3, 0($1)
add $1, $3, $1
lh $3, 0($1)
mult $3, $1
TAG300:
mfhi $4
sb $3, 0($4)
mflo $4
mtlo $3
TAG301:
mfhi $4
mtlo $4
beq $4, $4, TAG302
sw $4, 0($4)
TAG302:
nor $2, $4, $4
lui $4, 7
bltz $4, TAG303
divu $4, $4
TAG303:
mthi $4
mtlo $4
beq $4, $4, TAG304
multu $4, $4
TAG304:
beq $4, $4, TAG305
and $3, $4, $4
div $4, $3
mflo $3
TAG305:
sll $0, $0, 0
sltiu $1, $1, 8
multu $1, $1
mthi $1
TAG306:
mfhi $1
lui $2, 9
bltz $2, TAG307
lui $2, 0
TAG307:
add $3, $2, $2
bne $2, $2, TAG308
slt $3, $2, $3
mfhi $4
TAG308:
bne $4, $4, TAG309
sll $4, $4, 0
sb $4, 0($4)
lui $1, 2
TAG309:
bltz $1, TAG310
sltu $2, $1, $1
mthi $1
bgez $1, TAG310
TAG310:
multu $2, $2
lui $4, 2
slt $3, $4, $2
lbu $2, 0($2)
TAG311:
lbu $4, 0($2)
sll $1, $4, 3
mtlo $4
mfhi $3
TAG312:
lbu $1, 0($3)
bltz $1, TAG313
mthi $1
lbu $1, 0($1)
TAG313:
beq $1, $1, TAG314
lui $1, 14
mthi $1
sb $1, 0($1)
TAG314:
sra $3, $1, 6
lui $3, 10
bne $3, $3, TAG315
lui $3, 11
TAG315:
sll $0, $0, 0
beq $3, $4, TAG316
slti $1, $4, 2
mfhi $4
TAG316:
mult $4, $4
mult $4, $4
beq $4, $4, TAG317
sb $4, 0($4)
TAG317:
lui $4, 0
mtlo $4
sw $4, 0($4)
bne $4, $4, TAG318
TAG318:
ori $2, $4, 6
lb $4, 0($4)
sltiu $3, $4, 9
sllv $2, $4, $3
TAG319:
xor $4, $2, $2
mtlo $4
subu $4, $2, $2
lhu $1, 0($4)
TAG320:
bgtz $1, TAG321
xor $4, $1, $1
sh $4, 0($4)
subu $1, $1, $4
TAG321:
mthi $1
bgez $1, TAG322
nor $3, $1, $1
lw $1, 0($1)
TAG322:
mflo $2
mthi $1
bne $2, $1, TAG323
sb $1, 0($1)
TAG323:
beq $2, $2, TAG324
multu $2, $2
lbu $2, 0($2)
srlv $1, $2, $2
TAG324:
blez $1, TAG325
mflo $2
multu $2, $1
lui $2, 10
TAG325:
lw $3, 0($2)
lb $2, 0($3)
mthi $3
bltz $3, TAG326
TAG326:
addu $4, $2, $2
lui $2, 8
ori $4, $2, 10
bltz $2, TAG327
TAG327:
addiu $1, $4, 8
multu $1, $4
mflo $1
sll $0, $0, 0
TAG328:
lui $3, 2
slti $4, $4, 1
divu $3, $3
mthi $4
TAG329:
beq $4, $4, TAG330
sh $4, 0($4)
mflo $1
lw $3, 0($1)
TAG330:
bgtz $3, TAG331
sll $0, $0, 0
bltz $3, TAG331
mthi $3
TAG331:
lui $4, 3
ori $3, $4, 13
mthi $3
mult $4, $3
TAG332:
lui $2, 9
div $2, $3
bgez $2, TAG333
sll $1, $3, 4
TAG333:
blez $1, TAG334
sll $0, $0, 0
xori $4, $1, 14
mtlo $1
TAG334:
beq $4, $4, TAG335
sll $0, $0, 0
lbu $2, 0($1)
mult $1, $1
TAG335:
mtlo $2
mflo $3
beq $3, $2, TAG336
slt $3, $3, $3
TAG336:
multu $3, $3
bne $3, $3, TAG337
mtlo $3
beq $3, $3, TAG337
TAG337:
mthi $3
mfhi $1
mfhi $2
lbu $1, 0($1)
TAG338:
mtlo $1
beq $1, $1, TAG339
lui $3, 10
lui $1, 4
TAG339:
sra $4, $1, 8
add $3, $4, $4
mflo $1
sh $1, 0($4)
TAG340:
mfhi $1
mult $1, $1
sra $3, $1, 11
addu $4, $3, $1
TAG341:
mthi $4
lb $2, 0($4)
blez $4, TAG342
mthi $2
TAG342:
lui $3, 8
lh $3, 0($2)
multu $3, $3
mfhi $4
TAG343:
mtlo $4
mflo $4
ori $4, $4, 2
or $1, $4, $4
TAG344:
sh $1, 0($1)
sh $1, 0($1)
sllv $4, $1, $1
xor $3, $1, $1
TAG345:
mflo $3
bgez $3, TAG346
sllv $3, $3, $3
mtlo $3
TAG346:
bgez $3, TAG347
srl $3, $3, 1
beq $3, $3, TAG347
mflo $2
TAG347:
sllv $2, $2, $2
beq $2, $2, TAG348
mtlo $2
lui $2, 0
TAG348:
bne $2, $2, TAG349
sh $2, 0($2)
bne $2, $2, TAG349
mult $2, $2
TAG349:
sw $2, 0($2)
lw $4, 0($2)
sb $2, 0($2)
xor $4, $2, $4
TAG350:
mthi $4
sh $4, 0($4)
bgtz $4, TAG351
sh $4, 0($4)
TAG351:
sw $4, 0($4)
bgez $4, TAG352
sw $4, 0($4)
lw $4, 0($4)
TAG352:
mult $4, $4
bne $4, $4, TAG353
mult $4, $4
mtlo $4
TAG353:
sltu $1, $4, $4
sh $4, 0($4)
lh $4, 0($4)
lui $3, 7
TAG354:
mflo $3
multu $3, $3
mflo $3
bne $3, $3, TAG355
TAG355:
add $4, $3, $3
subu $2, $4, $4
sh $3, 0($4)
mthi $2
TAG356:
lui $2, 9
sll $0, $0, 0
div $2, $2
sll $0, $0, 0
TAG357:
lw $1, 0($3)
lui $3, 9
sll $0, $0, 0
bltz $3, TAG358
TAG358:
mtlo $3
lui $2, 2
sll $0, $0, 0
beq $2, $2, TAG359
TAG359:
nor $3, $2, $2
beq $2, $3, TAG360
sll $0, $0, 0
multu $2, $3
TAG360:
xor $4, $3, $3
mtlo $4
mflo $2
sltu $2, $3, $3
TAG361:
beq $2, $2, TAG362
lui $4, 13
sb $2, 0($4)
srlv $2, $4, $4
TAG362:
mthi $2
bgez $2, TAG363
sra $1, $2, 10
lbu $3, 0($1)
TAG363:
slti $1, $3, 0
bltz $1, TAG364
mthi $3
beq $3, $1, TAG364
TAG364:
sra $1, $1, 14
beq $1, $1, TAG365
mthi $1
mtlo $1
TAG365:
mtlo $1
sllv $3, $1, $1
ori $1, $3, 4
mfhi $4
TAG366:
sll $3, $4, 6
bltz $3, TAG367
mflo $4
xori $1, $3, 7
TAG367:
sb $1, 0($1)
bgez $1, TAG368
ori $3, $1, 1
bne $1, $3, TAG368
TAG368:
sb $3, 0($3)
srl $4, $3, 5
lhu $1, 0($4)
bne $3, $4, TAG369
TAG369:
addu $4, $1, $1
lw $4, 0($4)
slti $4, $4, 10
srlv $2, $4, $4
TAG370:
multu $2, $2
xori $2, $2, 11
mfhi $2
sltiu $1, $2, 0
TAG371:
sw $1, 0($1)
sltu $4, $1, $1
mfhi $4
addiu $2, $1, 14
TAG372:
mult $2, $2
lui $3, 15
div $3, $2
sllv $4, $3, $3
TAG373:
beq $4, $4, TAG374
sll $1, $4, 12
andi $1, $4, 7
bne $4, $1, TAG374
TAG374:
addiu $3, $1, 15
sll $0, $0, 0
mfhi $4
blez $3, TAG375
TAG375:
lui $3, 12
mthi $4
beq $4, $4, TAG376
sh $3, 0($4)
TAG376:
sll $0, $0, 0
lui $4, 0
beq $3, $4, TAG377
sltiu $3, $3, 9
TAG377:
sw $3, 0($3)
bne $3, $3, TAG378
addi $2, $3, 5
multu $2, $2
TAG378:
slt $4, $2, $2
mthi $2
mfhi $1
xori $4, $1, 1
TAG379:
srl $3, $4, 11
sra $3, $4, 2
mfhi $1
bne $1, $3, TAG380
TAG380:
sra $3, $1, 8
lb $4, 0($1)
beq $4, $3, TAG381
srl $3, $1, 6
TAG381:
lh $3, 0($3)
bgez $3, TAG382
lhu $3, 0($3)
addiu $4, $3, 0
TAG382:
bne $4, $4, TAG383
divu $4, $4
bgtz $4, TAG383
sb $4, 0($4)
TAG383:
addu $1, $4, $4
bltz $1, TAG384
subu $1, $4, $4
sb $4, 0($1)
TAG384:
mfhi $3
mfhi $2
blez $2, TAG385
mflo $2
TAG385:
multu $2, $2
sb $2, 0($2)
divu $2, $2
addu $3, $2, $2
TAG386:
bne $3, $3, TAG387
subu $2, $3, $3
mflo $3
sb $3, 0($3)
TAG387:
sb $3, 0($3)
bltz $3, TAG388
lb $4, 0($3)
mtlo $3
TAG388:
sb $4, 0($4)
mult $4, $4
lui $2, 14
beq $2, $2, TAG389
TAG389:
sll $0, $0, 0
slti $2, $1, 14
mfhi $3
bne $1, $2, TAG390
TAG390:
mtlo $3
xori $2, $3, 15
mflo $3
sw $2, 0($3)
TAG391:
beq $3, $3, TAG392
or $2, $3, $3
slti $3, $2, 0
slti $2, $3, 15
TAG392:
slti $2, $2, 4
sll $3, $2, 5
bgtz $2, TAG393
mult $2, $2
TAG393:
or $3, $3, $3
bne $3, $3, TAG394
sra $2, $3, 3
multu $3, $2
TAG394:
mult $2, $2
mfhi $4
mult $4, $4
beq $2, $2, TAG395
TAG395:
mthi $4
addiu $4, $4, 15
or $4, $4, $4
lui $2, 7
TAG396:
beq $2, $2, TAG397
srl $2, $2, 14
lbu $4, 0($2)
mult $2, $4
TAG397:
divu $4, $4
mthi $4
mflo $2
bne $4, $4, TAG398
TAG398:
lui $4, 10
mfhi $3
bgez $3, TAG399
sb $2, 0($3)
TAG399:
and $4, $3, $3
div $4, $3
lbu $3, 0($3)
xori $1, $3, 10
TAG400:
lb $2, 0($1)
srav $2, $2, $2
mult $2, $1
addiu $2, $1, 5
TAG401:
sb $2, 0($2)
mfhi $1
sh $2, 0($2)
lh $2, 0($2)
TAG402:
mthi $2
lui $4, 11
bltz $4, TAG403
sll $0, $0, 0
TAG403:
addiu $1, $4, 7
divu $4, $4
mflo $4
mthi $4
TAG404:
lui $2, 4
srl $3, $2, 4
sb $3, -16384($3)
lui $3, 8
TAG405:
mfhi $2
mult $2, $3
multu $2, $3
mthi $2
TAG406:
mflo $4
mfhi $3
sll $0, $0, 0
andi $2, $3, 14
TAG407:
ori $2, $2, 0
multu $2, $2
sb $2, 0($2)
sh $2, 0($2)
TAG408:
bgez $2, TAG409
multu $2, $2
nor $2, $2, $2
sb $2, 0($2)
TAG409:
sb $2, 0($2)
lui $2, 11
sll $0, $0, 0
addiu $3, $2, 1
TAG410:
mfhi $3
mflo $3
sh $3, 0($3)
bgtz $3, TAG411
TAG411:
sw $3, 0($3)
slti $2, $3, 5
mthi $3
mfhi $3
TAG412:
lw $4, 0($3)
lw $1, 0($4)
addi $1, $3, 9
bgtz $1, TAG413
TAG413:
mtlo $1
bgtz $1, TAG414
sb $1, 0($1)
sra $1, $1, 13
TAG414:
sll $1, $1, 4
mthi $1
nor $1, $1, $1
mult $1, $1
TAG415:
lui $4, 7
multu $1, $1
div $4, $4
lui $3, 2
TAG416:
mtlo $3
lui $2, 13
bne $3, $2, TAG417
srlv $1, $3, $2
TAG417:
mflo $4
mult $4, $1
mthi $4
lui $1, 14
TAG418:
sra $3, $1, 5
beq $3, $3, TAG419
mflo $3
lb $4, 0($1)
TAG419:
sltiu $2, $4, 9
mult $4, $2
mtlo $4
mflo $2
TAG420:
lui $3, 11
mfhi $1
bgez $1, TAG421
sll $0, $0, 0
TAG421:
sh $1, 0($1)
lui $3, 2
lui $1, 0
bltz $1, TAG422
TAG422:
nor $3, $1, $1
lui $4, 14
sh $4, 1($3)
lui $3, 0
TAG423:
mflo $4
lhu $2, 0($3)
multu $2, $2
mflo $4
TAG424:
ori $4, $4, 6
addu $2, $4, $4
mflo $1
mult $4, $2
TAG425:
lbu $1, 0($1)
mtlo $1
mult $1, $1
bltz $1, TAG426
TAG426:
lbu $4, 0($1)
sltu $1, $4, $1
lh $3, 0($1)
xor $3, $1, $1
TAG427:
lh $3, 0($3)
lui $2, 7
lui $2, 5
add $2, $3, $2
TAG428:
sll $0, $0, 0
mfhi $1
mflo $2
ori $1, $2, 10
TAG429:
beq $1, $1, TAG430
mult $1, $1
sb $1, 0($1)
beq $1, $1, TAG430
TAG430:
mtlo $1
addu $2, $1, $1
sh $1, 0($2)
div $2, $2
TAG431:
sllv $1, $2, $2
lui $2, 14
mtlo $2
sll $0, $0, 0
TAG432:
lui $2, 2
sll $0, $0, 0
sll $0, $0, 0
lui $4, 3
TAG433:
sll $0, $0, 0
mtlo $3
or $2, $4, $4
sll $0, $0, 0
TAG434:
lbu $3, 0($3)
lw $3, 0($3)
lui $3, 1
sll $0, $0, 0
TAG435:
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
blez $3, TAG436
TAG436:
subu $3, $2, $2
mthi $2
bne $2, $2, TAG437
div $2, $2
TAG437:
beq $3, $3, TAG438
lui $2, 6
ori $2, $2, 0
xor $3, $2, $3
TAG438:
sb $3, 0($3)
mfhi $4
lui $4, 0
addi $4, $3, 12
TAG439:
andi $3, $4, 8
xori $2, $3, 6
addiu $2, $2, 13
xori $4, $3, 10
TAG440:
mfhi $3
div $3, $4
addiu $3, $4, 3
mfhi $3
TAG441:
sll $1, $3, 15
blez $1, TAG442
add $1, $1, $1
bne $3, $1, TAG442
TAG442:
srl $1, $1, 1
or $3, $1, $1
multu $1, $1
bltz $3, TAG443
TAG443:
sub $2, $3, $3
mflo $1
lbu $1, 0($2)
multu $2, $2
TAG444:
beq $1, $1, TAG445
mfhi $1
lb $1, 0($1)
mfhi $3
TAG445:
mult $3, $3
beq $3, $3, TAG446
lui $1, 10
mflo $3
TAG446:
lui $4, 7
sb $3, 0($3)
sll $0, $0, 0
mfhi $1
TAG447:
beq $1, $1, TAG448
addiu $3, $1, 6
beq $3, $1, TAG448
lh $2, 0($3)
TAG448:
mult $2, $2
beq $2, $2, TAG449
multu $2, $2
mfhi $1
TAG449:
bltz $1, TAG450
sh $1, 0($1)
bgtz $1, TAG450
slt $3, $1, $1
TAG450:
sb $3, 0($3)
lui $4, 1
lui $1, 11
lui $1, 9
TAG451:
bltz $1, TAG452
sll $0, $0, 0
slti $2, $1, 9
bgez $2, TAG452
TAG452:
mthi $2
lui $3, 7
mult $2, $2
lw $2, 0($2)
TAG453:
mult $2, $2
blez $2, TAG454
mflo $2
lw $2, 0($2)
TAG454:
bltz $2, TAG455
lui $4, 2
sll $0, $0, 0
beq $2, $4, TAG455
TAG455:
sll $0, $0, 0
div $4, $4
multu $4, $4
mtlo $4
TAG456:
bgez $4, TAG457
xori $4, $4, 10
lui $2, 1
bltz $2, TAG457
TAG457:
lw $1, 0($2)
lbu $4, 0($1)
mflo $2
bltz $4, TAG458
TAG458:
addiu $1, $2, 9
bne $2, $1, TAG459
mthi $2
beq $1, $1, TAG459
TAG459:
addu $3, $1, $1
bltz $1, TAG460
sll $0, $0, 0
mfhi $1
TAG460:
lui $4, 12
mfhi $2
bltz $4, TAG461
div $1, $2
TAG461:
lui $3, 13
srlv $4, $2, $2
beq $4, $4, TAG462
sll $0, $0, 0
TAG462:
divu $2, $2
mfhi $1
beq $2, $2, TAG463
mthi $1
TAG463:
sra $4, $1, 5
srl $1, $4, 3
lb $2, 0($1)
bltz $1, TAG464
TAG464:
xor $4, $2, $2
blez $4, TAG465
lhu $3, 0($2)
mult $4, $3
TAG465:
xor $2, $3, $3
mflo $4
lui $2, 3
mfhi $4
TAG466:
addi $1, $4, 0
bne $4, $4, TAG467
lb $4, 0($1)
mfhi $1
TAG467:
mfhi $2
beq $1, $2, TAG468
lh $2, 0($1)
lb $3, 0($2)
TAG468:
mflo $2
sb $2, 0($2)
lbu $2, 0($2)
sll $2, $2, 8
TAG469:
sll $2, $2, 5
mtlo $2
div $2, $2
mflo $2
TAG470:
mfhi $3
bne $3, $2, TAG471
lui $3, 9
or $2, $2, $3
TAG471:
bltz $2, TAG472
lui $4, 0
lui $2, 15
mtlo $2
TAG472:
mult $2, $2
mtlo $2
mflo $4
sll $0, $0, 0
TAG473:
sll $0, $0, 0
beq $3, $3, TAG474
sll $0, $0, 0
mfhi $4
TAG474:
multu $4, $4
mtlo $4
addu $2, $4, $4
bne $2, $2, TAG475
TAG475:
srlv $1, $2, $2
bne $1, $2, TAG476
lui $4, 10
lui $3, 8
TAG476:
srl $2, $3, 4
bgtz $2, TAG477
mult $2, $2
beq $2, $2, TAG477
TAG477:
xor $1, $2, $2
sb $2, 0($1)
mult $2, $1
bgez $1, TAG478
TAG478:
lbu $1, 0($1)
lhu $1, 0($1)
beq $1, $1, TAG479
lui $1, 0
TAG479:
bne $1, $1, TAG480
lui $4, 5
slti $3, $1, 13
sll $0, $0, 0
TAG480:
nor $3, $3, $3
bne $3, $3, TAG481
mfhi $2
mult $2, $3
TAG481:
lhu $1, 0($2)
bne $2, $2, TAG482
addu $4, $2, $2
addu $1, $4, $4
TAG482:
sw $1, 0($1)
sh $1, 0($1)
sb $1, 0($1)
lw $2, 0($1)
TAG483:
sw $2, 0($2)
beq $2, $2, TAG484
sltiu $1, $2, 1
andi $4, $2, 3
TAG484:
mtlo $4
sw $4, 0($4)
mflo $1
bgez $1, TAG485
TAG485:
mthi $1
mfhi $2
mult $2, $1
sllv $4, $2, $2
TAG486:
bne $4, $4, TAG487
sw $4, 0($4)
bltz $4, TAG487
lhu $2, 0($4)
TAG487:
mtlo $2
lhu $4, 0($2)
beq $2, $4, TAG488
mthi $4
TAG488:
mfhi $2
lui $2, 7
bgtz $2, TAG489
mflo $1
TAG489:
lui $4, 9
beq $1, $4, TAG490
sll $0, $0, 0
mult $1, $1
TAG490:
lui $3, 3
sll $0, $0, 0
sll $0, $0, 0
bgtz $3, TAG491
TAG491:
sll $0, $0, 0
sra $2, $4, 11
sltiu $3, $3, 4
slt $3, $3, $4
TAG492:
mflo $3
mult $3, $3
bne $3, $3, TAG493
lb $3, 0($3)
TAG493:
bgez $3, TAG494
subu $3, $3, $3
mtlo $3
nor $2, $3, $3
TAG494:
lui $3, 5
sll $0, $0, 0
div $3, $2
addu $1, $3, $2
TAG495:
sll $0, $0, 0
lui $1, 8
sll $0, $0, 0
bltz $1, TAG496
TAG496:
mthi $1
divu $1, $1
divu $1, $1
mflo $3
TAG497:
lui $3, 9
blez $3, TAG498
sltiu $3, $3, 14
bltz $3, TAG498
TAG498:
multu $3, $3
bgtz $3, TAG499
sh $3, 0($3)
mthi $3
TAG499:
beq $3, $3, TAG500
lw $3, 0($3)
divu $3, $3
bne $3, $3, TAG500
TAG500:
sh $3, 0($3)
xori $4, $3, 8
bgtz $4, TAG501
add $3, $3, $3
TAG501:
lui $2, 2
sllv $2, $2, $3
lb $2, 0($3)
lbu $3, 0($2)
TAG502:
sw $3, 0($3)
sw $3, 0($3)
lb $3, 0($3)
multu $3, $3
TAG503:
mtlo $3
andi $4, $3, 6
mthi $3
bne $3, $4, TAG504
TAG504:
sra $4, $4, 15
add $4, $4, $4
lh $2, 0($4)
lui $2, 7
TAG505:
sll $0, $0, 0
multu $2, $4
mtlo $2
div $2, $2
TAG506:
mult $4, $4
sra $4, $4, 15
bne $4, $4, TAG507
lui $1, 1
TAG507:
div $1, $1
sll $0, $0, 0
subu $4, $1, $1
sra $2, $4, 3
TAG508:
sub $4, $2, $2
multu $4, $4
bgez $2, TAG509
mult $4, $4
TAG509:
nor $1, $4, $4
bgez $1, TAG510
lui $3, 9
bgtz $1, TAG510
TAG510:
multu $3, $3
srl $2, $3, 10
lw $3, -576($2)
mflo $2
TAG511:
mtlo $2
andi $2, $2, 8
mflo $4
sw $4, 0($4)
TAG512:
mflo $4
lui $3, 4
addu $2, $3, $4
lui $1, 15
TAG513:
andi $4, $1, 13
bgtz $4, TAG514
lui $3, 14
slt $1, $3, $3
TAG514:
lui $4, 11
mult $4, $4
beq $1, $4, TAG515
lbu $2, 0($1)
TAG515:
multu $2, $2
sub $4, $2, $2
sh $2, 0($4)
srav $3, $2, $4
TAG516:
mult $3, $3
bgez $3, TAG517
lui $3, 7
mult $3, $3
TAG517:
sll $0, $0, 0
mthi $3
mflo $3
mthi $3
TAG518:
lui $2, 7
mtlo $2
lui $4, 2
sra $2, $2, 15
TAG519:
mult $2, $2
mfhi $1
bltz $1, TAG520
mfhi $3
TAG520:
mult $3, $3
lb $1, 0($3)
lui $4, 8
lh $4, 0($3)
TAG521:
lh $2, 0($4)
sh $2, 0($4)
mult $2, $4
bltz $4, TAG522
TAG522:
srlv $2, $2, $2
srl $2, $2, 4
mult $2, $2
lbu $4, 0($2)
TAG523:
sh $4, 0($4)
lui $2, 1
mult $4, $4
mtlo $2
TAG524:
lui $3, 7
sll $0, $0, 0
addu $4, $4, $4
lbu $2, 0($4)
TAG525:
lui $3, 9
srl $1, $3, 11
bgtz $3, TAG526
mthi $3
TAG526:
and $1, $1, $1
srlv $1, $1, $1
mthi $1
mfhi $4
TAG527:
beq $4, $4, TAG528
mult $4, $4
mtlo $4
multu $4, $4
TAG528:
subu $1, $4, $4
mtlo $1
mthi $4
xori $2, $4, 10
TAG529:
bne $2, $2, TAG530
nor $1, $2, $2
mthi $2
lw $3, 299($1)
TAG530:
lui $1, 3
lui $3, 4
div $1, $3
xori $2, $1, 11
TAG531:
beq $2, $2, TAG532
div $2, $2
blez $2, TAG532
lw $3, 0($2)
TAG532:
slt $2, $3, $3
mthi $2
ori $4, $2, 5
lui $2, 9
TAG533:
lui $3, 3
subu $1, $3, $3
slt $2, $2, $1
add $1, $2, $2
TAG534:
slti $4, $1, 6
sltu $2, $1, $1
lb $2, 0($4)
mflo $3
TAG535:
addiu $2, $3, 7
bgez $2, TAG536
multu $3, $2
sw $3, 0($2)
TAG536:
lh $3, 0($2)
xori $4, $3, 13
sll $2, $4, 13
sltiu $4, $4, 7
TAG537:
multu $4, $4
bgez $4, TAG538
sw $4, 0($4)
divu $4, $4
TAG538:
mult $4, $4
sw $4, 0($4)
addi $1, $4, 5
lb $2, 0($1)
TAG539:
bltz $2, TAG540
lbu $2, 0($2)
blez $2, TAG540
sb $2, 0($2)
TAG540:
lb $3, 0($2)
sb $2, 0($3)
mthi $3
addu $3, $3, $2
TAG541:
sh $3, 0($3)
lui $4, 8
lui $2, 6
sll $0, $0, 0
TAG542:
bltz $2, TAG543
sll $0, $0, 0
sll $0, $0, 0
multu $2, $2
TAG543:
sll $0, $0, 0
bne $2, $2, TAG544
sllv $4, $2, $2
lui $1, 14
TAG544:
bne $1, $1, TAG545
div $1, $1
bne $1, $1, TAG545
xor $2, $1, $1
TAG545:
lui $2, 6
mthi $2
lui $3, 3
multu $2, $2
TAG546:
srl $1, $3, 10
subu $1, $1, $3
bgtz $3, TAG547
mtlo $1
TAG547:
mult $1, $1
beq $1, $1, TAG548
div $1, $1
nor $3, $1, $1
TAG548:
sll $0, $0, 0
mthi $3
mthi $3
mflo $2
TAG549:
sb $2, 0($2)
lb $1, 0($2)
bne $2, $1, TAG550
multu $1, $2
TAG550:
slti $4, $1, 0
nor $3, $1, $1
beq $4, $4, TAG551
divu $4, $1
TAG551:
blez $3, TAG552
lb $4, 2($3)
beq $3, $3, TAG552
sltiu $2, $3, 5
TAG552:
subu $2, $2, $2
sltu $3, $2, $2
mthi $2
or $1, $3, $3
TAG553:
multu $1, $1
lhu $1, 0($1)
lh $1, -256($1)
beq $1, $1, TAG554
TAG554:
mfhi $4
divu $1, $1
mfhi $2
lbu $4, -256($1)
TAG555:
lbu $4, 0($4)
blez $4, TAG556
mfhi $2
bgez $2, TAG556
TAG556:
lb $2, 0($2)
sw $2, 0($2)
beq $2, $2, TAG557
sh $2, 0($2)
TAG557:
lw $4, 0($2)
mult $4, $4
beq $4, $4, TAG558
mtlo $2
TAG558:
mult $4, $4
bgtz $4, TAG559
lw $2, 0($4)
sra $2, $2, 4
TAG559:
sb $2, 0($2)
mtlo $2
srlv $2, $2, $2
lhu $4, 0($2)
TAG560:
bne $4, $4, TAG561
lui $4, 10
blez $4, TAG561
slti $4, $4, 0
TAG561:
lui $1, 3
mthi $4
bgtz $4, TAG562
multu $4, $1
TAG562:
divu $1, $1
sll $0, $0, 0
slt $3, $1, $1
andi $1, $3, 7
TAG563:
sll $2, $1, 5
lb $2, 0($1)
multu $2, $2
sra $3, $1, 8
TAG564:
bltz $3, TAG565
multu $3, $3
beq $3, $3, TAG565
sra $1, $3, 1
TAG565:
sh $1, 0($1)
sra $4, $1, 5
sh $4, 0($1)
addiu $2, $1, 9
TAG566:
beq $2, $2, TAG567
sra $4, $2, 0
srav $4, $2, $4
mfhi $4
TAG567:
div $4, $4
mflo $1
bne $4, $4, TAG568
slti $4, $1, 15
TAG568:
bne $4, $4, TAG569
lbu $1, 0($4)
sllv $1, $1, $4
sub $1, $1, $1
TAG569:
mflo $4
and $3, $1, $4
sw $4, 0($1)
mult $4, $3
TAG570:
bne $3, $3, TAG571
mflo $4
lui $3, 2
srav $3, $3, $3
TAG571:
slt $4, $3, $3
sltiu $1, $4, 11
nor $3, $3, $3
mflo $2
TAG572:
blez $2, TAG573
mtlo $2
divu $2, $2
blez $2, TAG573
TAG573:
lw $4, 0($2)
bgtz $4, TAG574
lui $4, 12
bne $2, $4, TAG574
TAG574:
srl $1, $4, 7
mult $4, $4
lui $2, 13
bgtz $1, TAG575
TAG575:
div $2, $2
addu $4, $2, $2
sltu $3, $2, $4
bne $3, $2, TAG576
TAG576:
mthi $3
beq $3, $3, TAG577
subu $1, $3, $3
bne $1, $1, TAG577
TAG577:
mfhi $1
bne $1, $1, TAG578
addiu $1, $1, 7
sw $1, 0($1)
TAG578:
sh $1, 0($1)
sll $4, $1, 0
mult $1, $1
bltz $4, TAG579
TAG579:
lui $1, 4
lui $1, 1
lui $3, 7
andi $1, $1, 15
TAG580:
sh $1, 0($1)
lbu $2, 0($1)
sb $1, 0($2)
blez $2, TAG581
TAG581:
mthi $2
mthi $2
mfhi $3
bgez $2, TAG582
TAG582:
srav $2, $3, $3
sb $2, 0($2)
sra $3, $3, 4
blez $3, TAG583
TAG583:
lui $2, 14
bgez $2, TAG584
sltu $3, $3, $3
andi $1, $2, 5
TAG584:
addu $2, $1, $1
srav $3, $2, $1
xor $4, $1, $2
bgtz $1, TAG585
TAG585:
mult $4, $4
mtlo $4
bgez $4, TAG586
or $2, $4, $4
TAG586:
beq $2, $2, TAG587
mult $2, $2
mult $2, $2
mtlo $2
TAG587:
sh $2, 0($2)
lbu $1, 0($2)
bltz $1, TAG588
lui $4, 13
TAG588:
mtlo $4
or $2, $4, $4
blez $4, TAG589
xor $1, $2, $4
TAG589:
sub $3, $1, $1
mult $3, $1
multu $3, $1
lb $1, 0($3)
TAG590:
mfhi $1
beq $1, $1, TAG591
srlv $3, $1, $1
bgez $3, TAG591
TAG591:
nor $2, $3, $3
addu $4, $2, $3
blez $2, TAG592
or $2, $2, $4
TAG592:
mflo $4
bltz $2, TAG593
mthi $2
bgtz $4, TAG593
TAG593:
mfhi $2
mult $2, $4
mtlo $4
bgtz $4, TAG594
TAG594:
multu $2, $2
lui $3, 8
sll $0, $0, 0
nor $1, $3, $2
TAG595:
sb $1, 0($1)
sb $1, 0($1)
ori $2, $1, 6
mthi $2
TAG596:
nor $4, $2, $2
sh $2, 0($2)
mtlo $2
sh $4, 7($4)
TAG597:
sb $4, 7($4)
beq $4, $4, TAG598
mult $4, $4
bgtz $4, TAG598
TAG598:
lui $2, 12
sw $4, 7($4)
addiu $1, $2, 3
slti $1, $2, 2
TAG599:
srav $4, $1, $1
mthi $4
multu $4, $1
sub $3, $1, $1
TAG600:
bgez $3, TAG601
lhu $1, 0($3)
lh $3, 0($1)
beq $1, $1, TAG601
TAG601:
multu $3, $3
addi $1, $3, 13
addu $2, $3, $3
mflo $2
TAG602:
lw $3, 0($2)
sub $1, $3, $2
sw $1, 7($1)
sllv $1, $2, $1
TAG603:
multu $1, $1
lui $3, 11
divu $1, $3
blez $1, TAG604
TAG604:
mtlo $3
sll $0, $0, 0
sll $0, $0, 0
blez $1, TAG605
TAG605:
mthi $1
bne $1, $1, TAG606
lui $3, 3
xor $2, $3, $3
TAG606:
mtlo $2
lb $1, 0($2)
bltz $1, TAG607
mthi $1
TAG607:
sh $1, 7($1)
sh $1, 7($1)
mthi $1
bne $1, $1, TAG608
TAG608:
mtlo $1
lb $3, 7($1)
mflo $1
blez $1, TAG609
TAG609:
lui $4, 6
div $4, $1
sll $0, $0, 0
sll $0, $0, 0
TAG610:
nor $3, $2, $2
addu $2, $2, $2
multu $2, $2
lui $3, 14
TAG611:
mflo $2
beq $2, $2, TAG612
multu $2, $2
divu $3, $2
TAG612:
sw $2, 0($2)
lui $3, 4
mflo $4
sll $4, $3, 9
TAG613:
mfhi $4
sh $4, 0($4)
srav $1, $4, $4
srl $1, $4, 1
TAG614:
beq $1, $1, TAG615
multu $1, $1
lbu $4, 0($1)
multu $1, $4
TAG615:
add $4, $4, $4
bne $4, $4, TAG616
sh $4, 0($4)
andi $2, $4, 13
TAG616:
sllv $4, $2, $2
lb $3, 0($4)
addiu $2, $4, 15
multu $4, $3
TAG617:
beq $2, $2, TAG618
lb $2, 0($2)
lui $2, 15
lui $4, 15
TAG618:
mfhi $3
lhu $2, 0($3)
sltu $4, $2, $2
mflo $3
TAG619:
sw $3, 0($3)
mfhi $2
lui $2, 11
or $4, $2, $2
TAG620:
sltu $4, $4, $4
mult $4, $4
addi $1, $4, 2
lhu $3, 0($1)
TAG621:
mflo $3
sh $3, 0($3)
mthi $3
beq $3, $3, TAG622
TAG622:
sw $3, 0($3)
mthi $3
sub $1, $3, $3
sw $3, 0($3)
TAG623:
multu $1, $1
addiu $2, $1, 3
addi $4, $1, 15
mfhi $1
TAG624:
or $3, $1, $1
bne $1, $1, TAG625
mflo $3
blez $1, TAG625
TAG625:
lhu $2, 0($3)
mult $2, $2
beq $2, $2, TAG626
mult $2, $2
TAG626:
andi $3, $2, 9
blez $2, TAG627
ori $4, $2, 2
lhu $1, 0($4)
TAG627:
multu $1, $1
lb $1, 0($1)
mfhi $2
addu $4, $2, $2
TAG628:
sll $3, $4, 8
lui $1, 2
beq $3, $3, TAG629
mflo $2
TAG629:
bltz $2, TAG630
xori $1, $2, 8
multu $2, $2
mfhi $3
TAG630:
addi $4, $3, 3
mtlo $3
lb $2, 0($4)
andi $4, $4, 6
TAG631:
sb $4, 0($4)
mflo $2
bne $2, $4, TAG632
mtlo $2
TAG632:
srav $2, $2, $2
mfhi $1
lui $2, 0
mflo $4
TAG633:
srav $3, $4, $4
lhu $4, 0($4)
mult $3, $3
mthi $4
TAG634:
addu $1, $4, $4
lui $1, 2
sltu $4, $4, $4
sll $0, $0, 0
TAG635:
sllv $3, $3, $3
add $3, $3, $3
srav $1, $3, $3
or $2, $3, $3
TAG636:
lh $2, 0($2)
mult $2, $2
andi $1, $2, 10
subu $2, $2, $2
TAG637:
beq $2, $2, TAG638
addi $4, $2, 2
mtlo $2
lui $1, 4
TAG638:
bgez $1, TAG639
lui $1, 9
beq $1, $1, TAG639
lui $4, 12
TAG639:
lh $2, 0($4)
mthi $2
lui $2, 14
lb $4, 0($4)
TAG640:
lui $2, 9
bne $4, $2, TAG641
div $2, $2
bne $4, $2, TAG641
TAG641:
mult $2, $2
addiu $1, $2, 9
sll $0, $0, 0
sllv $3, $2, $1
TAG642:
beq $3, $3, TAG643
sll $0, $0, 0
lw $2, 0($3)
mthi $3
TAG643:
sltu $2, $2, $2
blez $2, TAG644
srav $1, $2, $2
addi $1, $2, 1
TAG644:
mtlo $1
blez $1, TAG645
sb $1, 0($1)
multu $1, $1
TAG645:
xor $3, $1, $1
mthi $3
lbu $4, 0($1)
bne $4, $4, TAG646
TAG646:
mtlo $4
bltz $4, TAG647
or $2, $4, $4
mfhi $3
TAG647:
lui $3, 1
lui $1, 2
lui $3, 3
sltu $1, $1, $3
TAG648:
mflo $3
sra $1, $3, 12
srl $4, $1, 7
lw $4, 0($4)
TAG649:
mtlo $4
mfhi $3
lbu $2, 0($3)
sb $3, 0($2)
TAG650:
lui $4, 13
sll $0, $0, 0
lb $1, 0($3)
lw $1, 0($3)
TAG651:
slti $3, $1, 13
lui $3, 4
subu $2, $3, $1
mtlo $3
TAG652:
and $3, $2, $2
multu $2, $3
mult $3, $2
bltz $2, TAG653
TAG653:
lui $3, 15
sll $0, $0, 0
bne $3, $3, TAG654
sll $0, $0, 0
TAG654:
sll $0, $0, 0
bgez $3, TAG655
mfhi $4
mthi $3
TAG655:
sltu $1, $4, $4
bgez $4, TAG656
mflo $3
mflo $2
TAG656:
slti $1, $2, 1
beq $1, $2, TAG657
divu $1, $2
lui $2, 15
TAG657:
mflo $4
bne $2, $4, TAG658
lui $2, 3
sh $4, 0($2)
TAG658:
bltz $2, TAG659
sll $3, $2, 14
bltz $3, TAG659
mtlo $2
TAG659:
lui $1, 2
lui $1, 13
addiu $4, $1, 1
sltu $3, $1, $4
TAG660:
sltiu $4, $3, 11
mthi $4
bne $4, $4, TAG661
lui $4, 7
TAG661:
mthi $4
mtlo $4
sllv $1, $4, $4
sll $0, $0, 0
TAG662:
sll $0, $0, 0
bgez $1, TAG663
multu $4, $4
div $1, $4
TAG663:
lui $2, 4
divu $4, $2
sll $0, $0, 0
sll $0, $0, 0
TAG664:
sra $2, $2, 10
subu $2, $2, $2
sw $2, 0($2)
mthi $2
TAG665:
lui $3, 15
andi $2, $2, 3
beq $2, $3, TAG666
lw $2, 0($2)
TAG666:
ori $4, $2, 6
mflo $4
sb $4, 0($4)
blez $2, TAG667
TAG667:
lbu $4, 0($4)
lui $3, 14
lb $3, 0($4)
bgtz $4, TAG668
TAG668:
sb $3, 0($3)
bgtz $3, TAG669
lui $4, 2
lbu $2, 0($3)
TAG669:
lui $2, 6
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
TAG670:
mult $2, $2
bne $2, $2, TAG671
sll $0, $0, 0
mthi $2
TAG671:
sra $4, $2, 15
lh $2, 0($4)
lui $3, 6
mult $2, $4
TAG672:
sll $0, $0, 0
lui $1, 6
mtlo $3
sltiu $1, $3, 12
TAG673:
xori $1, $1, 6
addiu $2, $1, 8
bgtz $2, TAG674
addiu $1, $1, 11
TAG674:
mthi $1
lb $3, 0($1)
lb $4, 0($1)
sb $3, 0($1)
TAG675:
slti $4, $4, 14
bne $4, $4, TAG676
mfhi $1
mtlo $4
TAG676:
sb $1, 0($1)
addiu $1, $1, 11
lui $4, 15
multu $1, $1
TAG677:
lui $1, 11
mthi $1
bgtz $1, TAG678
sll $0, $0, 0
TAG678:
sll $0, $0, 0
beq $1, $1, TAG679
mthi $1
beq $1, $1, TAG679
TAG679:
lui $2, 6
mfhi $2
mfhi $1
mflo $4
TAG680:
bne $4, $4, TAG681
sll $3, $4, 8
bne $4, $3, TAG681
srl $3, $3, 10
TAG681:
srlv $3, $3, $3
or $1, $3, $3
sw $3, 0($3)
mtlo $3
TAG682:
mtlo $1
sb $1, 0($1)
lui $3, 13
slt $4, $1, $1
TAG683:
ori $4, $4, 1
sb $4, 0($4)
div $4, $4
mtlo $4
TAG684:
sra $2, $4, 5
lh $3, 0($2)
lui $3, 12
sb $3, 0($4)
TAG685:
mflo $2
mfhi $1
sltiu $2, $2, 1
lui $4, 3
TAG686:
blez $4, TAG687
mflo $2
lbu $3, 0($2)
ori $3, $3, 4
TAG687:
mult $3, $3
addiu $3, $3, 13
mflo $2
div $3, $3
TAG688:
bgtz $2, TAG689
srav $1, $2, $2
lw $4, 0($1)
multu $1, $2
TAG689:
bltz $4, TAG690
multu $4, $4
nor $3, $4, $4
ori $3, $4, 0
TAG690:
addu $3, $3, $3
mtlo $3
ori $1, $3, 0
mult $3, $3
TAG691:
mthi $1
sll $0, $0, 0
sll $0, $0, 0
beq $1, $1, TAG692
TAG692:
divu $2, $2
andi $4, $2, 11
mthi $2
sw $2, 0($2)
TAG693:
sltu $2, $4, $4
mflo $3
sll $4, $2, 14
mfhi $4
TAG694:
mthi $4
mfhi $3
mflo $3
bne $3, $3, TAG695
TAG695:
andi $4, $3, 1
mfhi $1
sb $4, 0($3)
or $1, $1, $4
TAG696:
sltiu $4, $1, 8
mflo $3
lhu $3, 0($4)
mfhi $1
TAG697:
nor $3, $1, $1
mult $1, $3
sra $2, $1, 12
mult $2, $3
TAG698:
mfhi $4
sh $2, 0($4)
sb $4, 0($2)
mflo $1
TAG699:
sllv $2, $1, $1
bne $1, $1, TAG700
lw $4, 0($1)
mult $2, $1
TAG700:
mthi $4
blez $4, TAG701
srl $3, $4, 13
andi $4, $4, 11
TAG701:
sh $4, 0($4)
mult $4, $4
slti $2, $4, 12
mult $2, $4
TAG702:
lui $1, 4
ori $3, $2, 2
divu $1, $1
beq $2, $2, TAG703
TAG703:
lb $1, 0($3)
div $3, $3
sltu $1, $3, $3
mult $1, $1
TAG704:
lh $4, 0($1)
bgtz $1, TAG705
srl $4, $1, 2
mfhi $4
TAG705:
lh $2, 0($4)
mtlo $4
lui $4, 1
addu $2, $2, $4
TAG706:
mthi $2
multu $2, $2
bltz $2, TAG707
mflo $1
TAG707:
sh $1, 0($1)
mfhi $1
bgtz $1, TAG708
lb $1, 0($1)
TAG708:
beq $1, $1, TAG709
lui $3, 15
bne $3, $1, TAG709
srl $4, $1, 6
TAG709:
divu $4, $4
mfhi $2
beq $2, $4, TAG710
sltiu $4, $2, 14
TAG710:
mflo $2
addu $4, $2, $2
bgtz $4, TAG711
mult $4, $4
TAG711:
lbu $1, 0($4)
sltiu $3, $1, 10
addu $2, $4, $4
bgtz $3, TAG712
TAG712:
lb $4, 0($2)
srlv $2, $2, $2
mflo $3
lui $1, 5
TAG713:
sll $0, $0, 0
srav $1, $1, $1
sll $0, $0, 0
sll $0, $0, 0
TAG714:
blez $1, TAG715
mfhi $3
div $1, $1
bltz $1, TAG715
TAG715:
sh $3, 0($3)
sb $3, 0($3)
lh $1, 0($3)
xori $1, $3, 8
TAG716:
blez $1, TAG717
lui $4, 10
lbu $1, 0($1)
mthi $1
TAG717:
sw $1, 0($1)
lw $1, 0($1)
addiu $3, $1, 2
bltz $3, TAG718
TAG718:
sltiu $4, $3, 14
lh $3, 0($3)
beq $4, $3, TAG719
lb $2, 0($3)
TAG719:
subu $1, $2, $2
mthi $2
multu $1, $2
mfhi $2
TAG720:
bne $2, $2, TAG721
lh $1, 0($2)
srl $3, $1, 3
mult $1, $3
TAG721:
nor $4, $3, $3
or $1, $4, $3
bne $4, $4, TAG722
ori $3, $1, 0
TAG722:
sll $3, $3, 14
divu $3, $3
lbu $2, 16384($3)
addi $3, $2, 6
TAG723:
multu $3, $3
bne $3, $3, TAG724
lui $2, 13
sltiu $2, $2, 10
TAG724:
bgez $2, TAG725
lui $1, 14
beq $1, $1, TAG725
lb $4, 0($1)
TAG725:
divu $4, $4
subu $3, $4, $4
xori $1, $3, 1
multu $3, $3
TAG726:
multu $1, $1
lui $3, 7
bltz $1, TAG727
addu $2, $3, $3
TAG727:
lui $3, 11
beq $2, $3, TAG728
sltu $3, $2, $2
beq $3, $2, TAG728
TAG728:
nor $3, $3, $3
sw $3, 1($3)
divu $3, $3
bgtz $3, TAG729
TAG729:
sb $3, 1($3)
srav $1, $3, $3
blez $3, TAG730
mthi $3
TAG730:
blez $1, TAG731
mthi $1
lb $4, 0($1)
multu $4, $1
TAG731:
sh $4, 1($4)
bgez $4, TAG732
andi $4, $4, 13
mult $4, $4
TAG732:
lbu $4, 0($4)
blez $4, TAG733
multu $4, $4
beq $4, $4, TAG733
TAG733:
lui $3, 15
bne $4, $4, TAG734
subu $3, $3, $4
mfhi $2
TAG734:
mfhi $4
sw $2, 0($4)
bne $2, $2, TAG735
sw $4, 0($2)
TAG735:
sw $4, 0($4)
sb $4, 0($4)
lbu $4, 0($4)
lbu $4, 0($4)
TAG736:
sw $4, 0($4)
mthi $4
beq $4, $4, TAG737
mflo $3
TAG737:
mfhi $2
mflo $4
sltiu $3, $4, 10
sw $2, 0($2)
TAG738:
bltz $3, TAG739
lui $3, 15
sll $0, $0, 0
div $3, $3
TAG739:
bltz $3, TAG740
andi $1, $3, 6
sw $1, 0($1)
sll $0, $0, 0
TAG740:
sll $0, $0, 0
sllv $4, $3, $3
multu $4, $1
bne $3, $4, TAG741
TAG741:
sra $4, $4, 14
bltz $4, TAG742
lui $3, 13
mflo $4
TAG742:
xori $3, $4, 7
mthi $3
sllv $4, $4, $4
lbu $2, 0($4)
TAG743:
sub $3, $2, $2
bgtz $3, TAG744
lui $1, 4
beq $3, $1, TAG744
TAG744:
sll $0, $0, 0
div $1, $1
mthi $1
mflo $3
TAG745:
sltiu $4, $3, 5
subu $2, $4, $4
nor $4, $3, $4
div $2, $3
TAG746:
mfhi $4
lh $2, 0($4)
mthi $4
sb $2, 0($4)
TAG747:
srav $4, $2, $2
mtlo $4
lh $4, 0($2)
bgez $4, TAG748
TAG748:
lui $2, 10
sll $0, $0, 0
bgtz $4, TAG749
mfhi $1
TAG749:
addiu $1, $1, 9
lb $2, 0($1)
lw $2, 0($2)
lui $4, 5
TAG750:
nop
nop
test_end:
beq $0, $0, test_end
nop |
grammar/VSL.g4 | VegaLib/VSL | 0 | 3551 | <gh_stars>0
///
/// Microsoft Public License (Ms-PL) - Copyright (c) 2020-2021 <NAME>
/// This file is subject to the terms and conditions of the Microsoft Public License, the text of which can be found in
/// the 'LICENSE' file at the root of this repository, or online at <https://opensource.org/licenses/MS-PL>.
///
// This is the ANTLR4 lexer grammar for the Vega Shader Langauge
parser grammar VSL;
options {
tokenVocab=VSLLexer;
}
/////
// Top-level file unit
file
: shaderTypeStatement topLevelStatement* EOF
;
// Shader type statement
shaderTypeStatement
: '@shader' type=IDENTIFIER ';'
;
// Shader top level statements
topLevelStatement
: shaderStructDefinition
| shaderInputOutputStatement
| shaderUniformStatement
| shaderBindingStatement
| shaderLocalStatement
| shaderSubpassInputStatement
| shaderStageFunction
;
// Shader struct statement, for defining new POD struct types
shaderStructDefinition
: '@struct' name=IDENTIFIER '{' (variableDeclaration ';')+ '}' ';'
;
// Shader input or output declaration
shaderInputOutputStatement
: io=('in'|'out') '(' index=INTEGER_LITERAL ')' variableDeclaration ';'
;
// Shader uniform statement
shaderUniformStatement
: 'uniform' variableDeclaration ';'
;
// Shader binding declaration
shaderBindingStatement
: 'bind' '(' slot=INTEGER_LITERAL ')' variableDeclaration ';'
;
// Shader local statement
shaderLocalStatement
: 'local' '(' pstage=IDENTIFIER ')' 'flat'? variableDeclaration ';'
;
// Shader subpass input statement
shaderSubpassInputStatement
: 'passinput' '(' index=INTEGER_LITERAL ')' format=IDENTIFIER name=IDENTIFIER ';'
;
// Shader stage function statement
shaderStageFunction
: '@' stage=IDENTIFIER statementBlock
;
/////
// Statements
statement
: variableDefinition ';'
| variableDeclaration ';'
| assignment ';'
| ifStatement
| forLoopStatement
| controlStatement ';'
;
statementBlock
: '{' statement* '}'
;
// Variable declaration, for globals, type fields, and function locals
variableDeclaration
: baseType=IDENTIFIER ('<' subType=IDENTIFIER '>')? name=IDENTIFIER ('[' arraySize=INTEGER_LITERAL ']')?
;
// Variable definition (declaration with immediate assignment)
variableDefinition
: decl=variableDeclaration '=' value=expression
;
// Variable assignment
assignment
: lval=lvalue op=('='|'+='|'-='|'*='|'/='|'%='|'<<='|'>>='|'&='|'|='|'^=') value=expression
;
// Lvalue - anything that can occur as the destination of an assignment operation
lvalue
: name=IDENTIFIER
| val=lvalue '[' index=expression ']'
| val=lvalue '.' IDENTIFIER
;
// If statement
ifStatement
: 'if' '(' cond=expression ')' (statement|statementBlock) elifStatement* elseStatement?
;
elifStatement
: 'elif' '(' cond=expression ')' (statement|statementBlock)
;
elseStatement
: 'else' (statement|statementBlock)
;
// For Loop Statement
forLoopStatement
: 'for' '('
counter=IDENTIFIER ';'
start=INTEGER_LITERAL ':'
end=INTEGER_LITERAL (':' step=INTEGER_LITERAL)?
')' statementBlock
;
// Control Flow Statement
controlStatement
: 'break' | 'continue' | 'return' | 'discard'
;
/////
// Expressions
expression
: atom # AtomExpr
// Unary Operators
| op=('+'|'-') val=expression # FactorExpr
| op=('!'|'~') val=expression # NegateExpr
// Binary Operators
| left=expression op=('*'|'/'|'%') right=expression # MulDivModExpr
| left=expression op=('+'|'-') right=expression # AddSubExpr
| left=expression op=('<<'|'>>') right=expression # ShiftExpr
| left=expression op=('<'|'>'|'<='|'>=') right=expression # RelationalExpr
| left=expression op=('=='|'!=') right=expression # EqualityExpr
| left=expression op=('&'|'|'|'^') right=expression # BitwiseExpr
| left=expression op=('&&'|'||') right=expression # LogicalExpr
// Ternary (Selector) Operator
| cond=expression '?' texpr=expression ':' fexpr=expression # TernaryExpr
;
// Atom - smallest indivisible expression type
atom
: '(' expression ')' # GroupAtom
| atom '[' index=expression (',' index2=expression)? ']' # IndexAtom
| atom '.' IDENTIFIER # MemberAtom
| functionCall # CallAtom
| scalarLiteral # LiteralAtom
| IDENTIFIER # NameAtom
;
// Function or constructor call
functionCall
: name=IDENTIFIER '(' args+=expression (',' args+=expression )* ')'
;
// Scalar literal (number or bool)
scalarLiteral
: INTEGER_LITERAL
| FLOAT_LITERAL
| BOOLEAN_LITERAL
;
|
operating_sys/usertests.asm | jasper-lov/waterville_os | 0 | 26603 |
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc push -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1, "usertests starting\n");
11: 68 56 4d 00 00 push $0x4d56
16: 6a 01 push $0x1
18: e8 23 3a 00 00 call 3a40 <printf>
if(open("usertests.ran", 0) >= 0){
1d: 59 pop %ecx
1e: 58 pop %eax
1f: 6a 00 push $0x0
21: 68 6a 4d 00 00 push $0x4d6a
26: e8 e8 38 00 00 call 3913 <open>
2b: 83 c4 10 add $0x10,%esp
2e: 85 c0 test %eax,%eax
30: 78 13 js 45 <main+0x45>
printf(1, "already ran user tests -- rebuild fs.img\n");
32: 52 push %edx
33: 52 push %edx
34: 68 d4 54 00 00 push $0x54d4
39: 6a 01 push $0x1
3b: e8 00 3a 00 00 call 3a40 <printf>
exit();
40: e8 8e 38 00 00 call 38d3 <exit>
}
close(open("usertests.ran", O_CREATE));
45: 50 push %eax
46: 50 push %eax
47: 68 00 02 00 00 push $0x200
4c: 68 6a 4d 00 00 push $0x4d6a
51: e8 bd 38 00 00 call 3913 <open>
56: 89 04 24 mov %eax,(%esp)
59: e8 9d 38 00 00 call 38fb <close>
argptest();
5e: e8 8d 35 00 00 call 35f0 <argptest>
createdelete();
63: e8 b8 11 00 00 call 1220 <createdelete>
linkunlink();
68: e8 73 1a 00 00 call 1ae0 <linkunlink>
concreate();
6d: e8 6e 17 00 00 call 17e0 <concreate>
fourfiles();
72: e8 a9 0f 00 00 call 1020 <fourfiles>
sharedfd();
77: e8 e4 0d 00 00 call e60 <sharedfd>
bigargtest();
7c: e8 2f 32 00 00 call 32b0 <bigargtest>
bigwrite();
81: e8 7a 23 00 00 call 2400 <bigwrite>
bigargtest();
86: e8 25 32 00 00 call 32b0 <bigargtest>
bsstest();
8b: e8 b0 31 00 00 call 3240 <bsstest>
sbrktest();
90: e8 ab 2c 00 00 call 2d40 <sbrktest>
validatetest();
95: e8 f6 30 00 00 call 3190 <validatetest>
opentest();
9a: e8 61 03 00 00 call 400 <opentest>
writetest();
9f: e8 ec 03 00 00 call 490 <writetest>
writetest1();
a4: e8 c7 05 00 00 call 670 <writetest1>
createtest();
a9: e8 92 07 00 00 call 840 <createtest>
openiputtest();
ae: e8 4d 02 00 00 call 300 <openiputtest>
exitiputtest();
b3: e8 48 01 00 00 call 200 <exitiputtest>
iputtest();
b8: e8 63 00 00 00 call 120 <iputtest>
mem();
bd: e8 ce 0c 00 00 call d90 <mem>
pipe1();
c2: e8 59 09 00 00 call a20 <pipe1>
preempt();
c7: e8 e4 0a 00 00 call bb0 <preempt>
exitwait();
cc: e8 3f 0c 00 00 call d10 <exitwait>
rmdot();
d1: e8 1a 27 00 00 call 27f0 <rmdot>
fourteen();
d6: e8 d5 25 00 00 call 26b0 <fourteen>
bigfile();
db: e8 00 24 00 00 call 24e0 <bigfile>
subdir();
e0: e8 3b 1c 00 00 call 1d20 <subdir>
linktest();
e5: e8 e6 14 00 00 call 15d0 <linktest>
unlinkread();
ea: e8 51 13 00 00 call 1440 <unlinkread>
dirfile();
ef: e8 7c 28 00 00 call 2970 <dirfile>
iref();
f4: e8 77 2a 00 00 call 2b70 <iref>
forktest();
f9: e8 92 2b 00 00 call 2c90 <forktest>
bigdir(); // slow
fe: e8 ed 1a 00 00 call 1bf0 <bigdir>
uio();
103: e8 78 34 00 00 call 3580 <uio>
exectest();
108: e8 c3 08 00 00 call 9d0 <exectest>
exit();
10d: e8 c1 37 00 00 call 38d3 <exit>
112: 66 90 xchg %ax,%ax
114: 66 90 xchg %ax,%ax
116: 66 90 xchg %ax,%ax
118: 66 90 xchg %ax,%ax
11a: 66 90 xchg %ax,%ax
11c: 66 90 xchg %ax,%ax
11e: 66 90 xchg %ax,%ax
00000120 <iputtest>:
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 83 ec 10 sub $0x10,%esp
printf(stdout, "iput test\n");
126: 68 fc 3d 00 00 push $0x3dfc
12b: ff 35 78 55 00 00 push 0x5578
131: e8 0a 39 00 00 call 3a40 <printf>
if(mkdir("iputdir") < 0){
136: c7 04 24 8f 3d 00 00 movl $0x3d8f,(%esp)
13d: e8 f9 37 00 00 call 393b <mkdir>
142: 83 c4 10 add $0x10,%esp
145: 85 c0 test %eax,%eax
147: 78 58 js 1a1 <iputtest+0x81>
if(chdir("iputdir") < 0){
149: 83 ec 0c sub $0xc,%esp
14c: 68 8f 3d 00 00 push $0x3d8f
151: e8 ed 37 00 00 call 3943 <chdir>
156: 83 c4 10 add $0x10,%esp
159: 85 c0 test %eax,%eax
15b: 0f 88 85 00 00 00 js 1e6 <iputtest+0xc6>
if(unlink("../iputdir") < 0){
161: 83 ec 0c sub $0xc,%esp
164: 68 8c 3d 00 00 push $0x3d8c
169: e8 b5 37 00 00 call 3923 <unlink>
16e: 83 c4 10 add $0x10,%esp
171: 85 c0 test %eax,%eax
173: 78 5a js 1cf <iputtest+0xaf>
if(chdir("/") < 0){
175: 83 ec 0c sub $0xc,%esp
178: 68 b1 3d 00 00 push $0x3db1
17d: e8 c1 37 00 00 call 3943 <chdir>
182: 83 c4 10 add $0x10,%esp
185: 85 c0 test %eax,%eax
187: 78 2f js 1b8 <iputtest+0x98>
printf(stdout, "iput test ok\n");
189: 83 ec 08 sub $0x8,%esp
18c: 68 34 3e 00 00 push $0x3e34
191: ff 35 78 55 00 00 push 0x5578
197: e8 a4 38 00 00 call 3a40 <printf>
}
19c: 83 c4 10 add $0x10,%esp
19f: c9 leave
1a0: c3 ret
printf(stdout, "mkdir failed\n");
1a1: 50 push %eax
1a2: 50 push %eax
1a3: 68 68 3d 00 00 push $0x3d68
1a8: ff 35 78 55 00 00 push 0x5578
1ae: e8 8d 38 00 00 call 3a40 <printf>
exit();
1b3: e8 1b 37 00 00 call 38d3 <exit>
printf(stdout, "chdir / failed\n");
1b8: 50 push %eax
1b9: 50 push %eax
1ba: 68 b3 3d 00 00 push $0x3db3
1bf: ff 35 78 55 00 00 push 0x5578
1c5: e8 76 38 00 00 call 3a40 <printf>
exit();
1ca: e8 04 37 00 00 call 38d3 <exit>
printf(stdout, "unlink ../iputdir failed\n");
1cf: 52 push %edx
1d0: 52 push %edx
1d1: 68 97 3d 00 00 push $0x3d97
1d6: ff 35 78 55 00 00 push 0x5578
1dc: e8 5f 38 00 00 call 3a40 <printf>
exit();
1e1: e8 ed 36 00 00 call 38d3 <exit>
printf(stdout, "chdir iputdir failed\n");
1e6: 51 push %ecx
1e7: 51 push %ecx
1e8: 68 76 3d 00 00 push $0x3d76
1ed: ff 35 78 55 00 00 push 0x5578
1f3: e8 48 38 00 00 call 3a40 <printf>
exit();
1f8: e8 d6 36 00 00 call 38d3 <exit>
1fd: 8d 76 00 lea 0x0(%esi),%esi
00000200 <exitiputtest>:
{
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 83 ec 10 sub $0x10,%esp
printf(stdout, "exitiput test\n");
206: 68 c3 3d 00 00 push $0x3dc3
20b: ff 35 78 55 00 00 push 0x5578
211: e8 2a 38 00 00 call 3a40 <printf>
pid = fork();
216: e8 b0 36 00 00 call 38cb <fork>
if(pid < 0){
21b: 83 c4 10 add $0x10,%esp
21e: 85 c0 test %eax,%eax
220: 0f 88 8a 00 00 00 js 2b0 <exitiputtest+0xb0>
if(pid == 0){
226: 75 50 jne 278 <exitiputtest+0x78>
if(mkdir("iputdir") < 0){
228: 83 ec 0c sub $0xc,%esp
22b: 68 8f 3d 00 00 push $0x3d8f
230: e8 06 37 00 00 call 393b <mkdir>
235: 83 c4 10 add $0x10,%esp
238: 85 c0 test %eax,%eax
23a: 0f 88 87 00 00 00 js 2c7 <exitiputtest+0xc7>
if(chdir("iputdir") < 0){
240: 83 ec 0c sub $0xc,%esp
243: 68 8f 3d 00 00 push $0x3d8f
248: e8 f6 36 00 00 call 3943 <chdir>
24d: 83 c4 10 add $0x10,%esp
250: 85 c0 test %eax,%eax
252: 0f 88 86 00 00 00 js 2de <exitiputtest+0xde>
if(unlink("../iputdir") < 0){
258: 83 ec 0c sub $0xc,%esp
25b: 68 8c 3d 00 00 push $0x3d8c
260: e8 be 36 00 00 call 3923 <unlink>
265: 83 c4 10 add $0x10,%esp
268: 85 c0 test %eax,%eax
26a: 78 2c js 298 <exitiputtest+0x98>
exit();
26c: e8 62 36 00 00 call 38d3 <exit>
271: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
wait();
278: e8 5e 36 00 00 call 38db <wait>
printf(stdout, "exitiput test ok\n");
27d: 83 ec 08 sub $0x8,%esp
280: 68 e6 3d 00 00 push $0x3de6
285: ff 35 78 55 00 00 push 0x5578
28b: e8 b0 37 00 00 call 3a40 <printf>
}
290: 83 c4 10 add $0x10,%esp
293: c9 leave
294: c3 ret
295: 8d 76 00 lea 0x0(%esi),%esi
printf(stdout, "unlink ../iputdir failed\n");
298: 83 ec 08 sub $0x8,%esp
29b: 68 97 3d 00 00 push $0x3d97
2a0: ff 35 78 55 00 00 push 0x5578
2a6: e8 95 37 00 00 call 3a40 <printf>
exit();
2ab: e8 23 36 00 00 call 38d3 <exit>
printf(stdout, "fork failed\n");
2b0: 51 push %ecx
2b1: 51 push %ecx
2b2: 68 a9 4c 00 00 push $0x4ca9
2b7: ff 35 78 55 00 00 push 0x5578
2bd: e8 7e 37 00 00 call 3a40 <printf>
exit();
2c2: e8 0c 36 00 00 call 38d3 <exit>
printf(stdout, "mkdir failed\n");
2c7: 52 push %edx
2c8: 52 push %edx
2c9: 68 68 3d 00 00 push $0x3d68
2ce: ff 35 78 55 00 00 push 0x5578
2d4: e8 67 37 00 00 call 3a40 <printf>
exit();
2d9: e8 f5 35 00 00 call 38d3 <exit>
printf(stdout, "child chdir failed\n");
2de: 50 push %eax
2df: 50 push %eax
2e0: 68 d2 3d 00 00 push $0x3dd2
2e5: ff 35 78 55 00 00 push 0x5578
2eb: e8 50 37 00 00 call 3a40 <printf>
exit();
2f0: e8 de 35 00 00 call 38d3 <exit>
2f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000300 <openiputtest>:
{
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 83 ec 10 sub $0x10,%esp
printf(stdout, "openiput test\n");
306: 68 f8 3d 00 00 push $0x3df8
30b: ff 35 78 55 00 00 push 0x5578
311: e8 2a 37 00 00 call 3a40 <printf>
if(mkdir("oidir") < 0){
316: c7 04 24 07 3e 00 00 movl $0x3e07,(%esp)
31d: e8 19 36 00 00 call 393b <mkdir>
322: 83 c4 10 add $0x10,%esp
325: 85 c0 test %eax,%eax
327: 0f 88 9f 00 00 00 js 3cc <openiputtest+0xcc>
pid = fork();
32d: e8 99 35 00 00 call 38cb <fork>
if(pid < 0){
332: 85 c0 test %eax,%eax
334: 78 7f js 3b5 <openiputtest+0xb5>
if(pid == 0){
336: 75 38 jne 370 <openiputtest+0x70>
int fd = open("oidir", O_RDWR);
338: 83 ec 08 sub $0x8,%esp
33b: 6a 02 push $0x2
33d: 68 07 3e 00 00 push $0x3e07
342: e8 cc 35 00 00 call 3913 <open>
if(fd >= 0){
347: 83 c4 10 add $0x10,%esp
34a: 85 c0 test %eax,%eax
34c: 78 62 js 3b0 <openiputtest+0xb0>
printf(stdout, "open directory for write succeeded\n");
34e: 83 ec 08 sub $0x8,%esp
351: 68 8c 4d 00 00 push $0x4d8c
356: ff 35 78 55 00 00 push 0x5578
35c: e8 df 36 00 00 call 3a40 <printf>
exit();
361: e8 6d 35 00 00 call 38d3 <exit>
366: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36d: 8d 76 00 lea 0x0(%esi),%esi
sleep(1);
370: 83 ec 0c sub $0xc,%esp
373: 6a 01 push $0x1
375: e8 e9 35 00 00 call 3963 <sleep>
if(unlink("oidir") != 0){
37a: c7 04 24 07 3e 00 00 movl $0x3e07,(%esp)
381: e8 9d 35 00 00 call 3923 <unlink>
386: 83 c4 10 add $0x10,%esp
389: 85 c0 test %eax,%eax
38b: 75 56 jne 3e3 <openiputtest+0xe3>
wait();
38d: e8 49 35 00 00 call 38db <wait>
printf(stdout, "openiput test ok\n");
392: 83 ec 08 sub $0x8,%esp
395: 68 30 3e 00 00 push $0x3e30
39a: ff 35 78 55 00 00 push 0x5578
3a0: e8 9b 36 00 00 call 3a40 <printf>
}
3a5: 83 c4 10 add $0x10,%esp
3a8: c9 leave
3a9: c3 ret
3aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
exit();
3b0: e8 1e 35 00 00 call 38d3 <exit>
printf(stdout, "fork failed\n");
3b5: 52 push %edx
3b6: 52 push %edx
3b7: 68 a9 4c 00 00 push $0x4ca9
3bc: ff 35 78 55 00 00 push 0x5578
3c2: e8 79 36 00 00 call 3a40 <printf>
exit();
3c7: e8 07 35 00 00 call 38d3 <exit>
printf(stdout, "mkdir oidir failed\n");
3cc: 51 push %ecx
3cd: 51 push %ecx
3ce: 68 0d 3e 00 00 push $0x3e0d
3d3: ff 35 78 55 00 00 push 0x5578
3d9: e8 62 36 00 00 call 3a40 <printf>
exit();
3de: e8 f0 34 00 00 call 38d3 <exit>
printf(stdout, "unlink failed\n");
3e3: 50 push %eax
3e4: 50 push %eax
3e5: 68 21 3e 00 00 push $0x3e21
3ea: ff 35 78 55 00 00 push 0x5578
3f0: e8 4b 36 00 00 call 3a40 <printf>
exit();
3f5: e8 d9 34 00 00 call 38d3 <exit>
3fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000400 <opentest>:
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 83 ec 10 sub $0x10,%esp
printf(stdout, "open test\n");
406: 68 42 3e 00 00 push $0x3e42
40b: ff 35 78 55 00 00 push 0x5578
411: e8 2a 36 00 00 call 3a40 <printf>
fd = open("echo", 0);
416: 58 pop %eax
417: 5a pop %edx
418: 6a 00 push $0x0
41a: 68 4d 3e 00 00 push $0x3e4d
41f: e8 ef 34 00 00 call 3913 <open>
if(fd < 0){
424: 83 c4 10 add $0x10,%esp
427: 85 c0 test %eax,%eax
429: 78 36 js 461 <opentest+0x61>
close(fd);
42b: 83 ec 0c sub $0xc,%esp
42e: 50 push %eax
42f: e8 c7 34 00 00 call 38fb <close>
fd = open("doesnotexist", 0);
434: 5a pop %edx
435: 59 pop %ecx
436: 6a 00 push $0x0
438: 68 65 3e 00 00 push $0x3e65
43d: e8 d1 34 00 00 call 3913 <open>
if(fd >= 0){
442: 83 c4 10 add $0x10,%esp
445: 85 c0 test %eax,%eax
447: 79 2f jns 478 <opentest+0x78>
printf(stdout, "open test ok\n");
449: 83 ec 08 sub $0x8,%esp
44c: 68 90 3e 00 00 push $0x3e90
451: ff 35 78 55 00 00 push 0x5578
457: e8 e4 35 00 00 call 3a40 <printf>
}
45c: 83 c4 10 add $0x10,%esp
45f: c9 leave
460: c3 ret
printf(stdout, "open echo failed!\n");
461: 50 push %eax
462: 50 push %eax
463: 68 52 3e 00 00 push $0x3e52
468: ff 35 78 55 00 00 push 0x5578
46e: e8 cd 35 00 00 call 3a40 <printf>
exit();
473: e8 5b 34 00 00 call 38d3 <exit>
printf(stdout, "open doesnotexist succeeded!\n");
478: 50 push %eax
479: 50 push %eax
47a: 68 72 3e 00 00 push $0x3e72
47f: ff 35 78 55 00 00 push 0x5578
485: e8 b6 35 00 00 call 3a40 <printf>
exit();
48a: e8 44 34 00 00 call 38d3 <exit>
48f: 90 nop
00000490 <writetest>:
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 56 push %esi
494: 53 push %ebx
printf(stdout, "small file test\n");
495: 83 ec 08 sub $0x8,%esp
498: 68 9e 3e 00 00 push $0x3e9e
49d: ff 35 78 55 00 00 push 0x5578
4a3: e8 98 35 00 00 call 3a40 <printf>
fd = open("small", O_CREATE|O_RDWR);
4a8: 58 pop %eax
4a9: 5a pop %edx
4aa: 68 02 02 00 00 push $0x202
4af: 68 af 3e 00 00 push $0x3eaf
4b4: e8 5a 34 00 00 call 3913 <open>
if(fd >= 0){
4b9: 83 c4 10 add $0x10,%esp
4bc: 85 c0 test %eax,%eax
4be: 0f 88 88 01 00 00 js 64c <writetest+0x1bc>
printf(stdout, "creat small succeeded; ok\n");
4c4: 83 ec 08 sub $0x8,%esp
4c7: 89 c6 mov %eax,%esi
for(i = 0; i < 100; i++){
4c9: 31 db xor %ebx,%ebx
printf(stdout, "creat small succeeded; ok\n");
4cb: 68 b5 3e 00 00 push $0x3eb5
4d0: ff 35 78 55 00 00 push 0x5578
4d6: e8 65 35 00 00 call 3a40 <printf>
4db: 83 c4 10 add $0x10,%esp
4de: 66 90 xchg %ax,%ax
if(write(fd, "aaaaaaaaaa", 10) != 10){
4e0: 83 ec 04 sub $0x4,%esp
4e3: 6a 0a push $0xa
4e5: 68 ec 3e 00 00 push $0x3eec
4ea: 56 push %esi
4eb: e8 03 34 00 00 call 38f3 <write>
4f0: 83 c4 10 add $0x10,%esp
4f3: 83 f8 0a cmp $0xa,%eax
4f6: 0f 85 d9 00 00 00 jne 5d5 <writetest+0x145>
if(write(fd, "bbbbbbbbbb", 10) != 10){
4fc: 83 ec 04 sub $0x4,%esp
4ff: 6a 0a push $0xa
501: 68 f7 3e 00 00 push $0x3ef7
506: 56 push %esi
507: e8 e7 33 00 00 call 38f3 <write>
50c: 83 c4 10 add $0x10,%esp
50f: 83 f8 0a cmp $0xa,%eax
512: 0f 85 d6 00 00 00 jne 5ee <writetest+0x15e>
for(i = 0; i < 100; i++){
518: 83 c3 01 add $0x1,%ebx
51b: 83 fb 64 cmp $0x64,%ebx
51e: 75 c0 jne 4e0 <writetest+0x50>
printf(stdout, "writes ok\n");
520: 83 ec 08 sub $0x8,%esp
523: 68 02 3f 00 00 push $0x3f02
528: ff 35 78 55 00 00 push 0x5578
52e: e8 0d 35 00 00 call 3a40 <printf>
close(fd);
533: 89 34 24 mov %esi,(%esp)
536: e8 c0 33 00 00 call 38fb <close>
fd = open("small", O_RDONLY);
53b: 5b pop %ebx
53c: 5e pop %esi
53d: 6a 00 push $0x0
53f: 68 af 3e 00 00 push $0x3eaf
544: e8 ca 33 00 00 call 3913 <open>
if(fd >= 0){
549: 83 c4 10 add $0x10,%esp
fd = open("small", O_RDONLY);
54c: 89 c3 mov %eax,%ebx
if(fd >= 0){
54e: 85 c0 test %eax,%eax
550: 0f 88 b1 00 00 00 js 607 <writetest+0x177>
printf(stdout, "open small succeeded ok\n");
556: 83 ec 08 sub $0x8,%esp
559: 68 0d 3f 00 00 push $0x3f0d
55e: ff 35 78 55 00 00 push 0x5578
564: e8 d7 34 00 00 call 3a40 <printf>
i = read(fd, buf, 2000);
569: 83 c4 0c add $0xc,%esp
56c: 68 d0 07 00 00 push $0x7d0
571: 68 c0 7c 00 00 push $0x7cc0
576: 53 push %ebx
577: e8 6f 33 00 00 call 38eb <read>
if(i == 2000){
57c: 83 c4 10 add $0x10,%esp
57f: 3d d0 07 00 00 cmp $0x7d0,%eax
584: 0f 85 94 00 00 00 jne 61e <writetest+0x18e>
printf(stdout, "read succeeded ok\n");
58a: 83 ec 08 sub $0x8,%esp
58d: 68 41 3f 00 00 push $0x3f41
592: ff 35 78 55 00 00 push 0x5578
598: e8 a3 34 00 00 call 3a40 <printf>
close(fd);
59d: 89 1c 24 mov %ebx,(%esp)
5a0: e8 56 33 00 00 call 38fb <close>
if(unlink("small") < 0){
5a5: c7 04 24 af 3e 00 00 movl $0x3eaf,(%esp)
5ac: e8 72 33 00 00 call 3923 <unlink>
5b1: 83 c4 10 add $0x10,%esp
5b4: 85 c0 test %eax,%eax
5b6: 78 7d js 635 <writetest+0x1a5>
printf(stdout, "small file test ok\n");
5b8: 83 ec 08 sub $0x8,%esp
5bb: 68 69 3f 00 00 push $0x3f69
5c0: ff 35 78 55 00 00 push 0x5578
5c6: e8 75 34 00 00 call 3a40 <printf>
}
5cb: 83 c4 10 add $0x10,%esp
5ce: 8d 65 f8 lea -0x8(%ebp),%esp
5d1: 5b pop %ebx
5d2: 5e pop %esi
5d3: 5d pop %ebp
5d4: c3 ret
printf(stdout, "error: write aa %d new file failed\n", i);
5d5: 83 ec 04 sub $0x4,%esp
5d8: 53 push %ebx
5d9: 68 b0 4d 00 00 push $0x4db0
5de: ff 35 78 55 00 00 push 0x5578
5e4: e8 57 34 00 00 call 3a40 <printf>
exit();
5e9: e8 e5 32 00 00 call 38d3 <exit>
printf(stdout, "error: write bb %d new file failed\n", i);
5ee: 83 ec 04 sub $0x4,%esp
5f1: 53 push %ebx
5f2: 68 d4 4d 00 00 push $0x4dd4
5f7: ff 35 78 55 00 00 push 0x5578
5fd: e8 3e 34 00 00 call 3a40 <printf>
exit();
602: e8 cc 32 00 00 call 38d3 <exit>
printf(stdout, "error: open small failed!\n");
607: 51 push %ecx
608: 51 push %ecx
609: 68 26 3f 00 00 push $0x3f26
60e: ff 35 78 55 00 00 push 0x5578
614: e8 27 34 00 00 call 3a40 <printf>
exit();
619: e8 b5 32 00 00 call 38d3 <exit>
printf(stdout, "read failed\n");
61e: 52 push %edx
61f: 52 push %edx
620: 68 6d 42 00 00 push $0x426d
625: ff 35 78 55 00 00 push 0x5578
62b: e8 10 34 00 00 call 3a40 <printf>
exit();
630: e8 9e 32 00 00 call 38d3 <exit>
printf(stdout, "unlink small failed\n");
635: 50 push %eax
636: 50 push %eax
637: 68 54 3f 00 00 push $0x3f54
63c: ff 35 78 55 00 00 push 0x5578
642: e8 f9 33 00 00 call 3a40 <printf>
exit();
647: e8 87 32 00 00 call 38d3 <exit>
printf(stdout, "error: creat small failed!\n");
64c: 50 push %eax
64d: 50 push %eax
64e: 68 d0 3e 00 00 push $0x3ed0
653: ff 35 78 55 00 00 push 0x5578
659: e8 e2 33 00 00 call 3a40 <printf>
exit();
65e: e8 70 32 00 00 call 38d3 <exit>
663: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
66a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000670 <writetest1>:
{
670: 55 push %ebp
671: 89 e5 mov %esp,%ebp
673: 56 push %esi
674: 53 push %ebx
printf(stdout, "big files test\n");
675: 83 ec 08 sub $0x8,%esp
678: 68 7d 3f 00 00 push $0x3f7d
67d: ff 35 78 55 00 00 push 0x5578
683: e8 b8 33 00 00 call 3a40 <printf>
fd = open("big", O_CREATE|O_RDWR);
688: 58 pop %eax
689: 5a pop %edx
68a: 68 02 02 00 00 push $0x202
68f: 68 f7 3f 00 00 push $0x3ff7
694: e8 7a 32 00 00 call 3913 <open>
if(fd < 0){
699: 83 c4 10 add $0x10,%esp
69c: 85 c0 test %eax,%eax
69e: 0f 88 61 01 00 00 js 805 <writetest1+0x195>
6a4: 89 c6 mov %eax,%esi
for(i = 0; i < MAXFILE; i++){
6a6: 31 db xor %ebx,%ebx
6a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6af: 90 nop
if(write(fd, buf, 512) != 512){
6b0: 83 ec 04 sub $0x4,%esp
((int*)buf)[0] = i;
6b3: 89 1d c0 7c 00 00 mov %ebx,0x7cc0
if(write(fd, buf, 512) != 512){
6b9: 68 00 02 00 00 push $0x200
6be: 68 c0 7c 00 00 push $0x7cc0
6c3: 56 push %esi
6c4: e8 2a 32 00 00 call 38f3 <write>
6c9: 83 c4 10 add $0x10,%esp
6cc: 3d 00 02 00 00 cmp $0x200,%eax
6d1: 0f 85 b3 00 00 00 jne 78a <writetest1+0x11a>
for(i = 0; i < MAXFILE; i++){
6d7: 83 c3 01 add $0x1,%ebx
6da: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
6e0: 75 ce jne 6b0 <writetest1+0x40>
close(fd);
6e2: 83 ec 0c sub $0xc,%esp
6e5: 56 push %esi
6e6: e8 10 32 00 00 call 38fb <close>
fd = open("big", O_RDONLY);
6eb: 5b pop %ebx
6ec: 5e pop %esi
6ed: 6a 00 push $0x0
6ef: 68 f7 3f 00 00 push $0x3ff7
6f4: e8 1a 32 00 00 call 3913 <open>
if(fd < 0){
6f9: 83 c4 10 add $0x10,%esp
fd = open("big", O_RDONLY);
6fc: 89 c3 mov %eax,%ebx
if(fd < 0){
6fe: 85 c0 test %eax,%eax
700: 0f 88 e8 00 00 00 js 7ee <writetest1+0x17e>
n = 0;
706: 31 f6 xor %esi,%esi
708: eb 1d jmp 727 <writetest1+0xb7>
70a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(i != 512){
710: 3d 00 02 00 00 cmp $0x200,%eax
715: 0f 85 9f 00 00 00 jne 7ba <writetest1+0x14a>
if(((int*)buf)[0] != n){
71b: a1 c0 7c 00 00 mov 0x7cc0,%eax
720: 39 f0 cmp %esi,%eax
722: 75 7f jne 7a3 <writetest1+0x133>
n++;
724: 83 c6 01 add $0x1,%esi
i = read(fd, buf, 512);
727: 83 ec 04 sub $0x4,%esp
72a: 68 00 02 00 00 push $0x200
72f: 68 c0 7c 00 00 push $0x7cc0
734: 53 push %ebx
735: e8 b1 31 00 00 call 38eb <read>
if(i == 0){
73a: 83 c4 10 add $0x10,%esp
73d: 85 c0 test %eax,%eax
73f: 75 cf jne 710 <writetest1+0xa0>
if(n == MAXFILE - 1){
741: 81 fe 8b 00 00 00 cmp $0x8b,%esi
747: 0f 84 86 00 00 00 je 7d3 <writetest1+0x163>
close(fd);
74d: 83 ec 0c sub $0xc,%esp
750: 53 push %ebx
751: e8 a5 31 00 00 call 38fb <close>
if(unlink("big") < 0){
756: c7 04 24 f7 3f 00 00 movl $0x3ff7,(%esp)
75d: e8 c1 31 00 00 call 3923 <unlink>
762: 83 c4 10 add $0x10,%esp
765: 85 c0 test %eax,%eax
767: 0f 88 af 00 00 00 js 81c <writetest1+0x1ac>
printf(stdout, "big files ok\n");
76d: 83 ec 08 sub $0x8,%esp
770: 68 1e 40 00 00 push $0x401e
775: ff 35 78 55 00 00 push 0x5578
77b: e8 c0 32 00 00 call 3a40 <printf>
}
780: 83 c4 10 add $0x10,%esp
783: 8d 65 f8 lea -0x8(%ebp),%esp
786: 5b pop %ebx
787: 5e pop %esi
788: 5d pop %ebp
789: c3 ret
printf(stdout, "error: write big file failed\n", i);
78a: 83 ec 04 sub $0x4,%esp
78d: 53 push %ebx
78e: 68 a7 3f 00 00 push $0x3fa7
793: ff 35 78 55 00 00 push 0x5578
799: e8 a2 32 00 00 call 3a40 <printf>
exit();
79e: e8 30 31 00 00 call 38d3 <exit>
printf(stdout, "read content of block %d is %d\n",
7a3: 50 push %eax
7a4: 56 push %esi
7a5: 68 f8 4d 00 00 push $0x4df8
7aa: ff 35 78 55 00 00 push 0x5578
7b0: e8 8b 32 00 00 call 3a40 <printf>
exit();
7b5: e8 19 31 00 00 call 38d3 <exit>
printf(stdout, "read failed %d\n", i);
7ba: 83 ec 04 sub $0x4,%esp
7bd: 50 push %eax
7be: 68 fb 3f 00 00 push $0x3ffb
7c3: ff 35 78 55 00 00 push 0x5578
7c9: e8 72 32 00 00 call 3a40 <printf>
exit();
7ce: e8 00 31 00 00 call 38d3 <exit>
printf(stdout, "read only %d blocks from big", n);
7d3: 52 push %edx
7d4: 68 8b 00 00 00 push $0x8b
7d9: 68 de 3f 00 00 push $0x3fde
7de: ff 35 78 55 00 00 push 0x5578
7e4: e8 57 32 00 00 call 3a40 <printf>
exit();
7e9: e8 e5 30 00 00 call 38d3 <exit>
printf(stdout, "error: open big failed!\n");
7ee: 51 push %ecx
7ef: 51 push %ecx
7f0: 68 c5 3f 00 00 push $0x3fc5
7f5: ff 35 78 55 00 00 push 0x5578
7fb: e8 40 32 00 00 call 3a40 <printf>
exit();
800: e8 ce 30 00 00 call 38d3 <exit>
printf(stdout, "error: creat big failed!\n");
805: 50 push %eax
806: 50 push %eax
807: 68 8d 3f 00 00 push $0x3f8d
80c: ff 35 78 55 00 00 push 0x5578
812: e8 29 32 00 00 call 3a40 <printf>
exit();
817: e8 b7 30 00 00 call 38d3 <exit>
printf(stdout, "unlink big failed\n");
81c: 50 push %eax
81d: 50 push %eax
81e: 68 0b 40 00 00 push $0x400b
823: ff 35 78 55 00 00 push 0x5578
829: e8 12 32 00 00 call 3a40 <printf>
exit();
82e: e8 a0 30 00 00 call 38d3 <exit>
833: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
83a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000840 <createtest>:
{
840: 55 push %ebp
841: 89 e5 mov %esp,%ebp
843: 53 push %ebx
name[2] = '\0';
844: bb 30 00 00 00 mov $0x30,%ebx
{
849: 83 ec 0c sub $0xc,%esp
printf(stdout, "many creates, followed by unlink test\n");
84c: 68 18 4e 00 00 push $0x4e18
851: ff 35 78 55 00 00 push 0x5578
857: e8 e4 31 00 00 call 3a40 <printf>
name[0] = 'a';
85c: c6 05 b0 7c 00 00 61 movb $0x61,0x7cb0
name[2] = '\0';
863: 83 c4 10 add $0x10,%esp
866: c6 05 b2 7c 00 00 00 movb $0x0,0x7cb2
for(i = 0; i < 52; i++){
86d: 8d 76 00 lea 0x0(%esi),%esi
fd = open(name, O_CREATE|O_RDWR);
870: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
873: 88 1d b1 7c 00 00 mov %bl,0x7cb1
for(i = 0; i < 52; i++){
879: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE|O_RDWR);
87c: 68 02 02 00 00 push $0x202
881: 68 b0 7c 00 00 push $0x7cb0
886: e8 88 30 00 00 call 3913 <open>
close(fd);
88b: 89 04 24 mov %eax,(%esp)
88e: e8 68 30 00 00 call 38fb <close>
for(i = 0; i < 52; i++){
893: 83 c4 10 add $0x10,%esp
896: 80 fb 64 cmp $0x64,%bl
899: 75 d5 jne 870 <createtest+0x30>
name[0] = 'a';
89b: c6 05 b0 7c 00 00 61 movb $0x61,0x7cb0
name[2] = '\0';
8a2: bb 30 00 00 00 mov $0x30,%ebx
8a7: c6 05 b2 7c 00 00 00 movb $0x0,0x7cb2
for(i = 0; i < 52; i++){
8ae: 66 90 xchg %ax,%ax
unlink(name);
8b0: 83 ec 0c sub $0xc,%esp
name[1] = '0' + i;
8b3: 88 1d b1 7c 00 00 mov %bl,0x7cb1
for(i = 0; i < 52; i++){
8b9: 83 c3 01 add $0x1,%ebx
unlink(name);
8bc: 68 b0 7c 00 00 push $0x7cb0
8c1: e8 5d 30 00 00 call 3923 <unlink>
for(i = 0; i < 52; i++){
8c6: 83 c4 10 add $0x10,%esp
8c9: 80 fb 64 cmp $0x64,%bl
8cc: 75 e2 jne 8b0 <createtest+0x70>
printf(stdout, "many creates, followed by unlink; ok\n");
8ce: 83 ec 08 sub $0x8,%esp
8d1: 68 40 4e 00 00 push $0x4e40
8d6: ff 35 78 55 00 00 push 0x5578
8dc: e8 5f 31 00 00 call 3a40 <printf>
}
8e1: 8b 5d fc mov -0x4(%ebp),%ebx
8e4: 83 c4 10 add $0x10,%esp
8e7: c9 leave
8e8: c3 ret
8e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000008f0 <dirtest>:
{
8f0: 55 push %ebp
8f1: 89 e5 mov %esp,%ebp
8f3: 83 ec 10 sub $0x10,%esp
printf(stdout, "mkdir test\n");
8f6: 68 2c 40 00 00 push $0x402c
8fb: ff 35 78 55 00 00 push 0x5578
901: e8 3a 31 00 00 call 3a40 <printf>
if(mkdir("dir0") < 0){
906: c7 04 24 38 40 00 00 movl $0x4038,(%esp)
90d: e8 29 30 00 00 call 393b <mkdir>
912: 83 c4 10 add $0x10,%esp
915: 85 c0 test %eax,%eax
917: 78 58 js 971 <dirtest+0x81>
if(chdir("dir0") < 0){
919: 83 ec 0c sub $0xc,%esp
91c: 68 38 40 00 00 push $0x4038
921: e8 1d 30 00 00 call 3943 <chdir>
926: 83 c4 10 add $0x10,%esp
929: 85 c0 test %eax,%eax
92b: 0f 88 85 00 00 00 js 9b6 <dirtest+0xc6>
if(chdir("..") < 0){
931: 83 ec 0c sub $0xc,%esp
934: 68 dd 45 00 00 push $0x45dd
939: e8 05 30 00 00 call 3943 <chdir>
93e: 83 c4 10 add $0x10,%esp
941: 85 c0 test %eax,%eax
943: 78 5a js 99f <dirtest+0xaf>
if(unlink("dir0") < 0){
945: 83 ec 0c sub $0xc,%esp
948: 68 38 40 00 00 push $0x4038
94d: e8 d1 2f 00 00 call 3923 <unlink>
952: 83 c4 10 add $0x10,%esp
955: 85 c0 test %eax,%eax
957: 78 2f js 988 <dirtest+0x98>
printf(stdout, "mkdir test ok\n");
959: 83 ec 08 sub $0x8,%esp
95c: 68 75 40 00 00 push $0x4075
961: ff 35 78 55 00 00 push 0x5578
967: e8 d4 30 00 00 call 3a40 <printf>
}
96c: 83 c4 10 add $0x10,%esp
96f: c9 leave
970: c3 ret
printf(stdout, "mkdir failed\n");
971: 50 push %eax
972: 50 push %eax
973: 68 68 3d 00 00 push $0x3d68
978: ff 35 78 55 00 00 push 0x5578
97e: e8 bd 30 00 00 call 3a40 <printf>
exit();
983: e8 4b 2f 00 00 call 38d3 <exit>
printf(stdout, "unlink dir0 failed\n");
988: 50 push %eax
989: 50 push %eax
98a: 68 61 40 00 00 push $0x4061
98f: ff 35 78 55 00 00 push 0x5578
995: e8 a6 30 00 00 call 3a40 <printf>
exit();
99a: e8 34 2f 00 00 call 38d3 <exit>
printf(stdout, "chdir .. failed\n");
99f: 52 push %edx
9a0: 52 push %edx
9a1: 68 50 40 00 00 push $0x4050
9a6: ff 35 78 55 00 00 push 0x5578
9ac: e8 8f 30 00 00 call 3a40 <printf>
exit();
9b1: e8 1d 2f 00 00 call 38d3 <exit>
printf(stdout, "chdir dir0 failed\n");
9b6: 51 push %ecx
9b7: 51 push %ecx
9b8: 68 3d 40 00 00 push $0x403d
9bd: ff 35 78 55 00 00 push 0x5578
9c3: e8 78 30 00 00 call 3a40 <printf>
exit();
9c8: e8 06 2f 00 00 call 38d3 <exit>
9cd: 8d 76 00 lea 0x0(%esi),%esi
000009d0 <exectest>:
{
9d0: 55 push %ebp
9d1: 89 e5 mov %esp,%ebp
9d3: 83 ec 10 sub $0x10,%esp
printf(stdout, "exec test\n");
9d6: 68 84 40 00 00 push $0x4084
9db: ff 35 78 55 00 00 push 0x5578
9e1: e8 5a 30 00 00 call 3a40 <printf>
if(exec("echo", echoargv) < 0){
9e6: 5a pop %edx
9e7: 59 pop %ecx
9e8: 68 7c 55 00 00 push $0x557c
9ed: 68 4d 3e 00 00 push $0x3e4d
9f2: e8 14 2f 00 00 call 390b <exec>
9f7: 83 c4 10 add $0x10,%esp
9fa: 85 c0 test %eax,%eax
9fc: 78 02 js a00 <exectest+0x30>
}
9fe: c9 leave
9ff: c3 ret
printf(stdout, "exec echo failed\n");
a00: 50 push %eax
a01: 50 push %eax
a02: 68 8f 40 00 00 push $0x408f
a07: ff 35 78 55 00 00 push 0x5578
a0d: e8 2e 30 00 00 call 3a40 <printf>
exit();
a12: e8 bc 2e 00 00 call 38d3 <exit>
a17: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
a1e: 66 90 xchg %ax,%ax
00000a20 <pipe1>:
{
a20: 55 push %ebp
a21: 89 e5 mov %esp,%ebp
a23: 57 push %edi
a24: 56 push %esi
if(pipe(fds) != 0){
a25: 8d 45 e0 lea -0x20(%ebp),%eax
{
a28: 53 push %ebx
a29: 83 ec 38 sub $0x38,%esp
if(pipe(fds) != 0){
a2c: 50 push %eax
a2d: e8 b1 2e 00 00 call 38e3 <pipe>
a32: 83 c4 10 add $0x10,%esp
a35: 85 c0 test %eax,%eax
a37: 0f 85 34 01 00 00 jne b71 <pipe1+0x151>
pid = fork();
a3d: e8 89 2e 00 00 call 38cb <fork>
if(pid == 0){
a42: 85 c0 test %eax,%eax
a44: 0f 84 85 00 00 00 je acf <pipe1+0xaf>
} else if(pid > 0){
a4a: 0f 8e 34 01 00 00 jle b84 <pipe1+0x164>
close(fds[1]);
a50: 83 ec 0c sub $0xc,%esp
a53: ff 75 e4 push -0x1c(%ebp)
seq = 0;
a56: 31 db xor %ebx,%ebx
cc = 1;
a58: be 01 00 00 00 mov $0x1,%esi
close(fds[1]);
a5d: e8 99 2e 00 00 call 38fb <close>
total = 0;
a62: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
while((n = read(fds[0], buf, cc)) > 0){
a69: 83 c4 10 add $0x10,%esp
a6c: 83 ec 04 sub $0x4,%esp
a6f: 56 push %esi
a70: 68 c0 7c 00 00 push $0x7cc0
a75: ff 75 e0 push -0x20(%ebp)
a78: e8 6e 2e 00 00 call 38eb <read>
a7d: 83 c4 10 add $0x10,%esp
a80: 89 c7 mov %eax,%edi
a82: 85 c0 test %eax,%eax
a84: 0f 8e a3 00 00 00 jle b2d <pipe1+0x10d>
a8a: 8d 0c 1f lea (%edi,%ebx,1),%ecx
for(i = 0; i < n; i++){
a8d: 31 c0 xor %eax,%eax
a8f: 90 nop
if((buf[i] & 0xff) != (seq++ & 0xff)){
a90: 89 da mov %ebx,%edx
a92: 83 c3 01 add $0x1,%ebx
a95: 38 90 c0 7c 00 00 cmp %dl,0x7cc0(%eax)
a9b: 75 18 jne ab5 <pipe1+0x95>
for(i = 0; i < n; i++){
a9d: 83 c0 01 add $0x1,%eax
aa0: 39 d9 cmp %ebx,%ecx
aa2: 75 ec jne a90 <pipe1+0x70>
cc = cc * 2;
aa4: 01 f6 add %esi,%esi
aa6: b8 00 20 00 00 mov $0x2000,%eax
total += n;
aab: 01 7d d4 add %edi,-0x2c(%ebp)
aae: 39 c6 cmp %eax,%esi
ab0: 0f 4f f0 cmovg %eax,%esi
ab3: eb b7 jmp a6c <pipe1+0x4c>
printf(1, "pipe1 oops 2\n");
ab5: 83 ec 08 sub $0x8,%esp
ab8: 68 be 40 00 00 push $0x40be
abd: 6a 01 push $0x1
abf: e8 7c 2f 00 00 call 3a40 <printf>
ac4: 83 c4 10 add $0x10,%esp
}
ac7: 8d 65 f4 lea -0xc(%ebp),%esp
aca: 5b pop %ebx
acb: 5e pop %esi
acc: 5f pop %edi
acd: 5d pop %ebp
ace: c3 ret
close(fds[0]);
acf: 83 ec 0c sub $0xc,%esp
ad2: ff 75 e0 push -0x20(%ebp)
seq = 0;
ad5: 31 db xor %ebx,%ebx
close(fds[0]);
ad7: e8 1f 2e 00 00 call 38fb <close>
adc: 83 c4 10 add $0x10,%esp
for(i = 0; i < 1033; i++)
adf: 31 c0 xor %eax,%eax
ae1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
buf[i] = seq++;
ae8: 8d 14 18 lea (%eax,%ebx,1),%edx
for(i = 0; i < 1033; i++)
aeb: 83 c0 01 add $0x1,%eax
buf[i] = seq++;
aee: 88 90 bf 7c 00 00 mov %dl,0x7cbf(%eax)
for(i = 0; i < 1033; i++)
af4: 3d 09 04 00 00 cmp $0x409,%eax
af9: 75 ed jne ae8 <pipe1+0xc8>
if(write(fds[1], buf, 1033) != 1033){
afb: 83 ec 04 sub $0x4,%esp
buf[i] = seq++;
afe: 81 c3 09 04 00 00 add $0x409,%ebx
if(write(fds[1], buf, 1033) != 1033){
b04: 68 09 04 00 00 push $0x409
b09: 68 c0 7c 00 00 push $0x7cc0
b0e: ff 75 e4 push -0x1c(%ebp)
b11: e8 dd 2d 00 00 call 38f3 <write>
b16: 83 c4 10 add $0x10,%esp
b19: 3d 09 04 00 00 cmp $0x409,%eax
b1e: 75 77 jne b97 <pipe1+0x177>
for(n = 0; n < 5; n++){
b20: 81 fb 2d 14 00 00 cmp $0x142d,%ebx
b26: 75 b7 jne adf <pipe1+0xbf>
exit();
b28: e8 a6 2d 00 00 call 38d3 <exit>
if(total != 5 * 1033){
b2d: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp)
b34: 75 26 jne b5c <pipe1+0x13c>
close(fds[0]);
b36: 83 ec 0c sub $0xc,%esp
b39: ff 75 e0 push -0x20(%ebp)
b3c: e8 ba 2d 00 00 call 38fb <close>
wait();
b41: e8 95 2d 00 00 call 38db <wait>
printf(1, "pipe1 ok\n");
b46: 5a pop %edx
b47: 59 pop %ecx
b48: 68 e3 40 00 00 push $0x40e3
b4d: 6a 01 push $0x1
b4f: e8 ec 2e 00 00 call 3a40 <printf>
b54: 83 c4 10 add $0x10,%esp
b57: e9 6b ff ff ff jmp ac7 <pipe1+0xa7>
printf(1, "pipe1 oops 3 total %d\n", total);
b5c: 53 push %ebx
b5d: ff 75 d4 push -0x2c(%ebp)
b60: 68 cc 40 00 00 push $0x40cc
b65: 6a 01 push $0x1
b67: e8 d4 2e 00 00 call 3a40 <printf>
exit();
b6c: e8 62 2d 00 00 call 38d3 <exit>
printf(1, "pipe() failed\n");
b71: 57 push %edi
b72: 57 push %edi
b73: 68 a1 40 00 00 push $0x40a1
b78: 6a 01 push $0x1
b7a: e8 c1 2e 00 00 call 3a40 <printf>
exit();
b7f: e8 4f 2d 00 00 call 38d3 <exit>
printf(1, "fork() failed\n");
b84: 50 push %eax
b85: 50 push %eax
b86: 68 ed 40 00 00 push $0x40ed
b8b: 6a 01 push $0x1
b8d: e8 ae 2e 00 00 call 3a40 <printf>
exit();
b92: e8 3c 2d 00 00 call 38d3 <exit>
printf(1, "pipe1 oops 1\n");
b97: 56 push %esi
b98: 56 push %esi
b99: 68 b0 40 00 00 push $0x40b0
b9e: 6a 01 push $0x1
ba0: e8 9b 2e 00 00 call 3a40 <printf>
exit();
ba5: e8 29 2d 00 00 call 38d3 <exit>
baa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000bb0 <preempt>:
{
bb0: 55 push %ebp
bb1: 89 e5 mov %esp,%ebp
bb3: 57 push %edi
bb4: 56 push %esi
bb5: 53 push %ebx
bb6: 83 ec 24 sub $0x24,%esp
printf(1, "preempt: ");
bb9: 68 fc 40 00 00 push $0x40fc
bbe: 6a 01 push $0x1
bc0: e8 7b 2e 00 00 call 3a40 <printf>
pid1 = fork();
bc5: e8 01 2d 00 00 call 38cb <fork>
if(pid1 == 0)
bca: 83 c4 10 add $0x10,%esp
bcd: 85 c0 test %eax,%eax
bcf: 75 07 jne bd8 <preempt+0x28>
for(;;)
bd1: eb fe jmp bd1 <preempt+0x21>
bd3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bd7: 90 nop
bd8: 89 c3 mov %eax,%ebx
pid2 = fork();
bda: e8 ec 2c 00 00 call 38cb <fork>
bdf: 89 c6 mov %eax,%esi
if(pid2 == 0)
be1: 85 c0 test %eax,%eax
be3: 75 0b jne bf0 <preempt+0x40>
for(;;)
be5: eb fe jmp be5 <preempt+0x35>
be7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bee: 66 90 xchg %ax,%ax
pipe(pfds);
bf0: 83 ec 0c sub $0xc,%esp
bf3: 8d 45 e0 lea -0x20(%ebp),%eax
bf6: 50 push %eax
bf7: e8 e7 2c 00 00 call 38e3 <pipe>
pid3 = fork();
bfc: e8 ca 2c 00 00 call 38cb <fork>
if(pid3 == 0){
c01: 83 c4 10 add $0x10,%esp
pid3 = fork();
c04: 89 c7 mov %eax,%edi
if(pid3 == 0){
c06: 85 c0 test %eax,%eax
c08: 75 3e jne c48 <preempt+0x98>
close(pfds[0]);
c0a: 83 ec 0c sub $0xc,%esp
c0d: ff 75 e0 push -0x20(%ebp)
c10: e8 e6 2c 00 00 call 38fb <close>
if(write(pfds[1], "x", 1) != 1)
c15: 83 c4 0c add $0xc,%esp
c18: 6a 01 push $0x1
c1a: 68 c1 46 00 00 push $0x46c1
c1f: ff 75 e4 push -0x1c(%ebp)
c22: e8 cc 2c 00 00 call 38f3 <write>
c27: 83 c4 10 add $0x10,%esp
c2a: 83 f8 01 cmp $0x1,%eax
c2d: 0f 85 b8 00 00 00 jne ceb <preempt+0x13b>
close(pfds[1]);
c33: 83 ec 0c sub $0xc,%esp
c36: ff 75 e4 push -0x1c(%ebp)
c39: e8 bd 2c 00 00 call 38fb <close>
c3e: 83 c4 10 add $0x10,%esp
for(;;)
c41: eb fe jmp c41 <preempt+0x91>
c43: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c47: 90 nop
close(pfds[1]);
c48: 83 ec 0c sub $0xc,%esp
c4b: ff 75 e4 push -0x1c(%ebp)
c4e: e8 a8 2c 00 00 call 38fb <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
c53: 83 c4 0c add $0xc,%esp
c56: 68 00 20 00 00 push $0x2000
c5b: 68 c0 7c 00 00 push $0x7cc0
c60: ff 75 e0 push -0x20(%ebp)
c63: e8 83 2c 00 00 call 38eb <read>
c68: 83 c4 10 add $0x10,%esp
c6b: 83 f8 01 cmp $0x1,%eax
c6e: 75 67 jne cd7 <preempt+0x127>
close(pfds[0]);
c70: 83 ec 0c sub $0xc,%esp
c73: ff 75 e0 push -0x20(%ebp)
c76: e8 80 2c 00 00 call 38fb <close>
printf(1, "kill... ");
c7b: 58 pop %eax
c7c: 5a pop %edx
c7d: 68 2d 41 00 00 push $0x412d
c82: 6a 01 push $0x1
c84: e8 b7 2d 00 00 call 3a40 <printf>
kill(pid1);
c89: 89 1c 24 mov %ebx,(%esp)
c8c: e8 72 2c 00 00 call 3903 <kill>
kill(pid2);
c91: 89 34 24 mov %esi,(%esp)
c94: e8 6a 2c 00 00 call 3903 <kill>
kill(pid3);
c99: 89 3c 24 mov %edi,(%esp)
c9c: e8 62 2c 00 00 call 3903 <kill>
printf(1, "wait... ");
ca1: 59 pop %ecx
ca2: 5b pop %ebx
ca3: 68 36 41 00 00 push $0x4136
ca8: 6a 01 push $0x1
caa: e8 91 2d 00 00 call 3a40 <printf>
wait();
caf: e8 27 2c 00 00 call 38db <wait>
wait();
cb4: e8 22 2c 00 00 call 38db <wait>
wait();
cb9: e8 1d 2c 00 00 call 38db <wait>
printf(1, "preempt ok\n");
cbe: 5e pop %esi
cbf: 5f pop %edi
cc0: 68 3f 41 00 00 push $0x413f
cc5: 6a 01 push $0x1
cc7: e8 74 2d 00 00 call 3a40 <printf>
ccc: 83 c4 10 add $0x10,%esp
}
ccf: 8d 65 f4 lea -0xc(%ebp),%esp
cd2: 5b pop %ebx
cd3: 5e pop %esi
cd4: 5f pop %edi
cd5: 5d pop %ebp
cd6: c3 ret
printf(1, "preempt read error");
cd7: 83 ec 08 sub $0x8,%esp
cda: 68 1a 41 00 00 push $0x411a
cdf: 6a 01 push $0x1
ce1: e8 5a 2d 00 00 call 3a40 <printf>
ce6: 83 c4 10 add $0x10,%esp
ce9: eb e4 jmp ccf <preempt+0x11f>
printf(1, "preempt write error");
ceb: 83 ec 08 sub $0x8,%esp
cee: 68 06 41 00 00 push $0x4106
cf3: 6a 01 push $0x1
cf5: e8 46 2d 00 00 call 3a40 <printf>
cfa: 83 c4 10 add $0x10,%esp
cfd: e9 31 ff ff ff jmp c33 <preempt+0x83>
d02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
d09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d10 <exitwait>:
{
d10: 55 push %ebp
d11: 89 e5 mov %esp,%ebp
d13: 56 push %esi
d14: be 64 00 00 00 mov $0x64,%esi
d19: 53 push %ebx
d1a: eb 14 jmp d30 <exitwait+0x20>
d1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid){
d20: 74 68 je d8a <exitwait+0x7a>
if(wait() != pid){
d22: e8 b4 2b 00 00 call 38db <wait>
d27: 39 d8 cmp %ebx,%eax
d29: 75 2d jne d58 <exitwait+0x48>
for(i = 0; i < 100; i++){
d2b: 83 ee 01 sub $0x1,%esi
d2e: 74 41 je d71 <exitwait+0x61>
pid = fork();
d30: e8 96 2b 00 00 call 38cb <fork>
d35: 89 c3 mov %eax,%ebx
if(pid < 0){
d37: 85 c0 test %eax,%eax
d39: 79 e5 jns d20 <exitwait+0x10>
printf(1, "fork failed\n");
d3b: 83 ec 08 sub $0x8,%esp
d3e: 68 a9 4c 00 00 push $0x4ca9
d43: 6a 01 push $0x1
d45: e8 f6 2c 00 00 call 3a40 <printf>
return;
d4a: 83 c4 10 add $0x10,%esp
}
d4d: 8d 65 f8 lea -0x8(%ebp),%esp
d50: 5b pop %ebx
d51: 5e pop %esi
d52: 5d pop %ebp
d53: c3 ret
d54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "wait wrong pid\n");
d58: 83 ec 08 sub $0x8,%esp
d5b: 68 4b 41 00 00 push $0x414b
d60: 6a 01 push $0x1
d62: e8 d9 2c 00 00 call 3a40 <printf>
return;
d67: 83 c4 10 add $0x10,%esp
}
d6a: 8d 65 f8 lea -0x8(%ebp),%esp
d6d: 5b pop %ebx
d6e: 5e pop %esi
d6f: 5d pop %ebp
d70: c3 ret
printf(1, "exitwait ok\n");
d71: 83 ec 08 sub $0x8,%esp
d74: 68 5b 41 00 00 push $0x415b
d79: 6a 01 push $0x1
d7b: e8 c0 2c 00 00 call 3a40 <printf>
d80: 83 c4 10 add $0x10,%esp
}
d83: 8d 65 f8 lea -0x8(%ebp),%esp
d86: 5b pop %ebx
d87: 5e pop %esi
d88: 5d pop %ebp
d89: c3 ret
exit();
d8a: e8 44 2b 00 00 call 38d3 <exit>
d8f: 90 nop
00000d90 <mem>:
{
d90: 55 push %ebp
d91: 89 e5 mov %esp,%ebp
d93: 56 push %esi
d94: 31 f6 xor %esi,%esi
d96: 53 push %ebx
printf(1, "mem test\n");
d97: 83 ec 08 sub $0x8,%esp
d9a: 68 68 41 00 00 push $0x4168
d9f: 6a 01 push $0x1
da1: e8 9a 2c 00 00 call 3a40 <printf>
ppid = getpid();
da6: e8 a8 2b 00 00 call 3953 <getpid>
dab: 89 c3 mov %eax,%ebx
if((pid = fork()) == 0){
dad: e8 19 2b 00 00 call 38cb <fork>
db2: 83 c4 10 add $0x10,%esp
db5: 85 c0 test %eax,%eax
db7: 74 0b je dc4 <mem+0x34>
db9: e9 8a 00 00 00 jmp e48 <mem+0xb8>
dbe: 66 90 xchg %ax,%ax
*(char**)m2 = m1;
dc0: 89 30 mov %esi,(%eax)
dc2: 89 c6 mov %eax,%esi
while((m2 = malloc(10001)) != 0){
dc4: 83 ec 0c sub $0xc,%esp
dc7: 68 11 27 00 00 push $0x2711
dcc: e8 9f 2e 00 00 call 3c70 <malloc>
dd1: 83 c4 10 add $0x10,%esp
dd4: 85 c0 test %eax,%eax
dd6: 75 e8 jne dc0 <mem+0x30>
while(m1){
dd8: 85 f6 test %esi,%esi
dda: 74 18 je df4 <mem+0x64>
ddc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m2 = *(char**)m1;
de0: 89 f0 mov %esi,%eax
free(m1);
de2: 83 ec 0c sub $0xc,%esp
m2 = *(char**)m1;
de5: 8b 36 mov (%esi),%esi
free(m1);
de7: 50 push %eax
de8: e8 f3 2d 00 00 call 3be0 <free>
while(m1){
ded: 83 c4 10 add $0x10,%esp
df0: 85 f6 test %esi,%esi
df2: 75 ec jne de0 <mem+0x50>
m1 = malloc(1024*20);
df4: 83 ec 0c sub $0xc,%esp
df7: 68 00 50 00 00 push $0x5000
dfc: e8 6f 2e 00 00 call 3c70 <malloc>
if(m1 == 0){
e01: 83 c4 10 add $0x10,%esp
e04: 85 c0 test %eax,%eax
e06: 74 20 je e28 <mem+0x98>
free(m1);
e08: 83 ec 0c sub $0xc,%esp
e0b: 50 push %eax
e0c: e8 cf 2d 00 00 call 3be0 <free>
printf(1, "mem ok\n");
e11: 58 pop %eax
e12: 5a pop %edx
e13: 68 8c 41 00 00 push $0x418c
e18: 6a 01 push $0x1
e1a: e8 21 2c 00 00 call 3a40 <printf>
exit();
e1f: e8 af 2a 00 00 call 38d3 <exit>
e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "couldn't allocate mem?!!\n");
e28: 83 ec 08 sub $0x8,%esp
e2b: 68 72 41 00 00 push $0x4172
e30: 6a 01 push $0x1
e32: e8 09 2c 00 00 call 3a40 <printf>
kill(ppid);
e37: 89 1c 24 mov %ebx,(%esp)
e3a: e8 c4 2a 00 00 call 3903 <kill>
exit();
e3f: e8 8f 2a 00 00 call 38d3 <exit>
e44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
e48: 8d 65 f8 lea -0x8(%ebp),%esp
e4b: 5b pop %ebx
e4c: 5e pop %esi
e4d: 5d pop %ebp
wait();
e4e: e9 88 2a 00 00 jmp 38db <wait>
e53: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
e5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000e60 <sharedfd>:
{
e60: 55 push %ebp
e61: 89 e5 mov %esp,%ebp
e63: 57 push %edi
e64: 56 push %esi
e65: 53 push %ebx
e66: 83 ec 34 sub $0x34,%esp
printf(1, "sharedfd test\n");
e69: 68 94 41 00 00 push $0x4194
e6e: 6a 01 push $0x1
e70: e8 cb 2b 00 00 call 3a40 <printf>
unlink("sharedfd");
e75: c7 04 24 a3 41 00 00 movl $0x41a3,(%esp)
e7c: e8 a2 2a 00 00 call 3923 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
e81: 5b pop %ebx
e82: 5e pop %esi
e83: 68 02 02 00 00 push $0x202
e88: 68 a3 41 00 00 push $0x41a3
e8d: e8 81 2a 00 00 call 3913 <open>
if(fd < 0){
e92: 83 c4 10 add $0x10,%esp
e95: 85 c0 test %eax,%eax
e97: 0f 88 2a 01 00 00 js fc7 <sharedfd+0x167>
e9d: 89 c7 mov %eax,%edi
memset(buf, pid==0?'c':'p', sizeof(buf));
e9f: 8d 75 de lea -0x22(%ebp),%esi
ea2: bb e8 03 00 00 mov $0x3e8,%ebx
pid = fork();
ea7: e8 1f 2a 00 00 call 38cb <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
eac: 83 f8 01 cmp $0x1,%eax
pid = fork();
eaf: 89 45 d4 mov %eax,-0x2c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
eb2: 19 c0 sbb %eax,%eax
eb4: 83 ec 04 sub $0x4,%esp
eb7: 83 e0 f3 and $0xfffffff3,%eax
eba: 6a 0a push $0xa
ebc: 83 c0 70 add $0x70,%eax
ebf: 50 push %eax
ec0: 56 push %esi
ec1: e8 7a 28 00 00 call 3740 <memset>
ec6: 83 c4 10 add $0x10,%esp
ec9: eb 0a jmp ed5 <sharedfd+0x75>
ecb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ecf: 90 nop
for(i = 0; i < 1000; i++){
ed0: 83 eb 01 sub $0x1,%ebx
ed3: 74 26 je efb <sharedfd+0x9b>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
ed5: 83 ec 04 sub $0x4,%esp
ed8: 6a 0a push $0xa
eda: 56 push %esi
edb: 57 push %edi
edc: e8 12 2a 00 00 call 38f3 <write>
ee1: 83 c4 10 add $0x10,%esp
ee4: 83 f8 0a cmp $0xa,%eax
ee7: 74 e7 je ed0 <sharedfd+0x70>
printf(1, "fstests: write sharedfd failed\n");
ee9: 83 ec 08 sub $0x8,%esp
eec: 68 94 4e 00 00 push $0x4e94
ef1: 6a 01 push $0x1
ef3: e8 48 2b 00 00 call 3a40 <printf>
break;
ef8: 83 c4 10 add $0x10,%esp
if(pid == 0)
efb: 8b 4d d4 mov -0x2c(%ebp),%ecx
efe: 85 c9 test %ecx,%ecx
f00: 0f 84 f5 00 00 00 je ffb <sharedfd+0x19b>
wait();
f06: e8 d0 29 00 00 call 38db <wait>
close(fd);
f0b: 83 ec 0c sub $0xc,%esp
nc = np = 0;
f0e: 31 db xor %ebx,%ebx
close(fd);
f10: 57 push %edi
f11: 8d 7d e8 lea -0x18(%ebp),%edi
f14: e8 e2 29 00 00 call 38fb <close>
fd = open("sharedfd", 0);
f19: 58 pop %eax
f1a: 5a pop %edx
f1b: 6a 00 push $0x0
f1d: 68 a3 41 00 00 push $0x41a3
f22: e8 ec 29 00 00 call 3913 <open>
if(fd < 0){
f27: 83 c4 10 add $0x10,%esp
nc = np = 0;
f2a: 31 d2 xor %edx,%edx
fd = open("sharedfd", 0);
f2c: 89 45 d0 mov %eax,-0x30(%ebp)
if(fd < 0){
f2f: 85 c0 test %eax,%eax
f31: 0f 88 aa 00 00 00 js fe1 <sharedfd+0x181>
f37: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f3e: 66 90 xchg %ax,%ax
while((n = read(fd, buf, sizeof(buf))) > 0){
f40: 83 ec 04 sub $0x4,%esp
f43: 89 55 d4 mov %edx,-0x2c(%ebp)
f46: 6a 0a push $0xa
f48: 56 push %esi
f49: ff 75 d0 push -0x30(%ebp)
f4c: e8 9a 29 00 00 call 38eb <read>
f51: 83 c4 10 add $0x10,%esp
f54: 85 c0 test %eax,%eax
f56: 7e 28 jle f80 <sharedfd+0x120>
f58: 8b 55 d4 mov -0x2c(%ebp),%edx
f5b: 89 f0 mov %esi,%eax
f5d: eb 13 jmp f72 <sharedfd+0x112>
f5f: 90 nop
np++;
f60: 80 f9 70 cmp $0x70,%cl
f63: 0f 94 c1 sete %cl
f66: 0f b6 c9 movzbl %cl,%ecx
f69: 01 cb add %ecx,%ebx
for(i = 0; i < sizeof(buf); i++){
f6b: 83 c0 01 add $0x1,%eax
f6e: 39 f8 cmp %edi,%eax
f70: 74 ce je f40 <sharedfd+0xe0>
if(buf[i] == 'c')
f72: 0f b6 08 movzbl (%eax),%ecx
f75: 80 f9 63 cmp $0x63,%cl
f78: 75 e6 jne f60 <sharedfd+0x100>
nc++;
f7a: 83 c2 01 add $0x1,%edx
if(buf[i] == 'p')
f7d: eb ec jmp f6b <sharedfd+0x10b>
f7f: 90 nop
close(fd);
f80: 83 ec 0c sub $0xc,%esp
f83: ff 75 d0 push -0x30(%ebp)
f86: e8 70 29 00 00 call 38fb <close>
unlink("sharedfd");
f8b: c7 04 24 a3 41 00 00 movl $0x41a3,(%esp)
f92: e8 8c 29 00 00 call 3923 <unlink>
if(nc == 10000 && np == 10000){
f97: 8b 55 d4 mov -0x2c(%ebp),%edx
f9a: 83 c4 10 add $0x10,%esp
f9d: 81 fa 10 27 00 00 cmp $0x2710,%edx
fa3: 75 5b jne 1000 <sharedfd+0x1a0>
fa5: 81 fb 10 27 00 00 cmp $0x2710,%ebx
fab: 75 53 jne 1000 <sharedfd+0x1a0>
printf(1, "sharedfd ok\n");
fad: 83 ec 08 sub $0x8,%esp
fb0: 68 ac 41 00 00 push $0x41ac
fb5: 6a 01 push $0x1
fb7: e8 84 2a 00 00 call 3a40 <printf>
fbc: 83 c4 10 add $0x10,%esp
}
fbf: 8d 65 f4 lea -0xc(%ebp),%esp
fc2: 5b pop %ebx
fc3: 5e pop %esi
fc4: 5f pop %edi
fc5: 5d pop %ebp
fc6: c3 ret
printf(1, "fstests: cannot open sharedfd for writing");
fc7: 83 ec 08 sub $0x8,%esp
fca: 68 68 4e 00 00 push $0x4e68
fcf: 6a 01 push $0x1
fd1: e8 6a 2a 00 00 call 3a40 <printf>
return;
fd6: 83 c4 10 add $0x10,%esp
}
fd9: 8d 65 f4 lea -0xc(%ebp),%esp
fdc: 5b pop %ebx
fdd: 5e pop %esi
fde: 5f pop %edi
fdf: 5d pop %ebp
fe0: c3 ret
printf(1, "fstests: cannot open sharedfd for reading\n");
fe1: 83 ec 08 sub $0x8,%esp
fe4: 68 b4 4e 00 00 push $0x4eb4
fe9: 6a 01 push $0x1
feb: e8 50 2a 00 00 call 3a40 <printf>
return;
ff0: 83 c4 10 add $0x10,%esp
}
ff3: 8d 65 f4 lea -0xc(%ebp),%esp
ff6: 5b pop %ebx
ff7: 5e pop %esi
ff8: 5f pop %edi
ff9: 5d pop %ebp
ffa: c3 ret
exit();
ffb: e8 d3 28 00 00 call 38d3 <exit>
printf(1, "sharedfd oops %d %d\n", nc, np);
1000: 53 push %ebx
1001: 52 push %edx
1002: 68 b9 41 00 00 push $0x41b9
1007: 6a 01 push $0x1
1009: e8 32 2a 00 00 call 3a40 <printf>
exit();
100e: e8 c0 28 00 00 call 38d3 <exit>
1013: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
101a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00001020 <fourfiles>:
{
1020: 55 push %ebp
1021: 89 e5 mov %esp,%ebp
1023: 57 push %edi
1024: 56 push %esi
printf(1, "fourfiles test\n");
1025: be ce 41 00 00 mov $0x41ce,%esi
{
102a: 53 push %ebx
for(pi = 0; pi < 4; pi++){
102b: 31 db xor %ebx,%ebx
{
102d: 83 ec 34 sub $0x34,%esp
char *names[] = { "f0", "f1", "f2", "f3" };
1030: c7 45 d8 ce 41 00 00 movl $0x41ce,-0x28(%ebp)
printf(1, "fourfiles test\n");
1037: 68 d4 41 00 00 push $0x41d4
103c: 6a 01 push $0x1
char *names[] = { "f0", "f1", "f2", "f3" };
103e: c7 45 dc 17 43 00 00 movl $0x4317,-0x24(%ebp)
1045: c7 45 e0 1b 43 00 00 movl $0x431b,-0x20(%ebp)
104c: c7 45 e4 d1 41 00 00 movl $0x41d1,-0x1c(%ebp)
printf(1, "fourfiles test\n");
1053: e8 e8 29 00 00 call 3a40 <printf>
1058: 83 c4 10 add $0x10,%esp
unlink(fname);
105b: 83 ec 0c sub $0xc,%esp
105e: 56 push %esi
105f: e8 bf 28 00 00 call 3923 <unlink>
pid = fork();
1064: e8 62 28 00 00 call 38cb <fork>
if(pid < 0){
1069: 83 c4 10 add $0x10,%esp
106c: 85 c0 test %eax,%eax
106e: 0f 88 64 01 00 00 js 11d8 <fourfiles+0x1b8>
if(pid == 0){
1074: 0f 84 e9 00 00 00 je 1163 <fourfiles+0x143>
for(pi = 0; pi < 4; pi++){
107a: 83 c3 01 add $0x1,%ebx
107d: 83 fb 04 cmp $0x4,%ebx
1080: 74 06 je 1088 <fourfiles+0x68>
fname = names[pi];
1082: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi
1086: eb d3 jmp 105b <fourfiles+0x3b>
wait();
1088: e8 4e 28 00 00 call 38db <wait>
for(i = 0; i < 2; i++){
108d: 31 f6 xor %esi,%esi
wait();
108f: e8 47 28 00 00 call 38db <wait>
1094: e8 42 28 00 00 call 38db <wait>
1099: e8 3d 28 00 00 call 38db <wait>
fname = names[i];
109e: 8b 44 b5 d8 mov -0x28(%ebp,%esi,4),%eax
fd = open(fname, 0);
10a2: 83 ec 08 sub $0x8,%esp
total = 0;
10a5: 31 db xor %ebx,%ebx
fd = open(fname, 0);
10a7: 6a 00 push $0x0
10a9: 50 push %eax
fname = names[i];
10aa: 89 45 d0 mov %eax,-0x30(%ebp)
fd = open(fname, 0);
10ad: e8 61 28 00 00 call 3913 <open>
while((n = read(fd, buf, sizeof(buf))) > 0){
10b2: 83 c4 10 add $0x10,%esp
fd = open(fname, 0);
10b5: 89 45 d4 mov %eax,-0x2c(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
10b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
10bf: 90 nop
10c0: 83 ec 04 sub $0x4,%esp
10c3: 68 00 20 00 00 push $0x2000
10c8: 68 c0 7c 00 00 push $0x7cc0
10cd: ff 75 d4 push -0x2c(%ebp)
10d0: e8 16 28 00 00 call 38eb <read>
10d5: 83 c4 10 add $0x10,%esp
10d8: 89 c7 mov %eax,%edi
10da: 85 c0 test %eax,%eax
10dc: 7e 20 jle 10fe <fourfiles+0xde>
for(j = 0; j < n; j++){
10de: 31 c0 xor %eax,%eax
if(buf[j] != '0'+i){
10e0: 83 fe 01 cmp $0x1,%esi
10e3: 0f be 88 c0 7c 00 00 movsbl 0x7cc0(%eax),%ecx
10ea: 19 d2 sbb %edx,%edx
10ec: 83 c2 31 add $0x31,%edx
10ef: 39 d1 cmp %edx,%ecx
10f1: 75 5c jne 114f <fourfiles+0x12f>
for(j = 0; j < n; j++){
10f3: 83 c0 01 add $0x1,%eax
10f6: 39 c7 cmp %eax,%edi
10f8: 75 e6 jne 10e0 <fourfiles+0xc0>
total += n;
10fa: 01 fb add %edi,%ebx
10fc: eb c2 jmp 10c0 <fourfiles+0xa0>
close(fd);
10fe: 83 ec 0c sub $0xc,%esp
1101: ff 75 d4 push -0x2c(%ebp)
1104: e8 f2 27 00 00 call 38fb <close>
if(total != 12*500){
1109: 83 c4 10 add $0x10,%esp
110c: 81 fb 70 17 00 00 cmp $0x1770,%ebx
1112: 0f 85 d4 00 00 00 jne 11ec <fourfiles+0x1cc>
unlink(fname);
1118: 83 ec 0c sub $0xc,%esp
111b: ff 75 d0 push -0x30(%ebp)
111e: e8 00 28 00 00 call 3923 <unlink>
for(i = 0; i < 2; i++){
1123: 83 c4 10 add $0x10,%esp
1126: 83 fe 01 cmp $0x1,%esi
1129: 75 1a jne 1145 <fourfiles+0x125>
printf(1, "fourfiles ok\n");
112b: 83 ec 08 sub $0x8,%esp
112e: 68 12 42 00 00 push $0x4212
1133: 6a 01 push $0x1
1135: e8 06 29 00 00 call 3a40 <printf>
}
113a: 83 c4 10 add $0x10,%esp
113d: 8d 65 f4 lea -0xc(%ebp),%esp
1140: 5b pop %ebx
1141: 5e pop %esi
1142: 5f pop %edi
1143: 5d pop %ebp
1144: c3 ret
1145: be 01 00 00 00 mov $0x1,%esi
114a: e9 4f ff ff ff jmp 109e <fourfiles+0x7e>
printf(1, "wrong char\n");
114f: 83 ec 08 sub $0x8,%esp
1152: 68 f5 41 00 00 push $0x41f5
1157: 6a 01 push $0x1
1159: e8 e2 28 00 00 call 3a40 <printf>
exit();
115e: e8 70 27 00 00 call 38d3 <exit>
fd = open(fname, O_CREATE | O_RDWR);
1163: 83 ec 08 sub $0x8,%esp
1166: 68 02 02 00 00 push $0x202
116b: 56 push %esi
116c: e8 a2 27 00 00 call 3913 <open>
if(fd < 0){
1171: 83 c4 10 add $0x10,%esp
fd = open(fname, O_CREATE | O_RDWR);
1174: 89 c6 mov %eax,%esi
if(fd < 0){
1176: 85 c0 test %eax,%eax
1178: 78 45 js 11bf <fourfiles+0x19f>
memset(buf, '0'+pi, 512);
117a: 83 ec 04 sub $0x4,%esp
117d: 83 c3 30 add $0x30,%ebx
1180: 68 00 02 00 00 push $0x200
1185: 53 push %ebx
1186: bb 0c 00 00 00 mov $0xc,%ebx
118b: 68 c0 7c 00 00 push $0x7cc0
1190: e8 ab 25 00 00 call 3740 <memset>
1195: 83 c4 10 add $0x10,%esp
if((n = write(fd, buf, 500)) != 500){
1198: 83 ec 04 sub $0x4,%esp
119b: 68 f4 01 00 00 push $0x1f4
11a0: 68 c0 7c 00 00 push $0x7cc0
11a5: 56 push %esi
11a6: e8 48 27 00 00 call 38f3 <write>
11ab: 83 c4 10 add $0x10,%esp
11ae: 3d f4 01 00 00 cmp $0x1f4,%eax
11b3: 75 4a jne 11ff <fourfiles+0x1df>
for(i = 0; i < 12; i++){
11b5: 83 eb 01 sub $0x1,%ebx
11b8: 75 de jne 1198 <fourfiles+0x178>
exit();
11ba: e8 14 27 00 00 call 38d3 <exit>
printf(1, "create failed\n");
11bf: 51 push %ecx
11c0: 51 push %ecx
11c1: 68 6f 44 00 00 push $0x446f
11c6: 6a 01 push $0x1
11c8: e8 73 28 00 00 call 3a40 <printf>
exit();
11cd: e8 01 27 00 00 call 38d3 <exit>
11d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
11d8: 83 ec 08 sub $0x8,%esp
11db: 68 a9 4c 00 00 push $0x4ca9
11e0: 6a 01 push $0x1
11e2: e8 59 28 00 00 call 3a40 <printf>
exit();
11e7: e8 e7 26 00 00 call 38d3 <exit>
printf(1, "wrong length %d\n", total);
11ec: 50 push %eax
11ed: 53 push %ebx
11ee: 68 01 42 00 00 push $0x4201
11f3: 6a 01 push $0x1
11f5: e8 46 28 00 00 call 3a40 <printf>
exit();
11fa: e8 d4 26 00 00 call 38d3 <exit>
printf(1, "write failed %d\n", n);
11ff: 52 push %edx
1200: 50 push %eax
1201: 68 e4 41 00 00 push $0x41e4
1206: 6a 01 push $0x1
1208: e8 33 28 00 00 call 3a40 <printf>
exit();
120d: e8 c1 26 00 00 call 38d3 <exit>
1212: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001220 <createdelete>:
{
1220: 55 push %ebp
1221: 89 e5 mov %esp,%ebp
1223: 57 push %edi
1224: 56 push %esi
1225: 53 push %ebx
for(pi = 0; pi < 4; pi++){
1226: 31 db xor %ebx,%ebx
{
1228: 83 ec 44 sub $0x44,%esp
printf(1, "createdelete test\n");
122b: 68 20 42 00 00 push $0x4220
1230: 6a 01 push $0x1
1232: e8 09 28 00 00 call 3a40 <printf>
1237: 83 c4 10 add $0x10,%esp
pid = fork();
123a: e8 8c 26 00 00 call 38cb <fork>
if(pid < 0){
123f: 85 c0 test %eax,%eax
1241: 0f 88 c3 01 00 00 js 140a <createdelete+0x1ea>
if(pid == 0){
1247: 0f 84 13 01 00 00 je 1360 <createdelete+0x140>
for(pi = 0; pi < 4; pi++){
124d: 83 c3 01 add $0x1,%ebx
1250: 83 fb 04 cmp $0x4,%ebx
1253: 75 e5 jne 123a <createdelete+0x1a>
wait();
1255: e8 81 26 00 00 call 38db <wait>
for(i = 0; i < N; i++){
125a: 31 f6 xor %esi,%esi
125c: 8d 7d c8 lea -0x38(%ebp),%edi
wait();
125f: e8 77 26 00 00 call 38db <wait>
1264: e8 72 26 00 00 call 38db <wait>
1269: e8 6d 26 00 00 call 38db <wait>
name[0] = name[1] = name[2] = 0;
126e: c6 45 ca 00 movb $0x0,-0x36(%ebp)
for(i = 0; i < N; i++){
1272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if((i == 0 || i >= N/2) && fd < 0){
1278: 85 f6 test %esi,%esi
127a: 8d 46 30 lea 0x30(%esi),%eax
127d: 0f 94 c3 sete %bl
1280: 83 fe 09 cmp $0x9,%esi
1283: 88 45 c7 mov %al,-0x39(%ebp)
1286: 0f 9f c0 setg %al
1289: 09 c3 or %eax,%ebx
} else if((i >= 1 && i < N/2) && fd >= 0){
128b: 8d 46 ff lea -0x1(%esi),%eax
128e: 89 45 c0 mov %eax,-0x40(%ebp)
if((i == 0 || i >= N/2) && fd < 0){
1291: 88 5d c6 mov %bl,-0x3a(%ebp)
1294: bb 70 00 00 00 mov $0x70,%ebx
fd = open(name, 0);
1299: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
129c: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
name[0] = 'p' + pi;
12a0: 88 5d c8 mov %bl,-0x38(%ebp)
fd = open(name, 0);
12a3: 6a 00 push $0x0
12a5: 57 push %edi
name[1] = '0' + i;
12a6: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
12a9: e8 65 26 00 00 call 3913 <open>
if((i == 0 || i >= N/2) && fd < 0){
12ae: 83 c4 10 add $0x10,%esp
12b1: 80 7d c6 00 cmpb $0x0,-0x3a(%ebp)
12b5: 0f 84 85 00 00 00 je 1340 <createdelete+0x120>
12bb: 85 c0 test %eax,%eax
12bd: 0f 88 32 01 00 00 js 13f5 <createdelete+0x1d5>
} else if((i >= 1 && i < N/2) && fd >= 0){
12c3: 83 7d c0 08 cmpl $0x8,-0x40(%ebp)
12c7: 76 7b jbe 1344 <createdelete+0x124>
close(fd);
12c9: 83 ec 0c sub $0xc,%esp
12cc: 50 push %eax
12cd: e8 29 26 00 00 call 38fb <close>
12d2: 83 c4 10 add $0x10,%esp
for(pi = 0; pi < 4; pi++){
12d5: 83 c3 01 add $0x1,%ebx
12d8: 80 fb 74 cmp $0x74,%bl
12db: 75 bc jne 1299 <createdelete+0x79>
for(i = 0; i < N; i++){
12dd: 83 c6 01 add $0x1,%esi
12e0: 83 fe 14 cmp $0x14,%esi
12e3: 75 93 jne 1278 <createdelete+0x58>
12e5: be 70 00 00 00 mov $0x70,%esi
12ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(pi = 0; pi < 4; pi++){
12f0: 8d 46 c0 lea -0x40(%esi),%eax
name[0] = 'p' + i;
12f3: bb 04 00 00 00 mov $0x4,%ebx
12f8: 88 45 c7 mov %al,-0x39(%ebp)
unlink(name);
12fb: 83 ec 0c sub $0xc,%esp
name[0] = 'p' + i;
12fe: 89 f0 mov %esi,%eax
unlink(name);
1300: 57 push %edi
name[0] = 'p' + i;
1301: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
1304: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
1308: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
130b: e8 13 26 00 00 call 3923 <unlink>
for(pi = 0; pi < 4; pi++){
1310: 83 c4 10 add $0x10,%esp
1313: 83 eb 01 sub $0x1,%ebx
1316: 75 e3 jne 12fb <createdelete+0xdb>
for(i = 0; i < N; i++){
1318: 83 c6 01 add $0x1,%esi
131b: 89 f0 mov %esi,%eax
131d: 3c 84 cmp $0x84,%al
131f: 75 cf jne 12f0 <createdelete+0xd0>
printf(1, "createdelete ok\n");
1321: 83 ec 08 sub $0x8,%esp
1324: 68 33 42 00 00 push $0x4233
1329: 6a 01 push $0x1
132b: e8 10 27 00 00 call 3a40 <printf>
}
1330: 8d 65 f4 lea -0xc(%ebp),%esp
1333: 5b pop %ebx
1334: 5e pop %esi
1335: 5f pop %edi
1336: 5d pop %ebp
1337: c3 ret
1338: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
133f: 90 nop
} else if((i >= 1 && i < N/2) && fd >= 0){
1340: 85 c0 test %eax,%eax
1342: 78 91 js 12d5 <createdelete+0xb5>
printf(1, "oops createdelete %s did exist\n", name);
1344: 50 push %eax
1345: 57 push %edi
1346: 68 04 4f 00 00 push $0x4f04
134b: 6a 01 push $0x1
134d: e8 ee 26 00 00 call 3a40 <printf>
exit();
1352: e8 7c 25 00 00 call 38d3 <exit>
1357: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
135e: 66 90 xchg %ax,%ax
name[0] = 'p' + pi;
1360: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
1363: c6 45 ca 00 movb $0x0,-0x36(%ebp)
1367: be 01 00 00 00 mov $0x1,%esi
136c: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = 'p' + pi;
136f: 88 5d c8 mov %bl,-0x38(%ebp)
name[2] = '\0';
1372: 31 db xor %ebx,%ebx
1374: eb 15 jmp 138b <createdelete+0x16b>
1376: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
137d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < N; i++){
1380: 83 fe 14 cmp $0x14,%esi
1383: 74 6b je 13f0 <createdelete+0x1d0>
1385: 83 c3 01 add $0x1,%ebx
1388: 83 c6 01 add $0x1,%esi
fd = open(name, O_CREATE | O_RDWR);
138b: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
138e: 8d 43 30 lea 0x30(%ebx),%eax
fd = open(name, O_CREATE | O_RDWR);
1391: 68 02 02 00 00 push $0x202
1396: 57 push %edi
name[1] = '0' + i;
1397: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
139a: e8 74 25 00 00 call 3913 <open>
if(fd < 0){
139f: 83 c4 10 add $0x10,%esp
13a2: 85 c0 test %eax,%eax
13a4: 78 78 js 141e <createdelete+0x1fe>
close(fd);
13a6: 83 ec 0c sub $0xc,%esp
13a9: 50 push %eax
13aa: e8 4c 25 00 00 call 38fb <close>
if(i > 0 && (i % 2 ) == 0){
13af: 83 c4 10 add $0x10,%esp
13b2: 85 db test %ebx,%ebx
13b4: 74 cf je 1385 <createdelete+0x165>
13b6: f6 c3 01 test $0x1,%bl
13b9: 75 c5 jne 1380 <createdelete+0x160>
if(unlink(name) < 0){
13bb: 83 ec 0c sub $0xc,%esp
name[1] = '0' + (i / 2);
13be: 89 d8 mov %ebx,%eax
if(unlink(name) < 0){
13c0: 57 push %edi
name[1] = '0' + (i / 2);
13c1: d1 f8 sar %eax
13c3: 83 c0 30 add $0x30,%eax
13c6: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
13c9: e8 55 25 00 00 call 3923 <unlink>
13ce: 83 c4 10 add $0x10,%esp
13d1: 85 c0 test %eax,%eax
13d3: 79 ab jns 1380 <createdelete+0x160>
printf(1, "unlink failed\n");
13d5: 52 push %edx
13d6: 52 push %edx
13d7: 68 21 3e 00 00 push $0x3e21
13dc: 6a 01 push $0x1
13de: e8 5d 26 00 00 call 3a40 <printf>
exit();
13e3: e8 eb 24 00 00 call 38d3 <exit>
13e8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
13ef: 90 nop
exit();
13f0: e8 de 24 00 00 call 38d3 <exit>
printf(1, "oops createdelete %s didn't exist\n", name);
13f5: 83 ec 04 sub $0x4,%esp
13f8: 57 push %edi
13f9: 68 e0 4e 00 00 push $0x4ee0
13fe: 6a 01 push $0x1
1400: e8 3b 26 00 00 call 3a40 <printf>
exit();
1405: e8 c9 24 00 00 call 38d3 <exit>
printf(1, "fork failed\n");
140a: 83 ec 08 sub $0x8,%esp
140d: 68 a9 4c 00 00 push $0x4ca9
1412: 6a 01 push $0x1
1414: e8 27 26 00 00 call 3a40 <printf>
exit();
1419: e8 b5 24 00 00 call 38d3 <exit>
printf(1, "create failed\n");
141e: 83 ec 08 sub $0x8,%esp
1421: 68 6f 44 00 00 push $0x446f
1426: 6a 01 push $0x1
1428: e8 13 26 00 00 call 3a40 <printf>
exit();
142d: e8 a1 24 00 00 call 38d3 <exit>
1432: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1439: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001440 <unlinkread>:
{
1440: 55 push %ebp
1441: 89 e5 mov %esp,%ebp
1443: 56 push %esi
1444: 53 push %ebx
printf(1, "unlinkread test\n");
1445: 83 ec 08 sub $0x8,%esp
1448: 68 44 42 00 00 push $0x4244
144d: 6a 01 push $0x1
144f: e8 ec 25 00 00 call 3a40 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
1454: 5b pop %ebx
1455: 5e pop %esi
1456: 68 02 02 00 00 push $0x202
145b: 68 55 42 00 00 push $0x4255
1460: e8 ae 24 00 00 call 3913 <open>
if(fd < 0){
1465: 83 c4 10 add $0x10,%esp
1468: 85 c0 test %eax,%eax
146a: 0f 88 e6 00 00 00 js 1556 <unlinkread+0x116>
write(fd, "hello", 5);
1470: 83 ec 04 sub $0x4,%esp
1473: 89 c3 mov %eax,%ebx
1475: 6a 05 push $0x5
1477: 68 7a 42 00 00 push $0x427a
147c: 50 push %eax
147d: e8 71 24 00 00 call 38f3 <write>
close(fd);
1482: 89 1c 24 mov %ebx,(%esp)
1485: e8 71 24 00 00 call 38fb <close>
fd = open("unlinkread", O_RDWR);
148a: 58 pop %eax
148b: 5a pop %edx
148c: 6a 02 push $0x2
148e: 68 55 42 00 00 push $0x4255
1493: e8 7b 24 00 00 call 3913 <open>
if(fd < 0){
1498: 83 c4 10 add $0x10,%esp
fd = open("unlinkread", O_RDWR);
149b: 89 c3 mov %eax,%ebx
if(fd < 0){
149d: 85 c0 test %eax,%eax
149f: 0f 88 10 01 00 00 js 15b5 <unlinkread+0x175>
if(unlink("unlinkread") != 0){
14a5: 83 ec 0c sub $0xc,%esp
14a8: 68 55 42 00 00 push $0x4255
14ad: e8 71 24 00 00 call 3923 <unlink>
14b2: 83 c4 10 add $0x10,%esp
14b5: 85 c0 test %eax,%eax
14b7: 0f 85 e5 00 00 00 jne 15a2 <unlinkread+0x162>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
14bd: 83 ec 08 sub $0x8,%esp
14c0: 68 02 02 00 00 push $0x202
14c5: 68 55 42 00 00 push $0x4255
14ca: e8 44 24 00 00 call 3913 <open>
write(fd1, "yyy", 3);
14cf: 83 c4 0c add $0xc,%esp
14d2: 6a 03 push $0x3
fd1 = open("unlinkread", O_CREATE | O_RDWR);
14d4: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
14d6: 68 b2 42 00 00 push $0x42b2
14db: 50 push %eax
14dc: e8 12 24 00 00 call 38f3 <write>
close(fd1);
14e1: 89 34 24 mov %esi,(%esp)
14e4: e8 12 24 00 00 call 38fb <close>
if(read(fd, buf, sizeof(buf)) != 5){
14e9: 83 c4 0c add $0xc,%esp
14ec: 68 00 20 00 00 push $0x2000
14f1: 68 c0 7c 00 00 push $0x7cc0
14f6: 53 push %ebx
14f7: e8 ef 23 00 00 call 38eb <read>
14fc: 83 c4 10 add $0x10,%esp
14ff: 83 f8 05 cmp $0x5,%eax
1502: 0f 85 87 00 00 00 jne 158f <unlinkread+0x14f>
if(buf[0] != 'h'){
1508: 80 3d c0 7c 00 00 68 cmpb $0x68,0x7cc0
150f: 75 6b jne 157c <unlinkread+0x13c>
if(write(fd, buf, 10) != 10){
1511: 83 ec 04 sub $0x4,%esp
1514: 6a 0a push $0xa
1516: 68 c0 7c 00 00 push $0x7cc0
151b: 53 push %ebx
151c: e8 d2 23 00 00 call 38f3 <write>
1521: 83 c4 10 add $0x10,%esp
1524: 83 f8 0a cmp $0xa,%eax
1527: 75 40 jne 1569 <unlinkread+0x129>
close(fd);
1529: 83 ec 0c sub $0xc,%esp
152c: 53 push %ebx
152d: e8 c9 23 00 00 call 38fb <close>
unlink("unlinkread");
1532: c7 04 24 55 42 00 00 movl $0x4255,(%esp)
1539: e8 e5 23 00 00 call 3923 <unlink>
printf(1, "unlinkread ok\n");
153e: 58 pop %eax
153f: 5a pop %edx
1540: 68 fd 42 00 00 push $0x42fd
1545: 6a 01 push $0x1
1547: e8 f4 24 00 00 call 3a40 <printf>
}
154c: 83 c4 10 add $0x10,%esp
154f: 8d 65 f8 lea -0x8(%ebp),%esp
1552: 5b pop %ebx
1553: 5e pop %esi
1554: 5d pop %ebp
1555: c3 ret
printf(1, "create unlinkread failed\n");
1556: 51 push %ecx
1557: 51 push %ecx
1558: 68 60 42 00 00 push $0x4260
155d: 6a 01 push $0x1
155f: e8 dc 24 00 00 call 3a40 <printf>
exit();
1564: e8 6a 23 00 00 call 38d3 <exit>
printf(1, "unlinkread write failed\n");
1569: 51 push %ecx
156a: 51 push %ecx
156b: 68 e4 42 00 00 push $0x42e4
1570: 6a 01 push $0x1
1572: e8 c9 24 00 00 call 3a40 <printf>
exit();
1577: e8 57 23 00 00 call 38d3 <exit>
printf(1, "unlinkread wrong data\n");
157c: 53 push %ebx
157d: 53 push %ebx
157e: 68 cd 42 00 00 push $0x42cd
1583: 6a 01 push $0x1
1585: e8 b6 24 00 00 call 3a40 <printf>
exit();
158a: e8 44 23 00 00 call 38d3 <exit>
printf(1, "unlinkread read failed");
158f: 56 push %esi
1590: 56 push %esi
1591: 68 b6 42 00 00 push $0x42b6
1596: 6a 01 push $0x1
1598: e8 a3 24 00 00 call 3a40 <printf>
exit();
159d: e8 31 23 00 00 call 38d3 <exit>
printf(1, "unlink unlinkread failed\n");
15a2: 50 push %eax
15a3: 50 push %eax
15a4: 68 98 42 00 00 push $0x4298
15a9: 6a 01 push $0x1
15ab: e8 90 24 00 00 call 3a40 <printf>
exit();
15b0: e8 1e 23 00 00 call 38d3 <exit>
printf(1, "open unlinkread failed\n");
15b5: 50 push %eax
15b6: 50 push %eax
15b7: 68 80 42 00 00 push $0x4280
15bc: 6a 01 push $0x1
15be: e8 7d 24 00 00 call 3a40 <printf>
exit();
15c3: e8 0b 23 00 00 call 38d3 <exit>
15c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
15cf: 90 nop
000015d0 <linktest>:
{
15d0: 55 push %ebp
15d1: 89 e5 mov %esp,%ebp
15d3: 53 push %ebx
15d4: 83 ec 0c sub $0xc,%esp
printf(1, "linktest\n");
15d7: 68 0c 43 00 00 push $0x430c
15dc: 6a 01 push $0x1
15de: e8 5d 24 00 00 call 3a40 <printf>
unlink("lf1");
15e3: c7 04 24 16 43 00 00 movl $0x4316,(%esp)
15ea: e8 34 23 00 00 call 3923 <unlink>
unlink("lf2");
15ef: c7 04 24 1a 43 00 00 movl $0x431a,(%esp)
15f6: e8 28 23 00 00 call 3923 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
15fb: 58 pop %eax
15fc: 5a pop %edx
15fd: 68 02 02 00 00 push $0x202
1602: 68 16 43 00 00 push $0x4316
1607: e8 07 23 00 00 call 3913 <open>
if(fd < 0){
160c: 83 c4 10 add $0x10,%esp
160f: 85 c0 test %eax,%eax
1611: 0f 88 1e 01 00 00 js 1735 <linktest+0x165>
if(write(fd, "hello", 5) != 5){
1617: 83 ec 04 sub $0x4,%esp
161a: 89 c3 mov %eax,%ebx
161c: 6a 05 push $0x5
161e: 68 7a 42 00 00 push $0x427a
1623: 50 push %eax
1624: e8 ca 22 00 00 call 38f3 <write>
1629: 83 c4 10 add $0x10,%esp
162c: 83 f8 05 cmp $0x5,%eax
162f: 0f 85 98 01 00 00 jne 17cd <linktest+0x1fd>
close(fd);
1635: 83 ec 0c sub $0xc,%esp
1638: 53 push %ebx
1639: e8 bd 22 00 00 call 38fb <close>
if(link("lf1", "lf2") < 0){
163e: 5b pop %ebx
163f: 58 pop %eax
1640: 68 1a 43 00 00 push $0x431a
1645: 68 16 43 00 00 push $0x4316
164a: e8 e4 22 00 00 call 3933 <link>
164f: 83 c4 10 add $0x10,%esp
1652: 85 c0 test %eax,%eax
1654: 0f 88 60 01 00 00 js 17ba <linktest+0x1ea>
unlink("lf1");
165a: 83 ec 0c sub $0xc,%esp
165d: 68 16 43 00 00 push $0x4316
1662: e8 bc 22 00 00 call 3923 <unlink>
if(open("lf1", 0) >= 0){
1667: 58 pop %eax
1668: 5a pop %edx
1669: 6a 00 push $0x0
166b: 68 16 43 00 00 push $0x4316
1670: e8 9e 22 00 00 call 3913 <open>
1675: 83 c4 10 add $0x10,%esp
1678: 85 c0 test %eax,%eax
167a: 0f 89 27 01 00 00 jns 17a7 <linktest+0x1d7>
fd = open("lf2", 0);
1680: 83 ec 08 sub $0x8,%esp
1683: 6a 00 push $0x0
1685: 68 1a 43 00 00 push $0x431a
168a: e8 84 22 00 00 call 3913 <open>
if(fd < 0){
168f: 83 c4 10 add $0x10,%esp
fd = open("lf2", 0);
1692: 89 c3 mov %eax,%ebx
if(fd < 0){
1694: 85 c0 test %eax,%eax
1696: 0f 88 f8 00 00 00 js 1794 <linktest+0x1c4>
if(read(fd, buf, sizeof(buf)) != 5){
169c: 83 ec 04 sub $0x4,%esp
169f: 68 00 20 00 00 push $0x2000
16a4: 68 c0 7c 00 00 push $0x7cc0
16a9: 50 push %eax
16aa: e8 3c 22 00 00 call 38eb <read>
16af: 83 c4 10 add $0x10,%esp
16b2: 83 f8 05 cmp $0x5,%eax
16b5: 0f 85 c6 00 00 00 jne 1781 <linktest+0x1b1>
close(fd);
16bb: 83 ec 0c sub $0xc,%esp
16be: 53 push %ebx
16bf: e8 37 22 00 00 call 38fb <close>
if(link("lf2", "lf2") >= 0){
16c4: 58 pop %eax
16c5: 5a pop %edx
16c6: 68 1a 43 00 00 push $0x431a
16cb: 68 1a 43 00 00 push $0x431a
16d0: e8 5e 22 00 00 call 3933 <link>
16d5: 83 c4 10 add $0x10,%esp
16d8: 85 c0 test %eax,%eax
16da: 0f 89 8e 00 00 00 jns 176e <linktest+0x19e>
unlink("lf2");
16e0: 83 ec 0c sub $0xc,%esp
16e3: 68 1a 43 00 00 push $0x431a
16e8: e8 36 22 00 00 call 3923 <unlink>
if(link("lf2", "lf1") >= 0){
16ed: 59 pop %ecx
16ee: 5b pop %ebx
16ef: 68 16 43 00 00 push $0x4316
16f4: 68 1a 43 00 00 push $0x431a
16f9: e8 35 22 00 00 call 3933 <link>
16fe: 83 c4 10 add $0x10,%esp
1701: 85 c0 test %eax,%eax
1703: 79 56 jns 175b <linktest+0x18b>
if(link(".", "lf1") >= 0){
1705: 83 ec 08 sub $0x8,%esp
1708: 68 16 43 00 00 push $0x4316
170d: 68 de 45 00 00 push $0x45de
1712: e8 1c 22 00 00 call 3933 <link>
1717: 83 c4 10 add $0x10,%esp
171a: 85 c0 test %eax,%eax
171c: 79 2a jns 1748 <linktest+0x178>
printf(1, "linktest ok\n");
171e: 83 ec 08 sub $0x8,%esp
1721: 68 b4 43 00 00 push $0x43b4
1726: 6a 01 push $0x1
1728: e8 13 23 00 00 call 3a40 <printf>
}
172d: 8b 5d fc mov -0x4(%ebp),%ebx
1730: 83 c4 10 add $0x10,%esp
1733: c9 leave
1734: c3 ret
printf(1, "create lf1 failed\n");
1735: 50 push %eax
1736: 50 push %eax
1737: 68 1e 43 00 00 push $0x431e
173c: 6a 01 push $0x1
173e: e8 fd 22 00 00 call 3a40 <printf>
exit();
1743: e8 8b 21 00 00 call 38d3 <exit>
printf(1, "link . lf1 succeeded! oops\n");
1748: 50 push %eax
1749: 50 push %eax
174a: 68 98 43 00 00 push $0x4398
174f: 6a 01 push $0x1
1751: e8 ea 22 00 00 call 3a40 <printf>
exit();
1756: e8 78 21 00 00 call 38d3 <exit>
printf(1, "link non-existant succeeded! oops\n");
175b: 52 push %edx
175c: 52 push %edx
175d: 68 4c 4f 00 00 push $0x4f4c
1762: 6a 01 push $0x1
1764: e8 d7 22 00 00 call 3a40 <printf>
exit();
1769: e8 65 21 00 00 call 38d3 <exit>
printf(1, "link lf2 lf2 succeeded! oops\n");
176e: 50 push %eax
176f: 50 push %eax
1770: 68 7a 43 00 00 push $0x437a
1775: 6a 01 push $0x1
1777: e8 c4 22 00 00 call 3a40 <printf>
exit();
177c: e8 52 21 00 00 call 38d3 <exit>
printf(1, "read lf2 failed\n");
1781: 51 push %ecx
1782: 51 push %ecx
1783: 68 69 43 00 00 push $0x4369
1788: 6a 01 push $0x1
178a: e8 b1 22 00 00 call 3a40 <printf>
exit();
178f: e8 3f 21 00 00 call 38d3 <exit>
printf(1, "open lf2 failed\n");
1794: 53 push %ebx
1795: 53 push %ebx
1796: 68 58 43 00 00 push $0x4358
179b: 6a 01 push $0x1
179d: e8 9e 22 00 00 call 3a40 <printf>
exit();
17a2: e8 2c 21 00 00 call 38d3 <exit>
printf(1, "unlinked lf1 but it is still there!\n");
17a7: 50 push %eax
17a8: 50 push %eax
17a9: 68 24 4f 00 00 push $0x4f24
17ae: 6a 01 push $0x1
17b0: e8 8b 22 00 00 call 3a40 <printf>
exit();
17b5: e8 19 21 00 00 call 38d3 <exit>
printf(1, "link lf1 lf2 failed\n");
17ba: 51 push %ecx
17bb: 51 push %ecx
17bc: 68 43 43 00 00 push $0x4343
17c1: 6a 01 push $0x1
17c3: e8 78 22 00 00 call 3a40 <printf>
exit();
17c8: e8 06 21 00 00 call 38d3 <exit>
printf(1, "write lf1 failed\n");
17cd: 50 push %eax
17ce: 50 push %eax
17cf: 68 31 43 00 00 push $0x4331
17d4: 6a 01 push $0x1
17d6: e8 65 22 00 00 call 3a40 <printf>
exit();
17db: e8 f3 20 00 00 call 38d3 <exit>
000017e0 <concreate>:
{
17e0: 55 push %ebp
17e1: 89 e5 mov %esp,%ebp
17e3: 57 push %edi
17e4: 56 push %esi
for(i = 0; i < 40; i++){
17e5: 31 f6 xor %esi,%esi
{
17e7: 53 push %ebx
17e8: 8d 5d ad lea -0x53(%ebp),%ebx
17eb: 83 ec 64 sub $0x64,%esp
printf(1, "concreate test\n");
17ee: 68 c1 43 00 00 push $0x43c1
17f3: 6a 01 push $0x1
17f5: e8 46 22 00 00 call 3a40 <printf>
file[0] = 'C';
17fa: c6 45 ad 43 movb $0x43,-0x53(%ebp)
file[2] = '\0';
17fe: 83 c4 10 add $0x10,%esp
1801: c6 45 af 00 movb $0x0,-0x51(%ebp)
for(i = 0; i < 40; i++){
1805: eb 4c jmp 1853 <concreate+0x73>
1807: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
180e: 66 90 xchg %ax,%ax
1810: 69 c6 ab aa aa aa imul $0xaaaaaaab,%esi,%eax
if(pid && (i % 3) == 1){
1816: 3d ab aa aa aa cmp $0xaaaaaaab,%eax
181b: 0f 83 af 00 00 00 jae 18d0 <concreate+0xf0>
fd = open(file, O_CREATE | O_RDWR);
1821: 83 ec 08 sub $0x8,%esp
1824: 68 02 02 00 00 push $0x202
1829: 53 push %ebx
182a: e8 e4 20 00 00 call 3913 <open>
if(fd < 0){
182f: 83 c4 10 add $0x10,%esp
1832: 85 c0 test %eax,%eax
1834: 78 5f js 1895 <concreate+0xb5>
close(fd);
1836: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1839: 83 c6 01 add $0x1,%esi
close(fd);
183c: 50 push %eax
183d: e8 b9 20 00 00 call 38fb <close>
1842: 83 c4 10 add $0x10,%esp
wait();
1845: e8 91 20 00 00 call 38db <wait>
for(i = 0; i < 40; i++){
184a: 83 fe 28 cmp $0x28,%esi
184d: 0f 84 9f 00 00 00 je 18f2 <concreate+0x112>
unlink(file);
1853: 83 ec 0c sub $0xc,%esp
file[1] = '0' + i;
1856: 8d 46 30 lea 0x30(%esi),%eax
unlink(file);
1859: 53 push %ebx
file[1] = '0' + i;
185a: 88 45 ae mov %al,-0x52(%ebp)
unlink(file);
185d: e8 c1 20 00 00 call 3923 <unlink>
pid = fork();
1862: e8 64 20 00 00 call 38cb <fork>
if(pid && (i % 3) == 1){
1867: 83 c4 10 add $0x10,%esp
186a: 85 c0 test %eax,%eax
186c: 75 a2 jne 1810 <concreate+0x30>
link("C0", file);
186e: 69 f6 cd cc cc cc imul $0xcccccccd,%esi,%esi
} else if(pid == 0 && (i % 5) == 1){
1874: 81 fe cd cc cc cc cmp $0xcccccccd,%esi
187a: 73 34 jae 18b0 <concreate+0xd0>
fd = open(file, O_CREATE | O_RDWR);
187c: 83 ec 08 sub $0x8,%esp
187f: 68 02 02 00 00 push $0x202
1884: 53 push %ebx
1885: e8 89 20 00 00 call 3913 <open>
if(fd < 0){
188a: 83 c4 10 add $0x10,%esp
188d: 85 c0 test %eax,%eax
188f: 0f 89 39 02 00 00 jns 1ace <concreate+0x2ee>
printf(1, "concreate create %s failed\n", file);
1895: 83 ec 04 sub $0x4,%esp
1898: 53 push %ebx
1899: 68 d4 43 00 00 push $0x43d4
189e: 6a 01 push $0x1
18a0: e8 9b 21 00 00 call 3a40 <printf>
exit();
18a5: e8 29 20 00 00 call 38d3 <exit>
18aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
link("C0", file);
18b0: 83 ec 08 sub $0x8,%esp
18b3: 53 push %ebx
18b4: 68 d1 43 00 00 push $0x43d1
18b9: e8 75 20 00 00 call 3933 <link>
18be: 83 c4 10 add $0x10,%esp
exit();
18c1: e8 0d 20 00 00 call 38d3 <exit>
18c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
18cd: 8d 76 00 lea 0x0(%esi),%esi
link("C0", file);
18d0: 83 ec 08 sub $0x8,%esp
for(i = 0; i < 40; i++){
18d3: 83 c6 01 add $0x1,%esi
link("C0", file);
18d6: 53 push %ebx
18d7: 68 d1 43 00 00 push $0x43d1
18dc: e8 52 20 00 00 call 3933 <link>
18e1: 83 c4 10 add $0x10,%esp
wait();
18e4: e8 f2 1f 00 00 call 38db <wait>
for(i = 0; i < 40; i++){
18e9: 83 fe 28 cmp $0x28,%esi
18ec: 0f 85 61 ff ff ff jne 1853 <concreate+0x73>
memset(fa, 0, sizeof(fa));
18f2: 83 ec 04 sub $0x4,%esp
18f5: 8d 45 c0 lea -0x40(%ebp),%eax
18f8: 6a 28 push $0x28
18fa: 6a 00 push $0x0
18fc: 50 push %eax
18fd: e8 3e 1e 00 00 call 3740 <memset>
fd = open(".", 0);
1902: 5e pop %esi
1903: 5f pop %edi
1904: 6a 00 push $0x0
1906: 68 de 45 00 00 push $0x45de
190b: 8d 7d b0 lea -0x50(%ebp),%edi
190e: e8 00 20 00 00 call 3913 <open>
n = 0;
1913: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
while(read(fd, &de, sizeof(de)) > 0){
191a: 83 c4 10 add $0x10,%esp
fd = open(".", 0);
191d: 89 c6 mov %eax,%esi
while(read(fd, &de, sizeof(de)) > 0){
191f: 90 nop
1920: 83 ec 04 sub $0x4,%esp
1923: 6a 10 push $0x10
1925: 57 push %edi
1926: 56 push %esi
1927: e8 bf 1f 00 00 call 38eb <read>
192c: 83 c4 10 add $0x10,%esp
192f: 85 c0 test %eax,%eax
1931: 7e 3d jle 1970 <concreate+0x190>
if(de.inum == 0)
1933: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp)
1938: 74 e6 je 1920 <concreate+0x140>
if(de.name[0] == 'C' && de.name[2] == '\0'){
193a: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp)
193e: 75 e0 jne 1920 <concreate+0x140>
1940: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp)
1944: 75 da jne 1920 <concreate+0x140>
i = de.name[1] - '0';
1946: 0f be 45 b3 movsbl -0x4d(%ebp),%eax
194a: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
194d: 83 f8 27 cmp $0x27,%eax
1950: 0f 87 60 01 00 00 ja 1ab6 <concreate+0x2d6>
if(fa[i]){
1956: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1)
195b: 0f 85 3d 01 00 00 jne 1a9e <concreate+0x2be>
n++;
1961: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
fa[i] = 1;
1965: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1)
n++;
196a: eb b4 jmp 1920 <concreate+0x140>
196c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
close(fd);
1970: 83 ec 0c sub $0xc,%esp
1973: 56 push %esi
1974: e8 82 1f 00 00 call 38fb <close>
if(n != 40){
1979: 83 c4 10 add $0x10,%esp
197c: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
1980: 0f 85 05 01 00 00 jne 1a8b <concreate+0x2ab>
for(i = 0; i < 40; i++){
1986: 31 f6 xor %esi,%esi
1988: eb 4c jmp 19d6 <concreate+0x1f6>
198a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
((i % 3) == 1 && pid != 0)){
1990: 85 ff test %edi,%edi
1992: 74 05 je 1999 <concreate+0x1b9>
1994: 83 f8 01 cmp $0x1,%eax
1997: 74 6c je 1a05 <concreate+0x225>
unlink(file);
1999: 83 ec 0c sub $0xc,%esp
199c: 53 push %ebx
199d: e8 81 1f 00 00 call 3923 <unlink>
unlink(file);
19a2: 89 1c 24 mov %ebx,(%esp)
19a5: e8 79 1f 00 00 call 3923 <unlink>
unlink(file);
19aa: 89 1c 24 mov %ebx,(%esp)
19ad: e8 71 1f 00 00 call 3923 <unlink>
unlink(file);
19b2: 89 1c 24 mov %ebx,(%esp)
19b5: e8 69 1f 00 00 call 3923 <unlink>
19ba: 83 c4 10 add $0x10,%esp
if(pid == 0)
19bd: 85 ff test %edi,%edi
19bf: 0f 84 fc fe ff ff je 18c1 <concreate+0xe1>
wait();
19c5: e8 11 1f 00 00 call 38db <wait>
for(i = 0; i < 40; i++){
19ca: 83 c6 01 add $0x1,%esi
19cd: 83 fe 28 cmp $0x28,%esi
19d0: 0f 84 8a 00 00 00 je 1a60 <concreate+0x280>
file[1] = '0' + i;
19d6: 8d 46 30 lea 0x30(%esi),%eax
19d9: 88 45 ae mov %al,-0x52(%ebp)
pid = fork();
19dc: e8 ea 1e 00 00 call 38cb <fork>
19e1: 89 c7 mov %eax,%edi
if(pid < 0){
19e3: 85 c0 test %eax,%eax
19e5: 0f 88 8c 00 00 00 js 1a77 <concreate+0x297>
if(((i % 3) == 0 && pid == 0) ||
19eb: b8 ab aa aa aa mov $0xaaaaaaab,%eax
19f0: f7 e6 mul %esi
19f2: 89 d0 mov %edx,%eax
19f4: 83 e2 fe and $0xfffffffe,%edx
19f7: d1 e8 shr %eax
19f9: 01 c2 add %eax,%edx
19fb: 89 f0 mov %esi,%eax
19fd: 29 d0 sub %edx,%eax
19ff: 89 c1 mov %eax,%ecx
1a01: 09 f9 or %edi,%ecx
1a03: 75 8b jne 1990 <concreate+0x1b0>
close(open(file, 0));
1a05: 83 ec 08 sub $0x8,%esp
1a08: 6a 00 push $0x0
1a0a: 53 push %ebx
1a0b: e8 03 1f 00 00 call 3913 <open>
1a10: 89 04 24 mov %eax,(%esp)
1a13: e8 e3 1e 00 00 call 38fb <close>
close(open(file, 0));
1a18: 58 pop %eax
1a19: 5a pop %edx
1a1a: 6a 00 push $0x0
1a1c: 53 push %ebx
1a1d: e8 f1 1e 00 00 call 3913 <open>
1a22: 89 04 24 mov %eax,(%esp)
1a25: e8 d1 1e 00 00 call 38fb <close>
close(open(file, 0));
1a2a: 59 pop %ecx
1a2b: 58 pop %eax
1a2c: 6a 00 push $0x0
1a2e: 53 push %ebx
1a2f: e8 df 1e 00 00 call 3913 <open>
1a34: 89 04 24 mov %eax,(%esp)
1a37: e8 bf 1e 00 00 call 38fb <close>
close(open(file, 0));
1a3c: 58 pop %eax
1a3d: 5a pop %edx
1a3e: 6a 00 push $0x0
1a40: 53 push %ebx
1a41: e8 cd 1e 00 00 call 3913 <open>
1a46: 89 04 24 mov %eax,(%esp)
1a49: e8 ad 1e 00 00 call 38fb <close>
1a4e: 83 c4 10 add $0x10,%esp
1a51: e9 67 ff ff ff jmp 19bd <concreate+0x1dd>
1a56: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1a5d: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "concreate ok\n");
1a60: 83 ec 08 sub $0x8,%esp
1a63: 68 26 44 00 00 push $0x4426
1a68: 6a 01 push $0x1
1a6a: e8 d1 1f 00 00 call 3a40 <printf>
}
1a6f: 8d 65 f4 lea -0xc(%ebp),%esp
1a72: 5b pop %ebx
1a73: 5e pop %esi
1a74: 5f pop %edi
1a75: 5d pop %ebp
1a76: c3 ret
printf(1, "fork failed\n");
1a77: 83 ec 08 sub $0x8,%esp
1a7a: 68 a9 4c 00 00 push $0x4ca9
1a7f: 6a 01 push $0x1
1a81: e8 ba 1f 00 00 call 3a40 <printf>
exit();
1a86: e8 48 1e 00 00 call 38d3 <exit>
printf(1, "concreate not enough files in directory listing\n");
1a8b: 51 push %ecx
1a8c: 51 push %ecx
1a8d: 68 70 4f 00 00 push $0x4f70
1a92: 6a 01 push $0x1
1a94: e8 a7 1f 00 00 call 3a40 <printf>
exit();
1a99: e8 35 1e 00 00 call 38d3 <exit>
printf(1, "concreate duplicate file %s\n", de.name);
1a9e: 83 ec 04 sub $0x4,%esp
1aa1: 8d 45 b2 lea -0x4e(%ebp),%eax
1aa4: 50 push %eax
1aa5: 68 09 44 00 00 push $0x4409
1aaa: 6a 01 push $0x1
1aac: e8 8f 1f 00 00 call 3a40 <printf>
exit();
1ab1: e8 1d 1e 00 00 call 38d3 <exit>
printf(1, "concreate weird file %s\n", de.name);
1ab6: 83 ec 04 sub $0x4,%esp
1ab9: 8d 45 b2 lea -0x4e(%ebp),%eax
1abc: 50 push %eax
1abd: 68 f0 43 00 00 push $0x43f0
1ac2: 6a 01 push $0x1
1ac4: e8 77 1f 00 00 call 3a40 <printf>
exit();
1ac9: e8 05 1e 00 00 call 38d3 <exit>
close(fd);
1ace: 83 ec 0c sub $0xc,%esp
1ad1: 50 push %eax
1ad2: e8 24 1e 00 00 call 38fb <close>
1ad7: 83 c4 10 add $0x10,%esp
1ada: e9 e2 fd ff ff jmp 18c1 <concreate+0xe1>
1adf: 90 nop
00001ae0 <linkunlink>:
{
1ae0: 55 push %ebp
1ae1: 89 e5 mov %esp,%ebp
1ae3: 57 push %edi
1ae4: 56 push %esi
1ae5: 53 push %ebx
1ae6: 83 ec 24 sub $0x24,%esp
printf(1, "linkunlink test\n");
1ae9: 68 34 44 00 00 push $0x4434
1aee: 6a 01 push $0x1
1af0: e8 4b 1f 00 00 call 3a40 <printf>
unlink("x");
1af5: c7 04 24 c1 46 00 00 movl $0x46c1,(%esp)
1afc: e8 22 1e 00 00 call 3923 <unlink>
pid = fork();
1b01: e8 c5 1d 00 00 call 38cb <fork>
if(pid < 0){
1b06: 83 c4 10 add $0x10,%esp
pid = fork();
1b09: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1b0c: 85 c0 test %eax,%eax
1b0e: 0f 88 b6 00 00 00 js 1bca <linkunlink+0xea>
unsigned int x = (pid ? 1 : 97);
1b14: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
1b18: bb 64 00 00 00 mov $0x64,%ebx
if((x % 3) == 0){
1b1d: be ab aa aa aa mov $0xaaaaaaab,%esi
unsigned int x = (pid ? 1 : 97);
1b22: 19 ff sbb %edi,%edi
1b24: 83 e7 60 and $0x60,%edi
1b27: 83 c7 01 add $0x1,%edi
1b2a: eb 1e jmp 1b4a <linkunlink+0x6a>
1b2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if((x % 3) == 1){
1b30: 83 f8 01 cmp $0x1,%eax
1b33: 74 7b je 1bb0 <linkunlink+0xd0>
unlink("x");
1b35: 83 ec 0c sub $0xc,%esp
1b38: 68 c1 46 00 00 push $0x46c1
1b3d: e8 e1 1d 00 00 call 3923 <unlink>
1b42: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1b45: 83 eb 01 sub $0x1,%ebx
1b48: 74 41 je 1b8b <linkunlink+0xab>
x = x * 1103515245 + 12345;
1b4a: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx
1b50: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi
if((x % 3) == 0){
1b56: 89 f8 mov %edi,%eax
1b58: f7 e6 mul %esi
1b5a: 89 d0 mov %edx,%eax
1b5c: 83 e2 fe and $0xfffffffe,%edx
1b5f: d1 e8 shr %eax
1b61: 01 c2 add %eax,%edx
1b63: 89 f8 mov %edi,%eax
1b65: 29 d0 sub %edx,%eax
1b67: 75 c7 jne 1b30 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1b69: 83 ec 08 sub $0x8,%esp
1b6c: 68 02 02 00 00 push $0x202
1b71: 68 c1 46 00 00 push $0x46c1
1b76: e8 98 1d 00 00 call 3913 <open>
1b7b: 89 04 24 mov %eax,(%esp)
1b7e: e8 78 1d 00 00 call 38fb <close>
1b83: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1b86: 83 eb 01 sub $0x1,%ebx
1b89: 75 bf jne 1b4a <linkunlink+0x6a>
if(pid)
1b8b: 8b 45 e4 mov -0x1c(%ebp),%eax
1b8e: 85 c0 test %eax,%eax
1b90: 74 4b je 1bdd <linkunlink+0xfd>
wait();
1b92: e8 44 1d 00 00 call 38db <wait>
printf(1, "linkunlink ok\n");
1b97: 83 ec 08 sub $0x8,%esp
1b9a: 68 49 44 00 00 push $0x4449
1b9f: 6a 01 push $0x1
1ba1: e8 9a 1e 00 00 call 3a40 <printf>
}
1ba6: 8d 65 f4 lea -0xc(%ebp),%esp
1ba9: 5b pop %ebx
1baa: 5e pop %esi
1bab: 5f pop %edi
1bac: 5d pop %ebp
1bad: c3 ret
1bae: 66 90 xchg %ax,%ax
link("cat", "x");
1bb0: 83 ec 08 sub $0x8,%esp
1bb3: 68 c1 46 00 00 push $0x46c1
1bb8: 68 45 44 00 00 push $0x4445
1bbd: e8 71 1d 00 00 call 3933 <link>
1bc2: 83 c4 10 add $0x10,%esp
1bc5: e9 7b ff ff ff jmp 1b45 <linkunlink+0x65>
printf(1, "fork failed\n");
1bca: 52 push %edx
1bcb: 52 push %edx
1bcc: 68 a9 4c 00 00 push $0x4ca9
1bd1: 6a 01 push $0x1
1bd3: e8 68 1e 00 00 call 3a40 <printf>
exit();
1bd8: e8 f6 1c 00 00 call 38d3 <exit>
exit();
1bdd: e8 f1 1c 00 00 call 38d3 <exit>
1be2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1be9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001bf0 <bigdir>:
{
1bf0: 55 push %ebp
1bf1: 89 e5 mov %esp,%ebp
1bf3: 57 push %edi
1bf4: 56 push %esi
1bf5: 53 push %ebx
1bf6: 83 ec 24 sub $0x24,%esp
printf(1, "bigdir test\n");
1bf9: 68 58 44 00 00 push $0x4458
1bfe: 6a 01 push $0x1
1c00: e8 3b 1e 00 00 call 3a40 <printf>
unlink("bd");
1c05: c7 04 24 65 44 00 00 movl $0x4465,(%esp)
1c0c: e8 12 1d 00 00 call 3923 <unlink>
fd = open("bd", O_CREATE);
1c11: 5a pop %edx
1c12: 59 pop %ecx
1c13: 68 00 02 00 00 push $0x200
1c18: 68 65 44 00 00 push $0x4465
1c1d: e8 f1 1c 00 00 call 3913 <open>
if(fd < 0){
1c22: 83 c4 10 add $0x10,%esp
1c25: 85 c0 test %eax,%eax
1c27: 0f 88 de 00 00 00 js 1d0b <bigdir+0x11b>
close(fd);
1c2d: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 500; i++){
1c30: 31 f6 xor %esi,%esi
1c32: 8d 7d de lea -0x22(%ebp),%edi
close(fd);
1c35: 50 push %eax
1c36: e8 c0 1c 00 00 call 38fb <close>
1c3b: 83 c4 10 add $0x10,%esp
1c3e: 66 90 xchg %ax,%ax
name[1] = '0' + (i / 64);
1c40: 89 f0 mov %esi,%eax
if(link("bd", name) != 0){
1c42: 83 ec 08 sub $0x8,%esp
name[0] = 'x';
1c45: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1c49: c1 f8 06 sar $0x6,%eax
if(link("bd", name) != 0){
1c4c: 57 push %edi
name[1] = '0' + (i / 64);
1c4d: 83 c0 30 add $0x30,%eax
if(link("bd", name) != 0){
1c50: 68 65 44 00 00 push $0x4465
name[1] = '0' + (i / 64);
1c55: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1c58: 89 f0 mov %esi,%eax
1c5a: 83 e0 3f and $0x3f,%eax
name[3] = '\0';
1c5d: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[2] = '0' + (i % 64);
1c61: 83 c0 30 add $0x30,%eax
1c64: 88 45 e0 mov %al,-0x20(%ebp)
if(link("bd", name) != 0){
1c67: e8 c7 1c 00 00 call 3933 <link>
1c6c: 83 c4 10 add $0x10,%esp
1c6f: 89 c3 mov %eax,%ebx
1c71: 85 c0 test %eax,%eax
1c73: 75 6e jne 1ce3 <bigdir+0xf3>
for(i = 0; i < 500; i++){
1c75: 83 c6 01 add $0x1,%esi
1c78: 81 fe f4 01 00 00 cmp $0x1f4,%esi
1c7e: 75 c0 jne 1c40 <bigdir+0x50>
unlink("bd");
1c80: 83 ec 0c sub $0xc,%esp
1c83: 68 65 44 00 00 push $0x4465
1c88: e8 96 1c 00 00 call 3923 <unlink>
1c8d: 83 c4 10 add $0x10,%esp
name[1] = '0' + (i / 64);
1c90: 89 d8 mov %ebx,%eax
if(unlink(name) != 0){
1c92: 83 ec 0c sub $0xc,%esp
name[0] = 'x';
1c95: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1c99: c1 f8 06 sar $0x6,%eax
if(unlink(name) != 0){
1c9c: 57 push %edi
name[1] = '0' + (i / 64);
1c9d: 83 c0 30 add $0x30,%eax
name[3] = '\0';
1ca0: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1ca4: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1ca7: 89 d8 mov %ebx,%eax
1ca9: 83 e0 3f and $0x3f,%eax
1cac: 83 c0 30 add $0x30,%eax
1caf: 88 45 e0 mov %al,-0x20(%ebp)
if(unlink(name) != 0){
1cb2: e8 6c 1c 00 00 call 3923 <unlink>
1cb7: 83 c4 10 add $0x10,%esp
1cba: 85 c0 test %eax,%eax
1cbc: 75 39 jne 1cf7 <bigdir+0x107>
for(i = 0; i < 500; i++){
1cbe: 83 c3 01 add $0x1,%ebx
1cc1: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1cc7: 75 c7 jne 1c90 <bigdir+0xa0>
printf(1, "bigdir ok\n");
1cc9: 83 ec 08 sub $0x8,%esp
1ccc: 68 a7 44 00 00 push $0x44a7
1cd1: 6a 01 push $0x1
1cd3: e8 68 1d 00 00 call 3a40 <printf>
1cd8: 83 c4 10 add $0x10,%esp
}
1cdb: 8d 65 f4 lea -0xc(%ebp),%esp
1cde: 5b pop %ebx
1cdf: 5e pop %esi
1ce0: 5f pop %edi
1ce1: 5d pop %ebp
1ce2: c3 ret
printf(1, "bigdir link failed\n");
1ce3: 83 ec 08 sub $0x8,%esp
1ce6: 68 7e 44 00 00 push $0x447e
1ceb: 6a 01 push $0x1
1ced: e8 4e 1d 00 00 call 3a40 <printf>
exit();
1cf2: e8 dc 1b 00 00 call 38d3 <exit>
printf(1, "bigdir unlink failed");
1cf7: 83 ec 08 sub $0x8,%esp
1cfa: 68 92 44 00 00 push $0x4492
1cff: 6a 01 push $0x1
1d01: e8 3a 1d 00 00 call 3a40 <printf>
exit();
1d06: e8 c8 1b 00 00 call 38d3 <exit>
printf(1, "bigdir create failed\n");
1d0b: 50 push %eax
1d0c: 50 push %eax
1d0d: 68 68 44 00 00 push $0x4468
1d12: 6a 01 push $0x1
1d14: e8 27 1d 00 00 call 3a40 <printf>
exit();
1d19: e8 b5 1b 00 00 call 38d3 <exit>
1d1e: 66 90 xchg %ax,%ax
00001d20 <subdir>:
{
1d20: 55 push %ebp
1d21: 89 e5 mov %esp,%ebp
1d23: 53 push %ebx
1d24: 83 ec 0c sub $0xc,%esp
printf(1, "subdir test\n");
1d27: 68 b2 44 00 00 push $0x44b2
1d2c: 6a 01 push $0x1
1d2e: e8 0d 1d 00 00 call 3a40 <printf>
unlink("ff");
1d33: c7 04 24 3b 45 00 00 movl $0x453b,(%esp)
1d3a: e8 e4 1b 00 00 call 3923 <unlink>
if(mkdir("dd") != 0){
1d3f: c7 04 24 d8 45 00 00 movl $0x45d8,(%esp)
1d46: e8 f0 1b 00 00 call 393b <mkdir>
1d4b: 83 c4 10 add $0x10,%esp
1d4e: 85 c0 test %eax,%eax
1d50: 0f 85 b3 05 00 00 jne 2309 <subdir+0x5e9>
fd = open("dd/ff", O_CREATE | O_RDWR);
1d56: 83 ec 08 sub $0x8,%esp
1d59: 68 02 02 00 00 push $0x202
1d5e: 68 11 45 00 00 push $0x4511
1d63: e8 ab 1b 00 00 call 3913 <open>
if(fd < 0){
1d68: 83 c4 10 add $0x10,%esp
fd = open("dd/ff", O_CREATE | O_RDWR);
1d6b: 89 c3 mov %eax,%ebx
if(fd < 0){
1d6d: 85 c0 test %eax,%eax
1d6f: 0f 88 81 05 00 00 js 22f6 <subdir+0x5d6>
write(fd, "ff", 2);
1d75: 83 ec 04 sub $0x4,%esp
1d78: 6a 02 push $0x2
1d7a: 68 3b 45 00 00 push $0x453b
1d7f: 50 push %eax
1d80: e8 6e 1b 00 00 call 38f3 <write>
close(fd);
1d85: 89 1c 24 mov %ebx,(%esp)
1d88: e8 6e 1b 00 00 call 38fb <close>
if(unlink("dd") >= 0){
1d8d: c7 04 24 d8 45 00 00 movl $0x45d8,(%esp)
1d94: e8 8a 1b 00 00 call 3923 <unlink>
1d99: 83 c4 10 add $0x10,%esp
1d9c: 85 c0 test %eax,%eax
1d9e: 0f 89 3f 05 00 00 jns 22e3 <subdir+0x5c3>
if(mkdir("/dd/dd") != 0){
1da4: 83 ec 0c sub $0xc,%esp
1da7: 68 ec 44 00 00 push $0x44ec
1dac: e8 8a 1b 00 00 call 393b <mkdir>
1db1: 83 c4 10 add $0x10,%esp
1db4: 85 c0 test %eax,%eax
1db6: 0f 85 14 05 00 00 jne 22d0 <subdir+0x5b0>
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
1dbc: 83 ec 08 sub $0x8,%esp
1dbf: 68 02 02 00 00 push $0x202
1dc4: 68 0e 45 00 00 push $0x450e
1dc9: e8 45 1b 00 00 call 3913 <open>
if(fd < 0){
1dce: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
1dd1: 89 c3 mov %eax,%ebx
if(fd < 0){
1dd3: 85 c0 test %eax,%eax
1dd5: 0f 88 24 04 00 00 js 21ff <subdir+0x4df>
write(fd, "FF", 2);
1ddb: 83 ec 04 sub $0x4,%esp
1dde: 6a 02 push $0x2
1de0: 68 2f 45 00 00 push $0x452f
1de5: 50 push %eax
1de6: e8 08 1b 00 00 call 38f3 <write>
close(fd);
1deb: 89 1c 24 mov %ebx,(%esp)
1dee: e8 08 1b 00 00 call 38fb <close>
fd = open("dd/dd/../ff", 0);
1df3: 58 pop %eax
1df4: 5a pop %edx
1df5: 6a 00 push $0x0
1df7: 68 32 45 00 00 push $0x4532
1dfc: e8 12 1b 00 00 call 3913 <open>
if(fd < 0){
1e01: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/../ff", 0);
1e04: 89 c3 mov %eax,%ebx
if(fd < 0){
1e06: 85 c0 test %eax,%eax
1e08: 0f 88 de 03 00 00 js 21ec <subdir+0x4cc>
cc = read(fd, buf, sizeof(buf));
1e0e: 83 ec 04 sub $0x4,%esp
1e11: 68 00 20 00 00 push $0x2000
1e16: 68 c0 7c 00 00 push $0x7cc0
1e1b: 50 push %eax
1e1c: e8 ca 1a 00 00 call 38eb <read>
if(cc != 2 || buf[0] != 'f'){
1e21: 83 c4 10 add $0x10,%esp
1e24: 83 f8 02 cmp $0x2,%eax
1e27: 0f 85 3a 03 00 00 jne 2167 <subdir+0x447>
1e2d: 80 3d c0 7c 00 00 66 cmpb $0x66,0x7cc0
1e34: 0f 85 2d 03 00 00 jne 2167 <subdir+0x447>
close(fd);
1e3a: 83 ec 0c sub $0xc,%esp
1e3d: 53 push %ebx
1e3e: e8 b8 1a 00 00 call 38fb <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
1e43: 59 pop %ecx
1e44: 5b pop %ebx
1e45: 68 72 45 00 00 push $0x4572
1e4a: 68 0e 45 00 00 push $0x450e
1e4f: e8 df 1a 00 00 call 3933 <link>
1e54: 83 c4 10 add $0x10,%esp
1e57: 85 c0 test %eax,%eax
1e59: 0f 85 c6 03 00 00 jne 2225 <subdir+0x505>
if(unlink("dd/dd/ff") != 0){
1e5f: 83 ec 0c sub $0xc,%esp
1e62: 68 0e 45 00 00 push $0x450e
1e67: e8 b7 1a 00 00 call 3923 <unlink>
1e6c: 83 c4 10 add $0x10,%esp
1e6f: 85 c0 test %eax,%eax
1e71: 0f 85 16 03 00 00 jne 218d <subdir+0x46d>
if(open("dd/dd/ff", O_RDONLY) >= 0){
1e77: 83 ec 08 sub $0x8,%esp
1e7a: 6a 00 push $0x0
1e7c: 68 0e 45 00 00 push $0x450e
1e81: e8 8d 1a 00 00 call 3913 <open>
1e86: 83 c4 10 add $0x10,%esp
1e89: 85 c0 test %eax,%eax
1e8b: 0f 89 2c 04 00 00 jns 22bd <subdir+0x59d>
if(chdir("dd") != 0){
1e91: 83 ec 0c sub $0xc,%esp
1e94: 68 d8 45 00 00 push $0x45d8
1e99: e8 a5 1a 00 00 call 3943 <chdir>
1e9e: 83 c4 10 add $0x10,%esp
1ea1: 85 c0 test %eax,%eax
1ea3: 0f 85 01 04 00 00 jne 22aa <subdir+0x58a>
if(chdir("dd/../../dd") != 0){
1ea9: 83 ec 0c sub $0xc,%esp
1eac: 68 a6 45 00 00 push $0x45a6
1eb1: e8 8d 1a 00 00 call 3943 <chdir>
1eb6: 83 c4 10 add $0x10,%esp
1eb9: 85 c0 test %eax,%eax
1ebb: 0f 85 b9 02 00 00 jne 217a <subdir+0x45a>
if(chdir("dd/../../../dd") != 0){
1ec1: 83 ec 0c sub $0xc,%esp
1ec4: 68 cc 45 00 00 push $0x45cc
1ec9: e8 75 1a 00 00 call 3943 <chdir>
1ece: 83 c4 10 add $0x10,%esp
1ed1: 85 c0 test %eax,%eax
1ed3: 0f 85 a1 02 00 00 jne 217a <subdir+0x45a>
if(chdir("./..") != 0){
1ed9: 83 ec 0c sub $0xc,%esp
1edc: 68 db 45 00 00 push $0x45db
1ee1: e8 5d 1a 00 00 call 3943 <chdir>
1ee6: 83 c4 10 add $0x10,%esp
1ee9: 85 c0 test %eax,%eax
1eeb: 0f 85 21 03 00 00 jne 2212 <subdir+0x4f2>
fd = open("dd/dd/ffff", 0);
1ef1: 83 ec 08 sub $0x8,%esp
1ef4: 6a 00 push $0x0
1ef6: 68 72 45 00 00 push $0x4572
1efb: e8 13 1a 00 00 call 3913 <open>
if(fd < 0){
1f00: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/ffff", 0);
1f03: 89 c3 mov %eax,%ebx
if(fd < 0){
1f05: 85 c0 test %eax,%eax
1f07: 0f 88 e0 04 00 00 js 23ed <subdir+0x6cd>
if(read(fd, buf, sizeof(buf)) != 2){
1f0d: 83 ec 04 sub $0x4,%esp
1f10: 68 00 20 00 00 push $0x2000
1f15: 68 c0 7c 00 00 push $0x7cc0
1f1a: 50 push %eax
1f1b: e8 cb 19 00 00 call 38eb <read>
1f20: 83 c4 10 add $0x10,%esp
1f23: 83 f8 02 cmp $0x2,%eax
1f26: 0f 85 ae 04 00 00 jne 23da <subdir+0x6ba>
close(fd);
1f2c: 83 ec 0c sub $0xc,%esp
1f2f: 53 push %ebx
1f30: e8 c6 19 00 00 call 38fb <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
1f35: 58 pop %eax
1f36: 5a pop %edx
1f37: 6a 00 push $0x0
1f39: 68 0e 45 00 00 push $0x450e
1f3e: e8 d0 19 00 00 call 3913 <open>
1f43: 83 c4 10 add $0x10,%esp
1f46: 85 c0 test %eax,%eax
1f48: 0f 89 65 02 00 00 jns 21b3 <subdir+0x493>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
1f4e: 83 ec 08 sub $0x8,%esp
1f51: 68 02 02 00 00 push $0x202
1f56: 68 26 46 00 00 push $0x4626
1f5b: e8 b3 19 00 00 call 3913 <open>
1f60: 83 c4 10 add $0x10,%esp
1f63: 85 c0 test %eax,%eax
1f65: 0f 89 35 02 00 00 jns 21a0 <subdir+0x480>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
1f6b: 83 ec 08 sub $0x8,%esp
1f6e: 68 02 02 00 00 push $0x202
1f73: 68 4b 46 00 00 push $0x464b
1f78: e8 96 19 00 00 call 3913 <open>
1f7d: 83 c4 10 add $0x10,%esp
1f80: 85 c0 test %eax,%eax
1f82: 0f 89 0f 03 00 00 jns 2297 <subdir+0x577>
if(open("dd", O_CREATE) >= 0){
1f88: 83 ec 08 sub $0x8,%esp
1f8b: 68 00 02 00 00 push $0x200
1f90: 68 d8 45 00 00 push $0x45d8
1f95: e8 79 19 00 00 call 3913 <open>
1f9a: 83 c4 10 add $0x10,%esp
1f9d: 85 c0 test %eax,%eax
1f9f: 0f 89 df 02 00 00 jns 2284 <subdir+0x564>
if(open("dd", O_RDWR) >= 0){
1fa5: 83 ec 08 sub $0x8,%esp
1fa8: 6a 02 push $0x2
1faa: 68 d8 45 00 00 push $0x45d8
1faf: e8 5f 19 00 00 call 3913 <open>
1fb4: 83 c4 10 add $0x10,%esp
1fb7: 85 c0 test %eax,%eax
1fb9: 0f 89 b2 02 00 00 jns 2271 <subdir+0x551>
if(open("dd", O_WRONLY) >= 0){
1fbf: 83 ec 08 sub $0x8,%esp
1fc2: 6a 01 push $0x1
1fc4: 68 d8 45 00 00 push $0x45d8
1fc9: e8 45 19 00 00 call 3913 <open>
1fce: 83 c4 10 add $0x10,%esp
1fd1: 85 c0 test %eax,%eax
1fd3: 0f 89 85 02 00 00 jns 225e <subdir+0x53e>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
1fd9: 83 ec 08 sub $0x8,%esp
1fdc: 68 ba 46 00 00 push $0x46ba
1fe1: 68 26 46 00 00 push $0x4626
1fe6: e8 48 19 00 00 call 3933 <link>
1feb: 83 c4 10 add $0x10,%esp
1fee: 85 c0 test %eax,%eax
1ff0: 0f 84 55 02 00 00 je 224b <subdir+0x52b>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
1ff6: 83 ec 08 sub $0x8,%esp
1ff9: 68 ba 46 00 00 push $0x46ba
1ffe: 68 4b 46 00 00 push $0x464b
2003: e8 2b 19 00 00 call 3933 <link>
2008: 83 c4 10 add $0x10,%esp
200b: 85 c0 test %eax,%eax
200d: 0f 84 25 02 00 00 je 2238 <subdir+0x518>
if(link("dd/ff", "dd/dd/ffff") == 0){
2013: 83 ec 08 sub $0x8,%esp
2016: 68 72 45 00 00 push $0x4572
201b: 68 11 45 00 00 push $0x4511
2020: e8 0e 19 00 00 call 3933 <link>
2025: 83 c4 10 add $0x10,%esp
2028: 85 c0 test %eax,%eax
202a: 0f 84 a9 01 00 00 je 21d9 <subdir+0x4b9>
if(mkdir("dd/ff/ff") == 0){
2030: 83 ec 0c sub $0xc,%esp
2033: 68 26 46 00 00 push $0x4626
2038: e8 fe 18 00 00 call 393b <mkdir>
203d: 83 c4 10 add $0x10,%esp
2040: 85 c0 test %eax,%eax
2042: 0f 84 7e 01 00 00 je 21c6 <subdir+0x4a6>
if(mkdir("dd/xx/ff") == 0){
2048: 83 ec 0c sub $0xc,%esp
204b: 68 4b 46 00 00 push $0x464b
2050: e8 e6 18 00 00 call 393b <mkdir>
2055: 83 c4 10 add $0x10,%esp
2058: 85 c0 test %eax,%eax
205a: 0f 84 67 03 00 00 je 23c7 <subdir+0x6a7>
if(mkdir("dd/dd/ffff") == 0){
2060: 83 ec 0c sub $0xc,%esp
2063: 68 72 45 00 00 push $0x4572
2068: e8 ce 18 00 00 call 393b <mkdir>
206d: 83 c4 10 add $0x10,%esp
2070: 85 c0 test %eax,%eax
2072: 0f 84 3c 03 00 00 je 23b4 <subdir+0x694>
if(unlink("dd/xx/ff") == 0){
2078: 83 ec 0c sub $0xc,%esp
207b: 68 4b 46 00 00 push $0x464b
2080: e8 9e 18 00 00 call 3923 <unlink>
2085: 83 c4 10 add $0x10,%esp
2088: 85 c0 test %eax,%eax
208a: 0f 84 11 03 00 00 je 23a1 <subdir+0x681>
if(unlink("dd/ff/ff") == 0){
2090: 83 ec 0c sub $0xc,%esp
2093: 68 26 46 00 00 push $0x4626
2098: e8 86 18 00 00 call 3923 <unlink>
209d: 83 c4 10 add $0x10,%esp
20a0: 85 c0 test %eax,%eax
20a2: 0f 84 e6 02 00 00 je 238e <subdir+0x66e>
if(chdir("dd/ff") == 0){
20a8: 83 ec 0c sub $0xc,%esp
20ab: 68 11 45 00 00 push $0x4511
20b0: e8 8e 18 00 00 call 3943 <chdir>
20b5: 83 c4 10 add $0x10,%esp
20b8: 85 c0 test %eax,%eax
20ba: 0f 84 bb 02 00 00 je 237b <subdir+0x65b>
if(chdir("dd/xx") == 0){
20c0: 83 ec 0c sub $0xc,%esp
20c3: 68 bd 46 00 00 push $0x46bd
20c8: e8 76 18 00 00 call 3943 <chdir>
20cd: 83 c4 10 add $0x10,%esp
20d0: 85 c0 test %eax,%eax
20d2: 0f 84 90 02 00 00 je 2368 <subdir+0x648>
if(unlink("dd/dd/ffff") != 0){
20d8: 83 ec 0c sub $0xc,%esp
20db: 68 72 45 00 00 push $0x4572
20e0: e8 3e 18 00 00 call 3923 <unlink>
20e5: 83 c4 10 add $0x10,%esp
20e8: 85 c0 test %eax,%eax
20ea: 0f 85 9d 00 00 00 jne 218d <subdir+0x46d>
if(unlink("dd/ff") != 0){
20f0: 83 ec 0c sub $0xc,%esp
20f3: 68 11 45 00 00 push $0x4511
20f8: e8 26 18 00 00 call 3923 <unlink>
20fd: 83 c4 10 add $0x10,%esp
2100: 85 c0 test %eax,%eax
2102: 0f 85 4d 02 00 00 jne 2355 <subdir+0x635>
if(unlink("dd") == 0){
2108: 83 ec 0c sub $0xc,%esp
210b: 68 d8 45 00 00 push $0x45d8
2110: e8 0e 18 00 00 call 3923 <unlink>
2115: 83 c4 10 add $0x10,%esp
2118: 85 c0 test %eax,%eax
211a: 0f 84 22 02 00 00 je 2342 <subdir+0x622>
if(unlink("dd/dd") < 0){
2120: 83 ec 0c sub $0xc,%esp
2123: 68 ed 44 00 00 push $0x44ed
2128: e8 f6 17 00 00 call 3923 <unlink>
212d: 83 c4 10 add $0x10,%esp
2130: 85 c0 test %eax,%eax
2132: 0f 88 f7 01 00 00 js 232f <subdir+0x60f>
if(unlink("dd") < 0){
2138: 83 ec 0c sub $0xc,%esp
213b: 68 d8 45 00 00 push $0x45d8
2140: e8 de 17 00 00 call 3923 <unlink>
2145: 83 c4 10 add $0x10,%esp
2148: 85 c0 test %eax,%eax
214a: 0f 88 cc 01 00 00 js 231c <subdir+0x5fc>
printf(1, "subdir ok\n");
2150: 83 ec 08 sub $0x8,%esp
2153: 68 ba 47 00 00 push $0x47ba
2158: 6a 01 push $0x1
215a: e8 e1 18 00 00 call 3a40 <printf>
}
215f: 8b 5d fc mov -0x4(%ebp),%ebx
2162: 83 c4 10 add $0x10,%esp
2165: c9 leave
2166: c3 ret
printf(1, "dd/dd/../ff wrong content\n");
2167: 50 push %eax
2168: 50 push %eax
2169: 68 57 45 00 00 push $0x4557
216e: 6a 01 push $0x1
2170: e8 cb 18 00 00 call 3a40 <printf>
exit();
2175: e8 59 17 00 00 call 38d3 <exit>
printf(1, "chdir dd/../../dd failed\n");
217a: 50 push %eax
217b: 50 push %eax
217c: 68 b2 45 00 00 push $0x45b2
2181: 6a 01 push $0x1
2183: e8 b8 18 00 00 call 3a40 <printf>
exit();
2188: e8 46 17 00 00 call 38d3 <exit>
printf(1, "unlink dd/dd/ff failed\n");
218d: 50 push %eax
218e: 50 push %eax
218f: 68 7d 45 00 00 push $0x457d
2194: 6a 01 push $0x1
2196: e8 a5 18 00 00 call 3a40 <printf>
exit();
219b: e8 33 17 00 00 call 38d3 <exit>
printf(1, "create dd/ff/ff succeeded!\n");
21a0: 51 push %ecx
21a1: 51 push %ecx
21a2: 68 2f 46 00 00 push $0x462f
21a7: 6a 01 push $0x1
21a9: e8 92 18 00 00 call 3a40 <printf>
exit();
21ae: e8 20 17 00 00 call 38d3 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
21b3: 53 push %ebx
21b4: 53 push %ebx
21b5: 68 14 50 00 00 push $0x5014
21ba: 6a 01 push $0x1
21bc: e8 7f 18 00 00 call 3a40 <printf>
exit();
21c1: e8 0d 17 00 00 call 38d3 <exit>
printf(1, "mkdir dd/ff/ff succeeded!\n");
21c6: 51 push %ecx
21c7: 51 push %ecx
21c8: 68 c3 46 00 00 push $0x46c3
21cd: 6a 01 push $0x1
21cf: e8 6c 18 00 00 call 3a40 <printf>
exit();
21d4: e8 fa 16 00 00 call 38d3 <exit>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
21d9: 53 push %ebx
21da: 53 push %ebx
21db: 68 84 50 00 00 push $0x5084
21e0: 6a 01 push $0x1
21e2: e8 59 18 00 00 call 3a40 <printf>
exit();
21e7: e8 e7 16 00 00 call 38d3 <exit>
printf(1, "open dd/dd/../ff failed\n");
21ec: 50 push %eax
21ed: 50 push %eax
21ee: 68 3e 45 00 00 push $0x453e
21f3: 6a 01 push $0x1
21f5: e8 46 18 00 00 call 3a40 <printf>
exit();
21fa: e8 d4 16 00 00 call 38d3 <exit>
printf(1, "create dd/dd/ff failed\n");
21ff: 51 push %ecx
2200: 51 push %ecx
2201: 68 17 45 00 00 push $0x4517
2206: 6a 01 push $0x1
2208: e8 33 18 00 00 call 3a40 <printf>
exit();
220d: e8 c1 16 00 00 call 38d3 <exit>
printf(1, "chdir ./.. failed\n");
2212: 50 push %eax
2213: 50 push %eax
2214: 68 e0 45 00 00 push $0x45e0
2219: 6a 01 push $0x1
221b: e8 20 18 00 00 call 3a40 <printf>
exit();
2220: e8 ae 16 00 00 call 38d3 <exit>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
2225: 52 push %edx
2226: 52 push %edx
2227: 68 cc 4f 00 00 push $0x4fcc
222c: 6a 01 push $0x1
222e: e8 0d 18 00 00 call 3a40 <printf>
exit();
2233: e8 9b 16 00 00 call 38d3 <exit>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2238: 50 push %eax
2239: 50 push %eax
223a: 68 60 50 00 00 push $0x5060
223f: 6a 01 push $0x1
2241: e8 fa 17 00 00 call 3a40 <printf>
exit();
2246: e8 88 16 00 00 call 38d3 <exit>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
224b: 50 push %eax
224c: 50 push %eax
224d: 68 3c 50 00 00 push $0x503c
2252: 6a 01 push $0x1
2254: e8 e7 17 00 00 call 3a40 <printf>
exit();
2259: e8 75 16 00 00 call 38d3 <exit>
printf(1, "open dd wronly succeeded!\n");
225e: 50 push %eax
225f: 50 push %eax
2260: 68 9f 46 00 00 push $0x469f
2265: 6a 01 push $0x1
2267: e8 d4 17 00 00 call 3a40 <printf>
exit();
226c: e8 62 16 00 00 call 38d3 <exit>
printf(1, "open dd rdwr succeeded!\n");
2271: 50 push %eax
2272: 50 push %eax
2273: 68 86 46 00 00 push $0x4686
2278: 6a 01 push $0x1
227a: e8 c1 17 00 00 call 3a40 <printf>
exit();
227f: e8 4f 16 00 00 call 38d3 <exit>
printf(1, "create dd succeeded!\n");
2284: 50 push %eax
2285: 50 push %eax
2286: 68 70 46 00 00 push $0x4670
228b: 6a 01 push $0x1
228d: e8 ae 17 00 00 call 3a40 <printf>
exit();
2292: e8 3c 16 00 00 call 38d3 <exit>
printf(1, "create dd/xx/ff succeeded!\n");
2297: 52 push %edx
2298: 52 push %edx
2299: 68 54 46 00 00 push $0x4654
229e: 6a 01 push $0x1
22a0: e8 9b 17 00 00 call 3a40 <printf>
exit();
22a5: e8 29 16 00 00 call 38d3 <exit>
printf(1, "chdir dd failed\n");
22aa: 50 push %eax
22ab: 50 push %eax
22ac: 68 95 45 00 00 push $0x4595
22b1: 6a 01 push $0x1
22b3: e8 88 17 00 00 call 3a40 <printf>
exit();
22b8: e8 16 16 00 00 call 38d3 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
22bd: 50 push %eax
22be: 50 push %eax
22bf: 68 f0 4f 00 00 push $0x4ff0
22c4: 6a 01 push $0x1
22c6: e8 75 17 00 00 call 3a40 <printf>
exit();
22cb: e8 03 16 00 00 call 38d3 <exit>
printf(1, "subdir mkdir dd/dd failed\n");
22d0: 53 push %ebx
22d1: 53 push %ebx
22d2: 68 f3 44 00 00 push $0x44f3
22d7: 6a 01 push $0x1
22d9: e8 62 17 00 00 call 3a40 <printf>
exit();
22de: e8 f0 15 00 00 call 38d3 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
22e3: 50 push %eax
22e4: 50 push %eax
22e5: 68 a4 4f 00 00 push $0x4fa4
22ea: 6a 01 push $0x1
22ec: e8 4f 17 00 00 call 3a40 <printf>
exit();
22f1: e8 dd 15 00 00 call 38d3 <exit>
printf(1, "create dd/ff failed\n");
22f6: 50 push %eax
22f7: 50 push %eax
22f8: 68 d7 44 00 00 push $0x44d7
22fd: 6a 01 push $0x1
22ff: e8 3c 17 00 00 call 3a40 <printf>
exit();
2304: e8 ca 15 00 00 call 38d3 <exit>
printf(1, "subdir mkdir dd failed\n");
2309: 50 push %eax
230a: 50 push %eax
230b: 68 bf 44 00 00 push $0x44bf
2310: 6a 01 push $0x1
2312: e8 29 17 00 00 call 3a40 <printf>
exit();
2317: e8 b7 15 00 00 call 38d3 <exit>
printf(1, "unlink dd failed\n");
231c: 50 push %eax
231d: 50 push %eax
231e: 68 a8 47 00 00 push $0x47a8
2323: 6a 01 push $0x1
2325: e8 16 17 00 00 call 3a40 <printf>
exit();
232a: e8 a4 15 00 00 call 38d3 <exit>
printf(1, "unlink dd/dd failed\n");
232f: 52 push %edx
2330: 52 push %edx
2331: 68 93 47 00 00 push $0x4793
2336: 6a 01 push $0x1
2338: e8 03 17 00 00 call 3a40 <printf>
exit();
233d: e8 91 15 00 00 call 38d3 <exit>
printf(1, "unlink non-empty dd succeeded!\n");
2342: 51 push %ecx
2343: 51 push %ecx
2344: 68 a8 50 00 00 push $0x50a8
2349: 6a 01 push $0x1
234b: e8 f0 16 00 00 call 3a40 <printf>
exit();
2350: e8 7e 15 00 00 call 38d3 <exit>
printf(1, "unlink dd/ff failed\n");
2355: 53 push %ebx
2356: 53 push %ebx
2357: 68 7e 47 00 00 push $0x477e
235c: 6a 01 push $0x1
235e: e8 dd 16 00 00 call 3a40 <printf>
exit();
2363: e8 6b 15 00 00 call 38d3 <exit>
printf(1, "chdir dd/xx succeeded!\n");
2368: 50 push %eax
2369: 50 push %eax
236a: 68 66 47 00 00 push $0x4766
236f: 6a 01 push $0x1
2371: e8 ca 16 00 00 call 3a40 <printf>
exit();
2376: e8 58 15 00 00 call 38d3 <exit>
printf(1, "chdir dd/ff succeeded!\n");
237b: 50 push %eax
237c: 50 push %eax
237d: 68 4e 47 00 00 push $0x474e
2382: 6a 01 push $0x1
2384: e8 b7 16 00 00 call 3a40 <printf>
exit();
2389: e8 45 15 00 00 call 38d3 <exit>
printf(1, "unlink dd/ff/ff succeeded!\n");
238e: 50 push %eax
238f: 50 push %eax
2390: 68 32 47 00 00 push $0x4732
2395: 6a 01 push $0x1
2397: e8 a4 16 00 00 call 3a40 <printf>
exit();
239c: e8 32 15 00 00 call 38d3 <exit>
printf(1, "unlink dd/xx/ff succeeded!\n");
23a1: 50 push %eax
23a2: 50 push %eax
23a3: 68 16 47 00 00 push $0x4716
23a8: 6a 01 push $0x1
23aa: e8 91 16 00 00 call 3a40 <printf>
exit();
23af: e8 1f 15 00 00 call 38d3 <exit>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
23b4: 50 push %eax
23b5: 50 push %eax
23b6: 68 f9 46 00 00 push $0x46f9
23bb: 6a 01 push $0x1
23bd: e8 7e 16 00 00 call 3a40 <printf>
exit();
23c2: e8 0c 15 00 00 call 38d3 <exit>
printf(1, "mkdir dd/xx/ff succeeded!\n");
23c7: 52 push %edx
23c8: 52 push %edx
23c9: 68 de 46 00 00 push $0x46de
23ce: 6a 01 push $0x1
23d0: e8 6b 16 00 00 call 3a40 <printf>
exit();
23d5: e8 f9 14 00 00 call 38d3 <exit>
printf(1, "read dd/dd/ffff wrong len\n");
23da: 51 push %ecx
23db: 51 push %ecx
23dc: 68 0b 46 00 00 push $0x460b
23e1: 6a 01 push $0x1
23e3: e8 58 16 00 00 call 3a40 <printf>
exit();
23e8: e8 e6 14 00 00 call 38d3 <exit>
printf(1, "open dd/dd/ffff failed\n");
23ed: 53 push %ebx
23ee: 53 push %ebx
23ef: 68 f3 45 00 00 push $0x45f3
23f4: 6a 01 push $0x1
23f6: e8 45 16 00 00 call 3a40 <printf>
exit();
23fb: e8 d3 14 00 00 call 38d3 <exit>
00002400 <bigwrite>:
{
2400: 55 push %ebp
2401: 89 e5 mov %esp,%ebp
2403: 56 push %esi
2404: 53 push %ebx
for(sz = 499; sz < 12*512; sz += 471){
2405: bb f3 01 00 00 mov $0x1f3,%ebx
printf(1, "bigwrite test\n");
240a: 83 ec 08 sub $0x8,%esp
240d: 68 c5 47 00 00 push $0x47c5
2412: 6a 01 push $0x1
2414: e8 27 16 00 00 call 3a40 <printf>
unlink("bigwrite");
2419: c7 04 24 d4 47 00 00 movl $0x47d4,(%esp)
2420: e8 fe 14 00 00 call 3923 <unlink>
2425: 83 c4 10 add $0x10,%esp
2428: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
242f: 90 nop
fd = open("bigwrite", O_CREATE | O_RDWR);
2430: 83 ec 08 sub $0x8,%esp
2433: 68 02 02 00 00 push $0x202
2438: 68 d4 47 00 00 push $0x47d4
243d: e8 d1 14 00 00 call 3913 <open>
if(fd < 0){
2442: 83 c4 10 add $0x10,%esp
fd = open("bigwrite", O_CREATE | O_RDWR);
2445: 89 c6 mov %eax,%esi
if(fd < 0){
2447: 85 c0 test %eax,%eax
2449: 78 7e js 24c9 <bigwrite+0xc9>
int cc = write(fd, buf, sz);
244b: 83 ec 04 sub $0x4,%esp
244e: 53 push %ebx
244f: 68 c0 7c 00 00 push $0x7cc0
2454: 50 push %eax
2455: e8 99 14 00 00 call 38f3 <write>
if(cc != sz){
245a: 83 c4 10 add $0x10,%esp
245d: 39 d8 cmp %ebx,%eax
245f: 75 55 jne 24b6 <bigwrite+0xb6>
int cc = write(fd, buf, sz);
2461: 83 ec 04 sub $0x4,%esp
2464: 53 push %ebx
2465: 68 c0 7c 00 00 push $0x7cc0
246a: 56 push %esi
246b: e8 83 14 00 00 call 38f3 <write>
if(cc != sz){
2470: 83 c4 10 add $0x10,%esp
2473: 39 d8 cmp %ebx,%eax
2475: 75 3f jne 24b6 <bigwrite+0xb6>
close(fd);
2477: 83 ec 0c sub $0xc,%esp
for(sz = 499; sz < 12*512; sz += 471){
247a: 81 c3 d7 01 00 00 add $0x1d7,%ebx
close(fd);
2480: 56 push %esi
2481: e8 75 14 00 00 call 38fb <close>
unlink("bigwrite");
2486: c7 04 24 d4 47 00 00 movl $0x47d4,(%esp)
248d: e8 91 14 00 00 call 3923 <unlink>
for(sz = 499; sz < 12*512; sz += 471){
2492: 83 c4 10 add $0x10,%esp
2495: 81 fb 07 18 00 00 cmp $0x1807,%ebx
249b: 75 93 jne 2430 <bigwrite+0x30>
printf(1, "bigwrite ok\n");
249d: 83 ec 08 sub $0x8,%esp
24a0: 68 07 48 00 00 push $0x4807
24a5: 6a 01 push $0x1
24a7: e8 94 15 00 00 call 3a40 <printf>
}
24ac: 83 c4 10 add $0x10,%esp
24af: 8d 65 f8 lea -0x8(%ebp),%esp
24b2: 5b pop %ebx
24b3: 5e pop %esi
24b4: 5d pop %ebp
24b5: c3 ret
printf(1, "write(%d) ret %d\n", sz, cc);
24b6: 50 push %eax
24b7: 53 push %ebx
24b8: 68 f5 47 00 00 push $0x47f5
24bd: 6a 01 push $0x1
24bf: e8 7c 15 00 00 call 3a40 <printf>
exit();
24c4: e8 0a 14 00 00 call 38d3 <exit>
printf(1, "cannot create bigwrite\n");
24c9: 83 ec 08 sub $0x8,%esp
24cc: 68 dd 47 00 00 push $0x47dd
24d1: 6a 01 push $0x1
24d3: e8 68 15 00 00 call 3a40 <printf>
exit();
24d8: e8 f6 13 00 00 call 38d3 <exit>
24dd: 8d 76 00 lea 0x0(%esi),%esi
000024e0 <bigfile>:
{
24e0: 55 push %ebp
24e1: 89 e5 mov %esp,%ebp
24e3: 57 push %edi
24e4: 56 push %esi
24e5: 53 push %ebx
24e6: 83 ec 14 sub $0x14,%esp
printf(1, "bigfile test\n");
24e9: 68 14 48 00 00 push $0x4814
24ee: 6a 01 push $0x1
24f0: e8 4b 15 00 00 call 3a40 <printf>
unlink("bigfile");
24f5: c7 04 24 30 48 00 00 movl $0x4830,(%esp)
24fc: e8 22 14 00 00 call 3923 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
2501: 58 pop %eax
2502: 5a pop %edx
2503: 68 02 02 00 00 push $0x202
2508: 68 30 48 00 00 push $0x4830
250d: e8 01 14 00 00 call 3913 <open>
if(fd < 0){
2512: 83 c4 10 add $0x10,%esp
2515: 85 c0 test %eax,%eax
2517: 0f 88 5e 01 00 00 js 267b <bigfile+0x19b>
251d: 89 c6 mov %eax,%esi
for(i = 0; i < 20; i++){
251f: 31 db xor %ebx,%ebx
2521: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
memset(buf, i, 600);
2528: 83 ec 04 sub $0x4,%esp
252b: 68 58 02 00 00 push $0x258
2530: 53 push %ebx
2531: 68 c0 7c 00 00 push $0x7cc0
2536: e8 05 12 00 00 call 3740 <memset>
if(write(fd, buf, 600) != 600){
253b: 83 c4 0c add $0xc,%esp
253e: 68 58 02 00 00 push $0x258
2543: 68 c0 7c 00 00 push $0x7cc0
2548: 56 push %esi
2549: e8 a5 13 00 00 call 38f3 <write>
254e: 83 c4 10 add $0x10,%esp
2551: 3d 58 02 00 00 cmp $0x258,%eax
2556: 0f 85 f8 00 00 00 jne 2654 <bigfile+0x174>
for(i = 0; i < 20; i++){
255c: 83 c3 01 add $0x1,%ebx
255f: 83 fb 14 cmp $0x14,%ebx
2562: 75 c4 jne 2528 <bigfile+0x48>
close(fd);
2564: 83 ec 0c sub $0xc,%esp
2567: 56 push %esi
2568: e8 8e 13 00 00 call 38fb <close>
fd = open("bigfile", 0);
256d: 5e pop %esi
256e: 5f pop %edi
256f: 6a 00 push $0x0
2571: 68 30 48 00 00 push $0x4830
2576: e8 98 13 00 00 call 3913 <open>
if(fd < 0){
257b: 83 c4 10 add $0x10,%esp
fd = open("bigfile", 0);
257e: 89 c6 mov %eax,%esi
if(fd < 0){
2580: 85 c0 test %eax,%eax
2582: 0f 88 e0 00 00 00 js 2668 <bigfile+0x188>
total = 0;
2588: 31 db xor %ebx,%ebx
for(i = 0; ; i++){
258a: 31 ff xor %edi,%edi
258c: eb 30 jmp 25be <bigfile+0xde>
258e: 66 90 xchg %ax,%ax
if(cc != 300){
2590: 3d 2c 01 00 00 cmp $0x12c,%eax
2595: 0f 85 91 00 00 00 jne 262c <bigfile+0x14c>
if(buf[0] != i/2 || buf[299] != i/2){
259b: 89 fa mov %edi,%edx
259d: 0f be 05 c0 7c 00 00 movsbl 0x7cc0,%eax
25a4: d1 fa sar %edx
25a6: 39 d0 cmp %edx,%eax
25a8: 75 6e jne 2618 <bigfile+0x138>
25aa: 0f be 15 eb 7d 00 00 movsbl 0x7deb,%edx
25b1: 39 d0 cmp %edx,%eax
25b3: 75 63 jne 2618 <bigfile+0x138>
total += cc;
25b5: 81 c3 2c 01 00 00 add $0x12c,%ebx
for(i = 0; ; i++){
25bb: 83 c7 01 add $0x1,%edi
cc = read(fd, buf, 300);
25be: 83 ec 04 sub $0x4,%esp
25c1: 68 2c 01 00 00 push $0x12c
25c6: 68 c0 7c 00 00 push $0x7cc0
25cb: 56 push %esi
25cc: e8 1a 13 00 00 call 38eb <read>
if(cc < 0){
25d1: 83 c4 10 add $0x10,%esp
25d4: 85 c0 test %eax,%eax
25d6: 78 68 js 2640 <bigfile+0x160>
if(cc == 0)
25d8: 75 b6 jne 2590 <bigfile+0xb0>
close(fd);
25da: 83 ec 0c sub $0xc,%esp
25dd: 56 push %esi
25de: e8 18 13 00 00 call 38fb <close>
if(total != 20*600){
25e3: 83 c4 10 add $0x10,%esp
25e6: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx
25ec: 0f 85 9c 00 00 00 jne 268e <bigfile+0x1ae>
unlink("bigfile");
25f2: 83 ec 0c sub $0xc,%esp
25f5: 68 30 48 00 00 push $0x4830
25fa: e8 24 13 00 00 call 3923 <unlink>
printf(1, "bigfile test ok\n");
25ff: 58 pop %eax
2600: 5a pop %edx
2601: 68 bf 48 00 00 push $0x48bf
2606: 6a 01 push $0x1
2608: e8 33 14 00 00 call 3a40 <printf>
}
260d: 83 c4 10 add $0x10,%esp
2610: 8d 65 f4 lea -0xc(%ebp),%esp
2613: 5b pop %ebx
2614: 5e pop %esi
2615: 5f pop %edi
2616: 5d pop %ebp
2617: c3 ret
printf(1, "read bigfile wrong data\n");
2618: 83 ec 08 sub $0x8,%esp
261b: 68 8c 48 00 00 push $0x488c
2620: 6a 01 push $0x1
2622: e8 19 14 00 00 call 3a40 <printf>
exit();
2627: e8 a7 12 00 00 call 38d3 <exit>
printf(1, "short read bigfile\n");
262c: 83 ec 08 sub $0x8,%esp
262f: 68 78 48 00 00 push $0x4878
2634: 6a 01 push $0x1
2636: e8 05 14 00 00 call 3a40 <printf>
exit();
263b: e8 93 12 00 00 call 38d3 <exit>
printf(1, "read bigfile failed\n");
2640: 83 ec 08 sub $0x8,%esp
2643: 68 63 48 00 00 push $0x4863
2648: 6a 01 push $0x1
264a: e8 f1 13 00 00 call 3a40 <printf>
exit();
264f: e8 7f 12 00 00 call 38d3 <exit>
printf(1, "write bigfile failed\n");
2654: 83 ec 08 sub $0x8,%esp
2657: 68 38 48 00 00 push $0x4838
265c: 6a 01 push $0x1
265e: e8 dd 13 00 00 call 3a40 <printf>
exit();
2663: e8 6b 12 00 00 call 38d3 <exit>
printf(1, "cannot open bigfile\n");
2668: 53 push %ebx
2669: 53 push %ebx
266a: 68 4e 48 00 00 push $0x484e
266f: 6a 01 push $0x1
2671: e8 ca 13 00 00 call 3a40 <printf>
exit();
2676: e8 58 12 00 00 call 38d3 <exit>
printf(1, "cannot create bigfile");
267b: 50 push %eax
267c: 50 push %eax
267d: 68 22 48 00 00 push $0x4822
2682: 6a 01 push $0x1
2684: e8 b7 13 00 00 call 3a40 <printf>
exit();
2689: e8 45 12 00 00 call 38d3 <exit>
printf(1, "read bigfile wrong total\n");
268e: 51 push %ecx
268f: 51 push %ecx
2690: 68 a5 48 00 00 push $0x48a5
2695: 6a 01 push $0x1
2697: e8 a4 13 00 00 call 3a40 <printf>
exit();
269c: e8 32 12 00 00 call 38d3 <exit>
26a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
26a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
26af: 90 nop
000026b0 <fourteen>:
{
26b0: 55 push %ebp
26b1: 89 e5 mov %esp,%ebp
26b3: 83 ec 10 sub $0x10,%esp
printf(1, "fourteen test\n");
26b6: 68 d0 48 00 00 push $0x48d0
26bb: 6a 01 push $0x1
26bd: e8 7e 13 00 00 call 3a40 <printf>
if(mkdir("12345678901234") != 0){
26c2: c7 04 24 0b 49 00 00 movl $0x490b,(%esp)
26c9: e8 6d 12 00 00 call 393b <mkdir>
26ce: 83 c4 10 add $0x10,%esp
26d1: 85 c0 test %eax,%eax
26d3: 0f 85 97 00 00 00 jne 2770 <fourteen+0xc0>
if(mkdir("12345678901234/123456789012345") != 0){
26d9: 83 ec 0c sub $0xc,%esp
26dc: 68 c8 50 00 00 push $0x50c8
26e1: e8 55 12 00 00 call 393b <mkdir>
26e6: 83 c4 10 add $0x10,%esp
26e9: 85 c0 test %eax,%eax
26eb: 0f 85 de 00 00 00 jne 27cf <fourteen+0x11f>
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
26f1: 83 ec 08 sub $0x8,%esp
26f4: 68 00 02 00 00 push $0x200
26f9: 68 18 51 00 00 push $0x5118
26fe: e8 10 12 00 00 call 3913 <open>
if(fd < 0){
2703: 83 c4 10 add $0x10,%esp
2706: 85 c0 test %eax,%eax
2708: 0f 88 ae 00 00 00 js 27bc <fourteen+0x10c>
close(fd);
270e: 83 ec 0c sub $0xc,%esp
2711: 50 push %eax
2712: e8 e4 11 00 00 call 38fb <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
2717: 58 pop %eax
2718: 5a pop %edx
2719: 6a 00 push $0x0
271b: 68 88 51 00 00 push $0x5188
2720: e8 ee 11 00 00 call 3913 <open>
if(fd < 0){
2725: 83 c4 10 add $0x10,%esp
2728: 85 c0 test %eax,%eax
272a: 78 7d js 27a9 <fourteen+0xf9>
close(fd);
272c: 83 ec 0c sub $0xc,%esp
272f: 50 push %eax
2730: e8 c6 11 00 00 call 38fb <close>
if(mkdir("12345678901234/12345678901234") == 0){
2735: c7 04 24 fc 48 00 00 movl $0x48fc,(%esp)
273c: e8 fa 11 00 00 call 393b <mkdir>
2741: 83 c4 10 add $0x10,%esp
2744: 85 c0 test %eax,%eax
2746: 74 4e je 2796 <fourteen+0xe6>
if(mkdir("123456789012345/12345678901234") == 0){
2748: 83 ec 0c sub $0xc,%esp
274b: 68 24 52 00 00 push $0x5224
2750: e8 e6 11 00 00 call 393b <mkdir>
2755: 83 c4 10 add $0x10,%esp
2758: 85 c0 test %eax,%eax
275a: 74 27 je 2783 <fourteen+0xd3>
printf(1, "fourteen ok\n");
275c: 83 ec 08 sub $0x8,%esp
275f: 68 1a 49 00 00 push $0x491a
2764: 6a 01 push $0x1
2766: e8 d5 12 00 00 call 3a40 <printf>
}
276b: 83 c4 10 add $0x10,%esp
276e: c9 leave
276f: c3 ret
printf(1, "mkdir 12345678901234 failed\n");
2770: 50 push %eax
2771: 50 push %eax
2772: 68 df 48 00 00 push $0x48df
2777: 6a 01 push $0x1
2779: e8 c2 12 00 00 call 3a40 <printf>
exit();
277e: e8 50 11 00 00 call 38d3 <exit>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
2783: 50 push %eax
2784: 50 push %eax
2785: 68 44 52 00 00 push $0x5244
278a: 6a 01 push $0x1
278c: e8 af 12 00 00 call 3a40 <printf>
exit();
2791: e8 3d 11 00 00 call 38d3 <exit>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
2796: 52 push %edx
2797: 52 push %edx
2798: 68 f4 51 00 00 push $0x51f4
279d: 6a 01 push $0x1
279f: e8 9c 12 00 00 call 3a40 <printf>
exit();
27a4: e8 2a 11 00 00 call 38d3 <exit>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
27a9: 51 push %ecx
27aa: 51 push %ecx
27ab: 68 b8 51 00 00 push $0x51b8
27b0: 6a 01 push $0x1
27b2: e8 89 12 00 00 call 3a40 <printf>
exit();
27b7: e8 17 11 00 00 call 38d3 <exit>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
27bc: 51 push %ecx
27bd: 51 push %ecx
27be: 68 48 51 00 00 push $0x5148
27c3: 6a 01 push $0x1
27c5: e8 76 12 00 00 call 3a40 <printf>
exit();
27ca: e8 04 11 00 00 call 38d3 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
27cf: 50 push %eax
27d0: 50 push %eax
27d1: 68 e8 50 00 00 push $0x50e8
27d6: 6a 01 push $0x1
27d8: e8 63 12 00 00 call 3a40 <printf>
exit();
27dd: e8 f1 10 00 00 call 38d3 <exit>
27e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
27e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000027f0 <rmdot>:
{
27f0: 55 push %ebp
27f1: 89 e5 mov %esp,%ebp
27f3: 83 ec 10 sub $0x10,%esp
printf(1, "rmdot test\n");
27f6: 68 27 49 00 00 push $0x4927
27fb: 6a 01 push $0x1
27fd: e8 3e 12 00 00 call 3a40 <printf>
if(mkdir("dots") != 0){
2802: c7 04 24 33 49 00 00 movl $0x4933,(%esp)
2809: e8 2d 11 00 00 call 393b <mkdir>
280e: 83 c4 10 add $0x10,%esp
2811: 85 c0 test %eax,%eax
2813: 0f 85 b0 00 00 00 jne 28c9 <rmdot+0xd9>
if(chdir("dots") != 0){
2819: 83 ec 0c sub $0xc,%esp
281c: 68 33 49 00 00 push $0x4933
2821: e8 1d 11 00 00 call 3943 <chdir>
2826: 83 c4 10 add $0x10,%esp
2829: 85 c0 test %eax,%eax
282b: 0f 85 1d 01 00 00 jne 294e <rmdot+0x15e>
if(unlink(".") == 0){
2831: 83 ec 0c sub $0xc,%esp
2834: 68 de 45 00 00 push $0x45de
2839: e8 e5 10 00 00 call 3923 <unlink>
283e: 83 c4 10 add $0x10,%esp
2841: 85 c0 test %eax,%eax
2843: 0f 84 f2 00 00 00 je 293b <rmdot+0x14b>
if(unlink("..") == 0){
2849: 83 ec 0c sub $0xc,%esp
284c: 68 dd 45 00 00 push $0x45dd
2851: e8 cd 10 00 00 call 3923 <unlink>
2856: 83 c4 10 add $0x10,%esp
2859: 85 c0 test %eax,%eax
285b: 0f 84 c7 00 00 00 je 2928 <rmdot+0x138>
if(chdir("/") != 0){
2861: 83 ec 0c sub $0xc,%esp
2864: 68 b1 3d 00 00 push $0x3db1
2869: e8 d5 10 00 00 call 3943 <chdir>
286e: 83 c4 10 add $0x10,%esp
2871: 85 c0 test %eax,%eax
2873: 0f 85 9c 00 00 00 jne 2915 <rmdot+0x125>
if(unlink("dots/.") == 0){
2879: 83 ec 0c sub $0xc,%esp
287c: 68 7b 49 00 00 push $0x497b
2881: e8 9d 10 00 00 call 3923 <unlink>
2886: 83 c4 10 add $0x10,%esp
2889: 85 c0 test %eax,%eax
288b: 74 75 je 2902 <rmdot+0x112>
if(unlink("dots/..") == 0){
288d: 83 ec 0c sub $0xc,%esp
2890: 68 99 49 00 00 push $0x4999
2895: e8 89 10 00 00 call 3923 <unlink>
289a: 83 c4 10 add $0x10,%esp
289d: 85 c0 test %eax,%eax
289f: 74 4e je 28ef <rmdot+0xff>
if(unlink("dots") != 0){
28a1: 83 ec 0c sub $0xc,%esp
28a4: 68 33 49 00 00 push $0x4933
28a9: e8 75 10 00 00 call 3923 <unlink>
28ae: 83 c4 10 add $0x10,%esp
28b1: 85 c0 test %eax,%eax
28b3: 75 27 jne 28dc <rmdot+0xec>
printf(1, "rmdot ok\n");
28b5: 83 ec 08 sub $0x8,%esp
28b8: 68 ce 49 00 00 push $0x49ce
28bd: 6a 01 push $0x1
28bf: e8 7c 11 00 00 call 3a40 <printf>
}
28c4: 83 c4 10 add $0x10,%esp
28c7: c9 leave
28c8: c3 ret
printf(1, "mkdir dots failed\n");
28c9: 50 push %eax
28ca: 50 push %eax
28cb: 68 38 49 00 00 push $0x4938
28d0: 6a 01 push $0x1
28d2: e8 69 11 00 00 call 3a40 <printf>
exit();
28d7: e8 f7 0f 00 00 call 38d3 <exit>
printf(1, "unlink dots failed!\n");
28dc: 50 push %eax
28dd: 50 push %eax
28de: 68 b9 49 00 00 push $0x49b9
28e3: 6a 01 push $0x1
28e5: e8 56 11 00 00 call 3a40 <printf>
exit();
28ea: e8 e4 0f 00 00 call 38d3 <exit>
printf(1, "unlink dots/.. worked!\n");
28ef: 52 push %edx
28f0: 52 push %edx
28f1: 68 a1 49 00 00 push $0x49a1
28f6: 6a 01 push $0x1
28f8: e8 43 11 00 00 call 3a40 <printf>
exit();
28fd: e8 d1 0f 00 00 call 38d3 <exit>
printf(1, "unlink dots/. worked!\n");
2902: 51 push %ecx
2903: 51 push %ecx
2904: 68 82 49 00 00 push $0x4982
2909: 6a 01 push $0x1
290b: e8 30 11 00 00 call 3a40 <printf>
exit();
2910: e8 be 0f 00 00 call 38d3 <exit>
printf(1, "chdir / failed\n");
2915: 50 push %eax
2916: 50 push %eax
2917: 68 b3 3d 00 00 push $0x3db3
291c: 6a 01 push $0x1
291e: e8 1d 11 00 00 call 3a40 <printf>
exit();
2923: e8 ab 0f 00 00 call 38d3 <exit>
printf(1, "rm .. worked!\n");
2928: 50 push %eax
2929: 50 push %eax
292a: 68 6c 49 00 00 push $0x496c
292f: 6a 01 push $0x1
2931: e8 0a 11 00 00 call 3a40 <printf>
exit();
2936: e8 98 0f 00 00 call 38d3 <exit>
printf(1, "rm . worked!\n");
293b: 50 push %eax
293c: 50 push %eax
293d: 68 5e 49 00 00 push $0x495e
2942: 6a 01 push $0x1
2944: e8 f7 10 00 00 call 3a40 <printf>
exit();
2949: e8 85 0f 00 00 call 38d3 <exit>
printf(1, "chdir dots failed\n");
294e: 50 push %eax
294f: 50 push %eax
2950: 68 4b 49 00 00 push $0x494b
2955: 6a 01 push $0x1
2957: e8 e4 10 00 00 call 3a40 <printf>
exit();
295c: e8 72 0f 00 00 call 38d3 <exit>
2961: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2968: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
296f: 90 nop
00002970 <dirfile>:
{
2970: 55 push %ebp
2971: 89 e5 mov %esp,%ebp
2973: 53 push %ebx
2974: 83 ec 0c sub $0xc,%esp
printf(1, "dir vs file\n");
2977: 68 d8 49 00 00 push $0x49d8
297c: 6a 01 push $0x1
297e: e8 bd 10 00 00 call 3a40 <printf>
fd = open("dirfile", O_CREATE);
2983: 5b pop %ebx
2984: 58 pop %eax
2985: 68 00 02 00 00 push $0x200
298a: 68 e5 49 00 00 push $0x49e5
298f: e8 7f 0f 00 00 call 3913 <open>
if(fd < 0){
2994: 83 c4 10 add $0x10,%esp
2997: 85 c0 test %eax,%eax
2999: 0f 88 43 01 00 00 js 2ae2 <dirfile+0x172>
close(fd);
299f: 83 ec 0c sub $0xc,%esp
29a2: 50 push %eax
29a3: e8 53 0f 00 00 call 38fb <close>
if(chdir("dirfile") == 0){
29a8: c7 04 24 e5 49 00 00 movl $0x49e5,(%esp)
29af: e8 8f 0f 00 00 call 3943 <chdir>
29b4: 83 c4 10 add $0x10,%esp
29b7: 85 c0 test %eax,%eax
29b9: 0f 84 10 01 00 00 je 2acf <dirfile+0x15f>
fd = open("dirfile/xx", 0);
29bf: 83 ec 08 sub $0x8,%esp
29c2: 6a 00 push $0x0
29c4: 68 1e 4a 00 00 push $0x4a1e
29c9: e8 45 0f 00 00 call 3913 <open>
if(fd >= 0){
29ce: 83 c4 10 add $0x10,%esp
29d1: 85 c0 test %eax,%eax
29d3: 0f 89 e3 00 00 00 jns 2abc <dirfile+0x14c>
fd = open("dirfile/xx", O_CREATE);
29d9: 83 ec 08 sub $0x8,%esp
29dc: 68 00 02 00 00 push $0x200
29e1: 68 1e 4a 00 00 push $0x4a1e
29e6: e8 28 0f 00 00 call 3913 <open>
if(fd >= 0){
29eb: 83 c4 10 add $0x10,%esp
29ee: 85 c0 test %eax,%eax
29f0: 0f 89 c6 00 00 00 jns 2abc <dirfile+0x14c>
if(mkdir("dirfile/xx") == 0){
29f6: 83 ec 0c sub $0xc,%esp
29f9: 68 1e 4a 00 00 push $0x4a1e
29fe: e8 38 0f 00 00 call 393b <mkdir>
2a03: 83 c4 10 add $0x10,%esp
2a06: 85 c0 test %eax,%eax
2a08: 0f 84 46 01 00 00 je 2b54 <dirfile+0x1e4>
if(unlink("dirfile/xx") == 0){
2a0e: 83 ec 0c sub $0xc,%esp
2a11: 68 1e 4a 00 00 push $0x4a1e
2a16: e8 08 0f 00 00 call 3923 <unlink>
2a1b: 83 c4 10 add $0x10,%esp
2a1e: 85 c0 test %eax,%eax
2a20: 0f 84 1b 01 00 00 je 2b41 <dirfile+0x1d1>
if(link("README", "dirfile/xx") == 0){
2a26: 83 ec 08 sub $0x8,%esp
2a29: 68 1e 4a 00 00 push $0x4a1e
2a2e: 68 82 4a 00 00 push $0x4a82
2a33: e8 fb 0e 00 00 call 3933 <link>
2a38: 83 c4 10 add $0x10,%esp
2a3b: 85 c0 test %eax,%eax
2a3d: 0f 84 eb 00 00 00 je 2b2e <dirfile+0x1be>
if(unlink("dirfile") != 0){
2a43: 83 ec 0c sub $0xc,%esp
2a46: 68 e5 49 00 00 push $0x49e5
2a4b: e8 d3 0e 00 00 call 3923 <unlink>
2a50: 83 c4 10 add $0x10,%esp
2a53: 85 c0 test %eax,%eax
2a55: 0f 85 c0 00 00 00 jne 2b1b <dirfile+0x1ab>
fd = open(".", O_RDWR);
2a5b: 83 ec 08 sub $0x8,%esp
2a5e: 6a 02 push $0x2
2a60: 68 de 45 00 00 push $0x45de
2a65: e8 a9 0e 00 00 call 3913 <open>
if(fd >= 0){
2a6a: 83 c4 10 add $0x10,%esp
2a6d: 85 c0 test %eax,%eax
2a6f: 0f 89 93 00 00 00 jns 2b08 <dirfile+0x198>
fd = open(".", 0);
2a75: 83 ec 08 sub $0x8,%esp
2a78: 6a 00 push $0x0
2a7a: 68 de 45 00 00 push $0x45de
2a7f: e8 8f 0e 00 00 call 3913 <open>
if(write(fd, "x", 1) > 0){
2a84: 83 c4 0c add $0xc,%esp
2a87: 6a 01 push $0x1
fd = open(".", 0);
2a89: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2a8b: 68 c1 46 00 00 push $0x46c1
2a90: 50 push %eax
2a91: e8 5d 0e 00 00 call 38f3 <write>
2a96: 83 c4 10 add $0x10,%esp
2a99: 85 c0 test %eax,%eax
2a9b: 7f 58 jg 2af5 <dirfile+0x185>
close(fd);
2a9d: 83 ec 0c sub $0xc,%esp
2aa0: 53 push %ebx
2aa1: e8 55 0e 00 00 call 38fb <close>
printf(1, "dir vs file OK\n");
2aa6: 58 pop %eax
2aa7: 5a pop %edx
2aa8: 68 b5 4a 00 00 push $0x4ab5
2aad: 6a 01 push $0x1
2aaf: e8 8c 0f 00 00 call 3a40 <printf>
}
2ab4: 8b 5d fc mov -0x4(%ebp),%ebx
2ab7: 83 c4 10 add $0x10,%esp
2aba: c9 leave
2abb: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
2abc: 50 push %eax
2abd: 50 push %eax
2abe: 68 29 4a 00 00 push $0x4a29
2ac3: 6a 01 push $0x1
2ac5: e8 76 0f 00 00 call 3a40 <printf>
exit();
2aca: e8 04 0e 00 00 call 38d3 <exit>
printf(1, "chdir dirfile succeeded!\n");
2acf: 52 push %edx
2ad0: 52 push %edx
2ad1: 68 04 4a 00 00 push $0x4a04
2ad6: 6a 01 push $0x1
2ad8: e8 63 0f 00 00 call 3a40 <printf>
exit();
2add: e8 f1 0d 00 00 call 38d3 <exit>
printf(1, "create dirfile failed\n");
2ae2: 51 push %ecx
2ae3: 51 push %ecx
2ae4: 68 ed 49 00 00 push $0x49ed
2ae9: 6a 01 push $0x1
2aeb: e8 50 0f 00 00 call 3a40 <printf>
exit();
2af0: e8 de 0d 00 00 call 38d3 <exit>
printf(1, "write . succeeded!\n");
2af5: 51 push %ecx
2af6: 51 push %ecx
2af7: 68 a1 4a 00 00 push $0x4aa1
2afc: 6a 01 push $0x1
2afe: e8 3d 0f 00 00 call 3a40 <printf>
exit();
2b03: e8 cb 0d 00 00 call 38d3 <exit>
printf(1, "open . for writing succeeded!\n");
2b08: 53 push %ebx
2b09: 53 push %ebx
2b0a: 68 98 52 00 00 push $0x5298
2b0f: 6a 01 push $0x1
2b11: e8 2a 0f 00 00 call 3a40 <printf>
exit();
2b16: e8 b8 0d 00 00 call 38d3 <exit>
printf(1, "unlink dirfile failed!\n");
2b1b: 50 push %eax
2b1c: 50 push %eax
2b1d: 68 89 4a 00 00 push $0x4a89
2b22: 6a 01 push $0x1
2b24: e8 17 0f 00 00 call 3a40 <printf>
exit();
2b29: e8 a5 0d 00 00 call 38d3 <exit>
printf(1, "link to dirfile/xx succeeded!\n");
2b2e: 50 push %eax
2b2f: 50 push %eax
2b30: 68 78 52 00 00 push $0x5278
2b35: 6a 01 push $0x1
2b37: e8 04 0f 00 00 call 3a40 <printf>
exit();
2b3c: e8 92 0d 00 00 call 38d3 <exit>
printf(1, "unlink dirfile/xx succeeded!\n");
2b41: 50 push %eax
2b42: 50 push %eax
2b43: 68 64 4a 00 00 push $0x4a64
2b48: 6a 01 push $0x1
2b4a: e8 f1 0e 00 00 call 3a40 <printf>
exit();
2b4f: e8 7f 0d 00 00 call 38d3 <exit>
printf(1, "mkdir dirfile/xx succeeded!\n");
2b54: 50 push %eax
2b55: 50 push %eax
2b56: 68 47 4a 00 00 push $0x4a47
2b5b: 6a 01 push $0x1
2b5d: e8 de 0e 00 00 call 3a40 <printf>
exit();
2b62: e8 6c 0d 00 00 call 38d3 <exit>
2b67: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2b6e: 66 90 xchg %ax,%ax
00002b70 <iref>:
{
2b70: 55 push %ebp
2b71: 89 e5 mov %esp,%ebp
2b73: 53 push %ebx
printf(1, "empty file name\n");
2b74: bb 33 00 00 00 mov $0x33,%ebx
{
2b79: 83 ec 0c sub $0xc,%esp
printf(1, "empty file name\n");
2b7c: 68 c5 4a 00 00 push $0x4ac5
2b81: 6a 01 push $0x1
2b83: e8 b8 0e 00 00 call 3a40 <printf>
2b88: 83 c4 10 add $0x10,%esp
2b8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2b8f: 90 nop
if(mkdir("irefd") != 0){
2b90: 83 ec 0c sub $0xc,%esp
2b93: 68 d6 4a 00 00 push $0x4ad6
2b98: e8 9e 0d 00 00 call 393b <mkdir>
2b9d: 83 c4 10 add $0x10,%esp
2ba0: 85 c0 test %eax,%eax
2ba2: 0f 85 bb 00 00 00 jne 2c63 <iref+0xf3>
if(chdir("irefd") != 0){
2ba8: 83 ec 0c sub $0xc,%esp
2bab: 68 d6 4a 00 00 push $0x4ad6
2bb0: e8 8e 0d 00 00 call 3943 <chdir>
2bb5: 83 c4 10 add $0x10,%esp
2bb8: 85 c0 test %eax,%eax
2bba: 0f 85 b7 00 00 00 jne 2c77 <iref+0x107>
mkdir("");
2bc0: 83 ec 0c sub $0xc,%esp
2bc3: 68 8b 41 00 00 push $0x418b
2bc8: e8 6e 0d 00 00 call 393b <mkdir>
link("README", "");
2bcd: 59 pop %ecx
2bce: 58 pop %eax
2bcf: 68 8b 41 00 00 push $0x418b
2bd4: 68 82 4a 00 00 push $0x4a82
2bd9: e8 55 0d 00 00 call 3933 <link>
fd = open("", O_CREATE);
2bde: 58 pop %eax
2bdf: 5a pop %edx
2be0: 68 00 02 00 00 push $0x200
2be5: 68 8b 41 00 00 push $0x418b
2bea: e8 24 0d 00 00 call 3913 <open>
if(fd >= 0)
2bef: 83 c4 10 add $0x10,%esp
2bf2: 85 c0 test %eax,%eax
2bf4: 78 0c js 2c02 <iref+0x92>
close(fd);
2bf6: 83 ec 0c sub $0xc,%esp
2bf9: 50 push %eax
2bfa: e8 fc 0c 00 00 call 38fb <close>
2bff: 83 c4 10 add $0x10,%esp
fd = open("xx", O_CREATE);
2c02: 83 ec 08 sub $0x8,%esp
2c05: 68 00 02 00 00 push $0x200
2c0a: 68 c0 46 00 00 push $0x46c0
2c0f: e8 ff 0c 00 00 call 3913 <open>
if(fd >= 0)
2c14: 83 c4 10 add $0x10,%esp
2c17: 85 c0 test %eax,%eax
2c19: 78 0c js 2c27 <iref+0xb7>
close(fd);
2c1b: 83 ec 0c sub $0xc,%esp
2c1e: 50 push %eax
2c1f: e8 d7 0c 00 00 call 38fb <close>
2c24: 83 c4 10 add $0x10,%esp
unlink("xx");
2c27: 83 ec 0c sub $0xc,%esp
2c2a: 68 c0 46 00 00 push $0x46c0
2c2f: e8 ef 0c 00 00 call 3923 <unlink>
for(i = 0; i < 50 + 1; i++){
2c34: 83 c4 10 add $0x10,%esp
2c37: 83 eb 01 sub $0x1,%ebx
2c3a: 0f 85 50 ff ff ff jne 2b90 <iref+0x20>
chdir("/");
2c40: 83 ec 0c sub $0xc,%esp
2c43: 68 b1 3d 00 00 push $0x3db1
2c48: e8 f6 0c 00 00 call 3943 <chdir>
printf(1, "empty file name OK\n");
2c4d: 58 pop %eax
2c4e: 5a pop %edx
2c4f: 68 04 4b 00 00 push $0x4b04
2c54: 6a 01 push $0x1
2c56: e8 e5 0d 00 00 call 3a40 <printf>
}
2c5b: 8b 5d fc mov -0x4(%ebp),%ebx
2c5e: 83 c4 10 add $0x10,%esp
2c61: c9 leave
2c62: c3 ret
printf(1, "mkdir irefd failed\n");
2c63: 83 ec 08 sub $0x8,%esp
2c66: 68 dc 4a 00 00 push $0x4adc
2c6b: 6a 01 push $0x1
2c6d: e8 ce 0d 00 00 call 3a40 <printf>
exit();
2c72: e8 5c 0c 00 00 call 38d3 <exit>
printf(1, "chdir irefd failed\n");
2c77: 83 ec 08 sub $0x8,%esp
2c7a: 68 f0 4a 00 00 push $0x4af0
2c7f: 6a 01 push $0x1
2c81: e8 ba 0d 00 00 call 3a40 <printf>
exit();
2c86: e8 48 0c 00 00 call 38d3 <exit>
2c8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2c8f: 90 nop
00002c90 <forktest>:
{
2c90: 55 push %ebp
2c91: 89 e5 mov %esp,%ebp
2c93: 53 push %ebx
for(n=0; n<1000; n++){
2c94: 31 db xor %ebx,%ebx
{
2c96: 83 ec 0c sub $0xc,%esp
printf(1, "fork test\n");
2c99: 68 18 4b 00 00 push $0x4b18
2c9e: 6a 01 push $0x1
2ca0: e8 9b 0d 00 00 call 3a40 <printf>
2ca5: 83 c4 10 add $0x10,%esp
2ca8: eb 13 jmp 2cbd <forktest+0x2d>
2caa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(pid == 0)
2cb0: 74 4a je 2cfc <forktest+0x6c>
for(n=0; n<1000; n++){
2cb2: 83 c3 01 add $0x1,%ebx
2cb5: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
2cbb: 74 6b je 2d28 <forktest+0x98>
pid = fork();
2cbd: e8 09 0c 00 00 call 38cb <fork>
if(pid < 0)
2cc2: 85 c0 test %eax,%eax
2cc4: 79 ea jns 2cb0 <forktest+0x20>
for(; n > 0; n--){
2cc6: 85 db test %ebx,%ebx
2cc8: 74 14 je 2cde <forktest+0x4e>
2cca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(wait() < 0){
2cd0: e8 06 0c 00 00 call 38db <wait>
2cd5: 85 c0 test %eax,%eax
2cd7: 78 28 js 2d01 <forktest+0x71>
for(; n > 0; n--){
2cd9: 83 eb 01 sub $0x1,%ebx
2cdc: 75 f2 jne 2cd0 <forktest+0x40>
if(wait() != -1){
2cde: e8 f8 0b 00 00 call 38db <wait>
2ce3: 83 f8 ff cmp $0xffffffff,%eax
2ce6: 75 2d jne 2d15 <forktest+0x85>
printf(1, "fork test OK\n");
2ce8: 83 ec 08 sub $0x8,%esp
2ceb: 68 4a 4b 00 00 push $0x4b4a
2cf0: 6a 01 push $0x1
2cf2: e8 49 0d 00 00 call 3a40 <printf>
}
2cf7: 8b 5d fc mov -0x4(%ebp),%ebx
2cfa: c9 leave
2cfb: c3 ret
exit();
2cfc: e8 d2 0b 00 00 call 38d3 <exit>
printf(1, "wait stopped early\n");
2d01: 83 ec 08 sub $0x8,%esp
2d04: 68 23 4b 00 00 push $0x4b23
2d09: 6a 01 push $0x1
2d0b: e8 30 0d 00 00 call 3a40 <printf>
exit();
2d10: e8 be 0b 00 00 call 38d3 <exit>
printf(1, "wait got too many\n");
2d15: 52 push %edx
2d16: 52 push %edx
2d17: 68 37 4b 00 00 push $0x4b37
2d1c: 6a 01 push $0x1
2d1e: e8 1d 0d 00 00 call 3a40 <printf>
exit();
2d23: e8 ab 0b 00 00 call 38d3 <exit>
printf(1, "fork claimed to work 1000 times!\n");
2d28: 50 push %eax
2d29: 50 push %eax
2d2a: 68 b8 52 00 00 push $0x52b8
2d2f: 6a 01 push $0x1
2d31: e8 0a 0d 00 00 call 3a40 <printf>
exit();
2d36: e8 98 0b 00 00 call 38d3 <exit>
2d3b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2d3f: 90 nop
00002d40 <sbrktest>:
{
2d40: 55 push %ebp
2d41: 89 e5 mov %esp,%ebp
2d43: 57 push %edi
2d44: 56 push %esi
for(i = 0; i < 5000; i++){
2d45: 31 f6 xor %esi,%esi
{
2d47: 53 push %ebx
2d48: 83 ec 64 sub $0x64,%esp
printf(stdout, "sbrk test\n");
2d4b: 68 58 4b 00 00 push $0x4b58
2d50: ff 35 78 55 00 00 push 0x5578
2d56: e8 e5 0c 00 00 call 3a40 <printf>
oldbrk = sbrk(0);
2d5b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d62: e8 f4 0b 00 00 call 395b <sbrk>
a = sbrk(0);
2d67: c7 04 24 00 00 00 00 movl $0x0,(%esp)
oldbrk = sbrk(0);
2d6e: 89 45 a4 mov %eax,-0x5c(%ebp)
a = sbrk(0);
2d71: e8 e5 0b 00 00 call 395b <sbrk>
2d76: 83 c4 10 add $0x10,%esp
2d79: 89 c3 mov %eax,%ebx
for(i = 0; i < 5000; i++){
2d7b: eb 05 jmp 2d82 <sbrktest+0x42>
2d7d: 8d 76 00 lea 0x0(%esi),%esi
a = b + 1;
2d80: 89 c3 mov %eax,%ebx
b = sbrk(1);
2d82: 83 ec 0c sub $0xc,%esp
2d85: 6a 01 push $0x1
2d87: e8 cf 0b 00 00 call 395b <sbrk>
if(b != a){
2d8c: 83 c4 10 add $0x10,%esp
2d8f: 39 d8 cmp %ebx,%eax
2d91: 0f 85 9c 02 00 00 jne 3033 <sbrktest+0x2f3>
for(i = 0; i < 5000; i++){
2d97: 83 c6 01 add $0x1,%esi
*b = 1;
2d9a: c6 03 01 movb $0x1,(%ebx)
a = b + 1;
2d9d: 8d 43 01 lea 0x1(%ebx),%eax
for(i = 0; i < 5000; i++){
2da0: 81 fe 88 13 00 00 cmp $0x1388,%esi
2da6: 75 d8 jne 2d80 <sbrktest+0x40>
pid = fork();
2da8: e8 1e 0b 00 00 call 38cb <fork>
2dad: 89 c6 mov %eax,%esi
if(pid < 0){
2daf: 85 c0 test %eax,%eax
2db1: 0f 88 02 03 00 00 js 30b9 <sbrktest+0x379>
c = sbrk(1);
2db7: 83 ec 0c sub $0xc,%esp
if(c != a + 1){
2dba: 83 c3 02 add $0x2,%ebx
c = sbrk(1);
2dbd: 6a 01 push $0x1
2dbf: e8 97 0b 00 00 call 395b <sbrk>
c = sbrk(1);
2dc4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2dcb: e8 8b 0b 00 00 call 395b <sbrk>
if(c != a + 1){
2dd0: 83 c4 10 add $0x10,%esp
2dd3: 39 c3 cmp %eax,%ebx
2dd5: 0f 85 3b 03 00 00 jne 3116 <sbrktest+0x3d6>
if(pid == 0)
2ddb: 85 f6 test %esi,%esi
2ddd: 0f 84 2e 03 00 00 je 3111 <sbrktest+0x3d1>
wait();
2de3: e8 f3 0a 00 00 call 38db <wait>
a = sbrk(0);
2de8: 83 ec 0c sub $0xc,%esp
2deb: 6a 00 push $0x0
2ded: e8 69 0b 00 00 call 395b <sbrk>
2df2: 89 c3 mov %eax,%ebx
amt = (BIG) - (uint)a;
2df4: b8 00 00 40 06 mov $0x6400000,%eax
2df9: 29 d8 sub %ebx,%eax
p = sbrk(amt);
2dfb: 89 04 24 mov %eax,(%esp)
2dfe: e8 58 0b 00 00 call 395b <sbrk>
if (p != a) {
2e03: 83 c4 10 add $0x10,%esp
2e06: 39 c3 cmp %eax,%ebx
2e08: 0f 85 94 02 00 00 jne 30a2 <sbrktest+0x362>
a = sbrk(0);
2e0e: 83 ec 0c sub $0xc,%esp
*lastaddr = 99;
2e11: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
a = sbrk(0);
2e18: 6a 00 push $0x0
2e1a: e8 3c 0b 00 00 call 395b <sbrk>
c = sbrk(-4096);
2e1f: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
a = sbrk(0);
2e26: 89 c3 mov %eax,%ebx
c = sbrk(-4096);
2e28: e8 2e 0b 00 00 call 395b <sbrk>
if(c == (char*)0xffffffff){
2e2d: 83 c4 10 add $0x10,%esp
2e30: 83 f8 ff cmp $0xffffffff,%eax
2e33: 0f 84 22 03 00 00 je 315b <sbrktest+0x41b>
c = sbrk(0);
2e39: 83 ec 0c sub $0xc,%esp
2e3c: 6a 00 push $0x0
2e3e: e8 18 0b 00 00 call 395b <sbrk>
if(c != a - 4096){
2e43: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx
2e49: 83 c4 10 add $0x10,%esp
2e4c: 39 d0 cmp %edx,%eax
2e4e: 0f 85 f0 02 00 00 jne 3144 <sbrktest+0x404>
a = sbrk(0);
2e54: 83 ec 0c sub $0xc,%esp
2e57: 6a 00 push $0x0
2e59: e8 fd 0a 00 00 call 395b <sbrk>
c = sbrk(4096);
2e5e: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
a = sbrk(0);
2e65: 89 c3 mov %eax,%ebx
c = sbrk(4096);
2e67: e8 ef 0a 00 00 call 395b <sbrk>
if(c != a || sbrk(0) != a + 4096){
2e6c: 83 c4 10 add $0x10,%esp
c = sbrk(4096);
2e6f: 89 c6 mov %eax,%esi
if(c != a || sbrk(0) != a + 4096){
2e71: 39 c3 cmp %eax,%ebx
2e73: 0f 85 b4 02 00 00 jne 312d <sbrktest+0x3ed>
2e79: 83 ec 0c sub $0xc,%esp
2e7c: 6a 00 push $0x0
2e7e: e8 d8 0a 00 00 call 395b <sbrk>
2e83: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx
2e89: 83 c4 10 add $0x10,%esp
2e8c: 39 c2 cmp %eax,%edx
2e8e: 0f 85 99 02 00 00 jne 312d <sbrktest+0x3ed>
if(*lastaddr == 99){
2e94: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
2e9b: 0f 84 2f 02 00 00 je 30d0 <sbrktest+0x390>
a = sbrk(0);
2ea1: 83 ec 0c sub $0xc,%esp
2ea4: 6a 00 push $0x0
2ea6: e8 b0 0a 00 00 call 395b <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
2eab: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a = sbrk(0);
2eb2: 89 c3 mov %eax,%ebx
c = sbrk(-(sbrk(0) - oldbrk));
2eb4: e8 a2 0a 00 00 call 395b <sbrk>
2eb9: 89 c2 mov %eax,%edx
2ebb: 8b 45 a4 mov -0x5c(%ebp),%eax
2ebe: 29 d0 sub %edx,%eax
2ec0: 89 04 24 mov %eax,(%esp)
2ec3: e8 93 0a 00 00 call 395b <sbrk>
if(c != a){
2ec8: 83 c4 10 add $0x10,%esp
2ecb: 39 c3 cmp %eax,%ebx
2ecd: 0f 85 b8 01 00 00 jne 308b <sbrktest+0x34b>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
2ed3: bb 00 00 00 80 mov $0x80000000,%ebx
2ed8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2edf: 90 nop
ppid = getpid();
2ee0: e8 6e 0a 00 00 call 3953 <getpid>
2ee5: 89 c6 mov %eax,%esi
pid = fork();
2ee7: e8 df 09 00 00 call 38cb <fork>
if(pid < 0){
2eec: 85 c0 test %eax,%eax
2eee: 0f 88 5d 01 00 00 js 3051 <sbrktest+0x311>
if(pid == 0){
2ef4: 0f 84 6f 01 00 00 je 3069 <sbrktest+0x329>
wait();
2efa: e8 dc 09 00 00 call 38db <wait>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
2eff: 81 c3 50 c3 00 00 add $0xc350,%ebx
2f05: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx
2f0b: 75 d3 jne 2ee0 <sbrktest+0x1a0>
if(pipe(fds) != 0){
2f0d: 83 ec 0c sub $0xc,%esp
2f10: 8d 45 b8 lea -0x48(%ebp),%eax
2f13: 50 push %eax
2f14: e8 ca 09 00 00 call 38e3 <pipe>
2f19: 83 c4 10 add $0x10,%esp
2f1c: 85 c0 test %eax,%eax
2f1e: 0f 85 da 01 00 00 jne 30fe <sbrktest+0x3be>
2f24: 8d 5d c0 lea -0x40(%ebp),%ebx
2f27: 8d 75 e8 lea -0x18(%ebp),%esi
2f2a: 89 df mov %ebx,%edi
2f2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((pids[i] = fork()) == 0){
2f30: e8 96 09 00 00 call 38cb <fork>
2f35: 89 07 mov %eax,(%edi)
2f37: 85 c0 test %eax,%eax
2f39: 0f 84 91 00 00 00 je 2fd0 <sbrktest+0x290>
if(pids[i] != -1)
2f3f: 83 f8 ff cmp $0xffffffff,%eax
2f42: 74 14 je 2f58 <sbrktest+0x218>
read(fds[0], &scratch, 1);
2f44: 83 ec 04 sub $0x4,%esp
2f47: 8d 45 b7 lea -0x49(%ebp),%eax
2f4a: 6a 01 push $0x1
2f4c: 50 push %eax
2f4d: ff 75 b8 push -0x48(%ebp)
2f50: e8 96 09 00 00 call 38eb <read>
2f55: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f58: 83 c7 04 add $0x4,%edi
2f5b: 39 f7 cmp %esi,%edi
2f5d: 75 d1 jne 2f30 <sbrktest+0x1f0>
c = sbrk(4096);
2f5f: 83 ec 0c sub $0xc,%esp
2f62: 68 00 10 00 00 push $0x1000
2f67: e8 ef 09 00 00 call 395b <sbrk>
2f6c: 83 c4 10 add $0x10,%esp
2f6f: 89 c7 mov %eax,%edi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(pids[i] == -1)
2f78: 8b 03 mov (%ebx),%eax
2f7a: 83 f8 ff cmp $0xffffffff,%eax
2f7d: 74 11 je 2f90 <sbrktest+0x250>
kill(pids[i]);
2f7f: 83 ec 0c sub $0xc,%esp
2f82: 50 push %eax
2f83: e8 7b 09 00 00 call 3903 <kill>
wait();
2f88: e8 4e 09 00 00 call 38db <wait>
2f8d: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f90: 83 c3 04 add $0x4,%ebx
2f93: 39 de cmp %ebx,%esi
2f95: 75 e1 jne 2f78 <sbrktest+0x238>
if(c == (char*)0xffffffff){
2f97: 83 ff ff cmp $0xffffffff,%edi
2f9a: 0f 84 47 01 00 00 je 30e7 <sbrktest+0x3a7>
if(sbrk(0) > oldbrk)
2fa0: 83 ec 0c sub $0xc,%esp
2fa3: 6a 00 push $0x0
2fa5: e8 b1 09 00 00 call 395b <sbrk>
2faa: 83 c4 10 add $0x10,%esp
2fad: 39 45 a4 cmp %eax,-0x5c(%ebp)
2fb0: 72 60 jb 3012 <sbrktest+0x2d2>
printf(stdout, "sbrk test OK\n");
2fb2: 83 ec 08 sub $0x8,%esp
2fb5: 68 00 4c 00 00 push $0x4c00
2fba: ff 35 78 55 00 00 push 0x5578
2fc0: e8 7b 0a 00 00 call 3a40 <printf>
}
2fc5: 83 c4 10 add $0x10,%esp
2fc8: 8d 65 f4 lea -0xc(%ebp),%esp
2fcb: 5b pop %ebx
2fcc: 5e pop %esi
2fcd: 5f pop %edi
2fce: 5d pop %ebp
2fcf: c3 ret
sbrk(BIG - (uint)sbrk(0));
2fd0: 83 ec 0c sub $0xc,%esp
2fd3: 6a 00 push $0x0
2fd5: e8 81 09 00 00 call 395b <sbrk>
2fda: 89 c2 mov %eax,%edx
2fdc: b8 00 00 40 06 mov $0x6400000,%eax
2fe1: 29 d0 sub %edx,%eax
2fe3: 89 04 24 mov %eax,(%esp)
2fe6: e8 70 09 00 00 call 395b <sbrk>
write(fds[1], "x", 1);
2feb: 83 c4 0c add $0xc,%esp
2fee: 6a 01 push $0x1
2ff0: 68 c1 46 00 00 push $0x46c1
2ff5: ff 75 bc push -0x44(%ebp)
2ff8: e8 f6 08 00 00 call 38f3 <write>
2ffd: 83 c4 10 add $0x10,%esp
for(;;) sleep(1000);
3000: 83 ec 0c sub $0xc,%esp
3003: 68 e8 03 00 00 push $0x3e8
3008: e8 56 09 00 00 call 3963 <sleep>
300d: 83 c4 10 add $0x10,%esp
3010: eb ee jmp 3000 <sbrktest+0x2c0>
sbrk(-(sbrk(0) - oldbrk));
3012: 83 ec 0c sub $0xc,%esp
3015: 6a 00 push $0x0
3017: e8 3f 09 00 00 call 395b <sbrk>
301c: 89 c2 mov %eax,%edx
301e: 8b 45 a4 mov -0x5c(%ebp),%eax
3021: 29 d0 sub %edx,%eax
3023: 89 04 24 mov %eax,(%esp)
3026: e8 30 09 00 00 call 395b <sbrk>
302b: 83 c4 10 add $0x10,%esp
302e: e9 7f ff ff ff jmp 2fb2 <sbrktest+0x272>
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
3033: 83 ec 0c sub $0xc,%esp
3036: 50 push %eax
3037: 53 push %ebx
3038: 56 push %esi
3039: 68 63 4b 00 00 push $0x4b63
303e: ff 35 78 55 00 00 push 0x5578
3044: e8 f7 09 00 00 call 3a40 <printf>
exit();
3049: 83 c4 20 add $0x20,%esp
304c: e8 82 08 00 00 call 38d3 <exit>
printf(stdout, "fork failed\n");
3051: 83 ec 08 sub $0x8,%esp
3054: 68 a9 4c 00 00 push $0x4ca9
3059: ff 35 78 55 00 00 push 0x5578
305f: e8 dc 09 00 00 call 3a40 <printf>
exit();
3064: e8 6a 08 00 00 call 38d3 <exit>
printf(stdout, "oops could read %x = %x\n", a, *a);
3069: 0f be 03 movsbl (%ebx),%eax
306c: 50 push %eax
306d: 53 push %ebx
306e: 68 cc 4b 00 00 push $0x4bcc
3073: ff 35 78 55 00 00 push 0x5578
3079: e8 c2 09 00 00 call 3a40 <printf>
kill(ppid);
307e: 89 34 24 mov %esi,(%esp)
3081: e8 7d 08 00 00 call 3903 <kill>
exit();
3086: e8 48 08 00 00 call 38d3 <exit>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
308b: 50 push %eax
308c: 53 push %ebx
308d: 68 ac 53 00 00 push $0x53ac
3092: ff 35 78 55 00 00 push 0x5578
3098: e8 a3 09 00 00 call 3a40 <printf>
exit();
309d: e8 31 08 00 00 call 38d3 <exit>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
30a2: 56 push %esi
30a3: 56 push %esi
30a4: 68 dc 52 00 00 push $0x52dc
30a9: ff 35 78 55 00 00 push 0x5578
30af: e8 8c 09 00 00 call 3a40 <printf>
exit();
30b4: e8 1a 08 00 00 call 38d3 <exit>
printf(stdout, "sbrk test fork failed\n");
30b9: 50 push %eax
30ba: 50 push %eax
30bb: 68 7e 4b 00 00 push $0x4b7e
30c0: ff 35 78 55 00 00 push 0x5578
30c6: e8 75 09 00 00 call 3a40 <printf>
exit();
30cb: e8 03 08 00 00 call 38d3 <exit>
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
30d0: 51 push %ecx
30d1: 51 push %ecx
30d2: 68 7c 53 00 00 push $0x537c
30d7: ff 35 78 55 00 00 push 0x5578
30dd: e8 5e 09 00 00 call 3a40 <printf>
exit();
30e2: e8 ec 07 00 00 call 38d3 <exit>
printf(stdout, "failed sbrk leaked memory\n");
30e7: 50 push %eax
30e8: 50 push %eax
30e9: 68 e5 4b 00 00 push $0x4be5
30ee: ff 35 78 55 00 00 push 0x5578
30f4: e8 47 09 00 00 call 3a40 <printf>
exit();
30f9: e8 d5 07 00 00 call 38d3 <exit>
printf(1, "pipe() failed\n");
30fe: 52 push %edx
30ff: 52 push %edx
3100: 68 a1 40 00 00 push $0x40a1
3105: 6a 01 push $0x1
3107: e8 34 09 00 00 call 3a40 <printf>
exit();
310c: e8 c2 07 00 00 call 38d3 <exit>
exit();
3111: e8 bd 07 00 00 call 38d3 <exit>
printf(stdout, "sbrk test failed post-fork\n");
3116: 57 push %edi
3117: 57 push %edi
3118: 68 95 4b 00 00 push $0x4b95
311d: ff 35 78 55 00 00 push 0x5578
3123: e8 18 09 00 00 call 3a40 <printf>
exit();
3128: e8 a6 07 00 00 call 38d3 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
312d: 56 push %esi
312e: 53 push %ebx
312f: 68 54 53 00 00 push $0x5354
3134: ff 35 78 55 00 00 push 0x5578
313a: e8 01 09 00 00 call 3a40 <printf>
exit();
313f: e8 8f 07 00 00 call 38d3 <exit>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
3144: 50 push %eax
3145: 53 push %ebx
3146: 68 1c 53 00 00 push $0x531c
314b: ff 35 78 55 00 00 push 0x5578
3151: e8 ea 08 00 00 call 3a40 <printf>
exit();
3156: e8 78 07 00 00 call 38d3 <exit>
printf(stdout, "sbrk could not deallocate\n");
315b: 53 push %ebx
315c: 53 push %ebx
315d: 68 b1 4b 00 00 push $0x4bb1
3162: ff 35 78 55 00 00 push 0x5578
3168: e8 d3 08 00 00 call 3a40 <printf>
exit();
316d: e8 61 07 00 00 call 38d3 <exit>
3172: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003180 <validateint>:
}
3180: c3 ret
3181: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3188: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
318f: 90 nop
00003190 <validatetest>:
{
3190: 55 push %ebp
3191: 89 e5 mov %esp,%ebp
3193: 56 push %esi
for(p = 0; p <= (uint)hi; p += 4096){
3194: 31 f6 xor %esi,%esi
{
3196: 53 push %ebx
printf(stdout, "validate test\n");
3197: 83 ec 08 sub $0x8,%esp
319a: 68 0e 4c 00 00 push $0x4c0e
319f: ff 35 78 55 00 00 push 0x5578
31a5: e8 96 08 00 00 call 3a40 <printf>
31aa: 83 c4 10 add $0x10,%esp
31ad: 8d 76 00 lea 0x0(%esi),%esi
if((pid = fork()) == 0){
31b0: e8 16 07 00 00 call 38cb <fork>
31b5: 89 c3 mov %eax,%ebx
31b7: 85 c0 test %eax,%eax
31b9: 74 63 je 321e <validatetest+0x8e>
sleep(0);
31bb: 83 ec 0c sub $0xc,%esp
31be: 6a 00 push $0x0
31c0: e8 9e 07 00 00 call 3963 <sleep>
sleep(0);
31c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
31cc: e8 92 07 00 00 call 3963 <sleep>
kill(pid);
31d1: 89 1c 24 mov %ebx,(%esp)
31d4: e8 2a 07 00 00 call 3903 <kill>
wait();
31d9: e8 fd 06 00 00 call 38db <wait>
if(link("nosuchfile", (char*)p) != -1){
31de: 58 pop %eax
31df: 5a pop %edx
31e0: 56 push %esi
31e1: 68 1d 4c 00 00 push $0x4c1d
31e6: e8 48 07 00 00 call 3933 <link>
31eb: 83 c4 10 add $0x10,%esp
31ee: 83 f8 ff cmp $0xffffffff,%eax
31f1: 75 30 jne 3223 <validatetest+0x93>
for(p = 0; p <= (uint)hi; p += 4096){
31f3: 81 c6 00 10 00 00 add $0x1000,%esi
31f9: 81 fe 00 40 11 00 cmp $0x114000,%esi
31ff: 75 af jne 31b0 <validatetest+0x20>
printf(stdout, "validate ok\n");
3201: 83 ec 08 sub $0x8,%esp
3204: 68 41 4c 00 00 push $0x4c41
3209: ff 35 78 55 00 00 push 0x5578
320f: e8 2c 08 00 00 call 3a40 <printf>
}
3214: 83 c4 10 add $0x10,%esp
3217: 8d 65 f8 lea -0x8(%ebp),%esp
321a: 5b pop %ebx
321b: 5e pop %esi
321c: 5d pop %ebp
321d: c3 ret
exit();
321e: e8 b0 06 00 00 call 38d3 <exit>
printf(stdout, "link should not succeed\n");
3223: 83 ec 08 sub $0x8,%esp
3226: 68 28 4c 00 00 push $0x4c28
322b: ff 35 78 55 00 00 push 0x5578
3231: e8 0a 08 00 00 call 3a40 <printf>
exit();
3236: e8 98 06 00 00 call 38d3 <exit>
323b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
323f: 90 nop
00003240 <bsstest>:
{
3240: 55 push %ebp
3241: 89 e5 mov %esp,%ebp
3243: 83 ec 10 sub $0x10,%esp
printf(stdout, "bss test\n");
3246: 68 4e 4c 00 00 push $0x4c4e
324b: ff 35 78 55 00 00 push 0x5578
3251: e8 ea 07 00 00 call 3a40 <printf>
3256: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(uninit); i++){
3259: 31 c0 xor %eax,%eax
325b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
325f: 90 nop
if(uninit[i] != '\0'){
3260: 80 b8 a0 55 00 00 00 cmpb $0x0,0x55a0(%eax)
3267: 75 22 jne 328b <bsstest+0x4b>
for(i = 0; i < sizeof(uninit); i++){
3269: 83 c0 01 add $0x1,%eax
326c: 3d 10 27 00 00 cmp $0x2710,%eax
3271: 75 ed jne 3260 <bsstest+0x20>
printf(stdout, "bss test ok\n");
3273: 83 ec 08 sub $0x8,%esp
3276: 68 69 4c 00 00 push $0x4c69
327b: ff 35 78 55 00 00 push 0x5578
3281: e8 ba 07 00 00 call 3a40 <printf>
}
3286: 83 c4 10 add $0x10,%esp
3289: c9 leave
328a: c3 ret
printf(stdout, "bss test failed\n");
328b: 83 ec 08 sub $0x8,%esp
328e: 68 58 4c 00 00 push $0x4c58
3293: ff 35 78 55 00 00 push 0x5578
3299: e8 a2 07 00 00 call 3a40 <printf>
exit();
329e: e8 30 06 00 00 call 38d3 <exit>
32a3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
32aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000032b0 <bigargtest>:
{
32b0: 55 push %ebp
32b1: 89 e5 mov %esp,%ebp
32b3: 83 ec 14 sub $0x14,%esp
unlink("bigarg-ok");
32b6: 68 76 4c 00 00 push $0x4c76
32bb: e8 63 06 00 00 call 3923 <unlink>
pid = fork();
32c0: e8 06 06 00 00 call 38cb <fork>
if(pid == 0){
32c5: 83 c4 10 add $0x10,%esp
32c8: 85 c0 test %eax,%eax
32ca: 74 44 je 3310 <bigargtest+0x60>
} else if(pid < 0){
32cc: 0f 88 c5 00 00 00 js 3397 <bigargtest+0xe7>
wait();
32d2: e8 04 06 00 00 call 38db <wait>
fd = open("bigarg-ok", 0);
32d7: 83 ec 08 sub $0x8,%esp
32da: 6a 00 push $0x0
32dc: 68 76 4c 00 00 push $0x4c76
32e1: e8 2d 06 00 00 call 3913 <open>
if(fd < 0){
32e6: 83 c4 10 add $0x10,%esp
32e9: 85 c0 test %eax,%eax
32eb: 0f 88 8f 00 00 00 js 3380 <bigargtest+0xd0>
close(fd);
32f1: 83 ec 0c sub $0xc,%esp
32f4: 50 push %eax
32f5: e8 01 06 00 00 call 38fb <close>
unlink("bigarg-ok");
32fa: c7 04 24 76 4c 00 00 movl $0x4c76,(%esp)
3301: e8 1d 06 00 00 call 3923 <unlink>
}
3306: 83 c4 10 add $0x10,%esp
3309: c9 leave
330a: c3 ret
330b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
330f: 90 nop
args[i] = "bigargs test: failed\n ";
3310: c7 04 85 c0 9c 00 00 movl $0x53d0,0x9cc0(,%eax,4)
3317: d0 53 00 00
for(i = 0; i < MAXARG-1; i++)
331b: 83 c0 01 add $0x1,%eax
331e: 83 f8 1f cmp $0x1f,%eax
3321: 75 ed jne 3310 <bigargtest+0x60>
printf(stdout, "bigarg test\n");
3323: 51 push %ecx
3324: 51 push %ecx
3325: 68 80 4c 00 00 push $0x4c80
332a: ff 35 78 55 00 00 push 0x5578
args[MAXARG-1] = 0;
3330: c7 05 3c 9d 00 00 00 movl $0x0,0x9d3c
3337: 00 00 00
printf(stdout, "bigarg test\n");
333a: e8 01 07 00 00 call 3a40 <printf>
exec("echo", args);
333f: 58 pop %eax
3340: 5a pop %edx
3341: 68 c0 9c 00 00 push $0x9cc0
3346: 68 4d 3e 00 00 push $0x3e4d
334b: e8 bb 05 00 00 call 390b <exec>
printf(stdout, "bigarg test ok\n");
3350: 59 pop %ecx
3351: 58 pop %eax
3352: 68 8d 4c 00 00 push $0x4c8d
3357: ff 35 78 55 00 00 push 0x5578
335d: e8 de 06 00 00 call 3a40 <printf>
fd = open("bigarg-ok", O_CREATE);
3362: 58 pop %eax
3363: 5a pop %edx
3364: 68 00 02 00 00 push $0x200
3369: 68 76 4c 00 00 push $0x4c76
336e: e8 a0 05 00 00 call 3913 <open>
close(fd);
3373: 89 04 24 mov %eax,(%esp)
3376: e8 80 05 00 00 call 38fb <close>
exit();
337b: e8 53 05 00 00 call 38d3 <exit>
printf(stdout, "bigarg test failed!\n");
3380: 50 push %eax
3381: 50 push %eax
3382: 68 b6 4c 00 00 push $0x4cb6
3387: ff 35 78 55 00 00 push 0x5578
338d: e8 ae 06 00 00 call 3a40 <printf>
exit();
3392: e8 3c 05 00 00 call 38d3 <exit>
printf(stdout, "bigargtest: fork failed\n");
3397: 52 push %edx
3398: 52 push %edx
3399: 68 9d 4c 00 00 push $0x4c9d
339e: ff 35 78 55 00 00 push 0x5578
33a4: e8 97 06 00 00 call 3a40 <printf>
exit();
33a9: e8 25 05 00 00 call 38d3 <exit>
33ae: 66 90 xchg %ax,%ax
000033b0 <fsfull>:
{
33b0: 55 push %ebp
33b1: 89 e5 mov %esp,%ebp
33b3: 57 push %edi
33b4: 56 push %esi
for(nfiles = 0; ; nfiles++){
33b5: 31 f6 xor %esi,%esi
{
33b7: 53 push %ebx
33b8: 83 ec 54 sub $0x54,%esp
printf(1, "fsfull test\n");
33bb: 68 cb 4c 00 00 push $0x4ccb
33c0: 6a 01 push $0x1
33c2: e8 79 06 00 00 call 3a40 <printf>
33c7: 83 c4 10 add $0x10,%esp
33ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
33d0: b8 d3 4d 62 10 mov $0x10624dd3,%eax
name[3] = '0' + (nfiles % 100) / 10;
33d5: b9 cd cc cc cc mov $0xcccccccd,%ecx
printf(1, "writing %s\n", name);
33da: 83 ec 04 sub $0x4,%esp
name[0] = 'f';
33dd: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
33e1: f7 e6 mul %esi
name[5] = '\0';
33e3: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
33e7: c1 ea 06 shr $0x6,%edx
33ea: 8d 42 30 lea 0x30(%edx),%eax
33ed: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
33f0: 69 c2 e8 03 00 00 imul $0x3e8,%edx,%eax
33f6: 89 f2 mov %esi,%edx
33f8: 29 c2 sub %eax,%edx
33fa: b8 1f 85 eb 51 mov $0x51eb851f,%eax
33ff: f7 e2 mul %edx
name[3] = '0' + (nfiles % 100) / 10;
3401: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3406: c1 ea 05 shr $0x5,%edx
3409: 83 c2 30 add $0x30,%edx
340c: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
340f: f7 e6 mul %esi
3411: c1 ea 05 shr $0x5,%edx
3414: 6b c2 64 imul $0x64,%edx,%eax
3417: 89 f2 mov %esi,%edx
3419: 29 c2 sub %eax,%edx
341b: 89 d0 mov %edx,%eax
341d: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
341f: 89 f0 mov %esi,%eax
name[3] = '0' + (nfiles % 100) / 10;
3421: c1 ea 03 shr $0x3,%edx
3424: 83 c2 30 add $0x30,%edx
3427: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
342a: f7 e1 mul %ecx
342c: 89 f0 mov %esi,%eax
342e: c1 ea 03 shr $0x3,%edx
3431: 8d 14 92 lea (%edx,%edx,4),%edx
3434: 01 d2 add %edx,%edx
3436: 29 d0 sub %edx,%eax
3438: 83 c0 30 add $0x30,%eax
343b: 88 45 ac mov %al,-0x54(%ebp)
printf(1, "writing %s\n", name);
343e: 8d 45 a8 lea -0x58(%ebp),%eax
3441: 50 push %eax
3442: 68 d8 4c 00 00 push $0x4cd8
3447: 6a 01 push $0x1
3449: e8 f2 05 00 00 call 3a40 <printf>
int fd = open(name, O_CREATE|O_RDWR);
344e: 58 pop %eax
344f: 8d 45 a8 lea -0x58(%ebp),%eax
3452: 5a pop %edx
3453: 68 02 02 00 00 push $0x202
3458: 50 push %eax
3459: e8 b5 04 00 00 call 3913 <open>
if(fd < 0){
345e: 83 c4 10 add $0x10,%esp
int fd = open(name, O_CREATE|O_RDWR);
3461: 89 c7 mov %eax,%edi
if(fd < 0){
3463: 85 c0 test %eax,%eax
3465: 78 4f js 34b6 <fsfull+0x106>
int total = 0;
3467: 31 db xor %ebx,%ebx
3469: eb 07 jmp 3472 <fsfull+0xc2>
346b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
346f: 90 nop
total += cc;
3470: 01 c3 add %eax,%ebx
int cc = write(fd, buf, 512);
3472: 83 ec 04 sub $0x4,%esp
3475: 68 00 02 00 00 push $0x200
347a: 68 c0 7c 00 00 push $0x7cc0
347f: 57 push %edi
3480: e8 6e 04 00 00 call 38f3 <write>
if(cc < 512)
3485: 83 c4 10 add $0x10,%esp
3488: 3d ff 01 00 00 cmp $0x1ff,%eax
348d: 7f e1 jg 3470 <fsfull+0xc0>
printf(1, "wrote %d bytes\n", total);
348f: 83 ec 04 sub $0x4,%esp
3492: 53 push %ebx
3493: 68 f4 4c 00 00 push $0x4cf4
3498: 6a 01 push $0x1
349a: e8 a1 05 00 00 call 3a40 <printf>
close(fd);
349f: 89 3c 24 mov %edi,(%esp)
34a2: e8 54 04 00 00 call 38fb <close>
if(total == 0)
34a7: 83 c4 10 add $0x10,%esp
34aa: 85 db test %ebx,%ebx
34ac: 74 1e je 34cc <fsfull+0x11c>
for(nfiles = 0; ; nfiles++){
34ae: 83 c6 01 add $0x1,%esi
34b1: e9 1a ff ff ff jmp 33d0 <fsfull+0x20>
printf(1, "open %s failed\n", name);
34b6: 83 ec 04 sub $0x4,%esp
34b9: 8d 45 a8 lea -0x58(%ebp),%eax
34bc: 50 push %eax
34bd: 68 e4 4c 00 00 push $0x4ce4
34c2: 6a 01 push $0x1
34c4: e8 77 05 00 00 call 3a40 <printf>
break;
34c9: 83 c4 10 add $0x10,%esp
name[1] = '0' + nfiles / 1000;
34cc: bf d3 4d 62 10 mov $0x10624dd3,%edi
name[2] = '0' + (nfiles % 1000) / 100;
34d1: bb 1f 85 eb 51 mov $0x51eb851f,%ebx
34d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
34dd: 8d 76 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
34e0: 89 f0 mov %esi,%eax
unlink(name);
34e2: 83 ec 0c sub $0xc,%esp
name[0] = 'f';
34e5: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
34e9: f7 e7 mul %edi
name[5] = '\0';
34eb: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
34ef: c1 ea 06 shr $0x6,%edx
34f2: 8d 42 30 lea 0x30(%edx),%eax
34f5: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
34f8: 69 c2 e8 03 00 00 imul $0x3e8,%edx,%eax
34fe: 89 f2 mov %esi,%edx
3500: 29 c2 sub %eax,%edx
3502: 89 d0 mov %edx,%eax
3504: f7 e3 mul %ebx
name[3] = '0' + (nfiles % 100) / 10;
3506: 89 f0 mov %esi,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3508: c1 ea 05 shr $0x5,%edx
350b: 83 c2 30 add $0x30,%edx
350e: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3511: f7 e3 mul %ebx
3513: c1 ea 05 shr $0x5,%edx
3516: 6b ca 64 imul $0x64,%edx,%ecx
3519: 89 f2 mov %esi,%edx
351b: 29 ca sub %ecx,%edx
351d: b9 cd cc cc cc mov $0xcccccccd,%ecx
3522: 89 d0 mov %edx,%eax
3524: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
3526: 89 f0 mov %esi,%eax
name[3] = '0' + (nfiles % 100) / 10;
3528: c1 ea 03 shr $0x3,%edx
352b: 83 c2 30 add $0x30,%edx
352e: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
3531: f7 e1 mul %ecx
3533: 89 f0 mov %esi,%eax
nfiles--;
3535: 83 ee 01 sub $0x1,%esi
name[4] = '0' + (nfiles % 10);
3538: c1 ea 03 shr $0x3,%edx
353b: 8d 14 92 lea (%edx,%edx,4),%edx
353e: 01 d2 add %edx,%edx
3540: 29 d0 sub %edx,%eax
3542: 83 c0 30 add $0x30,%eax
3545: 88 45 ac mov %al,-0x54(%ebp)
unlink(name);
3548: 8d 45 a8 lea -0x58(%ebp),%eax
354b: 50 push %eax
354c: e8 d2 03 00 00 call 3923 <unlink>
while(nfiles >= 0){
3551: 83 c4 10 add $0x10,%esp
3554: 83 fe ff cmp $0xffffffff,%esi
3557: 75 87 jne 34e0 <fsfull+0x130>
printf(1, "fsfull test finished\n");
3559: 83 ec 08 sub $0x8,%esp
355c: 68 04 4d 00 00 push $0x4d04
3561: 6a 01 push $0x1
3563: e8 d8 04 00 00 call 3a40 <printf>
}
3568: 83 c4 10 add $0x10,%esp
356b: 8d 65 f4 lea -0xc(%ebp),%esp
356e: 5b pop %ebx
356f: 5e pop %esi
3570: 5f pop %edi
3571: 5d pop %ebp
3572: c3 ret
3573: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
357a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003580 <uio>:
{
3580: 55 push %ebp
3581: 89 e5 mov %esp,%ebp
3583: 83 ec 10 sub $0x10,%esp
printf(1, "uio test\n");
3586: 68 1a 4d 00 00 push $0x4d1a
358b: 6a 01 push $0x1
358d: e8 ae 04 00 00 call 3a40 <printf>
pid = fork();
3592: e8 34 03 00 00 call 38cb <fork>
if(pid == 0){
3597: 83 c4 10 add $0x10,%esp
359a: 85 c0 test %eax,%eax
359c: 74 1b je 35b9 <uio+0x39>
} else if(pid < 0){
359e: 78 3d js 35dd <uio+0x5d>
wait();
35a0: e8 36 03 00 00 call 38db <wait>
printf(1, "uio test done\n");
35a5: 83 ec 08 sub $0x8,%esp
35a8: 68 24 4d 00 00 push $0x4d24
35ad: 6a 01 push $0x1
35af: e8 8c 04 00 00 call 3a40 <printf>
}
35b4: 83 c4 10 add $0x10,%esp
35b7: c9 leave
35b8: c3 ret
asm volatile("outb %0,%1"::"a"(val), "d" (port));
35b9: b8 09 00 00 00 mov $0x9,%eax
35be: ba 70 00 00 00 mov $0x70,%edx
35c3: ee out %al,(%dx)
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
35c4: ba 71 00 00 00 mov $0x71,%edx
35c9: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
35ca: 52 push %edx
35cb: 52 push %edx
35cc: 68 b0 54 00 00 push $0x54b0
35d1: 6a 01 push $0x1
35d3: e8 68 04 00 00 call 3a40 <printf>
exit();
35d8: e8 f6 02 00 00 call 38d3 <exit>
printf (1, "fork failed\n");
35dd: 50 push %eax
35de: 50 push %eax
35df: 68 a9 4c 00 00 push $0x4ca9
35e4: 6a 01 push $0x1
35e6: e8 55 04 00 00 call 3a40 <printf>
exit();
35eb: e8 e3 02 00 00 call 38d3 <exit>
000035f0 <argptest>:
{
35f0: 55 push %ebp
35f1: 89 e5 mov %esp,%ebp
35f3: 53 push %ebx
35f4: 83 ec 0c sub $0xc,%esp
fd = open("init", O_RDONLY);
35f7: 6a 00 push $0x0
35f9: 68 33 4d 00 00 push $0x4d33
35fe: e8 10 03 00 00 call 3913 <open>
if (fd < 0) {
3603: 83 c4 10 add $0x10,%esp
3606: 85 c0 test %eax,%eax
3608: 78 39 js 3643 <argptest+0x53>
read(fd, sbrk(0) - 1, -1);
360a: 83 ec 0c sub $0xc,%esp
360d: 89 c3 mov %eax,%ebx
360f: 6a 00 push $0x0
3611: e8 45 03 00 00 call 395b <sbrk>
3616: 83 c4 0c add $0xc,%esp
3619: 83 e8 01 sub $0x1,%eax
361c: 6a ff push $0xffffffff
361e: 50 push %eax
361f: 53 push %ebx
3620: e8 c6 02 00 00 call 38eb <read>
close(fd);
3625: 89 1c 24 mov %ebx,(%esp)
3628: e8 ce 02 00 00 call 38fb <close>
printf(1, "arg test passed\n");
362d: 58 pop %eax
362e: 5a pop %edx
362f: 68 45 4d 00 00 push $0x4d45
3634: 6a 01 push $0x1
3636: e8 05 04 00 00 call 3a40 <printf>
}
363b: 8b 5d fc mov -0x4(%ebp),%ebx
363e: 83 c4 10 add $0x10,%esp
3641: c9 leave
3642: c3 ret
printf(2, "open failed\n");
3643: 51 push %ecx
3644: 51 push %ecx
3645: 68 38 4d 00 00 push $0x4d38
364a: 6a 02 push $0x2
364c: e8 ef 03 00 00 call 3a40 <printf>
exit();
3651: e8 7d 02 00 00 call 38d3 <exit>
3656: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
365d: 8d 76 00 lea 0x0(%esi),%esi
00003660 <rand>:
randstate = randstate * 1664525 + 1013904223;
3660: 69 05 74 55 00 00 0d imul $0x19660d,0x5574,%eax
3667: 66 19 00
366a: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
366f: a3 74 55 00 00 mov %eax,0x5574
}
3674: c3 ret
3675: 66 90 xchg %ax,%ax
3677: 66 90 xchg %ax,%ax
3679: 66 90 xchg %ax,%ax
367b: 66 90 xchg %ax,%ax
367d: 66 90 xchg %ax,%ax
367f: 90 nop
00003680 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
3680: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
3681: 31 c0 xor %eax,%eax
{
3683: 89 e5 mov %esp,%ebp
3685: 53 push %ebx
3686: 8b 4d 08 mov 0x8(%ebp),%ecx
3689: 8b 5d 0c mov 0xc(%ebp),%ebx
368c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((*s++ = *t++) != 0)
3690: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
3694: 88 14 01 mov %dl,(%ecx,%eax,1)
3697: 83 c0 01 add $0x1,%eax
369a: 84 d2 test %dl,%dl
369c: 75 f2 jne 3690 <strcpy+0x10>
;
return os;
}
369e: 8b 5d fc mov -0x4(%ebp),%ebx
36a1: 89 c8 mov %ecx,%eax
36a3: c9 leave
36a4: c3 ret
36a5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000036b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
36b0: 55 push %ebp
36b1: 89 e5 mov %esp,%ebp
36b3: 53 push %ebx
36b4: 8b 55 08 mov 0x8(%ebp),%edx
36b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
36ba: 0f b6 02 movzbl (%edx),%eax
36bd: 84 c0 test %al,%al
36bf: 75 17 jne 36d8 <strcmp+0x28>
36c1: eb 3a jmp 36fd <strcmp+0x4d>
36c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
36c7: 90 nop
36c8: 0f b6 42 01 movzbl 0x1(%edx),%eax
p++, q++;
36cc: 83 c2 01 add $0x1,%edx
36cf: 8d 59 01 lea 0x1(%ecx),%ebx
while(*p && *p == *q)
36d2: 84 c0 test %al,%al
36d4: 74 1a je 36f0 <strcmp+0x40>
p++, q++;
36d6: 89 d9 mov %ebx,%ecx
while(*p && *p == *q)
36d8: 0f b6 19 movzbl (%ecx),%ebx
36db: 38 c3 cmp %al,%bl
36dd: 74 e9 je 36c8 <strcmp+0x18>
return (uchar)*p - (uchar)*q;
36df: 29 d8 sub %ebx,%eax
}
36e1: 8b 5d fc mov -0x4(%ebp),%ebx
36e4: c9 leave
36e5: c3 ret
36e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36ed: 8d 76 00 lea 0x0(%esi),%esi
return (uchar)*p - (uchar)*q;
36f0: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
36f4: 31 c0 xor %eax,%eax
36f6: 29 d8 sub %ebx,%eax
}
36f8: 8b 5d fc mov -0x4(%ebp),%ebx
36fb: c9 leave
36fc: c3 ret
return (uchar)*p - (uchar)*q;
36fd: 0f b6 19 movzbl (%ecx),%ebx
3700: 31 c0 xor %eax,%eax
3702: eb db jmp 36df <strcmp+0x2f>
3704: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
370b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
370f: 90 nop
00003710 <strlen>:
uint
strlen(const char *s)
{
3710: 55 push %ebp
3711: 89 e5 mov %esp,%ebp
3713: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
3716: 80 3a 00 cmpb $0x0,(%edx)
3719: 74 15 je 3730 <strlen+0x20>
371b: 31 c0 xor %eax,%eax
371d: 8d 76 00 lea 0x0(%esi),%esi
3720: 83 c0 01 add $0x1,%eax
3723: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
3727: 89 c1 mov %eax,%ecx
3729: 75 f5 jne 3720 <strlen+0x10>
;
return n;
}
372b: 89 c8 mov %ecx,%eax
372d: 5d pop %ebp
372e: c3 ret
372f: 90 nop
for(n = 0; s[n]; n++)
3730: 31 c9 xor %ecx,%ecx
}
3732: 5d pop %ebp
3733: 89 c8 mov %ecx,%eax
3735: c3 ret
3736: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
373d: 8d 76 00 lea 0x0(%esi),%esi
00003740 <memset>:
void*
memset(void *dst, int c, uint n)
{
3740: 55 push %ebp
3741: 89 e5 mov %esp,%ebp
3743: 57 push %edi
3744: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3747: 8b 4d 10 mov 0x10(%ebp),%ecx
374a: 8b 45 0c mov 0xc(%ebp),%eax
374d: 89 d7 mov %edx,%edi
374f: fc cld
3750: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3752: 8b 7d fc mov -0x4(%ebp),%edi
3755: 89 d0 mov %edx,%eax
3757: c9 leave
3758: c3 ret
3759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003760 <strchr>:
char*
strchr(const char *s, char c)
{
3760: 55 push %ebp
3761: 89 e5 mov %esp,%ebp
3763: 8b 45 08 mov 0x8(%ebp),%eax
3766: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
376a: 0f b6 10 movzbl (%eax),%edx
376d: 84 d2 test %dl,%dl
376f: 75 12 jne 3783 <strchr+0x23>
3771: eb 1d jmp 3790 <strchr+0x30>
3773: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3777: 90 nop
3778: 0f b6 50 01 movzbl 0x1(%eax),%edx
377c: 83 c0 01 add $0x1,%eax
377f: 84 d2 test %dl,%dl
3781: 74 0d je 3790 <strchr+0x30>
if(*s == c)
3783: 38 d1 cmp %dl,%cl
3785: 75 f1 jne 3778 <strchr+0x18>
return (char*)s;
return 0;
}
3787: 5d pop %ebp
3788: c3 ret
3789: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
3790: 31 c0 xor %eax,%eax
}
3792: 5d pop %ebp
3793: c3 ret
3794: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
379b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
379f: 90 nop
000037a0 <gets>:
char*
gets(char *buf, int max)
{
37a0: 55 push %ebp
37a1: 89 e5 mov %esp,%ebp
37a3: 57 push %edi
37a4: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
37a5: 8d 7d e7 lea -0x19(%ebp),%edi
{
37a8: 53 push %ebx
for(i=0; i+1 < max; ){
37a9: 31 db xor %ebx,%ebx
{
37ab: 83 ec 1c sub $0x1c,%esp
for(i=0; i+1 < max; ){
37ae: eb 27 jmp 37d7 <gets+0x37>
cc = read(0, &c, 1);
37b0: 83 ec 04 sub $0x4,%esp
37b3: 6a 01 push $0x1
37b5: 57 push %edi
37b6: 6a 00 push $0x0
37b8: e8 2e 01 00 00 call 38eb <read>
if(cc < 1)
37bd: 83 c4 10 add $0x10,%esp
37c0: 85 c0 test %eax,%eax
37c2: 7e 1d jle 37e1 <gets+0x41>
break;
buf[i++] = c;
37c4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
37c8: 8b 55 08 mov 0x8(%ebp),%edx
37cb: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
37cf: 3c 0a cmp $0xa,%al
37d1: 74 1d je 37f0 <gets+0x50>
37d3: 3c 0d cmp $0xd,%al
37d5: 74 19 je 37f0 <gets+0x50>
for(i=0; i+1 < max; ){
37d7: 89 de mov %ebx,%esi
37d9: 83 c3 01 add $0x1,%ebx
37dc: 3b 5d 0c cmp 0xc(%ebp),%ebx
37df: 7c cf jl 37b0 <gets+0x10>
break;
}
buf[i] = '\0';
37e1: 8b 45 08 mov 0x8(%ebp),%eax
37e4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
37e8: 8d 65 f4 lea -0xc(%ebp),%esp
37eb: 5b pop %ebx
37ec: 5e pop %esi
37ed: 5f pop %edi
37ee: 5d pop %ebp
37ef: c3 ret
buf[i] = '\0';
37f0: 8b 45 08 mov 0x8(%ebp),%eax
37f3: 89 de mov %ebx,%esi
37f5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
}
37f9: 8d 65 f4 lea -0xc(%ebp),%esp
37fc: 5b pop %ebx
37fd: 5e pop %esi
37fe: 5f pop %edi
37ff: 5d pop %ebp
3800: c3 ret
3801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3808: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
380f: 90 nop
00003810 <stat>:
int
stat(const char *n, struct stat *st)
{
3810: 55 push %ebp
3811: 89 e5 mov %esp,%ebp
3813: 56 push %esi
3814: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
3815: 83 ec 08 sub $0x8,%esp
3818: 6a 00 push $0x0
381a: ff 75 08 push 0x8(%ebp)
381d: e8 f1 00 00 00 call 3913 <open>
if(fd < 0)
3822: 83 c4 10 add $0x10,%esp
3825: 85 c0 test %eax,%eax
3827: 78 27 js 3850 <stat+0x40>
return -1;
r = fstat(fd, st);
3829: 83 ec 08 sub $0x8,%esp
382c: ff 75 0c push 0xc(%ebp)
382f: 89 c3 mov %eax,%ebx
3831: 50 push %eax
3832: e8 f4 00 00 00 call 392b <fstat>
close(fd);
3837: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
383a: 89 c6 mov %eax,%esi
close(fd);
383c: e8 ba 00 00 00 call 38fb <close>
return r;
3841: 83 c4 10 add $0x10,%esp
}
3844: 8d 65 f8 lea -0x8(%ebp),%esp
3847: 89 f0 mov %esi,%eax
3849: 5b pop %ebx
384a: 5e pop %esi
384b: 5d pop %ebp
384c: c3 ret
384d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
3850: be ff ff ff ff mov $0xffffffff,%esi
3855: eb ed jmp 3844 <stat+0x34>
3857: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
385e: 66 90 xchg %ax,%ax
00003860 <atoi>:
int
atoi(const char *s)
{
3860: 55 push %ebp
3861: 89 e5 mov %esp,%ebp
3863: 53 push %ebx
3864: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3867: 0f be 02 movsbl (%edx),%eax
386a: 8d 48 d0 lea -0x30(%eax),%ecx
386d: 80 f9 09 cmp $0x9,%cl
n = 0;
3870: b9 00 00 00 00 mov $0x0,%ecx
while('0' <= *s && *s <= '9')
3875: 77 1e ja 3895 <atoi+0x35>
3877: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
387e: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
3880: 83 c2 01 add $0x1,%edx
3883: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
3886: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while('0' <= *s && *s <= '9')
388a: 0f be 02 movsbl (%edx),%eax
388d: 8d 58 d0 lea -0x30(%eax),%ebx
3890: 80 fb 09 cmp $0x9,%bl
3893: 76 eb jbe 3880 <atoi+0x20>
return n;
}
3895: 8b 5d fc mov -0x4(%ebp),%ebx
3898: 89 c8 mov %ecx,%eax
389a: c9 leave
389b: c3 ret
389c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000038a0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
38a0: 55 push %ebp
38a1: 89 e5 mov %esp,%ebp
38a3: 57 push %edi
38a4: 8b 45 10 mov 0x10(%ebp),%eax
38a7: 8b 55 08 mov 0x8(%ebp),%edx
38aa: 56 push %esi
38ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
38ae: 85 c0 test %eax,%eax
38b0: 7e 13 jle 38c5 <memmove+0x25>
38b2: 01 d0 add %edx,%eax
dst = vdst;
38b4: 89 d7 mov %edx,%edi
38b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
38bd: 8d 76 00 lea 0x0(%esi),%esi
*dst++ = *src++;
38c0: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
38c1: 39 f8 cmp %edi,%eax
38c3: 75 fb jne 38c0 <memmove+0x20>
return vdst;
}
38c5: 5e pop %esi
38c6: 89 d0 mov %edx,%eax
38c8: 5f pop %edi
38c9: 5d pop %ebp
38ca: c3 ret
000038cb <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
38cb: b8 01 00 00 00 mov $0x1,%eax
38d0: cd 40 int $0x40
38d2: c3 ret
000038d3 <exit>:
SYSCALL(exit)
38d3: b8 02 00 00 00 mov $0x2,%eax
38d8: cd 40 int $0x40
38da: c3 ret
000038db <wait>:
SYSCALL(wait)
38db: b8 03 00 00 00 mov $0x3,%eax
38e0: cd 40 int $0x40
38e2: c3 ret
000038e3 <pipe>:
SYSCALL(pipe)
38e3: b8 04 00 00 00 mov $0x4,%eax
38e8: cd 40 int $0x40
38ea: c3 ret
000038eb <read>:
SYSCALL(read)
38eb: b8 05 00 00 00 mov $0x5,%eax
38f0: cd 40 int $0x40
38f2: c3 ret
000038f3 <write>:
SYSCALL(write)
38f3: b8 10 00 00 00 mov $0x10,%eax
38f8: cd 40 int $0x40
38fa: c3 ret
000038fb <close>:
SYSCALL(close)
38fb: b8 15 00 00 00 mov $0x15,%eax
3900: cd 40 int $0x40
3902: c3 ret
00003903 <kill>:
SYSCALL(kill)
3903: b8 06 00 00 00 mov $0x6,%eax
3908: cd 40 int $0x40
390a: c3 ret
0000390b <exec>:
SYSCALL(exec)
390b: b8 07 00 00 00 mov $0x7,%eax
3910: cd 40 int $0x40
3912: c3 ret
00003913 <open>:
SYSCALL(open)
3913: b8 0f 00 00 00 mov $0xf,%eax
3918: cd 40 int $0x40
391a: c3 ret
0000391b <mknod>:
SYSCALL(mknod)
391b: b8 11 00 00 00 mov $0x11,%eax
3920: cd 40 int $0x40
3922: c3 ret
00003923 <unlink>:
SYSCALL(unlink)
3923: b8 12 00 00 00 mov $0x12,%eax
3928: cd 40 int $0x40
392a: c3 ret
0000392b <fstat>:
SYSCALL(fstat)
392b: b8 08 00 00 00 mov $0x8,%eax
3930: cd 40 int $0x40
3932: c3 ret
00003933 <link>:
SYSCALL(link)
3933: b8 13 00 00 00 mov $0x13,%eax
3938: cd 40 int $0x40
393a: c3 ret
0000393b <mkdir>:
SYSCALL(mkdir)
393b: b8 14 00 00 00 mov $0x14,%eax
3940: cd 40 int $0x40
3942: c3 ret
00003943 <chdir>:
SYSCALL(chdir)
3943: b8 09 00 00 00 mov $0x9,%eax
3948: cd 40 int $0x40
394a: c3 ret
0000394b <dup>:
SYSCALL(dup)
394b: b8 0a 00 00 00 mov $0xa,%eax
3950: cd 40 int $0x40
3952: c3 ret
00003953 <getpid>:
SYSCALL(getpid)
3953: b8 0b 00 00 00 mov $0xb,%eax
3958: cd 40 int $0x40
395a: c3 ret
0000395b <sbrk>:
SYSCALL(sbrk)
395b: b8 0c 00 00 00 mov $0xc,%eax
3960: cd 40 int $0x40
3962: c3 ret
00003963 <sleep>:
SYSCALL(sleep)
3963: b8 0d 00 00 00 mov $0xd,%eax
3968: cd 40 int $0x40
396a: c3 ret
0000396b <uptime>:
SYSCALL(uptime)
396b: b8 0e 00 00 00 mov $0xe,%eax
3970: cd 40 int $0x40
3972: c3 ret
00003973 <ps>:
SYSCALL(ps)
3973: b8 16 00 00 00 mov $0x16,%eax
3978: cd 40 int $0x40
397a: c3 ret
0000397b <chpr>:
SYSCALL(chpr)
397b: b8 17 00 00 00 mov $0x17,%eax
3980: cd 40 int $0x40
3982: c3 ret
3983: 66 90 xchg %ax,%ax
3985: 66 90 xchg %ax,%ax
3987: 66 90 xchg %ax,%ax
3989: 66 90 xchg %ax,%ax
398b: 66 90 xchg %ax,%ax
398d: 66 90 xchg %ax,%ax
398f: 90 nop
00003990 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3990: 55 push %ebp
3991: 89 e5 mov %esp,%ebp
3993: 57 push %edi
3994: 56 push %esi
3995: 53 push %ebx
3996: 83 ec 3c sub $0x3c,%esp
3999: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
399c: 89 d1 mov %edx,%ecx
{
399e: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
39a1: 85 d2 test %edx,%edx
39a3: 0f 89 7f 00 00 00 jns 3a28 <printint+0x98>
39a9: f6 45 08 01 testb $0x1,0x8(%ebp)
39ad: 74 79 je 3a28 <printint+0x98>
neg = 1;
39af: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
39b6: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
39b8: 31 db xor %ebx,%ebx
39ba: 8d 75 d7 lea -0x29(%ebp),%esi
39bd: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
39c0: 89 c8 mov %ecx,%eax
39c2: 31 d2 xor %edx,%edx
39c4: 89 cf mov %ecx,%edi
39c6: f7 75 c4 divl -0x3c(%ebp)
39c9: 0f b6 92 60 55 00 00 movzbl 0x5560(%edx),%edx
39d0: 89 45 c0 mov %eax,-0x40(%ebp)
39d3: 89 d8 mov %ebx,%eax
39d5: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
39d8: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
39db: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
39de: 39 7d c4 cmp %edi,-0x3c(%ebp)
39e1: 76 dd jbe 39c0 <printint+0x30>
if(neg)
39e3: 8b 4d bc mov -0x44(%ebp),%ecx
39e6: 85 c9 test %ecx,%ecx
39e8: 74 0c je 39f6 <printint+0x66>
buf[i++] = '-';
39ea: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
39ef: 89 d8 mov %ebx,%eax
buf[i++] = '-';
39f1: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
39f6: 8b 7d b8 mov -0x48(%ebp),%edi
39f9: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
39fd: eb 07 jmp 3a06 <printint+0x76>
39ff: 90 nop
putc(fd, buf[i]);
3a00: 0f b6 13 movzbl (%ebx),%edx
3a03: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
3a06: 83 ec 04 sub $0x4,%esp
3a09: 88 55 d7 mov %dl,-0x29(%ebp)
3a0c: 6a 01 push $0x1
3a0e: 56 push %esi
3a0f: 57 push %edi
3a10: e8 de fe ff ff call 38f3 <write>
while(--i >= 0)
3a15: 83 c4 10 add $0x10,%esp
3a18: 39 de cmp %ebx,%esi
3a1a: 75 e4 jne 3a00 <printint+0x70>
}
3a1c: 8d 65 f4 lea -0xc(%ebp),%esp
3a1f: 5b pop %ebx
3a20: 5e pop %esi
3a21: 5f pop %edi
3a22: 5d pop %ebp
3a23: c3 ret
3a24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3a28: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
3a2f: eb 87 jmp 39b8 <printint+0x28>
3a31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a38: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a3f: 90 nop
00003a40 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3a40: 55 push %ebp
3a41: 89 e5 mov %esp,%ebp
3a43: 57 push %edi
3a44: 56 push %esi
3a45: 53 push %ebx
3a46: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3a49: 8b 5d 0c mov 0xc(%ebp),%ebx
{
3a4c: 8b 75 08 mov 0x8(%ebp),%esi
for(i = 0; fmt[i]; i++){
3a4f: 0f b6 13 movzbl (%ebx),%edx
3a52: 84 d2 test %dl,%dl
3a54: 74 6a je 3ac0 <printf+0x80>
ap = (uint*)(void*)&fmt + 1;
3a56: 8d 45 10 lea 0x10(%ebp),%eax
3a59: 83 c3 01 add $0x1,%ebx
write(fd, &c, 1);
3a5c: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
3a5f: 31 c9 xor %ecx,%ecx
ap = (uint*)(void*)&fmt + 1;
3a61: 89 45 d0 mov %eax,-0x30(%ebp)
3a64: eb 36 jmp 3a9c <printf+0x5c>
3a66: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a6d: 8d 76 00 lea 0x0(%esi),%esi
3a70: 89 4d d4 mov %ecx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
3a73: b9 25 00 00 00 mov $0x25,%ecx
if(c == '%'){
3a78: 83 f8 25 cmp $0x25,%eax
3a7b: 74 15 je 3a92 <printf+0x52>
write(fd, &c, 1);
3a7d: 83 ec 04 sub $0x4,%esp
3a80: 88 55 e7 mov %dl,-0x19(%ebp)
3a83: 6a 01 push $0x1
3a85: 57 push %edi
3a86: 56 push %esi
3a87: e8 67 fe ff ff call 38f3 <write>
3a8c: 8b 4d d4 mov -0x2c(%ebp),%ecx
} else {
putc(fd, c);
3a8f: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
3a92: 0f b6 13 movzbl (%ebx),%edx
3a95: 83 c3 01 add $0x1,%ebx
3a98: 84 d2 test %dl,%dl
3a9a: 74 24 je 3ac0 <printf+0x80>
c = fmt[i] & 0xff;
3a9c: 0f b6 c2 movzbl %dl,%eax
if(state == 0){
3a9f: 85 c9 test %ecx,%ecx
3aa1: 74 cd je 3a70 <printf+0x30>
}
} else if(state == '%'){
3aa3: 83 f9 25 cmp $0x25,%ecx
3aa6: 75 ea jne 3a92 <printf+0x52>
if(c == 'd'){
3aa8: 83 f8 25 cmp $0x25,%eax
3aab: 0f 84 07 01 00 00 je 3bb8 <printf+0x178>
3ab1: 83 e8 63 sub $0x63,%eax
3ab4: 83 f8 15 cmp $0x15,%eax
3ab7: 77 17 ja 3ad0 <printf+0x90>
3ab9: ff 24 85 08 55 00 00 jmp *0x5508(,%eax,4)
putc(fd, c);
}
state = 0;
}
}
}
3ac0: 8d 65 f4 lea -0xc(%ebp),%esp
3ac3: 5b pop %ebx
3ac4: 5e pop %esi
3ac5: 5f pop %edi
3ac6: 5d pop %ebp
3ac7: c3 ret
3ac8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3acf: 90 nop
write(fd, &c, 1);
3ad0: 83 ec 04 sub $0x4,%esp
3ad3: 88 55 d4 mov %dl,-0x2c(%ebp)
3ad6: 6a 01 push $0x1
3ad8: 57 push %edi
3ad9: 56 push %esi
3ada: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3ade: e8 10 fe ff ff call 38f3 <write>
putc(fd, c);
3ae3: 0f b6 55 d4 movzbl -0x2c(%ebp),%edx
write(fd, &c, 1);
3ae7: 83 c4 0c add $0xc,%esp
3aea: 88 55 e7 mov %dl,-0x19(%ebp)
3aed: 6a 01 push $0x1
3aef: 57 push %edi
3af0: 56 push %esi
3af1: e8 fd fd ff ff call 38f3 <write>
putc(fd, c);
3af6: 83 c4 10 add $0x10,%esp
state = 0;
3af9: 31 c9 xor %ecx,%ecx
3afb: eb 95 jmp 3a92 <printf+0x52>
3afd: 8d 76 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
3b00: 83 ec 0c sub $0xc,%esp
3b03: b9 10 00 00 00 mov $0x10,%ecx
3b08: 6a 00 push $0x0
3b0a: 8b 45 d0 mov -0x30(%ebp),%eax
3b0d: 8b 10 mov (%eax),%edx
3b0f: 89 f0 mov %esi,%eax
3b11: e8 7a fe ff ff call 3990 <printint>
ap++;
3b16: 83 45 d0 04 addl $0x4,-0x30(%ebp)
3b1a: 83 c4 10 add $0x10,%esp
state = 0;
3b1d: 31 c9 xor %ecx,%ecx
3b1f: e9 6e ff ff ff jmp 3a92 <printf+0x52>
3b24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
3b28: 8b 45 d0 mov -0x30(%ebp),%eax
3b2b: 8b 10 mov (%eax),%edx
ap++;
3b2d: 83 c0 04 add $0x4,%eax
3b30: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
3b33: 85 d2 test %edx,%edx
3b35: 0f 84 8d 00 00 00 je 3bc8 <printf+0x188>
while(*s != 0){
3b3b: 0f b6 02 movzbl (%edx),%eax
state = 0;
3b3e: 31 c9 xor %ecx,%ecx
while(*s != 0){
3b40: 84 c0 test %al,%al
3b42: 0f 84 4a ff ff ff je 3a92 <printf+0x52>
3b48: 89 5d d4 mov %ebx,-0x2c(%ebp)
3b4b: 89 d3 mov %edx,%ebx
3b4d: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
3b50: 83 ec 04 sub $0x4,%esp
s++;
3b53: 83 c3 01 add $0x1,%ebx
3b56: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
3b59: 6a 01 push $0x1
3b5b: 57 push %edi
3b5c: 56 push %esi
3b5d: e8 91 fd ff ff call 38f3 <write>
while(*s != 0){
3b62: 0f b6 03 movzbl (%ebx),%eax
3b65: 83 c4 10 add $0x10,%esp
3b68: 84 c0 test %al,%al
3b6a: 75 e4 jne 3b50 <printf+0x110>
state = 0;
3b6c: 8b 5d d4 mov -0x2c(%ebp),%ebx
3b6f: 31 c9 xor %ecx,%ecx
3b71: e9 1c ff ff ff jmp 3a92 <printf+0x52>
3b76: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3b7d: 8d 76 00 lea 0x0(%esi),%esi
printint(fd, *ap, 10, 1);
3b80: 83 ec 0c sub $0xc,%esp
3b83: b9 0a 00 00 00 mov $0xa,%ecx
3b88: 6a 01 push $0x1
3b8a: e9 7b ff ff ff jmp 3b0a <printf+0xca>
3b8f: 90 nop
putc(fd, *ap);
3b90: 8b 45 d0 mov -0x30(%ebp),%eax
write(fd, &c, 1);
3b93: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
3b96: 8b 00 mov (%eax),%eax
write(fd, &c, 1);
3b98: 6a 01 push $0x1
3b9a: 57 push %edi
3b9b: 56 push %esi
putc(fd, *ap);
3b9c: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
3b9f: e8 4f fd ff ff call 38f3 <write>
ap++;
3ba4: 83 45 d0 04 addl $0x4,-0x30(%ebp)
3ba8: 83 c4 10 add $0x10,%esp
state = 0;
3bab: 31 c9 xor %ecx,%ecx
3bad: e9 e0 fe ff ff jmp 3a92 <printf+0x52>
3bb2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, c);
3bb8: 88 55 e7 mov %dl,-0x19(%ebp)
write(fd, &c, 1);
3bbb: 83 ec 04 sub $0x4,%esp
3bbe: e9 2a ff ff ff jmp 3aed <printf+0xad>
3bc3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3bc7: 90 nop
s = "(null)";
3bc8: ba fe 54 00 00 mov $0x54fe,%edx
while(*s != 0){
3bcd: 89 5d d4 mov %ebx,-0x2c(%ebp)
3bd0: b8 28 00 00 00 mov $0x28,%eax
3bd5: 89 d3 mov %edx,%ebx
3bd7: e9 74 ff ff ff jmp 3b50 <printf+0x110>
3bdc: 66 90 xchg %ax,%ax
3bde: 66 90 xchg %ax,%ax
00003be0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
3be0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3be1: a1 40 9d 00 00 mov 0x9d40,%eax
{
3be6: 89 e5 mov %esp,%ebp
3be8: 57 push %edi
3be9: 56 push %esi
3bea: 53 push %ebx
3beb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
3bee: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3bf1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3bf8: 89 c2 mov %eax,%edx
3bfa: 8b 00 mov (%eax),%eax
3bfc: 39 ca cmp %ecx,%edx
3bfe: 73 30 jae 3c30 <free+0x50>
3c00: 39 c1 cmp %eax,%ecx
3c02: 72 04 jb 3c08 <free+0x28>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
3c04: 39 c2 cmp %eax,%edx
3c06: 72 f0 jb 3bf8 <free+0x18>
break;
if(bp + bp->s.size == p->s.ptr){
3c08: 8b 73 fc mov -0x4(%ebx),%esi
3c0b: 8d 3c f1 lea (%ecx,%esi,8),%edi
3c0e: 39 f8 cmp %edi,%eax
3c10: 74 30 je 3c42 <free+0x62>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
3c12: 89 43 f8 mov %eax,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
3c15: 8b 42 04 mov 0x4(%edx),%eax
3c18: 8d 34 c2 lea (%edx,%eax,8),%esi
3c1b: 39 f1 cmp %esi,%ecx
3c1d: 74 3a je 3c59 <free+0x79>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
3c1f: 89 0a mov %ecx,(%edx)
} else
p->s.ptr = bp;
freep = p;
}
3c21: 5b pop %ebx
freep = p;
3c22: 89 15 40 9d 00 00 mov %edx,0x9d40
}
3c28: 5e pop %esi
3c29: 5f pop %edi
3c2a: 5d pop %ebp
3c2b: c3 ret
3c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
3c30: 39 c2 cmp %eax,%edx
3c32: 72 c4 jb 3bf8 <free+0x18>
3c34: 39 c1 cmp %eax,%ecx
3c36: 73 c0 jae 3bf8 <free+0x18>
if(bp + bp->s.size == p->s.ptr){
3c38: 8b 73 fc mov -0x4(%ebx),%esi
3c3b: 8d 3c f1 lea (%ecx,%esi,8),%edi
3c3e: 39 f8 cmp %edi,%eax
3c40: 75 d0 jne 3c12 <free+0x32>
bp->s.size += p->s.ptr->s.size;
3c42: 03 70 04 add 0x4(%eax),%esi
3c45: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
3c48: 8b 02 mov (%edx),%eax
3c4a: 8b 00 mov (%eax),%eax
3c4c: 89 43 f8 mov %eax,-0x8(%ebx)
if(p + p->s.size == bp){
3c4f: 8b 42 04 mov 0x4(%edx),%eax
3c52: 8d 34 c2 lea (%edx,%eax,8),%esi
3c55: 39 f1 cmp %esi,%ecx
3c57: 75 c6 jne 3c1f <free+0x3f>
p->s.size += bp->s.size;
3c59: 03 43 fc add -0x4(%ebx),%eax
freep = p;
3c5c: 89 15 40 9d 00 00 mov %edx,0x9d40
p->s.size += bp->s.size;
3c62: 89 42 04 mov %eax,0x4(%edx)
p->s.ptr = bp->s.ptr;
3c65: 8b 4b f8 mov -0x8(%ebx),%ecx
3c68: 89 0a mov %ecx,(%edx)
}
3c6a: 5b pop %ebx
3c6b: 5e pop %esi
3c6c: 5f pop %edi
3c6d: 5d pop %ebp
3c6e: c3 ret
3c6f: 90 nop
00003c70 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
3c70: 55 push %ebp
3c71: 89 e5 mov %esp,%ebp
3c73: 57 push %edi
3c74: 56 push %esi
3c75: 53 push %ebx
3c76: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3c79: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
3c7c: 8b 3d 40 9d 00 00 mov 0x9d40,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3c82: 8d 70 07 lea 0x7(%eax),%esi
3c85: c1 ee 03 shr $0x3,%esi
3c88: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
3c8b: 85 ff test %edi,%edi
3c8d: 0f 84 9d 00 00 00 je 3d30 <malloc+0xc0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3c93: 8b 17 mov (%edi),%edx
if(p->s.size >= nunits){
3c95: 8b 4a 04 mov 0x4(%edx),%ecx
3c98: 39 f1 cmp %esi,%ecx
3c9a: 73 6a jae 3d06 <malloc+0x96>
3c9c: bb 00 10 00 00 mov $0x1000,%ebx
3ca1: 39 de cmp %ebx,%esi
3ca3: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
3ca6: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
3cad: 89 45 e4 mov %eax,-0x1c(%ebp)
3cb0: eb 17 jmp 3cc9 <malloc+0x59>
3cb2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3cb8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
3cba: 8b 48 04 mov 0x4(%eax),%ecx
3cbd: 39 f1 cmp %esi,%ecx
3cbf: 73 4f jae 3d10 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
3cc1: 8b 3d 40 9d 00 00 mov 0x9d40,%edi
3cc7: 89 c2 mov %eax,%edx
3cc9: 39 d7 cmp %edx,%edi
3ccb: 75 eb jne 3cb8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
3ccd: 83 ec 0c sub $0xc,%esp
3cd0: ff 75 e4 push -0x1c(%ebp)
3cd3: e8 83 fc ff ff call 395b <sbrk>
if(p == (char*)-1)
3cd8: 83 c4 10 add $0x10,%esp
3cdb: 83 f8 ff cmp $0xffffffff,%eax
3cde: 74 1c je 3cfc <malloc+0x8c>
hp->s.size = nu;
3ce0: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
3ce3: 83 ec 0c sub $0xc,%esp
3ce6: 83 c0 08 add $0x8,%eax
3ce9: 50 push %eax
3cea: e8 f1 fe ff ff call 3be0 <free>
return freep;
3cef: 8b 15 40 9d 00 00 mov 0x9d40,%edx
if((p = morecore(nunits)) == 0)
3cf5: 83 c4 10 add $0x10,%esp
3cf8: 85 d2 test %edx,%edx
3cfa: 75 bc jne 3cb8 <malloc+0x48>
return 0;
}
}
3cfc: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
3cff: 31 c0 xor %eax,%eax
}
3d01: 5b pop %ebx
3d02: 5e pop %esi
3d03: 5f pop %edi
3d04: 5d pop %ebp
3d05: c3 ret
if(p->s.size >= nunits){
3d06: 89 d0 mov %edx,%eax
3d08: 89 fa mov %edi,%edx
3d0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
3d10: 39 ce cmp %ecx,%esi
3d12: 74 4c je 3d60 <malloc+0xf0>
p->s.size -= nunits;
3d14: 29 f1 sub %esi,%ecx
3d16: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
3d19: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
3d1c: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
3d1f: 89 15 40 9d 00 00 mov %edx,0x9d40
}
3d25: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
3d28: 83 c0 08 add $0x8,%eax
}
3d2b: 5b pop %ebx
3d2c: 5e pop %esi
3d2d: 5f pop %edi
3d2e: 5d pop %ebp
3d2f: c3 ret
base.s.ptr = freep = prevp = &base;
3d30: c7 05 40 9d 00 00 44 movl $0x9d44,0x9d40
3d37: 9d 00 00
base.s.size = 0;
3d3a: bf 44 9d 00 00 mov $0x9d44,%edi
base.s.ptr = freep = prevp = &base;
3d3f: c7 05 44 9d 00 00 44 movl $0x9d44,0x9d44
3d46: 9d 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3d49: 89 fa mov %edi,%edx
base.s.size = 0;
3d4b: c7 05 48 9d 00 00 00 movl $0x0,0x9d48
3d52: 00 00 00
if(p->s.size >= nunits){
3d55: e9 42 ff ff ff jmp 3c9c <malloc+0x2c>
3d5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
3d60: 8b 08 mov (%eax),%ecx
3d62: 89 0a mov %ecx,(%edx)
3d64: eb b9 jmp 3d1f <malloc+0xaf>
|
src/NTypes/Coproduct.agda | vituscze/HoTT-lectures | 0 | 9880 | <reponame>vituscze/HoTT-lectures<gh_stars>0
{-# OPTIONS --without-K #-}
module NTypes.Coproduct where
open import NTypes
open import PathOperations
open import PathStructure.Coproduct
open import Types
⊎-isSet : ∀ {A : Set} {B : Set} →
isSet A → isSet B → isSet (A ⊎ B)
⊎-isSet {A = A} {B = B} A-set B-set x y p q =
case (λ x → (y : A ⊎ B) (p q : x ≡ y) → p ≡ q)
(λ a y p q → case
(λ y → (p q : inl a ≡ y) → p ≡ q)
(λ a′ p q
→ split-eq p ⁻¹
· ap (ap inl)
(A-set _ _
(lower (tr (F (inl a)) p (lift refl)))
(lower (tr (F (inl a)) q (lift refl)))
)
· split-eq q
)
(λ _ p q → 0-elim
(lower (split-path p)))
y p q)
(λ b y p q → case
(λ y → (p q : inr b ≡ y) → p ≡ q)
(λ _ p q → 0-elim
(lower (split-path p)))
(λ b′ p q
→ split-eq p ⁻¹
· ap (ap inr)
(B-set _ _
(lower (tr (F (inr b)) p (lift refl)))
(lower (tr (F (inr b)) q (lift refl)))
)
· split-eq q
)
y p q)
x y p q
where
split-eq : {x y : A ⊎ B} → _
split-eq {x = x} {y = y} =
π₂ (π₂ (π₂ (split-merge-eq {x = x} {y = y})))
|
oeis/123/A123672.asm | neoneye/loda-programs | 11 | 164520 | <filename>oeis/123/A123672.asm
; A123672: a(1) = 1; for n > 1, a(n) = (2^n-1)*a(n-1) + (-1)^n.
; Submitted by <NAME>
; 1,4,27,406,12585,792856,100692711,25676641306,13120763707365,13422541272634396,27475941985082608611,112513982428913282262046,921602030075228695008418785,15098606058722471710322924954656,494736024726159230532151281989213151,32422525380428845172924534265163083850786,4249652824138189165660391630669190563406371805,1114016740278057322453712043238513621863036524078116,584064494710161839417289326013390591265705830099343203291,612435427540707950766984155024491039236437490796418799390860326
mov $1,2
mov $3,4
lpb $0
sub $0,1
mov $4,$1
add $1,$3
add $1,$4
add $2,1
mul $1,$2
mul $2,2
mov $3,$4
lpe
mov $0,$1
div $0,2
|
src/8088/payload/init.asm | TheStingray8088/cbm2-pc-emulator | 0 | 162966 | <reponame>TheStingray8088/cbm2-pc-emulator
; -----------------------------------------------------------------
; Init interrupt vectors
; -----------------------------------------------------------------
Init_INT:
cld
; Write interrupt vectors
mov ax, cs
mov ds, ax
xor bx, bx
mov es, bx
mov si, Init_INT_Table
mov di, 0040h
mov cx, (Init_INT_Table_End-Init_INT_Table)/2
Init_INT_0:
movsw
stosw
loop Init_INT_0
mov si, Init_INT_Table2
mov di, 0300h
mov cx, (Init_INT_Table2_End-Init_INT_Table2)/2
Init_INT_1:
movsw
stosw
loop Init_INT_1
ret
; -----------------------------------------------------------------
; Init data segment
; -----------------------------------------------------------------
Init_Data:
; Zero the data segment
mov ax, Data_Segment
mov es, ax
xor ax, ax
mov di, ax
; Cursor position
stosw
dec ax
stosw
xor ax, ax
; Cursor visibilty
stosb
stosw
; Debug flag
stosb
; Memory size
add di, 2
; Tick count
stosw
; Boot flag
stosb
; SD presence flag
stosb
; Video refresh counter
stosb
; Active video page
stosb
ret
; -----------------------------------------------------------------
; Interrupt vector table
; -----------------------------------------------------------------
Init_INT_Table:
dw Screen_INT
dw INT_11
dw INT_12
dw INT_13
dw INT_14
dw INT_15
dw INT_16
dw INT_17
dw INT_18
dw INT_19
dw INT_1A
dw INT_1B
dw INT_1C
dw 0
dw INT_1E
dw 0
Init_INT_Table_End:
Init_INT_Table2:
dw INT_C0
dw INT_C1
Init_INT_Table2_End:
; -----------------------------------------------------------------
; Output zero-terminated string.
; Input:
; DS:SI - pointer to the string
; -----------------------------------------------------------------
Output_String:
lodsb
test al, al
jz Output_String_End
mov ah, 0Eh
int 10h
jmp Output_String
Output_String_End:
ret
; -----------------------------------------------------------------
; Output a horizontal line.
; -----------------------------------------------------------------
Output_Line:
mov al, 0C4h
mov ah, 0Eh
mov cx, 80
Output_Line1:
int 10h
loop Output_Line1
ret
; -----------------------------------------------------------------
; Output the version banner.
; -----------------------------------------------------------------
Version_Banner:
db "PC Compatibility layer build ", SOFTWARE_VERSION, SOFTWARE_BUILDS, " "
db "(C) 2017-2020 Micha", 9Ch, " Pleban", 10, 13, 0, '$'
Version_Output:
mov ax, Data_Segment
mov es, ax
push cs
pop ds
mov si, Version_Banner
call Output_String
ret
|
include/bits_types_struct_u_jmp_buf_tag_h.ads | docandrew/troodon | 5 | 25007 | <filename>include/bits_types_struct_u_jmp_buf_tag_h.ads
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with bits_setjmp_h;
with bits_types_u_sigset_t_h;
package bits_types_struct_u_jmp_buf_tag_h is
-- Define struct __jmp_buf_tag.
-- Copyright (C) 1991-2021 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <https://www.gnu.org/licenses/>.
-- Get `__jmp_buf'.
-- Calling environment, plus possibly a saved signal mask.
-- NOTE: The machine-dependent definitions of `__sigsetjmp'
-- assume that a `jmp_buf' begins with a `__jmp_buf' and that
-- `__mask_was_saved' follows it. Do not move these members
-- or add others before it.
-- Calling environment.
type uu_jmp_buf_tag is record
uu_jmpbuf : aliased bits_setjmp_h.uu_jmp_buf; -- /usr/include/bits/types/struct___jmp_buf_tag.h:32
uu_mask_was_saved : aliased int; -- /usr/include/bits/types/struct___jmp_buf_tag.h:33
uu_saved_mask : aliased bits_types_u_sigset_t_h.uu_sigset_t; -- /usr/include/bits/types/struct___jmp_buf_tag.h:34
end record
with Convention => C_Pass_By_Copy; -- /usr/include/bits/types/struct___jmp_buf_tag.h:26
-- Saved the signal mask?
-- Saved signal mask.
end bits_types_struct_u_jmp_buf_tag_h;
|
test/asm/error-recovery.asm | michealccc/rgbds | 522 | 176489 | println "begin"
println 42, 1 2 3 4
for n, 5
println "start {d:n}"
println syntax error
println "finish {d:n}"
endr
println "end {d:n}"
|
langs/pm/src/main/antlr/quasylab/sibilla/langs/pm/PopulationModel.g4 | LucaLorenz/sibilla | 1 | 1021 | <filename>langs/pm/src/main/antlr/quasylab/sibilla/langs/pm/PopulationModel.g4<gh_stars>1-10
grammar PopulationModel;
@header {
package quasylab.sibilla.langs.pm;
}
model : element*;
element : const_declaration | species_declaration | rule_declaration | param_declaration | measure_declaration | system_declaration ;
system_declaration: 'system' name=ID ('(' args+=ID (',' args+=ID)* ')')? '=' species_pattern;
const_declaration : 'const' name=ID '=' expr ';';
species_declaration : 'species' name=ID ('of' range ('*' range)* )?;
range : '[' min=expr ',' max=expr ']';
rule_declaration :
'rule' name=ID '{'
rulestatement
'}'
;
rulestatement :
for_statement | when_statement | rule_body
;
for_statement :
'for' name=ID 'in' domain=range next=rulestatement
;
when_statement :
'when' guard=expr arg=rulestatement
;
rule_body :
('[' guard=expr ']')?
pre=species_pattern
'-[' rate=expr ']->'
post = species_pattern
;
species_pattern :
species_pattern_element ('|' species_pattern_element)*
;
species_pattern_element:
species_expression ('[' size=expr ']')?
;
species_expression:
name=ID ('<' expr (',' expr)* '>')?
;
measure_declaration : 'measure' name=ID '=' expr ';';
param_declaration : 'param' name=ID ':' type 'default' expr ';';
type :
'int' # intType
| 'real' # realType
;
expr :
left=expr op=('<'|'<='|'=='|'>='|'>') right=expr # relationExpression
| left=expr op=('&'|'&&') right=expr # andExpression
| left=expr op=('|'|'||') right=expr # orExpression
| left=expr '^' right=expr # exponentExpression
| left=expr op=('*'|'/'|'//') right=expr # mulDivExpression
| left=expr op=('+'|'-'|'%') right=expr # addSubExpression
| '!' arg=expr # negationExpression
| guard=expr '?' thenBranch=expr ':' elseBranch=expr # ifThenElseExpression
| op=('-'|'+') arg=expr # unaryExpression
| '(' expr ')' # bracketExpression
| INTEGER # intValue
| REAL # realValue
| 'false' # falseValue
| 'true' # trueValue
| '%' agent=species_expression # populationFractionExpression
| '#' agent=species_expression # populationSizeExpression
| 'now' # nowExpression
| reference=ID # referenceExpression
;
fragment DIGIT : [0-9];
fragment LETTER : [a-zA-Z_];
ID : LETTER (DIGIT|LETTER)*;
INTEGER : DIGIT+;
REAL : ((DIGIT* '.' DIGIT+)|DIGIT+ '.')(('E'|'e')('-')?DIGIT+)?;
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN) // match anything between /* and */
;
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
; |
source/nodes/program-nodes-case_paths.adb | reznikmm/gela | 0 | 5445 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Case_Paths is
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Case_Path is
begin
return Result : Case_Path :=
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Statements => Statements,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Path is
begin
return Result : Implicit_Case_Path :=
(Choices => Choices, Statements => Statements,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Choices
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Statements
(Self : Base_Case_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Statements;
end Statements;
overriding function When_Token
(Self : Case_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.When_Token;
end When_Token;
overriding function Arrow_Token
(Self : Case_Path)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Arrow_Token;
end Arrow_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Path)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Case_Path'Class) is
begin
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Statements.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Case_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Case_Path;
overriding function Is_Path (Self : Base_Case_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Path;
overriding procedure Visit
(Self : not null access Base_Case_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Case_Path (Self);
end Visit;
overriding function To_Case_Path_Text
(Self : in out Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
begin
return Self'Unchecked_Access;
end To_Case_Path_Text;
overriding function To_Case_Path_Text
(Self : in out Implicit_Case_Path)
return Program.Elements.Case_Paths.Case_Path_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Case_Path_Text;
end Program.Nodes.Case_Paths;
|
src/servlet-sessions.ads | jquorning/ada-servlet | 6 | 16240 | -----------------------------------------------------------------------
-- servlet-sessions -- Servlet Sessions
-- Copyright (C) 2010, 2011, 2018, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Objects;
with Ada.Calendar;
with Ada.Finalization;
with Ada.Strings.Unbounded;
with Servlet.Principals;
private with Util.Beans.Objects.Maps;
private with Util.Concurrent.Locks;
private with Util.Concurrent.Counters;
-- The <b>Servlet.Sessions</b> package is an Ada implementation of the
-- Java servlet Specification (See JSR 315 at jcp.org).
package Servlet.Sessions is
-- Raised if there is no session.
No_Session : exception;
-- The default session inactive timeout.
DEFAULT_INACTIVE_TIMEOUT : constant Duration := 300.0;
-- Provides a way to identify a user across more than one page request
-- or visit to a Web site and to store information about that user.
--
-- The servlet container uses this interface to create a session between
-- an HTTP client and an HTTP server. The session persists for a specified
-- time period, across more than one connection or page request from the user.
-- A session usually corresponds to one user, who may visit a site many times.
-- The server can maintain a session in many ways such as using cookies
-- or rewriting URLs.
--
-- This interface allows servlets to
-- * View and manipulate information about a session, such as the session
-- identifier, creation time, and last accessed time
-- * Bind objects to sessions, allowing user information to persist across
-- multiple user connections
--
-- A servlet should be able to handle cases in which the client does not
-- choose to join a session, such as when cookies are intentionally turned off.
-- Until the client joins the session, isNew returns true. If the client chooses
-- not to join the session, getSession will return a different session on each
-- request, and isNew will always return true.
--
-- Session information is scoped only to the current web application (ServletContext),
-- so information stored in one context will not be directly visible in another.
type Session is tagged private;
-- Returns true if the session is valid.
function Is_Valid (Sess : in Session'Class) return Boolean;
-- Returns a string containing the unique identifier assigned to this session.
-- The identifier is assigned by the servlet container and is implementation dependent.
function Get_Id (Sess : in Session) return String;
-- Returns the last time the client sent a request associated with this session,
-- as the number of milliseconds since midnight January 1, 1970 GMT, and marked
-- by the time the container recieved the request.
--
-- Actions that your application takes, such as getting or setting a value associated
-- with the session, do not affect the access time.
function Get_Last_Accessed_Time (Sess : in Session) return Ada.Calendar.Time;
-- Returns the maximum time interval, in seconds, that the servlet container will
-- keep this session open between client accesses. After this interval, the servlet
-- container will invalidate the session. The maximum time interval can be set with
-- the Set_Max_Inactive_Interval method.
-- A negative time indicates the session should never timeout.
function Get_Max_Inactive_Interval (Sess : in Session) return Duration;
-- Specifies the time, in seconds, between client requests before the servlet
-- container will invalidate this session. A negative time indicates the session
-- should never timeout.
procedure Set_Max_Inactive_Interval (Sess : in Session;
Interval : in Duration);
-- Returns the object bound with the specified name in this session,
-- or null if no object is bound under the name.
function Get_Attribute (Sess : in Session;
Name : in String) return EL.Objects.Object;
-- Binds an object to this session, using the name specified.
-- If an object of the same name is already bound to the session,
-- the object is replaced.
--
-- If the value passed in is null, this has the same effect as calling
-- removeAttribute().
procedure Set_Attribute (Sess : in out Session;
Name : in String;
Value : in EL.Objects.Object);
-- Removes the object bound with the specified name from this session.
-- If the session does not have an object bound with the specified name,
-- this method does nothing.
procedure Remove_Attribute (Sess : in out Session;
Name : in String);
-- Gets the principal that authenticated to the session.
-- Returns null if there is no principal authenticated.
function Get_Principal (Sess : in Session) return Servlet.Principals.Principal_Access;
-- Sets the principal associated with the session.
procedure Set_Principal (Sess : in out Session;
Principal : in Servlet.Principals.Principal_Access);
-- Invalidates this session then unbinds any objects bound to it.
procedure Invalidate (Sess : in out Session);
Null_Session : constant Session;
private
type Session_Record is tagged;
type Session_Record_Access is access all Session_Record'Class;
type Session_Record is new Ada.Finalization.Limited_Controlled with record
-- Reference counter.
Ref_Counter : Util.Concurrent.Counters.Counter;
-- RW lock to protect access to members.
Lock : Util.Concurrent.Locks.RW_Lock;
-- Attributes bound to this session.
Attributes : aliased Util.Beans.Objects.Maps.Map;
-- Time when the session was created.
Create_Time : Ada.Calendar.Time;
-- Time when the session was last accessed.
Access_Time : Ada.Calendar.Time;
-- Max inactive time in seconds.
Max_Inactive : Duration := DEFAULT_INACTIVE_TIMEOUT;
-- Session identifier.
Id : Ada.Strings.Unbounded.String_Access;
-- True if the session is active.
Is_Active : Boolean := True;
-- When not null, the principal that authenticated to this session.
Principal : Servlet.Principals.Principal_Access := null;
end record;
overriding
procedure Finalize (Object : in out Session_Record);
type Session is new Ada.Finalization.Controlled with record
Impl : Session_Record_Access;
end record;
-- Adjust (increment) the session record reference counter.
overriding
procedure Adjust (Object : in out Session);
-- Decrement the session record reference counter and free the session record
-- if this was the last session reference.
overriding
procedure Finalize (Object : in out Session);
Null_Session : constant Session := Session'(Ada.Finalization.Controlled with Impl => null);
end Servlet.Sessions;
|
proofs/AKS/Nat/WellFounded.agda | mckeankylej/thesis | 1 | 16614 | <reponame>mckeankylej/thesis
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym)
module AKS.Nat.WellFounded where
open import AKS.Nat.Base using (ℕ; _+_; _∸_; _≤_; _<_; lte)
open ℕ
open import AKS.Nat.Properties using (+-identityʳ; +-suc; ∸-mono-<ˡ; ∸-mono-<ʳ; suc-injective)
data Acc {A : Set} (_≺_ : A → A → Set) (bound : A) : Set where
acc : (∀ {lower : A} → lower ≺ bound → Acc _≺_ lower)
→ Acc _≺_ bound
subrelation
: ∀ {A : Set} {B : Set}
{_≺₁_ : A → A → Set}
{_≺₂_ : B → B → Set}
{f : B → A}
{n : B}
→ (∀ {x y} → x ≺₂ y → f x ≺₁ f y)
→ Acc _≺₁_ (f n)
→ Acc _≺₂_ n
subrelation ≺₂⇒≺₁ (acc down) =
acc λ x≺₂n → subrelation ≺₂⇒≺₁ (down (≺₂⇒≺₁ x≺₂n))
data _≤ⁱ_ : ℕ → ℕ → Set where
≤-same : ∀ {n} → n ≤ⁱ n
≤-step : ∀ {n m} → n ≤ⁱ m → n ≤ⁱ suc m
_<ⁱ_ : ℕ → ℕ → Set
n <ⁱ m = suc n ≤ⁱ m
<⇒<ⁱ : ∀ {n m} → n < m → n <ⁱ m
<⇒<ⁱ {n} {m} (lte zero refl) rewrite +-identityʳ n = ≤-same
<⇒<ⁱ {n} {m} (lte (suc k) refl) = ≤-step (<⇒<ⁱ (lte k (sym (+-suc n k))))
<-well-founded : ∀ {n} → Acc _<_ n
<-well-founded {n} = wf₁ n
where
wf₁ : ∀ t → Acc _<_ t
wf₂ : ∀ t b → b <ⁱ t → Acc _<_ b
wf₁ t = acc λ {b} b<t → wf₂ t b (<⇒<ⁱ b<t)
wf₂ (suc t) b ≤-same = wf₁ t
wf₂ (suc t) b (≤-step b<ⁱt) = wf₂ t b b<ⁱt
record [_,_] (low : ℕ) (high : ℕ) : Set where
inductive
constructor acc
field
downward : ∀ {mid} → low ≤ mid → mid < high → [ low , mid ]
upward : ∀ {mid} → low < mid → mid ≤ high → [ mid , high ]
binary-search : ∀ {n m} → [ n , m ]
binary-search {n} {m} = loop n m <-well-founded
where
loop : ∀ low high → Acc _<_ (high ∸ low) → [ low , high ]
loop low high (acc next) = acc
(λ {mid} low≤mid mid<high → loop low mid (next {mid ∸ low} (∸-mono-<ˡ low≤mid mid<high)))
(λ {mid} low<mid mid≤high → loop mid high (next {high ∸ mid} (∸-mono-<ʳ mid≤high low<mid)))
open import AKS.Unsafe using (trustMe)
record Interval : Set where
constructor [_,_∣_]
field
inf : ℕ
sup : ℕ
inf≤sup : inf ≤ sup
open Interval
width : Interval → ℕ
width i = sup i ∸ inf i
data _⊂_ (i₁ : Interval) (i₂ : Interval) : Set where
downward : inf i₂ ≤ inf i₁ → sup i₁ < sup i₂ → i₁ ⊂ i₂
upward : inf i₂ < inf i₁ → sup i₁ ≤ sup i₂ → i₁ ⊂ i₂
∸-monoˡ-< : ∀ {l₁ h₁ l₂ h₂} → l₁ ≤ h₁ → l₂ ≤ h₂ → l₂ ≤ l₁ → h₁ < h₂ → h₁ ∸ l₁ < h₂ ∸ l₂
∸-monoˡ-< {l₁} {h₁} {l₂} {h₂} l₁≤h₁ l₂≤h₂ l₂≤l₁ h₁<h₂ = lte ((h₂ ∸ l₂) ∸ suc (h₁ ∸ l₁)) trustMe -- TODO: EVIL
∸-monoʳ-< : ∀ {l₁ h₁ l₂ h₂} → l₁ ≤ h₁ → l₂ ≤ h₂ → l₂ < l₁ → h₁ ≤ h₂ → h₁ ∸ l₁ < h₂ ∸ l₂
∸-monoʳ-< {l₁} {h₁} {l₂} {h₂} l₁≤h₁ l₂≤h₂ l₂<l₁ h₁≤h₂ = lte ((h₂ ∸ l₂) ∸ suc (h₁ ∸ l₁)) trustMe
⊂⇒< : ∀ {i₁ i₂} → i₁ ⊂ i₂ → width i₁ < width i₂
⊂⇒< {[ inf-i₁ , sup-i₁ ∣ inf-i₁≤sup-i₁ ]} {[ inf-i₂ , sup-i₂ ∣ inf-i₂≤sup-i₂ ]} (downward inf-i₂≤inf-i₁ sup-i₁<sup-i₂)
= ∸-monoˡ-< inf-i₁≤sup-i₁ inf-i₂≤sup-i₂ inf-i₂≤inf-i₁ sup-i₁<sup-i₂
⊂⇒< {[ inf-i₁ , sup-i₁ ∣ inf-i₁≤sup-i₁ ]} {[ inf-i₂ , sup-i₂ ∣ inf-i₂≤sup-i₂ ]} (upward inf-i₂<inf-i₁ sup-i₁≤sup-i₂)
= ∸-monoʳ-< inf-i₁≤sup-i₁ inf-i₂≤sup-i₂ inf-i₂<inf-i₁ sup-i₁≤sup-i₂
⊂-well-founded : ∀ {i} → Acc _⊂_ i
⊂-well-founded = subrelation ⊂⇒< <-well-founded
|
substruction.asm | arfat01850/Assembly_Program | 1 | 16092 | <gh_stars>1-10
.MODEL COMPACT
.STACK 100H
.DATA
A DB ?
b DB ?
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV AH,1
INT 21H
MOV A,AL
INT 21H
MOV B,AL
MOV BL,A
MOV CL,B
SUB BL,CL ; BL = BL- CL
ADD BL,48
MOV AH,2
MOV DL,BL
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN |
scripts/CeruleanPokecenter.asm | AmateurPanda92/pokemon-rby-dx | 9 | 93786 | CeruleanPokecenter_Script:
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
CeruleanPokecenter_TextPointers:
dw CeruleanHealNurseText
dw CeruleanPokecenterText2
dw CeruleanPokecenterText3
dw CeruleanTradeNurseText
CeruleanTradeNurseText:
TX_CABLE_CLUB_RECEPTIONIST
CeruleanHealNurseText:
TX_POKECENTER_NURSE
CeruleanPokecenterText2:
TX_FAR _CeruleanPokecenterText2
db "@"
CeruleanPokecenterText3:
TX_FAR _CeruleanPokecenterText3
db "@"
|
msquic/msvc/evercrypt/amd64/poly1305-x86_64-msvc.asm | ThadHouse/everest-dist | 1 | 176091 | <reponame>ThadHouse/everest-dist<filename>msquic/msvc/evercrypt/amd64/poly1305-x86_64-msvc.asm
.code
ALIGN 16
x64_poly1305 proc
mov rax, rdi
mov r11, rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
mov rcx, r9
mov qword ptr [rdi + 184], rcx
push rbx
push rbp
push rax
push r11
push r12
push r13
push r14
push r15
mov r11, qword ptr [rdi + 24]
mov r12, qword ptr [rdi + 32]
mov rcx, 1152921487695413247
and r11, rcx
mov rcx, 1152921487695413244
and r12, rcx
mov qword ptr [rdi + 24], r11
mov qword ptr [rdi + 32], r12
mov rax, rdx
and rax, 15
sub rdx, rax
mov qword ptr [rdi + 56], rax
mov qword ptr [rdi + 64], rdx
mov rcx, 1
shr rdx, 4
mov r15, rdx
mov r11, qword ptr [rdi + 24]
mov r13, qword ptr [rdi + 32]
mov r14, qword ptr [rdi + 0]
mov rbx, qword ptr [rdi + 8]
mov rbp, qword ptr [rdi + 16]
mov r12, r13
shr r13, 2
mov rax, r12
add r13, r12
jmp L1
ALIGN 16
L0:
add r14, qword ptr [rsi + 0]
adc rbx, qword ptr [rsi + 8]
lea rsi, qword ptr [rsi + 16]
adc rbp, rcx
mul r14
mov r9, rax
mov rax, r11
mov r10, rdx
mul r14
mov r14, rax
mov rax, r11
mov r8, rdx
mul rbx
add r9, rax
mov rax, r13
adc r10, rdx
mul rbx
mov rbx, rbp
add r14, rax
adc r8, rdx
imul rbx, r13
add r9, rbx
mov rbx, r8
adc r10, 0
imul rbp, r11
add rbx, r9
mov rax, 18446744073709551612
adc r10, rbp
and rax, r10
mov rbp, r10
shr r10, 2
and rbp, 3
add rax, r10
add r14, rax
adc rbx, 0
adc rbp, 0
mov rax, r12
sub r15, 1
ALIGN 16
L1:
cmp r15, 0
jne L0
mov qword ptr [rdi + 0], r14
mov qword ptr [rdi + 8], rbx
mov qword ptr [rdi + 16], rbp
mov rax, qword ptr [rdi + 184]
cmp rax, 1
jne L2
mov r15, qword ptr [rdi + 56]
cmp r15, 0
je L4
mov rax, qword ptr [rdi + 32]
mov r8, qword ptr [rsi + 0]
mov r9, qword ptr [rsi + 8]
cmp r15, 8
jae L6
mov rcx, r15
shl rcx, 3
mov rdx, 1
shl rdx, cl
mov rcx, rdx
sub rcx, 1
and r8, rcx
mov r9, 0
add r14, r8
adc rbx, r9
adc rbp, 0
add r14, rdx
adc rbx, 0
adc rbp, 0
jmp L7
L6:
mov rcx, r15
sub rcx, 8
shl rcx, 3
mov rdx, 1
shl rdx, cl
mov rcx, rdx
sub rcx, 1
and r9, rcx
add r14, r8
adc rbx, r9
adc rbp, 0
add r14, 0
adc rbx, rdx
adc rbp, 0
L7:
mul r14
mov r9, rax
mov rax, r11
mov r10, rdx
mul r14
mov r14, rax
mov rax, r11
mov r8, rdx
mul rbx
add r9, rax
mov rax, r13
adc r10, rdx
mul rbx
mov rbx, rbp
add r14, rax
adc r8, rdx
imul rbx, r13
add r9, rbx
mov rbx, r8
adc r10, 0
imul rbp, r11
add rbx, r9
mov rax, 18446744073709551612
adc r10, rbp
and rax, r10
mov rbp, r10
shr r10, 2
and rbp, 3
add rax, r10
add r14, rax
adc rbx, 0
adc rbp, 0
jmp L5
L4:
L5:
mov r8, r14
mov r9, rbx
mov r10, rbp
add r8, 5
adc r9, 0
adc r10, 0
shr r10, 2
mov rax, r10
sub rax, 1
and r14, rax
and rbx, rax
mov rax, 0
sub rax, r10
and r8, rax
and r9, rax
add r14, r8
add rbx, r9
mov rax, qword ptr [rdi + 40]
mov rdx, qword ptr [rdi + 48]
add r14, rax
adc rbx, rdx
jmp L3
L2:
L3:
mov qword ptr [rdi + 0], r14
mov qword ptr [rdi + 8], rbx
mov qword ptr [rdi + 16], rbp
pop r15
pop r14
pop r13
pop r12
pop rsi
pop rax
pop rbp
pop rbx
mov rdi, rax
ret
x64_poly1305 endp
end
|
google-reverser-image-search.scpt | oblitorum/google-reverse-image-search-quick-action | 0 | 3258 | <reponame>oblitorum/google-reverse-image-search-quick-action
tell application "Finder" to set theFile to POSIX path of (selection as alias)
set link to do shell script "curl -s -i -F sch=sch -F encoded_image=@" & quoted form of theFile & " https://www.google.com/searchbyimage/upload | grep -Fi location | cut -d ' ' -f2-"
open location link
|
src/sparknacl-sign-utils.ads | yannickmoy/SPARKNaCl | 76 | 19172 | <gh_stars>10-100
package SPARKNaCl.Sign.Utils
with Pure,
SPARK_Mode => On
is
procedure Construct (X : in Bytes_64;
Y : out Signing_SK);
end SPARKNaCl.Sign.Utils;
|
antlr/java/11-history/CmdLine.g4 | flange/drift-dev | 2 | 5206 | <filename>antlr/java/11-history/CmdLine.g4
grammar CmdLine;
script
: cmd
| query
| ls
| cd
| rm
;
cd
: 'cd ' namespace
| 'cd ' up
;
up
: UP ('/')?
| UP ('/'UP('/')?)*
;
ls
: 'ls'
| 'ls ' namespace
;
rm
: 'rm ' targetName
| 'rm ' targetNamespace
;
query
: '$'targetName
| '$'targetNamespace
;
cmd
: syncCmd
| asyncCmd
;
syncCmd
: service (' | ' service)*
| targetName ' = ' service (' | ' service)*
| targetNamespace ' = ' serviceNsOut
;
asyncCmd
: targetName ' = ' service (' | ' service)* ' &'
| targetNamespace ' = ' serviceNsOut ' &'
;
service
: binary args* argName? (' 'argName)*
;
serviceNsOut
: binary'*' args* argName? (' 'argName)*
;
serviceNsIn
: '*'binary args* argName? (' 'argName)*
;
serviceNsInOut
: '*'binary'*' args* argName? (' 'argName)*
;
argName
: name
| namespace
;
name
: ID_S ('/'ID_S)*
;
namespace
: ID_S'/'(ID_S'/')*
;
targetName
: name
;
targetNamespace
: namespace
;
binary
: ID_B
;
args
: OPTION
;
ID_S : [a-z]('a'..'z' | 'A'..'Z' | '0'..'9' | '.')* ;
ID_B : [A-Z]('a'..'z' | 'A'..'Z' | '0'..'9')* ;
FILE : ID_S '.' ID_S ;
OPTION : '-'ID_S ;
UP : '..' ;
WS : [ \t\n]+ -> skip ;
|
source/progaid/renumapp.asm | zellyn/goapple2 | 9 | 4226 | **************************************************
* *
* APPLE-][ BASIC RENUMBER / APPEND SUBROUTINES *
* *
* VERSION TWO *
* RENUMBER *
* >CLR *
* >START= *
* >STEP= *
* >CALL -10531 *
* *
* OPTIONAL *
* >FROM= *
* >TO= *
* >CALL -10521 *
* *
* USE RENX ENTRY *
* FOR RENUMBER ALL *
* *
* WOZ APRIL 12, 1978 *
* APPLE COMPUTER INC. *
**************************************************
*
*
*
*
ROL EQU $0 LOW-ORDER SW16 R0 BYTE.
ROH EQU $1 HI-ORDER.
ONE EQU $01
R11L EQU $16 LOW-ORDER SW16 R11 BYTE.
R11H EQU $17 HI-ORDER.
HIMEM EQU $4C BASIC HIMEM POINTER.
PPL EQU $CA BASIC PROG POINTER.
PVL EQU $CC BASIC VAR POINTER.
MEMFULL EQU $E36B BASIC MEM FULL ERROR.
PRDEC EQU $E51B BASIC DECIMAL PRINT SUBR.
RANGERR EQU $EE68 BASIC RANGE ERROR.
LOAD EQU $F0DF BASIC LOAD SUBR.
SW16 EQU $F689 SWEET 16 ENTRY.
CROUT EQU $FD8E CAR RET SUBR.
COUT EQU $FDED CHAR OUT SUBR.
*
* SWEET 16 EQUATES
*
ACC EQU $0 SWEET 16 ACCUMULATOR.
NEWLOW EQU $1 NEW INITIAL LNO.
NEWINCR EQU $2 NEW LNO INCR.
LNLOW EQU $3 LOW LNO OF RENUM RANGE.
LNHI EQU $4 HI LNO OF RENUM RANGE.
TBLSTRT EQU $5 LNO TABLE START.
TBLNDX1 EQU $6 PASS 1 LNO TBL INDEX.
TBLIM EQU $7 LNO TABLE LIMIT.
SCR8 EQU $8 SCRATCH REG.
HMEM EQU $8 HIMEM (END OF PRGM).
SCR9 EQU $9 SCRATCH REG.
PRGNDX EQU $9 PASS 1 PROG INDEX.
PRGNDX1 EQU $A ALSO PROG INDEX.
NEWLN EQU $B NEXT "NEW LNO".
NEWLN1 EQU $C PRIOR "NEW LNO" ASSIGN.
TBLND EQU $6 PASS 2 LNO TABLE END.
PRGNDX2 EQU $7 PASS 2 PROG INDEX.
CHR0 EQU $9 ASCII "0".
CHRA EQU $A ASCII "A".
MODE EQU $C CONST/LNO MODE.
TBLNDX2 EQU $B LNO TBL IDX FOR UPDATE.
OLDLN EQU $D OLD LNO FOR UPDATE.
STRCON EQU $B BASIC STR CON TOKEN.
REM EQU $C BASIC REM TOKEN
R13 EQU $D SWEET 16 REG 13 (CPR REG).
THEN EQU $D BASIC THEN TOKEN
LIST EQU $D BASIC LIST TOKEN
DEL EQU $D
SCRC EQU $C SCRATCH REG FOR APPEND.
*
* APPLE-11 BASIC RENUMBER SUBROUTINE - PASS 1
ORG $D400
OBJ $A400
|
src/test/ref/function-as-array.asm | jbrandwood/kickc | 2 | 2752 | <reponame>jbrandwood/kickc
// Tests treating a function like an array
// Should produce an error
// https://gitlab.com/camelot/kickc/issues/276
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
jsr new_ball
rts
}
new_ball: {
inc BALLS
rts
}
BALLS: .fill $10, 0
|
Applications/Terminal/window/iterate.applescript | looking-for-a-job/applescript-examples | 1 | 2929 | <filename>Applications/Terminal/window/iterate.applescript
#!/usr/bin/osascript
tell application "Terminal"
repeat with w in every window
get properties of w
tell w
name
end tell
end repeat
end tell |
test/Fail/Issue3480.agda | cruhland/agda | 1,989 | 3061 | <filename>test/Fail/Issue3480.agda
-- Andreas, 2018-12-30, issue #3480
-- Parse error should be reported close to the incomplete "module _"
-- rather than at the end of the file, which is miles away.
module _
{- A long comment:
<NAME>
ON THE MEANINGS OF THE LOGICAL
CONSTANTS AND THE JUSTIFICATIONS
OF THE LOGICAL LAWS
Preface
The following three lectures were given in the form of a short course
at the meeting Teoria della Dimostrazione e Filosofia della Logica,
organized in Siena, 6-9 April 1983, by the Scuola di Specializzazione in
Logica Matematica of the Universit`a degli Studi di Siena. I am very
grateful to <NAME> and <NAME> of that school, not only
for recording the lectures on tape, but, above all, for transcribing the
tapes produced by the recorder: no machine could have done that work.
This written version of the lectures is based on their transcription. The
changes that I have been forced to make have mostly been of a stylistic
nature, except at one point. In the second lecture, as I actually gave
it, the order of conceptual priority between the notions of proof and
immediate inference was wrong. Since I discovered my mistake later
the same month as the meeting was held, I thought it better to let
the written text diverge from the oral presentation rather than possibly
confusing others by letting the mistake remain. The oral origin of
these lectures is the source of the many redundancies of the written
text. It is also my sole excuse for the lack of detailed references.
First lecture
When I was asked to give these lectures about a year ago, I suggested
the title On the Meanings of the Logical Constants and the
Justifications of the Logical Laws. So that is what I shall talk about,
eventually, but, first of all, I shall have to say something about, on
the one hand, the things that the logical operations operate on, which
we normally call propositions and propositional functions, and, on the
Nordic Journal of Philosophical Logic, Vol. 1, No. 1, pp. 11-60.
cfl 1996 Scandinavian University Press.
12 per martin-l"of
other hand, the things that the logical laws, by which I mean the rules
of inference, operate on, which we normally call assertions. We must
remember that, even if a logical inference, for instance, a conjunction
introduction, is written
A B
A & B
which is the way in which we would normally write it, it does not take
us from the propositions A and B to the proposition A & B. Rather, it
takes us from the affirmation of A and the affirmation of B to the
affirmation of A & B, which we may make explicit, using Frege's notation,
by writing it `
A ` B
` A & B
instead. It is always made explicit in this way by Frege in his writings,
and in Principia, for instance. Thus we have two kinds of entities here:
we have the entities that the logical operations operate on, which we
call propositions, and we have those that we prove and that appear
as premises and conclusion of a logical inference, which we call assertions. It turns out that, in order to clarify the meanings of the logical
constants and justify the logical laws, a considerable portion of the
philosophical work lies already in clarifying the notion of proposition
and the notion of assertion. Accordingly, a large part of my lectures
will be taken up by a philosophical analysis of these two notions.
Let us first look at the term proposition. It has its origin in the Gr.
pri`tasij, used by Aristotle in the Prior Analytics, the third part of the
Organon. It was translated, apparently by Cicero, into Lat. propositio,
which has its modern counterparts in It. proposizione, Eng. proposition and Ger. Satz. In the old, traditional use of the word proposition,
propositions are the things that we prove. We talk about proposition
and proof, of course, in mathematics: we put up a proposition and let
it be followed by its proof. In particular, the premises and conclusion
of an inference were propositions in this old terminology. It was the
standard use of the word up to the last century. And it is this use
which is retained in mathematics, where a theorem is sometimes called
a proposition, sometimes a theorem. Thus we have two words for the
things that we prove, proposition and theorem. The word proposition,
Gr. pri`tasij, comes from Aristotle and has dominated the logical tradition, whereas the word theorem, Gr. qey"rhma, is in Euclid, I believe,
and has dominated the mathematical tradition.
With Kant, something important happened, namely, that the
term judgement, Ger. Urteil, came to be used instead of proposition.
on the meanings of the logical constants 13
Perhaps one reason is that proposition, or a word with that stem, at
least, simply does not exist in German: the corresponding German
word would be Lehrsatz, or simply Satz. Be that as it may, what happened with Kant and the ensuing German philosophical tradition was
that the word judgement came to replace the word proposition. Thus,
in that tradition, a proof, Ger. Beweis, is always a proof of a judgement. In particular, the premises and conclusion of a logical inference
are always called judgements. And it was the judgements, or the categorical judgements, rather, which were divided into affirmations and
denials, whereas earlier it was the propositions which were so divided.
The term judgement also has a long history. It is the Gr. krDHsij,
translated into Lat. judicium, It. giudizio, Eng. judgement, and Ger.
Urteil. Now, since it has as long a history as the word proposition,
these two were also previously used in parallel. The traditional way of
relating the notions of judgement and proposition was by saying that a
proposition is the verbal expression of a judgement. This is, as far as I
know, how the notions of proposition and judgement were related during the scholastic period, and it is something which is repeated in the
Port Royal Logic, for instance. You still find it repeated by Brentano
in this century. Now, this means that, when, in German philosophy
beginning with Kant, what was previously called a proposition came
to be called a judgement, the term judgement acquired a double meaning. It came to be used, on the one hand, for the act of judging, just
as before, and, on the other hand, it came to be used instead of the old
proposition. Of course, when you say that a proposition is the verbal
expression of a judgement, you mean by judgement the act of judging,
the mental act of judging in scholastic terms, and the proposition is the
verbal expression by means of which you make the mental judgement
public, so to say. That is, I think, how one thought about it. Thus,
with Kant, the term judgement became ambiguous between the act of
judging and that which is judged, or the judgement made, if you prefer.
German has here the excellent expression gef"alltes Urteil, which has no
good counterpart in English.
judgement
z ""-- -
the act of judging that which is judged
old tradition judgement proposition
Kant Urteil(sakt) (gef"alltes) Urteil
This ambiguity is not harmful, and sometimes it is even convenient,
because, after all, it is a kind of ambiguity that the word judgement
14 per martin-l"of
shares with other nouns of action. If you take the word proposition,
for instance, it is just as ambiguous between the act of propounding
and that which is propounded. Or, if you take the word affirmation, it
is ambiguous between the act of affirming and that which is affirmed,
and so on.
It should be clear, from what I said in the beginning, that there is
a difference between what we now call a proposition and a proposition
in the old sense. In order to trace the emergence of the modern notion
of proposition, I first have to consider the division of propositions in
the old sense into affirmations and denials. Thus the propositions, or
the categorical propositions, rather, were divided into affirmations and
denials.
(categorical) proposition
z ""-- -
affirmation denial
And not only were the categorical propositions so divided: the very
definition of a categorical proposition was that a categorical proposition
is an affirmation or a denial. Correlatively, to judge was traditionally,
by which I mean before Kant, defined as to combine or separate ideas
in the mind, that is, to affirm or deny. Those were the traditional
definitions of the notions of proposition and judgement.
The notions of affirmation and denial have fortunately remained
stable, like the notion of proof, and are therefore easy to use without
ambiguity. Both derive from Aristotle. Affirmation is Gr. katL'fasij,
Lat. affirmatio, It. affermazione, and Ger. Bejahung, whereas denial
is Gr. C'pi`fasij, Lat. negatio, It. negazione, and Ger. Verneinung. In
Aristotelian logic, an affirmation was defined as a proposition in which
something, called the predicate, is affirmed of something else, called
the subject, and a denial was defined as a proposition in which the
predicate is denied of the subject. Now, this is something that we have
certainly abandoned in modern logic. Neither do we take categorical
judgements to have subject-predicate form, nor do we treat affirmation
and denial symmetrically. It seems to have been Bolzano who took the
crucial step of replacing the Aristotelian forms of judgement by the
single form
A is, A is true, or A holds.
In this, he was followed by Brentano, who also introduced the opposite
form
A is not, or A is false,
on the meanings of the logical constants 15
and Frege. And, through Frege's influence, the whole of modern logic
has come to be based on the single form of judgement, or assertion, A
is true.
Once this step was taken, the question arose, What sort of thing
is it that is affirmed in an affirmation and denied in a denial? that is,
What sort of thing is the A here? The isolation of this concept belongs
to the, if I may so call it, objectivistically oriented branch of German
philosophy in the last century. By that, I mean the tradition which you
may delimit by mentioning the names of, say, Bolzano, Lotze, Frege,
Brentano, and the Brentano disciples Stumpf, Meinong, and Husserl,
although, with Husserl, I think one should say that the split between
the objectivistic and the Kantian branches of German philosophy is
finally overcome. The isolation of this concept was a step which was
entirely necessary for the development of modern logic. Modern logic
simply would not work unless we had this concept, because it is on the
things that fall under it that the logical operations operate.
This new concept, which simply did not exist before the last century, was variously called. And, since it was something that one had not
met before, one had difficulties with what one should call it. Among
the terms that were used, I think the least committing one is Ger.
Urteilsinhalt, content of a judgement, by which I mean that which is
affirmed in an affirmation and denied in a denial. Bolzano, who was
the first to introduce this concept, called it proposition in itself, Ger.
Satz an sich. Frege also grappled with this terminological problem.
In Begriffsschrift, he called it judgeable content, Ger. beurteilbarer Inhalt. Later on, corresponding to his threefold division into expression, sense, and reference, in the case of this kind of entity, what was
the expression, he called sentence, <NAME>, what was the sense, he
called thought, <NAME>ke, and what was the reference, he called
truth value, Ger. Wahrheitswert. So the question arises, What should
I choose here? Should I choose sentence, thought, or truth value? The
closest possible correspondence is achieved, I think, if I choose Gedanke,
that is, thought, for late Frege. This is confirmed by the fact that, in
his very late logical investigations, he called the logical operations the
Gedankengef"uge. Thus judgeable content is early Frege and thought
is late Frege. We also have the term state of affairs, Ger. Sachverhalt,
which was introduced by Stumpf and used by Wittgenstein in the Tractatus. And, finally, we have the term objective, Ger. Objektiv, which
was the term used by Meinong. Maybe there were other terms as well
in circulation, but these are the ones that come immediately to my
mind.
Now, Russell used the term proposition for this new notion, which
16 per martin-l"of
has become the standard term in Anglo-Saxon philosophy and in modern logic. And, since he decided to use the word proposition in this
new sense, he had to use another word for the things that we prove and
that figure as premises and conclusion of a logical inference. His choice
was to translate Frege's Urteil, not by judgement, as one would expect,
but by assertion. And why, one may ask, did he choose the word assertion rather than translate Urteil literally by judgement? I think it
was to avoid any association with Kantian philosophy, because Urteil
was after all the central notion of logic as it was done in the Kantian
tradition. For instance, in his transcendental logic, which forms part
of the Kritik der reinen Vernunft, Kant arrives at his categories by
analysing the various forms that a judgement may have. That was his
clue to the discovery of all pure concepts of reason, as he called it.
Thus, in Russell's hands, Frege's Urteil came to be called assertion,
and the combination of Frege's Urteilsstrich, judgement stroke, and
Inhaltsstrich, content stroke, came to be called the assertion sign.
Observe now where we have arrived through this development,
namely, at a notion of proposition which is entirely different, or different, at least, from the old one, that is, from the Gr. pri`tasij and
the Lat. propositio. To repeat, the things that we prove, in particular, the premises and conclusion of a logical inference, are no longer
propositions in Russell's terminology, but assertions. Conversely, the
things that we combine by means of the logical operations, the connectives and the quantifiers, are not propositions in the old sense, that
is, what Russell calls assertions, but what he calls propositions. And,
as I said in the very beginning, the rule of conjunction introduction,
for instance, really allows us to affirm A & B, having affirmed A and
having affirmed B, `
A ` B
` A & B
It is another matter, of course, that we may adopt conventions that
allow us to suppress the assertion sign, if it becomes too tedious to
write it out. Conceptually, it would nevertheless be there, whether I
write it as above or A true B true
A & B true
as I think that I shall do in the following.
So far, I have made no attempt at defining the notions of judgement, or assertion, and proposition. I have merely wanted to give a
preliminary hint at the difference between the two by showing how the
terminology has evolved.
on the meanings of the logical constants 17
To motivate my next step, consider any of the usual inference rules
of the propositional or predicate calculus. Let me take the rule of
disjunction introduction this time, for some change,
A
A . B
or, writing out the affirmation,
A true
A . B true
Now, what do the variables A and B range over in a rule like this?
That is, what are you allowed to insert into the places indicated by
these variables? The standard answer to this question, by someone
who has received the now current logical education, would be to say
that A and B range over arbitrary formulas of the language that you are
considering. Thus, if the language is first order arithmetic, say, then
A and B should be arithmetical formulas. When you start thinking
about this answer, you will see that there is something strange about
it, namely, its language dependence. Because it is clearly irrelevant for
the validity of the rule whether A and B are arithmetical formulas, corresponding to the language of first order arithmetic, or whether they
contain, say, predicates defined by transfinite, or generalized, induction. The unary predicate expressing that a natural number encodes
an ordinal of the constructive second number class, for instance, is certainly not expressible in first order arithmetic, and there is no reason
at all why A and B should not be allowed to contain that predicate.
Or, surely, for the validity of the rule, A and B might just as well
be set theoretical formulas, supposing that we have given such a clear
sense to them that we clearly recognize that they express propositions.
Thus what is important for the validity of the rule is merely that A and
B are propositions, that is, that the expressions which we insert into
the places indicated by the variables A and B express propositions. It
seems, then, that the deficiency of the first answer, by which I mean
the answer that A and B should range over formulas, is eliminated
by saying that the variables A and B should range over propositions
instead of formulas. And this is entirely natural, because, after all, the
notion of formula, as given by the usual inductive definition, is nothing
but the formalistic substitute for the notion of proposition: when you
divest a proposition in some language of all sense, what remains is the
mere formula. But then, supposing we agree that the natural way out
of the first difficulty is to say that A and B should range over arbitrary
18 per martin-l"of
propositions, another difficulty arises, because, whereas the notion of
formula is a syntactic notion, a formula being defined as an expression
that can be formed by means of certain formation rules, the notion
of proposition is a semantic notion, which means that the rule is no
longer completely formal in the strict sense of formal logic. That a rule
of inference is completely formal means precisely that there must be
no semantic conditions involved in the rule: it may only put conditions
on the forms of the premises and conclusion. The only way out of this
second difficulty seems to be to say that, really, the rule has not one
but three premises, so that, if we were to write them all out, it would
read A prop B prop A true
A . B true
that is, from A and B being propositions and from the truth of A, we
are allowed to conclude the truth of A . B. Here I am using
A prop
as an abbreviated way of saying that
A is a proposition.
Now the complete formality of the rule has been restored. Indeed, for
the variables A and B, as they occur in this rule, we may substitute
anything we want, and, by anything, I mean any expressions. Or, to
be more precise, if we categorize the expressions, as Frege did, into
complete, or saturated, expressions and incomplete, unsaturated, or
functional, expressions, then we should say that we may substitute for
A and B any complete expressions we want, because propositions are
always expressed by complete expressions, not by functional expressions. Thus A and B now range over arbitrary complete expressions.
Of course, there would be needed here an analysis of what is understood by an expression, but that is something which I shall not go into
in these lectures, in the belief that it is a comparatively trivial matter,
as compared with explaining the notions of proposition and judgement.
An expression in the most general sense of the word is nothing but a
form, that is, something that we can passively recognize as the same in
its manifold occurrences and actively reproduce in many copies. But
I think that I shall have to rely here upon an agreement that we have
such a general notion of expression, which is formal in character, so
that the rule can now count as a formal rule.
Now, if we stick to our previous decision to call what we prove, in
particular, the premises and conclusion of a logical inference, by the
on the meanings of the logical constants 19
word judgement, or assertion, the outcome of the preceding considerations is that we are faced with a new form of judgement. After all, A
prop and B prop have now become premises of the rule of disjunction
introduction. Hence, if premises are always judgements,
A is a proposition
must count as a form of judgement. This immediately implies that the
traditional definition of the act of judging as an affirming or denying
and of the judgement, that is, the proposition in the terminology then
used, as an affirmation or denial has to be rejected, because A prop is
certainly neither an affirmation nor a denial. Or, rather, we are faced
with the choice of either keeping the old definition of judgement as
an affirmation or a denial, in which case we would have to invent a
new term for the things that we prove and that figure as premises and
conclusion of a logical inference, or else abandoning the old definition
of judgement, widening it so as to make room for A is a proposition
as a new form of judgement. I have chosen the latter alternative, well
aware that, in so doing, I am using the word judgement in a new way.
Having rejected the traditional definition of a judgement as an affirmation or a denial, by what should we replace it? How should we
now delimit the notion of judgement, so that A is a proposition, A
is true, and A is false all become judgements? And there are other
forms of judgement as well, which we shall meet in due course. Now,
the question, What is a judgement? is no small question, because the
notion of judgement is just about the first of all the notions of logic,
the one that has to be explained before all the others, before even the
notions of proposition and truth, for instance. There is therefore an
intimate relation between the answer to the question what a judgement
is and the very question what logic itself is. I shall start by giving a
very simple answer, which is essentially right: after some elaboration,
at least, I hope that we shall have a sufficiently clear understanding of
it. And the definition would simply be that, when understood as an act
of judging, a judgement is nothing but an act of knowing, and, when
understood as that which is judged, it is a piece or, more solemnly, an
object of knowledge.
judgement
z ""-- -
the act of judging that which is judged
the act of knowing the object of knowledge
Thus, first of all, we have the ambiguity of the term judgement between
the act of judging and that which is judged. What I say is that an act
20 per martin-l"of
of judging is essentially nothing but an act of knowing, so that to judge
is the same as to know, and that what is judged is a piece, or an object,
of knowledge. Unfortunately, the English language has no counterpart
of Ger. eine Erkenntnis, a knowledge.
This new definition of the notion of judgement, so central to logic,
should be attributed in the first place to Kant, I think, although it may
be difficult to find him ever explicitly saying that the act of judging is
the same as the act of knowing, and that what is judged is the object of
knowledge. Nevertheless, it is behind all of Kant's analysis of the notion
of judgement that to judge amounts to the same as to know. It was
he who broke with the traditional, Aristotelian definition of judgement
as an affirmation or a denial. Explicitly, the notions of judgement
and knowledge were related by Bolzano, who simply defined knowledge
as evident judgement. Thus, for him, the order of priority was the
reverse: knowledge was defined in terms of judgement rather than the
other way round. The important thing to realize is of course that to
judge and to know, and, correlatively, judgement and knowledge, are
essentially the same. And, when the relation between judgement, or
assertion, if you prefer, and knowledge is understood in this way, logic
itself is naturally understood as the theory of knowledge, that is, of
demonstrative knowledge, Aristotle's a^pista*mh C'podeiktika*. Thus logic
studies, from an objective point of view, our pieces of knowledge as
they are organized in demonstrative science, or, if you think about it
from the act point of view, it studies our acts of judging, or knowing,
and how they are interrelated.
As I said a moment ago, this is only a first approximation, because
it would actually have been better if I had not said that an act of
judging is an act of knowing, but if I had said that it is an act of, and
here there are many words that you may use, either understanding,
or comprehending, or grasping, or seeing, in the metaphorical sense
of the word see in which it is synonymous with understand. I would
prefer this formulation, because the relation between the verb to know
and the verb to understand, comprehend, grasp, or see, is given by the
equation
to know = to have understood, comprehended, grasped, seen,
which has the converse
to understand, comprehend, grasp, see = to get to know.
The reason why the first answer needs elaboration is that you may
use know in English both in the sense of having understood and in
the sense of getting to understand. Now, the first of the preceding
on the meanings of the logical constants 21
two equations brings to expression something which is deeply rooted
in the Indo-European languages. For instance, Gr. oU'da, I know, is the
perfect form of the verb whose present form is Gr. eO`dw, I see. Thus
to know is to have seen merely by the way the verb has been formed
in Greek. It is entirely similar in Latin. You have Lat. nosco, I get to
know, which has present form, and Lat. novi, I know, which has perfect
form. So, in these and other languages, the verb to know has present
sense but perfect form. And the reason for the perfect form is that to
know is to have seen. Observe also the two metaphors for the act of
understanding which you seem to have in one form or the other in all
European languages: the metaphor of seeing, first of all, which was so
much used by the Greeks, and which we still use, for instance, when
saying that we see that there are infinitely many prime numbers, and,
secondly, the metaphor of grasping, which you also find in the verb to
comprehend, derived as it is from Lat. prehendere, to seize. The same
metaphor is found in Ger. fassen and begreifen, and I am sure that you
also have it in Italian. (Chorus. Afferare!) Of course, these are two
metaphors that we use for this particular act of the mind: the mental
act of understanding is certainly as different from the perceptual act
of seeing something as from the physical act of grasping something.
Is a judgement a judgement already before it is grasped, that is,
becomes known, or does it become a judgement only through our act
of judging? And, in the latter case, what should we call a judgement
before it has been judged, that is, has become known? For example, if
you let G be the proposition that every even number is the sum of two
prime numbers, and then look at
G is true,
is it a judgement, or is it not a judgement? Clearly, in one sense, it
is, and, in another sense, it is not. It is not a judgement in the sense
that it is not known, that is, that it has not been proved, or grasped.
But, in another sense, it is a judgement, namely, in the sense that G
is true makes perfectly good sense, because G is a proposition which
we all understand, and, presumably, we understand what it means
for a proposition to be true. The distinction I am hinting at is the
distinction which was traditionally made between an enunciation and a
proposition. Enunciation is not a word of much currency in English, but
I think that its Italian counterpart has fared better. The origin is the
Gr. C'pi`fansij as it appears in De Interpretatione, the second part of
the Organon. It has been translated into Lat. enuntiatio, It. enunciato,
and Ger. Aussage. An enunciation is what a proposition, in the old
sense of the word, is before it has been proved, or become known. Thus
22 per martin-l"of
it is a proposition stripped of its epistemic force. For example, in this
traditional terminology, which would be fine if it were still living, G is
true is a perfectly good enunciation, but it is not a proposition, not yet
at least. But now that we have lost the term proposition in its old sense,
having decided to use it in the sense in which it started to be used by
Russell and is now used in Anglo-Saxon philosophy and modern logic,
I think we must admit that we have also lost the traditional distinction
between an enunciation and a proposition. Of course, we still have
the option of keeping the term enunciation, but it is no longer natural.
Instead, since I have decided to replace the term proposition in its old
sense, as that which we prove and which may appear as premise or
conclusion of a logical inference, by the term judgement, as it has been
used in German philosophy from Kant and onwards, it seems better,
when there is a need of making the distinction between an enunciation
and a proposition, that is, between a judgement before and after it has
been proved, or become known, to speak of a judgement and an evident
judgement, respectively. This is a wellestablished usage in the writings
of Bolzano, Brentano, and Husserl, that is, within the objectivistically
oriented branch of German philosophy that I mentioned earlier. If we
adopt this terminology, then we are faced with a fourfold table, which
I shall end by writing up.
judgement proposition
evident judgement true proposition
Thus, correlated with the distinction between judgement and proposition, there is the distinction between evidence of a judgement and
truth of a proposition.
So far, I have said very little about the notions of proposition and
truth. The essence of what I have said is merely that to judge is the
same as to know, so that an evident judgement is the same as a piece,
or an object, of knowledge, in agreement with Bolzano's definition of
knowledge as evident judgement. Tomorrow's lecture will have to be
taken up by an attempt to clarify the notion of evidence and the notions
of proposition and truth.
Second lecture
Under what condition is it right, or correct, to make a judgement,
one of the form
A is true,
on the meanings of the logical constants 23
which is certainly the most basic form of judgement, for instance?
When one is faced with this question for the first time, it is tempting to answer simply that it is right to say that A is true provided that
A is true, and that it is wrong to say that A is true provided that A is
not true, that is, provided that A is false. In fact, this is what Aristotle
says in his definition of truth in the Metaphysics. For instance, he says
that it is not because you rightly say that you are white that you are
white, but because you are white that what you say is correct. But a
moment's reflection shows that this first answer is simply wrong. Even
if every even number is the sum of two prime numbers, it is wrong of
me to say that unless I know it, that is, unless I have proved it. And it
would have been wrong of me to say that every map can be coloured
by four colours before the recent proof was given, that is, before I acquired that knowledge, either by understanding the proof myself, or
by trusting its discoverers. So the condition for it to be right of me to
affirm a proposition A, that is, to say that A is true, is not that A is
true, but that I know that A is true. This is a point which has been
made by Dummett and, before him, by Brentano, who introduced the
apt term blind judgement for a judgement which is made by someone
who does not know what he is saying, although what he says is correct
in the weaker sense that someone else knows it, or, perhaps, that he
himself gets to know it at some later time. When you are forced into
answering a yes or no question, although you do not know the answer,
and happen to give the right answer, right as seen by someone else, or
by you yourself when you go home and look it up, then you make a
blind judgement. Thus you err, although the teacher does not discover
your error. Not to speak of the fact that the teacher erred more greatly
by not giving you the option of giving the only the answer which would
have been honest, namely, that you did not know.
The preceding consideration does not depend on the particular form
of judgement, in this case, A is true, that I happened to use as an
example. Quite generally, the condition for it to be right of you to
make a judgement is that you know it, or, what amounts to the same,
that it is evident to you. The notion of evidence is related to the notion
of knowledge by the equation
evident = known.
When you say that a judgement is evident, you merely express that
you have understood, comprehended, grasped, or seen it, that is, that
you know it, because to have understood is to know. This is reflected
in the etymology of the word evident, which comes from Lat. ex, out
of, from, and videre, to see, in the metaphorical sense, of course.
24 per martin-l"of
There is absolutely no question of a judgement being evident in
itself, independently of us and our cognitive activity. That would be
just as absurd as to speak of a judgement as being known, not by
somebody, you or me, but in itself. To be evident is to be evident to
somebody, as inevitably as to be known is to be known by somebody.
That is what Brouwer meant by saying, in Consciousness, Philosophy,
and Mathematics, that there are no nonexperienced truths, a basic
intuitionistic tenet. This has been puzzling, because it has been understood as referring to the truth of a proposition, and clearly there are
true propositions whose truth has not been experienced, that is, propositions which can be shown to be true in the future, although they have
not been proved to be true now. But what Brouwer means here is not
that. He does not speak about propositions and truth: he speaks about
judgements and evidence, although he uses the term truth instead of
the term evidence. And what he says is then perfectly right: there is
no evident judgement whose evidence has not been experienced, and
experience it is what you do when you understand, comprehend, grasp,
or see it. There is no evidence outside our actual or possible experience of it. The notion of evidence is by its very nature subject related,
relative to the knowing subject, that is, in Kantian terminology.
As I already said, when you make, or utter, a judgement under
normal circumstances, you thereby express that you know it. There is
no need to make this explicit by saying,
I know that . . .
For example, when you make a judgement of the form
A is true
under normal circumstances, by so doing, you already express that you
know that A is true, without having to make this explicit by saying,
I know that A is true,
or the like. A judgement made under normal circumstances claims by
itself to be evident: it carries its claim of evidence automatically with
it. This is a point which was made by Wittgenstein in the Tractatus
by saying that Frege's Urteilsstrich, judgement stroke, is logically quite
meaningless, since it merely indicates that the proposition to which it
is prefixed is held true by the author, although it would perhaps have
been better to say, not that it is meaningless, but that it is superfluous,
since, when you make a judgement, it is clear already from its form that
you claim to know it. In speech act philosophy, this is expressed by
on the meanings of the logical constants 25
saying that knowing is an illocutionary force: it is not an explicit part
of what you say that you know it, but it is implicit in your saying of
it. This is the case, not only with judgements, that is, acts of knowing,
but also with other kinds of acts. For instance, if you say,
Would she come tonight!
it is clear from the form of your utterance that you express a wish.
There is no need of making this explicit by saying,
I wish that she would come tonight.
Some languages, like Greek, use the optative mood to make it clear
that an utterance expresses a wish or desire.
Consider the pattern that we have arrived at now,
I
act
z ""-- -know objectz ""-- -
A is true
Here the grammatical subject I refers to the subject, self, or ego, and
the grammatical predicate know to the act, which in this particular
case is an act of knowing, but might as well have been an act of conjecturing, doubting, wishing, fearing, etc. Thus the predicate know
indicates the modality of the act, that is, the way in which the subject
relates to the object, or the particular force which is involved, in this
case, the epistemic force. Observe that the function of the grammatical
moods, indicative, subjunctive, imperative, and optative, is to express
modalities in this sense. Finally, A is true is the judgement or, in general, the object of the act, which in this case is an object of knowledge,
but might have been an object of conjecture, doubt, wish, fear, etc.
The closest possible correspondence between the analysis that I am
giving and Frege's notation for a judgement
` A
is obtained by thinking of the vertical, judgement stroke as carrying
the epistemic force
I know . . .
and the horizontal, content stroke as expressing the affirmation
. . . is true.
26 per martin-l"of
Then it is the vertical stroke which is superfluous, whereas the horizontal stroke is needed to show that the judgement has the form of an
affirmation. But this can hardly be read out of Frege's own account of
the assertion sign: you have to read it into his text.
What is a judgement before it has become evident, or known? That
is, of the two, judgement and evident judgement, how is the first to be
defined? The characteristic of a judgement in this sense is merely that
it has been laid down what knowledge is expressed by it, that is, what
you must know in order to have the right to make, or utter, it. And
this is something which depends solely on the form of the judgement.
For example, if we consider the two forms of judgement
A is a proposition
and
A is true,
then there is something that you must know in order to have the right
to make a judgement of the first form, and there is something else
which you must know, in addition, in order to have the right to make
a judgement of the second form. And what you must know depends
in neither case on A, but only on the form of the judgement, . . . is
a proposition or . . . is true, respectively. Quite generally, I may say
that a judgement in this sense, that is, a not yet known, and perhaps
even unknowable, judgement, is nothing but an instance of a form
of judgement, because it is for the various forms of judgement that
I lay down what you must know in order to have the right to make
a judgement of one of those forms. Thus, as soon as something has
the form of a judgement, it is already a judgement in this sense. For
example, A is a proposition is a judgement in this sense, because it
has a form for which I have laid down, or rather shall lay down, what
you must know in order to have the right to make a judgement of that
form. I think that I may make things a bit clearer by showing again
in a picture what is involved here. Let me take the first form to begin
with.
I
evident judgement
z ""-- -
know
judgement
z ""-- -\Upsilon
\Sigma
\Xi
\Pi
\Lambda
\Theta
\Gamma
\Delta A is a proposition
expression\Delta \Delta form of judgementA
on the meanings of the logical constants 27
Here is involved, first, an expression A, which should be a complete
expression. Second, we have the form . . . is a proposition, which is
the form of judgement. Composing these two, we arrive at A is a
proposition, which is a judgement in the first sense. And then, third,
we have the act in which I grasp this judgement, and through which it
becomes evident. Thus it is my act of grasping which is the source of
the evidence. These two together, that is, the judgement and my act
of grasping it, become the evident judgement. And a similar analysis
can be given of a judgement of the second form.
I
evident judgement
z ""-- -
know
judgement
z ""-- -\Upsilon
\Sigma
\Xi
\Pi
\Lambda
\Theta
\Gamma
\Delta A is true
proposition\Delta \Delta form of judgementA
Such a judgement has the form . . . is true, but what fills the open place,
or hole, in the form is not an expression any longer, but a proposition.
And what is a proposition? A proposition is an expression for which
the previous judgement has already been grasped, because there is no
question of something being true unless you have previously grasped it
as a proposition. But otherwise the picture remains the same here.
Now I must consider the discussion of the notion of judgement finished and pass on to the notion of proof. Proof is a good word, because,
unlike the word proposition, it has not changed its meaning. Proof apparently means the same now as it did when the Greeks discovered
the notion of proof, and therefore no terminological difficulties arise.
Observe that both Lat. demonstratio and the corresponding words in
the modern languages, like It. dimostrazione, Eng. demonstration, and
Ger. Beweis, are literal translations of Gr. C'pi`deicij, deriving as it does
from Gr. deDHknumi, I show, which has the same meaning as Lat. monstrare and Ger. weisen.
If you want to have a first approximation to the notion of proof, a
first definition of what a proof is, the strange thing is that you cannot look it up in any modern textbook of logic, because what you get
out of the standard textbooks of modern logic is the definition of what
a formal proof is, at best with a careful discussion clarifying that a
formal proof in the sense of this definition is not what we ordinarily
call a proof in mathematics. That is, you get a formal proof defined
as a finite sequence of formulas, each one of them being an immediate
consequence of some of the preceding ones, where the notion of immediate consequence, in turn, is defined by saying that a formula is an
28 per martin-l"of
immediate consequence of some other formulas if there is an instance
of one of the figures, called rules of inference, which has the other formulas as premises and the formula itself as conclusion. Now, this is not
what a real proof is. That is why you have the warning epithet formal
in front of it, and do not simply say proof.
What is a proof in the original sense of the word? The ordinary
dictionary definition says, with slight variations, that a proof is that
which establishes the truth of a statement. Thus a proof is that which
makes a mathematical statement, or enunciation, into a theorem, or
proposition, in the old sense of the word which is retained in mathematics. Now, remember that I have reserved the term true for true
propositions, in the modern sense of the word, and that the things
that we prove are, in my terminology, judgements. Moreover, to avoid
terminological confusion, judgements qualify as evident rather than
true. Hence, translated into the terminology that I have decided upon,
the dictionary definition becomes simply,
A proof is what makes a judgement evident.
Accepting this, that is, that the proof of a judgement is that which
makes it evident, we might just as well say that the proof of a judgement is the evidence for it. Thus proof is the same as evidence. Combining this with the outcome of the previous discussion of the notion of
evidence, which was that it is the act of understanding, comprehending, grasping, or seeing a judgement which confers evidence on it, the
inevitable conclusion is that the proof of a judgement is the very act
of grasping it. Thus a proof is, not an object, but an act. This is what
Brouwer wanted to stress by saying that a proof is a mental construction, because what is mental, or psychic, is precisely our acts, and the
word construction, as used by Brouwer, is but a synonym for proof.
Thus he might just as well have said that the proof of a judgement is
the act of proving, or grasping, it. And the act is primarily the act as it
is being performed. Only secondarily, and irrevocably, does it become
the act that has been performed.
As is often the case, it might have been better to start with the verb
rather than the noun, in this case, with the verb to prove rather than
with the noun proof. If a proof is what makes a judgement evident,
then, clearly, to prove a judgement is to make it evident, or known.
To prove something to yourself is simply to get to know it. And to
prove something to someone else is to try to get him, or her, to know
it. Hence
to prove = to get to know = to understand,
comprehend, grasp, or see.
on the meanings of the logical constants 29
This means that prove is but another synonym for understand, comprehend, grasp, or see. And, passing to the perfect tense,
to have proved = to know = to have understood,
comprehended, grasped, or seen.
We also speak of acquiring and possessing knowledge. To possess
knowledge is the same as to have acquired it, just as to know something
is the same as to have understood, comprehended, grasped, or seen it.
Thus the relation between the plain verb to know and the venerable
expressions to acquire and to possess knowledge is given by the two
equations,
to get to know = to acquire knowledge
and
to know = to possess knowledge.
On the other hand, the verb to prove and the noun proof are related
by the two similar equations,
to prove = to acquire, or construct, a proof
and
to have proved = to possess a proof.
It is now manifest, from these equations, that proof and knowledge are
the same. Thus, if proof theory is construed, not in Hilbert's sense,
as metamathematics, but simply as the study of proofs in the original
sense of the word, then proof theory is the same as theory of knowledge,
which, in turn, is the same as logic in the original sense of the word, as
the study of reasoning, or proof, not as metamathematics.
Remember that the proof of a judgement is the very act of knowing
it. If this act is atomic, or indivisible, then the proof is said to be immediate. Otherwise, that is, if the proof consists of a whole sequence,
or chain, of atomic actions, it is mediate. And, since proof and knowledge are the same, the attributes immediate and mediate apply equally
well to knowledge. In logic, we are no doubt more used to saying of
inferences, rather than proofs, that they are immediate or mediate, as
the case may be. But that makes no difference, because inference and
proof are the same. It does not matter, for instance, whether we say
rules of inference or proof rules, as has become the custom in programming. And, to take another example, it does not matter whether we
say that a mediate proof is a chain of immediate inferences or a chain
30 per martin-l"of
of immediate proofs. The notion of formal proof that I referred to in
the beginning of my discussion of the notion of proof has been arrived
at by formalistically interpreting what you mean by an immediate inference, by forgetting about the difference between a judgement and
a proposition, and, finally, by interpreting the notion of proposition
formalistically, that is, by replacing it by the notion of formula. But a
real proof is and remains what it has always been, namely, that which
makes a judgement evident, or simply, the evidence for it. Thus, if we
do not have the notion of evidence, we do not have the notion of proof.
That is why the notion of proof has fared so badly in those branches
of philosophy where the notion of evidence has fallen into disrepute.
We also speak of a judgement being immediately and mediately
evident, respectively. Which of the two is the case depends of course on
the proof which constitutes the evidence for the judgement. If the proof
is immediate, then the judgement is said to be immediately evident.
And an immediately evident judgement is what we call an axiom. Thus
an axiom is a judgement which is evident by itself, not by virtue of
some previously proved judgements, but by itself, that is, a self-evident
judgement, as one has always said. That is, always before the notion
of evidence became disreputed, in which case the notion of axiom and
the notion of proof simply become deflated: we cannot make sense
of the notion of axiom and the notion of proof without access to the
notion of evidence. If, on the other hand, the proof which constitutes
the evidence for a judgement is a mediate one, so that the judgement
is evident, not by itself, but only by virtue of some previously proved
judgements, then the judgement is said to be mediately evident. And
a mediately evident judgement is what we call a theorem, as opposed
to an axiom. Thus an evident judgement, that is, a proposition in the
old sense of the word which is retained in mathematics, is either an
axiom or a theorem.
Instead of applying the attributes immediate and mediate to proof,
or knowledge, I might have chosen to speak of intuitive and discursive
proof, or knowledge, respectively. That would have implied no difference of sense. The proof of an axiom can only be intuitive, which is
to say that an axiom has to be grasped immediately, in a single act.
The word discursive, on the other hand, comes from Lat. discurrere,
to run to and fro. Thus a discursive proof is one which runs, from
premises to conclusion, in several steps. It is the opposite of an intuitive proof, which brings you to the conclusion immediately, in a single
step. When one says that the immediate propositions in the old sense
of the word proposition, that is, the immediately evident judgements
in my terminology, are unprovable, what is meant is of course only that
on the meanings of the logical constants 31
they cannot be proved discursively. Their proofs have to rest intuitive.
This seems to be all that I have to say about the notion of proof at the
moment, so let me pass on to the next item on the agenda, the forms
of judgement and their semantical explanations.
The forms of judgement have to be displayed in a table, simply,
and the corresponding semantical explanations have to be given, one
for each of those forms. A form of judgement is essentially just what
is called a category, not in the sense of category theory, but in the
logical, or philosophical, sense of the word. Thus I have to say what
my forms of judgement, or categories, are, and, for each one of those
forms, I have to explain what you must know in order to have the right
to make a judgement of that form. By the way, the forms of judgement
have to be introduced in a specific order. Actually, not only the forms
of judgement, but all the notions that I am undertaking to explain
here have to come in a specific order. Thus, for instance, the notion
of judgement has to come before the notion of proposition, and the
notion of logical consequence has to be dealt with before explaining
the notion of implication. There is an absolute rigidity in this order.
The notion of proof, for instance, has to come precisely where I have
put it here, because it is needed in some other explanations further on,
where it is presupposed already. Revealing this rigid order, thereby
arriving eventually at the concepts which have to be explained prior
to all other concepts, turns out to be surprisingly difficult: you seem
to arrive at the very first concepts last of all. I do not know what
it should best be called, maybe the order of conceptual priority, one
concept being conceptually prior to another concept if it has to be
explained before the other concept can be explained.
Let us now consider the first form of judgement,
A is a proposition,
or, as I shall continue to abbreviate it,
A prop.
What I have just displayed to you is a linguistic form, and I hope that
you can recognize it. What you cannot see from the form, and which
I therefore proceed to explain to you, is of course its meaning, that is,
what knowledge is expressed by, or embodied in, a judgement of this
form. The question that I am going to answer is, in ontological terms,
What is a proposition?
This is the usual Socratic way of formulating questions of this sort. Or
I could ask, in more knowledge theoretical terminology,
32 per martin-l"of
What is it to know a proposition?
or, if you prefer,
What knowledge is expressed by a judgement
of the form A is a proposition?
or, this may be varied endlessly,
What does a judgement of the form A is a proposition mean?
These various ways of posing essentially the same question reflect
roughly the historical development, from a more ontological to a more
knowledge theoretical way of posing, and answering, questions of this
sort, finally ending up with something which is more linguistic in nature, having to do with form and meaning.
Now, one particular answer to this question, however it be formulated, is that a proposition is something that is true or false, or, to use
Aristotle's formulation, that has truth or falsity in it. Here we have
to be careful, however, because what I am going to explain is what a
proposition in the modern sense is, whereas what Aristotle explained
was what an enunciation, being the translation of <NAME>, is.
And it was this explanation that he phrased by saying that an enunciation is something that has truth or falsity in it. What he meant by
this was that it is an expression which has a form of speech such that,
when you utter it, you say something, whether truly or falsely. That
is certainly not how we now interpret the definition of a proposition as
something which is true or false, but it is nevertheless correct that it
echoes Aristotle's formulation, especially in its symmetric treatment of
truth and falsity.
An elaboration of the definition of a proposition as something that
is true or false is to say that a proposition is a truth value, the true
or the false, and hence that a declarative sentence is an expression
which denotes a truth value, or is the name of a truth value. This
was the explanation adopted by Frege in his later writings. If a proposition is conceived in this way, that is, simply as a truth value, then
there is no difficulty in justifying the laws of the classical propositional
calculus and the laws of quantification over finite, explicitly listed, domains. The trouble arises when you come to the laws for forming
quantified propositions, the quantifiers not being restricted to finite
domains. That is, the trouble is to make the two laws
A(x) prop
(8x)A(x) prop
A(x) prop
(9x)A(x) prop
on the meanings of the logical constants 33
evident when propositions are conceived as nothing but truth values.
To my mind, at least, they simply fail to be evident. And I need not
be ashamed of the reference to myself in this connection: as I said
in my discussion of the notion of evidence, it is by its very nature
subject related. Others must make up their minds whether these laws
are really evident to them when they conceive of propositions simply
as truth values. Although we have had this notion of proposition and
these laws for forming quantified propositions for such a long time,
we still have no satisfactory explanations which serve to make them
evident on this conception of the notion of proposition. It does not
help to restrict the quantifiers, that is, to consider instead the laws
(x 2 A)
B(x) prop
(8x 2 A)B(x) prop
(x 2 A)
B(x) prop
(9x 2 A)B(x) prop
unless we restrict the quantifiers so severely as to take the set A here
to be a finite set, that is, to be given by a list of its elements. Then, of
course, there is no trouble with these rules. But, as soon as A is the set
of natural numbers, say, you have the full trouble already. Since, as I
said earlier, the law of the excluded middle, indeed, all the laws of the
classical propositional calculus, are doubtlessly valid on this conception
of the notion of proposition, this means that the rejection of the law
of excluded middle is implicitly also a rejection of the conception of a
proposition as something which is true or false. Hence the rejection of
this notion of proposition is something which belongs to Brouwer. On
the other hand, he did not say explicitly by what it should be replaced.
Not even the wellknown papers by Kolmogorov and Heyting, in which
the formal laws of intuitionistic logic were formulated for the first time,
contain any attempt at explaining the notion of proposition in terms of
which these laws become evident. It appears only in some later papers
by Heyting and Kolmogorov from the early thirties. In the first of these,
written by Heyting in 1930, he suggested that we should think about
a proposition as a problem, Fr. probl`eme, or expectation, Fr. attente.
And, in the wellknown paper of the following year, which appeared
in Erkenntnis, he used the terms expectation, Ger. Erwartung, and
intention, Ger. Intention. Thus he suggested that one should think of
a proposition as a problem, or as an expectation, or as an intention.
And, another year later, there appeared a second paper by Kolmogorov,
in which he observed that the laws of the intuitionistic propositional
calculus become evident upon thinking of the propositional variables
as ranging over problems, or tasks. The term he actually used was
34 per martin-l"of
Ger. Aufgabe. On the other hand, he explicitly said that he did not
want to equate the notion of proposition with the notion of problem
and, correlatively, the notion of truth of a proposition with the notion
of solvability of a problem. He merely proposed the interpretation of
propositions as problems, or tasks, as an alternative interpretation,
validating the laws of the intuitionistic propositional calculus.
Returning now to the form of judgement
A is a proposition,
the semantical explanation which goes together with it is this, and here
I am using the knowledge theoretical formulation, that to know a proposition, which may be replaced, if you want, by problem, expectation,
or intention, you must know what counts as a verification, solution,
fulfillment, or realization of it. Here verification matches with proposition, solution with problem, fulfillment with expectation as well as
with intention, and realization with intention. Realization is the term
introduced by Kleene, but here I am of course not using it in his sense:
Kleene's realizability interpretation is a nonstandard, or nonintended,
interpretation of intuitionistic logic and arithmetic. The terminology
of intention and fulfillment was taken over by Heyting from Husserl, via
Oskar Becker, apparently. There is a long chapter in the sixth, and last,
of his Logische Untersuchungen which bears the title Bedeutungsintention und Bedeutungserf"ullung, and it is these two terms, intention and
fulfillment, Ger. Erf"ullung, that Heyting applied in his analysis of the
notions of proposition and truth. And he did not just take the terms
from Husserl: if you observe how Husserl used these terms, you will see
that they were appropriately applied by Heyting. Finally, verification
seems to be the perfect term to use together with proposition, coming
as it does from Lat. verus, true, and facere, to make. So to verify is to
make true, and verification is the act, or process, of verifying something.
For a long time, I tried to avoid using the term verification, because
it immediately gives rise to discussions about how the present account
of the notions of proposition and truth is related to the verificationism
that was discussed so much in the thirties. But, fortunately, this is fifty
years ago now, and, since we have a word which lends itself perfectly
to expressing what needs to be expressed, I shall simply use it, without
wanting to get into discussion about how the present semantical theory
is related to the verificationism of the logical positivists.
What would an example be? If you take a proposition like,
The sun is shining,
on the meanings of the logical constants 35
to know that proposition, you must know what counts as a verification
of it, which in this case would be the direct seeing of the shining sun.
Or, if you take the proposition,
The temperature is 10ffi C,
then it would be a direct thermometer reading. What is more interesting, of course, is what the corresponding explanations look like for the
logical operations, which I shall come to in my last lecture.
Coupled with the preceding explanation of what a proposition is, is
the following explanation of what a truth is, that is, of what it means
for a proposition to be true. Assume first that
A is a proposition,
and, because of the omnipresence of the epistemic force, I am really
asking you to assume that you know, that is, have grasped, that A
is a proposition. On that assumption, I shall explain to you what a
judgement of the form
A is true,
or, briefly,
A true,
means, that is, what you must know in order to have the right to
make a judgement of this form. And the explanation would be that, to
know that a proposition is true, a problem is solvable, an expectation
is fulfillable, or an intention is realizable, you must know how to verify,
solve, fulfill, or realize it, respectively. Thus this explanation equates
truth with verifiability, solvability, fulfillability, or realizability. The
important point to observe here is the change from is in A is true to
can in A can be verified, or A is verifiable. Thus what is expressed in
terms of being in the first formulation really has the modal character
of possibility.
Now, as I said earlier in this lecture, to know a judgement is the
same as to possess a proof of it, and to know a judgement of the
particular form A is true is the same as to know how, or be able, to
verify the proposition A. Thus knowledge of a judgement of this form
is knowledge how in Ryle's terminology. On the other hand, to know
how to do something is the same as to possess a way, or method, of
doing it. This is reflected in the etymology of the word method, which
is derived from Gr. metL', after, and a*di`j, way. Taking all into account,
we arrive at the conclusion that a proof that a proposition A is true
36 per martin-l"of
is the same as a method of verifying, solving, fulfilling, or realizing A.
This is the explanation for the frequent appearance of the word method
in Heyting's explanations of the meanings of the logical constants. In
connection with the word method, notice the tendency of our language
towards hypostatization. I can do perfectly well without the concept of
method in my semantical explanations: it is quite sufficient for me to
have access to the expression know how, or knowledge how. But it is in
the nature of our language that, when we know how to do something,
we say that we possess a method of doing it.
Summing up, I have now explained the two forms of categorical
judgement,
A is a proposition
and
A is true,
respectively, and they are the only forms of categorical judgement that
I shall have occasion to consider. Observe that knowledge of a judgement of the second form is knowledge how, more precisely, knowledge
how to verify A, whereas knowledge of a judgement of the first form
is knowledge of a problem, expectation, or intention, which is knowledge what to do, simply. Here I am introducing knowledge what as a
counterpart of Ryle's knowledge how. So the difference between these
two kinds of knowledge is the difference between knowledge what to do
and knowledge how to do it. And, of course, there can be no question
of knowing how to do something before you know what it is that is to
be done. The difference between the two kinds of knowledge is a categorical one, and, as you see, what Ryle calls knowledge that, namely,
knowledge that a proposition is true, is equated with knowledge how
on this analysis. Thus the distinction between knowledge how and
knowledge that evaporates on the intuitionistic analysis of the notion
of truth.
Third lecture
The reason why I said that the word verification may be dangerous
is that the principle of verification formulated by the logical positivists
in the thirties said that a proposition is meaningful if and only if it is
verifiable, or that the meaning of a proposition is its method of verification. Now that is to confuse meaningfulness and truth. I have
indeed used the word verifiable and the expression method of verification. But what is equated with verifiability is not the meaningfulness
on the meanings of the logical constants 37
but the truth of a proposition, and what qualifies as a method of verification is a proof that a proposition is true. Thus the meaning of a
proposition is not its method of verification. Rather, the meaning of a
proposition is determined by what it is to verify it, or what counts as
a verification of it.
The next point that I want to bring up is the question,
Are there propositions which are true,
but which cannot be proved to be true?
And it suffices to think of mathematical propositions here, like the
Goldbach conjecture, the Riemann hypothesis, or Fermat's last theorem. This fundamental question was once posed to me outright by a
colleague of mine in the mathematics department, which shows that
even working mathematicians may find themselves puzzled by deep
philosophical questions. At first sight, at least, there seem to be two
possible answers to this question. One is simply,
No,
and the other is,
Perhaps,
although it is of course impossible for anybody to exhibit an example
of such a proposition, because, in order to do that, he would already
have to know it to be true. If you are at all puzzled by this question,
it is an excellent subject of meditation, because it touches the very
conflict between idealism and realism in the theory of knowledge, the
first answer, No, being indicative of idealism, and the second answer,
Perhaps, of realism. It should be clear, from any point of view, that
the answer depends on how you interpret the three notions in terms
of which the question is formulated, that is, the notion of proposition,
the notion of truth, and the notion of proof. And it should already be
clear, I believe, from the way in which I have explained these notions,
that the question simply ceases to be a problem, and that it is the first
answer which is favoured.
To see this, assume first of all that A is a proposition, or problem.
Then
A is true
is a judgement which gives rise to a new problem, namely, the problem
of proving that A is true. To say that that problem is solvable is precisely the same as saying that the judgement that A is true is provable.
Now, the solvability of a problem is always expressed by a judgement.
Hence
38 per martin-l"of
(A is true) is provable
is a new judgement. What I claim is that we have the right to make this
latter judgement if and only if we have the right to make the former
judgement, that is, that the proof rule
A is true
(A is true) is provable
as well as its inverse
(A is true) is provable
A is true
are both valid. This is the sense of saying that A is true if and only if
A can be proved to be true. To justify the first rule, assume that you
know its premise, that is, that you have proved that A is true. But, if
you have proved that A is true, then you can, or know how to, prove
that A is true, which is what you need to know in order to have the
right to judge the conclusion. In this step, I have relied on the principle
that, if something has been done, then it can be done. To justify the
second rule, assume that you know its premise, that is, that you know
how to prove the judgement A is true. On that assumption, I have to
explain the conclusion to you, which is to say that I have to explain
how to verify the proposition A. This is how you do it. First, put your
knowledge of the premise into practice. That yields as result a proof
that A is true. Now, such a proof is nothing but knowledge how to
verify, or a method of verifying, the proposition A. Hence, putting it,
in turn, into practice, you end up with a verification of the proposition
A, as required. Observe that the inference in this direction is essentially
a contraction of two possibilities into one: if you know how to know
how to do something, then you know how to do it.
All this is very easy to say, but, if one is at all puzzled by the question whether there are unprovable truths, then it is not an easy thing to
make up one's mind about. For instance, it seems, from Heyting's writings on the semantics of intuitionistic logic in the early thirties, that
he had not arrived at this position at that time. The most forceful and
persistent criticism of the idea of a knowledge independent, or knowledge transcendent, notion of truth has been delivered by Dummett,
although it seems difficult to find him ever explicitly committing himself in his writings to the view that, if a proposition is true, then it can
also be proved to be true. Prawitz seems to be leaning towards this
nonrealistic principle of truth, as he calls it, in his paper Intuitionistic
on the meanings of the logical constants 39
Logic: A Philosophical Challenge. And, in his book Det Os"agbara,
printed in the same year, Stenlund explicitly rejects the idea of true
propositions that are in principle unknowable. The Swedish proof theorists seem to be arriving at a common philosophical position.
Next I have to say something about hypothetical judgements, before I proceed to the final piece, which consists of the explanations
of the meanings of the logical constants and the justifications of the
logical laws. So far, I have only introduced the two forms of categorical judgement A is a proposition and A is true. The only forms of
judgement that I need to introduce, besides these, are forms of hypothetical judgement. Hypothetical means of course the same as under
assumptions. The Gr. I'pi`qesij, hypothesis, was translated into Lat.
suppositio, supposition, and they both mean the same as assumption.
Now, what is the rule for making assumptions, quite generally? It is
simple. Whenever you have a judgement in the sense that I am using
the word, that is, a judgement in the sense of an instance of a form of
judgement, then it has been laid down what you must know in order
to have the right to make it. And that means that it makes perfectly
good sense to assume it, which is the same as to assume that you know
it, which, in turn, is the same as to assume that you have proved it.
Why is it the same to assume it as to assume that you know it? Because of the constant tacit convention that the epistemic force, I know
. . . , is there, even if it is not made explicit. Thus, when you assume
something, what you do is that you assume that you know it, that is,
that you have proved it. And, to repeat, the rule for making assumptions is simply this: whenever you have a judgement, in the sense of an
instance of a form of judgement, you may assume it. That gives rise
to the notion of hypothetical judgement and the notion of hypothetical
proof, or proof under hypotheses.
The forms of hypothetical judgement that I shall need are not so
many. Many more can be introduced, and they are needed for other
purposes. But what is absolutely necessary for me is to have access to
the form
A1 true; : : : ; An true j A prop;
which says that A is a proposition under the assumptions that
A1; : : : ; An are all true, and, on the other hand, the form
A1 true; : : : ; An true j A true;
which says that the proposition A is true under the assumptions that
A1; : : : ; An are all true. Here I am using the vertical bar for the relation
of logical consequence, that is, for what Gentzen expressed by means of
40 per martin-l"of
the arrow ! in his sequence calculus, and for which the double arrow
) is also a common notation. It is the relation of logical consequence,
which must be carefully distinguished from implication. What stands
to the left of the consequence sign, we call the hypotheses, in which
case what follows the consequence sign is called the thesis, or we call
the judgements that precede the consequence sign the antecedents and
the judgement that follows after the consequence sign the consequent.
This is the terminology which Gentzen took over from the scholastics,
except that, for some reason, he changed consequent into succedent and
consequence into sequence, <NAME>, usually improperly rendered
by sequent in English.
hypothetical judgement
(logical) consequence
z ""-- -
A1 true; : : : ; An true j A prop
A1 true; : : : ; An true j A true
-- -z "" -- -z ""
antecedents consequent
hypotheses thesis
Since I am making the assumptions A1 true; : : : ; An true, I must be
presupposing something here, because, surely, I cannot make those
assumptions unless they are judgements. Specifically, in order for A1
true to be a judgement, A1 must be a proposition, and, in order for
A2 true to be a judgement, A2 must be a proposition, but now merely
under the assumption that A1 is true, . . . , and, in order for An true
to be a judgement, An must be a proposition under the assumptions
that A1; : : : ; An\Gamma 1 are all true. Unlike in Gentzen's sequence calculus,
the order of the assumptions is important here. This is because of the
generalization that something being a proposition may depend on other
things being true. Thus, for the assumptions to make sense, we must
presuppose
A1 prop;
A1 true j A2 prop;
...
A1 true; : : : ; An\Gamma 1 true j An prop.
Supposing this, that is, supposing that we know this, it makes perfectly
good sense to assume, first, that A1 is true, second, that A2 is true,
. . . , finally, that An is true, and hence
A1 true; : : : ; An true j A prop
on the meanings of the logical constants 41
is a perfectly good judgement whatever expression A is, that is, whatever expression you insert into the place indicated by the variable A.
And why is it a good judgement? To answer that question, I must
explain to you what it is to know such a judgement, that is, what
constitutes knowledge, or proof, of such a judgement. Now, quite generally, a proof of a hypothetical judgement, or logical consequence, is
nothing but a hypothetical proof of the thesis, or consequent, from the
hypotheses, or antecedents. The notion of hypothetical proof, in turn,
which is a primitive notion, is explained by saying that it is a proof
which, when supplemented by proofs of the hypotheses, or antecedents,
becomes a proof of the thesis, or consequent. Thus the notion of categorical proof precedes the notion of hypothetical proof, or inference, in
the order of conceptual priority. Specializing this general explanation
of what a proof of a hypothetical judgement is to the particular form
of hypothetical judgement
A1 true; : : : ; An true j A prop
that we are in the process of considering, we see that the defining
property of a proof
A1 true \Delta \Delta \Delta An true
\Delta \Delta \Delta \Delta \Delta \Delta
A prop
of such a judgement is that, when it is supplemented by proofs
...
A1 true \Delta \Delta \Delta
...
An true
of the hypotheses, or antecedents, it becomes a proof
...
A1 true \Delta \Delta \Delta
...
An true
\Delta \Delta \Delta \Delta \Delta \Delta
A prop
of the thesis, or consequent.
Consider now a judgement of the second form
A1 true; : : : ; An true j A true:
For it to make good sense, that is, to be a judgement, we must know,
not only
42 per martin-l"of
A1 prop;
A1 true j A2 prop;
...
A1 true; : : : ; An\Gamma 1 true j An prop;
as in the case of the previous form of judgement, but also
A1 true; : : : ; An true j A prop:
Otherwise, it does not make sense to ask oneself whether A is true
under the assumptions A1 true, . . . , An true. As with any proof of a
hypothetical judgement, the defining characteristic of a proof
A1 true \Delta \Delta \Delta An true
\Delta \Delta \Delta \Delta \Delta \Delta
A true
of a hypothetical judgement of the second form is that, when supplemented by proofs
...
A1 true \Delta \Delta \Delta
...
An true
of the antecedents, it becomes a categorical proof
...
A1 true \Delta \Delta \Delta
...
An true
\Delta \Delta \Delta \Delta \Delta \Delta
A true
of the consequent.
I am sorry that I have had to be so brief in my treatment of hypothetical judgements, but what I have said is sufficient for the following,
except that I need to generalize the two forms of hypothetical judgement so as to allow generality in them. Thus I need judgements which
are, not only hypothetical, but also general, which means that the first
form is turned into
A1(x1; : : : ; xm) true; : : : ; An(x1; : : : ; xm) true jx1;:::;x
m A(x1; : : : ; xm) prop
and the second form into
A1(x1; : : : ; xm) true; : : : ; An(x1; : : : ; xm) true jx1;:::;x
m A(x1; : : : ; xm) true:
Both of these forms involve a generality, indicated by subscribing the
variables that are being generalized to the consequence sign, which
must be carefully distinguished from, and which must be explained
on the meanings of the logical constants 43
prior to, the generality which is expressed by means of the universal
quantifier. It was only to avoid introducing all complications at once
that I treated the case without generality first. Now, the meaning of
a hypothetico-general judgement is explained by saying that, to have
the right to make such a judgement, you must possess a free variable
proof of the thesis, or consequent, from the hypotheses, or antecedents.
And what is a free variable proof? It is a proof which remains a proof
when you substitute anything you want for its free variables, that is,
any expressions you want, of the same arities as those variables. Thus
A1(x1; : : : ; xm) true \Delta \Delta \Delta An(x1; : : : ; xm) true
\Delta \Delta \Delta \Delta \Delta \Delta
A(x1; : : : ; xm) prop
is a proof of a hypothetico-general judgement of the first form provided
it becomes a categorical proof
...
A1(a1; : : : ; am) true \Delta \Delta \Delta
...
An(a1; : : : ; am) true
\Delta \Delta \Delta \Delta \Delta \Delta
A(a1; : : : ; am) prop
when you first substitute arbitrary expressions a1; : : : ; am, of the same
respective arities as the variables x1; : : : ; xm, for those variables, and
then supplement it with proofs
...
A1(a1; : : : ; am) true \Delta \Delta \Delta
...
An(a1; : : : ; am) true
of the resulting substitution instances of the antecedents. The explanation of what constitutes a proof of a hypothetico-general judgement
of the second form is entirely similar.
The difference between an inference and a logical consequence, or
hypothetical judgement, is that an inference is a proof of a logical consequence. Thus an inference is the same as a hypothetical proof. Now,
when we infer, or prove, we infer the conclusion from the premises.
Thus, just as a categorical proof is said to be a proof of its conclusion,
a hypothetical proof is said to be a proof, or an inference, of its conclusion from its premises. This makes it clear what is the connection
as well as what is the difference between an inference with its premises
and conclusion on the one hand, and a logical consequence with its
antecedents and consequent on the other hand. And the difference is
precisely that it is the presence of a proof of a logical consequence that
44 per martin-l"of
turns its antecedents into premises and the consequent into conclusion
of the proof in question. For example, if A is a proposition, then
A true j ? true
is a perfectly good logical consequence with A true as antecedent and
? true as consequent, but
A true
? true
is not an inference, not a valid inference, that is, unless A is false. In
that case, only, may the conclusion ? true be inferred from the premise
A true.
Let us now pass on to the rules of inference, or proof rules, and their
semantical explanations. I shall begin with the rules of implication.
Now, since I am treating A is a proposition as a form of judgement,
which is on a par with the form of judgement A is true, what we
ordinarily call formation rules will count as rules of inference, but that
is merely a terminological matter. So let us look at the formation rule
for implication.
oe-formation.
A prop
(A true)
B prop
A oe B prop
This rule says, in words, that, if A is a proposition and B is a proposition provided that A is true, then A oe B is a proposition. In the
second premise, I might just as well have used the notation for logical
consequence
A true j B prop
that I introduced earlier in this lecture, because to have a proof of
this logical consequence is precisely the same as to have a hypothetical
proof of B prop from the assumption A true. But, for the moment, I
shall use the more suggestive notation
(A true)
B prop
in imitation of Gentzen. It does not matter, of course, which notation
of the two that I employ. The meaning is in any case the same.
Explanation. The rule of implication formation is a rule of immediate inference, which means that you must make the conclusion evident
on the meanings of the logical constants 45
to yourself immediately, without any intervening steps, on the assumption that you know the premises. So assume that you do know the
premises, that is, that you know the proposition A, which is to say
that you know what counts as a verification of it, and that you know
that B is a proposition under the assumption that A is true. My obligation is to explain to you what proposition A oe B is. Thus I have
to explain to you what counts as a verification, or solution, of this
proposition, or problem. And the explanation is that what counts as a
verification of A oe B is a hypothetical proof
A true.
..
B true
that B is true under the assumption that A is true. In the Kolmogorov
interpretation, such a hypothetical proof appears as a method of solving
the problem B provided that the problem A can be solved, that is,
a method which together with a method of solving the problem A
becomes a method of solving the problem B. The explanation of the
meaning of implication, which has just been given, illustrates again the
rigidity of the order of conceptual priority: the notions of hypothetical
judgement, or logical consequence, and hypothetical proof have to be
explained before the notion of implication, because, when you explain
implication, they are already presupposed.
Given the preceding explanation of the meaning of implication, it
is not difficult to justify the rule of implication introduction.
oe-introduction. (A true)
B true
A oe B true
As you see, I am writing it in the standard way, although, of course, it
is still presupposed that A is a proposition and that B is a proposition
under the assumption that A is true. Thus you must know the premises
of the formation rule and the premise of the introduction rule in order
to be able to grasp its conclusion.
Explanation. Again, the rule of implication introduction is a rule of
immediate inference, which means that you must make the conclusion
immediately evident to yourself granted that you know the premises,
that is, granted that you possess a hypothetical proof that B is true
from the hypothesis that A is true. By the definition of implication,
such a proof is nothing but a verification of the proposition A oe B.
And what is it that you must know in order to have the right to judge
46 per martin-l"of
A oe B to be true? You must know how to get yourself a verification
of A oe B. But, since you already possess it, you certainly know how
to acquire it: just take what you already have. This is all that there
is to be seen in this particular rule. Observe that its justification rests
again on the principle that, if something has been done, then it can be
done.
Next we come to the elimination rule for implication, which I shall
formulate in the standard way, as modus ponens, although, if you want
all elimination rules to follow the same pattern, that is, the pattern
exhibited by the rules of falsehood, disjunction, and existence elimination, there is another formulation that you should consider, and which
has been considered by Schroeder-Heister. But I shall have to content
myself with the standard formulation in these lectures.
oe-elimination. A oe B true A true
B true
Here it is still assumed, of course, that A is a proposition and that B
is a proposition provided that A is true.
Explanation. This is a rule of immediate inference, so assume that
you know the premises, that is, that you possess proofs
...
A oe B true
and ...
A true
of them, and I shall try to make the conclusion evident to you. Now, by
the definitions of the notion of proof and the notion of truth, the proof
of the first premise is knowledge how to verify the proposition A oe B.
So put that knowledge of yours into practice. What you then end up
with is a verification of A oe B, and, because of the way implication
was defined, that verification is nothing but a hypothetical proof
A true.
..
B true
that B is true from the assumption that A is true. Now take your proof
of the right premise and adjoin it to the verification of A oe B. Then
you get a categorical proof ..
.
A true.
..
B true
on the meanings of the logical constants 47
of the conclusion that B is true. Here, of course, I am implicitly using
the principle that, if you supplement a hypothetical proof with proofs
of its hypotheses, then you get a proof of its conclusion. But this is in
the nature of a hypothetical proof: it is that property which makes a
hypothetical proof into what it is. So now you have a proof that B is
true, a proof which is knowledge how to verify B. Putting it, in turn,
into practice, you end up with a verification of B. This finishes my
explanation of how the proposition B is verified.
In the course of my semantical explanation of the elimination rule
for implication, I have performed certain transformations which are
very much like an implication reduction in the sense of Prawitz. Indeed,
I have explained the semantical role of this syntactical transformation.
The place where it belongs in the meaning theory is precisely in the
semantical explanation, or justification, of the elimination rule for implication. Similarly, the reduction rules for the other logical constants
serve to explain the elimination rules associated with those constants.
The key to seeing the relationship between the reduction rules and
the semantical explanations of the elimination rules is this: to verify
a proposition by putting a proof of yours that it is true into practice
corresponds to reducing a natural deduction to introductory form and
deleting the last inference. This takes for granted, as is in fact the
case, that an introduction is an inference in which you conclude, from
the possession of a verification of a proposition, that you know how to
verify it. In particular, verifying a proposition B by means of a proof
that B is true ...
A oe B true
...
A true
B true
which ends with an application of modus ponens, corresponds to reducing the proof of the left premise to introductory form
(A true).
..
B true
A oe B true
...
A true
B true
then performing an implication reduction in the sense of Prawitz, which
yields the proof
48 per martin-l"of
...
A true.
..
B true
as result, and finally reducing the latter proof to introductory form
and deleting its last, introductory inference. This is the syntactical
counterpart of the semantical explanation of the elimination rule for
implication.
The justifications of the remaining logical laws follow the same pattern. Let me take the rules of conjunction next.
& -formation.
A prop B prop
A & B prop
Explanation. Again, assume that you know the premises, and I
shall explain the conclusion to you, that is, I shall tell you what counts
as a verification of A & B. The explanation is that a verification of
A & B consists of a proof that A is true and a proof that B is true,
...
A true
and ...
B true
that is, of a method of verifying A and a method of verifying B. In
the Kolmogorov interpretation, A & B appears as the problem which
you solve by constructing both a method of solving A and a method of
solving B.
& -introduction. A true B true
A & B true
Here the premises of the formation rule are still in force, although not
made explicit, which is to say that A and B are still assumed to be
propositions.
Explanation. Assume that you know the premises, that is, that you
possess proofs ..
.
A true
and ...
B true
of them. Because of the meaning of conjunction, just explained, this
means that you have verified A & B. Then you certainly can, or know
how to, verify the proposition A & B, by the principle that, if something
has been done, then it can be done. And this is precisely what you need
to know in order to have the right to judge A & B to be true.
on the meanings of the logical constants 49
If you want the elimination rule for conjunction to exhibit the same
pattern as the elimination rules for falsehood, disjunction, and existence, it should be formulated differently, but, in its standard formulation, it reads as follows.
& -elimination.
A & B true
A true
A & B true
B true
Thus, in this formulation, there are two rules and not only one. Also,
it is still presupposed, of course, that A and B are propositions.
Explanation. It suffices for me to explain one of the rules, say the
first, because the explanation of the other is completely analogous. To
this end, assume that you know the premise, and I shall explain to you
the conclusion, which is to say that I shall explain how to verify A.
This is how you do it. First use your knowledge of the premise to get a
verification of A & B. By the meaning of conjunction, just explained,
that verification consists of a proof that A is true as well as a proof
that B is true, ..
.
A true
and ...
B true
Now select the first of these two proofs. By the definitions of the
notions of proof and truth, that proof is knowledge how to verify A.
So, putting it into practice, you end up with a verification of A. This
finishes the explanations of the rules of conjunction.
The next logical operation to be treated is disjunction. And, as
always, the formation rule must be explained first.
.-formation.
A prop B prop
A . B prop
Explanation. To justify it, assume that you know the premises, that
is, that you know what it is to verify A as well as what it is to verify
B. On that assumption, I explain to you what proposition A . B is by
saying that a verification of A . B is either a proof that A is true or a
proof that B is true, ..
.
A true
or ...
B true
Thus, in the wording of the Kolmogorov interpretation, a solution to
the problem A . B is either a method of solving the problem A or a
method of solving the problem B.
50 per martin-l"of
.-introduction.
A true
A . B true
B true
A . B true
In both of these rules, the premises of the formation rule, which say
that A and B are propositions, are still in force.
Explanation. Assume that you know the premise of the first rule
of disjunction introduction, that is, that you have proved, or possess a
proof of, the judgement that A is true. By the definition of disjunction,
this proof is a verification of the proposition A . B. Hence, by the
principle that, if something has been done, then it can be done, you
certainly can, or know how to, verify the proposition A . B. And it is
this knowledge which you express by judging the conclusion of the rule,
that is, by judging the proposition A . B to be true. The explanation
of the second rule of disjunction introduction is entirely similar.
.-elimination.
A . B true
(A true)
C true
(B true)
C true
C true
Here it is presupposed, not only that A and B are propositions, but also
that C is a proposition provided that A . B is true. Observe that, in
this formulation of the rule of disjunction elimination, C is presupposed
to be a proposition, not outright, but merely on the hypothesis that
A . B is true. Otherwise, it is just like the Gentzen rule.
Explanation. Assume that you know, or have proved, the premises.
By the definition of truth, your knowledge of the first premise is knowledge how to verify the proposition A . B. Put that knowledge of yours
into practice. By the definition of disjunction, you then end up either
with a proof that A is true or with a proof that B is true,
...
A true
or ...
B true
In the first case, join the proof that A is true to the proof that you
already possess of the second premise, which is a hypothetical proof
that C is true under the hypothesis that A is true,
A true.
..
C true
You then get a categorical, or nonhypothetical, proof that C is true,
on the meanings of the logical constants 51
...
A true.
..
C true
Again, by the definition of truth, this proof is knowledge how to verify
the proposition C. So, putting this knowledge of yours into practice,
you verify C. In the second case, join the proof that B is true, which
you ended up with as a result of putting your knowledge of the first
premise into practice, to the proof that you already possess of the
third premise, which is a hypothetical proof that C is true under the
hypothesis that B is true,
B true.
..
C true
You then get a categorical proof that C is true,
...
B true.
..
C true
As in the first case, by the definition of truth, this proof is knowledge how to verify the proposition C. So, putting this knowledge into
practice, you verify C. This finishes my explanation how to verify the
proposition C, which is precisely what you need to know in order to
have the right to infer the conclusion that C is true.
?-formation.
? prop
Explanation. This is an axiom, but not in its capacity of mere
figure: to become an axiom, it has to be made evident. And, to make
it evident, I have to explain what counts as a verification of ?. The
explanation is that there is nothing that counts as a verification of
the proposition ?. Under no condition is it true. Thinking of ? as a
problem, as in the Kolmogorov interpretation, it is the problem which
is defined to have no solution.
An introduction is an inference in which you conclude that a proposition is true, or can be verified, on the ground that you have verified it,
that is, that you possess a verification of it. Therefore, ? being defined
by the stipulation that there is nothing that counts as a verification of
it, there is no introduction rule for falsehood.
52 per martin-l"of
?-elimination. ? true
C true
Here, in analogy with the rule of disjunction elimination, C is presupposed to be a proposition, not outright, but merely under the assumption that ? is true. This is the only divergence from Gentzen's
formulation of ex falso quodlibet.
Explanation. When you infer by this rule, you undertake to verify
the proposition C when you are provided with a proof that ? is true,
that is, by the definition of truth, with a method of verifying ?. But
this is something that you can safely undertake, because, by the definition of falsehood, there is nothing that counts as a verification of ?.
Hence ? is false, that is, cannot be verified, and hence it is impossible
that you ever be provided with a proof that ? is true. Observe the
step here from the falsity of the proposition ? to the unprovability of
the judgement that ? is true. The undertaking that you make when
you infer by the rule of falsehood elimination is therefore like saying,
I shall eat up my hat if you do such and such,
where such and such is something of which you know, that is, are
certain, that it cannot be done.
Observe that the justification of the elimination rule for falsehood
only rests on the knowledge that ? is false. Thus, if A is a proposition,
not necessarily ?, and C is a proposition provided that A is true, then
the inference A true
C true
is valid as soon as A is false. Choosing C to be ?, we can conclude, by
implication introduction, that A oe ? is true provided that A is false.
Conversely, if A oe ? is true and A is true, then, by modus ponens, ?
would be true, which it is not. Hence A is false if A oe ? is true. These
two facts together justify the nominal definition of ,A, the negation of
A, as A oe ?, which is commonly made in intuitionistic logic. However,
the fact that A is false if and only if ,A is true should not tempt one
to define the notion of denial by saying that
A is false
means that
,A is true.
on the meanings of the logical constants 53
That the proposition A is false still means that it is impossible to verify
A, and this is a notion which cannot be reduced to the notions of negation, negation of propositions, that is, and truth. Denial comes before
negation in the order of conceptual priority, just as logical consequence
comes before implication, and the kind of generality which a judgement
may have comes before universal quantification.
As has been implicit in what I have just said,
A is false = A is not true = A is not verifiable
= A cannot be verified.
Moreover, in the course of justifying the rule of falsehood elimination,
I proved that ? is false, that is, that ? is not true. Now, remember
that, in the very beginning of this lecture, we convinced ourselves that a
proposition is true if and only if the judgement that it is true is provable.
Hence, negating both members, a proposition is false if and only if the
judgement that it is true cannot be proved, that is, is unprovable. Using
this in one direction, we can conclude, from the already established
falsity of ?, that the judgement that ? is true is unprovable. This is,
if you want, an absolute consistency proof: it is a proof of consistency
with respect to the unlimited notion of provability, or knowability, that
pervades these lectures. And
(? is true) is unprovable
is the judgement which expresses the absolute consistency, if I may call
it so. By my chain of explanations, I hope that I have succeeded in
making it evident.
The absolute consistency brings with it as a consequence the relative consistency of any system of correct, or valid, inference rules.
Suppose namely that you have a certain formal system, a system of
inference rules, and that you have a formal proof in that system of the
judgement that ? is true. Because of the absolute consistency, that is,
the unprovability of the judgement that ? is true, that formal proof, although formally correct, is no proof, not a real proof, that is. How can
that come about? Since a formal proof is a chain of formally immediate
inferences, that is, instances of the inference rules of the system, that
can only come about as a result of there being some rule of inference
which is incorrect. Thus, if you have a formal system, and you have
convinced yourself of the correctness of the inference rules that belong
to it, then you are sure that the judgement that ? is true cannot be
proved in the system. This means that the consistency problem is really the problem of the correctness of the rules of inference, and that, at
some stage or another, you cannot avoid having to convince yourself
54 per martin-l"of
of their correctness. Of course if you take any old formal system, it
may be that you can carry out a metamathematical consistency proof
for it, but that consistency proof will rely on the intuitive correctness
of the principles of reasoning that you use in that proof, which means
that you are nevertheless relying on the correctness of certain forms
of inference. Thus the consistency problem is really the problem of
the correctness of the rules of inference that you follow, consciously or
unconsciously, in your reasoning.
After this digression on consistency, we must return to the semantical explanations of the rules of inference. The ones that remain are
the quantifier rules.
8-formation.
A(x) prop
(8x)A(x) prop
Explanation. The premise of this rule is a judgement which has
generality in it. If I were to make it explicit, I would have to write it
jx A(x) prop:
It is a judgement which has generality in it, although it is free from
hypotheses. And remember what it is to know such a judgement: it is
to possess a free variable proof of it. Now, assume that you do know
the premise of this rule, that is, that you possess a free variable proof
of the judgement that A(x) is a proposition. On that assumption, I
explain the conclusion to you by stipulating that a verification of the
proposition (8x)A(x) consists of a free variable proof that A(x) is true,
graphically, ..
.
A(x) true
By definition, that is a proof in which the variable x may be replaced
by anything you want, that is, any expression you want of the same
arity as the variable x. Thus, if x is a variable ranging over complete
expressions, then you must substitute a complete expression for it, and,
similarly, if it ranges over incomplete expressions of some arity. In the
Kolmogorov interpretation, the explanation of the meaning of the universal quantifier would be phrased by saying that (8x)A(x) expresses
the problem of constructing a general method of solving the problem
A(x) for arbitrary x.
8-introduction. A(x) true
(8x)A(x) true
on the meanings of the logical constants 55
Here the premise of the formation rule, to the effect that A(x) is a
proposition for arbitrary x, is still in force.
Explanation. Again, the premise of this rule is a general judgement,
which would read
jx A(x) true
if I were to employ the systematic notation that I introduced earlier
in this lecture. Now, assume that you know this, that is, assume that
you possess a free variable proof of the judgement that A(x) is true.
Then, by the principle that, if something has been done, then it can
be done, you certainly can give such a proof, and this is precisely what
you must be able, or know how, to do in order to have the right to infer
the conclusion of the rule.
8-elimination. (8x)A(x) true
A(a) true
Here it is presupposed, of course, that A(x) is a proposition for arbitrary x. And, as you see, I have again chosen the usual formulation
of the elimination rule for the universal quantifier rather than the one
which is patterned upon the elimination rules for falsehood, disjunction, and existence.
Explanation. First of all, observe that, because of the tacit assumption that A(x) is a proposition for arbitrary x, both (8x)A(x) and A(a)
are propositions, where a is an expression of the same arity as the variable x. Now, assume that you know the premise, that is, that you know
how to verify the proposition (8x)A(x), and I shall explain to you how
to verify the proposition A(a). To begin with, put your knowledge of
the premise into practice. That will give you a verification of (8x)A(x),
which, by the definition of the universal quantifier, is a free variable
proof that A(x) is true, ..
.
A(x) true
Now, this being a free variable proof means precisely that it remains a
proof whatever you substitute for x. In particular, it remains a proof
when you substitute a for x so as to get
...
A(a) true
So now you have acquired a proof that A(a) is true. By the definitions
of the notions of proof and truth, this proof is knowledge how to verify
56 per martin-l"of
the proposition A(a). Thus, putting it into practice, you end up with
a verification of A(a), as required.
9-formation.
A(x) prop
(9x)A(x) prop
Explanation. Just as in the formation rule associated with the universal quantifier, the premise of this rule is really the general judgement
jx A(x) prop;
although I have not made the generality explicit in the formulation of
the rule. Assume that you know the premise, that is, assume that you
possess a free variable proof
...
A(x) prop
guaranteeing that A(x) is a proposition, and I shall explain to you what
proposition (9x)A(x) is, that is, what counts as a verification of it. The
explanation is that a verification of (9x)A(x) consists of an expression
a of the same arity as the variable x and a proof
...
A(a) true
showing that the proposition A(a) is true. Observe that the knowledge
of the premise is needed in order to guarantee that A(a) is a proposition,
so that it makes sense to talk about a proof that A(a) is true. In
the Kolmogorov interpretation, (9x)A(x) would be explained as the
problem of finding an expression a, of the same arity as the variable x,
and a method of solving the problem A(a).
9-introduction. A(a) true
(9x)A(x) true
Here, as usual, the premise of the formation rule is still in force, which
is to say that A(x) is assumed to be a proposition for arbitrary x.
Explanation. Assume that you know the premise, that is, assume
that you possess a proof that A(a) is true,
...
A(a) true
on the meanings of the logical constants 57
By the preceding explanation of the meaning of the existential quantifier, the expression a together with this proof make up a verification of
the proposition (9x)A(x). And, possessing a verification of the proposition (9x)A(x), you certainly know how to verify it, which is what you
must know in order to have the right to conclude that (9x)A(x) is true.
Like in my explanations of all the other introduction rules, I have here
taken for granted the principle that, if something has been done, then
it can be done.
9-elimination.
(9x)A(x) true
(A(x) true)
C true
C true
Here it is presupposed, not only that A(x) is a proposition for arbitrary
x, like in the introduction rule, but also that C is a proposition provided
that the proposition (9x)A(x) is true.
Explanation. First of all, in order to make it look familiar, I have
written the second premise in Gentzen's notation
(A(x) true)
C true
rather than in the notation
A(x) true jx C true;
but there is no difference whatever in sense. Thus the second premise
is really a hypothetico-general judgement. Now, assume that you know
the premises. By the definition of the notion of truth, your knowledge of
the first premise is knowledge how to verify the proposition (9x)A(x).
Put that knowledge of yours into practice. You then end up with
a verification of the proposition (9x)A(x). By the definition of the
existential quantifier, this verification consists of an expression a of the
same arity as the variable x and a proof that the proposition A(a) is
true, ..
.
A(a) true
Now use your knowledge, or proof, of the second premise. Because of
the meaning of a hypothetico-general judgement, this proof
A(x) true.
..
C true
58 per martin-l"of
is a free variable proof that C is true from the hypothesis that A(x)
is true. Being a free variable proof means that you may substitute
anything you want, in particular, the expression a, for the variable x.
You then get a hypothetical proof
A(a) true.
..
C true
that C is true from the hypothesis that A(a) is true. Supplementing this
hypothetical proof with the proof that A(a) is true that you obtained
as a result of putting your knowledge of the first premise into practice,
you get a proof ..
.
A(a) true.
..
C true
that C is true, and this proof is nothing but knowledge how to verify
the proposition C. Thus, putting it into practice, you end up having
verified the proposition C, as required.
The promise of the title of these lectures, On the Meanings of the
Logical Constants and the Justifications of the Logical Laws, has now
been fulfilled. As you have seen, the explanations of the meanings of
the logical constants are precisely the explanations belonging to the
formation rules. And the justifications of the logical laws are the explanations belonging to the introduction and elimination rules, which
are the rules that we normally call rules of inference. For lack of time,
I have only been able to deal with the pure logic in my semantical explanations. To develop some interesting parts of mathematics, you also
need axioms for ordinary inductive definitions, in particular, axioms of
computation and axioms for the natural numbers. And, if you need
predicates defined by transfinite, or generalized, induction, then you
will have to add the appropriate formation, introduction, and elimination rules for them.
I have already explained how you see the consistency of a formal
system of correct inference rules, that is, the impossibility of constructing a proof ..
.
? true
that falsehood is true which proceeds according to those rules, not by
studying metamathematically the proof figures divested of all sense, as
on the meanings of the logical constants 59
was Hilbert's program, but by doing just the opposite: not divesting
them of sense, but endowing them with sense. Similarly, suppose that
you have a proof ..
.
A true
that a proposition A is true which depends, neither on any assumptions,
nor on any free variables. By the definition of truth and the identification of proof and knowledge, such a proof is nothing but knowledge how
to verify the proposition A. And, as I remarked earlier in this lecture,
verifying the proposition A by putting that knowledge into practice is
the same as reducing the proof to introductory form and deleting the
last, introductory inference. Moreover, the way of reducing the proof
which corresponds to the semantical explanations, notably of the elimination rules, is precisely the way that I utilized for the first time in
my paper on iterated inductive definitions in the Proceedings of the
Second Scandinavian Logic Symposium, although merely because of
its naturalness, not for any genuine semantical reasons, at that time.
But no longer do we need to prove anything, that is, no longer do we
need to prove metamathematically that the proof figures, divested of
sense, reduce to introductory form. Instead of proving it, we endow
the proof figures with sense, and then we see it! Thus the definition
of convertibility, or computability, and the proof of normalization have
been transposed into genuine semantical explanations which allow you
to see this, just as you can see consistency semantically. And this is
the point that I had intended to reach in these lectures.
60 per martin-l"of
Postscript, Feb. 1996
The preceding three lectures were originally published in the Atti
degli Incontri di Logica Matematica, Vol. 2, Scuola di Specializzazione
in Logica Matematica, Dipartimento di Matematica, Universit`a di
Siena, 1985, pp. 203-281. Since they have been difficult to obtain,
and are now even out of print, they are reprinted here by kind permission of the Dipartimento di Matematica, Universit`a di Siena. Only
typing errors have been corrected. The reader who wishes to follow
the further development of the ideas that were brought up for the first
time in these lectures is referred to the papers listed below.
Per Martin-L"of (1987) Truth of a proposition, evidence of a judgement,
validity of a proof. Synthese, 73, pp. 407-420.
---- (1991) A path from logic to metaphysics. In Atti del Congresso
Nuovi Problemi della Logica e della Filosofia della Scienza, Viareggio, 8-13 gennaio 1990, Vol. II, pp. 141-149. CLUEB, Bologna.
---- (1994) Analytic and synthetic judgements in type theory. In
Paolo Parrini (ed.), Kant and Contemporary Epistemology, pp. 87-
99. Kluwer Academic Publishers, Dordrecht/Boston/London.
---- (1995) Verificationism then and now. In W. DePauli-Schimanovich,
<NAME>, and <NAME> (eds.), The Foundational Debate: Complexity and Constructivity in Mathematics and Physics, pp. 187-
196. Kluwer Academic Publishers, Dordrecht/Boston/London.
---- (1996) Truth and knowability: on the principles C and K of
<NAME>. In <NAME> and <NAME> (eds.), Truth
in Mathematics. Clarendon Press, Oxford. Forthcoming.
Department of Mathematics
University of Stockholm
Sweden
-}
-- record -- WORKS with this additional token
|
1-base/math/source/precision/short/short_math.ads | charlie5/lace | 20 | 4594 | <reponame>charlie5/lace
with
any_Math;
package short_Math is new any_Math (Real_t => short_Float);
pragma Pure (short_Math);
|
src/Categories/Diagram/Coequalizer.agda | maxsnew/agda-categories | 0 | 13638 | <gh_stars>0
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core using (Category)
module Categories.Diagram.Coequalizer {o ℓ e} (𝒞 : Category o ℓ e) where
open Category 𝒞
open HomReasoning
open Equiv
open import Categories.Morphism 𝒞
open import Categories.Morphism.Reasoning 𝒞
open import Level
open import Function using (_$_)
private
variable
A B C : Obj
h i j k : A ⇒ B
record IsCoequalizer {E} (f g : A ⇒ B) (arr : B ⇒ E) : Set (o ⊔ ℓ ⊔ e) where
field
equality : arr ∘ f ≈ arr ∘ g
coequalize : {h : B ⇒ C} → h ∘ f ≈ h ∘ g → E ⇒ C
universal : {h : B ⇒ C} {eq : h ∘ f ≈ h ∘ g} → h ≈ coequalize eq ∘ arr
unique : {h : B ⇒ C} {i : E ⇒ C} {eq : h ∘ f ≈ h ∘ g} → h ≈ i ∘ arr → i ≈ coequalize eq
unique′ : (eq eq′ : h ∘ f ≈ h ∘ g) → coequalize eq ≈ coequalize eq′
unique′ eq eq′ = unique universal
id-coequalize : id ≈ coequalize equality
id-coequalize = unique (⟺ identityˡ)
coequalize-resp-≈ : ∀ {eq : h ∘ f ≈ h ∘ g} {eq′ : i ∘ f ≈ i ∘ g} →
h ≈ i → coequalize eq ≈ coequalize eq′
coequalize-resp-≈ {h = h} {i = i} {eq = eq} {eq′ = eq′} h≈i = unique $ begin
i ≈˘⟨ h≈i ⟩
h ≈⟨ universal ⟩
coequalize eq ∘ arr ∎
coequalize-resp-≈′ : (eq : h ∘ f ≈ h ∘ g) → (eq′ : i ∘ f ≈ i ∘ g) →
h ≈ i → j ≈ coequalize eq → k ≈ coequalize eq′ → j ≈ k
coequalize-resp-≈′ {j = j} {k = k} eq eq′ h≈i eqj eqk = begin
j ≈⟨ eqj ⟩
coequalize eq ≈⟨ coequalize-resp-≈ h≈i ⟩
coequalize eq′ ≈˘⟨ eqk ⟩
k ∎
-- This could be proved via duality, but is easier to just write by hand,
-- as it makes the dependency graph a lot cleaner.
IsCoequalizer⇒Epi : IsCoequalizer h i j → Epi j
IsCoequalizer⇒Epi coeq _ _ eq =
coequalize-resp-≈′ (extendˡ equality) (extendˡ equality) eq (unique refl) (unique refl)
where
open IsCoequalizer coeq
record Coequalizer (f g : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where
field
{obj} : Obj
arr : B ⇒ obj
isCoequalizer : IsCoequalizer f g arr
open IsCoequalizer isCoequalizer public
Coequalizer⇒Epi : (e : Coequalizer h i) → Epi (Coequalizer.arr e)
Coequalizer⇒Epi coeq = IsCoequalizer⇒Epi isCoequalizer
where
open Coequalizer coeq
-- Proving this via duality arguments is kind of annoying, as ≅ does not behave nicely in
-- concert with op.
up-to-iso : (coe₁ coe₂ : Coequalizer h i) → Coequalizer.obj coe₁ ≅ Coequalizer.obj coe₂
up-to-iso coe₁ coe₂ = record
{ from = repack coe₁ coe₂
; to = repack coe₂ coe₁
; iso = record
{ isoˡ = repack-cancel coe₂ coe₁
; isoʳ = repack-cancel coe₁ coe₂
}
}
where
open Coequalizer
repack : (coe₁ coe₂ : Coequalizer h i) → obj coe₁ ⇒ obj coe₂
repack coe₁ coe₂ = coequalize coe₁ (equality coe₂)
repack∘ : (coe₁ coe₂ coe₃ : Coequalizer h i) → repack coe₂ coe₃ ∘ repack coe₁ coe₂ ≈ repack coe₁ coe₃
repack∘ coe₁ coe₂ coe₃ = unique coe₁ (⟺ (glueTrianglesˡ (⟺ (universal coe₂)) (⟺ (universal coe₁)))) -- unique e₃ (⟺ (glueTrianglesʳ (⟺ (universal e₃)) (⟺ (universal e₂))))
repack-cancel : (e₁ e₂ : Coequalizer h i) → repack e₁ e₂ ∘ repack e₂ e₁ ≈ id
repack-cancel coe₁ coe₂ = repack∘ coe₂ coe₁ coe₂ ○ ⟺ (id-coequalize coe₂)
IsCoequalizer⇒Coequalizer : IsCoequalizer h i k → Coequalizer h i
IsCoequalizer⇒Coequalizer {k = k} is-coe = record
{ arr = k
; isCoequalizer = is-coe
}
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_692_795.asm | ljhsiun2/medusa | 9 | 177794 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x816d, %rcx
sub $51094, %r10
mov (%rcx), %di
nop
nop
nop
inc %r13
lea addresses_UC_ht+0x43d, %r12
nop
nop
nop
nop
nop
inc %r9
movb (%r12), %bl
inc %r9
lea addresses_normal_ht+0x6d6d, %rbx
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %r12
movq %r12, %xmm1
movups %xmm1, (%rbx)
nop
nop
nop
nop
and %r10, %r10
lea addresses_D_ht+0x1523d, %r13
nop
nop
nop
nop
nop
cmp $40803, %r9
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r13)
nop
nop
add $10746, %r10
lea addresses_UC_ht+0x1856d, %r10
nop
nop
nop
nop
nop
inc %rbx
movw $0x6162, (%r10)
nop
nop
nop
nop
sub $5305, %rbx
lea addresses_UC_ht+0x1846d, %rsi
lea addresses_normal_ht+0x13405, %rdi
inc %r13
mov $42, %rcx
rep movsw
cmp %rbx, %rbx
lea addresses_normal_ht+0x12d7d, %r13
nop
nop
nop
sub %r10, %r10
mov (%r13), %r12w
nop
nop
nop
nop
cmp $25810, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %rax
push %rcx
push %rsi
// Store
lea addresses_RW+0x1816d, %r13
nop
nop
nop
nop
nop
xor %r12, %r12
mov $0x5152535455565758, %r14
movq %r14, %xmm4
vmovaps %ymm4, (%r13)
nop
cmp %r14, %r14
// Store
lea addresses_WC+0x99a9, %rcx
nop
nop
nop
inc %r10
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
dec %r10
// Store
lea addresses_RW+0x752d, %r10
nop
nop
nop
nop
sub %rcx, %rcx
mov $0x5152535455565758, %r12
movq %r12, (%r10)
nop
nop
and $26868, %rax
// Store
lea addresses_WC+0xa395, %r14
nop
nop
nop
inc %rsi
movb $0x51, (%r14)
nop
nop
nop
nop
cmp $18473, %rsi
// Faulty Load
lea addresses_D+0xd56d, %rsi
nop
nop
add %r13, %r13
movb (%rsi), %r10b
lea oracles, %rcx
and $0xff, %r10
shlq $12, %r10
mov (%rcx,%r10,1), %r10
pop %rsi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'36': 692}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
oeis/096/A096617.asm | neoneye/loda-programs | 11 | 246834 | ; A096617: Numerator of n*HarmonicNumber(n).
; Submitted by <NAME>(w1)
; 1,3,11,25,137,147,363,761,7129,7381,83711,86021,1145993,1171733,1195757,2436559,42142223,42822903,275295799,279175675,56574159,19093197,444316699,1347822955,34052522467,34395742267,312536252003,315404588903,9227046511387,9304682830147,290774257297357,586061125622639,590436990861839,54062195834749,54437269998109,54801925434709,2040798836801833,2053580969474233,2066035355155033,2078178381193813,85691034670497533,86165190925345133,532145396070491417,5884182435213075787,5914085889685464427
add $0,1
mov $2,1
mov $3,$0
lpb $3
mul $1,$3
mov $4,$3
add $4,1
mul $2,$4
add $1,$2
sub $3,1
lpe
mul $1,$0
gcd $2,$1
div $1,$2
mov $0,$1
|
oeis/256/A256539.asm | neoneye/loda-programs | 11 | 169770 | <gh_stars>10-100
; A256539: Number of partitions of 4n into at most 5 parts.
; Submitted by <NAME>(s2)
; 1,5,18,47,101,192,333,540,831,1226,1747,2418,3266,4319,5608,7166,9027,11229,13811,16814,20282,24260,28796,33940,39744,46262,53550,61667,70673,80631,91606,103664,116875,131310,147042,164147,182702,202787,224484,247877,273052,300097,329103,360162,393369,428821,466616,506856,549644,595085,643287,694359,748413,805563,865925,929617,996759,1067474,1141886,1220122,1302311,1388583,1479072,1573913,1673243,1777202,1885931,1999574,2118277,2242188,2371457,2506236,2646680,2792945,2945190,3103576,3268265
mov $2,$0
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $5,$0
mov $6,0
mov $7,$0
add $7,1
lpb $7
mov $0,$5
sub $7,1
sub $0,$7
mov $3,$0
mul $3,7
add $0,$3
seq $0,25770 ; Expansion of 1/((1-x)(1-x^3)(1-x^10)).
add $6,$0
lpe
add $1,$6
lpe
mov $0,$1
add $0,1
|
src/Parse/TreeConvert.agda | WhatisRT/meta-cedille | 35 | 10449 | --------------------------------------------------------------------------------
-- This file contains functions to turn the tree of parse results into the agda
-- data structures they represent.
--------------------------------------------------------------------------------
{-# OPTIONS --type-in-type #-}
module Parse.TreeConvert where
import Data.Sum
open import Class.Map
open import Class.Monad.Except
open import Data.SimpleMap
open import Data.String using (fromList; toList; fromChar; uncons)
open import Data.Tree
open import Data.Tree.Instance
open import Data.Word using (fromℕ)
open import Prelude
open import Prelude.Strings
open import CoreTheory
open import Bootstrap.InitEnv
open import Parse.MultiChar
open import Parse.LL1
open import Parse.Generate
open import Parse.Escape
continueIfInit : ∀ {a} {A : Set a} → List Char → List Char → (List Char → A) → Maybe A
continueIfInit {A = A} init s = helper init s
where
helper : List Char → List Char → (List Char → A) → Maybe A
helper [] s f = just $ f s
helper (x₁ ∷ init) [] f = nothing
helper (x₁ ∷ init) (x ∷ s) f with x ≟ x₁
... | yes p = helper init s f
... | no ¬p = nothing
ruleId : List Char → List Char → Maybe (ℕ ⊎ Char)
ruleId nonterm rule = do
rules ← lookup nonterm parseRuleMap
i ← findIndexList (_≟ (nonterm + "$" + rule)) rules
return $ inj₁ i
_≡ᴹ_ : ℕ ⊎ Char → Maybe (ℕ ⊎ Char) → Bool
x ≡ᴹ y = just x ≣ y
toSort : Tree (ℕ ⊎ Char) → Maybe Sort
toSort (Node x x₁) =
if x ≡ᴹ ruleId "sort" "*"
then return ⋆
else if x ≡ᴹ ruleId "sort" "□"
then return □
else nothing
toConst : Tree (ℕ ⊎ Char) → Maybe Const
toConst (Node x x₁) =
if x ≡ᴹ ruleId "const" "Char"
then return CharT
else nothing
toChar : Tree (ℕ ⊎ Char) → Maybe Char
toChar (Node (inj₁ x) x₁) = nothing
toChar (Node (inj₂ y) x₁) = just y
toChar' : Tree (ℕ ⊎ Char) → Maybe Char
toChar' (Node x x₁) =
if x ≡ᴹ ruleId "char" "!!"
then (case x₁ of λ { (y ∷ []) → toChar y ; _ → nothing })
else nothing
toName : Tree (ℕ ⊎ Char) → Maybe String
toName (Node x x₁) = case x₁ of λ
{ (y ∷ y' ∷ _) → do
c ← toChar y
n ← toName y'
return (fromChar c + n)
; [] → if x ≡ᴹ ruleId "string'" ""
then return ""
else nothing
; _ → nothing }
toNameList : Tree (ℕ ⊎ Char) → Maybe (List String)
toNameList (Node x []) = just []
toNameList (Node x (x₁ ∷ x₂ ∷ _)) = do
n ← toName x₁
rest ← toNameList x₂
return $ n ∷ rest
{-# CATCHALL #-}
toNameList _ = nothing
toIndex : Tree (ℕ ⊎ Char) → Maybe ℕ
toIndex t = do
res ← helper t
foldl {A = Maybe ℕ} (λ x c → (λ x' → 10 * x' + c) <$> x) (just 0) res
where
helper' : Tree (ℕ ⊎ Char) → Maybe (List ℕ)
helper' (Node x []) =
if x ≡ᴹ ruleId "index'" ""
then return []
else nothing
helper' (Node x (x₁ ∷ _)) = do
rest ← helper' x₁
decCase (just x) of
(ruleId "index'" "0_index'_" , return (0 ∷ rest)) ∷
(ruleId "index'" "1_index'_" , return (1 ∷ rest)) ∷
(ruleId "index'" "2_index'_" , return (2 ∷ rest)) ∷
(ruleId "index'" "3_index'_" , return (3 ∷ rest)) ∷
(ruleId "index'" "4_index'_" , return (4 ∷ rest)) ∷
(ruleId "index'" "5_index'_" , return (5 ∷ rest)) ∷
(ruleId "index'" "6_index'_" , return (6 ∷ rest)) ∷
(ruleId "index'" "7_index'_" , return (7 ∷ rest)) ∷
(ruleId "index'" "8_index'_" , return (8 ∷ rest)) ∷
(ruleId "index'" "9_index'_" , return (9 ∷ rest)) ∷ []
default nothing
helper : Tree (ℕ ⊎ Char) → Maybe (List ℕ)
helper (Node x []) = nothing
helper (Node x (x₁ ∷ _)) = do
rest ← helper' x₁
decCase just x of
(ruleId "index" "0_index'_" , return (0 ∷ rest)) ∷
(ruleId "index" "1_index'_" , return (1 ∷ rest)) ∷
(ruleId "index" "2_index'_" , return (2 ∷ rest)) ∷
(ruleId "index" "3_index'_" , return (3 ∷ rest)) ∷
(ruleId "index" "4_index'_" , return (4 ∷ rest)) ∷
(ruleId "index" "5_index'_" , return (5 ∷ rest)) ∷
(ruleId "index" "6_index'_" , return (6 ∷ rest)) ∷
(ruleId "index" "7_index'_" , return (7 ∷ rest)) ∷
(ruleId "index" "8_index'_" , return (8 ∷ rest)) ∷
(ruleId "index" "9_index'_" , return (9 ∷ rest)) ∷ []
default nothing
toTerm : Tree (ℕ ⊎ Char) → Maybe AnnTerm
toTerm = helper []
where
helper : List String → Tree (ℕ ⊎ Char) → Maybe AnnTerm
helper accu (Node x x₁) =
decCase just x of
(ruleId "term" "_var_" , (case x₁ of λ
{ ((Node y (n ∷ [])) ∷ []) →
decCase just y of
(ruleId "var" "_string_" , do
n' ← toName n
return $ case findIndexList (n' ≟_) accu of λ
{ (just x) → BoundVar $ fromℕ x
; nothing → FreeVar n' }) ∷
(ruleId "var" "_index_" , do
n' ← toIndex n
return $ BoundVar $ fromℕ n') ∷ []
default nothing
; _ → nothing })) ∷
(ruleId "term" "_sort_" , do
s ← head x₁ >>= toSort
return $ Sort-A s) ∷
(ruleId "term" "π^space^_term_" , (case x₁ of λ
{ (y ∷ []) → do
y' ← helper accu y
return $ Pr1-A y'
; _ → nothing })) ∷
(ruleId "term" "ψ^space^_term_" , (case x₁ of λ
{ (y ∷ []) → do
y' ← helper accu y
return $ Pr2-A y'
; _ → nothing })) ∷
(ruleId "term" "β^space^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ Beta-A t t'
; _ → nothing })) ∷
(ruleId "term" "δ^space^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ Delta-A t t'
; _ → nothing })) ∷
(ruleId "term" "σ^space^_term_" , (case x₁ of λ
{ (y ∷ []) → helper accu y >>= λ y' → return (Sigma-A y') ; _ → nothing })) ∷
(ruleId "term" "[^space'^_term_^space^_term_^space'^]" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ App-A t t'
; _ → nothing })) ∷
(ruleId "term" "<^space'^_term_^space^_term_^space'^>" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ AppE-A t t'
; _ → nothing })) ∷
(ruleId "term"
"ρ^space^_term_^space^_string_^space'^.^space'^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ n' ∷ y' ∷ y'' ∷ []) → do
t ← helper accu y
n ← toName n'
t' ← helper (n ∷ accu) y'
t'' ← helper accu y''
return $ Rho-A t t' t''
; _ → nothing })) ∷
(ruleId "term"
"∀^space^_string_^space'^:^space'^_term_^space^_term_" , (case x₁ of λ
{ (n' ∷ y ∷ y' ∷ []) → do
n ← toName n'
t ← helper accu y
t' ← helper (n ∷ accu) y'
return $ All-A n t t'
; _ → nothing })) ∷
(ruleId "term"
"Π^space^_string_^space'^:^space'^_term_^space^_term_" , (case x₁ of λ
{ (n' ∷ y ∷ y' ∷ []) → do
n ← toName n'
t ← helper accu y
t' ← helper (n ∷ accu) y'
return $ Pi-A n t t'
; _ → nothing })) ∷
(ruleId "term"
"ι^space^_string_^space'^:^space'^_term_^space^_term_" , (case x₁ of λ
{ (n' ∷ y ∷ y' ∷ []) → do
n ← toName n'
t ← helper accu y
t' ← helper (n ∷ accu) y'
return $ Iota-A n t t'
; _ → nothing })) ∷
(ruleId "term"
"λ^space^_string_^space'^:^space'^_term_^space^_term_" , (case x₁ of λ
{ (n' ∷ y ∷ y' ∷ []) → do
n ← toName n'
t ← helper accu y
t' ← helper (n ∷ accu) y'
return $ Lam-A n t t'
; _ → nothing })) ∷
(ruleId "term"
"Λ^space^_string_^space'^:^space'^_term_^space^_term_" , (case x₁ of λ
{ (n' ∷ y ∷ y' ∷ []) → do
n ← toName n'
t ← helper accu y
t' ← helper (n ∷ accu) y'
return $ LamE-A n t t'
; _ → nothing })) ∷
(ruleId "term"
"{^space'^_term_^space'^,^space'^_term_^space^_string_^space'^.^space'^_term_^space'^}" ,
(case x₁ of λ
{ (y ∷ y' ∷ n' ∷ y'' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
n ← toName n'
t'' ← helper (n ∷ accu) y''
return $ Pair-A t t' t''
; _ → nothing })) ∷
(ruleId "term" "φ^space^_term_^space^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ y' ∷ y'' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
t'' ← helper accu y''
return $ Phi-A t t' t''
; _ → nothing })) ∷
(ruleId "term" "=^space^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ Eq-A t t'
; _ → nothing })) ∷
(ruleId "term" "ω^space^_term_" , (case x₁ of λ
{ (y ∷ []) → do
t ← helper accu y
return $ M-A t
; _ → nothing })) ∷
(ruleId "term" "μ^space^_term_^space^_term_" , (case x₁ of λ
{ (y ∷ y' ∷ []) → do
t ← helper accu y
t' ← helper accu y'
return $ Mu-A t t'
; _ → nothing })) ∷
(ruleId "term" "ε^space^_term_" , (case x₁ of λ
{ (y ∷ []) → do
t ← helper accu y
return $ Epsilon-A t
; _ → nothing })) ∷
(ruleId "term" "ζEvalStmt^space^_term_" , (case x₁ of λ
{ (z ∷ []) → do
t ← helper accu z
return $ Ev-A EvalStmt t
; _ → nothing })) ∷
(ruleId "term" "ζShellCmd^space^_term_^space^_term_" , (case x₁ of λ
{ (z ∷ z' ∷ []) → do
t ← helper accu z
t' ← helper accu z'
return $ Ev-A ShellCmd (t , t')
; _ → nothing })) ∷
(ruleId "term" "ζCheckTerm^space^_term_^space^_term_" , (case x₁ of λ
{ (z ∷ z' ∷ []) → do
t ← helper accu z
t' ← helper accu z'
return $ Ev-A CheckTerm (t , t')
; _ → nothing })) ∷
(ruleId "term" "ζParse^space^_term_^space^_term_^space^_term_" , (case x₁ of λ
{ (z ∷ z' ∷ z'' ∷ []) → do
t ← helper accu z
t' ← helper accu z'
t'' ← helper accu z''
return $ Ev-A Parse (t , t' , t'')
; _ → nothing })) ∷
(ruleId "term" "ζCatchErr^space^_term_^space^_term_" , (case x₁ of λ
{ (z ∷ z' ∷ []) → do
t ← helper accu z
t' ← helper accu z'
return $ Gamma-A t t'
; _ → nothing })) ∷
(ruleId "term" "ζNormalize^space^_term_" , (case x₁ of λ
{ (z ∷ []) → do
t ← helper accu z
return $ Ev-A Normalize t
; _ → nothing })) ∷
(ruleId "term" "ζHeadNormalize^space^_term_" , (case x₁ of λ
{ (z ∷ []) → do
t ← helper accu z
return $ Ev-A HeadNormalize t
; _ → nothing })) ∷
(ruleId "term" "ζInferType^space^_term_" , (case x₁ of λ
{ (z ∷ []) → do
t ← helper accu z
return $ Ev-A InferType t
; _ → nothing })) ∷
(ruleId "term" "Κ_const_" , (case x₁ of λ
{ (z ∷ []) → do
c ← toConst z
return $ Const-A c
; _ → nothing })) ∷
(ruleId "term" "κ_char_" , (case x₁ of λ
{ (z ∷ []) → do
c ← toChar z <∣> toChar' z
return $ Char-A c
; _ → nothing })) ∷
(ruleId "term" "γ^space^_term_^space^_term_" , (case x₁ of λ
{ (z ∷ z' ∷ []) → do
t ← helper accu z
t' ← helper accu z'
return $ CharEq-A t t'
; _ → nothing })) ∷
[]
default nothing
data Stmt : Set where
Let : GlobalName → AnnTerm → Maybe AnnTerm → Stmt
Ass : GlobalName → AnnTerm → Stmt
SetEval : AnnTerm → String → String → Stmt
Import : String → Stmt
Empty : Stmt
instance
Stmt-Show : Show Stmt
Stmt-Show = record { show = helper }
where
helper : Stmt → String
helper (Let x x₁ (just x₂)) = "let " + x + " := " + show x₁ + " : " + show x₂
helper (Let x x₁ nothing) = "let " + x + " := " + show x₁
helper (Ass x x₁) = "ass " + x + " : " + show x₁
helper (SetEval x n n') = "seteval " + show x + " " + n + " " + n'
helper (Import s) = "import " + s
helper Empty = "Empty"
toStmt : Tree (ℕ ⊎ Char) → Maybe Stmt
toStmt (Node x ((Node x' x₂) ∷ [])) =
if x ≡ᴹ ruleId "stmt" "^space'^_stmt'_"
then
decCase just x' of
(ruleId "stmt'" "let^space^_string_^space'^:=^space'^_term_^space'^_lettail_" ,
(case x₂ of λ
{ (y ∷ y' ∷ y'' ∷ []) → do
n ← toName y
t ← toTerm y'
return $ Let n t $ toLetTail y''
; _ → nothing })) ∷
(ruleId "stmt'"
"ass^space^_string_^space'^:^space'^_term_^space'^." ,
(case x₂ of λ
{ (y ∷ y₁ ∷ []) → do
n ← toName y
t ← toTerm y₁
return $ Ass n t
; _ → nothing })) ∷
(ruleId "stmt'" "seteval^space^_term_^space^_string_^space^_string_^space'^." ,
(case x₂ of λ
{ (y ∷ y' ∷ y'' ∷ []) → do
t ← toTerm y
n ← toName y'
n' ← toName y''
return $ SetEval t n n'
; _ → nothing })) ∷
(ruleId "stmt'" "import^space^_string_^space'^." ,
(case x₂ of λ
{ (y ∷ []) → do
n ← toName y
return $ Import n
; _ → nothing })) ∷
(ruleId "stmt'" "" ,
return Empty) ∷
[]
default nothing
else nothing
where
toLetTail : Tree (ℕ ⊎ Char) → Maybe AnnTerm
toLetTail (Node x x₁) =
decCase just x of
(ruleId "lettail" ":^space'^_term_^space'^." ,
(case x₁ of λ
{ (y ∷ []) → toTerm y
; _ → nothing })) ∷
[]
default nothing
{-# CATCHALL #-}
toStmt _ = nothing
private
-- Folds a tree of constructors back into a term by properly applying the
-- constructors and prefixing the namespace
{-# TERMINATING #-}
foldConstrTree : String → Tree (String ⊎ Char) → AnnTerm
foldConstrTree namespace (Node x x₁) =
foldl (λ t t' → t ⟪$⟫ t') (ruleToTerm x) (foldConstrTree namespace <$> x₁)
where
ruleToTerm : String ⊎ Char → AnnTerm
ruleToTerm (inj₁ x) = FreeVar (namespace + "$" + ruleToConstr x)
ruleToTerm (inj₂ y) = Char-A y
convertIfChar : Tree (String ⊎ Char) → Maybe (Tree (ℕ ⊎ Char))
convertIfChar (Node (inj₁ x) x₁) = do
rest ← stripPrefix "nameInitChar$" x <∣> stripPrefix "nameTailChar$" x
(c , s) ← uncons rest
just $ Node (inj₂ $ unescape c s) []
convertIfChar (Node (inj₂ x) x₁) = nothing
module _ {M} {{_ : Monad M}} {{_ : MonadExcept M String}} where
preCoreGrammar : M Grammar
preCoreGrammar = generateCFGNonEscaped "stmt" (map fromList coreGrammarGenerator)
private
parseToConstrTree : (G : Grammar) → NonTerminal G → String → M (Tree (String ⊎ Char) × String)
parseToConstrTree (_ , G , (showRule , showNT)) S s = do
(t , rest) ← parseWithInitNT showNT matchMulti show G M S s
return (_<$>_ {{Tree-Functor}} (Data.Sum.map₁ showRule) t , rest)
parsePreCoreGrammar : String → M (Tree (String ⊎ Char) × String)
parsePreCoreGrammar s = do
G ← preCoreGrammar
parseToConstrTree G (initNT G) s
{-# TERMINATING #-} -- cannot just use sequence here because of the char special case
synTreeToℕTree : Tree (String ⊎ Char) → M (Tree (ℕ ⊎ Char))
synTreeToℕTree t@(Node (inj₁ x) x₁) with convertIfChar t
... | (just t') = return t'
... | nothing = do
id ← fullRuleId x
ids ← sequence $ map synTreeToℕTree x₁
return (Node id ids)
where
fullRuleId : String → M (ℕ ⊎ Char)
fullRuleId l with break (_≟ '$') (toList l) -- split at '$'
... | (x , []) = throwError "No '$' character found!"
... | (x , _ ∷ y) = maybeToError (ruleId x y) ("Rule " + l + "doesn't exist!")
synTreeToℕTree (Node (inj₂ x) x₁) = return $ Node (inj₂ x) []
-- Parse the next top-level non-terminal symbol from a string, and return a
-- term representing the result of the parse, as well as the unparsed rest of
-- the string
parse : (G : Grammar) → NonTerminal G → String → String → M (AnnTerm × String)
parse G S namespace s = do
(t , rest) ← parseToConstrTree G S s
return (foldConstrTree namespace t , rest)
-- Used for bootstrapping
parseStmt : String → M (Stmt × String)
parseStmt s = do
(y' , rest) ← parsePreCoreGrammar s
y ← synTreeToℕTree y'
case toStmt y of λ where
(just x) → return (x , rest)
nothing → throwError ("Error while converting syntax tree to statement!\nTree:\n" + show y
+ "\nRemaining: " + s)
|
x86/src/64/frames.asm | sneakin/north | 2 | 242961 | <gh_stars>1-10
defop current_frame
pop rax
push fp
push rax
ret
defop begin_frame
pop rax
push fp
mov fp, rsp
jmp rax
defop drop_frame
pop rax
mov rsp, fp
pop fp
jmp rax
defop end_frame
mov fp, [fp]
ret
defalias pop_frame,end_frame
;;;
;;; Returns
;;;
defop drop_locals
pop rax
mov rsp, fp
jmp rax
defop continue ; end the frame, leave the stack intact, and return to caller
add rsp, ptrsize
mov eval_ip, [fp+ptrsize]
mov rax, [fp+ptrsize*2]
mov fp, [fp]
jmp rax
defop return0 ; stash ToS, drop the frame, roll stash, and exit fn
mov rsp, fp
pop fp
pop eval_ip
ret
defop return_1 ; drops an argument
mov rsp, fp
pop fp
pop eval_ip
pop rax
add rsp, ptrsize
jmp rax
defop return1
mov rax, [rsp+ptrsize]
mov rsp, fp
pop fp
pop eval_ip
pop rbx
push rax
push rbx
ret
defop return2
mov rax, [rsp+ptrsize]
mov rbx, [rsp+ptrsize*2]
mov rsp, fp
pop fp
pop eval_ip
pop rcx
push rax
push rbx
push rcx
ret
defop quit
mov rbx, [rsp+ptrsize] ; keep the ToS as C expects a return value
mov rax, [fp] ; pop frames until the parent frame is 0
cmp rax, 0
je .done
mov fp, rax
jmp quit_asm
.done:
mov rsp, fp ; enter the top most frame
pop fp
pop eval_ip
pop rax ; save return to the top frame's caller
push rbx ; return with the ToS
jmp rax
;;;
;;; Call Arguments
;;;
defop args
lea rax, [fp+ptrsize*3]
pop rbx
push rax
push rbx
ret
defop arg0
mov rax, [fp+ptrsize*3]
pop rbx
push rax
push rbx
ret
defop arg1
mov rax, [fp+ptrsize*4]
pop rbx
push rax
push rbx
ret
;;;
;;; Local data
;;;
defop locals
lea rax, [fp-ptrsize*1]
pop rbx
push rax
push rbx
ret
defop local0
mov rax, [fp-ptrsize*1]
pop rbx
push rax
push rbx
ret
|
grammars/src/main/antlr/cadl_primitives.g4 | serefarikan/archie | 1 | 159 | //
// description: Antlr4 grammar for cADL primitives sub-syntax of Archetype Definition Language (ADL2)
// author: <NAME> <<EMAIL>>
// support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
// copyright: Copyright (c) 2015 openEHR Foundation
// license: Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
//
grammar cadl_primitives;
import adl_keywords, odin_values;
//
// ======================= Parser rules ========================
//
c_primitive_object:
c_integer
| c_real
| c_date
| c_time
| c_date_time
| c_duration
| c_string
| c_terminology_code
| c_boolean
;
c_integer: ( integer_value | integer_list_value | integer_interval_value | integer_interval_list_value ) assumed_integer_value? ;
assumed_integer_value: ';' integer_value ;
c_real: ( real_value | real_list_value | real_interval_value | real_interval_list_value ) assumed_real_value? ;
assumed_real_value: ';' real_value ;
c_date_time: ( DATE_TIME_CONSTRAINT_PATTERN | date_time_value | date_time_list_value | date_time_interval_value | date_time_interval_list_value ) assumed_date_time_value? ;
assumed_date_time_value: ';' date_time_value ;
c_date: ( DATE_CONSTRAINT_PATTERN | date_value | date_list_value | date_interval_value | date_interval_list_value ) assumed_date_value? ;
assumed_date_value: ';' date_value ;
c_time: ( TIME_CONSTRAINT_PATTERN | time_value | time_list_value | time_interval_value | time_interval_list_value ) assumed_time_value? ;
assumed_time_value: ';' time_value ;
c_duration: (
DURATION_CONSTRAINT_PATTERN ( ( duration_interval_value | duration_value ))?
| duration_value | duration_list_value | duration_interval_value | duration_interval_list_value ) assumed_duration_value?
;
assumed_duration_value: ';' duration_value ;
// for REGEX: strip first and last char, and then process with PCRE grammar
c_string: ( string_value | string_list_value ) assumed_string_value? ;
assumed_string_value: ';' string_value ;
// ADL2 term types: [ac3], [ac3; at5], [at5]
c_terminology_code: '[' ( ( AC_CODE ( ';' AT_CODE )? ) | AT_CODE ) ']' ;
c_boolean: ( boolean_value | boolean_list_value ) assumed_boolean_value? ;
assumed_boolean_value: ';' boolean_value ;
adl_path : ADL_PATH;
// ---------- ISO8601-based date/time/duration constraint patterns
DATE_CONSTRAINT_PATTERN : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
TIME_CONSTRAINT_PATTERN : HOUR_PATTERN SYM_COLON MINUTE_PATTERN SYM_COLON SECOND_PATTERN ;
DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
DURATION_CONSTRAINT_PATTERN : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ('/')?;
// date time pattern
fragment YEAR_PATTERN : ( 'yyy' 'y'? ) | ( 'YYY' 'Y'? ) ;
fragment MONTH_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
fragment DAY_PATTERN : 'dd' | 'DD' | '??' | 'XX' | 'xx' ;
fragment HOUR_PATTERN : 'hh' | 'HH' | '??' | 'XX' | 'xx' ;
fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx' ;
SYM_LEFT_BRACKET: '[';
SYM_RIGHT_BRACKET: ']';
SYM_SLASH: '/';
|
monitor/vga_library.asm | mfkiwl/QNICE-FPGA-hyperRAM | 53 | 5287 | <reponame>mfkiwl/QNICE-FPGA-hyperRAM<filename>monitor/vga_library.asm<gh_stars>10-100
;
;;=======================================================================================
;; The collection of VGA related function starts here
;;=======================================================================================
;
;
;***************************************************************************************
;* VGA$INIT
;*
;* VGA on, hardware cursor on, large, blinking, reset current character coordinates
;***************************************************************************************
;
VGA$INIT INCRB
MOVE VGA$STATE, R0
MOVE 0x00E0, @R0 ; Enable everything
OR VGA$COLOR_GREEN, @R0 ; Set font color to green
OR VGA$EN_HW_SCRL, @R0 ; Enable offset registers
XOR R0, R0
MOVE _VGA$X, R1
MOVE R0, @R1 ; Reset X coordinate
MOVE VGA$CR_X, R1 ; Store it in VGA$CR_X
MOVE R0, @R1 ; ...and let the hardware know
MOVE _VGA$Y, R1
MOVE R0, @R1 ; The same with Y...
MOVE VGA$CR_Y, R1
MOVE R0, @R1
MOVE VGA$OFFS_DISPLAY, R1 ; Reset the display offset reg.
MOVE R0, @R1
MOVE VGA$OFFS_RW, R1 ; Reset the rw offset reg.
MOVE R0, @R1
DECRB
RET
;
;***************************************************************************************
;* VGA$CHAR_AT_XY
;*
;* R8: Contains character to be printed
;* R9: X-coordinate (0 .. 79)
;* R10: Y-coordinate (0 .. 39)
;*
;* Output a single char at a given coordinate pair.
;***************************************************************************************
;
VGA$CHAR_AT_XY INCRB
MOVE VGA$CR_X, R0
MOVE R8, @R0
MOVE VGA$CR_Y, R0
MOVE R9, @R0
MOVE VGA$CHAR, R0
MOVE R10, @R0
DECRB
RET
;
;***************************************************************************************
;* VGA$PUTCHAR
;*
;* Print a character to the VGA display. This routine automatically increments the
;* X- and, if necessary, the Y-coordinate. Scrolling is implemented - if the end of the
;* scroll buffer is reached after about 20 screen pages, the next character will cause
;* a CLS and then will be printed at location (0, 0) on screen page 0 again.
;*
;* This routine relies on the stored coordinates VGA$X and VGA$Y which always contain
;* the coordinate of the next (!) character to be displayed and will be updated
;* accordingly. This implies that it is possible to perform other character output and
;* cursor coordinate manipulation between two calls to VGA$PUTC without disturbing
;* the position of the next character to be printed.
;*
;* R8: Contains the character to be printed.
;***************************************************************************************
;
; TODO: \t
;
VGA$PUTCHAR INCRB
MOVE VGA$CR_X, R0 ; R0 points to the HW X-register
MOVE VGA$CR_Y, R1 ; R1 points to the HW Y-register
MOVE _VGA$X, R2 ; R2 points to the SW X-register
MOVE _VGA$Y, R3 ; R2 points to the SW Y-register
MOVE @R2, R4 ; R4 contains the current X-coordinate
MOVE @R3, R5 ; R5 contains the current Y-coordinate
MOVE R4, @R0 ; Set the HW X-coordinate
MOVE R5, @R1 ; Set the HW Y-coordinate
; Before we output anything, let us check for 0x0A and 0x0D:
CMP 0x000D, R8 ; Is it a CR?
RBRA _VGA$PUTC_NO_CR, !Z ; No
XOR R4, R4 ; CR -> Reset X-coordinate
RBRA _VGA$PUTC_END, 1 ; Update registers and exit
_VGA$PUTC_NO_CR CMP 0x000A, R8 ; Is it a LF?
RBRA _VGA$PUTC_NORMAL_CHAR, !Z ; No, so just a normal character
ADD 0x0001, R5 ; Increment Y-coordinate
MOVE VGA$MAX_Y, R7 ; To utilize the full screen, we need...
ADD 1, R7 ; ...to compare to 40 lines due to ADD 1, R5
CMP R7, R5 ; EOScreen reached?
RBRA _VGA$PUTC_END, !Z ; No, just update and exit
MOVE 0, R8 ; VGA$SCROLL_UP_1 in automatic mode
RSUB VGA$SCROLL_UP_1, 1 ; Yes, scroll one line up...
CMP 1, R8 ; Wrap-around/clrscr happened?
RBRA _VGA$PUTC_END_SKIP, Z ; Yes: Leave the function w/o rundown
SUB 0x0001, R5 ; No: Decrement Y-coordinate b/c we scrolled
;
MOVE VGA$OFFS_RW, R7 ; Take care of the rw offset register
ADD VGA$CHARS_PER_LINE, @R7
;
RBRA _VGA$PUTC_END, 1 ; Update registers and exit
_VGA$PUTC_NORMAL_CHAR MOVE VGA$CHAR, R6 ; R6 points to the HW char-register
MOVE R8, @R6 ; Output the character
; Now update the X- and Y-coordinate still contained in R4 and R5:
CMP VGA$MAX_X, R4 ; Have we reached the EOL?
RBRA _VGA$PUTC_1, !Z ; No
XOR R4, R4 ; Yes, reset X-coordinate to 0 and
CMP VGA$MAX_Y, R5 ; check if we have reached EOScreen
RBRA _VGA$PUTC_2, !Z ; No
MOVE 0, R8 ; VGA$SCROLL_UP_1 in automatic mode
RSUB VGA$SCROLL_UP_1, 1 ; Yes, scroll one line up...
CMP 1, R8 ; Wrap-around/clrscr happened?
RBRA _VGA$PUTC_END_SKIP, Z ; Yes: Leave the function w/o rundown
MOVE VGA$OFFS_RW, R7 ; Take care of the rw offset register
ADD VGA$CHARS_PER_LINE, @R7
RBRA _VGA$PUTC_END, 1 ; and finish
_VGA$PUTC_1 ADD 0x0001, R4 ; Just increment the X-coordinate
RBRA _VGA$PUTC_END, 1 ; and finish
_VGA$PUTC_2 ADD 0x0001, R5 ; Increment Y-coordinate and finish
; Rundown of the function
_VGA$PUTC_END MOVE R4, @R0 ; Update the HW coordinates to
MOVE R5, @R1 ; display cursor at next location
MOVE R4, @R2 ; Store current coordinates in
MOVE R5, @R3 ; _VGA$X and _VGA$Y
;
_VGA$PUTC_END_SKIP DECRB
RET
;
;***************************************************************************************
;* VGA$SCROLL_UP_1
;*
;* Scroll one line up - this function only takes care of the display offset, NOT
;* of the read/write offset!
;*
;* R8 (input): 0 = scroll due to calculations, 1 = scroll due to key press
;* R8 (output): 0 = standard exit; 1 = clear screen was performed
;***************************************************************************************
;
VGA$SCROLL_UP_1 INCRB
MOVE VGA$OFFS_DISPLAY, R0
MOVE VGA$OFFS_RW, R1
; calculate the new offset and only allow scrolling up, if ...
; a) ... the screen is full, i.e. we are at the
; last line, display offs = rw offs AND
; it is not the user who wants to scroll, but the system
; b) ... we scrolled down before, i.e. the display
; offset < rw offset AND it is not the system who wants
; to scroll, but the user (no autoscroll but content is
; appended at the bottom)
; c) ... we would not wrap at 64.000, but in such a case clear
; the screen at reset the offsets
MOVE 0, R3 ; perform a 32-bit subtraction...
MOVE @R0, R2 ; ...to find out, if display < rw...
MOVE 0, R5 ; ...(R3R2) = 32-bit enhanced display...
MOVE @R1, R4 ; ...(R5R4) = 32-bit enhanced rw
SUB R4, R2 ; ...result in (R3R2)...
SUBC R5, R3 ; ...if negative, then highest bit of R3...
SHL 1, R3 ; ...is set, so move upper bit to Carry...
RBRA _VGA$SCROLL_UP_1_CKR80, C ; ...because if Carry, then display < rw
CMP @R1, @R0 ; display = rw?
RBRA _VGA$SCROLL_UP_1_CKR81, Z ; yes: check R8
RBRA _VGA$SCROLL_UP_1_NOP, 1 ; it is >, so skip
; case display < rw
; automatic scrolling when new content is written to the end
; of the STDIN is disabled as soon as the user scrolled upwards
_VGA$SCROLL_UP_1_CKR80 CMP 0, R8
RBRA _VGA$SCROLL_UP_1_NOP, Z
RBRA _VGA$SCROLL_UP_1_DOIT, 1
; case display = offs
; do not scroll if the user wants to, but only if the
; system needs to due to a calculation result
_VGA$SCROLL_UP_1_CKR81 CMP 1, R8
RBRA _VGA$SCROLL_UP_1_NOP, Z
; avoid wrapping at 64.000: 60.800 is the last offset
; we can support before resetting everything as
; 64.000 - (80 x 40) = 60.800
CMP 60800, @R0 ; display = 60800?
RBRA _VGA$SCROLL_UP_1_DOIT, !Z ; no: scroll
RSUB VGA$CLS, 1 ; yes: clear screen...
MOVE 1, R8 ; set clrscr flag
RBRA _VGA$SCROLL_UP_1_END, 1 ; exit function
; perform the actual scrolling
_VGA$SCROLL_UP_1_DOIT ADD VGA$CHARS_PER_LINE, @R0
; if after the scrolling disp = rw, then show cursor
CMP @R1, @R0
RBRA _VGA$SCROLL_UP_1_NOP, !Z
MOVE VGA$STATE, R0
OR VGA$EN_HW_CURSOR, @R0
_VGA$SCROLL_UP_1_NOP MOVE 0, R8 ; no clrscr happened
_VGA$SCROLL_UP_1_END DECRB
RET
;
;***************************************************************************************
;* VGA$SCROLL_UP
;*
;* Scroll many lines up, smartly: As VGA$SCROLL_UP_1 is used in a loop, all cases
;* are automatically taken care of.
;*
;* R8 contains the amount of lines, R8 is not preserved
;***************************************************************************************
;
VGA$SCROLL_UP INCRB
MOVE R8, R0
_VGA$SCROLL_UP_LOOP MOVE 1, R8 ; use "manual" mode
RSUB VGA$SCROLL_UP_1, 1 ; perform scrolling
SUB 1, R0
RBRA _VGA$SCROLL_UP_LOOP, !Z
DECRB
RET
;
;***************************************************************************************
;* VGA$SCROLL_DOWN_1
;*
;* Scroll one line down
;***************************************************************************************
;
VGA$SCROLL_DOWN_1 INCRB
MOVE VGA$OFFS_DISPLAY, R0
; if the offset is 0, then do not scroll
MOVE @R0, R1
RBRA _VGA$SCROLL_DOWN_1_NOP, Z
; do the actual scrolling
SUB VGA$CHARS_PER_LINE, R1
MOVE R1, @R0
; hide the cursor
MOVE VGA$STATE, R0
NOT VGA$EN_HW_CURSOR, R1
AND R1, @R0
_VGA$SCROLL_DOWN_1_NOP DECRB
RET
;
;***************************************************************************************
;* VGA$SCROLL_DOWN
;*
;* Scroll many lines down, smartly: As VGA$SCROLL_DOWN_1 is used in a loop, all cases
;* are automatically taken care of.
;*
;* R8 contains the amount of lines, R8 is not preserved
;***************************************************************************************
;
VGA$SCROLL_DOWN INCRB
MOVE R8, R0
_VGA$SCROLL_DOWN_LOOP RSUB VGA$SCROLL_DOWN_1, 1 ; perform scrolling
SUB 1, R0
RBRA _VGA$SCROLL_DOWN_LOOP, !Z
DECRB
RET
;
;***************************************************************************************
;* VGA$SCROLL_HOME_END
;*
;* Uses the "_1" scroll routines to scroll to the very top ("Home") or to the very
;* bottom("End"). As we are looping the "_1" functions, all special cases are
;* automatically taken care of.
;*
;* R8 = 0: HOME R8 = 1: END
;***************************************************************************************
;
VGA$SCROLL_HOME_END INCRB
MOVE VGA$OFFS_DISPLAY, R0
MOVE VGA$OFFS_RW, R1
CMP 1, R8 ; scroll to END?
RBRA _VGA$SCRL_HOME_END_E, Z
; Scroll to the very top ("Home")
_VGA$SCRL_HOME_END_H CMP 0, @R0 ; Home reached?
RBRA _VGA$SCRL_HOME_END_EOF, Z ; yes
RSUB VGA$SCROLL_DOWN_1, 1 ; no: scroll down
RBRA _VGA$SCRL_HOME_END_H, 1
RBRA _VGA$SCRL_HOME_END_EOF, 1
; Scroll to the very bottom ("End")
_VGA$SCRL_HOME_END_E CMP @R1, @R0 ; End reached?
RBRA _VGA$SCRL_HOME_END_EOF, Z ; Yes
MOVE 1, R8 ; No: scroll up in ...
RSUB VGA$SCROLL_UP_1, 1 ; ... "manual" scrolling mode
RBRA _VGA$SCRL_HOME_END_E, 1
_VGA$SCRL_HOME_END_EOF DECRB
RET
;
;***************************************************************************************
;* VGA$CLS
;*
;* Clear the VGA-screen and place the cursor in the upper left corner.
;***************************************************************************************
;
VGA$CLS INCRB
XOR R0, R0
MOVE _VGA$X, R1 ; Clear the SW X-register
MOVE R0, @R1
MOVE _VGA$Y, R1 ; Clear the SW Y-register
MOVE R0, @R1
; Reset hardware cursor address
MOVE VGA$CR_X, R1 ; Store it in VGA$CR_X
MOVE R0, @R1 ; ...and let the hardware know
MOVE _VGA$Y, R1
MOVE R0, @R1 ; The same with Y...
; Reset scrolling registers
MOVE VGA$OFFS_DISPLAY, R1
MOVE R0, @R1
MOVE VGA$OFFS_RW, R1
MOVE R0, @R1
; Actually clear screen (and all screen pages in the video RAM)
MOVE VGA$STATE, R0
OR VGA$CLR_SCRN, @R0
; Wait until screen is cleared
_VGA$CLS_WAIT MOVE @R0, R1
AND VGA$CLR_SCRN, R1
RBRA _VGA$CLS_WAIT, !Z
DECRB
RET
|
src/util-beans-objects-enums.ads | Letractively/ada-util | 60 | 4612 | -----------------------------------------------------------------------
-- Util.Beans.Objects.Enums -- Helper conversion for discrete types
-- Copyright (C) 2010 <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.
-----------------------------------------------------------------------
generic
type T is (<>);
-- When True, round the integer value held by the object before
-- converting it into the type T.
ROUND_VALUE : Boolean := False;
package Util.Beans.Objects.Enums is
-- Create an object from the given value.
function To_Object (Value : in T) return Object;
-- Convert the object into a value.
-- Raises Constraint_Error if the object cannot be converter to the target type.
function To_Value (Value : in Util.Beans.Objects.Object) return T;
end Util.Beans.Objects.Enums;
|
dv3/fd/rsect.asm | olifink/smsqe | 0 | 7689 | <reponame>olifink/smsqe
; DV3 Standard Floppy Disk Read Sector 1998 <NAME>
section dv3
xdef fd_rdirect ; direct sector read
xdef fd_rsint ; read sector (internal)
xdef fd_ckroot ; internal check root sector
xdef fd_rroot ; internal read root sector
xref fd_hold ; reserve the controller
xref fd_release ; release the controller
xref fd_ckrw ; read root sector and check
xref fd_seek ; seek to track
xref fd_rphys ; read sector (physical)
xref fd_reseek ; re-seek after error
xref fd_reseek0 ; recalibrate with error recovery
xref dv3_slen ; set sector length
include 'dev8_keys_sys'
include 'dev8_keys_err'
include 'dev8_keys_qlhw'
include 'dev8_dv3_keys'
include 'dev8_dv3_fd_keys'
include 'dev8_mac_assert'
;+++
; This routine read sectors from a Floppy disk for direct sector IO
;
; d0 cr cylinder + side + sector / error code
; d2 c p number of sectors
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.NC or ERR.MCHK
;
;---
fd_rdirect
jsr fd_hold ; hold and select
beq.s fdr_doread
rts
;+++
; This routine reads sectors from a Floppy disk for internal operations
;
; d0 cr cylinder + side + sector / error code
; d2 c p number of sectors
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.NC or ERR.MCHK
;
;---
fd_rsint
jsr fd_hold ; hold and select
bne.s fdr_rts
btst d7,fdl_stpb(a3) ; drive stopped?
bne.s fdr_doread ; ... no
jsr fd_ckrw ; check disk not changed
bne.s fdr_done
fdr_doread
bsr.s fdr_reads ; read with seek error recovery
fdr_done
jmp fd_release ; ... let it go
;+++
; This routine reads the root sector to check for new medium
;
; d0 r error code
; d2 s
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.NC or ERR.MCHK
;
;---
fd_rroot
jsr fd_hold ; hold and select
bne.s fdr_rts
tst.b ddf_lock(a4) ; locked?
beq.s fdrr_new ; ... no, could be new medium
bsr.s fd_ckroot ; ... yes, do not change density
bra.s fdr_done
fdrr_new
moveq #1,d2 ; number of sectors
move.l d2,fdl_sadd(a3) ; ... and the root sector number!
st fdl_ridd(a3) ; retry read ID with different densities
jsr fd_reseek0 ; find track 0 and density
sf fdl_ridd(a3)
bne.s fdr_done ; bad
move.b fdf_slen(a4),ddf_slflag(a4) ; set sector length flag
jsr dv3_slen
bsr.s fdr_readn ; read with read error recovery
ble.s fdr_done ; ... OK or bad medium
pea fdr_done
bra.s fdr_readn ; try again
;+++
; Check root sector (from fd_ckwr called from within read / write sector)
;
; d0 r error code
; d2 s
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0 or ERR.MCHK
;
;---
fd_ckroot
moveq #1,d0
moveq #1,d2 ; one sector only
;+++
; Read sector with seek error recovery
;
; d0 cr sector to read / error code
; d2 cp number of sectors to read
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0 or ERR.MCHK
;
;---
fdr_reads
move.l d0,fdl_sadd(a3) ; sector required
bsr.s fdr_read ; read sector
ble.s fdr_rts ; ... OK or bad medium
jsr fd_reseek ; re-seek
bne.s fdr_mchk ; ... bad medium
bsr.s fdr_readn ; re-read
beq.s fdr_rts ; OK
fdr_mchk
moveq #err.mchk,d0
fdr_rts
rts
;+++
; (Seek and) read sector with read error recovery
;
; d0 r error code
; d2 cp number of sectors to read
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.MCHK or positive conventional status return
;
;---
fdr_read
move.b fdl_trak(a3),d0 ; track required
cmp.b fdf_ctrk(a4),d0 ; the right track?
beq.s fdr_readn ; ... yes
jsr fd_seek ; ... no, seek
;+++
; Read sector (no seek) with read error recovery
;
; d0 r error code
; d2 cp number of sectors to read
; d7 c p drive ID / number
; a1 c p address to read into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.MCHK or positive conventional status return
;
;---
fdr_readn
fdr_try1
jsr fd_rphys ; physical read sector
ble.s fdr_rts
assert fdcs.orun,fdcs.derr-1,fdcs.seke-2,fdcs.nadd-3
cmp.b #fdcs.derr,d0
blt.s fdr_try1 ; always retry overrun
bgt.s fdr_rts ; seek error or no address mark
fdr_try2 ; retry data error once
jsr fd_rphys ; physical read sector
ble.s fdr_rts
assert fdcs.orun,fdcs.derr-1,fdcs.seke-2,fdcs.nadd-3
cmp.b #fdcs.orun,d0
beq.s fdr_try2 ; always retry overrun
rts
end
|
antigo/ap1/grammars/Exp.g4 | natalisso/compilers-cin | 24 | 332 | grammar Exp;
s : e;
e : e '*' e
| e '+' e
| INT
;
INT : [0-9]+;
WS : [ \t\r\n]+ -> skip; |
src/ada/src/services/atbb/assignment_tree_branch_bound.ads | VVCAS-Sean/OpenUxAS | 88 | 28157 | with Ada.Containers.Formal_Hashed_Maps;
with Ada.Containers.Functional_Maps;
with Ada.Containers; use Ada.Containers;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Assignment_Tree_Branch_Bound_Communication; use Assignment_Tree_Branch_Bound_Communication;
with Common; use Common;
with LMCP_Messages; use LMCP_Messages;
package Assignment_Tree_Branch_Bound with SPARK_Mode is
type Cost_Function_Kind is (Minmax, Cumulative);
package Int64_UAR_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => UniqueAutomationRequest,
Hash => Int64_Hash);
subtype Int64_UniqueAutomationRequest_Map is
Int64_UAR_Maps.Map (10, Int64_UAR_Maps.Default_Modulus (10));
use Int64_UAR_Maps;
package Int64_TaskPlanOptions_Maps is new Ada.Containers.Functional_Maps
(Key_Type => Int64,
Element_Type => TaskPlanOptions);
type Int64_TPO_Map is new Int64_TaskPlanOptions_Maps.Map;
package Int64_TPO_Map_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => Int64_TPO_Map,
Hash => Int64_Hash);
subtype Int64_TaskPlanOptions_Map_Map is
Int64_TPO_Map_Maps.Map (10, Int64_TPO_Map_Maps.Default_Modulus (10));
use Int64_TPO_Map_Maps;
use Int64_TPO_Map_Maps.Formal_Model;
package Int64_TaskPlanOptions_Map_Maps_P renames Int64_TPO_Map_Maps.Formal_Model.P;
package Int64_TaskPlanOptions_Map_Maps_K renames Int64_TPO_Map_Maps.Formal_Model.K;
package Int64_ACM_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => AssignmentCostMatrix,
Hash => Int64_Hash);
subtype Int64_AssignmentCostMatrix_Map is
Int64_ACM_Maps.Map (10, Int64_ACM_Maps.Default_Modulus (10));
use Int64_ACM_Maps;
use Int64_ACM_Maps.Formal_Model;
package Int64_AssignmentCostMatrix_Maps_P renames Int64_ACM_Maps.Formal_Model.P;
package Int64_AssignmentCostMatrix_Maps_K renames Int64_ACM_Maps.Formal_Model.K;
----------------------------
-- Annotation subprograms --
----------------------------
function Valid_TaskPlanOptions
(TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean;
function Valid_AssignmentCostMatrix
(Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean;
function Travel_In_CostMatrix
(VehicleId : Int64;
DestOption : TaskOption;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean;
function Travel_In_CostMatrix
(VehicleId : Int64;
InitOption, DestOption : TaskOption;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean;
function All_Travels_In_CostMatrix
(Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map;
Matrix : AssignmentCostMatrix)
return Boolean;
function All_EligibleEntities_In_EntityList
(Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean;
----------------------------------------
-- Assignment Tree Branch Bound types --
----------------------------------------
type Assignment_Tree_Branch_Bound_Configuration_Data is record
Cost_Function : Cost_Function_Kind := Minmax;
Number_Nodes_Maximum : Int64 := 0;
end record
with Predicate => Number_Nodes_Maximum >= 0;
type Assignment_Tree_Branch_Bound_State is record
m_uniqueAutomationRequests : Int64_UniqueAutomationRequest_Map;
m_taskPlanOptions : Int64_TaskPlanOptions_Map_Map;
m_assignmentCostMatrixes : Int64_AssignmentCostMatrix_Map;
end record with
Predicate =>
(for all ReqId of m_taskPlanOptions =>
(Valid_TaskPlanOptions (Element (m_taskPlanOptions, ReqId))
and then
Contains (m_uniqueAutomationRequests, ReqId)
and then
All_EligibleEntities_In_EntityList
(Element (m_uniqueAutomationRequests, ReqId),
Element (m_taskPlanOptions, ReqId))))
and then
(for all ReqId of m_assignmentCostMatrixes =>
Valid_AssignmentCostMatrix (Element (m_assignmentCostMatrixes, ReqId))
and then
Contains (m_uniqueAutomationRequests, ReqId)
and then
Contains (m_taskPlanOptions, ReqId)
and then
All_Travels_In_CostMatrix
(Element (m_uniqueAutomationRequests, ReqId),
Element (m_taskPlanOptions, ReqId),
Element (m_assignmentCostMatrixes, ReqId)));
---------------------------
-- Service functionality --
---------------------------
procedure Handle_Unique_Automation_Request
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Areq : UniqueAutomationRequest)
with
Pre =>
not Contains (State.m_uniqueAutomationRequests, Areq.RequestID)
and then
not Contains (State.m_assignmentCostMatrixes, Areq.RequestID);
procedure Handle_Task_Plan_Options
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Options : TaskPlanOptions)
with
Pre =>
(for all TaskOption of Options.Options =>
(TaskOption.Cost >= 0 and then Options.TaskID = TaskOption.TaskID))
and then not Contains (State.m_assignmentCostMatrixes, Options.CorrespondingAutomationRequestID)
and then
(not Contains (State.m_taskPlanOptions, Options.CorrespondingAutomationRequestID)
or else
not Has_Key (Element (State.m_taskPlanOptions, Options.CorrespondingAutomationRequestID), Options.TaskID))
and then Contains (State.m_uniqueAutomationRequests, Options.CorrespondingAutomationRequestID)
and then
(for all Option of Options.Options =>
(for all EntityId of Option.EligibleEntities =>
Contains (Element (State.m_uniqueAutomationRequests, Options.CorrespondingAutomationRequestID).EntityList,
TO_Sequences.First,
Last (Element (State.m_uniqueAutomationRequests, Options.CorrespondingAutomationRequestID).EntityList),
EntityId)));
procedure Handle_Assignment_Cost_Matrix
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Matrix : AssignmentCostMatrix)
with Pre =>
not Contains (State.m_assignmentCostMatrixes, Matrix.CorrespondingAutomationRequestID)
and then Valid_AssignmentCostMatrix (Matrix)
and then Contains (State.m_uniqueAutomationRequests, Matrix.CorrespondingAutomationRequestID)
and then Contains (State.m_taskPlanOptions, Matrix.CorrespondingAutomationRequestID)
and then All_Travels_In_CostMatrix (Element (State.m_uniqueAutomationRequests, Matrix.CorrespondingAutomationRequestID),
Element (State.m_taskPlanOptions, Matrix.CorrespondingAutomationRequestID),
Matrix);
procedure Check_Assignment_Ready
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
ReqId : Int64);
procedure Send_TaskAssignmentSummary
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
ReqId : Int64)
with
Pre =>
Contains (State.m_uniqueAutomationRequests, ReqId)
and then Contains (State.m_assignmentCostMatrixes, ReqId)
and then Contains (State.m_taskPlanOptions, ReqId)
and then
(for all TaskId of Element (State.m_uniqueAutomationRequests, ReqId).TaskList =>
Has_Key (Element (State.m_taskPlanOptions, ReqId), TaskId))
and then
Valid_TaskPlanOptions (Element (State.m_taskPlanOptions, ReqId));
procedure Run_Calculate_Assignment
(Data : Assignment_Tree_Branch_Bound_Configuration_Data;
Automation_Request : UniqueAutomationRequest;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map;
Summary : out TaskAssignmentSummary;
Error : out Boolean;
Message : out Unbounded_String)
with
Pre =>
Valid_AssignmentCostMatrix (Assignment_Cost_Matrix)
and then
Valid_TaskPlanOptions (TaskPlanOptions_Map)
and then
(for all TaskId of Automation_Request.TaskList =>
Has_Key (TaskPlanOptions_Map, TaskId))
and then
(for all Id of TaskPlanOptions_Map =>
(for all TaskOption of Get (TaskPlanOptions_Map, Id).Options => TaskOption.TaskID = Id))
and then
All_Travels_In_CostMatrix (Automation_Request, TaskPlanOptions_Map, Assignment_Cost_Matrix)
and then
All_EligibleEntities_In_EntityList (Automation_Request, TaskPlanOptions_Map);
-- Returns the assignment that minimizes the cost.
private
function Valid_TaskPlanOptions
(TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
is
(for all TaskId of TaskPlanOptions_Map =>
(TaskId in 0 .. 99_999
and then
TaskId = Get (TaskPlanOptions_Map, TaskId).TaskID
and then
(for all TaskOption of Get (TaskPlanOptions_Map, TaskId).Options =>
(TaskId = TaskOption.TaskID
and then TaskOption.OptionID in 0 .. 99_999
and then TaskOption.Cost >= 0))));
function Valid_AssignmentCostMatrix
(Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean
is
(for all TOC of Assignment_Cost_Matrix.CostMatrix => TOC.TimeToGo >= 0);
function Travel_In_CostMatrix
(VehicleId : Int64;
DestOption : TaskOption;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean
is
(for some TOC of Assignment_Cost_Matrix.CostMatrix =>
(VehicleId = TOC.VehicleID
and then 0 = TOC.InitialTaskID
and then 0 = TOC.InitialTaskOption
and then DestOption.TaskID = TOC.DestinationTaskID
and then DestOption.OptionID = TOC.DestinationTaskOption));
function Travel_In_CostMatrix
(VehicleId : Int64;
InitOption, DestOption : TaskOption;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean
is
(for some TOC of Assignment_Cost_Matrix.CostMatrix =>
(VehicleId = TOC.VehicleID
and then InitOption.TaskID = TOC.InitialTaskID
and then InitOption.OptionID = TOC.InitialTaskOption
and then DestOption.TaskID = TOC.DestinationTaskID
and then DestOption.OptionID = TOC.DestinationTaskOption));
function Is_Eligible (Request : UniqueAutomationRequest; Option : TaskOption; VehicleId : Int64) return Boolean is
(Contains (Request.EntityList, TO_Sequences.First, Last (Request.EntityList), VehicleId)
and then
(if Length (Option.EligibleEntities) > 0 then Contains (Option.EligibleEntities, TO_Sequences.First, Last (Option.EligibleEntities), VehicleId)));
function All_Travels_In_CostMatrix
(Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map;
Matrix : AssignmentCostMatrix)
return Boolean
is
(for all VehicleId of Request.EntityList =>
(for all TaskId_1 of TaskPlanOptions_Map =>
(for all Option_1 of Get (TaskPlanOptions_Map, TaskId_1).Options =>
(if Is_Eligible (Request, Option_1, VehicleId)
then
Travel_In_CostMatrix (VehicleId, Option_1, Matrix)
and then
(for all TaskId_2 of TaskPlanOptions_Map =>
(for all Option_2 of Get (TaskPlanOptions_Map, TaskId_2).Options =>
(if Option_1 /= Option_2 and then Is_Eligible (Request, Option_2, VehicleId)
then
Travel_In_CostMatrix (VehicleId,
Option_1,
Option_2,
Matrix))))))));
function All_EligibleEntities_In_EntityList
(Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
is
(for all TaskId of TaskPlanOptions_Map =>
(for all Option of Get (TaskPlanOptions_Map, TaskId).Options =>
(for all EntityId of Option.EligibleEntities =>
Contains (Request.EntityList, TO_Sequences.First, Last (Request.EntityList), EntityId))));
end Assignment_Tree_Branch_Bound;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1986.asm | ljhsiun2/medusa | 9 | 165686 | <filename>Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1986.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
// Store
lea addresses_D+0x1f29, %rcx
clflush (%rcx)
and $37960, %r13
movw $0x5152, (%rcx)
nop
nop
nop
nop
xor %r13, %r13
// Load
lea addresses_WC+0xfb29, %r9
nop
nop
nop
nop
nop
and %r12, %r12
mov (%r9), %rdi
nop
inc %r12
// Faulty Load
lea addresses_WC+0x10b29, %rbx
clflush (%rbx)
nop
nop
nop
nop
cmp %r8, %r8
movaps (%rbx), %xmm3
vpextrq $0, %xmm3, %r9
lea oracles, %rcx
and $0xff, %r9
shlq $12, %r9
mov (%rcx,%r9,1), %r9
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'AVXalign': True, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/034/A034699.asm | neoneye/loda-programs | 11 | 164327 | <reponame>neoneye/loda-programs
; A034699: Largest prime power factor of n.
; Submitted by <NAME>
; 1,2,3,4,5,3,7,8,9,5,11,4,13,7,5,16,17,9,19,5,7,11,23,8,25,13,27,7,29,5,31,32,11,17,7,9,37,19,13,8,41,7,43,11,9,23,47,16,49,25,17,13,53,27,11,8,19,29,59,5,61,31,9,64,13,11,67,17,23,7,71,9,73,37,25,19,11,13,79,16,81,41,83,7,17,43,29,11,89,9,13,23,31,47,19,32,97,49,11,25
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
mov $4,$0
sub $0,1
mul $4,4
lpb $4
pow $3,$4
gcd $2,$3
mod $4,1
lpe
lpe
mov $0,$2
|
programs/oeis/037/A037547.asm | karttu/loda | 1 | 93580 | ; A037547: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,2.
; 1,8,50,301,1808,10850,65101,390608,2343650,14061901,84371408,506228450,3037370701,18224224208,109345345250,656072071501,3936432429008,23618594574050,141711567444301,850269404665808,5101616427994850
cal $0,33142 ; Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,0.
mul $0,25
div $0,18
mov $1,$0
|
tests/tcl-strings-test_data-tests.adb | thindil/tashy2 | 2 | 29316 | -- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Tcl.Strings.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
-- begin read only
-- end read only
package body Tcl.Strings.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
function Wrap_Test_To_Tcl_String_05e111_cc0b40
(Source: String; Evaluate: Boolean := False) return Tcl_String is
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tcl-strings.ads:0):Test_To_Tcl_String test requirement violated");
end;
declare
Test_To_Tcl_String_05e111_cc0b40_Result: constant Tcl_String :=
GNATtest_Generated.GNATtest_Standard.Tcl.Strings.To_Tcl_String
(Source, Evaluate);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tcl-strings.ads:0:):Test_To_Tcl_String test commitment violated");
end;
return Test_To_Tcl_String_05e111_cc0b40_Result;
end;
end Wrap_Test_To_Tcl_String_05e111_cc0b40;
-- end read only
-- begin read only
procedure Test_To_Tcl_String_test_to_tcl_string(Gnattest_T: in out Test);
procedure Test_To_Tcl_String_05e111_cc0b40(Gnattest_T: in out Test) renames
Test_To_Tcl_String_test_to_tcl_string;
-- id:2.2/05e11147f5a156d7/To_Tcl_String/1/0/test_to_tcl_string/
procedure Test_To_Tcl_String_test_to_tcl_string(Gnattest_T: in out Test) is
function To_Tcl_String
(Source: String; Evaluate: Boolean := False) return Tcl_String renames
Wrap_Test_To_Tcl_String_05e111_cc0b40;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
Assert
(To_String(To_Tcl_String("test literal")) = "{test literal}",
"Failed to create literal string.");
Assert
(To_String(To_Tcl_String("test evaluate", True)) = """test evaluate""",
"Failed to create evaluation string.");
-- begin read only
end Test_To_Tcl_String_test_to_tcl_string;
-- end read only
-- begin read only
function Wrap_Test_To_Ada_String_9fab6f_7961da
(Source: Tcl_String) return String is
begin
declare
Test_To_Ada_String_9fab6f_7961da_Result: constant String :=
GNATtest_Generated.GNATtest_Standard.Tcl.Strings.To_Ada_String
(Source);
begin
return Test_To_Ada_String_9fab6f_7961da_Result;
end;
end Wrap_Test_To_Ada_String_9fab6f_7961da;
-- end read only
-- begin read only
procedure Test_To_Ada_String_test_to_ada_string(Gnattest_T: in out Test);
procedure Test_To_Ada_String_9fab6f_7961da(Gnattest_T: in out Test) renames
Test_To_Ada_String_test_to_ada_string;
-- id:2.2/9fab6f9320249ad5/To_Ada_String/1/0/test_to_ada_string/
procedure Test_To_Ada_String_test_to_ada_string(Gnattest_T: in out Test) is
function To_Ada_String(Source: Tcl_String) return String renames
Wrap_Test_To_Ada_String_9fab6f_7961da;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
Assert
(To_Ada_String(To_Tcl_String("test evaluate")) = "test evaluate",
"Failed to convert Tcl_String to Ada String.");
Assert
(To_Ada_String(To_Tcl_String("")) = "",
"Failed to convert empty Tcl_String to Ada String");
-- begin read only
end Test_To_Ada_String_test_to_ada_string;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Tcl.Strings.Test_Data.Tests;
|
src/ctree_d.asm | mdennehy/PICRat | 0 | 100897 | <filename>src/ctree_d.asm
;--------------------LIBRARY SPECIFICATION-------------------
;
; NAME : CTree_D.asm
;
; FUNCTIONS : Digital Command Tree
;
; NOTES :
;
;------------------------------------------------------------
; REVISION HISTORY :
; 9/1/98 First Draft
;
;------------------------------------------------------------
ERRORLEVEL 0
PROCESSOR PIC16C74A
LIST b=4
TITLE "Demonstration PICRAT program"
SUBTITLE "Version 1.00"
include <p16c74a.inc>
;--------------------ROUTINE SPECIFICATION-------------------
;
; NAME : DigitalRoot
;
; FUNCTION : Root of Digital Command Tree
;
; NOTES :
;
;------------------------------------------------------------
; REVISION HISTORY :
;
;------------------------------------------------------------
DigitalData UDATA
Digital_DisplayFormat RES 1
Digital_DataFormat RES 1
Digital_Data RES 1
Digital_LineNo RES 1
Digital_PortNo RES 1
tmp RES 1
tmp2 RES 1
tmp3 RES 1
GLOBAL Digital_DisplayFormat
GLOBAL Digital_DataFormat
GLOBAL Digital_Data
GLOBAL Digital_LineNo
GLOBAL Digital_PortNo
;------------------------------------------------------------
DigitalRoot CODE
DigitalRoot
GLOBAL DigitalRoot
EXTERN USART_getc
EXTERN USART_putc
EXTERN USART_putHexByte
EXTERN USART_putHexNybble
EXTERN MainLoop
movlw 0x00
BANKSEL Digital_DisplayFormat
movwf Digital_DisplayFormat
BANKSEL Digital_DataFormat
movwf Digital_DataFormat
BANKSEL Digital_Data
movwf Digital_Data
BANKSEL Digital_PortNo
movwf Digital_PortNo
movlw 0xFF
BANKSEL Digital_LineNo
movwf Digital_LineNo
PAGESEL USART_putc
movlw A'D'
call USART_putc
movlw A'R'
call USART_putc
movlw A'\r'
call USART_putc
movlw A'\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalNode_D1
movf tmp,w
xorlw A'r'
btfsc STATUS,Z
goto DigitalNode_D1
xorlw A'r'
xorlw A'w'
btfsc STATUS,Z
goto DigitalNode_D8
xorlw A'w'
xorlw A's'
btfsc STATUS,Z
goto DigitalNode_D16
xorlw A's'
xorlw A'c'
btfsc STATUS,Z
goto DigitalNode_D22
xorlw A'c'
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D1
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
BANKSEL Digital_DisplayFormat
movwf Digital_DisplayFormat
xorlw A'd'
btfsc STATUS,Z
goto DigitalNode_D2
xorlw A'd'
xorlw A'h'
btfsc STATUS,Z
goto DigitalNode_D2
xorlw A'h'
xorlw A'b'
btfsc STATUS,Z
goto DigitalNode_D2
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D2
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'p'
btfsc STATUS,Z
goto DigitalNode_D3
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D3
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '3'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..1
BANKSEL Digital_PortNo
movwf Digital_PortNo
andlw H'FE'
btfsc STATUS,Z
goto DigitalNode_D4
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D4
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '4'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'l'
btfsc STATUS,Z
goto DigitalNode_D6
xorlw A'l'
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D5
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D5
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '5'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL DigitalRoot
BANKSEL Digital_PortNo
movf Digital_PortNo,F
btfss STATUS,Z
goto D5_1
;read port 0 (B)
BANKSEL PORTB
movf PORTB,W
BANKSEL tmp
movwf tmp
goto D5_2
D5_1
;read port 1 (D and E)
BANKSEL PORTE
movf PORTE,W
BANKSEL tmp
movwf tmp
BANKSEL PORTD
movf PORTD,W
andlw H'80'
swapf W,W
BANKSEL tmp
iorwf tmp,F
D5_2
movlw H'01'
BANKSEL Digital_LineNo
addwf Digital_LineNo,F
btfsc STATUS,Z
goto D5_4
clrw
bsf STATUS,C
D5_3
rlf W,W
decfsz Digital_LineNo,F
goto D5_3
D5_4
BANKSEL tmp
iorwf tmp,F
clrw
BANKSEL Digital_DisplayFormat
movf Digital_DisplayFormat,W
xorlw 'h'
btfsc STATUS,Z
goto D5_5
xorlw 'h'
xorlw 'd'
btfsc STATUS,Z
goto D5_6
xorlw 'd'
xorlw 'b'
btfsc STATUS,Z
goto D5_7
goto D5_8
D5_5 ;Hex Display
PAGESEL USART_putc
movlw '0'
call USART_putc
movlw 'x'
call USART_putc
BANKSEL tmp
movf tmp,w
call USART_putHexByte
PAGESEL D5_8
goto D5_8
D5_6 ;Decimal Display
BANKSEL tmp2
clrf tmp2
movlw 0x64
D5_6a
BANKSEL tmp
subwf tmp,F
btfss STATUS,C
goto D5_6b
BANKSEL tmp2
incf tmp2,F
goto D5_6a
D5_6b
BANKSEL tmp
addwf tmp,F
movlw 0x30
BANKSEL tmp2
addwf tmp2,F
PAGESEL USART_putc
movf tmp2,W
call USART_putc
PAGESEL DigitalRoot
BANKSEL tmp2
clrf tmp2
movlw 0x0A
D5_6c
BANKSEL tmp
subwf tmp,F
btfss STATUS,C
goto D5_6d
BANKSEL tmp2
incf tmp2,F
goto D5_6c
D5_6d
BANKSEL tmp
addwf tmp,F
movlw 0x30
BANKSEL tmp2
addwf tmp2,F
PAGESEL USART_putc
movf tmp2,W
call USART_putc
BANKSEL tmp
movf tmp,W
addlw 0x30
call USART_putc
PAGESEL D5_8
goto D5_8
D5_7 ;Binary Display
movlw D'08'
movwf tmp2
D5_7a
rlf tmp,F
btfsc STATUS,C
goto D5_7b
PAGESEL USART_putc
movlw A'0'
call USART_putc
PAGESEL DigitalRoot
BANKSEL tmp2
decfsz tmp2,F
goto D5_7a
goto D5_8
D5_7b
PAGESEL USART_putc
movlw A'1'
call USART_putc
PAGESEL DigitalRoot
BANKSEL tmp2
decfsz tmp2,F
goto D5_7a
D5_8 ;End of command
PAGESEL USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D6
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '6'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..7
BANKSEL Digital_LineNo
movwf Digital_LineNo
andlw H'F8'
btfsc STATUS,Z
goto DigitalNode_D7
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D7
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '7'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D5
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D8
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '8'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
BANKSEL Digital_DataFormat
movwf Digital_DataFormat
xorlw A'd'
btfsc STATUS,Z
goto DigitalNode_D9
xorlw A'd'
xorlw A'h'
btfsc STATUS,Z
goto DigitalNode_D9
xorlw A'h'
xorlw A'b'
btfsc STATUS,Z
goto DigitalNode_D9
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D9
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '9'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'p'
btfsc STATUS,Z
goto DigitalNode_D10
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D10
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '0'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..1
BANKSEL Digital_PortNo
movwf Digital_PortNo
andlw H'FE'
btfsc STATUS,Z
goto DigitalNode_D11
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D11
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '1'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A':'
btfss STATUS,Z
goto DigitalNode_D11_err
BANKSEL Digital_DataFormat
movf Digital_DataFormat,W
xorlw A'd'
btfsc STATUS,Z
goto DigitalNode_D12
xorlw A'd'
xorlw A'h'
btfsc STATUS,Z
goto DigitalNode_D13
xorlw A'h'
xorlw A'b'
btfsc STATUS,Z
goto DigitalNode_D14
DigitalNode_D11_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D12
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '2'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..2
movwf tmp
andlw H'FC'
btfss STATUS,Z
goto DigitalNode_D12_err
movf tmp,F
btfsc STATUS,Z
goto D12_loop_2
D12_loop_1
movlw H'64'
BANKSEL Digital_Data
addwf Digital_Data,F
decfsz tmp,F
goto D12_loop_1
D12_loop_2
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..9
movwf tmp
andlw H'F0'
btfss STATUS,Z
goto DigitalNode_D12_err
movf tmp,F
btfsc STATUS,Z
goto D12_loop_4
movlw D'10'
D12_loop_3
BANKSEL Digital_Data
addwf Digital_Data,F
decfsz tmp,F
goto D12_loop_3
D12_loop_4
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..9
movwf tmp
andlw H'F0'
btfss STATUS,Z
goto DigitalNode_D12_err
movf tmp,W
BANKSEL Digital_Data
addwf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D15
DigitalNode_D12_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D13
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '3'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw H'C6'
addlw H'0A'
btfsc STATUS,C
goto D13_1
addlw H'C9'
addlw H'06'
btfsc STATUS,C
goto D13_0b
goto DigitalNode_D13_err
D13_0b
addlw 0x0A
D13_1
BANKSEL Digital_Data
movwf Digital_Data
swapf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw H'C6'
addlw H'0A'
btfsc STATUS,C
goto D13_2
addlw H'C9'
addlw H'06'
btfsc STATUS,C
goto D13_1b
goto DigitalNode_D13_err
D13_1b
addlw 0x0A
D13_2
BANKSEL Digital_Data
addwf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D15
DigitalNode_D13_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D14
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '4'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw 0x08
BANKSEL tmp2
movwf tmp2
D14_loop_1
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -0x30 ;If a number from 0..1
BANKSEL Digital_Data
bcf STATUS,C
rlf Digital_Data,F
addwf Digital_Data,F
andlw H'FE'
btfss STATUS,Z
goto DigitalNode_D14_err
BANKSEL tmp2
decfsz tmp2,F
goto D14_loop_1
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D15
DigitalNode_D14_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D15
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '5'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL DigitalRoot
movlw 0x01
addwf Digital_LineNo,W
btfss STATUS,C
goto D15_2
movf Digital_Data,W
andlw 0x01
D15_1
decfsz Digital_LineNo,F
goto D15_1b
goto D15_2
D15_1b
rlf W,W
goto D15_1
D15_2
movf Digital_PortNo,F
btfss STATUS,Z
goto D15_3
BANKSEL Digital_Data
movf Digital_Data,W
BANKSEL PORTB
movwf PORTB
goto D15_4
D15_3
movf Digital_Data,W
andlw 0x07
movwf PORTE
movf Digital_Data,W
andlw 0x08
btfsc STATUS,Z
goto D15_3b
bsf PORTD,7
goto D15_4
D15_3b
bcf PORTD,7
D15_4
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D16
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '6'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'p'
btfsc STATUS,Z
goto DigitalNode_D17
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D17
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '7'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..1
BANKSEL Digital_PortNo
movwf Digital_PortNo
andlw H'FE'
btfsc STATUS,Z
goto DigitalNode_D18
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D18
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '8'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'l'
btfsc STATUS,Z
goto DigitalNode_D20
xorlw A'l'
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D19
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D19
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '1'
call USART_putc
movlw '9'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL DigitalRoot
movf Digital_PortNo,F
btfss STATUS,Z
goto D19_
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D20
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '0'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..7
BANKSEL Digital_LineNo
movwf Digital_LineNo
andlw H'F8'
btfsc STATUS,Z
goto DigitalNode_D21
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D21
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '1'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D19
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D22
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '2'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
BANKSEL Digital_DataFormat
movwf Digital_DataFormat
xorlw A'd'
btfsc STATUS,Z
goto DigitalNode_D23
xorlw A'd'
xorlw A'h'
btfsc STATUS,Z
goto DigitalNode_D23
xorlw A'h'
xorlw A'b'
btfsc STATUS,Z
goto DigitalNode_D23
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D23
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '3'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'p'
btfsc STATUS,Z
goto DigitalNode_D24
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D24
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '4'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..1
BANKSEL Digital_PortNo
movwf Digital_PortNo
andlw H'FE'
btfsc STATUS,Z
goto DigitalNode_D25
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D25
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '5'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A':'
btfss STATUS,Z
goto DigitalNode_D25_err
BANKSEL Digital_DataFormat
movf Digital_DataFormat,W
xorlw A'd'
btfsc STATUS,Z
goto DigitalNode_D26
xorlw A'd'
xorlw A'h'
btfsc STATUS,Z
goto DigitalNode_D27
xorlw A'h'
xorlw A'b'
btfsc STATUS,Z
goto DigitalNode_D28
DigitalNode_D25_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D26
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '6'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..2
movwf tmp
andlw H'FC'
btfss STATUS,Z
goto DigitalNode_D26_err
movf tmp,F
btfsc STATUS,Z
goto D26_loop_2
D26_loop_1
movlw H'64'
BANKSEL Digital_Data
addwf Digital_Data,F
decfsz tmp,F
goto D26_loop_1
D26_loop_2
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..9
movwf tmp
andlw H'F0'
btfss STATUS,Z
goto DigitalNode_D26_err
movf tmp,F
btfsc STATUS,Z
goto D26_loop_4
movlw D'10'
D26_loop_3
BANKSEL Digital_Data
addwf Digital_Data,F
decfsz tmp,F
goto D26_loop_3
D26_loop_4
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..9
movwf tmp
andlw H'F0'
btfss STATUS,Z
goto DigitalNode_D26_err
movf tmp,W
BANKSEL Digital_Data
addwf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D29
DigitalNode_D26_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D27
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '7'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw H'C6'
addlw H'0A'
btfsc STATUS,C
goto D27_1
addlw H'C9'
addlw H'06'
btfsc STATUS,C
goto D27_1
goto DigitalNode_D27_err
D27_1
BANKSEL Digital_Data
movwf Digital_Data
swapf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw H'C6'
addlw H'0A'
btfsc STATUS,C
goto D27_2
addlw H'C9'
addlw H'06'
btfsc STATUS,C
goto D27_2
goto DigitalNode_D27_err
D27_2
BANKSEL Digital_Data
addwf Digital_Data,F
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D29
DigitalNode_D27_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D28
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '8'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw 08
BANKSEL tmp2
movwf tmp2
D28_loop_1
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
addlw -30 ;If a number from 0..1
BANKSEL tmp
rlf tmp,F
addwf tmp,F
andlw H'FE'
btfss STATUS,Z
goto DigitalNode_D28_err
BANKSEL tmp2
decfsz tmp2,F
goto D28_loop_1
PAGESEL USART_getc
call USART_getc
BANKSEL tmp
movwf tmp
PAGESEL DigitalRoot
movf tmp,W
xorlw A'\r'
btfsc STATUS,Z
goto DigitalNode_D29
DigitalNode_D28_err
PAGESEL USART_putc
movlw '*'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
DigitalNode_D29
PAGESEL USART_putc
movlw 'D'
call USART_putc
movlw '2'
call USART_putc
movlw '9'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
movlw '\r'
call USART_putc
movlw '\n'
call USART_putc
PAGESEL MainLoop
goto MainLoop
;------------------------------------------------------------
END
|
Exemplos ADA/BuscaBinaria/BuscaBinaria.adb | wildeee/safADA | 0 | 24442 | With Ada.Text_IO; Use Ada.Text_IO;
Procedure BuscaBinaria is
numeros: array(1..15) of Integer;
target : Integer;
L : Integer;
R : Integer;
mid : Integer;
found: Integer;
-- Leitura String
function Get_String return String is
Line : String (1 .. 1_000);
Last : Natural;
begin
Get_Line (Line, Last);
return Line (1 .. Last);
end Get_String;
-- Leitura Integer
function Get_Integer return Integer is
S : constant String := Get_String;
begin
return Integer'Value (S);
end Get_Integer;
-- Lê 15 elementos do array
procedure Faz_Leitura is
begin
for I in Integer range 1 .. 15 loop
numeros(I) := Get_Integer;
end loop;
end Faz_Leitura;
function binSearch return Integer is
begin
mid := (L + R) / 2;
if numeros(mid) < target then
L := mid + 1;
return binSearch;
end if;
if numeros(mid) > target then
R := mid - 1;
return binSearch;
end if;
return mid;
end binSearch;
begin
Faz_Leitura;
target := Get_Integer;
L := 1;
R := 15;
found := binSearch;
Put_Line(Integer'Image(found));
end BuscaBinaria; |
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1932.asm | ljhsiun2/medusa | 9 | 100154 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1932.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1425f, %rsi
lea addresses_WC_ht+0x2f5f, %rdi
clflush (%rdi)
nop
dec %r14
mov $79, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $14136, %r13
lea addresses_D_ht+0x36eb, %rsi
nop
nop
xor %r10, %r10
mov (%rsi), %r13w
nop
nop
nop
cmp $23563, %r13
lea addresses_normal_ht+0xe95f, %rdi
nop
sub %r14, %r14
movl $0x61626364, (%rdi)
nop
nop
nop
nop
xor $30431, %rdi
lea addresses_UC_ht+0x795f, %r14
nop
dec %r10
vmovups (%r14), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
add $18894, %rcx
lea addresses_UC_ht+0x1d55f, %rsi
lea addresses_WC_ht+0x19297, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $23208, %rbx
mov $49, %rcx
rep movsq
nop
nop
nop
nop
cmp $38044, %r14
lea addresses_WT_ht+0x37df, %rbx
nop
nop
nop
dec %r10
movl $0x61626364, (%rbx)
nop
nop
nop
xor $9337, %rbx
lea addresses_normal_ht+0x8185, %r13
nop
nop
nop
nop
xor %rbx, %rbx
mov (%r13), %si
nop
nop
add %r10, %r10
lea addresses_WC_ht+0x17d1f, %rsi
lea addresses_UC_ht+0x1d7db, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $59, %rcx
rep movsl
nop
nop
dec %rbx
lea addresses_D_ht+0x787b, %rsi
lea addresses_UC_ht+0x13572, %rdi
nop
nop
nop
nop
xor $60573, %r13
mov $41, %rcx
rep movsq
nop
nop
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x1b75f, %rsi
lea addresses_WC_ht+0x17f5f, %rdi
nop
nop
add $58558, %r10
mov $13, %rcx
rep movsl
inc %rsi
lea addresses_normal_ht+0x60bf, %rbx
sub %rcx, %rcx
mov $0x6162636465666768, %r13
movq %r13, (%rbx)
xor %rdx, %rdx
lea addresses_WT_ht+0x18d1f, %r14
nop
nop
sub $34109, %r13
movl $0x61626364, (%r14)
nop
cmp $64899, %r13
lea addresses_A_ht+0x705f, %rbx
nop
nop
inc %rcx
movw $0x6162, (%rbx)
nop
nop
nop
nop
nop
cmp $16221, %r13
lea addresses_normal_ht+0x1af1f, %rsi
lea addresses_UC_ht+0x86ff, %rdi
nop
add %rdx, %rdx
mov $57, %rcx
rep movsq
add $24603, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_D+0xaabf, %r14
nop
nop
nop
dec %r12
movl $0x51525354, (%r14)
nop
nop
nop
nop
xor $54930, %r12
// Load
lea addresses_normal+0x1f9df, %r14
nop
nop
nop
nop
and %r12, %r12
mov (%r14), %r11
nop
nop
nop
dec %r14
// Store
lea addresses_WT+0x701f, %r12
clflush (%r12)
nop
nop
dec %r10
mov $0x5152535455565758, %r11
movq %r11, %xmm6
movups %xmm6, (%r12)
mfence
// REPMOV
lea addresses_US+0xa197, %rsi
lea addresses_A+0x1fbdf, %rdi
nop
nop
nop
nop
nop
sub $47425, %r11
mov $3, %rcx
rep movsw
nop
nop
sub %r12, %r12
// Store
lea addresses_UC+0x14e8b, %r14
nop
nop
nop
nop
xor $38344, %rcx
mov $0x5152535455565758, %r12
movq %r12, %xmm4
vmovups %ymm4, (%r14)
nop
nop
nop
nop
nop
xor $24265, %rsi
// Store
lea addresses_US+0x1195f, %r12
cmp $10996, %r14
movl $0x51525354, (%r12)
nop
nop
sub %rdx, %rdx
// Store
lea addresses_D+0xaeef, %rcx
dec %rsi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm4
movups %xmm4, (%rcx)
nop
nop
nop
nop
nop
xor $2915, %r12
// Load
lea addresses_US+0x1195f, %rdi
nop
nop
nop
nop
xor $41843, %r14
mov (%rdi), %rdx
nop
nop
nop
nop
nop
xor %rdi, %rdi
// Store
lea addresses_PSE+0x1d546, %r11
nop
cmp $6841, %r12
movb $0x51, (%r11)
nop
nop
nop
nop
add $31089, %r14
// Faulty Load
lea addresses_US+0x1195f, %rdx
add %r11, %r11
movntdqa (%rdx), %xmm7
vpextrq $1, %xmm7, %rcx
lea oracles, %r11
and $0xff, %rcx
shlq $12, %rcx
mov (%r11,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_US', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 4, 'NT': True, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 8}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'47': 9, '40': 1, '44': 7103, '05': 5, '46': 1966, '08': 3, '00': 12733, '61': 2, 'c9': 1, '89': 1, '72': 1, 'ff': 4}
00 46 00 00 00 44 44 44 44 00 00 46 00 00 00 44 00 44 44 00 44 46 00 00 00 00 44 44 00 44 44 44 00 00 44 44 00 00 00 44 44 44 00 44 00 46 44 00 00 00 00 44 00 00 00 44 00 00 00 46 44 00 00 00 00 00 44 00 00 44 44 00 00 00 00 00 46 46 44 00 00 00 00 00 00 44 44 00 44 00 00 00 00 00 44 00 44 44 44 46 00 00 00 00 00 44 00 00 44 44 44 00 44 44 00 00 00 44 46 00 44 00 00 44 00 00 00 00 00 00 46 44 00 00 00 44 00 00 46 46 00 00 00 00 00 00 44 00 44 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 46 44 00 00 00 46 00 00 00 44 44 00 00 00 46 46 44 00 44 00 00 00 00 44 00 44 00 44 44 00 44 44 44 44 44 44 00 00 46 44 00 44 44 44 00 46 44 00 44 00 00 44 00 44 46 46 46 46 00 44 00 44 00 44 44 00 00 44 00 00 00 00 46 46 44 00 00 00 44 00 00 46 44 00 46 00 00 00 00 00 00 44 00 00 00 44 44 00 00 44 44 44 00 44 44 46 44 44 44 00 00 44 00 00 44 44 44 46 00 00 44 44 00 00 00 00 00 00 00 00 44 44 00 00 00 46 46 44 00 44 44 46 00 44 00 00 44 00 00 46 00 00 44 46 00 00 46 00 46 00 00 44 00 00 46 00 00 00 46 44 00 00 44 00 44 00 46 00 44 46 00 00 00 00 44 44 44 00 00 46 00 44 00 00 00 00 44 00 44 00 00 00 44 46 46 00 44 00 46 44 44 00 00 00 00 00 00 46 00 44 44 46 00 44 00 44 00 46 00 00 00 00 00 00 00 44 46 44 44 00 44 46 00 46 00 00 00 00 00 00 00 00 44 44 00 00 44 44 44 46 00 00 00 00 44 46 44 00 44 44 00 44 44 44 00 00 00 00 00 46 44 46 00 00 46 44 00 44 00 44 00 44 00 00 00 44 44 00 00 44 00 00 44 00 00 00 00 00 44 00 44 00 00 00 00 00 44 46 00 44 00 00 44 00 00 00 00 44 00 00 00 00 44 00 00 44 44 00 00 44 00 46 44 00 46 00 00 00 00 00 00 44 44 46 44 00 44 44 46 44 46 44 00 00 44 46 44 00 00 46 00 00 00 00 44 44 00 00 00 00 44 00 00 44 00 00 00 00 44 00 00 00 00 44 00 00 44 46 00 44 44 00 00 00 46 00 00 46 46 44 44 44 00 00 00 00 44 00 00 44 00 00 00 00 00 44 44 46 44 00 00 00 44 44 00 00 00 00 00 00 46 00 44 00 00 00 00 44 00 00 00 00 00 00 00 44 00 46 00 00 00 00 00 00 00 00 00 44 46 44 00 44 00 00 44 44 44 46 44 00 44 00 44 44 00 46 44 00 00 00 44 00 00 44 44 46 00 44 00 00 46 00 46 00 00 00 46 44 00 00 44 44 00 00 00 44 44 00 00 44 44 44 44 00 44 46 44 46 00 44 00 00 00 00 44 00 44 44 00 00 44 44 44 00 00 46 00 00 44 00 44 44 00 44 44 00 00 00 44 00 44 00 00 00 00 00 44 44 00 44 44 00 44 00 44 46 44 46 44 00 44 00 46 00 44 00 44 00 00 00 00 44 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 44 44 00 00 00 46 00 46 44 44 44 00 00 00 44 46 44 44 46 44 44 46 44 44 00 44 00 46 44 44 00 00 00 00 00 00 44 00 00 46 00 46 44 44 00 00 00 44 00 00 46 00 46 44 44 44 00 00 00 00 00 00 00 00 00 00 44 00 46 00 44 00 44 00 46 44 00 00 44 00 44 44 44 44 00 00 00 00 44 00 00 00 00 00 44 44 00 00 00 00 00 00 44 00 44 00 00 44 00 00 00 44 44 00 00 44 00 44 00 44 44 44 44 44 44 00 00 00 00 44 44 00 00 46 44 44 46 00 44 46 44 44 46 46 00 00 44 00 00 44 44 44 44 44 00 00 00 00 44 00 44 00 00 00 00 00 46 44 00 00 00 44 44 46 44 00 00 44 00 44 00 46 44 00 00 00 00 00 44 00 44 00 00 00 44 00 00 00 00 44 00 44 46 46 44 44 00 00 44 00 00 00 44 00 00 44 44 44 00 00 00 00 46 46 00 00 00
*/
|
oeis/055/A055478.asm | neoneye/loda-programs | 11 | 87262 | ; A055478: Powers of ten written in base 7.
; Submitted by <NAME>(s2)
; 1,13,202,2626,41104,564355,11333311,150666343,2322662122,33531600616,502544411644,10140043655335,132150634516021,2051322215344303,30030522136142242,420430421136212506,6066226105140066214,115260305403151260115,1535044306544330041531,23621642325042620603533,344015313561621001452562,5135235413265003022550266,103124430006141042330114154,1343654220116163613621520365,21134501161546523614013365441,305115115464104443615210450363,4302532541026364433634036515412,62236556663412434304205544336656
mov $1,10
pow $1,$0
seq $1,7093 ; Numbers in base 7.
mov $0,$1
|
old/Metalogic/Metalogic/Classical/Propositional/TruthSemanticsModel.agda | Lolirofle/stuff-in-agda | 6 | 8530 | <reponame>Lolirofle/stuff-in-agda
module Metalogic.Classical.Propositional.TruthSemanticsModel {ℓ} (Proposition : Set(ℓ)) where
import Lvl
open import Data.Boolean
open import Data
open import Data.Tuple as Tuple using (_⨯_ ; _,_)
open import Functional
open import Metalogic.Classical.Propositional.Syntax{ℓ} (Proposition)
renaming (
⊤ to ⊤ₗ ;
⊥ to ⊥ₗ ;
¬_ to ¬ₗ_ ;
_∧_ to _∧ₗ_ ;
_∨_ to _∨ₗ_ ;
_⇒_ to _⇒ₗ_ )
open import Relator.Equals
open import Relator.Equals.Proofs
open import Sets.BoolSet
-- A model decides whether a proposition is true or false
-- Also known as Interpretation, Structure, Model
record Model : Set(ℓ) where
field
interpretProp : Proposition → Bool
-- TODO: Can this be called a "theory" of propositional logic? So that instances of the type Semantics is the "models" of logic?
-- TODO: Now, all the metalogic depends on booleans, which may not be satisfactory
module _ where
import Data.Boolean.Operators
open Data.Boolean.Operators.Logic
satisfaction : Model → Formula → Bool
satisfaction(𝔐)(• prop) = Model.interpretProp(𝔐) (prop)
satisfaction(𝔐)(⊤ₗ) = 𝑇
satisfaction(𝔐)(⊥ₗ) = 𝐹
satisfaction(𝔐)(¬ₗ φ) = ¬(satisfaction(𝔐)(φ))
satisfaction(𝔐)(φ₁ ∧ₗ φ₂) = (satisfaction(𝔐)(φ₁)) ∧ (satisfaction(𝔐)(φ₂))
satisfaction(𝔐)(φ₁ ∨ₗ φ₂) = (satisfaction(𝔐)(φ₁)) ∨ (satisfaction(𝔐)(φ₂))
satisfaction(𝔐)(φ₁ ⇒ₗ φ₂) = ¬(satisfaction(𝔐)(φ₁)) ∨ (satisfaction(𝔐)(φ₂))
-- Syntactic details with the relation symbol
record SatisfactionRelation {ℓ₁}{ℓ₂} (Obj : Set(ℓ) → Set(ℓ₁)) : Set(Lvl.𝐒(ℓ Lvl.⊔ ℓ₁ Lvl.⊔ ℓ₂)) where
field
_⊧_ : Model → Obj(Formula) → Set(ℓ₂)
open SatisfactionRelation ⦃ ... ⦄ public
instance
-- Satisfaction for a single formula
formula-satisfaction-relation : SatisfactionRelation(id)
formula-satisfaction-relation = record{_⊧_ = \𝔐 φ → satisfaction(𝔐)(φ) ≡ 𝑇}
instance
-- Satisfaction for a list of formulas
list-satisfaction-relation : SatisfactionRelation(BoolSet{ℓ})
list-satisfaction-relation = record{_⊧_ = \𝔐 Γ → (∀{γ} → (γ ∈ Γ) → satisfaction(𝔐)(γ) ≡ 𝑇)}
-- Entailment
data _⊨_ (Γ : BoolSet{ℓ}(Formula)) (φ : Formula) : Set(ℓ) where
[⊨]-intro : (∀{𝔐} → (𝔐 ⊧ Γ) → (𝔐 ⊧ φ)) → (Γ ⊨ φ)
_⊭_ : BoolSet{ℓ}(Formula) → Formula → Set(ℓ)
_⊭_ Γ φ = (_⊨_ Γ φ) → Empty{ℓ}
-- Validity
valid : Formula → Set(ℓ)
valid = (∅ ⊨_)
module Theorems where
[⊤]-entailment : (∅ ⊨ ⊤ₗ)
[⊤]-entailment = [⊨]-intro(const [≡]-intro)
-- ∅ ⊨ ⊤ₗ
-- ∀{𝔐} → (𝔐 ⊧ ∅) → (𝔐 ⊧ ⊤ₗ)
-- ∀{𝔐} → (𝔐 ⊧ ∅) → (satisfaction(𝔐)(⊤ₗ) ≡ 𝑇)
-- ∀{𝔐} → (∀{γ} → (γ ∈ ∅) → satisfaction(𝔐)(γ) ≡ 𝑇) → (satisfaction(𝔐)(⊤ₗ) ≡ 𝑇)
-- [∧]-entailment : ∀{φ₁ φ₂} → ([ φ₁ ⊰ φ₂ ] ⊨ (φ₁ ∧ₗ φ₂))
-- [∧]-entailment{φ₁}{φ₂} = [⊨]-intro ([∈]-proof ↦ congruence₁-op(_∧_) ([∈]-proof (use)) ([∈]-proof (skip use)))
-- [ φ₁ ⊰ φ₂ ] ⊨ (φ₁ ∧ φ₂)
-- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (𝔐 ⊧ (φ₁ ∧ φ₂))
-- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (satisfaction(𝔐)(φ₁ ∧ₗ φ₂) ≡ 𝑇)
-- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (satisfaction(𝔐)(φ₁) ∧ satisfaction(𝔐)(φ₂) ≡ 𝑇)
-- ∀{𝔐} → (∀{γ} → (γ ∈ [ φ₁ ⊰ φ₂ ]) → satisfaction(𝔐)(γ) ≡ 𝑇) → (satisfaction(𝔐)(φ₁) ∧ satisfaction(𝔐)(φ₂) ≡ 𝑇)
|
oeis/196/A196537.asm | neoneye/loda-programs | 11 | 95540 | ; A196537: Number of nX1 0..4 arrays with each element equal to the number its horizontal and vertical neighbors less than or equal to itself
; Submitted by <NAME>
; 1,3,2,7,19,35,77,176,377,819,1801,3927,8562,18711,40855,89179,194729,425184,928305,2026855,4425441,9662395,21096706,46062279,100571611,219586403,479441557,1046805072,2285577449,4990293595,10895727817,23789558831,51941744882,113408780759,247614929951,540638504187,1180421521297,2577313596096,5627265559905,12286482224079,26826110093569,58571702593459,127884524919170,279221040017415,609646782810531,1331093100178915,2906287527960861,6345542016588784,13854755627896921,30250253328547203
mov $2,2
mov $4,-2
lpb $0
sub $0,1
add $1,$5
sub $3,$4
mov $4,$2
mov $2,$3
mul $2,3
add $2,$1
mov $1,$3
add $5,$4
mov $3,$5
lpe
mov $0,$2
div $0,2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.