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/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_destroy.asm
jpoikela/z88dk
640
80235
<filename>libsrc/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_destroy.asm ; void w_array_destroy(w_array_t *a) SECTION code_clib SECTION code_adt_w_array PUBLIC w_array_destroy EXTERN asm_w_array_destroy defc w_array_destroy = asm_w_array_destroy ; SDCC bridge for Classic IF __CLASSIC PUBLIC _w_array_destroy defc _w_array_destroy = w_array_destroy ENDIF
libsrc/target/smc777/graphics/w_respixl_MODE4.asm
Frodevan/z88dk
640
90438
; ; Reset pixel at (x,y) coordinate. SECTION code_clib PUBLIC w_respixel_MODE4 defc NEEDunplot = 1 .w_respixel_MODE4 INCLUDE "pixel_MODE4.inc"
data/baseStats/doduo.asm
etdv-thevoid/pokemon-rgb-enhanced
1
8583
db DODUO ; pokedex id db 35 ; base hp db 85 ; base attack db 45 ; base defense db 75 ; base speed db 35 ; base special db NORMAL ; species type 1 db FLYING ; species type 2 db 190 ; catch rate db 96 ; base exp yield INCBIN "pic/gsmon/doduo.pic",0,1 ; 55, sprite dimensions dw DoduoPicFront dw DoduoPicBack ; attacks known at lvl 0 db PECK db GROWL db 0 db 0 db 0 ; growth rate ; learnset tmlearn 2,3,4,6,8 tmlearn 9,10 tmlearn 20 tmlearn 31,32 tmlearn 33,34 tmlearn 44 tmlearn 49,50 db BANK(DoduoPicFront)
final.asm
AbderrhmanAbdellatif/SysPro
0
20943
<filename>final.asm segment .text global final ; ebx,esi,edi,ebp,cs,ds,ss,es should remain unchanged final: push ebp mov ebp,esp push esi sub esp,12 ;(max= -8 , count=-12 , 4=-16 )place mov esi,4 ; esi = 4 mov [ebp-16],esi ; [ebp-16] = 4 mov eax,[ebp+8] ; eax= count ;mov ecx,4 ; ecx = 4 mul esi;ecx ; eax*ecx add eax,16 ; move eax count 4 index to up becouse of line 9 sub esp,[eax] ; make a place in stack using count size mov eax,[ebp+12] ; array first element mov edx,[eax] ; first element = max mov [ebp-8],edx ; 1st no of array is the max mov edx,[ebp+8] ;count mov ecx, [ebp+12] ; ecx hold start address of array loop: add ecx,4 ; ecx hold address of next element of array mov eax,[ecx] ; value of index in array cmp eax,[ebp-8] ; max < a[i] jle next ; if false next mov [ebp-8],eax ; max=a[i] next: dec edx ; i-- cmp edx,1 ; i!= 1 jne loop ; go to loop mov ecx, [ebp+12] ; ecx hold start address of array mov edx,[ebp-16] ;count array first element ;mov [ebp-12],edx ; hold count array adderess for future change loop2: ; count[a[i]]=count[a[i]]+1; ; ecx hold address of next element of array mov eax,[ecx] ; value of index in array a[i] mul esi ; eax * 4 add eax,16 ; result (eax*4)+16 sub edx,eax ; count[a[i]] ==> ebp - (value * 4 + 16) add dword edx,1; add ecx,4 dec edx ; i-- cmp edx,0 ; i!= 1 jne loop2 ; go to loop
oeis/208/A208178.asm
neoneye/loda-programs
11
243210
; A208178: Primes of the form 256*k + 1. ; Submitted by <NAME> ; 257,769,3329,7681,7937,9473,10753,11777,12289,13313,14081,14593,15361,17921,18433,19457,22273,23041,23297,25601,26113,26881,30977,31489,32257,36097,36353,37633,37889,39937,40193,40961,41729,43777,45569,46337,49409,49921,50177,51713,57089,57601,58369,59393,60161,61441,64513,65537,67073,70657,70913,75521,76289,76801,77569,78593,79873,80897,81409,83969,84481,84737,86017,87041,87553,88321,91393,95233,96001,96769,98561,100609,101377,102913,103681,106753,107777,108289,109313,110849,112129,113153 mov $1,35 mov $2,$0 add $2,6 pow $2,2 lpb $2 add $1,24 sub $2,1 mov $3,$1 add $1,4 add $3,5 mul $3,4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,36 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,99 mul $0,4 add $0,257
src/Prelude/Ord/Reasoning.agda
L-TChen/agda-prelude
111
14970
<filename>src/Prelude/Ord/Reasoning.agda module Prelude.Ord.Reasoning where open import Prelude.Equality open import Prelude.Ord open import Prelude.Function module _ {a} {A : Set a} {{OrdA : Ord/Laws A}} where private lt/leq-trans : ∀ {x y z : A} → x < y → y ≤ z → x < z lt/leq-trans x<y y≤z = case leq-to-lteq {A = A} y≤z of λ where (less y<z) → less-trans {A = A} x<y y<z (equal refl) → x<y leq/lt-trans : ∀ {x y z : A} → x ≤ y → y < z → x < z leq/lt-trans x≤y y<z = case leq-to-lteq {A = A} x≤y of λ where (less x<y) → less-trans {A = A} x<y y<z (equal refl) → y<z data _≲_ (x y : A) : Set a where strict : x < y → x ≲ y nonstrict : x ≤ y → x ≲ y module _ {x y : A} where OrdProof : x ≲ y → Set a OrdProof (strict _) = x < y OrdProof (nonstrict _) = x ≤ y infix -1 ordProof_ ordProof_ : (p : x ≲ y) → OrdProof p ordProof strict p = p ordProof nonstrict p = p infixr 0 eqOrdStep ltOrdStep leqOrdStep infix 1 _∎Ord syntax eqOrdStep x q p = x ≡[ p ] q eqOrdStep : ∀ (x : A) {y z} → y ≲ z → x ≡ y → x ≲ z x ≡[ x=y ] strict y<z = strict (case x=y of λ where refl → y<z) x ≡[ x=y ] nonstrict y≤z = nonstrict (case x=y of λ where refl → y≤z) -- ^ Note: don't match on the proof here, we need to decide strict vs nonstrict for neutral proofs syntax eqOrdStepʳ x q p = x ≡[ p ]ʳ q eqOrdStepʳ : ∀ (x : A) {y z} → y ≲ z → y ≡ x → x ≲ z x ≡[ y=x ]ʳ strict y<z = strict (case y=x of λ where refl → y<z) x ≡[ y=x ]ʳ nonstrict y≤z = nonstrict (case y=x of λ where refl → y≤z) syntax ltOrdStep x q p = x <[ p ] q ltOrdStep : ∀ (x : A) {y z} → y ≲ z → x < y → x ≲ z x <[ x<y ] strict y<z = strict (less-trans {A = A} x<y y<z) x <[ x<y ] nonstrict y≤z = strict (lt/leq-trans x<y y≤z) syntax leqOrdStep x q p = x ≤[ p ] q leqOrdStep : ∀ (x : A) {y z} → y ≲ z → x ≤ y → x ≲ z x ≤[ x≤y ] strict y<z = strict (leq/lt-trans x≤y y<z) x ≤[ x≤y ] nonstrict y≤z = nonstrict (leq-trans {A = A} x≤y y≤z) _∎Ord : ∀ (x : A) → x ≲ x x ∎Ord = nonstrict (eq-to-leq {A = A} refl)
Library/Text/TextLine/tlLargeOffset.asm
steakknife/pcgeos
504
91643
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: tlLargeOffset.asm AUTHOR: <NAME>, Dec 26, 1991 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- John 12/26/91 Initial revision DESCRIPTION: Offset related stuff $Id: tlLargeOffset.asm,v 1.1 97/04/07 11:20:47 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TextFixed segment COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LargeLineGetCharCount %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the number of characters in a line. CALLED BY: TL_LineGetCount PASS: *ds:si = Instance ptr bx.cx = Line RETURN: dx.ax = Number of characters in the line DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 12/26/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LargeLineGetCharCount proc near uses cx, di, es .enter mov di, cx ; bx.di <- line call LargeGetLinePointer ; es:di <- line pointer ; cx <- size of line/field data CommonLineGetCharCount ; dx.ax <- Number of characters call LargeReleaseLineBlock ; Release the line block .leave ret LargeLineGetCharCount endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LargeLineToOffsetStart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the start offset of a line. CALLED BY: TL_LargeLineToOffsetStart PASS: *ds:si = Instance bx.cx = Line to find On stack: dword - First line in current region dword - Start offset of current region RETURN: dx.ax = Line start DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 4/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LargeLineToOffsetStart proc near uses bx, cx, di firstLine local dword lineStart local dword .enter inherit call LargeLineToOffsetStartSizeFlags ; ; cx <- line flags ; movdw dxax, lineStart .leave ret @ArgSize LargeLineToOffsetStart endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LargeLineToOffsetVeryEnd %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the end of the line. CALLED BY: TL_LineToOffsetVeryEnd PASS: *ds:si = Instance bx.cx = Line On stack: dword - First line in current region dword - Start offset of current region RETURN: dx.ax = Line start cx = Line flags DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 4/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LargeLineToOffsetVeryEnd proc near uses bx, di firstLine local dword lineStart local dword .enter inherit call LargeLineToOffsetStartSizeFlags ; ; cx <- line flags ; movdw dxax, firstLine ; dx.ax <- Number of characters on line adddw dxax, lineStart ; dx.ax <- end of line .leave ret @ArgSize LargeLineToOffsetVeryEnd endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LargeLineToOffsetStartSizeFlags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get information about a line... CALLED BY: LargeLineToOffsetVeryEnd, LargeLineToOffsetStart PASS: *ds:si = Instance bx.cx = Line ss:bp = Inheritable stack frame RETURN: cx = LineFlags lineStart = Start of the line firstLine = Number of characters on line DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 4/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LargeLineToOffsetStartSizeFlags proc near uses bx, dx, di firstLine local dword startOffset local dword .enter inherit subdw bxcx, firstLine ; bx.cx <- # of lines to skip mov dx, bx ; dx.cx <- # of lines to skip call T_GetVMFile push bx ; VM file call LargeGetLineArray ; di <- line array push di ; Pass array push cs mov di, offset cs:CommonLineToOffsetEtcCallback push di ; Pass callback pushdw firstLine ; Pass starting element mov di, -1 ; Pass number to do push di, di call HugeArrayEnum ; cx <- LineFlags, dx.ax <- charCount movdw firstLine, dxax ; Save the count ; ; lineStart = Start of this line ; firstLine = Number of characters on the line ; cx = LineFlags for the line ; .leave ret LargeLineToOffsetStartSizeFlags endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LargeLineFromOffsetGetStart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Figure which line falls at a given offset and return the start of the line. CALLED BY: TL_LineFromOffsetGetStart PASS: *ds:si = Instance RETURN: bx.di = Line containing offset dx.ax = Start of that line DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 5/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LargeLineFromOffsetGetStart proc near offsetToFind local dword lineStart local dword firstLine local dword wantFirstFlag local byte .enter inherit call T_GetVMFile push bx ; VM file call LargeGetLineArray ; di <- line array push di ; Pass array push cs mov di, offset cs:CommonLineFromOffsetCallback push di ; Pass callback pushdw firstLine ; Pass starting element mov di, -1 ; Pass number to do push di, di call HugeArrayEnum ; cx <- LineFlags ; dx.ax <- Previous line start ; carry set if ran out of lines call CommonLineFromOffsetGetStartFinish .leave ret LargeLineFromOffsetGetStart endp TextFixed ends
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_454.asm
ljhsiun2/medusa
9
83519
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_454.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x6961, %r9 clflush (%r9) nop nop nop sub $58722, %r13 movw $0x6162, (%r9) nop nop dec %rbx lea addresses_WT_ht+0x3961, %rsi lea addresses_WT_ht+0xeacd, %rdi nop nop nop cmp %rbp, %rbp mov $22, %rcx rep movsl nop nop sub %r13, %r13 lea addresses_A_ht+0x10d61, %rsi lea addresses_WT_ht+0x11cb, %rdi add %rbp, %rbp mov $84, %rcx rep movsb nop nop nop add %r9, %r9 lea addresses_WT_ht+0xa8c1, %rsi lea addresses_WC_ht+0x8e41, %rdi nop nop nop nop nop and %rbp, %rbp mov $18, %rcx rep movsb nop and %r13, %r13 lea addresses_A_ht+0x194e1, %r9 clflush (%r9) nop sub %rbp, %rbp mov (%r9), %rcx nop nop nop nop and %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx // Store lea addresses_WC+0x14761, %rbp nop nop nop nop nop and %rdi, %rdi mov $0x5152535455565758, %rdx movq %rdx, %xmm5 movups %xmm5, (%rbp) nop xor $25192, %r9 // Store lea addresses_US+0xae91, %rdi nop sub $23325, %rbp mov $0x5152535455565758, %rdx movq %rdx, (%rdi) nop nop nop nop dec %rdi // Load lea addresses_RW+0x12361, %r9 nop nop nop nop nop cmp $55700, %rcx movb (%r9), %dl nop cmp $61289, %r14 // Load lea addresses_normal+0x179e1, %rdx sub %rax, %rax mov (%rdx), %rbp nop and $38682, %r14 // Faulty Load lea addresses_RW+0x2f61, %rax nop and %r14, %r14 mov (%rax), %dx lea oracles, %r14 and $0xff, %rdx shlq $12, %rdx mov (%r14,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
programs/oeis/131/A131406.asm
jmorken/loda
1
84042
; A131406: 3*A128174 - 2*A000012(signed). ; 1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1 mov $1,4 mov $2,5 lpb $0 sub $0,1 sub $0,$1 add $1,4 lpe add $0,$2 gcd $0,2 mov $1,$0
oeis/317/A317487.asm
neoneye/loda-programs
11
82852
<filename>oeis/317/A317487.asm<gh_stars>10-100 ; A317487: Number of 4-cycles in the n-Bruhat graph. ; Submitted by <NAME>(s2) ; 0,0,0,6,90,1080,12600,151200,1905120,25401600,359251200,5388768000,85621536000,1438441804800,25499650176000,475993469952000,9336794987520000,192071211171840000,4135933413900288000,93058501812756480000,2184137777840578560000,53390034569436364800000,1357230878791461273600000,35830895200094577623040000,981084035240684863488000000,27827110817735788855296000000,816665208781376412057600000000,24772177999701751165747200000000,775864614950658846511202304000000,25066395252252055041131151360000000 sub $0,1 mov $1,$0 mov $3,1 lpb $0 sub $0,$3 add $2,$0 mul $1,$2 mov $2,4 lpe mov $0,$1 div $0,8 mul $0,6
scripts/UndergroundPathRoute7.asm
opiter09/ASM-Machina
1
172898
<filename>scripts/UndergroundPathRoute7.asm UndergroundPathRoute7_Script: ld a, ROUTE_7 ld [wLastMap], a jp EnableAutoTextBoxDrawing UndergroundPathRoute7_TextPointers: dw UndergroundPathEntranceRoute7Text1 UndergroundPathEntranceRoute7Text1: text_far _UndergroundPathEntRoute7Text1 text_end
Cubical/Algebra/Group.agda
thomas-lamiaux/cubical
1
7935
{-# OPTIONS --safe #-} module Cubical.Algebra.Group where open import Cubical.Algebra.Group.Base public open import Cubical.Algebra.Group.Properties public
kernel.asm
plane000/OwOS
1
23915
<reponame>plane000/OwOS # OwOS # Copyright <NAME> (c) 2019 # declare constants for the multiboot header .set ALIGN, 1<<0 # align loaded modules on page boundaries .set MEMINFO, 1<<1 # provide memory map .set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field .set MAGIC, 0x1BADB002 #'magic number' lets bootloader find the header .set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot .section .multiboot .align 4 .long MAGIC .long FLAGS .long CHECKSUM .section .bss .align 16 stack_bottom: .skip 16384 # 16 KiB stack_top: .section .text .global _start .type _start, @function _start: # Settup stack mov $stack_top, %esp push %ebx push %eax call kernel_main cli 1: hlt jmp 1b .global FPU_Init .type FPU_Init, @function FPU_Init: # FPU Config VAL_037F: .hword 0x037F VAL_037E: .hword 0x037E VAL_037A: .hword 0x037A # Configure FPU cli mov %cr0, %ecx or $0b00110010, %ecx and $0xFFFFFFFB, %ecx mov %ecx, %cr0 fldcw VAL_037F fldcw VAL_037E fldcw VAL_037A fninit ret .size _start, . - _start
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2_notsx.log_19999_992.asm
ljhsiun2/medusa
9
17945
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r15 push %rbp push %rdx lea addresses_WT_ht+0x10d29, %rdx nop nop nop add %r15, %r15 mov (%rdx), %rbp nop nop sub $16976, %r15 pop %rdx pop %rbp pop %r15 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+0xba9, %rcx nop nop nop nop inc %r14 movb $0x51, (%rcx) nop nop nop sub %rdi, %rdi // Store lea addresses_UC+0x145a9, %r14 nop nop sub $15886, %r13 mov $0x5152535455565758, %rdi movq %rdi, %xmm3 movups %xmm3, (%r14) nop nop nop nop nop inc %rsi // Store lea addresses_D+0x77a9, %rsi nop nop nop dec %rcx mov $0x5152535455565758, %r14 movq %r14, %xmm4 movups %xmm4, (%rsi) nop dec %rdi // Faulty Load lea addresses_D+0x77a9, %r12 nop nop cmp %rcx, %rcx movups (%r12), %xmm0 vpextrq $1, %xmm0, %rdi lea oracles, %rax and $0xff, %rdi shlq $12, %rdi mov (%rax,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'00': 19999} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_598_1874.asm
ljhsiun2/medusa
9
1712
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x109f9, %rsi lea addresses_normal_ht+0x139e9, %rdi nop nop nop add %rdx, %rdx mov $28, %rcx rep movsl nop cmp $46839, %r15 lea addresses_normal_ht+0x2221, %rcx nop and %r10, %r10 vmovups (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdx nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0x59e9, %rsi nop nop nop nop add %r13, %r13 and $0xffffffffffffffc0, %rsi vmovaps (%rsi), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rcx nop cmp %rcx, %rcx lea addresses_normal_ht+0x1ede9, %rsi lea addresses_normal_ht+0xa269, %rdi nop nop and $47074, %rdx mov $2, %rcx rep movsw sub %rsi, %rsi lea addresses_normal_ht+0x11c69, %r13 sub %r15, %r15 mov $0x6162636465666768, %r10 movq %r10, (%r13) nop dec %r13 lea addresses_D_ht+0xb5e9, %rdi nop inc %r15 mov (%rdi), %r13w nop nop nop nop dec %r13 lea addresses_WC_ht+0x177e9, %rdx and $49356, %rdi movw $0x6162, (%rdx) nop nop add $62984, %rcx lea addresses_normal_ht+0x18069, %rsi lea addresses_WT_ht+0x2739, %rdi nop nop nop nop and $47202, %r12 mov $119, %rcx rep movsq sub $26885, %rdi lea addresses_D_ht+0xca69, %rdx nop nop xor %r12, %r12 movb $0x61, (%rdx) cmp $1080, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %rax push %rcx // Faulty Load lea addresses_US+0x1d5e9, %rcx nop nop cmp %rax, %rax mov (%rcx), %r14 lea oracles, %rcx and $0xff, %r14 shlq $12, %r14 mov (%rcx,%r14,1), %r14 pop %rcx pop %rax pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'00': 598} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada
LaudateCorpus1/RosettaCodeData
1
28014
with Ada.Numerics.Discrete_Random; procedure Generic_Shuffle (List : in out Array_Type) is package Discrete_Random is new Ada.Numerics.Discrete_Random(Result_Subtype => Integer); use Discrete_Random; K : Integer; G : Generator; T : Element_Type; begin Reset (G); for I in reverse List'Range loop K := (Random(G) mod I) + 1; T := List(I); List(I) := List(K); List(K) := T; end loop; end Generic_Shuffle;
source/containers/a-colive.adb
ytomino/drake
33
15331
with Ada.Containers.Array_Sorting; -- diff (Ada.Unchecked_Conversion) with Ada.Unchecked_Deallocation; with System.Address_To_Named_Access_Conversions; with System.Growth; with System.Long_Long_Integer_Types; package body Ada.Containers.Limited_Vectors is pragma Check_Policy (Validate => Ignore); -- diff use type System.Address; use type System.Long_Long_Integer_Types.Word_Integer; subtype Word_Integer is System.Long_Long_Integer_Types.Word_Integer; package DA_Conv is new System.Address_To_Named_Access_Conversions (Data, Data_Access); -- diff (Upcast) -- -- diff (Downcast) -- procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access); procedure Free is new Unchecked_Deallocation (Data, Data_Access); -- diff (Assign_Element) -- -- -- -- -- -- -- -- procedure Swap_Element (I, J : Word_Integer; Params : System.Address); procedure Swap_Element (I, J : Word_Integer; Params : System.Address) is Data : constant Data_Access := DA_Conv.To_Pointer (Params); Temp : constant Element_Access := Data.Items (Index_Type'Val (I)); begin Data.Items (Index_Type'Val (I)) := Data.Items (Index_Type'Val (J)); -- diff -- diff Data.Items (Index_Type'Val (J)) := Temp; end Swap_Element; -- diff (Equivalent_Element) -- -- -- -- -- -- procedure Allocate_Element ( Item : out Element_Access; New_Item : not null access function return Element_Type); procedure Allocate_Element ( Item : out Element_Access; New_Item : not null access function return Element_Type) is begin Item := new Element_Type'(New_Item.all); end Allocate_Element; procedure Release (Data : in out Data_Access); procedure Release (Data : in out Data_Access) is begin if Data /= null then for I in Data.Items'Range loop Free (Data.Items (I)); end loop; Free (Data); end if; end Release; -- diff (Allocate_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Move_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Copy_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Max_Length) -- -- -- -- -- -- procedure Reallocate (Container : in out Vector; Capacity : Count_Type); procedure Reallocate (Container : in out Vector; Capacity : Count_Type) is begin if Capacity /= Limited_Vectors.Capacity (Container) then declare Old_Data : Data_Access := Container.Data; begin if Capacity = 0 then Container.Data := null; else Container.Data := new Data'( Capacity_Last => Index_Type'First - 1 + Index_Type'Base (Capacity), Items => <>); for I in Index_Type'First .. Last (Container) loop Container.Data.Items (I) := Old_Data.Items (I); Old_Data.Items (I) := null; end loop; end if; Release (Old_Data); end; end if; end Reallocate; -- diff (Unique) -- -- -- -- -- -- -- -- -- -- -- implementation function Empty_Vector return Vector is begin return (Finalization.Limited_Controlled with Data => null, Length => 0); end Empty_Vector; function Has_Element (Position : Cursor) return Boolean is begin return Position /= No_Element; end Has_Element; -- diff ("=") -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function To_Vector (Length : Count_Type) return Vector is begin return Result : Vector do Insert_Space (Result, Index_Type'First, Length); end return; end To_Vector; -- diff (To_Vector) -- -- -- -- -- -- -- diff (Generic_Array_To_Vector) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff ("&") -- -- -- -- -- -- diff ("&") -- -- -- -- -- -- diff ("&") -- -- -- -- -- -- -- -- diff ("&") -- -- -- -- -- -- -- function Capacity (Container : Vector) return Count_Type is Data : constant Data_Access := Container.Data; begin if Data = null then return 0; else return Count_Type'Base (Data.Capacity_Last - Index_Type'First + 1); end if; end Capacity; procedure Reserve_Capacity ( Container : in out Vector; Capacity : Count_Type) is New_Capacity : constant Count_Type := Count_Type'Max (Capacity, Container.Length); begin Reallocate (Container, New_Capacity); end Reserve_Capacity; function Length (Container : Vector) return Count_Type is begin return Container.Length; end Length; procedure Set_Length (Container : in out Vector; Length : Count_Type) is Old_Capacity : constant Count_Type := Capacity (Container); -- diff begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff if Length > Old_Capacity then declare function Grow is new System.Growth.Good_Grow ( Count_Type, Component_Size => Element_Array'Component_Size); New_Capacity : constant Count_Type := Count_Type'Max (Grow (Old_Capacity), Length); begin -- diff -- diff -- diff -- diff Reallocate (Container, New_Capacity); end; end if; Container.Length := Length; end Set_Length; function Is_Empty (Container : Vector) return Boolean is begin return Container.Length = 0; end Is_Empty; procedure Clear (Container : in out Vector) is begin Release (Container.Data); Container.Length := 0; end Clear; function To_Cursor ( Container : Vector'Class; Index : Extended_Index) return Cursor is pragma Check (Pre, Check => Index <= Last_Index (Container) + 1 or else raise Constraint_Error); begin if Index = Index_Type'First + Index_Type'Base (Container.Length) then return No_Element; -- Last_Index (Container) + 1 else return Index; end if; end To_Cursor; -- diff (Element) -- -- -- -- -- -- -- -- -- -- diff (Replace_Element) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Query_Element ( Container : Vector'Class; Index : Index_Type; Process : not null access procedure (Element : Element_Type)) is begin Process ( Constant_Reference ( Vector (Container), Index) -- checking Constraint_Error .Element.all); end Query_Element; procedure Update_Element ( Container : in out Vector'Class; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is begin Process ( Reference (Vector (Container), Position) -- checking Constraint_Error .Element.all); end Update_Element; function Constant_Reference (Container : aliased Vector; Position : Cursor) return Constant_Reference_Type is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else raise Constraint_Error); begin -- diff declare Data : constant Data_Access := Container.Data; begin return (Element => Data.Items (Position).all'Access); end; end Constant_Reference; function Reference (Container : aliased in out Vector; Position : Cursor) return Reference_Type is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else raise Constraint_Error); begin -- diff declare Data : constant Data_Access := Container.Data; begin return (Element => Data.Items (Position).all'Access); end; end Reference; -- diff (Assign) -- -- -- -- -- -- -- -- diff (Copy) -- -- -- -- -- procedure Move (Target : in out Vector; Source : in out Vector) is begin Release (Target.Data); Target.Data := Source.Data; Source.Data := null; -- diff Target.Length := Source.Length; Source.Length := 0; end Move; -- diff (Insert) -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Insert) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Insert ( Container : in out Vector'Class; Before : Cursor; New_Item : not null access function return Element_Type; Count : Count_Type := 1) is Position : Cursor; begin Insert ( Container, Before, -- checking Constraint_Error New_Item, Position, Count); end Insert; procedure Insert ( Container : in out Vector'Class; Before : Cursor; New_Item : not null access function return Element_Type; Position : out Cursor; Count : Count_Type := 1) is begin Insert_Space ( Vector (Container), Before, -- checking Constraint_Error Position, Count); for I in Position .. Position + Index_Type'Base (Count) - 1 loop declare E : Element_Access renames Container.Data.Items (I); begin pragma Check (Validate, E = null); Allocate_Element (E, New_Item); end; end loop; end Insert; -- diff (Prepend) -- -- -- -- -- -- procedure Prepend ( Container : in out Vector'Class; New_Item : not null access function return Element_Type; Count : Count_Type := 1) is begin Insert (Container, Index_Type'First, New_Item, Count); end Prepend; -- diff (Append) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Append ( Container : in out Vector'Class; New_Item : not null access function return Element_Type; Count : Count_Type := 1) is Old_Length : constant Count_Type := Container.Length; begin Set_Length (Vector (Container), Old_Length + Count); for I in Index_Type'First + Index_Type'Base (Old_Length) .. Last (Vector (Container)) loop declare E : Element_Access renames Container.Data.Items (I); begin pragma Check (Validate, E = null); Allocate_Element (E, New_Item); end; end loop; end Append; procedure Insert_Space ( Container : in out Vector'Class; Before : Extended_Index; Count : Count_Type := 1) is Position : Cursor; begin Insert_Space ( Vector (Container), Before, -- checking Constraint_Error Position, Count); end Insert_Space; procedure Insert_Space ( Container : in out Vector; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) is pragma Check (Pre, Check => Before <= Last (Container) + 1 or else raise Constraint_Error); Old_Length : constant Count_Type := Container.Length; After_Last : constant Index_Type'Base := Index_Type'First + Index_Type'Base (Old_Length); begin Position := Before; if Position = No_Element then Position := After_Last; end if; if Count > 0 then Set_Length (Container, Old_Length + Count); if Position < After_Last then -- Last_Index (Container) + 1 -- diff declare Data : constant Data_Access := Container.Data; subtype R1 is Extended_Index range Position + Index_Type'Base (Count) .. After_Last - 1 + Index_Type'Base (Count); subtype R2 is Extended_Index range Position .. After_Last - 1; begin for I in R2'Last + 1 .. R1'Last loop Free (Data.Items (I)); end loop; Data.Items (R1) := Data.Items (R2); for I in R2'First .. R1'First - 1 loop Data.Items (I) := null; end loop; end; end if; end if; end Insert_Space; procedure Delete ( Container : in out Vector; Position : in out Cursor; Count : Count_Type := 1) is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) - Index_Type'Base (Count) + 1 or else raise Constraint_Error); begin if Count > 0 then declare Old_Length : constant Count_Type := Container.Length; After_Last : constant Index_Type'Base := Index_Type'First + Index_Type'Base (Old_Length); begin if Position + Index_Type'Base (Count) < After_Last then -- diff declare Data : constant Data_Access := Container.Data; subtype R1 is Extended_Index range Position .. After_Last - 1 - Index_Type'Base (Count); subtype R2 is Extended_Index range Position + Index_Type'Base (Count) .. After_Last - 1; begin for I in R1'First .. R2'First - 1 loop Free (Data.Items (I)); end loop; Data.Items (R1) := Data.Items (R2); for I in R1'Last + 1 .. R2'Last loop Data.Items (I) := null; end loop; end; end if; Container.Length := Old_Length - Count; Position := No_Element; end; end if; end Delete; procedure Delete_First ( Container : in out Vector'Class; Count : Count_Type := 1) is Position : Cursor := Index_Type'First; begin Delete (Vector (Container), Position, Count => Count); end Delete_First; procedure Delete_Last ( Container : in out Vector'Class; Count : Count_Type := 1) is begin Container.Length := Container.Length - Count; end Delete_Last; procedure Reverse_Elements (Container : in out Vector) is begin -- diff -- diff Array_Sorting.In_Place_Reverse ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Container.Data), Swap => Swap_Element'Access); -- diff end Reverse_Elements; procedure Swap (Container : in out Vector; I, J : Cursor) is pragma Check (Pre, Check => (I in Index_Type'First .. Last (Container) and then J in Index_Type'First .. Last (Container)) or else raise Constraint_Error); begin -- diff Swap_Element ( Index_Type'Pos (I), Index_Type'Pos (J), DA_Conv.To_Address (Container.Data)); end Swap; function First_Index (Container : Vector'Class) return Index_Type is pragma Unreferenced (Container); begin return Index_Type'First; end First_Index; function First (Container : Vector) return Cursor is begin if Container.Length = 0 then return No_Element; else return Index_Type'First; end if; end First; -- diff (First_Element) -- -- -- -- function Last_Index (Container : Vector'Class) return Extended_Index is begin return Last (Vector (Container)); end Last_Index; function Last (Container : Vector) return Cursor is begin return Index_Type'First - 1 + Index_Type'Base (Container.Length); end Last; -- diff (Last_Element) -- -- -- -- -- diff (Find_Index) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Find) -- -- -- -- -- -- -- diff (Find) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Reverse_Find_Index) -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Reverse_Find) -- -- -- -- -- -- -- diff (Reverse_Find) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Contains) -- -- -- -- procedure Iterate ( Container : Vector'Class; Process : not null access procedure (Position : Cursor)) is begin for I in Index_Type'First .. Last (Vector (Container)) loop Process (I); end loop; end Iterate; procedure Reverse_Iterate ( Container : Vector'Class; Process : not null access procedure (Position : Cursor)) is begin for I in reverse Index_Type'First .. Last (Vector (Container)) loop Process (I); end loop; end Reverse_Iterate; function Iterate (Container : Vector'Class) return Vector_Iterator_Interfaces.Reversible_Iterator'Class is begin return Vector_Iterator'( First => First (Vector (Container)), Last => Last (Vector (Container))); end Iterate; function Iterate (Container : Vector'Class; First, Last : Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class is pragma Check (Pre, Check => (First <= Limited_Vectors.Last (Vector (Container)) + 1 and then Last <= Limited_Vectors.Last (Vector (Container))) or else raise Constraint_Error); Actual_First : Cursor := First; Actual_Last : Cursor := Last; begin if Actual_First = No_Element or else Actual_Last < Actual_First -- implies Last = No_Element then Actual_First := No_Element; Actual_Last := No_Element; end if; return Vector_Iterator'(First => Actual_First, Last => Actual_Last); end Iterate; -- diff (Constant_Reference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Reference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Adjust) -- -- -- overriding function First (Object : Vector_Iterator) return Cursor is begin return Object.First; end First; overriding function Next (Object : Vector_Iterator; Position : Cursor) return Cursor is begin if Position >= Object.Last then return No_Element; else return Position + 1; end if; end Next; overriding function Last (Object : Vector_Iterator) return Cursor is begin return Object.Last; end Last; overriding function Previous (Object : Vector_Iterator; Position : Cursor) return Cursor is begin if Position <= Object.First then return No_Element; else return Position - 1; end if; end Previous; -- diff (Constant_Indexing) -- -- -- -- -- -- -- diff (Indexing) -- -- -- -- -- -- package body Generic_Sorting is function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean; function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean is Data : constant Data_Access := DA_Conv.To_Pointer (Params); begin return Data.Items (Index_Type'Val (Left)).all < Data.Items (Index_Type'Val (Right)).all; end LT; function Is_Sorted (Container : Vector) return Boolean is begin -- diff -- diff -- diff -- diff return Array_Sorting.Is_Sorted ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Container.Data), LT => LT'Access); -- diff end Is_Sorted; procedure Sort (Container : in out Vector) is begin -- diff -- diff Array_Sorting.In_Place_Merge_Sort ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Container.Data), LT => LT'Access, Swap => Swap_Element'Access); -- diff end Sort; procedure Merge (Target : in out Vector; Source : in out Vector) is pragma Check (Pre, Check => Target'Address /= Source'Address or else Is_Empty (Target) or else raise Program_Error); -- RM A.18.2(237/3), same nonempty container begin if Source.Length > 0 then declare Old_Length : constant Count_Type := Target.Length; begin if Old_Length = 0 then Move (Target, Source); else Set_Length (Target, Old_Length + Source.Length); -- diff -- diff for I in Index_Type'First .. Last (Source) loop Target.Data.Items ( I + Index_Type'Base (Old_Length)) := Source.Data.Items (I); Source.Data.Items (I) := null; end loop; Source.Length := 0; Array_Sorting.In_Place_Merge ( Index_Type'Pos (Index_Type'First), Word_Integer (Index_Type'First) + Word_Integer (Old_Length), Index_Type'Pos (Last (Target)), DA_Conv.To_Address (Target.Data), LT => LT'Access, Swap => Swap_Element'Access); end if; end; end if; end Merge; end Generic_Sorting; package body Equivalents is function Equivalent_Element (Left : Element_Access; Right : Element_Type) return Boolean; function Equivalent_Element (Left : Element_Access; Right : Element_Type) return Boolean is begin return Left /= null and then Left.all = Right; end Equivalent_Element; function "=" (Left, Right : Vector) return Boolean is begin if Left.Length /= Right.Length then return False; else for I in Index_Type'First .. Last (Left) loop if Left.Data.Items (I) = null then if Right.Data.Items (I) /= null then return False; end if; elsif not Equivalent_Element ( Right.Data.Items (I), Left.Data.Items (I).all) then return False; end if; end loop; return True; end if; end "="; function Find ( Container : Vector; Item : Element_Type) return Cursor is begin return Find (Container, Item, First (Container)); end Find; function Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else (Is_Empty (Container) and then Position = No_Element) or else raise Constraint_Error); begin if Position >= Index_Type'First then for I in Position .. Last (Container) loop if Equivalent_Element (Container.Data.Items (I), Item) then return I; end if; end loop; end if; return No_Element; end Find; function Reverse_Find ( Container : Vector; Item : Element_Type) return Cursor is begin return Reverse_Find (Container, Item, Last (Container)); end Reverse_Find; function Reverse_Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else (Is_Empty (Container) and then Position = No_Element) or else raise Constraint_Error); begin if Position >= Index_Type'First then for I in reverse Index_Type'First .. Position loop if Equivalent_Element (Container.Data.Items (I), Item) then return I; end if; end loop; end if; return No_Element; end Reverse_Find; function Contains (Container : Vector; Item : Element_Type) return Boolean is begin return Reverse_Find (Container, Item) /= No_Element; end Contains; end Equivalents; end Ada.Containers.Limited_Vectors;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_2009_1649.asm
ljhsiun2/medusa
9
164582
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_A_ht+0x4316, %rsi lea addresses_UC_ht+0x14b16, %rdi sub %rax, %rax mov $111, %rcx rep movsb nop nop nop xor $23071, %rcx lea addresses_normal_ht+0x9e6, %rsi lea addresses_D_ht+0x4156, %rdi nop nop xor %r10, %r10 mov $14, %rcx rep movsq nop nop nop nop nop cmp %rax, %rax lea addresses_UC_ht+0xdd16, %r15 nop nop nop dec %r14 mov (%r15), %rsi nop nop dec %rsi lea addresses_UC_ht+0x17b16, %r14 nop nop nop cmp $33555, %r10 mov $0x6162636465666768, %r15 movq %r15, %xmm1 movups %xmm1, (%r14) dec %r10 lea addresses_WT_ht+0xe634, %rdi nop nop nop cmp $44562, %rcx vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rsi and $54992, %rdi lea addresses_D_ht+0x13056, %r15 nop nop and %r14, %r14 movw $0x6162, (%r15) nop nop nop nop and $11813, %rcx lea addresses_A_ht+0x801e, %rcx nop nop nop nop nop sub %r15, %r15 movups (%rcx), %xmm3 vpextrq $0, %xmm3, %rsi dec %rsi lea addresses_D_ht+0x1848, %rcx nop nop cmp %rsi, %rsi mov (%rcx), %rax inc %r10 lea addresses_normal_ht+0x14d92, %r15 nop nop nop nop sub $38884, %rsi mov $0x6162636465666768, %rdi movq %rdi, (%r15) nop nop nop nop nop xor $26018, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WT+0x16b16, %r8 nop nop nop nop sub $58234, %rdi movl $0x51525354, (%r8) xor %r10, %r10 // REPMOV lea addresses_WT+0x3316, %rsi lea addresses_WT+0x3316, %rdi clflush (%rsi) nop nop nop add %rdx, %rdx mov $14, %rcx rep movsq nop nop dec %r10 // Faulty Load lea addresses_WT+0x3316, %r10 nop nop and $1637, %rcx movups (%r10), %xmm6 vpextrq $0, %xmm6, %rbx lea oracles, %r8 and $0xff, %rbx shlq $12, %rbx mov (%r8,%rbx,1), %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_WT', 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'39': 2009} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/cosh.asm
jpoikela/z88dk
640
3457
SECTION code_clib SECTION code_fp_math48 PUBLIC cosh EXTERN cm48_sccz80_cosh defc cosh = cm48_sccz80_cosh
tests/src/tests-device.adb
Fabien-Chouteau/usb_embedded
14
2573
<gh_stars>10-100 with AAA.Strings; with HAL; use HAL; with USB_Testing.UDC_Stub; use USB_Testing.UDC_Stub; with USB_Testing.UDC_Scenarios; with USB_Testing; use USB_Testing; with USB.HAL.Device; use USB.HAL.Device; with USB; use USB; package body Tests.Device is ------------ -- Set_Up -- ------------ overriding procedure Set_Up (T : in out UDC_Stub_Fixture) is begin null; end Set_Up; ----------------------- -- Device_Descriptor -- ----------------------- procedure Device_Descriptor (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => True); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Poll -> RESET") .Append ("UDC Reset") .Append ("UDC EP_Setup [EP_IN 0] Type: CONTROL Max_Size: 64") .Append ("UDC EP_Setup [EP_OUT 0] Type: CONTROL Max_Size: 64") .Append ("UDC Set_Address 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Reset") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 256 Index: 0 Len: 64") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 18 bytes") .Append ("0000_0000_0000_0000: 12 01 10 01 00 00 00 40 66 66 42 42 21 01 01 02 .......@ffBB!...") .Append ("0000_0000_0000_0010: 03 01 ..") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 18") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 0") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => False); end Device_Descriptor; ----------------------- -- No_Status_Out_ZLP -- ----------------------- procedure No_Status_Out_ZLP (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & Stub_Scenario'(1 => (Kind => Set_Verbose, Verbose => False), 2 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, -- Get Device descriptor Req => ((Dev, 0, Stand, Device_To_Host), 6, 16#0100#, 0, 64), Req_EP => 0)), -- Do NOT ACK the IN transfer with a ZLP, but send another -- request instead. 3 => (Kind => Set_Verbose, Verbose => True), 4 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, -- Get Device descriptor Req => ((Dev, 0, Stand, Device_To_Host), 6, 16#0100#, 0, 64), Req_EP => 0)) ); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 256 Index: 0 Len: 64") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 18 bytes") .Append ("0000_0000_0000_0000: 12 01 10 01 00 00 00 40 66 66 42 42 21 01 01 02 .......@ffBB!...") .Append ("0000_0000_0000_0010: 03 01 ..") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 18") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => False); end No_Status_Out_ZLP; ----------------- -- Set_Address -- ----------------- procedure Set_Address (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & UDC_Scenarios.Set_Address (Verbose => True); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,STAND,DEV) Req: 5 Val: 42 Index: 0 Len: 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] ZLP") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 0") .Append ("UDC Set_Address 42") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => False); end Set_Address; ----------------------- -- Set_Early_Address -- ----------------------- procedure Set_Early_Address (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & UDC_Scenarios.Set_Address (Verbose => True); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,STAND,DEV) Req: 5 Val: 42 Index: 0 Len: 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC Set_Address 42") .Append ("UDC EP_Write_Packet [EP_IN 0] ZLP") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 0") .Append ("UDC Set_Address 42") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => True); end Set_Early_Address; ---------------------- -- Control_Data_Out -- ---------------------- procedure Control_Data_Out (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & Stub_Scenario'(1 => (Kind => Set_Verbose, Verbose => True), 2 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, -- Use an invalid request to trigger a stall -- after the data transfer. Req => ((Dev, 0, Class, Host_To_Device), 42, 0, 0, 16), Req_EP => 0)), 3 => (Kind => UDC_Event_E, Evt => (Kind => Transfer_Complete, EP => (0, EP_Out), BCNT => 16) ) ); RX_Data : aliased constant UInt8_Array := (1 .. 16 => 42); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,CLASS,DEV) Req: 42 Val: 0 Index: 0 Len: 16") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 16") .Append ("UDC OUT Transfer [EP_OUT 0] 16 bytes") .Append ("0000_0000_0000_0000: 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A ****************") .Append ("USB Class 1 Setup_Request Type: (HOST_TO_DEVICE,CLASS,DEV) Req: 42 Val: 0 Index: 0 Len: 16") .Append ("0000_0000_0000_0000: 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A ****************") .Append ("UDC EP_Stall [EP_IN 0] TRUE") .Append ("UDC EP_Stall [EP_OUT 0] TRUE") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => True); end Control_Data_Out; ----------------------- -- Get_Device_Config -- ----------------------- procedure Get_Device_Config (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & UDC_Scenarios.Set_Address (Verbose => False, Addr => 42) & UDC_Scenarios.Get_Config (Verbose => True); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 512 Index: 0 Len: 255") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 59 bytes") .Append ("0000_0000_0000_0000: 09 02 3B 00 01 01 00 80 32 00 00 00 00 00 00 00 ..;.....2.......") .Append ("0000_0000_0000_0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................") .Append ("0000_0000_0000_0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................") .Append ("0000_0000_0000_0030: 00 00 00 00 00 00 00 00 00 00 00 ...........") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 59") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 0") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => True); end Get_Device_Config; ----------------------- -- String_Descriptor -- ----------------------- procedure String_Descriptor (Unused : in out UDC_Stub_Fixture) is Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & UDC_Scenarios.Get_Config (Verbose => False) -- Get string #1 usually manufacturer from device desc & UDC_Scenarios.Get_String (Verbose => True, Id => 1, Ack => True) -- Get string #2 usually product from device desc & UDC_Scenarios.Get_String (Verbose => True, Id => 2, Ack => True) -- Get string #3 usually serial number from device desc & UDC_Scenarios.Get_String (Verbose => True, Id => 3, Ack => True) -- Get invalid string & UDC_Scenarios.Get_String (Verbose => True, Id => 42, Ack => False); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 769 Index: 0 Len: 255") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 26 bytes") .Append ("0000_0000_0000_0000: 1A 03 4D 00 61 00 6E 00 75 00 66 00 61 00 63 00 ..M.a.n.u.f.a.c.") .Append ("0000_0000_0000_0010: 74 00 75 00 72 00 65 00 72 00 t.u.r.e.r.") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 26") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 0") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 770 Index: 0 Len: 255") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 16 bytes") .Append ("0000_0000_0000_0000: 10 03 50 00 72 00 6F 00 64 00 75 00 63 00 74 00 ..P.r.o.d.u.c.t.") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 16") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 0") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 771 Index: 0 Len: 255") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Write_Packet [EP_IN 0] 14 bytes") .Append ("0000_0000_0000_0000: 0E 03 53 00 65 00 72 00 69 00 61 00 6C 00 ..S.e.r.i.a.l.") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 14") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] TRUE") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_OUT 0] BCNT: 0") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (DEVICE_TO_HOST,STAND,DEV) Req: 6 Val: 810 Index: 0 Len: 255") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Stall [EP_IN 0] TRUE") .Append ("UDC EP_Stall [EP_OUT 0] TRUE") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, Expected, RX_Data, Early_Address => True); end String_Descriptor; -------------------------- -- Iface_Setup_Dispatch -- -------------------------- procedure Iface_Setup_Dispatch (Unused : in out UDC_Stub_Fixture) is -- The Stub classes only have one interface each, so the interface IDs -- should be: -- -- Class 1 -> interface ID 0 -- -- Class 2 -> interface ID 1 Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & Stub_Scenario'(1 => (Kind => Set_Verbose, Verbose => True), 2 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 0, -- Interface ID of class 1 0), Req_EP => 0)), 3 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 1, -- Interface ID of class 2 0), Req_EP => 0)), 4 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 2, -- Invalid interface ID 0), Req_EP => 0)) ); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); Expected : constant AAA.Strings.Vector := AAA.Strings.Empty_Vector .Append ("UDC Initialize") .Append ("UDC Start") .Append ("UDC Verbose off") .Append ("UDC Verbose on") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,STAND,IFACE) Req: 0 Val: 0 Index: 0 Len: 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("USB Class 1 Setup_Request Type: (HOST_TO_DEVICE,STAND,IFACE) Req: 0 Val: 0 Index: 0 Len: 0") .Append ("UDC EP_Write_Packet [EP_IN 0] ZLP") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 0") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,STAND,IFACE) Req: 0 Val: 0 Index: 1 Len: 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("USB Class 2 Setup_Request Type: (HOST_TO_DEVICE,STAND,IFACE) Req: 0 Val: 0 Index: 1 Len: 0") .Append ("UDC EP_Write_Packet [EP_IN 0] ZLP") .Append ("UDC Poll -> TRANSFER_COMPLETE [EP_IN 0] BCNT: 0") .Append ("UDC Poll -> SETUP_REQUEST [EP_OUT 0] Type: (HOST_TO_DEVICE,STAND,IFACE) Req: 0 Val: 0 Index: 2 Len: 0") .Append ("UDC EP_Ready_For_Data [EP_OUT 0] FALSE") .Append ("UDC EP_Stall [EP_IN 0] TRUE") .Append ("UDC EP_Stall [EP_OUT 0] TRUE") .Append ("UDC Poll -> NONE"); begin USB_Testing.UDC_Scenarios.Two_Classes_UDC_Test (Scenario, Expected, RX_Data); end Iface_Setup_Dispatch; begin Suite.Add_Test (UDC_Stub_Caller.Create ("Device_Descriptor", Device_Descriptor'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("Get_Device_Config", Get_Device_Config'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("No Status Out ZLP", No_Status_Out_ZLP'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("Set_Address", Set_Address'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("Set_Early_Address", Set_Early_Address'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("Control_Data_Out", Control_Data_Out'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("String Descriptor", String_Descriptor'Access)); Suite.Add_Test (UDC_Stub_Caller.Create ("iface Setup Dispatch", Iface_Setup_Dispatch'Access)); end Tests.Device;
hdr.asm
malayli/snes-bg3-text
1
95966
<gh_stars>1-10 ;==LoRom== ; We'll get to HiRom some other time. .MEMORYMAP ; Begin describing the system architecture. SLOTSIZE $8000 ; The slot is $8000 bytes in size. More details on slots later. DEFAULTSLOT 0 ; There's only 1 slot in SNES, there are more in other consoles. SLOT 0 $8000 ; Defines Slot 0's starting address. SLOT 1 $0 $2000 SLOT 2 $2000 $E000 SLOT 3 $0 $10000 .ENDME ; End MemoryMap definition .ROMBANKSIZE $8000 ; Every ROM bank is 32 KBytes in size .ROMBANKS 8 ; 2 Mbits - Tell WLA we want to use 8 ROM Banks .SNESHEADER ID "SNES" ; 1-4 letter string, just leave it as "SNES" NAME "LIBSNES MULT SPRITES " ; Program Title - can't be over 21 bytes, ; "123456789012345678901" ; use spaces for unused bytes of the name. SLOWROM LOROM CARTRIDGETYPE $00 ; $00=ROM, $01=ROM+RAM, $02=ROM+SRAM, $03=ROM+DSP1, $04=ROM+RAM+DSP1, $05=ROM+SRAM+DSP1, $13=ROM+Super FX ROMSIZE $08 ; $08=2 Megabits, $09=4 Megabits,$0A=8 Megabits,$0B=16 Megabits,$0C=32 Megabits SRAMSIZE $00 ; $00=0 kilobits, $01=16 kilobits, $02=32 kilobits, $03=64 kilobits COUNTRY $01 ; $01= U.S., $00=Japan, $02=Europe, $03=Sweden/Scandinavia, $04=Finland, $05=Denmark, $06=France, $07=Netherlands, $08=Spain, $09=Germany, $0A=Italy, $0B=China, $0C=Indonesia, $0D=Korea LICENSEECODE $00 ; Just use $00 VERSION $00 ; $00 = 1.00, $01 = 1.01, etc. .ENDSNES .SNESNATIVEVECTOR ; Define Native Mode interrupt vector table COP EmptyHandler BRK EmptyHandler ABORT EmptyHandler NMI VBlank IRQ EmptyHandler .ENDNATIVEVECTOR .SNESEMUVECTOR ; Define Emulation Mode interrupt vector table COP EmptyHandler ABORT EmptyHandler NMI EmptyHandler RESET tcc__start ; where execution starts IRQBRK EmptyHandler .ENDEMUVECTOR
oeis/131/A131935.asm
neoneye/loda-programs
11
164501
; A131935: a(n) is the number of Khalimsky-continuous functions with four-point codomain and an n-point range. ; Submitted by <NAME> ; 4,7,15,31,65,136,285,597,1251,2621,5492,11507,24111,50519,105853 lpb $0 sub $0,1 sub $3,$4 add $1,$3 add $4,1 add $4,$2 add $2,$3 mov $5,$4 mov $4,$2 mov $2,$3 add $2,1 add $4,1 add $4,$1 add $5,$4 mov $3,$5 lpe add $4,$3 mov $0,$4 add $0,4
asm_main.asm
JoseC1/Project_3
0
89493
; ; file: asm_main.asm %include "asm_io.inc" ; initialized data is put in the .data segment segment .data ;Greeting msg Gmsg: db "Welcome to my program, my name is Jose",10,0 ;Age messages Amsg: db "I am currently ",0 Amsg_2: db " years old",10,0 ;Age num: dd 19; ;Favorite Letter Msg Lmsg: db "And my favorite letter is: ",0 ;Favorite Letter char: db "J",0 ;Questions Q1: db "Now Please Enter Your Favorite Letter",10,0 Q2: db "And Please Enter Your Age",10,0 ;Leaving Msg Bmsg: db "Thank you for playing Good Bye :)",10,0 ; uninitialized data is put in the .bss segment segment .bss input1: resd 1 ;This will save The answer to there ;first question input2: resd 1 ;This will save the answer to there ;Second Question ; code is put in the .text segment segment .text global asm_main asm_main: enter 0,0 ; setup routine pusha mov eax, 0 ;Zeroing out eax mov eax, Gmsg ;Moving the Address of my Greeting Msg ;Into my eax register call print_string ;This will print my greeting msg ;On to the screen call print_nl ;Adds a New line mov eax, Amsg ;This moves the address of my Age Msg ;Into my eax register call print_string ;This prints the first part of my ;Age msg onto the screen mov eax, DWORD[num] ;This moves the context of my num ;Variable into my eax register call print_int ;This will print my age onto the screen mov eax, Amsg_2 ;This will move the address of the ;Second part Age msg into eax register call print_string ;This will print the second part of ;the Age msg on to the screen call print_nl ;This will print a NEWLINE mov eax, Lmsg ;This moves the address of the ;Favorite Letter Msg into eax call print_string ;This will print My Favorite ;Letter Msg on to the screen mov eax, [char] ;This will move the context of my char ;variable into eax (putting J in eax) ;Note Char contains my favorite letter call print_char ;This will print my Favorite letter ;On to the screen call print_nl call print_nl ;Printing a Double NewLine To look cleaner ;This part of the code Ask the questions to the user: mov eax, Q1 ;This will move the address of the first ;Question into Eax call print_string ;This will print the first_Question call read_char ;This will read in their data and save ;Its ASCHII CODE in the eax register mov [input1], eax ;This saves their answer in the ;input1 variable mov eax, Q2 ;This will moves the address of the second ;Question into Eax call print_string ;This prints the Second Question call read_int ;This will read in the integer they ;Enter and save it in eax mov [input2], eax ;This Save their Answer in the ;Input2 Variable mov eax, Bmsg ;This moves the context of the Adress ;Of the bye msg into eax call print_string ;This prints the Bye msg to Screen call print_nl popa mov eax, 0 ; return back to C leave ret
src/render-fonts.ads
docandrew/troodon
5
22425
with Freetype; package Render.Fonts is FONT_SIZE : constant := 14; -- We reuse this object to store the current character glyph face : Freetype.FT_Face; emojiFace : Freetype.FT_Face; --glyph : Freetype.FT_GlyphSlot; function loadGlyph (c : Character; fontFace : Freetype.FT_Face) return Boolean; function loadGlyph (c : Wide_Wide_Character; fontFace : Freetype.FT_Face) return Boolean; --------------------------------------------------------------------------- -- start -- Initialize Freetype and Fontconfig libraries --------------------------------------------------------------------------- procedure start; --------------------------------------------------------------------------- -- stop -- Perform clean up of Freetype and Fontconfig libraries --------------------------------------------------------------------------- procedure stop; end Render.Fonts;
programs/oeis/337/A337509.asm
karttu/loda
1
16812
; A337509: Number of partitions of n into two distinct parts (s,t), such that (t-s) | n, and where n/(t-s) <= s < t. ; 0,0,0,0,0,0,0,1,1,0,0,2,0,0,2,2,0,1,0,2,2,0,0,4,1,0,2,2,0,2,0,3,2,0,2,4,0,0,2,4,0,2,0,2,4,0,0,6,1,1,2,2,0,2,2,4,2,0,0,6,0,0,4,4,2,2,0,2,2,2,0,7,0,0,4,2,2,2,0,6,3,0,0,6,2,0,2,4,0,4,2,2,2,0,2,8 cal $0,338117 ; Number of partitions of n into two parts (s,t) such that (t-s) | n, where s < t. trn $0,1 mov $1,$0
src/openapi.ads
mgrojo/swagger-ada
0
4460
<gh_stars>0 ----------------------------------------------------------------------- -- openapi -- Support library for OpenAPI code generator -- Copyright (C) 2017, 2022 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Calendar; with Ada.Strings.Hash; with Ada.Iterator_Interfaces; with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Hashed_Maps; with Util.Beans.Objects.Vectors; with Util.Beans.Objects.Maps; with Util.Strings.Vectors; with Util.Nullables; -- == OpenAPI Introduction == -- The OpenAPI Ada library provides a small runtime for use by the OpenAPI Codegen -- REST API generator. The library provides operations that are used by the generated -- REST client and servers to: -- -- * serialize and deserialize the data in JSON or XML, -- * make the client REST operation and retrieve the result, -- * let a server receive a REST operation, handle it and return the result -- -- The <tt>Swagger</tt> root package defines the global types that are used by -- the generator to represent values such as strings, integers, dates. -- -- @include openapi-clients.ads -- @include openapi-servers.ads -- @include openapi-streams.ads package OpenAPI is subtype UString is Ada.Strings.Unbounded.Unbounded_String; subtype Nullable_UString is Util.Nullables.Nullable_String; function To_String (S : in UString) return String renames Ada.Strings.Unbounded.To_String; function To_UString (S : in String) return UString renames Ada.Strings.Unbounded.To_Unbounded_String; subtype Date is Ada.Calendar.Time; subtype Nullable_Date is Util.Nullables.Nullable_Time; subtype Datetime is Ada.Calendar.Time; subtype Vector is Util.Beans.Objects.Vectors.Vector; subtype Long is Long_Long_Integer; subtype Nullable_Long is Util.Nullables.Nullable_Long; subtype Nullable_Integer is Util.Nullables.Nullable_Integer; subtype Nullable_Boolean is Util.Nullables.Nullable_Boolean; subtype Http_Content_Type is UString; subtype File_Part_Type is UString; subtype Number is Natural; subtype Object is Util.Beans.Objects.Object; subtype Value_Type is Util.Beans.Objects.Object; package UString_Vectors renames Util.Strings.Vectors; subtype Object_Map is Util.Beans.Objects.Maps.Map; package Nullable_UString_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Nullable_UString, "=" => Util.Nullables."="); -- Convert the long value into a string. function To_String (Value : in Long) return String; package Integer_Maps is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Integer, Hash => Ada.Strings.Hash, Equivalent_Keys => "="); subtype Integer_Map is Integer_Maps.Map; use Util.Nullables; package Nullable_Integer_Maps is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Nullable_Integer, Hash => Ada.Strings.Hash, Equivalent_Keys => "="); subtype Nullable_Integer_Map is Nullable_Integer_Maps.Map; type Value_Array_Type is tagged private with Constant_Indexing => Element_Value, Default_Iterator => Iterate, Iterator_Element => Value_Type; type Value_Cursor is private; function Has_Element (Pos : in Value_Cursor) return Boolean; package Value_Iterator is new Ada.Iterator_Interfaces (Cursor => Value_Cursor, Has_Element => Has_Element); function Element_Value (List : in Value_Array_Type; Pos : in Value_Cursor) return Value_Type; function Iterate (List : in Value_Array_Type) return Value_Iterator.Forward_Iterator'Class; private type Value_Array_Type is tagged record A : Util.Beans.Objects.Object; end record; type Value_Cursor is record List : Util.Beans.Objects.Object; Pos : Natural := 0; end record; type Iterator is new Value_Iterator.Forward_Iterator with record List : Util.Beans.Objects.Object; Pos : Natural := 0; end record; overriding function First (Iter : in Iterator) return Value_Cursor; overriding function Next (Object : in Iterator; Position : in Value_Cursor) return Value_Cursor; end OpenAPI;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_16477_702.asm
ljhsiun2/medusa
9
25632
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1930f, %r13 nop nop nop nop xor $2564, %rdx movl $0x61626364, (%r13) nop nop dec %r8 lea addresses_WT_ht+0xfeff, %rsi lea addresses_D_ht+0x2d6f, %rdi nop nop nop and $59145, %r10 mov $29, %rcx rep movsb nop nop nop sub %r13, %r13 lea addresses_A_ht+0x1c95f, %r8 inc %rdi movw $0x6162, (%r8) nop nop sub $25821, %r8 lea addresses_D_ht+0x18cc8, %r13 nop add $18167, %r10 mov (%r13), %edi nop nop nop nop and $38092, %r13 lea addresses_D_ht+0x1281b, %rdx nop cmp $3582, %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm5 movups %xmm5, (%rdx) nop sub %r13, %r13 lea addresses_WC_ht+0x96ff, %rsi lea addresses_D_ht+0x160ff, %rdi nop nop nop nop xor $2944, %r14 mov $76, %rcx rep movsq nop nop nop nop xor %r14, %r14 lea addresses_A_ht+0x14a33, %rsi nop nop nop xor $19700, %rdx movb $0x61, (%rsi) nop nop nop sub $1899, %rcx lea addresses_UC_ht+0x3c3f, %rcx nop nop nop and %rsi, %rsi and $0xffffffffffffffc0, %rcx vmovntdqa (%rcx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %r14 nop nop nop nop add $64976, %r13 lea addresses_WT_ht+0x12423, %rsi clflush (%rsi) nop nop nop nop nop sub %rcx, %rcx mov (%rsi), %r8 nop inc %rsi lea addresses_UC_ht+0xb0bf, %r13 nop nop nop inc %rsi movb $0x61, (%r13) nop nop nop nop sub $63443, %rcx lea addresses_WC_ht+0x8abf, %rsi lea addresses_A_ht+0x13968, %rdi nop nop add $32829, %r8 mov $126, %rcx rep movsl nop add %r13, %r13 lea addresses_WT_ht+0xebbf, %r10 inc %rsi mov (%r10), %edi nop nop nop and %rcx, %rcx lea addresses_D_ht+0xc3bf, %r10 nop nop nop nop xor %r13, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm7 movups %xmm7, (%r10) nop nop nop cmp $16666, %r14 lea addresses_WC_ht+0x12bdf, %rsi lea addresses_UC_ht+0x8a6b, %rdi nop inc %r14 mov $58, %rcx rep movsq nop nop add %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rcx push %rsi // Faulty Load lea addresses_WT+0x114ff, %r11 nop nop nop nop sub $64906, %r14 mov (%r11), %ecx lea oracles, %rsi and $0xff, %rcx shlq $12, %rcx mov (%rsi,%rcx,1), %rcx pop %rsi pop %rcx pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'39': 16477} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
tools/xmodem/highpage.asm
vipoo/msxrc2014
1
177576
ORG $8000 PUBLIC HIGHPAGEADDR, SIO_INT, SIO_RCVBUF, SIO_CNT, SIO_RTS, ORG_H_KEYI include "sio.inc" HIGHPAGEADDR: EQU $ SIO_RCVBUF: SIO_CNT: DB 0 ; CHARACTERS IN RING BUFFER SIO_HD: DW SIO_BUF ; BUFFER HEAD POINTER SIO_TL: DW SIO_BUF ; BUFFER TAIL POINTER SIO_BUF: DS SIO_BUFSZ, $00 ; RECEIVE RING BUFFER SIO_RTS: DB $FF ; 0 => RTS OFF, $FF => RTS ON ORG_H_KEYI: DS 5, 0 SIO_INT: DI ; INTERRUPTS WILL BE RE-ENABLED BY MSX BIOS ; CHECK TO SEE IF SOMETHING IS ACTUALLY THERE XOR A ; READ REGISTER 0 OUT (CMD_CH), A IN A, (CMD_CH) AND $01 ; ISOLATE RECEIVE READY BIT RET Z ; NOTHING AVAILABLE ON CURRENT CHANNEL SIO_INTRCV1: ; RECEIVE CHARACTER INTO BUFFER IN A, (DAT_CH) ; READ PORT LD B, A ; SAVE BYTE READ LD HL, SIO_RCVBUF LD A, (HL) ; GET COUNT CP SIO_BUFSZ ; COMPARE TO BUFFER SIZE JR Z, SIO_INTRCV4 ; BAIL OUT IF BUFFER FULL, RCV BYTE DISCARDED INC A ; INCREMENT THE COUNT LD (HL), A ; AND SAVE IT CP SIO_BUF_HI ; BUFFER GETTING FULL? JR NZ, SIO_INTRCV2 ; IF NOT, BYPASS CLEARING RTS LD A, 5 ; SELECTED REGISTER WRITE 5 OUT (CMD_CH), A LD A, SIO_RTSOFF OUT (CMD_CH), A XOR A LD (SIO_RTS), A SIO_INTRCV2: INC HL ; HL NOW HAS ADR OF HEAD PTR PUSH HL ; SAVE ADR OF HEAD PTR LD A, (HL) ; DEREFERENCE HL INC HL LD H, (HL) LD L, A ; HL IS NOW ACTUAL HEAD PTR LD (HL), B ; SAVE CHARACTER RECEIVED IN BUFFER AT HEAD INC HL ; BUMP HEAD POINTER POP DE ; RECOVER ADR OF HEAD PTR LD A, L ; GET LOW BYTE OF HEAD PTR SUB SIO_BUFSZ+4 ; SUBTRACT SIZE OF BUFFER AND POINTER CP E ; IF EQUAL TO START, HEAD PTR IS PAST BUF END JR NZ, SIO_INTRCV3 ; IF NOT, BYPASS LD H, D ; SET HL TO LD L, E ; ... HEAD PTR ADR INC HL ; BUMP PAST HEAD PTR INC HL INC HL INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START SIO_INTRCV3: EX DE, HL ; DE := HEAD PTR VAL, HL := ADR OF HEAD PTR LD (HL), E ; SAVE UPDATED HEAD PTR INC HL LD (HL), D ; CHECK FOR MORE PENDING... XOR A OUT (CMD_CH), A ; READ REGISTER 0 IN A, (CMD_CH) ; RRA ; READY BIT TO CF JR C, SIO_INTRCV1 ; IF SET, DO SOME MORE LD A, (SIO_RTS) OR A JR Z, SIO_INTRCV4 ; ABORT NOW IF RTS IS OFF ; TEST FOR NEW BYTES FOR A SHORT PERIOD OF TIME LD B, 40 SIO_MORE: IN A, (CMD_CH) ; RRA ; READY BIT TO CF JR C, SIO_INTRCV1 ; IF SET, DO SOME MORE DJNZ SIO_MORE SIO_INTRCV4: ; RESET INTERRUPT STATE IN SIO (CHANNEL A CONTROLS CHANNEL B ALSO) LD A, 0 OUT (SIO0A_CMD), A LD A, $38 OUT (SIO0A_CMD), A RET
tier-1/xcb/source/thin/xcb-xcb_render_linefix_t.ads
charlie5/cBound
2
7269
<reponame>charlie5/cBound -- This file is generated by SWIG. Please do not modify by hand. -- with xcb.xcb_render_pointfix_t; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_render_linefix_t is -- Item -- type Item is record p1 : aliased xcb.xcb_render_pointfix_t.Item; p2 : aliased xcb.xcb_render_pointfix_t.Item; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_linefix_t.Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_linefix_t.Item, Element_Array => xcb.xcb_render_linefix_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_linefix_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_linefix_t.Pointer, Element_Array => xcb.xcb_render_linefix_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_render_linefix_t;
Monkeybrains.g4
andytesti/mc2wasm
4
5288
<filename>Monkeybrains.g4 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ grammar Monkeybrains; IfToken : 'if'; ElseToken : 'else'; WhileToken : 'while'; DoToken : 'do'; ForToken : 'for'; VarToken : 'var'; ConstToken: 'const'; ClassToken: 'class'; FunctionToken: 'function'; ModuleToken: 'module'; EnumToken: 'enum'; SwitchToken: 'switch'; DefaultToken: 'default'; CaseToken: 'case'; InstanceOf: 'instanceof'; Has: 'has'; TryToken: 'try'; CatchToken: 'catch'; FinallyToken: 'finally'; ThrowToken: 'throw'; BlingToken: '$'; //Num : [-]?[0-9]+ | '0x'[0-9a-fA-F]+; HexNumber: '0x'[0-9a-fA-F]+[lL]?; OctalNumber: [0][0-9]*[lL]?; FloatNumber : ( ([0])('f'|'d')? | ([1-9][0-9]*))([\\.][0-9]+)?FloatExponent?('f'|'d')? | [\\.] [0-9]+ FloatExponent?('f'|'d')? ; fragment FloatExponent: [Ee][+-]?[0-9]+; Id: ([a-zA-Z_]|'\u0080'..'\ufffe')([a-zA-Z0-9_]|'\u0080'..'\ufffe')*; WS : [ \r\n\t]+ -> skip; fragment NEWLINE: '\r' '\n' | '\n' | '\r'; DoxyComment: '//!' ~[\r\n]* '\r'? (NEWLINE | EOF) -> channel(HIDDEN); Comment: '//' ~[\r\n]* '\r'? (NEWLINE | EOF) -> skip ; MultiLineComment: '/*' .*? '*/' -> skip; String: '"' ( EscapeSequence | ~[\\"] )* '"'; Char: '\'' ( EscapeSequence | ~[\\"] ) '\''; fragment HexDigit: [0-9a-fA-F]; fragment EscapeSequence: '\\' [nrtbf"'\\] | UnicodeSequence; fragment UnicodeSequence : '\\' 'u' HexDigit HexDigit HexDigit HexDigit; /* * A program assumes you are defining the global object, where you are * definiing functions, variables, classes, and modules. */ program : moduleDeclaration * EOF; /* * Modules are objects that are instantiated at startup. */ moduleDeclaration : annotations? flags=declarationFlags* (classdef | moduledef | functiondef | enumdef | variabledef ) | usingdef ; /* * A module is a class that automaticall instantiates at runtime * it is defined as * module Id * { * (class/variable/enum/function definition) * * } */ moduledef : ModuleToken id=symbol '{' moduleDeclaration* '}' ; /* * A hidden field is not visible from outside the field. * A final field is constant. */ declarationFlags : 'hidden' | 'static' | 'native' | 'public' | 'private' | 'protected' ; /* * Attribution is a way of associating symbols with a class member. It allows for * communication with the compiler without adding new types or keywords, opening a way * to add new features without changing the language */ annotations : '(' (symbolref (',')?)* ')' ; /* * A class is defined as * class ID (extends ClassId) * { * (var/function/class/enum) * * } */ classdef : ClassToken id=symbol ( 'extends' extendsValue=moduleId )? '{' classDeclaration* '}' ; /* * Classes are objects. You cannot define a module inside a class */ classDeclaration : annotations? flags=declarationFlags* (classdef | functiondef | variabledef | enumdef ) | usingdef ; /* * An enum is a module without functions and everything is final. It is defined as * enum Id * { * symbol ( = initializer )? * } */ enumDeclaration : id=symbol ( '=' initializer=variabledefInitializers)? ; enumdef : EnumToken '{' enumDeclaration (',' enumDeclaration)* ','? '}' ; /* * Functions are defined as * function Id ( Param, param...) * { * statements* * } */ functiondef : FunctionToken id=symbol paramDecl (codeBlock | ';') ; paramDecl : '(' ')' | '(' Id ( ',' Id )* ')' ; /* * Define a variable in a class */ variabledef : type=VarToken variabledefPair ( ',' variabledefPair ) * ';' | type=ConstToken variabledefPair ( ',' variabledefPair ) * ';' ; variabledefPair : id=symbol ( '=' initializer=variabledefInitializers )? ; variabledefInitializers : number | string | expression ; usingdef : 'using' usingModule=moduleId ('as' name=symbol)? ';' ; moduleId : symbol | moduleId '.' symbol ; /* * The statements are the high level operations in a function. */ statement : assignment ';' | procedureCall ';' | varDeclaration ';' | ifStatement | whileStatement | doStatement ';' | forStatement | switchStatement | breakStatement ';' | continueStatement ';' | throwStatement ';' | tryStatement | returnStatement ; /* Assignments are setting one value equal to another */ assignment : lvalue op=assignmentOperator expression | incrDecr lvalue | lvalue incrDecr ; /* Assignment Operators */ assignmentOperator : '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '>>=' | '<<=' | '&=' | '^=' | '|=' ; /* Handle pre and post increment/decrement */ incrDecr : '++' | '--' ; /* Procedure calls are when a call is made without capturing it's return value */ procedureCall : factor ; /* lValues are the left hand value of an assignment */ lvalue : (BlingToken op='.')? symbol lvalueExtension? | (BlingToken op='.')? symbol invocation lvalueExtension ; lvalueExtension : op='.' symbol lvalueExtension? | op='[' expression ']' lvalueExtension? | op='.' symbol invocation lvalueExtension ; /* Variable definitions. * def Id = x; */ varDeclaration : VarToken varDef ( ',' varDef )* ; varDef : Id ( '=' expression )? ; /* If statements */ ifStatement : IfToken '(' expression ')' ifCase = codeBlock ( ElseToken ( elseIfCase=ifStatement | elseCase=codeBlock ) )? ; /* While statement */ whileStatement : WhileToken '(' expression')' whileCode=codeBlock ; /* Do/while statement */ doStatement : DoToken whileCode=codeBlock WhileToken '(' expression ')' ; /* For loops */ forStatement : ForToken '(' initialize=forInitialize? ';' test=expression? ';' increment=forIncrement? ')' forCode=codeBlock ; forInitialize : assignment ( ',' assignment )* | varDeclaration ; forIncrement : assignment ( ',' assignment )* ; /* Break */ breakStatement : 'break' ; /* Continue */ continueStatement : 'continue' ; /* Switch/case statements */ switchStatement : SwitchToken '(' expression ')' '{' ( caseStatement )+ '}' ; caseStatement : CaseToken expression ':' caseStmt = statementSequenceEntry | CaseToken InstanceOf lvalue ':' caseStmt = statementSequenceEntry | DefaultToken ':' caseStmt = statementSequenceEntry ; /* Return values */ returnStatement : 'return' op=expression? ';' ; /* Code blocks */ statementSequenceEntry : statementSequence? | codeBlock ; statementSequence : statement statementSequence? | codeBlock statementSequence? ; codeBlock : '{' '}' | '{' statementSequence '}' ; /* try/catch/finally blocks */ tryStatement : tryBlock catchTypeBlock+ catchBlock? finallyBlock? | tryBlock catchTypeBlock* catchBlock finallyBlock? | tryBlock catchTypeBlock* catchBlock? finallyBlock ; tryBlock: TryToken codeBlock; catchTypeBlock: CatchToken '(' symbol InstanceOf lvalue ')' codeBlock; catchBlock: CatchToken '(' symbol ')' codeBlock; finallyBlock: FinallyToken codeBlock; /* throw statement */ throwStatement: ThrowToken ( lvalue | creation ); /* * Expressions are mathematical, logical, or other operation. */ expression : conditionalExpression ; conditionalExpression : conditionalOrExpression | conditionalOrExpression op='?' expression ':' conditionalExpression ; conditionalOrExpression : conditionalAndExpression | conditionalOrExpression op=('||' | 'or') conditionalOrExpression ; conditionalAndExpression : equalityExpression | conditionalAndExpression op=('&&' | 'and') conditionalAndExpression ; equalityExpression : simpleExpression ( op=expressionOps simpleExpression)* ; expressionOps : '==' | '<' | '<=' | '>' | '>=' | '!=' ; simpleExpression : pn=( '+' | '-')? term ( simpleExpressionOps term )* ; simpleExpressionOps : '+' | '-' | '|' | '^' | 'instanceof' ; term : factor ( op=termOps factor )* ; termOps: '*' | '/' | '%' | '&' | '<<' | '>>' | InstanceOf | Has ; factor : primary | op='~' factor | op='!' factor ; primary : literal | '(' expression ')' | symbol invocation | primary op='.' symbol invocation? | primary arrayAccess | creation ; literal : symbol | symbolref | number | string | bool | nullReference | character | BlingToken ; invocation : '(' argc+=expression (',' argc+=expression)* ')' | '(' ')' ; arrayAccess : '[' expression ']' ; keyValuePair : key=expression '=>' value=expression ; creation : op='new' lvalue invocation | op='new' '[' expression ']' | op='new' '[' expression ']b' | op='[' (expression ',')* expression? ']' | op='[' (expression ',')* expression? ']b' | op='{' (keyValuePair ',')* keyValuePair? '}' ; bool : 'true' | 'false' ; nullReference : 'null' ; string : String ; character : Char ; number : signValue=sign? integerLiteral | signValue=sign? floatLiteral ; symbol : Id ; symbolref : ':' symbolrefId ; symbolrefId : Id | Id '(' symbol ')' | Id '(' string ')' | Id '(' bool ')' | Id '(' nullReference ')' | Id '(' number ')' | Id '(' character ')' | symbolrefIdArray ; symbolrefIdArray : Id '(' '[' symbol (',' symbol)* ']' ')' ; sign : '+' | '-' ; integerLiteral : IntNumber | HexNumber | OctalNumber ; floatLiteral : FloatNumber | 'NaN' ;
oeis/157/A157636.asm
neoneye/loda-programs
11
84791
<reponame>neoneye/loda-programs ; A157636: Triangle read by rows: T(n, k) = 1 if k=0 or k=n, otherwise = n*k*(n-k)/2. ; Submitted by <NAME> ; 1,1,1,1,1,1,1,3,3,1,1,6,8,6,1,1,10,15,15,10,1,1,15,24,27,24,15,1,1,21,35,42,42,35,21,1,1,28,48,60,64,60,48,28,1,1,36,63,81,90,90,81,63,36,1,1,45,80,105,120,125,120,105,80,45,1,1,55,99,132,154,165,165,154,132,99,55,1,1,66,120,162,192,210,216,210,192,162,120,66,1,1,78,143,195,234,260,273,273,260 seq $0,157635 ; Triangle read by rows: T(n,m) = 1 if n*m*(n-m) = 0, and n*m*(n-m) otherwise. dif $0,2
src/risi_script-types-patterns.ads
OneWingedShark/Risi
1
23068
Pragma Ada_2012; Pragma Wide_Character_Encoding( UTF8 ); with Risi_Script.Types.Implementation, Ada.Characters.Handling; Package Risi_Script.Types.Patterns is Use Risi_Script.Types.Implementation; --------------------- -- PATTERN TYPES -- --------------------- --#TODO: Implement the pattern-types; they should have to- and from- --# string conversion functions. Type Half_Pattern(<>) is private; Type Three_Quarter_Pattern(<>) is private; Type Full_Pattern(<>) is private; Type Extended_Pattern(<>) is private; Type Square_Pattern(<>) is private; Type Cubic_Pattern(<>) is private; Type Power_Pattern(<>) is private; -- Pattern to String conversion. Function "+"( Pattern : Half_Pattern ) return String; Function "+"( Pattern : Three_Quarter_Pattern ) return String; Function "+"( Pattern : Full_Pattern ) return String; Function "+"( Pattern : Extended_Pattern ) return String; Function "+"( Pattern : Square_Pattern ) return String; Function "+"( Pattern : Cubic_Pattern ) return String; Function "+"( Pattern : Power_Pattern ) return String; -- String to Pattern conversion. -- Function "+"( Text : String ) return Half_Pattern; -- Function "+"( Text : String ) return Three_Quarter_Pattern; -- Function "+"( Text : String ) return Full_Pattern; -- Function "+"( Text : String ) return Extended_Pattern; -- Function "+"( Text : String ) return Square_Pattern; -- Function "+"( Text : String ) return Cubic_Pattern; -- Function "+"( Text : String ) return Power_Pattern; Function Match( Pattern : Half_Pattern; Indicators : Indicator_String ) return Boolean; Function Create( Input : Variable_List ) return Half_Pattern; ------------------ -- ATP Packet -- ------------------ -- Type ATP_Packet is private; -- function Create( Input : Variable_List ) return ATP_Packet; Private ---------------------------------- -- ELEMENTS FOR PATTERN TYPES -- ---------------------------------- Use Risi_Script.Types, Risi_Script.Types.Implementation; Type Enumeration_Length(Enum : Enumeration) is record case Enum is when RT_String | RT_Array | RT_Hash => Length : Natural; when others => Null; end case; end record; Type Pattern_Element is ( Half, Three_Quarter, Full ); Subtype Extended_Pattern_Element is Pattern_Element Range Half..Full; type Varying_Element( Element : Extended_Pattern_Element ) is record case Element is when Half => Half_Value : Enumeration; when Three_Quarter => TQ_Value : not null access Enumeration_Length; when Full => Full_Value : Representation; end case; end record; Type Half_Pattern is array (Positive range <>) of Enumeration; Type Three_Quarter_Pattern is array (Positive range <>) of not null access Enumeration_Length; Type Full_Pattern is array (Positive range <>) of Representation; Type Extended_Pattern is array (Positive range <>) of not null access Varying_Element; Type Square_Pattern is null record; Type Cubic_Pattern is null record; Type Power_Pattern is null record; -- Type ATP_Packet is record -- null; -- end record; -- function Create( Input : Variable_List ) return ATP_Packet is (null record); Package Conversions is -- Pattern to String conversion. Function Convert( Pattern : Half_Pattern ) return String; Function Convert( Pattern : Three_Quarter_Pattern ) return String; Function Convert( Pattern : Full_Pattern ) return String; Function Convert( Pattern : Extended_Pattern ) return String; Function Convert( Pattern : Square_Pattern ) return String; Function Convert( Pattern : Cubic_Pattern ) return String; Function Convert( Pattern : Power_Pattern ) return String; -- String to Pattern conversion. -- Function Convert( Text : String ) return Half_Pattern; -- Function Convert( Text : String ) return Three_Quarter_Pattern; -- Function Convert( Text : String ) return Full_Pattern; -- Function Convert( Text : String ) return Extended_Pattern; -- Function Convert( Text : String ) return Square_Pattern; -- Function Convert( Text : String ) return Cubic_Pattern; -- Function Convert( Text : String ) return Power_Pattern; end Conversions; Use Conversions; -- Pattern to String conversion. Function "+"( Pattern : Half_Pattern ) return String renames Convert; Function "+"( Pattern : Three_Quarter_Pattern ) return String renames Convert; Function "+"( Pattern : Full_Pattern ) return String renames Convert; Function "+"( Pattern : Extended_Pattern ) return String renames Convert; Function "+"( Pattern : Square_Pattern ) return String renames Convert; Function "+"( Pattern : Cubic_Pattern ) return String renames Convert; Function "+"( Pattern : Power_Pattern ) return String renames Convert; -- String to Pattern conversion. -- Function "+"( Text : String ) return Half_Pattern renames Convert; -- Function "+"( Text : String ) return Three_Quarter_Pattern renames Convert; -- Function "+"( Text : String ) return Full_Pattern renames Convert; -- Function "+"( Text : String ) return Extended_Pattern renames Convert; -- Function "+"( Text : String ) return Square_Pattern renames Convert; -- Function "+"( Text : String ) return Cubic_Pattern renames Convert; -- Function "+"( Text : String ) return Power_Pattern renames Convert; End Risi_Script.Types.Patterns;
programs/oeis/217/A217477.asm
neoneye/loda
22
177606
<reponame>neoneye/loda<filename>programs/oeis/217/A217477.asm ; A217477: Z-sequence for the Riordan triangle A111125; ; 3,-4,12,-40,140,-504,1848,-6864,25740,-97240,369512,-1410864,5408312,-20801200,80233200,-310235040,1202160780,-4667212440,18150270600,-70690527600,275693057640,-1076515748880,4208197927440,-16466861455200 mov $1,2 mov $2,1 mov $3,$0 add $3,2 sub $2,$3 sub $1,$2 bin $2,$0 lpb $0 mov $0,0 mov $1,$2 mul $1,2 lpe mov $0,$1
oeis/017/A017227.asm
neoneye/loda-programs
11
163615
; A017227: a(n) = (9*n + 5)^7. ; 78125,105413504,3404825447,34359738368,194754273881,781250000000,2488651484819,6722988818432,16048523266853,34792782221696,69833729609375,131593177923584,235260548044817,402271083010688,662062621900811,1054135040000000,1630436461403549,2458100350228352,3622557586593623,5231047633534976,7416552901015625,10342180413198464,14206014885142787,19246467315089408,25748143198497941,34048254470000000,44543599279432079,57698133708111872,74051159531521793,94226152134563456,118940252685546875 mul $0,9 add $0,5 pow $0,7
Cubical/Structures/Relational/Auto.agda
Schippmunk/cubical
0
10842
<filename>Cubical/Structures/Relational/Auto.agda {- Macros (autoDesc, AutoStructure, AutoEquivStr, autoUnivalentStr) for automatically generating structure definitions. For example: autoDesc (λ (X : Type₀) → X → X × ℕ) ↦ function+ var (var , constant ℕ) We prefer to use the constant structure whenever possible, e.g., [autoDesc (λ (X : Type₀) → ℕ → ℕ)] is [constant (ℕ → ℕ)] rather than [function (constant ℕ) (constant ℕ)]. Writing [auto* (λ X → ⋯)] doesn't seem to work, but [auto* (λ (X : Type ℓ) → ⋯)] does. -} {-# OPTIONS --cubical --no-exact-split --safe #-} module Cubical.Structures.Relational.Auto where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Data.Sigma open import Cubical.Data.Nat open import Cubical.Data.List open import Cubical.Data.Bool open import Cubical.Data.Maybe open import Cubical.Structures.Relational.Macro as Macro import Agda.Builtin.Reflection as R -- Magic number private FUEL = 10000 -- Mark a constant type with a proof it is a set abstract Const[_] : ∀ {ℓ} → hSet ℓ → Type ℓ Const[ A ] = A .fst -- Some reflection utilities private _>>=_ = R.bindTC _<|>_ = R.catchTC _>>_ : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → R.TC A → R.TC B → R.TC B f >> g = f >>= λ _ → g infixl 4 _>>=_ _>>_ _<|>_ varg : ∀ {ℓ} {A : Type ℓ} → A → R.Arg A varg = R.arg (R.arg-info R.visible R.relevant) tLevel = R.def (quote Level) [] tType : R.Term → R.Term tType ℓ = R.def (quote Type) [ varg ℓ ] thSet : R.Term → R.Term thSet ℓ = R.def (quote hSet) [ varg ℓ ] tPosRelDesc : R.Term → R.Term tPosRelDesc ℓ = R.def (quote PosRelDesc) [ varg ℓ ] tRelDesc : R.Term → R.Term tRelDesc ℓ = R.def (quote RelDesc) [ varg ℓ ] func : (ℓ ℓ' : Level) → Type (ℓ-suc (ℓ-max ℓ ℓ')) func ℓ ℓ' = Type ℓ → Type ℓ' tStruct : R.Term → R.Term → R.Term tStruct ℓ ℓ' = R.def (quote func) (varg ℓ ∷ varg ℓ' ∷ []) newMeta = R.checkType R.unknown -- We try to build a descriptor by unifying the provided structure with combinators we're aware of. We -- redefine the structure combinators as the *Shape terms below so that we don't depend on the specific way -- these are defined in other files (order of implicit arguments and so on); the syntactic analysis that goes -- on here means that we would get mysterious errors if those changed. private constantShape : ∀ {ℓ'} (ℓ : Level) (A : hSet ℓ') → (Type ℓ → Type ℓ') constantShape _ A _ = Const[ A ] pointedShape : (ℓ : Level) → Type ℓ → Type ℓ pointedShape _ X = X productShape : ∀ {ℓ₀ ℓ₁} (ℓ : Level) → (Type ℓ → Type ℓ₀) → (Type ℓ → Type ℓ₁) → Type ℓ → Type (ℓ-max ℓ₀ ℓ₁) productShape _ A₀ A₁ X = A₀ X × A₁ X paramShape : ∀ {ℓ₀ ℓ'} (ℓ : Level) → Type ℓ' → (Type ℓ → Type ℓ₀) → Type ℓ → Type (ℓ-max ℓ' ℓ₀) paramShape _ A A₀ X = A → A₀ X functionShape : ∀ {ℓ₀ ℓ₁} (ℓ : Level) → (Type ℓ → Type ℓ₀) → (Type ℓ → Type ℓ₁) → Type ℓ → Type (ℓ-max ℓ₀ ℓ₁) functionShape _ A₀ A₁ X = A₀ X → A₁ X maybeShape : ∀ {ℓ₀} (ℓ : Level) → (Type ℓ → Type ℓ₀) → Type ℓ → Type ℓ₀ maybeShape _ A₀ X = Maybe (A₀ X) private -- Build transport structure descriptor from a function [t : Type ℓ → Type ℓ'] buildPosRelDesc : ℕ → R.Term → R.Term → R.Term → R.TC R.Term buildPosRelDesc zero ℓ ℓ' t = R.typeError (R.strErr "Ran out of fuel! at \n" ∷ R.termErr t ∷ []) buildPosRelDesc (suc fuel) ℓ ℓ' t = tryConstant t <|> tryPointed t <|> tryProduct t <|> tryMaybe t <|> R.typeError (R.strErr "Can't automatically generate a positive structure for\n" ∷ R.termErr t ∷ []) where tryConstant : R.Term → R.TC R.Term tryConstant t = newMeta (thSet ℓ') >>= λ A → R.unify t (R.def (quote constantShape) (varg ℓ ∷ varg A ∷ [])) >> R.returnTC (R.con (quote PosRelDesc.constant) (varg A ∷ [])) tryPointed : R.Term → R.TC R.Term tryPointed t = R.unify t (R.def (quote pointedShape) (varg ℓ ∷ [])) >> R.returnTC (R.con (quote PosRelDesc.var) []) tryProduct : R.Term → R.TC R.Term tryProduct t = newMeta tLevel >>= λ ℓ₀ → newMeta tLevel >>= λ ℓ₁ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → newMeta (tStruct ℓ ℓ₁) >>= λ A₁ → R.unify t (R.def (quote productShape) (varg ℓ ∷ varg A₀ ∷ varg A₁ ∷ [])) >> buildPosRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → buildPosRelDesc fuel ℓ ℓ₁ A₁ >>= λ d₁ → R.returnTC (R.con (quote PosRelDesc._,_) (varg d₀ ∷ varg d₁ ∷ [])) tryMaybe : R.Term → R.TC R.Term tryMaybe t = newMeta tLevel >>= λ ℓ₀ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → R.unify t (R.def (quote maybeShape) (varg ℓ ∷ varg A₀ ∷ [])) >> buildPosRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → R.returnTC (R.con (quote PosRelDesc.maybe) (varg d₀ ∷ [])) autoPosRelDesc' : R.Term → R.Term → R.TC Unit autoPosRelDesc' t hole = R.inferType hole >>= λ H → newMeta tLevel >>= λ ℓ → newMeta tLevel >>= λ ℓ' → R.unify (tPosRelDesc ℓ) H >> R.checkType t (tStruct ℓ ℓ') >> buildPosRelDesc FUEL ℓ ℓ' t >>= R.unify hole -- Build structure descriptor from a function [t : Type ℓ → Type ℓ'] buildRelDesc : ℕ → R.Term → R.Term → R.Term → R.TC R.Term buildRelDesc zero ℓ ℓ' t = R.typeError (R.strErr "Ran out of fuel! at \n" ∷ R.termErr t ∷ []) buildRelDesc (suc fuel) ℓ ℓ' t = tryConstant t <|> tryPointed t <|> tryProduct t <|> tryParam t <|> tryFunction t <|> tryMaybe t <|> R.typeError (R.strErr "Can't automatically generate a structure for\n" ∷ R.termErr t ∷ []) where tryConstant : R.Term → R.TC R.Term tryConstant t = newMeta (thSet ℓ') >>= λ A → R.unify t (R.def (quote constantShape) (varg ℓ ∷ varg A ∷ [])) >> R.returnTC (R.con (quote RelDesc.constant) (varg A ∷ [])) tryPointed : R.Term → R.TC R.Term tryPointed t = R.unify t (R.def (quote pointedShape) (varg ℓ ∷ [])) >> R.returnTC (R.con (quote RelDesc.var) []) tryProduct : R.Term → R.TC R.Term tryProduct t = newMeta tLevel >>= λ ℓ₀ → newMeta tLevel >>= λ ℓ₁ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → newMeta (tStruct ℓ ℓ₁) >>= λ A₁ → R.unify t (R.def (quote productShape) (varg ℓ ∷ varg A₀ ∷ varg A₁ ∷ [])) >> buildRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → buildRelDesc fuel ℓ ℓ₁ A₁ >>= λ d₁ → R.returnTC (R.con (quote RelDesc._,_) (varg d₀ ∷ varg d₁ ∷ [])) tryParam : R.Term → R.TC R.Term tryParam t = newMeta (tType R.unknown) >>= λ A → newMeta tLevel >>= λ ℓ₀ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → R.unify t (R.def (quote paramShape) (varg ℓ ∷ varg A ∷ varg A₀ ∷ [])) >> buildRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → R.returnTC (R.con (quote RelDesc.param) (varg A ∷ varg d₀ ∷ [])) tryFunction : R.Term → R.TC R.Term tryFunction t = newMeta tLevel >>= λ ℓ₀ → newMeta tLevel >>= λ ℓ₁ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → newMeta (tStruct ℓ ℓ₁) >>= λ A₁ → R.unify t (R.def (quote functionShape) (varg ℓ ∷ varg A₀ ∷ varg A₁ ∷ [])) >> buildPosRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → buildRelDesc fuel ℓ ℓ₁ A₁ >>= λ d₁ → R.returnTC (R.con (quote RelDesc.function+) (varg d₀ ∷ varg d₁ ∷ [])) tryMaybe : R.Term → R.TC R.Term tryMaybe t = newMeta tLevel >>= λ ℓ₀ → newMeta (tStruct ℓ ℓ₀) >>= λ A₀ → R.unify t (R.def (quote maybeShape) (varg ℓ ∷ varg A₀ ∷ [])) >> buildRelDesc fuel ℓ ℓ₀ A₀ >>= λ d₀ → R.returnTC (R.con (quote RelDesc.maybe) (varg d₀ ∷ [])) autoRelDesc' : R.Term → R.Term → R.TC Unit autoRelDesc' t hole = R.inferType hole >>= λ H → newMeta tLevel >>= λ ℓ → newMeta tLevel >>= λ ℓ' → R.unify (tRelDesc ℓ) H >> R.checkType t (tStruct ℓ ℓ') >> buildRelDesc FUEL ℓ ℓ' t >>= R.unify hole macro -- (Type ℓ → Type ℓ₁) → PosRelDesc ℓ autoPosRelDesc : R.Term → R.Term → R.TC Unit autoPosRelDesc = autoPosRelDesc' -- (S : Type ℓ → Type ℓ₁) → RelDesc ℓ autoRelDesc : R.Term → R.Term → R.TC Unit autoRelDesc = autoRelDesc' -- (S : Type ℓ → Type ℓ₁) → (Type ℓ → Type ℓ₁) -- Sanity check: should be the identity AutoStructure : R.Term → R.Term → R.TC Unit AutoStructure t hole = newMeta (tRelDesc R.unknown) >>= λ d → R.unify hole (R.def (quote RelMacroStructure) [ varg d ]) >> autoRelDesc' t d -- (S : Type ℓ → Type ℓ₁) → StrRel S _ AutoRelStr : R.Term → R.Term → R.TC Unit AutoRelStr t hole = newMeta (tRelDesc R.unknown) >>= λ d → R.unify hole (R.def (quote RelMacroRelStr) [ varg d ]) >> autoRelDesc' t d -- (S : Type ℓ → Type ℓ₁) → SuitableStrRel S (AutoStrRel S) autoSuitableRel : R.Term → R.Term → R.TC Unit autoSuitableRel t hole = newMeta (tRelDesc R.unknown) >>= λ d → R.unify hole (R.def (quote relMacroSuitableRel) [ varg d ]) >> autoRelDesc' t d -- (S : Type ℓ → Type ℓ₁) → StrRelMatchesEquiv (AutoRelStr S) (AutoEquivStr S) autoMatchesEquiv : R.Term → R.Term → R.TC Unit autoMatchesEquiv t hole = newMeta (tRelDesc R.unknown) >>= λ d → R.unify hole (R.def (quote relMacroMatchesEquiv) [ varg d ]) >> autoRelDesc' t d
BasicIPC/Semantics/KripkeConcreteGluedImplicit.agda
mietek/hilbert-gentzen
29
10627
-- Basic intuitionistic propositional calculus, without ∨ or ⊥. -- Kripke-style semantics with contexts as concrete worlds, and glueing for α and ▻. -- Implicit syntax. module BasicIPC.Semantics.KripkeConcreteGluedImplicit where open import BasicIPC.Syntax.Common public open import Common.Semantics public open ConcreteWorlds (Ty) public -- Partial intuitionistic Kripke models. record Model : Set₁ where infix 3 _⊩ᵅ_ field -- Forcing for atomic propositions; monotonic. _⊩ᵅ_ : World → Atom → Set mono⊩ᵅ : ∀ {P w w′} → w ≤ w′ → w ⊩ᵅ P → w′ ⊩ᵅ P open Model {{…}} public module ImplicitSyntax (_[⊢]_ : Cx Ty → Ty → Set) (mono[⊢] : ∀ {A Γ Γ′} → Γ ⊆ Γ′ → Γ [⊢] A → Γ′ [⊢] A) where -- Forcing in a particular world of a particular model. module _ {{_ : Model}} where infix 3 _⊩_ _⊩_ : World → Ty → Set w ⊩ α P = Glue (unwrap w [⊢] (α P)) (w ⊩ᵅ P) w ⊩ A ▻ B = Glue (unwrap w [⊢] (A ▻ B)) (∀ {w′} → w ≤ w′ → w′ ⊩ A → w′ ⊩ B) w ⊩ A ∧ B = w ⊩ A × w ⊩ B w ⊩ ⊤ = 𝟙 infix 3 _⊩⋆_ _⊩⋆_ : World → Cx Ty → Set w ⊩⋆ ∅ = 𝟙 w ⊩⋆ Ξ , A = w ⊩⋆ Ξ × w ⊩ A -- Monotonicity with respect to context inclusion. module _ {{_ : Model}} where mono⊩ : ∀ {A w w′} → w ≤ w′ → w ⊩ A → w′ ⊩ A mono⊩ {α P} ξ s = mono[⊢] (unwrap≤ ξ) (syn s) ⅋ mono⊩ᵅ ξ (sem s) mono⊩ {A ▻ B} ξ s = mono[⊢] (unwrap≤ ξ) (syn s) ⅋ λ ξ′ → sem s (trans≤ ξ ξ′) mono⊩ {A ∧ B} ξ s = mono⊩ {A} ξ (π₁ s) , mono⊩ {B} ξ (π₂ s) mono⊩ {⊤} ξ s = ∙ mono⊩⋆ : ∀ {Ξ w w′} → w ≤ w′ → w ⊩⋆ Ξ → w′ ⊩⋆ Ξ mono⊩⋆ {∅} ξ ∙ = ∙ mono⊩⋆ {Ξ , A} ξ (ts , t) = mono⊩⋆ {Ξ} ξ ts , mono⊩ {A} ξ t -- Additional useful equipment. module _ {{_ : Model}} where _⟪$⟫_ : ∀ {A B w} → w ⊩ A ▻ B → w ⊩ A → w ⊩ B s ⟪$⟫ a = sem s refl≤ a ⟪S⟫ : ∀ {A B C w} → w ⊩ A ▻ B ▻ C → w ⊩ A ▻ B → w ⊩ A → w ⊩ C ⟪S⟫ s₁ s₂ a = (s₁ ⟪$⟫ a) ⟪$⟫ (s₂ ⟪$⟫ a) -- Forcing in a particular world of a particular model, for sequents. module _ {{_ : Model}} where infix 3 _⊩_⇒_ _⊩_⇒_ : World → Cx Ty → Ty → Set w ⊩ Γ ⇒ A = w ⊩⋆ Γ → w ⊩ A infix 3 _⊩_⇒⋆_ _⊩_⇒⋆_ : World → Cx Ty → Cx Ty → Set w ⊩ Γ ⇒⋆ Ξ = w ⊩⋆ Γ → w ⊩⋆ Ξ -- Entailment, or forcing in all worlds of all models, for sequents. infix 3 _⊨_ _⊨_ : Cx Ty → Ty → Set₁ Γ ⊨ A = ∀ {{_ : Model}} {w : World} → w ⊩ Γ ⇒ A infix 3 _⊨⋆_ _⊨⋆_ : Cx Ty → Cx Ty → Set₁ Γ ⊨⋆ Ξ = ∀ {{_ : Model}} {w : World} → w ⊩ Γ ⇒⋆ Ξ -- Additional useful equipment, for sequents. module _ {{_ : Model}} where lookup : ∀ {A Γ w} → A ∈ Γ → w ⊩ Γ ⇒ A lookup top (γ , a) = a lookup (pop i) (γ , b) = lookup i γ _⟦$⟧_ : ∀ {A B Γ w} → w ⊩ Γ ⇒ A ▻ B → w ⊩ Γ ⇒ A → w ⊩ Γ ⇒ B (s₁ ⟦$⟧ s₂) γ = s₁ γ ⟪$⟫ s₂ γ ⟦S⟧ : ∀ {A B C Γ w} → w ⊩ Γ ⇒ A ▻ B ▻ C → w ⊩ Γ ⇒ A ▻ B → w ⊩ Γ ⇒ A → w ⊩ Γ ⇒ C ⟦S⟧ s₁ s₂ a γ = ⟪S⟫ (s₁ γ) (s₂ γ) (a γ) _⟦,⟧_ : ∀ {A B Γ w} → w ⊩ Γ ⇒ A → w ⊩ Γ ⇒ B → w ⊩ Γ ⇒ A ∧ B (a ⟦,⟧ b) γ = a γ , b γ ⟦π₁⟧ : ∀ {A B Γ w} → w ⊩ Γ ⇒ A ∧ B → w ⊩ Γ ⇒ A ⟦π₁⟧ s γ = π₁ (s γ) ⟦π₂⟧ : ∀ {A B Γ w} → w ⊩ Γ ⇒ A ∧ B → w ⊩ Γ ⇒ B ⟦π₂⟧ s γ = π₂ (s γ)
lib/target/hemc/classic/hemc_crt0.asm
w5Mike/z88dk
4
171008
; ; Startup for Hübler/Evert-MC ; ; https://hc-ddr.hucki.net/wiki/doku.php/homecomputer/huebler#hueblerevert-mc ; module hemc_crt0 INCLUDE "target/hemc/def/hemc.def" ;-------- ; Include zcc_opt.def to find out some info ;-------- defc crt0 = 1 INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main ;main() is always external to crt0 code EXTERN asm_im1_handler PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) defc TAR__clib_exit_stack_size = 4 defc TAR__register_sp = $e800 defc CRT_KEY_DEL = 8 defc __CPU_CLOCK = 2457600 defc CONSOLE_COLUMNS = 64 defc CONSOLE_ROWS = 24 defc GRAPHICS_CHAR_SET = 128 + 32 defc GRAPHICS_CHAR_UNSET = 32 PUBLIC GRAPHICS_CHAR_SET PUBLIC GRAPHICS_CHAR_UNSET defc TAR__crt_enable_rst = $8080 EXTERN asm_im1_handler defc _z80_rst_38h = asm_im1_handler INCLUDE "crt/classic/crt_rules.inc" defc CRT_ORG_CODE = 0x0000 org CRT_ORG_CODE if (ASMPC<>$0000) defs CODE_ALIGNMENT_ERROR endif jp program INCLUDE "crt/classic/crt_z80_rsts.asm" program: INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" call crt0_init_bss ld hl,0 add hl,sp ld (exitsp),hl ei ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "crt/classic/crt_init_amalloc.asm" ENDIF ld hl,0 push hl ;argv push hl ;argc call _main pop bc pop bc cleanup: jp RESTART l_dcal: jp (hl) ;Used for function pointer calls INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm"
2020_notebooks/Labs/lab_5/lab5_release/calculator/Calc.g4
blended-learning/compilers
0
922
grammar Calc; @header { package calculator; } program : (statement ';')+ EOF ; statement : assign # assignStatement | expr # exprStatement ; assign : ID '=' expr ; expr : e1=expr '+' e2=expr # add | e1=expr '*' e2=expr # mul | '(' expr ')' # paren | ID # id | NUM # num ; ID : [a-z]; NUM : [0-9]+; Whitespace : [ \t\r]+ -> skip; Comment : '//' (~('\n'))+ '\n' -> skip;
agda/Esterel/Lang/CanFunction.agda
florence/esterel-calculus
3
628
<filename>agda/Esterel/Lang/CanFunction.agda module Esterel.Lang.CanFunction where open import utility hiding (module ListSet) open import Esterel.Lang open import Esterel.Environment as Env using (Env ; _←_ ; Θ ; module SigMap ; module ShrMap ; module VarMap) open import Esterel.CompletionCode as Code using () renaming (CompletionCode to Code) open import Esterel.Variable.Signal as Signal using (Signal ; _ₛ) renaming (_≟ₛₜ_ to _≟ₛₜₛ_) open import Esterel.Variable.Shared as SharedVar using (SharedVar ; _ₛₕ) renaming (_≟ₛₜ_ to _≟ₛₜₛₕ_) open import Esterel.Variable.Sequential as SeqVar using (SeqVar ; _ᵥ) open import Function using (_∘_) open import Relation.Nullary using (yes ; no) open import Relation.Nullary.Decidable using (⌊_⌋) open import Relation.Binary using (Decidable) open import Relation.Binary.PropositionalEquality using (_≡_ ; refl) open import Data.Bool using (Bool ; not ; if_then_else_) open import Data.Empty using (⊥ ; ⊥-elim) open import Data.Maybe using (Maybe ; just ; nothing) open import Data.List using (List ; [] ; _∷_ ; [_] ; _++_ ; map ; concatMap ; filter) open import Data.List.Any using (Any ; any) open import Data.Product using (_×_ ; _,_ ; _,′_ ; proj₁ ; proj₂) import Data.Nat as Nat open Nat using (ℕ ; zero ; suc) module SigSet = utility.ListSet Nat._≟_ module ShrSet = utility.ListSet Nat._≟_ module CodeSet = utility.ListSet Code._≟_ -- hide this when importing CanFunction to avoid ambiguity from sn-calculus.agda [S]-env : (S : Signal) → Env [S]-env S = Θ SigMap.[ S ↦ Signal.unknown ] ShrMap.empty VarMap.empty -- The speculative environment used in Canₛ rule and for existing signals in Canθ [S]-env-absent : (S : Signal) → Env [S]-env-absent S = Θ SigMap.[ S ↦ Signal.absent ] ShrMap.empty VarMap.empty -- Helper environment for existing signals in Canθ [S]-env-present : (S : Signal) → Env [S]-env-present S = Θ SigMap.[ S ↦ Signal.present ] ShrMap.empty VarMap.empty Can : Term → Env → SigSet.ST × CodeSet.ST × ShrSet.ST Canₛ : Term → Env → SigSet.ST Canₖ : Term → Env → CodeSet.ST Canₛₕ : Term → Env → ShrSet.ST Canₛ p θ with Can p θ ... | Ss , _ , _ = Ss Canₖ p θ with Can p θ ... | _ , ks , _ = ks Canₛₕ p θ with Can p θ ... | _ , _ , ss = ss Canθ : SigMap.Map Signal.Status → ℕ → Term → Env → SigSet.ST × CodeSet.ST × ShrSet.ST Canθₛ : SigMap.Map Signal.Status → ℕ → Term → Env → SigSet.ST Canθₖ : SigMap.Map Signal.Status → ℕ → Term → Env → CodeSet.ST Canθₛₕ : SigMap.Map Signal.Status → ℕ → Term → Env → ShrSet.ST Canθₛ sigs S p θ = proj₁ (Canθ sigs S p θ) Canθₖ sigs S p θ = proj₁ (proj₂ (Canθ sigs S p θ)) Canθₛₕ sigs S p θ = proj₂ (proj₂ (Canθ sigs S p θ)) Canθ [] S p θ = Can p θ Canθ (nothing ∷ sig') S p θ = Canθ sig' (suc S) p θ Canθ (just Signal.present ∷ sig') S p θ = Canθ sig' (suc S) p (θ ← [S]-env-present (S ₛ)) Canθ (just Signal.absent ∷ sig') S p θ = Canθ sig' (suc S) p (θ ← [S]-env-absent (S ₛ)) Canθ (just Signal.unknown ∷ sig') S p θ with any (Nat._≟_ S) (Canθₛ sig' (suc S) p (θ ← [S]-env (S ₛ))) ... | yes S∈can-p-θ←[S] = Canθ sig' (suc S) p (θ ← [S]-env (S ₛ)) ... | no S∉can-p-θ←[S] = Canθ sig' (suc S) p (θ ← [S]-env-absent (S ₛ)) Can nothin θ = [] ,′ [ Code.nothin ] ,′ [] Can pause θ = [] ,′ [ Code.pause ] ,′ [] Can (signl S p) θ = SigSet.set-remove (Canθₛ (Env.sig ([S]-env S)) 0 p θ) (Signal.unwrap S) ,′ Canθₖ (Env.sig ([S]-env S)) 0 p θ ,′ Canθₛₕ (Env.sig ([S]-env S)) 0 p θ Can (present S ∣⇒ p ∣⇒ q) θ with (Env.Sig∈ S θ) ... | yes S∈ = if ⌊ Signal.present Signal.≟ₛₜ (Env.sig-stats{S} θ S∈) ⌋ then Can p θ else if ⌊ Signal.absent Signal.≟ₛₜ Env.sig-stats{S} θ S∈ ⌋ then Can q θ else Canₛ p θ ++ Canₛ q θ ,′ Canₖ p θ ++ Canₖ q θ ,′ Canₛₕ p θ ++ Canₛₕ q θ ... | no S∉ = Canₛ p θ ++ Canₛ q θ ,′ Canₖ p θ ++ Canₖ q θ ,′ Canₛₕ p θ ++ Canₛₕ q θ Can (emit S) θ = [ (Signal.unwrap S) ] ,′ [ Code.nothin ] ,′ [] Can (p ∥ q) θ = Canₛ p θ ++ Canₛ q θ ,′ concatMap (λ k → map (Code._⊔_ k) (Canₖ q θ)) (Canₖ p θ) ,′ Canₛₕ p θ ++ Canₛₕ q θ Can (loop p) θ = Can p θ Can (loopˢ p q) θ = Can p θ Can (p >> q) θ with any (Code._≟_ Code.nothin) (Canₖ p θ) ... | no nothin∉ = Can p θ ... | yes nothin∈ = Canₛ p θ ++ Canₛ q θ ,′ (CodeSet.set-remove (Canₖ p θ) Code.nothin) ++ Canₖ q θ ,′ Canₛₕ p θ ++ Canₛₕ q θ Can (suspend p S) θ = Can p θ Can (trap p) θ = Canₛ p θ ,′ map Code.↓* (Canₖ p θ) ,′ Canₛₕ p θ Can (exit n) θ = [] ,′ [ Code.exit n ] ,′ [] Can (shared s ≔ e in: p) θ = Canₛ p θ ,′ Canₖ p θ ,′ ShrSet.set-remove (Canₛₕ p θ) (SharedVar.unwrap s) Can (s ⇐ e) θ = [] ,′ [ Code.nothin ] ,′ [ (SharedVar.unwrap s) ] Can (var x ≔ e in: p) θ = Can p θ Can (x ≔ e) θ = [] ,′ [ Code.nothin ] ,′ [] Can (if x ∣⇒ p ∣⇒ q) θ = Canₛ p θ ++ Canₛ q θ ,′ Canₖ p θ ++ Canₖ q θ ,′ Canₛₕ p θ ++ Canₛₕ q θ Can (ρ⟨ (Θ sig' shr' var') , A ⟩· p) θ = SigSet.set-subtract (Canθₛ sig' 0 p θ) (SigMap.keys sig') ,′ Canθₖ sig' 0 p θ ,′ ShrSet.set-subtract (Canθₛₕ sig' 0 p θ) (ShrMap.keys shr')
demo/src/formatted_output_demo.adb
VitalijBondarenko/Formatted_Output_NG
0
27630
with Ada.Text_IO; with Ada.Calendar; with Interfaces; use Interfaces; with Formatted_Output; use Formatted_Output; with Formatted_Output_Integer; use Formatted_Output_Integer; with Formatted_Output_Long_Integer; use Formatted_Output_Long_Integer; with Formatted_Output_Long_Long_Integer; use Formatted_Output_Long_Long_Integer; with Formatted_Output_Float; use Formatted_Output_Float; with Formatted_Output_Long_Float; use Formatted_Output_Long_Float; with Formatted_Output_Long_Long_Float; use Formatted_Output_Long_Long_Float; with Formatted_Output.Decimal_Output; with Formatted_Output.Modular_Output; with Formatted_Output_Short_Integer; use Formatted_Output_Short_Integer; with Formatted_Output_Short_Short_Integer; use Formatted_Output_Short_Short_Integer; with Formatted_Output.Enumeration_Output; with Formatted_Output.Time_Output; use Formatted_Output.Time_Output; with L10n; use L10n; procedure Formatted_Output_Demo is procedure Show_Integer_Ranges; procedure Show_Float_Ranges; ------------------------- -- Show_Integer_Ranges -- ------------------------- procedure Show_Integer_Ranges is begin Put_Line (+"Short_Short_Integer type range:\n\t%+_30d .. %-+_30d" & Short_Short_Integer'First & Short_Short_Integer'Last); Put_Line (+"Short_Integer type range:\n\t%+_30d .. %-+_30d" & Short_Integer'First & Short_Integer'Last); Put_Line (+"Integer type range:\n\t%+_30d .. %-+_30d" & Integer'First & Integer'Last); Put_Line (+"Long_Integer type range:\n\t%+_30d .. %-+_30d" & Long_Integer'First & Long_Integer'Last); Put_Line (+"Long_Long_Integer type range:\n\t%+_30d .. %-+_30d" & Long_Long_Integer'First & Long_Long_Integer'Last); Put_Line (+"Natural type range:\n\t%+_30d .. %-+_30d" & Natural'First & Natural'Last); Put_Line (+"Positive type range:\n\t%+_30d .. %-+_30d" & Positive'First & Positive'Last); end Show_Integer_Ranges; ----------------------- -- Show_Float_Ranges -- ----------------------- procedure Show_Float_Ranges is begin Put_Line (+"Float type range:\n\t%+_35.20e .. %-+_35.20e" & Float'First & Float'Last); Put_Line (+"Long_Float type range:\n\t%+_35.20e .. %-+_35.20e" & Long_Float'First & Long_Float'Last); Put_Line (+"Long_Long_Float type range:\n\t%+_35.20e .. %-+_35.20e" & Long_Long_Float'First & Long_Long_Float'Last); end Show_Float_Ranges; package Unsigned_Output is new Formatted_Output.Modular_Output (Interfaces.Unsigned_64); use Unsigned_Output; type Money is delta 0.01 digits 18; package Money_Output is new Formatted_Output.Decimal_Output (Money); use Money_Output; package Character_Output is new Formatted_Output.Enumeration_Output (Character); use Character_Output; Str : String := "Hello, world!"; T : Ada.Calendar.Time := Ada.Calendar.Clock; begin Set_Locale; Formatted_Output.Put_Line (+"String = %s" & Str); Formatted_Output.Put_Line (+"Char = %c" & Str (Str'First)); Ada.Text_IO.New_Line; Show_Integer_Ranges; Ada.Text_IO.New_Line; Show_Float_Ranges; Ada.Text_IO.New_Line; Formatted_Output.Put_Line (+"Unsigned_64 type range:\n\t%_35d .. %-_35d" & Unsigned_64'First & Unsigned_64'Last); Ada.Text_IO.New_Line; Formatted_Output.Put_Line (+"Money type range (%s):\n\t%+_35e .. %-+_35e" & "type Money is delta 0.01 digits 18" & Money'First & Money'Last); Ada.Text_IO.New_Line; Formatted_Output.Put_Line (+"Current Time (Locale: %s) = %s" & Get_Locale & Format_Time ("'%c'", T)); Set_Locale (Locale => "POSIX"); Formatted_Output.Put_Line (+"Current Time (Locale: %s) = %s" & Get_Locale & Format_Time ("'%c'", T)); Set_Locale (Locale => "uk_UA.UTF-8"); Formatted_Output.Put_Line (+"Current Time (Locale: %s) = %s" & Get_Locale & Format_Time ("'%c'", T)); end Formatted_Output_Demo;
alloy4fun_models/trashltl/models/4/3NZdcvJZFax8MeSwC.als
Kaixi26/org.alloytools.alloy
0
3662
<gh_stars>0 open main pred id3NZdcvJZFax8MeSwC_prop5 { always all f : Trash | eventually f not in File } pred __repair { id3NZdcvJZFax8MeSwC_prop5 } check __repair { id3NZdcvJZFax8MeSwC_prop5 <=> prop5o }
programs/oeis/090/A090178.asm
neoneye/loda
22
86576
<reponame>neoneye/loda<filename>programs/oeis/090/A090178.asm ; A090178: a(1) = 2; for n > 1, a(n) = n + prime(n-1). ; 2,4,6,9,12,17,20,25,28,33,40,43,50,55,58,63,70,77,80,87,92,95,102,107,114,123,128,131,136,139,144,159,164,171,174,185,188,195,202,207,214,221,224,235,238,243,246,259,272,277,280,285,292,295,306,313,320,327 mov $1,$0 seq $1,8578 ; Prime numbers at the beginning of the 20th century (today 1 is no longer regarded as a prime). add $0,$1 add $0,1
programs/oeis/038/A038723.asm
karttu/loda
0
14186
<reponame>karttu/loda<gh_stars>0 ; A038723: a(n) = 6*a(n-1) - a(n-2), n >= 2, a(0)=1, a(1)=4. ; 1,4,23,134,781,4552,26531,154634,901273,5253004,30616751,178447502,1040068261,6061962064,35331704123,205928262674,1200237871921,6995498968852,40772755941191,237641036678294,1385073464128573 mov $1,1 lpb $0,1 sub $0,1 add $3,$1 add $3,$1 sub $1,1 add $1,$3 mov $2,$3 add $2,$1 mov $1,$2 lpe
alloy4fun_models/trainstlt/models/5/X993o42sk5pRKczRT.als
Kaixi26/org.alloytools.alloy
0
2980
open main pred idX993o42sk5pRKczRT_prop6 { always (all s:Signal | (s in Green) implies eventually (s not in Green ) or s not in Green implies eventually (s in Green) ) } pred __repair { idX993o42sk5pRKczRT_prop6 } check __repair { idX993o42sk5pRKczRT_prop6 <=> prop6o }
programs/oeis/223/A223925.asm
karttu/loda
1
245750
; A223925: a(2n+1) = 2*n-1; a(2n)= 4^n. ; 1,4,3,16,5,64,7,256,9,1024,11,4096,13,16384,15,65536,17,262144,19,1048576,21,4194304,23,16777216,25,67108864,27,268435456,29,1073741824,31,4294967296,33,17179869184,35,68719476736,37,274877906944,39,1099511627776,41,4398046511104,43,17592186044416,45,70368744177664,47,281474976710656,49,1125899906842624,51,4503599627370496,53 add $0,1 mov $1,-2 pow $1,$0 trn $0,$1 add $1,$0
src/latin_utils/latin_utils-inflections_package-adverb_record_io.adb
spr93/whitakers-words
204
8521
<reponame>spr93/whitakers-words<gh_stars>100-1000 -- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Inflections_Package) package body Adverb_Record_IO is --------------------------------------------------------------------------- procedure Get (File : in File_Type; Item : out Adverb_Record) is begin Comparison_Type_IO.Get (File, Item.Comparison); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Adverb_Record) is begin Comparison_Type_IO.Get (Item.Comparison); end Get; --------------------------------------------------------------------------- procedure Put (File : in File_Type; Item : in Adverb_Record) is begin Comparison_Type_IO.Put (File, Item.Comparison); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Adverb_Record) is begin Comparison_Type_IO.Put (Item.Comparison); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Adverb_Record; Last : out Integer ) is begin Comparison_Type_IO.Get (Source, Target.Comparison, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Adverb_Record) is High : constant Integer := Target'First - 1 + Comparison_Type_IO.Default_Width; begin Comparison_Type_IO.Put (Target (Target'First .. High), Item.Comparison); Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Adverb_Record_IO;
programs/oeis/336/A336483.asm
jmorken/loda
1
85964
<filename>programs/oeis/336/A336483.asm<gh_stars>1-10 ; A336483: Floor(n/10) + (5 times last digit of n). ; 0,5,10,15,20,25,30,35,40,45,1,6,11,16,21,26,31,36,41,46,2,7,12,17,22,27,32,37,42,47,3,8,13,18,23,28,33,38,43,48,4,9,14,19,24,29,34,39,44,49,5,10,15,20,25,30,35,40,45,50,6,11,16,21,26,31,36,41,46,51,7 add $0,366 mov $2,3 lpb $0 sub $0,1 mov $1,$0 sub $0,9 mul $1,5 add $2,1 lpe add $1,$2 sub $1,65
programs/oeis/059/A059154.asm
karttu/loda
1
95116
<filename>programs/oeis/059/A059154.asm ; A059154: A hierarchical sequence (W'2{3}c - see A059126). ; 12,96,12,768,12,96,12,6144,12,96,12,768,12,96,12,49152,12,96,12,768,12,96,12,6144,12,96,12,768,12,96,12,393216,12,96,12,768,12,96,12,6144,12,96,12,768,12,96,12,49152,12,96,12,768,12,96,12,6144,12,96,12,768 add $0,1 pow $0,3 gcd $0,281474976710656 mov $1,$0 mul $1,12
tests/polymorphism/src/hal_interface.ads
TUM-EI-RCS/StratoX
12
28851
<gh_stars>10-100 package HAL_Interface with SPARK_Mode is pragma Preelaborate; type Byte is mod 2**8; type Port_Type is interface; -- abstract tagged null record; -- interface type Configuration_Type is null record; subtype Address_Type is Integer; type Data_Type is array(Natural range <>) of Byte; procedure configure(Port : Port_Type; Config : Configuration_Type) is abstract; procedure write (Port : Port_Type; Address : Address_Type; Data : Data_Type) is abstract; function read (Port : Port_Type; Address : Address_Type) return Data_Type is abstract; end HAL_Interface;
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/short_circuit_v2.adb
ouankou/rose
488
28445
function IsDivisible(x, y: IN Integer) return Integer is Result : Integer; begin Result := 0; if y = 0 or else x = 0 then Result := 0; else Result := x / y; end if; if y = 0 and then x = 0 then Result := 0; else Result := x * (x / y ); end if; return Result; end IsDivisible;
programs/oeis/171/A171503.asm
neoneye/loda
22
4318
<reponame>neoneye/loda ; A171503: Number of 2 X 2 integer matrices with entries from {0,1,...,n} having determinant 1. ; 0,3,7,15,23,39,47,71,87,111,127,167,183,231,255,287,319,383,407,479,511,559,599,687,719,799,847,919,967,1079,1111,1231,1295,1375,1439,1535,1583,1727,1799,1895,1959,2119,2167,2335,2415,2511,2599,2783,2847,3015,3095,3223,3319,3527,3599,3759,3855,3999,4111,4343,4407,4647,4767,4911,5039,5231,5311,5575,5703,5879,5975,6255,6351,6639,6783,6943,7087,7327,7423,7735,7863,8079,8239,8567,8663,8919,9087,9311,9471,9823,9919,10207,10383,10623,10807,11095,11223,11607,11775,12015 seq $0,140466 ; a(n) = 4*A002088(n). trn $0,1
src/cpu/gdt.asm
programble/happy
1
3060
<gh_stars>1-10 global gdt.init global gdt.table, gdt.table.null, gdt.table.code, gdt.table.data, gdt.table.# Type: .DATA: equ 0000_0000b .CODE: equ 0000_1000b .A: equ 0000_0001b .W: equ 0000_0010b .E: equ 0000_0100b .R: equ 0000_0010b .C: equ 0000_0100b Access: .S: equ 0001_0000b .DPL0: equ 0000_0000b .DPL1: equ 0010_0000b .DPL2: equ 0100_0000b .DPL3: equ 0110_0000b .P: equ 1000_0000b Flags: .L: equ 0010_0000b .D: equ 0100_0000b .B: equ 0100_0000b .G: equ 1000_0000b struc SegmentDescriptor .limitLow: resw 1 .baseLow: resw 1 .baseMid: resb 1 .typeAccess: resb 1 .limitHighFlags: resb 1 .baseHigh: resb 1 endstruc struc Gdt .limit: resw 1 .base: resd 1 endstruc section .data gdt.table: .null: dq 0 .code: istruc SegmentDescriptor at SegmentDescriptor.limitLow, dw 0FFFFh at SegmentDescriptor.baseLow, dw 0 at SegmentDescriptor.baseMid, db 0 at SegmentDescriptor.typeAccess, db Type.CODE | Type.R | Access.S | Access.DPL0 | Access.P at SegmentDescriptor.limitHighFlags, db 0Fh | Flags.D | Flags.G at SegmentDescriptor.baseHigh, db 0 iend .data: istruc SegmentDescriptor at SegmentDescriptor.limitLow, dw 0FFFFh at SegmentDescriptor.baseLow, dw 0 at SegmentDescriptor.baseMid, db 0 at SegmentDescriptor.typeAccess, db Type.DATA | Type.W | Access.S | Access.DPL0 | Access.P at SegmentDescriptor.limitHighFlags, db 0Fh | Flags.B | Flags.G at SegmentDescriptor.baseHigh, db 0 iend .#: equ $ - gdt.table gdt.gdt: istruc Gdt at Gdt.limit, dw gdt.table.# - 1 at Gdt.base, dd gdt.table iend section .text gdt.init: ; : : ax lgdt [gdt.gdt] mov ax, gdt.table.data - gdt.table mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax jmp (gdt.table.code - gdt.table):.ret .ret: ret
src/scripts/com_apple_mail.applescript
brianm/deeplinker
0
2298
tell application id "com.apple.mail" set theSelectedMessages to selection set the selected_message to item 1 of the theSelectedMessages set message_id to the message id of the selected_message set message_title to the subject of the selected_message end tell -- http://harvey.nu/applescript_url_encode_routine.html on urlencode(theText) set theTextEnc to "" repeat with eachChar in characters of theText set useChar to eachChar set eachCharNum to ASCII number of eachChar if eachCharNum = 32 then set useChar to "+" else if (eachCharNum is not equal 42) and (eachCharNum is not equal 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then set firstDig to round (eachCharNum / 16) rounding down set secondDig to eachCharNum mod 16 if firstDig > 9 then set aNum to firstDig + 55 set firstDig to ASCII character aNum end if if secondDig > 9 then set aNum to secondDig + 55 set secondDig to ASCII character aNum end if set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string set useChar to numHex end if set theTextEnc to theTextEnc & useChar as string end repeat return theTextEnc end urlencode return {link: "message://" & urlencode("<" & message_id & ">"), title:message_title}
test/Succeed/Issue939.agda
redfish64/autonomic-agda
3
12123
<filename>test/Succeed/Issue939.agda {-# OPTIONS --copatterns #-} module Issue939 where record Sigma (A : Set)(P : A → Set) : Set where field fst : A .snd : P fst open Sigma postulate A : Set P : A → Set x : A .p : P x ex : Sigma A P ex = record { fst = x ; snd = p } ex' : Sigma A P fst ex' = x snd ex' = p -- Giving p yields the following error: -- Identifier p is declared irrelevant, so it cannot be used here -- when checking that the expression p has type P (fst ex') -- Fixed. Andreas, 2013-11-05
Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i7-7700_9_0xca_notsx.log_21829_1432.asm
ljhsiun2/medusa
9
177681
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x94a1, %rdx nop nop nop nop nop xor %rdi, %rdi movups (%rdx), %xmm2 vpextrq $1, %xmm2, %r12 nop nop nop nop nop and %r15, %r15 lea addresses_WT_ht+0xfe11, %r12 nop nop nop xor %r15, %r15 movb (%r12), %r10b xor $26670, %r15 lea addresses_UC_ht+0xa391, %rsi lea addresses_WC_ht+0x12111, %rdi nop nop sub $2878, %r11 mov $46, %rcx rep movsl nop nop nop nop add $30492, %r15 lea addresses_WT_ht+0xb391, %r10 nop nop nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %rdx movq %rdx, (%r10) nop nop nop nop add $24852, %rdi lea addresses_D_ht+0x1c671, %r10 nop nop nop nop nop and %rdx, %rdx vmovups (%r10), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %r15 nop and %r15, %r15 lea addresses_A_ht+0x16e1, %rsi lea addresses_normal_ht+0x6651, %rdi nop nop nop add $38666, %r12 mov $65, %rcx rep movsq nop nop nop nop sub %rcx, %rcx lea addresses_D_ht+0xd451, %rsi lea addresses_UC_ht+0x1c71d, %rdi nop nop nop inc %r11 mov $86, %rcx rep movsw inc %r11 lea addresses_normal_ht+0xfc73, %r11 nop nop nop nop add %rdi, %rdi mov (%r11), %r15d nop nop cmp %rsi, %rsi lea addresses_D_ht+0x7b91, %r10 nop nop nop nop and $14555, %rcx mov $0x6162636465666768, %r15 movq %r15, %xmm3 vmovups %ymm3, (%r10) xor $9028, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rbp push %rcx push %rdi push %rdx push %rsi // Load lea addresses_D+0xeb91, %rbp nop xor %r14, %r14 movb (%rbp), %r12b nop nop nop and $12009, %r14 // Store lea addresses_WT+0xe9d1, %rdx nop nop nop nop nop cmp %r11, %r11 movb $0x51, (%rdx) cmp $65422, %rdx // Load lea addresses_PSE+0x1fb91, %r11 nop nop nop nop nop inc %rbp mov (%r11), %edx nop nop nop xor %r10, %r10 // Store lea addresses_D+0xe1d1, %rdx nop nop nop nop nop sub $34399, %rbp movl $0x51525354, (%rdx) nop cmp %r14, %r14 // REPMOV lea addresses_RW+0x391, %rsi lea addresses_WT+0x3791, %rdi clflush (%rsi) nop xor $43728, %r14 mov $106, %rcx rep movsq nop nop nop nop add $31888, %r11 // REPMOV lea addresses_UC+0xb391, %rsi lea addresses_PSE+0x13791, %rdi nop add $35786, %rbp mov $39, %rcx rep movsl nop xor %rbp, %rbp // Store lea addresses_WT+0x3305, %r12 nop nop nop sub $4904, %rdi movl $0x51525354, (%r12) nop nop nop nop nop add %r14, %r14 // Store lea addresses_A+0x16391, %r14 nop nop sub %rdi, %rdi mov $0x5152535455565758, %r11 movq %r11, (%r14) nop nop nop add $5112, %rsi // Store lea addresses_PSE+0x14291, %rcx add %r14, %r14 movl $0x51525354, (%rcx) xor $54638, %r11 // Load lea addresses_UC+0xee11, %rsi clflush (%rsi) nop nop nop xor $64009, %rbp mov (%rsi), %r12 nop xor $44102, %rsi // Store lea addresses_WT+0xdf51, %rdi nop and $17354, %rdx movb $0x51, (%rdi) nop add %rdi, %rdi // Store lea addresses_normal+0xf131, %r10 nop dec %r11 movb $0x51, (%r10) nop sub %rbp, %rbp // Store lea addresses_UC+0xb391, %rdi nop nop nop xor %r10, %r10 mov $0x5152535455565758, %rdx movq %rdx, %xmm7 vmovups %ymm7, (%rdi) nop nop add %rdi, %rdi // Store lea addresses_WT+0xb169, %r12 nop nop nop nop nop and $49986, %rdx mov $0x5152535455565758, %r14 movq %r14, %xmm7 movups %xmm7, (%r12) nop nop and $45714, %rbp // Faulty Load lea addresses_UC+0xb391, %rsi nop nop nop nop sub %r12, %r12 movb (%rsi), %cl lea oracles, %r10 and $0xff, %rcx shlq $12, %rcx mov (%r10,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_RW'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT'}, 'OP': 'REPM'} {'src': {'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'REPM'} {'dst': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'src': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 2, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_callhome.g4
pranavbj-amzn/batfish
763
7593
<gh_stars>100-1000 parser grammar CiscoXr_callhome; import CiscoXr_common; options { tokenVocab = CiscoXrLexer; } call_home_null : NO? ( ALERT_GROUP | CONTACT | CONTACT_EMAIL_ADDR | CONTACT_NAME | CONTRACT_ID | CUSTOMER_ID | MAIL_SERVER | PHONE_NUMBER | SENDER | SERVICE | SITE_ID | SOURCE_INTERFACE | SOURCE_IP_ADDRESS | STREET_ADDRESS | VRF ) null_rest_of_line ; call_home_profile : PROFILE null_rest_of_line ( call_home_profile_null )* ; call_home_profile_null : NO? ( ACTIVE | DESTINATION | SUBSCRIBE_TO_ALERT_GROUP ) null_rest_of_line ; s_call_home : NO? CALL_HOME null_rest_of_line ( call_home_null | call_home_profile )* ;
agda/BTree.agda
bgbianchi/sorting
6
6618
<reponame>bgbianchi/sorting<filename>agda/BTree.agda module BTree {A : Set} where open import Data.List data BTree : Set where leaf : BTree node : A → BTree → BTree → BTree flatten : BTree → List A flatten leaf = [] flatten (node x l r) = (flatten l) ++ (x ∷ flatten r)
examples/simulator/src/libriscv-sim-gdb_remote_target.ads
Fabien-Chouteau/libriscv
0
10980
<filename>examples/simulator/src/libriscv-sim-gdb_remote_target.ads ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2019, <NAME> -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with GNAT.Sockets; with GDB_Remote.Target; with LibRISCV.Sim.Platform; with LibRISCV.Sim.Memory_Bus; package LibRISCV.Sim.GDB_Remote_Target is package Parent renames GDB_Remote.Target; type Instance (P : not null Platform.Ptr; Bus : not null Memory_Bus.Ptr; Buffer_Size : GDB_Remote.Buffer_Lenght_Type) is new Parent.Instance with private; subtype Class is Instance'Class; type Ptr is access all Class; procedure Start_Server (This : in out Instance); procedure Poll (This : in out Instance); overriding procedure Detach (This : in out Instance); overriding procedure Send_To_Host (This : in out Instance; C : Character); overriding procedure Set_Thread (This : in out Instance; Id : Integer); overriding procedure Read_Memory (This : in out Instance; Addr : GDB_Remote.Target.Address; Data : out Unsigned_8; Success : out Boolean); overriding procedure Write_Memory (This : in out Instance; Addr : GDB_Remote.Target.Address; Data : Unsigned_8; Success : out Boolean); overriding function Last_General_Register (This : Instance) return Natural is (31); overriding procedure Read_Register (This : in out Instance; Id : Natural; Data : out GDB_Remote.Target.Register; Success : out Boolean); overriding procedure Write_Register (This : in out Instance; Id : Natural; Data : GDB_Remote.Target.Register; Success : out Boolean); overriding procedure Continue (This : in out Instance; Single_Step : Boolean := False); overriding procedure Continue_At (This : in out Instance; Addr : GDB_Remote.Target.Address; Single_Step : Boolean := False); overriding procedure Halt (This : in out Instance); procedure Halted_On_Single_Step (This : in out Instance); procedure Halted_On_Breakpoint (This : in out Instance); overriding function Supported (This : Instance; B_Type : GDB_Remote.Breakpoint_Type) return Boolean; overriding procedure Insert_Breakpoint (This : in out Instance; B_Type : GDB_Remote.Breakpoint_Type; Addr : GDB_Remote.Target.Address; Kind : Natural); overriding procedure Remove_Breakpoint (This : in out Instance; B_Type : GDB_Remote.Breakpoint_Type; Addr : GDB_Remote.Target.Address; Kind : Natural); private type Instance (P : not null Platform.Ptr; Bus : not null Memory_Bus.Ptr; Buffer_Size : GDB_Remote.Buffer_Lenght_Type) is new Parent.Instance (Buffer_Size) with record Receiver : GNAT.Sockets.Socket_Type; Connection : GNAT.Sockets.Socket_Type; Client : GNAT.Sockets.Sock_Addr_Type; Channel : GNAT.Sockets.Stream_Access; Current_Hart : Platform.Hart_Id := 1; end record; procedure Wait_For_Connection (This : in out Instance); end LibRISCV.Sim.GDB_Remote_Target;
src/Bi/BoxMp.agda
mietek/formal-logic
26
3397
<reponame>mietek/formal-logic -- Minimal implicational modal logic, de Bruijn approach, initial encoding module Bi.BoxMp where open import Lib using (List; []; _,_; LMem; lzero; lsuc) -- Types infixr 0 _=>_ data Ty : Set where UNIT : Ty _=>_ : Ty -> Ty -> Ty BOX : Ty -> Ty -- Context and truth/validity judgements Cx : Set Cx = List Ty isTrue : Ty -> Cx -> Set isTrue a tc = LMem a tc isValid : Ty -> Cx -> Set isValid a vc = LMem a vc -- Terms module BoxMp where infixl 1 _$_ infixr 0 lam=>_ data Tm (vc tc : Cx) : Ty -> Set where var : forall {a} -> isTrue a tc -> Tm vc tc a lam=>_ : forall {a b} -> Tm vc (tc , a) b -> Tm vc tc (a => b) _$_ : forall {a b} -> Tm vc tc (a => b) -> Tm vc tc a -> Tm vc tc b var# : forall {a} -> isValid a vc -> Tm vc tc a box : forall {a} -> Tm vc [] a -> Tm vc tc (BOX a) unbox' : forall {a b} -> Tm vc tc (BOX a) -> Tm (vc , a) tc b -> Tm vc tc b syntax unbox' x' x = unbox x' => x v0 : forall {vc tc a} -> Tm vc (tc , a) a v0 = var lzero v1 : forall {vc tc a b} -> Tm vc (tc , a , b) a v1 = var (lsuc lzero) v2 : forall {vc tc a b c} -> Tm vc (tc , a , b , c) a v2 = var (lsuc (lsuc lzero)) v0# : forall {vc tc a} -> Tm (vc , a) tc a v0# = var# lzero v1# : forall {vc tc a b} -> Tm (vc , a , b) tc a v1# = var# (lsuc lzero) v2# : forall {vc tc a b c} -> Tm (vc , a , b , c) tc a v2# = var# (lsuc (lsuc lzero)) Thm : Ty -> Set Thm a = forall {vc tc} -> Tm vc tc a open BoxMp public -- Example theorems rNec : forall {a} -> Thm a -> Thm (BOX a) rNec x = box x aK : forall {a b} -> Thm (BOX (a => b) => BOX a => BOX b) aK = lam=> lam=> (unbox v1 => unbox v0 => box (v1# $ v0#)) aT : forall {a} -> Thm (BOX a => a) aT = lam=> (unbox v0 => v0#) a4 : forall {a} -> Thm (BOX a => BOX (BOX a)) a4 = lam=> (unbox v0 => box (box v0#)) t1 : forall {a} -> Thm (a => BOX (a => a)) t1 = lam=> box (lam=> v0)
build.adb
annexi-strayline/AURA
13
20591
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020-2021, 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.Stream_IO; with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; with Repositories; with Registrar.Last_Run; with Registrar.Queries; with Registrar.Subsystems; with Registrar.Source_Files; with Registrar.Registration; with Workers, Workers.Reporting; with Unit_Names, Unit_Names.Sets; package body Build is use type Registrar.Library_Units.Library_Unit_Kind; use type Registrar.Source_Files.Source_File_Access; New_Line: Character renames Workers.Reporting.New_Line; -- -- Utilities -- ---------------------- -- Object_File_Name -- ---------------------- function Object_File_Name (Unit: Registrar.Library_Units.Library_Unit) return String is use Ada.Directories; use Repositories; use Registrar.Subsystems; Unit_Simple_Name: constant String := (if Unit.Body_File /= null then Simple_Name (Unit.Body_File.Full_Name) else Simple_Name (Unit.Spec_File.Full_Name)); Subsys: constant Subsystem := Registrar.Queries.Lookup_Subsystem (Unit.Name.Subsystem_Name); begin if Subsys.AURA and then Extract_Repository (Subsys.Source_Repository).Format = System then declare Subsys_Name: constant String := Subsys.Name.To_UTF8_String; begin return Current_Directory & '/' & Subsys_Name & '/' & Subsys_Name & ".so"; end; else return Build_Root & '/' & Base_Name (Unit_Simple_Name) & ".o"; end if; end Object_File_Name; ------------------- -- ALI_File_Name -- ------------------- function ALI_File_Name (Unit: Registrar.Library_Units.Library_Unit) return String is use Ada.Directories; begin return Build_Root & '/' & Base_Name (Simple_Name (Object_File_Name (Unit))) & ".ali"; end ALI_File_Name; -- -- Build_Configuration -- Last_Config_Store: constant String := Ada.Directories.Current_Directory & "/.aura/last_build.dat"; ---------------------------- -- Load_Last_Build_Config -- ---------------------------- procedure Load_Last_Build_Config (Configuration: out Build_Configuration) is use Ada.Streams.Stream_IO; Config_File: File_Type; begin Open (File => Config_File, Mode => In_File, Name => Last_Config_Store); Build_Configuration'Read (Stream (Config_File), Configuration); Close (Config_File); exception when others => null; end Load_Last_Build_Config; ------------------------ -- Store_Build_Config -- ------------------------ procedure Store_Build_Config (Current_Config: Build_Configuration) is use Ada.Streams.Stream_IO; Config_File: File_Type; begin if not Ada.Directories.Exists (".aura") then Ada.Directories.Create_Directory (".aura"); end if; if not Ada.Directories.Exists (Last_Config_Store) then Create (File => Config_File, Mode => Out_File, Name => Last_Config_Store); else Open (File => Config_File, Mode => Out_File, Name => Last_Config_Store); end if; Build_Configuration'Write (Stream (Config_File), Current_Config); Close (Config_File); end Store_Build_Config; -- -- Preparation -- ---------------- -- Init_Paths -- ---------------- procedure Init_Paths is use Ada.Directories; begin if Registrar.Last_Run.All_Library_Units.Is_Empty and then Exists (Build_Root) then Delete_Tree (Build_Root); Create_Path (Build_Output_Root); Create_Path (Build_Root); elsif not Exists (Build_Root) or else not Exists (Build_Output_Root) then Create_Path (Build_Output_Root); end if; end Init_Paths; ------------------------------- -- Hash_Compilation_Products -- ------------------------------- package Hash_Compilation_Orders is type Hash_Compilation_Order is new Workers.Work_Order with record Target: Registrar.Library_Units.Library_Unit; end record; -- The Hash_Compilation_Order does not generate any further orders. -- This ensures Direct_Hash_Compilatoion to execute an order directly -- without needing to deal with trackers overriding function Image (Order: Hash_Compilation_Order) return String; overriding procedure Execute (Order: in out Hash_Compilation_Order); end Hash_Compilation_Orders; package body Hash_Compilation_Orders is separate; -------------------------------------------------- procedure Hash_Compilation_Products is use Registrar.Library_Units; Order: Hash_Compilation_Orders.Hash_Compilation_Order; Selected_Units: Registrar.Library_Units.Library_Unit_Sets.Set; All_Units: constant Registrar.Library_Units.Library_Unit_Sets.Set := Registrar.Queries.Entered_Library_Units; begin Order.Tracker := Compilation_Hash_Progress'Access; -- Find our selected units for hashing. These are everything except -- Subunit kinds for Unit of All_Units loop pragma Assert (Unit.Kind /= Unknown); -- Compiled units also need to be rehashed if Unit.State in Available | Compiled and then Unit.Kind /= Subunit then Selected_Units.Include (Unit); end if; end loop; Order.Tracker.Increase_Total_Items_By (Natural (Selected_Units.Length)); -- Dispatch for Unit of Selected_Units loop Order.Target := Unit; Workers.Enqueue_Order (Order); end loop; end Hash_Compilation_Products; -------------------------------------- -- Direct_Hash_Compilation_Products -- -------------------------------------- procedure Direct_Hash_Compilation_Products (Unit: in Registrar.Library_Units.Library_Unit) is Direct_Order: Hash_Compilation_Orders.Hash_Compilation_Order := (Tracker => null, Target => Unit); begin Direct_Order.Execute; end Direct_Hash_Compilation_Products; ---------------------------- -- Compute_Recompilations -- ---------------------------- package Recompilation_Check_Orders is protected type Recompilation_Set is procedure Enter_Subset (Entry_Subset: in out Unit_Names.Sets.Set); -- Enters any items that are in Entry_Subset but not in the -- Recompilation_Set. Items that are already exist in the -- Recompilation_Set are deleted from the Entry_Subset. -- -- The principal of operation is that a Recompilation_Check_Order -- gets the reverse dependency set for it's target unit, and then -- submits that set to Enter_Subset. On return, Entry_Subset -- will contain only the units that the order should then -- generate additional orders for. -- -- The approach eliminates cyclic recursion. function Retrieve return Unit_Names.Sets.Set; -- Returns the entire Recompilation_Set private Master: Unit_Names.Sets.Set; Ret_Guard: Boolean := False; end Recompilation_Set; type Recompilation_Set_Access is access Recompilation_Set; ------------------------------- -- Recompilation_Check_Order -- ------------------------------- -- Recompilation_Check_Orders take a Target unit name, and recursively -- submits additional orders for each dependent unit if it is determined -- that the Target library unit requires recompilation. -- -- How the order determines if the Target unit requires recompilation -- depends on the Mode component. -- -- At the end of the process, the Phase_Trigger takes the generated -- set of unit names and marks all corresponding units in -- All_Library_Units as "Available" so that they will be recompiled -- in the compilation phase type Processing_Mode is (Test, -- The designated library unit needs to be checked. This means -- checking the compilation hash, specification hash, and -- implementation hash against the Last_Run set. -- -- This mode is only set from the original dispatch -- (Build.Compute_Recompilations) Set); -- The designated unit name must be entered into the Recompilation -- Set, along with reverse dependencies, recursively. -- -- This mode is always set for any recursively dispatched order. type Recompilation_Check_Order is new Workers.Work_Order with record Target : Unit_Names.Unit_Name; Mode : Processing_Mode; Recomp_Set: Recompilation_Set_Access; end record; overriding function Image (Order: Recompilation_Check_Order) return String; overriding procedure Execute (Order: in out Recompilation_Check_Order); overriding procedure Phase_Trigger (Order: in out Recompilation_Check_Order); end Recompilation_Check_Orders; package body Recompilation_Check_Orders is separate; -------------------------------------------------- procedure Compute_Recompilations (Configuration: Build_Configuration) is use Registrar.Library_Units; use Recompilation_Check_Orders; package LU_Keyed_Ops renames Registrar.Library_Units.Library_Unit_Sets_Keyed_Operations; procedure Set_Available (Unit: in out Library_Unit) is begin Unit.State := Available; end Set_Available; Last_Config: Build_Configuration; All_Units: Library_Unit_Sets.Set := Registrar.Queries.Entered_Library_Units; Target_Set: Unit_Names.Sets.Set; Order: Recompilation_Check_Order; Beacon_OK: Boolean; begin Compute_Recompilations_Completion.Approach (Beacon_OK); if not Beacon_OK then return; end if; Load_Last_Build_Config (Configuration => Last_Config); if Registrar.Last_Run.All_Library_Units.Is_Empty or else Last_Config /= Configuration then -- All units must be recompiled. The actual Compile process will -- ensure any residual objects are deleted for C in All_Units.Iterate loop declare use Repositories; use Registrar.Subsystems; USS: constant Subsystem := Registrar.Queries.Lookup_Subsystem (All_Units(C).Name.Subsystem_Name); begin if not (USS.AURA and then Extract_Repository(USS.Source_Repository).Format = System) then LU_Keyed_Ops.Update_Element_Preserving_Key (Container => All_Units, Position => C, Process => Set_Available'Access); end if; end; end loop; Registrar.Registration.Update_Library_Unit_Subset (All_Units); Compute_Recompilations_Completion.Leave; return; end if; -- Only re-evaluate Compiled items, since the purpose here is to select -- which "Compiled" units need to be pushed back to "Available" so that -- they will be compiled. for Unit of All_Units loop if Unit.Kind in Package_Unit | Subprogram_Unit | External_Unit and then Unit.State = Compiled then Target_Set.Insert (Unit.Name); end if; end loop; Order.Tracker := Compute_Recompilations_Progress'Access; Order.Mode := Test; Order.Recomp_Set := new Recompilation_Set; Order.Tracker.Increase_Total_Items_By (Natural (Target_Set.Length)); for Name of Target_Set loop Order.Target := Name; Workers.Enqueue_Order (Order); end loop; end Compute_Recompilations; end Build;
ffight/lcs/1p/66.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
244089
<filename>ffight/lcs/1p/66.asm copyright zengfr site:http://github.com/zengfr/romhack 007CF0 move.w (-$6e0a,A5), ($66,A6) [1p+59] 007CF6 tst.b ($58,A6) [1p+66] 00849A moveq #$0, D5 0084A2 rts [1p+66, container+66, enemy+66] 00A2C6 dbra D0, $a2c0 00A340 clr.w ($66,A4) 00A344 clr.b ($88,A4) copyright zengfr site:http://github.com/zengfr/romhack
Univalence/Obsolete/ConcretePermutation2.agda
JacquesCarette/pi-dual
14
2319
<reponame>JacquesCarette/pi-dual {-# OPTIONS --without-K #-} module ConcretePermutation where import Level using (zero) open import Data.Nat using (ℕ; _+_; _*_) open import Data.Fin using (Fin) open import Data.Product using (proj₁; proj₂) open import Data.Vec using (tabulate) open import Algebra using (CommutativeSemiring) open import Algebra.Structures using (IsSemigroup; IsCommutativeMonoid; IsCommutativeSemiring) open import Relation.Binary using (IsEquivalence) open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; cong; cong₂; module ≡-Reasoning) open import Equiv using (_≃_; sym≃;p∘!p≡id) -- open import FinVec using (FinVec; 1C; _∘̂_; _⊎c_; _×c_; unite+; uniti+; unite+r; uniti+r; assocl+; assocr+; swap+cauchy; unite*; uniti*; unite*r; uniti*r; assocl*; assocr*; swap⋆cauchy; dist*+; factor*+; distl*+; factorl*+; right-zero*l; right-zero*r) open import FinVecProperties using (∘̂-assoc; ∘̂-lid; ∘̂-rid; ~⇒≡; 1C⊎1C≡1C; 1C×1C≡1C; 1C₀⊎x≡x; ⊎c-distrib; ×c-distrib; unite+∘̂uniti+~id; uniti+∘̂unite+~id; unite+r∘̂uniti+r~id; uniti+r∘̂unite+r~id; assocl+∘̂assocr+~id; assocr+∘̂assocl+~id; swap+-inv; unite*∘̂uniti*~id; uniti*∘̂unite*~id; unite*r∘̂uniti*r~id; uniti*r∘̂unite*r~id; assocl*∘̂assocr*~id; assocr*∘̂assocl*~id; swap*-inv; dist*+∘̂factor*+~id; factor*+∘̂dist*+~id; distl*+∘̂factorl*+~id; factorl*+∘̂distl*+~id; right-zero*l∘̂right-zero*r~id; right-zero*r∘̂right-zero*l~id) ------------------------------------------------------------------------------ -- A concrete permutation has 4 components: -- - the one-line notation for a permutation -- - the one-line notation for the inverse permutation -- - and 2 proofs that these are indeed inverses record CPerm (values : ℕ) (size : ℕ) : Set where constructor cp field π : FinVec values size πᵒ : FinVec size values αp : π ∘̂ πᵒ ≡ 1C βp : πᵒ ∘̂ π ≡ 1C ------------------------------------------------------------------------------ -- Now the goal is to prove that CPerm m n is a commutative semiring -- (including symmetry now) -- First it is an equivalence relation idp : ∀ {n} → CPerm n n idp {n} = cp 1C 1C (∘̂-rid _) (∘̂-lid _) symp : ∀ {m n} → CPerm m n → CPerm n m symp (cp p₁ p₂ α β) = cp p₂ p₁ β α transp : ∀ {m₁ m₂ m₃} → CPerm m₂ m₁ → CPerm m₃ m₂ → CPerm m₃ m₁ transp {n} (cp π πᵒ αp βp) (cp π₁ πᵒ₁ αp₁ βp₁) = cp (π ∘̂ π₁) (πᵒ₁ ∘̂ πᵒ) pf₁ pf₂ where open ≡-Reasoning pf₁ : (π ∘̂ π₁) ∘̂ (πᵒ₁ ∘̂ πᵒ) ≡ 1C pf₁ = begin ( (π ∘̂ π₁) ∘̂ (πᵒ₁ ∘̂ πᵒ) ≡⟨ ∘̂-assoc _ _ _ ⟩ ((π ∘̂ π₁) ∘̂ πᵒ₁) ∘̂ πᵒ ≡⟨ cong (λ x → x ∘̂ πᵒ) (sym (∘̂-assoc _ _ _)) ⟩ (π ∘̂ (π₁ ∘̂ πᵒ₁)) ∘̂ πᵒ ≡⟨ cong (λ x → (π ∘̂ x) ∘̂ πᵒ) (αp₁) ⟩ (π ∘̂ 1C) ∘̂ πᵒ ≡⟨ cong (λ x → x ∘̂ πᵒ) (∘̂-rid _) ⟩ π ∘̂ πᵒ ≡⟨ αp ⟩ 1C ∎) pf₂ : (πᵒ₁ ∘̂ πᵒ) ∘̂ (π ∘̂ π₁) ≡ 1C pf₂ = begin ( (πᵒ₁ ∘̂ πᵒ) ∘̂ (π ∘̂ π₁) ≡⟨ ∘̂-assoc _ _ _ ⟩ ((πᵒ₁ ∘̂ πᵒ) ∘̂ π) ∘̂ π₁ ≡⟨ cong (λ x → x ∘̂ π₁) (sym (∘̂-assoc _ _ _)) ⟩ (πᵒ₁ ∘̂ (πᵒ ∘̂ π)) ∘̂ π₁ ≡⟨ cong (λ x → (πᵒ₁ ∘̂ x) ∘̂ π₁) βp ⟩ (πᵒ₁ ∘̂ 1C) ∘̂ π₁ ≡⟨ cong (λ x → x ∘̂ π₁) (∘̂-rid _) ⟩ πᵒ₁ ∘̂ π₁ ≡⟨ βp₁ ⟩ 1C ∎) -- units -- zero permutation 0p : CPerm 0 0 0p = idp {0} -- Additive monoid _⊎p_ : ∀ {m₁ m₂ n₁ n₂} → CPerm m₁ m₂ → CPerm n₁ n₂ → CPerm (m₁ + n₁) (m₂ + n₂) _⊎p_ {m₁} {m₂} {n₁} {n₂} π₀ π₁ = cp ((π π₀) ⊎c (π π₁)) ((πᵒ π₀) ⊎c (πᵒ π₁)) pf₁ pf₂ where open CPerm open ≡-Reasoning pf₁ : (π π₀ ⊎c π π₁) ∘̂ (πᵒ π₀ ⊎c πᵒ π₁) ≡ 1C pf₁ = begin ( (π π₀ ⊎c π π₁) ∘̂ (πᵒ π₀ ⊎c πᵒ π₁) ≡⟨ ⊎c-distrib {p₁ = π π₀} ⟩ (π π₀ ∘̂ πᵒ π₀) ⊎c (π π₁ ∘̂ πᵒ π₁) ≡⟨ cong₂ _⊎c_ (αp π₀) (αp π₁) ⟩ 1C {m₂} ⊎c 1C {n₂} ≡⟨ 1C⊎1C≡1C {m₂} ⟩ 1C ∎) pf₂ : (πᵒ π₀ ⊎c πᵒ π₁) ∘̂ (π π₀ ⊎c π π₁) ≡ 1C pf₂ = begin ( (πᵒ π₀ ⊎c πᵒ π₁) ∘̂ (π π₀ ⊎c π π₁) ≡⟨ ⊎c-distrib {p₁ = πᵒ π₀} ⟩ (πᵒ π₀ ∘̂ π π₀) ⊎c (πᵒ π₁ ∘̂ π π₁) ≡⟨ cong₂ _⊎c_ (βp π₀) (βp π₁) ⟩ 1C {m₁} ⊎c 1C {n₁} ≡⟨ 1C⊎1C≡1C {m₁} ⟩ 1C ∎ ) -- For the rest of the permutations, it is convenient to lift things from -- FinVec in one go mkPerm : {m n : ℕ} → (Fin m ≃ Fin n) → CPerm m n mkPerm {m} {n} eq = cp p q p∘̂q≡1 q∘̂p≡1 where f = proj₁ eq g = proj₁ (sym≃ eq) p = tabulate g -- note the flip! q = tabulate f q∘̂p≡1 = ~⇒≡ {f = g} {g = f} (p∘!p≡id {p = eq}) p∘̂q≡1 = ~⇒≡ {f = f} {g = g} (p∘!p≡id {p = sym≃ eq}) -- units unite+p : {m : ℕ} → CPerm m (0 + m) unite+p {m} = cp (unite+ {m}) (uniti+ {m}) (unite+∘̂uniti+~id {m}) (uniti+∘̂unite+~id {m}) uniti+p : {m : ℕ} → CPerm (0 + m) m uniti+p {m} = symp (unite+p {m}) unite+rp : {m : ℕ} → CPerm m (m + 0) unite+rp {m} = cp (unite+r {m}) (uniti+r) (unite+r∘̂uniti+r~id) (uniti+r∘̂unite+r~id) uniti+rp : {m : ℕ} → CPerm (m + 0) m uniti+rp {m} = symp (unite+rp {m}) -- commutativity swap+p : {m n : ℕ} → CPerm (n + m) (m + n) swap+p {m} {n} = cp (swap+cauchy m n) (swap+cauchy n m) (swap+-inv {m}) (swap+-inv {n}) -- associativity assocl+p : {m n o : ℕ} → CPerm ((m + n) + o) (m + (n + o)) assocl+p {m} = cp (assocl+ {m}) (assocr+ {m}) (assocl+∘̂assocr+~id {m}) (assocr+∘̂assocl+~id {m}) assocr+p : {m n o : ℕ} → CPerm (m + (n + o)) ((m + n) + o) assocr+p {m} = symp (assocl+p {m}) -- Multiplicative monoid _×p_ : ∀ {m₁ m₂ n₁ n₂} → CPerm m₁ m₂ → CPerm n₁ n₂ → CPerm (m₁ * n₁) (m₂ * n₂) _×p_ {m₁} {m₂} {n₁} {n₂} π₀ π₁ = cp ((π π₀) ×c (π π₁)) ((πᵒ π₀) ×c (πᵒ π₁)) pf₁ pf₂ where open CPerm open ≡-Reasoning pf₁ : (π π₀ ×c π π₁) ∘̂ (πᵒ π₀ ×c πᵒ π₁) ≡ 1C pf₁ = begin ( (π π₀ ×c π π₁) ∘̂ (πᵒ π₀ ×c πᵒ π₁) ≡⟨ ×c-distrib {p₁ = π π₀} ⟩ (π π₀ ∘̂ πᵒ π₀) ×c (π π₁ ∘̂ πᵒ π₁) ≡⟨ cong₂ _×c_ (αp π₀) (αp π₁) ⟩ 1C ×c 1C ≡⟨ 1C×1C≡1C ⟩ 1C ∎) pf₂ : (πᵒ π₀ ×c πᵒ π₁) ∘̂ (π π₀ ×c π π₁) ≡ 1C pf₂ = begin ( (πᵒ π₀ ×c πᵒ π₁) ∘̂ (π π₀ ×c π π₁) ≡⟨ ×c-distrib {p₁ = πᵒ π₀} ⟩ (πᵒ π₀ ∘̂ π π₀) ×c (πᵒ π₁ ∘̂ π π₁) ≡⟨ cong₂ _×c_ (βp π₀) (βp π₁) ⟩ 1C ×c 1C ≡⟨ 1C×1C≡1C ⟩ 1C ∎) -- units unite*p : {m : ℕ} → CPerm m (1 * m) unite*p {m} = cp (unite* {m}) (uniti* {m}) (unite*∘̂uniti*~id {m}) (uniti*∘̂unite*~id {m}) uniti*p : {m : ℕ} → CPerm (1 * m) m uniti*p {m} = symp (unite*p {m}) unite*rp : {m : ℕ} → CPerm m (m * 1) unite*rp {m} = cp (unite*r {m}) (uniti*r {m}) (unite*r∘̂uniti*r~id {m}) (uniti*r∘̂unite*r~id {m}) uniti*rp : {m : ℕ} → CPerm (m * 1) m uniti*rp {m} = symp (unite*rp {m}) -- commutativity swap*p : {m n : ℕ} → CPerm (n * m) (m * n) swap*p {m} {n} = cp (swap⋆cauchy m n) (swap⋆cauchy n m) (swap*-inv {m}) (swap*-inv {n}) -- associativity assocl*p : {m n o : ℕ} → CPerm ((m * n) * o) (m * (n * o)) assocl*p {m} = cp (assocl* {m}) (assocr* {m}) (assocl*∘̂assocr*~id {m}) (assocr*∘̂assocl*~id {m}) assocr*p : {m n o : ℕ} → CPerm (m * (n * o)) ((m * n) * o) assocr*p {m} = symp (assocl*p {m}) -- Distributivity -- right-zero absorbing permutation 0pr : ∀ {n} → CPerm 0 (n * 0) 0pr {n} = cp (right-zero*l {n}) (right-zero*r {n}) (right-zero*l∘̂right-zero*r~id {n}) (right-zero*r∘̂right-zero*l~id {n}) -- and its symmetric version 0pl : ∀ {n} → CPerm (n * 0) 0 0pl {n} = symp (0pr {n}) distp : {m n o : ℕ} → CPerm (m * o + n * o) ((m + n) * o) distp {m} {n} {o} = cp (dist*+ {m}) (factor*+ {m}) (dist*+∘̂factor*+~id {m}) (factor*+∘̂dist*+~id {m}) factorp : {m n o : ℕ} → CPerm ((m + n) * o) (m * o + n * o) factorp {m} = symp (distp {m}) distlp : {m n o : ℕ} → CPerm (m * n + m * o) (m * (n + o)) distlp {m} {n} {o} = cp (distl*+ {m}) (factorl*+ {m}) (distl*+∘̂factorl*+~id {m}) (factorl*+∘̂distl*+~id {m}) factorlp : {m n o : ℕ} → CPerm (m * (n + o)) (m * n + m * o) factorlp {m} = symp (distlp {m}) ------------------------------------------------------------------------------ -- Commutative semiring structure cpermIsEquiv : IsEquivalence {Level.zero} {Level.zero} {ℕ} CPerm cpermIsEquiv = record { refl = idp; sym = symp; trans = λ p q → transp q p } cpermPlusIsSG : IsSemigroup {Level.zero} {Level.zero} {ℕ} CPerm _+_ cpermPlusIsSG = record { isEquivalence = cpermIsEquiv ; assoc = λ m n o → assocl+p {m} {n} {o} ; ∙-cong = _⊎p_ } cpermTimesIsSG : IsSemigroup {Level.zero} {Level.zero} {ℕ} CPerm _*_ cpermTimesIsSG = record { isEquivalence = cpermIsEquiv ; assoc = λ m n o → assocl*p {m} {n} {o} ; ∙-cong = _×p_ } cpermPlusIsCM : IsCommutativeMonoid CPerm _+_ 0 cpermPlusIsCM = record { isSemigroup = cpermPlusIsSG ; identityˡ = λ m → idp ; comm = λ m n → swap+p {n} {m} } cpermTimesIsCM : IsCommutativeMonoid CPerm _*_ 1 cpermTimesIsCM = record { isSemigroup = cpermTimesIsSG ; identityˡ = λ m → uniti*p {m} ; comm = λ m n → swap*p {n} {m} } cpermIsCSR : IsCommutativeSemiring CPerm _+_ _*_ 0 1 cpermIsCSR = record { +-isCommutativeMonoid = cpermPlusIsCM ; *-isCommutativeMonoid = cpermTimesIsCM ; distribʳ = λ o m n → factorp {m} {n} {o} ; zeroˡ = λ m → 0p } cpermCSR : CommutativeSemiring Level.zero Level.zero cpermCSR = record { Carrier = ℕ ; _≈_ = CPerm; _+_ = _+_ ; _*_ = _*_ ; 0# = 0 ; 1# = 1 ; isCommutativeSemiring = cpermIsCSR } ------------------------------------------------------------------------------
sources/glew/glew.ads
godunko/adagl
6
16221
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018-2020, <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 <NAME>, 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. -- -- -- ------------------------------------------------------------------------------ with OpenGL; with Interfaces.C.Strings; with System; package GLEW is pragma Preelaborate; type GLuint is new Interfaces.Unsigned_32; type GLuint_Array is array (Positive range <>) of GLuint with Convention => C; type GLint_Array is array (Positive range <>) of OpenGL.GLint with Convention => C; type glewGenBuffers is access procedure (n : OpenGL.GLsizei; buffers : access GLuint) with Convention => C; glGenBuffers : glewGenBuffers with Import, Convention => C, External_Name => "__glewGenBuffers"; type glewBufferData is access procedure (target : OpenGL.GLenum; size : Interfaces.C.ptrdiff_t; data : System.Address; buffer : GLuint) with Convention => C; glBufferData : glewBufferData with Import, Convention => C, External_Name => "__glewBufferData"; type glewBindBuffer is access procedure (target : OpenGL.GLenum; buffer : GLuint) with Convention => C; glBindBuffer : glewBindBuffer with Import, Convention => C, External_Name => "__glewBindBuffer"; type glewCreateShader is access function (shaderType : OpenGL.GLenum) return GLuint with Convention => C; glCreateShader : glewCreateShader with Import, Convention => C, External_Name => "__glewCreateShader"; type glewShaderSource is access procedure (shader : GLuint; count : OpenGL.GLsizei; string : Interfaces.C.Strings.chars_ptr_array; length : GLint_Array) with Convention => C; glShaderSource : glewShaderSource with Import, Convention => C, External_Name => "__glewShaderSource"; type glewCompileShader is access procedure (shader : GLuint) with Convention => C; glCompileShader : glewCompileShader with Import, Convention => C, External_Name => "__glewCompileShader"; type glewGetShaderiv is access procedure (shader : GLuint; pname : OpenGL.GLenum; params : access OpenGL.GLint) with Convention => C; glGetShaderiv : glewGetShaderiv with Import, Convention => C, External_Name => "__glewGetShaderiv"; type glewDeleteShader is access procedure (shader : GLuint) with Convention => C; glDeleteShader : glewDeleteShader with Import, Convention => C, External_Name => "__glewDeleteShader"; type glewGetShaderInfoLog is access procedure (shader : GLuint; maxLength : OpenGL.GLsizei; length : access OpenGL.GLsizei; infoLog : out Interfaces.C.char_array) with Convention => C; glGetShaderInfoLog : glewGetShaderInfoLog with Import, Convention => C, External_Name => "__glewGetShaderInfoLog"; type glewAttachShader is access procedure (program : GLuint; shader : GLuint) with Convention => C; glAttachShader : glewAttachShader with Import, Convention => C, External_Name => "__glewAttachShader"; type glewGetAttribLocation is access function (program : GLuint; name : Interfaces.C.char_array) return OpenGL.GLint with Convention => C; glGetAttribLocation : glewGetAttribLocation with Import, Convention => C, External_Name => "__glewGetAttribLocation"; type glewUseProgram is access procedure (program : GLuint) with Convention => C; glUseProgram : glewUseProgram with Import, Convention => C, External_Name => "__glewUseProgram"; type glewCreateProgram is access function return GLuint with Convention => C; glCreateProgram : glewCreateProgram with Import, Convention => C, External_Name => "__glewCreateProgram"; type glewDisableVertexAttribArray is access procedure (index : GLuint) with Convention => C; glDisableVertexAttribArray : glewDisableVertexAttribArray with Import, Convention => C, External_Name => "__glewDisableVertexAttribArray"; type glewEnableVertexAttribArray is access procedure (index : GLuint) with Convention => C; glEnableVertexAttribArray : glewEnableVertexAttribArray with Import, Convention => C, External_Name => "__glewEnableVertexAttribArray"; type glewGetProgramiv is access procedure (program : GLuint; pname : OpenGL.GLenum; params : access OpenGL.GLint) with Convention => C; glGetProgramiv : glewGetProgramiv with Import, Convention => C, External_Name => "__glewGetProgramiv"; type glewLinkProgram is access procedure (index : GLuint) with Convention => C; glLinkProgram : glewLinkProgram with Import, Convention => C, External_Name => "__glewLinkProgram"; type glewVertexAttribPointer is access procedure (index : GLuint; size : OpenGL.GLint; kind : OpenGL.GLenum; normalized : OpenGL.GLint; stride : OpenGL.GLsizei; pointer : System.Address) with Convention => C; glVertexAttribPointer : glewVertexAttribPointer with Import, Convention => C, External_Name => "__glewVertexAttribPointer"; type glewVertexAttrib1f is access procedure (index : GLuint; v0 : OpenGL.GLfloat) with Convention => C; glVertexAttrib1f : glewVertexAttrib1f with Import, Convention => C, External_Name => "__glewVertexAttrib1f"; type glewVertexAttrib2f is access procedure (index : GLuint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat) with Convention => C; glVertexAttrib2f : glewVertexAttrib2f with Import, Convention => C, External_Name => "__glewVertexAttrib2f"; type glewVertexAttrib3f is access procedure (index : GLuint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat; v2 : OpenGL.GLfloat) with Convention => C; glVertexAttrib3f : glewVertexAttrib3f with Import, Convention => C, External_Name => "__glewVertexAttrib3f"; type glewVertexAttrib4f is access procedure (index : GLuint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat; v2 : OpenGL.GLfloat; v4 : OpenGL.GLfloat) with Convention => C; glVertexAttrib4f : glewVertexAttrib4f with Import, Convention => C, External_Name => "__glewVertexAttrib4f"; type glewVertexAttrib2fv is access procedure (index : GLuint; v : OpenGL.GLfloat_Matrix_2x2) with Convention => C; glVertexAttrib2fv : glewVertexAttrib2fv with Import, Convention => C, External_Name => "__glewVertexAttrib2fv"; type glewVertexAttrib3fv is access procedure (index : GLuint; v : OpenGL.GLfloat_Matrix_3x3) with Convention => C; glVertexAttrib3fv : glewVertexAttrib3fv with Import, Convention => C, External_Name => "__glewVertexAttrib3fv"; type glewVertexAttrib4fv is access procedure (index : GLuint; v : OpenGL.GLfloat_Matrix_4x4) with Convention => C; glVertexAttrib4fv : glewVertexAttrib4fv with Import, Convention => C, External_Name => "__glewVertexAttrib4fv"; type glewUniform1i is access procedure (index : OpenGL.GLint; v0 : OpenGL.GLint) with Convention => C; glUniform1i : glewUniform1i with Import, Convention => C, External_Name => "__glewUniform1i"; type glewUniform1f is access procedure (index : OpenGL.GLint; v0 : OpenGL.GLfloat) with Convention => C; glUniform1f : glewUniform1f with Import, Convention => C, External_Name => "__glewUniform1f"; type glewUniform2f is access procedure (index : OpenGL.GLint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat) with Convention => C; glUniform2f : glewUniform2f with Import, Convention => C, External_Name => "__glewUniform2f"; type glewUniform3f is access procedure (index : OpenGL.GLint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat; v2 : OpenGL.GLfloat) with Convention => C; glUniform3f : glewUniform3f with Import, Convention => C, External_Name => "__glewUniform3f"; type glewUniform4f is access procedure (index : OpenGL.GLint; v0 : OpenGL.GLfloat; v1 : OpenGL.GLfloat; v2 : OpenGL.GLfloat; v4 : OpenGL.GLfloat) with Convention => C; glUniform4f : glewUniform4f with Import, Convention => C, External_Name => "__glewUniform4f"; type glewUniformMatrix2fv is access procedure (index : OpenGL.GLint; count : OpenGL.GLsizei; transpose : OpenGL.GLint; v : OpenGL.GLfloat_Matrix_2x2) with Convention => C; glUniformMatrix2fv : glewUniformMatrix2fv with Import, Convention => C, External_Name => "__glewUniformMatrix2fv"; type glewUniformMatrix3fv is access procedure (index : OpenGL.GLint; count : OpenGL.GLsizei; transpose : OpenGL.GLint; v : OpenGL.GLfloat_Matrix_3x3) with Convention => C; glUniformMatrix3fv : glewUniformMatrix3fv with Import, Convention => C, External_Name => "__glewUniformMatrix3fv"; type glewUniformMatrix4fv is access procedure (index : OpenGL.GLint; count : OpenGL.GLsizei; transpose : OpenGL.GLint; v : OpenGL.GLfloat_Matrix_4x4) with Convention => C; glUniformMatrix4fv : glewUniformMatrix4fv with Import, Convention => C, External_Name => "__glewUniformMatrix4fv"; type glewGetUniformLocation is access function (program : GLuint; name : Interfaces.C.char_array) return OpenGL.GLint with Convention => C; glGetUniformLocation : glewGetUniformLocation with Import, Convention => C, External_Name => "__glewGetUniformLocation"; type glewActiveTexture is access procedure (texture : OpenGL.GLenum) with Convention => C; glActiveTexture : glewActiveTexture with Import, Convention => C, External_Name => "__glewActiveTexture"; procedure glClear (mask : OpenGL.Clear_Buffer_Mask) with Import, Convention => C, External_Name => "glClear"; procedure glDrawArrays (mode : OpenGL.GLenum; first : OpenGL.GLint; count : OpenGL.GLsizei) with Import, Convention => C, External_Name => "glDrawArrays"; procedure glDrawElements (mode : OpenGL.GLenum; count : OpenGL.GLsizei; tipe : OpenGL.GLenum; offset : System.Address) with Import, Convention => C, External_Name => "glDrawElements"; procedure glEnable(cap : OpenGL.GLenum) with Import, Convention => C, External_Name => "glEnable"; procedure glDisable(cap : OpenGL.GLenum) with Import, Convention => C, External_Name => "glDisable"; procedure glBlendFunc (sfactor : OpenGL.GLenum; dfactor : OpenGL.GLenum) with Import, Convention => C, External_Name => "glBlendFunc"; procedure glClearColor (red, green, blue, alpha : OpenGL.GLclampf) with Import, Convention => C, External_Name => "glClearColor"; procedure glClearDepth (depth : OpenGL.GLdouble) with Import, Convention => C, External_Name => "glClearDepth"; procedure glDepthFunc (func : OpenGL.GLenum) with Import, Convention => C, External_Name => "glDepthFunc"; procedure glFinish with Import, Convention => C, External_Name => "glFinish"; procedure glFlush with Import, Convention => C, External_Name => "glFlush"; procedure glViewport (x, y : OpenGL.GLint; width, height : OpenGL.GLsizei) with Import, Convention => C, External_Name => "glViewport"; procedure glBindTexture (target : OpenGL.GLenum; texture : GLuint) with Import, Convention => C, External_Name => "glBindTexture"; procedure glGenTextures (n : OpenGL.GLsizei; textures : access GLuint) with Import, Convention => C, External_Name => "glGenTextures"; procedure glDeleteTextures (n : OpenGL.GLsizei; textures : access GLuint) with Import, Convention => C, External_Name => "glDeleteTextures"; procedure glTexImage2D (target : OpenGL.GLenum; level : OpenGL.GLint; internalformat : OpenGL.GLenum; width : OpenGL.GLsizei; height : OpenGL.GLsizei; border : OpenGL.GLint; format : OpenGL.GLenum; tipe : OpenGL.GLenum; data : System.Address) with Import, Convention => C, External_Name => "glTexImage2D"; procedure glTexParameteri (target : OpenGL.GLenum; pname : OpenGL.GLenum; param : OpenGL.GLint) with Import, Convention => C, External_Name => "glTexParameteri"; ARRAY_BUFFER : constant := 16#8892#; ELEMENT_ARRAY_BUFFER : constant := 16#8893#; STATIC_DRAW : constant := 16#88E4#; FRAGMENT_SHADER : constant := 16#8B30#; VERTEX_SHADER : constant := 16#8B31#; COMPILE_STATUS : constant := 16#8B81#; LINK_STATUS : constant := 16#8B82#; end GLEW;
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xa0_notsx.log_21829_1089.asm
ljhsiun2/medusa
9
179212
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1ac2, %rbp add %r8, %r8 mov $0x6162636465666768, %r10 movq %r10, %xmm6 vmovups %ymm6, (%rbp) sub %rdx, %rdx lea addresses_WT_ht+0x14a1e, %rbx nop nop nop nop xor $15454, %rdi mov (%rbx), %rdx nop nop xor $22234, %r10 lea addresses_WC_ht+0xd722, %rbx mfence mov (%rbx), %rdx nop nop nop nop nop xor $7930, %rbx lea addresses_normal_ht+0x1aa82, %rdi nop nop nop dec %rax mov (%rdi), %ebx nop nop xor %rdi, %rdi lea addresses_WT_ht+0x5242, %rsi lea addresses_UC_ht+0xdfc2, %rdi nop nop nop nop xor $38841, %rax mov $65, %rcx rep movsw nop sub %r10, %r10 lea addresses_UC_ht+0x1c75a, %rdx nop nop nop nop nop add %rax, %rax vmovups (%rdx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %rsi nop and $58913, %rbp lea addresses_A_ht+0x81c0, %rsi lea addresses_A_ht+0x1541e, %rdi nop nop nop nop sub $33393, %r8 mov $84, %rcx rep movsl nop nop sub $16911, %r10 lea addresses_WT_ht+0x4862, %rbx nop nop nop sub %rdi, %rdi movb (%rbx), %al nop nop and $6147, %rdi lea addresses_UC_ht+0xb5c2, %rdi and $2331, %r10 movl $0x61626364, (%rdi) nop nop add %r10, %r10 lea addresses_WT_ht+0xffc2, %rdi nop nop nop add $60064, %rbp movb (%rdi), %cl xor %rax, %rax lea addresses_WT_ht+0x1bbed, %rbp nop xor %rcx, %rcx mov (%rbp), %rdx nop nop mfence lea addresses_WT_ht+0x14bc2, %rsi nop nop nop cmp %rax, %rax mov $0x6162636465666768, %r8 movq %r8, %xmm2 movups %xmm2, (%rsi) nop nop nop nop nop inc %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r8 push %rax push %rcx // Store lea addresses_PSE+0x1ca30, %r11 nop nop nop nop and %r10, %r10 mov $0x5152535455565758, %r8 movq %r8, (%r11) sub $64823, %r12 // Store lea addresses_D+0x87c2, %rcx nop nop nop nop nop and %r13, %r13 movb $0x51, (%rcx) nop nop dec %r11 // Load lea addresses_RW+0x7d82, %rcx nop nop nop nop sub %r8, %r8 mov (%rcx), %r11d nop nop dec %r12 // Store lea addresses_D+0x1ddc2, %r13 nop nop nop nop nop xor $27864, %rax movl $0x51525354, (%r13) nop nop xor $45894, %r11 // Load lea addresses_D+0xdc2, %r13 inc %rcx vmovups (%r13), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %r8 nop nop and $42804, %r8 // Store lea addresses_D+0x4fc2, %r10 nop nop nop nop nop sub $53173, %r12 movw $0x5152, (%r10) add $39869, %r12 // Store lea addresses_A+0xb316, %rax nop nop nop and $39449, %r12 mov $0x5152535455565758, %rcx movq %rcx, (%rax) nop nop nop nop xor %r10, %r10 // Faulty Load lea addresses_D+0x4fc2, %r10 nop nop nop nop nop cmp %r13, %r13 mov (%r10), %rcx lea oracles, %r12 and $0xff, %rcx shlq $12, %rcx mov (%r12,%rcx,1), %rcx pop %rcx pop %rax pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 11}} {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}} {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}} {'52': 21829} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
scripts/track/updater.tmpl.scpt
katsuma/itunes-client
12
390
<reponame>katsuma/itunes-client tell application "iTunes" set specified_track to (some track whose persistent ID is "#{persistent_id}") #{update_records} end tell
_anim/obj55.asm
NatsumiFox/AMPS-Sonic-1-2005
2
101623
<filename>_anim/obj55.asm ; --------------------------------------------------------------------------- ; Animation script - Basaran enemy ; --------------------------------------------------------------------------- dc.w byte_10230-Ani_obj55 dc.w byte_10234-Ani_obj55 dc.w byte_10238-Ani_obj55 byte_10230: dc.b $F, 0, $FF, 0 byte_10234: dc.b $F, 1, $FF, 0 byte_10238: dc.b 3, 1, 2, 3, 2, $FF even
pixy/src/host/pantilt_in_ada/specs/x86_64_linux_gnu_sys_time_h.ads
GambuzX/Pixy-SIW
1
25898
<gh_stars>1-10 -- -- Copyright (c) 2015, <NAME> <<EMAIL>> -- -- Permission to use, copy, modify, and/or distribute this software 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with x86_64_linux_gnu_bits_time_h; with Interfaces.C.Strings; package x86_64_linux_gnu_sys_time_h is -- arg-macro: procedure TIMEVAL_TO_TIMESPEC (tv, ts) -- { (ts).tv_sec := (tv).tv_sec; (ts).tv_nsec := (tv).tv_usec * 1000; } -- arg-macro: procedure TIMESPEC_TO_TIMEVAL (tv, ts) -- { (tv).tv_sec := (ts).tv_sec; (tv).tv_usec := (ts).tv_nsec / 1000; } -- unsupported macro: ITIMER_REAL ITIMER_REAL -- unsupported macro: ITIMER_VIRTUAL ITIMER_VIRTUAL -- unsupported macro: ITIMER_PROF ITIMER_PROF -- arg-macro: function timerisset (tvp) -- return (tvp).tv_sec or else (tvp).tv_usec; -- arg-macro: function timerclear (tvp) -- return (tvp).tv_sec := (tvp).tv_usec := 0; -- arg-macro: function timercmp (a, b, CMP) -- return ((a).tv_sec = (b).tv_sec) ? ((a).tv_usec CMP (b).tv_usec) : ((a).tv_sec CMP (b).tv_sec); -- arg-macro: procedure timeradd (a, b, result) -- do { (result).tv_sec := (a).tv_sec + (b).tv_sec; (result).tv_usec := (a).tv_usec + (b).tv_usec; if ((result).tv_usec >= 1000000) { ++(result).tv_sec; (result).tv_usec -= 1000000; } } while (0) -- arg-macro: procedure timersub (a, b, result) -- do { (result).tv_sec := (a).tv_sec - (b).tv_sec; (result).tv_usec := (a).tv_usec - (b).tv_usec; if ((result).tv_usec < 0) { --(result).tv_sec; (result).tv_usec += 1000000; } } while (0) type timezone is record tz_minuteswest : aliased int; -- /usr/include/x86_64-linux-gnu/sys/time.h:57 tz_dsttime : aliased int; -- /usr/include/x86_64-linux-gnu/sys/time.h:58 end record; pragma Convention (C_Pass_By_Copy, timezone); -- /usr/include/x86_64-linux-gnu/sys/time.h:55 type uu_timezone_ptr_t is access all timezone; -- /usr/include/x86_64-linux-gnu/sys/time.h:61 function gettimeofday (uu_tv : access x86_64_linux_gnu_bits_time_h.timeval; uu_tz : uu_timezone_ptr_t) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:71 pragma Import (C, gettimeofday, "gettimeofday"); function settimeofday (uu_tv : access constant x86_64_linux_gnu_bits_time_h.timeval; uu_tz : access constant timezone) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:77 pragma Import (C, settimeofday, "settimeofday"); function adjtime (uu_delta : access constant x86_64_linux_gnu_bits_time_h.timeval; uu_olddelta : access x86_64_linux_gnu_bits_time_h.timeval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:85 pragma Import (C, adjtime, "adjtime"); type uu_itimer_which is (ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF); pragma Convention (C, uu_itimer_which); -- /usr/include/x86_64-linux-gnu/sys/time.h:91 type itimerval is record it_interval : aliased x86_64_linux_gnu_bits_time_h.timeval; -- /usr/include/x86_64-linux-gnu/sys/time.h:110 it_value : aliased x86_64_linux_gnu_bits_time_h.timeval; -- /usr/include/x86_64-linux-gnu/sys/time.h:112 end record; pragma Convention (C_Pass_By_Copy, itimerval); -- /usr/include/x86_64-linux-gnu/sys/time.h:107 subtype uu_itimer_which_t is int; -- /usr/include/x86_64-linux-gnu/sys/time.h:120 function getitimer (uu_which : uu_itimer_which_t; uu_value : access itimerval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:125 pragma Import (C, getitimer, "getitimer"); function setitimer (uu_which : uu_itimer_which_t; uu_new : access constant itimerval; uu_old : access itimerval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:131 pragma Import (C, setitimer, "setitimer"); function utimes (uu_file : Interfaces.C.Strings.chars_ptr; uu_tvp : access constant x86_64_linux_gnu_bits_time_h.timeval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:138 pragma Import (C, utimes, "utimes"); function lutimes (uu_file : Interfaces.C.Strings.chars_ptr; uu_tvp : access constant x86_64_linux_gnu_bits_time_h.timeval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:143 pragma Import (C, lutimes, "lutimes"); function futimes (uu_fd : int; uu_tvp : access constant x86_64_linux_gnu_bits_time_h.timeval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:147 pragma Import (C, futimes, "futimes"); function futimesat (uu_fd : int; uu_file : Interfaces.C.Strings.chars_ptr; uu_tvp : access constant x86_64_linux_gnu_bits_time_h.timeval) return int; -- /usr/include/x86_64-linux-gnu/sys/time.h:154 pragma Import (C, futimesat, "futimesat"); end x86_64_linux_gnu_sys_time_h;
Cubical/DStructures/Structures/Type.agda
Schippmunk/cubical
0
9516
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.DStructures.Structures.Type where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Functions.FunExtEquiv open import Cubical.Foundations.Univalence open import Cubical.Data.Sigma open import Cubical.Data.Unit open import Cubical.Relation.Binary open import Cubical.DStructures.Base open import Cubical.DStructures.Meta.Properties private variable ℓ ℓ' ℓ'' ℓ₁ ℓ₁' ℓ₁'' ℓ₂ ℓA ℓ≅A ℓB ℓ≅B ℓ≅ᴰ ℓP : Level -- a type is a URGStr with the relation given by its identity type 𝒮-type : (A : Type ℓ) → URGStr A ℓ 𝒮-type A = make-𝒮 {_≅_ = _≡_} (λ _ → refl) isContrSingl 𝒮ᴰ-type : {A : Type ℓA} (B : A → Type ℓB) → URGStrᴰ (𝒮-type A) B ℓB 𝒮ᴰ-type {A = A} B = make-𝒮ᴰ (λ b p b' → PathP (λ i → B (p i)) b b') (λ _ → refl) λ _ b → isContrSingl b -- subtypes are displayed structures 𝒮ᴰ-subtype : {A : Type ℓ} (P : A → hProp ℓ') → URGStrᴰ (𝒮-type A) (λ a → P a .fst) ℓ-zero 𝒮ᴰ-subtype P = make-𝒮ᴰ (λ _ _ _ → Unit) (λ _ → tt) λ a p → isContrRespectEquiv (invEquiv (Σ-contractSnd (λ _ → isContrUnit))) (inhProp→isContr p (P a .snd)) -- a subtype induces a URG structure on itself Subtype→Sub-𝒮ᴰ : {A : Type ℓA} (P : A → hProp ℓP) (StrA : URGStr A ℓ≅A) → URGStrᴰ StrA (λ a → P a .fst) ℓ-zero Subtype→Sub-𝒮ᴰ P StrA = make-𝒮ᴰ (λ _ _ _ → Unit) (λ _ → tt) (λ a p → isContrRespectEquiv (invEquiv (Σ-contractSnd (λ _ → isContrUnit))) (inhProp→isContr p (P a .snd))) -- uniqueness of small URG structures private module _ {A : Type ℓA} (𝒮 : URGStr A ℓA) where open URGStr 𝒮' = 𝒮-type A ≅-≡ : _≅_ 𝒮' ≡ _≅_ 𝒮 ≅-≡ = funExt₂ (λ a a' → ua (isUnivalent→isUnivalent' (_≅_ 𝒮) (ρ 𝒮) (uni 𝒮) a a')) ρ-≡ : PathP (λ i → isRefl (≅-≡ i)) (ρ 𝒮') (ρ 𝒮) ρ-≡ = funExt (λ a → toPathP (p a)) where p : (a : A) → transport (λ i → ≅-≡ i a a) refl ≡ (ρ 𝒮 a) p a = uaβ (isUnivalent→isUnivalent' (_≅_ 𝒮) (ρ 𝒮) (uni 𝒮) a a) refl ∙ transportRefl (ρ 𝒮 a) u : (a : A) → (transport (λ i → ≅-≡ i a a) refl) ≡ (subst (λ a' → (_≅_ 𝒮) a a') refl (ρ 𝒮 a)) u a = uaβ (isUnivalent→isUnivalent' (_≅_ 𝒮) (ρ 𝒮) (uni 𝒮) a a) refl uni-≡ : PathP (λ i → isUnivalent (≅-≡ i) (ρ-≡ i)) (uni 𝒮') (uni 𝒮) uni-≡ = isProp→PathP (λ i → isPropΠ2 (λ a a' → isPropIsEquiv (≡→R (≅-≡ i) (ρ-≡ i)))) (uni 𝒮') (uni 𝒮) 𝒮-uniqueness : (A : Type ℓA) → isContr (URGStr A ℓA) 𝒮-uniqueness A .fst = 𝒮-type A 𝒮-uniqueness A .snd 𝒮 = sym (η-URGStr (𝒮-type A)) ∙∙ (λ i → p i) ∙∙ η-URGStr 𝒮 where p = λ (i : I) → urgstr (≅-≡ 𝒮 i) (ρ-≡ 𝒮 i) (uni-≡ 𝒮 i)
demo/adainclude/memory_set.ads
e3l6/SSMDev
0
623
with System; use System; with Interfaces.C; use Interfaces.C; package Memory_Set is pragma Preelaborate; function Memset (M : Address; C : int; Size : size_t) return Address; pragma Export (C, Memset, "memset"); -- This function stores C converted to a Character in each of the elements -- of the array of Characters beginning at M, with size Size. It returns a -- pointer to M. end Memory_Set;
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/u32tofreg.asm
gb-archive/really-old-stuff
10
175062
<reponame>gb-archive/really-old-stuff #include once <neg32.asm> __I8TOFREG: ld l, a rlca sbc a, a ; A = SGN(A) ld h, a ld e, a ld d, a __I32TOFREG: ; Converts a 32bit signed integer (stored in DEHL) ; to a Floating Point Number returned in (A ED CB) ld a, d or a ; Test sign jp p, __U32TOFREG ; It was positive, proceed as 32bit unsigned call __NEG32 ; Convert it to positive call __U32TOFREG ; Convert it to Floating point set 7, e ; Put the sign bit (negative) in the 31bit of mantissa ret __U8TOFREG: ; Converts an unsigned 8 bit (A) to Floating point ld l, a ld h, 0 ld e, h ld d, h __U32TOFREG: ; Converts an unsigned 32 bit integer (DEHL) ; to a Floating point number returned in A ED CB PROC LOCAL __U32TOFREG_END ld a, d or e or h or l ld b, d ld c, e ; Returns 00 0000 0000 if ZERO ret z push de push hl exx pop de ; Loads integer into B'C' D'E' pop bc exx ld l, 128 ; Exponent ld bc, 0 ; DEBC = 0 ld d, b ld e, c __U32TOFREG_LOOP: ; Also an entry point for __F16TOFREG exx ld a, d ; B'C'D'E' == 0 ? or e or b or c jp z, __U32TOFREG_END ; We are done srl b ; Shift B'C' D'E' >> 1, output bit stays in Carry rr c rr d rr e exx rr e ; Shift EDCB >> 1, inserting the carry on the left rr d rr c rr b inc l ; Increment exponent jp __U32TOFREG_LOOP __U32TOFREG_END: exx ld a, l ; Puts the exponent in a res 7, e ; Sets the sign bit to 0 (positive) ret ENDP
src/main.asm
daullmer/tic-tac-toe
1
162652
.data # 1 = X 2 = O board: .word 0 0 0 0 0 0 0 0 0 win_x: .string "X's Win!\n\n" win_o: .string "O's win!\n\n" tie: .string "Tie!\n\n" .text ####### # MAIN METHOD ####### main: jal draw_start # stores gamemode selector in s9 # 0=>1 Player Mode 1=>2 Player Mode mv s9, a4 li a4, 0 addi s9, s9, -1 # Board aufbauen jal draw_board # initialize current player with 1 (=X) li t0, 1 # initialize number of tries to 9 li t1, 9 ## constants form player change li s10, 1 li s11, 2 game_loop: la a0, board # draw x or o on board beq t0, s10, dr_x beq t0, s11, dr_o draw_return: # after drawing on display continue here # save input to array la a1, board # array start address mv a2, a3 # cell number from input mv a3, t0 # current player jal store_in_array # check if someone won la a0, board # array start address jal checkGameOutcome beq a0, s10, winner_X beq a0, s11, winner_O # remove one try addi t1, t1, -1 # switch current player beq t0, s10, to_player2 # if current player is 1 and next player should be 2, jump addi t0, t0, -1 # change from player 2 to player 1 # jump back to game_loop of we still have tries left game_loop.end: bnez t1, game_loop # Maximale Anzahl an Spielzügen erreicht --> Unentschieden! j winner_tie ### switch to player 2 to_player2: addi t0, t0, 1 j game_loop.end dr_x: jal select_field jal draw_x j draw_return dr_o: ## wenn 1 player mode (s9=0) Zug nicht von Konsole sondern von AI beqz s9, dr_AI jal select_field jal draw_o j draw_return dr_AI: jal getBlockingMove ## check if getBlockingMove returned 999 and no move can be blocked right now li t2, 999 beq s5, t2, call.random_ai mv a0, s5 j continue call.random_ai: jal random_ai continue: # store a0 in stack addi sp, sp, -4 sw a0, 0(sp) # restore original a0 from stack lw a0, 0(sp) # convert cell to coordinates and draw on screen jal cell_to_coordinates jal draw_o # restore original a0 from stack to a3 (the instructions at draw_return expect the cell at a3) lw a3, 0(sp) addi sp, sp, 4 j draw_return #### Ausgabe am Ende winner_X: la a0, win_x li a7, 4 ecall jal winner.x j exit winner_O: la a0, win_o li a7, 4 ecall jal winner.o j exit winner_tie: la a0, tie li a7, 4 ecall jal tiescreen j exit ## Programm mit Exit Code 0 beenden exit: li a7, 10 ecall .include "libs/cesplib_rars.asm" .include "draw/draw_pixel.asm" .include "draw/draw_board.asm" .include "store_in_array.asm" .include "select_field.asm" .include "draw/draw_X.asm" .include "draw/winnerscreen.asm" .include "draw/draw_O.asm" .include "check_end_game.asm" .include "draw/tiescreen.asm" .include "sound_optimized.asm" .include "draw/draw_winnerscreen.asm" .include "draw/draw_blackscreen.asm" .include "random_AI.asm" .include "ai.asm" .include "draw/draw_lines.asm" .include "draw/draw_startscreen.asm"
programs/oeis/048/A048497.asm
jmorken/loda
1
20399
; A048497: a(n) = 2^(n-1)*(4*n - 6) + 4. ; 1,2,8,28,84,228,580,1412,3332,7684,17412,38916,86020,188420,409604,884740,1900548,4063236,8650756,18350084,38797316,81788932,171966468,360710148,754974724,1577058308,3288334340,6845104132,14227079172,29527900164,61203283972,126701535236,261993005060,541165879300,1116691496964,2302102470660,4741643894788,9758165696516,20066087206916,41231686041604,84662395338756,173722837188612,356241767399428,730075720843268,1495335813775364,3061040371728388,6262818231812100 mov $2,$0 sub $0,3 add $0,$2 mov $1,2 mov $3,2 pow $3,$2 mov $4,$3 mov $3,0 lpb $0 add $3,120 mul $4,$0 mov $0,0 add $4,$3 add $1,$4 lpe sub $1,118
disorderly/binary_rank.adb
jscparker/math_packages
30
28643
<reponame>jscparker/math_packages ----------------------------------------------------------------------- -- package body Binary_Rank, routines for Marsaglia's Rank Test. -- Copyright (C) 1995-2018 <NAME> -- -- Permission to use, copy, modify, and/or distribute this software 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. ------------------------------------------------------------------------------- package body Binary_Rank is -------------- -- Get_Rank -- -------------- procedure Get_Rank (r : in out Binary_Matrix; Max_Row : in Matrix_Index; Max_Col : in Matrix_Index; Rank : out Integer) is tmp : Vector; j : Matrix_Index := Max_Col; -- essential init. i : Matrix_Index := Matrix_Index'First; -- essential init. ----------------------------- -- Vector_has_a_1_at_Index -- ----------------------------- function Vector_has_a_1_at_Index (j : Matrix_Index; V : Vector) return Boolean is Result : Boolean := False; Segment_id : Segments; Bit_id : Matrix_Index; begin Segment_id := 1 + (j-1) / Bits_per_Segment; Bit_id := 1 + (j-1) - (Segment_id-1) * Bits_per_Segment; if (V(Segment_id) AND Bit_is_1_at(Bit_id)) > 0 then Result := True; end if; return Result; end; begin Rank := 0; <<Reduce_Matrix_Rank_by_1>> -- Start at row i, the current row. -- Find row ii = i, i+1, ... that has a 1 in column j. -- Then move this row to position i. (Swap ii with i.) -- Reduce rank of matrix by 1 (by xor'ing row(i) with succeeding rows). -- Increment i, Decrement j. -- Repeat until no more i's or j's left. Row_Finder: for ii in i .. Max_Row loop if Vector_has_a_1_at_Index (j, r(ii)) then Rank := Rank + 1; if i /= ii then tmp := r(ii); r(ii) := r(i); r(i) := tmp; end if; for k in i+1 .. Max_Row loop if Vector_has_a_1_at_Index (j, r(k)) then for Seg_id in Segments loop r(k)(Seg_id) := r(k)(Seg_id) XOR r(i)(Seg_id); end loop; end if; end loop; if i = Max_Row then return; end if; i := i + 1; if j = Matrix_Index'First then return; end if; j := j - 1; goto Reduce_Matrix_Rank_by_1; end if; end loop Row_Finder; -- ii loop if j = Matrix_Index'First then return; end if; j := j - 1; goto Reduce_Matrix_Rank_by_1; end Get_Rank; end Binary_Rank;
source/numerics/generic/a-nudsge.adb
ytomino/drake
33
8713
<filename>source/numerics/generic/a-nudsge.adb package body Ada.Numerics.dSFMT.Generating is -- no SIMD version use type Interfaces.Unsigned_64; procedure do_recursion ( r : aliased out w128_t; a, b : aliased w128_t; lung : aliased in out w128_t) is t0, t1, L0, L1 : Unsigned_64; begin t0 := a (0); t1 := a (1); L0 := lung (0); L1 := lung (1); lung (0) := Interfaces.Shift_Left (t0, SL1) xor Interfaces.Shift_Right (L1, 32) xor Interfaces.Shift_Left (L1, 32) xor b (0); lung (1) := Interfaces.Shift_Left (t1, SL1) xor Interfaces.Shift_Right (L0, 32) xor Interfaces.Shift_Left (L0, 32) xor b (1); r (0) := Interfaces.Shift_Right (lung (0), SR) xor (lung (0) and MSK1) xor t0; r (1) := Interfaces.Shift_Right (lung (1), SR) xor (lung (1) and MSK2) xor t1; end do_recursion; procedure convert_c0o1 (w : aliased in out w128_t) is d : Long_Float_Array (0 .. 1); for d'Address use w'Address; begin d (0) := d (0) - 1.0; d (1) := d (1) - 1.0; end convert_c0o1; procedure convert_o0c1 (w : aliased in out w128_t) is d : Long_Float_Array (0 .. 1); for d'Address use w'Address; begin d (0) := 2.0 - d (0); d (1) := 2.0 - d (1); end convert_o0c1; procedure convert_o0o1 (w : aliased in out w128_t) is d : Long_Float_Array (0 .. 1); for d'Address use w'Address; begin w (0) := w (0) or 1; w (1) := w (1) or 1; d (0) := d (0) - 1.0; d (1) := d (1) - 1.0; end convert_o0o1; end Ada.Numerics.dSFMT.Generating;
programs/oeis/078/A078881.asm
neoneye/loda
22
16046
<filename>programs/oeis/078/A078881.asm ; A078881: Size of the largest subset S of {1,2,3,...,n} with the property that if i and j are distinct elements of S then i XOR j is not in S, where XOR is the bitwise exclusive-OR operator. ; 1,2,2,3,4,4,4,5,6,7,8,8,8,8,8,9,10,11,12,13,14,15,16,16,16,16,16,16,16,16,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,33,34,35,36,37,38,39,40,41,42,43,44 lpb $0 mov $2,$0 sub $0,1 trn $0,$1 sub $2,$0 trn $0,$2 add $1,$2 lpe add $1,1 mov $0,$1
third-party/gmp/gmp-src/mpn/x86_64/mod_1_2.asm
jhh67/chapel
1,602
197
dnl AMD64 mpn_mod_1s_2p dnl Contributed to the GNU project by <NAME>. dnl Copyright 2009-2012, 2014 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C AMD K8,K9 4 C AMD K10 4 C Intel P4 19 C Intel core2 8 C Intel NHM 6.5 C Intel SBR 4.5 C Intel atom 28 C VIA nano 8 ABI_SUPPORT(DOS64) ABI_SUPPORT(STD64) ASM_START() TEXT ALIGN(16) PROLOGUE(mpn_mod_1s_2p) FUNC_ENTRY(4) push %r14 test $1, R8(%rsi) mov %rdx, %r14 push %r13 mov %rcx, %r13 push %r12 push %rbp push %rbx mov 16(%rcx), %r10 mov 24(%rcx), %rbx mov 32(%rcx), %rbp je L(b0) dec %rsi je L(one) mov -8(%rdi,%rsi,8), %rax mul %r10 mov %rax, %r9 mov %rdx, %r8 mov (%rdi,%rsi,8), %rax add -16(%rdi,%rsi,8), %r9 adc $0, %r8 mul %rbx add %rax, %r9 adc %rdx, %r8 jmp L(11) L(b0): mov -8(%rdi,%rsi,8), %r8 mov -16(%rdi,%rsi,8), %r9 L(11): sub $4, %rsi jb L(ed2) lea 40(%rdi,%rsi,8), %rdi mov -40(%rdi), %r11 mov -32(%rdi), %rax jmp L(m0) ALIGN(16) L(top): mov -24(%rdi), %r9 add %rax, %r11 mov -16(%rdi), %rax adc %rdx, %r12 mul %r10 add %rax, %r9 mov %r11, %rax mov %rdx, %r8 adc $0, %r8 mul %rbx add %rax, %r9 mov %r12, %rax adc %rdx, %r8 mul %rbp sub $2, %rsi jb L(ed1) mov -40(%rdi), %r11 add %rax, %r9 mov -32(%rdi), %rax adc %rdx, %r8 L(m0): mul %r10 add %rax, %r11 mov %r9, %rax mov %rdx, %r12 adc $0, %r12 mul %rbx add %rax, %r11 lea -32(%rdi), %rdi C ap -= 4 mov %r8, %rax adc %rdx, %r12 mul %rbp sub $2, %rsi jae L(top) L(ed0): mov %r11, %r9 mov %r12, %r8 L(ed1): add %rax, %r9 adc %rdx, %r8 L(ed2): mov 8(%r13), R32(%rdi) C cnt mov %r8, %rax mov %r9, %r8 mul %r10 add %rax, %r8 adc $0, %rdx L(1): xor R32(%rcx), R32(%rcx) mov %r8, %r9 sub R32(%rdi), R32(%rcx) shr R8(%rcx), %r9 mov R32(%rdi), R32(%rcx) sal R8(%rcx), %rdx or %rdx, %r9 sal R8(%rcx), %r8 mov %r9, %rax mulq (%r13) mov %rax, %rsi inc %r9 add %r8, %rsi adc %r9, %rdx imul %r14, %rdx sub %rdx, %r8 lea (%r8,%r14), %rax cmp %r8, %rsi cmovc %rax, %r8 mov %r8, %rax sub %r14, %rax cmovc %r8, %rax mov R32(%rdi), R32(%rcx) shr R8(%rcx), %rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 FUNC_EXIT() ret L(one): mov (%rdi), %r8 mov 8(%rcx), R32(%rdi) xor %rdx, %rdx jmp L(1) EPILOGUE() ALIGN(16) PROLOGUE(mpn_mod_1s_2p_cps) FUNC_ENTRY(2) push %rbp bsr %rsi, %rcx push %rbx mov %rdi, %rbx push %r12 xor $63, R32(%rcx) mov %rsi, %r12 mov R32(%rcx), R32(%rbp) C preserve cnt over call sal R8(%rcx), %r12 C b << cnt IFSTD(` mov %r12, %rdi ') C pass parameter IFDOS(` mov %r12, %rcx ') C pass parameter IFDOS(` sub $32, %rsp ') ASSERT(nz, `test $15, %rsp') CALL( mpn_invert_limb) IFDOS(` add $32, %rsp ') mov %r12, %r8 mov %rax, %r11 mov %rax, (%rbx) C store bi mov %rbp, 8(%rbx) C store cnt neg %r8 mov R32(%rbp), R32(%rcx) mov $1, R32(%rsi) ifdef(`SHLD_SLOW',` shl R8(%rcx), %rsi neg R32(%rcx) mov %rax, %rbp shr R8(%rcx), %rax or %rax, %rsi mov %rbp, %rax neg R32(%rcx) ',` shld R8(%rcx), %rax, %rsi C FIXME: Slow on Atom and Nano ') imul %r8, %rsi mul %rsi add %rsi, %rdx shr R8(%rcx), %rsi mov %rsi, 16(%rbx) C store B1modb not %rdx imul %r12, %rdx lea (%rdx,%r12), %rsi cmp %rdx, %rax cmovnc %rdx, %rsi mov %r11, %rax mul %rsi add %rsi, %rdx shr R8(%rcx), %rsi mov %rsi, 24(%rbx) C store B2modb not %rdx imul %r12, %rdx add %rdx, %r12 cmp %rdx, %rax cmovnc %rdx, %r12 shr R8(%rcx), %r12 mov %r12, 32(%rbx) C store B3modb pop %r12 pop %rbx pop %rbp FUNC_EXIT() ret EPILOGUE()
source/program_structure/adam-program_unit.adb
charlie5/aIDE
3
21771
package body AdaM.program_Unit is procedure dummy is begin null; end dummy; end AdaM.program_Unit;
demo/tutorial/components-destructibles.adb
csb6/libtcod-ada
0
30663
with Actors, Engines, Libtcod.Color; use Libtcod; package body Components.Destructibles is ------------- -- is_dead -- ------------- function is_dead(self : Destructible) return Boolean is (self.hp = 0); ----------------- -- take_damage -- ----------------- function take_damage(self : in out Destructible'Class; owner : in out Actors.Actor; damage : Health; engine : in out Engines.Engine) return Health is real_damage : Health; begin if Health(self.defense_stat) > damage then real_damage := 0; else real_damage := damage - Health(self.defense_stat); if real_damage >= self.hp then self.hp := 0; self.die(owner, engine); else self.hp := self.hp - real_damage; end if; end if; return real_damage; end take_damage; --------- -- die -- --------- procedure die(self : in out Destructible; owner : in out Actors.Actor; engine : in out Engines.Engine) is begin owner.ch := '%'; owner.color := Color.dark_red; owner.blocks := False; end die; --------- -- die -- --------- overriding procedure die(self : in out Monster_Destructible; owner : in out Actors.Actor; engine : in out Engines.Engine) is begin engine.gui.log(owner.get_name & " is dead"); die(Destructible(self), owner, engine); end die; --------- -- die -- --------- overriding procedure die(self : in out Player_Destructible; owner : in out Actors.Actor; engine : in out Engines.Engine) is begin engine.gui.log("You died", Color.red); die(Destructible(self), owner, engine); engine.status := Engines.Status_Defeat; end die; end Components.Destructibles;
base/boot/lib/i386/pae.asm
npocmaka/Windows-Server-2003
17
90203
;++ ; ;Copyright (c) 1998 Microsoft Corporation ; ;Module Name: ; ; pae.asm ; ;Abstract: ; ; Contains routines to aid in enabling PAE mode. ; ;Author: ; ; <NAME> (forrestf) 12-28-98 ; ; ;Revision History: ; ;-- .586p .xlist include ks386.inc .list _TEXT SEGMENT PARA PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING EFLAGS_ID equ 200000h ;++ ; ; BOOLEAN ; BlpPaeSupported ( ; VOID ; ) ; ; Routine Description: ; ; This routine determines whether the CPU supports PAE mode ; ; Arguments: ; ; None. ; ; Return value: ; ; al == 1 if the CPU does support PAE mode. ; al == 0 if not. ; ;-- public _BlpPaeSupported@0 _BlpPaeSupported@0 proc ; ; First determine whether the CPUID instruction is supported. If ; the EFLAGS_ID bit "sticks" when stored in the flags register, then ; the CPUID instruction is supported. ; mov ecx, EFLAGS_ID pushfd pop eax ; eax == flags xor ecx, eax ; ecx == flags ^ EFLAGS_ID push ecx popfd ; load new flags pushfd pop ecx ; ecx == result of flag load xor eax, ecx ; Q: did the EFLAGS_ID bit stick? jz done ; N: CPUID is not available ; ; We can use the CPUID instruction. ; push ebx ; CPUID steps on eax, ebx, ecx, edx mov eax, 1 cpuid pop ebx ; ; edx contains the feature bits. Bit 6 is the PAE extensions flag. ; sub eax, eax ; assume not set test dl, 40h ; Q: bit 6 set? jz done ; N: return with eax == 0 inc eax ; Y: set eax == 1 done: ret _BlpPaeSupported@0 endp ;++ ; ; VOID ; BlSetPae ( ; IN ULONG IdentityAddress, ; IN ULONG PaeCr3 ; ) ; ; Routine Description: ; ; Arguments: ; ; Return ; ;-- public _BlpEnablePAE@4 _BlpEnablePAE@4 proc public _BlpEnablePAEStart _BlpEnablePAEStart label dword ; ; Load PDPT address ; mov edx, [esp]+4 ; ; Do this to set the state machine in motion ; mov ecx, cr3 mov cr3, ecx ; ; Disable paging ; mov eax, cr0 and eax, NOT CR0_PG mov cr0, eax jmp $+2 ; ; Enable physical address extensions ; mov eax, cr4 or eax, CR4_PAE ; ; The following instruction was necessary in order to boot some ; machines. Probably due to an errata. ; mov ecx, cr3 mov cr4, eax ; ; Point cr3 to the page directory pointer table ; mov cr3, edx ; ; Enable paging ; mov ecx, cr0 or ecx, CR0_PG mov cr0, ecx jmp $+2 ; ; Clean the stack and return ; ret 4 public _BlpEnablePAEEnd _BlpEnablePAEEnd label dword _BlpEnablePAE@4 endp _TEXT ends end
alloy4fun_models/trashltl/models/11/Bq7eFS6G5zPfmQCR9.als
Kaixi26/org.alloytools.alloy
0
3202
<reponame>Kaixi26/org.alloytools.alloy<gh_stars>0 open main pred idBq7eFS6G5zPfmQCR9_prop12 { eventually some f : Trash | after eventually f not in Trash } pred __repair { idBq7eFS6G5zPfmQCR9_prop12 } check __repair { idBq7eFS6G5zPfmQCR9_prop12 <=> prop12o }
test/Fail/Issue1946-5.agda
shlevy/agda
0
7095
-- This test case was reported by <NAME>. {-# OPTIONS --no-guardedness #-} open import Agda.Builtin.Size data Σ (A : Set) (B : A → Set) : Set where _,_ : (x : A) → B x → Σ A B data ⊥ : Set where record T (i : Size) : Set where constructor con coinductive field force : Σ (Size< i) λ{ j → T j } open T public empty : ∀ i → T i → ⊥ empty i x with force x ... | j , y = empty j y inh : T ∞ inh = λ{ .force → ∞ , inh } -- using ∞ < ∞ here false : ⊥ false = empty ∞ inh
_maps/obj18syz.asm
NatsumiFox/AMPS-Sonic-1-2005
2
161912
<gh_stars>1-10 ; --------------------------------------------------------------------------- ; Sprite mappings - SYZ platforms ; --------------------------------------------------------------------------- dc.w byte_818A-Map_obj18a byte_818A: dc.b 3 dc.b $F6, $B, 0, $49, $E0 dc.b $F6, 7, 0, $51, $F8 dc.b $F6, $B, 0, $55, 8 even
AppleScript/Extras/Text Utility/Trim.applescript
rightontron/coteditor-SampleScripts
24
247
<reponame>rightontron/coteditor-SampleScripts (* Trim.applescript Sample Script for CotEditor Description: Remove whitespaces at the begin/end of the frontmost document. written by nakamuxu on 2008-01-05 modified by 1024jp on 2014-2015 *) -- tell application "CotEditor" if not (exists front document) then return tell front document replace for "^ +" to "" with RE and all replace for " +$" to "" with RE and all end tell end tell
programs/oeis/308/A308720.asm
neoneye/loda
22
178067
<gh_stars>10-100 ; A308720: The maximum value in the continued fraction of sqrt(n), or 0 if there is no fractional part. ; 0,0,2,2,0,4,4,4,4,0,6,6,6,6,6,6,0,8,8,8,8,8,8,8,8,0,10,10,10,10,10,10,10,10,10,10,0,12,12,12,12,12,12,12,12,12,12,12,12,0,14,14,14,14,14,14,14,14,14,14,14,14,14,14,0,16,16,16,16,16,16,16 lpb $0 mov $2,$0 sub $0,1 sub $0,$1 add $1,2 add $2,1 mod $1,$2 lpe mov $0,$1
programs/oeis/004/A004757.asm
jmorken/loda
1
82192
<reponame>jmorken/loda ; A004757: Binary expansion starts 101. ; 5,10,11,20,21,22,23,40,41,42,43,44,45,46,47,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762 mov $2,$0 lpb $0 sub $0,1 div $0,2 div $1,2 mul $1,4 add $1,4 lpe add $1,5 add $1,$2
src/search-documents.adb
stcarrez/ada-search
9
10727
<reponame>stcarrez/ada-search ----------------------------------------------------------------------- -- search-documents -- Documents indexed by the search engine -- Copyright (C) 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Search.Fields; package body Search.Documents is -- ------------------------------ -- Add the field to the document. -- ------------------------------ procedure Add_Field (Document : in out Document_Type; Field : in Search.Fields.Field_Type) is begin Document.Fields.Append (Field); end Add_Field; -- ------------------------------ -- Create and add the field to the document. -- ------------------------------ procedure Add_Field (Document : in out Document_Type; Name : in String; Value : in String; Kind : in Search.Fields.Field_Kind) is begin Document.Fields.Append (Search.Fields.Create (Name, Value, Kind)); end Add_Field; -- ------------------------------ -- Get the field identified by the given name. -- ------------------------------ function Get_Field (Document : in Document_Type; Name : in String) return Search.Fields.Field_Type is begin for Field of Document.Fields loop if Search.Fields.Get_Name (Field) = Name then return Field; end if; end loop; raise Field_Not_Found; end Get_Field; -- ------------------------------ -- Returns True if the document contains the give named field. -- ------------------------------ function Has_Field (Document : in Document_Type; Name : in String) return Boolean is begin for Field of Document.Fields loop if Search.Fields.Get_Name (Field) = Name then return True; end if; end loop; return False; end Has_Field; -- ------------------------------ -- Iterate over the document fields. -- ------------------------------ procedure Iterate (Document : in Document_Type; Process : not null access procedure (Field : in Search.Fields.Field_Type)) is begin for Field of Document.Fields loop Process (Field); end loop; end Iterate; end Search.Documents;
Driver/IFS/DOS/Common/dosConvertEUC.asm
steakknife/pcgeos
504
6743
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1994 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: dosConvertEUC.asm AUTHOR: <NAME>, May 10, 1994 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial revision DESCRIPTION: Code for EUC support. EUC Code Set 4 is not currently supported. $Id: dosConvertEUC.asm,v 1.1 97/04/10 11:55:11 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource DosEUCToGeosChar proc near call DosEUCToGeosCharFar ret DosEUCToGeosChar endp GeosToDosEUCChar proc near call GeosToDosEUCCharFar ret GeosToDosEUCChar endp DosEUCToGeosCharString proc near call DosEUCToGeosCharStringFar ret DosEUCToGeosCharString endp GeosToDosEUCCharString proc near call GeosToDosEUCCharStringFar ret GeosToDosEUCCharString endp Resident ends ConvertRare segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConvEUCToJIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a EUC char to a JIS char CALLED BY: DosEUCToGeosCharFar PASS: ax - EUC character RETURN: carry set on error ah - 0 al - DTGSS_INVALID_CHARACTER else ax - JIS character DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: simply subtract 0x80 from both bytes. This means un-setting the high bits of both bytes. REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConvEUCToJIS proc near ; ; test the high byte first ; test ah, HIGH_BIT_MASK ;high bit must be set jz notEUCChar ; ; convert the high byte ; and ah, not HIGH_BIT_MASK ;clear high bit & carry test al, HIGH_BIT_MASK ;high bit must be set jz notEUCChar ; ; convert the low byte ; and al, not HIGH_BIT_MASK ;clear high bit & carry done: ret notEUCChar: mov ax, DTGSS_INVALID_CHARACTER or (0 shl 8) stc jmp done ConvEUCToJIS endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConvJISToEUC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a JIS char to a EUC char CALLED BY: GeosToDosEUCCharFar, GeosToDosEUCCharStringFar PASS: ax - JIS character RETURN: carry set on error ah - 0 al - DTGSS_INVALID_CHARACTER else ax - EUC character DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: simply add 0x80 to both bytes. This means setting the high bits of both bytes. REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConvJISToEUC proc near ; ;test high byte first ; test ah, HIGH_BIT_MASK ;high bit must be clear jnz notJISChar ; ; convert the high byte ; or ah, HIGH_BIT_MASK ;set high bit & clear carry test al, HIGH_BIT_MASK ;high bit must be clear jnz notJISChar ; ; convert the low byte ; or al, HIGH_BIT_MASK ;set high bit & clear carry done: ret notJISChar: mov ax, DTGSS_INVALID_CHARACTER or (0 shl 8) stc ;error -- not a JIS char jmp done ConvJISToEUC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DosEUCToGeosCharFar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a EUC character to a GEOS character CALLED BY: DCSConvertToDOSChar() PASS: bx - DosCodePage to use ax - EUC character RETURN: carry - set if error ah - 0 al - DTGSS_SUBSTITUTIONS or al - DTGSS_INVALID_CHARACTER else: ax - GEOS character DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DosEUCToGeosCharFar proc far .enter ; ; If Half-width Katakana, then JIS is same as EUC value ; tst ah ;is double byte? jnz notHalfWidthKatakanaOrAscii cmp al, EUC_CODE_SET_2_END jbe halfWidthKatakanaOrAscii notHalfWidthKatakanaOrAscii: ; ; Convert the EUC character to JIS ; call ConvEUCToJIS jc done halfWidthKatakanaOrAscii: ; ; Convert the JIS character to SJIS ; call ConvJISToSJIS jc done ; ; Convert the SJIS character to GEOS ; call DosSJISToGeosCharFar done: .leave ret DosEUCToGeosCharFar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GeosToDosEUCCharFar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a GEOS character to an EUC character. CALLED BY: DCSConvertToGEOSChar() PASS: bx - DosCodePage to use ax - GEOS character RETURN: carry - set if error ah - 0 al - DTGSS_SUBSTITUTIONS else: ax - EUC character DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GeosToDosEUCCharFar proc far .enter ; ; Convert the GEOS character to SJIS ; call GeosToDosSJISCharFar jc done ; ; Convert the SJIS character to JIS ; call ConvSJISToJIS jc done ; ; Convert the JIS character to EUC ; tst ah ;is Ascii or HW-Katakana? jz done call ConvJISToEUC done: .leave ret GeosToDosEUCCharFar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DosEUCToGeosCharStringFar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a EUC character in a string to a GEOS character CALLED BY: DCSConvertToGEOSChar() PASS: bx - DosCodePage to use ds:si - ptr to EUC string es:di - ptr to GEOS buffer cx - max # of bytes to read RETURN: carry - set if error ah - 0 al - DTGSS_INVALID_CHARACTER ah - # of bytes to back up al - DTGSS_CHARACTER_INCOMPLETE else: ax - GEOS character ds:si - ptr to next character es:di - ptr to next character cx - updated if >1 byte read DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DosEUCToGeosCharStringFar proc far .enter ; ; Get a byte and see which code set it lies in ; lodsb ;al <- byte of EUC string cmp al, EUC_SS2_CHAR ;single shift char? je doHalfWidthKatakana ;in CODE SET 2 cmp al, EUC_CODE_SET_0_START jb illegalChar ;out of range cmp al, EUC_CODE_SET_0_END jbe doAsciiJISRoman ;in CODE SET 0 cmp al, EUC_CODE_SET_1_START jb illegalChar ;out of range cmp al, EUC_CODE_SET_1_END ja illegalChar ; in CODE SET 1 -- JIS ; We have first of two bytes, read the second then convert. doJISChar: call readDBCSByte2 jz partialChar ; We have both bytes. Do the conversion and check for error. call DosEUCToGeosCharFar jc exit storeChar: stosw exit: .leave ret ; ; Read first byte of a two byte character, but rest ; is not there to read. ; partialChar: mov ax, DTGSS_CHARACTER_INCOMPLETE or (1 shl 8) stc ;carry <- error jmp exit ;couldn't convert ; We have read the Single Shift char. Read next byte into al, ; clear high byte, then convert. doHalfWidthKatakana: clr al ;will be xchnged to ah jmp doJISChar ;store it/no convert doAsciiJISRoman: clr ah jmp storeChar readDBCSByte2: dec cx ;cx <- read one more byte jz isPartialChar ;branch if no more bytes xchg al, ah lodsb ;ax <- JIS character isPartialChar: retn illegalChar: stc mov ax, DTGSS_INVALID_CHARACTER or (0 shl 8) jmp exit DosEUCToGeosCharStringFar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GeosToDosEUCCharStringFar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a GEOS character in a string to a EUC character CALLED BY: DCSConvertToGEOSChar() PASS: bx - DosCodePage to use ds:si - ptr to GEOS string es:di - ptr to EUC buffer cx - max # of chars to read RETURN: carry - set if error ah - 0 al - DTGSS_SUBSTITUTIONS else: ax - EUC character ds:si - ptr to next character es:di - ptr to next character DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 05/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GeosToDosEUCCharStringFar proc far uses bx .enter ; ; Get a GEOS character and convert to JIS ; lodsw ;ax <- GEOS character call GeosToDosJISCharFar jc exit ;branch if error ; ; Check for ASCII / SBCS ; tst ah ;SBCS or DBCS? jz isSBCS ;branch if SBCS ; ; DBCS char -- convert to EUC then store ; call ConvJISToEUC jc exit xchg al, ah ;store high-low stosw ;store DBCS character done: clc ;carry <- no error exit: .leave ret isSBCS: ; ; SB -- ASCII or Half-width Katakana char ; cmp al, EUC_CODE_SET_0_START jb illegalChar cmp al, EUC_CODE_SET_0_END jbe storeSBCSChar ;is Ascii/JIS Roman? cmp al, EUC_CODE_SET_2_START jb illegalChar cmp al, EUC_CODE_SET_2_END ja illegalChar ; ; Half-width Katakana character. Store Single Shift char + byte ; mov bx, EUC_SS2_CHAR ;Single Shift 2 call writeSingleShift storeSBCSChar: stosb ;store SBCS character jmp done writeSingleShift: push ax ;save current char mov_tr al, bl ;al <- single shift char stosb pop ax ;ax <- current char retn illegalChar: mov ax, DTGSS_SUBSTITUTIONS or (0 shl 8) stc jmp exit GeosToDosEUCCharStringFar endp ConvertRare ends
tools-src/gnu/gcc/gcc/ada/errout.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
1733
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E R R O U T -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 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, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Warning! Error messages can be generated during Gigi processing by direct -- calls to error message routines, so it is essential that the processing -- in this body be consistent with the requirements for the Gigi processing -- environment, and that in particular, no disallowed table expansion is -- allowed to occur. with Atree; use Atree; with Casing; use Casing; with Csets; use Csets; with Debug; use Debug; with Einfo; use Einfo; with Fname; use Fname; with Hostparm; with Lib; use Lib; with Namet; use Namet; with Opt; use Opt; with Output; use Output; with Scans; use Scans; with Sinput; use Sinput; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Style; with Uintp; use Uintp; with Uname; use Uname; package body Errout is Class_Flag : Boolean := False; -- This flag is set True when outputting a reference to a class-wide -- type, and is used by Add_Class to insert 'Class at the proper point Continuation : Boolean; -- Indicates if current message is a continuation. Initialized from the -- Msg_Cont parameter in Error_Msg_Internal and then set True if a \ -- insertion character is encountered. Cur_Msg : Error_Msg_Id; -- Id of most recently posted error message Flag_Source : Source_File_Index; -- Source file index for source file where error is being posted Is_Warning_Msg : Boolean; -- Set by Set_Msg_Text to indicate if current message is warning message Is_Unconditional_Msg : Boolean; -- Set by Set_Msg_Text to indicate if current message is unconditional Kill_Message : Boolean; -- A flag used to kill weird messages (e.g. those containing uninterpreted -- implicit type references) if we have already seen at least one message -- already. The idea is that we hope the weird message is a junk cascaded -- message that should be suppressed. Last_Killed : Boolean := False; -- Set True if the most recently posted non-continuation message was -- killed. This is used to determine the processing of any continuation -- messages that follow. List_Pragmas_Index : Int; -- Index into List_Pragmas table List_Pragmas_Mode : Boolean; -- Starts True, gets set False by pragma List (Off), True by List (On) Manual_Quote_Mode : Boolean; -- Set True in manual quotation mode Max_Msg_Length : constant := 80 + 2 * Hostparm.Max_Line_Length; -- Maximum length of error message. The addition of Max_Line_Length -- ensures that two insertion tokens of maximum length can be accomodated. Msg_Buffer : String (1 .. Max_Msg_Length); -- Buffer used to prepare error messages Msglen : Integer; -- Number of characters currently stored in the message buffer Suppress_Message : Boolean; -- A flag used to suppress certain obviously redundant messages (i.e. -- those referring to a node whose type is Any_Type). This suppression -- is effective only if All_Errors_Mode is off. Suppress_Instance_Location : Boolean := False; -- Normally, if a # location in a message references a location within -- a generic template, then a note is added giving the location of the -- instantiation. If this variable is set True, then this note is not -- output. This is used for internal processing for the case of an -- illegal instantiation. See Error_Msg routine for further details. ----------------------------------- -- Error Message Data Structures -- ----------------------------------- -- The error messages are stored as a linked list of error message objects -- sorted into ascending order by the source location (Sloc). Each object -- records the text of the message and its source location. -- The following record type and table are used to represent error -- messages, with one entry in the table being allocated for each message. type Error_Msg_Object is record Text : String_Ptr; -- Text of error message, fully expanded with all insertions Next : Error_Msg_Id; -- Pointer to next message in error chain Sfile : Source_File_Index; -- Source table index of source file. In the case of an error that -- refers to a template, always references the original template -- not an instantiation copy. Sptr : Source_Ptr; -- Flag pointer. In the case of an error that refers to a template, -- always references the original template, not an instantiation copy. -- This value is the actual place in the source that the error message -- will be posted. Fptr : Source_Ptr; -- Flag location used in the call to post the error. This is normally -- the same as Sptr, except in the case of instantiations, where it -- is the original flag location value. This may refer to an instance -- when the actual message (and hence Sptr) references the template. Line : Physical_Line_Number; -- Line number for error message Col : Column_Number; -- Column number for error message Warn : Boolean; -- True if warning message (i.e. insertion character ? appeared) Uncond : Boolean; -- True if unconditional message (i.e. insertion character ! appeared) Msg_Cont : Boolean; -- This is used for logical messages that are composed of multiple -- individual messages. For messages that are not part of such a -- group, or that are the first message in such a group. Msg_Cont -- is set to False. For subsequent messages in a group, Msg_Cont -- is set to True. This is used to make sure that such a group of -- messages is either suppressed or retained as a group (e.g. in -- the circuit that deletes identical messages). Deleted : Boolean; -- If this flag is set, the message is not printed. This is used -- in the circuit for deleting duplicate/redundant error messages. end record; package Errors is new Table.Table ( Table_Component_Type => Error_Msg_Object, Table_Index_Type => Error_Msg_Id, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 200, Table_Name => "Error"); Error_Msgs : Error_Msg_Id; -- The list of error messages -------------------------- -- Warning Mode Control -- -------------------------- -- Pragma Warnings allows warnings to be turned off for a specified -- region of code, and the following tabl is the data structure used -- to keep track of these regions. -- It contains pairs of source locations, the first being the start -- location for a warnings off region, and the second being the end -- location. When a pragma Warnings (Off) is encountered, a new entry -- is established extending from the location of the pragma to the -- end of the current source file. A subsequent pragma Warnings (On) -- adjusts the end point of this entry appropriately. -- If all warnings are suppressed by comamnd switch, then there is a -- dummy entry (put there by Errout.Initialize) at the start of the -- table which covers all possible Source_Ptr values. Note that the -- source pointer values in this table always reference the original -- template, not an instantiation copy, in the generic case. type Warnings_Entry is record Start : Source_Ptr; Stop : Source_Ptr; end record; package Warnings is new Table.Table ( Table_Component_Type => Warnings_Entry, Table_Index_Type => Natural, Table_Low_Bound => 1, Table_Initial => 100, Table_Increment => 200, Table_Name => "Warnings"); ----------------------- -- Local Subprograms -- ----------------------- procedure Add_Class; -- Add 'Class to buffer for class wide type case (Class_Flag set) function Buffer_Ends_With (S : String) return Boolean; -- Tests if message buffer ends with given string preceded by a space procedure Buffer_Remove (S : String); -- Removes given string from end of buffer if it is present -- at end of buffer, and preceded by a space. procedure Debug_Output (N : Node_Id); -- Called from Error_Msg_N and Error_Msg_NE to generate line of debug -- output giving node number (of node N) if the debug X switch is set. procedure Check_Duplicate_Message (M1, M2 : Error_Msg_Id); -- This function is passed the Id values of two error messages. If -- either M1 or M2 is a continuation message, or is already deleted, -- the call is ignored. Otherwise a check is made to see if M1 and M2 -- are duplicated or redundant. If so, the message to be deleted and -- all its continuations are marked with the Deleted flag set to True. procedure Error_Msg_Internal (Msg : String; Flag_Location : Source_Ptr; Msg_Cont : Boolean); -- This is like Error_Msg, except that Flag_Location is known not to be -- a location within a instantiation of a generic template. The outer -- level routine, Error_Msg, takes care of dealing with the generic case. -- Msg_Cont is set True to indicate that the message is a continuation of -- a previous message. This means that it must have the same Flag_Location -- as the previous message. procedure Set_Next_Non_Deleted_Msg (E : in out Error_Msg_Id); -- Given a message id, move to next message id, but skip any deleted -- messages, so that this results in E on output being the first non- -- deleted message following the input value of E, or No_Error_Msg if -- the input value of E was either already No_Error_Msg, or was the -- last non-deleted message. function No_Warnings (N : Node_Or_Entity_Id) return Boolean; -- Determines if warnings should be suppressed for the given node function OK_Node (N : Node_Id) return Boolean; -- Determines if a node is an OK node to place an error message on (return -- True) or if the error message should be suppressed (return False). A -- message is suppressed if the node already has an error posted on it, -- or if it refers to an Etype that has an error posted on it, or if -- it references an Entity that has an error posted on it. procedure Output_Error_Msgs (E : in out Error_Msg_Id); -- Output source line, error flag, and text of stored error message and -- all subsequent messages for the same line and unit. On return E is -- set to be one higher than the last message output. procedure Output_Line_Number (L : Logical_Line_Number); -- Output a line number as six digits (with leading zeroes suppressed), -- followed by a period and a blank (note that this is 8 characters which -- means that tabs in the source line will not get messed up). Line numbers -- that match or are less than the last Source_Reference pragma are listed -- as all blanks, avoiding output of junk line numbers. procedure Output_Msg_Text (E : Error_Msg_Id); -- Outputs characters of text in the text of the error message E, excluding -- any final exclamation point. Note that no end of line is output, the -- caller is responsible for adding the end of line. procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean); -- Outputs text of source line L, in file S, together with preceding line -- number, as described above for Output_Line_Number. The Errs parameter -- indicates if there are errors attached to the line, which forces -- listing on, even in the presence of pragma List (Off). function Same_Error (M1, M2 : Error_Msg_Id) return Boolean; -- See if two messages have the same text. Returns true if the text -- of the two messages is identical, or if one of them is the same -- as the other with an appended "instance at xxx" tag. procedure Set_Msg_Blank; -- Sets a single blank in the message if the preceding character is a -- non-blank character other than a left parenthesis. Has no effect if -- manual quote mode is turned on. procedure Set_Msg_Blank_Conditional; -- Sets a single blank in the message if the preceding character is a -- non-blank character other than a left parenthesis or quote. Has no -- effect if manual quote mode is turned on. procedure Set_Msg_Char (C : Character); -- Add a single character to the current message. This routine does not -- check for special insertion characters (they are just treated as text -- characters if they occur). procedure Set_Msg_Insertion_Column; -- Handle column number insertion (@ insertion character) procedure Set_Msg_Insertion_Name; -- Handle name insertion (% insertion character) procedure Set_Msg_Insertion_Line_Number (Loc, Flag : Source_Ptr); -- Handle line number insertion (# insertion character). Loc is the -- location to be referenced, and Flag is the location at which the -- flag is posted (used to determine whether to add "in file xxx") procedure Set_Msg_Insertion_Node; -- Handle node (name from node) insertion (& insertion character) procedure Set_Msg_Insertion_Reserved_Name; -- Handle insertion of reserved word name (* insertion character). procedure Set_Msg_Insertion_Reserved_Word (Text : String; J : in out Integer); -- Handle reserved word insertion (upper case letters). The Text argument -- is the current error message input text, and J is an index which on -- entry points to the first character of the reserved word, and on exit -- points past the last character of the reserved word. procedure Set_Msg_Insertion_Type_Reference (Flag : Source_Ptr); -- Handle type reference (right brace insertion character). Flag is the -- location of the flag, which is provided for the internal call to -- Set_Msg_Insertion_Line_Number, procedure Set_Msg_Insertion_Uint; -- Handle Uint insertion (^ insertion character) procedure Set_Msg_Insertion_Unit_Name; -- Handle unit name insertion ($ insertion character) procedure Set_Msg_Insertion_File_Name; -- Handle file name insertion (left brace insertion character) procedure Set_Msg_Int (Line : Int); -- Set the decimal representation of the argument in the error message -- buffer with no leading zeroes output. procedure Set_Msg_Name_Buffer; -- Output name from Name_Buffer, with surrounding quotes unless manual -- quotation mode is in effect. procedure Set_Msg_Node (Node : Node_Id); -- Add the sequence of characters for the name associated with the -- given node to the current message. procedure Set_Msg_Quote; -- Set quote if in normal quote mode, nothing if in manual quote mode procedure Set_Msg_Str (Text : String); -- Add a sequence of characters to the current message. This routine does -- not check for special insertion characters (they are just treated as -- text characters if they occur). procedure Set_Msg_Text (Text : String; Flag : Source_Ptr); -- Add a sequence of characters to the current message. The characters may -- be one of the special insertion characters (see documentation in spec). -- Flag is the location at which the error is to be posted, which is used -- to determine whether or not the # insertion needs a file name. The -- variables Msg_Buffer, Msglen, Is_Warning_Msg, and Is_Unconditional_Msg -- are set on return. procedure Set_Posted (N : Node_Id); -- Sets the Error_Posted flag on the given node, and all its parents -- that are subexpressions and then on the parent non-subexpression -- construct that contains the original expression (this reduces the -- number of cascaded messages) procedure Set_Qualification (N : Nat; E : Entity_Id); -- Outputs up to N levels of qualification for the given entity. For -- example, the entity A.B.C.D will output B.C. if N = 2. procedure Test_Warning_Msg (Msg : String); -- Sets Is_Warning_Msg true if Msg is a warning message (contains a -- question mark character), and False otherwise. procedure Unwind_Internal_Type (Ent : in out Entity_Id); -- This procedure is given an entity id for an internal type, i.e. -- a type with an internal name. It unwinds the type to try to get -- to something reasonably printable, generating prefixes like -- "subtype of", "access to", etc along the way in the buffer. The -- value in Ent on return is the final name to be printed. Hopefully -- this is not an internal name, but in some internal name cases, it -- is an internal name, and has to be printed anyway (although in this -- case the message has been killed if possible). The global variable -- Class_Flag is set to True if the resulting entity should have -- 'Class appended to its name (see Add_Class procedure), and is -- otherwise unchanged. function Warnings_Suppressed (Loc : Source_Ptr) return Boolean; -- Determines if given location is covered by a warnings off suppression -- range in the warnings table (or is suppressed by compilation option, -- which generates a warning range for the whole source file). --------------- -- Add_Class -- --------------- procedure Add_Class is begin if Class_Flag then Class_Flag := False; Set_Msg_Char ('''); Get_Name_String (Name_Class); Set_Casing (Identifier_Casing (Flag_Source), Mixed_Case); Set_Msg_Name_Buffer; end if; end Add_Class; ---------------------- -- Buffer_Ends_With -- ---------------------- function Buffer_Ends_With (S : String) return Boolean is Len : constant Natural := S'Length; begin return Msglen > Len and then Msg_Buffer (Msglen - Len) = ' ' and then Msg_Buffer (Msglen - Len + 1 .. Msglen) = S; end Buffer_Ends_With; ------------------- -- Buffer_Remove -- ------------------- procedure Buffer_Remove (S : String) is begin if Buffer_Ends_With (S) then Msglen := Msglen - S'Length; end if; end Buffer_Remove; ----------------------- -- Change_Error_Text -- ----------------------- procedure Change_Error_Text (Error_Id : Error_Msg_Id; New_Msg : String) is Save_Next : Error_Msg_Id; Err_Id : Error_Msg_Id := Error_Id; begin Set_Msg_Text (New_Msg, Errors.Table (Error_Id).Sptr); Errors.Table (Error_Id).Text := new String'(Msg_Buffer (1 .. Msglen)); -- If in immediate error message mode, output modified error message now -- This is just a bit tricky, because we want to output just a single -- message, and the messages we modified is already linked in. We solve -- this by temporarily resetting its forward pointer to empty. if Debug_Flag_OO then Save_Next := Errors.Table (Error_Id).Next; Errors.Table (Error_Id).Next := No_Error_Msg; Write_Eol; Output_Source_Line (Errors.Table (Error_Id).Line, Errors.Table (Error_Id).Sfile, True); Output_Error_Msgs (Err_Id); Errors.Table (Error_Id).Next := Save_Next; end if; end Change_Error_Text; ----------------------------- -- Check_Duplicate_Message -- ----------------------------- procedure Check_Duplicate_Message (M1, M2 : Error_Msg_Id) is L1, L2 : Error_Msg_Id; N1, N2 : Error_Msg_Id; procedure Delete_Msg (Delete, Keep : Error_Msg_Id); -- Called to delete message Delete, keeping message Keep. Marks -- all messages of Delete with deleted flag set to True, and also -- makes sure that for the error messages that are retained the -- preferred message is the one retained (we prefer the shorter -- one in the case where one has an Instance tag). Note that we -- always know that Keep has at least as many continuations as -- Delete (since we always delete the shorter sequence). procedure Delete_Msg (Delete, Keep : Error_Msg_Id) is D, K : Error_Msg_Id; begin D := Delete; K := Keep; loop Errors.Table (D).Deleted := True; -- Adjust error message count if Errors.Table (D).Warn then Warnings_Detected := Warnings_Detected - 1; else Errors_Detected := Errors_Detected - 1; end if; -- Substitute shorter of the two error messages if Errors.Table (K).Text'Length > Errors.Table (D).Text'Length then Errors.Table (K).Text := Errors.Table (D).Text; end if; D := Errors.Table (D).Next; K := Errors.Table (K).Next; if D = No_Error_Msg or else not Errors.Table (D).Msg_Cont then return; end if; end loop; end Delete_Msg; -- Start of processing for Check_Duplicate_Message begin -- Both messages must be non-continuation messages and not deleted if Errors.Table (M1).Msg_Cont or else Errors.Table (M2).Msg_Cont or else Errors.Table (M1).Deleted or else Errors.Table (M2).Deleted then return; end if; -- Definitely not equal if message text does not match if not Same_Error (M1, M2) then return; end if; -- Same text. See if all continuations are also identical L1 := M1; L2 := M2; loop N1 := Errors.Table (L1).Next; N2 := Errors.Table (L2).Next; -- If M1 continuations have run out, we delete M1, either the -- messages have the same number of continuations, or M2 has -- more and we prefer the one with more anyway. if N1 = No_Error_Msg or else not Errors.Table (N1).Msg_Cont then Delete_Msg (M1, M2); return; -- If M2 continuatins have run out, we delete M2 elsif N2 = No_Error_Msg or else not Errors.Table (N2).Msg_Cont then Delete_Msg (M2, M1); return; -- Otherwise see if continuations are the same, if not, keep both -- sequences, a curious case, but better to keep everything! elsif not Same_Error (N1, N2) then return; -- If continuations are the same, continue scan else L1 := N1; L2 := N2; end if; end loop; end Check_Duplicate_Message; ------------------------ -- Compilation_Errors -- ------------------------ function Compilation_Errors return Boolean is begin return Errors_Detected /= 0 or else (Warnings_Detected /= 0 and then Warning_Mode = Treat_As_Error); end Compilation_Errors; ------------------ -- Debug_Output -- ------------------ procedure Debug_Output (N : Node_Id) is begin if Debug_Flag_1 then Write_Str ("*** following error message posted on node id = #"); Write_Int (Int (N)); Write_Str (" ***"); Write_Eol; end if; end Debug_Output; ---------- -- dmsg -- ---------- procedure dmsg (Id : Error_Msg_Id) is E : Error_Msg_Object renames Errors.Table (Id); begin w ("Dumping error message, Id = ", Int (Id)); w (" Text = ", E.Text.all); w (" Next = ", Int (E.Next)); w (" Sfile = ", Int (E.Sfile)); Write_Str (" Sptr = "); Write_Location (E.Sptr); Write_Eol; Write_Str (" Fptr = "); Write_Location (E.Fptr); Write_Eol; w (" Line = ", Int (E.Line)); w (" Col = ", Int (E.Col)); w (" Warn = ", E.Warn); w (" Uncond = ", E.Uncond); w (" Msg_Cont = ", E.Msg_Cont); w (" Deleted = ", E.Deleted); Write_Eol; end dmsg; --------------- -- Error_Msg -- --------------- -- Error_Msg posts a flag at the given location, except that if the -- Flag_Location points within a generic template and corresponds -- to an instantiation of this generic template, then the actual -- message will be posted on the generic instantiation, along with -- additional messages referencing the generic declaration. procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is Sindex : Source_File_Index; -- Source index for flag location Orig_Loc : Source_Ptr; -- Original location of Flag_Location (i.e. location in original -- template in instantiation case, otherwise unchanged). begin -- If we already have messages, and we are trying to place a message -- at No_Location or in package Standard, then just ignore the attempt -- since we assume that what is happening is some cascaded junk. Note -- that this is safe in the sense that proceeding will surely bomb. if Flag_Location < First_Source_Ptr and then Errors_Detected > 0 then return; end if; Sindex := Get_Source_File_Index (Flag_Location); Test_Warning_Msg (Msg); -- It is a fatal error to issue an error message when scanning from -- the internal source buffer (see Sinput for further documentation) pragma Assert (Source /= Internal_Source_Ptr); -- Ignore warning message that is suppressed Orig_Loc := Original_Location (Flag_Location); if Is_Warning_Msg and then Warnings_Suppressed (Orig_Loc) then return; end if; -- The idea at this stage is that we have two kinds of messages. -- First, we have those that are to be placed as requested at -- Flag_Location. This includes messages that have nothing to -- do with generics, and also messages placed on generic templates -- that reflect an error in the template itself. For such messages -- we simply call Error_Msg_Internal to place the message in the -- requested location. if Instantiation (Sindex) = No_Location then Error_Msg_Internal (Msg, Flag_Location, False); return; end if; -- If we are trying to flag an error in an instantiation, we may have -- a generic contract violation. What we generate in this case is: -- instantiation error at ... -- original error message -- or -- warning: in instantiation at -- warning: original warning message -- All these messages are posted at the location of the top level -- instantiation. If there are nested instantiations, then the -- instantiation error message can be repeated, pointing to each -- of the relevant instantiations. -- However, before we do this, we need to worry about the case where -- indeed we are in an instantiation, but the message is a warning -- message. In this case, it almost certainly a warning for the -- template itself and so it is posted on the template. At least -- this is the default mode, it can be cancelled (resulting the -- warning being placed on the instance as in the error case) by -- setting the global Warn_On_Instance True. if (not Warn_On_Instance) and then Is_Warning_Msg then Error_Msg_Internal (Msg, Flag_Location, False); return; end if; -- Second, we need to worry about the case where there was a real error -- in the template, and we are getting a repeat of this error in the -- instantiation. We don't want to complain about the instantiation -- in this case, since we have already flagged the template. -- To deal with this case, just see if we have posted a message at -- the template location already. If so, assume that the current -- message is redundant. There could be cases in which this is not -- a correct assumption, but it is not terrible to lose a message -- about an incorrect instantiation given that we have already -- flagged a message on the template. for Err in Errors.First .. Errors.Last loop if Errors.Table (Err).Sptr = Orig_Loc then -- If the current message is a real error, as opposed to a -- warning, then we don't want to let a warning on the -- template inhibit a real error on the instantiation. if Is_Warning_Msg or else not Errors.Table (Err).Warn then return; end if; end if; end loop; -- OK, this is the case where we have an instantiation error, and -- we need to generate the error on the instantiation, rather than -- on the template. First, see if we have posted this exact error -- before, and if so suppress it. It is not so easy to use the main -- list of errors for this, since they have already been split up -- according to the processing below. Consequently we use an auxiliary -- data structure that just records these types of messages (it will -- never have very many entries). declare Actual_Error_Loc : Source_Ptr; -- Location of outer level instantiation in instantiation case, or -- just a copy of Flag_Location in the normal case. This is the -- location where all error messages will actually be posted. Save_Error_Msg_Sloc : constant Source_Ptr := Error_Msg_Sloc; -- Save possible location set for caller's message. We need to -- use Error_Msg_Sloc for the location of the instantiation error -- but we have to preserve a possible original value. X : Source_File_Index; Msg_Cont_Status : Boolean; -- Used to label continuation lines in instantiation case with -- proper Msg_Cont status. begin -- Loop to find highest level instantiation, where all error -- messages will be placed. X := Sindex; loop Actual_Error_Loc := Instantiation (X); X := Get_Source_File_Index (Actual_Error_Loc); exit when Instantiation (X) = No_Location; end loop; -- Since we are generating the messages at the instantiation -- point in any case, we do not want the references to the -- bad lines in the instance to be annotated with the location -- of the instantiation. Suppress_Instance_Location := True; Msg_Cont_Status := False; -- Loop to generate instantiation messages Error_Msg_Sloc := Flag_Location; X := Get_Source_File_Index (Flag_Location); while Instantiation (X) /= No_Location loop -- Suppress instantiation message on continuation lines if Msg (1) /= '\' then if Is_Warning_Msg then Error_Msg_Internal ("?in instantiation #", Actual_Error_Loc, Msg_Cont_Status); else Error_Msg_Internal ("instantiation error #", Actual_Error_Loc, Msg_Cont_Status); end if; end if; Error_Msg_Sloc := Instantiation (X); X := Get_Source_File_Index (Error_Msg_Sloc); Msg_Cont_Status := True; end loop; Suppress_Instance_Location := False; Error_Msg_Sloc := Save_Error_Msg_Sloc; -- Here we output the original message on the outer instantiation Error_Msg_Internal (Msg, Actual_Error_Loc, Msg_Cont_Status); end; end Error_Msg; ------------------ -- Error_Msg_AP -- ------------------ procedure Error_Msg_AP (Msg : String) is S1 : Source_Ptr; C : Character; begin -- If we had saved the Scan_Ptr value after scanning the previous -- token, then we would have exactly the right place for putting -- the flag immediately at hand. However, that would add at least -- two instructions to a Scan call *just* to service the possibility -- of an Error_Msg_AP call. So instead we reconstruct that value. -- We have two possibilities, start with Prev_Token_Ptr and skip over -- the current token, which is made harder by the possibility that this -- token may be in error, or start with Token_Ptr and work backwards. -- We used to take the second approach, but it's hard because of -- comments, and harder still because things that look like comments -- can appear inside strings. So now we take the first approach. -- Note: in the case where there is no previous token, Prev_Token_Ptr -- is set to Source_First, which is a reasonable position for the -- error flag in this situation. S1 := Prev_Token_Ptr; C := Source (S1); -- If the previous token is a string literal, we need a special approach -- since there may be white space inside the literal and we don't want -- to stop on that white space. if Prev_Token = Tok_String_Literal then loop S1 := S1 + 1; if Source (S1) = C then S1 := S1 + 1; exit when Source (S1) /= C; elsif Source (S1) in Line_Terminator then exit; end if; end loop; -- Character literal also needs special handling elsif Prev_Token = Tok_Char_Literal then S1 := S1 + 3; -- Otherwise we search forward for the end of the current token, marked -- by a line terminator, white space, a comment symbol or if we bump -- into the following token (i.e. the current token) else while Source (S1) not in Line_Terminator and then Source (S1) /= ' ' and then Source (S1) /= ASCII.HT and then (Source (S1) /= '-' or else Source (S1 + 1) /= '-') and then S1 /= Token_Ptr loop S1 := S1 + 1; end loop; end if; -- S1 is now set to the location for the flag Error_Msg (Msg, S1); end Error_Msg_AP; ------------------ -- Error_Msg_BC -- ------------------ procedure Error_Msg_BC (Msg : String) is begin -- If we are at end of file, post the flag after the previous token if Token = Tok_EOF then Error_Msg_AP (Msg); -- If we are at start of file, post the flag at the current token elsif Token_Ptr = Source_First (Current_Source_File) then Error_Msg_SC (Msg); -- If the character before the current token is a space or a horizontal -- tab, then we place the flag on this character (in the case of a tab -- we would really like to place it in the "last" character of the tab -- space, but that it too much trouble to worry about). elsif Source (Token_Ptr - 1) = ' ' or else Source (Token_Ptr - 1) = ASCII.HT then Error_Msg (Msg, Token_Ptr - 1); -- If there is no space or tab before the current token, then there is -- no room to place the flag before the token, so we place it on the -- token instead (this happens for example at the start of a line). else Error_Msg (Msg, Token_Ptr); end if; end Error_Msg_BC; ------------------------ -- Error_Msg_Internal -- ------------------------ procedure Error_Msg_Internal (Msg : String; Flag_Location : Source_Ptr; Msg_Cont : Boolean) is Next_Msg : Error_Msg_Id; -- Pointer to next message at insertion point Prev_Msg : Error_Msg_Id; -- Pointer to previous message at insertion point Temp_Msg : Error_Msg_Id; Orig_Loc : constant Source_Ptr := Original_Location (Flag_Location); procedure Handle_Fatal_Error; -- Internal procedure to do all error message handling other than -- bumping the error count and arranging for the message to be output. procedure Handle_Fatal_Error is begin -- Turn off code generation if not done already if Operating_Mode = Generate_Code then Operating_Mode := Check_Semantics; Expander_Active := False; end if; -- Set the fatal error flag in the unit table unless we are -- in Try_Semantics mode. This stops the semantics from being -- performed if we find a parser error. This is skipped if we -- are currently dealing with the configuration pragma file. if not Try_Semantics and then Current_Source_Unit /= No_Unit then Set_Fatal_Error (Get_Source_Unit (Orig_Loc)); end if; end Handle_Fatal_Error; -- Start of processing for Error_Msg_Internal begin if Raise_Exception_On_Error /= 0 then raise Error_Msg_Exception; end if; Continuation := Msg_Cont; Suppress_Message := False; Kill_Message := False; Set_Msg_Text (Msg, Orig_Loc); -- Kill continuation if parent message killed if Continuation and Last_Killed then return; end if; -- Return without doing anything if message is suppressed if Suppress_Message and not All_Errors_Mode and not (Msg (Msg'Last) = '!') then if not Continuation then Last_Killed := True; end if; return; end if; -- Return without doing anything if message is killed and this -- is not the first error message. The philosophy is that if we -- get a weird error message and we already have had a message, -- then we hope the weird message is a junk cascaded message if Kill_Message and then not All_Errors_Mode and then Errors_Detected /= 0 then if not Continuation then Last_Killed := True; end if; return; end if; -- Immediate return if warning message and warnings are suppressed if Is_Warning_Msg and then Warnings_Suppressed (Orig_Loc) then Cur_Msg := No_Error_Msg; return; end if; -- If message is to be ignored in special ignore message mode, this is -- where we do this special processing, bypassing message output. if Ignore_Errors_Enable > 0 then Handle_Fatal_Error; return; end if; -- Otherwise build error message object for new message Errors.Increment_Last; Cur_Msg := Errors.Last; Errors.Table (Cur_Msg).Text := new String'(Msg_Buffer (1 .. Msglen)); Errors.Table (Cur_Msg).Next := No_Error_Msg; Errors.Table (Cur_Msg).Sptr := Orig_Loc; Errors.Table (Cur_Msg).Fptr := Flag_Location; Errors.Table (Cur_Msg).Sfile := Get_Source_File_Index (Orig_Loc); Errors.Table (Cur_Msg).Line := Get_Physical_Line_Number (Orig_Loc); Errors.Table (Cur_Msg).Col := Get_Column_Number (Orig_Loc); Errors.Table (Cur_Msg).Warn := Is_Warning_Msg; Errors.Table (Cur_Msg).Uncond := Is_Unconditional_Msg; Errors.Table (Cur_Msg).Msg_Cont := Continuation; Errors.Table (Cur_Msg).Deleted := False; -- If immediate errors mode set, output error message now. Also output -- now if the -d1 debug flag is set (so node number message comes out -- just before actual error message) if Debug_Flag_OO or else Debug_Flag_1 then Write_Eol; Output_Source_Line (Errors.Table (Cur_Msg).Line, Errors.Table (Cur_Msg).Sfile, True); Temp_Msg := Cur_Msg; Output_Error_Msgs (Temp_Msg); -- If not in immediate errors mode, then we insert the message in the -- error chain for later output by Finalize. The messages are sorted -- first by unit (main unit comes first), and within a unit by source -- location (earlier flag location first in the chain). else Prev_Msg := No_Error_Msg; Next_Msg := Error_Msgs; while Next_Msg /= No_Error_Msg loop exit when Errors.Table (Cur_Msg).Sfile < Errors.Table (Next_Msg).Sfile; if Errors.Table (Cur_Msg).Sfile = Errors.Table (Next_Msg).Sfile then exit when Orig_Loc < Errors.Table (Next_Msg).Sptr; end if; Prev_Msg := Next_Msg; Next_Msg := Errors.Table (Next_Msg).Next; end loop; -- Now we insert the new message in the error chain. The insertion -- point for the message is after Prev_Msg and before Next_Msg. -- The possible insertion point for the new message is after Prev_Msg -- and before Next_Msg. However, this is where we do a special check -- for redundant parsing messages, defined as messages posted on the -- same line. The idea here is that probably such messages are junk -- from the parser recovering. In full errors mode, we don't do this -- deletion, but otherwise such messages are discarded at this stage. if Prev_Msg /= No_Error_Msg and then Errors.Table (Prev_Msg).Line = Errors.Table (Cur_Msg).Line and then Errors.Table (Prev_Msg).Sfile = Errors.Table (Cur_Msg).Sfile and then Compiler_State = Parsing and then not All_Errors_Mode then -- Don't delete unconditional messages and at this stage, -- don't delete continuation lines (we attempted to delete -- those earlier if the parent message was deleted. if not Errors.Table (Cur_Msg).Uncond and then not Continuation then -- Don't delete if prev msg is warning and new msg is -- an error. This is because we don't want a real error -- masked by a warning. In all other cases (that is parse -- errors for the same line that are not unconditional) -- we do delete the message. This helps to avoid -- junk extra messages from cascaded parsing errors if not Errors.Table (Prev_Msg).Warn or else Errors.Table (Cur_Msg).Warn then -- All tests passed, delete the message by simply -- returning without any further processing. if not Continuation then Last_Killed := True; end if; return; end if; end if; end if; -- Come here if message is to be inserted in the error chain if not Continuation then Last_Killed := False; end if; if Prev_Msg = No_Error_Msg then Error_Msgs := Cur_Msg; else Errors.Table (Prev_Msg).Next := Cur_Msg; end if; Errors.Table (Cur_Msg).Next := Next_Msg; end if; -- Bump appropriate statistics count if Errors.Table (Cur_Msg).Warn then Warnings_Detected := Warnings_Detected + 1; else Errors_Detected := Errors_Detected + 1; Handle_Fatal_Error; end if; -- Terminate if max errors reached if Errors_Detected + Warnings_Detected = Maximum_Errors then raise Unrecoverable_Error; end if; end Error_Msg_Internal; ----------------- -- Error_Msg_N -- ----------------- procedure Error_Msg_N (Msg : String; N : Node_Or_Entity_Id) is begin if No_Warnings (N) then Test_Warning_Msg (Msg); if Is_Warning_Msg then return; end if; end if; if All_Errors_Mode or else Msg (Msg'Last) = '!' or else OK_Node (N) or else (Msg (1) = '\' and not Last_Killed) then Debug_Output (N); Error_Msg_Node_1 := N; Error_Msg (Msg, Sloc (N)); else Last_Killed := True; end if; if not Is_Warning_Msg then Set_Posted (N); end if; end Error_Msg_N; ------------------ -- Error_Msg_NE -- ------------------ procedure Error_Msg_NE (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id) is begin if No_Warnings (N) or else No_Warnings (E) then Test_Warning_Msg (Msg); if Is_Warning_Msg then return; end if; end if; if All_Errors_Mode or else Msg (Msg'Last) = '!' or else OK_Node (N) or else (Msg (1) = '\' and not Last_Killed) then Debug_Output (N); Error_Msg_Node_1 := E; Error_Msg (Msg, Sloc (N)); else Last_Killed := True; end if; if not Is_Warning_Msg then Set_Posted (N); end if; end Error_Msg_NE; ----------------- -- Error_Msg_S -- ----------------- procedure Error_Msg_S (Msg : String) is begin Error_Msg (Msg, Scan_Ptr); end Error_Msg_S; ------------------ -- Error_Msg_SC -- ------------------ procedure Error_Msg_SC (Msg : String) is begin -- If we are at end of file, post the flag after the previous token if Token = Tok_EOF then Error_Msg_AP (Msg); -- For all other cases the message is posted at the current token -- pointer position else Error_Msg (Msg, Token_Ptr); end if; end Error_Msg_SC; ------------------ -- Error_Msg_SP -- ------------------ procedure Error_Msg_SP (Msg : String) is begin -- Note: in the case where there is no previous token, Prev_Token_Ptr -- is set to Source_First, which is a reasonable position for the -- error flag in this situation Error_Msg (Msg, Prev_Token_Ptr); end Error_Msg_SP; -------------- -- Finalize -- -------------- procedure Finalize is Cur : Error_Msg_Id; Nxt : Error_Msg_Id; E, F : Error_Msg_Id; Err_Flag : Boolean; begin -- Reset current error source file if the main unit has a pragma -- Source_Reference. This ensures outputting the proper name of -- the source file in this situation. if Num_SRef_Pragmas (Main_Source_File) /= 0 then Current_Error_Source_File := No_Source_File; end if; -- Eliminate any duplicated error messages from the list. This is -- done after the fact to avoid problems with Change_Error_Text. Cur := Error_Msgs; while Cur /= No_Error_Msg loop Nxt := Errors.Table (Cur).Next; F := Nxt; while F /= No_Error_Msg and then Errors.Table (F).Sptr = Errors.Table (Cur).Sptr loop Check_Duplicate_Message (Cur, F); F := Errors.Table (F).Next; end loop; Cur := Nxt; end loop; -- Brief Error mode if Brief_Output or (not Full_List and not Verbose_Mode) then E := Error_Msgs; Set_Standard_Error; while E /= No_Error_Msg loop if not Errors.Table (E).Deleted and then not Debug_Flag_KK then Write_Name (Reference_Name (Errors.Table (E).Sfile)); Write_Char (':'); Write_Int (Int (Physical_To_Logical (Errors.Table (E).Line, Errors.Table (E).Sfile))); Write_Char (':'); if Errors.Table (E).Col < 10 then Write_Char ('0'); end if; Write_Int (Int (Errors.Table (E).Col)); Write_Str (": "); Output_Msg_Text (E); Write_Eol; end if; E := Errors.Table (E).Next; end loop; Set_Standard_Output; end if; -- Full source listing case if Full_List then List_Pragmas_Index := 1; List_Pragmas_Mode := True; E := Error_Msgs; Write_Eol; -- First list initial main source file with its error messages for N in 1 .. Last_Source_Line (Main_Source_File) loop Err_Flag := E /= No_Error_Msg and then Errors.Table (E).Line = N and then Errors.Table (E).Sfile = Main_Source_File; Output_Source_Line (N, Main_Source_File, Err_Flag); if Err_Flag then Output_Error_Msgs (E); if not Debug_Flag_2 then Write_Eol; end if; end if; end loop; -- Then output errors, if any, for subsidiary units while E /= No_Error_Msg and then Errors.Table (E).Sfile /= Main_Source_File loop Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True); Output_Error_Msgs (E); end loop; end if; -- Verbose mode (error lines only with error flags) if Verbose_Mode and not Full_List then E := Error_Msgs; -- Loop through error lines while E /= No_Error_Msg loop Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True); Output_Error_Msgs (E); end loop; end if; -- Output error summary if verbose or full list mode if Verbose_Mode or else Full_List then -- Extra blank line if error messages or source listing were output if Errors_Detected + Warnings_Detected > 0 or else Full_List then Write_Eol; end if; -- Message giving number of lines read and number of errors detected. -- This normally goes to Standard_Output. The exception is when brief -- mode is not set, verbose mode (or full list mode) is set, and -- there are errors. In this case we send the message to standard -- error to make sure that *something* appears on standard error in -- an error situation. -- Formerly, only the "# errors" suffix was sent to stderr, whereas -- "# lines:" appeared on stdout. This caused problems on VMS when -- the stdout buffer was flushed, giving an extra line feed after -- the prefix. if Errors_Detected + Warnings_Detected /= 0 and then not Brief_Output and then (Verbose_Mode or Full_List) then Set_Standard_Error; end if; -- Message giving total number of lines Write_Str (" "); Write_Int (Num_Source_Lines (Main_Source_File)); if Num_Source_Lines (Main_Source_File) = 1 then Write_Str (" line: "); else Write_Str (" lines: "); end if; if Errors_Detected = 0 then Write_Str ("No errors"); elsif Errors_Detected = 1 then Write_Str ("1 error"); else Write_Int (Errors_Detected); Write_Str (" errors"); end if; if Warnings_Detected /= 0 then Write_Str (", "); Write_Int (Warnings_Detected); Write_Str (" warning"); if Warnings_Detected /= 1 then Write_Char ('s'); end if; if Warning_Mode = Treat_As_Error then Write_Str (" (treated as error"); if Warnings_Detected /= 1 then Write_Char ('s'); end if; Write_Char (')'); end if; end if; Write_Eol; Set_Standard_Output; end if; if Maximum_Errors /= 0 and then Errors_Detected + Warnings_Detected = Maximum_Errors then Set_Standard_Error; Write_Str ("fatal error: maximum errors reached"); Write_Eol; Set_Standard_Output; end if; if Warning_Mode = Treat_As_Error then Errors_Detected := Errors_Detected + Warnings_Detected; Warnings_Detected := 0; end if; end Finalize; ------------------ -- Get_Location -- ------------------ function Get_Location (E : Error_Msg_Id) return Source_Ptr is begin return Errors.Table (E).Sptr; end Get_Location; ---------------- -- Get_Msg_Id -- ---------------- function Get_Msg_Id return Error_Msg_Id is begin return Cur_Msg; end Get_Msg_Id; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Errors.Init; Error_Msgs := No_Error_Msg; Errors_Detected := 0; Warnings_Detected := 0; Cur_Msg := No_Error_Msg; List_Pragmas.Init; -- Initialize warnings table, if all warnings are suppressed, supply -- an initial dummy entry covering all possible source locations. Warnings.Init; if Warning_Mode = Suppress then Warnings.Increment_Last; Warnings.Table (Warnings.Last).Start := Source_Ptr'First; Warnings.Table (Warnings.Last).Stop := Source_Ptr'Last; end if; end Initialize; ----------------- -- No_Warnings -- ----------------- function No_Warnings (N : Node_Or_Entity_Id) return Boolean is begin if Error_Posted (N) then return True; elsif Nkind (N) in N_Entity and then Warnings_Off (N) then return True; elsif Is_Entity_Name (N) and then Present (Entity (N)) and then Warnings_Off (Entity (N)) then return True; else return False; end if; end No_Warnings; ------------- -- OK_Node -- ------------- function OK_Node (N : Node_Id) return Boolean is K : constant Node_Kind := Nkind (N); begin if Error_Posted (N) then return False; elsif K in N_Has_Etype and then Present (Etype (N)) and then Error_Posted (Etype (N)) then return False; elsif (K in N_Op or else K = N_Attribute_Reference or else K = N_Character_Literal or else K = N_Expanded_Name or else K = N_Identifier or else K = N_Operator_Symbol) and then Present (Entity (N)) and then Error_Posted (Entity (N)) then return False; else return True; end if; end OK_Node; ----------------------- -- Output_Error_Msgs -- ----------------------- procedure Output_Error_Msgs (E : in out Error_Msg_Id) is P : Source_Ptr; T : Error_Msg_Id; S : Error_Msg_Id; Flag_Num : Pos; Mult_Flags : Boolean := False; begin S := E; -- Skip deleted messages at start if Errors.Table (S).Deleted then Set_Next_Non_Deleted_Msg (S); end if; -- Figure out if we will place more than one error flag on this line T := S; while T /= No_Error_Msg and then Errors.Table (T).Line = Errors.Table (E).Line and then Errors.Table (T).Sfile = Errors.Table (E).Sfile loop if Errors.Table (T).Sptr > Errors.Table (E).Sptr then Mult_Flags := True; end if; Set_Next_Non_Deleted_Msg (T); end loop; -- Output the error flags. The circuit here makes sure that the tab -- characters in the original line are properly accounted for. The -- eight blanks at the start are to match the line number. if not Debug_Flag_2 then Write_Str (" "); P := Line_Start (Errors.Table (E).Sptr); Flag_Num := 1; -- Loop through error messages for this line to place flags T := S; while T /= No_Error_Msg and then Errors.Table (T).Line = Errors.Table (E).Line and then Errors.Table (T).Sfile = Errors.Table (E).Sfile loop -- Loop to output blanks till current flag position while P < Errors.Table (T).Sptr loop if Source_Text (Errors.Table (T).Sfile) (P) = ASCII.HT then Write_Char (ASCII.HT); else Write_Char (' '); end if; P := P + 1; end loop; -- Output flag (unless already output, this happens if more -- than one error message occurs at the same flag position). if P = Errors.Table (T).Sptr then if (Flag_Num = 1 and then not Mult_Flags) or else Flag_Num > 9 then Write_Char ('|'); else Write_Char (Character'Val (Character'Pos ('0') + Flag_Num)); end if; P := P + 1; end if; Set_Next_Non_Deleted_Msg (T); Flag_Num := Flag_Num + 1; end loop; Write_Eol; end if; -- Now output the error messages T := S; while T /= No_Error_Msg and then Errors.Table (T).Line = Errors.Table (E).Line and then Errors.Table (T).Sfile = Errors.Table (E).Sfile loop Write_Str (" >>> "); Output_Msg_Text (T); if Debug_Flag_2 then while Column < 74 loop Write_Char (' '); end loop; Write_Str (" <<<"); end if; Write_Eol; Set_Next_Non_Deleted_Msg (T); end loop; E := T; end Output_Error_Msgs; ------------------------ -- Output_Line_Number -- ------------------------ procedure Output_Line_Number (L : Logical_Line_Number) is D : Int; -- next digit C : Character; -- next character Z : Boolean; -- flag for zero suppress N, M : Int; -- temporaries begin if L = No_Line_Number then Write_Str (" "); else Z := False; N := Int (L); M := 100_000; while M /= 0 loop D := Int (N / M); N := N rem M; M := M / 10; if D = 0 then if Z then C := '0'; else C := ' '; end if; else Z := True; C := Character'Val (D + 48); end if; Write_Char (C); end loop; Write_Str (". "); end if; end Output_Line_Number; --------------------- -- Output_Msg_Text -- --------------------- procedure Output_Msg_Text (E : Error_Msg_Id) is begin if Errors.Table (E).Warn then if Errors.Table (E).Text'Length > 7 and then Errors.Table (E).Text (1 .. 7) /= "(style)" then Write_Str ("warning: "); end if; elsif Opt.Unique_Error_Tag then Write_Str ("error: "); end if; Write_Str (Errors.Table (E).Text.all); end Output_Msg_Text; ------------------------ -- Output_Source_Line -- ------------------------ procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean) is S : Source_Ptr; C : Character; Line_Number_Output : Boolean := False; -- Set True once line number is output begin if Sfile /= Current_Error_Source_File then Write_Str ("==============Error messages for source file: "); Write_Name (Full_File_Name (Sfile)); Write_Eol; if Num_SRef_Pragmas (Sfile) > 0 then Write_Str ("--------------Line numbers from file: "); Write_Name (Full_Ref_Name (Sfile)); -- Write starting line, except do not write it if we had more -- than one source reference pragma, since in this case there -- is no very useful number to write. Write_Str (" (starting at line "); Write_Int (Int (First_Mapped_Line (Sfile))); Write_Char (')'); Write_Eol; end if; Current_Error_Source_File := Sfile; end if; if Errs or List_Pragmas_Mode then Output_Line_Number (Physical_To_Logical (L, Sfile)); Line_Number_Output := True; end if; S := Line_Start (L, Sfile); loop C := Source_Text (Sfile) (S); exit when C = ASCII.LF or else C = ASCII.CR or else C = EOF; -- Deal with matching entry in List_Pragmas table if Full_List and then List_Pragmas_Index <= List_Pragmas.Last and then S = List_Pragmas.Table (List_Pragmas_Index).Ploc then case List_Pragmas.Table (List_Pragmas_Index).Ptyp is when Page => Write_Char (C); -- Ignore if on line with errors so that error flags -- get properly listed with the error line . if not Errs then Write_Char (ASCII.FF); end if; when List_On => List_Pragmas_Mode := True; if not Line_Number_Output then Output_Line_Number (Physical_To_Logical (L, Sfile)); Line_Number_Output := True; end if; Write_Char (C); when List_Off => Write_Char (C); List_Pragmas_Mode := False; end case; List_Pragmas_Index := List_Pragmas_Index + 1; -- Normal case (no matching entry in List_Pragmas table) else if Errs or List_Pragmas_Mode then Write_Char (C); end if; end if; S := S + 1; end loop; if Line_Number_Output then Write_Eol; end if; end Output_Source_Line; -------------------- -- Purge_Messages -- -------------------- procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr) is E : Error_Msg_Id; function To_Be_Purged (E : Error_Msg_Id) return Boolean; -- Returns True for a message that is to be purged. Also adjusts -- error counts appropriately. function To_Be_Purged (E : Error_Msg_Id) return Boolean is begin if E /= No_Error_Msg and then Errors.Table (E).Sptr > From and then Errors.Table (E).Sptr < To then if Errors.Table (E).Warn then Warnings_Detected := Warnings_Detected - 1; else Errors_Detected := Errors_Detected - 1; end if; return True; else return False; end if; end To_Be_Purged; -- Start of processing for Purge_Messages begin while To_Be_Purged (Error_Msgs) loop Error_Msgs := Errors.Table (Error_Msgs).Next; end loop; E := Error_Msgs; while E /= No_Error_Msg loop while To_Be_Purged (Errors.Table (E).Next) loop Errors.Table (E).Next := Errors.Table (Errors.Table (E).Next).Next; end loop; E := Errors.Table (E).Next; end loop; end Purge_Messages; ----------------------------- -- Remove_Warning_Messages -- ----------------------------- procedure Remove_Warning_Messages (N : Node_Id) is function Check_For_Warning (N : Node_Id) return Traverse_Result; -- This function checks one node for a possible warning message. function Check_All_Warnings is new Traverse_Func (Check_For_Warning); -- This defines the traversal operation ----------------------- -- Check_For_Warning -- ----------------------- function Check_For_Warning (N : Node_Id) return Traverse_Result is Loc : constant Source_Ptr := Sloc (N); E : Error_Msg_Id; function To_Be_Removed (E : Error_Msg_Id) return Boolean; -- Returns True for a message that is to be removed. Also adjusts -- warning count appropriately. ------------------- -- To_Be_Removed -- ------------------- function To_Be_Removed (E : Error_Msg_Id) return Boolean is begin if E /= No_Error_Msg and then Errors.Table (E).Fptr = Loc and then Errors.Table (E).Warn then Warnings_Detected := Warnings_Detected - 1; return True; else return False; end if; end To_Be_Removed; -- Start of processing for Check_For_Warnings begin while To_Be_Removed (Error_Msgs) loop Error_Msgs := Errors.Table (Error_Msgs).Next; end loop; E := Error_Msgs; while E /= No_Error_Msg loop while To_Be_Removed (Errors.Table (E).Next) loop Errors.Table (E).Next := Errors.Table (Errors.Table (E).Next).Next; end loop; E := Errors.Table (E).Next; end loop; if Nkind (N) = N_Raise_Constraint_Error and then Original_Node (N) /= N then -- Warnings may have been posted on subexpressions of -- the original tree. We temporarily replace the raise -- statement with the original expression to remove -- those warnings, whose sloc do not match those of -- any node in the current tree. declare Old : Node_Id := N; Status : Traverse_Result; begin Rewrite (N, Original_Node (N)); Status := Check_For_Warning (N); Rewrite (N, Old); return Status; end; else return OK; end if; end Check_For_Warning; -- Start of processing for Remove_Warning_Messages begin if Warnings_Detected /= 0 then declare Discard : Traverse_Result; begin Discard := Check_All_Warnings (N); end; end if; end Remove_Warning_Messages; ---------------- -- Same_Error -- ---------------- function Same_Error (M1, M2 : Error_Msg_Id) return Boolean is Msg1 : constant String_Ptr := Errors.Table (M1).Text; Msg2 : constant String_Ptr := Errors.Table (M2).Text; Msg2_Len : constant Integer := Msg2'Length; Msg1_Len : constant Integer := Msg1'Length; begin return Msg1.all = Msg2.all or else (Msg1_Len - 10 > Msg2_Len and then Msg2.all = Msg1.all (1 .. Msg2_Len) and then Msg1 (Msg2_Len + 1 .. Msg2_Len + 10) = ", instance") or else (Msg2_Len - 10 > Msg1_Len and then Msg1.all = Msg2.all (1 .. Msg1_Len) and then Msg2 (Msg1_Len + 1 .. Msg1_Len + 10) = ", instance"); end Same_Error; ------------------- -- Set_Msg_Blank -- ------------------- procedure Set_Msg_Blank is begin if Msglen > 0 and then Msg_Buffer (Msglen) /= ' ' and then Msg_Buffer (Msglen) /= '(' and then not Manual_Quote_Mode then Set_Msg_Char (' '); end if; end Set_Msg_Blank; ------------------------------- -- Set_Msg_Blank_Conditional -- ------------------------------- procedure Set_Msg_Blank_Conditional is begin if Msglen > 0 and then Msg_Buffer (Msglen) /= ' ' and then Msg_Buffer (Msglen) /= '(' and then Msg_Buffer (Msglen) /= '"' and then not Manual_Quote_Mode then Set_Msg_Char (' '); end if; end Set_Msg_Blank_Conditional; ------------------ -- Set_Msg_Char -- ------------------ procedure Set_Msg_Char (C : Character) is begin -- The check for message buffer overflow is needed to deal with cases -- where insertions get too long (in particular a child unit name can -- be very long). if Msglen < Max_Msg_Length then Msglen := Msglen + 1; Msg_Buffer (Msglen) := C; end if; end Set_Msg_Char; ------------------------------ -- Set_Msg_Insertion_Column -- ------------------------------ procedure Set_Msg_Insertion_Column is begin if Style.RM_Column_Check then Set_Msg_Str (" in column "); Set_Msg_Int (Int (Error_Msg_Col) + 1); end if; end Set_Msg_Insertion_Column; --------------------------------- -- Set_Msg_Insertion_File_Name -- --------------------------------- procedure Set_Msg_Insertion_File_Name is begin if Error_Msg_Name_1 = No_Name then null; elsif Error_Msg_Name_1 = Error_Name then Set_Msg_Blank; Set_Msg_Str ("<error>"); else Set_Msg_Blank; Get_Name_String (Error_Msg_Name_1); Set_Msg_Quote; Set_Msg_Name_Buffer; Set_Msg_Quote; end if; -- The following assignments ensure that the second and third percent -- insertion characters will correspond to the Error_Msg_Name_2 and -- Error_Msg_Name_3 as required. Error_Msg_Name_1 := Error_Msg_Name_2; Error_Msg_Name_2 := Error_Msg_Name_3; end Set_Msg_Insertion_File_Name; ----------------------------------- -- Set_Msg_Insertion_Line_Number -- ----------------------------------- procedure Set_Msg_Insertion_Line_Number (Loc, Flag : Source_Ptr) is Sindex_Loc : Source_File_Index; Sindex_Flag : Source_File_Index; begin Set_Msg_Blank; if Loc = No_Location then Set_Msg_Str ("at unknown location"); elsif Loc <= Standard_Location then Set_Msg_Str ("in package Standard"); if Loc = Standard_ASCII_Location then Set_Msg_Str (".ASCII"); end if; else -- Add "at file-name:" if reference is to other than the source -- file in which the error message is placed. Note that we check -- full file names, rather than just the source indexes, to -- deal with generic instantiations from the current file. Sindex_Loc := Get_Source_File_Index (Loc); Sindex_Flag := Get_Source_File_Index (Flag); if Full_File_Name (Sindex_Loc) /= Full_File_Name (Sindex_Flag) then Set_Msg_Str ("at "); Get_Name_String (Reference_Name (Get_Source_File_Index (Loc))); Set_Msg_Name_Buffer; Set_Msg_Char (':'); -- If in current file, add text "at line " else Set_Msg_Str ("at line "); end if; -- Output line number for reference Set_Msg_Int (Int (Get_Logical_Line_Number (Loc))); -- Deal with the instantiation case. We may have a reference to, -- e.g. a type, that is declared within a generic template, and -- what we are really referring to is the occurrence in an instance. -- In this case, the line number of the instantiation is also of -- interest, and we add a notation: -- , instance at xxx -- where xxx is a line number output using this same routine (and -- the recursion can go further if the instantiation is itself in -- a generic template). -- The flag location passed to us in this situation is indeed the -- line number within the template, but as described in Sinput.L -- (file sinput-l.ads, section "Handling Generic Instantiations") -- we can retrieve the location of the instantiation itself from -- this flag location value. -- Note: this processing is suppressed if Suppress_Instance_Location -- is set True. This is used to prevent redundant annotations of the -- location of the instantiation in the case where we are placing -- the messages on the instantiation in any case. if Instantiation (Sindex_Loc) /= No_Location and then not Suppress_Instance_Location then Set_Msg_Str (", instance "); Set_Msg_Insertion_Line_Number (Instantiation (Sindex_Loc), Flag); end if; end if; end Set_Msg_Insertion_Line_Number; ---------------------------- -- Set_Msg_Insertion_Name -- ---------------------------- procedure Set_Msg_Insertion_Name is begin if Error_Msg_Name_1 = No_Name then null; elsif Error_Msg_Name_1 = Error_Name then Set_Msg_Blank; Set_Msg_Str ("<error>"); else Set_Msg_Blank_Conditional; Get_Unqualified_Decoded_Name_String (Error_Msg_Name_1); -- Remove %s or %b at end. These come from unit names. If the -- caller wanted the (unit) or (body), then they would have used -- the $ insertion character. Certainly no error message should -- ever have %b or %s explicitly occurring. if Name_Len > 2 and then Name_Buffer (Name_Len - 1) = '%' and then (Name_Buffer (Name_Len) = 'b' or else Name_Buffer (Name_Len) = 's') then Name_Len := Name_Len - 2; end if; -- Remove upper case letter at end, again, we should not be getting -- such names, and what we hope is that the remainder makes sense. if Name_Len > 1 and then Name_Buffer (Name_Len) in 'A' .. 'Z' then Name_Len := Name_Len - 1; end if; -- If operator name or character literal name, just print it as is -- Also print as is if it ends in a right paren (case of x'val(nnn)) if Name_Buffer (1) = '"' or else Name_Buffer (1) = ''' or else Name_Buffer (Name_Len) = ')' then Set_Msg_Name_Buffer; -- Else output with surrounding quotes in proper casing mode else Set_Casing (Identifier_Casing (Flag_Source), Mixed_Case); Set_Msg_Quote; Set_Msg_Name_Buffer; Set_Msg_Quote; end if; end if; -- The following assignments ensure that the second and third percent -- insertion characters will correspond to the Error_Msg_Name_2 and -- Error_Msg_Name_3 as required. Error_Msg_Name_1 := Error_Msg_Name_2; Error_Msg_Name_2 := Error_Msg_Name_3; end Set_Msg_Insertion_Name; ---------------------------- -- Set_Msg_Insertion_Node -- ---------------------------- procedure Set_Msg_Insertion_Node is begin Suppress_Message := Error_Msg_Node_1 = Error or else Error_Msg_Node_1 = Any_Type; if Error_Msg_Node_1 = Empty then Set_Msg_Blank_Conditional; Set_Msg_Str ("<empty>"); elsif Error_Msg_Node_1 = Error then Set_Msg_Blank; Set_Msg_Str ("<error>"); elsif Error_Msg_Node_1 = Standard_Void_Type then Set_Msg_Blank; Set_Msg_Str ("procedure name"); else Set_Msg_Blank_Conditional; -- Skip quotes for operator case if Nkind (Error_Msg_Node_1) in N_Op then Set_Msg_Node (Error_Msg_Node_1); else Set_Msg_Quote; Set_Qualification (Error_Msg_Qual_Level, Error_Msg_Node_1); Set_Msg_Node (Error_Msg_Node_1); Set_Msg_Quote; end if; end if; -- The following assignment ensures that a second ampersand insertion -- character will correspond to the Error_Msg_Node_2 parameter. Error_Msg_Node_1 := Error_Msg_Node_2; end Set_Msg_Insertion_Node; ------------------------------------- -- Set_Msg_Insertion_Reserved_Name -- ------------------------------------- procedure Set_Msg_Insertion_Reserved_Name is begin Set_Msg_Blank_Conditional; Get_Name_String (Error_Msg_Name_1); Set_Msg_Quote; Set_Casing (Keyword_Casing (Flag_Source), All_Lower_Case); Set_Msg_Name_Buffer; Set_Msg_Quote; end Set_Msg_Insertion_Reserved_Name; ------------------------------------- -- Set_Msg_Insertion_Reserved_Word -- ------------------------------------- procedure Set_Msg_Insertion_Reserved_Word (Text : String; J : in out Integer) is begin Set_Msg_Blank_Conditional; Name_Len := 0; while J <= Text'Last and then Text (J) in 'A' .. 'Z' loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Text (J); J := J + 1; end loop; Set_Casing (Keyword_Casing (Flag_Source), All_Lower_Case); Set_Msg_Quote; Set_Msg_Name_Buffer; Set_Msg_Quote; end Set_Msg_Insertion_Reserved_Word; -------------------------------------- -- Set_Msg_Insertion_Type_Reference -- -------------------------------------- procedure Set_Msg_Insertion_Type_Reference (Flag : Source_Ptr) is Ent : Entity_Id; begin Set_Msg_Blank; if Error_Msg_Node_1 = Standard_Void_Type then Set_Msg_Str ("package or procedure name"); return; elsif Error_Msg_Node_1 = Standard_Exception_Type then Set_Msg_Str ("exception name"); return; elsif Error_Msg_Node_1 = Any_Access or else Error_Msg_Node_1 = Any_Array or else Error_Msg_Node_1 = Any_Boolean or else Error_Msg_Node_1 = Any_Character or else Error_Msg_Node_1 = Any_Composite or else Error_Msg_Node_1 = Any_Discrete or else Error_Msg_Node_1 = Any_Fixed or else Error_Msg_Node_1 = Any_Integer or else Error_Msg_Node_1 = Any_Modular or else Error_Msg_Node_1 = Any_Numeric or else Error_Msg_Node_1 = Any_Real or else Error_Msg_Node_1 = Any_Scalar or else Error_Msg_Node_1 = Any_String then Get_Unqualified_Decoded_Name_String (Chars (Error_Msg_Node_1)); Set_Msg_Name_Buffer; return; elsif Error_Msg_Node_1 = Universal_Real then Set_Msg_Str ("type universal real"); return; elsif Error_Msg_Node_1 = Universal_Integer then Set_Msg_Str ("type universal integer"); return; elsif Error_Msg_Node_1 = Universal_Fixed then Set_Msg_Str ("type universal fixed"); return; end if; -- Special case of anonymous array if Nkind (Error_Msg_Node_1) in N_Entity and then Is_Array_Type (Error_Msg_Node_1) and then Present (Related_Array_Object (Error_Msg_Node_1)) then Set_Msg_Str ("type of "); Set_Msg_Node (Related_Array_Object (Error_Msg_Node_1)); Set_Msg_Str (" declared"); Set_Msg_Insertion_Line_Number (Sloc (Related_Array_Object (Error_Msg_Node_1)), Flag); return; end if; -- If we fall through, it is not a special case, so first output -- the name of the type, preceded by private for a private type if Is_Private_Type (Error_Msg_Node_1) then Set_Msg_Str ("private type "); else Set_Msg_Str ("type "); end if; Ent := Error_Msg_Node_1; if Is_Internal_Name (Chars (Ent)) then Unwind_Internal_Type (Ent); end if; -- Types in Standard are displayed as "Standard.name" if Sloc (Ent) <= Standard_Location then Set_Msg_Quote; Set_Msg_Str ("Standard."); Set_Msg_Node (Ent); Add_Class; Set_Msg_Quote; -- Types in other language defined units are displayed as -- "package-name.type-name" elsif Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Ent))) then Get_Unqualified_Decoded_Name_String (Unit_Name (Get_Source_Unit (Ent))); Name_Len := Name_Len - 2; Set_Msg_Quote; Set_Casing (Mixed_Case); Set_Msg_Name_Buffer; Set_Msg_Char ('.'); Set_Casing (Mixed_Case); Set_Msg_Node (Ent); Add_Class; Set_Msg_Quote; -- All other types display as "type name" defined at line xxx -- possibly qualified if qualification is requested. else Set_Msg_Quote; Set_Qualification (Error_Msg_Qual_Level, Ent); Set_Msg_Node (Ent); Add_Class; Set_Msg_Quote; end if; -- If the original type did not come from a predefined -- file, add the location where the type was defined. if Sloc (Error_Msg_Node_1) > Standard_Location and then not Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Error_Msg_Node_1))) then Set_Msg_Str (" defined"); Set_Msg_Insertion_Line_Number (Sloc (Error_Msg_Node_1), Flag); -- If it did come from a predefined file, deal with the case where -- this was a file with a generic instantiation from elsewhere. else if Sloc (Error_Msg_Node_1) > Standard_Location then declare Iloc : constant Source_Ptr := Instantiation_Location (Sloc (Error_Msg_Node_1)); begin if Iloc /= No_Location and then not Suppress_Instance_Location then Set_Msg_Str (" from instance"); Set_Msg_Insertion_Line_Number (Iloc, Flag); end if; end; end if; end if; end Set_Msg_Insertion_Type_Reference; ---------------------------- -- Set_Msg_Insertion_Uint -- ---------------------------- procedure Set_Msg_Insertion_Uint is begin Set_Msg_Blank; UI_Image (Error_Msg_Uint_1); for J in 1 .. UI_Image_Length loop Set_Msg_Char (UI_Image_Buffer (J)); end loop; -- The following assignment ensures that a second carret insertion -- character will correspond to the Error_Msg_Uint_2 parameter. Error_Msg_Uint_1 := Error_Msg_Uint_2; end Set_Msg_Insertion_Uint; --------------------------------- -- Set_Msg_Insertion_Unit_Name -- --------------------------------- procedure Set_Msg_Insertion_Unit_Name is begin if Error_Msg_Unit_1 = No_Name then null; elsif Error_Msg_Unit_1 = Error_Name then Set_Msg_Blank; Set_Msg_Str ("<error>"); else Get_Unit_Name_String (Error_Msg_Unit_1); Set_Msg_Blank; Set_Msg_Quote; Set_Msg_Name_Buffer; Set_Msg_Quote; end if; -- The following assignment ensures that a second percent insertion -- character will correspond to the Error_Msg_Unit_2 parameter. Error_Msg_Unit_1 := Error_Msg_Unit_2; end Set_Msg_Insertion_Unit_Name; ----------------- -- Set_Msg_Int -- ----------------- procedure Set_Msg_Int (Line : Int) is begin if Line > 9 then Set_Msg_Int (Line / 10); end if; Set_Msg_Char (Character'Val (Character'Pos ('0') + (Line rem 10))); end Set_Msg_Int; ------------------------- -- Set_Msg_Name_Buffer -- ------------------------- procedure Set_Msg_Name_Buffer is begin for J in 1 .. Name_Len loop Set_Msg_Char (Name_Buffer (J)); end loop; end Set_Msg_Name_Buffer; ------------------ -- Set_Msg_Node -- ------------------ procedure Set_Msg_Node (Node : Node_Id) is Ent : Entity_Id; Nam : Name_Id; begin if Nkind (Node) = N_Designator then Set_Msg_Node (Name (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Identifier (Node)); return; elsif Nkind (Node) = N_Defining_Program_Unit_Name then Set_Msg_Node (Name (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Defining_Identifier (Node)); return; elsif Nkind (Node) = N_Selected_Component then Set_Msg_Node (Prefix (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Selector_Name (Node)); return; end if; -- The only remaining possibilities are identifiers, defining -- identifiers, pragmas, and pragma argument associations, i.e. -- nodes that have a Chars field. -- Internal names generally represent something gone wrong. An exception -- is the case of internal type names, where we try to find a reasonable -- external representation for the external name if Is_Internal_Name (Chars (Node)) and then ((Is_Entity_Name (Node) and then Present (Entity (Node)) and then Is_Type (Entity (Node))) or else (Nkind (Node) = N_Defining_Identifier and then Is_Type (Node))) then if Nkind (Node) = N_Identifier then Ent := Entity (Node); else Ent := Node; end if; Unwind_Internal_Type (Ent); Nam := Chars (Ent); else Nam := Chars (Node); end if; -- At this stage, the name to output is in Nam Get_Unqualified_Decoded_Name_String (Nam); -- Remove trailing upper case letters from the name (useful for -- dealing with some cases of internal names. while Name_Len > 1 and then Name_Buffer (Name_Len) in 'A' .. 'Z' loop Name_Len := Name_Len - 1; end loop; -- If we have any of the names from standard that start with the -- characters "any " (e.g. Any_Type), then kill the message since -- almost certainly it is a junk cascaded message. if Name_Len > 4 and then Name_Buffer (1 .. 4) = "any " then Kill_Message := True; end if; -- Now we have to set the proper case. If we have a source location -- then do a check to see if the name in the source is the same name -- as the name in the Names table, except for possible differences -- in case, which is the case when we can copy from the source. declare Src_Loc : constant Source_Ptr := Sloc (Error_Msg_Node_1); Sbuffer : Source_Buffer_Ptr; Ref_Ptr : Integer; Src_Ptr : Source_Ptr; begin Ref_Ptr := 1; Src_Ptr := Src_Loc; -- Determine if the reference we are dealing with corresponds -- to text at the point of the error reference. This will often -- be the case for simple identifier references, and is the case -- where we can copy the spelling from the source. if Src_Loc /= No_Location and then Src_Loc > Standard_Location then Sbuffer := Source_Text (Get_Source_File_Index (Src_Loc)); while Ref_Ptr <= Name_Len loop exit when Fold_Lower (Sbuffer (Src_Ptr)) /= Fold_Lower (Name_Buffer (Ref_Ptr)); Ref_Ptr := Ref_Ptr + 1; Src_Ptr := Src_Ptr + 1; end loop; end if; -- If we get through the loop without a mismatch, then output -- the name the way it is spelled in the source program if Ref_Ptr > Name_Len then Src_Ptr := Src_Loc; for J in 1 .. Name_Len loop Name_Buffer (J) := Sbuffer (Src_Ptr); Src_Ptr := Src_Ptr + 1; end loop; -- Otherwise set the casing using the default identifier casing else Set_Casing (Identifier_Casing (Flag_Source), Mixed_Case); end if; end; Set_Msg_Name_Buffer; Add_Class; -- Add 'Class if class wide type if Class_Flag then Set_Msg_Char ('''); Get_Name_String (Name_Class); Set_Casing (Identifier_Casing (Flag_Source), Mixed_Case); Set_Msg_Name_Buffer; end if; end Set_Msg_Node; ------------------- -- Set_Msg_Quote -- ------------------- procedure Set_Msg_Quote is begin if not Manual_Quote_Mode then Set_Msg_Char ('"'); end if; end Set_Msg_Quote; ----------------- -- Set_Msg_Str -- ----------------- procedure Set_Msg_Str (Text : String) is begin for J in Text'Range loop Set_Msg_Char (Text (J)); end loop; end Set_Msg_Str; ------------------ -- Set_Msg_Text -- ------------------ procedure Set_Msg_Text (Text : String; Flag : Source_Ptr) is C : Character; -- Current character P : Natural; -- Current index; begin Manual_Quote_Mode := False; Is_Unconditional_Msg := False; Msglen := 0; Flag_Source := Get_Source_File_Index (Flag); P := Text'First; while P <= Text'Last loop C := Text (P); P := P + 1; -- Check for insertion character if C = '%' then Set_Msg_Insertion_Name; elsif C = '$' then Set_Msg_Insertion_Unit_Name; elsif C = '{' then Set_Msg_Insertion_File_Name; elsif C = '}' then Set_Msg_Insertion_Type_Reference (Flag); elsif C = '*' then Set_Msg_Insertion_Reserved_Name; elsif C = '&' then Set_Msg_Insertion_Node; elsif C = '#' then Set_Msg_Insertion_Line_Number (Error_Msg_Sloc, Flag); elsif C = '\' then Continuation := True; elsif C = '@' then Set_Msg_Insertion_Column; elsif C = '^' then Set_Msg_Insertion_Uint; elsif C = '`' then Manual_Quote_Mode := not Manual_Quote_Mode; Set_Msg_Char ('"'); elsif C = '!' then Is_Unconditional_Msg := True; elsif C = '?' then null; elsif C = ''' then Set_Msg_Char (Text (P)); P := P + 1; -- Upper case letter (start of reserved word if 2 or more) elsif C in 'A' .. 'Z' and then P <= Text'Last and then Text (P) in 'A' .. 'Z' then P := P - 1; Set_Msg_Insertion_Reserved_Word (Text, P); -- Normal character with no special treatment else Set_Msg_Char (C); end if; end loop; end Set_Msg_Text; ------------------------------ -- Set_Next_Non_Deleted_Msg -- ------------------------------ procedure Set_Next_Non_Deleted_Msg (E : in out Error_Msg_Id) is begin if E = No_Error_Msg then return; else loop E := Errors.Table (E).Next; exit when E = No_Error_Msg or else not Errors.Table (E).Deleted; end loop; end if; end Set_Next_Non_Deleted_Msg; ---------------- -- Set_Posted -- ---------------- procedure Set_Posted (N : Node_Id) is P : Node_Id; begin -- We always set Error_Posted on the node itself Set_Error_Posted (N); -- If it is a subexpression, then set Error_Posted on parents -- up to and including the first non-subexpression construct. This -- helps avoid cascaded error messages within a single expression. P := N; loop P := Parent (P); exit when No (P); Set_Error_Posted (P); exit when Nkind (P) not in N_Subexpr; end loop; end Set_Posted; ----------------------- -- Set_Qualification -- ----------------------- procedure Set_Qualification (N : Nat; E : Entity_Id) is begin if N /= 0 and then Scope (E) /= Standard_Standard then Set_Qualification (N - 1, Scope (E)); Set_Msg_Node (Scope (E)); Set_Msg_Char ('.'); end if; end Set_Qualification; --------------------------- -- Set_Warnings_Mode_Off -- --------------------------- procedure Set_Warnings_Mode_Off (Loc : Source_Ptr) is begin -- Don't bother with entries from instantiation copies, since we -- will already have a copy in the template, which is what matters if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then return; end if; -- If last entry in table already covers us, this is a redundant -- pragma Warnings (Off) and can be ignored. This also handles the -- case where all warnings are suppressed by command line switch. if Warnings.Last >= Warnings.First and then Warnings.Table (Warnings.Last).Start <= Loc and then Loc <= Warnings.Table (Warnings.Last).Stop then return; -- Otherwise establish a new entry, extending from the location of -- the pragma to the end of the current source file. This ending -- point will be adjusted by a subsequent pragma Warnings (On). else Warnings.Increment_Last; Warnings.Table (Warnings.Last).Start := Loc; Warnings.Table (Warnings.Last).Stop := Source_Last (Current_Source_File); end if; end Set_Warnings_Mode_Off; -------------------------- -- Set_Warnings_Mode_On -- -------------------------- procedure Set_Warnings_Mode_On (Loc : Source_Ptr) is begin -- Don't bother with entries from instantiation copies, since we -- will already have a copy in the template, which is what matters if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then return; end if; -- Nothing to do unless command line switch to suppress all warnings -- is off, and the last entry in the warnings table covers this -- pragma Warnings (On), in which case adjust the end point. if (Warnings.Last >= Warnings.First and then Warnings.Table (Warnings.Last).Start <= Loc and then Loc <= Warnings.Table (Warnings.Last).Stop) and then Warning_Mode /= Suppress then Warnings.Table (Warnings.Last).Stop := Loc; end if; end Set_Warnings_Mode_On; ---------------------- -- Test_Warning_Msg -- ---------------------- procedure Test_Warning_Msg (Msg : String) is begin if Msg'Length > 7 and then Msg (1 .. 7) = "(style)" then Is_Warning_Msg := True; return; end if; for J in Msg'Range loop if Msg (J) = '?' and then (J = Msg'First or else Msg (J - 1) /= ''') then Is_Warning_Msg := True; return; end if; end loop; Is_Warning_Msg := False; end Test_Warning_Msg; -------------------------- -- Unwind_Internal_Type -- -------------------------- procedure Unwind_Internal_Type (Ent : in out Entity_Id) is Derived : Boolean := False; Mchar : Character; Old_Ent : Entity_Id; begin -- Undo placement of a quote, since we will put it back later Mchar := Msg_Buffer (Msglen); if Mchar = '"' then Msglen := Msglen - 1; end if; -- The loop here deals with recursive types, we are trying to -- find a related entity that is not an implicit type. Note -- that the check with Old_Ent stops us from getting "stuck". -- Also, we don't output the "type derived from" message more -- than once in the case where we climb up multiple levels. loop Old_Ent := Ent; -- Implicit access type, use directly designated type if Is_Access_Type (Ent) then Set_Msg_Str ("access to "); Ent := Directly_Designated_Type (Ent); -- Classwide type elsif Is_Class_Wide_Type (Ent) then Class_Flag := True; Ent := Root_Type (Ent); -- Use base type if this is a subtype elsif Ent /= Base_Type (Ent) then Buffer_Remove ("type "); -- Avoid duplication "subtype of subtype of", and also replace -- "derived from subtype of" simply by "derived from" if not Buffer_Ends_With ("subtype of ") and then not Buffer_Ends_With ("derived from ") then Set_Msg_Str ("subtype of "); end if; Ent := Base_Type (Ent); -- If this is a base type with a first named subtype, use the -- first named subtype instead. This is not quite accurate in -- all cases, but it makes too much noise to be accurate and -- add 'Base in all cases. Note that we only do this is the -- first named subtype is not itself an internal name. This -- avoids the obvious loop (subtype->basetype->subtype) which -- would otherwise occur!) elsif Present (Freeze_Node (Ent)) and then Present (First_Subtype_Link (Freeze_Node (Ent))) and then not Is_Internal_Name (Chars (First_Subtype_Link (Freeze_Node (Ent)))) then Ent := First_Subtype_Link (Freeze_Node (Ent)); -- Otherwise use root type else if not Derived then Buffer_Remove ("type "); -- Test for "subtype of type derived from" which seems -- excessive and is replaced by simply "type derived from" Buffer_Remove ("subtype of"); -- Avoid duplication "type derived from type derived from" if not Buffer_Ends_With ("type derived from ") then Set_Msg_Str ("type derived from "); end if; Derived := True; end if; Ent := Etype (Ent); end if; -- If we are stuck in a loop, get out and settle for the internal -- name after all. In this case we set to kill the message if it -- is not the first error message (we really try hard not to show -- the dirty laundry of the implementation to the poor user!) if Ent = Old_Ent then Kill_Message := True; exit; end if; -- Get out if we finally found a non-internal name to use exit when not Is_Internal_Name (Chars (Ent)); end loop; if Mchar = '"' then Set_Msg_Char ('"'); end if; end Unwind_Internal_Type; ------------------------- -- Warnings_Suppressed -- ------------------------- function Warnings_Suppressed (Loc : Source_Ptr) return Boolean is begin for J in Warnings.First .. Warnings.Last loop if Warnings.Table (J).Start <= Loc and then Loc <= Warnings.Table (J).Stop then return True; end if; end loop; return False; end Warnings_Suppressed; end Errout;
programs/oeis/139/A139620.asm
neoneye/loda
22
161757
; A139620: a(n) = 190*n + 20. ; 20,210,400,590,780,970,1160,1350,1540,1730,1920,2110,2300,2490,2680,2870,3060,3250,3440,3630,3820,4010,4200,4390,4580,4770,4960,5150,5340,5530,5720,5910,6100,6290,6480,6670,6860,7050,7240,7430,7620,7810,8000,8190,8380,8570,8760,8950,9140,9330,9520,9710,9900,10090,10280,10470,10660,10850,11040,11230,11420,11610,11800,11990,12180,12370,12560,12750,12940,13130,13320,13510,13700,13890,14080,14270,14460,14650,14840,15030,15220,15410,15600,15790,15980,16170,16360,16550,16740,16930,17120,17310,17500,17690,17880,18070,18260,18450,18640,18830 mul $0,190 add $0,20
programs/oeis/000/A000326.asm
neoneye/loda
22
89225
; A000326: Pentagonal numbers: a(n) = n*(3*n-1)/2. ; 0,1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882,3015,3151,3290,3432,3577,3725,3876,4030,4187,4347,4510,4676,4845,5017,5192,5370,5551,5735,5922,6112,6305,6501,6700,6902,7107,7315,7526,7740,7957,8177,8400,8626,8855,9087,9322,9560,9801,10045,10292,10542,10795,11051,11310,11572,11837,12105,12376,12650,12927,13207,13490,13776,14065,14357,14652 mul $0,3 bin $0,2 div $0,3
src/spat-command_line.ads
yannickmoy/spat
0
9919
------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); ------------------------------------------------------------------------------ -- -- SPARK Proof Analysis Tool -- -- S.P.A.T. - Command line parser -- ------------------------------------------------------------------------------ with GNATCOLL.Opt_Parse; with SPAT.Spark_Info; package SPAT.Command_Line is -- Report filter mode. -- Show all, show failed only, show unproved, show unjustified. -- Later ones imply earlier ones. type Report_Mode is (All_Proofs, Failed, Unproved, Unjustified, None); Parser : GNATCOLL.Opt_Parse.Argument_Parser := GNATCOLL.Opt_Parse.Create_Argument_Parser (Help => "Parses .spark files and outputs information about them.", Command_Name => "run_spat"); -- Before using the below functions you should have called Parser.Parse and -- evaluated its return status. --------------------------------------------------------------------------- -- Convert --------------------------------------------------------------------------- function Convert (Value : in String) return SPAT.Spark_Info.Sorting_Criterion; --------------------------------------------------------------------------- -- Convert --------------------------------------------------------------------------- function Convert (Value : in String) return Report_Mode; --------------------------------------------------------------------------- -- Convert --------------------------------------------------------------------------- function Convert (Value : in String) return SPAT.Spark_Info.Sorting_Criterion is (if Value = "a" then SPAT.Spark_Info.Name elsif Value = "t" then SPAT.Spark_Info.Time else (raise GNATCOLL.Opt_Parse.Opt_Parse_Error with "unknown parameter """ & Value & """")); --------------------------------------------------------------------------- -- Convert --------------------------------------------------------------------------- function Convert (Value : in String) return Report_Mode is (if Value in "all" | "a" then All_Proofs elsif Value in "failed" | "f" then Failed elsif Value in "unproved" | "u" then Unproved elsif Value in "unjustified" | "j" then Unjustified else (raise GNATCOLL.Opt_Parse.Opt_Parse_Error with "unknown parameter """ & Value & """")); -- Command line options (in order of importance/mode). -- Project file (mandatory). package Project is new GNATCOLL.Opt_Parse.Parse_Option (Parser => Parser, Short => "-P", Long => "--project", Help => "PROJECT = GNAT project file (.gpr) (mandatory!)", Arg_Type => SPAT.Subject_Name, Default_Val => SPAT.Null_Name, Convert => SPAT.To_Name); -- Summary mode. package Summary is new GNATCOLL.Opt_Parse.Parse_Flag (Parser => Parser, Short => "-s", Long => "--summary", Help => "List summary (per file)"); -- Report mode. package Report is new -- Any of the list modes. GNATCOLL.Opt_Parse.Parse_Option (Parser => Parser, Short => "-r", Long => "--report-mode", Help => "Report output (REPORT-MODE: a = all, f = failed, u = unproved, j = unjustified)", Arg_Type => Report_Mode, Convert => Convert, Default_Val => None); -- Valid for summary and list mode. package Sort_By is new GNATCOLL.Opt_Parse.Parse_Option (Parser => Parser, Short => "-c", Long => "--sort-by", Help => "Sort output (SORT-BY: a = alphabetical, t = by time)", Arg_Type => SPAT.Spark_Info.Sorting_Criterion, Convert => Convert, Default_Val => SPAT.Spark_Info.None); package Details is new GNATCOLL.Opt_Parse.Parse_Flag (Parser => Parser, Short => "-d", Long => "--details", Help => "Show details for entities (list mode)"); package Version is new GNATCOLL.Opt_Parse.Parse_Flag (Parser => Parser, Short => "-V", Long => "--version", Help => "Show version information and exit"); end SPAT.Command_Line;
Appl/FileMgrs2/CommonDesktop/CTool/ctoolToolMgr.asm
steakknife/pcgeos
504
82702
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: File Managers MODULE: Installable Tools -- Tool Manager object FILE: ctoolToolMgr.asm AUTHOR: <NAME>, Aug 25, 1992 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 8/25/92 Initial revision DESCRIPTION: Implementation of ToolManager class $Id: ctoolToolMgr.asm,v 1.1 97/04/04 15:02:28 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ToolCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMMangleActiveList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add or remove ourselves from the active list, depending on what the caller tells us to do. CALLED BY: (INTERNAL) TMSpecBuild, TMDetach PASS: *ds:si = ToolManager object ax = MSG_META_GCN_LIST_ADD or MSG_META_GCN_LIST_REMOVE RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di SIDE EFFECTS: object added to or removed from the app's active list PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMMangleActiveList proc near class ToolManagerClass .enter mov dx, size GCNListParams sub sp, dx mov bp, sp mov ss:[bp].GCNLP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS mov ss:[bp].GCNLP_ID.GCNLT_type, MGCNLT_ACTIVE_LIST mov bx, ds:[LMBH_handle] mov ss:[bp].GCNLP_optr.handle, bx mov ss:[bp].GCNLP_optr.chunk, si push si clr bx ; current thread... call GeodeGetAppObject mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_STACK call ObjMessage pop si add sp, size GCNListParams .leave ret TMMangleActiveList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMProcessTool %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Process an individual FMToolStruct, creating the ToolTrigger object for the beast, etc. CALLED BY: (INTERNAL) TMProcessLibrary PASS: *ds:si = ToolManager es:di = FMToolStruct dx = index of library in ToolManager's array bp = tool index within the library of this tool RETURN: nothing DESTROYED: ax, bx, bp SIDE EFFECTS: an ignoreDirty ToolTrigger will be created and initialized and added as the final child PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMProcessTool proc near class ToolManagerClass uses dx, di, cx, es setupArgs local ToolTriggerSetupArgs \ push bp, ; TTSA_number dx, ; TTSA_library es, di ; TTSA_toolStruct .enter ; ; Create the object. ; segmov es, <segment ToolTriggerClass>, di mov di, offset ToolTriggerClass mov bx, ds:[LMBH_handle] push bp, si call GenInstantiateIgnoreDirty ; ; Initialize it. ; lea bp, ss:[setupArgs] mov dx, size setupArgs mov ax, MSG_TT_SETUP call ObjCallInstanceNoLock ; ; Add it as our last child. ; mov dx, si mov cx, ds:[LMBH_handle] ; ^lcx:dx <- ToolTrigger pop si ; *ds:si <- ToolManager mov ax, MSG_GEN_ADD_CHILD mov bp, CCO_LAST call ObjCallInstanceNoLock ; ; Tell the thing the most-recent selection state we received. ; push si mov si, ds:[si] add si, ds:[si].ToolManager_offset mov cx, ds:[si].TMI_selectState mov si, dx ; *ds:si <- ToolTrigger mov ax, MSG_TT_SET_FILE_SELECTION_STATE call ObjCallInstanceNoLock ; ; Set the thing usable. Update mode is manual, as we're in the process ; of building; the update will be done when that's complete. ; mov ax, MSG_GEN_SET_USABLE mov dl, VUM_MANUAL call ObjCallInstanceNoLock pop bp, si .leave ret TMProcessTool endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMProcessLibrary %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Process a single tool library we found CALLED BY: (INTERNAL) TMProcessLibraries PASS: *ds:si = ToolManager object *ds:di = array to which we're adding ToolLibrary structs es:dx = FileLongName of next library to process RETURN: nothing DESTROYED: ax, bp SIDE EFFECTS: a new ToolLibrary structure is appended to the array PSEUDO CODE/STRATEGY: Figure index of this library (it's the count of things in the array currently) Append a ToolLibrary structure Copy the name in. Load the library. Ask it for its tool table Foreach tool: Instantiate a new ToolTrigger object (ignore dirty) set it up add it as last child set it usable, with manual update REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMProcessLibrary proc near class ToolManagerClass uses bx, cx, dx, es, di .enter ; ; Figure index of the library ; push si ; save tool manager mov si, di call ChunkArrayGetCount ; ; Append new descriptor to the array. ; push cx ; save library index for setup call ChunkArrayAppend ; ; Copy in the file name. ; segxchg ds, es push si mov si, dx mov cx, size FileLongName CheckHack <offset TL_name eq 0 and \ size TL_name eq size FileLongName> rep movsb ; ; Load in the library. ; mov bx, FMTOOL_PROTO_MINOR mov ax, FMTOOL_PROTO_MAJOR mov si, dx call GeodeUseLibrary pop si segmov ds, es jc loadFailed CheckHack <offset TL_handle eq offset TL_name + size TL_name> mov ds:[di], bx ; sp -> index, tmchunk ; ds = name block ; es = object block ; ; Ask the library what tools it has to provide. ; mov ax, GGIT_ATTRIBUTES call GeodeGetInfo push ax test ax, mask GA_ENTRY_POINTS_IN_C jnz fetchToolsFromCLibrary mov ax, FMTF_FETCH_TOOLS call ProcGetLibraryEntry call ProcCallFixedOrMovable ; cx <- # tools, es:di <- array haveToolTable: EC < tst cx > EC < ERROR_Z IMPORTED_TOOL_LIBRARY_PROVIDES_NO_TOOLS > ; ; Loop over all the tools, processing each in turn. ; pop ax ; ax <- library GeodeAttrs pop dx ; dx <- library index pop si ; *ds:si <- tool manager push ax ; save library GeodeAttrs push bx ; and possible original segment ; for unlock clr bp toolLoop: call TMProcessTool add di, size FMToolStruct inc bp loop toolLoop ; ; Unlock the table if we locked it. ; pop bx pop ax test ax, mask GA_ENTRY_POINTS_IN_C jz done call MemUnlockFixedOrMovable done: .leave ret loadFailed: ; ; Couldn't load the library, so nuke the entry we created for it. ; sub di, size FileLongName call ChunkArrayDelete pop cx pop si jmp done fetchToolsFromCLibrary: sub sp, 4 ; make room for return of ; far pointer mov ax, sp push ss, ax ; pass address of room on stack mov ax, FMTF_FETCH_TOOLS call ProcGetLibraryEntry call ProcCallFixedOrMovable mov_tr cx, ax ; cx <- # tools pop bx, di ; bx:di <- virtual fptr call MemLockFixedOrMovable mov es, ax ; es:di <- actual fptr to table jmp haveToolTable TMProcessLibrary endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMProcessLibraries %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Process the buffer of tools FileEnumPtr returned to us. CALLED BY: (INTERNAL) TMSpecBuild PASS: *ds:si = ToolManager object ^hbx = array of FileLongNames of found libraries cx = number of libraries found RETURN: nothing DESTROYED: ax, bx, cx, dx, bp SIDE EFFECTS: block is freed, ToolLibrary descriptors are added to the array pointed to by the TMI_tools instance variable. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMProcessLibraries proc near class ToolManagerClass .enter ; ; Fetch the chunk of the array we'll build. ; mov di, ds:[si] add di, ds:[di].ToolManager_offset mov di, ds:[di].TMI_tools ; ; Lock down the block of names. ; call MemLock mov es, ax clr dx ; ; Loop over all the names, processing each in turn. ; toolLoop: call TMProcessLibrary add dx, size FileLongName loop toolLoop ; ; Free the block o' names ; call MemFree .leave ret TMProcessLibraries endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMSpecBuild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Build up the list of tools found in [SP_SYSTEM]\FILEMGR CALLED BY: MSG_SPEC_BUILD PASS: *ds:si = ToolManager object ds:di = ToolManagerInstance bp = SpecBuildFlags RETURN: nothing DESTROYED: allowed: ax, cx, dx, bp SIDE EFFECTS: lots o' hooey PSEUDO CODE/STRATEGY: push to [SP_SYSTEM]\FILEMGR call FileEnum to locate all geodes with FMTL as token chars foreach geode: load the library ask it for its table of tools. foreach tool: create a ToolTrigger object set it up add as child set usable with manual update unload library? REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LocalDefNLString systemSubdir <C_BACKSLASH, "FILEMGR", 0> ; Subdirectory of SP_SYSTEM to find tools tmsbEnumParams FileEnumParams < mask FESF_GEOS_EXECS, ; FEP_searchFlags FESRT_NAME, ; FEP_returnAttrs size FileLongName, ; FEP_returnSize tmsbMatchAttrs, ; FEP_matchAttrs FE_BUFSIZE_UNLIMITED ; FEP_bufSize > tmsbMatchAttrs FileExtAttrDesc \ <FEA_TOKEN, toolToken, size GT_chars>, ; match GT_chars, only <FEA_END_OF_LIST> if FULL_EXECUTE_IN_PLACE FixedCode segment resource else idata segment endif toolToken GeodeToken <<'FMTL'>, 0> if FULL_EXECUTE_IN_PLACE FixedCode ends else idata ends endif TMSpecBuild method dynamic ToolManagerClass, MSG_SPEC_BUILD uses bp, es .enter ; ; Push to directory in which we'll find the tools. ; call FilePushDir mov bx, SP_SYSTEM push ds segmov ds, cs mov dx, offset systemSubdir call FileSetCurrentPath jnc doEnum enumFailed: pop ds jmp callSuper doEnum: push si mov si, offset tmsbEnumParams call FileEnumPtr pop si jc enumFailed jcxz enumFailed pop ds ; ; Now process all those files we found. ; call TMProcessLibraries callSuper: ; ; Return to previous directory. ; call FilePopDir ; ; Add ourselves to the active list so we can be sure to unload all ; the libraries we've loaded before the app goes away. ; mov ax, MSG_META_GCN_LIST_ADD call TMMangleActiveList .leave ; ; Let our superclass actually do all the building that needs to take ; place, now we've created all the kids we need to create. ; mov ax, MSG_SPEC_BUILD mov di, offset ToolManagerClass GOTO ObjCallSuperNoLock TMSpecBuild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMSetFileSelectionState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tell our children whether there are any files or directories selected. CALLED BY: MSG_TM_SET_FILE_SELECTION_STATE PASS: *ds:si = ToolManager object cx = non-zero if anything is selected RETURN: nothing DESTROYED: allowed: ax, cx, dx, bp SIDE EFFECTS: things might be enabled or disabled PSEUDO CODE/STRATEGY: Just call our generic children, passing the info along REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMSetFileSelectionState method dynamic ToolManagerClass, MSG_TM_SET_FILE_SELECTION_STATE .enter mov ds:[di].TMI_selectState, cx mov ax, MSG_TT_SET_FILE_SELECTION_STATE call GenSendToChildren .leave ret TMSetFileSelectionState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMActivateToolOnProcessThread %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call the appropriate routine in the tool library on the process thread, rather than here on the UI thread. CALLED BY: MSG_TM_ACTIVATE_TOOL_ON_PROCESS_THREAD PASS: *ds:si = ToolManager object cx = library number bp = routine number to call dx = tool number (within library) that was activated RETURN: nothing DESTROYED: allowed: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMActivateToolOnProcessThread method dynamic ToolManagerClass, MSG_TM_ACTIVATE_TOOL_ON_PROCESS_THREAD .enter ; ; Point to the ToolLibrary structure for the beast. ; mov_tr ax, cx mov si, ds:[di].TMI_tools call ChunkArrayElementToPtr ; ; Fetch out the library handle and queue a message to our process ; asking it to contact the library in question. ; mov cx, ds:[di].TL_handle mov si, bp mov ax, MSG_DESKTOP_CALL_TOOL_LIBRARY call GeodeGetProcessHandle mov di, mask MF_FORCE_QUEUE call ObjMessage .leave ret TMActivateToolOnProcessThread endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMDetach %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Unload any libraries we loaded before acknowledging the detach. CALLED BY: MSG_META_DETACH PASS: *ds:si = ToolManager object ds:di = ToolManagerInstance cx = caller's ID dx:bp = callers OD RETURN: nothing DESTROYED: allowed: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMDetach method dynamic ToolManagerClass, MSG_META_DETACH uses cx, dx, bp, si, ax .enter push si mov si, ds:[di].TMI_tools mov bx, cs mov di, offset TMD_callback call ChunkArrayEnum ; ; Remove ourselves from the app's active list so we don't get brought ; in on start-up. ; pop si mov ax, MSG_META_GCN_LIST_REMOVE call TMMangleActiveList .leave mov di, offset ToolManagerClass GOTO ObjCallSuperNoLock TMDetach endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMD_callback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback routine to unload all tool libraries we loaded, before the app goes away CALLED BY: TMDetach via ChunkArrayEnum PASS: *ds:si = chunk array ds:di = ToolLibrary RETURN: carry set to stop enumerating DESTROYED: allowed: ax, bx, cx, dx, bp, si, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMD_callback proc far .enter clr bx xchg bx, ds:[di].TL_handle tst bx jz done call GeodeFreeLibrary done: clc ; keep iterating .leave ret TMD_callback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ToolManagerRebuild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: rebuild tool library list CALLED BY: MSG_TM_REBUILD PASS: *ds:si = ToolManagerClass object ds:di = ToolManagerClass instance data es = segment of ToolManagerClass ax = MSG_TM_REBUILD RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 6/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ToolManagerRebuild method dynamic ToolManagerClass, MSG_TM_REBUILD ; ; nuke current library references ; push si mov si, ds:[di].TMI_tools mov bx, cs mov di, offset TMD_callback call ChunkArrayEnum pop si ; ; nuke tool triggers ; mov ax, MSG_GEN_DESTROY mov dl, VUM_DELAYED_VIA_UI_QUEUE mov bp, 0 call GenSendToChildren ; ; set not usable then usable, causing SPEC_BUILD when necessary ; mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_DELAYED_VIA_UI_QUEUE call ObjCallInstanceNoLock mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_UI_QUEUE call ObjCallInstanceNoLock ret ToolManagerRebuild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ToolManagerRebuildIfOnDisk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: rebuild tool library list if a library is on passed disk CALLED BY: MSG_TM_REBUILD_IF_ON_DISK PASS: *ds:si = ToolManagerClass object ds:di = ToolManagerClass instance data es = segment of ToolManagerClass ax = MSG_TM_REBUILD RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 6/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ToolManagerRebuildIfOnDisk method dynamic ToolManagerClass, MSG_TM_REBUILD_IF_ON_DISK ; ; nuke current library references ; push si mov si, ds:[di].TMI_tools mov bx, cs mov di, offset TMRIOD_callback call ChunkArrayEnum pop si jnc done ; no match found mov ax, MSG_TM_REBUILD ; else, match -> rebuild call ObjCallInstanceNoLock done: ret ToolManagerRebuildIfOnDisk endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TMRIOD_callback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback routine to check if library is on disk being removed CALLED BY: ToolManagerRebuildIfOnDisk via ChunkArrayEnum PASS: *ds:si = chunk array ds:di = ToolLibrary cx = disk being removed RETURN: carry set to stop enumerating (match, need to rebuild) DESTROYED: allowed: ax, bx, cx, dx, bp, si, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 6/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TMRIOD_callback proc far uses es .enter mov bx, ds:[di].TL_handle tst bx jz done ; (carry clear) call MemLock ; lock GeodeHeader mov es, ax clr ax ; assume not open test es:[GH_geodeAttr], mask GA_KEEP_FILE_OPEN jz checkHandle mov ax, es:[GH_geoHandle] checkHandle: call MemUnlock mov_tr bx, ax ; bx = library file handle tst bx jz done ; (carry clear) call FileGetDiskHandle ; bx = disk handle cmp bx, cx ; same as removed disk? clc ; assume not jne done ; not, keep iterating stc ; else, stop, need to rebuild done: .leave ret TMRIOD_callback endp ToolCode ends
tool-testsuite/test/org/antlr/v4/test/tool/Psl.g4
maximmenshikov/antlr4
11,811
3425
<filename>tool-testsuite/test/org/antlr/v4/test/tool/Psl.g4<gh_stars>1000+ grammar Psl; @parser::members { public void printPosition(String name, Token tok) { System.out.printf("%s: pos %d, len %d%n", name, tok.getCharPositionInLine(), tok.getText().length()); } /** * Checks whether a set of digit groups and commas construct * a valid command-number. * * @param digits * The groups of digits, each group in a separate item. * @param commas * The commas found separating the digit groups. * * There should be one more digit group than commas. * There should be no internal white space. * * @returns true (valid), false (invalid) */ public boolean isValidCommaNumber(List<Token> digits, List<Token> commas) { Token[] aDigits = new Token[0]; Token[] aCommas = new Token[0]; int j; aDigits = digits.toArray(aDigits); aCommas = commas.toArray(aCommas); if (aDigits.length != aCommas.length + 1) { return false; } for (j = 0; j < aCommas.length; ++j) { int p1, p2, p3; p1 = aDigits[j].getCharPositionInLine() + aDigits[j].getText().length(); p2 = aCommas[j].getCharPositionInLine(); p3 = aDigits[j + 1].getCharPositionInLine(); if (p1 != p2 || (p2 + 1) != p3) { return false; } } return true; } /** * Checks whether a the pieces of a floating-point number * construct a valid number. * * @param whole * The whole part of the number. Can be null. * @param period * The decimal point. * @param fraction * The fraction part of the number. Can be null. * * At least one of the whole or fraction must be present. * The decimal point is required. * * @returns true (valid), false (invalid) */ public boolean isValidFloatingConstant( Token whole, Token period, Token fraction ) { boolean foundDigits = false; int column; if (whole != null) { foundDigits = true; column = whole.getCharPositionInLine() + whole.getText().length(); if (column != period.getCharPositionInLine()) { return false; } } if (fraction != null) { foundDigits = true; column = period.getCharPositionInLine() + 1; if (column != fraction.getCharPositionInLine()) { return false; } } return foundDigits; } } translation_unit : numeric_range EOF ; pattern : numeric_range ; numeric_range : EURO_NUMBER PAREN_LEFT numeric_endpoint TILDE numeric_endpoint PAREN_RIGHT | NUMBER PAREN_LEFT numeric_endpoint TILDE numeric_endpoint PAREN_RIGHT ; numeric_endpoint : ( PLUS | MINUS )? integer_constant | ( PLUS | MINUS )? floating_constant | ( PLUS | MINUS )? comma_number ; /* Floating-point numbers and comma numbers are valid only * as numeric endpoints in number() or euro_number(). Otherwise, * the pieces should be parsed as separate lexical tokens, such as * * integer_constant '.' integer_constant * * Because of parser lookahead and the subtle interactions between * the parser and the lexer, changing lexical modes from the parser * is not safe. The code below checks the constraints for floating * numbers, forbidding internal white space. */ floating_constant : comma_number PERIOD fraction=DIGIT_SEQUENCE? { isValidFloatingConstant($comma_number.stop, $PERIOD, $fraction) }?<fail = { "COMMA:A floating-point constant cannot have internal white space" }> /*| whole=DIGIT_SEQUENCE PERIOD fraction=DIGIT_SEQUENCE? { isValidFloatingConstant($whole, $PERIOD, $fraction) }?/* <fail = { "DIG:A floating-point constant cannot have internal white space" }>*/ | PERIOD fraction=DIGIT_SEQUENCE { isValidFloatingConstant(null, $PERIOD, $fraction) }?<fail = { "DEC:A floating-point constant cannot have internal white space" }> ; comma_number : digits+=DIGIT_SEQUENCE ( commas+=COMMA digits+=DIGIT_SEQUENCE )+ { isValidCommaNumber($digits, $commas) }?<fail = { "A comma-number cannot have internal white space" }> ; term_expression : term | RETURN ( PAREN_LEFT ( integer_constant | ALL ) PAREN_RIGHT )? term ; term : pattern | PAREN_LEFT term_expression PAREN_RIGHT ; integer_constant : DIGIT_SEQUENCE | INTEGER_CONSTANT | BINARY_CONSTANT | DECIMAL_CONSTANT | HEXADECIMAL_CONSTANT | OCTAL_CONSTANT ; // LEXER /* Letter fragments */ fragment A: [Aa] ; fragment B: [BB] ; fragment C: [Cc] ; fragment D: [Dd] ; fragment E: [Ee] ; fragment F: [Ff] ; fragment G: [Gg] ; fragment H: [Hh] ; fragment I: [Ii] ; fragment J: [Jj] ; fragment K: [Kk] ; fragment L: [Ll] ; fragment M: [Mm] ; fragment N: [Nn] ; fragment O: [Oo] ; fragment P: [Pp] ; fragment Q: [Qq] ; fragment R: [Rr] ; fragment S: [Ss] ; fragment T: [Tt] ; fragment U: [Uu] ; fragment V: [Vv] ; fragment W: [Ww] ; fragment X: [Xx] ; fragment Y: [Yy] ; fragment Z: [Zz] ; WHITESPACE_IN_LINE : [ \t]+ -> skip ; NEWLINE : '\r'? '\n' -> skip ; WHITESPACE_ALL : [ \n\r\t]+ -> skip ; /* A sequence of decimal digits is useful on its own, * to avoid the base-prefixes (0b, 0x, ...) that an * INTEGER_CONTANT would allow. * Need to define before INTEGER_CONSTANT to make sure * DIGIT_SEQUENCE is recognized before INTEGER_CONSTANT. */ DIGIT_SEQUENCE : [0-9]+ ; INTEGER_CONSTANT : BINARY_CONSTANT | DECIMAL_CONSTANT | HEXADECIMAL_CONSTANT | OCTAL_CONSTANT ; BINARY_CONSTANT : '0' [Bb] [0-1]+ ; DECIMAL_CONSTANT : ( '0' [Dd] )? [0-9]+ ; HEXADECIMAL_CONSTANT : '0' [HhXx] [0-9a-fA-F]+ ; OCTAL_CONSTANT : '0' [Oo] [0-7]+ ; /* keywords */ ALL : A L L ; EURO_NUMBER : E U R O '_' N U M B E R ; NUMBER : N U M B E R ; RETURN : R E T U R N ; IDENTIFIER : [A-Za-z][A-Za-z0-9_]* ; /* The single-character tokens. */ COMMA : ',' ; MINUS : '-' ; PAREN_LEFT : '(' ; PAREN_RIGHT : ')' ; PERIOD : '.' ; PLUS : '+' ; TILDE : '~' ; /* This rule must be last (or nearly last) to avoid * matching individual characters for other rules. */ ANY_CHAR_BUT_NEWLINE : ~[\n\r] ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/cond_expr2.ads
best08618/asylo
7
14354
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/cond_expr2.ads package Cond_Expr2 is function F (X : integer) return String; end Cond_Expr2;
tpantlr2-code/code/reference/Recur.g4
cgonul/antlr-poc
10
2464
lexer grammar Recur; ACTION : '{' ( ACTION | ~[{}] )* '}' ; WS : [ \r\t\n]+ -> skip ;
src/mqtt.ads
jpuente/Temperature_Sensor
0
29930
<reponame>jpuente/Temperature_Sensor ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, Universidad Politécnica de Madrid -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- MQTT client with GNAT.Sockets; use GNAT.Sockets; with GNAT.Sockets.MQTT; use GNAT.Sockets.MQTT; package MQTT is Server_Name : constant String := "xxx.dit.upm.es"; Client_Name : constant String := "xxx"; Port : constant GNAT.Sockets.Port_Type := 1883; QoS : QoS_Level := Exactly_Once; Topic_Text : constant String := "test/temperature"; procedure Publish (Message_Text : String); end MQTT;
oeis/020/A020957.asm
neoneye/loda-programs
11
16392
; A020957: a(n) = Sum_{k >= 1} floor(2*tau^(n-k)). ; Submitted by <NAME> ; 3,6,11,19,32,54,89,147,240,392,637,1035,1678,2720,4405,7133,11546,18688,30243,48941,79194,128146,207351,335509,542872,878394,1421279,2299687,3720980,6020682,9741677,15762375,25504068,41266460,66770545 lpb $0 sub $0,1 sub $4,2 sub $3,$4 mov $2,$3 add $3,1 add $1,$3 add $4,1 div $5,2 mul $5,2 add $5,1 mov $3,$5 add $5,$2 lpe mov $0,$1 add $0,3
src/Holes/Util.agda
bch29/agda-holes
24
1641
module Holes.Util where open import Holes.Prelude private Rel : ∀ {a} → Set a → ∀ ℓ → Set (a ⊔ lsuc ℓ) Rel A ℓ = A → A → Set ℓ module CongSplit {ℓ x} {X : Set x} (_≈_ : Rel X ℓ) (reflexive : ∀ {x} → x ≈ x) where two→one₁ : {_+_ : X → X → X} → (∀ {x x′ y y′} → x ≈ x′ → y ≈ y′ → (x + y) ≈ (x′ + y′)) → (∀ x y {x′} → x ≈ x′ → (x + y) ≈ (x′ + y)) two→one₁ cong² _ _ eq = cong² eq reflexive two→one₂ : {_+_ : X → X → X} → (∀ {x x′ y y′} → x ≈ x′ → y ≈ y′ → (x + y) ≈ (x′ + y′)) → (∀ x y {y′} → y ≈ y′ → (x + y) ≈ (x + y′)) two→one₂ cong² _ _ eq = cong² reflexive eq
Smoola.g4
gsoosk/SmoolaCompiler
5
2067
<reponame>gsoosk/SmoolaCompiler grammar Smoola; @header { import main.Tools.AstMaker; import main.ast.node.*; import main.ast.*; import main.ast.node.expression.*; import main.ast.node.expression.Value.*; import main.ast.node.statement.*; import main.ast.node.declaration.*; import main.ast.Type.*; import main.ast.Type.ArrayType.*; import main.ast.Type.PrimitiveType.*; import main.ast.Type.UserDefinedType.*; import main.ast.node.expression.BinaryExpression.BinaryOperator; import main.ast.node.expression.UnaryExpression.UnaryOperator; } @members { boolean inMain; } program returns [Program p] : { inMain = true; } main = mainClass { Program program = new Program(); program.setMainClass($main.synMainClass); inMain = false; } ( classDec = classDeclaration {program.addClass($classDec.synClassDeclaration);})* EOF { $p = program; } ; mainClass returns [ClassDeclaration synMainClass] : 'class' mainClassName = ID '{' 'def' mainMethodName = 'main' '(' ')' ':' 'int' '{' allStatements = statements 'return' mainVal = expression ';' '}' '}' { $synMainClass = AstMaker.mainClass($mainClassName.text, $mainMethodName.text, $mainVal.synExpression, $allStatements.synStatements); $synMainClass.setLineNumber($mainClassName.getLine()); } ; classDeclaration returns [ClassDeclaration synClassDeclaration] : 'class' name = ID ('extends' parentName = ID)? { $synClassDeclaration = AstMaker.classDeclaration($name.text, $parentName.text); $synClassDeclaration.setLineNumber($name.getLine()); } '{' (varDec = varDeclaration {$synClassDeclaration.addVarDeclaration($varDec.synVarDec);} )* (methodDec = methodDeclaration {$synClassDeclaration.addMethodDeclaration($methodDec.synMethodDeclaration);})* '}' ; varDeclaration returns [VarDeclaration synVarDec] : var = 'var' varName = ID ':' varType = type ';' { $synVarDec = AstMaker.varDeclaration(new Identifier($varName.text), $varType.synType); $synVarDec.setLineNumber($var.getLine()); } ; methodDeclaration returns [MethodDeclaration synMethodDeclaration] : 'def' methodName = ID { $synMethodDeclaration = new MethodDeclaration(new Identifier($methodName.text)); $synMethodDeclaration.setLineNumber($methodName.getLine()); } ('(' ')' | ('(' arg1Id = ID ':' arg1Type = type { VarDeclaration newVarDeclaration = new VarDeclaration(new Identifier($arg1Id.text), $arg1Type.synType); newVarDeclaration.setLineNumber($arg1Id.getLine()); $synMethodDeclaration.addArg(newVarDeclaration); } (',' argId = ID ':' argType = type { VarDeclaration newVarDeclaration1 = new VarDeclaration(new Identifier($argId.text), $argType.synType); newVarDeclaration1.setLineNumber($argId.getLine()); $synMethodDeclaration.addArg(newVarDeclaration1); } )* ')')) ':' returnType = type { $synMethodDeclaration.setReturnType($returnType.synType); } '{' (newVar = varDeclaration { $synMethodDeclaration.addLocalVar($newVar.synVarDec); } )* allStatements = statements { $synMethodDeclaration.setBody($allStatements.synStatements); } 'return' returnVal = expression { $synMethodDeclaration.setReturnValue($returnVal.synExpression); } ';' '}' ; statements returns [ArrayList<Statement> synStatements] : { $synStatements = new ArrayList<>(); ; } (newStatement = statement { $synStatements.add($newStatement.synStatement); } )* ; statement returns [Statement synStatement] : stmB = statementBlock {$synStatement = $stmB.synStatementBlock;} | stmC = statementCondition {$synStatement = $stmC.synStatementCondition;} | stmL = statementLoop {$synStatement = $stmL.synStatementLoop;} | stmW = statementWrite {$synStatement = $stmW.synStatementWrite;} | stmA = statementAssignment {$synStatement = $stmA.synStatementAssign;} ; statementBlock returns [Statement synStatementBlock] : { Block block = new Block(); } '{' allStatements = statements { block.setBody($allStatements.synStatements); $synStatementBlock = block; } '}' ; statementCondition returns [Statement synStatementCondition] : 'if' '(' conditionExp = expression')' 'then' consequenceBody = statement { Conditional conditional = new Conditional($conditionExp.synExpression, $consequenceBody.synStatement); $synStatementCondition = conditional; }('else' altBody = statement { conditional.setAlternativeBody($altBody.synStatement); $synStatementCondition = conditional; } )? ; statementLoop returns [Statement synStatementLoop] : 'while' '(' loopCondition = expression ')' loopBody = statement { $synStatementLoop = new While($loopCondition.synExpression, $loopBody.synStatement); } ; statementWrite returns [Statement synStatementWrite] : val = 'writeln(' arg = expression ')' ';' { $synStatementWrite = new Write($arg.synExpression); $synStatementWrite.setLineNumber($val.getLine()); } ; statementAssignment returns [Statement synStatementAssign] : expr = expression val = ';' { if($expr.BinaryOp != null) { $synStatementAssign = new Assign(((BinaryExpression)$expr.synExpression).getLeft(), ((BinaryExpression)$expr.synExpression).getRight()); } else { $synStatementAssign = new Statement(); if(inMain && $expr.synExpression instanceof MethodCall) $synStatementAssign.setExpression($expr.synExpression); $synStatementAssign.setLineNumber($val.getLine()); } } ; expression returns [Expression synExpression, String BinaryOp] : expr = expressionAssignment { $synExpression = $expr.synExpression; $BinaryOp = $expr.BinaryOp; } ; expressionAssignment returns [Expression synExpression, String BinaryOp] : lExpr = expressionOr val = '=' rExpr = expressionAssignment { $BinaryOp = "="; $synExpression = new BinaryExpression($lExpr.synExpression, $rExpr.synExpression, BinaryOperator.assign); $synExpression.setLineNumber($val.getLine()); } | expr = expressionOr { $BinaryOp = null; $synExpression = $expr.synExpression; } ; expressionOr returns [Expression synExpression] : lExpr = expressionAnd rExpr = expressionOrTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionOrTemp[Expression inhExpression] returns [Expression synExpression] : val = '||' lExpr = expressionAnd { Expression expr = new BinaryExpression($inhExpression, $lExpr.synExpression , BinaryOperator.or); expr.setLineNumber($val.getLine()); } rExpr = expressionOrTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionAnd returns [Expression synExpression] : lExpr = expressionEq rExpr = expressionAndTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionAndTemp[Expression inhExpression] returns [Expression synExpression] : val = '&&' lExpr = expressionEq { Expression expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.and); expr.setLineNumber($val.getLine()); } rExpr = expressionAndTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionEq returns [Expression synExpression] : lExpr = expressionCmp rExpr = expressionEqTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionEqTemp[Expression inhExpression] returns [Expression synExpression] : binaryOp = ('==' | '<>') lExpr = expressionCmp { Expression expr; if($binaryOp.text.equals("==")) expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.eq); else expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.neq); expr.setLineNumber($binaryOp.getLine()); } rExpr = expressionEqTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionCmp returns [Expression synExpression] : lExpr = expressionAdd rExpr = expressionCmpTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionCmpTemp[Expression inhExpression] returns [Expression synExpression] : binaryOp = ('<' | '>') lExpr = expressionAdd { Expression expr; if($binaryOp.text.equals("<")) expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.lt); else expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.gt); expr.setLineNumber($binaryOp.getLine()); } rExpr = expressionCmpTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionAdd returns [Expression synExpression] : lExpr = expressionMult rExpr = expressionAddTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionAddTemp[Expression inhExpression] returns [Expression synExpression] : binaryOp = ('+' | '-') lExpr = expressionMult { Expression expr; if($binaryOp.text.equals("+")) expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.add); else expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.sub); expr.setLineNumber($binaryOp.getLine()); } rExpr = expressionAddTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionMult returns [Expression synExpression] : lExpr = expressionUnary rExpr = expressionMultTemp[$lExpr.synExpression] { $synExpression = $rExpr.synExpression; } ; expressionMultTemp[Expression inhExpression] returns [Expression synExpression] : binaryOp = ('*' | '/') lExpr = expressionUnary { Expression expr; if($binaryOp.text.equals("*")) expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.mult); else expr = new BinaryExpression($inhExpression, $lExpr.synExpression, BinaryOperator.div); expr.setLineNumber($binaryOp.getLine()); } rExpr = expressionMultTemp[expr] { $synExpression = $rExpr.synExpression; } | { $synExpression = $inhExpression; } ; expressionUnary returns [Expression synExpression] : val = '!' uExpr1 = expressionUnary { $synExpression = new UnaryExpression(UnaryOperator.not, $uExpr1.synExpression); $synExpression.setLineNumber($val.getLine()); } |val = '-' uExpr2 = expressionUnary { $synExpression = new UnaryExpression(UnaryOperator.minus, $uExpr2.synExpression); $synExpression.setLineNumber($val.getLine()); } | expr = expressionMem { $synExpression = $expr.synExpression; } ; expressionMem returns [Expression synExpression] : instance = expressionMethods index = expressionMemTemp { if($index.synExpression != null) { $synExpression = new ArrayCall($instance.synExpression, $index.synExpression); $synExpression.setLineNumber($instance.synExpression.getLineNumber()); } else $synExpression = $instance.synExpression; } ; expressionMemTemp returns [Expression synExpression] : '[' index = expression ']' { $synExpression = $index.synExpression; } | { $synExpression = null; } ; expressionMethods returns [Expression synExpression] : inhInstance = expressionOther method = expressionMethodsTemp[$inhInstance.synExpression] { if($method.synExpression != null) $synExpression = $method.synExpression; else $synExpression = $inhInstance.synExpression; } ; expressionMethodsTemp[Expression inhExpression] returns [Expression synExpression] : '.' { Expression method = null; } (methodName = ID '(' ')' { method = new MethodCall($inhExpression, new Identifier($methodName.text)); method.setLineNumber($methodName.getLine()); } | methodName = ID '(' ( arg1 = expression { method = new MethodCall($inhExpression, new Identifier($methodName.text)); ((MethodCall)method).addArg($arg1.synExpression); method.setLineNumber($methodName.getLine()); } (',' arg = expression{((MethodCall)method).addArg($arg.synExpression);})*) ')' | val = 'length' { method = new Length($inhExpression); method.setLineNumber($val.getLine()); } ) { if(method == null) { method = $inhExpression; } } expr = expressionMethodsTemp[method] { if($expr.synExpression != null) $synExpression = $expr.synExpression; else $synExpression = method; } | { $synExpression = null; } ; expressionOther returns [Expression synExpression] : val = CONST_NUM {$synExpression = new IntValue($val.int, new IntType()); $synExpression.setLineNumber($val.getLine());} | val = CONST_STR {$synExpression = new StringValue($val.text, new StringType()); $synExpression.setLineNumber($val.getLine());} | 'new ' 'int' '[' val = CONST_NUM ']' {NewArray arr = new NewArray(); arr.setExpression(new IntValue($val.int, new IntType())); arr.setLineNumber($val.getLine()); $synExpression = arr;} | 'new ' className = ID '(' ')' {$synExpression = new NewClass(new Identifier($className.text)); $synExpression.setLineNumber($className.getLine());} | val = 'this' {$synExpression = new This(); $synExpression.setLineNumber($val.getLine());} | val = 'true' {$synExpression = new BooleanValue(true, new BooleanType()); $synExpression.setLineNumber($val.getLine());} | val = 'false' {$synExpression = new BooleanValue(false, new BooleanType()); $synExpression.setLineNumber($val.getLine());} | val = ID {$synExpression = new Identifier($val.text); $synExpression.setLineNumber($val.getLine());} | val = ID '[' ex = expression ']' {$synExpression = new ArrayCall(new Identifier($val.text), $ex.synExpression); $synExpression.setLineNumber($val.getLine());} | '(' ex = expression ')' {$synExpression = $ex.synExpression; } ; type returns [Type synType] : 'int' {$synType = new IntType();} | 'boolean' {$synType = new BooleanType();} | 'string' {$synType = new StringType();} | 'int' '[' ']' {$synType = new ArrayType(); ((ArrayType)$synType).setSize(-1);} | val = ID {$synType = new UserDefinedType(); ((UserDefinedType)$synType).setName(new Identifier($val.text));} ; CONST_NUM: [0-9]+ ; CONST_STR: '"' ~('\r' | '\n' | '"')* '"' ; NL: '\r'? '\n' -> skip ; ID: [a-zA-Z_][a-zA-Z0-9_]* ; COMMENT: '#'(~[\r\n])* -> skip ; WS: [ \t] -> skip ;
data/mapObjects/ssanne3.asm
adhi-thirumala/EvoYellow
16
3256
SSAnne3Object: db $c ; border block db $2 ; warps db $3, $0, $0, SS_ANNE_5 db $3, $13, $7, SS_ANNE_2 db $0 ; signs db $1 ; objects object SPRITE_SAILOR, $9, $3, WALK, $2, $1 ; person ; warp-to EVENT_DISP SS_ANNE_3_WIDTH, $3, $0 ; SS_ANNE_5 EVENT_DISP SS_ANNE_3_WIDTH, $3, $13 ; SS_ANNE_2