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 |
|---|---|---|---|---|
tests/data_simple/19.asm | NullMember/customasm | 414 | 93780 | #d8 2 + 3, 2 * 3, 3 + 4 ; = 0x050607 |
programs/oeis/158/A158656.asm | karttu/loda | 1 | 169754 | <filename>programs/oeis/158/A158656.asm
; A158656: a(n) = 54*n^2 - 1.
; 53,215,485,863,1349,1943,2645,3455,4373,5399,6533,7775,9125,10583,12149,13823,15605,17495,19493,21599,23813,26135,28565,31103,33749,36503,39365,42335,45413,48599,51893,55295,58805,62423,66149,69983,73925,77975,82133,86399,90773,95255,99845,104543,109349,114263,119285,124415,129653,134999,140453,146015,151685,157463,163349,169343,175445,181655,187973,194399,200933,207575,214325,221183,228149,235223,242405,249695,257093,264599,272213,279935,287765,295703,303749,311903,320165,328535,337013,345599,354293,363095,372005,381023,390149,399383,408725,418175,427733,437399,447173,457055,467045,477143,487349,497663,508085,518615,529253,539999,550853,561815,572885,584063,595349,606743,618245,629855,641573,653399,665333,677375,689525,701783,714149,726623,739205,751895,764693,777599,790613,803735,816965,830303,843749,857303,870965,884735,898613,912599,926693,940895,955205,969623,984149,998783,1013525,1028375,1043333,1058399,1073573,1088855,1104245,1119743,1135349,1151063,1166885,1182815,1198853,1214999,1231253,1247615,1264085,1280663,1297349,1314143,1331045,1348055,1365173,1382399,1399733,1417175,1434725,1452383,1470149,1488023,1506005,1524095,1542293,1560599,1579013,1597535,1616165,1634903,1653749,1672703,1691765,1710935,1730213,1749599,1769093,1788695,1808405,1828223,1848149,1868183,1888325,1908575,1928933,1949399,1969973,1990655,2011445,2032343,2053349,2074463,2095685,2117015,2138453,2159999,2181653,2203415,2225285,2247263,2269349,2291543,2313845,2336255,2358773,2381399,2404133,2426975,2449925,2472983,2496149,2519423,2542805,2566295,2589893,2613599,2637413,2661335,2685365,2709503,2733749,2758103,2782565,2807135,2831813,2856599,2881493,2906495,2931605,2956823,2982149,3007583,3033125,3058775,3084533,3110399,3136373,3162455,3188645,3214943,3241349,3267863,3294485,3321215,3348053,3374999
mov $1,2
add $1,$0
mul $1,$0
mul $1,54
add $1,53
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/formal_procedure_declaration.ads | ouankou/rose | 488 | 2935 | package formal_procedure_declaration is
generic
with procedure Put_Line;
procedure SS_Info;
end formal_procedure_declaration;
|
Tests/yasm-regression/jmp64-6.asm | 13xforever/x86-assembly-textmate-bundle | 69 | 93400 | <reponame>13xforever/x86-assembly-textmate-bundle
[bits 64]
mov dword [l4-l1], 0x0 ; out: c7 04 25 00 00 00 00 00 00 00 00
l4:
l1:
jc short l3 ; out: 72 01
db 0x0 ; out: 00
l3:
|
backup/boot_sect06.asm | zurgeg/gbtos_opensource | 0 | 164837 | <reponame>zurgeg/gbtos_opensource
[org 0x7c00]
mov bp, 0x8000
mov sp, bp ;Hmm, the stack you say?
mov bx, 0x09000
mov dh, 2
call disk_load
mov dx, [0x9000]
call print_hex
call print_nl
mov dx, [0x9000 + 512]
call print_hex
jmp $
%include "boot_sect5_print.asm"
%include "boot_sect5_hex.asm"
%include "boot_sect06_disk.asm"
times 510-($-$$) db 0
dw 0xaa55
times 256 dw 0xdada
times 256 dw 0xface
|
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i3-7100_9_0xca_notsx.log_21829_51.asm | ljhsiun2/medusa | 9 | 173247 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x4fbb, %rbp
nop
nop
nop
xor %r9, %r9
mov (%rbp), %r10w
nop
nop
nop
nop
nop
inc %rbp
lea addresses_WC_ht+0x85bb, %rsi
add %r15, %r15
movb $0x61, (%rsi)
nop
cmp $41705, %r10
lea addresses_D_ht+0x4d27, %r15
nop
and $43029, %r8
movb $0x61, (%r15)
nop
nop
nop
cmp %r8, %r8
lea addresses_UC_ht+0x11706, %rsi
lea addresses_WT_ht+0xadbb, %rdi
sub $43527, %r10
mov $73, %rcx
rep movsq
nop
nop
nop
nop
xor $8528, %rdi
lea addresses_D_ht+0x160bb, %r10
nop
xor $7197, %rdi
vmovups (%r10), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rbx
nop
nop
nop
nop
xor $40756, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r9
push %rax
push %rcx
push %rsi
// Store
mov $0xbbb, %r11
nop
nop
nop
inc %rax
movw $0x5152, (%r11)
nop
nop
nop
sub $356, %r11
// Load
lea addresses_UC+0x12bbb, %r13
clflush (%r13)
nop
nop
nop
nop
sub %rax, %rax
movb (%r13), %r11b
nop
nop
nop
nop
add $20057, %r13
// Store
lea addresses_D+0x15bb, %r10
clflush (%r10)
and $23349, %r9
movl $0x51525354, (%r10)
nop
nop
nop
nop
cmp %r9, %r9
// Store
mov $0xe27, %r11
nop
nop
nop
nop
add $26823, %rcx
movl $0x51525354, (%r11)
nop
sub %r10, %r10
// Faulty Load
lea addresses_A+0x53bb, %r9
nop
nop
inc %r11
mov (%r9), %rsi
lea oracles, %r13
and $0xff, %rsi
shlq $12, %rsi
mov (%r13,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_P', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_UC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_P', 'size': 4, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': True, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'src': {'same': True, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'80': 4, '3c': 17, '00': 19980, '2c': 3, 'b0': 556, '48': 1, '3e': 1, 'a5': 71, 'de': 13, '46': 6, '01': 297, '1a': 59, 'e0': 1, '08': 149, '47': 671}
08 00 00 00 b0 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 47 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 47 a5 00 00 00 00 01 01 00 00 00 00 00 00 00 00 00 01 00 3c 00 00 00 00 00 00 01 01 00 00 00 00 00 00 01 01 00 00 1a 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 08 00 00 00 47 00 08 00 00 00 00 00 00 00 00 3c 47 00 00 00 a5 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 08 47 a5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 47 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/121/A121334.asm | neoneye/loda-programs | 11 | 3548 | ; A121334: Triangle, read by rows, where T(n,k) = C( n*(n+1)/2 + n-k, n-k), for n>=k>=0.
; Submitted by <NAME>
; 1,2,1,10,4,1,84,28,7,1,1001,286,66,11,1,15504,3876,816,136,16,1,296010,65780,12650,2024,253,22,1,6724520,1344904,237336,35960,4495,435,29,1,177232627,32224114,5245786,749398,91390,9139,703,37,1,5317936260
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
add $0,$2
bin $0,2
add $1,$2
add $0,$1
bin $0,$2
|
src/Numeric/Rational/Properties.agda | L-TChen/agda-prelude | 111 | 7699 |
module Numeric.Rational.Properties where
open import Prelude
open import Numeric.Rational
open import Numeric.Nat.Properties
open import Numeric.Nat.Divide
open import Numeric.Nat.Divide.Properties
open import Numeric.Nat.Prime
open import Numeric.Nat.Prime.Properties
open import Numeric.Nat.GCD
open import Numeric.Nat.GCD.Properties
open import Tactic.Nat
open import Tactic.Nat.Coprime
-- Correctness proofs for the efficient arithmetic operations -------
private
lem-coprime : ∀ n₁ n₂ s′ d₁′ d₂′ g g₁ →
s′ * g₁ ≡ n₁ * d₂′ + n₂ * d₁′ →
Coprime n₁ (d₁′ * g) →
Coprime d₁′ d₂′ →
Coprime s′ d₁′
lem-coprime n₁ n₂ s′ d₁′ d₂′ g g₁ s′g₁=s n₁⊥d₁ d₁′⊥d₂′ =
coprimeByPrimes s′ d₁′ λ p isP p|s′ p|d₁′ →
let s = n₁ * d₂′ + n₂ * d₁′
d₁ = d₁′ * g
p|d₁ : p Divides d₁
p|d₁ = divides-mul-l g p|d₁′
p|s : p Divides s
p|s = transport (p Divides_) s′g₁=s (divides-mul-l g₁ p|s′)
p|n₁d₂′ : p Divides (n₁ * d₂′)
p|n₁d₂′ = divides-sub-r p|s (divides-mul-r n₂ p|d₁′)
p∤n₁ : ¬ (p Divides n₁)
p∤n₁ p|n₁ = prime-divide-coprime p n₁ d₁ isP n₁⊥d₁ p|n₁ p|d₁
p|d₂′ : p Divides d₂′
p|d₂′ = case prime-split n₁ d₂′ isP p|n₁d₂′ of λ where
(left p|n₁) → ⊥-elim (p∤n₁ p|n₁)
(right p|d₂′) → p|d₂′
in divide-coprime p d₁′ d₂′ d₁′⊥d₂′ p|d₁′ p|d₂′
addQ-sound : ∀ x y → x + y ≡ slowAddQ x y
addQ-sound (ratio n₁ d₁ n₁⊥d₁) (ratio n₂ d₂ n₂⊥d₂)
with gcd (n₁ * d₂ + n₂ * d₁) (d₁ * d₂) | gcd d₁ d₂
... | gcd-res g₀ g₀-gcd@(is-gcd (factor p pg₀=n₀) (factor q qg₀=d₀) _)
| gcd-res g isgcd-dd@(is-gcd (factor! d₁′) (factor! d₂′) _)
with gcd (n₁ * d₂′ + n₂ * d₁′) g
... | gcd-res g₁ isgcd-sg@(is-gcd (factor s′ s′g₁=s) (factor! g′) _) =
let n₀ = n₁ * d₂ + n₂ * d₁
d₀ = d₁ * d₂
s = n₁ * d₂′ + n₂ * d₁′
instance
nz-g₀ = nonzero-is-gcd-r ⦃ mul-nonzero d₁ d₂ ⦄ g₀-gcd
nz-g = nonzero-is-gcd-l isgcd-dd
nz-g₁ = nonzero-is-gcd-r isgcd-sg
nz-gg₁ = mul-nonzero g g₁
s′gg₁=n₀ : s′ * (g * g₁) ≡ n₀
s′gg₁=n₀ =
s′ * (g * g₁)
≡⟨ auto ⟩
s′ * g₁ * g
≡⟨ _* g $≡ s′g₁=s ⟩
(n₁ * d₂′ + n₂ * d₁′) * g
≡⟨ auto ⟩
n₀ ∎
ddg′gg₁=d₀ : d₁′ * d₂′ * g′ * (g * g₁) ≡ d₀
ddg′gg₁=d₀ = auto
s′⊥ddg : Coprime s′ (d₁′ * d₂′ * g′)
s′⊥ddg =
let[ _ := is-gcd-factors-coprime isgcd-dd ]
let[ _ := lem-coprime n₁ n₂ s′ d₁′ d₂′ g g₁ s′g₁=s n₁⊥d₁ auto-coprime ]
let[ _ := lem-coprime n₂ n₁ s′ d₂′ d₁′ g g₁ (s′g₁=s ⟨≡⟩ auto) n₂⊥d₂ auto-coprime ]
let[ _ := is-gcd-factors-coprime isgcd-sg ]
auto-coprime
gg₁-gcd : IsGCD (g * g₁) n₀ d₀
gg₁-gcd = is-gcd-by-coprime-factors (g * g₁) n₀ d₀
(factor s′ s′gg₁=n₀) (factor (d₁′ * d₂′ * g′) ddg′gg₁=d₀)
s′⊥ddg
gg₁=g₀ : g * g₁ ≡ g₀
gg₁=g₀ = is-gcd-unique (g * g₁) g₀ gg₁-gcd g₀-gcd
s′g₀=n₀ : s′ * g₀ ≡ n₀
s′g₀=n₀ = s′ *_ $≡ sym gg₁=g₀ ⟨≡⟩ s′gg₁=n₀
ddgg₀=d₀ : d₁′ * d₂′ * g′ * g₀ ≡ d₀
ddgg₀=d₀ = d₁′ * d₂′ * g′ *_ $≡ sym gg₁=g₀ ⟨≡⟩ ddg′gg₁=d₀
s′=p : s′ ≡ p
s′=p = mul-inj₁ s′ p g₀ (s′g₀=n₀ ⟨≡⟩ʳ pg₀=n₀)
ddg=q : d₁′ * d₂′ * g′ ≡ q
ddg=q = mul-inj₁ _ q g₀ (ddgg₀=d₀ ⟨≡⟩ʳ qg₀=d₀)
in cong-ratio s′=p ddg=q
mulQ-sound : ∀ x y → x * y ≡ slowMulQ x y
mulQ-sound (ratio n₁ d₁ n₁⊥d₁) (ratio n₂ d₂ n₂⊥d₂)
with gcd n₁ d₂ | gcd n₂ d₁ | gcd (n₁ * n₂) (d₁ * d₂)
... | gcd-res g₁ gcd₁₂@(is-gcd (factor! n₁′) (factor! d₂′) _)
| gcd-res g₂ gcd₂₁@(is-gcd (factor! n₂′) (factor! d₁′) _)
| gcd-res g gcdnd@(is-gcd (factor n′ n′g=n) (factor d′ d′g=d) _) =
let instance _ = nonzero-is-gcd-r gcd₁₂
_ = nonzero-is-gcd-r gcd₂₁
_ = mul-nonzero g₁ g₂
g=gg : g ≡ g₁ * g₂
g=gg = is-gcd-unique _ _ gcdnd $
is-gcd-by-coprime-factors _ _ _ (factor (n₁′ * n₂′) auto)
(factor (d₁′ * d₂′) auto) $
let[ _ := is-gcd-factors-coprime gcd₁₂ ]
let[ _ := is-gcd-factors-coprime gcd₂₁ ]
auto-coprime
neq : n₁′ * n₂′ ≡ n′
neq = case g=gg of λ where
refl → mul-inj₁ (n₁′ * n₂′) n′ (g₁ * g₂) (by n′g=n)
deq : d₁′ * d₂′ ≡ d′
deq = case g=gg of λ where
refl → mul-inj₁ (d₁′ * d₂′) d′ (g₁ * g₂) (by d′g=d)
in cong-ratio neq deq
|
oeis/227/A227070.asm | neoneye/loda-programs | 11 | 82659 | <filename>oeis/227/A227070.asm
; A227070: Powers n such that the set s(n) = {k > 0 such that k^n ends with k} does not occur for smaller n.
; Submitted by <NAME>(s1)
; 1,2,3,5,6,9,11,17,21,26,33,41,51,65,81,101,126,129,161,201,251,257,321,401,501,513,626,641,801,1001,1025,1251,1281,1601,2001,2049,2501,2561,3126,3201,4001,4097,5001,5121,6251,6401,8001,8193,10001
mov $1,10
lpb $0
mov $3,$2
lpb $3
add $2,1
mov $4,$1
gcd $4,$2
div $4,$2
cmp $4,0
sub $3,$4
lpe
sub $0,1
add $2,1
mul $1,$2
lpe
mov $0,$2
add $0,1
|
oeis/017/A017142.asm | neoneye/loda-programs | 11 | 87498 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A017142: a(n) = (8*n+6)^6.
; 46656,7529536,113379904,729000000,3010936384,9474296896,24794911296,56800235584,117649000000,225199600704,404567235136,689869781056,1126162419264,1771561000000,2699554153024,4001504141376,5789336458816,8198418170944,11390625000000,15557597153344,20924183895616,27752076864576,36343632130624,47045881000000,60254729561664,76419346977856,96046742518336,119706531338304,148035889000000,181744694737984,221620863468096,268535866540096,323450441233984,387420489000000,461603162442304,547263141046336
mul $0,8
add $0,6
pow $0,6
|
llvm-gcc-4.2-2.9/gcc/ada/a-wtenio.adb | vidkidz/crossbridge | 1 | 7374 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O . E N U M E R A T I O N _ I O --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Enumeration_Aux;
package body Ada.Wide_Text_IO.Enumeration_IO is
package Aux renames Ada.Wide_Text_IO.Enumeration_Aux;
---------
-- Get --
---------
procedure Get (File : File_Type; Item : out Enum) is
Buf : Wide_String (1 .. Enum'Width);
Buflen : Natural;
begin
Aux.Get_Enum_Lit (File, Buf, Buflen);
Item := Enum'Wide_Value (Buf (1 .. Buflen));
exception
when Constraint_Error => raise Data_Error;
end Get;
procedure Get (Item : out Enum) is
begin
Get (Current_Input, Item);
end Get;
procedure Get
(From : Wide_String;
Item : out Enum;
Last : out Positive)
is
Start : Natural;
begin
Aux.Scan_Enum_Lit (From, Start, Last);
Item := Enum'Wide_Value (From (Start .. Last));
exception
when Constraint_Error => raise Data_Error;
end Get;
---------
-- Put --
---------
procedure Put
(File : File_Type;
Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
is
Image : constant Wide_String := Enum'Wide_Image (Item);
begin
Aux.Put (File, Image, Width, Set);
end Put;
procedure Put
(Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
is
begin
Put (Current_Output, Item, Width, Set);
end Put;
procedure Put
(To : out Wide_String;
Item : Enum;
Set : Type_Set := Default_Setting)
is
Image : constant Wide_String := Enum'Wide_Image (Item);
begin
Aux.Puts (To, Image, Set);
end Put;
end Ada.Wide_Text_IO.Enumeration_IO;
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_21829_1649.asm | ljhsiun2/medusa | 9 | 27589 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x5411, %r15
add %r10, %r10
mov (%r15), %ebx
nop
nop
nop
nop
xor $44333, %r11
lea addresses_WC_ht+0xe21, %r8
nop
xor $61665, %rsi
mov (%r8), %ax
nop
nop
xor %r8, %r8
lea addresses_normal_ht+0x1ec21, %rsi
lea addresses_WT_ht+0x11a21, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and $2119, %rbx
mov $64, %rcx
rep movsw
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0xce21, %rsi
nop
nop
nop
nop
sub $30062, %r11
movb (%rsi), %al
nop
nop
nop
nop
nop
add $34816, %r10
lea addresses_WT_ht+0x1b5ed, %r8
nop
add $17221, %rbx
movb $0x61, (%r8)
nop
nop
nop
lfence
lea addresses_UC_ht+0x1bb89, %rdi
sub $60445, %r15
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %r8
nop
nop
nop
nop
nop
add %r8, %r8
lea addresses_UC_ht+0xea91, %rsi
lea addresses_WT_ht+0x13861, %rdi
nop
nop
nop
nop
sub %r15, %r15
mov $87, %rcx
rep movsq
and %rbx, %rbx
lea addresses_WT_ht+0x15ca1, %rbx
nop
xor $11643, %rax
mov (%rbx), %cx
sub %r15, %r15
lea addresses_UC_ht+0xc01, %rbx
nop
nop
dec %r11
movl $0x61626364, (%rbx)
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x621, %r10
and $10760, %rax
movb (%r10), %bl
and $31790, %r8
lea addresses_normal_ht+0x12e21, %rsi
nop
nop
nop
nop
dec %r10
mov $0x6162636465666768, %r8
movq %r8, %xmm0
vmovups %ymm0, (%rsi)
nop
nop
inc %rbx
lea addresses_UC_ht+0xc801, %r8
nop
nop
add $1806, %rbx
mov (%r8), %edi
and %r15, %r15
lea addresses_UC_ht+0x1d519, %rcx
nop
cmp $17604, %rsi
vmovups (%rcx), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdi
nop
nop
nop
nop
nop
inc %r10
lea addresses_A_ht+0xb221, %r10
nop
nop
nop
nop
add %rax, %rax
movb (%r10), %r8b
nop
nop
nop
inc %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rbx
push %rcx
push %rdi
push %rsi
// Load
lea addresses_UC+0x1c6a1, %r12
nop
and $24196, %rdi
vmovups (%r12), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
nop
dec %rdi
// REPMOV
lea addresses_UC+0x4661, %rsi
mov $0xc21, %rdi
nop
nop
nop
nop
sub %r10, %r10
mov $5, %rcx
rep movsl
nop
nop
nop
add %r12, %r12
// Faulty Load
lea addresses_WT+0x9621, %r10
nop
cmp $24375, %rbx
mov (%r10), %r12w
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 6}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_P'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 8}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 9}}
{'dst': {'same': False, 'NT': True, 'AVXalign': True, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 2}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 7}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 4}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 11}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 11}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': True, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 10}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
test/interaction/Issue2280.agda | shlevy/agda | 1,989 | 15706 | -- Andreas, 2016-10-23 issue #2280:
-- Solver throws away meta arguments.
-- (Issue discovered by code review.)
open import Common.Equality
open import Common.Product
data Bool : Set where
true false : Bool
postulate
not : Bool → Bool
data D (f : Bool → Bool) : Set where
c : ∀ x → x ≡ not (f true) → D f
test : D {!!}
test = c {!!} refl
-- C-c C-= says
-- ?1 := not (?0 true)
-- But C-c C-s solves
-- ?1 := not ?
-- Ulf says this is fine, since we create a new interaction meta.
-- I must agree.
data E (p : Bool × Bool) : Set where
c : ∀ x → x ≡ not (proj₁ p) → E p
test2 : E {!!}
test2 = c {!!} refl
-- Consequently, C-c C-s should solve the last meta as
-- ?3 := not ?
|
core/lib/types/Pullback.agda | mikeshulman/HoTT-Agda | 0 | 16133 | <filename>core/lib/types/Pullback.agda
{-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.NType
open import lib.types.Cospan
open import lib.types.Pointed
open import lib.types.Sigma
module lib.types.Pullback where
module _ {i j k} (D : Cospan {i} {j} {k}) where
open Cospan D
record Pullback : Type (lmax i (lmax j k)) where
constructor pullback
field
a : A
b : B
h : f a == g b
pullback= : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ pullback a b h == pullback a' b' h'
pullback= idp idp r =
ap (pullback _ _) (! (∙-unit-r _) ∙ r)
pullback-aβ : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ ap Pullback.a (pullback= p q {h = h} {h' = h'} r) == p
pullback-aβ idp idp r =
ap Pullback.a (ap (pullback _ _) (! (∙-unit-r _) ∙ r))
=⟨ ∘-ap Pullback.a (pullback _ _) _ ⟩
ap (λ _ → _) (! (∙-unit-r _) ∙ r)
=⟨ ap-cst _ _ ⟩
idp =∎
pullback-bβ : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ ap Pullback.b (pullback= p q {h = h} {h' = h'} r) == q
pullback-bβ idp idp r =
ap Pullback.b (ap (pullback _ _) (! (∙-unit-r _) ∙ r))
=⟨ ∘-ap Pullback.b (pullback _ _) _ ⟩
ap (λ _ → _) (! (∙-unit-r _) ∙ r)
=⟨ ap-cst _ _ ⟩
idp =∎
module _ {i j k} (D : ⊙Cospan {i} {j} {k}) where
⊙Pullback : Ptd (lmax i (lmax j k))
⊙Pullback =
⊙[ Pullback (⊙cospan-out D) ,
pullback (pt X) (pt Y) (snd f ∙ ! (snd g)) ]
where open ⊙Cospan D
module _ {i j k} (D : Cospan {i} {j} {k}) where
open Cospan D
pullback-decomp-equiv : Pullback D ≃ Σ (A × B) (λ {(a , b) → f a == g b})
pullback-decomp-equiv = equiv
(λ {(pullback a b h) → ((a , b) , h)})
(λ {((a , b) , h) → pullback a b h})
(λ _ → idp)
(λ _ → idp)
module _ {i j k} (n : ℕ₋₂) {D : Cospan {i} {j} {k}} where
open Cospan D
pullback-level : has-level n A → has-level n B → has-level n C
→ has-level n (Pullback D)
pullback-level pA pB pC =
equiv-preserves-level ((pullback-decomp-equiv D)⁻¹) $
Σ-level (×-level pA pB) (λ _ → =-preserves-level pC)
|
Tests/NetNewsWireTests/ScriptingTests/scripts/testIterativeCreateAndDeleteFeed.applescript | bubudrc/NetNewsWire | 3,016 | 1650 | <reponame>bubudrc/NetNewsWire<filename>Tests/NetNewsWireTests/ScriptingTests/scripts/testIterativeCreateAndDeleteFeed.applescript
try
tell application "NetNewsWire"
tell account id "OnMyMac"
repeat 3 times
set newFeed to make new feed with data "https://boingboing.net/feed"
delete newFeed
end repeat
set newFolder to make new folder with properties {name:"XCTest folder"}
repeat 3 times
set newFeed to make new feed in newFolder with data "https://boingboing.net/feed"
delete newFeed
end repeat
delete newFolder
end tell
end tell
set test_result to true
set script_result to "Success"
on error message
return {test_result:false, script_result:message}
end try
return {test_result:test_result, script_result:script_result}
|
libsrc/_DEVELOPMENT/target/cpm/driver/terminal/cpm_01_output_dcio/cpm_01_output_dcio_oterm_msg_putc.asm | jpoikela/z88dk | 640 | 170545 | <filename>libsrc/_DEVELOPMENT/target/cpm/driver/terminal/cpm_01_output_dcio/cpm_01_output_dcio_oterm_msg_putc.asm<gh_stars>100-1000
INCLUDE "config_private.inc"
SECTION code_driver
SECTION code_driver_terminal_output
PUBLIC cpm_01_output_dcio_oterm_msg_putc
PUBLIC cpm_01_output_dcio_oterm_msg_putc_raw
EXTERN l_jpix, asm_cpm_bdos_alt
cpm_01_output_dcio_oterm_msg_putc:
; enter : c = char to output
; can use: af, bc, de, hl
; char to print is coming from stdio
bit 5,(ix+6)
jr z, cooked ; if cook is disabled
; tty emulation is enabled
ld a,OTERM_MSG_TTY
call l_jpix ; carry reset if tty absorbed char
ret nc ; if tty absorbed char
ld a,c
cp CHAR_BELL
jr nz, cooked
putchar_bell:
ld a,OTERM_MSG_BELL
jp (ix)
cooked:
cpm_01_output_dcio_oterm_msg_putc_raw:
; c = ascii code
bit 4,(ix+6)
jr z, crlf_done ; if not processing crlf
ld a,c
cp CHAR_CR
ret z ; ignore cr
cp CHAR_LF
jr nz, crlf_done
; send cr+lf
ld c,13
call crlf_done ; send cr
ld c,10
crlf_done:
; c = ascii code
ld e,c
ld c,__CPM_DCIO ; bdos direct i/o
jp asm_cpm_bdos_alt
|
oeis/275/A275778.asm | neoneye/loda-programs | 11 | 14330 | <reponame>neoneye/loda-programs
; A275778: Tribonacci-like sequence a(n) = a(n-1) + a(n-2) + a(n-3) for n >= 3, with a(0) = 1, a(1) = 2, a(2) = 1.
; Submitted by <NAME>
; 1,2,1,4,7,12,23,42,77,142,261,480,883,1624,2987,5494,10105,18586,34185,62876,115647,212708,391231,719586,1323525,2434342,4477453,8235320,15147115,27859888,51242323,94249326,173351537,318843186,586444049
mov $2,1
mov $3,2
lpb $0
sub $0,1
mov $1,$4
mov $4,$2
mov $2,$1
add $2,$3
mov $3,$1
add $4,$1
lpe
mov $0,$2
|
engine/battle/trainer_ai.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 15765 | ; creates a set of moves that may be used and returns its address in hl
; unused slots are filled with 0, all used slots may be chosen with equal probability
AIEnemyTrainerChooseMoves:
ld a, $20 ; for smart AI
ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
ld [hli], a ; move 1
ld [hli], a ; move 2
ld [hli], a ; move 3
ld [hl], a ; move 4
ld a, [wEnemyDisabledMove] ; forbid disabled move (if any)
swap a
and $f
jr z, .noMoveDisabled
ld hl, wBuffer
dec a
ld c, a
ld b, $0
add hl, bc ; advance pointer to forbidden move
ld [hl], $50 ; forbid (highly discourage) disabled move
.noMoveDisabled
ld hl, TrainerClassMoveChoiceModifications
ld a, [wTrainerClass]
ld b, a
.loopTrainerClasses
dec b
jr z, .readTrainerClassData
.loopTrainerClassData
ld a, [hli]
and a
jr nz, .loopTrainerClassData
jr .loopTrainerClasses
.readTrainerClassData
ld a, [hl]
and a
jp z, .useOriginalMoveSet
push hl
.nextMoveChoiceModification
pop hl
ld a, [hli]
and a
jr z, .loopFindMinimumEntries
push hl
ld hl, AIMoveChoiceModificationFunctionPointers
dec a
add a
ld c, a
ld b, 0
add hl, bc ; skip to pointer
ld a, [hli] ; read pointer into hl
ld h, [hl]
ld l, a
ld de, .nextMoveChoiceModification ; set return address
push de
jp hl ; execute modification function
.loopFindMinimumEntries ; all entries will be decremented sequentially until one of them is zero
ld hl, wBuffer ; temp move selection array
ld de, wEnemyMonMoves ; enemy moves
ld c, NUM_MOVES
.loopDecrementEntries
ld a, [de]
inc de
and a
jr z, .loopFindMinimumEntries
dec [hl]
jr z, .minimumEntriesFound
inc hl
dec c
jr z, .loopFindMinimumEntries
jr .loopDecrementEntries
.minimumEntriesFound
ld a, c
.loopUndoPartialIteration ; undo last (partial) loop iteration
inc [hl]
dec hl
inc a
cp NUM_MOVES + 1
jr nz, .loopUndoPartialIteration
ld hl, wBuffer ; temp move selection array
ld de, wEnemyMonMoves ; enemy moves
ld c, NUM_MOVES
.filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0)
ld a, [de]
and a
jr nz, .moveExisting
ld [hl], a
.moveExisting
ld a, [hl]
dec a
jr z, .slotWithMinimalValue
xor a
ld [hli], a ; disable move slot
jr .next
.slotWithMinimalValue
ld a, [de]
ld [hli], a ; enable move slot
.next
inc de
dec c
jr nz, .filterMinimalEntries
ld hl, wBuffer ; use created temporary array as move set
ret
.useOriginalMoveSet
ld hl, wEnemyMonMoves ; use original move set
ret
AIMoveChoiceModificationFunctionPointers:
dw AIMoveChoiceModification1
dw AIMoveChoiceModification2
dw AIMoveChoiceModification3
dw AIMoveChoiceModification4
; discourages moves that cause no damage but only a status
; ailment if player's mon already has one
AIMoveChoiceModification1:
ld a, [wBattleMonStatus]
and a
ret z ; return if no status ailment on player's mon
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset)
ld de, wEnemyMonMoves ; enemy moves
ld b, NUM_MOVES + 1
.nextMove
dec b
ret z ; processed all 4 moves
inc hl
ld a, [de]
and a
ret z ; no more moves in move set
inc de
call ReadMove
ld a, [wEnemyMovePower]
and a
jr nz, .nextMove
ld a, [wEnemyMoveEffect]
push hl
push de
push bc
ld hl, StatusAilmentMoveEffects
ld de, $0001
call IsInArray
pop bc
pop de
pop hl
jr nc, .nextMove
ld a, [hl]
add $20 ; heavily discourage move
ld [hl], a
jr .nextMove
StatusAilmentMoveEffects:
db $01 ; unused sleep effect
db SLEEP_EFFECT
db POISON_EFFECT
db PARALYZE_EFFECT
db $FF
; Deleted & Unused
AIMoveChoiceModification2:
ret
; Deleted & Unused
AIMoveChoiceModification3:
ret
; Smart AI routine
; Does everything a good Trainer would do...
AIMoveChoiceModification4:
; damaging move priority on turn 3+
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement
cp $2
jr c, .healingCheck
ld hl, wBuffer - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.damageLoop
dec b
jr z, .healingCheck
inc hl
ld a, [de]
and a
jr z, .healingCheck
inc de
call ReadMove
ld a, [wEnemyMovePower]
and a
jr z, .damageLoop
; encourage by 2
dec [hl]
dec [hl]
jr .damageLoop
; healing moves?
.healingCheck
ld a, [wEnemyMonMaxHP]
and a
jr z, .noscale
ld b, a
ld a, [wEnemyMonMaxHP + 1]
srl b
rr a
ld b, a
ld a, [wEnemyMonHP]
ld c, a
ld a, [wEnemyMonHP + 1]
srl c
rr a
ld c, a
jr .realHealCheck
.noscale
ld a, [wEnemyMonMaxHP + 1]
ld b, a
ld a, [wEnemyMonHP + 1]
ld c, a
.realHealCheck
srl b
ld a, c
cp b
ld hl, HealingMoves
jr nc, .debuffHealingMoves
ld b, -8
call Random
ld a, [hRandomAdd]
cp $C0 ; 3/4 chance
jr nc, .dreamEaterCheck
jr .applyHealingChance
.debuffHealingMoves
ld b, 10
.applyHealingChance
call AlterMovePriorityArray
.dreamEaterCheck
ld a, [wBattleMonStatus]
and SLP
ld a, DREAM_EATER
ld [wAIBuffer1], a
jr z, .debuffDreamEater
ld b, -1
jr .applyDreamEater
.debuffDreamEater
ld b, 20
.applyDreamEater
call AlterMovePriority
.effectivenessCheck
; encourage any damaging move with SE, slightly discourage NVE moves
ld hl, wBuffer - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.seloop
dec b
jr z, .selfBuffCheck
inc hl
ld a, [de]
and a
jr z, .selfBuffCheck
inc de
call ReadMove
ld a, [wEnemyMoveEffect]
cp SUPER_FANG_EFFECT
jr z, .seloop
cp SPECIAL_DAMAGE_EFFECT
jr z, .seloop
ld a, [wEnemyMovePower]
cp 10
jr c, .seloop
push hl
push bc
push de
callab AIGetTypeEffectiveness
pop de
pop bc
pop hl
ld a, [wTypeEffectiveness]
cp $0a
jr z, .seloop
jr c, .nvemove
; strongly encourage SE Move
rept 4
dec [hl]
endr
cp $15
jr c, .seloop
; even more strongly encourage 4x SE move
rept 3
dec [hl]
endr
jr .seloop
.nvemove
; slighly discourage
inc [hl]
and a
jr nz, .seloop
; strongly discourage immunity
ld a, [hl]
add 50
ld [hl], a
jr .seloop
.selfBuffCheck
; 50% chance to encourage self-buff or status on turn 1 - 2
ld a, [wAILayer2Encouragement]
cp $2
jr nc, .discourageFocusEnergy
call Random
ld a, [hRandomAdd]
cp $80
jr nc, .discourageFocusEnergy
ld hl, LightStatusMoves
ld b, -3
call AlterMovePriorityArray
ld hl, MediumStatusMoves
ld b, -5
call AlterMovePriorityArray
ld hl, HeavyStatusMoves
ld b, -6
call AlterMovePriorityArray
.discourageFocusEnergy
; NEVER use Focus Energy if we have already used it.
ld a, [wEnemyBattleStatus2]
bit GettingPumped, a
jr z, .discourageLightScreen
ld a, FOCUS_ENERGY
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.discourageLightScreen
; NEVER use Light Screen if we have already used it.
ld a, [wEnemyBattleStatus3]
bit HasLightScreenUp, a
jr z, .discourageReflect
ld a, LIGHT_SCREEN
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.discourageReflect
; NEVER use Reflect if we have already used it.
ld a, [wEnemyBattleStatus3]
bit HasReflectUp, a
jr z, .discourageBattleEndingMoves
ld a, REFLECT
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.discourageBattleEndingMoves
; NEVER use moves that try to end the battle...
ld hl, EndBattleMoves
ld b, 50
call AlterMovePriorityArray
.discourageImmunePoisonMoves
; NEVER use poison status moves that the player is immune to
ld de, wBattleMonType1
ld a, [de]
cp POISON
jr z, .poisonStatusDoesntAffect
; Check Second Type
inc de
ld a, [de]
cp POISON
jr z, .poisonStatusDoesntAffect
jr .discourageImmuneThunderWave
.poisonStatusDoesntAffect
ld hl, PoisonMoves
ld b, 50
call AlterMovePriorityArray
.discourageImmuneThunderWave
; NEVER use thunderwave if the player is immune to it
ld de, wBattleMonType1
ld a, [de]
cp ELECTRIC
jr z, .thunderWaveDoesntAffect
cp GROUND
jr z, .thunderWaveDoesntAffect
; Check Second Types
inc de
ld a, [de]
cp ELECTRIC
jr z, .thunderWaveDoesntAffect
cp GROUND
jr z, .thunderWaveDoesntAffect
jr .discourageImmuneGlare
.thunderWaveDoesntAffect
ld a, THUNDER_WAVE
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.discourageImmuneGlare
; NEVER use glare if the player is immune to it
ld de, wBattleMonType1
ld a, [de]
cp GHOST
jr z, .glareDoesntAffect
; Check Second Type
inc de
ld a, [de]
cp GHOST
jr z, .glareDoesntAffect
jr .discourageImmuneLeechSeed
.glareDoesntAffect
ld a, GLARE
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.discourageImmuneLeechSeed
; NEVER use leech seed if the player is immune to it
ld de, wBattleMonType1
ld a, [de]
cp GRASS
jr z, .leechSeedDoesntAffect
; Check Second Type
inc de
ld a, [de]
cp GRASS
jr z, .leechSeedDoesntAffect
jr .checkToInflictStatusOrConfusion
.leechSeedDoesntAffect
ld a, LEECH_SEED
ld [wAIBuffer1], a
ld b, 50
call AlterMovePriority
.checkToInflictStatusOrConfusion
; if enemy already has a status affliction, don't keep trying to give them one
; this *should* already be part of AIMoveChoiceModification1 but it doesn't always seem to catch them
; if player does not have a status, we then check confusion state. If not confused, attempt to do so
; The Priority here always falls to non-volatile status conditions first, then confusion
; Only 50% chance to perform this code
call Random
ld a, [hRandomAdd]
cp $80
jr c, .checkToInflictStatus
; Discourage Status moves
ld hl, StatusOnlyMoves
ld b, 30
call AlterMovePriorityArray
; Discourage Confusion moves
ld hl, ConfuseMoves
ld b, 30
call AlterMovePriorityArray
; Discourage Disable
ld a, DISABLE
ld [wAIBuffer1], a
ld b, 30
call AlterMovePriority
ret
.checkToInflictStatus
; is player statused?
ld a, [wBattleMonStatus]
and a
jr z, .inflictStatus
; fallthrough on nz
.discourageStatusMoves
; Discourage Status moves if already status'd
ld hl, StatusOnlyMoves
ld b, 30
call AlterMovePriorityArray
jr .checkInflictConfusion
.inflictStatus
; if they don't have a status, attempt to give them it.
ld hl, StatusOnlyMoves
ld b, -7
call AlterMovePriorityArray
; fallthrough
.checkInflictConfusion
; is player confused?
ld a,[wPlayerBattleStatus1]
bit Confused, a
jr z, .inflictConfusion
; fallthrough on nz
.discourageConfuseMoves
; Discourage Confusion moves if already confused
ld hl, ConfuseMoves
ld b, 30
call AlterMovePriorityArray
jr .checkInflictDisable
.inflictConfusion
; if they don't have confusion, attempt to give them it.
ld hl, ConfuseMoves
ld b, -7
call AlterMovePriorityArray
; fallthrough
.checkInflictDisable
; does player have a disabled move?
ld hl, wPlayerDisabledMove
ld a, [hl]
and a
jr z, .inflictDisable
; fallthrough on nz
.discourageDisable
; Discourage disable if already disabled
ld a, DISABLE
ld [wAIBuffer1], a
ld b, 30
call AlterMovePriority
ret
.inflictDisable
; if they don't have a disabled move, attempt to do it.
ld a, DISABLE
ld [wAIBuffer1], a
ld b, -7
call AlterMovePriority
ret
LightStatusMoves:
db DISABLE
db MIST
db HAZE
db LEER
db GROWL
db TAIL_WHIP
db STRING_SHOT
db HARDEN
db WITHDRAW
db DEFENSE_CURL
db $FF
MediumStatusMoves:
db BIDE
db SHARPEN
db MEDITATE
db BARRIER
db AGILITY
db SCREECH
db DOUBLE_TEAM
db SMOKESCREEN
db SAND_ATTACK
db FLASH
db $FF
HeavyStatusMoves:
db SWORDS_DANCE
db ACID_ARMOR
db GROWTH
db AMNESIA
db MINIMIZE
db KINESIS
db SUBSTITUTE
db FOCUS_ENERGY
db REFLECT
db LIGHT_SCREEN
db $FF
HealingMoves:
db REST
db RECOVER
db SOFTBOILED
db $FF
EndBattleMoves:
db WHIRLWIND
db ROAR
db TELEPORT
db $FF
StatusOnlyMoves:
db POISONPOWDER
db STUN_SPORE
db SLEEP_POWDER
db THUNDER_WAVE
db TOXIC
db HYPNOSIS
db GLARE
db POISON_GAS
db LOVELY_KISS
db SPORE
db SING
db $FF
ConfuseMoves:
db SUPERSONIC
db CONFUSE_RAY
db $FF
PoisonMoves:
db POISON_GAS
db POISONPOWDER
db TOXIC
db $FF
AlterMovePriority:
; [wAIBuffer1] = move
; b = priority change
ld hl, wBuffer - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
.moveLoop
dec c
ret z
inc hl
ld a, [de]
and a
ret z
inc de
push bc
ld b, a
ld a, [wAIBuffer1]
cp b
pop bc
jr nz, .moveLoop
ld a, [hl]
add b
ld [hl], a
ret
AlterMovePriorityArray:
; hl = move array
; b = priority change
ld a, h
ld [wAIBuffer1], a
ld a, l
ld [wAIBuffer1 + 1], a
ld hl, wBuffer - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
.moveLoop
dec c
ret z
inc hl
ld a, [de]
and a
ret z
inc de
push hl
push de
push bc
ld b, a
ld a, [wAIBuffer1]
ld h, a
ld a, [wAIBuffer1 + 1]
ld l, a
ld a, b
ld de, $0001
call IsInArray
pop bc
pop de
pop hl
jr nc, .moveLoop
ld a, [hl]
add b
ld [hl], a
ret
ReadMove:
push hl
push de
push bc
dec a
ld hl,Moves
ld bc,MoveEnd - Moves
call AddNTimes
ld de,wEnemyMoveNum
call CopyData
pop bc
pop de
pop hl
ret
; move choice modification methods that are applied for each trainer class
; 0 is sentinel value
TrainerClassMoveChoiceModifications:
db 1,4,0 ; YOUNGSTER
db 1,4,0 ; BUG CATCHER
db 1,4,0 ; LASS
db 1,4,0 ; SAILOR
db 1,4,0 ; JR_TRAINER_M
db 1,4,0 ; JR_TRAINER_F
db 1,4,0 ; POKEMANIAC
db 1,4,0 ; SUPER_NERD
db 1,4,0 ; HIKER
db 1,4,0 ; BIKER
db 1,4,0 ; BURGLAR
db 1,4,0 ; ENGINEER
db 1,4,0 ; SWIMMER_F
db 1,4,0 ; FISHER
db 1,4,0 ; SWIMMER
db 1,4,0 ; CUE_BALL
db 1,4,0 ; GAMBLER
db 1,4,0 ; BEAUTY
db 1,4,0 ; PSYCHIC_TR
db 1,4,0 ; ROCKER
db 1,4,0 ; JUGGLER
db 1,4,0 ; TAMER
db 1,4,0 ; BIRD_KEEPER
db 1,4,0 ; BLACKBELT
db 1,4,0 ; RIVAL1
db 1,4,0 ; PROF_OAK
db 1,4,0 ; ROCKET_F
db 1,4,0 ; SCIENTIST
db 1,4,0 ; GIOVANNI
db 1,4,0 ; ROCKET
db 1,4,0 ; COOLTRAINER_M
db 1,4,0 ; COOLTRAINER_F
db 1,4,0 ; BRUNO
db 1,4,0 ; BROCK
db 1,4,0 ; MISTY
db 1,4,0 ; LT_SURGE
db 1,4,0 ; ERIKA
db 1,4,0 ; KOGA
db 1,4,0 ; BLAINE
db 1,4,0 ; SABRINA
db 1,4,0 ; GENTLEMAN
db 1,4,0 ; RIVAL2
db 1,4,0 ; RIVAL3
db 1,4,0 ; LORELEI
db 1,4,0 ; CHANNELER
db 1,4,0 ; AGATHA
db 1,4,0 ; LANCE
INCLUDE "engine/battle/trainer_pic_money_pointers.asm"
INCLUDE "text/trainer_names.asm"
INCLUDE "engine/battle/bank_e_misc.asm"
INCLUDE "engine/battle/read_trainer_party.asm"
INCLUDE "data/trainer_moves.asm"
INCLUDE "data/trainer_parties.asm"
TrainerAI:
and a
ld a,[wIsInBattle]
dec a
ret z ; if not a trainer, we're done here
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
ld a,[wTrainerClass] ; what trainer class is this?
dec a
ld c,a
ld b,0
ld hl,TrainerAIPointers
add hl,bc
add hl,bc
add hl,bc
ld a,[wAICount]
and a
ret z ; if no AI uses left, we're done here
inc hl
inc a
jr nz,.getpointer
dec hl
ld a,[hli]
ld [wAICount],a
.getpointer
ld a,[hli]
ld h,[hl]
ld l,a
call Random
jp hl
TrainerAIPointers:
; one entry per trainer class
; first byte, number of times (per Pokémon) it can occur
; next two bytes, pointer to AI subroutine for trainer class
dbw 1,PotionAI ; YOUNGSTER
dbw 1,PotionAI ; BUG CATCHER
dbw 1,PotionAI ; LASS
dbw 3,SwitchOutAI ; SAILOR
dbw 1,FullHealOrPotionAI ; JR_TRAINER_M
dbw 1,FullHealOrPotionAI ; JR_TRAINER_F
dbw 2,SwitchOrSuperPotionAI ; POKEMANIAC
dbw 3,SwitchOutAI ; SUPER_NERD
dbw 1,FullHealOrPotionAI ; HIKER
dbw 1,XDefendAI ; BIKER
dbw 3,SwitchOutAI ; BURGLAR
dbw 1,GuardSpecAI ; ENGINEER
dbw 1,XDefendAI ; SWIMMER_F
dbw 1,SuperPotion1AI ; FISHER
dbw 1,XSpeedAI ; SWIMMER
dbw 1,DireHitAI ; CUE_BALL
dbw 3,SwitchOutAI ; GAMBLER
dbw 1,SuperPotion1AI ; BEAUTY
dbw 1,XSpecialAI ; PSYCHIC_TR
dbw 1,XSpeedAI ; ROCKER
dbw 3,SwitchOutAI ; JUGGLER
dbw 1,XAttackAI ; TAMER
dbw 1,DireHitAI ; BIRD_KEEPER
dbw 1,XAttackAI ; BLACKBELT
dbw 1,FullHealOrPotionAI ; RIVAL1
dbw 1,FullRestoreAI ; PROF_OAK
dbw 3,NoItemAI ; ROCKET_F
dbw 1,GuardSpecAI ; SCIENTIST
dbw 1,HyperPotion2AI ; GIOVANNI
dbw 3,NoItemAI ; ROCKET
dbw 1,SwitchOrHyperPotionAI ; COOLTRAINER_M
dbw 1,SwitchOrHyperPotionAI ; COOLTRAINER_F
dbw 1,HyperPotion2AI ; BRUNO
dbw 1,FullHealOrPotionAI ; BROCK
dbw 2,FullHealAI ; MISTY
dbw 1,SuperPotion1AI ; LT_SURGE
dbw 1,SuperPotion2AI ; ERIKA
dbw 1,HyperPotion1AI ; KOGA
dbw 2,HyperPotion1AI ; BLAINE
dbw 2,SwitchOrFullHealAI ; SABRINA
dbw 1,FullHealOrPotionAI ; GENTLEMAN
dbw 1,FullHealOrSuperPotionAI ; RIVAL2
dbw 1,FullRestoreAI ; RIVAL3
dbw 2,SuperPotion2AI ; LORELEI
dbw 1,XSpecialAI ; CHANNELER
dbw 2,SwitchOrSuperPotionAI ; AGATHA
dbw 1,HyperPotion2AI ; LANCE
SwitchOutAI:
cp $40
ret nc
ld a,[wEnemyBattleStatus2]
bit HasSubstituteUp, a
ret nz ; Don't want to switch if we have a sub up
ld a,2
call AICheckIfHPBelowFraction
ret nc
jp AISwitchIfEnoughMons
jp AISwitchIfEnoughMons
XAttackAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseXAttack
XDefendAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseXDefend
XSpeedAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseXSpeed
XSpecialAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseXSpecial
XAccuracyAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseXAccuracy
GuardSpecAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseGuardSpec
DireHitAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ret nc
jp AIUseDireHit
PotionAI:
cp $20
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AIUsePotion
FullHealAI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,[wEnemyMonStatus]
and a
ret z
jp AIUseFullHeal
SuperPotion1AI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion
SuperPotion2AI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,$A
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion
HyperPotion1AI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AIUseHyperPotion
HyperPotion2AI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,$A
call AICheckIfHPBelowFraction
ret nc
jp AIUseHyperPotion
FullRestoreAI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,[wEnemyMonStatus]
and a
jp nz, AIUseFullRestore
ld a,$A
call AICheckIfHPBelowFraction
ret nc
jp AIUseFullRestore
FullHealOrPotionAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,[wEnemyMonStatus]
and a
jp nz, AIUseFullHeal
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AIUsePotion
FullHealOrSuperPotionAI:
cp $40
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,[wEnemyMonStatus]
and a
jp nz, AIUseFullHeal
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion
SwitchOrFullHealAI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,[wEnemyMonStatus]
and a
jp nz, AIUseFullHeal
ld a,[wEnemyBattleStatus2]
bit HasSubstituteUp, a
ret nz ; Don't want to switch if we have a sub up
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AISwitchIfEnoughMons
SwitchOrSuperPotionAI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,$A
call AICheckIfHPBelowFraction
jp c,AIUseSuperPotion
ld a,[wEnemyBattleStatus2]
bit HasSubstituteUp, a
ret nz ; Don't want to switch if we have a sub up
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AISwitchIfEnoughMons
SwitchOrHyperPotionAI:
cp $80
ret nc
ld a, [wAILayer2Encouragement] ; wAILayer2Encouragement (How many turns has it been out?)
cp 2
ccf
ret nc ; They can't heal too early
ld a,$A
call AICheckIfHPBelowFraction
jp c,AIUseHyperPotion
ld a,[wEnemyBattleStatus2]
bit HasSubstituteUp, a
ret nz ; Don't want to switch if we have a sub up
ld a,5
call AICheckIfHPBelowFraction
ret nc
jp AISwitchIfEnoughMons
NoItemAI:
and a ; clear carry
ret
; end of individual trainer AI routines
DecrementAICount:
ld hl,wAICount
dec [hl]
scf
ret
AIPlayRestoringSFX:
ld a,SFX_HEAL_AILMENT
jp PlaySoundWaitForCurrent
AIUseFullRestore:
call AICureStatus
ld a,FULL_RESTORE
ld [wAIItem],a
ld de,wHPBarOldHP
ld hl,wEnemyMonHP + 1
ld a,[hld]
ld [de],a
inc de
ld a,[hl]
ld [de],a
inc de
ld hl,wEnemyMonMaxHP + 1
ld a,[hld]
ld [de],a
inc de
ld [wHPBarMaxHP],a
ld [wEnemyMonHP + 1],a
ld a,[hl]
ld [de],a
ld [wHPBarMaxHP+1],a
ld [wEnemyMonHP],a
jr AIPrintItemUseAndUpdateHPBar
AIUsePotion:
; enemy trainer heals his monster with a potion
ld a,POTION
ld b,20
jr AIRecoverHP
AIUseSuperPotion:
; enemy trainer heals his monster with a super potion
ld a,SUPER_POTION
ld b,50
jr AIRecoverHP
AIUseHyperPotion:
; enemy trainer heals his monster with a hyper potion
ld a,HYPER_POTION
ld b,200
; fallthrough
AIRecoverHP:
; heal b HP and print "trainer used $(a) on pokemon!"
ld [wAIItem],a
ld hl,wEnemyMonHP + 1
ld a,[hl]
ld [wHPBarOldHP],a
add b
ld [hld],a
ld [wHPBarNewHP],a
ld a,[hl]
ld [wHPBarOldHP+1],a
ld [wHPBarNewHP+1],a
jr nc,.next
inc a
ld [hl],a
ld [wHPBarNewHP+1],a
.next
inc hl
ld a,[hld]
ld b,a
ld de,wEnemyMonMaxHP + 1
ld a,[de]
dec de
ld [wHPBarMaxHP],a
sub b
ld a,[hli]
ld b,a
ld a,[de]
ld [wHPBarMaxHP+1],a
sbc b
jr nc,AIPrintItemUseAndUpdateHPBar
inc de
ld a,[de]
dec de
ld [hld],a
ld [wHPBarNewHP],a
ld a,[de]
ld [hl],a
ld [wHPBarNewHP+1],a
; fallthrough
AIPrintItemUseAndUpdateHPBar:
call AIPrintItemUse_
coord hl, 2, 2
xor a
ld [wHPBarType],a
predef UpdateHPBar2
jp DecrementAICount
AISwitchIfEnoughMons:
; enemy trainer switches if there are 3 or more unfainted mons in party
ld a,[wEnemyPartyCount]
ld c,a
ld hl,wEnemyMon1HP
ld d,0 ; keep count of unfainted monsters
; count how many monsters haven't fainted yet
.loop
ld a,[hli]
ld b,a
ld a,[hld]
or b
jr z,.Fainted ; has monster fainted?
inc d
.Fainted
push bc
ld bc, wEnemyMon2 - wEnemyMon1
add hl,bc
pop bc
dec c
jr nz,.loop
ld a,d ; how many available monsters are there?
cp 2 ; don't bother if only 1 or 2
jp nc,SwitchEnemyMon
and a
ret
SwitchEnemyMon:
; prepare to withdraw the active monster: copy hp, number, and status to roster
ld a,[wEnemyMonPartyPos]
ld hl,wEnemyMon1HP
ld bc,wEnemyMon2 - wEnemyMon1
call AddNTimes
ld d,h
ld e,l
ld hl,wEnemyMonHP
ld bc,4
call CopyData
ld hl, AIBattleWithdrawText
call PrintText
; This wFirstMonsNotOutYet variable is abused to prevent the player from
; switching in a new mon in response to this switch.
ld a,1
ld [wFirstMonsNotOutYet],a
callab EnemySendOut
xor a
ld [wFirstMonsNotOutYet],a
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
scf
ret
AIBattleWithdrawText:
TX_FAR _AIBattleWithdrawText
db "@"
AIUseFullHeal:
call AIPlayRestoringSFX
call AICureStatus
ld a,FULL_HEAL
jp AIPrintItemUse
AICureStatus:
; cures the status of enemy's active pokemon
ld a,[wEnemyMonPartyPos]
ld hl,wEnemyMon1Status
ld bc,wEnemyMon2 - wEnemyMon1
call AddNTimes
xor a
ld [hl],a ; clear status in enemy team roster
ld [wEnemyMonStatus],a ; clear status of active enemy
ld hl,wEnemyBattleStatus3
res 0,[hl]
ret
AIUseXAccuracy:
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 0,[hl]
ld a,X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec:
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 1,[hl]
ld a,GUARD_SPEC
jp AIPrintItemUse
AIUseDireHit:
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 2,[hl]
ld a,DIRE_HIT
jp AIPrintItemUse
AICheckIfHPBelowFraction:
; return carry if enemy trainer's current HP is below 1 / a of the maximum
ld [H_DIVISOR],a
ld hl,wEnemyMonMaxHP
ld a,[hli]
ld [H_DIVIDEND],a
ld a,[hl]
ld [H_DIVIDEND + 1],a
ld b,2
call Divide
ld a,[H_QUOTIENT + 3]
ld c,a
ld a,[H_QUOTIENT + 2]
ld b,a
ld hl,wEnemyMonHP + 1
ld a,[hld]
ld e,a
ld a,[hl]
ld d,a
ld a,d
sub b
ret nz
ld a,e
sub c
ret
AIUseXAttack:
ld b,$A
ld a,X_ATTACK
jr AIIncreaseStat
AIUseXDefend:
ld b,$B
ld a,X_DEFEND
jr AIIncreaseStat
AIUseXSpeed:
ld b,$C
ld a,X_SPEED
jr AIIncreaseStat
AIUseXSpecial:
ld b,$D
ld a,X_SPECIAL
; fallthrough
AIIncreaseStat:
ld [wAIItem],a
push bc
call AIPrintItemUse_
pop bc
ld hl,wEnemyMoveEffect
ld a,[hld]
push af
ld a,[hl]
push af
push hl
ld a,ANIM_AF
ld [hli],a
ld [hl],b
callab StatModifierUpEffect
pop hl
pop af
ld [hli],a
pop af
ld [hl],a
jp DecrementAICount
AIPrintItemUse:
ld [wAIItem],a
call AIPrintItemUse_
jp DecrementAICount
AIPrintItemUse_:
; print "x used [wAIItem] on z!"
ld a,[wAIItem]
ld [wd11e],a
call GetItemName
ld hl, AIBattleUseItemText
jp PrintText
AIBattleUseItemText:
TX_FAR _AIBattleUseItemText
db "@"
|
Cubical/Relation/Binary/Raw/Structures.agda | bijan2005/univalent-foundations | 0 | 2293 | <filename>Cubical/Relation/Binary/Raw/Structures.agda
{-# OPTIONS --cubical --no-import-sorts --safe #-}
open import Cubical.Relation.Binary.Base
open import Cubical.Core.Everything
module Cubical.Relation.Binary.Raw.Structures
{a ℓ} {A : Type a} -- The underlying type
(_<>_ : RawRel A ℓ) -- The relation
where
open import Cubical.Foundations.Prelude using (refl; sym)
open import Cubical.Foundations.Function using (_∘_)
open import Cubical.Data.Prod.Base using (proj₁; proj₂; _,_)
open import Cubical.Relation.Nullary.Decidable
open import Cubical.Relation.Binary.Raw.Definitions
open import Cubical.Relation.Binary.Raw.Properties
private
variable
ℓ₂ : Level
------------------------------------------------------------------------
-- Preorders
------------------------------------------------------------------------
record IsPreorder : Type (ℓ-max a ℓ) where
constructor ispreorder
field
reflexive : Reflexive _<>_
transitive : Transitive _<>_
fromEq : FromEq _<>_
fromEq = reflx→fromeq _<>_ reflexive
------------------------------------------------------------------------
-- Equivalences
------------------------------------------------------------------------
record IsPartialEquivalence : Type (ℓ-max a ℓ) where
constructor ispartialeq
field
symmetric : Symmetric _<>_
transitive : Transitive _<>_
record IsEquivalence : Type (ℓ-max a ℓ) where
constructor isequivalence
field
reflexive : Reflexive _<>_
isPartialEquivalence : IsPartialEquivalence
open IsPartialEquivalence isPartialEquivalence public
from-≡ : FromEq _<>_
from-≡ = reflx→fromeq _<>_ reflexive
isPreorder : IsPreorder
isPreorder = record
{ reflexive = reflexive
; transitive = transitive
}
record IsDecEquivalence : Type (ℓ-max a ℓ) where
constructor isdeceq
infix 4 _≟_
field
isEquivalence : IsEquivalence
_≟_ : Decidable _<>_
open IsEquivalence isEquivalence public
------------------------------------------------------------------------
-- Partial orders
------------------------------------------------------------------------
record IsPartialOrder : Type (ℓ-max a ℓ) where
constructor ispartialorder
field
isPreorder : IsPreorder
antisym : Antisymmetric _<>_
open IsPreorder isPreorder public
record IsDecPartialOrder : Type (ℓ-max a ℓ) where
constructor isdecpartialorder
infix 4 _≤?_
field
isPartialOrder : IsPartialOrder
_≤?_ : Decidable _<>_
open IsPartialOrder isPartialOrder public
private
lemma : ∀ {x y} → ¬ x <> y → ¬ x ≡ y
lemma x≰y x≡y = x≰y (fromEq x≡y)
_≟_ : Discrete A
_≟_ x y with x ≤? y
... | no ¬p = no (lemma ¬p)
... | yes p with y ≤? x
... | no ¬q = no (lemma ¬q ∘ sym)
... | yes q = yes (antisym p q)
record IsStrictPartialOrder : Type (ℓ-max a ℓ) where
constructor isstrictpartialorder
field
irrefl : Irreflexive _<>_
transitive : Transitive _<>_
asym : Asymmetric _<>_
asym {x} {y} = trans∧irr→asym _<>_ transitive irrefl
record IsDecStrictPartialOrder : Type (ℓ-max a ℓ) where
constructor isdecstrictpartialorder
infix 4 _<?_
field
isStrictPartialOrder : IsStrictPartialOrder
_<?_ : Decidable _<>_
open IsStrictPartialOrder isStrictPartialOrder public
------------------------------------------------------------------------
-- Total orders
------------------------------------------------------------------------
record IsTotalOrder : Type (ℓ-max a ℓ) where
constructor istotalorder
field
isPartialOrder : IsPartialOrder
total : PropTotal _<>_
open IsPartialOrder isPartialOrder public
record IsDecTotalOrder : Type (ℓ-max a ℓ) where
constructor isdectotalorder
infix 4 _≤?_
field
isTotalOrder : IsTotalOrder
_≤?_ : Decidable _<>_
open IsTotalOrder isTotalOrder public
isDecPartialOrder : IsDecPartialOrder
isDecPartialOrder = record
{ isPartialOrder = isPartialOrder
; _≤?_ = _≤?_
}
open IsDecPartialOrder isDecPartialOrder public using (_≟_)
-- Note that these orders are decidable. The current implementation
-- of `Trichotomous` subsumes irreflexivity and asymmetry. Any reasonable
-- definition capturing these three properties implies decidability
-- as `Trichotomous` necessarily separates out the equality case.
record IsStrictTotalOrder : Type (ℓ-max a ℓ) where
constructor isstricttotalorder
field
transitive : Transitive _<>_
compare : Trichotomous _<>_
infix 4 _<?_
_<?_ : Decidable _<>_
_<?_ = tri→dec< _<>_ compare
_≟_ : Discrete A
_≟_ = tri→dec≡ _<>_ compare
isStrictPartialOrder : IsStrictPartialOrder
isStrictPartialOrder = record
{ irrefl = tri→irr _<>_ compare
; transitive = transitive
}
isDecStrictPartialOrder : IsDecStrictPartialOrder
isDecStrictPartialOrder = record
{ isStrictPartialOrder = isStrictPartialOrder
; _<?_ = _<?_
}
open IsStrictPartialOrder isStrictPartialOrder public hiding (transitive)
|
src/bootloader.asm | adugast/bootloader | 0 | 243772 | ;small introduction to bootloader code
;0x7C00 - the BIOS loads 512 bytes from this memory address - MAGIC NUMBER
;0xAA55 - last two bytes of the MBR - MAGIC NUMBER
bits 16 ;pc cpu boots in real mode so only 16bit instructions
jmp _start
nop
string db "Printed from the bootloader", 0x0d, 0x0a, 0x00
_start:
mov ax, 0x07C0 ;move 0x7C00 into ax
mov ds, ax ;set data segment to the start
mov si, string ;put string into si
call print_str
.infinite_loop:
jmp .infinite_loop
print_str:
mov ah, 0x0e ;display character, function number = 0Eh
.loop:
lodsb ;load string byte to al
cmp al, 0x0 ;if al == 0
je .done ;end function
int 0x10 ;else call INT 10h to print the character
jmp .loop ;continue until al == 0
.done:
ret
times 510-($-$$) db 0 ;fill the rest of MBR with 0s
dw 0xAA55 ;the last two bytes of the MBR must contain 0xAA55
|
programs/oeis/097/A097454.asm | karttu/loda | 1 | 105357 | <filename>programs/oeis/097/A097454.asm
; A097454: a(n) = (number of nonprimes <= n) - (number of primes <= n).
; 1,0,-1,0,-1,0,-1,0,1,2,1,2,1,2,3,4,3,4,3,4,5,6,5,6,7,8,9,10,9,10,9,10,11,12,13,14,13,14,15,16,15,16,15,16,17,18,17,18,19,20,21,22,21,22,23,24,25,26,25,26,25,26,27,28,29,30,29,30,31,32,31,32,31,32,33,34,35,36,35,36,37,38,37,38,39,40,41,42,41,42,43,44,45
cal $0,72731 ; Difference of numbers of composite and prime numbers <= n.
add $0,1
mov $1,$0
|
awa/src/awa-users-modules.ads | Letractively/ada-awa | 0 | 7994 | <filename>awa/src/awa-users-modules.ads<gh_stars>0
-----------------------------------------------------------------------
-- awa-users-module -- User management module
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Applications;
with AWA.Modules;
with AWA.Users.Services;
with AWA.Users.Filters;
with AWA.Users.Servlets;
-- == Introduction ==
-- The <b>Users.Module</b> manages the creation, update, removal and authentication of users
-- in an application. The module provides the foundations for user management in
-- a web application.
--
-- A user can register himself by using a subscription form. In that case, a verification mail
-- is sent and the user has to follow the verification link defined in the mail to finish
-- the registration process. The user will authenticate using a password.
--
-- A user can also use an OpenID account and be automatically registered.
--
-- A user can have one or several permissions that allow to protect the application data.
-- User permissions are managed by the <b>Permissions.Module</b>.
--
-- == Configuration ==
-- The *users* module uses a set of configuration properties to configure the OpenID
-- integration.
--
-- @include users.xml
--
-- @include awa-users-services.ads
--
-- @include users.xml
--
-- == Model ==
-- [http://ada-awa.googlecode.com/svn/wiki/awa_user_model.png]
--
-- @include User.hbm.xml
package AWA.Users.Modules is
NAME : constant String := "users";
type User_Module is new AWA.Modules.Module with private;
type User_Module_Access is access all User_Module'Class;
-- Initialize the user module.
overriding
procedure Initialize (Plugin : in out User_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Get the user manager.
function Get_User_Manager (Plugin : in User_Module) return Services.User_Service_Access;
-- Create a user manager. This operation can be overriden to provide another
-- user service implementation.
function Create_User_Manager (Plugin : in User_Module) return Services.User_Service_Access;
-- Get the user module instance associated with the current application.
function Get_User_Module return User_Module_Access;
-- Get the user manager instance associated with the current application.
function Get_User_Manager return Services.User_Service_Access;
private
type User_Module is new AWA.Modules.Module with record
Manager : Services.User_Service_Access := null;
Key_Filter : aliased AWA.Users.Filters.Verify_Filter;
Auth_Filter : aliased AWA.Users.Filters.Auth_Filter;
Auth : aliased AWA.Users.Servlets.Request_Auth_Servlet;
Verify_Auth : aliased AWA.Users.Servlets.Verify_Auth_Servlet;
end record;
end AWA.Users.Modules;
|
src/core/asm/arm/thumb/inst_0x80.asm | Hiroshi123/bin_tools | 0 | 25961 |
;;; load/store halfword immediate
;;; 1 0 0 0
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_71_172.asm | ljhsiun2/medusa | 9 | 88978 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r9
push %rbp
push %rbx
push %rcx
push %rdx
push %rsi
// Store
mov $0x2a6b44000000097c, %rdx
nop
nop
nop
nop
nop
sub $36420, %rbx
movl $0x51525354, (%rdx)
nop
nop
nop
nop
nop
add $33342, %r9
// Store
lea addresses_D+0x7e8c, %r9
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%r9)
nop
and $55488, %rbx
// Faulty Load
lea addresses_normal+0x64c4, %rbp
nop
nop
nop
cmp $19229, %rbx
movb (%rbp), %dl
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r9
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'34': 71}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Working Disassembly/Levels/FBZ/Misc Object Data/Map - Exit Door.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 91165 | <filename>Working Disassembly/Levels/FBZ/Misc Object Data/Map - Exit Door.asm
Map_70F7E: dc.w word_70F80-Map_70F7E
word_70F80: dc.w 3
dc.b $E0, 2, 8, 0, $FF, $F8
dc.b $F8, 5, 8, 3, $FF, $F8
dc.b 8, 2, $18, 0, $FF, $F8
|
src/main/antlr4/com/dyuproject/jetg/parser/JetTemplateLexer.g4 | fbsgen/jetg | 1 | 2493 | /**
* jetg
* Copyright 2015-2016 <NAME>
*
* Copyright 2010-2013 <NAME>. All rights reserved.
* Email: <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
lexer grammar JetTemplateLexer;
/*
@header {
package com.dyuproject.jetg.parser;
}
*/
// *******************************************************************
// ------- DEFAULT mode for Plain Text -------------------------------
COMMENT_LINE : '##' ~[\r\n]* NEWLINE -> skip ;
COMMENT_BLOCK : '#--' .*? '--#' -> skip ;
fragment NEWLINE : ('\r'? '\n' | EOF) ;
TEXT_PLAIN : ~('«'|'»'|'#'|'\\'|'\n')+ ;
VALUE_CLOSE : '»' ;
TEXT_NEWLINE : [\r]?[\n] ;
TEXT_CDATA : '#[[' .*? ']]#' ;
TEXT_ESCAPED_CHAR : ('\\#'|'\\«'|'\\»'|'\\\\') ;
TEXT_ESCAPED_NEWLINE : '\\n' ;
TEXT_SINGLE_BACKSLASH : '\\' ;
TEXT_SINGLE_HASH : '#' ;
// doT style conditionals
V_ELSE : '«else»' ;
V_ENDIF : '«endif»' ;
V_ENDFOR : '«endfor»' ;
V_EMIT : '«#emit»' ;
V_END : '«#»' ;
V_ELSEIF : '«elseif(' -> pushMode(INSIDE) ;
V_IF : '«if(' -> pushMode(INSIDE) ;
V_FOR : '«for(' -> pushMode(INSIDE) ;
VALUE_ESCAPED_OPEN : '«;' -> pushMode(INSIDE) ;
VALUE_OPEN : '«' -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_IF : '#if' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_ELSEIF : '#elseif' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_FOR : '#for' ARGUMENT_START -> pushMode(INSIDE) ;
// controls
DIRECTIVE_OPEN_BREAK : '#break' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_CONTINUE : '#continue' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_STOP : '#stop' ARGUMENT_START -> pushMode(INSIDE) ;
// context dependent
DIRECTIVE_OPEN_DEFINE : '#define' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_SET : '#set' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_PUT : '#put' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_INCLUDE : '#include' ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_CALL : '#call' [ \t]+ ID ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_TAG : '#tag' [ \t]+ ID ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_MACRO : '#macro' [ \t]+ ID ARGUMENT_START -> pushMode(INSIDE) ;
DIRECTIVE_OPEN_PROC : '#' ID ARGUMENT_START -> pushMode(INSIDE) ;
fragment ID : [_a-zA-Z$][_a-zA-Z$0-9]* ;
fragment ARGUMENT_START : [ \t]* '(' ;
DIRECTIVE_IF : '#if' ;
DIRECTIVE_ELSEIF : '#elseif' ;
DIRECTIVE_FOR : '#for' ;
DIRECTIVE_BREAK : '#break' ;
DIRECTIVE_CONTINUE : '#continue' ;
DIRECTIVE_STOP : '#stop' ;
DIRECTIVE_ELSE : '#else' '()'? ;
DIRECTIVE_END : '#end' '()'? ;
DIRECTIVE_ENDIF : '#endif' '()'? ;
DIRECTIVE_ENDFOR : '#endfor' '()'? ;
// context dependent
DIRECTIVE_DEFINE : '#define' ;
DIRECTIVE_SET : '#set' ;
DIRECTIVE_PUT : '#put' ;
DIRECTIVE_INCLUDE : '#include' ;
DIRECTIVE_CALL : '#call' ;
DIRECTIVE_TAG : '#tag' ;
DIRECTIVE_MACRO : '#macro' ;
// It is a text which like a directive.
// It must be put after directive defination to avoid confliction.
TEXT_DIRECTIVE_LIKE : '#' [a-zA-Z0-9]+ ;
// option mode
mode OPTIONS;
O_WS : [ \t\r\n]+ -> skip ;
O_KEY : ID ;
O_ASSIGN : '=' -> type(OP_ASSIGN), popMode ;
// *******************************************************************
// -------- INSIDE mode for directive --------------------------------
mode INSIDE;
V_CLOSE : '»' -> type(VALUE_CLOSE), popMode ;
V_OPEN : '«' -> type(VALUE_OPEN), popMode;
WHITESPACE : [ \t\r\n]+ -> skip ;
SEMI_COLON : ';' -> pushMode(OPTIONS);
LEFT_PAREN : '(' -> pushMode(INSIDE) ;
RETURN_TYPE_START : ')::' -> popMode ;
BLOCK_IGNORE_NEWLINE : ')%%' -> popMode ;
RIGHT_PAREN : ')' -> popMode ;
LEFT_BRACKET : '[' ;
RIGHT_BRACKET : ']' ;
LEFT_BRACE : '{' -> pushMode(INSIDE) ;
RIGHT_BRACE : '}' -> popMode ;
OP_ASSIGN : '=' ;
OP_DOT_INVOCATION : '.' ;
OP_DOT_INVOCATION_SAFE : '?.' ;
OP_EQUALITY_EQ : '==' ;
OP_EQUALITY_NE : '!=' ;
OP_RELATIONAL_GT : '>' ;
OP_RELATIONAL_LT : '<' ;
OP_RELATIONAL_GE : '>=' ;
OP_RELATIONAL_LE : '<=' ;
OP_CONDITIONAL_AND : '&&' ;
OP_CONDITIONAL_OR : '||' ;
OP_CONDITIONAL_NOT : '!' ;
OP_MATH_PLUS : '+' ;
OP_MATH_MINUS : '-' ;
OP_MATH_MULTIPLICATION : '*' ;
OP_MATH_DIVISION : '/' ;
OP_MATH_REMAINDER : '%' ;
OP_MATH_INCREMENT : '++' ;
OP_MATH_DECREMENT : '--' ;
OP_BITWISE_AND : '&' ;
OP_BITWISE_OR : '|' ;
OP_BITWISE_NOT : '~' ;
OP_BITWISE_XOR : '^' ;
OP_BITWISE_SHL : '<<' ;
// Following operators are conflict with Java Generic Type definition.
// Sample: List<List<String>>
//OP_BITWISE_SHR : '>>' ;
//OP_BITWISE_SHR_2 : '>>>' ;
OP_INSTANCEOF : 'instanceof' | 'is' ;
OP_NEW : 'new' ;
OP_CONDITIONAL_TERNARY : '?' ;
COMMA : ',' ;
COLON : ':' ;
AT : '@' ;
KEYWORD_TRUE : 'true' ;
KEYWORD_FALSE : 'false' ;
KEYWORD_NULL : 'null' ;
IMPORT_REF : ID '::' ;
IDENTIFIER : ID ;
INTEGER : INT [lLfFdD]? ;
INTEGER_HEX : '0x' HEX+ [lL]? ;
FLOATING_POINT : INT ('.' FRAC)? EXP? [fFdD]? ;
fragment INT : '0' | [1-9] [0-9]* ;
fragment FRAC : [0-9]+ ;
fragment EXP : [Ee] [+\-]? INT ;
STRING_DOUBLE : '"' (ESC|OTHERS)*? '"' ;
STRING_SINGLE : '\'' (ESC|OTHERS)*? '\'' ;
fragment OTHERS : ~('\\' | '\r' | '\n') ;
fragment ESC : '\\' ([btnfr"'\\]|UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
|
dora-engine/movie-play-mac.scpt | TachibanaET/dora-scheduler | 6 | 1770 | <gh_stars>1-10
#!/usr/bin/osascript
on run argv
set unixFile to item 1 of argv
set macFile to POSIX file unixFile
set fileRef to (macFile as alias)
tell application "QuickTime Player"
activate
open fileRef
-- present front document
play front document
delay 3
try
repeat until not (playing of front document)
delay 1
end repeat
on error error_quit
end try
close front document
end tell
end run
|
audit/monitor-routines.asm | zellyn/a2audit | 22 | 15781 | <gh_stars>10-100
!zone monitor {
.LOC0 = $00
.LOC1 = $01
.WNDLFT = $20
.WNDWDTH = $21
.WNDTOP = $22
.WNDBTM = $23
.CH = $24
.CV = $25
.GBASL = $26
.GBASH = $27
.BASL = $28
.BASH = $29
.BAS2L = $2A
.BAS2H = $2B
.V2 = $2D
.MASK = $2E
.COLOR = $30
.INVFLG = $32
.YSAV1 = $35
.CSWL = $36
.CSWH = $37
.KSWL = $38
.KSWH = $39
.A2L = $3E
.STATUS = $48
.RNDL = $4E
.RNDH = $4F
.IOADR = $C000
.KBD = $C000
.KBDSTRB = $C010
.SPKR = $C030
.LORES = $C056
.LOWSCR = $C054
.TXTSET = $C051
.TXTCLR = $C050
.MIXSET = $C053
.PLOT LSR ;Y-COORD/2
PHP ;SAVE LSB IN CARRY
JSR .GBASCALC ;CALC BASE ADR IN GBASL,H
PLP ;RESTORE LSB FROM CARRY
LDA #$0F ;MASK $0F IF EVEN
BCC .RTMASK
ADC #$E0 ;MASK $F0 IF ODD
.RTMASK STA .MASK
.PLOT1 LDA (.GBASL),Y ;DATA
EOR .COLOR ; EOR COLOR
AND .MASK ; AND MASK
EOR (.GBASL),Y ; EOR DATA
STA (.GBASL),Y ; TO DATA
RTS
.VLINEZ ADC #$01 ;NEXT Y-COORD
.VLINE PHA ; SAVE ON STACK
JSR .PLOT ; PLOT SQUARE
PLA
CMP .V2 ;DONE?
BCC .VLINEZ ; NO, LOOP
.RTS1 RTS
.CLRSCR LDY #$2F ;MAX Y, FULL SCRN CLR
BNE .CLRSC2 ;ALWAYS TAKEN
.CLRTOP LDY #$27 ;MAX Y, TOP SCREEN CLR
.CLRSC2 STY .V2 ;STORE AS BOTTOM COORD
; FOR VLINE CALLS
LDY #$27 ;RIGHTMOST X-COORD (COLUMN)
.CLRSC3 LDA #$00 ;TOP COORD FOR VLINE CALLS
STA .COLOR ;CLEAR COLOR (BLACK)
JSR .VLINE ;DRAW VLINE
DEY ;NEXT LEFTMOST X-COORD
BPL .CLRSC3 ;LOOP UNTIL DONE
RTS
.GBASCALC PHA ;FOR INPUT 000DEFGH
LSR
AND #$03
ORA #$04 ; GENERATE GBASH=000001FG
STA .GBASH
PLA ; AND GBASL=HDEDE000
AND #$18
BCC .GBCALC
ADC #$7F
.GBCALC STA .GBASL
ASL
ASL
ORA .GBASL
STA .GBASL
RTS
PRNTYX TYA
.PRNTAX JSR PRBYTE ;OUTPUT TARGET ADR
.PRNTX TXA ; OF BRANCH AND RETURN
JMP PRBYTE
.INIT LDA #$00 ;CLR STATUS FOR DEBUG
STA .STATUS ; SOFTWARE
LDA .LORES
LDA .LOWSCR ;INIT VIDEO MODE
.SETTXT LDA .TXTSET ;SET FOR TEXT MODE
LDA #$00 ; FULL SCREEN WINDOW
BEQ .SETWND
.SETGR LDA .TXTCLR ;SET FOR GRAPHICS MODE
LDA .MIXSET ; LOWER 4 LINES AS
JSR .CLRTOP ; TEXT WINDOW
LDA #$14
.SETWND STA .WNDTOP ;SET FOR 40 COL WINDOW
LDA #$00 ; TOP IN A-REG,
STA .WNDLFT ; BTTM AT LINE 24
LDA #$28
STA .WNDWDTH
LDA #$18
STA .WNDBTM ; VTAB TO ROW 23
LDA #$17
.TABV STA .CV ;VTABS TO ROW IN A-REG
JMP .VTAB
.BASCALC PHA ;CALC BASE ADR IN BASL,H
LSR ; FOR GIVEN LINE NO
AND #$03 ; 0<=LINE NO.<=$17
ORA #$04 ;ARG=000ABCDE, GENERATE
STA .BASH ; BASH=000001CD
PLA ; AND
AND #$18 ; BASL=EABAB000
BCC .BSCLC2
ADC #$7F
.BSCLC2 STA .BASL
ASL
ASL
ORA .BASL
STA .BASL
RTS
.BELL1 CMP #$87 ;BELL CHAR? (CNTRL-G)
BNE .RTS2B ; NO, RETURN
LDA #$40 ;DELAY .01 SECONDS
JSR .WAIT
LDY #$C0
.BELL2 LDA #$0C ;TOGGLE SPEAKER AT
JSR .WAIT ; 1 KHZ FOR .1 SEC.
LDA .SPKR
DEY
BNE .BELL2
.RTS2B RTS
.STOADV LDY .CH ;CURSOR H INDEX TO Y-REG
STA (.BASL),Y ;STORE CHAR IN LINE
.ADVANCE INC .CH ;INCREMENT CURSOR H INDEX
LDA .CH ; (MOVE RIGHT)
CMP .WNDWDTH ;BEYOND WINDOW WIDTH?
BCS .CR ; YES CR TO NEXT LINE
.RTS3 RTS ; NO,RETURN
.VIDOUT CMP #$A0 ;CONTROL CHAR?
BCS .STOADV ; NO,OUTPUT IT.
TAY ;INVERSE VIDEO?
BPL .STOADV ; YES, OUTPUT IT.
CMP #$8D ;CR?
BEQ .CR ; YES.
CMP #$8A ;LINE FEED?
BEQ .LF ; IF SO, DO IT.
CMP #$88 ;BACK SPACE? (CNTRL-H)
BNE .BELL1 ; NO, CHECK FOR BELL.
.BS DEC .CH ;DECREMENT CURSOR H INDEX
BPL .RTS3 ;IF POS, OK. ELSE MOVE UP
LDA .WNDWDTH ;SET CH TO WNDWDTH-1
STA .CH
DEC .CH ;(RIGHTMOST SCREEN POS)
.UP LDA .WNDTOP ;CURSOR V INDEX
CMP .CV
BCS .RTS4 ;IF TOP LINE THEN RETURN
DEC .CV ;DEC CURSOR V-INDEX
.VTAB LDA .CV ;GET CURSOR V-INDEX
.VTABZ JSR .BASCALC ;GENERATE BASE ADR
ADC .WNDLFT ;ADD WINDOW LEFT INDEX
STA .BASL ;TO BASL
.RTS4 RTS
.CLEOP1 PHA ;SAVE CURRENT LINE ON STK
JSR .VTABZ ;CALC BASE ADDRESS
JSR .CLEOLZ ;CLEAR TO EOL, SET CARRY
LDY #$00 ;CLEAR FROM H INDEX=0 FOR REST
PLA ;INCREMENT CURRENT LINE
ADC #$00 ;(CARRY IS SET)
CMP .WNDBTM ;DONE TO BOTTOM OF WINDOW?
BCC .CLEOP1 ; NO, KEEP CLEARING LINES
BCS .VTAB ; YES, TAB TO CURRENT LINE
HOME LDA .WNDTOP ;INIT CURSOR V
STA .CV ; AND H-INDICES
LDY #$00
STY .CH ;THEN CLEAR TO END OF PAGE
BEQ .CLEOP1
.CR LDA #$00 ;CURSOR TO LEFT OF INDEX
STA .CH ;(RET CURSOR H=0)
.LF INC .CV ;INCR CURSOR V(DOWN 1 LINE)
LDA .CV
CMP .WNDBTM ;OFF SCREEN?
BCC .VTABZ ; NO, SET BASE ADDR
DEC .CV ;DECR CURSOR V (BACK TO BOTTOM)
.SCROLL LDA .WNDTOP ;START AT TOP OF SCRL WNDW
PHA
JSR .VTABZ ;GENERATE BASE ADR
.SCRL1 LDA .BASL ;COPY BASL,H
STA .BAS2L ; TO BAS2L,H
LDA .BASH
STA .BAS2H
LDY .WNDWDTH ;INIT Y TO RIGHTMOST INDEX
DEY ; OF SCROLLING WINDOW
PLA
ADC #$01 ;INCR LINE NUMBER
CMP .WNDBTM ;DONE?
BCS .SCRL3 ; YES, FINISH
PHA
JSR .VTABZ ;FORM BASL,H (BASE ADDR)
.SCRL2 LDA (.BASL),Y ;MOVE A CHR UP ON LINE
STA (.BAS2L),Y
DEY ;NEXT CHAR OF LINE
BPL .SCRL2
BMI .SCRL1 ;NEXT LINE (ALWAYS TAKEN)
.SCRL3 LDY #$00 ;CLEAR BOTTOM LINE
JSR .CLEOLZ ;GET BASE ADDR FOR BOTTOM LINE
BCS .VTAB ;CARRY IS SET
.CLREOL LDY .CH ;CURSOR H INDEX
.CLEOLZ LDA #$A0
.CLEOL2 STA (.BASL),Y ;STORE BLANKS FROM 'HERE'
INY ; TO END OF LINES (WNDWDTH)
CPY .WNDWDTH
BCC .CLEOL2
RTS
.WAIT SEC
.WAIT2 PHA
.WAIT3 SBC #$01
BNE .WAIT3 ;1.0204 USEC
PLA ;(13+27/2*A+5/2*A*A)
SBC #$01
BNE .WAIT2
RTS
KEYIN INC .RNDL
BNE .KEYIN2 ;INCR RND NUMBER
INC .RNDH
.KEYIN2 BIT .KBD ;KEY DOWN?
BPL KEYIN ; LOOP
STA (.BASL),Y ;REPLACE FLASHING SCREEN
LDA .KBD ;GET KEYCODE
BIT .KBDSTRB ;CLR KEY STROBE
RTS
CROUT LDA #$8D
BNE COUT
PRBYTE PHA ;PRINT BYTE AS 2 HEX
LSR ; DIGITS, DESTROYS A-REG
LSR
LSR
LSR
JSR .PRHEXZ
PLA
.PRHEX AND #$0F ;PRINT HEX DIG IN A-REG
.PRHEXZ ORA #$B0 ; LSB'S
CMP #$BA
BCC COUT
ADC #$06
COUT JMP (.CSWL) ;VECTOR TO USER OUTPUT ROUTINE
COUT1 CMP #$A0
BCC .COUTZ ;DON'T OUTPUT CTRL'S INVERSE
AND .INVFLG ;MASK WITH INVERSE FLAG
.COUTZ STY .YSAV1 ;SAV Y-REG
PHA ;SAV A-REG
JSR .VIDOUT ;OUTPUT A-REG AS ASCII
PLA ;RESTORE A-REG
LDY .YSAV1 ; AND Y-REG
RTS ; THEN RETURN
.SETNORM LDY #$FF ;SET FOR NORMAL VID
.SETIFLG STY .INVFLG
RTS
.SETKBD LDA #$00 ;SIMULATE PORT #0 INPUT
.INPORT STA .A2L ; SPECIFIED (KEYIN ROUTINE)
.INPRT LDX #.KSWL
LDY #<KEYIN
BNE .IOPRT
.SETVID LDA #$00 ;SIMULATE PORT #0 OUTPUT
.OUTPORT STA .A2L ; SPECIFIED (COUT1 ROUTINE)
.OUTPRT LDX #.CSWL
LDY #<COUT1
.IOPRT LDA .A2L ;SET RAM IN/OUT VECTORS
AND #$0F
BEQ .IOPRT1
ORA #>.IOADR
LDY #$00
BEQ .IOPRT2
.IOPRT1 LDA #>COUT1
.IOPRT2 STY .LOC0,X
STA .LOC1,X
RTS
RESET JSR .SETNORM ;SET SCREEN MODE
JSR .INIT ; AND INIT KBD/SCREEN
JSR .SETVID ; AS I/O DEV'S
JSR .SETKBD
CLD ;MUST SET HEX MODE!
RTS
} ; monitor
|
unittests/ASM/SelfModifyingCode/DifferentBlock.asm | cobalt2727/FEX | 628 | 175775 | <gh_stars>100-1000
%ifdef CONFIG
{
"Match": "All",
"RegData": {
"RAX": "0x20"
}
}
%endif
jmp main
patched_op:
mov rax,-1
ret
main:
; warm up the cache
call patched_op
mov byte [rel patched_op], 0xC3
mov rax, 32
call patched_op
hlt |
source/web/spikedog/daemon/servlet-application.ads | svn2github/matreshka | 24 | 6462 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2017, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
with Servlet.Contexts;
with Servlet.Context_Listeners;
package Servlet.Application is
procedure Initialize
(Application_Name : League.Strings.Universal_String;
Application_Version : League.Strings.Universal_String;
Organization_Name : League.Strings.Universal_String;
Organization_Domain : League.Strings.Universal_String);
-- Initialize servlet container. It detects run of application under
-- FastCGI environment and use it when possible, or fallback to start as
-- standalone AWS server when it supports was enabled at build time.
procedure Execute;
procedure Finalize;
procedure Add_Listener
(Listener : not null
Servlet.Context_Listeners.Servlet_Context_Listener_Access);
-- Adds Servlet_Context_Listener. Context_Initialized subprogram of this
-- interface will be called during execution of Initialize subprogram; and
-- Context_Destoyed subprogram will be called during execution of Finalize
-- subprogram.
function Get_Servlet_Context return
not null Servlet.Contexts.Servlet_Context_Access;
-- Returns servlet context of the initialized servlet container.
-- Application should use this context to add and configure servlets and
-- filters.
end Servlet.Application;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34006g.ada | best08618/asylo | 7 | 23056 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34006g.ada
-- C34006G.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE REQUIRED PREDEFINED OPERATIONS ARE DECLARED
-- (IMPLICITLY) FOR DERIVED RECORD TYPES WITHOUT DISCRIMINANTS AND
-- WITH A LIMITED COMPONENT TYPE.
-- HISTORY:
-- JRK 08/24/87 CREATED ORIGINAL TEST.
-- PWN 11/30/94 REMOVED 'BASE USE ILLEGAL IN ADA 9X.
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH SYSTEM; USE SYSTEM;
WITH REPORT; USE REPORT;
PROCEDURE C34006G IS
PACKAGE PKG_L IS
TYPE LP IS LIMITED PRIVATE;
FUNCTION CREATE (X : INTEGER) RETURN LP;
FUNCTION EQUAL (X, Y : LP) RETURN BOOLEAN;
PROCEDURE ASSIGN (X : OUT LP; Y : LP);
C1 : CONSTANT LP;
PRIVATE
TYPE LP IS NEW INTEGER;
C1 : CONSTANT LP := 1;
END PKG_L;
USE PKG_L;
SUBTYPE COMPONENT IS LP;
PACKAGE PKG_P IS
TYPE PARENT IS
RECORD
C : COMPONENT;
B : BOOLEAN := TRUE;
END RECORD;
FUNCTION EQUAL (X, Y : PARENT) RETURN BOOLEAN;
FUNCTION AGGR (C : COMPONENT; B : BOOLEAN) RETURN PARENT;
END PKG_P;
USE PKG_P;
TYPE T IS NEW PARENT;
X : T;
W : PARENT;
B : BOOLEAN := FALSE;
PROCEDURE A (X : ADDRESS) IS
BEGIN
B := IDENT_BOOL (TRUE);
END A;
PACKAGE BODY PKG_L IS
FUNCTION CREATE (X : INTEGER) RETURN LP IS
BEGIN
RETURN LP (IDENT_INT (X));
END CREATE;
FUNCTION EQUAL (X, Y : LP) RETURN BOOLEAN IS
BEGIN
RETURN X = Y;
END EQUAL;
PROCEDURE ASSIGN (X : OUT LP; Y : LP) IS
BEGIN
X := Y;
END ASSIGN;
END PKG_L;
PACKAGE BODY PKG_P IS
FUNCTION EQUAL (X, Y : PARENT) RETURN BOOLEAN IS
BEGIN
RETURN EQUAL (X.C, Y.C) AND X.B = Y.B;
END EQUAL;
FUNCTION AGGR (C : COMPONENT; B : BOOLEAN) RETURN PARENT IS
RESULT : PARENT;
BEGIN
ASSIGN (RESULT.C, C);
RESULT.B := B;
RETURN RESULT;
END AGGR;
END PKG_P;
BEGIN
TEST ("C34006G", "CHECK THAT THE REQUIRED PREDEFINED OPERATIONS " &
"ARE DECLARED (IMPLICITLY) FOR DERIVED " &
"RECORD TYPES WITHOUT DISCRIMINANTS AND WITH A " &
"LIMITED COMPONENT TYPE");
ASSIGN (X.C, CREATE (1));
X.B := IDENT_BOOL (TRUE);
ASSIGN (W.C, CREATE (1));
W.B := IDENT_BOOL (TRUE);
IF NOT EQUAL (T'(X), AGGR (C1, TRUE)) THEN
FAILED ("INCORRECT QUALIFICATION");
END IF;
IF NOT EQUAL (T (X), AGGR (C1, TRUE)) THEN
FAILED ("INCORRECT SELF CONVERSION");
END IF;
IF NOT EQUAL (T (W), AGGR (C1, TRUE)) THEN
FAILED ("INCORRECT CONVERSION FROM PARENT");
END IF;
IF NOT EQUAL (PARENT (X), AGGR (C1, TRUE)) THEN
FAILED ("INCORRECT CONVERSION TO PARENT");
END IF;
IF NOT EQUAL (X.C, C1) OR X.B /= TRUE THEN
FAILED ("INCORRECT SELECTION (VALUE)");
END IF;
X.B := IDENT_BOOL (FALSE);
IF NOT EQUAL (X, AGGR (C1, FALSE)) THEN
FAILED ("INCORRECT SELECTION (ASSIGNMENT)");
END IF;
X.B := IDENT_BOOL (TRUE);
IF NOT (X IN T) THEN
FAILED ("INCORRECT ""IN""");
END IF;
IF X NOT IN T THEN
FAILED ("INCORRECT ""NOT IN""");
END IF;
B := FALSE;
A (X'ADDRESS);
IF NOT B THEN
FAILED ("INCORRECT 'ADDRESS");
END IF;
IF X.C'FIRST_BIT < 0 THEN
FAILED ("INCORRECT 'FIRST_BIT");
END IF;
IF X.C'LAST_BIT < 0 OR
X.C'LAST_BIT - X.C'FIRST_BIT + 1 /= X.C'SIZE THEN
FAILED ("INCORRECT 'LAST_BIT");
END IF;
IF X.C'POSITION < 0 THEN
FAILED ("INCORRECT 'POSITION");
END IF;
IF X'SIZE < T'SIZE OR
X.C'SIZE < COMPONENT'SIZE OR
X.B'SIZE < BOOLEAN'SIZE THEN
FAILED ("INCORRECT OBJECT'SIZE");
END IF;
RESULT;
END C34006G;
|
programs/oeis/128/A128800.asm | neoneye/loda | 22 | 6141 | <reponame>neoneye/loda<gh_stars>10-100
; A128800: n*(n-1)*6^n.
; 0,0,72,1296,15552,155520,1399680,11757312,94058496,725594112,5441955840,39907676160,287335268352,2037468266496,14262277865472,98738846760960,677066377789440,4604051368968192,31077346740535296,208401031083589632,1389340207223930880,9213519268958699520,60809227175127416832,399603492865123024896,2615586498753532526592,17058172817957820825600,110878123316725835366400,718490239092383413174272,4642552314135400515895296,29918670468872581102436352,192334310157038021372805120,1233592472041692137080750080,7894991821066829677316800512,50426076792620396003507306496,321466239552955024522359078912,2045694251700622883324103229440,12996175246098074788176655810560,82432882989536360085006216855552,522074925600396947205039373418496,3301771151094402314756194956214272,20853291480596225145828599723458560,131536146262222343227534244409507840,828677721452000762333465739779899392
mov $2,6
pow $2,$0
bin $0,2
mul $0,$2
mul $0,2
|
src/args.asm | cmounce/all-purpose-tsr | 0 | 11187 | <reponame>cmounce/all-purpose-tsr
;; Code for parsing command-line arguments
%include 'macros.asm'
%include 'print.asm'
%include 'string.asm'
;-------------------------------------------------------------------------------
; Consts
;-------------------------------------------------------------------------------
; The command-line string in the PSP.
arg_string_length equ 80h
arg_string_contents equ 81h
;-------------------------------------------------------------------------------
; Strings
;-------------------------------------------------------------------------------
section .data
; Define a list of all the subcommand strings, with a named label for each one.
; These labels are used like enum values, allowing storage in registers and
; convenient comparisons: e.g., does AX == subcommands.install?
%macro db_subcommand 1
%deftok %%t %1
.%[%%t]:
db_wstring %1
%endmacro
subcommands:
; Each subcommand begins with a different letter, in order to allow the
; user to make single-character abbreviations (e.g., "foo i" to install).
db_subcommand "about"
db_subcommand "install"
db_subcommand "new"
db_subcommand "preview"
db_subcommand "reset"
db_subcommand "uninstall"
dw 0 ; end of list
; Define some boolean flags
arg_flags:
.help: db_wstring "/?"
; Define some key-value options
arg_options:
.blink: db_wstring "/b"
.font: db_wstring "/f"
.font2: db_wstring "/f2"
.output: db_wstring "/o"
.palette: db_wstring "/p"
; Non-filename values for certain options
arg_option_values:
; Blink value
.off: db_wstring "off"
.on: db_wstring "on"
;-------------------------------------------------------------------------------
; Parsed data
;-------------------------------------------------------------------------------
section .bss
; String list representing the tokenized argument string.
; How much space do we need? We could have up to 127 tokens, each token taking
; up three bytes (2 byte string header, 1 byte content). Additionally, the list
; itself is terminated with an empty string (2 byte header, no content).
MAX_TOKENS equ 127 ; Worst case: arg string is nothing but forward-slashes
arg_tokens:
resb MAX_TOKENS * 3 + 2
; Pointer to a wstring from the subcommands list, e.g., subcommands.install
parsed_subcommand:
resw 1
; Booleans representing flags that are present/absent
parsed_flags:
.help: resb 1
; Pointers to wstrings representing option values
parsed_options:
.blink: resw 1
.font: resw 1
.font2: resw 1
.output: resw 1
.palette: resw 1
;-------------------------------------------------------------------------------
; Code
;-------------------------------------------------------------------------------
section .text
; Read command line flags and initialize status variables accordingly.
;
; This is the main subroutine for parsing the command line, from start to
; end. It takes no parameters and returns nothing: it just mutates the global
; variables to match what the command line args specify.
parse_command_line:
push si
; Set up SI = start of token list
call tokenize_arg_string ; arg_tokens = string list of tokens
mov si, arg_tokens ; SI = first token
; Parse first word as a subcommand, if it exists
call parse_subcommand
; Consume all remaining arguments
while_condition
cmp word [si], 0
begin_while ne
call parse_argument
begin_if c
die EXIT_BAD_ARGS, "Unknown argument: %s", si
end_if
end_while
pop si
ret
;-------------------------------------------------------------------------------
; Internal helpers: tokenization
;-------------------------------------------------------------------------------
; Tokenize the PSP argument string and store the result in arg_tokens.
tokenize_arg_string:
push bx
push di
push si
; Set up all our pointers
mov si, arg_string_contents ; SI = argument string to read from
mov bl, [arg_string_length] ; BL = number of characters in string
mov di, arg_tokens ; DI = token list to write to
; Loop over each char in the arg string
while_condition
cmp bl, 0 ; Loop while we have characters remaining
begin_while ne
; Read next character into AL
lodsb
dec bl
; Whitespace and '=' are never included in tokens.
; If we see these, skip the character and start a new token.
call is_token_separator
begin_if e
call .flush_current_token
jmp continue
end_if
; Forward slashes always indicate the start of a new token.
cmp al, '/'
begin_if e
call .flush_current_token
end_if
; Append the character to the current token in DI.
call concat_byte_wstring
end_while
; Terminate the list if it isn't terminated already
call .flush_current_token
pop si
pop di
pop bx
ret
; Helper: Make DI point to an empty string at the end of the token list.
; This is a no-op if DI already points to an empty string.
.flush_current_token:
cmp word [di], 0
begin_if ne
next_wstring di ; Advance DI to point after current contents
mov word [di], 0 ; Write length header for empty string
end_if
ret
; Sets ZF if the character in AL is a token separator.
;
; Token separators are spaces, tabs, and any other ASCII control characters.
; Additionally, '=' is counted as a separator character: this is so that
; arguments like "/foo=bar" are separated into two tokens.
;
; Clobbers no registers!
is_token_separator:
cmp al, ' ' ; Is it an ASCII control character or a space?
jbe .true
cmp al, '=' ; Is it a '='?
ret
.true:
cmp al, al
ret
;-------------------------------------------------------------------------------
; Internal helpers: recursive-descent parsing
;-------------------------------------------------------------------------------
; Tries to consume the token in SI as a subcommand.
;
; On success: sets parsed_subcommand and consumes the token, advancing SI.
; On failure: leaves parsed_subcommand untouched (should be zero).
parse_subcommand:
push di
mov di, subcommands ; Loop DI = each possible subcommand
while_condition
cmp word [di], 0 ; Break if we run out of subcommands
begin_while ne
call icmp_wstring ; If SI == DI, this is a full subcommand.
je .found
call icmp_short_subcommand ; If the first letters of SI and DI match,
je .found ; this is an abbreviated subcommand.
next_wstring di ; Otherwise, advance DI to the next one.
end_while
; No matches for subcommand found
jmp .ret
.found:
mov [parsed_subcommand], di ; SI is a valid subcommand. Record it and
next_wstring si ; advance to the next token.
.ret:
pop di
ret
; Returns whether SI is a one-character abbreviation of the string in DI.
;
; Examples: "i" or "I" would match "install", but "x" or "inst" would not.
; Sets ZF if there's a match.
icmp_short_subcommand:
cmp word [si], 1 ; Is the input string one character long?
jne .ret
mov al, [si + 2] ; Get the only character of SI
call tolower_accumulator
mov ah, al
mov al, [di + 2] ; Get first character of DI
call tolower_accumulator
cmp ah, al ; Do a case-insensitive comparison
.ret:
ret
; Tries to consume 1-2 tokens from SI as a single argument.
;
; 1-token args are boolean flags, e.g., "/?".
; 2-token args are key-value options, e.g., "/foo=bar" or "/foo bar".
; Sets CF on failure.
parse_argument:
; Try to parse SI as a 1-token flag
call parse_flag
begin_if nc
ret ; Success: forward CF = 0
end_if
; Try to parse SI as the start of a key-value option
call parse_option
begin_if nc
ret ; Success: forward CF = 0
end_if
stc ; Failed to parse anything
ret
; Tries to consume a 1-token boolean flag from SI, e.g., "/?".
;
; Sets CF on failure.
parse_flag:
push di
; Compare SI against each of the flag strings
mov di, arg_flags.help
call icmp_wstring
begin_if e
mov byte [parsed_flags.help], 1
else
stc ; Error: flag not recognized
jmp .ret
end_if
; Found a match: consume the matched token and return success
next_wstring si
clc
.ret:
pop di
ret
; Tries to consume a 2-token option from SI, e.g., "/foo=bar"
;
; Sets CF on failure.
parse_option:
push bx
push di
; Set SI = option key, BX = option value
cmp word [si], 0
je .failure ; Not enough tokens (0)
mov bx, si
next_wstring bx
cmp word [bx], 0
je .failure ; Not enough tokens (1)
; Compare SI against each of the option strings
mov di, arg_options.blink
call icmp_wstring
begin_if e
mov [parsed_options.blink], bx
else
mov di, arg_options.font
call icmp_wstring
if e
mov [parsed_options.font], bx
else
mov di, arg_options.font2
call icmp_wstring
if e
mov [parsed_options.font2], bx
else
mov di, arg_options.output
call icmp_wstring
if e
mov [parsed_options.output], bx
else
mov di, arg_options.palette
call icmp_wstring
if e
mov [parsed_options.palette], bx
else
jmp .failure
end_if
; We found a match: consume both key and value tokens
mov si, bx ; SI = value token
next_wstring si ; SI = token following value token
clc ; Return success
.ret:
pop di
pop bx
ret
.failure:
stc
jmp .ret
|
klc3-manual/examples/zjui_ece220_fa20/mp1/print_centered/examples/mp1_buggy_print_centered.asm | liuzikai/klc3 | 0 | 162436 | ; Based on Zikai's mp1 FA20.
; Revised to trigger some issues.
; ================================ KLC3 ENTRY CODE ================================
; This piece of code serves as the entry point to your PRINT_CENTERED subroutine.
; The test string is stored at x2700, whose address is loaded into R1 before calling your subroutine.
.ORIG x3000
LD R1, KLC3_TEST_STRING_ADDR
JSR PRINT_CENTERED
HALT ; KLC3: INSTANT_HALT
KLC3_TEST_STRING_ADDR .FILL x2700
; ============================= END OF KLC3 ENTRY CODE ============================
; PRINT_SLOT
; This subroutine prints " XXXX " to the screen, whose hour is the integer
; stored in R1. It will preserves all registers. It simulates the operation of
; dividing 10 to get the quotient (the first digit) and the remainder
; (the second digit).
;
; R0: holds the integer of the first digit
; R1: holds the integer of the second digit
; R2: holds the ASCII '0'
;
PRINT_SLOT
; store R0, R1, R2 and R7 into memory for later recovery
ST R0,PRINT_SLOT_R0
STI R1,PRINT_SLOT_R1_ADDR
; NOTE: access unspecified memory
ST R2,PRINT_SLOT_R2
ST R7,PRINT_SLOT_R7
; print the prefix string
LEA R0,PRINT_SLOT_PREFIX
PUTS
ADD R1,R1,#6 ; map R1 to 6:00 to 20:00
AND R0,R0,#0 ; R0 = 0
PRINT_SLOT_MINUS_TEN
ADD R0,R0,#1 ; R0 += 1
ADD R1,R1,#-10 ; R1 -= 10
; BRzp PRINT_SLOT_MINUS_TEN ; keep minus ten if R1 >= 0
; NOTE: fail to handle the case of 20:00
PRINT_SLOT_PRINT
; since PRINT_SLOT_MINUS_TEN stops the first time R1 < 0, we should recover
; R0 and R1 to one loop before, so that R0 holds the integer of the first
; digit, and R1 holds the second content
ADD R0,R0,#-1 ; R0 -= 1
ADD R1,R1,#10 ; R1 += 10
LD R2,PRINT_SLOT_ASCII_ZERO ; put ASCII '0' into R2
; print the first digit
ADD R0,R0,R2
OUT
; print the second digit
ADD R0,R1,R2
OUT
; print the remainder string
LEA R0,PRINT_SLOT_REMAINER_STR
PUTS
; recover R0, R1 and R2
; LD R0,PRINT_SLOT_R0
LDI R2,PRINT_SLOT_R1_ADDR
; LD R2,PRINT_SLOT_R2
; NOTE: fail to restore R0 and R1, but load R1 to R2
LD R7,PRINT_SLOT_R7
; RET
HALT
; NOTE: HALT in subroutine and doesn't return
PRINT_SLOT_ASCII_ZERO .FILL x30 ; ASCII '0'
PRINT_SLOT_R0 .BLKW 1 ; temporary storage of R0
PRINT_SLOT_R1_ADDR .FILL x2500 ; temporary storage location address of R1
PRINT_SLOT_R2 .BLKW 1 ; temporary storage of R2
PRINT_SLOT_R7 .BLKW 1 ; temporary storage of R7
PRINT_SLOT_PREFIX .STRINGZ " "
PRINT_SLOT_REMAINER_STR .STRINGZ "00 "
; PRINT_CENTERED
; This subroutine maps the string in R1 to 9 characters with possibly leading
; and trailing spaces, and then print it to the screen.
;
; R0: temporary, and interface with PRINT_SPACES
; R1: holds the string pointer
; R2: holds the string length
; R7: temporary
;
PRINT_CENTERED
; store R0 and R1 into memory for later recovery
ST R0,PRINT_CENTERED_R0
STI R1,PRINT_CENTERED_R1_ADDR
ST R2,PRINT_CENTERED_R2
ST R7,PRINT_CENTERED_R7
AND R2,R2,#0 ; R2 = 0
PRINT_CENTERED_CHECK
LDR R0,R1,#0
BRz PRINT_CENTERED_CHECK_DONE
ADD R2,R2,#1 ; R2 += 1
ADD R1,R1,#1 ; move to the next character
BRnzp PRINT_CENTERED_CHECK
PRINT_CENTERED_CHECK_DONE
ADD R2,R2,#-9
BRnz PRINT_CENTERED_LE_NINE
; string length is greater than 6
PRINT_CENTERED_G_NINE
LDI R1,PRINT_CENTERED_R1_ADDR
; R2 = 9
AND R2,R2,#0
ADD R2,R2,#9
PRINT_CENTERED_FOO
BRz PRINT_CENTERED_DONE
LDR R0,R1,#0
OUT
ADD R1,R1,#1
ADD R2,R2,#-1
BRnzp PRINT_CENTERED_FOO
; string length is less or equal to 9
PRINT_CENTERED_LE_NINE
ADD R2,R2,#9 ; recover R2
; read the number of leading spaces into R0
LEA R7, PRINT_CENTERED_LEADING_COUNT
ADD R7,R7,R2
LDR R0,R7,#0 ; put the number of space into R0
; print the leading spaces
JSR PRINT_SPACES
; print the original string
LDI R0,PRINT_CENTERED_R1_ADDR
PUTS
; read the number of trailing space into R0
LEA R7, PRINT_CENTERED_TRAILING_COUNT
ADD R7,R7,R2
LDR R0,R7,#0 ; put the number of space into R0
; print the trailing spaces
JSR PRINT_SPACES
PRINT_CENTERED_DONE
; recover R0 and R1
; LD R0,PRINT_CENTERED_R0
LDI R1,PRINT_CENTERED_R1_ADDR
; LD R2,PRINT_CENTERED_R2
LD R7,PRINT_CENTERED_R7
; NOTE: fail to restore R0 and R2
; RET
HALT
; NOTE: HALT in subroutine and doesn't return
PRINT_CENTERED_R0 .BLKW 1 ; temporary storage of R0
PRINT_CENTERED_R1_ADDR .FILL x2600 ; temporary storage addr of R1
PRINT_CENTERED_R2 .BLKW 1 ; temporary storage of R1
PRINT_CENTERED_R7 .BLKW 1 ; temporary storage of R7
PRINT_CENTERED_LEADING_COUNT
.FILL #4 ; NOTE: should be 5
.FILL #4
.FILL #4
.FILL #3
.FILL #3
.FILL #2
.FILL #2
.FILL #1
.FILL #1
.FILL #0
PRINT_CENTERED_TRAILING_COUNT
.FILL #4
.FILL #4
.FILL #3
.FILL #3
.FILL #2
.FILL #2
.FILL #1
.FILL #1
.FILL #0
.FILL #0
; PRINT_SPACES
; This subroutine prints R0 number of space.
;
; R0: interface, and temporary
; R6: holds the number of remaining spaces
;
PRINT_SPACES
; store R0, R6 and R7 into memory
ST R0,PRINT_SPACES_R0
ST R6,PRINT_SPACES_R6
ST R7,PRINT_SPACES_R7
ADD R6,R0,#0 ; move R0 into R6
LD R0,PRINT_SPACES_ASCII_SPACE
ADD R6,R6,#0 ; set condition codes of R6
PRINT_SPACES_CHECK
BRnz PRINT_SPACES_DONE
OUT ; print a space
ADD R6,R6,#-1 ; R6 -= 1
BRnzp PRINT_SPACES_CHECK
PRINT_SPACES_DONE
; recover R0, R6 and R7
LD R0,PRINT_SPACES_R0
LD R6,PRINT_SPACES_R6
LD R7,PRINT_SPACES_R7
RET
PRINT_SPACES_R0 .BLKW 1 ; temporary storage of R0
PRINT_SPACES_R6 .BLKW 1 ; temporary storage of R6
PRINT_SPACES_R7 .BLKW 1 ; temporary storage of R7
PRINT_SPACES_ASCII_SPACE .FILL x20
.END |
programs/oeis/017/A017044.asm | neoneye/loda | 22 | 87393 | ; A017044: a(n) = (7*n + 5)^4.
; 625,20736,130321,456976,1185921,2560000,4879681,8503056,13845841,21381376,31640625,45212176,62742241,84934656,112550881,146410000,187388721,236421376,294499921,362673936,442050625,533794816,639128961,759333136,895745041,1049760000,1222830961,1416468496,1632240801,1871773696,2136750625,2428912656,2750058481,3102044416,3486784401,3906250000,4362470401,4857532416,5393580481,5972816656,6597500625,7269949696,7992538801,8767700496,9597924961,10485760000,11433811041,12444741136,13521270961,14666178816,15882300625,17172529936,18539817921,19987173376,21517662721,23134410000,24840596881,26639462656,28534304241,30528476176,32625390625,34828517376,37141383841,39567575056,42110733681,44774560000,47562811921,50479304976,53527912321,56712564736,60037250625,63506016016,67122964561,70892257536,74818113841,78904810000,83156680161,87578116096,92173567201,96947540496,101904600625,107049369856,112386528081,117920812816,123657019201,129600000000,135754665601,142125984016,148718980881,155538739456,162590400625,169879162896,177410282401,185189072896,193220905761,201511210000,210065472241,218889236736,227988105361,237367737616
mul $0,7
add $0,5
pow $0,4
|
awa/plugins/awa-images/regtests/awa-images-tests.adb | stcarrez/ada-awa | 81 | 28271 | <reponame>stcarrez/ada-awa
-----------------------------------------------------------------------
-- awa-images-tests -- Unit tests for images module
-- Copyright (C) 2018, 2019, 2020, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Util.Test_Caller;
with Util.Strings;
with ADO;
with Servlet.Requests.Mockup;
with Servlet.Responses.Mockup;
with ASF.Tests;
with AWA.Tests.Helpers.Users;
package body AWA.Images.Tests is
use Ada.Strings.Unbounded;
use ADO;
package Caller is new Util.Test_Caller (Test, "Images.Beans");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Images.Beans.Create",
Test_Create_Image'Access);
Caller.Add_Test (Suite, "Test AWA.Images.Servlets (missing)",
Test_Missing_Image'Access);
end Add_Tests;
-- ------------------------------
-- Get some access on the wiki as anonymous users.
-- ------------------------------
procedure Verify_Anonymous (T : in out Test;
Page : in String;
Title : in String) is
pragma Unreferenced (Page, Title);
Request : Servlet.Requests.Mockup.Request;
Reply : Servlet.Responses.Mockup.Response;
begin
ASF.Tests.Do_Get (Request, Reply, "/storages/images.html",
"images-anonymous-list.html");
ASF.Tests.Assert_Contains (T, "List of pages", Reply,
"Wiki list recent page is invalid");
end Verify_Anonymous;
-- ------------------------------
-- Verify that the wiki lists contain the given page.
-- ------------------------------
procedure Verify_List_Contains (T : in out Test;
Name : in String) is
pragma Unreferenced (Name);
Request : Servlet.Requests.Mockup.Request;
Reply : Servlet.Responses.Mockup.Response;
begin
ASF.Tests.Do_Get (Request, Reply, "/storages/documents.html",
"storage-list.html");
ASF.Tests.Assert_Contains (T, "Documents of the workspace", Reply,
"List of documents is invalid");
end Verify_List_Contains;
-- ------------------------------
-- Test access to the blog as anonymous user.
-- ------------------------------
procedure Test_Anonymous_Access (T : in out Test) is
begin
T.Verify_Anonymous ("", "");
end Test_Anonymous_Access;
-- ------------------------------
-- Test creation of image by simulating web requests.
-- ------------------------------
procedure Test_Create_Image (T : in out Test) is
Request : Servlet.Requests.Mockup.Part_Request (1);
Reply : Servlet.Responses.Mockup.Response;
Content : Ada.Strings.Unbounded.Unbounded_String;
Folder_Id : ADO.Identifier;
Image_Id : ADO.Identifier;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/result/upload.jpg");
begin
AWA.Tests.Helpers.Users.Login ("<EMAIL>", Request);
-- Create the folder.
Request.Set_Parameter ("folder-name", "Image Folder Name");
Request.Set_Parameter ("storage-folder-create-form", "1");
Request.Set_Parameter ("storage-folder-create-button", "1");
ASF.Tests.Do_Post (Request, Reply, "/storages/forms/folder-create.html",
"folder-create-form.html");
T.Assert (Reply.Get_Status = Servlet.Responses.SC_OK,
"Invalid response after folder creation");
Reply.Read_Content (Content);
Folder_Id := AWA.Tests.Helpers.Extract_Identifier (To_String (Content), "#folder");
T.Assert (Folder_Id > 0, "Invalid folder id returned");
-- Check the list page.
ASF.Tests.Do_Get (Request, Reply, "/storages/images.html",
"image-list.html");
ASF.Tests.Assert_Contains (T, "Documents of the workspace", Reply,
"List of documents is invalid (title)");
ASF.Tests.Assert_Contains (T, "Image Folder Name", Reply,
"List of documents is invalid (content)");
-- Upload an image to the folder.
if Ada.Directories.Exists (Path) then
Ada.Directories.Delete_File (Path);
end if;
Ada.Directories.Copy_File (Source_Name => "regtests/files/images/Ada-Lovelace.jpg",
Target_Name => Path,
Form => "all");
Request.Set_Parameter ("folder", ADO.Identifier'Image (Folder_Id));
Request.Set_Parameter ("uploadForm", "1");
Request.Set_Parameter ("id", "-1");
Request.Set_Parameter ("upload-button", "1");
Request.Set_Part (Position => 1, Name => "upload-file",
Path => Path, Content_Type => "image/jpg");
ASF.Tests.Do_Post (Request, Reply, "/storages/forms/upload-form.html",
"upload-image-form.html");
T.Assert (Reply.Get_Status = Servlet.Responses.SC_OK,
"Invalid response after image upload");
T.Assert_Equals ("application/json", Reply.Get_Content_Type,
"Invalid response after upload");
Reply.Read_Content (Content);
Image_Id := AWA.Tests.Helpers.Extract_Identifier (To_String (Content), "store");
T.Assert (Image_Id > 0, "Invalid image id returned after upload");
-- Look at the image content.
ASF.Tests.Do_Get (Request, Reply, "/storages/images/"
& Util.Strings.Image (Natural (Image_Id)) & "/view/upload.jpg",
"image-file-data.jpg");
T.Assert (Reply.Get_Status = Servlet.Responses.SC_OK,
"Invalid response after image get");
T.Assert_Equals ("image/jpg", Reply.Get_Content_Type,
"Invalid response after upload");
-- Look at the image description page.
ASF.Tests.Do_Get (Request, Reply, "/storages/image-info/"
& Util.Strings.Image (Natural (Image_Id)),
"image-file-info.html");
T.Assert (Reply.Get_Status = Servlet.Responses.SC_OK,
"Invalid response for image-info page");
T.Assert_Equals ("text/html; charset=UTF-8", Reply.Get_Content_Type,
"Invalid response for image-info");
ASF.Tests.Assert_Contains (T, "/storages/files/"
& Util.Strings.Image (Natural (Image_Id)) & "/", Reply,
"Image info page is invalid (missing link)");
end Test_Create_Image;
-- ------------------------------
-- Test getting an image which does not exist.
-- ------------------------------
procedure Test_Missing_Image (T : in out Test) is
Request : Servlet.Requests.Mockup.Request;
Reply : Servlet.Responses.Mockup.Response;
begin
ASF.Tests.Do_Get (Request, Reply, "/storages/images/12345345/view/missing.jpg",
"image-file-missing.html");
ASF.Tests.Assert_Redirect (T, "/auth/login.html", Reply,
"Invalid redirection for protected page");
AWA.Tests.Helpers.Users.Login ("<EMAIL>", Request);
ASF.Tests.Do_Get (Request, Reply, "/storages/images/12345345/view/missing.jpg",
"image-file-missing.html");
T.Assert (Reply.Get_Status = Servlet.Responses.SC_NOT_FOUND,
"Invalid response after image get");
end Test_Missing_Image;
end AWA.Images.Tests;
|
source/amf/uml/amf-uml-protocol_state_machines.ads | svn2github/matreshka | 24 | 4532 | <filename>source/amf/uml/amf-uml-protocol_state_machines.ads
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A protocol state machine is always defined in the context of a classifier.
-- It specifies which operations of the classifier can be called in which
-- state and under which condition, thus specifying the allowed call
-- sequences on the classifier's operations. A protocol state machine
-- presents the possible and permitted transitions on the instances of its
-- context classifier, together with the operations which carry the
-- transitions. In this manner, an instance lifecycle can be created for a
-- classifier, by specifying the order in which the operations can be
-- activated and the states through which an instance progresses during its
-- existence.
------------------------------------------------------------------------------
limited with AMF.UML.Protocol_Conformances.Collections;
with AMF.UML.State_Machines;
package AMF.UML.Protocol_State_Machines is
pragma Preelaborate;
type UML_Protocol_State_Machine is limited interface
and AMF.UML.State_Machines.UML_State_Machine;
type UML_Protocol_State_Machine_Access is
access all UML_Protocol_State_Machine'Class;
for UML_Protocol_State_Machine_Access'Storage_Size use 0;
not overriding function Get_Conformance
(Self : not null access constant UML_Protocol_State_Machine)
return AMF.UML.Protocol_Conformances.Collections.Set_Of_UML_Protocol_Conformance is abstract;
-- Getter of ProtocolStateMachine::conformance.
--
-- Conformance between protocol state machines.
end AMF.UML.Protocol_State_Machines;
|
kernel/interrupt.asm | linxin8/os | 3 | 83355 | [bits 32]
%define ERROR_CODE nop ; 若在相关的异常中cpu已经自动压入了错误码,为保持栈中格式统一,这里不做操作.
%define ZERO push 0 ; 若在相关的异常中cpu没有压入错误码,为了统一栈中格式,就手工压入一个0
extern idt_table ;idt_table是C中注册的中断处理程序数组
section .data
global interrupt_entry_table
interrupt_entry_table:
%macro VECTOR 2
section .text
intr%1entry: ; 每个中断处理程序都要压入中断向量号,所以一个中断类型一个中断处理程序,自己知道自己的中断向量号是多少
%2 ; 中断若有错误码会压在eip后面
; 以下是保存上下文环境
push ds
push es
push fs
push gs
pushad ; PUSHAD指令压入32位寄存器,其入栈顺序是: EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI
; 如果是从片上进入的中断,除了往从片上发送EOI外,还要往主片上发送EOI
mov al,0x20 ; 中断结束命令EOI
out 0xa0,al ; 向从片发送
out 0x20,al ; 向主片发送
push %1 ; 不管idt_table中的目标程序是否需要参数,都一律压入中断向量号,调试时很方便
call [idt_table + %1*4] ; 调用idt_table中的C版本中断处理函数
jmp intr_exit
section .data
dd intr%1entry ; 存储各个中断入口程序的地址,形成interrupt_entry_table数组
%endmacro
section .text
global intr_exit
intr_exit:
; 以下是恢复上下文环境
add esp, 4 ; 跳过中断号
popad
pop gs
pop fs
pop es
pop ds
add esp, 4 ; 跳过error_code
iretd
VECTOR 0x00,ZERO
VECTOR 0x01,ZERO
VECTOR 0x02,ZERO
VECTOR 0x03,ZERO
VECTOR 0x04,ZERO
VECTOR 0x05,ZERO
VECTOR 0x06,ZERO
VECTOR 0x07,ZERO
VECTOR 0x08,ERROR_CODE
VECTOR 0x09,ZERO
VECTOR 0x0a,ERROR_CODE
VECTOR 0x0b,ERROR_CODE
VECTOR 0x0c,ZERO
VECTOR 0x0d,ERROR_CODE
VECTOR 0x0e,ERROR_CODE
VECTOR 0x0f,ZERO
VECTOR 0x10,ZERO
VECTOR 0x11,ERROR_CODE
VECTOR 0x12,ZERO
VECTOR 0x13,ZERO
VECTOR 0x14,ZERO
VECTOR 0x15,ZERO
VECTOR 0x16,ZERO
VECTOR 0x17,ZERO
VECTOR 0x18,ERROR_CODE
VECTOR 0x19,ZERO
VECTOR 0x1a,ERROR_CODE
VECTOR 0x1b,ERROR_CODE
VECTOR 0x1c,ZERO
VECTOR 0x1d,ERROR_CODE
VECTOR 0x1e,ERROR_CODE
VECTOR 0x1f,ZERO
VECTOR 0x20,ZERO ;时钟中断对应的入口
VECTOR 0x21,ZERO ;键盘中断对应的入口
VECTOR 0x22,ZERO ;级联用的
VECTOR 0x23,ZERO ;串口2对应的入口
VECTOR 0x24,ZERO ;串口1对应的入口
VECTOR 0x25,ZERO ;并口2对应的入口
VECTOR 0x26,ZERO ;软盘对应的入口
VECTOR 0x27,ZERO ;并口1对应的入口
VECTOR 0x28,ZERO ;实时时钟对应的入口
VECTOR 0x29,ZERO ;重定向
VECTOR 0x2a,ZERO ;保留
VECTOR 0x2b,ZERO ;保留
VECTOR 0x2c,ZERO ;ps/2鼠标
VECTOR 0x2d,ZERO ;fpu浮点单元异常
VECTOR 0x2e,ZERO ;硬盘
VECTOR 0x2f,ZERO ;保留
;;;;;;;;;;;;;;;; 0x80号中断 ;;;;;;;;;;;;;;;;
[bits 32]
extern syscall_table
section .text
global syscall_handler
syscall_handler:
;1 保存上下文环境
push 0 ; 压入0, 使栈中格式统一
push ds
push es
push fs
push gs
pushad ; PUSHAD指令压入32位寄存器,其入栈顺序是:
; EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI
push 0x80 ; 此位置压入0x80也是为了保持统一的栈格式
;2 为系统调用子功能传入参数
push edx ; 系统调用中第3个参数
push ecx ; 系统调用中第2个参数
push ebx ; 系统调用中第1个参数
;3 调用子功能处理函数
call [syscall_table + eax*4] ; 编译器会在栈中根据C函数声明匹配正确数量的参数
add esp, 12 ; 跨过上面的三个参数
;4 将call调用后的返回值存入待当前内核栈中eax的位置
mov [esp + 8*4], eax
jmp intr_exit ; intr_exit返回,恢复上下文
|
tools/scitools/conf/understand/ada/ada95/s-finimp.ads | brucegua/moocos | 1 | 11072 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . F I N A L I Z A T I O N _ I M P L E M E N T A T I O N --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- ??? this package should be a private package. It is set as public for now
-- in order to simplify testing
package System.Finalization_Implementation is
pragma Preelaborate (Finalization_Implementation);
type Root;
subtype Finalizable is Root'Class;
type Finalizable_Ptr is access all Root'Class;
type Root is abstract tagged record
Prev : Finalizable_Ptr;
Next : Finalizable_Ptr;
end record;
procedure Initialize (Object : in out Root) is abstract;
procedure Finalize (Object : in out Root) is abstract;
procedure Adjust (Object : in out Root);
-------------------------------------------------
-- Finalization Management Abstract Interface --
-------------------------------------------------
Global_Final_List : Finalizable_Ptr;
-- This list stores the controlled objects defined in library-level
-- packages. They will be finalized after the main program completion.
procedure Finalize_Global_List;
-- The procedure to be called in order to finalize the global list;
procedure Attach_To_Final_List
(L : in out Finalizable_Ptr;
Obj : in out Finalizable);
-- Put the finalizable object on a list of finalizable elements.
procedure Detach_From_Final_List
(L : in out Finalizable_Ptr;
Obj : in out Finalizable);
-- Remove the specified object from the Final list and reset its
-- pointers to null.
procedure Finalize_List (L : Finalizable_Ptr);
-- Call Finalize on each element of the list L;
procedure Finalize_One
(From : in out Finalizable_Ptr;
Obj : in out Finalizable);
-- Call Finalize on Obj and remove it from the list From.
-----------------------------
-- Record Controller Types --
-----------------------------
-- Definition of the types of the controller component that is included
-- in records containing controlled components. This controller is
-- attached to the finalization chain of the upper-level and carries
-- the pointer of the finalization chain for the lower level
type Limited_Record_Controller is new Root with record
F : System.Finalization_Implementation.Finalizable_Ptr;
end record;
procedure Initialize (Object : in out Limited_Record_Controller);
-- Does nothing
procedure Finalize (Object : in out Limited_Record_Controller);
-- Finalize the controlled components of the enclosing record by
-- following the list starting at Object.F
type Record_Controller is
new Limited_Record_Controller with record
My_Address : System.Address;
end record;
procedure Initialize (Object : in out Record_Controller);
-- Initialize the field My_Address to the Object'Address
procedure Adjust (Object : in out Record_Controller);
-- Adjust the components and their finalization pointers by substracting
-- by the offset of the target and the source addresses of the assignment
-- Inherit Finalize from Limited_Record_Controller
end System.Finalization_Implementation;
|
oeis/032/A032121.asm | neoneye/loda-programs | 11 | 6331 | ; A032121: Number of reversible strings with n beads of 4 colors.
; Submitted by <NAME>
; 1,4,10,40,136,544,2080,8320,32896,131584,524800,2099200,8390656,33562624,134225920,536903680,2147516416,8590065664,34359869440,137439477760,549756338176,2199025352704,8796095119360,35184380477440,140737496743936,562949986975744,2251799847239680,9007199388958720,36028797153181696,144115188612726784,576460752840294400,2305843011361177600,9223372039002259456,36893488156009037824,147573952598266347520,590295810393065390080,2361183241469182345216,9444732965876729380864,37778931863094600663040
mov $1,2
pow $1,$0
mod $0,2
add $0,$1
add $0,1
mul $1,$0
mov $0,$1
div $0,2
|
oeis/024/A024116.asm | neoneye/loda-programs | 11 | 8856 | ; A024116: a(n) = 10^n - n^2.
; 1,9,96,991,9984,99975,999964,9999951,99999936,999999919,9999999900,99999999879,999999999856,9999999999831,99999999999804,999999999999775,9999999999999744,99999999999999711,999999999999999676,9999999999999999639,99999999999999999600,999999999999999999559,9999999999999999999516,99999999999999999999471,999999999999999999999424,9999999999999999999999375,99999999999999999999999324,999999999999999999999999271,9999999999999999999999999216,99999999999999999999999999159,999999999999999999999999999100
mov $1,10
pow $1,$0
pow $0,2
sub $1,$0
mov $0,$1
|
src/sdl.ads | Fabien-Chouteau/sdlada | 1 | 12336 | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL
--
-- Ada 2012 bindings to the SDL 2.x.y library.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C;
package SDL is
package C renames Interfaces.C;
use type C.int;
type Init_Flags is mod 2 ** 32 with
Convention => C;
Null_Init_Flags : constant Init_Flags := 16#0000_0000#;
Enable_Timer : constant Init_Flags := 16#0000_0001#;
Enable_Audio : constant Init_Flags := 16#0000_0010#;
Enable_Screen : constant Init_Flags := 16#0000_0020#;
Enable_Joystick : constant Init_Flags := 16#0000_0200#;
Enable_Haptic : constant Init_Flags := 16#0000_1000#;
Enable_Game_Controller : constant Init_Flags := 16#0000_2000#;
Enable_Events : constant Init_Flags := 16#0000_4000#;
Enable_No_Parachute : constant Init_Flags := 16#0010_0000#;
Enable_Everything : constant Init_Flags :=
Enable_Timer or Enable_Audio or Enable_Screen or Enable_Joystick or Enable_Haptic or
Enable_Game_Controller or Enable_Events or Enable_No_Parachute;
-- Coordinates are for positioning things.
subtype Coordinate is C.int;
subtype Natural_Coordinate is Coordinate range 0 .. Coordinate'Last;
subtype Positive_Coordinate is Coordinate range 1 .. Coordinate'Last;
Centre_Coordinate : constant Coordinate := 0;
type Coordinates is
record
X : SDL.Coordinate;
Y : SDL.Coordinate;
end record with
Convention => C;
Zero_Coordinate : constant Coordinates := (others => 0);
subtype Natural_Coordinates is Coordinates with
Dynamic_Predicate =>
Natural_Coordinates.X >= Natural_Coordinate'First and Natural_Coordinates.Y >= Natural_Coordinate'First;
subtype Positive_Coordinates is Coordinates with
Dynamic_Predicate =>
Positive_Coordinates.X >= Positive_Coordinate'First and Positive_Coordinates.Y >= Positive_Coordinate'First;
-- Dimensions are for sizing things.
subtype Dimension is C.int;
subtype Natural_Dimension is Dimension range 0 .. Dimension'Last;
subtype Positive_Dimension is Dimension range 1 .. Dimension'Last;
type Sizes is
record
Width : Dimension;
Height : Dimension;
end record with
Convention => C;
Zero_Size : constant Sizes := (others => Natural_Dimension'First);
subtype Natural_Sizes is Sizes with
Dynamic_Predicate => Natural_Sizes.Width >= 0 and Natural_Sizes.Height >= 0;
subtype Positive_Sizes is Sizes with
Dynamic_Predicate => Positive_Sizes.Width >= 1 and Positive_Sizes.Height >= 1;
function "*" (Left : in Sizes; Scale : in Positive_Dimension) return Sizes is
(Sizes'(Width => Left.Width * Scale, Height => Left.Height * Scale));
function "/" (Left : in Sizes; Scale : in Positive_Dimension) return Sizes is
(Sizes'(Width => Left.Width / Scale, Height => Left.Height / Scale));
function Initialise (Flags : in Init_Flags := Enable_Everything) return Boolean;
procedure Finalise with
Import => True,
Convention => C,
External_Name => "SDL_Quit";
function Initialise_Sub_System (Flags : in Init_Flags) return Boolean;
procedure Finalise_Sub_System
(Flags : in Init_Flags) with
Import => True,
Convention => C,
External_Name => "SDL_QuitSubSystem";
-- Get which sub-systems were initialised.
function Was_Initialised return Init_Flags;
-- Check whether a set of sub-systems were initialised.
function Was_Initialised (Flags : in Init_Flags) return Boolean;
private
Success : constant Interfaces.C.int := 0;
type SDL_Bool is (SDL_False, SDL_True) with
Convention => C;
-- The next value is used in mapping the Ada types onto the C types, it is the word size used for all data
-- in SDL, i.e. all data is 4 byte aligned so it works with 32-bit architectures.
Word : constant := 4;
-- These constants are internal to the events system.
SDL_Query : constant C.int := -1;
SDL_Ignore : constant C.int := 0;
SDL_Disable : constant C.int := 0;
SDL_Enable : constant C.int := 1;
end SDL;
|
Task/Grayscale-image/Ada/grayscale-image-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 1519 | function Grayscale (Picture : Image) return Grayscale_Image is
type Extended_Luminance is range 0..10_000_000;
Result : Grayscale_Image (Picture'Range (1), Picture'Range (2));
Color : Pixel;
begin
for I in Picture'Range (1) loop
for J in Picture'Range (2) loop
Color := Picture (I, J);
Result (I, J) :=
Luminance
( ( 2_126 * Extended_Luminance (Color.R)
+ 7_152 * Extended_Luminance (Color.G)
+ 722 * Extended_Luminance (Color.B)
)
/ 10_000
);
end loop;
end loop;
return Result;
end Grayscale;
|
alloy4fun_models/trashltl/models/9/quZoHHNdJAMaeQ39E.als | Kaixi26/org.alloytools.alloy | 0 | 2403 | open main
pred idquZoHHNdJAMaeQ39E_prop10 {
always (Protected in Protected')
}
pred __repair { idquZoHHNdJAMaeQ39E_prop10 }
check __repair { idquZoHHNdJAMaeQ39E_prop10 <=> prop10o } |
data/maps/objects/SafariZoneNorth.asm | opiter09/ASM-Machina | 1 | 93497 | <reponame>opiter09/ASM-Machina<filename>data/maps/objects/SafariZoneNorth.asm
SafariZoneNorth_Object:
db $0 ; border block
def_warps
warp 2, 35, 0, SAFARI_ZONE_WEST
warp 3, 35, 1, SAFARI_ZONE_WEST
warp 8, 35, 2, SAFARI_ZONE_WEST
warp 9, 35, 3, SAFARI_ZONE_WEST
warp 20, 35, 4, SAFARI_ZONE_CENTER
warp 21, 35, 5, SAFARI_ZONE_CENTER
warp 39, 30, 0, SAFARI_ZONE_EAST
warp 39, 31, 1, SAFARI_ZONE_EAST
warp 35, 3, 0, SAFARI_ZONE_NORTH_REST_HOUSE
def_signs
sign 36, 4, 3 ; SafariZoneNorthText3
sign 4, 25, 4 ; SafariZoneNorthText4
sign 13, 31, 5 ; SafariZoneNorthText5
sign 19, 33, 6 ; SafariZoneNorthText6
sign 26, 28, 7 ; SafariZoneNorthText7
def_objects
object SPRITE_POKE_BALL, 25, 1, STAY, NONE, 1, PROTEIN
object SPRITE_POKE_BALL, 19, 7, STAY, NONE, 2, TM_SKULL_BASH
def_warps_to SAFARI_ZONE_NORTH
|
programs/oeis/173/A173711.asm | karttu/loda | 1 | 98476 | ; A173711: Nonnegative integers, six even followed by two odd.
; 0,0,0,0,0,0,1,1,2,2,2,2,2,2,3,3,4,4,4,4,4,4,5,5,6,6,6,6,6,6,7,7,8,8,8,8,8,8,9,9,10,10,10,10,10,10,11,11,12,12,12,12,12,12,13,13,14,14,14,14,14,14,15,15,16,16,16,16,16,16,17,17,18,18,18,18,18,18,19,19,20,20,20,20,20,20,21,21,22,22,22,22,22,22,23,23,24,24,24,24,24,24,25,25,26,26,26,26,26,26,27,27,28,28,28,28,28,28,29,29,30,30,30,30,30,30,31,31,32,32,32,32,32,32,33,33,34,34,34,34,34,34,35,35,36,36,36,36,36,36,37,37,38,38,38,38,38,38,39,39,40,40,40,40,40,40,41,41,42,42,42,42,42,42,43,43,44,44,44,44,44,44,45,45,46,46,46,46,46,46,47,47,48,48,48,48,48,48,49,49,50,50,50,50,50,50,51,51,52,52,52,52,52,52,53,53,54,54,54,54,54,54,55,55,56,56,56,56,56,56,57,57,58,58,58,58,58,58,59,59,60,60,60,60,60,60,61,61,62,62
mul $0,6
mov $1,$0
div $1,16
mul $1,6
div $1,9
|
alloy4fun_models/trashltl/models/9/2zxrxKYJNM2FLpXTv.als | Kaixi26/org.alloytools.alloy | 0 | 2149 | <reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/9/2zxrxKYJNM2FLpXTv.als
open main
pred id2zxrxKYJNM2FLpXTv_prop10 {
always all f : File | f in Protected implies f in Protected
}
pred __repair { id2zxrxKYJNM2FLpXTv_prop10 }
check __repair { id2zxrxKYJNM2FLpXTv_prop10 <=> prop10o } |
arch/ARM/Nordic/svd/nrf52/nrf_svd-radio.ads | rocher/Ada_Drivers_Library | 192 | 9241 | -- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- 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, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.RADIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Shortcut between READY event and START task
type SHORTS_READY_START_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_READY_START_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between END event and DISABLE task
type SHORTS_END_DISABLE_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_END_DISABLE_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between DISABLED event and TXEN task
type SHORTS_DISABLED_TXEN_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_DISABLED_TXEN_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between DISABLED event and RXEN task
type SHORTS_DISABLED_RXEN_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_DISABLED_RXEN_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between ADDRESS event and RSSISTART task
type SHORTS_ADDRESS_RSSISTART_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_ADDRESS_RSSISTART_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between END event and START task
type SHORTS_END_START_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_END_START_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between ADDRESS event and BCSTART task
type SHORTS_ADDRESS_BCSTART_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_ADDRESS_BCSTART_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between DISABLED event and RSSISTOP task
type SHORTS_DISABLED_RSSISTOP_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_DISABLED_RSSISTOP_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut register
type SHORTS_Register is record
-- Shortcut between READY event and START task
READY_START : SHORTS_READY_START_Field := NRF_SVD.RADIO.Disabled;
-- Shortcut between END event and DISABLE task
END_DISABLE : SHORTS_END_DISABLE_Field := NRF_SVD.RADIO.Disabled;
-- Shortcut between DISABLED event and TXEN task
DISABLED_TXEN : SHORTS_DISABLED_TXEN_Field :=
NRF_SVD.RADIO.Disabled;
-- Shortcut between DISABLED event and RXEN task
DISABLED_RXEN : SHORTS_DISABLED_RXEN_Field :=
NRF_SVD.RADIO.Disabled;
-- Shortcut between ADDRESS event and RSSISTART task
ADDRESS_RSSISTART : SHORTS_ADDRESS_RSSISTART_Field :=
NRF_SVD.RADIO.Disabled;
-- Shortcut between END event and START task
END_START : SHORTS_END_START_Field := NRF_SVD.RADIO.Disabled;
-- Shortcut between ADDRESS event and BCSTART task
ADDRESS_BCSTART : SHORTS_ADDRESS_BCSTART_Field :=
NRF_SVD.RADIO.Disabled;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Shortcut between DISABLED event and RSSISTOP task
DISABLED_RSSISTOP : SHORTS_DISABLED_RSSISTOP_Field :=
NRF_SVD.RADIO.Disabled;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SHORTS_Register use record
READY_START at 0 range 0 .. 0;
END_DISABLE at 0 range 1 .. 1;
DISABLED_TXEN at 0 range 2 .. 2;
DISABLED_RXEN at 0 range 3 .. 3;
ADDRESS_RSSISTART at 0 range 4 .. 4;
END_START at 0 range 5 .. 5;
ADDRESS_BCSTART at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DISABLED_RSSISTOP at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- Write '1' to Enable interrupt for READY event
type INTENSET_READY_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_READY_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for READY event
type INTENSET_READY_Field_1 is
(-- Reset value for the field
Intenset_Ready_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_READY_Field_1 use
(Intenset_Ready_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for ADDRESS event
type INTENSET_ADDRESS_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_ADDRESS_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for ADDRESS event
type INTENSET_ADDRESS_Field_1 is
(-- Reset value for the field
Intenset_Address_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_ADDRESS_Field_1 use
(Intenset_Address_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for PAYLOAD event
type INTENSET_PAYLOAD_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_PAYLOAD_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for PAYLOAD event
type INTENSET_PAYLOAD_Field_1 is
(-- Reset value for the field
Intenset_Payload_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_PAYLOAD_Field_1 use
(Intenset_Payload_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for END event
type INTENSET_END_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_END_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for END event
type INTENSET_END_Field_1 is
(-- Reset value for the field
Intenset_End_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_END_Field_1 use
(Intenset_End_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for DISABLED event
type INTENSET_DISABLED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_DISABLED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for DISABLED event
type INTENSET_DISABLED_Field_1 is
(-- Reset value for the field
Intenset_Disabled_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_DISABLED_Field_1 use
(Intenset_Disabled_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for DEVMATCH event
type INTENSET_DEVMATCH_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_DEVMATCH_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for DEVMATCH event
type INTENSET_DEVMATCH_Field_1 is
(-- Reset value for the field
Intenset_Devmatch_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_DEVMATCH_Field_1 use
(Intenset_Devmatch_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for DEVMISS event
type INTENSET_DEVMISS_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_DEVMISS_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for DEVMISS event
type INTENSET_DEVMISS_Field_1 is
(-- Reset value for the field
Intenset_Devmiss_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_DEVMISS_Field_1 use
(Intenset_Devmiss_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for RSSIEND event
type INTENSET_RSSIEND_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_RSSIEND_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for RSSIEND event
type INTENSET_RSSIEND_Field_1 is
(-- Reset value for the field
Intenset_Rssiend_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_RSSIEND_Field_1 use
(Intenset_Rssiend_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for BCMATCH event
type INTENSET_BCMATCH_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_BCMATCH_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for BCMATCH event
type INTENSET_BCMATCH_Field_1 is
(-- Reset value for the field
Intenset_Bcmatch_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_BCMATCH_Field_1 use
(Intenset_Bcmatch_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for CRCOK event
type INTENSET_CRCOK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_CRCOK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for CRCOK event
type INTENSET_CRCOK_Field_1 is
(-- Reset value for the field
Intenset_Crcok_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_CRCOK_Field_1 use
(Intenset_Crcok_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for CRCERROR event
type INTENSET_CRCERROR_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_CRCERROR_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for CRCERROR event
type INTENSET_CRCERROR_Field_1 is
(-- Reset value for the field
Intenset_Crcerror_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_CRCERROR_Field_1 use
(Intenset_Crcerror_Field_Reset => 0,
Set => 1);
-- Enable interrupt
type INTENSET_Register is record
-- Write '1' to Enable interrupt for READY event
READY : INTENSET_READY_Field_1 := Intenset_Ready_Field_Reset;
-- Write '1' to Enable interrupt for ADDRESS event
ADDRESS : INTENSET_ADDRESS_Field_1 :=
Intenset_Address_Field_Reset;
-- Write '1' to Enable interrupt for PAYLOAD event
PAYLOAD : INTENSET_PAYLOAD_Field_1 :=
Intenset_Payload_Field_Reset;
-- Write '1' to Enable interrupt for END event
END_k : INTENSET_END_Field_1 := Intenset_End_Field_Reset;
-- Write '1' to Enable interrupt for DISABLED event
DISABLED : INTENSET_DISABLED_Field_1 :=
Intenset_Disabled_Field_Reset;
-- Write '1' to Enable interrupt for DEVMATCH event
DEVMATCH : INTENSET_DEVMATCH_Field_1 :=
Intenset_Devmatch_Field_Reset;
-- Write '1' to Enable interrupt for DEVMISS event
DEVMISS : INTENSET_DEVMISS_Field_1 :=
Intenset_Devmiss_Field_Reset;
-- Write '1' to Enable interrupt for RSSIEND event
RSSIEND : INTENSET_RSSIEND_Field_1 :=
Intenset_Rssiend_Field_Reset;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Write '1' to Enable interrupt for BCMATCH event
BCMATCH : INTENSET_BCMATCH_Field_1 :=
Intenset_Bcmatch_Field_Reset;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Write '1' to Enable interrupt for CRCOK event
CRCOK : INTENSET_CRCOK_Field_1 := Intenset_Crcok_Field_Reset;
-- Write '1' to Enable interrupt for CRCERROR event
CRCERROR : INTENSET_CRCERROR_Field_1 :=
Intenset_Crcerror_Field_Reset;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
READY at 0 range 0 .. 0;
ADDRESS at 0 range 1 .. 1;
PAYLOAD at 0 range 2 .. 2;
END_k at 0 range 3 .. 3;
DISABLED at 0 range 4 .. 4;
DEVMATCH at 0 range 5 .. 5;
DEVMISS at 0 range 6 .. 6;
RSSIEND at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
BCMATCH at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CRCOK at 0 range 12 .. 12;
CRCERROR at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-- Write '1' to Disable interrupt for READY event
type INTENCLR_READY_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_READY_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for READY event
type INTENCLR_READY_Field_1 is
(-- Reset value for the field
Intenclr_Ready_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_READY_Field_1 use
(Intenclr_Ready_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for ADDRESS event
type INTENCLR_ADDRESS_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_ADDRESS_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for ADDRESS event
type INTENCLR_ADDRESS_Field_1 is
(-- Reset value for the field
Intenclr_Address_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_ADDRESS_Field_1 use
(Intenclr_Address_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for PAYLOAD event
type INTENCLR_PAYLOAD_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_PAYLOAD_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for PAYLOAD event
type INTENCLR_PAYLOAD_Field_1 is
(-- Reset value for the field
Intenclr_Payload_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_PAYLOAD_Field_1 use
(Intenclr_Payload_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for END event
type INTENCLR_END_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_END_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for END event
type INTENCLR_END_Field_1 is
(-- Reset value for the field
Intenclr_End_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_END_Field_1 use
(Intenclr_End_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for DISABLED event
type INTENCLR_DISABLED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_DISABLED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for DISABLED event
type INTENCLR_DISABLED_Field_1 is
(-- Reset value for the field
Intenclr_Disabled_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_DISABLED_Field_1 use
(Intenclr_Disabled_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for DEVMATCH event
type INTENCLR_DEVMATCH_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_DEVMATCH_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for DEVMATCH event
type INTENCLR_DEVMATCH_Field_1 is
(-- Reset value for the field
Intenclr_Devmatch_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_DEVMATCH_Field_1 use
(Intenclr_Devmatch_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for DEVMISS event
type INTENCLR_DEVMISS_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_DEVMISS_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for DEVMISS event
type INTENCLR_DEVMISS_Field_1 is
(-- Reset value for the field
Intenclr_Devmiss_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_DEVMISS_Field_1 use
(Intenclr_Devmiss_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for RSSIEND event
type INTENCLR_RSSIEND_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_RSSIEND_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for RSSIEND event
type INTENCLR_RSSIEND_Field_1 is
(-- Reset value for the field
Intenclr_Rssiend_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_RSSIEND_Field_1 use
(Intenclr_Rssiend_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for BCMATCH event
type INTENCLR_BCMATCH_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_BCMATCH_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for BCMATCH event
type INTENCLR_BCMATCH_Field_1 is
(-- Reset value for the field
Intenclr_Bcmatch_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_BCMATCH_Field_1 use
(Intenclr_Bcmatch_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for CRCOK event
type INTENCLR_CRCOK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_CRCOK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for CRCOK event
type INTENCLR_CRCOK_Field_1 is
(-- Reset value for the field
Intenclr_Crcok_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_CRCOK_Field_1 use
(Intenclr_Crcok_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for CRCERROR event
type INTENCLR_CRCERROR_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_CRCERROR_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for CRCERROR event
type INTENCLR_CRCERROR_Field_1 is
(-- Reset value for the field
Intenclr_Crcerror_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_CRCERROR_Field_1 use
(Intenclr_Crcerror_Field_Reset => 0,
Clear => 1);
-- Disable interrupt
type INTENCLR_Register is record
-- Write '1' to Disable interrupt for READY event
READY : INTENCLR_READY_Field_1 := Intenclr_Ready_Field_Reset;
-- Write '1' to Disable interrupt for ADDRESS event
ADDRESS : INTENCLR_ADDRESS_Field_1 :=
Intenclr_Address_Field_Reset;
-- Write '1' to Disable interrupt for PAYLOAD event
PAYLOAD : INTENCLR_PAYLOAD_Field_1 :=
Intenclr_Payload_Field_Reset;
-- Write '1' to Disable interrupt for END event
END_k : INTENCLR_END_Field_1 := Intenclr_End_Field_Reset;
-- Write '1' to Disable interrupt for DISABLED event
DISABLED : INTENCLR_DISABLED_Field_1 :=
Intenclr_Disabled_Field_Reset;
-- Write '1' to Disable interrupt for DEVMATCH event
DEVMATCH : INTENCLR_DEVMATCH_Field_1 :=
Intenclr_Devmatch_Field_Reset;
-- Write '1' to Disable interrupt for DEVMISS event
DEVMISS : INTENCLR_DEVMISS_Field_1 :=
Intenclr_Devmiss_Field_Reset;
-- Write '1' to Disable interrupt for RSSIEND event
RSSIEND : INTENCLR_RSSIEND_Field_1 :=
Intenclr_Rssiend_Field_Reset;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Write '1' to Disable interrupt for BCMATCH event
BCMATCH : INTENCLR_BCMATCH_Field_1 :=
Intenclr_Bcmatch_Field_Reset;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Write '1' to Disable interrupt for CRCOK event
CRCOK : INTENCLR_CRCOK_Field_1 := Intenclr_Crcok_Field_Reset;
-- Write '1' to Disable interrupt for CRCERROR event
CRCERROR : INTENCLR_CRCERROR_Field_1 :=
Intenclr_Crcerror_Field_Reset;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
READY at 0 range 0 .. 0;
ADDRESS at 0 range 1 .. 1;
PAYLOAD at 0 range 2 .. 2;
END_k at 0 range 3 .. 3;
DISABLED at 0 range 4 .. 4;
DEVMATCH at 0 range 5 .. 5;
DEVMISS at 0 range 6 .. 6;
RSSIEND at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
BCMATCH at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CRCOK at 0 range 12 .. 12;
CRCERROR at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-- CRC status of packet received
type CRCSTATUS_CRCSTATUS_Field is
(-- Packet received with CRC error
Crcerror,
-- Packet received with CRC ok
Crcok)
with Size => 1;
for CRCSTATUS_CRCSTATUS_Field use
(Crcerror => 0,
Crcok => 1);
-- CRC status
type CRCSTATUS_Register is record
-- Read-only. CRC status of packet received
CRCSTATUS : CRCSTATUS_CRCSTATUS_Field;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CRCSTATUS_Register use record
CRCSTATUS at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype RXMATCH_RXMATCH_Field is HAL.UInt3;
-- Received address
type RXMATCH_Register is record
-- Read-only. Received address
RXMATCH : RXMATCH_RXMATCH_Field;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RXMATCH_Register use record
RXMATCH at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype RXCRC_RXCRC_Field is HAL.UInt24;
-- CRC field of previously received packet
type RXCRC_Register is record
-- Read-only. CRC field of previously received packet
RXCRC : RXCRC_RXCRC_Field;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RXCRC_Register use record
RXCRC at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype DAI_DAI_Field is HAL.UInt3;
-- Device address match index
type DAI_Register is record
-- Read-only. Device address match index
DAI : DAI_DAI_Field;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DAI_Register use record
DAI at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype FREQUENCY_FREQUENCY_Field is HAL.UInt7;
-- Channel map selection.
type FREQUENCY_MAP_Field is
(-- Channel map between 2400 MHZ .. 2500 MHz
Default,
-- Channel map between 2360 MHZ .. 2460 MHz
Low)
with Size => 1;
for FREQUENCY_MAP_Field use
(Default => 0,
Low => 1);
-- Frequency
type FREQUENCY_Register is record
-- Radio channel frequency
FREQUENCY : FREQUENCY_FREQUENCY_Field := 16#2#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Channel map selection.
MAP : FREQUENCY_MAP_Field := NRF_SVD.RADIO.Default;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FREQUENCY_Register use record
FREQUENCY at 0 range 0 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
MAP at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- RADIO output power.
type TXPOWER_TXPOWER_Field is
(-- 0 dBm
Val_0DBm,
-- +3 dBm
Pos3DBm,
-- +4 dBm
Pos4DBm,
-- -40 dBm
Neg40DBm,
-- -20 dBm
Neg20DBm,
-- -16 dBm
Neg16DBm,
-- -12 dBm
Neg12DBm,
-- -8 dBm
Neg8DBm,
-- -4 dBm
Neg4DBm,
-- Deprecated enumerator - -40 dBm
Neg30DBm)
with Size => 8;
for TXPOWER_TXPOWER_Field use
(Val_0DBm => 0,
Pos3DBm => 3,
Pos4DBm => 4,
Neg40DBm => 216,
Neg20DBm => 236,
Neg16DBm => 240,
Neg12DBm => 244,
Neg8DBm => 248,
Neg4DBm => 252,
Neg30DBm => 255);
-- Output power
type TXPOWER_Register is record
-- RADIO output power.
TXPOWER : TXPOWER_TXPOWER_Field := NRF_SVD.RADIO.Val_0DBm;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TXPOWER_Register use record
TXPOWER at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Radio data rate and modulation setting. The radio supports
-- Frequency-shift Keying (FSK) modulation.
type MODE_MODE_Field is
(-- 1 Mbit/s Nordic proprietary radio mode
Nrf_1Mbit,
-- 2 Mbit/s Nordic proprietary radio mode
Nrf_2Mbit,
-- Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode
Nrf_250Kbit,
-- 1 Mbit/s Bluetooth Low Energy
Ble_1Mbit,
-- 2 Mbit/s Bluetooth Low Energy
Ble_2Mbit)
with Size => 4;
for MODE_MODE_Field use
(Nrf_1Mbit => 0,
Nrf_2Mbit => 1,
Nrf_250Kbit => 2,
Ble_1Mbit => 3,
Ble_2Mbit => 4);
-- Data rate and modulation
type MODE_Register is record
-- Radio data rate and modulation setting. The radio supports
-- Frequency-shift Keying (FSK) modulation.
MODE : MODE_MODE_Field := NRF_SVD.RADIO.Nrf_1Mbit;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MODE_Register use record
MODE at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype PCNF0_LFLEN_Field is HAL.UInt4;
subtype PCNF0_S1LEN_Field is HAL.UInt4;
-- Include or exclude S1 field in RAM
type PCNF0_S1INCL_Field is
(-- Include S1 field in RAM only if S1LEN > 0
Automatic,
-- Always include S1 field in RAM independent of S1LEN
Include)
with Size => 1;
for PCNF0_S1INCL_Field use
(Automatic => 0,
Include => 1);
-- Length of preamble on air. Decision point: TASKS_START task
type PCNF0_PLEN_Field is
(-- 8-bit preamble
Val_8BIT,
-- 16-bit preamble
Val_16BIT)
with Size => 1;
for PCNF0_PLEN_Field use
(Val_8BIT => 0,
Val_16BIT => 1);
-- Packet configuration register 0
type PCNF0_Register is record
-- Length on air of LENGTH field in number of bits.
LFLEN : PCNF0_LFLEN_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Length on air of S0 field in number of bytes.
S0LEN : Boolean := False;
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- Length on air of S1 field in number of bits.
S1LEN : PCNF0_S1LEN_Field := 16#0#;
-- Include or exclude S1 field in RAM
S1INCL : PCNF0_S1INCL_Field := NRF_SVD.RADIO.Automatic;
-- unspecified
Reserved_21_23 : HAL.UInt3 := 16#0#;
-- Length of preamble on air. Decision point: TASKS_START task
PLEN : PCNF0_PLEN_Field := NRF_SVD.RADIO.Val_8BIT;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PCNF0_Register use record
LFLEN at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
S0LEN at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
S1LEN at 0 range 16 .. 19;
S1INCL at 0 range 20 .. 20;
Reserved_21_23 at 0 range 21 .. 23;
PLEN at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype PCNF1_MAXLEN_Field is HAL.UInt8;
subtype PCNF1_STATLEN_Field is HAL.UInt8;
subtype PCNF1_BALEN_Field is HAL.UInt3;
-- On air endianness of packet, this applies to the S0, LENGTH, S1 and the
-- PAYLOAD fields.
type PCNF1_ENDIAN_Field is
(-- Least Significant bit on air first
Little,
-- Most significant bit on air first
Big)
with Size => 1;
for PCNF1_ENDIAN_Field use
(Little => 0,
Big => 1);
-- Enable or disable packet whitening
type PCNF1_WHITEEN_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for PCNF1_WHITEEN_Field use
(Disabled => 0,
Enabled => 1);
-- Packet configuration register 1
type PCNF1_Register is record
-- Maximum length of packet payload. If the packet payload is larger
-- than MAXLEN, the radio will truncate the payload to MAXLEN.
MAXLEN : PCNF1_MAXLEN_Field := 16#0#;
-- Static length in number of bytes
STATLEN : PCNF1_STATLEN_Field := 16#0#;
-- Base address length in number of bytes
BALEN : PCNF1_BALEN_Field := 16#0#;
-- unspecified
Reserved_19_23 : HAL.UInt5 := 16#0#;
-- On air endianness of packet, this applies to the S0, LENGTH, S1 and
-- the PAYLOAD fields.
ENDIAN : PCNF1_ENDIAN_Field := NRF_SVD.RADIO.Little;
-- Enable or disable packet whitening
WHITEEN : PCNF1_WHITEEN_Field := NRF_SVD.RADIO.Disabled;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PCNF1_Register use record
MAXLEN at 0 range 0 .. 7;
STATLEN at 0 range 8 .. 15;
BALEN at 0 range 16 .. 18;
Reserved_19_23 at 0 range 19 .. 23;
ENDIAN at 0 range 24 .. 24;
WHITEEN at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- PREFIX0_AP array element
subtype PREFIX0_AP_Element is HAL.UInt8;
-- PREFIX0_AP array
type PREFIX0_AP_Field_Array is array (0 .. 3) of PREFIX0_AP_Element
with Component_Size => 8, Size => 32;
-- Prefixes bytes for logical addresses 0-3
type PREFIX0_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AP as a value
Val : HAL.UInt32;
when True =>
-- AP as an array
Arr : PREFIX0_AP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PREFIX0_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- PREFIX1_AP array element
subtype PREFIX1_AP_Element is HAL.UInt8;
-- PREFIX1_AP array
type PREFIX1_AP_Field_Array is array (4 .. 7) of PREFIX1_AP_Element
with Component_Size => 8, Size => 32;
-- Prefixes bytes for logical addresses 4-7
type PREFIX1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AP as a value
Val : HAL.UInt32;
when True =>
-- AP as an array
Arr : PREFIX1_AP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PREFIX1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
subtype TXADDRESS_TXADDRESS_Field is HAL.UInt3;
-- Transmit address select
type TXADDRESS_Register is record
-- Transmit address select
TXADDRESS : TXADDRESS_TXADDRESS_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TXADDRESS_Register use record
TXADDRESS at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Enable or disable reception on logical address 0.
type RXADDRESSES_ADDR0_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for RXADDRESSES_ADDR0_Field use
(Disabled => 0,
Enabled => 1);
-- RXADDRESSES_ADDR array
type RXADDRESSES_ADDR_Field_Array is array (0 .. 7)
of RXADDRESSES_ADDR0_Field
with Component_Size => 1, Size => 8;
-- Type definition for RXADDRESSES_ADDR
type RXADDRESSES_ADDR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ADDR as a value
Val : HAL.UInt8;
when True =>
-- ADDR as an array
Arr : RXADDRESSES_ADDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for RXADDRESSES_ADDR_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Receive address select
type RXADDRESSES_Register is record
-- Enable or disable reception on logical address 0.
ADDR : RXADDRESSES_ADDR_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RXADDRESSES_Register use record
ADDR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- CRC length in number of bytes.
type CRCCNF_LEN_Field is
(-- CRC length is zero and CRC calculation is disabled
Disabled,
-- CRC length is one byte and CRC calculation is enabled
One,
-- CRC length is two bytes and CRC calculation is enabled
Two,
-- CRC length is three bytes and CRC calculation is enabled
Three)
with Size => 2;
for CRCCNF_LEN_Field use
(Disabled => 0,
One => 1,
Two => 2,
Three => 3);
-- Include or exclude packet address field out of CRC calculation.
type CRCCNF_SKIPADDR_Field is
(-- CRC calculation includes address field
Include,
-- CRC calculation does not include address field. The CRC calculation will
-- start at the first byte after the address.
Skip)
with Size => 1;
for CRCCNF_SKIPADDR_Field use
(Include => 0,
Skip => 1);
-- CRC configuration
type CRCCNF_Register is record
-- CRC length in number of bytes.
LEN : CRCCNF_LEN_Field := NRF_SVD.RADIO.Disabled;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
-- Include or exclude packet address field out of CRC calculation.
SKIPADDR : CRCCNF_SKIPADDR_Field := NRF_SVD.RADIO.Include;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CRCCNF_Register use record
LEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
SKIPADDR at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
subtype CRCPOLY_CRCPOLY_Field is HAL.UInt24;
-- CRC polynomial
type CRCPOLY_Register is record
-- CRC polynomial
CRCPOLY : CRCPOLY_CRCPOLY_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CRCPOLY_Register use record
CRCPOLY at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype CRCINIT_CRCINIT_Field is HAL.UInt24;
-- CRC initial value
type CRCINIT_Register is record
-- CRC initial value
CRCINIT : CRCINIT_CRCINIT_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CRCINIT_Register use record
CRCINIT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype TIFS_TIFS_Field is HAL.UInt8;
-- Inter Frame Spacing in us
type TIFS_Register is record
-- Inter Frame Spacing in us
TIFS : TIFS_TIFS_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TIFS_Register use record
TIFS at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype RSSISAMPLE_RSSISAMPLE_Field is HAL.UInt7;
-- RSSI sample
type RSSISAMPLE_Register is record
-- Read-only. RSSI sample
RSSISAMPLE : RSSISAMPLE_RSSISAMPLE_Field;
-- unspecified
Reserved_7_31 : HAL.UInt25;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RSSISAMPLE_Register use record
RSSISAMPLE at 0 range 0 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Current radio state
type STATE_STATE_Field is
(-- RADIO is in the Disabled state
Disabled,
-- RADIO is in the RXRU state
Rxru,
-- RADIO is in the RXIDLE state
Rxidle,
-- RADIO is in the RX state
Rx,
-- RADIO is in the RXDISABLED state
Rxdisable,
-- RADIO is in the TXRU state
Txru,
-- RADIO is in the TXIDLE state
Txidle,
-- RADIO is in the TX state
Tx,
-- RADIO is in the TXDISABLED state
Txdisable)
with Size => 4;
for STATE_STATE_Field use
(Disabled => 0,
Rxru => 1,
Rxidle => 2,
Rx => 3,
Rxdisable => 4,
Txru => 9,
Txidle => 10,
Tx => 11,
Txdisable => 12);
-- Current radio state
type STATE_Register is record
-- Read-only. Current radio state
STATE : STATE_STATE_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for STATE_Register use record
STATE at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype DATAWHITEIV_DATAWHITEIV_Field is HAL.UInt7;
-- Data whitening initial value
type DATAWHITEIV_Register is record
-- Data whitening initial value. Bit 6 is hard-wired to '1', writing '0'
-- to it has no effect, and it will always be read back and used by the
-- device as '1'.
DATAWHITEIV : DATAWHITEIV_DATAWHITEIV_Field := 16#40#;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DATAWHITEIV_Register use record
DATAWHITEIV at 0 range 0 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Description collection[0]: Device address base segment 0
-- Description collection[0]: Device address base segment 0
type DAB_Registers is array (0 .. 7) of HAL.UInt32;
subtype DAP_DAP_Field is HAL.UInt16;
-- Description collection[0]: Device address prefix 0
type DAP_Register is record
-- Device address prefix 0
DAP : DAP_DAP_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DAP_Register use record
DAP at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Description collection[0]: Device address prefix 0
type DAP_Registers is array (0 .. 7) of DAP_Register;
-- Enable or disable device address matching using device address 0
type DACNF_ENA0_Field is
(-- Disabled
Disabled,
-- Enabled
Enabled)
with Size => 1;
for DACNF_ENA0_Field use
(Disabled => 0,
Enabled => 1);
-- DACNF_ENA array
type DACNF_ENA_Field_Array is array (0 .. 7) of DACNF_ENA0_Field
with Component_Size => 1, Size => 8;
-- Type definition for DACNF_ENA
type DACNF_ENA_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ENA as a value
Val : HAL.UInt8;
when True =>
-- ENA as an array
Arr : DACNF_ENA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for DACNF_ENA_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- DACNF_TXADD array
type DACNF_TXADD_Field_Array is array (0 .. 7) of Boolean
with Component_Size => 1, Size => 8;
-- Type definition for DACNF_TXADD
type DACNF_TXADD_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TXADD as a value
Val : HAL.UInt8;
when True =>
-- TXADD as an array
Arr : DACNF_TXADD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for DACNF_TXADD_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Device address match configuration
type DACNF_Register is record
-- Enable or disable device address matching using device address 0
ENA : DACNF_ENA_Field := (As_Array => False, Val => 16#0#);
-- TxAdd for device address 0
TXADD : DACNF_TXADD_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DACNF_Register use record
ENA at 0 range 0 .. 7;
TXADD at 0 range 8 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Radio ramp-up time
type MODECNF0_RU_Field is
(-- Default ramp-up time (tRXEN), compatible with firmware written for nRF51
Default,
-- Fast ramp-up (tRXEN,FAST), see electrical specification for more
-- information
Fast)
with Size => 1;
for MODECNF0_RU_Field use
(Default => 0,
Fast => 1);
-- Default TX value
type MODECNF0_DTX_Field is
(-- Transmit '1'
B1,
-- Transmit '0'
B0,
-- Transmit center frequency
Center)
with Size => 2;
for MODECNF0_DTX_Field use
(B1 => 0,
B0 => 1,
Center => 2);
-- Radio mode configuration register 0
type MODECNF0_Register is record
-- Radio ramp-up time
RU : MODECNF0_RU_Field := NRF_SVD.RADIO.Default;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
-- Default TX value
DTX : MODECNF0_DTX_Field := NRF_SVD.RADIO.Center;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MODECNF0_Register use record
RU at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
DTX at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Peripheral power control. The peripheral and its registers will be reset
-- to its initial state by switching the peripheral off and then back on
-- again.
type POWER_POWER_Field is
(-- Peripheral is powered off
Disabled,
-- Peripheral is powered on
Enabled)
with Size => 1;
for POWER_POWER_Field use
(Disabled => 0,
Enabled => 1);
-- Peripheral power control
type POWER_Register is record
-- Peripheral power control. The peripheral and its registers will be
-- reset to its initial state by switching the peripheral off and then
-- back on again.
POWER : POWER_POWER_Field := NRF_SVD.RADIO.Enabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_Register use record
POWER at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- 2.4 GHz Radio
type RADIO_Peripheral is record
-- Enable RADIO in TX mode
TASKS_TXEN : aliased HAL.UInt32;
-- Enable RADIO in RX mode
TASKS_RXEN : aliased HAL.UInt32;
-- Start RADIO
TASKS_START : aliased HAL.UInt32;
-- Stop RADIO
TASKS_STOP : aliased HAL.UInt32;
-- Disable RADIO
TASKS_DISABLE : aliased HAL.UInt32;
-- Start the RSSI and take one single sample of the receive signal
-- strength.
TASKS_RSSISTART : aliased HAL.UInt32;
-- Stop the RSSI measurement
TASKS_RSSISTOP : aliased HAL.UInt32;
-- Start the bit counter
TASKS_BCSTART : aliased HAL.UInt32;
-- Stop the bit counter
TASKS_BCSTOP : aliased HAL.UInt32;
-- RADIO has ramped up and is ready to be started
EVENTS_READY : aliased HAL.UInt32;
-- Address sent or received
EVENTS_ADDRESS : aliased HAL.UInt32;
-- Packet payload sent or received
EVENTS_PAYLOAD : aliased HAL.UInt32;
-- Packet sent or received
EVENTS_END : aliased HAL.UInt32;
-- RADIO has been disabled
EVENTS_DISABLED : aliased HAL.UInt32;
-- A device address match occurred on the last received packet
EVENTS_DEVMATCH : aliased HAL.UInt32;
-- No device address match occurred on the last received packet
EVENTS_DEVMISS : aliased HAL.UInt32;
-- Sampling of receive signal strength complete.
EVENTS_RSSIEND : aliased HAL.UInt32;
-- Bit counter reached bit count value.
EVENTS_BCMATCH : aliased HAL.UInt32;
-- Packet received with CRC ok
EVENTS_CRCOK : aliased HAL.UInt32;
-- Packet received with CRC error
EVENTS_CRCERROR : aliased HAL.UInt32;
-- Shortcut register
SHORTS : aliased SHORTS_Register;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- CRC status
CRCSTATUS : aliased CRCSTATUS_Register;
-- Received address
RXMATCH : aliased RXMATCH_Register;
-- CRC field of previously received packet
RXCRC : aliased RXCRC_Register;
-- Device address match index
DAI : aliased DAI_Register;
-- Packet pointer
PACKETPTR : aliased HAL.UInt32;
-- Frequency
FREQUENCY : aliased FREQUENCY_Register;
-- Output power
TXPOWER : aliased TXPOWER_Register;
-- Data rate and modulation
MODE : aliased MODE_Register;
-- Packet configuration register 0
PCNF0 : aliased PCNF0_Register;
-- Packet configuration register 1
PCNF1 : aliased PCNF1_Register;
-- Base address 0
BASE0 : aliased HAL.UInt32;
-- Base address 1
BASE1 : aliased HAL.UInt32;
-- Prefixes bytes for logical addresses 0-3
PREFIX0 : aliased PREFIX0_Register;
-- Prefixes bytes for logical addresses 4-7
PREFIX1 : aliased PREFIX1_Register;
-- Transmit address select
TXADDRESS : aliased TXADDRESS_Register;
-- Receive address select
RXADDRESSES : aliased RXADDRESSES_Register;
-- CRC configuration
CRCCNF : aliased CRCCNF_Register;
-- CRC polynomial
CRCPOLY : aliased CRCPOLY_Register;
-- CRC initial value
CRCINIT : aliased CRCINIT_Register;
-- Unspecified
UNUSED0 : aliased HAL.UInt32;
-- Inter Frame Spacing in us
TIFS : aliased TIFS_Register;
-- RSSI sample
RSSISAMPLE : aliased RSSISAMPLE_Register;
-- Current radio state
STATE : aliased STATE_Register;
-- Data whitening initial value
DATAWHITEIV : aliased DATAWHITEIV_Register;
-- Bit counter compare
BCC : aliased HAL.UInt32;
-- Description collection[0]: Device address base segment 0
DAB : aliased DAB_Registers;
-- Description collection[0]: Device address prefix 0
DAP : aliased DAP_Registers;
-- Device address match configuration
DACNF : aliased DACNF_Register;
-- Radio mode configuration register 0
MODECNF0 : aliased MODECNF0_Register;
-- Peripheral power control
POWER : aliased POWER_Register;
end record
with Volatile;
for RADIO_Peripheral use record
TASKS_TXEN at 16#0# range 0 .. 31;
TASKS_RXEN at 16#4# range 0 .. 31;
TASKS_START at 16#8# range 0 .. 31;
TASKS_STOP at 16#C# range 0 .. 31;
TASKS_DISABLE at 16#10# range 0 .. 31;
TASKS_RSSISTART at 16#14# range 0 .. 31;
TASKS_RSSISTOP at 16#18# range 0 .. 31;
TASKS_BCSTART at 16#1C# range 0 .. 31;
TASKS_BCSTOP at 16#20# range 0 .. 31;
EVENTS_READY at 16#100# range 0 .. 31;
EVENTS_ADDRESS at 16#104# range 0 .. 31;
EVENTS_PAYLOAD at 16#108# range 0 .. 31;
EVENTS_END at 16#10C# range 0 .. 31;
EVENTS_DISABLED at 16#110# range 0 .. 31;
EVENTS_DEVMATCH at 16#114# range 0 .. 31;
EVENTS_DEVMISS at 16#118# range 0 .. 31;
EVENTS_RSSIEND at 16#11C# range 0 .. 31;
EVENTS_BCMATCH at 16#128# range 0 .. 31;
EVENTS_CRCOK at 16#130# range 0 .. 31;
EVENTS_CRCERROR at 16#134# range 0 .. 31;
SHORTS at 16#200# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
CRCSTATUS at 16#400# range 0 .. 31;
RXMATCH at 16#408# range 0 .. 31;
RXCRC at 16#40C# range 0 .. 31;
DAI at 16#410# range 0 .. 31;
PACKETPTR at 16#504# range 0 .. 31;
FREQUENCY at 16#508# range 0 .. 31;
TXPOWER at 16#50C# range 0 .. 31;
MODE at 16#510# range 0 .. 31;
PCNF0 at 16#514# range 0 .. 31;
PCNF1 at 16#518# range 0 .. 31;
BASE0 at 16#51C# range 0 .. 31;
BASE1 at 16#520# range 0 .. 31;
PREFIX0 at 16#524# range 0 .. 31;
PREFIX1 at 16#528# range 0 .. 31;
TXADDRESS at 16#52C# range 0 .. 31;
RXADDRESSES at 16#530# range 0 .. 31;
CRCCNF at 16#534# range 0 .. 31;
CRCPOLY at 16#538# range 0 .. 31;
CRCINIT at 16#53C# range 0 .. 31;
UNUSED0 at 16#540# range 0 .. 31;
TIFS at 16#544# range 0 .. 31;
RSSISAMPLE at 16#548# range 0 .. 31;
STATE at 16#550# range 0 .. 31;
DATAWHITEIV at 16#554# range 0 .. 31;
BCC at 16#560# range 0 .. 31;
DAB at 16#600# range 0 .. 255;
DAP at 16#620# range 0 .. 255;
DACNF at 16#640# range 0 .. 31;
MODECNF0 at 16#650# range 0 .. 31;
POWER at 16#FFC# range 0 .. 31;
end record;
-- 2.4 GHz Radio
RADIO_Periph : aliased RADIO_Peripheral
with Import, Address => RADIO_Base;
end NRF_SVD.RADIO;
|
programs/oeis/214/A214721.asm | neoneye/loda | 22 | 9596 | ; A214721: Least m>0 such that 2*n+1+m and n-m are not relatively prime.
; 1,2,1,4,1,6,1,3,1,10,1,12,1,14,1,2,1,3,1,20,1,22,1,24,1,26,1,3,1,2,1,32,1,34,1,36,1,3,1,7,1,42,1,2,1,46,1,3,1,50,1,52,1,54,1,4,1,2,1,60,1,7,1,64,1,66,1,3,1,70,1,2,1,74,1,76,1,3,1,80,1,4,1,7,1,2,1,3,1,90,1,92,1,94,1,11,1,3,1,2
mov $1,1
mov $2,$0
lpb $0
add $1,3
gcd $0,$1
sub $2,1
mul $0,$2
lpe
div $1,3
add $1,1
mov $0,$1
|
src/com/seculayer/seql/parser/SeQL.g4 | seculayer/SeQL | 36 | 2206 | grammar SeQL;
mainQ
: (proc=PROC_BY_FILE)? query=pipe_query SEMI?
;
pipe_query
: ds=ds_query proc=pipe_proc_group?
;
ds_query
:
search=pipe_search_group #dsSearch
| file=ds_file #dsFile
| rdb=ds_rdb #dsRdb
| join=join_clause #dsJoin
| union=union_list #dsUnion
| json=json_file #dsJson
| tbl=ds_table #dsTable
| parallel=cluster_parallel #dsCluster
| show=show_reputations #dsReputations
| show=show_reput #dsShowReput
| drop=drop_reput #dsDropReput
| show=show_lookups #dsLookups
| show=show_lookup #dsShowLookup
| drop=drop_lookup #dsDropLookup
;
ds_file
:
FILE_PHRASE
;
ds_rdb
:
RDB_PHRASE
;
ds_table
:
TABLE_PHRASE
;
json_file
:
JSON_FILE (DQUOTE_PHRASE|SQUOTE_PHRASE)
;
join_clause
: LBRACK left=pipe_query RBRACK leftAlias=ID
joinType=join_type LBRACK right=pipe_query RBRACK rightAlias=ID
ON expr=op_eval_expr
;
union_list
:
union_clause+
;
union_clause
:
joinType=union_type? LBRACK right=pipe_query RBRACK
;
join_type
:
JOIN_DIRECTION? JOIN_TYPE
;
union_type
:
UNION_TYPE
;
cluster_parallel
:
CLUSTER_PARALLEL LBRACK (proc=PROC_BY_FILE)? query=pipe_query RBRACK
;
show_reputations
:
SHOW_REPUTATIONS
;
show_reput
:
SHOW_REPUTATION table=ID (PIPE filter=pipe_proc_filter)* (PIPE limit=pipe_proc_limit)?
;
drop_reput
:
DROP_REPUTATION table=ID
;
show_lookups
:
SHOW_LOOKUPS
;
show_lookup
:
SHOW_LOOKUP table=ID (PIPE filter=pipe_proc_filter)* (PIPE limit=pipe_proc_limit)?
;
drop_lookup
:
DROP_LOOKUP table=ID
;
/**--------------------------
** 1. Search
**--------------------------**/
pipe_search_group
:
searchClause (PIPE pipe_search)* (PIPE pipe_search_limit)?
| searchClause (PIPE pipe_group_search)*
;
pipe_search
: pipe_search_time
| pipe_search_in_clause
| pipe_search_storage
| pipe_search_fields
| pipe_search_sort
// | pipe_search_limit
;
pipe_group_search
: pipe_search_time
| pipe_search_in_clause
| pipe_search_storage
| pipe_search_groupby
| pipe_search_top_bottom
;
pipe_search_time
: LAST span=eval_expr timeType=TIME_TYPE
;
pipe_search_in_clause :
SEARCH id=join_id inNot=in_notin LBRACK query=pipe_query RBRACK
;
pipe_search_storage
: STORAGE FROM storage=ID
;
pipe_search_groupby
: GROUP BY idList=id_list
;
pipe_search_fields
: FIELDS idList=id_list
;
id_list :
ids (COMMA ids)*
;
ids :
ID
// | ID COLON ('avg'|'sum'|'max'|'min'|UINT)
// | APOSTRO ids APOSTRO
| gid=group_id
;
group_id :
groupFunc=('SUBSTR' | GROUP_FUNC) LPAREN id=ID (COMMA num=UINT)? RPAREN
;
pipe_search_sort
: SORT sort_clause (COMMA sort_clause)*
;
pipe_search_top_bottom
: topBot=top_bottom evExpr=UINT
;
pipe_search_limit
: limitType=LIMIT expr1=UINT expr2=UINT
| limitType=UNLIMIT
;
sort_clause
: sid=alias_name sort=ASC_DES
;
top_bottom
: (TOP|BOTTOM)
;
head_tail
: (HEAD|TAIL)
;
/**--------------------------
** 2. Processing(Stat, Convert...)
**--------------------------**/
pipe_proc_group
:
(PIPE proc=pipe_proc)+
;
pipe_proc
: pipe_proc_stats
| pipe_proc_filter
| pipe_proc_convert
| pipe_proc_sort
| pipe_proc_limit
| pipe_proc_head_tail
| pipe_output_print
| pipe_output_file
| pipe_output_db
| pipe_output_table
| pipe_output_reput
| pipe_output_lookup
;
//--------------------------
// Statistic statement
//--------------------------
pipe_proc_stats
:
STATS stats_func_alias (COMMA stats_func_alias)* BY alias_name (COMMA alias_name)*
;
stats_func_alias :
(statFunc=stats_function|func=function) AS alias=alias_name
;
stats_function
: funcNm=GROUP_FUNC (LPAREN args=arguments? RPAREN)?
;
//--------------------------
// Convert statement
//--------------------------
pipe_proc_convert :
CONVERT func_alias (COMMA func_alias)*
;
func_alias :
func=function AS alias=alias_name
;
function
: funcNm=functionName (LPAREN args=arguments? RPAREN)?
| LPAREN caseFunc=case_function RPAREN
| caseFunc=case_function
| text=SQUOTE_PHRASE
;
functionName
:
ID
| TIME_TYPE
| ID DOT ID
;
case_function
: 'CASE' ('WHEN' op_eval_expr 'THEN' arg_expr)+ ('ELSE' elsVal=arg_expr)? 'END'
;
arguments
: arg_expr (COMMA arg_expr )*
;
arg_expr
: left=arg_expr op=OPER right=arg_expr #argOper
| left=arg_expr op=AND right=arg_expr #argAnd
| left=arg_expr op=OR right=arg_expr #argOr
// | LPAREN expr=arg_expr RPAREN #argParen
| bool=BOOL #argBool
| text=SQUOTE_PHRASE #argText
| number=numeric #argNumber
| id=join_id #argId
| func=stats_function #argStatFunc
| func=function #argFunc
| eval=eval_expr #argEval
| STAR #argAsterik
;
op_eval_expr :
left=eval_expr op=AND right=eval_expr #opEvalAnd
| left=eval_expr op=OR right=eval_expr #opEvalOr
| LPAREN expr=op_eval_expr RPAREN #opParen
| left=eval_expr #opEval
| left=op_eval_expr op=AND right=eval_expr #opEvalExprAnd
| left=op_eval_expr op=OR right=eval_expr #opEvalExprOr
;
eval_expr :
left=eval_expr op=mathOp right=eval_expr #evalCalc
| left=eval_expr op=OPER right=eval_expr #evalOper
| LPAREN eval_expr RPAREN #evalParen
| trunc=truncated #evalTrunc
| number=numeric #evalAtomr
// | id=ID #evalId
| id=join_id #evalId
| text=SQUOTE_PHRASE #evalText
| text=DQUOTE_PHRASE #evalDquoteText
| func=function #evalFunction
;
join_id :
ID '.' ID
| ID
;
alias_name :
join_id
| DQUOTE_PHRASE
;
mathOp:
(PLUS | MINUS | STAR | SLASH | PER)
;
//--------------------------
// Filter statement
//--------------------------
pipe_proc_filter
:
WHERE filter=filter_logical
;
filter_logical :
LPAREN filter=filter_logical RPAREN #filterParen
| left=filter_logical fOper=OPER right=filter_logical #filterOper
| left=filter_logical op=AND right=filter_logical #filterAnd
| left=filter_logical op=OR right=filter_logical #filterOR
| left=eval_expr BETWEEN from=eval_expr AND to=eval_expr #filterBetween
| left=eval_expr REGEXP right=eval_expr #filterRegexp
| left=eval_expr fOper=like_oper right=eval_expr #filterLikeOper
| left=eval_expr fOper=null_oper #filterNullOper
| left=eval_expr inNot=in_notin LBRACK query=pipe_query RBRACK #filterInSearch
| left=eval_expr inNot=in_notin LPAREN exprs=expr_list RPAREN #filterInClause
| left=eval_expr #filterSingle
// | left=function #filterFunction
;
expr_list :
eval_expr (COMMA eval_expr)*
;
like_oper :
(LIKE | NOT LIKE)
;
null_oper :
(IS NULL | IS NOT NULL)
;
in_notin :
(IN | NOT IN)
;
//--------------------------
// Sort/Limit/Tail
//--------------------------
pipe_proc_sort
: SORT sort_clause (COMMA sort_clause)*
;
pipe_proc_limit
: LIMIT expr1=UINT expr2=UINT
;
pipe_proc_head_tail
: topBot=head_tail evExpr=UINT
;
/**--------------------------
** 3. Output
**--------------------------**/
pipe_output_print
: PRINT alias_name (COMMA alias_name)*
;
pipe_output_file
: fopt=OUTPUT_FILE_OPT (rewrite=REWRITE)?
;
pipe_output_db :
type1=SAVE_DB
| type2=SAVE_DB_QUERY
;
pipe_output_table
: table=OUTPUT_TABLE (rewrite=REWRITE)?
;
pipe_output_reput
: reput=(OUTPUT_REPUT|OUTPUT_REPUT_ALIAS)
;
pipe_output_lookup
: lookup=(OUTPUT_LOOKUP|OUTPUT_LOOKUP_ALIAS)
;
FILE_TYPE :
(TOJSON|TOCSV|TOFILE)
;
//OUTPUT_FILE_OPT :
// DQUOTE_PHRASE WS SEPARATOR_PHRASE? (WS* 'HEADER' EQ BOOL)?
// | DQUOTE_PHRASE WS ('HEADER' EQ BOOL)? (WS* SEPARATOR_PHRASE)?
// ;
OUTPUT_FILE_OPT :
FILE_TYPE WS DQUOTE_PHRASE (WS SEPARATOR_PHRASE)? (WS 'HEADER' EQ BOOL)?
| FILE_TYPE WS DQUOTE_PHRASE (WS 'HEADER' EQ BOOL)? (WS SEPARATOR_PHRASE)?
;
OUTPUT_TABLE :
'TOTABLE' WS 'tableName' WS? EQ WS? ID
;
OUTPUT_REPUT :
'TOREPUT' WS 'tableName' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'KEY' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS KEEP_TIME
;
OUTPUT_REPUT_ALIAS :
'TOREPUT' WS 'tableName' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'tableAlias' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'KEY' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS KEEP_TIME
;
KEEP_TIME :
'keepTime' WS? EQ WS? (SPAN WS)? UINT WS TIME_TYPE (WS ONCE)?
;
OUTPUT_LOOKUP :
'TOLOOKUP' WS 'tableName' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'KEY' WS? EQ WS? ID
;
OUTPUT_LOOKUP_ALIAS :
'TOLOOKUP' WS 'tableName' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'tableAlias' WS? EQ WS? (DQUOTE_PHRASE|SQUOTE_PHRASE) WS 'KEY' WS? EQ WS? ID
;
REWRITE :
'REWRITE' WS? EQ WS? BOOL
;
/* ================================================================
* = LuceneQL =
* ================================================================
*/
searchClause
:
clauseBasicList
;
clauseBasicList
:
clauseBasic (oper clauseBasic)*
;
clauseBasic
:
clauseGroup
| atom
| systemVariables
| systemList
;
clauseGroup
:
modifier? LPAREN search=clauseBasicList RPAREN term_modifier?
;
atom
:
modifier? mfld=field mval=multi_value term_modifier?
| modifier? fld=field? val=value term_modifier?
;
//SYSVAR(BLACK_IP)
systemVariables
: 'SYSVAR' LPAREN ID RPAREN
;
//SYSLIST(ATT_IP,src_ip=attack_src_ip,dst_ip=victim_dst_ip)
systemList
: 'SYSLIST' LPAREN ID RPAREN
;
field
:
FIELD
;
value
:
range=range_term
| ip=ip_type
| norm=normal
| trunc=truncated
| quot=quoted
| qmark=QMARK
| reg=regex
| any=anything
| star=STAR
;
anything
:
STAR COLON STAR
;
range_term
:
(LBRACK|LCURLY) left=range_value TO right=range_value (RBRACK|RCURLY)
;
range_value
:
truncated
| quoted
| ip_type
| normal
| STAR
;
multi_value
:
LPAREN vals=value+ RPAREN
;
normal
:
ID
| numeric
;
truncated
:
TERM_TRUNCATED
// (STAR|QMARK) (TERM_CHAR+ (QMARK|STAR))+ (TERM_CHAR)*
// | TERM_START_CHAR (TERM_CHAR* (QMARK|STAR))+ (TERM_CHAR)*
// | (STAR|QMARK) TERM_CHAR+
;
quoted :
DQUOTE_PHRASE
;
regex :
REGEX
;
modifier:
PLUS
| MINUS;
term_modifier :
boost fuzzy?
| fuzzy boost?
;
boost :
(CARAT) // set the default value
(numeric)? //replace the default with user input
;
fuzzy :
(TILDE) // set the default value
(numeric)? //replace the default with user input
;
not_ :
AND NOT
| NOT
;
oper :
and_
| or_
| not_
;
and_ :
AND
;
or_ :
OR
;
ip_type :
ip_v4
| ip_v6
;
ip_v4
: IPV4
;
ip_v6
: IPV6
;
numeric :
MINUS UINT '.' UINT
| UINT '.' UINT
| MINUS UINT
| UINT
;
/* ================================================================
* = LEXER =
* ================================================================
*/
fragment INT : '0' .. '9';
fragment ID_CHAR : ('a' .. 'z' | 'A' .. 'Z' | INT | '_');
fragment CHAR : ('a' .. 'z' | 'A' .. 'Z');
fragment IP_CHAR : ('a' .. 'f' | 'A' .. 'F');
fragment ESC_CHAR : '\\' .;
fragment EQ : '=';
fragment NEQ : '!=';
fragment LESS : '<';
fragment LESS_EQ : '<=';
fragment GREATER : '>';
fragment GREATER_EQ : '>=';
DOT : '.';
PIPE : '|';
SQUOTE : '\'';
APOSTRO : '`';
DQUOTE : '"';
LPAREN : '(';
RPAREN : ')';
LBRACK : '[';
RBRACK : ']';
LCURLY : '{' ;
RCURLY : '}' ;
COMMA : ',';
COLON : ':' ;
SEMI : ';' ;
PLUS : '+' ;
MINUS : '-';
STAR : '*' ;
QMARK : '?'+ ;
SLASH : '/';
PER : '%' ;
CARAT : '^' (INT+ ('.' INT+)?)?;
TILDE : '~' (INT+ ('.' INT+)?)?;
BETWEEN : 'BETWEEN' ;
REGEXP : 'REGEXP' ;
AND : 'AND' ;
OR : 'OR';
NOT : 'NOT';
ON : 'ON';
SEARCH : 'SEARCH';
IN : 'IN';
LAST : 'LAST';
STORAGE : 'STORAGE';
FROM : 'FROM';
GROUP : 'GROUP';
BY : 'BY';
FIELDS : 'FIELDS';
JSON_FILE : 'JSON' WS 'FILE';
//FILE : 'FILE';
RDB : 'RDB';
LOCAL : 'LOCAL';
SORT : 'SORT';
TOP : 'TOP';
BOTTOM : 'BOTTOM';
HEAD : 'HEAD';
TAIL : 'TAIL';
LIMIT : 'LIMIT';
UNLIMIT : 'UNLIMIT';
STATS : 'STATS';
IS : 'IS';
LIKE : 'LIKE';
WHERE : 'WHERE';
CONVERT : 'CONVERT';
ASC_DES : ('ASC'|'DESC');
AS : 'AS';
PRINT : 'PRINT';
TOJSON : 'TOJSON';
TOCSV : 'TOCSV';
TOFILE : 'TOFILE';
TODB : 'TODB';
TO : 'TO';
NULL : 'NULL';
SEPARATOR : 'SEPARATOR';
SPAN : 'SPAN';
ONCE : 'ONCE';
JOIN_TYPE
: 'INNER' WS 'JOIN'
| 'OUTER' WS 'JOIN'
;
JOIN_DIRECTION : ('LEFT'|'RIGHT'|'FULL');
UNION_TYPE : 'UNION' (WS 'ALL')?;
BOOL : ('true'|'false'|'TRUE'|'FALSE');
TIME_TYPE : ('SECOND'|'MINUTE'|'HOUR'|'DAY'|'MONTH'|'YEAR');
OPER : (EQ | NEQ | LESS | LESS_EQ | GREATER | GREATER_EQ);
//CALC : (PLUS | MINUS | STAR | SLASH | PER);
UINT : INT+;
//NUMBER
// : MINUS? INT+ (DOT INT+)?
// ;
GROUP_FUNC :
'COUNT'
| 'MAX'
| 'MIN'
| 'SUM'
| 'AVG'
| 'VALUES'
| 'DC'
| 'GROUP_CONCAT'
| 'STDEV'
;
ID : (APOSTRO ID APOSTRO | ID_CHAR+);
FIELD : (ID | STAR) COLON;
DQUOTE_PHRASE
: DQUOTE (ESC_CHAR|~('"'|'\\'))+ DQUOTE
;
SQUOTE_PHRASE
: SQUOTE (ESC_CHAR|~('\''|'\\'))* SQUOTE
;
SAVE_DB_QUERY :
TODB WS 'dbId' WS? EQ WS? ID WS 'queryStr' WS? EQ WS? LBRACK (ESC_CHAR|~('['|']'|'\\'))+ RBRACK
;
SAVE_DB :
TODB WS 'dbId' WS? EQ WS? ID WS 'tableName' WS? EQ WS? ID
;
SEPARATOR_PHRASE :
SEPARATOR WS* EQ WS* DQUOTE_PHRASE
;
FILE_PHRASE
: 'FILE' DOT ID WS* LBRACK WS* '*:*' WS* RBRACK
;
RDB_PHRASE
: RDB DOT ID WS* LBRACK (ESC_CHAR|~('['|']'|'\\'))+ RBRACK
;
TABLE_PHRASE
: 'TABLE' DOT 'LOCAL' WS* LBRACK (ESC_CHAR|~('['|']'|'\\'))+ RBRACK
;
REGEX
: SLASH (ESC_CHAR|~('/'|'\\'))+ SLASH
;
IPV4 :
UINT '.' UINT '.' UINT '.' UINT (SLASH UINT)?
;
PROC_BY_FILE
:
'@PROCESS_BY_FILE'
;
CLUSTER_PARALLEL
:
'CLUSTER' DOT 'PARALLEL'
;
SHOW_REPUTATIONS
:
'SHOW' WS 'REPUTATIONS'
;
SHOW_REPUTATION
:
'SHOW' WS 'REPUTATION' WS
;
DROP_REPUTATION
:
'DROP' WS 'REPUTATION' WS
;
SHOW_LOOKUPS
:
'SHOW' WS 'LOOKUP_TABLES'
;
SHOW_LOOKUP
:
'SHOW' WS 'LOOKUP_TABLE' WS
;
DROP_LOOKUP
:
'DROP' WS 'LOOKUP_TABLE' WS
;
IPV6 :
ESC_CHAR? (CHAR|COLON|INT) (ESC_CHAR|CHAR|COLON|INT)+ (SLASH INT+)?
;
//HEXDIG
// : INT
// | IP_CHAR
// ;
TERM_TRUNCATED:
(STAR|QMARK) (TERM_CHAR+ (QMARK|STAR))+ (TERM_CHAR)*
| TERM_START_CHAR (TERM_CHAR* (QMARK|STAR))+ (TERM_CHAR)*
| (STAR|QMARK) TERM_CHAR+
;
TERM_CHAR : (TERM_START_CHAR | '-' | '+');
TERM_START_CHAR
: (~(' ' | '\t' | '\n' | '\r' | '\u3000'
| '"'
| '(' | ')' | '[' | ']' | '{' | '}'
| '+' | '-' | '!' | ':' | '~' | '^'
| '?' | '*' | '\\'
)
| ESC_CHAR );
WS: [ \t\r\n]+ -> skip;
|
rom/dos/call.asm | hisahi/ellipse1100 | 0 | 5310 | <filename>rom/dos/call.asm
; Ellipse Workstation 1100 (fictitious computer)
; Ellipse DOS call vector
;
; Copyright (c) 2020 <NAME> (hisahi)
;
; 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.
;
; Written for the WLA-DX assembler
;
DOSCALLENTRY:
AXY16
CLD
PHP
PHB
PHA
SETBANK16 $80
LDA #$FFFF
ACC8
BIT DOSPAGE|DOSBUSY.W
STA DOSPAGE|DOSBUSY.W
ACC16
PLA
PLB
BVS DOSISBUSY
PHA
PHX
XBA
AND #$FF
CMP #$41
BCS DOSUNKFUNCPLXPLA
ASL A
TAX
; stack: K PC16 X16 A16 P8
ACC8
LDA 8,S
STA DOSLD|DOSPROGBANK.L
ACC16
LDA DOSBANKC|DOSCALLTABLE.L,X
STA DOSLC|DOSICALLVEC+1.L
PLX
PLA
PLP
JML DOSLC|DOSICALLVEC.L
DOSCALLEXIT:
PHP
ACC16
PHA
ACC8
LDA #$00
STA DOSLD|DOSBUSY.L
ACC16
PLA
PLP
RTL
DOSUNKFUNCPLXPLA:
PLX
PLA
PLP
DOSUNKFUNC:
LDA #DOS_ERR_UNK_FUNCTION
SEC
RTS
DOSISBUSY:
PLP
LDA #DOS_ERR_DOS_BUSY
SEC
RTL
DOSCALLTABLE:
.DW DOSTERMINATE.W ; $00 = terminate program
.DW DOSSTDINREAD.W ; $01 = read char from STDIN
.DW DOSSTDOUTWRITE.W ; $02 = write char to STDOUT
.DW DOSUNKFUNC.W ; $03 =
.DW DOSUNKFUNC.W ; $04 =
.DW DOSUNKFUNC.W ; $05 =
.DW DOSUNKFUNC.W ; $06 = direct console I/O
.DW DOSSTDINREADQUIET.W ; $07 = read char from STDIN w/ echo
.DW DOSSTDINREADRAW.W ; $08 = raw read char from STDIN
.DW DOSOUTPUTSTRING24.W ; $09 = output string ending in '$'
.DW DOSREADLINEINPUT.W ; $0A = read line of input
.DW DOSINPUTSTATUS.W ; $0B = get input status
.DW DOSFLUSHSTDIN.W ; $0C = flush stdin
.DW DOSFLUSHFILES.W ; $0D = flush all open files
.DW DOSSETDRIVE.W ; $0E = set active drive
.DW DOSOPENFILE.W ; $0F = open file
.DW DOSCLOSEFILE.W ; $10 = close file
.DW DOSFINDFIRST.W ; $11 = find first matching file
.DW DOSFINDNEXT.W ; $12 = find next matching file
.DW DOSDELETEFILE.W ; $13 = delete files
.DW DOSUNKFUNC.W ; $14 =
.DW DOSUNKFUNC.W ; $15 =
.DW DOSCREATEFILE.W ; $16 = create/truncate file
.DW DOSRENAMEFILE.W ; $17 = rename file
.DW DOSGETDRIVEINFO.W ; $18 = get drive info
.DW DOSOUTPUTSTRING00.W ; $19 = output string ending in '\0'
.DW DOSUNKFUNC.W ; $1A =
.DW DOSUNKFUNC.W ; $1B =
.DW DOSUNKFUNC.W ; $1C =
.DW DOSUNKFUNC.W ; $1D =
.DW DOSSETATTRS.W ; $1E = set file attributes
.DW DOSGETATTRS.W ; $1F = get file attributes
.DW DOSUNKFUNC.W ; $20 =
.DW DOSFILEREAD.W ; $21 = read from file
.DW DOSFILEWRITE.W ; $22 = write to file
.DW DOSFILEGETSIZE.W ; $23 = get file size
.DW DOSFILESEEK.W ; $24 = seek file
.DW DOSUNKFUNC.W ; $25 =
.DW DOSUNKFUNC.W ; $26 =
.DW DOSUNKFUNC.W ; $27 =
.DW DOSUNKFUNC.W ; $28 =
.DW DOSUNKFUNC.W ; $29 =
.DW DOSGETDATE.W ; $2A = get system date
.DW DOSSETDATE.W ; $2B = set system date
.DW DOSGETTIME.W ; $2C = get system time
.DW DOSSETTIME.W ; $2D = set system time
.DW DOSUNKFUNC.W ; $2E =
.DW DOSUNKFUNC.W ; $2F =
.DW DOSSETDIR.W ; $30 = set current directory
.DW DOSGETDIR.W ; $31 = get current directory
.DW DOSUNKFUNC.W ; $32 =
.DW DOSRMDIR.W ; $33 = delete (empty) directory
.DW DOSUNKFUNC.W ; $34 =
.DW DOSGETFREESPACE.W ; $35 = get free space
.DW DOSMKDIR.W ; $36 = create directory
.DW DOSMOVEENT.W ; $37 = move file entry
.DW DOSLAUNCH.W ; $38 = launch program
.DW DOSGETEXITCODE.W ; $39 = get exit code
.DW DOSALLOCMEM.W ; $3A = allocate memory
.DW DOSFREEMEM.W ; $3B = free memory allocation
.DW DOSREADFSMB.W ; $3C = read drive FSMB
.DW DOSUNKFUNC.W ; $3D =
.DW DOSGETDRIVE.W ; $3E = get active drive
.DW DOSGETVER.W ; $3F = get Ellipse DOS version
.DW DOSGETINBUF.W ; $40 = get address to INBUF
|
programs/oeis/094/A094258.asm | neoneye/loda | 22 | 9720 | <reponame>neoneye/loda
; A094258: a(1) = 1, a(n+1) = n*n! for n >= 1.
; 1,1,4,18,96,600,4320,35280,322560,3265920,36288000,439084800,5748019200,80951270400,1220496076800,19615115520000,334764638208000,6046686277632000,115242726703104000,2311256907767808000,48658040163532800000,1072909785605898240000,24728016011107368960000,594596384994354462720000,14890761641597746544640000,387780251083274649600000000,10485577989291746525184000000,293999475161295508340736000000,8536873649127988094042112000000,256411097818451356681764864000000,7957585794365731759089254400000000,254907998279515607349492449280000000
mov $2,$0
lpb $2
mul $0,$2
sub $2,1
lpe
trn $0,1
add $0,1
|
src/Tactic/Nat/Induction.agda | L-TChen/agda-prelude | 111 | 17177 | <reponame>L-TChen/agda-prelude<filename>src/Tactic/Nat/Induction.agda
module Tactic.Nat.Induction where
open import Prelude
nat-induction : (P : Nat → Set) → P 0 → (∀ n → P n → P (suc n)) → ∀ n → P n
nat-induction P base step zero = base
nat-induction P base step (suc n) = step n (nat-induction P base step n)
|
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/pstore32.asm | gb-archive/really-old-stuff | 10 | 24153 | <reponame>gb-archive/really-old-stuff<filename>mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/pstore32.asm
#include once <store32.asm>
; Stores a 32 bit integer number (DE,HL) at (IX + BC)
__PSTORE32:
push hl
push ix
pop hl
add hl, bc
pop bc
jp __STORE32
|
programs/oeis/176/A176032.asm | neoneye/loda | 22 | 25682 | ; A176032: Absolute values of A106044-A056892.
; 1,1,3,1,3,1,7,3,5,3,1,11,3,1,9,7,5,9,11,3,1,13,15,3,13,19,15,7,3,5,11,3,9,13,15,11,1,13,21,19,7,3,17,21,27,23,1,25,27,23,15,3,1,21,31,19,7,3,9,17,21,27,1,9,13,21,23,11,9,13,21,33,27,15,3,5,17,33,39,23,3,1,21,25
seq $0,40 ; The prime numbers.
sub $0,1
seq $0,4739 ; Concatenation of sequences (1,2,2,...,n-1,n-1,n,n,n-1,n-1,...,2,2,1) for n >= 1.
mul $0,2
sub $0,1
|
test/Fail/Issue5805.agda | KDr2/agda | 0 | 5090 | open import Agda.Builtin.Equality
cong : ∀{a b} {A : Set a} {B : Set b} (f : A → B) {x y : A} (eq : x ≡ y) → f x ≡ f y
cong f refl = refl
record Category : Set₂ where
field
Ob : Set₁
_⇒_ : Ob → Ob → Set
_∘_ : ∀ {O P Q} → P ⇒ Q → O ⇒ P → O ⇒ Q
-- Moving this out of the record fixes the problem.
idem : {X : Ob} → X ⇒ X → Set₁
idem {X} f = f ∘ f ≡ f → Set
Sets : Category
Sets = record
{ Ob = Set
; _⇒_ = {!!}
; _∘_ = λ f g x → f (g x)
}
open Category Sets
postulate
Y : Ob
f : Y ⇒ Y
idem-f : idem {X = _} f -- Solving the _ fixes the problem
idem-f ff≡f
with ffx≡fx ← cong {!!} ff≡f
= Y
|
programs/oeis/158/A158398.asm | neoneye/loda | 22 | 164206 | <reponame>neoneye/loda
; A158398: 784n^2 - 2n.
; 782,3132,7050,12536,19590,28212,38402,50160,63486,78380,94842,112872,132470,153636,176370,200672,226542,253980,282986,313560,345702,379412,414690,451536,489950,529932,571482,614600,659286,705540,753362,802752,853710,906236,960330,1015992,1073222,1132020,1192386,1254320,1317822,1382892,1449530,1517736,1587510,1658852,1731762,1806240,1882286,1959900,2039082,2119832,2202150,2286036,2371490,2458512,2547102,2637260,2728986,2822280,2917142,3013572,3111570,3211136,3312270,3414972,3519242,3625080,3732486,3841460,3952002,4064112,4177790,4293036,4409850,4528232,4648182,4769700,4892786,5017440,5143662,5271452,5400810,5531736,5664230,5798292,5933922,6071120,6209886,6350220,6492122,6635592,6780630,6927236,7075410,7225152,7376462,7529340,7683786,7839800
mov $1,14
mov $2,$0
add $2,1
mul $2,2
mul $1,$2
pow $1,2
sub $1,$2
mov $0,$1
|
third_party/antlr_grammars_v4/cto/CtoParser.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 4 | 3542 | /*
[The "BSD licence"]
Copyright (c) 2018 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
A grammar for Hyperledger Composer Modeling Language
https://hyperledger.github.io/composer/v0.19/reference/cto_language.html
*/
parser grammar CtoParser;
options { tokenVocab=CtoLexer; }
modelUnit
: namespaceDeclaration importDeclaration* typeDeclaration* EOF
;
namespaceDeclaration
: NAMESPACE qualifiedName
;
importDeclaration
: IMPORT qualifiedName ('.' '*')?
;
typeDeclaration
: (assetDeclaration
| conceptDeclaration
| enumDeclaration
| participantDeclaration
| transactionDeclaration
| eventDeclaration)
;
classModifier
: decorator
| ABSTRACT
;
assetDeclaration
: classModifier*
ASSET IDENTIFIER
extendsOrIdentified
classBody
;
conceptDeclaration
: classModifier*
CONCEPT IDENTIFIER
(EXTENDS IDENTIFIER)?
classBody
;
enumDeclaration
: ENUM IDENTIFIER '{' enumConstant* '}';
enumConstant
: VAR IDENTIFIER;
eventDeclaration
: EVENT IDENTIFIER
classBody
;
participantDeclaration
: classModifier*
PARTICIPANT IDENTIFIER
extendsOrIdentified
classBody
;
transactionDeclaration
: classModifier*
TRANSACTION IDENTIFIER
classBody
;
extendsOrIdentified: ((EXTENDS IDENTIFIER) | identified);
identified: (IDENTIFIED IDENTIFIER);
classBody
: '{' classBodyDeclaration* '}';
classBodyDeclaration
: ';'
| fieldDeclaration
;
fieldDeclaration
: stringField identifier defaultString? regexDeclaration? OPTIONAL?
| booleanField identifier defaultBoolean? OPTIONAL?
| numericField identifier defaultNumber? rangeValidation? OPTIONAL?
| dateField identifier defaultDate? OPTIONAL?
| identifierField identifier
| reference identifier;
identifierField
: VAR IDENTIFIER (square)*;
numericField
: VAR numericPrimitive (square)*;
numericPrimitive
: DOUBLE
| INTEGER
| LONG
;
booleanField
: VAR BOOLEAN (square)*;
dateField
: VAR DATE_TIME (square)*;
defaultDate
: DEFAULT ASSIGN DATE_TIME_LITERAL;
regexDeclaration
: REGEX ASSIGN REGEX_EXPR;
stringField
: VAR STRING (square)*;
reference
: REF IDENTIFIER (square)*;
qualifiedName
: IDENTIFIER ('.' IDENTIFIER)*;
rangeValidation
: RANGE ASSIGN rangeDeclaration;
rangeDeclaration
: ('[' numberLiteral ',' ']')
| ('[' ',' numberLiteral ']')
| ('[' numberLiteral ',' numberLiteral ']');
defaultBoolean
: (DEFAULT ASSIGN BOOL_LITERAL);
defaultString
: (DEFAULT ASSIGN stringLiteral);
defaultNumber
: (DEFAULT ASSIGN numberLiteral);
identifier: IDENTIFIER | ASSET | PARTICIPANT;
literal
: numberLiteral
| stringLiteral
| BOOL_LITERAL
;
numberLiteral
: integerLiteral
| floatLiteral;
stringLiteral
: CHAR_LITERAL
| STRING_LITERAL
;
integerLiteral
: DECIMAL_LITERAL
| OCT_LITERAL
;
floatLiteral
: FLOAT_LITERAL;
decorator
: AT qualifiedName ('(' elementValuePair ')')?;
elementValuePair
: literal (',' literal)*;
square: '[' ']'; |
boot/boot.asm | yds12/newcOS | 0 | 245946 | bits 16 ; 16 bit instructions
org 0x7c00 ; assume program will be loaded here
; address where the kernel should be loaded in memory
; (this will go to the segment register, so the actual
; address is this times 16)
KERNEL_OFFSET equ 0x1000
; Address for the stack we will create before entering the kernel
STACK_ADDR equ 0x90000
; setup a temporary stack (for push, call, ret, etc.)
mov bp, 0x9000
mov sp, bp
; setup video mode
mov ah, 0x00
mov al, 0x03 ; 80x25 text
int 0x10 ; BIOS interrupt
; print welcome msg
mov si, msg_hello
call print
; unfortunately in nasm relative paths are w.r.t.
; the working directory (from where we called nasm)
%include "boot/disk.asm"
; Perform memory mapping
%include "boot/rm_mmap.asm"
call prepare32
jmp $ ; infinite loop
%include "boot/gdt.asm"
%include "boot/print.asm"
prepare32:
cli ; disable BIOS interrupts
lgdt [gdt_descriptor] ; load GDT
mov eax, cr0 ; enable protected mode
or al, 1
mov cr0, eax
jmp CODE_SEG:start32 ; far jump
; from here on, 32 bit instructions
bits 32
start32:
mov ax, DATA_SEG ; update segment registers
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, STACK_ADDR ; setup another stack
mov esp, ebp
; Since now we are in a flat memory mode,
; an address xxx:0x0000 becomes xxx*16
; (the real memory address is the value of the segment multiplied by
; 16 and added to the offset)
call KERNEL_OFFSET * 16 ; give control to Kernel
jmp $ ; loop if kernel returns
; padding
times (510 - ($ - $$)) db 0 ; $: current offset
; $$: address of the current section
; for whatever reason, nasm says (510 - $) is not a constant
dw 0xaa55 ; magic word
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_37_93.asm | ljhsiun2/medusa | 9 | 105264 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xc7fc, %r8
nop
nop
nop
nop
nop
cmp %r12, %r12
mov (%r8), %r13w
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_normal_ht+0x1e720, %rsi
lea addresses_WT_ht+0x1c050, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
nop
add $41904, %r15
mov $38, %rcx
rep movsw
nop
sub $27880, %rbp
lea addresses_A_ht+0xf520, %rsi
lea addresses_normal_ht+0x49e0, %rdi
nop
nop
nop
sub %r8, %r8
mov $118, %rcx
rep movsb
cmp $3434, %rcx
lea addresses_WT_ht+0x9ea0, %r15
nop
nop
nop
nop
nop
xor $9546, %r8
movb $0x61, (%r15)
nop
nop
nop
cmp %r8, %r8
lea addresses_A_ht+0x11a00, %rsi
lea addresses_A_ht+0xcd20, %rdi
nop
nop
nop
nop
cmp %rbp, %rbp
mov $1, %rcx
rep movsw
nop
nop
nop
nop
add %rbp, %rbp
lea addresses_D_ht+0x7298, %rsi
lea addresses_WT_ht+0xd7c0, %rdi
nop
nop
nop
nop
add $41950, %r13
mov $64, %rcx
rep movsq
cmp $22250, %r8
lea addresses_D_ht+0x15120, %r15
nop
nop
nop
nop
cmp $2255, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, (%r15)
nop
nop
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_UC+0x11820, %r12
nop
nop
nop
sub $21019, %rcx
movb (%r12), %dl
xor %r12, %r12
// REPMOV
lea addresses_A+0x4de0, %rsi
lea addresses_WC+0x101a0, %rdi
inc %r8
mov $82, %rcx
rep movsb
xor %rcx, %rcx
// Store
lea addresses_PSE+0x7520, %rcx
nop
nop
nop
nop
nop
cmp %rdx, %rdx
movw $0x5152, (%rcx)
cmp $8157, %rdi
// REPMOV
lea addresses_normal+0xf120, %rsi
lea addresses_WT+0xd520, %rdi
nop
nop
sub $39956, %r12
mov $64, %rcx
rep movsq
nop
nop
inc %rdx
// Load
mov $0xb20, %rdi
nop
nop
nop
nop
nop
xor %r8, %r8
mov (%rdi), %cx
nop
nop
dec %rsi
// Store
lea addresses_A+0x196b0, %rdx
nop
nop
cmp %rsi, %rsi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm1
vmovups %ymm1, (%rdx)
// Exception!!!
nop
mov (0), %rsi
nop
nop
and $2170, %r12
// Store
mov $0x9de, %r10
nop
nop
xor $21051, %rdx
movw $0x5152, (%r10)
nop
nop
sub %rdx, %rdx
// Faulty Load
lea addresses_D+0xf920, %r8
xor %rdx, %rdx
movb (%r8), %r12b
lea oracles, %r10
and $0xff, %r12
shlq $12, %r12
mov (%r10,%r12,1), %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'36': 37}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
generated/natools-s_expressions-printers-pretty-config-commands-t.adb | faelys/natools | 0 | 4320 | -- Generated at 2014-06-02 19:12:04 +0000 by Natools.Static_Hash_Maps
-- from ../src/natools-s_expressions-printers-pretty-config-commands.sx
with Natools.S_Expressions.Printers.Pretty.Config.Main_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Newline_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Commands.SC;
with Natools.S_Expressions.Printers.Pretty.Config.Atom_Enc;
with Natools.S_Expressions.Printers.Pretty.Config.Commands.CE;
with Natools.S_Expressions.Printers.Pretty.Config.Hex_Casing;
with Natools.S_Expressions.Printers.Pretty.Config.Newline_Enc;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Opt;
with Natools.S_Expressions.Printers.Pretty.Config.Token_Opt;
function Natools.S_Expressions.Printers.Pretty.Config.Commands.T
return Boolean is
begin
for I in Map_1_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Main_Cmd.Hash
(Map_1_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_2_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Newline_Cmd.Hash
(Map_2_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_3_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd.Hash
(Map_3_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_4_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Commands.SC.Hash
(Map_4_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_5_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Atom_Enc.Hash
(Map_5_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_6_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Commands.CE.Hash
(Map_6_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_7_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Hex_Casing.Hash
(Map_7_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_8_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Newline_Enc.Hash
(Map_8_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_9_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc.Hash
(Map_9_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_10_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Quoted_Opt.Hash
(Map_10_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_11_Keys'Range loop
if Natools.S_Expressions.Printers.Pretty.Config.Token_Opt.Hash
(Map_11_Keys (I).all) /= I
then
return False;
end if;
end loop;
return True;
end Natools.S_Expressions.Printers.Pretty.Config.Commands.T;
|
programs/oeis/270/A270994.asm | karttu/loda | 1 | 10067 | <reponame>karttu/loda<filename>programs/oeis/270/A270994.asm
; A270994: a(n) = 9454129 + 11184810*n.
; 9454129,20638939,31823749,43008559,54193369,65378179,76562989,87747799,98932609,110117419,121302229,132487039,143671849,154856659,166041469,177226279,188411089,199595899,210780709,221965519,233150329,244335139,255519949,266704759,277889569,289074379,300259189
mov $1,$0
mul $1,11184810
add $1,9454129
|
src/multiply2.asm | MrPivato/mips_files | 0 | 94103 | <reponame>MrPivato/mips_files
.data
.text
addi $t0, $zero, 3200000
addi $t1, $zero, 4200000
mult $t0, $t1 # stored at lo and hi, up to 64bits
mflo $s0
mfhi $s1
add $t2, $s0, $s1
li $v0, 1
move $a0, $t2
syscall |
src/SystemF/Substitutions/Types.agda | metaborg/ts.agda | 4 | 13385 | <filename>src/SystemF/Substitutions/Types.agda
module SystemF.Substitutions.Types where
open import Prelude
open import SystemF.Syntax.Type
open import Data.Fin.Substitution
open import Data.Star hiding (map)
open import Data.Vec
module TypeSubst where
module TypeApp {T} (l : Lift T Type) where
open Lift l hiding (var)
infixl 8 _/_
_/_ : ∀ {m n} → Type m → Sub T m n → Type n
tc c / σ = tc c
tvar x / σ = lift (lookup x σ)
(a →' b) / σ = (a / σ) →' (b / σ)
(a ⟶ b) / σ = (a / σ) ⟶ (b / σ)
∀' a / σ = ∀' (a / σ ↑)
open Application (record { _/_ = _/_ }) using (_/✶_)
→'-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →
(a →' b) /✶ ρs ↑✶ k ≡ (a /✶ ρs ↑✶ k) →' (b /✶ ρs ↑✶ k)
→'-/✶-↑✶ k ε = refl
→'-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (→'-/✶-↑✶ k ρs) refl
⟶-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →
(a ⟶ b) /✶ ρs ↑✶ k ≡ (a /✶ ρs ↑✶ k) ⟶ (b /✶ ρs ↑✶ k)
⟶-/✶-↑✶ k ε = refl
⟶-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (⟶-/✶-↑✶ k ρs) refl
∀'-/✶-↑✶ : ∀ k {m n a} (ρs : Subs T m n) →
(∀' a) /✶ ρs ↑✶ k ≡ ∀' (a /✶ ρs ↑✶ (1 + k))
∀'-/✶-↑✶ k ε = refl
∀'-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (∀'-/✶-↑✶ k ρs) refl
tc-/✶-↑✶ : ∀ k {c m n} (ρs : Subs T m n) →
(tc c) /✶ ρs ↑✶ k ≡ tc c
tc-/✶-↑✶ k ε = refl
tc-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (tc-/✶-↑✶ k ρs) refl
typeSubst : TermSubst Type
typeSubst = record { var = tvar; app = TypeApp._/_ }
open TermSubst typeSubst public hiding (var)
infix 8 _[/_]
-- Shorthand for single-variable type substitutions
_[/_] : ∀ {n} → Type (suc n) → Type n → Type n
a [/ b ] = a / sub b
open TypeSubst public using ()
renaming (_/_ to _tp/tp_; _[/_] to _tp[/tp_]; weaken to tp-weaken)
|
02.jumpOperations.asm | tamim87/Assembly-Samples | 0 | 97372 | <reponame>tamim87/Assembly-Samples
;jump operations
;org 100h
;
;mov ax,00044h
;mov bx,0007h
;
;cmp ax,bx
;jl lower
;jg upper
;mov dx,0002h
;jmp done
;
;lower:
;mov dx,0001h
;jmp done
;
;upper:
;mov dx,0003h
;
;done:ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org 100h
mov ax,0044h ;0004h is stored in ax
mov bx,0007h ;0007h is stored in ax
cmp ax,bx ;compares ax and bx
jle x ;jumps to label x if ax <= bx, otherwise goes to next line
mov dx,0003h ;moves 0003h in dx if ax > bx
jmp done ;jumps to label done because ax > bx
x: jl y ;checks if ax < bx, if so jumps to label y
mov dx,0002h ;moves 0002h in dx if ax = bx
jmp done ;jumps to label done because ax = bx
y:
mov dx,0001h ;moves 0002h in dx because ax < bx
done:ret
|
test/Fail/Issue3672b.agda | cruhland/agda | 1,989 | 2187 | <filename>test/Fail/Issue3672b.agda
open import Agda.Primitive
_∘_ : ∀ {a b c}
{A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} →
(∀ {x} (y : B x) → C y) → (g : (x : A) → B x) →
((x : A) → C (g x))
f ∘ g = λ x → f (g x)
data D {a} (A : Set a) : Set a where
d : D A → D A
data E {a} (A : Set a) : Set a where
e : A → E A
F : ∀ {a} {A : Set a} → A → D A → Set a
F x (d ys) = E (F x ys)
G : ∀ {a} {A : Set a} → D A → D A → Set a
G xs ys = ∀ x → F x xs → F x ys
postulate
H : ∀ {a} {A : Set a} {xs ys : D A} → G xs ys → Set
variable
a : Level
A : Set a
P : A → Set a
x : A
xs : D A
postulate
h : {f : G xs xs} (_ : P x) → F x xs → H (λ _ → e ∘ f _)
|
firehog/ncurses/Ada95/ada_include/terminal_interface-curses-panels.adb | KipodAfterFree/KAF-2019-FireHog | 1 | 27348 | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Panels --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- 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, distribute with modifications, 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 ABOVE 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. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: <NAME> <<EMAIL>> 1996
-- Version Control:
-- $Revision: 1.6 $
-- Binding Version 00.93
------------------------------------------------------------------------------
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
with Interfaces.C;
package body Terminal_Interface.Curses.Panels is
use type Interfaces.C.int;
function Create (Win : Window) return Panel
is
function Newpanel (Win : Window) return Panel;
pragma Import (C, Newpanel, "new_panel");
Pan : Panel;
begin
Pan := Newpanel (Win);
if Pan = Null_Panel then
raise Panel_Exception;
end if;
return Pan;
end Create;
procedure Bottom (Pan : in Panel)
is
function Bottompanel (Pan : Panel) return C_Int;
pragma Import (C, Bottompanel, "bottom_panel");
begin
if Bottompanel (Pan) = Curses_Err then
raise Panel_Exception;
end if;
end Bottom;
procedure Top (Pan : in Panel)
is
function Toppanel (Pan : Panel) return C_Int;
pragma Import (C, Toppanel, "top_panel");
begin
if Toppanel (Pan) = Curses_Err then
raise Panel_Exception;
end if;
end Top;
procedure Show (Pan : in Panel)
is
function Showpanel (Pan : Panel) return C_Int;
pragma Import (C, Showpanel, "show_panel");
begin
if Showpanel (Pan) = Curses_Err then
raise Panel_Exception;
end if;
end Show;
procedure Hide (Pan : in Panel)
is
function Hidepanel (Pan : Panel) return C_Int;
pragma Import (C, Hidepanel, "hide_panel");
begin
if Hidepanel (Pan) = Curses_Err then
raise Panel_Exception;
end if;
end Hide;
function Get_Window (Pan : Panel) return Window
is
function Panel_Win (Pan : Panel) return Window;
pragma Import (C, Panel_Win, "panel_window");
Win : Window := Panel_Win (Pan);
begin
if Win = Null_Window then
raise Panel_Exception;
end if;
return Win;
end Get_Window;
procedure Replace (Pan : in Panel;
Win : in Window)
is
function Replace_Pan (Pan : Panel;
Win : Window) return C_Int;
pragma Import (C, Replace_Pan, "replace_panel");
begin
if Replace_Pan (Pan, Win) = Curses_Err then
raise Panel_Exception;
end if;
end Replace;
procedure Move (Pan : in Panel;
Line : in Line_Position;
Column : in Column_Position)
is
function Move (Pan : Panel;
Line : C_Int;
Column : C_Int) return C_Int;
pragma Import (C, Move, "move_panel");
begin
if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then
raise Panel_Exception;
end if;
end Move;
function Is_Hidden (Pan : Panel) return Boolean
is
function Panel_Hidden (Pan : Panel) return C_Int;
pragma Import (C, Panel_Hidden, "panel_hidden");
begin
if Panel_Hidden (Pan) = Curses_False then
return False;
else
return True;
end if;
end Is_Hidden;
procedure Delete (Pan : in out Panel)
is
function Del_Panel (Pan : Panel) return C_Int;
pragma Import (C, Del_Panel, "del_panel");
begin
if Del_Panel (Pan) = Curses_Err then
raise Panel_Exception;
end if;
Pan := Null_Panel;
end Delete;
end Terminal_Interface.Curses.Panels;
|
libsrc/stdio/sprintf_outc.asm | Toysoft/z88dk | 0 | 161486 | <reponame>Toysoft/z88dk
MODULE sprintf_outc
SECTION code_clib
PUBLIC sprintf_outc
EXTERN fputc_cons
sprintf_outc:
pop bc
pop hl ;fp
pop de ;charcter
push bc
push ix ;save ix
IF __CPU_R2K__ | __CPU_R3K__
ld ix,hl
ELSE
push hl ;get fp into ix
pop ix
ENDIF
ld c,(ix+2)
ld b,(ix+3)
ld a,c
or b
jr z,no_space
dec bc ;reduce space
ld (ix+2),c
ld (ix+3),b
IF __CPU_R2K__ | __CPU_R3K__
ld hl,(ix+0)
ELSE
ld l,(ix+0)
ld h,(ix+1)
ENDIF
ld a,b ;make sure we can terminate
or c
jr z,just_terminate
ld (hl),e
inc hl
just_terminate:
ld (hl),0
IF __CPU_R2K__ | __CPU_R3K__
ld (ix+0),hl
ELSE
ld (ix+0),l
ld (ix+1),h
ENDIF
no_space:
pop ix
ret
|
ANTLRTestProjects/antbased/CodeCompletion/grammar/org/mypackage/CombinedGrammar.g4 | timboudreau/ANTLR4-Plugins-for-NetBeans | 1 | 7897 | <filename>ANTLRTestProjects/antbased/CodeCompletion/grammar/org/mypackage/CombinedGrammar.g4
/******************************************************
* A multi-line Javadoc-like comment about my grammar *
******************************************************/
grammar CombinedGrammar;
import ParserGrammar;
tokens { TOK }
options { tokenVocab=LexerGrammar; }
// channels { CHANNEL4 }
/* ANTLR test if a parser rule id is already used locally but it does not test
if a parser rule id is already used by an imported parser rule!!!! */
rule4 :
// ANTLR does not test if all element labals of an alternative are different
eltLabel1=rule1 ID+ INT eltLabel2=TOK ILG_1_TOKEN_4 (eltLabel3=FRAGMENT? rule2+) #altLabel1 |
eltLabel1=rule2 #altLabel2 | // ANTLR does not test if alternatives of the same rule
// have different ids. It leads to a strange error at
// Java compilation time!!!
eltLabel1=rule5 #altLabel3
;
rule5 :
eltLabel1=rule2 #altLabel4 |
eltLabel1=rule1 #altLabel5
;
// some lexer rules
ID : [a-zA-Z]+ FRAGMENT ; // match identifiers
INT : [0-9]+ ; // match integers
NEWLINE: '\r'? '\n' ; // return newlines to parser
//mode ModeB;
fragment FRAGMENT : [a-z] ; |
10 Adapted from others/12 Sam Schloegel/03 Stems/Target version bump by filename.applescript | streth11/Qlab-Scripts | 1 | 2596 | <filename>10 Adapted from others/12 Sam Schloegel/03 Stems/Target version bump by filename.applescript
-- @description Target version bump by filename
-- @author <NAME>
-- @link bensmithsound.uk
-- @source <NAME>
-- @version 1.0
-- @testedmacos 10.13.6
-- @testedqlab 4.6.9
-- @about Retargets selected cues (intended for use with click track stems) from version xx to version xx+1 in the same folder
-- @separateprocess TRUE
-- @changelog
-- v1.0 + init
-- USER DEFINED VARIABLES -----------------
set versionLength to 2 -- How many digits for versioning? v1 / v01, 2 digits recommended
---------- END OF USER DEFINED VARIABLES --
-- RUN SCRIPT -----------------------------
tell application id "com.figure53.Qlab.4" to tell front workspace
set theSelection to (selected as list)
repeat with eachCue in theSelection
if q type of eachCue is "Audio" then
set theName to q name of eachCue
-- Get POSIX path of current target
set theTarget to (file target of eachCue)
set theTarget to the POSIX path of theTarget
set lastChars to text -6 thru -1 of theTarget
set thePos to ((6 - ((offset of "." in lastChars) - 2)) * -1)
set theExt to text (offset of "." in lastChars) thru -1 of lastChars
set theTrunk to text 1 thru thePos of theTarget
set oldVersion to (text (versionLength * -1) thru -1 of theTrunk) as integer
set newVersion to (oldVersion + 1) as string
if (count newVersion) < versionLength then
set leadingNeeded to versionLength - (count newVersion)
repeat leadingNeeded times
set newVersion to ("0" & newVersion)
end repeat
end if
set newTarget to ((text 1 thru (-1 - versionLength) of theTrunk) & newVersion & theExt)
set file target of eachCue to (POSIX file newTarget)
end if
end repeat
end tell
|
Transynther/x86/_processed/NONE/_un_xt_sm_/i7-7700_9_0x48.log_21829_1358.asm | ljhsiun2/medusa | 9 | 174351 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xbb9, %r8
dec %r9
vmovups (%r8), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rdx
nop
nop
nop
nop
dec %r11
lea addresses_D_ht+0x928d, %rsi
lea addresses_normal_ht+0x1e4d9, %rdi
nop
inc %r12
mov $31, %rcx
rep movsq
nop
nop
nop
nop
inc %r12
lea addresses_WC_ht+0x1d689, %r8
nop
nop
nop
nop
nop
dec %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
and $0xffffffffffffffc0, %r8
movntdq %xmm6, (%r8)
nop
nop
nop
nop
nop
add $43999, %r12
lea addresses_A_ht+0x32b9, %r12
nop
xor %rdi, %rdi
mov $0x6162636465666768, %r9
movq %r9, %xmm6
movups %xmm6, (%r12)
cmp $46592, %r12
lea addresses_normal_ht+0x4eb9, %rdi
nop
and $30628, %rdx
movups (%rdi), %xmm2
vpextrq $1, %xmm2, %r11
inc %r9
lea addresses_D_ht+0x81e9, %rsi
lea addresses_D_ht+0x9f99, %rdi
nop
nop
nop
nop
and $37632, %r8
mov $41, %rcx
rep movsq
cmp $24406, %rdx
lea addresses_WT_ht+0x32b9, %rsi
lea addresses_WT_ht+0x1539, %rdi
nop
nop
cmp $20472, %r9
mov $34, %rcx
rep movsq
nop
sub $16216, %rdi
lea addresses_WT_ht+0x1b4db, %rsi
lea addresses_UC_ht+0x1516d, %rdi
nop
nop
nop
nop
nop
dec %r8
mov $17, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x2739, %rsi
lea addresses_WC_ht+0x9df1, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
xor %r9, %r9
mov $103, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
mov $0xa45, %rsi
lea addresses_A+0x17cb9, %rdi
nop
nop
nop
nop
mfence
mov $92, %rcx
rep movsw
nop
nop
xor $238, %r8
// Store
lea addresses_UC+0x60b9, %r13
and $34341, %rbx
movw $0x5152, (%r13)
nop
nop
nop
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_UC+0x60b9, %rcx
clflush (%rcx)
and $54467, %rdi
movups (%rcx), %xmm0
vpextrq $0, %xmm0, %r8
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_P', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': True, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'52': 21699, '79': 130}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 79 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 79 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
Ada/test_solution.ads | PyllrNL/Project_Euler_Solutions | 0 | 20057 | with Ada.Strings.Unbounded;
with Ada.Containers.Vectors;
package Test_Solution is
type Solution is access procedure;
package SU renames Ada.Strings.Unbounded;
package P is new Ada.Containers.Vectors( Index_Type => Natural,
Element_Type => Solution);
Assertion_Error : Exception;
procedure Assert( Test : Boolean );
type Solution_Case is record
Name : SU.Unbounded_String;
Tests : P.Vector;
end record;
procedure Set_Name( C : in out Solution_Case; Name : String );
function Get_Name( C : in Solution_Case ) return String;
procedure Add_Test( C : in out Solution_Case; Func : Solution );
end Test_Solution;
|
programs/oeis/269/A269020.asm | neoneye/loda | 22 | 165317 | <filename>programs/oeis/269/A269020.asm
; A269020: a(n) = ceiling(n^(1+1/n)).
; 1,3,5,6,7,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70
mov $2,$0
mul $0,7
lpb $0
div $0,3
trn $0,2
add $1,1
lpe
add $1,1
add $1,$2
mov $0,$1
|
programs/oeis/164/A164051.asm | neoneye/loda | 22 | 161513 | <filename>programs/oeis/164/A164051.asm
; A164051: a(n) = 2^(2n) + 2^(n-1).
; 5,18,68,264,1040,4128,16448,65664,262400,1049088,4195328,16779264,67112960,268443648,1073758208,4295000064,17179934720,68719607808,274878169088,1099512152064,4398047559680,17592188141568,70368748371968,281474985099264,1125899923619840,4503599660924928,18014398576590848,72057594172145664,288230376420147200,1152921505143717888,4611686019501129728,18446744075857035264,73786976299133173760,295147905187942760448,1180591620734591172608,4722366482904004952064,18889465931547300331520,75557863726051762372608,302231454903932171583488,1208925819615178930520064,4835703278459616210452480,19342813113836265818554368,77371252455340665227706368,309485009821353864817803264,1237940039285397867085168640,4951760157141556283968585728,19807040628566154767130165248,79228162514264478331032305664,316912650057057631849152512000,1267650600228229964446656626688,5070602400912918731886719664128,20282409603651672675747064971264,81129638414606686199388632514560,324518553658426735790355275317248,1298074214633706925147022591787008,5192296858534827664559293348184064,20769187434139310586179579354808320,83076749736557242200603129343377408,332306998946228968514182141221797888
add $0,3
mov $1,2
mov $2,2
pow $2,$0
add $1,$2
mul $1,$2
div $1,16
mov $0,$1
|
programs/oeis/130/A130752.asm | jmorken/loda | 1 | 173736 | ; A130752: Binomial transform of periodic sequence (2, 3, 1).
; 2,5,9,16,31,63,128,257,513,1024,2047,4095,8192,16385,32769,65536,131071,262143,524288,1048577,2097153,4194304,8388607,16777215,33554432,67108865,134217729,268435456,536870911,1073741823,2147483648,4294967297,8589934593,17179869184,34359738367,68719476735,137438953472,274877906945,549755813889,1099511627776,2199023255551,4398046511103,8796093022208,17592186044417,35184372088833,70368744177664,140737488355327,281474976710655,562949953421312,1125899906842625,2251799813685249,4503599627370496,9007199254740991
mov $2,2
mov $3,1
mov $4,1
lpb $0
sub $0,1
add $1,$2
add $2,$4
mov $4,$3
add $3,$1
lpe
add $1,$2
|
src/gnat/scng.adb | My-Colaborations/dynamo | 15 | 20837 | <filename>src/gnat/scng.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S C N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, 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 Atree; use Atree;
with Csets; use Csets;
with Hostparm; use Hostparm;
with Namet; use Namet;
with Opt; use Opt;
-- with Restrict; use Restrict;
with Rident; use Rident;
with Scans; use Scans;
with Sinput; use Sinput;
with Snames; use Snames;
with Stringt; use Stringt;
with Stylesw; use Stylesw;
with Uintp; use Uintp;
with Urealp; use Urealp;
with Widechar; use Widechar;
pragma Warnings (Off);
-- This package is used also by gnatcoll
with System.CRC32;
with System.UTF_32; use System.UTF_32;
with System.WCh_Con; use System.WCh_Con;
pragma Warnings (On);
package body Scng is
use ASCII;
-- Make control characters visible
Special_Characters : array (Character) of Boolean := (others => False);
-- For characters that are Special token, the value is True
Comment_Is_Token : Boolean := False;
-- True if comments are tokens
End_Of_Line_Is_Token : Boolean := False;
-- True if End_Of_Line is a token
-----------------------
-- Local Subprograms --
-----------------------
procedure Accumulate_Token_Checksum;
pragma Inline (Accumulate_Token_Checksum);
-- Called after each numeric literal and identifier/keyword. For keywords,
-- the token used is Tok_Identifier. This allows detection of additional
-- spaces added in sources when using the builder switch -m.
procedure Accumulate_Token_Checksum_GNAT_6_3;
-- Used in place of Accumulate_Token_Checksum for GNAT versions 5.04 to
-- 6.3, when Tok_Some was not included in Token_Type and the actual
-- Token_Type was used for keywords. This procedure is never used in the
-- compiler or gnatmake, only in gprbuild.
procedure Accumulate_Token_Checksum_GNAT_5_03;
-- Used in place of Accumulate_Token_Checksum for GNAT version 5.03, when
-- Tok_Interface, Tok_Some, Tok_Synchronized and Tok_Overriding were not
-- included in Token_Type and the actual Token_Type was used for keywords.
-- This procedure is never used in the compiler or gnatmake, only in
-- gprbuild.
procedure Accumulate_Checksum (C : Character);
pragma Inline (Accumulate_Checksum);
-- This routine accumulates the checksum given character C. During the
-- scanning of a source file, this routine is called with every character
-- in the source, excluding blanks, and all control characters (except
-- that ESC is included in the checksum). Upper case letters not in string
-- literals are folded by the caller. See Sinput spec for the documentation
-- of the checksum algorithm. Note: checksum values are only used if we
-- generate code, so it is not necessary to worry about making the right
-- sequence of calls in any error situation.
procedure Accumulate_Checksum (C : Char_Code);
pragma Inline (Accumulate_Checksum);
-- This version is identical, except that the argument, C, is a character
-- code value instead of a character. This is used when wide characters
-- are scanned. We use the character code rather than the ASCII characters
-- so that the checksum is independent of wide character encoding method.
procedure Initialize_Checksum;
pragma Inline (Initialize_Checksum);
-- Initialize checksum value
-------------------------
-- Accumulate_Checksum --
-------------------------
procedure Accumulate_Checksum (C : Character) is
begin
System.CRC32.Update (System.CRC32.CRC32 (Checksum), C);
end Accumulate_Checksum;
procedure Accumulate_Checksum (C : Char_Code) is
begin
if C > 16#FFFF# then
Accumulate_Checksum (Character'Val (C / 2 ** 24));
Accumulate_Checksum (Character'Val ((C / 2 ** 16) mod 256));
Accumulate_Checksum (Character'Val ((C / 256) mod 256));
else
Accumulate_Checksum (Character'Val (C / 256));
end if;
Accumulate_Checksum (Character'Val (C mod 256));
end Accumulate_Checksum;
-------------------------------
-- Accumulate_Token_Checksum --
-------------------------------
procedure Accumulate_Token_Checksum is
begin
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token)));
end Accumulate_Token_Checksum;
----------------------------------------
-- Accumulate_Token_Checksum_GNAT_6_3 --
----------------------------------------
procedure Accumulate_Token_Checksum_GNAT_6_3 is
begin
-- Individual values of Token_Type are used, instead of subranges, so
-- that additions or suppressions of enumerated values in type
-- Token_Type are detected by the compiler.
case Token is
when Tok_Integer_Literal | Tok_Real_Literal | Tok_String_Literal |
Tok_Char_Literal | Tok_Operator_Symbol | Tok_Identifier |
Tok_Double_Asterisk | Tok_Ampersand | Tok_Minus | Tok_Plus |
Tok_Asterisk | Tok_Mod | Tok_Rem | Tok_Slash | Tok_New |
Tok_Abs | Tok_Others | Tok_Null | Tok_Dot | Tok_Apostrophe |
Tok_Left_Paren | Tok_Delta | Tok_Digits | Tok_Range |
Tok_Right_Paren | Tok_Comma | Tok_And | Tok_Or | Tok_Xor |
Tok_Less | Tok_Equal | Tok_Greater | Tok_Not_Equal |
Tok_Greater_Equal | Tok_Less_Equal | Tok_In | Tok_Not |
Tok_Box | Tok_Colon_Equal | Tok_Colon | Tok_Greater_Greater |
Tok_Abstract | Tok_Access | Tok_Aliased | Tok_All | Tok_Array |
Tok_At | Tok_Body | Tok_Constant | Tok_Do | Tok_Is |
Tok_Interface | Tok_Limited | Tok_Of | Tok_Out | Tok_Record |
Tok_Renames | Tok_Reverse =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token)));
when Tok_Some =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Tok_Identifier)));
when Tok_Tagged | Tok_Then | Tok_Less_Less | Tok_Abort | Tok_Accept |
Tok_Case | Tok_Delay | Tok_Else | Tok_Elsif | Tok_End |
Tok_Exception | Tok_Exit | Tok_Goto | Tok_If | Tok_Pragma |
Tok_Raise | Tok_Requeue | Tok_Return | Tok_Select |
Tok_Terminate | Tok_Until | Tok_When | Tok_Begin | Tok_Declare |
Tok_For | Tok_Loop | Tok_While | Tok_Entry | Tok_Protected |
Tok_Task | Tok_Type | Tok_Subtype | Tok_Overriding |
Tok_Synchronized | Tok_Use | Tok_Function | Tok_Generic |
Tok_Package | Tok_Procedure | Tok_Private | Tok_With |
Tok_Separate | Tok_EOF | Tok_Semicolon | Tok_Arrow |
Tok_Vertical_Bar | Tok_Dot_Dot | Tok_Project | Tok_Extends |
Tok_External | Tok_External_As_List | Tok_Comment |
Tok_End_Of_Line | Tok_Special | Tok_SPARK_Hide | No_Token =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token_Type'Pred (Token))));
end case;
end Accumulate_Token_Checksum_GNAT_6_3;
-----------------------------------------
-- Accumulate_Token_Checksum_GNAT_5_03 --
-----------------------------------------
procedure Accumulate_Token_Checksum_GNAT_5_03 is
begin
-- Individual values of Token_Type are used, instead of subranges, so
-- that additions or suppressions of enumerated values in type
-- Token_Type are detected by the compiler.
case Token is
when Tok_Integer_Literal | Tok_Real_Literal | Tok_String_Literal |
Tok_Char_Literal | Tok_Operator_Symbol | Tok_Identifier |
Tok_Double_Asterisk | Tok_Ampersand | Tok_Minus | Tok_Plus |
Tok_Asterisk | Tok_Mod | Tok_Rem | Tok_Slash | Tok_New |
Tok_Abs | Tok_Others | Tok_Null | Tok_Dot | Tok_Apostrophe |
Tok_Left_Paren | Tok_Delta | Tok_Digits | Tok_Range |
Tok_Right_Paren | Tok_Comma | Tok_And | Tok_Or | Tok_Xor |
Tok_Less | Tok_Equal | Tok_Greater | Tok_Not_Equal |
Tok_Greater_Equal | Tok_Less_Equal | Tok_In | Tok_Not |
Tok_Box | Tok_Colon_Equal | Tok_Colon | Tok_Greater_Greater |
Tok_Abstract | Tok_Access | Tok_Aliased | Tok_All | Tok_Array |
Tok_At | Tok_Body | Tok_Constant | Tok_Do | Tok_Is =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token)));
when Tok_Interface | Tok_Some | Tok_Overriding | Tok_Synchronized =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Tok_Identifier)));
when Tok_Limited | Tok_Of | Tok_Out | Tok_Record |
Tok_Renames | Tok_Reverse =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token) - 1));
when Tok_Tagged | Tok_Then | Tok_Less_Less | Tok_Abort | Tok_Accept |
Tok_Case | Tok_Delay | Tok_Else | Tok_Elsif | Tok_End |
Tok_Exception | Tok_Exit | Tok_Goto | Tok_If | Tok_Pragma |
Tok_Raise | Tok_Requeue | Tok_Return | Tok_Select |
Tok_Terminate | Tok_Until | Tok_When | Tok_Begin | Tok_Declare |
Tok_For | Tok_Loop | Tok_While | Tok_Entry | Tok_Protected |
Tok_Task | Tok_Type | Tok_Subtype =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token) - 2));
when Tok_Use | Tok_Function | Tok_Generic |
Tok_Package | Tok_Procedure | Tok_Private | Tok_With |
Tok_Separate | Tok_EOF | Tok_Semicolon | Tok_Arrow |
Tok_Vertical_Bar | Tok_Dot_Dot | Tok_Project | Tok_Extends |
Tok_External | Tok_External_As_List | Tok_Comment |
Tok_End_Of_Line | Tok_Special | Tok_SPARK_Hide | No_Token =>
System.CRC32.Update
(System.CRC32.CRC32 (Checksum),
Character'Val (Token_Type'Pos (Token) - 4));
end case;
end Accumulate_Token_Checksum_GNAT_5_03;
-----------------------
-- Check_End_Of_Line --
-----------------------
procedure Check_End_Of_Line is
Len : constant Int :=
Int (Scan_Ptr) -
Int (Current_Line_Start) -
Wide_Char_Byte_Count;
-- Start of processing for Check_End_Of_Line
begin
if Style_Check then
Style.Check_Line_Terminator (Len);
end if;
-- Deal with checking maximum line length
if Style_Check and Style_Check_Max_Line_Length then
Style.Check_Line_Max_Length (Len);
-- If style checking is inactive, check maximum line length against
-- standard value.
elsif Len > Max_Line_Length then
Error_Msg
("this line is too long",
Current_Line_Start + Source_Ptr (Max_Line_Length));
end if;
-- Now one more checking circuit. Normally we are only enforcing a limit
-- of physical characters, with tabs counting as one character. But if
-- after tab expansion we would have a total line length that exceeded
-- 32766, that would really cause trouble, because column positions
-- would exceed the maximum we allow for a column count. Note: the limit
-- is 32766 rather than 32767, since we use a value of 32767 for special
-- purposes (see Sinput). Now we really do not want to go messing with
-- tabs in the normal case, so what we do is to check for a line that
-- has more than 4096 physical characters. Any shorter line could not
-- be a problem, even if it was all tabs.
if Len >= 4096 then
declare
Col : Natural;
Ptr : Source_Ptr;
begin
Col := 1;
Ptr := Current_Line_Start;
loop
exit when Ptr = Scan_Ptr;
if Source (Ptr) = ASCII.HT then
Col := (Col - 1 + 8) / 8 * 8 + 1;
else
Col := Col + 1;
end if;
if Col > 32766 then
Error_Msg
("this line is longer than 32766 characters",
Current_Line_Start);
raise Unrecoverable_Error;
end if;
Ptr := Ptr + 1;
end loop;
end;
end if;
-- Reset wide character byte count for next line
Wide_Char_Byte_Count := 0;
end Check_End_Of_Line;
----------------------------
-- Determine_Token_Casing --
----------------------------
function Determine_Token_Casing return Casing_Type is
begin
return Determine_Casing (Source (Token_Ptr .. Scan_Ptr - 1));
end Determine_Token_Casing;
-------------------------
-- Initialize_Checksum --
-------------------------
procedure Initialize_Checksum is
begin
System.CRC32.Initialize (System.CRC32.CRC32 (Checksum));
end Initialize_Checksum;
------------------------
-- Initialize_Scanner --
------------------------
procedure Initialize_Scanner (Index : Source_File_Index) is
begin
-- Establish reserved words
Scans.Initialize_Ada_Keywords;
-- Initialize scan control variables
Current_Source_File := Index;
Source := Source_Text (Current_Source_File);
Scan_Ptr := Source_First (Current_Source_File);
Token := No_Token;
Token_Ptr := Scan_Ptr;
Current_Line_Start := Scan_Ptr;
Token_Node := Empty;
Token_Name := No_Name;
Start_Column := Set_Start_Column;
First_Non_Blank_Location := Scan_Ptr;
Initialize_Checksum;
Wide_Char_Byte_Count := 0;
-- Do not call Scan, otherwise the License stuff does not work in Scn
end Initialize_Scanner;
------------------------------
-- Reset_Special_Characters --
------------------------------
procedure Reset_Special_Characters is
begin
Special_Characters := (others => False);
end Reset_Special_Characters;
----------
-- Scan --
----------
procedure Scan is
Start_Of_Comment : Source_Ptr;
-- Record start of comment position
Underline_Found : Boolean;
-- During scanning of an identifier, set to True if last character
-- scanned was an underline or other punctuation character. This
-- is used to flag the error of two underlines/punctuations in a
-- row or ending an identifier with a underline/punctuation. Here
-- punctuation means any UTF_32 character in the Unicode category
-- Punctuation,Connector.
Wptr : Source_Ptr;
-- Used to remember start of last wide character scanned
function Double_Char_Token (C : Character) return Boolean;
-- This function is used for double character tokens like := or <>. It
-- checks if the character following Source (Scan_Ptr) is C, and if so
-- bumps Scan_Ptr past the pair of characters and returns True. A space
-- between the two characters is also recognized with an appropriate
-- error message being issued. If C is not present, False is returned.
-- Note that Double_Char_Token can only be used for tokens defined in
-- the Ada syntax (it's use for error cases like && is not appropriate
-- since we do not want a junk message for a case like &-space-&).
procedure Error_Illegal_Character;
-- Give illegal character error, Scan_Ptr points to character. On
-- return, Scan_Ptr is bumped past the illegal character.
procedure Error_Illegal_Wide_Character;
-- Give illegal wide character message. On return, Scan_Ptr is bumped
-- past the illegal character, which may still leave us pointing to
-- junk, not much we can do if the escape sequence is messed up.
procedure Error_No_Double_Underline;
-- Signal error of two underline or punctuation characters in a row.
-- Called with Scan_Ptr pointing to second underline/punctuation char.
procedure Nlit;
-- This is the procedure for scanning out numeric literals. On entry,
-- Scan_Ptr points to the digit that starts the numeric literal (the
-- checksum for this character has not been accumulated yet). On return
-- Scan_Ptr points past the last character of the numeric literal, Token
-- and Token_Node are set appropriately, and the checksum is updated.
procedure Slit;
-- This is the procedure for scanning out string literals. On entry,
-- Scan_Ptr points to the opening string quote (the checksum for this
-- character has not been accumulated yet). On return Scan_Ptr points
-- past the closing quote of the string literal, Token and Token_Node
-- are set appropriately, and the checksum is updated.
procedure Skip_Other_Format_Characters;
-- Skips past any "other format" category characters at the current
-- cursor location (does not skip past spaces or any other characters).
function Start_Of_Wide_Character return Boolean;
-- Returns True if the scan pointer is pointing to the start of a wide
-- character sequence, does not modify the scan pointer in any case.
-----------------------
-- Double_Char_Token --
-----------------------
function Double_Char_Token (C : Character) return Boolean is
begin
if Source (Scan_Ptr + 1) = C then
Accumulate_Checksum (C);
Scan_Ptr := Scan_Ptr + 2;
return True;
elsif Source (Scan_Ptr + 1) = ' '
and then Source (Scan_Ptr + 2) = C
then
Scan_Ptr := Scan_Ptr + 1;
Error_Msg_S -- CODEFIX
("no space allowed here");
Scan_Ptr := Scan_Ptr + 2;
return True;
else
return False;
end if;
end Double_Char_Token;
-----------------------------
-- Error_Illegal_Character --
-----------------------------
procedure Error_Illegal_Character is
begin
Error_Msg_S ("illegal character");
Scan_Ptr := Scan_Ptr + 1;
end Error_Illegal_Character;
----------------------------------
-- Error_Illegal_Wide_Character --
----------------------------------
procedure Error_Illegal_Wide_Character is
begin
Scan_Ptr := Scan_Ptr + 1;
Error_Msg ("illegal wide character", Wptr);
end Error_Illegal_Wide_Character;
-------------------------------
-- Error_No_Double_Underline --
-------------------------------
procedure Error_No_Double_Underline is
begin
Underline_Found := False;
-- There are four cases, and we special case the messages
if Source (Scan_Ptr) = '_' then
if Source (Scan_Ptr - 1) = '_' then
Error_Msg_S -- CODEFIX
("two consecutive underlines not permitted");
else
Error_Msg_S ("underline cannot follow punctuation character");
end if;
else
if Source (Scan_Ptr - 1) = '_' then
Error_Msg_S ("punctuation character cannot follow underline");
else
Error_Msg_S
("two consecutive punctuation characters not permitted");
end if;
end if;
end Error_No_Double_Underline;
----------
-- Nlit --
----------
procedure Nlit is
C : Character;
-- Current source program character
Base_Char : Character;
-- Either # or : (character at start of based number)
Base : Int;
-- Value of base
UI_Base : Uint;
-- Value of base in Uint format
UI_Int_Value : Uint;
-- Value of integer scanned by Scan_Integer in Uint format
UI_Num_Value : Uint;
-- Value of integer in numeric value being scanned
Scale : Int;
-- Scale value for real literal
UI_Scale : Uint;
-- Scale in Uint format
Exponent_Is_Negative : Boolean;
-- Set true for negative exponent
Extended_Digit_Value : Int;
-- Extended digit value
Point_Scanned : Boolean;
-- Flag for decimal point scanned in numeric literal
-----------------------
-- Local Subprograms --
-----------------------
procedure Error_Digit_Expected;
-- Signal error of bad digit, Scan_Ptr points to the location at
-- which the digit was expected on input, and is unchanged on return.
procedure Scan_Integer;
-- Scan integer literal. On entry, Scan_Ptr points to a digit, on
-- exit Scan_Ptr points past the last character of the integer.
--
-- For each digit encountered, UI_Int_Value is multiplied by 10, and
-- the value of the digit added to the result. In addition, the value
-- in Scale is decremented by one for each actual digit scanned.
--------------------------
-- Error_Digit_Expected --
--------------------------
procedure Error_Digit_Expected is
begin
Error_Msg_S ("digit expected");
end Error_Digit_Expected;
------------------
-- Scan_Integer --
------------------
procedure Scan_Integer is
C : Character;
-- Next character scanned
begin
C := Source (Scan_Ptr);
-- Loop through digits (allowing underlines)
loop
Accumulate_Checksum (C);
UI_Int_Value :=
UI_Int_Value * 10 + (Character'Pos (C) - Character'Pos ('0'));
Scan_Ptr := Scan_Ptr + 1;
Scale := Scale - 1;
C := Source (Scan_Ptr);
-- Case of underline encountered
if C = '_' then
-- We do not accumulate the '_' in the checksum, so that
-- 1_234 is equivalent to 1234, and does not trigger
-- compilation for "minimal recompilation" (gnatmake -m).
loop
Scan_Ptr := Scan_Ptr + 1;
C := Source (Scan_Ptr);
exit when C /= '_';
Error_No_Double_Underline;
end loop;
if C not in '0' .. '9' then
Error_Digit_Expected;
exit;
end if;
else
exit when C not in '0' .. '9';
end if;
end loop;
end Scan_Integer;
-- Start of Processing for Nlit
begin
Base := 10;
UI_Base := Uint_10;
UI_Int_Value := Uint_0;
Based_Literal_Uses_Colon := False;
Scale := 0;
Scan_Integer;
Point_Scanned := False;
UI_Num_Value := UI_Int_Value;
-- Various possibilities now for continuing the literal are period,
-- E/e (for exponent), or :/# (for based literal).
Scale := 0;
C := Source (Scan_Ptr);
if C = '.' then
-- Scan out point, but do not scan past .. which is a range
-- sequence, and must not be eaten up scanning a numeric literal.
while C = '.' and then Source (Scan_Ptr + 1) /= '.' loop
Accumulate_Checksum ('.');
if Point_Scanned then
Error_Msg_S ("duplicate point ignored");
end if;
Point_Scanned := True;
Scan_Ptr := Scan_Ptr + 1;
C := Source (Scan_Ptr);
if C not in '0' .. '9' then
Error_Msg
("real literal cannot end with point", Scan_Ptr - 1);
else
Scan_Integer;
UI_Num_Value := UI_Int_Value;
end if;
end loop;
-- Based literal case. The base is the value we already scanned.
-- In the case of colon, we insist that the following character
-- is indeed an extended digit or a period. This catches a number
-- of common errors, as well as catching the well known tricky
-- bug otherwise arising from "x : integer range 1 .. 10:= 6;"
elsif C = '#'
or else (C = ':' and then
(Source (Scan_Ptr + 1) = '.'
or else
Source (Scan_Ptr + 1) in '0' .. '9'
or else
Source (Scan_Ptr + 1) in 'A' .. 'Z'
or else
Source (Scan_Ptr + 1) in 'a' .. 'z'))
then
Accumulate_Checksum (C);
Base_Char := C;
UI_Base := UI_Int_Value;
if Base_Char = ':' then
Based_Literal_Uses_Colon := True;
end if;
if UI_Base < 2 or else UI_Base > 16 then
Error_Msg_SC ("base not 2-16");
UI_Base := Uint_16;
end if;
Base := UI_To_Int (UI_Base);
Scan_Ptr := Scan_Ptr + 1;
-- Scan out extended integer [. integer]
C := Source (Scan_Ptr);
UI_Int_Value := Uint_0;
Scale := 0;
loop
if C in '0' .. '9' then
Accumulate_Checksum (C);
Extended_Digit_Value :=
Int'(Character'Pos (C)) - Int'(Character'Pos ('0'));
elsif C in 'A' .. 'F' then
Accumulate_Checksum (Character'Val (Character'Pos (C) + 32));
Extended_Digit_Value :=
Int'(Character'Pos (C)) - Int'(Character'Pos ('A')) + 10;
elsif C in 'a' .. 'f' then
Accumulate_Checksum (C);
Extended_Digit_Value :=
Int'(Character'Pos (C)) - Int'(Character'Pos ('a')) + 10;
else
Error_Msg_S ("extended digit expected");
exit;
end if;
if Extended_Digit_Value >= Base then
Error_Msg_S ("digit '>= base");
end if;
UI_Int_Value := UI_Int_Value * UI_Base + Extended_Digit_Value;
Scale := Scale - 1;
Scan_Ptr := Scan_Ptr + 1;
C := Source (Scan_Ptr);
if C = '_' then
loop
Accumulate_Checksum ('_');
Scan_Ptr := Scan_Ptr + 1;
C := Source (Scan_Ptr);
exit when C /= '_';
Error_No_Double_Underline;
end loop;
elsif C = '.' then
Accumulate_Checksum ('.');
if Point_Scanned then
Error_Msg_S ("duplicate point ignored");
end if;
Scan_Ptr := Scan_Ptr + 1;
C := Source (Scan_Ptr);
Point_Scanned := True;
Scale := 0;
elsif C = Base_Char then
Accumulate_Checksum (C);
Scan_Ptr := Scan_Ptr + 1;
exit;
elsif C = '#' or else C = ':' then
Error_Msg_S ("based number delimiters must match");
Scan_Ptr := Scan_Ptr + 1;
exit;
elsif not Identifier_Char (C) then
if Base_Char = '#' then
Error_Msg_S -- CODEFIX
("missing '#");
else
Error_Msg_S -- CODEFIX
("missing ':");
end if;
exit;
end if;
end loop;
UI_Num_Value := UI_Int_Value;
end if;
-- Scan out exponent
if not Point_Scanned then
Scale := 0;
UI_Scale := Uint_0;
else
UI_Scale := UI_From_Int (Scale);
end if;
if Source (Scan_Ptr) = 'e' or else Source (Scan_Ptr) = 'E' then
Accumulate_Checksum ('e');
Scan_Ptr := Scan_Ptr + 1;
Exponent_Is_Negative := False;
if Source (Scan_Ptr) = '+' then
Accumulate_Checksum ('+');
Scan_Ptr := Scan_Ptr + 1;
elsif Source (Scan_Ptr) = '-' then
Accumulate_Checksum ('-');
if not Point_Scanned then
Error_Msg_S
("negative exponent not allowed for integer literal");
else
Exponent_Is_Negative := True;
end if;
Scan_Ptr := Scan_Ptr + 1;
end if;
UI_Int_Value := Uint_0;
if Source (Scan_Ptr) in '0' .. '9' then
Scan_Integer;
else
Error_Digit_Expected;
end if;
if Exponent_Is_Negative then
UI_Scale := UI_Scale - UI_Int_Value;
else
UI_Scale := UI_Scale + UI_Int_Value;
end if;
end if;
-- Case of real literal to be returned
if Point_Scanned then
Token := Tok_Real_Literal;
Real_Literal_Value :=
UR_From_Components (
Num => UI_Num_Value,
Den => -UI_Scale,
Rbase => Base);
-- Case of integer literal to be returned
else
Token := Tok_Integer_Literal;
if UI_Scale = 0 then
Int_Literal_Value := UI_Num_Value;
-- Avoid doing possibly expensive calculations in cases like
-- parsing 163E800_000# when semantics will not be done anyway.
-- This is especially useful when parsing garbled input.
elsif Operating_Mode /= Check_Syntax
and then (Serious_Errors_Detected = 0 or else Try_Semantics)
then
Int_Literal_Value := UI_Num_Value * UI_Base ** UI_Scale;
else
Int_Literal_Value := No_Uint;
end if;
end if;
if Checksum_Accumulate_Token_Checksum then
Accumulate_Token_Checksum;
end if;
return;
end Nlit;
----------
-- Slit --
----------
procedure Slit is
Delimiter : Character;
-- Delimiter (first character of string)
C : Character;
-- Current source program character
Code : Char_Code;
-- Current character code value
Err : Boolean;
-- Error flag for Scan_Wide call
String_Start : Source_Ptr;
-- Point to first character of string
procedure Error_Bad_String_Char;
-- Signal bad character in string/character literal. On entry
-- Scan_Ptr points to the improper character encountered during the
-- scan. Scan_Ptr is not modified, so it still points to the bad
-- character on return.
procedure Error_Unterminated_String;
-- Procedure called if a line terminator character is encountered
-- during scanning a string, meaning that the string is not properly
-- terminated.
procedure Set_String;
-- Procedure used to distinguish between string and operator symbol.
-- On entry the string has been scanned out, and its characters start
-- at Token_Ptr and end one character before Scan_Ptr. On exit Token
-- is set to Tok_String_Literal/Tok_Operator_Symbol as appropriate,
-- and Token_Node is appropriately initialized. In addition, in the
-- operator symbol case, Token_Name is appropriately set, and the
-- flags [Wide_]Wide_Character_Found are set appropriately.
---------------------------
-- Error_Bad_String_Char --
---------------------------
procedure Error_Bad_String_Char is
C : constant Character := Source (Scan_Ptr);
begin
if C = HT then
Error_Msg_S ("horizontal tab not allowed in string");
elsif C = VT or else C = FF then
Error_Msg_S ("format effector not allowed in string");
elsif C in Upper_Half_Character then
Error_Msg_S ("(Ada 83) upper half character not allowed");
else
Error_Msg_S ("control character not allowed in string");
end if;
end Error_Bad_String_Char;
-------------------------------
-- Error_Unterminated_String --
-------------------------------
procedure Error_Unterminated_String is
S : Source_Ptr;
begin
-- An interesting little refinement. Consider the following
-- examples:
-- A := "this is an unterminated string;
-- A := "this is an unterminated string &
-- P(A, "this is a parameter that didn't get terminated);
-- P("this is a parameter that didn't get terminated, A);
-- We fiddle a little to do slightly better placement in these
-- cases also if there is white space at the end of the line we
-- place the flag at the start of this white space, not at the
-- end. Note that we only have to test for blanks, since tabs
-- aren't allowed in strings in the first place and would have
-- caused an error message.
-- Two more cases that we treat specially are:
-- A := "this string uses the wrong terminator'
-- A := "this string uses the wrong terminator' &
-- In these cases we give a different error message as well
-- We actually reposition the scan pointer to the point where we
-- place the flag in these cases, since it seems a better bet on
-- the original intention.
while Source (Scan_Ptr - 1) = ' '
or else Source (Scan_Ptr - 1) = '&'
loop
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
end loop;
-- Check for case of incorrect string terminator, but single quote
-- is not considered incorrect if the opening terminator misused
-- a single quote (error message already given).
if Delimiter /= '''
and then Source (Scan_Ptr - 1) = '''
then
Unstore_String_Char;
Error_Msg
("incorrect string terminator character", Scan_Ptr - 1);
return;
end if;
-- Backup over semicolon or right-paren/semicolon sequence
if Source (Scan_Ptr - 1) = ';' then
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
if Source (Scan_Ptr - 1) = ')' then
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
end if;
end if;
-- See if there is a comma in the string, if so, guess that
-- the first comma terminates the string.
S := String_Start;
while S < Scan_Ptr loop
if Source (S) = ',' then
while Scan_Ptr > S loop
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
end loop;
exit;
end if;
S := S + 1;
end loop;
-- Now we have adjusted the scan pointer, give message
Error_Msg_S -- CODEFIX
("missing string quote");
end Error_Unterminated_String;
----------------
-- Set_String --
----------------
procedure Set_String is
Slen : constant Int := Int (Scan_Ptr - Token_Ptr - 2);
C1 : Character;
C2 : Character;
C3 : Character;
begin
-- Token_Name is currently set to Error_Name. The following
-- section of code resets Token_Name to the proper Name_Op_xx
-- value if the string is a valid operator symbol, otherwise it is
-- left set to Error_Name.
if Slen = 1 then
C1 := Source (Token_Ptr + 1);
case C1 is
when '=' =>
Token_Name := Name_Op_Eq;
when '>' =>
Token_Name := Name_Op_Gt;
when '<' =>
Token_Name := Name_Op_Lt;
when '+' =>
Token_Name := Name_Op_Add;
when '-' =>
Token_Name := Name_Op_Subtract;
when '&' =>
Token_Name := Name_Op_Concat;
when '*' =>
Token_Name := Name_Op_Multiply;
when '/' =>
Token_Name := Name_Op_Divide;
when others =>
null;
end case;
elsif Slen = 2 then
C1 := Source (Token_Ptr + 1);
C2 := Source (Token_Ptr + 2);
if C1 = '*' and then C2 = '*' then
Token_Name := Name_Op_Expon;
elsif C2 = '=' then
if C1 = '/' then
Token_Name := Name_Op_Ne;
elsif C1 = '<' then
Token_Name := Name_Op_Le;
elsif C1 = '>' then
Token_Name := Name_Op_Ge;
end if;
elsif (C1 = 'O' or else C1 = 'o') and then -- OR
(C2 = 'R' or else C2 = 'r')
then
Token_Name := Name_Op_Or;
end if;
elsif Slen = 3 then
C1 := Source (Token_Ptr + 1);
C2 := Source (Token_Ptr + 2);
C3 := Source (Token_Ptr + 3);
if (C1 = 'A' or else C1 = 'a') and then -- AND
(C2 = 'N' or else C2 = 'n') and then
(C3 = 'D' or else C3 = 'd')
then
Token_Name := Name_Op_And;
elsif (C1 = 'A' or else C1 = 'a') and then -- ABS
(C2 = 'B' or else C2 = 'b') and then
(C3 = 'S' or else C3 = 's')
then
Token_Name := Name_Op_Abs;
elsif (C1 = 'M' or else C1 = 'm') and then -- MOD
(C2 = 'O' or else C2 = 'o') and then
(C3 = 'D' or else C3 = 'd')
then
Token_Name := Name_Op_Mod;
elsif (C1 = 'N' or else C1 = 'n') and then -- NOT
(C2 = 'O' or else C2 = 'o') and then
(C3 = 'T' or else C3 = 't')
then
Token_Name := Name_Op_Not;
elsif (C1 = 'R' or else C1 = 'r') and then -- REM
(C2 = 'E' or else C2 = 'e') and then
(C3 = 'M' or else C3 = 'm')
then
Token_Name := Name_Op_Rem;
elsif (C1 = 'X' or else C1 = 'x') and then -- XOR
(C2 = 'O' or else C2 = 'o') and then
(C3 = 'R' or else C3 = 'r')
then
Token_Name := Name_Op_Xor;
end if;
end if;
-- If it is an operator symbol, then Token_Name is set. If it is
-- some other string value, then Token_Name still contains
-- Error_Name.
if Token_Name = Error_Name then
Token := Tok_String_Literal;
else
Token := Tok_Operator_Symbol;
end if;
end Set_String;
-- Start of processing for Slit
begin
-- On entry, Scan_Ptr points to the opening character of the string
-- which is either a percent, double quote, or apostrophe (single
-- quote). The latter case is an error detected by the character
-- literal circuit.
String_Start := Scan_Ptr;
Delimiter := Source (Scan_Ptr);
Accumulate_Checksum (Delimiter);
Start_String;
Wide_Character_Found := False;
Wide_Wide_Character_Found := False;
Scan_Ptr := Scan_Ptr + 1;
-- Loop to scan out characters of string literal
loop
C := Source (Scan_Ptr);
if C = Delimiter then
Accumulate_Checksum (C);
Scan_Ptr := Scan_Ptr + 1;
exit when Source (Scan_Ptr) /= Delimiter;
Code := Get_Char_Code (C);
Accumulate_Checksum (C);
Scan_Ptr := Scan_Ptr + 1;
else
if C = '"' and then Delimiter = '%' then
Error_Msg_S
("quote not allowed in percent delimited string");
Code := Get_Char_Code (C);
Scan_Ptr := Scan_Ptr + 1;
elsif Start_Of_Wide_Character then
Wptr := Scan_Ptr;
Scan_Wide (Source, Scan_Ptr, Code, Err);
if Err then
Error_Illegal_Wide_Character;
Code := Get_Char_Code (' ');
end if;
Accumulate_Checksum (Code);
-- In Ada 95 mode we allow any wide characters in a string
-- but in Ada 2005, the set of characters allowed has been
-- restricted to graphic characters.
if Ada_Version >= Ada_2005
and then Is_UTF_32_Non_Graphic (UTF_32 (Code))
then
Error_Msg
("(Ada 2005) non-graphic character not permitted " &
"in string literal", Wptr);
end if;
else
Accumulate_Checksum (C);
if C not in Graphic_Character then
if C in Line_Terminator then
Error_Unterminated_String;
exit;
elsif C in Upper_Half_Character then
if Ada_Version = Ada_83 then
Error_Bad_String_Char;
end if;
else
Error_Bad_String_Char;
end if;
end if;
Code := Get_Char_Code (C);
Scan_Ptr := Scan_Ptr + 1;
end if;
end if;
Store_String_Char (Code);
if not In_Character_Range (Code) then
if In_Wide_Character_Range (Code) then
Wide_Character_Found := True;
else
Wide_Wide_Character_Found := True;
end if;
end if;
end loop;
String_Literal_Id := End_String;
Set_String;
return;
end Slit;
----------------------------------
-- Skip_Other_Format_Characters --
----------------------------------
procedure Skip_Other_Format_Characters is
P : Source_Ptr;
Code : Char_Code;
Err : Boolean;
begin
while Start_Of_Wide_Character loop
P := Scan_Ptr;
Scan_Wide (Source, Scan_Ptr, Code, Err);
if not Is_UTF_32_Other (UTF_32 (Code)) then
Scan_Ptr := P;
return;
end if;
end loop;
end Skip_Other_Format_Characters;
-----------------------------
-- Start_Of_Wide_Character --
-----------------------------
function Start_Of_Wide_Character return Boolean is
C : constant Character := Source (Scan_Ptr);
begin
-- ESC encoding method with ESC present
if C = ESC
and then Wide_Character_Encoding_Method in WC_ESC_Encoding_Method
then
return True;
-- Upper half character with upper half encoding
elsif C in Upper_Half_Character and then Upper_Half_Encoding then
return True;
-- Brackets encoding
elsif C = '['
and then Source (Scan_Ptr + 1) = '"'
and then Identifier_Char (Source (Scan_Ptr + 2))
then
return True;
-- Not the start of a wide character
else
return False;
end if;
end Start_Of_Wide_Character;
-- Start of processing for Scan
begin
Prev_Token := Token;
Prev_Token_Ptr := Token_Ptr;
Token_Name := Error_Name;
-- The following loop runs more than once only if a format effector
-- (tab, vertical tab, form feed, line feed, carriage return) is
-- encountered and skipped, or some error situation, such as an
-- illegal character, is encountered.
<<Scan_Next_Character>>
loop
-- Skip past blanks, loop is opened up for speed
while Source (Scan_Ptr) = ' ' loop
if Source (Scan_Ptr + 1) /= ' ' then
Scan_Ptr := Scan_Ptr + 1;
exit;
end if;
if Source (Scan_Ptr + 2) /= ' ' then
Scan_Ptr := Scan_Ptr + 2;
exit;
end if;
if Source (Scan_Ptr + 3) /= ' ' then
Scan_Ptr := Scan_Ptr + 3;
exit;
end if;
if Source (Scan_Ptr + 4) /= ' ' then
Scan_Ptr := Scan_Ptr + 4;
exit;
end if;
if Source (Scan_Ptr + 5) /= ' ' then
Scan_Ptr := Scan_Ptr + 5;
exit;
end if;
if Source (Scan_Ptr + 6) /= ' ' then
Scan_Ptr := Scan_Ptr + 6;
exit;
end if;
if Source (Scan_Ptr + 7) /= ' ' then
Scan_Ptr := Scan_Ptr + 7;
exit;
end if;
Scan_Ptr := Scan_Ptr + 8;
end loop;
-- We are now at a non-blank character, which is the first character
-- of the token we will scan, and hence the value of Token_Ptr.
Token_Ptr := Scan_Ptr;
-- Here begins the main case statement which transfers control on the
-- basis of the non-blank character we have encountered.
case Source (Scan_Ptr) is
-- Line terminator characters
when CR | LF | FF | VT =>
goto Scan_Line_Terminator;
-- Horizontal tab, just skip past it
when HT =>
if Style_Check then
Style.Check_HT;
end if;
Scan_Ptr := Scan_Ptr + 1;
-- End of file character, treated as an end of file only if it is
-- the last character in the buffer, otherwise it is ignored.
when EOF =>
if Scan_Ptr = Source_Last (Current_Source_File) then
Check_End_Of_Line;
if Style_Check then
Style.Check_EOF;
end if;
Token := Tok_EOF;
return;
else
Scan_Ptr := Scan_Ptr + 1;
end if;
-- Ampersand
when '&' =>
Accumulate_Checksum ('&');
if Source (Scan_Ptr + 1) = '&' then
Error_Msg_S -- CODEFIX
("'&'& should be `AND THEN`");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_And;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Ampersand;
return;
end if;
-- Asterisk (can be multiplication operator or double asterisk which
-- is the exponentiation compound delimiter).
when '*' =>
Accumulate_Checksum ('*');
if Source (Scan_Ptr + 1) = '*' then
Accumulate_Checksum ('*');
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Double_Asterisk;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Asterisk;
return;
end if;
-- Colon, which can either be an isolated colon, or part of an
-- assignment compound delimiter.
when ':' =>
Accumulate_Checksum (':');
if Double_Char_Token ('=') then
Token := Tok_Colon_Equal;
if Style_Check then
Style.Check_Colon_Equal;
end if;
return;
elsif Source (Scan_Ptr + 1) = '-'
and then Source (Scan_Ptr + 2) /= '-'
then
Token := Tok_Colon_Equal;
Error_Msg -- CODEFIX
(":- should be :=", Scan_Ptr);
Scan_Ptr := Scan_Ptr + 2;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Colon;
if Style_Check then
Style.Check_Colon;
end if;
return;
end if;
-- Left parenthesis
when '(' =>
Accumulate_Checksum ('(');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Left_Paren;
if Style_Check then
Style.Check_Left_Paren;
end if;
return;
-- Left bracket
when '[' =>
if Source (Scan_Ptr + 1) = '"' then
goto Scan_Wide_Character;
else
Error_Msg_S ("illegal character, replaced by ""(""");
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Left_Paren;
return;
end if;
-- Left brace
when '{' =>
Error_Msg_S ("illegal character, replaced by ""(""");
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Left_Paren;
return;
-- Comma
when ',' =>
Accumulate_Checksum (',');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Comma;
if Style_Check then
Style.Check_Comma;
end if;
return;
-- Dot, which is either an isolated period, or part of a double dot
-- compound delimiter sequence. We also check for the case of a
-- digit following the period, to give a better error message.
when '.' =>
Accumulate_Checksum ('.');
if Double_Char_Token ('.') then
Token := Tok_Dot_Dot;
if Style_Check then
Style.Check_Dot_Dot;
end if;
return;
elsif Source (Scan_Ptr + 1) in '0' .. '9' then
Error_Msg_S ("numeric literal cannot start with point");
Scan_Ptr := Scan_Ptr + 1;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Dot;
return;
end if;
-- Equal, which can either be an equality operator, or part of the
-- arrow (=>) compound delimiter.
when '=' =>
Accumulate_Checksum ('=');
if Double_Char_Token ('>') then
Token := Tok_Arrow;
if Style_Check then
Style.Check_Arrow (Inside_Depends);
end if;
return;
elsif Source (Scan_Ptr + 1) = '=' then
Error_Msg_S -- CODEFIX
("== should be =");
Scan_Ptr := Scan_Ptr + 1;
end if;
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Equal;
return;
-- Greater than, which can be a greater than operator, greater than
-- or equal operator, or first character of a right label bracket.
when '>' =>
Accumulate_Checksum ('>');
if Double_Char_Token ('=') then
Token := Tok_Greater_Equal;
return;
elsif Double_Char_Token ('>') then
Token := Tok_Greater_Greater;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Greater;
return;
end if;
-- Less than, which can be a less than operator, less than or equal
-- operator, or the first character of a left label bracket, or the
-- first character of a box (<>) compound delimiter.
when '<' =>
Accumulate_Checksum ('<');
if Double_Char_Token ('=') then
Token := Tok_Less_Equal;
return;
elsif Double_Char_Token ('>') then
Token := Tok_Box;
if Style_Check then
Style.Check_Box;
end if;
return;
elsif Double_Char_Token ('<') then
Token := Tok_Less_Less;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Less;
return;
end if;
-- Minus, which is either a subtraction operator, or the first
-- character of double minus starting a comment
when '-' => Minus_Case : begin
if Source (Scan_Ptr + 1) = '>' then
Error_Msg_S ("invalid token");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Arrow;
return;
elsif Source (Scan_Ptr + 1) /= '-' then
Accumulate_Checksum ('-');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Minus;
return;
-- Comment
else -- Source (Scan_Ptr + 1) = '-' then
if Style_Check then
Style.Check_Comment;
end if;
Scan_Ptr := Scan_Ptr + 2;
-- If we are in preprocessor mode with Replace_In_Comments set,
-- then we return the "--" as a token on its own.
if Replace_In_Comments then
Token := Tok_Comment;
return;
end if;
-- Otherwise scan out the comment
Start_Of_Comment := Scan_Ptr;
-- Loop to scan comment (this loop runs more than once only if
-- a horizontal tab or other non-graphic character is scanned)
loop
-- Scan to non graphic character (opened up for speed)
-- Note that we just eat left brackets, which means that
-- bracket notation cannot be used for end of line
-- characters in comments. This seems a reasonable choice,
-- since no one would ever use brackets notation in a real
-- program in this situation, and if we allow brackets
-- notation, we forbid some valid comments which contain a
-- brackets sequence that happens to match an end of line
-- character.
loop
exit when Source (Scan_Ptr) not in Graphic_Character;
Scan_Ptr := Scan_Ptr + 1;
exit when Source (Scan_Ptr) not in Graphic_Character;
Scan_Ptr := Scan_Ptr + 1;
exit when Source (Scan_Ptr) not in Graphic_Character;
Scan_Ptr := Scan_Ptr + 1;
exit when Source (Scan_Ptr) not in Graphic_Character;
Scan_Ptr := Scan_Ptr + 1;
exit when Source (Scan_Ptr) not in Graphic_Character;
Scan_Ptr := Scan_Ptr + 1;
end loop;
-- Keep going if horizontal tab
if Source (Scan_Ptr) = HT then
if Style_Check then
Style.Check_HT;
end if;
Scan_Ptr := Scan_Ptr + 1;
-- Terminate scan of comment if line terminator
elsif Source (Scan_Ptr) in Line_Terminator then
exit;
-- Terminate scan of comment if end of file encountered
-- (embedded EOF character or real last character in file)
elsif Source (Scan_Ptr) = EOF then
exit;
-- If we have a wide character, we have to scan it out,
-- because it might be a legitimate line terminator
elsif Start_Of_Wide_Character then
declare
Wptr : constant Source_Ptr := Scan_Ptr;
Code : Char_Code;
Err : Boolean;
begin
Scan_Wide (Source, Scan_Ptr, Code, Err);
-- If not well formed wide character, then just skip
-- past it and ignore it.
if Err then
Scan_Ptr := Wptr + 1;
-- If UTF_32 terminator, terminate comment scan
elsif Is_UTF_32_Line_Terminator (UTF_32 (Code)) then
Scan_Ptr := Wptr;
exit;
end if;
end;
-- Keep going if character in 80-FF range, or is ESC. These
-- characters are allowed in comments by RM-2.1(1), 2.7(2).
-- They are allowed even in Ada 83 mode according to the
-- approved AI. ESC was added to the AI in June 93.
elsif Source (Scan_Ptr) in Upper_Half_Character
or else Source (Scan_Ptr) = ESC
then
Scan_Ptr := Scan_Ptr + 1;
-- Otherwise we have an illegal comment character, ignore
-- this error in relaxed semantics mode.
else
if Relaxed_RM_Semantics then
Scan_Ptr := Scan_Ptr + 1;
else
Error_Illegal_Character;
end if;
end if;
end loop;
-- Note that, except when comments are tokens, we do NOT
-- execute a return here, instead we fall through to reexecute
-- the scan loop to look for a token.
if Comment_Is_Token then
Name_Len := Integer (Scan_Ptr - Start_Of_Comment);
Name_Buffer (1 .. Name_Len) :=
String (Source (Start_Of_Comment .. Scan_Ptr - 1));
Comment_Id := Name_Find;
Token := Tok_Comment;
return;
end if;
-- If the SPARK restriction is set for this unit, then generate
-- a token Tok_SPARK_Hide for a SPARK HIDE directive.
-- if Restriction_Check_Required (SPARK_05)
-- and then Source (Start_Of_Comment) = '#'
-- then
-- declare
-- Scan_SPARK_Ptr : Source_Ptr;
--
-- begin
-- Scan_SPARK_Ptr := Start_Of_Comment + 1;
--
-- -- Scan out blanks
--
-- while Source (Scan_SPARK_Ptr) = ' '
-- or else Source (Scan_SPARK_Ptr) = HT
-- loop
-- Scan_SPARK_Ptr := Scan_SPARK_Ptr + 1;
-- end loop;
--
-- -- Recognize HIDE directive. SPARK input cannot be
-- -- encoded as wide characters, so only deal with
-- -- lower/upper case.
--
-- if (Source (Scan_SPARK_Ptr) = 'h'
-- or else Source (Scan_SPARK_Ptr) = 'H')
-- and then (Source (Scan_SPARK_Ptr + 1) = 'i'
-- or else Source (Scan_SPARK_Ptr + 1) = 'I')
-- and then (Source (Scan_SPARK_Ptr + 2) = 'd'
-- or else Source (Scan_SPARK_Ptr + 2) = 'D')
-- and then (Source (Scan_SPARK_Ptr + 3) = 'e'
-- or else Source (Scan_SPARK_Ptr + 3) = 'E')
-- and then (Source (Scan_SPARK_Ptr + 4) = ' '
-- or else Source (Scan_SPARK_Ptr + 4) = HT)
-- then
-- Token := Tok_SPARK_Hide;
-- return;
-- end if;
-- end;
-- end if;
end if;
end Minus_Case;
-- Double quote or percent starting a string literal
when '"' | '%' =>
Slit;
Post_Scan;
return;
-- Apostrophe. This can either be the start of a character literal,
-- or an isolated apostrophe used in a qualified expression or an
-- attribute. We treat it as a character literal if it does not
-- follow a right parenthesis, identifier, the keyword ALL or
-- a literal. This means that we correctly treat constructs like:
-- A := CHARACTER'('A');
-- Note that RM-2.2(7) does not require a separator between
-- "CHARACTER" and "'" in the above.
when ''' => Char_Literal_Case : declare
Code : Char_Code;
Err : Boolean;
begin
Accumulate_Checksum (''');
Scan_Ptr := Scan_Ptr + 1;
-- Here is where we make the test to distinguish the cases. Treat
-- as apostrophe if previous token is an identifier, right paren
-- or the reserved word "all" (latter case as in A.all'Address)
-- (or the reserved word "project" in project files). Also treat
-- it as apostrophe after a literal (this catches some legitimate
-- cases, like A."abs"'Address, and also gives better error
-- behavior for impossible cases like 123'xxx).
if Prev_Token = Tok_Identifier
or else Prev_Token = Tok_Right_Paren
or else Prev_Token = Tok_All
or else Prev_Token = Tok_Project
or else Prev_Token in Token_Class_Literal
then
Token := Tok_Apostrophe;
if Style_Check then
Style.Check_Apostrophe;
end if;
return;
-- Otherwise the apostrophe starts a character literal
else
-- Case of wide character literal
if Start_Of_Wide_Character then
Wptr := Scan_Ptr;
Scan_Wide (Source, Scan_Ptr, Code, Err);
Accumulate_Checksum (Code);
if Err then
Error_Illegal_Wide_Character;
Code := Character'Pos (' ');
-- In Ada 95 mode we allow any wide character in a character
-- literal, but in Ada 2005, the set of characters allowed
-- is restricted to graphic characters.
elsif Ada_Version >= Ada_2005
and then Is_UTF_32_Non_Graphic (UTF_32 (Code))
then
Error_Msg -- CODEFIX????
("(Ada 2005) non-graphic character not permitted " &
"in character literal", Wptr);
end if;
if Source (Scan_Ptr) /= ''' then
Error_Msg_S ("missing apostrophe");
else
Scan_Ptr := Scan_Ptr + 1;
end if;
-- If we do not find a closing quote in the expected place then
-- assume that we have a misguided attempt at a string literal.
-- However, if previous token is RANGE, then we return an
-- apostrophe instead since this gives better error recovery
elsif Source (Scan_Ptr + 1) /= ''' then
if Prev_Token = Tok_Range then
Token := Tok_Apostrophe;
return;
else
Scan_Ptr := Scan_Ptr - 1;
Error_Msg_S
("strings are delimited by double quote character");
Slit;
Post_Scan;
return;
end if;
-- Otherwise we have a (non-wide) character literal
else
Accumulate_Checksum (Source (Scan_Ptr));
if Source (Scan_Ptr) not in Graphic_Character then
if Source (Scan_Ptr) in Upper_Half_Character then
if Ada_Version = Ada_83 then
Error_Illegal_Character;
end if;
else
Error_Illegal_Character;
end if;
end if;
Code := Get_Char_Code (Source (Scan_Ptr));
Scan_Ptr := Scan_Ptr + 2;
end if;
-- Fall through here with Scan_Ptr updated past the closing
-- quote, and Code set to the Char_Code value for the literal
Accumulate_Checksum (''');
Token := Tok_Char_Literal;
Set_Character_Literal_Name (Code);
Token_Name := Name_Find;
Character_Code := Code;
Post_Scan;
return;
end if;
end Char_Literal_Case;
-- Right parenthesis
when ')' =>
Accumulate_Checksum (')');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Right_Paren;
if Style_Check then
Style.Check_Right_Paren;
end if;
return;
-- Right bracket or right brace, treated as right paren
when ']' | '}' =>
Error_Msg_S ("illegal character, replaced by "")""");
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Right_Paren;
return;
-- Slash (can be division operator or first character of not equal)
when '/' =>
Accumulate_Checksum ('/');
if Double_Char_Token ('=') then
Token := Tok_Not_Equal;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Slash;
return;
end if;
-- Semicolon
when ';' =>
Accumulate_Checksum (';');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Semicolon;
if Style_Check then
Style.Check_Semicolon;
end if;
return;
-- Vertical bar
when '|' => Vertical_Bar_Case : begin
Accumulate_Checksum ('|');
-- Special check for || to give nice message
if Source (Scan_Ptr + 1) = '|' then
Error_Msg_S -- CODEFIX
("""'|'|"" should be `OR ELSE`");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Or;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Vertical_Bar;
if Style_Check then
Style.Check_Vertical_Bar;
end if;
Post_Scan;
return;
end if;
end Vertical_Bar_Case;
-- Exclamation, replacement character for vertical bar
when '!' => Exclamation_Case : begin
Accumulate_Checksum ('!');
if Source (Scan_Ptr + 1) = '=' then
Error_Msg_S -- CODEFIX
("'!= should be /=");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Not_Equal;
return;
else
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Vertical_Bar;
Post_Scan;
return;
end if;
end Exclamation_Case;
-- Plus
when '+' => Plus_Case : begin
Accumulate_Checksum ('+');
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Plus;
return;
end Plus_Case;
-- Digits starting a numeric literal
when '0' .. '9' =>
-- First a bit of a scan ahead to see if we have a case of an
-- identifier starting with a digit (remembering exponent case).
declare
C : constant Character := Source (Scan_Ptr + 1);
begin
-- OK literal if digit followed by digit or underscore
if C in '0' .. '9' or else C = '_' then
null;
-- OK literal if digit not followed by identifier char
elsif not Identifier_Char (C) then
null;
-- OK literal if digit followed by e/E followed by digit/sign.
-- We also allow underscore after the E, which is an error, but
-- better handled by Nlit than deciding this is an identifier.
elsif (C = 'e' or else C = 'E')
and then (Source (Scan_Ptr + 2) in '0' .. '9'
or else Source (Scan_Ptr + 2) = '+'
or else Source (Scan_Ptr + 2) = '-'
or else Source (Scan_Ptr + 2) = '_')
then
null;
-- Here we have what really looks like an identifier that
-- starts with a digit, so give error msg.
else
Error_Msg_S ("identifier may not start with digit");
Name_Len := 1;
Underline_Found := False;
Name_Buffer (1) := Source (Scan_Ptr);
Accumulate_Checksum (Name_Buffer (1));
Scan_Ptr := Scan_Ptr + 1;
goto Scan_Identifier;
end if;
end;
-- Here we have an OK integer literal
Nlit;
-- Check for proper delimiter, ignoring other format characters
Skip_Other_Format_Characters;
if Identifier_Char (Source (Scan_Ptr)) then
Error_Msg_S
("delimiter required between literal and identifier");
end if;
Post_Scan;
return;
-- Lower case letters
when 'a' .. 'z' =>
Name_Len := 1;
Underline_Found := False;
Name_Buffer (1) := Source (Scan_Ptr);
Accumulate_Checksum (Name_Buffer (1));
Scan_Ptr := Scan_Ptr + 1;
goto Scan_Identifier;
-- Upper case letters
when 'A' .. 'Z' =>
Name_Len := 1;
Underline_Found := False;
Name_Buffer (1) :=
Character'Val (Character'Pos (Source (Scan_Ptr)) + 32);
Accumulate_Checksum (Name_Buffer (1));
Scan_Ptr := Scan_Ptr + 1;
goto Scan_Identifier;
-- Underline character
when '_' =>
if Special_Characters ('_') then
Token_Ptr := Scan_Ptr;
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Special;
Special_Character := '_';
return;
end if;
Error_Msg_S ("identifier cannot start with underline");
Name_Len := 1;
Name_Buffer (1) := '_';
Scan_Ptr := Scan_Ptr + 1;
Underline_Found := False;
goto Scan_Identifier;
-- Space (not possible, because we scanned past blanks)
when ' ' =>
raise Program_Error;
-- Characters in top half of ASCII 8-bit chart
when Upper_Half_Character =>
-- Wide character case
if Upper_Half_Encoding then
goto Scan_Wide_Character;
-- Otherwise we have OK Latin-1 character
else
-- Upper half characters may possibly be identifier letters
-- but can never be digits, so Identifier_Char can be used to
-- test for a valid start of identifier character.
if Identifier_Char (Source (Scan_Ptr)) then
Name_Len := 0;
Underline_Found := False;
goto Scan_Identifier;
else
Error_Illegal_Character;
end if;
end if;
when ESC =>
-- ESC character, possible start of identifier if wide characters
-- using ESC encoding are allowed in identifiers, which we can
-- tell by looking at the Identifier_Char flag for ESC, which is
-- only true if these conditions are met. In Ada 2005 mode, may
-- also be valid UTF_32 space or line terminator character.
if Identifier_Char (ESC) then
Name_Len := 0;
goto Scan_Wide_Character;
else
Error_Illegal_Character;
end if;
-- Invalid control characters
when NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | ASCII.SO |
SI | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN |
EM | FS | GS | RS | US | DEL
=>
Error_Illegal_Character;
-- Invalid graphic characters
when '#' | '$' | '?' | '@' | '`' | '\' | '^' | '~' =>
-- If Set_Special_Character has been called for this character,
-- set Scans.Special_Character and return a Special token.
if Special_Characters (Source (Scan_Ptr)) then
Token_Ptr := Scan_Ptr;
Token := Tok_Special;
Special_Character := Source (Scan_Ptr);
Scan_Ptr := Scan_Ptr + 1;
return;
-- Check for something looking like a preprocessor directive
elsif Source (Scan_Ptr) = '#'
and then (Source (Scan_Ptr + 1 .. Scan_Ptr + 2) = "if"
or else
Source (Scan_Ptr + 1 .. Scan_Ptr + 5) = "elsif"
or else
Source (Scan_Ptr + 1 .. Scan_Ptr + 4) = "else"
or else
Source (Scan_Ptr + 1 .. Scan_Ptr + 3) = "end")
then
Error_Msg_S
("preprocessor directive ignored, preprocessor not active");
-- Skip to end of line
loop
if Source (Scan_Ptr) in Graphic_Character
or else
Source (Scan_Ptr) = HT
then
Scan_Ptr := Scan_Ptr + 1;
-- Done if line terminator or EOF
elsif Source (Scan_Ptr) in Line_Terminator
or else
Source (Scan_Ptr) = EOF
then
exit;
-- If we have a wide character, we have to scan it out,
-- because it might be a legitimate line terminator
elsif Start_Of_Wide_Character then
declare
Wptr : constant Source_Ptr := Scan_Ptr;
Code : Char_Code;
Err : Boolean;
begin
Scan_Wide (Source, Scan_Ptr, Code, Err);
-- If not well formed wide character, then just skip
-- past it and ignore it.
if Err then
Scan_Ptr := Wptr + 1;
-- If UTF_32 terminator, terminate comment scan
elsif Is_UTF_32_Line_Terminator (UTF_32 (Code)) then
Scan_Ptr := Wptr;
exit;
end if;
end;
-- Else keep going (don't worry about bad comment chars
-- in this context, we just want to find the end of line.
else
Scan_Ptr := Scan_Ptr + 1;
end if;
end loop;
-- Otherwise, this is an illegal character
else
Error_Illegal_Character;
end if;
-- End switch on non-blank character
end case;
-- End loop past format effectors. The exit from this loop is by
-- executing a return statement following completion of token scan
-- (control never falls out of this loop to the code which follows)
end loop;
-- Wide_Character scanning routine. On entry we have encountered the
-- initial character of a wide character sequence.
<<Scan_Wide_Character>>
declare
Code : Char_Code;
Cat : Category;
Err : Boolean;
begin
Wptr := Scan_Ptr;
Scan_Wide (Source, Scan_Ptr, Code, Err);
-- If bad wide character, signal error and continue scan
if Err then
Error_Illegal_Wide_Character;
goto Scan_Next_Character;
end if;
Cat := Get_Category (UTF_32 (Code));
-- If OK letter, reset scan ptr and go scan identifier
if Is_UTF_32_Letter (Cat) then
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
goto Scan_Identifier;
-- If OK wide space, ignore and keep scanning (we do not include
-- any ignored spaces in checksum)
elsif Is_UTF_32_Space (Cat) then
goto Scan_Next_Character;
-- If other format character, ignore and keep scanning (again we
-- do not include in the checksum) (this is for AI-0079).
elsif Is_UTF_32_Other (Cat) then
goto Scan_Next_Character;
-- If OK wide line terminator, terminate current line
elsif Is_UTF_32_Line_Terminator (UTF_32 (Code)) then
Scan_Ptr := Wptr;
goto Scan_Line_Terminator;
-- Punctuation is an error (at start of identifier)
elsif Is_UTF_32_Punctuation (Cat) then
Error_Msg ("identifier cannot start with punctuation", Wptr);
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
goto Scan_Identifier;
-- Mark character is an error (at start of identifier)
elsif Is_UTF_32_Mark (Cat) then
Error_Msg ("identifier cannot start with mark character", Wptr);
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
goto Scan_Identifier;
-- Extended digit character is an error. Could be bad start of
-- identifier or bad literal. Not worth doing too much to try to
-- distinguish these cases, but we will do a little bit.
elsif Is_UTF_32_Digit (Cat) then
Error_Msg
("identifier cannot start with digit character", Wptr);
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
goto Scan_Identifier;
-- All other wide characters are illegal here
else
Error_Illegal_Wide_Character;
goto Scan_Next_Character;
end if;
end;
-- Routine to scan line terminator. On entry Scan_Ptr points to a
-- character which is one of FF,LR,CR,VT, or one of the wide characters
-- that is treated as a line terminator.
<<Scan_Line_Terminator>>
-- Check line too long
Check_End_Of_Line;
-- Set Token_Ptr, if End_Of_Line is a token, for the case when it is
-- a physical line.
if End_Of_Line_Is_Token then
Token_Ptr := Scan_Ptr;
end if;
declare
Physical : Boolean;
begin
Skip_Line_Terminators (Scan_Ptr, Physical);
-- If we are at start of physical line, update scan pointers to
-- reflect the start of the new line.
if Physical then
Current_Line_Start := Scan_Ptr;
Start_Column := Set_Start_Column;
First_Non_Blank_Location := Scan_Ptr;
-- If End_Of_Line is a token, we return it as it is a
-- physical line.
if End_Of_Line_Is_Token then
Token := Tok_End_Of_Line;
return;
end if;
end if;
end;
goto Scan_Next_Character;
-- Identifier scanning routine. On entry, some initial characters of
-- the identifier may have already been stored in Name_Buffer. If so,
-- Name_Len has the number of characters stored, otherwise Name_Len is
-- set to zero on entry. Underline_Found is also set False on entry.
<<Scan_Identifier>>
-- This loop scans as fast as possible past lower half letters and
-- digits, which we expect to be the most common characters.
loop
if Source (Scan_Ptr) in 'a' .. 'z'
or else Source (Scan_Ptr) in '0' .. '9'
then
Name_Buffer (Name_Len + 1) := Source (Scan_Ptr);
Accumulate_Checksum (Source (Scan_Ptr));
elsif Source (Scan_Ptr) in 'A' .. 'Z' then
Name_Buffer (Name_Len + 1) :=
Character'Val (Character'Pos (Source (Scan_Ptr)) + 32);
Accumulate_Checksum (Name_Buffer (Name_Len + 1));
else
exit;
end if;
Underline_Found := False;
Scan_Ptr := Scan_Ptr + 1;
Name_Len := Name_Len + 1;
end loop;
-- If we fall through, then we have encountered either an underline
-- character, or an extended identifier character (i.e. one from the
-- upper half), or a wide character, or an identifier terminator. The
-- initial test speeds us up in the most common case where we have
-- an identifier terminator. Note that ESC is an identifier character
-- only if a wide character encoding method that uses ESC encoding
-- is active, so if we find an ESC character we know that we have a
-- wide character.
if Identifier_Char (Source (Scan_Ptr))
or else (Source (Scan_Ptr) in Upper_Half_Character
and then Upper_Half_Encoding)
then
-- Case of underline
if Source (Scan_Ptr) = '_' then
Accumulate_Checksum ('_');
if Underline_Found then
Error_No_Double_Underline;
else
Underline_Found := True;
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := '_';
end if;
Scan_Ptr := Scan_Ptr + 1;
goto Scan_Identifier;
-- Upper half character
elsif Source (Scan_Ptr) in Upper_Half_Character
and then not Upper_Half_Encoding
then
Accumulate_Checksum (Source (Scan_Ptr));
Store_Encoded_Character
(Get_Char_Code (Fold_Lower (Source (Scan_Ptr))));
Scan_Ptr := Scan_Ptr + 1;
Underline_Found := False;
goto Scan_Identifier;
-- Left bracket not followed by a quote terminates an identifier.
-- This is an error, but we don't want to give a junk error msg
-- about wide characters in this case.
elsif Source (Scan_Ptr) = '['
and then Source (Scan_Ptr + 1) /= '"'
then
null;
-- We know we have a wide character encoding here (the current
-- character is either ESC, left bracket, or an upper half
-- character depending on the encoding method).
else
-- Scan out the wide character and insert the appropriate
-- encoding into the name table entry for the identifier.
declare
Code : Char_Code;
Err : Boolean;
Chr : Character;
Cat : Category;
begin
Wptr := Scan_Ptr;
Scan_Wide (Source, Scan_Ptr, Code, Err);
-- If error, signal error
if Err then
Error_Illegal_Wide_Character;
-- If the character scanned is a normal identifier
-- character, then we treat it that way.
elsif In_Character_Range (Code)
and then Identifier_Char (Get_Character (Code))
then
Chr := Get_Character (Code);
Accumulate_Checksum (Chr);
Store_Encoded_Character
(Get_Char_Code (Fold_Lower (Chr)));
Underline_Found := False;
-- Here if not a normal identifier character
else
Cat := Get_Category (UTF_32 (Code));
-- Wide character in Unicode category "Other, Format"
-- is not accepted in an identifier. This is because it
-- it is considered a security risk (AI-0091).
-- However, it is OK for such a character to appear at
-- the end of an identifier.
if Is_UTF_32_Other (Cat) then
if not Identifier_Char (Source (Scan_Ptr)) then
goto Scan_Identifier_Complete;
else
Error_Msg
("identifier cannot contain other_format "
& "character", Wptr);
goto Scan_Identifier;
end if;
-- Wide character in category Separator,Space terminates
elsif Is_UTF_32_Space (Cat) then
goto Scan_Identifier_Complete;
end if;
-- Here if wide character is part of the identifier
-- Make sure we are allowing wide characters in
-- identifiers. Note that we allow wide character
-- notation for an OK identifier character. This in
-- particular allows bracket or other notation to be
-- used for upper half letters.
-- Wide characters are always allowed in Ada 2005
if Identifier_Character_Set /= 'w'
and then Ada_Version < Ada_2005
then
Error_Msg
("wide character not allowed in identifier", Wptr);
end if;
-- If OK letter, store it folding to upper case. Note
-- that we include the folded letter in the checksum.
if Is_UTF_32_Letter (Cat) then
Code :=
Char_Code (UTF_32_To_Upper_Case (UTF_32 (Code)));
Accumulate_Checksum (Code);
Store_Encoded_Character (Code);
Underline_Found := False;
-- If OK extended digit or mark, then store it
elsif Is_UTF_32_Digit (Cat)
or else Is_UTF_32_Mark (Cat)
then
Accumulate_Checksum (Code);
Store_Encoded_Character (Code);
Underline_Found := False;
-- Wide punctuation is also stored, but counts as an
-- underline character for error checking purposes.
elsif Is_UTF_32_Punctuation (Cat) then
Accumulate_Checksum (Code);
if Underline_Found then
declare
Cend : constant Source_Ptr := Scan_Ptr;
begin
Scan_Ptr := Wptr;
Error_No_Double_Underline;
Scan_Ptr := Cend;
end;
else
Store_Encoded_Character (Code);
Underline_Found := True;
end if;
-- Any other wide character is not acceptable
else
Error_Msg
("invalid wide character in identifier", Wptr);
end if;
end if;
goto Scan_Identifier;
end;
end if;
end if;
-- Scan of identifier is complete. The identifier is stored in
-- Name_Buffer, and Scan_Ptr points past the last character.
<<Scan_Identifier_Complete>>
Token_Name := Name_Find;
-- Check for identifier ending with underline or punctuation char
if Underline_Found then
Underline_Found := False;
if Source (Scan_Ptr - 1) = '_' then
Error_Msg
("identifier cannot end with underline", Scan_Ptr - 1);
else
Error_Msg
("identifier cannot end with punctuation character", Wptr);
end if;
end if;
-- We will assume it is an identifier, not a keyword, so that the
-- checksum is independent of the Ada version.
Token := Tok_Identifier;
-- Here is where we check if it was a keyword
if Is_Keyword_Name (Token_Name) then
if Opt.Checksum_GNAT_6_3 then
Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name));
if Checksum_Accumulate_Token_Checksum then
if Checksum_GNAT_5_03 then
Accumulate_Token_Checksum_GNAT_5_03;
else
Accumulate_Token_Checksum_GNAT_6_3;
end if;
end if;
else
Accumulate_Token_Checksum;
Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name));
end if;
-- Keyword style checks
if Style_Check then
-- Deal with possible style check for non-lower case keyword,
-- but we don't treat ACCESS, DELTA, DIGITS, RANGE as keywords
-- for this purpose if they appear as attribute designators.
-- Actually we only check the first character for speed.
-- Ada 2005 (AI-284): Do not apply the style check in case of
-- "pragma Interface"
-- Ada 2005 (AI-340): Do not apply the style check in case of
-- MOD attribute.
if Source (Token_Ptr) <= 'Z'
and then (Prev_Token /= Tok_Apostrophe
or else
(Token /= Tok_Access and then
Token /= Tok_Delta and then
Token /= Tok_Digits and then
Token /= Tok_Mod and then
Token /= Tok_Range))
and then (Token /= Tok_Interface
or else
(Token = Tok_Interface
and then Prev_Token /= Tok_Pragma))
then
Style.Non_Lower_Case_Keyword;
end if;
-- Check THEN/ELSE style rules. These do not apply to AND THEN
-- or OR ELSE, and do not apply in if expressions.
if (Token = Tok_Then and then Prev_Token /= Tok_And)
or else
(Token = Tok_Else and then Prev_Token /= Tok_Or)
then
if Inside_If_Expression = 0 then
Style.Check_Separate_Stmt_Lines;
end if;
end if;
end if;
-- We must reset Token_Name since this is not an identifier and
-- if we leave Token_Name set, the parser gets confused because
-- it thinks it is dealing with an identifier instead of the
-- corresponding keyword.
Token_Name := No_Name;
return;
-- It is an identifier after all
else
if Checksum_Accumulate_Token_Checksum then
Accumulate_Token_Checksum;
end if;
Post_Scan;
return;
end if;
end Scan;
--------------------------
-- Set_Comment_As_Token --
--------------------------
procedure Set_Comment_As_Token (Value : Boolean) is
begin
Comment_Is_Token := Value;
end Set_Comment_As_Token;
------------------------------
-- Set_End_Of_Line_As_Token --
------------------------------
procedure Set_End_Of_Line_As_Token (Value : Boolean) is
begin
End_Of_Line_Is_Token := Value;
end Set_End_Of_Line_As_Token;
---------------------------
-- Set_Special_Character --
---------------------------
procedure Set_Special_Character (C : Character) is
begin
case C is
when '#' | '$' | '_' | '?' | '@' | '`' | '\' | '^' | '~' =>
Special_Characters (C) := True;
when others =>
null;
end case;
end Set_Special_Character;
----------------------
-- Set_Start_Column --
----------------------
-- Note: it seems at first glance a little expensive to compute this value
-- for every source line (since it is certainly not used for all source
-- lines). On the other hand, it doesn't take much more work to skip past
-- the initial white space on the line counting the columns than it would
-- to scan past the white space using the standard scanning circuits.
function Set_Start_Column return Column_Number is
Start_Column : Column_Number := 0;
begin
-- Outer loop scans past horizontal tab characters
Tabs_Loop : loop
-- Inner loop scans past blanks as fast as possible, bumping Scan_Ptr
-- past the blanks and adjusting Start_Column to account for them.
Blanks_Loop : loop
if Source (Scan_Ptr) = ' ' then
if Source (Scan_Ptr + 1) = ' ' then
if Source (Scan_Ptr + 2) = ' ' then
if Source (Scan_Ptr + 3) = ' ' then
if Source (Scan_Ptr + 4) = ' ' then
if Source (Scan_Ptr + 5) = ' ' then
if Source (Scan_Ptr + 6) = ' ' then
Scan_Ptr := Scan_Ptr + 7;
Start_Column := Start_Column + 7;
else
Scan_Ptr := Scan_Ptr + 6;
Start_Column := Start_Column + 6;
exit Blanks_Loop;
end if;
else
Scan_Ptr := Scan_Ptr + 5;
Start_Column := Start_Column + 5;
exit Blanks_Loop;
end if;
else
Scan_Ptr := Scan_Ptr + 4;
Start_Column := Start_Column + 4;
exit Blanks_Loop;
end if;
else
Scan_Ptr := Scan_Ptr + 3;
Start_Column := Start_Column + 3;
exit Blanks_Loop;
end if;
else
Scan_Ptr := Scan_Ptr + 2;
Start_Column := Start_Column + 2;
exit Blanks_Loop;
end if;
else
Scan_Ptr := Scan_Ptr + 1;
Start_Column := Start_Column + 1;
exit Blanks_Loop;
end if;
else
exit Blanks_Loop;
end if;
end loop Blanks_Loop;
-- Outer loop keeps going only if a horizontal tab follows
if Source (Scan_Ptr) = HT then
if Style_Check then
Style.Check_HT;
end if;
Scan_Ptr := Scan_Ptr + 1;
Start_Column := (Start_Column / 8) * 8 + 8;
else
exit Tabs_Loop;
end if;
end loop Tabs_Loop;
return Start_Column;
-- A constraint error can happen only if we have a compiler with checks on
-- and a line with a ludicrous number of tabs or spaces at the start. In
-- such a case, we really don't care if Start_Column is right or not.
exception
when Constraint_Error =>
return Start_Column;
end Set_Start_Column;
end Scng;
|
src/02-Hello-TIA/colorbg.asm | HudsonSchumaker/Atari-2600 | 0 | 168186 | ; <NAME>
; SchumakerTeam Lab
; Assembler should use basic 6502 instructions
processor 6502
; Include files for Atari 2600 constants and handy macro routines
include "vcs.h"
include "macro.h"
; 4K Atari 2600 ROMs usually start at address $F000
seg code
org $f000
START:
CLEAN_START ; Call macro to safely clear the memory
BKG:
lsr SWCHB ; test Console Reset switch
bcc START ; reset?
lda #$1C ; Load color code into A register
sta COLUBK ; Store A to memory address $09 (TIA COLUBK)
jmp BKG ; Repeat from START
; Here we skip to address $FFFC and define a word with the
; address of where the CPU should start fetching instructions.
; This also fills out the ROM size to $1000 (4k) bytes
org $FFFC ; Defines origin to $FFFC
.word START ; Reset vector at $FFFC (where program starts)
.word START ; Interrupt vector at $FFFE (unused by the VCS)
|
programs/oeis/038/A038714.asm | karttu/loda | 1 | 29898 | <gh_stars>1-10
; A038714: Promic numbers repeated 4 times; a(n) = floor(n/4) * ceiling((n+1)/4).
; 0,0,0,0,2,2,2,2,6,6,6,6,12,12,12,12,20,20,20,20,30,30,30,30,42,42,42,42,56,56,56,56,72,72,72,72,90,90,90,90,110,110,110,110,132,132,132,132,156,156,156,156,182,182,182,182,210,210,210,210,240,240,240,240,272,272,272,272,306,306,306,306,342,342,342,342,380,380,380,380,420,420,420,420,462,462,462,462,506,506,506,506,552,552,552,552,600,600,600,600,650,650,650,650,702,702,702,702,756,756,756,756,812,812,812,812,870,870,870,870,930,930,930,930,992,992,992,992,1056,1056,1056,1056,1122,1122,1122,1122,1190,1190,1190,1190,1260,1260,1260,1260,1332,1332,1332,1332,1406,1406,1406,1406,1482,1482,1482,1482,1560,1560,1560,1560,1640,1640,1640,1640,1722,1722,1722,1722,1806,1806,1806,1806,1892,1892,1892,1892,1980,1980,1980,1980,2070,2070,2070,2070,2162,2162,2162,2162,2256,2256,2256,2256,2352,2352,2352,2352,2450,2450,2450,2450,2550,2550,2550,2550,2652,2652,2652,2652,2756,2756,2756,2756,2862,2862,2862,2862,2970,2970,2970,2970,3080,3080,3080,3080,3192,3192,3192,3192,3306,3306,3306,3306,3422,3422,3422,3422,3540,3540,3540,3540,3660,3660,3660,3660,3782,3782,3782,3782,3906,3906
div $0,-4
bin $0,2
mov $1,$0
mul $1,2
|
src/System/IO/Examples/Four.agda | ilya-fiveisky/agda-system-io | 10 | 8443 | open import Data.Natural using ( Natural ; # ; _+_ )
module System.IO.Examples.Four where
four : Natural
four = # 2 + # 2 |
agda-stdlib/src/Data/Unit/Polymorphic.agda | DreamLinuxer/popl21-artifact | 5 | 13207 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- The universe polymorphic unit type and the total relation on unit
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Unit.Polymorphic where
------------------------------------------------------------------------
-- Re-export contents of Base module
open import Data.Unit.Polymorphic.Base public
------------------------------------------------------------------------
-- Re-export query operations
open import Data.Unit.Polymorphic.Properties public using (_≟_)
|
alloy4fun_models/trashltl/models/9/iByQj3K9agfKtPKf3.als | Kaixi26/org.alloytools.alloy | 0 | 2895 | open main
pred idiByQj3K9agfKtPKf3_prop10 {
always Protected' in Protected
}
pred __repair { idiByQj3K9agfKtPKf3_prop10 }
check __repair { idiByQj3K9agfKtPKf3_prop10 <=> prop10o } |
Lua.g4 | Xrayez/luascript | 0 | 4960 | <filename>Lua.g4
/*
BSD License
Copyright (c) 2013, <NAME>
Copyright (c) 2016, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the NAME of <NAME> 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.
This grammar file derived from:
Lua 5.4 Reference Manual
https://www.lua.org/manual/5.4/manual.html
Lua 5.3 Reference Manual
https://www.lua.org/manual/5.3/manual.html
Lua 5.2 Reference Manual
http://www.lua.org/manual/5.2/manual.html
Lua 5.1 grammar written by <NAME>
http://www.antlr3.org/grammar/1178608849736/Lua.g
Tested by <NAME> with Test suite for Lua 5.2 (http://www.lua.org/tests/5.2/)
Tested by <NAME> with Test suite for Lua 5.3 http://www.lua.org/tests/lua-5.3.2-tests.tar.gz
*/
grammar Lua;
chunk
: block EOF
;
block
: stat* retstat?
;
stat
: ';' # StatEmptySemicolon
| varlist '=' explist # StatAssignment
| functioncall # StatFunctionCall
| label # StatLabel
| 'break' # StatBreak
| 'goto' NAME # StatGoto
| 'do' block 'end' # StatDo
| 'while' exp 'do' block 'end' # StatWhile
| 'repeat' block 'until' exp # StatRepeat
| 'if' exp 'then' block ('elseif' exp 'then' block)* ('else' block)? 'end' # StatIfThenElse
| 'for' NAME '=' exp ',' exp (',' exp)? 'do' block 'end' # StatNumericFor
| 'for' namelist 'in' explist 'do' block 'end' # StatGenericFor
| 'function' funcname funcbody # StatFunction
| 'local' 'function' NAME funcbody # StatLocalFunction
| 'local' namelist ('=' explist)? # StatLocalNameList
;
retstat
: 'return' explist? ';'? # StatReturn
;
label
: '::' NAME '::'
;
funcname
: NAME ('.' NAME)* (':' NAME)?
;
varlist
: var (',' var)*
;
namelist
: NAME (',' NAME)*
;
explist
: exp (',' exp)*
;
exp
: 'nil' # ExpNil
| 'false' # ExpFalse
| 'true' # ExpTrue
| number # ExpNumber
| string # ExpString
| '...' # ExpVararg
| functiondef # ExpFunctionDef
| prefixexp # ExpPrefixExp
| tableconstructor # ExpTableConstructor
| <assoc=right> exp operatorPower exp # ExpOperatorPower
| operatorUnary exp # ExpOperatorUnary
| exp operatorMulDivMod exp # ExpOperatorMulDivMod
| exp operatorAddSub exp # ExpOperatorAddSub
| <assoc=right> exp operatorStrcat exp # ExpOperatorStrcat
| exp operatorComparison exp # ExpOperatorComparison
| exp operatorAnd exp # ExpOperatorAnd
| exp operatorOr exp # ExpOperatorOr
| exp operatorBitwise exp # ExpOperatorBitwise
;
prefixexp
: varOrExp nameAndArgs*
;
functioncall
: varOrExp nameAndArgs+
;
varOrExp
: var | '(' exp ')'
;
var
: (NAME | '(' exp ')' varSuffix) varSuffix*
;
varSuffix
: nameAndArgs* ('[' exp ']' | '.' NAME)
;
nameAndArgs
: (':' NAME)? args
;
args
: '(' explist? ')' | tableconstructor | string
;
functiondef
: 'function' funcbody
;
funcbody
: '(' parlist? ')' block 'end'
;
parlist
: namelist (',' '...')? | '...'
;
tableconstructor
: '{' fieldlist? '}'
;
fieldlist
: field (fieldsep field)* fieldsep?
;
field
: '[' exp ']' '=' exp | NAME '=' exp | exp
;
fieldsep
: ',' | ';'
;
operatorOr
: 'or';
operatorAnd
: 'and';
operatorComparison
: '<' | '>' | '<=' | '>=' | '~=' | '==';
operatorStrcat
: '..';
operatorAddSub
: '+' | '-';
operatorMulDivMod
: '*' | '/' | '%' | '//';
operatorBitwise
: '&' | '|' | '~' | '<<' | '>>';
operatorUnary
: 'not' | '#' | '-' | '~';
operatorPower
: '^';
number
: INT | HEX | FLOAT | HEX_FLOAT
;
string
: NORMALSTRING | CHARSTRING | LONGSTRING
;
// LEXER
NAME
: [a-zA-Z_][a-zA-Z_0-9]*
;
NORMALSTRING
: '"' ( EscapeSequence | ~('\\'|'"') )* '"'
;
CHARSTRING
: '\'' ( EscapeSequence | ~('\''|'\\') )* '\''
;
LONGSTRING
: '[' NESTED_STR ']'
;
fragment
NESTED_STR
: '=' NESTED_STR '='
| '[' .*? ']'
;
INT
: Digit+
;
HEX
: '0' [xX] HexDigit+
;
FLOAT
: Digit+ '.' Digit* ExponentPart?
| '.' Digit+ ExponentPart?
| Digit+ ExponentPart
;
HEX_FLOAT
: '0' [xX] HexDigit+ '.' HexDigit* HexExponentPart?
| '0' [xX] '.' HexDigit+ HexExponentPart?
| '0' [xX] HexDigit+ HexExponentPart
;
fragment
ExponentPart
: [eE] [+-]? Digit+
;
fragment
HexExponentPart
: [pP] [+-]? Digit+
;
fragment
EscapeSequence
: '\\' [abfnrtvz"'\\]
| '\\' '\r'? '\n'
| DecimalEscape
| HexEscape
| UtfEscape
;
fragment
DecimalEscape
: '\\' Digit
| '\\' Digit Digit
| '\\' [0-2] Digit Digit
;
fragment
HexEscape
: '\\' 'x' HexDigit HexDigit
;
fragment
UtfEscape
: '\\' 'u{' HexDigit+ '}'
;
fragment
Digit
: [0-9]
;
fragment
HexDigit
: [0-9a-fA-F]
;
COMMENT
: '--[' NESTED_STR ']' -> channel(HIDDEN)
;
LINE_COMMENT
: '--'
( // --
| '[' '='* // --[==
| '[' '='* ~('='|'['|'\r'|'\n') ~('\r'|'\n')* // --[==AA
| ~('['|'\r'|'\n') ~('\r'|'\n')* // --AAA
) ('\r\n'|'\r'|'\n'|EOF)
-> channel(HIDDEN)
;
WS
: [ \t\u000C\r\n]+ -> skip
;
SHEBANG
: '#' '!' ~('\n'|'\r')* -> channel(HIDDEN)
;
|
home/vcopy.asm | opiter09/ASM-Machina | 1 | 27955 | ; this function seems to be used only once
; it store the address of a row and column of the VRAM background map in hl
; INPUT: h - row, l - column, b - high byte of background tile map address in VRAM
GetRowColAddressBgMap::
xor a
srl h
rr a
srl h
rr a
srl h
rr a
or l
ld l, a
ld a, b
or h
ld h, a
ret
; clears a VRAM background map with blank space tiles
; INPUT: h - high byte of background tile map address in VRAM
ClearBgMap::
ld a, " "
jr .next
ld a, l
.next
ld de, BG_MAP_WIDTH * BG_MAP_HEIGHT
ld l, e
.loop
ld [hli], a
dec e
jr nz, .loop
dec d
jr nz, .loop
ret
; This function redraws a BG row of height 2 or a BG column of width 2.
; One of its main uses is redrawing the row or column that will be exposed upon
; scrolling the BG when the player takes a step. Redrawing only the exposed
; row or column is more efficient than redrawing the entire screen.
; However, this function is also called repeatedly to redraw the whole screen
; when necessary. It is also used in trade animation and elevator code.
RedrawRowOrColumn::
ldh a, [hRedrawRowOrColumnMode]
and a
ret z
ld b, a
xor a
ldh [hRedrawRowOrColumnMode], a
dec b
jr nz, .redrawRow
.redrawColumn
ld hl, wRedrawRowOrColumnSrcTiles
ldh a, [hRedrawRowOrColumnDest]
ld e, a
ldh a, [hRedrawRowOrColumnDest + 1]
ld d, a
ld c, SCREEN_HEIGHT
.loop1
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, BG_MAP_WIDTH - 1
add e
ld e, a
jr nc, .noCarry
inc d
.noCarry
; the following 4 lines wrap us from bottom to top if necessary
ld a, d
and $3
or $98
ld d, a
dec c
jr nz, .loop1
xor a
ldh [hRedrawRowOrColumnMode], a
ret
.redrawRow
ld hl, wRedrawRowOrColumnSrcTiles
ldh a, [hRedrawRowOrColumnDest]
ld e, a
ldh a, [hRedrawRowOrColumnDest + 1]
ld d, a
push de
call .DrawHalf ; draw upper half
pop de
ld a, BG_MAP_WIDTH ; width of VRAM background map
add e
ld e, a
; fall through and draw lower half
.DrawHalf
ld c, SCREEN_WIDTH / 2
.loop2
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, e
inc a
; the following 6 lines wrap us from the right edge to the left edge if necessary
and $1f
ld b, a
ld a, e
and $e0
or b
ld e, a
dec c
jr nz, .loop2
ret
; This function automatically transfers tile number data from the tile map at
; wTileMap to VRAM during V-blank. Note that it only transfers one third of the
; background per V-blank. It cycles through which third it draws.
; This transfer is turned off when walking around the map, but is turned
; on when talking to sprites, battling, using menus, etc. This is because
; the above function, RedrawRowOrColumn, is used when walking to
; improve efficiency.
AutoBgMapTransfer::
ldh a, [hAutoBGTransferEnabled]
and a
ret z
ld hl, sp + 0
ld a, h
ldh [hSPTemp], a
ld a, l
ldh [hSPTemp + 1], a ; save stack pinter
ldh a, [hAutoBGTransferPortion]
and a
jr z, .transferTopThird
dec a
jr z, .transferMiddleThird
.transferBottomThird
hlcoord 0, 12
ld sp, hl
ldh a, [hAutoBGTransferDest + 1]
ld h, a
ldh a, [hAutoBGTransferDest]
ld l, a
ld de, (12 * 32)
add hl, de
xor a ; TRANSFERTOP
jr .doTransfer
.transferTopThird
hlcoord 0, 0
ld sp, hl
ldh a, [hAutoBGTransferDest + 1]
ld h, a
ldh a, [hAutoBGTransferDest]
ld l, a
ld a, TRANSFERMIDDLE
jr .doTransfer
.transferMiddleThird
hlcoord 0, 6
ld sp, hl
ldh a, [hAutoBGTransferDest + 1]
ld h, a
ldh a, [hAutoBGTransferDest]
ld l, a
ld de, (6 * 32)
add hl, de
ld a, TRANSFERBOTTOM
.doTransfer
ldh [hAutoBGTransferPortion], a ; store next portion
ld b, 6
TransferBgRows::
; unrolled loop and using pop for speed
REPT SCREEN_WIDTH / 2 - 1
pop de
ld [hl], e
inc l
ld [hl], d
inc l
ENDR
pop de
ld [hl], e
inc l
ld [hl], d
ld a, BG_MAP_WIDTH - (SCREEN_WIDTH - 1)
add l
ld l, a
jr nc, .ok
inc h
.ok
dec b
jr nz, TransferBgRows
ldh a, [hSPTemp]
ld h, a
ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
ret
; Copies [hVBlankCopyBGNumRows] rows from hVBlankCopyBGSource to hVBlankCopyBGDest.
; If hVBlankCopyBGSource is XX00, the transfer is disabled.
VBlankCopyBgMap::
ldh a, [hVBlankCopyBGSource] ; doubles as enabling byte
and a
ret z
ld hl, sp + 0
ld a, h
ldh [hSPTemp], a
ld a, l
ldh [hSPTemp + 1], a ; save stack pointer
ldh a, [hVBlankCopyBGSource]
ld l, a
ldh a, [hVBlankCopyBGSource + 1]
ld h, a
ld sp, hl
ldh a, [hVBlankCopyBGDest]
ld l, a
ldh a, [hVBlankCopyBGDest + 1]
ld h, a
ldh a, [hVBlankCopyBGNumRows]
ld b, a
xor a
ldh [hVBlankCopyBGSource], a ; disable transfer so it doesn't continue next V-blank
jr TransferBgRows
VBlankCopyDouble::
; Copy [hVBlankCopyDoubleSize] 1bpp tiles
; from hVBlankCopyDoubleSource to hVBlankCopyDoubleDest.
; While we're here, convert to 2bpp.
; The process is straightforward:
; copy each byte twice.
ldh a, [hVBlankCopyDoubleSize]
and a
ret z
ld hl, sp + 0
ld a, h
ldh [hSPTemp], a
ld a, l
ldh [hSPTemp + 1], a
ldh a, [hVBlankCopyDoubleSource]
ld l, a
ldh a, [hVBlankCopyDoubleSource + 1]
ld h, a
ld sp, hl
ldh a, [hVBlankCopyDoubleDest]
ld l, a
ldh a, [hVBlankCopyDoubleDest + 1]
ld h, a
ldh a, [hVBlankCopyDoubleSize]
ld b, a
xor a ; transferred
ldh [hVBlankCopyDoubleSize], a
.loop
REPT LEN_2BPP_TILE / 4 - 1
pop de
ld [hl], e
inc l
ld [hl], e
inc l
ld [hl], d
inc l
ld [hl], d
inc l
ENDR
pop de
ld [hl], e
inc l
ld [hl], e
inc l
ld [hl], d
inc l
ld [hl], d
inc hl
dec b
jr nz, .loop
ld a, l
ldh [hVBlankCopyDoubleDest], a
ld a, h
ldh [hVBlankCopyDoubleDest + 1], a
ld hl, sp + 0
ld a, l
ldh [hVBlankCopyDoubleSource], a
ld a, h
ldh [hVBlankCopyDoubleSource + 1], a
ldh a, [hSPTemp]
ld h, a
ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
ret
VBlankCopy::
; Copy [hVBlankCopySize] 2bpp tiles (or 16 * [hVBlankCopySize] tile map entries)
; from hVBlankCopySource to hVBlankCopyDest.
; Source and destination addresses are updated,
; so transfer can continue in subsequent calls.
ldh a, [hVBlankCopySize]
and a
ret z
ld hl, sp + 0
ld a, h
ldh [hSPTemp], a
ld a, l
ldh [hSPTemp + 1], a
ldh a, [hVBlankCopySource]
ld l, a
ldh a, [hVBlankCopySource + 1]
ld h, a
ld sp, hl
ldh a, [hVBlankCopyDest]
ld l, a
ldh a, [hVBlankCopyDest + 1]
ld h, a
ldh a, [hVBlankCopySize]
ld b, a
xor a ; transferred
ldh [hVBlankCopySize], a
.loop
REPT LEN_2BPP_TILE / 2 - 1
pop de
ld [hl], e
inc l
ld [hl], d
inc l
ENDR
pop de
ld [hl], e
inc l
ld [hl], d
inc hl
dec b
jr nz, .loop
ld a, l
ldh [hVBlankCopyDest], a
ld a, h
ldh [hVBlankCopyDest + 1], a
ld hl, sp + 0
ld a, l
ldh [hVBlankCopySource], a
ld a, h
ldh [hVBlankCopySource + 1], a
ldh a, [hSPTemp]
ld h, a
ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
ret
UpdateMovingBgTiles::
; Animate water and flower
; tiles in the overworld.
ldh a, [hTileAnimations]
and a
ret z ; no animations if indoors (or if a menu set this to 0)
ldh a, [hMovingBGTilesCounter1]
inc a
ldh [hMovingBGTilesCounter1], a
cp 20
ret c
cp 21
jr z, .flower
; water
ld hl, vTileset tile $14
ld c, $10
ld a, [wMovingBGTilesCounter2]
inc a
and 7
ld [wMovingBGTilesCounter2], a
and 4
jr nz, .left
.right
ld a, [hl]
rrca
ld [hli], a
dec c
jr nz, .right
jr .done
.left
ld a, [hl]
rlca
ld [hli], a
dec c
jr nz, .left
.done
ldh a, [hTileAnimations]
rrca
ret nc
; if in a cave, no flower animations
xor a
ldh [hMovingBGTilesCounter1], a
ret
.flower
xor a
ldh [hMovingBGTilesCounter1], a
ld a, [wMovingBGTilesCounter2]
and 3
cp 2
ld hl, FlowerTile1
jr c, .copy
ld hl, FlowerTile2
jr z, .copy
ld hl, FlowerTile3
.copy
ld de, vTileset tile $03
ld c, $10
.loop
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop
ret
FlowerTile1: INCBIN "gfx/tilesets/flower/flower1.2bpp"
FlowerTile2: INCBIN "gfx/tilesets/flower/flower2.2bpp"
FlowerTile3: INCBIN "gfx/tilesets/flower/flower3.2bpp"
|
src/sys/boot/cdemboot.asm | germix/sanos | 57 | 240468 | ;
; cdemboot.asm
;
; CD-ROM 1.44 MB Floppy Emulation Boot sector
;
; Copyright (C) 2002 <NAME>. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; 3. Neither the name of the project 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 OWNER OR CONTRIBUTORS BE LIABLE
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
; SUCH DAMAGE.
;
OSLDRSEG equ 0x9000
OSLDRBASE equ (OSLDRSEG * 16)
OSLDRSTART equ 8
OSLDRSIZE equ 32
; The image is the first 512K of the 1.44 MB emulated floppy device. The first
; sector of the image is the boot sector.
IMGSTART equ 1
IMGSEG equ 0x7E0
IMGSIZE equ (512 * 2) - 1
ORG 0x7c00
BITS 16
SECTION .text
; Entry point for initial bootstap code
boot:
jmp short start
nop
nop
db 'SANOS '
ldrsize dw OSLDRSIZE
ldrstrt dd OSLDRSTART
start:
; Setup initial environment
jmp 0:start1
start1:
cli
mov ax, cs
mov ds, ax
mov ss, ax
mov sp, 0x7c00
sti
; Save boot drive
mov [bootdrv], dl
; Display boot message
mov si, bootmsg
call print
readimg:
; Get boot drive geometry
mov dl, [bootdrv]
mov ah, 8
xor di, di
mov es, di
int 0x13
and cl, 0x3F
mov byte [sectors], cl
inc dh
mov byte [heads], dh
; Load disk image from emulated floppy
loadnext:
xor eax, eax
mov ax, [sectno] ; eax = image sector number
mov bx, ax
shl bx, 5 ; 512/16 segments per sector
add bx, IMGSEG
mov es, bx ; es = segment for next image sector
mov di, IMGSIZE
sub di, ax ; di = number of image sectors left to read
mov cx, [sectno] ; make sure we do not cross a 64KB boundary
and cx, 0x7F
neg cx
add cx, 0x80
cmp cx, di
jg loadnext1
mov di, cx
loadnext1:
mov ebx, IMGSTART ; eax = LBA of next image sector
add eax, ebx
call readsectors
mov ax, [sectno] ; update next image sector to read
add ax, di
mov [sectno], ax
cmp ax, IMGSIZE
jnz loadnext
; Copy os loader from ram boot image
push ds
mov cx, [ldrsize] ; cx = number of bytes to copy
shl cx, 9 ; convert from sectors to bytes
mov eax, [ldrstrt] ; ds = loader start segment
shl eax, 5 ; convert from sectors to segments
add eax, 0x7c0
mov ds, ax
mov ax, OSLDRSEG ; es = loader segment
mov es, ax
xor di, di
xor si, si
cld ; copy os loader from boot image
rep movsb
pop ds
; Call real mode entry point in os loader
mov ax, OSLDRSEG
mov ds, ax
add ax, [0x16] ; cs
push ax
push word [0x14] ; ip
mov dl, 0xFD ; boot drive (0xFD for CD emulation)
mov ebx, 0x7C00 ; RAM disk image
retf
; Read sectors from boot drive
; input:
; eax = LBA
; di = maximum sector count
; es = segment for buffer
; output:
; di = sectors read
readsectors:
; Convert LBA to CHS
cdq ; edx = 0
movzx ebx, word [sectors]
div ebx ; eax = track, edx = sector - 1
mov cx, dx ; cl = sector - 1, ch = 0
inc cx ; cl = sector number
xor dx, dx
mov bl, [heads]
div ebx
mov dh, dl ; head
mov dl, [bootdrv] ; boot drive
xchg ch, al ; ch = low 8 bits of cylinder number, al = 0
shr ax, 2 ; al[6:7] = high two bits of cylinder, ah = 0
or cl, al ; cx = cylinder and sector
; Determine number of sectors to read
mov al, cl
mov ah, 0
add ax, di ; ax = last sector to xfer
cmp ax, [sectors]
jbe readall
mov ax, [sectors] ; read to end of track
inc ax
sub al, cl
push ax
jmp read
readall:
mov ax, di ; we can read all sectors
push ax
jmp read
readagain:
pusha
mov al, '#' ; print # to mark errror
call printchar
mov ax, 0 ; reset disk system
mov dx, 0
int 0x13
popa
read:
mov ah, 2 ; read sector using bios
xor bx, bx
int 0x13
jc readagain
pop di
ret
; Print string to console
; si = ptr to first character of a null terminated string
print:
push ax
cld
nextchar:
mov al, [si]
cmp al, 0
je printdone
call printchar
inc si
jmp nextchar
printdone:
pop ax
ret
; Print a single character to the console
; al = character to be printed
printchar:
mov ah, 0x0e
int 0x10
ret
; Variables
sectno dw 0
sectors dw 0
heads dw 0
bootdrv db 0
; Message strings
bootmsg:
db 'Loading boot image from CD-ROM... ', 0
; Boot signature
times 510-($-$$) db 0
dw 0xAA55
|
README.agda | nad/chi | 2 | 13379 | ------------------------------------------------------------------------
-- A formalisation of one variant of the language χ, along with a
-- number of properties
--
-- <NAME>
------------------------------------------------------------------------
-- A description of the language χ, as well as some of the definitions
-- and proofs used in this development, can be found in "The language
-- χ" by <NAME> (edited by me):
--
-- * https://chalmers.instructure.com/courses/10744/file_contents/course%20files/reading/The_language_chi.pdf
--
-- See also the following lecture slides:
--
-- * https://chalmers.instructure.com/courses/10744/file_contents/course%20files/lectures/L4.pdf
-- * https://chalmers.instructure.com/courses/10744/file_contents/course%20files/lectures/L5.pdf
-- * https://chalmers.instructure.com/courses/10744/file_contents/course%20files/lectures/L6.pdf
module README where
-- Atoms.
import Atom
-- Various constants.
import Constants
-- A specification of the language χ.
import Chi
-- The semantics is deterministic.
import Deterministic
-- Values.
import Values
-- Some cancellation lemmas.
import Cancellation
-- "Reasoning" combinators.
import Reasoning
-- The abstract syntax is a set, and the semantics is propositional.
import Propositional
-- The "terminates" relation.
import Termination
-- Compatibility lemmas.
import Compatibility
-- Some substitution lemmas.
import Substitution
-- Definitions of "free in" and "closed", along with some properties.
import Free-variables
-- Alpha-equivalence.
import Alpha-equivalence
-- Encoders and decoders.
import Coding
-- Encoder and decoder instances.
import Coding.Instances
-- Encoder and decoder instances for Atom.χ-ℕ-atoms.
import Coding.Instances.Nat
-- Internal coding.
import Internal-coding
-- Some χ program combinators.
import Combinators
-- The rec construction can be encoded using λ-terms.
import Recursion-without-rec
-- Definition of the size of an expression, along with some
-- properties.
import Expression-size
-- A self-interpreter (without correctness proof).
import Self-interpreter
-- Partial functions, computability.
import Computability
-- The halting problem.
import Halting-problem
-- Rice's theorem.
import Rices-theorem
-- A theorem related to pointwise equality.
import Pointwise-equality
|
examples/linux/src/socketcan.adb | jonashaggstrom/ada-canopen | 6 | 4971 | pragma Warnings (Off);
-- Internal GNAT unit, non-portable!
-- But SocketCAN is only available on Linux anyways...
with GNAT.Sockets.Thin;
with GNAT.Sockets.Thin_Common;
pragma Warnings (On);
package body SocketCAN is
use type C.int;
package Socket_Defs is
-- socket.h
SOCK_RAW : constant := 3;
AF_CAN : constant := 29;
PF_CAN : constant := 29;
end Socket_Defs;
package Can_Defs is
-- can.h
CAN_RAW : constant := 1;
pragma Unreferenced (CAN_RAW);
type C_Raw_Sockaddr_In is record
Family : C.unsigned_short;
Index : C.int;
Fill : C.char_array (0 .. 15);
end record
with Size => 24 * 8;
pragma No_Component_Reordering (C_Raw_Sockaddr_In);
pragma Convention (C, C_Raw_Sockaddr_In);
for C_Raw_Sockaddr_In use record
Family at 0 range 0 .. 31;
Index at 0 range 32 .. 63;
end record;
type C_Can_Data is array (0 .. 7) of Interfaces.Unsigned_8;
for C_Can_Data'Alignment use 8;
type C_Can_Frame is record
Can_Id : Interfaces.Unsigned_32;
Can_Dlc : Interfaces.Unsigned_8;
Pad : Interfaces.Unsigned_8;
Res0 : Interfaces.Unsigned_8;
Res1 : Interfaces.Unsigned_8;
Data : C_Can_Data;
end record;
pragma No_Component_Reordering (C_Can_Frame);
pragma Convention (C, C_Can_Frame);
RTR_Flag : constant := 16#40000000#;
EFF_Flag : constant := 16#80000000#;
ERR_Flag : constant := 16#20000000#;
SFF_Mask : constant := 16#000007FF#;
EFF_Mask : constant := 16#1FFFFFFF#;
ERR_Mask : constant := 16#1FFFFFFF#;
pragma Unreferenced (EFF_Flag, ERR_Flag, EFF_Mask, ERR_Mask);
end Can_Defs;
function Convert (Frame : Can_Frame) return Can_Defs.C_Can_Frame;
function Convert (Frame : Can_Frame) return Can_Defs.C_Can_Frame
is
use Interfaces;
Id : constant Unsigned_32 := Unsigned_32 (Frame.Can_Id);
begin
return (Can_Id => (if Frame.Rtr then Id or Can_Defs.RTR_Flag else Id),
Can_Dlc => Unsigned_8 (Frame.Dlc),
Pad => 0,
Res0 => 0,
Res1 => 0,
Data => Can_Defs.C_Can_Data (Frame.Data));
end Convert;
function Convert (Frame : Can_Defs.C_Can_Frame) return Can_Frame;
function Convert (Frame : Can_Defs.C_Can_Frame) return Can_Frame
is
use Interfaces;
begin
return (Can_Id => Frame_Id_Type (Frame.Can_Id and Can_Defs.SFF_Mask),
Rtr => (Frame.Can_Id and Can_Defs.RTR_Flag) /= 0,
Dlc => Dlc_Type (Frame.Can_Dlc),
Data => Frame_Data (Frame.Data));
end Convert;
procedure Send_Socket
(Socket : in Socket_Type;
Frame : in Can_Frame)
is
Msg : aliased Can_Defs.C_Can_Frame := Convert (Frame);
Mtu : constant C.int := Msg'Size / 8;
Res : constant C.int := C_Write (C.int (Socket), Msg'Address, Mtu);
begin
if Res /= Mtu then
raise SocketCAN_Error with
"Failed to write message with id" & Msg.Can_Id'Img &
": write return value " & Res'Img;
end if;
end Send_Socket;
procedure Receive_Socket_Blocking
(Socket : in Socket_Type;
Frame : out Can_Frame)
is
Msg : aliased Can_Defs.C_Can_Frame;
Mtu : constant C.int := Msg'Size / 8;
Res : C.int;
begin
Res := C_Read (C.int (Socket), Msg'Address, Mtu);
if Res = GNAT.Sockets.Thin_Common.Failure then
raise SocketCAN_Error with
"Failed to read message: read return value " & Res'Img;
elsif Res /= Mtu then
raise SocketCAN_Error with
"Received frame size" & Mtu'Img & " not supported";
end if;
Frame := Convert (Msg);
end Receive_Socket_Blocking;
Protocols : constant array (Protocol_Type) of C.int :=
(RAW => 1,
BCM => 2,
TP16 => 3,
TP20 => 4,
MCNET => 5,
ISOTP => 6,
J1939 => 7,
NPROTO => 8);
function Create_Socket (Protocol : Protocol_Type := RAW) return Socket_Type
is
use GNAT.Sockets.Thin;
Res : constant C.int := C_Socket (Domain => Socket_Defs.PF_CAN,
Typ => Socket_Defs.SOCK_RAW,
Protocol => Protocols (Protocol));
begin
if Res = GNAT.Sockets.Thin_Common.Failure then
raise SocketCAN_Error with
"Failed to create socket: socket return value " & Res'Img;
end if;
return Socket_Type (Res);
end Create_Socket;
procedure Bind_Socket
(Socket : in Socket_Type;
Name : in String := "can0")
is
use GNAT.Sockets.Thin;
Index : constant C.int := C_Name_To_Index (C.To_C (Name));
begin
if Index = 0 then
raise SocketCAN_Error with
"Failed to get interface index of " & Name & " when binding socket";
end if;
declare
Sin : aliased Can_Defs.C_Raw_Sockaddr_In :=
(Family => Socket_Defs.AF_CAN,
Index => Index,
Fill => (others => C.char'First));
Res : constant C.int :=
C_Bind (C.int (Socket), Sin'Address, Sin'Size / 8);
begin
if Res = GNAT.Sockets.Thin_Common.Failure then
raise SocketCAN_Error with "Failed to bind " & Name;
end if;
end;
end Bind_Socket;
procedure Close_Socket
(Socket : in Socket_Type)
is
use GNAT.Sockets.Thin;
Res : C.int;
begin
Res := C_Close (C.int (Socket));
if Res = GNAT.Sockets.Thin_Common.Failure then
raise SocketCAN_Error with "Failed to close: return value" & Res'Img;
end if;
end Close_Socket;
function Is_Frame_Pending
(Socket : Socket_Type)
return Boolean
is
use type C.short;
POLLIN : constant C.short := 16#0001#;
Pfd : aliased Poll_Fd :=
(Fd => C.int (Socket),
Events => POLLIN,
Revents => 0);
Res : C.int;
begin
Res := C_Poll (Fds => Pfd'Address,
N_Fds => 1,
Timeout => 0);
if Res < 0 then
raise SocketCAN_Error with
"Polling error" & Res'Img & " (revents =" & Pfd.Revents'Img & ")";
end if;
return (Pfd.Revents = POLLIN);
end Is_Frame_Pending;
end SocketCAN;
|
software/pcx86/bdsrc/cmd/const.asm | fatman2021/basicdos | 0 | 171671 | ;
; BASIC-DOS Command Interpreter Constants
;
; @author <NAME> <<EMAIL>>
; @copyright (c) 2020-2021 <NAME>
; @license MIT <https://basicdos.com/LICENSE.txt>
;
; This file is part of PCjs, a computer emulation software project at pcjs.org
;
include cmd.inc
include txt.inc
CODE SEGMENT
EXTNEAR <evalNegLong,evalNotLong>
EXTNEAR <evalAddLong,evalSubLong,evalMulLong,evalDivLong>
EXTNEAR <evalModLong,evalExpLong,evalImpLong>
EXTNEAR <evalEqvLong,evalXorLong,evalOrLong,evalAndLong>
EXTNEAR <evalEQLong,evalNELong,evalLTLong,evalGTLong>
EXTNEAR <evalLELong,evalGELong,evalShlLong,evalShrLong>
EXTNEAR <getErrorLevel,getRndLong>
EXTNEAR <evalEQStr,evalNEStr,evalLTStr,evalGTStr>
EXTNEAR <evalLEStr,evalGEStr,evalAddStr>
DEFSTR COM_EXT,<".COM",0> ; these 4 file extensions must be
DEFSTR EXE_EXT,<".EXE",0> ; listed in the desired search order
DEFSTR BAT_EXT,<".BAT",0>
DEFSTR BAS_EXT,<".BAS",0>
DEFSTR DIR_DEF,<"*.*",0>
DEFSTR PERIOD,<".",0>
DEFSTR VER_DEBUG,<" DEBUG">
DEFSTR VER_FINAL,<0,0>
DEFSTR HELP_FILE,<"HELP.TXT",0>
DEFSTR PIPE_NAME,<"PIPE$",0>
DEFSTR STR_ON,<"ON",0>
DEFSTR STR_OFF,<"OFF",0>
IFDEF DEBUG
DEFSTR SYS_MEM,<"<SYS>",0>
DEFSTR DOS_MEM,<"<DOS>",0>
DEFSTR FREE_MEM,<"<FREE>",0>
ENDIF ; DEBUG
;
; Table of BASIC-DOS expression operators
;
; Each OPDEF structure contains 1) operator symbol, 2) operator precedence,
; and 3) operator evaluators (currently, only one LONG evaluator is present
; for each operator). Although the operators are listed in order of highest
; to lowest precedence, it's the operator precedence field that actually
; determines an operator's priority.
;
; Most operators are "binary ops" (ie, operators that require 2 stack-based
; arguments). Exceptions include 3 "unary ops": unary -, unary +, and NOT,
; all of which are distinguished by an ODD precedence.
;
; Parentheses are another exception; they may appear to have low precedence,
; but that's just to ensure that when we encounter a closing parenthesis, all
; operators with a precedence higher than the opening parenthesis get popped.
;
; Note that all multi-character operators are converted to single character
; operators internally, to simplify operator management; genExpr takes care
; of any keyword operators listed in the KEYOP_TOKENS table, and validateOp
; takes care of any any multi-symbol operators listed in the RELOPS table.
;
; We've also taken some liberties with the language, by allowing '~' and '|'
; in addition to 'NOT' and 'OR', allowing '==' in addition to '=', and by
; adding '>>' and '<<' arithmetic shift operations. It would have been nice
; to allow '&' in place of 'AND' as well, but unfortunately '&' was already
; used to prefix hex and octal constants.
;
; TODO: Speaking of hex and octal constants, maybe someday we'll also allow
; "0x" and "0o" prefixes, and maybe even a C-inspired version of PRINT USING
; called... drum roll... PRINTF USING.
;
DEFLBL OPDEFS_LONG,byte
OPDEF <'(',2,0>
OPDEF <')',2,0>
OPDEF <'^',26,evalExpLong>
OPDEF <'P',25,0> ; unary '+'
OPDEF <'N',25,evalNegLong> ; unary '-'
OPDEF <'*',24,evalMulLong>
OPDEF <'/',24,evalDivLong>
OPDEF <'\',22,evalDivLong>
OPDEF <'M',20,evalModLong> ; 'MOD'
OPDEF <'+',18,evalAddLong>
OPDEF <'-',18,evalSubLong>
OPDEF <'S',16,evalShlLong> ; BASIC-DOS: '<<'
OPDEF <'R',16,evalShrLong> ; BASIC-DOS: '>>'
OPDEF <'=',14,evalEQLong> ; (BASIC-DOS allows '==' as well)
OPDEF <'U',14,evalNELong> ; '<>' or '><'
OPDEF <'<',14,evalLTLong>
OPDEF <'>',14,evalGTLong>
OPDEF <'L',14,evalLELong> ; '<=' or '=<'
OPDEF <'G',14,evalGELong> ; '>=' or '=>'
OPDEF <'~',13,evalNotLong> ; 'NOT' (BASIC-DOS allows '~' as well)
OPDEF <'A',12,evalAndLong> ; 'AND'
OPDEF <'|',10,evalOrLong> ; 'OR' (BASIC-DOS allows '|' as well)
OPDEF <'X',8,evalXorLong> ; 'XOR'
OPDEF <'E',6,evalEqvLong> ; 'EQV'
OPDEF <'I',4,evalImpLong> ; 'IMP'
db 0 ; terminator
DEFLBL OPDEFS_STR,byte
OPDEF <'(',2,0>
OPDEF <')',2,0>
OPDEF <'+',18,evalAddStr>
OPDEF <'=',14,evalEQStr> ; BASIC-DOS allows '==' as well
OPDEF <'U',14,evalNEStr> ; '<>' or '><'
OPDEF <'<',14,evalLTStr>
OPDEF <'>',14,evalGTStr>
OPDEF <'L',14,evalLEStr> ; '<=' or '=<'
OPDEF <'G',14,evalGEStr> ; '>=' or '=>'
db 0 ; terminator
DEFLBL RELOPS,byte
db "<>",'U',"><",'U',"<=",'L',"=<",'L',">=",'G',"=>",'G'
db "==",'=',"<<",'S',">>",'R'
db 0 ; terminator
DEFLBL PREDEF_VARS,byte
db VAR_FUNC + 10,"ERRORLEVEL"
db VAR_LONG,0 ; returns VAR_LONG with 0 parameters
dw offset getErrorLevel,0 ; 0 implies our own CODE segment
db VAR_LONG + 6,"MAXINT" ; TODO: Should this be "MAXINT%"?
dd 7FFFFFFFh ; largest positive value
db VAR_FUNC + 4,"RND%"
db VAR_LONG,1 ; returns VAR_LONG with 1 parameter
db VAR_LONG,PARM_OPT_ONE ; 1st parameter: VAR_LONG, optional
dw offset getRndLong,0 ; 0 implies our own CODE segment
db 0 ; terminator
DEFLBL PREDEF_ZERO,byte
db VAR_LONG
dd 0 ; predefined LONG zero constant
CODE ENDS
DEFTOKENS KEYWORD_TOKENS,KEYWORD_TOTAL
DEFTOK CLS, 40, genCLS
DEFTOK COLOR, 41, genColor
DEFTOK COPY, 20, cmdCopy
DEFTOK DATE, 10, cmdDate
DEFTOK DEF, 42, genDefFn
DEFTOK DEFDBL, 43, genDefDbl
DEFTOK DEFINT, 44, genDefInt
DEFTOK DEFSNG, 45, genDefDbl
DEFTOK DEFSTR, 46, genDefStr
DEFTOK DIR, 21, cmdDir
DEFTOK ECHO, 47, genEcho
DEFTOK ELSE, 201
DEFTOK EXIT, 1, cmdExit
DEFTOK GOTO, 48, genGoto
DEFTOK HELP, 2, cmdHelp
DEFTOK IF, 49 genIf
DEFTOK KEYS, 3, cmdKeys
DEFTOK LET, 50, genLet
DEFTOK LIST, 4, cmdList
DEFTOK LOAD, 22, cmdLoad
DEFTOK MEM, 5, cmdMem
DEFTOK NEW, 6, cmdNew
DEFTOK OFF, 202
DEFTOK ON, 203
DEFTOK PRINT, 51, genPrint
DEFTOK REM, 52
DEFTOK RESTART, 7, cmdRestart
DEFTOK RETURN, 53, genReturn
DEFTOK RUN, 8, cmdRun
DEFTOK THEN, 204
DEFTOK TIME, 11, cmdTime
DEFTOK TYPE, 23, cmdType
DEFTOK VER, 9, cmdVer
NUMTOKENS KEYWORD_TOKENS,KEYWORD_TOTAL
DEFTOKENS KEYOP_TOKENS,KEYOP_TOTAL
DEFTOK AND, 'A'
DEFTOK EQV, 'E'
DEFTOK IMP, 'I'
DEFTOK MOD, 'M'
DEFTOK NOT, '~'
DEFTOK OR, '|'
DEFTOK XOR, 'X'
NUMTOKENS KEYOP_TOKENS,KEYOP_TOTAL
DATA SEGMENT
;
; This is where per-process data begins; it must be at the end of the file.
;
DEFLBL BEG_HEAP,word
BLKDEF <0,CBLKLEN,size CBLK,SIG_CBLK>
BLKDEF <0,FBLKLEN,size FBLK,SIG_FBLK>
BLKDEF <0,VBLKLEN,size VBLK,SIG_VBLK>
BLKDEF <0,SBLKLEN,size SBLK,SIG_SBLK>
BLKDEF <0,TBLKLEN,size TBLK,SIG_TBLK>
COMHEAP <size CMDHEAP>,BEG_HEAP ; this must be the last item...
DATA ENDS
end
|
agda/MoreAlgebra.agda | mchristianl/synthetic-reals | 3 | 17178 | <reponame>mchristianl/synthetic-reals<gh_stars>1-10
{-# OPTIONS --cubical --no-import-sorts #-}
module MoreAlgebra where
open import Agda.Primitive renaming (_⊔_ to ℓ-max; lsuc to ℓ-suc; lzero to ℓ-zero)
private
variable
ℓ ℓ' ℓ'' : Level
open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)
open import Cubical.Relation.Nullary.Base -- ¬_
open import Cubical.Relation.Binary.Base
open import Cubical.Data.Sum.Base renaming (_⊎_ to infixr 4 _⊎_)
open import Cubical.Data.Sigma.Base renaming (_×_ to infixr 4 _×_)
open import Cubical.Data.Empty renaming (elim to ⊥-elim) -- `⊥` and `elim`
open import Cubical.Foundations.Logic renaming (¬_ to ¬ᵖ_; inl to inlᵖ; inr to inrᵖ)
open import Utils
hPropRel : ∀ {ℓ} (A B : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ'))
hPropRel A B ℓ' = A → B → hProp ℓ'
module Definitions where
-- NOTE: one needs these "all-lowercase constructors" to make use of copatterns
_Preserves_⟶_ : ∀{Aℓ Bℓ ℓ ℓ'} {A : Type Aℓ} {B : Type Bℓ} → (A → B) → Rel A A ℓ → Rel B B ℓ' → Set _
f Preserves P ⟶ Q = ∀{x y} → P x y → Q (f x) (f y)
_Reflects_⟶_ : ∀{Aℓ Bℓ ℓ ℓ'} {A : Type Aℓ} {B : Type Bℓ} → (A → B) → Rel A A ℓ → Rel B B ℓ' → Set _
f Reflects P ⟶ Q = ∀{x y} → Q (f x) (f y) → P x y
-- https://en.wikipedia.org/wiki/Complete_partial_order
-- A partially ordered set is a directed-complete partial order (dcpo) if each of its directed subsets has a supremum.
-- A subset of a partial order is directed if it is non-empty and every pair of elements has an upper bound in the subset.
-- In the literature, dcpos sometimes also appear under the label up-complete poset.
-- https://ncatlab.org/nlab/show/dcpo
-- A DCPO, or directed-complete partial order, is a poset with all directed joins.
-- Often a DCPO is required to have a bottom element ⊥\bot; then it is called a pointed DCPO or a CPO (but this term is ambiguous).
-- In this chapter we develop the theory of directed-complete partial orders (dcpo), namely
-- partially ordered sets in which only certain joins are required to exist.
--
-- ...
--
-- 3.1 Dcpos
--
-- We start by defining partial orders. By a binary relation R on a set X , we mean a map X → X → HProp, as in Definition 2.7.1.
-- We can specify which universe the binary relation lands in by saying that R is HPropᵢ-valued or is a relation in universe i if R : X → X → HPropᵢ.
--
-- Definition 3.1.1. A binary relation R on a set X is
--
-- 1. reflexive if (∀ x : X) R x x;
-- 2. irreflexive if (∀ x : X) ¬ R x x;
-- 3. symmetric if (∀ x, y : X) R x y ⇒ R y x;
-- 4. antisymmetric if (∀ x, y : X) R x y ⇒ R y x ⇒ x = y;
-- 5. transitive if (∀ x, y, z : X) R x y ⇒ R y z ⇒ R x z;
-- 6. cotransitive if (∀ x, y, z : X) R x y ⇒ (R x z) ∨ (R z y).
--
-- Remark 3.1.2. Cotransitivity is also known as weak linearity [91, Definition 11.2.7] or the approximate splitting principle [84].
--
-- Definition 3.1.3.
--
-- A preorder, denoted by ≤, is a reflexive transitive relation.
-- A partial order is an antisymmetric preorder.
-- Definition 4.1.4.
-- - An apartness relation, denoted by #, is an irreflexive symmetric cotransitive relation.
-- - A strict partial order, denoted by <, is an irreflexive transitive cotransitive relation.
IsIrrefl : {ℓ ℓ' : Level} {A : Type ℓ} → (R : Rel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsIrrefl {A = A} R = (a : A) → ¬(R a a)
IsCotrans : {ℓ ℓ' : Level} {A : Type ℓ} → (R : Rel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsCotrans {A = A} R = (a b : A) → R a b → (∀(x : A) → (R a x) ⊎ (R x b))
-- NOTE: see Cubical.Algebra.Poset
IsSymᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsSymᵖ {A = A} R = (a b : A) → [ R a b ] → [ R b a ]
IsIrreflᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsIrreflᵖ {A = A} R = (a : A) → [ ¬ᵖ(R a a) ]
IsCotransᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsCotransᵖ {A = A} R = (a b : A) → [ R a b ] → (∀(x : A) → [ (R a x) ⊔ (R x b) ])
{- NOTE: formulating the properties on witnesses with `[_]` is similar to the previous Propositions-as-types formalism
but it is not the way to proceed with hProps
the idea is, to produce an hProp again
e.g. from `Cubical.Algebra.Poset`
isTransitive : {A : Type ℓ₀} → Order ℓ₁ A → hProp (ℓ-max ℓ₀ ℓ₁)
isTransitive {ℓ₀ = ℓ₀} {ℓ₁ = ℓ₁} {A = X} _⊑_ = φ , φ-prop
where
φ : Type (ℓ-max ℓ₀ ℓ₁)
φ = ((x y z : X) → [ x ⊑ y ⇒ y ⊑ z ⇒ x ⊑ z ])
φ-prop : isProp φ
φ-prop = isPropΠ3 λ x y z → snd (x ⊑ y ⇒ y ⊑ z ⇒ x ⊑ z)
-}
IsTransᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsTransᵖ {A = A} R = (a b c : A) → [ R a b ] → [ R b c ] → [ R a c ]
-- NOTE: this is starting with a lower-case, because `hProp (ℓ-max ℓ ℓ')` is not a type but an element
isTransᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → hProp (ℓ-max ℓ ℓ')
isTransᵖ {ℓ} {ℓ'} {A = A} R = φ , φ-prop
where
φ : Type (ℓ-max ℓ ℓ')
φ = (a b c : A) → [ R a b ⇒ R b c ⇒ R a c ]
φ-prop : isProp φ
φ-prop = isPropΠ3 λ a b c → snd (R a b ⇒ R b c ⇒ R a c)
isIrreflᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → hProp (ℓ-max ℓ ℓ')
isIrreflᵖ {ℓ} {ℓ'} {A = A} R = φ , φ-prop
where
φ : Type (ℓ-max ℓ ℓ')
φ = (a : A) → [ ¬ᵖ (R a a) ]
φ-prop : isProp φ
φ-prop = isPropΠ λ a → snd (¬ᵖ (R a a))
isCotransᵖ : {ℓ ℓ' : Level} {A : Type ℓ} → (R : hPropRel A A ℓ') → hProp (ℓ-max ℓ ℓ')
isCotransᵖ {ℓ} {ℓ'} {A = A} R = φ , φ-prop
where
φ : Type (ℓ-max ℓ ℓ')
φ = (a b : A) → [ R a b ⇒ (∀[ x ∶ A ] (R a x) ⊔ (R x b)) ]
φ-prop : isProp φ
φ-prop = isPropΠ2 λ a b → snd (R a b ⇒ (∀[ x ∶ A ] (R a x) ⊔ (R x b)))
record IsApartnessRel {ℓ ℓ' : Level} {A : Type ℓ} (R : Rel A A ℓ') : Type (ℓ-max ℓ ℓ') where
field
isIrrefl : IsIrrefl R
isSym : BinaryRelation.isSym R
isCotrans : IsCotrans R
record IsApartnessRelᵖ {ℓ ℓ' : Level} {A : Type ℓ} (R : hPropRel A A ℓ') : Type (ℓ-max ℓ ℓ') where
field
isIrrefl : IsIrreflᵖ R
isSym : IsSymᵖ R
isCotrans : IsCotransᵖ R
record IsStrictPartialOrder {ℓ ℓ' : Level} {A : Type ℓ} (R : Rel A A ℓ') : Type (ℓ-max ℓ ℓ') where
constructor isstrictpartialorder
field
isIrrefl : IsIrrefl R
isTrans : BinaryRelation.isTrans R
isCotrans : IsCotrans R
record IsStrictPartialOrderᵖ {ℓ ℓ' : Level} {A : Type ℓ} (R : hPropRel A A ℓ') : Type (ℓ-max ℓ ℓ') where
constructor isstrictpartialorderᵖ
field
isIrrefl : IsIrreflᵖ R
isTrans : IsTransᵖ R
isCotrans : IsCotransᵖ R
{- NOTE: here again, the previous-way-interpretation would be to put witnesses into the struct with `[_]`
but with hProps, we would have `isStrictPartialOrder : hProp`
and use `[ isStrictPartialOrder ]` as the witness type
with hProps we would need to make heavy use of `Cubical.Foundations.HLevels`
isProp×, isProp×2, isProp×3
to show the record's `isProp`
do we have pathes on records? in order to use `isProp` on records?
yes, with record constructors
-}
record [IsStrictPartialOrder] {ℓ ℓ' : Level} {A : Type ℓ} (R : hPropRel A A ℓ') : Type (ℓ-max ℓ ℓ') where
constructor isstrictpartialorderᵖ
field
isIrrefl : [ isIrreflᵖ R ]
isTrans : [ isTransᵖ R ]
isCotrans : [ isCotransᵖ R ]
isStrictParialOrder : {ℓ ℓ' : Level} {A : Type ℓ} (R : hPropRel A A ℓ') → hProp (ℓ-max ℓ ℓ')
isStrictParialOrder R = [IsStrictPartialOrder] R , φ-prop where
φ-prop : isProp ([IsStrictPartialOrder] R)
φ-prop (isstrictpartialorderᵖ isIrrefl₀ isTrans₀ isCotrans₀)
(isstrictpartialorderᵖ isIrrefl₁ isTrans₁ isCotrans₁) =
λ i → isstrictpartialorderᵖ (isProp[] (isIrreflᵖ R) isIrrefl₀ isIrrefl₁ i)
(isProp[] (isTransᵖ R) isTrans₀ isTrans₁ i)
(isProp[] (isCotransᵖ R) isCotrans₀ isCotrans₁ i)
record IsPreorder {ℓ ℓ' : Level} {A : Type ℓ} (R : Rel A A ℓ') : Type (ℓ-max ℓ ℓ') where
constructor ispreorder
field
isRefl : BinaryRelation.isRefl R
isTrans : BinaryRelation.isTrans R
-- NOTE: there is already
-- isAntisym : {A : Type ℓ₀} → isSet A → Order ℓ₁ A → hProp (ℓ-max ℓ₀ ℓ₁)
-- in Cubical.Algebra.Poset. Can we use this?
-- import Cubical.Algebra.Poset
IsAntisym : {ℓ ℓ' : Level} {A : Type ℓ} → (R : Rel A A ℓ') → Type (ℓ-max ℓ ℓ')
IsAntisym {A = A} R = ∀ a b → R a b → R b a → a ≡ b
record IsPartialOrder {ℓ ℓ' : Level} {A : Type ℓ} (R : Rel A A ℓ') : Type (ℓ-max ℓ ℓ') where
constructor ispartialorder
field
isRefl : BinaryRelation.isRefl R
isAntisym : IsAntisym R
isTrans : BinaryRelation.isTrans R
_#'_ : ∀{X : Type ℓ} {_<_ : Rel X X ℓ'} → Rel X X ℓ'
_#'_ {_<_ = _<_} x y = (x < y) ⊎ (y < x)
_≤'_ : ∀{X : Type ℓ} {_<_ : Rel X X ℓ'} → Rel X X ℓ'
_≤'_ {_<_ = _<_} x y = ¬ (y < x)
-- NOTE: there is `Properties` and `Consequences`
-- the difference somehow is, that we do want to open `Consequences` directly
-- but we do not want to open `Properties` directly, because it might have a name clash
-- e.g. there is `Properties.Group` which clashes with `Cubical.Algebra.Group.Group` when opening `Properties`
-- but it is totally fine to open `Properties.Group` directly because it does not export a `Group`
-- TODO: check whether this matches the wording of the (old) standard library
module Consequences where
open Definitions
-- Lemma 4.1.7.
-- Given a strict partial order < on a set X:
-- 1. we have an apartness relation defined by
-- x # y := (x < y) ∨ (y < x), and
#'-isApartnessRel : ∀{X : Type ℓ} {_<_ : Rel X X ℓ'} → (isSPO : IsStrictPartialOrder _<_) → IsApartnessRel (_#'_ {_<_ = _<_})
#'-isApartnessRel {X = X} {_<_ = _<_} isSPO =
let (isstrictpartialorder <-irrefl <-trans <-cotrans) = isSPO
in λ where
.IsApartnessRel.isIrrefl a (inl a<a) → <-irrefl _ a<a
.IsApartnessRel.isIrrefl a (inr a<a) → <-irrefl _ a<a
.IsApartnessRel.isSym a b p → ⊎-swap p
.IsApartnessRel.isCotrans a b (inl a<b) x → case (<-cotrans _ _ a<b x) of λ where -- case x of f = f x
(inl a<x) → inl (inl a<x)
(inr x<b) → inr (inl x<b)
.IsApartnessRel.isCotrans a b (inr b<a) x → case (<-cotrans _ _ b<a x) of λ where
(inl b<x) → inr (inr b<x)
(inr x<a) → inl (inr x<a)
-- variant without copatterns: "just" move the `λ where` "into" the record
#'-isApartnessRel' : ∀{X : Type ℓ} {_<_ : Rel X X ℓ'} → {IsStrictPartialOrder _<_} → IsApartnessRel (_#'_ {_<_ = _<_})
#'-isApartnessRel' {X = X} {_<_ = _<_} {isSPO} =
let (isstrictpartialorder <-irrefl <-trans <-cotrans) = isSPO
in record
{ isIrrefl = λ where a (inl a<a) → <-irrefl _ a<a
a (inr a<a) → <-irrefl _ a<a
; isSym = λ where a b p → ⊎-swap p
; isCotrans = λ where
a b (inl a<b) x → case (<-cotrans _ _ a<b x) of λ where
(inl a<x) → inl (inl a<x)
(inr x<b) → inr (inl x<b)
a b (inr b<a) x → case (<-cotrans _ _ b<a x) of λ where
(inl b<x) → inr (inr b<x)
(inr x<a) → inl (inr x<a)
}
-- 2. we have a preorder defined by
-- x ≤ y := ¬(y < x).
≤-isPreorder' : ∀{X : Type ℓ} {_<_ : Rel X X ℓ'} → {IsStrictPartialOrder _<_} → IsPreorder (_≤'_ {_<_ = _<_})
≤-isPreorder' {X = X} {_<_ = _<_} {isSPO} =
let (isstrictpartialorder <-irrefl <-trans <-cotrans) = isSPO
in λ where
.IsPreorder.isRefl → <-irrefl
.IsPreorder.isTrans a b c ¬b<a ¬c<b c<a → case (<-cotrans _ _ c<a b) of λ where
(inl c<b) → ¬c<b c<b
(inr b<a) → ¬b<a b<a
module _
{X : Type ℓ} (_<_ : Rel X X ℓ')
(isSPO : IsStrictPartialOrder _<_)
(<-isProp : ∀ x y → isProp (x < y))
(let _#_ = _#'_ {_<_ = _<_})
(let (isstrictpartialorder <-irrefl <-trans <-cotrans) = isSPO)
where
-- open IsStrictPartialOrder isSPO
#-from-<-isProp : ∀ x y → isProp (x # y)
#-from-<-isProp x y (inl x<y₁) (inl x<y₂) = cong inl (<-isProp x y x<y₁ x<y₂)
-- NOTE: ⊥-elim could not resolve the level here and needed some hint on `A`
#-from-<-isProp x y (inl x<y ) (inr y<x ) = ⊥-elim {A = λ _ → inl x<y ≡ inr y<x} (<-irrefl y (<-trans y x y y<x x<y))
#-from-<-isProp x y (inr y<x ) (inl x<y ) = ⊥-elim {A = λ _ → inr y<x ≡ inl x<y} (<-irrefl y (<-trans y x y y<x x<y))
#-from-<-isProp x y (inr y<x₁) (inr y<x₂) = cong inr (<-isProp y x y<x₁ y<x₂)
module Properties where
module _ where
open import Cubical.Algebra.Group
-- import Cubical.Algebra.Group.Properties
module GroupProperties (G : Group {ℓ}) where
open Group G
private
simplR = GroupLemmas.simplR G
invUniqueL : {g h : Carrier} → g + h ≡ 0g → g ≡ - h
invUniqueL {g} {h} p = simplR h (p ∙ sym (invl h))
-- ported from `Algebra.Properties.Group`
right-helper : ∀ x y → y ≡ - x + (x + y)
right-helper x y = (
y ≡⟨ sym (snd (identity y)) ⟩
0g + y ≡⟨ cong₂ _+_ (sym (snd (inverse x))) refl ⟩
((- x) + x) + y ≡⟨ sym (assoc (- x) x y) ⟩
(- x) + (x + y) ∎)
-- alternative:
-- follows from uniqueness of -
-- (a + -a) ≡ 0
-- ∃! b . a + b = 0
-- show that a is an additive inverse of - a then it must be THE additive inverse of - a and has to be called - - a which is a by uniqueness
-involutive : ∀ x → - - x ≡ x
-involutive x = (
(- (- x)) ≡⟨ sym (fst (identity _)) ⟩
(- (- x)) + 0g ≡⟨ cong₂ _+_ refl (sym (snd (inverse _))) ⟩
(- (- x)) + (- x + x) ≡⟨ sym (right-helper (- x) x) ⟩
x ∎)
module _ where
open import Cubical.Algebra.Ring
module RingProperties (R : Ring {ℓ}) where
open Ring R
open Cubical.Algebra.Ring.Theory R
-- NOTE: a few facts about rings that might be collected from elsewhere
a+b-b≡a : ∀ a b → a ≡ (a + b) - b
a+b-b≡a a b = let P = sym (fst (+-inv b))
Q = sym (fst (+-identity a))
R = transport (λ i → a ≡ a + P i) Q
S = transport (λ i → a ≡ (+-assoc a b (- b)) i ) R
in S
-- NOTE: this is called `simplL` and `simplL` in `Cubical.Algebra.Group.Properties.GroupLemmas`
+-preserves-≡ : ∀{a b} → ∀ c → a ≡ b → a + c ≡ b + c
+-preserves-≡ c a≡b i = a≡b i + c
+-preserves-≡-l : ∀{a b} → ∀ c → a ≡ b → c + a ≡ c + b
+-preserves-≡-l c a≡b i = c + a≡b i
a+b≡0→a≡-b : ∀{a b} → a + b ≡ 0r → a ≡ - b
a+b≡0→a≡-b {a} {b} a+b≡0 = transport
(λ i →
let RHS = snd (+-identity (- b))
LHS₁ : a + (b + - b) ≡ a + 0r
LHS₁ = +-preserves-≡-l a (fst (+-inv b))
LHS₂ : (a + b) - b ≡ a
LHS₂ = transport (λ j → (+-assoc a b (- b)) j ≡ fst (+-identity a) j) LHS₁
in LHS₂ i ≡ RHS i
) (+-preserves-≡ (- b) a+b≡0)
-- NOTE: there is already
-- -commutesWithRight-· : (x y : R) → x · (- y) ≡ - (x · y)
a·-b≡-a·b : ∀ a b → a · (- b) ≡ - (a · b)
a·-b≡-a·b a b =
let P : a · 0r ≡ 0r
P = 0-rightNullifies a
Q : a · (- b + b) ≡ 0r
Q = transport (λ i → a · snd (+-inv b) (~ i) ≡ 0r) P
R : a · (- b) + a · b ≡ 0r
R = transport (λ i → ·-rdist-+ a (- b) b i ≡ 0r) Q
in a+b≡0→a≡-b R
a·b-a·c≡a·[b-c] : ∀ a b c → a · b - (a · c) ≡ a · (b - c)
a·b-a·c≡a·[b-c] a b c =
let P : a · b + a · (- c) ≡ a · (b + - c)
P = sym (·-rdist-+ a b (- c))
Q : a · b - a · c ≡ a · (b + - c)
Q = transport (λ i → a · b + a·-b≡-a·b a c i ≡ a · (b + - c) ) P
in Q
-- exports
module Group = GroupProperties
module Ring = RingProperties
|
UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForBfvBase.asm | KaoTuz/edk2-stable202108 | 9 | 2914 | ;------------------------------------------------------------------------------
; @file
; Search for the Boot Firmware Volume (BFV) base address
;
; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;------------------------------------------------------------------------------
;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
%define FFS_GUID_DWORD0 0x8c8ce578
%define FFS_GUID_DWORD1 0x4f1c8a3d
%define FFS_GUID_DWORD2 0x61893599
%define FFS_GUID_DWORD3 0xd32dc385
BITS 32
;
; Modified: EAX, EBX
; Preserved: EDI, ESP
;
; @param[out] EBP Address of Boot Firmware Volume (BFV)
;
Flat32SearchForBfvBase:
xor eax, eax
searchingForBfvHeaderLoop:
;
; We check for a firmware volume at every 4KB address in the top 16MB
; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
;
sub eax, 0x1000
cmp eax, 0xff000000
jb searchedForBfvHeaderButNotFound
;
; Check FFS GUID
;
cmp dword [eax + 0x10], FFS_GUID_DWORD0
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x14], FFS_GUID_DWORD1
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x18], FFS_GUID_DWORD2
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x1c], FFS_GUID_DWORD3
jne searchingForBfvHeaderLoop
;
; Check FV Length
;
cmp dword [eax + 0x24], 0
jne searchingForBfvHeaderLoop
mov ebx, eax
add ebx, dword [eax + 0x20]
jnz searchingForBfvHeaderLoop
jmp searchedForBfvHeaderAndItWasFound
searchedForBfvHeaderButNotFound:
;
; Hang if the SEC entry point was not found
;
debugShowPostCode POSTCODE_BFV_NOT_FOUND
;
; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
; for debugging purposes.
;
mov eax, 0xBFBFBFBF
mov ebp, eax
jmp $
searchedForBfvHeaderAndItWasFound:
mov ebp, eax
debugShowPostCode POSTCODE_BFV_FOUND
OneTimeCallRet Flat32SearchForBfvBase
|
data/baseStats/nidorina.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 7784 | <filename>data/baseStats/nidorina.asm
db NIDORINA ; pokedex id
db 70 ; base hp
db 62 ; base attack
db 67 ; base defense
db 56 ; base speed
db 55 ; base special
db POISON ; species type 1
db POISON ; species type 2
db 120 ; catch rate
db 117 ; base exp yield
INCBIN "pic/gsmon/nidorina.pic",0,1 ; 66, sprite dimensions
dw NidorinaPicFront
dw NidorinaPicBack
; attacks known at lvl 0
db SCRATCH
db GROWL
db 0
db 0
db 3 ; growth rate
; learnset
tmlearn 6,7,8
tmlearn 9,10,11,13,14
tmlearn 20,24
tmlearn 25,28,31,32
tmlearn 33,34,37,40
tmlearn 44
tmlearn 50,51
db BANK(NidorinaPicFront)
|
dingo-expr/parser/src/main/antlr/DingoExprLexer.g4 | frankbaul/dingo | 1 | 6212 | lexer grammar DingoExprLexer;
INT : NUM ;
REAL : (NUM '.' NUM EXP? | NUM EXP) ;
STR : '\'' (ESC | ~['\\])* '\'' | '"' (ESC | ~["\\])* '"' ;
BOOL : 'true' | 'false' ;
// operators
ADD : '+' ;
SUB : '-' ;
MUL : '*' ;
DIV : '/' ;
LT : '<' ;
LE : '<=' ;
EQ : '==' | '=' ;
GT : '>' ;
GE : '>=' ;
NE : '<>' | '!=' ;
AND : 'and' | '&&' ;
OR : 'or' | '||' ;
NOT : 'not' | '!' ;
STARTS_WITH : 'startsWith' ;
ENDS_WITH : 'endsWith' ;
CONTAINS : 'contains' ;
MATCHES : 'matches' ;
ID : (ALPHA | '_' | '$') (ALPHA | DIGIT | '_' )* ;
WS : [ \t]+ -> skip ;
NL : ('\r'? '\n')+ -> skip ;
LPAR : '(' ;
RPAR : ')' ;
COMMA : ',' ;
DOT : '.' ;
LBRCK : '[' ;
RBRCK : ']' ;
fragment
ALPHA : [a-zA-Z] ;
fragment
DIGIT : [0-9] ;
fragment
HEX : [0-9a-fA-F] ;
fragment
NUM : '0' | [1-9] [0-9]* ;
fragment
EXP : [Ee] [+\-]? NUM ;
fragment
ESC : '\\' (["\\/bfnrt] | UNICODE) ;
fragment
UNICODE : 'u' HEX HEX HEX HEX ;
|
materials.adb | Kidev/AdaPhysics2D | 9 | 30290 | <reponame>Kidev/AdaPhysics2D<gh_stars>1-10
package body Materials is
function SetStatic(This : Material) return Material is
That : Material := This;
begin
That.Density := 0.0;
return That;
end SetStatic;
function SetFriction(This : Material; FStatic, FDynamic : Float := 0.0) return Material is
That : Material := This;
begin
That.StaticFriction := FStatic;
That.DynamicFriction := FDynamic;
return That;
end SetFriction;
-- Allows you to change restitution for a material
-- Disables it by default
function SetRestitution(This : Material; Rest : Float := 0.0) return Material is
That : Material := This;
begin
That.Restitution := Rest;
return That;
end SetRestitution;
function IsSolidMaterial(This : Material) return Boolean is
begin
return (MaterialType'Pos(This.MType) < MaterialType'Pos(ETVacuum));
end IsSolidMaterial;
end Materials;
|
theora/lib/arm/armidct.asm | tonysergi/theoraplayer | 83 | 11918 | <reponame>tonysergi/theoraplayer<gh_stars>10-100
@********************************************************************
@* *
@* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
@* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
@* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
@* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
@* *
@* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
@* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
@* *
@********************************************************************
@ Original implementation:
@ Copyright (C) 2009 <NAME> for Pinknoise Productions Ltd
@ last mod: $Id:
@********************************************************************
.text; .p2align 2
.include "armopts-gnu.S"
.global oc_idct8x8_1_arm
.global oc_idct8x8_arm
.type oc_idct8x8_1_arm, %function; oc_idct8x8_1_arm: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_uint16_t _dc
ORR r1, r1, r1, LSL #16
MOV r2, r1
MOV r3, r1
MOV r12,r1
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
STMIA r0!,{r1,r2,r3,r12}
MOV PC, r14
.size oc_idct8x8_1_arm, .-oc_idct8x8_1_arm @ ENDP
.type oc_idct8x8_arm, %function; oc_idct8x8_arm: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_int16_t *_x
@ r2 = int _last_zzi
CMP r2, #3
BLE oc_idct8x8_3_arm
CMP r2, #6
BLE oc_idct8x8_6_arm
CMP r2, #10
BLE oc_idct8x8_10_arm
oc_idct8x8_slow_arm:
STMFD r13!,{r4-r11,r14}
SUB r13,r13,#64*2
@ Row transforms
STR r0, [r13,#-4]!
ADD r0, r13, #4 @ Write to temp storage.
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
BL idct8core_arm
LDR r0, [r13], #4 @ Write to the final destination.
SUB r2, r1, #8*16
@ Clear input data for next block.
MOV r4, #0
MOV r5, #0
MOV r6, #0
MOV r7, #0
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
STMIA r2!,{r4,r5,r6,r7}
MOV r1, r13 @ And read from temp storage.
@ Column transforms
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
BL idct8core_down_arm
ADD r13,r13,#64*2
LDMFD r13!,{r4-r11,PC}
.size oc_idct8x8_arm, .-oc_idct8x8_arm @ ENDP
.type oc_idct8x8_10_arm, %function; oc_idct8x8_10_arm: @ PROC
STMFD r13!,{r4-r11,r14}
SUB r13,r13,#64*2
@ Row transforms
MOV r2, r0
MOV r0, r13 @ Write to temp storage.
BL idct4core_arm
BL idct3core_arm
BL idct2core_arm
BL idct1core_arm
@ Clear input data for next block.
MOV r4, #0
STR r4, [r1,#-4*16]!
STR r4, [r1,#4]
STR r4, [r1,#16]
STR r4, [r1,#20]
STR r4, [r1,#32]
STR r4, [r1,#48]
MOV r1, r13 @ Read from temp storage.
MOV r0, r2 @ Write to the final destination
oc_idct8x8_10_arm_cols:
@ Column transforms
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
BL idct4core_down_arm
ADD r13,r13,#64*2
LDMFD r13!,{r4-r11,PC}
.size oc_idct8x8_10_arm, .-oc_idct8x8_10_arm @ ENDP
.type oc_idct8x8_6_arm, %function; oc_idct8x8_6_arm: @ PROC
STMFD r13!,{r4-r7,r9-r11,r14}
SUB r13,r13,#64*2
@ Row transforms
MOV r2, r0
MOV r0, r13 @ Write to temp storage.
BL idct3core_arm
BL idct2core_arm
BL idct1core_arm
@ Clear input data for next block.
MOV r4, #0
STR r4, [r1,#-3*16]!
STR r4, [r1,#4]
STR r4, [r1,#16]
STR r4, [r1,#32]
MOV r1, r13 @ Read from temp storage.
MOV r0, r2 @ Write to the final destination
@ Column transforms
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
BL idct3core_down_arm
ADD r13,r13,#64*2
LDMFD r13!,{r4-r7,r9-r11,PC}
.size oc_idct8x8_6_arm, .-oc_idct8x8_6_arm @ ENDP
.type oc_idct8x8_3_arm, %function; oc_idct8x8_3_arm: @ PROC
STMFD r13!,{r4-r7,r9-r11,r14}
SUB r13,r13,#64*2
@ Row transforms
MOV r2, r0
MOV r0, r13 @ Write to temp storage.
BL idct2core_arm
BL idct1core_arm
@ Clear input data for next block.
MOV r4, #0
STR r4, [r1,#-2*16]!
STR r4, [r1,#16]
MOV r1, r13 @ Read from temp storage.
MOV r0, r2 @ Write to the final destination
@ Column transforms
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
BL idct2core_down_arm
ADD r13,r13,#64*2
LDMFD r13!,{r4-r7,r9-r11,PC}
.size oc_idct8x8_3_arm, .-oc_idct8x8_3_arm @ ENDP
.type idct1core_arm, %function; idct1core_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r3, [r1], #16
MOV r12,#0x05
ORR r12,r12,#0xB500
MUL r3, r12, r3
@ Stall ?
MOV r3, r3, ASR #16
STRH r3, [r0], #2
STRH r3, [r0, #14]
STRH r3, [r0, #30]
STRH r3, [r0, #46]
STRH r3, [r0, #62]
STRH r3, [r0, #78]
STRH r3, [r0, #94]
STRH r3, [r0, #110]
MOV PC,R14
.size idct1core_arm, .-idct1core_arm @ ENDP
.type idct2core_arm, %function; idct2core_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r12,OC_C4S4
LDRSH r11,[r1, #-14] @ r11= x[1]
LDR r3, OC_C7S1
MUL r9, r12,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r10,OC_C1S7
MUL r3, r11,r3 @ r3 = t[4]<<16 = OC_C7S1*x[1]
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r11,r10,r11 @ r11= t[7]<<16 = OC_C1S7*x[1]
MOV r3, r3, ASR #16 @ r3 = t[4]
MUL r10,r12,r3 @ r10= t[5]<<16 = OC_C4S4*t[4]
MOV r11,r11,ASR #16 @ r11= t[7]
MUL r12,r11,r12 @ r12= t[6]<<16 = OC_C4S4*t[7]
MOV r10,r10,ASR #16 @ r10= t[5]
ADD r12,r9,r12,ASR #16 @ r12= t[0]+t[6]
ADD r12,r12,r10 @ r12= t[0]+t2[6] = t[0]+t[6]+t[5]
SUB r10,r12,r10,LSL #1 @ r10= t[0]+t2[5] = t[0]+t[6]-t[5]
ADD r3, r3, r9 @ r3 = t[0]+t[4]
ADD r11,r11,r9 @ r11= t[0]+t[7]
STRH r11,[r0], #2 @ y[0] = t[0]+t[7]
STRH r12,[r0, #14] @ y[1] = t[0]+t[6]
STRH r10,[r0, #30] @ y[2] = t[0]+t[5]
STRH r3, [r0, #46] @ y[3] = t[0]+t[4]
RSB r3, r3, r9, LSL #1 @ r3 = t[0]*2-(t[0]+t[4])=t[0]-t[4]
RSB r10,r10,r9, LSL #1 @ r10= t[0]*2-(t[0]+t[5])=t[0]-t[5]
RSB r12,r12,r9, LSL #1 @ r12= t[0]*2-(t[0]+t[6])=t[0]-t[6]
RSB r11,r11,r9, LSL #1 @ r1 = t[0]*2-(t[0]+t[7])=t[0]-t[7]
STRH r3, [r0, #62] @ y[4] = t[0]-t[4]
STRH r10,[r0, #78] @ y[5] = t[0]-t[5]
STRH r12,[r0, #94] @ y[6] = t[0]-t[6]
STRH r11,[r0, #110] @ y[7] = t[0]-t[7]
MOV PC,r14
.size idct2core_arm, .-idct2core_arm @ ENDP
.type idct2core_down_arm, %function; idct2core_down_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r12,OC_C4S4
LDRSH r11,[r1, #-14] @ r11= x[1]
LDR r3, OC_C7S1
MUL r9, r12,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r10,OC_C1S7
MUL r3, r11,r3 @ r3 = t[4]<<16 = OC_C7S1*x[1]
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r11,r10,r11 @ r11= t[7]<<16 = OC_C1S7*x[1]
ADD r9, r9, #8 @ r9 = t[0]+8
MOV r3, r3, ASR #16 @ r3 = t[4]
MUL r10,r12,r3 @ r10= t[5]<<16 = OC_C4S4*t[4]
MOV r11,r11,ASR #16 @ r11= t[7]
MUL r12,r11,r12 @ r12= t[6]<<16 = OC_C4S4*t[7]
MOV r10,r10,ASR #16 @ r10= t[5]
ADD r12,r9,r12,ASR #16 @ r12= t[0]+t[6]+8
ADD r12,r12,r10 @ r12= t[0]+t2[6] = t[0]+t[6]+t[5]+8
SUB r10,r12,r10,LSL #1 @ r10= t[0]+t2[5] = t[0]+t[6]-t[5]+8
ADD r3, r3, r9 @ r3 = t[0]+t[4]+8
ADD r11,r11,r9 @ r11= t[0]+t[7]+8
@ TODO: This is wrong.
@ The C code truncates to 16 bits by storing to RAM and doing the
@ shifts later; we've got an extra 4 bits here.
MOV r4, r11,ASR #4
MOV r5, r12,ASR #4
MOV r6, r10,ASR #4
MOV r7, r3, ASR #4
RSB r3, r3, r9, LSL #1 @r3 =t[0]*2+8-(t[0]+t[4])=t[0]-t[4]+8
RSB r10,r10,r9, LSL #1 @r10=t[0]*2+8-(t[0]+t[5])=t[0]-t[5]+8
RSB r12,r12,r9, LSL #1 @r12=t[0]*2+8-(t[0]+t[6])=t[0]-t[6]+8
RSB r11,r11,r9, LSL #1 @r11=t[0]*2+8-(t[0]+t[7])=t[0]-t[7]+8
MOV r3, r3, ASR #4
MOV r10,r10,ASR #4
MOV r12,r12,ASR #4
MOV r11,r11,ASR #4
STRH r4, [r0], #2 @ y[0] = t[0]+t[7]
STRH r5, [r0, #14] @ y[1] = t[0]+t[6]
STRH r6, [r0, #30] @ y[2] = t[0]+t[5]
STRH r7, [r0, #46] @ y[3] = t[0]+t[4]
STRH r3, [r0, #62] @ y[4] = t[0]-t[4]
STRH r10,[r0, #78] @ y[5] = t[0]-t[5]
STRH r12,[r0, #94] @ y[6] = t[0]-t[6]
STRH r11,[r0, #110] @ y[7] = t[0]-t[7]
MOV PC,r14
.size idct2core_down_arm, .-idct2core_down_arm @ ENDP
.type idct3core_arm, %function; idct3core_arm: @ PROC
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r12,OC_C4S4 @ r12= OC_C4S4
LDRSH r3, [r1, #-12] @ r3 = x[2]
LDR r10,OC_C6S2 @ r10= OC_C6S2
MUL r9, r12,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r4, OC_C2S6 @ r4 = OC_C2S6
MUL r10,r3, r10 @ r10= t[2]<<16 = OC_C6S2*x[2]
LDRSH r11,[r1, #-14] @ r11= x[1]
MUL r3, r4, r3 @ r3 = t[3]<<16 = OC_C2S6*x[2]
LDR r4, OC_C7S1 @ r4 = OC_C7S1
LDR r5, OC_C1S7 @ r5 = OC_C1S7
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r4, r11,r4 @ r4 = t[4]<<16 = OC_C7S1*x[1]
ADD r3, r9, r3, ASR #16 @ r3 = t[0]+t[3]
MUL r11,r5, r11 @ r11= t[7]<<16 = OC_C1S7*x[1]
MOV r4, r4, ASR #16 @ r4 = t[4]
MUL r5, r12,r4 @ r5 = t[5]<<16 = OC_C4S4*t[4]
MOV r11,r11,ASR #16 @ r11= t[7]
MUL r12,r11,r12 @ r12= t[6]<<16 = OC_C4S4*t[7]
ADD r10,r9, r10,ASR #16 @ r10= t[1] = t[0]+t[2]
RSB r6, r10,r9, LSL #1 @ r6 = t[2] = t[0]-t[2]
@ r3 = t2[0] = t[0]+t[3]
RSB r9, r3, r9, LSL #1 @ r9 = t2[3] = t[0]-t[3]
MOV r12,r12,ASR #16 @ r12= t[6]
ADD r5, r12,r5, ASR #16 @ r5 = t2[6] = t[6]+t[5]
RSB r12,r5, r12,LSL #1 @ r12= t2[5] = t[6]-t[5]
ADD r11,r3, r11 @ r11= t2[0]+t[7]
ADD r5, r10,r5 @ r5 = t[1]+t2[6]
ADD r12,r6, r12 @ r12= t[2]+t2[5]
ADD r4, r9, r4 @ r4 = t2[3]+t[4]
STRH r11,[r0], #2 @ y[0] = t[0]+t[7]
STRH r5, [r0, #14] @ y[1] = t[1]+t2[6]
STRH r12,[r0, #30] @ y[2] = t[2]+t2[5]
STRH r4, [r0, #46] @ y[3] = t2[3]+t[4]
RSB r11,r11,r3, LSL #1 @ r11= t2[0] - t[7]
RSB r5, r5, r10,LSL #1 @ r5 = t[1] - t2[6]
RSB r12,r12,r6, LSL #1 @ r6 = t[2] - t2[5]
RSB r4, r4, r9, LSL #1 @ r4 = t2[3] - t[4]
STRH r4, [r0, #62] @ y[4] = t2[3]-t[4]
STRH r12,[r0, #78] @ y[5] = t[2]-t2[5]
STRH r5, [r0, #94] @ y[6] = t[1]-t2[6]
STRH r11,[r0, #110] @ y[7] = t2[0]-t[7]
MOV PC,R14
.size idct3core_arm, .-idct3core_arm @ ENDP
.type idct3core_down_arm, %function; idct3core_down_arm: @ PROC
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r12,OC_C4S4 @ r12= OC_C4S4
LDRSH r3, [r1, #-12] @ r3 = x[2]
LDR r10,OC_C6S2 @ r10= OC_C6S2
MUL r9, r12,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r4, OC_C2S6 @ r4 = OC_C2S6
MUL r10,r3, r10 @ r10= t[2]<<16 = OC_C6S2*x[2]
LDRSH r11,[r1, #-14] @ r11= x[1]
MUL r3, r4, r3 @ r3 = t[3]<<16 = OC_C2S6*x[2]
LDR r4, OC_C7S1 @ r4 = OC_C7S1
LDR r5, OC_C1S7 @ r5 = OC_C1S7
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r4, r11,r4 @ r4 = t[4]<<16 = OC_C7S1*x[1]
ADD r9, r9, #8 @ r9 = t[0]+8
MUL r11,r5, r11 @ r11= t[7]<<16 = OC_C1S7*x[1]
ADD r3, r9, r3, ASR #16 @ r3 = t[0]+t[3]+8
MOV r4, r4, ASR #16 @ r4 = t[4]
MUL r5, r12,r4 @ r5 = t[5]<<16 = OC_C4S4*t[4]
MOV r11,r11,ASR #16 @ r11= t[7]
MUL r12,r11,r12 @ r12= t[6]<<16 = OC_C4S4*t[7]
ADD r10,r9, r10,ASR #16 @ r10= t[1]+8 = t[0]+t[2]+8
RSB r6, r10,r9, LSL #1 @ r6 = t[2]+8 = t[0]-t[2]+8
@ r3 = t2[0]+8 = t[0]+t[3]+8
RSB r9, r3, r9, LSL #1 @ r9 = t2[3]+8 = t[0]-t[3]+8
MOV r12,r12,ASR #16 @ r12= t[6]
ADD r5, r12,r5, ASR #16 @ r5 = t2[6] = t[6]+t[5]
RSB r12,r5, r12,LSL #1 @ r12= t2[5] = t[6]-t[5]
ADD r11,r3, r11 @ r11= t2[0]+t[7] +8
ADD r5, r10,r5 @ r5 = t[1] +t2[6]+8
ADD r12,r6, r12 @ r12= t[2] +t2[5]+8
ADD r4, r9, r4 @ r4 = t2[3]+t[4] +8
RSB r3, r11,r3, LSL #1 @ r11= t2[0] - t[7] + 8
RSB r10,r5, r10,LSL #1 @ r5 = t[1] - t2[6] + 8
RSB r6, r12,r6, LSL #1 @ r6 = t[2] - t2[5] + 8
RSB r9, r4, r9, LSL #1 @ r4 = t2[3] - t[4] + 8
@ TODO: This is wrong.
@ The C code truncates to 16 bits by storing to RAM and doing the
@ shifts later; we've got an extra 4 bits here.
MOV r11,r11,ASR #4
MOV r5, r5, ASR #4
MOV r12,r12,ASR #4
MOV r4, r4, ASR #4
MOV r9, r9, ASR #4
MOV r6, r6, ASR #4
MOV r10,r10,ASR #4
MOV r3, r3, ASR #4
STRH r11,[r0], #2 @ y[0] = t[0]+t[7]
STRH r5, [r0, #14] @ y[1] = t[1]+t2[6]
STRH r12,[r0, #30] @ y[2] = t[2]+t2[5]
STRH r4, [r0, #46] @ y[3] = t2[3]+t[4]
STRH r9, [r0, #62] @ y[4] = t2[3]-t[4]
STRH r6, [r0, #78] @ y[5] = t[2]-t2[5]
STRH r10,[r0, #94] @ y[6] = t[1]-t2[6]
STRH r3, [r0, #110] @ y[7] = t2[0]-t[7]
MOV PC,R14
.size idct3core_down_arm, .-idct3core_down_arm @ ENDP
.type idct4core_arm, %function; idct4core_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r10,OC_C4S4 @ r10= OC_C4S4
LDRSH r12,[r1, #-12] @ r12= x[2]
LDR r4, OC_C6S2 @ r4 = OC_C6S2
MUL r9, r10,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r5, OC_C2S6 @ r5 = OC_C2S6
MUL r4, r12,r4 @ r4 = t[2]<<16 = OC_C6S2*x[2]
LDRSH r3, [r1, #-14] @ r3 = x[1]
MUL r5, r12,r5 @ r5 = t[3]<<16 = OC_C2S6*x[2]
LDR r6, OC_C7S1 @ r6 = OC_C7S1
LDR r12,OC_C1S7 @ r12= OC_C1S7
LDRSH r11,[r1, #-10] @ r11= x[3]
MUL r6, r3, r6 @ r6 = t[4]<<16 = OC_C7S1*x[1]
LDR r7, OC_C5S3 @ r7 = OC_C5S3
MUL r3, r12,r3 @ r3 = t[7]<<16 = OC_C1S7*x[1]
LDR r8, OC_C3S5 @ r8 = OC_C3S5
MUL r7, r11,r7 @ r7 = -t[5]<<16 = OC_C5S3*x[3]
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r11,r8, r11 @ r11= t[6]<<16 = OC_C3S5*x[3]
MOV r6, r6, ASR #16 @ r6 = t[4]
@ TODO: This is wrong; t[4]-t[5] and t[7]-t[6] need to be truncated to 16-bit
@ before multiplying, not after (this is not equivalent)
SUB r7, r6, r7, ASR #16 @ r7 = t2[4]=t[4]+t[5] (as r7=-t[5])
RSB r6, r7, r6, LSL #1 @ r6 = t[4]-t[5]
MUL r6, r10,r6 @ r6 = t2[5]<<16 =OC_C4S4*(t[4]-t[5])
MOV r3, r3, ASR #16 @ r3 = t[7]
ADD r11,r3, r11,ASR #16 @ r11= t2[7]=t[7]+t[6]
RSB r3, r11,r3, LSL #1 @ r3 = t[7]-t[6]
MUL r3, r10,r3 @ r3 = t2[6]<<16 =OC_C4S4*(t[7]-t[6])
ADD r4, r9, r4, ASR #16 @ r4 = t[1] = t[0] + t[2]
RSB r10,r4, r9, LSL #1 @ r10= t[2] = t[0] - t[2]
ADD r5, r9, r5, ASR #16 @ r5 = t[0] = t[0] + t[3]
RSB r9, r5, r9, LSL #1 @ r9 = t[3] = t[0] - t[3]
MOV r3, r3, ASR #16 @ r3 = t2[6]
ADD r6, r3, r6, ASR #16 @ r6 = t3[6] = t2[6]+t2[5]
RSB r3, r6, r3, LSL #1 @ r3 = t3[5] = t2[6]-t2[5]
ADD r11,r5, r11 @ r11= t[0]+t2[7]
ADD r6, r4, r6 @ r6 = t[1]+t3[6]
ADD r3, r10,r3 @ r3 = t[2]+t3[5]
ADD r7, r9, r7 @ r7 = t[3]+t2[4]
STRH r11,[r0], #2 @ y[0] = t[0]+t[7]
STRH r6, [r0, #14] @ y[1] = t[1]+t2[6]
STRH r3, [r0, #30] @ y[2] = t[2]+t2[5]
STRH r7, [r0, #46] @ y[3] = t2[3]+t[4]
RSB r11,r11,r5, LSL #1 @ r11= t[0]-t2[7]
RSB r6, r6, r4, LSL #1 @ r6 = t[1]-t3[6]
RSB r3, r3, r10,LSL #1 @ r3 = t[2]-t3[5]
RSB r7, r7, r9, LSL #1 @ r7 = t[3]-t2[4]
STRH r7, [r0, #62] @ y[4] = t2[3]-t[4]
STRH r3, [r0, #78] @ y[5] = t[2]-t2[5]
STRH r6, [r0, #94] @ y[6] = t[1]-t2[6]
STRH r11, [r0, #110] @ y[7] = t2[0]-t[7]
MOV PC,r14
.size idct4core_arm, .-idct4core_arm @ ENDP
.type idct4core_down_arm, %function; idct4core_down_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r9, [r1], #16 @ r9 = x[0]
LDR r10,OC_C4S4 @ r10= OC_C4S4
LDRSH r12,[r1, #-12] @ r12= x[2]
LDR r4, OC_C6S2 @ r4 = OC_C6S2
MUL r9, r10,r9 @ r9 = t[0]<<16 = OC_C4S4*x[0]
LDR r5, OC_C2S6 @ r5 = OC_C2S6
MUL r4, r12,r4 @ r4 = t[2]<<16 = OC_C6S2*x[2]
LDRSH r3, [r1, #-14] @ r3 = x[1]
MUL r5, r12,r5 @ r5 = t[3]<<16 = OC_C2S6*x[2]
LDR r6, OC_C7S1 @ r6 = OC_C7S1
LDR r12,OC_C1S7 @ r12= OC_C1S7
LDRSH r11,[r1, #-10] @ r11= x[3]
MUL r6, r3, r6 @ r6 = t[4]<<16 = OC_C7S1*x[1]
LDR r7, OC_C5S3 @ r7 = OC_C5S3
MUL r3, r12,r3 @ r3 = t[7]<<16 = OC_C1S7*x[1]
LDR r8, OC_C3S5 @ r8 = OC_C3S5
MUL r7, r11,r7 @ r7 = -t[5]<<16 = OC_C5S3*x[3]
MOV r9, r9, ASR #16 @ r9 = t[0]
MUL r11,r8, r11 @ r11= t[6]<<16 = OC_C3S5*x[3]
MOV r6, r6, ASR #16 @ r6 = t[4]
@ TODO: This is wrong; t[4]-t[5] and t[7]-t[6] need to be truncated to 16-bit
@ before multiplying, not after (this is not equivalent)
SUB r7, r6, r7, ASR #16 @ r7 = t2[4]=t[4]+t[5] (as r7=-t[5])
RSB r6, r7, r6, LSL #1 @ r6 = t[4]-t[5]
MUL r6, r10,r6 @ r6 = t2[5]<<16 =OC_C4S4*(t[4]-t[5])
MOV r3, r3, ASR #16 @ r3 = t[7]
ADD r11,r3, r11,ASR #16 @ r11= t2[7]=t[7]+t[6]
RSB r3, r11,r3, LSL #1 @ r3 = t[7]-t[6]
ADD r9, r9, #8 @ r9 = t[0]+8
MUL r3, r10,r3 @ r3 = t2[6]<<16 =OC_C4S4*(t[7]-t[6])
ADD r4, r9, r4, ASR #16 @ r4 = t[1] = t[0] + t[2] + 8
RSB r10,r4, r9, LSL #1 @ r10= t[2] = t[0] - t[2] + 8
ADD r5, r9, r5, ASR #16 @ r5 = t[0] = t[0] + t[3] + 8
RSB r9, r5, r9, LSL #1 @ r9 = t[3] = t[0] - t[3] + 8
MOV r3, r3, ASR #16 @ r3 = t2[6]
ADD r6, r3, r6, ASR #16 @ r6 = t3[6] = t2[6]+t2[5]
RSB r3, r6, r3, LSL #1 @ r3 = t3[5] = t2[6]-t2[5]
ADD r5, r5, r11 @ r5 = t[0]+t2[7]+8
ADD r4, r4, r6 @ r4 = t[1]+t3[6]+8
ADD r10,r10,r3 @ r10= t[2]+t3[5]+8
ADD r9, r9, r7 @ r9 = t[3]+t2[4]+8
SUB r11,r5, r11,LSL #1 @ r11= t[0]-t2[7]+8
SUB r6, r4, r6, LSL #1 @ r6 = t[1]-t3[6]+8
SUB r3, r10,r3, LSL #1 @ r3 = t[2]-t3[5]+8
SUB r7, r9, r7, LSL #1 @ r7 = t[3]-t2[4]+8
@ TODO: This is wrong.
@ The C code truncates to 16 bits by storing to RAM and doing the
@ shifts later; we've got an extra 4 bits here.
MOV r11,r11,ASR #4
MOV r6, r6, ASR #4
MOV r3, r3, ASR #4
MOV r7, r7, ASR #4
MOV r9, r9, ASR #4
MOV r10,r10,ASR #4
MOV r4, r4, ASR #4
MOV r5, r5, ASR #4
STRH r5,[r0], #2 @ y[0] = t[0]+t[7]
STRH r4, [r0, #14] @ y[1] = t[1]+t2[6]
STRH r10,[r0, #30] @ y[2] = t[2]+t2[5]
STRH r9, [r0, #46] @ y[3] = t2[3]+t[4]
STRH r7, [r0, #62] @ y[4] = t2[3]-t[4]
STRH r3, [r0, #78] @ y[5] = t[2]-t2[5]
STRH r6, [r0, #94] @ y[6] = t[1]-t2[6]
STRH r11,[r0, #110] @ y[7] = t2[0]-t[7]
MOV PC,r14
.size idct4core_down_arm, .-idct4core_down_arm @ ENDP
.type idct8core_arm, %function; idct8core_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r2, [r1],#16 @ r2 = x[0]
STMFD r13!,{r1,r14}
LDRSH r6, [r1, #-8] @ r6 = x[4]
LDR r12,OC_C4S4 @ r12= C4S4
LDRSH r4, [r1, #-12] @ r4 = x[2]
ADD r2, r2, r6 @ r2 = x[0] + x[4]
SUB r6, r2, r6, LSL #1 @ r6 = x[0] - x[4]
@ For spec compliance, these sums must be truncated to 16-bit precision
@ _before_ the multiply (not after).
@ Sadly, ARMv4 provides no simple way to do that.
MOV r2, r2, LSL #16
MOV r6, r6, LSL #16
MOV r2, r2, ASR #16
MOV r6, r6, ASR #16
MUL r2, r12,r2 @ r2 = t[0]<<16 = C4S4*(x[0]+x[4])
LDRSH r8, [r1, #-4] @ r8 = x[6]
LDR r7, OC_C6S2 @ r7 = OC_C6S2
MUL r6, r12,r6 @ r6 = t[1]<<16 = C4S4*(x[0]-x[4])
LDR r14,OC_C2S6 @ r14= OC_C2S6
MUL r3, r4, r7 @ r3 = OC_C6S2*x[2]
LDR r5, OC_C7S1 @ r5 = OC_C7S1
MUL r4, r14,r4 @ r4 = OC_C2S6*x[2]
MOV r3, r3, ASR #16 @ r3 = OC_C6S2*x[2]>>16
MUL r14,r8, r14 @ r14= OC_C2S6*x[6]
MOV r4, r4, ASR #16 @ r4 = OC_C2S6*x[2]>>16
MUL r8, r7, r8 @ r8 = OC_C6S2*x[6]
LDR r7, OC_C1S7 @ r7 = OC_C1S7
SUB r3, r3, r14,ASR #16 @ r3=t[2]=C6S2*x[2]>>16-C2S6*x[6]>>16
LDRSH r14,[r1, #-14] @ r14= x[1]
ADD r4, r4, r8, ASR #16 @ r4=t[3]=C2S6*x[2]>>16+C6S2*x[6]>>16
LDRSH r8, [r1, #-2] @ r8 = x[7]
MUL r9, r5, r14 @ r9 = OC_C7S1*x[1]
LDRSH r10,[r1, #-6] @ r10= x[5]
MUL r14,r7, r14 @ r14= OC_C1S7*x[1]
MOV r9, r9, ASR #16 @ r9 = OC_C7S1*x[1]>>16
MUL r7, r8, r7 @ r7 = OC_C1S7*x[7]
MOV r14,r14,ASR #16 @ r14= OC_C1S7*x[1]>>16
MUL r8, r5, r8 @ r8 = OC_C7S1*x[7]
LDRSH r1, [r1, #-10] @ r1 = x[3]
LDR r5, OC_C3S5 @ r5 = OC_C3S5
LDR r11,OC_C5S3 @ r11= OC_C5S3
ADD r8, r14,r8, ASR #16 @ r8=t[7]=C1S7*x[1]>>16+C7S1*x[7]>>16
MUL r14,r5, r10 @ r14= OC_C3S5*x[5]
SUB r9, r9, r7, ASR #16 @ r9=t[4]=C7S1*x[1]>>16-C1S7*x[7]>>16
MUL r10,r11,r10 @ r10= OC_C5S3*x[5]
MOV r14,r14,ASR #16 @ r14= OC_C3S5*x[5]>>16
MUL r11,r1, r11 @ r11= OC_C5S3*x[3]
MOV r10,r10,ASR #16 @ r10= OC_C5S3*x[5]>>16
MUL r1, r5, r1 @ r1 = OC_C3S5*x[3]
SUB r14,r14,r11,ASR #16 @r14=t[5]=C3S5*x[5]>>16-C5S3*x[3]>>16
ADD r10,r10,r1, ASR #16 @r10=t[6]=C5S3*x[5]>>16+C3S5*x[3]>>16
@ r2=t[0]<<16 r3=t[2] r4=t[3] r6=t[1]<<16 r8=t[7] r9=t[4]
@ r10=t[6] r12=C4S4 r14=t[5]
@ TODO: This is wrong; t[4]-t[5] and t[7]-t[6] need to be truncated to 16-bit
@ before multiplying, not after (this is not equivalent)
@ Stage 2
@ 4-5 butterfly
ADD r9, r9, r14 @ r9 = t2[4] = t[4]+t[5]
SUB r14,r9, r14, LSL #1 @ r14= t[4]-t[5]
MUL r14,r12,r14 @ r14= t2[5]<<16 = C4S4*(t[4]-t[5])
@ 7-6 butterfly
ADD r8, r8, r10 @ r8 = t2[7] = t[7]+t[6]
SUB r10,r8, r10, LSL #1 @ r10= t[7]-t[6]
MUL r10,r12,r10 @ r10= t2[6]<<16 = C4S4*(t[7]+t[6])
@ r2=t[0]<<16 r3=t[2] r4=t[3] r6=t[1]<<16 r8=t2[7] r9=t2[4]
@ r10=t2[6]<<16 r12=C4S4 r14=t2[5]<<16
@ Stage 3
@ 0-3 butterfly
ADD r2, r4, r2, ASR #16 @ r2 = t2[0] = t[0] + t[3]
SUB r4, r2, r4, LSL #1 @ r4 = t2[3] = t[0] - t[3]
@ 1-2 butterfly
ADD r6, r3, r6, ASR #16 @ r6 = t2[1] = t[1] + t[2]
SUB r3, r6, r3, LSL #1 @ r3 = t2[2] = t[1] - t[2]
@ 6-5 butterfly
MOV r14,r14,ASR #16 @ r14= t2[5]
ADD r10,r14,r10,ASR #16 @ r10= t3[6] = t[6] + t[5]
SUB r14,r10,r14,LSL #1 @ r14= t3[5] = t[6] - t[5]
@ r2=t2[0] r3=t2[2] r4=t2[3] r6=t2[1] r8=t2[7] r9=t2[4]
@ r10=t3[6] r14=t3[5]
@ Stage 4
ADD r2, r2, r8 @ r2 = t[0] + t[7]
ADD r6, r6, r10 @ r6 = t[1] + t[6]
ADD r3, r3, r14 @ r3 = t[2] + t[5]
ADD r4, r4, r9 @ r4 = t[3] + t[4]
SUB r8, r2, r8, LSL #1 @ r8 = t[0] - t[7]
SUB r10,r6, r10,LSL #1 @ r10= t[1] - t[6]
SUB r14,r3, r14,LSL #1 @ r14= t[2] - t[5]
SUB r9, r4, r9, LSL #1 @ r9 = t[3] - t[4]
STRH r2, [r0], #2 @ y[0] = t[0]+t[7]
STRH r6, [r0, #14] @ y[1] = t[1]+t[6]
STRH r3, [r0, #30] @ y[2] = t[2]+t[5]
STRH r4, [r0, #46] @ y[3] = t[3]+t[4]
STRH r9, [r0, #62] @ y[4] = t[3]-t[4]
STRH r14,[r0, #78] @ y[5] = t[2]-t[5]
STRH r10,[r0, #94] @ y[6] = t[1]-t[6]
STRH r8, [r0, #110] @ y[7] = t[0]-t[7]
LDMFD r13!,{r1,PC}
.size idct8core_arm, .-idct8core_arm @ ENDP
.type idct8core_down_arm, %function; idct8core_down_arm: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r2, [r1],#16 @ r2 = x[0]
STMFD r13!,{r1,r14}
LDRSH r6, [r1, #-8] @ r6 = x[4]
LDR r12,OC_C4S4 @ r12= C4S4
LDRSH r4, [r1, #-12] @ r4 = x[2]
ADD r2, r2, r6 @ r2 = x[0] + x[4]
SUB r6, r2, r6, LSL #1 @ r6 = x[0] - x[4]
@ For spec compliance, these sums must be truncated to 16-bit precision
@ _before_ the multiply (not after).
@ Sadly, ARMv4 provides no simple way to do that.
MOV r2, r2, LSL #16
MOV r6, r6, LSL #16
MOV r2, r2, ASR #16
MOV r6, r6, ASR #16
MUL r2, r12,r2 @ r2 = t[0]<<16 = C4S4*(x[0]+x[4])
LDRSH r8, [r1, #-4] @ r8 = x[6]
LDR r7, OC_C6S2 @ r7 = OC_C6S2
MUL r6, r12,r6 @ r6 = t[1]<<16 = C4S4*(x[0]-x[4])
LDR r14,OC_C2S6 @ r14= OC_C2S6
MUL r3, r4, r7 @ r3 = OC_C6S2*x[2]
LDR r5, OC_C7S1 @ r5 = OC_C7S1
MUL r4, r14,r4 @ r4 = OC_C2S6*x[2]
MOV r3, r3, ASR #16 @ r3 = OC_C6S2*x[2]>>16
MUL r14,r8, r14 @ r14= OC_C2S6*x[6]
MOV r4, r4, ASR #16 @ r4 = OC_C2S6*x[2]>>16
MUL r8, r7, r8 @ r8 = OC_C6S2*x[6]
LDR r7, OC_C1S7 @ r7 = OC_C1S7
SUB r3, r3, r14,ASR #16 @ r3=t[2]=C6S2*x[2]>>16-C2S6*x[6]>>16
LDRSH r14,[r1, #-14] @ r14= x[1]
ADD r4, r4, r8, ASR #16 @ r4=t[3]=C2S6*x[2]>>16+C6S2*x[6]>>16
LDRSH r8, [r1, #-2] @ r8 = x[7]
MUL r9, r5, r14 @ r9 = OC_C7S1*x[1]
LDRSH r10,[r1, #-6] @ r10= x[5]
MUL r14,r7, r14 @ r14= OC_C1S7*x[1]
MOV r9, r9, ASR #16 @ r9 = OC_C7S1*x[1]>>16
MUL r7, r8, r7 @ r7 = OC_C1S7*x[7]
MOV r14,r14,ASR #16 @ r14= OC_C1S7*x[1]>>16
MUL r8, r5, r8 @ r8 = OC_C7S1*x[7]
LDRSH r1, [r1, #-10] @ r1 = x[3]
LDR r5, OC_C3S5 @ r5 = OC_C3S5
LDR r11,OC_C5S3 @ r11= OC_C5S3
ADD r8, r14,r8, ASR #16 @ r8=t[7]=C1S7*x[1]>>16+C7S1*x[7]>>16
MUL r14,r5, r10 @ r14= OC_C3S5*x[5]
SUB r9, r9, r7, ASR #16 @ r9=t[4]=C7S1*x[1]>>16-C1S7*x[7]>>16
MUL r10,r11,r10 @ r10= OC_C5S3*x[5]
MOV r14,r14,ASR #16 @ r14= OC_C3S5*x[5]>>16
MUL r11,r1, r11 @ r11= OC_C5S3*x[3]
MOV r10,r10,ASR #16 @ r10= OC_C5S3*x[5]>>16
MUL r1, r5, r1 @ r1 = OC_C3S5*x[3]
SUB r14,r14,r11,ASR #16 @r14=t[5]=C3S5*x[5]>>16-C5S3*x[3]>>16
ADD r10,r10,r1, ASR #16 @r10=t[6]=C5S3*x[5]>>16+C3S5*x[3]>>16
@ r2=t[0]<<16 r3=t[2] r4=t[3] r6=t[1]<<16 r8=t[7] r9=t[4]
@ r10=t[6] r12=C4S4 r14=t[5]
@ Stage 2
@ TODO: This is wrong; t[4]-t[5] and t[7]-t[6] need to be truncated to 16-bit
@ before multiplying, not after (this is not equivalent)
@ 4-5 butterfly
ADD r9, r9, r14 @ r9 = t2[4] = t[4]+t[5]
SUB r14,r9, r14, LSL #1 @ r14= t[4]-t[5]
MUL r14,r12,r14 @ r14= t2[5]<<16 = C4S4*(t[4]-t[5])
@ 7-6 butterfly
ADD r8, r8, r10 @ r8 = t2[7] = t[7]+t[6]
SUB r10,r8, r10, LSL #1 @ r10= t[7]-t[6]
MUL r10,r12,r10 @ r10= t2[6]<<16 = C4S4*(t[7]+t[6])
@ r2=t[0]<<16 r3=t[2] r4=t[3] r6=t[1]<<16 r8=t2[7] r9=t2[4]
@ r10=t2[6]<<16 r12=C4S4 r14=t2[5]<<16
@ Stage 3
ADD r2, r2, #8<<16 @ r2 = t[0]+8<<16
ADD r6, r6, #8<<16 @ r6 = t[1]+8<<16
@ 0-3 butterfly
ADD r2, r4, r2, ASR #16 @ r2 = t2[0] = t[0] + t[3] + 8
SUB r4, r2, r4, LSL #1 @ r4 = t2[3] = t[0] - t[3] + 8
@ 1-2 butterfly
ADD r6, r3, r6, ASR #16 @ r6 = t2[1] = t[1] + t[2] + 8
SUB r3, r6, r3, LSL #1 @ r3 = t2[2] = t[1] - t[2] + 8
@ 6-5 butterfly
MOV r14,r14,ASR #16 @ r14= t2[5]
ADD r10,r14,r10,ASR #16 @ r10= t3[6] = t[6] + t[5]
SUB r14,r10,r14,LSL #1 @ r14= t3[5] = t[6] - t[5]
@ r2=t2[0] r3=t2[2] r4=t2[3] r6=t2[1] r8=t2[7] r9=t2[4]
@ r10=t3[6] r14=t3[5]
@ Stage 4
ADD r2, r2, r8 @ r2 = t[0] + t[7] + 8
ADD r6, r6, r10 @ r6 = t[1] + t[6] + 8
ADD r3, r3, r14 @ r3 = t[2] + t[5] + 8
ADD r4, r4, r9 @ r4 = t[3] + t[4] + 8
SUB r8, r2, r8, LSL #1 @ r8 = t[0] - t[7] + 8
SUB r10,r6, r10,LSL #1 @ r10= t[1] - t[6] + 8
SUB r14,r3, r14,LSL #1 @ r14= t[2] - t[5] + 8
SUB r9, r4, r9, LSL #1 @ r9 = t[3] - t[4] + 8
@ TODO: This is wrong.
@ The C code truncates to 16 bits by storing to RAM and doing the
@ shifts later; we've got an extra 4 bits here.
MOV r2, r2, ASR #4
MOV r6, r6, ASR #4
MOV r3, r3, ASR #4
MOV r4, r4, ASR #4
MOV r8, r8, ASR #4
MOV r10,r10,ASR #4
MOV r14,r14,ASR #4
MOV r9, r9, ASR #4
STRH r2, [r0], #2 @ y[0] = t[0]+t[7]
STRH r6, [r0, #14] @ y[1] = t[1]+t[6]
STRH r3, [r0, #30] @ y[2] = t[2]+t[5]
STRH r4, [r0, #46] @ y[3] = t[3]+t[4]
STRH r9, [r0, #62] @ y[4] = t[3]-t[4]
STRH r14,[r0, #78] @ y[5] = t[2]-t[5]
STRH r10,[r0, #94] @ y[6] = t[1]-t[6]
STRH r8, [r0, #110] @ y[7] = t[0]-t[7]
LDMFD r13!,{r1,PC}
.size idct8core_down_arm, .-idct8core_down_arm @ ENDP
.if OC_ARM_ASM_MEDIA
.global oc_idct8x8_1_v6
.global oc_idct8x8_v6
.type oc_idct8x8_1_v6, %function; oc_idct8x8_1_v6: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_uint16_t _dc
ORR r2, r1, r1, LSL #16
ORR r3, r1, r1, LSL #16
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
STRD r2, [r0], #8
MOV PC, r14
.size oc_idct8x8_1_v6, .-oc_idct8x8_1_v6 @ ENDP
.type oc_idct8x8_v6, %function; oc_idct8x8_v6: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_int16_t *_x
@ r2 = int _last_zzi
CMP r2, #3
BLE oc_idct8x8_3_v6
@CMP r2, #6
@BLE oc_idct8x8_6_v6
CMP r2, #10
BLE oc_idct8x8_10_v6
oc_idct8x8_slow_v6:
STMFD r13!,{r4-r11,r14}
SUB r13,r13,#64*2
@ Row transforms
STR r0, [r13,#-4]!
ADD r0, r13, #4 @ Write to temp storage.
BL idct8_8core_v6
BL idct8_8core_v6
BL idct8_8core_v6
BL idct8_8core_v6
LDR r0, [r13], #4 @ Write to the final destination.
@ Clear input data for next block.
MOV r4, #0
MOV r5, #0
STRD r4, [r1,#-8*16]!
STRD r4, [r1,#8]
STRD r4, [r1,#16]
STRD r4, [r1,#24]
STRD r4, [r1,#32]
STRD r4, [r1,#40]
STRD r4, [r1,#48]
STRD r4, [r1,#56]
STRD r4, [r1,#64]
STRD r4, [r1,#72]
STRD r4, [r1,#80]
STRD r4, [r1,#88]
STRD r4, [r1,#96]
STRD r4, [r1,#104]
STRD r4, [r1,#112]
STRD r4, [r1,#120]
MOV r1, r13 @ And read from temp storage.
@ Column transforms
BL idct8_8core_down_v6
BL idct8_8core_down_v6
BL idct8_8core_down_v6
BL idct8_8core_down_v6
ADD r13,r13,#64*2
LDMFD r13!,{r4-r11,PC}
.size oc_idct8x8_v6, .-oc_idct8x8_v6 @ ENDP
.type oc_idct8x8_10_v6, %function; oc_idct8x8_10_v6: @ PROC
STMFD r13!,{r4-r11,r14}
SUB r13,r13,#64*2+4
@ Row transforms
MOV r2, r13
STR r0, [r13,#-4]!
AND r0, r2, #4 @ Align the stack.
ADD r0, r0, r2 @ Write to temp storage.
BL idct4_3core_v6
BL idct2_1core_v6
LDR r0, [r13], #4 @ Write to the final destination.
@ Clear input data for next block.
MOV r4, #0
MOV r5, #0
STRD r4, [r1,#-4*16]!
STRD r4, [r1,#16]
STR r4, [r1,#32]
STR r4, [r1,#48]
AND r1, r13,#4 @ Align the stack.
ADD r1, r1, r13 @ And read from temp storage.
@ Column transforms
BL idct4_4core_down_v6
BL idct4_4core_down_v6
BL idct4_4core_down_v6
BL idct4_4core_down_v6
ADD r13,r13,#64*2+4
LDMFD r13!,{r4-r11,PC}
.size oc_idct8x8_10_v6, .-oc_idct8x8_10_v6 @ ENDP
.type oc_idct8x8_3_v6, %function; oc_idct8x8_3_v6: @ PROC
STMFD r13!,{r4-r8,r14}
SUB r13,r13,#64*2
@ Row transforms
MOV r8, r0
MOV r0, r13 @ Write to temp storage.
BL idct2_1core_v6
@ Clear input data for next block.
MOV r4, #0
STR r4, [r1,#-2*16]!
STR r4, [r1,#16]
MOV r1, r13 @ Read from temp storage.
MOV r0, r8 @ Write to the final destination.
@ Column transforms
BL idct2_2core_down_v6
BL idct2_2core_down_v6
BL idct2_2core_down_v6
BL idct2_2core_down_v6
ADD r13,r13,#64*2
LDMFD r13!,{r4-r8,PC}
.size oc_idct8x8_3_v6, .-oc_idct8x8_3_v6 @ ENDP
.type idct2_1core_v6, %function; idct2_1core_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDR r2, [r1], #16 @ r2 = <x[0,1]|x[0,0]>
LDR r3, OC_C4S4
LDRSH r6, [r1], #16 @ r6 = x[1,0]
SMULWB r12,r3, r2 @ r12= t[0,0]=OC_C4S4*x[0,0]>>16
LDRD r4, OC_C7S1 @ r4 = OC_C7S1; r5 = OC_C1S7
SMULWB r6, r3, r6 @ r6 = t[1,0]=OC_C4S4*x[1,0]>>16
SMULWT r4, r4, r2 @ r4 = t[0,4]=OC_C7S1*x[0,1]>>16
SMULWT r7, r5, r2 @ r7 = t[0,7]=OC_C1S7*x[0,1]>>16
@ Stage 2:
SMULWB r5, r3, r4 @ r5 = t[0,5]=OC_C4S4*t[0,4]>>16
PKHBT r12,r12,r6, LSL #16 @ r12= <t[1,0]|t[0,0]>
SMULWB r6, r3, r7 @ r6 = t[0,6]=OC_C4S4*t[0,7]>>16
PKHBT r7, r7, r3 @ r7 = <0|t[0,7]>
@ Stage 3:
PKHBT r5, r6, r5, LSL #16 @ r5 = <t[0,5]|t[0,6]>
PKHBT r4, r4, r3 @ r4 = <0|t[0,4]>
SADDSUBX r5, r5, r5 @ r5 = <t[0,6]+t[0,5]|t[0,6]-t[0,5]>
@ Stage 4:
PKHTB r6, r3, r5, ASR #16 @ r6 = <0|t[0,6]>
PKHBT r5, r5, r3 @ r5 = <0|t[0,5]>
SADD16 r3, r12,r7 @ r3 = t[0]+t[7]
STR r3, [r0], #4 @ y[0<<3] = t[0]+t[7]
SADD16 r3, r12,r6 @ r3 = t[0]+t[6]
STR r3, [r0, #12] @ y[1<<3] = t[0]+t[6]
SADD16 r3, r12,r5 @ r3 = t[0]+t[5]
STR r3, [r0, #28] @ y[2<<3] = t[0]+t[5]
SADD16 r3, r12,r4 @ r3 = t[0]+t[4]
STR r3, [r0, #44] @ y[3<<3] = t[0]+t[4]
SSUB16 r4, r12,r4 @ r4 = t[0]-t[4]
STR r4, [r0, #60] @ y[4<<3] = t[0]-t[4]
SSUB16 r5, r12,r5 @ r5 = t[0]-t[5]
STR r5, [r0, #76] @ y[5<<3] = t[0]-t[5]
SSUB16 r6, r12,r6 @ r6 = t[0]-t[6]
STR r6, [r0, #92] @ y[6<<3] = t[0]-t[6]
SSUB16 r7, r12,r7 @ r7 = t[0]-t[7]
STR r7, [r0, #108] @ y[7<<3] = t[0]-t[7]
MOV PC,r14
.size idct2_1core_v6, .-idct2_1core_v6 @ ENDP
.endif
.balign 8
OC_C7S1:
.word 12785 @ 31F1
OC_C1S7:
.word 64277 @ FB15
OC_C6S2:
.word 25080 @ 61F8
OC_C2S6:
.word 60547 @ EC83
OC_C5S3:
.word 36410 @ 8E3A
OC_C3S5:
.word 54491 @ D4DB
OC_C4S4:
.word 46341 @ B505
.if OC_ARM_ASM_MEDIA
.type idct2_2core_down_v6, %function; idct2_2core_down_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDR r2, [r1], #16 @ r2 = <x[0,1]|x[0,0]>
LDR r3, OC_C4S4
MOV r7 ,#8 @ r7 = 8
LDR r6, [r1], #16 @ r6 = <x[1,1]|x[1,0]>
SMLAWB r12,r3, r2, r7 @ r12= (t[0,0]=OC_C4S4*x[0,0]>>16)+8
LDRD r4, OC_C7S1 @ r4 = OC_C7S1; r5 = OC_C1S7
SMLAWB r7, r3, r6, r7 @ r7 = (t[1,0]=OC_C4S4*x[1,0]>>16)+8
SMULWT r5, r5, r2 @ r2 = t[0,7]=OC_C1S7*x[0,1]>>16
PKHBT r12,r12,r7, LSL #16 @ r12= <t[1,0]+8|t[0,0]+8>
SMULWT r4, r4, r2 @ r4 = t[0,4]=OC_C7S1*x[0,1]>>16
@ Here we cheat: row 1 had just a DC, so x[0,1]==x[1,1] by definition.
PKHBT r7, r5, r5, LSL #16 @ r7 = <t[0,7]|t[0,7]>
@ Stage 2:
SMULWB r6, r3, r7 @ r6 = t[0,6]=OC_C4S4*t[0,7]>>16
PKHBT r4, r4, r4, LSL #16 @ r4 = <t[0,4]|t[0,4]>
SMULWT r2, r3, r7 @ r2 = t[1,6]=OC_C4S4*t[1,7]>>16
SMULWB r5, r3, r4 @ r5 = t[0,5]=OC_C4S4*t[0,4]>>16
PKHBT r6, r6, r2, LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWT r2, r3, r4 @ r2 = t[1,5]=OC_C4S4*t[1,4]>>16
PKHBT r2, r5, r2, LSL #16 @ r2 = <t[1,5]|t[0,5]>
@ Stage 3:
SSUB16 r5, r6, r2 @ r5 = <t[1,6]-t[1,5]|t[0,6]-t[0,5]>
SADD16 r6, r6, r2 @ r6 = <t[1,6]+t[1,5]|t[0,6]+t[0,5]>
@ Stage 4:
SADD16 r2, r12,r7 @ r2 = t[0]+t[7]+8
MOV r3, r2, ASR #4
MOV r2, r2, LSL #16
PKHTB r3, r3, r2, ASR #20 @ r3 = t[0]+t[7]+8>>4
STR r3, [r0], #4 @ y[0<<3] = t[0]+t[7]+8>>4
SADD16 r2, r12,r6 @ r2 = t[0]+t[6]+8
MOV r3, r2, ASR #4
MOV r2, r2, LSL #16
PKHTB r3, r3, r2, ASR #20 @ r3 = t[0]+t[6]+8>>4
STR r3, [r0, #12] @ y[1<<3] = t[0]+t[6]+8>>4
SADD16 r2, r12,r5 @ r2 = t[0]+t[5]+8
MOV r3, r2, ASR #4
MOV r2, r2, LSL #16
PKHTB r3, r3, r2, ASR #20 @ r3 = t[0]+t[5]+8>>4
STR r3, [r0, #28] @ y[2<<3] = t[0]+t[5]+8>>4
SADD16 r2, r12,r4 @ r2 = t[0]+t[4]+8
MOV r3, r2, ASR #4
MOV r2, r2, LSL #16
PKHTB r3, r3, r2, ASR #20 @ r3 = t[0]+t[4]+8>>4
STR r3, [r0, #44] @ y[3<<3] = t[0]+t[4]+8>>4
SSUB16 r4, r12,r4 @ r4 = t[0]-t[4]+8
MOV r3, r4, ASR #4
MOV r4, r4, LSL #16
PKHTB r3, r3, r4, ASR #20 @ r3 = t[0]-t[4]+8>>4
STR r3, [r0, #60] @ y[4<<3] = t[0]-t[4]+8>>4
SSUB16 r5, r12,r5 @ r5 = t[0]-t[5]+8
MOV r3, r5, ASR #4
MOV r5, r5, LSL #16
PKHTB r3, r3, r5, ASR #20 @ r3 = t[0]-t[5]+8>>4
STR r3, [r0, #76] @ y[5<<3] = t[0]-t[5]+8>>4
SSUB16 r6, r12,r6 @ r6 = t[0]-t[6]+8
MOV r3, r6, ASR #4
MOV r6, r6, LSL #16
PKHTB r3, r3, r6, ASR #20 @ r3 = t[0]-t[6]+8>>4
STR r3, [r0, #92] @ y[6<<3] = t[0]-t[6]+8>>4
SSUB16 r7, r12,r7 @ r7 = t[0]-t[7]+8
MOV r3, r7, ASR #4
MOV r7, r7, LSL #16
PKHTB r3, r3, r7, ASR #20 @ r3 = t[0]-t[7]+8>>4
STR r3, [r0, #108] @ y[7<<3] = t[0]-t[7]+8>>4
MOV PC,r14
.size idct2_2core_down_v6, .-idct2_2core_down_v6 @ ENDP
@ In theory this should save ~75 cycles over oc_idct8x8_10, more than enough to
@ pay for increased branch mis-prediction to get here, but in practice it
@ doesn't seem to slow anything down to take it out, and it's less code this
@ way.
.if 0
.type oc_idct8x8_6_v6, %function; oc_idct8x8_6_v6: @ PROC
STMFD r13!,{r4-r8,r10,r11,r14}
SUB r13,r13,#64*2+4
@ Row transforms
MOV r8, r0
AND r0, r13,#4 @ Align the stack.
ADD r0, r0, r13 @ Write to temp storage.
BL idct3_2core_v6
BL idct1core_v6
@ Clear input data for next block.
MOV r4, #0
MOV r5, #0
STRD r4, [r1,#-3*16]!
STR r4, [r1,#16]
STR r4, [r1,#32]
AND r1, r13,#4 @ Align the stack.
MOV r0, r8 @ Write to the final destination.
ADD r1, r1, r13 @ And read from temp storage.
@ Column transforms
BL idct3_3core_down_v6
BL idct3_3core_down_v6
BL idct3_3core_down_v6
BL idct3_3core_down_v6
ADD r13,r13,#64*2+4
LDMFD r13!,{r4-r8,r10,r11,PC}
.size oc_idct8x8_6_v6, .-oc_idct8x8_6_v6 @ ENDP
.type idct1core_v6, %function; idct1core_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
LDRSH r3, [r1], #16
MOV r12,#0x05
ORR r12,r12,#0xB500
MUL r3, r12, r3
@ Stall ?
MOV r3, r3, ASR #16
@ Don't need to actually store the odd lines; they won't be read.
STRH r3, [r0], #2
STRH r3, [r0, #30]
STRH r3, [r0, #62]
STRH r3, [r0, #94]
MOV PC,R14
.size idct1core_v6, .-idct1core_v6 @ ENDP
.type idct3_2core_v6, %function; idct3_2core_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDRD r4, [r1], #16 @ r4 = <x[0,1]|x[0,0]>; r5 = <*|x[0,2]>
LDRD r10,OC_C6S2_3_v6 @ r10= OC_C6S2; r11= OC_C2S6
@ Stall
SMULWB r3, r11,r5 @ r3 = t[0,3]=OC_C2S6*x[0,2]>>16
LDR r11,OC_C4S4
SMULWB r2, r10,r5 @ r2 = t[0,2]=OC_C6S2*x[0,2]>>16
LDR r5, [r1], #16 @ r5 = <x[1,1]|x[1,0]>
SMULWB r12,r11,r4 @ r12= (t[0,0]=OC_C4S4*x[0,0]>>16)
LDRD r6, OC_C7S1_3_v6 @ r6 = OC_C7S1; r7 = OC_C1S7
SMULWB r10,r11,r5 @ r10= (t[1,0]=OC_C4S4*x[1,0]>>16)
PKHBT r12,r12,r10,LSL #16 @ r12= <t[1,0]|t[0,0]>
SMULWT r10,r7, r5 @ r10= t[1,7]=OC_C1S7*x[1,1]>>16
PKHBT r2, r2, r11 @ r2 = <0|t[0,2]>
SMULWT r7, r7, r4 @ r7 = t[0,7]=OC_C1S7*x[0,1]>>16
PKHBT r3, r3, r11 @ r3 = <0|t[0,3]>
SMULWT r5, r6, r5 @ r10= t[1,4]=OC_C7S1*x[1,1]>>16
PKHBT r7, r7, r10,LSL #16 @ r7 = <t[1,7]|t[0,7]>
SMULWT r4, r6, r4 @ r4 = t[0,4]=OC_C7S1*x[0,1]>>16
@ Stage 2:
SMULWB r6, r11,r7 @ r6 = t[0,6]=OC_C4S4*t[0,7]>>16
PKHBT r4, r4, r5, LSL #16 @ r4 = <t[1,4]|t[0,4]>
SMULWT r10,r11,r7 @ r10= t[1,6]=OC_C4S4*t[1,7]>>16
SMULWB r5, r11,r4 @ r5 = t[0,5]=OC_C4S4*t[0,4]>>16
PKHBT r6, r6, r10,LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWT r10,r11,r4 @ r10= t[1,5]=OC_C4S4*t[1,4]>>16
@ Stage 3:
B idct4_3core_stage3_v6
.size idct3_2core_v6, .-idct3_2core_v6 @ ENDP
@ Another copy so the LDRD offsets are less than +/- 255.
.balign 8
OC_C7S1_3_v6:
.word 12785 @ 31F1
OC_C1S7_3_v6:
.word 64277 @ FB15
OC_C6S2_3_v6:
.word 25080 @ 61F8
OC_C2S6_3_v6:
.word 60547 @ EC83
.type idct3_3core_down_v6, %function; idct3_3core_down_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDRD r10,[r1], #16 @ r10= <x[0,1]|x[0,0]>; r11= <??|x[0,2]>
LDRD r6, OC_C6S2_3_v6 @ r6 = OC_C6S2; r7 = OC_C2S6
LDR r4, [r1], #16 @ r4 = <x[1,1]|x[1,0]>
SMULWB r3, r7, r11 @ r3 = t[0,3]=OC_C2S6*x[0,2]>>16
MOV r7,#8
SMULWB r2, r6, r11 @ r2 = t[0,2]=OC_C6S2*x[0,2]>>16
LDR r11,OC_C4S4
SMLAWB r12,r11,r10,r7 @ r12= t[0,0]+8=(OC_C4S4*x[0,0]>>16)+8
@ Here we cheat: row 2 had just a DC, so x[0,2]==x[1,2] by definition.
PKHBT r3, r3, r3, LSL #16 @ r3 = <t[0,3]|t[0,3]>
SMLAWB r5, r11,r4, r7 @ r5 = t[1,0]+8=(OC_C4S4*x[1,0]>>16)+8
PKHBT r2, r2, r2, LSL #16 @ r2 = <t[0,2]|t[0,2]>
LDRD r6, OC_C7S1_3_v6 @ r6 = OC_C7S1; r7 = OC_C1S7
PKHBT r12,r12,r5, LSL #16 @ r12= <t[1,0]+8|t[0,0]+8>
SMULWT r5, r7, r4 @ r5 = t[1,7]=OC_C1S7*x[1,1]>>16
SMULWT r7, r7, r10 @ r7 = t[0,7]=OC_C1S7*x[0,1]>>16
SMULWT r10,r6, r10 @ r10= t[0,4]=OC_C7S1*x[0,1]>>16
PKHBT r7, r7, r5, LSL #16 @ r7 = <t[1,7]|t[0,7]>
SMULWT r4, r6, r4 @ r4 = t[1,4]=OC_C7S1*x[1,1]>>16
@ Stage 2:
SMULWB r6, r11,r7 @ r6 = t[0,6]=OC_C4S4*t[0,7]>>16
PKHBT r4, r10,r4, LSL #16 @ r4 = <t[1,4]|t[0,4]>
SMULWT r10,r11,r7 @ r10= t[1,6]=OC_C4S4*t[1,7]>>16
SMULWB r5, r11,r4 @ r5 = t[0,5]=OC_C4S4*t[0,4]>>16
PKHBT r6, r6, r10,LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWT r10,r11,r4 @ r10= t[1,5]=OC_C4S4*t[1,4]>>16
@ Stage 3:
B idct4_4core_down_stage3_v6
.size idct3_3core_down_v6, .-idct3_3core_down_v6 @ ENDP
.endif
.type idct4_3core_v6, %function; idct4_3core_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDRD r10,[r1], #16 @ r10= <x[0,1]|x[0,0]>; r11= <x[0,3]|x[0,2]>
LDRD r2, OC_C5S3_4_v6 @ r2 = OC_C5S3; r3 = OC_C3S5
LDRD r4, [r1], #16 @ r4 = <x[1,1]|x[1,0]>; r5 = <??|x[1,2]>
SMULWT r9, r3, r11 @ r9 = t[0,6]=OC_C3S5*x[0,3]>>16
SMULWT r8, r2, r11 @ r8 = -t[0,5]=OC_C5S3*x[0,3]>>16
PKHBT r9, r9, r2 @ r9 = <0|t[0,6]>
LDRD r6, OC_C6S2_4_v6 @ r6 = OC_C6S2; r7 = OC_C2S6
PKHBT r8, r8, r2 @ r9 = <0|-t[0,5]>
SMULWB r3, r7, r11 @ r3 = t[0,3]=OC_C2S6*x[0,2]>>16
SMULWB r2, r6, r11 @ r2 = t[0,2]=OC_C6S2*x[0,2]>>16
LDR r11,OC_C4S4
SMULWB r12,r7, r5 @ r12= t[1,3]=OC_C2S6*x[1,2]>>16
SMULWB r5, r6, r5 @ r5 = t[1,2]=OC_C6S2*x[1,2]>>16
PKHBT r3, r3, r12,LSL #16 @ r3 = <t[1,3]|t[0,3]>
SMULWB r12,r11,r10 @ r12= t[0,0]=OC_C4S4*x[0,0]>>16
PKHBT r2, r2, r5, LSL #16 @ r2 = <t[1,2]|t[0,2]>
SMULWB r5, r11,r4 @ r5 = t[1,0]=OC_C4S4*x[1,0]>>16
LDRD r6, OC_C7S1_4_v6 @ r6 = OC_C7S1; r7 = OC_C1S7
PKHBT r12,r12,r5, LSL #16 @ r12= <t[1,0]|t[0,0]>
SMULWT r5, r7, r4 @ r5 = t[1,7]=OC_C1S7*x[1,1]>>16
SMULWT r7, r7, r10 @ r7 = t[0,7]=OC_C1S7*x[0,1]>>16
SMULWT r10,r6, r10 @ r10= t[0,4]=OC_C7S1*x[0,1]>>16
PKHBT r7, r7, r5, LSL #16 @ r7 = <t[1,7]|t[0,7]>
SMULWT r4, r6, r4 @ r4 = t[1,4]=OC_C7S1*x[1,1]>>16
@ Stage 2:
SSUB16 r6, r7, r9 @ r6 = t[7]-t[6]
PKHBT r4, r10,r4, LSL #16 @ r4 = <t[1,4]|t[0,4]>
SADD16 r7, r7, r9 @ r7 = t[7]=t[7]+t[6]
SMULWT r9, r11,r6 @ r9 = t[1,6]=OC_C4S4*r6T>>16
SADD16 r5, r4, r8 @ r5 = t[4]-t[5]
SMULWB r6, r11,r6 @ r6 = t[0,6]=OC_C4S4*r6B>>16
SSUB16 r4, r4, r8 @ r4 = t[4]=t[4]+t[5]
SMULWT r10,r11,r5 @ r10= t[1,5]=OC_C4S4*r5T>>16
PKHBT r6, r6, r9, LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWB r5, r11,r5 @ r5 = t[0,5]=OC_C4S4*r5B>>16
@ Stage 3:
idct4_3core_stage3_v6:
SADD16 r11,r12,r2 @ r11= t[1]=t[0]+t[2]
PKHBT r10,r5, r10,LSL #16 @ r10= <t[1,5]|t[0,5]>
SSUB16 r2, r12,r2 @ r2 = t[2]=t[0]-t[2]
idct4_3core_stage3_5_v6:
SSUB16 r5, r6, r10 @ r5 = t[5]=t[6]-t[5]
SADD16 r6, r6, r10 @ r6 = t[6]=t[6]+t[5]
SADD16 r10,r12,r3 @ r10= t[0]=t[0]+t[3]
SSUB16 r3, r12,r3 @ r3 = t[3]=t[0]-t[3]
@ Stage 4:
SADD16 r12,r10,r7 @ r12= t[0]+t[7]
STR r12,[r0], #4 @ y[0<<3] = t[0]+t[7]
SADD16 r12,r11,r6 @ r12= t[1]+t[6]
STR r12,[r0, #12] @ y[1<<3] = t[1]+t[6]
SADD16 r12,r2, r5 @ r12= t[2]+t[5]
STR r12,[r0, #28] @ y[2<<3] = t[2]+t[5]
SADD16 r12,r3, r4 @ r12= t[3]+t[4]
STR r12,[r0, #44] @ y[3<<3] = t[3]+t[4]
SSUB16 r4, r3, r4 @ r4 = t[3]-t[4]
STR r4, [r0, #60] @ y[4<<3] = t[3]-t[4]
SSUB16 r5, r2, r5 @ r5 = t[2]-t[5]
STR r5, [r0, #76] @ y[5<<3] = t[2]-t[5]
SSUB16 r6, r11,r6 @ r6 = t[1]-t[6]
STR r6, [r0, #92] @ y[6<<3] = t[1]-t[6]
SSUB16 r7, r10,r7 @ r7 = t[0]-t[7]
STR r7, [r0, #108] @ y[7<<3] = t[0]-t[7]
MOV PC,r14
.size idct4_3core_v6, .-idct4_3core_v6 @ ENDP
@ Another copy so the LDRD offsets are less than +/- 255.
.balign 8
OC_C7S1_4_v6:
.word 12785 @ 31F1
OC_C1S7_4_v6:
.word 64277 @ FB15
OC_C6S2_4_v6:
.word 25080 @ 61F8
OC_C2S6_4_v6:
.word 60547 @ EC83
OC_C5S3_4_v6:
.word 36410 @ 8E3A
OC_C3S5_4_v6:
.word 54491 @ D4DB
.type idct4_4core_down_v6, %function; idct4_4core_down_v6: @ PROC
@ r0 = ogg_int16_t *_y (destination)
@ r1 = const ogg_int16_t *_x (source)
@ Stage 1:
LDRD r10,[r1], #16 @ r10= <x[0,1]|x[0,0]>; r11= <x[0,3]|x[0,2]>
LDRD r2, OC_C5S3_4_v6 @ r2 = OC_C5S3; r3 = OC_C3S5
LDRD r4, [r1], #16 @ r4 = <x[1,1]|x[1,0]>; r5 = <x[1,3]|x[1,2]>
SMULWT r9, r3, r11 @ r9 = t[0,6]=OC_C3S5*x[0,3]>>16
LDRD r6, OC_C6S2_4_v6 @ r6 = OC_C6S2; r7 = OC_C2S6
SMULWT r8, r2, r11 @ r8 = -t[0,5]=OC_C5S3*x[0,3]>>16
@ Here we cheat: row 3 had just a DC, so x[0,3]==x[1,3] by definition.
PKHBT r9, r9, r9, LSL #16 @ r9 = <t[0,6]|t[0,6]>
SMULWB r3, r7, r11 @ r3 = t[0,3]=OC_C2S6*x[0,2]>>16
PKHBT r8, r8, r8, LSL #16 @ r8 = <-t[0,5]|-t[0,5]>
SMULWB r2, r6, r11 @ r2 = t[0,2]=OC_C6S2*x[0,2]>>16
LDR r11,OC_C4S4
SMULWB r12,r7, r5 @ r12= t[1,3]=OC_C2S6*x[1,2]>>16
MOV r7,#8
SMULWB r5, r6, r5 @ r5 = t[1,2]=OC_C6S2*x[1,2]>>16
PKHBT r3, r3, r12,LSL #16 @ r3 = <t[1,3]|t[0,3]>
SMLAWB r12,r11,r10,r7 @ r12= t[0,0]+8=(OC_C4S4*x[0,0]>>16)+8
PKHBT r2, r2, r5, LSL #16 @ r2 = <t[1,2]|t[0,2]>
SMLAWB r5, r11,r4 ,r7 @ r5 = t[1,0]+8=(OC_C4S4*x[1,0]>>16)+8
LDRD r6, OC_C7S1_4_v6 @ r6 = OC_C7S1; r7 = OC_C1S7
PKHBT r12,r12,r5, LSL #16 @ r12= <t[1,0]+8|t[0,0]+8>
SMULWT r5, r7, r4 @ r5 = t[1,7]=OC_C1S7*x[1,1]>>16
SMULWT r7, r7, r10 @ r7 = t[0,7]=OC_C1S7*x[0,1]>>16
SMULWT r10,r6, r10 @ r10= t[0,4]=OC_C7S1*x[0,1]>>16
PKHBT r7, r7, r5, LSL #16 @ r7 = <t[1,7]|t[0,7]>
SMULWT r4, r6, r4 @ r4 = t[1,4]=OC_C7S1*x[1,1]>>16
@ Stage 2:
SSUB16 r6, r7, r9 @ r6 = t[7]-t[6]
PKHBT r4, r10,r4, LSL #16 @ r4 = <t[1,4]|t[0,4]>
SADD16 r7, r7, r9 @ r7 = t[7]=t[7]+t[6]
SMULWT r9, r11,r6 @ r9 = t[1,6]=OC_C4S4*r6T>>16
SADD16 r5, r4, r8 @ r5 = t[4]-t[5]
SMULWB r6, r11,r6 @ r6 = t[0,6]=OC_C4S4*r6B>>16
SSUB16 r4, r4, r8 @ r4 = t[4]=t[4]+t[5]
SMULWT r10,r11,r5 @ r10= t[1,5]=OC_C4S4*r5T>>16
PKHBT r6, r6, r9, LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWB r5, r11,r5 @ r5 = t[0,5]=OC_C4S4*r5B>>16
@ Stage 3:
idct4_4core_down_stage3_v6:
SADD16 r11,r12,r2 @ r11= t[1]+8=t[0]+t[2]+8
PKHBT r10,r5, r10,LSL #16 @ r10= <t[1,5]|t[0,5]>
SSUB16 r2, r12,r2 @ r2 = t[2]+8=t[0]-t[2]+8
B idct8_8core_down_stage3_5_v6
.size idct4_4core_down_v6, .-idct4_4core_down_v6 @ ENDP
.type idct8_8core_v6, %function; idct8_8core_v6: @ PROC
STMFD r13!,{r0,r14}
@ Stage 1:
@5-6 rotation by 3pi/16
LDRD r10,OC_C5S3_4_v6 @ r10= OC_C5S3, r11= OC_C3S5
LDR r4, [r1,#8] @ r4 = <x[0,5]|x[0,4]>
LDR r7, [r1,#24] @ r7 = <x[1,5]|x[1,4]>
SMULWT r5, r11,r4 @ r5 = OC_C3S5*x[0,5]>>16
LDR r0, [r1,#4] @ r0 = <x[0,3]|x[0,2]>
SMULWT r3, r11,r7 @ r3 = OC_C3S5*x[1,5]>>16
LDR r12,[r1,#20] @ r12= <x[1,3]|x[1,2]>
SMULWT r6, r11,r0 @ r6 = OC_C3S5*x[0,3]>>16
SMULWT r11,r11,r12 @ r11= OC_C3S5*x[1,3]>>16
SMLAWT r6, r10,r4, r6 @ r6 = t[0,6]=r6+(OC_C5S3*x[0,5]>>16)
PKHBT r5, r5, r3, LSL #16 @ r5 = <r3|r5>
SMLAWT r11,r10,r7, r11 @ r11= t[1,6]=r11+(OC_C5S3*x[1,5]>>16)
PKHBT r4, r4, r7, LSL #16 @ r4 = <x[1,4]|x[0,4]>
SMULWT r3, r10,r0 @ r3 = OC_C5S3*x[0,3]>>16
PKHBT r6, r6, r11,LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWT r8, r10,r12 @ r8 = OC_C5S3*x[1,3]>>16
@2-3 rotation by 6pi/16
LDRD r10,OC_C6S2_4_v6 @ r10= OC_C6S2, r11= OC_C2S6
PKHBT r3, r3, r8, LSL #16 @ r3 = <r8|r3>
LDR r8, [r1,#12] @ r8 = <x[0,7]|x[0,6]>
SMULWB r2, r10,r0 @ r2 = OC_C6S2*x[0,2]>>16
SSUB16 r5, r5, r3 @ r5 = <t[1,5]|t[0,5]>
SMULWB r9, r10,r12 @ r9 = OC_C6S2*x[1,2]>>16
LDR r7, [r1,#28] @ r7 = <x[1,7]|x[1,6]>
SMULWB r3, r10,r8 @ r3 = OC_C6S2*x[0,6]>>16
SMULWB r10,r10,r7 @ r10= OC_C6S2*x[1,6]>>16
PKHBT r2, r2, r9, LSL #16 @ r2 = <r2|r9>
SMLAWB r3, r11,r0, r3 @ r3 = t[0,3]=r3+(OC_C2S6*x[0,2]>>16)
SMLAWB r10,r11,r12,r10 @ r10= t[1,3]=r10+(OC_C2S6*x[1,2]>>16)
SMULWB r9, r11,r8 @ r9 = OC_C2S6*x[0,6]>>16
PKHBT r3, r3, r10,LSL #16 @ r3 = <t[1,6]|t[0,6]>
SMULWB r12,r11,r7 @ r12= OC_C2S6*x[1,6]>>16
@4-7 rotation by 7pi/16
LDRD r10,OC_C7S1_8_v6 @ r10= OC_C7S1, r11= OC_C1S7
PKHBT r9, r9, r12,LSL #16 @ r9 = <r9|r12>
LDR r0, [r1],#16 @ r0 = <x[0,1]|x[0,0]>
PKHTB r7, r7, r8, ASR #16 @ r7 = <x[1,7]|x[0,7]>
SSUB16 r2, r2, r9 @ r2 = <t[1,2]|t[0,2]>
SMULWB r9, r10,r7 @ r9 = OC_C7S1*x[0,7]>>16
LDR r14,[r1],#16 @ r14= <x[1,1]|x[1,0]>
SMULWT r12,r10,r7 @ r12= OC_C7S1*x[1,7]>>16
SMULWT r8, r10,r0 @ r8 = OC_C7S1*x[0,1]>>16
SMULWT r10,r10,r14 @ r10= OC_C7S1*x[1,1]>>16
SMLAWT r9, r11,r0, r9 @ r9 = t[0,7]=r9+(OC_C1S7*x[0,1]>>16)
PKHBT r8, r8, r10,LSL #16 @ r8 = <r12|r8>
SMLAWT r12,r11,r14,r12 @ r12= t[1,7]=r12+(OC_C1S7*x[1,1]>>16)
PKHBT r0, r0, r14,LSL #16 @ r0 = <x[1,0]|x[0,0]>
SMULWB r10,r11,r7 @ r10= OC_C1S7*x[0,6]>>16
PKHBT r9, r9, r12,LSL #16 @ r9 = <t[1,7]|t[0,7]>
SMULWT r12,r11,r7 @ r12= OC_C1S7*x[1,6]>>16
@0-1 butterfly
LDR r11,OC_C4S4
PKHBT r10,r10,r12,LSL #16 @ r10= <r12|r10>
SADD16 r7, r0, r4 @ r7 = x[0]+x[4]
SSUB16 r10,r8, r10 @ r10= <t[1,4]|t[0,4]>
SSUB16 r4, r0, r4 @ r4 = x[0]-x[4]
SMULWB r8, r11,r7 @ r8 = t[0,0]=OC_C4S4*r7B>>16
SMULWT r12,r11,r7 @ r12= t[1,0]=OC_C4S4*r7T>>16
SMULWB r7, r11,r4 @ r7 = t[0,1]=OC_C4S4*r4B>>16
PKHBT r12,r8, r12,LSL #16 @ r12= <t[1,0]|t[0,0]>
SMULWT r8, r11,r4 @ r8 = t[1,1]=OC_C4S4*r4T>>16
@ Stage 2:
SADD16 r4, r10,r5 @ r4 = t[4]=t[4]+t[5]
PKHBT r8, r7, r8, LSL #16 @ r8 = <t[1,0]|t[0,0]>
SSUB16 r5, r10,r5 @ r5 = t[4]-t[5]
SMULWB r10,r11,r5 @ r10= t[0,5]=OC_C4S4*r5B>>16
SADD16 r7, r9, r6 @ r7 = t[7]=t[7]+t[6]
SMULWT r5, r11,r5 @ r5 = t[1,5]=OC_C4S4*r5T>>16
SSUB16 r6, r9, r6 @ r6 = t[7]-t[6]
SMULWB r9, r11,r6 @ r9 = t[0,6]=OC_C4S4*r6B>>16
PKHBT r10,r10,r5, LSL #16 @ r10= <t[1,5]|t[0,5]>
SMULWT r6, r11,r6 @ r6 = t[1,6]=OC_C4S4*r6T>>16
@ Stage 3:
SADD16 r11,r8, r2 @ r11= t[1]=t[1]+t[2]
PKHBT r6, r9, r6, LSL #16 @ r6 = <t[1,6]|t[0,6]>
SSUB16 r2, r8, r2 @ r2 = t[2]=t[1]-t[2]
LDMFD r13!,{r0,r14}
B idct4_3core_stage3_5_v6
.size idct8_8core_v6, .-idct8_8core_v6 @ ENDP
@ Another copy so the LDRD offsets are less than +/- 255.
.balign 8
OC_C7S1_8_v6:
.word 12785 @ 31F1
OC_C1S7_8_v6:
.word 64277 @ FB15
OC_C6S2_8_v6:
.word 25080 @ 61F8
OC_C2S6_8_v6:
.word 60547 @ EC83
OC_C5S3_8_v6:
.word 36410 @ 8E3A
OC_C3S5_8_v6:
.word 54491 @ D4DB
.type idct8_8core_down_v6, %function; idct8_8core_down_v6: @ PROC
STMFD r13!,{r0,r14}
@ Stage 1:
@5-6 rotation by 3pi/16
LDRD r10,OC_C5S3_8_v6 @ r10= OC_C5S3, r11= OC_C3S5
LDR r4, [r1,#8] @ r4 = <x[0,5]|x[0,4]>
LDR r7, [r1,#24] @ r7 = <x[1,5]|x[1,4]>
SMULWT r5, r11,r4 @ r5 = OC_C3S5*x[0,5]>>16
LDR r0, [r1,#4] @ r0 = <x[0,3]|x[0,2]>
SMULWT r3, r11,r7 @ r3 = OC_C3S5*x[1,5]>>16
LDR r12,[r1,#20] @ r12= <x[1,3]|x[1,2]>
SMULWT r6, r11,r0 @ r6 = OC_C3S5*x[0,3]>>16
SMULWT r11,r11,r12 @ r11= OC_C3S5*x[1,3]>>16
SMLAWT r6, r10,r4, r6 @ r6 = t[0,6]=r6+(OC_C5S3*x[0,5]>>16)
PKHBT r5, r5, r3, LSL #16 @ r5 = <r3|r5>
SMLAWT r11,r10,r7, r11 @ r11= t[1,6]=r11+(OC_C5S3*x[1,5]>>16)
PKHBT r4, r4, r7, LSL #16 @ r4 = <x[1,4]|x[0,4]>
SMULWT r3, r10,r0 @ r3 = OC_C5S3*x[0,3]>>16
PKHBT r6, r6, r11,LSL #16 @ r6 = <t[1,6]|t[0,6]>
SMULWT r8, r10,r12 @ r8 = OC_C5S3*x[1,3]>>16
@2-3 rotation by 6pi/16
LDRD r10,OC_C6S2_8_v6 @ r10= OC_C6S2, r11= OC_C2S6
PKHBT r3, r3, r8, LSL #16 @ r3 = <r8|r3>
LDR r8, [r1,#12] @ r8 = <x[0,7]|x[0,6]>
SMULWB r2, r10,r0 @ r2 = OC_C6S2*x[0,2]>>16
SSUB16 r5, r5, r3 @ r5 = <t[1,5]|t[0,5]>
SMULWB r9, r10,r12 @ r9 = OC_C6S2*x[1,2]>>16
LDR r7, [r1,#28] @ r7 = <x[1,7]|x[1,6]>
SMULWB r3, r10,r8 @ r3 = OC_C6S2*x[0,6]>>16
SMULWB r10,r10,r7 @ r10= OC_C6S2*x[1,6]>>16
PKHBT r2, r2, r9, LSL #16 @ r2 = <r2|r9>
SMLAWB r3, r11,r0, r3 @ r3 = t[0,3]=r3+(OC_C2S6*x[0,2]>>16)
SMLAWB r10,r11,r12,r10 @ r10= t[1,3]=r10+(OC_C2S6*x[1,2]>>16)
SMULWB r9, r11,r8 @ r9 = OC_C2S6*x[0,6]>>16
PKHBT r3, r3, r10,LSL #16 @ r3 = <t[1,6]|t[0,6]>
SMULWB r12,r11,r7 @ r12= OC_C2S6*x[1,6]>>16
@4-7 rotation by 7pi/16
LDRD r10,OC_C7S1_8_v6 @ r10= OC_C7S1, r11= OC_C1S7
PKHBT r9, r9, r12,LSL #16 @ r9 = <r9|r12>
LDR r0, [r1],#16 @ r0 = <x[0,1]|x[0,0]>
PKHTB r7, r7, r8, ASR #16 @ r7 = <x[1,7]|x[0,7]>
SSUB16 r2, r2, r9 @ r2 = <t[1,2]|t[0,2]>
SMULWB r9, r10,r7 @ r9 = OC_C7S1*x[0,7]>>16
LDR r14,[r1],#16 @ r14= <x[1,1]|x[1,0]>
SMULWT r12,r10,r7 @ r12= OC_C7S1*x[1,7]>>16
SMULWT r8, r10,r0 @ r8 = OC_C7S1*x[0,1]>>16
SMULWT r10,r10,r14 @ r10= OC_C7S1*x[1,1]>>16
SMLAWT r9, r11,r0, r9 @ r9 = t[0,7]=r9+(OC_C1S7*x[0,1]>>16)
PKHBT r8, r8, r10,LSL #16 @ r8 = <r12|r8>
SMLAWT r12,r11,r14,r12 @ r12= t[1,7]=r12+(OC_C1S7*x[1,1]>>16)
PKHBT r0, r0, r14,LSL #16 @ r0 = <x[1,0]|x[0,0]>
SMULWB r10,r11,r7 @ r10= OC_C1S7*x[0,6]>>16
PKHBT r9, r9, r12,LSL #16 @ r9 = <t[1,7]|t[0,7]>
SMULWT r12,r11,r7 @ r12= OC_C1S7*x[1,6]>>16
@0-1 butterfly
LDR r11,OC_C4S4
MOV r14,#8
PKHBT r10,r10,r12,LSL #16 @ r10= <r12|r10>
SADD16 r7, r0, r4 @ r7 = x[0]+x[4]
SSUB16 r10,r8, r10 @ r10= <t[1,4]|t[0,4]>
SMLAWB r8, r11,r7, r14 @ r8 = t[0,0]+8=(OC_C4S4*r7B>>16)+8
SSUB16 r4, r0, r4 @ r4 = x[0]-x[4]
SMLAWT r12,r11,r7, r14 @ r12= t[1,0]+8=(OC_C4S4*r7T>>16)+8
SMLAWB r7, r11,r4, r14 @ r7 = t[0,1]+8=(OC_C4S4*r4B>>16)+8
PKHBT r12,r8, r12,LSL #16 @ r12= <t[1,0]+8|t[0,0]+8>
SMLAWT r8, r11,r4, r14 @ r8 = t[1,1]+8=(OC_C4S4*r4T>>16)+8
@ Stage 2:
SADD16 r4, r10,r5 @ r4 = t[4]=t[4]+t[5]
PKHBT r8, r7, r8, LSL #16 @ r8 = <t[1,0]+8|t[0,0]+8>
SSUB16 r5, r10,r5 @ r5 = t[4]-t[5]
SMULWB r10,r11,r5 @ r10= t[0,5]=OC_C4S4*r5B>>16
SADD16 r7, r9, r6 @ r7 = t[7]=t[7]+t[6]
SMULWT r5, r11,r5 @ r5 = t[1,5]=OC_C4S4*r5T>>16
SSUB16 r6, r9, r6 @ r6 = t[7]-t[6]
SMULWB r9, r11,r6 @ r9 = t[0,6]=OC_C4S4*r6B>>16
PKHBT r10,r10,r5, LSL #16 @ r10= <t[1,5]|t[0,5]>
SMULWT r6, r11,r6 @ r6 = t[1,6]=OC_C4S4*r6T>>16
@ Stage 3:
SADD16 r11,r8, r2 @ r11= t[1]+8=t[1]+t[2]+8
PKHBT r6, r9, r6, LSL #16 @ r6 = <t[1,6]|t[0,6]>
SSUB16 r2, r8, r2 @ r2 = t[2]+8=t[1]-t[2]+8
LDMFD r13!,{r0,r14}
idct8_8core_down_stage3_5_v6:
SSUB16 r5, r6, r10 @ r5 = t[5]=t[6]-t[5]
SADD16 r6, r6, r10 @ r6 = t[6]=t[6]+t[5]
SADD16 r10,r12,r3 @ r10= t[0]+8=t[0]+t[3]+8
SSUB16 r3, r12,r3 @ r3 = t[3]+8=t[0]-t[3]+8
@ Stage 4:
SADD16 r12,r10,r7 @ r12= t[0]+t[7]+8
SSUB16 r7, r10,r7 @ r7 = t[0]-t[7]+8
MOV r10,r12,ASR #4
MOV r12,r12,LSL #16
PKHTB r10,r10,r12,ASR #20 @ r10= t[0]+t[7]+8>>4
STR r10,[r0], #4 @ y[0<<3] = t[0]+t[7]+8>>4
SADD16 r12,r11,r6 @ r12= t[1]+t[6]+8
SSUB16 r6, r11,r6 @ r6 = t[1]-t[6]+8
MOV r10,r12,ASR #4
MOV r12,r12,LSL #16
PKHTB r10,r10,r12,ASR #20 @ r10= t[1]+t[6]+8>>4
STR r10,[r0, #12] @ y[1<<3] = t[1]+t[6]+8>>4
SADD16 r12,r2, r5 @ r12= t[2]+t[5]+8
SSUB16 r5, r2, r5 @ r5 = t[2]-t[5]+8
MOV r10,r12,ASR #4
MOV r12,r12,LSL #16
PKHTB r10,r10,r12,ASR #20 @ r10= t[2]+t[5]+8>>4
STR r10,[r0, #28] @ y[2<<3] = t[2]+t[5]+8>>4
SADD16 r12,r3, r4 @ r12= t[3]+t[4]+8
SSUB16 r4, r3, r4 @ r4 = t[3]-t[4]+8
MOV r10,r12,ASR #4
MOV r12,r12,LSL #16
PKHTB r10,r10,r12,ASR #20 @ r10= t[3]+t[4]+8>>4
STR r10,[r0, #44] @ y[3<<3] = t[3]+t[4]+8>>4
MOV r10,r4, ASR #4
MOV r4, r4, LSL #16
PKHTB r10,r10,r4, ASR #20 @ r10= t[3]-t[4]+8>>4
STR r10,[r0, #60] @ y[4<<3] = t[3]-t[4]+8>>4
MOV r10,r5, ASR #4
MOV r5, r5, LSL #16
PKHTB r10,r10,r5, ASR #20 @ r10= t[2]-t[5]+8>>4
STR r10,[r0, #76] @ y[5<<3] = t[2]-t[5]+8>>4
MOV r10,r6, ASR #4
MOV r6, r6, LSL #16
PKHTB r10,r10,r6, ASR #20 @ r10= t[1]-t[6]+8>>4
STR r10,[r0, #92] @ y[6<<3] = t[1]-t[6]+8>>4
MOV r10,r7, ASR #4
MOV r7, r7, LSL #16
PKHTB r10,r10,r7, ASR #20 @ r10= t[0]-t[7]+8>>4
STR r10,[r0, #108] @ y[7<<3] = t[0]-t[7]+8>>4
MOV PC,r14
.size idct8_8core_down_v6, .-idct8_8core_down_v6 @ ENDP
.endif
.if OC_ARM_ASM_NEON
.global oc_idct8x8_1_neon
.global oc_idct8x8_neon
.balign 16
OC_IDCT_CONSTS_NEON:
.short 8
.short 64277 @ FB15 (C1S7)
.short 60547 @ EC83 (C2S6)
.short 54491 @ D4DB (C3S5)
.short 46341 @ B505 (C4S4)
.short 36410 @ 471D (C5S3)
.short 25080 @ 30FC (C6S2)
.short 12785 @ 31F1 (C7S1)
.type oc_idct8x8_1_neon, %function; oc_idct8x8_1_neon: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_uint16_t _dc
VDUP.S16 Q0, r1
VMOV Q1, Q0
VST1.64 {D0, D1, D2, D3}, [r0,:128]!
VST1.64 {D0, D1, D2, D3}, [r0,:128]!
VST1.64 {D0, D1, D2, D3}, [r0,:128]!
VST1.64 {D0, D1, D2, D3}, [r0,:128]
MOV PC, r14
.size oc_idct8x8_1_neon, .-oc_idct8x8_1_neon @ ENDP
.type oc_idct8x8_neon, %function; oc_idct8x8_neon: @ PROC
@ r0 = ogg_int16_t *_y
@ r1 = ogg_int16_t *_x
@ r2 = int _last_zzi
CMP r2, #10
BLE oc_idct8x8_10_neon
oc_idct8x8_slow_neon:
VPUSH {D8-D15}
MOV r2, r1
ADR r3, OC_IDCT_CONSTS_NEON
@ Row transforms (input is pre-transposed)
VLD1.64 {D16,D17,D18,D19}, [r2,:128]!
VLD1.64 {D20,D21,D22,D23}, [r2,:128]!
VLD1.64 {D24,D25,D26,D27}, [r2,:128]!
VSUB.S16 Q1, Q8, Q12 @ Q8 = x[0]-x[4]
VLD1.64 {D28,D29,D30,D31}, [r2,:128]
VADD.S16 Q8, Q8, Q12 @ Q1 = x[0]+x[4]
VLD1.64 {D0,D1}, [r3,:128]
MOV r12, r14
BL oc_idct8x8_stage123_neon
@ Stage 4
VSUB.S16 Q15,Q8, Q7 @ Q15 = y[7]=t[0]-t[7]
VADD.S16 Q8, Q8, Q7 @ Q8 = y[0]=t[0]+t[7]
VSUB.S16 Q14,Q9, Q3 @ Q14 = y[6]=t[1]-t[6]
VADD.S16 Q9, Q9, Q3 @ Q9 = y[1]=t[1]+t[6]
VSUB.S16 Q13,Q10,Q5 @ Q13 = y[5]=t[2]-t[5]
VADD.S16 Q10,Q10,Q5 @ Q10 = y[2]=t[2]+t[5]
VTRN.16 Q14,Q15
VSUB.S16 Q12,Q11,Q4 @ Q12 = y[4]=t[3]-t[4]
VADD.S16 Q11,Q11,Q4 @ Q11 = y[3]=t[3]+t[4]
@ 8x8 Transpose
VTRN.16 Q8, Q9
VTRN.16 Q10,Q11
VTRN.16 Q12,Q13
VTRN.32 Q8, Q10
VTRN.32 Q9, Q11
VTRN.32 Q12,Q14
VTRN.32 Q13,Q15
VSWP D17,D24
VSUB.S16 Q1, Q8, Q12 @ Q8 = x[0]-x[4]
VSWP D19,D26
VADD.S16 Q8, Q8, Q12 @ Q1 = x[0]+x[4]
VSWP D21,D28
VSWP D23,D30
@ Column transforms
BL oc_idct8x8_stage123_neon
@ We have to put the return address back in the LR, or the branch
@ predictor will not recognize the function return and mis-predict the
@ entire call stack.
MOV r14, r12
@ Stage 4
VSUB.S16 Q15,Q8, Q7 @ Q15 = y[7]=t[0]-t[7]
VADD.S16 Q8, Q8, Q7 @ Q8 = y[0]=t[0]+t[7]
VSUB.S16 Q14,Q9, Q3 @ Q14 = y[6]=t[1]-t[6]
VADD.S16 Q9, Q9, Q3 @ Q9 = y[1]=t[1]+t[6]
VSUB.S16 Q13,Q10,Q5 @ Q13 = y[5]=t[2]-t[5]
VADD.S16 Q10,Q10,Q5 @ Q10 = y[2]=t[2]+t[5]
VSUB.S16 Q12,Q11,Q4 @ Q12 = y[4]=t[3]-t[4]
VADD.S16 Q11,Q11,Q4 @ Q11 = y[3]=t[3]+t[4]
VMOV.I8 Q2,#0
VPOP {D8-D15}
VMOV.I8 Q3,#0
VRSHR.S16 Q8, Q8, #4 @ Q8 = y[0]+8>>4
VST1.64 {D4, D5, D6, D7}, [r1,:128]!
VRSHR.S16 Q9, Q9, #4 @ Q9 = y[1]+8>>4
VRSHR.S16 Q10,Q10,#4 @ Q10 = y[2]+8>>4
VST1.64 {D4, D5, D6, D7}, [r1,:128]!
VRSHR.S16 Q11,Q11,#4 @ Q11 = y[3]+8>>4
VRSHR.S16 Q12,Q12,#4 @ Q12 = y[4]+8>>4
VST1.64 {D4, D5, D6, D7}, [r1,:128]!
VRSHR.S16 Q13,Q13,#4 @ Q13 = y[5]+8>>4
VRSHR.S16 Q14,Q14,#4 @ Q14 = y[6]+8>>4
VST1.64 {D4, D5, D6, D7}, [r1,:128]
VRSHR.S16 Q15,Q15,#4 @ Q15 = y[7]+8>>4
VSTMIA r0, {D16-D31}
MOV PC, r14
.size oc_idct8x8_neon, .-oc_idct8x8_neon @ ENDP
.type oc_idct8x8_stage123_neon, %function; oc_idct8x8_stage123_neon: @ PROC
@ Stages 1 & 2
VMULL.S16 Q4, D18,D1[3]
VMULL.S16 Q5, D19,D1[3]
VMULL.S16 Q7, D30,D1[3]
VMULL.S16 Q6, D31,D1[3]
VMULL.S16 Q2, D30,D0[1]
VMULL.S16 Q3, D31,D0[1]
VSHRN.S32 D8, Q4, #16
VSHRN.S32 D9, Q5, #16 @ Q4 = (OC_C7S1*x[1]>>16)
VSHRN.S32 D14,Q7, #16
VSHRN.S32 D15,Q6, #16 @ Q7 = (OC_C7S1*x[7]>>16)
VSHRN.S32 D4, Q2, #16
VSHRN.S32 D5, Q3, #16 @ Q2 = (OC_C1S7*x[7]>>16)-x[7]
VSUB.S16 Q4, Q4, Q15
VADD.S16 Q7, Q7, Q9
VSUB.S16 Q4, Q4, Q2 @ Q4 = t[4]
VMULL.S16 Q2, D18,D0[1]
VMULL.S16 Q9, D19,D0[1]
VMULL.S16 Q5, D26,D0[3]
VMULL.S16 Q3, D27,D0[3]
VMULL.S16 Q6, D22,D0[3]
VMULL.S16 Q12,D23,D0[3]
VSHRN.S32 D4, Q2, #16
VSHRN.S32 D5, Q9, #16 @ Q2 = (OC_C1S7*x[1]>>16)-x[1]
VSHRN.S32 D10,Q5, #16
VSHRN.S32 D11,Q3, #16 @ Q5 = (OC_C3S5*x[5]>>16)-x[5]
VSHRN.S32 D12,Q6, #16
VSHRN.S32 D13,Q12,#16 @ Q6 = (OC_C3S5*x[3]>>16)-x[3]
VADD.S16 Q7, Q7, Q2 @ Q7 = t[7]
VSUB.S16 Q5, Q5, Q11
VADD.S16 Q6, Q6, Q11
VADD.S16 Q5, Q5, Q13
VADD.S16 Q6, Q6, Q13
VMULL.S16 Q9, D22,D1[1]
VMULL.S16 Q11,D23,D1[1]
VMULL.S16 Q15,D26,D1[1]
VMULL.S16 Q13,D27,D1[1]
VMULL.S16 Q2, D20,D1[2]
VMULL.S16 Q12,D21,D1[2]
VSHRN.S32 D18,Q9, #16
VSHRN.S32 D19,Q11,#16 @ Q9 = (OC_C5S3*x[3]>>16)-x[3]
VSHRN.S32 D30,Q15,#16
VSHRN.S32 D31,Q13,#16 @ Q15= (OC_C5S3*x[5]>>16)-x[5]
VSHRN.S32 D4, Q2, #16
VSHRN.S32 D5, Q12,#16 @ Q2 = (OC_C6S2*x[2]>>16)
VSUB.S16 Q5, Q5, Q9 @ Q5 = t[5]
VADD.S16 Q6, Q6, Q15 @ Q6 = t[6]
VSUB.S16 Q2, Q2, Q14
VMULL.S16 Q3, D28,D1[2]
VMULL.S16 Q11,D29,D1[2]
VMULL.S16 Q12,D28,D0[2]
VMULL.S16 Q9, D29,D0[2]
VMULL.S16 Q13,D20,D0[2]
VMULL.S16 Q15,D21,D0[2]
VSHRN.S32 D6, Q3, #16
VSHRN.S32 D7, Q11,#16 @ Q3 = (OC_C6S2*x[6]>>16)
VSHRN.S32 D24,Q12,#16
VSHRN.S32 D25,Q9, #16 @ Q12= (OC_C2S6*x[6]>>16)-x[6]
VSHRN.S32 D26,Q13,#16
VSHRN.S32 D27,Q15,#16 @ Q13= (OC_C2S6*x[2]>>16)-x[2]
VSUB.S16 Q9, Q4, Q5 @ Q9 = t[4]-t[5]
VSUB.S16 Q11,Q7, Q6 @ Q11= t[7]-t[6]
VADD.S16 Q3, Q3, Q10
VADD.S16 Q4, Q4, Q5 @ Q4 = t[4]=t[4]+t[5]
VADD.S16 Q7, Q7, Q6 @ Q7 = t[7]=t[7]+t[6]
VSUB.S16 Q2, Q2, Q12 @ Q2 = t[2]
VADD.S16 Q3, Q3, Q13 @ Q3 = t[3]
VMULL.S16 Q12,D16,D1[0]
VMULL.S16 Q13,D17,D1[0]
VMULL.S16 Q14,D2, D1[0]
VMULL.S16 Q15,D3, D1[0]
VMULL.S16 Q5, D18,D1[0]
VMULL.S16 Q6, D22,D1[0]
VSHRN.S32 D24,Q12,#16
VSHRN.S32 D25,Q13,#16
VSHRN.S32 D28,Q14,#16
VSHRN.S32 D29,Q15,#16
VMULL.S16 Q13,D19,D1[0]
VMULL.S16 Q15,D23,D1[0]
VADD.S16 Q8, Q8, Q12 @ Q8 = t[0]
VADD.S16 Q1, Q1, Q14 @ Q1 = t[1]
VSHRN.S32 D10,Q5, #16
VSHRN.S32 D12,Q6, #16
VSHRN.S32 D11,Q13,#16
VSHRN.S32 D13,Q15,#16
VADD.S16 Q5, Q5, Q9 @ Q5 = t[5]=OC_C4S4*(t[4]-t[5])>>16
VADD.S16 Q6, Q6, Q11 @ Q6 = t[6]=OC_C4S4*(t[7]-t[6])>>16
@ Stage 3
VSUB.S16 Q11,Q8, Q3 @ Q11 = t[3]=t[0]-t[3]
VADD.S16 Q8, Q8, Q3 @ Q8 = t[0]=t[0]+t[3]
VADD.S16 Q9, Q1, Q2 @ Q9 = t[1]=t[1]+t[2]
VADD.S16 Q3, Q6, Q5 @ Q3 = t[6]=t[6]+t[5]
VSUB.S16 Q10,Q1, Q2 @ Q10 = t[2]=t[1]-t[2]
VSUB.S16 Q5, Q6, Q5 @ Q5 = t[5]=t[6]-t[5]
MOV PC, r14
.size oc_idct8x8_stage123_neon, .-oc_idct8x8_stage123_neon @ ENDP
.type oc_idct8x8_10_neon, %function; oc_idct8x8_10_neon: @ PROC
ADR r3, OC_IDCT_CONSTS_NEON
VLD1.64 {D0,D1}, [r3,:128]
MOV r2, r1
@ Row transforms (input is pre-transposed)
@ Stage 1
VLD1.64 {D16,D17,D18,D19},[r2,:128]!
MOV r12, #16
VMULL.S16 Q15,D16,D1[0] @ Q15= OC_C4S4*x[0]-(x[0]<<16)
VLD1.64 {D17}, [r2,:64], r12
VMULL.S16 Q2, D18,D0[1] @ Q2 = OC_C1S7*x[1]-(x[1]<<16)
VLD1.64 {D19}, [r2,:64]
VMULL.S16 Q14,D17,D0[2] @ Q14= OC_C2S6*x[2]-(x[2]<<16)
VMULL.S16 Q3, D19,D0[3] @ Q3 = OC_C3S5*x[3]-(x[3]<<16)
VMULL.S16 Q13,D19,D1[1] @ Q13= OC_C5S3*x[3]-(x[3]<<16)
VMULL.S16 Q12,D18,D1[3] @ Q12= OC_C7S1*x[1]
VMULL.S16 Q1, D17,D1[2] @ Q1 = OC_C6S2*x[2]
VSHRN.S32 D30,Q15,#16 @ D30= t[0]-x[0]
VSHRN.S32 D4, Q2, #16 @ D4 = t[7]-x[1]
VSHRN.S32 D31,Q14,#16 @ D31= t[3]-x[2]
VSHRN.S32 D6, Q3, #16 @ D6 = t[6]-x[3]
VSHRN.S32 D7, Q13,#16 @ D7 = -t[5]-x[3]
VSHRN.S32 D5, Q12,#16 @ D5 = t[4]
VSHRN.S32 D2, Q1, #16 @ D2 = t[2]
VADD.S16 D4, D4, D18 @ D4 = t[7]
VADD.S16 D6, D6, D19 @ D6 = t[6]
VADD.S16 D7, D7, D19 @ D7 = -t[5]
VADD.S16 Q15,Q15,Q8 @ D30= t[0]
@ D31= t[3]
@ Stages 2 & 3
VSUB.S16 Q12,Q2, Q3 @ D24= t[7]-t[6]
@ D25= t[4]'=t[4]+t[5]
VADD.S16 Q13,Q2, Q3 @ D26= t[7]=t[7]+t[6]
@ D27= t[4]-t[5]
VMULL.S16 Q11,D24,D1[0] @ Q11= OC_C4S4*(t[7]-t[6])
@ -(t[7]-t[6]<<16)
VMULL.S16 Q14,D27,D1[0] @ Q14= OC_C4S4*(t[4]-t[5])
@ -(t[4]-t[5]<<16)
VADD.S16 D16,D30,D31 @ D16= t[0]=t[0]+t[3]
VSUB.S16 D17,D30,D2 @ D17= t[2]=t[0]-t[2]
VADD.S16 D18,D30,D2 @ D18= t[1]=t[0]+t[2]
VSHRN.S32 D22,Q11,#16 @ D22= (OC_C4S4*(t[7]-t[6])>>16)
@ -(t[7]-t[6])
VSHRN.S32 D23,Q14,#16 @ D23= (OC_C4S4*(t[4]-t[5])>>16)
@ -(t[4]-t[5])
VSUB.S16 D19,D30,D31 @ D19= t[3]=t[0]-t[3]
VADD.S16 D22,D22,D24 @ D22= t[6]=OC_C4S4*(t[7]-t[6])>>16
VADD.S16 D23,D23,D27 @ D23= t[5]=OC_C4S4*(t[4]-t[5])>>16
VSUB.S16 D27,D22,D23 @ D27= t[5]=t[6]-t[5]
VADD.S16 D24,D22,D23 @ D24= t[6]=t[6]+t[5]
@ Stage 4
VSUB.S16 Q11,Q8, Q13 @ D22= y[7]=t[0]-t[7]
@ D23= y[5]=t[2]'-t[5]''
VSUB.S16 Q10,Q9, Q12 @ D20= y[6]=t[1]-t[6]
@ D21= y[4]=t[3]'-t[4]''
VADD.S16 Q8, Q8, Q13 @ D16= y[0]=t[0]+t[7]
@ D17= y[2]=t[2]'+t[5]''
VADD.S16 Q9, Q9, Q12 @ D18= y[1]=t[1]-t[6]
@ D19= y[3]=t[3]'-t[4]''
@ 8x4 transpose
VTRN.16 Q10,Q11 @ Q10= c5c4a5a4 c7c6a7a6
@ Q11= d5d4b5b4 d7d6b7b6
VTRN.16 Q8, Q9 @ Q8 = c3c2a3a2 c1c0a1a0
@ Q9 = d3d2b3b2 d1d0b1b0
VSWP D20,D21 @ Q10= c7c6a7a6 c5c4a5a4
VSWP D22,D23 @ Q11= d7d6b7b6 d5d4b5b4
VUZP.32 Q9, Q11 @ Q9 = b7b6b5b4 b3b2b1b0
@ Q11= d7d6d5d4 d3d2d1d0
VMULL.S16 Q15,D18,D0[1]
VMULL.S16 Q13,D22,D1[1]
VUZP.32 Q8, Q10 @ Q8 = a7a6a5a4 a3a2a1a0
@ Q10= c7c6c5c4 c3c2c1c0
@ Column transforms
@ Stages 1, 2, & 3
VMULL.S16 Q14,D19,D0[1] @ Q14:Q15= OC_C1S7*x[1]-(x[1]<<16)
VMULL.S16 Q12,D23,D1[1] @ Q12:Q13= OC_C5S3*x[3]-(x[3]<<16)
VMULL.S16 Q3, D22,D0[3]
VMULL.S16 Q2, D23,D0[3] @ Q2:Q3 = OC_C3S5*x[3]-(x[3]<<16)
VSHRN.S32 D30,Q15,#16
VSHRN.S32 D31,Q14,#16 @ Q15= (OC_C1S7*x[1]>>16)-x[1]
VSHRN.S32 D26,Q13,#16
VSHRN.S32 D27,Q12,#16 @ Q13= (OC_C5S3*x[3]>>16)-x[3]
VSHRN.S32 D28,Q3, #16
VSHRN.S32 D29,Q2, #16 @ Q14= (OC_C3S5*x[3]>>16)-x[3]
VADD.S16 Q15,Q15,Q9 @ Q15= t[7]
VADD.S16 Q13,Q13,Q11 @ Q13= -t[5]
VADD.S16 Q14,Q14,Q11 @ Q14= t[6]
VMULL.S16 Q12,D18,D1[3]
VMULL.S16 Q2, D19,D1[3] @ Q2:Q12= OC_C7S1*x[1]
VMULL.S16 Q1, D16,D1[0]
VMULL.S16 Q11,D17,D1[0] @ Q11:Q1 = OC_C4S4*x[0]-(x[0]<<16)
VMULL.S16 Q3, D20,D0[2]
VMULL.S16 Q9, D21,D0[2] @ Q9:Q3 = OC_C2S6*x[2]-(x[2]<<16)
VSHRN.S32 D24,Q12,#16
VSHRN.S32 D25,Q2, #16 @ Q12= t[4]
VMULL.S16 Q2, D20,D1[2]
VSHRN.S32 D2, Q1, #16
VSHRN.S32 D3, Q11,#16 @ Q1 = (OC_C4S4*x[0]>>16)-x[0]
VMULL.S16 Q11,D21,D1[2] @ Q2:Q11= OC_C6S2*x[2]
VSHRN.S32 D6, Q3, #16
VSHRN.S32 D7, Q9, #16 @ Q3 = (OC_C2S6*x[2]>>16)-x[2]
VSUB.S16 Q9, Q15,Q14 @ Q9 = t[7]-t[6]
VADD.S16 Q15,Q15,Q14 @ Q15= t[7]=t[7]+t[6]
VSHRN.S32 D4, Q2, #16
VSHRN.S32 D5, Q11,#16 @ Q2 = t[2]
VADD.S16 Q1, Q1, Q8 @ Q1 = t[0]
VADD.S16 Q8, Q12,Q13 @ Q8 = t[4]-t[5]
VADD.S16 Q3, Q3, Q10 @ Q3 = t[3]
VMULL.S16 Q10,D16,D1[0]
VMULL.S16 Q11,D17,D1[0] @ Q11:Q10= OC_C4S4*(t[4]-t[5])
@ -(t[4]-t[5]<<16)
VSUB.S16 Q12,Q12,Q13 @ Q12= t[4]=t[4]+t[5]
VMULL.S16 Q14,D18,D1[0]
VMULL.S16 Q13,D19,D1[0] @ Q13:Q14= OC_C4S4*(t[6]-t[7])
@ -(t[6]-t[7]<<16)
VSHRN.S32 D20,Q10,#16
VSHRN.S32 D21,Q11,#16 @ Q10= (OC_C4S4*(t[4]-t[5])>>16)
@ -(t[4]-t[5])
VADD.S16 Q11,Q1, Q3 @ Q11= t[0]=t[0]+t[3]
VSUB.S16 Q3, Q1, Q3 @ Q3 = t[3]=t[0]-t[3]
VSHRN.S32 D28,Q14,#16
VSHRN.S32 D29,Q13,#16 @ Q14= (OC_C4S4*(t[7]-t[6])>>16)
@ -(t[7]-t[6])
VADD.S16 Q10,Q10,Q8 @ Q10=t[5]
VADD.S16 Q14,Q14,Q9 @ Q14=t[6]
VSUB.S16 Q13,Q14,Q10 @ Q13=t[5]=t[6]-t[5]
VADD.S16 Q14,Q14,Q10 @ Q14=t[6]=t[6]+t[5]
VADD.S16 Q10,Q1, Q2 @ Q10= t[1]=t[0]+t[2]
VSUB.S16 Q2, Q1, Q2 @ Q2 = t[2]=t[0]-t[2]
@ Stage 4
VADD.S16 Q8, Q11,Q15 @ Q8 = y[0]=t[0]+t[7]
VADD.S16 Q9, Q10,Q14 @ Q9 = y[1]=t[1]+t[6]
VSUB.S16 Q15,Q11,Q15 @ Q15 = y[7]=t[0]-t[7]
VSUB.S16 Q14,Q10,Q14 @ Q14 = y[6]=t[1]-t[6]
VADD.S16 Q10,Q2, Q13 @ Q10 = y[2]=t[2]+t[5]
VADD.S16 Q11,Q3, Q12 @ Q11 = y[3]=t[3]+t[4]
VSUB.S16 Q12,Q3, Q12 @ Q12 = y[4]=t[3]-t[4]
VSUB.S16 Q13,Q2, Q13 @ Q13 = y[5]=t[2]-t[5]
VMOV.I8 D2, #0
VRSHR.S16 Q8, Q8, #4 @ Q8 = y[0]+8>>4
VST1.64 {D2}, [r1,:64], r12
VRSHR.S16 Q9, Q9, #4 @ Q9 = y[1]+8>>4
VRSHR.S16 Q10,Q10,#4 @ Q10 = y[2]+8>>4
VST1.64 {D2}, [r1,:64], r12
VRSHR.S16 Q11,Q11,#4 @ Q11 = y[3]+8>>4
VRSHR.S16 Q12,Q12,#4 @ Q12 = y[4]+8>>4
VST1.64 {D2}, [r1,:64], r12
VRSHR.S16 Q13,Q13,#4 @ Q13 = y[5]+8>>4
VRSHR.S16 Q14,Q14,#4 @ Q14 = y[6]+8>>4
VST1.64 {D2}, [r1,:64]
VRSHR.S16 Q15,Q15,#4 @ Q15 = y[7]+8>>4
VSTMIA r0, {D16-D31}
MOV PC, r14
.size oc_idct8x8_10_neon, .-oc_idct8x8_10_neon @ ENDP
.endif
@ END
.section .note.GNU-stack,"",%progbits
|
programs/oeis/133/A133125.asm | karttu/loda | 1 | 11639 | ; A133125: A133080 * A000244.
; 1,4,9,36,81,324,729,2916,6561,26244,59049,236196,531441,2125764,4782969,19131876,43046721,172186884,387420489,1549681956,3486784401,13947137604,31381059609,125524238436,282429536481,1129718145924,2541865828329,10167463313316
mov $1,$0
mod $1,2
add $1,3
mul $1,7
mov $2,3
pow $2,$0
mul $2,7
mul $1,$2
sub $1,147
div $1,147
add $1,1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/e/eb4012a.ada | best08618/asylo | 7 | 7436 | -- EB4012A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT WHEN AN UNHANDLED EXCEPTION IS RAISED IN THE MAIN
-- PROGRAM, THE MAIN PROGRAM IS ABANDONED.
-- PASS/FAIL CRITERIA:
-- THIS TEST MUST EXECUTE AND PRINT "TENTATIVELY PASSED". IN
-- ADDITION, THE OUTPUT/LOG FILE MUST SHOW THAT THE PROGRAM
-- WAS ABANDONED DUE TO AN UNHANDLED EXCEPTION.
-- HISTORY:
-- DHH 03/29/88 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE EB4012A IS
BEGIN
TEST("EB4012A", "CHECK THAT WHEN AN UNHANDLED EXCEPTION IS " &
"RAISED IN THE MAIN PROGRAM, THE MAIN PROGRAM " &
"IS ABANDONED");
SPECIAL_ACTION("CHECK THE OUTPUT/LOG FILE TO SEE THAT THIS " &
"PROGRAM WAS ABANDONED BECAUSE OF AN UNHANDLED " &
"EXCEPTION");
RESULT;
IF EQUAL(3,3) THEN
RAISE CONSTRAINT_ERROR;
END IF;
TEST("EB4012A", "SHOULD NOT PRINT OUT");
FAILED("CONSTRAINT_ERROR NOT RAISED");
RESULT;
END EB4012A;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_309_1247.asm | ljhsiun2/medusa | 9 | 14519 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xeac6, %r13
nop
nop
nop
nop
sub %rax, %rax
mov $0x6162636465666768, %rbp
movq %rbp, (%r13)
nop
nop
nop
nop
nop
mfence
lea addresses_normal_ht+0x17ac6, %r15
nop
xor $11912, %rbp
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
movups %xmm5, (%r15)
inc %rbp
lea addresses_A_ht+0x12daa, %rsi
lea addresses_normal_ht+0x154c6, %rdi
nop
nop
xor $2763, %r13
mov $21, %rcx
rep movsb
dec %r8
lea addresses_D_ht+0x7bbe, %rsi
nop
nop
cmp %rbp, %rbp
mov (%rsi), %rdi
nop
nop
nop
nop
inc %rax
lea addresses_UC_ht+0x76c6, %rsi
lea addresses_UC_ht+0x19fc6, %rdi
nop
nop
cmp $1570, %r8
mov $65, %rcx
rep movsl
nop
nop
nop
xor %r15, %r15
lea addresses_D_ht+0x8ac6, %r15
nop
nop
nop
inc %rsi
vmovups (%r15), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rax
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0xc5e6, %rax
nop
inc %rsi
movl $0x61626364, (%rax)
nop
nop
add $15300, %r13
lea addresses_UC_ht+0x11016, %rsi
nop
nop
nop
nop
nop
add $6393, %rax
movb (%rsi), %r15b
nop
nop
sub $50946, %rcx
lea addresses_UC_ht+0x2aeb, %r8
nop
xor %r13, %r13
movb $0x61, (%r8)
nop
nop
nop
nop
nop
and $38697, %r8
lea addresses_UC_ht+0x1e3fc, %r8
nop
nop
and $15973, %rbp
movb $0x61, (%r8)
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x1cdd6, %rsi
lea addresses_D_ht+0x15446, %rdi
nop
nop
nop
nop
nop
xor $14015, %r13
mov $0, %rcx
rep movsl
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x18c6, %rsi
lea addresses_WC_ht+0x4bec, %rdi
nop
nop
cmp %r8, %r8
mov $51, %rcx
rep movsl
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0x19068, %rsi
nop
nop
nop
nop
and $5892, %rax
mov $0x6162636465666768, %r13
movq %r13, %xmm6
and $0xffffffffffffffc0, %rsi
vmovaps %ymm6, (%rsi)
sub $40112, %rbp
lea addresses_normal_ht+0x34c6, %rbp
nop
nop
nop
nop
nop
dec %r13
movups (%rbp), %xmm7
vpextrq $1, %xmm7, %r15
nop
cmp $37494, %rbp
lea addresses_D_ht+0xb1c6, %rdi
nop
nop
nop
nop
add %r13, %r13
movw $0x6162, (%rdi)
nop
inc %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_D+0x11ac6, %r12
nop
nop
nop
nop
and %rbx, %rbx
mov $0x5152535455565758, %r13
movq %r13, %xmm0
vmovups %ymm0, (%r12)
nop
nop
nop
sub %rbx, %rbx
// Store
lea addresses_A+0x14c6, %rbx
nop
nop
nop
nop
nop
cmp %rdx, %rdx
movb $0x51, (%rbx)
nop
nop
nop
nop
cmp %r15, %r15
// Store
lea addresses_WC+0x70c6, %r8
clflush (%r8)
nop
nop
and $11408, %r15
movl $0x51525354, (%r8)
nop
nop
nop
nop
sub $7322, %rbx
// Store
lea addresses_UC+0x7b46, %rdx
and $56962, %r13
movb $0x51, (%rdx)
nop
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_D+0x99ba, %rcx
nop
nop
nop
inc %rdx
mov $0x5152535455565758, %r15
movq %r15, (%rcx)
nop
dec %r8
// REPMOV
lea addresses_D+0x15e6, %rsi
mov $0xb86, %rdi
add $43258, %rbx
mov $68, %rcx
rep movsw
nop
sub $26437, %r15
// Store
mov $0x89e, %rdx
xor $7672, %r12
movb $0x51, (%rdx)
nop
nop
nop
cmp $64236, %r12
// Store
lea addresses_RW+0x190c6, %r12
nop
nop
nop
nop
cmp %r8, %r8
movw $0x5152, (%r12)
nop
nop
nop
cmp %rdi, %rdi
// Faulty Load
mov $0x55157800000002c6, %rbx
nop
nop
nop
nop
add $58811, %r13
mov (%rbx), %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_P', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'00': 309}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_802.asm | ljhsiun2/medusa | 9 | 104515 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x13663, %rsi
lea addresses_A_ht+0x8251, %rdi
clflush (%rsi)
nop
nop
add $1111, %r12
mov $52, %rcx
rep movsl
dec %rdi
lea addresses_WC_ht+0x108a3, %rsi
lea addresses_normal_ht+0x90a3, %rdi
nop
add $1596, %r14
mov $35, %rcx
rep movsw
nop
and %r12, %r12
lea addresses_UC_ht+0x1a263, %r11
nop
nop
nop
sub $49378, %r8
mov $0x6162636465666768, %r14
movq %r14, %xmm5
vmovups %ymm5, (%r11)
nop
nop
xor %r14, %r14
lea addresses_WT_ht+0x1e63, %r14
nop
nop
nop
sub $44350, %r12
movb $0x61, (%r14)
nop
nop
nop
add %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %r8
push %r9
push %rcx
// Load
lea addresses_PSE+0xf363, %r10
nop
nop
dec %r8
mov (%r10), %r9
nop
nop
nop
add %r9, %r9
// Load
lea addresses_WC+0x13063, %r11
nop
and %r14, %r14
mov (%r11), %r8w
nop
nop
nop
cmp %r9, %r9
// Store
lea addresses_US+0xf863, %rcx
cmp %r15, %r15
movl $0x51525354, (%rcx)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r14
nop
nop
nop
nop
and $3747, %r14
// Store
lea addresses_normal+0x7b63, %r14
nop
nop
nop
nop
nop
and $51968, %rcx
mov $0x5152535455565758, %r10
movq %r10, %xmm7
movups %xmm7, (%r14)
nop
nop
and %rcx, %rcx
// Store
mov $0x16240f0000000563, %r14
nop
nop
nop
cmp $47039, %r10
mov $0x5152535455565758, %rcx
movq %rcx, (%r14)
nop
and %r14, %r14
// Faulty Load
lea addresses_normal+0xee63, %r10
clflush (%r10)
nop
add %r15, %r15
movb (%r10), %r14b
lea oracles, %r8
and $0xff, %r14
shlq $12, %r14
mov (%r8,%r14,1), %r14
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
patch/ASM/Monster_Book_00066.asm | secondsabre/Tales-of-Destiny-DC | 96 | 245550 | <reponame>secondsabre/Tales-of-Destiny-DC
.ps2
.open "../DAT_FILES_ORIGINAL/00066.md1", "../DAT_FILES_PATCHED/00066.md1", 0x003C7A80
; Monster Book
; these correspond to some float values
; sorry too tired to figure out what math its doing and what is what
; but you can take these and add/subtract a little bit by bit
; to find something that fits nice/better?
.org 0x003CB078
lui at, 0x42AA ; move "Level" text right a bit
.org 0x003CB020
lui at, 0x4288 ; "Name" end width?
.org 0x003CAFE0
lui at, 0x429A ; "Level" highlight start position
.org 0x003CB010
lui at, 0x428A ; "Level" highlight width?
.org 0x003d2060
.asciiz "Level"
.org 0x003cc1e8 ; Monster Sort Table
.byte 0x63, 0xAF, 0xEB, 0xC9, 0x44, 0xD5, 0x8E, 0xF7, 0xCE, 0x6C
.byte 0xA5, 0xE1, 0x5F, 0x0E, 0x2E, 0xA8, 0x0B, 0x77, 0x32, 0x3F
.byte 0x67, 0x8C, 0x19, 0x34, 0x20, 0x4D, 0xD4, 0xEA, 0x85, 0x24
.byte 0xBE, 0x57, 0x68, 0x9A, 0xE2, 0xE7, 0x69, 0x61, 0x60, 0x13
.byte 0x62, 0x96, 0x06, 0x53, 0x7B, 0x1D, 0xC8, 0x70, 0x45, 0x99
.byte 0xB7, 0xBD, 0x28, 0xC3, 0x1F, 0x0D, 0x40, 0xBB, 0x95, 0xA3
.byte 0xF1, 0xE6, 0x2C, 0xF0, 0x72, 0x9B, 0x6E, 0xCF, 0xF8, 0x5E
.byte 0xF4, 0x59, 0xAA, 0x49, 0x54, 0xC2, 0x97, 0x73, 0x84, 0x4C
.byte 0x4A, 0x50, 0xAE, 0xCA, 0x78, 0xD2, 0xCD, 0xA4, 0xC1, 0xA0
.byte 0x7E, 0x8A, 0xBC, 0x87, 0xAB, 0x6B, 0xAD, 0x4F, 0x51, 0xF6
.byte 0x80, 0x7F, 0x81, 0x82, 0x90, 0x29, 0x7D, 0x1B, 0x0A, 0x56
.byte 0xB6, 0x98, 0x79, 0x42, 0xA2, 0xDD, 0x65, 0x64, 0x5A, 0xBA
.byte 0x11, 0xD6, 0xB8, 0xEE, 0xE5, 0xB2, 0x46, 0x0F, 0x07, 0x9E
.byte 0x93, 0x94, 0x08, 0x55, 0x58, 0xDF, 0x31, 0x04, 0x8B, 0x83
.byte 0x09, 0x6F, 0xF2, 0xE8, 0x9D, 0x30, 0x86, 0xE3, 0x05, 0xDE
.byte 0x12, 0x35, 0x75, 0x3B, 0x89, 0x26, 0x92, 0xD7, 0x3E, 0xAC
.byte 0x7A, 0x27, 0xCC, 0x48, 0x6A, 0x33, 0x22, 0x4E, 0x02, 0x66
.byte 0xA6, 0xEF, 0x16, 0xBF, 0x14, 0xEC, 0x41, 0xCB, 0xDC, 0xD0
.byte 0x8F, 0x8D, 0x5D, 0xB1, 0xDB, 0x10, 0xA1, 0x25, 0x7C, 0xC4
.byte 0xC6, 0xC7, 0xC5, 0xA9, 0x1E, 0xD8, 0xDA, 0xF3, 0x91, 0xB3
.byte 0x15, 0xA7, 0x38, 0x01, 0x00, 0x03, 0xED, 0x74, 0x2F, 0x3A
.byte 0x18, 0x2D, 0x1C, 0xF5, 0x23, 0x4B, 0x2A, 0xE4, 0xD3, 0x3D
.byte 0x36, 0xC0, 0x71, 0x47, 0x76, 0x52, 0x0C, 0xD1, 0xB4, 0x5B
.byte 0x9C, 0xD9, 0xE0, 0x9F, 0xB0, 0x3C, 0xB5, 0x17, 0x88, 0x43
.byte 0x5C, 0xB9, 0xE9, 0x1A, 0x6D, 0x21, 0x2B, 0x37, 0x39
.close |
source/units/program-units-bodies.ads | reznikmm/gela | 0 | 2830 | <filename>source/units/program-units-bodies.ads<gh_stars>0
-- SPDX-FileCopyrightText: 2019-2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
-- Trivial implementation of library bodies
with Program.Library_Unit_Bodies;
with Program.Library_Unit_Declarations;
with Program.Compilation_Unit_Vectors;
with Program.Units.Vectors;
package Program.Units.Bodies is
pragma Preelaborate;
type Unit_Body is new Unit
and Program.Library_Unit_Bodies.Library_Unit_Body with private;
procedure Initialize
(Self : in out Unit_Body;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access);
procedure Append_Subunit
(Self : in out Unit_Body;
Value : Program.Compilation_Units.Compilation_Unit_Access);
private
type Unit_Body is new Unit
and Program.Library_Unit_Bodies.Library_Unit_Body with
record
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Subunits : aliased Program.Units.Vectors.Unit_Vector;
end record;
overriding function Parent (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access;
overriding function Corresponding_Declaration (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access;
overriding function Subunits (Self : access Unit_Body)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access;
overriding function Is_Library_Unit_Body_Unit
(Self : Unit_Body) return Boolean;
end Program.Units.Bodies;
|
ex/testadd2.asm | jtzeng/herontitan | 1 | 418 | ; a = 2, b = 3, a += a, a += b, b++, c = b, c--
START:
LDC 2,RA
LDC 3,RB
ADD RA,RA
ADD RB,RA
NOP
INC RB
MOV RB,RC
DEC RC
JMP END
SKIPPED:
CLR RA
INC R0
LDC 7,R1
JMP SKIPPED
END:
NOP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.