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
oeis/022/A022128.asm
neoneye/loda-programs
11
15580
; A022128: Fibonacci sequence beginning 3, 19. ; Submitted by <NAME>(s4) ; 3,19,22,41,63,104,167,271,438,709,1147,1856,3003,4859,7862,12721,20583,33304,53887,87191,141078,228269,369347,597616,966963,1564579,2531542,4096121,6627663,10723784 mov $1,3 mov $2,16 lpb $0 sub $0,1 mov $3,$2 mov $2,$1 add $1,$3 lpe mov $0,$1
src/Categories/Category/Instance/LawvereTheories.agda
bond15/agda-categories
0
892
<filename>src/Categories/Category/Instance/LawvereTheories.agda {-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.LawvereTheories where -- Category of Lawvere Theories open import Level open import Categories.Category open import Categories.Functor.Cartesian.Properties open import Categories.NaturalTransformation.NaturalIsomorphism open import Categories.Theory.Lawvere LawvereTheories : (o ℓ e : Level) → Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e) LawvereTheories o ℓ e = record { Obj = FiniteProduct o ℓ e ; _⇒_ = LT-Hom ; _≈_ = λ H₁ H₂ → F H₁ ≃ F H₂ ; id = LT-id ; _∘_ = LT-∘ ; assoc = λ { {f = f} {g} {h} → associator (F f) (F g) (F h)} ; sym-assoc = λ { {f = f} {g} {h} → sym-associator (F f) (F g) (F h)} ; identityˡ = unitorˡ ; identityʳ = unitorʳ ; identity² = unitor² ; equiv = record { refl = refl ; sym = sym ; trans = trans } ; ∘-resp-≈ = _ⓘₕ_ } where open LT-Hom
examples/exercicio_3.asm
AlessandroFonseca/util.asm
1
14796
<reponame>AlessandroFonseca/util.asm<gh_stars>1-10 %include '../util.asm' default rel section .text global _main ; ;rótulo no código é como se fosse funçao ;rótulo na área de dados é nome de variável ; _main: ;rotulo inicio do programa mov r10, 0 leitura: call readint lea rdi, [inteiros] mov [rdi+r10*8], rax add r10, 1 cmp r10, 8 je continua jmp leitura continua: mov r10, 0 proximaleitura: lea rdi, [inteiros] mov rax, [rdi+r10*8] mov rbx, 3 mov rdx, 0 ;https://stackoverflow.com/questions/32927651/x86-assembly-nasm-floating-point-exception-not-dividing-by-0 idiv rbx ; rax= rax/rbx ; rdx = rax%rbx cmp rdx,0 je multiplo jmp continua2 multiplo: mov r9, [rdi+r10*8] continua2: add r10, 1 ; incrementar a pos vet cmp r10, 8 ; compara se percorreu todo je mostraultimo jmp proximaleitura mostraultimo: call endl mov rdi, r9 call printint call endl call exit ; termina o programa section .bss; declaração de dados ; int maior; inteiros: resq 8
spkrtubi.asm
vsariola/tubiform
0
1281
org 100h ; at startup, we assume ax = 0x0000, cx = 0x00FF, si = 0x0100, sp = 0xFFFE and most flags zero mov ax, 3508h ; int 21h: ah=35h get interrupt handler, al=1Ch which interrupt int 21h ; returns the handler in es:bx push es ; save the current handler to be able to restore it push bx mov ax, 64 ; PIT counter divisor, al = 64. IRQ init based on superogue's and TomCat's code. scaleconst equ $-1 mov dx, irq ; dx = New handler address mov bl, 0x13 ; bl = New video mode, mode 13h envs: ; envs contains the envelopes of the channels. We put them here to have them initialized call setirq ; into known values (in particular, to have chn 3 initialize as 0). xchg ax, cx out 61h, al ; enable PC speaker push 0xa000 - 10-20*3 ; set es to video segment, shifting 3.5 lines (the top three lines had some visual glitch). pop es main: ; basic tunnel effect, based on HellMood's original from http://www.sizecoding.org/wiki/Floating-point_Opcodes#The_.22Tunnel.22 sub dh, 0x68 ; dh = y, shift it to center the coordinates pusha ; push all registers to stack 0xFFF8: ax, 0xFFF6: cx, 0xFFF4: dx, etc. bx, sp, bp, si, di mov bx,-12 ; 0xFFF4, where the dx is fild word [bx-1] ; fpu: x*256 fild word [bx] ; fpu: y*256(+x) x*256 fpatan ; fpu: theta fst st1 ; fpu: theta theta fprem ; this instruction will be mutated with fsin so for proper tunnel, fpu: sin(theta) theta .effect equ $-1 ; 0xF3, 0xF4, 0xFE and 0xFC are pretty cool visuals for the last byte fimul dword [byte si+scaleconst] ; fpu: const*cos(theta) theta, the constant is what ever the lines there assemble to fidiv word [bx-1] ; fpu: const*sin(theta)/x/256=1/r theta fisub word [time] ; fpu: 1/r+offset theta fistp dword [bx] ; store r+offset to where dx is, cx&dx affected after popa, fpu: theta fnop ; this fnop will mutated to something more interesting eventually .effect2 equ $-1 fimul word [time+3] ; fpu: t*theta (+3 is initially wrong, but will be replaced with time+0 i.e. correct) .thetascale equ $-2 fistp dword [bx+2] ; store r+offset to where cx is, cx&ax affected after popa. We avoid messing the original IRQ address popa ; pop all registers from stack mov al, byte [byte si+envs+2] ; we rotate the tunnel based on the last channel envelope add ch, al xor dh, ch ; dh = r, ch = theta shl dh, 1 and dh, 64 ; we select parts of the XOR-texture add al, byte [byte si+envs+1] ; we add together the last two envelopes mul dh ; flash the tunnel color based on the sum of the last two envelopes mov al, ah add al, 16 ; shift to gray palette, will be replaced with 64 in the last part for a more colorful effect .palette equ $-1 stosb ; di = current pixel, write al to screen imul di, 85 ; traverse the pixels in slightly random order (tip from Hellmood) mov ax, 0xCCCD ; Rrrola trick! mul di ; dh = y, dl = x xchg bx, ax ; HellMood: put the low word of multiplication to bx, so we have more precision jc main ; when loading it in FPU xchg ax, dx ; dx guaranteed zero in al, 0x60 ; check for ESC key dec ax jnz main ; when song ends, this mutates to jnz -3 so it loops back to dec ax until ax = 0 .looptarget equ $-1 pop dx pop ds mov bl, 3 ; text mode out 61h, al setirq: out 40h, al ; write PIT counter divisor low byte salc ; set AL = 0 (because carry is zero) out 40h, al ; write PIT counter divisor high byte (freq = 1,19318181818 MHz / divisor) xchg al, bl ; set video mode int 10h mov ax, 2508h int 21h ; ah = 25h => set interrupt handler, al = which interrupt mov al, 90h ; set PIT channel 2 mode (PC speaker) to single cycle per write out 43h, al ret time: db 0,0 ; time initialized to zero patterns: db 108, 96, 0, 81, 96, 108, 0, 54 ; patterns play from last to first db 54, 0, 108, 54, 54, 0, 54 ; one 54 from previous pattern ; orderlist has: chn 1, chn 2, chn 3 orderlist: db 0x00, 0x6A, 0x00 ; the first nibble is chord, second nibble is offset to pattern table db 0x64, 0x63, 0x00 ; note that you should add channel number to the pattern offset to get db 0x84, 0x83, 0x00 ; the actual offset db 0x64, 0x63, 0x00 db 0x94, 0x00, 0x92 db 0x84, 0x83, 0x82 db 0x64, 0x63, 0x62 db 0x6B, 0x00, 0x69 irq: pusha mov al, 4 .sample equ $-1 mov cl, 176 ; scale max sample value (63+63+63) = 189 to 63, so samples are in 0..63 range mul cl shr ax, 9 jz .skipout ; write sample to speaker first, to have consistent sample timing out 42h, al ; this is actually the pulse length in counts, so we effectively control PWM duty cycle .skipout: ; for sample levels, assuming the loud speaker low pass filters it push ds ; practically only cs is guaranteed to be correct in interrupt push cs ; so we save current ds and put ds = cs pop ds dec byte [counter] ; quick hack for the PC speaker version: we need to run the interrupt at ~4x frequency for jnz .skipirq ; reasonable fake digital-to-analog conversion using PWM. So we calculate new sample values mov byte [counter], 4 ; only every 4 interrupt calls. xor bp, bp ; bp is the total sample value mov cx, 3 ; cx is the channel loop counter, we have three channels mov si, time mov bx, si .loop: mov al, byte [byte orderlist-patterns+bx+4] .pattern equ $ - 1 aam 16 mov dx, [si] ; si points to time shr dx, cl ; the bits shifted out of si are the position within note and dh, 7 ; patterns are 8 notes long, dh is now the row within pattern add al, dh ; al is pattern + row shr dl, 2 ; dl is now the envelope, 0..63 xlat mul ah shl ax, cl ; the channels are one octave apart imul ax, word [si] ; t*freq, we cannot do mul word [si] because that would trash dl sahf ; square wave, test the highest bit of ax for phase jns .skipchannel ; you can test different flags here to shift song up/down octaves mov byte [envs+bx-patterns+4], dl ; save the envelope for visuals add bp, dx ; add channel to sample total .skipchannel: dec bx loop .loop xchg ax, bp mov byte [irq.sample], al dec word [si] ; the time runs backwards to have decaying envelopes js .skipnextpattern ; after 32768 samples, advance orderlist mov word [si], cx ; cx guaranteed to be zero mov ax, word [script] .scriptpos equ $-2 mov bl, ah ; bh guaranteed to be 0x01 so we're good mov byte [bx], al ; change part of the code based on demo part add byte [.pattern+si-time],3 ; modify the mov al, byte ... instruction add word [.scriptpos+si-time],2 ; advance the script position by 2 .skipnextpattern: .skipirq: pop ds mov al, 20h out 20h, al ; end of interrupt signal popa iret script: db time, main.thetascale ; the tunnel theta multiplier points now to time, so the tunnel changes with time db 0xF3, main.effect ; D9 F3 = fpatan db 0xF4, main.effect ; D9 F4 = fxtract db 0xFE, main.effect ; D9 FE = fsin, hey we have a normal tunnel finally db 0xFF, main.effect2 ; D9 FF = fcos db 64, main.palette db 0xE8, main.effect ; D9 FF = fcos db 0xFD, main.looptarget ; last mutation: change the jnz main after dec ax to jump back to dec ax, so it loops until ax guaranteed 0 counter: db 4
Mppt/Original/constv.asm
stvnrhodes/calsol
0
96988
;********************************************************************** ; P R O G R A M M MPPTnG * ; * ; Undervoltage routine * ;********************************************************************** ; * ; Filename: underv.asm * ; Date: 21.09.01 * ; Last Update: 28.09.01 * ; File Version: V3.0 * ; * ; Author: <NAME> * ; * ; Company: HTA-Biel/Bienne Indulab * ; * ; Changes: program part which decreases current * ; * ; * ;********************************************************************** ; * ; Notes: * ; - Main program : mpptngv4.asm * ; * ;********************************************************************** ConstVMode call PWMoff call wait20ms Wait4Connect1 ;is bat. still connected? call UpdateCAN clrwdt ; reset watchdog call GetFilteredUout ;UOUT<=MAXUOUT+2V CheckMaxuout1 movlw 0x10 ;add 2V to MAXOUT movwf Temp4 movlw MAXUOH movwf Temp5 movlw MAXUOL addwf Temp4,f btfsc STATUS,C incf Temp5 movfw Temp5 movwf Temp1 movf UOFH,w subwf Temp1,w btfsc _Z goto CheckLsb21 btfss _C ;c set if w=MAXUOH-UOFH >=0 goto NoBatConnected goto ConstVMode2 CheckLsb21 movfw Temp4 movwf Temp1 movfw UOFL subwf Temp1,W btfsc _C ;c set if w=MAXUOL-UOFL >=0 goto ConstVMode2 NoBatConnected bsf REDLED bsf NOC bcf BVLR call PWMoff DeCharge1 call wait20ms ; wait for capacitor to be discharged call UpdateCAN call GetFilteredUin jmpFltL UIF0H,MINUINH,CV_UVState3 ; jmp, if minimal voltage not reached jmpFgtL UIF0H,MINUINH,CV_MeasUout3 ; go on, if minimal reached jmpFleL UIF0L,MINUINL,CV_UVState3 ; consider L-Byte goto CV_MeasUout3 CV_UVState3 call UnderVoltage CV_MeasUout3 call GetFilteredUout jmpFltL UOFH,MAXUOH,ClearNOC ; jmp, if minimal voltage not reached jmpFgtL UOFH,MAXUOH,DeCharge1 ; go on, if minimal reached jmpFleL UOFL,MAXUOL,ClearNOC ; consider L-Byte goto DeCharge1 ClearNOC bcf NOC bcf REDLED ;------------------------------------------------------------------------ ConstVMode2 bsf BVLR bsf REDLED call DecDuty ; decrement duty cycle call PWMon call wait20ms ; to obtain an approximate tracking frequency of 50Hz call UpdateCAN call GetFilteredUin jmpFltL UIF0H,MINUINH,CV_UVState ; jmp, if minimal voltage not reached jmpFgtL UIF0H,MINUINH,CV_MeasUout ; go on, if minimal reached jmpFleL UIF0L,MINUINL,CV_UVState ; consider L-Byte goto CV_MeasUout CV_UVState call UnderVoltage call UpdateCAN CV_MeasUout call GetFilteredUout ; test if battery reached full level call UpdateCAN jmpFltL UOFH,MAXUOH,MPPTtracking ; jmp, if output voltage within limits jmpFgtL UOFH,MAXUOH,CheckBatCon ; go on, if ouput voltage exceeded jmpFleL UOFL,MAXUOL,MPPTtracking ; consider L-Byte goto Wait4Connect1 CheckBatCon goto Wait4Connect1 ;**********************************************************************
programs/oeis/008/A008592.asm
neoneye/loda
22
161972
<filename>programs/oeis/008/A008592.asm ; A008592: Multiples of 10: a(n) = 10 * n. ; 0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990 mul $0,10
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1540.asm
ljhsiun2/medusa
9
245835
.global s_prepare_buffers s_prepare_buffers: push %r13 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x63cc, %rsi lea addresses_D_ht+0x17360, %rdi clflush (%rdi) nop nop nop sub %r13, %r13 mov $114, %rcx rep movsw nop cmp %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r15 push %r9 push %rdx // Store lea addresses_PSE+0x10c88, %r14 nop nop nop nop nop cmp $31119, %r9 mov $0x5152535455565758, %r15 movq %r15, %xmm6 movups %xmm6, (%r14) nop nop nop nop nop add %r15, %r15 // Store lea addresses_A+0xc45e, %r9 nop nop nop nop nop sub $6871, %r11 mov $0x5152535455565758, %r14 movq %r14, (%r9) // Exception!!! nop nop nop nop mov (0), %r15 nop nop nop nop cmp $44866, %r15 // Store lea addresses_UC+0x1eac8, %r12 nop nop nop sub %r15, %r15 movw $0x5152, (%r12) nop nop nop add %r9, %r9 // Faulty Load lea addresses_normal+0x2b60, %r14 nop nop nop and $23174, %rdx vmovups (%r14), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %r11 lea oracles, %r9 and $0xff, %r11 shlq $12, %r11 mov (%r9,%r11,1), %r11 pop %rdx pop %r9 pop %r15 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}} [Faulty Load] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
oeis/053/A053134.asm
neoneye/loda-programs
11
90627
<filename>oeis/053/A053134.asm ; A053134: Binomial coefficients C(2*n+4,4). ; 1,15,70,210,495,1001,1820,3060,4845,7315,10626,14950,20475,27405,35960,46376,58905,73815,91390,111930,135751,163185,194580,230300,270725,316251,367290,424270,487635,557845,635376,720720,814385,916895,1028790,1150626,1282975,1426425,1581580,1749060,1929501,2123555,2331890,2555190,2794155,3049501,3321960,3612280,3921225,4249575,4598126,4967690,5359095,5773185,6210820,6672876,7160245,7673835,8214570,8783390,9381251,10009125,10668000,11358880,12082785,12840751,13633830,14463090,15329615,16234505 mul $0,2 mov $1,-5 bin $1,$0 mov $0,$1
src/FOmegaInt/Kinding/Declarative/Normalization.agda
Blaisorblade/f-omega-int-agda
12
6360
------------------------------------------------------------------------ -- Soundness of normalization w.r.t. to declarative kinding of Fω with -- interval kinds ------------------------------------------------------------------------ {-# OPTIONS --safe --without-K #-} module FOmegaInt.Kinding.Declarative.Normalization where open import Data.Fin using (zero) open import Data.Fin.Substitution open import Data.Product using (_,_; proj₂; _×_) open import Data.Vec using ([]) open import Relation.Binary.PropositionalEquality hiding ([_]) open import FOmegaInt.Syntax open import FOmegaInt.Syntax.HereditarySubstitution open import FOmegaInt.Syntax.Normalization open import FOmegaInt.Typing open import FOmegaInt.Typing.Validity open Syntax open TermCtx open Substitution hiding (subst) open ContextConversions open Typing open TypedSubstitution ------------------------------------------------------------------------ -- Soundness of hereditary substitutions -- NOTE. The following are corollaries of the corresponding soundness -- lemmas using untyped β-reduction and the subject reduction property -- for kinding (see the Syntax.HereditarySubstitution and -- Typing.Validity modules for details). -- Soundness of hereditary substitution: the results of ordinary and -- hereditary substitutions in well-formed kinds resp. well-kinded -- types are equal (w.r.t. type resp. kind equality). kd-⌞⌟-[]-≅ : ∀ {n} {Γ : Ctx n} {j k a} → kd ⌞ j ⌟Kd ∷ Γ ⊢ ⌞ k ⌟Kd kd → Γ ⊢Tp ⌞ a ⌟ ∈ ⌞ j ⌟Kd → Γ ⊢ ⌞ k ⌟Kd Kind[ ⌞ a ⌟ ] ≅ ⌞ k Kind[ a ∈ ⌊ j ⌋ ] ⌟Kd kd-⌞⌟-[]-≅ {k = k} ⌞k⌟-kd ⌞a⌟∈⌞j⌟ = kd-→β*-≅ (kd-[] ⌞k⌟-kd (∈-tp ⌞a⌟∈⌞j⌟)) (⌞⌟Kd-/⟨⟩-β k) Tp∈-⌞⌟-[]-≃ : ∀ {n} {Γ : Ctx n} {j a k b} → kd ⌞ j ⌟Kd ∷ Γ ⊢Tp ⌞ a ⌟ ∈ ⌞ k ⌟Kd → Γ ⊢Tp ⌞ b ⌟ ∈ ⌞ j ⌟Kd → Γ ⊢ ⌞ a ⌟ [ ⌞ b ⌟ ] ≃ ⌞ a [ b ∈ ⌊ j ⌋ ] ⌟ ∈ ⌞ k ⌟Kd Kind[ ⌞ b ⌟ ] Tp∈-⌞⌟-[]-≃ {a = a} ⌞a⌟∈⌞k⌟ ⌞b⌟∈⌞j⌟ = Tp∈-→β*-≃ (Tp∈-[] ⌞a⌟∈⌞k⌟ (∈-tp ⌞b⌟∈⌞j⌟)) (⌞⌟-/⟨⟩-β a) -- Soundness of potentially reducing application: ordinary and -- potentially reducing application of well-kinded types are equal -- (w.r.t. type equality). Tp∈-⌞⌟-·-≃ : ∀ {n} {Γ : Ctx n} {a b j k} → Γ ⊢Tp ⌞ a ⌟ ∈ Π j k → Γ ⊢Tp ⌞ b ⌟ ∈ j → Γ ⊢ ⌞ a ⌟ · ⌞ b ⌟ ≃ ⌞ a ↓⌜·⌝ b ⌟ ∈ k Kind[ ⌞ b ⌟ ] Tp∈-⌞⌟-·-≃ {_} {_} {a} {b} {j} {k} ⌞a⌟∈Πjk ⌞b⌟∈j = Tp∈-→β*-≃ (∈-Π-e ⌞a⌟∈Πjk ⌞b⌟∈j) (⌞⌟-↓⌜·⌝-β a b) ------------------------------------------------------------------------ -- Soundness of η-expansion. module TrackSimpleKindsDeclarativeEtaExp where open RenamingCommutes open SimpHSubstLemmas private module V = VarSubst module TK = TrackSimpleKindsEtaExp -- NOTE. The definition of the function Tp∈-⌞⌟-≃-η below is -- structurally recursive in the *shape* parameter k, but *not* in -- the kind j because we need to weaken the domain j₁ of the -- dependent kind (j = Π j₁ j₂) in the arrow case. The additional -- hypothesis ⌊ j ⌋≡ k ensures that k is indeed the shape of the -- kind j. -- Well-kinded neutrals are equal to to their η-expansions. Tp∈-⌞⌟-≃-η : ∀ {n} {Γ : Ctx n} {x as j k} (hyp : ⌊ j ⌋≡ k) → Γ ⊢ ⌞ j ⌟Kd kd → Γ ⊢Tp ⌞ var x ∙ as ⌟ ∈ ⌞ j ⌟Kd → Γ ⊢ ⌞ var x ∙ as ⌟ ≃ ⌞ TK.η-exp j hyp (var x ∙ as) ⌟ ∈ ⌞ j ⌟Kd Tp∈-⌞⌟-≃-η is-★ ⌞b₂⋯c₂⌟-kd ⌞x∙as⌟∈⌞b₁⋯c₁⌟ = ≃-refl ⌞x∙as⌟∈⌞b₁⋯c₁⌟ Tp∈-⌞⌟-≃-η {_} {Γ} {x} {as} (is-⇒ {j₁} {j₂} ⌊j₁⌋≡k₁ ⌊j₂⌋≡k₂) (kd-Π ⌞j₁⌟-kd ⌞j₂⌟-kd) ⌞x∙as⌟∈⌞Πj₁j₂⌟ = begin ⌞ var x ∙ as ⌟ ≃⟨ ≃-sym (≃-η ⌞x∙as⌟∈⌞Πj₁j₂⌟) ⟩ Λ ⌞ j₁ ⌟Kd (weaken ⌞ var x ∙ as ⌟ · var zero) ≃⟨ ≃-λ′ (≅-refl ⌞j₁⌟-kd) (begin weaken ⌞ var x ∙ as ⌟ · var zero ≃⟨ ⌞x∙as⌟·z≃⌞x∙as⌟·⌞η-z⌟∈⌞j₂⌟ ⟩ weaken ⌞ var x ∙ as ⌟ · ⌞ TK.η-exp (weakenKind′ _) (⌊⌋≡-weaken ⌊j₁⌋≡k₁) (var∙ zero) ⌟ ≡⟨ ⌞x∙as⌟·⌞η-z⌟≡⌞x∙as⌜·⌝η-z⌟ ⟩ ⌞ weakenElim (var x ∙ as) ⌜·⌝ TK.η-exp (weakenKind′ _) (⌊⌋≡-weaken ⌊j₁⌋≡k₁) (var∙ zero) ⌟ ≃⟨ Tp∈-⌞⌟-≃-η ⌊j₂⌋≡k₂ ⌞j₂⌟-kd (subst (_ ⊢Tp_∈ _) ⌞x∙as⌟·⌞η-z⌟≡⌞x∙as⌜·⌝η-z⌟ ⌞x∙as⌟·⌞η-z⌟∈⌞j₂⌟) ⟩ ⌞ TK.η-exp j₂ ⌊j₂⌋≡k₂ _ ⌟ ∎) ⟩ ⌞ TK.η-exp (Π j₁ j₂) (is-⇒ ⌊j₁⌋≡k₁ ⌊j₂⌋≡k₂) (var x ∙ as) ⌟ ∎ where ⌞j₁⌟-wf = wf-kd ⌞j₁⌟-kd ⌞j₁⌟′-kd = kd-weaken ⌞j₁⌟-wf ⌞j₁⌟-kd ⌞j₁⌟′≡⌞j₁′⌟ = sym (⌞⌟Kd-/Var j₁) ⌞j₁′⌟-kd = subst (kd ⌞ j₁ ⌟Kd ∷ _ ⊢_kd) ⌞j₁⌟′≡⌞j₁′⌟ ⌞j₁⌟′-kd ⌞j₁⌟∷Γ-ctx = ⌞j₁⌟-wf ∷ Tp∈-ctx ⌞x∙as⌟∈⌞Πj₁j₂⌟ ⌞x∙as⌟′∈⌞Πj₁j₂′⌟ = subst (kd ⌞ j₁ ⌟Kd ∷ Γ ⊢Tp weaken ⌞ var x ∙ as ⌟ ∈_) (sym (⌞⌟Kd-/Var (Π j₁ j₂))) (Tp∈-weaken ⌞j₁⌟-wf ⌞x∙as⌟∈⌞Πj₁j₂⌟) z∈⌞j₁⌟ = ∈-var zero ⌞j₁⌟∷Γ-ctx (cong kd ⌞j₁⌟′≡⌞j₁′⌟ ) z≃η-z∈⌞j₁⌟ = Tp∈-⌞⌟-≃-η (⌊⌋≡-weaken ⌊j₁⌋≡k₁) ⌞j₁′⌟-kd z∈⌞j₁⌟ ⌞j₂′⌟[z]≡⌞j₂⌟ = begin ⌞ j₂ Kind′/Var V.wk V.↑ ⌟Kd Kind[ var zero ] ≡⟨ cong (_Kind[ var zero ]) (⌞⌟Kd-/Var j₂) ⟩ (⌞ j₂ ⌟Kd Kind/Var V.wk V.↑) Kind[ var zero ] ≡⟨ Kind-wk↑-sub-zero-vanishes ⌞ j₂ ⌟Kd ⟩ ⌞ j₂ ⌟Kd ∎ where open ≡-Reasoning ⌞x∙as⌟·z≃⌞x∙as⌟·⌞η-z⌟∈⌞j₂⌟ = subst (_ ⊢ _ ≃ _ ∈_) ⌞j₂′⌟[z]≡⌞j₂⌟ (≃-· (≃-refl (⌞x∙as⌟′∈⌞Πj₁j₂′⌟)) z≃η-z∈⌞j₁⌟) ⌞x∙as⌟·⌞η-z⌟∈⌞j₂⌟ = proj₂ (≃-valid ⌞x∙as⌟·z≃⌞x∙as⌟·⌞η-z⌟∈⌞j₂⌟) ⌞x∙as⌟·⌞η-z⌟≡⌞x∙as⌜·⌝η-z⌟ = begin weaken ⌞ var x ∙ as ⌟ · ⌞ TK.η-exp (weakenKind′ _) (⌊⌋≡-weaken ⌊j₁⌋≡k₁) (var∙ zero) ⌟ ≡⟨ cong (_· _) (sym (⌞⌟-/Var (var x ∙ as))) ⟩ ⌞ weakenElim (var x ∙ as) ⌟ · ⌞ TK.η-exp (weakenKind′ _) (⌊⌋≡-weaken ⌊j₁⌋≡k₁) (var∙ zero) ⌟ ≡⟨ sym (⌞⌟-· (weakenElim (var x ∙ as)) _) ⟩ ⌞ weakenElim (var x ∙ as) ⌜·⌝ TK.η-exp (weakenKind′ _) (⌊⌋≡-weaken ⌊j₁⌋≡k₁) (var∙ zero) ⌟ ∎ where open ≡-Reasoning open ≃-Reasoning private module TK = TrackSimpleKindsDeclarativeEtaExp -- Soundness of η-expansion of neutrals: well-kinded neutral types are -- equal to their η-expansions (w.r.t. to type equality). Tp∈-⌞⌟-≃-η : ∀ {n} {Γ : Ctx n} {x as k} → Γ ⊢Tp ⌞ var x ∙ as ⌟ ∈ ⌞ k ⌟Kd → Γ ⊢ ⌞ var x ∙ as ⌟ ≃ ⌞ η-exp k (var x ∙ as) ⌟ ∈ ⌞ k ⌟Kd Tp∈-⌞⌟-≃-η ⌞x∙as⌟∈⌞k⌟ = TK.Tp∈-⌞⌟-≃-η (⌊⌋-⌊⌋≡ _) (Tp∈-valid ⌞x∙as⌟∈⌞k⌟) ⌞x∙as⌟∈⌞k⌟ ------------------------------------------------------------------------ -- Soundness of normalization mutual -- Soundness of normalization: well-formed kinds and well-kinded -- types are equal to their normal forms (w.r.t. to kind resp. type -- equality). Tp∈-≃-⌞⌟-nf : ∀ {n} {Γ : Ctx n} {a k} → Γ ⊢Tp a ∈ k → Γ ⊢ a ≃ ⌞ nf (nfCtx Γ) a ⌟ ∈ k Tp∈-≃-⌞⌟-nf {_} {Γ} (∈-var {k} x Γ-ctx Γ[x]≡kd-k) with ElimCtx.lookup (nfCtx Γ) x | nfCtx-lookup-kd x Γ Γ[x]≡kd-k ... | kd ._ | refl = ≃-⇑ (Tp∈-⌞⌟-≃-η (∈-⇑ (∈-var x Γ-ctx Γ[x]≡kd-k) (≅⇒<∷ k≅⌞nf-k⌟))) (≅⇒<∷ (≅-sym k≅⌞nf-k⌟)) where open ≡-Reasoning open CtxEqOps using (lookup-≃-kd) Γ≃⌞nf-Γ⌟ = ctx-≃-⌞⌟-nf Γ-ctx ⌞nf-Γ⌟[x]≡kd-⌞k⌟ = begin lookup ⌞ nfCtx Γ ⌟Ctx x ≡⟨ ⌞⌟Asc-lookup (nfCtx Γ) x ⟩ ⌞ ElimCtx.lookup (nfCtx Γ) x ⌟Asc ≡⟨ cong ⌞_⌟Asc (nfCtx-lookup-kd x Γ Γ[x]≡kd-k) ⟩ kd ⌞ nfKind (nfCtx Γ) k ⌟Kd ∎ k≅⌞nf-k⌟ : Γ ⊢ k ≅ ⌞ nfKind (nfCtx Γ) k ⌟Kd k≅⌞nf-k⌟ = lookup-≃-kd x Γ≃⌞nf-Γ⌟ Γ[x]≡kd-k ⌞nf-Γ⌟[x]≡kd-⌞k⌟ Tp∈-≃-⌞⌟-nf (∈-⊥-f Γ-ctx) = ≃-refl (∈-⊥-f Γ-ctx) Tp∈-≃-⌞⌟-nf (∈-⊤-f Γ-ctx) = ≃-refl (∈-⊤-f Γ-ctx) Tp∈-≃-⌞⌟-nf (∈-∀-f k-kd a∈*) = ≃-∀ (kd-≅-⌞⌟-nf k-kd) (Tp∈-≃-⌞⌟-nf a∈*) Tp∈-≃-⌞⌟-nf (∈-→-f a∈* b∈*) = ≃-→ (Tp∈-≃-⌞⌟-nf a∈*) (Tp∈-≃-⌞⌟-nf b∈*) Tp∈-≃-⌞⌟-nf (∈-Π-i j-kd a∈k) = ≃-λ′ (kd-≅-⌞⌟-nf j-kd) (Tp∈-≃-⌞⌟-nf a∈k) Tp∈-≃-⌞⌟-nf {_} {Γ} (∈-Π-e {a} {b} {j} {k} a∈Πjk b∈j) with Tp∈-valid a∈Πjk ... | (kd-Π j-kd k-kd) = begin a · b ≃⟨ ≃-· a≃⌞nf-a⌟∈Πjk b≃⌞nf-b⌟∈j ⟩ ⌞ nf (nfCtx Γ) a ⌟ · ⌞ nf (nfCtx Γ) b ⌟ ≃⟨ ≃-⇑ (Tp∈-⌞⌟-·-≃ {a = nf (nfCtx Γ) a} {nf (nfCtx Γ) b} ⌞nf-a⌟∈Πjk ⌞nf-b⌟∈j) (≅⇒<∷ (≅-sym (kd-[≃] k-kd b≃⌞nf-b⌟∈j))) ⟩ ⌞ nf (nfCtx Γ) a ↓⌜·⌝ nf (nfCtx Γ) b ⌟ ∎ where open ≃-Reasoning a≃⌞nf-a⌟∈Πjk = Tp∈-≃-⌞⌟-nf a∈Πjk ⌞nf-a⌟∈Πjk = proj₂ (≃-valid a≃⌞nf-a⌟∈Πjk) b≃⌞nf-b⌟∈j = Tp∈-≃-⌞⌟-nf b∈j ⌞nf-b⌟∈j = proj₂ (≃-valid b≃⌞nf-b⌟∈j) Tp∈-≃-⌞⌟-nf (∈-s-i a∈b⋯c) = ≃-s-i (Tp∈-≃-⌞⌟-nf a∈b⋯c) Tp∈-≃-⌞⌟-nf (∈-⇑ a∈j j<∷k) = ≃-⇑ (Tp∈-≃-⌞⌟-nf a∈j) j<∷k kd-≅-⌞⌟-nf : ∀ {n} {Γ : Ctx n} {k} → Γ ⊢ k kd → Γ ⊢ k ≅ ⌞ nfKind (nfCtx Γ) k ⌟Kd kd-≅-⌞⌟-nf (kd-⋯ a∈* b∈*) = ≅-⋯ (Tp∈-≃-⌞⌟-nf a∈* ) (Tp∈-≃-⌞⌟-nf b∈*) kd-≅-⌞⌟-nf (kd-Π j-kd k-kd) = ≅-Π (kd-≅-⌞⌟-nf j-kd) (kd-≅-⌞⌟-nf k-kd) -- Well-formed ascriptions and contexts are equal to their normal -- forms. wf-≃-⌞⌟-nf : ∀ {n} {Γ : Ctx n} {a} → Γ ⊢ a wf → Γ ⊢ a ≃ ⌞ nfAsc (nfCtx Γ) a ⌟Asc wf wf-≃-⌞⌟-nf (wf-kd k-kd) = ≃wf-≅ (kd-≅-⌞⌟-nf k-kd) wf-≃-⌞⌟-nf (wf-tp a∈*) = ≃wf-≃ (Tp∈-≃-⌞⌟-nf a∈*) ctx-≃-⌞⌟-nf : ∀ {n} {Γ : Ctx n} → Γ ctx → Γ ≃ ⌞ nfCtx Γ ⌟Ctx ctx ctx-≃-⌞⌟-nf [] = ≃-[] ctx-≃-⌞⌟-nf (a-wf ∷ Γ-ctx) = ≃-∷ (wf-≃-⌞⌟-nf a-wf) (ctx-≃-⌞⌟-nf Γ-ctx) -- Some corollaries. -- The domain and co-domain of universal types are equal to their -- normal forms. Tp∈-∀-≃-⌞⌟-nf : ∀ {n} {Γ : Ctx n} {k a} → Γ ⊢Tp Π k a ∈ * → Γ ⊢ k ≅ ⌞ nfKind (nfCtx Γ) k ⌟Kd × kd k ∷ Γ ⊢ a ≃ ⌞ nf (nfCtx (kd k ∷ Γ)) a ⌟ ∈ * Tp∈-∀-≃-⌞⌟-nf ∀ka∈* with Tp∈-∀-inv ∀ka∈* ... | k-kd , a∈* = kd-≅-⌞⌟-nf k-kd , Tp∈-≃-⌞⌟-nf a∈* -- The domain and co-domain of arrow types are equal to their normal -- forms. Tp∈-→-≃-⌞⌟-nf : ∀ {n} {Γ : Ctx n} {a b} → Γ ⊢Tp a ⇒ b ∈ * → Γ ⊢ a ≃ ⌞ nf (nfCtx Γ) a ⌟ ∈ * × Γ ⊢ b ≃ ⌞ nf (nfCtx Γ) b ⌟ ∈ * Tp∈-→-≃-⌞⌟-nf a⇒b∈* with Tp∈-→-inv a⇒b∈* ... | a∈* , b∈* = Tp∈-≃-⌞⌟-nf a∈* , Tp∈-≃-⌞⌟-nf b∈*
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1815.asm
ljhsiun2/medusa
9
173340
<filename>Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1815.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_A_ht+0xc6c9, %r14 nop nop sub %r15, %r15 mov (%r14), %rax nop nop nop nop sub $7236, %r10 lea addresses_A_ht+0x1cab1, %rsi lea addresses_A_ht+0xc4c9, %rdi nop add %r15, %r15 mov $64, %rcx rep movsw nop and %r15, %r15 lea addresses_WT_ht+0xfc9, %r15 nop nop dec %rcx mov (%r15), %r10d xor %rcx, %rcx lea addresses_WC_ht+0x5ce7, %r10 nop nop nop add %rdi, %rdi movb $0x61, (%r10) dec %r15 lea addresses_WC_ht+0x76c9, %r14 nop nop nop nop xor %rdi, %rdi mov (%r14), %ecx nop nop nop xor $48522, %rdi lea addresses_UC_ht+0x1e6c9, %rsi lea addresses_normal_ht+0x1ee49, %rdi nop nop nop sub %r10, %r10 mov $46, %rcx rep movsq nop nop nop nop nop sub %rcx, %rcx lea addresses_WC_ht+0x9d39, %r14 cmp %rdi, %rdi mov $0x6162636465666768, %r15 movq %r15, %xmm7 movups %xmm7, (%r14) nop nop cmp %r15, %r15 lea addresses_UC_ht+0x10cc9, %rsi lea addresses_A_ht+0x171b, %rdi nop nop nop nop nop add %r8, %r8 mov $21, %rcx rep movsw xor %r8, %r8 lea addresses_normal_ht+0xcb49, %r14 nop nop nop nop nop xor $4258, %r10 mov $0x6162636465666768, %rdi movq %rdi, (%r14) nop add $47715, %rcx lea addresses_A_ht+0x16ac9, %rsi xor $36578, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm2 vmovups %ymm2, (%rsi) nop nop nop and $33860, %rcx lea addresses_UC_ht+0xa8c9, %rsi lea addresses_WC_ht+0x2616, %rdi clflush (%rdi) nop nop nop nop add $53687, %rax mov $0, %rcx rep movsq nop cmp $61235, %r15 lea addresses_A_ht+0x121a9, %rsi lea addresses_WC_ht+0x1e449, %rdi nop nop xor $37408, %r14 mov $75, %rcx rep movsw nop nop nop nop inc %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r15 push %r8 push %r9 push %rsi // Store mov $0x55d, %r9 nop nop sub %r8, %r8 movb $0x51, (%r9) nop nop nop nop add $61388, %r9 // Faulty Load lea addresses_RW+0x142c9, %r9 nop nop nop cmp $39332, %r15 movb (%r9), %r13b lea oracles, %r14 and $0xff, %r13 shlq $12, %r13 mov (%r14,%r13,1), %r13 pop %rsi pop %r9 pop %r8 pop %r15 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
programs/oeis/010/A010860.asm
neoneye/loda
22
13630
; A010860: Constant sequence: a(n) = 21. ; 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21 mov $0,21
alloy/coursework_two/sensors.ads
m-f-1998/university
0
23319
-- Author: <NAME> -- -- Address: School Mathematical & Computer Sciences -- Heriot-Watt University -- Edinburgh, EH14 4AS -- -- E-mail: <EMAIL> -- -- Last modified: 13.9.2019 -- -- Filename: sensors.ads -- -- Description: Models the 3 pressure sensors associated with the WTP system. Note that -- a single sensor reading is calculated using a majority vote -- algorithm. pragma SPARK_Mode (On); package Sensors with Abstract_State => State is subtype Sensor_Type is Integer range 0..2100; subtype Sensor_Index_Type is Integer range 1..3; procedure Write_Sensors(Value_1, Value_2, Value_3: in Sensor_Type) with Global => (Output => State), Depends => (State => (Value_1, Value_2, Value_3)); function Read_Sensor(Sensor_Index: in Sensor_Index_Type) return Sensor_Type with Global => (Input => State), Depends => (Read_Sensor'Result => (State, Sensor_Index)); function Read_Sensor_Majority return Sensor_Type with Global => (Input => State), Depends => (Read_Sensor_Majority'Result => State); end Sensors;
Library/Spool/Process/processNothing.asm
steakknife/pcgeos
504
174678
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Print Spooler FILE: processNothing.asm AUTHOR: <NAME>, April 29, 1991 ROUTINES: Name Description ---- ----------- InitNothingPort do init for port ExitNothingPort do exit for port ErrorNothingPort do error handling for port VerifyNothingPort verify that the port accessible REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 3/26/90 Initial revision Don 4/29/91 Copied code from parallel DESCRIPTION: This file contains the routines to initialize and close the nothing "port", a port whose type we do not deal with. $Id: processNothing.asm,v 1.1 97/04/07 11:11:16 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrintInit segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InitNothingPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Open the port and do special serial port initialization CALLED BY: INTERNAL InitPrinterPort PASS: nothing RETURN: carry = set if problem opening port ax = error type (PortErrors enum) DESTROYED: nothing PSEUDO CODE/STRATEGY: put pseudo code here KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 04/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InitNothingPort proc near curJob local SpoolJobInfo .enter inherit clc ; signal no problem .leave ret InitNothingPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExitNothingPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close the port CALLED BY: INTERNAL ExitPrinterPort PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: put pseudo code here KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 04/91 Exitial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExitNothingPort proc near curJob local SpoolJobInfo .enter inherit .leave ret ExitNothingPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VerifyNothingPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verify the existance and operation of the port CALLED BY: INTERNAL SpoolVerifyPrinterPort PASS: portStrategy - inherited local variable RETURN: carry - SET if there is some problem DESTROYED: nothing PSEUDO CODE/STRATEGY: For now, do nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 04/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VerifyNothingPort proc near portStrategy local fptr .enter inherit ; There is nothing to do. Just return carry clear ; clc .leave ret VerifyNothingPort endp PrintInit ends PrintError segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ErrorNothingPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle parallel port errors CALLED BY: parallel driver, via NothingErrorHandler in idata PASS: ds - segment of locked queue segment *ds:si - pointer to queue that is affected dx - error word RETURN: carry - set if print job should abort ds - still points at PrintQueue (may have changed) DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 04/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ErrorNothingPort proc near .enter stc .leave ret ErrorNothingPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InputNothingPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Common input routine (not normally needed) CALLED BY: INTERNAL CommPortInputHandler PASS: ds:bx - QueueInfo RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 6/24/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InputNothingPort proc near .enter .leave ret InputNothingPort endp PrintError ends
code/6502/tests/tms/tms9918cputests.asm
visrealm/hbc-56
65
17471
<reponame>visrealm/hbc-56 ; Troy's HBC-56 - CPU tests (degugging emulator issues) ; ; Copyright (c) 2021 <NAME> ; ; This code is licensed under the MIT license ; ; https://github.com/visrealm/hbc-56 ; !src "hbc56kernel.inc" hbc56Meta: +setHbcMetaTitle "CPU UNIT TESTS" rts hbc56Main: sei jsr kbInit +tmsSetColorFgBg TMS_LT_GREEN, TMS_BLACK jsr tmsInitEntireColorTable +tmsEnableOutput cli +tmsEnableInterrupts jsr overflowTests jsr decimalTests jmp success decimalTests: sed clc lda #$08 adc #$08 cld cmp #$16 bne FAIL sed sec sbc #$08 cld cmp #$08 bne FAIL sed clc sbc #$16 ;bcc FAIL cld cmp #$91 bne FAIL rts FAIL: +tmsPrint "FAILED",2,0 - jmp - overflowTests: clc lda #$30 adc #$10 bvs FAIL clc lda #$50 adc #$50 bvc FAIL clc lda #$50 adc #$90 bvs FAIL clc lda #$50 adc #$D0 bvs FAIL clc lda #$D0 adc #$10 bvs FAIL clc lda #$D0 adc #$50 bvs FAIL clc lda #$D0 adc #$90 bvc FAIL clc lda #$D0 adc #$D0 bvs FAIL sec lda #$50 sbc #$F0 bvs FAIL sec lda #$50 sbc #$B0 bvc FAIL sec lda #$50 sbc #$70 bvs FAIL sec lda #$50 sbc #$30 bvs FAIL sec lda #$D0 sbc #$F0 bvs FAIL2 sec lda #$D0 sbc #$B0 bvs FAIL2 sec lda #$D0 sbc #$70 bvc FAIL2 sec lda #$D0 sbc #$30 bvs FAIL2 rts FAIL2: +tmsPrint "FAILED",2,0 - jmp - success: +tmsPrint "PASSED",2,0 - jmp -
assembly/books/assembly_step/chapter07/sandbox/newsandbox.asm
argodev/2021
0
27576
<filename>assembly/books/assembly_step/chapter07/sandbox/newsandbox.asm<gh_stars>0 section .data section .text global _start _start: nop ; put your experiment lines in between the two nops mov ax, 067feh mov bx, ax mov cl, bh mov ch, bl nop section .bss
_maps/obj41.asm
NatsumiFox/AMPS-Sonic-1-2005
2
14613
; --------------------------------------------------------------------------- ; Sprite mappings - springs ; --------------------------------------------------------------------------- dc.w byte_DD26-Map_obj41 dc.w byte_DD31-Map_obj41 dc.w byte_DD37-Map_obj41 dc.w byte_DD47-Map_obj41 dc.w byte_DD4D-Map_obj41 dc.w byte_DD53-Map_obj41 byte_DD26: dc.b 2 dc.b $F8, $C, 0, 0, $F0 dc.b 0, $C, 0, 4, $F0 byte_DD31: dc.b 1 dc.b 0, $C, 0, 0, $F0 byte_DD37: dc.b 3 dc.b $E8, $C, 0, 0, $F0 dc.b $F0, 5, 0, 8, $F8 dc.b 0, $C, 0, $C, $F0 byte_DD47: dc.b 1 dc.b $F0, 7, 0, 0, $F8 byte_DD4D: dc.b 1 dc.b $F0, 3, 0, 4, $F8 byte_DD53: dc.b 4 dc.b $F0, 3, 0, 4, $10 dc.b $F8, 9, 0, 8, $F8 dc.b $F0, 0, 0, 0, $F8 dc.b 8, 0, 0, 3, $F8 even
data/baseStats/raikou.asm
adhi-thirumala/EvoYellow
0
240700
db DEX_RAIKOU ; pokedex id db 90 ; base hp db 85 ; base attack db 75 ; base defense db 115 ; base speed db 107 ; base special db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 3 ; catch rate db 216 ; base exp yield INCBIN "pic/ymon/raikou.pic",0,1 ; 55, sprite dimensions dw RaikouPicFront dw RaikouPicBack ; attacks known at lvl 0 db BITE db LEER db 0 db 0 db 5 ; growth rate ; learnset tmlearn 6,8 tmlearn 10,15 tmlearn 20,24 tmlearn 25,28,31,32 tmlearn 33,34,39 tmlearn 44,45 tmlearn 50,51,54,55 db Bank(RaikouPicFront) ; padding
oeis/274/A274682.asm
neoneye/loda-programs
11
245923
; A274682: Numbers n such that 8*n-1 is a triangular number. ; Submitted by <NAME> ; 2,7,29,44,88,113,179,214,302,347,457,512,644,709,863,938,1114,1199,1397,1492,1712,1817,2059,2174,2438,2563,2849,2984,3292,3437,3767,3922,4274,4439,4813,4988,5384,5569,5987,6182,6622,6827,7289,7504,7988,8213,8719,8954,9482,9727,10277,10532,11104,11369,11963,12238,12854,13139,13777,14072,14732,15037,15719,16034,16738,17063,17789,18124,18872,19217,19987,20342,21134,21499,22313,22688,23524,23909,24767,25162,26042,26447,27349,27764,28688,29113,30059,30494,31462,31907,32897,33352,34364,34829,35863 mov $1,$0 gcd $0,2 pow $0,2 add $0,2 mul $1,8 add $0,$1 bin $0,2 mul $0,8 div $0,64 add $0,1
software/kernel/cpu.ads
TUM-EI-RCS/StratoX
12
23102
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: CPU -- -- Authors: <NAME> (<EMAIL>) -- -- Description: Control CPU -- -- ToDo: -- [ ] Implementation package CPU with SPARK_Mode is -- configures hardware registers procedure initialize; procedure sleep; end CPU;
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_267.asm
ljhsiun2/medusa
9
25881
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x19b3d, %r12 nop nop nop cmp $51711, %r8 movups (%r12), %xmm4 vpextrq $1, %xmm4, %r10 nop nop nop nop and %r14, %r14 lea addresses_A_ht+0x15edd, %rbx nop add %rdx, %rdx movb $0x61, (%rbx) nop nop nop nop and %r12, %r12 lea addresses_WC_ht+0xd159, %rsi lea addresses_WT_ht+0x19e23, %rdi nop nop nop sub $27310, %r10 mov $17, %rcx rep movsl cmp $37585, %rdi lea addresses_WT_ht+0x1b85, %r12 nop nop nop nop sub %rdi, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm5 and $0xffffffffffffffc0, %r12 movaps %xmm5, (%r12) nop nop nop inc %r8 lea addresses_WC_ht+0xbadd, %rcx nop nop cmp $15817, %r14 mov $0x6162636465666768, %rbx movq %rbx, (%rcx) nop xor %r14, %r14 lea addresses_WT_ht+0x1bcdd, %rsi lea addresses_A_ht+0x427d, %rdi add $46703, %rdx mov $47, %rcx rep movsb nop and $27967, %rbx lea addresses_A_ht+0x1aedd, %rdx nop nop nop nop sub $28088, %r14 mov (%rdx), %ecx nop nop nop nop inc %r10 lea addresses_D_ht+0xbadd, %rbx nop nop nop nop add $35691, %rdx movb (%rbx), %r14b nop nop nop nop and %r8, %r8 lea addresses_WC_ht+0x218d, %rsi lea addresses_D_ht+0xa05d, %rdi nop nop nop cmp %r14, %r14 mov $89, %rcx rep movsw nop nop nop nop nop inc %rcx lea addresses_UC_ht+0x92dd, %r12 nop nop add %rsi, %rsi movb $0x61, (%r12) nop nop nop nop cmp $48530, %r8 lea addresses_normal_ht+0xd2eb, %rdi nop nop nop nop xor %rcx, %rcx movb $0x61, (%rdi) sub %rdi, %rdi lea addresses_A_ht+0x969d, %r12 sub %rdx, %rdx mov (%r12), %r14d nop xor %rbx, %rbx lea addresses_UC_ht+0x58dd, %rdi clflush (%rdi) nop nop nop nop and $58558, %rbx mov (%rdi), %cx nop nop nop add $8956, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %rax push %rbp push %rdi // Store lea addresses_normal+0x84dd, %rax nop and $45898, %r14 mov $0x5152535455565758, %r12 movq %r12, (%rax) nop dec %r14 // Store lea addresses_US+0xa9dd, %r14 and $17562, %r8 mov $0x5152535455565758, %rax movq %rax, %xmm7 movaps %xmm7, (%r14) nop nop nop nop dec %r8 // Store mov $0x1d6b940000000edd, %r14 and $1247, %r8 movl $0x51525354, (%r14) // Exception!!! nop nop nop nop mov (0), %r12 nop nop nop and %r8, %r8 // Faulty Load lea addresses_US+0x156dd, %r14 nop nop nop nop add %r12, %r12 movups (%r14), %xmm2 vpextrq $1, %xmm2, %rdi lea oracles, %rax and $0xff, %rdi shlq $12, %rdi mov (%rax,%rdi,1), %rdi pop %rdi pop %rbp pop %rax pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': True, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': True, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
source/network-managers.ads
reznikmm/network
1
2652
-- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with League.String_Vectors; with League.Strings; with Network.Addresses; with Network.Connections; with Network.Connection_Promises; with Network.Polls; package Network.Managers is pragma Preelaborate; type Manager is tagged limited private; -- Network connection manager procedure Initialize (Self : in out Manager'Class); -- Call Initialize before use procedure Connect (Self : in out Manager'Class; Address : Network.Addresses.Address; Error : out League.Strings.Universal_String; Promise : out Connection_Promises.Promise; Options : League.String_Vectors.Universal_String_Vector := League.String_Vectors.Empty_Universal_String_Vector); -- Try to connect to given address asynchronously. Return a connection -- promise or an Error if the address isn't supported. The promise will -- be resolved with a connection or rejected with an error. On successful -- connect the application should set a listener to the connection. After -- that it could write and read data until get a close event. Options are -- protocol dependent. type Connection_Listener is limited interface; type Connection_Listener_Access is access all Connection_Listener'Class with Storage_Size => 0; not overriding procedure Connected (Self : in out Connection_Listener; Connection : not null Network.Connections.Connection_Access; Remote : Network.Addresses.Address) is null; -- Once the manager accepts a new connection. It should assign a listener -- to the connection. procedure Listen (Self : in out Manager'Class; List : Network.Addresses.Address_Array; Listener : Connection_Listener_Access; Error : out League.Strings.Universal_String; Options : League.String_Vectors.Universal_String_Vector := League.String_Vectors.Empty_Universal_String_Vector); -- Make manager to listen given network addresses and call listener on -- new incoming connection. Return Error if some address isn't supported. -- Options are protocol dependent. procedure Wait (Self : in out Manager'Class; Timeout : Duration); -- Run manager for specified time or till some event occurs. private type Protocol is limited interface; type Protocol_Access is access all Protocol'Class with Storage_Size => 0; not overriding function Can_Listen (Self : Protocol; Address : Network.Addresses.Address) return Boolean is abstract; not overriding function Can_Connect (Self : Protocol; Address : Network.Addresses.Address) return Boolean is abstract; not overriding procedure Listen (Self : in out Protocol; List : Network.Addresses.Address_Array; Listener : Connection_Listener_Access; Poll : in out Network.Polls.Poll; Error : out League.Strings.Universal_String; Options : League.String_Vectors.Universal_String_Vector := League.String_Vectors.Empty_Universal_String_Vector) is abstract; not overriding procedure Connect (Self : in out Protocol; Address : Network.Addresses.Address; Poll : in out Network.Polls.Poll; Error : out League.Strings.Universal_String; Promise : out Connection_Promises.Promise; Options : League.String_Vectors.Universal_String_Vector := League.String_Vectors.Empty_Universal_String_Vector) is abstract; procedure Register (Self : in out Manager; Protocol : not null Protocol_Access); type Protocol_Access_Array is array (Positive range <>) of Protocol_Access; type Manager is tagged limited record Poll : Network.Polls.Poll; Proto : Protocol_Access_Array (1 .. 10); Last : Natural := 0; end record; end Network.Managers;
src/pra_boot.asm
vbieleny/page-algorithm-comparison
0
28859
bits 16 ; This is implicit but we declare to make it clear that we are using 16-bit instructions org 0x7c00 ; Our code will be loaded at 0x7C00 by BIOS, so we tell NASM we want to offset all addreses by 0x7C00 jmp 0x0000:_main ; Far jump to ensure that CS = 0x0000 %include "pra_helpers.inc" %include "pra_gdt.inc" load_kernel_chunk: pushad ; Store all general purpose registers to stack ; C = LBA ÷ (HPC × SPT) xor dx, dx mov ax, [current_address] mov cx, HEADS_PER_CYLINDER * SECTORS_PER_TRACK div cx mov [cylinder], al ; H = (LBA ÷ SPT) mod HPC xor dx, dx mov ax, [current_address] mov cx, SECTORS_PER_TRACK div cx xor dx, dx mov cx, HEADS_PER_CYLINDER div cx mov [head], dl ; S = (LBA mod SPT) + 1 xor dx, dx mov ax, [current_address] mov cx, SECTORS_PER_TRACK div cx inc dx mov [sector], dl mov ah, 0x02 ; Read Sectors From Drive mov al, LOAD_SIZE ; Sectors To Read Count mov ch, byte [cylinder] ; Cylinder mov cl, byte [sector] ; Sector mov dh, byte [head] ; Head mov dl, [drive_index] ; Drive xor bx, bx mov es, bx mov bx, 0x7e00 ; ES:BX - Buffer Address Pointer int 0x13 ; Read sectors from boot drive mov ecx, LOAD_BYTES mov esi, 0x7e00 mov edi, [load_address] rep a32 movsb ; Copy loaded sectors from temporary buffer to kernel target address add dword [current_address], LOAD_SIZE ; Increase from what sector we will be reading next add dword [load_address], LOAD_BYTES ; Increase where we will copy next sectors popad ; Restore all general purpose registers from stack ret ; Bootloader entry point _main: ; Initialize essential segment registers xor ax, ax mov ds, ax mov es, ax mov ss, ax mov [drive_index], dl ; Store boot drive index (BIOS loads boot drive index into DL register) mov sp, 0x7c00 ; Set stack pointer to beginning of bootloader growing downwards cld ; Clear the direction flag (data goes onwards for string operations) call clear_screen mov ax, 0x2401 ; Activate A20 gate int 0x15 cli ; Disable interrupts when loading GDT since interrupt could happen when CPU is in inconsistent state push ds ; Push data segemnt to stack for Unreal mode push es ; Push extra segment to stack for Unreal mode lgdt [gdtr] ; Load our Global Descriptor Table mov eax, cr0 or al, 1 mov cr0, eax ; Set PE (Protected Mode Enable) bit in control register CR0 to enable protected mode mov bx, 0x10 ; Load our data segment descriptor as defined in GDT mov ds, bx ; Load segment descriptor cache register with so we can use 32-bit offsets in real mode later mov es, bx ; Load segment descriptor cache register with so we can use 32-bit offsets in real mode later and al, 0xfe mov cr0, eax ; Clear PE (Protected Mode Enable) bit to get to unreal mode (we can do it because we are in 16-bit protected mode) pop es ; Restore extra segment to previous value pop ds ; Restore data segment to previous value sti mov cx, KERNEL_SIZE / LOAD_SIZE .load_loop: call load_kernel_chunk ; Load LOAD_SIZE sectors into temporary kernel buffer and copy it to final kernel destination address loop .load_loop ; Loop until whole kernel is loaded mov di, 0x7e00 xor ebx, ebx mov edx, 0x534d4150 mov word [MEMORY_MAP_COUNT], 0 .load_memory_map: mov eax, 0xe820 mov ecx, 24 int 0x15 jc .load_memory_map_end test ebx, ebx jz .load_memory_map_end add di, 24 add word [MEMORY_MAP_COUNT], 1 jmp .load_memory_map .load_memory_map_end: cli mov eax, cr0 or al, 1 mov cr0, eax ; Set PE (Protected Mode Enable) bit in control register CR0 to enable protected mode jmp 0x08:protected_mode ; Far jump to clear prefetch queue and set selector to segment descriptor for code bits 32 ; Switch to 32-bit instructions as we are already in 32-bit protected mode protected_mode: mov eax, 0x10 ; Selector for data descriptor ; Set all segment registers (except code segment) to data descriptor mov ds, eax mov es, eax mov fs, eax mov gs, eax mov ss, eax mov esp, 0x7c00 ; Point stack to beginning of bootloader code (stack will have 31 KB) call 0x08:KERNEL_ADDRESS ; Jump to C kernel code (at address 0x100000) .hang: hlt jmp .hang ; Endless jump to current address to halt CPU (should never get here) bits 16 ; Switch back to 16-bit mode (not necessary - just in case if there will be some code) KERNEL_SIZE equ 512 ; Kernel size in sectors KERNEL_ADDRESS equ 0x100000 ; Where will our kernel reside LOAD_SIZE equ 16 ; How many sectors to load with one INT13 call LOAD_BYTES equ LOAD_SIZE * 512 ; How many bytes will be loaded with one INT13 call MEMORY_MAP_COUNT equ 0x9000 ; Address of size of memory map entries HEADS_PER_CYLINDER equ 15 ; Default value of HPC for emulated floppy disks SECTORS_PER_TRACK equ 63 ; Default value of SPT for emulated floppy disks cylinder db 0 ; Stores cylinder number for INT13 loading head db 0 ; Stores head number for INT13 loading sector db 0 ; Stores sector number for INT13 loading current_address dw 0x0001 ; Current LBA address that INT13 interrupt will load from drive_index db 0 ; Index of boot drive that this bootloader was loaded from load_address dd KERNEL_ADDRESS ; Address where next chunk of kernel will be copied align 16 ; Align GDT as some CPUs like them aligned gdtr: dw gdt_end - gdt_start - 1 ; Size of GDT table dd gdt_start ; Offset of GDT table gdt_start: dq 0 ; Required null descriptor gdt_entry gdt_code, 0xffff, 0x0000, 0x00, 0b10011010, 0b11001111, 0x00 ; 32-bit code GDT entry gdt_entry gdt_data, 0xffff, 0x0000, 0x00, 0b10010010, 0b11001111, 0x00 ; 32-bit data GDT entry gdt_end: times 510-($-$$) db 0 ; Fill remaining space with zeroes so that bootloader has 512 bytes dw 0xaa55 ; Magic boot sequence for BIOS at the end of bootloader
programs/oeis/109/A109341.asm
karttu/loda
0
26550
; A109341: Take a deck of 52 cards face-down, split it in half and flip one deck and reinsert it into the other deck such that the cards are alternatingly face up and face down. This sequence is the number of face-up cards after repeating this process n times. ; 0,26,26,26,24,26,26,26,16,26,26,26,24,26,26,26,0,26,26,26,24,26,26,26,16,26,26,26,24,26,26,26,0,26,26,26,24,26,26,26,16,26,26,26,24,26,26,26,0,26,26,26,24,26,26,26,16,26,26,26,24,26,26,26,0 add $0,1 mov $2,9 mov $4,7 lpb $0,1 sub $0,1 mov $3,$2 add $3,$4 gcd $3,$0 sub $0,52 div $0,52 mov $1,52 trn $3,3 mov $4,2 lpe add $1,$4 sub $1,$3 trn $1,41 mul $1,2
CoSig/CoSig.agda
hbasold/Sandbox
0
10488
{-# OPTIONS --sized-types #-} module CoSig where open import Data.Product as Prod open import Data.Fin open import Data.Unit open import Data.Empty open import Data.Sum open import Data.Nat open import Size open import Function open import Relation.Binary.PropositionalEquality using (_≡_; refl; subst) ---- We don't use dependencies for now. -- record CoSigDep (I : Set) : Set₁ where -- field -- ∥_∥ : I → Set -- coar : {i : I} → ∥_∥ i → Set -- sel : {i : I} (d : ∥_∥ i) → coar d → I -- open CoSigDep public -- Fam : Set → Set₁ -- Fam I = I → Set -- -- | Extension of co-signature Δ, on objects -- ⟪_⟫ : ∀{I} → CoSigDep I → Fam I → Fam I -- ⟪ Δ ⟫ X i = (d : ∥ Δ ∥ i) → Σ[ u ∈ coar Δ d ] (X (sel Δ d u)) record CoSig : Set₁ where field ∥_∥ : Set coar : ∥_∥ → Set open CoSig public -- | Extension of co-signature Δ, on objects ⟪_⟫ : CoSig → Set → Set --⟪ Δ ⟫ X = (d : ∥ Δ ∥) → Σ[ u ∈ coar Δ d ] X ⟪ Δ ⟫ X = (d : ∥ Δ ∥) → (coar Δ d) × X -- | Extension of signature Σ, on morphisms ⟪_⟫₁ : (Δ : CoSig) {A B : Set} → (A → B) → ⟪ Δ ⟫ A → ⟪ Δ ⟫ B ⟪ Δ ⟫₁ f o d = Prod.map id f (o d) -- | Lift ⟪ Δ ⟫ to relations cosig-lift : {Δ : CoSig} {X : Set} (R : X → X → Set) (o₁ o₂ : ⟪ Δ ⟫ X) → Set cosig-lift {Δ} _R_ o₁ o₂ = ∀ d → proj₁ (o₁ d) ≡ proj₁ (o₂ d) × proj₂ (o₁ d) R proj₂ (o₂ d) record CoSig-FP (Δ : CoSig) : Set where coinductive field destr : ⟪ Δ ⟫ (CoSig-FP Δ) open CoSig-FP public record Str {i : Size} (A : Set) : Set where coinductive constructor _∷_ field hd : A tl : ∀ {j : Size< i} → Str {j} A open Str public --- Example: Streams Str-CoSig : Set → CoSig Str-CoSig A = record { ∥_∥ = ⊤ ; coar = λ _ → A } Str' : Set → Set Str' A = CoSig-FP (Str-CoSig A) -- We can indeed extract a stream from stream implemented through cosignatures. Str'-Str : ∀{A} → Str' A → Str A hd (Str'-Str s) = proj₁ (destr s tt) tl (Str'-Str s) = Str'-Str (proj₂ (destr s tt)) -- Example: Mealy machines MM-CoSig : Set → Set → CoSig MM-CoSig I O = record { ∥_∥ = I ; coar = λ _ → O } MM : Set → Set → Set MM I O = CoSig-FP (MM-CoSig I O) -- Such a Mealy machine gives rise to a causal stream transformation. MM-Causal : ∀{I O} → MM I O → ∀{i} → Str {i} I → Str {i} O hd (MM-Causal m s) = proj₁ (destr m (hd s)) tl (MM-Causal m s) = MM-Causal (proj₂ (destr m (hd s))) (tl s) --- Not quite Example: Streams with stop button BStr-CoSig : Set → CoSig BStr-CoSig A = record { ∥_∥ = ⊥ ⊎ ⊤ ; coar = BStr-CoSig-coar } where BStr-CoSig-coar : ⊥ ⊎ ⊤ → Set BStr-CoSig-coar (inj₁ x) = ⊥-elim x BStr-CoSig-coar (inj₂ y) = A BStr : Set → Set BStr A = CoSig-FP (BStr-CoSig A) st-ones : BStr ℕ destr st-ones (inj₁ x) = ⊥-elim x destr st-ones (inj₂ x) = (1 , st-ones) -- Claim: This way of definining streams with a "stop button" renders -- the button unusable. Thus, we only get streams back. BStr-Str : ∀{A} → BStr A → Str A hd (BStr-Str s) = proj₁ (destr s (inj₂ tt)) tl (BStr-Str s) = BStr-Str (proj₂ (destr s (inj₂ tt))) Str-BStr : ∀{A} → Str A → BStr A destr (Str-BStr s) (inj₁ x) = ⊥-elim x destr (Str-BStr s) (inj₂ y) = (hd s , Str-BStr (tl s)) --- Example: Streams with stop button BStr'-CoSig : Set → CoSig BStr'-CoSig A = record { ∥_∥ = ⊤ ⊎ ⊤ ; coar = BStr-CoSig-coar } where BStr-CoSig-coar : ⊤ ⊎ ⊤ → Set BStr-CoSig-coar (inj₁ x) = ⊥ BStr-CoSig-coar (inj₂ y) = A BStr' : Set → Set BStr' A = CoSig-FP (BStr'-CoSig A) -- Claim: This way of defining streams with a stop button makes any -- such stream undefinable. Thus, the fixed point is trivial. BStr'-triv : ∀{A} → BStr' A → ⊥ BStr'-triv s = proj₁ (destr s (inj₁ tt)) -- An extension of cosignatures that allow us to give a continuation -- for the following states. This enables us to specify systems with, -- for example, termination. record CoSig₂ : Set₁ where field ∥_∥₂ : Set coar₂ : ∥_∥₂ → Set cont : ∥_∥₂ → Set open CoSig₂ public -- | Extension of co-signature Δ, on objects ⟪_⟫₂ : CoSig₂ → Set → Set ⟪ Δ ⟫₂ X = (d : ∥ Δ ∥₂) → (coar₂ Δ d) × (cont Δ d → X) record CoSig₂-FP (Δ : CoSig₂) : Set where coinductive field destr₂ : ⟪ Δ ⟫₂ (CoSig₂-FP Δ) open CoSig₂-FP public --- Example: Streams with stop button BStr-CoSig₂ : Set → CoSig₂ BStr-CoSig₂ A = record { ∥_∥₂ = ⊤ ⊎ ⊤ ; coar₂ = BStr-CoSig-coar ; cont = BStr-CoSig-cont } where BStr-CoSig-coar : ⊤ ⊎ ⊤ → Set BStr-CoSig-coar (inj₁ x) = ⊤ BStr-CoSig-coar (inj₂ y) = A BStr-CoSig-cont : ⊤ ⊎ ⊤ → Set BStr-CoSig-cont (inj₁ x) = ⊥ BStr-CoSig-cont (inj₂ y) = ⊤ BStr₂ : Set → Set BStr₂ A = CoSig₂-FP (BStr-CoSig₂ A) st-ones₂ : BStr₂ ℕ destr₂ st-ones₂ (inj₁ tt) = (tt , ⊥-elim) destr₂ st-ones₂ (inj₂ tt) = (1 , (λ _ → st-ones₂))
scripts/launch/mac/launch_terminal.scpt
dandycheung/flat
1
3221
tell application "Terminal" activate set ProjectRoot to "$(dirname $(dirname $(dirname $(dirname " & (POSIX path of (path to me)) & "))))" do script "yarn --cwd \"" & ProjectRoot & "/desktop/renderer-app\" start" do script "yarn --cwd \"" & ProjectRoot & "/desktop/main-app\" start" end tell
src/shared/generic/lsc-aes_generic-cbc.adb
Componolit/libsparkcrypto
30
11374
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- @author <NAME> -- @date 2019-01-21 -- -- Copyright (C) 2018 Componolit GmbH -- 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 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 LSC.Ops_Generic; package body LSC.AES_Generic.CBC is ------------- -- Decrypt -- ------------- procedure Decrypt (Ciphertext : Ciphertext_Type; IV : Ciphertext_Type; Key : AES_Generic.Dec_Key_Type; Plaintext : out Plaintext_Type) is subtype CIT is Ciphertext_Index_Type; Next : Ciphertext_Type (CIT'First .. CIT'Val (CIT'Pos (CIT'First) + 15)) := IV; procedure Decrypt_XOR is new Ops_Generic.Array_XOR (Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type, Ciphertext_Index_Type, Ciphertext_Elem_Type, Ciphertext_Type, Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type); function Decrypt is new AES_Generic.Decrypt (Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type, Ciphertext_Index_Type, Ciphertext_Elem_Type, Ciphertext_Type); begin for Offset in 0 .. Ciphertext'Length / 16 - 1 loop declare subtype PIT is Plaintext_Index_Type; CT_Start : constant CIT := CIT'Val (CIT'Pos (Ciphertext'First) + 16 * Offset); CT_End : constant CIT := CIT'Val (CIT'Pos (Ciphertext'First) + 16 * Offset + 15); PT_Start : constant PIT := PIT'Val (PIT'Pos (Plaintext'First) + 16 * Offset); PT_End : constant PIT := PIT'Val (PIT'Pos (Plaintext'First) + 16 * Offset + 15); begin Decrypt_XOR (Left => Decrypt (Ciphertext (CT_Start .. CT_End), Key), Right => Next, Result => Plaintext (PT_Start .. PT_End)); Next := Ciphertext (CT_Start .. CT_End); end; end loop; pragma Annotate (GNATprove, False_Positive, """Plaintext"" might not be initialized", "Initialized in complete loop"); end Decrypt; pragma Annotate (GNATprove, False_Positive, """Plaintext"" might not be initialized", "Initialized in complete loop"); ------------- -- Encrypt -- ------------- procedure Encrypt (Plaintext : Plaintext_Type; IV : Ciphertext_Type; Key : AES_Generic.Enc_Key_Type; Ciphertext : out Ciphertext_Type) is subtype CIT is Ciphertext_Index_Type; subtype PIT is Plaintext_Index_Type; Temp : Plaintext_Type (PIT'First .. PIT'Val (PIT'Pos (PIT'First) + 15)); Next : Ciphertext_Type (CIT'First .. CIT'Val (CIT'Pos (CIT'First) + 15)) := IV; procedure Encrypt_XOR is new Ops_Generic.Array_XOR (Ciphertext_Index_Type, Ciphertext_Elem_Type, Ciphertext_Type, Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type, Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type); function Encrypt is new AES_Generic.Encrypt (Plaintext_Index_Type, Plaintext_Elem_Type, Plaintext_Type, Ciphertext_Index_Type, Ciphertext_Elem_Type, Ciphertext_Type); begin for Offset in 0 .. Plaintext'Length / 16 - 1 loop declare CT_Start : constant CIT := CIT'Val (CIT'Pos (Ciphertext'First) + 16 * Offset); CT_End : constant CIT := CIT'Val (CIT'Pos (Ciphertext'First) + 16 * Offset + 15); PT_Start : constant PIT := PIT'Val (PIT'Pos (Plaintext'First) + 16 * Offset); PT_End : constant PIT := PIT'Val (PIT'Pos (Plaintext'First) + 16 * Offset + 15); begin Encrypt_XOR (Left => Next, Right => Plaintext (PT_Start .. PT_End), Result => Temp); Next := Encrypt (Temp, Key); Ciphertext (CT_Start .. CT_End) := Next; end; end loop; pragma Annotate (GNATprove, False_Positive, """Ciphertext"" might not be initialized", "Initialized in complete loop"); end Encrypt; pragma Annotate (GNATprove, False_Positive, """Ciphertext"" might not be initialized", "Initialized in complete loop"); end LSC.AES_Generic.CBC;
firmware/coreboot/3rdparty/blobs/cpu/amd/geode_lx/gplvsa_ii/sysmgr/sw_int.asm
fabiojna02/OpenCellular
1
241779
<gh_stars>1-10 ; ; Copyright (c) 2006-2008 Advanced Micro Devices,Inc. ("AMD"). ; ; This library is free software; you can redistribute it and/or modify ; it under the terms of the GNU Lesser General Public License as ; published by the Free Software Foundation; either version 2.1 of the ; License, or (at your option) any later version. ; ; This code is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General ; Public License along with this library; if not, write to the ; Free Software Foundation, Inc., 59 Temple Place, Suite 330, ; Boston, MA 02111-1307 USA ; ;******************************************************************************** ;* Implementation of BIOS callbacks ;******************************************************************************** include SYSMGR.INC include VSA2.INC include SMIMAC.MAC include GX2.INC include ISA.INC .model tiny,c .586p .ALPHA DGROUP GROUP _CODE, _TEXT _CODE SEGMENT PUBLIC use16 'CODE' ASSUME DS:_CODE public VSM_Buffer SMINT_SEGMENT equ 0E000h ; Segment to store SMINT instruction & ISR stack ALLOW_SMM_SEGMENTS equ 0 ; 1 = ES segment allowed to point to SMM memory externdef pascal Report_VSM_Error: proc externdef pascal Schedule_VSM: proc externdef Sys_Exit: proc externdef pascal Hex_8: proc externdef pascal Hex_16: proc externdef pascal Hex_32: proc externdef BracketFlag: byte externdef SchedulerStack: word externdef INT_Vectors: dword externdef Current_VSM: dword externdef StartSaveArea: dword externdef EndSaveArea: dword externdef SysMgr_VSM: dword externdef Header_Addr: dword externdef SMM_Header: SmiHeader ;************************************************************************ ; Implements the SYS_STATE macro ; ; Input: ; CX = Flag: 0 = Save 1 = Restore ; EDI = Offset to VSM's register buffer ; DS = System Manager's data segment ;************************************************************************ Sys_State proc cld mov eax, [Current_VSM] ; Create flat ptr to calling VSM add edi, eax push eax ; Re-schedule the calling VSM call Schedule_VSM lea esi, [StartSaveArea] add esi, [SysMgr_VSM] jcxz CopyState ; Save or Restore ? xchg esi, edi ; Restore ; Copy the non-SMM state CopyState: mov ecx, OFFSET EndSaveArea sub cx, OFFSET StartSaveArea shr cx, 1 rep movsw [edi], fs:[esi] jmp Sys_Exit Sys_State endp ;************************************************************************ ; Implements the SYS_SW_INTERRUPT macro ; ; Input: ; EBX = 4 * INT number ; ECX = Offset to VSM's register buffer ;************************************************************************ Sys_SW_INT proc cld mov esi, [Current_VSM] push esi ; Re-schedule the calling VSM call Schedule_VSM cmp bx, 4*MAX_INT ; Validate INT vector ja Unsupported_INT mov edx, [INT_Vectors+bx] or edx, edx jz Illegal_INT mov [Saved_INT], ebx ; Save current vector & mov edi, edx ; patch with the original vector xchg fs:[ebx], edi mov [Saved_Vector], edi xor edi, edi ; Don't allow calling VSM to execute push edi call Schedule_VSM ASSUME di:PTR VSM_Header ; Mark the requesting VSM blocked mov gs:[di].SysStuff.RunFlag, RUN_FLAG_BLOCKED ; Handle PIC masks in al, PIC1_MASK ; Save PIC masks & set user-defined masks mov ah, al in al, PIC2_MASK mov [Saved_PIC], ax ASSUME di:PTR INT_REGS mov di, cx mov ax, word ptr gs:[di].PIC0_Mask not ax ; PIC masks are 0=enable cmp ah, 0FFh ; Any PIC1 IRQs enabled ? je short SetPIC and al, NOT 04h ; Yes, enable IRQ2 SetPIC: or al, 01h ; Always disable IRQ0 out PIC1_MASK, al mov al, ah out PIC2_MASK, al cmp ax, 0FFFFh ; Are any IRQs enabled ? je short RealMode or gs:[di].Flags, EFLAGS_IF ; Yes, enable interrupts ; ; Initialize real-mode state ; RealMode: mov ax, gs:[di].Reg_ES ; Set up ES descriptor push OFFSET BIOS_ES call Set_Descriptor mov ax, gs:[di].Reg_DS ; Set up DS descriptor push OFFSET BIOS_DS call Set_Descriptor add esi, ecx ; Create flat ptr to calling VSM's registers mov [VSM_Buffer], esi ASSUME di:PTR SmiHeader lea edi, [BIOS_Header] ; Set up CS descriptor & Next_EIP mov word ptr [di].SS_Flags, DATA_ATTR mov [di].SMI_Flags, SMI_FLAGS_CS_WRITABLE + SMI_FLAGS_CS_READABLE mov word ptr [di].Next_EIP, dx ; IP shr edx, 16 ; Convert segment to linear address mov [di]._CS.selector, dx ; CS selector shl edx, 4 mov [di]._CS.base, edx ; CS descriptor mov [di]._CS.limit, 0FFFFh mov [di]._CS.attr, CODE_ATTR ; CS attribute mov eax, CR0 ; Preserve the CD & NW bits and eax, 60000000h or eax, VSM_CR0 mov [di].r_CR0, eax if ALLOW_SMM_SEGMENTS mov ecx, MSR_RCONF_SMM ; Make SMM memory writeable by interrupt code rdmsr mov [OldRCONF], al and al, NOT REGION_WP wrmsr endif ASSUME DI: NOTHING mov ecx, 1000002Ch ; Save P2D_SC value & make UMBs R/W rdmsr mov [ShadowMSR], dx or dx, 0FFFFh wrmsr mov ebx, SMINT_SEGMENT ; Patch SS descriptor mov word ptr [BIOS_SS+8], bx shl ebx, 4 mov dword ptr [BIOS_SS+2], ebx mov byte ptr [BIOS_SS+5], DATA_ATTR add ebx, 0FFF0h mov [ShadowAddr], ebx mov word ptr [BIOS_ESP], bx ; Build a stack frame: ; SMINT_SEGMENT:FFF0 SMINT_SEGMENT:FFF6 - return addresss ; SMINT_SEGMENT:FFF4 Flags ; SMINT_SEGMENT:FFF6 SMINT instruction mov eax, SMINT_SEGMENT SHL 16 ; Segment lea ax, [bx+6] ; Offset (SP+6) xchg eax, dword ptr fs:[ebx] mov [ShadowMemory], eax mov eax, 380F0000h ; FLAGS & SMINT xchg eax, fs:[ebx+4] mov [ShadowMemory+4], eax mov eax, [Header_Addr] ; Copy top-level header address mov [Hdr_Address], eax call VSM_Registers ; Get registers for ISR call Swap_States ; S wap top-level state with BIOS state Exit: jmp Sys_Exit Unsupported_INT: Illegal_INT: mov ax, ERR_BAD_INTERRUPT push ax ; Push error code shr ebx, 2 push ebx ; Info1 = Interrupt # push dword ptr 0 ; Info2 = 0x00000000 call Report_VSM_Error jmp Exit Sys_SW_INT endp ;******************************************************************************** ; Returns here from INT callback ;******************************************************************************** INT_Return proc mov ebx, [Saved_INT] ; Restore the INT vector mov edx, [Saved_Vector] mov fs:[ebx], edx if ALLOW_SMM_SEGMENTS mov ecx, MSR_RCONF_SMM ; Restore SMM region properties rdmsr mov al, [OldRCONF] wrmsr endif mov esi, [Current_VSM] ; Mark the requesting VSM ready to run mov fs:(VSM_Header PTR [esi]).SysStuff.RunFlag, RUN_FLAG_READY call Swap_States ; Restore the original non-SMM state call VSM_Registers ; Return register values & flags xor eax, eax mov [VSM_Buffer], eax sub [SchedulerStack], 4 ; Pop the scheduler sentinel mov ebx, [ShadowAddr] ; Restore shadow memory mov eax, [ShadowMemory] mov fs:[ebx], eax mov eax, [ShadowMemory+4] mov fs:[ebx+4], eax mov ecx, 1000002Ch ; Restore R/W attributes of UMBs rdmsr mov dx, [ShadowMSR] wrmsr mov ax, [Saved_PIC] ; Restore PIC masks out PIC2_MASK, al mov al, ah out PIC1_MASK, al ret INT_Return endp ;************************************************************************ ; Swaps the top-level state with the BIOS callback state. ; Info to be saved: ; - SMM header & pointer ; - Descriptors ; - GP registers ; - IDT ptr ; - PCI config address ;************************************************************************ Swap_States proc lea si, [StartSaveArea] ; Swap thread states lea di, [Saved_State] mov cx, OFFSET EndSaveArea ; Compute # dwords of state sub cx, si shr cx, 2 StateLoop: lodsd ; Exchange a dword xchg [di], eax mov dword ptr [si-4], eax add di, 4 loop StateLoop lea si, [SMM_Header] ; Now do the top-level SMM header lea di, [BIOS_Header] mov cl, sizeof(SmiHeader)/4 Hdr_Loop: lodsd xchg [di], eax mov [si-4], eax add di, 4 loop Hdr_Loop ret Swap_States endp ;************************************************************************ ; Swaps the VSM's registers with the local state ;************************************************************************ VSM_Registers proc mov esi, [VSM_Buffer] ; Caller's register buffer mov ax, word ptr [BIOS_Header].EFLAGS xchg fs:(INT_REGS PTR [esi]).Flags, ax mov word ptr [BIOS_Header].EFLAGS, ax lea bx, [Reg_Table] mov cx, (End_Reg_Table-Reg_Table)/2 Reg_Loop: mov di, [bx] ; Get offset of register mov eax, [di] ; Swap with register structure xchg eax, fs:[esi] mov [di], eax add bx, 2 ; Increment ptrs add esi, 4 loop Reg_Loop ret ; This table translates between a INT_REGS structure and the PUSHA/POPA ordering Reg_Table: dw OFFSET BIOS_EAX dw OFFSET BIOS_EBX dw OFFSET BIOS_ECX dw OFFSET BIOS_EDX dw OFFSET BIOS_EBP dw OFFSET BIOS_ESI dw OFFSET BIOS_EDI End_Reg_Table: VSM_Registers endp ;************************************************************************ ; Sets a descriptor to a real-mode descriptor ; Input: ; AX = selector ; If selector = 0x0000, a 4 GB descriptor (big-real) is used ; If selector = 0xFFFF, the calling VSM's base/limit is used ; DI = ptr to descriptor ;************************************************************************ Set_Descriptor proc pascal uses di \ DescrPtr: PTR Descriptor ASSUME di: PTR Descriptor mov di, [DescrPtr] mov ebx, 0FFFFh ; 64K limit or ax, ax ; Selector = 0000h? jnz short SetSelector mov ebx, 008FFFFFh ; Yes, then use 4 GB limit (big-real mode) SetSelector: movzx eax, ax mov [di].selector, ax shl eax, 4 if ALLOW_SMM_SEGMENTS ; If ES == 0xFFFF, use VSM's base cmp ax, bx jne short Set_Limit mov eax, [Current_VSM] ; No, use VSM's base & limit mov bx, ax shr bx, 4 mov [di].selector, bx mov ebx, (VSM_Header PTR fs:[eax]).DS_Limit endif Set_Limit: ; EAX = base ; EBX = limit mov [di].limit_15_0, bx ; Store 24-bit limit shr ebx, 16 mov [di].limit_19_16, bl mov [di].base_15_0, ax ; Store 32-bit base shr eax, 16 mov [di].base_23_16, al mov [di].base_31_24, ah ret ASSUME di: NOTHING Set_Descriptor endp align 4 Saved_State: ;****************************************************************************** ; The following must match the structure at StartSaveArea in SYSMGR.ASM BIOS_PCI dd 80000000h BIOS_EDI dd 0 BIOS_ESI dd 0 BIOS_EBP dd 0 dd 0 ; ESP (not used) BIOS_EBX dd 0 BIOS_EDX dd 0 BIOS_ECX dd 0 BIOS_EAX dd 0 BIOS_ESP dd 0 BIOS_SS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0} BIOS_DS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0} BIOS_ES Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0} BIOS_FS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0} BIOS_GS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0} Hdr_Address dd 0 IDT_Selector dd 00920000h IDT_Base dd 00000000h IDT_Limit dd 0000FFFFh dw 0 ; Pad ;****************************************************************************** SMM_CONTROL equ EXTL_SMI_EN + INTL_SMI_EN + SMM_INST_EN + NEST_SMI_EN BIOS_Header SmiHeader {,SMM_CONTROL,,,,,,,,,VSM_CR0, VSM_EFLAGS, VSM_DR7} ShadowMemory dd 0, 0 ShadowAddr dd 0 ShadowMSR dw 0 VSM_Buffer dd 0 Saved_PIC dw 0 Saved_INT dd 0 Saved_Vector dd 0 OldRCONF db 0 _CODE ENDS END
mikroC/DisUSART/project.asm
chen0040/cs-dspic-ultrasonic
0
242154
_MySoft_UART_Write: ;project.c,9 :: void MySoft_UART_Write(char* message) ;project.c,11 :: MySoftUSARTWrite_MessageLen=strlen(message); CALL _strlen MOV W0, _MySoftUSARTWrite_MessageLen ;project.c,12 :: for(MySoftUSARTWrite_MessageIdx=0; MySoftUSARTWrite_MessageIdx < MySoftUSARTWrite_MessageLen; MySoftUSARTWrite_MessageIdx++) CLR W0 MOV W0, _MySoftUSARTWrite_MessageIdx L_MySoft_UART_Write0: MOV _MySoftUSARTWrite_MessageIdx, W1 MOV #lo_addr(_MySoftUSARTWrite_MessageLen), W0 CP W1, [W0] BRA LT L__MySoft_UART_Write70 GOTO L_MySoft_UART_Write1 L__MySoft_UART_Write70: ;project.c,14 :: Soft_UART_Write(message[MySoftUSARTWrite_MessageIdx]); MOV #lo_addr(_MySoftUSARTWrite_MessageIdx), W0 ADD W10, [W0], W0 PUSH W10 MOV.B [W0], W10 CALL _Soft_UART_Write POP W10 ;project.c,12 :: for(MySoftUSARTWrite_MessageIdx=0; MySoftUSARTWrite_MessageIdx < MySoftUSARTWrite_MessageLen; MySoftUSARTWrite_MessageIdx++) MOV #1, W1 MOV #lo_addr(_MySoftUSARTWrite_MessageIdx), W0 ADD W1, [W0], [W0] ;project.c,15 :: } GOTO L_MySoft_UART_Write0 L_MySoft_UART_Write1: ;project.c,16 :: } L_end_MySoft_UART_Write: RETURN ; end of _MySoft_UART_Write _Timer1Int: PUSH RCOUNT PUSH W0 MOV #2, W0 REPEAT #12 PUSH [W0++] ;project.c,18 :: void Timer1Int() iv IVT_ADDR_T1INTERRUPT { // Timer interrupt, sample with 40kHz ;project.c,19 :: LATC = ~PORTC; // invert PortC for generating signal MOV #lo_addr(LATC), W1 MOV PORTC, WREG COM W0, [W1] ;project.c,20 :: IFS0.T1IF = 0; // clear interrupt flag BCLR IFS0, #3 ;project.c,21 :: } L_end_Timer1Int: MOV #26, W0 REPEAT #12 POP [W0--] POP W0 POP RCOUNT RETFIE ; end of _Timer1Int _InitPort: ;project.c,23 :: void InitPort(void) { // function for initialization of I/O PORTS ;project.c,24 :: ADPCFG = 0xFEFF; // Configure AN pins as digital except PinB8 MOV #65279, W0 MOV WREG, ADPCFG ;project.c,25 :: TRISC = 0x0000; // set PORTC as output CLR TRISC ;project.c,26 :: PORTC = 0x2000; // default value of PORTC MOV #8192, W0 MOV WREG, PORTC ;project.c,27 :: TRISB.B8 = 1; // set PinB8 as input BSET TRISB, #8 ;project.c,28 :: } L_end_InitPort: RETURN ; end of _InitPort _InitTimer: ;project.c,30 :: void InitTimer(void) { // Initialization of Timer1 ;project.c,31 :: T1CON.B5 = 0; // prescaler 1:1 BCLR T1CON, #5 ;project.c,32 :: T1CON.B4 = 0; BCLR T1CON, #4 ;project.c,33 :: PR1 = (unsigned long)(Get_Fosc_kHz()) * 1000 / (8 * SAMPLE_FREQ); CALL _Get_Fosc_kHz MOV #1000, W2 MOV #0, W3 CALL __Multiply_32x32 MOV #57856, W2 MOV #4, W3 CLR W4 CALL __Divide_32x32 MOV W0, PR1 ;project.c,34 :: TON_bit = 1; // start Timer1 BSET TON_bit, #15 ;project.c,35 :: } L_end_InitTimer: RETURN ; end of _InitTimer _InitDelay: ;project.c,37 :: void InitDelay(void) { // Initialization of Timer2 ;project.c,38 :: T2CON.B5 = 0; // prescaler 1:8 BCLR T2CON, #5 ;project.c,39 :: T2CON.B4 = 1; BSET T2CON, #4 ;project.c,40 :: TMR2 = 0x0000; // Initial value of TMR2 register CLR TMR2 ;project.c,41 :: T2CON.TON = 1; // start Timer2 BSET T2CON, #15 ;project.c,42 :: } L_end_InitDelay: RETURN ; end of _InitDelay _InitADC: ;project.c,44 :: void InitADC(void) { // Initialization of ADC module ;project.c,45 :: ADC1_Init(); CALL _ADC1_Init ;project.c,46 :: } L_end_InitADC: RETURN ; end of _InitADC _InitVariable: ;project.c,48 :: void InitVariable(void) { // setting initial values ;project.c,49 :: abc = 0; CLR W0 MOV W0, _abc ;project.c,50 :: temp_old = 0; CLR W0 MOV W0, _temp_old ;project.c,51 :: distance = 0; CLR W0 MOV W0, _distance ;project.c,52 :: } L_end_InitVariable: RETURN ; end of _InitVariable _InitUSART: ;project.c,54 :: void InitUSART(void) { // Initialization of UART1 ;project.c,55 :: TRISD = 0; // Set PORTD as output (error signalization) PUSH W10 PUSH W11 PUSH W12 CLR TRISD ;project.c,56 :: LATD = 0; CLR LATD ;project.c,58 :: error = Soft_UART_Init(&PORTF, 2, 3, 14400, 0); // Initialize Soft UART at 14400 bps MOV #3, W12 MOV #2, W11 MOV #lo_addr(PORTF), W10 CLR W0 PUSH W0 MOV #14400, W0 MOV #0, W1 PUSH.D W0 CALL _Soft_UART_Init SUB #6, W15 MOV #lo_addr(_error), W1 MOV.B W0, [W1] ;project.c,59 :: if (error > 0) { CP.B W0, #0 BRA GTU L__InitUSART78 GOTO L_InitUSART3 L__InitUSART78: ;project.c,60 :: LATD = error; // Signalize Init error MOV #lo_addr(_error), W0 ZE [W0], W0 MOV WREG, LATD ;project.c,61 :: while(1); // Stop program L_InitUSART4: GOTO L_InitUSART4 ;project.c,62 :: } L_InitUSART3: ;project.c,63 :: Delay_ms(100); MOV #11, W8 MOV #11309, W7 L_InitUSART6: DEC W7 BRA NZ L_InitUSART6 DEC W8 BRA NZ L_InitUSART6 ;project.c,64 :: } L_end_InitUSART: POP W12 POP W11 POP W10 RETURN ; end of _InitUSART _main: MOV #2048, W15 MOV #6142, W0 MOV WREG, 32 MOV #1, W0 MOV WREG, 52 MOV #4, W0 IOR 68 LNK #16 PUSH W4 PUSH W3 ;project.c,66 :: void main() { // Main Program ;project.c,68 :: InitPort(); // Initialization PUSH W10 PUSH W11 CALL _InitPort ;project.c,69 :: InitTimer(); CALL _InitTimer ;project.c,70 :: InitADC(); CALL _InitADC ;project.c,71 :: InitUSART(); CALL _InitUSART ;project.c,73 :: while(1) { // Unending loop L_main8: ;project.c,76 :: IEC0.T1IE = 1; // enable T1 interrupt BSET IEC0, #3 ;project.c,77 :: Delay_us(100); // Software PWM lasts 300us MOV #666, W7 L_main10: DEC W7 BRA NZ L_main10 NOP NOP ;project.c,78 :: IEC0.T1IE = 0; // disable T1 interrupt BCLR IEC0, #3 ;project.c,81 :: Delay_ms(1); // wait 1ms so piezzo sattles down MOV #6666, W7 L_main12: DEC W7 BRA NZ L_main12 NOP NOP ;project.c,83 :: InitDelay(); // Start/initialize Timer2 to count Delay CALL _InitDelay ;project.c,85 :: temp = ADC1_Get_Sample(8); // get first two samples MOV #8, W10 CALL _ADC1_Get_Sample MOV W0, _temp ;project.c,86 :: Delay_us(1); MOV #6, W7 L_main14: DEC W7 BRA NZ L_main14 NOP NOP ;project.c,87 :: temp_sec = ADC1_Get_Sample(8); MOV #8, W10 CALL _ADC1_Get_Sample MOV W0, _temp_sec ;project.c,89 :: InitVariable(); // Initialization of Variables CALL _InitVariable ;project.c,91 :: while (temp > temp_sec) { // check if returned wave is uprising L_main16: MOV _temp, W1 MOV #lo_addr(_temp_sec), W0 CP W1, [W0] BRA GTU L__main80 GOTO L_main17 L__main80: ;project.c,92 :: Delay_us(10); // if not check again in 10us MOV #66, W7 L_main18: DEC W7 BRA NZ L_main18 NOP NOP ;project.c,93 :: temp = ADC1_Get_Sample(8); MOV #8, W10 CALL _ADC1_Get_Sample MOV W0, _temp ;project.c,94 :: Delay_us(1); MOV #6, W7 L_main20: DEC W7 BRA NZ L_main20 NOP NOP ;project.c,95 :: temp_sec = ADC1_Get_Sample(8); MOV #8, W10 CALL _ADC1_Get_Sample MOV W0, _temp_sec ;project.c,96 :: } GOTO L_main16 L_main17: ;project.c,98 :: while(abc < 1000) { // Measure in lenght of 250ms L_main22: MOV _abc, W1 MOV #1000, W0 CP W1, W0 BRA LT L__main81 GOTO L_main23 L__main81: ;project.c,99 :: temp = ADC1_Get_Sample(8); // get sample MOV #8, W10 CALL _ADC1_Get_Sample MOV W0, _temp ;project.c,100 :: if (temp > temp_old) { // if new value is bigger then old MOV #lo_addr(_temp_old), W1 CP W0, [W1] BRA GTU L__main82 GOTO L_main24 L__main82: ;project.c,101 :: temp_old = temp; // set value of ADC into temporary variable MOV _temp, W0 MOV W0, _temp_old ;project.c,102 :: time = TMR2; // remember time when value was measured MOV TMR2, WREG MOV W0, _time ;project.c,103 :: } L_main24: ;project.c,104 :: abc++; MOV #1, W1 MOV #lo_addr(_abc), W0 ADD W1, [W0], [W0] ;project.c,105 :: Delay_us(50); MOV #333, W7 L_main25: DEC W7 BRA NZ L_main25 NOP ;project.c,106 :: } GOTO L_main22 L_main23: ;project.c,107 :: T2CON.TON = 0; // Stop Timer2 BCLR T2CON, #15 ;project.c,109 :: if (time < 0) // absolute value of time MOV _time, W0 CP W0, #0 BRA LTU L__main83 GOTO L_main27 L__main83: ;project.c,110 :: time = - time; MOV _time, W1 MOV #lo_addr(_time), W0 SUBR W1, #0, [W0] L_main27: ;project.c,113 :: if (time < 600) MOV _time, W1 MOV #600, W0 CP W1, W0 BRA LTU L__main84 GOTO L_main28 L__main84: ;project.c,114 :: distance = time / 40; // 40 MOV #40, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main29 L_main28: ;project.c,115 :: else if ((time > 599) && (time < 1200)) MOV _time, W1 MOV #599, W0 CP W1, W0 BRA GTU L__main85 GOTO L__main60 L__main85: MOV _time, W1 MOV #1200, W0 CP W1, W0 BRA LTU L__main86 GOTO L__main59 L__main86: L__main58: ;project.c,116 :: distance = time / 60; // 60 MOV #60, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main33 ;project.c,115 :: else if ((time > 599) && (time < 1200)) L__main60: L__main59: ;project.c,117 :: else if ((time > 1199) && (time < 2800)) MOV _time, W1 MOV #1199, W0 CP W1, W0 BRA GTU L__main87 GOTO L__main62 L__main87: MOV _time, W1 MOV #2800, W0 CP W1, W0 BRA LTU L__main88 GOTO L__main61 L__main88: L__main57: ;project.c,118 :: distance = time / 90; // 90 MOV #90, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main37 ;project.c,117 :: else if ((time > 1199) && (time < 2800)) L__main62: L__main61: ;project.c,119 :: else if ((time > 2799) && (time < 7200)) MOV _time, W1 MOV #2799, W0 CP W1, W0 BRA GTU L__main89 GOTO L__main64 L__main89: MOV _time, W1 MOV #7200, W0 CP W1, W0 BRA LTU L__main90 GOTO L__main63 L__main90: L__main56: ;project.c,120 :: distance = time / 110; // 110 MOV #110, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main41 ;project.c,119 :: else if ((time > 2799) && (time < 7200)) L__main64: L__main63: ;project.c,121 :: else if ((time > 7199) && (time < 20000)) MOV _time, W1 MOV #7199, W0 CP W1, W0 BRA GTU L__main91 GOTO L__main66 L__main91: MOV _time, W1 MOV #20000, W0 CP W1, W0 BRA LTU L__main92 GOTO L__main65 L__main92: L__main55: ;project.c,122 :: distance = time / 125; // 125 MOV #125, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main45 ;project.c,121 :: else if ((time > 7199) && (time < 20000)) L__main66: L__main65: ;project.c,123 :: else if ((time > 19999) && (time < 35000)) MOV _time, W1 MOV #19999, W0 CP W1, W0 BRA GTU L__main93 GOTO L__main68 L__main93: MOV _time, W1 MOV #35000, W0 CP W1, W0 BRA LTU L__main94 GOTO L__main67 L__main94: L__main54: ;project.c,124 :: distance = time / 135; // 135 MOV #135, W2 MOV _time, W0 REPEAT #17 DIV.U W0, W2 MOV W0, _distance GOTO L_main49 ;project.c,123 :: else if ((time > 19999) && (time < 35000)) L__main68: L__main67: ;project.c,126 :: distance = 0; CLR W0 MOV W0, _distance L_main49: L_main45: L_main41: L_main37: L_main33: L_main29: ;project.c,128 :: if (distance == 0) { // if distance is 0 the object is too far MOV _distance, W0 CP W0, #0 BRA Z L__main95 GOTO L_main50 L__main95: ;project.c,129 :: MySoft_UART_Write("Too Far"); ADD W14, #0, W3 MOV #___Lib_System_DefaultPage, W4 MOV W4, 52 MOV #lo_addr(?ICS?lstr1_project), W4 REPEAT #7 MOV.B [W4++], [W3++] ADD W14, #0, W0 MOV W0, W10 CALL _MySoft_UART_Write ;project.c,130 :: MySoft_UART_Write("|"); MOV #124, W3 MOV.B W3, [W14+8] MOV #0, W3 MOV.B W3, [W14+9] ADD W14, #8, W0 MOV W0, W10 CALL _MySoft_UART_Write ;project.c,131 :: } GOTO L_main51 L_main50: ;project.c,133 :: IntToStr(distance, txt); // converts time into string MOV #lo_addr(_txt), W11 MOV _distance, W10 CALL _IntToStr ;project.c,134 :: MySoft_UART_Write(txt); MOV #lo_addr(_txt), W10 CALL _MySoft_UART_Write ;project.c,135 :: MySoft_UART_Write (" cm"); // send value over UART MOV #32, W3 MOV.B W3, [W14+10] MOV #99, W3 MOV.B W3, [W14+11] MOV #109, W3 MOV.B W3, [W14+12] MOV #0, W3 MOV.B W3, [W14+13] ADD W14, #10, W0 MOV W0, W10 CALL _MySoft_UART_Write ;project.c,136 :: MySoft_UART_Write("|"); MOV #124, W3 MOV.B W3, [W14+14] MOV #0, W3 MOV.B W3, [W14+15] ADD W14, #14, W0 MOV W0, W10 CALL _MySoft_UART_Write ;project.c,137 :: } L_main51: ;project.c,139 :: Delay_ms(500); // delay before next measure MOV #51, W8 MOV #56549, W7 L_main52: DEC W7 BRA NZ L_main52 DEC W8 BRA NZ L_main52 ;project.c,140 :: } GOTO L_main8 ;project.c,141 :: } L_end_main: POP W3 POP W4 ULNK L__main96: BRA L__main96 ; end of _main
test/Fail/Issue4135.agda
cruhland/agda
1,989
5844
<reponame>cruhland/agda<filename>test/Fail/Issue4135.agda -- Andreas, 2020-06-17, issue #4135 -- Constructor disambiguation on should only instantiate metas -- in a unique way. -- {-# OPTIONS -v tc.lhs:10 #-} -- {-# OPTIONS -v tc.lhs.split:40 #-} -- {-# OPTIONS -v tc.lhs.disamb:40 #-} data Bool : Set where true false : Bool module Foo (b : Bool) where data D : Set where c : D open module True = Foo true open module False = Foo false test : Foo.D ? → Set test c = ? -- C-c C-= -- EXPECTED ERROR: -- Ambiguous constructor c. -- ... -- when checking that the pattern c has type Foo.D ?0
src/adda.ads
alban-linard/adda
0
4723
package Adda is end Adda;
samples/1.asm
Seas0/masm-tasm
68
97927
<reponame>Seas0/masm-tasm ; a simple hello word sample .386 DATA SEGMENT USE16 MESG DB 'hello tasm',0AH,'$' DATA ENDS CODE SEGMENT USE16 ASSUME CS:CODE,DS:DATA BEG: MOV AX,DATA MOV DS, AX MOV CX,8 LAST:MOV AH,9 MOV DX, OFFSET MESG INT 21H LOOP LAST MOV AH,4CH INT 21H ;BACK TO DOS CODE ENDS END BEG
fiat-amd64/65.35_ratio12744_seed2003353293586321_mul_secp256k1.asm
dderjoel/fiat-crypto
491
28440
SECTION .text GLOBAL mul_secp256k1 mul_secp256k1: sub rsp, 0x150 ; last 0x30 (6) for Caller - save regs mov [ rsp + 0x120 ], rbx; saving to stack mov [ rsp + 0x128 ], rbp; saving to stack mov [ rsp + 0x130 ], r12; saving to stack mov [ rsp + 0x138 ], r13; saving to stack mov [ rsp + 0x140 ], r14; saving to stack mov [ rsp + 0x148 ], r15; saving to stack mov rax, [ rsi + 0x8 ]; load m64 x1 to register64 mov r10, [ rsi + 0x0 ]; load m64 x4 to register64 mov r11, rdx; preserving value of arg2 into a new reg mov rdx, [ rdx + 0x0 ]; saving arg2[0] in rdx. mulx rbx, rbp, r10; x12, x11<- x4 * arg2[0] mov r12, 0xd838091dd2253531 ; moving imm to reg mov rdx, r12; 0xd838091dd2253531 to rdx mulx r12, r13, rbp; _, x20<- x11 * 0xd838091dd2253531 mov r12, 0xfffffffefffffc2f ; moving imm to reg xchg rdx, r13; x20, swapping with 0xd838091dd2253531, which is currently in rdx mulx r14, r15, r12; x29, x28<- x20 * 0xfffffffefffffc2f mov rcx, 0xffffffffffffffff ; moving imm to reg mulx r8, r9, rcx; x27, x26<- x20 * 0xffffffffffffffff mulx r12, r13, rcx; x25, x24<- x20 * 0xffffffffffffffff mov [ rsp + 0x0 ], rdi; spilling out1 to mem mulx rdx, rdi, rcx; x23, x22<- x20 * 0xffffffffffffffff xor rcx, rcx adox r9, r14 mov r14, rdx; preserving value of x23 into a new reg mov rdx, [ r11 + 0x10 ]; saving arg2[2] in rdx. mov [ rsp + 0x8 ], rsi; spilling arg1 to mem mulx rcx, rsi, r10; x8, x7<- x4 * arg2[2] adox r13, r8 adcx r15, rbp mov rdx, [ r11 + 0x8 ]; arg2[1] to rdx mulx r15, rbp, r10; x10, x9<- x4 * arg2[1] adox rdi, r12 seto r8b; spill OF x35 to reg (r8) mov r12, -0x2 ; moving imm to reg inc r12; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1) adox rbp, rbx adox rsi, r15 mov rdx, rax; x1 to rdx mulx rax, rbx, [ r11 + 0x8 ]; x52, x51<- x1 * arg2[1] mulx r15, r12, [ r11 + 0x0 ]; x54, x53<- x1 * arg2[0] adcx r9, rbp adcx r13, rsi movzx rbp, r8b; x36, copying x35 here, cause x35 is needed in a reg for other than x36, namely all: , x36, size: 1 lea rbp, [ rbp + r14 ] setc r14b; spill CF x42 to reg (r14) clc; adcx rbx, r15 setc r8b; spill CF x56 to reg (r8) clc; adcx r12, r9 mov rsi, 0xd838091dd2253531 ; moving imm to reg xchg rdx, r12; x62, swapping with x1, which is currently in rdx mulx r15, r9, rsi; _, x72<- x62 * 0xd838091dd2253531 mov r15, rdx; preserving value of x62 into a new reg mov rdx, [ r11 + 0x18 ]; saving arg2[3] in rdx. mulx r10, rsi, r10; x6, x5<- x4 * arg2[3] adcx rbx, r13 mov r13, 0xfffffffefffffc2f ; moving imm to reg mov rdx, r9; x72 to rdx mov [ rsp + 0x10 ], rbp; spilling x36 to mem mulx r9, rbp, r13; x81, x80<- x72 * 0xfffffffefffffc2f setc r13b; spill CF x65 to reg (r13) clc; adcx rbp, r15 mov rbp, 0xffffffffffffffff ; moving imm to reg mov [ rsp + 0x18 ], r10; spilling x6 to mem mulx r15, r10, rbp; x79, x78<- x72 * 0xffffffffffffffff seto bpl; spill OF x16 to reg (rbp) mov [ rsp + 0x20 ], r15; spilling x79 to mem mov r15, -0x2 ; moving imm to reg inc r15; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1) adox r10, r9 mov r9, [ rsp + 0x8 ]; load m64 arg1 to register64 mov r15, [ r9 + 0x10 ]; load m64 x2 to register64 mov byte [ rsp + 0x28 ], r13b; spilling byte x65 to mem mov r13, rdx; preserving value of x72 into a new reg mov rdx, [ r11 + 0x10 ]; saving arg2[2] in rdx. mov [ rsp + 0x30 ], rax; spilling x52 to mem mov byte [ rsp + 0x38 ], r8b; spilling byte x56 to mem mulx rax, r8, r12; x50, x49<- x1 * arg2[2] adcx r10, rbx mov rdx, [ r11 + 0x0 ]; arg2[0] to rdx mov [ rsp + 0x40 ], rax; spilling x50 to mem mulx rbx, rax, r15; x107, x106<- x2 * arg2[0] mov [ rsp + 0x48 ], rbx; spilling x107 to mem setc bl; spill CF x92 to reg (rbx) clc; adcx rax, r10 setc r10b; spill CF x116 to reg (r10) clc; mov byte [ rsp + 0x50 ], bl; spilling byte x92 to mem mov rbx, -0x1 ; moving imm to reg movzx rbp, bpl adcx rbp, rbx; loading flag adcx rcx, rsi mov rbp, 0xd838091dd2253531 ; moving imm to reg mov rdx, rbp; 0xd838091dd2253531 to rdx mulx rbp, rsi, rax; _, x125<- x115 * 0xd838091dd2253531 setc bpl; spill CF x18 to reg (rbp) clc; movzx r14, r14b adcx r14, rbx; loading flag adcx rcx, rdi setc dil; spill CF x44 to reg (rdi) movzx r14, byte [ rsp + 0x38 ]; load byte memx56 to register64 clc; adcx r14, rbx; loading flag adcx r8, [ rsp + 0x30 ] setc r14b; spill CF x58 to reg (r14) movzx rbx, byte [ rsp + 0x28 ]; load byte memx65 to register64 clc; mov rdx, -0x1 ; moving imm to reg adcx rbx, rdx; loading flag adcx rcx, r8 mov rbx, 0xfffffffefffffc2f ; moving imm to reg mov rdx, rsi; x125 to rdx mov byte [ rsp + 0x58 ], r14b; spilling byte x58 to mem mulx r8, r14, rbx; x134, x133<- x125 * 0xfffffffefffffc2f mov rbx, rdx; preserving value of x125 into a new reg mov rdx, [ r11 + 0x8 ]; saving arg2[1] in rdx. mov byte [ rsp + 0x60 ], r10b; spilling byte x116 to mem mov byte [ rsp + 0x68 ], dil; spilling byte x44 to mem mulx r10, rdi, r15; x105, x104<- x2 * arg2[1] mov [ rsp + 0x70 ], r10; spilling x105 to mem movzx r10, bpl; x19, copying x18 here, cause x18 is needed in a reg for other than x19, namely all: , x19, size: 1 mov [ rsp + 0x78 ], rcx; spilling x66 to mem mov rcx, [ rsp + 0x18 ]; load m64 x6 to register64 lea r10, [ r10 + rcx ]; r8/64 + m8 setc cl; spill CF x67 to reg (rcx) clc; adcx r14, rax mov r14, 0xffffffffffffffff ; moving imm to reg mov rdx, r14; 0xffffffffffffffff to rdx mulx r14, rax, r13; x77, x76<- x72 * 0xffffffffffffffff setc bpl; spill CF x143 to reg (rbp) clc; adcx rdi, [ rsp + 0x48 ] mov byte [ rsp + 0x80 ], cl; spilling byte x67 to mem mov byte [ rsp + 0x88 ], bpl; spilling byte x143 to mem mulx rcx, rbp, rbx; x132, x131<- x125 * 0xffffffffffffffff mov rdx, [ rsp + 0x20 ]; x84, copying x79 here, cause x79 is needed in a reg for other than x84, namely all: , x84--x85, size: 1 adox rdx, rax setc al; spill CF x109 to reg (rax) clc; adcx rbp, r8 setc r8b; spill CF x136 to reg (r8) mov [ rsp + 0x90 ], rcx; spilling x132 to mem movzx rcx, byte [ rsp + 0x50 ]; load byte memx92 to register64 clc; mov byte [ rsp + 0x98 ], al; spilling byte x109 to mem mov rax, -0x1 ; moving imm to reg adcx rcx, rax; loading flag adcx rdx, [ rsp + 0x78 ] setc cl; spill CF x94 to reg (rcx) movzx rax, byte [ rsp + 0x68 ]; load byte memx44 to register64 clc; mov byte [ rsp + 0xa0 ], r8b; spilling byte x136 to mem mov r8, -0x1 ; moving imm to reg adcx rax, r8; loading flag adcx r10, [ rsp + 0x10 ] mov rax, rdx; preserving value of x93 into a new reg mov rdx, [ r11 + 0x10 ]; saving arg2[2] in rdx. mov byte [ rsp + 0xa8 ], cl; spilling byte x94 to mem mulx r8, rcx, r15; x103, x102<- x2 * arg2[2] mov [ rsp + 0xb0 ], r8; spilling x103 to mem mov r8, 0xffffffffffffffff ; moving imm to reg mov rdx, r8; 0xffffffffffffffff to rdx mov [ rsp + 0xb8 ], rcx; spilling x102 to mem mulx r8, rcx, rbx; x130, x129<- x125 * 0xffffffffffffffff mov [ rsp + 0xc0 ], r8; spilling x130 to mem mov r8, rdx; preserving value of 0xffffffffffffffff into a new reg mov rdx, [ r11 + 0x18 ]; saving arg2[3] in rdx. mov [ rsp + 0xc8 ], rcx; spilling x129 to mem mulx r12, rcx, r12; x48, x47<- x1 * arg2[3] mov rdx, r8; 0xffffffffffffffff to rdx mulx r13, r8, r13; x75, x74<- x72 * 0xffffffffffffffff adox r8, r14 setc r14b; spill CF x46 to reg (r14) movzx rdx, byte [ rsp + 0x60 ]; load byte memx116 to register64 clc; mov [ rsp + 0xd0 ], r8; spilling x86 to mem mov r8, -0x1 ; moving imm to reg adcx rdx, r8; loading flag adcx rax, rdi mov rdx, 0x0 ; moving imm to reg adox r13, rdx movzx rdi, byte [ rsp + 0x58 ]; load byte memx58 to register64 dec rdx; OF<-0x0, preserve CF (debug: state 1(0x0) (thanks Paul)) adox rdi, rdx; loading flag adox rcx, [ rsp + 0x40 ] setc r8b; spill CF x118 to reg (r8) movzx rdi, byte [ rsp + 0x88 ]; load byte memx143 to register64 clc; adcx rdi, rdx; loading flag adcx rax, rbp mov rdi, 0x0 ; moving imm to reg adox r12, rdi movzx rbp, byte [ rsp + 0x80 ]; load byte memx67 to register64 inc rdx; OF<-0x0, preserve CF (debug: state 1(-0x1) (thanks Paul)) mov rdx, -0x1 ; moving imm to reg adox rbp, rdx; loading flag adox r10, rcx movzx rbp, r14b; x70, copying x46 here, cause x46 is needed in a reg for other than x70, namely all: , x70--x71, size: 1 adox rbp, r12 mov r14, [ rsp + 0x70 ]; load m64 x105 to register64 seto cl; spill OF x71 to reg (rcx) movzx r12, byte [ rsp + 0x98 ]; load byte memx109 to register64 inc rdx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov rdx, -0x1 ; moving imm to reg adox r12, rdx; loading flag adox r14, [ rsp + 0xb8 ] mov rdx, [ r11 + 0x18 ]; arg2[3] to rdx mulx r15, r12, r15; x101, x100<- x2 * arg2[3] mov [ rsp + 0xd8 ], rax; spilling x144 to mem mov rax, [ rsp + 0xb0 ]; x112, copying x103 here, cause x103 is needed in a reg for other than x112, namely all: , x112--x113, size: 1 adox rax, r12 setc r12b; spill CF x145 to reg (r12) mov [ rsp + 0xe0 ], r15; spilling x101 to mem movzx r15, byte [ rsp + 0xa8 ]; load byte memx94 to register64 clc; mov [ rsp + 0xe8 ], rax; spilling x112 to mem mov rax, -0x1 ; moving imm to reg adcx r15, rax; loading flag adcx r10, [ rsp + 0xd0 ] adcx r13, rbp movzx r15, cl; x99, copying x71 here, cause x71 is needed in a reg for other than x99, namely all: , x99, size: 1 mov rbp, 0x0 ; moving imm to reg adcx r15, rbp clc; movzx r8, r8b adcx r8, rax; loading flag adcx r10, r14 mov r8, [ rsp + 0xc8 ]; load m64 x129 to register64 seto cl; spill OF x113 to reg (rcx) movzx r14, byte [ rsp + 0xa0 ]; load byte memx136 to register64 inc rax; OF<-0x0, preserve CF (debug: state 1(-0x1) (thanks Paul)) mov rbp, -0x1 ; moving imm to reg adox r14, rbp; loading flag adox r8, [ rsp + 0x90 ] mov r14, [ rsp + 0xe8 ]; x121, copying x112 here, cause x112 is needed in a reg for other than x121, namely all: , x121--x122, size: 1 adcx r14, r13 mov r13, [ r9 + 0x18 ]; load m64 x3 to register64 movzx rax, cl; x114, copying x113 here, cause x113 is needed in a reg for other than x114, namely all: , x114, size: 1 mov rbp, [ rsp + 0xe0 ]; load m64 x101 to register64 lea rax, [ rax + rbp ]; r8/64 + m8 mov rbp, 0xffffffffffffffff ; moving imm to reg mov rdx, rbx; x125 to rdx mulx rdx, rbx, rbp; x128, x127<- x125 * 0xffffffffffffffff mov rcx, [ rsp + 0xc0 ]; x139, copying x130 here, cause x130 is needed in a reg for other than x139, namely all: , x139--x140, size: 1 adox rcx, rbx adcx rax, r15 setc r15b; spill CF x124 to reg (r15) clc; mov rbx, -0x1 ; moving imm to reg movzx r12, r12b adcx r12, rbx; loading flag adcx r10, r8 mov r12, 0x0 ; moving imm to reg adox rdx, r12 adcx rcx, r14 adcx rdx, rax mov r8, rdx; preserving value of x150 into a new reg mov rdx, [ r11 + 0x0 ]; saving arg2[0] in rdx. mulx r14, rax, r13; x160, x159<- x3 * arg2[0] mov rdx, [ r11 + 0x8 ]; arg2[1] to rdx mulx r12, rbx, r13; x158, x157<- x3 * arg2[1] movzx rbp, r15b; x152, copying x124 here, cause x124 is needed in a reg for other than x152, namely all: , x152, size: 1 adc rbp, 0x0 xor r15, r15 adox rax, [ rsp + 0xd8 ] mov r15, 0xd838091dd2253531 ; moving imm to reg mov rdx, r15; 0xd838091dd2253531 to rdx mov [ rsp + 0xf0 ], rbp; spilling x152 to mem mulx r15, rbp, rax; _, x178<- x168 * 0xd838091dd2253531 mov r15, 0xfffffffefffffc2f ; moving imm to reg xchg rdx, r15; 0xfffffffefffffc2f, swapping with 0xd838091dd2253531, which is currently in rdx mov [ rsp + 0xf8 ], r8; spilling x150 to mem mulx r15, r8, rbp; x187, x186<- x178 * 0xfffffffefffffc2f mov rdx, 0xffffffffffffffff ; moving imm to reg mov [ rsp + 0x100 ], rcx; spilling x148 to mem mov [ rsp + 0x108 ], r10; spilling x146 to mem mulx rcx, r10, rbp; x185, x184<- x178 * 0xffffffffffffffff adcx r8, rax setc r8b; spill CF x196 to reg (r8) clc; adcx r10, r15 setc al; spill CF x189 to reg (rax) clc; adcx rbx, r14 mov r14, rdx; preserving value of 0xffffffffffffffff into a new reg mov rdx, [ r11 + 0x10 ]; saving arg2[2] in rdx. mov [ rsp + 0x110 ], r10; spilling x188 to mem mulx r15, r10, r13; x156, x155<- x3 * arg2[2] adcx r10, r12 mov r12, [ rsp + 0x108 ]; x170, copying x146 here, cause x146 is needed in a reg for other than x170, namely all: , x170--x171, size: 1 adox r12, rbx mov rdx, [ r11 + 0x18 ]; arg2[3] to rdx mulx r13, rbx, r13; x154, x153<- x3 * arg2[3] mov rdx, rbp; x178 to rdx mov [ rsp + 0x118 ], r12; spilling x170 to mem mulx rbp, r12, r14; x183, x182<- x178 * 0xffffffffffffffff adcx rbx, r15 mov r15, [ rsp + 0x100 ]; x172, copying x148 here, cause x148 is needed in a reg for other than x172, namely all: , x172--x173, size: 1 adox r15, r10 mov r10, [ rsp + 0xf8 ]; x174, copying x150 here, cause x150 is needed in a reg for other than x174, namely all: , x174--x175, size: 1 adox r10, rbx mov rbx, 0x0 ; moving imm to reg adcx r13, rbx clc; mov rbx, -0x1 ; moving imm to reg movzx rax, al adcx rax, rbx; loading flag adcx rcx, r12 mov rax, [ rsp + 0xf0 ]; x176, copying x152 here, cause x152 is needed in a reg for other than x176, namely all: , x176--x177, size: 1 adox rax, r13 mov r12, [ rsp + 0x110 ]; load m64 x188 to register64 seto r13b; spill OF x177 to reg (r13) inc rbx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov rbx, -0x1 ; moving imm to reg movzx r8, r8b adox r8, rbx; loading flag adox r12, [ rsp + 0x118 ] adox rcx, r15 mulx rdx, r8, r14; x181, x180<- x178 * 0xffffffffffffffff adcx r8, rbp adox r8, r10 mov rbp, 0x0 ; moving imm to reg adcx rdx, rbp adox rdx, rax movzx r15, r13b; x205, copying x177 here, cause x177 is needed in a reg for other than x205, namely all: , x205, size: 1 adox r15, rbp mov r10, r12; x206, copying x197 here, cause x197 is needed in a reg for other than x206, namely all: , x216, x206--x207, size: 2 mov r13, 0xfffffffefffffc2f ; moving imm to reg sub r10, r13 mov rax, rcx; x208, copying x199 here, cause x199 is needed in a reg for other than x208, namely all: , x208--x209, x217, size: 2 sbb rax, r14 mov rbp, r8; x210, copying x201 here, cause x201 is needed in a reg for other than x210, namely all: , x210--x211, x218, size: 2 sbb rbp, r14 mov rbx, rdx; x212, copying x203 here, cause x203 is needed in a reg for other than x212, namely all: , x219, x212--x213, size: 2 sbb rbx, r14 sbb r15, 0x00000000 cmovc rbp, r8; if CF, x218<- x201 (nzVar) cmovc r10, r12; if CF, x216<- x197 (nzVar) cmovc rbx, rdx; if CF, x219<- x203 (nzVar) cmovc rax, rcx; if CF, x217<- x199 (nzVar) mov r15, [ rsp + 0x0 ]; load m64 out1 to register64 mov [ r15 + 0x10 ], rbp; out1[2] = x218 mov [ r15 + 0x18 ], rbx; out1[3] = x219 mov [ r15 + 0x0 ], r10; out1[0] = x216 mov [ r15 + 0x8 ], rax; out1[1] = x217 mov rbx, [ rsp + 0x120 ]; restoring from stack mov rbp, [ rsp + 0x128 ]; restoring from stack mov r12, [ rsp + 0x130 ]; restoring from stack mov r13, [ rsp + 0x138 ]; restoring from stack mov r14, [ rsp + 0x140 ]; restoring from stack mov r15, [ rsp + 0x148 ]; restoring from stack add rsp, 0x150 ret ; cpu 11th Gen Intel(R) Core(TM) i7-11700KF @ 3.60GHz ; clocked at 3600 MHz ; first cyclecount 80.34, best 62.31404958677686, lastGood 65.35042735042735 ; seed 2003353293586321 ; CC / CFLAGS clang / -march=native -mtune=native -O3 ; time needed: 774461 ms / 60000 runs=> 12.907683333333333ms/run ; Time spent for assembling and measureing (initial batch_size=116, initial num_batches=101): 125733 ms ; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.1623490401711642 ; number reverted permutation/ tried permutation: 22714 / 29934 =75.880% ; number reverted decision/ tried decision: 22421 / 30067 =74.570%
samples/irs-demo/web/src/test/resources/scripts/runwebapps.scpt
suweicong/corda-1
4,168
3759
tell app "Terminal" activate tell app "System Events" to tell process "Terminal" to keystroke "t" using command down delay 0.5 do script "bash -c 'cd \"#DIR#\" && java -Dspring.profiles.active=NotaryService -jar #JAR_PATH# && exit'" in selected tab of the front window tell app "System Events" to tell process "Terminal" to keystroke "t" using command down delay 0.5 do script "bash -c 'cd \"#DIR#\" && java -Dspring.profiles.active=BankA -jar #JAR_PATH# && exit'" in selected tab of the front window tell app "System Events" to tell process "Terminal" to keystroke "t" using command down delay 0.5 do script "bash -c 'cd \"#DIR#\" && java -Dspring.profiles.active=BankB -jar #JAR_PATH# && exit'" in selected tab of the front window end tell
orka/src/orka/interface/orka-rendering-buffers-pointers.ads
onox/orka
52
21830
<gh_stars>10-100 -- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <<EMAIL>> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with GL.Types.Pointers; with Orka.Types.Pointers; private package Orka.Rendering.Buffers.Pointers is pragma Preelaborate; use GL.Types.Pointers; package Half is new GL.Objects.Buffers.Buffer_Pointers (Half_Pointers); package Single is new GL.Objects.Buffers.Buffer_Pointers (Single_Pointers); package Double is new GL.Objects.Buffers.Buffer_Pointers (Double_Pointers); package Byte is new GL.Objects.Buffers.Buffer_Pointers (Byte_Pointers); package Short is new GL.Objects.Buffers.Buffer_Pointers (Short_Pointers); package Int is new GL.Objects.Buffers.Buffer_Pointers (Int_Pointers); package UByte is new GL.Objects.Buffers.Buffer_Pointers (UByte_Pointers); package UShort is new GL.Objects.Buffers.Buffer_Pointers (UShort_Pointers); package UInt is new GL.Objects.Buffers.Buffer_Pointers (UInt_Pointers); ----------------------------------------------------------------------------- use Orka.Types.Pointers; package Single_Vector4 is new GL.Objects.Buffers.Buffer_Pointers (Single_Vector4_Pointers); package Double_Vector4 is new GL.Objects.Buffers.Buffer_Pointers (Double_Vector4_Pointers); package Single_Matrix4 is new GL.Objects.Buffers.Buffer_Pointers (Single_Matrix4_Pointers); package Double_Matrix4 is new GL.Objects.Buffers.Buffer_Pointers (Double_Matrix4_Pointers); ----------------------------------------------------------------------------- package Arrays_Command is new GL.Objects.Buffers.Buffer_Pointers (Indirect.Arrays_Indirect_Command_Pointers); package Elements_Command is new GL.Objects.Buffers.Buffer_Pointers (Indirect.Elements_Indirect_Command_Pointers); package Dispatch_Command is new GL.Objects.Buffers.Buffer_Pointers (Indirect.Dispatch_Indirect_Command_Pointers); end Orka.Rendering.Buffers.Pointers;
Ada/periodictasks.adb
UdayanSinha/Code_Blocks
3
27128
<reponame>UdayanSinha/Code_Blocks<gh_stars>1-10 pragma Task_Dispatching_Policy(FIFO_Within_Priorities); --pragma Task_Dispatching_Policy(Round_Robin_Within_Priorities); with Ada.Text_IO; use Ada.Text_IO; with Ada.Real_Time; use Ada.Real_Time; procedure PeriodicTasks is Start : Time; package Duration_IO is new Ada.Text_IO.Fixed_IO(Duration); package Int_IO is new Ada.Text_IO.Integer_IO(Integer); task type T(Id: Integer; Period : Integer) is pragma Priority(Id); end; task body T is Next : Time; X : Integer; begin Next := Start; loop Next := Next + Milliseconds(Period); -- Some dummy function X := 0; for Index in 1..5000000 loop X := X + Index; end loop; Duration_IO.Put(To_Duration(Clock - Start), 3, 3); Put(" : "); Int_IO.Put(Id, 2); Put_Line(""); delay until Next; end loop; end T; -- Example Task Task_P10 : T(10, 250); Task_P12 : T(12, 500); Task_P14 : T(14, 500); Task_P16 : T(16, 250); Task_P18 : T(18, 500); Task_P20 : T(20, 250); begin Start := Clock; null; end PeriodicTasks;
libsrc/gfx/narrow/multipoint_callee.asm
ahjelm/z88dk
640
29277
<gh_stars>100-1000 ; ; Z88 Graphics Functions - Small C+ stubs ; ; <NAME> 19/7/2007 ; ; ; $Id: multipoint_callee.asm $ ; IF !__CPU_INTEL__ & !__CPU_GBZ80__ ; CALLER LINKAGE FOR FUNCTION POINTERS ; ----- bool multipoint(int hv, int length, int x, int y) ;Usage: ;pick a vertical or horizontal bit bar, up to 16 bits long SECTION code_graphics PUBLIC multipoint_callee PUBLIC _multipoint_callee PUBLIC asm_multipoint EXTERN pointxy EXTERN swapgfxbk EXTERN swapgfxbk1 INCLUDE "graphics/grafix.inc" .multipoint_callee ._multipoint_callee pop af ; ret addr pop hl ; y pop de ; x ld h,e pop bc ld b,c ; length pop de ld c,e ; h/v push af ; ret addr .asm_multipoint push ix IF NEED_swapgfxbk = 1 call swapgfxbk ENDIF ld de,0 rr c jr nc,horizontal .vertical sla e rl d push de push hl push bc call pointxy pop bc pop hl pop de jr z,jv inc de .jv inc l djnz vertical jr exit .horizontal sla e rl d push de push hl push bc call pointxy pop bc pop hl pop de jr z,jh inc de .jh inc h djnz horizontal .exit IF NEED_swapgfxbk = 1 call swapgfxbk1 ENDIF pop ix ld h,d ld l,e ret ENDIF
src/connections/adabase-connection-base-sqlite.ads
jrmarino/AdaBase
30
24239
<reponame>jrmarino/AdaBase<filename>src/connections/adabase-connection-base-sqlite.ads -- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt with AdaBase.Interfaces.Connection; with AdaBase.Bindings.SQLite; with AdaBase.Results; with Ada.Exceptions; package AdaBase.Connection.Base.SQLite is package AIC renames AdaBase.Interfaces.Connection; package BND renames AdaBase.Bindings.SQLite; package AR renames AdaBase.Results; package EX renames Ada.Exceptions; type SQLite_Connection is new Base_Connection and AIC.iConnection with private; type SQLite_Connection_Access is access all SQLite_Connection; ----------------------------------------- -- SUBROUTINES REQUIRED BY INTERFACE -- ----------------------------------------- overriding procedure connect (conn : out SQLite_Connection; database : String; username : String := blankstring; password : String := <PASSWORD>; hostname : String := blankstring; socket : String := blankstring; port : Posix_Port := portless); overriding procedure setCompressed (conn : out SQLite_Connection; compressed : Boolean); overriding function compressed (conn : SQLite_Connection) return Boolean; overriding procedure setUseBuffer (conn : out SQLite_Connection; buffered : Boolean); overriding function useBuffer (conn : SQLite_Connection) return Boolean; overriding procedure setMultiQuery (conn : out SQLite_Connection; multiple : Boolean); overriding function multiquery (conn : SQLite_Connection) return Boolean; overriding procedure setAutoCommit (conn : out SQLite_Connection; auto : Boolean); overriding function description (conn : SQLite_Connection) return String; overriding function SqlState (conn : SQLite_Connection) return SQL_State; overriding function driverMessage (conn : SQLite_Connection) return String; overriding function driverCode (conn : SQLite_Connection) return Driver_Codes; overriding function lastInsertID (conn : SQLite_Connection) return Trax_ID; overriding procedure commit (conn : out SQLite_Connection); overriding procedure rollback (conn : out SQLite_Connection); overriding procedure disconnect (conn : out SQLite_Connection); overriding procedure execute (conn : out SQLite_Connection; sql : String); overriding function rows_affected_by_execution (conn : SQLite_Connection) return Affected_Rows; overriding procedure setTransactionIsolation (conn : out SQLite_Connection; isolation : Trax_Isolation); overriding procedure set_character_set (conn : out SQLite_Connection; charset : String); overriding function character_set (conn : out SQLite_Connection) return String; ----------------------------------------------- -- SUBROUTINES PARTICULAR TO SQLITE DRIVER -- ----------------------------------------------- function prepare_statement (conn : out SQLite_Connection; stmt : aliased out BND.sqlite3_stmt_Access; sql : String) return Boolean; function prep_markers_found (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access) return Natural; function fields_in_result (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access) return Natural; function retrieve_integer (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return AR.Byte8; function retrieve_double (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return AR.Real18; function retrieve_text (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return AR.Textual; function retrieve_blob (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural; maxsz : Natural) return String; function field_is_null (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return Boolean; function field_database (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return String; function field_table (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return String; function field_name (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return String; function field_true_name (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return String; procedure get_field_meta_data (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; database : String; table : String; column : String; data_type : out BND.enum_field_types; nullable : out Boolean); procedure reset_prep_stmt (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access); function prep_finalize (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access) return Boolean; function prep_fetch_next (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access) return Boolean; function marker_is_null (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural) return Boolean; function marker_is_integer (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural; value : AR.Byte8) return Boolean; function marker_is_double (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural; value : AR.Real18) return Boolean; function marker_is_text (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural; value : String; cstr : out BND.ICS.chars_ptr) return Boolean; function marker_is_blob (conn : SQLite_Connection; stmt : BND.sqlite3_stmt_Access; index : Natural; value : String; chary : out BND.ICS.char_array_access) return Boolean; ------------------ -- EXCEPTIONS -- ------------------ UNSUPPORTED_BY_SQLITE : exception; NOT_WHILE_CONNECTED : exception; DISCONNECT_FAILED : exception; CONNECT_FAILED : exception; AUTOCOMMIT_FAIL : exception; TRAX_BEGIN_FAIL : exception; TRAXISOL_FAIL : exception; ROLLBACK_FAIL : exception; COMMIT_FAIL : exception; QUERY_FAIL : exception; METADATA_FAIL : exception; STMT_NOT_VALID : exception; STMT_RESET_FAIL : exception; STMT_FETCH_FAIL : exception; private type SQLite_Connection is new Base_Connection and AIC.iConnection with record info_description : String (1 .. 21) := "SQLite3 native driver"; prop_multiquery : Boolean := False; dummy : Boolean := False; handle : aliased BND.sqlite3_Access := null; end record; function PUTF82S (cstr : BND.ICS.chars_ptr) return String; procedure begin_transaction (conn : out SQLite_Connection); procedure Initialize (conn : in out SQLite_Connection); overriding procedure finalize (conn : in out SQLite_Connection); procedure private_execute (conn : out SQLite_Connection; sql : String); function within_transaction (conn : SQLite_Connection) return Boolean; end AdaBase.Connection.Base.SQLite;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vfa1_3.adb
best08618/asylo
7
14217
-- { dg-do compile } -- { dg-options "-fdump-tree-gimple" } with VFA1_Pkg; use VFA1_Pkg; procedure VFA1_3 is Temp : Short_Integer; function F (I : Short_Integer) return Short_Integer is begin return I; end; function F2 return Short_Integer is begin return Short_Integer(Buffer1.A); end; procedure P3 (I : out Short_Integer) is begin null; end; begin Temp := Buffer1.A; Buffer1.B := Temp; Temp := Buffer2.A; Buffer2.B := Temp; Temp := Buffer1.A + Buffer2.B; if Buffer1.A /= Buffer2.B then raise Program_Error; end if; Temp := F(Buffer1.A); Buffer2.B := F(Temp); Temp := F(Buffer2.B); Buffer1.A := F(Temp); Temp := F2; P3 (Buffer2.B); end; -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__buffer1" 7 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__buffer2" 7 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__buffer1" 2 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__buffer2" 3 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
Runtime/AstParser.g4
kaby76/Piggy
31
3503
grammar AstParser; options { tokenVocab = AstLexer; } ast : node EOF ; node : OPEN_PAREN ID (node | attr)* CLOSE_PAREN ; attr : ID EQUALS StringLiteral ;
programs/oeis/177/A177206.asm
neoneye/loda
22
94702
; A177206: a(n) = 2*binomial(n+4, 4) + n + 4. ; 6,15,36,77,148,261,430,671,1002,1443,2016,2745,3656,4777,6138,7771,9710,11991,14652,17733,21276,25325,29926,35127,40978,47531,54840,62961,71952,81873,92786,104755,117846,132127,147668,164541,182820,202581 add $0,4 mov $1,$0 bin $0,4 mul $0,2 add $0,$1
oeis/154/A154287.asm
neoneye/loda-programs
11
19170
<filename>oeis/154/A154287.asm ; A154287: (L)-sieve transform of {1,4,9,16,...,n^2,...}=A000290. ; Submitted by <NAME> ; 1,3,6,9,13,18,23,29,35,42,49,57,66,75,85,95,106,117,129,141,154,167,181,195,210,225,241,258,275,293,311,330,349,369,389,410,431,453,475,498,521,545,569 mov $1,$0 lpb $1 mov $1,$0 add $0,1 add $2,1 div $1,$2 sub $1,$2 add $0,$1 lpe add $0,1
45/runtime/rt/llque.asm
minblock/msdos
0
178256
TITLE LLQUE - Queue Management ;*** ; LLQUE - Queue Management ; ; Copyright <C> 1986, Microsoft Corporation ; ;Purpose: ; ;****************************************************************************** INCLUDE switch.inc ;switch file [new] INCLUDE rmacros.inc ;useseg macro USESEG RT_TEXT ;core runtime segment USESEG _DATA INCLUDE seg.inc ;segment definitions INCLUDE oscalls.inc ;Dos 5 structures INCLUDE ibmunv.inc INCLUDE intmac.inc INCLUDE idmac.inc externFP B$ULDataRelease ;dealloc UL data images externFP CompressHelp externFP B$ERR_MEM ;arena destroyed error externNP B$ERR_FHC ;bad memory block address ;*** ;b$pFHLowerTop - vector for Memory Management ;OEM-interface routine ; ;Purpose: ; Move the top of the Far Heap (Basic data not in DGROUP) down ; if at all possible so that there is more memory available ; for DOS allocation. This is used to try to free enough space ; for B$FHHighAlloc. If the far heap cannot be move to free up ; the amount of memory requested, it releases the maximum amount ; of memory that it can. ; ; NOTE: b$pFHLowerTop is a variable through which the routine ; is indirectly called. ; ;Entry: ; AX = number of paragraphs of memory to release. ; ;Exit: ; AX = number of paragraphs of memory actually released. ; ;Uses: ; Per Convention ; ;Preserves: ; BX, CX, DX ; ;Exceptions: ; Fatal error due to far heap inconsistency. ; ;Indirection Information: ; The indirection variable b$pFHLowerTop is allocated in the _DATA ; segment by the OEM. It should be statically initialized to a ; RET statement. Once set, the OEM should not modify this variable. ; If a Far Heap exist, the OEM-Independent code will change the ; variable so that it points to a routine which performs the ; indicated function. ; ;**** sBegin _DATA globalW b$pFHLowerTop,Near_Ret,1 ;vector for FHLowerTop sEnd _DATA sBegin RT_TEXT assumes CS,RT_TEXT ;*** ;B$INIQUE ; ;PURPOSE: ; This routine initializes the top and bottom pointers ; of the queue. It also initializes the number ; of notes and the number of bytes in the queue to 0. ; ;ENTRY: ; [BX] = addr of music queue ctrl block. ; [AX] = addr of music queue ; ;EXIT: ; None ; ;MODIFIED: ; None ; ;**** cProc B$INIQUE,<PUBLIC,NEAR> cBegin MOV [BX].QUEGET,AX ;reset pointers to MOV [BX].QUEPUT,AX ;beginning of queue buffer MOV [BX].QUENUM,0 ;clear queue counter MOV [BX].QUNOTE,0 ;clear # of notes in queue Near_Ret: ;Near return for vector cEnd ; End of B$INIQUE ;*** ;B$QUE ; ;PURPOSE: ; This routine queues in a byte contained in [AL] into ; the appropriate music control queue. Address of the music ; control queue is contained in [BX]. ; ;ENTRY: ; [AL] = Byte to be queued ; [BX] = Address of appropriate music queue ; [ES] = either [DS] or $COMBUF ; ;EXIT: ; ;MODIFIED: ; QUENUM, QUEPUT, QUEGET ; ;**** cProc B$QUE,<PUBLIC,NEAR>,<SI> cBegin MOV SI,[BX].QUEPUT ;get put PTR MOV ES:[SI],AL ;queue in the byte INC SI ;advance put PTR CMP SI,[BX].QUETOP ;wrap around ? JNZ NWRQUE ;No MOV SI,[BX].QUEBOT ;get queue bottom NWRQUE: MOV [BX].QUEPUT,SI ;store new put PTR INC [BX].QUENUM cEnd ; End of B$QUE ;*** ;B$DQUE ; ;PURPOSE: ; This routine supports GETSND by dequeueing one byte from ; the music queue and updating the associated variables. ; ;ENTRY: ; [BX] = Adrress of the music queue ; [ES] = either [DS] or $COMBUF ; ;EXIT: ; [AL] = dequeued byte ; ;MODIFIED: ; QUENUM, QUEGET, QUEPUT ; ;**** cProc B$DQUE,<PUBLIC,NEAR>,<SI> cBegin MOV SI,[BX].QUEGET ;fetch get PTR MOV AL,ES:[SI] ;get the byte INC SI CMP SI,[BX].QUETOP ;wraparound? JNZ NWRDQU ;Brif not MOV SI,[BX].QUEBOT ;get queue bottom PTR NWRDQU: MOV [BX].QUEGET,SI ;store new get PTR DEC [BX].QUENUM ;dec # of bytes in queue cEnd ; End of B$DQUE ; ; (Moved here from fhinit with revision [11].) ; ;*** ;B$FHHighAlloc - Allocate a block of memory outside of BASIC's normal access ;OEM-Interface Routine ; ;Purpose: ; Allocate a block of memory. This is done by calling the ; Operating System, thus the memory returned will not be ; in DGROUP and will not be under the control of the rest ; of BASICS memory management routines. The far and near ; heaps may be moved down if necessary to make adequate room. ; ; The size of the block of memory will be rounded up to the nearest ; word for OS/2 and to the nearest paragraph for DOS 3. ; ; Note that the memory will only be deallocated by an explicit call ; to B$FHHighDealloc. ; ;Entry: ; DX:AX = Size of block to allocate. ; ;Exit: ; CX = segment of the memory block allocated or 0 if memory ; could not be allocated. ; The segment will be an SB (not a physical segment) if FV_SBPTR. ;Uses: ; Per convention. ; ;Preserves: ; AX, DX ; ;Exceptions: ; None. ;****************************************************************************** cProc B$FHHighAlloc,<NEAR,PUBLIC>,<AX,DX,SI> cBegin ; Convert allocation size to paragraphs in DX:AX. ADD AX,0FH ; Round up to nearest paragraph ADC DL,0 MOV CX,4 ; Divide by 32 (shift right 4 times) CvrtLoop: SHR DX,1 RCR AX,1 LOOP CvrtLoop OR DX,DX ;test if allocation over 1 megabyte JNZ FHHighError ;if so, then immediate error ; Try to allocate block from any available memory first. MOV SI,AX ;save paragraph size CALL FHMemAllocCall ;call to perform INT and handle fatal errors JNC FHHighDone ;if successful, use this block, jump ; Lower the top of the far heap and try to allocate the block ; using the released memory. The call to FHLowerTop may not ; release all the memory requested, but try the allocation ; anyway in case enough is there. CALL FHMemAllocCall_Lower ; CY clear if memory allocated JNC FHHighDone ;if successful, use allocated block CALL B$ULDataRelease ;release UL data images (if present) CALL FHMemAllocCall_Lower ; CY clear if memory allocated JNC FHHighDone ;if successful, use allocated block CALL CompressHelp ;release UL data images (if present) CALL FHMemAllocCall_Lower ; CY clear if memory allocated JNC FHHighDone ;if successful, return FHHighError: XOR AX,AX ;return 0 for error FHHighDone: XCHG CX,AX ;block starts at far pointer CX:0 cEnd ; ; (Moved here from fhinit with revision [11].) ; ;*** ; B$FHHighDealloc - deallocate high memory allocated with B$FHHighAlloc ;OEM-Interface Routine ; ;Purpose: ; To deallocate a block of memory outside the runtime heap ; management at the top of memory. The block must have been ; allocated by B$FHHighAlloc. There is no check that the ; segment was ever allocated or that multiple deallocations ; on the same segment are being attempted. ; ;Entry: ; AX = segment of block to be deallocated. ; ;Exit: ; None. ; ;Uses: ; None. ; ;Exceptions: ; None. ;****************************************************************************** cProc B$FHHighDealloc,<NEAR,PUBLIC>,<AX,ES> cBegin ; Deallocate the block through a DOS call. MOV ES,AX ;put memory segment in for call MOV AH,49H ;DOS function to deallocate a memory block CALL FHMemDosCall ;call to perform INT and handle fatal errors cEnd ;*** ; FHZeroEntry - Zero fill a DOS 5 allocation (DOS 5) ; ;Purpose: ; Fill a DOS 5 memory allocation with zeros. ; (Moved here from fhinit with revision [11].) ;Entry: ; DX:AX = 32 Bit size of block in bytes. ; CX = segment of the memory block allocated. ;Exit: ; None. ;Uses: ; AX,CX,SI ;Exceptions: ; None. ;****************************************************************************** ; Added with [22] for size ;*** ; FHMemAllocCall_Lower - perform memory allocation DOS call (DOS 3) ; ;Purpose: ; Performs the INT21H for the DOS allocate call, after requesting the ; far heap lower the top of memory. Error checking is done here to ; save space. ; ;Entry: ; SI = # paragraphs of memory to allocate ; ;Exit: ; Post-INT 21H register changes. ; ;Exceptions: ; B$ERR_MEM if arena is trashed. ; B$ERR_FHC if bad memory block address. ;**** cProc FHMemAllocCall_Lower,<NEAR> cBegin MOV AX,SI ;AX = size of memory requested INC AX ;add one for DOS memory header CALL [b$pFHLowerTop] ;try to lower the top of the far heap cEnd <nogen> ;Fall into FHMemAllocCall ; Added with [22] for size ;*** ; FHMemAllocCall - perform memory allocation DOS call (DOS 3) ; ;Purpose: ; Performs the INT21H for the DOS allocate call. Error checking is ; done here to save space. ; ;Entry: ; SI = # paragraphs of memory to allocate ; ;Exit: ; Post-INT 21H register changes. ; ;Exceptions: ; B$ERR_MEM if arena is trashed. ; B$ERR_FHC if bad memory block address. ;**** cProc FHMemAllocCall,<NEAR> cBegin MOV BX,SI ;BX = size of memory request MOV AH,48H ;DOS function to allocate memory block cEnd <nogen> ;Fall into FHMemDosCall ;*** ; FHMemDosCall - perform memory DOS call (DOS 3) ; ;Purpose: ; Performs the INT 21H for the DOS allocate, deallocate, and ; reallocate calls. Error checking is done here to save space. ; (Copied here from fhinit with revision [11].) ;Entry: ; Setup for the appropriate DOS call, this call replaces the ; INT 21H instruction. The DOS calls used are allocate memory ; (48H), deallocate memory (49H), and reallocate memory (4AH). ;Exit: ; Post-INT 21H register changes. ;Uses: ; Post-INT 21H register changes. ;Exceptions: ; B$ERR_MEM if arena is trashed. ; B$ERR_FHC if bad memory block address. ;****************************************************************************** cProc FHMemDosCall,<NEAR> cBegin INT 21H ;perform the DOS call JNC FHMemDosReturn ;if successful, then exit now CMP AX,8 ;test if out of memory JNE FHMemDosError ;if not, then jump to trap error STC ;set the carry again FHMemDosReturn: cEnd FHMemDosError: CMP AX,7 ;test if error was arena destroyed JNE FHMemDosBlock ;if not, then invalid block was used JMP B$ERR_MEM ;jump to fatal error for arena destroyed FHMemDosBlock: JMP B$ERR_FHC ;jump to fatal error for inconsistenct FH sEnd RT_TEXT END
src/sound/sleeping_music/main.asm
Gegel85/RunnerGB
0
93043
include "src/sound/sleeping_music/channel1.asm" include "src/sound/sleeping_music/channel2.asm" include "src/sound/sleeping_music/channel3.asm" include "src/sound/sleeping_music/channel4.asm" SleepingTheme:: db $A0 db %100 dw musicChan1SleepingTheme dw musicChan2SleepingTheme dw musicChan3SleepingTheme dw musicChan4SleepingTheme
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_182.asm
ljhsiun2/medusa
9
97421
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_182.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1388e, %rsi lea addresses_A_ht+0x162d5, %rdi nop nop nop nop dec %r13 mov $51, %rcx rep movsl add $42470, %r14 lea addresses_WT_ht+0x768e, %rbx nop nop nop nop cmp %r15, %r15 movw $0x6162, (%rbx) nop nop nop cmp %rcx, %rcx lea addresses_D_ht+0x1320e, %rcx nop nop nop add $3773, %rsi movw $0x6162, (%rcx) and $25216, %r13 lea addresses_normal_ht+0x1d48e, %rcx nop nop nop inc %r14 movw $0x6162, (%rcx) nop nop nop nop xor $39994, %rsi lea addresses_normal_ht+0x948e, %rcx dec %r14 movb (%rcx), %r13b and $9890, %rcx lea addresses_normal_ht+0xadfe, %r14 clflush (%r14) nop sub $58919, %rcx movw $0x6162, (%r14) nop nop nop nop nop dec %rcx lea addresses_A_ht+0x1554a, %r14 nop nop nop nop nop sub %rdi, %rdi mov $0x6162636465666768, %r13 movq %r13, (%r14) nop nop nop nop nop and $16426, %rdi lea addresses_normal_ht+0xc8e, %rsi lea addresses_normal_ht+0x148e, %rdi sub $39255, %r10 mov $28, %rcx rep movsw sub %rdi, %rdi lea addresses_normal_ht+0x19b8e, %rdi nop nop nop sub $58246, %r13 and $0xffffffffffffffc0, %rdi vmovaps (%rdi), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r10 nop nop sub %rcx, %rcx lea addresses_WC_ht+0x2e8e, %r15 nop nop nop cmp %rcx, %rcx movb (%r15), %r13b nop nop nop nop sub $1491, %r10 lea addresses_WT_ht+0x1992e, %r10 clflush (%r10) add %r14, %r14 movb (%r10), %cl nop nop nop inc %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r9 push %rax // Faulty Load lea addresses_normal+0x1948e, %r15 nop nop nop dec %r9 mov (%r15), %r11d lea oracles, %r15 and $0xff, %r11 shlq $12, %r11 mov (%r15,%r11,1), %r11 pop %rax pop %r9 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_normal', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_328.asm
ljhsiun2/medusa
9
242777
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x4d7c, %rbx nop xor $10791, %r9 mov (%rbx), %cx nop nop and $49611, %r10 lea addresses_normal_ht+0x4d40, %rsi lea addresses_D_ht+0x130c8, %rdi nop cmp %rbx, %rbx mov $114, %rcx rep movsw nop nop nop xor %rcx, %rcx lea addresses_A_ht+0xe0cc, %rsi nop nop nop xor $60490, %r11 movl $0x61626364, (%rsi) nop nop add $23496, %r11 lea addresses_WT_ht+0x4f90, %rsi lea addresses_WT_ht+0x8048, %rdi nop nop nop nop xor %rbp, %rbp mov $79, %rcx rep movsw xor $62417, %rsi lea addresses_UC_ht+0x16a44, %rsi clflush (%rsi) nop nop nop xor $60077, %r9 movl $0x61626364, (%rsi) nop nop inc %rdi lea addresses_normal_ht+0x1ba48, %rcx nop cmp $1585, %rsi movl $0x61626364, (%rcx) nop nop nop nop cmp %r10, %r10 lea addresses_normal_ht+0xfe4e, %r9 clflush (%r9) nop nop nop nop nop add %rdi, %rdi mov (%r9), %rbp nop nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0x16b48, %rcx nop nop nop nop sub $33438, %r11 movb (%rcx), %bl nop xor $50405, %r10 lea addresses_WT_ht+0x78f4, %rbx nop nop dec %rsi movb (%rbx), %r9b dec %rbx lea addresses_normal_ht+0x1c8c8, %rbp nop nop nop nop sub %rbx, %rbx movb $0x61, (%rbp) add $31228, %r9 lea addresses_A_ht+0x19c04, %rdi nop nop nop nop nop add $17183, %rsi mov $0x6162636465666768, %r9 movq %r9, (%rdi) nop nop nop nop xor $33915, %r9 lea addresses_WT_ht+0xc990, %rbx nop nop sub $26765, %r9 movups (%rbx), %xmm4 vpextrq $1, %xmm4, %rbp nop nop nop nop nop xor $34416, %rdi lea addresses_normal_ht+0x9e22, %rbx nop nop xor $40907, %r11 movw $0x6162, (%rbx) nop nop cmp %r10, %r10 lea addresses_UC_ht+0x13fe7, %rbp clflush (%rbp) nop nop nop nop nop sub $14655, %rdi mov (%rbp), %r11 nop sub $22869, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rbx push %rcx push %rdx push %rsi // Store lea addresses_A+0x181e0, %r14 clflush (%r14) nop nop nop nop nop xor $26150, %r10 movb $0x51, (%r14) nop nop nop xor %rsi, %rsi // Load lea addresses_D+0x6064, %rcx and $13860, %rdx mov (%rcx), %rsi sub %rsi, %rsi // Store lea addresses_WC+0x1d248, %rsi nop nop nop nop nop xor $12793, %rdx movl $0x51525354, (%rsi) nop xor $4913, %rcx // Faulty Load lea addresses_D+0x1b248, %rdx clflush (%rdx) nop xor %rsi, %rsi mov (%rdx), %r14d lea oracles, %rdx and $0xff, %r14 shlq $12, %r14 mov (%rdx,%r14,1), %r14 pop %rsi pop %rdx pop %rcx pop %rbx pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 8, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
programs/oeis/167/A167342.asm
neoneye/loda
22
9413
; A167342: Totally multiplicative sequence with a(p) = p*(p+3) = p^2+3p for prime p. ; 1,10,18,100,40,180,70,1000,324,400,154,1800,208,700,720,10000,340,3240,418,4000,1260,1540,598,18000,1600,2080,5832,7000,928,7200,1054,100000,2772,3400,2800,32400,1480,4180,3744,40000,1804,12600,1978,15400,12960,5980,2350,180000,4900,16000,6120,20800,2968,58320,6160,70000,7524,9280,3658,72000,3904,10540,22680,1000000,8320,27720,4690,34000,10764,28000,5254,324000,5548,14800,28800,41800,10780,37440,6478,400000,104976,18040,7138,126000,13600,19780,16704,154000,8188,129600,14560,59800,18972,23500,16720,1800000,9700,49000,49896,160000 mov $1,$0 seq $1,166591 ; Totally multiplicative sequence with a(p) = p+3 for prime p. mul $0,$1 add $0,1 add $0,$1 sub $0,1
stone/testcases/lea.asm
yutopp/sekki
6
101344
bits 64 a: .updated_args_offset: equ 20 lea rdi, [.updated_args_offset] lea rdi, [rbp+.updated_args_offset] lea rdi, [rbp-.updated_args_offset] lea rdi, [rbp-48] lea rdx, [rbp-88] lea rdx, [rbp-56] lea rdi, [rdi+56] lea rax, [rax+rcx*4] lea rdi, [rbp-0xa0] lea rdi, [rbp+0xa0] lea rax, [rbp-160] lea rax, [rbp-168]
programs/oeis/153/A153978.asm
jmorken/loda
1
165122
<reponame>jmorken/loda ; A153978: a(n) = n*(n-1)*(n+1)*(3*n-2)/12. ; 0,2,14,50,130,280,532,924,1500,2310,3410,4862,6734,9100,12040,15640,19992,25194,31350,38570,46970,56672,67804,80500,94900,111150,129402,149814,172550,197780,225680,256432,290224,327250,367710,411810,459762,511784,568100,628940,694540,765142,840994,922350,1009470,1102620,1202072,1308104,1421000,1541050,1668550,1803802,1947114,2098800,2259180,2428580,2607332,2795774,2994250,3203110,3422710,3653412,3895584,4149600,4415840,4694690,4986542,5291794,5610850,5944120,6292020,6654972,7033404,7427750,7838450,8265950,8710702,9173164,9653800,10153080,10671480,11209482,11767574,12346250,12946010,13567360,14210812,14876884,15566100,16278990,17016090,17777942,18565094,19378100,20217520,21083920,21977872,22899954,23850750,24830850,25840850,26881352,27952964,29056300,30191980,31360630,32562882,33799374,35070750,36377660,37720760,39100712,40518184,41973850,43468390,45002490,46576842,48192144,49849100,51548420,53290820,55077022,56907754,58783750,60705750,62674500,64690752,66755264,68868800,71032130,73246030,75511282,77828674,80199000,82623060,85101660,87635612,90225734,92872850,95577790,98341390,101164492,104047944,106992600,109999320,113068970,116202422,119400554,122664250,125994400,129391900,132857652,136392564,139997550,143673530,147421430,151242182,155136724,159106000,163150960,167272560,171471762,175749534,180106850,184544690,189064040,193665892,198351244,203121100,207976470,212918370,217947822,223065854,228273500,233571800,238961800,244444552,250021114,255692550,261459930,267324330,273286832,279348524,285510500,291773860,298139710,304609162,311183334,317863350,324650340,331545440,338549792,345664544,352890850,360229870,367682770,375250722,382934904,390736500,398656700,406696700,414857702,423140914,431547550,440078830,448735980,457520232,466432824,475475000,484648010,493953110,503391562,512964634,522673600,532519740,542504340,552628692,562894094,573301850,583853270,594549670,605392372,616382704,627522000,638811600,650252850,661847102,673595714,685500050,697561480,709781380,722161132,734702124,747405750,760273410,773306510,786506462,799874684,813412600,827121640,841003240,855058842,869289894,883697850,898284170,913050320,927997772,943128004,958442500,973942750 lpb $0 add $2,$0 sub $0,1 add $3,$2 add $1,$3 lpe mul $1,2
components/src/motion/mpu60x0/mpu60x0.ads
Sawchord/Ada_Drivers_Library
0
28252
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018, AdaCore -- -- -- -- 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 System; with Interfaces; use Interfaces; with HAL; use HAL; with HAL.Time; package MPU60x0 is -- TODO: Definition of Configuration and Value record type MPU60x0_Sensor_Reading is record Accel_X : Integer_16; Accel_Y : Integer_16; Accel_Z : Integer_16; Temp : Integer_16; Gyro_X : Integer_16; Gyro_Y : Integer_16; Gyro_Z : Integer_16; end record with Size => 112; -- Since the Values are stored in big endian order in the sensor for MPU60x0_Sensor_Reading'Bit_Order use System.High_Order_First; for MPU60x0_Sensor_Reading'Scalar_Storage_Order use System.High_Order_First; pragma Pack (MPU60x0_Sensor_Reading); type MPU60x0_Sensor_Reading_Float is record Accel_X : Float; Accel_Y : Float; Accel_Z : Float; Temp : Float; Gyro_X : Float; Gyro_Y : Float; Gyro_Z : Float; end record with Size => 224; pragma Pack (MPU60x0_Sensor_Reading_Float); type MPU60x0_Gyro_Scale_Range is (deg_250_s, deg_500_s, deg_1000_s, deg_2500_s) with Size => 2; for MPU60x0_Gyro_Scale_Range use (deg_250_s => 0, deg_500_s => 1, deg_1000_s => 2, deg_2500_s => 3); type MPU60x0_Accel_Scale_Range is (g2, g4, g8, g16) with Size => 2; for MPU60x0_Accel_Scale_Range use (g2 => 0, g4 => 1, g8 => 2, g16 => 3); type MPU60x0_Configuration is record Time : HAL.Time.Any_Delays; Accel_Scale_Range : MPU60x0_Accel_Scale_Range; Gyro_Scale_Range : MPU60x0_Gyro_Scale_Range; -- TODO: Digital Filter setting -- TODO: Sample Speed setting -- TODO: Clock source settin end record; type MPU60x0_Self_Test_Response is record XA : Float; YA : Float; ZA : Float; XG : Float; YG : Float; ZG : Float; end record; type MPU60x0_Config_Access is access all MPU60x0_Configuration; type MPU60x0_Device is tagged limited private; procedure Configure (This : in out MPU60x0_Device; Conf : MPU60x0_Configuration); procedure Read_Values (This : MPU60x0_Device; Values : in out MPU60x0_Sensor_Reading); procedure Read_Values_Float (This : MPU60x0_Device; Values : in out MPU60x0_Sensor_Reading_Float); procedure Get_ST_Results (This : MPU60x0_Device; Values : out MPU60x0_Self_Test_Response); private type Self_Test_Registers is record XA_Test_H : UInt3; XG_Test : UInt5; YA_Test_H : UInt3; YG_Test : UInt5; ZA_Test_H : UInt3; ZG_Test : UInt5; Reserved_6_7 : UInt2; XA_Test_L : UInt2; YA_Test_L : UInt2; ZA_Test_L : UInt2; end record with Size => 32; for Self_Test_Registers use record XA_Test_H at 0 range 5 .. 7; XG_Test at 0 range 0 .. 4; YA_Test_H at 1 range 5 .. 7; YG_Test at 1 range 0 .. 4; ZA_Test_H at 2 range 5 .. 7; ZG_Test at 2 range 0 .. 4; Reserved_6_7 at 3 range 6 .. 7; XA_Test_L at 3 range 4 .. 5; YA_Test_L at 3 range 2 .. 3; ZA_Test_L at 3 range 0 .. 1; end record; SELF_TEST_REG_ADDRESS : constant UInt8 := 16#0D#; function Get_Deriv (Read1 : Float; Read2 : Float; FT : Float) return Float; function Get_G_FT (Input : UInt5) return Float; function Get_A_FT (Input_H : UInt3; Input_L : UInt2) return Float; type Sample_Rate_Divider is new UInt8; SR_DIV_ADDRESS : constant UInt8 := 16#19#; type MPU60x0_Filter_Setting is new UInt3; type Config is record Reserved_3_7 : UInt5; Filter_Setting : MPU60x0_Filter_Setting; end record with Size => 8; for Config use record Reserved_3_7 at 0 range 3 .. 7; Filter_Setting at 0 range 0 .. 2; end record; CONFIG_ADDRESS : constant UInt8 := 16#1A#; type Gyro_Config is record XG_Selftest : Boolean; YG_Selftest : Boolean; ZG_Selftest : Boolean; Scale_Range : MPU60x0_Gyro_Scale_Range; Reserved_0_2 : UInt3; end record with Size => 8; for Gyro_Config use record XG_Selftest at 0 range 7 .. 7; YG_Selftest at 0 range 6 .. 6; ZG_Selftest at 0 range 5 .. 5; Scale_Range at 0 range 3 .. 4; Reserved_0_2 at 0 range 0 .. 2; end record; GYRO_CONFIG_ADDRESS : constant UInt8 := 16#1B#; type Accel_Config is record XA_Selftest : Boolean; YA_Selftest : Boolean; ZA_Selftest : Boolean; Scale_range : MPU60x0_Accel_Scale_Range; Reserved_0_2 : UInt3; end record with Size => 8; for Accel_Config use record XA_Selftest at 0 range 7 .. 7; YA_Selftest at 0 range 6 .. 6; ZA_Selftest at 0 range 5 .. 5; Scale_Range at 0 range 3 .. 4; Reserved_0_2 at 0 range 0 .. 2; end record; ACCEL_CONFIG_ADDRESS : constant UInt8 := 16#1C#; -- TODO : FIFO enable register type Int_Pin_Config is record Int_Level : Boolean; Int_Open : Boolean; Latch_Int_Enable : Boolean; Int_Read_Clear : Boolean; FSync_Int_Level : Boolean; FSync_Int_Enable : Boolean; I2C_Bypass_Enable : Boolean; Reserved_0 : Boolean; end record with Size => 8; for Int_Pin_Config use record Int_Level at 0 range 7 .. 7; Int_Open at 0 range 6 .. 6; Latch_Int_Enable at 0 range 5 .. 5; Int_Read_Clear at 0 range 4 .. 4; FSync_Int_Level at 0 range 3 .. 3; FSync_Int_Enable at 0 range 2 .. 2; I2C_Bypass_Enable at 0 range 1 .. 1; Reserved_0 at 0 range 0 .. 0; end record; INT_PIN_CFG_ADDRESS : constant UInt8 := 16#37#; type Int_Enable is record Reserved_5_7 : UInt3; Fifo_Overflow_Enable : Boolean; I2C_Master_Int_Enable : Boolean; Reserved_1_2 : UInt2; Data_Ready_Enable : Boolean; end record with Size => 8; for Int_Enable use record Reserved_5_7 at 0 range 5 .. 7; Fifo_Overflow_Enable at 0 range 4 .. 4; I2C_Master_Int_Enable at 0 range 3 .. 3; Reserved_1_2 at 0 range 1 .. 2; Data_Ready_Enable at 0 range 0 .. 0; end record; INT_ENABLE_ADDRESS : constant UInt8 := 16#38#; type Int_Status is record Reserved_5_7 : UInt3; Fifo_Overflow : Boolean; I2C_Master_Int : Boolean; Reserved_1_2 : UInt2; Data_Ready : Boolean; end record with Size => 8; for Int_Status use record Reserved_5_7 at 0 range 5 .. 7; Fifo_Overflow at 0 range 4 .. 4; I2C_Master_Int at 0 range 3 .. 3; Reserved_1_2 at 0 range 1 .. 2; Data_Ready at 0 range 0 .. 0; end record; INT_STATUS_ADDRESS : constant UInt8 := 16#3A#; SENSOR_DATA_ADDRESS : constant UInt8 := 16#3B#; type Signal_Path_Reset is record Reserved_3_7 : UInt5; Gyro_Reset : Boolean; Accel_Reset : Boolean; Temp_Reset : Boolean; end record with Size => 8; for Signal_Path_Reset use record Reserved_3_7 at 0 range 3 .. 7; Gyro_Reset at 0 range 2 .. 2; Accel_Reset at 0 range 1 .. 1; Temp_Reset at 0 range 0 .. 0; end record; SIGNAL_PATH_RESET_ADDRESS : constant UInt8 := 16#68#; type User_Control is record Reserved_7 : Boolean; Fifo_Enable : Boolean; I2C_Master_Enable : Boolean; I2C_IF_Enable : Boolean; Reserved_3 : Boolean; Fifo_Reset : Boolean; I2C_Master_Reset : Boolean; Sensor_Reset : Boolean; end record with Size => 8; for User_Control use record Reserved_7 at 0 range 7 .. 7; Fifo_Enable at 0 range 6 .. 6; I2C_Master_Enable at 0 range 5 .. 5; I2C_IF_Enable at 0 range 4 .. 4; Reserved_3 at 0 range 3 .. 3; Fifo_Reset at 0 range 2 .. 2; I2C_Master_Reset at 0 range 1 .. 1; Sensor_Reset at 0 range 0 .. 0; end record; USER_CONTROL_ADDRESS : constant UInt8 := 16#6A#; type MPU60x0_Clock_Selection is (Internal, PLL_X, PLL_Y, PLL_Z, PLL_Ext_32kHz, PLL_Ext_19MHz, Stop) with Size => 3; for MPU60x0_Clock_Selection use (Internal => 0, PLL_X => 1, PLL_Y => 2, PLL_Z => 3, PLL_Ext_32kHz => 4, PLL_Ext_19MHz => 5, Stop => 7); type Power_Management1 is record Device_Reset : Boolean; Sleep : Boolean; Cycle : Boolean; Reserved_4 : Boolean; Temp_Disable : Boolean; Clock_Selection : MPU60x0_Clock_Selection; end record with Size => 8; for Power_Management1 use record Device_Reset at 0 range 7 .. 7; Sleep at 0 range 6 .. 6; Cycle at 0 range 5 .. 5; Reserved_4 at 0 range 4 .. 4; Temp_Disable at 0 range 3 .. 3; Clock_Selection at 0 range 0 .. 2; end record; POWER_MANAGEMENT1_ADDRESS : constant UInt8 := 16#6B#; type MPU60x0_WakeUp_Freq is (Hz1_25, Hz5, Hz20, Hz40) with Size => 2; for MPU60x0_WakeUp_Freq use (Hz1_25 => 0, Hz5 => 1, Hz20 => 2, Hz40 => 3); type Power_Management2 is record WakeUp_Freq : MPU60x0_WakeUp_Freq; XA_Standby : Boolean; YA_Standby : Boolean; ZA_Standby : Boolean; XG_Standby : Boolean; YG_Standby : Boolean; ZG_Standby : Boolean; end record with Size => 8; for Power_Management2 use record WakeUp_Freq at 0 range 6 .. 7; XA_Standby at 0 range 5 .. 5; YA_Standby at 0 range 4 .. 4; ZA_Standby at 0 range 3 .. 3; XG_Standby at 0 range 2 .. 2; YG_Standby at 0 range 1 .. 1; ZG_Standby at 0 range 0 .. 0; end record; POWER_MANAGEMENT2_ADDRESS : constant UInt8 := 16#6C#; -- TODO : FiFo count and Data WHOAMI_ADDRESS : constant UInt8 := 16#75#; WHOAMI_VALUE : constant UInt8 := 2#01101000#; type Byte_Array is array (Positive range <>) of UInt8 with Alignment => 2; type Byte_Array_Access is access Byte_Array; type MPU60x0_Device is tagged limited record Conf : MPU60x0_Configuration; end record; procedure Read_Port (This : MPU60x0_Device; Address : UInt8; Data : out Byte_Array); procedure Write_Port (This : MPU60x0_Device; Address : UInt8; Data : UInt8); end MPU60x0;
programs/oeis/026/A026121.asm
neoneye/loda
22
6964
; A026121: a(n) = 3^n*(3^n-1)/2. ; 0,3,36,351,3240,29403,265356,2390391,21520080,193700403,1743362676,15690441231,141214502520,1270932117003,11438393835996,102945558872871,926510072902560,8338590785263203,75047317454789316,675425858255365311,6078832727785072200,54709494560526003003,492385451076115086636,4431469059779178958551,39883221538295040163440,358948993845502650080403,3230540944612065716551956,29074868501516217046452591,261673816513668830210528280,2355064348623088102272119403,21195579137607998811581169276,190760212238472606977626807431,1716841910146255315818830118720,15451577191316303401430037624003,139064194721846747290052038282596,1251577752496620775642013443543071,11264199772469587130872756288886760,101377797952226284628138712490978203,912400181570036563004100130091795916 mov $1,3 pow $1,$0 bin $1,2 mov $0,$1
oeis/193/A193250.asm
neoneye/loda-programs
11
13927
; A193250: Small rhombicuboctahedron with faces of centered polygons. ; 1,51,245,679,1449,2651,4381,6735,9809,13699,18501,24311,31225,39339,48749,59551,71841,85715,101269,118599,137801,158971,182205,207599,235249,265251,297701,332695,370329,410699,453901,500031,549185,601459,656949,715751,777961,843675,912989,985999,1062801,1143491,1228165,1316919,1409849,1507051,1608621,1714655,1825249,1940499,2060501,2185351,2315145,2449979,2589949,2735151,2885681,3041635,3203109,3370199,3543001,3721611,3906125,4096639,4293249,4496051,4705141,4920615,5142569,5371099,5606301 mul $0,2 add $0,1 mov $1,$0 pow $0,3 sub $1,$0 sub $0,$1
Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i9-9900K_12_0xca_notsx.log_21829_1203.asm
ljhsiun2/medusa
9
168475
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0xc704, %rbx nop nop nop nop xor %rsi, %rsi mov (%rbx), %edx nop nop nop sub %r15, %r15 lea addresses_WC_ht+0x17264, %rsi lea addresses_UC_ht+0x1fe4, %rdi nop nop nop nop nop sub $64711, %rbp mov $117, %rcx rep movsb nop nop nop nop nop inc %r15 lea addresses_UC_ht+0x10444, %r15 nop nop nop nop and $44274, %rsi vmovups (%r15), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdx nop nop nop inc %rsi lea addresses_normal_ht+0x1ea2c, %rsi cmp %rdx, %rdx vmovups (%rsi), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi nop add %rcx, %rcx lea addresses_UC_ht+0x12824, %rsi lea addresses_A_ht+0x16924, %rdi nop nop nop nop dec %r13 mov $74, %rcx rep movsb nop sub $50239, %rdx lea addresses_A_ht+0xd45c, %rsi lea addresses_D_ht+0x47e4, %rdi nop nop dec %rbx mov $36, %rcx rep movsw nop nop nop nop nop and %r15, %r15 lea addresses_UC_ht+0x17468, %rbp nop dec %r13 mov $0x6162636465666768, %rdi movq %rdi, (%rbp) nop nop nop xor %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r9 push %rax push %rcx push %rsi // Load lea addresses_WC+0x9224, %rcx nop nop nop nop and %r11, %r11 movups (%rcx), %xmm2 vpextrq $1, %xmm2, %rsi nop add $28903, %rsi // Store lea addresses_A+0x1f5e4, %r9 nop cmp %r15, %r15 mov $0x5152535455565758, %rcx movq %rcx, %xmm5 movntdq %xmm5, (%r9) nop nop nop nop inc %rsi // Store lea addresses_normal+0x15fe4, %r9 nop nop nop nop inc %r15 movl $0x51525354, (%r9) nop nop dec %r14 // Store lea addresses_WC+0x11be4, %r11 nop and $4849, %rcx mov $0x5152535455565758, %r15 movq %r15, %xmm4 vmovups %ymm4, (%r11) xor %r14, %r14 // Store lea addresses_normal+0x17e4, %r15 sub %r11, %r11 movw $0x5152, (%r15) nop nop nop nop nop xor $884, %r9 // Store lea addresses_UC+0x37e4, %rcx clflush (%rcx) inc %rax mov $0x5152535455565758, %rsi movq %rsi, %xmm3 movups %xmm3, (%rcx) nop nop nop nop dec %rax // Store lea addresses_UC+0x1bb24, %rax nop nop nop nop nop xor $38680, %r11 movl $0x51525354, (%rax) nop nop add $37948, %r9 // Store mov $0x55026800000002e4, %rsi and %r9, %r9 mov $0x5152535455565758, %r15 movq %r15, (%rsi) nop nop add %rsi, %rsi // Load lea addresses_WC+0x125d4, %rcx dec %r15 movups (%rcx), %xmm5 vpextrq $0, %xmm5, %rax nop add $47540, %rcx // Faulty Load lea addresses_D+0x7fe4, %rax add $7472, %r9 vmovntdqa (%rax), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r15 lea oracles, %rax and $0xff, %r15 shlq $12, %r15 mov (%rax,%r15,1), %r15 pop %rsi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': True, 'AVXalign': True, 'size': 4, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'00': 937, '54': 20892} 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 00 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 00 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
labs/types/grammars/Expr.g4
parrt/cs652
110
4645
<reponame>parrt/cs652 grammar Expr; @header {import org.antlr.symtab.*;} s returns [GlobalScope scope]: stat+ ; var : 'var' ID ':' typename ';' ; typename : 'int' | 'float' ; stat : var | assign ; assign : ID '=' e ';' ; e returns [Type type] : e '*' e # Mult | e '+' e # Add | INT # IntRef | FLOAT # FloatRef | ID # VarRef ; ID : [a-zA-Z_] [a-zA-Z0-9_]* ; INT : [0-9]+ ; FLOAT : '-'? INT '.' INT EXP? // 1.35, 1.35E-9, 0.3, -4.5 | '-'? INT EXP // 1e10 -3e4 | '-'? INT // -3, 45 ; fragment EXP : [Ee] [+\-]? INT ; WS : [ \r\t\n]+ -> skip ;
dasm/src/test/supercat.asm
zeh/dasmjs
16
162426
<filename>dasm/src/test/supercat.asm<gh_stars>10-100 ; $Id: supercat.asm 322 2008-11-16 10:22:06Z phf $ ; ; Pretty horrible bug... :-/ Switching to signed instead ; of unsigned arithmetic made this easier to handle but ; bad use of .ds can still lead to huge files since DASM ; doesn't enforce an upper bound yet. And what should it ; be? Hmm... ; ; From "supercat" on the atariage.com forums, forwarded by ; <NAME> 2008/04/12. ; ; <NAME> ; phf at acm dot org .processor 6502 .org $7FF8 .byte 1,2,3,4,5 ; original line by "supercat", would produce huge files ; since the "-1" result would be interpreted as a huge ; positive number .ds $7FFC-* ; Peter's line made the problem tractable and revealed ; the actual bug, checking this with xxd clearly shows ; the -1 bit pattern 0xffffffff which unsigned is huge. .long $7FFC-* .byte 1,2,3,4,5 .end
tools-src/gnu/gcc/gcc/ada/par-ch6.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
26898
<filename>tools-src/gnu/gcc/gcc/ada/par-ch6.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P A R . C H 6 -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ pragma Style_Checks (All_Checks); -- Turn off subprogram body ordering check. Subprograms are in order -- by RM section rather than alphabetical with Sinfo.CN; use Sinfo.CN; separate (Par) package body Ch6 is -- Local subprograms, used only in this chapter function P_Defining_Designator return Node_Id; function P_Defining_Operator_Symbol return Node_Id; procedure Check_Junk_Semicolon_Before_Return; -- Check for common error of junk semicolon before RETURN keyword of -- function specification. If present, skip over it with appropriate -- error message, leaving Scan_Ptr pointing to the RETURN after. This -- routine also deals with a possibly misspelled version of Return. ---------------------------------------- -- Check_Junk_Semicolon_Before_Return -- ---------------------------------------- procedure Check_Junk_Semicolon_Before_Return is Scan_State : Saved_Scan_State; begin if Token = Tok_Semicolon then Save_Scan_State (Scan_State); Scan; -- past the semicolon if Token = Tok_Return then Restore_Scan_State (Scan_State); Error_Msg_SC ("Unexpected semicolon ignored"); Scan; -- rescan past junk semicolon else Restore_Scan_State (Scan_State); end if; elsif Bad_Spelling_Of (Tok_Return) then null; end if; end Check_Junk_Semicolon_Before_Return; ----------------------------------------------------- -- 6.1 Subprogram (Also 6.3, 8.5.4, 10.1.3, 12.3) -- ----------------------------------------------------- -- This routine scans out a subprogram declaration, subprogram body, -- subprogram renaming declaration or subprogram generic instantiation. -- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION; -- ABSTRACT_SUBPROGRAM_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION is abstract; -- SUBPROGRAM_SPECIFICATION ::= -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE -- | function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE -- PARAMETER_PROFILE ::= [FORMAL_PART] -- PARAMETER_AND_RESULT_PROFILE ::= [FORMAL_PART] return SUBTYPE_MARK -- SUBPROGRAM_BODY ::= -- SUBPROGRAM_SPECIFICATION is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [DESIGNATOR]; -- SUBPROGRAM_RENAMING_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME; -- SUBPROGRAM_BODY_STUB ::= -- SUBPROGRAM_SPECIFICATION is separate; -- GENERIC_INSTANTIATION ::= -- procedure DEFINING_PROGRAM_UNIT_NAME is -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]; -- | function DEFINING_DESIGNATOR is -- new generic_function_NAME [GENERIC_ACTUAL_PART]; -- The value in Pf_Flags indicates which of these possible declarations -- is acceptable to the caller: -- Pf_Flags.Decl Set if declaration OK -- Pf_Flags.Gins Set if generic instantiation OK -- Pf_Flags.Pbod Set if proper body OK -- Pf_Flags.Rnam Set if renaming declaration OK -- Pf_Flags.Stub Set if body stub OK -- If an inappropriate form is encountered, it is scanned out but an -- error message indicating that it is appearing in an inappropriate -- context is issued. The only possible values for Pf_Flags are those -- defined as constants in the Par package. -- The caller has checked that the initial token is FUNCTION or PROCEDURE -- Error recovery: cannot raise Error_Resync function P_Subprogram (Pf_Flags : Pf_Rec) return Node_Id is Specification_Node : Node_Id; Name_Node : Node_Id; Fpart_List : List_Id; Fpart_Sloc : Source_Ptr; Return_Node : Node_Id; Inst_Node : Node_Id; Body_Node : Node_Id; Decl_Node : Node_Id; Rename_Node : Node_Id; Absdec_Node : Node_Id; Stub_Node : Node_Id; Fproc_Sloc : Source_Ptr; Func : Boolean; Scan_State : Saved_Scan_State; begin -- Set up scope stack entry. Note that the Labl field will be set later SIS_Entry_Active := False; SIS_Missing_Semicolon_Message := No_Error_Msg; Push_Scope_Stack; Scope.Table (Scope.Last).Sloc := Token_Ptr; Scope.Table (Scope.Last).Etyp := E_Name; Scope.Table (Scope.Last).Ecol := Start_Column; Scope.Table (Scope.Last).Lreq := False; Func := (Token = Tok_Function); Fproc_Sloc := Token_Ptr; Scan; -- past FUNCTION or PROCEDURE Ignore (Tok_Type); Ignore (Tok_Body); if Func then Name_Node := P_Defining_Designator; if Nkind (Name_Node) = N_Defining_Operator_Symbol and then Scope.Last = 1 then Error_Msg_SP ("operator symbol not allowed at library level"); Name_Node := New_Entity (N_Defining_Identifier, Sloc (Name_Node)); -- Set name from file name, we need some junk name, and that's -- as good as anything. This is only approximate, since we do -- not do anything with non-standard name translations. Get_Name_String (File_Name (Current_Source_File)); for J in 1 .. Name_Len loop if Name_Buffer (J) = '.' then Name_Len := J - 1; exit; end if; end loop; Set_Chars (Name_Node, Name_Find); Set_Error_Posted (Name_Node); end if; else Name_Node := P_Defining_Program_Unit_Name; end if; Scope.Table (Scope.Last).Labl := Name_Node; if Token = Tok_Colon then Error_Msg_SC ("redundant colon ignored"); Scan; -- past colon end if; -- Deal with generic instantiation, the one case in which we do not -- have a subprogram specification as part of whatever we are parsing if Token = Tok_Is then Save_Scan_State (Scan_State); -- at the IS T_Is; -- checks for redundant IS's if Token = Tok_New then if not Pf_Flags.Gins then Error_Msg_SC ("generic instantiation not allowed here!"); end if; Scan; -- past NEW if Func then Inst_Node := New_Node (N_Function_Instantiation, Fproc_Sloc); Set_Name (Inst_Node, P_Function_Name); else Inst_Node := New_Node (N_Procedure_Instantiation, Fproc_Sloc); Set_Name (Inst_Node, P_Qualified_Simple_Name); end if; Set_Defining_Unit_Name (Inst_Node, Name_Node); Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt); TF_Semicolon; Pop_Scope_Stack; -- Don't need scope stack entry in this case return Inst_Node; else Restore_Scan_State (Scan_State); -- to the IS end if; end if; -- If not a generic instantiation, then we definitely have a subprogram -- specification (all possibilities at this stage include one here) Fpart_Sloc := Token_Ptr; Check_Misspelling_Of (Tok_Return); -- Scan formal part. First a special error check. If we have an -- identifier here, then we have a definite error. If this identifier -- is on the same line as the designator, then we assume it is the -- first formal after a missing left parenthesis if Token = Tok_Identifier and then not Token_Is_At_Start_Of_Line then T_Left_Paren; -- to generate message Fpart_List := P_Formal_Part; -- Otherwise scan out an optional formal part in the usual manner else Fpart_List := P_Parameter_Profile; end if; -- We treat what we have as a function specification if FUNCTION was -- used, or if a RETURN is present. This gives better error recovery -- since later RETURN statements will be valid in either case. Check_Junk_Semicolon_Before_Return; Return_Node := Error; if Token = Tok_Return then if not Func then Error_Msg ("PROCEDURE should be FUNCTION", Fproc_Sloc); Func := True; end if; Scan; -- past RETURN Return_Node := P_Subtype_Mark; No_Constraint; else if Func then Ignore (Tok_Right_Paren); TF_Return; end if; end if; if Func then Specification_Node := New_Node (N_Function_Specification, Fproc_Sloc); Set_Subtype_Mark (Specification_Node, Return_Node); else Specification_Node := New_Node (N_Procedure_Specification, Fproc_Sloc); end if; Set_Defining_Unit_Name (Specification_Node, Name_Node); Set_Parameter_Specifications (Specification_Node, Fpart_List); -- Error check: barriers not allowed on protected functions/procedures if Token = Tok_When then if Func then Error_Msg_SC ("barrier not allowed on function, only on entry"); else Error_Msg_SC ("barrier not allowed on procedure, only on entry"); end if; Scan; -- past WHEN Discard_Junk_Node (P_Expression); end if; -- Deal with case of semicolon ending a subprogram declaration if Token = Tok_Semicolon then if not Pf_Flags.Decl then T_Is; end if; Scan; -- past semicolon -- If semicolon is immediately followed by IS, then ignore the -- semicolon, and go process the body. if Token = Tok_Is then Error_Msg_SP ("unexpected semicolon ignored"); T_Is; -- ignroe redundant IS's goto Subprogram_Body; -- If BEGIN follows in an appropriate column, we immediately -- commence the error action of assuming that the previous -- subprogram declaration should have been a subprogram body, -- i.e. that the terminating semicolon should have been IS. elsif Token = Tok_Begin and then Start_Column >= Scope.Table (Scope.Last).Ecol then Error_Msg_SP (""";"" should be IS!"); goto Subprogram_Body; else goto Subprogram_Declaration; end if; -- Case of not followed by semicolon else -- Subprogram renaming declaration case Check_Misspelling_Of (Tok_Renames); if Token = Tok_Renames then if not Pf_Flags.Rnam then Error_Msg_SC ("renaming declaration not allowed here!"); end if; Rename_Node := New_Node (N_Subprogram_Renaming_Declaration, Token_Ptr); Scan; -- past RENAMES Set_Name (Rename_Node, P_Name); Set_Specification (Rename_Node, Specification_Node); TF_Semicolon; Pop_Scope_Stack; return Rename_Node; -- Case of IS following subprogram specification elsif Token = Tok_Is then T_Is; -- ignore redundant Is's if Token_Name = Name_Abstract then Check_95_Keyword (Tok_Abstract, Tok_Semicolon); end if; -- Deal nicely with (now obsolete) use of <> in place of abstract if Token = Tok_Box then Error_Msg_SC ("ABSTRACT expected"); Token := Tok_Abstract; end if; -- Abstract subprogram declaration case if Token = Tok_Abstract then Absdec_Node := New_Node (N_Abstract_Subprogram_Declaration, Token_Ptr); Set_Specification (Absdec_Node, Specification_Node); Pop_Scope_Stack; -- discard unneeded entry Scan; -- past ABSTRACT TF_Semicolon; return Absdec_Node; -- Check for IS NEW with Formal_Part present and handle nicely elsif Token = Tok_New then Error_Msg ("formal part not allowed in instantiation", Fpart_Sloc); Scan; -- past NEW if Func then Inst_Node := New_Node (N_Function_Instantiation, Fproc_Sloc); else Inst_Node := New_Node (N_Procedure_Instantiation, Fproc_Sloc); end if; Set_Defining_Unit_Name (Inst_Node, Name_Node); Set_Name (Inst_Node, P_Name); Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt); TF_Semicolon; Pop_Scope_Stack; -- Don't need scope stack entry in this case return Inst_Node; else goto Subprogram_Body; end if; -- Here we have a missing IS or missing semicolon, we always guess -- a missing semicolon, since we are pretty good at fixing up a -- semicolon which should really be an IS else Error_Msg_AP ("missing "";"""); SIS_Missing_Semicolon_Message := Get_Msg_Id; goto Subprogram_Declaration; end if; end if; -- Processing for subprogram body <<Subprogram_Body>> if not Pf_Flags.Pbod then Error_Msg_SP ("subprogram body not allowed here!"); end if; -- Subprogram body stub case if Separate_Present then if not Pf_Flags.Stub then Error_Msg_SC ("body stub not allowed here!"); end if; if Nkind (Name_Node) = N_Defining_Operator_Symbol then Error_Msg ("operator symbol cannot be used as subunit name", Sloc (Name_Node)); end if; Stub_Node := New_Node (N_Subprogram_Body_Stub, Sloc (Specification_Node)); Set_Specification (Stub_Node, Specification_Node); Scan; -- past SEPARATE Pop_Scope_Stack; TF_Semicolon; return Stub_Node; -- Subprogram body case else -- Here is the test for a suspicious IS (i.e. one that looks -- like it might more properly be a semicolon). See separate -- section discussing use of IS instead of semicolon in -- package Parse. if (Token in Token_Class_Declk or else Token = Tok_Identifier) and then Start_Column <= Scope.Table (Scope.Last).Ecol and then Scope.Last /= 1 then Scope.Table (Scope.Last).Etyp := E_Suspicious_Is; Scope.Table (Scope.Last).S_Is := Prev_Token_Ptr; end if; Body_Node := New_Node (N_Subprogram_Body, Sloc (Specification_Node)); Set_Specification (Body_Node, Specification_Node); Parse_Decls_Begin_End (Body_Node); return Body_Node; end if; -- Processing for subprogram declaration <<Subprogram_Declaration>> Decl_Node := New_Node (N_Subprogram_Declaration, Sloc (Specification_Node)); Set_Specification (Decl_Node, Specification_Node); -- If this is a context in which a subprogram body is permitted, -- set active SIS entry in case (see section titled "Handling -- Semicolon Used in Place of IS" in body of Parser package) -- Note that SIS_Missing_Semicolon_Message is already set properly. if Pf_Flags.Pbod then SIS_Labl := Scope.Table (Scope.Last).Labl; SIS_Sloc := Scope.Table (Scope.Last).Sloc; SIS_Ecol := Scope.Table (Scope.Last).Ecol; SIS_Declaration_Node := Decl_Node; SIS_Semicolon_Sloc := Prev_Token_Ptr; SIS_Entry_Active := True; end if; Pop_Scope_Stack; return Decl_Node; end P_Subprogram; --------------------------------- -- 6.1 Subprogram Declaration -- --------------------------------- -- Parsed by P_Subprogram (6.1) ------------------------------------------ -- 6.1 Abstract Subprogram Declaration -- ------------------------------------------ -- Parsed by P_Subprogram (6.1) ----------------------------------- -- 6.1 Subprogram Specification -- ----------------------------------- -- SUBPROGRAM_SPECIFICATION ::= -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE -- | function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE -- PARAMETER_PROFILE ::= [FORMAL_PART] -- PARAMETER_AND_RESULT_PROFILE ::= [FORMAL_PART] return SUBTYPE_MARK -- Subprogram specifications that appear in subprogram declarations -- are parsed by P_Subprogram (6.1). This routine is used in other -- contexts where subprogram specifications occur. -- Note: this routine does not affect the scope stack in any way -- Error recovery: can raise Error_Resync function P_Subprogram_Specification return Node_Id is Specification_Node : Node_Id; begin if Token = Tok_Function then Specification_Node := New_Node (N_Function_Specification, Token_Ptr); Scan; -- past FUNCTION Ignore (Tok_Body); Set_Defining_Unit_Name (Specification_Node, P_Defining_Designator); Set_Parameter_Specifications (Specification_Node, P_Parameter_Profile); Check_Junk_Semicolon_Before_Return; TF_Return; Set_Subtype_Mark (Specification_Node, P_Subtype_Mark); No_Constraint; return Specification_Node; elsif Token = Tok_Procedure then Specification_Node := New_Node (N_Procedure_Specification, Token_Ptr); Scan; -- past PROCEDURE Ignore (Tok_Body); Set_Defining_Unit_Name (Specification_Node, P_Defining_Program_Unit_Name); Set_Parameter_Specifications (Specification_Node, P_Parameter_Profile); return Specification_Node; else Error_Msg_SC ("subprogram specification expected"); raise Error_Resync; end if; end P_Subprogram_Specification; --------------------- -- 6.1 Designator -- --------------------- -- DESIGNATOR ::= -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL -- The caller has checked that the initial token is an identifier, -- operator symbol, or string literal. Note that we don't bother to -- do much error diagnosis in this routine, since it is only used for -- the label on END lines, and the routines in package Par.Endh will -- check that the label is appropriate. -- Error recovery: cannot raise Error_Resync function P_Designator return Node_Id is Ident_Node : Node_Id; Name_Node : Node_Id; Prefix_Node : Node_Id; function Real_Dot return Boolean; -- Tests if a current token is an interesting period, i.e. is followed -- by an identifier or operator symbol or string literal. If not, it is -- probably just incorrect punctuation to be caught by our caller. Note -- that the case of an operator symbol or string literal is also an -- error, but that is an error that we catch here. If the result is -- True, a real dot has been scanned and we are positioned past it, -- if the result is False, the scan position is unchanged. function Real_Dot return Boolean is Scan_State : Saved_Scan_State; begin if Token /= Tok_Dot then return False; else Save_Scan_State (Scan_State); Scan; -- past dot if Token = Tok_Identifier or else Token = Tok_Operator_Symbol or else Token = Tok_String_Literal then return True; else Restore_Scan_State (Scan_State); return False; end if; end if; end Real_Dot; -- Start of processing for P_Designator begin Ident_Node := Token_Node; Scan; -- past initial token if Prev_Token = Tok_Operator_Symbol or else Prev_Token = Tok_String_Literal or else not Real_Dot then return Ident_Node; -- Child name case else Prefix_Node := Ident_Node; -- Loop through child names, on entry to this loop, Prefix contains -- the name scanned so far, and Ident_Node is the last identifier. loop Name_Node := New_Node (N_Selected_Component, Prev_Token_Ptr); Set_Prefix (Name_Node, Prefix_Node); Ident_Node := P_Identifier; Set_Selector_Name (Name_Node, Ident_Node); Prefix_Node := Name_Node; exit when not Real_Dot; end loop; -- On exit from the loop, Ident_Node is the last identifier scanned, -- i.e. the defining identifier, and Prefix_Node is a node for the -- entire name, structured (incorrectly!) as a selected component. Name_Node := Prefix (Prefix_Node); Change_Node (Prefix_Node, N_Designator); Set_Name (Prefix_Node, Name_Node); Set_Identifier (Prefix_Node, Ident_Node); return Prefix_Node; end if; exception when Error_Resync => while Token = Tok_Dot or else Token = Tok_Identifier loop Scan; end loop; return Error; end P_Designator; ------------------------------ -- 6.1 Defining Designator -- ------------------------------ -- DEFINING_DESIGNATOR ::= -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL -- Error recovery: cannot raise Error_Resync function P_Defining_Designator return Node_Id is begin if Token = Tok_Operator_Symbol then return P_Defining_Operator_Symbol; elsif Token = Tok_String_Literal then Error_Msg_SC ("invalid operator name"); Scan; -- past junk string return Error; else return P_Defining_Program_Unit_Name; end if; end P_Defining_Designator; ------------------------------------- -- 6.1 Defining Program Unit Name -- ------------------------------------- -- DEFINING_PROGRAM_UNIT_NAME ::= -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER -- Note: PARENT_UNIT_NAME may be present only in 95 mode at the outer level -- Error recovery: cannot raise Error_Resync function P_Defining_Program_Unit_Name return Node_Id is Ident_Node : Node_Id; Name_Node : Node_Id; Prefix_Node : Node_Id; begin -- Set identifier casing if not already set and scan initial identifier if Token = Tok_Identifier and then Identifier_Casing (Current_Source_File) = Unknown then Set_Identifier_Casing (Current_Source_File, Determine_Token_Casing); end if; Ident_Node := P_Identifier; Merge_Identifier (Ident_Node, Tok_Return); -- Normal case (not child library unit name) if Token /= Tok_Dot then Change_Identifier_To_Defining_Identifier (Ident_Node); return Ident_Node; -- Child library unit name case else if Scope.Last > 1 then Error_Msg_SP ("child unit allowed only at library level"); raise Error_Resync; elsif Ada_83 then Error_Msg_SP ("(Ada 83) child unit not allowed!"); end if; Prefix_Node := Ident_Node; -- Loop through child names, on entry to this loop, Prefix contains -- the name scanned so far, and Ident_Node is the last identifier. loop exit when Token /= Tok_Dot; Name_Node := New_Node (N_Selected_Component, Token_Ptr); Scan; -- past period Set_Prefix (Name_Node, Prefix_Node); Ident_Node := P_Identifier; Set_Selector_Name (Name_Node, Ident_Node); Prefix_Node := Name_Node; end loop; -- On exit from the loop, Ident_Node is the last identifier scanned, -- i.e. the defining identifier, and Prefix_Node is a node for the -- entire name, structured (incorrectly!) as a selected component. Name_Node := Prefix (Prefix_Node); Change_Node (Prefix_Node, N_Defining_Program_Unit_Name); Set_Name (Prefix_Node, Name_Node); Change_Identifier_To_Defining_Identifier (Ident_Node); Set_Defining_Identifier (Prefix_Node, Ident_Node); -- All set with unit name parsed return Prefix_Node; end if; exception when Error_Resync => while Token = Tok_Dot or else Token = Tok_Identifier loop Scan; end loop; return Error; end P_Defining_Program_Unit_Name; -------------------------- -- 6.1 Operator Symbol -- -------------------------- -- OPERATOR_SYMBOL ::= STRING_LITERAL -- Operator symbol is returned by the scanner as Tok_Operator_Symbol ----------------------------------- -- 6.1 Defining Operator Symbol -- ----------------------------------- -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL -- The caller has checked that the initial symbol is an operator symbol function P_Defining_Operator_Symbol return Node_Id is Op_Node : Node_Id; begin Op_Node := Token_Node; Change_Operator_Symbol_To_Defining_Operator_Symbol (Op_Node); Scan; -- past operator symbol return Op_Node; end P_Defining_Operator_Symbol; ---------------------------- -- 6.1 Parameter_Profile -- ---------------------------- -- PARAMETER_PROFILE ::= [FORMAL_PART] -- Empty is returned if no formal part is present -- Error recovery: cannot raise Error_Resync function P_Parameter_Profile return List_Id is begin if Token = Tok_Left_Paren then Scan; -- part left paren return P_Formal_Part; else return No_List; end if; end P_Parameter_Profile; --------------------------------------- -- 6.1 Parameter And Result Profile -- --------------------------------------- -- Parsed by its parent construct, which uses P_Parameter_Profile to -- parse the parameters, and P_Subtype_Mark to parse the return type. ---------------------- -- 6.1 Formal part -- ---------------------- -- FORMAL_PART ::= (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION}) -- PARAMETER_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : MODE SUBTYPE_MARK -- [:= DEFAULT_EXPRESSION] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION -- [:= DEFAULT_EXPRESSION] -- This scans the construct Formal_Part. The caller has already checked -- that the initial token is a left parenthesis, and skipped past it, so -- that on entry Token is the first token following the left parenthesis. -- Error recovery: cannot raise Error_Resync function P_Formal_Part return List_Id is Specification_List : List_Id; Specification_Node : Node_Id; Scan_State : Saved_Scan_State; Num_Idents : Nat; Ident : Nat; Ident_Sloc : Source_Ptr; Idents : array (Int range 1 .. 4096) of Entity_Id; -- This array holds the list of defining identifiers. The upper bound -- of 4096 is intended to be essentially infinite, and we do not even -- bother to check for it being exceeded. begin Specification_List := New_List; Specification_Loop : loop begin if Token = Tok_Pragma then P_Pragmas_Misplaced; end if; Ignore (Tok_Left_Paren); Ident_Sloc := Token_Ptr; Idents (1) := P_Defining_Identifier; Num_Idents := 1; Ident_Loop : loop exit Ident_Loop when Token = Tok_Colon; -- The only valid tokens are colon and comma, so if we have -- neither do a bit of investigation to see which is the -- better choice for insertion. if Token /= Tok_Comma then -- Assume colon if IN or OUT keyword found exit Ident_Loop when Token = Tok_In or else Token = Tok_Out; -- Otherwise scan ahead Save_Scan_State (Scan_State); Look_Ahead : loop -- If we run into a semicolon, then assume that a -- colon was missing, e.g. Parms (X Y; ...). Also -- assume missing colon on EOF (a real disaster!) -- and on a right paren, e.g. Parms (X Y), and also -- on an assignment symbol, e.g. Parms (X Y := ..) if Token = Tok_Semicolon or else Token = Tok_Right_Paren or else Token = Tok_EOF or else Token = Tok_Colon_Equal then Restore_Scan_State (Scan_State); exit Ident_Loop; -- If we run into a colon, assume that we had a missing -- comma, e.g. Parms (A B : ...). Also assume a missing -- comma if we hit another comma, e.g. Parms (A B, C ..) elsif Token = Tok_Colon or else Token = Tok_Comma then Restore_Scan_State (Scan_State); exit Look_Ahead; end if; Scan; end loop Look_Ahead; end if; -- Here if a comma is present, or to be assumed T_Comma; Num_Idents := Num_Idents + 1; Idents (Num_Idents) := P_Defining_Identifier; end loop Ident_Loop; -- Fall through the loop on encountering a colon, or deciding -- that there is a missing colon. T_Colon; -- If there are multiple identifiers, we repeatedly scan the -- type and initialization expression information by resetting -- the scan pointer (so that we get completely separate trees -- for each occurrence). if Num_Idents > 1 then Save_Scan_State (Scan_State); end if; -- Loop through defining identifiers in list Ident := 1; Ident_List_Loop : loop Specification_Node := New_Node (N_Parameter_Specification, Ident_Sloc); Set_Defining_Identifier (Specification_Node, Idents (Ident)); if Token = Tok_Access then if Ada_83 then Error_Msg_SC ("(Ada 83) access parameters not allowed"); end if; Set_Parameter_Type (Specification_Node, P_Access_Definition); else P_Mode (Specification_Node); if Token = Tok_Procedure or else Token = Tok_Function then Error_Msg_SC ("formal subprogram parameter not allowed"); Scan; if Token = Tok_Left_Paren then Discard_Junk_List (P_Formal_Part); end if; if Token = Tok_Return then Scan; Discard_Junk_Node (P_Subtype_Mark); end if; Set_Parameter_Type (Specification_Node, Error); else Set_Parameter_Type (Specification_Node, P_Subtype_Mark); No_Constraint; end if; end if; Set_Expression (Specification_Node, Init_Expr_Opt (True)); if Ident > 1 then Set_Prev_Ids (Specification_Node, True); end if; if Ident < Num_Idents then Set_More_Ids (Specification_Node, True); end if; Append (Specification_Node, Specification_List); exit Ident_List_Loop when Ident = Num_Idents; Ident := Ident + 1; Restore_Scan_State (Scan_State); end loop Ident_List_Loop; exception when Error_Resync => Resync_Semicolon_List; end; if Token = Tok_Semicolon then Scan; -- past semicolon -- If we have RETURN or IS after the semicolon, then assume -- that semicolon should have been a right parenthesis and exit if Token = Tok_Is or else Token = Tok_Return then Error_Msg_SP ("expected "")"" in place of "";"""); exit Specification_Loop; end if; elsif Token = Tok_Right_Paren then Scan; -- past right paren exit Specification_Loop; -- Special check for common error of using comma instead of semicolon elsif Token = Tok_Comma then T_Semicolon; Scan; -- past comma -- Special check for omitted separator elsif Token = Tok_Identifier then T_Semicolon; -- If nothing sensible, skip to next semicolon or right paren else T_Semicolon; Resync_Semicolon_List; if Token = Tok_Semicolon then Scan; -- past semicolon else T_Right_Paren; exit Specification_Loop; end if; end if; end loop Specification_Loop; return Specification_List; end P_Formal_Part; ---------------------------------- -- 6.1 Parameter Specification -- ---------------------------------- -- Parsed by P_Formal_Part (6.1) --------------- -- 6.1 Mode -- --------------- -- MODE ::= [in] | in out | out -- There is no explicit node in the tree for the Mode. Instead the -- In_Present and Out_Present flags are set in the parent node to -- record the presence of keywords specifying the mode. -- Error_Recovery: cannot raise Error_Resync procedure P_Mode (Node : Node_Id) is begin if Token = Tok_In then Scan; -- past IN Set_In_Present (Node, True); end if; if Token = Tok_Out then Scan; -- past OUT Set_Out_Present (Node, True); end if; if Token = Tok_In then Error_Msg_SC ("IN must precede OUT in parameter mode"); Scan; -- past IN Set_In_Present (Node, True); end if; end P_Mode; -------------------------- -- 6.3 Subprogram Body -- -------------------------- -- Parsed by P_Subprogram (6.1) ----------------------------------- -- 6.4 Procedure Call Statement -- ----------------------------------- -- Parsed by P_Sequence_Of_Statements (5.1) ------------------------ -- 6.4 Function Call -- ------------------------ -- Parsed by P_Call_Or_Name (4.1) -------------------------------- -- 6.4 Actual Parameter Part -- -------------------------------- -- Parsed by P_Call_Or_Name (4.1) -------------------------------- -- 6.4 Parameter Association -- -------------------------------- -- Parsed by P_Call_Or_Name (4.1) ------------------------------------ -- 6.4 Explicit Actual Parameter -- ------------------------------------ -- Parsed by P_Call_Or_Name (4.1) --------------------------- -- 6.5 Return Statement -- --------------------------- -- RETURN_STATEMENT ::= return [EXPRESSION]; -- The caller has checked that the initial token is RETURN -- Error recovery: can raise Error_Resync function P_Return_Statement return Node_Id is Return_Node : Node_Id; begin Return_Node := New_Node (N_Return_Statement, Token_Ptr); -- Sloc points to RETURN -- Expression (Op3) Scan; -- past RETURN if Token /= Tok_Semicolon then -- If no semicolon, then scan an expression, except that -- we avoid trying to scan an expression if we are at an -- expression terminator since in that case the best error -- message is probably that we have a missing semicolon. if Token not in Token_Class_Eterm then Set_Expression (Return_Node, P_Expression_No_Right_Paren); end if; end if; TF_Semicolon; return Return_Node; end P_Return_Statement; end Ch6;
oeis/139/A139101.asm
neoneye/loda-programs
11
21205
; A139101: Numbers that show the distribution of prime numbers up to the n-th prime minus 1, using "0" for primes and "1" for nonprime numbers. ; Submitted by <NAME>(s4) ; 1,10,1001,100101,1001010111,100101011101,1001010111010111,100101011101011101,1001010111010111010111,1001010111010111010111011111,100101011101011101011101111101,100101011101011101011101111101011111,1001010111010111010111011111010111110111,100101011101011101011101111101011111011101,1001010111010111010111011111010111110111010111,1001010111010111010111011111010111110111010111011111,1001010111010111010111011111010111110111010111011111011111 seq $0,6093 ; a(n) = prime(n) - 1. seq $0,118256 ; Concatenation for i=1 to n of A005171(i); also A118255 in base 2. div $0,10
oeis/032/A032085.asm
neoneye/loda-programs
11
98154
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A032085: Number of reversible strings with n beads of 2 colors. If more than 1 bead, not palindromic. ; 2,1,2,6,12,28,56,120,240,496,992,2016,4032,8128,16256,32640,65280,130816,261632,523776,1047552,2096128,4192256,8386560,16773120,33550336,67100672,134209536,268419072,536854528,1073709056,2147450880,4294901760,8589869056,17179738112,34359607296,68719214592,137438691328,274877382656,549755289600,1099510579200,2199022206976,4398044413952,8796090925056,17592181850112,35184367894528,70368735789056,140737479966720,281474959933440,562949936644096,1125899873288192,2251799780130816,4503599560261632 mov $2,1 lpb $2 mov $2,$0 add $0,2 lpe add $0,1 seq $0,297619 ; a(n) = 2*a(n-1) + 2*a(n-2) - 4*a(n-3), a(1) = 0, a(2) = 0, a(3) = 8. div $0,8
src/wiki-plugins-conditions.ads
jquorning/ada-wiki
18
3994
----------------------------------------------------------------------- -- wiki-plugins-conditions -- Condition Plugin -- Copyright (C) 2016, 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 Wiki.Strings; -- === Conditions Plugins === -- The <b>Wiki.Plugins.Conditions</b> package defines a set of conditional plugins -- to show or hide wiki content according to some conditions evaluated during the parsing phase. -- package Wiki.Plugins.Conditions is MAX_CONDITION_DEPTH : constant Natural := 31; type Condition_Depth is new Natural range 0 .. MAX_CONDITION_DEPTH; type Condition_Type is (CONDITION_IF, CONDITION_ELSIF, CONDITION_ELSE, CONDITION_END); type Condition_Plugin is new Wiki_Plugin with private; -- Evaluate the condition and return it as a boolean status. function Evaluate (Plugin : in Condition_Plugin; Params : in Wiki.Attributes.Attribute_List) return Boolean; -- Get the type of condition (IF, ELSE, ELSIF, END) represented by the plugin. function Get_Condition_Kind (Plugin : in Condition_Plugin; Params : in Wiki.Attributes.Attribute_List) return Condition_Type; -- Evaluate the condition described by the parameters and hide or show the wiki -- content. overriding procedure Expand (Plugin : in out Condition_Plugin; Document : in out Wiki.Documents.Document; Params : in out Wiki.Attributes.Attribute_List; Context : in out Plugin_Context); -- Append the attribute name/value to the condition plugin parameter list. procedure Append (Plugin : in out Condition_Plugin; Name : in Wiki.Strings.WString; Value : in Wiki.Strings.WString); private type Boolean_Array is array (Condition_Depth) of Boolean; pragma Pack (Boolean_Array); type Condition_Plugin is new Wiki_Plugin with record Depth : Condition_Depth := 1; Values : Boolean_Array := (others => False); Params : Wiki.Attributes.Attribute_List; end record; end Wiki.Plugins.Conditions;
wof/lcs/base/314.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
102530
copyright zengfr site:http://github.com/zengfr/romhack 0015FC move.w A0, -(A4) [base+314] 0015FE move.w A4, ($314,A5) [base+7BA, base+7BC, base+7BE] 001602 addq.w #1, ($30e,A5) [base+314] 018B1A lea ($740,A5), A3 [base+314] 01A65E move.w D0, ($30e,A5) [base+314] 05DFAA subq.w #1, D7 [base+314] copyright zengfr site:http://github.com/zengfr/romhack
Transynther/x86/_processed/AVXALIGN/_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_1665.asm
ljhsiun2/medusa
9
103687
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_WC_ht+0x14fdc, %r8 nop nop nop nop nop xor %r13, %r13 vmovups (%r8), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r14 nop nop nop xor $18357, %r11 lea addresses_UC_ht+0x1455c, %rsi lea addresses_WC_ht+0x1eb1c, %rdi nop nop cmp %r15, %r15 mov $93, %rcx rep movsb cmp $4066, %r11 lea addresses_UC_ht+0x154dc, %rsi lea addresses_A_ht+0x1a1dc, %rdi nop nop xor %r13, %r13 mov $4, %rcx rep movsb nop add $6176, %rdi lea addresses_UC_ht+0x12d3c, %rsi lea addresses_A_ht+0xaddc, %rdi nop nop nop dec %r13 mov $101, %rcx rep movsl nop nop add %rdi, %rdi lea addresses_WT_ht+0x793c, %r11 and $22347, %rsi movups (%r11), %xmm4 vpextrq $1, %xmm4, %rdi nop nop nop nop nop inc %r15 lea addresses_UC_ht+0x1915c, %rsi lea addresses_A_ht+0xc5dc, %rdi nop nop nop cmp $11928, %r11 mov $45, %rcx rep movsb nop add $43322, %r14 lea addresses_WC_ht+0xffdc, %rsi lea addresses_WT_ht+0x107dc, %rdi clflush (%rdi) and %r11, %r11 mov $24, %rcx rep movsb nop nop and %r15, %r15 lea addresses_D_ht+0x99dc, %r15 nop xor %r11, %r11 movb $0x61, (%r15) nop nop nop inc %rcx pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %rdi push %rdx push %rsi // Store lea addresses_D+0x177dc, %r11 nop nop nop add %rdi, %rdi mov $0x5152535455565758, %rdx movq %rdx, (%r11) sub $52414, %rdi // Store mov $0x3dc, %r15 nop nop nop nop and $38285, %r10 movb $0x51, (%r15) nop nop nop nop nop inc %rdi // Store lea addresses_RW+0x821c, %r13 nop nop cmp $63041, %rdi movw $0x5152, (%r13) nop and %rsi, %rsi // Load lea addresses_UC+0x8b94, %r15 cmp $34909, %rsi vmovups (%r15), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rdx cmp %r13, %r13 // Store lea addresses_US+0x8fdc, %r13 cmp $7028, %r10 movb $0x51, (%r13) nop nop dec %r11 // Store lea addresses_PSE+0x15edc, %rsi nop nop nop cmp %rdx, %rdx mov $0x5152535455565758, %r13 movq %r13, (%rsi) nop add $57808, %rdx // Load lea addresses_WT+0x5d7c, %rdi clflush (%rdi) nop nop nop nop nop cmp %r13, %r13 movb (%rdi), %r15b nop nop xor $35288, %rdx // Store lea addresses_WC+0x2fdc, %r11 nop nop nop nop nop sub %rsi, %rsi mov $0x5152535455565758, %r13 movq %r13, %xmm3 vmovups %ymm3, (%r11) nop nop nop nop nop sub $20966, %rdx // Faulty Load lea addresses_US+0x8fdc, %rdi nop nop xor $62397, %r10 mov (%rdi), %r15w lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_US', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'c1': 1, 'd0': 1, '98': 2, '54': 1, '00': 18051, '58': 3772, 'e0': 1} 00 58 00 00 00 00 00 00 00 00 00 58 58 58 58 00 00 00 00 00 58 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 58 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 58 00 00 00 00 58 58 00 58 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 58 58 58 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 58 58 00 58 58 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 58 58 58 58 00 00 58 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 58 58 00 58 00 00 00 00 00 00 58 00 58 00 00 00 00 00 00 58 58 00 00 00 00 00 00 58 58 00 58 58 00 00 00 00 00 58 58 00 00 00 00 58 58 00 00 00 00 00 00 00 00 58 00 00 58 00 00 00 58 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 58 00 00 00 00 58 58 00 00 00 00 00 00 58 00 00 00 00 58 00 00 58 00 58 00 58 00 00 00 00 00 00 00 58 00 00 00 00 58 00 58 00 58 00 00 58 00 00 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 58 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 58 00 58 58 58 00 00 00 00 00 00 00 58 00 58 00 58 00 00 00 00 00 00 00 00 00 00 58 58 58 00 00 58 00 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 00 00 00 00 58 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 58 58 58 00 58 00 00 00 58 00 00 58 58 58 00 00 00 58 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 00 00 00 00 58 00 58 00 00 00 58 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 58 00 00 00 00 58 00 00 58 00 00 00 00 58 00 58 00 00 00 58 00 00 58 00 00 00 00 58 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 58 58 58 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 58 00 58 58 00 00 00 00 58 00 00 00 00 00 00 58 58 58 58 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 58 00 00 00 00 00 00 00 58 00 58 00 58 00 00 00 00 00 58 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 58 */
programs/oeis/221/A221969.asm
neoneye/loda
22
247796
<reponame>neoneye/loda ; A221969: Number of -n..n arrays of length 6 with the sum ahead of each element differing from the sum following that element by n or less. ; 129,2305,16513,73089,241153,653185,1535745,3246337,6316417,11500545,19831681,32682625,51833601,79545985,118642177,172591617,245602945,342722305,469937793,634290049,843988993,1108536705,1438856449,1847427841,2348428161,2957879809,3693803905,4576380033,5628112129,6874000513,8341720065,10061804545,12067837057,14396646657,17088511105 mul $0,2 add $0,3 pow $0,2 seq $0,83364 ; Antidiagonal sums of table A083362. mul $0,4 sub $0,1940 div $0,15 add $0,129
oeis/087/A087288.asm
neoneye/loda-programs
11
89283
; A087288: a(n)=2a(n-1)+a(n-2)-2a(n-3). ; 4,4,10,16,34,64,130,256,514,1024,2050,4096,8194,16384,32770,65536,131074,262144,524290,1048576,2097154,4194304,8388610,16777216,33554434,67108864,134217730,268435456,536870914,1073741824,2147483650,4294967296,8589934594,17179869184,34359738370,68719476736,137438953474,274877906944,549755813890,1099511627776,2199023255554,4398046511104,8796093022210,17592186044416,35184372088834,70368744177664,140737488355330,281474976710656,562949953421314,1125899906842624,2251799813685250,4503599627370496 mov $1,2 pow $1,$0 div $1,3 mul $1,6 add $1,4 mov $0,$1
entropy-upgrade.applescript
rinchen/fesc
0
2401
<filename>entropy-upgrade.applescript on clicked theObject -- Read in the preferences set theLocation to POSIX path of (call method "defaultObjectForKey:" with parameter "entropy") -- no need to stop as the script does that for us and then restarts entropy -- tell progress indicator "progress" of window "main" to stop try do shell script "cd " & theLocation & ";sh update.sh" display dialog "Entropy sucessfully upgraded to latest version." on error display dialog "Error: I encountered an unknown error trying to execute update.sh. Could update.sh be missing?" end try end clicked
src/GBA.Numerics.Vectors.adb
98devin/ada-gba-dev
7
6368
<reponame>98devin/ada-gba-dev<filename>src/GBA.Numerics.Vectors.adb<gh_stars>1-10 -- Copyright (c) 2021 <NAME> -- zlib License -- see LICENSE for details. package body GBA.Numerics.Vectors is function Pointwise (V, W : Vec) return Vec is begin return ( 0 => Operator (V (0), W (0)) , 1 => Operator (V (1), W (1)) ); end; function Scalar (V : Vec; E : Element) return Vec is begin return ( 0 => Operator (V (0), E) , 1 => Operator (V (1), E) ); end; function EMul (X, Y : Element) return Element is ( X * Y ) with Inline_Always; function EDiv (X, Y : Element) return Element is ( X / Y ) with Inline_Always; function VAdd is new Pointwise ("+"); function VSub is new Pointwise ("-"); function VMul is new Pointwise (EMul); function VDiv is new Pointwise (EDiv); function VAdd is new Scalar ("+"); function VSub is new Scalar ("-"); function VMul is new Scalar (EMul); function VDiv is new Scalar (EDiv); function "+" (V, W : Vec) return Vec renames VAdd; function "-" (V, W : Vec) return Vec renames VSub; function "*" (V, W : Vec) return Vec renames VMul; function "/" (V, W : Vec) return Vec renames VDiv; function "+" (V : Vec; E : Element) return Vec renames VAdd; function "-" (V : Vec; E : Element) return Vec renames VSub; function "*" (V : Vec; E : Element) return Vec renames VMul; function "/" (V : Vec; E : Element) return Vec renames VDiv; function Dot (V, W : Vec) return Element is begin return Vec'(V * W)'Reduce ("+", 0.0); end; end GBA.Numerics.Vectors;
src/keystore-io.ads
thierr26/ada-keystore
25
12995
<gh_stars>10-100 ----------------------------------------------------------------------- -- keystore-io -- IO low level operation for the keystore -- Copyright (C) 2019 <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.Streams; with Util.Encoders.AES; with Keystore.Buffers; with Keystore.Marshallers; private package Keystore.IO is use Ada.Streams; -- Data block size defined to a 4K to map system page. Block_Size : constant := Buffers.Block_Size; BT_HMAC_HEADER_SIZE : constant := 32; BT_TYPE_HEADER_SIZE : constant := 16; -- Block type magic values. BT_WALLET_UNUSED : constant := 16#0000#; BT_WALLET_HEADER : constant := 16#0101#; BT_WALLET_DIRECTORY : constant := 16#0202#; BT_WALLET_DATA : constant := 16#0303#; SIZE_U16 : constant := 2; SIZE_U32 : constant := 4; SIZE_U64 : constant := 8; SIZE_DATE : constant := SIZE_U64; SIZE_HMAC : constant := BT_HMAC_HEADER_SIZE; SIZE_KIND : constant := SIZE_U32; SIZE_BLOCK : constant := SIZE_U32; SIZE_SECRET : constant := 32; SIZE_IV : constant := 16; type Block_Kind is (MASTER_BLOCK, DIRECTORY_BLOCK, DATA_BLOCK); subtype Buffer_Size is Buffers.Buffer_Size; subtype Block_Index is Buffers.Block_Index; subtype Block_Type is Buffers.Block_Type; subtype IO_Block_Type is Buffers.IO_Block_Type; subtype Block_Count is Buffers.Block_Count; subtype Block_Number is Buffers.Block_Number; subtype Storage_Block is Buffers.Storage_Block; subtype Storage_Identifier is Buffers.Storage_Identifier; subtype Marshaller is Marshallers.Marshaller; BT_HEADER_START : constant Block_Index := Block_Index'First; BT_DATA_START : constant Block_Index := BT_HEADER_START + BT_TYPE_HEADER_SIZE; BT_DATA_LENGTH : constant Block_Index := Block_Index'Last - BT_DATA_START + 1; BT_HMAC_HEADER_POS : constant Stream_Element_Offset := Block_Index'Last + 1; HEADER_BLOCK_NUM : constant Block_Number := 1; DEFAULT_STORAGE_ID : constant Storage_Identifier := 0; type Wallet_Stream is limited interface; type Wallet_Stream_Access is access all Wallet_Stream'Class; -- Returns true if the block number is allocated. function Is_Used (Stream : in out Wallet_Stream; Block : in Storage_Block) return Boolean is abstract; -- Read from the wallet stream the block identified by the number and -- call the `Process` procedure with the data block content. procedure Read (Stream : in out Wallet_Stream; Block : in Storage_Block; Process : not null access procedure (Data : in IO_Block_Type)) is abstract; -- Write in the wallet stream the block identified by the block number. procedure Write (Stream : in out Wallet_Stream; Block : in Storage_Block; Process : not null access procedure (Data : out IO_Block_Type)) is abstract; -- Allocate a new block and return the block number in `Block`. procedure Allocate (Stream : in out Wallet_Stream; Kind : in Block_Kind; Block : out Storage_Block) is abstract; -- Release the block number. procedure Release (Stream : in out Wallet_Stream; Block : in Storage_Block) is abstract; -- Close the wallet stream and release any resource. procedure Close (Stream : in out Wallet_Stream) is abstract; -- Set some header data in the keystore file. procedure Set_Header_Data (Stream : in out Wallet_Stream; Index : in Header_Slot_Index_Type; Kind : in Header_Slot_Type; Data : in Ada.Streams.Stream_Element_Array) is abstract; -- Get the header data information from the keystore file. procedure Get_Header_Data (Stream : in out Wallet_Stream; Index : in Header_Slot_Index_Type; Kind : out Header_Slot_Type; Data : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is abstract; -- Read the block from the wallet IO stream and decrypt the block content using -- the decipher object. The decrypted content is stored in the marshaller which -- is ready to read the start of the block header. procedure Read (Stream : in out Wallet_Stream'Class; Decipher : in out Util.Encoders.AES.Decoder; Sign : in Secret_Key; Decrypt_Size : out Block_Index; Into : in out Buffers.Storage_Buffer); -- Write the block in the wallet IO stream. Encrypt the block data using the -- cipher object. Sign the header and encrypted data using HMAC-256 and the -- given signature. procedure Write (Stream : in out Wallet_Stream'Class; Encrypt_Size : in Block_Index := BT_DATA_LENGTH; Cipher : in out Util.Encoders.AES.Encoder; Sign : in Secret_Key; From : in out Buffers.Storage_Buffer) with Pre => Encrypt_Size mod 16 = 0 and Encrypt_Size <= BT_DATA_LENGTH; end Keystore.IO;
gcc-gcc-7_3_0-release/gcc/ada/g-dynhta.ads
best08618/asylo
7
27605
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . D Y N A M I C _ H T A B L E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Hash table searching routines -- This package contains three separate packages. The Simple_HTable package -- provides a very simple abstraction that associates one element to one key -- value and takes care of all allocations automatically using the heap. The -- Static_HTable package provides a more complex interface that allows full -- control over allocation. The Load_Factor_HTable package provides a more -- complex abstraction where collisions are resolved by chaining, and the -- table grows by a percentage after the load factor has been exceeded. -- This package provides a facility similar to that of GNAT.HTable, except -- that this package declares types that can be used to define dynamic -- instances of hash tables, while instantiations in GNAT.HTable creates a -- single instance of the hash table. -- Note that this interface should remain synchronized with those in -- GNAT.HTable to keep as much coherency as possible between these two -- related units. private with Ada.Finalization; package GNAT.Dynamic_HTables is ------------------- -- Static_HTable -- ------------------- -- A low-level Hash-Table abstraction, not as easy to instantiate as -- Simple_HTable. This mirrors the interface of GNAT.HTable.Static_HTable, -- but does require dynamic allocation (since we allow multiple instances -- of the table). The model is that each Element contains its own Key that -- can be retrieved by Get_Key. Furthermore, Element provides a link that -- can be used by the HTable for linking elements with same hash codes: -- Element -- +-------------------+ -- | Key | -- +-------------------+ -- : other data : -- +-------------------+ -- | Next Elmt | -- +-------------------+ generic type Header_Num is range <>; -- An integer type indicating the number and range of hash headers type Element (<>) is limited private; -- The type of element to be stored type Elmt_Ptr is private; -- The type used to reference an element (will usually be an access -- type, but could be some other form of type such as an integer type). Null_Ptr : Elmt_Ptr; -- The null value of the Elmt_Ptr type with procedure Set_Next (E : Elmt_Ptr; Next : Elmt_Ptr); with function Next (E : Elmt_Ptr) return Elmt_Ptr; -- The type must provide an internal link for the sake of the -- staticness of the HTable. type Key is limited private; with function Get_Key (E : Elmt_Ptr) return Key; with function Hash (F : Key) return Header_Num; with function Equal (F1, F2 : Key) return Boolean; package Static_HTable is type Instance is private; Nil : constant Instance; procedure Reset (T : in out Instance); -- Resets the hash table by releasing all memory associated with -- it. The hash table can safely be reused after this call. For the -- most common case where Elmt_Ptr is an access type, and Null_Ptr is -- null, this is only needed if the same table is reused in a new -- context. If Elmt_Ptr is other than an access type, or Null_Ptr is -- other than null, then Reset must be called before the first use of -- the hash table. procedure Set (T : in out Instance; E : Elmt_Ptr); -- Insert the element pointer in the HTable function Get (T : Instance; K : Key) return Elmt_Ptr; -- Returns the latest inserted element pointer with the given Key -- or null if none. procedure Remove (T : Instance; K : Key); -- Removes the latest inserted element pointer associated with the -- given key if any, does nothing if none. function Get_First (T : Instance) return Elmt_Ptr; -- Returns Null_Ptr if the Htable is empty, otherwise returns one -- non specified element. There is no guarantee that 2 calls to this -- function will return the same element. function Get_Next (T : Instance) return Elmt_Ptr; -- Returns a non-specified element that has not been returned by the -- same function since the last call to Get_First or Null_Ptr if -- there is no such element or Get_First has never been called. If -- there is no call to 'Set' in between Get_Next calls, all the -- elements of the Htable will be traversed. private type Instance_Data; type Instance is access all Instance_Data; Nil : constant Instance := null; end Static_HTable; ------------------- -- Simple_HTable -- ------------------- -- A simple hash table abstraction, easy to instantiate, easy to use. -- The table associates one element to one key with the procedure Set. -- Get retrieves the Element stored for a given Key. The efficiency of -- retrieval is function of the size of the Table parameterized by -- Header_Num and the hashing function Hash. generic type Header_Num is range <>; -- An integer type indicating the number and range of hash headers type Element is private; -- The type of element to be stored No_Element : Element; -- The object that is returned by Get when no element has been set for -- a given key type Key is private; with function Hash (F : Key) return Header_Num; with function Equal (F1, F2 : Key) return Boolean; package Simple_HTable is type Instance is private; Nil : constant Instance; procedure Set (T : in out Instance; K : Key; E : Element); -- Associates an element with a given key. Overrides any previously -- associated element. procedure Reset (T : in out Instance); -- Releases all memory associated with the table. The table can be -- reused after this call (it is automatically allocated on the first -- access to the table). function Get (T : Instance; K : Key) return Element; -- Returns the Element associated with a key or No_Element if the -- given key has not associated element procedure Remove (T : Instance; K : Key); -- Removes the latest inserted element pointer associated with the -- given key if any, does nothing if none. function Get_First (T : Instance) return Element; -- Returns No_Element if the Htable is empty, otherwise returns one -- non specified element. There is no guarantee that two calls to this -- function will return the same element, if the Htable has been -- modified between the two calls. function Get_Next (T : Instance) return Element; -- Returns a non-specified element that has not been returned by the -- same function since the last call to Get_First or No_Element if -- there is no such element. If there is no call to 'Set' in between -- Get_Next calls, all the elements of the Htable will be traversed. -- To guarantee that all the elements of the Htable will be traversed, -- no modification of the Htable (Set, Reset, Remove) should occur -- between a call to Get_First and subsequent consecutive calls to -- Get_Next, until one of these calls returns No_Element. private type Element_Wrapper; type Elmt_Ptr is access all Element_Wrapper; type Element_Wrapper is record K : Key; E : Element; Next : Elmt_Ptr; end record; procedure Set_Next (E : Elmt_Ptr; Next : Elmt_Ptr); function Next (E : Elmt_Ptr) return Elmt_Ptr; function Get_Key (E : Elmt_Ptr) return Key; package Tab is new Static_HTable (Header_Num => Header_Num, Element => Element_Wrapper, Elmt_Ptr => Elmt_Ptr, Null_Ptr => null, Set_Next => Set_Next, Next => Next, Key => Key, Get_Key => Get_Key, Hash => Hash, Equal => Equal); type Instance is new Tab.Instance; Nil : constant Instance := Instance (Tab.Nil); end Simple_HTable; ------------------------ -- Load_Factor_HTable -- ------------------------ -- A simple hash table abstraction capable of growing once a threshold has -- been exceeded. Collisions are resolved by chaining elements onto lists -- hanging from individual buckets. This implementation does not make any -- effort to minimize the number of necessary rehashes once the table has -- been expanded, hence the term "simple". -- WARNING: This hash table implementation utilizes dynamic allocation. -- Storage reclamation is performed by the hash table. -- WARNING: This hash table implementation is not thread-safe. To achieve -- proper concurrency and synchronization, wrap an instance of a table in -- a protected object. generic type Range_Type is range <>; -- The underlying range of the hash table. Note that this type must be -- large enough to accommodate multiple expansions of the table. type Key_Type is private; type Value_Type is private; -- The types of the (key, value) pair stored in the hash table No_Value : Value_Type; -- A predefined value denoting a non-existent value Initial_Size : Positive; -- The starting size of the hash table. The hash table must contain at -- least one bucket. Growth_Percentage : Positive; -- The amount of increase expressed as a percentage. The hash table must -- grow by at least 1%. To illustrate, a value of 100 will increase the -- table by 100%, effectively doubling its size. Load_Factor : Float; -- The ratio of the elements stored within the hash table divided by the -- current size of the table. This value acts as the growth threshold. -- If exceeded, the hash table is expanded by Growth_Percentage. with function Equal (Left : Key_Type; Right : Key_Type) return Boolean; with function Hash (Key : Key_Type; Size : Positive) return Range_Type; -- Parameter Size denotes the current size of the hash table package Load_Factor_HTable is type Table is tagged limited private; function Current_Size (T : Table) return Positive; -- Obtain the current size of the table function Get (T : Table; Key : Key_Type) return Value_Type; -- Obtain the value associated with a key. This routine returns No_Value -- if the key is not present in the hash table. procedure Remove (T : in out Table; Key : Key_Type); -- Remove the value associated with the given key. This routine has no -- effect if the key is not present in the hash table. procedure Set (T : in out Table; Key : Key_Type; Val : Value_Type); -- Associate a value with a given key. This routine has no effect if the -- the (key, value) pair is already present in the hash table. Note that -- this action may cause the table to grow. private -- The following types model a bucket chain. Note that the key is also -- stored for rehashing purposes. type Element; type Element_Ptr is access all Element; type Element is record Key : Key_Type; Val : Value_Type; Prev : Element_Ptr := null; Next : Element_Ptr := null; end record; No_Element : constant Element_Ptr := null; -- The following types model the buckets of the hash table. Each bucket -- has a dummy head to facilitate insertion and deletion of elements. type Buckets_Array is array (Range_Type range <>) of aliased Element; type Buckets_Array_Ptr is access all Buckets_Array; type Table is new Ada.Finalization.Limited_Controlled with record Buckets : Buckets_Array_Ptr := null; Element_Count : Natural := 0; -- The number of (key, value) pairs stored in the hash table end record; procedure Finalize (T : in out Table); -- Destroy the contents of a hash table by reclaiming all storage used -- by buckets and their respective chains. procedure Initialize (T : in out Table); -- Create a hash table with buckets within the range Range_Type'First .. -- Range_Type'First + Initial_Size - 1. end Load_Factor_HTable; end GNAT.Dynamic_HTables;
src/tests/test_input_lengths.adb
jhumphry/SPARK_NORX
9
22318
-- NORX_Check_Padding -- Ensure that headers and trailers of different lengths are accepted -- and messages of different lengths correctly decrypted (to check padding) -- Copyright (c) 2016-2018, <NAME> - see LICENSE file for details with Ada.Text_IO; use Ada.Text_IO; with System.Storage_Elements; with Interfaces; use Interfaces; procedure Test_Input_Lengths is use NORX_Package; package Storage_Offset_Text_IO is new Ada.Text_IO.Integer_IO(Num => Storage_Offset); use Storage_Offset_Text_IO; function Generate (G : in out Unsigned_64) return Storage_Element is -- xorshift64 generator from: An experimental exploration of Marsaglia's -- xorshift generators, scrambled <NAME> - arXiv 1402.6246v2 M32 : constant := 2685821657736338717; begin G := G xor Shift_Right(G, 12); G := G xor Shift_Left(G, 25); G := G xor Shift_Right(G, 17); return Storage_Element((G * M32) mod Storage_Element'Modulus); end Generate; K : Key_Type; N : Nonce_Type; A, M, Z, C, M2 : Storage_Array(0..Max_Size-1); T : Tag_Type; Valid : Boolean; G : Unsigned_64 := 314_159_265; begin -- Setting up example input data for I in K'Range loop K(I) := Generate(G); end loop; for I in N'Range loop N(I) := Generate(G); end loop; for I in A'Range loop A(I) := Generate(G); M(I) := Generate(G); Z(I) := Generate(G); end loop; -- Testing different header lengths Put("Testing header lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..I-1), M => M(0..Other_Size-1), Z => Z(0..Other_Size-1), C => C(0..Other_Size-1), T => T); AEADDec(K => K, N => N, A => A(0..I-1), C => C(0..Other_Size-1), Z => Z(0..Other_Size-1), T => T, M => M2(0..Other_Size-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with header size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..Other_Size-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for header size:"); Put(I, Width=>0); New_Line; end if; end loop; -- Testing different message lengths Put("Testing message lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..Other_Size-1), M => M(0..I-1), Z => Z(0..Other_Size-1), C => C(0..I-1), T => T); AEADDec(K => K, N => N, A => A(0..Other_Size-1), C => C(0..I-1), Z => Z(0..Other_Size-1), T => T, M => M2(0..I-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with message size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..I-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for message size:"); Put(I, Width=>0); New_Line; end if; end loop; -- Testing different trailer lengths Put("Testing trailer lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..Other_Size-1), M => M(0..Other_Size-1), Z => Z(0..I-1), C => C(0..Other_Size-1), T => T); AEADDec(K => K, N => N, A => A(0..Other_Size-1), C => C(0..Other_Size-1), Z => Z(0..I-1), T => T, M => M2(0..Other_Size-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with trailer size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..Other_Size-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for trailer size:"); Put(I, Width=>0); New_Line; end if; end loop; New_Line; end Test_Input_Lengths;
grammar/VSLLexer.g4
VegaLib/VSL
0
2873
<filename>grammar/VSLLexer.g4 /// /// Microsoft Public License (Ms-PL) - Copyright (c) 2020-2021 <NAME> /// This file is subject to the terms and conditions of the Microsoft Public License, the text of which can be found in /// the 'LICENSE' file at the root of this repository, or online at <https://opensource.org/licenses/MS-PL>. /// // This is the ANTLR4 lexer grammar for the Vega Shader Language lexer grammar VSLLexer; // Booleans BOOLEAN_LITERAL : 'true' | 'false' ; // Keywords KW_BIND : 'bind' ; KW_BREAK : 'break' ; KW_CONTINUE : 'continue' ; KW_DISCARD : 'discard' ; KW_ELIF : 'elif' ; KW_ELSE : 'else' ; KW_FLAT : 'flat' ; KW_FOR : 'for' ; KW_IF : 'if' ; KW_IN : 'in' ; KW_LOCAL : 'local' ; KW_OUT : 'out' ; KW_RETURN : 'return' ; KW_SHADER : '@shader' ; KW_PASSINPUT : 'passinput' ; KW_STRUCT : '@struct' ; KW_UNIFORM : 'uniform' ; // Number literals INTEGER_LITERAL : '-'? DecimalLiteral [uU]? | HexLiteral ; FLOAT_LITERAL : '-'? DecimalLiteral ExponentPart | '-'? DecimalLiteral '.' DecimalLiteral? ExponentPart? ; fragment DecimalLiteral : DigitChar+ ; fragment HexLiteral : '0x' HexDigitChar+ ; fragment ExponentPart : [eE] ('-'|'+')? DigitChar+ ; // Identifiers, valid for variable and type names, and built-ins IDENTIFIER : (AlphaChar|'_') (AlnumChar|'_')* | '$' AlphaChar+ ; // Punctuation ATSIGN : '@' ; COLON : ':' ; COMMA : ',' ; LBRACE : '{' ; LBRACKET : '[' ; LPAREN : '(' ; PERIOD : '.' ; QMARK : '?' ; RBRACE : '}' ; RBRACKET : ']' ; RPAREN : ')' ; SEMICOLON : ';' ; // Operators OP_ADD : '+' ; OP_ASSIGN : '='; OP_ASN_ADD : '+=' ; OP_ASN_BAND : '&=' ; OP_ASN_BOR : '|=' ; OP_ASN_BXOR : '^=' ; OP_ASN_DIV : '/=' ; OP_ASN_LSH : '<<=' ; OP_ASN_MOD : '%=' ; OP_ASN_MUL : '*=' ; OP_ASN_RSH : '>>=' ; OP_ASN_SUB : '-=' ; OP_BAND : '&' ; OP_BNOT : '~' ; OP_BOR : '|' ; OP_BXOR : '^' ; OP_DIV : '/' ; OP_EQUAL : '==' ; OP_GEQUAL : '>=' ; OP_GREATER : '>' ; OP_LAND : '&&' ; OP_LEQUAL : '<=' ; OP_LESS : '<' ; OP_LNOT : '!' ; OP_LOR : '||' ; OP_LSHIFT : '<<' ; OP_MOD : '%' ; OP_MUL : '*' ; OP_NEQUAL : '!=' ; OP_RSHIFT : '>>' ; OP_SUB : '-' ; // Whitespace and comments (ignore to hidden channel) WS : [ \t\r\n\u000C]+ -> channel(HIDDEN) ; COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; LINE_COMMENT : '//' ~[\r\n]* (('\r'? '\n') | EOF) -> channel(HIDDEN) ; // Character types fragment AlphaChar : [a-zA-Z] ; fragment DigitChar : [0-9] ; fragment AlnumChar : AlphaChar | DigitChar ; fragment HexDigitChar : [a-fA-F0-9] ;
oeis/336/A336410.asm
neoneye/loda-programs
11
179194
<reponame>neoneye/loda-programs ; A336410: Numbers k such that prime(k) - oc(k) = 2, where oc(k) is the greatest odd composite < prime(k). ; Submitted by <NAME> ; 1,3,5,6,8,9,11,12,13,15,16,18,19,20,21,22,24,26,27,28,29,31,33,34,35,36,37,39,41,43,44,45,47,48,50,51,52,53,55,56,58,59,60,62,63,64,65,67,68,69,70,71,72,73,74,75,76,77,79,81,82,83,84,85,87,88 seq $0,136799 ; Last term in a sequence of at least 3 consecutive composite integers. sub $0,3 seq $0,230980 ; Number of primes <= n, starting at n=0. sub $0,3
MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.nasm
crazyinsanejames/CloverBootloader
3,861
166173
<reponame>crazyinsanejames/CloverBootloader ;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; SetMem.Asm ; ; Abstract: ; ; SetMem function ; ; Notes: ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; VOID * ; InternalMemSetMem( ; IN VOID *Buffer, ; IN UINTN Count, ; IN UINT8 Value ; ) ;------------------------------------------------------------------------------ global ASM_PFX(InternalMemSetMem) ASM_PFX(InternalMemSetMem): push edi mov ecx, [esp + 12] mov al, [esp + 16] mov ah, al shrd edx, eax, 16 shld eax, edx, 16 mov edx, ecx mov edi, [esp + 8] shr ecx, 2 rep stosd mov ecx, edx and ecx, 3 rep stosb mov eax, [esp + 8] pop edi ret
models/tests/test05.als
transclosure/Amalgam
4
2306
<reponame>transclosure/Amalgam<gh_stars>1-10 module tests/test sig S {} check { no S => no (iden-Int->Int) } for 3 S expect 0
data/mapObjects/CeladonMart3F.asm
AmateurPanda92/pokemon-rby-dx
9
244662
<gh_stars>1-10 CeladonMart3F_Object: db $f ; border block db 3 ; warps warp 12, 1, 0, CELADON_MART_4F warp 16, 1, 1, CELADON_MART_2F warp 1, 1, 0, CELADON_MART_ELEVATOR db 12 ; signs sign 2, 4, 6 ; CeladonMart3Text6 sign 3, 4, 7 ; CeladonMart3Text7 sign 5, 4, 8 ; CeladonMart3Text8 sign 6, 4, 9 ; CeladonMart3Text9 sign 2, 6, 10 ; CeladonMart3Text10 sign 3, 6, 11 ; CeladonMart3Text11 sign 5, 6, 12 ; CeladonMart3Text12 sign 6, 6, 13 ; CeladonMart3Text13 sign 14, 1, 14 ; CeladonMart3Text14 sign 4, 1, 15 ; CeladonMart3Text15 sign 6, 1, 16 ; CeladonMart3Text16 sign 10, 1, 17 ; CeladonMart3Text17 db 5 ; objects object SPRITE_MART_GUY, 16, 5, STAY, NONE, 1 ; person object SPRITE_GAMEBOY_KID_COPY, 11, 6, STAY, RIGHT, 2 ; person object SPRITE_GAMEBOY_KID_COPY, 7, 2, STAY, DOWN, 3 ; person object SPRITE_GAMEBOY_KID_COPY, 8, 2, STAY, DOWN, 4 ; person object SPRITE_YOUNG_BOY, 2, 5, STAY, UP, 5 ; person ; warp-to warp_to 12, 1, CELADON_MART_3F_WIDTH ; CELADON_MART_4F warp_to 16, 1, CELADON_MART_3F_WIDTH ; CELADON_MART_2F warp_to 1, 1, CELADON_MART_3F_WIDTH ; CELADON_MART_ELEVATOR
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccixp_ulonglong2ds.asm
jpoikela/z88dk
640
172766
<reponame>jpoikela/z88dk<filename>libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccixp_ulonglong2ds.asm ; float __ulonglong2fs (unsigned long long sl) SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sdccixp_ulonglong2ds EXTERN l_load_64_dehldehl_mbc, am48_double64u, cm48_sdccixp_m482d cm48_sdccixp_ulonglong2ds: ; unsigned long long to double ; ; enter : stack = unsigned long long sl, ret ; ; exit : dehl = sdcc_float(sl) ; ; uses : af, bc, de, hl, bc', de', hl' ld hl,2 add hl,sp ld c,l ld b,h call l_load_64_dehldehl_mbc ; dehl'dehl = 64-bit s1 call am48_double64u jp cm48_sdccixp_m482d
restli-server/src/main/antlr/com/linkedin/restli/server/config/ResourceMethodKey.g4
haroldl/rest.li
1,682
4518
grammar ResourceMethodKey; @header { package com.linkedin.restli.server.config; } key : ( restResource | '*' ) '.' ( operation | '*' ); restResource : Name ( '-' Name )* ( ':' Name )*; operation : simpleOp | complex; simpleOp : 'GET' | 'BATCH_GET' | 'CREATE' | 'BATCH_CREATE' | 'PARTIAL_UPDATE' | 'UPDATE' | 'BATCH_UPDATE' | 'DELETE' | 'BATCH_PARTIAL_UPDATE' | 'BATCH_DELETE' | 'GET_ALL' | 'OPTIONS'; complex : complexOp '-' ( Name | '*' ); complexOp : 'FINDER' | 'ACTION' | 'BATCH_FINDER'; Name : [a-zA-Z_0-9]+;
src/player.ads
drm343/Space-War-3000
2
24587
<gh_stars>1-10 with Ada.Strings.Unbounded; with Planet; with Rule; use Rule; package Player is type Object is tagged private; function Build (Race : String; Good_Ability : Good_Type; Bad_Ability : Bad_Type; Victory_Condition : Victory; Homeworld : Planet.Object) return Object; private package SU renames Ada.Strings.Unbounded; type Object is tagged record Race : SU.Unbounded_String; Good_Ability : Good_Type; Bad_Ability : Bad_Type; Victory_Condition : Victory; Owner_Planets : Planet.Vector; Homeworld : Planet.Object; end record; end Player;
samples/client/petstore/ada/src/samples.ads
derBiggi/swagger-codegen
14,570
19271
<filename>samples/client/petstore/ada/src/samples.ads -- Swagger Petstore -- This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special_key` to test the authorization filters. -- ------------ EDIT NOTE ------------ -- This file was generated with swagger-codegen. You can modify it to implement -- the server. After you modify this file, you should add the following line -- to the .swagger-codegen-ignore file: -- -- src/samples-petstore.ads -- -- Then, you can drop this edit note comment. -- ------------ EDIT NOTE ------------ package Samples is end Samples;
examples/timer/main.adb
ekoeppen/STM32_Generic_Ada_Drivers
1
23807
<gh_stars>1-10 with Ada.Real_Time; use Ada.Real_Time; with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control; with STM32GD.Board; use STM32GD.Board; with Peripherals; procedure Main is Next_Release : Time := Clock; Period : constant Time_Span := Milliseconds (1000); Counter : Natural := 0; begin Init; Peripherals.Timer.Init; Text_IO.Put_Line ("--------------------------------------------------------------------------"); Text_IO.Put_Line ("Main task starting"); Peripherals.Timer.Every (Milliseconds (200), STM32GD.Board.LED.Toggle'Access); -- Peripherals.Timer.After (Milliseconds (5000), STM32GD.Board.LED2.Toggle'Access); while True loop Next_Release := Next_Release + Period; delay until Next_Release; Text_IO.Put_Integer (Counter); Text_IO.New_Line; Counter := Counter + 1; end loop; end Main;
dbi_clients_src/pin/pin-3.6-97554-g31f0a167d-gcc-linux/source/tools/InlinedFuncsOpt/inlined_funcs_ia32.asm
DigitalAlchemist/fuzzwatch
326
173580
; BEGIN_LEGAL ; Intel Open Source License ; ; Copyright (c) 2002-2017 Intel Corporation. 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 Intel Corporation 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 INTEL OR ; ITS 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. ; END_LEGAL PUBLIC IfProc1 PUBLIC IfProc2 PUBLIC IfProc3 PUBLIC IfProc4 PUBLIC IfProc5 PUBLIC IfProc6 PUBLIC IfProc7 PUBLIC IfProc8 PUBLIC IfProc9 PUBLIC IfProc10 PUBLIC IfProc11 PUBLIC IfProc12 PUBLIC IfProc13 PUBLIC IfProc14 PUBLIC IfProc15 PUBLIC IfProc16 PUBLIC IfProc17 PUBLIC IfProc18 PUBLIC IfProc19 PUBLIC IfProc20 PUBLIC IfProc21 PUBLIC IfProc22 PUBLIC IfProc23 PUBLIC IfProc24 PUBLIC IfProc25 PUBLIC IfProc26 PUBLIC IfProc27 PUBLIC IfProc28 PUBLIC IfProc29 PUBLIC IfProc30 PUBLIC IfProc31 PUBLIC IfProc32 PUBLIC IfProc33 PUBLIC IfProc34 PUBLIC IfProc35 PUBLIC IfProc36 PUBLIC IfProc37 PUBLIC IfProc38 PUBLIC IfProc39 PUBLIC IfProc40 .686 .model flat, c .XMM .data extern globVal:dword .code IfProc1 PROC mov edx, 1 xor eax, eax cmp edx, ecx setz al ret IfProc1 ENDP IfProc2 PROC mov edx, 1 xor eax, eax cmp edx, ecx setz al ret IfProc2 ENDP IfProc3 PROC lea edx, globVal mov edx, dword ptr [edx] xor eax, eax cmp edx, ecx setz al ret IfProc3 ENDP IfProc4 PROC lea eax, globVal mov edx, dword ptr [eax] xor eax, eax cmp ecx, edx setz al ret IfProc4 ENDP IfProc5 PROC xor eax, eax cmp edx, ecx setz al ret IfProc5 ENDP IfProc6 PROC xor eax, eax cmp dl, cl setz al ret IfProc6 ENDP IfProc7 PROC cmp edx, ecx setz al movzx eax, al ret IfProc7 ENDP IfProc8 PROC lea ecx, dword ptr [ecx+70h] and ecx, 0fh mov eax, ecx ret IfProc8 ENDP IfProc9 PROC mov ecx, eax lea edx, globVal mov eax, dword ptr [edx] xor ecx, ecx ret IfProc9 ENDP IfProc10 PROC xor eax, eax cmp dl, cl setb al ret IfProc10 ENDP IfProc11 PROC cmp edx, ecx setb al movzx eax, al ret IfProc11 ENDP IfProc12 PROC xor eax, eax cmp dl, cl setbe al ret IfProc12 ENDP IfProc13 PROC cmp edx, ecx setbe al movzx eax, al ret IfProc13 ENDP IfProc14 PROC xor eax, eax cmp dl, cl setnl al ret IfProc14 ENDP IfProc15 PROC cmp edx, ecx setnl al movzx eax, al ret IfProc15 ENDP IfProc16 PROC xor eax, eax cmp dl, cl setl al ret IfProc16 ENDP IfProc17 PROC cmp edx, ecx setl al movzx eax, al ret IfProc17 ENDP IfProc18 PROC xor eax, eax cmp dl, cl setle al ret IfProc18 ENDP IfProc19 PROC cmp edx, ecx setle al movzx eax, al ret IfProc19 ENDP IfProc20 PROC xor eax, eax cmp dl, cl setnb al ret IfProc20 ENDP IfProc21 PROC cmp edx, ecx setnb al movzx eax, al ret IfProc21 ENDP IfProc22 PROC xor eax, eax cmp dl, cl setnbe al ret IfProc22 ENDP IfProc23 PROC cmp edx, ecx setnbe al movzx eax, al ret IfProc23 ENDP IfProc24 PROC xor eax, eax cmp dl, cl setnle al ret IfProc24 ENDP IfProc25 PROC cmp edx, ecx setnle al movzx eax, al ret IfProc25 ENDP IfProc26 PROC xor eax, eax add dl, cl seto al ret IfProc26 ENDP IfProc27 PROC add dl, cl seto al movzx eax, al ret IfProc27 ENDP IfProc28 PROC xor eax, eax add dl, cl setno al ret IfProc28 ENDP IfProc29 PROC add dl, cl setno al movzx eax, al ret IfProc29 ENDP IfProc30 PROC xor eax, eax add dl, cl setp al ret IfProc30 ENDP IfProc31 PROC add dl, cl setp al movzx eax, al ret IfProc31 ENDP IfProc32 PROC xor eax, eax add dl, cl setnp al ret IfProc32 ENDP IfProc33 PROC add dl, cl setnp al movzx eax, al ret IfProc33 ENDP IfProc34 PROC xor eax, eax add dl, cl sets al ret IfProc34 ENDP IfProc35 PROC add dl, cl sets al movzx eax, al ret IfProc35 ENDP IfProc36 PROC xor eax, eax add dl, cl setns al ret IfProc36 ENDP IfProc37 PROC add dl, cl setns al movzx eax, al ret IfProc37 ENDP IfProc38 PROC xor eax, eax add dl, cl setnz al ret IfProc38 ENDP IfProc39 PROC add dl, cl setnz al movzx eax, al ret IfProc39 ENDP IfProc40 PROC mov eax, 01h xor eax, eax cmp eax, 01h setz al ret IfProc40 ENDP end
test/Succeed/AnonymousImport.agda
shlevy/agda
1,989
14383
<gh_stars>1000+ module AnonymousImport where open import Common.IO as _ open import Common.Unit as _ main : IO Unit main = putStrLn ""
test/Succeed/Issue498b.agda
shlevy/agda
1,989
6826
<filename>test/Succeed/Issue498b.agda module Issue498b where record ⊤ : Set where constructor tt postulate U : Set → Set pr : ∀ {A} → A → U A _*_ : ∀ {A B} → U A → (A → U B) → U B module M (I : Set)(J : I → Set)(K : (i : I)(j : J i) → Set) where data D (P : I → Set) : I → Set where r : ∀ {i} → P i → D P i d : (i : I)(j : J i) (f : K i j → D P i) → D P i module N (e : (i : I)(j : J i) → U (K i j)) where du : ∀ {P}{i : I} → D P i → U (P i) du (r p) = pr p du (d i j f) = e i j * λ k → du (f k) data j : ⊤ → Set where cj : j _ k : (i : ⊤)(j : j i) → Set k _ j = ⊤ e : (i : ⊤)(j : j i) → U (k i j) e tt cj = pr tt open M ⊤ j k open N e
oeis/077/A077037.asm
neoneye/loda-programs
11
171296
<filename>oeis/077/A077037.asm ; A077037: Largest prime < n^3. ; Submitted by <NAME>(s3) ; 7,23,61,113,211,337,509,727,997,1327,1723,2179,2741,3373,4093,4909,5827,6857,7993,9257,10639,12163,13807,15619,17573,19681,21943,24379,26993,29789,32749,35933,39301,42863,46649,50651,54869,59281,63997,68917,74077,79493,85159,91121,97327,103813,110587,117643,124991,132647,140603,148873,157457,166363,175601,185189,195103,205357,215983,226943,238321,250043,262139,274609,287491,300761,314423,328481,342989,357883,373231,389003,405221,421847,438967,456529,474547,493027,511997,531383,551363,571783 mov $2,$0 add $2,2 mov $3,$2 pow $2,2 mul $2,$3 lpb $2 mov $3,$2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. mul $3,$2 sub $0,$3 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$2 add $0,1
oeis/348/A348030.asm
neoneye/loda-programs
11
12134
<filename>oeis/348/A348030.asm ; A348030: a(n) = A003968(n) - n, where A003968 is multiplicative with a(p^e) = p*(p+1)^(e-1). ; Submitted by <NAME> ; 0,0,0,2,0,0,0,10,3,0,0,6,0,0,0,38,0,6,0,10,0,0,0,30,5,0,21,14,0,0,0,130,0,0,0,36,0,0,0,50,0,0,0,22,15,0,0,114,7,10,0,26,0,42,0,70,0,0,0,30,0,0,21,422,0,0,0,34,0,0,0,144,0,0,15,38,0,0,0,190,111,0,0,42,0,0,0,110,0,30,0,46,0,0,0,390,0,14,33,80 mov $2,$0 seq $2,3968 ; Möbius transform of A003959. sub $2,$0 mov $0,$2 sub $0,1
dev/smartdrv/popup.asm
minblock/msdos
0
88851
;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ include bambi.inc PUBLIC warning_pop_up PUBLIC warning_pop_up_DOS PUBLIC shut_down_pop_up extrn popup1 :byte extrn popup2 :byte extrn reboot_when_ok :byte extrn startup_info :byte WARNING_DIALOG_ATTRIBUTES equ 7 ;white on black (usually!) ROM_SET_CURSOR equ 2 ROM_GET_CURSOR equ 3 ROM_WRITE_ACHAR equ 09h ROM_WRITE_CHAR equ 0ah ROM_TELETYPE equ 0eh ROM_GET_VIDEO_MODE equ 0fh zseg segment public 'CODE' assume cs:zseg assume ds:nothing lastscancode db 0 ;scancode of last keypress popupsaveint9 dd ? user_response db ? popupint9handler proc near push ax in al,60h ;get the scancode mov byte ptr cs:lastscancode,al ;;; The following code was taken from the swapper ;;; it EOIs the int9 effectively "swallowing" the keys in al,61h ;read in code mov ah,al ;save it or al,80h out 61h,al xchg ah,al out 61h,al cli mov al,20h ;need to output the eoi out 20h,al sti pop ax ;restore iret popupint9handler endp grab_the_keyboard proc near push es push bx xor ax,ax mov es,ax cli mov ax,es:[4*9] mov bx,es:[4*9+2] mov word ptr popupsaveint9[0],ax mov word ptr popupsaveint9[2],bx mov ax,offset cs:popupint9handler mov es:[4*9],ax mov es:[4*9+2],cs sti pop bx pop es ret grab_the_keyboard endp restore_the_keyboard proc near push ax push bx push es xor ax,ax mov es,ax mov ax,word ptr popupsaveint9[0] mov bx,word ptr popupsaveint9[2] cli mov es:[4*9],ax mov es:[4*9+2],bx sti mov cs:lastscancode,0 pop es pop bx pop ax ret restore_the_keyboard endp ; ; INPUT ; CS:BP -> dialog template ; dh:dl -> y,x ; bh = display page ; bl = color attributes ; al = drive letter replaceable parameter ; OUTPUT ; none ; USES ; ALL except DS,ES ; BP is modified! ; NOTES ; Text wraps at single NULL, ends at '$' ; save_al db 0 query_cursor_locx db 0 query_cursor_locy db 0 draw_dialog proc near mov cs:save_al,al display_loop: mov ah,ROM_SET_CURSOR int 10h inc dl mov al,cs:[bp] cmp al,'$' jz done_displaying cmp al,'&' jne check_replace mov cs:query_cursor_locx,dl mov cs:query_cursor_locy,dh mov al,' ' jmp short continue_line check_replace: cmp al,'@' jne check_wrap mov al,cs:save_al add al,'A' jmp short continue_line check_wrap: cmp al,0 jne continue_line inc dh ;wrap to new line xor dl,dl continue_line: mov cx,1 mov ah,ROM_WRITE_ACHAR ;display a message int 10h inc bp jmp short display_loop done_displaying: mov dl,cs:query_cursor_locx mov dh,cs:query_cursor_locy mov ah,ROM_SET_CURSOR int 10h ret draw_dialog endp setup_video_access proc near push ax mov ah,ROM_GET_VIDEO_MODE ; get video page into bh int 10h mov ah,ROM_GET_CURSOR ; get cursor location int 10h mov cs:save_starting_cursorx,dl mov cs:save_starting_cursory,dh pop ax ret setup_video_access endp finish_video_access proc near mov dl,cs:save_starting_cursorx ; put the cursor back mov dh,cs:save_starting_cursory mov ah,ROM_SET_CURSOR int 10h ret finish_video_access endp ; ; INPUT ; al = drive letter which has error ; OUTPUT ; al = ASCIICODE_RETRY => retry the operation ; al = ASCIICODE_IGNORE => ignore the error ; save_starting_cursorx db 0 save_starting_cursory db 0 warning_pop_up proc near ;the int2f initialization will point this to warning_pop_up_DOS below, ;vxd load will change this to the vxd's windows handler push es push di les di,cs:startup_info.SIS_Reference_Data call DWORD PTR es:[di] pop di pop es mov al,ASCIICODE_RETRY ;retry is only real option ret warning_pop_up endp warning_pop_up_DOS proc far push bx push cx push dx push si push di push bp push es push ax call set_windows_focus pop ax ;;; before we can display to the screen ;;; we need to get the active display page ;;; which is retuned in bh from get_video_mode call setup_video_access xor dx,dx mov bl,WARNING_DIALOG_ATTRIBUTES ;color of dialog mov bp,offset cs:popup1 ;al still has drive letter push bx ; save display page for later call draw_dialog ;;; BUG BUG BUG BUG BUG BUG BUG ;;; this code continually scans the keyboard port waiting for ;;; the retry or ignore scan codes. This is evil and satanic, but ;;; we MUST get user input, and this is the only way that works ;;; in diverse environments like windows. It is concievable that ;;; this could break and cause a hang. But it will DEFINITELY ;;; cause a hang if we don't do it in many cases. So, we stomp ;;; on eggs! CODE REVIEW ME ;;; NOTE that the int 9 handler is still eating the keys, ;;; and is also polling the port so we won't miss the key ;;; call grab_the_keyboard waitforkey: ; in al,60h ;get the scancode ; cmp al,SCANCODE_RETRY ; je key_valid ;;;bug bug took out check for ignore ; cmp al,SCANCODE_IGNORE ; je key_valid mov al,cs:lastscancode cmp al,SCANCODE_RETRY jne waitforkey ; cmp al,SCANCODE_IGNORE ; jne waitforkey key_valid: call restore_the_keyboard mov ah,ROM_WRITE_CHAR cmp al,SCANCODE_RETRY jne was_ignore mov al,ASCIICODE_RETRY jmp short was_retry was_ignore: mov al,ASCIICODE_IGNORE was_retry: mov cs:user_response,al pop bx ; restore display page push bx ; but still save till later mov cx,1 ; just display one character int 10h pop bx ; restore display page mov bl,0 ; display out same dialog, mov bp,offset cs:popup1 ; only use black-on-black xor dx,dx call draw_dialog call finish_video_access pop es pop bp pop di pop si pop dx pop cx pop bx cmp cs:reboot_when_ok,0 je not_reboot ;hack--if the shut-down popup is up call shut_down_pop_up ;we should put it back up so ;the user won't be confused if he ;hits ctrl+alt+delete, then ;pops out the floppy, gets this ;message, replaces the floppy ;but the message is erased not_reboot: mov al,cs:user_response ret warning_pop_up_DOS endp shut_down_pop_up proc near push ax push bx push cx push dx push si push di push bp push es call setup_video_access xor dx,dx mov bl,WARNING_DIALOG_ATTRIBUTES ;color of dialog mov bp,offset cs:popup2 call draw_dialog call finish_video_access pop es pop bp pop di pop si pop dx pop cx pop bx pop ax ret shut_down_pop_up endp set_windows_focus proc near if 0 ;;;superceded by code from msbio1. This code suggested by ralphl, ;;;msbio code suggested by aaronr mov ax,1600h int 2fh ; get win386 version cmp ax,3 ; Q: is it 3.00? jne use_31way ; N: Do 3.1 call mov ax,1681h int 2fh ; enter a critical section ; ; point int 24 vector at an IRET instruction ; push ds xor ax,ax mov ds,ax push word ptr ds:[24h*4] push word ptr ds:[24h*4+2] mov word ptr ds:[24h*4],offset iretinstruction mov word ptr ds:[24h*4+2],cs int 24h pop word ptr ds:[24h*4+2] pop word ptr ds:[24h*4] pop ds mov ax,1682h int 2fh ;exit critical section ret use_31way: mov ax,168Bh xor bx,bx int 2fh endif push di push es push bx push ax xor di,di mov es,di mov bx,0015h ;Device ID of DOSMGR device mov ax,1684h ;Get API entry point int 2fh mov ax,es or ax,di jz Skip ; ;Here, es:di is address of API routine. Set up stack frame to simulate a call ; push cs ;push return segment mov ax,OFFSET Skip push ax ;push return offset push es push di ;API far call address mov ax,1 ;SetFocus function number retf ;do the call Skip: pop ax pop bx pop es pop di ret ret iretinstruction: iret set_windows_focus endp zseg ends end 
src/framework/aunit-test_cases-simple_main_generic.adb
persan/AUnit-addons
0
29342
with AUnit.Test_Suites; with AUnit.Test_Suites.Simple_Main_Generic; procedure AUnit.Test_Cases.Simple_Main_Generic is use AUnit.Test_Suites; function Suite return AUnit.Test_Suites.Access_Test_Suite is Result : Access_Test_Suite; pragma Warnings (Off); begin Result := new Test_Suite; Add_Test (Result, new Test_Case); return Result; end Suite; procedure Run is new AUnit.Test_Suites.Simple_Main_Generic (Suite); begin Run; end AUnit.Test_Cases.Simple_Main_Generic;
llvm-gcc-4.2-2.9/gcc/ada/a-elchha.adb
vidkidz/crossbridge
1
4285
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . E X C E P T I O N S . L A S T _ C H A N C E _ H A N D L E R -- -- -- -- B o d y -- -- -- -- Copyright (C) 2003-2005, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Default version for most targets with System.Standard_Library; use System.Standard_Library; -- Used for Adafinal with System.Soft_Links; -- Used for Task_Termination_Handler -- Task_Termination_NT procedure Ada.Exceptions.Last_Chance_Handler (Except : Exception_Occurrence) is procedure Unhandled_Terminate; pragma No_Return (Unhandled_Terminate); pragma Import (C, Unhandled_Terminate, "__gnat_unhandled_terminate"); -- Perform system dependent shutdown code function Exception_Message_Length (X : Exception_Occurrence) return Natural; pragma Import (Ada, Exception_Message_Length, "__gnat_exception_msg_len"); procedure Append_Info_Exception_Message (X : Exception_Occurrence; Info : in out String; Ptr : in out Natural); pragma Import (Ada, Append_Info_Exception_Message, "__gnat_append_info_e_msg"); procedure Append_Info_Exception_Information (X : Exception_Occurrence; Info : in out String; Ptr : in out Natural); pragma Import (Ada, Append_Info_Exception_Information, "__gnat_append_info_e_info"); procedure To_Stderr (S : String); pragma Import (Ada, To_Stderr, "__gnat_to_stderr"); -- Little routine to output string to stderr Ptr : Natural := 0; Nobuf : String (1 .. 0); Nline : constant String := String'(1 => ASCII.LF); -- Convenient shortcut begin -- Do not execute any task termination code when shutting down the system. -- The Adafinal procedure would execute the task termination routine for -- normal termination, but we have already executed the task termination -- procedure because of an unhandled exception. System.Soft_Links.Task_Termination_Handler := System.Soft_Links.Task_Termination_NT'Access; -- Let's shutdown the runtime now. The rest of the procedure needs to be -- careful not to use anything that would require runtime support. In -- particular, functions returning strings are banned since the sec stack -- is no longer functional. This is particularly important to note for the -- Exception_Information output. We used to allow the tailored version to -- show up here, which turned out to be a bad idea as it might involve a -- traceback decorator the length of which we don't control. Potentially -- heavy primary/secondary stack use or dynamic allocations right before -- this point are not welcome, moving the output before the finalization -- raises order of outputs concerns, and decorators are intended to only -- be used with exception traces, which should have been issued already. System.Standard_Library.Adafinal; -- Check for special case of raising _ABORT_SIGNAL, which is not -- really an exception at all. We recognize this by the fact that -- it is the only exception whose name starts with underscore. if To_Ptr (Except.Id.Full_Name) (1) = '_' then To_Stderr (Nline); To_Stderr ("Execution terminated by abort of environment task"); To_Stderr (Nline); -- If no tracebacks, we print the unhandled exception in the old style -- (i.e. the style used before ZCX was implemented). We do this to -- retain compatibility. elsif Except.Num_Tracebacks = 0 then To_Stderr (Nline); To_Stderr ("raised "); To_Stderr (To_Ptr (Except.Id.Full_Name) (1 .. Except.Id.Name_Length - 1)); if Exception_Message_Length (Except) /= 0 then To_Stderr (" : "); Append_Info_Exception_Message (Except, Nobuf, Ptr); end if; To_Stderr (Nline); -- Traceback exists else To_Stderr (Nline); To_Stderr ("Execution terminated by unhandled exception"); To_Stderr (Nline); Append_Info_Exception_Information (Except, Nobuf, Ptr); end if; Unhandled_Terminate; end Ada.Exceptions.Last_Chance_Handler;
Ada/inc/Problem_71.ads
Tim-Tom/project-euler
0
24141
package Problem_71 is -- Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is -- called a reduced proper fraction. -- If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: -- 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8 -- It can be seen that 2/5 is the fraction immediately to the left of 3/7. -- By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending order of size, -- find the numerator of the fraction immediately to the left of 3/7. procedure Solve; end Problem_71;
src/asis/asis-extensions.adb
My-Colaborations/dynamo
15
25247
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A S I S . E X T E N S I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- ASIS-for-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 -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY 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 ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore -- -- (http://www.<EMAIL>). -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with Asis.Compilation_Units; use Asis.Compilation_Units; with Asis.Declarations; use Asis.Declarations; with Asis.Definitions; use Asis.Definitions; with Asis.Errors; use Asis.Errors; with Asis.Exceptions; use Asis.Exceptions; with Asis.Expressions; use Asis.Expressions; with Asis.Statements; use Asis.Statements; with Asis.Set_Get; use Asis.Set_Get; with A4G.A_Debug; use A4G.A_Debug; with A4G.A_Opt; use A4G.A_Opt; with A4G.A_Sem; use A4G.A_Sem; with A4G.A_Sinput; use A4G.A_Sinput; with A4G.Contt; use A4G.Contt; with A4G.Contt.TT; use A4G.Contt.TT; with A4G.Contt.UT; use A4G.Contt.UT; with A4G.DDA_Aux; use A4G.DDA_Aux; with A4G.Decl_Sem; use A4G.Decl_Sem; with A4G.Asis_Tables; use A4G.Asis_Tables; with A4G.Expr_Sem; use A4G.Expr_Sem; with A4G.GNAT_Int; use A4G.GNAT_Int; with A4G.Mapping; use A4G.Mapping; with A4G.Queries; use A4G.Queries; with A4G.Vcheck; use A4G.Vcheck; with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; with Namet; use Namet; with Nlists; use Nlists; with Output; use Output; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; with Uintp; use Uintp; with Urealp; use Urealp; package body Asis.Extensions is Package_Name : constant String := "Asis.Extensions."; ----------------------- -- Local subprograms -- ----------------------- function Is_Typeless_Subaggregate (Aggr : Node_Id) return Boolean; -- Checks if Aggr represents an inner typeless subaggregate of -- multi-dimensional array aggregate. A caller is responsible for providing -- only nodes that represents components of array aggregates as actuals. function Is_Expanded_Subprogram (N : Node_Id) return Boolean; -- Checks if N corresponds to the spec of an expanded generic -- subprogram. Is needed because Comes_From_Source in this case is -- set OFF (opposite to expanded packages) function Is_Type_Operator (Op_Decl : Asis.Element; Type_Decl : Asis.Element) return Boolean; -- Checks if Op_Decl declares an operator function having a parameter -- or a result of the type Type_Decl (Type_Decl is supposed to be a type -- declaration name). Returns False for a function body if the body has -- the separate spec function Overrides_Type_Operator (Op_Decl : Asis.Element; Type_Decl : Asis.Element) return Boolean; -- Provided that Is_Type_Operator (Op_Decl, Type_Decl) is True (note, -- that this function does not check this, it should be checked by the -- caller), checks if Op_Decl overrides a predefined or inherited -- operator function that exists for Type_Decl function Is_From_Import_Procedure_Pragma (N : Node_Id) return Boolean; -- Checks a specific situation for an identifier specific to a pragma for -- GNAT-specific pragmas Import_Procedure and Import_Valued_Procedure - -- for components of MECHANISM_NAME having the form of A (B). function Get_LF_From_Ureal (U : Ureal) return Long_Long_Float; -- Converts universal real into Long_Float. This is a quick-and-dirty -- solution for extending Static_Expression_Value_Image for real image, -- it may blow up in case if numerator or denominator is too big. The -- conversion does some arbitrary rounding (I believe this rounding is -- reasonable, but I have no proof of this) pragma Unreferenced (Get_LF_From_Ureal); function Get_Implemented_Op (Op_Decl : Asis.Element; Type_Def : Asis.Element) return Asis.Element; pragma Unreferenced (Get_Implemented_Op); -- Op_Decl is supposed to be a declaration of a dispatching operation for -- that Is_Overriding_Operation is true. Type_Def is supposed to be an -- interface type definition for some interface type that is included in -- the interface list of the definition of the type that is the type -- of dispatching operand(s) of Op_Decl. This function checks if Op_Decl -- may implement some operation of this interface, and if it may returns -- the declaration of this interface operation as a result, otherwise it -- returns Nil_Element. function Is_Procedure (Decl : Asis.Element) return Boolean; pragma Unreferenced (Is_Procedure); -- Checks that Decl declares a procedure ------------------ -- Acts_As_Spec -- ------------------ function Acts_As_Spec (Declaration : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Arg_Node : Node_Id; Name_Node : Node_Id; Spec_Node : Node_Id; Arg_Ekind : Entity_Kind; Result : Boolean := False; begin Check_Validity (Declaration, Package_Name & "Acts_As_Spec"); Arg_Node := Node (Declaration); case Arg_Kind is when A_Procedure_Body_Declaration | A_Function_Body_Declaration => Result := Acts_As_Spec (Arg_Node); -- The problem here is that for some subprogram bodies the -- front-end creates artificial specs and sets OFF the -- Acts_As_Spec flag for the body. At the moment we have detected -- two such situations (and we exclude the case of expanded -- subprogram body not to mix up with the similar situation in -- the tree, see : if not Result and then Special_Case (Declaration) /= Expanded_Subprogram_Instantiation then -- (1) Bodies declared immediately within protected bodies if Nkind (Parent (Arg_Node)) = N_Protected_Body then Spec_Node := Corresponding_Spec (Arg_Node); if Is_Artificial_Protected_Op_Item_Spec (Spec_Node) then Result := True; end if; else -- (2) child subprogram bodies with no separate spec Name_Node := Defining_Unit_Name (Specification (Arg_Node)); if Nkind (Name_Node) = N_Defining_Program_Unit_Name then Arg_Node := Corresponding_Spec (Arg_Node); if Present (Arg_Node) then while not (Nkind (Arg_Node) = N_Subprogram_Declaration or else Nkind (Arg_Node) = N_Generic_Subprogram_Declaration) loop Arg_Node := Parent (Arg_Node); end loop; Result := not Comes_From_Source (Arg_Node); end if; end if; end if; end if; when A_Procedure_Body_Stub | A_Function_Body_Stub => Arg_Ekind := Ekind (Defining_Unit_Name (Specification (Arg_Node))); Result := Arg_Ekind = E_Function or else Arg_Ekind = E_Procedure; when An_Expression_Function_Declaration => if Is_Part_Of_Inherited (Declaration) then Result := True; else Result := Nkind (R_Node (Declaration)) = N_Subprogram_Declaration; end if; when others => null; end case; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Acts_As_Spec"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Acts_As_Spec", Ex => Ex, Arg_Element => Declaration); end Acts_As_Spec; ------------------------------ -- Compilation_Dependencies -- ------------------------------ function Compilation_Dependencies (Main_Unit : Asis.Compilation_Unit) return Asis.Compilation_Unit_List is Arg_Kind : constant Asis.Unit_Kinds := Kind (Main_Unit); Arg_Unit_Id : Unit_Id; Res_Cont_Id : Context_Id; begin Check_Validity (Main_Unit, Package_Name & "Compilation_Dependencies"); if Arg_Kind not in A_Procedure .. A_Protected_Body_Subunit then Raise_ASIS_Inappropriate_Compilation_Unit (Diagnosis => Package_Name & "Compilation_Dependencies"); end if; Res_Cont_Id := Encl_Cont_Id (Main_Unit); Reset_Context (Res_Cont_Id); Arg_Unit_Id := Get_Unit_Id (Main_Unit); declare Result_Id_List : constant Unit_Id_List := GNAT_Compilation_Dependencies (Arg_Unit_Id); Result_List : constant Compilation_Unit_List := Get_Comp_Unit_List (Result_Id_List, Res_Cont_Id); begin if Is_Nil (Result_List) then Raise_ASIS_Inappropriate_Compilation_Unit (Diagnosis => Package_Name & "Compilation_Dependencies"); else return Result_List; end if; end; exception when ASIS_Inappropriate_Compilation_Unit => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Compilation_Dependencies"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Compilation_Dependencies", Ex => Ex, Arg_CU => Main_Unit); end Compilation_Dependencies; ------------- -- Compile -- ------------- procedure Compile (Source_File : String_Access; Args : Argument_List; Success : out Boolean; GCC : String_Access := null; Use_GNATMAKE : Boolean := False; Use_Temp_Prj : Boolean := False; Compiler_Out : String := ""; All_Warnings_Off : Boolean := True; Display_Call : Boolean := False) is Comp_Args : Argument_List (Args'First .. Args'Last + 12 + 1); First_Idx : constant Integer := Comp_Args'First; Last_Idx : Integer := First_Idx; Obj_Name : String_Access; Dot_Idx : Natural; Is_GNAAMP_Call : Boolean := False; -- In case of the call to GNAAMP we should not set '-x ada' flags Is_GNATMAKE_Call : Boolean := Use_GNATMAKE; begin if Is_GNATMAKE_Call and then GCC = null then -- We can not set gnatmake-specific parameters in this case Is_GNATMAKE_Call := False; end if; if GCC /= null then declare -- ??? What an awful code! Name : constant String := To_Lower (Base_Name (GCC.all)); Dot_Idx : Positive := Name'Last; begin for J in reverse Name'Range loop if Name (J) = '.' then Dot_Idx := J - 1; exit; end if; end loop; if Name (Name'First .. Dot_Idx) = "gnaamp" then Is_GNAAMP_Call := True; end if; end; end if; Comp_Args (Last_Idx) := Comp_Flag; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GNAT_Flag_ct; Last_Idx := Last_Idx + 1; if Is_GNATMAKE_Call then Comp_Args (Last_Idx) := GNATMAKE_Flag_u; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GNATMAKE_Flag_f; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GNATMAKE_Flag_q; Last_Idx := Last_Idx + 1; elsif not Is_GNAAMP_Call then Comp_Args (Last_Idx) := GCC_Flag_X; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GCC_Par_Ada; Last_Idx := Last_Idx + 1; end if; for J in Args'Range loop Comp_Args (Last_Idx) := Args (J); Last_Idx := Last_Idx + 1; end loop; if All_Warnings_Off then Comp_Args (Last_Idx) := GNAT_Flag_ws; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GNAT_Flag_yN; Last_Idx := Last_Idx + 1; end if; Comp_Args (Last_Idx) := Source_File; if Is_GNATMAKE_Call and then not Use_Temp_Prj then Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GNATMAKE_Flag_cargs; Last_Idx := Last_Idx + 1; Comp_Args (Last_Idx) := GCC_Flag_o; Last_Idx := Last_Idx + 1; Obj_Name := new String'(Base_Name (Source_File.all)); Dot_Idx := Obj_Name'Last; for J in reverse Obj_Name'Range loop if Obj_Name (J) = '.' then Dot_Idx := J - 1; exit; end if; end loop; Comp_Args (Last_Idx) := new String' (Get_Current_Dir & Directory_Separator & Obj_Name (Obj_Name'First .. Dot_Idx) & ".o"); end if; Success := Execute (GCC, Comp_Args (Args'First .. Last_Idx), Compiler_Out, Display_Call => Display_Call); end Compile; ---------------- -- Components -- ---------------- function Components (E : Asis.Element) return Asis.Element_List is Child_Access : constant Query_Array := Appropriate_Queries (E); Result_Length : Integer := 0; begin Check_Validity (E, Package_Name & "Components"); if Is_Nil (E) then return Nil_Element_List; end if; -- first, we compute the result's length: for Each_Query in Child_Access'Range loop case Child_Access (Each_Query).Query_Kind is when Bug => null; when Single_Element_Query => if not Is_Nil (Child_Access (Each_Query).Func_Simple (E)) then Result_Length := Result_Length + 1; end if; when Element_List_Query => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List (E); begin Result_Length := Result_Length + Child_List'Length; end; when Element_List_Query_With_Boolean => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List_Boolean (E, Child_Access (Each_Query).Bool); begin Result_Length := Result_Length + Child_List'Length; end; end case; end loop; -- and now, we define the result element list of Result_Length -- length and fill it in by repeating the same loop. This is -- not effective, and this will have to be revised. if Result_Length = 0 then return Nil_Element_List; end if; declare Result_List : Asis.Element_List (1 .. Result_Length); Next_Element : Integer := 1; begin for Each_Query in Child_Access'Range loop case Child_Access (Each_Query).Query_Kind is when Bug => null; when Single_Element_Query => if not Is_Nil (Child_Access (Each_Query).Func_Simple (E)) then Result_List (Next_Element) := Child_Access (Each_Query).Func_Simple (E); Next_Element := Next_Element + 1; end if; when Element_List_Query => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List (E); begin for I in Child_List'First .. Child_List'Last loop Result_List (Next_Element) := Child_List (I); Next_Element := Next_Element + 1; end loop; end; when Element_List_Query_With_Boolean => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List_Boolean (E, Child_Access (Each_Query).Bool); begin for I in Child_List'First .. Child_List'Last loop Result_List (Next_Element) := Child_List (I); Next_Element := Next_Element + 1; end loop; end; end case; end loop; return Result_List; end; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => E, Outer_Call => Package_Name & "Components"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Components", Ex => Ex, Arg_Element => E); end Components; ----------------------------------------------- -- Corresponding_Body_Parameter_Definition -- ----------------------------------------------- function Corresponding_Body_Parameter_Definition (Defining_Name : Asis.Defining_Name) return Asis.Defining_Name is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Defining_Name); Encl_Constr : Asis.Element; Encl_Constr_Kind : Internal_Element_Kinds; Result : Asis.Element := Nil_Element; begin Check_Validity (Defining_Name, Package_Name & "Corresponding_Body_Parameter_Definition"); if Arg_Kind /= A_Defining_Identifier then Raise_ASIS_Inappropriate_Element (Package_Name & "Corresponding_Body_Parameter_Definition", Wrong_Kind => Arg_Kind); end if; Encl_Constr := Enclosing_Element (Defining_Name); if Declaration_Kind (Encl_Constr) not in A_Formal_Declaration then Encl_Constr := (Enclosing_Element (Encl_Constr)); end if; Encl_Constr_Kind := Int_Kind (Encl_Constr); case Encl_Constr_Kind is when A_Procedure_Body_Declaration | A_Function_Body_Declaration => Result := Defining_Name; when A_Procedure_Body_Stub | A_Function_Body_Stub => Encl_Constr := Corresponding_Subunit (Encl_Constr); when A_Procedure_Declaration | A_Function_Declaration | A_Generic_Function_Declaration | A_Generic_Procedure_Declaration => Encl_Constr := Corresponding_Body (Encl_Constr); Encl_Constr_Kind := Int_Kind (Encl_Constr); if Encl_Constr_Kind = A_Procedure_Body_Stub or else Encl_Constr_Kind = A_Function_Body_Stub then Encl_Constr := Corresponding_Subunit (Encl_Constr); elsif Encl_Constr_Kind = An_Import_Pragma then Encl_Constr := Nil_Element; end if; when others => -- For all the other situations we can not return a parameter -- definition in the body Encl_Constr := Nil_Element; end case; if not Is_Nil (Result) or else Is_Nil (Encl_Constr) or else Declaration_Kind (Encl_Constr) = Not_A_Declaration then return Result; end if; Process_Parameter_Specifications : declare Def_Name_Image : constant String := To_Lower (To_String (Defining_Name_Image (Defining_Name))); Param_Specs : constant Asis.Element_List := Parameter_Profile (Encl_Constr); begin Through_Parameter_Specs : for I in Param_Specs'Range loop Process_Parameter_Names : declare Par_Names : constant Asis.Element_List := Names (Param_Specs (I)); begin Through_Parameter_Names : for J in Par_Names'Range loop if Def_Name_Image = To_Lower (To_String (Defining_Name_Image (Par_Names (J)))) then Result := Par_Names (J); exit Through_Parameter_Specs; end if; end loop Through_Parameter_Names; end Process_Parameter_Names; end loop Through_Parameter_Specs; end Process_Parameter_Specifications; pragma Assert (not Is_Nil (Result)); return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Defining_Name, Outer_Call => Package_Name & "Corresponding_Body_Parameter_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Body_Parameter_Definition", Ex => Ex, Arg_Element => Defining_Name); end Corresponding_Body_Parameter_Definition; ----------------------------------------- -- Corresponding_Called_Entity_Unwound -- ----------------------------------------- function Corresponding_Called_Entity_Unwound (Statement : Asis.Statement) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement); Arg_Node : Node_Id; Arg_Node_Kind : Node_Kind; Result_Node : Node_Id; Result_Unit : Compilation_Unit; Res_Spec_Case : Special_Cases := Not_A_Special_Case; begin Check_Validity (Statement, Package_Name & "Corresponding_Called_Entity_Unwound"); if not (Arg_Kind = An_Entry_Call_Statement or else Arg_Kind = A_Procedure_Call_Statement) then Raise_ASIS_Inappropriate_Element (Package_Name & "Corresponding_Called_Entity_Unwound", Wrong_Kind => Arg_Kind); end if; -- the implementation approach is similar to the approach taken for -- Asis.Expressions.Corresponding_Called_Function Arg_Node := R_Node (Statement); -- To be on the safe side, we use R_Node instead of Node, but it looks -- like in this case R_Node and Node should be the same Arg_Node_Kind := Nkind (Arg_Node); case Arg_Node_Kind is when N_Attribute_Reference => return Nil_Element; -- call to a procedure-attribute when N_Entry_Call_Statement | N_Procedure_Call_Statement => -- here we have to filter out the case when Nil_Element -- should be returned for a call through access-to-function: if Nkind (Sinfo.Name (Arg_Node)) = N_Explicit_Dereference then return Nil_Element; end if; -- ??? <tree problem 4> -- this fragment should be revised when the problem is fixed (as it should) if Arg_Node_Kind = N_Entry_Call_Statement then Result_Node := Sinfo.Name (Arg_Node); -- Result_Node points to the name of the called entry if Nkind (Result_Node) = N_Indexed_Component then -- this is the case for a call to an entry from an -- entry family Result_Node := Prefix (Result_Node); end if; Result_Node := Entity (Selector_Name (Result_Node)); else Result_Node := Entity (Sinfo.Name (Arg_Node)); -- only this assignment is needed if tree problem 4 is -- fixed end if; -- ??? <tree problem 4> - end when others => pragma Assert (False); null; end case; Result_Node := Unwind_Renaming (Result_Node); if No (Result_Node) then -- renaming of a procedure-attribute return Nil_Element; end if; if not Comes_From_Source (Result_Node) then return Nil_Element; end if; Result_Unit := Enclosing_Unit (Encl_Cont_Id (Statement), Result_Node); -- if not Is_Consistent (Result_Unit, Encl_Unit (Statement)) then -- return Nil_Element; -- end if; -- And now - from a defining name to a declaration itself Result_Node := Parent (Result_Node); if Nkind (Result_Node) in N_Function_Specification .. N_Procedure_Specification then Result_Node := Parent (Result_Node); end if; if Is_Expanded_Subprogram (Result_Node) then Res_Spec_Case := Expanded_Subprogram_Instantiation; end if; return Node_To_Element_New (Node => Result_Node, Spec_Case => Res_Spec_Case, In_Unit => Result_Unit); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Statement, Outer_Call => Package_Name & "Corresponding_Called_Entity_Unwound"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Called_Entity_Unwound", Ex => Ex, Arg_Element => Statement); end Corresponding_Called_Entity_Unwound; ------------------------------------------- -- Corresponding_Called_Function_Unwound -- ------------------------------------------- function Corresponding_Called_Function_Unwound (Expression : Asis.Expression) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Expression); Arg_Node : Node_Id; Arg_Node_Kind : Node_Kind; Result_Node : Node_Id; Result_Unit : Compilation_Unit; Res_Spec_Case : Special_Cases := Not_A_Special_Case; begin Check_Validity (Expression, Package_Name & "Corresponding_Called_Function_Unwound"); if not (Arg_Kind = A_Function_Call) then Raise_ASIS_Inappropriate_Element (Package_Name & "Corresponding_Called_Function_Unwound", Wrong_Kind => Arg_Kind); end if; -- first, we have to filter out the cases when a Nil_Element -- should be returned. For now, these cases include: -- -- - calls to functions-attributes; -- - all forms of calls to predefined operators; -- - all forms of calls to inherited functions -- -- We hope to implement the last case in future... -- First, we try the simplest approach, and then we will add patches -- if needed: Arg_Node := R_Node (Expression); Arg_Node_Kind := Nkind (Arg_Node); -- Rewritten node should know everything. But if this node is the -- result of compile-time optimization, we have to work with -- original node only: if Arg_Node_Kind = N_String_Literal or else Arg_Node_Kind = N_Integer_Literal or else Arg_Node_Kind = N_Real_Literal or else Arg_Node_Kind = N_Character_Literal or else Arg_Node_Kind = N_Raise_Constraint_Error or else Arg_Node_Kind = N_Identifier then Arg_Node := Node (Expression); Arg_Node_Kind := Nkind (Arg_Node); elsif Arg_Node_Kind = N_Explicit_Dereference then -- See F727-023 Arg_Node := Sinfo.Prefix (Arg_Node); Arg_Node_Kind := Nkind (Arg_Node); end if; case Arg_Node_Kind is when N_Attribute_Reference => return Nil_Element; when N_Function_Call | N_Procedure_Call_Statement => -- The second choice here corresponds to a procedure that is an -- argument of Debug pragma -- here we have to filter out the case when Nil_Element -- should be returned for a call through access-to-function: if Nkind (Sinfo.Name (Arg_Node)) = N_Explicit_Dereference then return Nil_Element; else Result_Node := Entity (Sinfo.Name (Arg_Node)); end if; when N_Op => -- all the predefined operations (??) Result_Node := Entity (Arg_Node); when others => pragma Assert (False); null; end case; -- here we have Result_Node pointed to the defining occurrence of -- the corresponding called function. Three things should be done: -- 1. If Result_Node is defined in a renaming definition, we have -- to unwind all the renamings till the defining occurrence of -- the corresponding callable entity will be reached; -- 2. If a given callable entity is implicitly defined, Nil_Element -- should be returned; -- 3. We have to come from a defining name to the corresponding -- declaration and then we should return the Element -- corresponding to this declaration Result_Node := Unwind_Renaming (Result_Node); if No (Result_Node) then -- renaming of a function-attribute return Nil_Element; end if; -- here we have Result_Node pointing to the defining occurrence of the -- name of the corresponding called function. First, we have to -- filter out implicitly declared functions: if not Comes_From_Source (Result_Node) then return Nil_Element; end if; Result_Unit := Enclosing_Unit (Encl_Cont_Id (Expression), Result_Node); Result_Node := Parent (Result_Node); if Nkind (Result_Node) = N_Defining_Program_Unit_Name then Result_Node := Parent (Result_Node); end if; Result_Node := Parent (Result_Node); -- to go from a defining name to a declaration itself if Is_Expanded_Subprogram (Result_Node) then Res_Spec_Case := Expanded_Subprogram_Instantiation; end if; return Node_To_Element_New (Node => Result_Node, Spec_Case => Res_Spec_Case, In_Unit => Result_Unit); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Expression, Outer_Call => Package_Name & "Corresponding_Called_Function_Unwound"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Called_Function_Unwound", Ex => Ex, Arg_Element => Expression); end Corresponding_Called_Function_Unwound; ------------------------------------ -- Corresponding_First_Definition -- ------------------------------------ function Corresponding_First_Definition (Defining_Name : Asis.Defining_Name) return Asis.Defining_Name is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Defining_Name); Is_Parameter : Boolean := False; Encl_Constr : Asis.Element; Encl_Constr_Kind : Internal_Element_Kinds; First_Declaration : Asis.Element; Result : Asis.Element := Nil_Element; begin Check_Validity (Defining_Name, Package_Name & "Corresponding_First_Definition"); if Arg_Kind not in Internal_Defining_Name_Kinds then Raise_ASIS_Inappropriate_Element (Package_Name & "Corresponding_First_Definition", Wrong_Kind => Arg_Kind); end if; Encl_Constr := Enclosing_Element (Defining_Name); if Int_Kind (Encl_Constr) = A_Parameter_Specification then Encl_Constr := Enclosing_Element (Encl_Constr); Is_Parameter := True; end if; if Is_Subunit (Encl_Constr) then Encl_Constr := Corresponding_Body_Stub (Encl_Constr); end if; Encl_Constr_Kind := Int_Kind (Encl_Constr); case Encl_Constr_Kind is when A_Procedure_Body_Declaration | A_Function_Body_Declaration | A_Function_Renaming_Declaration | A_Procedure_Renaming_Declaration | A_Procedure_Body_Stub | A_Function_Body_Stub => if ((Encl_Constr_Kind = A_Procedure_Body_Declaration or else Encl_Constr_Kind = A_Function_Body_Declaration or else Encl_Constr_Kind = A_Procedure_Body_Stub or else Encl_Constr_Kind = A_Function_Body_Stub) and then (not (Acts_As_Spec (Encl_Constr)))) or else ((Encl_Constr_Kind = A_Function_Renaming_Declaration or else Encl_Constr_Kind = A_Procedure_Renaming_Declaration) and then Is_Renaming_As_Body (Encl_Constr)) then -- there should be a corresponding spec where the first -- definition should be: if Is_Subunit (Encl_Constr) then Encl_Constr := Corresponding_Body_Stub (Encl_Constr); end if; First_Declaration := Corresponding_Declaration (Encl_Constr); if not Is_Parameter then -- just returning a defining name from a declaration, -- otherwise Result will remain nil, and we will have -- to process the case of a formal parameter after this -- case statement Result := Names (First_Declaration) (1); end if; else Result := Defining_Name; end if; when A_Package_Body_Declaration | A_Task_Body_Declaration | A_Protected_Body_Declaration | A_Package_Body_Stub | A_Task_Body_Stub | A_Protected_Body_Stub | An_Entry_Body_Declaration => First_Declaration := Corresponding_Declaration (Encl_Constr); if not Is_Parameter then Result := Names (First_Declaration) (1); end if; when An_Accept_Statement => First_Declaration := Corresponding_Entry (Encl_Constr); when An_Ordinary_Type_Declaration => Result := Corresponding_Type_Declaration (Encl_Constr); if Is_Nil (Result) then -- Encl_Constr is not a completion of an incomplete or -- private type declaration Result := Defining_Name; else Result := Names (Result) (1); end if; when others => Result := Defining_Name; end case; if Is_Nil (Result) then -- here we have to compute the first definition of the formal -- parameter in a subprogram spec/entry declaration Process_Parameter_Specifications : declare Def_Name_Image : constant String := To_Lower (To_String (Defining_Name_Image (Defining_Name))); Param_Specs : constant Asis.Element_List := Parameter_Profile (First_Declaration); begin Through_Parameter_Specs : for I in Param_Specs'Range loop Process_Parameter_Names : declare Par_Names : constant Asis.Element_List := Names (Param_Specs (I)); begin Through_Parameter_Names : for J in Par_Names'Range loop if Def_Name_Image = To_Lower (To_String (Defining_Name_Image (Par_Names (J)))) then Result := Par_Names (J); exit Through_Parameter_Specs; end if; end loop Through_Parameter_Names; end Process_Parameter_Names; end loop Through_Parameter_Specs; end Process_Parameter_Specifications; end if; pragma Assert (not Is_Nil (Result)); return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Defining_Name, Outer_Call => Package_Name & "Corresponding_First_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_First_Definition", Ex => Ex, Arg_Element => Defining_Name); end Corresponding_First_Definition; ---------------------------------------- -- Corresponding_Overridden_Operation -- ---------------------------------------- function Corresponding_Overridden_Operation (Declaration : Asis.Declaration) return Asis.Declaration is Result : Asis.Element := Nil_Element; Result_Unit : Compilation_Unit; Result_Node : Node_Id; Inherited : Boolean := False; Association_Type : Node_Id; begin Check_Validity (Declaration, Package_Name & "Corresponding_Overridden_Operation"); case Declaration_Kind (Declaration) is when A_Procedure_Declaration | A_Function_Declaration | A_Procedure_Instantiation | A_Function_Instantiation | A_Procedure_Body_Declaration | A_Null_Procedure_Declaration | A_Function_Body_Declaration | A_Procedure_Renaming_Declaration | A_Function_Renaming_Declaration => null; when others => Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Overridden_Operation", Wrong_Kind => Int_Kind (Declaration)); end case; if Is_Overriding_Operation (Declaration) then if Declaration_Kind (Declaration) in A_Procedure_Instantiation .. A_Function_Instantiation then Result_Node := Specification (Instance_Spec (Node (Declaration))); Result_Node := Related_Instance (Defining_Unit_Name (Result_Node)); else Result_Node := Defining_Unit_Name (Specification (Node (Declaration))); end if; Result_Node := Overridden_Operation (Result_Node); Inherited := not Comes_From_Source (Result_Node); if Inherited then Association_Type := Result_Node; Result_Node := Explicit_Parent_Subprogram (Result_Node); Result_Unit := Enclosing_Unit (Encl_Cont_Id (Declaration), Association_Type); Result := Node_To_Element_New (Node => Result_Node, Node_Field_1 => Association_Type, Inherited => True, In_Unit => Result_Unit); if Is_From_Instance (Association_Type) then Set_From_Instance (Result, True); else Set_From_Instance (Result, False); end if; else Result_Unit := Enclosing_Unit (Encl_Cont_Id (Declaration), Result_Node); Result := Node_To_Element_New (Node => Result_Node, In_Unit => Result_Unit); end if; Result := Enclosing_Element (Result); if Special_Case (Result) = Expanded_Subprogram_Instantiation then Result := Enclosing_Element (Result); end if; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Corresponding_Overridden_Operation"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Overridden_Operation", Ex => Ex, Arg_Element => Declaration); end Corresponding_Overridden_Operation; ----------------------------------------- -- Corresponding_Overridden_Operations -- ----------------------------------------- -- UNDER CONSTRUCTION!!! pragma Warnings (Off); function Corresponding_Overridden_Operations (Declaration : Asis.Declaration) return Asis.Element_List is Type_Def : Asis.Element; Tmp_El : Asis.Element; Result : Asis.Element := Nil_Element; Arg_Node : Entity_Id; Prim_Elmt : Elmt_Id; Prim_Node : Entity_Id; Res_Node : Node_Id; begin Check_Validity (Declaration, Package_Name & "Corresponding_Overridden_Operations"); case Declaration_Kind (Declaration) is when A_Procedure_Declaration | A_Function_Declaration | A_Procedure_Instantiation | A_Function_Instantiation | A_Procedure_Body_Declaration | A_Function_Body_Declaration | A_Null_Procedure_Declaration | A_Procedure_Renaming_Declaration | A_Function_Renaming_Declaration => null; when others => Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Overridden_Operations", Wrong_Kind => Int_Kind (Declaration)); end case; if not Is_Overriding_Operation (Declaration) then return Nil_Element_List; end if; -- Simple case: single inheritance: Type_Def := Primitive_Owner (Declaration); if Is_Nil (Definition_Interface_List (Type_Def)) then return (1 => Corresponding_Overridden_Operation (Declaration)); end if; -- General case - multiple inheritance Asis_Element_Table.Init; Tmp_El := First_Name (Declaration); Arg_Node := R_Node (Tmp_El); Tmp_El := First_Name (Enclosing_Element (Type_Def)); Prim_Elmt := First_Elmt (Primitive_Operations (R_Node (Tmp_El))); Prim_Node := Node (Prim_Elmt); while Present (Prim_Elmt) loop -- Check if Prim_Node corresponds to overridden primitive: if Present (Interface_Alias (Prim_Node)) and then Alias (Prim_Node) = Arg_Node then Res_Node := Interface_Alias (Prim_Node); -- ??? -- !!! Here we have to form the element representing overridden -- subprogram and to add it to Asis_Element_Table end if; Prim_Elmt := Next_Elmt (Prim_Elmt); Prim_Node := Node (Prim_Elmt); end loop; -- ??? Asis_Element_Table.Append (Corresponding_Overridden_Operation (Declaration)); return Asis.Declaration_List (Asis_Element_Table.Table (1 .. Asis_Element_Table.Last)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Corresponding_Overridden_Operations"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Overridden_Operations", Ex => Ex, Arg_Element => Declaration); end Corresponding_Overridden_Operations; pragma Warnings (On); -- function Corresponding_Overridden_Operations -- (Declaration : Asis.Declaration) -- return Asis.Element_List -- is -- Type_Def : Asis.Element; -- Result : Asis.Element := Nil_Element; -- begin -- Check_Validity (Declaration, -- Package_Name & "Corresponding_Overridden_Operations"); -- case Declaration_Kind (Declaration) is -- when A_Procedure_Declaration | -- A_Function_Declaration | -- A_Procedure_Instantiation | -- A_Function_Instantiation | -- A_Procedure_Body_Declaration | -- A_Function_Body_Declaration | -- A_Procedure_Renaming_Declaration | -- A_Function_Renaming_Declaration => -- null; -- when others => -- Raise_ASIS_Inappropriate_Element -- (Diagnosis => Package_Name & -- "Corresponding_Overridden_Operations"); -- end case; -- if not Is_Overriding_Operation (Declaration) then -- return Nil_Element_List; -- end if; -- -- Simple case: single inheritance: -- Type_Def := Primitive_Owner (Declaration); -- if Is_Nil (Definition_Interface_List (Type_Def)) then -- return (1 => Corresponding_Overridden_Operation (Declaration)); -- end if; -- -- General case - multiple inheritance -- declare -- Interfaces : Asis.Element_List := -- Definition_Interface_List (Type_Def); -- Start_From : Positive := Interfaces'First; -- begin -- Asis_Element_Table.Init; -- Result := Corresponding_Overridden_Operation (Declaration); -- Asis_Element_Table.Append (Result); -- Type_Def := Primitive_Owner (Declaration); -- -- First, replace each interface name in Interfaces with the -- -- corresponding type definition and check if we may start further -- -- processing not from the first interface in the list -- for J in Interfaces'Range loop -- Interfaces (J) := -- Type_Declaration_View -- (Corresponding_Name_Definition -- (Normalize_Reference (Interfaces (J)))); -- if Is_Equal (Interfaces (J), Type_Def) then -- Start_From := J + 1; -- end if; -- end loop; -- for J in Start_From .. Interfaces'Last loop -- Result := Get_Implemented_Op (Declaration, Interfaces (J)); -- if not Is_Nil (Result) then -- Asis_Element_Table.Append (Result); -- end if; -- end loop; -- return Asis.Declaration_List -- (Asis_Element_Table.Table (1 .. Asis_Element_Table.Last)); -- end; -- exception -- when ASIS_Inappropriate_Element => -- raise; -- when ASIS_Failed => -- if Status_Indicator = Unhandled_Exception_Error then -- Add_Call_Information -- (Argument => Declaration, -- Outer_Call => Package_Name & -- "Corresponding_Overridden_Operations"); -- end if; -- raise; -- when Ex : others => -- Report_ASIS_Bug -- (Query_Name => Package_Name & -- "Corresponding_Overridden_Operations", -- Ex => Ex, -- Arg_Element => Declaration); -- end Corresponding_Overridden_Operations; ---------------------------------------------- -- Corresponding_Parent_Subtype_Unwind_Base -- ---------------------------------------------- function Corresponding_Parent_Subtype_Unwind_Base (Type_Definition : Asis.Type_Definition) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Elem : Asis.Element := Type_Definition; Result : Asis.Element := Nil_Element; begin Check_Validity (Type_Definition, Package_Name & "Corresponding_Parent_Subtype_Unwind_Base"); if not (Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Parent_Subtype_Unwind_Base", Wrong_Kind => Arg_Kind); end if; Result := Corresponding_Parent_Subtype (Arg_Elem); if Is_Nil (Result) then -- The only possible case for this - we have a 'Base attribute -- reference as a parent subtype mark Arg_Elem := Parent_Subtype_Indication (Arg_Elem); Arg_Elem := Asis.Definitions.Subtype_Mark (Arg_Elem); while Attribute_Kind (Arg_Elem) = A_Base_Attribute loop Arg_Elem := Prefix (Arg_Elem); end loop; if Expression_Kind (Arg_Elem) = A_Selected_Component then Arg_Elem := Selector (Arg_Elem); end if; Arg_Elem := Corresponding_Name_Declaration (Arg_Elem); if Declaration_Kind (Result) = A_Subtype_Declaration then Result := Corresponding_First_Subtype (Arg_Elem); else Result := Arg_Elem; end if; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Corresponding_Parent_Subtype_Unwind_Base"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Parent_Subtype_Unwind_Base", Ex => Ex, Arg_Element => Type_Definition); end Corresponding_Parent_Subtype_Unwind_Base; ---------------------- -- CU_Requires_Body -- ---------------------- function CU_Requires_Body (Right : Asis.Compilation_Unit) return Boolean is Unit_Kind : constant Asis.Unit_Kinds := Kind (Right); Result : Boolean := False; begin Check_Validity (Right, Package_Name & "CU_Requires_Body"); Reset_Context (Encl_Cont_Id (Right)); case Unit_Kind is when A_Generic_Procedure | A_Generic_Function | A_Procedure | A_Function | A_Package | A_Generic_Package => Result := Asis.Set_Get.Is_Body_Required (Right); when others => null; end case; return Result; end CU_Requires_Body; --------------------------- -- Elements_Hash_Wrapper -- --------------------------- function Elements_Hash_Wrapper (E : Asis.Element) return Ada.Containers.Hash_Type is use Ada.Containers; Asis_Hash : constant Asis.ASIS_Integer := abs Asis.Elements.Hash (E); Result : Ada.Containers.Hash_Type; begin Result := Ada.Containers.Hash_Type (Asis_Hash); return Result; exception when Constraint_Error => return 0; end Elements_Hash_Wrapper; ------------------------------- -- Element_Image_In_Template -- ------------------------------- function Element_Image_In_Template (Element : Asis.Element) return Program_Text is Tmp_Element : Asis.Element := Element; begin Check_Validity (Element, Package_Name & "Element_Image_In_Template"); if Is_Part_Of_Implicit (Element) or else not Is_Part_Of_Instance (Element) then return ""; else -- What we are doing is tricky, but it gives the fast and -- easy-to-maintain solution: we consider the argument as if it is -- NOT from the expanded template, and we use the normal ASIS -- Element_Span function for it. The idea is to use Sloc fields -- from the element node which point to the corresponding positions -- in the template. Set_From_Instance (Tmp_Element, False); return Element_Image (Tmp_Element); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Element, Outer_Call => Package_Name & "Element_Image_In_Template"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Element_Image_In_Template", Ex => Ex, Arg_Element => Element); end Element_Image_In_Template; ------------------------------ -- Element_Span_In_Template -- ------------------------------ function Element_Span_In_Template (Element : Asis.Element) return Asis.Text.Span is Tmp_Element : Asis.Element := Element; begin Check_Validity (Element, Package_Name & "Element_Span_In_Template"); if Is_Part_Of_Implicit (Element) or else not Is_Part_Of_Instance (Element) then return Nil_Span; else -- What we are doing is tricky, but it gives the fast and -- easy-to-maintain solution: we consider the argument as if it is -- NOT from the expanded template, and we use the normal ASIS -- Element_Span function for it. The idea is to use Sloc fields -- from the element node which point to the corresponding positions -- in the template. Set_From_Instance (Tmp_Element, False); return Element_Span (Tmp_Element); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Element, Outer_Call => Package_Name & "Element_Span_In_Template"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Element_Span_In_Template", Ex => Ex, Arg_Element => Element); end Element_Span_In_Template; ----------------------------- -- Explicit_Type_Operators -- ----------------------------- function Explicit_Type_Operators (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Parent_El : Asis.Element; -- The construct where the argument type is defined Type_Decl : Asis.Element; -- Declaration of the argument type In_Package_Spec : Boolean; -- If the argument type is declared not in a package spec, but it is -- a derived type, we have to count all the explicit overridings of -- inherited operators, but if we are in the package spec, we just -- collect all the explicitly declared type operators Is_Formal_Type : Boolean; begin Check_Validity (Type_Definition, Package_Name & "Explicit_Type_Operators"); if not (Arg_Kind in Internal_Type_Kinds or else Arg_Kind in Internal_Formal_Type_Kinds or else Arg_Kind in A_Private_Type_Definition .. A_Protected_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Explicit_Type_Operators", Wrong_Kind => Arg_Kind); end if; Type_Decl := Enclosing_Element (Type_Definition); Parent_El := Enclosing_Element (Type_Decl); Is_Formal_Type := Arg_Kind in Internal_Formal_Type_Kinds; In_Package_Spec := Declaration_Kind (Parent_El) = A_Package_Declaration or else (not Is_Formal_Type and then Declaration_Kind (Parent_El) = A_Formal_Package_Declaration); declare All_Comp : constant Asis.Element_List := Components (Parent_El); Start_From : Natural; Result : Asis.Element_List (All_Comp'Range); Res_First : constant Natural := Result'First; Res_Last : Natural := Res_First - 1; begin for J in All_Comp'Range loop if Is_Equal (Type_Decl, All_Comp (J)) then Start_From := J + 1; exit; end if; end loop; for J in Start_From .. All_Comp'Last loop if Is_Formal_Type and then Declaration_Kind (All_Comp (J)) not in A_Formal_Declaration then exit; end if; if Is_Type_Operator (All_Comp (J), Type_Decl) and then (In_Package_Spec or else Overrides_Type_Operator (All_Comp (J), Type_Decl)) then Res_Last := Res_Last + 1; Result (Res_Last) := All_Comp (J); if Is_Bool_Eq_Declaration (All_Comp (J)) then Res_Last := Res_Last + 1; Result (Res_Last) := Corresponding_Equality_Operator (All_Comp (J)); end if; end if; end loop; return Result (Res_First .. Res_Last); end; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Explicit_Type_Operators"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Explicit_Type_Operators", Ex => Ex, Arg_Element => Type_Definition); end Explicit_Type_Operators; ---------------- -- First_Name -- ---------------- function First_Name (Dcl : Asis.Element) return Asis.Element is Name_List : constant Asis.Element_List := Names (Dcl); begin return Name_List (Name_List'First); end First_Name; ------------------------------- -- Formal_Subprogram_Default -- ------------------------------- function Formal_Subprogram_Default (Declaration : Asis.Generic_Formal_Parameter) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Arg_Node : Node_Id; begin Arg_Node := Node (Declaration); Check_Validity (Declaration, Package_Name & "Formal_Subprogram_Default"); if not (Arg_Kind = A_Formal_Procedure_Declaration or else Arg_Kind = A_Formal_Function_Declaration) then Raise_ASIS_Inappropriate_Element (Package_Name & "Formal_Subprogram_Default", Wrong_Kind => Arg_Kind); end if; if not Present (Default_Name (Arg_Node)) then return Nil_Element; end if; return Node_To_Element_New (Node => Default_Name (Arg_Node), Starting_Element => Declaration); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Formal_Subprogram_Default"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Formal_Subprogram_Default", Ex => Ex, Arg_Element => Declaration); end Formal_Subprogram_Default; --------------------- -- Full_Name_Image -- --------------------- function Full_Name_Image (Expression : Asis.Expression) return Program_Text is begin case Expression_Kind (Expression) is when An_Identifier .. An_Enumeration_Literal => return Asis.Expressions.Name_Image (Expression); when A_Selected_Component => return Full_Name_Image (Prefix (Expression)) & '.' & Asis.Expressions.Name_Image (Selector (Expression)); when others => Raise_ASIS_Inappropriate_Element (Package_Name & "Full_Name_Image", Wrong_Kind => Int_Kind (Expression)); end case; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Expression, Outer_Call => Package_Name & "Full_Name_Image"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Full_Name_Image", Ex => Ex, Arg_Element => Expression); end Full_Name_Image; ------------------------- -- Get_Call_Parameters -- ------------------------- function Get_Call_Parameters (Call : Asis.Element; Normalized : Boolean := False) return Asis.Element_List is begin if Expression_Kind (Call) = A_Function_Call then return Function_Call_Parameters (Call, Normalized); else return Call_Statement_Parameters (Call, Normalized); end if; end Get_Call_Parameters; ------------------------ -- Get_Implemented_Op -- ------------------------ -- Under construction! function Get_Implemented_Op (Op_Decl : Asis.Element; Type_Def : Asis.Element) return Asis.Element is pragma Unreferenced (Op_Decl, Type_Def); begin return Nil_Element; end Get_Implemented_Op; -- function Get_Implemented_Op -- (Op_Decl : Asis.Element; -- Type_Def : Asis.Element) -- return Asis.Element -- is -- Result : Asis.Element := Nil_Element; -- Look_For_Proc : constant Boolean := Is_Procedure (Op_Decl); -- Primitives : constant Asis.Element_List := Get_Primitives (Type_Def); -- Arg_Chars : Name_Id; -- Res_Chars : Name_Id; -- Tmp_Node : Node_Id; -- Tmp_El1 : Asis.Element; -- Tmp_El2 : Asis.Element; -- Success : Boolean; -- Is_Controlling : Boolean; -- Arg_Params : constant Asis.Element_List := Parameter_Profile (Op_Decl); -- begin -- Tmp_El := First_Name (Decl); -- Arg_Chars := Chars (R_Node (Tmp_El)); -- Scan_Primitives : for J in Primitives'Range loop -- if Look_For_Proc xor Is_Procedure (Primitives (J)) then -- Res_Chars := Chars (R_Node (First_Name (Primitives (J)))); -- if Res_Chars = Arg_Chars -- and then -- Arg_Params'Length = Parameter_Profile (Primitives (J))'Length -- then -- -- Check parameter profiles: -- Success := True; -- if not Look_For_Proc then -- -- Check for the result type -- Tmp_El1 := First_Name (Op_Decl); -- Tmp_El2 := First_Name (Primitives (J)); -- if Has_Controlling_Result (R_Node (Tmp_El1)) xor -- Has_Controlling_Result (R_Node (Tmp_El2)) -- then -- Success := False; -- else -- Is_Controlling := -- Has_Controlling_Result (R_Node (Tmp_El1)); -- Tmp_El1 := Result_Profile (Op_Decl); -- Tmp_El2 := Result_Profile (Primitives (J)); -- if Definition_Kind (Tmp_El1) = An_Access_Definition -- xor -- Definition_Kind (Tmp_El2) = An_Access_Definition -- then -- Success := False; -- elsif not Is_Controlling then -- Succes := Are_Type_Conforming (Tmp_El1, Tmp_El2); -- end if; -- end if; -- end if; -- end if; -- if Success then -- declare -- Res_Params : constant Asis.Element_List := -- Parameter_Profile (Primitives (J)); -- begin -- Scan_Params : for P in Arg_Params'Range loop -- if not Are_Conformant -- (Arg_Params (P), Res_Params (P)) -- then -- Success := False; -- exit Scan_Params; -- end if; -- end loop; -- end; -- end if; -- if Success then -- Result := Primitives (J) -- exit Scan_Primitives; -- end if; -- end if; -- end if; -- end loop Scan_Primitives; -- return Result; -- end Get_Implemented_Op; ------------------------ -- Get_Last_Component -- ------------------------ function Get_Last_Component (E : Asis.Element) return Asis.Element is Child_Access : constant Query_Array := Appropriate_Queries (E); Child : Asis.Element := Asis.Nil_Element; begin Check_Validity (E, Package_Name & "Get_Last_Component"); if Is_Nil (E) then Raise_ASIS_Inappropriate_Element (Package_Name & "Get_Last_Component", Wrong_Kind => Not_An_Element); end if; if Debug_Flag_X then Write_Str (" Get_Last_Component - called for "); Write_Str (Internal_Element_Kinds'Image (Int_Kind (E))); Write_Eol; end if; for Each_Query in reverse Child_Access'Range loop case Child_Access (Each_Query).Query_Kind is when Bug => null; when Single_Element_Query => Child := Child_Access (Each_Query).Func_Simple (E); when Element_List_Query => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List (E); begin if not Is_Nil (Child_List) then Child := Child_List (Child_List'Last); end if; end; when Element_List_Query_With_Boolean => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List_Boolean (E, Child_Access (Each_Query).Bool); begin if not Is_Nil (Child_List) then Child := Child_List (Child_List'Last); end if; end; end case; exit when not Is_Nil (Child); end loop; if Debug_Flag_X then Write_Str (" Get_Last_Component - returns "); Write_Str (Internal_Element_Kinds'Image (Int_Kind (Child))); Write_Eol; end if; return Child; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => E, Outer_Call => Package_Name & "Get_Last_Component"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Get_Last_Component", Ex => Ex, Arg_Element => E); end Get_Last_Component; ----------------------- -- Get_LF_From_Ureal -- ----------------------- function Get_LF_From_Ureal (U : Ureal) return Long_Long_Float is Result : Long_Long_Float; Base : constant Nat := Rbase (U); U_Num : constant Uint := Numerator (U); U_Denum : constant Uint := Denominator (U); Num : Long_Long_Integer; Denum : Long_Long_Integer; begin UI_Image (U_Num, Format => Decimal); Num := Long_Long_Integer'Value (UI_Image_Buffer (1 .. UI_Image_Length)); UI_Image (U_Denum, Format => Decimal); Denum := Long_Long_Integer'Value (UI_Image_Buffer (1 .. UI_Image_Length)); if Base /= 0 then Denum := Long_Long_Integer (2 ** Natural (Denum)); end if; Result := Long_Long_Float (Num) / Long_Long_Float (Denum); if UR_Is_Negative (U) then Result := -Result; end if; return Result; end Get_LF_From_Ureal; -------------------------- -- Has_Enumeration_Type -- -------------------------- function Has_Enumeration_Type (Expression : Asis.Expression) return Boolean is Result : Boolean := False; begin Check_Validity (Expression, Package_Name & "Has_Enumeration_Type"); if Ekind (Etype (R_Node (Expression))) in Enumeration_Kind then Result := True; end if; return Result; end Has_Enumeration_Type; ---------------------- -- Has_Integer_Type -- ---------------------- function Has_Integer_Type (Expression : Asis.Expression) return Boolean is Result : Boolean := False; begin Check_Validity (Expression, Package_Name & "Has_Integer_Type"); if Ekind (Etype (R_Node (Expression))) in Integer_Kind then Result := True; end if; return Result; end Has_Integer_Type; ------------------------------ -- Inherited_Type_Operators -- ------------------------------ function Inherited_Type_Operators (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Type_Decl : Asis.Element; begin Check_Validity (Type_Definition, Package_Name & "Inherited_Type_Operators"); if not (Arg_Kind in Internal_Type_Kinds or else Arg_Kind in Internal_Formal_Type_Kinds or else Arg_Kind in A_Private_Type_Definition .. A_Protected_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Inherited_Type_Operators", Wrong_Kind => Arg_Kind); end if; if not (Arg_Kind = A_Private_Extension_Definition or else Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition or else Arg_Kind = A_Formal_Derived_Type_Definition) then return Nil_Element_List; end if; declare All_Inherited_Ops : constant Asis.Declaration_List := Implicit_Inherited_Subprograms (Type_Definition); Result : Asis.Declaration_List (All_Inherited_Ops'Range); Res_First : constant Natural := Result'First; Res_Last : Natural := Res_First - 1; begin Type_Decl := Enclosing_Element (Type_Definition); for J in All_Inherited_Ops'Range loop if Is_Type_Operator (All_Inherited_Ops (J), Type_Decl) then Res_Last := Res_Last + 1; Result (Res_Last) := All_Inherited_Ops (J); end if; end loop; return Result (Res_First .. Res_Last); end; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Inherited_Type_Operators"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Inherited_Type_Operators", Ex => Ex, Arg_Element => Type_Definition); end Inherited_Type_Operators; -------------------- -- Is_Aspect_Mark -- -------------------- function Is_Aspect_Mark (Element : Asis.Element) return Boolean is Result : Boolean := False; Tmp : Node_Id; begin if Expression_Kind (Element) = An_Identifier or else Attribute_Kind (Element) = A_Class_Attribute then Tmp := R_Node (Element); Result := Nkind (Parent (Tmp)) = N_Aspect_Specification and then Tmp = Sinfo.Identifier (Parent (Tmp)); end if; return Result; end Is_Aspect_Mark; ----------------------------------- -- Is_Aspect_Specific_Identifier -- ----------------------------------- function Is_Aspect_Specific_Identifier (Element : Asis.Element) return Boolean is Result : Boolean := False; Tmp : Node_Id; begin if Expression_Kind (Element) = An_Identifier then Tmp := R_Node (Element); if Nkind (Tmp) = N_Identifier and then not Present (Entity (Tmp)) then Tmp := Parent (Tmp); if Present (Tmp) then case Nkind (Tmp) is when N_Component_Association => if Nkind (Parent (Parent (Tmp))) = N_Aspect_Specification then Result := True; end if; when N_Aspect_Specification => Result := R_Node (Element) /= Sinfo.Identifier (Tmp); -- ... to be continued... when others => null; end case; end if; end if; end if; return Result; end Is_Aspect_Specific_Identifier; ---------------------------- -- Is_Bool_Eq_Declaration -- ---------------------------- function Is_Bool_Eq_Declaration (Declaration : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Result : Boolean := False; Op_Node : Node_Id; Op_Etype : Node_Id; begin Check_Validity (Declaration, Package_Name & "Is_Bool_Eq_Declaration"); if Arg_Kind = A_Function_Declaration or else (Arg_Kind = A_Function_Body_Declaration and then Acts_As_Spec (Declaration)) or else Arg_Kind = A_Function_Renaming_Declaration then Op_Node := Defining_Unit_Name (Specification (Node (Declaration))); Op_Etype := Etype (Op_Node); if Is_Generic_Instance (Op_Node) then Op_Node := Defining_Unit_Name (Node (Enclosing_Element (Declaration))); end if; if Nkind (Op_Node) = N_Defining_Program_Unit_Name then Op_Node := Defining_Identifier (Op_Node); end if; if Nkind (Op_Node) = N_Defining_Operator_Symbol and then Chars (Op_Node) = Name_Op_Eq and then Op_Etype = Standard_Boolean then Result := True; end if; end if; return Result; end Is_Bool_Eq_Declaration; ------------------- -- Is_Class_Wide -- ------------------- function Is_Class_Wide (Declaration : Asis.Declaration) return Boolean is Result : Boolean := False; Subtype_Entity : Entity_Id; begin if Declaration_Kind (Declaration) = A_Subtype_Declaration then Subtype_Entity := R_Node (Declaration); Subtype_Entity := Defining_Identifier (Subtype_Entity); Result := Ekind (Subtype_Entity) = E_Class_Wide_Subtype; end if; return Result; end Is_Class_Wide; ------------------ -- Is_Completed -- ------------------ function Is_Completed (Declaration : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Arg_Node : Node_Id; Result : Boolean := False; begin Check_Validity (Declaration, Package_Name & "Is_Completed"); -- JUNK IMPLEMENTATION!!! if not (Arg_Kind = A_Procedure_Declaration or else Arg_Kind = A_Function_Declaration) or else Is_Part_Of_Inherited (Declaration) then return False; end if; Arg_Node := Defining_Unit_Name (Specification (Node (Declaration))); Result := Has_Completion (Arg_Node); return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Is_Completed"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Completed", Ex => Ex, Arg_Element => Declaration); end Is_Completed; ----------------------------------- -- Is_Default_For_Null_Procedure -- ----------------------------------- function Is_Default_For_Null_Procedure (Reference : Asis.Element) return Boolean is Result : Boolean := False; Tmp : Node_Id; begin if Expression_Kind (Reference) = An_Identifier and then Is_Part_Of_Instance (Reference) then Tmp := R_Node (Reference); if Nkind (Tmp) in N_Has_Entity then Tmp := Entity (Tmp); if Present (Tmp) and then Ekind (Tmp) = E_Procedure then Tmp := Parent (Parent (Tmp)); Result := Nkind (Tmp) = N_Subprogram_Body and then Nkind (Parent (Tmp)) = N_Package_Specification; end if; end if; end if; return Result; end Is_Default_For_Null_Procedure; ---------------------------- -- Is_Expanded_Subprogram -- ---------------------------- function Is_Expanded_Subprogram (N : Node_Id) return Boolean is Result : Boolean := False; Tmp : Node_Id; begin if Nkind (N) = N_Subprogram_Declaration then Tmp := Defining_Unit_Name (Specification (N)); if Nkind (Tmp) = N_Defining_Program_Unit_Name then Tmp := Defining_Identifier (Tmp); end if; if Is_Generic_Instance (Tmp) then Result := True; end if; end if; return Result; end Is_Expanded_Subprogram; ----------------- -- Is_Exported -- ----------------- function Is_Exported (Defining_Name : Asis.Defining_Name) return Boolean is Arg_Node : Node_Id; Tmp : Node_Id; Result : Boolean := False; begin Check_Validity (Defining_Name, Package_Name & "Is_Exported"); if Int_Kind (Defining_Name) not in Internal_Defining_Name_Kinds then return False; end if; Arg_Node := R_Node (Defining_Name); if Nkind (Arg_Node) = N_Defining_Program_Unit_Name then Arg_Node := Defining_Identifier (Arg_Node); end if; if Ekind (Arg_Node) = E_Subprogram_Body then -- Go to the corresponding spec entity Tmp := Parent (Arg_Node); while Nkind (Tmp) not in N_Subprogram_Specification loop Tmp := Parent (Tmp); end loop; Tmp := Parent (Tmp); Tmp := Corresponding_Decl_Node (Tmp); Arg_Node := Defining_Unit_Name (Specification (Tmp)); if Nkind (Arg_Node) = N_Defining_Program_Unit_Name then Arg_Node := Defining_Identifier (Arg_Node); end if; end if; Result := Is_Exported (Arg_Node); return Result; end Is_Exported; ------------------------------------- -- Is_From_Import_Procedure_Pragma -- ------------------------------------- function Is_From_Import_Procedure_Pragma (N : Node_Id) return Boolean is Tmp : Node_Id := Parent (N); Result : Boolean := False; begin if Nkind (Tmp) = N_Indexed_Component then Tmp := Parent (Tmp); if Nkind (Tmp) = N_Aggregate then Tmp := Parent (Tmp); if Nkind (Tmp) = N_Pragma_Argument_Association then Tmp := Pragma_Identifier (Parent (Tmp)); Result := Chars (Tmp) = Name_Import_Procedure or else Chars (Tmp) = Name_Import_Valued_Procedure; end if; end if; end if; return Result; end Is_From_Import_Procedure_Pragma; --------------------------------- -- Is_Implicit_Neq_Declaration -- --------------------------------- function Is_Implicit_Neq_Declaration (Declaration : Asis.Element) return Boolean is begin return Declaration_Kind (Declaration) = A_Function_Declaration and then Special_Case (Declaration) = Is_From_Imp_Neq_Declaration; end Is_Implicit_Neq_Declaration; -------------- -- Is_Label -- -------------- function Is_Label (Defining_Name : Asis.Defining_Name) return Boolean is N : constant Node_Id := Node (Defining_Name); Result : Boolean := False; begin if Int_Kind (Defining_Name) = A_Defining_Identifier then if Nkind (N) = N_Label then Result := True; elsif Nkind (N) = N_Identifier and then Nkind (Parent (N)) = N_Loop_Statement and then Nkind (Original_Node (Parent (N))) = N_Goto_Statement then -- An infinite loop is implemented with goto statement Result := True; end if; end if; return Result; end Is_Label; -------------------------- -- Is_Main_Unit_In_Tree -- -------------------------- function Is_Main_Unit_In_Tree (Right : Asis.Compilation_Unit) return Boolean is Arg_Kind : constant Unit_Kinds := Kind (Right); Arg_Unit_Id : Unit_Id; Arg_Cont_Id : Context_Id; begin Check_Validity (Right, Package_Name & "Is_Main_Unit_In_Tree"); Arg_Cont_Id := Encl_Cont_Id (Right); Reset_Context (Arg_Cont_Id); Arg_Unit_Id := Get_Unit_Id (Right); if Arg_Kind in A_Procedure .. A_Protected_Body_Subunit then return GNAT_Compilation_Dependencies (Arg_Unit_Id) /= Nil_Unit_Id_List; else return False; end if; exception when ASIS_Inappropriate_Compilation_Unit => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Is_Main_Unit_In_Tree"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Main_Unit_In_Tree", Ex => Ex, Arg_CU => Right); end Is_Main_Unit_In_Tree; ----------------- -- Is_Obsolete -- ----------------- function Is_Obsolete (Right : Asis.Compilation_Unit) return Boolean is Arg_Kind : constant Unit_Kinds := Kind (Right); Arg_Id : Unit_Id; Result : Boolean := True; begin Check_Validity (Right, Package_Name & "Is_Obsolete"); case Arg_Kind is when Not_A_Unit | A_Nonexistent_Declaration | A_Nonexistent_Body | An_Unknown_Unit => null; when others => Arg_Id := Get_Unit_Id (Right); if Arg_Id = Standard_Id then Result := False; else Result := not (Source_Status (Right) = Up_To_Date); end if; end case; return Result; exception when ASIS_Inappropriate_Compilation_Unit => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Is_Obsolete"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Obsolete", Ex => Ex, Arg_CU => Right); end Is_Obsolete; ----------------------------- -- Is_Overriding_Operation -- ----------------------------- function Is_Overriding_Operation (Declaration : Asis.Element) return Boolean is Result : Boolean := False; Entity_N : Entity_Id := Empty; begin case Declaration_Kind (Declaration) is when A_Procedure_Instantiation | A_Function_Instantiation => Entity_N := Specification (Instance_Spec (Node (Declaration))); Entity_N := Related_Instance (Defining_Unit_Name (Entity_N)); when A_Procedure_Declaration | A_Function_Declaration | A_Procedure_Body_Declaration | A_Function_Body_Declaration | A_Null_Procedure_Declaration | A_Procedure_Renaming_Declaration | A_Function_Renaming_Declaration => if not Is_Part_Of_Implicit (Declaration) then Entity_N := Specification (Node (Declaration)); Entity_N := Defining_Unit_Name (Entity_N); end if; when others => null; end case; if Present (Entity_N) and then Nkind (Entity_N) in N_Defining_Identifier .. N_Defining_Operator_Symbol then Result := Present (Overridden_Operation (Entity_N)); end if; return Result; end Is_Overriding_Operation; ---------------------------- -- Is_Predefined_Operator -- ---------------------------- function Is_Predefined_Operator (Operator : Asis.Element) return Boolean is Result : Boolean := False; Entity_N : Entity_Id; begin if Expression_Kind (Operator) = An_Operator_Symbol then Entity_N := Entity (Node (Operator)); Result := Present (Entity_N) and then Is_Predefined (Entity_N); end if; return Result; end Is_Predefined_Operator; ---------------- -- Is_Private -- ---------------- function Is_Private (Declaration : Asis.Element) return Boolean is Arg_Element : Element := Declaration; Result : Boolean := False; Next_Node : Node_Id; Enclosing_List : List_Id; Enclosing_Node : Node_Id; begin Check_Validity (Declaration, Package_Name & "Is_Private"); if Declaration_Kind (Declaration) = Not_A_Declaration or else Declaration_Kind (Declaration) in A_Loop_Parameter_Specification .. An_Element_Iterator_Specification then return False; end if; -- In case of an implicit Element we go to the "enclosing" explicit -- Element to get the node stored in R_Node field which can safely be -- used for tree traversal (for implicit Elements R_Node may be of -- special use and it may have the Parent field set to Empty while Is_Part_Of_Implicit (Arg_Element) and then Special_Case (Arg_Element) /= From_Limited_View loop Arg_Element := Enclosing_Element (Arg_Element); end loop; Next_Node := R_Node (Arg_Element); while Nkind (Next_Node) /= N_Compilation_Unit and then not Is_List_Member (Next_Node) loop Next_Node := Parent (Next_Node); end loop; while Nkind (Next_Node) /= N_Compilation_Unit loop -- If we are here, we have Next_Node being a list member Enclosing_List := List_Containing (Next_Node); Enclosing_Node := Parent (Enclosing_List); case Nkind (Enclosing_Node) is when N_Statement_Other_Than_Procedure_Call => -- We can not be in any private part exit; when N_Package_Specification | N_Task_Definition | N_Protected_Definition => if Enclosing_List = Private_Declarations (Enclosing_Node) then Result := True; exit; end if; when others => null; end case; Next_Node := Parent (Next_Node); while Nkind (Next_Node) /= N_Compilation_Unit and then not Is_List_Member (Next_Node) loop Next_Node := Parent (Next_Node); end loop; end loop; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Is_Private"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Private", Ex => Ex, Arg_Element => Declaration); end Is_Private; ------------------ -- Is_Procedure -- ------------------ function Is_Procedure (Decl : Asis.Element) return Boolean is Result : Boolean := False; begin case Declaration_Kind (Decl) is when A_Procedure_Declaration | A_Procedure_Instantiation | A_Procedure_Body_Declaration | A_Null_Procedure_Declaration | A_Procedure_Renaming_Declaration => Result := True; when others => null; end case; return Result; end Is_Procedure; ----------------- -- Is_RCI_Unit -- ----------------- function Is_RCI_Unit (C : Asis.Compilation_Unit) return Boolean is Arg_Node : Node_Id; Result : Boolean := False; begin if Is_Standard (C) then return False; end if; case Unit_Kind (C) is when A_Package | A_Procedure_Body | A_Function_Body | A_Generic_Package => Arg_Node := Unit (Top (C)); Arg_Node := Defining_Unit_Name (Specification (Arg_Node)); if Nkind (Arg_Node) = N_Defining_Program_Unit_Name then Arg_Node := Defining_Identifier (Arg_Node); end if; Result := Is_Remote_Call_Interface (Arg_Node); when others => null; end case; return Result; end Is_RCI_Unit; ------------------------- -- Is_Renaming_As_Body -- ------------------------- function Is_Renaming_As_Body (Declaration : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Arg_Node : Node_Id; Result : Boolean := False; begin Check_Validity (Declaration, Package_Name & "Is_Renaming_As_Body"); if Arg_Kind = A_Procedure_Renaming_Declaration or else Arg_Kind = A_Function_Renaming_Declaration then Arg_Node := R_Node (Declaration); if Nkind (Arg_Node) /= N_Subprogram_Declaration then Result := Present (Corresponding_Spec (Arg_Node)); end if; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Is_Renaming_As_Body"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Renaming_As_Body", Ex => Ex, Arg_Element => Declaration); end Is_Renaming_As_Body; --------------- -- Is_Static -- --------------- function Is_Static (Element : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element); Arg_Node : Node_Id; Result : Boolean := False; begin Check_Validity (Element, Package_Name & "Is_Static"); if Arg_Kind in Internal_Expression_Kinds and then Is_True_Expression (Element) then Result := Sinfo.Is_Static_Expression (R_Node (Element)); elsif Arg_Kind = A_Range_Attribute_Reference or else Arg_Kind = A_Discrete_Range_Attribute_Reference_As_Subtype_Definition or else Arg_Kind = A_Discrete_Range_Attribute_Reference then Arg_Node := R_Node (Element); if Nkind (Arg_Node) = N_Range_Constraint then Arg_Node := Range_Expression (Arg_Node); end if; if Nkind (Arg_Node) = N_Range and then Is_Static_Expression (Low_Bound (Arg_Node)) and then Is_Static_Expression (High_Bound (Arg_Node)) then Result := True; end if; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Element, Outer_Call => Package_Name & "Is_Static"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Static", Ex => Ex, Arg_Element => Element); end Is_Static; ------------------------ -- Is_True_Expression -- ------------------------ function Is_True_Expression (Expression : Asis.Expression) return Boolean is Arg_Node : Node_Id := Node (Expression); Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Expression); Expr_Chars : Name_Id; Entity_Node : Entity_Id; Result : Boolean := True; -- the idea of the implementation is to find out the cases when -- Expression is NOT a true exception, so we initialize Result -- as True begin Check_Validity (Expression, Package_Name & "Is_True_Expression"); if Arg_Kind not in Internal_Expression_Kinds then return False; end if; if Nkind (Arg_Node) = N_Identifier and then Nkind (Parent (Arg_Node)) = N_Expanded_Name and then Arg_Node = Selector_Name (Parent (Arg_Node)) then -- selector in an expanded name - all the semantic fields -- are set for the whole name, but not for this selector. -- So: Arg_Node := Parent (Arg_Node); end if; if Nkind (Arg_Node) not in N_Has_Etype or else No (Etype (Arg_Node)) or else Is_Anonymous (Ekind (Etype (Arg_Node))) or else Ekind (Etype (Arg_Node)) = E_Subprogram_Type then -- Expression may be a true expression, but it may have a type which -- cannot be represented in ASIS (such as an anonymous access type), -- in such cases we also classify it as being not true expression Result := False; else -- in some cases more detailed analysis is required. -- ??? This part may require some more analysis - it may be -- somewhat redundant case Arg_Kind is when An_Identifier | A_Selected_Component => -- and here we have to investigate whether or not this -- Expression is a "naming expression" if Special_Case (Expression) = Rewritten_Named_Number then return True; end if; -- ??? <tree problem 1> -- this fragment should be revised when the problem is fixed (as it should) if Nkind (Arg_Node) = N_Selected_Component and then Etype (Arg_Node) = Any_Type -- for now (GNAT 3.05) this means, that Expression is an -- expanded name of the character literal of ether a -- predefined character type or of the type derived from a -- predefined character type; the problem is that the -- Entity field is not set for such a node then return True; end if; -- ??? <tree problem 1> - end -- now taking the Entity field (if any) and looking, -- what we have: if Nkind (Arg_Node) = N_Selected_Component then Entity_Node := Entity (Selector_Name (Arg_Node)); elsif Nkind (Arg_Node) = N_Attribute_Definition_Clause then -- the attribute designator in an attribute definition -- clause Entity_Node := Empty; else Entity_Node := Entity (Arg_Node); end if; if No (Entity_Node) then Result := False; elsif Ekind (Entity_Node) = E_Enumeration_Literal then null; else case Ekind (Entity_Node) is -- the first choice in this case statement should -- filter in entities which *ARE* expressions in Ada -- sense when E_Variable => -- tasks and protected objects declared by _single_ -- task/protected declarations do not have -- corresponding type declarations which can be -- represented in ASIS Result := Comes_From_Source (Parent (Entity_Node)); when E_Component | E_Constant | E_Discriminant | E_Loop_Parameter | E_In_Out_Parameter | E_In_Parameter | E_Out_Parameter | E_Generic_In_Out_Parameter | E_Generic_In_Parameter | E_Named_Integer | E_Named_Real | E_Enumeration_Literal | -- ??? (see elsif path) -- enumeration literals are not treated as -- functions in ASIS E_Entry_Index_Parameter | E_Protected_Object => null; -- simply keeping the initialization of Result when others => Result := False; end case; end if; when Internal_Operator_Symbol_Kinds => Result := False; when Internal_Attribute_Reference_Kinds => case Internal_Attribute_Reference_Kinds (Arg_Kind) is when An_Adjacent_Attribute | A_Base_Attribute | A_Ceiling_Attribute | A_Class_Attribute | A_Compose_Attribute | A_Copy_Sign_Attribute | An_Exponent_Attribute | A_Floor_Attribute | A_Fraction_Attribute | An_Image_Attribute | An_Input_Attribute | A_Leading_Part_Attribute | A_Machine_Attribute | A_Max_Attribute | A_Min_Attribute | A_Model_Attribute | An_Output_Attribute | A_Pos_Attribute | A_Pred_Attribute | A_Range_Attribute | A_Read_Attribute | A_Remainder_Attribute | A_Round_Attribute | A_Rounding_Attribute | A_Scaling_Attribute | A_Succ_Attribute | A_Truncation_Attribute | An_Unbiased_Rounding_Attribute | A_Val_Attribute | A_Value_Attribute | A_Wide_Image_Attribute | A_Wide_Value_Attribute | A_Write_Attribute => Result := False; when An_Implementation_Defined_Attribute => Expr_Chars := Attribute_Name (Arg_Node); if Expr_Chars = Name_Abort_Signal or else Expr_Chars = Name_Elab_Body or else Expr_Chars = Name_Elab_Spec then Result := False; end if; when others => null; end case; when A_Positional_Array_Aggregate | A_Named_Array_Aggregate => if Nkind (Parent (Arg_Node)) = N_Enumeration_Representation_Clause or else Is_Typeless_Subaggregate (Arg_Node) then Result := False; end if; when others => null; end case; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Expression, Outer_Call => Package_Name & "Is_True_Expression"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_True_Expression", Ex => Ex, Arg_Element => Expression); end Is_True_Expression; ---------------------- -- Is_Type_Operator -- ---------------------- function Is_Type_Operator (Op_Decl : Asis.Element; Type_Decl : Asis.Element) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Op_Decl); Result : Boolean := False; Next_Type : Asis.Element; begin if (Arg_Kind = A_Function_Declaration or else ((Arg_Kind = A_Function_Body_Declaration or else Arg_Kind = A_Function_Body_Stub or else Arg_Kind = A_Function_Renaming_Declaration) and then not (Is_Equal (Corresponding_Declaration (Op_Decl), Op_Decl))) or else Arg_Kind = A_Function_Instantiation or else Arg_Kind = A_Formal_Function_Declaration) and then Int_Kind (Names (Op_Decl) (1)) in Internal_Defining_Operator_Kinds then -- First, check the result type Next_Type := Result_Profile (Op_Decl); if Int_Kind (Next_Type) = A_Selected_Component then Next_Type := Selector (Next_Type); end if; if Int_Kind (Next_Type) = An_Identifier then Next_Type := Corresponding_Name_Declaration (Next_Type); Next_Type := Corresponding_First_Subtype (Next_Type); if Is_Equal (Next_Type, Type_Decl) then Result := True; end if; end if; if not Result then -- check parameter types declare Params : constant Asis.Element_List := Parameter_Profile (Op_Decl); begin for J in Params'Range loop Next_Type := Object_Declaration_View (Params (J)); if Int_Kind (Next_Type) = A_Selected_Component then Next_Type := Selector (Next_Type); end if; if Int_Kind (Next_Type) = An_Identifier then Next_Type := Corresponding_Name_Declaration (Next_Type); Next_Type := Corresponding_First_Subtype (Next_Type); if Is_Equal (Next_Type, Type_Decl) then Result := True; exit; end if; end if; end loop; end; end if; end if; return Result; end Is_Type_Operator; ------------------------------ -- Is_Typeless_Subaggregate -- ------------------------------ function Is_Typeless_Subaggregate (Aggr : Node_Id) return Boolean is Parent_Node : Node_Id := Parent (Aggr); Result : Boolean := False; Arg_Type : Entity_Id; Parent_Type : Entity_Id; begin if Nkind (Parent_Node) = N_Component_Association then Parent_Node := Parent (Parent_Node); end if; if Nkind (Parent_Node) = N_Aggregate then Arg_Type := Etype (Aggr); while Present (Arg_Type) and then Etype (Arg_Type) /= Arg_Type loop Arg_Type := Etype (Arg_Type); end loop; Parent_Type := Etype (Parent_Node); while Present (Parent_Type) and then Etype (Parent_Type) /= Parent_Type loop Parent_Type := Etype (Parent_Type); end loop; Result := Arg_Type = Parent_Type; end if; return Result; end Is_Typeless_Subaggregate; ------------------------- -- Is_Uniquely_Defined -- ------------------------- function Is_Uniquely_Defined (Reference : Asis.Expression) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Reference); Arg_Node : Node_Id; Result : Boolean := False; begin Check_Validity (Reference, Package_Name & "Is_Uniquely_Defined"); if Arg_Kind = An_Identifier or else Arg_Kind in Internal_Operator_Symbol_Kinds or else Arg_Kind = A_Character_Literal or else Arg_Kind = An_Enumeration_Literal then Result := True; -- We suppose, that in general case we have a unique declaration, -- and now let's try to detect if we have a special case: Arg_Node := Node (Reference); -- first, the situation when "passed a portion of a pragma that -- was "ignored" by the compiler", it relates to pragma arguments -- only, but not to pragma element identifiers: -- GNAT rewrites the tree structure for non-recognized pragma as -- if it is a null statement, so: if Nkind (Parent (Parent (Arg_Node))) = N_Null_Statement then Result := False; end if; if Arg_Kind = An_Identifier then -- There are three checks specific to arguments of An_Identifier -- kind only: a pragma_argument_identifier, an identifier specific -- to a pragma and a reference to an attribute_designator: if Nkind (Arg_Node) = N_Pragma_Argument_Association -- a reference to a pragma_argument_identifier or else (Nkind (Arg_Node) in N_Has_Entity and then No (Entity (Arg_Node)) and then (Nkind (Parent (Arg_Node)) = N_Pragma_Argument_Association or else Is_From_Import_Procedure_Pragma (Arg_Node))) -- an identifier specific to a pragma, we make a guess that -- any identifier on the place of a pragma argument is -- specific to the pragma, if the Entity field is not set -- for this identifier. Is it really true??? or else Nkind (Arg_Node) = N_Attribute_Reference or else Special_Case (Reference) = Dummy_Class_Attribute_Designator -- a reference to an attribute_designator or else Nkind (Arg_Node) = N_Attribute_Definition_Clause -- attribute designator from an attribute definition clause then Result := False; end if; end if; -- One more check for pragma argument. It corresponds to the -- situation when the identifier is specific for a pragma, but in -- the same time it is a part of other expression. This check is -- specific to extended Import and Export pragmas applying to -- subprograms. if Result and then Special_Case (Reference) = Not_A_Special_Case and then Arg_Kind = An_Identifier and then No (Entity (Arg_Node)) then -- The first possibility: -- -- pragma Import_Function (Internal => Unix_Code_Mappings, -- External => "unix_code_mappings", -- Result_Type => Integer, -- Mechanism => (Value)); -- -- Value is rewritten into N_Aggregate -- -- The second possibility: -- -- pragma Import_Procedure (Internal => Ignore_Signal, -- External => "ignore_signal", -- Mechanism => (Value, Value)); -- -- Value is not rewritten and it is represented as a "normal" -- aggregate component -- -- And the third possibility: -- -- pragma Export_Procedure -- (Internal => Reset, -- External => "", -- Parameter_Types => (File_Type, File_Mode), -- Mechanism => (File => Reference)); -- -- Here we have an aggregate with named associations: if (Nkind (R_Node (Reference)) = N_Aggregate and then (Nkind (Parent (R_Node (Reference)))) = N_Pragma_Argument_Association) or else (Nkind (R_Node (Reference)) = N_Identifier and then not (Is_Rewrite_Substitution (R_Node (Reference))) and then ((Nkind (Parent (R_Node (Reference))) = N_Aggregate and then Nkind (Parent (Parent (R_Node (Reference)))) = N_Pragma_Argument_Association) or else (Nkind (Parent (R_Node (Reference))) = N_Component_Association and then Nkind (Parent (Parent (R_Node (Reference)))) = N_Aggregate and then Nkind (Parent (Parent (Parent ((R_Node (Reference)))))) = N_Pragma_Argument_Association) ) ) then Result := False; end if; end if; -- Then check for the situation when if passed a portion of a pragma -- that may be an ambiguous reference to more than one entity. if Result and then Nkind (Parent (Arg_Node)) = N_Pragma_Argument_Association and then Needs_List (Reference) then declare Res_List : constant Asis.Element_List := Corresponding_Name_Definition_List (Reference); begin if Res_List'Length /= 1 then Result := False; end if; end; end if; end if; -- Case when the argument is a parameter of Source_File_Name pragma or -- component thereof if Result then while not Is_List_Member (Arg_Node) and then Present (Arg_Node) loop Arg_Node := Parent (Arg_Node); end loop; if Nkind (Arg_Node) = N_Pragma_Argument_Association and then Pragma_Name (Parent (Arg_Node)) = Name_Source_File_Name then Result := False; end if; end if; -- Case when the argument is the (component of the) prefix of the -- GNAT-specific attribute 'Elab_Body or 'Elab_Spec if Result then Arg_Node := Parent (R_Node (Reference)); while Nkind (Arg_Node) = N_Selected_Component loop Arg_Node := Parent (Arg_Node); end loop; if Nkind (Arg_Node) = N_Attribute_Reference and then Attribute_Name (Arg_Node) in Name_Elab_Body .. Name_Elab_Spec then Result := False; end if; end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Reference, Outer_Call => Package_Name & "Is_Uniquely_Defined"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Uniquely_Defined", Ex => Ex, Arg_Element => Reference); end Is_Uniquely_Defined; ------------------------------- -- Main_Unit_In_Current_Tree -- ------------------------------- function Main_Unit_In_Current_Tree (The_Context : Asis.Context) return Asis.Compilation_Unit is Curr_Tree_Id : Tree_Id; Curr_Cont_Id : Context_Id; Res_Unit_Id : Unit_Id := Nil_Unit; begin Check_Validity (The_Context, Package_Name & "Main_Unit_In_Current_Tree"); Curr_Cont_Id := Get_Current_Cont; Curr_Tree_Id := Get_Current_Tree; if Tree_Processing_Mode (Get_Cont_Id (The_Context)) = GNSA then -- Note, that for GNSA Context no check is made! This works correctly -- only for -GNSA -C1 Context and if only this Context Is_Open -- at the moment Res_Unit_Id := Config_Comp_Id + 1; -- ??? -- Not a good approach!!! elsif Get_Cont_Id (The_Context) = Curr_Cont_Id and then Curr_Cont_Id /= Nil_Context_Id and then Present (Curr_Tree_Id) then Res_Unit_Id := Main_Unit_Id; elsif Get_Cont_Id (The_Context) /= Nil_Context_Id then Reset_Context (Get_Cont_Id (The_Context)); if Tree_Processing_Mode (Get_Cont_Id (The_Context)) = GNSA then -- Note, that for GNSA Context no check is made! This works -- correctly only for -GNSA -C1 Context and if only this Context -- Is_Open at the moment Res_Unit_Id := Config_Comp_Id + 1; -- ??? -- Not a good approach!!! elsif Last_Tree (Get_Cont_Id (The_Context)) >= First_Tree_Id then Res_Unit_Id := Main_Unit_Id (First_Tree_Id); end if; end if; if Present (Res_Unit_Id) then return Get_Comp_Unit (Res_Unit_Id, Get_Cont_Id (The_Context)); else return Nil_Compilation_Unit; end if; exception when ASIS_Inappropriate_Context => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Main_Unit_In_Current_Tree"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Main_Unit_In_Current_Tree", Ex => Ex); end Main_Unit_In_Current_Tree; ----------- -- No_Op -- ----------- procedure No_Op (Element : Asis.Element; Control : in out Traverse_Control; State : in out No_State) is begin pragma Unreferenced (Element); pragma Unreferenced (Control); pragma Unreferenced (State); null; end No_Op; ------------------------- -- Normalize_Reference -- ------------------------- function Normalize_Reference (Ref : Asis.Element) return Asis.Element is Result : Asis.Element := Ref; begin case Expression_Kind (Ref) is when A_Selected_Component => Result := Selector (Ref); when An_Attribute_Reference => Result := Normalize_Reference (Prefix (Ref)); when others => null; end case; return Result; end Normalize_Reference; -------------------------- -- Original_Line_Number -- -------------------------- function Original_Line_Number (Element : Asis.Element; Compiled_Line : Line_Number_Positive) return Line_Number is SFI : Source_File_Index; Result : Line_Number := 0; begin Check_Validity (Element, Package_Name & "Original_Line_Number"); if Is_Text_Available (Element) then if Compiled_Line > Line_Number (Number_Of_Lines (Element)) then Raise_ASIS_Inappropriate_Line_Number (Package_Name & "Original_Line_Number"); end if; SFI := Get_Source_File_Index (Location (Element)); Result := Line_Number (Sinput.Physical_To_Logical (Physical_Line_Number (Compiled_Line), SFI)); end if; return Result; exception when ASIS_Inappropriate_Element | ASIS_Inappropriate_Line_Number => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Element, Outer_Call => Package_Name & "Original_Line_Number"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Original_Line_Number", Ex => Ex, Arg_Element => Element); end Original_Line_Number; ------------------------ -- Original_Text_Name -- ------------------------ function Original_Text_Name (Compilation_Unit : Asis.Compilation_Unit) return Wide_String is begin Check_Validity (Compilation_Unit, Package_Name & "Original_Text_Name"); if not Exists (Compilation_Unit) then return Nil_Asis_Wide_String; else -- Exists resets the Context! return To_Program_Text (Ref_File (Compilation_Unit)); end if; exception when ASIS_Inappropriate_Compilation_Unit => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Original_Text_Name"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Original_Text_Name", Ex => Ex, Arg_CU => Compilation_Unit); end Original_Text_Name; ----------------------------- -- Overrides_Type_Operator -- ----------------------------- function Overrides_Type_Operator (Op_Decl : Asis.Element; Type_Decl : Asis.Element) return Boolean is pragma Unreferenced (Type_Decl); Op_Entity : Entity_Id; Result : Boolean := False; begin -- We assume that Is_Type_Operator (Op_Decl, Type_Decl) is True -- !!! The implementation is incomplete!!! Op_Entity := Node (Names (Op_Decl) (1)); if Present (Overridden_Operation (Op_Entity)) then Result := True; end if; return Result; end Overrides_Type_Operator; --------------------- -- Primitive_Owner -- --------------------- function Primitive_Owner (Declaration : Asis.Declaration) return Asis.Type_Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration); Arg_Node : Node_Id := Empty; Par_Node : Node_Id := Empty; Res_Node : Node_Id := Empty; Result : Element := Nil_Element; Res_Kind : Internal_Element_Kinds := Not_An_Element; begin Check_Validity (Declaration, Package_Name & "Primitive_Owner"); if not (Arg_Kind = A_Procedure_Declaration or else Arg_Kind = A_Null_Procedure_Declaration or else Arg_Kind = A_Function_Declaration or else Arg_Kind = A_Procedure_Renaming_Declaration or else Arg_Kind = A_Function_Renaming_Declaration or else Arg_Kind = A_Procedure_Body_Declaration or else Arg_Kind = A_Function_Body_Declaration or else Arg_Kind = A_Procedure_Body_Stub or else Arg_Kind = A_Function_Body_Stub) then Raise_ASIS_Inappropriate_Element (Package_Name & "Primitive_Owner", Wrong_Kind => Arg_Kind); end if; if not Is_From_Implicit (Declaration) and then Asis.Declarations.Is_Dispatching_Operation (Declaration) then Arg_Node := Specification (Node (Declaration)); if Nkind (Arg_Node) = N_Function_Specification then if Has_Controlling_Result (Defining_Unit_Name (Arg_Node)) then Res_Node := Defining_Unit_Name (Arg_Node); Res_Node := Parent (Res_Node); Res_Node := Sinfo.Result_Definition (Res_Node); if Nkind (Res_Node) = N_Access_Definition then Res_Node := Sinfo.Subtype_Mark (Res_Node); end if; Res_Node := Entity (Res_Node); end if; end if; if No (Res_Node) then -- This means that we do not have a function with controlling -- result, so we have to go through the formal parameter list, -- and it can not be No_List or empty Par_Node := First (Parameter_Specifications (Arg_Node)); while Present (Par_Node) loop if Is_Controlling_Formal (Defining_Identifier (Par_Node)) then if Nkind (Parameter_Type (Par_Node)) = N_Access_Definition then Res_Node := Sinfo.Subtype_Mark (Parameter_Type (Par_Node)); else Res_Node := Defining_Identifier (Par_Node); end if; Res_Node := Etype (Res_Node); exit; end if; Par_Node := Next (Par_Node); end loop; end if; pragma Assert (Present (Res_Node)); if Nkind (Parent (Res_Node)) = N_Subtype_Declaration then Res_Node := Etype (Res_Node); end if; Res_Node := Parent (Res_Node); case Nkind (Res_Node) is when N_Private_Type_Declaration => if Tagged_Present (Res_Node) then Res_Kind := A_Tagged_Private_Type_Definition; else -- It can be non-tagged, if the full view is tagged Res_Kind := A_Private_Type_Definition; end if; when N_Private_Extension_Declaration => Res_Kind := A_Private_Extension_Definition; when N_Full_Type_Declaration => Res_Node := Sinfo.Type_Definition (Res_Node); when others => pragma Assert (False); null; end case; Result := Node_To_Element_New (Node => Res_Node, Internal_Kind => Res_Kind, Starting_Element => Declaration); end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Declaration, Outer_Call => Package_Name & "Primitive_Owner"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Primitive_Owner", Ex => Ex, Arg_Element => Declaration); end Primitive_Owner; ------------------------ -- Source_File_Status -- ------------------------ function Source_File_Status (Right : Asis.Compilation_Unit) return Source_File_Statuses is Arg_Kind : constant Unit_Kinds := Kind (Right); Result : Source_File_Statuses; begin Check_Validity (Right, Package_Name & "Source_File_Status"); case Arg_Kind is when Not_A_Unit | A_Nonexistent_Declaration | A_Nonexistent_Body | An_Unknown_Unit => Result := Absent; when others => Result := Source_Status (Right); end case; return Result; exception when ASIS_Inappropriate_Compilation_Unit => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Outer_Call => Package_Name & "Source_File_Status"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Source_File_Status", Ex => Ex, Arg_CU => Right); end Source_File_Status; ----------------------------------- -- Static_Expression_Value_Image -- ----------------------------------- function Static_Expression_Value_Image (Expression : Asis.Expression) return Wide_String is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Expression); Arg_Node : Node_Id := Empty; Result : Uint; Tmp_El : Asis.Element; begin Check_Validity (Expression, Package_Name & "Static_Expression_Value_Image"); if Arg_Kind not in Internal_Expression_Kinds then Raise_ASIS_Inappropriate_Element (Package_Name & "Static_Expression_Value_Image", Wrong_Kind => Arg_Kind); end if; if not (Is_True_Expression (Expression) and then Is_Static (Expression)) then return ""; end if; Arg_Node := R_Node (Expression); if Nkind (Arg_Node) = N_String_Literal then String_To_Name_Buffer (Strval (Arg_Node)); return To_Wide_String (Name_Buffer (1 .. Name_Len)); -- elsif Nkind (Arg_Node) = N_Real_Literal then -- begin -- return Long_Long_Float'Wide_Image -- (Get_LF_From_Ureal (Realval (Arg_Node))); -- exception -- when others => return ""; -- end; elsif Has_Enumeration_Type (Expression) or else Has_Integer_Type (Expression) then Result := Eval_Scalar_Node (Arg_Node); UI_Image (Result, Format => Decimal); return To_Wide_String (UI_Image_Buffer (1 .. UI_Image_Length)); else if Expression_Kind (Expression) = A_Selected_Component then Tmp_El := Selector (Expression); else Tmp_El := Expression; end if; if Expression_Kind (Tmp_El) = An_Identifier then begin Tmp_El := Corresponding_Name_Declaration (Tmp_El); exception when ASIS_Inappropriate_Element => Tmp_El := Nil_Element; end; if Declaration_Kind (Tmp_El) = A_Constant_Declaration then Tmp_El := Initialization_Expression (Tmp_El); return Static_Expression_Value_Image (Tmp_El); end if; end if; end if; return ""; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Expression, Outer_Call => Package_Name & "Static_Expression_Value_Image"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Static_Expression_Value_Image", Ex => Ex, Arg_Element => Expression); end Static_Expression_Value_Image; ----------------------------------------- -- Static_Range_High_Bound_Value_Image -- ----------------------------------------- function Static_Range_High_Bound_Value_Image (Range_Element : Asis.Range_Constraint) return Wide_String is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Range_Element); Arg_Node : Node_Id := Empty; Arg_Ekind : Entity_Kind; Result : Uint; begin Check_Validity (Range_Element, Package_Name & "Static_Range_High_Bound_Value_Image"); if not (Arg_Kind = A_Range_Attribute_Reference or else Arg_Kind = A_Discrete_Range_Attribute_Reference_As_Subtype_Definition or else Arg_Kind = A_Discrete_Range_Attribute_Reference) then Raise_ASIS_Inappropriate_Element (Package_Name & "Static_Range_High_Bound_Value_Image", Wrong_Kind => Arg_Kind); end if; if not (Is_Static (Range_Element)) then return ""; end if; Arg_Node := R_Node (Range_Element); if Nkind (Arg_Node) = N_Range_Constraint then Arg_Node := Range_Expression (Arg_Node); end if; Arg_Ekind := Ekind (Etype (Arg_Node)); if not (Arg_Ekind in Discrete_Kind) then -- Implementation limitation!!! return ""; end if; Result := Eval_Scalar_Node (High_Bound (Arg_Node)); UI_Image (Result, Format => Decimal); return To_Wide_String (UI_Image_Buffer (1 .. UI_Image_Length)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Range_Element, Outer_Call => Package_Name & "Static_Range_High_Bound_Value_Image"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Static_Range_High_Bound_Value_Image", Ex => Ex, Arg_Element => Range_Element); end Static_Range_High_Bound_Value_Image; ---------------------------------------- -- Static_Range_Low_Bound_Value_Image -- ---------------------------------------- function Static_Range_Low_Bound_Value_Image (Range_Element : Asis.Range_Constraint) return Wide_String is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Range_Element); Arg_Node : Node_Id := Empty; Arg_Ekind : Entity_Kind; Result : Uint; begin Check_Validity (Range_Element, Package_Name & "Static_Range_Low_Bound_Value_Image"); if not (Arg_Kind = A_Range_Attribute_Reference or else Arg_Kind = A_Discrete_Range_Attribute_Reference_As_Subtype_Definition or else Arg_Kind = A_Discrete_Range_Attribute_Reference) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Static_Range_Low_Bound_Value_Image", Wrong_Kind => Arg_Kind); end if; if not (Is_Static (Range_Element)) then return ""; end if; Arg_Node := R_Node (Range_Element); if Nkind (Arg_Node) = N_Range_Constraint then Arg_Node := Range_Expression (Arg_Node); end if; Arg_Ekind := Ekind (Etype (Arg_Node)); if not (Arg_Ekind in Discrete_Kind) then -- Implementation limitation!!! return ""; end if; Result := Eval_Scalar_Node (Low_Bound (Arg_Node)); UI_Image (Result, Format => Decimal); return To_Wide_String (UI_Image_Buffer (1 .. UI_Image_Length)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Range_Element, Outer_Call => Package_Name & "Static_Range_Low_Bound_Value_Image"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Static_Range_Low_Bound_Value_Image", Ex => Ex, Arg_Element => Range_Element); end Static_Range_Low_Bound_Value_Image; end Asis.Extensions;
projects/batfish/src/org/batfish/grammar/flatjuniper/FlatJuniper_routing_instances.g4
Alexia23/batfish
1
2221
parser grammar FlatJuniper_routing_instances; import FlatJuniper_common, FlatJuniper_protocols; options { tokenVocab = FlatJuniperLexer; } agt_as_path : AS_PATH PATH path = as_path_expr ; agt_preference : PREFERENCE preference = DEC ; bmpt_station_address : STATION_ADDRESS IP_ADDRESS ; bmpt_station_port : STATION_PORT DEC ; gt_discard : DISCARD ; gt_metric : METRIC metric = DEC ; gt_policy : POLICY policy = variable ; irfit_export : EXPORT ( LAN | POINT_TO_POINT ) ; irft_inet : INET irft_inet_tail ; irft_inet_tail : irfit_export ; irft_null : INET6 s_null_filler ; irrgt_inet : INET name = variable ; irrgt_null : INET6 s_null_filler ; irt_family : FAMILY irt_family_tail ; irt_family_tail : irft_inet | irft_null ; irt_rib_group : RIB_GROUP irt_rib_group_tail ; irt_rib_group_tail : irrgt_inet | irrgt_null ; rgt_export_rib : EXPORT_RIB rib = variable ; rgt_import_policy : IMPORT_POLICY name = variable ; rgt_import_rib : IMPORT_RIB rib = variable ; ribt_aggregate : AGGREGATE ROUTE ( IP_PREFIX | IPV6_PREFIX ) ribt_aggregate_tail ; ribt_apply_groups : s_apply_groups ; ribt_aggregate_tail : agt_as_path | agt_preference ; ribt_generate : rot_generate ; ribt_static : rot_static ; rit_apply_groups : s_apply_groups ; rit_apply_groups_except : s_apply_groups_except ; rit_common : rit_apply_groups | rit_apply_groups_except | rit_description | rit_routing_options ; rit_description : s_description ; rit_instance_type : INSTANCE_TYPE ( FORWARDING | L2VPN | VIRTUAL_SWITCH | VRF ) ; rit_interface : INTERFACE id = interface_id ; rit_named_routing_instance : ( WILDCARD | name = variable ) rit_named_routing_instance_tail ; rit_named_routing_instance_tail : rit_common | rit_instance_type | rit_interface | rit_null | rit_protocols | rit_route_distinguisher | rit_vrf_export | rit_vrf_import | rit_vrf_table_label | rit_vrf_target ; rit_null : ( BRIDGE_DOMAINS | CHASSIS | CLASS_OF_SERVICE | EVENT_OPTIONS | FORWARDING_OPTIONS | PROVIDER_TUNNEL | SERVICES | SNMP ) s_null_filler ; rit_protocols : s_protocols ; rit_route_distinguisher : ROUTE_DISTINGUISHER ( DEC | IP_ADDRESS ) COLON DEC ; rit_routing_options : s_routing_options ; rit_vrf_export : VRF_EXPORT name = variable ; rit_vrf_import : VRF_IMPORT name = variable ; rit_vrf_table_label : VRF_TABLE_LABEL ; rit_vrf_target : VRF_TARGET rit_vrf_target_tail ; rit_vrf_target_tail : vtt_community | vtt_export | vtt_import ; rot_aggregate : AGGREGATE ROUTE IP_PREFIX ( ( AS_PATH ORIGIN IGP ) | ( COMMUNITY community = COMMUNITY_LITERAL ) | ( TAG tag = DEC ) )* ; rot_auto_export : AUTO_EXPORT ; rot_autonomous_system : AUTONOMOUS_SYSTEM as = DEC ; rot_martians : MARTIANS s_null_filler ; rot_bmp : BMP rot_bmp_tail ; rot_bmp_tail : bmpt_station_address | bmpt_station_port ; rot_generate : GENERATE ROUTE ( IP_PREFIX | IPV6_PREFIX ) rot_generate_tail ; rot_generate_tail : gt_discard | gt_metric | gt_policy ; rot_interface_routes : INTERFACE_ROUTES rot_interface_routes_tail ; rot_interface_routes_tail : irt_family | irt_rib_group ; rot_null : ( FORWARDING_TABLE | MULTICAST | MULTIPATH | NONSTOP_ROUTING | OPTIONS | PPM | RESOLUTION | TRACEOPTIONS ) s_null_filler ; rot_rib_groups : RIB_GROUPS name = variable rot_rib_groups_tail ; rot_rib_groups_tail : rgt_export_rib | rgt_import_policy | rgt_import_rib ; rot_rib : RIB ( name = VARIABLE | WILDCARD ) rot_rib_tail ; rot_rib_tail : // intentional blank | ribt_aggregate | ribt_apply_groups | ribt_generate | ribt_static ; rot_router_id : ROUTER_ID id = IP_ADDRESS ; rot_static : STATIC rot_static_tail ; rot_static_tail : rst_rib_group | rst_route ; rot_srlg : SRLG rot_srlg_tail ; rot_srlg_tail : srlgt_named ; rst_rib_group : RIB_GROUP name = variable ; rst_route : ROUTE ( IP_PREFIX | IPV6_PREFIX ) rst_route_tail ; rst_route_tail : srt_common | srt_qualified_next_hop ; s_routing_instances : ROUTING_INSTANCES s_routing_instances_tail ; s_routing_instances_tail : rit_common | rit_named_routing_instance ; s_routing_options : ROUTING_OPTIONS s_routing_options_tail ; s_routing_options_tail : rot_aggregate | rot_auto_export | rot_autonomous_system | rot_bmp | rot_generate | rot_interface_routes | rot_martians | rot_null | rot_rib | rot_rib_groups | rot_router_id | rot_srlg | rot_static ; srlgnt_srlg_cost : SRLG_COST cost = DEC ; srlgnt_srlg_value : SRLG_VALUE value = DEC ; srlgt_named : name = variable srlgt_named_tail ; srlgt_named_tail : srlgnt_srlg_cost | srlgnt_srlg_value ; srt_active : ACTIVE ; srt_as_path : AS_PATH PATH ( path += DEC )+ ; srt_common : srt_active | srt_as_path | srt_community | srt_discard | srt_install | srt_next_hop | srt_next_table | srt_no_readvertise | srt_no_retain | srt_passive | srt_preference | srt_readvertise | srt_reject | srt_resolve | srt_retain | srt_tag ; srt_community : COMMUNITY standard_community ; srt_discard : DISCARD ; srt_install : INSTALL ; srt_next_hop : NEXT_HOP ( IP_ADDRESS | IPV6_ADDRESS | interface_id ) ; srt_next_table : NEXT_TABLE name = variable ; srt_no_readvertise : NO_READVERTISE ; srt_no_retain : NO_RETAIN ; srt_passive : PASSIVE ; srt_preference : PREFERENCE pref = DEC ; srt_qualified_next_hop : QUALIFIED_NEXT_HOP nexthop = IP_ADDRESS srt_common? ; srt_readvertise : READVERTISE ; srt_reject : REJECT ; srt_resolve : RESOLVE ; srt_retain : RETAIN ; srt_tag : TAG tag = DEC ; vtt_community : extended_community ; vtt_export : EXPORT extended_community ; vtt_import : IMPORT extended_community ;
obj/boot/boot.asm
baquiax/cc7-lab3
0
29126
obj/boot/boot.out: formato del fichero elf32-i386 Desensamblado de la sección .text: 00007c00 <start>: start: # FIRST PHASE: Register y operation mode setup. # Assemble for 16-bit mode .code16 cli 7c00: fa cli # Set up the important data segment registers (DS, ES, SS). xorw %ax,%ax # Segment number zero 7c01: 31 c0 xor %eax,%eax movw %ax,%ds # -> Data Segment 7c03: 8e d8 mov %eax,%ds movw %ax,%es # -> Extra Segment 7c05: 8e c0 mov %eax,%es movw %ax,%ss # -> Stack Segment 7c07: 8e d0 mov %eax,%ss lgdt gdtdesc # load GDT: mandatory in protected mode 7c09: 0f 01 16 lgdtl (%esi) 7c0c: 54 push %esp 7c0d: 7c 0f jl 7c1e <protcseg+0x1> movl %cr0, %eax # Turn on protected mode 7c0f: 20 c0 and %al,%al orl $CR0_PE_ON, %eax 7c11: 66 83 c8 01 or $0x1,%ax movl %eax, %cr0 7c15: 0f 22 c0 mov %eax,%cr0 # CPU magic: jump to relocation, flush prefetch queue, and # reload %cs. Has the effect of just jmp to the next # instruction, but simultaneously loads CS with # $PROT_MODE_CSEG. ljmp $PROT_MODE_CSEG, $protcseg 7c18: ea 1d 7c 08 00 66 b8 ljmp $0xb866,$0x87c1d 00007c1d <protcseg>: # to generate code for that mode .code32 protcseg: # Set up the protected-mode data segment registers movw $PROT_MODE_DSEG, %ax # Our data segment selector 7c1d: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds # -> DS: Data Segment 7c21: 8e d8 mov %eax,%ds movw %ax, %es # -> ES: Extra Segment 7c23: 8e c0 mov %eax,%es movw %ax, %fs # -> FS 7c25: 8e e0 mov %eax,%fs movw %ax, %gs # -> GS 7c27: 8e e8 mov %eax,%gs movw %ax, %ss # -> SS: Stack Segment 7c29: 8e d0 mov %eax,%ss # #Agregue aquí su codigo para resolver el inciso 2) #de las actividades asignadas # # movb $0x67,0xB8000 7c2b: c6 05 00 80 0b 00 67 movb $0x67,0xb8000 movb $0x1E,0xB8001 7c32: c6 05 01 80 0b 00 1e movb $0x1e,0xb8001 00007c39 <hang>: #call printString hang: jmp hang 7c39: eb fe jmp 7c39 <hang> 7c3b: 90 nop 00007c3c <gdt>: ... 00007c44 <gdt_code>: 7c44: ff (bad) 7c45: ff 00 incl (%eax) 7c47: 00 00 add %al,(%eax) 7c49: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf 00007c4c <gdt_data>: 7c4c: ff (bad) 7c4d: ff 00 incl (%eax) 7c4f: 00 00 add %al,(%eax) 7c51: 92 xchg %eax,%edx 7c52: cf iret ... 00007c54 <gdt_end>: 7c54: 17 pop %ss 7c55: 00 3c 7c add %bh,(%esp,%edi,2) ... 00007c5a <cls>: const char *cadena = "Bienvenido al GOS"; void cls() { 7c5a: 55 push %ebp unsigned char *vidmem = (unsigned char *)0xB8000; 7c5b: b8 00 80 0b 00 mov $0xb8000,%eax const char *cadena = "Bienvenido al GOS"; void cls() { 7c60: 89 e5 mov %esp,%ebp const long size = 80*25; long loop; for (loop=0; loop<size; loop++) { *vidmem++ = 0; 7c62: c6 00 00 movb $0x0,(%eax) 7c65: 83 c0 02 add $0x2,%eax { unsigned char *vidmem = (unsigned char *)0xB8000; const long size = 80*25; long loop; for (loop=0; loop<size; loop++) 7c68: 3d a0 8f 0b 00 cmp $0xb8fa0,%eax { *vidmem++ = 0; *vidmem++ = 0xA; 7c6d: c6 40 ff 0a movb $0xa,-0x1(%eax) { unsigned char *vidmem = (unsigned char *)0xB8000; const long size = 80*25; long loop; for (loop=0; loop<size; loop++) 7c71: 75 ef jne 7c62 <cls+0x8> { *vidmem++ = 0; *vidmem++ = 0xA; } } 7c73: 5d pop %ebp 7c74: c3 ret 00007c75 <print>: void print(const char *_message) { 7c75: 55 push %ebp unsigned char *vidmem = (unsigned char *)0xB8000; 7c76: b8 00 80 0b 00 mov $0xb8000,%eax *vidmem++ = 0xA; } } void print(const char *_message) { 7c7b: 89 e5 mov %esp,%ebp unsigned char *vidmem = (unsigned char *)0xB8000; const long size = 80*25; long loop; while(*cadena!=0) { 7c7d: 8b 15 40 7d 00 00 mov 0x7d40,%edx 7c83: 8a 12 mov (%edx),%dl 7c85: 84 d2 test %dl,%dl 7c87: 74 11 je 7c9a <print+0x25> *vidmem++ = *cadena; 7c89: 88 10 mov %dl,(%eax) 7c8b: 83 c0 02 add $0x2,%eax *vidmem++ = 0x1E; 7c8e: c6 40 ff 1e movb $0x1e,-0x1(%eax) *cadena++; 7c92: ff 05 40 7d 00 00 incl 0x7d40 7c98: eb e3 jmp 7c7d <print+0x8> } } 7c9a: 5d pop %ebp 7c9b: c3 ret 00007c9c <printString>: int printString() { 7c9c: 55 push %ebp 7c9d: 89 e5 mov %esp,%ebp cls(); 7c9f: e8 b6 ff ff ff call 7c5a <cls> print(cadena); 7ca4: ff 35 40 7d 00 00 pushl 0x7d40 7caa: e8 c6 ff ff ff call 7c75 <print> return 0; } 7caf: 31 c0 xor %eax,%eax 7cb1: c9 leave 7cb2: c3 ret
test_programs/eae.asm
mfkiwl/QNICE-FPGA-hyperRAM
53
14325
<gh_stars>10-100 ; EAE - Extended Arithmetic Element test ; assumes that each EAE calculation is done combinatorically, i.e. that ; there is no need to wait for the 'busy' signal of the EAE ; done by sy2002 in May 2016 #include "../dist_kit/sysdef.asm" #include "../dist_kit/monitor.def" .ORG 0x8000 ; EAE registers MOVE IO$EAE_OPERAND_0, R0 MOVE IO$EAE_OPERAND_1, R1 MOVE IO$EAE_RESULT_LO, R2 MOVE IO$EAE_RESULT_HI, R3 MOVE IO$EAE_CSR, R4 ; unsigned: 0x91D9 x 0x2CB1 = 0x19762309 MOVE 0x91D9, @R0 MOVE 0x2CB1, @R1 MOVE EAE$MULU, @R4 MOVE @R3, R8 SYSCALL(puthex, 1) MOVE @R2, R8 SYSCALL(puthex, 1) SYSCALL(crlf, 1) ; signed: decimal -13.422 x 50 = -671.100 = 0xFFF5C284 MOVE -13422, @R0 MOVE 50, @R1 MOVE EAE$MULS, @R4 MOVE @R3, R8 SYSCALL(puthex, 1) MOVE @R2, R8 SYSCALL(puthex, 1) SYSCALL(crlf, 1) ; unsigned: 0x2309 / 0x0076 = 0x004C and modulo is 0x0001 ; so the printed output is 004C0001 MOVE 0x2309, @R0 MOVE 0x0076, @R1 MOVE EAE$DIVU, @R4 MOVE @R2, R8 SYSCALL(puthex, 1) MOVE @R3, R8 SYSCALL(puthex, 1) SYSCALL(crlf, 1) ; signed: decimal -32.009 / 16 = -2.000 = modulo is 9 ; so the printed output is F8300007 MOVE -32009, @R0 MOVE 16, @R1 MOVE EAE$DIVS, @R4 MOVE @R2, R8 SYSCALL(puthex, 1) MOVE @R3, R8 SYSCALL(puthex, 1) SYSCALL(crlf, 1) SYSCALL(exit, 1)
3-mid/impact/source/3d/collision/broadphase/impact-d3-collision-overlapped_pair_callback.ads
charlie5/lace
20
22671
<gh_stars>10-100 with impact.d3.collision.Proxy, impact.d3.Dispatcher; package impact.d3.collision.overlapped_pair_Callback -- -- The impact.d3.collision.overlapped_pair_Callback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar -- interface to impact.d3.collision.overlapped_pair_Callback.cached. -- is type Item is abstract tagged null record; --- Forge -- procedure destruct (Self : in out Item) is null; --- Attributes -- function addOverlappingPair (Self : access Item; proxy0, proxy1 : access impact.d3.collision.Proxy.item'Class) return access impact.d3.collision.Proxy.btBroadphasePair is abstract; function removeOverlappingPair (Self : access Item; proxy0, proxy1 : access impact.d3.collision.Proxy.item'Class; dispatcher : access impact.d3.Dispatcher.item'Class) return access Any'Class is abstract; procedure removeOverlappingPairsContainingProxy (Self : access Item; proxy0 : access impact.d3.collision.Proxy.item'Class; dispatcher : access impact.d3.Dispatcher.item'Class) is abstract; end impact.d3.collision.overlapped_pair_Callback; -- class impact.d3.Dispatcher; -- struct btBroadphasePair; -- class impact.d3.collision.overlapped_pair_Callback -- { -- public: -- virtual void* removeOverlappingPair(impact.d3.collision.Proxy* proxy0,impact.d3.collision.Proxy* proxy1,impact.d3.Dispatcher* dispatcher) = 0; -- -- virtual void removeOverlappingPairsContainingProxy(impact.d3.collision.Proxy* proxy0,impact.d3.Dispatcher* dispatcher) = 0; -- -- };
programs/oeis/120/A120437.asm
karttu/loda
1
96150
; A120437: Differences of A037314 (sum of base-3 digits of n = sum of base-9 digits of n). ; 1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,4921,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,4921,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,547,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,61,1,1,7,1,1,7,1,1,44287,1,1,7,1,1,7,1 add $0,1 pow $0,2 gcd $0,43046721 mov $1,$0 div $1,8 mul $1,6 add $1,1
src/mmap/sample2/asm.asm
freepvps/hseos
0
11266
f: imul %esi,%edi lea 0x1(%rdi),%eax retq
oeis/313/A313721.asm
neoneye/loda-programs
11
15515
<gh_stars>10-100 ; A313721: Coordination sequence Gal.5.129.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME>(s3) ; 1,5,10,15,20,24,29,34,39,44,49,54,59,64,68,73,78,83,88,93,98,103,108,112,117,122,127,132,137,142,147,152,156,161,166,171,176,181,186,191,196,200,205,210,215,220,225,230,235,240 mul $0,88 div $0,9 sub $0,1 div $0,2 add $0,1
base/crts/crtw32/string/i386/memset.asm
npocmaka/Windows-Server-2003
17
103064
<filename>base/crts/crtw32/string/i386/memset.asm page ,132 title memset - set sections of memory all to one byte ;*** ;memset.asm - set a section of memory to all one byte ; ; Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved. ; ;Purpose: ; contains the memset() routine ; ;Revision History: ; 05-07-84 RN initial version ; 06-30-87 SKS faster algorithm ; 05-17-88 SJM Add model-independent (large model) ifdef ; 08-04-88 SJM convert to cruntime/ add 32-bit support ; 08-19-88 JCR Enable word alignment code for all models/CPUs, ; Some code improvement ; 10-25-88 JCR General cleanup for 386-only code ; 10-27-88 JCR More optimization (dword alignment, no ebx usage, etc) ; 03-23-90 GJF Changed to _stdcall. Also, fixed the copyright. ; 05-10-91 GJF Back to _cdecl, sigh... ; 01-23-95 GJF Improved routine from Intel Israel. I fixed up the ; formatting and comments. ; 01-24-95 GJF Added FPO directive. ; 06-12-01 PML inc->add 1, dec->sub 1 for Pentium 4 perf (vs7#267015) ; ;******************************************************************************* .xlist include cruntime.inc .list page ;*** ;char *memset(dst, value, count) - sets "count" bytes at "dst" to "value" ; ;Purpose: ; Sets the first "count" bytes of the memory starting ; at "dst" to the character value "value". ; ; Algorithm: ; char * ; memset (dst, value, count) ; char *dst; ; char value; ; unsigned int count; ; { ; char *start = dst; ; ; while (count--) ; *dst++ = value; ; return(start); ; } ; ;Entry: ; char *dst - pointer to memory to fill with value ; char value - value to put in dst bytes ; int count - number of bytes of dst to fill ; ;Exit: ; returns dst, with filled bytes ; ;Uses: ; ;Exceptions: ; ;******************************************************************************* CODESEG public memset memset proc .FPO ( 0, 3, 0, 0, 0, 0 ) mov edx,[esp + 0ch] ; edx = "count" mov ecx,[esp + 4] ; ecx points to "dst" test edx,edx ; 0? jz short toend ; if so, nothing to do xor eax,eax mov al,[esp + 8] ; the byte "value" to be stored ; Align address on dword boundary push edi ; preserve edi mov edi,ecx ; edi = dest pointer cmp edx,4 ; if it's less then 4 bytes jb tail ; tail needs edi and edx to be initialized neg ecx and ecx,3 ; ecx = # bytes before dword boundary jz short dwords ; jump if address already aligned sub edx,ecx ; edx = adjusted count (for later) adjust_loop: mov [edi],al add edi,1 sub ecx,1 jnz adjust_loop dwords: ; set all 4 bytes of eax to [value] mov ecx,eax ; ecx=0/0/0/value shl eax,8 ; eax=0/0/value/0 add eax,ecx ; eax=0/0val/val mov ecx,eax ; ecx=0/0/val/val shl eax,10h ; eax=val/val/0/0 add eax,ecx ; eax = all 4 bytes = [value] ; Set dword-sized blocks mov ecx,edx ; move original count to ecx and edx,3 ; prepare in edx byte count (for tail loop) shr ecx,2 ; adjust ecx to be dword count jz tail ; jump if it was less then 4 bytes rep stosd main_loop_tail: test edx,edx ; if there is no tail bytes, jz finish ; we finish, and it's time to leave ; Set remaining bytes tail: mov [edi],al ; set remaining bytes add edi,1 sub edx,1 ; if there is some more bytes jnz tail ; continue to fill them ; Done finish: mov eax,[esp + 8] ; return dest pointer pop edi ; restore edi ret toend: mov eax,[esp + 4] ; return dest pointer ret memset endp end
programs/oeis/117/A117304.asm
karttu/loda
0
27984
<reponame>karttu/loda ; A117304: Numbers with an even number of digits such that the second half is twice the first half. ; 12,24,36,48,1020,1122,1224,1326,1428,1530,1632,1734,1836,1938,2040,2142,2244,2346,2448,2550,2652,2754,2856,2958,3060,3162,3264,3366,3468,3570,3672,3774,3876,3978,4080,4182,4284,4386,4488,4590,4692,4794,4896 mov $13,$0 mov $15,$0 add $15,1 lpb $15,1 mov $0,$13 sub $15,1 sub $0,$15 mov $9,$0 mov $11,2 lpb $11,1 clr $0,9 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mov $2,6 mov $8,3 lpb $0,1 mov $1,$2 add $8,$0 mov $0,3 add $8,7 mul $1,$8 sub $1,20 lpe mov $12,$11 lpb $12,1 mov $10,$1 sub $12,1 lpe lpe lpb $9,1 mov $9,0 sub $10,$1 lpe mov $1,$10 div $1,2 mul $1,30 add $1,12 add $14,$1 lpe mov $1,$14
c6ers/interlnk/driver/drmain.asm
minblock/msdos
0
100595
<reponame>minblock/msdos ;*** ;* $Workfile: main.asm $ ;* $Revision: 1.5 $ ;* $Author: <NAME> $ ;* $Date: 08 Aug 1989 16:44:52 $ ;*** TITLE Main program for driver when run as a .EXE file PAGE 66, 132 INCLUDE drivers.mac INCLUDE packets.mac INCLUDE debug.mac INIT SEGMENT WORD PUBLIC 'CODE' EXTRN print_msg:NEAR EXTRN toupper:NEAR EXTRN is_alpha:NEAR EXTRN show_char:NEAR EXTRN show_units:NEAR EXTRN show_printers:NEAR EXTRN signon:NEAR EXTRN get_dos_version:NEAR EXTRN show_crlf:NEAR EXTRN connect:NEAR EXTRN requires_dos3:BYTE EXTRN m_not_installed:BYTE EXTRN invalid_switch:BYTE EXTRN doslink_help:BYTE EXTRN m_drive_syntax:BYTE EXTRN m_drive_map:BYTE EXTRN m_client_letter:BYTE EXTRN m_server_letter:BYTE EXTRN m_not_connected:BYTE EXTRN m_dl_ver_mismatch:BYTE EXTRN show_drive_map:NEAR EXTRN show_prn_map:NEAR EXTRN m_lost_connect:BYTE EXTRN device_high:BYTE EXTRN init_size:WORD EXTRN low_memory:BYTE EXTRN driver_size:WORD INIT ENDS BLOCK SEGMENT WORD PUBLIC 'CODE' EXTRN block_start:BYTE EXTRN block_init_end:BYTE BLOCK ENDS CORE SEGMENT WORD PUBLIC 'CODE' EXTRN end_low_stub:BYTE EXTRN end_core_data:BYTE EXTRN finger_print:BYTE EXTRN major_version:WORD EXTRN dos_major:BYTE EXTRN strat_seg:WORD EXTRN driver_call:DWORD EXTRN drive_mapping:BYTE EXTRN default_mapping:BYTE EXTRN printer_loaded:BYTE EXTRN first_unit:BYTE EXTRN units:BYTE EXTRN slave_units:BYTE EXTRN is_serial:BYTE EXTRN idle_semaphore:BYTE EXTRN gri_proc:NEAR CORE ENDS STACK SEGMENT WORD STACK 'STACK' db 512 dup(?) STACK ENDS MAIN SEGMENT WORD PUBLIC 'CODE' psp dw ? help db 0 ; Set to TRUE if help display desired startup PROC FAR cld push cs pop ds call get_dos_version cmp dos_major, 2 ja get_psp pmsg requires_dos3 jmp short error_exit get_psp: mov ah, 62H int 21H mov cs:psp, bx ; Save PSP and pass to show_help in BX call show_help ; Show help if requested jc normal_exit ; and exit if help was shown call find_driver jc error_exit call parse_mappings jc drive_syntax call show_crlf call connect ; NOTE: turns off idling pushf call reset_map ; Reset default map. popf jnc process_cmd ; If connected, process command line pmsg m_not_connected jmp short error_exit process_cmd: call show_drive_map jc error_exit call show_prn_map normal_exit: mov idle_semaphore, MINIMUM_TICKS + 1 ; Turn on idling mov ax, 4C00H ; Terminate with code 0 int 21H drive_syntax: pmsg m_drive_syntax error_exit: mov ax, 4C01H ; Terminate with code 1 int 21H lost_connect: pmsg m_lost_connect jmp error_exit startup ENDP reset_map PROC NEAR push ds pop es mov al, DONT_CARE mov di, DVR:default_mapping mov cx, MAX_DEVICES rep stosb ret reset_map ENDP show_help PROC NEAR ; Enter with: ; BX = PSP segment ; Return: ; NC - Help was not requested (with "/?" on command line). ; C - Help was requested and displayed. mov es, bx mov si, 81H ; Point ES:SI to cmd line in PSP sh_loop: mov ax, es:[si] cmp al, ' ' jb sh_no_help cmp ax, "?/" jne sh_next pmsg doslink_help stc jmp short sh_ret sh_next: inc si jmp sh_loop sh_no_help: clc sh_ret: ret show_help ENDP local_drive db ? parse_mappings PROC NEAR mov es, cs:psp mov si, 81H ; Point ES:SI to cmd line in PSP pm_grab_char: mov al, es:[si] call toupper inc si cmp al, '/' je skip_arg cmp al, ',' je pm_grab_char cmp al, ':' je pm_grab_char cmp al, ' ' je pm_grab_char jb parse_ok call is_alpha jc parse_error sub al, 'A' cmp al, MAX_DEVICES jae parse_error sub al, first_unit mov cs:local_drive, al look_equal: mov al, es:[si] call toupper cmp al, ' ' jb parse_error inc si cmp al, ':' je look_equal cmp al, '=' jne parse_error look_server: mov al, es:[si] call toupper xor bh, bh mov bl, cs:local_drive cmp al, ' ' jbe deassign cmp al, ':' je swallow_colon cmp bl, units jae parse_error call is_alpha jc deassign inc si cmp al, 'Z' ja parse_error sub al, 'A' mov ah, UNASSIGNED mov dx, ds call delete_server jmp short store_mapping deassign: mov al, UNASSIGNED store_mapping: mov drive_mapping[bx], al mov default_mapping[bx], al jmp pm_grab_char swallow_colon: inc si jmp look_server skip_arg: mov al, es:[si] cmp al, ' ' je pm_grab_char jb parse_ok inc si jmp skip_arg parse_error: stc jmp short pm_parse_exit parse_ok: clc pm_parse_exit: ret parse_mappings ENDP delete_server PROC NEAR ; Enter with: ; AL = server drive letter ; AH = replacement value if found (DONT_CARE or UNASSIGNED) ; DX = segment of map table push cx push di push es mov es, dx mov di, DVR:drive_mapping mov cx, MAX_DEVICES repne scasb jne del_done mov BYTE PTR es:[di - 1], ah del_done: pop es pop di pop cx ret delete_server ENDP find_driver PROC NEAR mov ax, 352FH int 21H mov ax, es or ax, bx jz not_found mov ax, (INTERLNK_MULTIPLEX_ID SHL 8) OR 0 mov bl, 0 mov dx, 0FFFFH int 2FH cmp al, 0FFH jne not_found cmp dx, 0FFFFH je not_found mov es, dx mov si, DVR:finger_print mov di, si mov cx, 8 repe cmpsb je found not_found: pmsg m_not_installed fd_show_prog: call print_prog_name call show_crlf stc jmp short find_ret found: cmp WORD PTR es:major_version, (MAJOR_VER OR (MINOR_VER SHL 8)) je same_version pmsg m_dl_ver_mismatch jmp fd_show_prog same_version: mov ds, es:strat_seg clc find_ret: ret find_driver ENDP IFDEF DEBUG show_hex_byte PROC NEAR push ax push cx push dx mov cl, 4 shl ax, cl shr al, cl and ax, 0F0FH mov dl, ah call show_hex_nibble mov dl, al call show_hex_nibble mov dl, ' ' call show_char pop dx pop cx pop ax ret show_hex_byte ENDP show_hex_nibble PROC NEAR add dl, '0' cmp dl, '9' jbe show_nibble add dl, 7 show_nibble: call show_char ret show_hex_nibble ENDP ENDIF print_prog_name PROC NEAR mov es, cs:psp mov es, es:[2CH] ;Get segment of environment xor di, di xor ax, ax mov cx, 8000H scan_end: repne scasb scasb jne scan_end inc di inc di print_prog: mov dl, es:[di] mov ah, 6 int 21H inc di or al, al jnz print_prog ret print_prog_name ENDP MAIN ENDS END startup
core/lib/groups/PropSubgroup.agda
cmknapp/HoTT-Agda
0
16044
{-# OPTIONS --without-K #-} open import lib.Basics open import lib.NType2 open import lib.types.Group open import lib.types.Sigma open import lib.types.Truncation open import lib.groups.Homomorphisms module lib.groups.PropSubgroup where module _ {i} (G : Group i) where private module G = Group G module PropSubgroup {j} (P : G.El → Type j) (P-level : ∀ g → has-level -1 (P g)) (P-ident : P G.ident) (P-inv : ∀ {g} → P g → P (G.inv g)) (P-comp : ∀ {g₁ g₂} → P g₁ → P g₂ → P (G.comp g₁ g₂)) where struct : GroupStructure (Σ G.El P) struct = record { ident = (G.ident , P-ident); inv = λ {(g , p) → (G.inv g , P-inv p)}; comp = λ {(g₁ , p₁) (g₂ , p₂) → (G.comp g₁ g₂ , P-comp p₁ p₂)}; unitl = λ {(g , _) → pair= (G.unitl g) (prop-has-all-paths-↓ (P-level _))}; unitr = λ {(g , _) → pair= (G.unitr g) (prop-has-all-paths-↓ (P-level _))}; assoc = λ {(g₁ , _) (g₂ , _) (g₃ , _) → pair= (G.assoc g₁ g₂ g₃) (prop-has-all-paths-↓ (P-level _))}; invl = λ {(g , _) → pair= (G.invl g) (prop-has-all-paths-↓ (P-level _))}; invr = λ {(g , _) → pair= (G.invr g) (prop-has-all-paths-↓ (P-level _))}} Subgroup : Group (lmax i j) Subgroup = group _ (Σ-level G.El-level (raise-level _ ∘ P-level)) struct inj : Subgroup →ᴳ G inj = record { f = λ {(g , _) → g}; pres-comp = λ _ _ → idp} module _ {j} {H : Group j} (φ : H →ᴳ G) where private module H = Group H module φ = GroupHom φ prop-hom : Π H.El (P ∘ φ.f) → (H →ᴳ Subgroup) prop-hom p = record { f = λ g → (φ.f g , p g); pres-comp = λ g₁ g₂ → pair= (φ.pres-comp g₁ g₂) (prop-has-all-paths-↓ (P-level _))} module _ {i} {j} {G : Group i} {H : Group j} (φ : G →ᴳ H) where private module G = Group G module H = Group H module φ = GroupHom φ module Ker = PropSubgroup G (λ g → φ.f g == H.ident) (λ g → H.El-level _ _) φ.pres-ident (λ p → φ.pres-inv _ ∙ ap H.inv p ∙ group-inv-ident H) (λ p₁ p₂ → φ.pres-comp _ _ ∙ ap2 H.comp p₁ p₂ ∙ H.unitl _) module Im = PropSubgroup H (λ h → Trunc -1 (Σ G.El (λ g → φ.f g == h))) (λ h → Trunc-level) ([ G.ident , φ.pres-ident ]) (Trunc-fmap (λ {(g , p) → (G.inv g , φ.pres-inv g ∙ ap H.inv p)})) (Trunc-fmap2 (λ {(g₁ , p₁) (g₂ , p₂) → (G.comp g₁ g₂ , φ.pres-comp g₁ g₂ ∙ ap2 H.comp p₁ p₂)})) open Ker public renaming (struct to ker-struct; Subgroup to Ker; inj to ker-inj; prop-hom to ker-hom) open Im public renaming (struct to im-struct; Subgroup to Im; inj to im-inj; prop-hom to im-out-hom) im-in-hom : G →ᴳ Im im-in-hom = record { f = λ g → (φ.f g , [ g , idp ]); pres-comp = λ g₁ g₂ → pair= (φ.pres-comp g₁ g₂) (prop-has-all-paths-↓ Trunc-level)} im-in-surj : (h : Group.El Im) → Trunc -1 (Σ G.El (λ g → GroupHom.f im-in-hom g == h)) im-in-surj (_ , s) = Trunc-fmap (λ {(g , p) → (g , pair= p (prop-has-all-paths-↓ Trunc-level))}) s
src/kafka-topic-partition.adb
Latence-Technologies/Kafka-Ada
0
6186
package body Kafka.Topic.Partition is procedure List_Add(List : Partition_List_Type; Topic : String; Partition : Integer_32) is C_Topic : chars_ptr := New_String(Topic); Unused : System.Address; begin Unused := rd_kafka_topic_partition_list_add(List, C_Topic, Partition); Free(C_Topic); end List_Add; procedure List_Add_Range(List : Partition_List_Type; Topic : String; Start : Integer_32; Stop : Integer_32) is C_Topic : chars_ptr := New_String(Topic); begin rd_kafka_topic_partition_list_add_range(List, C_Topic, Start, Stop); Free(C_Topic); end List_Add_Range; function List_Delete(List : Partition_List_Type; Topic : String; Partition : Integer_32) return Boolean is C_Topic : chars_ptr := New_String(Topic); Result : int; begin Result := rd_kafka_topic_partition_list_del(List, C_Topic, Partition); Free(C_Topic); return Result = 1; end List_Delete; end Kafka.Topic.Partition;
arch/ARM/STM32/driversL5/stm32-sau.adb
morbos/Ada_Drivers_Library
2
1149
package body STM32.SAU is type RLAR_Overlay (As_32Bit : Boolean := False) is record case As_32Bit is when False => Val : HAL.UInt32; when True => Reg : SAU_RLAR_Register; end case; end record with Unchecked_Union, Size => 32; procedure Add_Region (Region_Num : SAU_Regions; Addr : UInt32; Size : UInt32; NSC : Boolean) is A : UInt32; X : SAU_RBAR_Register; for X'Address use A'Address; L : RLAR_Overlay; begin A := Addr; SAU_Periph.SAU_RNR.REGION := UInt8 (Region_Num); SAU_Periph.SAU_RBAR.BADDR := X.BADDR; L.Val := UInt32 (Addr); L.Val := L.Val + Size; L.Reg.NSC := NSC; L.Reg.ENABLE := True; SAU_Periph.SAU_RLAR := L.Reg; end Add_Region; procedure Enable_SAU is begin SAU_Periph.SAU_CTRL.ENABLE := True; end Enable_SAU; procedure All_NS is begin SAU_Periph.SAU_CTRL.ENABLE := False; SAU_Periph.SAU_CTRL.ALLNS := True; end All_NS; end STM32.SAU;