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
libsrc/gfx/common/div3_192.asm
ahjelm/z88dk
640
93244
; Divide by three lookup table (192 entries) ; ; $Id: div3_192.asm $ ; SECTION rodata_graphics PUBLIC div3_192 .div3_192 ; 00 15 31 defb 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10 defb 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21 defb 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31 defb 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42 defb 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53 defb 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63
core/lib/types/Join.agda
cmknapp/HoTT-Agda
0
6936
{-# OPTIONS --without-K #-} open import lib.Basics open import lib.types.Paths open import lib.types.Sigma open import lib.types.Span open import lib.types.Pointed open import lib.types.Pushout module lib.types.Join where module _ {i j} (A : Type i) (B : Type j) where *-span : Span *-span = span A B (A × B) fst snd infix 80 _*_ _*_ : Type _ _*_ = Pushout *-span module JoinElim {i j} {A : Type i} {B : Type j} {k} {P : A * B → Type k} (left* : (a : A) → P (left a)) (right* : (b : B) → P (right b)) (glue* : (ab : A × B) → left* (fst ab) == right* (snd ab) [ P ↓ glue ab ]) = PushoutElim left* right* glue* open JoinElim public using () renaming (f to Join-elim) module JoinRec {i j} {A : Type i} {B : Type j} {k} {D : Type k} (left* : (a : A) → D) (right* : (b : B) → D) (glue* : (ab : A × B) → left* (fst ab) == right* (snd ab)) = PushoutRec left* right* glue* open JoinRec public using () renaming (f to Join-rec) module _ {i j} (X : Ptd i) (Y : Ptd j) where *-⊙span : ⊙Span *-⊙span = ⊙span X Y (X ⊙× Y) ⊙fst ⊙snd infix 80 _⊙*_ _⊙*_ : Ptd _ _⊙*_ = ⊙Pushout *-⊙span module _ {i i' j j'} {A : Type i} {A' : Type i'} {B : Type j} {B' : Type j'} where equiv-* : A ≃ A' → B ≃ B' → A * B ≃ A' * B' equiv-* eqA eqB = equiv to from to-from from-to where module To = JoinRec {D = A' * B'} (left ∘ –> eqA) (right ∘ –> eqB) (λ{(a , b) → glue (–> eqA a , –> eqB b)}) module From = JoinRec {D = A * B} (left ∘ <– eqA) (right ∘ <– eqB) (λ{(a , b) → glue (<– eqA a , <– eqB b)}) to : A * B → A' * B' to = To.f from : A' * B' → A * B from = From.f to-from : ∀ y → to (from y) == y to-from = Join-elim (ap left ∘ <–-inv-r eqA) (ap right ∘ <–-inv-r eqB) to-from-glue where to-from-glue : ∀ (ab : A' × B') → ap left (<–-inv-r eqA (fst ab)) == ap right (<–-inv-r eqB (snd ab)) [ (λ y → to (from y) == y) ↓ glue ab ] to-from-glue (a , b) = ↓-app=idf-in $ ap left (<–-inv-r eqA a) ∙' glue (a , b) =⟨ htpy-natural'-app=cst (λ a → glue (a , b)) (<–-inv-r eqA a) ⟩ glue (–> eqA (<– eqA a) , b) =⟨ ! $ htpy-natural-cst=app (λ b → glue (–> eqA (<– eqA a) , b)) (<–-inv-r eqB b) ⟩ glue (–> eqA (<– eqA a) , –> eqB (<– eqB b)) ∙ ap right (<–-inv-r eqB b) =⟨ ! $ To.glue-β (<– eqA a , <– eqB b) |in-ctx (_∙ ap right (<–-inv-r eqB b)) ⟩ ap to (glue (<– eqA a , <– eqB b)) ∙ ap right (<–-inv-r eqB b) =⟨ ! $ From.glue-β (a , b) |in-ctx (λ p → ap to p ∙ ap right (<–-inv-r eqB b)) ⟩ ap to (ap from (glue (a , b))) ∙ ap right (<–-inv-r eqB b) =⟨ ! $ ap-∘ to from (glue (a , b)) |in-ctx (_∙ ap right (<–-inv-r eqB b)) ⟩ ap (to ∘ from) (glue (a , b)) ∙ ap right (<–-inv-r eqB b) ∎ from-to : ∀ x → from (to x) == x from-to = Join-elim (ap left ∘ <–-inv-l eqA) (ap right ∘ <–-inv-l eqB) from-to-glue where from-to-glue : ∀ (ab : A × B) → ap left (<–-inv-l eqA (fst ab)) == ap right (<–-inv-l eqB (snd ab)) [ (λ x → from (to x) == x) ↓ glue ab ] from-to-glue (a , b) = ↓-app=idf-in $ ap left (<–-inv-l eqA a) ∙' glue (a , b) =⟨ htpy-natural'-app=cst (λ a → glue (a , b)) (<–-inv-l eqA a) ⟩ glue (<– eqA (–> eqA a) , b) =⟨ ! $ htpy-natural-cst=app (λ b → glue (<– eqA (–> eqA a) , b)) (<–-inv-l eqB b) ⟩ glue (<– eqA (–> eqA a) , <– eqB (–> eqB b)) ∙ ap right (<–-inv-l eqB b) =⟨ ! $ From.glue-β (–> eqA a , –> eqB b) |in-ctx (_∙ ap right (<–-inv-l eqB b)) ⟩ ap from (glue (–> eqA a , –> eqB b)) ∙ ap right (<–-inv-l eqB b) =⟨ ! $ To.glue-β (a , b) |in-ctx (λ p → ap from p ∙ ap right (<–-inv-l eqB b)) ⟩ ap from (ap to (glue (a , b))) ∙ ap right (<–-inv-l eqB b) =⟨ ! $ ap-∘ from to (glue (a , b)) |in-ctx (_∙ ap right (<–-inv-l eqB b)) ⟩ ap (from ∘ to) (glue (a , b)) ∙ ap right (<–-inv-l eqB b) ∎ module _ {i i' j j'} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'} where ⊙equiv-⊙* : X ⊙≃ X' → Y ⊙≃ Y' → X ⊙* Y ⊙≃ X' ⊙* Y' ⊙equiv-⊙* ⊙eqX ⊙eqY = ⊙≃-in (equiv-* (fst (⊙≃-out ⊙eqX)) (fst (⊙≃-out ⊙eqY))) (ap left (snd (⊙≃-out ⊙eqX)))
programs/oeis/329/A329279.asm
karttu/loda
1
164218
; A329279: Number of distinct tilings of a 2n X 2n square with 1 x n polyominoes. ; 1,9,11,19,22,33,37,51,56,73,79,99,106,129,137,163,172,201,211,243,254,289,301,339,352,393,407,451,466,513,529,579,596,649,667,723,742,801,821,883,904,969,991,1059,1082,1153,1177,1251,1276,1353,1379,1459,1486,1569,1597,1683,1712,1801,1831 mov $2,$0 add $2,6 add $2,$0 add $0,$2 cmp $0,$2 mov $1,$2 div $1,4 sub $1,$0 mul $2,8 mul $1,$2 div $1,16 add $1,1
docs/asm_examples/large_mergesort.asm
schorrm/arm2riscv
8
1012
.file "large_mergesort.c" .section .tdata REG_BANK: .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 .text .align 2 .global merge .type merge, %function merge: # stp x29, x30, [sp, -128]! sd x8, -128(sp) sd ra, -120(sp) addi sp, sp, -128 # writeback # add x29, sp, 0 addi x8, sp, 0 # str x19, [sp, 16] sd x18, 16(sp) # str x0, [x29, 56] sd x10, 56(x8) # str w1, [x29, 52] sw x11, 52(x8) # str w2, [x29, 48] sw x12, 48(x8) # str w3, [x29, 44] sw x13, 44(x8) # adrp x0, :got:__stack_chk_guard lui x10, %hi(__stack_chk_guard) # ldr x0, [x0, #:got_lo12:__stack_chk_guard] add x10, x10, %lo(__stack_chk_guard) # load from GOT -> ADD! # ldr x1, [x0] ld x11, 0(x10) # str x1, [x29, 120] sd x11, 120(x8) # mov x1,0 li x11, 0 # mov x0, sp mv x10, sp # mov x3, x0 mv x13, x10 # ldr w1, [x29, 48] lw x11, 48(x8) # ldr w0, [x29, 52] lw x10, 52(x8) # sub w0, w1, w0 subw x10, x11, x10 # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 80] sw x10, 80(x8) # ldr w1, [x29, 44] lw x11, 44(x8) # ldr w0, [x29, 48] lw x10, 48(x8) # sub w0, w1, w0 subw x10, x11, x10 # str w0, [x29, 84] sw x10, 84(x8) # ldr w0, [x29, 80] lw x10, 80(x8) # sxtw x1, w0 sext.w x11, x10 # sub x1, x1, #1 addi x11, x11, -1 # str x1, [x29, 88] sd x11, 88(x8) # sxtw x1, w0 sext.w x11, x10 # mov x18, x1 ld x22, 8(x21) # load of mmapped register mv x22, x11 sd x22, 8(x21) # store of mmapped register # mov x19, 0 li x18, 0 # lsr x1, x18, 59 ld x22, 8(x21) # load of mmapped register srli x11, x22, 59 # lsl x11, x19, 5 slli x7, x18, 5 # orr x11, x1, x11 or x7, x11, x7 # lsl x10, x18, 5 ld x22, 8(x21) # load of mmapped register slli x6, x22, 5 # sxtw x1, w0 sext.w x11, x10 # mov x16, x1 mv x27, x11 # mov x17, 0 ld x22, 0(x21) # load of mmapped register li x22, 0 sd x22, 0(x21) # store of mmapped register # lsr x1, x16, 59 srli x11, x27, 59 # lsl x9, x17, 5 ld x22, 0(x21) # load of mmapped register slli x5, x22, 5 # orr x9, x1, x9 or x5, x11, x5 # lsl x8, x16, 5 slli x9, x27, 5 # sxtw x0, w0 sext.w x10, x10 # lsl x0, x0, 2 slli x10, x10, 2 # add x0, x0, 3 addi x10, x10, 3 # add x0, x0, 15 addi x10, x10, 15 # lsr x0, x0, 4 srli x10, x10, 4 # lsl x0, x0, 4 slli x10, x10, 4 # sub sp, sp, x0 sub sp, sp, x10 # mov x0, sp mv x10, sp # add x0, x0, 3 addi x10, x10, 3 # lsr x0, x0, 2 srli x10, x10, 2 # lsl x0, x0, 2 slli x10, x10, 2 # str x0, [x29, 96] sd x10, 96(x8) # ldr w0, [x29, 84] lw x10, 84(x8) # sxtw x1, w0 sext.w x11, x10 # sub x1, x1, #1 addi x11, x11, -1 # str x1, [x29, 104] sd x11, 104(x8) # sxtw x1, w0 sext.w x11, x10 # mov x14, x1 mv x30, x11 # mov x15, 0 li x31, 0 # lsr x1, x14, 59 srli x11, x30, 59 # lsl x7, x15, 5 slli x17, x31, 5 # orr x7, x1, x7 or x17, x11, x17 # lsl x6, x14, 5 slli x16, x30, 5 # sxtw x1, w0 sext.w x11, x10 # mov x12, x1 mv x28, x11 # mov x13, 0 li x29, 0 # lsr x1, x12, 59 srli x11, x28, 59 # lsl x5, x13, 5 slli x15, x29, 5 # orr x5, x1, x5 or x15, x11, x15 # lsl x4, x12, 5 slli x14, x28, 5 # sxtw x0, w0 sext.w x10, x10 # lsl x0, x0, 2 slli x10, x10, 2 # add x0, x0, 3 addi x10, x10, 3 # add x0, x0, 15 addi x10, x10, 15 # lsr x0, x0, 4 srli x10, x10, 4 # lsl x0, x0, 4 slli x10, x10, 4 # sub sp, sp, x0 sub sp, sp, x10 # mov x0, sp mv x10, sp # add x0, x0, 3 addi x10, x10, 3 # lsr x0, x0, 2 srli x10, x10, 2 # lsl x0, x0, 2 slli x10, x10, 2 # str x0, [x29, 112] sd x10, 112(x8) # str wzr, [x29, 76] sw x0, 76(x8) # b .L2 j .L2 .L3: # ldr w1, [x29, 52] lw x11, 52(x8) # ldr w0, [x29, 76] lw x10, 76(x8) # add w0, w1, w0 addw x10, x11, x10 # sxtw x0, w0 sext.w x10, x10 # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr w2, [x0] lw x12, 0(x10) # ldr x0, [x29, 96] ld x10, 96(x8) # ldrsw x1, [x29, 76] lw x11, 76(x8) # str w2, [x0, x1, lsl 2] slli x26, x11, 2 add x26, x26, x10 # converting offset register to add sw x12, 0(x26) # ldr w0, [x29, 76] lw x10, 76(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 76] sw x10, 76(x8) .L2: # ldr w1, [x29, 76] lw x11, 76(x8) # ldr w0, [x29, 80] lw x10, 80(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L3 blt x25, x0, .L3 # str wzr, [x29, 72] sw x0, 72(x8) # b .L4 j .L4 .L5: # ldr w0, [x29, 48] lw x10, 48(x8) # add w1, w0, 1 addiw x11, x10, 1 # ldr w0, [x29, 72] lw x10, 72(x8) # add w0, w1, w0 addw x10, x11, x10 # sxtw x0, w0 sext.w x10, x10 # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr w2, [x0] lw x12, 0(x10) # ldr x0, [x29, 112] ld x10, 112(x8) # ldrsw x1, [x29, 72] lw x11, 72(x8) # str w2, [x0, x1, lsl 2] slli x26, x11, 2 add x26, x26, x10 # converting offset register to add sw x12, 0(x26) # ldr w0, [x29, 72] lw x10, 72(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 72] sw x10, 72(x8) .L4: # ldr w1, [x29, 72] lw x11, 72(x8) # ldr w0, [x29, 84] lw x10, 84(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L5 blt x25, x0, .L5 # str wzr, [x29, 76] sw x0, 76(x8) # str wzr, [x29, 72] sw x0, 72(x8) # ldr w0, [x29, 52] lw x10, 52(x8) # str w0, [x29, 68] sw x10, 68(x8) # b .L6 j .L6 .L10: # ldr x0, [x29, 96] ld x10, 96(x8) # ldrsw x1, [x29, 76] lw x11, 76(x8) # ldr w1, [x0, x1, lsl 2] slli x26, x11, 2 add x26, x26, x10 # converting offset register to add lw x11, 0(x26) # ldr x0, [x29, 112] ld x10, 112(x8) # ldrsw x2, [x29, 72] lw x12, 72(x8) # ldr w0, [x0, x2, lsl 2] slli x26, x12, 2 add x26, x26, x10 # converting offset register to add lw x10, 0(x26) # cmp w1, w0 sub x25, x11, x10 # bgt .L7 bgt x25, x0, .L7 # ldrsw x0, [x29, 68] lw x10, 68(x8) # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr x1, [x29, 96] ld x11, 96(x8) # ldrsw x2, [x29, 76] lw x12, 76(x8) # ldr w1, [x1, x2, lsl 2] slli x26, x12, 2 add x26, x26, x11 # converting offset register to add lw x11, 0(x26) # str w1, [x0] sw x11, 0(x10) # ldr w0, [x29, 76] lw x10, 76(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 76] sw x10, 76(x8) # b .L8 j .L8 .L7: # ldrsw x0, [x29, 68] lw x10, 68(x8) # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr x1, [x29, 112] ld x11, 112(x8) # ldrsw x2, [x29, 72] lw x12, 72(x8) # ldr w1, [x1, x2, lsl 2] slli x26, x12, 2 add x26, x26, x11 # converting offset register to add lw x11, 0(x26) # str w1, [x0] sw x11, 0(x10) # ldr w0, [x29, 72] lw x10, 72(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 72] sw x10, 72(x8) .L8: # ldr w0, [x29, 68] lw x10, 68(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 68] sw x10, 68(x8) .L6: # ldr w1, [x29, 76] lw x11, 76(x8) # ldr w0, [x29, 80] lw x10, 80(x8) # cmp w1, w0 sub x25, x11, x10 # bge .L11 bge x25, x0, .L11 # ldr w1, [x29, 72] lw x11, 72(x8) # ldr w0, [x29, 84] lw x10, 84(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L10 blt x25, x0, .L10 # b .L11 j .L11 .L12: # ldrsw x0, [x29, 68] lw x10, 68(x8) # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr x1, [x29, 96] ld x11, 96(x8) # ldrsw x2, [x29, 76] lw x12, 76(x8) # ldr w1, [x1, x2, lsl 2] slli x26, x12, 2 add x26, x26, x11 # converting offset register to add lw x11, 0(x26) # str w1, [x0] sw x11, 0(x10) # ldr w0, [x29, 76] lw x10, 76(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 76] sw x10, 76(x8) # ldr w0, [x29, 68] lw x10, 68(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 68] sw x10, 68(x8) .L11: # ldr w1, [x29, 76] lw x11, 76(x8) # ldr w0, [x29, 80] lw x10, 80(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L12 blt x25, x0, .L12 # b .L13 j .L13 .L14: # ldrsw x0, [x29, 68] lw x10, 68(x8) # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 56] ld x11, 56(x8) # add x0, x1, x0 add x10, x11, x10 # ldr x1, [x29, 112] ld x11, 112(x8) # ldrsw x2, [x29, 72] lw x12, 72(x8) # ldr w1, [x1, x2, lsl 2] slli x26, x12, 2 add x26, x26, x11 # converting offset register to add lw x11, 0(x26) # str w1, [x0] sw x11, 0(x10) # ldr w0, [x29, 72] lw x10, 72(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 72] sw x10, 72(x8) # ldr w0, [x29, 68] lw x10, 68(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 68] sw x10, 68(x8) .L13: # ldr w1, [x29, 72] lw x11, 72(x8) # ldr w0, [x29, 84] lw x10, 84(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L14 blt x25, x0, .L14 # mov sp, x3 mv sp, x13 # nop nop # adrp x0, :got:__stack_chk_guard lui x10, %hi(__stack_chk_guard) # ldr x0, [x0, #:got_lo12:__stack_chk_guard] add x10, x10, %lo(__stack_chk_guard) # load from GOT -> ADD! # ldr x1, [x29, 120] ld x11, 120(x8) # ldr x0, [x0] ld x10, 0(x10) # eor x0, x1, x0 xor x10, x11, x10 # cmp x0, 0 addi x25, x10, 0 # beq .L15 beq x25, x0, .L15 # bl __stack_chk_fail call __stack_chk_fail .L15: # add sp, x29, 0 addi sp, x8, 0 # ldr x19, [sp, 16] ld x18, 16(sp) # ldp x29, x30, [sp], 128 ld x8, 0(sp) ld ra, 8(sp) addi sp, sp, 128 # writeback # ret ret .size merge, .-merge .align 2 .global mergeSort .type mergeSort, %function mergeSort: # stp x29, x30, [sp, -48]! sd x8, -48(sp) sd ra, -40(sp) addi sp, sp, -48 # writeback # add x29, sp, 0 addi x8, sp, 0 # str x0, [x29, 24] sd x10, 24(x8) # str w1, [x29, 20] sw x11, 20(x8) # str w2, [x29, 16] sw x12, 16(x8) # ldr w1, [x29, 20] lw x11, 20(x8) # ldr w0, [x29, 16] lw x10, 16(x8) # cmp w1, w0 sub x25, x11, x10 # bge .L18 bge x25, x0, .L18 # ldr w1, [x29, 16] lw x11, 16(x8) # ldr w0, [x29, 20] lw x10, 20(x8) # sub w0, w1, w0 subw x10, x11, x10 # lsr w1, w0, 31 srliw x11, x10, 31 # add w0, w1, w0 addw x10, x11, x10 # asr w0, w0, 1 sraiw x10, x10, 1 # mov w1, w0 mv x11, x10 # ldr w0, [x29, 20] lw x10, 20(x8) # add w0, w0, w1 addw x10, x10, x11 # str w0, [x29, 44] sw x10, 44(x8) # ldr w2, [x29, 44] lw x12, 44(x8) # ldr w1, [x29, 20] lw x11, 20(x8) # ldr x0, [x29, 24] ld x10, 24(x8) # bl mergeSort call mergeSort # ldr w0, [x29, 44] lw x10, 44(x8) # add w0, w0, 1 addiw x10, x10, 1 # ldr w2, [x29, 16] lw x12, 16(x8) # mov w1, w0 mv x11, x10 # ldr x0, [x29, 24] ld x10, 24(x8) # bl mergeSort call mergeSort # ldr w3, [x29, 16] lw x13, 16(x8) # ldr w2, [x29, 44] lw x12, 44(x8) # ldr w1, [x29, 20] lw x11, 20(x8) # ldr x0, [x29, 24] ld x10, 24(x8) # bl merge call merge .L18: # nop nop # ldp x29, x30, [sp], 48 ld x8, 0(sp) ld ra, 8(sp) addi sp, sp, 48 # writeback # ret ret .size mergeSort, .-mergeSort .section .rodata .align 3 .LC0: .string "%d " .text .align 2 .global printArray .type printArray, %function printArray: # stp x29, x30, [sp, -48]! sd x8, -48(sp) sd ra, -40(sp) addi sp, sp, -48 # writeback # add x29, sp, 0 addi x8, sp, 0 # str x0, [x29, 24] sd x10, 24(x8) # str w1, [x29, 20] sw x11, 20(x8) # str wzr, [x29, 44] sw x0, 44(x8) # b .L20 j .L20 .L21: # ldrsw x0, [x29, 44] lw x10, 44(x8) # lsl x0, x0, 2 slli x10, x10, 2 # ldr x1, [x29, 24] ld x11, 24(x8) # add x0, x1, x0 add x10, x11, x10 # ldr w1, [x0] lw x11, 0(x10) # adrp x0, .LC0 lui x10, %hi(.LC0) # add x0, x0, :lo12:.LC0 add x10, x10, %lo(.LC0) # bl printf call printf # ldr w0, [x29, 44] lw x10, 44(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 44] sw x10, 44(x8) .L20: # ldr w1, [x29, 44] lw x11, 44(x8) # ldr w0, [x29, 20] lw x10, 20(x8) # cmp w1, w0 sub x25, x11, x10 # blt .L21 blt x25, x0, .L21 # mov w0, 10 li x10, 10 # bl putchar call putchar # nop nop # ldp x29, x30, [sp], 48 ld x8, 0(sp) ld ra, 8(sp) addi sp, sp, 48 # writeback # ret ret .size printArray, .-printArray .section .rodata .align 3 .LC1: .string "Given array is " .align 3 .LC2: .string "\nSorted array is " .text .align 2 .global main .type main, %function main: la x21, REG_BANK # mov x16, 40032 li x27, 40032 # sub sp, sp, x16 sub sp, sp, x27 # stp x29, x30, [sp] sd x8, 0(sp) sd ra, 8(sp) # add x29, sp, 0 addi x8, sp, 0 # adrp x0, :got:__stack_chk_guard lui x10, %hi(__stack_chk_guard) # ldr x0, [x0, #:got_lo12:__stack_chk_guard] add x10, x10, %lo(__stack_chk_guard) # load from GOT -> ADD! # add x1, x29, 32768 li x26, 32768 # synthesis of oversized immediate add x11, x8, x26 # ldr x2, [x0] ld x12, 0(x10) # str x2, [x1, 7256] li x26, 7256 # synthesis of oversized immediate add x26, x26, x11 # converting offset register to add sd x12, 0(x26) # mov x2,0 li x12, 0 # mov w0, 1234 li x10, 1234 # bl srand call srand # str wzr, [x29, 16] sw x0, 16(x8) # b .L23 j .L23 .L24: # bl random call random # mov w2, w0 mv x12, x10 # ldrsw x0, [x29, 16] lw x10, 16(x8) # lsl x0, x0, 2 slli x10, x10, 2 # add x1, x29, 24 addi x11, x8, 24 # str w2, [x1, x0] add x26, x10, x11 # converting offset register to add sw x12, 0(x26) # ldr w0, [x29, 16] lw x10, 16(x8) # add w0, w0, 1 addiw x10, x10, 1 # str w0, [x29, 16] sw x10, 16(x8) .L23: # ldr w1, [x29, 16] lw x11, 16(x8) # mov w0, 9999 li x10, 9999 # cmp w1, w0 sub x25, x11, x10 # ble .L24 ble x25, x0, .L24 # mov w0, 10000 li x10, 10000 # str w0, [x29, 20] sw x10, 20(x8) # adrp x0, .LC1 lui x10, %hi(.LC1) # add x0, x0, :lo12:.LC1 add x10, x10, %lo(.LC1) # bl puts call puts # add x0, x29, 24 addi x10, x8, 24 # ldr w1, [x29, 20] lw x11, 20(x8) # bl printArray call printArray # ldr w0, [x29, 20] lw x10, 20(x8) # sub w1, w0, #1 addiw x11, x10, -1 # add x0, x29, 24 addi x10, x8, 24 # mov w2, w1 mv x12, x11 # mov w1, 0 li x11, 0 # bl mergeSort call mergeSort # adrp x0, .LC2 lui x10, %hi(.LC2) # add x0, x0, :lo12:.LC2 add x10, x10, %lo(.LC2) # bl puts call puts # add x0, x29, 24 addi x10, x8, 24 # ldr w1, [x29, 20] lw x11, 20(x8) # bl printArray call printArray # mov w0, 0 li x10, 0 # adrp x1, :got:__stack_chk_guard lui x11, %hi(__stack_chk_guard) # ldr x1, [x1, #:got_lo12:__stack_chk_guard] add x11, x11, %lo(__stack_chk_guard) # load from GOT -> ADD! # add x2, x29, 32768 li x26, 32768 # synthesis of oversized immediate add x12, x8, x26 # ldr x3, [x2, 7256] li x26, 7256 # synthesis of oversized immediate add x26, x26, x12 # converting offset register to add ld x13, 0(x26) # ldr x1, [x1] ld x11, 0(x11) # eor x1, x3, x1 xor x11, x13, x11 # cmp x1, 0 addi x25, x11, 0 # beq .L26 beq x25, x0, .L26 # bl __stack_chk_fail call __stack_chk_fail .L26: # ldp x29, x30, [sp] ld x8, 0(sp) ld ra, 8(sp) # mov x16, 40032 li x27, 40032 # add sp, sp, x16 add sp, sp, x27 # ret ret .size main, .-main .ident "GCC: (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0" .section .note.GNU-stack,"",@progbits
src/grammar/bsize.g4
myl7/bsize
0
5728
<filename>src/grammar/bsize.g4<gh_stars>0 grammar bsize; size: Number Space* unit?; unit: word | abbr; word: (prefix | biPrefix)? suffix; abbr: pre BiSign? suf | pre | suf; prefix: KiloWord | MegaWord | GigaWord | TeraWord | PetaWord; biPrefix: KibiWord | MebiWord | GibiWord | TebiWord | PebiWord; suffix: (BitBody | ByteBody) S?; pre: Kilo | Mega | Giga | Tera | Peta; suf: Bit | Byte; ByteBody: 'byte'; BitBody: 'bit'; Number: Digit+; Space: ' '; KiloWord: Kilo 'ilo'; MegaWord: Mega 'ega'; GigaWord: Giga 'iga'; TeraWord: Tera 'era'; PetaWord: Peta 'eta'; KibiWord: Kilo 'ibi'; MebiWord: Mega 'ebi'; GibiWord: Giga 'ibi'; TebiWord: Tera 'ebi'; PebiWord: Peta 'ebi'; BiSign: 'i'; Kilo: 'k' | 'K'; Mega: 'm' | 'M'; Giga: 'g' | 'G'; Tera: 't' | 'T'; Peta: 'p' | 'P'; Bit: 'b'; Byte: 'B'; S: 's'; fragment Digit: [0-9];
agda/par-swap/dpg.agda
florence/esterel-calculus
3
4670
module par-swap.dpg where open import par-swap open import par-swap.properties open import par-swap.confluent open import par-swap.dpg-pot open import par-swap.dpg-e-view open import noetherian using (noetherian ; ∥_∥s) open import Esterel.Lang open import Esterel.Lang.Properties open import Esterel.Lang.Binding open import Esterel.Environment as Env open import Esterel.Context open import Data.Product open import Data.Bool open import Data.Empty open import Data.List using ([] ; [_] ; _∷_ ; List ; _++_) open import Data.Sum open import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; sym ; subst ; cong ; trans ; module ≡-Reasoning ; cong₂ ; subst₂ ; inspect) open import sn-calculus open import context-properties -- get view, E-views DPG₁ : ∀ {p q r} -> (p ∥ q) sn⟶₁ r -> ∃ \ {(d , d₁) -> (q ∥ p) sn⟶ d₁ × d₁ sn⟶* d × r ∥R* d} DPG₁{p} {q} {r} (rpar-done-right haltedp doneq) = (r , r) , fixup-valuemax₁ doneq haltedp (rcontext [] dchole (rpar-done-left doneq haltedp)) , rrefl , ∥R0 where fixup-valuemax₁ : ∀ {p q} -> (doneq : done q) -> (haltedp : halted p) -> q ∥ p sn⟶ value-max doneq (dhalted haltedp) (inj₂ haltedp) -> q ∥ p sn⟶ value-max (dhalted haltedp) doneq (inj₁ haltedp) fixup-valuemax₁ donep haltedq rewrite value-max-sym donep haltedq = λ z → z DPG₁{p}{q}{r} (rpar-done-left donep haltedq) = (r , r) , fixup-valuemax₂ donep haltedq (rcontext [] dchole (rpar-done-right haltedq donep)) , rrefl , ∥R0 where fixup-valuemax₂ : ∀ {p q} -> (donep : done p) -> (haltedq : halted q) -> q ∥ p sn⟶ value-max (dhalted haltedq) donep (inj₁ haltedq) -> q ∥ p sn⟶ value-max donep (dhalted haltedq) (inj₂ haltedq) fixup-valuemax₂ donep haltedq rewrite sym (value-max-sym donep haltedq) = λ z → z par-not-halted : ∀ {p C q₁ q₂} -> halted p -> p ≐ C ⟦ q₁ ∥ q₂ ⟧c -> ⊥ par-not-halted hnothin () par-not-halted (hexit n) () swap-paused-is-paused : ∀ {p C q₁ q₂} -> paused p -> p ≐ C ⟦ q₁ ∥ q₂ ⟧c -> paused (C ⟦ q₂ ∥ q₁ ⟧c) swap-paused-is-paused ppause () swap-paused-is-paused (pseq pausedp) (dcseq₁ dc) = pseq (swap-paused-is-paused pausedp dc) swap-paused-is-paused (pseq pausedp) (dcseq₂ dc) = pseq pausedp swap-paused-is-paused (ploopˢ pausedp) (dcloopˢ₁ dc) = ploopˢ (swap-paused-is-paused pausedp dc) swap-paused-is-paused (ploopˢ pausedp) (dcloopˢ₂ dc) = ploopˢ pausedp swap-paused-is-paused (ppar pausedp pausedp₁) dchole = ppar pausedp₁ pausedp swap-paused-is-paused (ppar pausedp pausedp₁) (dcpar₁ dc) = ppar (swap-paused-is-paused pausedp dc) pausedp₁ swap-paused-is-paused (ppar pausedp pausedp₁) (dcpar₂ dc) = ppar pausedp (swap-paused-is-paused pausedp₁ dc) swap-paused-is-paused (psuspend pausedp) (dcsuspend dc) = psuspend (swap-paused-is-paused pausedp dc) swap-paused-is-paused (ptrap pausedp) (dctrap dc) = ptrap (swap-paused-is-paused pausedp dc) DPG : ∀ {a b c} -> a ∥R b -> a sn⟶ c -> Σ (Term × Term) λ {(d , d₁) -> b sn⟶ d₁ × d₁ sn⟶* d × c ∥R* d} DPG (∥Rstep dchole) (rcontext _ dchole psn⟶₁p') = DPG₁ psn⟶₁p' DPG (∥Rstep dchole) (rcontext _ (dcpar₁ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcpar₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep dchole) ∥R0 DPG (∥Rstep dchole) (rcontext _ (dcpar₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcpar₁ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep dchole) ∥R0 DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext .[] dchole (rpar-done-right haltedp doneq)) = ⊥-elim (par-not-halted haltedp dc∥R) DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext .[] dchole (rpar-done-left (dhalted p/halted) haltedq)) = ⊥-elim (par-not-halted p/halted dc∥R) DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext .[] dchole (rpar-done-left (dpaused p/paused) hnothin)) = _ , rcontext [] dchole (rpar-done-left (dpaused (swap-paused-is-paused p/paused dc∥R)) hnothin) , rrefl , ∥Rn (∥Rstep dc∥R) ∥R0 DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext .[] dchole (rpar-done-left (dpaused p/paused) (hexit n))) = _ , rcontext [] dchole (rpar-done-left (dpaused (swap-paused-is-paused p/paused dc∥R)) (hexit n)) , rrefl , ∥R0 DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext (ceval (epar₁ _) ∷ C) (dcpar₁ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ (ceval (epar₁ _)) sn⟶step , Context1-sn⟶* (ceval (epar₁ _)) sn⟶*step , Context1-∥R* (ceval (epar₁ _)) ∥R*step DPG (∥Rstep (dcpar₁ dc∥R)) (rcontext _ (dcpar₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcpar₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcpar₁ dc∥R)) ∥R0 DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext .[] dchole (rpar-done-right haltedp (dhalted p/halted))) = ⊥-elim (par-not-halted p/halted dc∥R) DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext .[] dchole (rpar-done-right hnothin (dpaused p/paused))) = _ , rcontext [] dchole (rpar-done-right hnothin (dpaused (swap-paused-is-paused p/paused dc∥R))) , rrefl , ∥Rn (∥Rstep dc∥R) ∥R0 DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext .[] dchole (rpar-done-right (hexit n) (dpaused p/paused))) = _ , rcontext [] dchole (rpar-done-right (hexit n) (dpaused (swap-paused-is-paused p/paused dc∥R))) , rrefl , ∥R0 DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext .[] dchole (rpar-done-left donep haltedq)) = ⊥-elim (par-not-halted haltedq dc∥R) DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext _ (dcpar₁ dcsn⟶) psn⟶₁p') = _ , (rcontext _ (dcpar₁ dcsn⟶) psn⟶₁p') , rrefl , ∥Rn (∥Rstep (dcpar₂ dc∥R)) ∥R0 DPG (∥Rstep (dcpar₂ dc∥R)) (rcontext (c ∷ C) (dcpar₂ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcseq₁ ())) (rcontext .[] dchole rseq-done) DPG (∥Rstep (dcseq₁ ())) (rcontext .[] dchole rseq-exit) DPG (∥Rstep (dcseq₁ dc∥R)) (rcontext (c ∷ C) (dcseq₁ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcseq₁ dc∥R)) (rcontext _ (dcseq₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcseq₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcseq₁ dc∥R)) ∥R0 DPG (∥Rstep (dcseq₂ dc∥R)) (rcontext .[] dchole rseq-done) = _ , rcontext [] dchole rseq-done , rrefl , ∥Rn (∥Rstep dc∥R) ∥R0 DPG (∥Rstep (dcseq₂ dc∥R)) (rcontext .[] dchole rseq-exit) = _ , rcontext [] dchole rseq-exit , rrefl , ∥R0 DPG (∥Rstep (dcseq₂ dc∥R)) (rcontext _ (dcseq₁ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcseq₁ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcseq₂ dc∥R)) ∥R0 DPG (∥Rstep (dcseq₂ dc∥R)) (rcontext (c ∷ C) (dcseq₂ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcsuspend dc∥R)) (rcontext .[] dchole (rsuspend-done haltedp)) = ⊥-elim (par-not-halted haltedp dc∥R) DPG (∥Rstep (dcsuspend dc∥R)) (rcontext (c ∷ C) (dcsuspend dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dctrap dc∥R)) (rcontext .[] dchole (rtrap-done haltedp)) = ⊥-elim (par-not-halted haltedp dc∥R) DPG (∥Rstep (dctrap dc∥R)) (rcontext (c ∷ C) (dctrap dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcsignl dc∥R)) (rcontext .[] dchole rraise-signal) = _ , (rcontext [] dchole rraise-signal) , rrefl , (∥Rn (∥Rstep (dcenv dc∥R)) ∥R0) DPG (∥Rstep (dcsignl dc∥R)) (rcontext (c ∷ C) (dcsignl dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcpresent₁ dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcpresent₁ dc∥R)) (rcontext (c ∷ C) (dcpresent₁ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcpresent₁ dc∥R)) (rcontext _ (dcpresent₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcpresent₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcpresent₁ dc∥R)) ∥R0 DPG (∥Rstep (dcpresent₂ dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcpresent₂ dc∥R)) (rcontext _ (dcpresent₁ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcpresent₁ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcpresent₂ dc∥R)) ∥R0 DPG (∥Rstep (dcpresent₂ dc∥R)) (rcontext (c ∷ C) (dcpresent₂ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcloop dc∥R)) (rcontext .[] dchole rloop-unroll) = _ , (rcontext [] dchole rloop-unroll) , rrefl , ∥Rn (∥Rstep (dcloopˢ₁ dc∥R)) (∥Rn (∥Rstep (dcloopˢ₂ dc∥R)) ∥R0) DPG (∥Rstep (dcloop dc∥R)) (rcontext (c ∷ C) (dcloop dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcloopˢ₁ ())) (rcontext .[] dchole rloopˢ-exit) DPG (∥Rstep (dcloopˢ₁ dc∥R)) (rcontext (c ∷ C) (dcloopˢ₁ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcloopˢ₁ dc∥R)) (rcontext _ (dcloopˢ₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcloopˢ₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcloopˢ₁ dc∥R)) ∥R0 DPG (∥Rstep (dcloopˢ₂ dc∥R)) (rcontext .[] dchole rloopˢ-exit) = _ , (rcontext [] dchole rloopˢ-exit) , rrefl , ∥R0 DPG (∥Rstep (dcloopˢ₂ dc∥R)) (rcontext _ (dcloopˢ₁ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcloopˢ₁ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcloopˢ₂ dc∥R)) ∥R0 DPG (∥Rstep (dcloopˢ₂ dc∥R)) (rcontext (c ∷ C) (dcloopˢ₂ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcshared dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcshared dc∥R)) (rcontext (c ∷ C) (dcshared dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcvar dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcvar dc∥R)) (rcontext (c ∷ C) (dcvar dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcif₁ dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcif₁ dc∥R)) (rcontext (c ∷ C) (dcif₁ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcif₁ dc∥R)) (rcontext _ (dcif₂ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcif₂ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcif₁ dc∥R)) ∥R0 DPG (∥Rstep (dcif₂ dc∥R)) (rcontext .[] dchole ()) DPG (∥Rstep (dcif₂ dc∥R)) (rcontext _ (dcif₁ dcsn⟶) psn⟶₁p') = _ , rcontext _ (dcif₁ dcsn⟶) psn⟶₁p' , rrefl , ∥Rn (∥Rstep (dcif₂ dc∥R)) ∥R0 DPG (∥Rstep (dcif₂ dc∥R)) (rcontext (c ∷ C) (dcif₂ dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step DPG (∥Rstep (dcenv dc∥R)) (rcontext{p' = p'} .[] dchole psn⟶₁p') with ρ-stays-ρ-sn⟶₁ psn⟶₁p' ... | θ' , q , A' , refl with get-view psn⟶₁p' ... | inj₂ (eq , eq2 , pot-view) = DPG-pot-view dc∥R psn⟶₁p' eq eq2 pot-view ... | inj₁ (E , pin , qin , peq , qeq , E-view) with DPG-E-view peq qeq dc∥R psn⟶₁p' E-view ... | (d , sn⟶step , ∥R*-step , _ ) = _ , rcontext [] dchole sn⟶step , rrefl , Context1-∥R* (cenv θ' _) ∥R*-step DPG (∥Rstep (dcenv dc∥R)) (rcontext (c ∷ C) (dcenv dcsn⟶) psn⟶₁p') with DPG (∥Rstep dc∥R) (rcontext C dcsn⟶ psn⟶₁p') ... | _ , sn⟶step , sn⟶*step , ∥R*step = _ , Context1-sn⟶ c sn⟶step , Context1-sn⟶* c sn⟶*step , Context1-∥R* c ∥R*step
beetl-core/src/main/java/org/beetl/core/parser/BeetlParser.g4
tengyz/beetl2.0x
2
895
<gh_stars>1-10 parser grammar BeetlParser; options { tokenVocab=BeetlLexer; } // starting point for parsing a java file prog : statement* EOF ; block : LEFT_BRACE statement* RIGHT_BRACE ; // STATMENT statement : block #blockSt | textStatment #textOutputSt | constantsTextStatment #staticOutputSt | COMMENT_TAG commentTypeTag #commentTagSt | If parExpression statement (Else statement)? #ifSt | For LEFT_PAR forControl RIGHT_PAR statement ( Elsefor statement)? #forSt | While parExpression statement #whileSt | Switch parExpression switchBlock #siwchSt | Select g_switchStatment #selectSt | Try block (Catch LEFT_PAR Identifier? RIGHT_PAR block )? #trySt | Return expression? END #returnSt | Break END #breakSt | Continue END #continueSt | Var varDeclareList END #varSt | Directive directiveExp #directiveSt | assignMent END #assignSt | functionTagCall #functionTagSt | statementExpression END #statmentExpSt | (Ajax|Fragment) Identifier Identifier? COLON block #ajaxSt | END #end ; //注解:@type User user,List<User> userList commentTypeTag: LEFT_PAR1 commentTypeItemTag (COMMA1 commentTypeItemTag)* RIGHT_PAR1; commentTypeItemTag: classOrInterfaceType Identifier1 ; classOrInterfaceType: Identifier1 (PERIOD1 Identifier1 )* typeArguments?; typeArguments : LEFT_ANGULAR typeArgument (COMMA1 typeArgument)* RIGHT_ANGULAR ; typeArgument : classOrInterfaceType ; //指令 directive object xx,xx,xx directiveExp: Identifier (StringLiteral|directiveExpIDList)? END; directiveExpIDList: Identifier (COMMA Identifier)* ; g_switchStatment : (LEFT_PAR base=expression RIGHT_PAR)? LEFT_BRACE g_caseStatment* g_defaultStatment? RIGHT_BRACE ; g_caseStatment : Case expression (COMMA expression)* COLON statement* ; g_defaultStatment : Default COLON statement*; varDeclareList : assignMent (COMMA assignMent)* ; assignMent : Identifier #assignId | generalAssignExp #assignGeneralInSt | Identifier ASSIN block #assignTemplateVar ; switchBlock : LEFT_BRACE switchBlockStatementGroup* RIGHT_BRACE ; switchBlockStatementGroup : switchLabel+ statement* ; switchLabel : Case expression COLON | Default COLON ; forControl : forInControl | generalForControl ; forInControl: Var? Identifier FOR_IN expression ; generalForControl:forInit? ';' expression? ';' forUpdate?; forInit : Var varDeclareList | expressionList ; forUpdate : expressionList ; // EXPRESSIONS parExpression : LEFT_PAR expression RIGHT_PAR ; expressionList : expression (COMMA expression)* ; statementExpression : expression ; textStatment: //表达式输 LEFT_TOKEN NOT LEFT_PAR textVar RIGHT_PAR RIGHT_TOKEN | LEFT_TOKEN textVar RIGHT_TOKEN; textVar : b=expression (COMMA textformat)? ; textformat: fm=functionNs (ASSIN StringLiteral)? | StringLiteral ; constantsTextStatment : LEFT_TEXT_TOKEN DecimalLiteral RIGHT_TOKEN ; // 常量输出,代表数组搜应 constantExpression : expression ; expression : literal #literalExp | AT nativeCall #nativeCallExp | functionCall #functionCallExp | varRef #varRefExp | json #jsonExp | Identifier (INCREASE|DECREASE) #oneIncDec | (ADD|MIN) expression #negExp | (INCREASE|DECREASE) Identifier #incDecOne | NOT expression #notExp | expression (MUlTIP|DIV|MOD) expression #muldivmodExp | expression (ADD|MIN) expression #addminExp | expression (EQUAL | NOT_EQUAL |LESS_EQUAL | LARGE_EQUAL |LARGE |LESS) expression #compareExp | expression AND expression #andExp | expression OR expression #orExp | expression QUESTOIN expression? COLON? expression? #ternaryExp | LEFT_PAR expression RIGHT_PAR #parExp | generalAssignExp #assignGeneralInExp ; generalAssignExp: varRef ASSIN expression ; varRef:Identifier ( varAttribute)* (safe_output)? ; varAttribute :PERIOD Identifier #varAttributeGeneral | VIRTUAL Identifier #varAttributeVirtual |LEFT_SQBR expression RIGHT_SQBR #varAttributeArrayOrMap ; safe_output: NOT safe_allow_exp? ; safe_allow_exp:literal | AT nativeCall | functionCall | json | varRef | LEFT_PAR expression RIGHT_PAR; functionCall: functionNs LEFT_PAR expressionList? RIGHT_PAR (varAttribute)* ; functionTagCall:functionNs LEFT_PAR expressionList? RIGHT_PAR block ; functionNs:Identifier (PERIOD Identifier)*; // NATIVE nativeCall: nativeVarRefChain (nativeMethod|nativeArray| PERIOD nativeVarRefChain)*; nativeMethod: LEFT_PAR (expression (COMMA expression) *)? RIGHT_PAR ; nativeArray: LEFT_SQBR expression RIGHT_SQBR; nativeVarRefChain:Identifier (PERIOD Identifier)*; json : LEFT_SQBR (expression (COMMA expression)*)? RIGHT_SQBR | LEFT_BRACE (jsonKeyValue (COMMA jsonKeyValue)*)? RIGHT_BRACE ; jsonKeyValue : StringLiteral COLON expression | Identifier COLON expression ; literal : DecimalLiteral | FloatingPointLiteral | StringLiteral | booleanLiteral | NULL ; booleanLiteral : TRUE | FALSE ; arguments : LEFT_PAR expressionList? RIGHT_PAR ;
oeis/213/A213031.asm
neoneye/loda-programs
11
100008
<reponame>neoneye/loda-programs ; A213031: [n/2]^3 -[n/3]^3, where []=floor. ; Submitted by <NAME> ; 0,0,1,0,7,7,19,19,56,37,98,98,152,152,279,218,387,387,513,513,784,657,988,988,1216,1216,1685,1468,2015,2015,2375,2375,3096,2765,3582,3582,4104,4104,5131,4662,5803,5803,6517,6517,7904,7273,8792,8792 mov $1,$0 div $0,2 pow $0,3 div $1,3 pow $1,3 sub $0,$1
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___hmul_callee.asm
Frodevan/z88dk
0
170153
<filename>libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___hmul_callee.asm<gh_stars>0 SECTION code_fp_math16 PUBLIC ___hmul_callee PUBLIC _f16_mul_callee EXTERN cm16_sdcc_mul_callee defc ___hmul_callee = cm16_sdcc_mul_callee defc _f16_mul_callee = cm16_sdcc_mul_callee
Transynther/x86/_processed/US/_ht_zr_un_/i7-7700_9_0xca.log_21829_1810.asm
ljhsiun2/medusa
9
165730
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x15472, %rsi lea addresses_WC_ht+0x1aa70, %rdi nop nop xor $47786, %rbx mov $95, %rcx rep movsw nop nop nop cmp %r11, %r11 lea addresses_normal_ht+0xca70, %r8 nop nop nop nop inc %r13 mov $0x6162636465666768, %rbx movq %rbx, %xmm2 vmovups %ymm2, (%r8) nop nop nop nop sub %rbx, %rbx lea addresses_WC_ht+0x184b0, %rsi nop dec %r8 mov (%rsi), %rbx dec %r13 lea addresses_D_ht+0x66ee, %rbx nop sub %r13, %r13 mov (%rbx), %rcx nop nop nop dec %r11 lea addresses_WC_ht+0x6f70, %rsi lea addresses_UC_ht+0x1b70, %rdi nop nop nop add $2965, %r13 mov $35, %rcx rep movsl nop nop nop nop nop xor $56955, %r11 lea addresses_D_ht+0x371a, %rsi lea addresses_A_ht+0x1d740, %rdi nop nop nop add $36973, %r13 mov $68, %rcx rep movsq add $64227, %rdi lea addresses_UC_ht+0xcb30, %r13 nop nop nop nop nop cmp %rcx, %rcx mov (%r13), %si nop nop nop sub %r8, %r8 lea addresses_D_ht+0x5df0, %rsi lea addresses_UC_ht+0x13c70, %rdi clflush (%rsi) nop nop nop nop nop sub $62442, %rbp mov $19, %rcx rep movsw nop nop nop nop nop inc %r8 lea addresses_WC_ht+0x137ca, %rsi lea addresses_A_ht+0x475c, %rdi nop add %r8, %r8 mov $111, %rcx rep movsw nop nop nop nop nop inc %r13 lea addresses_D_ht+0x9d70, %rsi lea addresses_WT_ht+0x1d3f4, %rdi clflush (%rdi) nop nop nop and %r11, %r11 mov $69, %rcx rep movsl nop nop nop nop nop xor $1773, %r11 lea addresses_UC_ht+0xe270, %rsi lea addresses_UC_ht+0x1c138, %rdi nop nop dec %r8 mov $24, %rcx rep movsl nop nop nop nop and %r11, %r11 lea addresses_normal_ht+0x3a70, %r11 nop nop nop and $52096, %rdi mov $0x6162636465666768, %r8 movq %r8, (%r11) nop nop mfence lea addresses_normal_ht+0x1c3b, %rsi nop nop nop cmp $23014, %r8 movl $0x61626364, (%rsi) nop nop nop nop inc %rbx lea addresses_UC_ht+0xf940, %rsi nop inc %rbx and $0xffffffffffffffc0, %rsi vmovntdqa (%rsi), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r8 nop nop cmp $57575, %rcx lea addresses_D_ht+0x1e336, %r8 nop add $24313, %r13 mov (%r8), %rcx sub %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r15 push %r9 push %rbx push %rdx // Load lea addresses_normal+0xada0, %r15 nop nop nop nop nop add $8917, %r10 vmovups (%r15), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %rbx nop cmp $38380, %r13 // Store lea addresses_PSE+0x1a0d0, %rbx nop add %r14, %r14 mov $0x5152535455565758, %r10 movq %r10, (%rbx) nop nop nop nop nop xor $29356, %rdx // Faulty Load lea addresses_US+0xb270, %r15 nop nop nop nop sub %rbx, %rbx vmovups (%r15), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r14 lea oracles, %r9 and $0xff, %r14 shlq $12, %r14 mov (%r9,%r14,1), %r14 pop %rdx pop %rbx pop %r9 pop %r15 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': True, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'46': 801, '48': 274, '47': 8, '00': 1902, 'e8': 1, '49': 11, 'c8': 9359, 'f2': 1, 'c7': 9292, '74': 1, 'ff': 79, '1a': 97, 'ec': 2, '01': 1} 00 c7 c7 1a c7 c7 c7 46 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 1a c7 c7 c7 c7 c7 1a c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 48 46 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 00 c7 c7 c7 00 c7 c7 c7 c7 00 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 48 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 00 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 00 c7 c7 00 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 48 c7 c7 c7 00 00 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 00 00 c7 c7 c7 46 c7 c7 c7 48 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 00 c7 c7 00 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 00 c7 c7 c7 c7 c7 c7 00 48 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 48 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 46 00 c7 48 c7 c7 48 46 c7 c7 c7 00 c7 c7 c7 c7 c7 00 48 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 c7 00 c7 00 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 46 c7 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 ff c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 48 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 00 00 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 00 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 48 c7 c7 00 c7 00 c7 c7 00 1a c7 46 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 1a c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 46 c7 c7 48 c7 c7 c7 00 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 00 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 00 c7 c7 c7 c7 c7 c7 00 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 48 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 ff 00 c7 c7 c7 c7 00 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 00 46 c7 c7 c7 c7 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 00 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 00 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 46 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 ff 1a c7 c7 46 c7 c7 c7 c7 46 c7 49 c7 c7 c7 46 c7 c7 c7 c7 00 c7 00 c7 c7 c7 c7 c7 c7 c7 00 c7 48 c7 46 c7 c7 c7 c7 c7 c7 c7 c7 00 c7 c7 c7 1a */
archive/agda-1/InterpretationEqualityExceptAtVariableName.agda
m0davis/oscar
0
13261
<filename>archive/agda-1/InterpretationEqualityExceptAtVariableName.agda module InterpretationEqualityExceptAtVariableName where open import OscarPrelude open import VariableName open import FunctionName open import PredicateName open import Elements open import Interpretation record _≞_/_ (𝓘 : Interpretation) (I : Interpretation) (𝑥 : VariableName) : Set where field μEquality : {𝑥′ : VariableName} → 𝑥′ ≢ 𝑥 → μ⟦ 𝓘 ⟧ 𝑥 ≡ μ⟦ I ⟧ 𝑥′ 𝑓Equality : (𝑓 : FunctionName) (μs : Elements) → 𝑓⟦ 𝓘 ⟧ 𝑓 μs ≡ 𝑓⟦ I ⟧ 𝑓 μs 𝑃Equality : (𝑃 : PredicateName) → (μs : Elements) → 𝑃⟦ 𝓘 ⟧ 𝑃 μs ≡ 𝑃⟦ I ⟧ 𝑃 μs
Embedded LABs/Embedded lab 1/8a.asm
amritphuyal/LATEX
1
104152
ORG 00H MOV R3,#05H MOV B,R3 MOV R1,B ACALL FACTO MOV R1,A AGAIN: MOV A,R1 MOV P0,A ACALL DELAY ACALL HTOD MOV P0,A ACALL DELAY MOV A,B MOV P0,A ACALL DELAY SJMP AGAIN HTOD: MOV R4,#00H MOV B,#0AH DIV AB MOV R2,A SUBB A,#0AH JC SKIP MOV A,R2 MOV R3,B MOV B,#0AH DIV AB MOV R4,A MOV P0,A MOV A,B MOV B,R3 MOV R2,A SKIP: MOV A,R2 SWAP A ADD A,B MOV B,R4 RET DELAY: MOV R7,#7 HERE1: MOV R6,#255 HERE2: MOV R5,#255 HERE3: DJNZ R5,HERE3 DJNZ R6,HERE2 DJNZ R7,HERE1 RET FACTO: MOV A,#01H LOOP: MOV B,R1 MUL AB DJNZ R1,LOOP RET END
examples/StateSized/GUI/BitMaps.agda
agda/ooAgda
23
7505
module StateSized.GUI.BitMaps where open import StateSizedIO.GUI.WxBindingsFFI ship : Bitmap ship = bitmap "./StateSized/GUI/ship.ico" rock : Bitmap rock = bitmap "./StateSized/GUI/rock.ico"
data/pokemon/base_stats/mime_jr.asm
TastySnax12/pokecrystal16-493-plus
2
164494
db 0 ; species ID placeholder db 20, 25, 45, 60, 70, 90 ; hp atk def spd sat sdf db PSYCHIC, PSYCHIC ; type db 145 ; catch rate db 52 ; base exp db NO_ITEM, MYSTERYBERRY ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 25 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/mime_jr/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_FAST ; growth rate dn EGG_NONE, EGG_NONE ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, ZAP_CANNON, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, DREAM_EATER, REST, ATTRACT, THIEF, NIGHTMARE, FLASH, THUNDERBOLT ; end
theorems/groups/ReducedWord.agda
timjb/HoTT-Agda
0
9767
{-# OPTIONS --without-K --rewriting #-} open import HoTT module groups.ReducedWord {i} {A : Type i} (dec : has-dec-eq A) where is-reduced : Word A → Type i is-reduced nil = Lift ⊤ is-reduced (_ :: nil) = Lift ⊤ is-reduced (inl x :: inl y :: w) = is-reduced (inl y :: w) is-reduced (inl x :: inr y :: w) = (x ≠ y) × is-reduced (inr y :: w) is-reduced (inr x :: inl y :: w) = (x ≠ y) × is-reduced (inl y :: w) is-reduced (inr x :: inr y :: w) = is-reduced (inr y :: w) -- Everything is a set. A-is-set : is-set A A-is-set = dec-eq-is-set dec PlusMinus-has-dec-eq : has-dec-eq (PlusMinus A) PlusMinus-has-dec-eq (inl x) (inl y) with dec x y PlusMinus-has-dec-eq (inl x) (inl y) | inl p = inl $ ap inl p PlusMinus-has-dec-eq (inl x) (inl y) | inr ¬p = inr $ ¬p ∘ lower ∘ Coprod=-in PlusMinus-has-dec-eq (inl x) (inr y) = inr $ lower ∘ Coprod=-in PlusMinus-has-dec-eq (inr x) (inl y) = inr $ lower ∘ Coprod=-in PlusMinus-has-dec-eq (inr x) (inr y) with dec x y PlusMinus-has-dec-eq (inr x) (inr y) | inl p = inl $ ap inr p PlusMinus-has-dec-eq (inr x) (inr y) | inr ¬p = inr $ ¬p ∘ lower ∘ Coprod=-in Word-has-dec-eq : has-dec-eq (Word A) Word-has-dec-eq nil nil = inl idp Word-has-dec-eq nil (_ :: w) = inr $ lower ∘ List=-in Word-has-dec-eq (_ :: v) nil = inr $ lower ∘ List=-in Word-has-dec-eq (x :: v) (y :: w) with PlusMinus-has-dec-eq x y Word-has-dec-eq (x :: v) (y :: w) | inl x=y with Word-has-dec-eq v w Word-has-dec-eq (x :: v) (y :: w) | inl x=y | inl v=w = inl $ List=-out (x=y , v=w) Word-has-dec-eq (x :: v) (y :: w) | inl x=y | inr v≠w = inr $ v≠w ∘ snd ∘ List=-in Word-has-dec-eq (x :: v) (y :: w) | inr x≠y = inr $ x≠y ∘ fst ∘ List=-in instance Word-is-set : is-set (Word A) Word-is-set = dec-eq-is-set Word-has-dec-eq is-reduced-is-prop : {w : Word A} → is-prop (is-reduced w) is-reduced-is-prop {nil} = ⟨⟩ is-reduced-is-prop {x :: nil} = ⟨⟩ is-reduced-is-prop {inl x :: inl y :: l} = is-reduced-is-prop {inl y :: l} is-reduced-is-prop {inl x :: inr y :: l} = ⟨⟩ where instance _ = is-reduced-is-prop {inr y :: l} is-reduced-is-prop {inr x :: inl y :: l} = ⟨⟩ where instance _ = is-reduced-is-prop {inl y :: l} is-reduced-is-prop {inr x :: inr y :: l} = is-reduced-is-prop {inr y :: l} is-reduced-prop : SubtypeProp (Word A) i is-reduced-prop = is-reduced , λ w → is-reduced-is-prop {w} -- The subtype ReducedWord : Type i ReducedWord = Subtype is-reduced-prop instance ReducedWord-is-set : is-set ReducedWord ReducedWord-is-set = Subtype-level is-reduced-prop where instance _ = is-reduced-is-prop -- Identifications in [ReducedWord]. ReducedWord= : ReducedWord → ReducedWord → Type i ReducedWord= = Subtype= is-reduced-prop ReducedWord=-out : {x y : ReducedWord} → ReducedWord= x y → x == y ReducedWord=-out = Subtype=-out is-reduced-prop -- The group structure of reduced words private rw-unit : ReducedWord rw-unit = nil , lift tt abstract tail-is-reduced : ∀ x w → is-reduced (x :: w) → is-reduced w tail-is-reduced x nil red = lift tt tail-is-reduced (inl x) (inl y :: w) red = red tail-is-reduced (inl x) (inr y :: w) red = snd red tail-is-reduced (inr x) (inl y :: w) red = snd red tail-is-reduced (inr x) (inr y :: w) red = red rw-cons : PlusMinus A → ReducedWord → ReducedWord rw-cons x (nil , _) = (x :: nil) , lift tt rw-cons (inl x) ((inl y :: l) , red) = (inl x :: inl y :: l) , red rw-cons (inl x) ((inr y :: l) , red) with dec x y rw-cons (inl x) ((inr y :: l) , red) | inl p = l , tail-is-reduced (inr y) l red rw-cons (inl x) ((inr y :: l) , red) | inr ¬p = (inl x :: inr y :: l) , (¬p , red) rw-cons (inr x) ((inl y :: l) , red) with dec x y rw-cons (inr x) ((inl y :: l) , red) | inl p = l , tail-is-reduced (inl y) l red rw-cons (inr x) ((inl y :: l) , red) | inr ¬p = (inr x :: inl y :: l) , (¬p , red) rw-cons (inr x) ((inr y :: l) , red) = (inr x :: inr y :: l) , red rw-++' : Word A → ReducedWord → ReducedWord rw-++' w₁ rw₂ = foldr rw-cons rw₂ w₁ reduce : Word A → ReducedWord reduce w = rw-++' w rw-unit rw-++ : ReducedWord → ReducedWord → ReducedWord rw-++ rw₁ rw₂ = rw-++' (fst rw₁) rw₂ abstract -- assoc rw-cons-reduced : ∀ x w → (red : is-reduced w) → (red' : is-reduced (x :: w)) → rw-cons x (w , red) == (x :: w) , red' rw-cons-reduced x nil _ _ = ReducedWord=-out idp rw-cons-reduced (inl x) (inl y :: w) _ red' = ReducedWord=-out idp rw-cons-reduced (inl x) (inr y :: w) _ red' with dec x y rw-cons-reduced (inl x) (inr y :: w) _ red' | inl p = ⊥-rec $ fst red' $ p rw-cons-reduced (inl x) (inr y :: w) _ red' | inr ¬p = ReducedWord=-out idp rw-cons-reduced (inr x) (inl y :: w) _ red' with dec x y rw-cons-reduced (inr x) (inl y :: w) _ red' | inl p = ⊥-rec $ fst red' $ p rw-cons-reduced (inr x) (inl y :: w) _ red' | inr ¬p = ReducedWord=-out idp rw-cons-reduced (inr x) (inr y :: w) _ red' = ReducedWord=-out idp rw-cons-flip : ∀ x w red red' → rw-cons x ((flip x :: w) , red) == w , red' rw-cons-flip (inl x) w _ _ with dec x x rw-cons-flip (inl x) w _ _ | inl x=x = ReducedWord=-out idp rw-cons-flip (inl x) w _ _ | inr x≠x = ⊥-rec (x≠x idp) rw-cons-flip (inr x) w _ _ with dec x x rw-cons-flip (inr x) w _ _ | inl x=x = ReducedWord=-out idp rw-cons-flip (inr x) w _ _ | inr x≠x = ⊥-rec (x≠x idp) rw-cons-cons-flip : ∀ x rw → rw-cons x (rw-cons (flip x) rw) == rw rw-cons-cons-flip x (nil , red) = rw-cons-flip x nil _ red rw-cons-cons-flip (inl x) ((inl y :: w) , red) with dec x y rw-cons-cons-flip (inl x) ((inl y :: w) , red) | inl x=y = rw-cons-reduced (inl x) w _ (transport! (λ z → is-reduced (inl z :: w)) x=y red) ∙ ReducedWord=-out (ap (λ z → inl z :: w) x=y) rw-cons-cons-flip (inl x) ((inl y :: w) , red) | inr x≠y = rw-cons-flip (inl x) (inl y :: w) (x≠y , red) red rw-cons-cons-flip (inl x) ((inr y :: w) , red) = rw-cons-flip (inl x) (inr y :: w) red red rw-cons-cons-flip (inr x) ((inl y :: w) , red) = rw-cons-flip (inr x) (inl y :: w) red red rw-cons-cons-flip (inr x) ((inr y :: w) , red) with dec x y rw-cons-cons-flip (inr x) ((inr y :: w) , red) | inl x=y = rw-cons-reduced (inr x) w _ (transport! (λ z → is-reduced (inr z :: w)) x=y red) ∙ ReducedWord=-out (ap (λ z → inr z :: w) x=y) rw-cons-cons-flip (inr x) ((inr y :: w) , red) | inr x≠y = rw-cons-flip (inr x) (inr y :: w) (x≠y , red) red rw-++-cons : ∀ x rw₁ rw₂ → rw-++ (rw-cons x rw₁) rw₂ == rw-cons x (rw-++ rw₁ rw₂) rw-++-cons x (nil , _) rw₂ = idp rw-++-cons (inl x) ((inl y :: w₁) , _) rw₂ = idp rw-++-cons (inl x) ((inr y :: w₁) , _) rw₂ with dec x y rw-++-cons (inl x) ((inr y :: w₁) , _) rw₂ | inl p rewrite p = ! (rw-cons-cons-flip (inl y) (rw-++' w₁ rw₂)) rw-++-cons (inl x) ((inr y :: w₁) , _) rw₂ | inr ¬p = idp rw-++-cons (inr x) ((inl y :: w₁) , _) rw₂ with dec x y rw-++-cons (inr x) ((inl y :: w₁) , _) rw₂ | inl p rewrite p = ! (rw-cons-cons-flip (inr y) (rw-++' w₁ rw₂)) rw-++-cons (inr x) ((inl y :: w₁) , _) rw₂ | inr ¬p = idp rw-++-cons (inr x) ((inr y :: w₁) , _) rw₂ = idp rw-++-assoc' : ∀ w₁ rw₂ rw₃ → rw-++ (rw-++' w₁ rw₂) rw₃ == rw-++' w₁ (rw-++' (fst rw₂) rw₃) rw-++-assoc' nil rw₂ rw = idp rw-++-assoc' (x :: w₁) rw₂ rw₃ = rw-++-cons x (rw-++' w₁ rw₂) rw₃ ∙ ap (rw-cons x) (rw-++-assoc' w₁ rw₂ rw₃) -- inv abstract head2-is-reduced : ∀ x y w → is-reduced (x :: y :: w) → is-reduced (x :: y :: nil) head2-is-reduced (inl x) (inl y) w red = lift tt head2-is-reduced (inl x) (inr y) w red = fst red , lift tt head2-is-reduced (inr x) (inl y) w red = fst red , lift tt head2-is-reduced (inr x) (inr y) w red = lift tt cons-is-reduced : ∀ x y w → is-reduced (x :: y :: nil) → is-reduced (y :: w) → is-reduced (x :: y :: w) cons-is-reduced (inl x) (inl y) _ _ red₂ = red₂ cons-is-reduced (inl x) (inr y) _ red₁ red₂ = fst red₁ , red₂ cons-is-reduced (inr x) (inl y) _ red₁ red₂ = fst red₁ , red₂ cons-is-reduced (inr x) (inr y) _ _ red₂ = red₂ ++-is-reduced : ∀ w₁ x w₂ → is-reduced (w₁ ++ (x :: nil)) → is-reduced (x :: w₂) → is-reduced ((w₁ ++ (x :: nil)) ++ w₂) ++-is-reduced nil _ _ _ red₂ = red₂ ++-is-reduced (x :: nil) y w₂ red₁ red₂ = cons-is-reduced x y w₂ red₁ red₂ ++-is-reduced (x :: y :: w₁) z w₂ red₁ red₂ = cons-is-reduced x y ((w₁ ++ (z :: nil)) ++ w₂) (head2-is-reduced x y (w₁ ++ (z :: nil)) red₁) (++-is-reduced (y :: w₁) z w₂ (tail-is-reduced x (y :: w₁ ++ (z :: nil)) red₁) red₂) swap2-is-reduced : ∀ x y → is-reduced (x :: y :: nil) → is-reduced (y :: x :: nil) swap2-is-reduced (inl x) (inl y) red = lift tt swap2-is-reduced (inl x) (inr y) red = fst red ∘ ! , lift tt swap2-is-reduced (inr x) (inl y) red = fst red ∘ ! , lift tt swap2-is-reduced (inr x) (inr y) red = lift tt reverse-is-reduced : ∀ w → is-reduced w → is-reduced (reverse w) reverse-is-reduced nil red = red reverse-is-reduced (x :: nil) red = red reverse-is-reduced (x :: y :: w) red = ++-is-reduced (reverse w) y (x :: nil) (reverse-is-reduced (y :: w) (tail-is-reduced x (y :: w) red)) (swap2-is-reduced x y (head2-is-reduced x y w red)) flip2-is-reduced : ∀ x y → is-reduced (x :: y :: nil) → is-reduced (flip x :: flip y :: nil) flip2-is-reduced (inl x) (inl y) red = red flip2-is-reduced (inl x) (inr y) red = red flip2-is-reduced (inr x) (inl y) red = red flip2-is-reduced (inr x) (inr y) red = red Word-flip-is-reduced : ∀ w → is-reduced w → is-reduced (Word-flip w) Word-flip-is-reduced nil red = red Word-flip-is-reduced (x :: nil) red = red Word-flip-is-reduced (x :: y :: w) red = cons-is-reduced (flip x) (flip y) (Word-flip w) (flip2-is-reduced x y (head2-is-reduced x y w red)) (Word-flip-is-reduced (y :: w) (tail-is-reduced x (y :: w) red)) rw-inv : ReducedWord → ReducedWord rw-inv (w , red) = reverse (Word-flip w) , reverse-is-reduced (Word-flip w) (Word-flip-is-reduced w red) abstract rw-inv-l-lemma : ∀ w₁ x w₂ (red₂ : is-reduced (x :: w₂)) (red₂' : is-reduced w₂) → rw-++' (w₁ ++ (flip x :: nil)) ((x :: w₂) , red₂) == rw-++' w₁ (w₂ , red₂') rw-inv-l-lemma nil (inl x) w₂ _ _ with dec x x rw-inv-l-lemma nil (inl x) w₂ _ _ | inl p = ReducedWord=-out idp rw-inv-l-lemma nil (inl x) w₂ _ _ | inr ¬p = ⊥-rec (¬p idp) rw-inv-l-lemma nil (inr x) w₂ _ _ with dec x x rw-inv-l-lemma nil (inr x) w₂ _ _ | inl p = ReducedWord=-out idp rw-inv-l-lemma nil (inr x) w₂ _ _ | inr ¬p = ⊥-rec (¬p idp) rw-inv-l-lemma (x :: w₁) y w₂ red₂ red₂' = ap (rw-cons x) (rw-inv-l-lemma w₁ y w₂ red₂ red₂') rw-inv-l' : ∀ w (red : is-reduced w) → rw-++' (reverse (Word-flip w)) (w , red) == nil , lift tt rw-inv-l' nil _ = idp rw-inv-l' (x :: w) red = rw-inv-l-lemma (reverse (Word-flip w)) x w red (tail-is-reduced x w red) ∙ rw-inv-l' w (tail-is-reduced x w red) suffix-is-reduced : ∀ w₁ w₂ → is-reduced (w₁ ++ w₂) → is-reduced w₂ suffix-is-reduced nil w₂ red = red suffix-is-reduced (x :: w₁) w₂ red = suffix-is-reduced w₁ w₂ $ tail-is-reduced x (w₁ ++ w₂) red ReducedWord-group-struct : GroupStructure ReducedWord ReducedWord-group-struct = record { ident = nil , lift tt ; inv = rw-inv ; comp = rw-++ ; unit-l = λ _ → idp ; assoc = λ rw → rw-++-assoc' (fst rw) ; inv-l = uncurry rw-inv-l' } ReducedWord-group : Group i ReducedWord-group = group _ ReducedWord-group-struct private abstract QuotWordRel-cons : ∀ x w₂ (red₂ : is-reduced w₂) → QuotWordRel (x :: w₂) (fst (rw-cons x (w₂ , red₂))) QuotWordRel-cons x nil _ = qwr-refl idp QuotWordRel-cons (inl x) (inl y :: w) _ = qwr-refl idp QuotWordRel-cons (inl x) (inr y :: w) _ with dec x y QuotWordRel-cons (inl x) (inr y :: w) _ | inl x=y rewrite x=y = qwr-flip (inl y) w QuotWordRel-cons (inl x) (inr y :: w) _ | inr x≠y = qwr-refl idp QuotWordRel-cons (inr x) (inl y :: w) _ with dec x y QuotWordRel-cons (inr x) (inl y :: w) _ | inl x=y rewrite x=y = qwr-flip (inr y) w QuotWordRel-cons (inr x) (inl y :: w) _ | inr x≠y = qwr-refl idp QuotWordRel-cons (inr x) (inr y :: w) _ = qwr-refl idp QuotWordRel-++ : ∀ w₁ rw₂ → QuotWordRel (w₁ ++ fst rw₂) (fst (rw-++' w₁ rw₂)) QuotWordRel-++ nil _ = qwr-refl idp QuotWordRel-++ (x :: w₁) rw₂ = qwr-trans (qwr-cons x (QuotWordRel-++ w₁ rw₂)) $ uncurry (QuotWordRel-cons x) (rw-++' w₁ rw₂) -- freeness ReducedWord-to-FreeGroup : ReducedWord-group →ᴳ FreeGroup A ReducedWord-to-FreeGroup = group-hom (λ rw → qw[ fst rw ]) (λ rw₁ rw₂ → ! $ quot-rel $ QuotWordRel-++ (fst rw₁) rw₂) private abstract reduce-emap : ∀ {w₁ w₂} → QuotWordRel w₁ w₂ → reduce w₁ == reduce w₂ reduce-emap (qwr-refl p) = ap reduce p reduce-emap (qwr-trans qwr₁ qwr₂) = reduce-emap qwr₁ ∙ reduce-emap qwr₂ reduce-emap (qwr-sym qwr) = ! (reduce-emap qwr) reduce-emap (qwr-cons x qwr) = ap (rw-cons x) (reduce-emap qwr) reduce-emap (qwr-flip x w) = rw-cons-cons-flip x (reduce w) to = GroupHom.f ReducedWord-to-FreeGroup from : QuotWord A → ReducedWord from = QuotWord-rec reduce reduce-emap abstract QuotWordRel-reduce : ∀ w → QuotWordRel w (fst (reduce w)) QuotWordRel-reduce nil = qwr-refl idp QuotWordRel-reduce (x :: w) = qwr-trans (qwr-cons x (QuotWordRel-reduce w)) $ uncurry (QuotWordRel-cons x) (reduce w) to-from : ∀ qw → to (from qw) == qw to-from = QuotWord-elim (λ w → ! $ quot-rel $ QuotWordRel-reduce w) (λ _ → prop-has-all-paths-↓) from-to : ∀ rw → from (to rw) == rw from-to = Group.unit-r ReducedWord-group ReducedWord-iso-FreeGroup : ReducedWord-group ≃ᴳ FreeGroup A ReducedWord-iso-FreeGroup = ReducedWord-to-FreeGroup , is-eq to from to-from from-to
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1726.asm
ljhsiun2/medusa
9
104012
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1726.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0x5820, %r13 nop nop nop cmp $7440, %r15 vmovups (%r13), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %r11 add %r9, %r9 lea addresses_normal_ht+0x7900, %r11 nop sub $18762, %r9 vmovups (%r11), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi nop nop nop nop mfence lea addresses_D_ht+0x3924, %rsi lea addresses_UC_ht+0x8c90, %rdi clflush (%rdi) inc %r11 mov $96, %rcx rep movsb nop add %r15, %r15 lea addresses_normal_ht+0x19fe0, %rsi lea addresses_A_ht+0x19420, %rdi nop nop inc %rax mov $26, %rcx rep movsq nop nop nop sub $30014, %r15 lea addresses_D_ht+0x46c0, %rcx nop xor $49851, %r13 mov $0x6162636465666768, %r9 movq %r9, %xmm7 movups %xmm7, (%rcx) nop add $44859, %r9 lea addresses_A_ht+0x11a00, %r13 nop nop nop nop sub %r9, %r9 movb (%r13), %r15b nop sub %rax, %rax lea addresses_A_ht+0xa750, %rsi lea addresses_normal_ht+0x169e0, %rdi nop nop nop nop sub $50039, %r15 mov $4, %rcx rep movsl nop nop nop nop sub %r13, %r13 lea addresses_UC_ht+0x13820, %rsi lea addresses_WT_ht+0x9fa0, %rdi nop nop nop nop nop add $52857, %rax mov $79, %rcx rep movsq nop cmp $23562, %r13 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rdi push %rsi // Faulty Load lea addresses_PSE+0x14020, %r10 nop nop nop cmp %rsi, %rsi movb (%r10), %r11b lea oracles, %r10 and $0xff, %r11 shlq $12, %r11 mov (%r10,%r11,1), %r11 pop %rsi pop %rdi pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
inet-tcp.ads
annexi-strayline/ASAP-INET
0
15611
<filename>inet-tcp.ads ------------------------------------------------------------------------------ -- -- -- Internet Protocol Suite Package -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- 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 copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; use Ada.Streams; with INET.IP; private with Interfaces.C; private with INET.Internal.UNIX_Sockets; package INET.TCP is TCP_Timeout : exception; TCP_Lookup_Failed : exception; TCP_Buffer_Full : exception; TCP_Connection_Reset : exception; TCP_Connection_Refused : exception; TCP_Host_Unreachable : exception; TCP_Net_Unreachable : exception; TCP_System_Error : exception; TCP_Bind_Unauthorized : exception; TCP_Bind_Occupied : exception; TCP_Listener_Not_Bound : exception; type TCP_Port is range 0 .. 2**16 - 1; -- IETF RFC 793/STD 7, Section 3.1 -------------------- -- TCP_Connection -- -------------------- type TCP_Connection is limited new Root_Stream_Type with private; -- TCP_Connection objects are NOT task-safe. -- Stream Properties -- ----------------------- overriding procedure Read (Stream: in out TCP_Connection; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); -- Read attempts to read the entire Item buffer from the connection. If -- an error occurs, an exception is propegated any any partially read data -- is lost. This was done to provide more useful error information during -- stream reads, since simply "ending the stream" by setting Last to less -- than Item'Last would not give an indication as to what happened, and in -- most cases the read data would be lost anyways in such a case. procedure Read_Immediate (Stream: in out TCP_Connection; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); -- Attempts to receive as much of Item as is currently available in the -- operating system's buffer. -- -- Read_Immediate does not block, and does not raise any TCP_ series -- exceptions. overriding procedure Write (Stream: in out TCP_Connection; Item : in Stream_Element_Array); -- If a timeout occurs due to Set_Read_Timeout being set, Write will raise -- TCP_Timeout. It is possible that some of Item will have been transmitted. procedure Write_Immediate (Stream: in out TCP_Connection; Item : in Stream_Element_Array; Last : out Stream_Element_Offset); -- Attempts to write as much of Item as can be placed in the operating -- system's buffer. -- -- Write_Immediate does not block, and does not raise TCP_ series exceptions. -- Connection Properties -- --------------------------- function Destination_Address (Connection: TCP_Connection) return IP.IP_Address; function Destination_Port (Connection: TCP_Connection) return TCP_Port; -- For accepted connections, these will be for the client -- Timeout Properties -- ------------------------ procedure Read_Timeout (Connection: in out TCP_Connection; Timeout : in Duration); procedure Read_Never_Timeout (Connection: in out TCP_Connection); procedure Write_Timeout (Connection: in out TCP_Connection; Timeout : in Duration); procedure Write_Never_Timeout (Connection: in out TCP_Connection); -- This setting is specific to the TCP_Connection object, and persists -- across connections. -- -- If Read/Write_Timeout are set to 0.0, calls to Read/Write will be -- equivalent to Read/Write_Immediate. For Ada stream 'Read invocations, -- this means that insufficient data will result in an End_Error exception, -- and the data will be lost. In the case of 'Write invocations, a -- TCP_Buffer_Full exception is explicitly raised if the write was not -- completed. -- -- The internal implementation of TCP_Connection timeouts is designed to be -- resistent to "Slowloris" attacks, particularily when reading Strings or -- to simple buffers directly. The timeout is absolute for each call to Read -- resp Write. The timer is NOT reset upon receipt of data, but instead sets -- a bound to the total duration of a Read resp Write operation. -- Connection_Management -- --------------------------- procedure Connect (Connection: in out TCP_Connection; Address : in IP.IP_Address; Port : in TCP_Port); procedure Connect (Connection: in out TCP_Connection; Host_Name : in String; Port : in TCP_Port) with Pre'Class => Host_Name'Length > 0; procedure Connect (Connection : in out TCP_Connection; Host_Name : in String; Port : in TCP_Port; Version : in IP.IP_Version) with Pre'Class => Host_Name'Length > 0; -- Attempts to connect a TCP_Connection object to the specified endpoint. -- -- If Connection is already connected, Shutdown is invoked, and the -- existing connection is destroyed. This happens regardless of the outcome -- of the subsequent connection attempt. -- -- When obtaining the address vi a Host_Name, if Version is specified, -- only address of that IP version will be used to complete the connection. -- Otherwise, the first address returned by the lookup is used. -- -- If the connection fails, the appropriate TCP_ exception is raised. procedure Shutdown (Connection: in out TCP_Connection); procedure Shutdown_Read (Connection: in out TCP_Connection); procedure Shutdown_Write (Connection: in out TCP_Connection); -- See man page shutdown(2) ------------------ -- TCP_Listener -- ------------------ type TCP_Listener (Queue_Size: Positive) is tagged limited private; -- TCP_Listener objects ARE task-safe -- -- Queue_Size is the number of connections that can be pending Dequeue -- on the listener. This is often known as the "backlog". function Is_Bound (Listener: TCP_Listener) return Boolean; -- Returns True iff the Listener is currently bound to an address -- or socket procedure Bind (Listener: in out TCP_Listener; Address : in IP.IP_Address; Port : in TCP_Port) with Pre'Class => not Listener.Is_Bound; -- Attempts to bind a listener to the provided Address and Port. -- -- The Bind Address determins the IP version of the listener, and thus -- can only be executed once. A listener cannot be unbound. -- -- -- All Possible Exceptions -- -- * Program_Error : Listener is already bound. -- * TCP_Bind_Unauthorized: The operating system did not permit binding to -- the specified address/port -- * TCP_Bind_Occupied : A different listener is already bound to the -- specified address/port -- * TCP_System_Error : An unexpected error occured procedure Dequeue (Listener : in out TCP_Listener; Connection: in out TCP_Connection'Class) with Pre'Class => Listener.Is_Bound; function Dequeue (Listener: in out TCP_Listener) return TCP_Connection'Class with Pre'Class => Listener.Is_Bound; -- Waits for a connection to become available on Listener. -- -- If the Precondition is not held, TCP_Listener_Not_Bound is raised, -- otherwise, unexpected errors result in 1TCP_System_Error. -- -- If Connection is already connected, Shutdown is invoked and the -- connection is destroyed immediately on entry into Dequeue, before -- waiting. -- -- It might not be wise to have multiple tasks waiting on the Dequeue of a -- single TCP_Listener. Due to the underlying system call, this should work -- fine, but the behaviour might not be reliable. It is probably better to -- dequeue from one task and then dispatch the connections to a queue of -- form. private package UNIX_Sockets renames Internal.UNIX_Sockets; use type UNIX_Sockets.Transport_Protocol; type TCP_Connection is limited new Root_Stream_Type with record Socket : UNIX_Sockets.UNIX_Socket (UNIX_Sockets.TCP); Destination_Address: IP.IP_Address; Destination_Port : TCP_Port; Read_Does_Timeout : Boolean := False; Write_Does_Timeout: Boolean := False; -- True means there is a timeout Read_Timeout : Duration := 0.0; Write_Timeout: Duration := 0.0; -- A value of 0.0 when Read/Write_Does_Timeout is False means -- that Read/Write are analogous to calls to Read/Write_Immediate end record; -- Some generic, TCP_Connection-specific implementations of Read/Write. -- These are provided so that child extension packages, such as TLS, can -- override Read/Write to use alternate calls for the actual read/write -- operation, while re-using the code for polling and checking for timeout generic type Connection_Type is limited new TCP_Connection with private; with procedure Connection_Receive_Immediate (Connection: in out Connection_Type; Buffer : out Stream_Element_Array; Last : out Stream_Element_Offset; Status : out UNIX_Sockets.Operation_Status; Errno : out Interfaces.C.int); procedure Generic_Read (Stream: in out Connection_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); generic type Connection_Type is limited new TCP_Connection with private; with procedure Connection_Send_Immediate (Connection: in out Connection_Type; Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Status : out UNIX_Sockets.Operation_Status; Errno : out Interfaces.C.int); procedure Generic_Write (Stream: in out Connection_Type; Item : in Stream_Element_Array); protected type Listener_Bound_Flag is procedure Set_Bound; function Is_Bound return Boolean; private Bound_Flag: Boolean := False; end Listener_Bound_Flag; type TCP_Listener (Queue_Size: Positive) is tagged limited record Bound_Flag: Listener_Bound_Flag; Socket : UNIX_Sockets.UNIX_Socket (UNIX_Sockets.TCP); end record; end INET.TCP;
P6/data_P6/testpoint/testpoint34.asm
alxzzhou/BUAA_CO_2020
1
17328
ori $1, $0, 7 ori $2, $0, 2 ori $3, $0, 2 ori $4, $0, 3 sw $4, 0($0) sw $3, 4($0) sw $2, 8($0) sw $1, 12($0) sw $2, 16($0) sw $3, 20($0) sw $2, 24($0) sw $2, 28($0) sw $3, 32($0) sw $2, 36($0) sw $1, 40($0) sw $2, 44($0) sw $3, 48($0) sw $4, 52($0) sw $4, 56($0) sw $2, 60($0) sw $3, 64($0) sw $4, 68($0) sw $2, 72($0) sw $1, 76($0) sw $1, 80($0) sw $4, 84($0) sw $1, 88($0) sw $4, 92($0) sw $3, 96($0) sw $3, 100($0) sw $2, 104($0) sw $2, 108($0) sw $3, 112($0) sw $2, 116($0) sw $3, 120($0) sw $4, 124($0) blez $2, TAG1 lh $2, 0($2) bltz $2, TAG1 multu $2, $2 TAG1: lhu $1, 0($2) mtlo $2 mfhi $1 mfhi $4 TAG2: mflo $3 beq $4, $4, TAG3 sb $4, 0($3) lh $3, 0($3) TAG3: mthi $3 slti $3, $3, 5 mtlo $3 mtlo $3 TAG4: lb $4, 0($3) sb $3, 0($3) mthi $3 mfhi $2 TAG5: xori $3, $2, 0 blez $2, TAG6 ori $1, $2, 2 bgtz $1, TAG6 TAG6: sb $1, 0($1) mtlo $1 lb $3, 0($1) srlv $1, $3, $1 TAG7: bne $1, $1, TAG8 sw $1, 0($1) sw $1, 0($1) sw $1, 0($1) TAG8: mflo $3 srl $3, $3, 14 mthi $3 mflo $1 TAG9: mtlo $1 mfhi $1 bne $1, $1, TAG10 mult $1, $1 TAG10: mfhi $1 multu $1, $1 nor $4, $1, $1 mthi $1 TAG11: divu $4, $4 lw $4, 1($4) mflo $3 mthi $3 TAG12: sltu $4, $3, $3 mfhi $1 bgez $3, TAG13 subu $1, $1, $4 TAG13: mflo $3 beq $3, $3, TAG14 mflo $3 mult $1, $3 TAG14: lbu $2, 0($3) sra $4, $2, 7 multu $2, $4 multu $3, $4 TAG15: lh $2, 0($4) bltz $2, TAG16 lh $1, 0($4) multu $2, $2 TAG16: nor $1, $1, $1 sh $1, 1($1) lw $2, 1($1) subu $3, $2, $1 TAG17: bltz $3, TAG18 multu $3, $3 lui $4, 0 bgez $4, TAG18 TAG18: sub $1, $4, $4 mthi $1 sh $1, 0($1) sb $4, 0($4) TAG19: mult $1, $1 bne $1, $1, TAG20 mthi $1 bne $1, $1, TAG20 TAG20: mflo $1 mfhi $2 lw $4, 0($2) nor $3, $1, $4 TAG21: bne $3, $3, TAG22 mfhi $3 sw $3, 0($3) mtlo $3 TAG22: lui $4, 7 sll $0, $0, 0 bgtz $4, TAG23 mthi $3 TAG23: mflo $4 mflo $3 bgtz $4, TAG24 sh $3, 0($3) TAG24: srl $4, $3, 10 lbu $2, 0($3) lui $3, 14 bgez $3, TAG25 TAG25: multu $3, $3 lui $4, 11 blez $3, TAG26 sll $0, $0, 0 TAG26: bne $4, $4, TAG27 sll $0, $0, 0 blez $2, TAG27 mult $2, $2 TAG27: mult $2, $2 mtlo $2 lui $4, 3 addu $3, $2, $4 TAG28: lui $3, 12 mthi $3 divu $3, $3 beq $3, $3, TAG29 TAG29: subu $1, $3, $3 mtlo $3 mult $1, $1 lui $4, 2 TAG30: mflo $2 andi $4, $4, 1 sub $2, $4, $4 lui $2, 9 TAG31: mult $2, $2 mflo $2 bne $2, $2, TAG32 sll $2, $2, 13 TAG32: srav $4, $2, $2 mflo $3 sh $2, 0($3) add $4, $3, $4 TAG33: mthi $4 sh $4, 0($4) mult $4, $4 bne $4, $4, TAG34 TAG34: sra $4, $4, 8 slti $3, $4, 5 mthi $3 addiu $4, $4, 8 TAG35: mthi $4 bne $4, $4, TAG36 xori $4, $4, 8 lh $2, 0($4) TAG36: mthi $2 andi $1, $2, 3 sllv $4, $1, $1 bltz $1, TAG37 TAG37: or $1, $4, $4 multu $4, $4 lbu $2, 0($4) lw $4, 0($2) TAG38: lui $4, 4 beq $4, $4, TAG39 sll $0, $0, 0 mflo $2 TAG39: andi $3, $2, 10 sllv $4, $2, $3 mthi $2 multu $2, $2 TAG40: lui $3, 8 bltz $4, TAG41 mtlo $3 sltu $2, $4, $3 TAG41: beq $2, $2, TAG42 div $2, $2 sltu $4, $2, $2 beq $2, $2, TAG42 TAG42: lbu $4, 0($4) lh $3, 0($4) lui $1, 8 bne $1, $1, TAG43 TAG43: mfhi $3 lui $1, 14 mflo $2 mfhi $1 TAG44: mtlo $1 sb $1, 0($1) lui $4, 9 mthi $1 TAG45: bgez $4, TAG46 srav $4, $4, $4 mtlo $4 bltz $4, TAG46 TAG46: lui $1, 14 srlv $4, $1, $4 bltz $4, TAG47 srlv $1, $4, $1 TAG47: bne $1, $1, TAG48 sll $0, $0, 0 mtlo $2 sll $0, $0, 0 TAG48: sltiu $4, $3, 1 beq $3, $4, TAG49 slt $4, $3, $3 sllv $2, $4, $4 TAG49: sb $2, 0($2) sw $2, 0($2) mfhi $2 lui $2, 12 TAG50: xori $1, $2, 11 mflo $4 multu $4, $1 bgez $4, TAG51 TAG51: lui $2, 13 mflo $4 subu $4, $4, $4 mthi $4 TAG52: mfhi $3 mflo $3 mthi $3 multu $4, $3 TAG53: beq $3, $3, TAG54 andi $1, $3, 12 sw $1, 0($3) bne $1, $3, TAG54 TAG54: mfhi $2 div $2, $1 sb $2, 0($1) blez $2, TAG55 TAG55: addu $3, $2, $2 multu $3, $3 mflo $2 lui $2, 2 TAG56: lui $2, 0 beq $2, $2, TAG57 slt $4, $2, $2 mfhi $2 TAG57: sra $1, $2, 9 lui $3, 13 sh $3, 0($1) lui $1, 5 TAG58: sll $3, $1, 3 sll $0, $0, 0 sll $4, $3, 9 bne $3, $1, TAG59 TAG59: mtlo $4 sll $0, $0, 0 sll $0, $0, 0 beq $4, $4, TAG60 TAG60: lui $3, 15 blez $3, TAG61 ori $1, $2, 15 mthi $3 TAG61: sb $1, 0($1) sb $1, 0($1) bne $1, $1, TAG62 lui $4, 5 TAG62: bgtz $4, TAG63 mult $4, $4 sh $4, 0($4) divu $4, $4 TAG63: blez $4, TAG64 sll $0, $0, 0 and $2, $4, $4 sltu $4, $2, $4 TAG64: mtlo $4 lui $3, 13 divu $3, $3 lui $3, 11 TAG65: lui $4, 11 or $4, $3, $3 mthi $3 sll $0, $0, 0 TAG66: bgez $4, TAG67 mflo $2 sb $2, 0($2) sh $4, 0($2) TAG67: subu $3, $2, $2 lui $3, 3 mtlo $3 mflo $3 TAG68: mflo $3 mtlo $3 andi $1, $3, 14 lh $4, 0($1) TAG69: sw $4, 0($4) beq $4, $4, TAG70 sll $4, $4, 11 lui $2, 7 TAG70: bltz $2, TAG71 mult $2, $2 mthi $2 beq $2, $2, TAG71 TAG71: mthi $2 mflo $3 lui $1, 6 multu $3, $1 TAG72: sll $0, $0, 0 bne $1, $1, TAG73 lui $3, 9 bgez $1, TAG73 TAG73: srl $1, $3, 10 sh $1, -576($1) addiu $4, $3, 0 multu $3, $4 TAG74: mflo $4 bltz $4, TAG75 mfhi $1 sb $1, 0($1) TAG75: mfhi $1 bgez $1, TAG76 multu $1, $1 divu $1, $1 TAG76: mfhi $3 beq $1, $3, TAG77 xor $2, $1, $3 lb $4, 0($1) TAG77: mfhi $4 sw $4, 0($4) bltz $4, TAG78 mtlo $4 TAG78: lui $3, 13 beq $3, $4, TAG79 sll $0, $0, 0 srav $2, $4, $3 TAG79: mthi $2 nor $4, $2, $2 mthi $4 mfhi $1 TAG80: divu $1, $1 beq $1, $1, TAG81 slt $1, $1, $1 mflo $3 TAG81: divu $3, $3 lui $2, 0 bltz $3, TAG82 subu $4, $2, $3 TAG82: or $4, $4, $4 mtlo $4 mfhi $4 lb $2, 0($4) TAG83: mtlo $2 xori $1, $2, 8 lui $4, 13 mflo $4 TAG84: multu $4, $4 mult $4, $4 lb $3, 0($4) mult $3, $4 TAG85: sh $3, 0($3) mult $3, $3 bne $3, $3, TAG86 sh $3, 0($3) TAG86: mflo $3 or $1, $3, $3 sra $1, $3, 4 mult $1, $1 TAG87: mthi $1 lw $1, 0($1) mult $1, $1 sb $1, 0($1) TAG88: mthi $1 sh $1, 0($1) mflo $3 mflo $4 TAG89: addiu $3, $4, 11 ori $1, $4, 1 sh $4, 0($4) bgtz $3, TAG90 TAG90: mfhi $1 mthi $1 sltiu $3, $1, 5 subu $4, $3, $3 TAG91: multu $4, $4 multu $4, $4 lb $3, 0($4) lui $1, 6 TAG92: mthi $1 xori $3, $1, 3 sltu $4, $3, $3 mtlo $1 TAG93: sb $4, 0($4) ori $1, $4, 15 mfhi $1 lui $1, 2 TAG94: beq $1, $1, TAG95 mult $1, $1 srav $1, $1, $1 sra $4, $1, 9 TAG95: mflo $3 mflo $3 beq $3, $3, TAG96 multu $3, $3 TAG96: beq $3, $3, TAG97 mfhi $3 sub $2, $3, $3 bne $3, $3, TAG97 TAG97: lui $2, 8 addiu $1, $2, 9 mtlo $2 mthi $2 TAG98: sllv $2, $1, $1 multu $2, $1 subu $3, $2, $1 bgez $2, TAG99 TAG99: mtlo $3 srl $2, $3, 3 bgtz $2, TAG100 sll $0, $0, 0 TAG100: divu $3, $3 lui $1, 11 and $2, $1, $1 mfhi $1 TAG101: beq $1, $1, TAG102 lbu $4, 0($1) mthi $1 mfhi $3 TAG102: mflo $1 sll $0, $0, 0 lb $1, 0($4) sh $1, 0($1) TAG103: sll $1, $1, 12 mthi $1 sw $1, 0($1) xori $2, $1, 8 TAG104: ori $3, $2, 5 sb $3, 0($3) mtlo $3 lui $3, 13 TAG105: subu $1, $3, $3 blez $3, TAG106 mthi $3 bgtz $1, TAG106 TAG106: subu $3, $1, $1 lui $1, 14 lui $3, 11 lui $4, 8 TAG107: mfhi $2 bne $2, $2, TAG108 slti $3, $4, 6 mthi $2 TAG108: bne $3, $3, TAG109 addi $2, $3, 2 mthi $3 multu $3, $2 TAG109: slti $1, $2, 2 bne $2, $1, TAG110 lw $4, 0($1) xor $3, $4, $1 TAG110: mthi $3 sb $3, 0($3) lhu $3, 0($3) blez $3, TAG111 TAG111: srlv $3, $3, $3 andi $2, $3, 2 slti $4, $2, 3 sb $4, 0($3) TAG112: mtlo $4 srl $3, $4, 3 beq $3, $3, TAG113 mtlo $3 TAG113: sw $3, 0($3) lui $4, 13 bltz $3, TAG114 addiu $3, $3, 1 TAG114: lui $4, 11 sll $0, $0, 0 lui $1, 8 mtlo $3 TAG115: bltz $1, TAG116 sll $0, $0, 0 nor $4, $1, $1 and $1, $1, $1 TAG116: mflo $1 sb $1, 0($1) lb $4, 0($1) blez $1, TAG117 TAG117: slti $4, $4, 13 lb $4, 0($4) ori $4, $4, 6 bltz $4, TAG118 TAG118: sltiu $2, $4, 9 mflo $2 mflo $1 div $4, $2 TAG119: beq $1, $1, TAG120 sb $1, 0($1) sb $1, 0($1) lhu $3, 0($1) TAG120: beq $3, $3, TAG121 mflo $4 multu $3, $3 mtlo $4 TAG121: bgez $4, TAG122 mtlo $4 srl $2, $4, 5 mflo $4 TAG122: mtlo $4 mthi $4 sb $4, 0($4) bgez $4, TAG123 TAG123: mtlo $4 mtlo $4 lui $4, 11 lui $3, 13 TAG124: mult $3, $3 lui $3, 13 sll $0, $0, 0 sll $0, $0, 0 TAG125: bltz $2, TAG126 lbu $1, 0($2) mthi $2 lbu $2, 0($2) TAG126: addu $1, $2, $2 sh $2, 0($1) srl $3, $1, 0 sh $3, 0($3) TAG127: divu $3, $3 mthi $3 srlv $1, $3, $3 addu $2, $3, $1 TAG128: srlv $3, $2, $2 bgez $3, TAG129 mfhi $3 div $3, $3 TAG129: mult $3, $3 bgtz $3, TAG130 mflo $2 mtlo $2 TAG130: mthi $2 or $2, $2, $2 blez $2, TAG131 mfhi $2 TAG131: blez $2, TAG132 nor $4, $2, $2 lh $3, 5($4) mflo $1 TAG132: sw $1, 0($1) lui $2, 10 mflo $2 sw $2, 0($2) TAG133: addu $1, $2, $2 lui $2, 11 divu $2, $1 andi $3, $2, 6 TAG134: bne $3, $3, TAG135 mtlo $3 lui $4, 11 beq $4, $4, TAG135 TAG135: lui $1, 0 mtlo $4 sll $0, $0, 0 ori $4, $4, 11 TAG136: mult $4, $4 mtlo $4 divu $4, $4 lui $4, 2 TAG137: andi $4, $4, 8 mthi $4 blez $4, TAG138 subu $2, $4, $4 TAG138: mthi $2 sw $2, 0($2) lui $2, 12 sll $0, $0, 0 TAG139: sltiu $1, $2, 12 mflo $4 sll $0, $0, 0 mtlo $2 TAG140: bltz $2, TAG141 lui $2, 7 addu $1, $2, $2 ori $2, $1, 13 TAG141: mthi $2 bne $2, $2, TAG142 lui $4, 1 addiu $4, $2, 13 TAG142: mflo $1 sll $0, $0, 0 lui $4, 11 sra $2, $4, 10 TAG143: beq $2, $2, TAG144 lui $1, 11 multu $1, $2 lui $2, 15 TAG144: divu $2, $2 sw $2, -704($2) lw $2, -704($2) sltu $2, $2, $2 TAG145: ori $1, $2, 5 mult $2, $2 lbu $3, 0($1) beq $2, $1, TAG146 TAG146: mfhi $4 sub $4, $4, $3 lui $1, 12 lbu $4, 0($3) TAG147: blez $4, TAG148 lui $3, 11 mflo $1 lui $2, 2 TAG148: slt $2, $2, $2 bgez $2, TAG149 sltiu $3, $2, 8 sra $3, $2, 14 TAG149: addiu $3, $3, 12 lb $3, 0($3) mtlo $3 addu $2, $3, $3 TAG150: mfhi $2 blez $2, TAG151 andi $2, $2, 9 lui $2, 7 TAG151: srl $4, $2, 9 mtlo $4 bne $2, $4, TAG152 mflo $4 TAG152: lui $1, 13 lh $1, 0($4) mtlo $1 addu $2, $4, $1 TAG153: lui $3, 10 multu $2, $2 beq $3, $3, TAG154 sb $3, -704($2) TAG154: sll $0, $0, 0 mfhi $2 lb $3, -704($1) mflo $2 TAG155: bgez $2, TAG156 mflo $4 mflo $3 mtlo $4 TAG156: bgez $3, TAG157 multu $3, $3 multu $3, $3 srlv $2, $3, $3 TAG157: sll $2, $2, 5 nor $4, $2, $2 blez $2, TAG158 sll $0, $0, 0 TAG158: bne $4, $4, TAG159 lui $3, 4 nor $4, $3, $3 beq $4, $3, TAG159 TAG159: addiu $2, $4, 1 mthi $2 subu $2, $2, $4 slti $2, $4, 4 TAG160: lbu $3, 0($2) sb $3, 0($2) lbu $4, 0($2) lui $4, 6 TAG161: sll $0, $0, 0 sll $0, $0, 0 div $4, $3 lhu $1, -704($1) TAG162: sra $3, $1, 10 and $1, $3, $3 lui $1, 11 sra $1, $1, 2 TAG163: bne $1, $1, TAG164 sll $0, $0, 0 srlv $1, $1, $1 sll $0, $0, 0 TAG164: srlv $4, $2, $2 srl $3, $4, 7 andi $2, $4, 11 lui $2, 13 TAG165: bgtz $2, TAG166 mflo $2 sb $2, 0($2) blez $2, TAG166 TAG166: div $2, $2 sll $0, $0, 0 sll $0, $0, 0 multu $1, $2 TAG167: divu $1, $1 bgtz $1, TAG168 mthi $1 beq $1, $1, TAG168 TAG168: lui $1, 1 bne $1, $1, TAG169 sll $0, $0, 0 beq $1, $1, TAG169 TAG169: mflo $1 sll $0, $0, 0 div $2, $2 mtlo $2 TAG170: bne $1, $1, TAG171 lbu $1, 0($1) lui $1, 13 mthi $1 TAG171: mthi $1 mflo $3 lui $2, 13 mflo $3 TAG172: addu $2, $3, $3 sll $0, $0, 0 bltz $2, TAG173 divu $3, $2 TAG173: sll $0, $0, 0 mult $2, $2 mthi $2 blez $2, TAG174 TAG174: subu $2, $2, $2 mflo $4 mult $4, $2 sllv $4, $2, $2 TAG175: sltiu $2, $4, 13 bne $2, $2, TAG176 mflo $3 slti $2, $3, 11 TAG176: mtlo $2 lui $1, 8 sb $1, 0($2) mtlo $2 TAG177: blez $1, TAG178 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG178: lhu $4, 0($3) mfhi $1 bgez $3, TAG179 mthi $1 TAG179: mfhi $4 multu $1, $1 sltiu $3, $4, 15 mfhi $3 TAG180: lui $3, 2 blez $3, TAG181 addu $1, $3, $3 sll $0, $0, 0 TAG181: bltz $2, TAG182 mflo $2 sh $2, 0($2) mflo $4 TAG182: bne $4, $4, TAG183 lui $4, 11 lui $1, 12 sll $0, $0, 0 TAG183: sll $0, $0, 0 subu $2, $4, $4 bgtz $4, TAG184 sra $3, $4, 1 TAG184: addu $3, $3, $3 bgtz $3, TAG185 lui $2, 2 divu $3, $2 TAG185: beq $2, $2, TAG186 sll $0, $0, 0 mthi $2 bltz $2, TAG186 TAG186: ori $4, $2, 8 sll $0, $0, 0 bgtz $2, TAG187 srlv $3, $4, $2 TAG187: sll $0, $0, 0 bne $4, $3, TAG188 mtlo $4 multu $3, $3 TAG188: lui $3, 14 divu $4, $3 xori $4, $4, 0 sll $0, $0, 0 TAG189: beq $4, $4, TAG190 mflo $4 subu $4, $4, $4 bgez $4, TAG190 TAG190: sh $4, 0($4) addiu $1, $4, 9 lui $3, 0 sh $4, 0($4) TAG191: lh $2, 0($3) lw $2, 0($2) mult $3, $2 mtlo $3 TAG192: lui $2, 3 mfhi $3 beq $3, $2, TAG193 mult $3, $2 TAG193: lui $4, 0 subu $2, $3, $3 sub $3, $2, $4 beq $3, $4, TAG194 TAG194: mthi $3 mflo $2 sb $3, 0($3) sltu $4, $3, $2 TAG195: bltz $4, TAG196 or $2, $4, $4 mtlo $4 lh $3, 0($4) TAG196: lui $4, 0 bltz $4, TAG197 mtlo $4 lbu $1, 0($4) TAG197: bne $1, $1, TAG198 sh $1, 0($1) blez $1, TAG198 sb $1, 0($1) TAG198: mflo $3 add $4, $3, $1 lw $2, 0($1) bne $3, $1, TAG199 TAG199: mflo $1 lhu $1, 0($2) bne $1, $1, TAG200 mtlo $1 TAG200: sll $2, $1, 7 mult $2, $1 sub $2, $1, $1 bgtz $2, TAG201 TAG201: multu $2, $2 lh $2, 0($2) sb $2, 0($2) sh $2, 0($2) TAG202: sh $2, 0($2) mthi $2 sb $2, 0($2) bne $2, $2, TAG203 TAG203: mfhi $4 sltu $1, $2, $2 multu $4, $1 lui $3, 13 TAG204: lui $3, 12 mflo $4 sb $3, 0($4) lui $4, 12 TAG205: beq $4, $4, TAG206 mflo $4 multu $4, $4 lui $1, 6 TAG206: multu $1, $1 sltu $4, $1, $1 mtlo $1 lhu $3, 0($4) TAG207: lw $1, 0($3) mfhi $4 mfhi $3 andi $4, $1, 3 TAG208: mflo $2 sra $4, $4, 13 lui $3, 5 blez $4, TAG209 TAG209: sll $0, $0, 0 lui $4, 1 lui $4, 2 lui $4, 6 TAG210: nor $1, $4, $4 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG211: mtlo $4 beq $4, $4, TAG212 sra $2, $4, 5 mfhi $4 TAG212: blez $4, TAG213 sll $0, $0, 0 mtlo $4 slt $3, $4, $4 TAG213: bgtz $3, TAG214 mfhi $3 sltiu $2, $3, 4 blez $2, TAG214 TAG214: sra $3, $2, 9 multu $3, $3 lb $4, 0($2) andi $3, $3, 2 TAG215: mult $3, $3 bne $3, $3, TAG216 mthi $3 lui $3, 1 TAG216: lui $2, 8 mtlo $3 addu $4, $3, $3 bgtz $2, TAG217 TAG217: sllv $4, $4, $4 slt $4, $4, $4 mthi $4 slti $4, $4, 1 TAG218: addu $1, $4, $4 lbu $3, 0($1) mult $1, $1 lbu $4, 0($4) TAG219: bne $4, $4, TAG220 addi $3, $4, 11 bgtz $4, TAG220 slti $2, $4, 7 TAG220: lui $1, 12 xori $2, $1, 0 sll $0, $0, 0 blez $2, TAG221 TAG221: mflo $4 mult $4, $4 multu $4, $4 sll $0, $0, 0 TAG222: divu $4, $4 divu $4, $4 sb $4, 0($4) lui $4, 15 TAG223: sll $0, $0, 0 mtlo $4 mthi $4 sll $0, $0, 0 TAG224: sll $0, $0, 0 sll $4, $4, 5 beq $4, $4, TAG225 sll $0, $0, 0 TAG225: divu $4, $4 addiu $4, $4, 5 sll $0, $0, 0 sll $0, $0, 0 TAG226: xori $3, $3, 8 lb $4, 0($3) lui $3, 10 lui $2, 0 TAG227: mthi $2 lui $1, 5 sh $2, 0($2) mthi $2 TAG228: srlv $3, $1, $1 bgez $1, TAG229 ori $3, $1, 7 slti $3, $1, 13 TAG229: lui $4, 10 bltz $3, TAG230 addu $3, $4, $4 srl $1, $4, 5 TAG230: mtlo $1 lbu $1, -20480($1) xori $2, $1, 15 srl $3, $2, 11 TAG231: sw $3, 0($3) lb $4, 0($3) or $1, $3, $4 mtlo $3 TAG232: mflo $4 mfhi $1 bne $1, $1, TAG233 multu $4, $1 TAG233: lw $2, 0($1) srl $3, $1, 8 beq $1, $1, TAG234 sltiu $4, $3, 13 TAG234: mflo $3 sra $4, $4, 9 multu $4, $4 bgez $4, TAG235 TAG235: sh $4, 0($4) multu $4, $4 mtlo $4 mfhi $3 TAG236: beq $3, $3, TAG237 multu $3, $3 addu $4, $3, $3 lui $1, 0 TAG237: lbu $1, 0($1) sltiu $4, $1, 6 mflo $2 mult $1, $4 TAG238: srav $4, $2, $2 beq $4, $4, TAG239 mtlo $4 slt $4, $2, $2 TAG239: mtlo $4 multu $4, $4 sb $4, 0($4) blez $4, TAG240 TAG240: lh $1, 0($4) bgtz $1, TAG241 sw $4, 0($4) sra $3, $1, 4 TAG241: mfhi $1 and $1, $3, $3 addiu $2, $3, 12 bgtz $1, TAG242 TAG242: lw $4, 0($2) lw $2, 0($2) bne $2, $2, TAG243 sll $0, $0, 0 TAG243: sb $3, 0($3) mtlo $3 blez $3, TAG244 lb $2, 0($3) TAG244: lui $1, 9 xori $3, $2, 10 sh $3, 0($2) slt $4, $2, $1 TAG245: addu $4, $4, $4 lh $1, 0($4) div $1, $4 addiu $3, $4, 10 TAG246: lhu $1, 0($3) mthi $3 lh $1, 0($3) ori $4, $1, 5 TAG247: slti $3, $4, 12 sh $3, -3335($4) slt $3, $3, $4 and $4, $3, $3 TAG248: sllv $1, $4, $4 divu $4, $4 mfhi $3 bgez $1, TAG249 TAG249: multu $3, $3 lbu $3, 0($3) sllv $3, $3, $3 add $1, $3, $3 TAG250: bgtz $1, TAG251 sh $1, 0($1) bne $1, $1, TAG251 sra $2, $1, 7 TAG251: sltu $1, $2, $2 lw $3, 0($1) lw $4, 0($2) sll $2, $4, 14 TAG252: beq $2, $2, TAG253 mthi $2 div $2, $2 divu $2, $2 TAG253: srl $2, $2, 10 multu $2, $2 andi $1, $2, 4 xor $4, $1, $2 TAG254: mtlo $4 beq $4, $4, TAG255 mflo $2 multu $4, $4 TAG255: sltiu $1, $2, 12 beq $2, $2, TAG256 srl $4, $2, 14 lhu $4, 0($4) TAG256: sub $3, $4, $4 mtlo $4 bltz $4, TAG257 addiu $4, $4, 15 TAG257: lui $1, 1 lui $3, 3 slt $2, $4, $4 sll $0, $0, 0 TAG258: mtlo $1 bne $1, $1, TAG259 mult $1, $1 mflo $2 TAG259: bne $2, $2, TAG260 mtlo $2 lb $2, 0($2) mtlo $2 TAG260: mflo $3 bne $3, $2, TAG261 lui $1, 11 lui $3, 5 TAG261: mfhi $2 lui $3, 13 mtlo $3 bne $2, $2, TAG262 TAG262: sll $2, $3, 0 srlv $1, $3, $2 lui $3, 8 mthi $3 TAG263: multu $3, $3 mfhi $1 mfhi $4 mtlo $1 TAG264: sll $2, $4, 1 bgez $2, TAG265 sb $2, 0($2) div $2, $4 TAG265: sh $2, 0($2) multu $2, $2 mflo $3 beq $2, $3, TAG266 TAG266: sb $3, -16384($3) sb $3, -16384($3) bltz $3, TAG267 multu $3, $3 TAG267: sll $0, $0, 0 sra $1, $3, 3 mfhi $3 slti $4, $2, 0 TAG268: lw $3, 0($4) lb $1, 0($4) bne $4, $1, TAG269 ori $2, $1, 5 TAG269: addiu $4, $2, 13 divu $4, $2 multu $2, $2 blez $4, TAG270 TAG270: sb $4, 0($4) sb $4, 0($4) bne $4, $4, TAG271 srav $2, $4, $4 TAG271: sw $2, 0($2) lui $1, 4 mflo $2 addu $4, $2, $1 TAG272: lui $3, 12 sllv $3, $4, $4 or $2, $3, $3 div $4, $2 TAG273: mfhi $3 beq $2, $3, TAG274 xor $2, $2, $2 sll $0, $0, 0 TAG274: sb $2, 0($2) bgtz $2, TAG275 sra $2, $2, 5 slt $2, $2, $2 TAG275: beq $2, $2, TAG276 sltu $4, $2, $2 srav $2, $2, $2 xor $3, $2, $2 TAG276: divu $3, $3 sll $0, $0, 0 beq $3, $3, TAG277 mthi $3 TAG277: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 slti $1, $3, 12 TAG278: lw $1, 0($1) bne $1, $1, TAG279 mfhi $1 slt $3, $1, $1 TAG279: blez $3, TAG280 sltiu $3, $3, 9 lui $3, 6 sw $3, 0($3) TAG280: multu $3, $3 subu $1, $3, $3 sub $2, $1, $1 div $3, $3 TAG281: lui $3, 2 lh $4, 0($2) sra $1, $4, 13 mflo $4 TAG282: lui $4, 3 bltz $4, TAG283 mthi $4 lui $1, 0 TAG283: sh $1, 0($1) lh $4, 0($1) lui $4, 4 sll $0, $0, 0 TAG284: mthi $4 mult $4, $4 mthi $4 bgtz $4, TAG285 TAG285: sll $0, $0, 0 lui $2, 9 srlv $1, $4, $2 sll $0, $0, 0 TAG286: mtlo $4 bne $4, $4, TAG287 sll $0, $0, 0 sll $0, $0, 0 TAG287: sll $0, $0, 0 sll $0, $0, 0 bne $2, $2, TAG288 lui $2, 0 TAG288: mthi $2 sra $2, $2, 2 slt $2, $2, $2 srlv $2, $2, $2 TAG289: mthi $2 srl $2, $2, 2 xori $3, $2, 7 mult $3, $2 TAG290: addiu $3, $3, 15 bltz $3, TAG291 lui $4, 2 sh $4, 0($3) TAG291: blez $4, TAG292 mtlo $4 bgtz $4, TAG292 sll $0, $0, 0 TAG292: sll $0, $0, 0 ori $4, $1, 8 sll $0, $0, 0 sra $1, $1, 0 TAG293: mfhi $2 sll $0, $0, 0 lui $1, 1 xori $2, $1, 0 TAG294: div $2, $2 mflo $1 sll $0, $0, 0 addiu $1, $1, 12 TAG295: bne $1, $1, TAG296 lb $1, 0($1) lui $2, 2 slti $2, $2, 1 TAG296: lui $4, 0 lhu $1, 0($2) sltu $2, $2, $1 bgez $2, TAG297 TAG297: xori $1, $2, 15 blez $1, TAG298 lui $1, 4 sll $0, $0, 0 TAG298: multu $1, $1 bgtz $1, TAG299 mtlo $1 bne $1, $1, TAG299 TAG299: div $1, $1 sll $0, $0, 0 slt $1, $1, $4 addiu $2, $4, 11 TAG300: sb $2, 0($2) mult $2, $2 blez $2, TAG301 mthi $2 TAG301: sra $3, $2, 12 divu $3, $2 lhu $1, 0($3) subu $4, $2, $2 TAG302: mtlo $4 sra $3, $4, 8 lui $4, 0 mthi $3 TAG303: multu $4, $4 multu $4, $4 bgtz $4, TAG304 mthi $4 TAG304: sh $4, 0($4) lb $4, 0($4) xor $2, $4, $4 beq $4, $4, TAG305 TAG305: lui $2, 10 mflo $3 mflo $2 sub $1, $3, $2 TAG306: andi $4, $1, 8 mtlo $1 slt $2, $1, $4 addiu $2, $1, 5 TAG307: mthi $2 andi $3, $2, 14 div $2, $3 beq $2, $3, TAG308 TAG308: mflo $3 lui $3, 7 bne $3, $3, TAG309 mflo $1 TAG309: mfhi $3 blez $3, TAG310 lui $4, 11 bgez $4, TAG310 TAG310: mfhi $3 lb $3, 0($3) mthi $4 mult $3, $3 TAG311: bltz $3, TAG312 subu $4, $3, $3 multu $4, $4 lui $1, 11 TAG312: bltz $1, TAG313 slt $2, $1, $1 mtlo $1 sll $0, $0, 0 TAG313: bne $2, $2, TAG314 lui $2, 5 bne $2, $2, TAG314 mfhi $3 TAG314: sh $3, 0($3) bltz $3, TAG315 srlv $1, $3, $3 addiu $3, $3, 1 TAG315: lbu $4, 0($3) sb $3, 0($3) lbu $3, 0($3) mult $3, $3 TAG316: sb $3, 0($3) mtlo $3 sb $3, 0($3) mthi $3 TAG317: bne $3, $3, TAG318 srav $3, $3, $3 srl $3, $3, 11 bgtz $3, TAG318 TAG318: ori $1, $3, 15 mtlo $1 ori $1, $1, 1 sltiu $1, $1, 2 TAG319: addu $3, $1, $1 bltz $3, TAG320 mtlo $1 multu $1, $1 TAG320: mflo $3 sltu $2, $3, $3 mthi $3 mfhi $1 TAG321: mtlo $1 lui $2, 14 mthi $1 blez $2, TAG322 TAG322: div $2, $2 sll $0, $0, 0 bne $2, $2, TAG323 xori $4, $2, 13 TAG323: lui $3, 11 multu $4, $4 or $2, $3, $3 mtlo $2 TAG324: lui $4, 1 sll $0, $0, 0 bne $4, $4, TAG325 mfhi $3 TAG325: mfhi $2 srlv $2, $3, $2 bltz $2, TAG326 mflo $4 TAG326: sll $0, $0, 0 bgtz $3, TAG327 sll $0, $0, 0 mflo $4 TAG327: sll $0, $0, 0 lbu $2, -196($3) nor $3, $4, $3 or $2, $4, $3 TAG328: srav $3, $2, $2 mtlo $2 mfhi $4 sw $4, 197($2) TAG329: lui $2, 11 slt $2, $4, $4 lh $3, 0($2) lui $4, 7 TAG330: div $4, $4 sll $0, $0, 0 mthi $4 bltz $4, TAG331 TAG331: sll $0, $0, 0 sll $0, $0, 0 xor $1, $4, $4 lui $1, 12 TAG332: sll $0, $0, 0 multu $1, $1 xor $3, $1, $1 beq $3, $1, TAG333 TAG333: sb $3, 0($3) mthi $3 lbu $3, 0($3) bne $3, $3, TAG334 TAG334: mthi $3 addiu $1, $3, 1 mult $1, $3 sb $1, 0($1) TAG335: bgez $1, TAG336 lbu $1, 0($1) mtlo $1 mflo $1 TAG336: lui $3, 6 mtlo $1 mult $3, $1 lbu $2, 0($1) TAG337: bltz $2, TAG338 lui $2, 8 mfhi $4 lhu $2, 0($4) TAG338: bne $2, $2, TAG339 addu $1, $2, $2 mflo $1 mult $2, $1 TAG339: bne $1, $1, TAG340 mflo $4 xori $1, $4, 11 blez $1, TAG340 TAG340: mflo $3 bgtz $3, TAG341 divu $3, $3 lui $3, 2 TAG341: subu $3, $3, $3 sh $3, 0($3) mthi $3 mthi $3 TAG342: blez $3, TAG343 sltiu $2, $3, 15 srl $2, $2, 15 mflo $4 TAG343: beq $4, $4, TAG344 lui $4, 8 mthi $4 subu $1, $4, $4 TAG344: div $1, $1 bgez $1, TAG345 sll $0, $0, 0 sw $1, 0($1) TAG345: sll $0, $0, 0 addu $3, $1, $1 sll $0, $0, 0 mtlo $1 TAG346: blez $4, TAG347 subu $2, $4, $4 multu $4, $2 beq $2, $2, TAG347 TAG347: sra $4, $2, 10 sw $2, 0($4) mtlo $2 bne $2, $4, TAG348 TAG348: mthi $4 bgtz $4, TAG349 sb $4, 0($4) sllv $4, $4, $4 TAG349: slti $3, $4, 6 mthi $3 mflo $1 bltz $4, TAG350 TAG350: mthi $1 bltz $1, TAG351 lw $1, 0($1) andi $4, $1, 0 TAG351: mtlo $4 mult $4, $4 blez $4, TAG352 sltiu $2, $4, 0 TAG352: lui $3, 0 ori $3, $2, 13 bne $3, $2, TAG353 lui $4, 10 TAG353: multu $4, $4 mflo $1 mthi $1 divu $1, $4 TAG354: multu $1, $1 srlv $2, $1, $1 addu $1, $1, $2 multu $1, $1 TAG355: mult $1, $1 lui $3, 11 mult $3, $1 mflo $3 TAG356: mfhi $1 mflo $4 mtlo $1 and $1, $4, $4 TAG357: sub $3, $1, $1 bne $1, $3, TAG358 xor $3, $3, $3 bne $3, $3, TAG358 TAG358: subu $3, $3, $3 srl $1, $3, 11 beq $3, $1, TAG359 lui $2, 8 TAG359: blez $2, TAG360 lui $4, 0 andi $4, $4, 13 lw $4, 0($4) TAG360: mflo $1 sh $1, 0($1) beq $4, $4, TAG361 mthi $1 TAG361: sub $1, $1, $1 mtlo $1 bgez $1, TAG362 multu $1, $1 TAG362: lui $2, 6 lh $1, 0($1) lb $2, 0($1) multu $2, $1 TAG363: lui $3, 6 mtlo $3 bltz $3, TAG364 sltiu $2, $2, 7 TAG364: addiu $4, $2, 12 lui $3, 14 mtlo $3 mfhi $3 TAG365: sltu $3, $3, $3 mult $3, $3 bne $3, $3, TAG366 lui $2, 4 TAG366: mult $2, $2 bne $2, $2, TAG367 lui $2, 0 mult $2, $2 TAG367: lb $3, 0($2) lbu $3, 0($3) andi $4, $2, 4 bne $2, $4, TAG368 TAG368: sra $2, $4, 4 bne $4, $2, TAG369 lhu $1, 0($2) beq $1, $2, TAG369 TAG369: lbu $4, 0($1) beq $1, $1, TAG370 lui $2, 10 ori $4, $1, 15 TAG370: mthi $4 addu $1, $4, $4 srl $4, $4, 0 mflo $3 TAG371: mfhi $3 blez $3, TAG372 mthi $3 mult $3, $3 TAG372: mfhi $1 beq $1, $1, TAG373 sub $1, $1, $1 nor $3, $3, $3 TAG373: sb $3, 0($3) srlv $1, $3, $3 bltz $1, TAG374 xori $4, $1, 6 TAG374: divu $4, $4 mthi $4 sh $4, 0($4) bltz $4, TAG375 TAG375: lhu $2, 0($4) mthi $4 lui $2, 5 sll $0, $0, 0 TAG376: mfhi $4 mthi $2 mtlo $2 bgtz $4, TAG377 TAG377: addu $4, $4, $4 bgez $4, TAG378 addiu $4, $4, 15 sb $4, 0($4) TAG378: multu $4, $4 lbu $2, 0($4) beq $4, $4, TAG379 lui $4, 2 TAG379: lui $3, 1 sllv $4, $4, $3 divu $4, $3 sll $0, $0, 0 TAG380: sw $1, 0($1) multu $1, $1 mtlo $1 bltz $1, TAG381 TAG381: lw $4, 0($1) lb $1, 0($4) mtlo $1 bne $4, $4, TAG382 TAG382: mtlo $1 lh $2, 0($1) multu $1, $2 mflo $4 TAG383: multu $4, $4 bne $4, $4, TAG384 add $3, $4, $4 sh $4, 0($3) TAG384: mfhi $2 mflo $4 srlv $1, $3, $4 lui $3, 11 TAG385: sll $0, $0, 0 mtlo $3 sll $0, $0, 0 sll $0, $0, 0 TAG386: sll $0, $0, 0 sll $0, $0, 0 bne $1, $1, TAG387 sll $0, $0, 0 TAG387: sh $1, 0($1) bgez $1, TAG388 sb $1, 0($1) bgtz $1, TAG388 TAG388: sra $3, $1, 6 mtlo $3 mthi $1 mtlo $3 TAG389: nor $1, $3, $3 addiu $1, $1, 6 lui $1, 12 lui $4, 15 TAG390: mfhi $3 mult $4, $3 ori $3, $3, 7 mthi $3 TAG391: nor $2, $3, $3 beq $2, $2, TAG392 xor $3, $2, $2 sb $3, 0($3) TAG392: blez $3, TAG393 ori $1, $3, 0 lbu $3, 0($1) sb $3, 0($1) TAG393: beq $3, $3, TAG394 lb $3, 0($3) bltz $3, TAG394 div $3, $3 TAG394: beq $3, $3, TAG395 lui $1, 2 lui $2, 9 mflo $4 TAG395: lui $3, 1 div $3, $4 or $3, $3, $3 lui $2, 15 TAG396: bne $2, $2, TAG397 sll $0, $0, 0 lui $1, 8 lui $3, 11 TAG397: addiu $1, $3, 15 mflo $2 sll $0, $0, 0 lui $1, 1 TAG398: divu $1, $1 mtlo $1 mfhi $3 addiu $4, $1, 14 TAG399: mtlo $4 bgtz $4, TAG400 mfhi $4 div $4, $4 TAG400: slt $3, $4, $4 bne $3, $3, TAG401 mtlo $3 mflo $3 TAG401: or $1, $3, $3 lui $4, 15 lui $2, 4 blez $3, TAG402 TAG402: lui $3, 15 lui $1, 5 multu $2, $2 srlv $4, $3, $2 TAG403: beq $4, $4, TAG404 div $4, $4 bgtz $4, TAG404 divu $4, $4 TAG404: sll $0, $0, 0 addiu $1, $4, 3 addu $1, $4, $4 slti $3, $1, 11 TAG405: bltz $3, TAG406 sllv $4, $3, $3 sw $3, 0($4) lui $2, 0 TAG406: mult $2, $2 mflo $1 sh $1, 0($2) sb $2, 0($1) TAG407: lui $4, 13 bgtz $4, TAG408 sw $4, 0($1) sltu $1, $4, $1 TAG408: xor $1, $1, $1 mult $1, $1 lui $1, 4 bgez $1, TAG409 TAG409: addiu $2, $1, 5 bltz $2, TAG410 div $2, $1 sll $0, $0, 0 TAG410: sll $0, $0, 0 mfhi $3 beq $2, $2, TAG411 multu $3, $2 TAG411: mthi $3 mfhi $3 multu $3, $3 addu $2, $3, $3 TAG412: blez $2, TAG413 sb $2, 0($2) andi $4, $2, 3 sh $2, 0($2) TAG413: slt $2, $4, $4 lb $3, 0($2) sra $3, $4, 6 beq $2, $3, TAG414 TAG414: lhu $3, 0($3) lb $4, 0($3) sh $3, 0($4) lb $1, 0($3) TAG415: sh $1, 0($1) sb $1, 0($1) sb $1, 0($1) mflo $2 TAG416: bgez $2, TAG417 mfhi $4 bgez $4, TAG417 mfhi $2 TAG417: lui $4, 0 mult $4, $4 lbu $3, 0($2) lui $1, 14 TAG418: bgtz $1, TAG419 lui $4, 13 xori $4, $4, 14 addu $2, $1, $4 TAG419: div $2, $2 mflo $1 blez $2, TAG420 mfhi $4 TAG420: lui $1, 2 lui $1, 13 bltz $4, TAG421 or $2, $1, $1 TAG421: sltu $2, $2, $2 addiu $2, $2, 13 beq $2, $2, TAG422 lb $1, 0($2) TAG422: bne $1, $1, TAG423 sb $1, 0($1) div $1, $1 blez $1, TAG423 TAG423: ori $1, $1, 2 lui $1, 5 xori $3, $1, 4 blez $1, TAG424 TAG424: mtlo $3 mfhi $3 mtlo $3 bgtz $3, TAG425 TAG425: sub $4, $3, $3 mflo $2 lh $4, 0($3) lhu $1, 0($2) TAG426: addiu $4, $1, 0 mthi $1 subu $2, $1, $4 multu $4, $1 TAG427: mult $2, $2 mtlo $2 mthi $2 mtlo $2 TAG428: addiu $3, $2, 1 lb $1, 0($3) multu $2, $2 mtlo $1 TAG429: lui $2, 6 addu $4, $2, $2 mult $2, $2 div $1, $4 TAG430: nor $1, $4, $4 divu $1, $4 sltu $2, $1, $1 mthi $1 TAG431: slt $4, $2, $2 lui $1, 1 bne $2, $4, TAG432 slt $3, $2, $2 TAG432: mflo $2 srl $1, $2, 10 srlv $1, $1, $3 sb $1, 0($1) TAG433: lui $2, 2 sra $4, $1, 0 lui $3, 15 mtlo $1 TAG434: sll $0, $0, 0 sll $0, $0, 0 mtlo $2 blez $3, TAG435 TAG435: mthi $2 mfhi $4 mfhi $3 sll $0, $0, 0 TAG436: nor $3, $3, $3 mtlo $3 lui $1, 3 sllv $3, $3, $3 TAG437: sll $0, $0, 0 mfhi $3 bne $3, $3, TAG438 sra $1, $3, 1 TAG438: sll $0, $0, 0 xori $4, $1, 11 beq $1, $4, TAG439 srlv $3, $4, $1 TAG439: sll $0, $0, 0 ori $2, $3, 3 mthi $3 beq $3, $3, TAG440 TAG440: lui $3, 2 sll $0, $0, 0 mthi $2 blez $2, TAG441 TAG441: xor $2, $2, $2 sh $2, 0($2) lbu $4, 0($2) slt $1, $4, $2 TAG442: bgez $1, TAG443 mfhi $2 bgez $1, TAG443 lhu $4, 0($1) TAG443: andi $3, $4, 8 mfhi $3 lui $1, 15 divu $3, $1 TAG444: addiu $4, $1, 2 sll $4, $1, 3 andi $2, $4, 10 bltz $1, TAG445 TAG445: addu $4, $2, $2 mtlo $4 lb $2, 0($2) mfhi $2 TAG446: srl $1, $2, 9 lui $3, 7 sltu $4, $1, $2 lbu $3, 0($4) TAG447: beq $3, $3, TAG448 lw $4, 0($3) mult $3, $3 lui $3, 10 TAG448: mflo $4 bne $4, $3, TAG449 mflo $3 mflo $1 TAG449: sltiu $2, $1, 6 mflo $4 slti $2, $2, 11 sh $2, 0($1) TAG450: sra $4, $2, 9 sb $4, 0($2) sh $4, 0($4) lui $2, 5 TAG451: beq $2, $2, TAG452 mtlo $2 srl $4, $2, 2 divu $4, $2 TAG452: sra $3, $4, 7 lbu $4, 0($4) mtlo $3 mfhi $4 TAG453: bgtz $4, TAG454 sll $0, $0, 0 divu $4, $4 lui $4, 8 TAG454: bne $4, $4, TAG455 mflo $1 mthi $1 beq $1, $1, TAG455 TAG455: sw $1, 0($1) sh $1, 0($1) lbu $1, 0($1) multu $1, $1 TAG456: mtlo $1 mfhi $1 slti $1, $1, 10 multu $1, $1 TAG457: divu $1, $1 lui $4, 5 sb $1, 0($1) lui $4, 11 TAG458: lui $1, 8 mthi $4 slt $1, $1, $1 bgtz $1, TAG459 TAG459: mthi $1 mthi $1 lh $3, 0($1) lui $4, 15 TAG460: sll $0, $0, 0 lui $1, 14 bne $1, $4, TAG461 mfhi $2 TAG461: sh $2, 0($2) lhu $2, 0($2) sltiu $3, $2, 8 slt $1, $2, $3 TAG462: mtlo $1 lui $1, 6 lui $1, 13 mthi $1 TAG463: mfhi $1 mflo $1 lbu $2, 0($1) mfhi $4 TAG464: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG465: lb $4, 0($1) sh $1, 0($4) lbu $4, 0($1) lb $4, 0($1) TAG466: sll $3, $4, 14 mthi $4 bne $3, $4, TAG467 mult $3, $3 TAG467: mflo $3 sllv $1, $3, $3 mtlo $1 mtlo $3 TAG468: bgtz $1, TAG469 multu $1, $1 sw $1, 0($1) addi $3, $1, 5 TAG469: lb $3, 0($3) subu $2, $3, $3 mult $3, $3 mtlo $3 TAG470: sb $2, 0($2) beq $2, $2, TAG471 sub $1, $2, $2 mfhi $1 TAG471: beq $1, $1, TAG472 sb $1, 0($1) sw $1, 0($1) mfhi $3 TAG472: beq $3, $3, TAG473 lui $2, 12 bne $3, $3, TAG473 mult $3, $2 TAG473: sll $0, $0, 0 sltiu $1, $2, 12 andi $1, $1, 8 multu $1, $1 TAG474: slt $2, $1, $1 lhu $4, 0($1) mtlo $2 lbu $3, 0($4) TAG475: xori $3, $3, 3 mthi $3 multu $3, $3 lui $2, 12 TAG476: and $2, $2, $2 bgtz $2, TAG477 mult $2, $2 lui $1, 3 TAG477: sb $1, 0($1) bltz $1, TAG478 sll $1, $1, 9 srlv $3, $1, $1 TAG478: lb $3, 0($3) subu $4, $3, $3 bne $4, $3, TAG479 mult $4, $4 TAG479: lui $2, 9 andi $1, $2, 10 sw $4, 0($1) bgtz $4, TAG480 TAG480: addiu $1, $1, 13 mthi $1 addu $2, $1, $1 lui $3, 9 TAG481: andi $2, $3, 10 mfhi $4 div $2, $3 srav $1, $4, $2 TAG482: bgez $1, TAG483 div $1, $1 sb $1, 0($1) beq $1, $1, TAG483 TAG483: sb $1, 0($1) beq $1, $1, TAG484 sb $1, 0($1) addi $1, $1, 1 TAG484: lbu $1, 0($1) bne $1, $1, TAG485 subu $1, $1, $1 beq $1, $1, TAG485 TAG485: sh $1, 0($1) lui $3, 7 lui $1, 11 sll $0, $0, 0 TAG486: bne $4, $4, TAG487 mfhi $3 bltz $3, TAG487 lb $1, 0($4) TAG487: lbu $1, 0($1) mthi $1 mfhi $4 mflo $2 TAG488: lb $2, 0($2) sll $2, $2, 15 bgez $2, TAG489 multu $2, $2 TAG489: srl $1, $2, 0 srlv $2, $1, $1 lb $3, 0($2) multu $2, $2 TAG490: mflo $1 bltz $3, TAG491 mflo $3 bgez $1, TAG491 TAG491: mthi $3 sh $3, 0($3) mult $3, $3 sh $3, 0($3) TAG492: mult $3, $3 sltu $3, $3, $3 bgtz $3, TAG493 nor $2, $3, $3 TAG493: div $2, $2 lhu $4, 1($2) lui $1, 3 bltz $2, TAG494 TAG494: sll $0, $0, 0 divu $1, $1 divu $1, $1 bgtz $1, TAG495 TAG495: srl $4, $1, 6 srlv $2, $4, $1 divu $2, $4 mtlo $4 TAG496: lui $1, 0 sb $2, -3072($2) mflo $4 lbu $1, -3072($4) TAG497: ori $1, $1, 13 xor $2, $1, $1 blez $1, TAG498 lb $3, 0($1) TAG498: lbu $4, 0($3) beq $3, $4, TAG499 ori $2, $3, 10 sb $3, 0($4) TAG499: and $4, $2, $2 bltz $4, TAG500 andi $2, $2, 2 or $2, $2, $4 TAG500: srl $1, $2, 0 slt $4, $1, $1 xori $3, $1, 15 mfhi $4 TAG501: mtlo $4 lw $2, 0($4) blez $4, TAG502 lb $3, 0($2) TAG502: mflo $2 lui $1, 3 mtlo $1 sw $2, 0($3) TAG503: bne $1, $1, TAG504 sll $0, $0, 0 bne $3, $3, TAG504 mfhi $4 TAG504: sltiu $1, $4, 1 mtlo $4 beq $4, $4, TAG505 sh $4, 0($4) TAG505: mthi $1 lui $2, 4 lui $2, 0 slti $4, $1, 4 TAG506: blez $4, TAG507 mfhi $3 sb $3, 0($4) lb $2, 0($4) TAG507: mtlo $2 mflo $2 sb $2, 0($2) or $3, $2, $2 TAG508: lui $3, 2 sra $3, $3, 6 blez $3, TAG509 sw $3, -2048($3) TAG509: mthi $3 beq $3, $3, TAG510 lh $3, -2048($3) mflo $2 TAG510: addu $4, $2, $2 beq $4, $4, TAG511 divu $2, $4 mthi $4 TAG511: sh $4, 0($4) mthi $4 lhu $3, 0($4) divu $3, $4 TAG512: lui $3, 10 multu $3, $3 mflo $3 lui $3, 5 TAG513: mtlo $3 addiu $4, $3, 7 lui $2, 12 sll $0, $0, 0 TAG514: sll $0, $0, 0 lui $2, 3 mult $2, $2 mthi $2 TAG515: mthi $2 lui $4, 11 nor $3, $2, $2 mthi $2 TAG516: addiu $3, $3, 8 divu $3, $3 bgtz $3, TAG517 sll $0, $0, 0 TAG517: divu $3, $3 bne $3, $3, TAG518 subu $3, $3, $3 mtlo $3 TAG518: mtlo $3 lb $2, 0($3) slt $3, $2, $3 multu $3, $3 TAG519: bltz $3, TAG520 lui $4, 14 mflo $2 lw $2, 0($3) TAG520: mflo $1 addiu $4, $1, 13 divu $1, $4 sll $0, $0, 0 TAG521: mfhi $1 blez $1, TAG522 mtlo $1 bne $1, $1, TAG522 TAG522: mfhi $3 beq $1, $1, TAG523 sllv $3, $3, $3 sb $1, 0($1) TAG523: mflo $3 addiu $4, $3, 6 sb $3, 0($4) sb $3, 0($4) TAG524: bltz $4, TAG525 mthi $4 sb $4, 0($4) mthi $4 TAG525: sb $4, 0($4) divu $4, $4 lui $2, 11 lui $1, 7 TAG526: sll $0, $0, 0 sll $0, $0, 0 mflo $3 mflo $4 TAG527: sb $4, 0($4) sb $4, 0($4) mthi $4 div $4, $4 TAG528: mtlo $4 bgtz $4, TAG529 mflo $3 bltz $4, TAG529 TAG529: sb $3, 0($3) lui $1, 13 sll $0, $0, 0 lui $4, 1 TAG530: sll $0, $0, 0 lui $3, 8 sll $3, $4, 8 beq $3, $3, TAG531 TAG531: slt $4, $3, $3 lw $2, 0($4) bne $4, $3, TAG532 multu $2, $4 TAG532: lui $3, 12 mflo $2 nor $4, $3, $3 mthi $2 TAG533: sll $0, $0, 0 bgtz $4, TAG534 sll $0, $0, 0 xori $4, $4, 11 TAG534: mflo $1 lui $1, 3 bne $4, $1, TAG535 sll $0, $0, 0 TAG535: beq $4, $4, TAG536 sll $0, $0, 0 slti $2, $4, 11 lh $3, 0($2) TAG536: lui $3, 5 mfhi $4 addu $1, $3, $4 lui $4, 4 TAG537: sll $0, $0, 0 multu $4, $4 mflo $1 sll $0, $0, 0 TAG538: lui $2, 5 bne $1, $2, TAG539 sh $2, 0($1) slti $1, $2, 8 TAG539: blez $1, TAG540 multu $1, $1 lhu $3, 0($1) sltu $1, $1, $3 TAG540: bgtz $1, TAG541 ori $3, $1, 10 mfhi $2 divu $1, $3 TAG541: sh $2, 0($2) lui $3, 14 divu $3, $3 divu $3, $3 TAG542: lui $4, 5 lui $1, 5 beq $1, $4, TAG543 sll $4, $4, 12 TAG543: nor $2, $4, $4 xor $1, $2, $2 lui $2, 3 div $2, $2 TAG544: sll $0, $0, 0 bne $2, $3, TAG545 mflo $2 mtlo $2 TAG545: mtlo $2 mult $2, $2 lui $2, 11 sll $0, $0, 0 TAG546: sra $1, $1, 3 multu $1, $1 lh $4, 0($1) beq $4, $1, TAG547 TAG547: lbu $4, 0($4) bne $4, $4, TAG548 sll $2, $4, 12 mfhi $2 TAG548: lui $1, 8 divu $1, $1 sll $0, $0, 0 nor $3, $1, $2 TAG549: sllv $4, $3, $3 bne $3, $3, TAG550 addiu $4, $4, 2 mfhi $3 TAG550: mflo $1 bgtz $3, TAG551 ori $3, $3, 0 lui $2, 5 TAG551: sll $0, $0, 0 bgez $4, TAG552 mthi $4 div $4, $2 TAG552: and $4, $4, $4 lui $2, 1 or $2, $2, $4 addiu $2, $2, 14 TAG553: xori $4, $2, 9 beq $4, $4, TAG554 lui $3, 8 lui $3, 13 TAG554: beq $3, $3, TAG555 sll $0, $0, 0 bgtz $3, TAG555 sw $3, 0($3) TAG555: sll $0, $0, 0 mtlo $3 addu $3, $3, $3 mult $3, $3 TAG556: mflo $1 lui $1, 5 sll $0, $0, 0 sll $0, $0, 0 TAG557: bgtz $2, TAG558 xor $1, $2, $2 mult $2, $1 blez $2, TAG558 TAG558: mult $1, $1 lui $3, 11 lh $4, 0($1) sll $0, $0, 0 TAG559: ori $3, $4, 6 bgtz $4, TAG560 mthi $4 mult $4, $4 TAG560: slti $3, $3, 13 lui $4, 14 slti $1, $3, 6 divu $4, $3 TAG561: slti $3, $1, 11 lui $1, 6 sllv $3, $3, $1 sll $0, $0, 0 TAG562: div $1, $1 lui $4, 14 nor $4, $1, $4 divu $4, $4 TAG563: mthi $4 sll $0, $0, 0 mflo $3 mfhi $3 TAG564: bne $3, $3, TAG565 mfhi $4 srav $3, $3, $4 bltz $3, TAG565 TAG565: mfhi $1 bgez $3, TAG566 mfhi $4 lui $3, 14 TAG566: sll $0, $0, 0 mtlo $3 bne $3, $3, TAG567 sll $0, $0, 0 TAG567: and $4, $1, $1 mflo $2 addu $4, $4, $4 lui $4, 15 TAG568: blez $4, TAG569 lui $3, 5 mfhi $1 bgtz $1, TAG569 TAG569: lui $3, 4 lui $1, 15 mthi $3 blez $1, TAG570 TAG570: lui $2, 8 srav $2, $2, $1 mtlo $2 subu $4, $2, $2 TAG571: or $3, $4, $4 lui $4, 3 sll $0, $0, 0 bgez $4, TAG572 TAG572: multu $2, $2 sll $0, $0, 0 sll $0, $0, 0 lui $3, 0 TAG573: mtlo $3 addu $1, $3, $3 multu $1, $3 sb $1, 0($3) TAG574: slt $4, $1, $1 mflo $2 lh $1, 0($2) bltz $2, TAG575 TAG575: sb $1, 0($1) mult $1, $1 or $2, $1, $1 beq $2, $2, TAG576 TAG576: lhu $2, 0($2) srl $1, $2, 14 bne $2, $2, TAG577 sra $4, $1, 15 TAG577: sltu $3, $4, $4 mfhi $3 lbu $4, 0($3) mult $4, $3 TAG578: mtlo $4 sb $4, 0($4) mtlo $4 lui $4, 0 TAG579: lui $4, 14 sll $0, $0, 0 sll $0, $0, 0 mult $4, $2 TAG580: nor $1, $2, $2 mflo $1 sb $1, 0($1) mtlo $1 TAG581: mtlo $1 sw $1, 0($1) and $3, $1, $1 sra $3, $1, 5 TAG582: mult $3, $3 slti $3, $3, 3 sb $3, 0($3) divu $3, $3 TAG583: lui $1, 2 mthi $3 mtlo $3 lb $3, 0($3) TAG584: sra $4, $3, 1 mult $4, $3 div $3, $3 beq $4, $3, TAG585 TAG585: lui $2, 1 sra $3, $4, 10 sh $4, 0($4) bltz $3, TAG586 TAG586: mthi $3 slti $3, $3, 11 sb $3, 0($3) mflo $3 TAG587: mthi $3 sb $3, 0($3) divu $3, $3 lbu $1, 0($3) TAG588: srlv $3, $1, $1 beq $1, $1, TAG589 mthi $1 bgez $1, TAG589 TAG589: sh $3, 0($3) lui $1, 8 blez $1, TAG590 addiu $3, $1, 13 TAG590: div $3, $3 bne $3, $3, TAG591 mfhi $2 blez $3, TAG591 TAG591: mtlo $2 lb $3, 0($2) sltiu $1, $3, 1 beq $2, $2, TAG592 TAG592: lbu $3, 0($1) lh $4, 0($3) sh $1, 0($4) lui $3, 6 TAG593: bgez $3, TAG594 xor $3, $3, $3 lui $1, 8 mthi $1 TAG594: lb $2, 0($1) mflo $1 beq $1, $2, TAG595 sltu $4, $1, $1 TAG595: addu $4, $4, $4 bgez $4, TAG596 multu $4, $4 mfhi $2 TAG596: lbu $1, 0($2) xori $1, $2, 5 beq $2, $2, TAG597 sb $1, 0($1) TAG597: bne $1, $1, TAG598 lui $2, 7 beq $1, $2, TAG598 mflo $3 TAG598: mtlo $3 andi $4, $3, 5 lbu $4, 0($4) mflo $4 TAG599: lbu $3, 0($4) bgez $3, TAG600 sb $3, 0($3) divu $3, $3 TAG600: divu $3, $3 addiu $3, $3, 7 beq $3, $3, TAG601 andi $3, $3, 9 TAG601: beq $3, $3, TAG602 srl $1, $3, 4 srav $4, $3, $3 bne $3, $4, TAG602 TAG602: sb $4, 0($4) sw $4, 0($4) sltu $2, $4, $4 andi $4, $2, 10 TAG603: addiu $4, $4, 6 addu $1, $4, $4 bltz $4, TAG604 lui $1, 13 TAG604: mtlo $1 sltu $1, $1, $1 mflo $2 mfhi $3 TAG605: sw $3, 0($3) lh $3, 0($3) sh $3, 0($3) mult $3, $3 TAG606: beq $3, $3, TAG607 mtlo $3 ori $1, $3, 12 beq $1, $1, TAG607 TAG607: mthi $1 lui $4, 7 sll $0, $0, 0 lui $2, 8 TAG608: mflo $2 sh $2, 0($2) mult $2, $2 add $3, $2, $2 TAG609: mult $3, $3 bgez $3, TAG610 lb $3, 0($3) div $3, $3 TAG610: mtlo $3 bne $3, $3, TAG611 mtlo $3 mfhi $2 TAG611: andi $2, $2, 11 lui $3, 5 bne $2, $3, TAG612 mthi $3 TAG612: mthi $3 addiu $3, $3, 13 mflo $3 blez $3, TAG613 TAG613: lw $4, 0($3) sltiu $4, $3, 3 bgez $4, TAG614 sb $4, 0($4) TAG614: mtlo $4 sllv $3, $4, $4 lui $4, 3 bne $4, $4, TAG615 TAG615: addiu $1, $4, 9 sll $0, $0, 0 mtlo $4 sltiu $1, $1, 0 TAG616: subu $2, $1, $1 sltiu $3, $1, 7 sb $2, 0($3) blez $2, TAG617 TAG617: mflo $1 mflo $4 bgtz $3, TAG618 xori $3, $1, 14 TAG618: blez $3, TAG619 mtlo $3 mult $3, $3 sll $0, $0, 0 TAG619: mfhi $4 sll $0, $0, 0 mflo $4 bne $4, $4, TAG620 TAG620: lui $1, 7 beq $1, $4, TAG621 multu $1, $1 and $2, $4, $4 TAG621: mthi $2 sll $0, $0, 0 mthi $2 beq $2, $2, TAG622 TAG622: mult $2, $2 addiu $1, $2, 1 sll $0, $0, 0 sll $0, $0, 0 TAG623: divu $1, $1 bgez $1, TAG624 div $1, $1 mthi $1 TAG624: sll $0, $0, 0 bne $1, $1, TAG625 mult $1, $1 sll $0, $0, 0 TAG625: sll $0, $0, 0 addu $4, $4, $4 mthi $2 mflo $2 TAG626: srlv $1, $2, $2 lui $4, 13 divu $1, $1 mflo $4 TAG627: bgtz $4, TAG628 sb $4, 0($4) bgtz $4, TAG628 mthi $4 TAG628: mtlo $4 mflo $4 sb $4, 0($4) lui $4, 5 TAG629: sll $0, $0, 0 beq $4, $4, TAG630 mthi $4 sb $4, 0($4) TAG630: mtlo $4 sll $0, $0, 0 mthi $4 sll $0, $0, 0 TAG631: div $3, $3 bne $3, $3, TAG632 multu $3, $3 beq $3, $3, TAG632 TAG632: divu $3, $3 beq $3, $3, TAG633 lui $1, 8 lui $1, 11 TAG633: sll $0, $0, 0 mfhi $2 mult $2, $2 mfhi $4 TAG634: sb $4, 0($4) subu $2, $4, $4 sw $4, 0($4) lui $1, 2 TAG635: multu $1, $1 and $4, $1, $1 lui $4, 9 mthi $1 TAG636: mthi $4 beq $4, $4, TAG637 lui $4, 1 lui $3, 10 TAG637: mthi $3 lui $1, 4 mflo $1 bne $3, $1, TAG638 TAG638: mult $1, $1 blez $1, TAG639 multu $1, $1 lui $2, 4 TAG639: mult $2, $2 sb $2, 0($2) sub $3, $2, $2 mtlo $3 TAG640: srl $1, $3, 2 lui $3, 5 sw $3, 0($1) nor $4, $3, $1 TAG641: mfhi $2 mflo $3 bgez $4, TAG642 lbu $3, 0($2) TAG642: lb $2, 0($3) mult $2, $3 multu $3, $2 bne $2, $3, TAG643 TAG643: sh $2, 0($2) lhu $4, 0($2) mflo $2 bne $2, $4, TAG644 TAG644: slti $1, $2, 10 lui $1, 5 mthi $2 addu $4, $2, $2 TAG645: lui $2, 2 addu $4, $2, $4 beq $4, $4, TAG646 mflo $2 TAG646: or $3, $2, $2 mult $2, $3 sh $3, 0($2) sh $3, 0($3) TAG647: bgez $3, TAG648 multu $3, $3 mflo $4 lui $2, 9 TAG648: lb $2, 0($2) mult $2, $2 lui $2, 6 mflo $1 TAG649: sh $1, 0($1) multu $1, $1 mtlo $1 sw $1, 0($1) TAG650: srav $3, $1, $1 sh $1, 0($3) bne $3, $3, TAG651 mult $3, $1 TAG651: lh $3, 0($3) multu $3, $3 bgtz $3, TAG652 lbu $2, 0($3) TAG652: lui $1, 5 blez $2, TAG653 multu $2, $2 ori $4, $2, 3 TAG653: blez $4, TAG654 mult $4, $4 mult $4, $4 nor $3, $4, $4 TAG654: mthi $3 sll $0, $0, 0 mult $3, $2 lui $3, 11 TAG655: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG656: bne $4, $4, TAG657 sll $0, $0, 0 bne $2, $2, TAG657 multu $4, $2 TAG657: slti $4, $2, 14 lb $3, 0($4) mfhi $2 lui $2, 6 TAG658: beq $2, $2, TAG659 sll $0, $0, 0 mfhi $1 sb $1, 0($1) TAG659: mflo $1 slti $2, $1, 10 sb $1, 0($2) sll $1, $1, 15 TAG660: lui $1, 6 slti $3, $1, 13 sb $1, 0($3) sb $3, 0($3) TAG661: sra $2, $3, 3 addiu $2, $3, 11 blez $2, TAG662 slt $4, $3, $2 TAG662: lbu $4, 0($4) blez $4, TAG663 or $2, $4, $4 beq $4, $4, TAG663 TAG663: xori $1, $2, 8 srav $4, $1, $1 or $2, $1, $4 xori $3, $4, 11 TAG664: mtlo $3 addu $1, $3, $3 mflo $1 sltu $3, $1, $3 TAG665: mflo $1 mtlo $3 lb $4, 0($3) beq $4, $1, TAG666 TAG666: mfhi $4 multu $4, $4 lw $3, 0($4) bgez $3, TAG667 TAG667: sh $3, 0($3) mflo $2 sb $3, 0($2) mult $3, $2 TAG668: subu $3, $2, $2 multu $2, $3 sra $2, $3, 14 mfhi $1 TAG669: mult $1, $1 lui $3, 8 lui $3, 6 bne $3, $3, TAG670 TAG670: mtlo $3 beq $3, $3, TAG671 addiu $3, $3, 4 mfhi $2 TAG671: mtlo $2 blez $2, TAG672 lui $3, 4 mult $2, $3 TAG672: addu $4, $3, $3 mflo $4 addiu $3, $4, 4 beq $4, $3, TAG673 TAG673: lw $2, 0($3) sll $0, $0, 0 mult $4, $2 and $4, $4, $2 TAG674: mfhi $4 mfhi $1 mthi $4 sb $4, 0($4) TAG675: addu $1, $1, $1 andi $4, $1, 15 lui $4, 9 sll $0, $0, 0 TAG676: lbu $1, 0($3) divu $3, $3 bltz $3, TAG677 lbu $4, 0($3) TAG677: bgez $4, TAG678 lui $3, 15 xor $3, $4, $4 beq $3, $3, TAG678 TAG678: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 bgez $3, TAG679 TAG679: addu $1, $1, $1 bne $1, $1, TAG680 mtlo $1 lui $4, 9 TAG680: srl $2, $4, 4 and $3, $4, $2 mfhi $1 mult $2, $2 TAG681: lhu $2, 0($1) blez $1, TAG682 lui $2, 0 xor $2, $1, $2 TAG682: sw $2, 0($2) lui $2, 10 slti $2, $2, 2 sw $2, 0($2) TAG683: lui $2, 2 lui $2, 5 mfhi $4 sll $0, $0, 0 TAG684: mtlo $4 mflo $4 lhu $3, 0($4) add $3, $3, $4 TAG685: mtlo $3 or $2, $3, $3 mfhi $2 mthi $2 TAG686: beq $2, $2, TAG687 mtlo $2 mfhi $3 lb $4, 0($3) TAG687: slti $2, $4, 8 beq $2, $2, TAG688 sb $2, 0($2) lui $4, 4 TAG688: mult $4, $4 sll $4, $4, 13 lui $2, 13 sltiu $3, $4, 10 TAG689: bne $3, $3, TAG690 lui $2, 11 slt $2, $2, $2 multu $3, $2 TAG690: mtlo $2 sltiu $1, $2, 2 lui $2, 4 bne $1, $2, TAG691 TAG691: mfhi $3 bgez $3, TAG692 subu $4, $3, $2 blez $4, TAG692 TAG692: mfhi $4 sb $4, 0($4) mult $4, $4 blez $4, TAG693 TAG693: lbu $4, 0($4) addu $4, $4, $4 mult $4, $4 lui $3, 5 TAG694: addu $4, $3, $3 mflo $4 lhu $4, 0($4) mfhi $2 TAG695: mfhi $4 slti $1, $2, 12 lb $2, 0($1) bltz $1, TAG696 TAG696: div $2, $2 lui $3, 12 bltz $3, TAG697 sll $0, $0, 0 TAG697: or $3, $3, $3 sll $0, $0, 0 sllv $1, $4, $4 sb $1, 0($4) TAG698: beq $1, $1, TAG699 lui $2, 8 blez $2, TAG699 addiu $2, $2, 4 TAG699: sll $0, $0, 0 bltz $2, TAG700 lui $3, 11 mtlo $3 TAG700: mthi $3 srav $3, $3, $3 lui $3, 3 mflo $2 TAG701: bgtz $2, TAG702 mfhi $1 mfhi $4 bne $1, $4, TAG702 TAG702: addu $4, $4, $4 sltiu $4, $4, 5 mthi $4 divu $4, $4 TAG703: addiu $4, $4, 12 addu $4, $4, $4 lhu $1, 0($4) lbu $3, 0($4) TAG704: lui $4, 15 addiu $1, $4, 7 lui $4, 6 bgez $1, TAG705 TAG705: srlv $1, $4, $4 bltz $4, TAG706 sll $0, $0, 0 sltu $4, $4, $1 TAG706: mflo $2 sltu $1, $2, $2 nor $2, $1, $1 and $3, $2, $2 TAG707: sh $3, 1($3) lw $4, 1($3) lui $4, 1 mflo $4 TAG708: mfhi $3 srl $1, $3, 10 lbu $4, 0($1) lh $1, -255($4) TAG709: lui $2, 1 multu $1, $2 bltz $1, TAG710 mtlo $2 TAG710: sra $1, $2, 4 or $3, $1, $2 bltz $1, TAG711 sll $0, $0, 0 TAG711: beq $3, $3, TAG712 lui $1, 1 sb $3, 0($1) and $2, $3, $3 TAG712: blez $2, TAG713 mthi $2 mflo $4 sll $0, $0, 0 TAG713: mthi $4 bne $4, $4, TAG714 mtlo $4 mflo $4 TAG714: mult $4, $4 mult $4, $4 lui $3, 7 lui $3, 5 TAG715: or $2, $3, $3 sll $0, $0, 0 mflo $1 lb $2, 0($1) TAG716: sll $0, $0, 0 mtlo $1 sra $1, $2, 2 lui $3, 8 TAG717: bltz $3, TAG718 srav $1, $3, $3 mflo $4 sll $0, $0, 0 TAG718: srl $1, $4, 13 addu $1, $1, $4 lui $2, 7 mfhi $2 TAG719: srl $2, $2, 11 lui $4, 15 addu $2, $2, $2 bne $2, $2, TAG720 TAG720: xor $4, $2, $2 bne $2, $2, TAG721 mflo $1 lw $2, 0($2) TAG721: bltz $2, TAG722 multu $2, $2 mthi $2 andi $4, $2, 4 TAG722: lui $3, 8 lui $1, 1 lui $3, 11 slti $4, $3, 1 TAG723: sw $4, 0($4) sw $4, 0($4) mthi $4 mthi $4 TAG724: sh $4, 0($4) srl $2, $4, 15 beq $4, $4, TAG725 multu $2, $4 TAG725: sll $2, $2, 10 lui $2, 10 ori $2, $2, 11 sltu $3, $2, $2 TAG726: mtlo $3 addi $4, $3, 13 beq $4, $4, TAG727 mfhi $4 TAG727: lui $4, 6 mfhi $2 multu $2, $2 mflo $2 TAG728: lui $4, 6 multu $2, $2 mfhi $3 lui $3, 10 TAG729: srav $1, $3, $3 addu $4, $3, $3 sll $0, $0, 0 mflo $2 TAG730: sub $3, $2, $2 sltiu $3, $2, 11 lhu $2, 0($2) beq $2, $2, TAG731 TAG731: mtlo $2 mult $2, $2 sb $2, 0($2) sh $2, 0($2) TAG732: mfhi $3 mtlo $3 mult $2, $2 mtlo $2 TAG733: mflo $4 mfhi $2 beq $4, $3, TAG734 multu $3, $4 TAG734: subu $2, $2, $2 multu $2, $2 lui $3, 7 mflo $4 TAG735: mflo $3 lui $2, 15 slt $3, $4, $3 mult $3, $4 TAG736: mflo $1 mtlo $3 mtlo $1 lh $3, 0($3) TAG737: sh $3, 0($3) mthi $3 lui $1, 7 subu $4, $3, $1 TAG738: xor $4, $4, $4 sh $4, 0($4) beq $4, $4, TAG739 mthi $4 TAG739: lui $1, 13 sllv $4, $1, $4 lui $1, 12 mfhi $3 TAG740: nor $1, $3, $3 sw $1, 1($1) slti $1, $1, 9 mflo $4 TAG741: and $4, $4, $4 beq $4, $4, TAG742 lui $2, 0 lb $1, 0($2) TAG742: div $1, $1 beq $1, $1, TAG743 div $1, $1 mtlo $1 TAG743: mfhi $4 mfhi $1 sh $1, 0($1) xori $1, $1, 15 TAG744: mthi $1 sb $1, 0($1) blez $1, TAG745 mflo $3 TAG745: sb $3, 0($3) bne $3, $3, TAG746 sllv $4, $3, $3 mfhi $2 TAG746: srlv $3, $2, $2 multu $2, $3 addi $2, $3, 3 andi $4, $3, 2 TAG747: sb $4, 0($4) mtlo $4 sh $4, 0($4) slt $3, $4, $4 TAG748: mult $3, $3 mtlo $3 mult $3, $3 xor $3, $3, $3 TAG749: sb $3, 0($3) bltz $3, TAG750 sb $3, 0($3) mtlo $3 TAG750: nop nop test_end: beq $0, $0, test_end nop
unittests/ASM/TwoByte/0F_F4.asm
woachk/FEX
0
177185
%ifdef CONFIG { "RegData": { "MM0": ["0x000000000003FFFC", "0x0"], "MM1": ["0x000000000003FFFC", "0x0"] }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rdx, 0xe0000000 mov rax, 0x414243440000FFFF mov [rdx + 8 * 0], rax mov rax, 0x5152535400007FFF mov [rdx + 8 * 1], rax mov rax, 0x6162636400000004 mov [rdx + 8 * 2], rax mov rax, 0x7172737400000002 mov [rdx + 8 * 3], rax movq mm0, [rdx] pmuludq mm0, [rdx + 8 * 2] movq mm1, [rdx] movq mm2, [rdx + 8 * 2] pmuludq mm1, mm2 hlt
oeis/349/A349050.asm
neoneye/loda-programs
11
161947
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A349050: Number of multisets of size n that have no alternating permutations and cover an initial interval of positive integers. ; Submitted by <NAME> ; 0,0,1,1,3,4,8,12,20,32 lpb $0 sub $0,1 div $1,2 add $2,$1 sub $3,1 sub $3,$1 add $3,1 add $1,$3 add $1,$3 div $3,2 add $1,$3 add $1,2 add $3,$2 lpe mov $0,$2
llvm-gcc-4.2-2.9/gcc/ada/sem_ch8.adb
vidkidz/crossbridge
1
16103
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M . C H 8 -- -- -- -- 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. -- -- -- -- 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 Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Fname; use Fname; with Freeze; use Freeze; with Lib; use Lib; with Lib.Load; use Lib.Load; with Lib.Xref; use Lib.Xref; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Output; use Output; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Cat; use Sem_Cat; with Sem_Ch3; use Sem_Ch3; with Sem_Ch4; use Sem_Ch4; with Sem_Ch6; use Sem_Ch6; with Sem_Ch12; use Sem_Ch12; with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sem_Type; use Sem_Type; with Stand; use Stand; with Sinfo; use Sinfo; with Sinfo.CN; use Sinfo.CN; with Snames; use Snames; with Style; use Style; with Table; with Tbuild; use Tbuild; with Uintp; use Uintp; with GNAT.Spelling_Checker; use GNAT.Spelling_Checker; package body Sem_Ch8 is ------------------------------------ -- Visibility and Name Resolution -- ------------------------------------ -- This package handles name resolution and the collection of -- interpretations for overloaded names, prior to overload resolution. -- Name resolution is the process that establishes a mapping between source -- identifiers and the entities they denote at each point in the program. -- Each entity is represented by a defining occurrence. Each identifier -- that denotes an entity points to the corresponding defining occurrence. -- This is the entity of the applied occurrence. Each occurrence holds -- an index into the names table, where source identifiers are stored. -- Each entry in the names table for an identifier or designator uses the -- Info pointer to hold a link to the currently visible entity that has -- this name (see subprograms Get_Name_Entity_Id and Set_Name_Entity_Id -- in package Sem_Util). The visibility is initialized at the beginning of -- semantic processing to make entities in package Standard immediately -- visible. The visibility table is used in a more subtle way when -- compiling subunits (see below). -- Entities that have the same name (i.e. homonyms) are chained. In the -- case of overloaded entities, this chain holds all the possible meanings -- of a given identifier. The process of overload resolution uses type -- information to select from this chain the unique meaning of a given -- identifier. -- Entities are also chained in their scope, through the Next_Entity link. -- As a consequence, the name space is organized as a sparse matrix, where -- each row corresponds to a scope, and each column to a source identifier. -- Open scopes, that is to say scopes currently being compiled, have their -- corresponding rows of entities in order, innermost scope first. -- The scopes of packages that are mentioned in context clauses appear in -- no particular order, interspersed among open scopes. This is because -- in the course of analyzing the context of a compilation, a package -- declaration is first an open scope, and subsequently an element of the -- context. If subunits or child units are present, a parent unit may -- appear under various guises at various times in the compilation. -- When the compilation of the innermost scope is complete, the entities -- defined therein are no longer visible. If the scope is not a package -- declaration, these entities are never visible subsequently, and can be -- removed from visibility chains. If the scope is a package declaration, -- its visible declarations may still be accessible. Therefore the entities -- defined in such a scope are left on the visibility chains, and only -- their visibility (immediately visibility or potential use-visibility) -- is affected. -- The ordering of homonyms on their chain does not necessarily follow -- the order of their corresponding scopes on the scope stack. For -- example, if package P and the enclosing scope both contain entities -- named E, then when compiling the package body the chain for E will -- hold the global entity first, and the local one (corresponding to -- the current inner scope) next. As a result, name resolution routines -- do not assume any relative ordering of the homonym chains, either -- for scope nesting or to order of appearance of context clauses. -- When compiling a child unit, entities in the parent scope are always -- immediately visible. When compiling the body of a child unit, private -- entities in the parent must also be made immediately visible. There -- are separate routines to make the visible and private declarations -- visible at various times (see package Sem_Ch7). -- +--------+ +-----+ -- | In use |-------->| EU1 |--------------------------> -- +--------+ +-----+ -- | | -- +--------+ +-----+ +-----+ -- | Stand. |---------------->| ES1 |--------------->| ES2 |---> -- +--------+ +-----+ +-----+ -- | | -- +---------+ | +-----+ -- | with'ed |------------------------------>| EW2 |---> -- +---------+ | +-----+ -- | | -- +--------+ +-----+ +-----+ -- | Scope2 |---------------->| E12 |--------------->| E22 |---> -- +--------+ +-----+ +-----+ -- | | -- +--------+ +-----+ +-----+ -- | Scope1 |---------------->| E11 |--------------->| E12 |---> -- +--------+ +-----+ +-----+ -- ^ | | -- | | | -- | +---------+ | | -- | | with'ed |-----------------------------------------> -- | +---------+ | | -- | | | -- Scope stack | | -- (innermost first) | | -- +----------------------------+ -- Names table => | Id1 | | | | Id2 | -- +----------------------------+ -- Name resolution must deal with several syntactic forms: simple names, -- qualified names, indexed names, and various forms of calls. -- Each identifier points to an entry in the names table. The resolution -- of a simple name consists in traversing the homonym chain, starting -- from the names table. If an entry is immediately visible, it is the one -- designated by the identifier. If only potentially use-visible entities -- are on the chain, we must verify that they do not hide each other. If -- the entity we find is overloadable, we collect all other overloadable -- entities on the chain as long as they are not hidden. -- -- To resolve expanded names, we must find the entity at the intersection -- of the entity chain for the scope (the prefix) and the homonym chain -- for the selector. In general, homonym chains will be much shorter than -- entity chains, so it is preferable to start from the names table as -- well. If the entity found is overloadable, we must collect all other -- interpretations that are defined in the scope denoted by the prefix. -- For records, protected types, and tasks, their local entities are -- removed from visibility chains on exit from the corresponding scope. -- From the outside, these entities are always accessed by selected -- notation, and the entity chain for the record type, protected type, -- etc. is traversed sequentially in order to find the designated entity. -- The discriminants of a type and the operations of a protected type or -- task are unchained on exit from the first view of the type, (such as -- a private or incomplete type declaration, or a protected type speci- -- fication) and re-chained when compiling the second view. -- In the case of operators, we do not make operators on derived types -- explicit. As a result, the notation P."+" may denote either a user- -- defined function with name "+", or else an implicit declaration of the -- operator "+" in package P. The resolution of expanded names always -- tries to resolve an operator name as such an implicitly defined entity, -- in addition to looking for explicit declarations. -- All forms of names that denote entities (simple names, expanded names, -- character literals in some cases) have a Entity attribute, which -- identifies the entity denoted by the name. --------------------- -- The Scope Stack -- --------------------- -- The Scope stack keeps track of the scopes currently been compiled. -- Every entity that contains declarations (including records) is placed -- on the scope stack while it is being processed, and removed at the end. -- Whenever a non-package scope is exited, the entities defined therein -- are removed from the visibility table, so that entities in outer scopes -- become visible (see previous description). On entry to Sem, the scope -- stack only contains the package Standard. As usual, subunits complicate -- this picture ever so slightly. -- The Rtsfind mechanism can force a call to Semantics while another -- compilation is in progress. The unit retrieved by Rtsfind must be -- compiled in its own context, and has no access to the visibility of -- the unit currently being compiled. The procedures Save_Scope_Stack and -- Restore_Scope_Stack make entities in current open scopes invisible -- before compiling the retrieved unit, and restore the compilation -- environment afterwards. ------------------------ -- Compiling subunits -- ------------------------ -- Subunits must be compiled in the environment of the corresponding -- stub, that is to say with the same visibility into the parent (and its -- context) that is available at the point of the stub declaration, but -- with the additional visibility provided by the context clause of the -- subunit itself. As a result, compilation of a subunit forces compilation -- of the parent (see description in lib-). At the point of the stub -- declaration, Analyze is called recursively to compile the proper body -- of the subunit, but without reinitializing the names table, nor the -- scope stack (i.e. standard is not pushed on the stack). In this fashion -- the context of the subunit is added to the context of the parent, and -- the subunit is compiled in the correct environment. Note that in the -- course of processing the context of a subunit, Standard will appear -- twice on the scope stack: once for the parent of the subunit, and -- once for the unit in the context clause being compiled. However, the -- two sets of entities are not linked by homonym chains, so that the -- compilation of any context unit happens in a fresh visibility -- environment. ------------------------------- -- Processing of USE Clauses -- ------------------------------- -- Every defining occurrence has a flag indicating if it is potentially use -- visible. Resolution of simple names examines this flag. The processing -- of use clauses consists in setting this flag on all visible entities -- defined in the corresponding package. On exit from the scope of the use -- clause, the corresponding flag must be reset. However, a package may -- appear in several nested use clauses (pathological but legal, alas!) -- which forces us to use a slightly more involved scheme: -- a) The defining occurrence for a package holds a flag -In_Use- to -- indicate that it is currently in the scope of a use clause. If a -- redundant use clause is encountered, then the corresponding occurrence -- of the package name is flagged -Redundant_Use-. -- b) On exit from a scope, the use clauses in its declarative part are -- scanned. The visibility flag is reset in all entities declared in -- package named in a use clause, as long as the package is not flagged -- as being in a redundant use clause (in which case the outer use -- clause is still in effect, and the direct visibility of its entities -- must be retained). -- Note that entities are not removed from their homonym chains on exit -- from the package specification. A subsequent use clause does not need -- to rechain the visible entities, but only to establish their direct -- visibility. ----------------------------------- -- Handling private declarations -- ----------------------------------- -- The principle that each entity has a single defining occurrence clashes -- with the presence of two separate definitions for private types: the -- first is the private type declaration, and second is the full type -- declaration. It is important that all references to the type point to -- the same defining occurrence, namely the first one. To enforce the two -- separate views of the entity, the corresponding information is swapped -- between the two declarations. Outside of the package, the defining -- occurrence only contains the private declaration information, while in -- the private part and the body of the package the defining occurrence -- contains the full declaration. To simplify the swap, the defining -- occurrence that currently holds the private declaration points to the -- full declaration. During semantic processing the defining occurrence -- also points to a list of private dependents, that is to say access -- types or composite types whose designated types or component types are -- subtypes or derived types of the private type in question. After the -- full declaration has been seen, the private dependents are updated to -- indicate that they have full definitions. ------------------------------------ -- Handling of Undefined Messages -- ------------------------------------ -- In normal mode, only the first use of an undefined identifier generates -- a message. The table Urefs is used to record error messages that have -- been issued so that second and subsequent ones do not generate further -- messages. However, the second reference causes text to be added to the -- original undefined message noting "(more references follow)". The -- full error list option (-gnatf) forces messages to be generated for -- every reference and disconnects the use of this table. type Uref_Entry is record Node : Node_Id; -- Node for identifier for which original message was posted. The -- Chars field of this identifier is used to detect later references -- to the same identifier. Err : Error_Msg_Id; -- Records error message Id of original undefined message. Reset to -- No_Error_Msg after the second occurrence, where it is used to add -- text to the original message as described above. Nvis : Boolean; -- Set if the message is not visible rather than undefined Loc : Source_Ptr; -- Records location of error message. Used to make sure that we do -- not consider a, b : undefined as two separate instances, which -- would otherwise happen, since the parser converts this sequence -- to a : undefined; b : undefined. end record; package Urefs is new Table.Table ( Table_Component_Type => Uref_Entry, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => 10, Table_Increment => 100, Table_Name => "Urefs"); Candidate_Renaming : Entity_Id; -- Holds a candidate interpretation that appears in a subprogram renaming -- declaration and does not match the given specification, but matches at -- least on the first formal. Allows better error message when given -- specification omits defaulted parameters, a common error. ----------------------- -- Local Subprograms -- ----------------------- procedure Analyze_Generic_Renaming (N : Node_Id; K : Entity_Kind); -- Common processing for all three kinds of generic renaming declarations. -- Enter new name and indicate that it renames the generic unit. procedure Analyze_Renamed_Character (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean); -- Renamed entity is given by a character literal, which must belong -- to the return type of the new entity. Is_Body indicates whether the -- declaration is a renaming_as_body. If the original declaration has -- already been frozen (because of an intervening body, e.g.) the body of -- the function must be built now. The same applies to the following -- various renaming procedures. procedure Analyze_Renamed_Dereference (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean); -- Renamed entity is given by an explicit dereference. Prefix must be a -- conformant access_to_subprogram type. procedure Analyze_Renamed_Entry (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean); -- If the renamed entity in a subprogram renaming is an entry or protected -- subprogram, build a body for the new entity whose only statement is a -- call to the renamed entity. procedure Analyze_Renamed_Family_Member (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean); -- Used when the renamed entity is an indexed component. The prefix must -- denote an entry family. function Applicable_Use (Pack_Name : Node_Id) return Boolean; -- Common code to Use_One_Package and Set_Use, to determine whether -- use clause must be processed. Pack_Name is an entity name that -- references the package in question. procedure Attribute_Renaming (N : Node_Id); -- Analyze renaming of attribute as function. The renaming declaration N -- is rewritten as a function body that returns the attribute reference -- applied to the formals of the function. procedure Check_Frozen_Renaming (N : Node_Id; Subp : Entity_Id); -- A renaming_as_body may occur after the entity of the original decla- -- ration has been frozen. In that case, the body of the new entity must -- be built now, because the usual mechanism of building the renamed -- body at the point of freezing will not work. Subp is the subprogram -- for which N provides the Renaming_As_Body. procedure Check_In_Previous_With_Clause (N : Node_Id; Nam : Node_Id); -- N is a use_package clause and Nam the package name, or N is a use_type -- clause and Nam is the prefix of the type name. In either case, verify -- that the package is visible at that point in the context: either it -- appears in a previous with_clause, or because it is a fully qualified -- name and the root ancestor appears in a previous with_clause. procedure Check_Library_Unit_Renaming (N : Node_Id; Old_E : Entity_Id); -- Verify that the entity in a renaming declaration that is a library unit -- is itself a library unit and not a nested unit or subunit. Also check -- that if the renaming is a child unit of a generic parent, then the -- renamed unit must also be a child unit of that parent. Finally, verify -- that a renamed generic unit is not an implicit child declared within -- an instance of the parent. procedure Chain_Use_Clause (N : Node_Id); -- Chain use clause onto list of uses clauses headed by First_Use_Clause in -- the proper scope table entry. This is usually the current scope, but it -- will be an inner scope when installing the use clauses of the private -- declarations of a parent unit prior to compiling the private part of a -- child unit. This chain is traversed when installing/removing use clauses -- when compiling a subunit or instantiating a generic body on the fly, -- when it is necessary to save and restore full environments. function Has_Implicit_Character_Literal (N : Node_Id) return Boolean; -- Find a type derived from Character or Wide_Character in the prefix of N. -- Used to resolved qualified names whose selector is a character literal. function Has_Private_With (E : Entity_Id) return Boolean; -- Ada 2005 (AI-262): Determines if the current compilation unit has a -- private with on E. procedure Find_Expanded_Name (N : Node_Id); -- Selected component is known to be expanded name. Verify legality -- of selector given the scope denoted by prefix. function Find_Renamed_Entity (N : Node_Id; Nam : Node_Id; New_S : Entity_Id; Is_Actual : Boolean := False) return Entity_Id; -- Find the renamed entity that corresponds to the given parameter profile -- in a subprogram renaming declaration. The renamed entity may be an -- operator, a subprogram, an entry, or a protected operation. Is_Actual -- indicates that the renaming is the one generated for an actual subpro- -- gram in an instance, for which special visibility checks apply. function Has_Implicit_Operator (N : Node_Id) return Boolean; -- N is an expanded name whose selector is an operator name (eg P."+"). -- A declarative part contains an implicit declaration of an operator -- if it has a declaration of a type to which one of the predefined -- operators apply. The existence of this routine is an artifact of -- our implementation: a more straightforward but more space-consuming -- choice would be to make all inherited operators explicit in the -- symbol table. procedure Inherit_Renamed_Profile (New_S : Entity_Id; Old_S : Entity_Id); -- A subprogram defined by a renaming declaration inherits the parameter -- profile of the renamed entity. The subtypes given in the subprogram -- specification are discarded and replaced with those of the renamed -- subprogram, which are then used to recheck the default values. function Is_Appropriate_For_Record (T : Entity_Id) return Boolean; -- Prefix is appropriate for record if it is of a record type, or -- an access to such. function Is_Appropriate_For_Entry_Prefix (T : Entity_Id) return Boolean; -- True if it is of a task type, a protected type, or else an access -- to one of these types. procedure Note_Redundant_Use (Clause : Node_Id); -- Mark the name in a use clause as redundant if the corresponding -- entity is already use-visible. Emit a warning if the use clause -- comes from source and the proper warnings are enabled. procedure Premature_Usage (N : Node_Id); -- Diagnose usage of an entity before it is visible procedure Use_One_Package (P : Entity_Id; N : Node_Id); -- Make visible entities declared in package P potentially use-visible -- in the current context. Also used in the analysis of subunits, when -- re-installing use clauses of parent units. N is the use_clause that -- names P (and possibly other packages). procedure Use_One_Type (Id : Node_Id); -- Id is the subtype mark from a use type clause. This procedure makes -- the primitive operators of the type potentially use-visible. procedure Write_Info; -- Write debugging information on entities declared in current scope procedure Write_Scopes; pragma Warnings (Off, Write_Scopes); -- Debugging information: dump all entities on scope stack -------------------------------- -- Analyze_Exception_Renaming -- -------------------------------- -- The language only allows a single identifier, but the tree holds -- an identifier list. The parser has already issued an error message -- if there is more than one element in the list. procedure Analyze_Exception_Renaming (N : Node_Id) is Id : constant Node_Id := Defining_Identifier (N); Nam : constant Node_Id := Name (N); begin Enter_Name (Id); Analyze (Nam); Set_Ekind (Id, E_Exception); Set_Exception_Code (Id, Uint_0); Set_Etype (Id, Standard_Exception_Type); Set_Is_Pure (Id, Is_Pure (Current_Scope)); if not Is_Entity_Name (Nam) or else Ekind (Entity (Nam)) /= E_Exception then Error_Msg_N ("invalid exception name in renaming", Nam); else if Present (Renamed_Object (Entity (Nam))) then Set_Renamed_Object (Id, Renamed_Object (Entity (Nam))); else Set_Renamed_Object (Id, Entity (Nam)); end if; end if; end Analyze_Exception_Renaming; --------------------------- -- Analyze_Expanded_Name -- --------------------------- procedure Analyze_Expanded_Name (N : Node_Id) is begin -- If the entity pointer is already set, this is an internal node, or -- a node that is analyzed more than once, after a tree modification. -- In such a case there is no resolution to perform, just set the type. -- For completeness, analyze prefix as well. if Present (Entity (N)) then if Is_Type (Entity (N)) then Set_Etype (N, Entity (N)); else Set_Etype (N, Etype (Entity (N))); end if; Analyze (Prefix (N)); return; else Find_Expanded_Name (N); end if; end Analyze_Expanded_Name; --------------------------------------- -- Analyze_Generic_Function_Renaming -- --------------------------------------- procedure Analyze_Generic_Function_Renaming (N : Node_Id) is begin Analyze_Generic_Renaming (N, E_Generic_Function); end Analyze_Generic_Function_Renaming; -------------------------------------- -- Analyze_Generic_Package_Renaming -- -------------------------------------- procedure Analyze_Generic_Package_Renaming (N : Node_Id) is begin -- Apply the Text_IO Kludge here, since we may be renaming -- one of the subpackages of Text_IO, then join common routine. Text_IO_Kludge (Name (N)); Analyze_Generic_Renaming (N, E_Generic_Package); end Analyze_Generic_Package_Renaming; ---------------------------------------- -- Analyze_Generic_Procedure_Renaming -- ---------------------------------------- procedure Analyze_Generic_Procedure_Renaming (N : Node_Id) is begin Analyze_Generic_Renaming (N, E_Generic_Procedure); end Analyze_Generic_Procedure_Renaming; ------------------------------ -- Analyze_Generic_Renaming -- ------------------------------ procedure Analyze_Generic_Renaming (N : Node_Id; K : Entity_Kind) is New_P : constant Entity_Id := Defining_Entity (N); Old_P : Entity_Id; Inst : Boolean := False; -- prevent junk warning begin if Name (N) = Error then return; end if; Generate_Definition (New_P); if Current_Scope /= Standard_Standard then Set_Is_Pure (New_P, Is_Pure (Current_Scope)); end if; if Nkind (Name (N)) = N_Selected_Component then Check_Generic_Child_Unit (Name (N), Inst); else Analyze (Name (N)); end if; if not Is_Entity_Name (Name (N)) then Error_Msg_N ("expect entity name in renaming declaration", Name (N)); Old_P := Any_Id; else Old_P := Entity (Name (N)); end if; Enter_Name (New_P); Set_Ekind (New_P, K); if Etype (Old_P) = Any_Type then null; elsif Ekind (Old_P) /= K then Error_Msg_N ("invalid generic unit name", Name (N)); else if Present (Renamed_Object (Old_P)) then Set_Renamed_Object (New_P, Renamed_Object (Old_P)); else Set_Renamed_Object (New_P, Old_P); end if; Set_Etype (New_P, Etype (Old_P)); Set_Has_Completion (New_P); if In_Open_Scopes (Old_P) then Error_Msg_N ("within its scope, generic denotes its instance", N); end if; Check_Library_Unit_Renaming (N, Old_P); end if; end Analyze_Generic_Renaming; ----------------------------- -- Analyze_Object_Renaming -- ----------------------------- procedure Analyze_Object_Renaming (N : Node_Id) is Id : constant Entity_Id := Defining_Identifier (N); Dec : Node_Id; Nam : constant Node_Id := Name (N); T : Entity_Id; T2 : Entity_Id; begin if Nam = Error then return; end if; Set_Is_Pure (Id, Is_Pure (Current_Scope)); Enter_Name (Id); -- The renaming of a component that depends on a discriminant -- requires an actual subtype, because in subsequent use of the object -- Gigi will be unable to locate the actual bounds. This explicit step -- is required when the renaming is generated in removing side effects -- of an already-analyzed expression. if Nkind (Nam) = N_Selected_Component and then Analyzed (Nam) then T := Etype (Nam); Dec := Build_Actual_Subtype_Of_Component (Etype (Nam), Nam); if Present (Dec) then Insert_Action (N, Dec); T := Defining_Identifier (Dec); Set_Etype (Nam, T); end if; elsif Present (Subtype_Mark (N)) then Find_Type (Subtype_Mark (N)); T := Entity (Subtype_Mark (N)); Analyze_And_Resolve (Nam, T); -- Ada 2005 (AI-230/AI-254): Access renaming else pragma Assert (Present (Access_Definition (N))); T := Access_Definition (Related_Nod => N, N => Access_Definition (N)); Analyze_And_Resolve (Nam, T); -- Ada 2005 (AI-231): "In the case where the type is defined by an -- access_definition, the renamed entity shall be of an access-to- -- constant type if and only if the access_definition defines an -- access-to-constant type" ARM 8.5.1(4) if Constant_Present (Access_Definition (N)) and then not Is_Access_Constant (Etype (Nam)) then Error_Msg_N ("(Ada 2005): the renamed object is not " & "access-to-constant ('R'M 8.5.1(6))", N); elsif Null_Exclusion_Present (Access_Definition (N)) then Error_Msg_N ("(Ada 2005): null-excluding attribute ignored " & "('R'M 8.5.1(6))?", N); end if; end if; -- An object renaming requires an exact match of the type; -- class-wide matching is not allowed. if Is_Class_Wide_Type (T) and then Base_Type (Etype (Nam)) /= Base_Type (T) then Wrong_Type (Nam, T); end if; T2 := Etype (Nam); -- (Ada 2005: AI-326): Handle wrong use of incomplete type if Nkind (Nam) = N_Explicit_Dereference and then Ekind (Etype (T2)) = E_Incomplete_Type then Error_Msg_N ("invalid use of incomplete type", Id); return; end if; Set_Ekind (Id, E_Variable); Init_Size_Align (Id); if T = Any_Type or else Etype (Nam) = Any_Type then return; -- Verify that the renamed entity is an object or a function call. -- It may have been rewritten in several ways. elsif Is_Object_Reference (Nam) then if Comes_From_Source (N) and then Is_Dependent_Component_Of_Mutable_Object (Nam) then Error_Msg_N ("illegal renaming of discriminant-dependent component", Nam); else null; end if; -- A static function call may have been folded into a literal elsif Nkind (Original_Node (Nam)) = N_Function_Call -- When expansion is disabled, attribute reference is not -- rewritten as function call. Otherwise it may be rewritten -- as a conversion, so check original node. or else (Nkind (Original_Node (Nam)) = N_Attribute_Reference and then Is_Function_Attribute_Name (Attribute_Name (Original_Node (Nam)))) -- Weird but legal, equivalent to renaming a function call -- Illegal if the literal is the result of constant-folding -- an attribute reference that is not a function. or else (Is_Entity_Name (Nam) and then Ekind (Entity (Nam)) = E_Enumeration_Literal and then Nkind (Original_Node (Nam)) /= N_Attribute_Reference) or else (Nkind (Nam) = N_Type_Conversion and then Is_Tagged_Type (Entity (Subtype_Mark (Nam)))) then null; else if Nkind (Nam) = N_Type_Conversion then Error_Msg_N ("renaming of conversion only allowed for tagged types", Nam); else Error_Msg_N ("expect object name in renaming", Nam); end if; end if; Set_Etype (Id, T2); if not Is_Variable (Nam) then Set_Ekind (Id, E_Constant); Set_Never_Set_In_Source (Id, True); Set_Is_True_Constant (Id, True); end if; Set_Renamed_Object (Id, Nam); end Analyze_Object_Renaming; ------------------------------ -- Analyze_Package_Renaming -- ------------------------------ procedure Analyze_Package_Renaming (N : Node_Id) is New_P : constant Entity_Id := Defining_Entity (N); Old_P : Entity_Id; Spec : Node_Id; begin if Name (N) = Error then return; end if; -- Apply Text_IO kludge here, since we may be renaming one of -- the children of Text_IO Text_IO_Kludge (Name (N)); if Current_Scope /= Standard_Standard then Set_Is_Pure (New_P, Is_Pure (Current_Scope)); end if; Enter_Name (New_P); Analyze (Name (N)); if Is_Entity_Name (Name (N)) then Old_P := Entity (Name (N)); else Old_P := Any_Id; end if; if Etype (Old_P) = Any_Type then Error_Msg_N ("expect package name in renaming", Name (N)); -- Ada 2005 (AI-50217): Limited withed packages cannot be renamed elsif Ekind (Old_P) = E_Package and then From_With_Type (Old_P) then Error_Msg_N ("limited withed package cannot be renamed", Name (N)); elsif Ekind (Old_P) /= E_Package and then not (Ekind (Old_P) = E_Generic_Package and then In_Open_Scopes (Old_P)) then if Ekind (Old_P) = E_Generic_Package then Error_Msg_N ("generic package cannot be renamed as a package", Name (N)); else Error_Msg_Sloc := Sloc (Old_P); Error_Msg_NE ("expect package name in renaming, found& declared#", Name (N), Old_P); end if; -- Set basic attributes to minimize cascaded errors Set_Ekind (New_P, E_Package); Set_Etype (New_P, Standard_Void_Type); else -- Entities in the old package are accessible through the -- renaming entity. The simplest implementation is to have -- both packages share the entity list. Set_Ekind (New_P, E_Package); Set_Etype (New_P, Standard_Void_Type); if Present (Renamed_Object (Old_P)) then Set_Renamed_Object (New_P, Renamed_Object (Old_P)); else Set_Renamed_Object (New_P, Old_P); end if; Set_Has_Completion (New_P); Set_First_Entity (New_P, First_Entity (Old_P)); Set_Last_Entity (New_P, Last_Entity (Old_P)); Set_First_Private_Entity (New_P, First_Private_Entity (Old_P)); Check_Library_Unit_Renaming (N, Old_P); Generate_Reference (Old_P, Name (N)); -- If this is the renaming declaration of a package instantiation -- within itself, it is the declaration that ends the list of actuals -- for the instantiation. At this point, the subtypes that rename -- the actuals are flagged as generic, to avoid spurious ambiguities -- if the actuals for two distinct formals happen to coincide. If -- the actual is a private type, the subtype has a private completion -- that is flagged in the same fashion. -- Resolution is identical to what is was in the original generic. -- On exit from the generic instance, these are turned into regular -- subtypes again, so they are compatible with types in their class. if not Is_Generic_Instance (Old_P) then return; else Spec := Specification (Unit_Declaration_Node (Old_P)); end if; if Nkind (Spec) = N_Package_Specification and then Present (Generic_Parent (Spec)) and then Old_P = Current_Scope and then Chars (New_P) = Chars (Generic_Parent (Spec)) then declare E : Entity_Id := First_Entity (Old_P); begin while Present (E) and then E /= New_P loop if Is_Type (E) and then Nkind (Parent (E)) = N_Subtype_Declaration then Set_Is_Generic_Actual_Type (E); if Is_Private_Type (E) and then Present (Full_View (E)) then Set_Is_Generic_Actual_Type (Full_View (E)); end if; end if; Next_Entity (E); end loop; end; end if; end if; end Analyze_Package_Renaming; ------------------------------- -- Analyze_Renamed_Character -- ------------------------------- procedure Analyze_Renamed_Character (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean) is C : constant Node_Id := Name (N); begin if Ekind (New_S) = E_Function then Resolve (C, Etype (New_S)); if Is_Body then Check_Frozen_Renaming (N, New_S); end if; else Error_Msg_N ("character literal can only be renamed as function", N); end if; end Analyze_Renamed_Character; --------------------------------- -- Analyze_Renamed_Dereference -- --------------------------------- procedure Analyze_Renamed_Dereference (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean) is Nam : constant Node_Id := Name (N); P : constant Node_Id := Prefix (Nam); Typ : Entity_Id; Ind : Interp_Index; It : Interp; begin if not Is_Overloaded (P) then if Ekind (Etype (Nam)) /= E_Subprogram_Type or else not Type_Conformant (Etype (Nam), New_S) then Error_Msg_N ("designated type does not match specification", P); else Resolve (P); end if; return; else Typ := Any_Type; Get_First_Interp (Nam, Ind, It); while Present (It.Nam) loop if Ekind (It.Nam) = E_Subprogram_Type and then Type_Conformant (It.Nam, New_S) then if Typ /= Any_Id then Error_Msg_N ("ambiguous renaming", P); return; else Typ := It.Nam; end if; end if; Get_Next_Interp (Ind, It); end loop; if Typ = Any_Type then Error_Msg_N ("designated type does not match specification", P); else Resolve (N, Typ); if Is_Body then Check_Frozen_Renaming (N, New_S); end if; end if; end if; end Analyze_Renamed_Dereference; --------------------------- -- Analyze_Renamed_Entry -- --------------------------- procedure Analyze_Renamed_Entry (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean) is Nam : constant Node_Id := Name (N); Sel : constant Node_Id := Selector_Name (Nam); Old_S : Entity_Id; begin if Entity (Sel) = Any_Id then -- Selector is undefined on prefix. Error emitted already Set_Has_Completion (New_S); return; end if; -- Otherwise, find renamed entity, and build body of New_S as a call -- to it. Old_S := Find_Renamed_Entity (N, Selector_Name (Nam), New_S); if Old_S = Any_Id then Error_Msg_N (" no subprogram or entry matches specification", N); else if Is_Body then Check_Subtype_Conformant (New_S, Old_S, N); Generate_Reference (New_S, Defining_Entity (N), 'b'); Style.Check_Identifier (Defining_Entity (N), New_S); else -- Only mode conformance required for a renaming_as_declaration Check_Mode_Conformant (New_S, Old_S, N); end if; Inherit_Renamed_Profile (New_S, Old_S); end if; Set_Convention (New_S, Convention (Old_S)); Set_Has_Completion (New_S, Inside_A_Generic); if Is_Body then Check_Frozen_Renaming (N, New_S); end if; end Analyze_Renamed_Entry; ----------------------------------- -- Analyze_Renamed_Family_Member -- ----------------------------------- procedure Analyze_Renamed_Family_Member (N : Node_Id; New_S : Entity_Id; Is_Body : Boolean) is Nam : constant Node_Id := Name (N); P : constant Node_Id := Prefix (Nam); Old_S : Entity_Id; begin if (Is_Entity_Name (P) and then Ekind (Entity (P)) = E_Entry_Family) or else (Nkind (P) = N_Selected_Component and then Ekind (Entity (Selector_Name (P))) = E_Entry_Family) then if Is_Entity_Name (P) then Old_S := Entity (P); else Old_S := Entity (Selector_Name (P)); end if; if not Entity_Matches_Spec (Old_S, New_S) then Error_Msg_N ("entry family does not match specification", N); elsif Is_Body then Check_Subtype_Conformant (New_S, Old_S, N); Generate_Reference (New_S, Defining_Entity (N), 'b'); Style.Check_Identifier (Defining_Entity (N), New_S); end if; else Error_Msg_N ("no entry family matches specification", N); end if; Set_Has_Completion (New_S, Inside_A_Generic); if Is_Body then Check_Frozen_Renaming (N, New_S); end if; end Analyze_Renamed_Family_Member; --------------------------------- -- Analyze_Subprogram_Renaming -- --------------------------------- procedure Analyze_Subprogram_Renaming (N : Node_Id) is Spec : constant Node_Id := Specification (N); Save_AV : constant Ada_Version_Type := Ada_Version; Save_AV_Exp : constant Ada_Version_Type := Ada_Version_Explicit; Nam : constant Node_Id := Name (N); New_S : Entity_Id; Old_S : Entity_Id := Empty; Rename_Spec : Entity_Id; Formal_Spec : constant Node_Id := Corresponding_Formal_Spec (N); Is_Actual : constant Boolean := Present (Formal_Spec); Inst_Node : Node_Id := Empty; function Original_Subprogram (Subp : Entity_Id) return Entity_Id; -- Find renamed entity when the declaration is a renaming_as_body -- and the renamed entity may itself be a renaming_as_body. Used to -- enforce rule that a renaming_as_body is illegal if the declaration -- occurs before the subprogram it completes is frozen, and renaming -- indirectly renames the subprogram itself.(Defect Report 8652/0027). ------------------------- -- Original_Subprogram -- ------------------------- function Original_Subprogram (Subp : Entity_Id) return Entity_Id is Orig_Decl : Node_Id; Orig_Subp : Entity_Id; begin -- First case: renamed entity is itself a renaming if Present (Alias (Subp)) then return Alias (Subp); elsif Nkind (Unit_Declaration_Node (Subp)) = N_Subprogram_Declaration and then Present (Corresponding_Body (Unit_Declaration_Node (Subp))) then -- Check if renamed entity is a renaming_as_body Orig_Decl := Unit_Declaration_Node (Corresponding_Body (Unit_Declaration_Node (Subp))); if Nkind (Orig_Decl) = N_Subprogram_Renaming_Declaration then Orig_Subp := Entity (Name (Orig_Decl)); if Orig_Subp = Rename_Spec then -- Circularity detected return Orig_Subp; else return (Original_Subprogram (Orig_Subp)); end if; else return Subp; end if; else return Subp; end if; end Original_Subprogram; -- Start of processing for Analyze_Subprogram_Renaming begin -- We must test for the attribute renaming case before the Analyze -- call because otherwise Sem_Attr will complain that the attribute -- is missing an argument when it is analyzed. if Nkind (Nam) = N_Attribute_Reference then -- In the case of an abstract formal subprogram association, -- rewrite an actual given by a stream attribute as the name -- of the corresponding stream primitive of the type. -- In a generic context the stream operations are not generated, -- and this must be treated as a normal attribute reference, to -- be expanded in subsequent instantiations. if Is_Actual and then Is_Abstract (Formal_Spec) and then Expander_Active then declare Stream_Prim : Entity_Id; Prefix_Type : constant Entity_Id := Entity (Prefix (Nam)); begin -- The class-wide forms of the stream attributes are not -- primitive dispatching operations (even though they -- internally dispatch to a stream attribute). if Is_Class_Wide_Type (Prefix_Type) then Error_Msg_N ("attribute must be a primitive dispatching operation", Nam); return; end if; -- Retrieve the primitive subprogram associated with the -- attribute. This can only be a stream attribute, since -- those are the only ones that are dispatching (and the -- actual for an abstract formal subprogram must be a -- dispatching operation). case Attribute_Name (Nam) is when Name_Input => Stream_Prim := Find_Prim_Op (Prefix_Type, TSS_Stream_Input); when Name_Output => Stream_Prim := Find_Prim_Op (Prefix_Type, TSS_Stream_Output); when Name_Read => Stream_Prim := Find_Prim_Op (Prefix_Type, TSS_Stream_Read); when Name_Write => Stream_Prim := Find_Prim_Op (Prefix_Type, TSS_Stream_Write); when others => Error_Msg_N ("attribute must be a primitive dispatching operation", Nam); return; end case; -- Rewrite the attribute into the name of its corresponding -- primitive dispatching subprogram. We can then proceed with -- the usual processing for subprogram renamings. declare Prim_Name : constant Node_Id := Make_Identifier (Sloc (Nam), Chars => Chars (Stream_Prim)); begin Set_Entity (Prim_Name, Stream_Prim); Rewrite (Nam, Prim_Name); Analyze (Nam); end; end; -- Normal processing for a renaming of an attribute else Attribute_Renaming (N); return; end if; end if; -- Check whether this declaration corresponds to the instantiation -- of a formal subprogram. -- If this is an instantiation, the corresponding actual is frozen -- and error messages can be made more precise. If this is a default -- subprogram, the entity is already established in the generic, and -- is not retrieved by visibility. If it is a default with a box, the -- candidate interpretations, if any, have been collected when building -- the renaming declaration. If overloaded, the proper interpretation -- is determined in Find_Renamed_Entity. If the entity is an operator, -- Find_Renamed_Entity applies additional visibility checks. if Is_Actual then Inst_Node := Unit_Declaration_Node (Formal_Spec); if Is_Entity_Name (Nam) and then Present (Entity (Nam)) and then not Comes_From_Source (Nam) and then not Is_Overloaded (Nam) then Old_S := Entity (Nam); New_S := Analyze_Subprogram_Specification (Spec); -- Operator case if Ekind (Entity (Nam)) = E_Operator then -- Box present if Box_Present (Inst_Node) then Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual); -- If there is an immediately visible homonym of the operator -- and the declaration has a default, this is worth a warning -- because the user probably did not intend to get the pre- -- defined operator, visible in the generic declaration. -- To find if there is an intended candidate, analyze the -- renaming again in the current context. elsif Scope (Old_S) = Standard_Standard and then Present (Default_Name (Inst_Node)) then declare Decl : constant Node_Id := New_Copy_Tree (N); Hidden : Entity_Id; begin Set_Entity (Name (Decl), Empty); Analyze (Name (Decl)); Hidden := Find_Renamed_Entity (Decl, Name (Decl), New_S, True); if Present (Hidden) and then In_Open_Scopes (Scope (Hidden)) and then Is_Immediately_Visible (Hidden) and then Comes_From_Source (Hidden) and then Hidden /= Old_S then Error_Msg_Sloc := Sloc (Hidden); Error_Msg_N ("?default subprogram is resolved " & "in the generic declaration " & "('R'M 12.6(17))", N); Error_Msg_NE ("\?and will not use & #", N, Hidden); end if; end; end if; end if; else Analyze (Nam); New_S := Analyze_Subprogram_Specification (Spec); end if; else -- Renamed entity must be analyzed first, to avoid being hidden by -- new name (which might be the same in a generic instance). Analyze (Nam); -- The renaming defines a new overloaded entity, which is analyzed -- like a subprogram declaration. New_S := Analyze_Subprogram_Specification (Spec); end if; if Current_Scope /= Standard_Standard then Set_Is_Pure (New_S, Is_Pure (Current_Scope)); end if; Rename_Spec := Find_Corresponding_Spec (N); if Present (Rename_Spec) then -- Renaming_As_Body. Renaming declaration is the completion of -- the declaration of Rename_Spec. We will build an actual body -- for it at the freezing point. Set_Corresponding_Spec (N, Rename_Spec); if Nkind (Unit_Declaration_Node (Rename_Spec)) = N_Abstract_Subprogram_Declaration then -- Input and Output stream functions are abstract if the object -- type is abstract. However, these functions may receive explicit -- declarations in representation clauses, making the attribute -- subprograms usable as defaults in subsequent type extensions. -- In this case we rewrite the declaration to make the subprogram -- non-abstract. We remove the previous declaration, and insert -- the new one at the point of the renaming, to prevent premature -- access to unfrozen types. The new declaration reuses the -- specification of the previous one, and must not be analyzed. pragma Assert (Is_TSS (Rename_Spec, TSS_Stream_Output) or else Is_TSS (Rename_Spec, TSS_Stream_Input)); declare Old_Decl : constant Node_Id := Unit_Declaration_Node (Rename_Spec); New_Decl : constant Node_Id := Make_Subprogram_Declaration (Sloc (N), Specification => Relocate_Node (Specification (Old_Decl))); begin Remove (Old_Decl); Insert_After (N, New_Decl); Set_Is_Abstract (Rename_Spec, False); Set_Analyzed (New_Decl); end; end if; Set_Corresponding_Body (Unit_Declaration_Node (Rename_Spec), New_S); if Ada_Version = Ada_83 and then Comes_From_Source (N) then Error_Msg_N ("(Ada 83) renaming cannot serve as a body", N); end if; Set_Convention (New_S, Convention (Rename_Spec)); Check_Fully_Conformant (New_S, Rename_Spec); Set_Public_Status (New_S); -- Indicate that the entity in the declaration functions like the -- corresponding body, and is not a new entity. The body will be -- constructed later at the freeze point, so indicate that the -- completion has not been seen yet. Set_Ekind (New_S, E_Subprogram_Body); New_S := Rename_Spec; Set_Has_Completion (Rename_Spec, False); -- Ada 2005: check overriding indicator if Must_Override (Specification (N)) and then not Is_Overriding_Operation (Rename_Spec) then Error_Msg_NE ("subprogram& is not overriding", N, Rename_Spec); elsif Must_Not_Override (Specification (N)) and then Is_Overriding_Operation (Rename_Spec) then Error_Msg_NE ("subprogram& overrides inherited operation", N, Rename_Spec); end if; else Generate_Definition (New_S); New_Overloaded_Entity (New_S); if Is_Entity_Name (Nam) and then Is_Intrinsic_Subprogram (Entity (Nam)) then null; else Check_Delayed_Subprogram (New_S); end if; end if; -- There is no need for elaboration checks on the new entity, which may -- be called before the next freezing point where the body will appear. -- Elaboration checks refer to the real entity, not the one created by -- the renaming declaration. Set_Kill_Elaboration_Checks (New_S, True); if Etype (Nam) = Any_Type then Set_Has_Completion (New_S); return; elsif Nkind (Nam) = N_Selected_Component then -- Renamed entity is an entry or protected subprogram. For those -- cases an explicit body is built (at the point of freezing of this -- entity) that contains a call to the renamed entity. Analyze_Renamed_Entry (N, New_S, Present (Rename_Spec)); return; elsif Nkind (Nam) = N_Explicit_Dereference then -- Renamed entity is designated by access_to_subprogram expression. -- Must build body to encapsulate call, as in the entry case. Analyze_Renamed_Dereference (N, New_S, Present (Rename_Spec)); return; elsif Nkind (Nam) = N_Indexed_Component then Analyze_Renamed_Family_Member (N, New_S, Present (Rename_Spec)); return; elsif Nkind (Nam) = N_Character_Literal then Analyze_Renamed_Character (N, New_S, Present (Rename_Spec)); return; elsif (not Is_Entity_Name (Nam) and then Nkind (Nam) /= N_Operator_Symbol) or else not Is_Overloadable (Entity (Nam)) then Error_Msg_N ("expect valid subprogram name in renaming", N); return; end if; -- Most common case: subprogram renames subprogram. No body is generated -- in this case, so we must indicate the declaration is complete as is. if No (Rename_Spec) then Set_Has_Completion (New_S); end if; -- Find the renamed entity that matches the given specification. Disable -- Ada_83 because there is no requirement of full conformance between -- renamed entity and new entity, even though the same circuit is used. -- This is a bit of a kludge, which introduces a really irregular use of -- Ada_Version[_Explicit]. Would be nice to find cleaner way to do this -- ??? Ada_Version := Ada_Version_Type'Max (Ada_Version, Ada_95); Ada_Version_Explicit := Ada_Version; if No (Old_S) then Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual); end if; if Old_S /= Any_Id then if Is_Actual and then From_Default (N) then -- This is an implicit reference to the default actual Generate_Reference (Old_S, Nam, Typ => 'i', Force => True); else Generate_Reference (Old_S, Nam); end if; -- For a renaming-as-body, require subtype conformance, but if the -- declaration being completed has not been frozen, then inherit the -- convention of the renamed subprogram prior to checking conformance -- (unless the renaming has an explicit convention established; the -- rule stated in the RM doesn't seem to address this ???). if Present (Rename_Spec) then Generate_Reference (Rename_Spec, Defining_Entity (Spec), 'b'); Style.Check_Identifier (Defining_Entity (Spec), Rename_Spec); if not Is_Frozen (Rename_Spec) then if not Has_Convention_Pragma (Rename_Spec) then Set_Convention (New_S, Convention (Old_S)); end if; if Ekind (Old_S) /= E_Operator then Check_Mode_Conformant (New_S, Old_S, Spec); end if; if Original_Subprogram (Old_S) = Rename_Spec then Error_Msg_N ("unfrozen subprogram cannot rename itself ", N); end if; else Check_Subtype_Conformant (New_S, Old_S, Spec); end if; Check_Frozen_Renaming (N, Rename_Spec); -- Check explicitly that renamed entity is not intrinsic, because -- in in a generic the renamed body is not built. In this case, -- the renaming_as_body is a completion. if Inside_A_Generic then if Is_Frozen (Rename_Spec) and then Is_Intrinsic_Subprogram (Old_S) then Error_Msg_N ("subprogram in renaming_as_body cannot be intrinsic", Name (N)); end if; Set_Has_Completion (Rename_Spec); end if; elsif Ekind (Old_S) /= E_Operator then Check_Mode_Conformant (New_S, Old_S); if Is_Actual and then Error_Posted (New_S) then Error_Msg_NE ("invalid actual subprogram: & #!", N, Old_S); end if; end if; if No (Rename_Spec) then -- The parameter profile of the new entity is that of the renamed -- entity: the subtypes given in the specification are irrelevant. Inherit_Renamed_Profile (New_S, Old_S); -- A call to the subprogram is transformed into a call to the -- renamed entity. This is transitive if the renamed entity is -- itself a renaming. if Present (Alias (Old_S)) then Set_Alias (New_S, Alias (Old_S)); else Set_Alias (New_S, Old_S); end if; -- Note that we do not set Is_Intrinsic_Subprogram if we have a -- renaming as body, since the entity in this case is not an -- intrinsic (it calls an intrinsic, but we have a real body for -- this call, and it is in this body that the required intrinsic -- processing will take place). -- Also, if this is a renaming of inequality, the renamed operator -- is intrinsic, but what matters is the corresponding equality -- operator, which may be user-defined. Set_Is_Intrinsic_Subprogram (New_S, Is_Intrinsic_Subprogram (Old_S) and then (Chars (Old_S) /= Name_Op_Ne or else Ekind (Old_S) = E_Operator or else Is_Intrinsic_Subprogram (Corresponding_Equality (Old_S)))); if Ekind (Alias (New_S)) = E_Operator then Set_Has_Delayed_Freeze (New_S, False); end if; -- If the renaming corresponds to an association for an abstract -- formal subprogram, then various attributes must be set to -- indicate that the renaming is an abstract dispatching operation -- with a controlling type. if Is_Actual and then Is_Abstract (Formal_Spec) then -- Mark the renaming as abstract here, so Find_Dispatching_Type -- see it as corresponding to a generic association for a -- formal abstract subprogram Set_Is_Abstract (New_S); declare New_S_Ctrl_Type : constant Entity_Id := Find_Dispatching_Type (New_S); Old_S_Ctrl_Type : constant Entity_Id := Find_Dispatching_Type (Old_S); begin if Old_S_Ctrl_Type /= New_S_Ctrl_Type then Error_Msg_NE ("actual must be dispatching subprogram for type&", Nam, New_S_Ctrl_Type); else Set_Is_Dispatching_Operation (New_S); Check_Controlling_Formals (New_S_Ctrl_Type, New_S); -- In the case where the actual in the formal subprogram -- is itself a formal abstract subprogram association, -- there's no dispatch table component or position to -- inherit. if Present (DTC_Entity (Old_S)) then Set_DTC_Entity (New_S, DTC_Entity (Old_S)); Set_DT_Position (New_S, DT_Position (Old_S)); end if; end if; end; end if; end if; if not Is_Actual and then (Old_S = New_S or else (Nkind (Nam) /= N_Expanded_Name and then Chars (Old_S) = Chars (New_S))) then Error_Msg_N ("subprogram cannot rename itself", N); end if; Set_Convention (New_S, Convention (Old_S)); Set_Is_Abstract (New_S, Is_Abstract (Old_S)); Check_Library_Unit_Renaming (N, Old_S); -- Pathological case: procedure renames entry in the scope of its -- task. Entry is given by simple name, but body must be built for -- procedure. Of course if called it will deadlock. if Ekind (Old_S) = E_Entry then Set_Has_Completion (New_S, False); Set_Alias (New_S, Empty); end if; if Is_Actual then Freeze_Before (N, Old_S); Set_Has_Delayed_Freeze (New_S, False); Freeze_Before (N, New_S); -- An abstract subprogram is only allowed as an actual in the case -- where the formal subprogram is also abstract. if (Ekind (Old_S) = E_Procedure or else Ekind (Old_S) = E_Function) and then Is_Abstract (Old_S) and then not Is_Abstract (Formal_Spec) then Error_Msg_N ("abstract subprogram not allowed as generic actual", Nam); end if; end if; else -- A common error is to assume that implicit operators for types are -- defined in Standard, or in the scope of a subtype. In those cases -- where the renamed entity is given with an expanded name, it is -- worth mentioning that operators for the type are not declared in -- the scope given by the prefix. if Nkind (Nam) = N_Expanded_Name and then Nkind (Selector_Name (Nam)) = N_Operator_Symbol and then Scope (Entity (Nam)) = Standard_Standard then declare T : constant Entity_Id := Base_Type (Etype (First_Formal (New_S))); begin Error_Msg_Node_2 := Prefix (Nam); Error_Msg_NE ("operator for type& is not declared in&", Prefix (Nam), T); end; else Error_Msg_NE ("no visible subprogram matches the specification for&", Spec, New_S); end if; if Present (Candidate_Renaming) then declare F1 : Entity_Id; F2 : Entity_Id; begin F1 := First_Formal (Candidate_Renaming); F2 := First_Formal (New_S); while Present (F1) and then Present (F2) loop Next_Formal (F1); Next_Formal (F2); end loop; if Present (F1) and then Present (Default_Value (F1)) then if Present (Next_Formal (F1)) then Error_Msg_NE ("\missing specification for &" & " and other formals with defaults", Spec, F1); else Error_Msg_NE ("\missing specification for &", Spec, F1); end if; end if; end; end if; end if; -- Ada 2005 AI 404: if the new subprogram is dispatching, verify that -- controlling access parameters are known non-null for the renamed -- subprogram. Test also applies to a subprogram instantiation that -- is dispatching. Test is skipped if some previous error was detected -- that set Old_S to Any_Id. if Ada_Version >= Ada_05 and then Old_S /= Any_Id and then not Is_Dispatching_Operation (Old_S) and then Is_Dispatching_Operation (New_S) then declare Old_F : Entity_Id; New_F : Entity_Id; begin Old_F := First_Formal (Old_S); New_F := First_Formal (New_S); while Present (Old_F) loop if Ekind (Etype (Old_F)) = E_Anonymous_Access_Type and then Is_Controlling_Formal (New_F) and then not Can_Never_Be_Null (Old_F) then Error_Msg_N ("access parameter is controlling,", New_F); Error_Msg_NE ("\corresponding parameter of& " & " must be explicitly null excluding", New_F, Old_S); end if; Next_Formal (Old_F); Next_Formal (New_F); end loop; end; end if; -- A useful warning, suggested by Ada Bug Finder (Ada-Europe 2005) if Comes_From_Source (N) and then Present (Old_S) and then Nkind (Old_S) = N_Defining_Operator_Symbol and then Nkind (New_S) = N_Defining_Operator_Symbol and then Chars (Old_S) /= Chars (New_S) then Error_Msg_NE ("?& is being renamed as a different operator", New_S, Old_S); end if; Ada_Version := Save_AV; Ada_Version_Explicit := Save_AV_Exp; end Analyze_Subprogram_Renaming; ------------------------- -- Analyze_Use_Package -- ------------------------- -- Resolve the package names in the use clause, and make all the visible -- entities defined in the package potentially use-visible. If the package -- is already in use from a previous use clause, its visible entities are -- already use-visible. In that case, mark the occurrence as a redundant -- use. If the package is an open scope, i.e. if the use clause occurs -- within the package itself, ignore it. procedure Analyze_Use_Package (N : Node_Id) is Pack_Name : Node_Id; Pack : Entity_Id; -- Start of processing for Analyze_Use_Package begin Set_Hidden_By_Use_Clause (N, No_Elist); -- Use clause is not allowed in a spec of a predefined package -- declaration except that packages whose file name starts a-n are OK -- (these are children of Ada.Numerics, and such packages are never -- loaded by Rtsfind). if Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit)) and then Name_Buffer (1 .. 3) /= "a-n" and then Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Declaration then Error_Msg_N ("use clause not allowed in predefined spec", N); end if; -- Chain clause to list of use clauses in current scope if Nkind (Parent (N)) /= N_Compilation_Unit then Chain_Use_Clause (N); end if; -- Loop through package names to identify referenced packages Pack_Name := First (Names (N)); while Present (Pack_Name) loop Analyze (Pack_Name); if Nkind (Parent (N)) = N_Compilation_Unit and then Nkind (Pack_Name) = N_Expanded_Name then declare Pref : Node_Id := Prefix (Pack_Name); begin while Nkind (Pref) = N_Expanded_Name loop Pref := Prefix (Pref); end loop; if Entity (Pref) = Standard_Standard then Error_Msg_N ("predefined package Standard cannot appear" & " in a context clause", Pref); end if; end; end if; Next (Pack_Name); end loop; -- Loop through package names to mark all entities as potentially -- use visible. Pack_Name := First (Names (N)); while Present (Pack_Name) loop if Is_Entity_Name (Pack_Name) then Pack := Entity (Pack_Name); if Ekind (Pack) /= E_Package and then Etype (Pack) /= Any_Type then if Ekind (Pack) = E_Generic_Package then Error_Msg_N ("a generic package is not allowed in a use clause", Pack_Name); else Error_Msg_N ("& is not a usable package", Pack_Name); end if; else if Nkind (Parent (N)) = N_Compilation_Unit then Check_In_Previous_With_Clause (N, Pack_Name); end if; if Applicable_Use (Pack_Name) then Use_One_Package (Pack, N); end if; end if; end if; Next (Pack_Name); end loop; end Analyze_Use_Package; ---------------------- -- Analyze_Use_Type -- ---------------------- procedure Analyze_Use_Type (N : Node_Id) is Id : Entity_Id; begin Set_Hidden_By_Use_Clause (N, No_Elist); -- Chain clause to list of use clauses in current scope if Nkind (Parent (N)) /= N_Compilation_Unit then Chain_Use_Clause (N); end if; Id := First (Subtype_Marks (N)); while Present (Id) loop Find_Type (Id); if Entity (Id) /= Any_Type then Use_One_Type (Id); if Nkind (Parent (N)) = N_Compilation_Unit then if Nkind (Id) = N_Identifier then Error_Msg_N ("type is not directly visible", Id); elsif Is_Child_Unit (Scope (Entity (Id))) and then Scope (Entity (Id)) /= System_Aux_Id then Check_In_Previous_With_Clause (N, Prefix (Id)); end if; end if; end if; Next (Id); end loop; end Analyze_Use_Type; -------------------- -- Applicable_Use -- -------------------- function Applicable_Use (Pack_Name : Node_Id) return Boolean is Pack : constant Entity_Id := Entity (Pack_Name); begin if In_Open_Scopes (Pack) then return False; elsif In_Use (Pack) then Note_Redundant_Use (Pack_Name); return False; elsif Present (Renamed_Object (Pack)) and then In_Use (Renamed_Object (Pack)) then Note_Redundant_Use (Pack_Name); return False; else return True; end if; end Applicable_Use; ------------------------ -- Attribute_Renaming -- ------------------------ procedure Attribute_Renaming (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Nam : constant Node_Id := Name (N); Spec : constant Node_Id := Specification (N); New_S : constant Entity_Id := Defining_Unit_Name (Spec); Aname : constant Name_Id := Attribute_Name (Nam); Form_Num : Nat := 0; Expr_List : List_Id := No_List; Attr_Node : Node_Id; Body_Node : Node_Id; Param_Spec : Node_Id; begin Generate_Definition (New_S); -- This procedure is called in the context of subprogram renaming, -- and thus the attribute must be one that is a subprogram. All of -- those have at least one formal parameter, with the singular -- exception of AST_Entry (which is a real oddity, it is odd that -- this can be renamed at all!) if not Is_Non_Empty_List (Parameter_Specifications (Spec)) then if Aname /= Name_AST_Entry then Error_Msg_N ("subprogram renaming an attribute must have formals", N); return; end if; else Param_Spec := First (Parameter_Specifications (Spec)); while Present (Param_Spec) loop Form_Num := Form_Num + 1; if Nkind (Parameter_Type (Param_Spec)) /= N_Access_Definition then Find_Type (Parameter_Type (Param_Spec)); -- The profile of the new entity denotes the base type (s) of -- the types given in the specification. For access parameters -- there are no subtypes involved. Rewrite (Parameter_Type (Param_Spec), New_Reference_To (Base_Type (Entity (Parameter_Type (Param_Spec))), Loc)); end if; if No (Expr_List) then Expr_List := New_List; end if; Append_To (Expr_List, Make_Identifier (Loc, Chars => Chars (Defining_Identifier (Param_Spec)))); -- The expressions in the attribute reference are not freeze -- points. Neither is the attribute as a whole, see below. Set_Must_Not_Freeze (Last (Expr_List)); Next (Param_Spec); end loop; end if; -- Immediate error if too many formals. Other mismatches in numbers -- of number of types of parameters are detected when we analyze the -- body of the subprogram that we construct. if Form_Num > 2 then Error_Msg_N ("too many formals for attribute", N); -- Error if the attribute reference has expressions that look -- like formal parameters. elsif Present (Expressions (Nam)) then Error_Msg_N ("illegal expressions in attribute reference", Nam); elsif Aname = Name_Compose or else Aname = Name_Exponent or else Aname = Name_Leading_Part or else Aname = Name_Pos or else Aname = Name_Round or else Aname = Name_Scaling or else Aname = Name_Val then if Nkind (N) = N_Subprogram_Renaming_Declaration and then Present (Corresponding_Formal_Spec (N)) then Error_Msg_N ("generic actual cannot be attribute involving universal type", Nam); else Error_Msg_N ("attribute involving a universal type cannot be renamed", Nam); end if; end if; -- AST_Entry is an odd case. It doesn't really make much sense to -- allow it to be renamed, but that's the DEC rule, so we have to -- do it right. The point is that the AST_Entry call should be made -- now, and what the function will return is the returned value. -- Note that there is no Expr_List in this case anyway if Aname = Name_AST_Entry then declare Ent : Entity_Id; Decl : Node_Id; begin Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Ent, Object_Definition => New_Occurrence_Of (RTE (RE_AST_Handler), Loc), Expression => Nam, Constant_Present => True); Set_Assignment_OK (Decl, True); Insert_Action (N, Decl); Attr_Node := Make_Identifier (Loc, Chars (Ent)); end; -- For all other attributes, we rewrite the attribute node to have -- a list of expressions corresponding to the subprogram formals. -- A renaming declaration is not a freeze point, and the analysis of -- the attribute reference should not freeze the type of the prefix. else Attr_Node := Make_Attribute_Reference (Loc, Prefix => Prefix (Nam), Attribute_Name => Aname, Expressions => Expr_List); Set_Must_Not_Freeze (Attr_Node); Set_Must_Not_Freeze (Prefix (Nam)); end if; -- Case of renaming a function if Nkind (Spec) = N_Function_Specification then if Is_Procedure_Attribute_Name (Aname) then Error_Msg_N ("attribute can only be renamed as procedure", Nam); return; end if; Find_Type (Result_Definition (Spec)); Rewrite (Result_Definition (Spec), New_Reference_To ( Base_Type (Entity (Result_Definition (Spec))), Loc)); Body_Node := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => New_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Return_Statement (Loc, Expression => Attr_Node)))); -- Case of renaming a procedure else if not Is_Procedure_Attribute_Name (Aname) then Error_Msg_N ("attribute can only be renamed as function", Nam); return; end if; Body_Node := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => New_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Attr_Node))); end if; Rewrite (N, Body_Node); Analyze (N); if Is_Compilation_Unit (New_S) then Error_Msg_N ("a library unit can only rename another library unit", N); end if; Set_Etype (New_S, Base_Type (Etype (New_S))); -- We suppress elaboration warnings for the resulting entity, since -- clearly they are not needed, and more particularly, in the case -- of a generic formal subprogram, the resulting entity can appear -- after the instantiation itself, and thus look like a bogus case -- of access before elaboration. Set_Suppress_Elaboration_Warnings (New_S); end Attribute_Renaming; ---------------------- -- Chain_Use_Clause -- ---------------------- procedure Chain_Use_Clause (N : Node_Id) is Pack : Entity_Id; Level : Int := Scope_Stack.Last; begin if not Is_Compilation_Unit (Current_Scope) or else not Is_Child_Unit (Current_Scope) then null; -- Common case elsif Defining_Entity (Parent (N)) = Current_Scope then null; -- Common case for compilation unit else -- If declaration appears in some other scope, it must be in some -- parent unit when compiling a child. Pack := Defining_Entity (Parent (N)); if not In_Open_Scopes (Pack) then null; -- default as well else -- Find entry for parent unit in scope stack while Scope_Stack.Table (Level).Entity /= Pack loop Level := Level - 1; end loop; end if; end if; Set_Next_Use_Clause (N, Scope_Stack.Table (Level).First_Use_Clause); Scope_Stack.Table (Level).First_Use_Clause := N; end Chain_Use_Clause; --------------------------- -- Check_Frozen_Renaming -- --------------------------- procedure Check_Frozen_Renaming (N : Node_Id; Subp : Entity_Id) is B_Node : Node_Id; Old_S : Entity_Id; begin if Is_Frozen (Subp) and then not Has_Completion (Subp) then B_Node := Build_Renamed_Body (Parent (Declaration_Node (Subp)), Defining_Entity (N)); if Is_Entity_Name (Name (N)) then Old_S := Entity (Name (N)); if not Is_Frozen (Old_S) and then Operating_Mode /= Check_Semantics then Append_Freeze_Action (Old_S, B_Node); else Insert_After (N, B_Node); Analyze (B_Node); end if; if Is_Intrinsic_Subprogram (Old_S) and then not In_Instance then Error_Msg_N ("subprogram used in renaming_as_body cannot be intrinsic", Name (N)); end if; else Insert_After (N, B_Node); Analyze (B_Node); end if; end if; end Check_Frozen_Renaming; ----------------------------------- -- Check_In_Previous_With_Clause -- ----------------------------------- procedure Check_In_Previous_With_Clause (N : Node_Id; Nam : Entity_Id) is Pack : constant Entity_Id := Entity (Original_Node (Nam)); Item : Node_Id; Par : Node_Id; begin Item := First (Context_Items (Parent (N))); while Present (Item) and then Item /= N loop if Nkind (Item) = N_With_Clause -- Protect the frontend against previously reported -- critical errors and then Nkind (Name (Item)) /= N_Selected_Component and then Entity (Name (Item)) = Pack then Par := Nam; -- Find root library unit in with_clause while Nkind (Par) = N_Expanded_Name loop Par := Prefix (Par); end loop; if Is_Child_Unit (Entity (Original_Node (Par))) then Error_Msg_NE ("& is not directly visible", Par, Entity (Par)); else return; end if; end if; Next (Item); end loop; -- On exit, package is not mentioned in a previous with_clause. -- Check if its prefix is. if Nkind (Nam) = N_Expanded_Name then Check_In_Previous_With_Clause (N, Prefix (Nam)); elsif Pack /= Any_Id then Error_Msg_NE ("& is not visible", Nam, Pack); end if; end Check_In_Previous_With_Clause; --------------------------------- -- Check_Library_Unit_Renaming -- --------------------------------- procedure Check_Library_Unit_Renaming (N : Node_Id; Old_E : Entity_Id) is New_E : Entity_Id; begin if Nkind (Parent (N)) /= N_Compilation_Unit then return; elsif Scope (Old_E) /= Standard_Standard and then not Is_Child_Unit (Old_E) then Error_Msg_N ("renamed unit must be a library unit", Name (N)); -- Entities defined in Standard (operators and boolean literals) cannot -- be renamed as library units. elsif Scope (Old_E) = Standard_Standard and then Sloc (Old_E) = Standard_Location then Error_Msg_N ("renamed unit must be a library unit", Name (N)); elsif Present (Parent_Spec (N)) and then Nkind (Unit (Parent_Spec (N))) = N_Generic_Package_Declaration and then not Is_Child_Unit (Old_E) then Error_Msg_N ("renamed unit must be a child unit of generic parent", Name (N)); elsif Nkind (N) in N_Generic_Renaming_Declaration and then Nkind (Name (N)) = N_Expanded_Name and then Is_Generic_Instance (Entity (Prefix (Name (N)))) and then Is_Generic_Unit (Old_E) then Error_Msg_N ("renamed generic unit must be a library unit", Name (N)); elsif Ekind (Old_E) = E_Package or else Ekind (Old_E) = E_Generic_Package then -- Inherit categorization flags New_E := Defining_Entity (N); Set_Is_Pure (New_E, Is_Pure (Old_E)); Set_Is_Preelaborated (New_E, Is_Preelaborated (Old_E)); Set_Is_Remote_Call_Interface (New_E, Is_Remote_Call_Interface (Old_E)); Set_Is_Remote_Types (New_E, Is_Remote_Types (Old_E)); Set_Is_Shared_Passive (New_E, Is_Shared_Passive (Old_E)); end if; end Check_Library_Unit_Renaming; --------------- -- End_Scope -- --------------- procedure End_Scope is Id : Entity_Id; Prev : Entity_Id; Outer : Entity_Id; begin Id := First_Entity (Current_Scope); while Present (Id) loop -- An entity in the current scope is not necessarily the first one -- on its homonym chain. Find its predecessor if any, -- If it is an internal entity, it will not be in the visibility -- chain altogether, and there is nothing to unchain. if Id /= Current_Entity (Id) then Prev := Current_Entity (Id); while Present (Prev) and then Present (Homonym (Prev)) and then Homonym (Prev) /= Id loop Prev := Homonym (Prev); end loop; -- Skip to end of loop if Id is not in the visibility chain if No (Prev) or else Homonym (Prev) /= Id then goto Next_Ent; end if; else Prev := Empty; end if; Outer := Homonym (Id); Set_Is_Immediately_Visible (Id, False); while Present (Outer) and then Scope (Outer) = Current_Scope loop Outer := Homonym (Outer); end loop; -- Reset homonym link of other entities, but do not modify link -- between entities in current scope, so that the back-end can have -- a proper count of local overloadings. if No (Prev) then Set_Name_Entity_Id (Chars (Id), Outer); elsif Scope (Prev) /= Scope (Id) then Set_Homonym (Prev, Outer); end if; <<Next_Ent>> Next_Entity (Id); end loop; -- If the scope generated freeze actions, place them before the -- current declaration and analyze them. Type declarations and -- the bodies of initialization procedures can generate such nodes. -- We follow the parent chain until we reach a list node, which is -- the enclosing list of declarations. If the list appears within -- a protected definition, move freeze nodes outside the protected -- type altogether. if Present (Scope_Stack.Table (Scope_Stack.Last).Pending_Freeze_Actions) then declare Decl : Node_Id; L : constant List_Id := Scope_Stack.Table (Scope_Stack.Last).Pending_Freeze_Actions; begin if Is_Itype (Current_Scope) then Decl := Associated_Node_For_Itype (Current_Scope); else Decl := Parent (Current_Scope); end if; Pop_Scope; while not (Is_List_Member (Decl)) or else Nkind (Parent (Decl)) = N_Protected_Definition or else Nkind (Parent (Decl)) = N_Task_Definition loop Decl := Parent (Decl); end loop; Insert_List_Before_And_Analyze (Decl, L); end; else Pop_Scope; end if; end End_Scope; --------------------- -- End_Use_Clauses -- --------------------- procedure End_Use_Clauses (Clause : Node_Id) is U : Node_Id; begin -- Remove Use_Type clauses first, because they affect the -- visibility of operators in subsequent used packages. U := Clause; while Present (U) loop if Nkind (U) = N_Use_Type_Clause then End_Use_Type (U); end if; Next_Use_Clause (U); end loop; U := Clause; while Present (U) loop if Nkind (U) = N_Use_Package_Clause then End_Use_Package (U); end if; Next_Use_Clause (U); end loop; end End_Use_Clauses; --------------------- -- End_Use_Package -- --------------------- procedure End_Use_Package (N : Node_Id) is Pack_Name : Node_Id; Pack : Entity_Id; Id : Entity_Id; Elmt : Elmt_Id; function Is_Primitive_Operator (Op : Entity_Id; F : Entity_Id) return Boolean; -- Check whether Op is a primitive operator of a use-visible type --------------------------- -- Is_Primitive_Operator -- --------------------------- function Is_Primitive_Operator (Op : Entity_Id; F : Entity_Id) return Boolean is T : constant Entity_Id := Etype (F); begin return In_Use (T) and then Scope (T) = Scope (Op); end Is_Primitive_Operator; -- Start of processing for End_Use_Package begin Pack_Name := First (Names (N)); while Present (Pack_Name) loop Pack := Entity (Pack_Name); if Ekind (Pack) = E_Package then if In_Open_Scopes (Pack) then null; elsif not Redundant_Use (Pack_Name) then Set_In_Use (Pack, False); Set_Current_Use_Clause (Pack, Empty); Id := First_Entity (Pack); while Present (Id) loop -- Preserve use-visibility of operators that are primitive -- operators of a type that is use_visible through an active -- use_type clause. if Nkind (Id) = N_Defining_Operator_Symbol and then (Is_Primitive_Operator (Id, First_Formal (Id)) or else (Present (Next_Formal (First_Formal (Id))) and then Is_Primitive_Operator (Id, Next_Formal (First_Formal (Id))))) then null; else Set_Is_Potentially_Use_Visible (Id, False); end if; if Is_Private_Type (Id) and then Present (Full_View (Id)) then Set_Is_Potentially_Use_Visible (Full_View (Id), False); end if; Next_Entity (Id); end loop; if Present (Renamed_Object (Pack)) then Set_In_Use (Renamed_Object (Pack), False); Set_Current_Use_Clause (Renamed_Object (Pack), Empty); end if; if Chars (Pack) = Name_System and then Scope (Pack) = Standard_Standard and then Present_System_Aux then Id := First_Entity (System_Aux_Id); while Present (Id) loop Set_Is_Potentially_Use_Visible (Id, False); if Is_Private_Type (Id) and then Present (Full_View (Id)) then Set_Is_Potentially_Use_Visible (Full_View (Id), False); end if; Next_Entity (Id); end loop; Set_In_Use (System_Aux_Id, False); end if; else Set_Redundant_Use (Pack_Name, False); end if; end if; Next (Pack_Name); end loop; if Present (Hidden_By_Use_Clause (N)) then Elmt := First_Elmt (Hidden_By_Use_Clause (N)); while Present (Elmt) loop Set_Is_Immediately_Visible (Node (Elmt)); Next_Elmt (Elmt); end loop; Set_Hidden_By_Use_Clause (N, No_Elist); end if; end End_Use_Package; ------------------ -- End_Use_Type -- ------------------ procedure End_Use_Type (N : Node_Id) is Id : Entity_Id; Op_List : Elist_Id; Elmt : Elmt_Id; T : Entity_Id; begin Id := First (Subtype_Marks (N)); while Present (Id) loop -- A call to rtsfind may occur while analyzing a use_type clause, -- in which case the type marks are not resolved yet, and there is -- nothing to remove. if not Is_Entity_Name (Id) or else No (Entity (Id)) then goto Continue; end if; T := Entity (Id); if T = Any_Type then null; -- Note that the use_Type clause may mention a subtype of the -- type whose primitive operations have been made visible. Here -- as elsewhere, it is the base type that matters for visibility. elsif In_Open_Scopes (Scope (Base_Type (T))) then null; elsif not Redundant_Use (Id) then Set_In_Use (T, False); Set_In_Use (Base_Type (T), False); Op_List := Collect_Primitive_Operations (T); Elmt := First_Elmt (Op_List); while Present (Elmt) loop if Nkind (Node (Elmt)) = N_Defining_Operator_Symbol then Set_Is_Potentially_Use_Visible (Node (Elmt), False); end if; Next_Elmt (Elmt); end loop; end if; <<Continue>> Next (Id); end loop; end End_Use_Type; ---------------------- -- Find_Direct_Name -- ---------------------- procedure Find_Direct_Name (N : Node_Id) is E : Entity_Id; E2 : Entity_Id; Msg : Boolean; Inst : Entity_Id := Empty; -- Enclosing instance, if any Homonyms : Entity_Id; -- Saves start of homonym chain Nvis_Entity : Boolean; -- Set True to indicate that at there is at least one entity on the -- homonym chain which, while not visible, is visible enough from the -- user point of view to warrant an error message of "not visible" -- rather than undefined. Nvis_Is_Private_Subprg : Boolean := False; -- Ada 2005 (AI-262): Set True to indicate that a form of Beaujolais -- effect concerning library subprograms has been detected. Used to -- generate the precise error message. function From_Actual_Package (E : Entity_Id) return Boolean; -- Returns true if the entity is declared in a package that is -- an actual for a formal package of the current instance. Such an -- entity requires special handling because it may be use-visible -- but hides directly visible entities defined outside the instance. function Known_But_Invisible (E : Entity_Id) return Boolean; -- This function determines whether the entity E (which is not -- visible) can reasonably be considered to be known to the writer -- of the reference. This is a heuristic test, used only for the -- purposes of figuring out whether we prefer to complain that an -- entity is undefined or invisible (and identify the declaration -- of the invisible entity in the latter case). The point here is -- that we don't want to complain that something is invisible and -- then point to something entirely mysterious to the writer. procedure Nvis_Messages; -- Called if there are no visible entries for N, but there is at least -- one non-directly visible, or hidden declaration. This procedure -- outputs an appropriate set of error messages. procedure Undefined (Nvis : Boolean); -- This function is called if the current node has no corresponding -- visible entity or entities. The value set in Msg indicates whether -- an error message was generated (multiple error messages for the -- same variable are generally suppressed, see body for details). -- Msg is True if an error message was generated, False if not. This -- value is used by the caller to determine whether or not to output -- additional messages where appropriate. The parameter is set False -- to get the message "X is undefined", and True to get the message -- "X is not visible". ------------------------- -- From_Actual_Package -- ------------------------- function From_Actual_Package (E : Entity_Id) return Boolean is Scop : constant Entity_Id := Scope (E); Act : Entity_Id; begin if not In_Instance then return False; else Inst := Current_Scope; while Present (Inst) and then Ekind (Inst) /= E_Package and then not Is_Generic_Instance (Inst) loop Inst := Scope (Inst); end loop; if No (Inst) then return False; end if; Act := First_Entity (Inst); while Present (Act) loop if Ekind (Act) = E_Package then -- Check for end of actuals list if Renamed_Object (Act) = Inst then return False; elsif Present (Associated_Formal_Package (Act)) and then Renamed_Object (Act) = Scop then -- Entity comes from (instance of) formal package return True; else Next_Entity (Act); end if; else Next_Entity (Act); end if; end loop; return False; end if; end From_Actual_Package; ------------------------- -- Known_But_Invisible -- ------------------------- function Known_But_Invisible (E : Entity_Id) return Boolean is Fname : File_Name_Type; begin -- Entities in Standard are always considered to be known if Sloc (E) <= Standard_Location then return True; -- An entity that does not come from source is always considered -- to be unknown, since it is an artifact of code expansion. elsif not Comes_From_Source (E) then return False; -- In gnat internal mode, we consider all entities known elsif GNAT_Mode then return True; end if; -- Here we have an entity that is not from package Standard, and -- which comes from Source. See if it comes from an internal file. Fname := Unit_File_Name (Get_Source_Unit (E)); -- Case of from internal file if Is_Internal_File_Name (Fname) then -- Private part entities in internal files are never considered -- to be known to the writer of normal application code. if Is_Hidden (E) then return False; end if; -- Entities from System packages other than System and -- System.Storage_Elements are not considered to be known. -- System.Auxxxx files are also considered known to the user. -- Should refine this at some point to generally distinguish -- between known and unknown internal files ??? Get_Name_String (Fname); return Name_Len < 2 or else Name_Buffer (1 .. 2) /= "s-" or else Name_Buffer (3 .. 8) = "stoele" or else Name_Buffer (3 .. 5) = "aux"; -- If not an internal file, then entity is definitely known, -- even if it is in a private part (the message generated will -- note that it is in a private part) else return True; end if; end Known_But_Invisible; ------------------- -- Nvis_Messages -- ------------------- procedure Nvis_Messages is Comp_Unit : Node_Id; Ent : Entity_Id; Hidden : Boolean := False; Item : Node_Id; begin -- Ada 2005 (AI-262): Generate a precise error concerning the -- Beaujolais effect that was previously detected if Nvis_Is_Private_Subprg then pragma Assert (Nkind (E2) = N_Defining_Identifier and then Ekind (E2) = E_Function and then Scope (E2) = Standard_Standard and then Has_Private_With (E2)); -- Find the sloc corresponding to the private with'ed unit Comp_Unit := Cunit (Current_Sem_Unit); Item := First (Context_Items (Comp_Unit)); Error_Msg_Sloc := No_Location; while Present (Item) loop if Nkind (Item) = N_With_Clause and then Private_Present (Item) and then Entity (Name (Item)) = E2 then Error_Msg_Sloc := Sloc (Item); exit; end if; Next (Item); end loop; pragma Assert (Error_Msg_Sloc /= No_Location); Error_Msg_N ("(Ada 2005): hidden by private with clause #", N); return; end if; Undefined (Nvis => True); if Msg then -- First loop does hidden declarations Ent := Homonyms; while Present (Ent) loop if Is_Potentially_Use_Visible (Ent) then if not Hidden then Error_Msg_N ("multiple use clauses cause hiding!", N); Hidden := True; end if; Error_Msg_Sloc := Sloc (Ent); Error_Msg_N ("hidden declaration#!", N); end if; Ent := Homonym (Ent); end loop; -- If we found hidden declarations, then that's enough, don't -- bother looking for non-visible declarations as well. if Hidden then return; end if; -- Second loop does non-directly visible declarations Ent := Homonyms; while Present (Ent) loop if not Is_Potentially_Use_Visible (Ent) then -- Do not bother the user with unknown entities if not Known_But_Invisible (Ent) then goto Continue; end if; Error_Msg_Sloc := Sloc (Ent); -- Output message noting that there is a non-visible -- declaration, distinguishing the private part case. if Is_Hidden (Ent) then Error_Msg_N ("non-visible (private) declaration#!", N); else Error_Msg_N ("non-visible declaration#!", N); if Is_Compilation_Unit (Ent) and then Nkind (Parent (Parent (N))) = N_Use_Package_Clause then Error_Msg_NE ("\possibly missing with_clause for&", N, Ent); end if; end if; -- Set entity and its containing package as referenced. We -- can't be sure of this, but this seems a better choice -- to avoid unused entity messages. if Comes_From_Source (Ent) then Set_Referenced (Ent); Set_Referenced (Cunit_Entity (Get_Source_Unit (Ent))); end if; end if; <<Continue>> Ent := Homonym (Ent); end loop; end if; end Nvis_Messages; --------------- -- Undefined -- --------------- procedure Undefined (Nvis : Boolean) is Emsg : Error_Msg_Id; begin -- We should never find an undefined internal name. If we do, then -- see if we have previous errors. If so, ignore on the grounds that -- it is probably a cascaded message (e.g. a block label from a badly -- formed block). If no previous errors, then we have a real internal -- error of some kind so raise an exception. if Is_Internal_Name (Chars (N)) then if Total_Errors_Detected /= 0 then return; else raise Program_Error; end if; end if; -- A very specialized error check, if the undefined variable is -- a case tag, and the case type is an enumeration type, check -- for a possible misspelling, and if so, modify the identifier -- Named aggregate should also be handled similarly ??? if Nkind (N) = N_Identifier and then Nkind (Parent (N)) = N_Case_Statement_Alternative then Get_Name_String (Chars (N)); declare Case_Str : constant String := Name_Buffer (1 .. Name_Len); Case_Stm : constant Node_Id := Parent (Parent (N)); Case_Typ : constant Entity_Id := Etype (Expression (Case_Stm)); Case_Rtp : constant Entity_Id := Root_Type (Case_Typ); Lit : Node_Id; begin if Is_Enumeration_Type (Case_Typ) and then Case_Rtp /= Standard_Character and then Case_Rtp /= Standard_Wide_Character and then Case_Rtp /= Standard_Wide_Wide_Character then Lit := First_Literal (Case_Typ); Get_Name_String (Chars (Lit)); if Chars (Lit) /= Chars (N) and then Is_Bad_Spelling_Of (Case_Str, Name_Buffer (1 .. Name_Len)) then Error_Msg_Node_2 := Lit; Error_Msg_N ("& is undefined, assume misspelling of &", N); Rewrite (N, New_Occurrence_Of (Lit, Sloc (N))); return; end if; Lit := Next_Literal (Lit); end if; end; end if; -- Normal processing Set_Entity (N, Any_Id); Set_Etype (N, Any_Type); -- We use the table Urefs to keep track of entities for which we -- have issued errors for undefined references. Multiple errors -- for a single name are normally suppressed, however we modify -- the error message to alert the programmer to this effect. for J in Urefs.First .. Urefs.Last loop if Chars (N) = Chars (Urefs.Table (J).Node) then if Urefs.Table (J).Err /= No_Error_Msg and then Sloc (N) /= Urefs.Table (J).Loc then Error_Msg_Node_1 := Urefs.Table (J).Node; if Urefs.Table (J).Nvis then Change_Error_Text (Urefs.Table (J).Err, "& is not visible (more references follow)"); else Change_Error_Text (Urefs.Table (J).Err, "& is undefined (more references follow)"); end if; Urefs.Table (J).Err := No_Error_Msg; end if; -- Although we will set Msg False, and thus suppress the -- message, we also set Error_Posted True, to avoid any -- cascaded messages resulting from the undefined reference. Msg := False; Set_Error_Posted (N, True); return; end if; end loop; -- If entry not found, this is first undefined occurrence if Nvis then Error_Msg_N ("& is not visible!", N); Emsg := Get_Msg_Id; else Error_Msg_N ("& is undefined!", N); Emsg := Get_Msg_Id; -- A very bizarre special check, if the undefined identifier -- is put or put_line, then add a special error message (since -- this is a very common error for beginners to make). if Chars (N) = Name_Put or else Chars (N) = Name_Put_Line then Error_Msg_N ("\possible missing with of 'Text_'I'O!", N); end if; -- Now check for possible misspellings Get_Name_String (Chars (N)); declare E : Entity_Id; Ematch : Entity_Id := Empty; Last_Name_Id : constant Name_Id := Name_Id (Nat (First_Name_Id) + Name_Entries_Count - 1); S : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); begin for N in First_Name_Id .. Last_Name_Id loop E := Get_Name_Entity_Id (N); if Present (E) and then (Is_Immediately_Visible (E) or else Is_Potentially_Use_Visible (E)) then Get_Name_String (N); if Is_Bad_Spelling_Of (Name_Buffer (1 .. Name_Len), S) then Ematch := E; exit; end if; end if; end loop; if Present (Ematch) then Error_Msg_NE ("\possible misspelling of&", N, Ematch); end if; end; end if; -- Make entry in undefined references table unless the full -- errors switch is set, in which case by refraining from -- generating the table entry, we guarantee that we get an -- error message for every undefined reference. if not All_Errors_Mode then Urefs.Increment_Last; Urefs.Table (Urefs.Last).Node := N; Urefs.Table (Urefs.Last).Err := Emsg; Urefs.Table (Urefs.Last).Nvis := Nvis; Urefs.Table (Urefs.Last).Loc := Sloc (N); end if; Msg := True; end Undefined; -- Start of processing for Find_Direct_Name begin -- If the entity pointer is already set, this is an internal node, or -- a node that is analyzed more than once, after a tree modification. -- In such a case there is no resolution to perform, just set the type. if Present (Entity (N)) then if Is_Type (Entity (N)) then Set_Etype (N, Entity (N)); else declare Entyp : constant Entity_Id := Etype (Entity (N)); begin -- One special case here. If the Etype field is already set, -- and references the packed array type corresponding to the -- etype of the referenced entity, then leave it alone. This -- happens for trees generated from Exp_Pakd, where expressions -- can be deliberately "mis-typed" to the packed array type. if Is_Array_Type (Entyp) and then Is_Packed (Entyp) and then Present (Etype (N)) and then Etype (N) = Packed_Array_Type (Entyp) then null; -- If not that special case, then just reset the Etype else Set_Etype (N, Etype (Entity (N))); end if; end; end if; return; end if; -- Here if Entity pointer was not set, we need full visibility analysis -- First we generate debugging output if the debug E flag is set. if Debug_Flag_E then Write_Str ("Looking for "); Write_Name (Chars (N)); Write_Eol; end if; Homonyms := Current_Entity (N); Nvis_Entity := False; E := Homonyms; while Present (E) loop -- If entity is immediately visible or potentially use -- visible, then process the entity and we are done. if Is_Immediately_Visible (E) then goto Immediately_Visible_Entity; elsif Is_Potentially_Use_Visible (E) then goto Potentially_Use_Visible_Entity; -- Note if a known but invisible entity encountered elsif Known_But_Invisible (E) then Nvis_Entity := True; end if; -- Move to next entity in chain and continue search E := Homonym (E); end loop; -- If no entries on homonym chain that were potentially visible, -- and no entities reasonably considered as non-visible, then -- we have a plain undefined reference, with no additional -- explanation required! if not Nvis_Entity then Undefined (Nvis => False); -- Otherwise there is at least one entry on the homonym chain that -- is reasonably considered as being known and non-visible. else Nvis_Messages; end if; return; -- Processing for a potentially use visible entry found. We must search -- the rest of the homonym chain for two reasons. First, if there is a -- directly visible entry, then none of the potentially use-visible -- entities are directly visible (RM 8.4(10)). Second, we need to check -- for the case of multiple potentially use-visible entries hiding one -- another and as a result being non-directly visible (RM 8.4(11)). <<Potentially_Use_Visible_Entity>> declare Only_One_Visible : Boolean := True; All_Overloadable : Boolean := Is_Overloadable (E); begin E2 := Homonym (E); while Present (E2) loop if Is_Immediately_Visible (E2) then -- If the use-visible entity comes from the actual for a -- formal package, it hides a directly visible entity from -- outside the instance. if From_Actual_Package (E) and then Scope_Depth (E2) < Scope_Depth (Inst) then goto Found; else E := E2; goto Immediately_Visible_Entity; end if; elsif Is_Potentially_Use_Visible (E2) then Only_One_Visible := False; All_Overloadable := All_Overloadable and Is_Overloadable (E2); -- Ada 2005 (AI-262): Protect against a form of Beujolais effect -- that can occurr in private_with clauses. Example: -- with A; -- private with B; package A is -- package C is function B return Integer; -- use A; end A; -- V1 : Integer := B; -- private function B return Integer; -- V2 : Integer := B; -- end C; -- V1 resolves to A.B, but V2 resolves to library unit B elsif Ekind (E2) = E_Function and then Scope (E2) = Standard_Standard and then Has_Private_With (E2) then Only_One_Visible := False; All_Overloadable := False; Nvis_Is_Private_Subprg := True; exit; end if; E2 := Homonym (E2); end loop; -- On falling through this loop, we have checked that there are no -- immediately visible entities. Only_One_Visible is set if exactly -- one potentially use visible entity exists. All_Overloadable is -- set if all the potentially use visible entities are overloadable. -- The condition for legality is that either there is one potentially -- use visible entity, or if there is more than one, then all of them -- are overloadable. if Only_One_Visible or All_Overloadable then goto Found; -- If there is more than one potentially use-visible entity and at -- least one of them non-overloadable, we have an error (RM 8.4(11). -- Note that E points to the first such entity on the homonym list. -- Special case: if one of the entities is declared in an actual -- package, it was visible in the generic, and takes precedence over -- other entities that are potentially use-visible. Same if it is -- declared in a local instantiation of the current instance. else if In_Instance then Inst := Current_Scope; -- Find current instance while Present (Inst) and then Inst /= Standard_Standard loop if Is_Generic_Instance (Inst) then exit; end if; Inst := Scope (Inst); end loop; E2 := E; while Present (E2) loop if From_Actual_Package (E2) or else (Is_Generic_Instance (Scope (E2)) and then Scope_Depth (Scope (E2)) > Scope_Depth (Inst)) then E := E2; goto Found; end if; E2 := Homonym (E2); end loop; Nvis_Messages; return; elsif Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit)) then -- A use-clause in the body of a system file creates conflict -- with some entity in a user scope, while rtsfind is active. -- Keep only the entity coming from another predefined unit. E2 := E; while Present (E2) loop if Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Sloc (E2)))) then E := E2; goto Found; end if; E2 := Homonym (E2); end loop; -- Entity must exist because predefined unit is correct raise Program_Error; else Nvis_Messages; return; end if; end if; end; -- Come here with E set to the first immediately visible entity on -- the homonym chain. This is the one we want unless there is another -- immediately visible entity further on in the chain for a more -- inner scope (RM 8.3(8)). <<Immediately_Visible_Entity>> declare Level : Int; Scop : Entity_Id; begin -- Find scope level of initial entity. When compiling through -- Rtsfind, the previous context is not completely invisible, and -- an outer entity may appear on the chain, whose scope is below -- the entry for Standard that delimits the current scope stack. -- Indicate that the level for this spurious entry is outside of -- the current scope stack. Level := Scope_Stack.Last; loop Scop := Scope_Stack.Table (Level).Entity; exit when Scop = Scope (E); Level := Level - 1; exit when Scop = Standard_Standard; end loop; -- Now search remainder of homonym chain for more inner entry -- If the entity is Standard itself, it has no scope, and we -- compare it with the stack entry directly. E2 := Homonym (E); while Present (E2) loop if Is_Immediately_Visible (E2) then -- If a generic package contains a local declaration that -- has the same name as the generic, there may be a visibility -- conflict in an instance, where the local declaration must -- also hide the name of the corresponding package renaming. -- We check explicitly for a package declared by a renaming, -- whose renamed entity is an instance that is on the scope -- stack, and that contains a homonym in the same scope. Once -- we have found it, we know that the package renaming is not -- immediately visible, and that the identifier denotes the -- other entity (and its homonyms if overloaded). if Scope (E) = Scope (E2) and then Ekind (E) = E_Package and then Present (Renamed_Object (E)) and then Is_Generic_Instance (Renamed_Object (E)) and then In_Open_Scopes (Renamed_Object (E)) and then Comes_From_Source (N) then Set_Is_Immediately_Visible (E, False); E := E2; else for J in Level + 1 .. Scope_Stack.Last loop if Scope_Stack.Table (J).Entity = Scope (E2) or else Scope_Stack.Table (J).Entity = E2 then Level := J; E := E2; exit; end if; end loop; end if; end if; E2 := Homonym (E2); end loop; -- At the end of that loop, E is the innermost immediately -- visible entity, so we are all set. end; -- Come here with entity found, and stored in E <<Found>> begin if Comes_From_Source (N) and then Is_Remote_Access_To_Subprogram_Type (E) and then Expander_Active and then Get_PCS_Name /= Name_No_DSA then Rewrite (N, New_Occurrence_Of (Equivalent_Type (E), Sloc (N))); return; end if; Set_Entity (N, E); -- Why no Style_Check here??? if Is_Type (E) then Set_Etype (N, E); else Set_Etype (N, Get_Full_View (Etype (E))); end if; if Debug_Flag_E then Write_Str (" found "); Write_Entity_Info (E, " "); end if; -- If the Ekind of the entity is Void, it means that all homonyms -- are hidden from all visibility (RM 8.3(5,14-20)). However, this -- test is skipped if the current scope is a record and the name is -- a pragma argument expression (case of Atomic and Volatile pragmas -- and possibly other similar pragmas added later, which are allowed -- to reference components in the current record). if Ekind (E) = E_Void and then (not Is_Record_Type (Current_Scope) or else Nkind (Parent (N)) /= N_Pragma_Argument_Association) then Premature_Usage (N); -- If the entity is overloadable, collect all interpretations -- of the name for subsequent overload resolution. We optimize -- a bit here to do this only if we have an overloadable entity -- that is not on its own on the homonym chain. elsif Is_Overloadable (E) and then (Present (Homonym (E)) or else Current_Entity (N) /= E) then Collect_Interps (N); -- If no homonyms were visible, the entity is unambiguous if not Is_Overloaded (N) then Generate_Reference (E, N); end if; -- Case of non-overloadable entity, set the entity providing that -- we do not have the case of a discriminant reference within a -- default expression. Such references are replaced with the -- corresponding discriminal, which is the formal corresponding to -- to the discriminant in the initialization procedure. else -- Entity is unambiguous, indicate that it is referenced here -- One slightly odd case is that we do not want to set the -- Referenced flag if the entity is a label, and the identifier -- is the label in the source, since this is not a reference -- from the point of view of the user if Nkind (Parent (N)) = N_Label then declare R : constant Boolean := Referenced (E); begin Generate_Reference (E, N); Set_Referenced (E, R); end; -- Normal case, not a label. Generate reference else Generate_Reference (E, N); end if; -- Set Entity, with style check if need be. If this is a -- discriminant reference, it must be replaced by the -- corresponding discriminal, that is to say the parameter -- of the initialization procedure that corresponds to the -- discriminant. If this replacement is being performed, there -- is no style check to perform. -- This replacement must not be done if we are currently -- processing a generic spec or body, because the discriminal -- has not been not generated in this case. if not In_Default_Expression or else Ekind (E) /= E_Discriminant or else Inside_A_Generic then Set_Entity_With_Style_Check (N, E); -- The replacement is not done either for a task discriminant that -- appears in a default expression of an entry parameter. See -- Expand_Discriminant in exp_ch2 for details on their handling. elsif Is_Concurrent_Type (Scope (E)) then declare P : Node_Id := Parent (N); begin while Present (P) and then Nkind (P) /= N_Parameter_Specification and then Nkind (P) /= N_Component_Declaration loop P := Parent (P); end loop; if Present (P) and then Nkind (P) = N_Parameter_Specification then null; else Set_Entity (N, Discriminal (E)); end if; end; -- Otherwise, this is a discriminant in a context in which -- it is a reference to the corresponding parameter of the -- init proc for the enclosing type. else Set_Entity (N, Discriminal (E)); end if; end if; end; end Find_Direct_Name; ------------------------ -- Find_Expanded_Name -- ------------------------ -- This routine searches the homonym chain of the entity until it finds -- an entity declared in the scope denoted by the prefix. If the entity -- is private, it may nevertheless be immediately visible, if we are in -- the scope of its declaration. procedure Find_Expanded_Name (N : Node_Id) is Selector : constant Node_Id := Selector_Name (N); Candidate : Entity_Id := Empty; P_Name : Entity_Id; O_Name : Entity_Id; Id : Entity_Id; begin P_Name := Entity (Prefix (N)); O_Name := P_Name; -- If the prefix is a renamed package, look for the entity -- in the original package. if Ekind (P_Name) = E_Package and then Present (Renamed_Object (P_Name)) then P_Name := Renamed_Object (P_Name); -- Rewrite node with entity field pointing to renamed object Rewrite (Prefix (N), New_Copy (Prefix (N))); Set_Entity (Prefix (N), P_Name); -- If the prefix is an object of a concurrent type, look for -- the entity in the associated task or protected type. elsif Is_Concurrent_Type (Etype (P_Name)) then P_Name := Etype (P_Name); end if; Id := Current_Entity (Selector); while Present (Id) loop if Scope (Id) = P_Name then Candidate := Id; if Is_Child_Unit (Id) then exit when Is_Visible_Child_Unit (Id) or else Is_Immediately_Visible (Id); else exit when not Is_Hidden (Id) or else Is_Immediately_Visible (Id); end if; end if; Id := Homonym (Id); end loop; if No (Id) and then (Ekind (P_Name) = E_Procedure or else Ekind (P_Name) = E_Function) and then Is_Generic_Instance (P_Name) then -- Expanded name denotes entity in (instance of) generic subprogram. -- The entity may be in the subprogram instance, or may denote one of -- the formals, which is declared in the enclosing wrapper package. P_Name := Scope (P_Name); Id := Current_Entity (Selector); while Present (Id) loop exit when Scope (Id) = P_Name; Id := Homonym (Id); end loop; end if; if No (Id) or else Chars (Id) /= Chars (Selector) then Set_Etype (N, Any_Type); -- If we are looking for an entity defined in System, try to -- find it in the child package that may have been provided as -- an extension to System. The Extend_System pragma will have -- supplied the name of the extension, which may have to be loaded. if Chars (P_Name) = Name_System and then Scope (P_Name) = Standard_Standard and then Present (System_Extend_Unit) and then Present_System_Aux (N) then Set_Entity (Prefix (N), System_Aux_Id); Find_Expanded_Name (N); return; elsif Nkind (Selector) = N_Operator_Symbol and then Has_Implicit_Operator (N) then -- There is an implicit instance of the predefined operator in -- the given scope. The operator entity is defined in Standard. -- Has_Implicit_Operator makes the node into an Expanded_Name. return; elsif Nkind (Selector) = N_Character_Literal and then Has_Implicit_Character_Literal (N) then -- If there is no literal defined in the scope denoted by the -- prefix, the literal may belong to (a type derived from) -- Standard_Character, for which we have no explicit literals. return; else -- If the prefix is a single concurrent object, use its -- name in the error message, rather than that of the -- anonymous type. if Is_Concurrent_Type (P_Name) and then Is_Internal_Name (Chars (P_Name)) then Error_Msg_Node_2 := Entity (Prefix (N)); else Error_Msg_Node_2 := P_Name; end if; if P_Name = System_Aux_Id then P_Name := Scope (P_Name); Set_Entity (Prefix (N), P_Name); end if; if Present (Candidate) then if Is_Child_Unit (Candidate) then -- If the candidate is a private child unit and we are -- in the visible part of a public unit, specialize the -- error message. There might be a private with_clause for -- it, but it is not currently active. if Is_Private_Descendant (Candidate) and then Ekind (Current_Scope) = E_Package and then not In_Private_Part (Current_Scope) and then not Is_Private_Descendant (Current_Scope) then Error_Msg_N ("private child unit& is not visible here", Selector); else Error_Msg_N ("missing with_clause for child unit &", Selector); end if; else Error_Msg_NE ("& is not a visible entity of&", N, Selector); end if; else -- Within the instantiation of a child unit, the prefix may -- denote the parent instance, but the selector has the -- name of the original child. Find whether we are within -- the corresponding instance, and get the proper entity, which -- can only be an enclosing scope. if O_Name /= P_Name and then In_Open_Scopes (P_Name) and then Is_Generic_Instance (P_Name) then declare S : Entity_Id := Current_Scope; P : Entity_Id; begin for J in reverse 0 .. Scope_Stack.Last loop S := Scope_Stack.Table (J).Entity; exit when S = Standard_Standard; if Ekind (S) = E_Function or else Ekind (S) = E_Package or else Ekind (S) = E_Procedure then P := Generic_Parent (Specification (Unit_Declaration_Node (S))); if Present (P) and then Chars (Scope (P)) = Chars (O_Name) and then Chars (P) = Chars (Selector) then Id := S; goto Found; end if; end if; end loop; end; end if; if Chars (P_Name) = Name_Ada and then Scope (P_Name) = Standard_Standard then Error_Msg_Node_2 := Selector; Error_Msg_NE ("missing with for `&.&`", N, P_Name); -- If this is a selection from a dummy package, then -- suppress the error message, of course the entity -- is missing if the package is missing! elsif Sloc (Error_Msg_Node_2) = No_Location then null; -- Here we have the case of an undefined component else Error_Msg_NE ("& not declared in&", N, Selector); -- Check for misspelling of some entity in prefix Id := First_Entity (P_Name); Get_Name_String (Chars (Selector)); declare S : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); begin while Present (Id) loop Get_Name_String (Chars (Id)); if Is_Bad_Spelling_Of (Name_Buffer (1 .. Name_Len), S) and then not Is_Internal_Name (Chars (Id)) then Error_Msg_NE ("possible misspelling of&", Selector, Id); exit; end if; Next_Entity (Id); end loop; end; -- Specialize the message if this may be an instantiation -- of a child unit that was not mentioned in the context. if Nkind (Parent (N)) = N_Package_Instantiation and then Is_Generic_Instance (Entity (Prefix (N))) and then Is_Compilation_Unit (Generic_Parent (Parent (Entity (Prefix (N))))) then Error_Msg_NE ("\possible missing with clause on child unit&", N, Selector); end if; end if; end if; Id := Any_Id; end if; end if; <<Found>> if Comes_From_Source (N) and then Is_Remote_Access_To_Subprogram_Type (Id) and then Present (Equivalent_Type (Id)) then -- If we are not actually generating distribution code (i.e. -- the current PCS is the dummy non-distributed version), then -- the Equivalent_Type will be missing, and Id should be treated -- as a regular access-to-subprogram type. Id := Equivalent_Type (Id); Set_Chars (Selector, Chars (Id)); end if; -- Ada 2005 (AI-50217): Check usage of entities in limited withed units if Ekind (P_Name) = E_Package and then From_With_Type (P_Name) then if From_With_Type (Id) or else Is_Type (Id) or else Ekind (Id) = E_Package then null; else Error_Msg_N ("limited withed package can only be used to access " & " incomplete types", N); end if; end if; if Is_Task_Type (P_Name) and then ((Ekind (Id) = E_Entry and then Nkind (Parent (N)) /= N_Attribute_Reference) or else (Ekind (Id) = E_Entry_Family and then Nkind (Parent (Parent (N))) /= N_Attribute_Reference)) then -- It is an entry call after all, either to the current task -- (which will deadlock) or to an enclosing task. Analyze_Selected_Component (N); return; end if; Change_Selected_Component_To_Expanded_Name (N); -- Do style check and generate reference, but skip both steps if this -- entity has homonyms, since we may not have the right homonym set -- yet. The proper homonym will be set during the resolve phase. if Has_Homonym (Id) then Set_Entity (N, Id); else Set_Entity_With_Style_Check (N, Id); Generate_Reference (Id, N); end if; if Is_Type (Id) then Set_Etype (N, Id); else Set_Etype (N, Get_Full_View (Etype (Id))); end if; -- If the Ekind of the entity is Void, it means that all homonyms -- are hidden from all visibility (RM 8.3(5,14-20)). if Ekind (Id) = E_Void then Premature_Usage (N); elsif Is_Overloadable (Id) and then Present (Homonym (Id)) then declare H : Entity_Id := Homonym (Id); begin while Present (H) loop if Scope (H) = Scope (Id) and then (not Is_Hidden (H) or else Is_Immediately_Visible (H)) then Collect_Interps (N); exit; end if; H := Homonym (H); end loop; -- If an extension of System is present, collect possible -- explicit overloadings declared in the extension. if Chars (P_Name) = Name_System and then Scope (P_Name) = Standard_Standard and then Present (System_Extend_Unit) and then Present_System_Aux (N) then H := Current_Entity (Id); while Present (H) loop if Scope (H) = System_Aux_Id then Add_One_Interp (N, H, Etype (H)); end if; H := Homonym (H); end loop; end if; end; end if; if Nkind (Selector_Name (N)) = N_Operator_Symbol and then Scope (Id) /= Standard_Standard then -- In addition to user-defined operators in the given scope, -- there may be an implicit instance of the predefined -- operator. The operator (defined in Standard) is found -- in Has_Implicit_Operator, and added to the interpretations. -- Procedure Add_One_Interp will determine which hides which. if Has_Implicit_Operator (N) then null; end if; end if; end Find_Expanded_Name; ------------------------- -- Find_Renamed_Entity -- ------------------------- function Find_Renamed_Entity (N : Node_Id; Nam : Node_Id; New_S : Entity_Id; Is_Actual : Boolean := False) return Entity_Id is Ind : Interp_Index; I1 : Interp_Index := 0; -- Suppress junk warnings It : Interp; It1 : Interp; Old_S : Entity_Id; Inst : Entity_Id; function Enclosing_Instance return Entity_Id; -- If the renaming determines the entity for the default of a formal -- subprogram nested within another instance, choose the innermost -- candidate. This is because if the formal has a box, and we are within -- an enclosing instance where some candidate interpretations are local -- to this enclosing instance, we know that the default was properly -- resolved when analyzing the generic, so we prefer the local -- candidates to those that are external. This is not always the case -- but is a reasonable heuristic on the use of nested generics. -- The proper solution requires a full renaming model. function Within (Inner, Outer : Entity_Id) return Boolean; -- Determine whether a candidate subprogram is defined within -- the enclosing instance. If yes, it has precedence over outer -- candidates. function Is_Visible_Operation (Op : Entity_Id) return Boolean; -- If the renamed entity is an implicit operator, check whether it is -- visible because its operand type is properly visible. This -- check applies to explicit renamed entities that appear in the -- source in a renaming declaration or a formal subprogram instance, -- but not to default generic actuals with a name. ------------------------ -- Enclosing_Instance -- ------------------------ function Enclosing_Instance return Entity_Id is S : Entity_Id; begin if not Is_Generic_Instance (Current_Scope) and then not Is_Actual then return Empty; end if; S := Scope (Current_Scope); while S /= Standard_Standard loop if Is_Generic_Instance (S) then return S; end if; S := Scope (S); end loop; return Empty; end Enclosing_Instance; -------------------------- -- Is_Visible_Operation -- -------------------------- function Is_Visible_Operation (Op : Entity_Id) return Boolean is Scop : Entity_Id; Typ : Entity_Id; Btyp : Entity_Id; begin if Ekind (Op) /= E_Operator or else Scope (Op) /= Standard_Standard or else (In_Instance and then (not Is_Actual or else Present (Enclosing_Instance))) then return True; else -- For a fixed point type operator, check the resulting type, -- because it may be a mixed mode integer * fixed operation. if Present (Next_Formal (First_Formal (New_S))) and then Is_Fixed_Point_Type (Etype (New_S)) then Typ := Etype (New_S); else Typ := Etype (First_Formal (New_S)); end if; Btyp := Base_Type (Typ); if Nkind (Nam) /= N_Expanded_Name then return (In_Open_Scopes (Scope (Btyp)) or else Is_Potentially_Use_Visible (Btyp) or else In_Use (Btyp) or else In_Use (Scope (Btyp))); else Scop := Entity (Prefix (Nam)); if Ekind (Scop) = E_Package and then Present (Renamed_Object (Scop)) then Scop := Renamed_Object (Scop); end if; -- Operator is visible if prefix of expanded name denotes -- scope of type, or else type type is defined in System_Aux -- and the prefix denotes System. return Scope (Btyp) = Scop or else (Scope (Btyp) = System_Aux_Id and then Scope (Scope (Btyp)) = Scop); end if; end if; end Is_Visible_Operation; ------------ -- Within -- ------------ function Within (Inner, Outer : Entity_Id) return Boolean is Sc : Entity_Id := Scope (Inner); begin while Sc /= Standard_Standard loop if Sc = Outer then return True; else Sc := Scope (Sc); end if; end loop; return False; end Within; function Report_Overload return Entity_Id; -- List possible interpretations, and specialize message in the -- case of a generic actual. function Report_Overload return Entity_Id is begin if Is_Actual then Error_Msg_NE ("ambiguous actual subprogram&, " & "possible interpretations: ", N, Nam); else Error_Msg_N ("ambiguous subprogram, " & "possible interpretations: ", N); end if; List_Interps (Nam, N); return Old_S; end Report_Overload; -- Start of processing for Find_Renamed_Entry begin Old_S := Any_Id; Candidate_Renaming := Empty; if not Is_Overloaded (Nam) then if Entity_Matches_Spec (Entity (Nam), New_S) and then Is_Visible_Operation (Entity (Nam)) then Old_S := Entity (Nam); elsif Present (First_Formal (Entity (Nam))) and then Present (First_Formal (New_S)) and then (Base_Type (Etype (First_Formal (Entity (Nam)))) = Base_Type (Etype (First_Formal (New_S)))) then Candidate_Renaming := Entity (Nam); end if; else Get_First_Interp (Nam, Ind, It); while Present (It.Nam) loop if Entity_Matches_Spec (It.Nam, New_S) and then Is_Visible_Operation (It.Nam) then if Old_S /= Any_Id then -- Note: The call to Disambiguate only happens if a -- previous interpretation was found, in which case I1 -- has received a value. It1 := Disambiguate (Nam, I1, Ind, Etype (Old_S)); if It1 = No_Interp then Inst := Enclosing_Instance; if Present (Inst) then if Within (It.Nam, Inst) then return (It.Nam); elsif Within (Old_S, Inst) then return (Old_S); else return Report_Overload; end if; else return Report_Overload; end if; else Old_S := It1.Nam; exit; end if; else I1 := Ind; Old_S := It.Nam; end if; elsif Present (First_Formal (It.Nam)) and then Present (First_Formal (New_S)) and then (Base_Type (Etype (First_Formal (It.Nam))) = Base_Type (Etype (First_Formal (New_S)))) then Candidate_Renaming := It.Nam; end if; Get_Next_Interp (Ind, It); end loop; Set_Entity (Nam, Old_S); Set_Is_Overloaded (Nam, False); end if; return Old_S; end Find_Renamed_Entity; ----------------------------- -- Find_Selected_Component -- ----------------------------- procedure Find_Selected_Component (N : Node_Id) is P : constant Node_Id := Prefix (N); P_Name : Entity_Id; -- Entity denoted by prefix P_Type : Entity_Id; -- and its type Nam : Node_Id; begin Analyze (P); if Nkind (P) = N_Error then return; -- If the selector already has an entity, the node has been -- constructed in the course of expansion, and is known to be -- valid. Do not verify that it is defined for the type (it may -- be a private component used in the expansion of record equality). elsif Present (Entity (Selector_Name (N))) then if No (Etype (N)) or else Etype (N) = Any_Type then declare Sel_Name : constant Node_Id := Selector_Name (N); Selector : constant Entity_Id := Entity (Sel_Name); C_Etype : Node_Id; begin Set_Etype (Sel_Name, Etype (Selector)); if not Is_Entity_Name (P) then Resolve (P); end if; -- Build an actual subtype except for the first parameter -- of an init proc, where this actual subtype is by -- definition incorrect, since the object is uninitialized -- (and does not even have defined discriminants etc.) if Is_Entity_Name (P) and then Ekind (Entity (P)) = E_Function then Nam := New_Copy (P); if Is_Overloaded (P) then Save_Interps (P, Nam); end if; Rewrite (P, Make_Function_Call (Sloc (P), Name => Nam)); Analyze_Call (P); Analyze_Selected_Component (N); return; elsif Ekind (Selector) = E_Component and then (not Is_Entity_Name (P) or else Chars (Entity (P)) /= Name_uInit) then C_Etype := Build_Actual_Subtype_Of_Component ( Etype (Selector), N); else C_Etype := Empty; end if; if No (C_Etype) then C_Etype := Etype (Selector); else Insert_Action (N, C_Etype); C_Etype := Defining_Identifier (C_Etype); end if; Set_Etype (N, C_Etype); end; -- If this is the name of an entry or protected operation, and -- the prefix is an access type, insert an explicit dereference, -- so that entry calls are treated uniformly. if Is_Access_Type (Etype (P)) and then Is_Concurrent_Type (Designated_Type (Etype (P))) then declare New_P : constant Node_Id := Make_Explicit_Dereference (Sloc (P), Prefix => Relocate_Node (P)); begin Rewrite (P, New_P); Set_Etype (P, Designated_Type (Etype (Prefix (P)))); end; end if; -- If the selected component appears within a default expression -- and it has an actual subtype, the pre-analysis has not yet -- completed its analysis, because Insert_Actions is disabled in -- that context. Within the init proc of the enclosing type we -- must complete this analysis, if an actual subtype was created. elsif Inside_Init_Proc then declare Typ : constant Entity_Id := Etype (N); Decl : constant Node_Id := Declaration_Node (Typ); begin if Nkind (Decl) = N_Subtype_Declaration and then not Analyzed (Decl) and then Is_List_Member (Decl) and then No (Parent (Decl)) then Remove (Decl); Insert_Action (N, Decl); end if; end; end if; return; elsif Is_Entity_Name (P) then P_Name := Entity (P); -- The prefix may denote an enclosing type which is the completion -- of an incomplete type declaration. if Is_Type (P_Name) then Set_Entity (P, Get_Full_View (P_Name)); Set_Etype (P, Entity (P)); P_Name := Entity (P); end if; P_Type := Base_Type (Etype (P)); if Debug_Flag_E then Write_Str ("Found prefix type to be "); Write_Entity_Info (P_Type, " "); Write_Eol; end if; -- First check for components of a record object (not the -- result of a call, which is handled below). if Is_Appropriate_For_Record (P_Type) and then not Is_Overloadable (P_Name) and then not Is_Type (P_Name) then -- Selected component of record. Type checking will validate -- name of selector. Analyze_Selected_Component (N); elsif Is_Appropriate_For_Entry_Prefix (P_Type) and then not In_Open_Scopes (P_Name) and then (not Is_Concurrent_Type (Etype (P_Name)) or else not In_Open_Scopes (Etype (P_Name))) then -- Call to protected operation or entry. Type checking is -- needed on the prefix. Analyze_Selected_Component (N); elsif (In_Open_Scopes (P_Name) and then Ekind (P_Name) /= E_Void and then not Is_Overloadable (P_Name)) or else (Is_Concurrent_Type (Etype (P_Name)) and then In_Open_Scopes (Etype (P_Name))) then -- Prefix denotes an enclosing loop, block, or task, i.e. an -- enclosing construct that is not a subprogram or accept. Find_Expanded_Name (N); elsif Ekind (P_Name) = E_Package then Find_Expanded_Name (N); elsif Is_Overloadable (P_Name) then -- The subprogram may be a renaming (of an enclosing scope) as -- in the case of the name of the generic within an instantiation. if (Ekind (P_Name) = E_Procedure or else Ekind (P_Name) = E_Function) and then Present (Alias (P_Name)) and then Is_Generic_Instance (Alias (P_Name)) then P_Name := Alias (P_Name); end if; if Is_Overloaded (P) then -- The prefix must resolve to a unique enclosing construct declare Found : Boolean := False; Ind : Interp_Index; It : Interp; begin Get_First_Interp (P, Ind, It); while Present (It.Nam) loop if In_Open_Scopes (It.Nam) then if Found then Error_Msg_N ( "prefix must be unique enclosing scope", N); Set_Entity (N, Any_Id); Set_Etype (N, Any_Type); return; else Found := True; P_Name := It.Nam; end if; end if; Get_Next_Interp (Ind, It); end loop; end; end if; if In_Open_Scopes (P_Name) then Set_Entity (P, P_Name); Set_Is_Overloaded (P, False); Find_Expanded_Name (N); else -- If no interpretation as an expanded name is possible, it -- must be a selected component of a record returned by a -- function call. Reformat prefix as a function call, the -- rest is done by type resolution. If the prefix is a -- procedure or entry, as is P.X; this is an error. if Ekind (P_Name) /= E_Function and then (not Is_Overloaded (P) or else Nkind (Parent (N)) = N_Procedure_Call_Statement) then -- Prefix may mention a package that is hidden by a local -- declaration: let the user know. Scan the full homonym -- chain, the candidate package may be anywhere on it. if Present (Homonym (Current_Entity (P_Name))) then P_Name := Current_Entity (P_Name); while Present (P_Name) loop exit when Ekind (P_Name) = E_Package; P_Name := Homonym (P_Name); end loop; if Present (P_Name) then Error_Msg_Sloc := Sloc (Entity (Prefix (N))); Error_Msg_NE ("package& is hidden by declaration#", N, P_Name); Set_Entity (Prefix (N), P_Name); Find_Expanded_Name (N); return; else P_Name := Entity (Prefix (N)); end if; end if; Error_Msg_NE ("invalid prefix in selected component&", N, P_Name); Change_Selected_Component_To_Expanded_Name (N); Set_Entity (N, Any_Id); Set_Etype (N, Any_Type); else Nam := New_Copy (P); Save_Interps (P, Nam); Rewrite (P, Make_Function_Call (Sloc (P), Name => Nam)); Analyze_Call (P); Analyze_Selected_Component (N); end if; end if; -- Remaining cases generate various error messages else -- Format node as expanded name, to avoid cascaded errors Change_Selected_Component_To_Expanded_Name (N); Set_Entity (N, Any_Id); Set_Etype (N, Any_Type); -- Issue error message, but avoid this if error issued already. -- Use identifier of prefix if one is available. if P_Name = Any_Id then null; elsif Ekind (P_Name) = E_Void then Premature_Usage (P); elsif Nkind (P) /= N_Attribute_Reference then Error_Msg_N ( "invalid prefix in selected component&", P); if Is_Access_Type (P_Type) and then Ekind (Designated_Type (P_Type)) = E_Incomplete_Type then Error_Msg_N ("\dereference must not be of an incomplete type " & "('R'M 3.10.1)", P); end if; else Error_Msg_N ( "invalid prefix in selected component", P); end if; end if; else -- If prefix is not the name of an entity, it must be an expression, -- whose type is appropriate for a record. This is determined by -- type resolution. Analyze_Selected_Component (N); end if; end Find_Selected_Component; --------------- -- Find_Type -- --------------- procedure Find_Type (N : Node_Id) is C : Entity_Id; Typ : Entity_Id; T : Entity_Id; T_Name : Entity_Id; begin if N = Error then return; elsif Nkind (N) = N_Attribute_Reference then -- Class attribute. This is only valid in Ada 95 mode, but we don't -- do a check, since the tagged type referenced could only exist if -- we were in 95 mode when it was declared (or, if we were in Ada -- 83 mode, then an error message would already have been issued). if Attribute_Name (N) = Name_Class then Check_Restriction (No_Dispatch, N); Find_Type (Prefix (N)); -- Propagate error from bad prefix if Etype (Prefix (N)) = Any_Type then Set_Entity (N, Any_Type); Set_Etype (N, Any_Type); return; end if; T := Base_Type (Entity (Prefix (N))); -- Case type is not known to be tagged. Its appearance in -- the prefix of the 'Class attribute indicates that the full -- view will be tagged. if not Is_Tagged_Type (T) then if Ekind (T) = E_Incomplete_Type then -- It is legal to denote the class type of an incomplete -- type. The full type will have to be tagged, of course. Set_Is_Tagged_Type (T); Set_Primitive_Operations (T, New_Elmt_List); Make_Class_Wide_Type (T); Set_Entity (N, Class_Wide_Type (T)); Set_Etype (N, Class_Wide_Type (T)); elsif Ekind (T) = E_Private_Type and then not Is_Generic_Type (T) and then In_Private_Part (Scope (T)) then -- The Class attribute can be applied to an untagged -- private type fulfilled by a tagged type prior to -- the full type declaration (but only within the -- parent package's private part). Create the class-wide -- type now and check that the full type is tagged -- later during its analysis. Note that we do not -- mark the private type as tagged, unlike the case -- of incomplete types, because the type must still -- appear untagged to outside units. if No (Class_Wide_Type (T)) then Make_Class_Wide_Type (T); end if; Set_Entity (N, Class_Wide_Type (T)); Set_Etype (N, Class_Wide_Type (T)); else -- Should we introduce a type Any_Tagged and use -- Wrong_Type here, it would be a bit more consistent??? Error_Msg_NE ("tagged type required, found}", Prefix (N), First_Subtype (T)); Set_Entity (N, Any_Type); return; end if; -- Case of tagged type else if Is_Concurrent_Type (T) then if No (Corresponding_Record_Type (Entity (Prefix (N)))) then -- Previous error. Use current type, which at least -- provides some operations. C := Entity (Prefix (N)); else C := Class_Wide_Type (Corresponding_Record_Type (Entity (Prefix (N)))); end if; else C := Class_Wide_Type (Entity (Prefix (N))); end if; Set_Entity_With_Style_Check (N, C); Generate_Reference (C, N); Set_Etype (N, C); end if; -- Base attribute, not allowed in Ada 83 elsif Attribute_Name (N) = Name_Base then if Ada_Version = Ada_83 and then Comes_From_Source (N) then Error_Msg_N ("(Ada 83) Base attribute not allowed in subtype mark", N); else Find_Type (Prefix (N)); Typ := Entity (Prefix (N)); if Ada_Version >= Ada_95 and then not Is_Scalar_Type (Typ) and then not Is_Generic_Type (Typ) then Error_Msg_N ("prefix of Base attribute must be scalar type", Prefix (N)); elsif Sloc (Typ) = Standard_Location and then Base_Type (Typ) = Typ and then Warn_On_Redundant_Constructs then Error_Msg_NE ("?redudant attribute, & is its own base type", N, Typ); end if; T := Base_Type (Typ); -- Rewrite attribute reference with type itself (see similar -- processing in Analyze_Attribute, case Base). Preserve -- prefix if present, for other legality checks. if Nkind (Prefix (N)) = N_Expanded_Name then Rewrite (N, Make_Expanded_Name (Sloc (N), Chars => Chars (Entity (N)), Prefix => New_Copy (Prefix (Prefix (N))), Selector_Name => New_Reference_To (Entity (N), Sloc (N)))); else Rewrite (N, New_Reference_To (Entity (N), Sloc (N))); end if; Set_Entity (N, T); Set_Etype (N, T); end if; -- All other attributes are invalid in a subtype mark else Error_Msg_N ("invalid attribute in subtype mark", N); end if; else Analyze (N); if Is_Entity_Name (N) then T_Name := Entity (N); else Error_Msg_N ("subtype mark required in this context", N); Set_Etype (N, Any_Type); return; end if; if T_Name = Any_Id or else Etype (N) = Any_Type then -- Undefined id. Make it into a valid type Set_Entity (N, Any_Type); elsif not Is_Type (T_Name) and then T_Name /= Standard_Void_Type then Error_Msg_Sloc := Sloc (T_Name); Error_Msg_N ("subtype mark required in this context", N); Error_Msg_NE ("\found & declared#", N, T_Name); Set_Entity (N, Any_Type); else T_Name := Get_Full_View (T_Name); if In_Open_Scopes (T_Name) then if Ekind (Base_Type (T_Name)) = E_Task_Type then Error_Msg_N ("task type cannot be used as type mark " & "within its own body", N); else Error_Msg_N ("type declaration cannot refer to itself", N); end if; Set_Etype (N, Any_Type); Set_Entity (N, Any_Type); Set_Error_Posted (T_Name); return; end if; Set_Entity (N, T_Name); Set_Etype (N, T_Name); end if; end if; if Present (Etype (N)) and then Comes_From_Source (N) then if Is_Fixed_Point_Type (Etype (N)) then Check_Restriction (No_Fixed_Point, N); elsif Is_Floating_Point_Type (Etype (N)) then Check_Restriction (No_Floating_Point, N); end if; end if; end Find_Type; ------------------- -- Get_Full_View -- ------------------- function Get_Full_View (T_Name : Entity_Id) return Entity_Id is begin if Ekind (T_Name) = E_Incomplete_Type and then Present (Full_View (T_Name)) then return Full_View (T_Name); elsif Is_Class_Wide_Type (T_Name) and then Ekind (Root_Type (T_Name)) = E_Incomplete_Type and then Present (Full_View (Root_Type (T_Name))) then return Class_Wide_Type (Full_View (Root_Type (T_Name))); else return T_Name; end if; end Get_Full_View; ------------------------------------ -- Has_Implicit_Character_Literal -- ------------------------------------ function Has_Implicit_Character_Literal (N : Node_Id) return Boolean is Id : Entity_Id; Found : Boolean := False; P : constant Entity_Id := Entity (Prefix (N)); Priv_Id : Entity_Id := Empty; begin if Ekind (P) = E_Package and then not In_Open_Scopes (P) then Priv_Id := First_Private_Entity (P); end if; if P = Standard_Standard then Change_Selected_Component_To_Expanded_Name (N); Rewrite (N, Selector_Name (N)); Analyze (N); Set_Etype (Original_Node (N), Standard_Character); return True; end if; Id := First_Entity (P); while Present (Id) and then Id /= Priv_Id loop if Is_Character_Type (Id) and then (Root_Type (Id) = Standard_Character or else Root_Type (Id) = Standard_Wide_Character or else Root_Type (Id) = Standard_Wide_Wide_Character) and then Id = Base_Type (Id) then -- We replace the node with the literal itself, resolve as a -- character, and set the type correctly. if not Found then Change_Selected_Component_To_Expanded_Name (N); Rewrite (N, Selector_Name (N)); Analyze (N); Set_Etype (N, Id); Set_Etype (Original_Node (N), Id); Found := True; else -- More than one type derived from Character in given scope. -- Collect all possible interpretations. Add_One_Interp (N, Id, Id); end if; end if; Next_Entity (Id); end loop; return Found; end Has_Implicit_Character_Literal; ---------------------- -- Has_Private_With -- ---------------------- function Has_Private_With (E : Entity_Id) return Boolean is Comp_Unit : constant Node_Id := Cunit (Current_Sem_Unit); Item : Node_Id; begin Item := First (Context_Items (Comp_Unit)); while Present (Item) loop if Nkind (Item) = N_With_Clause and then Private_Present (Item) and then Entity (Name (Item)) = E then return True; end if; Next (Item); end loop; return False; end Has_Private_With; --------------------------- -- Has_Implicit_Operator -- --------------------------- function Has_Implicit_Operator (N : Node_Id) return Boolean is Op_Id : constant Name_Id := Chars (Selector_Name (N)); P : constant Entity_Id := Entity (Prefix (N)); Id : Entity_Id; Priv_Id : Entity_Id := Empty; procedure Add_Implicit_Operator (T : Entity_Id; Op_Type : Entity_Id := Empty); -- Add implicit interpretation to node N, using the type for which -- a predefined operator exists. If the operator yields a boolean -- type, the Operand_Type is implicitly referenced by the operator, -- and a reference to it must be generated. --------------------------- -- Add_Implicit_Operator -- --------------------------- procedure Add_Implicit_Operator (T : Entity_Id; Op_Type : Entity_Id := Empty) is Predef_Op : Entity_Id; begin Predef_Op := Current_Entity (Selector_Name (N)); while Present (Predef_Op) and then Scope (Predef_Op) /= Standard_Standard loop Predef_Op := Homonym (Predef_Op); end loop; if Nkind (N) = N_Selected_Component then Change_Selected_Component_To_Expanded_Name (N); end if; Add_One_Interp (N, Predef_Op, T); -- For operators with unary and binary interpretations, add both if Present (Homonym (Predef_Op)) then Add_One_Interp (N, Homonym (Predef_Op), T); end if; -- The node is a reference to a predefined operator, and -- an implicit reference to the type of its operands. if Present (Op_Type) then Generate_Operator_Reference (N, Op_Type); else Generate_Operator_Reference (N, T); end if; end Add_Implicit_Operator; -- Start of processing for Has_Implicit_Operator begin if Ekind (P) = E_Package and then not In_Open_Scopes (P) then Priv_Id := First_Private_Entity (P); end if; Id := First_Entity (P); case Op_Id is -- Boolean operators: an implicit declaration exists if the scope -- contains a declaration for a derived Boolean type, or for an -- array of Boolean type. when Name_Op_And | Name_Op_Not | Name_Op_Or | Name_Op_Xor => while Id /= Priv_Id loop if Valid_Boolean_Arg (Id) and then Id = Base_Type (Id) then Add_Implicit_Operator (Id); return True; end if; Next_Entity (Id); end loop; -- Equality: look for any non-limited type (result is Boolean) when Name_Op_Eq | Name_Op_Ne => while Id /= Priv_Id loop if Is_Type (Id) and then not Is_Limited_Type (Id) and then Id = Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; end if; Next_Entity (Id); end loop; -- Comparison operators: scalar type, or array of scalar when Name_Op_Lt | Name_Op_Le | Name_Op_Gt | Name_Op_Ge => while Id /= Priv_Id loop if (Is_Scalar_Type (Id) or else (Is_Array_Type (Id) and then Is_Scalar_Type (Component_Type (Id)))) and then Id = Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; end if; Next_Entity (Id); end loop; -- Arithmetic operators: any numeric type when Name_Op_Abs | Name_Op_Add | Name_Op_Mod | Name_Op_Rem | Name_Op_Subtract | Name_Op_Multiply | Name_Op_Divide | Name_Op_Expon => while Id /= Priv_Id loop if Is_Numeric_Type (Id) and then Id = Base_Type (Id) then Add_Implicit_Operator (Id); return True; end if; Next_Entity (Id); end loop; -- Concatenation: any one-dimensional array type when Name_Op_Concat => while Id /= Priv_Id loop if Is_Array_Type (Id) and then Number_Dimensions (Id) = 1 and then Id = Base_Type (Id) then Add_Implicit_Operator (Id); return True; end if; Next_Entity (Id); end loop; -- What is the others condition here? Should we be using a -- subtype of Name_Id that would restrict to operators ??? when others => null; end case; -- If we fall through, then we do not have an implicit operator return False; end Has_Implicit_Operator; -------------------- -- In_Open_Scopes -- -------------------- function In_Open_Scopes (S : Entity_Id) return Boolean is begin -- Since there are several scope stacks maintained by Scope_Stack each -- delineated by Standard (see comments by definition of Scope_Stack) -- it is necessary to end the search when Standard is reached. for J in reverse 0 .. Scope_Stack.Last loop if Scope_Stack.Table (J).Entity = S then return True; end if; -- We need Is_Active_Stack_Base to tell us when to stop rather -- than checking for Standard_Standard because there are cases -- where Standard_Standard appears in the middle of the active -- set of scopes. This affects the declaration and overriding -- of private inherited operations in instantiations of generic -- child units. exit when Scope_Stack.Table (J).Is_Active_Stack_Base; end loop; return False; end In_Open_Scopes; ----------------------------- -- Inherit_Renamed_Profile -- ----------------------------- procedure Inherit_Renamed_Profile (New_S : Entity_Id; Old_S : Entity_Id) is New_F : Entity_Id; Old_F : Entity_Id; Old_T : Entity_Id; New_T : Entity_Id; begin if Ekind (Old_S) = E_Operator then New_F := First_Formal (New_S); while Present (New_F) loop Set_Etype (New_F, Base_Type (Etype (New_F))); Next_Formal (New_F); end loop; Set_Etype (New_S, Base_Type (Etype (New_S))); else New_F := First_Formal (New_S); Old_F := First_Formal (Old_S); while Present (New_F) loop New_T := Etype (New_F); Old_T := Etype (Old_F); -- If the new type is a renaming of the old one, as is the -- case for actuals in instances, retain its name, to simplify -- later disambiguation. if Nkind (Parent (New_T)) = N_Subtype_Declaration and then Is_Entity_Name (Subtype_Indication (Parent (New_T))) and then Entity (Subtype_Indication (Parent (New_T))) = Old_T then null; else Set_Etype (New_F, Old_T); end if; Next_Formal (New_F); Next_Formal (Old_F); end loop; if Ekind (Old_S) = E_Function or else Ekind (Old_S) = E_Enumeration_Literal then Set_Etype (New_S, Etype (Old_S)); end if; end if; end Inherit_Renamed_Profile; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Urefs.Init; end Initialize; ------------------------- -- Install_Use_Clauses -- ------------------------- procedure Install_Use_Clauses (Clause : Node_Id; Force_Installation : Boolean := False) is U : Node_Id := Clause; P : Node_Id; Id : Entity_Id; begin while Present (U) loop -- Case of USE package if Nkind (U) = N_Use_Package_Clause then P := First (Names (U)); while Present (P) loop Id := Entity (P); if Ekind (Id) = E_Package then if In_Use (Id) then Note_Redundant_Use (P); elsif Present (Renamed_Object (Id)) and then In_Use (Renamed_Object (Id)) then Note_Redundant_Use (P); elsif Force_Installation or else Applicable_Use (P) then Use_One_Package (Id, U); end if; end if; Next (P); end loop; -- case of USE TYPE else P := First (Subtype_Marks (U)); while Present (P) loop if not Is_Entity_Name (P) or else No (Entity (P)) then null; elsif Entity (P) /= Any_Type then Use_One_Type (P); end if; Next (P); end loop; end if; Next_Use_Clause (U); end loop; end Install_Use_Clauses; ------------------------------------- -- Is_Appropriate_For_Entry_Prefix -- ------------------------------------- function Is_Appropriate_For_Entry_Prefix (T : Entity_Id) return Boolean is P_Type : Entity_Id := T; begin if Is_Access_Type (P_Type) then P_Type := Designated_Type (P_Type); end if; return Is_Task_Type (P_Type) or else Is_Protected_Type (P_Type); end Is_Appropriate_For_Entry_Prefix; ------------------------------- -- Is_Appropriate_For_Record -- ------------------------------- function Is_Appropriate_For_Record (T : Entity_Id) return Boolean is function Has_Components (T1 : Entity_Id) return Boolean; -- Determine if given type has components (i.e. is either a record -- type or a type that has discriminants). function Has_Components (T1 : Entity_Id) return Boolean is begin return Is_Record_Type (T1) or else (Is_Private_Type (T1) and then Has_Discriminants (T1)) or else (Is_Task_Type (T1) and then Has_Discriminants (T1)); end Has_Components; -- Start of processing for Is_Appropriate_For_Record begin return Present (T) and then (Has_Components (T) or else (Is_Access_Type (T) and then Has_Components (Designated_Type (T)))); end Is_Appropriate_For_Record; --------------- -- New_Scope -- --------------- procedure New_Scope (S : Entity_Id) is E : Entity_Id; begin if Ekind (S) = E_Void then null; -- Set scope depth if not a non-concurrent type, and we have not -- yet set the scope depth. This means that we have the first -- occurrence of the scope, and this is where the depth is set. elsif (not Is_Type (S) or else Is_Concurrent_Type (S)) and then not Scope_Depth_Set (S) then if S = Standard_Standard then Set_Scope_Depth_Value (S, Uint_0); elsif Is_Child_Unit (S) then Set_Scope_Depth_Value (S, Uint_1); elsif not Is_Record_Type (Current_Scope) then if Ekind (S) = E_Loop then Set_Scope_Depth_Value (S, Scope_Depth (Current_Scope)); else Set_Scope_Depth_Value (S, Scope_Depth (Current_Scope) + 1); end if; end if; end if; Scope_Stack.Increment_Last; declare SST : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); begin SST.Entity := S; SST.Save_Scope_Suppress := Scope_Suppress; SST.Save_Local_Entity_Suppress := Local_Entity_Suppress.Last; if Scope_Stack.Last > Scope_Stack.First then SST.Component_Alignment_Default := Scope_Stack.Table (Scope_Stack.Last - 1). Component_Alignment_Default; end if; SST.Last_Subprogram_Name := null; SST.Is_Transient := False; SST.Node_To_Be_Wrapped := Empty; SST.Pending_Freeze_Actions := No_List; SST.Actions_To_Be_Wrapped_Before := No_List; SST.Actions_To_Be_Wrapped_After := No_List; SST.First_Use_Clause := Empty; SST.Is_Active_Stack_Base := False; end; if Debug_Flag_W then Write_Str ("--> new scope: "); Write_Name (Chars (Current_Scope)); Write_Str (", Id="); Write_Int (Int (Current_Scope)); Write_Str (", Depth="); Write_Int (Int (Scope_Stack.Last)); Write_Eol; end if; -- Copy from Scope (S) the categorization flags to S, this is not -- done in case Scope (S) is Standard_Standard since propagation -- is from library unit entity inwards. if S /= Standard_Standard and then Scope (S) /= Standard_Standard and then not Is_Child_Unit (S) then E := Scope (S); if Nkind (E) not in N_Entity then return; end if; -- We only propagate inwards for library level entities, -- inner level subprograms do not inherit the categorization. if Is_Library_Level_Entity (S) then Set_Is_Preelaborated (S, Is_Preelaborated (E)); Set_Is_Shared_Passive (S, Is_Shared_Passive (E)); Set_Categorization_From_Scope (E => S, Scop => E); end if; end if; end New_Scope; ------------------------ -- Note_Redundant_Use -- ------------------------ procedure Note_Redundant_Use (Clause : Node_Id) is Pack_Name : constant Entity_Id := Entity (Clause); Cur_Use : constant Node_Id := Current_Use_Clause (Pack_Name); Decl : constant Node_Id := Parent (Clause); Prev_Use : Node_Id := Empty; Redundant : Node_Id := Empty; -- The Use_Clause which is actually redundant. In the simplest case -- it is Pack itself, but when we compile a body we install its -- context before that of its spec, in which case it is the use_clause -- in the spec that will appear to be redundant, and we want the -- warning to be placed on the body. Similar complications appear when -- the redundancy is between a child unit and one of its ancestors. begin Set_Redundant_Use (Clause, True); if not Comes_From_Source (Clause) or else In_Instance or else not Warn_On_Redundant_Constructs then return; end if; if not Is_Compilation_Unit (Current_Scope) then -- If the use_clause is in an inner scope, it is made redundant -- by some clause in the current context, with one exception: -- If we're compiling a nested package body, and the use_clause -- comes from the corresponding spec, the clause is not necessarily -- fully redundant, so we should not warn. If a warning was -- warranted, it would have been given when the spec was processed. if Nkind (Parent (Decl)) = N_Package_Specification then declare Package_Spec_Entity : constant Entity_Id := Defining_Unit_Name (Parent (Decl)); begin if In_Package_Body (Package_Spec_Entity) then return; end if; end; end if; Redundant := Clause; Prev_Use := Cur_Use; elsif Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Body then declare Cur_Unit : constant Unit_Number_Type := Get_Source_Unit (Cur_Use); New_Unit : constant Unit_Number_Type := Get_Source_Unit (Clause); Scop : Entity_Id; begin if Cur_Unit = New_Unit then -- Redundant clause in same body Redundant := Clause; Prev_Use := Cur_Use; elsif Cur_Unit = Current_Sem_Unit then -- If the new clause is not in the current unit it has been -- analyzed first, and it makes the other one redundant. -- However, if the new clause appears in a subunit, Cur_Unit -- is still the parent, and in that case the redundant one -- is the one appearing in the subunit. if Nkind (Unit (Cunit (New_Unit))) = N_Subunit then Redundant := Clause; Prev_Use := Cur_Use; -- Most common case: redundant clause in body, -- original clause in spec. Current scope is spec entity. elsif Current_Scope = Defining_Entity ( Unit (Library_Unit (Cunit (Current_Sem_Unit)))) then Redundant := Cur_Use; Prev_Use := Clause; else -- The new clause may appear in an unrelated unit, when -- the parents of a generic are being installed prior to -- instantiation. In this case there must be no warning. -- We detect this case by checking whether the current top -- of the stack is related to the current compilation. Scop := Current_Scope; while Present (Scop) and then Scop /= Standard_Standard loop if Is_Compilation_Unit (Scop) and then not Is_Child_Unit (Scop) then return; elsif Scop = Cunit_Entity (Current_Sem_Unit) then exit; end if; Scop := Scope (Scop); end loop; Redundant := Cur_Use; Prev_Use := Clause; end if; elsif New_Unit = Current_Sem_Unit then Redundant := Clause; Prev_Use := Cur_Use; else -- Neither is the current unit, so they appear in parent or -- sibling units. Warning will be emitted elsewhere. return; end if; end; elsif Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Declaration and then Present (Parent_Spec (Unit (Cunit (Current_Sem_Unit)))) then -- Use_clause is in child unit of current unit, and the child -- unit appears in the context of the body of the parent, so it -- has been installed first, even though it is the redundant one. -- Depending on their placement in the context, the visible or the -- private parts of the two units, either might appear as redundant, -- but the message has to be on the current unit. if Get_Source_Unit (Cur_Use) = Current_Sem_Unit then Redundant := Cur_Use; Prev_Use := Clause; else Redundant := Clause; Prev_Use := Cur_Use; end if; -- If the new use clause appears in the private part of a parent unit -- it may appear to be redudant w.r.t. a use clause in a child unit, -- but the previous use clause was needed in the visible part of the -- child, and no warning should be emitted. if Nkind (Parent (Decl)) = N_Package_Specification and then List_Containing (Decl) = Private_Declarations (Parent (Decl)) then declare Par : constant Entity_Id := Defining_Entity (Parent (Decl)); Spec : constant Node_Id := Specification (Unit (Cunit (Current_Sem_Unit))); begin if Is_Compilation_Unit (Par) and then Par /= Cunit_Entity (Current_Sem_Unit) and then Parent (Cur_Use) = Spec and then List_Containing (Cur_Use) = Visible_Declarations (Spec) then return; end if; end; end if; else null; end if; if Present (Redundant) then Error_Msg_Sloc := Sloc (Prev_Use); Error_Msg_NE ( "& is already use_visible through declaration #?", Redundant, Pack_Name); end if; end Note_Redundant_Use; --------------- -- Pop_Scope -- --------------- procedure Pop_Scope is SST : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); begin if Debug_Flag_E then Write_Info; end if; Scope_Suppress := SST.Save_Scope_Suppress; Local_Entity_Suppress.Set_Last (SST.Save_Local_Entity_Suppress); if Debug_Flag_W then Write_Str ("--> exiting scope: "); Write_Name (Chars (Current_Scope)); Write_Str (", Depth="); Write_Int (Int (Scope_Stack.Last)); Write_Eol; end if; End_Use_Clauses (SST.First_Use_Clause); -- If the actions to be wrapped are still there they will get lost -- causing incomplete code to be generated. It is better to abort in -- this case (and we do the abort even with assertions off since the -- penalty is incorrect code generation) if SST.Actions_To_Be_Wrapped_Before /= No_List or else SST.Actions_To_Be_Wrapped_After /= No_List then return; end if; -- Free last subprogram name if allocated, and pop scope Free (SST.Last_Subprogram_Name); Scope_Stack.Decrement_Last; end Pop_Scope; --------------------- -- Premature_Usage -- --------------------- procedure Premature_Usage (N : Node_Id) is Kind : constant Node_Kind := Nkind (Parent (Entity (N))); E : Entity_Id := Entity (N); begin -- Within an instance, the analysis of the actual for a formal object -- does not see the name of the object itself. This is significant -- only if the object is an aggregate, where its analysis does not do -- any name resolution on component associations. (see 4717-008). In -- such a case, look for the visible homonym on the chain. if In_Instance and then Present (Homonym (E)) then E := Homonym (E); while Present (E) and then not In_Open_Scopes (Scope (E)) loop E := Homonym (E); end loop; if Present (E) then Set_Entity (N, E); Set_Etype (N, Etype (E)); return; end if; end if; if Kind = N_Component_Declaration then Error_Msg_N ("component&! cannot be used before end of record declaration", N); elsif Kind = N_Parameter_Specification then Error_Msg_N ("formal parameter&! cannot be used before end of specification", N); elsif Kind = N_Discriminant_Specification then Error_Msg_N ("discriminant&! cannot be used before end of discriminant part", N); elsif Kind = N_Procedure_Specification or else Kind = N_Function_Specification then Error_Msg_N ("subprogram&! cannot be used before end of its declaration", N); else Error_Msg_N ("object& cannot be used before end of its declaration!", N); end if; end Premature_Usage; ------------------------ -- Present_System_Aux -- ------------------------ function Present_System_Aux (N : Node_Id := Empty) return Boolean is Loc : Source_Ptr; Aux_Name : Name_Id; Unum : Unit_Number_Type; Withn : Node_Id; With_Sys : Node_Id; The_Unit : Node_Id; function Find_System (C_Unit : Node_Id) return Entity_Id; -- Scan context clause of compilation unit to find a with_clause -- for System. ----------------- -- Find_System -- ----------------- function Find_System (C_Unit : Node_Id) return Entity_Id is With_Clause : Node_Id; begin With_Clause := First (Context_Items (C_Unit)); while Present (With_Clause) loop if (Nkind (With_Clause) = N_With_Clause and then Chars (Name (With_Clause)) = Name_System) and then Comes_From_Source (With_Clause) then return With_Clause; end if; Next (With_Clause); end loop; return Empty; end Find_System; -- Start of processing for Present_System_Aux begin -- The child unit may have been loaded and analyzed already if Present (System_Aux_Id) then return True; -- If no previous pragma for System.Aux, nothing to load elsif No (System_Extend_Unit) then return False; -- Use the unit name given in the pragma to retrieve the unit. -- Verify that System itself appears in the context clause of the -- current compilation. If System is not present, an error will -- have been reported already. else With_Sys := Find_System (Cunit (Current_Sem_Unit)); The_Unit := Unit (Cunit (Current_Sem_Unit)); if No (With_Sys) and then (Nkind (The_Unit) = N_Package_Body or else (Nkind (The_Unit) = N_Subprogram_Body and then not Acts_As_Spec (Cunit (Current_Sem_Unit)))) then With_Sys := Find_System (Library_Unit (Cunit (Current_Sem_Unit))); end if; if No (With_Sys) and then Present (N) then -- If we are compiling a subunit, we need to examine its -- context as well (Current_Sem_Unit is the parent unit); The_Unit := Parent (N); while Nkind (The_Unit) /= N_Compilation_Unit loop The_Unit := Parent (The_Unit); end loop; if Nkind (Unit (The_Unit)) = N_Subunit then With_Sys := Find_System (The_Unit); end if; end if; if No (With_Sys) then return False; end if; Loc := Sloc (With_Sys); Get_Name_String (Chars (Expression (System_Extend_Unit))); Name_Buffer (8 .. Name_Len + 7) := Name_Buffer (1 .. Name_Len); Name_Buffer (1 .. 7) := "system."; Name_Buffer (Name_Len + 8) := '%'; Name_Buffer (Name_Len + 9) := 's'; Name_Len := Name_Len + 9; Aux_Name := Name_Find; Unum := Load_Unit (Load_Name => Aux_Name, Required => False, Subunit => False, Error_Node => With_Sys); if Unum /= No_Unit then Semantics (Cunit (Unum)); System_Aux_Id := Defining_Entity (Specification (Unit (Cunit (Unum)))); Withn := Make_With_Clause (Loc, Name => Make_Expanded_Name (Loc, Chars => Chars (System_Aux_Id), Prefix => New_Reference_To (Scope (System_Aux_Id), Loc), Selector_Name => New_Reference_To (System_Aux_Id, Loc))); Set_Entity (Name (Withn), System_Aux_Id); Set_Library_Unit (Withn, Cunit (Unum)); Set_Corresponding_Spec (Withn, System_Aux_Id); Set_First_Name (Withn, True); Set_Implicit_With (Withn, True); Insert_After (With_Sys, Withn); Mark_Rewrite_Insertion (Withn); Set_Context_Installed (Withn); return True; -- Here if unit load failed else Error_Msg_Name_1 := Name_System; Error_Msg_Name_2 := Chars (Expression (System_Extend_Unit)); Error_Msg_N ("extension package `%.%` does not exist", Opt.System_Extend_Unit); return False; end if; end if; end Present_System_Aux; ------------------------- -- Restore_Scope_Stack -- ------------------------- procedure Restore_Scope_Stack (Handle_Use : Boolean := True) is E : Entity_Id; S : Entity_Id; Comp_Unit : Node_Id; In_Child : Boolean := False; Full_Vis : Boolean := True; SS_Last : constant Int := Scope_Stack.Last; begin -- Restore visibility of previous scope stack, if any for J in reverse 0 .. Scope_Stack.Last loop exit when Scope_Stack.Table (J).Entity = Standard_Standard or else No (Scope_Stack.Table (J).Entity); S := Scope_Stack.Table (J).Entity; if not Is_Hidden_Open_Scope (S) then -- If the parent scope is hidden, its entities are hidden as -- well, unless the entity is the instantiation currently -- being analyzed. if not Is_Hidden_Open_Scope (Scope (S)) or else not Analyzed (Parent (S)) or else Scope (S) = Standard_Standard then Set_Is_Immediately_Visible (S, True); end if; E := First_Entity (S); while Present (E) loop if Is_Child_Unit (E) then Set_Is_Immediately_Visible (E, Is_Visible_Child_Unit (E) or else In_Open_Scopes (E)); else Set_Is_Immediately_Visible (E, True); end if; Next_Entity (E); if not Full_Vis then exit when E = First_Private_Entity (S); end if; end loop; -- The visibility of child units (siblings of current compilation) -- must be restored in any case. Their declarations may appear -- after the private part of the parent. if not Full_Vis and then Present (E) then while Present (E) loop if Is_Child_Unit (E) then Set_Is_Immediately_Visible (E, Is_Visible_Child_Unit (E) or else In_Open_Scopes (E)); end if; Next_Entity (E); end loop; end if; end if; if Is_Child_Unit (S) and not In_Child -- check only for current unit. then In_Child := True; -- restore visibility of parents according to whether the child -- is private and whether we are in its visible part. Comp_Unit := Parent (Unit_Declaration_Node (S)); if Nkind (Comp_Unit) = N_Compilation_Unit and then Private_Present (Comp_Unit) then Full_Vis := True; elsif (Ekind (S) = E_Package or else Ekind (S) = E_Generic_Package) and then (In_Private_Part (S) or else In_Package_Body (S)) then Full_Vis := True; elsif (Ekind (S) = E_Procedure or else Ekind (S) = E_Function) and then Has_Completion (S) then Full_Vis := True; else Full_Vis := False; end if; else Full_Vis := True; end if; end loop; if SS_Last >= Scope_Stack.First and then Scope_Stack.Table (SS_Last).Entity /= Standard_Standard and then Handle_Use then Install_Use_Clauses (Scope_Stack.Table (SS_Last).First_Use_Clause); end if; end Restore_Scope_Stack; ---------------------- -- Save_Scope_Stack -- ---------------------- procedure Save_Scope_Stack (Handle_Use : Boolean := True) is E : Entity_Id; S : Entity_Id; SS_Last : constant Int := Scope_Stack.Last; begin if SS_Last >= Scope_Stack.First and then Scope_Stack.Table (SS_Last).Entity /= Standard_Standard then if Handle_Use then End_Use_Clauses (Scope_Stack.Table (SS_Last).First_Use_Clause); end if; -- If the call is from within a compilation unit, as when -- called from Rtsfind, make current entries in scope stack -- invisible while we analyze the new unit. for J in reverse 0 .. SS_Last loop exit when Scope_Stack.Table (J).Entity = Standard_Standard or else No (Scope_Stack.Table (J).Entity); S := Scope_Stack.Table (J).Entity; Set_Is_Immediately_Visible (S, False); E := First_Entity (S); while Present (E) loop Set_Is_Immediately_Visible (E, False); Next_Entity (E); end loop; end loop; end if; end Save_Scope_Stack; ------------- -- Set_Use -- ------------- procedure Set_Use (L : List_Id) is Decl : Node_Id; Pack_Name : Node_Id; Pack : Entity_Id; Id : Entity_Id; begin if Present (L) then Decl := First (L); while Present (Decl) loop if Nkind (Decl) = N_Use_Package_Clause then Chain_Use_Clause (Decl); Pack_Name := First (Names (Decl)); while Present (Pack_Name) loop Pack := Entity (Pack_Name); if Ekind (Pack) = E_Package and then Applicable_Use (Pack_Name) then Use_One_Package (Pack, Decl); end if; Next (Pack_Name); end loop; elsif Nkind (Decl) = N_Use_Type_Clause then Chain_Use_Clause (Decl); Id := First (Subtype_Marks (Decl)); while Present (Id) loop if Entity (Id) /= Any_Type then Use_One_Type (Id); end if; Next (Id); end loop; end if; Next (Decl); end loop; end if; end Set_Use; --------------------- -- Use_One_Package -- --------------------- procedure Use_One_Package (P : Entity_Id; N : Node_Id) is Id : Entity_Id; Prev : Entity_Id; Current_Instance : Entity_Id := Empty; Real_P : Entity_Id; Private_With_OK : Boolean := False; begin if Ekind (P) /= E_Package then return; end if; Set_In_Use (P); Set_Current_Use_Clause (P, N); -- Ada 2005 (AI-50217): Check restriction if From_With_Type (P) then Error_Msg_N ("limited withed package cannot appear in use clause", N); end if; -- Find enclosing instance, if any if In_Instance then Current_Instance := Current_Scope; while not Is_Generic_Instance (Current_Instance) loop Current_Instance := Scope (Current_Instance); end loop; if No (Hidden_By_Use_Clause (N)) then Set_Hidden_By_Use_Clause (N, New_Elmt_List); end if; end if; -- If unit is a package renaming, indicate that the renamed -- package is also in use (the flags on both entities must -- remain consistent, and a subsequent use of either of them -- should be recognized as redundant). if Present (Renamed_Object (P)) then Set_In_Use (Renamed_Object (P)); Set_Current_Use_Clause (Renamed_Object (P), N); Real_P := Renamed_Object (P); else Real_P := P; end if; -- Ada 2005 (AI-262): Check the use_clause of a private withed package -- found in the private part of a package specification if In_Private_Part (Current_Scope) and then Has_Private_With (P) and then Is_Child_Unit (Current_Scope) and then Is_Child_Unit (P) and then Is_Ancestor_Package (Scope (Current_Scope), P) then Private_With_OK := True; end if; -- Loop through entities in one package making them potentially -- use-visible. Id := First_Entity (P); while Present (Id) and then (Id /= First_Private_Entity (P) or else Private_With_OK) -- Ada 2005 (AI-262) loop Prev := Current_Entity (Id); while Present (Prev) loop if Is_Immediately_Visible (Prev) and then (not Is_Overloadable (Prev) or else not Is_Overloadable (Id) or else (Type_Conformant (Id, Prev))) then if No (Current_Instance) then -- Potentially use-visible entity remains hidden goto Next_Usable_Entity; -- A use clause within an instance hides outer global -- entities, which are not used to resolve local entities -- in the instance. Note that the predefined entities in -- Standard could not have been hidden in the generic by -- a use clause, and therefore remain visible. Other -- compilation units whose entities appear in Standard must -- be hidden in an instance. -- To determine whether an entity is external to the instance -- we compare the scope depth of its scope with that of the -- current instance. However, a generic actual of a subprogram -- instance is declared in the wrapper package but will not be -- hidden by a use-visible entity. -- If Id is called Standard, the predefined package with the -- same name is in the homonym chain. It has to be ignored -- because it has no defined scope (being the only entity in -- the system with this mandated behavior). elsif not Is_Hidden (Id) and then Present (Scope (Prev)) and then not Is_Wrapper_Package (Scope (Prev)) and then Scope_Depth (Scope (Prev)) < Scope_Depth (Current_Instance) and then (Scope (Prev) /= Standard_Standard or else Sloc (Prev) > Standard_Location) then Set_Is_Potentially_Use_Visible (Id); Set_Is_Immediately_Visible (Prev, False); Append_Elmt (Prev, Hidden_By_Use_Clause (N)); end if; -- A user-defined operator is not use-visible if the -- predefined operator for the type is immediately visible, -- which is the case if the type of the operand is in an open -- scope. This does not apply to user-defined operators that -- have operands of different types, because the predefined -- mixed mode operations (multiplication and division) apply to -- universal types and do not hide anything. elsif Ekind (Prev) = E_Operator and then Operator_Matches_Spec (Prev, Id) and then In_Open_Scopes (Scope (Base_Type (Etype (First_Formal (Id))))) and then (No (Next_Formal (First_Formal (Id))) or else Etype (First_Formal (Id)) = Etype (Next_Formal (First_Formal (Id))) or else Chars (Prev) = Name_Op_Expon) then goto Next_Usable_Entity; end if; Prev := Homonym (Prev); end loop; -- On exit, we know entity is not hidden, unless it is private if not Is_Hidden (Id) and then ((not Is_Child_Unit (Id)) or else Is_Visible_Child_Unit (Id)) then Set_Is_Potentially_Use_Visible (Id); if Is_Private_Type (Id) and then Present (Full_View (Id)) then Set_Is_Potentially_Use_Visible (Full_View (Id)); end if; end if; <<Next_Usable_Entity>> Next_Entity (Id); end loop; -- Child units are also made use-visible by a use clause, but they -- may appear after all visible declarations in the parent entity list. while Present (Id) loop if Is_Child_Unit (Id) and then Is_Visible_Child_Unit (Id) then Set_Is_Potentially_Use_Visible (Id); end if; Next_Entity (Id); end loop; if Chars (Real_P) = Name_System and then Scope (Real_P) = Standard_Standard and then Present_System_Aux (N) then Use_One_Package (System_Aux_Id, N); end if; end Use_One_Package; ------------------ -- Use_One_Type -- ------------------ procedure Use_One_Type (Id : Node_Id) is T : Entity_Id; Op_List : Elist_Id; Elmt : Elmt_Id; begin -- It is the type determined by the subtype mark (8.4(8)) whose -- operations become potentially use-visible. T := Base_Type (Entity (Id)); Set_Redundant_Use (Id, In_Use (T) or else Is_Potentially_Use_Visible (T) or else In_Use (Scope (T))); if In_Open_Scopes (Scope (T)) then null; -- If the subtype mark designates a subtype in a different package, -- we have to check that the parent type is visible, otherwise the -- use type clause is a noop. Not clear how to do that??? elsif not Redundant_Use (Id) then Set_In_Use (T); Op_List := Collect_Primitive_Operations (T); Elmt := First_Elmt (Op_List); while Present (Elmt) loop if (Nkind (Node (Elmt)) = N_Defining_Operator_Symbol or else Chars (Node (Elmt)) in Any_Operator_Name) and then not Is_Hidden (Node (Elmt)) then Set_Is_Potentially_Use_Visible (Node (Elmt)); end if; Next_Elmt (Elmt); end loop; end if; end Use_One_Type; ---------------- -- Write_Info -- ---------------- procedure Write_Info is Id : Entity_Id := First_Entity (Current_Scope); begin -- No point in dumping standard entities if Current_Scope = Standard_Standard then return; end if; Write_Str ("========================================================"); Write_Eol; Write_Str (" Defined Entities in "); Write_Name (Chars (Current_Scope)); Write_Eol; Write_Str ("========================================================"); Write_Eol; if No (Id) then Write_Str ("-- none --"); Write_Eol; else while Present (Id) loop Write_Entity_Info (Id, " "); Next_Entity (Id); end loop; end if; if Scope (Current_Scope) = Standard_Standard then -- Print information on the current unit itself Write_Entity_Info (Current_Scope, " "); end if; Write_Eol; end Write_Info; ----------------- -- Write_Scopes -- ----------------- procedure Write_Scopes is S : Entity_Id; begin for J in reverse 1 .. Scope_Stack.Last loop S := Scope_Stack.Table (J).Entity; Write_Int (Int (S)); Write_Str (" === "); Write_Name (Chars (S)); Write_Eol; end loop; end Write_Scopes; end Sem_Ch8;
tests/028_LABELS_-_testing_dot_notation.asm
tpisto/pasm
103
29233
; name: LABELS - testing dot notation ; code: "0FA274FE0FA2E9FDFF0FA290" cpuid main: .tommi: jz .tommi cpuid maintest: .tommi: jmp .tommi cpuid nop
ejercicios3/intercambiar.adb
iyan22/AprendeAda
0
22307
<reponame>iyan22/AprendeAda<filename>ejercicios3/intercambiar.adb with datos; use datos; procedure intercambiar (Pos_Min, posicion : in Integer; L : in out Lista_Enteros) is -- Incio: X Y -- Final: Y X Auxiliar: Integer; begin Auxiliar := L.Numeros(posicion); -- Auxiliar es Posicion X L.Numeros(posicion) := L.Numeros(Pos_Min); -- En Posicion X ponemos Posicion Y L.Numeros(Pos_Min) := Auxiliar; -- En Posicion Y ponemos Auxilar que es Posicion X end intercambiar;
oeis/018/A018218.asm
neoneye/loda-programs
11
96511
; A018218: Sum(C(j)*(n-j)*4^(n-j-1),j=0..n-1), C = Catalan numbers. ; Submitted by <NAME> ; 0,1,9,58,325,1686,8330,39796,185517,848830,3827230,17053356,75249954,329353948,1431575220,6185613032,26589395581,113780713806,484945025942,2059546425340,8719018250838,36805967321684,154967912827084,650939308033368,2728370918647250,11413228324791436,47656753846376940,198660744927424696,826847431428282532,3436471280539215480,14263213583677854696,59125983167297482192,244810992635573409309,1012527744472704607598,4183458409742874554950,17268036310421872448796,71212072212983894012430 mov $1,$0 mul $1,2 add $1,1 bin $1,$0 mov $2,4 pow $2,$0 add $0,1 sub $2,$1 mul $0,$2 div $0,2
test/interaction/Issue3428.agda
cruhland/agda
1,989
15144
kk : ∀ {ℓ} → Set ℓ kk = {!∀ B → B!}
GauInt/EucDomain.agda
onestruggler/EucDomain
0
12560
<filename>GauInt/EucDomain.agda -- We show Gausssian Integers forms an Euclidean domain. The proofs -- are straightforward. {-# OPTIONS --without-K --safe #-} module GauInt.EucDomain where -- imports from local. -- Hiding the usual div and mod function. We will the new instance in -- Integer.EucDomain2 import Instances hiding (DMℤ) open Instances open import Integer.EucDomain2 renaming (div' to divℤ ; mod' to modℤ ; euc-eq' to euc-eqℤ ; euc-rank' to euc-rankℤ) open import Integer.Properties open import GauInt.Base using (𝔾 ; _+_i ; _ᶜ ; Re ; Im ; _+0i ; _+0i' ; 0𝔾 ; 1𝔾) open import GauInt.Properties open import GauInt.Instances -- imports from stdlib and Agda. open import Relation.Nullary using (yes ; no ; ¬_) open import Relation.Binary.PropositionalEquality open import Data.Product as P using (_×_ ; _,_ ; proj₁ ; proj₂) open import Data.Sum as S renaming ([_,_]′ to ⊎-elim) open import Data.Nat as Nat using (ℕ ; suc ; zero ; z≤n) import Data.Nat.Properties as NatP open import Data.Integer as Int using (0ℤ ; +0 ; +_ ; _≥_ ; +≤+ ; +[1+_] ; -[1+_] ; ℤ ; ∣_∣) import Data.Integer.Properties as IntP import Data.Nat.Solver as NS import Data.Integer.Solver as IS import GauInt.Solver as GS open import Algebra.Properties.Ring +-*-ring open import Algebra.Definitions (_≡_ {A = 𝔾}) using (AlmostLeftCancellative) open import Function.Base using (_$_) -- ---------------------------------------------------------------------- -- Euclidean Structure on 𝔾 -- As explained in the imports part, we will use the div and mod -- function defined in Integer.EucDomain2. -- A special case when the divisor is a positive natural number. The proof: -- Let x = a + b i, and y = d. By integer euc-eq and euc-rank we have -- step-a : a = ra + qa * d, with rank ra ≤ d / 2. -- step-b : b = rb + qb * d, with rank rb ≤ d / 2. -- We let q = qa + qb i, r = ra + rb i. Easy to check that -- eq : x = r + q y. Slightly harder to check -- le : rank r ≤ d / 2 (see below). div' : 𝔾 -> (d : ℕ) -> ¬ d ≡ 0# -> 𝔾 div' n zero n0 with n0 refl ... | () div' (a + b i) d@(suc e) n0 = qa + qb i where qa = a / + d qb = b / + d mod' : 𝔾 -> (d : ℕ) -> ¬ d ≡ 0# -> 𝔾 mod' n zero n0 with n0 refl ... | () mod' (a + b i) d@(suc e) n0 = ra + rb i where ra = a % + d rb = b % + d div : (x y : 𝔾) -> ¬ y ≡ 0# -> 𝔾 div x y n0 = div' (x * y ᶜ) y*yᶜ n0' where y*yᶜ : ℕ y*yᶜ = rank y n0' : ¬ rank y ≡ 0# n0' = y≠0#⇒rank≠0 n0 mod : (x y : 𝔾) -> ¬ y ≡ 0# -> 𝔾 mod x y n0 = (x - q * y) where q = div x y n0 -- ---------------------------------------------------------------------- -- euc-eq and euc-rank property for div' and mod' -- Dividend = reminder + quotient * divisor. euc-eq' : ∀ (x : 𝔾) (d : ℕ) (n0 : ¬ d ≡ 0) -> let r = mod' x d n0 in let q = div' x d n0 in x ≡ r + q * (d +0i) euc-eq' n zero n0 with n0 refl ... | () euc-eq' x@(a + b i) d@(suc e) n0 = eq where -- setting up q and r. n0' : ¬ + d ≡ 0# n0' p = n0 (IntP.+-injective p) qa = a / + d qb = b / + d ra = a % + d rb = b % + d ea : a ≡ ra + qa * + d ea = euc-eqℤ a (+ d) n0' eb : b ≡ rb + qb * + d eb = euc-eqℤ b (+ d) n0' q : 𝔾 q = qa + qb i r : 𝔾 r = ra + rb i -- Inject natural number d to Gaussian integer. y = d +0i -- Proving x = r + q * y. eq : x ≡ r + q * y eq = begin x ≡⟨ refl ⟩ a + b i ≡⟨ cong (λ x -> x + b i) ea ⟩ (ra + qa * (+ d)) + b i ≡⟨ cong (λ x -> (ra + qa * (+ d)) + x i) eb ⟩ (ra + qa * (+ d)) + (rb + qb * (+ d)) i ≡⟨ refl ⟩ (ra + rb i) + ((qa * (+ d)) + (qb * (+ d)) i) ≡⟨ cong (λ x → (ra + rb i) + ((qa * (+ d)) + x i)) ((solve 3 (λ qa d qb → qb :* d := qa :* con 0ℤ :+ qb :* d) refl) qa (+ d) qb) ⟩ (ra + rb i) + ((qa * (+ d)) + (qa * 0ℤ + qb * (+ d)) i) ≡⟨ cong (λ x → (ra + rb i) + (x + (qa * 0ℤ + qb * (+ d)) i)) ((solve 3 (λ qa d qb → qa :* d := qa :* d :- qb :* con 0ℤ) refl) qa (+ d) qb) ⟩ (ra + rb i) + ((qa * (+ d) - qb * 0ℤ) + (qa * 0ℤ + qb * (+ d)) i) ≡⟨ refl ⟩ (ra + rb i) + (qa + qb i) * y ≡⟨ refl ⟩ r + q * y ∎ where open IS.+-*-Solver open ≡-Reasoning -- rank r < rank (inj d) euc-rank' : ∀ (x : 𝔾) (d : ℕ) (n0 : ¬ d ≡ 0) -> let r = mod' x d n0 in let q = div' x d n0 in rank r < rank (d +0i) euc-rank' n zero n0 with n0 refl ... | () euc-rank' x@(a + b i) d@(suc e) n0 = le where -- setting up q and r. n0' : ¬ + d ≡ 0# n0' p = n0 (IntP.+-injective p) r : 𝔾 r = mod' x d n0 ra = Re r rb = Im r q : 𝔾 q = div' x d n0 qa = Re q qb = Im q lea : ∣ ra ∣ ≤ d / 2 lea = euc-rankℤ a (+ d) n0' leb : ∣ rb ∣ ≤ d / 2 leb = euc-rankℤ b (+ d) n0' y = d +0i -- Proving rank r < rank y. -- Some auxillary lemmas. lem1 : ∀ {d : ℕ} -> d / 2 + d / 2 ≤ d lem1 {d} = begin d / 2 + d / 2 ≡⟨ solve 1 (λ x → x :+ x := x :* con 2) refl (d / 2) ⟩ d / 2 * 2 ≤⟨ NatP.m≤n+m (d / 2 * 2) (d % 2) ⟩ d % 2 + d / 2 * 2 ≡⟨ (sym $ NatESR.euc-eq d 2 (λ ())) ⟩ d ∎ where open NatP.≤-Reasoning open NS.+-*-Solver lem2 : ∀ {d : Nat.ℕ} -> d / 2 ≤ d lem2 {d} = begin d / 2 ≤⟨ NatP.m≤n+m (d / 2) (d / 2) ⟩ d / 2 + d / 2 ≤⟨ lem1 {d} ⟩ d ∎ where open NatP.≤-Reasoning open NS.+-*-Solver lem2-strict : ∀ {d : Nat.ℕ} .{{_ : NonZero d}} -> (d / 2) < d lem2-strict {x@(suc d)} with x / 2 Nat.≟ 0 ... | no ¬p = begin-strict x / 2 <⟨ NatP.m<n+m (x / 2) x/2>0 ⟩ x / 2 + x / 2 ≤⟨ lem1 {x} ⟩ x ∎ where open NatP.≤-Reasoning open NS.+-*-Solver open import Relation.Binary.Definitions open import Data.Empty x/2>0 : 0 < (x / 2) x/2>0 with NatP.<-cmp 0 (x / 2) ... | tri< a ¬b ¬c = a ... | tri≈ ¬a b ¬c = ⊥-elim (¬p (sym b)) ... | yes p rewrite p = Nat.s≤s Nat.z≤n lem3 : rank y ≡ d * d lem3 = begin rank y ≡⟨ refl ⟩ ∣ (+ d) * (+ d) + 0ℤ * 0ℤ ∣ ≡⟨ cong ∣_∣ (solve 1 (λ x → x :* x :+ con 0ℤ :* con 0ℤ := x :* x) refl (+ d)) ⟩ ∣ (+ d) * (+ d) ∣ ≡⟨ IntP.abs-*-commute (+ d) (+ d) ⟩ ∣ (+ d) ∣ * ∣ (+ d) ∣ ≡⟨ refl ⟩ d * d ∎ where open IS.+-*-Solver open ≡-Reasoning -- The proof idea: -- rank r = ∣ ra * ra + rb * rb ∣ = ∣ ra ∣ * ∣ ra ∣ + ∣ rb ∣ * ∣ rb ∣ -- ≤ d / 2 * d / 2 + d / 2 * d / 2 by the integer divmod property. -- ≤ d * d -- = rank y le : rank r < rank y le = begin-strict rank r ≡⟨ refl ⟩ let (sa , sae) = (a*a=+b ra) in let (sb , sbe) = a*a=+b rb in ∣ ra * ra + rb * rb ∣ ≡⟨ tri-eq' ra rb ⟩ ∣ ra * ra ∣ + ∣ rb * rb ∣ ≡⟨ cong₂ _+_ (IntP.abs-*-commute ra ra) (IntP.abs-*-commute rb rb) ⟩ ∣ ra ∣ * ∣ ra ∣ + ∣ rb ∣ * ∣ rb ∣ ≤⟨ NatP.+-mono-≤ (NatP.*-mono-≤ lea lea) (NatP.*-mono-≤ leb leb) ⟩ (d / 2) * (d / 2) + (d / 2) * (d / 2) ≡⟨ solve 1 (λ x → (x :* x) :+ (x :* x) := x :* (x :+ x)) refl (d / 2) ⟩ (d / 2) * ((d / 2) + (d / 2)) ≤⟨ NatP.*-monoʳ-≤ (d / 2) lem1 ⟩ (d / 2) * d <⟨ NatP.*-monoˡ-< d (lem2-strict {d}) ⟩ d * d ≡⟨ sym lem3 ⟩ rank y ∎ where open NatP.≤-Reasoning open NS.+-*-Solver -- ---------------------------------------------------------------------- -- euc-eq and euc-rank property for div and mod -- This is the case when the divisor y = c + d i is an arbitrary -- non-zero Gaussian integer. Easy to see rank y ᶜ = rank y = y * y -- ᶜ = ∣ c * c + d * d ∣ ≠ 0. Notice that by the previous spcial -- case (when the divisor is a positive natural number) we have -- eq' : x * y ᶜ = r' + q' * (y * y ᶜ), and -- le' : rank r' < rank (y * y ᶜ) = rank y * rank y ᶜ -- (eq') ⇒ r' = x * y ᶜ - q' * (y * y ᶜ) = (x - q' * y) * y ᶜ -- ⇒ eqr: rank r' = rank (x - q' * y) * rank y ᶜ -- (le') & (eqr) ⇒ rank (x - q' * y) < rank y since rank y ᶜ ≠ 0. -- So setting q = q', and r = x - q' * y as div and mod functions do, -- then check the euc-rank property holds. -- Dividend = reminder + quotient * divisor. euc-eq : ∀ (x y : 𝔾) (n0 : ¬ y ≡ 0𝔾) -> let r = mod x y n0 in let q = div x y n0 in x ≡ r + q * y euc-eq x y n0 = claim where -- Setting up r and q. r : 𝔾 r = mod x y n0 q : 𝔾 q = div x y n0 claim : x ≡ (x - q * y) + q * y claim = begin x ≡⟨ solve 2 (\ x qy -> x := (x :- qy) :+ qy) refl x (q * y) ⟩ (x - q * y) + q * y ∎ where open GS.+-*-Solver open ≡-Reasoning -- rank r < rank y. euc-rank : ∀ (x y : 𝔾) (n0 : ¬ y ≡ 0#) -> let r = mod x y n0 in let q = div x y n0 in rank r < rank y euc-rank x y n0 = claim where n0' : ¬ rank y ≡ 0# n0' = y≠0#⇒rank≠0 n0 r : 𝔾 r = mod x y n0 q : 𝔾 q = div x y n0 eq : x ≡ r + q * y eq = euc-eq x y n0 r' : 𝔾 r' = mod' (x * y ᶜ) (rank y) n0' q' : 𝔾 q' = div' (x * y ᶜ) (rank y) n0' eq' : x * y ᶜ ≡ r' + q' * (rank y +0i) eq' = euc-eq' (x * y ᶜ) (rank y) n0' le' : rank r' < rank (rank y +0i) le' = euc-rank' (x * y ᶜ) (rank y) n0' q=q' : q ≡ q' q=q' = refl -- eqr : rank r' = rank (x - q' * y) * rank y ᶜ ---- (3) eqr : rank r' ≡ rank (x - q' * y) * rank (y ᶜ) eqr = begin rank r' ≡⟨ cong rank step ⟩ rank ((x - q' * y) * y ᶜ) ≡⟨ rank-*-commute (x - q * y) (y ᶜ) ⟩ rank (x - q' * y) * rank (y ᶜ) ∎ where open ≡-Reasoning step : r' ≡ (x - q' * y) * y ᶜ step = begin r' ≡⟨ solve 2 (λ r x → r := r :+ x :- x) refl r' (q' * (rank y +0i)) ⟩ r' + q' * (rank y +0i) - q' * (rank y +0i) ≡⟨ cong (_- q' * (rank y +0i)) (sym eq') ⟩ x * y ᶜ - q' * (rank y +0i) ≡⟨ cong (λ z → x * y ᶜ - q' * z) (sym $ y*yᶜ=rank {y}) ⟩ x * y ᶜ - q' * (y * y ᶜ) ≡⟨ solve 4 (\ x yc q y -> x :* yc :- q :* ( y :* yc) := (x :- q :* y) :* yc) refl x (y ᶜ) q' y ⟩ (x - q' * y) * y ᶜ ∎ where open GS.+-*-Solver open ≡-Reasoning -- (le') & (eqr) ⇒ rank (x - q' * y) < rank y since rank y ᶜ ≠ 0. claim : rank (x - q' * y) < rank y claim = NatP.*-cancelʳ-< {rank (y ᶜ)} (rank (x - q * y)) (rank y) eqr' where eqr' : rank (x - q' * y) * rank (y ᶜ) < rank y * rank (y ᶜ) eqr' = begin-strict rank (x - q' * y) * rank (y ᶜ) ≡⟨ sym eqr ⟩ rank r' <⟨ le' ⟩ rank (rank y +0i) ≡⟨ cong rank (sym $ y*yᶜ=rank {y}) ⟩ rank (y * y ᶜ) ≡⟨ rank-*-commute y (y ᶜ) ⟩ rank y * rank (y ᶜ) ∎ where open GS.+-*-Solver open NatP.≤-Reasoning -- ---------------------------------------------------------------------- -- 𝔾 is an Euclidean Domain. import EuclideanDomain open EuclideanDomain.Structures (_≡_ {A = 𝔾}) using (IsEuclideanDomain) open EuclideanDomain.Bundles using (EuclideanDomainBundle) +-*-isEuclideanDomain : IsEuclideanDomain _+_ _*_ -_ 0𝔾 1𝔾 +-*-isEuclideanDomain = record { isCommutativeRing = +-*-isCommutativeRing ; *-alc = *-alc-𝔾 ; div = div ; mod = mod ; rank = rank ; euc-eq = euc-eq ; euc-rank = euc-rank } -- Bundle. +-*-euclideanDomain : EuclideanDomainBundle _ _ +-*-euclideanDomain = record { isEuclideanDomain = +-*-isEuclideanDomain' } -- ---------------------------------------------------------------------- -- Making 𝔾 an DivMod instance, overloading div and mod. -- Translation between two nonzeros. nz𝔾 : ∀ (x : 𝔾) -> .{{NonZero x}} -> ¬ x ≡ 0# nz𝔾 (+_ zero + +[1+ n ] i) {{n0}} i0 with i0 ... | () instance g-divmod : DivMod 𝔾 DivMod.NZT g-divmod = NZT𝔾 (g-divmod DivMod./ n) d = div n d (nz𝔾 d) (g-divmod DivMod.% n) d = mod n d (nz𝔾 d)
test.asm
Nibble-Knowledge/label-replacer
0
9527
INF 19 NOP *CHIP_SELECT HLT test: .data 2
programs/oeis/171/A171588.asm
karttu/loda
0
174239
<gh_stars>0 ; A171588: The Pell word: Fixed point of the morphism 0->001, 1->0. ; 0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0 mov $1,6 mov $2,1 add $2,$0 cal $2,188295 ; [nr]-[nr-r], where r=1/sqrt(2), [ ]=floor. sub $1,$2 mul $1,2 div $1,12
programs/oeis/261/A261676.asm
karttu/loda
1
160122
<gh_stars>1-10 ; A261676: Numbers which when represented as a sum of palindromes using the greedy algorithm require more than 3 palindromes. ; 1022,1033,1044,1055,1066,1077,1088,1099,1132,1143,1154,1165,1176,1187,1198,1209,1242,1253,1264,1275,1286,1297,1308,1319,1352,1363,1374,1385,1396,1407,1418,1429,1462,1473,1484,1495,1506,1517,1528,1539,1572,1583,1594 mov $1,$0 div $0,8 mul $0,2 add $1,$0 mul $1,11 add $1,1022
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1312.asm
ljhsiun2/medusa
9
166578
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1312.asm .global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x133fd, %rsi lea addresses_WT_ht+0xe265, %rdi nop nop nop add %r15, %r15 mov $30, %rcx rep movsq nop nop and %rbx, %rbx lea addresses_A_ht+0x28b0, %rdx nop nop nop cmp %r13, %r13 movups (%rdx), %xmm2 vpextrq $1, %xmm2, %rsi nop nop nop nop add %rdi, %rdi lea addresses_D_ht+0x1859b, %rdi nop sub $14784, %r15 mov $0x6162636465666768, %rdx movq %rdx, %xmm3 movups %xmm3, (%rdi) nop nop xor $27604, %rdi lea addresses_A_ht+0x1038d, %r15 nop nop nop nop and %r13, %r13 mov (%r15), %rdx nop nop xor $29838, %rbx lea addresses_UC_ht+0x16bd, %rsi lea addresses_WC_ht+0x1ad15, %rdi clflush (%rsi) nop nop nop nop nop add $28592, %r9 mov $49, %rcx rep movsb nop nop nop nop nop and $65250, %r15 lea addresses_WT_ht+0x162bd, %rsi lea addresses_UC_ht+0x6ebd, %rdi nop nop nop nop nop dec %rdx mov $11, %rcx rep movsw nop nop nop and %rsi, %rsi lea addresses_A_ht+0x17ebd, %rsi lea addresses_normal_ht+0x18405, %rdi and %r15, %r15 mov $48, %rcx rep movsw nop cmp %rcx, %rcx lea addresses_WC_ht+0x1790d, %rbx nop nop nop nop nop sub $21421, %r9 movl $0x61626364, (%rbx) nop nop nop nop nop sub %r9, %r9 lea addresses_normal_ht+0x118bd, %rdx nop nop nop nop nop sub %r9, %r9 mov $0x6162636465666768, %r15 movq %r15, %xmm1 vmovups %ymm1, (%rdx) nop nop nop nop add $38969, %r13 lea addresses_UC_ht+0xfabd, %rdx nop nop nop and %r15, %r15 movw $0x6162, (%rdx) nop sub $40321, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %rax push %rbx push %rcx push %rsi // Faulty Load lea addresses_A+0xdebd, %rsi nop nop nop inc %rbx mov (%rsi), %cx lea oracles, %rsi and $0xff, %rcx shlq $12, %rcx mov (%rsi,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %rax ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
runtime/ravenscar-sfp-stm32f427/math/a-nlelfu.ads
TUM-EI-RCS/StratoX
12
27259
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- ADA.NUMERICS.LONG_ELEMENTARY_FUNCTIONS -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2014, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- @llrset a-nlelfu.ads -- Long_Elementary_Functions -- ========================= -- -- This is the Ada Cert Math specific version of a-nlelfu.ads. with System.Generic_C_Math_Interface; with System.Libm_Double; package Ada.Numerics.Long_Elementary_Functions is new System.Generic_C_Math_Interface (Float_Type => Long_Float, C_Sqrt => System.Libm_Double.Sqrt, C_Log => System.Libm_Double.Log, C_Exp => System.Libm_Double.Exp, C_Pow => System.Libm_Double.Pow, C_Sin => System.Libm_Double.Sin, C_Cos => System.Libm_Double.Cos, C_Tan => System.Libm_Double.Tan, C_Asin => System.Libm_Double.Asin, C_Acos => System.Libm_Double.Acos, C_Atan2 => System.Libm_Double.Atan2, C_Sinh => System.Libm_Double.Sinh, C_Cosh => System.Libm_Double.Cosh, C_Tanh => System.Libm_Double.Tanh, C_Asinh => System.Libm_Double.Asinh, C_Acosh => System.Libm_Double.Acosh, C_Atanh => System.Libm_Double.Atanh); pragma Pure (Long_Elementary_Functions);
Cubical/Algebra/Semigroup/Base.agda
Edlyr/cubical
0
17467
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.Semigroup.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Foundations.Transport open import Cubical.Foundations.SIP open import Cubical.Data.Sigma open import Cubical.Reflection.StrictEquiv open import Cubical.Structures.Axioms open import Cubical.Structures.Auto open import Cubical.Structures.Record open Iso private variable ℓ : Level -- Semigroups as a record, inspired by the Agda standard library: -- -- https://github.com/agda/agda-stdlib/blob/master/src/Algebra/Bundles.agda#L48 -- https://github.com/agda/agda-stdlib/blob/master/src/Algebra/Structures.agda#L50 -- -- Note that as we are using Path for all equations the IsMagma record -- would only contain isSet A if we had it. record IsSemigroup {A : Type ℓ} (_·_ : A → A → A) : Type ℓ where constructor issemigroup field is-set : isSet A assoc : (x y z : A) → x · (y · z) ≡ (x · y) · z record SemigroupStr (A : Type ℓ) : Type (ℓ-suc ℓ) where constructor semigroupstr field _·_ : A → A → A isSemigroup : IsSemigroup _·_ infixl 7 _·_ open IsSemigroup isSemigroup public Semigroup : Type (ℓ-suc ℓ) Semigroup = TypeWithStr _ SemigroupStr semigroup : (A : Type ℓ) (_·_ : A → A → A) (h : IsSemigroup _·_) → Semigroup semigroup A _·_ h = A , semigroupstr _·_ h record SemigroupEquiv (M N : Semigroup {ℓ}) (e : ⟨ M ⟩ ≃ ⟨ N ⟩) : Type ℓ where constructor semigroupequiv -- Shorter qualified names private module M = SemigroupStr (snd M) module N = SemigroupStr (snd N) field isHom : (x y : ⟨ M ⟩) → equivFun e (x M.· y) ≡ equivFun e x N.· equivFun e y open SemigroupStr open IsSemigroup open SemigroupEquiv -- Develop some theory about Semigroups using various general results -- that are stated using Σ-types. For this we define Semigroup as a -- nested Σ-type, prove that it's equivalent to the above record -- definition and then transport results along this equivalence. module SemigroupΣTheory {ℓ} where RawSemigroupStructure : Type ℓ → Type ℓ RawSemigroupStructure X = X → X → X RawSemigroupEquivStr = AutoEquivStr RawSemigroupStructure rawSemigroupUnivalentStr : UnivalentStr _ RawSemigroupEquivStr rawSemigroupUnivalentStr = autoUnivalentStr RawSemigroupStructure SemigroupAxioms : (A : Type ℓ) → RawSemigroupStructure A → Type ℓ SemigroupAxioms A _·_ = isSet A × ((x y z : A) → x · (y · z) ≡ (x · y) · z) SemigroupStructure : Type ℓ → Type ℓ SemigroupStructure = AxiomsStructure RawSemigroupStructure SemigroupAxioms SemigroupΣ : Type (ℓ-suc ℓ) SemigroupΣ = TypeWithStr ℓ SemigroupStructure isPropSemigroupAxioms : (A : Type ℓ) (_·_ : RawSemigroupStructure A) → isProp (SemigroupAxioms A _·_) isPropSemigroupAxioms _ _ = isPropΣ isPropIsSet λ isSetA → isPropΠ3 λ _ _ _ → isSetA _ _ SemigroupEquivStr : StrEquiv SemigroupStructure ℓ SemigroupEquivStr = AxiomsEquivStr RawSemigroupEquivStr SemigroupAxioms SemigroupAxiomsIsoIsSemigroup : {A : Type ℓ} (_·_ : RawSemigroupStructure A) → Iso (SemigroupAxioms A _·_) (IsSemigroup _·_) fun (SemigroupAxiomsIsoIsSemigroup s) (x , y) = issemigroup x y inv (SemigroupAxiomsIsoIsSemigroup s) M = is-set M , assoc M rightInv (SemigroupAxiomsIsoIsSemigroup s) _ = refl leftInv (SemigroupAxiomsIsoIsSemigroup s) _ = refl SemigroupAxioms≡IsSemigroup : {A : Type ℓ} (_·_ : RawSemigroupStructure A) → SemigroupAxioms _ _·_ ≡ IsSemigroup _·_ SemigroupAxioms≡IsSemigroup s = isoToPath (SemigroupAxiomsIsoIsSemigroup s) Semigroup→SemigroupΣ : Semigroup → SemigroupΣ Semigroup→SemigroupΣ (A , semigroupstr _·_ isSemigroup) = A , _·_ , SemigroupAxiomsIsoIsSemigroup _ .inv isSemigroup SemigroupΣ→Semigroup : SemigroupΣ → Semigroup SemigroupΣ→Semigroup (A , _·_ , isSemigroupΣ) = semigroup A _·_ (SemigroupAxiomsIsoIsSemigroup _ .fun isSemigroupΣ) SemigroupIsoSemigroupΣ : Iso Semigroup SemigroupΣ SemigroupIsoSemigroupΣ = iso Semigroup→SemigroupΣ SemigroupΣ→Semigroup (λ _ → refl) (λ _ → refl) semigroupUnivalentStr : UnivalentStr SemigroupStructure SemigroupEquivStr semigroupUnivalentStr = axiomsUnivalentStr _ isPropSemigroupAxioms rawSemigroupUnivalentStr SemigroupΣPath : (M N : SemigroupΣ) → (M ≃[ SemigroupEquivStr ] N) ≃ (M ≡ N) SemigroupΣPath = SIP semigroupUnivalentStr SemigroupEquivΣ : (M N : Semigroup) → Type ℓ SemigroupEquivΣ M N = Semigroup→SemigroupΣ M ≃[ SemigroupEquivStr ] Semigroup→SemigroupΣ N SemigroupIsoΣPath : {M N : Semigroup} → Iso (Σ[ e ∈ ⟨ M ⟩ ≃ ⟨ N ⟩ ] SemigroupEquiv M N e) (SemigroupEquivΣ M N) fun SemigroupIsoΣPath (e , x) = e , isHom x inv SemigroupIsoΣPath (e , h) = e , semigroupequiv h rightInv SemigroupIsoΣPath _ = refl leftInv SemigroupIsoΣPath _ = refl SemigroupPath : (M N : Semigroup) → (Σ[ e ∈ ⟨ M ⟩ ≃ ⟨ N ⟩ ] SemigroupEquiv M N e) ≃ (M ≡ N) SemigroupPath M N = Σ[ e ∈ ⟨ M ⟩ ≃ ⟨ N ⟩ ] SemigroupEquiv M N e ≃⟨ strictIsoToEquiv SemigroupIsoΣPath ⟩ SemigroupEquivΣ M N ≃⟨ SemigroupΣPath _ _ ⟩ Semigroup→SemigroupΣ M ≡ Semigroup→SemigroupΣ N ≃⟨ isoToEquiv (invIso (congIso SemigroupIsoSemigroupΣ)) ⟩ M ≡ N ■ -- We now extract the important results from the above module isPropIsSemigroup : {A : Type ℓ} (_·_ : A → A → A) → isProp (IsSemigroup _·_) isPropIsSemigroup _·_ = subst isProp (SemigroupΣTheory.SemigroupAxioms≡IsSemigroup _·_) (SemigroupΣTheory.isPropSemigroupAxioms _ _·_) SemigroupPath : (M N : Semigroup {ℓ}) → (Σ[ e ∈ ⟨ M ⟩ ≃ ⟨ N ⟩ ] SemigroupEquiv M N e) ≃ (M ≡ N) SemigroupPath {ℓ = ℓ} = SIP (autoUnivalentRecord (autoRecordSpec (SemigroupStr {ℓ}) SemigroupEquiv (fields: data[ _·_ ∣ isHom ] prop[ isSemigroup ∣ (λ _ → isPropIsSemigroup _) ])) _ _)
Sources/Globe_3d/globe_3d-io.adb
ForYouEyesOnly/Space-Convoy
1
19452
<filename>Sources/Globe_3d/globe_3d-io.adb pragma Warnings (Off); pragma Style_Checks (Off); with Ada.Exceptions; use Ada.Exceptions; with Ada.Strings.Fixed; use Ada.Strings, Ada.Strings.Fixed; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; -- with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Unchecked_Conversion; with UnZip.Streams; with Float_portable_binary_transfer; pragma Elaborate_All (Float_portable_binary_transfer); with GLOBE_3D.Textures; with GL.IO; package body GLOBE_3D.IO is ------------------------------------------------ -- Common, internal definitions, routines, .. . -- ------------------------------------------------ stop_type : constant Character := Character'Val (26); -- Ctrl - Z to stop typing a binary file signature_obj : constant String := "GLOBE_3D 3D Binary Object File (" & object_extension & "). " & "Format version : 2 - Apr - 2008." & stop_type; signature_bsp : constant String := "GLOBE_3D Binary Space Partition File (" & BSP_extension & "). " & "Format version : 2 - Apr - 2008." & stop_type; subtype U8 is GL.Ubyte; type U16 is mod 2 ** 16; for U16'Size use 16; type U32 is mod 2 ** 32; for U32'Size use 32; type I16 is range -2 ** 15 .. 2 ** 15 - 1; for I16'Size use 16; type I32 is range -2 ** 31 .. 2 ** 31 - 1; for I32'Size use 32; f_scaling : constant := 2.0**24; package FFBT is new Float_portable_binary_transfer (GL.C_Float, I32, I16, True, f_scaling); use FFBT; d_scaling : constant := 2.0**27; -- 53/2=26.5 package DFBT is new Float_portable_binary_transfer (GL.Double, I32, I16, True, d_scaling); use DFBT; function Cvt is new Ada.Unchecked_Conversion (I16, U16); function Cvt is new Ada.Unchecked_Conversion (I32, U32); function Cvt is new Ada.Unchecked_Conversion (U16, I16); function Cvt is new Ada.Unchecked_Conversion (U32, I32); generic type Number is mod <>; procedure Read_Intel_x86_number (sb : in out GL.IO.Input_buffer; n : out Number); procedure Read_Intel_x86_number (sb : in out GL.IO.Input_buffer; n : out Number) is b : U8; m : Number := 1; bytes : constant Integer := Number'Size / 8; begin n := 0; for i in 1 .. bytes loop GL.IO.Get_Byte (sb, b); n := n + m * Number (b); m := m * 256; end loop; end Read_Intel_x86_number; procedure Read_Double ( sb : in out GL.IO.Input_buffer; n : out GL.Double ) is procedure Read_Intel is new Read_Intel_x86_number (U16); procedure Read_Intel is new Read_Intel_x86_number (U32); m1, m2 : U32; e : U16; begin Read_Intel (sb, m1); Read_Intel (sb, m2); Read_Intel (sb, e); Merge (Cvt (m1), Cvt (m2), Cvt (e), n); -- Double is stored in two parts due to the absence of -- 64 - bit integers on certain compilers (e.g. OA 8.2) end Read_Double; generic s : Ada.Streams.Stream_IO.Stream_Access; type Number is mod <>; procedure Write_Intel_x86_number (n : in Number); procedure Write_Intel_x86_number (n : in Number) is m : Number := n; bytes : constant Integer := Number'Size/8; begin for i in 1 .. bytes loop U8'Write (s, U8 (m mod 256)); m := m / 256; end loop; end Write_Intel_x86_number; procedure Write_Double ( s : Ada.Streams.Stream_IO.Stream_Access; n : in GL.Double) is procedure Write_Intel is new Write_Intel_x86_number (s, U16); procedure Write_Intel is new Write_Intel_x86_number (s, U32); m1, m2 : I32; e : I16; begin Split (n, m1, m2, e); -- Double is stored in two parts due to the absence of -- 64 - bit integers on certain compilers (e.g. OA 8.2) Write_Intel (Cvt (m1)); Write_Intel (Cvt (m2)); Write_Intel (Cvt (e)); end Write_Double; procedure Write_String ( s : in Ada.Streams.Stream_IO.Stream_Access; str : in String ) is tstr : constant String := Trim (str, Right); begin U8'Write (s, tstr'Length); String'Write (s, tstr); end Write_String; procedure Read_String ( sb : in out GL.IO.Input_buffer; str : out String ) is l8 : U8; l : Natural; begin GL.IO.Get_Byte (sb, l8); l := Natural (l8); if l > str'Length then raise Constraint_Error; end if; for i in str'First .. str'First + l - 1 loop GL.IO.Get_Byte (sb, l8); str (i) := Character'Val (l8); end loop; str (str'First + l .. str'Last) := (others => ' '); end Read_String; ------------------- -- Object_3D I/O -- ------------------- procedure Read ( s : in Ada.Streams.Stream_IO.Stream_Access; o : out p_Object_3D ) is buf : GL.IO.Input_buffer; procedure Read_Intel is new Read_Intel_x86_number (U16); procedure Read_Intel is new Read_Intel_x86_number (U32); procedure Read_Float (n : out GL.C_Float) is m : U32; e : U16; begin Read_Intel (buf, m); Read_Intel (buf, e); Merge (Cvt (m), Cvt (e), n); end Read_Float; procedure Read_Material_Float_vector (mfv : out GL.Material_Float_vector) is begin for i in mfv'Range loop Read_Float (mfv (i)); end loop; end Read_Material_Float_vector; procedure Read_Point_3D (p : out Point_3D) is begin for i in p'Range loop Read_Double (buf, p (i)); end loop; end Read_Point_3D; procedure Read_Map_idx_pair_array (m : out Map_idx_pair_array) is begin for i in m'Range loop Read_Double (buf, m (i).U); Read_Double (buf, m (i).V); end loop; end Read_Map_idx_pair_array; v8 : U8; v32, mp32, mf32 : U32; procedure Read_face (face : out Face_type; face_invar : in out Face_invariant_type) is begin -- 1/ Points for i in face.p'Range loop Read_Intel (buf, v32); face.p (i) := Integer (v32); end loop; -- 2/ Portal connection : object name is stored; -- access must be found later Read_String (buf, face_invar.connect_name); -- 3/ Skin GL.IO.Get_Byte (buf, v8); face.skin := Skin_Type'Val (v8); -- 4/ Mirror GL.IO.Get_Byte (buf, v8); face.mirror := Boolean'Val (v8); -- 5/ Alpha Read_Double (buf, face.alpha); -- 6/ Colour case face.skin is when colour_only | coloured_texture => Read_Double (buf, face.colour.red); Read_Double (buf, face.colour.green); Read_Double (buf, face.colour.blue); when others => null; end case; -- 7/ Material case face.skin is when material_only | material_texture => Read_Material_Float_vector (face.material.ambient); Read_Material_Float_vector (face.material.diffuse); Read_Material_Float_vector (face.material.specular); Read_Material_Float_vector (face.material.emission); Read_Float (face.material.shininess); when others => null; end case; -- 8/ Texture : texture name is stored; -- id must be found later Read_String (buf, face_invar.texture_name); GL.IO.Get_Byte (buf, v8); face.whole_texture := Boolean'Val (v8); GL.IO.Get_Byte (buf, v8); face.repeat_U := Positive'Val (v8); GL.IO.Get_Byte (buf, v8); face.repeat_V := Positive'Val (v8); if not face.whole_texture then Read_Map_idx_pair_array (face.texture_edge_map); end if; end Read_face; test_signature : String (signature_obj'Range); ID : Ident; begin String'Read (s, test_signature); if test_signature /= signature_obj then raise Bad_data_format; end if; GL.IO.Attach_Stream (b => buf, stm => s); Read_String (buf, ID); -- Read the object's dimensions, create object, read its contents Read_Intel (buf, mp32); Read_Intel (buf, mf32); o := new Object_3D (Integer (mp32), Integer (mf32)); o.ID := ID; for p in o.Point'Range loop Read_Point_3D (o.Point (p)); end loop; for f in o.face'Range loop Read_face (o.face (f), o.face_invariant (f)); end loop; Read_Point_3D (o.Centre); for i in Matrix_33'Range (1) loop for j in Matrix_33'Range (2) loop Read_Double (buf, o.rotation (i, j)); end loop; end loop; -- !! sub - objects : skipped !! -- Main operation done! end Read; procedure Write ( s : in Ada.Streams.Stream_IO.Stream_Access; o : in Object_3D ) is procedure Write_Intel is new Write_Intel_x86_number (s, U16); procedure Write_Intel is new Write_Intel_x86_number (s, U32); procedure Write_Float (n : in GL.C_Float) is m : I32; e : I16; begin Split (n, m, e); Write_Intel (Cvt (m)); Write_Intel (Cvt (e)); end Write_Float; procedure Write_Material_Float_vector (mfv : in GL.Material_Float_vector) is begin for i in mfv'Range loop Write_Float (mfv (i)); end loop; end Write_Material_Float_vector; procedure Write_Point_3D (p : in Point_3D) is begin for i in p'Range loop Write_Double (s, p (i)); end loop; end Write_Point_3D; procedure Write_Map_idx_pair_array (m : in Map_idx_pair_array) is begin for i in m'Range loop Write_Double (s, m (i).U); Write_Double (s, m (i).V); end loop; end Write_Map_idx_pair_array; procedure Write_face (face : Face_type; face_invar : Face_invariant_type) is begin -- 1/ Points for i in face.p'Range loop Write_Intel (U32 (face.p (i))); end loop; -- 2/ Portal connection : object name is stored if face.connecting = null then Write_String (s, empty); else Write_String (s, face.connecting.ID); end if; -- 3/ Skin U8'Write (s, Skin_Type'Pos (face.skin)); -- 4/ Mirror U8'Write (s, Boolean'Pos (face.mirror)); -- 5/ Alpha Write_Double (s, face.alpha); -- 6/ Colour case face.skin is when colour_only | coloured_texture => Write_Double (s, face.colour.red); Write_Double (s, face.colour.green); Write_Double (s, face.colour.blue); when others => null; end case; -- 7/ Material case face.skin is when material_only | material_texture => Write_Material_Float_vector (face.material.ambient); Write_Material_Float_vector (face.material.diffuse); Write_Material_Float_vector (face.material.specular); Write_Material_Float_vector (face.material.emission); Write_Float (face.material.shininess); when others => null; end case; -- 8/ Texture : texture name is stored if face.texture = null_image then -- Maybe a texture name has been given with Texture_name_hint, -- but was not yet attached to a GL ID number through Rebuild_Links Write_String (s, face_invar.texture_name); else -- Usual way : We can get the texture name associated to the -- GL ID number; name is stored by GLOBE_3D.Textures. Write_String (s, Textures.Texture_name (face.texture, False)); end if; U8'Write (s, Boolean'Pos (face.whole_texture)); U8'Write (s, Positive'Pos (face.repeat_U)); U8'Write (s, Positive'Pos (face.repeat_V)); if not face.whole_texture then Write_Map_idx_pair_array (face.texture_edge_map); end if; end Write_face; begin String'Write (s, signature_obj); Write_String (s, o.ID); Write_Intel (U32 (o.Max_points)); Write_Intel (U32 (o.Max_faces)); for p in o.Point'Range loop Write_Point_3D (o.Point (p)); end loop; for f in o.face'Range loop Write_face (o.face (f), o.face_invariant (f)); end loop; Write_Point_3D (o.Centre); for i in Matrix_33'Range (1) loop for j in Matrix_33'Range (2) loop Write_Double (s, o.rotation (i, j)); end loop; end loop; -- !! sub - objects : skipped !! -- Main operation done! end Write; generic type Anything is private; extension : String; animal : String; with procedure Read ( s : in Ada.Streams.Stream_IO.Stream_Access; a : out Anything ); procedure Load_generic (name_in_resource : String; a : out Anything); procedure Load_generic (name_in_resource : String; a : out Anything) is name_ext : constant String := name_in_resource & extension; procedure Try (zif : in out Zip.Zip_info; name : String) is use UnZip.Streams; fobj : Zipped_File_Type; begin -- Try Load_if_needed (zif, name); Open (fobj, zif, name_ext); Read (Stream (fobj), a); Close (fobj); exception when Zip.File_name_not_found => raise; when e:others => Raise_Exception ( Exception_Identity (e), Exception_Message (e) & " on " & animal & " : " & name_ext ); end Try; begin begin Try (zif_level, To_String (level_data_name)); exception when Zip.File_name_not_found | Zip.Zip_file_open_Error => -- Not found in level - specific pack Try (zif_global, To_String (global_data_name)); end; exception when Zip.File_name_not_found | Zip.Zip_file_open_Error => -- Never found - neither in level, nor in global pack Raise_Exception ( Missing_object'Identity, animal & " not found in any data resource pack : " & name_in_resource ); end Load_generic; procedure Load_Internal is new Load_generic ( Anything => p_Object_3D, extension => object_extension, animal => "object", Read => Read ); procedure Load (name_in_resource : String; o : out p_Object_3D) renames Load_Internal; procedure Load_file (file_name : String; o : out p_Object_3D) is use Ada.Streams.Stream_IO; f : File_Type; begin Open (f, in_file, file_name); Read (Stream (f), o); Close (f); end Load_file; procedure Save_file (file_name : String; o : in Object_3D'Class) is use Ada.Streams.Stream_IO; f : File_Type; begin Create (f, out_file, file_name); Write (Stream (f), Object_3D (o)); -- ^ endian - proof and floating - point hardware neutral; -- using stream attribute would be machine - specific. Close (f); end Save_file; procedure Save_file (o : in Object_3D'Class) is begin Save_file (Trim (o.ID, Right) & object_extension, o); end Save_file; ------------- -- BSP I/O -- ------------- -- Write a BSP tree to a stream procedure Write ( s : in Ada.Streams.Stream_IO.Stream_Access; tree : in BSP.p_BSP_node ) is procedure Write_Intel is new Write_Intel_x86_number (s, U32); use BSP; n : Natural := 0; procedure Numbering (node : p_BSP_node) is begin if node /= null then n := n + 1; node.node_id := n; Numbering (node.front_child); Numbering (node.back_child); end if; end Numbering; procedure Save_node (node : p_BSP_node) is begin if node /= null then Write_Intel (U32 (node.node_id)); if node.front_child = null then Write_Intel (U32' (0)); if node.front_leaf = null then Write_String (s, empty); else Write_String (s, node.front_leaf.ID); end if; else Write_Intel (U32 (node.front_child.node_id)); end if; if node.back_child = null then Write_Intel (U32' (0)); if node.back_leaf = null then Write_String (s, empty); else Write_String (s, node.back_leaf.ID); end if; else Write_Intel (U32 (node.back_child.node_id)); end if; for i in node.normal'Range loop Write_Double (s, node.normal (i)); end loop; Write_Double (s, node.distance); -- Save_node (node.front_child); Save_node (node.back_child); end if; end Save_node; begin Numbering (tree); -- fill the node_id's String'Write (s, signature_bsp); -- header Write_Intel (U32 (n)); -- give the number of nodes first Save_node (tree); end Write; -- Write a BSP tree to a file procedure Save_file (file_name : String; tree : in BSP.p_BSP_node) is use Ada.Streams.Stream_IO; f : File_Type; begin if Index (file_name, ".")=0 then Create (f, out_file, file_name & BSP_extension); else Create (f, out_file, file_name); end if; Write (Stream (f), tree); Close (f); end Save_file; procedure Load ( name_in_resource : in String; referred : in Map_of_Visuals; tree : out BSP.p_BSP_node ) is function Find_object (ID : Ident; tolerant : Boolean) return p_Object_3D is begin if ID = empty then return null; else return p_Object_3D ( Visuals_Mapping.Element ( Container => Visuals_Mapping.Map (referred), Key => Ada.Strings.Unbounded.To_Unbounded_String (ID) ) ); end if; exception when Constraint_Error => -- GNAT gives also the message: -- no element available because key not in map if tolerant then return null; else Raise_Exception ( Missing_object_in_BSP'Identity, "Object not found : [" & Trim (ID, Right) & ']' ); end if; end Find_object; procedure Read ( s : in Ada.Streams.Stream_IO.Stream_Access; tree : out BSP.p_BSP_node ) is use BSP; buf : GL.IO.Input_buffer; procedure Read_Intel is new Read_Intel_x86_number (U32); test_signature : String (signature_bsp'Range); n, j, k : U32; ID : Ident; tol : constant Boolean := False; begin String'Read (s, test_signature); if test_signature /= signature_bsp then raise Bad_data_format; end if; GL.IO.Attach_Stream (b => buf, stm => s); Read_Intel (buf, n); if n < 1 then tree := null; return; end if; declare -- We put all the new - born nodes into a farm with numbered boxes, -- because only the numbers are stored in the BSP file. -- Once the nodes are linked together through accesses (pointers), -- we can forget the farm and let the tree float .. . farm : array (0 .. n) of p_BSP_Node; begin farm (0) := null; for i in 1 .. n loop farm (i) := new BSP_Node; end loop; for i in 1 .. n loop Read_Intel (buf, j); -- node_id farm (j).node_id := Integer (j); Read_Intel (buf, k); farm (j).front_child := farm (k); if k = 0 then -- it is a front leaf - > associate object Read_String (buf, ID); farm (j).front_leaf := Find_object (ID, tol); end if; Read_Intel (buf, k); farm (j).back_child := farm (k); if k = 0 then -- it is a back leaf - > associate object Read_String (buf, ID); farm (j).back_leaf := Find_object (ID, tol); end if; -- The node's geometric information (a plane): for ii in farm (j).normal'Range loop Read_Double (buf, farm (j).normal (ii)); end loop; Read_Double (buf, farm (j).distance); end loop; tree := farm (1); end; end Read; procedure Load_Internal is new Load_generic ( Anything => BSP.p_BSP_node, extension => BSP_extension, animal => "BSP tree", Read => Read ); begin Load_Internal (name_in_resource, tree); end Load; end GLOBE_3D.IO;
libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_size.asm
meesokim/z88dk
0
8653
<gh_stars>0 ; size_t wv_stack_size(wv_stack_t *s) SECTION code_adt_wv_stack PUBLIC _wv_stack_size EXTERN _w_vector_size defc _wv_stack_size = _w_vector_size
source/amf/uml/amf-uml-pins.ads
svn2github/matreshka
24
17109
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- 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 pin is an object node for inputs and outputs to actions. -- -- A pin is a typed element and multiplicity element that provides values to -- actions and accept result values from them. ------------------------------------------------------------------------------ with AMF.UML.Multiplicity_Elements; with AMF.UML.Object_Nodes; package AMF.UML.Pins is pragma Preelaborate; type UML_Pin is limited interface and AMF.UML.Object_Nodes.UML_Object_Node and AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element; type UML_Pin_Access is access all UML_Pin'Class; for UML_Pin_Access'Storage_Size use 0; not overriding function Get_Is_Control (Self : not null access constant UML_Pin) return Boolean is abstract; -- Getter of Pin::isControl. -- -- Tells whether the pins provide data to the actions, or just controls -- when it executes it. not overriding procedure Set_Is_Control (Self : not null access UML_Pin; To : Boolean) is abstract; -- Setter of Pin::isControl. -- -- Tells whether the pins provide data to the actions, or just controls -- when it executes it. end AMF.UML.Pins;
vtl2/vtl2.asm
paulscottrobson/vtl-1802
0
98965
; *************************************************************************************************************** ; *************************************************************************************************************** ; ; File: vtl2.asm ; Purpose: Main Program. ; Author: <NAME> (<EMAIL>) ; Based on Frank McCoy's documentation for the 6800 version. ; Date: 14th January 2017. ; ; *************************************************************************************************************** ; *************************************************************************************************************** cpu 1802 ; obviously ! r0 = 0 ; not used (may be used in interrupt display) r1 = 1 ; not used (interrupt register) r2 = 2 ; stack pointer r3 = 3 ; general run P rExecutePC = 4 ; execute commands using R4. (param1 = code to execute) rCurrentLine = 5 ; current line pointer. rVarPtr = 6 ; always points to variables (64 variables 2 bytes each 6 bit ASCII) rExprPC = 7 ; used as P register in expression (mandated) rSrc = 8 ; source code. rSpecialHandler = 9 ; special variables handler. rParenthesisLevel = 10 ; bracket level (low byte) rSaveStack = 11 ; original value of stack pointer rUtilPC = 12 ; used as P register calling routines (not mandated) rSubPC = 13 ; used as P register to call routines within routines rParam1 = 14 ; subroutine parameters/return values. rParam2 = 15 return macro ; allows subroutine returns to disable/enable interrupts as you want. dis ; this program uses MARK-subroutines endm lrx macro r,n ; load 16 bit value into register macro ldi (n)/256 phi r ldi (n)&255 plo r endm ; *************************************************************************************************************** ; ; Start up 1802 ; ; *************************************************************************************************************** return ; enable/disable interrupts, switch to R3. db 000h lrx r3,Initialise ; jump to start. sep r3 ; *************************************************************************************************************** ; ; Initialisation ; ; *************************************************************************************************************** Initialise: lrx r2,0FFFFh ; find top of memory for stack & vartop. sex r2 ; this won't work with mirrored memory. findRAMTop: ldi 05Ah ; write this and re-read it. str r2 ldn r2 xri 05Ah ; check the write actually worked. bz foundRAMTop ghi r2 smi 1 phi r2 br findRAMTop foundRAMTop: ldi ('*' & 03Fh) * 2 + 1 ; set up rVarPtr.0 so it will point to MSB of RAMTop. plo rVarPtr ghi r2 ; use the top page of RAM for the variables + keyboard buffer phi rVarPtr smi 1 ; and the page below that is the stack. phi r2 str rVarPtr ; save in RAMTop MSB dec rVarPtr ldi 0 ; zero RAMTop LSB str rVarPtr ldi ('&' & 03Fh) * 2 ; set program end pointer (&) plo rVarPtr ldi (ProgramEnd & 255) str rVarPtr inc rVarPtr ldi (ProgramEnd / 256) str rVarPtr ldi (39 & 03Fh) * 2 ; initialise RNG plo rVarPtr str rVarPtr ; *************************************************************************************************************** ; ; OK Prompt (Come here after CMD exec, or program halted) also clears # ; ; *************************************************************************************************************** Prompt: lrx rUtilPC,__PrintString ; print Prompt lrx rParam2,__Prompt sep rUtilPC ldi ('#' & 03Fh) * 2 ; # = 0 plo rVarPtr ldi 0 str rVarPtr inc rVarPtr str rVarPtr lrx rSpecialHandler,SpecialHandler ; initialise 'special handler' vector. ; *************************************************************************************************************** ; ; Read line loop (come back here if modifying program) ; ; *************************************************************************************************************** EnterCommand: lrx rUtilPC,READLine ; input a new line. mark sep rUtilPC dec r2 lrx rUtilPC,ASCIIToInteger ; see if there is a number up front mark sep rUtilPC dec r2 ; if there is it will be in rParam2 and D # 0, rParam1 points to first non-space bz Execute ; if D = 0, it is text, so execute the command in rParam1. glo rParam2 ; if rParam2 is non zero, then go to edit bnz Edit ; if zero (e.g. typed line number zero) this is actually list. ghi rParam2 bnz Edit ; *************************************************************************************************************** ; ; Program Listing ; ; *************************************************************************************************************** ListProgram: lrx rSrc,ProgramStart ; point rSrc to the start of the program __ListLoop: lda rSrc ; read the offset link, which we don't use as a step bz Prompt ; if the link is zero, we have reached the end of the program. lda rSrc ; read line number into rParam1 plo rParam1 lda rSrc phi rParam1 ghi rVarPtr ; use keyboard buffer for conversion phi rParam2 ldi 0FFh plo rParam2 lrx rUtilPC,IntegerToASCII ; and convert it to ASCII mark sep rUtilPC dec r2 lrx rUtilPC,__PrintString ; print it. sep rUtilPC ldi ' ' ; print a space - note this takes advantage of __PrintString mark ; loading rSubPC with the XIOWriteCharacter() routine. sep rSubPC dec r2 glo rSrc ; put rSrc -> rParam2 and print that. plo rParam2 ghi rSrc phi rParam2 sep rUtilPC ldi 13 ; same trick to print CR as above mark sep rSubPC dec r2 __ListNext: ; advance pointer forward and do next. lda rSrc bnz __ListNext br __ListLoop ; *************************************************************************************************************** ; ; Edit Line rParam2, new text in rParam1 ; ; *************************************************************************************************************** Edit: ; edit line - number in rParam2, new text in rParam1. glo rParam2 ; save line number in rSrc plo rSrc ghi rParam2 phi rSrc lrx rUtilPC,LocateLine ; find the line. mark sep rUtilPC dec r2 bnf __DontDelete ; if DF = 0 not found line to delete. lrx rUtilPC,DeleteLine ; Delete line (address in rParam2) mark sep rUtilPC dec r2 __DontDelete: ldn rParam1 ; look at first not space character bz EnterCommand ; if zero, it's delete only. lrx rUtilPC,InsertLine ; Insert the new line mark sep rUtilPC dec r2 br EnterCommand ; *************************************************************************************************************** ; ; Execute line in rParam1 ; ; *************************************************************************************************************** Execute: ldn rParam1 ; read first character bz EnterCommand ; blank line, do nothing lrx rExecutePC,ExecuteCommand ; execute command in P1. sep rExecutePC ldi ('#' & 03Fh) * 2 ; look at '#' plo rVarPtr lda rVarPtr ; if non zero go to run code. bnz RunProgram ldn rVarPtr bz Prompt ; if zero, loop back, displaying "OK" ; *************************************************************************************************************** ; ; In Run Mode. ; ; *************************************************************************************************************** RunProgram: ldn rCurrentLine ; if current offset = 0 (end of program) then exit to prompt str r2 ; save at TOS. bz Prompt glo rCurrentLine ; copy current line into rParam1 plo rParam1 ghi rCurrentLine phi rParam1 glo rCurrentLine ; set currentPC to point to next line. add ; done here so the Execute Routine can update it if it wants. plo rCurrentLine ghi rCurrentLine adci 0 phi rCurrentLine ldi ('#' & 03Fh) * 2 ; set rVarPtr to point to current line number plo rVarPtr inc rParam1 ; skip over offset lda rParam1 ; read line# low str rVarPtr ; copy to # low lda rParam1 ; read line# high inc rVarPtr ; copy to # high str rVarPtr ; now points to first byte of command. sep rExecutePC ; and execute it. br RunProgram align 256 include expression.asm ; expression evaluator, all arithmetic, atoi/itoa align 256 include handler.asm ; special routine handler. include editing.asm ; line editing code __Prompt: ; VTL-2 Prompt. db "OK",13,0 align 256 include command.asm ; command execution code (slightly more than one page) include readline.asm ; line input routine. include virtualio.asm ; I/O routines that are hardware specific. ; *************************************************************************************************************** ; ; VTL-2 Code, test ; ; *************************************************************************************************************** vtl macro line,code ; creating VTL-2 code in line. startLine: db endLine-startLine ; +0 offset to next db line & 255,line / 256 ; +1,+2 line number db code,0 ; ASCIIZ line. endLine: endm ProgramStart: vtl 10,"A=0" vtl 20,"B=1" vtl 30,"?=A" vtl 40,"?=\" factorial is \";" vtl 50,"?=B" vtl 60,"?=\"\"" vtl 70,"A=A+1" vtl 80,"B=B*A" vtl 90,"#=A<9*30" ProgramEnd: db 0 ; ; Things that don't work: ; ; (1) You can't assign to & (set correctly by default) ; (2) You can't enter expressions in input, only numbers (using A=?) ; (3) The backspace is the backspace key and displays as ^H in the emulator and is chr(8) ; (4) Erroneous expressions may return different values compared to other versions. ; ; Code checked as far as "Hurkle" in the VTL-2 manual. ;
tools/scitools/conf/understand/ada/ada12/s-tasren.ads
brucegua/moocos
1
21694
<filename>tools/scitools/conf/understand/ada/ada12/s-tasren.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . R E N D E Z V O U S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNARL 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes. with Ada.Exceptions; with System.Tasking.Protected_Objects.Entries; package System.Tasking.Rendezvous is package STPE renames System.Tasking.Protected_Objects.Entries; procedure Task_Entry_Call (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address; Mode : Call_Modes; Rendezvous_Successful : out Boolean); -- General entry call used to implement ATC or conditional entry calls. -- Compiler interface only. Do not call from within the RTS. -- Acceptor is the ID of the acceptor task. -- E is the entry index requested. -- Uninterpreted_Data represents the parameters of the entry. It is -- constructed by the compiler for the caller and the callee; therefore, -- the run time never needs to decode this data. -- Mode can be either Asynchronous_Call (ATC) or Conditional_Call. -- Rendezvous_Successful is set to True on return if the call was serviced. procedure Timed_Task_Entry_Call (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address; Timeout : Duration; Mode : Delay_Modes; Rendezvous_Successful : out Boolean); -- Timed entry call without using ATC. -- Compiler interface only. Do not call from within the RTS. -- See Task_Entry_Call for details on Acceptor, E and Uninterpreted_Data. -- Timeout is the value of the time out. -- Mode determines whether the delay is relative or absolute. procedure Call_Simple (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address); -- Simple entry call. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- T.E1 (Params); -- -- expansion: -- declare -- P : parms := (parm1, parm2, parm3); -- X : Task_Entry_Index := 1; -- begin -- Call_Simple (t._task_id, X, P'Address); -- parm1 := P.param1; -- parm2 := P.param2; -- ... -- end; procedure Cancel_Task_Entry_Call (Cancelled : out Boolean); -- Cancel pending asynchronous task entry call. -- Compiler interface only. Do not call from within the RTS. -- See Exp_Ch9.Expand_N_Asynchronous_Select for code expansion. procedure Requeue_Task_Entry (Acceptor : Task_Id; E : Task_Entry_Index; With_Abort : Boolean); -- Requeue from a task entry to a task entry. -- Compiler interface only. Do not call from within the RTS. -- The code generation for task entry requeues is different from that for -- protected entry requeues. There is a "goto" that skips around the call -- to Complete_Rendezvous, so that Requeue_Task_Entry must also do the work -- of Complete_Rendezvous. The difference is that it does not report that -- the call's State = Done. -- -- source: -- accept e1 do -- ...A... -- requeue e2; -- ...B... -- end e1; -- -- expansion: -- A62b : address; -- L61b : label -- begin -- accept_call (1, A62b); -- ...A... -- requeue_task_entry (tTV!(t)._task_id, 2, false); -- goto L61b; -- ...B... -- complete_rendezvous; -- <<L61b>> -- exception -- when others => -- exceptional_complete_rendezvous (current_exception); -- end; procedure Requeue_Protected_To_Task_Entry (Object : STPE.Protection_Entries_Access; Acceptor : Task_Id; E : Task_Entry_Index; With_Abort : Boolean); -- Requeue from a protected entry to a task entry. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- entry e2 when b is -- begin -- b := false; -- ...A... -- requeue t.e2; -- end e2; -- -- expansion: -- procedure rPT__E14b (O : address; P : address; E : -- protected_entry_index) is -- type rTVP is access rTV; -- freeze rTVP [] -- _object : rTVP := rTVP!(O); -- begin -- declare -- rR : protection renames _object._object; -- vP : integer renames _object.v; -- bP : boolean renames _object.b; -- begin -- b := false; -- ...A... -- requeue_protected_to_task_entry (rR'unchecked_access, tTV!(t). -- _task_id, 2, false); -- return; -- end; -- complete_entry_body (_object._object'unchecked_access, objectF => -- 0); -- return; -- exception -- when others => -- abort_undefer.all; -- exceptional_complete_entry_body (_object._object' -- unchecked_access, current_exception, objectF => 0); -- return; -- end rPT__E14b; procedure Selective_Wait (Open_Accepts : Accept_List_Access; Select_Mode : Select_Modes; Uninterpreted_Data : out System.Address; Index : out Select_Index); -- Implement select statement. -- Compiler interface only. Do not call from within the RTS. -- See comments on Accept_Call. -- -- source: -- select accept e1 do -- ...A... -- end e1; -- ...B... -- or accept e2; -- ...C... -- end select; -- -- expansion: -- A32b : address; -- declare -- A37b : T36b; -- A37b (1) := (null_body => false, s => 1); -- A37b (2) := (null_body => true, s => 2); -- S0 : aliased T36b := accept_list'A37b; -- J1 : select_index := 0; -- procedure e1A is -- begin -- abort_undefer.all; -- ...A... -- <<L31b>> -- complete_rendezvous; -- exception -- when all others => -- exceptional_complete_rendezvous (get_gnat_exception); -- end e1A; -- begin -- selective_wait (S0'unchecked_access, simple_mode, A32b, J1); -- case J1 is -- when 0 => -- goto L3; -- when 1 => -- e1A; -- goto L1; -- when 2 => -- goto L2; -- when others => -- goto L3; -- end case; -- <<L1>> -- ...B... -- goto L3; -- <<L2>> -- ...C... -- goto L3; -- <<L3>> -- end; procedure Timed_Selective_Wait (Open_Accepts : Accept_List_Access; Select_Mode : Select_Modes; Uninterpreted_Data : out System.Address; Timeout : Duration; Mode : Delay_Modes; Index : out Select_Index); -- Selective wait with timeout without using ATC. -- Compiler interface only. Do not call from within the RTS. procedure Accept_Call (E : Task_Entry_Index; Uninterpreted_Data : out System.Address); -- Accept an entry call. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- accept E do ...A... end E; -- expansion: -- A27b : address; -- L26b : label -- begin -- accept_call (1, A27b); -- ...A... -- complete_rendezvous; -- <<L26b>> -- exception -- when all others => -- exceptional_complete_rendezvous (get_gnat_exception); -- end; -- -- The handler for Abort_Signal (*all* others) is to handle the case when -- the acceptor is aborted between Accept_Call and the corresponding -- Complete_Rendezvous call. We need to wake up the caller in this case. -- -- See also Selective_Wait procedure Accept_Trivial (E : Task_Entry_Index); -- Accept an entry call that has no parameters and no body. -- Compiler interface only. Do not call from within the RTS. -- This should only be called when there is no accept body, or the accept -- body is empty. -- -- source: -- accept E; -- expansion: -- accept_trivial (1); -- -- The compiler is also able to recognize the following and -- translate it the same way. -- -- accept E do null; end E; function Task_Count (E : Task_Entry_Index) return Natural; -- Return number of tasks waiting on the entry E (of current task) -- Compiler interface only. Do not call from within the RTS. function Callable (T : Task_Id) return Boolean; -- Return T'Callable -- Compiler interface. Do not call from within the RTS, except for body of -- Ada.Task_Identification. type Task_Entry_Nesting_Depth is new Task_Entry_Index range 0 .. Max_Task_Entry; function Task_Entry_Caller (D : Task_Entry_Nesting_Depth) return Task_Id; -- Return E'Caller. This will only work if called from within an -- accept statement that is handling E, as required by the LRM (C.7.1(14)). -- Compiler interface only. Do not call from within the RTS. procedure Complete_Rendezvous; -- Called by acceptor to wake up caller procedure Exceptional_Complete_Rendezvous (Ex : Ada.Exceptions.Exception_Id); pragma No_Return (Exceptional_Complete_Rendezvous); -- Called by acceptor to mark the end of the current rendezvous and -- propagate an exception to the caller. -- For internal use only: function Task_Do_Or_Queue (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) return Boolean; -- Call this only with abort deferred and holding no locks, except -- the global RTS lock when Single_Lock is True which must be owned. -- Returns False iff the call cannot be served or queued, as is the -- case if the caller is not callable; i.e., a False return value -- indicates that Tasking_Error should be raised. -- Either initiate the entry call, such that the accepting task is -- free to execute the rendezvous, queue the call on the acceptor's -- queue, or cancel the call. Conditional calls that cannot be -- accepted immediately are cancelled. end System.Tasking.Rendezvous;
LabExam-1.asm
IftekharMohammad/Computer-Organization-and-Architecture-Lab-Task
0
166833
<gh_stars>0 .MODEL SMALL .STACK 100H .DATA QUES DB "Input 4 characters: $" QUES2 DB "Input pattern character: $" STAR DB ? INITIAL1 DB ? INITIAL2 DB ? INITIAL3 DB ? INITIAL4 DB ? SUM1 DB 30H SUM3 DB 30H SUM5 DB 30H .CODE MAIN PROC MOV AX,@DATA MOV DS,AX MOV AH,9 LEA DX,QUES INT 21H MOV AH,1 INT 21H MOV INITIAL1,AL INT 21H MOV INITIAL2,AL INT 21H MOV INITIAL3,AL INT 21H MOV INITIAL4,AL MOV AH,2 MOV DL,0AH INT 21H MOV DL,0DH INT 21H MOV AH,9 LEA DX,QUES2 INT 21H MOV AH,1 INT 21H MOV STAR,AL MOV AH,2 MOV DL,0AH INT 21H MOV DL,0DH INT 21H LABEL_LOOP1: MOV DL,STAR INT 21H INC SUM1 CMP SUM1,35H JL LABEL_LOOP1 MOV DL,0AH INT 21H MOV DL,0DH INT 21H MOV DL,STAR INT 21H MOV DL,INITIAL1 INT 21H MOV DL,STAR INT 21H MOV DL,INITIAL2 INT 21H MOV DL,STAR INT 21H MOV DL,0AH INT 21H MOV DL,0DH INT 21H LABEL_LOOP3: MOV DL,STAR INT 21H INC SUM3 CMP SUM3,35H JL LABEL_LOOP3 MOV DL,0AH INT 21H MOV DL,0DH INT 21H MOV DL,STAR INT 21H MOV DL,INITIAL3 INT 21H MOV DL,STAR INT 21H MOV DL,INITIAL4 INT 21H MOV DL,STAR INT 21H MOV DL,0AH INT 21H MOV DL,0DH INT 21H LABEL_LOOP5: MOV DL,STAR INT 21H INC SUM5 CMP SUM5,35H JL LABEL_LOOP5 MOV DL,0AH INT 21H MOV DL,0DH INT 21H MOV AH,4CH ;RETURN TO OS INT 21H MAIN ENDP END MAIN
Gramaticas/Micro.g4
cor14095/proyecto1Compis
0
4580
<filename>Gramaticas/Micro.g4<gh_stars>0 grammar Micro; KEYWORD : 'PROGRAM' | 'BEGIN' | 'END' | 'FUNCTION' | 'READ' | 'WRITE' | 'IF' | 'ELSE' | 'FI' | 'FOR' | 'ROF' | 'CONTINUE' | 'BREAK' | 'RETURN' | 'INT' | 'VOID' | 'STRING' | 'FLOAT' ; IDENTIFIER : [_a-zA-Z][_a-zA-Z0-9]* ; INTLITERAL : [0-9]+ ; FLOATLITERAL : [0-9]* '.' [0-9]+ ; STRINGLITERAL : '"'(~'"')*'"' ; COMMENT : ('--'(~'\n')* '\n') -> skip; OPERATOR : ':=' | '+' | '-' | '*' | '/' | '=' | '!=' | '<' | '>' | '(' | ')' | ';' | ',' | '<=' | '>=' ; WS : ('\t' | ' ' | '\r'|'\n')+ -> skip; program: 'PROGRAM' id 'BEGIN' pgm_body 'END'; id: IDENTIFIER; pgm_body: decl func_declarations; decl: string_decl decl | var_decl decl | ; string_decl: 'STRING' id ':=' str ';'; str: STRINGLITERAL; var_decl: var_type id_list ';'; var_type: 'FLOAT'|'INT'; any_type: var_type | 'VOID'; id_list: id id_tail; id_tail: ',' id id_tail | ; param_decl_list: param_decl param_decl_tail | ; param_decl: var_type id; param_decl_tail: ',' param_decl param_decl_tail | ; func_declarations: func_decl func_declarations | ; func_decl: 'FUNCTION' any_type id '(' param_decl_list ')' 'BEGIN' func_body 'END'; func_body: decl stmt_list; stmt_list: stmt stmt_list | ; stmt: base_stmt | if_stmt | for_stmt; base_stmt: assign_stmt | read_stmt | write_stmt | return_stmt; assign_stmt: assign_expr ';'; assign_expr: id ':=' expr; read_stmt: 'READ' '(' id_list ')' ';'; write_stmt: 'WRITE' '(' id_list ')' ';'; return_stmt: 'RETURN' expr ';'; expr: expr_prefix factor; expr_prefix: expr_prefix factor addop | ; factor: factor_prefix postfix_expr; factor_prefix: factor_prefix postfix_expr mulop | ; postfix_expr: primary | call_expr; call_expr: id '(' expr_list ')'; expr_list: expr expr_list_tail | ; expr_list_tail: ',' expr expr_list_tail | ; primary: '(' expr ')' | id | INTLITERAL | FLOATLITERAL; addop: '+'|'-'; mulop: '*'|'/'; if_stmt: 'IF' '(' cond ')' decl stmt_list else_part 'FI'; else_part: 'ELSE' decl stmt_list | ; cond: expr compop expr; compop: '<'|'>'|'='|'!='|'<='|'>='; init_stmt: assign_expr | ; incr_stmt: assign_expr | ; for_stmt: 'FOR' '(' init_stmt ';' cond ';' incr_stmt ')' decl aug_stmt_list 'ROF'; aug_stmt_list: aug_stmt aug_stmt_list | ; aug_stmt: base_stmt | aug_if_stmt | for_stmt | 'CONTINUE'';' | 'BREAK'';' ; aug_if_stmt: 'IF''(' cond ')' decl aug_stmt_list aug_else_part 'FI'; aug_else_part: 'ELSE' decl aug_stmt_list | ;
programs/oeis/158/A158732.asm
neoneye/loda
22
94484
; A158732: a(n) = 68*n^2 + 1. ; 1,69,273,613,1089,1701,2449,3333,4353,5509,6801,8229,9793,11493,13329,15301,17409,19653,22033,24549,27201,29989,32913,35973,39169,42501,45969,49573,53313,57189,61201,65349,69633,74053,78609,83301,88129,93093,98193,103429,108801,114309,119953,125733,131649,137701,143889,150213,156673,163269,170001,176869,183873,191013,198289,205701,213249,220933,228753,236709,244801,253029,261393,269893,278529,287301,296209,305253,314433,323749,333201,342789,352513,362373,372369,382501,392769,403173,413713,424389,435201,446149,457233,468453,479809,491301,502929,514693,526593,538629,550801,563109,575553,588133,600849,613701,626689,639813,653073,666469 pow $0,2 mul $0,68 add $0,1
oeis/135/A135755.asm
neoneye/loda-programs
11
243469
; A135755: a(n) = Sum_{k=0..n} C(n,k)*3^[k*(k-1)/2]. ; Submitted by <NAME> ; 1,2,6,40,860,63000,14714728,10562062112,22960880409360,150300904214651680,2955814683617734854752,174481716707875308905153664,30905247968182392588500030233024,16423605022875515869684744918951064960,26184120631921143478178182301111552267630208,125237130297963767793259964894705352258099962636800,1797012303705373892554796550472761238345084352296879710464,77355431563734974947789260144566672283762380009894434606937891328,9989690488345921473416196682396801129077370100620188201250373409160955392 mov $1,1 mov $3,$0 mov $4,2 lpb $3 mul $1,$4 mul $1,$3 mul $4,3 add $5,2 div $1,$5 add $2,$1 sub $3,1 lpe mov $0,$2 add $0,1
alloy4fun_models/trainstlt/models/15/dPDF4LL7ZhYAbjNMY.als
Kaixi26/org.alloytools.alloy
0
3788
open main pred iddPDF4LL7ZhYAbjNMY_prop16 { always (all t:pos.Exit | (always some t.pos) since t.pos in Entry) } pred __repair { iddPDF4LL7ZhYAbjNMY_prop16 } check __repair { iddPDF4LL7ZhYAbjNMY_prop16 <=> prop16o }
data/pokemon/base_stats/blaziken.asm
AtmaBuster/pokeplat-gen2
6
15809
db 0 ; species ID placeholder db 80, 120, 70, 80, 110, 70 ; hp atk def spd sat sdf db FIRE, FIRE ; type db 45 ; catch rate db 209 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F12_5 ; gender ratio db 20 ; step cycles to hatch INCBIN "gfx/pokemon/blaziken/front.dimensions" db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups db 70 ; happiness ; tm/hm learnset tmhm FOCUS_PUNCH, ROAR, TOXIC, BULK_UP, HIDDEN_POWER, SUNNY_DAY, HYPER_BEAM, PROTECT, FRUSTRATION, SOLARBEAM, EARTHQUAKE, RETURN, DIG, BRICK_BREAK, DOUBLE_TEAM, FLAMETHROWER, FIRE_BLAST, ROCK_TOMB, AERIAL_ACE, FACADE, SECRET_POWER, REST, ATTRACT, OVERHEAT, FOCUS_BLAST, FLING, ENDURE, WILL_O_WISP, SHADOW_CLAW, GIGA_IMPACT, STONE_EDGE, SWORDS_DANCE, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, POISON_JAB, SWAGGER, SUBSTITUTE, CUT, STRENGTH, ROCK_SMASH, ROCK_CLIMB, BLAST_BURN, BOUNCE, FIRE_PUNCH, FURY_CUTTER, HEAT_WAVE, HELPING_HAND, KNOCK_OFF, LAST_RESORT, MUD_SLAP, SNORE, SUPERPOWER, SWIFT, THUNDERPUNCH, VACUUM_WAVE ; end
Task/Factors-of-a-Mersenne-number/Ada/factors-of-a-mersenne-number.ada
LaudateCorpus1/RosettaCodeData
1
22130
<reponame>LaudateCorpus1/RosettaCodeData with Ada.Text_IO; -- reuse Is_Prime from [[Primality by Trial Division]] with Is_Prime; procedure Mersenne is function Is_Set (Number : Natural; Bit : Positive) return Boolean is begin return Number / 2 ** (Bit - 1) mod 2 = 1; end Is_Set; function Get_Max_Bit (Number : Natural) return Natural is Test : Natural := 0; begin while 2 ** Test <= Number loop Test := Test + 1; end loop; return Test; end Get_Max_Bit; function Modular_Power (Base, Exponent, Modulus : Positive) return Natural is Maximum_Bit : constant Natural := Get_Max_Bit (Exponent); Square : Natural := 1; begin for Bit in reverse 1 .. Maximum_Bit loop Square := Square ** 2; if Is_Set (Exponent, Bit) then Square := Square * Base; end if; Square := Square mod Modulus; end loop; return Square; end Modular_Power; Not_A_Prime_Exponent : exception; function Get_Factor (Exponent : Positive) return Natural is Factor : Positive; begin if not Is_Prime (Exponent) then raise Not_A_Prime_Exponent; end if; for K in 1 .. 16384 / Exponent loop Factor := 2 * K * Exponent + 1; if Factor mod 8 = 1 or else Factor mod 8 = 7 then if Is_Prime (Factor) and then Modular_Power (2, Exponent, Factor) = 1 then return Factor; end if; end if; end loop; return 0; end Get_Factor; To_Test : constant Positive := 929; Factor : Natural; begin Ada.Text_IO.Put ("2 **" & Integer'Image (To_Test) & " - 1 "); begin Factor := Get_Factor (To_Test); if Factor = 0 then Ada.Text_IO.Put_Line ("is prime."); else Ada.Text_IO.Put_Line ("has factor" & Integer'Image (Factor)); end if; exception when Not_A_Prime_Exponent => Ada.Text_IO.Put_Line ("is not a Mersenne number"); end; end Mersenne;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1369.asm
ljhsiun2/medusa
9
245806
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1369.asm .global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1e37, %r14 nop nop nop nop inc %rax mov $0x6162636465666768, %r9 movq %r9, %xmm2 vmovups %ymm2, (%r14) sub %rbx, %rbx lea addresses_WC_ht+0x14eef, %rdx nop nop nop xor %r14, %r14 mov $0x6162636465666768, %r15 movq %r15, %xmm5 movups %xmm5, (%rdx) nop nop sub %r15, %r15 lea addresses_D_ht+0x1c107, %rdx nop nop add $57257, %r14 mov (%rdx), %r9 nop nop nop inc %r15 lea addresses_D_ht+0x18acf, %rax xor $59225, %rsi mov $0x6162636465666768, %r15 movq %r15, %xmm2 movups %xmm2, (%rax) nop nop nop nop nop add %rbx, %rbx lea addresses_D_ht+0x6b3f, %rsi nop nop dec %r15 movups (%rsi), %xmm2 vpextrq $1, %xmm2, %r9 nop nop nop nop cmp %rsi, %rsi lea addresses_A_ht+0x1716f, %rdx clflush (%rdx) nop dec %rbx mov (%rdx), %r9w nop nop nop nop inc %rax lea addresses_UC_ht+0x656f, %rdx nop nop nop nop nop add %rax, %rax mov (%rdx), %r9d xor %r15, %r15 lea addresses_WT_ht+0x712f, %r9 inc %rdx mov (%r9), %r15w nop dec %r15 lea addresses_D_ht+0x376f, %rsi lea addresses_UC_ht+0x11f61, %rdi nop nop nop xor $17654, %r14 mov $4, %rcx rep movsl nop and %rcx, %rcx lea addresses_UC_ht+0x94ab, %rbx nop nop nop nop sub %r15, %r15 mov $0x6162636465666768, %rdi movq %rdi, %xmm3 movups %xmm3, (%rbx) nop nop nop nop nop sub %r9, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi // Store lea addresses_normal+0x1256f, %r8 clflush (%r8) nop nop nop nop and $11735, %rax movb $0x51, (%r8) nop nop add $8664, %r9 // Store lea addresses_normal+0x726f, %r14 nop nop nop nop nop sub $9654, %r13 mov $0x5152535455565758, %r9 movq %r9, %xmm2 vmovups %ymm2, (%r14) nop nop cmp $33020, %rax // Store lea addresses_A+0x1292b, %r9 nop nop dec %r14 mov $0x5152535455565758, %r13 movq %r13, %xmm4 movups %xmm4, (%r9) nop nop xor %rax, %rax // REPMOV lea addresses_D+0xad6f, %rsi lea addresses_A+0x17967, %rdi nop nop add %r9, %r9 mov $119, %rcx rep movsl and %rax, %rax // Faulty Load lea addresses_A+0x556f, %r14 nop nop nop nop nop cmp $16096, %rsi mov (%r14), %r13w lea oracles, %rcx and $0xff, %r13 shlq $12, %r13 mov (%rcx,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_D'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
dos/mknode.asm
minblock/msdos
0
176641
<gh_stars>0 TITLE MKNODE - Node maker NAME MKNODE ; ; Microsoft Confidential ; Copyright (C) Microsoft Corporation 1991 ; All Rights Reserved. ; ;** MKNODE.ASM ; ; Low level routines for making a new local file system node ; and filling in an SFT from a directory entry ; ; BUILDDIR ; SETDOTENT ; MakeNode ; NEWENTRY ; FREEENT ; NEWDIR ; DOOPEN ; RENAME_MAKE ; CHECK_VIRT_OPEN ; ; Revision history: ; ; AN000 version 4.0 Jan. 1988 ; A004 PTM 3680 --- Make SFT NAME field offset same as 3.30 .xlist .xcref include version.inc include dosseg.inc include fastopen.inc include dossym.inc include sf.inc include dpb.inc include filemode.inc include devsym.inc .cref .list i_need EntFree,WORD i_need DirStart,WORD i_need LastEnt,WORD i_need ClusNum,WORD i_need CurBuf,DWORD i_need Attrib,BYTE i_need VolID,BYTE i_need Name1,BYTE i_need ThisDPB,DWORD i_need EntLast,WORD i_need Creating,BYTE i_need SecClusPos,BYTE i_need ClusFac,BYTE i_need NxtClusNum,WORD i_need DirSec,WORD i_need NoSetDir,BYTE i_need THISSFT,DWORD i_need SATTRIB,BYTE i_need ALLOWED,BYTE i_need FAILERR,BYTE i_need VIRTUAL_OPEN I_need FastOpen_Ext_info,BYTE ; DOS 3.3 I_need FastOpenFlg,BYTE ; DOS 3.3 I_need CPSWFLAG,BYTE ;FT. DOS 3.4 ;AN000; I_need EXTOPEN_ON,BYTE ;FT. DOS 3.4 ;AN000; I_need EXTOPEN_FLAG,WORD ;FT. DOS 3.4 ;AN000; I_need EXTOPEN_IO_MODE,WORD ;FT. DOS 3.4 ;AN000; I_need HIGH_SECTOR,WORD ;>32mb ;AN000; DOSCODE SEGMENT ASSUME SS:DOSDATA,CS:DOSCODE Break <BUILDDIR,NEWDIR -- ALLOCATE DIRECTORIES> ;---------------------------------------------------------------------------- ; ; Procedure Name : BUILDDIR,NEWDIR ; ; Inputs: ; ES:BP Points to DPB ; [THISSFT] Set if using NEWDIR entry point ; (used by ALLOCATE) ; [LASTENT] current last valid entry number in directory if no free ; entries ; [DIRSTART] Points to first cluster of dir (0 means root) ; Function: ; Grow directory if no free entries and not root ; Outputs: ; CARRY SET IF FAILURE ; ELSE ; AX entry number of new entry ; If a new dir [DIRSTART],[CLUSFAC],[CLUSNUM],[DIRSEC] set ; AX = first entry of new dir ; GETENT should be called to set [LASTENT] ; ;---------------------------------------------------------------------------- procedure BUILDDIR,NEAR DOSAssume <DS>,"BuildDir" MOV AX,[ENTFREE] CMP AX,-1 JZ CHECK_IF_ROOT CLC return CHECK_IF_ROOT: CMP [DIRSTART],0 JNZ NEWDIR STC return ; Can't grow root entry NEWDIR MOV BX,[DIRSTART] OR BX,BX JZ NULLDIR invoke GETEOF retc ; Screw up NULLDIR: MOV CX,1 invoke ALLOCATE retc MOV DX,[DIRSTART] OR DX,DX JNZ ADDINGDIR invoke SETDIRSRCH retc MOV [LASTENT],-1 JMP SHORT GOTDIRREC ADDINGDIR: PUSH BX MOV BX,[ClusNum] Invoke IsEof POP BX JB NOTFIRSTGROW ;;;; 10/17/86 update CLUSNUM in the fastopen cache MOV [CLUSNUM],BX PUSH CX PUSH AX PUSH BP MOV AH,1 ; CLUSNUM update MOV DL,ES:[BP.dpb_drive] ; drive # MOV CX,[DIRSTART] ; first cluster # MOV BP,BX ; CLUSNUM invoke FastOpen_Update POP BP POP AX POP CX ;;;; 10/17/86 update CLUSNUM in the fastopen cache NOTFIRSTGROW: MOV DX,BX XOR BL,BL invoke FIGREC GOTDIRREC: MOV CL,ES:[BP.dpb_cluster_mask] INC CL XOR CH,CH ZERODIR: PUSH CX MOV [ALLOWED],allowed_FAIL + allowed_RETRY MOV AL,0FFH invoke GETBUFFR JNC GET_SSIZE POP CX return GET_SSIZE: MOV CX,ES:[BP.dpb_sector_size] PUSH ES LES DI,[CURBUF] OR ES:[DI.buf_flags],buf_isDIR PUSH DI ADD DI,BUFINSIZ XOR AX,AX SHR CX,1 REP STOSW JNC EVENZ STOSB EVENZ: POP DI TESTB ES:[DI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; JNZ yesdirty ;LB. don't increment dirty count ;AN000; invoke INC_DIRTY_COUNT ;LB. ;AN000; OR ES:[DI.buf_flags],buf_dirty yesdirty: POP ES POP CX ; INC DX add dx, 1 adc [HIGH_SECTOR], 0 LOOP ZERODIR MOV AX,[LASTENT] INC AX CLC return EndProc BUILDDIR ;-------------------------------------------------------------------------- ; ; Procedure Name : SETDOTENT ; ; set up a . or .. directory entry for a directory. ; ; Inputs: ES:DI point to the beginning of a directory entry. ; AX contains ". " or ".." ; DX contains first cluster of entry ; ;---------------------------------------------------------------------------- procedure SETDOTENT,NEAR DOSAssume <DS>,"SetDotEnt" ; Fill in name field STOSW MOV CX,4 MOV AX," " REP STOSW STOSB ; Set up attribute MOV AL,attr_directory .errnz dir_attr-(dir_name+11) STOSB ; Initialize time and date of creation ADD DI,10 MOV SI,WORD PTR [THISSFT] MOV AX,[SI.sf_time] .errnz dir_time-(dir_attr+1+10) STOSW MOV AX,[SI.sf_date] .errnz dir_date-(dir_time+2) STOSW ; Set up first cluster field MOV AX,DX .errnz dir_first-(dir_date+2) STOSW ; 0 file size XOR AX,AX .errnz dir_size_l-(dir_first+2) STOSW STOSW .errnz (size dir_entry)-(dir_size_l+4) return EndProc SETDOTENT Break <MAKENODE -- CREATE A NEW NODE> ;--------------------------------------------------------------------------- ; ; Procedure Name : MakeNode ; ; Inputs: ; AL - attribute to create ; AH = 0 if it is ok to truncate a file already by this name ; AH != 0 if truncation not allowed (prexisting file is an error) ; (AH ignored on dirs and devices) ; ; NOTE: When making a DIR or volume ID, AH need not be set since ; a name already existant is ALWAYS an error in these cases. ; ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL ; terminated) ; [CURR_DIR_END] Points to end of Current dir part of string ; ( = -1 if current dir not involved, else ; Points to first char after last "/" of current dir part) ; [THISCDS] Points to CDS being used ; [THISSFT] Points to an empty SFT. EXCEPT sf_mode filled in. ; Function: ; Make a new node ; Outputs: ; Sets EXTERR_LOCUS = errLOC_Disk or errLOC_Unk via GetPathNoset ; CARRY SET IF ERROR ; AX = 1 A node by this name exists and is a directory ; AX = 2 A new node could not be created ; AX = 3 A node by this name exists and is a disk file ; (AH was NZ on input) ; AX = 4 Bad Path ; SI return from GetPath maintained ; AX = 5 Attribute mismatch ; AX = 6 Sharing Violation ; (INT 24 generated ALWAYS since create is always compat mode ; AX = 7 file not found for Extended Open (not exists and fails) ; ELSE ; AX = 0 Disk Node ; AX = 3 Device Node (error in some cases) ; [DIRSTART],[DIRSEC],[CLUSFAC],[CLUSNUM] set to directory ; containing new node. ; [CURBUF+2]:BX Points to entry ; [CURBUF+2]:SI Points to entry.dir_first ; [THISSFT] is filled in ; sf_mode = unchanged. ; Attribute byte in entry is input AL ; DS preserved, others destroyed ; ;------------------------------------------------------------------------- procedure MakeNode,NEAR DOSAssume <DS>,"MakeNode" MOV WORD PTR CREATING, DIRFREE*256 + 0ffh ; Creating, not DEL *.* PUSH AX ; Save AH value MOV NoSetDir,0 MOV SATTRIB,AL invoke GetPathNoSet MOV DL,CL ; Save CL info MOV CX,AX ; Device ID to CH POP AX ; Get back AH JNC make_exists ; File existed JNZ make_err_4 ; Path bad CMP DL,80H ; Check "CL" return from GETPATH JZ make_type ; Name simply not found, and no metas make_err_4: MOV AL,4 ; case 1 bad path make_err_ret: XOR AH,AH STC return entry RENAME_MAKE ; Used by DOS_RENAME to "copy" a node make_type: ;Extended Open hooks TESTB EXTOPEN_ON,ext_open_on ;FT. from extended open ;AN000; JZ make_type2 ;FT. no ;AN000; OR EXTOPEN_ON,ext_file_not_exists ;FT. set for extended open ;AN000; TESTB EXTOPEN_FLAG,0F0H ;FT. not exists and fails ;AN000; JNZ make_type2 ;FT. no ;AN000; STC ;FT. set carry ;AN000; MOV AX,7 ;FT. file not found ;AN000; return ;FT. ;AN000; ; Extended Open hooks make_type2: LES DI,[THISSFT] ; MOV ES:[DI.sf_mode],sharing_compat + open_for_both XOR AX,AX ; nothing exists Disk Node STC ; Not found JMP short make_new ; ; The node exists. It may be either a device, directory or file: ; Zero set => directory ; High bit of CH on => device ; else => file make_exists: JZ make_exists_dir MOV AL,3 ; file exists type 3 (error or device node) TESTB Attrib,<attr_volume_id+attr_directory> JNZ make_err_ret_5 ; Cannot already exist as Disk or Device Node ; if making DIR or Volume ID OR CH,CH JS make_share ; No further checks on attributes if device OR AH,AH JNZ make_err_ret ; truncating NOT OK (AL = 3) PUSH CX ; Save device ID MOV ES,WORD PTR [CURBUF+2] MOV CH,ES:[BX+dir_attr] ; Get file attributes test CH,attr_read_only JNZ make_err_ret_5P ; Cannot create on read only files invoke MatchAttributes POP CX ; Devid back in CH JNZ make_err_ret_5 ; Attributes not ok XOR AL,AL ; AL = 0, Disk Node make_share: XOR AH,AH PUSH AX ; Save Disk or Device node PUSH CX ; Save Device ID MOV AH,CH ; Device ID to AH CALL DOOPEN ; Fill in SFT for share check LES DI,[THISSFT] ; MOV ES:[DI.sf_mode],sharing_compat + open_for_both SAVE <SI,BX> ; Save CURBUF pointers invoke ShareEnter jnc MakeEndShare ; ; User failed request. ; RESTORE <BX,SI,CX,AX> Make_Share_ret: MOV AL,6 JMP make_err_ret make_err_ret_5P: POP CX ; Get back device ID make_err_ret_5: MOV AL,5 ; Attribute mismatch JMP make_err_ret make_exists_dir: MOV AL,1 ; exists as directory, always an error JMP make_err_ret make_save: PUSH AX ; Save whether Disk or File MOV AX,CX ; Device ID to AH CALL NewEntry POP AX ; 0 if Disk, 3 if File retnc MOV AL,2 ; create failed case 2 return make_new: call make_save retc ; case 2 fail test BYTE PTR Attrib,attr_directory retnz ; Don't "open" directories, so don't ; tell the sharer about them SAVE <AX,BX,SI> ; Save AL code invoke ShareEnter RESTORE <SI,BX,AX> retnc ; ; We get here by having the user FAIL a share problem. Typically a failure of ; this nature is an out-of-space or an internal error. We clean up as best as ; possible: delete the newly created directory entry and return share_error. ; PUSH AX LES DI,CurBuf MOV BYTE PTR ES:[BX],DIRFREE ; nuke newly created entry. TESTB ES:[DI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; invoke INC_DIRTY_COUNT ;LB. ;AN000; OR ES:[DI].buf_flags,buf_dirty ; flag buffer as dirty yesdirty2: LES BP,ThisDPB MOV AL,ES:[BP].DPB_Drive ; get drive for flush Invoke FlushBuf ; write out buffer. POP AX jmp make_Share_ret ; ; We have found an existing file. We have also entered it into the share set. ; At this point we need to call newentry to correctly address the problem of ; getting rid of old data (create an existing file) or creating a new ; directory entry (create a new file). Unfortunately, this operation may ; result in an INT 24 that the user doesn't return from, thus locking the file ; irretrievably into the share set. The correct solution is for us to LEAVE ; the share set now, do the operation and then reassert the share access. ; ; We are allowed to do this! There is no window! After all, we are in ; critDisk here and for someone else to get in, they must enter critDisk also. ; MakeEndShare: LES DI,ThisSFT ; grab SFT XOR AX,AX EnterCrit critSFT XCHG AX,ES:[DI].sf_ref_count SAVE <AX,DI,ES> PUSHF invoke ShareEnd ; remove sharing POPF RESTORE <ES,DI,ES:[DI].sf_ref_count> LeaveCrit critSFT RESTORE <BX,SI,CX,AX> CALL make_save ; ; If the user failed, we do not reenter into the sharing set. ; retc ; bye if error SAVE <AX,BX,SI> PUSHF invoke ShareEnter POPF RESTORE <SI,BX,AX> ; ; If Share_check fails, then we have an internal ERROR!!!!! ; return EndProc MakeNode,NoCheck ;--------------------------------------------------------------------------- ; ; Procedure Name : NEWENTRY ; ; Inputs: ; [THISSFT] set ; [THISDPB] set ; [LASTENT] current last valid entry number in directory if no free ; entries ; [VOLID] set if a volume ID was found during search ; Attrib Contains attributes for new file ; [DIRSTART] Points to first cluster of dir (0 means root) ; CARRY FLAG INDICATES STATUS OF SEARCH FOR FILE ; NC means file existed (device) ; C means file did not exist ; AH = Device ID byte ; If FILE ; [CURBUF+2]:BX points to start of directory entry ; [CURBUF+2]:SI points to dir_first of directory entry ; If device ; DS:BX points to start of "fake" directory entry ; DS:SI points to dir_first of "fake" directory entry ; (has DWORD pointer to device header) ; Function: ; Make a new directory entry ; If an old one existed it is truncated first ; Outputs: ; Carry set if error ; Can't grow dir, atts didn't match, attempt to make 2nd ; vol ID, user FAILed to I 24 ; else ; outputs of DOOPEN ; DS, BX, SI preserved (meaning on SI BX, not value), others destroyed ; ;---------------------------------------------------------------------------- procedure NEWENTRY,NEAR DOSAssume <DS>,"NewEntry" LES BP,[THISDPB] ASSUME ES:NOTHING JNC EXISTENT CMP [FAILERR],0 STC retnz ; User FAILed, node might exist CALL BUILDDIR ; Try to build dir retc ; Failed invoke GETENT ; Point at that free entry retc ; Failed JMP SHORT FREESPOT ERRRET3: STC return EXISTENT: DOSAssume <DS>,"ExistEnt" OR AH,AH ; Check if file is I/O device JNS NOT_DEV1 JMP DOOPEN ; If so, proceed with open NOT_DEV1: invoke FREEENT ; Free cluster chain retc ; Failed FREESPOT: test BYTE PTR Attrib,attr_volume_id JZ NOTVOLID CMP BYTE PTR [VOLID],0 JNZ ERRRET3 ; Can't create a second volume ID NOTVOLID: MOV ES,WORD PTR [CURBUF+2] MOV DI,BX ;hkn; NAME1 is in DOADATA MOV SI,OFFSET DOSDATA:NAME1 MOV CX,5 REP MOVSW MOVSB ; Move name into dir entry MOV AL,Attrib .errnz dir_attr-(dir_name+11) STOSB ; Attributes ;; File Tagging for Create DOS 4.00 MOV CL,5 ;FT. assume normal FBUGBUG ;AN000; ;; File Tagging for Create DOS 4.00 XOR AX,AX REP STOSW ; Zero pad invoke DATE16 XCHG AX,DX .errnz dir_time-(dir_attr+1+2*5) STOSW ; dir_time XCHG AX,DX .errnz dir_date-(dir_time+2) STOSW ; dir_date XOR AX,AX PUSH DI ; Correct SI input value (recomputed for new buffer) .errnz dir_first-(dir_date+2) STOSW ; Zero dir_first and size .errnz dir_size_l-(dir_first+2) STOSW STOSW updnxt: .errnz (size dir_entry)-(dir_size_l+4) MOV SI,WORD PTR [CURBUF] TESTB ES:[SI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; JNZ yesdirty3 ;LB. don't increment dirty count ;AN000; invoke INC_DIRTY_COUNT ;LB. ;AN000; OR ES:[SI.buf_flags],buf_dirty yesdirty3: LES BP,[THISDPB] MOV AL,ES:[BP.dpb_drive] ; Sets AH value again (in AL) PUSH AX PUSH BX ; If we have a file, we need to increment the open ref. count so that ; we have some protection against invalid media changes if an Int 24 ; error occurs. ; Do nothing for a device. SAVE <ES,DI> LES DI,[THISSFT] TESTB es:[di].SF_FLAGS,devid_device jnz GotADevice SAVE <DS,BX> LDS BX,[THISDPB] MOV word ptr ES:[DI.sf_devptr],BX MOV BX,DS MOV word ptr ES:[DI.sf_devptr+2],BX RESTORE <BX,DS> ; need to use DS for segment later on invoke Dev_Open_SFT ; increment ref. count mov [VIRTUAL_OPEN],1; set flag GotADevice: RESTORE <DI,ES> invoke FLUSHBUF Call CHECK_VIRT_OPEN ; decrement ref. count ;AN000; POP BX POP AX POP SI ; Get SI input back MOV AH,AL ; Get I/O driver number back retc ; Failed ;NOTE FALL THROUGH ; Inputs: ; [THISDPB] points to DPB if file ; [THISSFT] points to SFT being used ; AH = Device ID byte ; If FILE ; [CURBUF+2]:BX points to start of directory entry ; [CURBUF+2]:SI points to dir_first of directory entry ; If device ; DS:BX points to start of "fake" directory entry ; DS:SI points to dir_first of "fake" directory entry ; (has DWORD pointer to device header) ; Function: ; Fill in SFT from dir entry ; Outputs: ; CARRY CLEAR ; sf_ref_count and sf_mode fields not altered ; sf_flags high byte = 0 ; sf_flags low byte = AH except ; sf_flags Bit 6 set (not dirty or not EOF) ; sf_attr sf_date sf_time sf_name set from entry ; sf_position = 0 ; If device ; sf_devptr = dword at dir_first (pointer to device header) ; sf_size = 0 ; If file ; sf_firclus sf_size set from entry ; sf_devptr = [THISDPB] ; sf_cluspos = 0 ; sf_lstclus = sf_firclus ; sf_dirsec sf_dirpos set ; DS,SI,BX preserved, others destroyed entry DOOPEN ASSUME ES:NOTHING DOSAssume <DS>,"DoOpen" ; Generate and store attribute MOV DH,AH ; AH to different place LES DI,[THISSFT] ADD DI,sf_attr ; Skip ref_count and mode fields XOR AL,AL ; Assume it's a device, devices have an ; attribute of 0 (for R/O testing etc). OR DH,DH ; See if our assumption good. JS DEV_SFT1 ; If device DS=DOSGROUP MOV DS,WORD PTR [CURBUF+2] ASSUME DS:NOTHING MOV AL,[BX.dir_attr] ; If file, get attrib from dir entry DEV_SFT1: STOSB ; sf_attr, ES:DI -> sf_flags ; Generate and store flags word XOR AX,AX MOV AL,DH OR AL,devid_file_clean STOSW ; sf_flags, ES:DI -> sf_devptr ; Generate and store device pointer PUSH DS LDS AX,DWORD PTR [BX.dir_first] ; Assume device OR DH,DH JS DEV_SFT2 ;hkn; SS override LDS AX,[THISDPB] ; Was file DEV_SFT2: STOSW ; store offset MOV AX,DS POP DS STOSW ; store segment ; ES:DI -> sf_firclus ; Generate pointer to, generate and store first cluster (irrelevant for ; devices) PUSH SI ; Save pointer to dir_first MOVSW ; dir_first -> sf_firclus ; DS:SI -> dir_size_l, ES:DI -> sf_time ; Copy time/date of last modification SUB SI,dir_size_l - dir_time ; DS:SI->dir_time MOVSW ; dir_time -> sf_time ; DS:SI -> dir_date, ES:DI -> sf_date MOVSW ; dir_date -> sf_date ; DS:SI -> dir_first, ES:DI -> sf_size ; Generate and store file size (0 for devices) LODSW ; skip dir_first, DS:SI -> dir_size_l LODSW ; dir_size_l in AX , DS:SI -> dir_size_h MOV CX,AX ; dir_size_l in CX LODSW ; dir_size_h (size AX:CX), DS:SI -> ???? OR DH,DH JNS FILE_SFT1 XOR AX,AX MOV CX,AX ; Devices are open ended FILE_SFT1: XCHG AX,CX STOSW ; Low word of sf_size XCHG AX,CX STOSW ; High word of sf_size ; ES:DI -> sf_position ; ; Initialize position to 0 ; XOR AX,AX STOSW STOSW ; sf_position ; ES:DI -> sf_cluspos ; ; Generate cluster optimizations for files ; OR DH,DH JS DEV_SFT3 STOSW ; sf_cluspos MOV AX,[BX.dir_first] ;;;; STOSW ; sf_lstclus PUSH DI ;AN004; save dirsec offset SUB DI,sf_dirsec ;AN004; es:di -> SFT MOV ES:[DI.sf_lstclus],AX ;AN004; save it POP DI ;AN004; restore dirsec offset ; DOS 3.3 FastOpen 6/13/86 PUSH DS ;hkn; SS is DOSDATA context DS TESTB FastOpenFlg,Special_Fill_Set JZ Not_FastOpen ;hkn; FastOpen_Ext_Info is in DOSDATA MOV SI,OFFSET DOSDATA:FastOpen_Ext_Info MOV AX,WORD PTR [SI.FEI_dirsec] STOSW ; sf_dirsec MOV AX,WORD PTR [SI.FEI_dirsec+2] ;;; changed for >32mb STOSW ; sf_dirsec MOV AL,[SI.FEI_dirpos] STOSB ; sf_dirpos POP DS JMP short Next_Name ; DOS 3.3 FastOpen 6/13/86 Not_FastOpen: POP DS ; normal path ASSUME DS:NOTHING ;hkn; SS override MOV SI,WORD PTR [CURBUF] ; DS:SI->buffer header MOV AX,WORD PTR [SI.buf_sector] ;F.C. >32mb ;AN000; STOSW ; sf_dirsec ;F.C. >32mb ;AN000; MOV AX,WORD PTR [SI.buf_sector+2] ;F.C. >32mb ;AN000; STOSW ; sf_dirsec ;F.C. >32mb ;AN000; MOV AX,BX ADD SI,BUFINSIZ ; DS:SI-> start of data in buffer SUB AX,SI ; AX = BX relative to start of sector MOV CL,SIZE dir_entry DIV CL STOSB ; sf_dirpos Next_Name: .errnz sf_name-(sf_dirpos+1) JMP SHORT FILE_SFT2 DEV_SFT3: ADD DI,sf_name - sf_cluspos FILE_SFT2: ; ; Copy in the object's name ; MOV SI,BX ; DS:SI points to dir_name MOV CX,11 REP MOVSB ; sf_name POP SI ; recover DS:SI -> dir_first ;hkn; SS is DOSDATA context DS CLC return EndProc NEWENTRY ;--------------------------------------------------------------------------- ; ; Procedure Name : FREEENT ; ; Inputs: ; ES:BP -> DPB ; [CURBUF] Set ; [CURBUF+2]:BX points to directory entry ; [CURBUF+2]:SI points to above dir_first ; Function: ; Free the cluster chain for the entry if present ; Outputs: ; Carry set if error (currently user FAILed to I 24) ; (NOTE dir_firclus and dir_size_l/h are wrong) ; DS BX SI ES BP preserved (BX,SI in meaning, not value) others destroyed ;--------------------------------------------------------------------------- procedure FREEENT,NEAR DOSAssume <DS>,"FreeEnt" PUSH DS LDS DI,[CURBUF] ASSUME DS:NOTHING MOV CX,[SI] ; Get pointer to clusters MOV DX,WORD PTR [DI.buf_sector+2] ;F.C. >32mb ;AN000; ;hkn; SS override MOV [HIGH_SECTOR],DX ;F.C. >32mb ;AN000; MOV DX,WORD PTR [DI.buf_sector] POP DS DOSAssume <DS>,"FreeEnt2" CMP CX,2 JB RET1 ; Was 0 length file (or mucked Firclus if CX=1) CMP CX,ES:[BP.dpb_max_cluster] JA RET1 ; Treat like zero length file (firclus mucked) SUB BX,DI PUSH BX ; Save offset PUSH [HIGH_SECTOR] ;F.C. >32mb ;AN000; PUSH DX ; Save sector number MOV BX,CX invoke RELEASE ; Free any data allocated POP DX POP [HIGH_SECTOR] ;F.C. >32mb ;AN000; JNC GET_BUF_BACK POP BX return ; Screw up GET_BUF_BACK: MOV [ALLOWED],allowed_RETRY + allowed_FAIL XOR AL,AL invoke GETBUFFR ; Get sector back POP BX ; Get offset back retc invoke SET_BUF_AS_DIR ADD BX,WORD PTR [CURBUF] ; Correct it for new buffer MOV SI,BX ADD SI,dir_first ; Get corrected SI RET1: CLC return EndProc FREEENT ;--------------------------------------------------------------------------- ; ; Procedure Name : CHECK_VIRT_OPEN ; ; CHECK_VIRT_OPEN checks to see if we had performed a "virtual open" (by ; examining the flag [VIRTUAL_OPEN] to see if it is 1). If we did, then ; it calls Dev_Close_SFT to decrement the ref. count. It also resets the ; flag [VIRTUAL_OPEN]. ; No registers affected (including flags). ; On input, [THISSFT] points to current SFT. ; ;--------------------------------------------------------------------------- Procedure CHECK_VIRT_OPEN,NEAR DOSAssume <DS>,"Check_Virt_Open" PUSH AX lahf ; preserve flags CMP [VIRTUAL_OPEN],0 JZ ALL_CLOSED mov [VIRTUAL_OPEN],0 ; reset flag SAVE <ES,DI> LES DI,[THISSFT] INVOKE DEV_CLOSE_SFT RESTORE <DI,ES> ALL_CLOSED: sahf ; restore flags POP AX return EndProc CHECK_VIRT_OPEN DOSCODE ENDS END  
45/runtime/rt/grputil.asm
minblock/msdos
0
247522
<reponame>minblock/msdos TITLE GRPUTIL - iAPX 88/86 GRAPHICS UTILITY ROUTINES ;*** ; GRPUTIL - iAPX 88/86 GRAPHICS UTILITY ROUTINES ; ; Copyright <C> 1986, Microsoft Corporation ; ;Purpose: ; Graphics utility routines. ; ;****************************************************************************** INCLUDE switch.inc INCLUDE rmacros.inc ; Runtime Macro Defintions USESEG _BSS USESEG GR_TEXT INCLUDE seg.inc ;segment definitions sBegin _BSS ; ;**************************************************************************** ; External low-level function vectors ;**************************************************************************** ; externW b$SetAttr externW B$VXMIN ;defined in GWDATA.ASM externW B$VXMAX ;defined in GWDATA.ASM externW B$VYMIN ;defined in GWDATA.ASM externW B$VYMAX ;defined in GWDATA.ASM sEnd _BSS assumes CS,GR_TEXT sBegin GR_TEXT ;low-level routines: externNP B$GETFBC externNP B$ERR_FC PAGE SUBTTL GRAPHICS SUPPORT ROUTINES ;*** ; ;B$CLRATR PROCESS COLOR ATTRIBUTE FOR GRAPHICS STATEMENTS ; ;Purpose: ; This routine processes a color attribute for several graphics ; statements. If the color attribute is defaulted, the default color ; is put into AL by a call to the OEM dependent routine B$GETFBC. Next ; OEM routine SetAttr is called to set the current graphics attribute ; to the specified color. If the color was invalid, SetAttr returns ; carry set and this routine issues a function call error. ; ;Entry: ; AL=color attribute or AX=-1 if default color ; ;Exit: ; AL=valid color attribute ; ;Modifies: ; AX,BX ; ;**** cProc B$CLRATR,<PUBLIC,NEAR> cBegin ;PROCESS COLOR ATTRIBUTE CMP AX,-1 ;IS DEFAULT COLOR NEEDED? JNE SET_COLOR ;NO: USE SPECIFIED VALUE STC ;SET CARRY CALL B$GETFBC ;GET FG/BG COLORS SET_COLOR: CALL [b$SetAttr] ;SET ATTRIBUTE JC FC_ERROR ;ABORT IF INVALID COLOR cEnd FC_ERROR: JMP B$ERR_FC ;ILLEGAL FUNCTION CALL SUBTTL COMPILER INTERFACE ROUTINES PAGE ;*** ; ;B$INVIEW Determine whether (x,y) coordinates within viewport boundaries ; ;Purpose: ; Test the (x,y) coordinates in (CX,DX) against the current viewport ; boundaries. The carry flag is cleared if either ; coordinate was outside the viewport boundary. ; ;Entry: ; CX=x coordinate DX=y coordinate ; ;Exit: ; carry set if no coords changed, clear if either coord changed ; ;Modifies: none ; ;**** cProc B$INVIEW,<PUBLIC,NEAR> cBegin ;See if x is in VIEW CMP CX,B$VXMIN ;Is it off the left of the viewport JL OUTVIEW ;Yes, out of VIEW CMP CX,B$VXMAX ;Is it off the right of the viewport JG OUTVIEW ;Yes, out of VIEW CMP DX,B$VYMIN ;Is it off the top of the viewport JL OUTVIEW ;Yes, out of VIEW CMP DX,B$VYMAX ;Is it off the bottom of the viewport JG OUTVIEW ;Yes, out of VIEW STC ;no, is in VIEW RET OUTVIEW: CLC RET cEnd nogen sEnd GR_TEXT END
Student/examples/Correct/CPRL0/Correct_121.asm
SoftMoore/CPRL-Kt
6
4525
PROGRAM 8 LDGADDR 0 LDCINT 5 STOREW LDGADDR 4 LDCINT 0 STOREW LDGADDR 4 LOADW LDCINT 0 CMP BNZ L4 LDCB 0 BR L5 L4: LDGADDR 0 LOADW LDGADDR 4 LOADW DIV LDCINT 10 CMP BGE L2 LDCB 1 BR L3 L2: LDCB 0 L3: L5: BZ L6 LDGADDR 0 LOADW PUTINT PUTEOL BR L7 L6: LDGADDR 4 LOADW PUTINT PUTEOL L7: HALT
source/kinit.asm
daniel3735928559/toast
0
19720
<gh_stars>0 [bits 32] %define STACK_SIZE 0x3000 %define BASE 0xC0000000 extern kmain extern monitor_init global begin begin: pop eax mov [vidmem],eax ;; Apply a new upstairs GDT so that we don't have to reply on that old one downstairs ;; 20090902: Insert code for filling out TSS entry properly here? mov eax,tss_start mov [gdt_tss+2],word ax shr eax,16 mov [gdt_tss+4],byte al mov [gdt_tss+7],byte ah mov eax,tss_end-tss_start+1 ;Or possibly just tss_end? Depends on whether the limit is the upper bound or the size... mov [gdt_tss+0],word ax shr eax,16 mov bl,[gdt_tss+6] and al,0x0F or bl,al mov [gdt_tss+6],byte bl lgdt [gdtr] jmp code_selector:flush %include 'init/gdt.asm' flush: mov ax,data_selector mov ds,ax mov fs,ax mov gs,ax mov es,ax mov ss,ax ;mov esp,stack+STACK_SIZE jmp code_selector:.init .init: mov ax,0x2B ltr ax call pic_remap mov al,0xFF out 0x21,al out 0xA1,al lidt [idtr] sti ;; What is this code for? mov cl,1 mov ah,1 shl ah,cl xor ah,0xFF in al, 0x21 and al, ah out 0x21, al ;nop;Causes triple fault at 0xC00000a7 (?!) Remove to make OK again (!?!) push dword tss_start push dword 0x40000 push dword [vidmem] call kmain ;mov eax,0x7000000 ;mov [eax],dword 0xff ;mov eax,0xC1000000 ;mov [eax],dword 0xff jmp $ %include 'init/pic.asm' %include 'init/isr.asm' %include 'init/idt.asm' tss_phys_start: dd 0x12345678 ;NEW 20091224 vidmem: dd 0x12345678 align 32 tss_start: times 26 dd 0 tss_end: stack: dd 0xabcdef ;times (0x1000+STACK_SIZE) db 0 ; reserve 16k stack on a quadword boundary
src/Categories/Category/Instance/LawvereTheories.agda
Trebor-Huang/agda-categories
279
8046
{-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.LawvereTheories where -- Category of Lawvere Theories open import Level open import Categories.Category.Core using (Category) open import Categories.Functor.Cartesian using (CartesianF) open import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_; associator; sym-associator; unitorˡ; unitorʳ; unitor²; refl; sym; trans; _ⓘₕ_) open import Categories.Theory.Lawvere using (LawvereTheory; LT-Hom; LT-id; LT-∘) LawvereTheories : (ℓ e : Level) → Category (suc (ℓ ⊔ e)) (ℓ ⊔ e) (ℓ ⊔ e) LawvereTheories ℓ e = record { Obj = LawvereTheory ℓ e ; _⇒_ = LT-Hom ; _≈_ = λ H₁ H₂ → cartF.F H₁ ≃ cartF.F H₂ ; id = LT-id ; _∘_ = LT-∘ ; assoc = λ { {f = f} {g} {h} → associator (cartF.F f) (cartF.F g) (cartF.F h) } ; sym-assoc = λ { {f = f} {g} {h} → sym-associator (cartF.F f) (cartF.F g) (cartF.F h) } ; identityˡ = unitorˡ ; identityʳ = unitorʳ ; identity² = unitor² ; equiv = record { refl = refl ; sym = sym ; trans = trans } ; ∘-resp-≈ = _ⓘₕ_ } where open LT-Hom
utils/torus.ads
Lucretia/old_nehe_ada95
0
13027
--------------------------------------------------------------------------------- -- Copyright 2004-2005 © <NAME> -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- package Torus is type Object is record Radius : Float; -- Radius of the inner circle. Section_Radius : Float; -- Radius of the tube. Sections : Integer; -- Total sections in the torus. Tube_Sections : Integer; -- Total sections in the tube. end record; end Torus;
examples/led1.asm
NibNerd/asm85
3
163225
<reponame>NibNerd/asm85<filename>examples/led1.asm ; Test program for 8085 SBC. Blinks an LED on SOD forever. ; Note the first jump that seems to do nothing. This is for the power-on jump. ; The ROM is normally at 8000 and the RAM at 0000. At reset, the ROM maps to ; both 0000 and 8000. This condition persists until the A15 line goes high. ; The first instruction is located at 8000, but the PC will actually be 0000 ; when it executes. The jump to 8003 will cause the power-on flip flop to ; clear and the normal addressing scheme will be activated. At this point, ; the RAM and ROM use their normal addressing. ORG 8000h JMP START ; Jump to ROM START: MVI A, 0C0h ; LED on SIM MVI A, 0FFh ; Delay MOV B, A D1PT1: DCR A D1PT2: DCR B JNZ D1PT2 CPI 00h JNZ D1PT1 MVI A, 40h ; LED off SIM MVI A, 0FFh ; Delay MOV B, A D2PT1: DCR A D2PT2: DCR B JNZ D2PT2 CPI 00h JNZ D2PT1 JMP START ; Loop forever
NatDelta.agda
nickcollins/dependent-dicts-agda
0
13548
<gh_stars>0 open import Prelude open import Nat open import Bij module NatDelta where instance NatBij : bij Nat Nat NatBij = record { convert = λ n → n; inj = λ n → n; surj = λ n → n , refl} open import Delta Nat {{NatBij}} nat-dd = dd
code/Forec/t12.asm
KongoHuster/assembly-exercise
1
116
;; last edit date: 2016/10/24 ;; author: Forec ;; LICENSE ;; Copyright (c) 2015-2017, Forec <<EMAIL>> ;; Permission to use, copy, modify, and/or distribute this code for any ;; purpose with or without fee is hereby granted, provided that the above ;; copyright notice and this permission notice appear in all copies. ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. title forec_t12 .model small .data output db 'ANS: $' matchinfo db 'MATCH$' nomatchinfo db 'NO MATCH$' warninginfo db 0dh, 0ah, 'You can input at most 100 chars!', 0dh, 0ah, '$' inputinfo db 'input str$' str1 db 100 dup(?) str2 db 100 dup(?) .code start: mov ax, @data mov ds, ax mov dx, offset inputinfo ;; 显示帮助信息 mov ah, 9h int 21h mov dl, '1' mov ah, 2h int 21h mov dl, ':' int 21h ;; 输入str1 mov si, 0h mov ah, 1h input1: int 21h mov str1[si], al inc si cmp al, 0dh jz pre2 cmp si, 100 jl input1 mov dx, offset warninginfo ;; 超过100字符,提示警告 mov ah, 9h int 21h pre2: mov dx, offset inputinfo ;; 显示帮助信息 mov ah, 9h int 21h mov dl, '2' mov ah, 2h int 21h mov dl, ':' int 21h mov di, 0h mov ah, 1h input2: int 21h mov str2[di], al inc di cmp al, 0dh jz compare cmp di, 100 jl input2 mov dx, offset warninginfo ;; 超过100字符,提示警告 mov ah, 9h int 21h compare: mov dx, offset output ;; 显示 "ANS: " mov ah, 9h int 21h cmp si, di jnz unmatch dec si cmpchar: cmp si, 0h jz match mov bh, str1[si] mov bl, str2[si] cmp bh, bl jnz unmatch dec si jmp cmpchar unmatch: mov dx, offset nomatchinfo jmp quit match: mov dx, offset matchinfo quit: int 21h mov ah, 4ch int 21h end start
libsrc/_DEVELOPMENT/temp/sp1/zx/sprites/draw/SP1_DRAW_MASK2LB.asm
jpoikela/z88dk
640
99061
; DRAW MASK SPRITE 2 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version INCLUDE "config_private.inc" SECTION code_clib SECTION code_temp_sp1 PUBLIC _SP1_DRAW_MASK2LB EXTERN _SP1_DRAW_MASK2NR EXTERN SP1RETSPRDRAW ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call _SP1_DRAW_MASK2LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 62 + 174*4 - 6 + 10 = 762 cycles _SP1_DRAW_MASK2LB: cp SP1V_ROTTBL/256 jp z, _SP1_DRAW_MASK2NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (mask,graph) pairs ld e,$ff ld a,(de) cpl exx ld b,a exx _SP1Mask2LBRotate: ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+0),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+2),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+4),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+6),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) ld a,(de) or b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW
Projetos/I-VM/bin/nasm/StackTest.nasm
juanjorgegarcia/Z01
0
21027
; 0 - PUSH constant 17 leaw $17,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 1 - PUSH constant 17 leaw $17,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 2 - EQ leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $EQStackTest0,%A je %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $EQ2StackTest0,%A jmp nop EQStackTest0: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) EQ2StackTest0: ; 3 - PUSH constant 17 leaw $17,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 4 - PUSH constant 16 leaw $16,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 5 - EQ leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $EQStackTest1,%A je %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $EQ2StackTest1,%A jmp nop EQStackTest1: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) EQ2StackTest1: ; 6 - PUSH constant 16 leaw $16,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 7 - PUSH constant 17 leaw $17,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 8 - EQ leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $EQStackTest2,%A je %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $EQ2StackTest2,%A jmp nop EQStackTest2: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) EQ2StackTest2: ; 9 - PUSH constant 892 leaw $892,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 10 - PUSH constant 891 leaw $891,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 11 - LT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $LTStackTest3,%A jl %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $LT2StackTest3,%A jmp nop LTStackTest3: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) LT2StackTest3: ; 12 - PUSH constant 891 leaw $891,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 13 - PUSH constant 892 leaw $892,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 14 - LT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $LTStackTest4,%A jl %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $LT2StackTest4,%A jmp nop LTStackTest4: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) LT2StackTest4: ; 15 - PUSH constant 891 leaw $891,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 16 - PUSH constant 891 leaw $891,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 17 - LT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $LTStackTest5,%A jl %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $LT2StackTest5,%A jmp nop LTStackTest5: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) LT2StackTest5: ; 18 - PUSH constant 32767 leaw $32767,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 19 - PUSH constant 32766 leaw $32766,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 20 - GT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $GTStackTest6,%A jg %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $GT2StackTest6,%A jmp nop GTStackTest6: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) GT2StackTest6: ; 21 - PUSH constant 32766 leaw $32766,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 22 - PUSH constant 32767 leaw $32767,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 23 - GT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $GTStackTest7,%A jg %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $GT2StackTest7,%A jmp nop GTStackTest7: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) GT2StackTest7: ; 24 - PUSH constant 32766 leaw $32766,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 25 - PUSH constant 32766 leaw $32766,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 26 - GT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $GTStackTest8,%A jg %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $GT2StackTest8,%A jmp nop GTStackTest8: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) GT2StackTest8: ; 27 - PUSH constant 57 leaw $57,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 28 - PUSH constant 31 leaw $31,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 29 - PUSH constant 53 leaw $53,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 30 - ADD leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A addw (%A),%D,%D movw %D,(%A) ; 31 - PUSH constant 112 leaw $112,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 32 - SUB leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D movw %D,(%A) ; 33 - NEG leaw $SP,%A subw (%A),$1,%A movw (%A),%D negw %D movw %D,(%A) ; 34 - AND leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A andw (%A),%D,%D movw %D,(%A) ; 35 - PUSH constant 82 leaw $82,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 36 - OR leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A orw (%A),%D,%D movw %D,(%A) ; 37 - NOT leaw $SP,%A subw (%A),$1,%A movw (%A),%D notw %D movw %D,(%A) ; End
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/lto1_pkg.ads
best08618/asylo
7
26117
package Lto1_Pkg is type Unsigned_64 is mod 2 ** 64; type Associated_Report_T is (miss, radpr, radssr, radcmb); -- sensor type : primary, secondary, co-rotating (combined) subtype Sensor_Type_T is Associated_Report_T; -- range radpr .. radcmb; subtype Antenna_Type_T is Sensor_Type_T range radpr .. radssr; type Filtering_Level_T is (none, pr_in_clutter, ssr_plots, pr_plots); type Filtering_Levels_T is array (Filtering_Level_T) of boolean; type Radar_T is record External_Sensor_ID : Unsigned_64; Dual_Radar_Index : Integer; Compatible_Filtering_Levels : Filtering_Levels_T; Sensor_Type : Sensor_Type_T; end record; procedure Initialize (Radar : in Radar_T); end Lto1_Pkg;
oeis/027/A027764.asm
neoneye/loda-programs
11
98048
<reponame>neoneye/loda-programs ; A027764: a(n) = (n+1)*binomial(n+1,4). ; 4,25,90,245,560,1134,2100,3630,5940,9295,14014,20475,29120,40460,55080,73644,96900,125685,160930,203665,255024,316250,388700,473850,573300,688779,822150,975415,1150720,1350360,1576784,1832600,2120580,2443665,2804970,3207789,3655600,4152070,4701060,5306630,5973044,6704775,7506510,8383155,9339840,10381924,11515000,12744900,14077700,15519725,17077554,18758025,20568240,22515570,24607660,26852434,29258100,31833155,34586390,37526895,40664064,44007600,47567520,51354160,55378180,59650569,64182650 add $0,4 mov $1,$0 bin $1,4 mul $0,$1
agda/Ctt.agda
anqurvanillapy/fpl
1
3276
{-# OPTIONS --cubical --safe #-} module Ctt where open import Cubical.Core.Everything open import Agda.Primitive.Cubical using ( primComp ) -- Identity function. id : ∀ {ℓ} {A : Set ℓ} (x : A) → A id x = x -- Funciton composition. _∘_ : ∀ {ℓ} {A B C : Type ℓ} (g : B → C) (f : A → B) → A → C g ∘ f = λ a → g (f a) -- Equivalence is the path to `x` itself. refl : ∀ {ℓ} {A : Type ℓ} {x : A} → Path A x x refl {x = x} = λ i → x -- A square in `A` is built out of 4 points and 4 lines. square : ∀ {ℓ} {A : Type ℓ} {x0 x1 y0 y1 : A} → x0 ≡ x1 → y0 ≡ y1 → x0 ≡ y0 → x1 ≡ y1 → Type ℓ square p q r s = PathP (λ i → p i ≡ q i) r s -- Symmetry. sym : ∀ {ℓ} {A : Type ℓ} {x y : A} → x ≡ y → y ≡ x sym p i = p (~ i) -- sym p i = λ i → p (~ i) -- Congruence. cong : ∀ {ℓ} {A : Type ℓ} {x y : A} {B : A → Type ℓ} (f : (a : A) → B a) (p : x ≡ y) → PathP (λ i → B (p i)) (f x) (f y) cong f p i = f (p i) -- Symmetry inverse. symInv : ∀ {ℓ} {A : Type ℓ} {x y : A} (p : x ≡ y) → sym (sym p) ≡ p symInv p = refl -- Congruence with identity function. congId : ∀ {ℓ} {A : Type ℓ} {x y : A} (p : x ≡ y) → cong id p ≡ p congId p = refl -- Congruence with composition. congComp : ∀ {ℓ} {A B C : Type ℓ} (f : A → B) (g : B → C) {x y : A} (p : x ≡ y) → cong (g ∘ f) p ≡ cong g (cong f p) congComp f g p = refl -- Function extensionality. funExt : ∀ {ℓ} {A : Type ℓ} {B : A → Type ℓ} {f g : (x : A) → B x} → ((x : A) → f x ≡ g x) → f ≡ g funExt p i x = p x i -- `p` matches the 1st parameter, -- `i` matches the dimension of the 1st parameter, -- `x` matches `(x : A)`, -- `funExt p i x = {!!}` the goal matches `B x`, -- `(p x) i` is obvious. -- Transitivity. trans : ∀ {ℓ} {A : Type ℓ} {x y z : A} → x ≡ y → y ≡ z → x ≡ z trans {y = y} p q i = primComp {!!} {!!} {!!} -- Transport with composition. transportComp : ∀ {ℓ} {A B C : Type ℓ} → A ≡ B → B ≡ C → A → C transportComp p q a = {!!}
programs/oeis/110/A110550.asm
neoneye/loda
22
92768
<reponame>neoneye/loda ; A110550: Periodic {1,3,2,4,4,2,3,1}. ; 1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4,4,2,3,1,1,3,2,4 seq $0,341740 ; a(n) is the maximum value of the magic constant in a normal magic triangle of order n. seq $0,70402 ; a(n) = 2^n mod 5.
programs/oeis/136/A136290.asm
karttu/loda
1
14776
<reponame>karttu/loda<filename>programs/oeis/136/A136290.asm ; A136290: a(0)=1, a(1)=3, a(2)=9, a(3)=12, a(4)=15; thereafter a(n) = a(n-1)+a(n-3)-a(n-4). ; 1,3,9,12,15,21,24,27,33,36,39,45,48,51,57,60,63,69,72,75,81,84,87,93,96,99,105,108,111,117,120,123,129,132,135,141,144,147,153,156,159,165,168,171,177,180,183,189,192,195,201,204,207,213,216,219,225,228,231,237 mov $1,$0 add $0,1 mod $0,3 mul $1,4 trn $1,$0 add $1,1
programs/oeis/266/A266256.asm
karttu/loda
0
93412
<reponame>karttu/loda ; A266256: Number of ON (black) cells in the n-th iteration of the "Rule 11" elementary cellular automaton starting with a single ON (black) cell. ; 1,1,2,5,2,9,2,13,2,17,2,21,2,25,2,29,2,33,2,37,2,41,2,45,2,49,2,53,2,57,2,61,2,65,2,69,2,73,2,77,2,81,2,85,2,89,2,93,2,97,2,101,2,105,2,109,2,113,2,117,2,121,2,125,2,129,2,133,2,137,2,141,2,145,2,149,2,153,2,157,2,161,2,165,2,169,2,173,2,177,2,181,2,185,2,189,2,193,2,197,2,201,2,205,2,209,2,213,2,217,2,221,2,225,2,229,2,233,2,237,2,241,2,245,2,249,2,253,2,257,2,261,2,265,2,269,2,273,2,277,2,281,2,285,2,289,2,293,2,297,2,301,2,305,2,309,2,313,2,317,2,321,2,325,2,329,2,333,2,337,2,341,2,345,2,349,2,353,2,357,2,361,2,365,2,369,2,373,2,377,2,381,2,385,2,389,2,393,2,397,2,401,2,405,2,409,2,413,2,417,2,421,2,425,2,429,2,433,2,437,2,441,2,445,2,449,2,453,2,457,2,461,2,465,2,469,2,473,2,477,2,481,2,485,2,489,2,493,2,497 trn $0,1 mov $1,$0 mod $0,2 mul $1,2 mov $2,$0 lpb $2,1 mov $1,1 sub $2,1 lpe add $1,1
programs/oeis/081/A081348.asm
karttu/loda
1
26042
; A081348: First row in maze arrangement of natural numbers. ; 1,6,7,20,21,42,43,72,73,110,111,156,157,210,211,272,273,342,343,420,421,506,507,600,601,702,703,812,813,930,931,1056,1057,1190,1191,1332,1333,1482,1483,1640,1641,1806,1807,1980,1981,2162,2163,2352,2353,2550,2551,2756,2757,2970,2971,3192,3193,3422,3423,3660,3661,3906,3907,4160,4161,4422,4423,4692,4693,4970,4971,5256,5257,5550,5551,5852,5853,6162,6163,6480,6481,6806,6807,7140,7141,7482,7483,7832,7833,8190,8191,8556,8557,8930,8931,9312,9313,9702,9703,10100,10101,10506,10507,10920,10921,11342,11343,11772,11773,12210,12211,12656,12657,13110,13111,13572,13573,14042,14043,14520,14521,15006,15007,15500,15501,16002,16003,16512,16513,17030,17031,17556,17557,18090,18091,18632,18633,19182,19183,19740,19741,20306,20307,20880,20881,21462,21463,22052,22053,22650,22651,23256,23257,23870,23871,24492,24493,25122,25123,25760,25761,26406,26407,27060,27061,27722,27723,28392,28393,29070,29071,29756,29757,30450,30451,31152,31153,31862,31863,32580,32581,33306,33307,34040,34041,34782,34783,35532,35533,36290,36291,37056,37057,37830,37831,38612,38613,39402,39403,40200,40201,41006,41007,41820,41821,42642,42643,43472,43473,44310,44311,45156,45157,46010,46011,46872,46873,47742,47743,48620,48621,49506,49507,50400,50401,51302,51303,52212,52213,53130,53131,54056,54057,54990,54991,55932,55933,56882,56883,57840,57841,58806,58807,59780,59781,60762,60763,61752,61753,62750 sub $0,1 mov $1,2 gcd $1,$0 add $1,$0 pow $1,2 add $1,2 add $0,$1 mov $1,$0
Transynther/x86/_processed/AVXALIGN/_st_zr_un_4k_/i7-7700_9_0xca.log_21829_1261.asm
ljhsiun2/medusa
9
8726
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x137, %rsi lea addresses_A_ht+0x8483, %rdi nop nop nop sub %rbx, %rbx mov $88, %rcx rep movsq nop nop and %r13, %r13 lea addresses_WT_ht+0x1c6b7, %r14 nop add $52565, %r12 movb (%r14), %cl nop nop add %r14, %r14 lea addresses_WC_ht+0xaf73, %r12 nop nop nop nop nop cmp %rbx, %rbx and $0xffffffffffffffc0, %r12 vmovntdqa (%r12), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rsi nop nop nop nop nop and $34652, %r12 lea addresses_D_ht+0x319f, %rsi lea addresses_normal_ht+0x153b7, %rdi nop nop nop nop sub $9231, %r12 mov $88, %rcx rep movsw nop nop add %r12, %r12 lea addresses_WT_ht+0x66b7, %rsi lea addresses_UC_ht+0x180b7, %rdi nop nop nop nop xor %r10, %r10 mov $54, %rcx rep movsl nop nop nop nop sub $1902, %r13 lea addresses_WT_ht+0xd2b7, %rsi nop inc %rdi movb (%rsi), %r10b xor %r14, %r14 lea addresses_normal_ht+0xceb7, %rsi lea addresses_WT_ht+0x99b7, %rdi clflush (%rsi) sub %rbx, %rbx mov $20, %rcx rep movsw cmp %r12, %r12 lea addresses_normal_ht+0xceb7, %r13 nop nop nop nop sub $21279, %rdi movups (%r13), %xmm5 vpextrq $1, %xmm5, %r10 nop xor %r12, %r12 lea addresses_UC_ht+0x4e89, %rsi lea addresses_normal_ht+0x1925b, %rdi xor $57166, %r14 mov $61, %rcx rep movsl nop nop nop nop cmp %r12, %r12 lea addresses_normal_ht+0x14937, %r10 clflush (%r10) nop nop nop nop nop cmp %r13, %r13 mov (%r10), %ecx inc %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi // Store lea addresses_WC+0x36b7, %r14 nop xor %rax, %rax mov $0x5152535455565758, %rcx movq %rcx, %xmm1 vmovaps %ymm1, (%r14) nop xor %rax, %rax // Faulty Load mov $0x4c39a600000006b7, %r13 nop nop and $59176, %r12 mov (%r13), %rdi lea oracles, %r12 and $0xff, %rdi shlq $12, %rdi mov (%r12,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 11, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'79': 2, '00': 3847, '5f': 17735, '58': 245} 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 00 00 5f 5f 5f 5f 5f 5f 00 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 00 00 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 00 00 5f 5f 00 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 00 00 00 5f 00 00 00 5f 00 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 58 5f 5f 5f 5f 00 5f 5f 5f 00 5f 00 5f 5f 00 00 5f 00 5f 00 00 00 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 00 58 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 00 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 00 00 5f 5f 5f 5f 5f 00 00 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 00 00 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 00 5f 5f 5f 00 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 5f 00 00 5f 5f 5f 5f 5f 5f 5f 5f 00 00 5f 5f 00 5f 5f 5f 5f 00 5f 5f 5f 00 00 5f 5f 5f 00 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 00 5f 5f 58 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 5f 58 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f 5f 00 00 5f 00 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 00 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 00 5f 5f 00 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 00 5f 5f 5f 5f 5f */
ReductionSystem.agda
Lolirofle/stuff-in-agda
6
4363
open import Type -- The relation (_⟶_) should be interpreted as "a term reduces/rewritten to another term". -- Also called: Abstract reduction system, abstract rewriting system, rewriting system. module ReductionSystem {ℓ₁ ℓ₂} {Term : Type{ℓ₁}} (_⟶_ : Term → Term → Type{ℓ₂}) where open import Functional open import Graph.Properties open import Graph.Walk open import Graph.Walk.Proofs open import Lang.Instance import Lvl open import Logic open import Logic.Propositional open import Logic.Predicate open import Relator.Converse open import Relator.Equals open import Relator.Equals.Proofs.Equiv open import Relator.ReflexiveTransitiveClosure open import Structure.Setoid.Uniqueness open import Structure.Relator.Equivalence open import Structure.Relator.Ordering open import Structure.Relator.Properties open import Syntax.Function open import Syntax.Transitivity open Graph.Properties using (intro) public -- The relation (_⟶_) is a function on the left argument. -- In terms of paths, it means that there are no forks on any paths. Deterministic = ∀{a} → Unique(a ⟶_) -- A term is reducible when there is a term it can reduce to. -- In terms of paths, it means that one can go somewhere else from this point. Reducible : Term → Stmt Reducible(a) = ∃(a ⟶_) -- A term is in normal form when it is irreducible (cannot be reduced any further). -- Also called: Irreducible term -- In terms of paths, it means that this point is a dead-end. NormalForm : Term → Stmt NormalForm = FinalVertex(_⟶_) module NormalForm = FinalVertex -- "a normalizes to b" means that "a" reduces to the normal form "b". -- In terms of paths, this means that the dead end of one path from "a" is "b". record _normalizes-to_ (a : Term) (b : Term) : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field reduction : Walk(_⟶_) a b ⦃ normalForm ⦄ : NormalForm(b) -- In terms of paths, this means that there is a path which leads to a dead-end. WeaklyNormalizes : Term → Stmt WeaklyNormalizes a = ∃(a normalizes-to_) -- A reduction system is weakly normalizing when all terms in the language have a normal form. -- In terms of paths, this means that all points have a path whch eventually lead to a dead-end. WeaklyNormalizing = ∀ₗ(WeaklyNormalizes) StronglyNormalizes : Term → Stmt StronglyNormalizes = Strict.Properties.Accessibleₗ(Converse(_⟶_)) -- Every term reduces to a normal form. -- Also called: Terminating. StronglyNormalizing : Stmt StronglyNormalizing = Strict.Properties.WellFounded(Converse(_⟶_)) -- Both a and b reduce to c in zero or more steps. -- Also called: _⟶*_*⟵_ CommonReduct : Term → Term → Term → Stmt CommonReduct c a b = (Walk(_⟶_) a c) ∧ (Walk(_⟶_) b c) -- Both a and b reduce to the same term in zero or more steps. -- In terms of paths, this means that paths starting from the two points are able to eventually meet. -- Also called: Joinable, _⟶*_*⟵_ _↓_. Joinable : Term → Term → Stmt Joinable a b = ∃(c ↦ CommonReduct c a b) module Names where import Structure.Relator.Names as Names EverywhereCommonReduct = Names.Subrelation (Walk(_⟶_)) Joinable module _ (a : Term) where Confluent = ∀{b c} → (Walk(_⟶_) a b) → (Walk(_⟶_) a c) → Joinable b c Semiconfluent = ∀{b c} → (a ⟶ b) → (Walk(_⟶_) a c) → Joinable b c LocallyConfluent = ∀{b c} → (a ⟶ b) → (a ⟶ c) → Joinable b c StronglyConfluent = ∀{b c} → (a ⟶ b) → (a ⟶ c) → ∃(d ↦ (ReflexiveClosure(_⟶_) b d) ∧ (Walk(_⟶_) c d)) DiamondProperty = ∀{b c} → (a ⟶ b) → (a ⟶ c) → ∃(d ↦ (b ⟶ d) ∧ (c ⟶ d)) Confluence = ∀ₗ(Confluent) -- Also called: The Church-Rosser property EverywhereCommonReduct = (Walk(_⟶_)) ⊆₂ Joinable module _ (a : Term) where -- A term is confluent when all its reducts have a common reduct. -- In terms of paths, this means that paths starting from this point will always eventually meet. record Confluent : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field proof : Names.Confluent(a) confluent = inst-fn Confluent.proof record Semiconfluent : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field proof : Names.Semiconfluent(a) semiconfluent = inst-fn Semiconfluent.proof record LocallyConfluent : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field proof : Names.LocallyConfluent(a) locally-confluent = inst-fn LocallyConfluent.proof record StronglyConfluent : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field proof : Names.StronglyConfluent(a) strongly-confluent = inst-fn StronglyConfluent.proof record DiamondProperty : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field proof : Names.DiamondProperty(a) diamond-property = inst-fn DiamondProperty.proof -- All terms are confluent. -- In terms of paths, this means that parts starting from the same point can always eventually meet. Confluence = ∀ₗ(Confluent) Semiconfluence = ∀ₗ(Semiconfluent) LocalConfluence = ∀ₗ(LocallyConfluent) StrongConfluence = ∀ₗ(StronglyConfluent) record Convergent : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field ⦃ confluence ⦄ : Confluence ⦃ strongly-normalizing ⦄ : StronglyNormalizing -- Evaluable = ∃(f ↦ ) -- All paths from a dead-end results in going nowhere. Normal-unique-Path : ∀{a} → ⦃ _ : NormalForm(a) ⦄ → ∀{b} → Walk(_⟶_) a b → (a ≡ b) Normal-unique-Path at = [≡]-intro Normal-unique-Path ⦃ intro na ⦄ (prepend ab1 sb1b) = [⊥]-elim(na ab1) instance -- A term reduces to itself in zero steps. -- In terms of paths, this means that two paths starting from the same point can reach this same point. Joinable-reflexivity : Reflexivity(Joinable) ∃.witness (Reflexivity.proof Joinable-reflexivity {x}) = x ∃.proof (Reflexivity.proof Joinable-reflexivity {x}) = [∧]-intro Walk.at Walk.at instance -- When one reduces to the same term as the other, the other also reduces to the same term as the first one. Joinable-symmetry : Symmetry(Joinable) ∃.witness (Symmetry.proof Joinable-symmetry {x} {y} xy) = [∃]-witness xy ∃.proof (Symmetry.proof Joinable-symmetry {x} {y} xy) = [∧]-intro ([∧]-elimᵣ(∃.proof xy)) (([∧]-elimₗ(∃.proof xy))) instance -- When one reduces to the same term as the other, the other also reduces to the same term as the first one. Walk-Joinable-subrelation : Walk(_⟶_) ⊆₂ Joinable ∃.witness (_⊆₂_.proof Walk-Joinable-subrelation {y = y} ab) = y ∃.proof (_⊆₂_.proof Walk-Joinable-subrelation ab) = [∧]-intro ab (reflexivity(Walk(_⟶_))) module _ ⦃ confl : Confluence ⦄ where import Structure.Relator.Names as Names instance Confluence-to-Joinable-transitivity : Transitivity(Joinable) Confluence-to-Joinable-transitivity = intro proof where proof : Names.Transitivity(Joinable) proof {x}{y}{z} ([∃]-intro obj-xy ⦃ [∧]-intro pxxy pyxy ⦄) ([∃]-intro obj-yz ⦃ [∧]-intro pyyz pzyz ⦄) = [∃]-intro obj ⦃ [∧]-intro l r ⦄ where objxy-objyz-common-reduct : Joinable obj-xy obj-yz objxy-objyz-common-reduct = confluent(y) pyxy pyyz obj : Term obj = [∃]-witness objxy-objyz-common-reduct l : Walk(_⟶_) x obj l = transitivity(Walk(_⟶_)) pxxy ([∧]-elimₗ ([∃]-proof objxy-objyz-common-reduct)) r : Walk(_⟶_) z obj r = transitivity(Walk(_⟶_)) pzyz ([∧]-elimᵣ ([∃]-proof objxy-objyz-common-reduct)) instance Confluence-to-Joinable-equivalence : Equivalence(Joinable) Confluence-to-Joinable-equivalence = intro module _ (det : Deterministic) where -- Frege thing deterministic-dichotomy : ∀{a b c} → (Walk(_⟶_) a b) → (Walk(_⟶_) a c) → (Walk(_⟶_) b c) ∨ (Walk(_⟶_) c b) deterministic-dichotomy at ac = [∨]-introₗ ac deterministic-dichotomy (ab @ (prepend _ _)) at = [∨]-introᵣ ab deterministic-dichotomy (prepend ab2 b) (prepend ab3 ac) with det ab2 ab3 ... | [≡]-intro = deterministic-dichotomy b ac deterministic-step : ∀{a b c} → (a ⟶ b) → (Walk(_⟶_) a c) → ((a ≡ c) ∨ (Walk(_⟶_) b c)) deterministic-step ab at = [∨]-introₗ [≡]-intro deterministic-step ab (prepend ab₁ ac) rewrite det ab ab₁ = [∨]-introᵣ ac instance deterministic-confluence : Confluence deterministic-confluence = intro proof where proof : Names.Confluence proof {c = c} at ac = [∃]-intro c ⦃ [∧]-intro ac at ⦄ {-# CATCHALL #-} proof {b = b} ab at = [∃]-intro b ⦃ [∧]-intro at ab ⦄ proof (prepend ab1 ab) (prepend ab2 ac) rewrite det ab1 ab2 = proof ab ac deterministic-unique-normalizes-to : ∀{a} → Unique(a normalizes-to_) deterministic-unique-normalizes-to (intro ax) (intro ay) = proof ax ay where proof : ∀{a b c} → ⦃ _ : NormalForm(b) ⦄ → ⦃ _ : NormalForm(c) ⦄ → Walk(_⟶_) a b → Walk(_⟶_) a c → (b ≡ c) proof at at = [≡]-intro proof ⦃ intro normal-x ⦄ ⦃ _ ⦄ at (prepend ab by) = [⊥]-elim(normal-x ab) proof ⦃ _ ⦄ ⦃ intro normal-y ⦄ (prepend ab bx) at = [⊥]-elim(normal-y ab) proof (prepend ab₁ b₁x) (prepend ab₂ b₂y) rewrite det ab₁ ab₂ = proof b₁x b₂y confluence-semiconfluence : Confluence ↔ Semiconfluence confluence-semiconfluence = [↔]-intro (semiconfl ↦ intro(l(semiconfl))) r where l : Names.Confluence ← Semiconfluence l semiconfl at xc = sub₂(Walk(_⟶_))(Joinable) xc l semiconfl (prepend xb₁ b₁b) xc with Semiconfluent.proof semiconfl xb₁ xc ... | [∃]-intro d ⦃ [∧]-intro b₁d c₁d ⦄ with l semiconfl b₁b b₁d ... | [∃]-intro e ⦃ [∧]-intro be de ⦄ = [∃]-intro e ⦃ [∧]-intro be (transitivity(Walk(_⟶_)) c₁d de) ⦄ r : Confluence → Semiconfluence Semiconfluent.proof (r confl) xb xc = Confluent.proof confl (sub₂(_⟶_)(Walk(_⟶_)) xb) xc -- TODO: Not sure, but maybe? {-# TERMINATING #-} strong-confluence-confluence : StrongConfluence → Confluence strong-confluence-confluence strconfl = intro(proof strconfl) where proof : StrongConfluence → Names.Confluence proof strconfl {x} at at = reflexivity(Joinable) proof strconfl {x} at (prepend xb bc) = sub₂(Walk(_⟶_))(Joinable) (prepend xb bc) proof strconfl {x} (prepend xb₁ b₁b) at = symmetry(Joinable) (sub₂(Walk(_⟶_))(Joinable) (prepend xb₁ b₁b)) proof strconfl {x} {b}{c} (prepend xb₁ b₁b) (prepend xb₂ b₂c) with StronglyConfluent.proof strconfl xb₁ xb₂ proof strconfl {x} {b}{c} (prepend xd db) (prepend xb₁ b₁c) | [∃]-intro d ⦃ [∧]-intro refl b₁d ⦄ with proof strconfl b₁c b₁d ... | [∃]-intro e ⦃ [∧]-intro ce de ⦄ with proof strconfl db de ... | [∃]-intro f ⦃ [∧]-intro bf ef ⦄ = [∃]-intro f ⦃ [∧]-intro bf (transitivity(Walk(_⟶_)) ce ef) ⦄ proof strconfl {x} {b}{c} (prepend xb₁ b₁b) (prepend xb₂ b₂c) | [∃]-intro d ⦃ [∧]-intro (super b₁d) b₂d ⦄ with proof strconfl b₁b (sub₂(_⟶_)(Walk(_⟶_)) b₁d) ... | [∃]-intro e ⦃ [∧]-intro be de ⦄ with proof strconfl b₂c b₂d ... | [∃]-intro f ⦃ [∧]-intro cf df ⦄ with proof strconfl de df ... | [∃]-intro g ⦃ [∧]-intro eg fg ⦄ = [∃]-intro g ⦃ [∧]-intro (transitivity(Walk(_⟶_)) be eg) (transitivity(Walk(_⟶_)) cf fg) ⦄ semiconfluence-everywhere-common-reduct : ⦃ _ : Semiconfluence ⦄ → EverywhereCommonReduct semiconfluence-everywhere-common-reduct ⦃ semiconfl ⦄ = intro proof where instance confl : Confluence confl = [↔]-to-[←] confluence-semiconfluence semiconfl proof : Names.EverywhereCommonReduct proof at = reflexivity(Joinable) proof {a}{c} (prepend {b = b} ab bc) = transitivity(Joinable) (sub₂(Walk(_⟶_))(Joinable) (sub₂(_⟶_)(Walk(_⟶_)) ab)) (proof bc) diamond-property-locally-confluent : ⦃ _ : ∀ₗ(DiamondProperty) ⦄ → LocalConfluence LocallyConfluent.proof (diamond-property-locally-confluent {x}) xb xc = [∃]-map-proof ([∧]-map (sub₂(_⟶_)(Walk(_⟶_))) (sub₂(_⟶_)(Walk(_⟶_)))) (diamond-property _ xb xc) -- locally-confluent-diamond-property : ⦃ LocalConfluence ⦄ → ∀ₗ(DiamondProperty) -- DiamondProperty.proof locally-confluent-diamond-property xb xc = {!locally-confluent _ xb xc!} -- Terminating ↔ LocalConfluence (TODO: See Newman's lemma) -- Convergent → ∀{a} → Unique(a normalizes-to_) -- Confluence → (Walk(_⟶_) x y) → NormalForm(y) → (ReflexiveClosure(_⟶_) x y) -- Confluence → (Walk(_⟶_) x y) → Unique(NormalForm) -- Confluence → ∀{a} → Unique(a normalizes-to_)
data/src/main/antlr/com/linkedin/data/grammar/Pdl.g4
aman1309/rest.li
0
5307
<gh_stars>0 /* * Copyright 2015 Coursera Inc. * * 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. */ /* * Antlr grammar for the Pegasus data language format (.pdl). */ grammar Pdl; @header { package com.linkedin.data.grammar; import com.linkedin.data.schema.grammar.PdlParseUtils; import java.util.Arrays; } // Document is the top level node of this grammar. // Each .pdl file contains exactly one document. // Ideally, only namedTypeDeclaration would be allowed for document level type declarations. // But for compatibility with .pdsc, arrays, maps and unions may be declared as well. document: namespaceDeclaration? packageDeclaration? importDeclarations typeDeclaration; namespaceDeclaration: NAMESPACE typeName; packageDeclaration: PACKAGE typeName; importDeclarations: importDeclaration*; importDeclaration: IMPORT type=typeName; // A typeReference is simply a type name that refers to a type defined elsewhere. typeReference returns [String value]: NULL_LITERAL { $value = "null"; } | typeName { $value = $typeName.value; }; typeDeclaration: scopedNamedTypeDeclaration | namedTypeDeclaration | anonymousTypeDeclaration; // Only named declarations support schemadoc and properties. namedTypeDeclaration: doc=schemadoc? props+=propDeclaration* (recordDeclaration | enumDeclaration | typerefDeclaration | fixedDeclaration); // Why can named type declarations be scoped with an alternate namespace and package? // Begrudgingly, for compatibility with .pdsc. In .pdsc all type declarations may specify a namespace and package, // even if they are inline declarations. scopedNamedTypeDeclaration: OPEN_BRACE namespaceDeclaration? packageDeclaration? namedTypeDeclaration CLOSE_BRACE; anonymousTypeDeclaration: unionDeclaration | arrayDeclaration | mapDeclaration; typeAssignment: typeReference | typeDeclaration; // Each property is a node in a properties tree, keyed by it's path in the tree. // The value of each property may be any JSON type. // If the property does not specify a property, it defaults to JSON 'true'. propDeclaration returns [List<String> path]: propNameDeclaration propJsonValue? { $path = $propNameDeclaration.path; }; propNameDeclaration returns [List<String> path]: AT propName { $path = $propName.path; }; propJsonValue: EQ jsonValue; recordDeclaration returns [String name]: RECORD identifier beforeIncludes=fieldIncludes? recordDecl=fieldSelection afterIncludes=fieldIncludes? { $name = $identifier.value; }; enumDeclaration returns [String name]: ENUM identifier enumDecl=enumSymbolDeclarations { $name = $identifier.value; }; enumSymbolDeclarations: OPEN_BRACE symbolDecls+=enumSymbolDeclaration* CLOSE_BRACE; enumSymbolDeclaration: doc=schemadoc? props+=propDeclaration* symbol=enumSymbol; enumSymbol returns [String value]: identifier { $value = $identifier.value; }; typerefDeclaration returns [String name]: TYPEREF identifier EQ ref=typeAssignment { $name = $identifier.value; }; fixedDeclaration returns[String name, int size]: FIXED identifier sizeStr=NUMBER_LITERAL { $name = $identifier.value; $size = $sizeStr.int; }; unionDeclaration: UNION typeParams=unionTypeAssignments; unionTypeAssignments: OPEN_BRACKET members+=unionMemberDeclaration* CLOSE_BRACKET; unionMemberDeclaration: alias=unionMemberAlias? member=typeAssignment; unionMemberAlias: doc=schemadoc? props+=propDeclaration* name=identifier COLON; arrayDeclaration: ARRAY typeParams=arrayTypeAssignments; arrayTypeAssignments: OPEN_BRACKET items=typeAssignment CLOSE_BRACKET; mapDeclaration: MAP typeParams=mapTypeAssignments; mapTypeAssignments: OPEN_BRACKET key=typeAssignment value=typeAssignment CLOSE_BRACKET; fieldSelection: OPEN_BRACE fields+=fieldDeclaration* CLOSE_BRACE; fieldIncludes: INCLUDES typeAssignment+; fieldDeclaration returns [String name, boolean isOptional]: doc=schemadoc? props+=propDeclaration* fieldName=identifier COLON OPTIONAL? type=typeAssignment fieldDefault? { $name = $identifier.value; $isOptional = $OPTIONAL() != null; }; fieldDefault: EQ jsonValue; // A qualified identifier is simply one or more '.' separated identifiers. typeName returns [String value]: ID (DOT ID)* { $value = PdlParseUtils.validatePegasusId(PdlParseUtils.unescapeIdentifier($text)); }; identifier returns [String value]: ID { $value = PdlParseUtils.validatePegasusId(PdlParseUtils.unescapeIdentifier($text)); }; // A full property name, made of property segments separated by dots. // Returns the list of property segments. propName returns [List<String> path] @init{$path = new ArrayList<String>();} : propSegment {$path.add($propSegment.value);} (DOT propSegment {$path.add($propSegment.value);})* ; // A property segment. Can be escaped with back-tick() to include dots (.) or other special characters in the segment. // Eg, // validate // `com.linkedin.validate.CustomValidator` // deprecated // `/*` propSegment returns [String value]: (ID | PROPERTY_ID | ESCAPED_PROP_ID) { $value = PdlParseUtils.unescapeIdentifier($text); }; // Schemadoc strings support markdown formatting. schemadoc returns [String value]: SCHEMADOC_COMMENT { $value = PdlParseUtils.extractMarkdown($SCHEMADOC_COMMENT.text); }; // Embedded JSON Grammar // JSON is used both for property values and for field default values. object: OPEN_BRACE objectEntry* CLOSE_BRACE; objectEntry: key=string COLON value=jsonValue ; array: OPEN_BRACKET items=jsonValue* CLOSE_BRACKET; jsonValue: string | number | object | array | bool | nullValue; string returns [String value]: STRING_LITERAL { $value = PdlParseUtils.extractString($STRING_LITERAL.text); }; number returns [Number value]: NUMBER_LITERAL { $value = PdlParseUtils.toNumber($NUMBER_LITERAL.text); }; bool returns [Boolean value]: BOOLEAN_LITERAL { $value = Boolean.valueOf($BOOLEAN_LITERAL.text); }; nullValue: NULL_LITERAL; // Tokens // Antlr uses the below token rules to construct it the lexer for this grammar. ARRAY: 'array'; ENUM: 'enum'; FIXED: 'fixed'; IMPORT: 'import'; OPTIONAL: 'optional'; PACKAGE: 'package'; MAP: 'map'; NAMESPACE: 'namespace'; RECORD: 'record'; TYPEREF: 'typeref'; UNION: 'union'; INCLUDES: 'includes'; OPEN_PAREN: '('; CLOSE_PAREN: ')'; OPEN_BRACE: '{'; CLOSE_BRACE: '}'; OPEN_BRACKET: '['; CLOSE_BRACKET: ']'; AT: '@'; COLON: ':'; DOT: '.'; EQ: '='; BOOLEAN_LITERAL: 'true' | 'false'; NULL_LITERAL: 'null'; SCHEMADOC_COMMENT: '/**' .*? '*/'; BLOCK_COMMENT: '/*' .*? '*/' -> skip; LINE_COMMENT: '//' ~[\r\n]* -> skip; NUMBER_LITERAL: '-'? ('0' | [1-9] [0-9]*) ( '.' [0-9]+)? ([eE][+-]?[0-9]+)?; fragment HEX: [0-9a-fA-F]; fragment UNICODE: 'u' HEX HEX HEX HEX; fragment ESC: '\\' (["\\/bfnrt] | UNICODE); STRING_LITERAL: '"' (ESC | ~["\\])* '"'; // ID lexeme is used both for property names and pegasus identifiers. // Unlike pegasus identifiers, it may contain '-' since that is allowed in property names. // The parser further constrains this ID using PdlParseUtils.validatePegasusId when matching // pegasus identifiers. fragment UNESCAPED_ID: [A-Za-z_] [A-Za-z0-9_\-]*; fragment ESCAPED_ID: '`' UNESCAPED_ID '`'; ID: UNESCAPED_ID | ESCAPED_ID; // "insignificant commas" are used in this grammar. Commas may be added as desired // in source files, but they are treated as whitespace. WS: [ \t\n\r\f,]+ -> skip; // Property segments can be any group of regular chars without escaping. PROPERTY_ID: [A-Za-z0-9_\-]+; // Property segment id escaped with ` to include special characters in them. ESCAPED_PROP_ID: '`' (~[`])+ '`';
assets/assembly/IA32/linux_nasm_progs/nasm_linux_ORG_CH9/hex2char.asm
edassis/SB-Tradutor
1
161717
;Hex equivalent of characters HEX2CHAR.ASM ; ; Objective: To print the hex equivalent of ; ASCII character code. Demonstrates ; the use of xlat instruction. ; Input: Requests a character from keyboard. ; Output: Prints the ASCII code of the ; input character in hex. %include "io.mac" .DATA char_prompt db "Please input a character: ",0 out_msg1 db "The ASCII code of '",0 out_msg2 db "' in hex is ",0 query_msg db "Do you want to quit (Y/N): ",0 ; translation table: 4-bit binary to hex hex_table db "0123456789ABCDEF" .CODE .STARTUP read_char: PutStr char_prompt ; request a char. input GetCh AL ; read input character PutStr out_msg1 PutCh AL PutStr out_msg2 mov AH,AL ; save input character in AH mov EBX,hex_table ; BX := translation table shr AL,4 ; move upper 4 bits to lower half xlatb ; replace AL with hex digit PutCh AL ; write the first hex digit mov AL,AH ; restore input character to AL and AL,0FH ; mask off upper 4 bits xlatb PutCh AL ; write the second hex digit nwln PutStr query_msg ; query user whether to terminate GetCh AL ; read response cmp AL,'Y' ; if response is not 'Y' jne read_char ; read another character done: ; otherwise, terminate program .EXIT
src/fot/DistributiveLaws/README.agda
asr/fotc
11
13118
<reponame>asr/fotc<filename>src/fot/DistributiveLaws/README.agda ------------------------------------------------------------------------------ -- Distributive laws on a binary operation (Stanovský example) ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module DistributiveLaws.README where ------------------------------------------------------------------------------ -- Description -- Let _·_ be a left-associative binary operation which satifies the -- left and right distributive axioms: -- -- ∀ x y z → x ∙ (y ∙ z) ≡ (x ∙ y) ∙ (x ∙ z) -- ∀ x y z → (x ∙ y) ∙ z ≡ (x ∙ z) ∙ (y ∙ z). -- We prove some properties of Stanovský (2008): Task B, Lemma 3, -- Lemma 4, Lemma 5 (Task A) and Lemma 6. ------------------------------------------------------------------------------ -- The axioms open import DistributiveLaws.Base -- The interactive and combined proofs open import DistributiveLaws.Lemma3-ATP open import DistributiveLaws.Lemma4-ATP open import DistributiveLaws.Lemma5-ATP open import DistributiveLaws.Lemma6-ATP open import DistributiveLaws.TaskB-AllStepsATP open import DistributiveLaws.TaskB-HalvedStepsATP open import DistributiveLaws.TaskB-I open import DistributiveLaws.TaskB-TopDownATP -- Unproven theorem by the ATPs open import DistributiveLaws.TaskB.UnprovedATP ------------------------------------------------------------------------------ -- References: -- -- Stanovský, David (2008). Distributive Groupoids are -- Symmetrical-by-Medial: An Elementary Proof. Commentations -- Mathematicae Universitatis Carolinae 49.4, pp. 541–546.
oeis/227/A227347.asm
neoneye/loda-programs
11
7699
; A227347: Number of lattice points in the closed region bounded by the graphs of y = (5/6)*x^2, x = n, and y = 0, excluding points on the x-axis. ; 0,3,10,23,43,73,113,166,233,316,416,536,676,839,1026,1239,1479,1749,2049,2382,2749,3152,3592,4072,4592,5155,5762,6415,7115,7865,8665,9518,10425,11388,12408,13488,14628,15831,17098,18431,19831,21301,22841,24454,26141,27904,29744,31664,33664,35747,37914,40167,42507,44937,47457,50070,52777,55580,58480,61480,64580,67783,71090,74503,78023,81653,85393,89246,93213,97296,101496,105816,110256,114819,119506,124319,129259,134329,139529,144862,150329,155932,161672,167552,173572,179735,186042,192495,199095 mov $2,$0 mov $3,$0 lpb $3 mov $0,$2 sub $3,1 sub $0,$3 mov $5,$0 add $5,1 pow $5,2 mov $4,$5 mul $4,5 div $4,6 add $1,$4 lpe mov $0,$1
tests/inputs/test_dep_inst/test_R0_false_dep/R0_false_dep.asm
danielstumpp/tomasulo-simulator
0
96023
<reponame>danielstumpp/tomasulo-simulator add, R0, R1, R1 ld, F1, 0(R0)
oeis/157/A157668.asm
neoneye/loda-programs
11
175534
; A157668: a(n) = 729*n^2 - 442*n + 67. ; 354,2099,5302,9963,16082,23659,32694,43187,55138,68547,83414,99739,117522,136763,157462,179619,203234,228307,254838,282827,312274,343179,375542,409363,444642,481379,519574,559227,600338,642907,686934,732419,779362,827763,877622,928939,981714,1035947,1091638,1148787,1207394,1267459,1328982,1391963,1456402,1522299,1589654,1658467,1728738,1800467,1873654,1948299,2024402,2101963,2180982,2261459,2343394,2426787,2511638,2597947,2685714,2774939,2865622,2957763,3051362,3146419,3242934,3340907,3440338 seq $0,157669 ; a(n) = 19683*n - 5967. pow $0,2 sub $0,188128656 div $0,531441 add $0,354
programs/oeis/106/A106404.asm
neoneye/loda
22
81564
; A106404: Number of even semiprimes dividing n. ; 0,0,0,1,0,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,2,0,1,0,1,0,2,0,1,0,2,0,2,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,3,0,1,0,1,0,2,0,2,0,2,0,2,0,1,0,2,0,2,0,2,0,1,0,3,0,1,0,2,0,2,0,2,0,1,0,2,0,1,0,2 dif $0,-2 div $0,2 max $0,0 seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
source/connection.scpt
novelview9/alfred-workflow-toggle-airpods
0
2125
<filename>source/connection.scpt "Required setting your airpod!(setairpods)"
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2_notsx.log_1649_878.asm
ljhsiun2/medusa
9
19105
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x12424, %rsi lea addresses_A_ht+0x950c, %rdi nop nop nop nop nop and %rbp, %rbp mov $110, %rcx rep movsl nop nop add $33257, %r11 lea addresses_WT_ht+0x110dc, %r14 nop nop nop nop nop and %rbp, %rbp mov (%r14), %cx nop and $54493, %r14 lea addresses_D_ht+0xdeb4, %rdi nop nop nop nop cmp %rsi, %rsi mov (%rdi), %r14 cmp %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %rax push %rbx push %rsi // Faulty Load lea addresses_US+0x1e3f4, %r15 clflush (%r15) nop nop nop inc %r11 movb (%r15), %bl lea oracles, %r14 and $0xff, %rbx shlq $12, %rbx mov (%r14,%rbx,1), %rbx pop %rsi pop %rbx pop %rax pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} {'00': 1649} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
source/amf/uml/amf-uml-parameterable_elements.ads
svn2github/matreshka
24
24537
------------------------------------------------------------------------------ -- -- -- 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 parameterable element is an element that can be exposed as a formal -- template parameter for a template, or specified as an actual parameter in -- a binding of a template. ------------------------------------------------------------------------------ with AMF.UML.Elements; limited with AMF.UML.Template_Parameters; package AMF.UML.Parameterable_Elements is pragma Preelaborate; type UML_Parameterable_Element is limited interface and AMF.UML.Elements.UML_Element; type UML_Parameterable_Element_Access is access all UML_Parameterable_Element'Class; for UML_Parameterable_Element_Access'Storage_Size use 0; not overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Parameterable_Element) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is abstract; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. not overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Parameterable_Element; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is abstract; -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. not overriding function Get_Template_Parameter (Self : not null access constant UML_Parameterable_Element) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is abstract; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. not overriding procedure Set_Template_Parameter (Self : not null access UML_Parameterable_Element; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is abstract; -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. not overriding function Is_Compatible_With (Self : not null access constant UML_Parameterable_Element; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is abstract; -- Operation ParameterableElement::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. Subclasses -- should override this operation to specify different compatibility -- constraints. not overriding function Is_Template_Parameter (Self : not null access constant UML_Parameterable_Element) return Boolean is abstract; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. end AMF.UML.Parameterable_Elements;
src/main/antlr/adl/base_lexer.g4
openEHR/adl-antlr
1
5326
// // General purpose patterns used in all openEHR parser and lexer tools // author: <NAME> <<EMAIL>> // support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues> // copyright: Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org> // lexer grammar base_lexer; // ---------- whitespace & comments ---------- WS : [ \t\r]+ -> channel(HIDDEN) ; LINE : '\r'? EOL -> channel(HIDDEN) ; // increment line count CMT_LINE : '--' .*? '\r'? EOL -> skip ; // (increment line count) fragment EOL : '\n' ; // -------------- template overlay cannot be handled in a more simple way because it includes the comment line SYM_TEMPLATE_OVERLAY : H_CMT_LINE (WS|LINE)* SYM_TEMPLATE_OVERLAY_ONLY; fragment H_CMT_LINE : '--------' '-'*? ('\n'|'\r''\n'|'\r') ; // special type of comment for splitting template overlays fragment SYM_TEMPLATE_OVERLAY_ONLY : [Tt][Ee][Mm][Pp][Ll][Aa][Tt][Ee]'_'[Oo][Vv][Ee][Rr][Ll][Aa][Yy] ; // ---------- path patterns ----------- ADL_PATH : ADL_ABSOLUTE_PATH | ADL_RELATIVE_PATH; fragment ADL_ABSOLUTE_PATH : ('/' ADL_PATH_SEGMENT)+; fragment ADL_RELATIVE_PATH : ADL_PATH_SEGMENT ('/' ADL_PATH_SEGMENT)+; fragment ADL_PATH_SEGMENT : ALPHA_LC_ID ('[' ADL_PATH_ATTRIBUTE ']')?; fragment ADL_PATH_ATTRIBUTE : ID_CODE | STRING | INTEGER | ARCHETYPE_REF | ARCHETYPE_HRID; // ---------- ISO8601-based date/time/duration constraint patterns DATE_CONSTRAINT_PATTERN : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ; TIME_CONSTRAINT_PATTERN : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN ; DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ; DURATION_CONSTRAINT_PATTERN : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ; // date time pattern fragment YEAR_PATTERN : ( 'yyy' 'y'? ) | ( 'YYY' 'Y'? ) ; fragment MONTH_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx' ; fragment DAY_PATTERN : 'dd' | 'DD' | '??' | 'XX' | 'xx' ; fragment HOUR_PATTERN : 'hh' | 'HH' | '??' | 'XX' | 'xx' ; fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx' ; fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx' ; // ---------- Delimited Regex matcher ------------ // In ADL, a regexp can only exist between {}. // allows for '/' or '^' delimiters // logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^'; // The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars //a // regexp can only exist between {}. It can optionally have an assumed value, by adding ;"value" CONTAINED_REGEXP: '{'WS* (SLASH_REGEXP | CARET_REGEXP) WS* (';' WS* STRING)? WS* '}'; fragment SLASH_REGEXP: '/' SLASH_REGEXP_CHAR+ '/'; fragment SLASH_REGEXP_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/'; fragment CARET_REGEXP: '^' CARET_REGEXP_CHAR+ '^'; fragment CARET_REGEXP_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^'; // ---------- various ADL2 codes ------- ROOT_ID_CODE : 'id1' '.1'* ; ID_CODE : 'id' CODE_STR ; AT_CODE : 'at' CODE_STR ; AC_CODE : 'ac' CODE_STR ; fragment CODE_STR : ('0' | [1-9][0-9]*) ( '.' ('0' | [1-9][0-9]* ))* ; // ---------- ISO8601 Date/Time values ---------- ISO8601_DATE : YEAR '-' MONTH ( '-' DAY )? | YEAR '-' MONTH '-' UNKNOWN_DT | YEAR '-' UNKNOWN_DT '-' UNKNOWN_DT ; ISO8601_TIME : ( HOUR ':' MINUTE ( ':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)? | HOUR ':' MINUTE ':' UNKNOWN_DT | HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ; ISO8601_DATE_TIME : ( YEAR '-' MONTH '-' DAY 'T' HOUR (':' MINUTE (':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)?)? | YEAR '-' MONTH '-' DAY 'T' HOUR ':' MINUTE ':' UNKNOWN_DT | YEAR '-' MONTH '-' DAY 'T' HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ; fragment TIMEZONE : 'Z' | ('+'|'-') HOUR_MIN ; // hour offset, e.g. `+0930`, or else literal `Z` indicating +0000. fragment YEAR : [0-9][0-9][0-9][0-9] ; // Year in ISO8601:2004 is 4 digits with 0-filling as needed fragment MONTH : ( [0][1-9] | [1][0-2] ) ; // month in year fragment DAY : ( [0][1-9] | [12][0-9] | [3][0-1] ) ; // day in month fragment HOUR : ( [01]?[0-9] | [2][0-3] ) ; // hour in 24 hour clock fragment MINUTE : [0-5][0-9] ; // minutes fragment HOUR_MIN : ( [01]?[0-9] | [2][0-3] ) [0-5][0-9] ; // hour / minutes quad digit pattern fragment SECOND : [0-5][0-9] ; // seconds fragment SECOND_DEC_SEP : '.' | ',' ; fragment UNKNOWN_DT : '??' ; // any unknown date/time value, except years. // ISO8601 DURATION PnYnMnWnDTnnHnnMnn.nnnS // here we allow a deviation from the standard to allow weeks to be // mixed in with the rest since this commonly occurs in medicine // TODO: the following will incorrectly match just 'P' ISO8601_DURATION : '-'?'P' (DIGIT+ [yY])? (DIGIT+ [mM])? (DIGIT+ [wW])? (DIGIT+[dD])? ('T' (DIGIT+[hH])? (DIGIT+[mM])? (DIGIT+ (SECOND_DEC_SEP DIGIT+)?[sS])?)? ; // ------------------- special word symbols -------------- SYM_TRUE : [Tt][Rr][Uu][Ee] ; SYM_FALSE : [Ff][Aa][Ll][Ss][Ee] ; // ---------------------- Identifiers --------------------- ARCHETYPE_HRID : ARCHETYPE_HRID_ROOT '.v' ARCHETYPE_VERSION_ID ; ARCHETYPE_REF : ARCHETYPE_HRID_ROOT '.v' INTEGER ( '.' DIGIT+ )* ; fragment ARCHETYPE_HRID_ROOT : (NAMESPACE '::')? IDENTIFIER '-' IDENTIFIER '-' IDENTIFIER '.' LABEL ; fragment ARCHETYPE_VERSION_ID: DIGIT+ ('.' DIGIT+ ('.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )?)?)? ; VERSION_ID : DIGIT+ '.' DIGIT+ '.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )? ; fragment IDENTIFIER : ALPHA_CHAR WORD_CHAR* ; // --------------------- composed primitive types ------------------- // e.g. [ICD10AM(1998)::F23]; [ISO_639-1::en] TERM_CODE_REF : '[' TERM_CODE_CHAR+ ( '(' TERM_CODE_CHAR+ ')' )? '::' TERM_CODE_CHAR+ ']' ; fragment TERM_CODE_CHAR: NAME_CHAR | '.'; // --------------------- URIs -------------------- // URI recogniser based on https://tools.ietf.org/html/rfc3986 and // http://www.w3.org/Addressing/URL/5_URI_BNF.html EMBEDDED_URI: '<' ([ \t\r\n]|CMT_LINE)* URI ([ \t\r\n]|CMT_LINE)* '>'; fragment URI : URI_SCHEME ':' URI_HIER_PART ( '?' URI_QUERY )? ('#' URI_FRAGMENT)? ; fragment URI_HIER_PART : ( '//' URI_AUTHORITY ) URI_PATH_ABEMPTY | URI_PATH_ABSOLUTE | URI_PATH_ROOTLESS | URI_PATH_EMPTY; fragment URI_SCHEME : ALPHA_CHAR ( ALPHA_CHAR | DIGIT | '+' | '-' | '.')* ; fragment URI_AUTHORITY : ( URI_USERINFO '@' )? URI_HOST ( ':' URI_PORT )? ; fragment URI_USERINFO: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' )* ; fragment URI_HOST : URI_IP_LITERAL | URI_IPV4_ADDRESS | URI_REG_NAME ; //TODO: ipv6 fragment URI_PORT: DIGIT*; fragment URI_IP_LITERAL : '[' URI_IPV6_LITERAL ']'; //TODO, if needed: IPvFuture fragment URI_IPV4_ADDRESS : URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET ; fragment URI_IPV6_LITERAL : HEX_QUAD (':' HEX_QUAD )* ':' ':' HEX_QUAD (':' HEX_QUAD )* ; fragment URI_DEC_OCTET : DIGIT | [1-9] DIGIT | '1' DIGIT DIGIT | '2' [0-4] DIGIT | '25' [0-5]; fragment URI_REG_NAME: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS)*; fragment HEX_QUAD : HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; fragment URI_PATH_ABEMPTY: ('/' URI_SEGMENT ) *; fragment URI_PATH_ABSOLUTE: '/' ( URI_SEGMENT_NZ ( '/' URI_SEGMENT )* )?; fragment URI_PATH_NOSCHEME: URI_SEGMENT_NZ_NC ( '/' URI_SEGMENT )*; fragment URI_PATH_ROOTLESS: URI_SEGMENT_NZ ( '/' URI_SEGMENT )*; fragment URI_PATH_EMPTY: ; fragment URI_SEGMENT: URI_PCHAR*; fragment URI_SEGMENT_NZ: URI_PCHAR+; fragment URI_SEGMENT_NZ_NC: ( URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | '@' )+; //non-zero-length segment without any colon ":" fragment URI_PCHAR: URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' | '@'; //fragment URI_PATH : '/' | ( '/' URI_XPALPHA+ )+ ('/')?; fragment URI_QUERY : (URI_PCHAR | '/' | '?')*; fragment URI_FRAGMENT : (URI_PCHAR | '/' | '?')*; fragment URI_PCT_ENCODED : '%' HEX_DIGIT HEX_DIGIT ; fragment URI_UNRESERVED: ALPHA_CHAR | DIGIT | '-' | '.' | '_' | '~'; fragment URI_RESERVED: URI_GEN_DELIMS | URI_SUB_DELIMS; fragment URI_GEN_DELIMS: ':' | '/' | '?' | '#' | '[' | ']' | '@'; //TODO: migrate to [/?#...] notation fragment URI_SUB_DELIMS: '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | ';' | '='; // According to IETF http://tools.ietf.org/html/rfc1034[RFC 1034] and http://tools.ietf.org/html/rfc1035[RFC 1035], // as clarified by http://tools.ietf.org/html/rfc2181[RFC 2181] (section 11) fragment NAMESPACE : LABEL ('.' LABEL)* ; fragment LABEL : ALPHA_CHAR (NAME_CHAR|URI_PCT_ENCODED)* ; GUID : HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ ; ALPHA_UC_ID : ALPHA_UCHAR WORD_CHAR* ; // used for type ids ALPHA_LC_ID : ALPHA_LCHAR WORD_CHAR* ; // used for attribute / method ids ALPHA_UNDERSCORE_ID : '_' WORD_CHAR* ; // usually used for meta-model ids // --------------------- atomic primitive types ------------------- INTEGER : DIGIT+ E_SUFFIX? ; REAL : DIGIT+ '.' DIGIT+ E_SUFFIX? ; fragment E_SUFFIX : [eE][+-]? DIGIT+ ; STRING : '"' STRING_CHAR*? '"' ; fragment STRING_CHAR : ~["\\] | ESCAPE_SEQ | UTF8CHAR ; // strings can be multi-line CHARACTER : '\'' CHAR '\'' ; fragment CHAR : ~['\\\r\n] | ESCAPE_SEQ | UTF8CHAR ; fragment ESCAPE_SEQ: '\\' ['"?abfnrtv\\] ; // ------------------- character fragments ------------------ fragment NAME_CHAR : WORD_CHAR | '-' ; fragment WORD_CHAR : ALPHANUM_CHAR | '_' ; fragment ALPHANUM_CHAR : ALPHA_CHAR | DIGIT ; fragment ALPHA_CHAR : [a-zA-Z] ; fragment ALPHA_UCHAR : [A-Z] ; fragment ALPHA_LCHAR : [a-z] ; fragment UTF8CHAR : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; fragment DIGIT : [0-9] ; fragment HEX_DIGIT : [0-9a-fA-F] ; // -------------------- common symbols --------------------- SYM_COMMA: ',' ; SYM_SEMI_COLON : ';' ; SYM_LPAREN : '('; SYM_RPAREN : ')'; SYM_LBRACKET : '['; SYM_RBRACKET : ']'; SYM_LCURLY : '{' ; SYM_RCURLY : '}' ; // --------- symbols ---------- SYM_ASSIGNMENT: ':=' | '::=' ; SYM_NE : '/=' | '!=' | '≠' ; SYM_EQ : '=' ; SYM_GT : '>' ; SYM_LT : '<' ; SYM_LE : '<=' | '≤' ; SYM_GE : '>=' | '≥' ; // TODO: remove when [] path predicates supported VARIABLE_WITH_PATH: VARIABLE_ID ADL_ABSOLUTE_PATH ; VARIABLE_ID: '$' ALPHA_LC_ID ; // // ========================= Lexer ============================ // // -------------------- symbols for lists ------------------------ SYM_LIST_CONTINUE: '...' ; // ------------------ symbols for intervals ---------------------- SYM_PLUS : '+' ; SYM_MINUS : '-' ; SYM_PLUS_OR_MINUS : '+/-' | '±' ; SYM_PERCENT : '%' ; SYM_CARAT: '^' ; SYM_IVL_DELIM: '|' ; SYM_IVL_SEP : '..' ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/lto20.adb
best08618/asylo
7
28790
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/lto20.adb -- { dg-do run } -- { dg-options "-flto" { target lto } } -- { dg-excess-errors "does not match original declaration" } with Lto20_Pkg; procedure Lto20 is begin Lto20_Pkg.Proc (Lto20_Pkg.Null_Arr); end;
tests/tkmrpc-servers-ike__mock.adb
DrenfongWong/tkm-rpc
0
15483
-- -- Copyright (C) 2013 <NAME> <<EMAIL>> -- Copyright (C) 2013 <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: -- 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 University 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 REGENTS 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 REGENTS 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. -- with Tkmrpc.Mock; package body Tkmrpc.Servers.Ike is ------------------------------------------------------------------------- procedure Ae_Reset (Result : out Results.Result_Type; Ae_Id : Types.Ae_Id_Type) is pragma Unreferenced (Ae_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Ae_Reset; ------------------------------------------------------------------------- procedure Cc_Add_Certificate (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type; Autha_Id : Types.Autha_Id_Type; Certificate : Types.Certificate_Type) is pragma Unreferenced (Cc_Id); pragma Unreferenced (Autha_Id); pragma Unreferenced (Certificate); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Cc_Add_Certificate; ------------------------------------------------------------------------- procedure Cc_Check_Ca (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type; Ca_Id : Types.Ca_Id_Type) is pragma Unreferenced (Cc_Id); pragma Unreferenced (Ca_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Cc_Check_Ca; ------------------------------------------------------------------------- procedure Cc_Reset (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type) is pragma Unreferenced (Cc_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Cc_Reset; ------------------------------------------------------------------------- procedure Cc_Set_User_Certificate (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type; Ri_Id : Types.Ri_Id_Type; Autha_Id : Types.Autha_Id_Type; Certificate : Types.Certificate_Type) is pragma Unreferenced (Cc_Id); pragma Unreferenced (Ri_Id); pragma Unreferenced (Autha_Id); pragma Unreferenced (Certificate); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Cc_Set_User_Certificate; ------------------------------------------------------------------------- procedure Dh_Create (Result : out Results.Result_Type; Dh_Id : Types.Dh_Id_Type; Dha_Id : Types.Dha_Id_Type; Pubvalue : out Types.Dh_Pubvalue_Type) is pragma Unreferenced (Dh_Id); pragma Unreferenced (Dha_Id); pragma Unreferenced (Pubvalue); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Dh_Create; ------------------------------------------------------------------------- procedure Dh_Generate_Key (Result : out Results.Result_Type; Dh_Id : Types.Dh_Id_Type; Pubvalue : Types.Dh_Pubvalue_Type) is pragma Unreferenced (Dh_Id); use type Types.Byte_Sequence; Size : constant Natural := Natural (Pubvalue.Size); begin if Pubvalue.Size = Mock.Ref_Dh_Pubvalue.Size and then Pubvalue.Data (1 .. Size) = Mock.Ref_Dh_Pubvalue.Data (1 .. Size) then Result := Results.Ok; else Result := Results.Invalid_Parameter; end if; end Dh_Generate_Key; ------------------------------------------------------------------------- procedure Dh_Reset (Result : out Results.Result_Type; Dh_Id : Types.Dh_Id_Type) is pragma Unreferenced (Dh_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Dh_Reset; ------------------------------------------------------------------------- procedure Esa_Create (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type; Isa_Id : Types.Isa_Id_Type; Sp_Id : Types.Sp_Id_Type; Ea_Id : Types.Ea_Id_Type; Dh_Id : Types.Dh_Id_Type; Nc_Loc_Id : Types.Nc_Id_Type; Nonce_Rem : Types.Nonce_Type; Initiator : Types.Init_Type; Esp_Spi_Loc : Types.Esp_Spi_Type; Esp_Spi_Rem : Types.Esp_Spi_Type) is pragma Unreferenced (Esa_Id); pragma Unreferenced (Isa_Id); pragma Unreferenced (Sp_Id); pragma Unreferenced (Ea_Id); pragma Unreferenced (Dh_Id); pragma Unreferenced (Nc_Loc_Id); pragma Unreferenced (Nonce_Rem); pragma Unreferenced (Initiator); pragma Unreferenced (Esp_Spi_Loc); pragma Unreferenced (Esp_Spi_Rem); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Esa_Create; ------------------------------------------------------------------------- procedure Esa_Create_First (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type; Isa_Id : Types.Isa_Id_Type; Sp_Id : Types.Sp_Id_Type; Ea_Id : Types.Ea_Id_Type; Esp_Spi_Loc : Types.Esp_Spi_Type; Esp_Spi_Rem : Types.Esp_Spi_Type) is pragma Unreferenced (Esa_Id); pragma Unreferenced (Isa_Id); pragma Unreferenced (Sp_Id); pragma Unreferenced (Ea_Id); pragma Unreferenced (Esp_Spi_Loc); pragma Unreferenced (Esp_Spi_Rem); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Esa_Create_First; ------------------------------------------------------------------------- procedure Esa_Create_No_Pfs (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type; Isa_Id : Types.Isa_Id_Type; Sp_Id : Types.Sp_Id_Type; Ea_Id : Types.Ea_Id_Type; Nc_Loc_Id : Types.Nc_Id_Type; Nonce_Rem : Types.Nonce_Type; Initiator : Types.Init_Type; Esp_Spi_Loc : Types.Esp_Spi_Type; Esp_Spi_Rem : Types.Esp_Spi_Type) is pragma Unreferenced (Esa_Id); pragma Unreferenced (Isa_Id); pragma Unreferenced (Sp_Id); pragma Unreferenced (Ea_Id); pragma Unreferenced (Nc_Loc_Id); pragma Unreferenced (Nonce_Rem); pragma Unreferenced (Initiator); pragma Unreferenced (Esp_Spi_Loc); pragma Unreferenced (Esp_Spi_Rem); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Esa_Create_No_Pfs; ------------------------------------------------------------------------- procedure Esa_Reset (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type) is pragma Unreferenced (Esa_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Esa_Reset; ------------------------------------------------------------------------- procedure Esa_Select (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type) is pragma Unreferenced (Esa_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Esa_Select; ------------------------------------------------------------------------- procedure Finalize is begin null; end Finalize; ------------------------------------------------------------------------- procedure Init is begin null; end Init; ------------------------------------------------------------------------- procedure Isa_Auth (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type; Cc_Id : Types.Cc_Id_Type; Init_Message : Types.Init_Message_Type; Signature : Types.Signature_Type) is pragma Unreferenced (Isa_Id); pragma Unreferenced (Cc_Id); pragma Unreferenced (Init_Message); pragma Unreferenced (Signature); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Auth; ------------------------------------------------------------------------- procedure Isa_Create (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type; Ae_Id : Types.Ae_Id_Type; Ia_Id : Types.Ia_Id_Type; Dh_Id : Types.Dh_Id_Type; Nc_Loc_Id : Types.Nc_Id_Type; Nonce_Rem : Types.Nonce_Type; Initiator : Types.Init_Type; Spi_Loc : Types.Ike_Spi_Type; Spi_Rem : Types.Ike_Spi_Type; Sk_Ai : out Types.Key_Type; Sk_Ar : out Types.Key_Type; Sk_Ei : out Types.Key_Type; Sk_Er : out Types.Key_Type) is pragma Unreferenced (Isa_Id); pragma Unreferenced (Ae_Id); pragma Unreferenced (Ia_Id); pragma Unreferenced (Dh_Id); pragma Unreferenced (Nc_Loc_Id); pragma Unreferenced (Nonce_Rem); pragma Unreferenced (Initiator); pragma Unreferenced (Spi_Loc); pragma Unreferenced (Spi_Rem); pragma Unreferenced (Sk_Ai); pragma Unreferenced (Sk_Ar); pragma Unreferenced (Sk_Ei); pragma Unreferenced (Sk_Er); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Create; ------------------------------------------------------------------------- procedure Isa_Create_Child (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type; Parent_Isa_Id : Types.Isa_Id_Type; Ia_Id : Types.Ia_Id_Type; Dh_Id : Types.Dh_Id_Type; Nc_Loc_Id : Types.Nc_Id_Type; Nonce_Rem : Types.Nonce_Type; Initiator : Types.Init_Type; Spi_Loc : Types.Ike_Spi_Type; Spi_Rem : Types.Ike_Spi_Type; Sk_Ai : out Types.Key_Type; Sk_Ar : out Types.Key_Type; Sk_Ei : out Types.Key_Type; Sk_Er : out Types.Key_Type) is pragma Unreferenced (Isa_Id); pragma Unreferenced (Parent_Isa_Id); pragma Unreferenced (Ia_Id); pragma Unreferenced (Dh_Id); pragma Unreferenced (Nc_Loc_Id); pragma Unreferenced (Nonce_Rem); pragma Unreferenced (Initiator); pragma Unreferenced (Spi_Loc); pragma Unreferenced (Spi_Rem); pragma Unreferenced (Sk_Ai); pragma Unreferenced (Sk_Ar); pragma Unreferenced (Sk_Ei); pragma Unreferenced (Sk_Er); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Create_Child; ------------------------------------------------------------------------- procedure Isa_Reset (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type) is pragma Unreferenced (Isa_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Reset; ------------------------------------------------------------------------- procedure Isa_Sign (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type; Lc_Id : Types.Lc_Id_Type; Init_Message : Types.Init_Message_Type; Signature : out Types.Signature_Type) is pragma Unreferenced (Isa_Id); pragma Unreferenced (Lc_Id); pragma Unreferenced (Init_Message); pragma Unreferenced (Signature); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Sign; ------------------------------------------------------------------------- procedure Isa_Skip_Create_First (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type) is pragma Unreferenced (Isa_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Isa_Skip_Create_First; ------------------------------------------------------------------------- procedure Nc_Create (Result : out Results.Result_Type; Nc_Id : Types.Nc_Id_Type; Nonce_Length : Types.Nonce_Length_Type; Nonce : out Types.Nonce_Type) is begin Mock.Last_Nonce_Id := Nc_Id; Mock.Last_Nonce_Length := Nonce_Length; Nonce := Mock.Ref_Nonce; Result := Results.Ok; end Nc_Create; ------------------------------------------------------------------------- procedure Nc_Reset (Result : out Results.Result_Type; Nc_Id : Types.Nc_Id_Type) is pragma Unreferenced (Nc_Id); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Nc_Reset; ------------------------------------------------------------------------- procedure Tkm_Limits (Result : out Results.Result_Type; Max_Active_Requests : out Types.Active_Requests_Type; Nc_Contexts : out Types.Nc_Id_Type; Dh_Contexts : out Types.Dh_Id_Type; Cc_Contexts : out Types.Cc_Id_Type; Ae_Contexts : out Types.Ae_Id_Type; Isa_Contexts : out Types.Isa_Id_Type; Esa_Contexts : out Types.Esa_Id_Type) is pragma Unreferenced (Max_Active_Requests); pragma Unreferenced (Nc_Contexts); pragma Unreferenced (Dh_Contexts); pragma Unreferenced (Cc_Contexts); pragma Unreferenced (Ae_Contexts); pragma Unreferenced (Isa_Contexts); pragma Unreferenced (Esa_Contexts); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Tkm_Limits; ------------------------------------------------------------------------- procedure Tkm_Reset (Result : out Results.Result_Type) is begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Tkm_Reset; ------------------------------------------------------------------------- procedure Tkm_Version (Result : out Results.Result_Type; Version : out Types.Version_Type) is pragma Unreferenced (Version); begin -- Auto-generated stub. Result := Results.Invalid_Operation; end Tkm_Version; end Tkmrpc.Servers.Ike;
oeis/293/A293614.asm
neoneye/loda-programs
11
26553
<gh_stars>10-100 ; A293614: a(n) = (8*n + 18)*Pochhammer(n, 6) / 6!. ; Submitted by <NAME> ; 0,26,238,1176,4200,12180,30492,68376,140712,270270,490490,848848,1410864,2264808,3527160,5348880,7922544,11490402,16353414,22881320,31523800,42822780,57425940,76101480,99754200,129442950,166399506,212048928,268031456,336226000,418775280,518112672,636990816,778512042,946160670,1143837240,1375894728,1647176804,1963058188,2329487160,2753030280,3240919374,3801100842,4442287344,5174011920,6006684600,6951651560,8021256880,9228906960,10589137650,12117684150,13831553736,15749101368,17890108236 mov $1,$0 add $0,5 bin $0,$1 mul $1,2 mul $0,$1 add $1,5 mul $1,$0 div $0,2 sub $1,$0 mov $0,$1 div $0,3
programs/oeis/078/A078716.asm
jmorken/loda
1
14929
; A078716: Sequence has period 9 and differences between successive terms are 4, -3, 4, -3, 4, -3, 4, -3, -4. ; 1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1,5,2,6,3,7,4,8,5,1 mod $0,9 mov $1,$0 mov $2,7 lpb $0 div $0,2 mul $0,2 mul $2,2 lpe add $1,$2 sub $1,7 div $1,2 add $1,1
reo-interpreter/src/main/antlr4/nl/cwi/reo/interpret/RBA.g4
kasperdokter/Reo-compiler
9
6497
grammar RBA; import Tokens; rba : '#RBA' rba_initial* rba_rule* ; rba_initial : '$' ID '=' rba_term ';' ; rba_rule : ('{' (rba_port (',' rba_port)* )? '}')? rba_formula; rba_port : ID #rba_syncFire | '~'ID #rba_syncBlock ; rba_formula : 'true' #rba_true | 'false' #rba_false | '!' rba_formula #rba_negation | rba_formula (',' rba_formula)+ #rba_conjunction | '(' rba_formula ')' #rba_def | ID '(' rba_term (',' rba_term)* ')' #rba_relation | rba_term '=' rba_term #rba_equality | rba_term '!=' rba_term #rba_inequality; rba_term : NAT #rba_nat | BOOL #rba_bool | STRING #rba_string | DEC #rba_decimal | ID '(' rba_term (',' rba_term)* ')' #rba_function | '[' rba_term ':' rba_term (',' rba_term ':' rba_term)* ']' #rba_distribution | '$' ID #rba_memorycellIn | '$' ID '\'' #rba_memorycellOut | 'null' #rba_null | '*' #rba_null_ctxt | ID #rba_parameter | MIN rba_term # rba_unarymin | rba_term op=(MUL | DIV | MOD | ADD | MIN) rba_term # rba_operation ;
ada-strings-wide_maps-wide_constants.ads
mgrojo/adalib
15
10643
<filename>ada-strings-wide_maps-wide_constants.ads -- Standard Ada library specification -- Copyright (c) 2003-2018 <NAME> <<EMAIL>> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- package Ada.Strings.Wide_Maps.Wide_Constants is pragma Preelaborate (Wide_Constants); Control_Set : constant Wide_Character_Set; Graphic_Set : constant Wide_Character_Set; Letter_Set : constant Wide_Character_Set; Lower_Set : constant Wide_Character_Set; Upper_Set : constant Wide_Character_Set; Basic_Set : constant Wide_Character_Set; Decimal_Digit_Set : constant Wide_Character_Set; Hexadecimal_Digit_Set : constant Wide_Character_Set; Alphanumeric_Set : constant Wide_Character_Set; Special_Set : constant Wide_Character_Set; ISO_646_Set : constant Wide_Character_Set; Character_Set : constant Wide_Character_Set; -- Contains each Wide_Character value WC such that -- Characters.Conversions.Is_Character(WC) is True Lower_Case_Map : constant Wide_Character_Mapping; -- Wide_Maps to lower case for letters, else identity Upper_Case_Map : constant Wide_Character_Mapping; -- Wide_Maps to upper case for letters, else identity Basic_Map : constant Wide_Character_Mapping; -- Wide_Maps to basic letter for letters, else identity private pragma Import (Ada, Control_Set); pragma Import (Ada, Graphic_Set); pragma Import (Ada, Letter_Set); pragma Import (Ada, Lower_Set); pragma Import (Ada, Upper_Set); pragma Import (Ada, Basic_Set); pragma Import (Ada, Decimal_Digit_Set); pragma Import (Ada, Hexadecimal_Digit_Set); pragma Import (Ada, Alphanumeric_Set); pragma Import (Ada, Special_Set); pragma Import (Ada, ISO_646_Set); pragma Import (Ada, Lower_Case_Map); pragma Import (Ada, Upper_Case_Map); pragma Import (Ada, Basic_Map); pragma Import (Ada, Character_Set); end Ada.Strings.Wide_Maps.Wide_Constants;
alloy4fun_models/trashltl/models/9/WL9kxXCPezFy6vgw2.als
Kaixi26/org.alloytools.alloy
0
61
open main pred idWL9kxXCPezFy6vgw2_prop10 { all f:File | always (f in Protected) since f in Protected } pred __repair { idWL9kxXCPezFy6vgw2_prop10 } check __repair { idWL9kxXCPezFy6vgw2_prop10 <=> prop10o }
a10.asm
Sahilsinggh/MP_SEM4
1
15537
<reponame>Sahilsinggh/MP_SEM4<filename>a10.asm global main extern printf,scanf; %macro _printf 3 pop qword[stack]; mov rdi,%1; movsd xmm0,qword[%2]; //MOVSD — Move Scalar Double-Precision Floating-Point Value movsd xmm1,qword[%3]; mov rax,2; call printf push qword[stack]; %endmacro %macro _scanf 1 pop qword[stack]; mov rdi,readFormat; mov rsi,rsp; call scanf; mov rax,qword[rsp]; mov qword[%1],rax; push qword[stack]; %endmacro %macro print 2 mov rax,1; mov rdi,1; mov rsi,%1; mov rdx,%2; syscall %endmacro section .data eqn: db "Ax^2 + Bx + C = 0",10; lenEqn: equ $-eqn; reqA: db "Coefficient of x^2 (A): "; lenReqA: equ $-reqA; reqB: db "Coefficient of x (B): "; lenReqB: equ $-reqB; reqC: db "Constant (C): "; lenReqC: equ $-reqC; rootsMsg: db "Roots:",10; lenRootsMsg: equ $-rootsMsg; root1Format: db "%lf + %lf i",10,0; root2Format: db "%lf - %lf i",10,0; readFormat: db "%lf",0; space: db " "; newLine: db 10d; zero: dq 0.0; two: dq 2.0; four: dq 4.0; section .bss stack: resq 1; a: resq 1; b: resq 1; c: resq 1; bSquare: resq 1; //b^2 fourAC: resq 1; //4ac twoA: resq 1; //2a d: resq 1; //d=b^2-4ac (determinant) rootD: resq 1; //d^(1/2) root1: resq 1; //First Root root2: resq 1; //Second Root real: resq 1; //real Part of the root img: resq 1; //imaginary part of the root section .text main: finit; print eqn,lenEqn; print newLine,1; print reqA,lenReqA; _scanf a; print reqB,lenReqB; _scanf b; print reqC,lenReqC; _scanf c; fld qword[b]; fmul qword[b]; fstp qword[bSquare]; fld qword[two]; fmul qword[a]; fstp qword[twoA]; fld qword[four]; fmul qword[a]; fmul qword[c]; fstp qword[fourAC]; fld qword[bSquare]; fsub qword[fourAC]; fstp qword[d]; ;btr - bit test and reset btr qword[d],63; //check and reset signBit of d (determinant), if negative carry flag is set jc negativeD positiveD: fld qword[d]; fsqrt; fstp qword[rootD]; fldz; //loads 0.0 onto the stack fsub qword[b]; fadd qword[rootD]; fdiv qword[twoA]; fstp qword[root1]; fldz; fsub qword[b]; fsub qword[rootD]; fdiv qword[twoA]; fstp qword[root2]; print newLine,1; print rootsMsg,lenRootsMsg; _printf root1Format,root1,zero; _printf root1Format,root2,zero; jmp exit; negativeD: fld qword[d]; fsqrt; fstp qword[rootD]; fldz fsub qword[b]; fdiv qword[twoA]; fstp qword[real]; fld qword[rootD]; fdiv qword[twoA]; fstp qword[img]; print newLine,1; print rootsMsg,lenRootsMsg; _printf root1Format,real,img; _printf root2Format,real,img; exit: mov rax,60; mov rdi,00; syscall;
src/Polynomial/Simple/Solver.agda
mckeankylej/agda-ring-solver
36
10718
{-# OPTIONS --without-K --safe #-} module Polynomial.Simple.Solver where open import Polynomial.Expr public open import Polynomial.Simple.AlmostCommutativeRing public hiding (-raw-almostCommutative⟶) open import Data.Vec hiding (_⊛_) open import Algebra.Solver.Ring.AlmostCommutativeRing using (-raw-almostCommutative⟶) open import Polynomial.Parameters open import Function open import Data.Maybe open import Data.Vec.N-ary open import Data.Bool using (Bool; true; false; T; if_then_else_) open import Data.Empty using (⊥-elim) module Ops {ℓ₁ ℓ₂} (ring : AlmostCommutativeRing ℓ₁ ℓ₂) where open AlmostCommutativeRing ring zero-homo : ∀ x → T (is-just (0≟ x)) → 0# ≈ x zero-homo x _ with 0≟ x zero-homo x _ | just p = p zero-homo x () | nothing homo : Homomorphism ℓ₁ ℓ₂ ℓ₁ ℓ₂ homo = record { coeffs = record { coeffs = AlmostCommutativeRing.rawRing ring ; Zero-C = λ x → is-just (0≟ x) } ; ring = record { isAlmostCommutativeRing = record { isCommutativeSemiring = isCommutativeSemiring ; -‿cong = -‿cong ; -‿*-distribˡ = -‿*-distribˡ ; -‿+-comm = -‿+-comm } } ; morphism = -raw-almostCommutative⟶ _ ; Zero-C⟶Zero-R = zero-homo } ⟦_⟧ : ∀ {n} → Expr Carrier n → Vec Carrier n → Carrier ⟦ Κ x ⟧ ρ = x ⟦ Ι x ⟧ ρ = lookup ρ x ⟦ x ⊕ y ⟧ ρ = ⟦ x ⟧ ρ + ⟦ y ⟧ ρ ⟦ x ⊗ y ⟧ ρ = ⟦ x ⟧ ρ * ⟦ y ⟧ ρ ⟦ ⊝ x ⟧ ρ = - ⟦ x ⟧ ρ ⟦ x ⊛ i ⟧ ρ = ⟦ x ⟧ ρ ^ i open import Polynomial.NormalForm.Definition (Homomorphism.coeffs homo) open import Polynomial.NormalForm.Operations (Homomorphism.coeffs homo) norm : ∀ {n} → Expr Carrier n → Poly n norm = go where go : ∀ {n} → Expr Carrier n → Poly n go (Κ x) = κ x go (Ι x) = ι x go (x ⊕ y) = go x ⊞ go y go (x ⊗ y) = go x ⊠ go y go (⊝ x) = ⊟ go x go (x ⊛ i) = go x ⊡ i ⟦_⇓⟧ : ∀ {n} → Expr Carrier n → Vec Carrier n → Carrier ⟦ expr ⇓⟧ = ⟦ norm expr ⟧ₚ where open import Polynomial.NormalForm.Semantics homo renaming (⟦_⟧ to ⟦_⟧ₚ) correct : ∀ {n} (expr : Expr Carrier n) ρ → ⟦ expr ⇓⟧ ρ ≈ ⟦ expr ⟧ ρ correct {n = n} = go where open import Polynomial.Homomorphism homo go : ∀ (expr : Expr Carrier n) ρ → ⟦ expr ⇓⟧ ρ ≈ ⟦ expr ⟧ ρ go (Κ x) ρ = κ-hom x ρ go (Ι x) ρ = ι-hom x ρ go (x ⊕ y) ρ = ⊞-hom (norm x) (norm y) ρ ⟨ trans ⟩ (go x ρ ⟨ +-cong ⟩ go y ρ) go (x ⊗ y) ρ = ⊠-hom (norm x) (norm y) ρ ⟨ trans ⟩ (go x ρ ⟨ *-cong ⟩ go y ρ) go (⊝ x) ρ = ⊟-hom (norm x) ρ ⟨ trans ⟩ -‿cong (go x ρ) go (x ⊛ i) ρ = ⊡-hom (norm x) i ρ ⟨ trans ⟩ pow-cong i (go x ρ) open import Relation.Binary.Reflection setoid Ι ⟦_⟧ ⟦_⇓⟧ correct public open import Data.Nat using (ℕ) open import Data.Product solve : ∀ {ℓ₁ ℓ₂} → (ring : AlmostCommutativeRing ℓ₁ ℓ₂) → (n : ℕ) → (f : N-ary n (Expr (AlmostCommutativeRing.Carrier ring) n) (Expr (AlmostCommutativeRing.Carrier ring) n × Expr (AlmostCommutativeRing.Carrier ring) n)) → Eqʰ n (AlmostCommutativeRing._≈_ ring) (curryⁿ (Ops.⟦_⇓⟧ ring (proj₁ (Ops.close ring n f)))) (curryⁿ (Ops.⟦_⇓⟧ ring (proj₂ (Ops.close ring n f)))) → Eq n (AlmostCommutativeRing._≈_ ring) (curryⁿ (Ops.⟦_⟧ ring (proj₁ (Ops.close ring n f)))) (curryⁿ (Ops.⟦_⟧ ring (proj₂ (Ops.close ring n f)))) solve ring = solve′ where open Ops ring renaming (solve to solve′) {-# INLINE solve #-} _⊜_ : ∀ {ℓ₁ ℓ₂} → (ring : AlmostCommutativeRing ℓ₁ ℓ₂) → (n : ℕ) → Expr (AlmostCommutativeRing.Carrier ring) n → Expr (AlmostCommutativeRing.Carrier ring) n → Expr (AlmostCommutativeRing.Carrier ring) n × Expr (AlmostCommutativeRing.Carrier ring) n _⊜_ _ _ = _,_ {-# INLINE _⊜_ #-}
data/maps/headers/SSAnneCaptainsRoom.asm
opiter09/ASM-Machina
1
102467
map_header SSAnneCaptainsRoom, SS_ANNE_CAPTAINS_ROOM, SHIP, 0 end_map_header
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1155.asm
ljhsiun2/medusa
9
177282
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1155.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rbp lea addresses_normal_ht+0xe93, %r8 xor %r15, %r15 movb (%r8), %r10b nop nop inc %r13 pop %rbp pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %r9 push %rax push %rdi // Store lea addresses_A+0x11d4b, %r13 nop dec %r12 mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%r13) nop nop nop nop nop and $14402, %r12 // Faulty Load mov $0x2b1be9000000078b, %r10 nop nop nop nop nop inc %rdi mov (%r10), %r9d lea oracles, %rax and $0xff, %r9 shlq $12, %r9 mov (%rax,%r9,1), %r9 pop %rdi pop %rax pop %r9 pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
stm32f1/stm32gd-usb-peripheral.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
8126
with Ada.Interrupts.Names; with STM32GD.USB; generic with function EP0_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP1_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP2_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP3_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP4_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP5_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP6_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with function EP7_Reset_Callback (BTable_Offset : Integer) return Integer is STM32GD.USB.EP_Unused_Reset; with procedure EP0_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP1_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP2_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP3_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP4_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP5_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP6_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; with procedure EP7_Handler_Callback (Out_Transaction : Boolean) is STM32GD.USB.EP_Unused_Handler; package STM32GD.USB.Peripheral is procedure Init; procedure Handle_Reset; protected Handler is pragma Interrupt_Priority; private procedure IRQ_Handler; pragma Attach_Handler (IRQ_Handler, Ada.Interrupts.Names.USB_LP_CAN_RX0); end Handler; end STM32GD.USB.Peripheral;
Asm4Kids/18loop.asm
jacmoe/c64adventures
17
174081
<filename>Asm4Kids/18loop.asm ; loop using cpx (compare x) and bne (branch is not equal) ; prints a-z ; 10 SYS (49152) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $39, $31, $35, $32, $29, $00, $00, $00 *=$c000 jsr $e544 ldx #65 ; initialize x with 65 - ASCII a loop txa ; transfer x to accumulator jsr $e716 ; print it to the screen inx ; increment x cpx #91 ; compare x with 91 bne loop ; if x <> 91 then branch back to loop rts
programs/oeis/027/A027084.asm
karttu/loda
0
176311
; A027084: G.f.: x^2*(x^2 + x + 1)/(x^4 - 2*x + 1). ; 1,3,7,14,27,51,95,176,325,599,1103,2030,3735,6871,12639,23248,42761,78651,144663,266078,489395,900139,1655615,3045152,5600909,10301679,18947743,34850334,64099759,117897839,216847935,398845536 mov $2,$0 add $2,1 mov $4,$0 lpb $2,1 mov $0,$4 sub $2,1 sub $0,$2 cal $0,301657 ; Number of nX3 0..1 arrays with every element equal to 0, 1 or 4 horizontally or vertically adjacent elements, with upper left element zero. sub $0,1 mov $3,$0 sub $3,1 add $1,$3 lpe
programs/oeis/002/A002265.asm
neoneye/loda
22
85657
<reponame>neoneye/loda<gh_stars>10-100 ; A002265: Nonnegative integers repeated 4 times. ; 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24 div $0,4
test/asset/agda-stdlib-1.0/Level/Literals.agda
omega12345/agda-mode
5
442
<filename>test/asset/agda-stdlib-1.0/Level/Literals.agda<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Conversion from naturals to universe levels ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Level.Literals where open import Agda.Builtin.Nat renaming (Nat to ℕ) open import Agda.Builtin.FromNat open import Agda.Builtin.Unit open import Level using (Level; 0ℓ) -- Increase a Level by a number of sucs. _ℕ+_ : ℕ → Level → Level zero ℕ+ ℓ = ℓ suc n ℕ+ ℓ = Level.suc (n ℕ+ ℓ) -- Nat-computed Level. infix 10 #_ #_ : ℕ → Level #_ = _ℕ+ 0ℓ -- Literal overloading for levels. Levelℕ : Number Level Levelℕ .Number.Constraint _ = ⊤ Levelℕ .Number.fromNat n = # n
dino/lcs/base/782.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
167024
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D20 move.l D0, (A4)+ 004D22 move.l D0, (A4)+ 020800 move.w ($6,A0), ($46,A6) [base+77E, base+780] 020806 move.w ($8,A0), ($48,A6) 020842 move.w ($46,A6), D0 020846 move.w ($48,A6), D1 021272 move.w ($46,A6), D1 [base+744] 021276 cmp.w D0, D1 [base+782] 0212A0 sub.w ($46,A6), D0 [base+744] 0212A4 bsr $212ee [base+782] 0212C0 move.w D0, ($46,A6) 0212C4 move.w ($c,A6), D0 [base+782] 021302 move.w ($46,A6), D0 021306 addi.w #$200, D0 [base+782] 02138E move.w ($46,A6), D0 021392 move.w ($48,A6), D1 [base+782] 022420 move.w ($6,A0), ($46,A6) [base+77E, base+780] 022426 move.w ($8,A0), ($48,A6) 022462 move.w ($46,A6), D0 022466 move.w ($48,A6), D1 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
Capture One Scripts/select_next_variants.applescript
emorydunn/CaptureOneScripts
17
766
<filename>Capture One Scripts/select_next_variants.applescript (* Shift the variant selection up or down. Created by <NAME> *) use application "Capture One 20" try set currentVariants to variants whose selected is true if (count of currentVariants) is 0 then select current document variant (first variant) return end if set nextVariants to {} repeat with v in currentVariants set nextVariant to variant after v copy nextVariant to the end of the |nextVariants| end repeat deselect current document variants currentVariants select current document variants nextVariants end try
pwnlib/shellcraft/templates/i386/ret.asm
kristoff3r/pwntools
1
241986
<gh_stars>1-10 <%docstring>A single-byte RET instruction.</%docstring> ret
oeis/171/A171842.asm
neoneye/loda-programs
11
246607
; A171842: Binomial transform of 1,0,1,0,2,0,4,0,8,0,16,... ; Submitted by <NAME>(s2) ; 1,1,2,4,9,21,50,120,289,697,1682,4060,9801,23661,57122,137904,332929,803761,1940450,4684660,11309769,27304197,65918162,159140520,384199201,927538921,2239277042,5406093004,13051463049,31509019101,76069501250,183648021600,443365544449,1070379110497,2584123765442,6238626641380,15061377048201,36361380737781,87784138523762,211929657785304,511643454094369,1235216565974041,2982076586042450,7199369738058940,17380816062160329,41961001862379597,101302819786919522,244566641436218640,590436102659356801 lpb $0 sub $0,1 mov $2,$1 mov $1,$3 add $1,1 add $2,$3 add $3,$2 lpe mov $0,$3 add $0,1
alloy4fun_models/trashltl/models/18/C3RzrJveQHSFgBnt9.als
Kaixi26/org.alloytools.alloy
0
2824
open main pred idC3RzrJveQHSFgBnt9_prop19 { all p: Protected | p in Protected until p in Trash } pred __repair { idC3RzrJveQHSFgBnt9_prop19 } check __repair { idC3RzrJveQHSFgBnt9_prop19 <=> prop19o }
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4
h3ci/spark
0
3429
/* * 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. * * This file is an adaptation of Presto's presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4 grammar. */ parser grammar SqlBaseParser; options { tokenVocab = SqlBaseLexer; } @members { /** * When false, INTERSECT is given the greater precedence over the other set * operations (UNION, EXCEPT and MINUS) as per the SQL standard. */ public boolean legacy_setops_precedence_enabled = false; /** * When false, a literal with an exponent would be converted into * double type rather than decimal type. */ public boolean legacy_exponent_literal_as_decimal_enabled = false; /** * When true, the behavior of keywords follows ANSI SQL standard. */ public boolean SQL_standard_keyword_behavior = false; } singleStatement : statement SEMICOLON* EOF ; singleExpression : namedExpression EOF ; singleTableIdentifier : tableIdentifier EOF ; singleMultipartIdentifier : multipartIdentifier EOF ; singleFunctionIdentifier : functionIdentifier EOF ; singleDataType : dataType EOF ; singleTableSchema : colTypeList EOF ; statement : query #statementDefault | ctes? dmlStatementNoWith #dmlStatement | USE multipartIdentifier #use | USE namespace multipartIdentifier #useNamespace | SET CATALOG (identifier | STRING) #setCatalog | CREATE namespace (IF NOT EXISTS)? multipartIdentifier (commentSpec | locationSpec | (WITH (DBPROPERTIES | PROPERTIES) propertyList))* #createNamespace | ALTER namespace multipartIdentifier SET (DBPROPERTIES | PROPERTIES) propertyList #setNamespaceProperties | ALTER namespace multipartIdentifier SET locationSpec #setNamespaceLocation | DROP namespace (IF EXISTS)? multipartIdentifier (RESTRICT | CASCADE)? #dropNamespace | SHOW namespaces ((FROM | IN) multipartIdentifier)? (LIKE? pattern=STRING)? #showNamespaces | createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? createTableClauses (AS? query)? #createTable | CREATE TABLE (IF NOT EXISTS)? target=tableIdentifier LIKE source=tableIdentifier (tableProvider | rowFormat | createFileFormat | locationSpec | (TBLPROPERTIES tableProps=propertyList))* #createTableLike | replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? createTableClauses (AS? query)? #replaceTable | ANALYZE TABLE multipartIdentifier partitionSpec? COMPUTE STATISTICS (identifier | FOR COLUMNS identifierSeq | FOR ALL COLUMNS)? #analyze | ANALYZE TABLES ((FROM | IN) multipartIdentifier)? COMPUTE STATISTICS (identifier)? #analyzeTables | ALTER TABLE multipartIdentifier ADD (COLUMN | COLUMNS) columns=qualifiedColTypeWithPositionList #addTableColumns | ALTER TABLE multipartIdentifier ADD (COLUMN | COLUMNS) LEFT_PAREN columns=qualifiedColTypeWithPositionList RIGHT_PAREN #addTableColumns | ALTER TABLE table=multipartIdentifier RENAME COLUMN from=multipartIdentifier TO to=errorCapturingIdentifier #renameTableColumn | ALTER TABLE multipartIdentifier DROP (COLUMN | COLUMNS) (IF EXISTS)? LEFT_PAREN columns=multipartIdentifierList RIGHT_PAREN #dropTableColumns | ALTER TABLE multipartIdentifier DROP (COLUMN | COLUMNS) (IF EXISTS)? columns=multipartIdentifierList #dropTableColumns | ALTER (TABLE | VIEW) from=multipartIdentifier RENAME TO to=multipartIdentifier #renameTable | ALTER (TABLE | VIEW) multipartIdentifier SET TBLPROPERTIES propertyList #setTableProperties | ALTER (TABLE | VIEW) multipartIdentifier UNSET TBLPROPERTIES (IF EXISTS)? propertyList #unsetTableProperties | ALTER TABLE table=multipartIdentifier (ALTER | CHANGE) COLUMN? column=multipartIdentifier alterColumnAction? #alterTableAlterColumn | ALTER TABLE table=multipartIdentifier partitionSpec? CHANGE COLUMN? colName=multipartIdentifier colType colPosition? #hiveChangeColumn | ALTER TABLE table=multipartIdentifier partitionSpec? REPLACE COLUMNS LEFT_PAREN columns=qualifiedColTypeWithPositionList RIGHT_PAREN #hiveReplaceColumns | ALTER TABLE multipartIdentifier (partitionSpec)? SET SERDE STRING (WITH SERDEPROPERTIES propertyList)? #setTableSerDe | ALTER TABLE multipartIdentifier (partitionSpec)? SET SERDEPROPERTIES propertyList #setTableSerDe | ALTER (TABLE | VIEW) multipartIdentifier ADD (IF NOT EXISTS)? partitionSpecLocation+ #addTablePartition | ALTER TABLE multipartIdentifier from=partitionSpec RENAME TO to=partitionSpec #renameTablePartition | ALTER (TABLE | VIEW) multipartIdentifier DROP (IF EXISTS)? partitionSpec (COMMA partitionSpec)* PURGE? #dropTablePartitions | ALTER TABLE multipartIdentifier (partitionSpec)? SET locationSpec #setTableLocation | ALTER TABLE multipartIdentifier RECOVER PARTITIONS #recoverPartitions | DROP TABLE (IF EXISTS)? multipartIdentifier PURGE? #dropTable | DROP VIEW (IF EXISTS)? multipartIdentifier #dropView | CREATE (OR REPLACE)? (GLOBAL? TEMPORARY)? VIEW (IF NOT EXISTS)? multipartIdentifier identifierCommentList? (commentSpec | (PARTITIONED ON identifierList) | (TBLPROPERTIES propertyList))* AS query #createView | CREATE (OR REPLACE)? GLOBAL? TEMPORARY VIEW tableIdentifier (LEFT_PAREN colTypeList RIGHT_PAREN)? tableProvider (OPTIONS propertyList)? #createTempViewUsing | ALTER VIEW multipartIdentifier AS? query #alterViewQuery | CREATE (OR REPLACE)? TEMPORARY? FUNCTION (IF NOT EXISTS)? multipartIdentifier AS className=STRING (USING resource (COMMA resource)*)? #createFunction | DROP TEMPORARY? FUNCTION (IF EXISTS)? multipartIdentifier #dropFunction | EXPLAIN (LOGICAL | FORMATTED | EXTENDED | CODEGEN | COST)? statement #explain | SHOW TABLES ((FROM | IN) multipartIdentifier)? (LIKE? pattern=STRING)? #showTables | SHOW TABLE EXTENDED ((FROM | IN) ns=multipartIdentifier)? LIKE pattern=STRING partitionSpec? #showTableExtended | SHOW TBLPROPERTIES table=multipartIdentifier (LEFT_PAREN key=propertyKey RIGHT_PAREN)? #showTblProperties | SHOW COLUMNS (FROM | IN) table=multipartIdentifier ((FROM | IN) ns=multipartIdentifier)? #showColumns | SHOW VIEWS ((FROM | IN) multipartIdentifier)? (LIKE? pattern=STRING)? #showViews | SHOW PARTITIONS multipartIdentifier partitionSpec? #showPartitions | SHOW identifier? FUNCTIONS ((FROM | IN) ns=multipartIdentifier)? (LIKE? (legacy=multipartIdentifier | pattern=STRING))? #showFunctions | SHOW CREATE TABLE multipartIdentifier (AS SERDE)? #showCreateTable | SHOW CURRENT namespace #showCurrentNamespace | SHOW CATALOGS (LIKE? pattern=STRING)? #showCatalogs | (DESC | DESCRIBE) FUNCTION EXTENDED? describeFuncName #describeFunction | (DESC | DESCRIBE) namespace EXTENDED? multipartIdentifier #describeNamespace | (DESC | DESCRIBE) TABLE? option=(EXTENDED | FORMATTED)? multipartIdentifier partitionSpec? describeColName? #describeRelation | (DESC | DESCRIBE) QUERY? query #describeQuery | COMMENT ON namespace multipartIdentifier IS comment=(STRING | NULL) #commentNamespace | COMMENT ON TABLE multipartIdentifier IS comment=(STRING | NULL) #commentTable | REFRESH TABLE multipartIdentifier #refreshTable | REFRESH FUNCTION multipartIdentifier #refreshFunction | REFRESH (STRING | .*?) #refreshResource | CACHE LAZY? TABLE multipartIdentifier (OPTIONS options=propertyList)? (AS? query)? #cacheTable | UNCACHE TABLE (IF EXISTS)? multipartIdentifier #uncacheTable | CLEAR CACHE #clearCache | LOAD DATA LOCAL? INPATH path=STRING OVERWRITE? INTO TABLE multipartIdentifier partitionSpec? #loadData | TRUNCATE TABLE multipartIdentifier partitionSpec? #truncateTable | MSCK REPAIR TABLE multipartIdentifier (option=(ADD|DROP|SYNC) PARTITIONS)? #repairTable | op=(ADD | LIST) identifier .*? #manageResource | SET ROLE .*? #failNativeCommand | SET TIME ZONE interval #setTimeZone | SET TIME ZONE timezone=(STRING | LOCAL) #setTimeZone | SET TIME ZONE .*? #setTimeZone | SET configKey EQ configValue #setQuotedConfiguration | SET configKey (EQ .*?)? #setConfiguration | SET .*? EQ configValue #setQuotedConfiguration | SET .*? #setConfiguration | RESET configKey #resetQuotedConfiguration | RESET .*? #resetConfiguration | CREATE INDEX (IF NOT EXISTS)? identifier ON TABLE? multipartIdentifier (USING indexType=identifier)? LEFT_PAREN columns=multipartIdentifierPropertyList RIGHT_PAREN (OPTIONS options=propertyList)? #createIndex | DROP INDEX (IF EXISTS)? identifier ON TABLE? multipartIdentifier #dropIndex | unsupportedHiveNativeCommands .*? #failNativeCommand ; configKey : quotedIdentifier ; configValue : quotedIdentifier ; unsupportedHiveNativeCommands : kw1=CREATE kw2=ROLE | kw1=DROP kw2=ROLE | kw1=GRANT kw2=ROLE? | kw1=REVOKE kw2=ROLE? | kw1=SHOW kw2=GRANT | kw1=SHOW kw2=ROLE kw3=GRANT? | kw1=SHOW kw2=PRINCIPALS | kw1=SHOW kw2=ROLES | kw1=SHOW kw2=CURRENT kw3=ROLES | kw1=EXPORT kw2=TABLE | kw1=IMPORT kw2=TABLE | kw1=SHOW kw2=COMPACTIONS | kw1=SHOW kw2=CREATE kw3=TABLE | kw1=SHOW kw2=TRANSACTIONS | kw1=SHOW kw2=INDEXES | kw1=SHOW kw2=LOCKS | kw1=CREATE kw2=INDEX | kw1=DROP kw2=INDEX | kw1=ALTER kw2=INDEX | kw1=LOCK kw2=TABLE | kw1=LOCK kw2=DATABASE | kw1=UNLOCK kw2=TABLE | kw1=UNLOCK kw2=DATABASE | kw1=CREATE kw2=TEMPORARY kw3=MACRO | kw1=DROP kw2=TEMPORARY kw3=MACRO | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=CLUSTERED | kw1=ALTER kw2=TABLE tableIdentifier kw3=CLUSTERED kw4=BY | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=SORTED | kw1=ALTER kw2=TABLE tableIdentifier kw3=SKEWED kw4=BY | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=SKEWED | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=STORED kw5=AS kw6=DIRECTORIES | kw1=ALTER kw2=TABLE tableIdentifier kw3=SET kw4=SKEWED kw5=LOCATION | kw1=ALTER kw2=TABLE tableIdentifier kw3=EXCHANGE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=ARCHIVE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=UNARCHIVE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=TOUCH | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=COMPACT | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=CONCATENATE | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=SET kw4=FILEFORMAT | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=REPLACE kw4=COLUMNS | kw1=START kw2=TRANSACTION | kw1=COMMIT | kw1=ROLLBACK | kw1=DFS ; createTableHeader : CREATE TEMPORARY? EXTERNAL? TABLE (IF NOT EXISTS)? multipartIdentifier ; replaceTableHeader : (CREATE OR)? REPLACE TABLE multipartIdentifier ; bucketSpec : CLUSTERED BY identifierList (SORTED BY orderedIdentifierList)? INTO INTEGER_VALUE BUCKETS ; skewSpec : SKEWED BY identifierList ON (constantList | nestedConstantList) (STORED AS DIRECTORIES)? ; locationSpec : LOCATION STRING ; commentSpec : COMMENT STRING ; query : ctes? queryTerm queryOrganization ; insertInto : INSERT OVERWRITE TABLE? multipartIdentifier (partitionSpec (IF NOT EXISTS)?)? identifierList? #insertOverwriteTable | INSERT INTO TABLE? multipartIdentifier partitionSpec? (IF NOT EXISTS)? identifierList? #insertIntoTable | INSERT OVERWRITE LOCAL? DIRECTORY path=STRING rowFormat? createFileFormat? #insertOverwriteHiveDir | INSERT OVERWRITE LOCAL? DIRECTORY (path=STRING)? tableProvider (OPTIONS options=propertyList)? #insertOverwriteDir ; partitionSpecLocation : partitionSpec locationSpec? ; partitionSpec : PARTITION LEFT_PAREN partitionVal (COMMA partitionVal)* RIGHT_PAREN ; partitionVal : identifier (EQ constant)? | identifier EQ DEFAULT ; namespace : NAMESPACE | DATABASE | SCHEMA ; namespaces : NAMESPACES | DATABASES | SCHEMAS ; describeFuncName : qualifiedName | STRING | comparisonOperator | arithmeticOperator | predicateOperator ; describeColName : nameParts+=identifier (DOT nameParts+=identifier)* ; ctes : WITH namedQuery (COMMA namedQuery)* ; namedQuery : name=errorCapturingIdentifier (columnAliases=identifierList)? AS? LEFT_PAREN query RIGHT_PAREN ; tableProvider : USING multipartIdentifier ; createTableClauses :((OPTIONS options=propertyList) | (PARTITIONED BY partitioning=partitionFieldList) | skewSpec | bucketSpec | rowFormat | createFileFormat | locationSpec | commentSpec | (TBLPROPERTIES tableProps=propertyList))* ; propertyList : LEFT_PAREN property (COMMA property)* RIGHT_PAREN ; property : key=propertyKey (EQ? value=propertyValue)? ; propertyKey : identifier (DOT identifier)* | STRING ; propertyValue : INTEGER_VALUE | DECIMAL_VALUE | booleanValue | STRING ; constantList : LEFT_PAREN constant (COMMA constant)* RIGHT_PAREN ; nestedConstantList : LEFT_PAREN constantList (COMMA constantList)* RIGHT_PAREN ; createFileFormat : STORED AS fileFormat | STORED BY storageHandler ; fileFormat : INPUTFORMAT inFmt=STRING OUTPUTFORMAT outFmt=STRING #tableFileFormat | identifier #genericFileFormat ; storageHandler : STRING (WITH SERDEPROPERTIES propertyList)? ; resource : identifier STRING ; dmlStatementNoWith : insertInto query #singleInsertQuery | fromClause multiInsertQueryBody+ #multiInsertQuery | DELETE FROM multipartIdentifier tableAlias whereClause? #deleteFromTable | UPDATE multipartIdentifier tableAlias setClause whereClause? #updateTable | MERGE INTO target=multipartIdentifier targetAlias=tableAlias USING (source=multipartIdentifier | LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias ON mergeCondition=booleanExpression matchedClause* notMatchedClause* #mergeIntoTable ; queryOrganization : (ORDER BY order+=sortItem (COMMA order+=sortItem)*)? (CLUSTER BY clusterBy+=expression (COMMA clusterBy+=expression)*)? (DISTRIBUTE BY distributeBy+=expression (COMMA distributeBy+=expression)*)? (SORT BY sort+=sortItem (COMMA sort+=sortItem)*)? windowClause? (LIMIT (ALL | limit=expression))? (OFFSET offset=expression)? ; multiInsertQueryBody : insertInto fromStatementBody ; queryTerm : queryPrimary #queryTermDefault | left=queryTerm {legacy_setops_precedence_enabled}? operator=(INTERSECT | UNION | EXCEPT | SETMINUS) setQuantifier? right=queryTerm #setOperation | left=queryTerm {!legacy_setops_precedence_enabled}? operator=INTERSECT setQuantifier? right=queryTerm #setOperation | left=queryTerm {!legacy_setops_precedence_enabled}? operator=(UNION | EXCEPT | SETMINUS) setQuantifier? right=queryTerm #setOperation ; queryPrimary : querySpecification #queryPrimaryDefault | fromStatement #fromStmt | TABLE multipartIdentifier #table | inlineTable #inlineTableDefault1 | LEFT_PAREN query RIGHT_PAREN #subquery ; sortItem : expression ordering=(ASC | DESC)? (NULLS nullOrder=(LAST | FIRST))? ; fromStatement : fromClause fromStatementBody+ ; fromStatementBody : transformClause whereClause? queryOrganization | selectClause lateralView* whereClause? aggregationClause? havingClause? windowClause? queryOrganization ; querySpecification : transformClause fromClause? lateralView* whereClause? aggregationClause? havingClause? windowClause? #transformQuerySpecification | selectClause fromClause? lateralView* whereClause? aggregationClause? havingClause? windowClause? #regularQuerySpecification ; transformClause : (SELECT kind=TRANSFORM LEFT_PAREN setQuantifier? expressionSeq RIGHT_PAREN | kind=MAP setQuantifier? expressionSeq | kind=REDUCE setQuantifier? expressionSeq) inRowFormat=rowFormat? (RECORDWRITER recordWriter=STRING)? USING script=STRING (AS (identifierSeq | colTypeList | (LEFT_PAREN (identifierSeq | colTypeList) RIGHT_PAREN)))? outRowFormat=rowFormat? (RECORDREADER recordReader=STRING)? ; selectClause : SELECT (hints+=hint)* setQuantifier? namedExpressionSeq ; setClause : SET assignmentList ; matchedClause : WHEN MATCHED (AND matchedCond=booleanExpression)? THEN matchedAction ; notMatchedClause : WHEN NOT MATCHED (AND notMatchedCond=booleanExpression)? THEN notMatchedAction ; matchedAction : DELETE | UPDATE SET ASTERISK | UPDATE SET assignmentList ; notMatchedAction : INSERT ASTERISK | INSERT LEFT_PAREN columns=multipartIdentifierList RIGHT_PAREN VALUES LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN ; assignmentList : assignment (COMMA assignment)* ; assignment : key=multipartIdentifier EQ value=expression ; whereClause : WHERE booleanExpression ; havingClause : HAVING booleanExpression ; hint : HENT_START hintStatements+=hintStatement (COMMA? hintStatements+=hintStatement)* HENT_END ; hintStatement : hintName=identifier | hintName=identifier LEFT_PAREN parameters+=primaryExpression (COMMA parameters+=primaryExpression)* RIGHT_PAREN ; fromClause : FROM relation (COMMA relation)* lateralView* pivotClause? ; temporalClause : FOR? (SYSTEM_VERSION | VERSION) AS OF version=(INTEGER_VALUE | STRING) | FOR? (SYSTEM_TIME | TIMESTAMP) AS OF timestamp=valueExpression ; aggregationClause : GROUP BY groupingExpressionsWithGroupingAnalytics+=groupByClause (COMMA groupingExpressionsWithGroupingAnalytics+=groupByClause)* | GROUP BY groupingExpressions+=expression (COMMA groupingExpressions+=expression)* ( WITH kind=ROLLUP | WITH kind=CUBE | kind=GROUPING SETS LEFT_PAREN groupingSet (COMMA groupingSet)* RIGHT_PAREN)? ; groupByClause : groupingAnalytics | expression ; groupingAnalytics : (ROLLUP | CUBE) LEFT_PAREN groupingSet (COMMA groupingSet)* RIGHT_PAREN | GROUPING SETS LEFT_PAREN groupingElement (COMMA groupingElement)* RIGHT_PAREN ; groupingElement : groupingAnalytics | groupingSet ; groupingSet : LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN | expression ; pivotClause : PIVOT LEFT_PAREN aggregates=namedExpressionSeq FOR pivotColumn IN LEFT_PAREN pivotValues+=pivotValue (COMMA pivotValues+=pivotValue)* RIGHT_PAREN RIGHT_PAREN ; pivotColumn : identifiers+=identifier | LEFT_PAREN identifiers+=identifier (COMMA identifiers+=identifier)* RIGHT_PAREN ; pivotValue : expression (AS? identifier)? ; lateralView : LATERAL VIEW (OUTER)? qualifiedName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tblName=identifier (AS? colName+=identifier (COMMA colName+=identifier)*)? ; setQuantifier : DISTINCT | ALL ; relation : LATERAL? relationPrimary joinRelation* ; joinRelation : (joinType) JOIN LATERAL? right=relationPrimary joinCriteria? | NATURAL joinType JOIN LATERAL? right=relationPrimary ; joinType : INNER? | CROSS | LEFT OUTER? | LEFT? SEMI | RIGHT OUTER? | FULL OUTER? | LEFT? ANTI ; joinCriteria : ON booleanExpression | USING identifierList ; sample : TABLESAMPLE LEFT_PAREN sampleMethod? RIGHT_PAREN (REPEATABLE LEFT_PAREN seed=INTEGER_VALUE RIGHT_PAREN)? ; sampleMethod : negativeSign=MINUS? percentage=(INTEGER_VALUE | DECIMAL_VALUE) PERCENTLIT #sampleByPercentile | expression ROWS #sampleByRows | sampleType=BUCKET numerator=INTEGER_VALUE OUT OF denominator=INTEGER_VALUE (ON (identifier | qualifiedName LEFT_PAREN RIGHT_PAREN))? #sampleByBucket | bytes=expression #sampleByBytes ; identifierList : LEFT_PAREN identifierSeq RIGHT_PAREN ; identifierSeq : ident+=errorCapturingIdentifier (COMMA ident+=errorCapturingIdentifier)* ; orderedIdentifierList : LEFT_PAREN orderedIdentifier (COMMA orderedIdentifier)* RIGHT_PAREN ; orderedIdentifier : ident=errorCapturingIdentifier ordering=(ASC | DESC)? ; identifierCommentList : LEFT_PAREN identifierComment (COMMA identifierComment)* RIGHT_PAREN ; identifierComment : identifier commentSpec? ; relationPrimary : multipartIdentifier temporalClause? sample? tableAlias #tableName | LEFT_PAREN query RIGHT_PAREN sample? tableAlias #aliasedQuery | LEFT_PAREN relation RIGHT_PAREN sample? tableAlias #aliasedRelation | inlineTable #inlineTableDefault2 | functionTable #tableValuedFunction ; inlineTable : VALUES expression (COMMA expression)* tableAlias ; functionTable : funcName=functionName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tableAlias ; tableAlias : (AS? strictIdentifier identifierList?)? ; rowFormat : ROW FORMAT SERDE name=STRING (WITH SERDEPROPERTIES props=propertyList)? #rowFormatSerde | ROW FORMAT DELIMITED (FIELDS TERMINATED BY fieldsTerminatedBy=STRING (ESCAPED BY escapedBy=STRING)?)? (COLLECTION ITEMS TERMINATED BY collectionItemsTerminatedBy=STRING)? (MAP KEYS TERMINATED BY keysTerminatedBy=STRING)? (LINES TERMINATED BY linesSeparatedBy=STRING)? (NULL DEFINED AS nullDefinedAs=STRING)? #rowFormatDelimited ; multipartIdentifierList : multipartIdentifier (COMMA multipartIdentifier)* ; multipartIdentifier : parts+=errorCapturingIdentifier (DOT parts+=errorCapturingIdentifier)* ; multipartIdentifierPropertyList : multipartIdentifierProperty (COMMA multipartIdentifierProperty)* ; multipartIdentifierProperty : multipartIdentifier (OPTIONS options=propertyList)? ; tableIdentifier : (db=errorCapturingIdentifier DOT)? table=errorCapturingIdentifier ; functionIdentifier : (db=errorCapturingIdentifier DOT)? function=errorCapturingIdentifier ; namedExpression : expression (AS? (name=errorCapturingIdentifier | identifierList))? ; namedExpressionSeq : namedExpression (COMMA namedExpression)* ; partitionFieldList : LEFT_PAREN fields+=partitionField (COMMA fields+=partitionField)* RIGHT_PAREN ; partitionField : transform #partitionTransform | colType #partitionColumn ; transform : qualifiedName #identityTransform | transformName=identifier LEFT_PAREN argument+=transformArgument (COMMA argument+=transformArgument)* RIGHT_PAREN #applyTransform ; transformArgument : qualifiedName | constant ; expression : booleanExpression ; expressionSeq : expression (COMMA expression)* ; booleanExpression : NOT booleanExpression #logicalNot | EXISTS LEFT_PAREN query RIGHT_PAREN #exists | valueExpression predicate? #predicated | left=booleanExpression operator=AND right=booleanExpression #logicalBinary | left=booleanExpression operator=OR right=booleanExpression #logicalBinary ; predicate : NOT? kind=BETWEEN lower=valueExpression AND upper=valueExpression | NOT? kind=IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN | NOT? kind=IN LEFT_PAREN query RIGHT_PAREN | NOT? kind=RLIKE pattern=valueExpression | NOT? kind=(LIKE | ILIKE) quantifier=(ANY | SOME | ALL) (LEFT_PAREN RIGHT_PAREN | LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN) | NOT? kind=(LIKE | ILIKE) pattern=valueExpression (ESCAPE escapeChar=STRING)? | IS NOT? kind=NULL | IS NOT? kind=(TRUE | FALSE | UNKNOWN) | IS NOT? kind=DISTINCT FROM right=valueExpression ; valueExpression : primaryExpression #valueExpressionDefault | operator=(MINUS | PLUS | TILDE) valueExpression #arithmeticUnary | left=valueExpression operator=(ASTERISK | SLASH | PERCENT | DIV) right=valueExpression #arithmeticBinary | left=valueExpression operator=(PLUS | MINUS | CONCAT_PIPE) right=valueExpression #arithmeticBinary | left=valueExpression operator=AMPERSAND right=valueExpression #arithmeticBinary | left=valueExpression operator=HAT right=valueExpression #arithmeticBinary | left=valueExpression operator=PIPE right=valueExpression #arithmeticBinary | left=valueExpression comparisonOperator right=valueExpression #comparison ; datetimeUnit : YEAR | QUARTER | MONTH | WEEK | DAY | DAYOFYEAR | HOUR | MINUTE | SECOND | MILLISECOND | MICROSECOND ; primaryExpression : name=(CURRENT_DATE | CURRENT_TIMESTAMP | CURRENT_USER | USER) #currentLike | name=(TIMESTAMPADD | DATEADD) LEFT_PAREN unit=datetimeUnit COMMA unitsAmount=valueExpression COMMA timestamp=valueExpression RIGHT_PAREN #timestampadd | name=(TIMESTAMPDIFF | DATEDIFF) LEFT_PAREN unit=datetimeUnit COMMA startTimestamp=valueExpression COMMA endTimestamp=valueExpression RIGHT_PAREN #timestampdiff | CASE whenClause+ (ELSE elseExpression=expression)? END #searchedCase | CASE value=expression whenClause+ (ELSE elseExpression=expression)? END #simpleCase | name=(CAST | TRY_CAST) LEFT_PAREN expression AS dataType RIGHT_PAREN #cast | STRUCT LEFT_PAREN (argument+=namedExpression (COMMA argument+=namedExpression)*)? RIGHT_PAREN #struct | FIRST LEFT_PAREN expression (IGNORE NULLS)? RIGHT_PAREN #first | LAST LEFT_PAREN expression (IGNORE NULLS)? RIGHT_PAREN #last | POSITION LEFT_PAREN substr=valueExpression IN str=valueExpression RIGHT_PAREN #position | constant #constantDefault | ASTERISK #star | qualifiedName DOT ASTERISK #star | LEFT_PAREN namedExpression (COMMA namedExpression)+ RIGHT_PAREN #rowConstructor | LEFT_PAREN query RIGHT_PAREN #subqueryExpression | functionName LEFT_PAREN (setQuantifier? argument+=expression (COMMA argument+=expression)*)? RIGHT_PAREN (FILTER LEFT_PAREN WHERE where=booleanExpression RIGHT_PAREN)? (nullsOption=(IGNORE | RESPECT) NULLS)? ( OVER windowSpec)? #functionCall | identifier ARROW expression #lambda | LEFT_PAREN identifier (COMMA identifier)+ RIGHT_PAREN ARROW expression #lambda | value=primaryExpression LEFT_BRACKET index=valueExpression RIGHT_BRACKET #subscript | identifier #columnReference | base=primaryExpression DOT fieldName=identifier #dereference | LEFT_PAREN expression RIGHT_PAREN #parenthesizedExpression | EXTRACT LEFT_PAREN field=identifier FROM source=valueExpression RIGHT_PAREN #extract | (SUBSTR | SUBSTRING) LEFT_PAREN str=valueExpression (FROM | COMMA) pos=valueExpression ((FOR | COMMA) len=valueExpression)? RIGHT_PAREN #substring | TRIM LEFT_PAREN trimOption=(BOTH | LEADING | TRAILING)? (trimStr=valueExpression)? FROM srcStr=valueExpression RIGHT_PAREN #trim | OVERLAY LEFT_PAREN input=valueExpression PLACING replace=valueExpression FROM position=valueExpression (FOR length=valueExpression)? RIGHT_PAREN #overlay | name=(PERCENTILE_CONT | PERCENTILE_DISC) LEFT_PAREN percentage=valueExpression RIGHT_PAREN WITHIN GROUP LEFT_PAREN ORDER BY sortItem RIGHT_PAREN ( OVER windowSpec)? #percentile ; constant : NULL #nullLiteral | interval #intervalLiteral | identifier STRING #typeConstructor | number #numericLiteral | booleanValue #booleanLiteral | STRING+ #stringLiteral ; comparisonOperator : EQ | NEQ | NEQJ | LT | LTE | GT | GTE | NSEQ ; arithmeticOperator : PLUS | MINUS | ASTERISK | SLASH | PERCENT | DIV | TILDE | AMPERSAND | PIPE | CONCAT_PIPE | HAT ; predicateOperator : OR | AND | IN | NOT ; booleanValue : TRUE | FALSE ; interval : INTERVAL (errorCapturingMultiUnitsInterval | errorCapturingUnitToUnitInterval)? ; errorCapturingMultiUnitsInterval : body=multiUnitsInterval unitToUnitInterval? ; multiUnitsInterval : (intervalValue unit+=identifier)+ ; errorCapturingUnitToUnitInterval : body=unitToUnitInterval (error1=multiUnitsInterval | error2=unitToUnitInterval)? ; unitToUnitInterval : value=intervalValue from=identifier TO to=identifier ; intervalValue : (PLUS | MINUS)? (INTEGER_VALUE | DECIMAL_VALUE | STRING) ; colPosition : position=FIRST | position=AFTER afterCol=errorCapturingIdentifier ; dataType : complex=ARRAY LT dataType GT #complexDataType | complex=MAP LT dataType COMMA dataType GT #complexDataType | complex=STRUCT (LT complexColTypeList? GT | NEQ) #complexDataType | INTERVAL from=(YEAR | MONTH) (TO to=MONTH)? #yearMonthIntervalDataType | INTERVAL from=(DAY | HOUR | MINUTE | SECOND) (TO to=(HOUR | MINUTE | SECOND))? #dayTimeIntervalDataType | identifier (LEFT_PAREN INTEGER_VALUE (COMMA INTEGER_VALUE)* RIGHT_PAREN)? #primitiveDataType ; qualifiedColTypeWithPositionList : qualifiedColTypeWithPosition (COMMA qualifiedColTypeWithPosition)* ; qualifiedColTypeWithPosition : name=multipartIdentifier dataType (NOT NULL)? defaultExpression? commentSpec? colPosition? ; defaultExpression : DEFAULT expression ; colTypeList : colType (COMMA colType)* ; colType : colName=errorCapturingIdentifier dataType (NOT NULL)? commentSpec? ; createOrReplaceTableColTypeList : createOrReplaceTableColType (COMMA createOrReplaceTableColType)* ; createOrReplaceTableColType : colName=errorCapturingIdentifier dataType (NOT NULL)? defaultExpression? commentSpec? ; complexColTypeList : complexColType (COMMA complexColType)* ; complexColType : identifier COLON? dataType (NOT NULL)? commentSpec? ; whenClause : WHEN condition=expression THEN result=expression ; windowClause : WINDOW namedWindow (COMMA namedWindow)* ; namedWindow : name=errorCapturingIdentifier AS windowSpec ; windowSpec : name=errorCapturingIdentifier #windowRef | LEFT_PAREN name=errorCapturingIdentifier RIGHT_PAREN #windowRef | LEFT_PAREN ( CLUSTER BY partition+=expression (COMMA partition+=expression)* | ((PARTITION | DISTRIBUTE) BY partition+=expression (COMMA partition+=expression)*)? ((ORDER | SORT) BY sortItem (COMMA sortItem)*)?) windowFrame? RIGHT_PAREN #windowDef ; windowFrame : frameType=RANGE start=frameBound | frameType=ROWS start=frameBound | frameType=RANGE BETWEEN start=frameBound AND end=frameBound | frameType=ROWS BETWEEN start=frameBound AND end=frameBound ; frameBound : UNBOUNDED boundType=(PRECEDING | FOLLOWING) | boundType=CURRENT ROW | expression boundType=(PRECEDING | FOLLOWING) ; qualifiedNameList : qualifiedName (COMMA qualifiedName)* ; functionName : qualifiedName | FILTER | LEFT | RIGHT ; qualifiedName : identifier (DOT identifier)* ; // this rule is used for explicitly capturing wrong identifiers such as test-table, which should actually be `test-table` // replace identifier with errorCapturingIdentifier where the immediate follow symbol is not an expression, otherwise // valid expressions such as "a-b" can be recognized as an identifier errorCapturingIdentifier : identifier errorCapturingIdentifierExtra ; // extra left-factoring grammar errorCapturingIdentifierExtra : (MINUS identifier)+ #errorIdent | #realIdent ; identifier : strictIdentifier | {!SQL_standard_keyword_behavior}? strictNonReserved ; strictIdentifier : IDENTIFIER #unquotedIdentifier | quotedIdentifier #quotedIdentifierAlternative | {SQL_standard_keyword_behavior}? ansiNonReserved #unquotedIdentifier | {!SQL_standard_keyword_behavior}? nonReserved #unquotedIdentifier ; quotedIdentifier : BACKQUOTED_IDENTIFIER ; number : {!legacy_exponent_literal_as_decimal_enabled}? MINUS? EXPONENT_VALUE #exponentLiteral | {!legacy_exponent_literal_as_decimal_enabled}? MINUS? DECIMAL_VALUE #decimalLiteral | {legacy_exponent_literal_as_decimal_enabled}? MINUS? (EXPONENT_VALUE | DECIMAL_VALUE) #legacyDecimalLiteral | MINUS? INTEGER_VALUE #integerLiteral | MINUS? BIGINT_LITERAL #bigIntLiteral | MINUS? SMALLINT_LITERAL #smallIntLiteral | MINUS? TINYINT_LITERAL #tinyIntLiteral | MINUS? DOUBLE_LITERAL #doubleLiteral | MINUS? FLOAT_LITERAL #floatLiteral | MINUS? BIGDECIMAL_LITERAL #bigDecimalLiteral ; alterColumnAction : TYPE dataType | commentSpec | colPosition | setOrDrop=(SET | DROP) NOT NULL | SET defaultExpression | dropDefault=DROP DEFAULT ; // When `SQL_standard_keyword_behavior=true`, there are 2 kinds of keywords in Spark SQL. // - Reserved keywords: // Keywords that are reserved and can't be used as identifiers for table, view, column, // function, alias, etc. // - Non-reserved keywords: // Keywords that have a special meaning only in particular contexts and can be used as // identifiers in other contexts. For example, `EXPLAIN SELECT ...` is a command, but EXPLAIN // can be used as identifiers in other places. // You can find the full keywords list by searching "Start of the keywords list" in this file. // The non-reserved keywords are listed below. Keywords not in this list are reserved keywords. ansiNonReserved //--ANSI-NON-RESERVED-START : ADD | AFTER | ALTER | ANALYZE | ANTI | ARCHIVE | ARRAY | ASC | AT | BETWEEN | BUCKET | BUCKETS | BY | CACHE | CASCADE | CATALOG | CATALOGS | CHANGE | CLEAR | CLUSTER | CLUSTERED | CODEGEN | COLLECTION | COLUMNS | COMMENT | COMMIT | COMPACT | COMPACTIONS | COMPUTE | CONCATENATE | COST | CUBE | CURRENT | DATA | DATABASE | DATABASES | DATEADD | DATEDIFF | DAY | DAYOFYEAR | DBPROPERTIES | DEFAULT | DEFINED | DELETE | DELIMITED | DESC | DESCRIBE | DFS | DIRECTORIES | DIRECTORY | DISTRIBUTE | DIV | DROP | ESCAPED | EXCHANGE | EXISTS | EXPLAIN | EXPORT | EXTENDED | EXTERNAL | EXTRACT | FIELDS | FILEFORMAT | FIRST | FOLLOWING | FORMAT | FORMATTED | FUNCTION | FUNCTIONS | GLOBAL | GROUPING | HOUR | IF | IGNORE | IMPORT | INDEX | INDEXES | INPATH | INPUTFORMAT | INSERT | INTERVAL | ITEMS | KEYS | LAST | LAZY | LIKE | ILIKE | LIMIT | LINES | LIST | LOAD | LOCAL | LOCATION | LOCK | LOCKS | LOGICAL | MACRO | MAP | MATCHED | MERGE | MICROSECOND | MILLISECOND | MINUTE | MONTH | MSCK | NAMESPACE | NAMESPACES | NO | NULLS | OF | OPTION | OPTIONS | OUT | OUTPUTFORMAT | OVER | OVERLAY | OVERWRITE | PARTITION | PARTITIONED | PARTITIONS | PERCENTLIT | PIVOT | PLACING | POSITION | PRECEDING | PRINCIPALS | PROPERTIES | PURGE | QUARTER | QUERY | RANGE | RECORDREADER | RECORDWRITER | RECOVER | REDUCE | REFRESH | RENAME | REPAIR | REPEATABLE | REPLACE | RESET | RESPECT | RESTRICT | REVOKE | RLIKE | ROLE | ROLES | ROLLBACK | ROLLUP | ROW | ROWS | SCHEMA | SCHEMAS | SECOND | SEMI | SEPARATED | SERDE | SERDEPROPERTIES | SET | SETMINUS | SETS | SHOW | SKEWED | SORT | SORTED | START | STATISTICS | STORED | STRATIFY | STRUCT | SUBSTR | SUBSTRING | SYNC | SYSTEM_TIME | SYSTEM_VERSION | TABLES | TABLESAMPLE | TBLPROPERTIES | TEMPORARY | TERMINATED | TIMESTAMP | TIMESTAMPADD | TIMESTAMPDIFF | TOUCH | TRANSACTION | TRANSACTIONS | TRANSFORM | TRIM | TRUE | TRUNCATE | TRY_CAST | TYPE | UNARCHIVE | UNBOUNDED | UNCACHE | UNLOCK | UNSET | UPDATE | USE | VALUES | VERSION | VIEW | VIEWS | WEEK | WINDOW | YEAR | ZONE //--ANSI-NON-RESERVED-END ; // When `SQL_standard_keyword_behavior=false`, there are 2 kinds of keywords in Spark SQL. // - Non-reserved keywords: // Same definition as the one when `SQL_standard_keyword_behavior=true`. // - Strict-non-reserved keywords: // A strict version of non-reserved keywords, which can not be used as table alias. // You can find the full keywords list by searching "Start of the keywords list" in this file. // The strict-non-reserved keywords are listed in `strictNonReserved`. // The non-reserved keywords are listed in `nonReserved`. // These 2 together contain all the keywords. strictNonReserved : ANTI | CROSS | EXCEPT | FULL | INNER | INTERSECT | JOIN | LATERAL | LEFT | NATURAL | ON | RIGHT | SEMI | SETMINUS | UNION | USING ; nonReserved //--DEFAULT-NON-RESERVED-START : ADD | AFTER | ALL | ALTER | ANALYZE | AND | ANY | ARCHIVE | ARRAY | AS | ASC | AT | AUTHORIZATION | BETWEEN | BOTH | BUCKET | BUCKETS | BY | CACHE | CASCADE | CASE | CAST | CATALOG | CATALOGS | CHANGE | CHECK | CLEAR | CLUSTER | CLUSTERED | CODEGEN | COLLATE | COLLECTION | COLUMN | COLUMNS | COMMENT | COMMIT | COMPACT | COMPACTIONS | COMPUTE | CONCATENATE | CONSTRAINT | COST | CREATE | CUBE | CURRENT | CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP | CURRENT_USER | DATA | DATABASE | DATABASES | DATEADD | DATEDIFF | DAY | DAYOFYEAR | DBPROPERTIES | DEFAULT | DEFINED | DELETE | DELIMITED | DESC | DESCRIBE | DFS | DIRECTORIES | DIRECTORY | DISTINCT | DISTRIBUTE | DIV | DROP | ELSE | END | ESCAPE | ESCAPED | EXCHANGE | EXISTS | EXPLAIN | EXPORT | EXTENDED | EXTERNAL | EXTRACT | FALSE | FETCH | FILTER | FIELDS | FILEFORMAT | FIRST | FOLLOWING | FOR | FOREIGN | FORMAT | FORMATTED | FROM | FUNCTION | FUNCTIONS | GLOBAL | GRANT | GROUP | GROUPING | HAVING | HOUR | IF | IGNORE | IMPORT | IN | INDEX | INDEXES | INPATH | INPUTFORMAT | INSERT | INTERVAL | INTO | IS | ITEMS | KEYS | LAST | LAZY | LEADING | LIKE | ILIKE | LIMIT | LINES | LIST | LOAD | LOCAL | LOCATION | LOCK | LOCKS | LOGICAL | MACRO | MAP | MATCHED | MERGE | MICROSECOND | MILLISECOND | MINUTE | MONTH | MSCK | NAMESPACE | NAMESPACES | NO | NOT | NULL | NULLS | OF | OFFSET | ONLY | OPTION | OPTIONS | OR | ORDER | OUT | OUTER | OUTPUTFORMAT | OVER | OVERLAPS | OVERLAY | OVERWRITE | PARTITION | PARTITIONED | PARTITIONS | PERCENTILE_CONT | PERCENTILE_DISC | PERCENTLIT | PIVOT | PLACING | POSITION | PRECEDING | PRIMARY | PRINCIPALS | PROPERTIES | PURGE | QUARTER | QUERY | RANGE | RECORDREADER | RECORDWRITER | RECOVER | REDUCE | REFERENCES | REFRESH | RENAME | REPAIR | REPEATABLE | REPLACE | RESET | RESPECT | RESTRICT | REVOKE | RLIKE | ROLE | ROLES | ROLLBACK | ROLLUP | ROW | ROWS | SCHEMA | SCHEMAS | SECOND | SELECT | SEPARATED | SERDE | SERDEPROPERTIES | SESSION_USER | SET | SETS | SHOW | SKEWED | SOME | SORT | SORTED | START | STATISTICS | STORED | STRATIFY | STRUCT | SUBSTR | SUBSTRING | SYNC | SYSTEM_TIME | SYSTEM_VERSION | TABLE | TABLES | TABLESAMPLE | TBLPROPERTIES | TEMPORARY | TERMINATED | THEN | TIME | TIMESTAMP | TIMESTAMPADD | TIMESTAMPDIFF | TO | TOUCH | TRAILING | TRANSACTION | TRANSACTIONS | TRANSFORM | TRIM | TRUE | TRUNCATE | TRY_CAST | TYPE | UNARCHIVE | UNBOUNDED | UNCACHE | UNIQUE | UNKNOWN | UNLOCK | UNSET | UPDATE | USE | USER | VALUES | VERSION | VIEW | VIEWS | WEEK | WHEN | WHERE | WINDOW | WITH | WITHIN | YEAR | ZONE //--DEFAULT-NON-RESERVED-END ;
fastmodel-parser/src/main/antlr4/imports/CallParser.g4
alibaba/fast-modeling-language
9
68
<reponame>alibaba/fast-modeling-language parser grammar CallParser; call : KW_CALL functionExpression ;
orka/src/gl/interface/gl-objects-textures.ads
onox/orka
52
4790
<reponame>onox/orka -- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2012 <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 System; with Interfaces.C.Pointers; with Ada.Unchecked_Deallocation; with GL.Low_Level.Enums; with GL.Objects.Buffers; with GL.Objects.Shaders; with GL.Pixels.Extensions; with GL.Types.Pointers; package GL.Objects.Textures is pragma Preelaborate; package LE renames Low_Level.Enums; package PE renames Pixels.Extensions; use all type LE.Texture_Kind; type Dimension_Count is (One, Two, Three); function Get_Dimensions (Kind : LE.Texture_Kind) return Dimension_Count; function Maximum_Anisotropy return Single with Post => Maximum_Anisotropy'Result >= 16.0; ----------------------------------------------------------------------------- -- Basic Types -- ----------------------------------------------------------------------------- type Minifying_Function is (Nearest, Linear, Nearest_Mipmap_Nearest, Linear_Mipmap_Nearest, Nearest_Mipmap_Linear, Linear_Mipmap_Linear); -- Has to be defined here because of following subtype declaration. for Minifying_Function use (Nearest => 16#2600#, Linear => 16#2601#, Nearest_Mipmap_Nearest => 16#2700#, Linear_Mipmap_Nearest => 16#2701#, Nearest_Mipmap_Linear => 16#2702#, Linear_Mipmap_Linear => 16#2703#); for Minifying_Function'Size use Int'Size; subtype Magnifying_Function is Minifying_Function range Nearest .. Linear; type Wrapping_Mode is (Repeat, Clamp_To_Border, Clamp_To_Edge, Mirrored_Repeat, Mirror_Clamp_To_Edge); -- Actual range is implementation-defined -- -- - OpenGL 2.x: At least 2 -- - OpenGL 3.x: At least 48 -- - OpenGL 4.x: At least 80 subtype Texture_Unit is UInt; subtype Image_Unit is UInt; subtype Mipmap_Level is Size; ----------------------------------------------------------------------------- -- Texture Objects -- ----------------------------------------------------------------------------- type Texture_Base (Kind : LE.Texture_Kind) is abstract new GL_Object with private; function Has_Levels (Object : Texture_Base) return Boolean is (Object.Kind not in Texture_Buffer | Texture_Rectangle | Texture_2D_Multisample | Texture_2D_Multisample_Array) with Inline; function Layered (Object : Texture_Base) return Boolean is (Object.Kind in Texture_1D_Array | Texture_2D_Array | Texture_3D | Texture_Cube_Map | Texture_Cube_Map_Array | Texture_2D_Multisample_Array) with Inline; overriding procedure Initialize_Id (Object : in out Texture_Base); overriding procedure Delete_Id (Object : in out Texture_Base); overriding function Identifier (Object : Texture_Base) return Types.Debug.Identifier is (Types.Debug.Texture); procedure Invalidate_Image (Object : Texture_Base; Level : Mipmap_Level) with Pre => (if not Object.Has_Levels then Level = 0); procedure Invalidate_Sub_Image (Object : Texture_Base; Level : Mipmap_Level; X, Y, Z : Int; Width, Height, Depth : Size) with Pre => (if not Object.Has_Levels then Level = 0); procedure Bind_Texture_Unit (Object : Texture_Base; Unit : Texture_Unit); procedure Bind_Image_Texture (Object : Texture_Base; Unit : Image_Unit); ----------------------------------------------------------------------------- type Texture is new Texture_Base with private; function Dimensions (Object : Texture) return Dimension_Count; function Allocated (Object : Texture) return Boolean; procedure Clear_Using_Data (Object : Texture; Level : Mipmap_Level; Source_Format : Pixels.Format; Source_Type : Pixels.Data_Type; Source : System.Address) with Pre => not Object.Compressed; procedure Clear_Using_Zeros (Object : Texture; Level : Mipmap_Level) with Pre => not Object.Compressed; procedure Generate_Mipmap (Object : Texture) with Pre => Object.Has_Levels; ----------------------------------------------------------------------------- generic Kind : LE.Texture_Kind; package Texture_Bindings is type Texture_Array is array (Texture_Unit range <>) of Texture (Kind); type Image_Array is array (Image_Unit range <>) of Texture (Kind); procedure Bind_Textures (Textures : Texture_Array); procedure Bind_Images (Images : Image_Array); end Texture_Bindings; ----------------------------------------------------------------------------- -- Texture Parameters -- ----------------------------------------------------------------------------- procedure Set_Lowest_Mipmap_Level (Object : Texture; Level : Mipmap_Level); procedure Set_Highest_Mipmap_Level (Object : Texture; Level : Mipmap_Level); function Lowest_Mipmap_Level (Object : Texture) return Mipmap_Level; function Highest_Mipmap_Level (Object : Texture) return Mipmap_Level; function Mipmap_Levels (Object : Texture) return Mipmap_Level with Pre => Object.Allocated, Post => Mipmap_Levels'Result >= 1; ----------------------------------------------------------------------------- function Internal_Format (Object : Texture) return Pixels.Internal_Format with Pre => Object.Allocated and not Object.Compressed; function Compressed_Format (Object : Texture) return Pixels.Compressed_Format with Pre => Object.Allocated and Object.Compressed; function Compressed (Object : Texture) return Boolean; function Samples (Object : Texture) return Size; function Fixed_Sample_Locations (Object : Texture) return Boolean with Pre => Object.Kind in Texture_2D_Multisample | Texture_2D_Multisample_Array; ----------------------------------------------------------------------------- -- Texture Level Parameters -- ----------------------------------------------------------------------------- function Width (Object : Texture; Level : Mipmap_Level) return Size; function Height (Object : Texture; Level : Mipmap_Level) return Size; function Depth (Object : Texture; Level : Mipmap_Level) return Size; function Compressed_Image_Size (Object : Texture; Level : Mipmap_Level) return Size with Pre => Object.Compressed; ----------------------------------------------------------------------------- -- Texture Units -- ----------------------------------------------------------------------------- function Texture_Unit_Count return Natural; -- Return the maximum combined number of texture image units available -- to all shaders -- -- If a texture image unit is used by multiple shaders, each shader stage -- is counted separately. function Texture_Unit_Count (Shader : Shaders.Shader_Type) return Natural; -- Return the maximum number of texture image units available for -- the specified shader ----------------------------------------------------------------------------- -- Buffer Texture Loading -- ----------------------------------------------------------------------------- type Buffer_Texture is new Texture_Base (Kind => Texture_Buffer) with private; procedure Attach_Buffer (Object : Buffer_Texture; Internal_Format : Pixels.Internal_Format_Buffer_Texture; Buffer : Objects.Buffers.Buffer); procedure Attach_Buffer (Object : Buffer_Texture; Internal_Format : Pixels.Internal_Format_Buffer_Texture; Buffer : Objects.Buffers.Buffer; Offset, Size : Types.Size); function Buffer_Offset (Object : Buffer_Texture) return Size; function Buffer_Size (Object : Buffer_Texture) return Size; ----------------------------------------------------------------------------- -- Texture Loading -- ----------------------------------------------------------------------------- procedure Allocate_Storage (Object : in out Texture; Levels, Samples : Types.Size; Format : Pixels.Internal_Format; Width, Height, Depth : Types.Size; Fixed_Locations : Boolean := True) with Pre => not Object.Allocated, Post => Object.Allocated; procedure Allocate_Storage (Object : in out Texture; Levels, Samples : Types.Size; Format : Pixels.Compressed_Format; Width, Height, Depth : Types.Size; Fixed_Locations : Boolean := True) with Pre => not Object.Allocated and Object.Kind /= Texture_Rectangle, Post => Object.Allocated; procedure Allocate_Storage (Object : in out Texture; Subject : Texture; Fixed_Locations : Boolean := True) with Pre => not Object.Allocated and Subject.Allocated, Post => Object.Allocated; -- Allocate storage using the same format, mipmap levels, samples, and -- dimensions of the given texture procedure Load_From_Data (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size; Source_Format : Pixels.Format; Source_Type : Pixels.Data_Type; Source : System.Address) with Pre => Object.Allocated and not Object.Compressed; -- Load data to allocated texture -- -- Data is considered to be packed. When loading it to a texture, -- it will be unpacked. Therefore, each row in bytes must be a multiple -- of the current unpack alignment. Call Set_Unpack_Alignment if necessary. procedure Load_From_Data (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size; Source_Format : Pixels.Compressed_Format; Image_Size : Types.Size; Source : System.Address) with Pre => Object.Dimensions /= One and Object.Allocated and Object.Compressed; procedure Copy_Data (Object : Texture; Subject : Texture; Source_Level, Target_Level : Mipmap_Level) with Pre => Object.Allocated and Subject.Allocated; procedure Copy_Sub_Data (Object : Texture; Subject : Texture; Source_Level, Target_Level : Mipmap_Level; Source_X, Source_Y, Source_Z : Types.Size := 0; Target_X, Target_Y, Target_Z : Types.Size := 0; Width, Height, Depth : Types.Size) with Pre => Object.Allocated and Subject.Allocated; procedure Clear_Using_Data (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size; Source_Format : Pixels.Format; Source_Type : Pixels.Data_Type; Source : System.Address) with Pre => not Object.Compressed; procedure Clear_Using_Zeros (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size) with Pre => not Object.Compressed; ----------------------------------------------------------------------------- function Get_Compressed_Data (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size; Format : Pixels.Compressed_Format) return not null Types.Pointers.UByte_Array_Access with Pre => Object.Dimensions /= One and Object.Allocated and Object.Compressed and Object.Kind not in Texture_2D_Multisample | Texture_2D_Multisample_Array; generic with package Pointers is new Interfaces.C.Pointers (<>); package Texture_Pointers is type Element_Array_Access is access Pointers.Element_Array; procedure Free is new Ada.Unchecked_Deallocation (Object => Pointers.Element_Array, Name => Element_Array_Access); function Get_Data (Object : Texture; Level : Mipmap_Level; X, Y, Z : Types.Size := 0; Width, Height, Depth : Types.Positive_Size; Format : Pixels.Format; Data_Type : PE.Non_Packed_Data_Type) return not null Element_Array_Access with Pre => Object.Allocated and not Object.Compressed and PE.Compatible (Format, Data_Type); end Texture_Pointers; ----------------------------------------------------------------------------- -- Texture Views -- ----------------------------------------------------------------------------- function Create_View (Object : Texture; Kind : LE.Texture_Kind; Format : Pixels.Internal_Format; Min_Level, Levels : Mipmap_Level; Min_Layer, Layers : Size) return Texture with Pre => Object.Allocated; -- Create a Texture object that shares some of the original texture's data -- -- The format and kind must be compatible with the original texture. See -- the OpenGL documentation. function Create_View (Object : Texture; Kind : LE.Texture_Kind; Format : Pixels.Compressed_Format; Min_Level, Levels : Mipmap_Level; Min_Layer, Layers : Size) return Texture with Pre => Object.Allocated; -- Create a Texture object that shares some of the original texture's data -- -- The format and kind must be compatible with the original texture. See -- the OpenGL documentation. function Create_View (Object : Texture; Kind : LE.Texture_Kind; Layer : Size) return Texture with Pre => Object.Allocated and Object.Layered; -- Create a Texture object that shares one layer or six layer-faces -- of the original texture's data private for Wrapping_Mode use (Repeat => 16#2901#, Clamp_To_Border => 16#812D#, Clamp_To_Edge => 16#812F#, Mirrored_Repeat => 16#8370#, Mirror_Clamp_To_Edge => 16#8743#); for Wrapping_Mode'Size use Int'Size; type Texture_Base (Kind : LE.Texture_Kind) is new GL_Object with null record; type Texture is new Texture_Base with record Allocated : Boolean := False; Dimensions : Dimension_Count := Get_Dimensions (Texture.Kind); end record; type Buffer_Texture is new Texture_Base (Kind => Texture_Buffer) with null record; end GL.Objects.Textures;