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
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_69.asm
ljhsiun2/medusa
9
87096
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xc813, %rcx nop nop nop cmp %r12, %r12 movb $0x61, (%rcx) nop nop nop dec %r15 lea addresses_WC_ht+0x13a13, %rcx xor %r14, %r14 vmovups (%rcx), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %r12 dec %r15 lea addresses_D_ht+0x1d293, %rdx clflush (%rdx) nop nop nop nop xor %r13, %r13 mov (%rdx), %cx nop nop nop inc %r13 lea addresses_WC_ht+0x1d013, %rcx nop nop nop nop nop inc %rdi movb $0x61, (%rcx) nop nop nop sub %r13, %r13 lea addresses_D_ht+0x5653, %rdi nop nop add %rcx, %rcx movw $0x6162, (%rdi) nop and %r13, %r13 lea addresses_UC_ht+0x18a13, %r13 nop nop nop nop and $7349, %r14 mov (%r13), %r12w nop nop nop nop nop xor %r15, %r15 lea addresses_WC_ht+0x4013, %rsi lea addresses_WT_ht+0x18353, %rdi nop nop nop nop nop sub $3794, %r12 mov $81, %rcx rep movsl nop nop inc %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %rax push %rbx push %rcx push %rsi // Store lea addresses_UC+0x4413, %rcx nop cmp $49825, %rsi mov $0x5152535455565758, %rax movq %rax, %xmm2 vmovups %ymm2, (%rcx) dec %r12 // Store lea addresses_UC+0xc213, %rsi nop nop nop nop dec %rbx mov $0x5152535455565758, %r12 movq %r12, %xmm5 vmovups %ymm5, (%rsi) nop nop nop add $8185, %r10 // Load lea addresses_WC+0x1b813, %r12 clflush (%r12) nop nop nop nop add $8312, %r10 mov (%r12), %ecx nop nop and %rcx, %rcx // Faulty Load lea addresses_WC+0x1b813, %rcx nop nop and %rsi, %rsi movb (%rcx), %al lea oracles, %rbx and $0xff, %rax shlq $12, %rax mov (%rbx,%rax,1), %rax pop %rsi pop %rcx pop %rbx pop %rax pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_WC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 9}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 10}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 7}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 6}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 5}} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
src/plfa/part2/Properties-peer.agda
billyang98/plfa.github.io
0
4575
module plfa.part2.Properties-peer where open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; sym; cong; cong₂) open import Data.String using (String; _≟_) open import Data.Nat using (ℕ; zero; suc) open import Data.Empty using (⊥; ⊥-elim) open import Data.Product using (_×_; proj₁; proj₂; ∃; ∃-syntax) renaming (_,_ to ⟨_,_⟩) open import Data.Sum using (_⊎_; inj₁; inj₂) open import Relation.Nullary using (¬_; Dec; yes; no) open import Function using (_∘_) open import plfa.part1.Isomorphism open import plfa.part2.Lambda V¬—→ : ∀ {M N} → Value M ---------- → ¬ (M —→ N) V¬—→ V-ƛ () V¬—→ V-zero () V¬—→ (V-suc VM) (ξ-suc M—→N) = V¬—→ VM M—→N —→¬V : ∀ {M N} → M —→ N --------- → ¬ Value M —→¬V M—→N VM = V¬—→ VM M—→N infix 4 Canonical_⦂_ data Canonical_⦂_ : Term → Type → Set where C-ƛ : ∀ {x A N B} → ∅ , x ⦂ A ⊢ N ⦂ B ----------------------------- → Canonical (ƛ x ⇒ N) ⦂ (A ⇒ B) C-zero : -------------------- Canonical `zero ⦂ `ℕ C-suc : ∀ {V} → Canonical V ⦂ `ℕ --------------------- → Canonical `suc V ⦂ `ℕ canonical : ∀ {V A} → ∅ ⊢ V ⦂ A → Value V ----------- → Canonical V ⦂ A canonical (⊢` ()) () canonical (⊢ƛ ⊢N) V-ƛ = C-ƛ ⊢N canonical (⊢L · ⊢M) () canonical ⊢zero V-zero = C-zero canonical (⊢suc ⊢V) (V-suc VV) = C-suc (canonical ⊢V VV) canonical (⊢case ⊢L ⊢M ⊢N) () canonical (⊢μ ⊢M) () value : ∀ {M A} → Canonical M ⦂ A ---------------- → Value M value (C-ƛ ⊢N) = V-ƛ value C-zero = V-zero value (C-suc CM) = V-suc (value CM) typed : ∀ {M A} → Canonical M ⦂ A --------------- → ∅ ⊢ M ⦂ A typed (C-ƛ ⊢N) = ⊢ƛ ⊢N typed C-zero = ⊢zero typed (C-suc CM) = ⊢suc (typed CM) data Progress (M : Term) : Set where step : ∀ {N} → M —→ N ---------- → Progress M done : Value M ---------- → Progress M progress : ∀ {M A} → ∅ ⊢ M ⦂ A ---------- → Progress M progress (⊢` ()) progress (⊢ƛ ⊢N) = done V-ƛ progress (⊢L · ⊢M) with progress ⊢L ... | step L—→L′ = step (ξ-·₁ L—→L′) ... | done VL with progress ⊢M ... | step M—→M′ = step (ξ-·₂ VL M—→M′) ... | done VM with canonical ⊢L VL ... | C-ƛ _ = step (β-ƛ VM) progress ⊢zero = done V-zero progress (⊢suc ⊢M) with progress ⊢M ... | step M—→M′ = step (ξ-suc M—→M′) ... | done VM = done (V-suc VM) progress (⊢case ⊢L ⊢M ⊢N) with progress ⊢L ... | step L—→L′ = step (ξ-case L—→L′) ... | done VL with canonical ⊢L VL ... | C-zero = step β-zero ... | C-suc CL = step (β-suc (value CL)) progress (⊢μ ⊢M) = step β-μ postulate progress′ : ∀ M {A} → ∅ ⊢ M ⦂ A → Value M ⊎ ∃[ N ](M —→ N) ext : ∀ {Γ Δ} → (∀ {x A} → Γ ∋ x ⦂ A → Δ ∋ x ⦂ A) ----------------------------------------------------- → (∀ {x y A B} → Γ , y ⦂ B ∋ x ⦂ A → Δ , y ⦂ B ∋ x ⦂ A) ext ρ Z = Z ext ρ (S x≢y ∋x) = S x≢y (ρ ∋x) rename : ∀ {Γ Δ} → (∀ {x A} → Γ ∋ x ⦂ A → Δ ∋ x ⦂ A) ---------------------------------- → (∀ {M A} → Γ ⊢ M ⦂ A → Δ ⊢ M ⦂ A) rename ρ (⊢` ∋w) = ⊢` (ρ ∋w) rename ρ (⊢ƛ ⊢N) = ⊢ƛ (rename (ext ρ) ⊢N) rename ρ (⊢L · ⊢M) = (rename ρ ⊢L) · (rename ρ ⊢M) rename ρ ⊢zero = ⊢zero rename ρ (⊢suc ⊢M) = ⊢suc (rename ρ ⊢M) rename ρ (⊢case ⊢L ⊢M ⊢N) = ⊢case (rename ρ ⊢L) (rename ρ ⊢M) (rename (ext ρ) ⊢N) rename ρ (⊢μ ⊢M) = ⊢μ (rename (ext ρ) ⊢M) weaken : ∀ {Γ M A} → ∅ ⊢ M ⦂ A ---------- → Γ ⊢ M ⦂ A weaken {Γ} ⊢M = rename ρ ⊢M where ρ : ∀ {z C} → ∅ ∋ z ⦂ C --------- → Γ ∋ z ⦂ C ρ () drop : ∀ {Γ x M A B C} → Γ , x ⦂ A , x ⦂ B ⊢ M ⦂ C -------------------------- → Γ , x ⦂ B ⊢ M ⦂ C drop {Γ} {x} {M} {A} {B} {C} ⊢M = rename ρ ⊢M where ρ : ∀ {z C} → Γ , x ⦂ A , x ⦂ B ∋ z ⦂ C ------------------------- → Γ , x ⦂ B ∋ z ⦂ C ρ Z = Z ρ (S x≢x Z) = ⊥-elim (x≢x refl) ρ (S z≢x (S _ ∋z)) = S z≢x ∋z swap : ∀ {Γ x y M A B C} → x ≢ y → Γ , y ⦂ B , x ⦂ A ⊢ M ⦂ C -------------------------- → Γ , x ⦂ A , y ⦂ B ⊢ M ⦂ C swap {Γ} {x} {y} {M} {A} {B} {C} x≢y ⊢M = rename ρ ⊢M where ρ : ∀ {z C} → Γ , y ⦂ B , x ⦂ A ∋ z ⦂ C -------------------------- → Γ , x ⦂ A , y ⦂ B ∋ z ⦂ C ρ Z = S x≢y Z ρ (S z≢x Z) = Z ρ (S z≢x (S z≢y ∋z)) = S z≢y (S z≢x ∋z) subst : ∀ {Γ x N V A B} → ∅ ⊢ V ⦂ A → Γ , x ⦂ A ⊢ N ⦂ B -------------------- → Γ ⊢ N [ x := V ] ⦂ B subst {x = y} ⊢V (⊢` {x = x} Z) with x ≟ y ... | yes _ = weaken ⊢V ... | no x≢y = ⊥-elim (x≢y refl) subst {x = y} ⊢V (⊢` {x = x} (S x≢y ∋x)) with x ≟ y ... | yes refl = ⊥-elim (x≢y refl) ... | no _ = ⊢` ∋x subst {x = y} ⊢V (⊢ƛ {x = x} ⊢N) with x ≟ y ... | yes refl = ⊢ƛ (drop ⊢N) ... | no x≢y = ⊢ƛ (subst ⊢V (swap x≢y ⊢N)) subst ⊢V (⊢L · ⊢M) = (subst ⊢V ⊢L) · (subst ⊢V ⊢M) subst ⊢V ⊢zero = ⊢zero subst ⊢V (⊢suc ⊢M) = ⊢suc (subst ⊢V ⊢M) subst {x = y} ⊢V (⊢case {x = x} ⊢L ⊢M ⊢N) with x ≟ y ... | yes refl = ⊢case (subst ⊢V ⊢L) (subst ⊢V ⊢M) (drop ⊢N) ... | no x≢y = ⊢case (subst ⊢V ⊢L) (subst ⊢V ⊢M) (subst ⊢V (swap x≢y ⊢N)) subst {x = y} ⊢V (⊢μ {x = x} ⊢M) with x ≟ y ... | yes refl = ⊢μ (drop ⊢M) ... | no x≢y = ⊢μ (subst ⊢V (swap x≢y ⊢M)) preserve : ∀ {M N A} → ∅ ⊢ M ⦂ A → M —→ N ---------- → ∅ ⊢ N ⦂ A preserve (⊢` ()) preserve (⊢ƛ ⊢N) () preserve (⊢L · ⊢M) (ξ-·₁ L—→L′) = (preserve ⊢L L—→L′) · ⊢M preserve (⊢L · ⊢M) (ξ-·₂ VL M—→M′) = ⊢L · (preserve ⊢M M—→M′) preserve ((⊢ƛ ⊢N) · ⊢V) (β-ƛ VV) = subst ⊢V ⊢N preserve ⊢zero () preserve (⊢suc ⊢M) (ξ-suc M—→M′) = ⊢suc (preserve ⊢M M—→M′) preserve (⊢case ⊢L ⊢M ⊢N) (ξ-case L—→L′) = ⊢case (preserve ⊢L L—→L′) ⊢M ⊢N preserve (⊢case ⊢zero ⊢M ⊢N) (β-zero) = ⊢M preserve (⊢case (⊢suc ⊢V) ⊢M ⊢N) (β-suc VV) = subst ⊢V ⊢N preserve (⊢μ ⊢M) (β-μ) = subst (⊢μ ⊢M) ⊢M sucμ = μ "x" ⇒ `suc (` "x") data Gas : Set where gas : ℕ → Gas data Finished (N : Term) : Set where done : Value N ---------- → Finished N out-of-gas : ---------- Finished N data Steps (L : Term) : Set where steps : ∀ {N} → L —↠ N → Finished N ---------- → Steps L {-# TERMINATING #-} eval : ∀ {L A} → Gas → ∅ ⊢ L ⦂ A --------- → Steps L eval {L} (gas zero) ⊢L = steps (L ∎) out-of-gas eval {L} (gas (suc m)) ⊢L with progress ⊢L ... | done VL = steps (L ∎) (done VL) ... | step L—→M with eval (gas m) (preserve ⊢L L—→M) ... | steps M—↠N fin = steps (L —→⟨ L—→M ⟩ M—↠N) fin ⊢sucμ : ∅ ⊢ μ "x" ⇒ `suc ` "x" ⦂ `ℕ ⊢sucμ = ⊢μ (⊢suc (⊢` ∋x)) where ∋x = Z _ : eval (gas 3) ⊢sucμ ≡ steps (μ "x" ⇒ `suc ` "x" —→⟨ β-μ ⟩ `suc (μ "x" ⇒ `suc ` "x") —→⟨ ξ-suc β-μ ⟩ `suc (`suc (μ "x" ⇒ `suc ` "x")) —→⟨ ξ-suc (ξ-suc β-μ) ⟩ `suc (`suc (`suc (μ "x" ⇒ `suc ` "x"))) ∎) out-of-gas _ = refl _ : eval (gas 100) (⊢twoᶜ · ⊢sucᶜ · ⊢zero) ≡ steps ((ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "n" ⇒ `suc ` "n") · `zero —→⟨ ξ-·₁ (β-ƛ V-ƛ) ⟩ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · `zero —→⟨ β-ƛ V-zero ⟩ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · `zero) —→⟨ ξ-·₂ V-ƛ (β-ƛ V-zero) ⟩ (ƛ "n" ⇒ `suc ` "n") · `suc `zero —→⟨ β-ƛ (V-suc V-zero) ⟩ `suc (`suc `zero) ∎) (done (V-suc (V-suc V-zero))) _ = refl _ : eval (gas 100) ⊢2+2 ≡ steps ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · `suc (`suc `zero) · `suc (`suc `zero) —→⟨ ξ-·₁ (ξ-·₁ β-μ) ⟩ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ])) · `suc (`suc `zero) · `suc (`suc `zero) —→⟨ ξ-·₁ (β-ƛ (V-suc (V-suc V-zero))) ⟩ (ƛ "n" ⇒ case `suc (`suc `zero) [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ]) · `suc (`suc `zero) —→⟨ β-ƛ (V-suc (V-suc V-zero)) ⟩ case `suc (`suc `zero) [zero⇒ `suc (`suc `zero) |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · `suc (`suc `zero)) ] —→⟨ β-suc (V-suc V-zero) ⟩ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · `suc `zero · `suc (`suc `zero)) —→⟨ ξ-suc (ξ-·₁ (ξ-·₁ β-μ)) ⟩ `suc ((ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ])) · `suc `zero · `suc (`suc `zero)) —→⟨ ξ-suc (ξ-·₁ (β-ƛ (V-suc V-zero))) ⟩ `suc ((ƛ "n" ⇒ case `suc `zero [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ]) · `suc (`suc `zero)) —→⟨ ξ-suc (β-ƛ (V-suc (V-suc V-zero))) ⟩ `suc case `suc `zero [zero⇒ `suc (`suc `zero) |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · `suc (`suc `zero)) ] —→⟨ ξ-suc (β-suc V-zero) ⟩ `suc (`suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · `zero · `suc (`suc `zero))) —→⟨ ξ-suc (ξ-suc (ξ-·₁ (ξ-·₁ β-μ))) ⟩ `suc (`suc ((ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ])) · `zero · `suc (`suc `zero))) —→⟨ ξ-suc (ξ-suc (ξ-·₁ (β-ƛ V-zero))) ⟩ `suc (`suc ((ƛ "n" ⇒ case `zero [zero⇒ ` "n" |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · ` "n") ]) · `suc (`suc `zero))) —→⟨ ξ-suc (ξ-suc (β-ƛ (V-suc (V-suc V-zero)))) ⟩ `suc (`suc case `zero [zero⇒ `suc (`suc `zero) |suc "m" ⇒ `suc ((μ "+" ⇒ (ƛ "m" ⇒ (ƛ "n" ⇒ case ` "m" [zero⇒ ` "n" |suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]))) · ` "m" · `suc (`suc `zero)) ]) —→⟨ ξ-suc (ξ-suc β-zero) ⟩ `suc (`suc (`suc (`suc `zero))) ∎) (done (V-suc (V-suc (V-suc (V-suc V-zero))))) _ = refl Normal : Term → Set Normal M = ∀ {N} → ¬ (M —→ N) Stuck : Term → Set Stuck M = Normal M × ¬ Value M -- Exercise Progress-≃ (practice) Progress-≃ : ∀ {M} → Progress M ≃ Value M ⊎ ∃[ N ](M —→ N) Progress-≃ {M} = record { to = to ; from = from ; from∘to = from∘to ; to∘from = to∘from } where to : ∀ { M } → Progress M → Value M ⊎ ∃[ N ](M —→ N) to (done m) = inj₁ m to (step {N} M→N) = inj₂ ⟨ N , M→N ⟩ from : ∀ { M } → Value M ⊎ ∃[ N ](M —→ N) → Progress M from (inj₁ m) = done m from (inj₂ ⟨ N , M→N ⟩) = step M→N from∘to : ∀ { M } → (m : Progress M) → from (to m) ≡ m from∘to (done m) = refl from∘to (step M→N) = refl to∘from : ∀ { M } ( s : Value M ⊎ ∃[ N ](M —→ N)) → to (from s) ≡ s to∘from (inj₁ m) = refl to∘from (inj₂ ⟨ N , M→N ⟩) = refl -- Exercise value? (practice) value? : ∀ {A M} → ∅ ⊢ M ⦂ A → Dec (Value M) value? ⊢M with progress ⊢M ... | done m = yes m ... | step M→N = no (—→¬V M→N) -- Exercise mul-eval (recommended) mulᶜ : Term mulᶜ = ƛ "m" ⇒ ƛ "n" ⇒ ƛ "s" ⇒ ƛ "z" ⇒ ` "m" · (` "n" · ` "s" ) · ` "z" ⊢mulᶜ : ∀ {Γ A} → Γ ⊢ mulᶜ ⦂ Ch A ⇒ Ch A ⇒ Ch A ⊢mulᶜ = ⊢ƛ (⊢ƛ (⊢ƛ (⊢ƛ (⊢m · ⊢z)))) where ⊢m = (⊢` (S (λ()) (S (λ()) (S (λ()) Z)))) · (⊢` (S (λ()) (S (λ()) Z)) · (⊢` (S (λ()) Z))) ⊢z = ⊢` Z ⊢2*2ᶜ : ∅ ⊢ mulᶜ · twoᶜ · twoᶜ · sucᶜ · `zero ⦂ `ℕ ⊢2*2ᶜ = ⊢mulᶜ · ⊢twoᶜ · ⊢twoᶜ · ⊢sucᶜ · ⊢zero _ : eval (gas 100) (⊢2*2ᶜ) ≡ steps ((ƛ "m" ⇒ (ƛ "n" ⇒ ( ƛ "s" ⇒ (ƛ "z" ⇒ ` "m" · (` "n" · ` "s") · ` "z")))) · (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "n" ⇒ `suc ` "n") · `zero —→⟨ ξ-·₁ (ξ-·₁ (ξ-·₁ (β-ƛ V-ƛ))) ⟩ (ƛ "n" ⇒ (ƛ "s" ⇒ (ƛ "z" ⇒ (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (` "n" · ` "s") · ` "z"))) · (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "n" ⇒ `suc ` "n") · `zero —→⟨ ξ-·₁ (ξ-·₁ (β-ƛ V-ƛ)) ⟩ (ƛ "s" ⇒ (ƛ "z" ⇒ (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · ((ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · ` "s") · ` "z")) · (ƛ "n" ⇒ `suc ` "n") · `zero —→⟨ ξ-·₁ (β-ƛ V-ƛ) ⟩ (ƛ "z" ⇒ (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · ((ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "n" ⇒ `suc ` "n")) · ` "z") · `zero —→⟨ β-ƛ V-zero ⟩ (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · ((ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "n" ⇒ `suc ` "n")) · `zero —→⟨ ξ-·₁ (ξ-·₂ V-ƛ (β-ƛ V-ƛ)) ⟩ (ƛ "s" ⇒ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z"))) · (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · `zero —→⟨ ξ-·₁ (β-ƛ V-ƛ) ⟩ (ƛ "z" ⇒ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · ((ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · ` "z")) · `zero —→⟨ β-ƛ V-zero ⟩ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · ((ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · `zero) —→⟨ ξ-·₂ V-ƛ (β-ƛ V-zero) ⟩ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · ((ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · `zero)) —→⟨ ξ-·₂ V-ƛ (ξ-·₂ V-ƛ (β-ƛ V-zero)) ⟩ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · ((ƛ "n" ⇒ `suc ` "n") · `suc `zero) —→⟨ ξ-·₂ V-ƛ (β-ƛ (V-suc V-zero)) ⟩ (ƛ "z" ⇒ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · ` "z")) · `suc (`suc `zero) —→⟨ β-ƛ (V-suc (V-suc V-zero)) ⟩ (ƛ "n" ⇒ `suc ` "n") · ((ƛ "n" ⇒ `suc ` "n") · `suc (`suc `zero)) —→⟨ ξ-·₂ V-ƛ (β-ƛ (V-suc (V-suc V-zero))) ⟩ (ƛ "n" ⇒ `suc ` "n") · `suc (`suc (`suc `zero)) —→⟨ β-ƛ (V-suc (V-suc (V-suc V-zero))) ⟩ `suc (`suc (`suc (`suc `zero))) ∎) (done (V-suc (V-suc (V-suc (V-suc V-zero))))) _ = refl -- Exercise: progress-preservation (practice) -- progress: If there exists a term M ⦂ A, then M must either be a value, or there exists an N such that M —→ N -- preservation: If term M ⦂ A and N can be reduced from M, then N ⦂ A. -- Exercise subject_expansion (practice) -- counter example with case expression -- M = case `suc V [zero ⇒ N |suc x ⇒ T ], ∅ ⊢ N ⦂ A, ∅ ⊢ T ⦂ B -- In this example, M does not have a type, but M —→ A or M —→ B. -- counter example without case expression -- M —→ N, ∅ ⊢ N ⦂ A → B → A and N = λ a b. a -- Exercise stuck (practice) -- example: `zero · `suc `zero -- The example above is an ill-typed term. -- Exercise unstuck (recommended) unstuck : ∀ {M A} → ∅ ⊢ M ⦂ A ----------- → ¬ (Stuck M) unstuck m ⟨ fst , snd ⟩ with progress m ... | done m₁ = ⊥-elim (snd m₁) ... | step m₁ = ⊥-elim (fst m₁) preserves : ∀ {M N A} → ∅ ⊢ M ⦂ A → M —↠ N --------- → ∅ ⊢ N ⦂ A preserves m (M _—↠_.∎) = m preserves m (L —→⟨ LM ⟩ MN) = preserves (preserve m LM) MN wttdgs : ∀ {M N A} → ∅ ⊢ M ⦂ A → M —↠ N ----------- → ¬ (Stuck N) wttdgs a n = unstuck (preserves a n)
ATMega328P/03-led_onoff/led_onoff_avr.asm
agguro/arduino-project
0
102037
led_onoff.hex: file format ihex Disassembly of section .sec1: 00000000 <.sec1>: 0: 00 e2 ldi r16, 0x20 ; 32 2: 04 b9 out 0x04, r16 ; 4 4: 05 b9 out 0x05, r16 ; 5 6: 0e 94 09 00 call 0x12 ; 0x12 a: 00 e0 ldi r16, 0x00 ; 0 c: 05 b9 out 0x05, r16 ; 5 e: 0c 94 07 00 jmp 0xe ; 0xe 12: 22 e5 ldi r18, 0x52 ; 82 14: 3b e2 ldi r19, 0x2B ; 43 16: 4e ef ldi r20, 0xFE ; 254 18: 4a 95 dec r20 1a: f1 f7 brne .-4 ; 0x18 1c: 3a 95 dec r19 1e: e1 f7 brne .-8 ; 0x18 20: 2a 95 dec r18 22: d1 f7 brne .-12 ; 0x18 24: 00 00 nop 26: 08 95 ret
src/Preimage.agda
nad/equality
3
6893
<filename>src/Preimage.agda ------------------------------------------------------------------------ -- Preimages ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} -- Partly based on Voevodsky's work on so-called univalent -- foundations. open import Equality module Preimage {reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where open import Bijection eq as Bijection hiding (id; _∘_) open Derived-definitions-and-properties eq open import H-level eq as H-level open import Injection eq hiding (id; _∘_) open import Logical-equivalence using (module _⇔_) open import Prelude open import Surjection eq hiding (id; _∘_) -- The preimage of y under f is denoted by f ⁻¹ y. infix 5 _⁻¹_ _⁻¹_ : ∀ {a b} {A : Type a} {B : Type b} → (A → B) → B → Type (a ⊔ b) f ⁻¹ y = ∃ λ x → f x ≡ y -- Preimages under the identity function are contractible. (Note that -- Singleton x is equal to id ⁻¹ x.) id⁻¹-contractible : ∀ {a} {A : Type a} (y : A) → Contractible (id ⁻¹ y) id⁻¹-contractible = singleton-contractible -- _⁻¹_ respects extensional equality of functions. respects-extensional-equality : ∀ {a b} {A : Type a} {B : Type b} {f g : A → B} {y} → (∀ x → f x ≡ g x) → (f ⁻¹ y) ↔ (g ⁻¹ y) respects-extensional-equality {f = f} {g} {y} f≡g = record { surjection = record { logical-equivalence = record { to = to′ ; from = from′ } ; right-inverse-of = right-inverse-of } ; left-inverse-of = left-inverse-of } where to′ : f ⁻¹ y → g ⁻¹ y to′ (x , fx≡y) = x , ( g x ≡⟨ sym $ f≡g x ⟩ f x ≡⟨ fx≡y ⟩∎ y ∎) from′ : g ⁻¹ y → f ⁻¹ y from′ (x , gx≡y) = x , ( f x ≡⟨ f≡g x ⟩ g x ≡⟨ gx≡y ⟩∎ y ∎) abstract right-inverse-of : ∀ p → to′ (from′ p) ≡ p right-inverse-of = λ g⁻¹y → cong (_,_ (proj₁ g⁻¹y)) ( let p = f≡g (proj₁ g⁻¹y); q = proj₂ g⁻¹y in trans (sym p) (trans p q) ≡⟨ sym $ trans-assoc _ _ _ ⟩ trans (trans (sym p) p) q ≡⟨ cong (λ p → trans p q) (trans-symˡ _) ⟩ trans (refl _) q ≡⟨ trans-reflˡ _ ⟩∎ q ∎) left-inverse-of : ∀ p → from′ (to′ p) ≡ p left-inverse-of = λ f⁻¹y → cong (_,_ (proj₁ f⁻¹y)) let p = f≡g (proj₁ f⁻¹y); q = proj₂ f⁻¹y in trans p (trans (sym p) q) ≡⟨ sym $ trans-assoc _ _ _ ⟩ trans (trans p (sym p)) q ≡⟨ cong (λ p → trans p q) (trans-symʳ _) ⟩ trans (refl _) q ≡⟨ trans-reflˡ _ ⟩∎ q ∎ -- Split surjections can be lifted to preimages. lift-surjection : ∀ {a b} {A : Type a} {B : Type b} (A↠B : A ↠ B) → let open _↠_ A↠B in ∀ {y} → (from ∘ to ⁻¹ y) ↠ (from ⁻¹ y) lift-surjection {A = A} {B} A↠B {y} = record { logical-equivalence = record { to = drop-∘ ; from = add-∘ } ; right-inverse-of = right-inv } where open _↠_ A↠B -- Given a preimage under (f ∘ g) a preimage under f can be -- constructed. drop-∘ : (from ∘ to) ⁻¹ y → from ⁻¹ y drop-∘ = Σ-map to id -- If f is a left inverse of g then the other direction also -- holds. abstract add-∘-lemma : ∀ {x} → from x ≡ y → from (to (from x)) ≡ y add-∘-lemma {x} from-x≡y = from (to (from x)) ≡⟨ cong from (right-inverse-of x) ⟩ from x ≡⟨ from-x≡y ⟩∎ y ∎ add-∘ : from ⁻¹ y → (from ∘ to) ⁻¹ y add-∘ (x , from-x≡y) = (from x , add-∘-lemma from-x≡y) abstract -- add-∘ is a right inverse of drop-∘. right-inv : (from⁻¹y : from ⁻¹ y) → drop-∘ (add-∘ from⁻¹y) ≡ from⁻¹y right-inv (x , from-x≡y) = (to (from x) , trans (cong from (right-inverse-of x)) from-x≡y) ≡⟨ sym $ lemma (right-inverse-of x) from-x≡y ⟩∎ (x , from-x≡y) ∎ where lemma : ∀ {x y z} {f : B → A} (y≡x : y ≡ x) (p : f x ≡ z) → _≡_ {A = f ⁻¹ z} (x , p) (y , trans (cong f y≡x) p) lemma {z = z} {f} = elim (λ {y x} y≡x → (p : f x ≡ z) → _≡_ {A = f ⁻¹ z} (x , p) (y , trans (cong f y≡x) p)) (λ x p → cong (_,_ x) ( p ≡⟨ sym $ trans-reflˡ _ ⟩ trans (refl (f x)) p ≡⟨ cong (λ q → trans q p) (sym (cong-refl f)) ⟩∎ trans (cong f (refl x)) p ∎)) -- A consequence of the lemmas above is that preimages under a -- bijection are contractible. bijection⁻¹-contractible : ∀ {a b} {A : Type a} {B : Type b} (A↔B : A ↔ B) → let open _↔_ A↔B in ∀ y → Contractible (to ⁻¹ y) bijection⁻¹-contractible A↔B = H-level.respects-surjection surj 0 ∘ id⁻¹-contractible where open _↔_ (Bijection.inverse A↔B) surj : ∀ {y} → id ⁻¹ y ↠ from ⁻¹ y surj {y} = id ⁻¹ y ↠⟨ _↔_.surjection $ respects-extensional-equality (sym ∘ left-inverse-of) ⟩ from ∘ to ⁻¹ y ↠⟨ lift-surjection surjection ⟩□ from ⁻¹ y □ abstract -- Preimages under an injection into a set are propositional. injection⁻¹-propositional : ∀ {a b} {A : Type a} {B : Type b} (A↣B : A ↣ B) → let open _↣_ A↣B in Is-set B → ∀ y → Is-proposition (to ⁻¹ y) injection⁻¹-propositional A↣B B-set y (x₁ , tox₁≡y) (x₂ , tox₂≡y) = Σ-≡,≡→≡ (injective (to x₁ ≡⟨ tox₁≡y ⟩ y ≡⟨ sym tox₂≡y ⟩∎ to x₂ ∎)) (subst (λ x → to x ≡ y) (injective (trans tox₁≡y (sym tox₂≡y))) tox₁≡y ≡⟨ B-set _ _ ⟩∎ tox₂≡y ∎) where open _↣_ A↣B
MIPS/P2/Q5.asm
JJLeo/BUAA-CO-2020
9
103814
.data a:.space 1000 b:.space 1000 space: .asciiz " " enter: .asciiz "\n" .macro pspace la $a0, space li $v0, 4 syscall .end_macro .macro penter la $a0, enter li $v0, 4 syscall .end_macro .macro scanfd(%x) li $v0, 5 syscall move %x, $v0 .end_macro .macro printfd(%x) move $a0, %x li $v0, 1 syscall .end_macro .macro id(%x, %i, %j) sll %x, %i, 3 add %x, %x, %j sll %x, %x, 2 .end_macro .macro end li $v0, 10 syscall .end_macro .text scanfd($s0) scanfd($s1) li $t1, 1 for1: bgt $t1, $s0, endfor1 li $t2, 1 for2: bgt $t2, $s1, endfor2 scanfd($t3) id($t4, $t1, $t2) sw $t3, a($t4) addi $t2, $t2, 1 j for2 endfor2: addi $t1, $t1, 1 j for1 endfor1: scanfd($t1) scanfd($t2) scanfd($s2) scanfd($s3) jal dfs printfd($s6) end dfs: ## printfd($t1) ## pspace ## printfd($t2) ## penter bne $t1, $s2, else bne $t2, $s3, else addi $s6, $s6, 1 jr $ra else: subi $sp, $sp, 4 sw $ra, 0($sp) id($t3, $t1, $t2) li $t4, 1 sw $t4, b($t3) li $t3, -1 fori: bgt $t3, 1, endfori li $t4, -1 forj: bgt $t4, 1, endforj add $t5, $t3, $t4 beq $t5, 0, continue beq $t5, 2, continue beq $t5, -2, continue add $t5, $t1, $t3 add $t6, $t2, $t4 beq $t5, 0, continue beq $t6, 0, continue bgt $t5, $s0, continue bgt $t6, $s1, continue id($t7, $t5, $t6) lw $t8, a($t7) beq $t8, 1, continue lw $t8, b($t7) beq $t8, 1, continue subi $sp, $sp, 4 sw $t1, 0($sp) subi $sp, $sp, 4 sw $t2, 0($sp) subi $sp, $sp, 4 sw $t3, 0($sp) subi $sp, $sp, 4 sw $t4, 0($sp) move $t1, $t5 move $t2, $t6 jal dfs lw $t4, 0($sp) addi $sp, $sp, 4 lw $t3, 0($sp) addi $sp, $sp, 4 lw $t2, 0($sp) addi $sp, $sp, 4 lw $t1, 0($sp) addi $sp, $sp, 4 continue: addi $t4, $t4, 1 j forj endforj: addi $t3, $t3, 1 j fori endfori: lw $ra, 0($sp) addi $sp, $sp, 4 id($t3, $t1, $t2) sw $0, b($t3) jr $ra
ExtractSac.agda
ashinkarov/agda-extractor
1
10362
open import Structures open import SacTy module ExtractSac where open import Data.String as S hiding (_++_) renaming (_≟_ to _≟s_) open import Data.List as L hiding (_++_) open import Data.List.Categorical open import Data.List.Properties as L open import Data.Nat as N open import Agda.Builtin.Nat using (div-helper; mod-helper) open import Data.Nat.Properties as N open import Data.Nat.Show renaming (show to showNat) open import Data.Product as Σ hiding (map) open import Data.Sum hiding (map) open import Data.Vec as V using (Vec; [] ; _∷_) open import Data.Char using (Char) renaming (_≈?_ to _c≈?_) open import Data.Bool open import Data.Fin as F using (Fin; zero; suc; inject₁; fromℕ<; #_) open import Data.Maybe as M using (Maybe; just; nothing) open import Data.Unit open import Category.Monad open import Category.Monad.State open import Relation.Binary.PropositionalEquality as Eq hiding ([_]) open import Relation.Nullary open import Relation.Nullary.Decidable hiding (map) open import Reflection hiding (return; _>>=_; _>>_) open import Reflection.Term import Reflection.Name as RN open import Reflection.Annotated open import Reflection.Universe open import Reflection.Annotated.Free open import Function open import Array.Base open import Array.Properties open import APL2 using (reduce-1d; _↑_; _↓_; ▴_; ▾_; _-↑⟨_⟩_; _↑⟨_⟩_) open import Agda.Builtin.Float open RawMonad ⦃ ... ⦄ -- Glorified sigma type for variable-type pairs record VarTy : Set where constructor _∈_~_ field v : String s : Err SacTy t : Arg Type -- Glorified sigma type for variable-assertion pairs record Assrt : Set where constructor mk field v : String a : String Assrts = List Assrt -- The state used when traversing a Pi type. record PS : Set where field cnt : ℕ -- The source of unique variable names cur : String -- Current variable name (used to collect assertions from its type) ctx : List VarTy -- Names in the telscopes to resolve deBruijn indices ret : String -- Variable that the function returns as a result. -- We assume that there is always a single variable and its name -- is known upfront. We need this to generate assertions from the -- return type. assrts : Assrts -- Assertions that we generate per each variable. kst : KS -- Compilation state (in case we have to extract some functions used in types) defaultPS : PS defaultPS = record { cnt = 1 ; cur = "" ; ctx = [] ; ret = "__ret" ; assrts = [] ; kst = defaultKS } -- Pack the information about new variables generated -- by patterns in the clause, assignments to these, -- and the list of conditions for "getting into" the -- clause. E.g. -- foo : List ℕ → ℕ -- foo (x ∷ xs) 2 = ... -- -- Assume that we named top-level arguments [a, b] -- Then, new variables for this clause are going to be -- [x, xs] -- Assignments are: -- [x = hd a, xs = tl a] -- Conditions are: -- [is-cons a, b == 2] -- -- `cnt` is merely a source of fresh variables. record PatSt : Set where constructor mk field vars : List (String × ℕ) --Strings assigns : Strings conds : Strings cnt : ℕ defaultPatSt : PatSt defaultPatSt = mk [] [] [] 1 SPS = State PS -- The main function kit to extract sac functions. kompile-fun : Type → Term → Name → SKS Prog kompile-pi : Type → SPS (Err SacTy) --Prog kompile-cls : Clauses → (vars : Strings) → (ret : String) → SKS Prog kompile-clpats : Telescope → (pats : List $ Arg Pattern) → (vars : Strings) → PatSt → Err PatSt {-# TERMINATING #-} kompile-term : Term → {- (varctx : Strings) -} {- List VarTy -} Telescope → SKS Prog -- Normalise the name of the symbols (functions, constructors, ...) -- that we obtain from showName, i.e. remove dots, replace weird -- symbols with ascii. nnorm : String → String nnorm s = replace '.' "_" $ replace '-' "_" $ replace '+' "plus" $ replace 'α' "alpha" $ replace 'ω' "omega" $ replace '→' "to" $ s where repchar : (from : Char) (to : String) (x : Char) → String repchar from to x with does $ x c≈? from ... | true = to ... | false = fromList (x ∷ []) replace : (from : Char) (to : String) → String → String replace f t s = "" ++/ L.map (repchar f t) (toList s) private kf : String → Prog kf x = error $ "kompile-fun: " ++ x validate-ty : Err SacTy → Prog validate-ty (error x) = error x validate-ty (ok τ) = let τ′ = sacty-normalise τ in case nested? τ′ of λ where hom → ok $ sacty-to-string τ′ nes → error $ "sac does not support nested types, but `" ++ sacty-to-string τ′ ++ "` found" module R = RawMonadState (StateMonadState KS) kompile-fun ty (pat-lam [] []) n = return $ kf "got zero clauses in a lambda term" kompile-fun ty (pat-lam cs []) n = do kst ← R.get let (rt , ps) = kompile-pi ty $ record defaultPS{ kst = kst } rt = validate-ty rt rv = PS.ret ps ns = showName n args = ok ", " ++/ L.map (λ where (v ∈ t ~ _) → validate-ty t ⊕ " " ⊕ v) (PS.ctx ps) ret-assrts = list-filter (λ where (mk v _) → v ≈? rv) $ PS.assrts ps arg-assrts = list-filter (dec-neg λ where (mk v _) → v ≈? rv) $ PS.assrts ps assrt-to-code = ("/* " ++_) ∘ (_++ " */") ∘ Assrt.a R.put $ PS.kst ps --b ← if does (showName n S.≟ "Example-02.testn") then kompile-cls cs (L.map (λ where (v ∈ _ ~ _) → v) $ PS.ctx ps) rv else (return $ ok "XX") b ← kompile-cls cs (L.map (λ where (v ∈ _ ~ _) → v) $ PS.ctx ps) rv return $ "// Function " ⊕ ns ⊕ "\n" ⊕ rt ⊕ "\n" ⊕ nnorm ns ⊕ "(" ⊕ args ⊕ ") {\n" ⊕ "\n" ++/ L.map assrt-to-code arg-assrts ⊕ rt ⊕ " " ⊕ rv ⊕ ";\n" ⊕ b -- function body ⊕ "\n" ++/ L.map assrt-to-code ret-assrts ⊕ "return " ⊕ rv ⊕ ";\n" ⊕ "}\n\n" kompile-fun _ _ _ = return $ kf "expected pattern-matching lambda" private kp : ∀ {X} → String → SPS (Err X) kp x = return $ error $ "kompile-pi: " ++ x ke : ∀ {X} → String → SPS (Err X) ke x = return $ error x module P = RawMonadState (StateMonadState PS) infixl 10 _p+=c_ _p+=a_ _p+=c_ : PS → ℕ → PS ps p+=c n = record ps{ cnt = PS.cnt ps + n } _p+=a_ : PS → Assrt → PS ps p+=a a = record ps{ assrts = a ∷ PS.assrts ps } ps-fresh : String → SPS String ps-fresh x = do ps ← P.get P.modify (_p+=c 1) return $ x ++ showNat (PS.cnt ps) lift-ks : ∀ {X} → SKS X → SPS X lift-ks xf sps = let (x , sks) = xf (PS.kst sps) in x , record sps {kst = sks} sps-kompile-term : Term → SPS Prog sps-kompile-term t = do ps ← P.get lift-ks $ kompile-term t $ (L.map (λ where (v ∈ _ ~ t) → (v , t)) $ PS.ctx ps) kompile-ty : Type → (pi-ok : Bool) → SPS (Err SacTy) kompile-ty (Π[ s ∶ arg i x ] y) false = kp "higher-order functions are not supported" kompile-ty (Π[ s ∶ arg i x ] y) true = do v ← ps-fresh "x_" P.modify λ k → record k { cur = v } (ok t) ← kompile-ty x false where e → return e P.modify λ k → record k { cur = PS.ret k -- In case this is a return type ; ctx = PS.ctx k ++ [ v ∈ ok t ~ arg i x ] } kompile-ty y true kompile-ty (con c args) pi-ok = kp $ "don't know how to handle `" ++ showName c ++ "` constructor" kompile-ty (def (quote ℕ) args) _ = return $ ok int kompile-ty (def (quote Bool) args) _ = return $ ok bool kompile-ty (def (quote Float) args) _ = return $ ok float kompile-ty (def (quote Fin) (arg _ x ∷ [])) _ = do ok p ← sps-kompile-term x where error x → ke x v ← PS.cur <$> P.get P.modify $ _p+=a (mk v $′ "assert (" ++ v ++ " < " ++ p ++ ")") return $ ok int kompile-ty (def (quote L.List) (_ ∷ arg _ ty ∷ _)) _ = do el ← ps-fresh "el_" v , as ← < PS.cur , PS.assrts > <$> P.get -- Any constraints that the subsequent call would -- generate will be constraints about the elements -- of the list. P.modify λ k → record k { cur = el ; assrts = [] } ok τ ← kompile-ty ty false where e → return e P.modify λ k → record k { cur = v; assrts = as ++ (L.map {B = Assrt} (λ where (mk _ a) → mk v ("foreach-v " ++ el ++ " in " ++ v ++ ": " ++ a)) $ PS.assrts k) -- No need to modify context, as we don't allow higher order functions, so it stays the same. } return $ ok $ akd nes τ (error "lists do not have static shape") 1 kompile-ty (def (quote V.Vec) (_ ∷ arg _ ty ∷ arg _ n ∷ [])) _ = do el ← ps-fresh "el_" v , as ← < PS.cur , PS.assrts > <$> P.get ok p ← sps-kompile-term n where error x → ke x P.modify λ k → record k { cur = el ; assrts = [] } ok τ ← kompile-ty ty false where e → return e P.modify λ k → record k { cur = v; assrts = as ++ (L.map {B = Assrt} (λ where (mk _ a) → mk v ("foreach-v " ++ el ++ " in " ++ v ++ ": " ++ a)) $ PS.assrts k) ++ [ mk v $′ "assert (shape (" ++ v ++ ")[[0]] == " ++ p ++ ")" ] } let sh = "[" ⊕ p ⊕ "]" case n of λ where -- XXX can we possibly miss on any constant expressions? (lit (nat n′)) → return $ ok $ aks hom τ sh 1 V.[ n′ ] _ → return $ ok $ akd hom τ sh 1 kompile-ty (def (quote Ar) (_ ∷ arg _ el-ty ∷ arg _ dim ∷ arg _ sh ∷ [])) _ = do el ← ps-fresh "el_" v , as ← < PS.cur , PS.assrts > <$> P.get ok d ← sps-kompile-term dim where error x → ke x ok s ← sps-kompile-term sh where error x → ke x P.modify λ k → record k { cur = el ; assrts = [] } ok τ ← kompile-ty el-ty false where e → return e P.modify λ k → record k { cur = v; assrts = as ++ (L.map {B = Assrt} (λ where (mk _ a) → mk v ("foreach-a sh=" ++ s ++ " " ++ el ++ " in " ++ v ++ ": " ++ a)) $ PS.assrts k) ++ [ mk v $′ "assert (take (" ++ d ++ ", shape (" ++ v ++ ")) == " ++ s ++ ")" ] -- XXX do we want to assert stuff about rank? } case dim of λ where -- XXX can we possibly miss on any constant expressions? -- FIXME consider AKS case here! (lit (nat d′)) → return $ ok $ akd hom τ (ok s) d′ _ → return $ ok $ aud hom τ (ok s) kompile-ty (def (quote Ix) (arg _ dim ∷ arg _ s ∷ [])) _ = do v ← PS.cur <$> P.get ok d ← sps-kompile-term dim where error x → ke x ok s ← sps-kompile-term s where error x → ke x P.modify $ _p+=a (mk v $′ "assert (dim (" ++ v ++ ") == " ++ d ++ ")") ∘ _p+=a (mk v $′ "assert (" ++ v ++ " < " ++ s ++ ")") case dim of λ where (lit (nat d′)) → return $ ok $ aks hom int (ok s) 1 V.[ d′ ] _ → return $ ok $ akd hom int (ok s) 1 kompile-ty (def (quote _≡_) (_ ∷ arg _ ty ∷ arg _ x ∷ arg _ y ∷ [])) _ = do ok x ← sps-kompile-term x where error x → ke x ok y ← sps-kompile-term y where error x → ke x v ← PS.cur <$> P.get P.modify $ _p+=a (mk v $′ "assert (" ++ x ++ " == " ++ y ++ ")") return $ ok unit kompile-ty (def (quote _≥a_) (_ ∷ _ ∷ arg _ x ∷ arg _ y ∷ [])) _ = do ok x ← sps-kompile-term x where error x → ke x ok y ← sps-kompile-term y where error x → ke x v ← PS.cur <$> P.get P.modify $ _p+=a (mk v $′ "assert (" ++ x ++ " >= " ++ y ++ ")") return $ ok unit kompile-ty (def (quote _<a_) (_ ∷ _ ∷ arg _ x ∷ arg _ y ∷ [])) _ = do ok x ← sps-kompile-term x where error x → ke x ok y ← sps-kompile-term y where error x → ke x v ← PS.cur <$> P.get P.modify $ _p+=a (mk v $′ "assert (" ++ x ++ " < " ++ y ++ ")") return $ ok unit kompile-ty (def (quote Dec) (_ ∷ arg _ p ∷ [])) _ = do _ ← kompile-ty p false return $ ok bool kompile-ty (def n _) _ = kp $ "cannot handle `" ++ showName n ++ "` type" kompile-ty t _ = kp $ "failed with the term `" ++ showTerm t ++ "`" kompile-pi x = kompile-ty x true -- The names in the telescopes very oftern are not unique, which -- would be pretty disasterous if the code generation relies on them. -- see https://github.com/agda/agda/issues/5048 for more details. -- -- This function simply ensures that variable names are unique in -- in the telescope. tel-rename : Telescope → (db : List (String × ℕ)) → Telescope tel-rename [] db = [] tel-rename ((v , ty) ∷ tel) db with list-find-el ((_≟s v) ∘ proj₁) db ... | just (_ , n) = (v ++ "_" ++ showNat n , ty) ∷ tel-rename tel (list-update-fst ((_≟s v) ∘ proj₁) db (Σ.map₂ suc)) ... | nothing = (v , ty) ∷ tel-rename tel ((v , 1) ∷ db) private kc : String → SKS Prog kc x = return $ error $ "kompile-cls: " ++ x _>>=e_ : ∀ {a}{X : Set a} → Err X → (X → SKS Prog) → SKS Prog (error s) >>=e _ = return $ error s (ok x) >>=e f = f x -- sort in increasing order list-sort : ∀ {a}{X : Set a} → (acc l : List (X × ℕ)) → List (X × ℕ) list-sort acc [] = acc list-sort acc (x ∷ l) = list-sort (insert acc x) l where insert : _ → _ → _ insert [] y = y ∷ [] insert (x ∷ xs) y with proj₂ y N.<? proj₂ x ... | yes y<x = y ∷ x ∷ xs ... | no y≥x = x ∷ insert xs y isperm : ∀ {a}{X : Set a} → (n max : ℕ) → (db : List ℕ) → List (X × ℕ) → Bool isperm 0 0 [] [] = true isperm n max db [] = does (1 + max N.≟ n) ∧ does (L.length db N.≟ n) isperm n max db ((_ , x) ∷ xs) with list-has-el (N._≟ x) db ... | true = false ... | false = isperm n (max N.⊔ x) (x ∷ db) xs perm : Telescope → List (String × ℕ) → Err (List String) perm tel vs with isperm (L.length tel) 0 [] vs ... | false = error $ ", " ++/ L.map (λ where (x , y) → "(" ++ x ++ ", " ++ showNat y ++ ")") vs ++ " is not a permutation of the telescope " ++ showTel tel ... | true = ok $ L.reverse $ L.map proj₁ $ list-sort [] vs module test-perm where test₀ : isperm {X = ℕ} 0 0 [] [] ≡ true test₀ = refl test₁ : isperm 1 0 [] (("" , 0) ∷ []) ≡ true test₁ = refl test₂′ : isperm 2 0 [] (("" , 1) ∷ ("" , 0) ∷ []) ≡ true test₂′ = refl test₃ : isperm 3 0 [] (("" , 2) ∷ ("" , 0) ∷ ("" , 1) ∷ []) ≡ true test₃ = refl test₄ : isperm 4 0 [] (("" , 2) ∷ ("" , 2) ∷ ("" , 1) ∷ ("" , 3) ∷ []) ≡ false test₄ = refl kompile-tel : Telescope → SPS (Err ⊤) kompile-tel [] = return $ ok tt kompile-tel ((v , t@(arg i x)) ∷ tel) = do --(ok τ) ← kompile-ty x false where (error x) → return $ error x P.modify λ k → record k{ ctx = PS.ctx k ++ [ v ∈ error "?" ~ t ] } kompile-tel tel kompile-cls [] ctx ret = kc "zero clauses found" kompile-cls (clause tel ps t ∷ []) ctx ret = -- Make telscope names unique. let tel = (tel-rename $! tel) $! [] in kompile-clpats tel ps ctx defaultPatSt >>=e λ pst → do let (mk vars assgns _ _) = pst --in t ← kompile-term t $! tel let as = "\n" ++/ assgns return $ as ⊕ "\n" ⊕ ret ⊕ " = " ⊕ t ⊕ ";\n" kompile-cls (absurd-clause tel ps ∷ []) ctx ret = -- Exactly the same as above -- We don't really need to make this call, but we keep it -- for sanity checks. I.e. if we'll get an error in the -- patterns, it will bubble up to the caller. kompile-clpats ((tel-rename $! tel) $! []) ps ctx defaultPatSt >>=e λ pst → do return $ ok "unreachable ();" kompile-cls (absurd-clause tel ps ∷ ts@(_ ∷ _)) ctx ret = kompile-clpats ((tel-rename $! tel) $! []) ps ctx defaultPatSt >>=e λ pst → do let (mk vars _ conds _) = pst cs = " && " ++/ (if L.length conds N.≡ᵇ 0 then [ "true" ] else conds) r ← kompile-cls ts ctx ret return $ "if (" ⊕ cs ⊕ ") {\n" ⊕ "unreachable();\n" ⊕ "} else {\n" ⊕ r ⊕ "\n" ⊕ "}\n" kompile-cls (clause tel ps t ∷ ts@(_ ∷ _)) ctx ret = kompile-clpats ((tel-rename $! tel) $! []) ps ctx defaultPatSt >>=e λ pst → do let (mk vars assgns conds _) = pst cs = " && " ++/ (if L.length conds N.≡ᵇ 0 then [ "true" ] else conds) as = "\n" ++/ assgns t ← kompile-term t $! tel --telv --{!!} --PS.ctx ps r ← kompile-cls ts ctx ret return $ "if (" ⊕ cs ⊕ ") {\n" ⊕ as ⊕ "\n" ⊕ ret ⊕ " = " ⊕ t ⊕ ";\n" ⊕ "} else {\n" ⊕ r ⊕ "\n" ⊕ "}\n" tel-lookup-name : Telescope → ℕ → Prog tel-lookup-name tel n with n N.<? L.length (reverse tel) ... | yes n<l = ok $ proj₁ $ lookup (reverse tel) $ fromℕ< n<l ... | no _ = error "Variable lookup in telescope failed" private kcp : String → Err PatSt kcp x = error $ "kompile-clpats: " ++ x infixl 10 _+=c_ _+=a_ _+=v_ _+=n_ _+=c_ : PatSt → String → PatSt p +=c c = record p { conds = PatSt.conds p ++ [ c ] } _+=a_ : PatSt → String → PatSt p +=a a = record p { assigns = PatSt.assigns p ++ [ a ] } _+=v_ : PatSt → String × ℕ → PatSt p +=v v = record p { vars = PatSt.vars p ++ [ v ] } _+=n_ : PatSt → ℕ → PatSt p +=n n = record p { cnt = PatSt.cnt p + 1 } pst-fresh : PatSt → String → Err $ String × PatSt pst-fresh pst x = return $ x ++ showNat (PatSt.cnt pst) , pst +=n 1 kompile-clpats tel (arg i (con (quote true) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c (v {- == true -}) kompile-clpats tel (arg i (con (quote false) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c ("!" ++ v) kompile-clpats tel (arg i (con (quote N.zero) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c (v ++ " == 0") kompile-clpats tel (arg i (con (quote N.suc) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (ps ++ l) ((v ++ " - 1") ∷ ctx) $ pst +=c (v ++ " > 0") kompile-clpats tel (arg i (con (quote F.zero) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c (v ++ " == 0") kompile-clpats tel (arg i (con (quote F.suc) ps@(_ ∷ _ ∷ [])) ∷ l) (v ∷ ctx) pst = do (ub , pst) ← pst-fresh pst "ub_" -- XXX here we are not using `ub` in conds. For two reasons: -- 1) as we have assertions, we should check the upper bound on function entry -- 2) typically, the value of this argument would be Pat.dot, which we ignore -- right now. It is possible to capture the value of the dot-patterns, as -- they carry the value when reconstructed. kompile-clpats tel (ps ++ l) (ub ∷ (v ++ " - 1") ∷ ctx) $ pst +=c (v ++ " > 0") kompile-clpats tel (arg i (con (quote L.List.[]) []) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c ("emptyvec_p (" ++ v ++ ")") kompile-clpats tel (arg i (con (quote L.List._∷_) ps@(_ ∷ _ ∷ [])) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (ps ++ l) (("hd (" ++ v ++ ")") ∷ ("tl (" ++ v ++ ")") ∷ ctx) $ pst +=c ("nonemptyvec_p (" ++ v ++ ")") -- Almost the same as List (extra parameter in cons) kompile-clpats tel (arg i (con (quote V.Vec.[]) []) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c ("emptyvec_p (" ++ v ++ ")") kompile-clpats tel (arg i (con (quote V.Vec._∷_) ps@(_ ∷ _ ∷ _ ∷ [])) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (ps ++ l) (("len (" ++ v ++ ") - 1") ∷ ("hd (" ++ v ++ ")") ∷ ("tl (" ++ v ++ ")") ∷ ctx) $ pst +=c ("nonemptyvec_p (" ++ v ++ ")") -- Patterns for Ix constructors kompile-clpats tel (arg i (con (quote Ix.[]) []) ∷ l) (v ∷ ctx) pst = kompile-clpats tel l ctx $ pst +=c ("emptyvec_p (" ++ v ++ ")") kompile-clpats tel (arg i (con (quote Ix._∷_) ps@(d ∷ arg _ (dot s) ∷ arg _ (dot x) ∷ finx ∷ tailix ∷ [])) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (d ∷ finx ∷ tailix ∷ l) (("len (" ++ v ++ ") - 1") ∷ ("hd (" ++ v ++ ")") ∷ ("tl (" ++ v ++ ")") ∷ ctx) $ pst +=c ("nonemptyvec_p (" ++ v ++ ")") kompile-clpats tel (arg i (con (quote Ix._∷_) _) ∷ l) (v ∷ ctx) pst = kcp $ "matching on `s` and `x` in the Ix._∷_ is not supported, please rewrite the pattern" kompile-clpats tel (arg _ (con (quote imap) (arg _ (var i) ∷ [])) ∷ l) (v ∷ ctx) pst = do (ub , pst) ← pst-fresh pst $ "IMAP_" ++ v ++ "_" -- The only thing that `x` could be is a variable, and since -- we don't have higher-order functions in sac, we define a local -- macro. Note that we do not pass x further, to avoid assignment. kompile-clpats tel l ctx $ pst +=v (ub , i) +=a ("#define " ++ ub ++ "(__x) (" ++ v ++ ")[__x]") kompile-clpats tel (arg i (con (quote imap) (arg _ (dot _) ∷ [])) ∷ l) (v ∷ ctx) pst = -- We simply ignore this inner function entirely. kompile-clpats tel l ctx $ pst kompile-clpats tel (arg i (con (quote imap) (arg _ (absurd _) ∷ [])) ∷ l) (v ∷ ctx) pst = kcp "don't know how to handle absurd pattern as an argument to imap" kompile-clpats tel (arg i (con (quote refl) ps) ∷ l) (v ∷ ctx) pst = -- No constraints, as there could only be a single value. kompile-clpats tel l ctx pst kompile-clpats tel (arg i (con (quote _because_) ps) ∷ l) (v ∷ ctx) pst = do pf , pst ← pst-fresh pst $ "pf_" kompile-clpats tel (ps ++ l) (v ∷ pf ∷ ctx) pst kompile-clpats tel (arg i (con (quote Reflects.ofʸ) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (ps ++ l) ("true" ∷ ctx) pst kompile-clpats tel (arg i (con (quote Reflects.ofⁿ) ps) ∷ l) (v ∷ ctx) pst = kompile-clpats tel (ps ++ l) ("false" ∷ ctx) pst -- End of constructors here. kompile-clpats tel (arg (arg-info _ r) (var i) ∷ l) (v ∷ vars) pst = do -- Note that we do not distinguish between hidden and visible variables s ← tel-lookup-name tel i let s = nnorm s -- If the order of variable binding doesn't match the order -- of the variables in the telescope, we have to consider `i` as well. -- This changed with https://github.com/agda/agda/issues/5075 let pst = pst +=v (s , i) let pst = if does (s ≈? "_") then pst else pst +=a (s ++ " = " ++ v ++ ";") {- -- XXX If I replace the above if with this one, I end up with -- the unsolved meta in the test₂ in Example.agda. Is this a bug? let pst = case (s ≈? "_") of λ where (yes _) → pst (no _) → pst +=a (s ++ " = " ++ v ++ ";") -} kompile-clpats tel l vars pst kompile-clpats tel (arg i (dot t) ∷ l) (v ∷ vars) pst = -- For now we just skip dot patterns. kompile-clpats tel l vars pst kompile-clpats tel (arg i (absurd _) ∷ l) (v ∷ ctx) pst = -- If have met the absurd pattern, we are done, as -- we have accumulated enough conditions to derive -- impossibility. So we are simply done. ok pst kompile-clpats _ [] [] pst = ok pst kompile-clpats tel ps ctx patst = kcp $ "failed on pattern: [" ++ (", " ++/ L.map (λ where (arg _ x) → showPattern x) ps) ++ "], ctx: [" ++ (", " ++/ ctx) ++ "]" private kt : String → SKS Prog kt x = return $ error $ "kompile-term: " ++ x kt-fresh : String → SKS String kt-fresh x = do ps ← R.get R.modify λ k → record k{ cnt = 1 + KS.cnt k } return $ x ++ showNat (KS.cnt ps) var-lookup : List VarTy → ℕ → SKS Prog var-lookup [] _ = kt "Variable lookup failed" var-lookup (v ∈ _ ~ _ ∷ xs) zero = return $ ok v var-lookup (x ∷ xs) (suc n) = var-lookup xs n vty-lookup : List VarTy → ℕ → Err (VarTy) vty-lookup [] _ = error "Variable lookup failed" vty-lookup (x ∷ xs) zero = ok x vty-lookup (x ∷ xs) (suc n) = vty-lookup xs n mk-mask : (n : ℕ) → List $ Fin n mk-mask zero = [] mk-mask (suc n) = L.reverse $ go n (suc n) N.≤-refl where sa<b⇒a<b : ∀ a b → suc a N.< b → a N.< b sa<b⇒a<b zero (suc b) _ = s≤s z≤n sa<b⇒a<b (suc a) (suc n) (s≤s pf) = s≤s $ sa<b⇒a<b a n pf go : (m n : ℕ) → m N.< n → List $ Fin n go 0 (suc _) _ = zero ∷ [] go (suc m) n pf = F.fromℕ< pf ∷ go m n (sa<b⇒a<b m n pf) te-to-lvt : Telescope → List VarTy te-to-lvt tel = L.map (λ where (v , t) → v ∈ error "?" ~ t) tel -- TODO lift it up SAC-funs : List (Name × String) SAC-funs = (quote _+_ , "_add_SxS_") ∷ (quote _*_ , "_mul_SxS_") ∷ (quote primFloatPlus , "_add_SxS_") ∷ (quote primFloatMinus , "_sub_SxS_") ∷ (quote primFloatTimes , "_mul_SxS_") ∷ (quote primFloatDiv , "_div_SxS_") ∷ (quote primFloatExp , "Math::exp") ∷ (quote primFloatNegate , "_neg_S_") ∷ [] private module mask-tests where test-mk-mask₁ : mk-mask 0 ≡ [] test-mk-mask₁ = refl test-mk-mask₂ : mk-mask 1 ≡ # 0 ∷ [] test-mk-mask₂ = refl test-mk-mask₃ : mk-mask 2 ≡ # 0 ∷ # 1 ∷ [] test-mk-mask₃ = refl kompile-arglist : (n : ℕ) → List $ Arg Term → List $ Fin n → Telescope → SKS Prog kompile-arglist n args mask varctx with L.length args N.≟ n | V.fromList args ... | yes p | vargs rewrite p = do l ← mapM (λ where (arg _ x) → kompile-term x varctx) $ L.map (V.lookup vargs) mask return $ ok ", " ++/ l where open TraversableM (StateMonad KS) ... | no ¬p | _ = kt "Incorrect argument mask" kompile-term (var x []) vars = return $ tel-lookup-name vars x kompile-term (var x args@(_ ∷ _)) vars = do let f = tel-lookup-name vars x l = L.length args args ← kompile-arglist l args (mk-mask l) vars return $ f ⊕ "(" ⊕ args ⊕ ")" kompile-term (lit l@(float _)) vars = return $ showLiteral l ⊕ "f" kompile-term (lit l) vars = return $ ok $ showLiteral l kompile-term (con (quote N.zero) _) _ = return $ ok "0" kompile-term (con (quote N.suc) args) vars = do args ← kompile-arglist 1 args [ # 0 ] vars return $ "(1 + " ⊕ args ⊕ ")" kompile-term (con (quote Fin.zero) _) _ = return $ ok "0" kompile-term (con (quote Fin.suc) args) vars = do args ← kompile-arglist 2 args [ # 1 ] vars return $ "(1 + " ⊕ args ⊕ ")" kompile-term (con (quote L.List.[]) (_ ∷ (arg _ ty) ∷ [])) vars = do -- We want to call kompile-ty, and we need a context that "should" -- contain vars with their types. But, we never actually access these -- types in the context, we only refer to variables, therefore the -- following hack is justified. kst ← R.get let ctx = L.map (λ where (v , t) → v ∈ error "?" ~ t) $ vars (rt , ps) = kompile-ty ty false $ record defaultPS{ kst = kst; ctx = ctx } in-sh = sacty-shape =<< rt --R.put (PS.kst ps) return $ "empty (" ⊕ in-sh ⊕ ")" --ok "[]" kompile-term (con (quote L.List._∷_) args) vars = do args ← kompile-arglist 4 args (# 2 ∷ # 3 ∷ []) vars return $ "cons (" ⊕ args ⊕ ")" -- Almost the same as List kompile-term (con (quote V.Vec.[]) (_ ∷ (arg _ ty) ∷ [])) vars = do kst ← R.get let ctx = L.map (λ where (v , t) → v ∈ error "?" ~ t) $ vars (rt , ps) = kompile-ty ty false $ record defaultPS{ kst = kst; ctx = ctx } in-sh = sacty-shape =<< rt R.put (PS.kst ps) return $ "empty (" ⊕ in-sh ⊕ ")" kompile-term (con (quote V.Vec._∷_) args) vars = do args ← kompile-arglist 5 args (# 3 ∷ # 4 ∷ []) vars return $ "cons (" ⊕ args ⊕ ")" -- Ix constructors kompile-term (con (quote Ix.[]) []) vars = return $ ok "[]" kompile-term (con (quote Ix._∷_) args) vars = do args ← kompile-arglist 5 args (# 3 ∷ # 4 ∷ []) vars return $ "cons (" ⊕ args ⊕ ")" kompile-term (con (quote refl) _) _ = return $ ok "tt" -- Imaps with explicit lambdas kompile-term (con (quote Array.Base.imap) (_ ∷ arg _ ty ∷ arg _ d ∷ X@(arg _ s) ∷ arg _ (vLam x e) ∷ [])) vars = do kst ← R.get let ctx = L.map (λ where (v , t) → v ∈ error "?" ~ t) $ vars (rt , ps) = kompile-ty ty false $ record defaultPS{ kst = kst; ctx = ctx } in-sh = sacty-shape =<< rt bt = bt <$> rt R.put (PS.kst ps) iv ← kt-fresh "iv_" let iv-type = vArg (def (quote Ix) ((vArg d) ∷ vArg s ∷ [])) s ← kompile-term s vars b ← kompile-term e $! vars ++ [ (iv , iv-type) ] return $! "with { (. <= " ⊕ iv ⊕ " <= .): " ⊕ b ⊕ "; }: genarray (" ⊕ s ⊕ ", zero_" ⊕ bt ⊕ " (" ⊕ in-sh ⊕ "))" -- Imaps with an expression kompile-term (con (quote Array.Base.imap) (_ ∷ arg _ ty ∷ _ ∷ arg _ s ∷ arg _ e ∷ [])) vars = do kst ← R.get let ctx = L.map (λ where (v , t) → v ∈ error "?" ~ t) $ vars (rt , ps) = kompile-ty ty false $ record defaultPS{ kst = kst; ctx = ctx } in-sh = sacty-shape =<< rt bt = bt <$> rt R.put (PS.kst ps) iv ← kt-fresh "iv_" s ← kompile-term s vars b ← kompile-term e $ vars return $ "with { (. <= " ⊕ iv ⊕ " <= .): " ⊕ b ⊕ " (" ⊕ iv ⊕ "); }: genarray (" ⊕ s ⊕ ", zero_" ⊕ bt ⊕ " (" ⊕ in-sh ⊕ "))" kompile-term (con c _) vars = kt $ "don't know constructor " ++ (showName c) -- Definitions -- From Agda.Builtin.Nat: div-helper k m n j = k + (n + m - j) div (1 + m) kompile-term (def (quote div-helper) (arg _ k ∷ arg _ m ∷ arg _ n ∷ arg _ j ∷ [])) vars = do k ← kompile-term k vars m ← kompile-term m vars n ← kompile-term n vars j ← kompile-term j vars return $ "_div_SxS_ (" ⊕ k ⊕ " + (" ⊕ n ⊕ " + " ⊕ m ⊕ " - " ⊕ j ⊕ "), 1 + " ⊕ m ⊕ ")" kompile-term (def (quote N._≟_) (arg _ a ∷ arg _ b ∷ [])) vars = do a ← kompile-term a vars b ← kompile-term b vars return $ a ⊕ " == " ⊕ b kompile-term (def (quote V._++_) args) vars = do args ← kompile-arglist 6 args (# 4 ∷ # 5 ∷ []) vars return $ "concat (" ⊕ args ⊕ ")" kompile-term (def (quote V.tabulate) (_ ∷ arg _ ty ∷ X@(arg _ l) ∷ arg _ (vLam x e) ∷ [])) vars = do kst ← R.get let ctx = te-to-lvt vars --L.map (λ where (v , t) → v ∈ error "?" ~ t) $ TelView.tel vars (rt , ps) = kompile-ty ty false $ record defaultPS{ kst = kst; ctx = ctx } in-sh = sacty-shape =<< rt bt = bt <$> rt R.put (PS.kst ps) iv ← kt-fresh "iv_" let iv-type = vArg (def (quote Fin) (vArg l ∷ [])) l ← kompile-term l vars b ← kompile-term e $ vars ++ [(iv , iv-type)] return $ "with { (. <= " ⊕ iv ⊕ " <= .): " ⊕ b ⊕ "; }: genarray ([" ⊕ l ⊕ "], zero_" ⊕ bt ⊕ " (" ⊕ in-sh ⊕ "))" kompile-term (def (quote ix-tabulate) (arg _ d ∷ X ∷ arg _ (vLam x e) ∷ [])) vars = do iv ← kt-fresh "iv_" let iv-type = vArg (def (quote Fin) (vArg d ∷ [])) d ← kompile-term d vars b ← kompile-term e $ vars ++ [(iv , iv-type)] return $ "with { (. <= " ⊕ iv ⊕ " <= .): " ⊕ b ⊕ "; }: genarray ([" ⊕ d ⊕ "], 0)" -- Array stuff kompile-term (def (quote sel) (_ ∷ _ ∷ _ ∷ _ ∷ arg _ a ∷ arg _ iv ∷ [])) vars = do a ← kompile-term a vars iv ← kompile-term iv vars return $ a ⊕ "[" ⊕ iv ⊕ "]" kompile-term (def (quote ix-lookup) (_ ∷ _ ∷ arg _ iv ∷ arg _ el ∷ [])) vars = do iv ← kompile-term iv vars el ← kompile-term el vars return $ iv ⊕ "[" ⊕ el ⊕ "]" kompile-term (def (quote V.lookup) (_ ∷ _ ∷ _ ∷ arg _ v ∷ arg _ i ∷ [])) vars = do v ← kompile-term v vars i ← kompile-term i vars return $ v ⊕ "[" ⊕ i ⊕ "]" kompile-term (def (quote V.foldr) (_ ∷ _ ∷ ty₁ ∷ arg _ (vLam _ ty₂) ∷ arg _ len ∷ arg _ (hLam _ (def f args)) ∷ arg _ neut ∷ arg _ arr ∷ [])) vars = do let f = case list-find-el ((RN._≟ f) ∘ proj₁) SAC-funs of λ where (just (_ , f)) → f _ → nnorm $ showName f len ← kompile-term len vars neut ← kompile-term neut vars arr ← kompile-term arr vars iv ← kt-fresh "iv_" return $ "with { ([0] <= " ⊕ iv ⊕ " < [" ⊕ len ⊕ "]): " ⊕ arr ⊕ "[" ⊕ iv ⊕ "]; }: fold (" ⊕ f ⊕ ", " ⊕ neut ⊕ ")" kompile-term (def (quote reduce-1d) (_ ∷ _ ∷ arg _ s ∷ arg _ (def f args) ∷ arg _ ε ∷ arg _ a ∷ [])) vars = do let f = case list-find-el ((RN._≟ f) ∘ proj₁) SAC-funs of λ where (just (_ , f)) → f _ → nnorm $ showName f ε ← kompile-term ε vars a ← kompile-term a vars s ← kompile-term s vars iv ← kt-fresh "iv_" return $ "with { ([0] <= " ⊕ iv ⊕ " < " ⊕ s ⊕ "): " ⊕ a ⊕ "[" ⊕ iv ⊕ "]; }: fold (" ⊕ f ⊕ ", " ⊕ ε ⊕ ")" kompile-term (def (quote reduce-1d) (Xa@(arg _ X) ∷ Ya@(arg _ Y) ∷ arg _ s ∷ arg _ L@(vLam a (vLam b e)) ∷ arg _ ε ∷ arg _ arr ∷ [])) vars = do a ← kt-fresh "a" b ← kt-fresh "b" kst ← R.get let (Xs , ps) = kompile-ty X false $ record defaultPS{ kst = kst; ctx = te-to-lvt vars } (Ys , ps) = kompile-ty Y false $ record ps { ctx = PS.ctx ps ++ [ a ∈ Xs ~ Xa ] } R.put $ PS.kst ps t ← kompile-term e $ vars ++ (a , Xa) ∷ (b , Ya) ∷ [] -- (PS.ctx ps ++ [ b ∈ Ys ~ Ya ]) kst ← R.get fname ← kt-fresh "lifted_" let e , ps = kompile-ctx vars $ record defaultPS{ kst = kst } vs = L.map {B = String × Prog} (λ where (v ∈ τ ~ _) → (v , (sacty-to-string <$> τ))) $′ PS.ctx ps vs = vs ++ ((a , (sacty-to-string <$> Xs)) ∷ (b , (sacty-to-string <$> Ys)) ∷ []) vs = ok ", " ++/ L.map (λ where (v , τ) → τ ⊕ " " ⊕ v) vs fun = (sacty-to-string <$> Ys) ⊕ " " ⊕ fname ⊕ "(" ⊕ vs ⊕ ") " ⊕ "{ return " ⊕ t ⊕ "; }" -- error out in case our current context was broken (ok _) ← return e where (error x) → return (error x) --R.modify $! λ k → record k{ defs = (KS.defs k ⊕_) $! fun } kst ← R.get R.put $! record kst{ defs = KS.defs kst ⊕ fun } let part-app = fname ⊕ "(" ⊕ ", " ++/ L.map proj₁ vars ⊕ ")" ε ← kompile-term ε vars arr ← kompile-term arr vars s ← kompile-term s vars iv ← kt-fresh "iv_" return $! "with { ([0] <= " ⊕ iv ⊕ " < " ⊕ s ⊕ "): " ⊕ arr ⊕ "[" ⊕ iv ⊕ "]; }: fold (" ⊕ part-app ⊕ ", " ⊕ ε ⊕ ")" where kompile-ctx : Telescope → SPS (Err ⊤) kompile-ctx [] = return $ ok tt kompile-ctx ((v , t@(arg i x)) ∷ ctx) = do (ok τ) ← kompile-ty x false where (error x) → return $ error x P.modify λ k → record k{ ctx = PS.ctx k ++ [ v ∈ ok τ ~ t ] } kompile-ctx ctx -- A bunch of functions that are mapped to id in sac -- XXX get rid of id call, only keeping for debugging purposes. kompile-term (def (quote F.fromℕ<) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 3 args (# 0 ∷ []) vars kompile-term (def (quote F.toℕ) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 2 args (# 1 ∷ []) vars kompile-term (def (quote subst-ar) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 7 args (# 6 ∷ []) vars kompile-term (def (quote subst-ix) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 5 args (# 4 ∷ []) vars kompile-term (def (quote ▾_) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 6 args (# 5 ∷ []) vars kompile-term (def (quote ▴_) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 6 args (# 5 ∷ []) vars kompile-term (def (quote a→ix) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 4 args (# 1 ∷ []) vars kompile-term (def (quote a→s) args) vars = ("id (" ⊕_) ∘ (_⊕ ")") <$> kompile-arglist 2 args (# 1 ∷ []) vars kompile-term (def (quote Array.Base.magic-fin) args) vars = return $ ok "unreachable ()" kompile-term (def (quote Array.Base.off→idx) args) vars = do args ← kompile-arglist 3 args (# 1 ∷ # 2 ∷ []) vars return $ "off_to_idx (" ⊕ args ⊕ ")" kompile-term (def (quote _↑_) args) vars = do args ← kompile-arglist 7 args (# 4 ∷ # 5 ∷ []) vars return $ "take (" ⊕ args ⊕ ")" kompile-term (def (quote _↓_) args) vars = do args ← kompile-arglist 7 args (# 4 ∷ # 5 ∷ []) vars return $ "drop (" ⊕ args ⊕ ")" kompile-term (def (quote _↑⟨_⟩_) args) vars = do args ← kompile-arglist 7 args (# 4 ∷ # 5 ∷ # 6 ∷ []) vars return $ "overtake (" ⊕ args ⊕ ")" kompile-term (def (quote _-↑⟨_⟩_) args) vars = do args ← kompile-arglist 7 args (# 4 ∷ # 5 ∷ # 6 ∷ []) vars return $ "overtake_back (" ⊕ args ⊕ ")" -- The last pattern in the list of `def` matches kompile-term (def n []) _ = kt $ "attempting to compile `" ++ showName n ++ "` as function with 0 arguments" kompile-term (def n args@(_ ∷ _)) vars with list-find-el ((RN._≟ n) ∘ proj₁) SAC-funs ... | just (_ , f) = do let l = L.length args args ← kompile-arglist l args (mk-mask l) vars return $ f ⊕ " (" ⊕ args ⊕ ")" ... | nothing = do R.modify λ k → record k { funs = KS.funs k ++ [ n ] } let n = nnorm $ showName n l = L.length args args ← kompile-arglist l args (mk-mask l) vars return $ n ⊕ " (" ⊕ args ⊕ ")" kompile-term t vctx = kt $ "failed to compile term `" ++ showTerm t ++ "`"
Task/Function-definition/AppleScript/function-definition.applescript
LaudateCorpus1/RosettaCodeData
1
3078
<gh_stars>1-10 to multiply(a as number, b as number) return a * b end
alloy4fun_models/trashltl/models/7/RoXhZLWpwMdYzMfye.als
Kaixi26/org.alloytools.alloy
0
4053
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/7/RoXhZLWpwMdYzMfye.als open main pred idRoXhZLWpwMdYzMfye_prop8 { all disj f1,f2 : File | f1->f2 in link implies eventually f2 in Trash } pred __repair { idRoXhZLWpwMdYzMfye_prop8 } check __repair { idRoXhZLWpwMdYzMfye_prop8 <=> prop8o }
oeis/160/A160204.asm
neoneye/loda-programs
11
243428
; A160204: Decimal expansion of (873+232*sqrt(2))/809. ; Submitted by <NAME> ; 1,4,8,4,6,6,9,4,0,2,3,1,2,1,8,5,4,7,7,5,3,0,2,7,4,1,4,5,8,7,9,6,6,6,1,9,8,0,5,7,0,6,2,8,8,6,3,8,7,4,5,6,0,6,0,5,4,0,1,6,0,3,2,0,4,1,2,6,6,9,8,8,2,5,7,5,0,4,1,8,2,0,7,8,2,8,0,5,8,1,9,4,8,5,8,0,0,7,9,7 bin $1,$0 mov $2,2 mov $3,$0 mul $3,4 lpb $3 add $5,$2 add $1,$5 add $2,$1 mov $1,$2 sub $3,1 lpe mul $1,2 add $2,$5 mov $4,10 pow $4,$0 add $5,$2 div $2,8 mul $2,13 add $2,$5 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
src/day-4/adventofcode-day_4.ads
persan/advent-of-code-2020
0
18096
<gh_stars>0 with Ada.Containers.Vectors; -- --------------------------------------------------------------------------- -- https://adventofcode.com/2020/day/4 -- --------------------------------------------------------------------------- --- Day 4: Passport Processing --- -- You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. -- While these documents are extremely similar, -- North Pole Credentials aren't issued by a country and therefore -- aren't actually valid documentation for travel in most of the world. -- -- It seems like you're not the only one having problems, though; -- a very long line has formed for the automatic passport scanners, -- and the delay could upset your travel itinerary. -- -- Due to some questionable network security, you realize you might be able to solve both of these problems at the same time. -- -- The automatic passport scanners are slow because they're having trouble detecting which passports have all required fields. The expected fields are as follows: -- -- byr (Birth Year) -- iyr (Issue Year) -- eyr (Expiration Year) -- hgt (Height) -- hcl (Hair Color) -- ecl (Eye Color) -- pid (Passport ID) -- cid (Country ID) -- -- Passport data is validated in batch files (your puzzle input). -- Each passport is represented as a sequence of key:value pairs separated by spaces or newlines. -- Passports are separated by blank lines. -- -- Here is an example batch file containing four passports: -- -- ecl:gry pid:860033327 eyr:2020 hcl:#fffffd -- byr:1937 iyr:2017 cid:147 hgt:183cm -- -- iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 -- hcl:#cfa07d byr:1929 -- -- hcl:#ae17e1 iyr:2013 -- eyr:2024 -- ecl:brn pid:760753108 byr:1931 -- hgt:179cm -- -- hcl:#cfa07d eyr:2025 pid:166559648 -- iyr:2011 ecl:brn hgt:59in -- -- The first passport is valid - all eight fields are present. -- The second passport is invalid - it is missing hgt (the Height field). -- -- The third passport is interesting; the only missing field is cid, -- so it looks like data from North Pole Credentials, not a passport at all! Surely, -- nobody would mind if you made the system temporarily ignore missing cid fields. Treat this "passport" as valid. -- -- The fourth passport is missing two fields, cid and byr. -- Missing cid is fine, but missing any other field is not, so this passport is invalid. -- -- According to the above rules, your improved system would report 2 valid passports. -- -- Count the number of valid passports - those that have all required fields. -- Treat cid as optional. In your batch file, how many passports are valid? with GNAT.Strings; with Ada.Finalization; package Adventofcode.Day_4 is type Hair_Color_Type is new GNAT.Strings.String_Access; type Eye_Color_Type is new GNAT.Strings.String_Access; type Passport_ID_Type is new GNAT.Strings.String_Access; type Heigth_Type is new GNAT.Strings.String_Access; type Country_ID_Type is new Integer with Default_Value => -1; type Year_Type is range 0 .. 3000 with Default_Value => 0; type Boolean is new Standard.Boolean with Default_Value => False; type Passport is new Ada.Finalization.Controlled with record Is_Valid : Boolean; Birth_Year : Year_Type; -- byr Issue_Year : Year_Type; -- iyr Expiration_Year : Year_Type; -- eyr Height : Heigth_Type; -- hgt Hair_Color : Hair_Color_Type; -- hcl Eye_Color : Eye_Color_Type; -- ecl Passport_ID : Passport_ID_Type; -- pid Country_ID : Country_ID_Type; -- cid end record; overriding procedure Adjust (P : in out Passport); overriding procedure Finalize (P : in out Passport); procedure Append (Self : in out Passport; Fields : String); procedure Check_Validty (P : in out Passport); Null_Passport : constant Passport := Passport'(Ada.Finalization.Controlled with others => <>); package Passport_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Passport); type Passport_Vector is new Passport_Vectors.Vector with null record; function Count_Valid (Passports : Passport_Vector) return Natural; procedure Read (Passports : in out Passport_Vector; From_Path : String); end Adventofcode.Day_4;
mc-sema/validator/x86/tests/INC16r.asm
randolphwong/mcsema
2
17758
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ; INC16r xor dx, dx mov dx, 0x30 ;TEST_BEGIN_RECORDING inc dx ;TEST_END_RECORDING
.emacs.d/elpa/ada-ref-man-2012.5/progs/arm_texi.ads
caqg/linux-home
0
21324
with Ada.Text_IO; with Ada.Unchecked_Deallocation; with ARM_Output; with ARM_Contents; package ARM_Texinfo is -- -- Ada reference manual formatter. -- -- This package defines the TEXINFO output object. -- Output objects are responsible for implementing the details of -- a particular format. -- -- --------------------------------------- -- -- Copyright (C) 2003, 2007, 2011, 2013, 2018 <NAME>. All Rights Reserved. -- E-Mail: <EMAIL> -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This library is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file gnu-3-0.txt. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- --------------------------------------- -- -- Edit History: -- -- Ancient - S L - Developed package as add-on to Arm_Form. -- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form. -- Commented out/replaced Ada 2005 features (this is -- Ada 95 code). Updated for a few other changes since -- the last update. -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. -- 4/ 1/12 - S L - Various revisions. -- 8/31/12 - RLB - Added Output_Path. -- 11/26/12 - RLB - Added subdivision names to Clause_Header and -- Revised_Clause_Header. type Texinfo_Output_Type is new ARM_Output.Output_Type with private; --not overriding - Ada 2005-only procedure Create (Output_Object : in out Texinfo_Output_Type; File_Prefix : in String; Output_Path : in String; Change_Version : in ARM_Contents.Change_Version_Type; Title : in String); -- Create an Output_Object for a document. -- overriding - Ada 2005-only procedure Close (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Section (Output_Object : in out Texinfo_Output_Type; Section_Title : in String; Section_Name : in String); -- overriding procedure Set_Columns (Output_Object : in out Texinfo_Output_Type; Number_of_Columns : in ARM_Output.Column_Count); -- overriding procedure Start_Paragraph (Output_Object : in out Texinfo_Output_Type; Style : in ARM_Output.Paragraph_Style_Type; Indent : in ARM_Output.Paragraph_Indent_Type; Number : in String; No_Prefix : in Boolean := False; Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; No_Breaks : in Boolean := False; Keep_with_Next : in Boolean := False; Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal; Justification : in ARM_Output.Justification_Type := ARM_Output.Default); -- overriding procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Category_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : String); -- overriding procedure Clause_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False); -- overriding procedure Revised_Clause_Header (Output_Object : in out Texinfo_Output_Type; New_Header_Text : in String; Old_Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Version : in ARM_Contents.Change_Version_Type; Old_Version : in ARM_Contents.Change_Version_Type; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False); -- overriding procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type; For_Start : in Boolean); -- overriding procedure New_Page (Output_Object : in out Texinfo_Output_Type; Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page); -- overriding procedure New_Column (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Separator_Line (Output_Object : in out Texinfo_Output_Type; Is_Thin : Boolean := True); -- overriding procedure Start_Table (Output_Object : in out Texinfo_Output_Type; Columns : in ARM_Output.Column_Count; First_Column_Width : in ARM_Output.Column_Count; Last_Column_Width : in ARM_Output.Column_Count; Alignment : in ARM_Output.Column_Text_Alignment; No_Page_Break : in Boolean; Has_Border : in Boolean; Small_Text_Size : in Boolean; Header_Kind : in ARM_Output.Header_Kind_Type); -- overriding procedure Table_Marker (Output_Object : in out Texinfo_Output_Type; Marker : in ARM_Output.Table_Marker_Type); -- overriding procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type; Text : in String); -- overriding procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type; Char : in Character); -- overriding procedure Hard_Space (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Line_Break (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type; Clear_Keep_with_Next : in Boolean); -- overriding procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Tab (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Special_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Special_Character_Type); -- overriding procedure Unicode_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Unicode_Type); -- overriding procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type); -- overriding procedure Text_Format (Output_Object : in out Texinfo_Output_Type; Format : in ARM_Output.Format_Type); -- overriding procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Clause_Number : in String); -- overriding procedure Index_Target (Output_Object : in out Texinfo_Output_Type; Index_Key : in Natural); -- overriding procedure Index_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Index_Key : in Natural; Clause_Number : in String); -- overriding procedure DR_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; DR_Number : in String); -- overriding procedure AI_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; AI_Number : in String); -- overriding procedure Local_Target (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String); -- overriding procedure Local_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String; Clause_Number : in String); -- overriding procedure Local_Link_Start (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String); -- overriding procedure Local_Link_End (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String); -- overriding procedure URL_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; URL : in String); -- overriding procedure Picture (Output_Object : in out Texinfo_Output_Type; Name : in String; Descr : in String; Alignment : in ARM_Output.Picture_Alignment; Height, Width : in Natural; Border : in ARM_Output.Border_Kind); private subtype Column_Index_Type is Integer range 1 .. 5; type Column_Text_Item_Type; type Column_Text_Ptr is access Column_Text_Item_Type; type Column_Text_Item_Type is record Text : String (1 .. 80); Length : Natural; Row : Natural; -- Which row in the column. Next : Column_Text_Ptr; end record; type Column_Text_Ptrs_Type is array (Column_Index_Type) of Column_Text_Ptr; type Column_Widths_Type is array (Column_Index_Type) of Natural; procedure Free is new Ada.Unchecked_Deallocation (Column_Text_Item_Type, Column_Text_Ptr); type State_Type is (Title, Contents, Table_Header, Multi_Column, Normal, Index_Start, Index); type Texinfo_Output_Type is new ARM_Output.Output_Type with record File : Ada.Text_IO.File_Type; Is_Valid : Boolean := False; State : State_Type; In_Paragraph : Boolean := False; -- Sub-state within major states Style : ARM_Output.Paragraph_Style_Type; Indent : ARM_Output.Paragraph_Indent_Type; Format : ARM_Output.Format_Type := ARM_Output.Normal_Format; End_Hang_Seen : Boolean; -- Detecting end of title page Line_Empty : Boolean := False; -- True if current line contains only whitespace. First_Word : String (1 .. 80); First_Word_Last : Natural; -- Building menus Menu_Section : ARM_Contents.Section_Number_Type := 0; Menu_Clause : Natural := 0; -- Table and Multi-Column format Column_Count : ARM_Output.Column_Count; Current_Column : Natural; Current_Row : Natural; Column_Text : Column_Text_Ptrs_Type := (others => null); Column_Widths : Column_Widths_Type; Max_Row : Natural := 0; end record; end ARM_Texinfo;
models/tests/test23.als
transclosure/Amalgam
4
2164
module tests/test // Bugpost by <NAME> open util/sequence[A] as aseq open util/sequence[B] as bseq sig A {} sig B {} fact { // This line works all a: A | some (Seq.seqElems).a // This line should work, but typechecker had a bug, and find Seq ambiguous all a: A | some indsOf[Seq,a] } run {} expect 1
oeis/108/A108262.asm
neoneye/loda-programs
11
13228
; A108262: Second order recursive series having the property that the product of any two adjacent terms equals 4 times a triangular number. That is a(n)*a(n+1)= 4*T(c) = 2c(c+1), where c = the term a(n+1) of related series A108261. ; Submitted by <NAME>(s4) ; 3,8,39,220,1275,7424,43263,252148,1469619,8565560,49923735,290976844,1695937323,9884647088,57611945199,335787024100,1957110199395,11406874172264,66484134834183,387497934832828,2258503474162779,13163522910143840,76722633986700255 mov $2,1 lpb $0 sub $0,1 add $2,1 add $2,$1 add $1,$2 add $1,$2 add $2,$1 lpe mov $0,$2 add $0,2
libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_end.asm
jpoikela/z88dk
640
24664
<filename>libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_end.asm SECTION code_clib SECTION code_threads PUBLIC __thread_critical_section_end EXTERN asm_cpu_pop_ei defc __thread_critical_section_end = asm_cpu_pop_ei
out/CommMonoid/Equality.agda
JoeyEremondi/agda-soas
39
4013
<reponame>JoeyEremondi/agda-soas<gh_stars>10-100 {- This second-order equational theory was created from the following second-order syntax description: syntax CommMonoid | CM type * : 0-ary term unit : * | ε add : * * -> * | _⊕_ l20 theory (εU⊕ᴸ) a |> add (unit, a) = a (εU⊕ᴿ) a |> add (a, unit) = a (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c)) (⊕C) a b |> add(a, b) = add(b, a) -} module CommMonoid.Equality where open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Families.Core open import SOAS.Families.Build open import SOAS.ContextMaps.Inductive open import CommMonoid.Signature open import CommMonoid.Syntax open import SOAS.Metatheory.SecondOrder.Metasubstitution CM:Syn open import SOAS.Metatheory.SecondOrder.Equality CM:Syn private variable α β γ τ : *T Γ Δ Π : Ctx infix 1 _▹_⊢_≋ₐ_ -- Axioms of equality data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ CM) α Γ → (𝔐 ▷ CM) α Γ → Set where εU⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ ε ⊕ 𝔞 ≋ₐ 𝔞 ⊕A : ⁅ * ⁆ ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊕ 𝔠 ≋ₐ 𝔞 ⊕ (𝔟 ⊕ 𝔠) ⊕C : ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ 𝔟 ≋ₐ 𝔟 ⊕ 𝔞 open EqLogic _▹_⊢_≋ₐ_ open ≋-Reasoning -- Derived equations εU⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ ε ≋ 𝔞 εU⊕ᴿ = tr (ax ⊕C with《 𝔞 ◃ ε 》) (ax εU⊕ᴸ with《 𝔞 》)
programs/oeis/204/A204553.asm
karttu/loda
0
173511
<reponame>karttu/loda ; A204553: Symmetric matrix: f(i,j)=floor[(2i+2j+2)/4]-floor[(i+j+1)/4], by (constant) antidiagonals. ; 1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 mul $0,2 mov $1,2 mov $2,$0 lpb $2,1 sub $2,$1 add $1,2 sub $2,1 lpe div $1,8 add $1,1
maps/BlackthornEmysHouse.asm
Dev727/ancientplatinum
28
25415
object_const_def ; object_event constants const BLACKTHORNEMYSHOUSE_EMY BlackthornEmysHouse_MapScripts: db 0 ; scene scripts db 0 ; callbacks Emy: faceplayer opentext trade NPC_TRADE_EMY waitbutton closetext end EmysHouseBookshelf: jumpstd magazinebookshelf BlackthornEmysHouse_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 2, 7, BLACKTHORN_CITY, 3 warp_event 3, 7, BLACKTHORN_CITY, 3 db 0 ; coord events db 2 ; bg events bg_event 0, 1, BGEVENT_READ, EmysHouseBookshelf bg_event 1, 1, BGEVENT_READ, EmysHouseBookshelf db 1 ; object events object_event 2, 3, SPRITE_LASS, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, Emy, -1
src/xph_model.adb
ohenley/covidsim
6
23895
<filename>src/xph_model.adb with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers; use Ada.Containers; with Ada.Calendar.Arithmetic; use Ada.Calendar.Arithmetic; with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Formatting; with xph_covid19; use xph_covid19; with xph_covid19.data; use xph_covid19.data; with xph_covid19.serialization; use xph_covid19.serialization; with xph_covid19.utilities; use xph_covid19.utilities; with Qt.QObject; use Qt.QObject; with Qt.QWidget; use Qt.QWidget; with Qt.QString; use Qt.QString; with Qt.QComboBox; use Qt.QComboBox; with Qt.QStringList; use Qt.QStringList; with Qt.QXYSeries; use Qt.QXYSeries; with Qt.QChart; use Qt.QChart; with Qt.QLineSeries; use Qt.QLineSeries; with Qt.QDateTime; use Qt.QDateTime; with Qt.QVariant; use Qt.QVariant; with Qt.QValueAxis; use Qt.QValueAxis; with Qt.QObjectList; use Qt.QObjectList; with Qt.QSpinBox; use Qt.QSpinBox; with Qt.QAreaSeries; use Qt.QAreaSeries; with Qt.QColor; use Qt.QColor; with Qt.QPoint; use Qt.QPoint; with Qt.QTimer; use Qt.QTimer; with Qt.QCheckBox; use Qt.QCheckBox; with Qt.QApplication; use Qt.QApplication; with Qt.QNamespace; use Qt.QNamespace; with Qt.QCursor; use Qt.QCursor; with Qt.QScatterSeries; use Qt.QScatterSeries; with Qt.QPen; use Qt.QPen; with Qt.QBrush; use Qt.QBrush; with Qt.QPainter; use Qt.QPainter; with Qt.QGradient; use Qt.QGradient; with Qt.QAbstractSeries; use Qt.QAbstractSeries; with platform; use platform; -- TODO: -- 1. implement progress bar, feedback and cancel. -- 2. proper legend package body xph_model is data_filename : string := get_covid_raw_data_filepath; bend : integer := 1; -- array index for bend in forecast_ce first_case : integer := 6; -- arr. index in forecast_ce when 1'st case appeared country_entries : country_entries_vector.vector; country_forecast_entries : country_entries_vector.vector; chart : QChartH; form : QWidgetH; country_choice : QComboBoxH; start_date_value : QDateEditH; end_date_value : QDateEditH; steps_value : QSpinBoxH; forecast_days_value : QSpinBoxH; minimize_by_density : QCheckBoxH; refine_search_group : QGroupBoxH; zoom_factor_value : QDoubleSpinBoxH; minimal_improvement_percentage_value : QDoubleSpinBoxH; procedure init_country_choices is countries : QStringListH := QStringList_create; disable : integer := 0; begin for c in country loop QComboBox_addItem (country_choice, s2qs(all_countries(c).name)); declare raw_ce : country_entries_array := get_country_data (data_filename, c); begin if raw_ce'length < 5 then QComboBox_setItemData (country_choice, country'pos(c), QVariant_create(disable), QtUserRole-1); end if; end; end loop; end; procedure update_forecast_range_chart is axes : QObjectListH; forecast_last : qreal := qreal (QSpinBox_value (forecast_days_value)); begin axes := QChart_axes(chart); QValueAxis_setRange(QAxisH(QObjectList_at(axes, 0)), 0.0, forecast_last); end; procedure update_chart is current_index : integer := QComboBox_currentIndex (country_choice); c : country := country'val(current_index); start_date : QDateH := QDateTimeEdit_date (start_date_value); start_time : Time := time_of (QDate_year (start_date), QDate_month (start_date), QDate_day (start_date)); end_date : QDateH := QDateTimeEdit_date (end_date_value); end_time : Time := time_of (QDate_year (end_date), QDate_month (end_date), QDate_day (end_date)); country_ground_truth_first : QSeriesH; country_ground_truth_date_range : QSeriesH; country_ground_truth_last : QSeriesH; country_forecast : QSeriesH; procedure init_series is pen_first : QPenH := QPen_create(QColor_create(0,255,0)); pen_date_range : QPenH := QPen_create(QColor_create(255,0,0)); pen_last : QPenH := QPen_create(QColor_create(0,255,0)); pen_forecast: QPenH := QPen_create(QColor_create(255,255,0)); begin country_ground_truth_first := QLineSeries_create; QPen_setWidth(pen_first, 3); QAreaSeries_setPen(country_ground_truth_first, pen_first); country_ground_truth_date_range := QLineSeries_create; QPen_setWidth(pen_date_range, 3); QAreaSeries_setPen(country_ground_truth_date_range, pen_date_range); country_ground_truth_last := QLineSeries_create; QPen_setWidth(pen_last, 3); QAreaSeries_setPen(country_ground_truth_last, pen_last); country_forecast := QLineSeries_create; QPen_setWidth(pen_forecast, 3); QAreaSeries_setPen(country_forecast, pen_forecast); end; begin QChart_removeAllSeries (chart); QChart_setTitle (chart, s2qs (all_countries(c).name)); init_series; -- ground truths for e in country_entries.first_index .. country_entries.last_index loop if ada.calendar.arithmetic."-" (start_time, country_entries(e).date) > 0 then QXYSeries_append (country_ground_truth_first, qreal(e), qreal(country_entries(e).cumulative_cases)); elsif ada.calendar.arithmetic."-" (country_entries(e).date, end_time) > 0 then QXYSeries_append (country_ground_truth_last, qreal(e), qreal(country_entries(e).cumulative_cases)); else QXYSeries_append (country_ground_truth_date_range, qreal(e), qreal(country_entries(e).cumulative_cases)); end if; end loop; -- forecast for f in country_forecast_entries.first_index .. country_forecast_entries.last_index loop QXYSeries_append (country_forecast, qreal(f), qreal(country_forecast_entries(f).cumulative_cases_simulated)); end loop; QChart_addSeries (chart, country_ground_truth_first); QChart_addSeries (chart, country_ground_truth_date_range); QChart_addSeries (chart, country_ground_truth_last); QChart_addSeries (chart, country_forecast); QChart_createDefaultAxes (chart); end; procedure reset_chart is begin country_forecast_entries.clear; update_chart; update_forecast_range_chart; end; procedure init_model (form_widget: QWidgetH; chart_widget : QChartH) is begin form := form_widget; chart := chart_widget; country_choice := QComboBoxH (QObject_findChild (QObjectH (form), s2qs ("country_choice"))); start_date_value := QDateEditH (QObject_findChild (QObjectH (form), s2qs ("start_date_value"))); end_date_value := QDateEditH (QObject_findChild (QObjectH (form), s2qs ("end_date_value"))); steps_value := QSpinBoxH (QObject_findChild (QObjectH (form), s2qs ("steps_value"))); forecast_days_value := QSpinBoxH (QObject_findChild (QObjectH (form), s2qs ("forecast_days_value"))); minimize_by_density := QCheckBoxH (QObject_findChild (QObjectH (form), s2qs ("minimize_by_density"))); refine_search_group := QGroupBoxH (QObject_findChild (QObjectH (form), s2qs ("refine_search_group"))); zoom_factor_value := QDoubleSpinBoxH (QObject_findChild (QObjectH (form), s2qs ("zoom_factor_value"))); minimal_improvement_percentage_value := QDoubleSpinBoxH (QObject_findChild (QObjectH (form), s2qs ("minimal_improvement_percentage_value"))); init_country_choices; end; procedure set_initial_date_limits is function find_first_case_date return integer is begin for i in country_entries.first_index .. country_entries.last_index loop if country_entries.element (i).cumulative_cases > 0.0 then return i; end if; end loop; return -1; end; start_time : Time := country_entries.element(find_first_case_date).date; start_date : QDateH := QDate_create (Ada.Calendar.Formatting.year (start_time), Ada.Calendar.Formatting.month (start_time), Ada.Calendar.Formatting.day (start_time)); end_time : Time := country_entries.last_element.date; end_date : QDateH := QDate_create (Ada.Calendar.Formatting.year (end_time), Ada.Calendar.Formatting.month (end_time), Ada.Calendar.Formatting.day (end_time)); begin QDateTimeEdit_setMinimumDate (start_date_value, start_date); QDateTimeEdit_setDate (start_date_value, start_date); QDateTimeEdit_setDate (end_date_value, end_date); QDateTimeEdit_setMaximumDate (end_date_value, end_date); end; procedure update_min_max_date_limits is function get_maximum_start_time(end_time : time) return Time is begin return ada.calendar.arithmetic."-" (end_time, 5); end; function get_minimum_end_time (start_time : time) return Time is begin return ada.calendar.arithmetic."+" (start_time, 5); end; start_date : QDateH := QDateTimeEdit_date (start_date_value); start_time : Time := time_of (QDate_year (start_date), QDate_month (start_date), QDate_day (start_date)); end_date : QDateH := QDateTimeEdit_date (end_date_value); end_time : Time := time_of (QDate_year (end_date), QDate_month (end_date), QDate_day (end_date)); maximum_start_time : time := get_maximum_start_time (end_time); maximum_start_date : QDateH := QDate_create (year (maximum_start_time), month (maximum_start_time), day (maximum_start_time)); minimum_end_time : time := get_minimum_end_time (start_time); minimum_end_date : QDateH := QDate_create (year (minimum_end_time), month (minimum_end_time), day (minimum_end_time)); begin QDateTimeEdit_setMaximumDate (start_date_value, maximum_start_date); QDateTimeEdit_setMinimumDate (end_date_value, minimum_end_date); end; procedure slot_compute_xph is c : country := country'val(QComboBox_currentIndex (country_choice)); steps : integer := QSpinBox_value (steps_value); i,j,k,l,m : integer := steps + 1; size : integer := i*j*k*l*m; covid_data : country_entries_array := to_country_entries_array (country_entries); start_date : QDateH := QDateTimeEdit_date (start_date_value); start_time : Time := Ada.Calendar.Formatting.time_of (QDate_year (start_date), QDate_month (start_date), QDate_day (start_date)); end_date : QDateH := QDateTimeEdit_date (end_date_value); end_time : Time := Ada.Calendar.Formatting.time_of (QDate_year (end_date), QDate_month (end_date), QDate_day (end_date)); function get_date_index (date_time : time) return integer is begin for i in covid_data'range loop if covid_data (i).date = date_time then return i; end if; end loop; return -1; end; start_day_index : integer := get_date_index (start_time); end_day_index : integer := get_date_index (end_time); model : model_parameters; minimize_by_density_state : QtCheckState := QCheckBox_checkState (minimize_by_density); ua1 : uarray_access := new unknowns_array (1 .. size); ub1 : uarray_access := new unknowns_array (1 .. size); ub2 : uarray_access := new unknowns_array (1 .. size); uk1 : uarray_access := new unknowns_array (1 .. size); uk2 : uarray_access := new unknowns_array (1 .. size); ssrates : uarray_access := new unknowns_array (1 .. size); ssrates_by_density : uarray_access := new unknowns_array (1 .. size); forecast_value : integer := QSpinBox_value (forecast_days_value); forecast_ce : country_entries_array (1 .. forecast_value); refine_search : boolean := QWidget_isEnabled (QWidgetH (refine_search_group)); begin --put_line (integer'image(start_day_index)); --put_line (integer'image(end_day_index)); QApplication_setOverrideCursor(QCursor_create(WaitCursor)); reset_chart; build_search_set (steps, u_range, ua1, ub1, ub2, uk1, uk2); --Put_Line (integer'image(ua1'Length)); compute_ssrate (c, start_day_index, end_day_index, covid_data, ua1, ub1, ub2, uk1, uk2, ssrates, ssrates_by_density); characterize_best_model (model, ua1, ub1, ub2, uk1, uk2, ssrates, ssrates_by_density, minimize_by_density_state = QtChecked); if refine_search then declare zoom_factor : float := float(QDoubleSpinBox_value (zoom_factor_value)); minimal_improvement_percentage : float := float(QDoubleSpinBox_value (minimal_improvement_percentage_value)); begin zoom (c, steps, start_day_index, end_day_index, covid_data, minimize_by_density_state = QtChecked, ua1, ub1, ub2, uk1, uk2, ssrates, ssrates_by_density, model, zoom_factor, minimal_improvement_percentage); end; end if; compute_simulated_rate (c, start_day_index, covid_data, model); country_forecast_entries.clear; compute_forecast (c, covid_data, forecast_ce, model); country_forecast_entries := to_country_entries_vector (forecast_ce); update_chart; update_forecast_range_chart; QApplication_restoreOverrideCursor; end; procedure slot_change_country_choice(country_name : QStringH) is current_index : integer := QComboBox_currentIndex (country_choice); c : country := country'val(current_index); raw_ce : country_entries_array := get_country_data (data_filename, c); ce : country_entries_array := sanitize_covid_data (raw_ce, all_countries (c)); function filter_out_toxic_date_time return country_entries_vector.vector is toxic_date : Time := Ada.Calendar.Formatting.time_of (2019, 12, 31); begin if ce (ce'first).date = toxic_date then return to_country_entries_vector (ce (ce'first + 1 .. ce'last)); else return to_country_entries_vector (ce); end if; end; begin country_entries := filter_out_toxic_date_time; -- date set_initial_date_limits; --update_min_max_date_limits; -- chart reset_chart; end; procedure slot_start_date_changed (date: QDateH) is begin update_min_max_date_limits; update_chart; update_forecast_range_chart; end; procedure slot_end_date_changed (date: QDateH) is begin update_min_max_date_limits; update_chart; update_forecast_range_chart; end; procedure slot_change_forecast_days(foracast_days_val: Integer) is begin update_forecast_range_chart; end; function refine_search_group_enabled (state: integer) return boolean is begin if state = 0 then return false; end if; return true; end; procedure slot_change_refine_search (state: integer) is begin QWidget_setEnabled (QWidgetH (refine_search_group), refine_search_group_enabled (state)); end; end xph_model;
data/pokemon/base_stats/golduck.asm
Karkino/KarkCrystal16
0
80511
db 0 ; species ID placeholder db 85, 72, 78, 95, 95, 95 ; hp atk def spd sat sdf db WATER, PSYCHIC ; type db 75 ; catch rate db 174 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/golduck/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_FAST ; growth rate dn EGG_WATER_1, EGG_GROUND ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, ROCK_SMASH, PSYCH_UP, DARK_PULSE, SNORE, BLIZZARD, ICY_WIND, PROTECT, RAIN_DANCE, IRON_HEAD, RETURN, DIG, PSYCHIC_M, SHADOW_BALL, FEATHERDANCE, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, SWIFT, THUNDERPUNCH, REST, ATTRACT, SURF, STRENGTH, FLASH, WHIRLPOOL, WATERFALL, ICE_BEAM ; end
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1000.asm
ljhsiun2/medusa
9
3002
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x4b08, %rbx nop nop nop nop nop cmp %rcx, %rcx mov (%rbx), %r11d nop nop cmp $43968, %r9 lea addresses_A_ht+0x1de80, %rsi lea addresses_UC_ht+0x13680, %rdi clflush (%rsi) nop and %r15, %r15 mov $110, %rcx rep movsq nop nop sub $27852, %r9 lea addresses_WT_ht+0x2280, %rsi lea addresses_UC_ht+0xee80, %rdi nop nop and $36427, %rdx mov $10, %rcx rep movsb cmp $9177, %rsi lea addresses_D_ht+0x14a78, %rsi lea addresses_UC_ht+0x7fa0, %rdi nop add $41303, %r15 mov $91, %rcx rep movsq add %r15, %r15 lea addresses_D_ht+0xa680, %rsi lea addresses_WC_ht+0x15840, %rdi nop nop nop nop xor %r11, %r11 mov $112, %rcx rep movsw and $26989, %rbx lea addresses_UC_ht+0x18680, %rsi lea addresses_A_ht+0x7c80, %rdi nop nop nop nop cmp %rdx, %rdx mov $120, %rcx rep movsb nop nop nop nop nop and $43994, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %rbx push %rdi push %rdx push %rsi // Faulty Load lea addresses_normal+0xae80, %r14 nop dec %rbx movups (%r14), %xmm1 vpextrq $1, %xmm1, %r12 lea oracles, %r14 and $0xff, %r12 shlq $12, %r12 mov (%r14,%r12,1), %r12 pop %rsi pop %rdx pop %rdi pop %rbx pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
oeis/192/A192970.asm
neoneye/loda-programs
11
96022
; A192970: Coefficient of x in the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments. ; 0,1,3,9,21,44,85,156,276,476,806,1347,2230,3667,6001,9787,15923,25862,41955,68006,110170,178406,288828,467509,756636,1224469,1981455,3206301,5188161,8394896,13583521,21978912,35562960,57542432,93105986,150649047,243755698,394405447,638161885,1032568111,1670730815,2703299786,4374031503,7077332234,11451364726,18528697994,29980063800,48508762921,78488827896,126997592041,205486421211,332484014577,537970437165,870454453172,1408424891821,2278879346532,3687304239948,5966183588132,9653487829790 lpb $0 sub $0,1 seq $2,192969 ; Constant term of the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments. add $1,$2 mov $2,$0 lpe mov $0,$1
oeis/001/A001196.asm
neoneye/loda-programs
11
94980
; A001196: Double-bitters: only even length runs in binary expansion. ; Submitted by <NAME> ; 0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,768,771,780,783,816,819,828,831,960,963,972,975,1008,1011,1020,1023,3072,3075,3084,3087,3120,3123,3132,3135,3264,3267,3276,3279,3312,3315,3324,3327,3840,3843,3852,3855,3888,3891,3900,3903,4032,4035,4044,4047,4080,4083,4092,4095,12288,12291,12300,12303,12336,12339,12348,12351,12480,12483,12492,12495,12528,12531,12540,12543,13056,13059,13068,13071,13104,13107,13116,13119,13248,13251,13260,13263,13296,13299,13308,13311,15360,15363,15372,15375 mov $2,3 lpb $0 mov $3,$0 div $0,2 mod $3,2 mul $3,$2 add $1,$3 mul $2,4 lpe mov $0,$1
orka/src/orka/interface/orka-scenes-generic_scene_trees.ads
onox/orka
52
24607
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <<EMAIL>> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. private with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Orka.Transforms.SIMD_Matrices; generic with package Transforms is new Orka.Transforms.SIMD_Matrices (<>); package Orka.Scenes.Generic_Scene_Trees is pragma Preelaborate; package SU renames Ada.Strings.Unbounded; subtype Matrix4 is Transforms.Matrix4; type Tree is tagged private; type Cursor is private; function To_Cursor (Object : Tree; Name : String) return Cursor; function Depth (Object : Tree) return Positive; function Width (Object : Tree; Level : Positive) return Natural with Pre => Level <= Object.Depth; procedure Update_Tree (Object : in out Tree); procedure Update_Tree (Object : in out Tree; Root_Transform : Transforms.Matrix4); procedure Set_Visibility (Object : in out Tree; Node : Cursor; Visible : Boolean); function Visibility (Object : Tree; Node : Cursor) return Boolean; procedure Set_Local_Transform (Object : in out Tree; Node : Cursor; Transform : Transforms.Matrix4); function World_Transform (Object : Tree; Node : Cursor) return Transforms.Matrix4; function Root_Name (Object : Tree) return String; function Create_Tree (Name : String) return Tree; procedure Add_Node (Object : in out Tree; Name, Parent : String); procedure Add_Node (Object : in out Tree; Name : SU.Unbounded_String; Parent : String); procedure Remove_Node (Object : in out Tree; Name : String); Unknown_Node_Error : exception; -- Exception raised if a given node does not exist Root_Removal_Error : exception; -- Exception raised if user tries to remove the root node private type Node is record Offset : Positive; Count : Natural; Name : SU.Unbounded_String; end record; pragma Suppress (Tampering_Check); -- Disabling the tampering check speeds up execution of Add_Node, -- reducing the time to create a full scene tree to around 20 %. package Node_Vectors is new Ada.Containers.Vectors (Positive, Node); package Boolean_Vectors is new Ada.Containers.Vectors (Positive, Boolean); use type Transforms.Matrix4; package Matrix_Vectors is new Ada.Containers.Vectors (Positive, Transforms.Matrix4); type Level is record Nodes : Node_Vectors.Vector; Local_Transforms : Matrix_Vectors.Vector; World_Transforms : Matrix_Vectors.Vector; Local_Visibilities : Boolean_Vectors.Vector; World_Visibilities : Boolean_Vectors.Vector; end record; package Level_Vectors is new Ada.Containers.Vectors (Positive, Level); type Tree is tagged record Levels : Level_Vectors.Vector; end record; type Cursor is record Level, Offset : Positive; end record; function Depth (Object : Tree) return Positive is (Positive (Object.Levels.Length)); function Width (Object : Tree; Level : Positive) return Natural is (Natural (Object.Levels (Level).Nodes.Length)); end Orka.Scenes.Generic_Scene_Trees;
data/mapObjects/SafariZoneGate.asm
AmateurPanda92/pokemon-rby-dx
9
1145
<gh_stars>1-10 SafariZoneGate_Object: db $a ; border block db 4 ; warps warp 3, 5, 4, -1 warp 4, 5, 4, -1 warp 3, 0, 0, SAFARI_ZONE_CENTER warp 4, 0, 1, SAFARI_ZONE_CENTER db 0 ; signs db 2 ; objects object SPRITE_WHITE_PLAYER, 6, 2, STAY, LEFT, 1 ; person object SPRITE_WHITE_PLAYER, 1, 4, STAY, RIGHT, 2 ; person ; warp-to warp_to 3, 5, SAFARI_ZONE_GATE_WIDTH warp_to 4, 5, SAFARI_ZONE_GATE_WIDTH warp_to 3, 0, SAFARI_ZONE_GATE_WIDTH ; SAFARI_ZONE_CENTER warp_to 4, 0, SAFARI_ZONE_GATE_WIDTH ; SAFARI_ZONE_CENTER
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2773.asm
ljhsiun2/medusa
9
7337
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xcf36, %r15 clflush (%r15) sub %rbx, %rbx and $0xffffffffffffffc0, %r15 vmovntdqa (%r15), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %r14 nop nop and $33345, %r11 lea addresses_D_ht+0xbc6, %rsi lea addresses_WT_ht+0x2cc6, %rdi nop nop nop xor $10247, %rax mov $87, %rcx rep movsw sub %r15, %r15 lea addresses_A_ht+0x7306, %rcx clflush (%rcx) nop nop nop sub $54581, %rdi mov (%rcx), %r15 sub %r15, %r15 lea addresses_WT_ht+0x1bac6, %r11 dec %rsi movl $0x61626364, (%r11) nop nop nop nop nop inc %rbx lea addresses_WC_ht+0x1d8c6, %rsi lea addresses_D_ht+0x80c6, %rdi nop nop nop nop dec %rbx mov $47, %rcx rep movsw nop nop nop xor %rsi, %rsi lea addresses_UC_ht+0x1bc3a, %r15 nop nop cmp %rsi, %rsi movb (%r15), %bl nop nop add %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %r8 push %rcx push %rdi push %rdx // Store lea addresses_A+0x1fb26, %rdi nop nop cmp $929, %r8 mov $0x5152535455565758, %r10 movq %r10, (%rdi) nop nop nop nop nop xor $35534, %rdx // Store lea addresses_WC+0x12ff6, %rdi add $9151, %r14 mov $0x5152535455565758, %r15 movq %r15, (%rdi) nop nop sub $7809, %rdx // Store lea addresses_WC+0x4d96, %rdi nop nop nop nop nop and %r8, %r8 movl $0x51525354, (%rdi) nop nop add %rcx, %rcx // Store lea addresses_A+0xd4c6, %r8 nop nop sub $55563, %r14 movl $0x51525354, (%r8) nop nop nop sub $1334, %r10 // Store lea addresses_WT+0x7c36, %r10 inc %rdx movb $0x51, (%r10) nop nop nop nop inc %r10 // Load lea addresses_normal+0x10fc5, %rdx nop nop nop nop xor %r8, %r8 movups (%rdx), %xmm1 vpextrq $1, %xmm1, %r14 cmp $22451, %rdi // Store lea addresses_A+0x1d83c, %r15 nop sub $21390, %r14 movw $0x5152, (%r15) nop nop nop dec %r8 // Store lea addresses_WT+0x1ecbe, %r14 clflush (%r14) nop nop nop sub $9153, %r10 movw $0x5152, (%r14) sub %rdi, %rdi // Faulty Load lea addresses_RW+0x15cc6, %rdx nop nop nop nop inc %r14 mov (%rdx), %r10 lea oracles, %rdx and $0xff, %r10 shlq $12, %r10 mov (%rdx,%r10,1), %r10 pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
8085_programming/SS/2_add_5nos.asm
SayanGhoshBDA/code-backup
16
24298
<reponame>SayanGhoshBDA/code-backup ; To add 5 nos. stored in mem. loc. 2050H onwards and store the outputs in ; mem loc 2060H MVI C, 05H ; counter to store 5 nos. MVI H, 20H ; initializing the H-L pair MVI L, 50H MVI A, 00H label1: ADD M ; ADDING M to A INR L ; incrementing L DCR C ; decrementing C JNZ label1 ; loop STA 2060H HLT
oeis/214/A214825.asm
neoneye/loda-programs
11
82165
; A214825: a(n) = a(n-1) + a(n-2) + a(n-3), with a(0) = 1, a(1) = a(2) = 3. ; Submitted by <NAME> ; 1,3,3,7,13,23,43,79,145,267,491,903,1661,3055,5619,10335,19009,34963,64307,118279,217549,400135,735963,1353647,2489745,4579355,8422747,15491847,28493949,52408543,96394339,177296831,326099713,599790883,1103187427,2029078023,3732056333,6864321783,12625456139,23221834255,42711612177,78558902571,144492349003,265762863751,488814115325,899069328079,1653646307155,3041529750559,5594245385793,10289421443507,18925196579859,34808863409159,64023481432525,117757541421543,216589886263227,398370909117295 mov $1,2 mov $2,1 lpb $0 sub $0,1 sub $2,1 add $2,$1 add $1,$3 sub $1,$2 add $3,$2 add $2,$1 lpe mul $2,2 mov $0,$2 sub $0,1
samples/decompress.adb
stcarrez/ada-lzma
4
214
----------------------------------------------------------------------- -- decompress - Decompress example based on the 02_decompress.c example -- The MIT License (MIT) -- -- Copyright (c) 2015 <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.Command_Line; with Ada.Text_IO; with Ada.Streams; with Ada.Streams.Stream_IO; with Interfaces.C; with Lzma; with Lzma.Base; with Lzma.Container; procedure Decompress is use type Interfaces.C.size_t; use type Lzma.Base.lzma_ret; procedure Init_Decoder; procedure Decompress (Source : in String; Dest : in String); BUFSIZE : constant Ada.Streams.Stream_Element_Offset := 4096; Stream : aliased Lzma.Base.lzma_stream := Lzma.Base.LZMA_STREAM_INIT; procedure Init_Decoder is Result : Lzma.Base.lzma_ret; begin Result := Lzma.Container.lzma_stream_decoder (Stream'Unchecked_Access, Long_Long_Integer'Last, Lzma.Container.LZMA_CONCATENATED); if Result /= Lzma.Base.LZMA_OK then Ada.Text_IO.Put_Line ("Error initializing the decoder: " & Lzma.Base.lzma_ret'Image (Result)); end if; end Init_Decoder; -- ------------------------------ -- Open the source file for reading, decompress that file and write the decompressed -- output in the destination file. -- ------------------------------ procedure Decompress (Source : in String; Dest : in String) is Infile : Ada.Streams.Stream_IO.File_Type; Outfile : Ada.Streams.Stream_IO.File_Type; Sbuf : aliased Ada.Streams.Stream_Element_Array (1 .. BUFSIZE); Dbuf : aliased Ada.Streams.Stream_Element_Array (1 .. BUFSIZE); Action : Lzma.Base.lzma_action := Lzma.Base.LZMA_RUN; Last : Ada.Streams.Stream_Element_Offset; Result : Lzma.Base.lzma_ret; begin Ada.Streams.Stream_IO.Open (Infile, Ada.Streams.Stream_IO.In_File, Source); Ada.Streams.Stream_IO.Create (Outfile, Ada.Streams.Stream_IO.Out_File, Dest); Stream.next_out := Dbuf (Dbuf'First)'Unchecked_Access; Stream.avail_out := Dbuf'Length; loop -- Read a block of data from the source file. if Stream.avail_in = 0 and not Ada.Streams.Stream_IO.End_Of_File (Infile) then Stream.next_in := Sbuf (Sbuf'First)'Unchecked_Access; Ada.Streams.Stream_IO.Read (Infile, Sbuf, Last); Stream.avail_in := Interfaces.C.size_t (Last); if Ada.Streams.Stream_IO.End_Of_File (Infile) then Action := Lzma.Base.LZMA_FINISH; end if; end if; Result := Lzma.Base.lzma_code (Stream'Unchecked_Access, Action); -- Write the output data when the buffer is full or we reached the end of stream. if Stream.avail_out = 0 or Result = Lzma.Base.LZMA_STREAM_END then Last := Ada.Streams.Stream_Element_Offset (Dbuf'Length - Stream.avail_out); Ada.Streams.Stream_IO.Write (Outfile, Item => Dbuf (Dbuf'First .. Last)); Stream.next_out := Dbuf (Dbuf'First)'Unchecked_Access; Stream.avail_out := Dbuf'Length; end if; exit when Result /= Lzma.Base.LZMA_OK; end loop; Ada.Streams.Stream_IO.Close (Infile); Ada.Streams.Stream_IO.Close (Outfile); if Result /= Lzma.Base.LZMA_STREAM_END then Ada.Text_IO.Put_Line ("Error while decompressing the input stream: " & Lzma.Base.lzma_ret'Image (Result)); end if; end Decompress; begin if Ada.Command_Line.Argument_Count /= 2 then Ada.Text_IO.Put_Line ("Usage: decompress input output.xz"); return; end if; Init_Decoder; Decompress (Ada.Command_Line.Argument (1), Ada.Command_Line.Argument (2)); Lzma.Base.lzma_end (Stream'Unchecked_Access); end Decompress;
IT_100.asm
pishangujeniya/file-manager-assembly-tasm
0
95244
<gh_stars>0 ;; FILE MANAGER ;; data segment S1 db 'File' S2 db 'Directory' S3 db 'List' S4 db 'Exit' S5 db 'Cancel' S6 db 'Create' S7 db 'Delete' S11 db 'Create' S12 db 'View' S13 db 'Copy' S14 db 'Rename' S15 db 'Delete' S16 db 'Exit' S17 db 'Home' S21 db 'Create' S22 db 'Remove' S23 db 'ChangeDIR' S24 db 'Exit' msg4 db 10, 13, 10, 13, ' Enter name of file to be renamed : $' msg1 db 10, 13, ' ' msg3 db 10, 13, 10, 13, ' Enter name of file to be deleted : $' msg2 db 10, 13, 10, 13, ' Enter name of file to be created : $' msg5 db 10, 13, ' Enter new name of file : $' msg6 db 10, 13, 10, 13, ' Enter name of file to be copied : $' msg7 db 10, 13, ' Enter destination for this file : $' msg8 db 10, 13, 10, 13, ' Enter name of directory to be created : $' msg9 db 10, 13, 10, 13, ' Enter name of directory to be removed : $' msg10 db 10, 13, 10, 13, ' Change directory to : $' msg11 db 10, 13, 10, 13, ' Enter name of file to be deleted : $' msg12 db 10, 13, 10, 13, ' Enter name of file to be deleted : $' msg13 db 10, 13, 10, 13, ' Change drive to : $' msg14 db 10, 13, 10, 13, ' File not found!$' msg15 db 10, 13, 10, 13, ' Access denied!$' msg16 db 10, 13, 10, 13, ' File successfully created.$' msg17 db 10, 13, 10, 13, ' File successfully deleted.$' msg18 db 10, 13, 10, 13, ' File successfully renamed.$' msg19 db 10, 13, 10, 13, ' Directory successfully created.$' msg20 db 10, 13, 10, 13, ' Directory successfully deleted.$' msg21 db 10, 13, 10, 13, ' Path not found!$' msg22 db 10, 13, 10, 13, ' Directory changed successfully.$' msg23 db 10, 13, 10, 13, ' Drive changed successfully.$' msg24 db '*.*', 0 msg25 db 10, 13, 10, 13, ' File copied successfully.$' msg26 db 10, 13, '$' msg27 db 10, 13, 'Press any key to continue$' msg28 db 10, 13, 10, 13, ' Do you want to enter data now?$' msg29 db 10, 13, ' Enter the data (Press Esc to stop) :', 10, 13, '$' msg30 db 10, 13, 10, 13, ' Enter name of file to be viewed : $' msg31 db ' $' MSG110 DB 'PRESS ANY KEY TO EXIT$' buffer1 db 80, 0, 80 dup(0) buffer2 db 80, 0, 80 dup(0) data ends code segment begin1: ASSUME CS:CODE,DS:DATA start:MOV AX,DATA MOV DS,AX MOV ES,AX begin : mov ax, 12h ; Set graphics mode. int 10h ;Drawing button background BLUE mov cx,21d ;screen column mov dx,210d ;screen line mov al,09h ;color of pixel mov ah,0ch ;print pixel sna1:int 10h inc cx cmp cx,155d jne sna1 inc dx mov cx,21d cmp dx,259d jne sna1 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,176d mov dx,210d mov al,09h mov ah,0ch sna2:int 10h inc cx cmp cx,310d jne sna2 inc dx mov cx,176d cmp dx,259d jne sna2 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,331d mov dx,210d mov al,09h mov ah,0ch sna3:int 10h inc cx cmp cx,465d jne sna3 inc dx mov cx,331d cmp dx,259d jne sna3 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,486d mov dx,210d mov al,09h mov ah,0ch sna4:int 10h inc cx cmp cx,620d jne sna4 inc dx mov cx,486d cmp dx,259d jne sna4 ;Drawing button background ;;;;;;;;;;;;;;;;button text printing;;;;;;;; ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ; text color change mov cx,04d ; No of Characters in string mov dl,7d ; Column Start mov dh,14d ; Row Start mov bp,offset S1 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,09d ; No of Characters in string mov dl,23d ; Column Start mov dh,14d ; Row Start mov bp,offset S2 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,43d ; Column Start mov dh,14d ; Row Start mov bp,offset S3 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,63d ; Column Start mov dh,14d ; Row Start mov bp,offset S4 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Mouse initializationnnnnnnnnnnnnn again: mov ax,0000h int 33h cmp ax,0000h je again ;Endsssssssssss Mouse initializationnnnnnnnnnnnnn ;show initialized mouse pointer mov ax, 0001h int 33h ;endsssssssss show initialized mouse pointer ;check for button click sna4 check4: mov ax,0003h int 33h cmp bx,1h jne check4 cmp cx,486d ;greater than or equal 486d we want jc check3 ;to next button cmp cx,620d ;less than 620D jnc check4 cmp dx,210d ;greater than or equal 210d we want jc check1 ;to first button cmp dx,260d ;less than 260d jnc check1 ;to first button call BT4 ;Action if Button Pressed check3: mov ax,0003h int 33h cmp bx,1h jne check3 cmp cx,331d ;greater than or equal 1B we want!!!! jc check2 cmp cx,465d ;less than 5E!!!! jnc check4 cmp dx,210d ;greater than or equal 1B we want!!!! jc check1 cmp dx,260d ;less than 2E!!!! jnc check1 jmp LISTING check2: mov ax,0003h int 33h cmp bx,1h jne check2 cmp cx,176d ;greater than or equal 1B we want!!!! jc check1 cmp cx,311d ;less than 5E!!!! jnc check3 cmp dx,210d ;greater than or equal 1B we want!!!! jc check1 cmp dx,260d ;less than 2E!!!! jnc check1 call BT2 check1: mov ax,0003h int 33h cmp bx,1h jne check1 cmp cx,21d ;greater than or equal 1B we want!!!! jc check4 cmp cx,156d ;less than 5E!!!! jnc check2 cmp dx,210d ;greater than or equal 1B we want!!!! jc check1 cmp dx,260d ;less than 2E!!!! jnc check1 call BT1 jmp check4 ;Like getch() wait for key press before exit!!!!!! mov ah,07h int 21h ;changing mode back to text mode.... mov al,03h mov ah,00h int 10h ;endsssssss changing mode back to text mode.... ;;;;;;;;;;;;;;;;;;;File's Further Buttons;;;;;; BT1 proc mov ax, 12h ; Set graphics mode. int 10h ;Drawing button background BLUE mov cx,10d mov dx,210d mov al,09h mov ah,0ch sna11:int 10h inc cx cmp cx,89d jne sna11 inc dx mov cx,10d cmp dx,259d jne sna11 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,100d mov dx,210d mov al,09h mov ah,0ch sna12:int 10h inc cx cmp cx,179d jne sna12 inc dx mov cx,100d cmp dx,259d jne sna12 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,190d mov dx,210d mov al,09h mov ah,0ch sna13:int 10h inc cx cmp cx,269d jne sna13 inc dx mov cx,190d cmp dx,259d jne sna13 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,280d mov dx,210d mov al,09h mov ah,0ch sna14:int 10h inc cx cmp cx,349d jne sna14 inc dx mov cx,280d cmp dx,259d jne sna14 ;Drawing button background mov cx,360d mov dx,210d mov al,09h mov ah,0ch sna15:int 10h inc cx cmp cx,429d jne sna15 inc dx mov cx,360d cmp dx,259d jne sna15 ;Drawing button background mov cx,440d mov dx,210d mov al,09h mov ah,0ch sna16:int 10h inc cx cmp cx,519d jne sna16 inc dx mov cx,440d cmp dx,259d jne sna16 ;Drawing button background mov cx,530d mov dx,210d mov al,09h mov ah,0ch sna17:int 10h inc cx cmp cx,609d jne sna17 inc dx mov cx,530d cmp dx,259d jne sna17 ;Drawing button background3 ;;;;;;;;;;;;;;;;button text printing;;;;;;;; ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,06d ; No of Characters in string mov dl,2d ; Column Start mov dh,14d ; Row Start mov bp,offset S11 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,14d ; Column Start mov dh,14d ; Row Start mov bp,offset S12 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,26d ; Column Start mov dh,14d ; Row Start mov bp,offset S13 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,06d ; No of Characters in string mov dl,36d ; Column Start mov dh,14d ; Row Start mov bp,offset S14 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,06d ; No of Characters in string mov dl,46d ; Column Start mov dh,14d ; Row Start mov bp,offset S15 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,57d ; Column Start mov dh,14d ; Row Start mov bp,offset S16 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,69d ; Column Start mov dh,14d ; Row Start mov bp,offset S17 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Mouse initializationnnnnnnnnnnnnn again3: mov ax,0000h int 33h cmp ax,0000h je again3 ;Endsssssssssss Mouse initializationnnnnnnnnnnnnn ;show initialized mouse pointer mov ax, 0001h int 33h ;endsssssssss show initialized mouse pointer ;check for button click sna4 check177: mov ax,0003h int 33h cmp bx,1h jne check177 cmp cx,530d ;greater than or equal 1B we want!!!! jc check16 cmp cx,609d ;less than 5E!!!! jnc check177 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 jmp begin1 check16: mov ax,0003h int 33h cmp bx,1h jne check16 cmp cx,440d ;greater than or equal 1B we want!!!! jc check15 cmp cx,519d ;less than 5E!!!! jnc check177 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 call BT4 check15: mov ax,0003h int 33h cmp bx,1h jne check15 cmp cx,360d ;greater than or equal 1B we want!!!! jc check14 cmp cx,429d ;less than 5E!!!! jnc check16 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 jmp DELETE check11: jmp check111 check14: mov ax,0003h int 33h cmp bx,1h jne check14 cmp cx,280d ;greater than or equal 1B we want!!!! jc check13 cmp cx,349d ;less than 5E!!!! jnc check15 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 jmp RENAME check13: mov ax,0003h int 33h cmp bx,1h jne check13 cmp cx,190d ;greater than or equal 1B we want!!!! jc check12 cmp cx,269d ;less than 5E!!!! jnc check14 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 jmp COPY check12: mov ax,0003h int 33h cmp bx,1h jne check12 cmp cx,100d ;greater than or equal 1B we want!!!! jc check11 cmp cx,179d ;less than 5E!!!! jnc check13 cmp dx,210d ;greater than or equal 1B we want!!!! jc check11 cmp dx,260d ;less than 2E!!!! jnc check11 jmp VIEW check111: mov ax,0003h int 33h cmp bx,1h jne check111 cmp cx,10d ;greater than or equal 1B we want!!!! jc check17 cmp cx,89d ;less than 5E!!!! jnc check12 cmp dx,210d ;greater than or equal 1B we want!!!! jc check111 cmp dx,260d ;less than 2E!!!! jnc check111 jmp CREATE check17 : jmp check177 ;endsssssssss show initialized mouse pointer ret endp BT1 ;;;;;;;;;;;;;;;;;;;;;Directory Buttton Click;;;;;;;;;;;;;;;; BT2 proc ;Drawing button background BLUE mov ax, 12h ; Set graphics mode. int 10h mov cx,21d mov dx,210d mov al,09h mov ah,0ch sna21:int 10h inc cx cmp cx,155d jne sna21 inc dx mov cx,21d cmp dx,259d jne sna21 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,176d mov dx,210d mov al,09h mov ah,0ch sna22:int 10h inc cx cmp cx,310d jne sna22 inc dx mov cx,176d cmp dx,259d jne sna22 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,331d mov dx,210d mov al,09h mov ah,0ch sna23:int 10h inc cx cmp cx,465d jne sna23 inc dx mov cx,331d cmp dx,259d jne sna23 ;Drawing button background ;;;;;;;;;;;;;;; ;Drawing button background mov cx,486d mov dx,210d mov al,09h mov ah,0ch sna24:int 10h inc cx cmp cx,620d jne sna24 inc dx mov cx,486d cmp dx,259d jne sna24 ;Drawing button background ;Mouse initializationnnnnnnnnnnnnn again2: mov ax,0000h int 33h cmp ax,0000h je again2 ;Endsssssssssss Mouse initializationnnnnnnnnnnnnn ;show initialized mouse pointer mov ax, 0001h int 33h ;endsssssssss show initialized mouse pointer ;;;;;;;;;;;;;;;;button text printing;;;;;;;; ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,06d ; No of Characters in string mov dl,7d ; Column Start mov dh,14d ; Row Start mov bp,offset S21 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,06d ; No of Characters in string mov dl,26d ; Column Start mov dh,14d ; Row Start mov bp,offset S22 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,09d ; No of Characters in string mov dl,46d ; Column Start mov dh,14d ; Row Start mov bp,offset S23 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;Drawing button mov al,01h ; write mode mov bh,0h ; page number mov bl,04h ;Welcome text color change mov cx,04d ; No of Characters in string mov dl,66d ; Column Start mov dh,14d ; Row Start mov bp,offset S24 mov ah,13h ; print string int 10h ; print string interrupt ;endsssssssssss Drawing button ;check for button click sna4 check24: mov ax,0003h int 33h cmp bx,1h jne check24 cmp cx,486d ;greater than or equal 1B we want!!!! jc check23 cmp cx,620d ;less than 5E!!!! jnc check24 cmp dx,210d ;greater than or equal 1B we want!!!! jc check21 cmp dx,260d ;less than 2E!!!! jnc check21 call BT4 check23: mov ax,0003h int 33h cmp bx,1h jne check23 cmp cx,331d ;greater than or equal 1B we want!!!! jc check22 cmp cx,465d ;less than 5E!!!! jnc check24 cmp dx,210d ;greater than or equal 1B we want!!!! jc check21 cmp dx,260d ;less than 2E!!!! jnc check21 jmp ChDIR check22: mov ax,0003h int 33h cmp bx,1h jne check22 cmp cx,176d ;greater than or equal 1B we want!!!! jc check21 cmp cx,311d ;less than 5E!!!! jnc check23 cmp dx,210d ;greater than or equal 1B we want!!!! jc check21 cmp dx,260d ;less than 2E!!!! jnc check21 jmp redir check21: mov ax,0003h int 33h cmp bx,1h jne check21 ;shr cx,01h cmp cx,21d ;greater than or equal 1B we want!!!! jc check24 cmp cx,156d ;less than 5E!!!! jnc check22 cmp dx,210d ;greater than or equal 1B we want!!!! jc check21 cmp dx,260d ;less than 2E!!!! jnc check21 jmp CRDIR jmp check24 ret endp BT2 ;;;;;;;;;;;; EXit Button Code;;;;;;;;;;;;;;;;; BT4 proc exit: mov al,03h mov ah,00h int 10h mov ax, 4c00h ; exit program int 21h endp BT4 CREATE: call SIMPLE lea dx, msg2 ; module for creating a file call disp1 call read1 ; read name of file to be lea dx, buffer1[2] ; created mov cx, 0 mov ah, 3ch ; create the file int 21h push ax ; push file handle onto stack. lea dx, msg28 ; ask if data is to call disp1 ; be input call readch ; read choice and al, 0fh cmp al, 9 ; if choice = 'Y' or 'y' jnz no lea dx, msg29 call disp1 pop bx ; retrieve file handle from stack. mov buffer1[1], 0 write : call readch ; read data character by character. mov buffer1[0], al cmp buffer1[0], 27 ; check if character is 'Esc'(stop). jz no cmp buffer1[0], 0dh jne neol lea dx, msg26 call disp1 mov si, dx mov byte ptr ds:[si + 2], 0 mov cx, 3 jmp com neol : mov cx, 1 lea dx, buffer1[0] com : mov ah, 40h ; write to the file int 21h mov byte ptr ds:[si + 2], '$' jmp write ENDING: JMP ENDINGII no : lea dx, msg16 ; creation successful call disp1 call readch jmp begin DELETE: call SIMPLE lea dx, msg3 ; module for deleting a file call disp1 call read1 ; read name of file to be deleted lea dx, buffer1[2] mov ah, 41h ; delete the file int 21h cmp ax, 2 ; error if file not found jnz err2 lea dx, msg14 call disp1 jmp endd err2 : cmp ax, 5 ; error if access denied jnz done lea dx, msg15 call disp1 jmp endd done : lea dx, msg17 ; delete successful call disp1 endd : call readch jmp begin ENDINGII: JMP ENDINGI RENAME: call SIMPLE lea dx, msg4 ; module for renaming a file call disp1 call read1 ; read name of file to be renamed lea dx, msg5 call disp1 call read2 ; read new name of file push ds pop es lea dx, buffer1[2] lea di, buffer2[2] mov ah, 56h ; rename file int 21h cmp ax, 2 ; error if file not found jnz err3 lea dx, msg14 call disp1 jmp ende err3 : cmp ax, 3 ; error if path not found jnz err4 lea dx, msg14 call disp1 jmp ende err4 : cmp ax, 5 ; error if access denied jnz ren lea dx, msg15 call disp1 jmp ende ren : lea dx, msg18 ; rename successful call disp1 ende : call readch jmp begin VIEW: call SIMPLE lea dx, msg30 ; module to view the call disp1 ; contents of a file call read1 ; read name of file lea dx, msg26 call disp1 call disp1 lea dx, buffer1[2] ; open the file mov ax, 3d02h int 21h mov buffer2[0], 0 cmp ax, 2 ; error if file not found jnz v_err lea dx, msg14 call disp1 jmp endv v_err : cmp ax, 3 ; error if path not found jnz cont2 lea dx, msg21 call disp1 jmp endv cont2 : mov bx, ax push ax mov cx, 1 lea dx, buffer1 mov ah, 3fh ; read the file int 21h cmp ax, 0 ; stop if end-of-file jz push jnz show2 ENDINGI: JMP ENDINGS show2 : mov buffer1[1], '$' lea dx, buffer1 call disp1 pop ax jmp cont2 cmp buffer1[0], 0dh inc buffer2[0] cmp buffer2[0], 23 ; check if end of page jnz show1temp show1temp: jmp show1 lea dx, msg27 call disp1 call readch mov buffer2[0], 0 lea dx, msg26 call disp1 push: mov ah,02 mov al,0 mov cx,0 mov dx,10 int 21 ;int 21h ;push ax ; push file handle onto stack. lea dx, msg28 ; ask if data is to call disp1 ; be input call readch ; read choice and al, 0fh cmp al, 9 ; if choice = 'Y' or 'y' jnz no1 lea dx, msg29 call disp1 pop bx ; retrieve file handle from stack. mov buffer1[1], 0 write1 : call readch ; read data character by character. mov buffer1[0], al cmp buffer1[0], 27 ; check if character is 'Esc'(stop). jz no1 cmp buffer1[0], 0dh jne neol1 lea dx, msg26 call disp1 mov si, dx mov byte ptr ds:[si + 2], 0 mov cx, 3 jmp com1 neol1 : mov cx, 1 lea dx, buffer1[0] com1: mov ah, 40h ; write to the file int 21h mov byte ptr ds:[si + 2], '$' jmp write1 no1 : lea dx, msg16 ; creation successful call disp1 call readch jmp begin show1 : mov buffer1[1], '$' lea dx, buffer1 call disp1 pop ax jmp cont2 endv : call readch jmp begin jmp DELETE COPY: call SIMPLE lea dx, msg6 ; module for copying a file call disp1 ; read name of file to call read1 ; to be copied mov cx, bx lea dx, msg7 call disp1 call read2 ; read path of destination mov buffer2[bx], '\' ; directory inc bx mov ax, 2 cp : mov si, ax ; concatenating path and filename mov dl, buffer1[si] mov buffer2[bx], dl inc bx inc al cmp cx, ax jne cp mov cx, 0 lea dx, buffer2[2] ; create the file in mov ah, 3ch ; destination directory int 21h cmp ax, 3 ; Display error message jnz cont ; if path not found lea dx, msg21 call disp1 jmp COPY ; on error read data again cont : push ax lea dx, buffer1[2] ; open source file mov ax, 3d00h int 21h push ax rd : pop bx lea dx, buffer1 mov cx, 80h ; read source file mov ah, 3fh int 21h cmp ax, 0 ; check if entire file jz fin ; has been read mov cx, bx pop bx push bx push cx mov cx, ax lea dx, buffer1 ; write into new file to mov ah, 40h ; complete copy task int 21h jmp rd ; read file further fin : lea dx, msg25 ; copy successful call disp1 call readch jmp begin CRDIR : call SIMPLE lea dx, msg8 ; module for creating call disp1 ; a directory call read1 ; read name of directory lea dx, buffer1[2] ; to be created mov ah, 39h ; create directory int 21h cmp ax, 3 ; error if path not found jnz err5 lea dx, msg21 call disp1 jmp endf err5 : cmp ax, 5 ; error if access denied jnz done1 lea dx, msg15 call disp1 jmp endf done1 : lea dx, msg19 ; creation successful call disp1 endf : call readch jmp begin REDIR : call SIMPLE lea dx, msg9 ; module for removing directory call disp1 call read1 ; read name of directory to lea dx, buffer1[2] ; be removed mov ah, 3ah ; remove directory int 21h cmp ax, 3 ; error if path not found jnz err6 lea dx, msg21 call disp1 jmp endg err6 : cmp ax, 5 ; error if access denied jnz done2 lea dx, msg15 call disp1 jmp endg done2 : lea dx, msg20 ; deletion successful call disp1 endg : call readch jmp begin ChDIR : CALL SIMPLE lea dx, msg10 ; module for changing directory call disp1 call read1 ; read name of directory to lea dx, buffer1[2] ; be changed to mov ah, 3bh ; change directory int 21h cmp ax, 3 ; error if path not found jnz done3 lea dx, msg21 call disp1 jmp endh done3 : lea dx, msg22 ; change successful call disp1 endh : call readch jmp begin LISTING: call SIMPLE mov ax, 3h ; module for displaying int 10h ; contents of directory lea dx, msg24 mov cx, 0 mov ah, 4eh ; Get first file int 21h ; in directory cmp ax, 18 ; Check if no files jnz list ; in directory lea dx, msg14 ; Display message call disp1 ; 'File not found' call readch jmp begin list : mov ah, 2fh ; Get dta address int 21h mov byte ptr es:[bx + 42], 0 add bx, 1eh mov buffer1[0], 0 char : mov dl, byte ptr es:[bx] ; Get character of inc bx ; filename from DTA inc buffer1[0] cmp dl, '.' ; Check if extension jnz cont3 ; is starting cont4 : lea dx, msg31 call disp1 inc buffer1[0] cmp buffer1[0], 0bh ; Check for end of filename jne cont4 ; buffer - 13 characters jmp char cont3 : mov ah, 02h ; Display character int 21h ; of filename cmp dl, 0 ; Check for end jne char ; of file name lea dx, msg26 call disp1 inc cx cmp cx, 23 ; Check for end of page jne cont1 lea dx, msg27 call disp1 call readch mov cx, 0 lea dx, msg26 call disp1 cont1 : mov ah, 4fh ; Get next file int 21h jnc list lea dx, msg27 call disp1 call readch jmp begin1 ENDINGS: CALL SIMPLE mov al,01h mov bh,0h mov bl, 0fh mov cx,15h mov dl,00h mov dh,00H mov bp,offset msg110 mov ah,13h int 10h mov ah,07h int 21h CALL SIMPLE MOV AH,4CH INT 21h disp1 proc ; module for display of mov ah, 09h ; a string on screen int 21h ret disp1 endp readch proc ; module for reading a mov ah, 01h ; character from keyboard int 21h ret readch endp read1 proc ; module for reading mov [buffer1], 80 ; first string lea dx, buffer1 mov ah, 0ah ; read string from keyboard int 21h mov bl, buffer1[1] mov bh, 0 add bx, 2 mov buffer1[bx], 0 ; ASCIIZ string, so ret ; terminate with 0 read1 endp read2 proc ; module for reading lea dx, buffer2 ; second string mov ah, 0ah int 21h mov bl, buffer2[1] mov bh, 0 add bx, 2 mov buffer2[bx], 0 ret read2 endp SIMPLE proc MOV AL,03H MOV AH,00H INT 10H RET SIMPLE endp code ends END start
Sources/Library/exceptions.ads
ForYouEyesOnly/Space-Convoy
1
11402
<filename>Sources/Library/exceptions.ads -- -- Jan & <NAME>, Australia, July 2011 -- -- -- Usage if the purpose is to "catch all": -- -- begin -- .. -- exception -- when Exception_Id : others => Show_Exception (Exception_Id); -- end; -- with Ada.Exceptions; use Ada.Exceptions; package Exceptions is procedure Show_Exception (Exception_Identifier : Exception_Occurrence; Optional_Message : String := ""); end Exceptions;
src/asf-converters-dates.adb
jquorning/ada-asf
12
27390
----------------------------------------------------------------------- -- asf-converters-dates -- Date Converters -- Copyright (C) 2011, 2012, 2013, 2014, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Exceptions; with Util.Properties.Bundles; with Util.Beans.Objects.Time; with Util.Dates.Formats; with Util.Log.Loggers; with ASF.Applications.Main; package body ASF.Converters.Dates is -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ASF.Converters.Dates"); function Get_Date_Format (Mode : in Style_Type; Bundle : in ASF.Locales.Bundle) return String; function Get_Time_Format (Mode : in Style_Type; Bundle : in ASF.Locales.Bundle) return String; -- ------------------------------ -- Get the format to print the date. -- ------------------------------ function Get_Date_Format (Mode : in Style_Type; Bundle : in ASF.Locales.Bundle) return String is begin case Mode is when DEFAULT => return Bundle.Get ("faces.dates.default_date_format", "%x"); when SHORT => return Bundle.Get ("faces.dates.short_date_format", "%d/%m/%Y"); when MEDIUM => return Bundle.Get ("faces.dates.medium_date_format", "%b %d, %Y"); when LONG => return Bundle.Get ("faces.dates.long_date_format", "%B %d, %Y"); when FULL => return Bundle.Get ("faces.dates.full_date_format", "%A, %B %d, %Y"); end case; end Get_Date_Format; -- ------------------------------ -- Get the format to print the time. -- ------------------------------ function Get_Time_Format (Mode : in Style_Type; Bundle : in ASF.Locales.Bundle) return String is begin case Mode is when DEFAULT => return Bundle.Get ("faces.dates.default_time_format", "%X"); when SHORT => return Bundle.Get ("faces.dates.short_time_format", "%H:%M"); when MEDIUM => return Bundle.Get ("faces.dates.medium_time_format", "%H:%M"); when LONG => return Bundle.Get ("faces.dates.long_time_format", "%H:%M:%S"); when FULL => return Bundle.Get ("faces.dates.full_time_format", "%H:%M:%S %Z"); end case; end Get_Time_Format; -- ------------------------------ -- Get the date format pattern that must be used for formatting a date on the given component. -- ------------------------------ function Get_Pattern (Convert : in Date_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class; Bundle : in ASF.Locales.Bundle; Component : in ASF.Components.Base.UIComponent'Class) return String is begin case Convert.Format is when BOTH => return Get_Date_Format (Convert.Time_Style, Bundle); when TIME => return Get_Time_Format (Convert.Time_Style, Bundle); when DATE => return Get_Date_Format (Convert.Date_Style, Bundle); when CONVERTER_PATTERN => return Ada.Strings.Unbounded.To_String (Convert.Pattern); when COMPONENT_FORMAT => return Component.Get_Attribute (Context => Context, Name => "format", Default => "%x"); end case; end Get_Pattern; -- ------------------------------ -- Get the locale that must be used to format the date. -- ------------------------------ function Get_Locale (Convert : in Date_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Util.Locales.Locale is use type Util.Locales.Locale; begin if Convert.Locale /= Util.Locales.NULL_LOCALE then return Convert.Locale; else return Context.Get_Locale; end if; end Get_Locale; -- ------------------------------ -- Convert the object value into a string. The object value is associated -- with the specified component. -- If the string cannot be converted, the Invalid_Conversion exception should be raised. -- ------------------------------ function To_String (Convert : in Date_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class; Component : in ASF.Components.Base.UIComponent'Class; Value : in Util.Beans.Objects.Object) return String is Locale : constant Util.Locales.Locale := Date_Converter'Class (Convert).Get_Locale (Context); Bundle : ASF.Locales.Bundle; begin begin ASF.Applications.Main.Load_Bundle (Context.Get_Application.all, Name => "asf", Locale => Util.Locales.To_String (Locale), Bundle => Bundle); exception when E : Util.Properties.Bundles.NO_BUNDLE => Log.Error ("Cannot localize dates: {0}", Ada.Exceptions.Exception_Message (E)); end; -- Convert the value as a date here so that we can raise an Invalid_Conversion exception. declare Pattern : constant String := Date_Converter'Class (Convert).Get_Pattern (Context, Bundle, Component); Date : constant Ada.Calendar.Time := Util.Beans.Objects.Time.To_Time (Value); Result : constant String := Util.Dates.Formats.Format (Pattern, Date, Bundle); begin return Result; end; exception when E : others => raise Invalid_Conversion with Ada.Exceptions.Exception_Message (E); end To_String; -- ------------------------------ -- Convert the date string into an object for the specified component. -- If the string cannot be converted, the Invalid_Conversion exception should be raised. -- ------------------------------ function To_Object (Convert : in Date_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class; Component : in ASF.Components.Base.UIComponent'Class; Value : in String) return Util.Beans.Objects.Object is Locale : constant Util.Locales.Locale := Date_Converter'Class (Convert).Get_Locale (Context); Bundle : ASF.Locales.Bundle; begin begin ASF.Applications.Main.Load_Bundle (Context.Get_Application.all, Name => "asf", Locale => Util.Locales.To_String (Locale), Bundle => Bundle); exception when E : Util.Properties.Bundles.NO_BUNDLE => Log.Error ("Cannot localize dates: {0}", Ada.Exceptions.Exception_Message (E)); end; -- Convert the string to a date here so that we can raise an Invalid_Conversion exception. declare Pattern : constant String := Date_Converter'Class (Convert).Get_Pattern (Context, Bundle, Component); Date : Util.Dates.Date_Record; begin Log.Debug ("Date conversion '{0}' with pattern '{1}'", Value, Pattern); Date := Util.Dates.Formats.Parse (Pattern => Pattern, Date => Value, Bundle => Bundle); return Util.Beans.Objects.Time.To_Object (Date.Date); exception when E : others => Log.Error ("Date '{0}' does not match pattern '{1}'", Value, Pattern); raise Invalid_Conversion with Ada.Exceptions.Exception_Message (E); end; end To_Object; -- ------------------------------ -- Create a date converter. -- ------------------------------ function Create_Date_Converter (Date : in Style_Type; Time : in Style_Type; Format : in Format_Type; Locale : in String; Pattern : in String) return Date_Converter_Access is use Ada.Strings.Unbounded; L : constant Util.Locales.Locale := Util.Locales.Get_Locale (Locale); begin if Pattern'Length > 0 then return new Date_Converter '(Date_Style => Date, Time_Style => Time, Locale => L, Format => CONVERTER_PATTERN, Pattern => To_Unbounded_String (Pattern)); else return new Date_Converter '(Date_Style => Date, Time_Style => Time, Format => Format, Locale => L, Pattern => Null_Unbounded_String); end if; end Create_Date_Converter; end ASF.Converters.Dates;
oeis/313/A313740.asm
neoneye/loda-programs
11
175800
<gh_stars>10-100 ; A313740: Coordination sequence Gal.5.309.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME> ; 1,5,10,15,20,25,31,37,43,49,55,60,65,70,75,80,85,90,95,100,105,111,117,123,129,135,140,145,150,155,160,165,170,175,180,185,191,197,203,209,215,220,225,230,235,240,245,250,255,260 mov $1,$0 add $0,1 add $0,$1 add $0,1 mov $2,$1 mov $3,$1 sub $1,5 trn $3,1 add $0,$3 add $0,4 lpb $1 add $0,$1 sub $0,1 trn $1,5 sub $0,$1 add $0,1 trn $1,10 lpe sub $0,3 lpb $2 add $0,2 sub $2,1 lpe sub $0,2
arch/ARM/STM32/svd/stm32f46_79x/stm32_svd-dbg.ads
rocher/Ada_Drivers_Library
192
18951
<reponame>rocher/Ada_Drivers_Library -- This spec has been automatically generated from STM32F46_79x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.DBG is pragma Preelaborate; --------------- -- Registers -- --------------- subtype DBGMCU_IDCODE_DEV_ID_Field is HAL.UInt12; subtype DBGMCU_IDCODE_REV_ID_Field is HAL.UInt16; -- IDCODE type DBGMCU_IDCODE_Register is record -- Read-only. DEV_ID DEV_ID : DBGMCU_IDCODE_DEV_ID_Field; -- unspecified Reserved_12_15 : HAL.UInt4; -- Read-only. REV_ID REV_ID : DBGMCU_IDCODE_REV_ID_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DBGMCU_IDCODE_Register use record DEV_ID at 0 range 0 .. 11; Reserved_12_15 at 0 range 12 .. 15; REV_ID at 0 range 16 .. 31; end record; subtype DBGMCU_CR_TRACE_MODE_Field is HAL.UInt2; -- Control Register type DBGMCU_CR_Register is record -- DBG_SLEEP DBG_SLEEP : Boolean := False; -- DBG_STOP DBG_STOP : Boolean := False; -- DBG_STANDBY DBG_STANDBY : Boolean := False; -- unspecified Reserved_3_4 : HAL.UInt2 := 16#0#; -- TRACE_IOEN TRACE_IOEN : Boolean := False; -- TRACE_MODE TRACE_MODE : DBGMCU_CR_TRACE_MODE_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DBGMCU_CR_Register use record DBG_SLEEP at 0 range 0 .. 0; DBG_STOP at 0 range 1 .. 1; DBG_STANDBY at 0 range 2 .. 2; Reserved_3_4 at 0 range 3 .. 4; TRACE_IOEN at 0 range 5 .. 5; TRACE_MODE at 0 range 6 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Debug MCU APB1 Freeze registe type DBGMCU_APB1_FZ_Register is record -- DBG_TIM2_STOP DBG_TIM2_STOP : Boolean := False; -- DBG_TIM3 _STOP DBG_TIM3_STOP : Boolean := False; -- DBG_TIM4_STOP DBG_TIM4_STOP : Boolean := False; -- DBG_TIM5_STOP DBG_TIM5_STOP : Boolean := False; -- DBG_TIM6_STOP DBG_TIM6_STOP : Boolean := False; -- DBG_TIM7_STOP DBG_TIM7_STOP : Boolean := False; -- DBG_TIM12_STOP DBG_TIM12_STOP : Boolean := False; -- DBG_TIM13_STOP DBG_TIM13_STOP : Boolean := False; -- DBG_TIM14_STOP DBG_TIM14_STOP : Boolean := False; -- unspecified Reserved_9_10 : HAL.UInt2 := 16#0#; -- DBG_WWDG_STOP DBG_WWDG_STOP : Boolean := False; -- DBG_IWDEG_STOP DBG_IWDEG_STOP : Boolean := False; -- unspecified Reserved_13_20 : HAL.UInt8 := 16#0#; -- DBG_J2C1_SMBUS_TIMEOUT DBG_J2C1_SMBUS_TIMEOUT : Boolean := False; -- DBG_J2C2_SMBUS_TIMEOUT DBG_J2C2_SMBUS_TIMEOUT : Boolean := False; -- DBG_J2C3SMBUS_TIMEOUT DBG_J2C3SMBUS_TIMEOUT : Boolean := False; -- unspecified Reserved_24_24 : HAL.Bit := 16#0#; -- DBG_CAN1_STOP DBG_CAN1_STOP : Boolean := False; -- DBG_CAN2_STOP DBG_CAN2_STOP : Boolean := False; -- unspecified Reserved_27_31 : HAL.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DBGMCU_APB1_FZ_Register use record DBG_TIM2_STOP at 0 range 0 .. 0; DBG_TIM3_STOP at 0 range 1 .. 1; DBG_TIM4_STOP at 0 range 2 .. 2; DBG_TIM5_STOP at 0 range 3 .. 3; DBG_TIM6_STOP at 0 range 4 .. 4; DBG_TIM7_STOP at 0 range 5 .. 5; DBG_TIM12_STOP at 0 range 6 .. 6; DBG_TIM13_STOP at 0 range 7 .. 7; DBG_TIM14_STOP at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; DBG_WWDG_STOP at 0 range 11 .. 11; DBG_IWDEG_STOP at 0 range 12 .. 12; Reserved_13_20 at 0 range 13 .. 20; DBG_J2C1_SMBUS_TIMEOUT at 0 range 21 .. 21; DBG_J2C2_SMBUS_TIMEOUT at 0 range 22 .. 22; DBG_J2C3SMBUS_TIMEOUT at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; DBG_CAN1_STOP at 0 range 25 .. 25; DBG_CAN2_STOP at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; -- Debug MCU APB2 Freeze registe type DBGMCU_APB2_FZ_Register is record -- TIM1 counter stopped when core is halted DBG_TIM1_STOP : Boolean := False; -- TIM8 counter stopped when core is halted DBG_TIM8_STOP : Boolean := False; -- unspecified Reserved_2_15 : HAL.UInt14 := 16#0#; -- TIM9 counter stopped when core is halted DBG_TIM9_STOP : Boolean := False; -- TIM10 counter stopped when core is halted DBG_TIM10_STOP : Boolean := False; -- TIM11 counter stopped when core is halted DBG_TIM11_STOP : Boolean := False; -- unspecified Reserved_19_31 : HAL.UInt13 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DBGMCU_APB2_FZ_Register use record DBG_TIM1_STOP at 0 range 0 .. 0; DBG_TIM8_STOP at 0 range 1 .. 1; Reserved_2_15 at 0 range 2 .. 15; DBG_TIM9_STOP at 0 range 16 .. 16; DBG_TIM10_STOP at 0 range 17 .. 17; DBG_TIM11_STOP at 0 range 18 .. 18; Reserved_19_31 at 0 range 19 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Debug support type DBG_Peripheral is record -- IDCODE DBGMCU_IDCODE : aliased DBGMCU_IDCODE_Register; -- Control Register DBGMCU_CR : aliased DBGMCU_CR_Register; -- Debug MCU APB1 Freeze registe DBGMCU_APB1_FZ : aliased DBGMCU_APB1_FZ_Register; -- Debug MCU APB2 Freeze registe DBGMCU_APB2_FZ : aliased DBGMCU_APB2_FZ_Register; end record with Volatile; for DBG_Peripheral use record DBGMCU_IDCODE at 16#0# range 0 .. 31; DBGMCU_CR at 16#4# range 0 .. 31; DBGMCU_APB1_FZ at 16#8# range 0 .. 31; DBGMCU_APB2_FZ at 16#C# range 0 .. 31; end record; -- Debug support DBG_Periph : aliased DBG_Peripheral with Import, Address => System'To_Address (16#E0042000#); end STM32_SVD.DBG;
Library/Text/TextAttr/taRunQuery.asm
steakknife/pcgeos
504
97565
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: User/Text FILE: taRunQuery.asm ROUTINES: Name Description ---- ----------- Routines available to the rest of the text object EXT TA_GraphicRunLength Return the number of characters before a graphic EXT TA_CharAttrRunLengthAndInfo Return the number of characters in the same charAttr starting at a given position and return the font, point size and text charAttr for that position EXT TA_CharAttrRunSetupGStateForCalc Set up the cached gstate for calculation EXT TA_FillTextAttrForTextDraw Fill a TextAttr structure with the attr for this run REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/89 Initial version DESCRIPTION: This file contains the internal routines to handle charAttr, paraAttr and type runs. None of these routines are directly accessable outisde the text object. $Id: taRunQuery.asm,v 1.1 97/04/07 11:18:59 newdeal Exp $ ------------------------------------------------------------------------------@ Text segment resource TextFixed segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: TA_GraphicRunLength DESCRIPTION: Return the number of characters before the next graphic CALLED BY: INTERNAL PASS: *ds:si - text object dx.ax - offset into text RETURN: dx.ax - number of characters until next graphic DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/89 Initial version ------------------------------------------------------------------------------@ TA_GraphicRunLength proc far uses di .enter class VisTextClass EC < call T_AssertIsVisText > call TextFixed_DerefVis_DI test ds:[di].VTI_storageFlags, mask VTSF_GRAPHICS jnz multiple ; one charAttr mov dx, TEXT_ADDRESS_PAST_END_HIGH mov ax, TEXT_ADDRESS_PAST_END_LOW done: .leave ret ; multiple charAttrs multiple: call GraphicRunMultiple jmp done TA_GraphicRunLength endp TextFixed ends ;--- TextAttributes segment resource GraphicRunMultiple proc far uses bx, cx, si, ds .enter pushdw dxax call GetGraphicRunForPosition ;dx.ax = position call RunArrayUnlock popdw cxbx ;cx.bx = position passed subdw dxax, cxbx ;dx.ax = runpos - passed .leave ret GraphicRunMultiple endp TextAttributes ends TextFixed segment COMMENT @---------------------------------------------------------------------- FUNCTION: TA_GetCharAttrForPosition DESCRIPTION: Find charAttr for position CALLED BY: INTERNAL PASS: *ds:si - text object dx.ax - position cl - GetCharAttrForPositionTypes ss:bp - buffer for VisTextCharAttr RETURN: dx.ax - number of consecutive characters DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/89 Initial version ------------------------------------------------------------------------------@ TA_GetCharAttrForPosition proc far uses di, es .enter class VisTextClass EC < cmp cl, GetCharAttrForPositionTypes > EC < ERROR_AE VIS_TEXT_GET_CHAR_ATTR_FOR_POSITION_ILLEGAL_TYPE > EC < call T_AssertIsVisText > call TextFixed_DerefVis_DI ; set stuff from charAttr structure test ds:[di].VTI_storageFlags,mask VTSF_MULTIPLE_CHAR_ATTRS jnz multiple ; one charAttr call GetSingleCharAttr movdw dxax, TEXT_ADDRESS_PAST_END done: segmov es, ss mov di, bp call CharAttrVirtualToPhysical .leave ret ; multiple charAttrs multiple: call GetCharAttrMultiple jmp done TA_GetCharAttrForPosition endp COMMENT @---------------------------------------------------------------------- FUNCTION: CharAttrVirtualToPhysical DESCRIPTION: Convert a virtual charAttr to a physical charAttr CALLED BY: INTERNAL PASS: dxax - number of characters that run is valid for *ds:si - text object es:di - virtual charAttr RETURN: dxax - number of characters that run is valid for es:di - physical charAttr DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 4/90 Initial version ------------------------------------------------------------------------------@ CharAttrVirtualToPhysical proc far class VisLargeTextClass push di call TextFixed_DerefVis_DI test ds:[di].VTI_storageFlags, mask VTSF_LARGE jz notSpecialDraftMode cmp ds:[di].VLTI_displayMode, VLTDM_DRAFT_WITHOUT_STYLES jz specialDraftMode notSpecialDraftMode: test ds:[di].VTI_state, mask VTS_SUBCLASS_VIRT_PHYS_TRANSLATION pop di jz done push ax, cx, dx, bp mov cx, es mov dx, di mov ax, MSG_VIS_TEXT_CHAR_ATTR_VIRTUAL_TO_PHYSICAL call ObjCallInstanceNoLock pop ax, cx, dx, bp done: ret specialDraftMode: pop di push cx, si, bp, ds sub sp, size VisTextCharAttr mov bp, sp call T_GetSystemCharAttr segmov ds, ss mov si, bp push di mov cx, (size VisTextCharAttr) / 2 rep movsw pop di add sp, size VisTextCharAttr pop cx, si, bp, ds movdw dxax, TEXT_ADDRESS_PAST_END jmp done CharAttrVirtualToPhysical endp TextFixed ends ;--- TextAttributes segment resource GetCharAttrMultiple proc far uses bx, cx, si, ds class VisTextClass .enter pushdw dxax mov bx, offset VTI_charAttrRuns cmp cl, GSFPT_MANIPULATION jz charAttrRight push ax mov ax, ATTR_VIS_TEXT_CHAR_ATTR_INSERTION_TOKEN call ObjVarFindData pop ax jnc noInsertionToken push ds:[bx] mov bx, offset VTI_charAttrRuns call GetRunForPosition pop bx jmp charAttrCommon noInsertionToken: mov bx, offset VTI_charAttrRuns call TSL_IsParagraphStart jc charAttrRight ; if we're at the end of the text then use the attributes to the ; right in case there is a run hanging out at the end movdw cxdi, dxax ;save position call TS_GetTextSize cmpdw dxax, cxdi movdw dxax, cxdi jz charAttrRight call GetRunForPositionLeft jmp charAttrCommon charAttrRight: call GetRunForPosition charAttrCommon: ; ds:si = run, dx.ax = pos, bx = token call GetElement call RunArrayNext popdw cxbx subdw dxax, cxbx call RunArrayUnlock .leave ret GetCharAttrMultiple endp TextAttributes ends COMMENT @---------------------------------------------------------------------- FUNCTION: CharAttrRunSetupGStateForCalc DESCRIPTION: Set up the cached gstate for calculation CALLED BY: INTERNAL PASS: *ds:si - VisTextInstance dx.ax - offset into text RETURN: di - gstate DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/89 Initial version ------------------------------------------------------------------------------@ TextInstance segment resource TA_CharAttrRunSetupGStateForCalc proc near class VisTextClass uses ax, bx, cx, dx, bp EC < call T_AssertIsVisText > ; allocate local vars .enter sub sp, size VisTextCharAttr mov bp, sp mov cl, GSFPT_MANIPULATION ;get charAttr to the right call TA_GetCharAttrForPosition mov di, ds:[si] add di, ds:[di].Vis_offset mov di, ds:[di].VTI_gstate ; set the font and point size mov cx, ss:[bp].VTCA_fontID mov dx, ss:[bp].VTCA_pointSize.WBF_int mov ah, ss:[bp].VTCA_pointSize.WBF_frac call GrSetFont ; set the text charAttr mov al, ss:[bp].VTCA_textStyles mov ah, 0xff call GrSetTextStyle ; set the track kerning mov ax, {word} ss:[bp].VTCA_trackKerning call GrSetTrackKern add sp,size VisTextCharAttr .leave ret TA_CharAttrRunSetupGStateForCalc endp TextInstance ends COMMENT @---------------------------------------------------------------------- FUNCTION: TA_FillTextAttrForDraw DESCRIPTION: Fill a TextAttr structure with the attr for this run CALLED BY: EXTERNAL PASS: *ds:si - text object bx:di - TextAttr structure dx.ax - position in the text cx - VisTextExtendedStyles RETURN: dx.ax - #characters in run DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/25/91 Initial version LES 6/13/00 Now returns extended styles ------------------------------------------------------------------------------@ TA_FarFillTextAttrForDraw proc far call TA_FillTextAttrForDraw ret TA_FarFillTextAttrForDraw endp TA_FillTextAttrForDraw proc near class VisTextClass uses bx, si, bp, es .enter EC < call T_AssertIsVisText > sub sp, size VisTextCharAttr mov bp, sp mov es, bx ; set es:di -> passed buffer mov cl, GSFPT_MANIPULATION ; get charAttr to the right call TA_GetCharAttrForPosition ; Get charAttr information. pushdw dxax ; Save # of chars ; ; Test for VA_FULLY_ENABLED being set or VTF_USE_50_PCT_TEXT_MASK being ; clear. If either is true, we'll be forcing the draw mask to SDM_50. ; call Text_DerefVis_SI test ds:[si].VI_attrs, mask VA_FULLY_ENABLED stc ; assume doing 50 pct jz 5$ test ds:[si].VTI_features, mask VTF_USE_50_PCT_TEXT_MASK jz 5$ stc ; set, do 50 pct 5$: pushf ; save fully enabled flag for later... ; ; set the font and point size ; mov ax, ss:[bp].VTCA_fontID mov es:[di].TA_font, ax ; save font mov ax, ss:[bp].VTCA_pointSize.WBF_int mov es:[di].TA_size.WBF_int, ax ; save point size mov al, ss:[bp].VTCA_pointSize.WBF_frac mov es:[di].TA_size.WBF_frac, al mov ax, {word} ss:[bp].VTCA_trackKerning mov {word} es:[di].TA_trackKern, ax ; ; set the color, map mode ; mov ax, ss:[bp].VTCA_color.low if USE_COLOR_FOR_DISABLED_GADGETS popf pushf jnc 8$ ; not disabled, leave color same mov ax, DISABLED_COLOR 8$: endif mov es:[di].TA_color.low, ax mov ax, ss:[bp].VTCA_color.high mov es:[di].TA_color.high, ax mov ax, {word} ss:[bp].VTCA_pattern stuffPattern:: mov {word} es:[di].TA_pattern, ax ; ; set the gray screen ; mov al, ss:[bp].VTCA_grayScreen popf ; restore enabled flag if not USE_COLOR_FOR_DISABLED_GADGETS jnc 10$ ; Not doing 50%, branch mov al, SDM_50 ; else use the all-powerful 50% 10$: endif mov es:[di].TA_mask, al ; save draw mask ; ; set the text charAttr ; mov al, ss:[bp].VTCA_textStyles mov ah, 0ffh mov {word} es:[di].TA_styleSet, ax ; save charAttr ; ; set mode to text object defaults ; mov ax, mask TM_DRAW_BASE mov {word} es:[di].TA_modeSet, ax ; save mode ; ; Set the font weight & width ; mov ax, {word}ss:[bp].VTCA_fontWeight mov {word} es:[di].TA_fontWeight, ax CheckHack <(offset VTCA_fontWidth) eq (offset VTCA_fontWeight)+1> CheckHack <(offset TA_fontWidth) eq (offset TA_fontWeight)+1> ;============================================================================= popdw dxax ; ; Check for any extended styles and return the carry set if there are mov bp, ss:[bp].VTCA_extendedStyles ; Return the extended styles as well. mov cx, bp add sp, size VisTextCharAttr tst bp ; (clears the carry) jz quit ; Branch if none stc ; Signal: contains ext-styles quit: .leave ret TA_FillTextAttrForDraw endp TextFixed segment COMMENT @---------------------------------------------------------------------- FUNCTION: TA_GetParaAttrForPosition DESCRIPTION: Find paraAttr for position CALLED BY: INTERNAL PASS: *ds:si - VisTextInstance dx.ax - position in text bx - Y position (only needed for large objects) cx - region number (only needed for large objects) di - Height of line at that offset ss:bp - buffer for VisTextCharAttr RETURN: dx.ax - start of range covered by this paraAttr cx.bx - end of range covered by this paraAttr buffer - filled DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/89 Initial version ------------------------------------------------------------------------------@ TA_GetParaAttrForPosition proc far uses di, es region local word push cx yPosition local word push bx lineHeight local word push di class VisTextClass .enter EC < call T_AssertIsVisText > push bp mov bp, ss:[bp] call TextFixed_DerefVis_DI test ds:[di].VTI_storageFlags, mask VTSF_MULTIPLE_PARA_ATTRS jnz multiple ; one paraAttr call GetSingleParaAttr clr ax ;return range -- whole object clr dx mov cx, TEXT_ADDRESS_PAST_END_HIGH mov bx, TEXT_ADDRESS_PAST_END_LOW jmp done ; multiple paraAttrs multiple: call GetParaAttrMultiple done: pop bp ;recover frame pointer push ax, bx, cx, dx mov cx, region mov bx, yPosition mov dx, lineHeight segmov es, ss mov di, ss:[bp] call ParaAttrVirtualToPhysical tst ax ;test "valid for all" flag pop ax, bx, cx, dx jz exit clrdw dxax movdw cxbx, TEXT_ADDRESS_PAST_END exit: .leave ret TA_GetParaAttrForPosition endp TextFixed ends TextAttributes segment resource GetParaAttrMultiple proc far uses si, ds class VisTextClass .enter mov bx, offset VTI_paraAttrRuns call GetRunForPosition ; ds:si = run, dx.ax = pos, bx = token call GetElement pushdw dxax ;save position call RunArrayNext movdw cxbx, dxax ;cxbx = range end popdw dxax ;dxax = range start call RunArrayUnlock .leave ret GetParaAttrMultiple endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VisTextGetRunBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the bounds of the current run type CALLED BY: GLOBAL PASS: ss:bp - VisTextGetRunBoundsParams RETURN: nada DESTROYED: ax, bx, dx, si, bp, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 2/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VisTextGetRunBounds proc far ;MSG_VIS_TEXT_GET_RUN_BOUNDS mov bx, ss:[bp].VTGRBP_type movdw dxax, ss:[bp].VTGRBP_position movdw esbp, ss:[bp].VTGRBP_retVal FALL_THRU TA_GetRunBounds VisTextGetRunBounds endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TA_GetRunBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the bounds of the current run type CALLED BY: INTERNAL VisTextGetRunBounds FindRangeForHyperlink PASS: *ds:si = text object bx = offset for run dx.ax = position es:bp = VisTextRange to fill in RETURN: es:bp = VisTextRange filled with run bounds DESTROYED: ax, dx, si, ds SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jenny 8/15/94 Broke out of VisTextGetRunBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TA_GetRunBounds proc far call GetRunForPosition movdw es:[bp].VTR_start, dxax call RunArrayNext movdw es:[bp].VTR_end, dxax call RunArrayUnlock ret TA_GetRunBounds endp TextAttributes ends TextFixed segment COMMENT @---------------------------------------------------------------------- FUNCTION: ParaAttrVirtualToPhysical DESCRIPTION: Convert a virtual paraAttr to a physical paraAttr CALLED BY: INTERNAL PASS: cx - region number bx - Y position in region dx - Integer height of the line at that position *ds:si - text object es:di - virtual paraAttr RETURN: ax - non-zero if this para attr is good for the entire document es:di - physical paraAttr VTR_{left,para,right}Margin - adjusted DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: * Adjust the margins of a paraAttr to reflect the constraints imposed by the vis bounds * Adjust all positions from points*8 to points (except VTR_defaultTabs) REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 4/90 Initial version ------------------------------------------------------------------------------@ ParaAttrVirtualToPhysical proc far class VisLargeTextClass uses bx, cx, dx, bp .enter push dx ;save line height at <bx> push di ;save pointer to virtual attrs call TextFixed_DerefVis_DI ;ds:di <- instance ; ; Load up some default values for use later in the routine ; dl = VisTextStates ; ax = Non-zero if these attributes are good for the entire document ; mov dl, ds:[di].VTI_state clr ax ;assume not valid for whole obj ; ; Check for draft mode ; test ds:[di].VTI_storageFlags, mask VTSF_LARGE jz notSpecialDraftMode cmp ds:[di].VLTI_displayMode, VLTDM_DRAFT_WITHOUT_STYLES jnz notSpecialDraftMode ; ; Special draft mode ; ; For draft mode we use some standard paragraph attributes ; (reflected by VIS_TEXT_INITIAL_PARA_ATTR). ; ; Below we expand these default attributes into a VisTextParaAttr ; structure and then copy that structure into the destination ; buffer that was passed to us on the stack. ; pop di ;es:di <- ptr to virtual attrs push si, bp, ds ;save instance, ???? sub sp, size VisTextParaAttr mov bp, sp ;ss:bp <- ptr to VisTextAttr mov ax, VIS_TEXT_INITIAL_PARA_ATTR call TextMapDefaultParaAttr ;map attributes into ss:bp segmov ds, ss ;ds:si <- source attributes mov si, bp push di ;save dest offset mov cx, (size VisTextParaAttr) / 2 rep movsw ;copy attributes to destination pop di ;restore dest offset add sp, size VisTextParaAttr ;restore stack pop si, bp, ds ;restore instance, ??? ; ; For draft mode, there are no subclasses interested in mapping ; the attributes. ; clr dx ;no sublcass in special draft ; ; For draft mode, the attributes are valid for the entire object ; mov ax, 1 ;valid for entire object push di ;put dest offset back on stack ;so it can be popped below notSpecialDraftMode: pop di mov bp, dx ;bp = VisTextStates to use pop dx ;dx <- line height at <bx> ; ; ax = Non-zero if the attributes are valid for the entire object ; bp = VisTextStates for the object ; ; cx = Region ; bx = Y position in the region ; dx = Line height at <bx> ; push ax ;save valid flag push di call TextFixed_DerefVis_DI ; ; Compute width of object ; mov_tr ax, cx ;ax = region number mov cx, ds:[di].VI_bounds.R_right sub cx, ds:[di].VI_bounds.R_left ;cx = right - left ; ; For large objects (width of zero) we must look at the region ; tst cx jnz gotWidth ;branch if no region to check largeObject:: ; ; We are in a large object that has regions. We need to get the width ; of the region at this point, given the line height ; mov_tr cx, ax ;cx <- region push bx ;save y position clr bx ;not for bit-blt call TR_RegionGetTrueWidth ;ax <- true width pop bx ;restore y position push ax ;save true width xchg dx, bx ;dx <- y position ;bx <- height of line at <dx> call TR_RegionLeftRight ;ax <- left ;bx <- right mov cx, bx ;cx <- width sub cx, ax pop dx ;dx <- true width pop di jmp afterLRMarginAdjust gotWidth: clr ax mov al, ds:[di].VTI_lrMargin shl ax sub cx, ax ;cx = width (considering bounds) clr ax ;ax <- left edge mov bx, cx ;bx <- right edge test ds:[di].VTI_state, mask VTS_ONE_LINE jz skipOneLineRightEdge mov bx, VIS_TEXT_ONE_LINE_RIGHT_MARGIN skipOneLineRightEdge: mov dx, cx ;dx <- true width pop di afterLRMarginAdjust: ; ; es:di = Virtual paragraph attributes ; ax = Left edge of area ; bx = Right edge of area ; cx = Width of area ; dx = True width of area ; ; Convert the margins to pixel positions, store the new values and ; keep the left and para margins push ax ;save left edge mov ax, offset VTPA_rightMargin call RoundParaAttrPos mov ax, offset VTPA_paraMargin call RoundParaAttrPos mov ax, offset VTPA_leftMargin call RoundParaAttrPos ;ax = left margin pop ax ;restore left edge push bx ; save right edge of area ; ; The left, paragraph, and right margins can now be adjusted. ; ; If the margins are greater than the indentation associated with ; the region, then they are not affected. Otherwise they are set ; to be the amount of the indentation. ; ; ; The right margin is the distance from the right edge of the region, ; assuming the square region. To figure this correctly, we need to ; get the "true" width of the region in order to know where the ; right edge was originally. ; ; ; Since later we will be assuming that the right margin contains ; the indent from the right edge of the area, we will want to store ; in VTPA_rightMargin the distance to indent from the right edge ; of the flow-region. ; ; This value is one of: ; rightIndent > rightMargin :: rightMargin <- 0 ; rightIndent < rightMargin :: rightMargin <- rm - ri ; sub dx, bx ; dx <- right edge indent ; Always positive or zero clr bx ; Assume rIndent > rMargin cmp dx, es:[di].VTPA_rightMargin jae 10$ mov bx, es:[di].VTPA_rightMargin ; bx <- rMargin - rIndent sub bx, dx 10$: mov es:[di].VTPA_rightMargin, bx ; Save temp right margin ; ; Adjust the left and paragraph margins ; cmp es:[di].VTPA_leftMargin, ax jae 20$ mov es:[di].VTPA_leftMargin, ax 20$: cmp es:[di].VTPA_paraMargin, ax jae 30$ mov es:[di].VTPA_paraMargin, ax 30$: mov_tr bx, es:[di].VTPA_paraMargin ;bx = para margin ; check for one line object -- if so then replace the visual width ; with the virtual width of a one line object test bp, mask VTS_ONE_LINE jz notOneLine mov cx, VIS_TEXT_ONE_LINE_RIGHT_MARGIN notOneLine: ; compute the maximum legal value for the left and para margins sub cx, VIS_TEXT_MIN_TEXT_FIELD_WIDTH ;cx = max left/para jae notTooNarrow clr cx notTooNarrow: add cx, ax ;cx = min margin setting ; keep the left and para margins within bounds cmp ax, cx jbe leftOK mov ax, cx mov es:[di].VTPA_leftMargin, cx leftOK: cmp bx, cx jbe paraOK mov bx, cx mov es:[di].VTPA_paraMargin, cx paraOK: ; find the greater of the left and para margins cmp ax, bx jae gotLeftPara mov_tr ax, bx gotLeftPara: ; ; compute the minimum legal right margin -- this is the greater ; of the left and para margins plus the minimum field witdh ; This cannot be wider than the object, however ; ; ax = Greater of the *real* left and paragraph margins. ; (That is, the real position of the margin as an offset ; from the left edge of the region). ; On Stack: ; Width of the object ; add ax, VIS_TEXT_MIN_TEXT_FIELD_WIDTH ;ax = min right margin pop cx ;cx = object width cmp ax, cx jbe minimumRightIsLegal mov ax, cx minimumRightIsLegal: ; ; ax = Minimum position for the right margin ; cx = Right edge of flow region ; sub cx, es:[di].VTPA_rightMargin ; ; cx = right margin (right edge of object minus RM value) ; ax = minimum right margin (from left/para margins) ; cmp cx, ax jge storeRightMargin ;sign compare in case cx < 0 mov_tr cx, ax storeRightMargin: ; ; cx = Value for right margin ; mov es:[di].VTPA_rightMargin, cx ; convert tab positions clr cx mov cl, es:[di].VTPA_numberOfTabs jcxz afterTabs CheckHack <(offset T_position eq 0) mov ax, offset VTPA_tabList tabLoop: push ax call RoundParaAttrPos pop ax add ax, size Tab loop tabLoop afterTabs: test bp, mask VTS_SUBCLASS_VIRT_PHYS_TRANSLATION jz noSubclass mov cx, es mov dx, di mov ax, MSG_VIS_TEXT_PARA_ATTR_VIRTUAL_TO_PHYSICAL call ObjCallInstanceNoLock noSubclass: pop ax .leave ret ParaAttrVirtualToPhysical endp COMMENT @---------------------------------------------------------------------- FUNCTION: RoundParaAttrPos DESCRIPTION: Round a paraAttr position CALLED BY: INTERNAL PASS: es:[di][ax] - position (points * 8) RETURN: ax, es:[di][ax] - position rounded DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/25/91 Initial version ------------------------------------------------------------------------------@ RoundParaAttrPos proc near uses bp .enter add ax, di mov_tr bp, ax mov ax, es:[bp] add ax, 4 shr ax shr ax shr ax mov es:[bp], ax .leave ret RoundParaAttrPos endp TextFixed ends COMMENT @---------------------------------------------------------------------- FUNCTION: TA_IsPositionAtParaAttrBoundry DESCRIPTION: Decide if a position falls at the start of a paraAttr run. CALLED BY: INTERNAL PASS: *ds:si - text object dx.ax - position RETURN: carry - set if the position is at the start of a paraAttr run. DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/25/91 Initial version ------------------------------------------------------------------------------@ if 0 TextAttributes segment resource TA_IsPositionAtParaAttrBoundry proc far uses ax, bx, cx, dx, si, di, ds class VisTextClass .enter push dx, ax mov bx, offset VTI_paraAttrRuns call GetTokenForPosition pop cx, bx ;cx.bx = passed position cmp dx, cx jz 10$ cmp ax, bx 10$: stc jz done clc done: .leave ret TA_IsPositionAtParaAttrBoundry endp TextAttributes ends endif COMMENT @---------------------------------------------------------------------- FUNCTION: TA_GetGraphicForPosition DESCRIPTION: Find a graphic element CALLED BY: GLOBAL PASS: *ds:si - text object dxax - position in text ss:bp - buffer for VisTextGraphic RETURN: buffer - filled DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ TextGraphic segment resource TA_GetGraphicForPosition proc near uses ax, bx, cx, dx, si, di, ds .enter ; find the correct run EC < pushdw cxbp > EC < pushdw dxax > call GetGraphicRunForPosition ;bx = token EC < popdw cxbp > EC < cmpdw dxax, cxbp > EC < ERROR_NZ NO_GRAPHIC_RUN_AT_GIVEN_POSITION > EC < popdw cxbp > ; get the element call GetElement EC < cmp ss:[bp].VTG_type, VisTextGraphicType > EC < ERROR_AE GRAPHIC_RUN_BAD_GRAPHIC_TYPE > call FarRunArrayUnlock .leave ret TA_GetGraphicForPosition endp COMMENT @---------------------------------------------------------------------- FUNCTION: TA_CheckForVariableGraphics DESCRIPTION: See if an object has any variable graphics CALLED BY: INTERNAL PASS: *ds:si - text object RETURN: carry - set if a variable graphics exists DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/13/92 Initial version ------------------------------------------------------------------------------@ TA_CheckForVariableGraphics proc near uses ax, bx, cx, si, di, ds .enter mov bx, OFFSET_FOR_GRAPHIC_RUNS call FarRunArrayLock ;ds:si = run array, di = token ;cx = count mov bx, ds:[si].TRAE_token mov dl, ds:[si].TRAE_position.WAAH_high searchLoop: cmp dl, TEXT_ADDRESS_PAST_END_HIGH clc jz done push si, di, ds mov_tr ax, bx ;ax = token call FarElementArrayLock call ChunkArrayElementToPtr cmp ds:[di].VTG_type, VTGT_VARIABLE call FarElementArrayUnlock pop si, di, ds stc jz done call FarRunArrayNext jmp searchLoop done: call FarRunArrayUnlock .leave ret TA_CheckForVariableGraphics endp COMMENT @---------------------------------------------------------------------- FUNCTION: VisTextUpdateGraphicElement DESCRIPTION: Update a graphic element CALLED BY: EXTERNAL PASS: *ds:si - text object ds:di - text instance ss:bp - new VisTextUpdateGraphicElementParams RETURN: ax - UpdateGraphicReturnValue DESTROYED: bx,si,di,ds,es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cassie 5/15/94 Initial version ------------------------------------------------------------------------------@ VisTextUpdateGraphicElement proc far ;MSG_VIS_TEXT_UPDATE_GRAPHIC_ELEMENT class VisTextClass uses cx,dx .enter EC < call T_AssertIsVisText > push ds:[LMBH_handle], si ;save text's optr call T_GetVMFile push bx ;save file handle mov di, ds:[si] add di, ds:[di].Vis_offset mov cl, ds:[di].VTI_storageFlags ;get storage flags EC < mov ax, ss:[bp].VTUGEP_flags > EC < and ax, not VisTextUpdateGraphicFlags > EC < ERROR_NZ VIS_TEXT_UPDATE_GRAPHIC_FLAGS_INVALID > segmov es, ss, ax lea di, ss:[bp].VTUGEP_graphic ;ds:di <- new graphic call TG_CheckIfValidGraphicElement LONG jc error ;ax <- VTUGRV ; get the graphic run push cx ;save storage flags mov bx, OFFSET_FOR_GRAPHIC_RUNS movdw dxax, ss:[bp].VTUGEP_position call GetGraphicRunForPosition ;bx = token, di - run token ; ds:si - run element pop cx EC < cmpdw dxax, ss:[bp].VTUGEP_position > EC < ERROR_NZ NO_GRAPHIC_RUN_AT_GIVEN_POSITION > mov_tr ax, bx ;ax = token call RunArrayUnref push bx, si, di ; ; get a pointer to the graphic element to be modified ; call FarElementArrayLock push cx ;save storage flags call ChunkArrayElementToPtr ;ds:di <- VisTextGraphic pop cx ;cl <- storage flags ; ; If this element has only one reference, or the caller wants all ; graphic runs with this graphic to be updated, we can modify ; this element, else we need to add a new element and point this ; graphic run at it. ; EC < cmp ds:[di].VTG_meta.REH_refCount.WAAH_high, EA_FREE_ELEMENT> EC < ERROR_Z TEXT_ATTRIBUTE_ELEMENT_IS_FREE > tst ds:[di].VTG_meta.REH_refCount.WAAH_high jnz checkAddNew cmp ds:[di].VTG_meta.REH_refCount.WAAH_low, 1 je modify ; only 1 element... checkAddNew: test ss:[bp].VTUGEP_flags, mask VTUGF_NEW_ELEMENT jnz addNew modify: ; ; copy the new graphic, less the RefElementHeader ; into the VisTextGraphic element ; push cx ;save storage flags mov cx, size RefElementHeader push si segxchg es, ds, ax ;es:di <- destination graphic add di, cx ; es:di <- VTG_vmChain lea si, ss:[bp].VTUGEP_graphic ;ds:si <- source graphic add si, cx ; ds:si <- VTG_vmChain neg cx add cx, size VisTextGraphic ;size of graphic less Ref rep movsb pop si pop cx ;restore storage flags ; ; mark the graphic element array dirty and unlock it ; segmov ds, es, ax ;*ds:si<- graphic element array test cl, mask VTSF_LARGE jz smallText call HugeArrayDirty ;mark the huge array dirty unlock: call FarElementArrayUnlock pop bx, si, di call RunArrayReref call FarRunArrayUnlock pop bx ;clear file handle from stack mov ax, UGRV_MODIFIED_ELEMENT draw: pop bx, si ;^lbx:si <- text object call MemDerefDS test ss:[bp].VTUGEP_flags, mask VTUGF_RECALC jz exit push ax ;save the return value mov ax, MSG_VIS_TEXT_RECALC_AND_DRAW call ObjCallInstanceNoLock pop ax exit: .leave ret smallText: call ObjMarkDirty ;mark the chunk as dirty jmp unlock error: add sp, 6 ;clear the stack jmp exit ;and leave addNew: pushdw ds:[di].VTG_vmChain ;save original VMChain ; ; Remove the reference for this graphic, as we are going to ; change the token stored in the graphic run array to that of ; the new graphic ; clr bx ; no callback, since element ; won't be removed - it's ; ref count is > 0 call ElementArrayRemoveReference EC < ERROR_C VIS_TEXT_GRAPHIC_ELEMENT_FREED_UNEXPECTEDLY > call FarElementArrayUnlock popdw axcx ;original graphic element pop bx, si, di call RunArrayReref ;ds:si <- run element pop dx ;dx <- destination file ; ; add the new graphic element, point the old run at it ; push bp mov bx, dx ;dx <- source file lea bp, ss:[bp].VTUGEP_graphic ;ss:bp <- new graphic ; ; First, check that the passed VMChain is not the same as ; the original VMChain. If they are the same, make a copy ; of the original for the new element. Otherwise, when ; AddGraphicElement is called, a new element may not be created ; because the VMChains match. ; cmpdw axcx, ss:[bp].VTG_vmChain jne noCopy push bp mov bp, cx call VMCopyVMChain mov cx, bp pop bp movdw ss:[bp].VTG_vmChain, axcx noCopy: clr ss:[bp].VTG_meta.REH_refCount.WAAH_high mov ss:[bp].VTG_meta.REH_refCount.WAAH_low, 1 call AddGraphicElement ;bx <- token of elt added mov ds:[si].TRAE_token, bx ;save the new token pop bp call FarRunArrayMarkDirty call FarRunArrayUnlock mov ax, UGRV_CREATED_NEW_ELEMENT jmp draw VisTextUpdateGraphicElement endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TG_CheckIfValidGraphicElement %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks if a graphic element has any obvious invalidities CALLED BY: VisTextUpdateGraphicElement PASS: es:di - VisTextGraphic RETURN: carry clear if graphic is valid ax - destroyed carry set if invalid ax - UpdateGraphicReturnValue DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cassie 5/27/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TG_CheckIfValidGraphicElement proc near uses cx .enter ; ; check for valid graphic type and graphic flags ; mov ax, UGRV_INVALID_GRAPHIC_TYPE cmp es:[di].VTG_type, VisTextGraphicType LONG jae error mov ax, es:[di].VTG_flags and ax, not VisTextGraphicFlags mov ax, UGRV_INVALID_GRAPHIC_FLAGS LONG jnz error cmp es:[di].VTG_type, VTGT_GSTRING jne notGString ; ; gstring graphics can't have null size ; mov ax, es:[di].VTG_size.XYS_width or ax, es:[di].VTG_size.XYS_height mov ax, UGRV_INVALID_GSTRING_SIZE LONG jz error ; ; Check the VTG_vmChain field. From vTextC.def: ; VTG_vmChain dword ; ; This is a dword value to pass to the VMChain routines. ; If only the low word is 0, then the high word is a VM handle ; ; If both are non-zero, it is a DB item (high word is group ; low word is item) ; ; If the high word is 0, then the low word is an LMemChunk. ; ; If both are 0, then there is no data. ; ; I don't think a gstring can ever be stored in an LMemChunk, ; because when a graphic run is deleted, VMFreeVMChain is called ; on the value in VTG_vmChain, and I don't think it will work if ; it contains a chunk handle. So treat that as an error. ; tst es:[di].VTG_vmChain.high mov ax, UGRV_INVALID_GSTRING_VMCHAIN_HANDLE LONG jz error mov ax, es:[di].VTG_vmChain.high ; ; What about a gstring in a DBItem? ; mov cx, es:[di].VTG_vmChain.low tst cx LONG jnz noError ; ; its in a vm chain - make sure the chain is valid ; push di call VMInfo pop di mov ax, UGRV_INVALID_GSTRING_VMCHAIN jc error jmp noError notGString: EC < cmp es:[di].VTG_type, VTGT_VARIABLE > EC < ERROR_NE GRAPHIC_RUN_BAD_GRAPHIC_TYPE > ; ; check for valid variable type ; mov ax, UGRV_INVALID_VARIABLE_TYPE cmp es:[di].VTG_data.VTGD_variable.VTGV_type, VisTextVariableType jae error ; ; variable graphics don't use VMChains (see VisTextVariableType ; definition in geoworks.def) ; ; Actually, this is no longer true. Condo VTVT_HOTSPOT graphics ; do have gstrings in vmChains, they just don't ever get drawn ; ;; mov ax, UGRV_INVALID_VARIABLE_VMCHAIN_HANDLE ;; cmpdw es:[di].VTG_vmChain, 0 ;; jnz error ; ; check for a valid ManufacturerID (see geode.def) ; mov ax, UGRV_INVALID_VARIABLE_MANUFACTURER_ID cmp es:[di].VTG_data.VTGD_variable.VTGV_manufacturerID, \ MANUFACTURER_ID_DATABASE_LAST ja error cmp es:[di].VTG_data.VTGD_variable.VTGV_manufacturerID, \ MANUFACTURER_ID_DATABASE_FIRST jae noError cmp es:[di].VTG_data.VTGD_variable.VTGV_manufacturerID, \ ManufacturerID jae error ; ; check that the graphic contains valid private data ; (see VisTextVariableType definition in geoworks.def) ; cmp es:[di].VTG_data.VTGD_variable.VTGV_type, \ VTVT_CONTEXT_SECTION ;don't check privdata for ja noError ; context_name, hotspot types mov ax, VisTextNumberType cmp es:[di].VTG_data.VTGD_variable.VTGV_type, \ VTVT_CREATION_DATE_TIME jb doTheCheck cmp es:[di].VTG_data.VTGD_variable.VTGV_type, \ VTVT_STORED_DATE_TIME ja doTheCheck mov ax, DateTimeFormat doTheCheck: cmp {word}es:[di].VTG_data.VTGD_variable.VTGV_privateData, ax mov ax, UGRV_INVALID_VARIABLE_PRIVATE_DATA jae error ; ; we can do more checking for VTVT_STORED_DATE_TIME ; cmp es:[di].VTG_data.VTGD_variable.VTGV_type, \ VTVT_STORED_DATE_TIME jne noError cmp {word}es:[di+2].VTG_data.VTGD_variable.VTGV_privateData, \ FileDate jae error cmp {word}es:[di+4].VTG_data.VTGD_variable.VTGV_privateData, \ FileTime jae error noError: clc done: .leave ret error: stc jmp done TG_CheckIfValidGraphicElement endp TextGraphic ends TextStorageCode segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: TA_GetGraphicElement DESCRIPTION: Get a graphic elemement CALLED BY: INTERNAL PASS: *ds:si - text object ss:bp - buffer ax - element RETURN: buffer - filled DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/28/92 Initial version ------------------------------------------------------------------------------@ TA_GetGraphicElement proc near uses bx, cx, si, di, ds .enter mov bx, OFFSET_FOR_GRAPHIC_RUNS call FarRunArrayLock mov bx, ax call GetElement call FarRunArrayUnlock .leave ret TA_GetGraphicElement endp COMMENT @---------------------------------------------------------------------- FUNCTION: TA_AddGraphicElement DESCRIPTION: Add a graphic element CALLED BY: INTERNAL PASS: *ds:si - text object ss:bp - VisTextGraphic bx - source file RETURN: ax - token DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/28/92 Initial version ------------------------------------------------------------------------------@ TA_AddGraphicElement proc near uses bx, dx, si, di, ds .enter mov dx, bx ;dx = source file call T_GetVMFile push bx mov bx, OFFSET_FOR_GRAPHIC_RUNS call FarRunArrayLock pop bx ;bx = dest file call AddGraphicElement mov_tr ax, bx ;ax = token call FarRunArrayUnlock .leave ret TA_AddGraphicElement endp TextStorageCode ends Text ends
audio/sfx/battle_0c.asm
etdv-thevoid/pokemon-rgb-enhanced
1
19407
SFX_Battle_0C_Ch7: unknownnoise0x20 15, 143, 17 unknownnoise0x20 4, 255, 18 unknownnoise0x20 10, 241, 85 endchannel
src/bootloader/protected_mode.asm
Thombrom/SnekOS
0
247843
<filename>src/bootloader/protected_mode.asm ; Make switch to 32-bit protected [bits 16] protected_mode_enter: cli ; Disable interrupts lgdt [gdt_descriptor] mov eax, cr0 ; Fetch cr0 register or eax, 0x1 ; set first bit mov cr0, eax ; and store it back ; Perform far jump to protected mode jmp CODE_SEG:protected_mode_init %include "src/bootloader/GDT.asm" [bits 32] protected_mode_init: mov ax, DATA_SEG mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; Update stack so it at the top mov esp, ebp ; of the free space protected_mode_begin: mov ebx, protected_mode_message call print_str_32 ; Enable A20 in al, 0x92 or al, 2 out 0x92, al ; Switch to Long Mode call cpuid_detect ; Detect cpuid call long_mode_detect ; Detect long mode call paging_identity_setup ; Set up identity paging call gdt_edit_long_mode ; Set up GDT for long mode jmp CODE_SEG:long_mode_init %include "src/bootloader/print_str_32bit.asm" %include "src/bootloader/CPUID.asm" %include "src/bootloader/paging.asm" protected_mode_message: db "Entered 32bit protected mode", 0 [bits 64] [extern _start] long_mode_init: mov ax, DATA_SEG ; Update segments mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; Update stack so it at the top mov esp, ebp ; of the free space long_mode_begin: mov edi, 0xb8000 mov rax, 0x1f201f201f201f20 mov ecx, 500 rep stosq call _start jmp $
src/editor_package.ads
MorganPeterson/avi-editor
0
912
<reponame>MorganPeterson/avi-editor with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Buffer_Package; use Buffer_Package; with Utilities_Package; use Utilities_Package; package Editor_Package is type KEYSTROKE is record O : ERR_TYPE; C : Character; end record; type Editor is record Name : Unbounded_String; Doc : Integer; Cmd : Integer; Doc_View : View; Focus_View : View; Running : Boolean; Error: Unbounded_String; end record; function Open_Editor (Name : Unbounded_String; Doc : Integer; Cmd : Integer) return Editor; procedure Load_File (File_Name : Unbounded_String; E : in out Editor); procedure Run_Startup (Name : String); procedure Run_Startup_Files (File_Name : Unbounded_String); procedure Run (E : Editor); procedure Status_Callback (E : Editor; V : View); procedure Redisplay (V : View); procedure Fix_Loc (E : Editor); function Get_Key_Stroke (E : Editor; D : Boolean) return KEYSTROKE; procedure Dispatch (E : Editor; F : View; K : KEYSTROKE); end Editor_Package;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1249.asm
ljhsiun2/medusa
9
167870
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %rax lea addresses_normal_ht+0x1788, %r14 nop nop nop nop nop inc %rax mov $0x6162636465666768, %r12 movq %r12, (%r14) nop nop nop mfence pop %rax pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %rax push %rbx push %rcx push %rdi // Store lea addresses_A+0x11ac0, %r11 nop nop nop nop nop and %rdi, %rdi mov $0x5152535455565758, %rcx movq %rcx, (%r11) nop and $8432, %r15 // Faulty Load lea addresses_UC+0x5788, %rbx clflush (%rbx) nop mfence mov (%rbx), %r15 lea oracles, %r11 and $0xff, %r15 shlq $12, %r15 mov (%r11,%r15,1), %r15 pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}} [Faulty Load] {'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
oeis/231/A231670.asm
neoneye/loda-programs
11
12829
<filename>oeis/231/A231670.asm ; A231670: a(n) = Sum_{i=0..n} digsum_5(i)^3, where digsum_5(i) = A053824(i). ; 0,1,9,36,100,101,109,136,200,325,333,360,424,549,765,792,856,981,1197,1540,1604,1729,1945,2288,2800,2801,2809,2836,2900,3025,3033,3060,3124,3249,3465,3492,3556,3681,3897,4240,4304,4429,4645,4988,5500,5625,5841,6184,6696,7425,7433,7460,7524,7649,7865,7892,7956,8081,8297,8640,8704,8829,9045,9388,9900,10025,10241,10584,11096,11825,12041,12384,12896,13625,14625,14652,14716,14841,15057,15400,15464,15589,15805,16148,16660,16785,17001,17344,17856,18585,18801,19144,19656,20385,21385,21728,22240,22969 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,53824 ; Sum of digits of (n written in base 5). pow $0,3 add $1,$0 lpe mov $0,$1
test/LaTeXAndHTML/succeed/Issue5043.agda
cruhland/agda
1,989
12877
<filename>test/LaTeXAndHTML/succeed/Issue5043.agda {-# OPTIONS --allow-unsolved-metas #-} latex : Set latex = {!test!}
engine/battle/link_result.asm
Dev727/ancientplatinum
28
9401
DetermineLinkBattleResult: farcall UpdateEnemyMonInParty ld hl, wPartyMon1HP call .CountMonsRemaining push bc ld hl, wOTPartyMon1HP call .CountMonsRemaining ld a, c pop bc cp c jr z, .even_number_of_mons_remaining jr c, .defeat jr .victory .even_number_of_mons_remaining call .BothSides_CheckNumberMonsAtFullHealth jr z, .drawn ld a, e cp $1 jr z, .victory cp $2 jr z, .defeat ld hl, wPartyMon1HP call .CalcPercentHPRemaining push de ld hl, wOTPartyMon1HP call .CalcPercentHPRemaining pop hl ld a, d cp h jr c, .victory jr z, .compare_lo jr .defeat .compare_lo ld a, e cp l jr z, .drawn jr nc, .defeat .victory ld a, [wBattleResult] and $f0 ld [wBattleResult], a ; WIN ret .defeat ld a, [wBattleResult] and $f0 add LOSE ld [wBattleResult], a ret .drawn ld a, [wBattleResult] and $f0 add DRAW ld [wBattleResult], a ret .CountMonsRemaining: ld c, 0 ld b, 3 ld de, PARTYMON_STRUCT_LENGTH - 1 .loop ld a, [hli] or [hl] jr nz, .not_fainted inc c .not_fainted add hl, de dec b jr nz, .loop ret .CalcPercentHPRemaining: ld de, 0 ld c, $3 .loop2 ld a, [hli] or [hl] jr z, .next dec hl xor a ldh [hDividend + 0], a ld a, [hli] ldh [hDividend + 1], a ld a, [hli] ldh [hDividend + 2], a xor a ldh [hDividend + 3], a ld a, [hli] ld b, a ld a, [hld] srl b rr a srl b rr a ldh [hDivisor], a ld b, $4 call Divide ldh a, [hQuotient + 3] add e ld e, a ldh a, [hQuotient + 2] adc d ld d, a dec hl .next push de ld de, $2f add hl, de pop de dec c jr nz, .loop2 ret .BothSides_CheckNumberMonsAtFullHealth: ld hl, wPartyMon1HP call .CheckFaintedOrFullHealth jr nz, .finish ; we have a pokemon that's neither fainted nor at full health ld hl, wOTPartyMon1HP call .CheckFaintedOrFullHealth ld e, $1 ; victory ret .finish ld hl, wOTPartyMon1HP call .CheckFaintedOrFullHealth ld e, $0 ; drawn ret nz ; we both have pokemon that are neither fainted nor at full health ld e, $2 ; defeat ld a, $1 ; not drawn and a ret .CheckFaintedOrFullHealth: ld d, 3 .loop3 ld a, [hli] ld b, a ld a, [hli] ld c, a or b jr z, .fainted_or_full_health ld a, [hli] cp b ret nz ld a, [hld] cp c ret nz .fainted_or_full_health push de ld de, PARTYMON_STRUCT_LENGTH - 2 add hl, de pop de dec d jr nz, .loop3 ret
src/Relation/Ternary/Separation/Monad/State/Heap.agda
laMudri/linear.agda
34
4337
open import Data.List open import Data.Unit open import Relation.Unary hiding (_∈_) open import Relation.Unary.PredicateTransformer using (Pt) open import Relation.Ternary.Separation open import Relation.Ternary.Separation.Construct.Market open import Relation.Ternary.Separation.Monad open import Relation.Ternary.Separation.Morphisms module Relation.Ternary.Separation.Monad.State.Heap {ℓ} -- value types {T : Set ℓ} -- stored values (V : T → Pred (List T) ℓ) where open import Level hiding (Lift) open import Function using (_∘_; case_of_) import Relation.Binary.HeterogeneousEquality as HEq open import Relation.Unary.PredicateTransformer hiding (_⊔_; [_]) open import Relation.Binary.PropositionalEquality using (refl; _≡_) open import Relation.Ternary.Separation.Construct.Product open import Relation.Ternary.Separation.Construct.List T open import Relation.Ternary.Separation.Morphisms open import Relation.Ternary.Separation.Monad open import Relation.Ternary.Separation.Allstar open import Data.Product open import Data.List.Relation.Ternary.Interleaving.Propositional as I module HeapOps -- inner monad (M : Pt (Market (List T)) ℓ) {{monad : Monads.Monad ⊤ ℓ (λ _ _ → M) }} where Cells : Pred (List T × List T) ℓ Cells (Σ , Φ) = Allstar V Σ Φ open import Relation.Ternary.Separation.Monad.State open StateTransformer M public open Monads using (str) open Monads.Monad {{...}} -- Creating a reference to a new cell, filled with a given value. -- Note that in the market monoid this is pure! -- Because we get a reference that consumes the freshly created resource. newref : ∀ {a} → ∀[ V a ⇒ StateT M Cells (Just a) ] app (newref v) (lift st σ₁) (offerᵣ σ₂) = let _ , τ₁ , τ₂ = ⊎-assoc (⊎-comm σ₂) σ₁ in return ( inj refl ×⟨ offerᵣ ⊎-∙ ⟩ lift (cons (v ×⟨ τ₂ ⟩ st)) (⊎-∙ₗ τ₁)) -- A linear read on a store: you lose the reference. -- This is pure, because with the reference being lost, the cell is destroyed: no resources leak. read : ∀ {a} → ∀[ Just a ⇒ StateT M Cells (V a) ] app (read refl) (lift st σ₁) (offerᵣ σ₂) with ⊎-assoc σ₂ σ₁ ... | _ , σ₃ , σ₄ with repartition σ₃ st ... | cons (v ×⟨ σ₅ ⟩ nil) ×⟨ σ₆ ⟩ st' with ⊎-id⁻ʳ σ₅ | ⊎-assoc (⊎-comm σ₆) (⊎-comm σ₄) ... | refl | _ , τ₁ , τ₂ = return (inj v ×⟨ offerᵣ τ₂ ⟩ lift st' (⊎-comm τ₁)) -- Writing into a cell, returning the current contents write : ∀ {a b} → ∀[ Just b ✴ (V a) ⇒ StateT M Cells (Just a ✴ V b) ] app (write (refl ×⟨ σ₁ ⟩ v)) (lift st σ₂) (offerᵣ σ₃) with ⊎-assoc (⊎-comm σ₁) σ₃ -- first we reassociate the arguments in the order that we want to piece it back together ... | _ , τ₁ , τ₂ with ⊎-assoc (⊎-comm τ₁) σ₂ ... | _ , τ₃ , τ₄ with ⊎-assoc τ₂ τ₃ ... | _ , τ₅ , τ₆ -- then we reorganize the store internally to take out the unit value with repartition τ₅ st ... | cons (vb ×⟨ σ₅ ⟩ nil) ×⟨ σ₆ ⟩ st' rewrite ⊎-id⁻ʳ σ₅ = let _ , κ₁ , κ₂ = ⊎-unassoc τ₄ (⊎-comm σ₆) _ , κ₃ , κ₄ = ⊎-assoc κ₂ (⊎-comm τ₆) in return ( inj (refl ×⟨ consˡ ⊎-idˡ ⟩ vb) ×⟨ offerᵣ (consˡ κ₄) ⟩ lift (cons (v ×⟨ κ₁ ⟩ st')) (⊎-∙ₗ (⊎-comm κ₃))) -- A linear (strong) update on the store update! : ∀ {a b} → ∀[ Just a ⇒ (V a ─✴ StateT M Cells (V b)) ─✴ StateT M Cells (Just b) ] app (update! ptr) f σ = do a ×⟨ σ₁ ⟩ f ← read ptr &⟨ σ ⟩ f b ← app f a (⊎-comm σ₁) newref b
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt21.adb
best08618/asylo
7
2294
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt21.adb -- { dg-do run } -- { dg-options "-O2" } with System; with Opt21_Pkg; use Opt21_Pkg; procedure Opt21 is V : System.Address := Convert (null); begin null; end;
programs/oeis/023/A023705.asm
neoneye/loda
22
246056
; A023705: Numbers with no 0's in base 4 expansion. ; 1,2,3,5,6,7,9,10,11,13,14,15,21,22,23,25,26,27,29,30,31,37,38,39,41,42,43,45,46,47,53,54,55,57,58,59,61,62,63,85,86,87,89,90,91,93,94,95,101,102,103,105,106,107,109,110,111,117,118,119,121,122,123,125,126,127,149,150,151,153,154,155,157,158,159,165,166,167,169,170,171,173,174,175,181,182,183,185,186,187,189,190,191,213,214,215,217,218,219,221 add $0,1 seq $0,259568 ; Numbers following gaps in the sequence of base-4 numbers that don't contain 0. div $0,4
pkgs/tools/yasm/src/modules/preprocs/nasm/tests/orgsect.asm
manggoguy/parsec-modified
2,151
12301
<reponame>manggoguy/parsec-modified<filename>pkgs/tools/yasm/src/modules/preprocs/nasm/tests/orgsect.asm ORG 100h label: db 5 STRUC Foo .bar resb 4 ENDSTRUC dw label
old_materials/workshop07/fact.asm
MrBat13/hse-acos-course
9
92640
<reponame>MrBat13/hse-acos-course<gh_stars>1-10 # # int fact (int n) # { # if (n < 1) return (1); # else return (n * fact(n – 1)); # } # .text .globl main main: li $v0, 5 syscall move $a0, $v0 jal fact move $a0, $v0 li $v0, 1 syscall li $v0, 10 syscall fact: addi $sp, $sp, -8 # adjust stack for 2 items sw $ra, 4($sp) # save the return address sw $a0, 0($sp) # save the argument n slti $t0, $a0, 1 # test for n < 1 beq $t0, $zero, L1 # if n >= 1, go to L1 addi $v0, $zero, 1 # return 1 addi $sp, $sp, 8 # pop 2 items off stack jr $ra # return to caller L1: addi $a0, $a0, -1 # n >= 1: argument gets (n – 1) jal fact # call fact with (n –1) lw $a0, 0($sp) # return from jal: restore argument n lw $ra, 4($sp) # restore the return address addi $sp, $sp, 8 # adjust stack pointer to pop 2 items mul $v0, $a0, $v0 # return n * fact (n – 1) jr $ra # return to the caller
4inline/jugar_conecta4.adb
iyan22/AprendeAda
0
1036
<reponame>iyan22/AprendeAda<filename>4inline/jugar_conecta4.adb with Ada.Text_Io; use Ada.Text_Io; with Ada.Integer_Text_IO; use Ada.Integer_Text_Io; with conecta4; use conecta4; with Nt_Console; use Nt_console; with colocar_ficha; with imprimir_tablero; with pedir_columna; with inicializar_tablero; procedure jugar_conecta4 is Tablero : T_Tablero; Ganador : Boolean; Jugador : Integer; CColum : Integer; FichasColoc : Integer; begin -- Inicio del juego e instrucciones new_line(2); put(" Bienvenido a CONECTA4"); new_line(2); put(" Jugador 1 juega con las fichas "); Set_Foreground(Light_Red); put("ROJAS"); Set_Foreground; new_line; put(" Jugador 2 juega con las fichas "); Set_Foreground(Light_Blue); put("AZULES"); Set_Foreground; new_line; new_line(2); put(" Que jugador va a comenzar (1 o 2)? "); get(Jugador); loop exit when Jugador = 1 or Jugador = 2; Set_Foreground(Red); new_line; put_line(" ERROR, eliga Jugador 1 o Jugador 2 "); new_line; Set_Foreground; Bleep; put(" Que jugador va a comenzar (1 o 2)? "); get(Jugador); end loop; new_line(2); Skip_Line; put(" Pulsa INTRO para empezar a juegar..."); Skip_Line; new_line; -- Inicializamos el juego Ganador := False; FichasColoc := 0; inicializar_tablero(Tablero); imprimir_tablero(Tablero); -- Mientras que no haya ganador ni empate while Ganador = False and FichasColoc /= Max_Filas * Max_Columnas loop CColum := Pedir_Columna(Tablero, Jugador); FichasColoc := FichasColoc+1; colocar_ficha (Tablero, Jugador, CColum, Ganador); imprimir_tablero(Tablero); -- Cambio de turno de un Jugador a otro if Jugador = 1 then Jugador := 2; else Jugador := 1; end if; end loop; -- Final de partida -- Empate (tablero lleno sin combinacion ganadora) if FichasColoc = Max_Filas * Max_Columnas and Ganador = False then new_line; put_line(" Buena partida"); put_line(" --- EMPATE ---"); skip_line; end if; -- Un ganador, dependiendo del jugador dice cual es. if Ganador = True then new_line; put_line(" La partida ha finalizado"); put (" Y el ganador es: "); -- Como cambia de turno directamente, se invierte el orden de quien ha ganado if Jugador = 2 then Set_Foreground(Light_Red); put("Jugador 1"); Set_Foreground; new_line; else Set_Foreground(Light_Blue); put("Jugador 2"); Set_Foreground; new_line; end if; Skip_line; end if; end jugar_conecta4;
Algebra/Construct/Cayley/Propositional.agda
oisdk/agda-playground
6
13679
<gh_stars>1-10 {-# OPTIONS --cubical --safe --prop #-} open import Algebra open import Prelude open import Relation.Binary.Equivalence.PropTruncated module Algebra.Construct.Cayley.Propositional {a} (mon : Monoid a) where open Monoid mon record 𝒞 : Type a where constructor cayley infixr 7 _⇓_ field _⇓_ : 𝑆 → 𝑆 small : ∀ x → _⇓_ ε ∙ x ≐ _⇓_ x open 𝒞 public ⟦_⇓⟧ : 𝒞 → 𝑆 ⟦ x ⇓⟧ = x ⇓ ε ⟦_⇑⟧ : 𝑆 → 𝒞 ⟦ x ⇑⟧ ⇓ y = x ∙ y ⟦ x ⇑⟧ .small y = ∣ cong (_∙ y) (∙ε x) ∣ ⓔ : 𝒞 ⓔ ⇓ x = x ⓔ .small x = ∣ ε∙ x ∣ module _ where open Reasoning _⊙_ : 𝒞 → 𝒞 → 𝒞 (x ⊙ y) ⇓ z = x ⇓ y ⇓ z (x ⊙ y) .small z = x ⇓ y ⇓ ε ∙ z ≐˘⟨ ∙cong (_∙ z) (x .small (y ⇓ ε)) ⟩ x ⇓ ε ∙ y ⇓ ε ∙ z ≡⟨ assoc (x ⇓ ε) (y ⇓ ε) z ⟩ x ⇓ ε ∙ (y ⇓ ε ∙ z) ≐⟨ ∙cong (x ⇓ ε ∙_) (y .small z) ⟩ x ⇓ ε ∙ y ⇓ z ≐⟨ x .small (y ⇓ z) ⟩ x ⇓ y ⇓ z ∎ ⊙-assoc : Associative _⊙_ ⊙-assoc x y z = refl ⓔ⊙ : ∀ x → ⓔ ⊙ x ≡ x ⓔ⊙ x = refl ⊙ⓔ : ∀ x → x ⊙ ⓔ ≡ x ⊙ⓔ x = refl cayleyMonoid : Monoid a Monoid.𝑆 cayleyMonoid = 𝒞 Monoid._∙_ cayleyMonoid = _⊙_ Monoid.ε cayleyMonoid = ⓔ Monoid.assoc cayleyMonoid = ⊙-assoc Monoid.ε∙ cayleyMonoid = ⓔ⊙ Monoid.∙ε cayleyMonoid = ⊙ⓔ open import Data.Sigma.Properties open import Relation.Nullary.Stable 𝒞≡ : {x y : 𝒞} → (∀ z → x ⇓ z ≡ y ⇓ z) → x ≡ y 𝒞≡ { f } { cayley g q } f≡g = subst (λ (g′ : 𝑆 → 𝑆) → (q′ : ∀ x → g′ ε ∙ x ≐ g′ x) → f ≡ cayley g′ q′) (funExt f≡g) (λ _ → refl) q ∙-homo : ∀ x y → ⟦ x ∙ y ⇑⟧ ≡ ⟦ x ⇑⟧ ⊙ ⟦ y ⇑⟧ ∙-homo x y = 𝒞≡ (assoc x y) ε-homo : ⟦ ε ⇑⟧ ≡ ⓔ ε-homo = 𝒞≡ ε∙ homo-to : MonoidHomomorphism mon ⟶ cayleyMonoid MonoidHomomorphism_⟶_.f homo-to = ⟦_⇑⟧ MonoidHomomorphism_⟶_.∙-homo homo-to = ∙-homo MonoidHomomorphism_⟶_.ε-homo homo-to = ε-homo ⓔ-homo : ⟦ ⓔ ⇓⟧ ≡ ε ⓔ-homo = refl module _ (sIsStable : ∀ {x y : 𝑆} → Stable (x ≡ y)) where ⊙-homo : ∀ x y → ⟦ x ⊙ y ⇓⟧ ≡ ⟦ x ⇓⟧ ∙ ⟦ y ⇓⟧ ⊙-homo x y = sym (unsquash sIsStable (x .small ⟦ y ⇓⟧)) 𝒞-iso : 𝒞 ⇔ 𝑆 fun 𝒞-iso = ⟦_⇓⟧ inv 𝒞-iso = ⟦_⇑⟧ rightInv 𝒞-iso = ∙ε leftInv 𝒞-iso x = 𝒞≡ λ y → unsquash sIsStable (x .small y) homo-from : MonoidHomomorphism cayleyMonoid ⟶ mon MonoidHomomorphism_⟶_.f homo-from = ⟦_⇓⟧ MonoidHomomorphism_⟶_.∙-homo homo-from = ⊙-homo MonoidHomomorphism_⟶_.ε-homo homo-from = ⓔ-homo
tests/open_numbers.scpt
quilt-js/j
182
2191
#!/usr/bin/env osascript -- open_numbers.scpt -- open file using Numbers for Mac -- Copyright (C) 2014 SheetJS -- vim: set ts=2: on run argv set pwd to (system attribute "PWD") set workingDir to POSIX path of pwd set input_file_name to pwd & "/" & (item 1 of argv) set input_file to POSIX file input_file_name tell application "Numbers" open input_file try close saving no end try quit saving no end tell end run
fourier/fourier8.ads
jscparker/math_packages
30
19982
<reponame>jscparker/math_packages -- PACKAGE Fourier8 -- -- Standard Radix 8 (decimation in frequency) Cooley-Tukey FFT. -- Procedure FFT does a Discrete Fourier Transform on data sets -- that are powers-of-2 in length. The package is pure. -- -- Radix 2 FFT's read and write the entire data set to the data array -- log(N) times per transform (where N is the data length). -- Radix 2**k FFT's read and write the entire data set to the data array -- log(N) / k times per transform (where N is the data length). -- These reads and writes slow down the calculation significantly, -- especially as arrays get large and spill out of the machine's -- cache ram. So the higher Radix FFT's are usually quite a bit faster -- than the simpler Radix 2 FFT's when the data sets get large. -- (The code, on the other hand, is not pretty!) -- -- -- 2. Notes on use. -- -- If length of the data set to be transformed is not a power -- of 2, then it is padded with Zeros to make it a power of 2. -- -- Data is stored as 2 arrays of Real numbers, one for the Real part, -- one for the complex part. -- -- Only data in the range 0..N is transformed. -- N is input as: Input_Data_Last. -- If N+1 is not a power of 2, then the Data array will be padded -- with zeros out to the nearest power of 2. -- The FFT is then performed on the enlarged set of data. -- -- More precisely if Input_Data_Last is not 2**N-1 for some integer N -- then all data points in the range Input_Data_Last+1..2**M-1 -- *will be set to zero*, i.e. data is padded with Zeros to the nearest -- power of two. The FFT will be performed on the interval 0..2**M-1, -- where 2**M-1 = Transformed_Data_Last = smallest power of 2 (minus -- one) that is greater than or equal to Input_Data_Last. -- (You input the number of data points *minus one*, so that this number -- can have the same type as the array index, which has range 0..2**N-1). -- -- The user sets the maximum size of the storage array by -- setting the generic parameter Log_Of_Max_Data_Length. -- -- The user has the option of Normalizing the data by dividing -- the results by SQRT (N), where N is the number of data points. -- If you want normalization by 1/N instead, then choose the no -- normalization option and perform the normalization yourself. -- -- -- 3. Notes on the Discrete Fourier Transform (DFT) -- -- The N point Discrete Fourier Transform F(W) of a function of time G(T): -- -- N-1 -- F(W_n) = DFT(N){G} = SUM { G(T_m) * Exp (-i * W_n * T_m)/Sqrt (N) }, -- m=0 -- -- where the sum is over m and goes from 0 to N-1. (N is the -- number of data points and is a power of 2.) Notice that this -- is the discretized version of the integral by which one calculates -- the Fourier coefficients of a Fourier series. In other words, -- F(W_n) is the projection of the function G (which we wish to -- write as a sum of the Fourier basis functions Exp) onto the -- appropriate basis function. -- -- Dividing by SQRT (N) normalizes the Fourier basis function Exp. -- If this is done, then the Fourier coefficients F(W) give the -- power spectrum: Power(W) = F(W) * Conjugate (F(W)). -- -- The discrete components of time T_m are given by (Tmax/N)*m -- where Tmax is the total time interval of the transform, and m -- goes from 0 to N-1. Similarly, the dicrete components of -- frequency are W_n = (2*Pi/Tmax)*n where n goes from 0 to N-1. -- Consequently the Dicrete Fourier Transform is -- -- N-1 -- F(W_n) = SUM { G(T_m) * Exp (-i * (2*Pi/N) * n * m)/Sqrt(N) }. -- m=0 -- -- In calculating F(W) we are finding the coefficients F(W_n) of -- plane waves Exp (i * W_n * T_m) such that a sum over these plane -- waves times the appropriate coefficient F(W_n) reproduces (approx.) -- the funtion of time G(T). The plane waves Exp (i * W_n * T_m) are -- said to form a complete set of states for functions G(T) that -- are restricted to an interval [0,Tmax). They satisfy periodic -- boundary conditions: State (n, T) = State (n, T + Tmax). It -- follows from the periodic boundary conditions and from the -- definition State (n, T) = Exp (i * W_n * T) that the discrete -- frequencies W_n have the form W_n = (2*Pi/Tmax)*n. Because the -- the sum is truncated at N-1 the Fourier series won't exactly -- approximate the function of time G(T). Finally, notice that -- the (un-normalized) states State (n, T) look like: -- -- { 1, Exp (i*(2*Pi/Tmax)*T), Exp (i*(2*Pi/Tmax)*2*T), ... } -- -- If we take the FFT of State (n, T) we should a get back a -- delta function F(W) peaked at the nth data point W_n. A test -- procedure demonstrates this. -- -- It is important to note from these definitions that we are -- assuming that the function of time G(T) is restricted to an -- interval of time [0, Tmax). If we want to use the FFT to approximate -- the integral of G(T)*Exp(i*W*T) on another time interval, say -- [-Tmax/2, Tmax/2], then must transform coordinates of the integral -- to the time interval [0,Tmax). The -- result of this transformation is to put an W (hence n) dependent phase -- factor out front of the prediction of the FFT. In fact, in the case -- just described, the phase factor is -- Exp (i * W_n * Tmax/2) = Exp (i * W_n * 2 * Pi * n / (W_n * 2)). -- This equals Exp (i * Pi * n), which is +1 or -1 depending on whether -- n is even of odd. -- -- -- 4. Notes on the radix 8 fast fourier transform (FFT) -- see below -- --***************************************************************** generic type Real is digits <>; type Array_Index is range <>; type Data_Array is array (Array_Index) of Real; Log_Of_Max_Data_Length : Positive; -- The FFT can only operate on range 0..2**N-1, where the maximum -- value N can have is N_max = Log_Of_Max_Data_Length. -- -- The generic formal Data_Array has arbitrary limits. This is -- useful, but the FFT algorithm works on a restricted range. It -- only operates on data in power-of-2 ranges: 0..2**N-1 for some N. -- The user can find out about this restriction at runtime or at -- compile time. To make sure he finds out about it at compile time -- he is required to enter the Maximum value N is allowed to have. -- That value is N_max = Log_Of_Max_Data_Length. -- The package checks that 0..2**N_max-1 is in in the range of -- Array_Index, during compilation, and also exports a -- subtype of Array_Index that has range 0..2**N_max-1. This -- subtype is called Data_Index, and all computation is done on it. package Fourier8 is pragma Pure (Fourier8); Data_Index_Last : constant Array_Index := Array_Index (2**Log_Of_Max_Data_Length-1); subtype Data_Index is Array_Index range 0..Data_Index_Last; -- Data_Index: the index on which all computation is performed. One -- of the reasons this subset is defined is to make sure that the generic -- formal type Array_Index contains the range 0..2**N-1 -- where N is the log of the max number of data points. The FFT -- is always done on some sub range of this: 0..M where M <= 2**N-1. type Exp_Storage is private; -- Must declare an object of this type and pass it to FFT as a parameter. -- That is all you ever have to do. The program does eveything else -- for you. (It contains the Sin's for the FFT ... keeps the package Pure.) -- So all you do is declare: -- -- My_Exp_Table : Exp_Storage; -- -- and then in the call to FFT, you add the parameter: -- -- Exp_Table => My_Exp_Table, -- procedure FFT (Data_Re, Data_Im : in out Data_Array; --destroys original data Transformed_Data_Last : out Data_Index; Input_Data_Last : in Data_Index; Exp_Table : in out Exp_Storage; Inverse_FFT_Desired : in Boolean := False; Normalized_Data_Desired : in Boolean := False; Bit_Reversal_Desired : in Boolean := True); -- FFT's the arrays Data_Re and Data_Im, and puts the results back -- into the same arrays. The original data is destroyed. -- -- The user inputs: Input_Data_Last -- -- The procedure performs an FFT on data that lies in the interval -- -- 0 .. Input_Data_Last. -- -- Data beyond this point will be set to Complex_Zero out to the -- nearest power of 2: Transformed_Data_Last. -- The transformed data is returned in the array Data, in the range -- -- 0 .. Transformed_Data_Last. -- -- Transformed_Data_Last+1 is a power of 2 -- Input_Data_Last+1 need not be a power of 2 pragma Inline (FFT); private -- Types for a table of SIN's and COS's called Exp_Table. Makes the -- package pure by moving declaration of the table to the client program. -- The Table is passed to the FFT as an in/out parameter. Half_Max_Data_Length : constant Array_Index := Data_Index_Last / 2; subtype Exp_Mode_Index is Data_Index range 0..Half_Max_Data_Length+29; -- The +29 sometimes helps. (the usual -1 is ok). type Sinusoid_Storage is Array(Exp_Mode_Index) of Real; type Exp_Storage is record Re : Sinusoid_Storage; Im : Sinusoid_Storage; Current_Size_Of_Exp_Table : Data_Index := 0; end record; -- Current_Size_Of_Exp_Table -- tells the FFT routine whether to reconstruct Exp_Table. -- Current_Size_Of_Exp_Table is initialized to 0 so that the table -- is correctly initialized on first call to Make_Exp_Table. end Fourier8; --***************************************************************** -- Notes on the radix 8 fast fourier transform (FFT) -- -- The FFT is an algorithm for computing the discrete Fourier transform -- with K*N*Log(N) arithmetic operation (where K is about 4 or 5). A -- direct calulation of the DFT uses O(N**2) operations. (N is the -- number of Data points; always a power of 2 in what follows.) Here's -- the decimation in frequency way. We break the N point DFT (DFT(N)) -- into two DFT's of N/2 points. Recursive application of this gives -- the Cooley_Tukey FFT. One of the 2 DFTs will give the even points -- of the final result; the other gives the odd points of the final -- result. Here is the derivation of first of the 2 DFTs. We start by -- defining F as the N point discrete Fourier transform of G: DFT(N){G}. -- -- N-1 -- r in [0,N-1]: F(r) = SUM { W(N)**(rn) * G(n) } -- n=0 -- -- where W(N) = exp(-i*2*Pi/N), for the direct DFT, and exp(i*2*Pi/N) for -- the inverse DFT. For the even-indexed data points this is: -- -- N/2-1 -- r in [0,N/2-1]: F(2r) = SUM { W(N)**(2rn) * G(n) } -- n=0 -- -- N/2-1 -- + SUM { W(N)**(2r(n+N/2)) * G(n+N/2) } -- n=0 -- -- Now use the fact that W(N)**(2rn) = W(N/2)**(rn) and that W(N)**(rN) -- equals 1 to get: -- -- r in [0,N/2-1]: F(2r) = DFT(N/2) { G(n) + G(N+N/2) }. -- -- Now get the odd-indexed data points by the same process. The result: -- -- r in [0,N/2-1]: -- -- F(2r) = DFT(N/2) { (G(n) + G(N+N/2)) } -- F(2r+1) = DFT(N/2) { (G(n) - G(N+N/2)) * W(N)**n }. -- -- So now if you wrote a recursive procedure that performs the above -- process, making N a variable (a parameter of the recursive procedure) -- then you are done. (i.e. next step is to break the two N/2 point -- DFTs into 4 N/4 point DFTs, etc.) In practice we just do it directly. -- Each stage you form two new data sequences of length N/2 as defined -- above: G(n) + G(N+N/2) and [G(n) + G(N+N/2)] * W(N)**n . -- These operation are called the Butterflies. Then you -- perform the N/2 point DFT on both by doing the same thing all over -- again but with N -> N/2. For example the W(N)**n term goes to W(N/2)**n. -- This process is repeated Log2(N) times. The variable in the code is -- called Stage: Stage is in 0..Log2(N)-1. Actually we have just described -- the radix 2 FFT. Below is the radix 4 FFT, in which you directly break -- DFT into 4 DFT's of length N/4. This gives you a 20-30% reduction -- in floating point ops. (And you use half as many stages, which is -- very important in the out-of-core FFT in this set, which writes -- the entire data set to the hard disk each stage.) Here is the radix -- 4 FFT. To derive it, you just follow the above procedure. -- -- for r in [0,N/4-1]: -- -- F(4r) = DFT(N/4){ [G(n) + G(n+N/4) + G(n+2N/4) + G(n+3N/4)] * W(N)**0n} -- F(4r+1) = DFT(N/4){ [G(n) -i*G(n+N/4) - G(n+2N/4) +i*G(n+3N/4)] * W(N)**1n} -- F(4r+2) = DFT(N/4){ [G(n) - G(n+N/4) + G(n+2N/4) - G(n+3N/4)] * W(N)**2n} -- F(4r+3) = DFT(N/4){ [G(n) +i*G(n+N/4) - G(n+2N/4) -i*G(n+3N/4)] * W(N)**3n} -- -- The improvement in computation comes from the fact that one need not -- perform any operations in multiplying by i, and from the fact that -- several quantities, like G(n) + G(N+N/2), appear more than once in -- the expessions. The 4 expressions in brackets [] form a 4 point DFT. -- Notice that the factors of G are given by exp (-i k m (2Pi/N)) where -- N = 4 and k, m go from 0..3. i.e. exp (-i k m (2Pi/N)) = -- m= 0 1 2 3 -- -- k=0 1 1 1 1 -- k=1 1 -i -1 i -- k=2 1 -1 1 -1 -- k=3 1 i -1 -i -- -- This is the kernel to which all higher DFT's are reduced. The -- W(N)**kn terms are called twiddle factors, I think. If the number -- of Radix 2 stages (log(N)) is not divisible by 2, then a final radix -- 2 stage must be performed to complete the FFT. Finally, be aware that -- to get the inverse DFT, all of the i's and exp's above must be -- replaced with their complex conjugates. -- The factors of G for Radix 8 are given by exp (-i k m (2Pi/N)) where -- N = 8 and k, m go from 0..7. i.e. exp (-i k m (2Pi/N)) = -- m= 0 1 2 3 4 5 6 7 -- -- k=0 1 1 1 1 1 1 1 1 -- k=1 1 a(1-i) -i a(-1-i) -1 -a(1-i) i -a(-1-i) -- k=2 1 -i -1 i 1 -i -1 i -- k=3 1 a(-1-i) i a(1-i) -1 -a(-1-i) -i -a(1-i) -- k=4 1 -1 1 -1 1 -1 1 -1 -- k=5 1 a(-1+i) -i a(1+i) -1 -a(-1+i) i -a(1+i) -- k=6 1 i -1 -i 1 i -1 -i -- k=7 1 a(1+i) i a(-1+i) -1 -a(1+i) -i -a(-1+i) -- -- In the above, a = 1/Sqrt(2.0). If you call the above matrix Exp_km, -- the FFT becomes: -- -- for each r in [0, N/8-1] we have: -- -- for k in 0..7: -- F(8r+k) = DFT(N/8){ [Exp_km * G(n+mN/8)] * W(N)**(k*n)} -- -- where W(N) = exp(-i*2*Pi/N), for the direct DFT, and exp(i*2*Pi/N) for -- the inverse DFT. -- Each stage of the FFT you transform the data according to the formula in -- in the { }. Then the idea is to perform eight N/8 point FFT's. But each -- of these is again performed according the the above formula, giving the -- next stage in the FFT. The above turns an N point FFT into 8 N/8 point -- FFT's. The next stage turns those eight N/8 pt. FFT's into 64 N/64 pt -- FFT's. To apply the above formula to that latter step, N must be replaced -- by N/8 in the above formula. -- You don't get a big reduction in floating point going from Radix 4 to 8, -- but you read the array fewer times from memory, -- and you can perform more floating point per expression which often helps. -- Accuracy is improved because fewer complex mults are done. -- Below let Dm = G(n+mN/8). (D stands for Data.) -- -- D0new := ((D0+D4) + (D2+D6) + ( (D1+D5) + (D3+D7))) * Exp0; -- D2new := ((D0+D4) - (D2+D6) - i*( (D1+D5) - (D3+D7))) * Exp2; -- D4new := ((D0+D4) + (D2+D6) - ( (D1+D5) + (D3+D7))) * Exp4; -- D6new := ((D0+D4) - (D2+D6) + i*( (D1+D5) - (D3+D7))) * Exp6; -- -- D1new := ((D0-D4) - i(D2-D6) + a( 1-i)*(D1-D5) + a(-1-i)*(D3-D7))*Exp1; -- D3new := ((D0-D4) + i(D2-D6) + a(-1-i)*(D1-D5) + a( 1-i)*(D3-D7))*Exp3; -- D5new := ((D0-D4) - i(D2-D6) + a(-1+i)*(D1-D5) + a( 1+i)*(D3-D7))*Exp5; -- D7new := ((D0-D4) + i(D2-D6) + a( 1+i)*(D1-D5) + a(-1+i)*(D3-D7))*Exp7; -- -- The last set can be written: -- --D1new = ((D0-D4) - i(D2-D6) - a(i((D1-D5)+(D3-D7)) - ((D1-D5)-(D3-D7))))*Exp1; --D3new = ((D0-D4) + i(D2-D6) - a(i((D1-D5)+(D3-D7)) + ((D1-D5)-(D3-D7))))*Exp3; --D5new = ((D0-D4) - i(D2-D6) + a(i((D1-D5)+(D3-D7)) - ((D1-D5)-(D3-D7))))*Exp5; --D7new = ((D0-D4) + i(D2-D6) + a(i((D1-D5)+(D3-D7)) + ((D1-D5)-(D3-D7))))*Exp7; -- --*****************************************************************
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/size_attribute1_pkg2.ads
best08618/asylo
7
13475
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/size_attribute1_pkg2.ads -- { dg-excess-errors "no code generated" } generic type T is private; package Size_Attribute1_Pkg2 is procedure Proc; end Size_Attribute1_Pkg2;
tools/scitools/conf/understand/ada/ada95/a-strbou.ads
brucegua/moocos
1
20950
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- A D A . S T R I N G S . B O U N D E D -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Maps; package Ada.Strings.Bounded is pragma Preelaborate (Bounded); generic Max : Positive; -- Maximum length of a Bounded_String package Generic_Bounded_Length is Max_Length : constant Positive := Max; type Bounded_String is private; Null_Bounded_String : constant Bounded_String; subtype Length_Range is Natural range 0 .. Max_Length; function Length (Source : in Bounded_String) return Length_Range; -------------------------------------------------------- -- Conversion, Concatenation, and Selection Functions -- -------------------------------------------------------- function To_Bounded_String (Source : in String; Drop : in Truncation := Error) return Bounded_String; function To_String (Source : in Bounded_String) return String; function Append (Left, Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String; function Append (Left : in Bounded_String; Right : in String; Drop : in Truncation := Error) return Bounded_String; function Append (Left : in String; Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String; function Append (Left : in Bounded_String; Right : in Character; Drop : in Truncation := Error) return Bounded_String; function Append (Left : in Character; Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String; procedure Append (Source : in out Bounded_String; New_Item : in Bounded_String; Drop : in Truncation := Error); procedure Append (Source : in out Bounded_String; New_Item : in String; Drop : in Truncation := Error); procedure Append (Source : in out Bounded_String; New_Item : in Character; Drop : in Truncation := Error); function "&" (Left, Right : in Bounded_String) return Bounded_String; function "&" (Left : in Bounded_String; Right : in String) return Bounded_String; function "&" (Left : in String; Right : in Bounded_String) return Bounded_String; function "&" (Left : in Bounded_String; Right : in Character) return Bounded_String; function "&" (Left : in Character; Right : in Bounded_String) return Bounded_String; function Element (Source : in Bounded_String; Index : in Positive) return Character; procedure Replace_Element (Source : in out Bounded_String; Index : in Positive; By : in Character); function Slice (Source : in Bounded_String; Low : in Positive; High : in Natural) return String; function "=" (Left, Right : in Bounded_String) return Boolean; function "=" (Left : in Bounded_String; Right : in String) return Boolean; function "=" (Left : in String; Right : in Bounded_String) return Boolean; function "<" (Left, Right : in Bounded_String) return Boolean; function "<" (Left : in Bounded_String; Right : in String) return Boolean; function "<" (Left : in String; Right : in Bounded_String) return Boolean; function "<=" (Left, Right : in Bounded_String) return Boolean; function "<=" (Left : in Bounded_String; Right : in String) return Boolean; function "<=" (Left : in String; Right : in Bounded_String) return Boolean; function ">" (Left, Right : in Bounded_String) return Boolean; function ">" (Left : in Bounded_String; Right : in String) return Boolean; function ">" (Left : in String; Right : in Bounded_String) return Boolean; function ">=" (Left, Right : in Bounded_String) return Boolean; function ">=" (Left : in Bounded_String; Right : in String) return Boolean; function ">=" (Left : in String; Right : in Bounded_String) return Boolean; ---------------------- -- Search Functions -- ---------------------- function Index (Source : in Bounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Index (Source : in Bounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural; function Index (Source : in Bounded_String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural; function Index_Non_Blank (Source : in Bounded_String; Going : in Direction := Forward) return Natural; function Count (Source : in Bounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Count (Source : in Bounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural; function Count (Source : in Bounded_String; Set : in Maps.Character_Set) return Natural; procedure Find_Token (Source : in Bounded_String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural); ------------------------------------ -- String Translation Subprograms -- ------------------------------------ function Translate (Source : in Bounded_String; Mapping : in Maps.Character_Mapping) return Bounded_String; procedure Translate (Source : in out Bounded_String; Mapping : in Maps.Character_Mapping); function Translate (Source : in Bounded_String; Mapping : in Maps.Character_Mapping_Function) return Bounded_String; procedure Translate (Source : in out Bounded_String; Mapping : in Maps.Character_Mapping_Function); --------------------------------------- -- String Transformation Subprograms -- --------------------------------------- function Replace_Slice (Source : in Bounded_String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error) return Bounded_String; procedure Replace_Slice (Source : in out Bounded_String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error); function Insert (Source : in Bounded_String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error) return Bounded_String; procedure Insert (Source : in out Bounded_String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error); function Overwrite (Source : in Bounded_String; Position : in Positive; New_Item : in String; Drop : in Truncation := Error) return Bounded_String; procedure Overwrite (Source : in out Bounded_String; Position : in Positive; New_Item : in String; Drop : in Truncation := Error); function Delete (Source : in Bounded_String; From : in Positive; Through : in Natural) return Bounded_String; procedure Delete (Source : in out Bounded_String; From : in Positive; Through : in Natural); --------------------------------- -- String Selector Subprograms -- --------------------------------- function Trim (Source : in Bounded_String; Side : in Trim_End) return Bounded_String; procedure Trim (Source : in out Bounded_String; Side : in Trim_End); function Trim (Source : in Bounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return Bounded_String; procedure Trim (Source : in out Bounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set); function Head (Source : in Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error) return Bounded_String; procedure Head (Source : in out Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error); function Tail (Source : in Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error) return Bounded_String; procedure Tail (Source : in out Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error); ------------------------------------ -- String Constructor Subprograms -- ------------------------------------ function "*" (Left : in Natural; Right : in Character) return Bounded_String; function "*" (Left : in Natural; Right : in String) return Bounded_String; function "*" (Left : in Natural; Right : in Bounded_String) return Bounded_String; function Replicate (Count : in Natural; Item : in Character; Drop : in Truncation := Error) return Bounded_String; function Replicate (Count : in Natural; Item : in String; Drop : in Truncation := Error) return Bounded_String; function Replicate (Count : in Natural; Item : in Bounded_String; Drop : in Truncation := Error) return Bounded_String; private type Bounded_String is record Length : Length_Range; Data : String (1 .. Max_Length); end record; Null_Bounded_String : constant Bounded_String := (Length => 0, Data => (1 .. Max_Length => Ascii.NUL)); -- Pragma Inline declarations (GNAT specific additions) pragma Inline ("="); pragma Inline ("<"); pragma Inline ("<="); pragma Inline (">"); pragma Inline (">="); pragma Inline ("&"); pragma Inline (Count); pragma Inline (Element); pragma Inline (Find_Token); pragma Inline (Index); pragma Inline (Index_Non_Blank); pragma Inline (Length); pragma Inline (Replace_Element); pragma Inline (Slice); pragma Inline (To_Bounded_String); pragma Inline (To_String); end Generic_Bounded_Length; end Ada.Strings.Bounded;
Transynther/x86/_processed/NONE/_st_/i3-7100_9_0x84_notsx.log_36_2911.asm
ljhsiun2/medusa
9
179997
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_WT_ht+0xda9a, %rsi lea addresses_WC_ht+0x11f3c, %rdi nop sub $1111, %r15 mov $121, %rcx rep movsl nop nop nop nop cmp $11802, %r8 lea addresses_WT_ht+0x140c, %r8 nop sub %r10, %r10 mov $0x6162636465666768, %rcx movq %rcx, %xmm4 vmovups %ymm4, (%r8) nop nop nop nop cmp $44311, %rsi lea addresses_A_ht+0xf024, %rsi nop nop nop and $8956, %r8 mov (%rsi), %r10w nop nop sub $56341, %rcx lea addresses_A_ht+0x1c8a4, %r8 nop nop nop nop nop inc %r13 movb $0x61, (%r8) nop cmp $61699, %rsi lea addresses_A_ht+0xa424, %rsi lea addresses_WC_ht+0x14504, %rdi nop nop nop sub %r15, %r15 mov $37, %rcx rep movsl nop nop nop nop xor %r13, %r13 lea addresses_WT_ht+0x126a4, %rcx nop inc %r8 movb $0x61, (%rcx) nop nop cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_D+0x5bf4, %rsi lea addresses_A+0xaa4, %rdi clflush (%rsi) clflush (%rdi) nop nop dec %r10 mov $38, %rcx rep movsq nop nop nop sub %rcx, %rcx // Load lea addresses_PSE+0x1a4a4, %r15 nop nop nop nop nop cmp %rbx, %rbx movups (%r15), %xmm5 vpextrq $0, %xmm5, %rcx nop nop and $5648, %rdi // Load lea addresses_PSE+0xdb7c, %r11 sub %rsi, %rsi movaps (%r11), %xmm5 vpextrq $0, %xmm5, %rcx sub %rdi, %rdi // Store lea addresses_WT+0x12ae4, %r15 nop nop nop sub %rcx, %rcx movb $0x51, (%r15) nop nop nop nop add $33106, %r15 // Faulty Load lea addresses_A+0xaa4, %r15 nop nop nop sub $49017, %rsi vmovups (%r15), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %r11 lea oracles, %rbx and $0xff, %r11 shlq $12, %r11 mov (%rbx,%r11,1), %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'36': 36} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
Cubical/Functions/Fibration.agda
apabepa10/cubical
0
12892
<reponame>apabepa10/cubical<gh_stars>0 {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Functions.Fibration where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.GroupoidLaws open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.Properties open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Path open import Cubical.Foundations.Univalence open import Cubical.Foundations.Transport open import Cubical.Data.Sigma private variable ℓ ℓb : Level B : Type ℓb module FiberIso {ℓ} (p⁻¹ : B → Type ℓ) (x : B) where p : Σ B p⁻¹ → B p = fst fwd : fiber p x → p⁻¹ x fwd ((x' , y) , q) = subst (λ z → p⁻¹ z) q y bwd : p⁻¹ x → fiber p x bwd y = (x , y) , refl fwd-bwd : ∀ x → fwd (bwd x) ≡ x fwd-bwd y = transportRefl y bwd-fwd : ∀ x → bwd (fwd x) ≡ x bwd-fwd ((x' , y) , q) i = h (r i) where h : Σ[ s ∈ singl x ] p⁻¹ (s .fst) → fiber p x h ((x , p) , y) = (x , y) , sym p r : Path (Σ[ s ∈ singl x ] p⁻¹ (s .fst)) ((x , refl ) , subst p⁻¹ q y) ((x' , sym q) , y ) r = ΣPathP (isContrSingl x .snd (x' , sym q) , toPathP (transport⁻Transport (λ i → p⁻¹ (q i)) y)) -- HoTT Lemma 4.8.1 fiberEquiv : fiber p x ≃ p⁻¹ x fiberEquiv = isoToEquiv (iso fwd bwd fwd-bwd bwd-fwd) open FiberIso using (fiberEquiv) public module _ {ℓ} {E : Type ℓ} (p : E → B) where -- HoTT Lemma 4.8.2 totalEquiv : E ≃ Σ B (fiber p) totalEquiv = isoToEquiv isom where isom : Iso E (Σ B (fiber p)) Iso.fun isom x = p x , x , refl Iso.inv isom (b , x , q) = x Iso.leftInv isom x i = x Iso.rightInv isom (b , x , q) i = q i , x , λ j → q (i ∧ j) module _ (B : Type ℓb) (ℓ : Level) where private ℓ' = ℓ-max ℓb ℓ -- HoTT Theorem 4.8.3 fibrationEquiv : (Σ[ E ∈ Type ℓ' ] (E → B)) ≃ (B → Type ℓ') fibrationEquiv = isoToEquiv isom where isom : Iso (Σ[ E ∈ Type ℓ' ] (E → B)) (B → Type ℓ') Iso.fun isom (E , p) = fiber p Iso.inv isom p⁻¹ = Σ B p⁻¹ , fst Iso.rightInv isom p⁻¹ i x = ua (fiberEquiv p⁻¹ x) i Iso.leftInv isom (E , p) i = ua e (~ i) , fst ∘ ua-unglue e (~ i) where e = totalEquiv p -- The path type in a fiber of f is equivalent to a fiber of (cong f) open import Cubical.Foundations.Function fiberPath : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} {f : A → B} {b : B} (h h' : fiber f b) → (Σ[ p ∈ (fst h ≡ fst h') ] (PathP (λ i → f (p i) ≡ b) (snd h) (snd h'))) ≡ fiber (cong f) (h .snd ∙∙ refl ∙∙ sym (h' .snd)) fiberPath h h' = cong (Σ (h .fst ≡ h' .fst)) (funExt λ p → flipSquarePath ∙ PathP≡doubleCompPathʳ _ _ _ _) fiber≡ : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} {f : A → B} {b : B} (h h' : fiber f b) → (h ≡ h') ≡ fiber (cong f) (h .snd ∙∙ refl ∙∙ sym (h' .snd)) fiber≡ {f = f} {b = b} h h' = ΣPath≡PathΣ ⁻¹ ∙ fiberPath h h' FibrationStr : (B : Type ℓb) → Type ℓ → Type (ℓ-max ℓ ℓb) FibrationStr B A = A → B Fibration : (B : Type ℓb) → (ℓ : Level) → Type (ℓ-max ℓb (ℓ-suc ℓ)) Fibration {ℓb = ℓb} B ℓ = Σ[ A ∈ Type ℓ ] FibrationStr B A
alloy4fun_models/trashltl/models/6/zE4gwFkXmqBEkGsRE.als
Kaixi26/org.alloytools.alloy
0
3717
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/6/zE4gwFkXmqBEkGsRE.als open main pred idzE4gwFkXmqBEkGsRE_prop7 { some Protected } pred __repair { idzE4gwFkXmqBEkGsRE_prop7 } check __repair { idzE4gwFkXmqBEkGsRE_prop7 <=> prop7o }
Nehemiah/Change/Correctness.agda
inc-lc/ilc-agda
10
6602
<reponame>inc-lc/ilc-agda ------------------------------------------------------------------------ -- INCREMENTAL λ-CALCULUS -- -- Correctness of differentiation with the Nehemiah plugin. ------------------------------------------------------------------------ module Nehemiah.Change.Correctness where -- The denotational properties of the `derive` transformation -- for Calculus Nehemiah. In particular, the main theorem -- about it producing the correct incremental behavior. open import Nehemiah.Syntax.Type open import Nehemiah.Syntax.Term open import Nehemiah.Denotation.Value open import Nehemiah.Denotation.Evaluation open import Nehemiah.Change.Type open import Nehemiah.Change.Term open import Nehemiah.Change.Value open import Nehemiah.Change.Evaluation open import Nehemiah.Change.Validity open import Nehemiah.Change.Derive open import Nehemiah.Change.Implementation open import Base.Denotation.Notation open import Relation.Binary.PropositionalEquality open import Data.Integer open import Theorem.Groups-Nehemiah open import Postulate.Extensionality import Parametric.Change.Correctness Const ⟦_⟧Base ⟦_⟧Const ΔBase apply-base diff-base nil-base ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧ meaning-⊕-base meaning-⊝-base meaning-onil-base derive-const implementation-structure as Correctness open import Algebra.Structures private flatmap-funarg-equal : ∀ (f : ℤ → Bag) (Δf : Δ₍ int ⇒ bag ₎ f) Δf′ (Δf≈Δf′ : Δf ≈₍ int ⇒ bag ₎ Δf′) → (f ⊞₍ int ⇒ bag ₎ Δf) ≡ (f ⟦⊕₍ int ⇒ bag ₎⟧ Δf′) flatmap-funarg-equal f Δf Δf′ Δf≈Δf′ = ext lemma where lemma : ∀ v → f v ++ FunctionChange.apply Δf v (+ 0) ≡ f v ++ Δf′ v (+ 0) lemma v rewrite Δf≈Δf′ v (+ 0) (+ 0) refl = refl derive-const-correct : Correctness.Structure derive-const-correct (intlit-const n) = refl derive-const-correct add-const w Δw .Δw refl w₁ Δw₁ .Δw₁ refl rewrite mn·pq=mp·nq {w} {Δw} {w₁} {Δw₁} | associative-int (w + w₁) (Δw + Δw₁) (- (w + w₁)) = n+[m-n]=m {w + w₁} {Δw + Δw₁} derive-const-correct minus-const w Δw .Δw refl rewrite sym (-m·-n=-mn {w} {Δw}) | associative-int (- w) (- Δw) (- (- w)) = n+[m-n]=m { - w} { - Δw} derive-const-correct empty-const = refl derive-const-correct insert-const w Δw .Δw refl w₁ Δw₁ .Δw₁ refl = refl derive-const-correct union-const w Δw .Δw refl w₁ Δw₁ .Δw₁ refl rewrite ab·cd=ac·bd {w} {Δw} {w₁} {Δw₁} | associative-bag (w ++ w₁) (Δw ++ Δw₁) (negateBag (w ++ w₁)) = a++[b\\a]=b {w ++ w₁} {Δw ++ Δw₁} derive-const-correct negate-const w Δw .Δw refl rewrite sym (-a·-b=-ab {w} {Δw}) | associative-bag (negateBag w) (negateBag Δw) (negateBag (negateBag w)) = a++[b\\a]=b {negateBag w} {negateBag Δw} derive-const-correct flatmap-const w Δw Δw′ Δw≈Δw′ w₁ Δw₁ .Δw₁ refl rewrite flatmap-funarg-equal w Δw Δw′ Δw≈Δw′ = refl derive-const-correct sum-const w Δw .Δw refl rewrite homo-sum {w} {Δw} | associative-int (sumBag w) (sumBag Δw) (- sumBag w) = n+[m-n]=m {sumBag w} {sumBag Δw} open Correctness.Structure derive-const-correct public
programs/oeis/059/A059827.asm
neoneye/loda
22
162270
<filename>programs/oeis/059/A059827.asm ; A059827: Cubes of triangular numbers: (n*(n+1)/2)^3. ; 1,27,216,1000,3375,9261,21952,46656,91125,166375,287496,474552,753571,1157625,1728000,2515456,3581577,5000211,6859000,9261000,12326391,16194277,21024576,27000000,34328125,43243551,54010152,66923416,82312875,100544625,122023936,147197952,176558481,210644875,250047000,295408296,347428927,406869021,474552000,551368000,638277381,736314327,846590536,970299000,1108717875,1263214441,1435249152,1626379776,1838265625,2072671875,2331473976,2616662152,2930345991,3274759125,3652264000,4065356736,4516672077,5008988431,5545233000,6128487000,6761990971,7449150177,8193540096,8998912000,9869198625,10808519931,11821188952,12911717736,14084823375,15345434125,16698695616,18149977152,19704878101,21369234375,23149125000,25050878776,27081081027,29246580441,31554496000,34012224000,36627445161,39408131827,42362555256,45499293000,48827236375,52355598021,56093919552,60052079296,64240300125,68669157375,73349586856,78292892952,83510756811,89015244625,94818816000,100934332416,107375065777,114154707051,121287375000,128787625000 add $0,2 bin $0,2 pow $0,3
alloy4fun_models/trashltl/models/3/KgjDaFyoRvYFKT7Ef.als
Kaixi26/org.alloytools.alloy
0
617
<gh_stars>0 open main pred idKgjDaFyoRvYFKT7Ef_prop4 { some f:File | eventually f in Trash } pred __repair { idKgjDaFyoRvYFKT7Ef_prop4 } check __repair { idKgjDaFyoRvYFKT7Ef_prop4 <=> prop4o }
software/modules/actuators/servo.ads
TUM-EI-RCS/StratoX
12
286
-- Institution: Technische Universitaet Muenchen -- Department: Real-Time Computer Systems (RCS) -- Project: StratoX -- -- Authors: <NAME> (<EMAIL>) -- <NAME> (<EMAIL>) -- -- @summary Servo Actuator frontend with Units; use Units; with Config; use Config; package Servo with SPARK_Mode is type Servo_Type is (LEFT_ELEVON, RIGHT_ELEVON); subtype Servo_Angle_Type is Angle_Type range CFG_SERVO_ANGLE_LIMIT_MIN .. CFG_SERVO_ANGLE_LIMIT_MAX; procedure initialize; procedure activate; procedure deactivate; procedure Set_Critical_Angle (which: Servo_Type; angle : Servo_Angle_Type); -- call this if the angle is vital at this very moment. It will be restored -- immediately after a potential in-air reset. this procedure is a bit slower procedure Set_Angle (which: Servo_Type; angle : Servo_Angle_Type); -- call this for all other angles, which is faster. procedure sync; end Servo;
archive/agda-2/Oscar/Data3.agda
m0davis/oscar
0
11662
<filename>archive/agda-2/Oscar/Data3.agda {- trying (and failing) to create a univesal "successor" -} -- types with and without payloads defined dependently, those w/o payloads in terms of those with (using ⊤ as a trivial payload) -- this complicates the successor constructor, `!`, so we use use pattern (OR function?), `¡` module Oscar.Data3 where record ⊤ : Set where constructor tt infixr 20 _∷_ -- List data ⟦_⟧ {a} (A : Set a) : Set a where ∅ : ⟦ A ⟧ _∷_ : A → ⟦ A ⟧ → ⟦ A ⟧ -- Nat ⟦⟧ = ⟦ ⊤ ⟧ infix 21 ¡_ pattern ¡_ ⟦A⟧ = tt ∷ ⟦A⟧ --¡ : ⟦⟧ → ⟦⟧ --¡ ⟦A⟧ = tt ∷ ⟦A⟧ -- Fin, with payload data ⟦_⟧[_] {a} (A : ⟦⟧ → Set a) : ⟦⟧ → Set a where ∅ : ∀ {n} → ⟦ A ⟧[ ¡ n ] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ n ] → ⟦ A ⟧[ ¡ n ] data ⟦_⟧[_₀] {a} (A : ⟦⟧ → Set a) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[ ∅ ₀] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ n ₀] → ⟦ A ⟧[ ¡ n ₀] Const_ : ∀ {a} {A : Set a} {b} {B : Set b} → B → A → B Const_ x _ = x ⟦⟧[_₀] = ⟦ Const ⊤ ⟧[_₀] -- Fin ⟦⟧[_] = ⟦ Const ⊤ ⟧[_] -- m ≤ n, counting down from n-1 to m data ⟦_⟧[_≤↓_] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[ m ≤↓ m ] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ m ≤↓ n ] → ⟦ A ⟧[ m ≤↓ ¡ n ] infix 21 ‼_ pattern ‼_ ⟦A⟧ = tt ∷ ⟦A⟧ -- tricky, works for all above _∷_ constructors only because it is defined afterwards, won't work for later-defined constructors testNat : ⟦⟧ testNat = ¡ ∅ testListNat : ⟦ ⟦⟧ ⟧ testListNat = ¡ ∅ ∷ ‼ ∅ ∷ ‼ ‼ ∅ ∷ ∅ ∷ ¡ ¡ ¡ ∅ ∷ ∅ testFin : ⟦⟧[ ¡ ¡ ∅ ] testFin = ‼ ∅ ⟦⟧[_≤↓_] = ⟦ Const ⊤ ⟧[_≤↓_] test≤↓ : ⟦⟧[ ‼ ‼ ‼ ∅ ≤↓ ‼ ‼ ‼ ‼ ‼ ∅ ] test≤↓ = ‼ ‼ ∅ -- m ≤ n, counting up from m to n-1 data ⟦_⟧[_↑≤_] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[ m ↑≤ m ] _∷_ : ∀ {n} → A m → ⟦ A ⟧[ ¡ m ↑≤ n ] → ⟦ A ⟧[ m ↑≤ n ] ⟦⟧[_↑≤_] = ⟦ Const ⊤ ⟧[_↑≤_] -- Inj (almost) data ⟦_⟧[_↓≤↓_] {a} (A : ⟦⟧ → ⟦⟧ → Set a) : ⟦⟧ → ⟦⟧ → Set a where ∅ : ∀ {n} → ⟦ A ⟧[ ∅ ↓≤↓ n ] _∷_ : ∀ {m n} → A m n → ⟦ A ⟧[ m ↓≤↓ n ] → ⟦ A ⟧[ ¡ m ↓≤↓ ¡ n ] ⟦⟧[_↓≤↓_] = ⟦ Const Const ⊤ ⟧[_↓≤↓_] ⓪ ⑴ ⑵ : ⟦⟧ ⓪ = ∅ ⑴ = ‼ ∅ ⑵ = ‼ ⑴ data D : ⟦⟧ → ⟦⟧ → Set where List : D ⓪ ⓪ Fin : D ⑴ ⑴ Vec : D ⑴ ⑴ Descend : D ⑴ ⑵ Ascend : D ⑴ ⑵ Inj : D ⑵ ⑵ open import Oscar.Level theA : ∀ ℓ → ⟦⟧ → Set (lsuc ℓ) theA ℓ ∅ = Set ℓ theA ℓ (tt ∷ x₁) = ⟦⟧ → theA ℓ x₁ theIndices : ⟦⟧ → Set theIndices x = ⟦ Const ⟦⟧ ⟧[ x ₀] μ : ∀ {p i} → D p i → ∀ {a} → theA a p → theIndices i → Set a μ List A _ = ⟦ A ⟧ μ Fin A (n ∷ _) = ⟦ A ⟧[ n ] μ Vec A (n ∷ _) = ⟦ A ⟧[ n ₀] μ Descend A (m ∷ n ∷ _) = ⟦ A ⟧[ m ≤↓ n ] μ Ascend A (m ∷ n ∷ _) = ⟦ A ⟧[ m ↑≤ n ] μ Inj A (m ∷ n ∷ ∅) = ⟦ A ⟧[ m ↓≤↓ n ] μ¡ : ∀ {p i} → D p i → theIndices i → Set μ¡ List _ = ⟦⟧ → ⟦⟧ μ¡ Fin (n ∷ _) = ⟦⟧[ n ] → ⟦⟧[ ¡ n ] μ¡ Vec (n ∷ _) = ⟦⟧[ n ₀] → ⟦⟧[ ¡ n ₀] μ¡ Descend (m ∷ n ∷ _) = ⟦⟧[ m ≤↓ n ] → ⟦⟧[ m ≤↓ ¡ n ] μ¡ Ascend (m ∷ n ∷ _) = ⟦⟧[ ¡ m ↑≤ n ] → ⟦⟧[ m ↑≤ n ] μ¡ Inj (m ∷ n ∷ _) = ⟦⟧[ m ↓≤↓ n ] → ⟦⟧[ ¡ m ↓≤↓ ¡ n ] μ¡↑ : ∀ {p i} → D p i → Set μ¡↑ List = ⟦⟧ → ⟦⟧ μ¡↑ Fin = {!!} μ¡↑ Vec = {!!} μ¡↑ Descend = {!!} μ¡↑ Ascend = {!!} μ¡↑ Inj = {!!} theArguments : ∀ {p i} → (d : D p i) → Set theArguments List = μ¡ List ∅ theArguments Fin = {n : ⟦⟧} → μ¡ Fin (n ∷ ∅) theArguments Vec = {n : ⟦⟧} → μ¡ Vec (n ∷ ∅) theArguments Descend = {m : ⟦⟧} → {n : ⟦⟧} → μ¡ Descend (m ∷ n ∷ ∅) theArguments Ascend = {m : ⟦⟧} → {n : ⟦⟧} → μ¡ Ascend (m ∷ n ∷ ∅) theArguments Inj = {m : ⟦⟧} → {n : ⟦⟧} → μ¡ Inj (m ∷ n ∷ ∅) infix 21 ↑_ ↑_ : ∀ {p i} → {d : D p i} → {I : theIndices i} → μ¡ d I ↑_ {d = List} = ‼_ ↑_ {d = Fin} {x ∷ I} = ‼_ ↑_ {d = Vec} {x ∷ I} = ‼_ ↑_ {d = Descend} {x ∷ x₁ ∷ I} = ‼_ ↑_ {d = Ascend} {x ∷ x₁ ∷ I} = tt ∷_ ↑_ {d = Inj} {x ∷ x₁ ∷ I} = tt ∷_ ↑↑ : ∀ {p i} → {d : D p i} → theArguments d ↑↑ {d = List} = {!‼_!} ↑↑ {d = Fin} = ‼_ ↑↑ {d = Vec} = ‼_ ↑↑ {d = Descend} = ‼_ ↑↑ {d = Ascend} = tt ∷_ ↑↑ {d = Inj} = tt ∷_ record BANG {p i} (d : D p i) : Set where field ⟰ : theArguments d open BANG ⦃ … ⦄ instance BANGFin : BANG Fin BANG.⟰ BANGFin {n} = ‼_ testμ : μ Fin (Const ⊤) (‼ ‼ ‼ ‼ ∅ ∷ ∅) testμ = ⟰ {d = Fin} {!!} -- ↑↑ {d = Fin} {!!} -- ↑_ {d = Fin} {I = _ ∷ {!!}} ∅ -- ↑_ {d = Fin} {I = {!!} ∷ {!!}} {!!} {- data ⟦_⟧ {a} (A : Set a) : Set a where data ⟦_⟧[_] {a} (A : ⟦⟧ → Set a) : ⟦⟧ → Set a where data ⟦_⟧[_≤↓_] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where data ⟦_⟧[_↑≤_] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where data ⟦_⟧[_↓≤↓_] {a} (A : ⟦⟧ → ⟦⟧ → Set a) : ⟦⟧ → ⟦⟧ → Set a where -}
test/interaction/Issue3989.agda
shlevy/agda
1,989
15067
{-# OPTIONS --warning ShadowingInTelescope #-} postulate _ : (A A : Set) → Set
notes/FOT/FOTC/Program/Nest/Nest-FOTC-BC.agda
asr/fotc
11
14959
<filename>notes/FOT/FOTC/Program/Nest/Nest-FOTC-BC.agda ------------------------------------------------------------------------------ -- FOTC version of a nested recursive function by the -- Bove-Capretta method ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- From: <NAME> and <NAME>. Nested general recursion and -- partiality in type theory. Vol. 2152 of LNCS. 2001. module FOT.FOTC.Program.Nest.Nest-FOTC-BC where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Data.Nat import FOTC.Data.Nat.Induction.Acc.WF-I open FOTC.Data.Nat.Induction.Acc.WF-I.<-WF open import FOTC.Data.Nat.Inequalities open import FOTC.Data.Nat.Inequalities.PropertiesI ------------------------------------------------------------------------------ -- The nest function. postulate nest : D → D nest-0 : nest zero ≡ zero nest-S : ∀ d → nest (succ₁ d) ≡ nest (nest d) data Dom : D → Set where dom0 : Dom zero domS : ∀ d → Dom d → Dom (nest d) → Dom (succ₁ d) -- Inductive principle associated to the domain predicate. Dom-ind : (P : D → Set) → P zero → (∀ {d} → Dom d → P d → Dom (nest d) → P (nest d) → P (succ₁ d)) → ∀ {d} → Dom d → P d Dom-ind P P0 ih dom0 = P0 Dom-ind P P0 ih (domS d h₁ h₂) = ih h₁ (Dom-ind P P0 ih h₁) h₂ (Dom-ind P P0 ih h₂) -- The domain predicate is total. dom-N : ∀ d → Dom d → N d dom-N .zero dom0 = nzero dom-N .(succ₁ d) (domS d h₁ h₂) = nsucc (dom-N d h₁) nestCong : ∀ {n₁ n₂} → n₁ ≡ n₂ → nest n₁ ≡ nest n₂ nestCong refl = refl nest-x≡0 : ∀ {n} → N n → nest n ≡ zero nest-x≡0 nzero = nest-0 nest-x≡0 (nsucc {n} Nn) = nest (succ₁ n) ≡⟨ nest-S n ⟩ nest (nest n) ≡⟨ nestCong (nest-x≡0 Nn) ⟩ nest zero ≡⟨ nest-0 ⟩ zero ∎ -- The nest function is total in its domain (via structural recursion -- in the domain predicate). nest-DN : ∀ {d} → Dom d → N (nest d) nest-DN dom0 = subst N (sym nest-0) nzero nest-DN (domS d h₁ h₂) = subst N (sym (nest-S d)) (nest-DN h₂) -- The nest function is total. nest-N : ∀ {n} → N n → N (nest n) nest-N Nn = subst N (sym (nest-x≡0 Nn)) nzero nest-≤ : ∀ {n} → Dom n → nest n ≤ n nest-≤ dom0 = le (nest zero) zero ≡⟨ leLeftCong nest-0 ⟩ le zero zero ≡⟨ x≤x nzero ⟩ true ∎ nest-≤ (domS n h₁ h₂) = ≤-trans (nest-N (nsucc (dom-N n h₁))) (nest-N (dom-N n h₁)) (nsucc Nn) prf₁ prf₂ where Nn : N n Nn = dom-N n h₁ prf₁ : nest (succ₁ n) ≤ nest n prf₁ = le (nest (succ₁ n)) (nest n) ≡⟨ leLeftCong (nest-S n) ⟩ le (nest (nest n)) (nest n) ≡⟨ nest-≤ h₂ ⟩ true ∎ prf₂ : nest n ≤ succ₁ n prf₂ = ≤-trans (nest-N (dom-N n h₁)) Nn (nsucc Nn) (nest-≤ h₁) (x≤Sx Nn) N→Dom : ∀ {n} → N n → Dom n N→Dom = <-wfind P ih where P : D → Set P = Dom ih : ∀ {x} → N x → (∀ {y} → N y → y < x → P y) → P x ih nzero h = dom0 ih (nsucc {x} Nx) h = domS x dn-x (h (nest-N Nx) (x≤y→x<Sy (nest-N Nx) Nx (nest-≤ dn-x))) where dn-x : Dom x dn-x = h Nx (x<Sx Nx)
src/core/objectfile/coff_pe/read_coff.asm
Hiroshi123/bin_tools
0
7131
<gh_stars>0 default rel section .text global __z__obj__run_through_coff_shdr3 global __z__obj__run_through_coff_symtable3 ;;; microsoft ;;; caller saved register RAX, RCX, RDX, R8, R9, R10, R11 ;;; callee saved register RBX, RBP, RDI, RSI, RSP, R12, R13, R14, and R15 ;;; sysv args ;; RDI, RSI, RDX, RCX, R8, R9 __z__obj__run_through_coff_shdr3: push rbp mov rbp,rsp push rbx push rdx ;; 2nd(rsi) should be set on r13(which is one of registers kept on caller) mov r13,rsi ;; add number of sections mov rax,0 mov word ax,[rdi+2] mov r15,rax cmp r15,0 je __z__obj__run_through_coff_shdr3._b2 ;; r12 = string table pointer (end of symbol table) ;; get End of SymbolTable which is beginning of string table ;; get NumberOfSymbols ;; mov dword eax,[rdi+0xc] ;; mov r14,rax ;; mov rax,0x12 ;; mul r14 ;; ;; get PointerToSymbolTable(+0x8) ;; mov r12,rax ;; mov dword eax,[rdi+0x8] ;; add r12,rax ;; add r12,rdi mov r12,rdi ;; 1st argument is the top of file pointer mov r14,rdi add r14,0x14 ;; add size of optional header mov rax,0 mov word ax,[rdi+0x10] add r14,rax ;; preserve rdx(3rd argument) as it is volatile ;; mov rbx,rcx ._b1: ;; 1st arg mov rdi,r14 ;; 2nd arg mov rsi,r12 ;; 3rd arg mov rdx,[rsp] call r13 ;; increment size of ImageSectionHeader add r14,40 sub r15,1 cmp r15,0 jne __z__obj__run_through_coff_shdr3._b1 ;; mov rax,3 ;; pop rdx ;; pop rsi ;; pop rdi ;; ;; these values are promised to be kept from the System5 amd64 convention. ;; pop r15 ;; pop r14 ;; pop r13 ._b2: pop rdx pop rbx pop rbp ret __z__obj__run_through_coff_symtable3: push rbp mov rbp,rsp push rbx push r12 push rdx ;; 2nd(rsi) should be set on r13(which is one of registers kept on caller) mov r13,rsi ;; get PointerToSymbolTable mov dword eax,[rdi+0x8] mov r15,rax add r15,rdi ;; get NumberOfSymbols mov dword eax,[rdi+0xc] mov r14,rax ;; get End of SymbolTable which is beginning of string table mov rax,0x12 mul r14 mov r12, r15 add r12, rax ._b1: ;; 1st arg mov rdi,r15 ;; 2nd arg mov rsi,r12 ;; 3rd arg mov rdx,[rsp] call r13 add r15,0x12 sub r14,1 cmp r14,0 jne __z__obj__run_through_coff_symtable3._b1 pop rdx pop r12 pop rbx pop rbp ret
Assembly/8086/HelloWorld.asm
silence0201/iOS-Reverse
15
23211
assume cs:code, ds:data ; 数据段 data segment db 11h,22h,'Hello World!$' data ends ; 代码段 code segment start: ; 设置ds的值 mov ax, data mov ds, ax ; 显示字符 DS:DX=串地址 '$'结束字符串 mov dx, 2h mov ah, 9h int 21h ; 结束程序 mov ah, 4ch int 21h code ends end start
tests/src/shared/gl_test-display_backend.ads
Cre8or/OpenGLAda
79
12047
<reponame>Cre8or/OpenGLAda -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" package GL_Test.Display_Backend is -- abstraction layer for tests so they can run on both GLFW 2 and 3. -- only exposes most basic functionality, not intended for usage outside -- tests. procedure Init (Debugging : Boolean := False); procedure Open_Window (Width, Height : Natural; Depth_Bits : Natural := 0); procedure Swap_Buffers; procedure Poll_Events; procedure Wait_For_Events; procedure Set_Window_Title (Value : String); function Escape_Pressed return Boolean; function Window_Opened return Boolean; procedure Close_Window; procedure Shutdown; procedure Configure_Minimum_OpenGL_Version (Major, Minor : Natural); end GL_Test.Display_Backend;
installer/scripts/uninstall.applescript
ericmckean/webm.webmquicktime
8
1937
(* Copyright (c) 2012 The WebM project authors. All Rights Reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file in the root of the source tree. An additional intellectual property rights grant can be found in the file PATENTS. All contributing project authors may be found in the AUTHORS file in the root of the source tree. *) (* Get path to uninstall bundle. *) tell application "Finder" to get POSIX path of ¬ ((container of (path to me)) as text) (* Execute the uninstall script. *) do shell script quoted form of result & "./uninstall_helper.sh" ¬ with administrator privileges
alloy4fun_models/trainstlt/models/5/fdahJAGbot3iG6GC9.als
Kaixi26/org.alloytools.alloy
0
2224
open main pred idfdahJAGbot3iG6GC9_prop6 { always (all s : Signal | s in Green implies s not in Green' or s not in Green implies s in Green') } pred __repair { idfdahJAGbot3iG6GC9_prop6 } check __repair { idfdahJAGbot3iG6GC9_prop6 <=> prop6o }
programs/oeis/008/A008627.asm
neoneye/loda
22
87330
<filename>programs/oeis/008/A008627.asm<gh_stars>10-100 ; A008627: Molien series for A_4. ; 1,1,2,3,5,6,10,12,17,21,28,33,43,50,62,72,87,99,118,133,155,174,200,222,253,279,314,345,385,420,466,506,557,603,660,711,775,832,902,966,1043,1113,1198,1275,1367,1452,1552,1644,1753,1853,1970,2079,2205,2322 lpb $0 mov $2,$0 sub $0,2 seq $2,36410 ; G.f.: (1+x^6)/((1-x)*(1-x^3)*(1-x^4)). add $1,$2 lpe add $1,1 mov $0,$1
programs/oeis/030/A030123.asm
jmorken/loda
1
25040
; A030123: Most likely total for a roll of n 6-sided dice, choosing the smallest if there is a choice. ; 0,1,7,10,14,17,21,24,28,31,35,38,42,45,49,52,56,59,63,66,70,73,77,80,84,87,91,94,98,101,105,108,112,115,119,122,126,129,133,136,140,143,147,150,154,157,161,164,168,171,175,178,182,185,189,192,196,199,203,206,210,213,217,220,224,227,231,234,238,241,245,248,252,255,259,262,266,269,273,276,280,283,287,290,294,297,301,304,308,311,315,318,322,325,329,332,336,339,343,346,350,353,357,360,364,367,371,374,378,381,385,388,392,395,399,402,406,409,413,416,420,423,427,430,434,437,441,444,448,451,455,458,462,465,469,472,476,479,483,486,490,493,497,500,504,507,511,514,518,521,525,528,532,535,539,542,546,549,553,556,560,563,567,570,574,577,581,584,588,591,595,598,602,605,609,612,616,619,623,626,630,633,637,640,644,647,651,654,658,661,665,668,672,675,679,682,686,689,693,696,700,703,707,710,714,717,721,724,728,731,735,738,742,745,749,752,756,759,763,766,770,773,777,780,784,787,791,794,798,801,805,808,812,815,819,822,826,829,833,836,840,843,847,850,854,857,861,864,868,871 mov $1,$0 mov $2,$0 lpb $2 mul $1,7 div $1,2 pow $2,$3 lpe
test/Succeed/Issue3354.agda
shlevy/agda
1,989
8722
<filename>test/Succeed/Issue3354.agda open import Agda.Builtin.Equality postulate Ty Cxt : Set Var Tm : Ty → Cxt → Set _≤_ : (Γ Δ : Cxt) → Set variable Γ Δ Φ : Cxt A B C : Ty x : Var A Γ Mon : (P : Cxt → Set) → Set Mon P = ∀{Δ Γ} (ρ : Δ ≤ Γ) → P Γ → P Δ postulate _•_ : Mon (_≤ Φ) monVar : Mon (Var A) monTm : Mon (Tm A) postulate refl-ish : {A : Set} {x y : A} → x ≡ y variable ρ ρ' : Δ ≤ Γ monVar-comp : monVar ρ (monVar ρ' x) ≡ monVar (ρ • ρ') x monVar-comp {ρ = ρ} {ρ' = ρ'} {x = x} = refl-ish variable t : Tm A Γ monTm-comp : monTm ρ (monTm ρ' t) ≡ monTm (ρ • ρ') t monTm-comp {ρ = ρ} {ρ' = ρ'} {t = t} = refl-ish
programs/oeis/175/A175824.asm
neoneye/loda
22
241888
<gh_stars>10-100 ; A175824: Maximum unsigned integer that can be stored in n bytes. ; 0,255,65535,16777215,4294967295,1099511627775,281474976710655,72057594037927935,18446744073709551615,4722366482869645213695,1208925819614629174706175,309485009821345068724781055 mov $1,256 pow $1,$0 sub $1,1 mov $0,$1
libsrc/_DEVELOPMENT/fcntl/c/sdcc_ix/vopen_callee.asm
meesokim/z88dk
0
173255
; int vopen_callee(const char *path, int oflag, void *arg) SECTION code_fcntl PUBLIC _vopen_callee, l0_vopen_callee EXTERN asm_vopen _vopen_callee: pop hl pop de pop bc ex (sp),hl l0_vopen_callee: push ix call asm_vopen pop ix ret
oeis/190/A190870.asm
neoneye/loda-programs
11
177199
<filename>oeis/190/A190870.asm ; A190870: a(n) = 11*a(n-1) - 22*a(n-2), a(0)=0, a(1)=1. ; Submitted by <NAME> ; 0,1,11,99,847,7139,59895,501787,4201967,35182323,294562279,2466173963,20647543455,172867150819,1447292702999,12117142414971,101448127098703,849352264956371,7111016118348615,59535427472794603,498447347597071103,4173141419166300867,34938713963693745271,292516742378972578907,2449032458967435972015,20503988716304398956211,171665161782064797133991,1437229027844015991437259,12032885747078750368862047,100742704605297902245862819,843446264222544416589525975,7061569405131434733075803707 mov $1,-1 lpb $0 sub $0,1 mul $2,2 add $1,$2 sub $2,$1 mul $1,11 lpe mov $0,$2
oeis/103/A103646.asm
neoneye/loda-programs
11
100431
<gh_stars>10-100 ; A103646: G.f.: 9*(3x+1)/(1+2x-6x^2-27x^3). ; Submitted by <NAME>(s1) ; 9,9,36,225,9,2304,1521,11025,49284,8649,576081,230400,3229209,10478169,4639716,140778225,29192409,911556864,2153052801,1951430625,33627490884,2586027609,249281516961,424895385600,715721076009,7848531119529,69439628196,66276776513025,79773424970409,239988679098624,1788136157476881,17542233839025,17173426812846084,14038076029217769,75438049132294641,397034881857561600,37586583867524409,4343863449982276089,2257734413394757476,22562549637527300625,85705620354835398009,24922886277151459584 mov $1,1 mov $2,$0 lpb $2 sub $2,1 mul $3,3 sub $1,$3 add $3,$1 lpe pow $1,2 mov $0,$1 mul $0,9
programs/oeis/105/A105349.asm
neoneye/loda
22
244619
; A105349: Characteristic sequence for the Pell numbers. ; 1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 pow $0,2 div $0,2 seq $0,5369 ; a(n) = 1 if n is of the form m(m+1), else 0.
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/controlled1.ads
best08618/asylo
7
25658
-- { dg-do compile } with Ada.Finalization; with Controlled1_Pkg; use Controlled1_Pkg; package Controlled1 is type Collection is new Ada.Finalization.Controlled with null record; type Object_Kind_Type is (One, Two); type Byte_Array is array (Natural range <>) of Integer; type Bounded_Byte_Array_Type is record A : Byte_Array (1 .. Value); end record; type Object_Type is tagged record A : Bounded_Byte_Array_Type; end record; type R_Object_Type is new Object_Type with record L : Collection; end record; type Obj_Type (Kind : Object_Kind_Type := One) is record case Kind is when One => R : R_Object_Type; when others => null; end case; end record; type Obj_Array_Type is array (Positive range <>) of Obj_Type; end Controlled1;
source/oasis/program-elements-membership_tests.ads
optikos/oasis
0
23279
<filename>source/oasis/program-elements-membership_tests.ads -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Element_Vectors; package Program.Elements.Membership_Tests is pragma Pure (Program.Elements.Membership_Tests); type Membership_Test is limited interface and Program.Elements.Expressions.Expression; type Membership_Test_Access is access all Membership_Test'Class with Storage_Size => 0; not overriding function Expression (Self : Membership_Test) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Choices (Self : Membership_Test) return not null Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Has_Not (Self : Membership_Test) return Boolean is abstract; type Membership_Test_Text is limited interface; type Membership_Test_Text_Access is access all Membership_Test_Text'Class with Storage_Size => 0; not overriding function To_Membership_Test_Text (Self : aliased in out Membership_Test) return Membership_Test_Text_Access is abstract; not overriding function Not_Token (Self : Membership_Test_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function In_Token (Self : Membership_Test_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Membership_Tests;
test/asset/agda-stdlib-1.0/Induction/Lexicographic.agda
omega12345/agda-mode
0
14933
<reponame>omega12345/agda-mode<gh_stars>0 ------------------------------------------------------------------------ -- The Agda standard library -- -- Lexicographic induction ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Induction.Lexicographic where open import Data.Product open import Induction open import Level -- The structure of lexicographic induction. Σ-Rec : ∀ {a b ℓ₁ ℓ₂ ℓ₃} {A : Set a} {B : A → Set b} → RecStruct A (ℓ₁ ⊔ b) ℓ₂ → (∀ x → RecStruct (B x) ℓ₁ ℓ₃) → RecStruct (Σ A B) _ _ Σ-Rec RecA RecB P (x , y) = -- Either x is constant and y is "smaller", ... RecB x (λ y' → P (x , y')) y × -- ...or x is "smaller" and y is arbitrary. RecA (λ x' → ∀ y' → P (x' , y')) x _⊗_ : ∀ {a b ℓ₁ ℓ₂ ℓ₃} {A : Set a} {B : Set b} → RecStruct A (ℓ₁ ⊔ b) ℓ₂ → RecStruct B ℓ₁ ℓ₃ → RecStruct (A × B) _ _ RecA ⊗ RecB = Σ-Rec RecA (λ _ → RecB) -- Constructs a recursor builder for lexicographic induction. Σ-rec-builder : ∀ {a b ℓ₁ ℓ₂ ℓ₃} {A : Set a} {B : A → Set b} {RecA : RecStruct A (ℓ₁ ⊔ b) ℓ₂} {RecB : ∀ x → RecStruct (B x) ℓ₁ ℓ₃} → RecursorBuilder RecA → (∀ x → RecursorBuilder (RecB x)) → RecursorBuilder (Σ-Rec RecA RecB) Σ-rec-builder {RecA = RecA} {RecB = RecB} recA recB P f (x , y) = (p₁ x y p₂x , p₂x) where p₁ : ∀ x y → RecA (λ x' → ∀ y' → P (x' , y')) x → RecB x (λ y' → P (x , y')) y p₁ x y x-rec = recB x (λ y' → P (x , y')) (λ y y-rec → f (x , y) (y-rec , x-rec)) y p₂ : ∀ x → RecA (λ x' → ∀ y' → P (x' , y')) x p₂ = recA (λ x → ∀ y → P (x , y)) (λ x x-rec y → f (x , y) (p₁ x y x-rec , x-rec)) p₂x = p₂ x [_⊗_] : ∀ {a b ℓ₁ ℓ₂ ℓ₃} {A : Set a} {B : Set b} {RecA : RecStruct A (ℓ₁ ⊔ b) ℓ₂} {RecB : RecStruct B ℓ₁ ℓ₃} → RecursorBuilder RecA → RecursorBuilder RecB → RecursorBuilder (RecA ⊗ RecB) [ recA ⊗ recB ] = Σ-rec-builder recA (λ _ → recB) ------------------------------------------------------------------------ -- Example private open import Data.Nat open import Induction.Nat as N -- The Ackermann function à la <NAME>. ackermann : ℕ → ℕ → ℕ ackermann m n = build [ N.recBuilder ⊗ N.recBuilder ] (λ _ → ℕ) (λ { (zero , n) _ → 1 + n ; (suc m , zero) (_ , ackm•) → ackm• 1 ; (suc m , suc n) (ack[1+m]n , ackm•) → ackm• ack[1+m]n }) (m , n)
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_21.asm
ljhsiun2/medusa
9
163244
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_A_ht+0x10adc, %r13 nop nop nop nop cmp %r8, %r8 mov $0x6162636465666768, %r12 movq %r12, %xmm2 movups %xmm2, (%r13) and %rax, %rax lea addresses_normal_ht+0x17e5c, %rcx nop nop nop nop xor $23328, %r9 mov (%rcx), %r14d nop nop nop xor $18774, %r12 lea addresses_UC_ht+0xd9c, %rcx nop xor %r12, %r12 mov $0x6162636465666768, %rax movq %rax, %xmm4 and $0xffffffffffffffc0, %rcx vmovaps %ymm4, (%rcx) and %r8, %r8 lea addresses_UC_ht+0x151dc, %r14 clflush (%r14) xor $54953, %r8 movups (%r14), %xmm3 vpextrq $0, %xmm3, %r9 nop nop add %rcx, %rcx lea addresses_WC_ht+0x1bf94, %rsi lea addresses_WC_ht+0x178dc, %rdi nop nop nop nop cmp $30316, %r12 mov $113, %rcx rep movsl nop nop nop nop and %r13, %r13 lea addresses_WT_ht+0x6adc, %r13 nop sub $31636, %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%r13) nop and $37054, %rsi lea addresses_UC_ht+0x17108, %r9 xor %rcx, %rcx mov $0x6162636465666768, %r12 movq %r12, %xmm6 vmovups %ymm6, (%r9) nop nop nop nop add %rsi, %rsi lea addresses_normal_ht+0x1c578, %rcx nop nop nop nop nop and %rdi, %rdi mov $0x6162636465666768, %r8 movq %r8, %xmm6 vmovups %ymm6, (%rcx) nop nop nop add %r9, %r9 lea addresses_WT_ht+0x6cdc, %rsi lea addresses_normal_ht+0x1752, %rdi nop nop add %r13, %r13 mov $52, %rcx rep movsw nop nop nop xor $39665, %rax lea addresses_A_ht+0x1badc, %rdi nop nop nop nop nop dec %r8 mov (%rdi), %r14d nop nop nop nop nop xor $37912, %r8 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %r15 push %rax push %rsi // Store lea addresses_D+0x7a65, %rax add $34184, %rsi mov $0x5152535455565758, %r10 movq %r10, %xmm1 movups %xmm1, (%rax) nop nop nop and $17913, %r11 // Faulty Load lea addresses_WC+0x1badc, %r12 nop nop nop nop xor $970, %r15 mov (%r12), %rax lea oracles, %r15 and $0xff, %rax shlq $12, %rax mov (%r15,%rax,1), %rax pop %rsi pop %rax pop %r15 pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_WC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
Rust/dis.asm
yuxiqian/assembly-inject
0
104104
(__TEXT,__text) section _main: 000000010000a340 pushq %rbp 000000010000a341 movq %rsp, %rbp 000000010000a344 subq $0x10, %rsp 000000010000a348 movslq %edi, %rax 000000010000a34b leaq -0x1a2(%rip), %rdi 000000010000a352 movq %rsi, -0x8(%rbp) 000000010000a356 movq %rax, %rsi 000000010000a359 movq -0x8(%rbp), %rdx 000000010000a35d callq 0x10000a560 000000010000a362 movl %eax, %ecx 000000010000a364 movl %ecx, %eax 000000010000a366 addq $0x10, %rsp 000000010000a36a popq %rbp 000000010000a36b retq 000000010000a36c nop 000000010000a36d nop 000000010000a36e nop 000000010000a36f nop
base/SyscallInputSum.asm
gmarciani/assimply
1
84069
<reponame>gmarciani/assimply # @Name: SyscallInputSum # @Description: The program sums two integers, prompted by the user, the displays the result. # # @Author: <NAME> <<EMAIL>> .text .globl main main: la $t0, value li $v0, 5 # loads the syscall 'read_int' in register $v0 syscall # executes the syscall 'read_int' sw $v0, 0($t0) # stores the integer returned by the syscall. $t0=a li $v0, 5 # loads the syscall 'read_int' in register $v0 syscall # executes the syscall 'read_int' sw $v0, 4($t0) # stores the integer returned by the syscall. $t0=b lw $t1, 0($t0) # $t1=a lw $t2, 4($t0) # $t2=b add $t3, $t1, $t2 # $t3=c=a+b sw $t3, 8($t0) # $t0=c li $v0, 4 # loads the syscall 'print_string' in register $v0 la $a0, msgSum # 'print_string' with argument msgSum syscall # executes the syscall 'print_string' li $v0, 1 # loads the syscall 'print_int' in register $v0 move $a0, $t3 # 'print_int' with argument $t3 syscall # executes the syscall 'print_int' li $v0, 10 # loads the syscall 'program_exit' in register $v0 syscall # executes the syscall 'program_exit' .data value: .word 0, 0, 0 msgSum: .asciiz "The sum is "
data/jpred4/jp_batch_1613899824__qgKH_EZ/jp_batch_1613899824__qgKH_EZ.als
jonriege/predict-protein-structure
0
3876
SILENT_MODE BLOCK_FILE jp_batch_1613899824__qgKH_EZ.concise.blc MAX_NSEQ 866 MAX_INPUT_LEN 868 OUTPUT_FILE jp_batch_1613899824__qgKH_EZ.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 325 855 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 856 325 865 H SPACE SUB_CHARS 1 856 325 865 E SPACE SUB_CHARS 1 856 325 865 - SPACE STRAND 5 859 11 COLOUR_TEXT_REGION 5 859 11 859 51 STRAND 34 859 41 COLOUR_TEXT_REGION 34 859 41 859 51 STRAND 82 859 87 COLOUR_TEXT_REGION 82 859 87 859 51 STRAND 121 859 125 COLOUR_TEXT_REGION 121 859 125 859 51 STRAND 147 859 153 COLOUR_TEXT_REGION 147 859 153 859 51 STRAND 175 859 181 COLOUR_TEXT_REGION 175 859 181 859 51 STRAND 187 859 193 COLOUR_TEXT_REGION 187 859 193 859 51 STRAND 258 859 265 COLOUR_TEXT_REGION 258 859 265 859 51 STRAND 276 859 284 COLOUR_TEXT_REGION 276 859 284 859 51 STRAND 288 859 293 COLOUR_TEXT_REGION 288 859 293 859 51 HELIX 15 859 27 COLOUR_TEXT_REGION 15 859 27 859 50 HELIX 49 859 58 COLOUR_TEXT_REGION 49 859 58 859 50 HELIX 76 859 77 COLOUR_TEXT_REGION 76 859 77 859 50 HELIX 95 859 116 COLOUR_TEXT_REGION 95 859 116 859 50 HELIX 131 859 139 COLOUR_TEXT_REGION 131 859 139 859 50 HELIX 154 859 167 COLOUR_TEXT_REGION 154 859 167 859 50 HELIX 204 859 207 COLOUR_TEXT_REGION 204 859 207 859 50 HELIX 213 859 232 COLOUR_TEXT_REGION 213 859 232 859 50 HELIX 235 859 251 COLOUR_TEXT_REGION 235 859 251 859 50 HELIX 299 859 323 COLOUR_TEXT_REGION 299 859 323 859 50 STRAND 5 864 11 COLOUR_TEXT_REGION 5 864 11 864 51 STRAND 34 864 41 COLOUR_TEXT_REGION 34 864 41 864 51 STRAND 68 864 70 COLOUR_TEXT_REGION 68 864 70 864 51 STRAND 83 864 87 COLOUR_TEXT_REGION 83 864 87 864 51 STRAND 121 864 126 COLOUR_TEXT_REGION 121 864 126 864 51 STRAND 147 864 153 COLOUR_TEXT_REGION 147 864 153 864 51 STRAND 175 864 181 COLOUR_TEXT_REGION 175 864 181 864 51 STRAND 187 864 192 COLOUR_TEXT_REGION 187 864 192 864 51 STRAND 257 864 265 COLOUR_TEXT_REGION 257 864 265 864 51 STRAND 276 864 284 COLOUR_TEXT_REGION 276 864 284 864 51 STRAND 289 864 293 COLOUR_TEXT_REGION 289 864 293 864 51 HELIX 16 864 26 COLOUR_TEXT_REGION 16 864 26 864 50 HELIX 50 864 57 COLOUR_TEXT_REGION 50 864 57 864 50 HELIX 75 864 76 COLOUR_TEXT_REGION 75 864 76 864 50 HELIX 98 864 115 COLOUR_TEXT_REGION 98 864 115 864 50 HELIX 131 864 139 COLOUR_TEXT_REGION 131 864 139 864 50 HELIX 154 864 167 COLOUR_TEXT_REGION 154 864 167 864 50 HELIX 203 864 205 COLOUR_TEXT_REGION 203 864 205 864 50 HELIX 212 864 231 COLOUR_TEXT_REGION 212 864 231 864 50 HELIX 235 864 251 COLOUR_TEXT_REGION 235 864 251 864 50 HELIX 299 864 323 COLOUR_TEXT_REGION 299 864 323 864 50 STRAND 5 865 11 COLOUR_TEXT_REGION 5 865 11 865 51 STRAND 35 865 40 COLOUR_TEXT_REGION 35 865 40 865 51 STRAND 82 865 87 COLOUR_TEXT_REGION 82 865 87 865 51 STRAND 122 865 125 COLOUR_TEXT_REGION 122 865 125 865 51 STRAND 148 865 153 COLOUR_TEXT_REGION 148 865 153 865 51 STRAND 175 865 181 COLOUR_TEXT_REGION 175 865 181 865 51 STRAND 188 865 194 COLOUR_TEXT_REGION 188 865 194 865 51 STRAND 259 865 265 COLOUR_TEXT_REGION 259 865 265 865 51 STRAND 277 865 284 COLOUR_TEXT_REGION 277 865 284 865 51 STRAND 288 865 293 COLOUR_TEXT_REGION 288 865 293 865 51 HELIX 14 865 27 COLOUR_TEXT_REGION 14 865 27 865 50 HELIX 47 865 58 COLOUR_TEXT_REGION 47 865 58 865 50 HELIX 76 865 77 COLOUR_TEXT_REGION 76 865 77 865 50 HELIX 93 865 116 COLOUR_TEXT_REGION 93 865 116 865 50 HELIX 131 865 139 COLOUR_TEXT_REGION 131 865 139 865 50 HELIX 154 865 166 COLOUR_TEXT_REGION 154 865 166 865 50 HELIX 204 865 209 COLOUR_TEXT_REGION 204 865 209 865 50 HELIX 217 865 232 COLOUR_TEXT_REGION 217 865 232 865 50 HELIX 234 865 251 COLOUR_TEXT_REGION 234 865 251 865 50 HELIX 299 865 323 COLOUR_TEXT_REGION 299 865 323 865 50
src/extraction-node_edge_types.ads
TNO/Dependency_Graph_Extractor-Ada
0
18821
with Extraction.Utilities; private package Extraction.Node_Edge_Types is -- Node names. function Get_Node_Name (File : VFS.Virtual_File; Directory_Prefix : VFS.Virtual_File) return String; function Get_Node_Name (Project : GPR.Project_Type; Directory_Prefix : VFS.Virtual_File) return String; function Get_Node_Name (Analysis_Unit : LAL.Analysis_Unit; Directory_Prefix : VFS.Virtual_File) return String; function Get_Node_Name (Defining_Name : LAL.Defining_Name; Basic_Decl : LAL.Basic_Decl'Class; Directory_Prefix : VFS.Virtual_File) return String; -- Node attributes. Node_Attribute_Fully_Qualified_Name : constant SU.Unbounded_String := +"fullyQualifiedName"; Node_Attribute_Is_Formal_Parameter : constant SU.Unbounded_String := +"isFormalParameter"; Node_Attribute_Is_Main_Program : constant SU.Unbounded_String := +"isMainProgram"; Node_Attribute_Relative_Name : constant SU.Unbounded_String := +"relativeName"; Node_Attribute_Source_Location : constant SU.Unbounded_String := +"sourceLocation"; function Node_Attributes return GW.Attribute_Definition_Sets.Map; function Get_Node_Attributes (File : VFS.Virtual_File; Directory_Prefix : VFS.Virtual_File) return GW.Attribute_Value_Sets.Map; function Get_Node_Attributes (Project : GPR.Project_Type) return GW.Attribute_Value_Sets.Map; function Get_Node_Attributes (Defining_Name : LAL.Defining_Name; Basic_Decl : LAL.Basic_Decl; Context : Utilities.Project_Context) return GW.Attribute_Value_Sets.Map; -- Node types. -- File and directory types. Node_Type_File : constant GW.Node_Type := "File"; Node_Type_Directory : constant GW.Node_Type := "Directory"; -- File subtypes. Node_Type_Unknown_File_Type : constant GW.Node_Subtype := ""; Node_Type_Ada_Body_File : constant GW.Node_Subtype := "AdaBodyFile"; Node_Type_Ada_Specification_File : constant GW.Node_Subtype := "AdaSpecificationFile"; Node_Type_C_Header_File : constant GW.Node_Subtype := "CHeaderFile"; -- Contained in projects, but not analyzed. Node_Type_C_Source_File : constant GW.Node_Subtype := "CSourceFile"; -- Contained in projects, but not analyzed. Node_Type_Gnat_Project_File : constant GW.Node_Subtype := "GnatProjectFile"; -- Project types. Node_Type_Gnat_Project : constant GW.Node_Type := "GnatProject"; -- Declarations. Node_Type_Ada_Declaration : constant GW.Node_Type := "AdaDeclaration"; -- Declaration subtypes. Node_Type_Ada_Component_Declaration : constant GW.Node_Subtype := "AdaComponentDeclaration"; Node_Type_Ada_Discriminant_Declaration : constant GW.Node_Subtype := "AdaDiscriminantDeclaration"; Node_Type_Ada_Entry_Declaration : constant GW.Node_Subtype := "AdaEntryDeclaration"; Node_Type_Ada_Enum_Literal_Declaration : constant GW.Node_Subtype := "AdaEnumLiteralDeclaration"; Node_Type_Ada_Exception_Declaration : constant GW.Node_Subtype := "AdaExceptionDeclaration"; Node_Type_Ada_Number_Declaration : constant GW.Node_Subtype := "AdaNumberDeclaration"; Node_Type_Ada_Object_Declaration : constant GW.Node_Subtype := "AdaObjectDeclaration"; Node_Type_Ada_Package_Declaration : constant GW.Node_Subtype := "AdaPackageDeclaration"; Node_Type_Ada_Protected_Declaration : constant GW.Node_Subtype := "AdaProtectedDeclaration"; Node_Type_Ada_Subprogram_Declaration : constant GW.Node_Subtype := "AdaSubprogramDeclaration"; Node_Type_Ada_Task_Declaration : constant GW.Node_Subtype := "AdaTaskDeclaration"; Node_Type_Ada_Type_Declaration : constant GW.Node_Subtype := "AdaTypeDeclaration"; function Get_File_Subtype (File : VFS.Virtual_File) return GW.Node_Subtype; function Get_Decl_Subtype (Decl : LAL.Basic_Decl) return GW.Node_Subtype; -- Edge attributes. Edge_Attribute_Has_Access_Type : constant SU.Unbounded_String := +"hasAccessType"; Edge_Attribute_Has_Array_Type : constant SU.Unbounded_String := +"hasArrayType"; Edge_Attribute_Is_Dispatching : constant SU.Unbounded_String := +"isDispatching"; function Edge_Attributes return GW.Attribute_Definition_Sets.Map; function Get_Edge_Attributes (Expr : LAL.Expr'Class) return GW.Attribute_Value_Sets.Map; function Get_Edge_Attributes (Type_Expr : LAL.Type_Expr'Class; Can_Have_Array_Type : Boolean) return GW.Attribute_Value_Sets.Map; -- Edge types. -- Declaration-related and project-related. Edge_Type_Contains : constant GW.Edge_Type := "Contains"; -- For declaration nesting and file in project/directory containment. Edge_Type_Derives_From : constant GW.Edge_Type := "DerivesFrom"; -- For type derivations and project extensions. Edge_Type_Imports : constant GW.Edge_Type := "Imports"; -- For `with` clauses and project imports. Edge_Type_Source : constant GW.Edge_Type := "Source"; -- Source of a declaration or project. -- Project-related. Edge_Type_Compiles : constant GW.Edge_Type := "Compiles"; -- Declaration-related. Edge_Type_Instantiates : constant GW.Edge_Type := "Instantiates"; Edge_Type_Is_Implemented_By : constant GW.Edge_Type := "IsImplementedBy"; Edge_Type_Is_Overridden_By : constant GW.Edge_Type := "IsOverriddenBy"; Edge_Type_Is_Parent_Of : constant GW.Edge_Type := "IsParentOf"; -- For child packages and their parents. Edge_Type_Is_Primitive_Subprogram_Of : constant GW.Edge_Type := "IsPrimitiveSubprogramOf"; Edge_Type_References : constant GW.Edge_Type := "References"; Edge_Type_Renames : constant GW.Edge_Type := "Renames"; -- Call-related. Edge_Type_Calls : constant GW.Edge_Type := "Calls"; -- Type-related. Edge_Type_Has_Parameter_Of_Type : constant GW.Edge_Type := "HasParameterOfType"; Edge_Type_Has_Return_Of_Type : constant GW.Edge_Type := "HasReturnOfType"; Edge_Type_Has_Type : constant GW.Edge_Type := "HasType"; end Extraction.Node_Edge_Types;
alloy4fun_models/trashltl/models/11/DA6GXA6JLCRyjbuAh.als
Kaixi26/org.alloytools.alloy
0
3482
<reponame>Kaixi26/org.alloytools.alloy<gh_stars>0 open main pred idDA6GXA6JLCRyjbuAh_prop12 { eventually all t : Trash | after t not in Trash } pred __repair { idDA6GXA6JLCRyjbuAh_prop12 } check __repair { idDA6GXA6JLCRyjbuAh_prop12 <=> prop12o }
programs/oeis/037/A037627.asm
karttu/loda
1
247156
<gh_stars>1-10 ; A037627: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 2,3,0. ; 2,15,90,542,3255,19530,117182,703095,4218570,25311422,151868535,911211210,5467267262,32803603575,196821621450,1180929728702,7085578372215,42513470233290,255080821399742,1530484928398455 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,60 div $0,24 mov $1,$0
src/JVM/Model.agda
ajrouvoet/jvm.agda
6
14350
<filename>src/JVM/Model.agda<gh_stars>1-10 {-# OPTIONS --safe #-} module JVM.Model {ℓ} (T : Set ℓ) where open import Level hiding (Lift) open import Data.Product open import Data.Unit open import Data.List open import Relation.Binary.PropositionalEquality using (_≡_; refl) open import Relation.Ternary.Core open import Relation.Ternary.Structures open import Relation.Ternary.Construct.Empty T public open import Relation.Ternary.Construct.Duplicate T public open import Data.List.Relation.Binary.Permutation.Propositional using () renaming (_↭_ to _≈_) open import Data.List.Relation.Binary.Permutation.Propositional.Properties using (++-isMonoid) instance ++-monoid-instance = ++-isMonoid module Disjoint where open import Relation.Ternary.Construct.Bag empty-rel tt public open IsPartialSemigroup bags-isSemigroup public open IsPartialMonoid bags-isMonoid public open IsCommutative bags-isCommutative public module Overlap where open import Relation.Ternary.Construct.Bag duplicate tt public open IsPartialSemigroup bags-isSemigroup public open IsPartialMonoid bags-isMonoid public open IsCommutative bags-isCommutative public open IsTotal bags-isTotal public open Disjoint using (bag-emptiness) renaming ( empty-unique to empty-bag-unique ; singleton-unique to singleton-bag-unique) public open Rel₃ Disjoint.bags using () renaming (_∙_≣_ to _⊕_≣_; _✴_ to _⊕_; _─✴_ to _─⊕_; _∙⟨_⟩_ to _⊕⟨_⟩_) public open Rel₃ Overlap.bags using () renaming (_∙_≣_ to _⊗_≣_; _✴_ to _⊗_; _─✴_ to _─⊗_; _∙⟨_⟩_ to _⊗⟨_⟩_) public open import Relation.Ternary.Construct.Bag.Properties open import Data.List.Relation.Binary.Permutation.Propositional open CrossSplittable {{div₁ = duplicate}} {{empty-rel}} (λ _ ()) abstract private m₁ : IsPartialMonoid _↭_ Disjoint.bags [] m₁ = Disjoint.bags-isMonoid m₂ : IsPartialMonoid _↭_ Overlap.bags [] m₂ = Overlap.bags-isMonoid p₁ : IsPositiveWithZero 0ℓ _↭_ Disjoint.bags [] p₁ = Disjoint.bags-isPositive-w/0 p₂ : IsPositiveWithZero 0ℓ _↭_ Overlap.bags [] p₂ = Overlap.bags-isPositive-w/0 c₁ : IsCommutative Disjoint.bags c₁ = Disjoint.bags-isCommutative c₂ : IsCommutative Overlap.bags c₂ = Overlap.bags-isCommutative x : CrossSplit Overlap.bags Disjoint.bags x = xsplit ux : Uncross Disjoint.bags Overlap.bags ux = uncrossover (unxcross λ ()) open import Relation.Ternary.Construct.Exchange {A = List T} {{m₁}} {{m₂}} {{p₁}} {{p₂}} {{empty-bag-unique}} {{c₁}} {{c₂}} {{Disjoint.bags-isTotal}} {{Overlap.bags-isTotal}} {{++-isMonoid}} x ux public renaming (Account to Intf ; _≈_ to _≈intf≈_ ; exchange-rel to intf-rel ; exchange-emptiness to intf-emptiness ; exchange-isSemigroup to intf-isSemigroup ; exchange-isCommutative to intf-isCommutative ; exchange-isMonoid to intf-isMonoid ; exchange-isTotal to intf-isTotal) open DownIntuitive {{Overlap.bags-isContractive}} public module Syntax where open Rel₃ intf-rel public open Emptiness intf-emptiness public open IsPartialSemigroup intf-isSemigroup public open IsPartialMonoid intf-isMonoid public open IsCommutative intf-isCommutative public open CommutativeSemigroupOps {{intf-isSemigroup}} {{intf-isCommutative}} public -- module _ {P} where -- open IsIntuitionistic (intf-isIntuitive {P}) w public open Syntax
libsrc/target/x1/x1/x1_load_pcg.asm
Frodevan/z88dk
640
28557
SECTION code_clib PUBLIC x1_load_pcg PUBLIC _x1_load_pcg EXTERN asm_load_pcg ;void x1_load_pcg(int char, char data[8]) __z88dk_callee x1_load_pcg: _x1_load_pcg: pop de ;ret pop hl ;data pop bc ;character push de jp asm_load_pcg
Transynther/x86/_processed/NONE/_un_/i9-9900K_12_0xa0.log_1_843.asm
ljhsiun2/medusa
9
80182
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %r8 push %rcx push %rdi push %rsi lea addresses_A_ht+0x16f78, %rsi lea addresses_WC_ht+0x13d9a, %rdi nop nop nop sub $45198, %r13 mov $7, %rcx rep movsl and $51589, %r10 lea addresses_A_ht+0x5be, %rcx nop nop nop and %r11, %r11 mov (%rcx), %edi nop nop nop nop sub %rcx, %rcx lea addresses_normal_ht+0x3480, %rsi lea addresses_WC_ht+0xf19a, %rdi add %r14, %r14 mov $61, %rcx rep movsq nop nop add $51386, %r11 lea addresses_normal_ht+0x669a, %rcx nop nop add $34141, %rdi mov (%rcx), %r14d nop nop nop cmp %r11, %r11 lea addresses_WC_ht+0x102aa, %rdi nop nop nop nop xor %r14, %r14 movl $0x61626364, (%rdi) nop nop nop nop xor $4538, %r14 lea addresses_WC_ht+0x1bd9a, %rsi lea addresses_D_ht+0x5ec2, %rdi nop nop nop add %r8, %r8 mov $45, %rcx rep movsl nop nop nop nop nop add %r13, %r13 pop %rsi pop %rdi pop %rcx pop %r8 pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rcx push %rdi // Faulty Load lea addresses_WT+0x1519a, %r8 nop nop nop nop sub %rcx, %rcx movups (%r8), %xmm6 vpextrq $1, %xmm6, %r13 lea oracles, %r13 and $0xff, %r13 shlq $12, %r13 mov (%r13,%r13,1), %r13 pop %rdi pop %rcx pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}} {'e1': 1} e1 */
programs/oeis/184/A184327.asm
jmorken/loda
1
100223
; A184327: a(1)=1, a(2)=17; thereafter a(n) = 6*a(n-1)-a(n-2)+c, where c=-4 if n is odd, c=12 if n is even. ; 1,17,97,577,3361,19601,114241,665857,3880897,22619537,131836321,768398401,4478554081,26102926097,152139002497,886731088897,5168247530881,30122754096401,175568277047521,1023286908188737,5964153172084897,34761632124320657 mov $1,1 mov $2,1 lpb $0 sub $0,1 mov $3,$2 add $2,$1 mov $1,$3 add $1,$2 lpe mul $1,4 pow $1,2 div $1,128 mul $1,16 add $1,1
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i3-7100_9_0xca_notsx.log_21829_91.asm
ljhsiun2/medusa
9
168361
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x19ce6, %rsi lea addresses_WC_ht+0x9dcb, %rdi nop nop nop nop nop add $18523, %r10 mov $50, %rcx rep movsb add %rax, %rax lea addresses_WC_ht+0x11905, %rsi lea addresses_normal_ht+0xd8c3, %rdi clflush (%rdi) nop nop nop nop nop and $39605, %rax mov $106, %rcx rep movsb nop nop xor %rsi, %rsi lea addresses_UC_ht+0xa163, %rsi lea addresses_UC_ht+0x9ec3, %rdi nop sub $59293, %r13 mov $127, %rcx rep movsw nop nop nop nop nop xor %rdi, %rdi lea addresses_WC_ht+0x1a49f, %rsi nop nop nop nop nop xor %r14, %r14 mov $0x6162636465666768, %r10 movq %r10, (%rsi) nop nop nop and $30700, %r13 lea addresses_WC_ht+0x17a06, %r13 nop add $41344, %rax mov $0x6162636465666768, %rdi movq %rdi, (%r13) nop cmp $51657, %rax lea addresses_normal_ht+0xf023, %rsi lea addresses_WT_ht+0x130ad, %rdi clflush (%rsi) nop nop nop nop inc %r10 mov $40, %rcx rep movsl nop nop nop sub %rax, %rax lea addresses_WT_ht+0x142c3, %rsi nop nop nop nop nop xor %rdi, %rdi vmovups (%rsi), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rcx nop nop nop nop cmp %r10, %r10 lea addresses_UC_ht+0x5ac3, %r13 nop nop nop nop add $21784, %rdi movb $0x61, (%r13) nop nop add $14184, %r10 lea addresses_WT_ht+0x2323, %rcx nop nop nop nop nop xor $32222, %r13 mov (%rcx), %si nop nop add %r13, %r13 lea addresses_WT_ht+0x6ec3, %rsi lea addresses_D_ht+0xa2c3, %rdi nop nop nop nop dec %r15 mov $100, %rcx rep movsl nop nop nop nop and $62167, %r13 lea addresses_normal_ht+0x32c3, %rsi lea addresses_normal_ht+0x1da5b, %rdi nop add $28203, %r13 mov $25, %rcx rep movsb nop nop nop nop nop inc %r14 lea addresses_UC_ht+0x434b, %rsi lea addresses_A_ht+0x5e23, %rdi nop cmp $28726, %r13 mov $91, %rcx rep movsb sub %r15, %r15 lea addresses_WC_ht+0x11223, %r14 nop nop dec %r15 mov $0x6162636465666768, %r10 movq %r10, %xmm4 and $0xffffffffffffffc0, %r14 movntdq %xmm4, (%r14) nop nop nop xor $33424, %r14 lea addresses_WC_ht+0x18293, %rdi nop nop nop nop nop xor %rax, %rax movl $0x61626364, (%rdi) nop nop nop nop xor $9930, %r13 lea addresses_A_ht+0x30c3, %r15 sub $43712, %rax mov (%r15), %rsi nop nop sub %rax, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r14 push %r9 push %rcx push %rdi // Load mov $0xa43, %rdi nop nop nop nop cmp $24925, %r9 mov (%rdi), %r14 nop nop nop nop cmp %r9, %r9 // Faulty Load lea addresses_A+0x62c3, %rdi nop nop nop nop nop inc %rcx movaps (%rdi), %xmm6 vpextrq $1, %xmm6, %r12 lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rdi pop %rcx pop %r9 pop %r14 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}} {'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': True}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': True, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}} {'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'44': 1828, '00': 12410, '49': 39, '48': 7552} 00 48 00 00 00 48 00 48 00 00 00 00 48 48 00 00 00 44 48 00 48 00 00 00 00 48 00 00 00 44 48 00 48 00 00 00 44 48 48 48 00 00 00 00 00 00 00 00 48 48 48 48 00 00 00 44 48 48 00 00 00 00 00 00 48 00 00 00 44 48 48 00 00 00 00 44 48 48 00 00 00 00 44 48 48 00 00 00 00 44 48 48 00 00 00 00 44 48 48 48 00 00 00 44 48 48 00 00 00 00 44 48 00 48 00 00 00 44 48 48 48 00 00 00 44 00 48 00 00 00 44 48 48 48 00 00 00 44 00 48 48 00 00 00 49 00 48 48 00 00 44 00 48 48 00 00 00 44 48 48 48 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 00 48 48 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 44 48 48 00 00 00 44 48 00 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 00 00 00 00 00 48 48 00 00 00 48 48 48 00 00 00 44 48 48 48 00 00 00 00 00 48 48 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 48 48 00 48 00 00 00 00 48 48 00 00 44 48 48 48 00 00 44 48 48 48 00 00 00 48 48 48 00 00 00 00 00 48 00 00 00 44 48 48 00 00 00 00 48 48 00 00 00 48 48 48 48 00 00 00 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 48 00 00 00 48 48 00 00 00 44 48 48 48 00 00 44 48 48 48 00 00 00 00 48 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 44 48 48 00 00 00 44 48 48 00 00 00 00 44 00 48 48 00 00 00 00 00 48 00 00 00 00 48 00 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 48 48 48 48 00 00 00 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 44 00 48 48 00 00 44 48 48 00 00 00 00 00 48 48 00 00 48 00 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 48 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 00 48 48 00 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 48 48 00 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 44 48 00 48 00 00 00 49 00 00 48 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 44 48 48 48 00 00 44 48 00 00 00 00 48 48 00 00 00 48 48 48 00 00 00 00 00 48 00 00 00 00 48 00 00 00 00 00 48 48 00 00 00 44 48 00 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 00 00 48 00 00 00 44 00 48 48 00 00 00 00 00 48 00 00 00 44 00 48 48 00 00 44 48 48 00 00 00 44 48 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 00 44 48 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 44 48 48 48 00 00 00 00 48 00 00 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 00 48 00 00 00 48 48 00 48 00 00 00 48 48 00 00 00 44 48 48 48 00 00 00 49 00 48 48 00 00 00 48 48 00 00 00 44 48 48 */
programs/oeis/205/A205085.asm
neoneye/loda
22
21438
; A205085: a(n) = n 5's sandwiched between two 1's. ; 11,151,1551,15551,155551,1555551,15555551,155555551,1555555551,15555555551,155555555551,1555555555551,15555555555551,155555555555551,1555555555555551,15555555555555551,155555555555555551,1555555555555555551,15555555555555555551,155555555555555555551,1555555555555555555551,15555555555555555555551,155555555555555555555551,1555555555555555555555551,15555555555555555555555551,155555555555555555555555551,1555555555555555555555555551,15555555555555555555555555551,155555555555555555555555555551,1555555555555555555555555555551,15555555555555555555555555555551,155555555555555555555555555555551,1555555555555555555555555555555551,15555555555555555555555555555555551,155555555555555555555555555555555551 mov $1,10 pow $1,$0 mul $1,10 div $1,9 mul $1,7 add $1,4 mul $1,2 sub $1,11 mov $0,$1
string_ops.ads
davidkristola/vole
4
30367
-- public domain with Ada.Calendar; with Ada.Strings.Maps; with Interfaces; package String_Ops is pragma Elaborate_Body; type String_Pointer_Type is access String; -- All the control characters plus space and non-breaking-space. -- function Is_White_Space (Char : in Character) return Boolean; -- The Stuff routines place the source into the target, -- padding with space or zeros. -- procedure Stuff (This : in String; Into : out String); procedure Stuff_Right (This : in String; Into : out String); procedure Stuff_Number (Number : in Integer; Into : out String); procedure Stuff_Hex (Number : in Interfaces.Unsigned_32; Into : out String); -- Kills Ada comments from The_String -- function Drop_Ada_Comments (The_String : String) return String; function Drop_Vole_Comments (The_String : String) return String; function Up_Case (The_String : String) return String; function Down_Case (The_String : String) return String; -- Discards blanks from the front and back end -- of The_String. -- function Trim_Blanks (The_String : String) return String; -- Many times the important string will be enclosed in -- quotation marks or brackets. This trims one character -- off of each end. -- function Trim_One_From_Both_Ends(The_String : String) return String; -- Discards non-printable characters from -- The_String. -- function Filter (The_String : String) return String; -- Return the first substring of Str (deliniated by white space). -- Note: Str is assumed to not start with white space. -- function First (Str : in String) return String; -- Return the second part of Str. -- function Rest (Str : in String) return String; -- Return the second substring of Str (deliniated by white space). -- function Second (Str : in String) return String; -- This returns the Rest of the Rest. -- function Second_Rest (Str : in String) return String; -- Return the third substring of Str (deliniated by white space). -- function Third (Str : in String) return String; -- Return the Nth substring of Str (deliniated by white space). -- function Nth (Str : in String; N : in Positive) return String; -- Return the Nth substring of Str (deliniated by Set). -- function Nth (Str : in String; N : in Positive; Set : in Ada.Strings.Maps.Character_Set) return String; -- This is a caseless compare. -- function Same(L, R : in String) return Boolean; -- This is a specialized "=" for strings. For -- the length of the smaller of Check and Master, -- both strings must be the same. -- function Conformance (Master : in String; Check : in String) return Boolean; -- Returns a string in the form "16#0000_0000#" -- function Integer_To_Hex_String (Value : in Interfaces.Unsigned_32) return String; -- These return images without leading blanks. -- function Str (Int : Integer) return String; function Str (Int : Interfaces.Unsigned_32) return String; -- This "image" routine will only resort to scientific notation -- if the number is too large or too small. -- function Img (Flt : Float) return String; -- This will take a number (floating point or integer) from the -- string and return a Float. -- function Value (Str : String) return Float; function Img (Int : Integer) return String renames Str; function Value (Str : String) return Integer; function Long_Date (Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String; function Short_Date (Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String; function Date_As_Filename (Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String; function IP_Address (Addr : Interfaces.Unsigned_32) return String; ----------------------------------------------------------------------------- generic type Selection_Type is (<>); -- enumeration package Selection_Ops is -- Return true if and only if Str passes "Conformance" -- to the image of a member of Selection_Type. -- Str is up cased before conformance checking. -- function String_Matches (Str : in String) return Boolean; -- Return the number of "Conformance" matches. -- function String_Matches (Str : in String) return Natural; -- Returns the first member of Selection_Type to -- conform to Str, or the first member of -- Selection_Type. -- function To_Selection (Str : in String) return Selection_Type; end Selection_Ops; end String_Ops;
projects/batfish/src/org/batfish/grammar/flatvyos/FlatVyosParser.g4
gaberger/batfish
1
6131
parser grammar FlatVyosParser; import FlatVyos_bgp, FlatVyos_common, FlatVyos_interfaces, FlatVyos_policy, FlatVyos_protocols, FlatVyos_vpn; options { superClass = 'org.batfish.grammar.BatfishParser'; tokenVocab = FlatVyosLexer; } @header { package org.batfish.grammar.flatvyos; } flat_vyos_configuration : NEWLINE* set_line+ NEWLINE* EOF ; s_null : ( SERVICE ) null_filler ; s_system : SYSTEM s_system_tail ; s_system_tail : st_host_name | st_null ; set_line : SET set_line_tail NEWLINE ; set_line_tail : statement ; st_default_address_selection : DEFAULT_ADDRESS_SELECTION ; st_host_name : HOST_NAME name = variable ; st_null : ( CONFIG_MANAGEMENT | CONSOLE | FLOW_ACCOUNTING | LOGIN | NTP | PACKAGE | SYSLOG | TASK_SCHEDULER | TIME_ZONE ) null_filler ; statement : s_interfaces | s_null | s_policy | s_protocols | s_system | s_vpn ;
test/succeed/PruningNonMillerPattern.agda
asr/agda-kanso
0
2110
<filename>test/succeed/PruningNonMillerPattern.agda -- {-# OPTIONS -v tc.meta:100 #-} -- Andreas, 2011-04-20 -- see <NAME> TLCA 2011 module PruningNonMillerPattern where data _≡_ {A : Set}(a : A) : A -> Set where refl : a ≡ a data Nat : Set where zero : Nat suc : Nat -> Nat test : let X : Nat -> Nat -> Nat X = _ Y : Nat -> Nat -> Nat Y = _ in (C : Set) -> (({x y : Nat} -> X x x ≡ suc (Y x y)) -> ({x y : Nat} -> Y x x ≡ x) -> ({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C test C k = k refl refl refl {- none of these equations is immediately solvable. However, from 1. we deduce that Y does not depend on its second argument, thus from 2. we solve Y x y = x, and then eqn. 3. simplifies to X x y = X x x, thus, X does not depend on its second arg, we can then solve using 1. X x y = suc x -} -- a variant, where pruning is even triggered from a non-pattern test' : let X : Nat -> Nat -> Nat X = _ Y : Nat -> Nat -> Nat Y = _ in (C : Set) -> (({x y : Nat} -> X x (suc x) ≡ suc (Y x y)) -> -- non-pattern lhs ({x y : Nat} -> Y x x ≡ x) -> ({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C test' C k = k refl refl refl
libsrc/_DEVELOPMENT/font/fzx/c/sdcc_iy/fzx_puts_justified_callee.asm
jpoikela/z88dk
640
243081
; int fzx_puts_justified_callee(struct fzx_state *fs, char *s, uint16_t allowed_width) SECTION code_font SECTION code_font_fzx PUBLIC _fzx_puts_justified_callee EXTERN asm_fzx_puts_justified _fzx_puts_justified_callee: pop af pop ix pop hl pop bc push af jp asm_fzx_puts_justified
test/Fail/Issue3813.agda
cruhland/agda
1,989
12876
open import Agda.Builtin.Nat open import Agda.Builtin.Equality cong : {A B : Set} (f : A → B) → {x y : A} → x ≡ y → f x ≡ f y cong f refl = refl +-identityʳ : (x : Nat) → x + 0 ≡ x +-identityʳ zero = refl +-identityʳ (suc n) = cong suc (+-identityʳ n) +-assoc : (x y z : Nat) → (x + y) + z ≡ x + (y + z) +-assoc zero _ _ = refl +-assoc (suc m) n o = cong suc (+-assoc m n o) data Bin : Set where nil : Bin x0_ : Bin → Bin x1_ : Bin → Bin inc : Bin → Bin inc nil = x1 nil inc (x0 x) = x1 x inc (x1 x) = x0 (inc x) to : Nat → Bin to zero = (x0 nil) to (suc x) = inc (to x) postulate from : Bin → Nat data Can : Bin → Set where Can- : ∀ {n} → from (to n) ≡ n → Can (to n) data Σ (A : Set) (B : A → Set) : Set where ⟨_,_⟩ : (x : A) → B x → Σ A B postulate to'' : (x : Nat) → Σ Bin Can to∘from' : (a : Bin) → (b : Can a) → to'' (from a) ≡ ⟨ a , b ⟩ to∘from' .(to _) (Can- x) = {!!}
fox32rom/draw_text.asm
ry755/fox32
6
86237
<filename>fox32rom/draw_text.asm ; generic text drawing routines ; draw a single font tile to a framebuffer ; inputs: ; r0: tile number ; r1: X coordinate ; r2: Y coordinate ; r3: foreground color ; r4: background color ; r5: pointer to font graphics ; r6: font width ; r7: font height ; r8: pointer to framebuffer ; r9: framebuffer width (pixels) ; outputs: ; none draw_font_tile_generic: push r0 push r1 push r2 push r5 push r6 push r7 push r8 push r9 ;movz.8 r0, r0 ; ensure the tile number is a single byte ; calculate pointer to the tile data push r6 mul r6, r7 mul r0, r6 mul r0, 4 ; 4 bytes per pixel add r0, r5 ; r0: pointer to tile data pop r6 ; calculate pointer to the framebuffer mul r9, 4 ; 4 bytes per pixel mul r2, r9 ; y * width * 4 mul r1, 4 ; x * 4 add r1, r2 ; y * width * 4 + (x * 4) add r1, r8 ; r1: pointer to framebuffer ; r8: font width in bytes mov r8, r6 mul r8, 4 draw_font_tile_generic_y_loop: mov r5, r6 ; x counter draw_font_tile_generic_x_loop: mov r2, [r0] cmp r2, 0xFF000000 ifz jmp draw_font_tile_generic_x_loop_background ; drawing foreground pixel cmp r3, 0x00000000 ; is the foreground color supposed to be transparent? ifz jmp draw_font_tile_generic_x_loop_end mov [r1], r3 ; draw foreground color jmp draw_font_tile_generic_x_loop_end draw_font_tile_generic_x_loop_background: ; drawing background pixel cmp r4, 0x00000000 ; is the background color supposed to be transparent? ifz jmp draw_font_tile_generic_x_loop_end mov [r1], r4 ; draw background color draw_font_tile_generic_x_loop_end: add r0, 4 ; increment tile pointer add r1, 4 ; increment framebuffer pointer dec r5 ifnz jmp draw_font_tile_generic_x_loop ; loop if there are still more X pixels to draw sub r1, r8 ; return to the beginning of this line add r1, r9 ; increment to the next line by adding the framebuffer width in bytes dec r7 ; decrement height counter ifnz jmp draw_font_tile_generic_y_loop ; loop if there are still more Y pixels to draw pop r9 pop r8 pop r7 pop r6 pop r5 pop r2 pop r1 pop r0 ret ; draw text to a framebuffer, using printf-style formatting ; inputs: ; r0: pointer to null-terminated string ; r1: X coordinate ; r2: Y coordinate ; r3: foreground color ; r4: background color ; r5: pointer to font graphics ; r6: font width ; r7: font height ; r8: pointer to framebuffer ; r9: framebuffer width ; r10-r15: optional format values ; outputs: ; r1: X coordinate of end of text draw_format_str_generic: push r0 push r1 push r2 push r5 push r6 push r7 push r8 push r9 push r16 push r17 mov r16, 0 ; current format specifier counter draw_format_str_generic_loop: cmp.8 [r0], 0 ifz jmp draw_format_str_generic_end cmp.8 [r0], '%' ifz jmp draw_format_str_generic_found_format_specifier ; if this is not a format specifier or the end of the string, print the character push r0 movz.8 r0, [r0] call draw_font_tile_generic pop r0 add r1, r6 ; add the font width to the X coordinate inc r0 jmp draw_format_str_generic_loop draw_format_str_generic_found_format_specifier: inc r0 ; percent sign cmp.8 [r0], '%' ifz call draw_format_str_generic_percent_sign ; character cmp.8 [r0], 'c' ifz call draw_format_str_generic_character ; unsigned decimal cmp.8 [r0], 'u' ifz call draw_format_str_generic_unsigned_decimal ; hex cmp.8 [r0], 'x' ifz call draw_format_str_generic_hex inc r0 jmp draw_format_str_generic_loop draw_format_str_generic_percent_sign: push r0 mov r0, '%' call draw_font_tile_generic add r1, r6 pop r0 inc r16 ret draw_format_str_generic_character: call draw_format_str_generic_get_parameter push r0 mov r0, r17 call draw_font_tile_generic add r1, r6 pop r0 inc r16 ret draw_format_str_generic_unsigned_decimal: call draw_format_str_generic_get_parameter push r0 mov r0, r17 call draw_decimal_generic pop r0 inc r16 ret draw_format_str_generic_hex: call draw_format_str_generic_get_parameter push r0 mov r0, r17 call draw_hex_generic pop r0 inc r16 ret draw_format_str_generic_get_parameter: ; load the correct format parameter into r17 ; this is messy, but i don't know of any other way to do this at the moment cmp r16, 0 ifz jmp draw_format_str_generic_get_parameter_0 cmp r16, 1 ifz jmp draw_format_str_generic_get_parameter_1 cmp r16, 2 ifz jmp draw_format_str_generic_get_parameter_2 cmp r16, 3 ifz jmp draw_format_str_generic_get_parameter_3 cmp r16, 4 ifz jmp draw_format_str_generic_get_parameter_4 cmp r16, 5 ifz jmp draw_format_str_generic_get_parameter_5 mov r17, 0 ret draw_format_str_generic_get_parameter_0: mov r17, r10 ret draw_format_str_generic_get_parameter_1: mov r17, r11 ret draw_format_str_generic_get_parameter_2: mov r17, r12 ret draw_format_str_generic_get_parameter_3: mov r17, r13 ret draw_format_str_generic_get_parameter_4: mov r17, r14 ret draw_format_str_generic_get_parameter_5: mov r17, r15 ret draw_format_str_generic_end: pop r17 pop r16 pop r9 pop r8 pop r7 pop r6 pop r5 pop r2 pop r1 pop r0 ret ; draw text to a framebuffer ; inputs: ; r0: pointer to null-terminated string ; r1: X coordinate ; r2: Y coordinate ; r3: foreground color ; r4: background color ; r5: pointer to font graphics ; r6: font width ; r7: font height ; r8: pointer to framebuffer ; r9: framebuffer width ; outputs: ; r1: X coordinate of end of text draw_str_generic: push r0 push r10 mov r10, r0 draw_str_generic_loop: movz.8 r0, [r10] call draw_font_tile_generic inc r10 add r1, r6 cmp.8 [r10], 0x00 ifnz jmp draw_str_generic_loop pop r10 pop r0 ret ; draw a decimal value to a framebuffer ; inputs: ; r0: value ; r1: X coordinate ; r2: Y coordinate ; r3: foreground color ; r4: background color ; r5: pointer to font graphics ; r6: font width ; r7: font height ; r8: pointer to framebuffer ; r9: framebuffer width ; outputs: ; r1: X coordinate of end of text draw_decimal_generic: push r0 push r10 ; r10: original stack pointer push r11 ; temp 1 push r12 ; temp 2 push r13 ; temp 3 mov r10, rsp mov r12, r0 push.8 0x00 ; end the string with a terminator draw_decimal_generic_find_loop: push r12 div r12, 10 ; quotient goes into r12 pop r13 rem r13, 10 ; remainder goes into r13 mov r11, r13 add r11, '0' push.8 r11 cmp r12, 0 ifnz jmp draw_decimal_generic_find_loop draw_decimal_generic_print: mov r0, rsp ; point to start of string in the stack call draw_str_generic mov rsp, r10 pop r13 pop r12 pop r11 pop r10 pop r0 ret ; draw a hex value to a framebuffer ; inputs: ; r0: value ; r1: X coordinate ; r2: Y coordinate ; r3: foreground color ; r4: background color ; r5: pointer to font graphics ; r6: font width ; r7: font height ; r8: pointer to framebuffer ; r9: framebuffer width ; outputs: ; r1: X coordinate of end of text draw_hex_generic: push r10 push r11 push r12 push r31 mov r10, r0 mov r31, 8 draw_hex_generic_loop: rol r10, 4 movz.16 r11, r10 and r11, 0x0F mov r12, draw_hex_generic_characters add r12, r11 movz.8 r0, [r12] call draw_font_tile_generic add r1, r6 loop draw_hex_generic_loop pop r31 pop r12 pop r11 pop r10 ret draw_hex_generic_characters: data.str "0123456789ABCDEF"
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_14659_1192.asm
ljhsiun2/medusa
9
10422
<filename>Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_14659_1192.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r15 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x129b0, %rsi lea addresses_normal_ht+0x159e0, %rdi nop and $8577, %rbx mov $83, %rcx rep movsq nop nop nop and %r15, %r15 lea addresses_D_ht+0x1b7d0, %rsi lea addresses_normal_ht+0x102a0, %rdi nop nop add $54320, %rax mov $15, %rcx rep movsl nop nop nop sub $14759, %rcx lea addresses_UC_ht+0x61e0, %rsi lea addresses_D_ht+0xce30, %rdi clflush (%rsi) nop nop nop dec %rbx mov $22, %rcx rep movsw nop nop inc %rbx lea addresses_A_ht+0x1dad4, %rsi nop nop nop add $13569, %r12 movb $0x61, (%rsi) nop dec %r15 lea addresses_A_ht+0x16bb0, %rcx nop nop nop nop and %rdi, %rdi mov $0x6162636465666768, %r12 movq %r12, (%rcx) nop sub $54205, %rdi lea addresses_A_ht+0x1dbe0, %rdi nop nop nop xor $11760, %rax movups (%rdi), %xmm6 vpextrq $1, %xmm6, %r12 nop sub $58178, %rsi lea addresses_A_ht+0x118b0, %r15 nop nop add %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm6 and $0xffffffffffffffc0, %r15 vmovaps %ymm6, (%r15) nop nop nop and $47826, %rcx lea addresses_normal_ht+0x17db0, %r12 nop nop nop nop nop cmp %r15, %r15 movb $0x61, (%r12) nop nop nop nop cmp %rcx, %rcx lea addresses_normal_ht+0x53b0, %rsi lea addresses_WT_ht+0x2530, %rdi nop nop nop nop nop and $16263, %r10 mov $64, %rcx rep movsl nop add $40005, %rax lea addresses_normal_ht+0x1b9b0, %rsi lea addresses_WC_ht+0x1ec70, %rdi nop nop nop nop nop and $17536, %rbx mov $40, %rcx rep movsl nop sub %r10, %r10 lea addresses_UC_ht+0x95b0, %rsi lea addresses_A_ht+0x76d8, %rdi nop nop nop nop nop cmp $64028, %r10 mov $117, %rcx rep movsq add $7658, %r10 lea addresses_WC_ht+0x12110, %rsi nop nop sub %r12, %r12 movb $0x61, (%rsi) nop nop dec %r12 lea addresses_WT_ht+0x14d8, %rcx clflush (%rcx) nop xor $12613, %r12 movw $0x6162, (%rcx) nop xor $3145, %r12 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %rax push %rbp push %rcx push %rdx // Faulty Load lea addresses_D+0x139b0, %r8 nop nop cmp $41884, %rdx vmovups (%r8), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rcx lea oracles, %rax and $0xff, %rcx shlq $12, %rcx mov (%rax,%rcx,1), %rcx pop %rdx pop %rcx pop %rbp pop %rax pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'36': 14659} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
programs/oeis/300/A300451.asm
neoneye/loda
22
21689
; A300451: a(n) = (3*n^2 - 3*n + 8)*2^(n - 3). ; 1,2,7,26,88,272,784,2144,5632,14336,35584,86528,206848,487424,1134592,2613248,5963776,13500416,30343168,67764224,150470656,332398592,730857472,1600126976,3489660928,7583301632,16424894464,35467034624,76369887232,164014063616,351382011904,751082405888,1602022801408,3410204033024,7245609828352,15367392985088,32538672234496,68788196212736,145204254343168,306076549382144,644313813876736,1354598325420032,2844436581056512,5965950092312576,12499248184557568,26159580648046592,54694106412089344,114243656172437504,238409305273925632,497084808871018496,1035546439318503424,2155535371650203648,4483333429047328768,9317947629029556224,19351967598811021312,40163101476890083328,83298578707844694016,172649995314875334656,357621839210236346368,740319721145671614464,1531656218870196207616,3167075373155008643072,6545135381653070282752,13519157563019887640576,27909923783522551595008,57590734998121220145152,118778585090615802855424,244862080834420588150784,504555343904103655800832,1039215774136501299838976,2139527164645128634630144,4403016449465585456119808,9057498914143979519868928,18625013408437880722817024,38284225076624213747433472,78665180871642549969747968,161580491577867780631822336,331774579620489794133426176,681003025761665796976672768,1397367131747059497313501184,2866363118306285773228343296,5877797334966327047421427712,12049363644099008984296456192,24693518791448415522548350976,50591127699233001703104053248,103619449850809095822415757312,212171317045645878677632712704,434323525658030135821639614464,888840948206903037377571192832,1818533917710223623826813485056,3719700333042746381003143512064,7606522571389019099117668794368,15551002773502947013282798501888,31785348448691423938309913575424,64952237981225332263407249784832,132697268691078482426986923819008,271039543961298298907513854099456,553487943324650662428498037047296,1130031281940952247096717363642368,2306648723440291924698438570082304 mov $2,$0 lpb $0 add $2,$0 sub $0,1 mul $1,2 add $1,3 mul $2,2 add $2,1 add $1,$2 lpe div $1,8 add $1,1 mov $0,$1