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_/i9-9900K_12_0xca_notsx.log_21829_1027.asm | ljhsiun2/medusa | 9 | 14007 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x93db, %rsi
lea addresses_WC_ht+0x10d2f, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $110, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $10669, %rdx
lea addresses_A_ht+0x19fc7, %rsi
lea addresses_WT_ht+0x1706f, %rdi
xor %r15, %r15
mov $70, %rcx
rep movsl
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0xecdf, %r8
nop
nop
nop
nop
nop
inc %r12
vmovups (%r8), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rcx
nop
nop
nop
xor %r8, %r8
lea addresses_WC_ht+0xb06f, %r12
sub $2940, %r8
mov $0x6162636465666768, %rdi
movq %rdi, (%r12)
inc %rdi
lea addresses_D_ht+0x1c077, %rsi
lea addresses_UC_ht+0x154f, %rdi
nop
nop
nop
nop
nop
add $19535, %r13
mov $116, %rcx
rep movsb
nop
nop
nop
nop
nop
add $64132, %rsi
lea addresses_WT_ht+0xbacf, %rsi
clflush (%rsi)
nop
nop
nop
sub $60762, %r13
movw $0x6162, (%rsi)
sub %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %r8
push %rbp
push %rdx
// Load
lea addresses_UC+0x3eaf, %r13
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov (%r13), %r14d
nop
nop
nop
nop
add $52706, %r13
// Store
mov $0x9ff, %r8
sub %r11, %r11
mov $0x5152535455565758, %rdx
movq %rdx, %xmm3
vmovntdq %ymm3, (%r8)
nop
nop
nop
nop
nop
add %rbp, %rbp
// Store
lea addresses_A+0x1e083, %r11
clflush (%r11)
nop
nop
nop
nop
and $998, %r15
mov $0x5152535455565758, %rdx
movq %rdx, %xmm6
vmovups %ymm6, (%r11)
nop
nop
nop
sub $19937, %r11
// Store
lea addresses_US+0x1986f, %r11
clflush (%r11)
nop
and %r8, %r8
mov $0x5152535455565758, %r13
movq %r13, %xmm7
movups %xmm7, (%r11)
xor %r13, %r13
// Faulty Load
lea addresses_normal+0x1a06f, %r14
nop
nop
nop
nop
sub %r15, %r15
movups (%r14), %xmm2
vpextrq $1, %xmm2, %rdx
lea oracles, %r11
and $0xff, %rdx
shlq $12, %rdx
mov (%r11,%rdx,1), %rdx
pop %rdx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'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
*/
|
LibraBFT/Base/ByteString.agda | cwjnkins/bft-consensus-agda | 0 | 11865 | <gh_stars>0
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Prelude
-- To enable reasoning about algorithms that concatenate
-- ByteStrings and pass the result to a cryptographic hash
-- function (as LibraBFT does), it is critical to have an
-- injective bitstring concat function ('bs-concat', below).
--
-- To see why, suppose we hash a data structure that contains two
-- fields of type ByteString by passing its fields to a hash
-- function like this:
--
-- > h : String -> String -> Hash
-- > h a b = hash (concat [a , b])
--
-- This function is /NOT/ collision resistant:
--
-- > h "xx" "x" == hash (concat ["xx" , "x"])
-- > == hash "xxx"
-- > == hash (concat ["x" , "xx"]) == h "x" "xx"
--
-- We cannot solve the problem simply by using an arbitrary field
-- separator, because an arbitrary ByteString might contain the
-- separator. For example, if we define:
--
-- > h a b = hash (concat [ a , ";" , b ])
--
-- Then, we still have:
--
-- > h "x;x" "x" == h "x" "x;x"
--
-- Two possible approaches to defining an injective `concat`
-- function are:
--
-- 1) Use some length-prefixed encoding where we know the size of
-- each field. This approach will work in practice but we won't
-- be able to prove its injectivity for arbitrary ByteStrings in
-- Agda: Regardless of how many bytes we reserve for size
-- information, there are some inputs that require more.
--
-- 2) Encoding the arguments' list structure in the result of
-- concat; inverting the concat function then becomes parsing a
-- list of values. This approach is analogous to:
--
-- > concat : List ByteString -> BitString
-- > concat = serialize . toJSON
--
-- We take the second approach.
module LibraBFT.Base.ByteString where
-- A BitString is a list of bits
BitString : Set
BitString = List Bool
-- A ByteString is a list of bytes
ByteString : Set
ByteString = List (Vec Bool 8)
_≟ByteString_ : (bs1 bs2 : ByteString) → Dec (bs1 ≡ bs2)
_≟ByteString_ = List-≡-dec (Vec-≡-dec _≟Bool_)
-- Concatenates ByteString prepending '11' to each byte.
toBitString-pad' : ByteString → BitString
toBitString-pad' = concat ∘ List-map (λ v → true ∷ true ∷ Vec-toList v)
-- Concatenates a ByteString distinguishing an empty list from a non-empty list
toBitString-pad : ByteString → BitString
toBitString-pad [] = false ∷ false ∷ []
toBitString-pad (b ∷ bs) = true ∷ false ∷ Vec-toList b ++ toBitString-pad' bs
-- Here's our injective concat function for ByteString
bs-concat : List ByteString -> BitString
bs-concat = concat ∘ List-map toBitString-pad
-----------------------
-- Injectivity Proof --
-----------------------
-- The proof is straightforward once we figure out the core reasoning principle:
-- Any non-injective cases would be some variation on:
--
-- bs-concat ([a] ∷ c) ≡ bs-concat ([b₀ , b₁] ∷ d)
--
-- <==> toBitString-pad [a] ++ bs-concat c ≡ toBitString-pad [b₀ , b₁] ++ bs-concat d
--
-- <==> 1 1 a₀ ⋯ a₇ ++ bs-concat c ≡ 1 1 b₀₀ ⋯ b₀₇ 1 0 b₁₀ ⋯ b₁₇ ++ bs-concat d
--
-- { ++ is injective for same-length prefixes }
--
-- <==> aᵢ ≡ b₀ᵢ × bs-concat c ≡ 1 0 b₁₀ ⋯ b₁₇ ++ bs-concat d
--
-- { impossible, bs-concat c is either empty or starts with 11 }
--
-- <==> ⊥
--
-- The actual Agda is a little more involved; but this covers the intuition.
-- Appending two lists of the same length is injective.
++-len-injective : ∀{a}{A : Set a}(xs₀ ys₀ : List A){xs₁ ys₁ : List A}
→ length xs₀ ≡ length ys₀
→ xs₀ ++ xs₁ ≡ ys₀ ++ ys₁
→ xs₀ ≡ ys₀ × xs₁ ≡ ys₁
++-len-injective [] [] len hyp = refl , hyp
++-len-injective (x ∷ xs0) (y ∷ ys0) len hyp
= let x≡y , tails≡ = ∷-injective hyp
a , b = ++-len-injective xs0 ys0 (suc-injective len) tails≡
in cong₂ _∷_ x≡y a , b
Vec-toList-length : ∀{a n}{A : Set a}(x : Vec A n) → length (Vec-toList x) ≡ n
Vec-toList-length [] = refl
Vec-toList-length (_ ∷ xs) = cong suc (Vec-toList-length xs)
Vec-toList-inj : ∀{a n}{A : Set a}{x y : Vec A n}
→ Vec-toList x ≡ Vec-toList y → x ≡ y
Vec-toList-inj {x = []} {[]} hyp = refl
Vec-toList-inj {x = x ∷ xs} {y ∷ ys} hyp
= let x≡y , xs≡ys = ∷-injective hyp
in cong₂ _∷_ x≡y (Vec-toList-inj xs≡ys)
-- In general, _++_ is not injective. However, we can
-- characterize it universally with a /Prefix/ property.
data _≺_ {a}{A : Set a} : List A → List A → Set where
z≺n : ∀{xs} → [] ≺ xs
s≺s : ∀{x xs ys} → xs ≺ ys → (x ∷ xs) ≺ (x ∷ ys)
-- Returns the tail of ys; after dropping the prefix xs.
≺-drop : ∀{a}{A : Set a}{xs ys : List A} → xs ≺ ys → List A
≺-drop {ys = ys} z≺n = ys
≺-drop (s≺s a) = ≺-drop a
++-≺ : ∀{a}{A : Set a}(xs ws : List A){ys zs : List A}
→ xs ++ ys ≡ ws ++ zs
→ Σ (xs ≺ ws) (λ prf → ≺-drop prf ++ zs ≡ ys)
⊎ Σ (ws ≺ xs) (λ prf → ≺-drop prf ++ ys ≡ zs)
++-≺ [] ys hyp = inj₁ (z≺n , sym hyp)
++-≺ (x ∷ xs) [] hyp = inj₂ (z≺n , hyp)
++-≺ (x ∷ xs) (y ∷ ys) hyp
with ∷-injective hyp
...| refl , xs≡ys
with ++-≺ xs ys xs≡ys
...| inj₁ (ok , prf) = inj₁ (s≺s ok , prf)
...| inj₂ (ok , prf) = inj₂ (s≺s ok , prf)
≺-respects-++-len
: ∀{a}{A : Set a}(xs₀ ys₀ : List A){xs₁ ys₁ : List A}
→ (p : (xs₀ ++ xs₁) ≺ (ys₀ ++ ys₁))
→ length xs₀ ≡ length ys₀
→ xs₀ ≡ ys₀ × Σ (xs₁ ≺ ys₁) (λ p' → ≺-drop p ≡ ≺-drop p')
≺-respects-++-len [] [] prf hyp = refl , (prf , refl)
≺-respects-++-len (x ∷ xs) (.x ∷ ys) (s≺s prf) hyp
with ≺-respects-++-len xs ys prf (suc-injective hyp)
...| xs≡ys , res , ok = cong (x ∷_) xs≡ys , res , ok
bs-concat-[]⊎tf : ∀ as {bs} → true ∷ true ∷ bs ≢ bs-concat as
bs-concat-[]⊎tf ([] ∷ as) ()
bs-concat-[]⊎tf ((_ ∷ _) ∷ as) ()
toBitString-pad'-≺
: ∀{a b}
→ (a≺bbs : toBitString-pad' a ≺ toBitString-pad' b)
→ a ≡ b ⊎ ∃[ tail ] (≺-drop a≺bbs ≡ true ∷ true ∷ tail)
toBitString-pad'-≺ {[]} {[]} prf = inj₁ refl
toBitString-pad'-≺ {[]} {x ∷ bs} z≺n = inj₂ (Vec-toList x ++ toBitString-pad' bs , refl)
toBitString-pad'-≺ {a ∷ as} {b ∷ bs} (s≺s (s≺s prf))
with ≺-respects-++-len (Vec-toList a) (Vec-toList b) prf
(trans (Vec-toList-length a) (sym (Vec-toList-length b)))
...| a≡b , prf' , drop≡
with toBitString-pad'-≺ {as} {bs} prf'
...| inj₁ ok = inj₁ (cong₂ _∷_ (Vec-toList-inj a≡b) ok)
...| inj₂ ok = inj₂ (proj₁ ok , trans drop≡ (proj₂ ok))
toBitString-pad-≺
: ∀{a b}
→ (a≺bbs : toBitString-pad a ≺ toBitString-pad b)
→ a ≡ b ⊎ ∃[ tail ] (≺-drop a≺bbs ≡ true ∷ true ∷ tail)
toBitString-pad-≺ {[]} {[]} prf = inj₁ refl
toBitString-pad-≺ {a ∷ as} {b ∷ bs} (s≺s (s≺s prf))
with ≺-respects-++-len (Vec-toList a) (Vec-toList b) prf
(trans (Vec-toList-length a) (sym (Vec-toList-length b)))
...| a≡b , prf' , drop≡
with toBitString-pad'-≺ {as} {bs} prf'
...| inj₁ ok = inj₁ (cong₂ _∷_ (Vec-toList-inj a≡b) ok)
...| inj₂ ok = inj₂ (proj₁ ok , trans drop≡ (proj₂ ok))
bs-concat-inj : ∀ bs₁ bs₂ → bs-concat bs₁ ≡ bs-concat bs₂ → bs₁ ≡ bs₂
bs-concat-inj [] [] hyp = refl
bs-concat-inj ([] ∷ as) [] ()
bs-concat-inj [] ([] ∷ bs) ()
bs-concat-inj [] ((_ ∷ _) ∷ bs) ()
bs-concat-inj ((_ ∷ _) ∷ as) [] ()
bs-concat-inj (a ∷ as) (b ∷ bs) hyp -- TODO-1: Eliminate catchall warning or explain why we don't.
with ++-≺ (toBitString-pad a) (toBitString-pad b) hyp
...| inj₁ (a≺b , prf)
with toBitString-pad-≺ a≺b
...| inj₁ refl = cong (a ∷_) (bs-concat-inj as bs (proj₂ (++-len-injective (toBitString-pad a) _ refl hyp)))
...| inj₂ (tail , aux) rewrite aux = ⊥-elim (bs-concat-[]⊎tf as prf)
bs-concat-inj (a ∷ as) (b ∷ bs) hyp
| inj₂ (b≺a , prf)
with toBitString-pad-≺ b≺a
...| inj₁ refl = cong (a ∷_) (bs-concat-inj as bs (proj₂ (++-len-injective (toBitString-pad a) _ refl hyp)))
...| inj₂ (tail , aux) rewrite aux = ⊥-elim (bs-concat-[]⊎tf bs prf)
|
alloy4fun_models/trashltl/models/8/DdnwMS2xyJtELEzmt.als | Kaixi26/org.alloytools.alloy | 0 | 5128 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idDdnwMS2xyJtELEzmt_prop9 {
all f: File | always(f in Protected implies f not in Trash)
}
pred __repair { idDdnwMS2xyJtELEzmt_prop9 }
check __repair { idDdnwMS2xyJtELEzmt_prop9 <=> prop9o } |
oeis/291/A291512.asm | neoneye/loda-programs | 11 | 21643 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A291512: The arithmetic function uhat(n,2,7).
; Submitted by <NAME>
; -34,-34,-34,-34,-34,-34,-34,-34,-36,-40,-44,-48,-52,-56,-60,-64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124,-128,-132,-136,-140,-144,-148,-152,-156,-160,-164,-168,-172,-176,-180,-184,-188,-192,-196,-200,-204,-208,-212,-216,-220,-224,-228,-232,-236,-240,-244,-248,-252,-256,-260,-264,-268,-272,-276,-280
mul $0,2
trn $0,15
mov $2,-17
sub $2,$0
mov $0,$2
mul $0,2
|
Code/Z80-Assembly/Demo2/multiply.asm | sonic2000gr/RainbowProject | 6 | 84125 | ORG 0000H ; Program Entry Point (BIOS Start)
endram: EQU 27FFH ; Stack at end of RAM (dec 10239)
LD SP, endram ; Load Stack Pointer
LD DE, 250 ; Multiply DE
LD A, 10 ; with A
LD B,8 ; 8 bits to shift
LD HL, 0 ; result in HL
start: add HL,HL ; double HL
rlca ; rotate A left and check carry
jr nc, loop ; if no carry just reloop
add hl,de ; if carry add de
loop: djnz start ; repeat from start
halt |
src/Projects/eu_projects-projects.ads | fintatarta/eugen | 0 | 20292 | with Ada.Iterator_Interfaces;
with Ada.Containers.Indefinite_Ordered_Maps;
with Ada.Containers.Vectors;
with Ada.Finalization;
use Ada;
with EU_Projects.Nodes.Partners;
with EU_Projects.Nodes.Timed_Nodes.Milestones;
with EU_Projects.Nodes.Timed_Nodes.Deliverables;
with EU_Projects.Nodes.Action_Nodes.WPs;
with EU_Projects.Nodes.Action_Nodes.Tasks;
with EU_Projects.Nodes.Risks;
with EU_Projects.Node_Tables;
with EU_Projects.Times;
use EU_Projects.Nodes.Action_Nodes;
use EU_Projects.Nodes.Timed_Nodes;
with EU_Projects.Nodes.Timed_Nodes.Project_Infos;
-- with Ada.Containers.Ordered_Maps;
--------------------------
-- EU_Projects.Projects --
--------------------------
package EU_Projects.Projects is
type Project_Descriptor is
new Finalization.Limited_Controlled
with
private;
type Project_Access is access Project_Descriptor;
function Node_Directory (Item : aliased in out Project_Descriptor)
return Node_Tables.Table_Ref;
function Is_Blessed (Project : Project_Descriptor) return Boolean;
procedure Bless (Project : in out Project_Descriptor;
Info : Nodes.Timed_Nodes.Project_Infos.Info_Access)
with
Pre => not Project.Is_Blessed,
Post => Project.Is_Blessed;
procedure Configure (Project : in out Project_Descriptor;
Name : String;
Value : String);
procedure Add_Partner (Project : in out Project_Descriptor;
Partner : in Nodes.Partners.Partner_Access);
procedure Add_WP (Project : in out Project_Descriptor;
WP : in WPs.Project_WP_Access);
procedure Add_Milestone (Project : in out Project_Descriptor;
Item : in Nodes.Timed_Nodes.Milestones.Milestone_Access);
procedure Add_Risk (Project : in out Project_Descriptor;
Item : in Nodes.Risks.Risk_Access);
type Freezing_Options is private;
Sort_Milestones : constant Freezing_Options;
function "+" (X, Y : Freezing_Options) return Freezing_Options;
procedure Freeze (Project : in out Project_Descriptor;
Options : Freezing_Options := Sort_Milestones)
with
Pre => not Project.Is_Freezed and Project.Is_Blessed,
Post => Project.Is_Freezed;
-- Do final housekeeping such as checking for duplicate labels, resolving
-- all the implicit time references in the project and so on.
-- Raise exception Unsolvable if some references cannot be resolved
-- (usually because of a circular reference) and Duplicate_Label if
-- there is more than one node with the same label
function Is_Freezed (Project : Project_Descriptor) return Boolean;
Unsolvable : exception;
Duplicated_Label : exception;
function Find (Where : Project_Descriptor;
Label : Nodes.Node_Label)
return Nodes.Node_Access;
-- Search for a child with the given name and return it
-- Return null if the child does not exist
function Exists (Where : Project_Descriptor;
Label : Nodes.Node_Label)
return Boolean;
function Duration (Item : Project_Descriptor) return Times.Instant;
type Month_Number is new Positive;
subtype Extended_Month_Number is Month_Number'Base range Month_Number'First - 1 .. Month_Number'Last;
No_Month : constant Extended_Month_Number := Extended_Month_Number'First;
type Milestone_Table_Type is
array (Month_Number range <>, Positive range <>)
of Nodes.Timed_Nodes.Milestones.Milestone_Access;
function Milestone_Table (Item : Project_Descriptor) return Milestone_Table_Type
with Pre => Item.Is_Freezed;
-- ========= --
-- ITERATORS --
-- ========= --
------------------
-- WP Iterators --
------------------
type WP_Cursor is private;
function Has_Element (X : WP_Cursor) return Boolean;
package WP_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => WP_Cursor,
Has_Element => Has_Element);
function All_WPs
(Item : Project_Descriptor)
return WP_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : WP_Cursor) return WPs.Project_WP_Access;
function N_WPs (Item : Project_Descriptor) return Natural;
-----------------------
-- Partner Iterators --
-----------------------
type Partner_Cursor is private;
function Has_Element (X : Partner_Cursor) return Boolean;
package Partner_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Partner_Cursor,
Has_Element => Has_Element);
function All_Partners
(Item : Project_Descriptor)
return Partner_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : Partner_Cursor)
return Nodes.Partners.Partner_Access;
function N_Partners (Item : Project_Descriptor) return Natural;
function Partner_Names (Item : Project_Descriptor)
return Nodes.Partners.Partner_Name_Array;
--------------------
-- Risk Iterators --
--------------------
type Risk_Cursor is private;
function Has_Element (X : Risk_Cursor) return Boolean;
package Risk_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Risk_Cursor,
Has_Element => Has_Element);
function All_Risks
(Item : Project_Descriptor)
return Risk_Iterator_Interfaces.Forward_Iterator'Class;
-------------------------
-- All Nodes Iterators --
-------------------------
type All_Node_Cursor is private;
function Has_Element (X : All_Node_Cursor) return Boolean;
package All_Node_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => All_Node_Cursor,
Has_Element => Has_Element);
function All_Nodes
(Item : Project_Descriptor; Full : Boolean := False)
return All_Node_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : All_Node_Cursor)
return Nodes.Node_Access;
-------------------------
-- Milestone Iterators --
-------------------------
type Milestone_Cursor is private;
function Has_Element (X : Milestone_Cursor) return Boolean;
package Milestone_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Milestone_Cursor,
Has_Element => Has_Element);
function All_Milestones
(Item : Project_Descriptor)
return Milestone_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : Milestone_Cursor)
return Nodes.Timed_Nodes.Milestones.Milestone_Access;
-----------------------
-- All task iteration --
------------------------
type All_Task_Cursor is private;
function Element (Index : All_Task_Cursor) return Tasks.Project_Task_Access;
function Has_Element (X : All_Task_Cursor) return Boolean;
package All_Task_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => All_Task_Cursor,
Has_Element => Has_Element);
function All_Tasks (Item : Project_Descriptor)
return All_Task_Iterator_Interfaces.Forward_Iterator'Class;
type All_Deliverable_Cursor is private;
function Element (Index : All_Deliverable_Cursor) return Deliverables.Deliverable_Access;
function Has_Element (X : All_Deliverable_Cursor) return Boolean;
package All_Deliverable_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => All_Deliverable_Cursor,
Has_Element => Has_Element);
function All_Deliverables (Item : Project_Descriptor)
return All_Deliverable_Iterator_Interfaces.Forward_Iterator'Class;
private
use WPs, Nodes.Partners, Nodes.Timed_Nodes.Milestones;
use Nodes, Nodes.Risks;
-- procedure Add_Node (Project : in out Project_Descriptor;
-- Label : Nodes.Node_Label;
-- Node : Nodes.Node_Access);
type Cursor is null record;
-- type Deliverable_Cursor is
-- new Nodes.Node_Index'Base range Nodes.Node_Index'First - 1 .. Nodes.Node_Index'Last;
--
-- type Milestone_Cursor is
-- new Nodes.Node_Index'Base range Nodes.Node_Index'First - 1 .. Nodes.Node_Index'Last;
--
--
package WP_Lists is
new Ada.Containers.Vectors (Index_Type => WP_Index,
Element_Type => Project_WP_Access);
package Partner_Lists is
new Ada.Containers.Vectors (Index_Type => Partner_Index,
Element_Type => Partner_Access);
package Risk_Vectors is
new Ada.Containers.Vectors (Index_Type => Risks.Risk_Index,
Element_Type => Risks.Risk_Access);
package Milestone_Vectors is
new Ada.Containers.Vectors (Index_Type => Milestones.Milestone_Index,
Element_Type => Milestones.Milestone_Access);
use type Times.Instant;
function Is_Earlier (X, Y : Milestones.Milestone_Access) return Boolean
is (Times.Instant'(X.Due_On) < Times.Instant'(Y.Due_On));
package Milestone_Sort is
new Milestone_Vectors.Generic_Sorting ("<" => Is_Earlier);
package Option_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String,
Element_Type => String);
-- package Node_Maps is
-- new Ada.Containers.Ordered_Maps (Key_Type => Nodes.Node_Label,
-- Element_Type => Nodes.Node_Access);
use type Nodes.Timed_Nodes.Project_Infos.Info_Access;
type Project_Descriptor is
new Finalization.Limited_Controlled
with
record
Options : Option_Maps.Map;
WP_List : WP_Lists.Vector;
Partner_List : Partner_Lists.Vector;
Risk_List : Risk_Vectors.Vector;
Milestones : Milestone_Vectors.Vector;
Node_Directory : aliased Node_Tables.Node_Table;
Freezed : Boolean := False;
Last_Month : Times.Instant := Times.Earliest_Istant;
Info : Project_Infos.Info_Access := null;
end record;
function Is_Blessed (Project : Project_Descriptor) return Boolean
is (Project.Info /= null);
function Duration (Item : Project_Descriptor) return Times.Instant
is (Item.Last_Month);
function N_Partners (Item : Project_Descriptor) return Natural
is (Natural (Item.Partner_List.Length));
function N_WPs (Item : Project_Descriptor) return Natural
is (Natural (Item.WP_List.Length));
function Node_Directory (Item : aliased in out Project_Descriptor)
return Node_Tables.Table_Ref
is (D => Item.Node_Directory'Access);
-------------------------
-- Milestone iteration --
-------------------------
type Milestone_Cursor is new Milestone_Vectors.Cursor;
type Milestone_Iterator is
new Milestone_Iterator_Interfaces.Forward_Iterator
with
record
Start : Milestone_Vectors.Cursor;
end record;
overriding
function First (Object : Milestone_Iterator) return Milestone_Cursor
is (Milestone_Cursor (Object.Start));
overriding
function Next
(Object : Milestone_Iterator;
Position : Milestone_Cursor) return Milestone_Cursor
is (Milestone_Cursor (Milestone_Vectors.Next (Milestone_Vectors.Cursor (Position))));
function Element (Index : Milestone_Cursor) return Nodes.Timed_Nodes.Milestones.Milestone_Access
is (Milestone_Vectors.Element (Milestone_Vectors.Cursor (Index)));
function Has_Element (X : Milestone_Cursor) return Boolean
is (Milestone_Vectors.Has_Element (Milestone_Vectors.Cursor (X)));
function All_Milestones (Item : Project_Descriptor)
return Milestone_Iterator_Interfaces.Forward_Iterator'Class
is (Milestone_Iterator'(Start => Item.Milestones.First));
------------------
-- WP iteration --
------------------
type WP_Cursor is new WP_Lists.Cursor;
type Task_Cursor is
record
WP : WP_Cursor;
Tsk : Nodes.Node_Index;
end record;
type WP_Iterator is
new WP_Iterator_Interfaces.Forward_Iterator
with
record
Start : WP_Cursor;
end record;
overriding
function First (Object : WP_Iterator) return WP_Cursor
is (Object.Start);
overriding
function Next
(Object : WP_Iterator;
Position : WP_Cursor) return WP_Cursor
is (WP_Cursor (WP_Lists.Next (WP_Lists.Cursor (Position))));
function Element (Index : WP_Cursor) return Nodes.Action_Nodes.WPs.Project_WP_Access
is (WP_Lists.Element (WP_Lists.Cursor (Index)));
function Has_Element (X : WP_Cursor) return Boolean
is (WP_Lists.Has_Element (WP_Lists.Cursor (X)));
function All_WPs (Item : Project_Descriptor)
return WP_Iterator_Interfaces.Forward_Iterator'Class
is (WP_Iterator'(Start => WP_Cursor (Item.WP_List.First)));
-----------------------
-- Partner iteration --
-----------------------
type Partner_Cursor is new Partner_Lists.Cursor;
type Partner_Iterator is
new Partner_Iterator_Interfaces.Forward_Iterator
with
record
Start : Partner_Lists.Cursor;
end record;
overriding
function First (Object : Partner_Iterator) return Partner_Cursor
is (Partner_Cursor (Object.Start));
overriding
function Next
(Object : Partner_Iterator;
Position : Partner_Cursor) return Partner_Cursor
is (Partner_Cursor (Partner_Lists.Next (Partner_Lists.Cursor (Position))));
function Element (Index : Partner_Cursor) return Nodes.Partners.Partner_Access
is (Partner_Lists.Element (Partner_Lists.Cursor (Index)));
function Has_Element (X : Partner_Cursor) return Boolean
is (Partner_Lists.Has_Element (Partner_Lists.Cursor (X)));
function All_Partners (Item : Project_Descriptor)
return Partner_Iterator_Interfaces.Forward_Iterator'Class
is (Partner_Iterator'(Start => Item.Partner_List.First));
------------------------
-- All task iteration --
------------------------
type All_Task_Cursor is
record
WP_Pos : WP_Cursor;
Task_Pos : WPs.Task_Cursor;
Task_Iter : WPs.Task_Iterator;
end record;
function Element (Index : All_Task_Cursor) return Tasks.Project_Task_Access
is (WPs.Element (Index.Task_Pos));
function Has_Element (X : All_Task_Cursor) return Boolean
is (Has_Element (X.WP_Pos));
type All_Task_Iterator is
new All_Task_Iterator_Interfaces.Forward_Iterator
with
record
WP_Iter : WP_Iterator;
end record;
overriding
function First (Object : All_Task_Iterator) return All_Task_Cursor;
overriding
function Next
(Object : All_Task_Iterator;
Position : All_Task_Cursor) return All_Task_Cursor;
function All_Tasks (Item : Project_Descriptor)
return All_Task_Iterator_Interfaces.Forward_Iterator'Class
is (All_Task_Iterator'(WP_Iter => WP_Iterator (Item.All_WPs)));
------------------------------
-- All_Deliverable_Iterator --
------------------------------
type All_Deliverable_Iterator is
new All_Deliverable_Iterator_Interfaces.Forward_Iterator
with
record
WP_Iter : WP_Iterator;
end record;
type All_Deliverable_Cursor is
record
WP_Pos : WP_Cursor;
Deliv_Pos : WPs.Deliverable_Cursor;
Deliv_Iter : WPs.Deliverable_Iterator;
end record;
function Element (Index : All_Deliverable_Cursor) return Deliverables.Deliverable_Access
is (WPs.Element (Index.Deliv_Pos));
function Has_Element (X : All_Deliverable_Cursor) return Boolean
is (Has_Element (X.Deliv_Pos));
overriding
function First (Object : All_Deliverable_Iterator) return All_Deliverable_Cursor;
overriding
function Next
(Object : All_Deliverable_Iterator;
Position : All_Deliverable_Cursor) return All_Deliverable_Cursor;
function All_Deliverables (Item : Project_Descriptor)
return All_Deliverable_Iterator_Interfaces.Forward_Iterator'Class
is (All_Deliverable_Iterator'(WP_Iter => WP_Iterator (Item.All_WPs)));
--------------------
-- Risk iteration --
--------------------
type Risk_Cursor is new Risk_Vectors.Cursor;
type Risk_Iterator is
new Risk_Iterator_Interfaces.Forward_Iterator
with
record
Start : Risk_Vectors.Cursor;
end record;
overriding
function First (Object : Risk_Iterator) return Risk_Cursor
is (Risk_Cursor (Object.Start));
overriding
function Next
(Object : Risk_Iterator;
Position : Risk_Cursor) return Risk_Cursor
is (Risk_Cursor (Risk_Vectors.Next (Risk_Vectors.Cursor (Position))));
function Element (Index : Risk_Cursor) return Risks.Risk_Access
is (Risk_Vectors.Element (Risk_Vectors.Cursor (Index)));
function Has_Element (X : Risk_Cursor) return Boolean
is (Risk_Vectors.Has_Element (Risk_Vectors.Cursor (X)));
function All_Risks (Item : Project_Descriptor)
return Risk_Iterator_Interfaces.Forward_Iterator'Class
is (Risk_Iterator'(Start => Item.Risk_List.First));
-------------------------
-- All Node iteration --
-------------------------
subtype Restricted_Node_Class is
Nodes.Node_Class
range
Node_Class'Succ (Nodes.Info_Node) .. Node_Class'Last;
type All_Node_Cursor is
record
Prj_Info_Access : Nodes.Timed_Nodes.Project_Infos.Info_Access;
Current_Class : Restricted_Node_Class;
Risk_Pos : Risk_Cursor;
Deliverable_Pos : All_Deliverable_Cursor;
WP_Pos : WP_Cursor;
Task_Pos : All_Task_Cursor;
Partner_Pos : Partner_Cursor;
Milestone_Pos : Milestone_Cursor;
end record;
type All_Node_Iterator is
new All_Node_Iterator_Interfaces.Forward_Iterator
with
record
Prj_Info_Access : Project_Infos.Info_Access;
Risk_Iter : Risk_Iterator;
Deliverable_Iter : All_Deliverable_Iterator;
WP_Iter : WP_Iterator;
All_Task_Iter : All_Task_Iterator;
Partner_Iter : Partner_Iterator;
Milestone_Iter : Milestone_Iterator;
end record;
overriding
function First (Object : All_Node_Iterator) return All_Node_Cursor
is (All_Node_Cursor'(Current_Class => Node_Class'Succ (Info_Node),
Prj_Info_Access => Object.Prj_Info_Access,
Risk_Pos => First (Object.Risk_Iter),
Deliverable_Pos => First (Object.Deliverable_Iter),
WP_Pos => First (Object.WP_Iter),
Task_Pos => First (Object.All_Task_Iter),
Partner_Pos => First (Object.Partner_Iter),
Milestone_Pos => First (Object.Milestone_Iter)));
overriding
function Next
(Object : All_Node_Iterator;
Position : All_Node_Cursor) return All_Node_Cursor;
function Element (Index : All_Node_Cursor) return Node_Access
is (if Index.Prj_Info_Access /= null
then
Node_Access (Index.Prj_Info_Access)
else
(case Index.Current_Class is
when WP_Node => Node_Access (Element (Index.WP_Pos)),
when Task_Node => Node_Access (Element (Index.Task_Pos)),
when Deliverable_Node => Node_Access (Element (Index.Deliverable_Pos)),
when Risk_Node => Node_Access (Element (Index.Risk_Pos)),
when Partner_Node => Node_Access (Element (Index.Partner_Pos)),
when Milestone_Node => Node_Access (Element (Index.Milestone_Pos))));
function Has_Element (X : All_Node_Cursor) return Boolean
is (X.Prj_Info_Access /= null
or else X.Current_Class /= Nodes.Node_Class'Last
or else Has_Element (X.Partner_Pos));
pragma Compile_Time_Error (Node_Class'Last /= Partner_Node, "Wrong has_element");
function All_Nodes (Item : Project_Descriptor; Full : Boolean := False)
return All_Node_Iterator_Interfaces.Forward_Iterator'Class
is (All_Node_Iterator'
(Prj_Info_Access => (if Full then Item.Info else null),
Risk_Iter => Risk_Iterator (Item.All_Risks),
Deliverable_Iter => All_Deliverable_Iterator (Item.All_Deliverables),
WP_Iter => WP_Iterator (Item.All_WPs),
All_Task_Iter => All_Task_Iterator (Item.All_Tasks),
Partner_Iter => Partner_Iterator (Item.All_Partners),
Milestone_Iter => Milestone_Iterator (Item.All_Milestones)));
function Is_Freezed (Project : Project_Descriptor) return Boolean
is (Project.Freezed);
type Freezing_Basic_Option is (Milestone_Sorting);
type Freezing_Options is array (Freezing_Basic_Option) of Boolean;
pragma Warnings(Off, "there are no others");
Sort_Milestones : constant Freezing_Options := (Milestone_Sorting => True, others => False);
function "+" (X, Y : Freezing_Options) return Freezing_Options
is (X or Y);
end EU_Projects.Projects;
-- function Find (Resolver : Project_Descriptor;
-- What : Identifiers.Full_Paths.Full_ID)
-- return Boolean;
-- function Get_Attribute (Project : Project_Descriptor;
-- Name : Identifier)
-- return String;
--
-- function Get_Attribute (Project : Project_Descriptor;
-- Name : Identifier)
-- return Integer;
-- function Get (Project : Project_Descriptor;
-- Name : WPs.WP_Label)
-- return WPs.Project_WP_Access;
--
-- function Get (Project : Project_Descriptor;
-- Name : Nodes.Partners.Partner_Label)
-- return Nodes.Partners.Partner_Access;
|
Transynther/x86/_processed/AVXALIGN/_st_zr_un_4k_/i9-9900K_12_0xa0.log_21829_471.asm | ljhsiun2/medusa | 9 | 244973 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1c7fe, %r9
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
movups %xmm7, (%r9)
and %rdi, %rdi
lea addresses_normal_ht+0x385e, %r9
nop
cmp %rsi, %rsi
mov (%r9), %r11
nop
inc %rcx
lea addresses_A_ht+0x14dae, %rsi
lea addresses_UC_ht+0x102fe, %rdi
sub %r13, %r13
mov $54, %rcx
rep movsl
nop
nop
nop
dec %r11
lea addresses_A_ht+0x18f6, %r11
nop
nop
nop
nop
nop
xor $21753, %rbx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%r11)
nop
xor $535, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %r8
push %rax
push %rsi
// Store
lea addresses_RW+0x1a7fe, %r11
nop
nop
nop
nop
and $29104, %r8
movw $0x5152, (%r11)
nop
nop
nop
nop
nop
dec %rax
// Faulty Load
lea addresses_PSE+0x87fe, %r10
cmp %r14, %r14
movntdqa (%r10), %xmm0
vpextrq $0, %xmm0, %rsi
lea oracles, %rax
and $0xff, %rsi
shlq $12, %rsi
mov (%rax,%rsi,1), %rsi
pop %rsi
pop %rax
pop %r8
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': True, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'52': 21590, '5f': 112, '00': 127}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 5f 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 5f 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
projects/batfish/src/main/antlr4/org/batfish/grammar/flatjuniper/FlatJuniper_routing_instances.g4 | netarch/batfish | 0 | 4046 | <gh_stars>0
parser grammar FlatJuniper_routing_instances;
import
FlatJuniper_common, FlatJuniper_forwarding_options, FlatJuniper_protocols, FlatJuniper_snmp;
options {
tokenVocab = FlatJuniperLexer;
}
ri_common
:
apply
| ri_description
| s_forwarding_options
| s_routing_options
;
ri_description
:
description
;
ri_instance_type
:
INSTANCE_TYPE
(
FORWARDING
| L2VPN
| VIRTUAL_ROUTER
| VIRTUAL_SWITCH
| VRF
)
;
ri_interface
:
INTERFACE id = interface_id
;
ri_named_routing_instance
:
name = variable
(
ri_common
| ri_instance_type
| ri_interface
| ri_null
| ri_protocols
| ri_route_distinguisher
| ri_snmp
| ri_vrf_export
| ri_vrf_import
| ri_vrf_table_label
| ri_vrf_target
| ri_vtep_source_interface
)
;
ri_null
:
(
BRIDGE_DOMAINS
| CHASSIS
| CLASS_OF_SERVICE
| EVENT_OPTIONS
| PROVIDER_TUNNEL
| SERVICES
) null_filler
;
ri_protocols
:
s_protocols
;
ri_route_distinguisher
:
ROUTE_DISTINGUISHER
(
DEC
| IP_ADDRESS
) COLON DEC
;
ri_snmp
:
s_snmp
;
ri_vrf_export
:
VRF_EXPORT name = variable
;
ri_vrf_import
:
VRF_IMPORT name = variable
;
ri_vrf_table_label
:
VRF_TABLE_LABEL
;
ri_vrf_target
:
VRF_TARGET
(
riv_community
| riv_export
| riv_import
)
;
ri_vtep_source_interface
:
VTEP_SOURCE_INTERFACE iface = interface_id
;
riv_community
:
extended_community
;
riv_export
:
EXPORT extended_community
;
riv_import
:
IMPORT extended_community
;
ro_aggregate
:
AGGREGATE
(
apply
| roa_defaults
| roa_route
)
;
ro_auto_export
:
AUTO_EXPORT
;
ro_autonomous_system
:
AUTONOMOUS_SYSTEM asn = bgp_asn?
(
apply
|
(
roas_asdot_notation
| roas_loops
)*
)
;
ro_bmp
:
BMP
(
rob_station_address
| rob_station_port
)
;
ro_confederation
:
CONFEDERATION num = DEC?
(
MEMBERS member += DEC
)*
;
ro_forwarding_table
:
FORWARDING_TABLE
(
rof_export
| rof_no_ecmp_fast_reroute
| rof_null
)
;
ro_generate
:
GENERATE
(
apply
| rog_defaults
| rog_route
)
;
ro_interface_routes
:
INTERFACE_ROUTES
(
roi_family
| roi_rib_group
)
;
ro_martians
:
MARTIANS null_filler
;
ro_null
:
(
GRACEFUL_RESTART
| LSP_TELEMETRY
| MULTICAST
| MULTIPATH
| NONSTOP_ROUTING
| OPTIONS
| PPM
| RESOLUTION
| TRACEOPTIONS
) null_filler
;
ro_rib
:
RIB name = VARIABLE
(
apply
| ro_aggregate
| ro_generate
| ro_static
)
;
ro_rib_groups
:
RIB_GROUPS name = variable
(
ror_export_rib
| ror_import_policy
| ror_import_rib
)
;
ro_route_distinguisher_id
:
ROUTE_DISTINGUISHER_ID addr = IP_ADDRESS
;
ro_router_id
:
ROUTER_ID id = IP_ADDRESS
;
ro_srlg
:
SRLG name = variable
(
roslrg_srlg_cost
| roslrg_srlg_value
)
;
ro_static
:
STATIC
(
ros_rib_group
| ros_route
)
;
roa_active
:
ACTIVE
;
roa_as_path
:
AS_PATH?
(
roaa_aggregator
| roaa_origin
| roaa_path
)
;
roa_common
:
apply
| roa_active
| roa_as_path
| roa_community
| roa_discard
| roa_passive
| roa_policy
| roa_preference
| roa_tag
;
roa_community
:
COMMUNITY community = COMMUNITY_LITERAL
;
roa_defaults
:
DEFAULTS roa_common
;
roa_discard
:
DISCARD
;
roa_passive
:
PASSIVE
;
roa_policy
:
POLICY name = variable
;
roa_preference
:
PREFERENCE preference = DEC
;
roa_route
:
ROUTE
(
prefix = IP_PREFIX
| prefix6 = IPV6_PREFIX
)
roa_common
;
roa_tag
:
TAG tag = DEC
;
roaa_aggregator
:
AGGREGATOR as = DEC ip = IP_ADDRESS
;
roaa_origin
:
ORIGIN IGP
;
roaa_path
:
PATH path = as_path_expr
;
roas_asdot_notation
:
ASDOT_NOTATION
;
roas_loops
:
LOOPS DEC
;
rob_station_address
:
STATION_ADDRESS IP_ADDRESS
;
rob_station_port
:
STATION_PORT DEC
;
roa_route
:
ROUTE
(
prefix = IP_PREFIX
| prefix6 = IPV6_PREFIX
)
(
apply
| roa_common
)
;
rof_export
:
EXPORT name = variable
;
rof_no_ecmp_fast_reroute
:
NO_ECMP_FAST_REROUTE
;
rof_null
:
(
INDIRECT_NEXT_HOP
| INDIRECT_NEXT_HOP_CHANGE_ACKNOWLEDGEMENTS
) null_filler
;
rog_active
:
ACTIVE
;
rog_common
:
apply
| rog_active
| rog_community
| rog_discard
| rog_metric
| rog_passive
| rog_policy
;
rog_community
:
COMMUNITY standard_community
;
rog_defaults
:
DEFAULTS rog_common
;
rog_discard
:
DISCARD
;
rog_metric
:
METRIC metric = DEC
;
rog_passive
:
PASSIVE
;
rog_policy
:
POLICY policy = variable
;
rog_route
:
ROUTE
(
IP_PREFIX
| IPV6_PREFIX
) rog_common
;
roi_family
:
FAMILY
(
roif_inet
| roif_null
)
;
roi_rib_group
:
RIB_GROUP
(
roir_inet
| roir_null
)
;
roif_inet
:
INET
(
roifi_export
)
;
roif_null
:
INET6 null_filler
;
roifi_export
:
EXPORT
(
roifie_lan
| roifie_point_to_point
)
;
roifie_lan
:
LAN
;
roifie_point_to_point
:
POINT_TO_POINT
;
roir_inet
:
INET name = variable
;
roir_null
:
INET6 null_filler
;
ror_export_rib
:
EXPORT_RIB rib = variable
;
ror_import_policy
:
IMPORT_POLICY name = variable
;
ror_import_rib
:
IMPORT_RIB rib = variable
;
ros_rib_group
:
RIB_GROUP name = variable
;
ros_route
:
ROUTE
(
IP_PREFIX
| IPV6_PREFIX
)
(
rosr_common
| rosr_qualified_next_hop
)
;
roslrg_srlg_cost
:
SRLG_COST cost = DEC
;
roslrg_srlg_value
:
SRLG_VALUE value = DEC
;
rosr_active
:
ACTIVE
;
rosr_as_path
:
AS_PATH PATH
(
path += DEC
)+
;
rosr_common
:
rosr_active
| rosr_as_path
| rosr_community
| rosr_discard
| rosr_install
| rosr_no_install
| rosr_metric
| rosr_next_hop
| rosr_next_table
| rosr_no_readvertise
| rosr_no_retain
| rosr_passive
| rosr_preference
| rosr_readvertise
| rosr_reject
| rosr_resolve
| rosr_retain
| rosr_tag
;
rosr_community
:
COMMUNITY standard_community
;
rosr_discard
:
DISCARD
;
rosr_install
:
INSTALL
;
rosr_metric
:
METRIC metric = DEC
(
TYPE DEC
)?
;
rosr_next_hop
:
NEXT_HOP
(
IP_ADDRESS
| IPV6_ADDRESS
| interface_id
)
;
rosr_next_table
:
NEXT_TABLE name = variable
;
rosr_no_install
:
NO_INSTALL
;
rosr_no_readvertise
:
NO_READVERTISE
;
rosr_no_retain
:
NO_RETAIN
;
rosr_passive
:
PASSIVE
;
rosr_preference
:
PREFERENCE pref = DEC
;
rosr_qualified_next_hop
:
QUALIFIED_NEXT_HOP nexthop = IP_ADDRESS rosr_common?
;
rosr_readvertise
:
READVERTISE
;
rosr_reject
:
REJECT
;
rosr_resolve
:
RESOLVE
;
rosr_retain
:
RETAIN
;
rosr_tag
:
TAG tag = DEC
;
s_routing_instances
:
ROUTING_INSTANCES
(
ri_common
| ri_named_routing_instance
)
;
s_routing_options
:
ROUTING_OPTIONS
(
ro_aggregate
| ro_auto_export
| ro_autonomous_system
| ro_bmp
| ro_confederation
| ro_forwarding_table
| ro_generate
| ro_interface_routes
| ro_martians
| ro_null
| ro_rib
| ro_rib_groups
| ro_route_distinguisher_id
| ro_router_id
| ro_srlg
| ro_static
)
;
|
oeis/211/A211421.asm | neoneye/loda-programs | 11 | 17634 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A211421: Integral factorial ratio sequence: a(n) = (8*n)!*(3*n)!/((6*n)!*(4*n)!*n!).
; Submitted by <NAME>
; 1,14,390,12236,404550,13777764,478273692,16825310040,597752648262,21397472070260,770557136489140,27884297395587240,1013127645555452700,36935287875280348776,1350441573221798941560,49498889739033621986736,1818284097150186829038150,66920769700528547057908500,2467167492130768182080453700,91095235149726756910334373000,3368099426962326804363735573300,124683505899828792470448523810104,4620814774829824363618645711873800,171423637044076905982892148876150480,6365433935222442622152802301782499100
mov $1,1
mov $2,1
mov $3,$0
mul $3,2
lpb $3
mul $1,$0
mul $1,6
sub $3,1
mul $2,$3
add $1,$2
mov $2,$1
mov $4,$5
cmp $4,0
add $5,$4
div $1,$5
div $2,$5
add $2,$1
mul $1,2
sub $3,1
add $5,1
lpe
mov $0,$2
|
src/terminal_colours.adb | wiremoons/terminal-colours | 1 | 13737 | <filename>src/terminal_colours.adb
-------------------------------------------------------------------------------
-- BUILD FILE : Terminal_Colours.gpr --
-- Description : Demo of Ada terminal color support --
-- Author : <NAME> <<EMAIL>> --
-- License : MIT Open Source. --
-------------------------------------------------------------------------------
-- Based on example source code from:
-- https://docs.adacore.com/gnatcoll-docs/terminals.html
--
-- to build:
--
-- gprbuild -P terminal_colours.gpr
--
-- to clean up:
--
-- gnatclean -P terminal_colours
--
-- to pretty format the code:
--
-- gnatpp -P terminal_colours.gpr
--
with Ada.Text_IO; use Ada.Text_IO;
with GNATCOLL.Terminal; use GNATCOLL.Terminal;
procedure Terminal_Colours is
Screen : Terminal_Info;
begin
-- initialise screen outputs wanted
Screen.Init_For_Stdout (Auto);
Screen.Init_For_Stderr (Auto);
Put_Line ("Checking for colour terminal support...");
New_Line (1);
Put_Line ("- Colour support: " & (if Screen.Has_Colors then "Ok" else "None"));
Put_Line ("- ANSI support: " & (if Screen.Has_ANSI_Colors then "Yes" else "No"));
New_Line (1);
Screen.Clear_To_End_Of_Line;
-- Change Standard Output
Put_Line ("Testing 'stdout':");
Screen.Set_Color (Standard_Output, Blue, Yellow);
Put_Line ("A blue on yellow line");
Screen.Set_Style (Term => Standard_Output, Style => Bright);
Put_Line ("A blue on yellow line with 'bright' style added");
Set_Color (Self => Screen, Term => Standard_Output, Style => Reset_All, Foreground => Reset, Background => Reset);
-- ensure the background colour is clearer properly before next output
Screen.Beginning_Of_Line;
Screen.Clear_To_End_Of_Line;
Put_Line ("Reset all - as default now.");
-- Normal colours
New_Line (1);
Screen.Set_Style (Style => Normal, Term => Standard_Output);
Screen.Set_Fg (Color => Blue, Term => Standard_Output);
Put_Line ("Normal blue text.");
Screen.Set_Fg (Color => Green, Term => Standard_Output);
Put_Line ("Normal green text.");
Screen.Set_Fg (Color => Yellow, Term => Standard_Output);
Put_Line ("Normal Yellow text.");
Screen.Set_Fg (Color => Magenta, Term => Standard_Output);
Put_Line ("Normal Magenta text.");
Screen.Set_Fg (Color => Cyan, Term => Standard_Output);
Put_Line ("Normal Cyan text.");
Screen.Set_Fg (Color => Grey, Term => Standard_Output);
Put_Line ("Normal Grey text.");
Set_Color (Self => Screen, Term => Standard_Output, Style => Reset_All, Foreground => Reset, Background => Reset);
Put_Line ("Reset all - as default now.");
-- Bright colours
New_Line (1);
Screen.Set_Style (Style => Bright, Term => Standard_Output);
Screen.Set_Fg (Color => Blue, Term => Standard_Output);
Put_Line ("Bright blue text.");
Screen.Set_Fg (Color => Green, Term => Standard_Output);
Put_Line ("Bright green text.");
Screen.Set_Fg (Color => Yellow, Term => Standard_Output);
Put_Line ("Bright Yellow text.");
Screen.Set_Fg (Color => Magenta, Term => Standard_Output);
Put_Line ("Bright Magenta text.");
Screen.Set_Fg (Color => Cyan, Term => Standard_Output);
Put_Line ("Bright Cyan text.");
Screen.Set_Fg (Color => Grey, Term => Standard_Output);
Put_Line ("Bright Grey text.");
Screen.Set_Color (Standard_Output, Style => Reset_All);
Put_Line ("Reset all - as default now.");
-- Change Standard Output
New_Line (1);
Put_Line ("Testing 'stderr':");
Screen.Set_Color (Standard_Error, Red, Unchanged);
Put_Line (Standard_Error, "A red on 'Unchanged' line");
Screen.Set_Style (Style => Bright, Term => Standard_Error);
Put_Line (Standard_Error, "A bright red on 'Unchanged' line");
Screen.Set_Color (Standard_Error, Style => Reset_All);
Put_Line ("Back to standard colors -- 'Reset_All'");
New_Line (1);
Put_Line ("Testing 'cursor management'");
New_Line (1);
Put_Line ("Increment to '40'...");
for J in 1 .. 40 loop
if J mod 10 = 0 then
Put ("Processing file :");
Screen.Set_Fg (Green);
Put (J'Img);
Screen.Set_Fg (Cyan);
Put (" with long name");
Screen.Set_Fg (Reset);
delay 0.2;
else
Put ("Processing file :" & J'Img);
end if;
delay 0.2;
Screen.Beginning_Of_Line;
Screen.Clear_To_End_Of_Line;
end loop;
Put_Line ("End.");
end Terminal_Colours;
|
libsrc/_DEVELOPMENT/arch/zx/display/c/sdcc_iy/zx_saddrpleft_callee.asm | meesokim/z88dk | 0 | 21823 |
; void *zx_saddrpleft_callee(void *saddr, uchar bitmask)
SECTION code_arch
PUBLIC _zx_saddrpleft_callee
_zx_saddrpleft_callee:
pop af
pop hl
pop de
push af
INCLUDE "arch/zx/display/z80/asm_zx_saddrpleft.asm"
|
alloy4fun_models/trainstlt/models/10/fJdBs9y9QeEeBQTvd.als | Kaixi26/org.alloytools.alloy | 0 | 2991 | open main
pred idfJdBs9y9QeEeBQTvd_prop11 {
always ( all t:Train | some t.pos :> (Track-Entry) implies historically ( t.pos in Entry) )
}
pred __repair { idfJdBs9y9QeEeBQTvd_prop11 }
check __repair { idfJdBs9y9QeEeBQTvd_prop11 <=> prop11o } |
test/Succeed/Issue4005.agda | cruhland/agda | 1,989 | 3855 | <reponame>cruhland/agda<gh_stars>1000+
open import Agda.Builtin.Equality using (_≡_)
open import Agda.Builtin.Sigma using (Σ; _,_)
postulate
F : Set → Set₁
P : (A : Set) → F A → Set
easy : {A : Set₁} → A
A : Set₁
A = Σ Set λ B → Σ (F B) (P B)
f : (X Y : A) → X ≡ Y
f (C , x , p) (D , y , q) = proof
module _ where
abstract
proof : (C , x , p) ≡ (D , y , q)
proof = easy
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_241.asm | ljhsiun2/medusa | 9 | 93874 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xc45d, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
and $64133, %r10
mov (%rbx), %r9d
nop
nop
nop
add $21663, %r13
lea addresses_WT_ht+0xc2a1, %rsi
lea addresses_A_ht+0x2955, %rdi
nop
nop
nop
dec %r9
mov $112, %rcx
rep movsb
nop
nop
nop
nop
nop
and $48431, %rdi
lea addresses_WC_ht+0xbd9d, %rcx
nop
nop
nop
nop
nop
and %rsi, %rsi
mov (%rcx), %rdi
nop
nop
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0x6fad, %rbx
nop
nop
nop
inc %r10
mov (%rbx), %r13w
nop
sub %rdi, %rdi
lea addresses_A_ht+0xb3d, %rbx
nop
nop
nop
nop
mfence
mov (%rbx), %cx
nop
nop
nop
nop
nop
and %r10, %r10
lea addresses_UC_ht+0x8d11, %rsi
lea addresses_normal_ht+0x4c5d, %rdi
clflush (%rdi)
sub $30241, %r15
mov $64, %rcx
rep movsl
nop
nop
nop
and $39613, %r9
lea addresses_normal_ht+0x1845d, %rsi
nop
nop
nop
add $10639, %rcx
movups (%rsi), %xmm4
vpextrq $0, %xmm4, %r10
nop
nop
nop
nop
dec %r10
lea addresses_WT_ht+0x9a5d, %rsi
lea addresses_D_ht+0x1e05d, %rdi
nop
nop
dec %r9
mov $127, %rcx
rep movsq
nop
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x1bed, %r10
nop
nop
nop
nop
add $45349, %rbx
and $0xffffffffffffffc0, %r10
vmovntdqa (%r10), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
nop
nop
nop
cmp %rcx, %rcx
lea addresses_D_ht+0x14c08, %r13
nop
cmp $26313, %r10
mov $0x6162636465666768, %rdi
movq %rdi, %xmm4
vmovups %ymm4, (%r13)
nop
nop
nop
nop
nop
inc %r10
lea addresses_A_ht+0xec5d, %rdi
nop
nop
nop
nop
dec %rbx
movb (%rdi), %r13b
nop
nop
dec %r9
lea addresses_A_ht+0x16b25, %rsi
nop
dec %rdi
movb (%rsi), %r9b
sub $48302, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r9
push %rbp
// Faulty Load
lea addresses_PSE+0x10c5d, %r13
and $44303, %r9
movups (%r13), %xmm3
vpextrq $1, %xmm3, %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
release/src/router/gmp/source/mpn/ia64/sqr_diagonal.asm | zhoutao0712/rtn11pb1 | 184 | 87721 | dnl IA-64 mpn_sqr_diagonal. Helper for sqr_basecase.
dnl Copyright 2001, 2002, 2004 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: 4
C Itanium 2: 2
C TODO
C * Perhaps avoid ctop loop. Unfortunately, a cloop loop running at 1 c/l
C would need prohibitive 8-way unrolling.
C * Instead of messing too much with this, write a nifty mpn_sqr_basecase.
C INPUT PARAMETERS
C rp = r32
C sp = r33
C n = r34
ASM_START()
PROLOGUE(mpn_sqr_diagonal)
.prologue
.save ar.lc, r2
.save pr, r15
.body
ifdef(`HAVE_ABI_32',
` addp4 r32 = 0, r32
addp4 r33 = 0, r33
zxt4 r34 = r34
;;
')
ldf8 f32 = [r33], 8 C M load rp[0] early
mov r2 = ar.lc C I0
mov r14 = ar.ec C I0
mov r15 = pr C I0
add r19 = -1, r34 C M I decr n
add r18 = 8, r32 C M I rp for high limb
;;
mov ar.lc = r19 C I0
mov ar.ec = 5 C I0
mov pr.rot = 1<<16 C I0
;;
br.cexit.spnt .Ldone C B
;;
ALIGN(32)
.Loop:
(p16) ldf8 f32 = [r33], 8 C M
(p19) xma.l f36 = f35, f35, f0 C F
(p21) stf8 [r32] = f38, 16 C M2 M3
(p19) xma.hu f40 = f35, f35, f0 C F
(p21) stf8 [r18] = f42, 16 C M2 M3
br.ctop.dptk .Loop C B
;;
.Ldone:
stf8 [r32] = f38 C M2 M3
stf8 [r18] = f42 C M2 M3
mov ar.ec = r14 C I0
;;
mov pr = r15, 0x1ffff C I0
mov ar.lc = r2 C I0
br.ret.sptk.many b0 C B
EPILOGUE(mpn_sqr_diagonal)
ASM_END()
|
programs/oeis/257/A257849.asm | karttu/loda | 1 | 9216 | <gh_stars>1-10
; A257849: a(n) = floor(n/9) * (n mod 9).
; 0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,0,2,4,6,8,10,12,14,16,0,3,6,9,12,15,18,21,24,0,4,8,12,16,20,24,28,32,0,5,10,15,20,25,30,35,40,0,6,12,18,24,30,36,42,48,0,7,14,21,28,35,42,49,56,0,8,16,24,32,40,48,56,64,0,9,18,27,36,45,54,63,72,0,10,20,30,40,50,60,70,80,0,11,22,33,44,55,66,77,88,0,12,24,36,48,60,72,84,96,0,13,26,39,52,65,78,91,104,0,14,28,42,56,70,84,98,112,0,15,30,45,60,75,90,105,120,0,16,32,48,64,80,96,112,128,0,17,34,51,68,85,102,119,136,0,18,36,54,72,90,108,126,144,0,19,38,57,76,95,114,133,152,0,20,40,60,80,100,120,140,160,0,21,42,63,84,105,126,147,168,0,22,44,66,88,110,132,154,176,0,23,46,69,92,115,138,161,184,0,24,48,72,96,120,144,168,192,0,25,50,75,100,125,150,175,200,0,26,52,78,104,130,156,182,208,0,27,54,81,108,135,162
mov $1,$0
mod $1,9
sub $0,$1
mul $1,$0
div $1,9
|
src/game_level/enemiesA.asm | TypeDefinition/NautiBuoy | 2 | 91292 | <reponame>TypeDefinition/NautiBuoy
SECTION "Enemy A", ROM0
INCLUDE "./src/definitions/definitions.inc"
INCLUDE "./src/include/entities.inc"
/* Update for enemy type A
Behavior:
- Stays in 1 spot and shoot based on direction
- mostly based on animation
Parameters:
- hl: the starting address of the enemy
- a : enemy type
*/
UpdateEnemyA::
push hl ; PUSH hl = enemy address
cp a, TYPE_ENEMYA_MOV
jr nz, .checkShoot
push hl ; PUSH hl = enemy address
call EnemyBounceOnWallMovement
pop hl ; POP hl = enemy address
.checkShoot
ld de, Character_Direction
add hl, de ; get direction
ld a, [hli]
xor a, %00000001 ; invert last bit, get opposite direction for shooting
ld c, a ; c = direction
inc hl
inc hl
inc hl
ld a, [hl] ; first part of updateFrameCounter
add a, ENEMY_TYPEA_ANIMATION_UPDATE_SPEED
ld [hli], a ; store the new value
jr nc, .endUpdateEnemyA
; update frames
ld a, [hl] ; a = int part of updateFrameCounter
inc a ; add the carry
cp a, ENEMY_TYPEA_ATTACK_FRAME ; check if shoot
jr nz, .attackFinish
pop de ; POP de = enemy address
push de ; PUSH de = enemy address
push af ; PUSH af = int part of updateFrameCounter
push hl ; PUSH hl = updateFrameCounter address
call EnemyShoot
pop hl ; POP hl = updateFrameCounter address
pop af ; POP af = int part of updateFrameCounter
.attackFinish
; a = int part of updateFrameCounter, hl = updateFrameCounter address
ld d, a ; reg d = int part of updateFrameCounter
inc hl
cp a, ENEMY_TYPEA_ATTACK_STATE_FRAME ; check if go attack state
jr nz, .updateAnimationFrames
; reach attack state, reset variables
ld a, -1
ld [hli], a ; currFrame = -1
ld a, ENEMY_TYPEA_ATTACK_ANIM_MAX_FRAMES
ld [hl], a ; init max frame to be the attack frames
dec hl
.updateAnimationFrames
; hl = curr animation frame address, d = int part of updateFrameCounter
ld a, [hli] ; get curr animation frame
inc a ; go next frame
ld b, a ; b stores curr frame
ld a, [hl] ; get max frames
cp a, b
jr nz, .continueAnimation ; check if reach max frame
ld b, 0 ; reset curr frame if reach max frame
; check if in attack mode
ld a, d ; reg a = updateFrameCounter
cp a, ENEMY_TYPEA_ATTACK_STATE_FRAME
jr c, .continueAnimation
ld a, ENEMY_TYPEA_WALK_FRAMES
ld [hl], a ; reset back to idling
ld d, 0 ; int part of updateFrameCounter = 0
.continueAnimation ; store the relevant animation info
; hl = max frames address, d = updateFrameCounter, b = currFrame
dec hl
ld a, b
ld [hl], a ; store curr frame
dec hl
ld a, d
ld [hl], a ; store updateFrameCounter
.endUpdateEnemyA
pop hl ; POP hl = enemy address
call InitEnemyASprite
ret
/* Init enemy A sprite
hl - enemy address
*/
InitEnemyASprite:
push hl
call UpdateEnemyEffects
pop hl
ld b, SCREEN_UPPER_OFFSET_Y
ld c, SCREEN_LEFT_OFFSET_X
call CheckEnemyInScreen
and a
ret z
inc hl ; offset to get direction
inc hl
ld a, [hli] ; check direction of enemy and init sprite data
push af ; PUSH AF = direction
inc hl
inc hl
inc hl
inc hl ; offset to get updateFrameCounter
ld a, [hl] ; get int part of updateFrameCounter
ld bc, EnemyAAnimation.upAnimation
cp a, ENEMY_TYPEA_ATTACK_STATE_FRAME ; check state and init proper animation
jr nc, .endDir
.attackAnim
ld bc, EnemyAAnimation.attackUpAnimation
.endDir
pop af ; POP af = direction
and a, DIR_BIT_MASK
sla a
sla a ; x 4
add a, a ; x8
add a, c
ld c, a
ld a, b
adc a, 0 ; add direction offset to animation address: bc + a
ld b, a
ld a, l ; offset the address back to default
sub a, Character_UpdateFrameCounter + 1
ld l, a
ld a, h
sbc a, 0
ld h, a
call UpdateEnemySpriteOAM
.end
ret |
R2_Comm_Link/asm/src/slave_manager.asm | CmdrZin/chips_avr_examples | 5 | 6707 | /*
* Slave Manager Module
*
* org: 9/11/2014
* auth: Nels "Chip" Pearson
*
* Target: R2Link Demo Board w/ LED bank, 20MHz
*
* Usage:
* .include slave_manager.asm
*
*/
// Message Type values
.equ MSG_TYPE_0 = 0x00 ; Normal Data Parcket. N=1-15 bytes.
/* SLAVE_ECHO:
* Copy valid Type 0 I2C messages to I2C OUT. Ignores Tone messages.
* Any Mode other than SLAVE_ECHO:
* Copy the message bytes into its Tone OUT buffer and output.
*/
.equ MSG_TYPE_F = 0xF0 ; Set Parameters. Data pairs. N*2 bytes.
/* Any Mode:
* Slave will parse data pairs and set parameters.
*/
.equ PARAM_LOOP = 0x00 ; Set Output Loops 0:No Loop, 1->FE, FF:Continuous
.equ PARAM_AUTOA = 0x01 ; Set ACK/NACK response..0:No, 1:Yes
.equ PARAM_SYMTDLY = 0x02 ; Timeout Delay. N=Symbol delays to wait for next Symbol.
.equ PARAM_SYMRATE = 0x03 ; Symbol Rate. Rate to send Symbols. N=n * 10ms.
.equ PARAM_SYMDUR` = 0x04 ; Symbol Duration. Time to hold Tone output. N=n * 10 ms.
.equ PARAM_MODE = 0x06 ; Set Mode (1-4)
// Slave Modes
.equ S_MODE_INVALID = 0x00
.equ S_MODE_NORMAL = 0x01
.equ S_MODE_ECHO = 0x02
.equ S_MODE_RAW = 0x03
.equ S_MODE_CAL = 0x04
// slave_state values
.equ SS_ECHO = 2 ; Do not load OUT buffer from Tones.
// Slave Control Flags
.equ SCF_NO_TONE_OUT = 0x01 ; If set=1, inhibit Tone generation
.equ SCF_NO_TONE_IN = 0x02 ; If set=1, do not process ADC sample with Goeritz
.DSEG
slave_mode: .BYTE 1 ; current Slave Mode
slave_flags: .BYTE 1 ; subsystem control flags
slave_state: .BYTE 1 ; current Slave Mode state
slave_delay: .BYTE 1 ; extend delay
.CSEG
/*
* This function will generate a service based on the Mode and slave_state.
* Call when an I2C message is received from Master.
*
* 1. Perform CKSUM test on I2C IN buffer.
* 2. Parse based on Mode.
*
* input reg: none
* output reg: none
*
*/
parse_i2c_msg:
rjmp tst_00
// Check CKSUM of I2C IN Buffer.
ldi XL, LOW(i2c_buffer_in)
ldi XH, HIGH(i2c_buffer_in)
lds R18, i2c_buffer_in_cnt
call util_cksum ; X->CKSUM in buffer.
ld R18, X ; get buffer CKSUM
cp R17, R18
breq pim_skip00
; CKSUM invalid
rjmp pim_reset_in ; reset I2C IN Buffer to receive.
;
pim_skip00:
// CKSUM valid. Check for Type F.
lds R16, i2c_buffer_in ; get Header
andi R16, 0xF0 ; mask
cpi R16, MSG_TYPE_F
brne pim_skip10
; Type F
ldi R16, S_MODE_NORMAL
sts slave_mode, R16 ; Default Mode = NORMAL
// For now, ANY Type F msg wil set the Mode to NORMAL.
// TODO: Parse Data Pairs of Parameters from msg.
;
rjmp pim_reset_in ; reset I2C IN Buffer to receive.
;
pim_skip10:
// Check for Type 0.
cpi R16, MSG_TYPE_0
brne pim_reset_in ; EXIT..Others Types not supported.
;
lds R16, slave_mode
cpi R16, S_MODE_NORMAL
brne pim_skip20
; In NORMAL mode, Type 0 msgs are sent to the Tone OUT buffer.
lds R16, i2c_buffer_in ; get Header
andi R16, 0xF0 ; mask
cpi R16, MSG_TYPE_0
brne pim_skip10
;
tst_00:
; Type 0: Data .. Copy to Tone Msg Out
lds R16, i2c_buffer_in ; get Header
andi R16, 0x0F ; get num of bytes
ldi XL, LOW(i2c_buffer_in) ; X=src
ldi XH, HIGH(i2c_buffer_in)
ldi YL, LOW(tgu_msg_buff) ; Y=dst
ldi YH, HIGH(tgu_msg_buff)
;
pim_loop00:
ld R17, X+
st Y+, R17
dec R16
brne pim_loop00
;
ld R17, X ; get CKSUM
st Y, R17
; Trigger TONE Out
lds R16, i2c_buffer_in ; get Header
andi R16, 0x0F ; get num of bytes
sts tgu_msg_status, R16 ; Set byte count.
;
rjmp pim_reset_in ; reset I2C IN Buffer to receive.
;
pim_skip20:
cpi R16, S_MODE_ECHO
brne pim_skip100
; In ECHO Mode, Type 0 messages go back into I2C OUT buffer.
lds R16, i2c_buffer_in ; get Header
andi R16, 0x0F ; get num of bytes
sts i2c_buffer_out_cnt, R16 ; store byte count.
ldi XL, LOW(i2c_buffer_in) ; X=src
ldi XH, HIGH(i2c_buffer_in)
ldi YL, LOW(i2c_buffer_out) ; Y=dst
ldi YH, HIGH(i2c_buffer_out)
;
pim_loop10:
ld R17, X+
st Y+, R17
dec R16
brne pim_loop10
;
ld R17, X ; get CKSUM
st Y, R17
rjmp pim_reset_in ; reset I2C IN Buffer to receive.
;
pim_skip100:
; Test for other Modes when supported.
;
pim_reset_in:
lds R16, i2c_flags
cbr R16, I2CF_IN_MSG
sts i2c_flags, R16
call i2c_slave_init ; reset I2C interface.
;
ret
/*
* This function will generate a service based on the Mode and slave_state.
* Call from main() loop to service periodic operations.
*
* Check slave_mode
* S_MODE_NORMAL: Copy Type 0 I2C IN msg to Tone OUT buffer
* Ignore other types except Type F.
* S_MODE_ECHO: Copy Type 1 I2C IN msg to I2C OUT buffer
* Ignore other types except Type F.
* S_MODE_RAW: Ignore I2C IN msg types except Type F.
* Copy new ADC output to I2C OUT buffer
* S_MODE_CAL: Ignore I2C IN msg types except Type F.
*
* input reg: none (slave_state)
* output reg: none
*
*/
slave_service:
// Check for ADC sample. Always Service ADC.
call adc_get_data ; read ADC buffer..ADC intr driven
tst R18 ; check for new data.
brne ss_skip00
; Process?
lds R16, slave_flags
andi R16, SCF_NO_TONE_IN
brne ss_skip00
;
call goertzel_1_tone ; process data.
lds R16, gortz_det
sts led_bank, R16
;
ss_skip00:
// Check for I2C In Message. Always process Type F to set parameters.
lds R16, i2c_flags
andi R16, I2CF_IN_MSG ; ckeck flag
breq ss_skip10 ; not set
; New. Parse I2C message.
call parse_i2c_msg ; Parse is based on Mode.
;
lds R16, i2c_flags
cbr R16, I2CF_IN_MSG ; clear flag
sts i2c_flags, R16
;
ss_skip10:
// Process MODE specific tasks
lds R16, slave_mode
cpi R16, S_MODE_NORMAL
brne ss_skip20
; NORMAL Mode
// Check for Tone In Message if NOT in ECHO mode
lds R16, tone_flags
andi R16, TF_IN_MSG
breq ss_skip20
;
call parse_tone_msg
;
ss_skip20:
cpi R16, S_MODE_ECHO
brne ss_skip30
; ECHO Mode
;
ss_skip30:
cpi R16, S_MODE_RAW
brne ss_skip40
; RAW Mode
;
ss_skip40:
cpi R16, S_MODE_CAL
brne ss_skip50
; CAL Mode
;
ss_skip50:
// Service any 1ms TIC operations
sbis GPIOR0, MS_1MS_TIC
ret
;
cbi GPIOR0, MS_1MS_TIC
ret ; EXIT
|
oeis/090/A090640.asm | neoneye/loda-programs | 11 | 22563 | ; A090640: a(0) = 0; a(2n) = 4*a(n), a(2n+1) = a(n) + 1.
; Submitted by <NAME>
; 0,1,4,2,16,5,8,3,64,17,20,6,32,9,12,4,256,65,68,18,80,21,24,7,128,33,36,10,48,13,16,5,1024,257,260,66,272,69,72,19,320,81,84,22,96,25,28,8,512,129,132,34,144,37,40,11,192,49,52,14,64,17,20,6,4096,1025,1028,258,1040
mov $2,1
lpb $0
gcd $2,$3
mov $3,$0
div $0,2
mod $3,2
mul $3,$2
add $1,$3
mul $2,4
lpe
add $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c38102e.ada | best08618/asylo | 7 | 13340 | <gh_stars>1-10
-- C38102E.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT AN INCOMPLETE TYPE CAN BE REDECLARED AS A DERIVED GENERIC
-- FORMAL TYPE.
-- AH 8/15/86
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
-- DNT 11/28/95 CHANGED TO FLAG1 := F4.
WITH REPORT; USE REPORT;
PROCEDURE C38102E IS
TYPE RAINBOW IS (RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET);
TYPE T_FLOAT IS DIGITS 5 RANGE -4.0 .. 4.0;
TYPE T_FIXED IS DELTA 0.01 RANGE 0.0 .. 1.5;
SUBTYPE P1 IS INTEGER;
TYPE P2 IS RANGE 0 .. 10;
TYPE P3 IS ARRAY (P2) OF INTEGER;
TYPE P4 IS ARRAY (P2, P2) OF INTEGER;
F1, F2 : BOOLEAN;
GENERIC
TYPE G1 IS (<>);
TYPE G2 IS RANGE <>;
FUNCTION G_DISCRETE RETURN BOOLEAN;
FUNCTION G_DISCRETE RETURN BOOLEAN IS
TYPE INC1;
TYPE INC2;
TYPE F1 IS NEW G1;
TYPE INC1 IS NEW G1;
TYPE INC2 IS NEW G2;
OBJ1_0 : INC1;
OBJ1_1 : INC1;
OBJ2_0 : INC2;
OBJ2_1 : INC2;
OBJ3 : F1;
RESULT_VALUE1 : BOOLEAN := FALSE;
RESULT_VALUE2 : BOOLEAN := FALSE;
BEGIN
OBJ3 := F1'LAST;
OBJ3 := F1'PRED(OBJ3);
IF INC1(OBJ3) = INC1'PRED(INC1'LAST) THEN
RESULT_VALUE1 := TRUE;
END IF;
OBJ2_0 := INC2'FIRST;
OBJ2_1 := INC2'LAST;
IF (OBJ2_0 + OBJ2_1) = (INC2'SUCC(OBJ2_0) +
INC2'PRED(OBJ2_1)) THEN
RESULT_VALUE2 := TRUE;
END IF;
RETURN (RESULT_VALUE1 AND RESULT_VALUE2);
END G_DISCRETE;
GENERIC
TYPE G3 IS DIGITS <>;
TYPE G4 IS DELTA <>;
PROCEDURE REALS (FLAG1, FLAG2 : OUT BOOLEAN);
PROCEDURE REALS (FLAG1, FLAG2 : OUT BOOLEAN) IS
F1, F2, F3, F4, F5, F6, F7, F8 : BOOLEAN;
TYPE INC3;
TYPE INC4;
TYPE P1 IS NEW G3;
TYPE P2 IS NEW G4;
TYPE INC3 IS NEW G3;
TYPE INC4 IS NEW G4;
BEGIN
F4 := P1'LAST = P1(INC3'LAST) AND P1'FIRST = P1(INC3'FIRST);
F5 := P2'FORE = INC4'FORE;
F6 := P2'AFT = INC4'AFT;
F7 := ABS(P2'LAST - P2'FIRST) = P2(ABS(INC4'LAST -
INC4'FIRST));
F8 := INC4(P2'LAST / P2'LAST) = INC4(INC4'LAST / INC4'LAST);
FLAG1 := F4;
FLAG2 := F5 AND F6 AND F7 AND F8;
END REALS;
GENERIC
TYPE ITEM IS PRIVATE;
TYPE INDEX IS RANGE <>;
TYPE G5 IS ARRAY (INDEX) OF ITEM;
TYPE G6 IS ARRAY (INDEX, INDEX) OF ITEM;
PACKAGE DIMENSIONS IS
TYPE INC5;
TYPE INC6;
TYPE D1 IS NEW G5;
TYPE D2 IS NEW G6;
TYPE INC5 IS NEW G5;
TYPE INC6 IS NEW G6;
FUNCTION CHECK RETURN BOOLEAN;
END DIMENSIONS;
PACKAGE BODY DIMENSIONS IS
FUNCTION CHECK RETURN BOOLEAN IS
A1 : INC5;
A2 : INC6;
DIM1 : D1;
DIM2 : D2;
F1, F2 : BOOLEAN;
BEGIN
F1 := A1(INDEX'FIRST)'SIZE = DIM1(INDEX'FIRST)'SIZE;
F2 := A2(INDEX'FIRST, INDEX'LAST)'SIZE =
DIM2(INDEX'FIRST, INDEX'LAST)'SIZE;
RETURN (F1 AND F2);
END CHECK;
END DIMENSIONS;
PROCEDURE PROC IS NEW REALS (G3 => T_FLOAT, G4 => T_FIXED);
FUNCTION DISCRETE IS NEW G_DISCRETE (G1 => RAINBOW, G2 => P2);
PACKAGE PKG IS NEW DIMENSIONS (ITEM => P1, INDEX => P2, G5 => P3,
G6 => P4);
USE PKG;
BEGIN
TEST ("C38102E", "INCOMPLETE TYPES CAN BE DERIVED GENERIC " &
"FORMAL TYPES");
IF NOT DISCRETE THEN
FAILED ("INTEGER AND ENUMERATED TYPES NOT DERIVED");
END IF;
PROC (F1, F2);
IF (NOT F1) THEN
FAILED ("FLOAT TYPES NOT DERIVED");
END IF;
IF (NOT F2) THEN
FAILED ("FIXED TYPES NOT DERIVED");
END IF;
IF NOT CHECK THEN
FAILED ("ONE AND TWO DIMENSIONAL ARRAY TYPES NOT DERIVED");
END IF;
RESULT;
END C38102E;
|
MatrixMultiplication/matrix_multiplication.adb | veyselharun/ABench2020 | 0 | 14400 | <gh_stars>0
--
-- ABench2020 Benchmark Suite
--
-- Matrix Multiplication Program
--
-- Licensed under the MIT License. See LICENSE file in the ABench root
-- directory for license information.
--
-- Uncomment the line below to print the result.
-- with Ada.Text_IO; use Ada.Text_IO;
procedure Matrix_Multiplication is
type MMatrix is array (Positive range<>, Positive range<>) of Integer;
procedure Multiply (First_Matrix, Second_Matrix : in MMatrix; Third_Matrix : out MMatrix) is
Product : Integer := 0;
begin
for T in 1 .. First_Matrix'Last (1) loop
for Y in 1 .. Second_Matrix'Last (2) loop
Product := 0;
for U in 1 .. First_Matrix'Last (2) loop
Product := Product + First_Matrix (T, U) * Second_Matrix (U, Y);
end loop;
Third_Matrix (T, Y) := Product;
end loop;
end loop;
end;
First_Matrix : constant MMatrix :=
( (1, 1, 22, 83, 98, 1, 10, 2, 9, 11),
(5, 1, 14, 8, 9, 10, 7, 2, 10, 30),
(6, 5, 32, 0, 1, 60, 10, 0, 2, 0),
(22, 9, 23, 4, 1, 9, 3, 1, 4, 1),
(8, 1, 82, 3, 5, 6, 3, 4, 7, 2),
(9, 0, 17, 4, 4, 99, 9, 0, 1, 10),
(2, 5, 27, 2, 1, 40, 7, 1, 0, 20),
(0, 7, 12, 1, 1, 13, 4, 8, 2, 75),
(21, 33, 1, 1, 7, 8, 2, 0, 9, 3),
(5, 98, 0, 2, 0, 9, 1, 1, 5, 12)
);
Second_Matrix : constant MMatrix :=
( (1, 1, 22, 83, 98, 1, 10, 2, 9, 11),
(5, 1, 14, 8, 9, 10, 7, 2, 10, 30),
(6, 5, 32, 0, 1, 60, 10, 0, 2, 0),
(22, 9, 23, 4, 1, 9, 3, 1, 4, 1),
(8, 1, 82, 3, 5, 6, 3, 4, 7, 2),
(9, 0, 17, 4, 4, 99, 9, 0, 1, 10),
(2, 5, 27, 2, 1, 40, 7, 1, 0, 20),
(0, 7, 12, 1, 1, 13, 4, 8, 2, 75),
(21, 33, 1, 1, 7, 8, 2, 0, 9, 3),
(5, 98, 0, 2, 0, 9, 1, 1, 5, 12)
);
Third_Matrix : MMatrix (1 .. 10, 1 .. 10);
begin
Multiply (First_Matrix, Second_Matrix, Third_Matrix);
-- Uncomment the lines below to print the result.
-- for I in 1 .. Third_Matrix'Last (1) loop
-- for J in 1 .. Third_Matrix'Last (2) loop
-- Put (Integer'Image (Third_Matrix (I, J)));
-- end loop;
-- New_Line;
-- end loop;
end;
|
projects/Kirbys_Dream_Land_2.windfish/configuration/globals.asm | jverkoey/awaken | 68 | 11586 | HeaderIsColorGB EQU $0143 ; [HW_COLORGAMEBOY]
HeaderSGBFlag EQU $0146 ; [HW_SUPERGAMEBOY]
HeaderCartridgeType EQU $0147 ; [HW_CARTRIDGETYPE]
HeaderROMSize EQU $0148 ; [HW_ROMSIZE]
HeaderRAMSize EQU $0149 ; [HW_RAMSIZE]
HeaderDestinationCode EQU $014A ; [HW_DESTINATIONCODE]
gbVRAM EQU $8000 ; [hex]
gbBGCHARDAT EQU $8800 ; [hex]
gbBGDAT0 EQU $9800 ; [hex]
gbBGDAT1 EQU $9C00 ; [hex]
gbCARTRAM EQU $A000 ; [hex]
gbRAM EQU $C000 ; [hex]
wScrollPosition1 EQU $DA02 ; [decimal]
wScrollPosition2 EQU $DA04 ; [decimal]
wQueuedDMATransfer EQU $DA0F ; [decimal]
wTrampoline EQU $DA10 ; [LR35902_INSTRUCTION]
wStashL EQU $DA11 ; [decimal]
wStashH EQU $DA12 ; [decimal]
wLCDInterruptTrampoline EQU $DA13 ; [decimal]
wDesiredLYC EQU $DA29 ; [decimal]
wJoypadStorage EQU $DA3E ; [BUTTON]
wJoypadStorage2 EQU $DA3F ; [BUTTON]
wJoypadStorage3 EQU $DA40 ; [BUTTON]
wJoypadCounter EQU $DA41 ; [decimal]
gbOAMRAM EQU $FE00 ; [hex]
gbP1 EQU $FF00 ; [JOYPAD]
gbSB EQU $FF01 ; [hex]
gbSC EQU $FF02 ; [hex]
gbDIV EQU $FF04 ; [hex]
gbTIMA EQU $FF05 ; [hex]
gbTMA EQU $FF06 ; [hex]
gbTAC EQU $FF07 ; [hex]
gbIF EQU $FF0F ; [hex]
gbAUD1SWEEP EQU $FF10 ; [hex]
gbAUD1LEN EQU $FF11 ; [hex]
gbAUD1ENV EQU $FF12 ; [hex]
gbAUD1LOW EQU $FF13 ; [hex]
gbAUD1HIGH EQU $FF14 ; [hex]
gbAUD2LEN EQU $FF16 ; [hex]
gbAUD2ENV EQU $FF17 ; [hex]
gbAUD2LOW EQU $FF18 ; [hex]
gbAUD2HIGH EQU $FF19 ; [hex]
gbAUD3ENA EQU $FF1A ; [hex]
gbAUD3LEN EQU $FF1B ; [hex]
gbAUD3LEVEL EQU $FF1C ; [hex]
gbAUD3LOW EQU $FF1D ; [hex]
gbAUD3HIGH EQU $FF1E ; [hex]
gbAUD4LEN EQU $FF20 ; [hex]
gbAUD4ENV EQU $FF21 ; [hex]
gbAUD4POLY EQU $FF22 ; [hex]
gbAUD4CONSEC EQU $FF23 ; [hex]
gbAUDVOL EQU $FF24 ; [binary]
gbAUDTERM EQU $FF25 ; [binary]
gbAUDENA EQU $FF26 ; [HW_AUDIO_ENABLE]
gbAUD3WAVERAM EQU $FF30 ; [hex]
gbLCDC EQU $FF40 ; [LCDCF]
gbSTAT EQU $FF41 ; [STATF]
gbSCY EQU $FF42 ; [decimal]
gbSCX EQU $FF43 ; [decimal]
gbLY EQU $FF44 ; [decimal]
gbLYC EQU $FF45 ; [decimal]
gbDMA EQU $FF46 ; [hex]
gbBGP EQU $FF47 ; [hex]
gbOBP0 EQU $FF48 ; [hex]
gbOBP1 EQU $FF49 ; [hex]
gbWY EQU $FF4A ; [hex]
gbWX EQU $FF4B ; [hex]
gbKEY1 EQU $FF4D ; [hex]
gbVBK EQU $FF4F ; [hex]
gbHDMA1 EQU $FF51 ; [hex]
gbHDMA2 EQU $FF52 ; [hex]
gbHDMA3 EQU $FF53 ; [hex]
gbHDMA4 EQU $FF54 ; [hex]
gbHDMA5 EQU $FF55 ; [hex]
gbRP EQU $FF56 ; [hex]
gbBCPS EQU $FF68 ; [hex]
gbBCPD EQU $FF69 ; [hex]
gbOCPS EQU $FF6A ; [hex]
gbOCPD EQU $FF6B ; [hex]
gbSVBK EQU $FF70 ; [hex]
gbPCM12 EQU $FF76 ; [hex]
gbPCM34 EQU $FF77 ; [hex]
hDMARegion EQU $FF80 ; [hex]
hDMARegion2 EQU $FF88 ; [hex]
hDesiredBankChange EQU $FF96 ; [decimal]
hLastBank EQU $FFA4 ; [decimal]
gbIE EQU $FFFF ; [HW_IE] |
LM/Aula5/Lista3/ex1.asm | Kw-Vinicius/Linguagem-de-Montagem- | 0 | 11073 | ;--------------------------------------------------------------------------------------------
; 1. Escreva um programa que inicialize três posições de memória com valores numéricos
;(<128), e retorne o menor dentre eles.
; <NAME>
;--------------------------------------------------------------------------------------------
SECTION .data
var1: db 6
var2: db 7
var3: db 5
SECTION .text
global _start
_start:
mov al, [var1]
mov bl, [var2]
cmp al,bl
ja a_maior_b
mov bl,[var3]
cmp al,bl
ja var1_maior_var3
mov bl,al
jmp fim
var1_maior_var3:
mov bl,bl
jmp fim
a_maior_b:
mov al,[var3]
cmp al,bl
ja var3_maior_b
var3_maior_b:
mov bl,bl
jmp fim
fim:
mov eax,1
int 80h
|
Transynther/x86/_processed/NC/_ht_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_2116.asm | ljhsiun2/medusa | 9 | 176092 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xbd96, %r12
nop
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%r12), %r10
nop
nop
nop
cmp %r14, %r14
lea addresses_UC_ht+0x1ab96, %rsi
lea addresses_D_ht+0x12a46, %rdi
nop
nop
nop
nop
nop
xor $6707, %r14
mov $121, %rcx
rep movsl
nop
nop
add $23022, %r12
lea addresses_D_ht+0xf5c6, %rsi
lea addresses_normal_ht+0x1c2d3, %rdi
nop
nop
and %rbp, %rbp
mov $79, %rcx
rep movsb
nop
add %rsi, %rsi
lea addresses_WC_ht+0x49d6, %rsi
lea addresses_A_ht+0x1ee46, %rdi
inc %rdx
mov $88, %rcx
rep movsw
nop
nop
add %r10, %r10
lea addresses_normal_ht+0xabae, %rsi
lea addresses_WC_ht+0x7646, %rdi
nop
nop
nop
nop
nop
cmp $58270, %r14
mov $80, %rcx
rep movsb
nop
xor $48600, %rbp
lea addresses_UC_ht+0x13446, %r12
nop
nop
nop
nop
cmp $18284, %rdx
movw $0x6162, (%r12)
add %r12, %r12
lea addresses_A_ht+0x1e846, %rdx
clflush (%rdx)
nop
nop
nop
sub %r12, %r12
vmovups (%rdx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rsi
nop
add %rdx, %rdx
lea addresses_normal_ht+0x11646, %r10
nop
nop
nop
add $58351, %rdx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm4
and $0xffffffffffffffc0, %r10
movntdq %xmm4, (%r10)
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x19b26, %rsi
lea addresses_normal_ht+0x15206, %rdi
clflush (%rdi)
nop
sub $48672, %rbp
mov $84, %rcx
rep movsw
add $31791, %r10
lea addresses_WT_ht+0x1d846, %rdx
xor %rdi, %rdi
movb (%rdx), %cl
nop
nop
nop
add %rsi, %rsi
lea addresses_normal_ht+0xd946, %rdx
nop
nop
nop
add $29049, %rbp
mov (%rdx), %r12d
nop
nop
nop
nop
nop
cmp $22334, %rdi
lea addresses_UC_ht+0xe4c2, %rcx
xor $51192, %rsi
mov (%rcx), %rdi
nop
nop
nop
nop
add %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x1ce46, %rsi
lea addresses_D+0x5e46, %rdi
nop
nop
inc %r13
mov $120, %rcx
rep movsw
nop
nop
nop
nop
cmp %r15, %r15
// Store
mov $0x1461200000000e46, %rdi
add $1629, %r11
movw $0x5152, (%rdi)
sub %r11, %r11
// Faulty Load
mov $0x1461200000000e46, %rdi
nop
nop
add %r15, %r15
movups (%rdi), %xmm6
vpextrq $0, %xmm6, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_NC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': True, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'7a': 1, 'd8': 2, 'd4': 1, '52': 2472, '98': 338, 'a6': 1, '94': 1, 'bc': 1, 'f2': 1, '82': 1, '08': 1, 'fa': 1, '16': 1, 'f0': 1, '4e': 1, '80': 1, '35': 290, '02': 2, '46': 1, '2e': 1, '58': 1, '8a': 1, 'ae': 1, '10': 1, 'c6': 1, '32': 2, 'ca': 1, 'd2': 1, 'e0': 1, 'c2': 1, '06': 1, 'fc': 2, 'd6': 1, 'be': 1, 'a4': 1, '86': 2, 'd0': 111, '00': 18579, 'fe': 1}
00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 52 00 35 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 52 00 00 00 00 35 00 35 00 00 00 d0 00 00 52 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 52 52 00 00 52 00 00 00 52 00 52 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 52 00 00 52 52 00 00 00 00 52 00 52 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 52 00 00 00 00 52 00 00 00 52 00 00 00 00 00 00 52 52 00 00 52 52 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 52 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 98 00 00 00 35 00 00 00 52 00 00 00 00 00 00 00 00 35 00 00 35 00 00 00 00 98 00 98 00 00 00 35 00 00 00 35 00 00 00 00 35 00 00 00 00 00 06 52 00 98 00 52 00 00 00 00 00 35 52 52 00 00 00 00 00 00 00 98 00 00 00 00 00 52 00 00 00 52 00 00 00 00 52 00 00 00 00 00 52 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 52 00 00 35 00 00 00 52 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 52 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 98 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 52 00 00 00 00 52 00 00 00 00 00 52 52 52 00 00 00 35 00 00 52 00 00 00 00 00 35 52 00 00 00 52 52 00 00 00 00 35 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 52 00 00 52 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 98 00 00 00 00 98 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 d0 00 00 00 00 00 00 52 00 52 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 35 00 00 52 00 00 98 00 52 00 00 52 00 00 52 00 00 00 00 35 35 00 00 00 00 00 00 00 00 00 00 52 00 00 00 52 00 00 00 00 00 00 00 98 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 98 00 00 00 98 00 00 52 00 52 52 d0 00 00 35 00 52 00 52 98 52 00 00 ca 52 00 00 00 00 00 52 52 00 00 52 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 98 00 00 00 00 00 00 00 00 52 00 00 00 98 00 00 52 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 52 52 00 00 00 00 52 52 35 00 00 52 00 00 00 00 00 52 00 00 d0 00 00 00 00 52 52 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 52 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 35 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00
*/
|
Sources/Globe_3d/globe_3d-collision_detection.adb | ForYouEyesOnly/Space-Convoy | 1 | 10289 | <reponame>ForYouEyesOnly/Space-Convoy
pragma Style_Checks (Off);
pragma Warnings (Off);
-------------------------------------------------------------------------
-- GLOBE_3D.Collision_detection
--
-- Copyright (c) <NAME> 1999 .. 2008
-- SWITZERLAND
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-- NB : this is the MIT License, as found 12 - Sep - 2007 on the site
-- http://www.opensource.org/licenses/mit - license.php
-------------------------------------------------------------------------
with GLOBE_3D.Math; use GLOBE_3D.Math;
with GLOBE_3D.Options;
package body GLOBE_3D.Collision_detection is
check_normals : constant Boolean := GLOBE_3D.Options.strict_geometry;
procedure Reaction (
o : Object_3D'Class;
ball : Ball_type;
method : Reaction_method;
step : in out Vector_3D; -- Whole step (in : desired, out : effective)
reacted : out Real -- in proportion to step
)
is
P_after_step, P_face : Point_3D;
u, n : Vector_3D;
dist_after, dist_before, nn : Real; -- distance orientee
retour : Real := 0.0;
lstep0 : constant Real := Norm (step);
-- This function check whether we are inside the prism above face f
function Dans_prisme_epaissi (f : Positive) return Boolean is
sfp1 : Positive;
Ps, Psp1 : Point_3D;
u, edge_vector, npa : Vector_3D;
dist_edge, nnpa : Real;
facteur : constant := 1.05;
begin
-- Cycle through face's vertices
for sf in reverse 1 .. o.Face_Invariant (f).last_edge loop
sfp1 := 1 + sf mod o.Face_Invariant (f).last_edge;
Ps := o.point (o.Face_Invariant (f).P_compact (sf));
Psp1 := o.point (o.Face_Invariant (f).P_compact (sfp1));
edge_vector := Psp1 - Ps;
npa := n * edge_vector;
nnpa := Norm (npa);
if Almost_Zero (nnpa) then -- degenerated edge
return False;
end if;
npa := 1.0/nnpa * npa;
-- npa points towards the prism's interior
u := P_after_step - (Ps + o.Centre);
dist_edge := u * npa;
if dist_edge < - ball.radius * facteur then
return False;
end if;
end loop;
return True;
end Dans_prisme_epaissi;
begin
reacted := 0.0;
if Almost_Zero (lstep0) then
return;
end if;
P_after_step := ball.centre + step;
for face in reverse 1 .. o.Max_faces loop
n := o.Face_Invariant (face).normal;
if check_normals then
nn := Norm (n);
if Almost_zero (nn) then
raise Zero_normal;
elsif abs (nn - 1.0) > 1.0e-7 then
raise Not_one_normal with " norm = " & Real'Image (nn);
end if;
end if;
if step * n < 0.0 then
P_face := o.point (o.Face_Invariant (face).P_compact (1)) + o.Centre;
-- ^ any point on the face, to measure distance to face's plane.
u := ball.centre - P_face;
dist_before := u * n;
if dist_before > 0.0 then
-- ^ Fine, we are on the right side of the face.
-- Test added to Engine_3D's algo, since objects are
-- not always hollow, convex polyhedrons anymore.
u := P_after_step - P_face;
dist_after := u * n;
if dist_after < ball.radius
-- ^ Ouch! React we must!
-- This includes negatives values of dist_after, in cases
-- the intended step makes going through the face!
and then
Dans_prisme_epaissi (face)
then
if o.face (face).skin /= invisible then
-- ^ this assumes : invisible < => can go through
reacted := reacted + retour / lstep0;
-- !! seems wrong if reactions in different directions
-- should be something like step * step0
case method is
when elastic =>
raise Unsupported with "elastic reaction";
-- should compute the time the "ball" takes from rebound to
-- next face or portal.
when slide =>
retour := ball.radius - dist_after; -- always > 0
step := step + retour * n;
-- Since step and n have a negative dot product - checked -
-- and dist (ball.centre + step_old, face) < ball.radius - checked -
-- then:
-- ||step_new|| < ||step_old|| --> decreasing algo : - )
end case;
end if;
end if;
end if;
end if;
end loop;
end Reaction;
end GLOBE_3D.Collision_detection;
|
dino/lcs/base/6BDB.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 173614 | copyright zengfr site:http://github.com/zengfr/romhack
004CFC move.b D0, ($6bdb,A5)
004D00 move.b D0, ($6bdc,A5)
016CB6 move.b ($6bdb,A5), D2
016CBA bra $16cc8 [base+6BDB]
016CDA move.b D2, ($6bdb,A5)
016CDE rts [base+6BDB]
copyright zengfr site:http://github.com/zengfr/romhack
|
Outputs/mixers/m32flat/mixinterp.asm | jgunthorpe/muse | 0 | 170202 | ;
; ASM mixing code
;
ideal ; TASM Ideal ode
p386 ; protected mode 386 code
model os2 flat, syscall ; os/2 flat model, system calling
nosmart
public syscall MixIntAsm
public syscall MixIntAsmR
public syscall MixIntAsm_Si
public syscall MixIntAsmR_Si
public syscall MixIntAsm_16
public syscall MixIntAsmR_16
dataseg
StackSave DD ?
VolTable DD ?
MulIncr DD ?
WholeIncr DD ?
Fraction DD ?
FirstPos DD ?
PrevPos DD ?
LastPos DD ?
LastVal DD ?
FromL DD ?
FromR DD ?
StoreEnd DD ?
codeseg ; Start the code segment
MACRO MIXCODE
; Main mixer
IF DIRECTION EQ FORWARD
IF MODE EQ UNSIGNED
proc MixIntAsm syscall
ELSEIF MODE EQ SIGNED
proc MixIntAsm_Si syscall
ELSE
proc MixIntAsm_16 syscall
ENDIF
ELSE
IF MODE EQ UNSIGNED
proc MixIntAsmR syscall
ELSEIF MODE EQ SIGNED
proc MixIntAsmR_Si syscall
ELSE
proc MixIntAsmR_16 syscall
ENDIF
ENDIF
ARG @@MCur:PTR DWORD,@@End:PTR DWORD,@@Incr:DWORD,@@CurIncr:DWORD, \
@@Add:DWORD,@@PlayPos:PTR BYTE,@@VolMap:PTR DWORD, \
@@FirstPos:DWORD,@@PrevPos:DWORD,@@LastPos:PTR DWORD
; Save volatile registers
pushad
push ebp
; Save esp and store MEnd
mov [StackSave],esp ; Stash esp in the dgroup
mov eax,[@@VolMap]
mov [VolTable], eax
mov eax,[@@Add]
IF MODE EQ _16BIT
add eax, eax
ENDIF
mov [WholeIncr],eax ; Stash Add too
; Register map:
mov ecx,[@@CurIncr] ; Current Incr
mov ebx,[@@Incr] ; Incr
mov [Fraction], ebx
mov edx,[@@MCur] ; MCur
mov edi,[@@PlayPos] ; edi - PlayPos
mov esp,[@@End] ; esi - Volume map
mov eax,[@@FirstPos]
inc eax
shl eax, 3
mov [FirstPos], eax
mov eax,[@@PrevPos]
inc eax
shl eax, 3
mov [PrevPos], eax
sub esp, eax
mov eax,[@@LastPos]
mov [LastPos], eax
IF MODE EQ UNSIGNED
movzx eax, [BYTE eax]
sub eax, 80h
ELSEIF MODE EQ SIGNED
movsx eax, [BYTE eax]
ELSE
movsx eax, [WORD eax]
ENDIF
mov [LastVal], eax
mov esi,edx ; Put MCur into esp
mov eax, [VolTable]
mov ebp, eax
mov [StoreEnd], esp
mov eax, [FirstPos]
add eax, esi
cmp esp, eax
jbe @@Top2
;;int 3
;;Pass 1, everything from the beginning of mixing to the first source change
mov esp, [FirstPos]
add esp, esi
@@Top1:
cmp esi, esp
jae @@End1
IF MODE EQ UNSIGNED
movzx ebx, [BYTE edi]
sub ebx, 80h
ELSEIF MODE EQ SIGNED
movsx ebx, [BYTE edi]
ELSE
movsx ebx, [WORD edi]
ENDIF
mov edx, ebx
imul ebx, [ebp-8-8*2]
imul edx, [ebp-4-8*2]
mov [FromL], ebx
mov [FromR], edx
; cmp edi, [LastPos]
; jne @@GetByte
; mov ebx, [LastVal]
; jmp @@GotByte
;@@GetByte:
IF DIRECTION EQ FORWARD
IF MODE EQ UNSIGNED
movzx ebx, [BYTE edi+1]
sub ebx, 80h
ELSEIF MODE EQ SIGNED
movsx ebx, [BYTE edi+1]
ELSE
movsx ebx, [WORD edi+2]
ENDIF
ELSE
IF MODE EQ UNSIGNED
movzx ebx, [BYTE edi-1]
sub ebx, 80h
ELSEIF MODE EQ SIGNED
movsx ebx, [BYTE edi-1]
ELSE
movsx ebx, [WORD edi-2]
ENDIF
ENDIF
;@@GotByte:
mov eax, ebx
mov edx, ecx
imul eax, [ebp-8]
shr edx, 17
imul ebx, [ebp-4]
sub eax, [FromL]
imul edx
shrd eax, edx, 15
mov edx, ecx
add [FromL], eax
shr edx, 17
mov eax, ebx
sub eax, [FromR]
imul edx
shrd eax, edx, 15
add eax, [FromR]
mov ebx, [FromL]
add [esi+4],eax ; Add right channel to buffer
add [esi],ebx ; Add Left channel to buffer
add esi, 8
IF MODE EQ _16BIT
xor eax, eax
add ecx,[Fraction] ; Add the lower portion of the fraction
setc al
mov ebx,[WholeIncr]
lea eax, [ebx+eax*2]
IF DIRECTION EQ FORWARD
add edi,eax ; Move play pos up 1
ELSE
sub edi,eax ; Move play pos up 1
ENDIF
ELSE
add ecx,[Fraction] ; Add the lower portion of the fraction
IF DIRECTION EQ FORWARD
adc edi,[WholeIncr] ; Move play pos up 1
ELSE
sbb edi,[WholeIncr] ; Move play pos up 1
ENDIF
ENDIF
jmp @@Top1
@@End1:
mov esp, [StoreEnd]
;;Pass 2, everything up to mixing from the last byte
@@Top2:
cmp esi,esp ; Check to see if the end was reached
jae @@End2
mov edx, ecx
IF MODE EQ UNSIGNED
movzx ebx, [BYTE edi]
ELSEIF MODE EQ SIGNED
movsx ebx, [BYTE edi]
ELSE
movsx ebx, [WORD edi]
ENDIF
IF DIRECTION EQ FORWARD
IF MODE EQ UNSIGNED
movzx eax, [BYTE edi+1]
ELSEIF MODE EQ SIGNED
movsx eax, [BYTE edi+1]
ELSE
movsx eax, [WORD edi+2]
ENDIF
ELSE
IF MODE EQ UNSIGNED
movzx eax, [BYTE edi-1]
ELSEIF MODE EQ SIGNED
movsx eax, [BYTE edi-1]
ELSE
movsx eax, [WORD edi-2]
ENDIF
ENDIF
shr edx, 17
sub eax, ebx
imul edx
IF MODE EQ _16BIT
sar eax, 15
add ebx, eax
ELSE
sar eax, 15-8
add bl, ah
ENDIF
IF MODE EQ SIGNED
and EBX, 000000FFh
ENDIF
IF MODE EQ _16BIT
mov edx, ebx
imul ebx, [ebp-8]
imul edx, [ebp-4]
ELSE
lea eax, [ebx*8+ebp]
mov ebx,[eax] ; Index volume table, Left
mov edx,[eax+4] ; Index volume table, Right
ENDIF
add [esi],ebx ; Add Left channel to buffer
add [esi+4],edx ; Add right channel to buffer
add esi, 8
IF MODE EQ _16BIT
xor eax, eax
add ecx,[Fraction] ; Add the lower portion of the fraction
setc al
mov ebx,[WholeIncr]
lea eax, [ebx+eax*2]
IF DIRECTION EQ FORWARD
add edi,eax ; Move play pos up 1
ELSE
sub edi,eax ; Move play pos up 1
ENDIF
ELSE
add ecx,[Fraction] ; Add the lower portion of the fraction
IF DIRECTION EQ FORWARD
adc edi,[WholeIncr] ; Move play pos up 1
ELSE
sbb edi,[WholeIncr] ; Move play pos up 1
ENDIF
ENDIF
jmp @@Top2
@@End2:
;;Pass 3, everything from mixing from the last byte to the end of mixing
add esp, [PrevPos]
@@Top3:
cmp esi, esp
jae @@End3
IF MODE EQ UNSIGNED
movzx ebx, [BYTE edi]
ELSEIF MODE EQ SIGNED
movzx ebx, [BYTE edi]
ELSE
movsx ebx, [WORD edi]
ENDIF
IF MODE EQ _16BIT
mov edx, ebx
imul ebx, [ebp-8]
imul edx, [ebp-4]
ELSE
lea eax, [ebx*8+ebp]
mov ebx,[eax] ; Index volume table, Left
mov edx,[eax+4] ; Index volume table, Right
ENDIF
mov [FromL], ebx
mov [FromR], edx
mov ebx, [LastVal]
mov eax, ebx
mov edx, ecx
imul eax, [ebp-8-8]
shr edx, 17
imul ebx, [ebp-4-8]
sub eax, [FromL]
imul edx
shrd eax, edx, 15
mov edx, ecx
add [FromL], eax
shr edx, 17
mov eax, ebx
sub eax, [FromR]
imul edx
shrd eax, edx, 15
add eax, [FromR]
mov ebx, [FromL]
add [esi+4],eax ; Add right channel to buffer
add [esi],ebx ; Add Left channel to buffer
add esi, 8
IF MODE EQ _16BIT
xor eax, eax
add ecx,[Fraction] ; Add the lower portion of the fraction
setc al
mov ebx,[WholeIncr]
lea eax, [ebx+eax*2]
IF DIRECTION EQ FORWARD
add edi,eax ; Move play pos up 1
ELSE
sub edi,eax ; Move play pos up 1
ENDIF
ELSE
add ecx,[Fraction] ; Add the lower portion of the fraction
IF DIRECTION EQ FORWARD
adc edi,[WholeIncr] ; Move play pos up 1
ELSE
sbb edi,[WholeIncr] ; Move play pos up 1
ENDIF
ENDIF
jmp @@Top3
@@End3:
; Restore the stack
mov esp,[StackSave]
; Restore the flags
pop ebp
popad
cld
ret
endp
ENDM
FORWARD = 1
BACKWARD = 2
UNSIGNED = 1
SIGNED = 2
_16BIT = 3
MODE = UNSIGNED
DIRECTION = FORWARD
MIXCODE
DIRECTION = BACKWARD
MIXCODE
MODE = SIGNED
DIRECTION = FORWARD
MIXCODE
DIRECTION = BACKWARD
MIXCODE
MODE = _16BIT
DIRECTION = FORWARD
MIXCODE
DIRECTION = BACKWARD
MIXCODE
end
|
programs/oeis/171/A171622.asm | karttu/loda | 1 | 105455 | ; A171622: Floor(n-th noncomposite / n).
; 1,1,1,1,1,1,1,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,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
cal $0,171626 ; Ceiling(n-th noncomposite/n).
trn $0,2
add $1,$0
add $1,1
|
test/test_list.applescript | darricktheprogrammer/Yaasl | 1 | 259 | <filename>test/test_list.applescript<gh_stars>1-10
property parent : script "ASUnit"
property suite : makeTestSuite("List")
set suite's loggers to {ConsoleLogger}
autorun(suite)
script BaseListTest
property parent : TestSet(me)
property listlib : missing value
property emptylist : missing value
property shortlist : missing value
property recordlist : missing value
property longlist : missing value
property NO_ERROR : "0: no error"
on setUp()
set emptylist to {}
set shortlist to {"a", "b", "c"}
set recordlist to {{a:1, b:2}, {c:3, d:4}}
set longlist to {"a", "b", "c", "d", "e", "f", "g"}
tell application "System Events"
set top_level to POSIX path of (container of container of (path to me)) & "/"
end tell
set listlib to load script (top_level & "list.scpt")
end setUp
end script
script ListToListManipulations
property parent : BaseListTest
script unique_ListWithDuplicates_ReturnsUniqueList
property parent : UnitTest(me)
set ls to my listlib's unique({1, 1, 2, 2, 3, 3})
assertEqual({1, 2, 3}, ls)
end script
script unique_ListWithoutDuplicates_ReturnsSameList
property parent : UnitTest(me)
set ls to my listlib's unique(my shortlist)
assertEqual(my shortlist, ls)
end script
script unique_EmptyList_ReturnsEmptyList
property parent : UnitTest(me)
set ls to my listlib's unique(my emptylist)
assertEqual(my emptylist, ls)
end script
script unique_RecordList_ThrowsError
property parent : UnitTest(me)
set badlist to my recordlist & my recordlist
try
set ls to my listlib's unique(badlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script unique_ListofLists_ThrowsError
property parent : UnitTest(me)
set badlist to my shortlist
set end of badlist to my shortlist
try
set ls to my listlib's unique(badlist)
set errnum to "0: no error"
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script insert_IntoFrontOfList_AddsItemToFrontOfList
property parent : UnitTest(me)
set ls to my listlib's insert("0", 1, my shortlist)
assertEqual({"0"} & my shortlist, ls)
end script
script insert_IntoBackOfList_AddsItemToBackOfList
property parent : UnitTest(me)
set ls to my listlib's insert("d", 4, my shortlist)
assertEqual(my shortlist & {"d"}, ls)
end script
script insert_IntoMiddleOfList_AddsItemToMiddleOfList
property parent : UnitTest(me)
set ls to my listlib's insert("z", 2, my shortlist)
assertEqual({"a", "z", "b", "c"}, ls)
end script
script insert_RecordAtEnd_InsertsRecord
property parent : UnitTest(me)
set ls to my listlib's insert({e:5, f:6}, 4, my shortlist)
assertEqual({"a", "b", "c", {e:5, f:6}}, ls)
end script
script insert_RecordAtBeginning_InsertsRecord
property parent : UnitTest(me)
set ls to my listlib's insert({e:5, f:6}, 1, my shortlist)
assertEqual({{e:5, f:6}, "a", "b", "c"}, ls)
end script
script insert_RecordInMiddle_InsertsRecord
property parent : UnitTest(me)
set ls to my listlib's insert({e:5, f:6}, 2, my shortlist)
assertEqual({"a", {e:5, f:6}, "b", "c"}, ls)
end script
script insert_GivenZeroIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's insert("0", 0, my shortlist)
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script insert_GivenOutOfBoundsIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's insert("d", 5, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script insert_GivenNegativeIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's insert("d", -1, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script insert_IntoEmptyList_CreatesOneItemLIst
property parent : UnitTest(me)
set ls to my listlib's insert("a", 1, my emptylist)
assertEqual({"a"}, ls)
end script
script popIndex_PopFirstItem_PopsFirstItem
property parent : UnitTest(me)
set ls to my listlib's pop_index(1, my shortlist)
assertEqual({"a", {"b", "c"}}, ls)
end script
script popIndex_PopLastItem_PopsLastItem
property parent : UnitTest(me)
set ls to my listlib's pop_index(3, my shortlist)
assertEqual({"c", {"a", "b"}}, ls)
end script
script popIndex_PopMiddleItem_PopsMiddleItem
property parent : UnitTest(me)
set ls to my listlib's pop_index(2, my shortlist)
assertEqual({"b", {"a", "c"}}, ls)
end script
script popIndex_EmptyList_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(1, my emptylist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script popIndex_GivenCountOfListPlusOneIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(4, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script popIndex_GivenOutOfBoundsIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(5, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script popIndex_GivenZeroIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(0, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script popIndex_GivenNegativeIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(-1, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script popIndex_GivenNotAList_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop_index(1, "A string")
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 704)
end script
script pop_GivenList_PopsLastItem
property parent : UnitTest(me)
set ls to my listlib's pop(my shortlist)
assertEqual({"c", {"a", "b"}}, ls)
end script
script pop_GivenNotAList_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop("A string")
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 704)
end script
script pop_EmptyList_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's pop(my emptylist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(errnum, 705)
end script
script remove_ItemInList_RemovesItem
property parent : UnitTest(me)
set ls to my listlib's remove("a", my shortlist)
assertEqual(rest of my shortlist, ls)
end script
script remove_ItemNotInList_ReturnsUnchangedList
property parent : UnitTest(me)
set ls to my listlib's remove("d", my shortlist)
assertEqual(my shortlist, ls)
end script
script remove_RecordItem_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's remove(item 1 of my recordlist, my recordlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script diff_DifferentLists_ReturnsDiff
property parent : UnitTest(me)
set ls to my listlib's diff(my longlist, my shortlist)
assertEqual({"d", "e", "f", "g"}, ls)
end script
script diff_SameList_ReturnsEmptyList
property parent : UnitTest(me)
set ls to my listlib's diff(my shortlist, my shortlist)
assertEqual({}, ls)
end script
script diff_NoOverlap_ReturnsOriginalList
property parent : UnitTest(me)
set ls to my listlib's diff(my shortlist, {})
assertEqual(my shortlist, ls)
end script
script diff_FirstListContainsRecord_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's diff(my recordlist, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script diff_SecondListContainsRecord_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's diff(my shortlist, my recordlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script intersect_DifferentLists_ReturnsIntersectingPortion
property parent : UnitTest(me)
set ls to my listlib's intersect(my longlist, my shortlist)
assertEqual({"a", "b", "c"}, ls)
end script
script intersect_SameList_ReturnsSameList
property parent : UnitTest(me)
set ls to my listlib's intersect(my shortlist, my shortlist)
assertEqual(my shortlist, ls)
end script
script intersect_NoOverlap_ReturnsEmptyList
property parent : UnitTest(me)
set ls to my listlib's intersect(my shortlist, {})
assertEqual({}, ls)
end script
script intersect_FirstListContainsRecord_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's intersect(my recordlist, my shortlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script intersect_SecondListContainsRecord_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's intersect(my shortlist, my recordlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script MoveItem_FromFrontToBack_MovesItem
property parent : UnitTest(me)
set ls to my listlib's move_item(my shortlist, 1, 3)
assertEqual({"b", "c", "a"}, ls)
end script
script MoveItem_ToSameSpot_ReturnsSameList
property parent : UnitTest(me)
set ls to my listlib's move_item(my shortlist, 2, 2)
assertEqual(my shortlist, ls)
end script
script MoveItem_ToBeginning_MovesItem
property parent : UnitTest(me)
set ls to my listlib's move_item(my shortlist, 2, 1)
assertEqual({"b", "a", "c"}, ls)
end script
script MoveItem_MoveRecord_MovesRecord
property parent : UnitTest(me)
set ls to my listlib's move_item(my recordlist, 1, 2)
assertEqual({{c:3, d:4}, {a:1, b:2}}, ls)
end script
script MoveItem_GivenNegativeIndexAsItemIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, -1, 3)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script MoveItem_GivenNegativeIndexAsTargetIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, 1, -1)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script MoveItem_GivenZeroAsOriginalIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, 0, 3)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script MoveItem_GivenZeroAsTargetIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, 1, 0)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script MoveItem_GivenOutOfBoundsOriginalIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, 4, 0)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script MoveItem_GivenOutOfBoundsTargetIndex_ThrowsError
property parent : UnitTest(me)
try
set ls to my listlib's move_item(my shortlist, 1, 4)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(705, errnum)
end script
script sort_OutOfOrderList_SortsList
property parent : UnitTest(me)
set ls to my listlib's sort({"c", "a", "b"})
assertEqual({"a", "b", "c"}, ls)
end script
end script
script ListInformation
property parent : BaseListTest
script indexOf_TextItem_ReturnsIndex
property parent : UnitTest(me)
set ix to my listlib's index_of("a", my shortlist)
assertEqual(1, ix)
end script
script indexOf_NumberItem_ReturnsIndex
property parent : UnitTest(me)
set ix to my listlib's index_of(1, {1, 2, 3})
assertEqual(1, ix)
end script
script indexOf_RecordItem_ThrowsError
property parent : UnitTest(me)
try
set ix to my listlib's index_of(item 1 of my recordlist, my recordlist)
set errnum to my NO_ERROR
on error number errnum
set errnum to errnum
end try
assertEqual(704, errnum)
end script
script indexOf_EmptyList_ReturnsZero
property parent : UnitTest(me)
set ix to my listlib's index_of("a", {})
assertEqual(0, ix)
end script
script indexOf_ItemNotInList_ReturnsZero
property parent : UnitTest(me)
set ix to my listlib's index_of("d", my shortlist)
assertEqual(0, ix)
end script
script indexOf_ItemInListMultipleTimes_ReturnsFirstOccurence
property parent : UnitTest(me)
set ls to my shortlist & my shortlist
set ix to my listlib's index_of("a", ls)
assertEqual(1, ix)
end script
script CountInstances_FoundOnce_Returns1
property parent : UnitTest(me)
set instanceCount to my listlib's count_instances("a", my shortlist)
assertEqual(1, instanceCount)
end script
script CountInstances_FoundTwice_Returns2
property parent : UnitTest(me)
set instanceCount to my listlib's count_instances("a", my shortlist & my shortlist)
assertEqual(2, instanceCount)
end script
script CountInstances_NotInList_Returns0
property parent : UnitTest(me)
set instanceCount to my listlib's count_instances("d", my shortlist)
assertEqual(0, instanceCount)
end script
script CountInstances_LookingForRecord_ReturnsCount
property parent : UnitTest(me)
set instanceCount to my listlib's count_instances({a:1, b:2}, my recordlist)
assertEqual(1, instanceCount)
end script
end script
script FunctionalRoutines
property parent : BaseListTest
script zipMany_ZeroItemList_ReturnsEmptyList
property parent : UnitTest(me)
set ls to my listlib's zip_many({})
assertEqual({}, ls)
end script
script zipMany_MixedClassLists_ZipsLists
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {"d", "e", "f"}
set l3 to {1, 2, 3}
set zipped to my listlib's zip_many({l1, l2, l3})
assertEqual({{"a", "d", 1}, {"b", "e", 2}, {"c", "f", 3}}, zipped)
end script
script zipMany_FirstListShorter_ZipsToShorterLength
property parent : UnitTest(me)
set l1 to {"a"}
set l2 to {"d", "e", "f"}
set l3 to {1, 2, 3}
set zipped to my listlib's zip_many({l1, l2, l3})
assertEqual({{"a", "d", 1}}, zipped)
end script
script zipMany_OtherListShorter_ZipsToShorterLength
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {"d", "e", "f"}
set l3 to {1}
set zipped to my listlib's zip_many({l1, l2, l3})
assertEqual({{"a", "d", 1}}, zipped)
end script
script zipMany_GivenRecord_ZipsLists
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {{a:1}, {b:2}, {c:3}}
set l3 to {1, 2, 3}
set zipped to my listlib's zip_many({l1, l2, l3})
assertEqual({{"a", {a:1}, 1}, {"b", {b:2}, 2}, {"c", {c:3}, 3}}, zipped)
end script
script zip_ZeroItemList_ReturnsEmptyList
property parent : UnitTest(me)
set ls to my listlib's zip({}, {})
assertEqual({}, ls)
end script
script zip_MixedClassLists_ZipsLists
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {1, 2, 3}
set zipped to my listlib's zip(l1, l2)
assertEqual({{"a", 1}, {"b", 2}, {"c", 3}}, zipped)
end script
script zip_FirstListShorter_ZipsToShorterLength
property parent : UnitTest(me)
set l1 to {"a"}
set l2 to {1, 2, 3}
set zipped to my listlib's zip(l1, l2)
assertEqual({{"a", 1}}, zipped)
end script
script zip_OtherListShorter_ZipsToShorterLength
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {1}
set zipped to my listlib's zip(l1, l2)
assertEqual({{"a", 1}}, zipped)
end script
script zip_GivenRecord_ZipsLists
property parent : UnitTest(me)
set l1 to {"a", "b", "c"}
set l2 to {{a:1}, {b:2}, {c:3}}
set zipped to my listlib's zip(l1, l2)
assertEqual({{"a", {a:1}}, {"b", {b:2}}, {"c", {c:3}}}, zipped)
end script
end script
|
programs/oeis/325/A325473.asm | neoneye/loda | 22 | 176204 | <reponame>neoneye/loda
; A325473: Number of compositions of n with no part divisible by 3 and an even number of parts congruent to 4 or 5 modulo 6.
; 1,1,2,3,5,8,13,22,38,67,120,217,395,722,1323,2428,4460,8197,15070,27711,50961,93724,172377,317042,583122,1072519,1972660,3628277,6673431,12274342,22576023,41523768,76374104,140473865,258371706,475219643,874065181,1607656496
lpb $0
sub $0,2
mov $2,$0
max $2,0
seq $2,288599 ; a(n) = 2*a(n-1) - a(n-4) for n >= 4, where a(0) = 2, a(1) = 4, a(2) = 6, a(3) = 10, a(4) = 16.
add $1,$2
lpe
div $1,2
add $1,1
mov $0,$1
|
oeis/000/A000453.asm | neoneye/loda-programs | 11 | 105285 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A000453: Stirling numbers of the second kind, S(n,4).
; 1,10,65,350,1701,7770,34105,145750,611501,2532530,10391745,42355950,171798901,694337290,2798806985,11259666950,45232115901,181509070050,727778623825,2916342574750,11681056634501,46771289738810,187226356946265,749329038535350,2998587019946701,11998160744311570,48004081105038305,192050639071964750,768305500780164501,3073530837671316330,12295049856484723945,49182978947632238950,196740254364198919901,786986033194985441090,3148019180028870787185,12592301861930989693950,50369882873307917364901
add $0,3
mov $1,4
pow $1,$0
seq $0,210448 ; Total number of different letters summed over all ternary words of length n.
sub $1,$0
div $1,6
mov $0,$1
|
src/Double-negation.agda | nad/equality | 3 | 3389 | ------------------------------------------------------------------------
-- The double-negation monad
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Double-negation
{reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where
open import Logical-equivalence using (_⇔_)
open import Prelude
open import Bijection eq using (_↔_)
open Derived-definitions-and-properties eq
open import Equivalence eq hiding (id; _∘_)
open import Excluded-middle eq
open import H-level eq
open import H-level.Closure eq
open import Monad eq
-- The double-negation monad, defined using a wrapper type to make
-- instance resolution easier.
infix 3 ¬¬_
record ¬¬_ {a} (A : Type a) : Type a where
constructor wrap
field
run : ¬ ¬ A
open ¬¬_ public
-- An extra universe-polymorphic variant of map.
map′ :
∀ {a b} {@0 A : Type a} {@0 B : Type b} →
(A → B) → ¬¬ A → ¬¬ B
run (map′ f ¬¬a) = λ ¬b → run ¬¬a (λ a → ¬b (f a))
-- Instances.
instance
double-negation-monad : ∀ {ℓ} → Raw-monad (λ (A : Type ℓ) → ¬¬ A)
run (Raw-monad.return double-negation-monad x) = _$ x
run (Raw-monad._>>=_ double-negation-monad x f) =
join (map′ (run ∘ f) x)
where
join : ∀ {a} {A : Type a} → ¬¬ ¬ A → ¬ A
join ¬¬¬a = λ a → run ¬¬¬a (λ ¬a → ¬a a)
private
proof-irrelevant : ∀ {a} {A : Type a} {x y : ¬¬ A} →
Extensionality a lzero → x ≡ y
proof-irrelevant ext =
cong wrap $ apply-ext ext λ _ → ⊥-propositional _ _
monad : ∀ {ℓ} →
Extensionality ℓ lzero →
Monad (λ (A : Type ℓ) → ¬¬ A)
Monad.raw-monad (monad _) = double-negation-monad
Monad.left-identity (monad ext) _ _ = proof-irrelevant ext
Monad.right-identity (monad ext) _ = proof-irrelevant ext
Monad.associativity (monad ext) _ _ _ = proof-irrelevant ext
-- The following variant of excluded middle is provable.
excluded-middle : ∀ {a} {@0 A : Type a} → ¬¬ Dec A
run excluded-middle ¬[a⊎¬a] = ¬[a⊎¬a] (no λ a → ¬[a⊎¬a] (yes a))
-- The following variant of Peirce's law is provable.
call/cc : ∀ {a w} {@0 A : Type a} {Whatever : Type w} →
((A → Whatever) → ¬¬ A) → ¬¬ A
run (call/cc hyp) ¬a = run (hyp (λ a → ⊥-elim (¬a a))) ¬a
-- If one can prove that the empty type is inhabited in the
-- double-negation monad, then the empty type is inhabited.
¬¬¬⊥ : ∀ {ℓ} → ¬ (¬¬ (⊥ {ℓ = ℓ}))
¬¬¬⊥ ¬¬⊥ = run ¬¬⊥ ⊥-elim
-- If the double-negation of a negation can be proved, then the
-- negation itself can be proved.
¬¬¬→¬ : ∀ {a} {A : Type a} → ¬¬ ¬ A → ¬ A
¬¬¬→¬ ¬¬¬a = λ a → ¬¬¬⊥ (¬¬¬a >>= λ ¬a → ⊥-elim (¬a a))
------------------------------------------------------------------------
-- Excluded middle and double-negation elimination
-- Double-negation elimination (roughly as stated in the HoTT book).
Double-negation-elimination : (ℓ : Level) → Type (lsuc ℓ)
Double-negation-elimination p =
{P : Type p} → Is-proposition P → ¬¬ P → P
-- Double-negation elimination is propositional (assuming
-- extensionality).
Double-negation-elimination-propositional :
∀ {ℓ} →
Extensionality (lsuc ℓ) ℓ →
Is-proposition (Double-negation-elimination ℓ)
Double-negation-elimination-propositional ext =
implicit-Π-closure ext 1 λ _ →
Π-closure (lower-extensionality _ lzero ext) 1 λ P-prop →
Π-closure (lower-extensionality _ lzero ext) 1 λ _ →
P-prop
-- Excluded middle implies double-negation elimination.
Excluded-middle→Double-negation-elimination :
∀ {ℓ} → Excluded-middle ℓ → Double-negation-elimination ℓ
Excluded-middle→Double-negation-elimination em P-prop ¬¬p =
[ id , ⊥-elim ∘ run ¬¬p ] (em P-prop)
-- Excluded middle is pointwise equivalent to double-negation
-- elimination (assuming extensionality).
Excluded-middle≃Double-negation-elimination :
∀ {ℓ} →
Extensionality (lsuc ℓ) (lsuc ℓ) →
Excluded-middle ℓ ≃ Double-negation-elimination ℓ
Excluded-middle≃Double-negation-elimination ext =
_↔_.to (⇔↔≃ ext
(Excluded-middle-propositional
(lower-extensionality lzero _ ext))
(Double-negation-elimination-propositional
(lower-extensionality lzero _ ext)))
(record
{ to = Excluded-middle→Double-negation-elimination
; from = λ dne P-prop →
dne (Dec-closure-propositional
(lower-extensionality _ _ ext) P-prop)
excluded-middle
})
|
wof/lcs/enemy/AA.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 20864 | copyright zengfr site:http://github.com/zengfr/romhack
001590 lea ($20,A0), A0
003D4C move.w (A1)+, ($a8,A0) [enemy+AA]
003DC2 move.w (A2)+, ($a8,A0) [enemy+AA]
003EB4 sub.w ($aa,A0), D0 [enemy+AF]
003EB8 bgt $3eac [enemy+AA]
0122A0 move.l (A2)+, (A3)+ [enemy+A4, enemy+A6]
0122A2 move.l (A2)+, (A3)+ [enemy+A8, enemy+AA]
01A75E dbra D4, $1a75c
copyright zengfr site:http://github.com/zengfr/romhack
|
audio/music/cities1.asm | opiter09/ASM-Machina | 1 | 20771 | Music_Cities1_branch_aa6f::
tempo 232
sound_loop 0, Music_Cities1_branch_aa79
Music_Cities1_Ch1::
tempo 144
Music_Cities1_branch_aa79::
volume 7, 7
vibrato 8, 2, 4
duty_cycle 3
Music_Cities1_branch_aa80::
note_type 12, 12, 5
octave 3
note G#, 4
note F#, 4
note E_, 2
note E_, 2
note F#, 2
note D#, 2
note E_, 2
note E_, 2
note D#, 2
note C#, 4
note D#, 4
note E_, 2
note D#, 4
note C#, 2
note E_, 2
note E_, 4
note_type 12, 10, 5
note C#, 4
octave 2
note B_, 6
octave 3
note C#, 2
note C#, 4
octave 2
note B_, 4
note_type 12, 12, 5
sound_call Music_Cities1_branch_ab7d
octave 3
note D#, 6
note E_, 2
octave 2
note B_, 4
note_type 12, 10, 5
octave 3
note C#, 2
octave 2
note B_, 2
note A_, 4
note B_, 4
note B_, 2
octave 3
note C#, 2
note D#, 2
note E_, 2
note D#, 2
note C#, 2
note D#, 2
note_type 12, 12, 5
note G#, 2
note E_, 2
note F#, 2
note E_, 2
note E_, 4
note F#, 2
note D#, 2
note E_, 4
note D#, 2
note C#, 4
note D#, 4
note E_, 2
note D#, 2
note C#, 2
note C#, 2
note E_, 2
note E_, 4
note_type 12, 10, 5
note C#, 2
octave 2
note A_, 2
note B_, 6
octave 3
note C#, 2
note C#, 2
octave 2
note B_, 2
note B_, 4
note_type 12, 12, 5
sound_call Music_Cities1_branch_ab7d
octave 3
note D#, 4
note D#, 2
note E_, 2
octave 2
note B_, 2
octave 3
note C#, 2
note G#, 2
note E_, 4
octave 2
note B_, 2
octave 3
note E_, 2
note_type 12, 10, 5
note C#, 4
octave 2
note B_, 2
octave 3
note D#, 4
note C#, 2
note E_, 4
note_type 12, 11, 3
sound_call Music_Cities1_branch_ab8a
note A_, 2
note B_, 2
note A_, 2
note G#, 2
note A_, 4
note F#, 4
note G#, 2
note E_, 2
octave 2
note B_, 2
octave 3
note E_, 4
note G#, 2
octave 2
note B_, 2
octave 3
note E_, 2
note E_, 2
note F#, 2
note E_, 2
note D#, 2
note E_, 2
note D#, 2
note C#, 2
octave 2
note B_, 2
octave 3
Music_Cities1_branch_ab12::
note C#, 2
note D#, 2
note C#, 2
octave 2
note B_, 4
note B_, 2
octave 3
note C#, 2
note D#, 2
sound_loop 2, Music_Cities1_branch_ab12
note E_, 2
octave 2
note B_, 4
octave 3
note E_, 4
octave 2
note B_, 2
octave 3
note C#, 2
note G#, 2
note G#, 2
octave 2
note B_, 2
octave 3
note F#, 2
octave 2
note B_, 2
octave 3
note E_, 2
octave 2
note B_, 2
octave 3
note D#, 2
octave 2
note B_, 2
octave 3
sound_call Music_Cities1_branch_ab8a
note A_, 2
note E_, 2
note A_, 2
note B_, 2
note A_, 2
note G#, 2
note A_, 2
note F#, 2
note G#, 2
note E_, 2
octave 2
note B_, 2
octave 3
note E_, 2
note C#, 2
note G#, 2
note C#, 2
note D#, 2
note B_, 2
note E_, 2
note G#, 2
note E_, 2
note F#, 2
note E_, 4
note G#, 2
note F#, 2
note D#, 2
octave 2
note B_, 2
octave 3
note D#, 4
note F#, 2
note D#, 2
note D#, 2
note F#, 2
octave 2
note B_, 2
octave 3
note E_, 2
octave 2
note B_, 2
octave 3
note D#, 2
octave 2
note B_, 2
note B_, 2
octave 3
note D#, 2
note_type 12, 11, 6
note F#, 8
note F#, 4
note D#, 4
note E_, 8
note_type 12, 8, 4
octave 2
note B_, 4
octave 3
note E_, 2
note F#, 2
sound_loop 0, Music_Cities1_branch_aa80
Music_Cities1_branch_ab7d::
octave 3
note F#, 2
note D#, 4
note E_, 2
note D#, 4
note C#, 4
octave 2
note B_, 4
octave 3
note C#, 2
note D#, 2
note C#, 2
sound_ret
Music_Cities1_branch_ab8a::
note A_, 2
note E_, 2
note C#, 2
note E_, 4
note A_, 2
note C#, 2
note E_, 2
sound_ret
Music_Cities1_Ch2::
vibrato 5, 1, 5
sound_call Music_Cities1_branch_ac00
octave 4
note G#, 2
note_type 12, 12, 4
note E_, 6
note_type 12, 12, 5
duty_cycle 3
octave 3
note C#, 4
note D#, 4
note E_, 6
note F#, 6
note G#, 4
sound_call Music_Cities1_branch_ac00
octave 4
note G#, 2
note_type 12, 12, 4
note E_, 14
duty_cycle 3
octave 3
note E_, 6
note F#, 6
note G#, 4
note_type 12, 11, 7
duty_cycle 2
vibrato 8, 1, 7
octave 5
note C#, 12
octave 4
note A_, 4
octave 5
note E_, 8
note F#, 2
note E_, 2
note D#, 2
note C#, 2
octave 4
note B_, 12
note G#, 4
note B_, 16
note F#, 12
note G#, 2
note A_, 2
note B_, 4
note A_, 4
note G#, 4
note F#, 4
note G#, 12
note E_, 4
note B_, 16
octave 5
note C#, 12
note D#, 2
note E_, 2
note F#, 4
note E_, 4
note D#, 4
note C#, 4
octave 4
note B_, 12
octave 5
note C#, 2
note D#, 2
note C#, 4
octave 4
note B_, 4
note A_, 4
note G#, 4
note A_, 12
note B_, 2
octave 5
note C_, 2
note C_, 4
octave 4
note B_, 4
note A_, 4
note F#, 4
note_type 12, 11, 7
note A_, 8
octave 5
note C_, 8
octave 4
note B_, 14
note_type 12, 8, 4
note G#, 1
note_type 12, 10, 4
note A_, 1
sound_loop 0, Music_Cities1_Ch2
Music_Cities1_branch_ac00::
duty_cycle 2
note_type 12, 12, 3
octave 4
note B_, 4
note A_, 4
note_type 12, 12, 4
note G#, 10
note_type 12, 12, 3
note G#, 2
note A_, 2
note B_, 4
note B_, 2
note A_, 2
note G#, 2
note A_, 2
note_type 12, 12, 4
note F#, 10
note_type 12, 12, 5
duty_cycle 3
octave 3
note E_, 4
note D#, 8
note E_, 4
note F#, 4
note_type 12, 12, 3
duty_cycle 2
octave 4
note A_, 4
note G#, 4
note_type 12, 12, 4
note F#, 10
note_type 12, 12, 3
note F#, 2
note G#, 2
note A_, 4
note A_, 2
note G#, 2
note F#, 2
sound_ret
Music_Cities1_Ch3::
note_type 12, 1, 1
toggle_perfect_pitch
Music_Cities1_branch_ac35::
vibrato 0, 0, 0
octave 4
sound_call Music_Cities1_branch_acc5
sound_call Music_Cities1_branch_acc5
sound_call Music_Cities1_branch_acce
note G#, 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
sound_call Music_Cities1_branch_acc5
note B_, 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
sound_call Music_Cities1_branch_acc5
sound_call Music_Cities1_branch_acce
note G#, 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note G#, 2
note E_, 2
note B_, 2
rest 2
note E_, 2
note F#, 2
note E_, 2
note G#, 2
note E_, 2
note B_, 2
note E_, 2
vibrato 8, 2, 5
note A_, 8
note E_, 8
note A_, 8
note F#, 8
note G#, 8
note E_, 8
note G#, 12
note E_, 4
note F#, 2
note F#, 2
note D#, 2
note E_, 4
note F#, 2
note D#, 2
note E_, 2
note F#, 2
note F#, 2
note B_, 2
note A_, 2
note G#, 2
note A_, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note E_, 2
note G#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
note B_, 2
note A_, 2
note G#, 2
note F#, 2
note A_, 8
note E_, 8
note A_, 8
note B_, 2
note A_, 2
note G#, 2
note F#, 2
note G#, 8
note E_, 8
note B_, 4
note E_, 4
note F#, 4
note G#, 4
rest 2
note D#, 2
note E_, 2
note F#, 2
rest 2
note F#, 2
note B_, 2
note A_, 2
note A_, 4
note G#, 4
note F#, 2
note D#, 2
note A_, 2
note F#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note E_, 2
note F#, 1
note G#, 1
note E_, 1
note F#, 1
note G#, 4
note B_, 2
note A_, 2
note G#, 2
note A_, 2
note G#, 2
note F#, 2
sound_loop 0, Music_Cities1_branch_ac35
Music_Cities1_branch_acc5::
rest 2
note E_, 2
note F#, 2
note G#, 2
rest 2
note E_, 2
note F#, 2
note G#, 2
sound_ret
Music_Cities1_branch_acce::
note A_, 2
note F#, 2
note G#, 2
note A_, 2
rest 2
note A_, 2
note G#, 2
note F#, 2
rest 2
note F#, 2
note G#, 2
note A_, 2
rest 2
note A_, 2
note G#, 2
note F#, 2
note D#, 2
note D#, 2
note E_, 2
note F#, 2
rest 2
note D#, 2
note E_, 2
note F#, 2
rest 2
note D#, 2
note E_, 2
note F#, 2
rest 2
note D#, 2
note E_, 2
note F#, 2
sound_ret
Music_Cities1_Ch4::
drum_speed 12
sound_call Music_Cities1_branch_ad36
Music_Cities1_branch_acf3::
sound_call Music_Cities1_branch_ad36
sound_call Music_Cities1_branch_ad45
sound_call Music_Cities1_branch_ad45
sound_loop 2, Music_Cities1_branch_acf3
sound_call Music_Cities1_branch_ad36
sound_call Music_Cities1_branch_ad5f
sound_call Music_Cities1_branch_ad52
drum_note 6, 6
drum_note 6, 6
drum_note 7, 4
sound_call Music_Cities1_branch_ad6e
sound_call Music_Cities1_branch_ad5f
sound_call Music_Cities1_branch_ad52
sound_call Music_Cities1_branch_ad6e
sound_call Music_Cities1_branch_ad52
drum_note 6, 6
drum_note 6, 6
drum_note 7, 2
drum_note 6, 2
drum_note 6, 6
drum_note 6, 6
drum_note 6, 4
drum_note 6, 6
drum_note 8, 6
drum_note 8, 4
sound_loop 0, Music_Cities1_Ch4
Music_Cities1_branch_ad36::
drum_note 8, 6
drum_note 8, 6
drum_note 8, 4
drum_note 8, 6
drum_note 8, 6
drum_note 8, 2
drum_note 8, 2
sound_ret
Music_Cities1_branch_ad45::
drum_note 8, 6
drum_note 8, 6
drum_note 8, 4
drum_note 8, 6
drum_note 8, 6
drum_note 8, 4
sound_ret
Music_Cities1_branch_ad52::
drum_note 6, 6
drum_note 6, 6
drum_note 7, 4
drum_note 6, 6
drum_note 6, 6
drum_note 7, 4
sound_ret
Music_Cities1_branch_ad5f::
drum_note 6, 6
drum_note 6, 6
drum_note 7, 4
drum_note 6, 6
drum_note 6, 6
drum_note 7, 2
drum_note 6, 2
sound_ret
Music_Cities1_branch_ad6e::
drum_note 6, 6
drum_note 6, 6
drum_note 7, 2
drum_note 7, 2
sound_ret
|
Contractive/Stream.agda | nad/codata | 1 | 2393 | <reponame>nad/codata
------------------------------------------------------------------------
-- Instantiation of Contractive for streams
------------------------------------------------------------------------
-- Taken from the paper.
-- The definition of Eq has been changed slightly, as compared to the
-- paper. The paper uses
-- Eq = λ n xs ys → take n xs ≡ take n ys.
-- The reason for the change is that with the definition above
-- coherence does not say anything about the first element in limU s.
-- With the definition in the paper head (s 0), which is the first
-- element in limU s, does not have to be related to head (s n) for
-- any other n, and this makes it impossible to prove isLimitU.
-- (Unless I have missed something.)
module Contractive.Stream {A : Set} where
open import Codata.Musical.Notation
open import Codata.Musical.Stream
open import Contractive
open import Data.Nat
open import Data.Nat.Induction
open import Data.Nat.Properties
import Data.Vec as Vec
open Vec using (_∷_; [])
open import Function
open import Relation.Unary
open import Relation.Binary.PropositionalEquality
<′-isWellFoundedOrder : IsWellFoundedOrder _<′_
<′-isWellFoundedOrder = record
{ trans = λ {i} {j} {k} i+1≤j j+1≤k → ≤⇒≤′ (begin
suc i ≤⟨ ≤′⇒≤ (≤′-step i+1≤j) ⟩
suc j ≤⟨ ≤′⇒≤ j+1≤k ⟩
k ∎)
; isWellFounded = <′-wellFounded
}
where open ≤-Reasoning
ofe : OFE
ofe = record
{ Carrier = ℕ
; Domain = Stream A
; _<_ = _<′_
; isWellFoundedOrder = <′-isWellFoundedOrder
; Eq = λ n xs ys → take (suc n) xs ≡ take (suc n) ys
; isEquivalence = λ _ → record
{ refl = refl
; sym = sym
; trans = trans
}
}
open OFE ofe
private
limU : (ℕ → Stream A) → Stream A
limU s = head (s 0) ∷ ♯ limU (tail ∘ s ∘ suc)
η : ∀ {n} {xs : Stream A} → Eq n xs (head xs ∷ ♯ tail xs)
η {xs = x ∷ xs} = refl
step : ∀ s →
IsCoherent {U} (lift s) →
IsCoherent {U} (lift (tail ∘ s ∘ suc))
step s coh {m} {n} _ _ m<n = begin
take (suc m) (tail (s (suc m))) ≡⟨ lem (s (suc m)) ⟩
Vec.tail (take (2 + m) (s (1 + m))) ≡⟨ cong Vec.tail $ coh {1 + m} {1 + n} _ _ (s≤′s m<n) ⟩
Vec.tail (take (2 + m) (s (1 + n))) ≡⟨ sym $ lem (s (suc n)) ⟩
take (suc m) (tail (s (suc n))) ∎
where
open ≡-Reasoning
lem : ∀ {n} (xs : Stream A) →
take n (tail xs) ≡ Vec.tail (take (1 + n) xs)
lem (x ∷ xs) = refl
isLimitU : ∀ s →
IsCoherent {U} (lift s) →
IsLimit {U} (lift s) (limU s)
isLimitU s coh {zero} _ = begin
take 1 (s 0) ≡⟨ η ⟩
head (s 0) ∷ [] ∎
where open ≡-Reasoning
isLimitU s coh {suc n} _ = begin
take (2 + n) (s (1 + n)) ≡⟨ η ⟩
head (s (1 + n)) ∷ take (1 + n) ((tail ∘ s ∘ suc) n) ≡⟨ cong₂ _∷_ lem₁ (isLimitU (tail ∘ s ∘ suc)
(step s coh) {n} _) ⟩
head (s 0) ∷ take (1 + n) (limU (tail ∘ s ∘ suc)) ∎
where
open ≡-Reasoning
lem₂ : ∀ {n} (xs ys : Stream A) →
Eq n xs ys → head xs ≡ head ys
lem₂ (x ∷ xs) (y ∷ ys) = cong Vec.head
lem₁ : head (s (1 + n)) ≡ head (s 0)
lem₁ = lem₂ _ _ $ sym $ coh {0} {suc n} _ _ (s≤′s z≤′n)
lim↓ : A → ∀ n → (∀ n' → n' <′ n → Stream A) → Stream A
lim↓ x zero s = repeat x
lim↓ x (suc n) s = s n ≤′-refl
isLimit↓ : ∀ x n (s : Family (↓ n)) →
IsCoherent s → IsLimit s (lim↓ x n s)
isLimit↓ x zero s coh ()
isLimit↓ x (suc n) s coh ≤′-refl = refl
isLimit↓ x (suc n) s coh (≤′-step m<n) =
coh (≤′-step m<n) ≤′-refl m<n
-- The paper implicitly assumes that A is non-empty.
cofe : A → COFE
cofe x = record
{ ofe = ofe
; limU = limU
; isLimitU = isLimitU _
; lim↓ = lim↓ x
; isLimit↓ = λ n {s} → isLimit↓ x n s
}
|
src/Ada/collatz/col.adb | vonNiklasson/KTH-programming-benchmark | 0 | 206 | <gh_stars>0
with Gnat.Io; use Gnat.Io;
procedure col is
function collatz(n1: Integer) return Integer is
c: Integer;
n: Integer;
begin
n := n1;
c := 0;
while n /= 1 loop
if n mod 2 = 0 then
n := n / 2;
else
n := n * 3 + 1;
end if;
c := c + 1;
end loop;
return c;
end;
f: Integer;
begin
f := 0;
for j in Integer range 1 .. 100 loop
for i in Integer range 1 .. 100000 loop
f := f + collatz(i);
end loop;
end loop;
Put(f);
New_Line;
end col;
|
ANTLRTestProjects/antbased/LexerRules/build/classes/TokenDeclarations.g4 | timboudreau/ANTLR4-Plugins-for-NetBeans | 1 | 2742 | lexer grammar TokenDeclarations;
tokens { EOF1 }
ID1 : [a-z]; // match identifiers
ID2 : [0-9]+; // match integers
ID3 : [A-Z]*;
ID4 : ~[A-Z]*?;
NEWLINE:'\r'? '\n'; // return newlines to parser
EOF2 : EOF; // EOF is a reserved token id |
vpx_dsp/x86/sad_ssse3.asm | prometheansacrifice/esy-vpx | 2,151 | 7688 | ;
; Copyright (c) 2010 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.
;
%include "vpx_ports/x86_abi_support.asm"
%macro PROCESS_16X2X3 1
%if %1
movdqa xmm0, XMMWORD PTR [rsi]
lddqu xmm5, XMMWORD PTR [rdi]
lddqu xmm6, XMMWORD PTR [rdi+1]
lddqu xmm7, XMMWORD PTR [rdi+2]
psadbw xmm5, xmm0
psadbw xmm6, xmm0
psadbw xmm7, xmm0
%else
movdqa xmm0, XMMWORD PTR [rsi]
lddqu xmm1, XMMWORD PTR [rdi]
lddqu xmm2, XMMWORD PTR [rdi+1]
lddqu xmm3, XMMWORD PTR [rdi+2]
psadbw xmm1, xmm0
psadbw xmm2, xmm0
psadbw xmm3, xmm0
paddw xmm5, xmm1
paddw xmm6, xmm2
paddw xmm7, xmm3
%endif
movdqa xmm0, XMMWORD PTR [rsi+rax]
lddqu xmm1, XMMWORD PTR [rdi+rdx]
lddqu xmm2, XMMWORD PTR [rdi+rdx+1]
lddqu xmm3, XMMWORD PTR [rdi+rdx+2]
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rdx*2]
psadbw xmm1, xmm0
psadbw xmm2, xmm0
psadbw xmm3, xmm0
paddw xmm5, xmm1
paddw xmm6, xmm2
paddw xmm7, xmm3
%endmacro
%macro PROCESS_16X2X3_OFFSET 2
%if %1
movdqa xmm0, XMMWORD PTR [rsi]
movdqa xmm4, XMMWORD PTR [rdi]
movdqa xmm7, XMMWORD PTR [rdi+16]
movdqa xmm5, xmm7
palignr xmm5, xmm4, %2
movdqa xmm6, xmm7
palignr xmm6, xmm4, (%2+1)
palignr xmm7, xmm4, (%2+2)
psadbw xmm5, xmm0
psadbw xmm6, xmm0
psadbw xmm7, xmm0
%else
movdqa xmm0, XMMWORD PTR [rsi]
movdqa xmm4, XMMWORD PTR [rdi]
movdqa xmm3, XMMWORD PTR [rdi+16]
movdqa xmm1, xmm3
palignr xmm1, xmm4, %2
movdqa xmm2, xmm3
palignr xmm2, xmm4, (%2+1)
palignr xmm3, xmm4, (%2+2)
psadbw xmm1, xmm0
psadbw xmm2, xmm0
psadbw xmm3, xmm0
paddw xmm5, xmm1
paddw xmm6, xmm2
paddw xmm7, xmm3
%endif
movdqa xmm0, XMMWORD PTR [rsi+rax]
movdqa xmm4, XMMWORD PTR [rdi+rdx]
movdqa xmm3, XMMWORD PTR [rdi+rdx+16]
movdqa xmm1, xmm3
palignr xmm1, xmm4, %2
movdqa xmm2, xmm3
palignr xmm2, xmm4, (%2+1)
palignr xmm3, xmm4, (%2+2)
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rdx*2]
psadbw xmm1, xmm0
psadbw xmm2, xmm0
psadbw xmm3, xmm0
paddw xmm5, xmm1
paddw xmm6, xmm2
paddw xmm7, xmm3
%endmacro
%macro PROCESS_16X16X3_OFFSET 2
%2_aligned_by_%1:
sub rdi, %1
PROCESS_16X2X3_OFFSET 1, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
jmp %2_store_off
%endmacro
%macro PROCESS_16X8X3_OFFSET 2
%2_aligned_by_%1:
sub rdi, %1
PROCESS_16X2X3_OFFSET 1, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
PROCESS_16X2X3_OFFSET 0, %1
jmp %2_store_off
%endmacro
SECTION .text
;void int vpx_sad16x16x3_ssse3(
; unsigned char *src_ptr,
; int src_stride,
; unsigned char *ref_ptr,
; int ref_stride,
; int *results)
global sym(vpx_sad16x16x3_ssse3) PRIVATE
sym(vpx_sad16x16x3_ssse3):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
SAVE_XMM 7
push rsi
push rdi
push rcx
; end prolog
mov rsi, arg(0) ;src_ptr
mov rdi, arg(2) ;ref_ptr
mov rdx, 0xf
and rdx, rdi
jmp .vpx_sad16x16x3_ssse3_skiptable
.vpx_sad16x16x3_ssse3_jumptable:
dd .vpx_sad16x16x3_ssse3_aligned_by_0 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_1 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_2 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_3 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_4 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_5 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_6 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_7 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_8 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_9 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_10 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_11 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_12 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_13 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_14 - .vpx_sad16x16x3_ssse3_do_jump
dd .vpx_sad16x16x3_ssse3_aligned_by_15 - .vpx_sad16x16x3_ssse3_do_jump
.vpx_sad16x16x3_ssse3_skiptable:
call .vpx_sad16x16x3_ssse3_do_jump
.vpx_sad16x16x3_ssse3_do_jump:
pop rcx ; get the address of do_jump
mov rax, .vpx_sad16x16x3_ssse3_jumptable - .vpx_sad16x16x3_ssse3_do_jump
add rax, rcx ; get the absolute address of vpx_sad16x16x3_ssse3_jumptable
movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
add rcx, rax
movsxd rax, dword ptr arg(1) ;src_stride
movsxd rdx, dword ptr arg(3) ;ref_stride
jmp rcx
PROCESS_16X16X3_OFFSET 0, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 1, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 2, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 3, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 4, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 5, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 6, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 7, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 8, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 9, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 10, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 11, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 12, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 13, .vpx_sad16x16x3_ssse3
PROCESS_16X16X3_OFFSET 14, .vpx_sad16x16x3_ssse3
.vpx_sad16x16x3_ssse3_aligned_by_15:
PROCESS_16X2X3 1
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
.vpx_sad16x16x3_ssse3_store_off:
mov rdi, arg(4) ;Results
movq xmm0, xmm5
psrldq xmm5, 8
paddw xmm0, xmm5
movd [rdi], xmm0
;-
movq xmm0, xmm6
psrldq xmm6, 8
paddw xmm0, xmm6
movd [rdi+4], xmm0
;-
movq xmm0, xmm7
psrldq xmm7, 8
paddw xmm0, xmm7
movd [rdi+8], xmm0
; begin epilog
pop rcx
pop rdi
pop rsi
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void int vpx_sad16x8x3_ssse3(
; unsigned char *src_ptr,
; int src_stride,
; unsigned char *ref_ptr,
; int ref_stride,
; int *results)
global sym(vpx_sad16x8x3_ssse3) PRIVATE
sym(vpx_sad16x8x3_ssse3):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
SAVE_XMM 7
push rsi
push rdi
push rcx
; end prolog
mov rsi, arg(0) ;src_ptr
mov rdi, arg(2) ;ref_ptr
mov rdx, 0xf
and rdx, rdi
jmp .vpx_sad16x8x3_ssse3_skiptable
.vpx_sad16x8x3_ssse3_jumptable:
dd .vpx_sad16x8x3_ssse3_aligned_by_0 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_1 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_2 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_3 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_4 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_5 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_6 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_7 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_8 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_9 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_10 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_11 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_12 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_13 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_14 - .vpx_sad16x8x3_ssse3_do_jump
dd .vpx_sad16x8x3_ssse3_aligned_by_15 - .vpx_sad16x8x3_ssse3_do_jump
.vpx_sad16x8x3_ssse3_skiptable:
call .vpx_sad16x8x3_ssse3_do_jump
.vpx_sad16x8x3_ssse3_do_jump:
pop rcx ; get the address of do_jump
mov rax, .vpx_sad16x8x3_ssse3_jumptable - .vpx_sad16x8x3_ssse3_do_jump
add rax, rcx ; get the absolute address of vpx_sad16x8x3_ssse3_jumptable
movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
add rcx, rax
movsxd rax, dword ptr arg(1) ;src_stride
movsxd rdx, dword ptr arg(3) ;ref_stride
jmp rcx
PROCESS_16X8X3_OFFSET 0, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 1, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 2, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 3, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 4, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 5, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 6, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 7, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 8, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 9, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 10, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 11, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 12, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 13, .vpx_sad16x8x3_ssse3
PROCESS_16X8X3_OFFSET 14, .vpx_sad16x8x3_ssse3
.vpx_sad16x8x3_ssse3_aligned_by_15:
PROCESS_16X2X3 1
PROCESS_16X2X3 0
PROCESS_16X2X3 0
PROCESS_16X2X3 0
.vpx_sad16x8x3_ssse3_store_off:
mov rdi, arg(4) ;Results
movq xmm0, xmm5
psrldq xmm5, 8
paddw xmm0, xmm5
movd [rdi], xmm0
;-
movq xmm0, xmm6
psrldq xmm6, 8
paddw xmm0, xmm6
movd [rdi+4], xmm0
;-
movq xmm0, xmm7
psrldq xmm7, 8
paddw xmm0, xmm7
movd [rdi+8], xmm0
; begin epilog
pop rcx
pop rdi
pop rsi
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
|
libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshc_saddr2px.asm | jpoikela/z88dk | 640 | 173679 | <gh_stars>100-1000
; ===============================================================
; May 2017
; ===============================================================
;
; uchar tshc_saddr2px(void *saddr)
;
; Pixel x coordinate corresponding to the leftmost pixel at
; of the screen address.
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshc_saddr2px
EXTERN asm_zx_saddr2px
defc asm_tshc_saddr2px = asm_zx_saddr2px
|
grammars/query/ElementSelector.g4 | aaronhuggins/js-edi | 7 | 7071 | grammar ElementSelector;
selector:
segmentTag
| elementSelector
| parentSegmentSelector
| hlPathSelector
| loopPathSelector
| elementValueSelector
| elementNotValueSelector
| elementContainsValueSelector
| elementSiblingSelector
| elementPrecedentSelector
| elementAdjacentSelector
;
// Element reference adjacent to selector.
elementAdjacentSelector:
(ElementReference | hlPathSelector | parentSegmentSelector | loopPathSelector)
'~'
(elementValueSelector | elementNotValueSelector | elementContainsValueSelector)
;
// Element reference precedent to selector.
elementPrecedentSelector:
(ElementReference | hlPathSelector | parentSegmentSelector | loopPathSelector)
'?'
(elementValueSelector | elementNotValueSelector | elementContainsValueSelector)
;
// Element reference which is a sibling to selector.
elementSiblingSelector:
(ElementReference | hlPathSelector | parentSegmentSelector | loopPathSelector)
':'
(elementValueSelector | elementNotValueSelector | elementContainsValueSelector)
;
// Element not value selector.
elementContainsValueSelector: ElementReference '*' ElementValue;
// Element not value selector.
elementNotValueSelector: ElementReference '!' ElementValue;
// Element value selector.
elementValueSelector: ElementReference ElementValue;
// Loop path selector.
loopPathSelector: SegmentID '^' SegmentID '-' (ElementReference | parentSegmentSelector);
// Element at HL path selector.
hlPathSelector: 'HL' ('+' AnyCharacter)+ '-' (ElementReference | parentSegmentSelector);
// Element at parent segment path selector.
parentSegmentSelector: (SegmentID '-')+ ElementReference;
// Element reference selector.
elementSelector: ElementReference;
// Segment tag selector.
segmentTag: SegmentID;
// Fragments for printable character detection.
fragment Number: '\u0030'..'\u0039';
fragment Letter: '\u0041'..'\u005A' | '\u0061'..'\u007A';
fragment Special: '\u0020'..'\u002F' | '\u003A'..'\u0040' | '\u005B'..'\u0060' | '\u007B'..'\u007E';
fragment AlphaNumeric: Number | Letter;
fragment SegmentID2: Letter AlphaNumeric;
fragment SegmentID3: Letter AlphaNumeric AlphaNumeric;
// Value identifier
ElementValue: '[' ['"] (AnyCharacter|ElementID|SegmentID|ElementReference)* ['"] ']';
// Element reference
ElementReference: SegmentID ElementID;
// Element identifier.
ElementID: Number Number;
// Segment identifier.
SegmentID: SegmentID2 | SegmentID3;
// Any single unicode character.
AnyCharacter: '\u0000'..'\uFFFF';
|
test/Succeed/Issue4735.agda | cruhland/agda | 1,989 | 6395 | <reponame>cruhland/agda
module _ where
open import Agda.Builtin.Nat renaming (Nat to Nombre)
open import Agda.Builtin.Equality
open import Agda.Builtin.String
open import Agda.Builtin.Reflection
check₁ : primShowQName (quote Nombre) ≡ "Agda.Builtin.Nat.Nat"
check₁ = refl
check₂ : primShowQName (quote Agda.Builtin.Nat.Nat) ≡ "Agda.Builtin.Nat.Nat"
check₂ = refl
|
src/main/antlr4/org/snomed/langauges/ecl/generated/parser/ECL.g4 | danka74/snomed-ecl-parser | 0 | 7680 | grammar ECL;
expressionconstraint : ws ( refinedexpressionconstraint | compoundexpressionconstraint | dottedexpressionconstraint | subexpressionconstraint ) ws;
refinedexpressionconstraint : subexpressionconstraint ws COLON ws eclrefinement;
compoundexpressionconstraint : conjunctionexpressionconstraint | disjunctionexpressionconstraint | exclusionexpressionconstraint;
conjunctionexpressionconstraint : subexpressionconstraint (ws conjunction ws subexpressionconstraint)+;
disjunctionexpressionconstraint : subexpressionconstraint (ws disjunction ws subexpressionconstraint)+;
exclusionexpressionconstraint : subexpressionconstraint ws exclusion ws subexpressionconstraint;
dottedexpressionconstraint : subexpressionconstraint (ws dottedexpressionattribute)+;
dottedexpressionattribute : dot ws eclattributename;
subexpressionconstraint : (constraintoperator ws)? (memberof ws)? (eclfocusconcept | (LEFT_PAREN ws expressionconstraint ws RIGHT_PAREN)) (ws filterconstraint)*;
eclfocusconcept : eclconceptreference | wildcard;
dot : PERIOD;
memberof : CARAT;
eclconceptreference : conceptid (ws PIPE ws term ws PIPE)?;
eclconceptreferenceset : LEFT_PAREN ws eclconceptreference (mws eclconceptreference)* ws RIGHT_PAREN;
conceptid : sctid;
term : nonwsnonpipe+ ( sp+ nonwsnonpipe+ )*;
wildcard : ASTERISK;
constraintoperator : childof | childorselfof | descendantorselfof | descendantof | parentof | parentorselfof | ancestororselfof | ancestorof;
descendantof : LESS_THAN;
descendantorselfof : (LESS_THAN LESS_THAN);
childof : (LESS_THAN EXCLAMATION);
childorselfof : (LESS_THAN LESS_THAN EXCLAMATION);
ancestorof : GREATER_THAN;
ancestororselfof : (GREATER_THAN GREATER_THAN);
parentof : (GREATER_THAN EXCLAMATION);
parentorselfof : (GREATER_THAN GREATER_THAN EXCLAMATION);
conjunction : (((CAP_A | A)|(CAP_A | A)) ((CAP_N | N)|(CAP_N | N)) ((CAP_D | D)|(CAP_D | D)) mws) | COMMA;
disjunction : ((CAP_O | O)|(CAP_O | O)) ((CAP_R | R)|(CAP_R | R)) mws;
exclusion : ((CAP_M | M)|(CAP_M | M)) ((CAP_I | I)|(CAP_I | I)) ((CAP_N | N)|(CAP_N | N)) ((CAP_U | U)|(CAP_U | U)) ((CAP_S | S)|(CAP_S | S)) mws;
eclrefinement : subrefinement ws (conjunctionrefinementset | disjunctionrefinementset)?;
conjunctionrefinementset : (ws conjunction ws subrefinement)+;
disjunctionrefinementset : (ws disjunction ws subrefinement)+;
subrefinement : eclattributeset | eclattributegroup | (LEFT_PAREN ws eclrefinement ws RIGHT_PAREN);
eclattributeset : subattributeset ws (conjunctionattributeset | disjunctionattributeset)?;
conjunctionattributeset : (ws conjunction ws subattributeset)+;
disjunctionattributeset : (ws disjunction ws subattributeset)+;
subattributeset : eclattribute | (LEFT_PAREN ws eclattributeset ws RIGHT_PAREN);
eclattributegroup : (LEFT_BRACE cardinality RIGHT_BRACE ws)? LEFT_CURLY_BRACE ws eclattributeset ws RIGHT_CURLY_BRACE;
eclattribute : (LEFT_BRACE cardinality RIGHT_BRACE ws)? (reverseflag ws)? eclattributename ws ((expressioncomparisonoperator ws subexpressionconstraint) | (numericcomparisonoperator ws HASH numericvalue) | (stringcomparisonoperator ws qm stringvalue qm) | (booleancomparisonoperator ws booleanvalue));
cardinality : minvalue to maxvalue;
minvalue : nonnegativeintegervalue;
to : (PERIOD PERIOD);
maxvalue : nonnegativeintegervalue | many;
many : ASTERISK;
reverseflag : (CAP_R | R);
eclattributename : subexpressionconstraint;
expressioncomparisonoperator : EQUALS | (EXCLAMATION EQUALS);
numericcomparisonoperator : EQUALS | (EXCLAMATION EQUALS) | (LESS_THAN EQUALS) | LESS_THAN | (GREATER_THAN EQUALS) | GREATER_THAN;
stringcomparisonoperator : EQUALS | (EXCLAMATION EQUALS);
booleancomparisonoperator : EQUALS | (EXCLAMATION EQUALS);
filterconstraint : (LEFT_CURLY_BRACE LEFT_CURLY_BRACE) ws filter (ws COMMA ws filter)* ws (RIGHT_CURLY_BRACE RIGHT_CURLY_BRACE);
filter : termfilter | languagefilter | typefilter | dialectfilter;
termfilter : termkeyword ws booleancomparisonoperator ws (typedsearchterm | typedsearchtermset);
termkeyword : ((CAP_T | T)|(CAP_T | T)) ((CAP_E | E)|(CAP_E | E)) ((CAP_R | R)|(CAP_R | R)) ((CAP_M | M)|(CAP_M | M));
typedsearchterm : ( ( match ws COLON ws )? matchsearchtermset ) | ( wild ws COLON ws wildsearchtermset );
typedsearchtermset : LEFT_PAREN ws typedsearchterm (mws typedsearchterm)* ws RIGHT_PAREN;
wild : ((CAP_W | W)|(CAP_W | W)) ((CAP_I | I)|(CAP_I | I)) ((CAP_L | L)|(CAP_L | L)) ((CAP_D | D)|(CAP_D | D));
match : ((CAP_M | M)|(CAP_M | M)) ((CAP_A | A)|(CAP_A | A)) ((CAP_T | T)|(CAP_T | T)) ((CAP_C | C)|(CAP_C | C)) ((CAP_H | H)|(CAP_H | H));
matchsearchterm : (nonwsnonescapedchar | escapedchar)+;
matchsearchtermset : qm ws matchsearchterm (mws matchsearchterm)* ws qm;
wildsearchterm : (anynonescapedchar | escapedwildchar)+;
wildsearchtermset : qm wildsearchterm qm;
languagefilter : language ws booleancomparisonoperator ws (languagecode | languagecodeset);
language : ((CAP_L | L)|(CAP_L | L)) ((CAP_A | A)|(CAP_A | A)) ((CAP_N | N)|(CAP_N | N)) ((CAP_G | G)|(CAP_G | G)) ((CAP_U | U)|(CAP_U | U)) ((CAP_A | A)|(CAP_A | A)) ((CAP_G | G)|(CAP_G | G)) ((CAP_E | E)|(CAP_E | E));
languagecode : (alpha alpha);
languagecodeset : LEFT_PAREN ws languagecode (mws languagecode)* ws RIGHT_PAREN;
typefilter : typeidfilter | typetokenfilter;
typeidfilter : typeid ws booleancomparisonoperator ws (eclconceptreference | eclconceptreferenceset);
typeid : ((CAP_T | T)|(CAP_T | T)) ((CAP_Y | Y)|(CAP_Y | Y)) ((CAP_P | P)|(CAP_P | P)) ((CAP_E | E)|(CAP_E | E)) ((CAP_I | I)|(CAP_I | I)) ((CAP_D | D)|(CAP_D | D));
typetokenfilter : type ws booleancomparisonoperator ws (typetoken | typetokenset);
type : ((CAP_T | T)|(CAP_T | T)) ((CAP_Y | Y)|(CAP_Y | Y)) ((CAP_P | P)|(CAP_P | P)) ((CAP_E | E)|(CAP_E | E));
typetoken : synonym | fullyspecifiedname | definition;
typetokenset : LEFT_PAREN ws typetoken (mws typetoken)* ws RIGHT_PAREN;
synonym : ((CAP_S | S)|(CAP_S | S)) ((CAP_Y | Y)|(CAP_Y | Y)) ((CAP_N | N)|(CAP_N | N));
fullyspecifiedname : ((CAP_F | F)|(CAP_F | F)) ((CAP_S | S)|(CAP_S | S)) ((CAP_N | N)|(CAP_N | N));
definition : ((CAP_D | D)|(CAP_D | D)) ((CAP_E | E)|(CAP_E | E)) ((CAP_F | F)|(CAP_F | F));
dialectfilter : (dialectidfilter | dialectaliasfilter) ( ws acceptabilityset )?;
dialectidfilter : dialectid ws booleancomparisonoperator ws (eclconceptreference | eclconceptreferenceset);
dialectid : ((CAP_D | D)|(CAP_D | D)) ((CAP_I | I)|(CAP_I | I)) ((CAP_A | A)|(CAP_A | A)) ((CAP_L | L)|(CAP_L | L)) ((CAP_E | E)|(CAP_E | E)) ((CAP_C | C)|(CAP_C | C)) ((CAP_T | T)|(CAP_T | T)) ((CAP_I | I)|(CAP_I | I)) ((CAP_D | D)|(CAP_D | D));
dialectaliasfilter : dialect ws booleancomparisonoperator ws (dialectalias | dialectaliasset);
dialect : ((CAP_D | D)|(CAP_D | D)) ((CAP_I | I)|(CAP_I | I)) ((CAP_A | A)|(CAP_A | A)) ((CAP_L | L)|(CAP_L | L)) ((CAP_E | E)|(CAP_E | E)) ((CAP_C | C)|(CAP_C | C)) ((CAP_T | T)|(CAP_T | T));
dialectalias : alpha ( dash | alpha | integervalue)*;
dialectaliasset : LEFT_PAREN ws dialectalias (mws dialectalias)* ws RIGHT_PAREN;
acceptabilityset : acceptabilityidset | acceptabilitytokenset;
acceptabilityidset : eclconceptreferenceset;
acceptabilitytokenset : LEFT_PAREN ws acceptabilitytoken (mws acceptabilitytoken)* ws RIGHT_PAREN;
acceptabilitytoken : acceptable | preferred;
acceptable : ((CAP_A | A)|(CAP_A | A)) ((CAP_C | C)|(CAP_C | C)) ((CAP_C | C)|(CAP_C | C)) ((CAP_E | E)|(CAP_E | E)) ((CAP_P | P)|(CAP_P | P)) ((CAP_T | T)|(CAP_T | T));
preferred : ((CAP_P | P)|(CAP_P | P)) ((CAP_R | R)|(CAP_R | R)) ((CAP_E | E)|(CAP_E | E)) ((CAP_F | F)|(CAP_F | F)) ((CAP_E | E)|(CAP_E | E)) ((CAP_R | R)|(CAP_R | R));
numericvalue : (DASH|PLUS)? (decimalvalue | integervalue);
stringvalue : (anynonescapedchar | escapedchar)+;
integervalue : (digitnonzero digit*) | zero;
decimalvalue : integervalue PERIOD digit+;
booleanvalue : true_1 | false_1;
true_1 : ((CAP_T | T)|(CAP_T | T)) ((CAP_R | R)|(CAP_R | R)) ((CAP_U | U)|(CAP_U | U)) ((CAP_E | E)|(CAP_E | E));
false_1 : ((CAP_F | F)|(CAP_F | F)) ((CAP_A | A)|(CAP_A | A)) ((CAP_L | L)|(CAP_L | L)) ((CAP_S | S)|(CAP_S | S)) ((CAP_E | E)|(CAP_E | E));
nonnegativeintegervalue : (digitnonzero digit* ) | zero;
sctid : digitnonzero (( digit ) (digit) (digit) (digit) (digit) (((digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit) (digit)) | ((digit) (digit) (digit) (digit)) | ((digit) (digit) (digit)) | ((digit) (digit)) | (digit)?));
ws : ( sp | htab | cr | lf | comment )*; // optional white space
mws : ( sp | htab | cr | lf | comment )+; // mandatory white space
comment : (SLASH ASTERISK) (nonstarchar | starwithnonfslash)* (ASTERISK SLASH);
nonstarchar : sp | htab | cr | lf | (EXCLAMATION | QUOTE | HASH | DOLLAR | PERCENT | AMPERSAND | APOSTROPHE | LEFT_PAREN | RIGHT_PAREN) | (PLUS | COMMA | DASH | PERIOD | SLASH | ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | COLON | SEMICOLON | LESS_THAN | EQUALS | GREATER_THAN | QUESTION | AT | CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z | LEFT_BRACE | BACKSLASH | RIGHT_BRACE | CARAT | UNDERSCORE | ACCENT | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | LEFT_CURLY_BRACE | PIPE | RIGHT_CURLY_BRACE | TILDE) |UTF8_LETTER;
starwithnonfslash : ASTERISK nonfslash;
nonfslash : sp | htab | cr | lf | (EXCLAMATION | QUOTE | HASH | DOLLAR | PERCENT | AMPERSAND | APOSTROPHE | LEFT_PAREN | RIGHT_PAREN | ASTERISK | PLUS | COMMA | DASH | PERIOD) | (ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | COLON | SEMICOLON | LESS_THAN | EQUALS | GREATER_THAN | QUESTION | AT | CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z | LEFT_BRACE | BACKSLASH | RIGHT_BRACE | CARAT | UNDERSCORE | ACCENT | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | LEFT_CURLY_BRACE | PIPE | RIGHT_CURLY_BRACE | TILDE) |UTF8_LETTER;
sp : SPACE; // space
htab : TAB; // tab
cr : CR; // carriage return
lf : LF; // line feed
qm : QUOTE; // quotation mark
bs : BACKSLASH; // back slash
star : ASTERISK; // asterisk
digit : (ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE);
zero : ZERO;
digitnonzero : (ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE);
nonwsnonpipe : (EXCLAMATION | QUOTE | HASH | DOLLAR | PERCENT | AMPERSAND | APOSTROPHE | LEFT_PAREN | RIGHT_PAREN | ASTERISK | PLUS | COMMA | DASH | PERIOD | SLASH | ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | COLON | SEMICOLON | LESS_THAN | EQUALS | GREATER_THAN | QUESTION | AT | CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z | LEFT_BRACE | BACKSLASH | RIGHT_BRACE | CARAT | UNDERSCORE | ACCENT | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | LEFT_CURLY_BRACE) | (RIGHT_CURLY_BRACE | TILDE) | UTF8_LETTER;
anynonescapedchar : sp | htab | cr | lf | (SPACE | EXCLAMATION) | (HASH | DOLLAR | PERCENT | AMPERSAND | APOSTROPHE | LEFT_PAREN | RIGHT_PAREN | ASTERISK | PLUS | COMMA | DASH | PERIOD | SLASH | ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | COLON | SEMICOLON | LESS_THAN | EQUALS | GREATER_THAN | QUESTION | AT | CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z | LEFT_BRACE) | (RIGHT_BRACE | CARAT | UNDERSCORE | ACCENT | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | LEFT_CURLY_BRACE | PIPE | RIGHT_CURLY_BRACE | TILDE) | UTF8_LETTER;
escapedchar : (bs qm) | (bs bs);
escapedwildchar : (bs qm) | (bs bs) | (bs star);
nonwsnonescapedchar : EXCLAMATION | (HASH | DOLLAR | PERCENT | AMPERSAND | APOSTROPHE | LEFT_PAREN | RIGHT_PAREN | ASTERISK | PLUS | COMMA | DASH | PERIOD | SLASH | ZERO | ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | COLON | SEMICOLON | LESS_THAN | EQUALS | GREATER_THAN | QUESTION | AT | CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z | LEFT_BRACE) | (RIGHT_BRACE | CARAT | UNDERSCORE | ACCENT | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | LEFT_CURLY_BRACE | PIPE | RIGHT_CURLY_BRACE | TILDE) | UTF8_LETTER;
alpha : (CAP_A | CAP_B | CAP_C | CAP_D | CAP_E | CAP_F | CAP_G | CAP_H | CAP_I | CAP_J | CAP_K | CAP_L | CAP_M | CAP_N | CAP_O | CAP_P | CAP_Q | CAP_R | CAP_S | CAP_T | CAP_U | CAP_V | CAP_W | CAP_X | CAP_Y | CAP_Z) | (A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z);
dash : DASH;
////////////////////////////////////////////////////////////////////////////////////////////
// Lexer rules generated for each distinct character in original grammar
// Simplified character names based on Unicode (http://www.unicode.org/charts/PDF/U0000.pdf)
////////////////////////////////////////////////////////////////////////////////////////////
TAB : '\u0009';
LF : '\u000A';
CR : '\u000D';
SPACE : ' ';
EXCLAMATION : '!';
QUOTE : '"';
HASH : '#';
DOLLAR : '$';
PERCENT : '%';
AMPERSAND : '&';
APOSTROPHE : '\'';
LEFT_PAREN : '(';
RIGHT_PAREN : ')';
ASTERISK : '*';
PLUS : '+';
COMMA : ',';
DASH : '-';
PERIOD : '.';
SLASH : '/';
ZERO : '0';
ONE : '1';
TWO : '2';
THREE : '3';
FOUR : '4';
FIVE : '5';
SIX : '6';
SEVEN : '7';
EIGHT : '8';
NINE : '9';
COLON : ':';
SEMICOLON : ';';
LESS_THAN : '<';
EQUALS : '=';
GREATER_THAN : '>';
QUESTION : '?';
AT : '@';
CAP_A : 'A';
CAP_B : 'B';
CAP_C : 'C';
CAP_D : 'D';
CAP_E : 'E';
CAP_F : 'F';
CAP_G : 'G';
CAP_H : 'H';
CAP_I : 'I';
CAP_J : 'J';
CAP_K : 'K';
CAP_L : 'L';
CAP_M : 'M';
CAP_N : 'N';
CAP_O : 'O';
CAP_P : 'P';
CAP_Q : 'Q';
CAP_R : 'R';
CAP_S : 'S';
CAP_T : 'T';
CAP_U : 'U';
CAP_V : 'V';
CAP_W : 'W';
CAP_X : 'X';
CAP_Y : 'Y';
CAP_Z : 'Z';
LEFT_BRACE : '[';
BACKSLASH : '\\';
RIGHT_BRACE : ']';
CARAT : '^';
UNDERSCORE : '_';
ACCENT : '`';
A : 'a';
B : 'b';
C : 'c';
D : 'd';
E : 'e';
F : 'f';
G : 'g';
H : 'h';
I : 'i';
J : 'j';
K : 'k';
L : 'l';
M : 'm';
N : 'n';
O : 'o';
P : 'p';
Q : 'q';
R : 'r';
S : 's';
T : 't';
U : 'u';
V : 'v';
W : 'w';
X : 'x';
Y : 'y';
Z : 'z';
LEFT_CURLY_BRACE : '{';
PIPE : '|';
RIGHT_CURLY_BRACE : '}';
TILDE : '~';
UTF8_LETTER
: '\u00C0' .. '\u02FF'
| '\u0370' .. '\u037D'
| '\u037F' .. '\u1FFF'
| '\u200C' .. '\u200D'
| '\u2070' .. '\u218F'
| '\u2C00' .. '\u2FEF'
| '\u3001' .. '\uD7FF'
| '\uF900' .. '\uFDCF'
| '\uFDF0' .. '\uFFFD'
; |
source/Tribes2.g4 | Ragora/TribalScript | 0 | 7767 | <gh_stars>0
/**
* Copyright 2021 <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.
*/
grammar Tribes2;
program : statement* EOF ;
/*
Main Blocks
*/
function_declaration : FUNCTION LABEL '(' function_declaration_parameters? ')' '{' expression_statement* '}'
| FUNCTION LABEL '::' LABEL '(' function_declaration_parameters? ')' '{' expression_statement* '}' ;
function_declaration_parameters : localvariable (',' localvariable)* ;
package_declaration : PACKAGE LABEL '{' function_declaration+ '}' ';' ;
datablock_declaration : DATABLOCK LABEL '(' LABEL ')' (':' LABEL)? '{' field_assign+ '}' ;
field_assign : labelwithkeywords '=' primary_expression_or_expression ';'
| labelwithkeywords '[' expression_list ']' '=' primary_expression_or_expression ';' ;
object_initialization : '{' field_assign* (object_declaration ';')* '}' ;
// NOTE: In T2 it's possible to pass multiple values in the type & name, what do they do exactly?
object_declaration : NEW LABEL '(' (name=primary_expression_or_expression)? ')' object_initialization?
| NEW '(' expression ')' '(' (name=primary_expression_or_expression)? ')' object_initialization? ;
/*
Control blocks
*/
control_statements : '{' expression_statement* '}'
| expression_statement ;
while_control : WHILE '(' expression ')' control_statements ;
for_control : FOR '(' primary_expression_or_expression ';' primary_expression_or_expression ';' primary_expression_or_expression ')' control_statements ;
else_control : ELSE control_statements ;
elseif_control : ELSE IF '(' primary_expression_or_expression ')' control_statements ;
if_control : IF '(' primary_expression_or_expression ')' control_statements elseif_control* else_control? ;
default_control : DEFAULT ':' expression_statement* ;
case_control : CASE expression ('or' expression)* ':' expression_statement* ;
switch_control : SWITCH '$'? '(' primary_expression_or_expression ')' '{' case_control+ default_control? '}' ;
break_control : BREAK ;
continue_control : CONTINUE ;
return_control : RETURN primary_expression_or_expression? ;
/*
Expressions and Statements
*/
expression_statement : primary_expression ';'
| while_control
| for_control
| if_control
| switch_control
| continue_control ';'
| break_control ';'
| return_control ';' ;
statement : function_declaration
| package_declaration
| expression_statement ;
expression_list : primary_expression_or_expression (',' primary_expression_or_expression)* ;
qualified_functioncall_expression : LABEL '::' LABEL '(' expression_list? ')' ;
functioncall_expression : LABEL '(' expression_list? ')' ;
// A copy of functioncall_expression for easily distinguishing a bound call and not
subfunctioncall_expression : LABEL '(' expression_list? ')' ;
chain_start : localvariable
| globalvariable
| globalarray
| localarray
| rvalue
| functioncall_expression
| qualified_functioncall_expression
| field ;
chain_component : field
| fieldarray
| subfunctioncall_expression ;
chain_elements : field
| fieldarray
| subfunctioncall_expression
| chain_elements '.' chain_elements ;
chain : chain_start ('.' chain_elements)? ;
assignable_chain : localvariable
| globalvariable
| localarray
| globalarray
| chain_start ('.' chain_elements)? '.' field
| chain_start ('.' chain_elements)? '.' fieldarray ;
primary_chain : functioncall_expression
| qualified_functioncall_expression
| chain_start ('.' chain_elements)? '.' subfunctioncall_expression ;
// Root level expression - because expressions like `1;` are not valid - it must be actionable
primary_expression : primary_chain # chainPrimaryExpression
| assignable_chain (op=ASSIGN
|op=PLUSASSIGN
|op=MINUSASSIGN
|op=MULTIPLYASSIGN
|op=DIVIDEASSIGN
|op=ORASSIGN
|op=MODULUSASSIGN
|op=ANDASSIGN) expression # assign
| assignable_chain '++' # increment
| assignable_chain '--' # decrement
| object_declaration # objectDeclarationExpression
| datablock_declaration # datablockDeclarationExpression ;
primary_expression_or_expression : primary_expression
| expression ;
// Only valid on the right side of an assignment, however still valid on the left side of a '.'
rvalue : INT # value
| HEXINT # value
| STRING # value
| TAGGEDSTRING # value
| FLOAT # value
| LABEL # value
| TRUE # value
| FALSE # value
| object_declaration # objectDeclarationRValue ;
expression : (op=MINUS
|op=NOT
|op=TILDE) expression # unary
| chain # chainExpression
| '(' expression ')' # parentheses
| expression (op=BITWISEXOR
|op=BITWISEOR
|op=BITWISEAND) expression # bitwise
| expression (op=MODULUS
|op=MULTIPLY
|op=DIVIDE) expression # arithmetic
| expression (op=PLUS
|op=MINUS) expression # arithmetic
| expression '?' expression ':' expression # ternary
| expression (op=LESSTHAN
|op=GREATERTHAN
|op=LESSTHANOREQUAL
|op=GREATERTHANOREQUAL) expression # relational
| expression (op=LEFTBITSHIFT
|op=RIGHTBITSHIFT) expression # bitshift
| expression (op=LOGICALAND
|op=LOGICALOR) expression # logical
| expression (op=EQUALS
|op=NOTEQUAL
|op=STRINGEQUALS
|op=STRINGNOTEQUAL) expression # equality
| expression (op=CONCAT
|op=TABCONCAT
|op=SPACECONCAT
|op=NEWLINECONCAT) expression # concat
| rvalue # rvalueExpression ;
// For the grammar to work correctly, we need to explicitly allow these keywords to be used in variable names
labelwithkeywords : LABEL | PACKAGE | RETURN | BREAK | CONTINUE | WHILE | FALSE | TRUE | FUNCTION | ELSE | IF | DATABLOCK | CASE ;
localvariable : '%' labelwithkeywords ('::' labelwithkeywords)* ;
globalvariable : '$' labelwithkeywords ('::' labelwithkeywords)* ;
field : LABEL ;
fieldarray : LABEL '[' expression_list ']' ;
localarray : localvariable '[' expression_list ']' ;
globalarray : globalvariable '[' expression_list ']' ;
/*
Lexer
*/
DATABLOCK : 'datablock' ;
PACKAGE : 'package' ;
FUNCTION : 'function' ;
IF : 'if';
ELSE : 'else' ;
SWITCH : 'switch';
CASE : 'case' ;
RETURN : 'return';
BREAK : 'break';
NEW : 'new' ;
WHILE : 'while' ;
FOR : 'for' ;
TRUE : 'true' ;
FALSE : 'false' ;
DEFAULT : 'default' ;
PLUS : '+' ;
MINUS : '-' ;
MULTIPLY : '*' ;
DIVIDE : '/' ;
MODULUS : '%' ;
ASSIGN : '=';
PLUSASSIGN : '+=' ;
MULTIPLYASSIGN : '*=' ;
ORASSIGN : '|=' ;
ANDASSIGN : '&=' ;
MODULUSASSIGN : '%=' ;
DIVIDEASSIGN : '/=' ;
MINUSASSIGN : '-=' ;
LESSTHAN : '<' ;
GREATERTHAN : '>' ;
LESSTHANOREQUAL : '<=' ;
GREATERTHANOREQUAL : '>=' ;
NOT : '!' ;
TILDE : '~' ;
EQUALS : '==' ;
STRINGEQUALS : '$=' ;
NOTEQUAL : '!=' ;
STRINGNOTEQUAL : '!$=' ;
CONCAT : '@' ;
SPACECONCAT : 'SPC' ;
TABCONCAT : 'TAB' ;
NEWLINECONCAT : 'NL' ;
CONTINUE : 'continue' ;
LOGICALAND : '&&' ;
LOGICALOR : '||' ;
LEFTBITSHIFT : '<<' ;
RIGHTBITSHIFT : '>>' ;
BITWISEXOR : '^' ;
BITWISEAND : '&' ;
BITWISEOR : '|' ;
// Labels can contain numbers but not at the start
LABEL : [a-zA-Z_]+[a-zA-Z_0-9]* ;
INT : DIGIT+ ;
HEXINT : '0x' HEXDIGIT+ ;
DIGIT: '0'..'9' ;
HEXDIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
STRING : '"' ( ESC | ~[\\"] )*? '"' ;
TAGGEDSTRING : '\'' ( ESC | ~[\\'] )*? '\'' ;
fragment
ESC : '\\' ([A-Za-z0-9|{}"'\\])
| HEX_ESCAPE
| COLOR_ESCAPE
;
fragment
HEX_ESCAPE
: '\\x' HEXDIGIT HEXDIGIT?
;
// NOTE: I'm uncertain as to what these \c escapes actually signify aside from what they do in the T2 chat and console
fragment
COLOR_ESCAPE
: '\\c' (DIGIT|'p'|'o') ;
EXP : ('E' | 'e') ('+' | '-')? INT ;
FLOAT: DIGIT+ '.' DIGIT+ EXP?
| DIGIT+ EXP?
;
// Ignore line comments
LineComment : '//' ~[\r\n]* -> skip ;
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|
source/quickAdd.applescript | oashour/bookends-tools | 76 | 40 | <reponame>oashour/bookends-tools
#!/usr/bin/env osascript
tell application "System Events"
set previousApp to name of 1st process whose frontmost is true
keystroke "c" using command down
tell application "Bookends"
activate
end tell
delay 0.1
keystroke "n" using {command down, control down}
delay 0.6
keystroke "v" using command down
delay 0.1
keystroke return --comment this out if you want to edit text before search
delay 0.5
tell application previousApp
activate
end tell
end tell |
bb-runtimes/src/s-bbcpsp__spe.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 443 | <filename>bb-runtimes/src/s-bbcpsp__spe.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . C P U _ S P E C I F I C --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package implements PowerPC architecture specific support for the GNAT
-- Ravenscar run time.
with System.Machine_Code;
package body System.BB.CPU_Specific is
type Exception_Handler_Array is array (Vector_Id) of Address;
procedure GNAT_Error_Handler (Trap : Vector_Id);
Exception_Handlers : Exception_Handler_Array :=
(others => GNAT_Error_Handler'Address);
pragma Export (C, Exception_Handlers, "__gnat_powerpc_exception_handlers");
-------------------------------
-- Finish_Initialize_Context --
-------------------------------
procedure Finish_Initialize_Context
(Buffer : not null access Context_Buffer)
is
use System.Machine_Code;
use Interfaces;
Spefpscr : Unsigned_32;
begin
-- Copy the current value of SPEFPSCR
Asm ("mfspr %0, 512",
Outputs => Unsigned_32'Asm_Output ("=r", Spefpscr),
Volatile => True);
Buffer.SPEFPSCR := Spefpscr;
end Finish_Initialize_Context;
--------------------
-- Initialize_CPU --
--------------------
procedure Initialize_CPU is
use System.Machine_Code;
use Interfaces;
Addr : Address;
-- Interrupt vector table prefix
DIE : constant Unsigned_32 := 16#0400_0000#;
-- Decrementer interrupt enable
begin
-- Set TCR
Asm ("mtspr 340, %0",
Inputs => Unsigned_32'Asm_Input ("r", DIE),
Volatile => True);
-- Set IVPR
Asm ("lis %0,handler_0@h",
Outputs => Address'Asm_Output ("=r", Addr),
Volatile => True);
Asm ("mtspr 63, %0",
Inputs => Address'Asm_Input ("r", Addr),
Volatile => True);
-- Set IVOR10 (decrementer)
Asm ("li %0,handler_10@l",
Outputs => Address'Asm_Output ("=r", Addr),
Volatile => True);
Asm ("mtspr 410, %0",
Inputs => Address'Asm_Input ("r", Addr),
Volatile => True);
-- Set IVOR4 (External interrupt)
Asm ("li %0,handler_4@l",
Outputs => Address'Asm_Output ("=r", Addr),
Volatile => True);
Asm ("mtspr 404, %0",
Inputs => Address'Asm_Input ("r", Addr),
Volatile => True);
-- Set IVOR33 (spe data interrupt)
Asm ("li %0,handler_33@l",
Outputs => Address'Asm_Output ("=r", Addr),
Volatile => True);
Asm ("mtspr 529, %0",
Inputs => Address'Asm_Input ("r", Addr),
Volatile => True);
end Initialize_CPU;
---------------------
-- Install_Handler --
---------------------
procedure Install_Exception_Handler
(Service_Routine : System.Address;
Vector : Vector_Id)
is
begin
Exception_Handlers (Vector) := Service_Routine;
end Install_Exception_Handler;
------------------------
-- GNAT_Error_Handler --
------------------------
procedure GNAT_Error_Handler (Trap : Vector_Id) is
begin
case Trap is
when Floatting_Point_Data_Excp =>
raise Constraint_Error with "floating point exception";
when others =>
raise Program_Error with "unhandled trap";
end case;
end GNAT_Error_Handler;
----------------------------
-- Install_Error_Handlers --
----------------------------
procedure Install_Error_Handlers is
begin
Install_Exception_Handler (GNAT_Error_Handler'Address,
Floatting_Point_Data_Excp);
end Install_Error_Handlers;
end System.BB.CPU_Specific;
|
Tek2/ASM/MinilibC/src/memmove.asm | PhilippeDeSousa/EpitechBundle | 1 | 93554 | <reponame>PhilippeDeSousa/EpitechBundle
section .text
global memmove:function
memmove:
mov rax, rdi
mov r8, rdi
sub r8, rsi
cmp r8, 0
jge overlap_right
overlap_left:
xor rcx, rcx
loop_left:
cmp rcx, rdx
je end
mov r8b, [rsi + rcx]
mov [rdi + rcx], r8b
inc rcx
jmp loop_left
overlap_right:
dec rdx
loop_right:
cmp rdx, 0
jl end
mov r8b, [rsi + rdx]
mov [rdi + rdx], r8b
dec rdx
jmp loop_right
end:
ret |
src/include/defines.asm | rondnelson99/vcs-instrument | 0 | 9897 | <gh_stars>0
.MEMORYMAP
DEFAULTSLOT 0
SLOT 0 START $F000 SIZE $1000 NAME "ROM"
SLOT 1 START $80 SIZE $80 NAME "RAM"
.ENDME
.ROMBANKSIZE $1000
.ROMBANKS 1
.include "vcs.inc"
.include "macro.inc"
.def Scratchpad $80
.MACRO incv2bpp ARGS FILE WIDTH ;include a 2bpp row-major image, but convert to column-major
.fopen FILE HANDLE
.fsize HANDLE SIZE
.REPT WIDTH/8 INDEX X
.REPT SIZE/(WIDTH/8) INDEX Y
.fseek HANDLE (WIDTH/8*Y)+X START
.ftell HANDLE LOC
.printv LOC
.print "\n"
.fread HANDLE DATA
.db DATA
.ENDR
.ENDR
.ENDM
.MACRO incvr2bpp ARGS FILE WIDTH ;same as above but also store each character backwards
.incbin FILE READ 0 FSIZE SIZE
.redef HEIGHT SIZE/(WIDTH/8)
.REPT WIDTH/8 INDEX X
.REPT HEIGHT INDEX Y
.incbin FILE SKIP SIZE-(WIDTH/8*(Y+1))+X READ 1
.ENDR
.ENDR
.ENDM
.MACRO bitReverse ;reverse the order of bits in the byte
.redef _out 0
.rept 8 INDEX i
.redef _out (_out>>1)|((\1<<i)&$80)
.endr
.ENDM
.MACRO lax_ind_y
.db $b3
.db \1
.endm
|
programs/oeis/295/A295513.asm | karttu/loda | 0 | 177398 | <filename>programs/oeis/295/A295513.asm<gh_stars>0
; A295513: a(n) = n*bil(n) - 2^bil(n) where bil(0) = 0 and bil(n) = floor(log_2(n)) + 1 for n>0.
; -1,-1,0,2,4,7,10,13,16,20,24,28,32,36,40,44,48,53,58,63,68,73,78,83,88,93,98,103,108,113,118,123,128,134,140,146,152,158,164,170,176,182,188,194,200,206,212,218,224,230,236,242,248,254,260,266,272,278
sub $0,1
lpb $0,1
mov $2,$0
lpb $2,1
add $1,1
div $2,2
lpe
sub $0,1
lpe
sub $1,1
|
libsrc/_DEVELOPMENT/font/fzx/fonts/kk/_ff_kk_McMillen.asm | jpoikela/z88dk | 640 | 103069 |
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_kk_McMillen
_ff_kk_McMillen:
BINARY "font/fzx/fonts/kk/McMillen.fzx"
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cofuve.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 1457 | <gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FUNCTIONAL_VECTORS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2016-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
pragma Ada_2012;
private with Ada.Containers.Functional_Base;
generic
type Index_Type is (<>);
-- To avoid Constraint_Error being raised at run time, Index_Type'Base
-- should have at least one more element at the low end than Index_Type.
type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Functional_Vectors with SPARK_Mode is
subtype Extended_Index is Index_Type'Base range
Index_Type'Pred (Index_Type'First) .. Index_Type'Last;
-- Index_Type with one more element at the low end of the range.
-- This type is never used but it forces GNATprove to check that there is
-- room for one more element at the low end of Index_Type.
type Sequence is private
with Default_Initial_Condition => Length (Sequence) = 0,
Iterable => (First => Iter_First,
Has_Element => Iter_Has_Element,
Next => Iter_Next,
Element => Get);
-- Sequences are empty when default initialized.
-- Quantification over sequences can be done using the regular
-- quantification over its range or directly on its elements with "for of".
-----------------------
-- Basic operations --
-----------------------
-- Sequences are axiomatized using Length and Get, providing respectively
-- the length of a sequence and an accessor to its Nth element:
function Length (Container : Sequence) return Count_Type with
-- Length of a sequence
Global => null,
Post =>
(Index_Type'Pos (Index_Type'First) - 1) + Length'Result <=
Index_Type'Pos (Index_Type'Last);
function Get
(Container : Sequence;
Position : Extended_Index) return Element_Type
-- Access the Element at position Position in Container
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container);
function Last (Container : Sequence) return Extended_Index with
-- Last index of a sequence
Global => null,
Post =>
Last'Result =
Index_Type'Val ((Index_Type'Pos (Index_Type'First) - 1) +
Length (Container));
pragma Annotate (GNATprove, Inline_For_Proof, Last);
function First return Extended_Index is (Index_Type'First) with
Global => null;
-- First index of a sequence
------------------------
-- Property Functions --
------------------------
function "=" (Left : Sequence; Right : Sequence) return Boolean with
-- Extensional equality over sequences
Global => null,
Post =>
"="'Result =
(Length (Left) = Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "=");
function "<" (Left : Sequence; Right : Sequence) return Boolean with
-- Left is a strict subsequence of Right
Global => null,
Post =>
"<"'Result =
(Length (Left) < Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "<");
function "<=" (Left : Sequence; Right : Sequence) return Boolean with
-- Left is a subsequence of Right
Global => null,
Post =>
"<="'Result =
(Length (Left) <= Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "<=");
function Contains
(Container : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Item : Element_Type) return Boolean
-- Returns True if Item occurs in the range from Fst to Lst of Container
with
Global => null,
Pre => Lst <= Last (Container),
Post =>
Contains'Result =
(for some I in Fst .. Lst => Get (Container, I) = Item);
pragma Annotate (GNATprove, Inline_For_Proof, Contains);
function Constant_Range
(Container : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Item : Element_Type) return Boolean
-- Returns True if every element of the range from Fst to Lst of Container
-- is equal to Item.
with
Global => null,
Pre => Lst <= Last (Container),
Post =>
Constant_Range'Result =
(for all I in Fst .. Lst => Get (Container, I) = Item);
pragma Annotate (GNATprove, Inline_For_Proof, Constant_Range);
function Equal_Except
(Left : Sequence;
Right : Sequence;
Position : Index_Type) return Boolean
-- Returns True is Left and Right are the same except at position Position
with
Global => null,
Pre => Position <= Last (Left),
Post =>
Equal_Except'Result =
(Length (Left) = Length (Right)
and then (for all I in Index_Type'First .. Last (Left) =>
(if I /= Position then Get (Left, I) = Get (Right, I))));
pragma Annotate (GNATprove, Inline_For_Proof, Equal_Except);
function Equal_Except
(Left : Sequence;
Right : Sequence;
X : Index_Type;
Y : Index_Type) return Boolean
-- Returns True is Left and Right are the same except at positions X and Y
with
Global => null,
Pre => X <= Last (Left) and Y <= Last (Left),
Post =>
Equal_Except'Result =
(Length (Left) = Length (Right)
and then (for all I in Index_Type'First .. Last (Left) =>
(if I /= X and I /= Y then
Get (Left, I) = Get (Right, I))));
pragma Annotate (GNATprove, Inline_For_Proof, Equal_Except);
function Range_Equal
(Left : Sequence;
Right : Sequence;
Fst : Index_Type;
Lst : Extended_Index) return Boolean
-- Returns True if the ranges from Fst to Lst contain the same elements in
-- Left and Right.
with
Global => null,
Pre => Lst <= Last (Left) and Lst <= Last (Right),
Post =>
Range_Equal'Result =
(for all I in Fst .. Lst => Get (Left, I) = Get (Right, I));
pragma Annotate (GNATprove, Inline_For_Proof, Range_Equal);
function Range_Shifted
(Left : Sequence;
Right : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Offset : Count_Type'Base) return Boolean
-- Returns True if the range from Fst to Lst in Left contains the same
-- elements as the range from Fst + Offset to Lst + Offset in Right.
with
Global => null,
Pre =>
Lst <= Last (Left)
and then
(if Offset < 0 then
Index_Type'Pos (Index_Type'Base'First) - Offset <=
Index_Type'Pos (Index_Type'First))
and then
(if Fst <= Lst then
Offset in
Index_Type'Pos (Index_Type'First) - Index_Type'Pos (Fst) ..
(Index_Type'Pos (Index_Type'First) - 1) + Length (Right) -
Index_Type'Pos (Lst)),
Post =>
Range_Shifted'Result =
((for all I in Fst .. Lst =>
Get (Left, I) =
Get (Right, Index_Type'Val (Index_Type'Pos (I) + Offset)))
and
(for all I in Index_Type'Val (Index_Type'Pos (Fst) + Offset) ..
Index_Type'Val (Index_Type'Pos (Lst) + Offset)
=>
Get (Left, Index_Type'Val (Index_Type'Pos (I) - Offset)) =
Get (Right, I)));
pragma Annotate (GNATprove, Inline_For_Proof, Range_Shifted);
----------------------------
-- Construction Functions --
----------------------------
-- For better efficiency of both proofs and execution, avoid using
-- construction functions in annotations and rather use property functions.
function Set
(Container : Sequence;
Position : Index_Type;
New_Item : Element_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- except for the one at position Position which is replaced by New_Item.
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container),
Post =>
Get (Set'Result, Position) = New_Item
and then Equal_Except (Container, Set'Result, Position);
function Add (Container : Sequence; New_Item : Element_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- plus New_Item at the end.
with
Global => null,
Pre =>
Length (Container) < Count_Type'Last
and then Last (Container) < Index_Type'Last,
Post =>
Length (Add'Result) = Length (Container) + 1
and then Get (Add'Result, Last (Add'Result)) = New_Item
and then Container <= Add'Result;
function Add
(Container : Sequence;
Position : Index_Type;
New_Item : Element_Type) return Sequence
with
-- Returns a new sequence which contains the same elements as Container
-- except that New_Item has been inserted at position Position.
Global => null,
Pre =>
Length (Container) < Count_Type'Last
and then Last (Container) < Index_Type'Last
and then Position <= Extended_Index'Succ (Last (Container)),
Post =>
Length (Add'Result) = Length (Container) + 1
and then Get (Add'Result, Position) = New_Item
and then Range_Equal
(Left => Container,
Right => Add'Result,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Position))
and then Range_Shifted
(Left => Container,
Right => Add'Result,
Fst => Position,
Lst => Last (Container),
Offset => 1);
function Remove
(Container : Sequence;
Position : Index_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- except that the element at position Position has been removed.
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container),
Post =>
Length (Remove'Result) = Length (Container) - 1
and then Range_Equal
(Left => Container,
Right => Remove'Result,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Position))
and then Range_Shifted
(Left => Remove'Result,
Right => Container,
Fst => Position,
Lst => Last (Remove'Result),
Offset => 1);
---------------------------
-- Iteration Primitives --
---------------------------
function Iter_First (Container : Sequence) return Extended_Index with
Global => null;
function Iter_Has_Element
(Container : Sequence;
Position : Extended_Index) return Boolean
with
Global => null,
Post =>
Iter_Has_Element'Result =
(Position in Index_Type'First .. Last (Container));
pragma Annotate (GNATprove, Inline_For_Proof, Iter_Has_Element);
function Iter_Next
(Container : Sequence;
Position : Extended_Index) return Extended_Index
with
Global => null,
Pre => Iter_Has_Element (Container, Position);
private
pragma SPARK_Mode (Off);
package Containers is new Ada.Containers.Functional_Base
(Index_Type => Index_Type,
Element_Type => Element_Type);
type Sequence is record
Content : Containers.Container;
end record;
function Iter_First (Container : Sequence) return Extended_Index is
(Index_Type'First);
function Iter_Next
(Container : Sequence;
Position : Extended_Index) return Extended_Index
is
(if Position = Extended_Index'Last then
Extended_Index'First
else
Extended_Index'Succ (Position));
function Iter_Has_Element
(Container : Sequence;
Position : Extended_Index) return Boolean
is
(Position in Index_Type'First ..
(Index_Type'Val
((Index_Type'Pos (Index_Type'First) - 1) + Length (Container))));
end Ada.Containers.Functional_Vectors;
|
programs/oeis/017/A017366.asm | neoneye/loda | 22 | 289 | <filename>programs/oeis/017/A017366.asm
; A017366: a(n) = (10*n+8)^2.
; 64,324,784,1444,2304,3364,4624,6084,7744,9604,11664,13924,16384,19044,21904,24964,28224,31684,35344,39204,43264,47524,51984,56644,61504,66564,71824,77284,82944,88804,94864,101124,107584,114244,121104,128164,135424,142884,150544,158404,166464,174724,183184,191844,200704,209764,219024,228484,238144,248004,258064,268324,278784,289444,300304,311364,322624,334084,345744,357604,369664,381924,394384,407044,419904,432964,446224,459684,473344,487204,501264,515524,529984,544644,559504,574564,589824,605284,620944,636804,652864,669124,685584,702244,719104,736164,753424,770884,788544,806404,824464,842724,861184,879844,898704,917764,937024,956484,976144,996004
mul $0,10
add $0,8
pow $0,2
|
libsrc/graphics/xordrawto.asm | grancier/z180 | 0 | 160112 | ;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Stubs Written by <NAME> - 30/9/98
;
;
; $Id: xordrawto.asm,v 1.1 2016/11/10 07:34:56 stefano Exp $
;
;Usage: xordrawto(struct *pixels)
SECTION code_clib
PUBLIC xordrawto
PUBLIC _xordrawto
EXTERN swapgfxbk
EXTERN __graphics_end
EXTERN __gfx_coords
EXTERN Line
EXTERN xorpixel
.xordrawto
._xordrawto
push ix
ld ix,2
add ix,sp
ld hl,(__gfx_coords)
ld e,(ix+2) ;y
ld d,(ix+4) ;x
call swapgfxbk
ld ix,xorpixel
call Line
jp __graphics_end
|
AppleScript/airpods_pro_start.applescript | iml885203/helper_scripts | 1 | 4607 | if application "Music" is running then
tell application "Music" to play
end if
if application "Spotify" is running then
tell application "Spotify" to play
end if
tell application "System Events"
tell process "SystemUIServer"
click (menu bar item 1 of menu bar 1 whose description contains "volume")
click menu item "Your AirPods Pro Name" of menu 1 of result
click menu item "降噪" of menu 1 of result
end tell
end tell
|
oeis/055/A055067.asm | neoneye/loda-programs | 11 | 242003 | ; A055067: Product of numbers < n which do not divide n (or 1 if no such numbers exist).
; 1,1,2,3,24,20,720,630,13440,36288,3628800,277200,479001600,444787200,5811886080,20432412000,20922789888000,1097800704000,6402373705728000,304112751022080,115852476579840000,2322315553259520000,1124000727777607680000,1870082229375360000,124089680346647887872000,596585001666576384000000,14936720782466875392000000,13888864094921367552000000,304888344611713860501504000000,327472666434803776094208000,265252859812191058636308480000000,8030115873220627751685120000000,7973661725263440308097515520000000
add $0,1
mov $1,1
mov $3,$0
mov $4,$0
lpb $3
mov $5,$4
mov $6,0
lpb $5
mov $6,8
mov $7,$0
mov $8,$2
cmp $8,0
add $2,$8
div $0,$2
mod $7,$2
cmp $7,0
sub $5,$7
lpe
mov $0,$4
cmp $6,0
mov $7,$2
pow $7,$6
mul $1,$7
add $2,1
mov $7,$4
cmp $7,1
cmp $7,0
sub $3,$7
lpe
mov $0,$1
|
01_bootsector/inf_bootsector.asm | cristicretu/CrtOS | 1 | 5879 | <reponame>cristicretu/CrtOS
; infinite loop (e9 fd ff)
loop:
jmp loop
; Fill with 510 zeros - size of the prev code
times 510 - ($ - $$) db 0
; Magic number
dw 0xaa55
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_148.asm | ljhsiun2/medusa | 9 | 101496 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1359, %rsi
lea addresses_WT_ht+0x8cb1, %rdi
nop
nop
nop
nop
nop
cmp $33627, %r13
mov $59, %rcx
rep movsb
nop
and %rdi, %rdi
lea addresses_WC_ht+0x18b71, %rcx
add %r8, %r8
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
and $0xffffffffffffffc0, %rcx
vmovaps %ymm5, (%rcx)
nop
sub $49492, %r8
lea addresses_D_ht+0x13971, %r13
nop
sub $65210, %r11
vmovups (%r13), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r8
nop
add $21751, %r13
lea addresses_UC_ht+0x1adf1, %rcx
nop
nop
nop
xor %r11, %r11
movl $0x61626364, (%rcx)
nop
nop
dec %r11
lea addresses_D_ht+0xa271, %rsi
lea addresses_normal_ht+0x18c1, %rdi
nop
nop
nop
and %rbx, %rbx
mov $87, %rcx
rep movsq
nop
xor $44846, %rdi
lea addresses_WT_ht+0x1a1f1, %r13
clflush (%r13)
nop
nop
nop
nop
add %r11, %r11
movb $0x61, (%r13)
nop
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_normal_ht+0x1b71, %rbx
nop
nop
nop
add %rsi, %rsi
mov (%rbx), %r8
nop
cmp %r11, %r11
lea addresses_A_ht+0x19af1, %rsi
lea addresses_WC_ht+0x195f1, %rdi
clflush (%rdi)
add %r15, %r15
mov $2, %rcx
rep movsb
nop
add $26755, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r9
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_A+0x5cb1, %r9
clflush (%r9)
nop
dec %r14
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
vmovups %ymm6, (%r9)
nop
nop
lfence
// Store
lea addresses_UC+0xf9b, %r9
clflush (%r9)
nop
nop
nop
dec %rbx
mov $0x5152535455565758, %r14
movq %r14, %xmm5
vmovups %ymm5, (%r9)
nop
nop
nop
nop
nop
xor $63408, %rbp
// Faulty Load
lea addresses_WC+0x1f1f1, %rdx
nop
nop
sub %r15, %r15
movups (%rdx), %xmm0
vpextrq $1, %xmm0, %rsi
lea oracles, %r9
and $0xff, %rsi
shlq $12, %rsi
mov (%r9,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'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
*/
|
C/BiosLib/strcmp.asm | p-k-p/SysToolsLib | 232 | 89573 | <filename>C/BiosLib/strcmp.asm
PAGE ,132
TITLE C library emulation, not relying on MS-DOS.
;*****************************************************************************;
; ;
; FILE NAME: STRCMP.ASM ;
; ;
; DESCRIPTION: C library emulation routines in assembly language ;
; ;
; NOTES: Uses only BIOS calls to work before DOS is available. ;
; ;
; HISTORY: ;
; 1990/11/02 JFL Initial implementation of alibc.asm. ;
; 1991/02/15 JFL Added strcmp. ;
; 1991/06/24 JFL Added routine strncmp. ;
; 1993/10/07 JFL Separated from alibc.c ;
; ;
; (c) Copyright 1990-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
.286
;-----------------------------------------------------------------------------;
; ;
; Globally defined constants ;
; ;
;-----------------------------------------------------------------------------;
include adefine.inc ; All assembly language definitions
;-----------------------------------------------------------------------------;
; ;
; Public routines ;
; ;
;-----------------------------------------------------------------------------;
.code
;=============================================================================;
;
; ENTRY POINT NAME: strcmp & strncmp
;
; DESCRIPTION: Compare two strings
;
; INPUT PARAMETERS
; ARG1 BX = Pointer to the first string
; ARG2 AX = Pointer to the second string
; [ARG3] DX = Max number of characters to compare (strncmp only)
;
; OUTPUT PARAMETERS
; AX First difference, or 0 if they match
;
; REGISTERS DESTROYED: AX, BX, DX
;
; REGISTERS PRESERVED: Others
;
; DEPENDENCIES
;
; ALGORITHM USED
;
; NOTES
;
; MODIFICATION HISTORY NOTES
; JFL 02/15/91 Initial implementation.
; JFL 06/24/91 Added strncmp
;
;=============================================================================;
CFASTPROC strcmp
xor dx, dx ; Compare up to 64 KB chars
; Fall through into strncmp
ENDCFASTPROC strcmp
CFASTPROC strncmp
push si
push cx
mov si, bx ; First pointer in SI
mov bx, ax ; Second pointer in BX
mov cx, dx ; Max count in CX
next_cmp:
lodsb ; First character in AL
; and advance SI
mov dl, byte ptr [bx] ; Second character in DL
inc bx ; Advance BX
test al, al ; First character NUL?
jz done_cmp ; Yes, return difference
test dl, dl ; Second character NUL?
jz done_cmp ; Yes, return difference
cmp al, dl ; Compare the characters
loope next_cmp ; Continue if they're equal
done_cmp:
xor ah, ah ; Convert uchar to signed int
xor dh, dh
sub ax, dx ; Return signed int difference
pop cx
pop si
ret
ENDCFASTPROC strncmp
END
|
src/isa/avx2/masm/vrd2_tan_fma3.asm | jepler/aocl-libm-ose | 66 | 23238 | <reponame>jepler/aocl-libm-ose
;
; Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
; 3. Neither the name of the copyright holder nor the names of its contributors
; may be used to endorse or promote products derived from this software without
; specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
;
include fm.inc
include trig_func.inc
FN_PROTOTYPE_FMA3 vrd2_tan
text SEGMENT EXECUTE
PUBLIC fname
fname PROC FRAME
StackAllocate stack_size
SaveAllXMMRegs
SaveRegsGPR r12,save_r12
SaveRegsGPR r13,save_r13
.ENDPROLOG
vmovupd xmm0, XMMWORD PTR [rcx]
tan_early_exit_s:
VMOVAPD [store_input + rsp],xmm0
VCMPNEQPD xmm1,xmm0,xmm0 ;nan mask xmm1
VANDPD xmm13,xmm0,L__sign_mask ; xmm13 clear sign
VPCMPEQQ xmm2,xmm13,L__inf_mask_64 ;xmm2 has inf mask
VADDPD xmm3,xmm0,xmm0 ;nan value
;xmm4 nan value
VANDNPD xmm11 , xmm1, xmm1
VANDPD xmm4 , xmm3, xmm1
VORPD xmm4 , xmm4, xmm11
VMOVAPD xmm3,L_nan
;xmm12 nan and inf values
VANDNPD xmm11 , xmm2, xmm4
VANDPD xmm12 , xmm3, xmm2
VORPD xmm12 , xmm12, xmm11
VORPD xmm11,xmm2,xmm1 ; xmm11 nan and inf mask
tan_early_exit_s_1:
VMOVDQA xmm7,XMMWORD PTR L_mask_3f_9
VPCMPGTQ xmm7,xmm7,xmm13
VORPD xmm2,xmm7,xmm11
VPTEST xmm2,xmm2
JZ range_reduce
VMOVAPD xmm10,xmm0
VMULPD xmm14,xmm0,xmm0 ;
VMULPD xmm14,xmm14,xmm0 ; xmm1 x3
VFMADD132PD xmm14,xmm0,L_point_333 ; x + x*x*x*0.3333333333333333;
VXORPD xmm3,xmm3,xmm3
VXORPD xmm1,xmm1,xmm1
tan_2fpiby4_s_fma3
VMOVDQA xmm3,XMMWORD PTR L_mask_3e4
VMOVDQA xmm4,XMMWORD PTR L_mask_3f2
VPCMPGTQ xmm3,xmm3,xmm13
VPCMPGTQ xmm4,xmm4,xmm13
VANDNPD xmm1,xmm4,xmm7
VANDPD xmm1,xmm1,xmm0 ; res2
VANDNPD xmm5,xmm3,xmm7
VANDPD xmm5,xmm4,xmm5
VANDPD xmm5,xmm5,xmm14
VANDPD xmm3,xmm3,xmm7
VANDPD xmm3,xmm3,xmm10
VORPD xmm5,xmm5,xmm3 ; res1 amm5
VORPD xmm0,xmm5,xmm1 ; res_pi_4
VANDNPD xmm3 , xmm11, xmm0
VANDPD xmm0 , xmm12, xmm11
VORPD xmm0 , xmm0, xmm3
range_reduce:
VORPD xmm7,xmm7,xmm11
VMOVAPD [res_pi_4 + rsp],xmm0
VMOVAPD [mas_res_pi_4 + rsp],xmm7
VANDNPD xmm0,xmm7,xmm13 ; xmm0 x with the sign cleared
VMOVAPD [input + rsp],xmm0
VCMPGEPD xmm3,xmm0,L_e_5
VPTEST xmm3,xmm3
JZ call_range_e5
call_remainder_2d_piby2_fma3
VMOVAPD [r1 + rsp],xmm0
VMOVAPD [rr1 + rsp],xmm1
VMOVAPD [region1 + rsp],xmm11
call_range_e5:
VMOVAPD xmm0,[input + rsp]
range_e_5_2f_s_fma3
if_not_remainder:
VMOVAPD xmm2,[input + rsp]
VCMPLTPD xmm3,xmm2,L_e_5
VANDNPD xmm2 , xmm3, [r1 + rsp]
VANDPD xmm0 , xmm0, xmm3
VORPD xmm0, xmm0, xmm2
VANDNPD xmm2 , xmm3, [rr1 + rsp]
VANDPD xmm1 , xmm1, xmm3
VORPD xmm1, xmm2, xmm1
VANDNPD xmm2 , xmm3, [region1 + rsp]
VANDPD xmm11 , xmm11, xmm3
VORPD xmm11 , xmm11, xmm2
VANDPD xmm3,xmm11,L_int_one
tan_2fpiby4_s_fma3
ret_tan_2fpiby4_s:
VMOVAPD xmm1,[store_input + rsp]
VANDPD xmm1,xmm1,L_signbit
VXORPD xmm4,xmm1,xmm0
VMOVAPD xmm8,[mas_res_pi_4 + rsp]
VMOVAPD xmm0,[res_pi_4 + rsp]
VANDNPD xmm4 , xmm8, xmm4
VANDPD xmm0 , xmm8, xmm0
VORPD xmm0 , xmm0, xmm4
return_cos_s:
RestoreAllXMMRegs
RestoreRegsGPR r12,save_r12
RestoreRegsGPR r13,save_r13
StackDeallocate stack_size
ret
fname endp
TEXT ENDS
END
|
c2000/C2000Ware_1_00_06_00/libraries/dsp/VCU/c28/source/vcu0/crc/vcu0_crc_32.asm | ramok/Themis_ForHPSDR | 0 | 12910 | ;;*****************************************************************************
;;! \file source/vcu0/vcu0_crc_8.asm
;;!
;;! \brief 32-bit CRC that uses the polynomial 0x04c11db7
;;
;; \date Apr 7, 2011
;;!
;;
;; Group: C2000
;; Target Family: F2837x
;;
;; Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
;; ALL RIGHTS RESERVED
;;*****************************************************************************
;;$TI Release: C28x VCU Library V2.10.00.00 $
;;$Release Date: Oct 18, 2018 $
;;*****************************************************************************
;;
;;*****************************************************************************
;; includes
;;*****************************************************************************
;;
;;*****************************************************************************
;; global defines
;;*****************************************************************************
;; CRC Routine defines
;/*! ASM- function to get the 32-bit CRC
; *
; * \param ACC = The initial value of crc, in case the message has been
; * chopped into several parts, you can use the crc32 of the previous
; * segment as the init value for the current segment crc32 calculation
; * until the final crc is derived.
; * \param *+XAR4 = Address of the message buffer
; * \param AR5 = Parity of the first message byte, i.e. whether its on an even
; * or odd address
; * \param *-SP[1]/AR0 = Length of the message in bytes
; *
; * Calculate the 32-bit CRC of a message buffer by using the VCU instructions
; * VCRC32H_1 and VCRC32L_1
; *
; * \return CRC result in ACC
; */
.def _getCRC32_vcu
_getCRC32_vcu:
PUSH XAR0
PUSH XAR1
MOVZ AR0, *-SP[7] ; load rxLen
ADDB SP, #4 ; allocate 4 words for local
VMOV32 *-SP[2], VCRC ; Store current CRC
VCRCCLR
MOVL *-SP[4], ACC
VMOV32 VCRC,*-SP[4] ; VCRC = Inital value
MOV AL, AR5 ; check the parity
SBF _CRC32_loop_prep, EQ
VCRC32H_1 *XAR4++ ; if parity=1, calculate high byte first
DEC AR0
SBF _CRC32done, EQ
_CRC32_loop_prep:
MOV AL, AR0
MOV AH, AR0
AND AL, #0xFFF8 ; check to see if the length is greater than 8 bytes
BF _CRC32_LSB,EQ
LSR AL, #3 ; loop in 8 bytes
MOV AR1, AL
SUB AR1, #1
.align (2) ; align at 32-bit boundary to remove penalty
RPTB _CRC32_post, AR1 ; loop for the middle part of the packet
VCRC32L_1 *XAR4
VCRC32H_1 *XAR4++
VCRC32L_1 *XAR4
VCRC32H_1 *XAR4++
VCRC32L_1 *XAR4
VCRC32H_1 *XAR4++
VCRC32L_1 *XAR4
VCRC32H_1 *XAR4++
_CRC32_post:
LSL AL, #3 ; calculating remaining number of bytes
SUB AH, AL
SBF _CRC32done, EQ ; if multiple of 8, done
MOV AR0, AH
_CRC32_LSB
VCRC32L_1 *XAR4 ; if parity=0, calculate the low byte
DEC AR0
SBF _CRC32done, EQ
VCRC32H_1 *XAR4++
DEC AR0
SBF _CRC32_LSB, NEQ
_CRC32done
VMOV32 *-SP[4], VCRC ; Store CRC
MOVL ACC, *-SP[4] ; return ACC
VMOV32 VCRC, *-SP[2] ; Restore VCRC
SUBB SP, #4 ; restore stack pointer
POP XAR1
POP XAR0
LRETR
;; End of file
|
oeis/319/A319948.asm | neoneye/loda-programs | 11 | 100017 | <reponame>neoneye/loda-programs
; A319948: a(n) = Product_{i=1..n} floor(3*i/2).
; Submitted by <NAME>
; 1,3,12,72,504,4536,45360,544320,7076160,106142400,1698278400,30569011200,580811212800,12197035468800,268334780313600,6440034727526400,161000868188160000,4347023441080320000,121716656350248960000,3651499690507468800000
mov $1,1
mov $2,1
mov $3,2
lpb $0
sub $0,1
add $3,3
add $2,$3
div $2,2
mul $1,$2
mov $2,1
lpe
mov $0,$1
|
ShellcodeBuilder/shellcode_arm.asm | boogy/ctftools | 3 | 100000 | <reponame>boogy/ctftools<gh_stars>1-10
# Linux/ARM - execve("/bin/sh", [0], [0 vars]) - 27 bytes
# http://shell-storm.org/shellcode/files/shellcode-698.php
.section .text
.global _start
_start:
add r3, pc, #1
bx r3
mov r0, pc
adds r0, #8
subs r1, r1, r1
subs r2, r2, r2
movs r7, #11
svc 1
str r7, [r5, #32]
ldr r1, [r5, #100]
strb r7, [r5, #12]
lsls r0, r5, #1
|
programs/oeis/311/A311932.asm | neoneye/loda | 22 | 165555 | ; A311932: Coordination sequence Gal.6.192.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.
; 1,4,8,13,17,22,26,31,35,40,44,48,52,56,61,65,70,74,79,83,88,92,96,100,104,109,113,118,122,127,131,136,140,144,148,152,157,161,166,170,175,179,184,188,192,196,200,205,209,214
seq $0,314253 ; Coordination sequence Gal.6.627.1 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.
mov $1,$0
add $0,6
add $1,2
sub $2,$1
div $2,2
add $0,$2
div $0,2
sub $0,$2
sub $0,3
|
.config/alfred/Alfred.alfredpreferences/workflows/user.workflow.D27B6AD4-C1F8-4105-8C0B-0E52489E70FE/app_Contacts.applescript | kuanger/dotfiles | 1 | 2902 | <gh_stars>1-10
on getTitle()
tell application id "com.apple.AddressBook"
set theContacts to selection
return name of first item of theContacts
end tell
end getTitle
on getBody()
tell application id "com.apple.AddressBook"
set theContacts to selection
return "addressbook://" & id of first item of theContacts
end tell
end getBody |
Validation/pyFrame3DD-master/gcc-master/gcc/ada/ali.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 11866 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A L I --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Butil; use Butil;
with Debug; use Debug;
with Fname; use Fname;
with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
with Snames; use Snames;
with GNAT; use GNAT;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
package body ALI is
use ASCII;
-- Make control characters visible
-----------
-- Types --
-----------
-- The following type represents an invocation construct
type Invocation_Construct_Record is record
Body_Placement : Declaration_Placement_Kind := No_Declaration_Placement;
-- The location of the invocation construct's body with respect to the
-- unit where it is declared.
Kind : Invocation_Construct_Kind := Regular_Construct;
-- The nature of the invocation construct
Signature : Invocation_Signature_Id := No_Invocation_Signature;
-- The invocation signature that uniquely identifies the invocation
-- construct in the ALI space.
Spec_Placement : Declaration_Placement_Kind := No_Declaration_Placement;
-- The location of the invocation construct's spec with respect to the
-- unit where it is declared.
end record;
-- The following type represents an invocation relation. It associates an
-- invoker that activates/calls/instantiates with a target.
type Invocation_Relation_Record is record
Extra : Name_Id := No_Name;
-- The name of an additional entity used in error diagnostics
Invoker : Invocation_Signature_Id := No_Invocation_Signature;
-- The invocation signature that uniquely identifies the invoker within
-- the ALI space.
Kind : Invocation_Kind := No_Invocation;
-- The nature of the invocation
Target : Invocation_Signature_Id := No_Invocation_Signature;
-- The invocation signature that uniquely identifies the target within
-- the ALI space.
end record;
-- The following type represents an invocation signature. Its purpose is
-- to uniquely identify an invocation construct within the ALI space. The
-- signature comprises several pieces, some of which are used in error
-- diagnostics by the binder. Identification issues are resolved as
-- follows:
--
-- * The Column, Line, and Locations attributes together differentiate
-- between homonyms. In most cases, the Column and Line are sufficient
-- except when generic instantiations are involved. Together, the three
-- attributes offer a sequence of column-line pairs that eventually
-- reflect the location within the generic template.
--
-- * The Name attribute differentiates between invocation constructs at
-- the scope level. Since it is illegal for two entities with the same
-- name to coexist in the same scope, the Name attribute is sufficient
-- to distinguish them. Overloaded entities are already handled by the
-- Column, Line, and Locations attributes.
--
-- * The Scope attribute differentiates between invocation constructs at
-- various levels of nesting.
type Invocation_Signature_Record is record
Column : Nat := 0;
-- The column number where the invocation construct is declared
Line : Nat := 0;
-- The line number where the invocation construct is declared
Locations : Name_Id := No_Name;
-- Sequence of column and line numbers within nested instantiations
Name : Name_Id := No_Name;
-- The name of the invocation construct
Scope : Name_Id := No_Name;
-- The qualified name of the scope where the invocation construct is
-- declared.
end record;
---------------------
-- Data structures --
---------------------
package Invocation_Constructs is new Table.Table
(Table_Index_Type => Invocation_Construct_Id,
Table_Component_Type => Invocation_Construct_Record,
Table_Low_Bound => First_Invocation_Construct,
Table_Initial => 2500,
Table_Increment => 200,
Table_Name => "Invocation_Constructs");
package Invocation_Relations is new Table.Table
(Table_Index_Type => Invocation_Relation_Id,
Table_Component_Type => Invocation_Relation_Record,
Table_Low_Bound => First_Invocation_Relation,
Table_Initial => 2500,
Table_Increment => 200,
Table_Name => "Invocation_Relation");
package Invocation_Signatures is new Table.Table
(Table_Index_Type => Invocation_Signature_Id,
Table_Component_Type => Invocation_Signature_Record,
Table_Low_Bound => First_Invocation_Signature,
Table_Initial => 2500,
Table_Increment => 200,
Table_Name => "Invocation_Signatures");
procedure Destroy (IS_Id : in out Invocation_Signature_Id);
-- Destroy an invocation signature with id IS_Id
function Hash
(IS_Rec : Invocation_Signature_Record) return Bucket_Range_Type;
-- Obtain the hash of key IS_Rec
package Sig_Map is new Dynamic_Hash_Tables
(Key_Type => Invocation_Signature_Record,
Value_Type => Invocation_Signature_Id,
No_Value => No_Invocation_Signature,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => "=",
Destroy_Value => Destroy,
Hash => Hash);
-- The following map relates invocation signature records to invocation
-- signature ids.
Sig_To_Sig_Map : constant Sig_Map.Dynamic_Hash_Table :=
Sig_Map.Create (500);
-- The folowing table maps declaration placement kinds to character codes
-- for invocation construct encoding in ALI files.
Declaration_Placement_Codes :
constant array (Declaration_Placement_Kind) of Character :=
(In_Body => 'b',
In_Spec => 's',
No_Declaration_Placement => 'Z');
Compile_Time_Invocation_Graph_Encoding : Invocation_Graph_Encoding_Kind :=
No_Encoding;
-- The invocation-graph encoding format as specified at compile time. Do
-- not manipulate this value directly.
-- The following table maps invocation kinds to character codes for
-- invocation relation encoding in ALI files.
Invocation_Codes :
constant array (Invocation_Kind) of Character :=
(Accept_Alternative => 'a',
Access_Taken => 'b',
Call => 'c',
Controlled_Adjustment => 'd',
Controlled_Finalization => 'e',
Controlled_Initialization => 'f',
Default_Initial_Condition_Verification => 'g',
Initial_Condition_Verification => 'h',
Instantiation => 'i',
Internal_Controlled_Adjustment => 'j',
Internal_Controlled_Finalization => 'k',
Internal_Controlled_Initialization => 'l',
Invariant_Verification => 'm',
Postcondition_Verification => 'n',
Protected_Entry_Call => 'o',
Protected_Subprogram_Call => 'p',
Task_Activation => 'q',
Task_Entry_Call => 'r',
Type_Initialization => 's',
No_Invocation => 'Z');
-- The following table maps invocation construct kinds to character codes
-- for invocation construct encoding in ALI files.
Invocation_Construct_Codes :
constant array (Invocation_Construct_Kind) of Character :=
(Elaborate_Body_Procedure => 'b',
Elaborate_Spec_Procedure => 's',
Regular_Construct => 'Z');
-- The following table maps invocation-graph encoding kinds to character
-- codes for invocation-graph encoding in ALI files.
Invocation_Graph_Encoding_Codes :
constant array (Invocation_Graph_Encoding_Kind) of Character :=
(Full_Path_Encoding => 'f',
Endpoints_Encoding => 'e',
No_Encoding => 'Z');
-- The following table maps invocation-graph line kinds to character codes
-- used in ALI files.
Invocation_Graph_Line_Codes :
constant array (Invocation_Graph_Line_Kind) of Character :=
(Invocation_Construct_Line => 'c',
Invocation_Graph_Attributes_Line => 'a',
Invocation_Relation_Line => 'r');
-- The following variable records which characters currently are used as
-- line type markers in the ALI file. This is used in Scan_ALI to detect
-- (or skip) invalid lines.
Known_ALI_Lines : constant array (Character range 'A' .. 'Z') of Boolean :=
('A' | -- argument
'C' | -- SCO information
'D' | -- dependency
'E' | -- external
'G' | -- invocation graph
'I' | -- interrupt
'L' | -- linker option
'M' | -- main program
'N' | -- notes
'P' | -- program
'R' | -- restriction
'S' | -- specific dispatching
'T' | -- task stack information
'U' | -- unit
'V' | -- version
'W' | -- with
'X' | -- xref
'Y' | -- limited_with
'Z' -- implicit with from instantiation
=> True,
-- Still available:
'B' | 'F' | 'H' | 'J' | 'K' | 'O' | 'Q' => False);
------------------------------
-- Add_Invocation_Construct --
------------------------------
procedure Add_Invocation_Construct
(Body_Placement : Declaration_Placement_Kind;
Kind : Invocation_Construct_Kind;
Signature : Invocation_Signature_Id;
Spec_Placement : Declaration_Placement_Kind;
Update_Units : Boolean := True)
is
begin
pragma Assert (Present (Signature));
-- Create a invocation construct from the scanned attributes
Invocation_Constructs.Append
((Body_Placement => Body_Placement,
Kind => Kind,
Signature => Signature,
Spec_Placement => Spec_Placement));
-- Update the invocation construct counter of the current unit only when
-- requested by the caller.
if Update_Units then
declare
Curr_Unit : Unit_Record renames Units.Table (Units.Last);
begin
Curr_Unit.Last_Invocation_Construct := Invocation_Constructs.Last;
end;
end if;
end Add_Invocation_Construct;
-----------------------------
-- Add_Invocation_Relation --
-----------------------------
procedure Add_Invocation_Relation
(Extra : Name_Id;
Invoker : Invocation_Signature_Id;
Kind : Invocation_Kind;
Target : Invocation_Signature_Id;
Update_Units : Boolean := True)
is
begin
pragma Assert (Present (Invoker));
pragma Assert (Kind /= No_Invocation);
pragma Assert (Present (Target));
-- Create an invocation relation from the scanned attributes
Invocation_Relations.Append
((Extra => Extra,
Invoker => Invoker,
Kind => Kind,
Target => Target));
-- Update the invocation relation counter of the current unit only when
-- requested by the caller.
if Update_Units then
declare
Curr_Unit : Unit_Record renames Units.Table (Units.Last);
begin
Curr_Unit.Last_Invocation_Relation := Invocation_Relations.Last;
end;
end if;
end Add_Invocation_Relation;
--------------------
-- Body_Placement --
--------------------
function Body_Placement
(IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind
is
begin
pragma Assert (Present (IC_Id));
return Invocation_Constructs.Table (IC_Id).Body_Placement;
end Body_Placement;
----------------------------------------
-- Code_To_Declaration_Placement_Kind --
----------------------------------------
function Code_To_Declaration_Placement_Kind
(Code : Character) return Declaration_Placement_Kind
is
begin
-- Determine which placement kind corresponds to the character code by
-- traversing the contents of the mapping table.
for Kind in Declaration_Placement_Kind loop
if Declaration_Placement_Codes (Kind) = Code then
return Kind;
end if;
end loop;
raise Program_Error;
end Code_To_Declaration_Placement_Kind;
---------------------------------------
-- Code_To_Invocation_Construct_Kind --
---------------------------------------
function Code_To_Invocation_Construct_Kind
(Code : Character) return Invocation_Construct_Kind
is
begin
-- Determine which invocation construct kind matches the character code
-- by traversing the contents of the mapping table.
for Kind in Invocation_Construct_Kind loop
if Invocation_Construct_Codes (Kind) = Code then
return Kind;
end if;
end loop;
raise Program_Error;
end Code_To_Invocation_Construct_Kind;
--------------------------------------------
-- Code_To_Invocation_Graph_Encoding_Kind --
--------------------------------------------
function Code_To_Invocation_Graph_Encoding_Kind
(Code : Character) return Invocation_Graph_Encoding_Kind
is
begin
-- Determine which invocation-graph encoding kind matches the character
-- code by traversing the contents of the mapping table.
for Kind in Invocation_Graph_Encoding_Kind loop
if Invocation_Graph_Encoding_Codes (Kind) = Code then
return Kind;
end if;
end loop;
raise Program_Error;
end Code_To_Invocation_Graph_Encoding_Kind;
-----------------------------
-- Code_To_Invocation_Kind --
-----------------------------
function Code_To_Invocation_Kind
(Code : Character) return Invocation_Kind
is
begin
-- Determine which invocation kind corresponds to the character code by
-- traversing the contents of the mapping table.
for Kind in Invocation_Kind loop
if Invocation_Codes (Kind) = Code then
return Kind;
end if;
end loop;
raise Program_Error;
end Code_To_Invocation_Kind;
----------------------------------------
-- Code_To_Invocation_Graph_Line_Kind --
----------------------------------------
function Code_To_Invocation_Graph_Line_Kind
(Code : Character) return Invocation_Graph_Line_Kind
is
begin
-- Determine which invocation-graph line kind matches the character
-- code by traversing the contents of the mapping table.
for Kind in Invocation_Graph_Line_Kind loop
if Invocation_Graph_Line_Codes (Kind) = Code then
return Kind;
end if;
end loop;
raise Program_Error;
end Code_To_Invocation_Graph_Line_Kind;
------------
-- Column --
------------
function Column (IS_Id : Invocation_Signature_Id) return Nat is
begin
pragma Assert (Present (IS_Id));
return Invocation_Signatures.Table (IS_Id).Column;
end Column;
----------------------------------------
-- Declaration_Placement_Kind_To_Code --
----------------------------------------
function Declaration_Placement_Kind_To_Code
(Kind : Declaration_Placement_Kind) return Character
is
begin
return Declaration_Placement_Codes (Kind);
end Declaration_Placement_Kind_To_Code;
-------------
-- Destroy --
-------------
procedure Destroy (IS_Id : in out Invocation_Signature_Id) is
pragma Unreferenced (IS_Id);
begin
null;
end Destroy;
-----------
-- Extra --
-----------
function Extra (IR_Id : Invocation_Relation_Id) return Name_Id is
begin
pragma Assert (Present (IR_Id));
return Invocation_Relations.Table (IR_Id).Extra;
end Extra;
-----------------------------------
-- For_Each_Invocation_Construct --
-----------------------------------
procedure For_Each_Invocation_Construct
(Processor : Invocation_Construct_Processor_Ptr)
is
begin
pragma Assert (Processor /= null);
for IC_Id in Invocation_Constructs.First ..
Invocation_Constructs.Last
loop
Processor.all (IC_Id);
end loop;
end For_Each_Invocation_Construct;
-----------------------------------
-- For_Each_Invocation_Construct --
-----------------------------------
procedure For_Each_Invocation_Construct
(U_Id : Unit_Id;
Processor : Invocation_Construct_Processor_Ptr)
is
pragma Assert (Present (U_Id));
pragma Assert (Processor /= null);
U_Rec : Unit_Record renames Units.Table (U_Id);
begin
for IC_Id in U_Rec.First_Invocation_Construct ..
U_Rec.Last_Invocation_Construct
loop
Processor.all (IC_Id);
end loop;
end For_Each_Invocation_Construct;
----------------------------------
-- For_Each_Invocation_Relation --
----------------------------------
procedure For_Each_Invocation_Relation
(Processor : Invocation_Relation_Processor_Ptr)
is
begin
pragma Assert (Processor /= null);
for IR_Id in Invocation_Relations.First ..
Invocation_Relations.Last
loop
Processor.all (IR_Id);
end loop;
end For_Each_Invocation_Relation;
----------------------------------
-- For_Each_Invocation_Relation --
----------------------------------
procedure For_Each_Invocation_Relation
(U_Id : Unit_Id;
Processor : Invocation_Relation_Processor_Ptr)
is
pragma Assert (Present (U_Id));
pragma Assert (Processor /= null);
U_Rec : Unit_Record renames Units.Table (U_Id);
begin
for IR_Id in U_Rec.First_Invocation_Relation ..
U_Rec.Last_Invocation_Relation
loop
Processor.all (IR_Id);
end loop;
end For_Each_Invocation_Relation;
----------
-- Hash --
----------
function Hash
(IS_Rec : Invocation_Signature_Record) return Bucket_Range_Type
is
Buffer : Bounded_String (2052);
IS_Nam : Name_Id;
begin
-- The hash is obtained in the following manner:
--
-- * A String signature based on the scope, name, line number, column
-- number, and locations, in the following format:
--
-- scope__name__line_column__locations
--
-- * The String is converted into a Name_Id
--
-- * The absolute value of the Name_Id is used as the hash
Append (Buffer, IS_Rec.Scope);
Append (Buffer, "__");
Append (Buffer, IS_Rec.Name);
Append (Buffer, "__");
Append (Buffer, IS_Rec.Line);
Append (Buffer, '_');
Append (Buffer, IS_Rec.Column);
if IS_Rec.Locations /= No_Name then
Append (Buffer, "__");
Append (Buffer, IS_Rec.Locations);
end if;
IS_Nam := Name_Find (Buffer);
return Bucket_Range_Type (abs IS_Nam);
end Hash;
--------------------
-- Initialize_ALI --
--------------------
procedure Initialize_ALI is
begin
-- When (re)initializing ALI data structures the ALI user expects to
-- get a fresh set of data structures. Thus we first need to erase the
-- marks put in the name table by the previous set of ALI routine calls.
-- These two loops are empty and harmless the first time in.
for J in ALIs.First .. ALIs.Last loop
Set_Name_Table_Int (ALIs.Table (J).Afile, 0);
end loop;
for J in Units.First .. Units.Last loop
Set_Name_Table_Int (Units.Table (J).Uname, 0);
end loop;
-- Free argument table strings
for J in Args.First .. Args.Last loop
Free (Args.Table (J));
end loop;
-- Initialize all tables
ALIs.Init;
Invocation_Constructs.Init;
Invocation_Relations.Init;
Invocation_Signatures.Init;
Linker_Options.Init;
No_Deps.Init;
Notes.Init;
Sdep.Init;
Units.Init;
Version_Ref.Reset;
Withs.Init;
Xref_Entity.Init;
Xref.Init;
Xref_Section.Init;
-- Add dummy zeroth item in Linker_Options and Notes for sort calls
Linker_Options.Increment_Last;
Notes.Increment_Last;
-- Initialize global variables recording cumulative options in all
-- ALI files that are read for a given processing run in gnatbind.
Dynamic_Elaboration_Checks_Specified := False;
Locking_Policy_Specified := ' ';
No_Normalize_Scalars_Specified := False;
No_Object_Specified := False;
No_Component_Reordering_Specified := False;
GNATprove_Mode_Specified := False;
Normalize_Scalars_Specified := False;
Partition_Elaboration_Policy_Specified := ' ';
Queuing_Policy_Specified := ' ';
SSO_Default_Specified := False;
Task_Dispatching_Policy_Specified := ' ';
Unreserve_All_Interrupts_Specified := False;
Frontend_Exceptions_Specified := False;
Zero_Cost_Exceptions_Specified := False;
end Initialize_ALI;
---------------------------------------
-- Invocation_Construct_Kind_To_Code --
---------------------------------------
function Invocation_Construct_Kind_To_Code
(Kind : Invocation_Construct_Kind) return Character
is
begin
return Invocation_Construct_Codes (Kind);
end Invocation_Construct_Kind_To_Code;
-------------------------------
-- Invocation_Graph_Encoding --
-------------------------------
function Invocation_Graph_Encoding return Invocation_Graph_Encoding_Kind is
begin
return Compile_Time_Invocation_Graph_Encoding;
end Invocation_Graph_Encoding;
--------------------------------------------
-- Invocation_Graph_Encoding_Kind_To_Code --
--------------------------------------------
function Invocation_Graph_Encoding_Kind_To_Code
(Kind : Invocation_Graph_Encoding_Kind) return Character
is
begin
return Invocation_Graph_Encoding_Codes (Kind);
end Invocation_Graph_Encoding_Kind_To_Code;
----------------------------------------
-- Invocation_Graph_Line_Kind_To_Code --
----------------------------------------
function Invocation_Graph_Line_Kind_To_Code
(Kind : Invocation_Graph_Line_Kind) return Character
is
begin
return Invocation_Graph_Line_Codes (Kind);
end Invocation_Graph_Line_Kind_To_Code;
-----------------------------
-- Invocation_Kind_To_Code --
-----------------------------
function Invocation_Kind_To_Code
(Kind : Invocation_Kind) return Character
is
begin
return Invocation_Codes (Kind);
end Invocation_Kind_To_Code;
-----------------------------
-- Invocation_Signature_Of --
-----------------------------
function Invocation_Signature_Of
(Column : Nat;
Line : Nat;
Locations : Name_Id;
Name : Name_Id;
Scope : Name_Id) return Invocation_Signature_Id
is
IS_Rec : constant Invocation_Signature_Record :=
(Column => Column,
Line => Line,
Locations => Locations,
Name => Name,
Scope => Scope);
IS_Id : Invocation_Signature_Id;
begin
IS_Id := Sig_Map.Get (Sig_To_Sig_Map, IS_Rec);
-- The invocation signature lacks an id. This indicates that it
-- is encountered for the first time during the construction of
-- the graph.
if not Present (IS_Id) then
Invocation_Signatures.Append (IS_Rec);
IS_Id := Invocation_Signatures.Last;
-- Map the invocation signature record to its corresponding id
Sig_Map.Put (Sig_To_Sig_Map, IS_Rec, IS_Id);
end if;
return IS_Id;
end Invocation_Signature_Of;
-------------
-- Invoker --
-------------
function Invoker
(IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id
is
begin
pragma Assert (Present (IR_Id));
return Invocation_Relations.Table (IR_Id).Invoker;
end Invoker;
----------
-- Kind --
----------
function Kind
(IC_Id : Invocation_Construct_Id) return Invocation_Construct_Kind
is
begin
pragma Assert (Present (IC_Id));
return Invocation_Constructs.Table (IC_Id).Kind;
end Kind;
----------
-- Kind --
----------
function Kind (IR_Id : Invocation_Relation_Id) return Invocation_Kind is
begin
pragma Assert (Present (IR_Id));
return Invocation_Relations.Table (IR_Id).Kind;
end Kind;
----------
-- Line --
----------
function Line (IS_Id : Invocation_Signature_Id) return Nat is
begin
pragma Assert (Present (IS_Id));
return Invocation_Signatures.Table (IS_Id).Line;
end Line;
---------------
-- Locations --
---------------
function Locations (IS_Id : Invocation_Signature_Id) return Name_Id is
begin
pragma Assert (Present (IS_Id));
return Invocation_Signatures.Table (IS_Id).Locations;
end Locations;
----------
-- Name --
----------
function Name (IS_Id : Invocation_Signature_Id) return Name_Id is
begin
pragma Assert (Present (IS_Id));
return Invocation_Signatures.Table (IS_Id).Name;
end Name;
-------------
-- Present --
-------------
function Present (IC_Id : Invocation_Construct_Id) return Boolean is
begin
return IC_Id /= No_Invocation_Construct;
end Present;
-------------
-- Present --
-------------
function Present (IR_Id : Invocation_Relation_Id) return Boolean is
begin
return IR_Id /= No_Invocation_Relation;
end Present;
-------------
-- Present --
-------------
function Present (IS_Id : Invocation_Signature_Id) return Boolean is
begin
return IS_Id /= No_Invocation_Signature;
end Present;
-------------
-- Present --
-------------
function Present (Dep : Sdep_Id) return Boolean is
begin
return Dep /= No_Sdep_Id;
end Present;
-------------
-- Present --
-------------
function Present (U_Id : Unit_Id) return Boolean is
begin
return U_Id /= No_Unit_Id;
end Present;
-------------
-- Present --
-------------
function Present (W_Id : With_Id) return Boolean is
begin
return W_Id /= No_With_Id;
end Present;
--------------
-- Scan_ALI --
--------------
function Scan_ALI
(F : File_Name_Type;
T : Text_Buffer_Ptr;
Ignore_ED : Boolean;
Err : Boolean;
Read_Xref : Boolean := False;
Read_Lines : String := "";
Ignore_Lines : String := "X";
Ignore_Errors : Boolean := False;
Directly_Scanned : Boolean := False) return ALI_Id
is
P : Text_Ptr := T'First;
Line : Logical_Line_Number := 1;
Id : ALI_Id;
C : Character;
NS_Found : Boolean;
First_Arg : Arg_Id;
Ignore : array (Character range 'A' .. 'Z') of Boolean;
-- Ignore (X) is set to True if lines starting with X are to
-- be ignored by Scan_ALI and skipped, and False if the lines
-- are to be read and processed.
Bad_ALI_Format : exception;
-- Exception raised by Fatal_Error if Err is True
function At_Eol return Boolean;
-- Test if at end of line
function At_End_Of_Field return Boolean;
-- Test if at end of line, or if at blank or horizontal tab
procedure Check_At_End_Of_Field;
-- Check if we are at end of field, fatal error if not
procedure Checkc (C : Character);
-- Check next character is C. If so bump past it, if not fatal error
procedure Check_Unknown_Line;
-- If Ignore_Errors mode, then checks C to make sure that it is not
-- an unknown ALI line type characters, and if so, skips lines
-- until the first character of the line is one of these characters,
-- at which point it does a Getc to put that character in C. The
-- call has no effect if C is already an appropriate character.
-- If not in Ignore_Errors mode, a fatal error is signalled if the
-- line is unknown. Note that if C is an EOL on entry, the line is
-- skipped (it is assumed that blank lines are never significant).
-- If C is EOF on entry, the call has no effect (it is assumed that
-- the caller will properly handle this case).
procedure Fatal_Error;
-- Generate fatal error message for badly formatted ALI file if
-- Err is false, or raise Bad_ALI_Format if Err is True.
procedure Fatal_Error_Ignore;
pragma Inline (Fatal_Error_Ignore);
-- In Ignore_Errors mode, has no effect, otherwise same as Fatal_Error
function Getc return Character;
-- Get next character, bumping P past the character obtained
function Get_File_Name
(Lower : Boolean := False;
May_Be_Quoted : Boolean := False) return File_Name_Type;
-- Skip blanks, then scan out a file name (name is left in Name_Buffer
-- with length in Name_Len, as well as returning a File_Name_Type value.
-- If May_Be_Quoted is True and the first non blank character is '"',
-- then remove starting and ending quotes and undoubled internal quotes.
-- If lower is false, the case is unchanged, if Lower is True then the
-- result is forced to all lower case for systems where file names are
-- not case sensitive. This ensures that gnatbind works correctly
-- regardless of the case of the file name on all systems. The scan
-- is terminated by a end of line, space or horizontal tab. Any other
-- special characters are included in the returned name.
function Get_Name
(Ignore_Spaces : Boolean := False;
Ignore_Special : Boolean := False;
May_Be_Quoted : Boolean := False) return Name_Id;
-- Skip blanks, then scan out a name (name is left in Name_Buffer with
-- length in Name_Len, as well as being returned in Name_Id form).
-- If Lower is set to True then the Name_Buffer will be converted to
-- all lower case, for systems where file names are not case sensitive.
-- This ensures that gnatbind works correctly regardless of the case
-- of the file name on all systems. The termination condition depends
-- on the settings of Ignore_Spaces and Ignore_Special:
--
-- If Ignore_Spaces is False (normal case), then scan is terminated
-- by the normal end of field condition (EOL, space, horizontal tab)
--
-- If Ignore_Special is False (normal case), the scan is terminated by
-- a typeref bracket or an equal sign except for the special case of
-- an operator name starting with a double quote that is terminated
-- by another double quote.
--
-- If May_Be_Quoted is True and the first non blank character is '"'
-- the name is 'unquoted'. In this case Ignore_Special is ignored and
-- assumed to be True.
--
-- It is an error to set both Ignore_Spaces and Ignore_Special to True.
-- This function handles wide characters properly.
function Get_Nat return Nat;
-- Skip blanks, then scan out an unsigned integer value in Nat range
-- raises ALI_Reading_Error if the encoutered type is not natural.
function Get_Stamp return Time_Stamp_Type;
-- Skip blanks, then scan out a time stamp
function Get_Unit_Name return Unit_Name_Type;
-- Skip blanks, then scan out a file name (name is left in Name_Buffer
-- with length in Name_Len, as well as returning a Unit_Name_Type value.
-- The case is unchanged and terminated by a normal end of field.
function Nextc return Character;
-- Return current character without modifying pointer P
procedure Get_Typeref
(Current_File_Num : Sdep_Id;
Ref : out Tref_Kind;
File_Num : out Sdep_Id;
Line : out Nat;
Ref_Type : out Character;
Col : out Nat;
Standard_Entity : out Name_Id);
-- Parse the definition of a typeref (<...>, {...} or (...))
procedure Scan_Invocation_Graph_Line;
-- Parse a single line that encodes a piece of the invocation graph
procedure Skip_Eol;
-- Skip past spaces, then skip past end of line (fatal error if not
-- at end of line). Also skips past any following blank lines.
procedure Skip_Line;
-- Skip rest of current line and any following blank lines
procedure Skip_Space;
-- Skip past white space (blanks or horizontal tab)
procedure Skipc;
-- Skip past next character, does not affect value in C. This call
-- is like calling Getc and ignoring the returned result.
---------------------
-- At_End_Of_Field --
---------------------
function At_End_Of_Field return Boolean is
begin
return Nextc <= ' ';
end At_End_Of_Field;
------------
-- At_Eol --
------------
function At_Eol return Boolean is
begin
return Nextc = EOF or else Nextc = CR or else Nextc = LF;
end At_Eol;
---------------------------
-- Check_At_End_Of_Field --
---------------------------
procedure Check_At_End_Of_Field is
begin
if not At_End_Of_Field then
if Ignore_Errors then
while Nextc > ' ' loop
P := P + 1;
end loop;
else
Fatal_Error;
end if;
end if;
end Check_At_End_Of_Field;
------------------------
-- Check_Unknown_Line --
------------------------
procedure Check_Unknown_Line is
begin
while C not in 'A' .. 'Z'
or else not Known_ALI_Lines (C)
loop
if C = CR or else C = LF then
Skip_Line;
C := Nextc;
elsif C = EOF then
return;
elsif Ignore_Errors then
Skip_Line;
C := Getc;
else
Fatal_Error;
end if;
end loop;
end Check_Unknown_Line;
------------
-- Checkc --
------------
procedure Checkc (C : Character) is
begin
if Nextc = C then
P := P + 1;
elsif Ignore_Errors then
P := P + 1;
else
Fatal_Error;
end if;
end Checkc;
-----------------
-- Fatal_Error --
-----------------
procedure Fatal_Error is
Ptr1 : Text_Ptr;
Ptr2 : Text_Ptr;
Col : Int;
procedure Wchar (C : Character);
-- Write a single character, replacing horizontal tab by spaces
procedure Wchar (C : Character) is
begin
if C = HT then
loop
Wchar (' ');
exit when Col mod 8 = 0;
end loop;
else
Write_Char (C);
Col := Col + 1;
end if;
end Wchar;
-- Start of processing for Fatal_Error
begin
if Err then
raise Bad_ALI_Format;
end if;
Set_Standard_Error;
Write_Str ("fatal error: file ");
Write_Name (F);
Write_Str (" is incorrectly formatted");
Write_Eol;
Write_Str ("make sure you are using consistent versions " &
-- Split the following line so that it can easily be transformed for
-- other back-ends where the compiler might have a different name.
"of gcc/gnatbind");
Write_Eol;
-- Find start of line
Ptr1 := P;
while Ptr1 > T'First
and then T (Ptr1 - 1) /= CR
and then T (Ptr1 - 1) /= LF
loop
Ptr1 := Ptr1 - 1;
end loop;
Write_Int (Int (Line));
Write_Str (". ");
if Line < 100 then
Write_Char (' ');
end if;
if Line < 10 then
Write_Char (' ');
end if;
Col := 0;
Ptr2 := Ptr1;
while Ptr2 < T'Last
and then T (Ptr2) /= CR
and then T (Ptr2) /= LF
loop
Wchar (T (Ptr2));
Ptr2 := Ptr2 + 1;
end loop;
Write_Eol;
Write_Str (" ");
Col := 0;
while Ptr1 < P loop
if T (Ptr1) = HT then
Wchar (HT);
else
Wchar (' ');
end if;
Ptr1 := Ptr1 + 1;
end loop;
Wchar ('|');
Write_Eol;
Exit_Program (E_Fatal);
end Fatal_Error;
------------------------
-- Fatal_Error_Ignore --
------------------------
procedure Fatal_Error_Ignore is
begin
if not Ignore_Errors then
Fatal_Error;
end if;
end Fatal_Error_Ignore;
-------------------
-- Get_File_Name --
-------------------
function Get_File_Name
(Lower : Boolean := False;
May_Be_Quoted : Boolean := False) return File_Name_Type
is
F : Name_Id;
begin
F := Get_Name (Ignore_Special => True,
May_Be_Quoted => May_Be_Quoted);
-- Convert file name to all lower case if file names are not case
-- sensitive. This ensures that we handle names in the canonical
-- lower case format, regardless of the actual case.
if Lower and not File_Names_Case_Sensitive then
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
return Name_Find;
else
return File_Name_Type (F);
end if;
end Get_File_Name;
--------------
-- Get_Name --
--------------
function Get_Name
(Ignore_Spaces : Boolean := False;
Ignore_Special : Boolean := False;
May_Be_Quoted : Boolean := False) return Name_Id
is
Char : Character;
begin
Name_Len := 0;
Skip_Space;
if At_Eol then
if Ignore_Errors then
return Error_Name;
else
Fatal_Error;
end if;
end if;
Char := Getc;
-- Deal with quoted characters
if May_Be_Quoted and then Char = '"' then
loop
if At_Eol then
if Ignore_Errors then
return Error_Name;
else
Fatal_Error;
end if;
end if;
Char := Getc;
if Char = '"' then
if At_Eol then
exit;
else
Char := Getc;
if Char /= '"' then
P := P - 1;
exit;
end if;
end if;
end if;
Add_Char_To_Name_Buffer (Char);
end loop;
-- Other than case of quoted character
else
P := P - 1;
loop
Add_Char_To_Name_Buffer (Getc);
exit when At_End_Of_Field and then not Ignore_Spaces;
if not Ignore_Special then
if Name_Buffer (1) = '"' then
exit when Name_Len > 1
and then Name_Buffer (Name_Len) = '"';
else
-- Terminate on parens or angle brackets or equal sign
exit when Nextc = '(' or else Nextc = ')'
or else Nextc = '{' or else Nextc = '}'
or else Nextc = '<' or else Nextc = '>'
or else Nextc = '=';
-- Terminate on comma
exit when Nextc = ',';
-- Terminate if left bracket not part of wide char
-- sequence Note that we only recognize brackets
-- notation so far ???
exit when Nextc = '[' and then T (P + 1) /= '"';
-- Terminate if right bracket not part of wide char
-- sequence.
exit when Nextc = ']' and then T (P - 1) /= '"';
end if;
end if;
end loop;
end if;
return Name_Find;
end Get_Name;
-------------------
-- Get_Unit_Name --
-------------------
function Get_Unit_Name return Unit_Name_Type is
begin
return Unit_Name_Type (Get_Name);
end Get_Unit_Name;
-------------
-- Get_Nat --
-------------
function Get_Nat return Nat is
V : Nat;
begin
Skip_Space;
-- Check if we are on a number. In the case of bad ALI files, this
-- may not be true.
if not (Nextc in '0' .. '9') then
Fatal_Error;
end if;
V := 0;
loop
V := V * 10 + (Character'Pos (Getc) - Character'Pos ('0'));
exit when At_End_Of_Field;
exit when Nextc < '0' or else Nextc > '9';
end loop;
return V;
end Get_Nat;
---------------
-- Get_Stamp --
---------------
function Get_Stamp return Time_Stamp_Type is
T : Time_Stamp_Type;
Start : Integer;
begin
Skip_Space;
if At_Eol then
if Ignore_Errors then
return Dummy_Time_Stamp;
else
Fatal_Error;
end if;
end if;
-- Following reads old style time stamp missing first two digits
if Nextc in '7' .. '9' then
T (1) := '1';
T (2) := '9';
Start := 3;
-- Normal case of full year in time stamp
else
Start := 1;
end if;
for J in Start .. T'Last loop
T (J) := Getc;
end loop;
return T;
end Get_Stamp;
-----------------
-- Get_Typeref --
-----------------
procedure Get_Typeref
(Current_File_Num : Sdep_Id;
Ref : out Tref_Kind;
File_Num : out Sdep_Id;
Line : out Nat;
Ref_Type : out Character;
Col : out Nat;
Standard_Entity : out Name_Id)
is
N : Nat;
begin
case Nextc is
when '<' => Ref := Tref_Derived;
when '(' => Ref := Tref_Access;
when '{' => Ref := Tref_Type;
when others => Ref := Tref_None;
end case;
-- Case of typeref field present
if Ref /= Tref_None then
P := P + 1; -- skip opening bracket
if Nextc in 'a' .. 'z' then
File_Num := No_Sdep_Id;
Line := 0;
Ref_Type := ' ';
Col := 0;
Standard_Entity := Get_Name (Ignore_Spaces => True);
else
N := Get_Nat;
if Nextc = '|' then
File_Num := Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
P := P + 1;
N := Get_Nat;
else
File_Num := Current_File_Num;
end if;
Line := N;
Ref_Type := Getc;
Col := Get_Nat;
Standard_Entity := No_Name;
end if;
-- ??? Temporary workaround for nested generics case:
-- 4i4 Directories{1|4I9[4|6[3|3]]}
-- See C918-002
declare
Nested_Brackets : Natural := 0;
begin
loop
case Nextc is
when '[' =>
Nested_Brackets := Nested_Brackets + 1;
when ']' =>
Nested_Brackets := Nested_Brackets - 1;
when others =>
if Nested_Brackets = 0 then
exit;
end if;
end case;
Skipc;
end loop;
end;
P := P + 1; -- skip closing bracket
Skip_Space;
-- No typeref entry present
else
File_Num := No_Sdep_Id;
Line := 0;
Ref_Type := ' ';
Col := 0;
Standard_Entity := No_Name;
end if;
end Get_Typeref;
----------
-- Getc --
----------
function Getc return Character is
begin
if P = T'Last then
return EOF;
else
P := P + 1;
return T (P - 1);
end if;
end Getc;
-----------
-- Nextc --
-----------
function Nextc return Character is
begin
return T (P);
end Nextc;
--------------------------------
-- Scan_Invocation_Graph_Line --
--------------------------------
procedure Scan_Invocation_Graph_Line is
procedure Scan_Invocation_Construct_Line;
pragma Inline (Scan_Invocation_Construct_Line);
-- Parse an invocation construct line and construct the corresponding
-- construct. The following data structures are updated:
--
-- * Invocation_Constructs
-- * Units
procedure Scan_Invocation_Graph_Attributes_Line;
pragma Inline (Scan_Invocation_Graph_Attributes_Line);
-- Parse an invocation-graph attributes line. The following data
-- structures are updated:
--
-- * Units
procedure Scan_Invocation_Relation_Line;
pragma Inline (Scan_Invocation_Relation_Line);
-- Parse an invocation relation line and construct the corresponding
-- relation. The following data structures are updated:
--
-- * Invocation_Relations
-- * Units
function Scan_Invocation_Signature return Invocation_Signature_Id;
pragma Inline (Scan_Invocation_Signature);
-- Parse a single invocation signature while populating the following
-- data structures:
--
-- * Invocation_Signatures
-- * Sig_To_Sig_Map
------------------------------------
-- Scan_Invocation_Construct_Line --
------------------------------------
procedure Scan_Invocation_Construct_Line is
Body_Placement : Declaration_Placement_Kind;
Kind : Invocation_Construct_Kind;
Signature : Invocation_Signature_Id;
Spec_Placement : Declaration_Placement_Kind;
begin
-- construct-kind
Kind := Code_To_Invocation_Construct_Kind (Getc);
Checkc (' ');
Skip_Space;
-- construct-spec-placement
Spec_Placement := Code_To_Declaration_Placement_Kind (Getc);
Checkc (' ');
Skip_Space;
-- construct-body-placement
Body_Placement := Code_To_Declaration_Placement_Kind (Getc);
Checkc (' ');
Skip_Space;
-- construct-signature
Signature := Scan_Invocation_Signature;
Skip_Eol;
Add_Invocation_Construct
(Body_Placement => Body_Placement,
Kind => Kind,
Signature => Signature,
Spec_Placement => Spec_Placement);
end Scan_Invocation_Construct_Line;
-------------------------------------------
-- Scan_Invocation_Graph_Attributes_Line --
-------------------------------------------
procedure Scan_Invocation_Graph_Attributes_Line is
begin
-- encoding-kind
Set_Invocation_Graph_Encoding
(Code_To_Invocation_Graph_Encoding_Kind (Getc));
Skip_Eol;
end Scan_Invocation_Graph_Attributes_Line;
-----------------------------------
-- Scan_Invocation_Relation_Line --
-----------------------------------
procedure Scan_Invocation_Relation_Line is
Extra : Name_Id;
Invoker : Invocation_Signature_Id;
Kind : Invocation_Kind;
Target : Invocation_Signature_Id;
begin
-- relation-kind
Kind := Code_To_Invocation_Kind (Getc);
Checkc (' ');
Skip_Space;
-- (extra-name | "none")
Extra := Get_Name;
if Extra = Name_None then
Extra := No_Name;
end if;
Checkc (' ');
Skip_Space;
-- invoker-signature
Invoker := Scan_Invocation_Signature;
Checkc (' ');
Skip_Space;
-- target-signature
Target := Scan_Invocation_Signature;
Skip_Eol;
Add_Invocation_Relation
(Extra => Extra,
Invoker => Invoker,
Kind => Kind,
Target => Target);
end Scan_Invocation_Relation_Line;
-------------------------------
-- Scan_Invocation_Signature --
-------------------------------
function Scan_Invocation_Signature return Invocation_Signature_Id is
Column : Nat;
Line : Nat;
Locations : Name_Id;
Name : Name_Id;
Scope : Name_Id;
begin
-- [
Checkc ('[');
-- name
Name := Get_Name;
Checkc (' ');
Skip_Space;
-- scope
Scope := Get_Name;
Checkc (' ');
Skip_Space;
-- line
Line := Get_Nat;
Checkc (' ');
Skip_Space;
-- column
Column := Get_Nat;
Checkc (' ');
Skip_Space;
-- (locations | "none")
Locations := Get_Name;
if Locations = Name_None then
Locations := No_Name;
end if;
-- ]
Checkc (']');
-- Create an invocation signature from the scanned attributes
return
Invocation_Signature_Of
(Column => Column,
Line => Line,
Locations => Locations,
Name => Name,
Scope => Scope);
end Scan_Invocation_Signature;
-- Local variables
Line : Invocation_Graph_Line_Kind;
-- Start of processing for Scan_Invocation_Graph_Line
begin
if Ignore ('G') then
return;
end if;
Checkc (' ');
Skip_Space;
-- line-kind
Line := Code_To_Invocation_Graph_Line_Kind (Getc);
Checkc (' ');
Skip_Space;
-- line-attributes
case Line is
when Invocation_Construct_Line =>
Scan_Invocation_Construct_Line;
when Invocation_Graph_Attributes_Line =>
Scan_Invocation_Graph_Attributes_Line;
when Invocation_Relation_Line =>
Scan_Invocation_Relation_Line;
end case;
end Scan_Invocation_Graph_Line;
--------------
-- Skip_Eol --
--------------
procedure Skip_Eol is
begin
Skip_Space;
if not At_Eol then
if Ignore_Errors then
while not At_Eol loop
P := P + 1;
end loop;
else
Fatal_Error;
end if;
end if;
-- Loop to skip past blank lines (first time through skips this EOL)
while Nextc < ' ' and then Nextc /= EOF loop
if Nextc = LF then
Line := Line + 1;
end if;
P := P + 1;
end loop;
end Skip_Eol;
---------------
-- Skip_Line --
---------------
procedure Skip_Line is
begin
while not At_Eol loop
P := P + 1;
end loop;
Skip_Eol;
end Skip_Line;
----------------
-- Skip_Space --
----------------
procedure Skip_Space is
begin
while Nextc = ' ' or else Nextc = HT loop
P := P + 1;
end loop;
end Skip_Space;
-----------
-- Skipc --
-----------
procedure Skipc is
begin
if P /= T'Last then
P := P + 1;
end if;
end Skipc;
-- Start of processing for Scan_ALI
begin
First_Sdep_Entry := Sdep.Last + 1;
-- Acquire lines to be ignored
if Read_Xref then
Ignore :=
('T' | 'U' | 'W' | 'Y' | 'Z' | 'D' | 'X' => False, others => True);
-- Read_Lines parameter given
elsif Read_Lines /= "" then
Ignore := ('U' => False, others => True);
for J in Read_Lines'Range loop
Ignore (Read_Lines (J)) := False;
end loop;
-- Process Ignore_Lines parameter
else
Ignore := (others => False);
for J in Ignore_Lines'Range loop
pragma Assert (Ignore_Lines (J) /= 'U');
Ignore (Ignore_Lines (J)) := True;
end loop;
end if;
-- Setup ALI Table entry with appropriate defaults
ALIs.Increment_Last;
Id := ALIs.Last;
Set_Name_Table_Int (F, Int (Id));
ALIs.Table (Id) := (
Afile => F,
Compile_Errors => False,
First_Interrupt_State => Interrupt_States.Last + 1,
First_Sdep => No_Sdep_Id,
First_Specific_Dispatching => Specific_Dispatching.Last + 1,
First_Unit => No_Unit_Id,
GNATprove_Mode => False,
Invocation_Graph_Encoding => No_Encoding,
Last_Interrupt_State => Interrupt_States.Last,
Last_Sdep => No_Sdep_Id,
Last_Specific_Dispatching => Specific_Dispatching.Last,
Last_Unit => No_Unit_Id,
Locking_Policy => ' ',
Main_Priority => -1,
Main_CPU => -1,
Main_Program => None,
No_Component_Reordering => False,
No_Object => False,
Normalize_Scalars => False,
Ofile_Full_Name => Full_Object_File_Name,
Partition_Elaboration_Policy => ' ',
Queuing_Policy => ' ',
Restrictions => No_Restrictions,
SAL_Interface => False,
Sfile => No_File,
SSO_Default => ' ',
Task_Dispatching_Policy => ' ',
Time_Slice_Value => -1,
WC_Encoding => 'b',
Unit_Exception_Table => False,
Ver => (others => ' '),
Ver_Len => 0,
Frontend_Exceptions => False,
Zero_Cost_Exceptions => False);
-- Now we acquire the input lines from the ALI file. Note that the
-- convention in the following code is that as we enter each section,
-- C is set to contain the first character of the following line.
C := Getc;
Check_Unknown_Line;
-- Acquire library version
if C /= 'V' then
-- The V line missing really indicates trouble, most likely it
-- means we don't have an ALI file at all, so here we give a
-- fatal error even if we are in Ignore_Errors mode.
Fatal_Error;
elsif Ignore ('V') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Checkc ('"');
for J in 1 .. Ver_Len_Max loop
C := Getc;
exit when C = '"';
ALIs.Table (Id).Ver (J) := C;
ALIs.Table (Id).Ver_Len := J;
end loop;
Skip_Eol;
end if;
C := Getc;
Check_Unknown_Line;
-- Acquire main program line if present
if C = 'M' then
if Ignore ('M') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
C := Getc;
if C = 'F' then
ALIs.Table (Id).Main_Program := Func;
elsif C = 'P' then
ALIs.Table (Id).Main_Program := Proc;
else
P := P - 1;
Fatal_Error;
end if;
Skip_Space;
if not At_Eol then
if Nextc < 'A' then
ALIs.Table (Id).Main_Priority := Get_Nat;
end if;
Skip_Space;
if Nextc = 'T' then
P := P + 1;
Checkc ('=');
ALIs.Table (Id).Time_Slice_Value := Get_Nat;
end if;
Skip_Space;
if Nextc = 'C' then
P := P + 1;
Checkc ('=');
ALIs.Table (Id).Main_CPU := Get_Nat;
end if;
Skip_Space;
Checkc ('W');
Checkc ('=');
ALIs.Table (Id).WC_Encoding := Getc;
end if;
Skip_Eol;
end if;
C := Getc;
end if;
-- Acquire argument lines
First_Arg := Args.Last + 1;
A_Loop : loop
Check_Unknown_Line;
exit A_Loop when C /= 'A';
if Ignore ('A') then
Skip_Line;
else
Checkc (' ');
-- Scan out argument
Name_Len := 0;
while not At_Eol loop
Add_Char_To_Name_Buffer (Getc);
end loop;
-- If -fstack-check, record that it occurred. Note that an
-- additional string parameter can be specified, in the form of
-- -fstack-check={no|generic|specific}. "no" means no checking,
-- "generic" means force the use of old-style checking, and
-- "specific" means use the best checking method.
if Name_Len >= 13
and then Name_Buffer (1 .. 13) = "-fstack-check"
and then Name_Buffer (1 .. Name_Len) /= "-fstack-check=no"
then
Stack_Check_Switch_Set := True;
end if;
-- Store the argument
Args.Increment_Last;
Args.Table (Args.Last) := new String'(Name_Buffer (1 .. Name_Len));
Skip_Eol;
end if;
C := Getc;
end loop A_Loop;
-- Acquire P line
Check_Unknown_Line;
while C /= 'P' loop
if Ignore_Errors then
if C = EOF then
Fatal_Error;
else
Skip_Line;
C := Nextc;
end if;
else
Fatal_Error;
end if;
end loop;
if Ignore ('P') then
Skip_Line;
-- Process P line
else
NS_Found := False;
while not At_Eol loop
Checkc (' ');
Skip_Space;
C := Getc;
-- Processing for CE
if C = 'C' then
Checkc ('E');
ALIs.Table (Id).Compile_Errors := True;
-- Processing for DB
elsif C = 'D' then
Checkc ('B');
Detect_Blocking := True;
-- Processing for Ex
elsif C = 'E' then
Partition_Elaboration_Policy_Specified := Getc;
ALIs.Table (Id).Partition_Elaboration_Policy :=
Partition_Elaboration_Policy_Specified;
-- Processing for FX
elsif C = 'F' then
C := Getc;
if C = 'X' then
ALIs.Table (Id).Frontend_Exceptions := True;
Frontend_Exceptions_Specified := True;
else
Fatal_Error_Ignore;
end if;
-- Processing for GP
elsif C = 'G' then
Checkc ('P');
GNATprove_Mode_Specified := True;
ALIs.Table (Id).GNATprove_Mode := True;
-- Processing for Lx
elsif C = 'L' then
Locking_Policy_Specified := Getc;
ALIs.Table (Id).Locking_Policy := Locking_Policy_Specified;
-- Processing for flags starting with N
elsif C = 'N' then
C := Getc;
-- Processing for NC
if C = 'C' then
ALIs.Table (Id).No_Component_Reordering := True;
No_Component_Reordering_Specified := True;
-- Processing for NO
elsif C = 'O' then
ALIs.Table (Id).No_Object := True;
No_Object_Specified := True;
-- Processing for NR
elsif C = 'R' then
No_Run_Time_Mode := True;
Configurable_Run_Time_Mode := True;
-- Processing for NS
elsif C = 'S' then
ALIs.Table (Id).Normalize_Scalars := True;
Normalize_Scalars_Specified := True;
NS_Found := True;
-- Invalid switch starting with N
else
Fatal_Error_Ignore;
end if;
-- Processing for OH/OL
elsif C = 'O' then
C := Getc;
if C = 'L' or else C = 'H' then
ALIs.Table (Id).SSO_Default := C;
SSO_Default_Specified := True;
else
Fatal_Error_Ignore;
end if;
-- Processing for Qx
elsif C = 'Q' then
Queuing_Policy_Specified := Getc;
ALIs.Table (Id).Queuing_Policy := Queuing_Policy_Specified;
-- Processing for flags starting with S
elsif C = 'S' then
C := Getc;
-- Processing for SL
if C = 'L' then
ALIs.Table (Id).SAL_Interface := True;
-- Processing for SS
elsif C = 'S' then
Opt.Sec_Stack_Used := True;
-- Invalid switch starting with S
else
Fatal_Error_Ignore;
end if;
-- Processing for Tx
elsif C = 'T' then
Task_Dispatching_Policy_Specified := Getc;
ALIs.Table (Id).Task_Dispatching_Policy :=
Task_Dispatching_Policy_Specified;
-- Processing for switch starting with U
elsif C = 'U' then
C := Getc;
-- Processing for UA
if C = 'A' then
Unreserve_All_Interrupts_Specified := True;
-- Processing for UX
elsif C = 'X' then
ALIs.Table (Id).Unit_Exception_Table := True;
-- Invalid switches starting with U
else
Fatal_Error_Ignore;
end if;
-- Processing for ZX
elsif C = 'Z' then
C := Getc;
if C = 'X' then
ALIs.Table (Id).Zero_Cost_Exceptions := True;
Zero_Cost_Exceptions_Specified := True;
else
Fatal_Error_Ignore;
end if;
-- Invalid parameter
else
C := Getc;
Fatal_Error_Ignore;
end if;
end loop;
if not NS_Found then
No_Normalize_Scalars_Specified := True;
end if;
Skip_Eol;
end if;
C := Getc;
Check_Unknown_Line;
-- Loop to skip to first restrictions line
while C /= 'R' loop
if Ignore_Errors then
if C = EOF then
Fatal_Error;
else
Skip_Line;
C := Nextc;
end if;
else
Fatal_Error;
end if;
end loop;
-- Ignore all 'R' lines if that is required
if Ignore ('R') then
while C = 'R' loop
Skip_Line;
C := Getc;
end loop;
-- Here we process the restrictions lines (other than unit name cases)
else
Scan_Restrictions : declare
Save_R : constant Restrictions_Info := Cumulative_Restrictions;
-- Save cumulative restrictions in case we have a fatal error
Bad_R_Line : exception;
-- Signal bad restrictions line (raised on unexpected character)
Typ : Character;
R : Restriction_Id;
N : Natural;
begin
-- Named restriction case
if Nextc = 'N' then
Skip_Line;
C := Getc;
-- Loop through RR and RV lines
while C = 'R' and then Nextc /= ' ' loop
Typ := Getc;
Checkc (' ');
-- Acquire restriction name
Name_Len := 0;
while not At_Eol and then Nextc /= '=' loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Getc;
end loop;
-- Now search list of restrictions to find match
declare
RN : String renames Name_Buffer (1 .. Name_Len);
begin
R := Restriction_Id'First;
while R /= Not_A_Restriction_Id loop
if Restriction_Id'Image (R) = RN then
goto R_Found;
end if;
R := Restriction_Id'Succ (R);
end loop;
-- We don't recognize the restriction. This might be
-- thought of as an error, and it really is, but we
-- want to allow building with inconsistent versions
-- of the binder and ali files (see comments at the
-- start of package System.Rident), so we just ignore
-- this situation.
goto Done_With_Restriction_Line;
end;
<<R_Found>>
case R is
-- Boolean restriction case
when All_Boolean_Restrictions =>
case Typ is
when 'V' =>
ALIs.Table (Id).Restrictions.Violated (R) :=
True;
Cumulative_Restrictions.Violated (R) := True;
when 'R' =>
ALIs.Table (Id).Restrictions.Set (R) := True;
Cumulative_Restrictions.Set (R) := True;
when others =>
raise Bad_R_Line;
end case;
-- Parameter restriction case
when All_Parameter_Restrictions =>
if At_Eol or else Nextc /= '=' then
raise Bad_R_Line;
else
Skipc;
end if;
N := Natural (Get_Nat);
case Typ is
-- Restriction set
when 'R' =>
ALIs.Table (Id).Restrictions.Set (R) := True;
ALIs.Table (Id).Restrictions.Value (R) := N;
if Cumulative_Restrictions.Set (R) then
Cumulative_Restrictions.Value (R) :=
Integer'Min
(Cumulative_Restrictions.Value (R), N);
else
Cumulative_Restrictions.Set (R) := True;
Cumulative_Restrictions.Value (R) := N;
end if;
-- Restriction violated
when 'V' =>
ALIs.Table (Id).Restrictions.Violated (R) :=
True;
Cumulative_Restrictions.Violated (R) := True;
ALIs.Table (Id).Restrictions.Count (R) := N;
-- Checked Max_Parameter case
if R in Checked_Max_Parameter_Restrictions then
Cumulative_Restrictions.Count (R) :=
Integer'Max
(Cumulative_Restrictions.Count (R), N);
-- Other checked parameter cases
else
declare
pragma Unsuppress (Overflow_Check);
begin
Cumulative_Restrictions.Count (R) :=
Cumulative_Restrictions.Count (R) + N;
exception
when Constraint_Error =>
-- A constraint error comes from the
-- addition. We reset to the maximum
-- and indicate that the real value
-- is now unknown.
Cumulative_Restrictions.Value (R) :=
Integer'Last;
Cumulative_Restrictions.Unknown (R) :=
True;
end;
end if;
-- Deal with + case
if Nextc = '+' then
Skipc;
ALIs.Table (Id).Restrictions.Unknown (R) :=
True;
Cumulative_Restrictions.Unknown (R) := True;
end if;
-- Other than 'R' or 'V'
when others =>
raise Bad_R_Line;
end case;
if not At_Eol then
raise Bad_R_Line;
end if;
-- Bizarre error case NOT_A_RESTRICTION
when Not_A_Restriction_Id =>
raise Bad_R_Line;
end case;
if not At_Eol then
raise Bad_R_Line;
end if;
<<Done_With_Restriction_Line>>
Skip_Line;
C := Getc;
end loop;
-- Positional restriction case
else
Checkc (' ');
Skip_Space;
-- Acquire information for boolean restrictions
for R in All_Boolean_Restrictions loop
C := Getc;
case C is
when 'v' =>
ALIs.Table (Id).Restrictions.Violated (R) := True;
Cumulative_Restrictions.Violated (R) := True;
when 'r' =>
ALIs.Table (Id).Restrictions.Set (R) := True;
Cumulative_Restrictions.Set (R) := True;
when 'n' =>
null;
when others =>
raise Bad_R_Line;
end case;
end loop;
-- Acquire information for parameter restrictions
for RP in All_Parameter_Restrictions loop
case Getc is
when 'n' =>
null;
when 'r' =>
ALIs.Table (Id).Restrictions.Set (RP) := True;
declare
N : constant Integer := Integer (Get_Nat);
begin
ALIs.Table (Id).Restrictions.Value (RP) := N;
if Cumulative_Restrictions.Set (RP) then
Cumulative_Restrictions.Value (RP) :=
Integer'Min
(Cumulative_Restrictions.Value (RP), N);
else
Cumulative_Restrictions.Set (RP) := True;
Cumulative_Restrictions.Value (RP) := N;
end if;
end;
when others =>
raise Bad_R_Line;
end case;
-- Acquire restrictions violations information
case Getc is
when 'n' =>
null;
when 'v' =>
ALIs.Table (Id).Restrictions.Violated (RP) := True;
Cumulative_Restrictions.Violated (RP) := True;
declare
N : constant Integer := Integer (Get_Nat);
begin
ALIs.Table (Id).Restrictions.Count (RP) := N;
if RP in Checked_Max_Parameter_Restrictions then
Cumulative_Restrictions.Count (RP) :=
Integer'Max
(Cumulative_Restrictions.Count (RP), N);
else
declare
pragma Unsuppress (Overflow_Check);
begin
Cumulative_Restrictions.Count (RP) :=
Cumulative_Restrictions.Count (RP) + N;
exception
when Constraint_Error =>
-- A constraint error comes from the add. We
-- reset to the maximum and indicate that the
-- real value is now unknown.
Cumulative_Restrictions.Value (RP) :=
Integer'Last;
Cumulative_Restrictions.Unknown (RP) := True;
end;
end if;
if Nextc = '+' then
Skipc;
ALIs.Table (Id).Restrictions.Unknown (RP) := True;
Cumulative_Restrictions.Unknown (RP) := True;
end if;
end;
when others =>
raise Bad_R_Line;
end case;
end loop;
if not At_Eol then
raise Bad_R_Line;
else
Skip_Line;
C := Getc;
end if;
end if;
-- Here if error during scanning of restrictions line
exception
when Bad_R_Line =>
-- In Ignore_Errors mode, undo any changes to restrictions
-- from this unit, and continue on, skipping remaining R
-- lines for this unit.
if Ignore_Errors then
Cumulative_Restrictions := Save_R;
ALIs.Table (Id).Restrictions := No_Restrictions;
loop
Skip_Eol;
C := Getc;
exit when C /= 'R';
end loop;
-- In normal mode, this is a fatal error
else
Fatal_Error;
end if;
end Scan_Restrictions;
end if;
-- Acquire additional restrictions (No_Dependence) lines if present
while C = 'R' loop
if Ignore ('R') then
Skip_Line;
else
Skip_Space;
No_Deps.Append ((Id, Get_Name));
Skip_Eol;
end if;
C := Getc;
end loop;
-- Acquire 'I' lines if present
Check_Unknown_Line;
while C = 'I' loop
if Ignore ('I') then
Skip_Line;
else
declare
Int_Num : Nat;
I_State : Character;
Line_No : Nat;
begin
Int_Num := Get_Nat;
Skip_Space;
I_State := Getc;
Line_No := Get_Nat;
Interrupt_States.Append (
(Interrupt_Id => Int_Num,
Interrupt_State => I_State,
IS_Pragma_Line => Line_No));
ALIs.Table (Id).Last_Interrupt_State := Interrupt_States.Last;
Skip_Eol;
end;
end if;
C := Getc;
end loop;
-- Acquire 'S' lines if present
Check_Unknown_Line;
while C = 'S' loop
if Ignore ('S') then
Skip_Line;
else
declare
Policy : Character;
First_Prio : Nat;
Last_Prio : Nat;
Line_No : Nat;
begin
Checkc (' ');
Skip_Space;
Policy := Getc;
Skip_Space;
First_Prio := Get_Nat;
Last_Prio := Get_Nat;
Line_No := Get_Nat;
Specific_Dispatching.Append (
(Dispatching_Policy => Policy,
First_Priority => First_Prio,
Last_Priority => Last_Prio,
PSD_Pragma_Line => Line_No));
ALIs.Table (Id).Last_Specific_Dispatching :=
Specific_Dispatching.Last;
Skip_Eol;
end;
end if;
C := Getc;
end loop;
-- Loop to acquire unit entries
U_Loop : loop
Check_Unknown_Line;
exit U_Loop when C /= 'U';
-- Note: as per spec, we never ignore U lines
Checkc (' ');
Skip_Space;
Units.Increment_Last;
if ALIs.Table (Id).First_Unit = No_Unit_Id then
ALIs.Table (Id).First_Unit := Units.Last;
end if;
declare
UL : Unit_Record renames Units.Table (Units.Last);
begin
UL.Uname := Get_Unit_Name;
UL.Predefined := Is_Predefined_Unit;
UL.Internal := Is_Internal_Unit;
UL.My_ALI := Id;
UL.Sfile := Get_File_Name (Lower => True);
UL.Pure := False;
UL.Preelab := False;
UL.No_Elab := False;
UL.Shared_Passive := False;
UL.RCI := False;
UL.Remote_Types := False;
UL.Serious_Errors := False;
UL.Has_RACW := False;
UL.Init_Scalars := False;
UL.Is_Generic := False;
UL.Icasing := Mixed_Case;
UL.Kcasing := All_Lower_Case;
UL.Dynamic_Elab := False;
UL.Elaborate_Body := False;
UL.Set_Elab_Entity := False;
UL.Version := "00000000";
UL.First_With := Withs.Last + 1;
UL.First_Arg := First_Arg;
UL.First_Invocation_Construct := Invocation_Constructs.Last + 1;
UL.Last_Invocation_Construct := No_Invocation_Construct;
UL.First_Invocation_Relation := Invocation_Relations.Last + 1;
UL.Last_Invocation_Relation := No_Invocation_Relation;
UL.Elab_Position := 0;
UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
UL.Directly_Scanned := Directly_Scanned;
UL.Body_Needed_For_SAL := False;
UL.Elaborate_Body_Desirable := False;
UL.Optimize_Alignment := 'O';
UL.Has_Finalizer := False;
UL.Primary_Stack_Count := 0;
UL.Sec_Stack_Count := 0;
if Debug_Flag_U then
Write_Str (" ----> reading unit ");
Write_Int (Int (Units.Last));
Write_Str (" ");
Write_Unit_Name (UL.Uname);
Write_Str (" from file ");
Write_Name (UL.Sfile);
Write_Eol;
end if;
end;
-- Check for duplicated unit in different files
declare
Info : constant Int := Get_Name_Table_Int
(Units.Table (Units.Last).Uname);
begin
if Info /= 0
and then Units.Table (Units.Last).Sfile /=
Units.Table (Unit_Id (Info)).Sfile
then
-- If Err is set then ignore duplicate unit name. This is the
-- case of a call from gnatmake, where the situation can arise
-- from substitution of source files. In such situations, the
-- processing in gnatmake will always result in any required
-- recompilations in any case, and if we consider this to be
-- an error we get strange cases (for example when a generic
-- instantiation is replaced by a normal package) where we
-- read the old ali file, decide to recompile, and then decide
-- that the old and new ali files are incompatible.
if Err then
null;
-- If Err is not set, then this is a fatal error. This is
-- the case of being called from the binder, where we must
-- definitely diagnose this as an error.
else
Set_Standard_Error;
Write_Str ("error: duplicate unit name: ");
Write_Eol;
Write_Str ("error: unit """);
Write_Unit_Name (Units.Table (Units.Last).Uname);
Write_Str (""" found in file """);
Write_Name_Decoded (Units.Table (Units.Last).Sfile);
Write_Char ('"');
Write_Eol;
Write_Str ("error: unit """);
Write_Unit_Name (Units.Table (Unit_Id (Info)).Uname);
Write_Str (""" found in file """);
Write_Name_Decoded (Units.Table (Unit_Id (Info)).Sfile);
Write_Char ('"');
Write_Eol;
Exit_Program (E_Fatal);
end if;
end if;
end;
Set_Name_Table_Int
(Units.Table (Units.Last).Uname, Int (Units.Last));
-- Scan out possible version and other parameters
loop
Skip_Space;
exit when At_Eol;
C := Getc;
-- Version field
if C in '0' .. '9' or else C in 'a' .. 'f' then
Units.Table (Units.Last).Version (1) := C;
for J in 2 .. 8 loop
C := Getc;
Units.Table (Units.Last).Version (J) := C;
end loop;
-- BD/BN parameters
elsif C = 'B' then
C := Getc;
if C = 'D' then
Check_At_End_Of_Field;
Units.Table (Units.Last).Elaborate_Body_Desirable := True;
elsif C = 'N' then
Check_At_End_Of_Field;
Units.Table (Units.Last).Body_Needed_For_SAL := True;
else
Fatal_Error_Ignore;
end if;
-- DE parameter (Dynamic elaboration checks)
elsif C = 'D' then
C := Getc;
if C = 'E' then
Check_At_End_Of_Field;
Units.Table (Units.Last).Dynamic_Elab := True;
Dynamic_Elaboration_Checks_Specified := True;
else
Fatal_Error_Ignore;
end if;
-- EB/EE parameters
elsif C = 'E' then
C := Getc;
if C = 'B' then
Units.Table (Units.Last).Elaborate_Body := True;
elsif C = 'E' then
Units.Table (Units.Last).Set_Elab_Entity := True;
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- GE parameter (generic)
elsif C = 'G' then
C := Getc;
if C = 'E' then
Check_At_End_Of_Field;
Units.Table (Units.Last).Is_Generic := True;
else
Fatal_Error_Ignore;
end if;
-- IL/IS/IU parameters
elsif C = 'I' then
C := Getc;
if C = 'L' then
Units.Table (Units.Last).Icasing := All_Lower_Case;
elsif C = 'S' then
Units.Table (Units.Last).Init_Scalars := True;
Initialize_Scalars_Used := True;
elsif C = 'U' then
Units.Table (Units.Last).Icasing := All_Upper_Case;
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- KM/KU parameters
elsif C = 'K' then
C := Getc;
if C = 'M' then
Units.Table (Units.Last).Kcasing := Mixed_Case;
elsif C = 'U' then
Units.Table (Units.Last).Kcasing := All_Upper_Case;
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- NE parameter
elsif C = 'N' then
C := Getc;
if C = 'E' then
Units.Table (Units.Last).No_Elab := True;
Check_At_End_Of_Field;
else
Fatal_Error_Ignore;
end if;
-- PF/PR/PU/PK parameters
elsif C = 'P' then
C := Getc;
if C = 'F' then
Units.Table (Units.Last).Has_Finalizer := True;
elsif C = 'R' then
Units.Table (Units.Last).Preelab := True;
elsif C = 'U' then
Units.Table (Units.Last).Pure := True;
elsif C = 'K' then
Units.Table (Units.Last).Unit_Kind := 'p';
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- OL/OO/OS/OT parameters
elsif C = 'O' then
C := Getc;
if C = 'L' or else C = 'O' or else C = 'S' or else C = 'T' then
Units.Table (Units.Last).Optimize_Alignment := C;
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- RC/RT parameters
elsif C = 'R' then
C := Getc;
if C = 'C' then
Units.Table (Units.Last).RCI := True;
elsif C = 'T' then
Units.Table (Units.Last).Remote_Types := True;
elsif C = 'A' then
Units.Table (Units.Last).Has_RACW := True;
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
-- SE/SP/SU parameters
elsif C = 'S' then
C := Getc;
if C = 'E' then
Units.Table (Units.Last).Serious_Errors := True;
elsif C = 'P' then
Units.Table (Units.Last).Shared_Passive := True;
elsif C = 'U' then
Units.Table (Units.Last).Unit_Kind := 's';
else
Fatal_Error_Ignore;
end if;
Check_At_End_Of_Field;
else
C := Getc;
Fatal_Error_Ignore;
end if;
end loop;
Skip_Eol;
C := Getc;
-- Scan out With lines for this unit
With_Loop : loop
Check_Unknown_Line;
exit With_Loop when C /= 'W' and then C /= 'Y' and then C /= 'Z';
if Ignore ('W') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Withs.Increment_Last;
Withs.Table (Withs.Last).Uname := Get_Unit_Name;
Withs.Table (Withs.Last).Elaborate := False;
Withs.Table (Withs.Last).Elaborate_All := False;
Withs.Table (Withs.Last).Elab_Desirable := False;
Withs.Table (Withs.Last).Elab_All_Desirable := False;
Withs.Table (Withs.Last).SAL_Interface := False;
Withs.Table (Withs.Last).Limited_With := (C = 'Y');
Withs.Table (Withs.Last).Implicit_With := (C = 'Z');
-- Generic case with no object file available
if At_Eol then
Withs.Table (Withs.Last).Sfile := No_File;
Withs.Table (Withs.Last).Afile := No_File;
-- Normal case
else
Withs.Table (Withs.Last).Sfile := Get_File_Name
(Lower => True);
Withs.Table (Withs.Last).Afile := Get_File_Name
(Lower => True);
-- Scan out possible E, EA, ED, and AD parameters
while not At_Eol loop
Skip_Space;
if Nextc = 'A' then
P := P + 1;
Checkc ('D');
Check_At_End_Of_Field;
-- Store AD indication unless ignore required
if not Ignore_ED then
Withs.Table (Withs.Last).Elab_All_Desirable := True;
end if;
elsif Nextc = 'E' then
P := P + 1;
if At_End_Of_Field then
Withs.Table (Withs.Last).Elaborate := True;
elsif Nextc = 'A' then
P := P + 1;
Check_At_End_Of_Field;
Withs.Table (Withs.Last).Elaborate_All := True;
else
Checkc ('D');
Check_At_End_Of_Field;
-- Store ED indication unless ignore required
if not Ignore_ED then
Withs.Table (Withs.Last).Elab_Desirable :=
True;
end if;
end if;
else
Fatal_Error;
end if;
end loop;
end if;
Skip_Eol;
end if;
C := Getc;
end loop With_Loop;
Units.Table (Units.Last).Last_With := Withs.Last;
Units.Table (Units.Last).Last_Arg := Args.Last;
-- Scan out task stack information for the unit if present
Check_Unknown_Line;
if C = 'T' then
if Ignore ('T') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Units.Table (Units.Last).Primary_Stack_Count := Get_Nat;
Skip_Space;
Units.Table (Units.Last).Sec_Stack_Count := Get_Nat;
Skip_Space;
Skip_Eol;
end if;
C := Getc;
end if;
-- If there are linker options lines present, scan them
Name_Len := 0;
Linker_Options_Loop : loop
Check_Unknown_Line;
exit Linker_Options_Loop when C /= 'L';
if Ignore ('L') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Checkc ('"');
loop
C := Getc;
if C < Character'Val (16#20#)
or else C > Character'Val (16#7E#)
then
Fatal_Error_Ignore;
elsif C = '{' then
C := Character'Val (0);
declare
V : Natural;
begin
V := 0;
for J in 1 .. 2 loop
C := Getc;
if C in '0' .. '9' then
V := V * 16 +
Character'Pos (C) -
Character'Pos ('0');
elsif C in 'A' .. 'F' then
V := V * 16 +
Character'Pos (C) -
Character'Pos ('A') +
10;
else
Fatal_Error_Ignore;
end if;
end loop;
Checkc ('}');
Add_Char_To_Name_Buffer (Character'Val (V));
end;
else
if C = '"' then
exit when Nextc /= '"';
C := Getc;
end if;
Add_Char_To_Name_Buffer (C);
end if;
end loop;
Add_Char_To_Name_Buffer (NUL);
Skip_Eol;
end if;
C := Getc;
end loop Linker_Options_Loop;
-- Store the linker options entry if one was found
if Name_Len /= 0 then
Linker_Options.Increment_Last;
Linker_Options.Table (Linker_Options.Last).Name :=
Name_Enter;
Linker_Options.Table (Linker_Options.Last).Unit :=
Units.Last;
Linker_Options.Table (Linker_Options.Last).Internal_File :=
Is_Internal_File_Name (F);
end if;
-- If there are notes present, scan them
Notes_Loop : loop
Check_Unknown_Line;
exit Notes_Loop when C /= 'N';
if Ignore ('N') then
Skip_Line;
else
Checkc (' ');
Notes.Increment_Last;
Notes.Table (Notes.Last).Pragma_Type := Getc;
Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
Checkc (':');
Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
if not At_Eol and then Nextc = ':' then
Checkc (':');
Notes.Table (Notes.Last).Pragma_Source_File :=
Get_File_Name (Lower => True);
else
Notes.Table (Notes.Last).Pragma_Source_File :=
Units.Table (Units.Last).Sfile;
end if;
if At_Eol then
Notes.Table (Notes.Last).Pragma_Args := No_Name;
else
-- Note: can't use Get_Name here as the remainder of the
-- line is unstructured text whose syntax depends on the
-- particular pragma used.
Checkc (' ');
Name_Len := 0;
while not At_Eol loop
Add_Char_To_Name_Buffer (Getc);
end loop;
end if;
Skip_Eol;
end if;
C := Getc;
end loop Notes_Loop;
end loop U_Loop;
-- End loop through units for one ALI file
ALIs.Table (Id).Last_Unit := Units.Last;
ALIs.Table (Id).Sfile := Units.Table (ALIs.Table (Id).First_Unit).Sfile;
-- Set types of the units (there can be at most 2 of them)
if ALIs.Table (Id).First_Unit /= ALIs.Table (Id).Last_Unit then
Units.Table (ALIs.Table (Id).First_Unit).Utype := Is_Body;
Units.Table (ALIs.Table (Id).Last_Unit).Utype := Is_Spec;
else
-- Deal with body only and spec only cases, note that the reason we
-- do our own checking of the name (rather than using Is_Body_Name)
-- is that Uname drags in far too much compiler junk.
Get_Name_String (Units.Table (Units.Last).Uname);
if Name_Buffer (Name_Len) = 'b' then
Units.Table (Units.Last).Utype := Is_Body_Only;
else
Units.Table (Units.Last).Utype := Is_Spec_Only;
end if;
end if;
-- Scan out external version references and put in hash table
E_Loop : loop
Check_Unknown_Line;
exit E_Loop when C /= 'E';
if Ignore ('E') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Name_Len := 0;
Name_Len := 0;
loop
C := Getc;
if C < ' ' then
Fatal_Error;
end if;
exit when At_End_Of_Field;
Add_Char_To_Name_Buffer (C);
end loop;
Version_Ref.Set (new String'(Name_Buffer (1 .. Name_Len)), True);
Skip_Eol;
end if;
C := Getc;
end loop E_Loop;
-- Scan out source dependency lines for this ALI file
ALIs.Table (Id).First_Sdep := Sdep.Last + 1;
D_Loop : loop
Check_Unknown_Line;
exit D_Loop when C /= 'D';
if Ignore ('D') then
Skip_Line;
else
Checkc (' ');
Skip_Space;
Sdep.Increment_Last;
-- In the following call, Lower is not set to True, this is either
-- a bug, or it deserves a special comment as to why this is so???
-- The file/path name may be quoted
Sdep.Table (Sdep.Last).Sfile :=
Get_File_Name (May_Be_Quoted => True);
Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
Sdep.Table (Sdep.Last).Dummy_Entry :=
(Sdep.Table (Sdep.Last).Stamp = Dummy_Time_Stamp);
-- Acquire checksum value
Skip_Space;
declare
Ctr : Natural;
Chk : Word;
begin
Ctr := 0;
Chk := 0;
loop
exit when At_Eol or else Ctr = 8;
if Nextc in '0' .. '9' then
Chk := Chk * 16 +
Character'Pos (Nextc) - Character'Pos ('0');
elsif Nextc in 'a' .. 'f' then
Chk := Chk * 16 +
Character'Pos (Nextc) - Character'Pos ('a') + 10;
else
exit;
end if;
Ctr := Ctr + 1;
P := P + 1;
end loop;
if Ctr = 8 and then At_End_Of_Field then
Sdep.Table (Sdep.Last).Checksum := Chk;
else
Fatal_Error;
end if;
end;
-- Acquire (sub)unit and reference file name entries
Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
Sdep.Table (Sdep.Last).Unit_Name := No_Name;
Sdep.Table (Sdep.Last).Rfile :=
Sdep.Table (Sdep.Last).Sfile;
Sdep.Table (Sdep.Last).Start_Line := 1;
if not At_Eol then
Skip_Space;
-- Here for (sub)unit name
if Nextc not in '0' .. '9' then
Name_Len := 0;
while not At_End_Of_Field loop
Add_Char_To_Name_Buffer (Getc);
end loop;
-- Set the (sub)unit name. Note that we use Name_Find rather
-- than Name_Enter here as the subunit name may already
-- have been put in the name table by the Project Manager.
if Name_Len <= 2
or else Name_Buffer (Name_Len - 1) /= '%'
then
Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
else
Name_Len := Name_Len - 2;
Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
end if;
Skip_Space;
end if;
-- Here for reference file name entry
if Nextc in '0' .. '9' then
Sdep.Table (Sdep.Last).Start_Line := Get_Nat;
Checkc (':');
Name_Len := 0;
while not At_End_Of_Field loop
Add_Char_To_Name_Buffer (Getc);
end loop;
Sdep.Table (Sdep.Last).Rfile := Name_Enter;
end if;
end if;
Skip_Eol;
end if;
C := Getc;
end loop D_Loop;
ALIs.Table (Id).Last_Sdep := Sdep.Last;
-- Loop through invocation-graph lines
G_Loop : loop
Check_Unknown_Line;
exit G_Loop when C /= 'G';
Scan_Invocation_Graph_Line;
C := Getc;
end loop G_Loop;
-- We must at this stage be at an Xref line or the end of file
if C = EOF then
return Id;
end if;
Check_Unknown_Line;
if C /= 'X' then
Fatal_Error;
end if;
-- If we are ignoring Xref sections we are done (we ignore all
-- remaining lines since only xref related lines follow X).
if Ignore ('X') and then not Debug_Flag_X then
return Id;
end if;
-- Loop through Xref sections
X_Loop : loop
Check_Unknown_Line;
exit X_Loop when C /= 'X';
-- Make new entry in section table
Xref_Section.Increment_Last;
Read_Refs_For_One_File : declare
XS : Xref_Section_Record renames
Xref_Section.Table (Xref_Section.Last);
Current_File_Num : Sdep_Id;
-- Keeps track of the current file number (changed by nn|)
begin
XS.File_Num := Sdep_Id (Get_Nat + Nat (First_Sdep_Entry) - 1);
XS.File_Name := Get_File_Name;
XS.First_Entity := Xref_Entity.Last + 1;
Current_File_Num := XS.File_Num;
Skip_Space;
Skip_Eol;
C := Nextc;
-- Loop through Xref entities
while C /= 'X' and then C /= EOF loop
Xref_Entity.Increment_Last;
Read_Refs_For_One_Entity : declare
XE : Xref_Entity_Record renames
Xref_Entity.Table (Xref_Entity.Last);
N : Nat;
procedure Read_Instantiation_Reference;
-- Acquire instantiation reference. Caller has checked
-- that current character is '[' and on return the cursor
-- is skipped past the corresponding closing ']'.
----------------------------------
-- Read_Instantiation_Reference --
----------------------------------
procedure Read_Instantiation_Reference is
Local_File_Num : Sdep_Id := Current_File_Num;
begin
Xref.Increment_Last;
declare
XR : Xref_Record renames Xref.Table (Xref.Last);
begin
P := P + 1; -- skip [
N := Get_Nat;
if Nextc = '|' then
XR.File_Num :=
Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
Local_File_Num := XR.File_Num;
P := P + 1;
N := Get_Nat;
else
XR.File_Num := Local_File_Num;
end if;
XR.Line := N;
XR.Rtype := ' ';
XR.Col := 0;
-- Recursive call for next reference
if Nextc = '[' then
pragma Warnings (Off); -- kill recursion warning
Read_Instantiation_Reference;
pragma Warnings (On);
end if;
-- Skip closing bracket after recursive call
P := P + 1;
end;
end Read_Instantiation_Reference;
-- Start of processing for Read_Refs_For_One_Entity
begin
XE.Line := Get_Nat;
XE.Etype := Getc;
XE.Col := Get_Nat;
case Getc is
when '*' =>
XE.Visibility := Global;
when '+' =>
XE.Visibility := Static;
when others =>
XE.Visibility := Other;
end case;
XE.Entity := Get_Name;
-- Handle the information about generic instantiations
if Nextc = '[' then
Skipc; -- Opening '['
N := Get_Nat;
if Nextc /= '|' then
XE.Iref_File_Num := Current_File_Num;
XE.Iref_Line := N;
else
XE.Iref_File_Num :=
Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
Skipc;
XE.Iref_Line := Get_Nat;
end if;
if Getc /= ']' then
Fatal_Error;
end if;
else
XE.Iref_File_Num := No_Sdep_Id;
XE.Iref_Line := 0;
end if;
Current_File_Num := XS.File_Num;
-- Renaming reference is present
if Nextc = '=' then
P := P + 1;
XE.Rref_Line := Get_Nat;
if Getc /= ':' then
Fatal_Error;
end if;
XE.Rref_Col := Get_Nat;
-- No renaming reference present
else
XE.Rref_Line := 0;
XE.Rref_Col := 0;
end if;
Skip_Space;
XE.Oref_File_Num := No_Sdep_Id;
XE.Tref_File_Num := No_Sdep_Id;
XE.Tref := Tref_None;
XE.First_Xref := Xref.Last + 1;
-- Loop to check for additional info present
loop
declare
Ref : Tref_Kind;
File : Sdep_Id;
Line : Nat;
Typ : Character;
Col : Nat;
Std : Name_Id;
begin
Get_Typeref
(Current_File_Num, Ref, File, Line, Typ, Col, Std);
exit when Ref = Tref_None;
-- Do we have an overriding procedure?
if Ref = Tref_Derived and then Typ = 'p' then
XE.Oref_File_Num := File;
XE.Oref_Line := Line;
XE.Oref_Col := Col;
-- Arrays never override anything, and <> points to
-- the index types instead
elsif Ref = Tref_Derived and then XE.Etype = 'A' then
-- Index types are stored in the list of references
Xref.Increment_Last;
declare
XR : Xref_Record renames Xref.Table (Xref.Last);
begin
XR.File_Num := File;
XR.Line := Line;
XR.Rtype := Array_Index_Reference;
XR.Col := Col;
XR.Name := Std;
end;
-- Interfaces are stored in the list of references,
-- although the parent type itself is stored in XE.
-- The first interface (when there are only
-- interfaces) is stored in XE.Tref*)
elsif Ref = Tref_Derived
and then Typ = 'R'
and then XE.Tref_File_Num /= No_Sdep_Id
then
Xref.Increment_Last;
declare
XR : Xref_Record renames Xref.Table (Xref.Last);
begin
XR.File_Num := File;
XR.Line := Line;
XR.Rtype := Interface_Reference;
XR.Col := Col;
XR.Name := Std;
end;
else
XE.Tref := Ref;
XE.Tref_File_Num := File;
XE.Tref_Line := Line;
XE.Tref_Type := Typ;
XE.Tref_Col := Col;
XE.Tref_Standard_Entity := Std;
end if;
end;
end loop;
-- Loop through cross-references for this entity
loop
Skip_Space;
if At_Eol then
Skip_Eol;
exit when Nextc /= '.';
P := P + 1;
end if;
Xref.Increment_Last;
declare
XR : Xref_Record renames Xref.Table (Xref.Last);
begin
N := Get_Nat;
if Nextc = '|' then
XR.File_Num :=
Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
Current_File_Num := XR.File_Num;
P := P + 1;
N := Get_Nat;
else
XR.File_Num := Current_File_Num;
end if;
XR.Line := N;
XR.Rtype := Getc;
-- Imported entities reference as in:
-- 494b<c,__gnat_copy_attribs>25
if Nextc = '<' then
Skipc;
XR.Imported_Lang := Get_Name;
pragma Assert (Nextc = ',');
Skipc;
XR.Imported_Name := Get_Name;
pragma Assert (Nextc = '>');
Skipc;
else
XR.Imported_Lang := No_Name;
XR.Imported_Name := No_Name;
end if;
XR.Col := Get_Nat;
if Nextc = '[' then
Read_Instantiation_Reference;
end if;
end;
end loop;
-- Record last cross-reference
XE.Last_Xref := Xref.Last;
C := Nextc;
exception
when Bad_ALI_Format =>
-- If ignoring errors, then we skip a line with an
-- unexpected error, and try to continue subsequent
-- xref lines.
if Ignore_Errors then
Xref_Entity.Decrement_Last;
Skip_Line;
C := Nextc;
-- Otherwise, we reraise the fatal exception
else
raise;
end if;
end Read_Refs_For_One_Entity;
end loop;
-- Record last entity
XS.Last_Entity := Xref_Entity.Last;
end Read_Refs_For_One_File;
C := Getc;
end loop X_Loop;
-- Here after dealing with xref sections
-- Ignore remaining lines, which belong to an additional section of the
-- ALI file not considered here (like SCO or SPARK information).
Check_Unknown_Line;
return Id;
exception
when Bad_ALI_Format =>
return No_ALI_Id;
end Scan_ALI;
-----------
-- Scope --
-----------
function Scope (IS_Id : Invocation_Signature_Id) return Name_Id is
begin
pragma Assert (Present (IS_Id));
return Invocation_Signatures.Table (IS_Id).Scope;
end Scope;
---------
-- SEq --
---------
function SEq (F1, F2 : String_Ptr) return Boolean is
begin
return F1.all = F2.all;
end SEq;
-----------------------------------
-- Set_Invocation_Graph_Encoding --
-----------------------------------
procedure Set_Invocation_Graph_Encoding
(Kind : Invocation_Graph_Encoding_Kind;
Update_Units : Boolean := True)
is
begin
Compile_Time_Invocation_Graph_Encoding := Kind;
-- Update the invocation-graph encoding of the current unit only when
-- requested by the caller.
if Update_Units then
declare
Curr_Unit : Unit_Record renames Units.Table (Units.Last);
Curr_ALI : ALIs_Record renames ALIs.Table (Curr_Unit.My_ALI);
begin
Curr_ALI.Invocation_Graph_Encoding := Kind;
end;
end if;
end Set_Invocation_Graph_Encoding;
-----------
-- SHash --
-----------
function SHash (S : String_Ptr) return Vindex is
H : Word;
begin
H := 0;
for J in S.all'Range loop
H := H * 2 + Character'Pos (S (J));
end loop;
return Vindex (Vindex'First + Vindex (H mod Vindex'Range_Length));
end SHash;
---------------
-- Signature --
---------------
function Signature
(IC_Id : Invocation_Construct_Id) return Invocation_Signature_Id
is
begin
pragma Assert (Present (IC_Id));
return Invocation_Constructs.Table (IC_Id).Signature;
end Signature;
--------------------
-- Spec_Placement --
--------------------
function Spec_Placement
(IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind
is
begin
pragma Assert (Present (IC_Id));
return Invocation_Constructs.Table (IC_Id).Spec_Placement;
end Spec_Placement;
------------
-- Target --
------------
function Target
(IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id
is
begin
pragma Assert (Present (IR_Id));
return Invocation_Relations.Table (IR_Id).Target;
end Target;
end ALI;
|
source/directories/machine-apple-darwin/a-dirinf.ads | ytomino/drake | 33 | 15945 | pragma License (Unrestricted);
-- AARM A.16(124.cc/2), specialized for POSIX (Darwin, FreeBSD, or Linux)
package Ada.Directories.Information is
-- System-specific directory information.
-- Unix and similar systems version.
function Last_Access_Time (Name : String) return Calendar.Time;
function Last_Status_Change_Time (Name : String) return Calendar.Time;
-- modified
type Permission is (
Others_Execute, Others_Write, Others_Read,
Group_Execute, Group_Write, Group_Read,
Owner_Execute, Owner_Write, Owner_Read,
Sticky, -- additional
Set_Group_ID, Set_User_ID);
type Permission_Set_Type is array (Permission) of Boolean;
pragma Pack (Permission_Set_Type);
function Permission_Set (Name : String) return Permission_Set_Type;
function Owner (Name : String) return String;
-- Returns the image of the User_Id. If a definition of User_Id
-- is available, an implementation-defined version of Owner
-- returning User_Id should also be defined.
function Group (Name : String) return String;
-- Returns the image of the Group_Id. If a definition of Group_Id
-- is available, an implementation-defined version of Group
-- returning Group_Id should also be defined.
function Is_Block_Special_File (Name : String) return Boolean;
function Is_Character_Special_File (Name : String) return Boolean;
function Is_FIFO (Name : String) return Boolean;
function Is_Symbolic_Link (Name : String) return Boolean;
function Is_Socket (Name : String) return Boolean;
function Last_Access_Time (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Calendar.Time;
function Last_Status_Change_Time (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Calendar.Time;
function Permission_Set (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Permission_Set_Type;
function Owner (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return String;
-- See Owner above.
function Group (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return String;
-- See Group above.
function Is_Block_Special_File (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Boolean;
function Is_Character_Special_File (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Boolean;
function Is_FIFO (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Boolean;
function Is_Symbolic_Link (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Boolean;
function Is_Socket (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return Boolean;
-- Additional implementation-defined subprograms allowed here.
-- extended
-- Read a target path of a symbolic link.
function Read_Symbolic_Link (Name : String) return String;
function Read_Symbolic_Link (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return String;
-- extended from here
-- The permissions of the current user.
type User_Permission is (User_Execute, User_Write, User_Read);
type User_Permission_Set_Type is array (User_Permission) of Boolean;
pragma Pack (User_Permission_Set_Type);
function User_Permission_Set (Name : String)
return User_Permission_Set_Type;
function User_Permission_Set (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return User_Permission_Set_Type;
-- to here
-- extended
-- Unique file identifier.
type File_Id is mod 2 ** 64; -- 64bit inode
function Identity (Name : String) return File_Id;
function Identity (
Directory_Entry : Directory_Entry_Type) -- Assigned_Directory_Entry_Type
return File_Id;
end Ada.Directories.Information;
|
konz/konz1/rac.ads | balintsoos/LearnAda | 0 | 15725 | <filename>konz/konz1/rac.ads
package Rac is
type Raci is record
szamlalo: Integer;
nevezo: Positive;
end record;
function "/" (A: Integer; B: Positive) return Raci;
function "+" (A: Raci; B: Raci) return Raci;
procedure kiir (A: Raci);
end Rac;
|
programs/oeis/143/A143299.asm | neoneye/loda | 22 | 160456 | <filename>programs/oeis/143/A143299.asm
; A143299: Number of terms in the Zeckendorf representation of every number in row n of the Wythoff array.
; 1,2,2,2,3,2,3,3,2,3,3,3,4,2,3,3,3,4,3,4,4,2,3,3,3,4,3,4,4,3,4,4,4,5,2,3,3,3,4,3,4,4,3,4,4,4,5,3,4,4,4,5,4,5,5,2,3,3,3,4,3,4,4,3,4,4,4,5,3,4,4,4,5,4,5,5,3,4,4,4,5,4,5,5,4,5,5,5,6,2,3,3,3,4,3,4,4,3,4,4
mov $1,2
lpb $0
mov $2,$0
seq $2,66628 ; a(n) = n - the largest Fibonacci number <= n.
mov $0,$2
add $1,2
lpe
div $1,2
mov $0,$1
|
audio/sfx/battle_25.asm | opiter09/ASM-Machina | 1 | 241957 | SFX_Battle_25_Ch8:
noise_note 15, 4, -7, 65
noise_note 8, 8, -7, 65
noise_note 8, 12, -7, 65
noise_note 8, 15, 2, 66
noise_note 15, 15, 2, 65
sound_ret
|
programs/oeis/180/A180119.asm | neoneye/loda | 22 | 246967 | ; A180119: a(n) = (n+2)! * Sum_{k = 1..n} 1/((k+1)*(k+2)).
; 0,1,6,36,240,1800,15120,141120,1451520,16329600,199584000,2634508800,37362124800,566658892800,9153720576000,156920924160000,2845499424768000,54420176498688000,1094805903679488000,23112569077678080000,510909421717094400000,11802007641664880640000,284372184127734743040000,7135156619932253552640000,186134520519971831808000000,5041143264082570444800000000,141555302855438578089984000000,4115992652258137116770304000000,123784667912355827363610624000000,3846166467276770350226472960000000,123342579812668842265883443200000000
mov $1,$0
mov $2,$0
pow $2,2
add $0,$2
mod $0,1024
div $0,2
lpb $1
mul $0,$1
sub $1,1
lpe
|
programs/oeis/324/A324015.asm | karttu/loda | 0 | 101675 | ; A324015: Number of nonempty subsets of {1, ..., n} containing no two cyclically successive elements.
; 0,1,2,3,6,10,17,28,46,75,122,198,321,520,842,1363,2206,3570,5777,9348,15126,24475,39602,64078,103681,167760,271442,439203,710646,1149850,1860497,3010348,4870846,7881195,12752042,20633238,33385281,54018520,87403802
mov $2,$0
mov $4,1
lpb $0,1
sub $0,1
add $3,$2
mov $2,$4
trn $2,$0
mov $4,$3
lpe
add $1,$2
|
alloy4fun_models/trashltl/models/4/TTFxmGy2LFtHmcJEA.als | Kaixi26/org.alloytools.alloy | 0 | 4335 | open main
pred idTTFxmGy2LFtHmcJEA_prop5 {
eventually some ((File-Protected) & Trash)
}
pred __repair { idTTFxmGy2LFtHmcJEA_prop5 }
check __repair { idTTFxmGy2LFtHmcJEA_prop5 <=> prop5o } |
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/chip/ys_chip0.asm | prismotizm/gigaleak | 0 | 170774 | Name: ys_chip0.asm
Type: file
Size: 368848
Last-Modified: '2016-05-13T04:51:15Z'
SHA-1: AB15B0F98DFD1820D600928F4575E2BCC8C26FA6
Description: null
|
1-base/math/source/generic/pure/geometry/any_math-any_geometry-any_d3-any_modeller-any_forge.adb | charlie5/lace-alire | 1 | 298 | <reponame>charlie5/lace-alire<filename>1-base/math/source/generic/pure/geometry/any_math-any_geometry-any_d3-any_modeller-any_forge.adb
with
ada.Text_IO,
ada.Strings.unbounded,
ada.Strings.Maps;
package body any_Math.any_Geometry.any_d3.any_Modeller.any_Forge
is
function to_Box_Model (half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return a_Model
is
pragma Unreferenced (half_Extents);
Modeller : any_Modeller.item;
begin
Modeller.add_Triangle ((0.0, 0.0, 0.0),
(1.0, 0.0, 0.0),
(1.0, 1.0, 0.0));
Modeller.add_Triangle ((1.0, 1.0, 0.0),
(0.0, 1.0, 0.0),
(0.0, 0.0, 0.0));
-- TODO: Add the rest.
return Modeller.Model;
end to_Box_Model;
function to_Capsule_Model (Length : in Real := 1.0;
Radius : in Real := 0.5) return a_Model
is
use Functions;
quality_Level : constant Positive := 4;
sides_Count : constant Positive := Positive (quality_Level * 4); -- Number of sides to the cylinder (divisible by 4).
type Edge is -- 'Barrel' edge.
record
Fore : Site;
Aft : Site;
end record;
type Edges is array (Positive range 1 .. sides_Count) of Edge;
type arch_Edges is array (Positive range 1 .. quality_Level) of Sites (1 .. sides_Count);
tmp,
ny, nz,
start_nx,
start_ny : Real;
a : constant Real := Pi * 2.0 / Real (sides_Count);
ca : constant Real := Cos (a);
sa : constant Real := Sin (a);
L : constant Real := Length * 0.5;
the_Edges : Edges;
Modeller : any_Modeller.item;
begin
-- Define cylinder body.
--
ny := 1.0;
nz := 0.0; -- Normal vector = (0, ny, nz)
for Each in Edges'Range
loop
the_Edges (Each).Fore (1) := ny * Radius;
the_Edges (Each).Fore (2) := nz * Radius;
the_Edges (Each).Fore (3) := L;
the_Edges (Each).Aft (1) := ny * Radius;
the_Edges (Each).Aft (2) := nz * Radius;
the_Edges (Each).Aft (3) := -L;
-- Rotate ny, nz.
--
tmp := ca * ny - sa * nz;
nz := sa * ny + ca * nz;
ny := tmp;
end loop;
for Each in Edges'Range
loop
if Each /= Edges'Last
then
Modeller.add_Triangle (the_Edges (Each) .Fore,
the_Edges (Each) .Aft,
the_Edges (Each + 1).Aft);
Modeller.add_Triangle (the_Edges (Each + 1).Aft,
the_Edges (Each + 1).Fore,
the_Edges (Each) .Fore);
else
Modeller.add_Triangle (the_Edges (Each) .Fore,
the_Edges (Each) .Aft,
the_Edges (edges'First).Aft);
Modeller.add_Triangle (the_Edges (edges'First).Aft,
the_Edges (edges'First).Fore,
the_Edges (Each) .Fore);
end if;
end loop;
-- Define fore cylinder cap.
--
declare
the_arch_Edges : arch_Edges;
begin
start_nx := 0.0;
start_ny := 1.0;
for each_Hoop in 1 .. quality_Level
loop
-- Get start_n2 = rotated start_n.
--
declare
start_nx2 : constant Real := ca * start_nx + sa * start_ny;
start_ny2 : constant Real := -sa * start_nx + ca * start_ny;
begin
-- Get n = start_n and n2 = start_n2.
--
ny := start_ny;
nz := 0.0;
declare
nx2 : constant Real := start_nx2;
ny2 : Real := start_ny2;
nz2 : Real := 0.0;
begin
for Each in 1 .. sides_Count
loop
the_arch_Edges (each_Hoop)(Each) (1) := ny2 * Radius;
the_arch_Edges (each_Hoop)(Each) (2) := nz2 * Radius;
the_arch_Edges (each_Hoop)(Each) (3) := nx2 * Radius + L;
-- Rotate n, n2.
--
tmp := ca * ny - sa * nz;
nz := sa * ny + ca * nz;
ny := tmp;
tmp := ca * ny2 - sa * nz2;
nz2 := sa * ny2 + ca * nz2;
ny2 := tmp;
end loop;
end;
start_nx := start_nx2;
start_ny := start_ny2;
end;
end loop;
for Each in 1 .. sides_Count
loop
if Each /= sides_Count
then
Modeller.add_Triangle (the_Edges (Each) .Fore,
the_Edges (Each + 1).Fore,
the_arch_Edges (1) (Each));
else
Modeller.add_Triangle (the_Edges (Each).Fore,
the_Edges (1) .Fore,
the_arch_Edges (1) (Each));
end if;
if Each /= sides_Count
then
Modeller.add_Triangle (the_Edges (Each + 1).Fore,
the_arch_Edges (1) (Each + 1),
the_arch_Edges (1) (Each));
else
Modeller.add_Triangle (the_Edges (1).Fore,
the_arch_Edges (1) (1),
the_arch_Edges (1) (Each));
end if;
end loop;
for each_Hoop in 1 .. quality_Level - 1
loop
for Each in 1 .. sides_Count
loop
declare
function next_Hoop_Vertex return Positive
is
begin
if Each = sides_Count then return 1;
else return Each + 1;
end if;
end next_Hoop_Vertex;
begin
Modeller.add_Triangle (the_arch_Edges (each_Hoop) (Each),
the_arch_Edges (each_Hoop) (next_Hoop_Vertex),
the_arch_Edges (each_Hoop + 1) (Each));
if each_Hoop /= quality_Level - 1
then
Modeller.add_Triangle (the_arch_Edges (each_Hoop) (next_Hoop_Vertex),
the_arch_Edges (each_Hoop + 1) (next_Hoop_Vertex),
the_arch_Edges (each_Hoop + 1) (Each));
end if;
end;
end loop;
end loop;
end;
-- Define aft cylinder cap.
--
declare
the_arch_Edges : arch_Edges;
begin
start_nx := 0.0;
start_ny := 1.0;
for each_Hoop in 1 .. quality_Level
loop
declare
-- Get start_n2 = rotated start_n.
--
start_nx2 : constant Real := ca * start_nx - sa * start_ny;
start_ny2 : constant Real := sa * start_nx + ca * start_ny;
begin
-- Get n = start_n and n2 = start_n2.
--
ny := start_ny;
nz := 0.0;
declare
nx2 : constant Real := start_nx2;
ny2 : Real := start_ny2;
nz2 : Real := 0.0;
begin
for Each in 1 .. sides_Count
loop
the_arch_Edges (each_Hoop) (Each) (1) := ny2 * Radius;
the_arch_Edges (each_Hoop) (Each) (2) := nz2 * Radius;
the_arch_Edges (each_Hoop) (Each) (3) := nx2 * Radius - L;
-- Rotate n, n2
--
tmp := ca * ny - sa * nz;
nz := sa * ny + ca * nz;
ny := tmp;
tmp := ca * ny2 - sa * nz2;
nz2 := sa * ny2 + ca * nz2;
ny2 := tmp;
end loop;
end;
start_nx := start_nx2;
start_ny := start_ny2;
end;
end loop;
for Each in 1 .. sides_Count
loop
if Each /= sides_Count
then
Modeller.add_Triangle (the_Edges (Each).Aft,
the_arch_Edges (1) (Each),
the_Edges (Each + 1).Aft);
else
Modeller.add_Triangle (the_Edges (Each).Aft,
the_arch_Edges (1) (Each),
the_Edges (1).Aft);
end if;
if Each /= sides_Count
then
Modeller.add_Triangle (The_Edges (Each + 1).Aft,
the_arch_Edges (1) (Each),
the_arch_Edges (1) (Each + 1));
else
Modeller.add_Triangle (the_Edges (1).Aft,
the_arch_Edges (1) (Each),
the_arch_Edges (1) (1));
end if;
end loop;
for each_Hoop in 1 .. quality_Level - 1
loop
for Each in 1 .. sides_Count
loop
declare
function next_Hoop_Vertex return Positive
is
begin
if Each = sides_Count then return 1;
else return Each + 1;
end if;
end next_hoop_Vertex;
begin
Modeller.add_Triangle (the_arch_Edges (each_Hoop) (Each),
the_arch_Edges (each_Hoop + 1) (Each),
the_arch_Edges (each_Hoop) (next_Hoop_Vertex));
if each_Hoop /= quality_Level - 1
then
Modeller.add_Triangle (the_arch_Edges (each_Hoop) (next_hoop_Vertex),
the_arch_Edges (each_Hoop + 1) (Each),
the_arch_Edges (each_Hoop + 1) (next_Hoop_Vertex));
end if;
end;
end loop;
end loop;
end;
return Modeller.Model;
end to_capsule_Model;
-- Polar to euclidian shape models.
--
function to_Radians (From : in Latitude) return Radians
is
begin
return Radians (From) * Pi / 180.0;
end to_Radians;
function to_Radians (From : in Longitude) return Radians
is
begin
return Radians (From) * Pi / 180.0;
end to_Radians;
function polar_Model_from (model_Filename : in String) return polar_Model -- TODO: Handle different file formats.
is
use Functions,
ada.Text_IO,
ada.Strings.unbounded;
the_File : File_type;
the_Text : unbounded_String;
begin
open (the_File, in_File, model_Filename);
while not end_of_File (the_File)
loop
append (the_Text, get_Line (the_File) & " ");
end loop;
declare
text_Length : constant Natural := Length (the_Text);
First : Positive := 1;
function get_Real return Real
is
use ada.Strings,
ada.Strings.Maps;
real_Set : constant Character_Set := to_Set (Span => (Low => '0',
High => '9'))
or to_Set ('-' & '.');
Last : Positive;
Result : Real;
begin
find_Token (the_Text, Set => real_Set,
From => First,
Test => Inside,
First => First,
Last => Last);
Result := Real'Value (Slice (the_Text,
Low => First,
High => Last));
First := Last + 1;
return Result;
end get_Real;
Lat : Latitude;
Long : Longitude;
Value : Integer;
Distance : Real;
Scale : constant Real := 10.0; -- TODO: Add a 'Scale' parameter.
the_Model : polar_Model;
begin
while First < text_Length
loop
Value := Integer (get_Real);
exit when Value = 360;
Long := Longitude (Value);
Lat := Latitude (get_Real);
Distance := get_Real;
the_Model (Long) (Lat).Site (1) := Scale * Distance * Cos (to_Radians (Lat)) * Sin (to_Radians (Long));
the_Model (Long) (Lat).Site (2) := Scale * Distance * Sin (to_Radians (Lat));
the_Model (Long) (Lat).Site (3) := Scale * Distance * Cos (to_Radians (Lat)) * Cos (to_Radians (Long));
end loop;
return the_Model;
end;
end polar_Model_from;
function mesh_Model_from (Model : in polar_Model) return a_Model
is
the_raw_Model : polar_Model := Model;
the_mesh_Model : a_Model (site_Count => 2522,
tri_Count => 73 * (16 * 4 + 6));
the_longitude : Longitude := 0;
the_latitude : Latitude ;
the_Vertex : Positive := 1;
the_Triangle : Positive := 1;
the_North_Pole : Positive;
the_South_Pole : Positive;
function Sum (the_Longitude : in Longitude; Increment : in Integer) return Longitude
is
Result : Integer := Integer (the_Longitude) + Increment;
begin
if Result >= 360
then
Result := Result - 360;
end if;
return longitude (Result);
end Sum;
begin
the_mesh_Model.Sites (the_Vertex) := (the_raw_model (0) (-90).Site);
the_North_Pole := the_Vertex;
the_raw_Model (0) (-90).Id := the_Vertex;
the_Vertex := the_Vertex + 1;
the_mesh_Model.Sites (the_Vertex) := (the_raw_model (0) (90).Site);
the_south_Pole := the_Vertex;
the_raw_Model (0) (90).Id := the_Vertex;
the_Vertex := the_Vertex + 1;
loop
the_latitude := -90;
loop
if the_Latitude = -90
then
the_raw_Model (the_Longitude) (the_Latitude).Id := the_North_Pole;
elsif the_Latitude = 90
then
the_raw_Model (the_Longitude) (the_Latitude).Id := the_South_Pole;
else
the_mesh_Model.Sites (the_Vertex) := the_raw_model (the_Longitude) (the_Latitude).Site;
the_raw_Model (the_Longitude) (the_Latitude).Id := the_Vertex;
the_Vertex := the_Vertex + 1;
end if;
exit when the_Latitude = 90;
the_Latitude := the_Latitude + 5;
end loop;
exit when the_Longitude = 355;
the_Longitude := the_Longitude + 5;
end loop;
the_Longitude := 0;
loop
the_mesh_Model.Triangles (the_Triangle) := (1 => the_North_Pole,
2 => the_raw_Model (Sum (the_Longitude, 5)) (-85).Id,
3 => the_raw_Model ( the_Longitude ) (-85).Id);
the_Triangle := the_Triangle + 1;
the_mesh_Model.Triangles (the_Triangle) := (1 => the_South_Pole,
2 => the_raw_Model (the_Longitude) (85).Id,
3 => the_raw_Model (Sum (the_Longitude, 5)) (85).Id);
the_Triangle := the_Triangle + 1;
the_Latitude := -85;
loop
the_mesh_Model.Triangles (the_Triangle) := (1 => the_raw_Model ( the_Longitude) (the_Latitude ).Id,
2 => the_raw_Model (Sum (the_Longitude, 5)) (the_Latitude ).Id,
3 => the_raw_Model ( the_Longitude) (the_Latitude + 5).Id);
the_Triangle := the_Triangle + 1;
the_mesh_Model.Triangles (the_Triangle) := (1 => the_raw_Model (the_Longitude) (the_Latitude + 5).Id,
2 => the_raw_Model (Sum (the_Longitude, 5)) (the_Latitude ).Id,
3 => the_raw_Model (Sum (the_Longitude, 5)) (the_Latitude + 5).Id);
the_Triangle := the_Triangle + 1;
the_Latitude := the_Latitude + 5;
exit when the_Latitude = 85;
end loop;
exit when the_Longitude = 355;
the_Longitude := the_Longitude + 5;
end loop;
the_mesh_Model.Triangles (the_Triangle) := (1 => the_North_Pole,
2 => the_raw_Model (5) (-85).Id,
3 => the_raw_Model (0) (-85).Id);
the_Triangle := the_Triangle + 1;
the_mesh_Model.Triangles (the_Triangle) := (1 => the_South_Pole,
2 => the_raw_Model (0) (85).Id,
3 => the_raw_Model (5) (85).Id);
the_Triangle := the_Triangle + 1;
the_latitude := -85;
loop
the_mesh_Model.Triangles (the_Triangle) := (1 => the_raw_Model (0) (the_Latitude ).Id,
2 => the_raw_Model (5) (the_Latitude ).Id,
3 => the_raw_Model (0) (the_Latitude + 5).Id);
the_Triangle := the_Triangle + 1;
the_mesh_Model.Triangles (the_Triangle) := (1 => the_raw_Model (0) (the_Latitude + 5).Id,
2 => the_raw_Model (5) (the_Latitude ).Id,
3 => the_raw_Model (5) (the_Latitude + 5).Id);
the_Triangle := the_Triangle + 1;
the_Latitude := the_Latitude + 5;
exit when the_Latitude = 85;
end loop;
return the_mesh_Model;
end mesh_Model_from;
end any_Math.any_Geometry.any_d3.any_Modeller.any_Forge;
|
Driver/Printer/DotMatrix/Grpr9/grpr9DriverInfo.asm | steakknife/pcgeos | 504 | 169107 | <filename>Driver/Printer/DotMatrix/Grpr9/grpr9DriverInfo.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: IBM Graphics Printer 9-pin printer driver
FILE: grpr9DriverInfo.asm
AUTHOR: <NAME>
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 2/93 Initial 2.0 version
DESCRIPTION:
Driver info for the graphics printer 9-pin printer driver
The file "printerDriver.def" should be included before this one
$Id: grpr9DriverInfo.asm,v 1.1 97/04/18 11:55:26 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Driver Info Resource
This part of the file contains the information that pertains to
all device supported by the driver. It includes device names and
a table of the resource handles for the specific device info. A
pointer to this info is provided by the DriverInfo function.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DriverInfo segment lmem LMEM_TYPE_GENERAL
;----------------------------------------------------------------------------
; Device Enumerations
;----------------------------------------------------------------------------
DefPrinter PD_IBM_GP, "IBM Graphics Printer", grprInfo
DefPrinter PD_IBM_3812, "IBM Pageprinter 3812", grprInfo
DefPrinter PD_IBM_PP, "IBM Proprinter", pp1Info
DefPrinter PD_INFOSCRIBE_1100_I, "Infoscribe 1100 (IBM Mode)", grprInfo
DefPrinter PD_INFOSCRIBE_1400_I, "Infoscribe 1400 (IBM Mode)", grprInfo
DefPrinter PD_OLIVETTI_DM109_I, "Olivetti DM 109 (IBM Mode)", pp1Info
DefPrinter PD_OLIVETTI_DM99_I, "Olivetti DM 99 (IBM Mode)", pp1Info
DefPrinter PD_PANASONIC_KXP1080I_I, "Panasonic KX-P1080i (IBM Mode)", grprInfo
DefPrinter PD_PANASONIC_KXP1091_I, "Panasonic KX-P1091 (IBM Mode)", grprInfo
DefPrinter PD_PANASONIC_KXP1091I_I, "Panasonic KX-P1091i (IBM Mode)", grprInfo
DefPrinter PD_PANASONIC_KXP1092I_I, "Panasonic KX-P1092i (IBM Mode)", pp1Info
DefPrinter PD_TANDY_DMP106_I, "Tandy DMP 106 (IBM Mode)", grprInfo
DefPrinter PD_TANDY_DMP107_I, "Tandy DMP 107 (IBM Mode)", grprInfo
DefPrinter PD_TANDY_DMP130A_I, "Tandy DMP 130A (IBM Mode)", grprInfo
DefPrinter PD_TANDY_DMP132_I, "Tandy DMP 132 (IBM Mode)", grprInfo
DefPrinter PD_TANDY_DMP133_I, "Tandy DMP 133 (IBM Mode)", grprInfo
DefPrinter PD_TANDY_DMP2120_I, "Tandy DMP 2120 (IBM Mode)", grprInfo
;----------------------------------------------------------------------------
; Driver Info Header
;----------------------------------------------------------------------------
DriverExtendedInfoTable < {}, ; lmem hdr
PrintDevice/2, ; # devices
offset deviceStrings, ; devices
offset deviceInfoTab ; info blocks
>
PrintDriverInfo < 30, ; timeout (sec)
PR_DONT_RESEND,
isoSubstitutions, ;ISO sub tab.
asciiTransTable,
PDT_PRINTER,
TRUE
>
;----------------------------------------------------------------------------
; Device String Table and Strings
;----------------------------------------------------------------------------
isoSubstitutions chunk.word 0ffffh ;no ISO subs.
; ASCII Translation List for Foreign Language Versions
asciiTransTable chunk.char ";;",0
;Create the actual tables here......
PrinterTables
DriverInfo ends
|
programs/oeis/133/A133190.asm | karttu/loda | 1 | 105337 | <filename>programs/oeis/133/A133190.asm
; A133190: a(n) = 2a(n-1) - a(n-2) + 2a(n-3).
; 1,3,3,5,13,27,51,101,205,411,819,1637,3277,6555,13107,26213,52429,104859,209715,419429,838861,1677723,3355443,6710885,13421773,26843547,53687091,107374181,214748365,429496731,858993459,1717986917,3435973837
cal $0,100455 ; a(n) = 2^n + sin(n*Pi/2).
mov $2,12
add $2,$0
mul $2,2
mov $0,$2
div $0,5
mov $1,$0
sub $1,5
mul $1,2
add $1,1
|
test-suite/programs/unit/jgt_0x1D.asm | ocus/TinyASM_Haskell | 0 | 247845 | MOV [0] 57
MOV [1] 58
MOV [2] 56
JGT 16 [0] [2]
DPRINT 123
HALT
JGT 23 [0] [1]
DPRINT 456
HALT
DPRINT 789
HALT
|
m3-sys/m3gdb/gdb/gdb/testsuite/gdb.ada/exec_changed/second.adb | jaykrell/cm3 | 105 | 17990 | procedure Second is
begin
null;
end Second;
|
firmware/glyphs/glyphs9.asm | ddomurad/avrVideoCard | 0 | 4493 | <gh_stars>0
.org 0x5800
.db 0x0, 0x0, 0x0, 0x0, 0x11, 0xaa, 0x33, 0xaa, 0x0, 0xc3
.db 0xff, 0xee, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0xcc, 0x18, 0x18, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18
.db 0x0, 0x0, 0x18, 0x18, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18
.db 0x18, 0x18, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x66, 0x66
.db 0x0, 0x0, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x0, 0x0
.db 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
.db 0x24, 0x0, 0x0, 0x0, 0x24, 0x24, 0x3c, 0x0, 0x0, 0x0
.db 0x0, 0x18, 0x3c, 0x0, 0x41, 0x1c, 0x3c, 0x5a, 0x0, 0x0
.db 0x0, 0x0, 0x3, 0x3, 0x0, 0x70, 0x0, 0x3, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x18, 0x18, 0x3c, 0xfc, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0
.db 0x18, 0x8, 0x18, 0x10, 0x0, 0x0, 0x0, 0x0, 0x38, 0x38
.db 0x38, 0x38, 0x0, 0x0, 0x0, 0x3c
.org 0x5900
.db 0x0, 0x0, 0x0, 0x3c, 0x44, 0x55, 0x33, 0xaa, 0xff, 0x81
.db 0xfd, 0xee, 0xf7, 0x7e, 0x0, 0x18, 0xcd, 0x32, 0x0, 0x0
.db 0x0, 0x0, 0xc, 0x88, 0x0, 0x18, 0x0, 0x0, 0x20, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x36, 0x24, 0x8, 0x0, 0x3c, 0x18
.db 0xc, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x3c, 0x18
.db 0x3c, 0x3c, 0xe, 0x3e, 0x1e, 0x7e, 0x3c, 0x3c, 0x0, 0x0
.db 0x6, 0x0, 0x60, 0x3c, 0x3c, 0x18, 0x7e, 0x3c, 0x7c, 0x7f
.db 0x7f, 0x3e, 0xe7, 0x3c, 0x3f, 0x73, 0x70, 0x63, 0x67, 0x3c
.db 0x7e, 0x3c, 0xfc, 0x1e, 0x3f, 0xe7, 0xe7, 0xe7, 0xc3, 0xe7
.db 0x7e, 0x1c, 0x40, 0x38, 0x18, 0x0, 0x10, 0x0, 0x60, 0x0
.db 0x6, 0x0, 0xe, 0x0, 0xe0, 0x18, 0x18, 0x70, 0x38, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0xc, 0x18, 0x30, 0x0, 0x0, 0x0, 0x18
.db 0x0, 0x0, 0x18, 0x18, 0x0, 0x0, 0x3c, 0x18, 0x18, 0x18
.db 0x18, 0x18, 0x0, 0x0, 0xff, 0x66, 0x3f, 0xfc, 0x67, 0xe6
.db 0x7f, 0xfe, 0x7e, 0x66, 0xe7, 0xe6, 0x67, 0xe7, 0xff, 0x3c
.db 0xff, 0xe7, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xe7
.db 0x34, 0x0, 0x0, 0x0, 0x34, 0x34, 0x7e, 0x0, 0x0, 0x24
.db 0x0, 0x3c, 0x7e, 0x5, 0x7f, 0x3e, 0x7e, 0x7e, 0x0, 0x0
.db 0x0, 0x0, 0x5, 0x5, 0x0, 0x1a, 0x0, 0x5, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3c
.db 0x24, 0x3c, 0x24, 0x7e, 0x0, 0x8, 0x0, 0x3c, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x3f, 0xff, 0xfe, 0x3f, 0xff, 0xfe
.db 0x3c, 0x3c, 0x7e, 0x7e, 0x0, 0x0, 0x38, 0xc, 0x0, 0x0
.db 0x3c, 0xc, 0x18, 0x30, 0x0, 0x0, 0x0, 0x0, 0x44, 0x44
.db 0x44, 0x44, 0x0, 0x6, 0x66, 0x18
.org 0x5a00
.db 0x0, 0x0, 0x18, 0x7e, 0x11, 0xaa, 0xcc, 0xaa, 0x0, 0x18
.db 0xff, 0xaa, 0xf7, 0x7a, 0x0, 0x3c, 0xb3, 0x4c, 0x8, 0x2
.db 0x10, 0x10, 0x4, 0x88, 0x3c, 0x3c, 0x0, 0x0, 0x10, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x36, 0x7e, 0x3e, 0x64, 0x66, 0x18
.db 0x18, 0x18, 0x24, 0x18, 0x0, 0x0, 0x0, 0x6, 0x66, 0x38
.db 0x66, 0x66, 0x1e, 0x32, 0x30, 0x6, 0x66, 0x66, 0x18, 0x18
.db 0xc, 0x0, 0x30, 0x66, 0x66, 0x3c, 0x33, 0x76, 0x36, 0x31
.db 0x31, 0x73, 0x66, 0x18, 0xc, 0x36, 0x30, 0x77, 0x76, 0x66
.db 0x33, 0x66, 0x66, 0x32, 0x2d, 0x66, 0x66, 0x66, 0x66, 0x66
.db 0x46, 0x18, 0x60, 0x18, 0x3c, 0x0, 0x8, 0x0, 0x60, 0x0
.db 0x6, 0x0, 0x18, 0x0, 0x60, 0x0, 0x0, 0x30, 0x18, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x18, 0x18, 0x32, 0x0, 0x0, 0x18
.db 0x0, 0x0, 0x1c, 0x38, 0x60, 0x6, 0x3c, 0x18, 0x18, 0x18
.db 0x18, 0x18, 0x0, 0x18, 0xff, 0x66, 0x7f, 0xfe, 0x63, 0xc6
.db 0xff, 0xff, 0x66, 0x66, 0xc3, 0xc6, 0x63, 0xc3, 0xff, 0x7e
.db 0xff, 0xe7, 0xff, 0xff, 0xe3, 0xc7, 0xff, 0xff, 0xff, 0xe7
.db 0x24, 0xff, 0x1f, 0xf8, 0x27, 0xe4, 0x5a, 0x5, 0x0, 0x5a
.db 0x0, 0x6a, 0x5a, 0x87, 0x2a, 0x7f, 0x66, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0xa, 0x9, 0x4, 0xc, 0x0, 0x6, 0x3c, 0x3c
.db 0x0, 0x0, 0x0, 0x18, 0x18, 0x1c, 0x0, 0x0, 0xf9, 0x0
.db 0x42, 0x7e, 0x3c, 0x7e, 0x18, 0x14, 0x7e, 0x42, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x41, 0x1, 0x1, 0x7f, 0xff, 0xff
.db 0x42, 0x42, 0x42, 0x42, 0x6, 0x66, 0x6c, 0x12, 0x0, 0x0
.db 0x7e, 0xe, 0x18, 0x70, 0x0, 0x0, 0x10, 0x8, 0x92, 0xb2
.db 0x82, 0x82, 0xdb, 0x12, 0x66, 0x81
.org 0x5b00
.db 0x0, 0x18, 0x3c, 0x7e, 0x44, 0x55, 0xcc, 0xaa, 0xff, 0x3c
.db 0x0, 0x0, 0xf7, 0x5e, 0x0, 0x7e, 0xff, 0x0, 0x48, 0x44
.db 0x92, 0x54, 0x0, 0x0, 0x0, 0x7e, 0x0, 0x1c, 0x1c, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x12, 0x24, 0x68, 0x48, 0x3c, 0x8
.db 0x30, 0xc, 0x18, 0x18, 0x0, 0x0, 0x0, 0xc, 0x66, 0x18
.db 0xc, 0x6, 0x36, 0x30, 0x7c, 0x6, 0x66, 0x66, 0x18, 0x18
.db 0x18, 0x3c, 0x18, 0x6, 0x66, 0x66, 0x33, 0x60, 0x33, 0x30
.db 0x30, 0x60, 0x66, 0x18, 0xc, 0x3c, 0x30, 0x7f, 0x76, 0x66
.db 0x33, 0x66, 0x66, 0x30, 0xc, 0x66, 0x66, 0x42, 0x3c, 0x66
.db 0xc, 0x18, 0x30, 0x18, 0x66, 0x0, 0x0, 0x3c, 0x7c, 0x3c
.db 0x3e, 0x3c, 0x18, 0x7e, 0x7c, 0x38, 0x38, 0x33, 0x18, 0x54
.db 0x5c, 0x3c, 0x7e, 0x3e, 0x36, 0x3e, 0x78, 0x77, 0x66, 0x63
.db 0x36, 0x66, 0x7c, 0x10, 0x18, 0x8, 0x7e, 0x0, 0xff, 0x18
.db 0xf, 0xf0, 0x1f, 0xf8, 0x7f, 0xfe, 0x18, 0x18, 0xff, 0xf8
.db 0x1f, 0xff, 0xff, 0x3c, 0x0, 0x66, 0x70, 0xe, 0x60, 0x6
.db 0xc0, 0x3, 0x66, 0x66, 0x0, 0x6, 0x60, 0x0, 0x0, 0x66
.db 0x0, 0x66, 0x70, 0xe, 0x60, 0x6, 0x60, 0x6, 0x66, 0x66
.db 0x2c, 0x22, 0x22, 0x24, 0x22, 0xc, 0x7e, 0x87, 0x0, 0x18
.db 0x0, 0x7e, 0x7e, 0x72, 0x2a, 0x2a, 0x66, 0x7e, 0x0, 0x0
.db 0x0, 0x0, 0x94, 0x11, 0xf, 0xe, 0x18, 0x8, 0x7e, 0x3c
.db 0x18, 0x0, 0x24, 0x3c, 0x24, 0x3e, 0x0, 0x0, 0xfb, 0x3c
.db 0x42, 0x7e, 0x24, 0xfc, 0x3c, 0x14, 0x7e, 0x42, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x1, 0x7f, 0xff, 0xff
.db 0x42, 0x5a, 0x42, 0x5a, 0xc, 0x3c, 0xee, 0x12, 0x0, 0x0
.db 0xff, 0xff, 0x18, 0xff, 0x0, 0x18, 0x18, 0x18, 0xaa, 0xaa
.db 0xaa, 0xaa, 0x92, 0x32, 0x18, 0xc3
.org 0x5c00
.db 0x0, 0x18, 0x3c, 0x7e, 0x11, 0xaa, 0x33, 0xaa, 0x0, 0x3c
.db 0xff, 0x77, 0x0, 0x7e, 0x0, 0x7e, 0xff, 0x0, 0x2a, 0x54
.db 0x54, 0x54, 0x60, 0x66, 0x7e, 0x3c, 0x18, 0x22, 0x1e, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x0, 0x24, 0x3e, 0x10, 0x19, 0x0
.db 0x30, 0xc, 0x7e, 0x7e, 0x0, 0x7e, 0x0, 0x18, 0x6e, 0x18
.db 0x18, 0xc, 0x66, 0x3c, 0x66, 0xc, 0x3c, 0x3e, 0x0, 0x0
.db 0x30, 0x0, 0xc, 0x1c, 0x6e, 0x7e, 0x3e, 0x60, 0x33, 0x3c
.db 0x3c, 0x60, 0x7e, 0x18, 0xc, 0x38, 0x30, 0x6b, 0x7e, 0x66
.db 0x3e, 0x66, 0x7c, 0x1c, 0xc, 0x66, 0x24, 0x5a, 0x18, 0x3e
.db 0x18, 0x18, 0x18, 0x18, 0x0, 0x0, 0x0, 0x6, 0x66, 0x66
.db 0x66, 0x66, 0x7e, 0xcc, 0x66, 0x18, 0x18, 0x36, 0x18, 0x6a
.db 0x66, 0x66, 0x33, 0x66, 0x3b, 0x60, 0x30, 0x36, 0x66, 0x6b
.db 0x1c, 0x66, 0x4c, 0x30, 0x18, 0xc, 0x4c, 0x0, 0xff, 0x18
.db 0x1f, 0xf8, 0xf, 0xf0, 0x7f, 0xfe, 0x18, 0x18, 0xff, 0xf8
.db 0x1f, 0xff, 0xff, 0x3c, 0x0, 0x66, 0x60, 0x6, 0x70, 0xe
.db 0xc0, 0x3, 0x66, 0x66, 0x0, 0x6, 0x60, 0x0, 0x0, 0x66
.db 0x0, 0x66, 0x60, 0x6, 0x70, 0xe, 0x60, 0x6, 0x66, 0x66
.db 0x24, 0x88, 0x20, 0x84, 0x28, 0x44, 0x3c, 0x72, 0x24, 0x0
.db 0x4, 0x7e, 0x28, 0x77, 0x1c, 0x1c, 0x3c, 0x5a, 0x0, 0x0
.db 0x0, 0x0, 0x68, 0x22, 0x17, 0x13, 0xa8, 0x10, 0xbd, 0x24
.db 0x24, 0x24, 0x24, 0x3c, 0x24, 0x1c, 0x0, 0x0, 0xfb, 0x3c
.db 0x42, 0x7a, 0x3c, 0x10, 0x3c, 0x8, 0x7e, 0x7e, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x1, 0x7f, 0xff, 0xff
.db 0x42, 0x5a, 0x42, 0x5a, 0xd8, 0x18, 0xfe, 0x1c, 0x0, 0x0
.db 0x18, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x1c, 0x38, 0xba, 0xb2
.db 0x92, 0xba, 0xda, 0x7e, 0x18, 0xc3
.org 0x5d00
.db 0x0, 0x0, 0x18, 0x7e, 0x44, 0x55, 0x33, 0xaa, 0xff, 0x18
.db 0xfd, 0x77, 0x7f, 0x7c, 0x0, 0x3c, 0xcd, 0x32, 0x22, 0x14
.db 0x54, 0x38, 0x26, 0x44, 0x0, 0x7e, 0x0, 0x8, 0x36, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x0, 0x7e, 0xb, 0x24, 0x3e, 0x0
.db 0x30, 0xc, 0x18, 0x18, 0x0, 0x0, 0x0, 0x30, 0x76, 0x18
.db 0x30, 0x6, 0x67, 0x6, 0x66, 0x18, 0x66, 0x6, 0x0, 0x0
.db 0x18, 0x3c, 0x18, 0x18, 0x6e, 0x66, 0x33, 0x60, 0x33, 0x30
.db 0x30, 0x67, 0x66, 0x18, 0xc, 0x3c, 0x30, 0x63, 0x6e, 0x66
.db 0x30, 0x66, 0x66, 0x6, 0xc, 0x66, 0x3c, 0x5a, 0x3c, 0xc
.db 0x30, 0x18, 0xc, 0x18, 0x0, 0x0, 0x0, 0x3e, 0x66, 0x60
.db 0x66, 0x7e, 0x18, 0x7c, 0x66, 0x18, 0x18, 0x3c, 0x18, 0x6a
.db 0x66, 0x66, 0x3e, 0x66, 0x30, 0x7e, 0x30, 0x36, 0x24, 0x6b
.db 0x8, 0x3e, 0x18, 0x10, 0x18, 0x8, 0x0, 0x0, 0x0, 0x18
.db 0x1c, 0x38, 0x0, 0x0, 0x60, 0x6, 0x18, 0x18, 0x18, 0x18
.db 0x18, 0x0, 0x18, 0x18, 0xff, 0x66, 0x63, 0xc6, 0x7f, 0xfe
.db 0xff, 0xff, 0x66, 0x66, 0xc3, 0xc6, 0x63, 0xff, 0xc3, 0x7e
.db 0xff, 0xe7, 0xe3, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff
.db 0x34, 0xff, 0x37, 0xf4, 0x1f, 0xf8, 0x42, 0x75, 0x5a, 0x0
.db 0x36, 0x3e, 0x42, 0x72, 0x3e, 0x8, 0x42, 0x3c, 0x0, 0x0
.db 0x0, 0x0, 0x30, 0x46, 0x27, 0x21, 0x50, 0x20, 0xbd, 0x24
.db 0x24, 0x66, 0x0, 0x3c, 0x18, 0x1c, 0x0, 0x0, 0xf9, 0x0
.db 0x42, 0x7a, 0x24, 0x91, 0x3c, 0x8, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x41, 0x1, 0x1, 0x7f, 0xff, 0xff
.db 0x42, 0x42, 0x42, 0x42, 0x70, 0x3c, 0xee, 0x20, 0x0, 0x0
.db 0x18, 0xe, 0x7e, 0x70, 0x3c, 0x7e, 0x1c, 0x38, 0xaa, 0xaa
.db 0xaa, 0x92, 0x8a, 0x30, 0x66, 0x81
.org 0x5e00
.db 0x0, 0x0, 0x0, 0x3c, 0x11, 0xaa, 0xcc, 0xaa, 0x0, 0x81
.db 0xff, 0x55, 0x7f, 0x6e, 0x0, 0x18, 0xb3, 0x4c, 0x0, 0x0
.db 0x10, 0x10, 0x2, 0x44, 0xff, 0xff, 0x18, 0x8, 0x22, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x3e, 0x4c, 0x66, 0x0
.db 0x18, 0x18, 0x24, 0x18, 0x10, 0x0, 0x18, 0x60, 0x66, 0x18
.db 0x62, 0x66, 0x7f, 0x6, 0x66, 0x18, 0x66, 0xc, 0x18, 0x18
.db 0xc, 0x0, 0x30, 0x0, 0x60, 0x66, 0x33, 0x76, 0x36, 0x31
.db 0x30, 0x73, 0x66, 0x18, 0xc, 0x36, 0x31, 0x63, 0x6e, 0x66
.db 0x30, 0x6e, 0x66, 0x26, 0xc, 0x7e, 0x18, 0x3c, 0x66, 0x18
.db 0x62, 0x18, 0x6, 0x18, 0x0, 0x0, 0x0, 0x66, 0x66, 0x66
.db 0x66, 0x60, 0x18, 0xc, 0x66, 0x18, 0x18, 0x36, 0x18, 0x6a
.db 0x66, 0x66, 0x30, 0x3e, 0x30, 0x6, 0x30, 0x36, 0x3c, 0x6b
.db 0x1c, 0x6, 0x32, 0x18, 0x18, 0x18, 0x0, 0x0, 0x0, 0x18
.db 0x18, 0x18, 0x0, 0x0, 0x0, 0x0, 0x18, 0x3c, 0x18, 0x18
.db 0x18, 0x0, 0x18, 0x0, 0xff, 0x66, 0x67, 0xe6, 0x3f, 0xfc
.db 0x7f, 0xfe, 0x66, 0x7e, 0xe7, 0xe6, 0x67, 0xff, 0xe7, 0x3c
.db 0xff, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff
.db 0x24, 0x0, 0x24, 0x24, 0x0, 0x0, 0xbd, 0x70, 0x42, 0x0
.db 0x7d, 0x2c, 0x99, 0x48, 0x5d, 0x5d, 0xbd, 0x81, 0x0, 0x0
.db 0x0, 0x0, 0x50, 0x8c, 0x46, 0x41, 0x60, 0x40, 0x3c, 0x24
.db 0x0, 0x0, 0x0, 0x24, 0x0, 0x8, 0x0, 0x0, 0x0, 0x3c
.db 0x42, 0x7e, 0x3c, 0xfe, 0x3c, 0x14, 0x66, 0x66, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x3f, 0xff, 0xfe, 0x3f, 0xff, 0xfe
.db 0x3c, 0x3c, 0x7e, 0x7e, 0x20, 0x66, 0xfe, 0x40, 0x0, 0x0
.db 0x18, 0xc, 0x3c, 0x30, 0x18, 0x0, 0x18, 0x18, 0x44, 0x7c
.db 0x44, 0x44, 0xdb, 0x10, 0x66, 0x18
.org 0x5f00
.db 0x0, 0x0, 0x0, 0x0, 0x44, 0x55, 0xcc, 0xaa, 0xff, 0xc3
.db 0x0, 0x0, 0x7f, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x18, 0x0, 0x1c, 0x0
.db 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x8, 0x0, 0x3d, 0x0
.db 0xc, 0x30, 0x0, 0x0, 0x20, 0x0, 0x18, 0x0, 0x3c, 0x3c
.db 0x7e, 0x3c, 0x6, 0x3c, 0x3c, 0x38, 0x3c, 0x38, 0x18, 0x8
.db 0x6, 0x0, 0x60, 0x18, 0x3c, 0xe7, 0x7e, 0x3c, 0x7c, 0x7f
.db 0x78, 0x3f, 0xe7, 0x3c, 0x38, 0x73, 0x7f, 0x63, 0xe6, 0x3c
.db 0x78, 0x3f, 0xe7, 0x3c, 0x1e, 0x3c, 0x18, 0x24, 0xc3, 0x70
.db 0x7e, 0x1c, 0x0, 0x38, 0x0, 0x7e, 0x0, 0x3e, 0x7c, 0x3c
.db 0x3e, 0x3c, 0x3c, 0x78, 0xe7, 0x3c, 0x70, 0x73, 0x3c, 0xeb
.db 0xe7, 0x3c, 0x78, 0x7, 0x78, 0x7c, 0x1c, 0x1c, 0x18, 0x36
.db 0x36, 0x3c, 0x7e, 0xc, 0x18, 0x30, 0x0, 0x0, 0x0, 0x18
.db 0x18, 0x18, 0x0, 0x0, 0x0, 0x0, 0x18, 0x3c, 0x18, 0x18
.db 0x18, 0x0, 0x18, 0x0, 0x0, 0x66, 0x66, 0x66, 0x0, 0x0
.db 0x0, 0x0, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x0, 0x66, 0x0
.db 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
.db 0x2c, 0x0, 0x2c, 0x2c, 0x0, 0x0, 0x24, 0x4a, 0x0, 0x0
.db 0x80, 0x0, 0x24, 0x4a, 0x14, 0x14, 0x24, 0x24, 0x0, 0x0
.db 0x0, 0x0, 0x88, 0xf0, 0x80, 0x80, 0x90, 0x80, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x42, 0x7e, 0x24, 0xfc, 0x3c, 0x14, 0x7e, 0x7e, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
.db 0x18, 0x8, 0x18, 0x10, 0x0, 0x0, 0x10, 0x8, 0x38, 0x38
.db 0x38, 0x38, 0x0, 0x0, 0x0, 0x3c
|
src/gl/implementation/gl-buffers.adb | Roldak/OpenGLAda | 79 | 28778 | <filename>src/gl/implementation/gl-buffers.adb
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Unchecked_Conversion;
with GL.API;
with GL.Enums.Getter;
with GL.Low_Level.Enums;
package body GL.Buffers is
use type Culling.Face_Selector;
procedure Clear (Bits : Buffer_Bits) is
use type Low_Level.Bitfield;
function Convert is new Ada.Unchecked_Conversion
(Source => Buffer_Bits, Target => Low_Level.Bitfield);
Raw_Bits : constant Low_Level.Bitfield :=
Convert (Bits) and 2#0100011100000000#;
begin
API.Clear (Raw_Bits);
Raise_Exception_On_OpenGL_Error;
end Clear;
procedure Set_Active_Buffer (Selector : Explicit_Color_Buffer_Selector) is
begin
API.Draw_Buffer (Selector);
Raise_Exception_On_OpenGL_Error;
end Set_Active_Buffer;
procedure Set_Active_Buffers (List : Explicit_Color_Buffer_List) is
begin
API.Draw_Buffers (List'Length, List);
Raise_Exception_On_OpenGL_Error;
end Set_Active_Buffers;
procedure Set_Color_Clear_Value (Value : Colors.Color) is
begin
API.Clear_Color (Value (Colors.R), Value (Colors.G), Value (Colors.B),
Value (Colors.A));
Raise_Exception_On_OpenGL_Error;
end Set_Color_Clear_Value;
function Color_Clear_Value return Colors.Color is
Value : Colors.Color;
begin
API.Get_Color (Enums.Getter.Color_Clear_Value, Value);
Raise_Exception_On_OpenGL_Error;
return Value;
end Color_Clear_Value;
procedure Set_Depth_Clear_Value (Value : Depth) is
begin
API.Clear_Depth (Value);
Raise_Exception_On_OpenGL_Error;
end Set_Depth_Clear_Value;
function Depth_Clear_Value return Depth is
Value : aliased Double;
begin
API.Get_Double (Enums.Getter.Depth_Clear_Value, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Depth_Clear_Value;
procedure Set_Stencil_Clear_Value (Value : Stencil_Index) is
begin
API.Clear_Stencil (Value);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Clear_Value;
function Stencil_Clear_Value return Stencil_Index is
Value : aliased Stencil_Index;
begin
API.Get_Integer (Enums.Getter.Stencil_Clear_Value, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Clear_Value;
procedure Set_Accum_Clear_Value (Value : Colors.Color) is
begin
API.Clear_Accum (Value (Colors.R), Value (Colors.G), Value (Colors.B),
Value (Colors.A));
Raise_Exception_On_OpenGL_Error;
end Set_Accum_Clear_Value;
function Accum_Clear_Value return Colors.Color is
Value : Colors.Color;
begin
API.Get_Color (Enums.Getter.Accum_Clear_Value, Value);
Raise_Exception_On_OpenGL_Error;
return Value;
end Accum_Clear_Value;
procedure Set_Depth_Function (Func : Compare_Function) is
begin
API.Depth_Func (Func);
Raise_Exception_On_OpenGL_Error;
end Set_Depth_Function;
function Depth_Function return Compare_Function is
Value : aliased Compare_Function;
begin
API.Get_Compare_Function (Enums.Getter.Depth_Func, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Depth_Function;
procedure Depth_Mask (Enabled : Boolean) is
begin
API.Depth_Mask (Low_Level.Bool (Enabled));
Raise_Exception_On_OpenGL_Error;
end Depth_Mask;
function Depth_Mask return Boolean is
Value : aliased Low_Level.Bool;
begin
API.Get_Boolean (Enums.Getter.Depth_Writemask, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Boolean (Value);
end Depth_Mask;
procedure Set_Stencil_Function (Func : Compare_Function;
Ref : Int;
Mask : UInt) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Function (Face, Func, Ref, Mask);
end Set_Stencil_Function;
procedure Set_Stencil_Function (Face : Culling.Face_Selector;
Func : Compare_Function;
Ref : Int;
Mask : UInt) is
begin
API.Stencil_Func_Separate (Face, Func, Ref, Mask);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Function;
function Stencil_Function (Face : Single_Face_Selector) return Compare_Function is
Value : aliased Compare_Function;
begin
if Face = Culling.Front then
API.Get_Compare_Function (Enums.Getter.Stencil_Func, Value'Access);
else
API.Get_Compare_Function (Enums.Getter.Stencil_Back_Func, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Function;
function Stencil_Reference_Value (Face : Single_Face_Selector) return Int is
Value : aliased Int;
begin
if Face = Culling.Front then
API.Get_Integer (Enums.Getter.Stencil_Ref, Value'Access);
else
API.Get_Integer (Enums.Getter.Stencil_Back_Ref, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Reference_Value;
function Stencil_Value_Mask (Face : Single_Face_Selector) return UInt is
Value : aliased UInt;
begin
if Face = Culling.Front then
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Value_Mask, Value'Access);
else
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Back_Value_Mask, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Value_Mask;
procedure Set_Stencil_Operation (Stencil_Fail : Buffers.Stencil_Action;
Depth_Fail : Buffers.Stencil_Action;
Depth_Pass : Buffers.Stencil_Action) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Operation (Face, Stencil_Fail, Depth_Fail, Depth_Pass);
end Set_Stencil_Operation;
procedure Set_Stencil_Operation (Face : Culling.Face_Selector;
Stencil_Fail : Buffers.Stencil_Action;
Depth_Fail : Buffers.Stencil_Action;
Depth_Pass : Buffers.Stencil_Action) is
begin
API.Stencil_Op_Separate (Face, Stencil_Fail, Depth_Fail, Depth_Pass);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Operation;
function Stencil_Operation_Stencil_Fail (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Fail, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Fail, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Stencil_Fail;
function Stencil_Operation_Depth_Fail (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Pass_Depth_Fail, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Pass_Depth_Fail, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Depth_Fail;
function Stencil_Operation_Depth_Pass (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Pass_Depth_Pass, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Pass_Depth_Pass, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Depth_Pass;
procedure Set_Stencil_Mask (Value : UInt) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Mask (Face, Value);
end Set_Stencil_Mask;
procedure Set_Stencil_Mask (Face : Culling.Face_Selector;
Value : UInt) is
begin
API.Stencil_Mask_Separate (Face, Value);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Mask;
function Stencil_Mask (Face : Single_Face_Selector) return UInt is
Value : aliased UInt;
begin
if Face = Culling.Front then
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Writemask, Value'Access);
else
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Back_Writemask, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Mask;
procedure Clear_Color_Buffers (Selector : Base_Color_Buffer_Selector;
Value : Colors.Color) is
begin
API.Clear_Buffer (Selector, 0, Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Color_Buffers;
procedure Clear_Draw_Buffer (Index : Draw_Buffer_Index;
Value : Colors.Color) is
begin
API.Clear_Draw_Buffer (Low_Level.Enums.Color, Index, Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Draw_Buffer;
procedure Clear_Depth_Buffer (Value : Depth) is
Aliased_Value : aliased constant Depth := Value;
begin
API.Clear_Buffer_Depth (Low_Level.Enums.Depth_Buffer, 0,
Aliased_Value'Unchecked_Access);
Raise_Exception_On_OpenGL_Error;
end Clear_Depth_Buffer;
procedure Clear_Stencil_Buffer (Value : Stencil_Index) is
Aliased_Value : aliased constant Stencil_Index := Value;
begin
API.Clear_Buffer_Stencil (Low_Level.Enums.Stencil, 0,
Aliased_Value'Unchecked_Access);
Raise_Exception_On_OpenGL_Error;
end Clear_Stencil_Buffer;
procedure Clear_Depth_And_Stencil_Buffer (Depth_Value : Depth;
Stencil_Value : Stencil_Index) is
begin
API.Clear_Buffer_Depth_Stencil (Low_Level.Enums.Depth_Stencil, 0,
Depth_Value, Stencil_Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Depth_And_Stencil_Buffer;
end GL.Buffers;
|
test/gameboy/test_ldd.asm | gb-archive/asmotor | 0 | 167321 | <filename>test/gameboy/test_ldd.asm
SECTION "Test",CODE[0]
ld [hl+],a
|
programs/oeis/051/A051747.asm | jmorken/loda | 1 | 172233 | ; A051747: a(n) = n*(n+1)*(n+2)*(n^2+7*n+32)/120.
; 2,10,31,76,161,308,546,912,1452,2222,3289,4732,6643,9128,12308,16320,21318,27474,34979,44044,54901,67804,83030,100880,121680,145782,173565,205436,241831,283216,330088,382976,442442,509082,583527,666444,758537,860548,973258,1097488,1234100,1383998,1548129,1727484,1923099,2136056,2367484,2618560,2890510,3184610,3502187,3844620,4213341,4609836,5035646,5492368,5981656,6505222,7064837,7662332,8299599,8978592,9701328,10469888,11286418,12153130,13072303,14046284,15077489,16168404,17321586,18539664,19825340,21181390,22610665,24116092,25700675,27367496,29119716,30960576,32893398,34921586,37048627,39278092,41613637,44059004,46618022,49294608,52092768,55016598,58070285,61258108,64584439,68053744,71670584,75439616,79365594,83453370,87707895,92134220,96737497,101522980,106496026,111662096,117026756,122595678,128374641,134369532,140586347,147031192,153710284,160629952,167796638,175216898,182897403,190844940,199066413,207568844,216359374,225445264,234833896,244532774,254549525,264891900,275567775,286585152,297952160,309677056,321768226,334234186,347083583,360325196,373967937,388020852,402493122,417394064,432733132,448519918,464764153,481475708,498664595,516340968,534515124,553197504,572398694,592129426,612400579,633223180,654608405,676567580,699112182,722253840,746004336,770375606,795379741,821028988,847335751,874312592,901972232,930327552,959391594,989177562,1019698823,1050968908,1083001513,1115810500,1149409898,1183813904,1219036884,1255093374,1291998081,1329765884,1368411835,1407951160,1448399260,1489771712,1532084270,1575352866,1619593611,1664822796,1711056893,1758312556,1806606622,1855956112,1906378232,1957890374,2010510117,2064255228,2119143663,2175193568,2232423280,2290851328,2350496434,2411377514,2473513679,2536924236,2601628689,2667646740,2734998290,2803703440,2873782492,2945255950,3018144521,3092469116,3168250851,3245511048,3324271236,3404553152,3486378742,3569770162,3654749779,3741340172,3829564133,3919444668,4011004998,4104268560,4199259008,4296000214,4394516269,4494831484,4596970391,4700957744,4806818520,4914577920,5024261370,5135894522,5249503255,5365113676,5482752121,5602445156,5724219578,5848102416,5974120932,6102302622,6232675217,6365266684,6500105227,6637219288,6776637548,6918388928,7062502590,7209007938,7357934619,7509312524,7663171789,7819542796,7978456174,8139942800,8304033800,8470760550
mov $7,$0
mov $9,$0
add $9,1
lpb $9
clr $0,7
mov $0,$7
sub $9,1
sub $0,$9
mov $4,$0
mov $6,$0
add $6,1
lpb $6
mov $0,$4
sub $6,1
sub $0,$6
mov $1,3
add $1,$0
bin $1,$0
add $1,1
add $1,$0
add $5,$1
lpe
add $8,$5
lpe
mov $1,$8
|
Ada/DataStructures/AVLTree/generic_avl_tree.adb | egustafson/sandbox | 2 | 17045 | <gh_stars>1-10
with Generic_Stack;
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Unchecked_Deallocation;
use Ada.Text_IO, Ada.Integer_Text_IO;
package body Generic_AVL_Tree is
type Compare_Result_Type is ( Less_Than, Equal, Greater_Than );
----------------------------------------------------------------------
procedure Free is new Ada.Unchecked_Deallocation( Tree_Node,
Tree_Node_Ptr );
----------------------------------------------------------------------
procedure Put(Ballance: in Pivot_Type) is
begin
case Ballance is
when Pivot_Left => Put("Pivot Left");
when Left => Put(" Left");
when Equal => Put("Equal");
when Right => Put("Right");
when Pivot_Right => Put("Pivot Right");
end case;
end Put;
----------------------------------------------------------------------
function Compare( Left, Right : in Element_Type ) return
Compare_Result_Type is
begin
if Less_Than( Left, Right ) then
return Less_Than;
elsif Greater_Than( Left, Right ) then
return Greater_Than;
else
return Equal;
end if;
end Compare;
----------------------------------------------------------------------
function Find_Node( Tree: in T; Element: in Element_Type ) return
Tree_Node_Ptr is
Node : Tree_Node_Ptr;
begin
while Node /= null loop
case Compare ( Element, Node.Data ) is
when Equal =>
return Node;
when Less_Than =>
Node := Node.Left;
when Greater_Than =>
Node := Node.Right;
end case;
end loop;
return Node;
end Find_Node;
----------------------------------------------------------------------
function Is_In_Tree( Tree: in T; Element: in Element_Type ) return Boolean is
Node : Tree_Node_Ptr := Find_Node( Tree, Element );
begin
if Node /= null then
return True;
else
return False;
end if;
end Is_In_Tree;
----------------------------------------------------------------------
procedure Insert( Tree: in out T; Element: in Element_Type ) is
New_Node : Tree_Node_Ptr := new Tree_Node'( Data => Element,
Left => null,
Right => null,
Parent => null,
Ballance => Equal,
Branch => Root );
-------------------------------------------------------------------
procedure Inject_Node( Tree: in out T;
New_Node: in out Tree_Node_Ptr ) is
Child : Tree_Node_Ptr := Tree.Root;
Node : Tree_Node_Ptr := Tree.Root;
begin
if Node = null then
Tree.Root := New_Node;
else
while Child /= null loop
Node := Child;
case Compare ( Element, Node.Data ) is
when Equal =>
return;
when Less_Than =>
Child := Child.Left;
New_Node.Branch := Left;
when Greater_Than =>
Child := Child.Right;
New_Node.Branch := Right;
end case;
end loop;
New_Node.Parent := Node;
case Compare( Element, Node.Data ) is
when Less_Than =>
Node.Left := New_Node;
when Greater_Than =>
Node.Right := New_Node;
when Equal =>
null;
end case;
end if;
end Inject_Node;
-------------------------------------------------------------------
procedure Reballance( Tree: in out T; Leaf: in Tree_Node_Ptr ) is
Node : Tree_Node_Ptr := Leaf;
New_Ballance : Pivot_Type;
Ballance_State_Table : constant
array(Branch_Type range Left..Right, Ballance_Type)
of Pivot_Type := (( Pivot_Left, Left, Equal ),
( Equal, Right, Pivot_Right ));
----------------------------------------------------------------
procedure Swap_Child( Tree : in out T;
Parent : in Tree_Node_Ptr;
Branch : in Branch_Type;
Child : in Tree_Node_Ptr ) is
begin
case Branch is
when Left => Parent.Left := Child;
when Right => Parent.Right := Child;
when Root => Tree.Root := Child;
end case;
if Child /= null then
Child.Parent := Parent;
Child.Branch := Branch;
end if;
end Swap_Child;
----------------------------------------------------------------
procedure Rotate_Right(Tree : in out T;
Pivot : in Tree_Node_Ptr ) is
Child : Tree_Node_Ptr := Pivot.Left;
begin
-- Put_Line("Rotate Right - Begin.");
Swap_Child( Tree, Pivot.Parent, Pivot.Branch, Child );
Swap_Child( Tree, Pivot, Left, Child.Right );
Swap_Child( Tree, Child, Right, Pivot );
Pivot.Ballance := Equal;
Child.Ballance := Equal;
-- Put_Line("Rotate Right - End.");
end Rotate_Right;
----------------------------------------------------------------
procedure Double_Right(Tree : in out T;
Pivot : in Tree_Node_Ptr ) is
Child1 : Tree_Node_Ptr := Pivot.Left;
Child2 : Tree_Node_Ptr := Pivot.Left.Right;
begin
-- Put_Line("Double Right - Begin.");
Swap_Child( Tree, Pivot.Parent, Pivot.Branch, Child2 );
Swap_Child( Tree, Pivot, Left, Child2.Right );
Swap_Child( Tree, Child1, Right, Child2.Left );
Swap_Child( Tree, Child2, Left, Child1);
Swap_Child( Tree, Child2, Right, Pivot);
Pivot.Ballance := Equal;
Child1.Ballance := Equal;
case Child2.Ballance is
when Left =>
Pivot.Ballance := Right;
if Child1.Left = null then
Child1.Ballance := Right;
end if;
when Right =>
Child1.Ballance := Left;
when Equal =>
null;
end case;
Child2.Ballance := Equal;
-- Put_Line("Double Right - End.");
end Double_Right;
----------------------------------------------------------------
procedure Rotate_Left(Tree : in out T;
Pivot : in Tree_Node_Ptr ) is
Child : Tree_Node_Ptr := Pivot.Right;
begin
-- Put("Rotate Left - Begin.");
Swap_Child( Tree, Pivot.Parent, Pivot.Branch, Child );
Swap_Child( Tree, Pivot, Right, Child.Left );
Swap_Child( Tree, Child, Left, Pivot );
Pivot.Ballance := Equal;
Child.Ballance := Equal;
-- Put_Line("Rotate Left - End.");
end Rotate_Left;
----------------------------------------------------------------
procedure Double_Left(Tree : in out T;
Pivot : in Tree_Node_Ptr ) is
Child1 : Tree_Node_Ptr := Pivot.Right;
Child2 : Tree_Node_Ptr := Pivot.Right.Left;
begin
-- Put_Line("Double Left - Begin.");
Swap_Child( Tree, Pivot.Parent, Pivot.Branch, Child2 );
Swap_Child( Tree, Pivot, Right, Child2.Left );
Swap_Child( Tree, Child1, Left, Child2.Right );
Swap_Child( Tree, Child2, Left, Pivot );
Swap_Child( Tree, Child2, Right, Child1 );
Pivot.Ballance := Equal;
Child1.Ballance := Equal;
case Child2.Ballance is
when Left =>
Child1.Ballance := Right;
when Right =>
Pivot.Ballance := Left;
if Child1.Right = null then
Child1.Ballance := Left;
end if;
when Equal =>
null;
end case;
Child2.Ballance := Equal;
-- Put_Line("Double Left - End.");
end Double_Left;
----------------------------------------------------------------
begin
while Node.Parent /= null loop -- top and _bottom_ tested
New_Ballance := Ballance_State_Table( Node.Branch,
Node.Parent.Ballance );
-- Put("node "); Put(Node.Parent.Data); Put(" is ballanced ");
-- Put(Node.Parent.Ballance);Put(" -> "); Put(New_Ballance);
-- Put(" from child "); Put(Node.Data); New_Line;
if New_Ballance = Pivot_Left then
if Node.Ballance = Left then
Node := Node.Parent;
Rotate_Right( Tree, Node );
-- if Node.Ballance /= Equal then
-- Put_Line("PROBLEM: Pivot.Ballance is not Equal");
-- end if;
else
Node := Node.Parent;
Double_Right( Tree, Node );
end if;
exit;
elsif New_Ballance = Pivot_Right then
if Node.Ballance = Right then
Node := Node.Parent;
Rotate_Left( Tree, Node );
-- if Node.Ballance /= Equal then
-- Put_Line("PROBLEM: Pivot.Ballance is not Equal");
-- end if;
else
Node := Node.Parent;
Double_Left( Tree, Node );
end if;
exit;
else
Node.Parent.Ballance := New_Ballance;
end if;
Node := Node.Parent;
exit when New_Ballance = Equal;
end loop;
end Reballance;
-------------------------------------------------------------------
begin -- Insert
-- Put_Line("----------------------------------------");
-- Put("Inserting : "); Put(Element); New_Line;
Inject_Node( Tree, New_Node );
-- Put("Injected successfully; parent : ");
-- if New_Node.Parent /= null then
-- Put(New_Node.Parent.Data); New_Line;
-- else
-- Put("Root"); New_Line;
-- if Tree.Root /= New_Node then
-- Put_Line("Error, this node is not the root.");
-- raise Program_Error;
-- end if;
-- end if;
--
-- Check_Tree( Tree );
Reballance( Tree, New_Node );
-- Put_Line("Reballanced Successfully.");
-- Check_Tree( Tree );
end Insert;
----------------------------------------------------------------------
procedure Remove( Tree: in out T; Element: in Element_Type ) is
Remove_Node : Tree_Node_Ptr := Find_Node( Tree, Element );
Pivot_Node : Tree_Node_Ptr;
Pivot_Node_Parent : Tree_Node_Ptr;
procedure Graft( Tree: in out T;
Old_Node, New_Node: in out Tree_Node_Ptr ) is
Parent : Tree_Node_Ptr := Old_Node.Parent;
begin
if Parent /= null then
if Parent.Left = Old_Node then
Parent.Left := New_Node;
else
Parent.Right := New_Node;
end if;
else
Tree.Root := New_Node;
end if;
end Graft;
begin
if Remove_Node = null then
return;
end if;
if Remove_Node.Left = null then
Graft( Tree, Remove_Node, Remove_Node.Right );
Free( Remove_Node );
elsif Remove_Node.Right = null then
Graft( Tree, Remove_Node, Remove_Node.Left );
Free( Remove_Node );
else
Pivot_Node := Remove_Node.Left;
while Pivot_Node.Right /= null loop
Pivot_Node := Pivot_Node.Right;
end loop;
if Pivot_Node.Parent = Remove_Node then
Pivot_Node.Right := Remove_Node.Right;
else
Pivot_Node.Parent.Right := Pivot_Node.Left;
Pivot_Node.Left := Remove_Node.Left;
Pivot_Node.Right := Remove_Node.Right;
end if;
Graft( Tree, Remove_Node, Pivot_Node );
end if;
end Remove;
----------------------------------------------------------------------
procedure Print( Tree: in T ) is
procedure Print_Node( Node: in Tree_Node_Ptr ) is
begin
if Node.Left /= null then
Print_Node( Node.Left );
end if;
Put(Node.Data);
New_Line;
if Node.Right /= null then
Print_Node( Node.Right );
end if;
end;
begin
Print_Node( Tree.Root );
end Print;
----------------------------------------------------------------------
procedure Debug_Print( Tree: in T ) is
procedure Print_Node( Node: in Tree_Node_Ptr;
Node_ID: in out Integer ) is
procedure Print_Edge( Source, Target : in Integer;
Branch : in Branch_Type ) is
begin
Put("edge [ source ");
Put( Source );
Put(" target ");
Put( Target );
if Branch = Left then
Put_Line(" label ""L"" ]");
else
Put_Line(" label ""R"" ]");
end if;
end Print_Edge;
My_ID : Integer := Node_ID;
begin
if Node.Left /= null then
Node_ID := Node_ID + 1;
Print_Edge( My_ID, Node_ID, Left );
Print_Node( Node.Left, Node_ID );
end if;
Put("node [ id ");
Put( My_ID );
Put(" label """);
Put(Node.Data);
Put_Line(""" ]");
if Node.Right /= null then
Node_ID := Node_ID + 1;
Print_Edge( My_ID, Node_ID, Right );
Print_Node( Node.Right, Node_ID );
end if;
end Print_Node;
Node_ID : Integer := 0;
begin
Put_Line("graph [ directed 1");
Print_Node( Tree.Root, Node_ID );
Put_Line("]");
end Debug_Print;
----------------------------------------------------------------------
procedure Check_Tree( Tree: in T ) is
package Tree_Node_Stack is new Generic_Stack(Tree_Node_Ptr);
use Tree_Node_Stack;
Node_Count : Integer := 0;
Node_Stack : Tree_Node_Stack.T;
Node : Tree_Node_Ptr;
procedure Put( Branch : Branch_Type ) is
begin
case Branch is
when Left => Put("left");
when Right => Put("right");
when Root => Put("root");
end case;
end Put;
begin
if Tree.Root /= null then
if Tree.Root.Parent /= null then
Put_Line("Tree.Root.Parent /= null.");
raise AVL_Tree_Error;
end if;
if Tree.Root.Branch /= Root then
Put_Line("Tree.Root.Branch /= root.");
raise AVL_Tree_Error;
end if;
Push( Node_Stack, Tree.Root );
while not Empty( Node_Stack ) loop
Pop( Node_Stack, Node );
Node_Count := Node_Count + 1;
if Node.Left /= null then
Push( Node_Stack, Node.Left );
if Node.Left.Parent /= Node or Node.Left.Branch /= Left then
Put("Node "); Put(Node.Data);
Put(" has left child "); Put(Node.Left.Data);
Put(" which thinks parent is "); Put(Node.Left.Parent.Data);
Put(" and thinks it is a "); Put(Node.Left.Branch);
Put(" branch."); New_Line;
raise AVL_Tree_Error;
end if;
end if;
if Node.Right /= null then
Push( Node_Stack, Node.Right );
if Node.Right.Parent /= Node or Node.Right.Branch /= Right then
Put("Node "); Put(Node.Data);
Put(" has right child "); Put(Node.Right.Data);
Put(" which thinks parent is "); Put(Node.Right.Parent.Data);
Put(" and thinks it is a "); Put(Node.Right.Branch);
Put(" branch."); New_Line;
raise AVL_Tree_Error;
end if;
end if;
end loop;
end if;
Put_Line(" Tree Check - " & Integer'Image(Node_Count) & " nodes ok.");
end Check_Tree;
end Generic_AVL_Tree;
|
RAdjunctions.agda | jmchapman/Relative-Monads | 21 | 8263 | <gh_stars>10-100
module RAdjunctions where
open import Library
open import Categories
open import Functors
open Cat
open Fun
record RAdj {a b c d e f}{C : Cat {a}{b}}{D : Cat {c}{d}}
(J : Fun C D)(E : Cat {e}{f}) : Set (a ⊔ b ⊔ c ⊔ d ⊔ e ⊔ f) where
constructor radjunction
field L : Fun C E
R : Fun E D
left : {X : Obj C}{Y : Obj E} →
Hom E (OMap L X) Y → Hom D (OMap J X) (OMap R Y)
right : {X : Obj C}{Y : Obj E} →
Hom D (OMap J X) (OMap R Y) → Hom E (OMap L X) Y
lawa : {X : Obj C}{Y : Obj E}(f : Hom E (OMap L X) Y) →
right (left f) ≅ f
lawb : {X : Obj C}{Y : Obj E}(f : Hom D (OMap J X) (OMap R Y)) →
left (right f) ≅ f
natleft : {X X' : Obj C}{Y Y' : Obj E}
(f : Hom C X' X)(g : Hom E Y Y')
(h : Hom E (OMap L X) Y) →
comp D (HMap R g) (comp D (left h) (HMap J f))
≅
left (comp E g (comp E h (HMap L f)))
natright : {X X' : Obj C}{Y Y' : Obj E}
(f : Hom C X' X)(g : Hom E Y Y')
(h : Hom D (OMap J X) (OMap R Y)) →
right (comp D (HMap R g) (comp D h (HMap J f)))
≅
comp E g (comp E (right h) (HMap L f))
|
gfx/pokemon/rattata/anim.asm | Dev727/ancientplatinum | 28 | 82149 | <gh_stars>10-100
frame 1, 02
frame 2, 02
frame 3, 12
frame 0, 10
setrepeat 3
frame 0, 05
frame 4, 05
dorepeat 5
endanim
|
Commands/Miscellaneous Commands suite/system info/long user name of (get system info).applescript | looking-for-a-job/applescript-examples | 1 | 1269 | #!/usr/bin/osascript
long user name of (get system info) |
programs/oeis/076/A076458.asm | karttu/loda | 0 | 165943 | ; A076458: Sum of numbers that can be written as t*n + u*(n+1) for nonnegative integers t,u in exactly five ways.
; 17,165,678,1910,4335,8547,15260,25308,39645,59345,85602,119730,163163,217455,284280,365432,462825,578493,714590,873390,1057287,1268795,1510548,1785300,2095925,2445417,2836890,3273578,3758835,4296135,4889072,5541360,6256833,7039445,7893270,8822502,9831455,10924563,12106380,13381580,14754957,16231425,17816018,19513890,21330315,23270687,25340520,27545448,29891225,32383725,35028942,37832990,40802103,43942635,47261060,50763972,54458085,58350233,62447370,66756570,71285027,76040055,81029088,86259680,91739505,97476357,103478150,109752918,116308815,123154115,130297212,137746620,145510973,153599025,162019650,170781842,179894715,189367503,199209560,209430360,220039497,231046685,242461758,254294670,266555495,279254427,292401780,306007988,320083605,334639305,349685882,365234250,381295443,397880615,415001040,432668112,450893345,469688373,489064950,509034950,529610367,550803315,572626028,595090860,618210285,641996897,666463410,691622658,717487595,744071295,771386952,799447880,828267513,857859405,888237230,919414782,951405975,984224843,1017885540,1052402340,1087789637,1124061945,1161233898,1199320250,1238335875,1278295767,1319215040,1361108928,1403992785,1447882085,1492792422,1538739510,1585739183,1633807395,1682960220,1733213852,1784584605,1837088913,1890743330,1945564530,2001569307,2058774575,2117197368,2176854840,2237764265,2299943037,2363408670,2428178798,2494271175,2561703675,2630494292,2700661140,2772222453,2845196585,2919602010,2995457322,3072781235,3151592583,3231910320,3313753520,3397141377,3482093205,3568628438,3656766630,3746527455,3837930707,3930996300,4025744268,4122194765,4220368065,4320284562,4421964770,4525429323,4630698975,4737794600,4846737192,4957547865,5070247853,5184858510,5301401310,5419897847,5540369835,5662839108,5787327620,5913857445,6042450777,6173129930,6305917338,6440835555,6577907255,6717155232,6858602400,7002271793,7148186565,7296369990,7446845462,7599636495,7754766723,7912259900,8072139900,8234430717,8399156465,8566341378,8736009810,8908186235,9082895247,9260161560,9440010008,9622465545,9807553245,9995298302,10185726030,10378861863,10574731355,10773360180,10974774132,11178999125,11386061193,11595986490,11808801290,12024531987,12243205095,12464847248,12689485200,12917145825,13147856117,13381643190,13618534278,13858556735,14101738035,14348105772,14597687660,14850511533,15106605345,15365997170,15628715202,15894787755,16164243263,16437110280,16713417480,16993193657,17276467725,17563268718,17853625790,18147568215,18445125387,18746326820,19051202148,19359781125,19672093625
mov $6,$0
lpb $0,1
mov $5,$0
sub $0,1
add $1,$5
lpe
add $1,17
mov $2,53
mov $7,$6
lpb $2,1
add $1,$7
sub $2,1
lpe
mov $3,$6
lpb $3,1
sub $3,1
add $4,$7
lpe
mov $2,60
mov $7,$4
lpb $2,1
add $1,$7
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$7
lpe
mov $2,29
mov $7,$4
lpb $2,1
add $1,$7
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3,1
sub $3,1
add $4,$7
lpe
mov $2,5
mov $7,$4
lpb $2,1
add $1,$7
sub $2,1
lpe
|
test/s/ext/float.asm | rolf0504/c2verilog | 252 | 2003 | <filename>test/s/ext/float.asm
@main
0;JMP
(C4) 4.0
(PI) 3.14159
(main)
@PI
D=A
@16 // get F(PI)
swi
@18 // putf F
swi
@PI
D=A
@19 // fadd F , PI
swi
@18 // putf F
swi
@C4
D=A
@21 // fmul F, 2
swi
@18 // putf F
swi
|
10 Adapted from others/11 Rich Walsh/02 Durations/5 Decrease postwait by 0.5s.applescript | streth11/Qlab-Scripts | 0 | 4649 | -- @description Decrease postwait by 0.5s
-- @author <NAME>
-- @link bensmithsound.uk
-- @source Rich Walsh
-- @version 1.0
-- @testedmacos 10.13.6
-- @testedqlab 4.6.9
-- @about Decreases post wait of selected cue by 0.5s. Can now be accomplished by OSC
-- @separateprocess FALSE
-- @changelog
-- v1.0 + init
-- USER DEFINED VARIABLES -----------------
set userDelta to -0.5
---------- END OF USER DEFINED VARIABLES --
-- RUN SCRIPT -----------------------------
repeat with eachCue in (selected of front workspace as list)
try
set currentPostWait to post wait of eachCue
set post wait of eachCue to (currentPostWait + userDelta)
end try
end repeat |
tester.adb | skill-lang/adaCommon | 0 | 30727 | with Skill.Streams.Reader;
procedure Tester is
begin
null;
end Tester;
|
programs/oeis/118/A118002.asm | jmorken/loda | 1 | 83363 | ; A118002: a(0) = 0. a(n) = a(n-1) + (largest integer <= n which is coprime to a(n-1)).
; 0,1,3,5,9,14,19,26,33,41,51,62,73,86,99,113,129,146,163,182,201,221,243,266,289,314,339,365,393,422,451,482,513,545,579,614,649,686,723,761,801,842,883,926,969,1013,1059,1106,1153,1202,1251,1301,1353,1406,1459,1514,1569,1625,1683,1742,1801,1862,1923,1985,2049,2114,2179,2246,2313,2381,2451,2522,2593,2666,2739,2813,2889,2966,3043,3122,3201,3281,3363,3446,3529,3614,3699,3785,3873,3962,4051,4142,4233,4325,4419,4514,4609,4706,4803,4901,5001,5102,5203,5306,5409,5513,5619,5726,5833,5942,6051,6161,6273,6386,6499,6614,6729,6845,6963,7082,7201,7322,7443,7565,7689,7814,7939,8066,8193,8321,8451,8582,8713,8846,8979,9113,9249,9386,9523,9662,9801,9941,10083,10226,10369,10514,10659,10805,10953,11102,11251,11402,11553,11705,11859,12014,12169,12326,12483,12641,12801,12962,13123,13286,13449,13613,13779,13946,14113,14282,14451,14621,14793,14966,15139,15314,15489,15665,15843,16022,16201,16382,16563,16745,16929,17114,17299,17486,17673,17861,18051,18242,18433,18626,18819,19013,19209,19406,19603,19802,20001,20201,20403,20606,20809,21014,21219,21425,21633,21842,22051,22262,22473,22685,22899,23114,23329,23546,23763,23981,24201,24422,24643,24866,25089,25313,25539,25766,25993,26222,26451,26681,26913,27146,27379,27614,27849,28085,28323,28562,28801,29042,29283,29525,29769,30014,30259,30506,30753,31001
mov $5,$0
mov $7,$0
lpb $7
mov $0,$5
sub $7,1
sub $0,$7
mul $0,2
mov $2,1
mov $3,$0
sub $3,1
mov $6,$0
lpb $0
add $0,3
sub $0,$2
add $0,1
mod $0,4
mov $2,$6
sub $3,1
trn $4,3
sub $4,3
mod $6,$4
lpe
add $3,1
add $3,$6
mov $6,$3
div $6,2
add $1,$6
lpe
|
libsrc/_DEVELOPMENT/adt/p_forward_list/z80/asm_p_forward_list_init.asm | jpoikela/z88dk | 640 | 87380 |
; ===============================================================
; Dec 2013
; ===============================================================
;
; void p_forward_list_init(void *p)
;
; Create an empty forward_list in the two bytes of memory
; provided.
;
; ===============================================================
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC asm_p_forward_list_init
EXTERN l_setmem_hl
asm_p_forward_list_init:
; enter : hl = void *p
;
; exit : hl = void *p + 2
; de = void *p = p_forward_list_t *list
;
; uses : af, de, hl
ld e,l
ld d,h
xor a
jp l_setmem_hl - 4 ; p_forward_list->next = 0
|
libsrc/gfx/wide/w_xordrawto.asm | ahjelm/z88dk | 640 | 168745 | ; void xordrawto(int x2, int y2);
IF !__CPU_INTEL__ && !__CPU_GBZ80__
SECTION code_graphics
PUBLIC xordrawto
PUBLIC _xordrawto
EXTERN asm_xordrawto
.xordrawto
._xordrawto
pop af
pop de
pop hl
push hl
push de
push af
jp asm_xordrawto
ENDIF
|
oeis/204/A204270.asm | neoneye/loda-programs | 11 | 101209 | <filename>oeis/204/A204270.asm<gh_stars>10-100
; A204270: a(n) = tau(n)*Pell(n), where tau(n) = A000005(n), the number of divisors of n.
; Submitted by <NAME>
; 1,4,10,36,58,280,338,1632,2955,9512,11482,83160,66922,323128,780100,2354160,2273378,16465260,13250218,95966568,154455860,372889432,450117362,4346717760,3935214363,12667263848,30581480180,110745336312,89120964298,860628162800,519435045698,3762081396288,6054978619780,14618011503752,35291001627284,191700033206220,102845515571962,496582077046168,1198855185236260,5788584895037376,3493720040136818,33738345216131920,20362892648202778,147481114801315608,356050907547239550,573055286597196472
mov $2,$0
add $0,1
seq $0,207846 ; Number of 3 X n 0..1 arrays avoiding 0 0 0 and 0 0 1 horizontally and 0 0 0 and 1 1 1 vertically.
seq $2,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
mul $0,$2
div $0,36
|
src/kafka-topic.adb | Latence-Technologies/Kafka-Ada | 0 | 7867 | <reponame>Latence-Technologies/Kafka-Ada
package body Kafka.Topic is
function Create_Topic_Handle(Handle : Handle_Type;
Topic : String;
Config : Topic_Config_Type) return Topic_Type is
C_Topic : chars_ptr := New_String(Topic);
Topic_Handle : Topic_Type;
begin
Topic_Handle := rd_kafka_topic_new(Handle, C_Topic, Config);
Free(C_Topic);
return Topic_Handle;
end;
function Create_Topic_Handle(Handle : Handle_Type;
Topic : String) return Topic_Type is
begin
return Create_Topic_Handle(Handle, Topic, Topic_Config_Type(System.Null_Address));
end;
function Get_Name(Topic : Topic_Type) return String is
begin
return Interfaces.C.Strings.Value(rd_kafka_topic_name(Topic));
end;
end Kafka.Topic;
|
programs/oeis/284/A284775.asm | neoneye/loda | 22 | 12169 | <filename>programs/oeis/284/A284775.asm
; A284775: Fixed point of the morphism 0 -> 01, 1 -> 0011.
; 0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0
sub $0,1
mov $2,$0
div $0,2
add $2,1
add $0,$2
seq $0,189664 ; Fixed point of the morphism 0->010, 1->001.
|
oeis/208/A208650.asm | neoneye/loda-programs | 11 | 24720 | <reponame>neoneye/loda-programs
; A208650: Number of constant paths through the subset array of {1,2,...,n}; see Comments.
; Submitted by <NAME>(s1)
; 1,2,6,36,480,15000,1134000,211768200,99131719680,117595223746560,356467003200000000,2779532232516963000000,56049508602150185041920000,2935889842347365340037522521600
mov $1,1
add $1,$0
mov $2,$0
lpb $0
sub $0,1
mov $3,$2
bin $3,$0
mul $1,$3
lpe
mov $0,$1
|
03. 8086/01. Addition.asm | nitrece/microprocessor-laboratory | 0 | 26023 | <gh_stars>0
; Q 1>
; a> Addition of 2 16bit BCD numbers with carry
SW 2000h
[2000h] = 0999h ; A = 999 in BCD
[2002h] = 0001h ; B = 1 in BCD
[2004h] = (ans) ; C = (A + B) in BCD
.
A
1000h
mov ax, [2000h]
mov bx, [2002h]
add bx, ax
mov al, bl
daa
adc bh, 00h
mov bl, al
mov al, bh
daa
mov bh, al
mov [2004h], bx
hlt
.
GO 1000h
INT ; (try '.' here)
SW 2004h ; ans = 1000h
. ; => 1000 in BCD
; b> Addition of 2 32bit numbers
SW 2000h
[2000h] = 4B20h ; A = 12340000
[2002h] = 00BCh ;
[2004h] = 162Eh ; B = 5678
[2006h] = 0000h ;
[2008h] = (ans) ; C = (A + B)
[200Ah] = (ans) ;
.
A
1000h
mov ax, [2000h]
mov bx, [2002h]
add ax, [2004h]
adc bx, [2006h]
mov [2008h], ax
mov [200Ah], bx
hlt
.
GO 1000h
INT ;(try '.' here)
SW 2008h ; ans = 614Eh
SW 200Ah ; ans = 00BCh
. ; => 12345678
; c> Addition of 2 signed 32bit numbers
SW 2000h
[2000h] = 614Eh ; A = 12345678
[2002h] = 00BCh ;
[2004h] = 0E9D2h ; B = -5678
[2006h] = 0FFFFh ;
[2008h] = (ans) ; C = (A + B)
[200Ah] = (ans) ;
.
A
1000h
mov ax, [2000h]
mov bx, [2002h]
add ax, [2004h]
adc bx, [2006h]
mov [2008h], ax
mov [200Ah], bx
hlt
.
GO 1000h
INT ;(try '.' here)
SW 2008h ; ans = 4B20h
SW 200Ah ; ans = 00BCh
. ; => 12340000
|
MarkConv/HtmlParser.g4 | KvanTTT/HabraMark | 16 | 255 | parser grammar HtmlParser;
options { tokenVocab=HtmlLexer; }
@parser::members
{private MarkConv.ILogger _logger;
public HtmlParser(ITokenStream input, MarkConv.ILogger logger)
: this(input)
{
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
}
private void ProcessClosingTag()
{
var openingSymbol = (MarkConv.Html.HtmlMarkdownToken)((ElementContext) RuleContext.Parent).TAG_NAME().Symbol;
var tagCloseContext = (TagCloseContext) RuleContext;
var closingSymbol = (MarkConv.Html.HtmlMarkdownToken)tagCloseContext.TAG_NAME().Symbol;
var openingTagName = openingSymbol.Text;
var closingTagName = closingSymbol.Text;
if (!openingTagName.Equals(closingTagName, System.StringComparison.OrdinalIgnoreCase))
_logger.Error($"Incorrect nesting: element </{closingTagName}> at {closingSymbol.LineColumnSpan} closes <{openingTagName}> at {openingSymbol.LineColumnSpan}");
}
}
root
: content* EOF
;
content
: element
| HTML_COMMENT
| HTML_TEXT
| MARKDOWN_FRAGMENT
;
element
: TAG_OPEN (
TAG_NAME attribute* (TAG_CLOSE content* tagClose | TAG_SLASH_CLOSE) |
voidElementTag attribute* (TAG_CLOSE | TAG_SLASH_CLOSE)
)
;
tagClose
: TAG_OPEN TAG_SLASH TAG_NAME {ProcessClosingTag();} TAG_CLOSE
;
voidElementTag
: TAG_AREA
| TAG_BASE
| TAG_BR
| TAG_COL
| TAG_EMBED
| TAG_HR
| TAG_IMG
| TAG_INPUT
| TAG_LINK
| TAG_META
| TAG_PARAM
| TAG_SOURCE
| TAG_TRACK
| TAG_WBR
| TAG_CUT
| TAG_LINKMAP
| TAG_INCLUDE
;
attribute
: TAG_NAME TAG_EQUALS ATTR_VALUE
; |
src/hide-file_coder.ads | persan/midnightsun-ctf-LoveLacedLetter | 0 | 15408 | package Hide.File_Coder is
procedure Encode (Source_File_Name : Posix.C_String;
Output_File_Name : Posix.C_String;
Offset : Natural;
Text : String);
function Decode (File_Name : Posix.C_String) return String;
end Hide.File_Coder;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt3_pkg.ads | best08618/asylo | 7 | 27298 | <reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt3_pkg.ads
package Opt3_Pkg is
procedure F (I : Short_Integer);
end Opt3_Pkg;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.