max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
libsrc/msx/gen_ldirvm.asm
meesokim/z88dk
0
178114
; ; z88dk library: Generic VDP support code ; ; FILVRM ; ; ; $Id: gen_ldirvm.asm,v 1.2 2015/01/19 01:32:57 pauloscustodio Exp $ ; PUBLIC LDIRVM EXTERN SETWRT INCLUDE "msx/vdp.inc" LDIRVM: ex de,hl call SETWRT loop: ld a,(de) out (VDP_DATA),a inc de dec bc ld a,b or c jr nz,loop ret
feature_2_convert_format_time_string.asm
Chien10/MIPS-Project
2
170149
.data TIME: .space 1024 day: .space 1024 month: .space 1024 year: .space 1024 option: .space 4 comma: .word ',' slash: .word '/' space: .word ' ' MM_1: .asciiz "01" MM_2: .asciiz "02" MM_3: .asciiz "03" MM_4: .asciiz "04" MM_5: .asciiz "05" MM_6: .asciiz "06" MM_7: .asciiz "07" MM_8: .asciiz "08" MM_9: .asciiz "09" MM_10: .asciiz "10" MM_11: .asciiz "11" MM_12: .asciiz "12" Month_1: .asciiz "January" Month_2: .asciiz "Febuaray" Month_3: .asciiz "March" Month_4: .asciiz "April" Month_5: .asciiz "May" Month_6: .asciiz "June" Month_7: .asciiz "July" Month_8: .asciiz "August" Month_9: .asciiz "September" Month_10: .asciiz "October" Month_11: .asciiz "November" Month_12: .asciiz "December" ntf_2: .asciiz "Chuyen chuoi thanh 1 trong cac dinh dang sau:\n\tA. MM/DD/YYYY\n\tB. Month DD, YYYY\n\tC. DD Month, YYYY\n" .text main: #Input string time (default format) li $v0, 8 la $a0, TIME la $a1, 1024 syscall jal NumberDay move $t0,$v0 #Print converted time string li $v0, 1 la $a0,($t0) syscall #Exit program li $v0, 10 syscall #LIST FUNCTIONS: # + fill_blank_string(): fill blank string # + atoi(): convert string to int # + convert_MM_to_Month(): convert MM to Month # + push_string_to_string(): str1 = str1 + str2 # + convert_format_string(): FEATURE 2 OF PROJECT #Function to fill blank string #INPUT: $a0: save address of string need to fill blank #OUTPUT: $a0: save address of string after filling blank fill_blank_string: #Backup addi $sp, $sp, -12 sw $ra, ($sp) sw $a0, 4($sp) sw $t0, 8($sp) #Loop fill '\0' fill_blank_string.loop: lb $t0, ($a0) beq $t0, '\n', fill_blank_string.exit beq $t0, '\0', fill_blank_string.exit li $t0, 0 sb $t0, ($a0) addi $a0, $a0, 1 j fill_blank_string.loop #Exit loop fill_blank_string.exit: #Restore lw $ra, ($sp) lw $a0, 4($sp) lw $t0, 8($sp) addi $sp, $sp, 12 #Back jr $ra #End function fill_blank_string() #Function to convert string to number #INPUT: $a0: save address of string #OUTPUT: $v0: save value into int atoi: #Backup addi $sp, $sp, -12 sw $ra, ($sp) sw $a0, 4($sp) sw $t0, 8($sp) li $v0, 0 atoi_loop: lb $t0, ($a0) beq $t0, '\n', atoi_finish beq $t0, '\0', atoi_finish mul $v0, $v0, 10 addi $t0, $t0, -48 add $v0, $v0, $t0 addi $a0, $a0, 1 j atoi_loop atoi_finish: #Restore lw $ra, ($sp) lw $a0, 4($sp) lw $t0, 8($sp) addi $sp, $sp, 12 jr $ra #End function atoi() #Convert string month "DD" format to "Month" format #INUPPUT: $a0: save address of string month #OUTPUT: $a0: save address of string month after convert convert_MM_to_Month: #Backup addi $sp, $sp, -12 sw $ra, ($sp) sw $a0, 4($sp) sw $t0, 8($sp) #Covert string month to int la $a0, month jal atoi #Empty string month before call function push_string_to_string() la $a0, month jal fill_blank_string #Branch month value to convert beq $v0, 1, convert_MM_to_Month.convert_01 beq $v0, 2, convert_MM_to_Month.convert_02 beq $v0, 3, convert_MM_to_Month.convert_03 beq $v0, 4, convert_MM_to_Month.convert_04 beq $v0, 5, convert_MM_to_Month.convert_05 beq $v0, 6, convert_MM_to_Month.convert_06 beq $v0, 7, convert_MM_to_Month.convert_07 beq $v0, 8, convert_MM_to_Month.convert_08 beq $v0, 9, convert_MM_to_Month.convert_09 beq $v0, 10, convert_MM_to_Month.convert_10 beq $v0, 11, convert_MM_to_Month.convert_11 beq $v0, 12, convert_MM_to_Month.convert_12 convert_MM_to_Month.convert_01: la $a1, Month_1 j convert_MM_to_Month.exit convert_MM_to_Month.convert_02: la $a1, Month_2 j convert_MM_to_Month.exit convert_MM_to_Month.convert_03: la $a1, Month_3 j convert_MM_to_Month.exit convert_MM_to_Month.convert_04: la $a1, Month_4 j convert_MM_to_Month.exit convert_MM_to_Month.convert_05: la $a1, Month_5 j convert_MM_to_Month.exit convert_MM_to_Month.convert_06: la $a1, Month_6 j convert_MM_to_Month.exit convert_MM_to_Month.convert_07: la $a1, Month_7 j convert_MM_to_Month.exit convert_MM_to_Month.convert_08: la $a1, Month_8 j convert_MM_to_Month.exit convert_MM_to_Month.convert_09: la $a1, Month_9 j convert_MM_to_Month.exit convert_MM_to_Month.convert_10: la $a1, Month_10 j convert_MM_to_Month.exit convert_MM_to_Month.convert_11: la $a1, Month_11 j convert_MM_to_Month.exit convert_MM_to_Month.convert_12: la $a1, Month_12 j convert_MM_to_Month.exit convert_MM_to_Month.exit: jal push_string_to_string #Restore lw $ra, ($sp) lw $a0, 4($sp) lw $t0, 8($sp) addi $sp, $sp, 12 #Back jr $ra #End function convert_MM_to_Month() #Pushing string 2 to end-of-line of string 1 (Code C: str1 = str1 + str2) #INPUT: # $a0 save address of string 1 # $a1 save address of string 2 #OUTPUT: $a0 save address of string 1 after pushing string 2 push_string_to_string: #Backup addi $sp, $sp, -12 sw $ra, ($sp) sw $a0, 4($sp) sw $t0, 8($sp) #Moving index of string 1 to end-of-line push_string_to_string.string1.moveEOL.loop: lb $t0, ($a0) beq $t0, '\0', push_string_to_string.string1.moveEOL.exit beq $t0, '\n', push_string_to_string.string1.moveEOL.exit addi $a0, $a0, 1 #Increase index j push_string_to_string.string1.moveEOL.loop push_string_to_string.string1.moveEOL.exit: #Pushing push_string_to_string.string2.push.loop: lb $t0, ($a1) beq $t0, '\0', push_string_to_string.string2.push.exit beq $t0, '\n', push_string_to_string.string2.push.exit sb $t0, ($a0) #push letter addi $a0, $a0, 1 # address str_1 ++ addi $a1, $a1, 1 # address str_2 ++ j push_string_to_string.string2.push.loop push_string_to_string.string2.push.exit: #Restore lw $ra, ($sp) lw $a0, 4($sp) lw $t0, 8($sp) addi $sp, $sp, 12 #Back jr $ra #End function push_string_to_string() #Function to format string time #INPUT: $a0: save address of string time #OUTPUT: $a0: save address of string time after coverting convert_format_time: #Backup addi $sp, $sp, -16 sw $ra, ($sp) sw $t0, 4($sp) sw $a0, 8($sp) sw $a1, 12($sp) #Get day string (to string 'day') lb $t0, ($a0) sb $t0, day+0 lb $t0, 1($a0) sb $t0, day+1 li $t0, '\n' sb $t0, day+2 #Get month string (to string 'month') lb $t0, 3($a0) sb $t0, month+0 lb $t0, 4($a0) sb $t0, month+1 li $t0, '\n' sb $t0, month+2 #Get year string (to string 'year') lb $t0, 6($a0) sb $t0, year+0 lb $t0, 7($a0) sb $t0, year+1 lb $t0, 8($a0) sb $t0, year+2 lb $t0, 9($a0) sb $t0, year+3 li $t0, '\n' sb $t0, year+4 #Show notification of feature 2 li $v0, 4 la $a0, ntf_2 syscall #Read option convert li $v0, 8 la $a0, option la $a1, 4 syscall #Branch option format lb $t0, option beq $t0, 'A', convert_format_time.format_A beq $t0, 'B', convert_format_time.format_B beq $t0, 'C', convert_format_time.format_C #Convert to format A convert_format_time.format_A: la $a0, TIME jal fill_blank_string la $a1, month jal push_string_to_string la $a1, slash jal push_string_to_string la $a1, day jal push_string_to_string la $a1, slash jal push_string_to_string la $a1, year jal push_string_to_string #Exit j convert_format_time.exit #Convert to format B convert_format_time.format_B: la $a0, month jal convert_MM_to_Month move $a1, $a0 la $a0, TIME jal fill_blank_string jal push_string_to_string la $a1, space jal push_string_to_string la $a1, day jal push_string_to_string la $a1, comma jal push_string_to_string la $a1, space jal push_string_to_string la $a1, year jal push_string_to_string #Exit j convert_format_time.exit #Convert to format C convert_format_time.format_C: la $a0, TIME jal fill_blank_string la $a1, day jal push_string_to_string la $a1, space jal push_string_to_string la $a0, month jal convert_MM_to_Month move $a1, $a0 la $a0, TIME jal push_string_to_string la $a1, comma jal push_string_to_string la $a1, space jal push_string_to_string la $a1, year jal push_string_to_string #Exit j convert_format_time.exit #Exit function convert_format_time() convert_format_time.exit: #Restore lw $ra, ($sp) lw $t0, 4($sp) lw $a0, 8($sp) lw $a1, 12($sp) addi $sp, $sp, 16 #Back jr $ra #End function convert_format_time() Convert_Time_To_DMY: #backup addi $sp,$sp,-4 sw $ra,($sp) #Get day string (to string 'day') lb $t6, ($a0) sb $t6, day+0 lb $t6, 1($a0) sb $t6, day+1 li $t6, '\n' sb $t6, day+2 #Get month string (to string 'month') lb $t6, 3($a0) sb $t6, month+0 lb $t6, 4($a0) sb $t6, month+1 li $t6, '\n' sb $t6, month+2 #Get year string (to string 'year') lb $t6, 6($a0) sb $t6, year+0 lb $t6, 7($a0) sb $t6, year+1 lb $t6, 8($a0) sb $t6, year+2 lb $t6, 9($a0) sb $t6, year+3 li $t6, '\n' sb $t6, year+4 Convert_Time_To_DMY.Exit: lw $ra,($sp) addi $sp,$sp,4 jr $ra DMY_To_Int: #Retore s0=day(int),s1=month(int),s2(year) #backup addi $sp,$sp,-4 sw $ra,($sp) la $a0,day jal atoi move $s0,$v0 la $a0,month jal atoi move $s1,$v0 la $a0,year jal atoi move $s2,$v0 DMY.Exit: lw $ra,($sp) addi $sp,$sp,4 jr $ra #End function atoi() NumberDay: #Input a0<-TIME #Output SoNgay t? 1/1/1 #backup addi $sp,$sp,-32 sw $ra,($sp) sw $s0,4($sp) sw $s1,8($sp) sw $s2,12($sp) sw $t0,16($sp) sw $t4,20($sp) sw $t5,24($sp) sw $t6,28($sp) jal Convert_Time_To_DMY jal DMY_To_Int bge $s1,3,NumberDay.Do #thang >=3 addi $s2,$s2,-1 addi $s1,$s1,12 NumberDay.Do: li $t5,365 mul $t0,$s2,$t5 #t0=year *365 mflo $t0 li $t5,4 div $s2,$t5 #year/4 mflo $t1 #t1=year/4 li $t5,100 div $s2,$t5 mflo $t2 #t2=year/100 li $t5,400 div $s2,$t5 mflo $t3 #t3=year/400 li $t5,153 mul $s1,$s1,$t5 mflo $s1 subi $t4,$s1,457 li $t5,5 div $t4,$t5 mflo $t4 #t4=(153*month-4457)/5 ####Tong ngay add $t0,$t0,$t1 sub $t0,$t0,$t2 add $t0,$t0,$t3 add $t0,$t0,$t4 add $t0,$t0,$s0 subi $t0,$t0,306 addi $t0,$t0,-1 move $v0,$t0 j NumberDay.Exit #exit NumberDay.Exit: lw $t4,20($sp) lw $t5,24($sp) lw $t6,28($sp) lw $t0,16($sp) lw $s0,12($sp) lw $s1,8($sp) lw $s2,4($sp) lw $ra,($sp) addi $sp,$sp,32 jr $ra GetTime: #backup addi $sp,$sp,-16 sw $ra,($sp) sw $a0,4($sp) sw $t0,8($sp) sw $t1,12($sp) #la $a0,TIME_1 #jal NumberDay #move $t0,$v0 #la $a0,TIME_2 #jal NumberDay #move $t1,$v0 sub $v0,$t1,$t0 GetTime.Exit: lw $ra,($sp) lw $a0,4($sp) lw $t0,8($sp) lw $t1,12($sp) addi $sp,$sp,16 jr $ra
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_36_471.asm
ljhsiun2/medusa
9
90540
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r9 push %rax push %rbx push %rcx push %rdx lea addresses_WC_ht+0x8b05, %rbx nop nop add %r13, %r13 mov (%rbx), %r9d nop cmp $44872, %r14 lea addresses_D_ht+0x5ead, %rbx sub $11213, %rdx movb (%rbx), %cl nop nop nop nop sub %r9, %r9 lea addresses_D_ht+0x198d5, %rbx nop nop nop cmp %rax, %rax movw $0x6162, (%rbx) nop and %rax, %rax lea addresses_A_ht+0x18985, %rdx cmp %rax, %rax mov (%rdx), %bx nop nop nop add %r14, %r14 pop %rdx pop %rcx pop %rbx pop %rax pop %r9 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r15 push %r9 push %rcx push %rdi // Store lea addresses_PSE+0x18525, %rcx nop nop and %r12, %r12 mov $0x5152535455565758, %r11 movq %r11, %xmm1 vmovups %ymm1, (%rcx) nop cmp %r14, %r14 // Store lea addresses_UC+0x1b2b2, %rdi cmp %r9, %r9 mov $0x5152535455565758, %r11 movq %r11, %xmm7 movups %xmm7, (%rdi) nop nop nop cmp $21665, %r12 // Store lea addresses_WC+0x16215, %r12 nop cmp %rcx, %rcx movl $0x51525354, (%r12) nop nop sub %r9, %r9 // Store lea addresses_WC+0xc125, %r12 and $54364, %r15 mov $0x5152535455565758, %rdi movq %rdi, %xmm7 vmovups %ymm7, (%r12) // Exception!!! nop nop nop nop nop mov (0), %r12 nop nop cmp $44044, %r11 // Store lea addresses_RW+0xbcec, %r14 nop nop nop nop and $2521, %r9 movl $0x51525354, (%r14) nop xor $60698, %r12 // Store lea addresses_RW+0x3195, %r12 nop nop nop nop nop sub %r15, %r15 mov $0x5152535455565758, %r14 movq %r14, %xmm5 movups %xmm5, (%r12) nop nop nop nop nop sub %r11, %r11 // Store mov $0x325, %r11 nop nop nop and $27652, %r9 movl $0x51525354, (%r11) nop add %r11, %r11 // Store lea addresses_WC+0xa885, %r9 nop nop and %r15, %r15 mov $0x5152535455565758, %r11 movq %r11, %xmm1 movups %xmm1, (%r9) nop nop nop nop nop sub %r11, %r11 // Faulty Load lea addresses_RW+0x15525, %rdi nop nop nop nop nop cmp %r9, %r9 mov (%rdi), %rcx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rdi pop %rcx pop %r9 pop %r15 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'32': 36} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
Micro/Tests/pop/pop.asm
JavierOramas/CP_AC
0
18961
addi r1 r0 65 push r1 push r2 push r3 push r4 pop r10 pop r10 pop r10 pop r9 tty r9 halt #pirnts A
programs/oeis/331/A331176.asm
neoneye/loda
22
161526
; A331176: a(n) = n - n/gcd(n, phi(n)), where phi is Euler totient function. ; 0,0,0,2,0,3,0,6,6,5,0,9,0,7,0,14,0,15,0,15,14,11,0,21,20,13,24,21,0,15,0,30,0,17,0,33,0,19,26,35,0,35,0,33,30,23,0,45,42,45,0,39,0,51,44,49,38,29,0,45,0,31,56,62,0,33,0,51,0,35,0,69,0,37,60,57,0,65,0,75,78,41,0,77,0,43,0,77,0,75,0,69,62,47,0,93,0,91,66,95 mov $1,$0 seq $1,109395 ; Denominator of phi(n)/n = Product_{p|n} (1 - 1/p); phi(n)=A000010(n), the Euler totient function. sub $0,$1 add $0,1
programs/oeis/168/A168631.asm
neoneye/loda
22
241680
; A168631: a(n) = n^6*(n^7 + 1)/2. ; 0,1,4128,797526,33556480,610359375,6530370336,48444564028,274878038016,1270933179885,5000000500000,17261356957746,53496604182528,151437555709531,396857390391840,973097539875000,2251799822073856,4952289028521753,10411482449841696,21026491754651470,40960000032000000,77236188912442791,141405028998231328,252018181042251636,438244169328230400,745058059814453125,1240576436756326176,2026277576703198378,3251055711489918976,5130314356776712755,7971615000364500000,12208773149166273136,18446744074246422528,27520176997369985841,40569151623555120160,59136358891910343750,85290864090877495296,121784612109323515903,172249020262910381856,241440374285499661740,335544320002048000000,462551551159881866781,632718859222177828128,859132062144306074146,1158389997092735109120,1551431779990113796875,2064532938496507549216,2730499853065681196328,3590096234360220942336,4693740168830797796425,6103515625007812500000,7895548281587144241726,10162802168652390320128,13018360962814325278551,16599265906778124245280,21070991298799851062500,26632648386567014055936,33523019376265178761653,42027535208297468912416,52486323838087305414810,65303470080023328000000,80957643716102138015971,100014269634363294570528,123139432347114339961056,151115727451863006576640,184860294550973378390625,225445289957206398183456,274121083305245943533878,332342490093885459204096,401798382335871202814895,484445052035058824500000,582543737292812845407516,698702758623621998051328,835924753696970110083661,997659542389151130151200,1187863200903027832031250,1411063973981525402699776,1672435708095702181635003,1977879546132513054329376,2334114685751250602294680,2748779069440131072000000,3230540944613477864234361,3789222307082447829034528,4435935321154600133208366,5183232894725773343016960,6045274678287503638234375,7038009853060465339972896,8179378175765365571987028,9489530856154196354400256,10991072958654413734152165,12709329141645265720500000,14672634677319301545914506,16912653832124886300592128,19464727832791059814497171,22368254796270253629221920,25667104163975623283250000,29410068351829224839970816,33651354508279159500311953,38451119463005644557128736,43876051149948870132685350 mov $1,$0 pow $0,6 mov $2,$1 pow $2,7 mul $2,$0 add $0,$2 div $0,2
src/ada/src/services/atbb/algebra.adb
manthonyaiello/OpenUxAS
0
18284
with Ada.Containers; use Ada.Containers; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings; use Ada.Strings; with Ada.Text_IO; use Ada.Text_IO; package body Algebra with SPARK_Mode is type Int64_Seq_Arr is array (Children_Index range <>) of Int64_Seq; ----------------------- -- Local subprograms -- ----------------------- procedure Next_Actions (Assignment : Int64_Seq; Algebra : not null access constant Algebra_Tree_Cell; Result : out Int64_Seq; Encounter_Executed_Out : out Boolean); ----------------------------- -- Get_Next_Objectives_Ids -- ----------------------------- function Get_Next_Objectives_Ids (Assignment : Int64_Seq; Algebra : access constant Algebra_Tree_Cell) return Int64_Seq is Encounter_Executed : Boolean; Result : Int64_Seq; begin Next_Actions (Assignment, Algebra, Result, Encounter_Executed); return Result; end Get_Next_Objectives_Ids; ------------------ -- Next_Actions -- ------------------ procedure Next_Actions (Assignment : Int64_Seq; Algebra : not null access constant Algebra_Tree_Cell; Result : out Int64_Seq; Encounter_Executed_Out : out Boolean) is ResultThis : Int64_Seq; begin case Algebra.Node_Kind is when Action => declare ActionFound : constant Boolean := (for some TaskOptionId of Assignment => (TaskOptionId = Algebra.TaskOptionId)); begin -- If the action has already been executed, we assign -- True to Encounter_Executed_Out. if ActionFound then Encounter_Executed_Out := True; -- Otherwise, the action is an objective, so we add it to -- ResultThis. Encounter_Executed_Out is set to False; else ResultThis := Add (ResultThis, Algebra.TaskOptionId); Encounter_Executed_Out := False; end if; end; when Operator => declare Num_Children : Children_Number renames Algebra.Collection.Num_Children; Children_Results : Int64_Seq_Arr (1 .. Num_Children); -- We will need to store the results of this procedure for all -- children of the current node. Encounter_Executed : Boolean; -- Result of this procedure called on the children of the -- current node. begin Encounter_Executed_Out := False; case Algebra.Operator_Kind is when Sequential => -- Encounter_Executed_Out is set to true in the case where -- the first child has no next objectives, i.e. it has -- been executed. Encounter_Executed_Out := True; for J in 1 .. Num_Children loop Next_Actions (Assignment, Algebra.Collection.Children (J), Children_Results (J), Encounter_Executed); -- If this child has next objectives, we set ResultThis -- to those objectives. if Length (Children_Results (J)) > 0 then ResultThis := Children_Results (J); -- If this child is the first child, we set -- Encounter_Executed_Out to Encounter_Executed. -- Encounter_Executed_Out can be true when -- the first child is an operator. if J = 1 then Encounter_Executed_Out := Encounter_Executed; end if; exit; end if; end loop; when Alternative => for J in 1 .. Num_Children loop Next_Actions (Assignment, Algebra.Collection.Children (J), Children_Results (J), Encounter_Executed); -- If this child has been executed, even partially, -- no other child can be executed. if Encounter_Executed then Encounter_Executed_Out := True; ResultThis := Children_Results (J); exit; end if; end loop; -- If no child has been executed, every action is a -- candidate for the next assignment. if not Encounter_Executed_Out then for J in 1 .. Num_Children loop for TaskOptionId of Children_Results (J) loop ResultThis := Add (ResultThis, TaskOptionId); end loop; end loop; end if; when Parallel => for J in 1 .. Num_Children loop Next_Actions (Assignment, Algebra.Collection.Children (J), Children_Results (J), Encounter_Executed); -- All actions are candidate in a parallel assignment for TaskOptionId of Children_Results (J) loop ResultThis := Add (ResultThis, TaskOptionId); end loop; -- If a child has been executed, Encounter_Executed_Out -- is set to True. if Encounter_Executed then Encounter_Executed_Out := True; end if; end loop; when Undefined => raise Program_Error; end case; end; when Undefined => raise Program_Error; end case; Result := ResultThis; end Next_Actions; ------------------- -- Parse_Formula -- ------------------- procedure Parse_Formula (Formula : Unbounded_String; Algebra : out not null Algebra_Tree) is Kind : Node_Kind_Type := Undefined; Operator_Kind : Operator_Kind_Type := Undefined; form : Unbounded_String := Formula; begin for J in 1 .. Length (form) loop if Element (form, J) = '.' then Kind := Operator; Operator_Kind := Sequential; form := To_Unbounded_String (Slice (form, J + 2, Index (form, ")", Backward) - 1)); exit; elsif Element (form, J) = '+' then Kind := Operator; Operator_Kind := Alternative; form := To_Unbounded_String (Slice (form, J + 2, Index (form, ")", Backward) - 1)); exit; elsif Element (form, J) = '|' then Kind := Operator; Operator_Kind := Parallel; form := To_Unbounded_String (Slice (form, J + 2, Index (form, ")", Backward) - 1)); exit; elsif Element (form, J) = 'p' then Kind := Action; if Index (form, ")", Backward) = 0 then form := To_Unbounded_String (Slice (form, J + 1, Length (form))); else form := To_Unbounded_String (Slice (form, J + 1, Index (form, ")", Backward) - 1)); end if; exit; end if; end loop; if Kind = Action then declare ActionID : constant Int64 := Int64'Value (To_String (form)); begin Algebra := new Algebra_Tree_Cell'(Node_Kind => Action, TaskOptionId => ActionID); end; else declare numParenthesis : Natural := 0; Children_Arr : Algebra_Tree_Array (1 .. Max_Children); numChildren : Children_Number := 0; begin for J in 1 .. Length (form) loop if Element (form, J) in '+' | '.' | '|' then if numParenthesis = 0 then declare iEnd : Natural := J + 1; numParenthesisTmp : Natural := 0; begin while iEnd <= Length (form) loop if Element (form, iEnd) = '(' then numParenthesisTmp := numParenthesisTmp + 1; elsif Element (form, iEnd) = ')' then numParenthesisTmp := numParenthesisTmp - 1; end if; if numParenthesisTmp = 0 then exit; end if; iEnd := iEnd + 1; end loop; numChildren := numChildren + 1; Parse_Formula (To_Unbounded_String (Slice (form, J, iEnd)), Children_Arr (numChildren)); end; end if; elsif Element (form, J) = 'p' then if numParenthesis = 0 then declare iEnd : Natural := J + 2; begin while iEnd <= Length (form) loop if Element (form, iEnd) in ')' | ' ' then exit; end if; iEnd := iEnd + 1; end loop; numChildren := numChildren + 1; Parse_Formula (To_Unbounded_String (Slice (form, J, iEnd)), Children_Arr (numChildren)); end; end if; elsif Element (form, J) = '(' then numParenthesis := numParenthesis + 1; elsif Element (form, J) = ')' then numParenthesis := numParenthesis - 1; end if; end loop; declare Nb_Children : constant Children_Number := numChildren; Children : Children_Collection (Nb_Children) := (Num_Children => Nb_Children, Children => Children_Array (Children_Arr (1 .. Nb_Children))); begin Algebra := new Algebra_Tree_Cell'(Node_Kind => Operator, Operator_Kind => Operator_Kind, Collection => Children); end; end; end if; end Parse_Formula; ---------------- -- Print_Tree -- ---------------- procedure Print_Tree (Algebra : access constant Algebra_Tree_Cell) is procedure Print_Tree_Aux (Node : access constant Algebra_Tree_Cell; I : Natural); procedure Print_Tree_Aux (Node : access constant Algebra_Tree_Cell; I : Natural) is Prefix : constant String := I * " | "; begin if Node.Node_Kind = Action then Put_Line (Prefix & "Action node: " & Node.TaskOptionId'Image); else Put_Line (Prefix & "Operator " & Node.Operator_Kind'Image & ":"); for J in 1 .. Node.Collection.Num_Children loop Print_Tree_Aux (Node.Collection.Children (J), I + 1); end loop; end if; end Print_Tree_Aux; begin Print_Tree_Aux (Algebra, 0); end Print_Tree; end Algebra;
ada-real_time-timing_events.ads
mgrojo/adalib
15
9175
<filename>ada-real_time-timing_events.ads<gh_stars>10-100 -- Standard Ada library specification -- Copyright (c) 2003-2018 <NAME> <<EMAIL>> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- package Ada.Real_Time.Timing_Events is type Timing_Event is tagged limited private; type Timing_Event_Handler is access protected procedure (Event : in out Timing_Event); procedure Set_Handler (Event : in out Timing_Event; At_Time : in Time; Handler : in Timing_Event_Handler); procedure Set_Handler (Event : in out Timing_Event; In_Time : in Time_Span; Handler : in Timing_Event_Handler); function Current_Handler (Event : in Timing_Event) return Timing_Event_Handler; procedure Cancel_Handler (Event : in out Timing_Event; Cancelled : out Boolean); function Time_Of_Event (Event : in Timing_Event) return Time; private pragma Import (Ada, Timing_Event); end Ada.Real_Time.Timing_Events;
Assembly Works 4/Task_1_Lab_4.asm
AhmadVakil/Assembly-C_Micro-Controller
0
177229
<reponame>AhmadVakil/Assembly-C_Micro-Controller<filename>Assembly Works 4/Task_1_Lab_4.asm ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; 1DT301, Computer Technology I ; Date: 2017-10-29 ; Author: ; <NAME> ; ; Lab number: 4 ; Title: Timer and USART ; ; Hardware: STK600, CPU ATmega2560 ; ; Function: 1 Hz square wave to turn on and off LED0 each 1/2 second. ; ; Input ports: N/A ; ; Output ports: PORTB, PINB0 ; ; Subroutines: N/A ; ; Included files: m2560def.inc ; ; Other information: N/A ; ; Changes in program: ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< .include "m2560def.inc" .def temp = r16 .def ledLights = r17 .def counter = r18 .equ comparable = 2 .equ foreScale = 0x05 .equ timer = 6 .CSEG .org 0 rjmp reset .org ovf0addr ;interrupt vector rjmp interrupt .org 0x72 reset: ldi temp, LOW(RAMEND) out SPL, temp ldi temp, HIGH(RAMEND) out SPH, temp ldi temp, 0x01 out DDRB, temp ldi temp, foreScale ;set forescale out TCCR0B, temp ldi temp, (1<<TOIE0) ;enabling flag sts TIMSK0, temp ldi temp, timer ;Timer value out TCNT0, temp sei clr ledLights main_loop: out PORTB, ledLights rjmp main_loop interrupt: in temp, SREG ;Status goes to stack push temp ldi temp, timer ;set timer value out TCNT0, temp inc counter cpi counter, comparable ;if it is equal to 2 then go to switch_Leds breq switch_Leds rjmp end switch_Leds: com ledLights ; Switch LED0 clr counter ; Counter == 0 end: pop temp out SREG, temp reti
_incObj/0D Signpost.asm
kodishmediacenter/msu-md-sonic
9
104555
<reponame>kodishmediacenter/msu-md-sonic ; --------------------------------------------------------------------------- ; Object 0D - signpost at the end of a level ; --------------------------------------------------------------------------- Signpost: moveq #0,d0 move.b obRoutine(a0),d0 move.w Sign_Index(pc,d0.w),d1 jsr Sign_Index(pc,d1.w) lea (Ani_Sign).l,a1 bsr.w AnimateSprite bsr.w DisplaySprite out_of_range DeleteObject rts ; =========================================================================== Sign_Index: dc.w Sign_Main-Sign_Index dc.w Sign_Touch-Sign_Index dc.w Sign_Spin-Sign_Index dc.w Sign_SonicRun-Sign_Index dc.w Sign_Exit-Sign_Index spintime: equ $30 ; time for signpost to spin sparkletime: equ $32 ; time between sparkles sparkle_id: equ $34 ; counter to keep track of sparkles ; =========================================================================== Sign_Main: ; Routine 0 addq.b #2,obRoutine(a0) move.l #Map_Sign,obMap(a0) move.w #$680,obGfx(a0) move.b #4,obRender(a0) move.b #$18,obActWid(a0) move.b #4,obPriority(a0) Sign_Touch: ; Routine 2 move.w (v_player+obX).w,d0 sub.w obX(a0),d0 bcs.s @notouch cmpi.w #$20,d0 ; is Sonic within $20 pixels of the signpost? bcc.s @notouch ; if not, branch sfx sfx_Signpost,0,0,0 ; play signpost sound clr.b (f_timecount).w ; stop time counter move.w (v_limitright2).w,(v_limitleft2).w ; lock screen position addq.b #2,obRoutine(a0) @notouch: rts ; =========================================================================== Sign_Spin: ; Routine 4 subq.w #1,spintime(a0) ; subtract 1 from spin time bpl.s @chksparkle ; if time remains, branch move.w #60,spintime(a0) ; set spin cycle time to 1 second addq.b #1,obAnim(a0) ; next spin cycle cmpi.b #3,obAnim(a0) ; have 3 spin cycles completed? bne.s @chksparkle ; if not, branch addq.b #2,obRoutine(a0) @chksparkle: subq.w #1,sparkletime(a0) ; subtract 1 from time delay bpl.s @fail ; if time remains, branch move.w #$B,sparkletime(a0) ; set time between sparkles to $B frames moveq #0,d0 move.b sparkle_id(a0),d0 ; get sparkle id addq.b #2,sparkle_id(a0) ; increment sparkle counter andi.b #$E,sparkle_id(a0) lea Sign_SparkPos(pc,d0.w),a2 ; load sparkle position data bsr.w FindFreeObj bne.s @fail move.b #id_Rings,0(a1) ; load rings object move.b #id_Ring_Sparkle,obRoutine(a1) ; jump to ring sparkle subroutine move.b (a2)+,d0 ext.w d0 add.w obX(a0),d0 move.w d0,obX(a1) move.b (a2)+,d0 ext.w d0 add.w obY(a0),d0 move.w d0,obY(a1) move.l #Map_Ring,obMap(a1) move.w #$27B2,obGfx(a1) move.b #4,obRender(a1) move.b #2,obPriority(a1) move.b #8,obActWid(a1) @fail: rts ; =========================================================================== Sign_SparkPos: dc.b -$18,-$10 ; x-position, y-position dc.b 8, 8 dc.b -$10, 0 dc.b $18, -8 dc.b 0, -8 dc.b $10, 0 dc.b -$18, 8 dc.b $18, $10 ; =========================================================================== Sign_SonicRun: ; Routine 6 tst.w (v_debuguse).w ; is debug mode on? bne.w locret_ECEE ; if yes, branch btst #1,(v_player+obStatus).w bne.s loc_EC70 move.b #1,(f_lockctrl).w ; lock controls move.w #btnR<<8,(v_jpadhold2).w ; make Sonic run to the right loc_EC70: tst.b (v_player).w beq.s loc_EC86 move.w (v_player+obX).w,d0 move.w (v_limitright2).w,d1 addi.w #$128,d1 cmp.w d1,d0 bcs.s locret_ECEE loc_EC86: addq.b #2,obRoutine(a0) ; --------------------------------------------------------------------------- ; Subroutine to set up bonuses at the end of an act ; --------------------------------------------------------------------------- ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| GotThroughAct: tst.b (v_objspace+$5C0).w bne.s locret_ECEE move.w (v_limitright2).w,(v_limitleft2).w clr.b (v_invinc).w ; disable invincibility clr.b (f_timecount).w ; stop time counter move.b #id_GotThroughCard,(v_objspace+$5C0).w moveq #plcid_TitleCard,d0 jsr (NewPLC).l ; load title card patterns move.b #1,(f_endactbonus).w moveq #0,d0 move.b (v_timemin).w,d0 mulu.w #60,d0 ; convert minutes to seconds moveq #0,d1 move.b (v_timesec).w,d1 add.w d1,d0 ; add up your time divu.w #15,d0 ; divide by 15 moveq #$14,d1 cmp.w d1,d0 ; is time 5 minutes or higher? bcs.s @hastimebonus ; if not, branch move.w d1,d0 ; use minimum time bonus (0) @hastimebonus: add.w d0,d0 move.w TimeBonuses(pc,d0.w),(v_timebonus).w ; set time bonus move.w (v_rings).w,d0 ; load number of rings mulu.w #10,d0 ; multiply by 10 move.w d0,(v_ringbonus).w ; set ring bonus ;sfx bgm_GotThrough,0,0,0 ; play "Sonic got through" music jsr msuPlayTrack_14 locret_ECEE: rts ; End of function GotThroughAct ; =========================================================================== TimeBonuses: dc.w 5000, 5000, 1000, 500, 400, 400, 300, 300, 200, 200 dc.w 200, 200, 100, 100, 100, 100, 50, 50, 50, 50, 0 ; =========================================================================== Sign_Exit: ; Routine 8 rts
Serializers/C/CPPBaseLexer.g4
kaby76/Piggy
31
4203
lexer grammar CPPBaseLexer; @header { using CSerializer; } INCLUDE : '#include' [ \t]* STRING [ \t]* '\r'? '\n' { // launch another lexer on the include file, get tokens, // emit them all at once here, replacing this token var tokens = CPP.Include(Text); System.Console.Error.WriteLine("back from include"); if ( tokens != null ) { foreach (CPPToken t in tokens) Emit(t); } } ; fragment STRING : '"' .*? '"' ; OTHER_CMD : '#' ~[\r\n]* '\r'? '\n' ; // can't use .*; scarfs \n\n after include CHUNK : ~'#'+ ; // anything else
Everything.agda
jvoigtlaender/bidiragda
0
9884
-- The sole purpose of this module is to ease compilation of everything. module Everything where import Generic import Structures import Instances import FinMap import CheckInsert import GetTypes import FreeTheorems import BFF import Bidir import LiftGet import Precond import Examples import BFFPlug
libsrc/_DEVELOPMENT/math/float/math32/z80/d32_fsutil.asm
jpoikela/z88dk
640
8767
<gh_stars>100-1000 ; ; Copyright (c) 2015 Digi International Inc. ; ; This Source Code Form is subject to the terms of the Mozilla Public ; License, v. 2.0. If a copy of the MPL was not distributed with this ; file, You can obtain one at http://mozilla.org/MPL/2.0/. ; ; feilipu, 2019 April ; adapted for z80, z180, and z80n ; ;------------------------------------------------------------------------- SECTION code_fp_math32 PUBLIC m32_fseexit PUBLIC m32_fsneg PUBLIC m32_fszero PUBLIC m32_fszero_hlde PUBLIC m32_fsmin PUBLIC m32_fsmax PUBLIC m32_fsnan ; here to negate a number in dehl .m32_fsneg ld a,d xor 080h ld d,a ret ; here to return a legal zero of sign h in hlde .m32_fszero_hlde ex de,hl ; here to return a legal zero of sign d in dehl .m32_fszero ld a,d and 080h ld d,a ld e,0 ld h,e ld l,e ret ; here to change underflow to a error floating zero .m32_fsmin call m32_fszero .m32_fseexit scf ; C set for error ret ; here to change overflow to floating infinity of sign d in dehl .m32_fsmax ld a,d or 07fh ; max exponent ld d,a ld e,080h ;floating infinity ld hl,0 jr m32_fseexit ; here to change error to floating NaN of sign d in dehl .m32_fsnan ld a,d or 07fh ; max exponent ld d,a ld e,0ffh ;floating NaN ld h,e ld l,e jr m32_fseexit
tests/tk-ttklabelframe-ttk_label_frame_options_test_data-ttk_label_frame_options_tests.adb
thindil/tashy2
2
10264
<reponame>thindil/tashy2<gh_stars>1-10 -- This package has been generated automatically by GNATtest. -- You are allowed to add your code to the bodies of test routines. -- Such changes will be kept during further regeneration of this file. -- All code placed outside of test routine bodies will be lost. The -- code intended to set up and tear down the test environment should be -- placed into Tk.TtkLabelFrame.Ttk_Label_Frame_Options_Test_Data. with AUnit.Assertions; use AUnit.Assertions; with System.Assertions; -- begin read only -- id:2.2/00/ -- -- This section can be used to add with clauses if necessary. -- -- end read only with Ada.Environment_Variables; use Ada.Environment_Variables; -- begin read only -- end read only package body Tk.TtkLabelFrame.Ttk_Label_Frame_Options_Test_Data .Ttk_Label_Frame_Options_Tests is -- begin read only -- id:2.2/01/ -- -- This section can be used to add global variables and other elements. -- -- end read only -- begin read only -- end read only -- begin read only procedure Wrap_Test_Configure_0076be_459bf9 (Frame_Widget: Ttk_Label_Frame; Options: Ttk_Label_Frame_Options) is begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-ttklabelframe.ads:0):Test_Configure_TtkLabelFrame test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.TtkLabelFrame.Configure (Frame_Widget, Options); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-ttklabelframe.ads:0:):Test_Configure_TtkLabelFrame test commitment violated"); end; end Wrap_Test_Configure_0076be_459bf9; -- end read only -- begin read only procedure Test_Configure_test_configure_ttklabelframe (Gnattest_T: in out Test_Ttk_Label_Frame_Options); procedure Test_Configure_0076be_459bf9 (Gnattest_T: in out Test_Ttk_Label_Frame_Options) renames Test_Configure_test_configure_ttklabelframe; -- id:2.2/0076be6725db0897/Configure/1/0/test_configure_ttklabelframe/ procedure Test_Configure_test_configure_ttklabelframe (Gnattest_T: in out Test_Ttk_Label_Frame_Options) is procedure Configure (Frame_Widget: Ttk_Label_Frame; Options: Ttk_Label_Frame_Options) renames Wrap_Test_Configure_0076be_459bf9; -- end read only pragma Unreferenced(Gnattest_T); Frame: Ttk_Label_Frame; Options: Ttk_Label_Frame_Options; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create (Frame, ".myframe", Ttk_Label_Frame_Options'(Relief => RAISED, others => <>)); Configure (Frame, Ttk_Label_Frame_Options'(Relief => SOLID, others => <>)); Options := Get_Options(Frame); Assert (Options.Relief = SOLID, "Failed to set options for Ttk labelframe."); Destroy(Frame); -- begin read only end Test_Configure_test_configure_ttklabelframe; -- end read only -- begin read only function Wrap_Test_Create_32e405_465c74 (Path_Name: Tk_Path_String; Options: Ttk_Label_Frame_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Ttk_Label_Frame is begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-ttklabelframe.ads:0):Test_Create_TtkLabelFrame1 test requirement violated"); end; declare Test_Create_32e405_465c74_Result: constant Ttk_Label_Frame := GNATtest_Generated.GNATtest_Standard.Tk.TtkLabelFrame.Create (Path_Name, Options, Interpreter); begin begin pragma Assert(Test_Create_32e405_465c74_Result /= Null_Widget); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-ttklabelframe.ads:0:):Test_Create_TtkLabelFrame1 test commitment violated"); end; return Test_Create_32e405_465c74_Result; end; end Wrap_Test_Create_32e405_465c74; -- end read only -- begin read only procedure Test_1_Create_test_create_ttklabelframe1 (Gnattest_T: in out Test_Ttk_Label_Frame_Options); procedure Test_Create_32e405_465c74 (Gnattest_T: in out Test_Ttk_Label_Frame_Options) renames Test_1_Create_test_create_ttklabelframe1; -- id:2.2/32e405543423d7b8/Create/1/0/test_create_ttklabelframe1/ procedure Test_1_Create_test_create_ttklabelframe1 (Gnattest_T: in out Test_Ttk_Label_Frame_Options) is function Create (Path_Name: Tk_Path_String; Options: Ttk_Label_Frame_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Ttk_Label_Frame renames Wrap_Test_Create_32e405_465c74; -- end read only pragma Unreferenced(Gnattest_T); Frame: Ttk_Label_Frame; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Frame := Create(".myframe", Ttk_Label_Frame_Options'(others => <>)); Assert (Frame /= Null_Widget, "Failed to create a new Ttk labelframe with function."); Destroy(Frame); -- begin read only end Test_1_Create_test_create_ttklabelframe1; -- end read only -- begin read only procedure Wrap_Test_Create_ebbdc1_d1ec6f (Frame_Widget: out Ttk_Label_Frame; Path_Name: Tk_Path_String; Options: Ttk_Label_Frame_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-ttklabelframe.ads:0):Test_Create_TtkLabelFrame2 test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.TtkLabelFrame.Create (Frame_Widget, Path_Name, Options, Interpreter); begin pragma Assert(Frame_Widget /= Null_Widget); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-ttklabelframe.ads:0:):Test_Create_TtkLabelFrame2 test commitment violated"); end; end Wrap_Test_Create_ebbdc1_d1ec6f; -- end read only -- begin read only procedure Test_2_Create_test_create_ttklabelframe2 (Gnattest_T: in out Test_Ttk_Label_Frame_Options); procedure Test_Create_ebbdc1_d1ec6f (Gnattest_T: in out Test_Ttk_Label_Frame_Options) renames Test_2_Create_test_create_ttklabelframe2; -- id:2.2/ebbdc1934f0fa33d/Create/0/0/test_create_ttklabelframe2/ procedure Test_2_Create_test_create_ttklabelframe2 (Gnattest_T: in out Test_Ttk_Label_Frame_Options) is procedure Create (Frame_Widget: out Ttk_Label_Frame; Path_Name: Tk_Path_String; Options: Ttk_Label_Frame_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Create_ebbdc1_d1ec6f; -- end read only pragma Unreferenced(Gnattest_T); Frame: Ttk_Label_Frame; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create(Frame, ".myframe", Ttk_Label_Frame_Options'(others => <>)); Assert (Frame /= Null_Widget, "Failed to create a new Ttk labelframe with procedure."); Destroy(Frame); -- begin read only end Test_2_Create_test_create_ttklabelframe2; -- end read only -- begin read only function Wrap_Test_Get_Options_ded36e_39fa14 (Frame_Widget: Ttk_Label_Frame) return Ttk_Label_Frame_Options is begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-ttklabelframe.ads:0):Test_Get_Options_TtkLabelFrame test requirement violated"); end; declare Test_Get_Options_ded36e_39fa14_Result: constant Ttk_Label_Frame_Options := GNATtest_Generated.GNATtest_Standard.Tk.TtkLabelFrame.Get_Options (Frame_Widget); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-ttklabelframe.ads:0:):Test_Get_Options_TtkLabelFrame test commitment violated"); end; return Test_Get_Options_ded36e_39fa14_Result; end; end Wrap_Test_Get_Options_ded36e_39fa14; -- end read only -- begin read only procedure Test_Get_Options_test_get_options_ttklabelframe (Gnattest_T: in out Test_Ttk_Label_Frame_Options); procedure Test_Get_Options_ded36e_39fa14 (Gnattest_T: in out Test_Ttk_Label_Frame_Options) renames Test_Get_Options_test_get_options_ttklabelframe; -- id:2.2/ded36e34d54c20f9/Get_Options/1/0/test_get_options_ttklabelframe/ procedure Test_Get_Options_test_get_options_ttklabelframe (Gnattest_T: in out Test_Ttk_Label_Frame_Options) is function Get_Options (Frame_Widget: Ttk_Label_Frame) return Ttk_Label_Frame_Options renames Wrap_Test_Get_Options_ded36e_39fa14; -- end read only pragma Unreferenced(Gnattest_T); Frame: Ttk_Label_Frame; Options: Ttk_Label_Frame_Options; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create (Frame, ".myframe", Ttk_Label_Frame_Options'(Relief => RAISED, others => <>)); Options := Get_Options(Frame); Assert (Options.Relief = Raised, "Failed to get options of Ttk labelframe."); Destroy(Frame); -- begin read only end Test_Get_Options_test_get_options_ttklabelframe; -- end read only -- begin read only -- id:2.2/02/ -- -- This section can be used to add elaboration code for the global state. -- begin -- end read only null; -- begin read only -- end read only end Tk.TtkLabelFrame.Ttk_Label_Frame_Options_Test_Data .Ttk_Label_Frame_Options_Tests;
tag-mac/scripts/quit-confirmation-for-safari.scpt
stevenberg/dotfiles
2
4365
<reponame>stevenberg/dotfiles use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions tell Application "Safari" set _window_count to count windows set _tab_count to 0 repeat with _w in every window set _tab_count to _tab_count + (count of tabs of _w) end repeat set _msg to _window_count & " windows containing " & _tab_count & " tabs." as string display alert "Are you sure you want to quit Safari?" message _msg buttons {"Cancel", "Quit"} giving up after 60 if button returned of result is "Quit" then quit end tell
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c35508o.ada
best08618/asylo
7
19091
-- C35508O.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT 'FIRST' AND 'LAST' YIELD THE CORRECT RESULTS WHEN THE -- PREFIX IS A BOOLEAN TYPE. -- HISTORY: -- RJW 03/19/86 CREATED ORIGINAL TEST. -- DHH 10/19/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS. WITH REPORT; USE REPORT; PROCEDURE C35508O IS BEGIN TEST ("C35508O", "CHECK THAT 'FIRST' AND 'LAST' YIELD THE " & "CORRECT RESULTS WHEN THE PREFIX IS A " & "BOOLEAN TYPE" ); DECLARE SUBTYPE TBOOL IS BOOLEAN RANGE IDENT_BOOL(TRUE) .. IDENT_BOOL(TRUE); SUBTYPE FBOOL IS BOOLEAN RANGE IDENT_BOOL(FALSE) .. IDENT_BOOL(FALSE); SUBTYPE NOBOOL IS BOOLEAN RANGE IDENT_BOOL(TRUE) .. IDENT_BOOL(FALSE); TYPE NEWBOOL IS NEW BOOLEAN; TYPE NIL IS NEW BOOLEAN RANGE IDENT_BOOL(TRUE) .. IDENT_BOOL(FALSE); BEGIN IF IDENT_BOOL(BOOLEAN'FIRST) /= FALSE THEN FAILED ( "WRONG VALUE FOR BOOLEAN'FIRST" ); END IF; IF IDENT_BOOL(BOOLEAN'LAST) /= TRUE THEN FAILED ( "WRONG VALUE FOR BOOLEAN'LAST" ); END IF; IF TBOOL'FIRST /= TRUE THEN FAILED ( "WRONG VALUE FOR TBOOL'FIRST" ); END IF; IF TBOOL'LAST /= TRUE THEN FAILED ( "WRONG VALUE FOR TBOOL'LAST" ); END IF; IF FBOOL'FIRST /= FALSE THEN FAILED ( "WRONG VALUE FOR FBOOL'FIRST" ); END IF; IF FBOOL'LAST /= FALSE THEN FAILED ( "WRONG VALUE FOR FBOOL'LAST" ); END IF; IF NOBOOL'FIRST /= TRUE THEN FAILED ( "WRONG VALUE FOR NOBOOL'FIRST" ); END IF; IF NOBOOL'LAST /= FALSE THEN FAILED ( "WRONG VALUE FOR NOBOOL'LAST" ); END IF; IF NEWBOOL'FIRST /= FALSE THEN FAILED ( "WRONG VALUE FOR NEWBOOL'FIRST" ); END IF; IF NEWBOOL'LAST /= TRUE THEN FAILED ( "WRONG VALUE FOR NEWBOOL'LAST" ); END IF; IF NIL'FIRST /= TRUE THEN FAILED ( "WRONG VALUE FOR NIL'FIRST" ); END IF; IF NIL'LAST /= FALSE THEN FAILED ( "WRONG VALUE FOR NIL'LAST" ); END IF; END; RESULT; END C35508O;
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_2753.asm
ljhsiun2/medusa
9
168279
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1c7af, %r10 nop nop nop nop sub $33839, %rdi mov $0x6162636465666768, %r13 movq %r13, (%r10) nop nop xor %r13, %r13 lea addresses_D_ht+0x2faf, %rbx nop nop nop nop nop cmp $21129, %r15 mov (%rbx), %r8 nop nop nop nop dec %rbx lea addresses_D_ht+0x11faf, %r8 nop sub %rbp, %rbp mov $0x6162636465666768, %r15 movq %r15, %xmm6 and $0xffffffffffffffc0, %r8 vmovntdq %ymm6, (%r8) nop nop nop nop nop xor $28507, %r13 lea addresses_WT_ht+0xf2af, %rsi lea addresses_normal_ht+0x16c2f, %rdi nop nop nop and $59300, %rbx mov $42, %rcx rep movsw and %rcx, %rcx lea addresses_UC_ht+0x72f, %rsi lea addresses_A_ht+0x1410f, %rdi nop nop nop nop nop inc %r8 mov $96, %rcx rep movsq and %rdi, %rdi lea addresses_A_ht+0x65af, %rbp nop nop nop nop sub $23625, %rsi mov (%rbp), %edi nop nop nop nop sub $31824, %r10 lea addresses_A_ht+0x16faf, %rsi lea addresses_A_ht+0x1182f, %rdi nop nop nop nop nop dec %r8 mov $102, %rcx rep movsw nop nop nop nop and $46239, %r15 lea addresses_D_ht+0x3ccf, %r10 nop nop nop nop nop sub %r15, %r15 movb (%r10), %r13b nop nop nop nop cmp $54242, %r10 lea addresses_normal_ht+0xc7af, %rsi lea addresses_D_ht+0x5d2f, %rdi clflush (%rdi) nop and %rbx, %rbx mov $18, %rcx rep movsw nop nop nop nop sub $55892, %r15 lea addresses_WC_ht+0x158af, %rsi lea addresses_WT_ht+0x171b6, %rdi nop and $32869, %r13 mov $60, %rcx rep movsb sub $44622, %r15 lea addresses_D_ht+0x187af, %r10 nop nop nop nop sub %rcx, %rcx movb (%r10), %r8b nop nop nop add $31934, %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r8 push %rbp push %rcx push %rdx // Store lea addresses_D+0x40af, %r8 add %rbp, %rbp mov $0x5152535455565758, %rdx movq %rdx, (%r8) nop xor %rbp, %rbp // Load lea addresses_A+0x1d951, %r8 add %r13, %r13 movb (%r8), %r10b nop add %rbp, %rbp // Store lea addresses_D+0x149af, %rbp nop nop dec %rcx movb $0x51, (%rbp) nop nop nop cmp $63593, %rbp // Load lea addresses_US+0x137af, %r13 nop nop inc %r8 movb (%r13), %dl nop nop nop nop xor $15687, %r8 // Store mov $0x7af, %r13 nop nop and $51495, %r14 mov $0x5152535455565758, %rdx movq %rdx, %xmm6 movaps %xmm6, (%r13) nop nop nop nop nop add $21686, %r14 // Faulty Load lea addresses_A+0x1afaf, %r13 nop nop nop dec %r8 mov (%r13), %r14 lea oracles, %r13 and $0xff, %r14 shlq $12, %r14 mov (%r13,%r14,1), %r14 pop %rdx pop %rcx pop %rbp pop %r8 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': True, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': True, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': True, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, '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 */
orka/src/orka/implementation/orka-rendering-buffers-mapped-persistent.adb
onox/orka
52
26726
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 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. package body Orka.Rendering.Buffers.Mapped.Persistent is function Create_Buffer (Kind : Orka.Types.Element_Type; Length : Natural; Mode : IO_Mode) return Persistent_Mapped_Buffer is Storage_Flags : constant GL.Objects.Buffers.Storage_Bits := (Write => Mode = Write, Read => Mode = Read, Persistent => True, Coherent => True, others => False); Access_Flags : constant GL.Objects.Buffers.Access_Bits := (Write => Mode = Write, Read => Mode = Read, Persistent => True, Coherent => True, others => False); Total_Length : constant Natural := Length * Index_Type'Modulus; begin return Result : Persistent_Mapped_Buffer (Kind, Mode) do Result.Buffer := Buffers.Create_Buffer (Storage_Flags, Kind, Total_Length); Result.Index := Index_Type'First; Result.Offset := Length * Natural (Result.Index); Result.Map (Size (Total_Length), Access_Flags); end return; end Create_Buffer; overriding function Length (Object : Persistent_Mapped_Buffer) return Natural is (Object.Buffer.Length / Index_Type'Modulus); procedure Advance_Index (Object : in out Persistent_Mapped_Buffer) is begin Object.Index := Object.Index + 1; Object.Offset := Object.Length * Natural (Object.Index); end Advance_Index; end Orka.Rendering.Buffers.Mapped.Persistent;
oeis/141/A141208.asm
neoneye/loda-programs
11
244507
; A141208: a(n) = prime(prime(prime(n) - 1) - 1) - 1, where prime(n) = n-th prime. ; Submitted by <NAME> ; 1,2,12,36,106,150,238,280,396,576,612,862,1020,1068,1212,1492,1732,1810,2088,2346,2410,2712,2902,3220,3582,3906,4020,4210,4336,4512,5278,5530,5848,6028,6636,6688,7102,7516,7740,8110,8500,8572,9282,9396,9648 seq $0,6093 ; a(n) = prime(n) - 1. seq $0,175248 ; Noncomposites (A008578) with noncomposite (A008578) subscripts. sub $0,1
bin/JWASM/Samples/Dos2.asm
Abd-Beltaji/ASMEMU
3
170857
;--- this is a 16bit sample for DOS. To create a simple DOS 16bit ;--- real-mode binary enter: ;--- JWasm -mz Dos2.asm ;--- or, if a linker is to be used: ;--- JWasm Dos2.asm ;--- wlink format dos file Dos2.obj ;--- To debug the sample with MS CodeView enter ;--- JWasm -Zi Dos2.asm ;--- link /CO Dos2.obj; ;--- cv Dos2.exe ;--- Optionally, the module can be linked as a DPMI 16bit protected-mode ;--- application. There are 2 ways to achieve this: ;--- 1. use Borland DOS extender: ;--- JWasm Dos2.asm ;--- tlink /Tx Dos2.obj; ;--- The resulting binary will need Borland's RTM.EXE and DPMI16BI.OVL. ;--- [To debug the application with TD run "JWasm /Zd Dos2.asm" and ;--- then run "tlink /Tx /v Dos2.obj".] ;--- 2. use HX DOS extender: ;--- JWasm Dos2.asm ;--- wlink format windows file Dos2.obj op stub=hdld16.bin ;--- patchne Dos2.exe ;--- The result is a 16bit DPMI application which includes a DPMI host. ;--- [To get files HDLD16.BIN and PATCHNE.EXE download HXDEV16.ZIP]. .model small .stack 1024 .data text db 13,10,"Hello, world!",13,10,'$' .code start: mov ax, @data mov ds, ax mov ah, 09h mov dx, offset text int 21h mov ax, 4c00h int 21h end start
tools/scitools/conf/understand/ada/ada12/a-etgrbu.ads
brucegua/moocos
1
8446
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . E X E C U T I O N _ T I M E . G R O U P _ B U D G E T S -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- This unit is not implemented in typical GNAT implementations that lie on -- top of operating systems, because it is infeasible to implement in such -- environments. -- If a target environment provides appropriate support for this package, -- then the Unimplemented_Unit pragma should be removed from this spec and -- an appropriate body provided. with System; package Ada.Execution_Time.Group_Budgets is pragma Preelaborate; pragma Unimplemented_Unit; type Group_Budget is tagged limited private; type Group_Budget_Handler is access protected procedure (GB : in out Group_Budget); type Task_Array is array (Positive range <>) of Ada.Task_Identification.Task_Id; Min_Handler_Ceiling : constant System.Any_Priority := System.Any_Priority'First; -- Initial value is an arbitrary choice ??? procedure Add_Task (GB : in out Group_Budget; T : Ada.Task_Identification.Task_Id); procedure Remove_Task (GB : in out Group_Budget; T : Ada.Task_Identification.Task_Id); function Is_Member (GB : Group_Budget; T : Ada.Task_Identification.Task_Id) return Boolean; function Is_A_Group_Member (T : Ada.Task_Identification.Task_Id) return Boolean; function Members (GB : Group_Budget) return Task_Array; procedure Replenish (GB : in out Group_Budget; To : Ada.Real_Time.Time_Span); procedure Add (GB : in out Group_Budget; Interval : Ada.Real_Time.Time_Span); function Budget_Has_Expired (GB : Group_Budget) return Boolean; function Budget_Remaining (GB : Group_Budget) return Ada.Real_Time.Time_Span; procedure Set_Handler (GB : in out Group_Budget; Handler : Group_Budget_Handler); function Current_Handler (GB : Group_Budget) return Group_Budget_Handler; procedure Cancel_Handler (GB : in out Group_Budget; Cancelled : out Boolean); Group_Budget_Error : exception; private type Group_Budget is tagged limited null record; end Ada.Execution_Time.Group_Budgets;
main.adb
thieryw/game_of_life
0
28716
<gh_stars>0 with ada.text_io,ada.integer_text_io,game_types,game_functions,display,ada.calendar ; use ada.text_io ; procedure main is cells : game_types.array_of_cell ; f : file_type ; begin cells := game_functions.initialize_cells ; loop game_functions.render_game(cells) ; cells := game_functions.evolve_cells(cells) ; delay 1.0 ; end loop ; end main ;
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_dldpush.asm
meesokim/z88dk
0
243013
<gh_stars>0 SECTION code_fp_math48 PUBLIC asm_dldpush EXTERN am48_dldpush defc asm_dldpush = am48_dldpush
Scripts Pack Source Items/Scripts Pack/Core Components/Make Files Invisible.applescript
Phorofor/ScriptsPack.macOS
1
2679
<reponame>Phorofor/ScriptsPack.macOS<filename>Scripts Pack Source Items/Scripts Pack/Core Components/Make Files Invisible.applescript # Scripts Pack - Tweak various preference variables in macOS # <Phorofor, https://github.com/Phorofor/> -- Makes selected files or folders invisible without having to use any third party application -- Only works with files, not folders -- [>+<] Features need to be added: -- Add the ability to be able to apply changes to multiple files -- Add the ability to hide folders display alert "Would you like to make a file invisible or visible?" buttons {"Cancel", "Invisible", "Visible"} cancel button 1 default button 1 message "Makes the specified file(s) or folder(s) invisible or visible without the need of a 3rd party application! Only works with files you have permission to modify." if the button returned of the result is "Invisible" then set selectedFile to (choose file with prompt "Please select the file you wish to make invisible") as string set filePath to POSIX path of selectedFile try do shell script "chflags hidden " & filePath display alert "Changes applied!" message "Here's the location of the file you made to be invisible:" & return & return & filePath on error display alert "An Expected Error Occured!" message "This error can occur if the files you have selected may not be ones where you have permission to modify them. Please change its permissions in order to do so!" end try else set selectedFile to (choose file with prompt "Please select the file or folder you wish to make visible" with invisibles) as string set filePath to POSIX path of selectedFile try do shell script "chflags nohidden " & filePath display alert "Changes applied!" message "Here's the location of the file you made to be invisible:" & return & return & filePath on error display alert "A expected error occured!" message "This error can occur if the files you have selected may not be ones where you have permission to modify them. Please change its permissions in order to do so! Or you might've selected a file that is already visible. Invisible files show as if it's 'greyed out'" end try end if
sofa/src/com/tehforce/sofa/parser/SofaLang.g4
mockillo/sofa
1
1966
grammar SofaLang; prog: root; INT: [0-9]+; ID: [a-zA-Z]+; ARROW: '->'; root: team ; team: classentry+ ; classentry: classname '{' logic+ '}' ; classname: 'Warrior' #className_Warrior | 'Healer' #className_Healer | 'Ranger' #className_Ranger | 'Any' #className_Any ; logic: expr+ (ARROW) token+ ; expr: comparison #expr_Comparison | booleanBuiltin #expr_booleanBuiltin | 'otherwise' #expr_Otherwise ; comparison: numberBuiltin bop numberBuiltin #comparison_numberBuiltin ; numberBuiltin: (target '.')? ('distance') '(' targetBuiltin ')' #numberBuiltin_distanceTo | (target '.')? ('health') '(' ')' #numberBuiltin_health | (target '.')? ('maxhealth') '(' ')' #numberBuiltin_maxHealth | (target '.')? ('range') '(' ')' #numberBuiltin_range | INT #numberBuiltin_number ; directionalBuiltin: (target '.')? ('direction') '(' targetBuiltin ')' #directionalBultin_directionTo | (target '.')? ('oppositeDirection') '(' targetBuiltin ')' #directionalBultin_oppositeDirectionTo | direction #directionalBultin_direction ; booleanBuiltin: (target '.')? ('wounded') '(' ')' #booleanBuiltin_wounded | (target '.')? ('inRange') '(' target ')' #booleanBuiltin_inRange | (target '.')? ('alive') '(' ')' #booleanBuiltin_alive ; targetBuiltin: (target '.')? 'closest' '(' alignment ')' #targetBuiltin_closest | (target '.')? 'farthest' '(' alignment ')' #targetBuiltin_farthest | target #targetBuiltin_target ; token: 'Move' directionalBuiltin #token_move | 'Attack' targetBuiltin #token_attack | 'Heal' targetBuiltin #token_heal | 'Defend' #token_defend | 'Roam' #token_roam ; direction: 'Up' #direction_up | 'Down' #direction_down | 'Left' #direction_left | 'Right' #direction_right ; alignment: 'Friendly' #alignment_friendly | 'Enemy' #alignment_enemy ; target: alignment '.' classname ; bop: '==' #bop_eq | '>=' #bop_ge | '<=' #bop_le | '!=' #bop_ne | '<' #bop_lt | '>' #bop_gt ;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1800.asm
ljhsiun2/medusa
9
102440
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1bba3, %rax nop nop nop nop cmp $47328, %r12 mov (%rax), %rsi nop nop nop nop and %rsi, %rsi lea addresses_WC_ht+0x10677, %r13 nop nop nop nop nop and $60131, %rbp mov $0x6162636465666768, %rdx movq %rdx, (%r13) nop nop add %rbp, %rbp lea addresses_normal_ht+0xb0b7, %rax nop nop nop cmp %r11, %r11 movups (%rax), %xmm0 vpextrq $0, %xmm0, %rbp nop nop nop nop dec %rdx lea addresses_D_ht+0x997, %rsi xor $28482, %r12 movb (%rsi), %dl nop nop sub $21666, %r12 lea addresses_WC_ht+0x6297, %rsi lea addresses_UC_ht+0xc905, %rdi nop nop nop nop sub $24493, %rax mov $105, %rcx rep movsw nop nop nop nop nop and %rax, %rax lea addresses_UC_ht+0xdd97, %rsi lea addresses_D_ht+0x1c7f7, %rdi nop nop cmp %rax, %rax mov $48, %rcx rep movsq nop nop dec %rsi lea addresses_UC_ht+0x99f2, %rdi nop nop nop add $32034, %r11 mov (%rdi), %rdx nop dec %rcx lea addresses_normal_ht+0x19297, %rsi sub %rbp, %rbp movw $0x6162, (%rsi) nop sub $15097, %rdx lea addresses_D_ht+0x19895, %rsi lea addresses_WC_ht+0x8fd7, %rdi clflush (%rdi) nop add $40329, %r13 mov $56, %rcx rep movsw nop nop nop nop nop cmp $14348, %rsi lea addresses_WC_ht+0x13977, %r13 nop nop nop nop add $61692, %rdx mov (%r13), %edi nop nop nop nop cmp $5004, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r15 push %r8 push %r9 push %rbp push %rdi // Store lea addresses_UC+0x17197, %r14 nop nop nop nop nop add $65379, %r12 movw $0x5152, (%r14) nop nop nop nop cmp %r8, %r8 // Load mov $0x597, %r9 nop nop sub $58482, %r15 mov (%r9), %r8w nop nop nop xor $23095, %r14 // Faulty Load lea addresses_D+0x17997, %r12 nop and %r15, %r15 vmovups (%r12), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rbp lea oracles, %r15 and $0xff, %rbp shlq $12, %rbp mov (%r15,%rbp,1), %rbp pop %rdi pop %rbp pop %r9 pop %r8 pop %r15 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}} {'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 4}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}} {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}, '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/053/A053867.asm
neoneye/loda
22
84305
<filename>programs/oeis/053/A053867.asm ; A053867: Parity of sum of divisors of n less than n. ; 0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1 mov $1,$0 seq $1,53866 ; Parity of A000203(n), the sum of the divisors of n; a(n) = 1 when n is a square or twice a square, 0 otherwise. sub $0,$1 add $0,1 mod $0,2
src/Dodo/Binary/Immediate.agda
sourcedennis/agda-dodo
0
3543
{-# OPTIONS --without-K --safe #-} module Dodo.Binary.Immediate where -- Stdlib imports import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; _≢_; refl; subst) renaming (sym to ≡-sym) open import Level using (Level; _⊔_) open import Function using (_∘_; flip) open import Data.Empty using (⊥-elim) open import Data.Product using (_×_; _,_; proj₁; proj₂; ∃-syntax) open import Data.Sum using (_⊎_; inj₁; inj₂) open import Relation.Nullary using (¬_) open import Relation.Unary using (Pred) open import Relation.Binary using (Rel; REL) open import Relation.Binary using (IsStrictTotalOrder; Irreflexive; Trichotomous) open import Relation.Binary using (Transitive) open import Relation.Binary using (Tri; tri<; tri≈; tri>) open import Relation.Binary.Construct.Closure.Transitive using (TransClosure; [_]; _∷_; _∷ʳ_; _++_) -- Local imports open import Dodo.Unary.Equality open import Dodo.Unary.Unique open import Dodo.Binary.Equality open import Dodo.Binary.Transitive open import Dodo.Binary.Functional open import Dodo.Binary.Filter open import Dodo.Binary.Domain -- # Definitions # -- | The immediate relation over the given (order) relation immediate : ∀ {a ℓ : Level} {A : Set a} → Rel A ℓ ------------- → Rel A (a ⊔ ℓ) immediate r x y = r x y × ¬ (∃[ z ] r x z × TransClosure r z y) -- A more conventional definitions is: -- immediate r x y = r x y × (¬ ∃ λ{z → r x z × r z y}) -- which is identical to this one when r is Transitive Immediate : ∀ {a ℓ : Level} {A : Set a} → Rel A ℓ → Set (a ⊔ ℓ) -- For some reason, x and y have to be /explicit/. Otherwise, Agda complains about some -- of Immediate's uses. Unsure why. Immediate {A = A} r = ∀ (x y : A) → r x y → ¬ (∃[ z ] r x z × TransClosure r z y) -- # Operations # imm-flip : ∀ {a ℓ : Level} {A : Set a} → {R : Rel A ℓ} {x y : A} → immediate R x y → immediate (flip R) y x imm-flip {R = R} {x} {y} (Rxy , ¬∃z) = (Rxy , lemma) where ⁺-invert : {a ℓ : Level} {A : Set a} {R : Rel A ℓ} {x y : A} → {z : A} → R x z → TransClosure R z y → ∃[ q ] (TransClosure R x q × R q y) ⁺-invert {z = z} Rxz [ Rzy ] = (z , [ Rxz ] , Rzy) ⁺-invert {z = z} Rxz ( Rzq ∷ R⁺qy ) with ⁺-invert Rzq R⁺qy ... | v , R⁺zv , Rvy = (v , Rxz ∷ R⁺zv , Rvy) lemma : ¬ (∃[ z ] (flip R y z × TransClosure (flip R) z x)) lemma (z , flipRyz , flipR⁺zx) = let (q , R⁺yq , Rqx) = ⁺-invert flipRyz flipR⁺zx in ¬∃z (q , Rqx , ⁺-flip R⁺yq) -- # Properties # module _ {a ℓ : Level} {A : Set a} {R : Rel A ℓ} where imm-imm : Immediate (immediate R) imm-imm _ _ (Rxy , ¬∃z) (z , (Rxz , ¬∃w) , [immR]⁺xy) = ¬∃z (z , Rxz , ⁺-map _ proj₁ [immR]⁺xy) imm-⊆₂ : immediate R ⊆₂ R imm-⊆₂ = ⊆: λ{_ _ → proj₁} module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {_≈_ : Rel A ℓ₁} {_<_ : Rel A ℓ₂} where imm-uniqueˡ : Trichotomous _≈_ _<_ → {z : A} → Unique₁ _≈_ λ{τ → immediate _<_ τ z} imm-uniqueˡ triR {z} {x} {y} (Rxz , ¬∃y) (Ryz , ¬∃x) with triR x y ... | tri< Rxy x≉y ¬Ryx = ⊥-elim (¬∃y (y , Rxy , [ Ryz ])) ... | tri≈ ¬Rxy x≈y ¬Ryx = x≈y ... | tri> ¬Rxy x≉y Ryx = ⊥-elim (¬∃x (x , Ryx , [ Rxz ])) imm-uniqueʳ : Trichotomous _≈_ _<_ → {x : A} → Unique₁ _≈_ (immediate _<_ x) imm-uniqueʳ triR {x} {y} {z} (Rxy , ¬∃z) (Rxz , ¬∃y) with triR y z ... | tri< Ryz y≈z ¬Rzy = ⊥-elim (¬∃y (y , Rxy , [ Ryz ])) ... | tri≈ ¬Ryz y≈z ¬Rzy = y≈z ... | tri> ¬Ryz y≈z Rzy = ⊥-elim (¬∃z (z , Rxz , [ Rzy ])) module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} where -- immediate < x y → immediate < x z → y ≈ z imm-func : IsStrictTotalOrder ≈ < → Functional ≈ (immediate <) imm-func sto x y₁ y₂ (x<y₁ , ¬∃z[x<z×z<y₁]) (x<y₂ , ¬∃z[x<z×z<y₂]) with IsStrictTotalOrder.compare sto y₁ y₂ ... | tri< y₁<y₂ _ _ = ⊥-elim (¬∃z[x<z×z<y₂] (y₁ , x<y₁ , [ y₁<y₂ ])) ... | tri≈ _ y₁≈y₂ _ = y₁≈y₂ ... | tri> _ _ y₂<y₁ = ⊥-elim (¬∃z[x<z×z<y₁] (y₂ , x<y₂ , [ y₂<y₁ ])) module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {P : Pred A ℓ₁} {R : Rel A ℓ₂} where imm-filter-⊆₂ : filter-rel P (immediate R) ⊆₂ immediate (filter-rel P R) imm-filter-⊆₂ = ⊆: lemma where lemma : filter-rel P (immediate R) ⊆₂' immediate (filter-rel P R) lemma (with-pred x Px) (with-pred y Py) (Rxy , ¬∃z) = Rxy , ¬∃z' where ¬∃z' : ¬ (∃[ z ] (filter-rel P R (with-pred x Px) z × TransClosure (filter-rel P R) z (with-pred y Py))) ¬∃z' (with-pred z Pz , Rxz , fR⁺zy) = ¬∃z (z , Rxz , ⁺-strip-filter fR⁺zy) module _ {a ℓ : Level} {A : Set a} {R : Rel A ℓ} where immediate⁺ : Immediate R → R ⇔₂ immediate (TransClosure R) immediate⁺ immR = ⇔: ⊆-proof ⊇-proof where ⊆-proof : R ⊆₂' immediate (TransClosure R) ⊆-proof x y xRy = ([ xRy ] , lemma x y xRy) where lemma : (x y : A) → R x y → ¬ (∃[ z ] TransClosure R x z × TransClosure (TransClosure R) z y) lemma x y xRy (z , [ xRz ] , zR⁺y) = immR x y xRy (z , xRz , ⇔₂-apply-⊇₂ ⁺-idem zR⁺y) lemma x y xRy (z , _∷_ {_} {w} xRw wR⁺z , zR⁺y) = immR x y xRy (w , xRw , ⇔₂-apply-⊇₂ ⁺-idem (wR⁺z ∷ zR⁺y)) ⊇-proof : immediate (TransClosure R) ⊆₂' R ⊇-proof x y ([ x∼y ] , ¬∃z) = x∼y ⊇-proof x y (_∷_ {_} {w} x∼w wR⁺y , ¬∃z) = ⊥-elim (¬∃z (w , [ x∼w ] , [ wR⁺y ])) trans-imm⁺-⊆ : Transitive R → TransClosure (immediate R) ⊆₂ R trans-imm⁺-⊆ transR = ⊆: lemma where lemma : TransClosure (immediate R) ⊆₂' R lemma x y [ R[xy] ] = proj₁ R[xy] lemma x y (_∷_ {_} {z} R[xz] R⁺[zy]) = transR (proj₁ R[xz]) (lemma z y R⁺[zy]) imm-udr-⊆₁ : udr (immediate R) ⊆₁ udr R imm-udr-⊆₁ = ⊆: lemma where lemma : udr (immediate R) ⊆₁' udr R lemma _ (inj₁ (y , Rxy , ¬∃z)) = inj₁ (y , Rxy) lemma _ (inj₂ (x , Rxy , ¬∃z)) = inj₂ (x , Rxy)
src/core/external/jpeg-6bx/jidctred.asm
miahmie/krkrz
4
9214
<gh_stars>1-10 ; ; jidctred.asm - reduced-size IDCT (non-SIMD) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; This file contains inverse-DCT routines that produce reduced-size output: ; either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block. ; The following code is based directly on the IJG's original jidctred.c; ; see the jidctred.c for more details. ; ; Last Modified : October 17, 2004 ; ; [TAB8] %include "jsimdext.inc" %include "jdct.inc" %ifdef IDCT_SCALING_SUPPORTED ; This module is specialized to the case DCTSIZE = 8. ; %if DCTSIZE != 8 %error "Sorry, this code only copes with 8x8 DCTs." %endif ; -------------------------------------------------------------------------- ; Descale and correctly round a DWORD value that's scaled by N bits. ; %macro descale 2 %if (%2)<=7 add %1, byte (1<<((%2)-1)) ; add reg32,imm8 %else add %1, (1<<((%2)-1)) ; add reg32,imm32 %endif sar %1,%2 %endmacro ; -------------------------------------------------------------------------- %define CONST_BITS 13 %define PASS1_BITS 2 %if CONST_BITS == 13 F_0_211 equ 1730 ; FIX(0.211164243) F_0_509 equ 4176 ; FIX(0.509795579) F_0_601 equ 4926 ; FIX(0.601344887) F_0_720 equ 5906 ; FIX(0.720959822) F_0_765 equ 6270 ; FIX(0.765366865) F_0_850 equ 6967 ; FIX(0.850430095) F_0_899 equ 7373 ; FIX(0.899976223) F_1_061 equ 8697 ; FIX(1.061594337) F_1_272 equ 10426 ; FIX(1.272758580) F_1_451 equ 11893 ; FIX(1.451774981) F_1_847 equ 15137 ; FIX(1.847759065) F_2_172 equ 17799 ; FIX(2.172734803) F_2_562 equ 20995 ; FIX(2.562915447) F_3_624 equ 29692 ; FIX(3.624509785) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) %endif ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 4x4 output block. ; ; GLOBAL(void) ; jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ; JCOEFPTR coef_block, ; JSAMPARRAY output_buf, JDIMENSION output_col) ; %define cinfo(b) (b)+8 ; j_decompress_ptr cinfo %define compptr(b) (b)+12 ; jpeg_component_info * compptr %define coef_block(b) (b)+16 ; JCOEFPTR coef_block %define output_buf(b) (b)+20 ; JSAMPARRAY output_buf %define output_col(b) (b)+24 ; JDIMENSION output_col %define range_limit ebp-SIZEOF_POINTER ; JSAMPLE * range_limit %define workspace range_limit-(DCTSIZE*4)*SIZEOF_INT ; int workspace[DCTSIZE*4] align 16 global EXTN(jpeg_idct_4x4) EXTN(jpeg_idct_4x4): push ebp mov ebp,esp lea esp, [workspace] push ebx ; push ecx ; need not be preserved ; push edx ; need not be preserved push esi push edi ; ---- Pass 1: process columns from input, store into work array. mov edx, POINTER [compptr(ebp)] mov edx, POINTER [jcompinfo_dct_table(edx)] ; quantptr mov esi, JCOEFPTR [coef_block(ebp)] ; inptr lea edi, [workspace] ; int * wsptr mov ecx, DCTSIZE ; ctr alignx 16,7 .columnloop: ; Don't bother to process column 4, because second pass won't use it cmp ecx, byte DCTSIZE-4 je near .nextcolumn mov ax, JCOEF [COL(1,esi,SIZEOF_JCOEF)] or ax, JCOEF [COL(2,esi,SIZEOF_JCOEF)] jnz short .columnDCT mov ax, JCOEF [COL(3,esi,SIZEOF_JCOEF)] mov bx, JCOEF [COL(5,esi,SIZEOF_JCOEF)] or ax, JCOEF [COL(6,esi,SIZEOF_JCOEF)] or bx, JCOEF [COL(7,esi,SIZEOF_JCOEF)] or ax,bx jnz short .columnDCT ; -- AC terms all zero; we need not examine term 4 for 4x4 output mov ax, JCOEF [COL(0,esi,SIZEOF_JCOEF)] imul ax, ISLOW_MULT_TYPE [COL(0,edx,SIZEOF_ISLOW_MULT_TYPE)] cwde sal eax, PASS1_BITS mov INT [COL(0,edi,SIZEOF_INT)], eax mov INT [COL(1,edi,SIZEOF_INT)], eax mov INT [COL(2,edi,SIZEOF_INT)], eax mov INT [COL(3,edi,SIZEOF_INT)], eax jmp near .nextcolumn alignx 16,7 .columnDCT: push ecx ; ctr push esi ; coef_block push edx ; quantptr push edi ; wsptr ; -- Even part movsx ebx, JCOEF [COL(2,esi,SIZEOF_JCOEF)] movsx ecx, JCOEF [COL(6,esi,SIZEOF_JCOEF)] movsx eax, JCOEF [COL(0,esi,SIZEOF_JCOEF)] imul bx, ISLOW_MULT_TYPE [COL(2,edx,SIZEOF_ISLOW_MULT_TYPE)] imul cx, ISLOW_MULT_TYPE [COL(6,edx,SIZEOF_ISLOW_MULT_TYPE)] imul ax, ISLOW_MULT_TYPE [COL(0,edx,SIZEOF_ISLOW_MULT_TYPE)] imul ebx,(F_1_847) ; ebx=MULTIPLY(z2,FIX_1_847759065) imul ecx,(-F_0_765) ; ecx=MULTIPLY(z3,-FIX_0_765366865) sal eax,(CONST_BITS+1) ; eax=tmp0 add ecx,ebx ; ecx=tmp2 lea edi,[eax+ecx] ; edi=tmp10 sub eax,ecx ; eax=tmp12 push eax ; tmp12 push edi ; tmp10 ; -- Odd part movsx edi, JCOEF [COL(7,esi,SIZEOF_JCOEF)] movsx ecx, JCOEF [COL(5,esi,SIZEOF_JCOEF)] imul di, ISLOW_MULT_TYPE [COL(7,edx,SIZEOF_ISLOW_MULT_TYPE)] imul cx, ISLOW_MULT_TYPE [COL(5,edx,SIZEOF_ISLOW_MULT_TYPE)] movsx ebx, JCOEF [COL(3,esi,SIZEOF_JCOEF)] movsx eax, JCOEF [COL(1,esi,SIZEOF_JCOEF)] imul bx, ISLOW_MULT_TYPE [COL(3,edx,SIZEOF_ISLOW_MULT_TYPE)] imul ax, ISLOW_MULT_TYPE [COL(1,edx,SIZEOF_ISLOW_MULT_TYPE)] mov esi,edi ; esi=edi=z1 mov edx,ecx ; edx=ecx=z2 imul edi,(-F_0_211) ; edi=MULTIPLY(z1,-FIX_0_211164243) imul ecx,(F_1_451) ; ecx=MULTIPLY(z2,FIX_1_451774981) imul esi,(-F_0_509) ; esi=MULTIPLY(z1,-FIX_0_509795579) imul edx,(-F_0_601) ; edx=MULTIPLY(z2,-FIX_0_601344887) add edi,ecx ; edi=(tmp0) add esi,edx ; esi=(tmp2) mov ecx,ebx ; ecx=ebx=z3 mov edx,eax ; edx=eax=z4 imul ebx,(-F_2_172) ; ebx=MULTIPLY(z3,-FIX_2_172734803) imul eax,(F_1_061) ; eax=MULTIPLY(z4,FIX_1_061594337) imul ecx,(F_0_899) ; ecx=MULTIPLY(z3,FIX_0_899976223) imul edx,(F_2_562) ; edx=MULTIPLY(z4,FIX_2_562915447) add edi,ebx add esi,ecx add edi,eax ; edi=tmp0 add esi,edx ; esi=tmp2 ; -- Final output stage pop ebx ; ebx=tmp10 pop ecx ; ecx=tmp12 lea eax,[ebx+esi] ; eax=data0(=tmp10+tmp2) sub ebx,esi ; ebx=data3(=tmp10-tmp2) lea edx,[ecx+edi] ; edx=data1(=tmp12+tmp0) sub ecx,edi ; ecx=data2(=tmp12-tmp0) pop edi ; wsptr descale eax,(CONST_BITS-PASS1_BITS+1) descale ebx,(CONST_BITS-PASS1_BITS+1) descale edx,(CONST_BITS-PASS1_BITS+1) descale ecx,(CONST_BITS-PASS1_BITS+1) mov INT [COL(0,edi,SIZEOF_INT)], eax mov INT [COL(3,edi,SIZEOF_INT)], ebx mov INT [COL(1,edi,SIZEOF_INT)], edx mov INT [COL(2,edi,SIZEOF_INT)], ecx pop edx ; quantptr pop esi ; coef_block pop ecx ; ctr .nextcolumn: add esi, byte SIZEOF_JCOEF ; advance pointers to next column add edx, byte SIZEOF_ISLOW_MULT_TYPE add edi, byte SIZEOF_INT dec ecx jnz near .columnloop ; ---- Pass 2: process 4 rows from work array, store into output array. mov eax, POINTER [cinfo(ebp)] mov eax, POINTER [jdstruct_sample_range_limit(eax)] sub eax, byte -CENTERJSAMPLE*SIZEOF_JSAMPLE ; JSAMPLE * range_limit mov POINTER [range_limit], eax lea esi, [workspace] ; int * wsptr mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) mov ecx, DCTSIZE/2 ; ctr alignx 16,7 .rowloop: push edi mov edi, JSAMPROW [edi] ; (JSAMPLE *) add edi, JDIMENSION [output_col(ebp)] ; edi=outptr %ifndef NO_ZERO_ROW_TEST mov eax, INT [ROW(1,esi,SIZEOF_INT)] or eax, INT [ROW(2,esi,SIZEOF_INT)] jnz short .rowDCT mov eax, INT [ROW(3,esi,SIZEOF_INT)] mov ebx, INT [ROW(5,esi,SIZEOF_INT)] or eax, INT [ROW(6,esi,SIZEOF_INT)] or ebx, INT [ROW(7,esi,SIZEOF_INT)] or eax,ebx jnz short .rowDCT ; -- AC terms all zero mov eax, INT [ROW(0,esi,SIZEOF_INT)] mov edx, POINTER [range_limit] ; (JSAMPLE *) descale eax,(PASS1_BITS+3) and eax,RANGE_MASK mov al, JSAMPLE [edx+eax*SIZEOF_JSAMPLE] mov JSAMPLE [edi+0*SIZEOF_JSAMPLE], al mov JSAMPLE [edi+1*SIZEOF_JSAMPLE], al mov JSAMPLE [edi+2*SIZEOF_JSAMPLE], al mov JSAMPLE [edi+3*SIZEOF_JSAMPLE], al jmp near .nextrow alignx 16,7 %endif .rowDCT: push esi ; wsptr push ecx ; ctr push edi ; outptr ; -- Even part mov eax, INT [ROW(0,esi,SIZEOF_INT)] mov ebx, INT [ROW(2,esi,SIZEOF_INT)] mov ecx, INT [ROW(6,esi,SIZEOF_INT)] imul ebx,(F_1_847) ; ebx=MULTIPLY(z2,FIX_1_847759065) imul ecx,(-F_0_765) ; ecx=MULTIPLY(z3,-FIX_0_765366865) sal eax,(CONST_BITS+1) ; eax=tmp0 add ecx,ebx ; ecx=tmp2 lea edi,[eax+ecx] ; edi=tmp10 sub eax,ecx ; eax=tmp12 push eax ; tmp12 push edi ; tmp10 ; -- Odd part mov eax, INT [ROW(1,esi,SIZEOF_INT)] mov ebx, INT [ROW(3,esi,SIZEOF_INT)] mov ecx, INT [ROW(5,esi,SIZEOF_INT)] mov edi, INT [ROW(7,esi,SIZEOF_INT)] mov esi,edi ; esi=edi=z1 mov edx,ecx ; edx=ecx=z2 imul edi,(-F_0_211) ; edi=MULTIPLY(z1,-FIX_0_211164243) imul ecx,(F_1_451) ; ecx=MULTIPLY(z2,FIX_1_451774981) imul esi,(-F_0_509) ; esi=MULTIPLY(z1,-FIX_0_509795579) imul edx,(-F_0_601) ; edx=MULTIPLY(z2,-FIX_0_601344887) add edi,ecx ; edi=(tmp0) add esi,edx ; esi=(tmp2) mov ecx,ebx ; ecx=ebx=z3 mov edx,eax ; edx=eax=z4 imul ebx,(-F_2_172) ; ebx=MULTIPLY(z3,-FIX_2_172734803) imul eax,(F_1_061) ; eax=MULTIPLY(z4,FIX_1_061594337) imul ecx,(F_0_899) ; ecx=MULTIPLY(z3,FIX_0_899976223) imul edx,(F_2_562) ; edx=MULTIPLY(z4,FIX_2_562915447) add edi,ebx add esi,ecx add edi,eax ; edi=tmp0 add esi,edx ; esi=tmp2 ; -- Final output stage pop ebx ; ebx=tmp10 pop ecx ; ecx=tmp12 lea eax,[ebx+esi] ; eax=data0(=tmp10+tmp2) sub ebx,esi ; ebx=data3(=tmp10-tmp2) lea edx,[ecx+edi] ; edx=data1(=tmp12+tmp0) sub ecx,edi ; ecx=data2(=tmp12-tmp0) mov esi, POINTER [range_limit] ; (JSAMPLE *) descale eax,(CONST_BITS+PASS1_BITS+3+1) descale ebx,(CONST_BITS+PASS1_BITS+3+1) descale edx,(CONST_BITS+PASS1_BITS+3+1) descale ecx,(CONST_BITS+PASS1_BITS+3+1) pop edi ; outptr and eax,RANGE_MASK and ebx,RANGE_MASK and edx,RANGE_MASK and ecx,RANGE_MASK mov al, JSAMPLE [esi+eax*SIZEOF_JSAMPLE] mov bl, JSAMPLE [esi+ebx*SIZEOF_JSAMPLE] mov dl, JSAMPLE [esi+edx*SIZEOF_JSAMPLE] mov cl, JSAMPLE [esi+ecx*SIZEOF_JSAMPLE] mov JSAMPLE [edi+0*SIZEOF_JSAMPLE], al mov JSAMPLE [edi+3*SIZEOF_JSAMPLE], bl mov JSAMPLE [edi+1*SIZEOF_JSAMPLE], dl mov JSAMPLE [edi+2*SIZEOF_JSAMPLE], cl pop ecx ; ctr pop esi ; wsptr .nextrow: pop edi add esi, byte DCTSIZE*SIZEOF_INT ; advance pointer to next row add edi, byte SIZEOF_JSAMPROW dec ecx jnz near .rowloop pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; need not be preserved pop ebx mov esp,ebp pop ebp ret ; -------------------------------------------------------------------------- ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 2x2 output block. ; ; GLOBAL(void) ; jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ; JCOEFPTR coef_block, ; JSAMPARRAY output_buf, JDIMENSION output_col) ; %define cinfo(b) (b)+8 ; j_decompress_ptr cinfo %define compptr(b) (b)+12 ; jpeg_component_info * compptr %define coef_block(b) (b)+16 ; JCOEFPTR coef_block %define output_buf(b) (b)+20 ; JSAMPARRAY output_buf %define output_col(b) (b)+24 ; JDIMENSION output_col %define range_limit ebp-SIZEOF_POINTER ; JSAMPLE * range_limit %define workspace range_limit-(DCTSIZE*2)*SIZEOF_INT ; int workspace[DCTSIZE*2] align 16 global EXTN(jpeg_idct_2x2) EXTN(jpeg_idct_2x2): push ebp mov ebp,esp lea esp, [workspace] push ebx ; push ecx ; need not be preserved ; push edx ; need not be preserved push esi push edi ; ---- Pass 1: process columns from input, store into work array. mov edx, POINTER [compptr(ebp)] mov edx, POINTER [jcompinfo_dct_table(edx)] ; quantptr mov esi, JCOEFPTR [coef_block(ebp)] ; inptr lea edi, [workspace] ; int * wsptr mov ecx, DCTSIZE ; ctr alignx 16,7 .columnloop: ; Don't bother to process columns 2,4,6 test ecx, 0x09 jz near .nextcolumn mov ax, JCOEF [COL(1,esi,SIZEOF_JCOEF)] or ax, JCOEF [COL(3,esi,SIZEOF_JCOEF)] jnz short .columnDCT mov ax, JCOEF [COL(5,esi,SIZEOF_JCOEF)] or ax, JCOEF [COL(7,esi,SIZEOF_JCOEF)] jnz short .columnDCT ; -- AC terms all zero; we need not examine terms 2,4,6 for 2x2 output mov ax, JCOEF [COL(0,esi,SIZEOF_JCOEF)] imul ax, ISLOW_MULT_TYPE [COL(0,edx,SIZEOF_ISLOW_MULT_TYPE)] cwde sal eax, PASS1_BITS mov INT [COL(0,edi,SIZEOF_INT)], eax mov INT [COL(1,edi,SIZEOF_INT)], eax jmp short .nextcolumn alignx 16,7 .columnDCT: push ecx ; ctr push edi ; wsptr ; -- Odd part movsx eax, JCOEF [COL(1,esi,SIZEOF_JCOEF)] movsx ebx, JCOEF [COL(3,esi,SIZEOF_JCOEF)] imul ax, ISLOW_MULT_TYPE [COL(1,edx,SIZEOF_ISLOW_MULT_TYPE)] imul bx, ISLOW_MULT_TYPE [COL(3,edx,SIZEOF_ISLOW_MULT_TYPE)] movsx ecx, JCOEF [COL(5,esi,SIZEOF_JCOEF)] movsx edi, JCOEF [COL(7,esi,SIZEOF_JCOEF)] imul cx, ISLOW_MULT_TYPE [COL(5,edx,SIZEOF_ISLOW_MULT_TYPE)] imul di, ISLOW_MULT_TYPE [COL(7,edx,SIZEOF_ISLOW_MULT_TYPE)] imul eax,(F_3_624) ; eax=MULTIPLY(data1,FIX_3_624509785) imul ebx,(-F_1_272) ; ebx=MULTIPLY(data3,-FIX_1_272758580) imul ecx,(F_0_850) ; ecx=MULTIPLY(data5,FIX_0_850430095) imul edi,(-F_0_720) ; edi=MULTIPLY(data7,-FIX_0_720959822) add eax,ebx add ecx,edi add ecx,eax ; ecx=tmp0 ; -- Even part mov ax, JCOEF [COL(0,esi,SIZEOF_JCOEF)] imul ax, ISLOW_MULT_TYPE [COL(0,edx,SIZEOF_ISLOW_MULT_TYPE)] cwde sal eax,(CONST_BITS+2) ; eax=tmp10 ; -- Final output stage pop edi ; wsptr lea ebx,[eax+ecx] ; ebx=data0(=tmp10+tmp0) sub eax,ecx ; eax=data1(=tmp10-tmp0) pop ecx ; ctr descale ebx,(CONST_BITS-PASS1_BITS+2) descale eax,(CONST_BITS-PASS1_BITS+2) mov INT [COL(0,edi,SIZEOF_INT)], ebx mov INT [COL(1,edi,SIZEOF_INT)], eax .nextcolumn: add esi, byte SIZEOF_JCOEF ; advance pointers to next column add edx, byte SIZEOF_ISLOW_MULT_TYPE add edi, byte SIZEOF_INT dec ecx jnz near .columnloop ; ---- Pass 2: process 2 rows from work array, store into output array. mov eax, POINTER [cinfo(ebp)] mov eax, POINTER [jdstruct_sample_range_limit(eax)] sub eax, byte -CENTERJSAMPLE*SIZEOF_JSAMPLE ; JSAMPLE * range_limit mov POINTER [range_limit], eax lea esi, [workspace] ; int * wsptr mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) mov ecx, DCTSIZE/4 ; ctr alignx 16,7 .rowloop: push edi mov edi, JSAMPROW [edi] ; (JSAMPLE *) add edi, JDIMENSION [output_col(ebp)] ; edi=outptr %ifndef NO_ZERO_ROW_TEST mov eax, INT [ROW(1,esi,SIZEOF_INT)] or eax, INT [ROW(3,esi,SIZEOF_INT)] jnz short .rowDCT mov eax, INT [ROW(5,esi,SIZEOF_INT)] or eax, INT [ROW(7,esi,SIZEOF_INT)] jnz short .rowDCT ; -- AC terms all zero mov eax, INT [ROW(0,esi,SIZEOF_INT)] mov edx, POINTER [range_limit] ; (JSAMPLE *) descale eax,(PASS1_BITS+3) and eax,RANGE_MASK mov al, JSAMPLE [edx+eax*SIZEOF_JSAMPLE] mov JSAMPLE [edi+0*SIZEOF_JSAMPLE], al mov JSAMPLE [edi+1*SIZEOF_JSAMPLE], al jmp short .nextrow alignx 16,7 %endif .rowDCT: push ecx ; ctr ; -- Odd part mov eax, INT [ROW(1,esi,SIZEOF_INT)] mov ebx, INT [ROW(3,esi,SIZEOF_INT)] mov ecx, INT [ROW(5,esi,SIZEOF_INT)] mov edx, INT [ROW(7,esi,SIZEOF_INT)] imul eax,(F_3_624) ; eax=MULTIPLY(data1,FIX_3_624509785) imul ebx,(-F_1_272) ; ebx=MULTIPLY(data3,-FIX_1_272758580) imul ecx,(F_0_850) ; ecx=MULTIPLY(data5,FIX_0_850430095) imul edx,(-F_0_720) ; edx=MULTIPLY(data7,-FIX_0_720959822) add eax,ebx add ecx,edx add ecx,eax ; ecx=tmp0 ; -- Even part mov eax, INT [ROW(0,esi,SIZEOF_INT)] sal eax,(CONST_BITS+2) ; eax=tmp10 ; -- Final output stage mov edx, POINTER [range_limit] ; (JSAMPLE *) lea ebx,[eax+ecx] ; ebx=data0(=tmp10+tmp0) sub eax,ecx ; eax=data1(=tmp10-tmp0) pop ecx ; ctr descale ebx,(CONST_BITS+PASS1_BITS+3+2) descale eax,(CONST_BITS+PASS1_BITS+3+2) and ebx,RANGE_MASK and eax,RANGE_MASK mov bl, JSAMPLE [edx+ebx*SIZEOF_JSAMPLE] mov al, JSAMPLE [edx+eax*SIZEOF_JSAMPLE] mov JSAMPLE [edi+0*SIZEOF_JSAMPLE], bl mov JSAMPLE [edi+1*SIZEOF_JSAMPLE], al .nextrow: pop edi add esi, byte DCTSIZE*SIZEOF_INT ; advance pointer to next row add edi, byte SIZEOF_JSAMPROW dec ecx jnz near .rowloop pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; need not be preserved pop ebx mov esp,ebp pop ebp ret ; -------------------------------------------------------------------------- ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 1x1 output block. ; ; GLOBAL(void) ; jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ; JCOEFPTR coef_block, ; JSAMPARRAY output_buf, JDIMENSION output_col) ; %define cinfo(b) (b)+8 ; j_decompress_ptr cinfo %define compptr(b) (b)+12 ; jpeg_component_info * compptr %define coef_block(b) (b)+16 ; JCOEFPTR coef_block %define output_buf(b) (b)+20 ; JSAMPARRAY output_buf %define output_col(b) (b)+24 ; JDIMENSION output_col %define ebp esp-4 ; use esp instead of ebp align 16 global EXTN(jpeg_idct_1x1) EXTN(jpeg_idct_1x1): ; push ebp ; mov ebp,esp ; push ebx ; unused ; push ecx ; need not be preserved ; push edx ; need not be preserved ; push esi ; unused ; push edi ; unused ; We hardly need an inverse DCT routine for this: just take the ; average pixel value, which is one-eighth of the DC coefficient. mov edx, POINTER [compptr(ebp)] mov ecx, JCOEFPTR [coef_block(ebp)] ; inptr mov edx, POINTER [jcompinfo_dct_table(edx)] ; quantptr mov ax, JCOEF [COL(0,ecx,SIZEOF_JCOEF)] imul ax, ISLOW_MULT_TYPE [COL(0,edx,SIZEOF_ISLOW_MULT_TYPE)] mov ecx, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) mov edx, JDIMENSION [output_col(ebp)] mov ecx, JSAMPROW [ecx] ; (JSAMPLE *) add ax, (1 << (3-1)) + (CENTERJSAMPLE << 3) sar ax,3 ; descale test ah,ah ; unsigned saturation jz short .output not ax sar ax,15 alignx 16,3 .output: mov JSAMPLE [ecx+edx*SIZEOF_JSAMPLE], al ; pop edi ; unused ; pop esi ; unused ; pop edx ; need not be preserved ; pop ecx ; need not be preserved ; pop ebx ; unused ; pop ebp ret %endif ; IDCT_SCALING_SUPPORTED
alloy4fun_models/trainstlt/models/6/7HAgCnPZxoPudLBk9.als
Kaixi26/org.alloytools.alloy
0
2584
open main pred id7HAgCnPZxoPudLBk9_prop7 { all t : Train | (eventually always no t.pos') } pred __repair { id7HAgCnPZxoPudLBk9_prop7 } check __repair { id7HAgCnPZxoPudLBk9_prop7 <=> prop7o }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_20258_1432.asm
ljhsiun2/medusa
9
178646
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r9 push %rdi lea addresses_A_ht+0x6dba, %r15 nop nop xor $482, %rdi vmovups (%r15), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r9 and %r12, %r12 pop %rdi pop %r9 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rax push %rbp push %rbx push %rdi // Store lea addresses_RW+0x279a, %rbp nop nop nop nop nop xor $37779, %r10 mov $0x5152535455565758, %rax movq %rax, %xmm7 movups %xmm7, (%rbp) dec %rdi // Store lea addresses_PSE+0x1852a, %r13 nop sub %rbx, %rbx movw $0x5152, (%r13) nop nop nop nop cmp $39923, %rbx // Faulty Load lea addresses_RW+0xb3da, %rbp clflush (%rbp) nop nop cmp $42156, %rax movb (%rbp), %r13b lea oracles, %rbp and $0xff, %r13 shlq $12, %r13 mov (%rbp,%r13,1), %r13 pop %rdi pop %rbx pop %rbp pop %rax pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_RW'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 5, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'32': 20258} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 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/031/A031286.asm
neoneye/loda
22
84007
<reponame>neoneye/loda<gh_stars>10-100 ; A031286: Additive persistence: number of summations of digits needed to obtain a single digit (the additive digital root). ; 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2 lpb $0 seq $0,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n). add $1,17 lpe div $1,17 mov $0,$1
test/Fail/Issue1609c.agda
shlevy/agda
1,989
16926
-- Andreas, 2015-07-13 Better parse errors for illegal type signatures A | B : Set
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca_notsx.log_21829_226.asm
ljhsiun2/medusa
9
2870
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0xdca5, %rbp nop nop nop nop add %rax, %rax vmovups (%rbp), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rbx nop nop cmp %rsi, %rsi lea addresses_WC_ht+0x1e725, %rsi lea addresses_A_ht+0x1819e, %rdi clflush (%rsi) nop nop nop nop add %r13, %r13 mov $74, %rcx rep movsl nop nop nop nop nop add $10665, %r13 lea addresses_normal_ht+0x112a5, %rsi lea addresses_UC_ht+0x1a2a5, %rdi nop nop nop nop nop sub %r11, %r11 mov $109, %rcx rep movsl nop nop nop nop nop sub %rbp, %rbp lea addresses_UC_ht+0x79a5, %r11 nop nop nop nop nop xor %rdi, %rdi mov (%r11), %rax nop nop nop nop sub $50153, %rdi lea addresses_A_ht+0x193a5, %rbp nop nop nop nop nop cmp $37473, %rbx movw $0x6162, (%rbp) and $10154, %rbp lea addresses_WC_ht+0x49a5, %rbx nop nop nop nop nop and $41086, %rax movw $0x6162, (%rbx) nop nop nop and %rbp, %rbp lea addresses_UC_ht+0x1b4e9, %rsi lea addresses_normal_ht+0x1dd5d, %rdi nop nop nop xor $39480, %r13 mov $15, %rcx rep movsl nop nop nop inc %rdi lea addresses_UC_ht+0x82a5, %rsi lea addresses_WT_ht+0x7a65, %rdi nop nop add $61142, %rbx mov $27, %rcx rep movsw nop nop nop nop nop xor %r11, %r11 lea addresses_WT_ht+0x1aea5, %rsi lea addresses_WC_ht+0xb1ab, %rdi nop and %r13, %r13 mov $63, %rcx rep movsb nop add %rbp, %rbp lea addresses_D_ht+0x12aa5, %rbx clflush (%rbx) nop add $63666, %r11 mov $0x6162636465666768, %rdi movq %rdi, %xmm1 movups %xmm1, (%rbx) nop nop nop nop nop xor $33657, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r15 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi // Load lea addresses_WC+0x1bbed, %rsi nop nop add %rcx, %rcx movups (%rsi), %xmm1 vpextrq $1, %xmm1, %rbp nop nop add $12951, %rbp // Store lea addresses_RW+0x1a191, %rbx nop nop nop nop nop xor $5973, %r15 mov $0x5152535455565758, %r9 movq %r9, %xmm3 vmovaps %ymm3, (%rbx) sub $12832, %r9 // REPMOV lea addresses_D+0x1eaa5, %rsi lea addresses_RW+0xb0a5, %rdi nop nop nop sub $49915, %r15 mov $1, %rcx rep movsl cmp $14196, %r15 // Faulty Load lea addresses_D+0x1eaa5, %r8 nop nop nop nop and $37377, %rcx mov (%r8), %esi lea oracles, %r8 and $0xff, %rsi shlq $12, %rsi mov (%r8,%rsi,1), %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r15 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'src': {'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_RW'}, 'OP': 'REPM'} [Faulty Load] {'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'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 */
drivers/chebyshev.adb
sciencylab/lagrangian-solver
0
8483
with Numerics; use Numerics; package body Chebyshev is function CGL_Transform (F : in Real_Vector) return Real_Vector is N : constant Nat := F'Length; X : constant Real_Vector := Chebyshev_Gauss_Lobatto (N, -1.0, 1.0); G : Real_Vector := (2.0 / Real (N - 1)) * F; T : Real_Matrix (1 .. N, 1 .. N); begin G (1) := 0.5 * G (1); G (N) := 0.5 * G (N); for J in X'Range loop T (1, J) := 1.0; T (2, J) := X (J); for I in 3 .. N loop T (I, J) := 2.0 * X (J) * T (I - 1, J) - T (I - 2, J); end loop; end loop; return (T * G); end CGL_Transform; function Chebyshev_Gauss_Lobatto (N : in Nat; L : in Real := 0.0; R : in Real := 1.0) return Real_Vector is use Real_Functions; K : constant Real := (R - L) / 2.0; X : Real_Vector (1 .. N); Y : Real; begin for I in X'Range loop Y := Real (I - 1) * π / Real (N - 1); X (I) := L + K * (1.0 - Cos (Y)); end loop; return X; end Chebyshev_Gauss_Lobatto; function Derivative_Matrix (N : in Nat; L : in Real := 0.0; R : in Real := 1.0) return Real_Matrix is use Real_Functions; M : constant Pos := N - 1; K : constant Real := 2.0 / (R - L); X : constant Real_Vector := Chebyshev_Gauss_Lobatto (N, -1.0, 1.0); P : Real_Vector (1 .. N) := (others => 1.0); D : Real_Matrix (1 .. N, 1 .. N); begin P (1) := 2.0; P (N) := 2.0; -- Top-left and bottom-right corners D (1, 1) := -(1.0 + 2.0 * Real (M ** 2)) / 6.0; D (N, N) := (1.0 + 2.0 * Real (M ** 2)) / 6.0; -- Diagonals for I in D'First (1) + 1 .. D'Last (1) - 1 loop D (I, I) := -0.5 * X (I) / (1.0 - X (I) ** 2); end loop; -- Non-diagonals for I in D'Range (1) loop for J in D'Range (2) loop if I /= J then D (I, J) := (P (I) / P (J)) / (X (J) - X (I)); if (I + J) mod 2 = 0 then D (I, J) := -D (I, J); end if; end if; D (I, J) := K * D (I, J); -- note: outside non-diag if-clause end loop; end loop; return D; end Derivative_Matrix; procedure CGL (D : out Real_Matrix; X : out Real_Vector; N : in Nat; L : in Real := 0.0; R : in Real := 1.0) is begin X := Chebyshev_Gauss_Lobatto (N, L, R); D := Derivative_Matrix (N, L, R); end CGL; function Interpolate (A : in Real_Vector; X : in Real; L : in Real := 0.0; R : in Real := 1.0) return Real is N : constant Nat := A'Length; T : Real_Vector (1 .. N); Y : Real := -1.0 + 2.0 * (X - L) / (R - L); F : Real := 0.0; begin T (1) := 1.0; T (2) := Y; for I in 3 .. N loop T (I) := 2.0 * Y * T (I - 1) - T (I - 2); end loop; T (1) := 0.5; T (N) := 0.5 * T (N); for I in 1 .. N loop F := F + A (I) * T (I); end loop; return F; end Interpolate; end Chebyshev;
src/test/ref/declared-memory-var-5.asm
jbrandwood/kickc
2
28150
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store) // Test a memory variable struct value // Commodore 64 PRG executable file .file [name="declared-memory-var-5.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const OFFSET_STRUCT_FOO_THING2 = 1 .segment Code main: { .label SCREEN = $400 // SCREEN[i++] = bar.thing1 lda bar sta SCREEN // SCREEN[i++] = bar.thing2 lda bar+OFFSET_STRUCT_FOO_THING2 sta SCREEN+1 // } rts } .segment Data bar: .byte 'a', 'b'
src/ggt/group/Definitions.agda
zampino/ggt
2
120
module GGT.Group.Definitions {a ℓ} where open import Relation.Unary using (Pred) open import Algebra.Bundles using (Group) open import Level IsOpInvClosed : {l : Level} → (G : Group a ℓ) → (Pred (Group.Carrier G) l) → Set (a ⊔ l) IsOpInvClosed G P = ∀ {x y : Carrier} → P x → P y → P (x - y) where open Group G
src/events.adb
docandrew/troodon
5
16570
with Ada.Real_Time; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with GNAT.OS_Lib; with Interfaces; use Interfaces; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System; with GL; with GLX; with xcb; use xcb; with xproto; use xproto; with xcb_damage; with Compositor; with Frames; with Setup; with Util; use Util; package body events is -- focusWin : xcb_window_t := 0; -- Window movement & resizing. -- need both the original window pos -- and the mouse pos, since we want -- to adjust the window position by -- the delta, not just put the window -- where the mouse is. winStartX : Interfaces.C.short; winStartY : Interfaces.C.short; dragStartX : Interfaces.C.short; dragStartY : Interfaces.C.short; dragFrame : xcb_window_t; dragInProgress : Boolean := False; -- Set to true if should exit main loop. close : Boolean := False; --------------------------------------------------------------------------- -- handleMapRequest --------------------------------------------------------------------------- procedure handleMapRequest (connection : access xcb_connection_t; event : eventPtr; rend : render.Renderer) is use Frames; use Render; type mapRequestPtr is access all xcb_map_request_event_t; mapRequestEvent : mapRequestPtr; cookie : xcb_void_cookie_t; -- dummy : int; winType : xcb_atom_t := XCB_ATOM_NONE; -- type of window, if set. -- title : Unbounded_String := To_Unbounded_String (""); -- screen : access xcb_screen_t; -- frameThis : Boolean := True; -- drawable : GLX.GLXDrawable := 0; -- geom : xcb_get_geometry_reply_t; -- frameValueMask : Interfaces.C.unsigned := -- (if rend.kind = render.SOFTWARE then -- XCB_CW_BORDER_PIXEL or XCB_CW_BACK_PIXEL or XCB_CW_EVENT_MASK -- else -- XCB_CW_BORDER_PIXEL or XCB_CW_BACK_PIXEL or XCB_CW_EVENT_MASK or XCB_CW_COLORMAP); -- frameCreateAttributes : aliased xcb_create_window_value_list_t; -- := (others => <>); function toMapEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => mapRequestPtr); begin Ada.Text_IO.Put_Line ("Enter handleMapRequest"); mapRequestEvent := toMapEvent (event); -- See if the map event is for a frame we've already created. if isFrame (mapRequestEvent.window) then -- If so, go ahead and map it as-is. declare F : Frame := getFrameFromList (mapRequestEvent.window); begin F.map; return; end; end if; -- If not, is this for an app window we've already framed? if hasFrame (mapRequestEvent.window) then -- If so, go ahead and get its frame and map it. getFrameOfWindow (mapRequestEvent.window).map; return; end if; -- If EWMH in use, and this window sets the _NET_WM_WINDOW_TYPE property, honor that here, -- map the window without framing. if setup.ewmh /= null then winType := getAtomProperty (connection, mapRequestEvent.window, setup.ewmh.u_NET_WM_WINDOW_TYPE); if winType = setup.ewmh.u_NET_WM_WINDOW_TYPE_DOCK or winType = Setup.ewmh.u_NET_WM_WINDOW_TYPE_DESKTOP then -- frameThis := False; Ada.Text_IO.Put_Line("Troodon: mapping docked window"); Compositor.addWindow (mapRequestEvent.window); cookie := xcb_map_window (c => connection, window => mapRequestEvent.window); return; end if; end if; -- This is for an app whose frame doesn't exist yet, so create a new one -- and map it and its child. declare F : Frame := frameWindow(connection, mapRequestEvent.window, rend); begin -- Only need to composite the parent window. Compositor.addWindow (F.frameID); -- Compositor.addWindow (F.appWindow); F.map; end; end handleMapRequest; --------------------------------------------------------------------------- -- handleConfigureRequest --------------------------------------------------------------------------- procedure handleConfigureRequest (connection : access xcb_connection_t; event : eventPtr) is type configureRequestPtr is access all xcb_configure_request_event_t; configureRequestEvent : configureRequestPtr; windowAttributes : aliased xcb_configure_window_value_list_t; dummyCookie : xcb_void_cookie_t; dummy : int; function toConfigureEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => configureRequestPtr); begin -- Ada.Text_IO.Put_Line("enter handleConfigurationRequest"); configureRequestEvent := toConfigureEvent (event); -- @TODO, see if a frame is being configured, and if so, make sure we update -- the frame's internal width/height also. windowAttributes.x := int (configureRequestEvent.x); windowAttributes.y := int (configureRequestEvent.y); windowAttributes.width := unsigned (configureRequestEvent.width); windowAttributes.height := unsigned (configureRequestEvent.height); -- ignore window's border width, since we frame it ourselves. windowAttributes.border_width := 0; --unsigned (configureRequestEvent.border_width); windowAttributes.sibling := configureRequestEvent.sibling; windowAttributes.stack_mode := unsigned (configureRequestEvent.stack_mode); dummyCookie := xcb_configure_window_aux(c => connection, window => configureRequestEvent.window, value_mask => configureRequestEvent.value_mask, value_list => windowAttributes'Access); -- Ada.Text_IO.Put_Line ("Configuring window" & configureRequestEvent.window'Image); dummy := xcb_flush (connection); Ada.Text_IO.Put_Line("exit handleConfigurationRequest"); end handleConfigureRequest; --------------------------------------------------------------------------- -- handleButtonPress --------------------------------------------------------------------------- procedure handleButtonPress (connection : access xcb_connection_t; event : eventPtr) is use ASCII; use Frames; type buttonEventPtr is access all xcb_button_press_event_t; buttonEvent : buttonEventPtr; cookie : xcb_void_cookie_t; ignore : Interfaces.C.int; geom : xcb_get_geometry_reply_t; f : Frame; function toButtonEvent is new Ada.Unchecked_Conversion (Source => events.eventPtr, Target => buttonEventPtr); -- function toCharsPtr is new Ada.Unchecked_Conversion (Source => events.eventPtr, Target => Interfaces.C.Strings.chars_ptr); begin buttonEvent := toButtonEvent (event); Ada.Text_IO.Put_Line ("Button press" & buttonEvent.detail'Image & " Modifier" & buttonEvent.state'Image & " on window" & buttonEvent.event'Image & " on child" & buttonEvent.child'Image); if isFrame (buttonEvent.event) then f := getFrameFromList(buttonEvent.event); -- COPY? -- Clicked on a frame. Register the start pos in case this turns into a drag. --@TODO see if this was on the resize area. dragInProgress := False; -- Drag not in progress yet. dragFrame := buttonEvent.event; dragStartX := buttonEvent.root_x; dragStartY := buttonEvent.root_y; -- Need to get geometry of window to determine its current pos geom := Util.getWindowGeometry (connection, buttonEvent.event); -- if returned geom is invalid, this might cause some weird results. -- @TODO find a good way to validate that. winStartX := geom.x; winStartY := geom.y; -- Focus this frame. Frames.focus (f.frameID); -- Ada.Text_IO.Put_Line ("Clicked on frame, focusing " & f.frameID'Image); elsif hasFrame (buttonEvent.event) then -- Clicked on app. Focus it. f := getFrameOfWindow (buttonEvent.event); Frames.focus (f.frameID); -- Ada.Text_IO.Put_Line ("Clicked on app, focusing " & f.frameID'Image); else -- Clicked on a non-framed window, unfocus all our frames Frames.unfocusAll; -- @TODO give input focus to unframed window? end if; ignore := xcb_flush (connection); end handleButtonPress; --------------------------------------------------------------------------- -- handleButtonRelease --------------------------------------------------------------------------- procedure handleButtonRelease (connection : access xcb_connection_t; event : eventPtr) is type buttonEventPtr is access xcb_button_release_event_t; buttonEvent : buttonEventPtr; ignore : int; function toButtonEvent is new Ada.Unchecked_Conversion(Source => eventPtr, Target => buttonEventPtr); begin buttonEvent := toButtonEvent(event); -- If we were dragging, stop. dragFrame := 0; dragInProgress := False; Frames.stopDrag; ignore := xcb_flush (connection); end handleButtonRelease; --------------------------------------------------------------------------- -- handleMotionNotify --------------------------------------------------------------------------- procedure handleMotionNotify (connection : access xcb_connection_t; event : eventPtr) is use Interfaces.C; type MotionEventPtr is access all xcb_motion_notify_event_t; motionEvent : MotionEventPtr; windowAttributes : aliased xcb_configure_window_value_list_t; cookie : xcb_void_cookie_t; deltaX : Interfaces.C.short; deltaY : Interfaces.C.short; newX : Interfaces.C.short; newY : Interfaces.C.short; dummy : Interfaces.C.int; -- screen : access xcb_screen_t := setup.getScreen(connection); function toMotionEvent is new Ada.Unchecked_Conversion(Source => eventPtr, Target => MotionEventPtr); begin motionEvent := toMotionEvent(event); -- Ada.Text_IO.Put_Line ("Root X: " & motionEvent.root_x'Image & " Root Y: " & motionEvent.root_y'Image); if dragFrame /= 0 then -- Only want to start the drag once. if not dragInProgress then dragInProgress := True; Frames.startDrag (dragFrame); end if; -- Update window location deltaX := dragStartX - winStartX; deltaY := dragStartY - winStartY; newX := motionEvent.root_x - deltaX; newY := motionEvent.root_y - deltaY; windowAttributes.x := Interfaces.C.int(newX); windowAttributes.y := Interfaces.C.int(newY); cookie := xcb_configure_window_aux (c => connection, window => dragFrame, value_mask => Unsigned_short(XCB_CONFIG_WINDOW_X or XCB_CONFIG_WINDOW_Y), value_list => windowAttributes'Access); end if; -- @TODO consider introducing some hysteresis so small mouse -- movements during a button click don't turn into drags. dummy := xcb_flush (connection); end handleMotionNotify; --------------------------------------------------------------------------- -- handleExpose --------------------------------------------------------------------------- procedure handleExpose (connection : access xcb_connection_t; event : eventPtr; rend : Render.Renderer) is use Frames; type ExposeEventPtr is access all xcb_expose_event_t; function toExposeEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => ExposeEventPtr); exposeEvent : ExposeEventPtr := toExposeEvent (event); begin Ada.Text_IO.Put_Line ("exposing window" & exposeEvent.window'Image); -- If we're exposing a window, expose the frame too (if it has one) and vice versa. -- We'll tell the compositor to blit the frame first then window contents after. if isFrame (exposeEvent.window) then -- exposing a frame getFrameFromList (exposeEvent.window).draw; elsif hasFrame (exposeEvent.window) then -- exposing a framed application window. getFrameOfWindow (exposeEvent.window).draw; else -- exposing a non-framed window, just let it expose. -- @TODO if we determine this is a DE menu or something like that -- then we'll want to draw it here too. null; end if; -- Ada.Text_IO.Put_Line("exit handleExpose"); end handleExpose; --------------------------------------------------------------------------- -- handleCreate --------------------------------------------------------------------------- procedure handleCreate (connection : access xcb_connection_t; event : eventPtr; rend : Render.Renderer) is use Frames; type CreateEventPtr is access all xcb_create_notify_event_t; function toCreateEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => CreateEventPtr); createEvent : CreateEventPtr := toCreateEvent (event); win : xcb_window_t := createEvent.window; begin Ada.Text_IO.Put_Line ("Window Create: " & createEvent.window'Image & " with parent " & createEvent.parent'Image); -- We might get this notification after a window has already been mapped/focused. -- We will only add non-framed windows to the render stack here. -- Add to the list, but ignore the overlay window since we get a -- create notification for that too. -- if win /= Compositor.overlayWindow then -- if not isFrame (win) and not hasFrame (win) then -- Compositor.addWindow (win); -- end if; -- end if; end handleCreate; --------------------------------------------------------------------------- -- handleDestroy --------------------------------------------------------------------------- procedure handleDestroy (connection : access xcb_connection_t; event : eventPtr) is use Frames; type DestroyEventPtr is access all xcb_destroy_notify_event_t; function toDestroyEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => DestroyEventPtr); destroyEvent : DestroyEventPtr := toDestroyEvent (event); begin Ada.Text_IO.Put_Line ("Window Destroy: " & destroyEvent.window'Image); if hasFrame (destroyEvent.window) then Frames.deleteFrame (getFrameOfWindow (destroyEvent.window)); elsif isFrame (destroyEvent.window) then Frames.deleteFrame (getFrameFromList (destroyEvent.window)); end if; -- Compositor.deleteWindow (destroyEvent.window); end handleDestroy; --------------------------------------------------------------------------- -- handleKeypress --------------------------------------------------------------------------- procedure handleKeypress (connection : access xcb_connection_t; event : Events.eventPtr) is type KeyEventPtr is access all xcb_key_press_event_t; function toKeyEvent is new Ada.Unchecked_Conversion (Source => eventPtr, Target => KeyEventPtr); keyEvent : KeyEventPtr := toKeyEvent (event); begin Ada.Text_IO.Put_Line ("Received key event: "); Ada.Text_IO.Put_Line (" Detail:" & keyEvent.detail'Image); Ada.Text_IO.Put_Line (" State:" & keyEvent.state'Image); -- ESC if keyEvent.detail = 9 then Events.close := True; end if; end handleKeypress; --------------------------------------------------------------------------- -- clearDamage --------------------------------------------------------------------------- procedure clearDamage (connection : access xcb_connection_t) is cookie : xcb_void_cookie_t; begin cookie := xcb_damage.xcb_damage_subtract (c => connection, damage => Setup.damage, repair => 0, parts => 0); end clearDamage; --------------------------------------------------------------------------- -- dispatchEvent -- @TODO need to report damage during draw requests or geometry changes. --------------------------------------------------------------------------- procedure dispatchEvent (connection : access xcb_connection_t; rend : Render.Renderer; event : Events.eventPtr) is use Compositor; use xcb_damage; XCB_EVENT_MASK : constant := 2#0111_1111#; begin case (event.response_type and XCB_EVENT_MASK) is when CONST_XCB_MAP_REQUEST => events.handleMapRequest (connection, event, rend); when CONST_XCB_CONFIGURE_REQUEST => events.handleConfigureRequest (connection, event); when CONST_XCB_BUTTON_PRESS => events.handleButtonPress (connection, event); when CONST_XCB_MOTION_NOTIFY => events.handleMotionNotify (connection, event); when CONST_XCB_BUTTON_RELEASE => events.handleButtonRelease (connection, event); when CONST_XCB_EXPOSE => events.handleExpose (connection, event, rend); when CONST_XCB_CREATE_NOTIFY => events.handleCreate (connection, event, rend); when CONST_XCB_DESTROY_NOTIFY => events.handleDestroy (connection, event); when CONST_XCB_KEY_PRESS => events.handleKeypress (connection, event); when others => null; -- if event.response_type = Setup.DAMAGE_EVENT then -- -- Ada.Text_IO.Put_Line ("Got damage"); -- -- clearDamage (connection); -- null; -- else -- -- Ada.Text_IO.Put_Line ("Troodon: (Events) got unknown event " & event.response_type'Image); -- end if; end case; end dispatchEvent; --------------------------------------------------------------------------- -- eventLoop --------------------------------------------------------------------------- procedure eventLoop (connection : access xcb_connection_t; rend : Render.Renderer; mode : Compositor.CompositeMode) is use Ada.Real_Time; use Compositor; FRAME_RATE : constant := 60; FRAME_RATE_US : constant Integer := 1_000_000 / 60; event : Events.eventPtr; ignore : int; nextPeriod : Ada.Real_Time.Time; startTime : Ada.Real_Time.Time; endTime : Ada.Real_Time.Time; render_us : Time_Span; procedure free is new Ada.Unchecked_Deallocation (Object => xcb_generic_event_t, Name => events.eventPtr); begin ignore := xcb_flush (connection); if mode = Compositor.MANUAL then loop startTime := Ada.Real_Time.Clock; nextPeriod := startTime + Ada.Real_Time.Microseconds (FRAME_RATE_US); event := Events.eventPtr (xcb_poll_for_event (connection)); -- If we're compositing ourselves, we need to refresh the -- screen even if no events are headed our way so we poll -- here to avoid blocking. if event /= null then dispatchEvent (connection, rend, event); ignore := xcb_flush (connection); free (event); else Compositor.renderScene (connection, rend); -- @TODO adjust delay to keep a smooth frame rate delay until nextPeriod; end if; endTime := Ada.Real_Time.Clock; render_us := endTime - startTime; exit when close = True; end loop; else loop -- In automatic compositing mode, we block event := Events.eventPtr (xcb_wait_for_event (connection)); exit when event = null; dispatchEvent (connection, rend, event); free (event); exit when close = True; end loop; end if; Ada.Text_IO.Put_Line ("Troodon: (Events) Received close command."); end eventLoop; end events;
lib/Explore/Summable.agda
crypto-agda/explore
2
13368
<reponame>crypto-agda/explore {-# OPTIONS --without-K #-} -- Specific constructions on top of summation functions module Explore.Summable where open import Type open import Function.NP import Relation.Binary.PropositionalEquality.NP as ≡ open ≡ using (_≡_ ; _≗_ ; _≗₂_) open import Explore.Core open import Explore.Properties open import Explore.Product open import Data.Product open import Data.Nat.NP open import Data.Nat.Properties open import Data.Two open Data.Two.Indexed module FromSum {a} {A : ★_ a} (sum : Sum A) where Card : ℕ Card = sum (const 1) count : Count A count f = sum (𝟚▹ℕ ∘ f) sum-lin⇒sum-zero : SumLin sum → SumZero sum sum-lin⇒sum-zero sum-lin = sum-lin (λ _ → 0) 0 sum-mono⇒sum-ext : SumMono sum → SumExt sum sum-mono⇒sum-ext sum-mono f≗g = ℕ≤.antisym (sum-mono (ℕ≤.reflexive ∘ f≗g)) (sum-mono (ℕ≤.reflexive ∘ ≡.sym ∘ f≗g)) sum-ext+sum-hom⇒sum-mono : SumExt sum → SumHom sum → SumMono sum sum-ext+sum-hom⇒sum-mono sum-ext sum-hom {f} {g} f≤°g = sum f ≤⟨ m≤m+n _ _ ⟩ sum f + sum (λ x → g x ∸ f x) ≡⟨ ≡.sym (sum-hom _ _) ⟩ sum (λ x → f x + (g x ∸ f x)) ≡⟨ sum-ext (m+n∸m≡n ∘ f≤°g) ⟩ sum g ∎ where open ≤-Reasoning module FromSumInd {a} {A : ★_ a} {sum : Sum A} (sum-ind : SumInd sum) where open FromSum sum public sum-ext : SumExt sum sum-ext = sum-ind (λ s → s _ ≡ s _) ≡.refl (≡.ap₂ _+_) sum-zero : SumZero sum sum-zero = sum-ind (λ s → s (const 0) ≡ 0) ≡.refl (≡.ap₂ _+_) (λ _ → ≡.refl) sum-hom : SumHom sum sum-hom f g = sum-ind (λ s → s (f +° g) ≡ s f + s g) ≡.refl (λ {s₀} {s₁} p₀ p₁ → ≡.trans (≡.ap₂ _+_ p₀ p₁) (+-interchange (s₀ _) (s₀ _) _ _)) (λ _ → ≡.refl) sum-mono : SumMono sum sum-mono = sum-ind (λ s → s _ ≤ s _) z≤n _+-mono_ sum-lin : SumLin sum sum-lin f zero = sum-zero sum-lin f (suc k) = ≡.trans (sum-hom f (λ x → k * f x)) (≡.ap₂ _+_ (≡.refl {x = sum f}) (sum-lin f k)) module _ (f g : A → ℕ) where open ≡.≡-Reasoning sum-⊓-∸ : sum f ≡ sum (f ⊓° g) + sum (f ∸° g) sum-⊓-∸ = sum f ≡⟨ sum-ext (f ⟨ a≡a⊓b+a∸b ⟩° g) ⟩ sum ((f ⊓° g) +° (f ∸° g)) ≡⟨ sum-hom (f ⊓° g) (f ∸° g) ⟩ sum (f ⊓° g) + sum (f ∸° g) ∎ sum-⊔-⊓ : sum f + sum g ≡ sum (f ⊔° g) + sum (f ⊓° g) sum-⊔-⊓ = sum f + sum g ≡⟨ ≡.sym (sum-hom f g) ⟩ sum (f +° g) ≡⟨ sum-ext (f ⟨ a+b≡a⊔b+a⊓b ⟩° g) ⟩ sum (f ⊔° g +° f ⊓° g) ≡⟨ sum-hom (f ⊔° g) (f ⊓° g) ⟩ sum (f ⊔° g) + sum (f ⊓° g) ∎ sum-⊔ : sum (f ⊔° g) ≤ sum f + sum g sum-⊔ = ℕ≤.trans (sum-mono (f ⟨ ⊔≤+ ⟩° g)) (ℕ≤.reflexive (sum-hom f g)) count-ext : CountExt count count-ext f≗g = sum-ext (≡.cong 𝟚▹ℕ ∘ f≗g) sum-const : ∀ k → sum (const k) ≡ Card * k sum-const k rewrite ℕ°.*-comm Card k | ≡.sym (sum-lin (const 1) k) | proj₂ ℕ°.*-identity k = ≡.refl module _ f g where count-∧-not : count f ≡ count (f ∧° g) + count (f ∧° not° g) count-∧-not rewrite sum-⊓-∸ (𝟚▹ℕ ∘ f) (𝟚▹ℕ ∘ g) | sum-ext (f ⟨ 𝟚▹ℕ-⊓ ⟩° g) | sum-ext (f ⟨ 𝟚▹ℕ-∸ ⟩° g) = ≡.refl count-∨-∧ : count f + count g ≡ count (f ∨° g) + count (f ∧° g) count-∨-∧ rewrite sum-⊔-⊓ (𝟚▹ℕ ∘ f) (𝟚▹ℕ ∘ g) | sum-ext (f ⟨ 𝟚▹ℕ-⊔ ⟩° g) | sum-ext (f ⟨ 𝟚▹ℕ-⊓ ⟩° g) = ≡.refl count-∨≤+ : count (f ∨° g) ≤ count f + count g count-∨≤+ = ℕ≤.trans (ℕ≤.reflexive (sum-ext (≡.sym ∘ (f ⟨ 𝟚▹ℕ-⊔ ⟩° g)))) (sum-⊔ (𝟚▹ℕ ∘ f) (𝟚▹ℕ ∘ g)) module FromSum× {a} {A : Set a} {b} {B : Set b} {sumᴬ : Sum A} (sum-indᴬ : SumInd sumᴬ) {sumᴮ : Sum B} (sum-indᴮ : SumInd sumᴮ) where module |A| = FromSumInd sum-indᴬ module |B| = FromSumInd sum-indᴮ open Operators sumᴬᴮ = sumᴬ ×ˢ sumᴮ sum-∘proj₁≡Card* : ∀ f → sumᴬᴮ (f ∘ proj₁) ≡ |B|.Card * sumᴬ f sum-∘proj₁≡Card* f rewrite |A|.sum-ext (|B|.sum-const ∘ f) = |A|.sum-lin f |B|.Card sum-∘proj₂≡Card* : ∀ f → sumᴬᴮ (f ∘ proj₂) ≡ |A|.Card * sumᴮ f sum-∘proj₂≡Card* = |A|.sum-const ∘ sumᴮ sum-∘proj₁ : ∀ {f} {g} → sumᴬ f ≡ sumᴬ g → sumᴬᴮ (f ∘ proj₁) ≡ sumᴬᴮ (g ∘ proj₁) sum-∘proj₁ {f} {g} sumf≡sumg rewrite sum-∘proj₁≡Card* f | sum-∘proj₁≡Card* g | sumf≡sumg = ≡.refl sum-∘proj₂ : ∀ {f} {g} → sumᴮ f ≡ sumᴮ g → sumᴬᴮ (f ∘ proj₂) ≡ sumᴬᴮ (g ∘ proj₂) sum-∘proj₂ sumf≡sumg = |A|.sum-ext (const sumf≡sumg) -- -} -- -} -- -} -- -}
src/ewok-ipc.ads
PThierry/ewok-kernel
65
25458
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- 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 ewok.tasks_shared; package ewok.ipc with spark_mode => on is -- -- IPC EndPoints -- MAX_IPC_MSG_SIZE : constant := 128; type t_endpoint_state is ( -- IPC endpoint is unused FREE, -- IPC endpoint is used and is ready for message passing READY, -- send() block until the receiver read the message WAIT_FOR_RECEIVER); type t_extended_task_id is (ID_UNUSED, ID_APP1, ID_APP2, ID_APP3, ID_APP4, ID_APP5, ID_APP6, ID_APP7, ANY_APP) with size => 8; for t_extended_task_id use (ID_UNUSED => 0, ID_APP1 => 1, ID_APP2 => 2, ID_APP3 => 3, ID_APP4 => 4, ID_APP5 => 5, ID_APP6 => 6, ID_APP7 => 7, ANY_APP => 255); function to_task_id (id : t_extended_task_id) return ewok.tasks_shared.t_task_id; function to_ext_task_id (id : ewok.tasks_shared.t_task_id) return t_extended_task_id; type t_endpoint is record from : t_extended_task_id; to : t_extended_task_id; state : t_endpoint_state; data : byte_array (1 .. MAX_IPC_MSG_SIZE); size : unsigned_8; end record; -- -- Global pool of IPC EndPoints -- ENDPOINTS_POOL_SIZE : constant := 10; ID_ENDPOINT_UNUSED : constant := 0; type t_extended_endpoint_id is range ID_ENDPOINT_UNUSED .. ENDPOINTS_POOL_SIZE; subtype t_endpoint_id is t_extended_endpoint_id range 1 .. ENDPOINTS_POOL_SIZE; ipc_endpoints : array (t_endpoint_id) of aliased t_endpoint; -- -- Functions -- -- Init IPC endpoints procedure init_endpoints; -- Get a free IPC endpoint procedure get_endpoint (endpoint : out t_extended_endpoint_id; success : out boolean); -- Release a used IPC endpoint procedure release_endpoint (ep_id : in t_endpoint_id); end ewok.ipc;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1848.asm
ljhsiun2/medusa
9
83334
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x125f1, %r11 nop cmp %rax, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm0 movups %xmm0, (%r11) nop nop add $56581, %rdx lea addresses_D_ht+0x18a3d, %rsi lea addresses_D_ht+0x1177d, %rdi nop nop nop nop nop add $44820, %rbx mov $115, %rcx rep movsq nop nop nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x1a889, %rcx nop nop nop nop nop cmp %rdx, %rdx mov $0x6162636465666768, %rdi movq %rdi, (%rcx) and %rax, %rax lea addresses_UC_ht+0x12353, %rsi nop nop inc %rax mov (%rsi), %r11 nop nop nop and $55301, %rbx lea addresses_D_ht+0x12d9d, %rax add %rdx, %rdx mov (%rax), %rbx nop nop nop nop inc %rdx lea addresses_normal_ht+0x1bda9, %rdx nop nop nop nop add $28650, %r11 mov $0x6162636465666768, %rdi movq %rdi, (%rdx) nop nop nop add $58765, %rdi lea addresses_UC_ht+0xd8fd, %rsi lea addresses_normal_ht+0x1c37d, %rdi nop nop nop nop inc %rbx mov $69, %rcx rep movsb nop nop nop nop nop cmp $60525, %rdx lea addresses_A_ht+0x177d, %rbx nop nop nop nop xor $52849, %r11 movl $0x61626364, (%rbx) nop nop nop nop dec %rdi lea addresses_D_ht+0x1d27d, %rbx nop nop nop nop add $16087, %r11 movups (%rbx), %xmm7 vpextrq $0, %xmm7, %rdi inc %rdx lea addresses_WC_ht+0x8f7d, %r11 nop nop add $17418, %rdi movups (%r11), %xmm1 vpextrq $1, %xmm1, %rbx nop nop cmp $37034, %rax lea addresses_WT_ht+0x1a2ed, %rax add %rbx, %rbx vmovups (%rax), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdx add %rax, %rax lea addresses_WC_ht+0xd6bd, %rsi lea addresses_normal_ht+0x1b77d, %rdi nop nop add $5805, %r14 mov $30, %rcx rep movsb nop sub $26729, %rdx lea addresses_A_ht+0x13ffd, %rsi lea addresses_A_ht+0x1b7d, %rdi nop nop nop nop xor $18860, %r14 mov $82, %rcx rep movsb nop nop nop nop xor %r11, %r11 lea addresses_A_ht+0x1224d, %rsi lea addresses_WT_ht+0x7bfd, %rdi and %r11, %r11 mov $113, %rcx rep movsw nop nop nop nop nop inc %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %rax push %rbx push %rsi // Faulty Load lea addresses_normal+0x77d, %r13 nop and $39040, %r14 mov (%r13), %r15 lea oracles, %r13 and $0xff, %r15 shlq $12, %r15 mov (%r13,%r15,1), %r15 pop %rsi pop %rbx pop %rax pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 2}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 2}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 3}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 2}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 4}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}} {'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 */
9LAB/bar5.asm
RustyRaptor/compilers
0
246371
<filename>9LAB/bar5.asm<gh_stars>0 # PACKAGE fibinaci .data # Data section starts here, strings first _L0: .asciiz "in fib" _L1: .asciiz "hello" _NL: .asciiz "\n" # NEWLINE STRING .align 2 # start all global variable aligned y: .word 7 # global var initialized Z: .space 4 # global var uninitialized A: .space 400 # global var uninitialized x: .word 1 # global var initialized .text # start of text segment (code) .globl main # Force MIPS to start at main label fib: # MAIN METHOD LABEL subu $t0 $sp 44 #set up $t0 to be the new spot for SP sw $ra ($t0) #Store the return address in offset 0 sw $sp 4($t0) #Store the old stack pointer in offset 4 move $sp $t0 #set the stack pointer to the new value la $a0, _L0 #expr constant is a string li $v0 4 #set up write call syscall #print a string li $v0, 4 #print NEWLINE la $a0, _NL #print NEWLINE string location syscall #call print a NEWLINE li $a0, 8 #offset for variable address add $a0, $a0, $sp #exact location for stack variable lw $a0 ($a0) #load from the memory address a value sw $a0, 16($sp) #store $a0 (LHS) temporarily so we can eval RHS li $a0, 0 #expr constant value move $a1, $a0 #move RHS to $a1 lw $a0, 16($sp) #get LHS from storage sle $a0, $a0, $a1 #less than or eq to beq $a0 $0 _L2 #Branch to first label if expression is 0 j _L3 #And the cow jumped over the else 🐄 _L2: #First Label for entering else _L3: #Second Label for jumping over the else li $a0, 8 #offset for variable address add $a0, $a0, $sp #exact location for stack variable lw $a0 ($a0) #load from the memory address a value sw $a0, 20($sp) #store $a0 (LHS) temporarily so we can eval RHS li $a0, 1 #expr constant value move $a1, $a0 #move RHS to $a1 lw $a0, 20($sp) #get LHS from storage seq $a0, $a0, $a1 #equal to beq $a0 $0 _L4 #Branch to first label if expression is 0 j _L5 #And the cow jumped over the else 🐄 _L4: #First Label for entering else _L5: #Second Label for jumping over the else li $v0 0 #return NULL zero (0) lw $ra ($sp) #reset return address lw $ra 4($sp) #reset stack pointer main: # MAIN METHOD LABEL subu $t0 $sp 32 #set up $t0 to be the new spot for SP sw $ra ($t0) #Store the return address in offset 0 sw $sp 4($t0) #Store the old stack pointer in offset 4 move $sp $t0 #set the stack pointer to the new value li $a0, 4 #expr constant value sw $a0, 12($sp) #Store the argument value in the stack li $a0, 4 #expr constant value lw $a0, 12($sp) #load the argument from the stack to a0, a1, a2, a3 respectively and as necessary sw $a0 16($sp) #store RHS of assign temporarily li $a0, 8 #offset for variable address add $a0, $a0, $sp #exact location for stack variable lw $a1, 16($sp) #load back RHS into $a1 sw $a1, ($a0) #Store assign value #EMIT PRINT INT HERE li $a0, 5 #expr constant value li $v0 1 #set up write call syscall #print a number li $v0, 4 #print NEWLINE la $a0, _NL #print NEWLINE string location syscall #call print a NEWLINE la $a0, _L1 #expr constant is a string li $v0 4 #set up write call syscall #print a string li $v0, 4 #print NEWLINE la $a0, _NL #print NEWLINE string location syscall #call print a NEWLINE #EMIT PRINT INT HERE li $a0, 28 #offset for variable address add $a0, $a0, $sp #exact location for stack variable lw $a0 ($a0) #load from the memory address a value li $v0 1 #set up write call syscall #print a number li $v0, 4 #print NEWLINE la $a0, _NL #print NEWLINE string location syscall #call print a NEWLINE li $v0 0 #return NULL zero (0) lw $ra ($sp) #reset return address lw $ra 4($sp) #reset stack pointer li $v0, 10 #Main function ends syscall #MAIN FUNCTION EXIT
sim/asm/fn31.asm
nanamake/avr_cpu
2
90247
<gh_stars>1-10 ;------------------- ; test for bset/bclr ;------------------- .equ sreg = 0x3f ;------------------- in r7 ,sreg ;------------------- sec in r8 ,sreg sez in r9 ,sreg sen in r10,sreg sev in r11,sreg ses in r12,sreg seh in r13,sreg set in r14,sreg sei in r15,sreg ;------------------- clc in r16,sreg clz in r17,sreg cln in r18,sreg clv in r19,sreg cls in r20,sreg clh in r21,sreg clt in r22,sreg cli in r23,sreg ;------------------- .def zl = r30 .def zh = r31 ldi zh,0x01 ldi zl,0x0f st z+,r7 ; (in) sreg st z+,r8 ; (sec) st z+,r9 ; (sez) st z+,r10 ; (sen) st z+,r11 ; (sev) st z+,r12 ; (ses) st z+,r13 ; (seh) st z+,r14 ; (set) st z+,r15 ; (sei) st z+,r16 ; (clc) st z+,r17 ; (clz) st z+,r18 ; (cln) st z+,r19 ; (clv) st z+,r20 ; (cls) st z+,r21 ; (clh) st z+,r22 ; (clt) st z+,r23 ; (cli) ;------------------- ldi r16,0xff sts 0xffff,r16 halt: rjmp halt
Library/Text/TextGraphic/tgGraphic.asm
steakknife/pcgeos
504
241319
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Text/TextGraphic FILE: tgGraphic.asm METHODS: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/89 Initial version DESCRIPTION: ... $Id: tgGraphic.asm,v 1.1 97/04/07 11:19:35 newdeal Exp $ ------------------------------------------------------------------------------@ TextGraphic segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: TG_GraphicRunSize DESCRIPTION: Return the bounds of a graphic element CALLED BY: EXTERNAL PASS: *ds:si - text object dx.ax - position in text RETURN: cx - width (0 means 0 width graphic) dx - height (0 to use current text height) DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ TG_GraphicRunSize proc far uses di, bp class VisTextClass .enter mov di, 1000 call ThreadBorrowStackSpace push di sub sp, size VisTextGraphic mov bp, sp call TA_GetGraphicForPosition ;ss:bp = graphic ; get values to return mov cx, ss:[bp].VTG_size.XYS_width mov dx, ss:[bp].VTG_size.XYS_height ; null size ? tst cx jnz done tst dx jnz done EC < cmp ss:[bp].VTG_type, VTGT_VARIABLE > EC < ERROR_NZ VIS_TEXT_GRAPHIC_CANNOT_HAVE_SIZE_0 > push ax, di, bp mov di, ds:[si] add di, ds:[di].Vis_offset mov cx, ds:[di].VTI_gstate mov dx, ss mov ax, MSG_VIS_TEXT_GRAPHIC_VARIABLE_SIZE call ObjCallInstanceNoLock ;ax = non-zero if handled pop ax, di, bp done: add sp, size VisTextGraphic pop di call ThreadReturnStackSpace .leave ret TG_GraphicRunSize endp COMMENT @---------------------------------------------------------------------- MESSAGE: VisTextGraphicVariableSize -- MSG_VIS_TEXT_GRAPHIC_VARIABLE_SIZE for VisTextClass DESCRIPTION: Default handler for finding the size of a variable graphic PASS: *ds:si - instance data es - segment of VisTextClass ax - The message cx - gstate dx:bp - VisTextGraphic (dx always = ss) RETURN: cx - width dx - height DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/30/92 Initial version ------------------------------------------------------------------------------@ VisTextGraphicVariableSize proc far ;MSG_VIS_TEXT_GRAPHIC_VARIABLE_SIZE ; send a message up to the document to try to get a string sub sp, GEN_DOCUMENT_GET_VARIABLE_BUFFER_SIZE mov di, sp ;ss:di = buffer call GetVariableString segmov ds, ss mov si, di ;ds:si = string mov di, cx ;di = gstate clr cx ;null terminated call GrTextWidth mov cx, dx ;cx = width clr dx ;height = 0 add sp, GEN_DOCUMENT_GET_VARIABLE_BUFFER_SIZE ret VisTextGraphicVariableSize endp COMMENT @---------------------------------------------------------------------- FUNCTION: GetVariableString DESCRIPTION: Get the string for a variable CALLED BY: INTERNAL PASS: *ds:si - text object cx - gstate dx:bp - VisTextGraphic (dx always = ss) ss:di - buffer RETURN: buffer filled DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/30/92 Initial version ------------------------------------------------------------------------------@ GetVariableString proc near uses ax, bx, cx, dx, di, bp .enter ; initialize string to default mov {word} ss:[di], '#' ;'#' followed by 0 DBCS < mov {wchar}ss:[di][2], 0 > ; push GenDocumentGetVariableParams on the stack push ds:[LMBH_handle], si ;GDGVP_object pushdw dxbp ;GDGVP_graphic pushdw ssdi ;GDGVP_buffer ; get the position of the graphic by taking: ; (current transform - default transform) + WinBounds (if any) call CalculatePositionInSpace ;cxbx = x, dxax = y pushdw dxax ;GDGVP_position.PD_y pushdw cxbx ;GDGVP_position.PD_x mov bp, sp mov dx, size GenDocumentGetVariableParams mov ax, MSG_GEN_DOCUMENT_GET_VARIABLE mov di, mask MF_RECORD or mask MF_STACK push si mov bx, segment GenDocumentClass mov si, offset GenDocumentClass call ObjMessage ;di = message pop si add sp, size GenDocumentGetVariableParams mov cx, di mov ax, MSG_VIS_VUP_CALL_OBJECT_OF_CLASS call ObjCallInstanceNoLock .leave ret GetVariableString endp COMMENT @---------------------------------------------------------------------- FUNCTION: CalculatePositionInSpace DESCRIPTION: Calculate the current "document" position for the given gstate CALLED BY: INTERNAL PASS: cx - gstate RETURN: cxbx - x pos dxax - y pos DESTROYED: di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/ 1/92 Initial version ------------------------------------------------------------------------------@ CalculatePositionInSpace proc near uses si, ds currentTransform local TransMatrix .enter mov di, cx ;di = state segmov ds, ss lea si, currentTransform call GrGetTransform call GrGetWinHandle ;ax = window tst ax movdw cxbx, currentTransform.TM_e31.DWF_int movdw dxax, currentTransform.TM_e32.DWF_int jnz done ; no window -- subtract the default transform call GrSaveTransform call GrSetDefaultTransform call GrGetTransform call GrRestoreTransform subdw cxbx, currentTransform.TM_e31.DWF_int subdw dxax, currentTransform.TM_e32.DWF_int done: .leave ret CalculatePositionInSpace endp COMMENT @---------------------------------------------------------------------- FUNCTION: TG_GraphicRunDraw DESCRIPTION: Draw a graphic element CALLED BY: EXTERNAL PASS: *ds:si - text object bx - baseline position cx - line height (THIS IS NOT PASSED -- brianc 2/29/00) dx.ax - position in text di - gstate RETURN: cx - width of graphic drawn dx - height of graphic drawn DESTROYED: none Graphic element draw routines: PASS: *ds:si - text object ss:bp - VisTextGraphic di - gstate RETURN: none (state of the gstate can be trashed) DESTROY: ax, bx, cx, dx, si, di, bp, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ TG_GraphicRunDraw proc far uses ax, bx, si, di, bp, ds, es .enter mov bp, di mov di, 1000 call ThreadBorrowStackSpace push di mov di, bp push di call GrSaveState ; Copy the text color to the line and area color to prevent the ; "inviso-graphic" bug on black and white systems and also so that ; graphics that do not specify a color are drawn in an appropriate ; color push ax, bx ; save position in the text. call GrGetTextColor mov ah, CF_RGB call GrSetLineColor call GrSetAreaColor mov al, SDM_100 call GrSetAreaMask pop ax, bx sub sp, size VisTextGraphic mov bp, sp call TA_GetGraphicForPosition ;fill in ss:bp clr al ; al <- bits to set, ah <- bits to clear mov ah, mask TM_DRAW_BASE or \ mask TM_DRAW_BOTTOM or \ mask TM_DRAW_ACCENT or \ mask TM_DRAW_OPTIONAL_HYPHENS test ss:[bp].VTG_flags, mask VTGF_DRAW_FROM_BASELINE jz gotFlags mov al, mask TM_DRAW_BASE ; al <- bits to set, ah <- bits to clear mov ah, mask TM_DRAW_BOTTOM or \ mask TM_DRAW_ACCENT or \ mask TM_DRAW_OPTIONAL_HYPHENS gotFlags: call GrSetTextMode ; Clear all the TextMode bits ; We are passed the top of the line as the position to draw. ; We want to move to draw with the bottom above the baseline. ; To do this we need to move the pen position down by: ; baseline - graphicHeight ; bx already holds the baseline. ; Note:RelMoveTo now takes WWFixed values, hence the change push cx, dx sub bx, ss:[bp].VTG_size.XYS_height clr ax clr cx, dx call GrRelMoveTo pop cx, dx ; draw the sucker push ss:[bp].VTG_size.XYS_width, ss:[bp].VTG_size.XYS_height clr bx mov bl, ss:[bp].VTG_type shl bx push bp mov ax, MSG_VIS_TEXT_GET_FEATURES call ObjCallInstanceNoLock pop bp test cx, mask VTF_DONT_SHOW_GRAPHICS jz drawGraphic ; Draw a rectangle in place of the graphic. mov ax, C_LIGHT_GRAY call GrSetAreaColor mov ax, C_DARK_GRAY call GrSetLineColor pop cx, dx ; cx, dx <- width/height. tst cx jnz haveSize ; ; get size (just send msg instead of calling TG_GraphicRunSize ; since parameters are a bit easier to set up) ; mov cx, di ; cx = gstate mov dx, ss ; dx:bp = VisTextGraphic mov ax, MSG_VIS_TEXT_GRAPHIC_VARIABLE_SIZE call ObjCallInstanceNoLock ; cx, dx = size haveSize: push cx, dx call GrGetCurPos add cx, ax add dx, bx dec cx dec dx call GrFillRect ; Fill me a rectangle. call GrDrawRect ; Fill me a rectangle. jmp done drawGraphic: call cs:[bx][GraphElementDrawRoutines] done: pop ax, bx ; ax, bx <- width, height. tst ax jz useReturnValues mov_tr cx, ax mov dx, bx useReturnValues: add sp, size VisTextGraphic pop di call GrRestoreState pop di call ThreadReturnStackSpace .leave ret TG_GraphicRunDraw endp GraphElementDrawRoutines label word word offset DrawGraphicGString word offset DrawGraphicVariable COMMENT @---------------------------------------------------------------------- FUNCTION: DrawGraphicGString DESCRIPTION: Draw a graphic element CALLED BY: INTERNAL GraphicRunDraw PASS: *ds:si - text object ss:bp - VisTextGraphic di - gstate RETURN: none (state of the gstate can be trashed) DESTROY: ax, bx, cx, dx, si, di, bp, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ DrawGraphicGString proc near ; transform me push si, ds segmov ds, ss lea si, ss:[bp].VTG_data.VTGD_gstring.VTGG_tmatrix call GrApplyTransform pop si, ds ; ; The left/top are not zero. We negate them and call GrApplyTranslation ; in order to get to the right place for the draw. ; mov dx, ss:[bp].VTG_data.VTGD_gstring.VTGG_drawOffset.XYO_x clr cx ; dx.cx <- X trans (WWFixed) mov bx, ss:[bp].VTG_data.VTGD_gstring.VTGG_drawOffset.XYO_y clr ax ; bx.ax <- Y trans (WWFixed) call GrRelMoveTo call T_GetVMFile ; bx = VM file mov ax, ss:[bp].VTG_vmChain.high tst ax jz isLMem mov cx, ss:[bp].VTG_vmChain.low tst cx jnz isDB mov_tr si, ax ;SI <- VMem chain handle ; its in a vm chain -- draw it mov cx, GST_VMEM loadAndDraw: call GrLoadGString ;si = gstring ; ; di = GState ; si = GString ; ; Draw the string, we're in the right place. ; clr dx call GrDrawGStringAtCP mov dl, GSKT_LEAVE_DATA ; leave data alone call GrDestroyGString ret isDB: ; gstring is in a DB item -- draw it push di mov di, cx call DBLock ;*es:di = data segmov ds, es mov si, ds:[di] pop di clr dx push si, bx mov cl, GST_PTR ; pointer type GString mov bx, ds ; bx:si -> GString call GrLoadGString call GrDrawGStringAtCP mov dl, GSKT_LEAVE_DATA call GrDestroyGString pop si, bx call DBUnlock done: ret isLMem: ; gstring is in a chunk -- draw it mov si, ss:[bp].VTG_vmChain.low tst si jz done mov si, ds:[si] clr dx mov cl, GST_PTR ; pointer type GString mov bx, ds ; bx:si -> GString jmp loadAndDraw DrawGraphicGString endp COMMENT @---------------------------------------------------------------------- FUNCTION: DrawGraphicVariable DESCRIPTION: Draw a graphic element by sending a method to ourself CALLED BY: INTERNAL GraphicRunDraw PASS: *ds:si - text object ss:bp - VisTextGraphic di - gstate RETURN: cx - width of graphic drawn dx - height of graphic drawn state of the gstate can be trashed DESTROY: ax, bx, si, di, bp, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ DrawGraphicVariable proc near mov ax, MSG_VIS_TEXT_GRAPHIC_VARIABLE_DRAW mov cx, di ;pass gstate in dx mov dx, ss call ObjCallInstanceNoLock ret DrawGraphicVariable endp COMMENT @---------------------------------------------------------------------- MESSAGE: VisTextGraphicVariableDraw -- MSG_VIS_TEXT_GRAPHIC_VARIABLE_DRAW for VisTextClass DESCRIPTION: Default handler for drawing a variable graphic PASS: *ds:si - instance data es - segment of VisTextClass ax - The message cx - gstate with font and current position set dx:bp - VisTextGraphic (dx always = ss) RETURN: cx - width of the graphic dx - height of the graphic DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/30/92 Initial version ------------------------------------------------------------------------------@ VisTextGraphicVariableDraw proc far ;MSG_VIS_TEXT_GRAPHIC_VARIABLE_DRAW ; send a message up to the document to try to get a string sub sp, GEN_DOCUMENT_GET_VARIABLE_BUFFER_SIZE mov di, sp ;ss:di = buffer call GetVariableString segmov ds, ss mov si, di ;ds:si = string mov di, cx ;di = gstate clr cx ;null terminated call GrDrawTextAtCP call GrTextWidth mov cx, dx ;cx = width clr dx ;height = 0 add sp, GEN_DOCUMENT_GET_VARIABLE_BUFFER_SIZE ret VisTextGraphicVariableDraw endp COMMENT @---------------------------------------------------------------------- FUNCTION: TG_GraphicRunDelete DESCRIPTION: Delete a graphic element CALLED BY: INTERNAL RemoveElementLow PASS: *ds:si - graphic element array ds:di - VisTextGraphic ax - VM file RETURN: none DESTROYED: ax, bx, cx, dx REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ TG_GraphicRunDelete proc far uses si, di, bp .enter mov_tr bx, ax ;bx = VM file movdw axbp, ds:[di].VTG_vmChain tst ax jz done call VMFreeVMChain done: .leave ret TG_GraphicRunDelete endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VisTextGetGraphicAtPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the graphic at the current position. CALLED BY: GLOBAL PASS: ss:bp - VisTextGetGraphicAtPositionParams RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 3/24/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VisTextGetGraphicAtPosition proc far ;method VisTextClass MSG_VIS_TEXT_GET_GRAPHIC_AT_POSITION .enter if ERROR_CHECK ; ; Validate that ret ptr is not in a movable code segment ; FXIP< push bx, si > FXIP< movdw bxsi, ss:[bp].VTGGAPP_retPtr > FXIP< call ECAssertValidFarPointerXIP > FXIP< pop bx, si > endif movdw dxax, ss:[bp].VTGGAPP_position les di, ss:[bp].VTGGAPP_retPtr sub sp, size VisTextGraphic mov bp, sp ;SS:BP <- buffer for VisTextGraphic call TA_GetGraphicForPosition ; Copy the VisTextGraphic structure out. segmov ds, ss ;DS:SI <- size VisTextGraphic mov si, bp mov cx, (size VisTextGraphic) / 2 rep movsw add sp, size VisTextGraphic .leave ret VisTextGetGraphicAtPosition endp COMMENT @---------------------------------------------------------------------- FUNCTION: TG_IfVariableGraphicsThenRecalc DESCRIPTION: If the object contains a varibale graphic then recalculate it CALLED BY: INTERNAL PASS: *ds:si - text object RETURN: cx - chunk handle to pass to TG_RecalcAfterPrint DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/13/92 Initial version ------------------------------------------------------------------------------@ TG_IfVariableGraphicsThenRecalc proc far uses ax, bx, dx, di, es class VisTextClass .enter EC < call T_AssertIsVisText > clr cx call TA_CheckForVariableGraphics jnc done ; variable graphic exists -- save line structures mov di, ds:[si] add di, ds:[di].Vis_offset mov bx, ds:[di].VTI_lines ;bx = line array push bx ;save line array ; save flags mov ax, si call ObjGetFlags push ax ;save the flags push bx mov ax, si mov bx, mask OCF_IGNORE_DIRTY call ObjSetFlags pop bx push si ;save object push bx ;save line array ChunkSizeHandle ds, bx, cx ;cx = size mov al, mask OCF_IGNORE_DIRTY call LMemAlloc ;ax = new line arrray mov di, ds:[si] add di, ds:[di].Vis_offset mov ds:[di].VTI_lines, ax mov_tr di, ax mov di, ds:[di] segmov es, ds ;es:di = dest pop si mov si, ds:[si] ;ds:si = source rep movsb pop si ;*ds:si = object call TextCompleteRecalc mov ax, si pop bx ;bx = old flags mov bh, bl clr bl and bh, mask OCF_IGNORE_DIRTY call ObjSetFlags pop cx done: .leave ret TG_IfVariableGraphicsThenRecalc endp COMMENT @---------------------------------------------------------------------- FUNCTION: TG_RecalcAfterPrint DESCRIPTION: Recalculate after printing with variable graphics CALLED BY: INTERNAL PASS: *ds:si - text object cx - chunk returned by TG_IfVariableGraphicsThenRecalc RETURN: none DESTROYED: cx REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/13/92 Initial version ------------------------------------------------------------------------------@ TG_RecalcAfterPrint proc far uses ax, cx, di class VisTextClass .enter EC < call T_AssertIsVisText > mov_tr ax, cx mov di, ds:[si] add di, ds:[di].Vis_offset xchg ax, ds:[di].VTI_lines call LMemFree .leave ret TG_RecalcAfterPrint endp TextGraphic ends
src/sdl-video-textures-makers.adb
treggit/sdlada
89
23724
<reponame>treggit/sdlada<gh_stars>10-100 -------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Ada.Unchecked_Conversion; with Interfaces.C; private with SDL.C_Pointers; with SDL.Error; package body SDL.Video.Textures.Makers is package C renames Interfaces.C; use type SDL.C_Pointers.Texture_Pointer; function Get_Internal_Surface (Self : in SDL.Video.Surfaces.Surface) return SDL.Video.Surfaces.Internal_Surface_Pointer with Import => True, Convention => Ada; function Get_Internal_Renderer (Self : in SDL.Video.Renderers.Renderer) return SDL.C_Pointers.Renderer_Pointer with Import => True, Convention => Ada; procedure Create (Tex : in out Texture; Renderer : in SDL.Video.Renderers.Renderer; Format : in SDL.Video.Pixel_Formats.Pixel_Format_Names; Kind : in Kinds; Size : in SDL.Positive_Sizes) is -- Convert the Pixel_Format_Name to an Unsigned_32 because the compiler is changing the value somewhere along -- the lines from the start of this procedure to calling SDL_Create_Texture. function To_Unsigned32 is new Ada.Unchecked_Conversion (Source => SDL.Video.Pixel_Formats.Pixel_Format_Names, Target => Interfaces.Unsigned_32); function SDL_Create_Texture (R : in SDL.C_Pointers.Renderer_Pointer; Format : in Interfaces.Unsigned_32; Kind : in Kinds; W, H : in C.int) return SDL.C_Pointers.Texture_Pointer with Import => True, Convention => C, External_Name => "SDL_CreateTexture"; begin Tex.Internal := SDL_Create_Texture (Get_Internal_Renderer (Renderer), To_Unsigned32 (Format), Kind, Size.Width, Size.Height); if Tex.Internal = null then raise Texture_Error with SDL.Error.Get; end if; Tex.Size := Size; Tex.Pixel_Format := Format; end Create; procedure Create (Tex : in out Texture; Renderer : in SDL.Video.Renderers.Renderer; Surface : in SDL.Video.Surfaces.Surface) is function SDL_Create_Texture_From_Surface (R : in SDL.C_Pointers.Renderer_Pointer; S : in SDL.Video.Surfaces.Internal_Surface_Pointer) return SDL.C_Pointers.Texture_Pointer with Import => True, Convention => C, External_Name => "SDL_CreateTextureFromSurface"; begin Tex.Internal := SDL_Create_Texture_From_Surface (Get_Internal_Renderer (Renderer), Get_Internal_Surface (Surface)); if Tex.Internal = null then raise Texture_Error with SDL.Error.Get; end if; end Create; end SDL.Video.Textures.Makers;
resources/Expression.g4
jojo1981/php-types
1
3685
grammar Expression; expression : multiType | type ; type : arrayType | listType | basicType | classType ; arrayType : indexedArrayType | typedArrayType | tupleArrayType | basicArrayType ; indexedArrayType : TYPE_ARRAY ANGLE_BRACKET_OPEN arrayValueType ANGLE_BRACKET_CLOSE ; typedArrayType : TYPE_ARRAY ANGLE_BRACKET_OPEN arrayKeyType COMMA arrayValueType ANGLE_BRACKET_CLOSE ; basicArrayType : TYPE_ARRAY ; tupleArrayType : TYPE_ARRAY CURLY_BRACKET_OPEN tupleArrayTypeElements CURLY_BRACKET_CLOSE ; tupleArrayTypeElements : expression COMMA expression (COMMA expression)* ; arrayKeyType : expression ; arrayValueType : expression ; listType : (basicType | classType | basicArrayType) SQUARE_BRACKET_OPEN SQUARE_BRACKET_CLOSE ; multiType : type PIPE type (PIPE type)* ; classType : '\\'? IDENTIFIER ('\\' IDENTIFIER)* ; basicType : integerType | stringType | booleanType | floatType | resourceType | mixedType | voidType | callableType | objectType | iterableType | nullType ; integerType : TYPE_INTEGER | TYPE_INT ; stringType : TYPE_STRING | TYPE_TEXT ; booleanType : TYPE_BOOLEAN | TYPE_BOOL ; floatType : TYPE_FLOAT | TYPE_NUMBER | TYPE_REAL | TYPE_DOUBLE ; resourceType : TYPE_RESOURCE ; mixedType : TYPE_MIXED ; voidType : TYPE_VOID ; callableType : TYPE_CALLABLE | TYPE_CALLBACK ; objectType : TYPE_OBJECT ; iterableType : TYPE_ITERABLE ; nullType : TYPE_NULL ; TYPE_ARRAY: A R R A Y; TYPE_INTEGER: I N T E G E R; TYPE_INT: I N T; TYPE_STRING: S T R I N G; TYPE_TEXT: T E X T ; TYPE_BOOLEAN: B O O L E A N; TYPE_BOOL: B O O L; TYPE_NUMBER: N U M B E R; TYPE_REAL: R E A L; TYPE_DOUBLE: D O U B L E; TYPE_FLOAT: F L O A T; TYPE_RESOURCE: R E S O U R C E; TYPE_MIXED: M I X E D; TYPE_VOID: V O I D; TYPE_CALLABLE: C A L L A B L E; TYPE_CALLBACK: C A L L B A C K; TYPE_OBJECT: O B J E C T; TYPE_ITERABLE: I T E R A B L E; TYPE_NULL: N U L L; PIPE: '|'; COMMA: ','; CURLY_BRACKET_OPEN: '{'; CURLY_BRACKET_CLOSE: '}'; SQUARE_BRACKET_OPEN: '['; SQUARE_BRACKET_CLOSE: ']'; ANGLE_BRACKET_OPEN: '<'; ANGLE_BRACKET_CLOSE: '>'; IDENTIFIER: [a-zA-Z_\u0080-\ufffe][a-zA-Z0-9_\u0080-\ufffe]*; fragment A : [aA]; // match either an 'a' or 'A' fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ]; WS: [ \t\n\r] + -> skip;
TotalRecognisers/LeftRecursion/ExpressiveStrength.agda
nad/parser-combinators
1
10775
------------------------------------------------------------------------ -- This module establishes that the recognisers are as expressive as -- possible when the alphabet is Bool (this could be generalised to -- arbitrary finite alphabets), whereas this is not the case when the -- alphabet is ℕ ------------------------------------------------------------------------ module TotalRecognisers.LeftRecursion.ExpressiveStrength where open import Algebra open import Codata.Musical.Notation open import Data.Bool as Bool hiding (_∧_) open import Data.Empty open import Function.Base open import Function.Equality using (_⟨$⟩_) open import Function.Equivalence using (_⇔_; equivalence; module Equivalence) open import Data.List import Data.List.Properties as ListProp open import Data.List.Reverse open import Data.Nat as Nat open import Data.Nat.InfinitelyOften as Inf import Data.Nat.Properties as NatProp open import Data.Product open import Data.Sum open import Relation.Binary open import Relation.Binary.PropositionalEquality hiding ([_]) open import Relation.Nullary open import Relation.Nullary.Decidable open import Relation.Nullary.Negation private module ListMonoid {A : Set} = Monoid (ListProp.++-monoid A) module NatOrder = DecTotalOrder NatProp.≤-decTotalOrder import TotalRecognisers.LeftRecursion open TotalRecognisers.LeftRecursion Bool using (_∧_; left-zero) private open module LR {Tok : Set} = TotalRecognisers.LeftRecursion Tok hiding (P; ∞⟨_⟩P; _∧_; left-zero; _∷_) P : Set → Bool → Set P Tok = LR.P {Tok} ∞⟨_⟩P : Bool → Set → Bool → Set ∞⟨ b ⟩P Tok n = LR.∞⟨_⟩P {Tok} b n open import TotalRecognisers.LeftRecursion.Lib Bool hiding (_∷_) ------------------------------------------------------------------------ -- A boring lemma private lemma : (f : List Bool → Bool) → (false ∧ f [ true ] ∨ false ∧ f [ false ]) ∨ f [] ≡ f [] lemma f = cong₂ (λ b₁ b₂ → (b₁ ∨ b₂) ∨ f []) (left-zero (f [ true ])) (left-zero (f [ false ])) ------------------------------------------------------------------------ -- Expressive strength -- For every grammar there is an equivalent decidable predicate. grammar⇒pred : ∀ {Tok n} (p : P Tok n) → ∃ λ (f : List Tok → Bool) → ∀ {s} → s ∈ p ⇔ T (f s) grammar⇒pred p = ((λ s → ⌊ s ∈? p ⌋) , λ {_} → equivalence fromWitness toWitness) -- When the alphabet is Bool the other direction holds: for every -- decidable predicate there is a corresponding grammar. -- -- Note that the grammars constructed by the proof are all "infinite -- LL(1)". pred⇒grammar : (f : List Bool → Bool) → ∃ λ (p : P Bool (f [])) → ∀ {s} → s ∈ p ⇔ T (f s) pred⇒grammar f = (p f , λ {s} → equivalence (p-sound f) (p-complete f s)) where p : (f : List Bool → Bool) → P Bool (f []) p f = cast (lemma f) ( ♯? (sat id ) · ♯ p (f ∘ _∷_ true ) ∣ ♯? (sat not) · ♯ p (f ∘ _∷_ false) ∣ accept-if-true (f []) ) p-sound : ∀ f {s} → s ∈ p f → T (f s) p-sound f (cast (∣-right s∈)) with AcceptIfTrue.sound (f []) s∈ ... | (refl , ok) = ok p-sound f (cast (∣-left (∣-left (t∈ · s∈)))) with drop-♭♯ (f [ true ]) t∈ ... | sat {t = true} _ = p-sound (f ∘ _∷_ true ) s∈ ... | sat {t = false} () p-sound f (cast (∣-left (∣-right (t∈ · s∈)))) with drop-♭♯ (f [ false ]) t∈ ... | sat {t = false} _ = p-sound (f ∘ _∷_ false) s∈ ... | sat {t = true} () p-complete : ∀ f s → T (f s) → s ∈ p f p-complete f [] ok = cast (∣-right {n₁ = false ∧ f [ true ] ∨ false ∧ f [ false ]} $ AcceptIfTrue.complete ok) p-complete f (true ∷ bs) ok = cast (∣-left $ ∣-left $ add-♭♯ (f [ true ]) (sat _) · p-complete (f ∘ _∷_ true ) bs ok) p-complete f (false ∷ bs) ok = cast (∣-left $ ∣-right {n₁ = false ∧ f [ true ]} $ add-♭♯ (f [ false ]) (sat _) · p-complete (f ∘ _∷_ false) bs ok) -- An alternative proof which uses a left recursive definition of the -- grammar to avoid the use of a cast. pred⇒grammar′ : (f : List Bool → Bool) → ∃ λ (p : P Bool (f [])) → ∀ {s} → s ∈ p ⇔ T (f s) pred⇒grammar′ f = (p f , λ {s} → equivalence (p-sound f) (p-complete f s)) where extend : {A B : Set} → (List A → B) → A → (List A → B) extend f x = λ xs → f (xs ∷ʳ x) p : (f : List Bool → Bool) → P Bool (f []) p f = ♯ p (extend f true ) · ♯? (sat id ) ∣ ♯ p (extend f false) · ♯? (sat not) ∣ accept-if-true (f []) p-sound : ∀ f {s} → s ∈ p f → T (f s) p-sound f (∣-right s∈) with AcceptIfTrue.sound (f []) s∈ ... | (refl , ok) = ok p-sound f (∣-left (∣-left (s∈ · t∈))) with drop-♭♯ (f [ true ]) t∈ ... | sat {t = true} _ = p-sound (extend f true ) s∈ ... | sat {t = false} () p-sound f (∣-left (∣-right (s∈ · t∈))) with drop-♭♯ (f [ false ]) t∈ ... | sat {t = false} _ = p-sound (extend f false) s∈ ... | sat {t = true} () p-complete′ : ∀ f {s} → Reverse s → T (f s) → s ∈ p f p-complete′ f [] ok = ∣-right {n₁ = false} $ AcceptIfTrue.complete ok p-complete′ f (bs ∶ rs ∶ʳ true ) ok = ∣-left {n₁ = false} $ ∣-left {n₁ = false} $ p-complete′ (extend f true ) rs ok · add-♭♯ (f [ true ]) (sat _) p-complete′ f (bs ∶ rs ∶ʳ false) ok = ∣-left {n₁ = false} $ ∣-right {n₁ = false} $ p-complete′ (extend f false) rs ok · add-♭♯ (f [ false ]) (sat _) p-complete : ∀ f s → T (f s) → s ∈ p f p-complete f s = p-complete′ f (reverseView s) -- If infinite alphabets are allowed the result is different: there -- are decidable predicates which cannot be realised as grammars. The -- proof below shows that a recogniser for natural number strings -- cannot accept exactly the strings of the form "nn". module NotExpressible where -- A "pair" is a string containing two equal elements. pair : ℕ → List ℕ pair n = n ∷ n ∷ [] -- OnlyPairs p is inhabited iff p only accepts pairs and empty -- strings. (Empty strings are allowed due to the presence of the -- nonempty combinator.) OnlyPairs : ∀ {n} → P ℕ n → Set OnlyPairs p = ∀ {n s} → n ∷ s ∈ p → s ≡ [ n ] -- ManyPairs p is inhabited iff p accepts infinitely many pairs. ManyPairs : ∀ {n} → P ℕ n → Set ManyPairs p = Inf (λ n → pair n ∈ p) -- AcceptsNonEmptyString p is inhabited iff p accepts a non-empty -- string. AcceptsNonEmptyString : ∀ {Tok n} → P Tok n → Set AcceptsNonEmptyString p = ∃₂ λ t s → t ∷ s ∈ p -- If a recogniser does not accept any non-empty string, then it -- either accepts the empty string or no string at all. nullable-or-fail : ∀ {Tok n} {p : P Tok n} → ¬ AcceptsNonEmptyString p → [] ∈ p ⊎ (∀ s → ¬ s ∈ p) nullable-or-fail {p = p} ¬a with [] ∈? p ... | yes []∈p = inj₁ []∈p ... | no []∉p = inj₂ helper where helper : ∀ s → ¬ s ∈ p helper [] = []∉p helper (t ∷ s) = ¬a ∘ _,_ t ∘ _,_ s -- If p₁ · p₂ accepts infinitely many pairs, and nothing but pairs -- (or the empty string), then at most one of p₁ and p₂ accepts a -- non-empty string. This follows because p₁ and p₂ are independent -- of each other. For instance, if p₁ accepted n and p₂ accepted i -- and j, then p₁ · p₂ would accept both ni and nj, and if p₁ -- accepted mm and p₂ accepted n then p₁ · p₂ would accept mmn. at-most-one : ∀ {n₁ n₂} {p₁ : ∞⟨ n₂ ⟩P ℕ n₁} {p₂ : ∞⟨ n₁ ⟩P ℕ n₂} → OnlyPairs (p₁ · p₂) → ManyPairs (p₁ · p₂) → AcceptsNonEmptyString (♭? p₁) → AcceptsNonEmptyString (♭? p₂) → ⊥ at-most-one op mp (n₁ , s₁ , n₁s₁∈p₁) (n₂ , s₂ , n₂s₂∈p₂) with op (n₁s₁∈p₁ · n₂s₂∈p₂) at-most-one _ _ (_ , _ ∷ [] , _) (_ , _ , _) | () at-most-one _ _ (_ , _ ∷ _ ∷ _ , _) (_ , _ , _) | () at-most-one {p₁ = p₁} {p₂} op mp (n , [] , n∈p₁) (.n , .[] , n∈p₂) | refl = twoDifferentWitnesses mp helper where ¬pair : ∀ {i s} → s ∈ p₁ · p₂ → n ≢ i → s ≢ pair i ¬pair (_·_ {s₁ = []} _ ii∈p₂) n≢i refl with op (n∈p₁ · ii∈p₂) ... | () ¬pair (_·_ {s₁ = i ∷ []} i∈p₁ _) n≢i refl with op (i∈p₁ · n∈p₂) ¬pair (_·_ {s₁ = .n ∷ []} n∈p₁ _) n≢n refl | refl = n≢n refl ¬pair (_·_ {s₁ = i ∷ .i ∷ []} ii∈p₁ _) n≢i refl with op (ii∈p₁ · n∈p₂) ... | () ¬pair (_·_ {s₁ = _ ∷ _ ∷ _ ∷ _} _ _) _ () helper : ¬ ∃₂ λ i j → i ≢ j × pair i ∈ p₁ · p₂ × pair j ∈ p₁ · p₂ helper (i , j , i≢j , ii∈ , jj∈) with Nat._≟_ n i helper (.n , j , n≢j , nn∈ , jj∈) | yes refl = ¬pair jj∈ n≢j refl helper (i , j , i≢j , ii∈ , jj∈) | no n≢i = ¬pair ii∈ n≢i refl -- OnlyPairs and ManyPairs are mutually exclusive. ¬pairs : ∀ {n} (p : P ℕ n) → OnlyPairs p → ManyPairs p → ⊥ ¬pairs fail op mp = witness mp (helper ∘ proj₂) where helper : ∀ {t} → ¬ pair t ∈ fail helper () ¬pairs empty op mp = witness mp (helper ∘ proj₂) where helper : ∀ {t} → ¬ pair t ∈ empty helper () ¬pairs (sat f) op mp = witness mp (helper ∘ proj₂) where helper : ∀ {t} → ¬ pair t ∈ sat f helper () ¬pairs (nonempty p) op mp = ¬pairs p (op ∘ nonempty) (Inf.map helper mp) where helper : ∀ {n} → pair n ∈ nonempty p → pair n ∈ p helper (nonempty pr) = pr ¬pairs (cast eq p) op mp = ¬pairs p (op ∘ cast) (Inf.map helper mp) where helper : ∀ {n} → pair n ∈ cast eq p → pair n ∈ p helper (cast pr) = pr -- The most interesting cases are _∣_ and _·_. For the choice -- combinator we make use of the fact that if p₁ ∣ p₂ accepts -- infinitely many pairs, then at least one of p₁ and p₂ do. (We are -- deriving a contradiction, so the use of classical reasoning is -- unproblematic.) ¬pairs (p₁ ∣ p₂) op mp = commutes-with-∪ (Inf.map split mp) helper where helper : ¬ (ManyPairs p₁ ⊎ ManyPairs p₂) helper (inj₁ mp₁) = ¬pairs p₁ (op ∘ ∣-left) mp₁ helper (inj₂ mp₂) = ¬pairs p₂ (op ∘ ∣-right {p₁ = p₁}) mp₂ split : ∀ {s} → s ∈ p₁ ∣ p₂ → s ∈ p₁ ⊎ s ∈ p₂ split (∣-left s∈p₁) = inj₁ s∈p₁ split (∣-right s∈p₂) = inj₂ s∈p₂ -- For the sequencing combinator we make use of the fact that the -- argument recognisers cannot both accept non-empty strings. ¬pairs (p₁ · p₂) op mp = excluded-middle λ a₁? → excluded-middle λ a₂? → helper a₁? a₂? where continue : {n n′ : Bool} (p : ∞⟨ n′ ⟩P ℕ n) → n′ ≡ true → OnlyPairs (♭? p) → ManyPairs (♭? p) → ⊥ continue p eq with forced? p continue p refl | true = ¬pairs p continue p () | false helper : Dec (AcceptsNonEmptyString (♭? p₁)) → Dec (AcceptsNonEmptyString (♭? p₂)) → ⊥ helper (yes a₁) (yes a₂) = at-most-one op mp a₁ a₂ helper (no ¬a₁) _ with nullable-or-fail ¬a₁ ... | inj₁ []∈p₁ = continue p₂ (⇒ []∈p₁) (op ∘ _·_ []∈p₁) (Inf.map right mp) where right : ∀ {s} → s ∈ p₁ · p₂ → s ∈ ♭? p₂ right (_·_ {s₁ = []} _ ∈p₂) = ∈p₂ right (_·_ {s₁ = _ ∷ _} ∈p₁ _) = ⊥-elim (¬a₁ (-, -, ∈p₁)) ... | inj₂ is-fail = witness mp (∉ ∘ proj₂) where ∉ : ∀ {s} → ¬ s ∈ p₁ · p₂ ∉ (∈p₁ · _) = is-fail _ ∈p₁ helper _ (no ¬a₂) with nullable-or-fail ¬a₂ ... | inj₁ []∈p₂ = continue p₁ (⇒ []∈p₂) (op ∘ (λ ∈p₁ → cast∈ (proj₂ ListMonoid.identity _) refl (∈p₁ · []∈p₂))) (Inf.map left mp) where left : ∀ {s} → s ∈ p₁ · p₂ → s ∈ ♭? p₁ left (_·_ {s₂ = _ ∷ _} _ ∈p₂) = ⊥-elim (¬a₂ (-, -, ∈p₂)) left (_·_ {s₁ = s₁} {s₂ = []} ∈p₁ _) = cast∈ (sym $ proj₂ ListMonoid.identity s₁) refl ∈p₁ ... | inj₂ is-fail = witness mp (∉ ∘ proj₂) where ∉ : ∀ {s} → ¬ s ∈ p₁ · p₂ ∉ (_ · ∈p₂) = is-fail _ ∈p₂ -- Note that it is easy to decide whether a string is a pair or not. pair? : List ℕ → Bool pair? (m ∷ n ∷ []) = ⌊ Nat._≟_ m n ⌋ pair? _ = false -- This means that there are decidable predicates over token strings -- which cannot be realised using the recogniser combinators. not-realisable : ¬ ∃₂ (λ n (p : P ℕ n) → ∀ {s} → s ∈ p ⇔ T (pair? s)) not-realisable (_ , p , hyp) = ¬pairs p op mp where op : OnlyPairs p op {n} {[]} s∈p = ⊥-elim (Equivalence.to hyp ⟨$⟩ s∈p) op {n} { m ∷ []} s∈p with toWitness (Equivalence.to hyp ⟨$⟩ s∈p) op {n} {.n ∷ []} s∈p | refl = refl op {n} {_ ∷ _ ∷ _} s∈p = ⊥-elim (Equivalence.to hyp ⟨$⟩ s∈p) mp : ManyPairs p mp (i , ¬pair) = ¬pair i NatOrder.refl $ Equivalence.from hyp ⟨$⟩ fromWitness refl not-expressible : ∃₂ λ (Tok : Set) (f : List Tok → Bool) → ¬ ∃₂ (λ n (p : P Tok n) → ∀ {s} → s ∈ p ⇔ T (f s)) not-expressible = (ℕ , pair? , not-realisable) where open NotExpressible
ada.editor/test/unit/data/subprogram_declarations.adb
timboudreau/netbeans-contrib
2
817
<gh_stars>1-10 -- -- 6.1 Subprogram Declarations -- -- NOTE: This module is not compilation is used only for testing purposes -- package Subprogram_Declarations is -- Examples of subprogram declarations: procedure Traverse_Tree; procedure Increment(X : in out Integer); procedure Right_Indent(Margin : out Line_Size); -- see 3.5.4 procedure Switch(From, To : in out Link); -- see 3.10.1 function Random return Probability; -- see 3.5.7 function Min_Cell(X : Link) return Cell; -- see 3.10.1 function Next_Frame(K : Positive) return Frame; -- see 3.10 function Dot_Product(Left, Right : Vector) return Real; -- see 3.6 function "*"(Left, Right : Matrix) return Matrix; -- see 3.6 -- Examples of in parameters with default expressions: procedure Print_Header (Pages : in Natural; Center : in Boolean := True); end Subprogram_Declarations;
alloy4fun_models/trashltl/models/5/f3iK4xRBDpmJ8eHgd.als
Kaixi26/org.alloytools.alloy
0
4952
open main pred idf3iK4xRBDpmJ8eHgd_prop6 { all f:File | f in Trash implies (always after f in Trash) } pred __repair { idf3iK4xRBDpmJ8eHgd_prop6 } check __repair { idf3iK4xRBDpmJ8eHgd_prop6 <=> prop6o }
chapter7/Project9.asm
pcooksey/Assembly-x86-64
0
171974
<reponame>pcooksey/Assembly-x86-64 ;;; ;;; This is Suggested Project 7.9.2.9 ;;; Iteratively find the nth Fibonacci number ;;; Pg. 138 for the problem ;;; Pg. 24 for Registers; Pg. 48 for Data Types SECTION .data SUCCESS: equ 0 ; Default success value SYS_EXIT: equ 60 ; Default system exit value ;; Variables used by the project N: equ 50 ; Nth number Fib: dq 0 ; Fibonacci number SECTION .text ; Code Section global _start ; Standard start _start: mov rcx, N - 1 ; Puting N in rcx for loop command mov rax, 0 ; Initialize to 0 mov rbx, 0 ; Initialize to 0 mov rdx, 1 ; Initialize to 1 cmp rdx, N ; Compare with N jb loop ; If 1 < N then jump mov rdx, N ; Set rdx to N (0 or 1) jmp end ; Jump to end loop: mov rax, rbx mov rbx, rdx add rdx, rax loop loop ; Loop until rcx is zero end: mov qword [Fib], rdx ; Done, terminate program last: mov rax, SYS_EXIT ; Call code for exit mov rdi, SUCCESS ; Exit with success syscall
src/words_engine/words_engine-word_package.adb
spr93/whitakers-words
3
8333
<gh_stars>1-10 -- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. -- -- This file still needs a lot of work. -- To do: -- -- * analyse all the things which can be factored back together -- * factor together the 9 instances of "Sxx (M) := " -- * factor together the two branches of Apply_Suffix () -- with Support_Utils.Addons_Package; use Support_Utils.Addons_Package; with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; with Latin_Utils.Config; use Latin_Utils.Config; with Support_Utils.Uniques_Package; use Support_Utils.Uniques_Package; with Support_Utils.Word_Parameters; use Support_Utils.Word_Parameters; with Latin_Utils.Preface; with Support_Utils.Developer_Parameters; use Support_Utils.Developer_Parameters; with Support_Utils.Line_Stuff; use Support_Utils.Line_Stuff; with Words_Engine.English_Support_Package; use Words_Engine.English_Support_Package; package body Words_Engine.Word_Package is Inflections_Sections_File : Lel_Section_Io.File_Type; procedure Pause (Output : Ada.Text_IO.File_Type) is Pause_Line : String (1 .. 300); Pause_Last : Integer := 0; begin if Words_Mdev (Pause_In_Screen_Output) then if Method = Interactive then if Ada.Text_IO.Name (Output) = Ada.Text_IO.Name (Ada.Text_IO.Standard_Output) then Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Output, " MORE - hit RETURN/ENTER to continue"); Ada.Text_IO.Get_Line (Ada.Text_IO.Standard_Input, Pause_Line, Pause_Last); end if; elsif Method = Command_Line_Input then Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Output, " MORE - hit RETURN/ENTER to continue"); Ada.Text_IO.Get_Line (Ada.Text_IO.Standard_Input, Pause_Line, Pause_Last); elsif Method = Command_Line_Files then null; -- Do not PAUSE end if; end if; exception when others => Ada.Text_IO.Put_Line ("Unexpected exception in PAUSE"); end Pause; function Ltu (C, D : Character) return Boolean is begin case D is when 'v' => return C < 'u'; when 'j' => return C < 'i'; when 'V' => return C < 'U'; when 'J' => return C < 'I'; when others => return C < D; end case; end Ltu; function Equ (C, D : Character) return Boolean is begin case D is when 'u' | 'v' => return (C = 'u') or (C = 'v'); when 'i' | 'j' => return (C = 'i') or (C = 'j'); when 'U' | 'V' => return (C = 'U') or (C = 'V'); when 'I' | 'J' => return (C = 'I') or (C = 'J'); when others => return C = D; end case; end Equ; function Gtu (C, D : Character) return Boolean is begin case D is when 'u' => return C > 'v'; when 'i' => return C > 'j'; when 'U' => return C > 'V'; when 'I' => return C > 'J'; when others => return C > D; end case; end Gtu; function Ltu (S, T : String) return Boolean is begin for I in 1 .. S'Length loop -- Not TRIMed, so same length if Equ (S (S'First + I - 1), T (T'First + I - 1)) then null; elsif Gtu (S (S'First + I - 1), T (T'First + I - 1)) then return False; elsif Ltu (S (S'First + I - 1), T (T'First + I - 1)) then return True; end if; end loop; return False; end Ltu; function Gtu (S, T : String) return Boolean is begin for I in 1 .. S'Length loop -- Not TRIMed, so same length if Equ (S (S'First + I - 1), T (T'First + I - 1)) then null; elsif Ltu (S (S'First + I - 1), T (T'First + I - 1)) then return False; elsif Gtu (S (S'First + I - 1), T (T'First + I - 1)) then return True; end if; end loop; return False; end Gtu; function Equ (S, T : String) return Boolean is begin if S'Length /= T'Length then return False; end if; for I in 1 .. S'Length loop if not Equ (S (S'First + I - 1), T (T'First + I - 1)) then return False; end if; end loop; return True; end Equ; procedure Run_Uniques (S : in String; Pa : in out Parse_Array; Pa_Last : in out Integer) is Sl : constant String -- BAD NAME!!!!!!!!!!!!!!!!!! := Lower_Case (Trim (S)); St : constant Stem_Type := Head (Sl, Max_Stem_Size); Unql : Unique_List; -- Unique list for a letter begin if Sl (Sl'First) = 'v' then Unql := Unq ('u'); -- Unique list for a letter elsif Sl (Sl'First) = 'j' then Unql := Unq ('i'); -- Unique list for a letter else Unql := Unq (Sl (Sl'First)); -- Unique list for a letter end if; --TEXT_IO.NEW_LINE; --TEXT_IO.PUT_LINE ("Called UNIQUES with =>" & SL & "|"); --TEXT_IO.NEW_LINE; --TEXT_IO.PUT_LINE ("UNQL "); while Unql /= null loop -- If there is a match, add to PA --TEXT_IO.PUT_LINE ("UNIQUE =>" & UNQL.PR.STEM); --if ST = LOWER_CASE (UNQL.PR.STEM) then if Equ (St, Lower_Case (Unql.Stem)) then Pa_Last := Pa_Last + 1; Pa (Pa_Last) := (Unql.Stem, (Unql.Qual, 0, Null_Ending_Record, X, X), Unique, Unql.MNPC); end if; Unql := Unql.Succ; end loop; end Run_Uniques; procedure Run_Inflections (S : in String; Sl : in out Sal; Restriction : Dict_Restriction := Regular) is -- Tries all possible inflections against the Input word in S -- and constructs a STEM_LIST of those that survive SL use Lel_Section_Io; Word : constant String := Lower_Case (Trim (S)); Last_Of_Word : constant Character := Word (Word'Last); Length_Of_Word : constant Integer := Word'Length; Stem_Length : Integer := 0; Pr : Parse_Record; M : Integer := 1; begin --TEXT_IO.NEW_LINE; --TEXT_IO.PUT_LINE ("Called RUN_INFLECTIONS with =>" & WORD & "|"); if Word'Length = 0 then Sl (M) := Null_Parse_Record; return; end if; Sa := Not_A_Stem_Array; -- Add all of these to list of possible ending records -- since the blank ending agrees with everything -- PACK/PRON have no blank endings if ((Restriction /= Pack_Only) and (Restriction /= Qu_Pron_Only)) and then (Word'Length <= Max_Stem_Size) then for I in Belf (0, ' ') .. Bell (0, ' ') loop Pr := (Word & Null_Stem_Type (Length_Of_Word + 1 .. Stem_Type'Length), Bel (I), Default_Dictionary_Kind, Null_MNPC); Sl (M) := Pr; M := M + 1; end loop; -- Is always a possibility (null ending) Sa (Length_Of_Word) := Pr.Stem; end if; -- Here we read in the INFLECTIONS_SECTION that is applicable if Restriction = Regular then case Last_Of_Word is when 'a' | 'c' | 'd' | 'e' | 'i' => Read (Inflections_Sections_File, Lel, 1); when 'm' | 'n' | 'o' | 'r' => Read (Inflections_Sections_File, Lel, 2); when 's' => Read (Inflections_Sections_File, Lel, 3); when 't' | 'u' => Read (Inflections_Sections_File, Lel, 4); when others => --PUT_LINE ("Only blank inflections are found"); return; end case; elsif Restriction = Pack_Only or Restriction = Qu_Pron_Only then Read (Inflections_Sections_File, Lel, 4); end if; -- Now do the non-blank endings -- Only go to LENGTH_OF_WORD for Z in reverse 1 .. Integer'Min (Max_Ending_Size, Length_Of_Word) loop -- Check if Z agrees with a PDL SIZE !!!!!!!!!!!!!!!!!!!!!!!!!!!! -- Maybe make PDL on size, if it has to be a list, -- or order by size if array if Lell (Z, Last_Of_Word) > 0 then -- Any likely inflections at all for I in Lelf (Z, Last_Of_Word) .. Lell (Z, Last_Of_Word) loop if Equ (Lower_Case (Lel (I).Ending.Suf (1 .. Z)), Lower_Case (Word (Word'Last - Z + 1 .. Word'Last))) then -- Add to list of possible ending records --STEM_LENGTH := WORD'LENGTH - LEL (I).ENDING.SIZE; Stem_Length := Word'Length - Z; if Stem_Length <= Max_Stem_Size then -- Reject too long words -- Check if LEL IR agrees with PDL IR !!!!!!!! Pr := (Word (Word'First .. Stem_Length) & Null_Stem_Type (Stem_Length + 1 .. Max_Stem_Size), Lel (I), Default_Dictionary_Kind, Null_MNPC); Sl (M) := Pr; M := M + 1; Sa (Stem_Length) := Pr.Stem; -- Gets set dozens of times -- Could order the endings by length (suffix sort) -- so length changes slowly --PUT_LINE ("LENGTH = " & INTEGER'IMAGE (STEM_LENGTH) --& " SA =>" & PR.STEM & "|"); end if; end if; end loop; end if; end loop; end Run_Inflections; procedure Try_To_Load_Dictionary (D_K : Dictionary_Kind) is begin Stem_Io.Open (Stem_File (D_K), Stem_Io.In_File, Add_File_Name_Extension (Stem_File_Name, Dictionary_Kind'Image (D_K))); Dict_IO.Open (Dict_File (D_K), Dict_IO.In_File, Add_File_Name_Extension (Dict_File_Name, Dictionary_Kind'Image (D_K))); Load_Indices_From_Indx_File (D_K); Dictionary_Available (D_K) := True; exception when others => Dictionary_Available (D_K) := False; end Try_To_Load_Dictionary; procedure Dictionary_Search (Ssa : Stem_Array_Type; D_K : Dictionary_Kind; Restriction : Dict_Restriction := Regular) is -- Prepares a PDL list of possible dictionary hits -- Search a dictionary (D_K) looking for all stems that match -- any of the stems that are physically possible with Latin inflections use Stem_Io; --type NAT_32 is Range 0 .. 2**31-1; --############### J, J1, J2, Jj : Stem_Io.Count := 0; Index_On : constant String := Ssa (Ssa'Last); Index_First, Index_Last : Stem_Io.Count := 0; Ds : Dictionary_Stem; First_Try, Second_Try : Boolean := True; function First_Two (W : String) return String is -- 'v' could be represented by 'u', like the -- new Oxford Latin Dictionary -- Fixes the first two letters of a word/stem which can be done right S : constant String := Lower_Case (W); Ss : String (W'Range) := W; function Ui (C : Character) return Character is begin if C = 'v' then return 'u'; elsif C = 'V' then return 'U'; elsif C = 'j' then return 'i'; elsif C = 'J' then return 'I'; else return C; end if; end Ui; begin if S'Length = 1 then Ss (S'First) := Ui (W (S'First)); else Ss (S'First) := Ui (W (S'First)); Ss (S'First + 1) := Ui (W (S'First + 1)); end if; return Ss; end First_Two; procedure Load_Pdl is begin case Restriction is when Regular => if not (Ds.Part.Pofs = Pack or (Ds.Part.Pofs = Pron and then (Ds.Part.Pron.Decl.Which = 1))) then Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Ds, D_K); end if; when Pack_Only => if Ds.Part.Pofs = Pack then Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Ds, D_K); end if; when Qu_Pron_Only => if Ds.Part.Pofs = Pron and then (Ds.Part.Pron.Decl.Which = 1) then Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Ds, D_K); end if; when others => Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Ds, D_K); end case; end Load_Pdl; begin -- Now go through the dictionary list DL for the first letters -- and make a reduced dictionary list PDL if D_K = Local then Index_First := First_Index ((First_Two (Index_On)(1), 'a'), D_K); Index_Last := Last_Index ((First_Two (Index_On)(1), 'a'), D_K); else Index_First := First_Index (First_Two (Index_On), D_K); Index_Last := Last_Index (First_Two (Index_On), D_K); end if; if Index_First > 0 and then Index_First <= Index_Last then J1 := Index_First; --###################### J2 := Index_Last; Stem_Array_Loop : for K in Ssa'Range loop if Trim (Ssa (K))'Length > 1 then -- This may be checking for 0 and 1 letter SSAs which -- are done elsewhere if D_K = Local then -- Special processing for unordered DICT.LOC for J in J1 .. J2 loop -- Sweep exaustively through the scope Set_Index (Stem_File (D_K), Stem_Io.Count (J)); Read (Stem_File (D_K), Ds); if Equ (Lower_Case (Ds.Stem), Ssa (K)) then Load_Pdl; end if; end loop; else -- Regular dictionaries First_Try := True; Second_Try := True; J := (J1 + J2) / 2; Binary_Search : loop if (J1 = J2 - 1) or (J1 = J2) then if First_Try then J := J1; First_Try := False; elsif Second_Try then J := J2; Second_Try := False; else Jj := J; exit Binary_Search; end if; end if; Set_Index (Stem_File (D_K), J); Read (Stem_File (D_K), Ds); if Ltu (Lower_Case (Ds.Stem), Ssa (K)) then J1 := J; J := (J1 + J2) / 2; elsif Gtu (Lower_Case (Ds.Stem), Ssa (K)) then J2 := J; J := (J1 + J2) / 2; else for I in reverse J1 .. J loop Set_Index (Stem_File (D_K), Stem_Io.Count (I)); Read (Stem_File (D_K), Ds); if Equ (Lower_Case (Ds.Stem), Ssa (K)) then Jj := I; Load_Pdl; else exit; end if; end loop; for I in J + 1 .. J2 loop Set_Index (Stem_File (D_K), Stem_Io.Count (I)); Read (Stem_File (D_K), Ds); if Equ (Lower_Case (Ds.Stem), Ssa (K)) then Jj := I; Load_Pdl; else exit Binary_Search; end if; end loop; exit Binary_Search; end if; end loop Binary_Search; J1 := Jj; J2 := Index_Last; end if; -- On LOCAL check end if; -- On LENGTH > 1 end loop Stem_Array_Loop; end if; end Dictionary_Search; procedure Search_Dictionaries (Ssa : in Stem_Array_Type; Restriction : Dict_Restriction := Regular) is use Stem_Io; Fc : Character := ' '; begin Pdl := (others => Null_Pruned_Dictionary_Item); Pdl_Index := 0; --PUT_LINE ("Search for blank stems"); -- BDL is always used, so it is loaded initially and not called from disk -- Check all stems of the dictionary entry against the reduced stems -- Determine if there is a pure blank " " stem if Len (Ssa (Ssa'First)) = 0 then -- a size would help? --PUT ("HIT on blank stem I = ");PUT ('1'); --PUT (" STEM = ");PUT_LINE (BDL (1).STEM); --PDL := new PRUNED_DICTIONARY_ITEM'(BDL (1), GENERAL, PDL); Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Bdl (1), General); end if; -- Now there is only one blank stem (2 of to_be), -- but need not always be so -- Determine if there is a blank stem (SC = ' ') -- Prepare for the possibility that one stem is short but there -- are others Fc := ' '; if Ssa (Ssa'First)(1) = ' ' then if Ssa'Length > 1 and then Ssa (Ssa'First + 1)(2) = ' ' then Fc := Ssa (Ssa'First + 1)(1); end if; elsif Ssa (Ssa'First)(2) = ' ' then Fc := Ssa (Ssa'First)(1); end if; -- If there is a single letter stem (FC /= ' ') then if Fc /= ' ' then for I in 2 .. Bdl_Last loop -- Check all stems of the dictionary entry against the -- reduced stems --if LOWER_CASE (BDL (I).STEM (1)) = FC then if Equ (Lower_Case (Bdl (I).Stem (1)), Fc) then Pdl_Index := Pdl_Index + 1; Pdl (Pdl_Index) := Pruned_Dictionary_Item'(Bdl (I), General); end if; end loop; end if; if Ssa'Length = 0 then -- PUT_LINE ("Empty stem array, don't bother searching"); return; -- elsif LEN (SSA (SSA'LAST)) <= 1 then -- PUT_LINE ("No two letter stems, have done searching"); -- else -- PUT_LINE ("Searching Dictionaries"); end if; for D_K in Dictionary_Kind loop if Dictionary_Available (D_K) then if not Is_Open (Stem_File (D_K)) then Open (Stem_File (D_K), Stem_Io.In_File, Add_File_Name_Extension (Stem_File_Name, Dictionary_Kind'Image (D_K))); end if; Dictionary_Search (Ssa, D_K, Restriction); Close (Stem_File (D_K)); --?????? end if; end loop; end Search_Dictionaries; procedure Change_Language (C : Character) is begin if Upper_Case (C) = 'L' then Language := Latin_To_English; Preface.Put_Line ("Language changed to " & Language_Type'Image (Language)); elsif Upper_Case (C) = 'E' then if English_Dictionary_Available (General) then Language := English_To_Latin; Preface.Put_Line ("Language changed to " & Language_Type'Image (Language)); Preface.Put_Line ("Input a single English word (+ part of speech - " & "N, ADJ, V, PREP, . .. )"); else Preface.Put_Line ("No English dictionary available"); end if; else Preface.Put_Line ("Bad LANGUAGE Input - no change, remains " & Language_Type'Image (Language)); end if; exception when others => Preface.Put_Line ("Bad LANGUAGE Input - no change, remains " & Language_Type'Image (Language)); end Change_Language; procedure Word (Raw_Word : in String; Pa : in out Parse_Array; Pa_Last : in out Integer) is Input_Word : constant String := Lower_Case (Raw_Word); Pa_Save : constant Integer := Pa_Last; procedure Order_Stems (Sx : in out Sal) is use Dict_IO; Hits : Integer := 0; Sl : Sal := Sx; Sl_Last : Integer := 0; Sm : Parse_Record; begin if Sx (1) = Null_Parse_Record then return; end if; --PUT_LINE ("ORDERing_STEMS"); for I in Sl'Range loop exit when Sl (I) = Null_Parse_Record; Sl_Last := Sl_Last + 1; end loop; --PUT_LINE ("In ORDER SL_LAST = " & INTEGER'IMAGE (SL_LAST)); -- Bubble sort since this list should usually be very small (1-5) Hit_Loop : loop Hits := 0; Switch : begin -- Need to remove duplicates in ARRAY_STEMS -- This sort is very sloppy -- One problem is that it can mix up some of the order of -- PREFIX, XXX, LOC; I ought to do this for every set of -- results from different approaches not just in one fell -- swoop at the end !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! declare function Compare (L : Parse_Record; R : Parse_Record) return Boolean is begin if (R.MNPC < L.MNPC) or else (R.MNPC = L.MNPC and then R.IR.Ending.Size < L.IR.Ending.Size) or else (R.MNPC = L.MNPC and then R.IR.Ending.Size = L.IR.Ending.Size and then R.IR.Qual < L.IR.Qual) or else (R.MNPC = L.MNPC and then R.IR.Ending.Size = L.IR.Ending.Size and then R.IR.Qual = L.IR.Qual and then R.D_K < L.D_K) then return True; else return False; end if; end Compare; begin Inner_Loop : for I in 1 .. Sl_Last - 1 loop if Sl (I + 1) /= Null_Parse_Record then -- the following condition is absurd and should be -- rewritten if Compare (Sl (I), Sl (I + 1)) then Sm := Sl (I); Sl (I) := Sl (I + 1); Sl (I + 1) := Sm; Hits := Hits + 1; end if; else exit Inner_Loop; end if; end loop Inner_Loop; end; end Switch; exit Hit_Loop when Hits = 0; end loop Hit_Loop; Sx := Sl; end Order_Stems; procedure Array_Stems (Sx : in Sal; Pa : in out Parse_Array; Pa_Last : in out Integer) is Sl : constant Sal := Sx; Opr : Parse_Record := Null_Parse_Record; begin if Sl (1) = Null_Parse_Record then return; else Opr := Null_Parse_Record; for I in Sl'Range loop if Sl (I) /= Null_Parse_Record then --PUT ('*'); PUT (SL (I)); NEW_LINE; Supress_Key_Check : declare function "<=" (A, B : Parse_Record) return Boolean is use Dict_IO; begin -- !!!!!!!!!!!!!!!!!!!!!!!!!! if A.IR.Qual = B.IR.Qual and then A.MNPC = B.MNPC then return True; else return False; end if; end "<="; begin if Sl (I) <= Opr then -- Get rid of duplicates, if ORDER is OK --PUT ('-'); PUT (SL (I)); NEW_LINE; null; else Pa_Last := Pa_Last + 1; Pa (Pa_Last) := Sl (I); Opr := Sl (I); end if; end Supress_Key_Check; else exit; end if; end loop; end if; end Array_Stems; procedure Reduce_Stem_List (Sl : in Sal; Sxx : in out Sal; -- Need in out if want to print it at the end --procedure REDUCE_STEM_LIST (SL : in SAL; SXX : out SAL; Prefix : in Prefix_Item := Null_Prefix_Item; Suffix : in Suffix_Item := Null_Suffix_Item) is MNPC_Part : MNPC_Type := Null_MNPC; Pdl_Part : Part_Entry; Com : Comparison_Type := X; Num_Sort : Numeral_Sort_Type := X; Ls : Integer := 0; M : Integer := 0; Pdl_Key : Stem_Key_Type; Pdl_P : Part_Of_Speech_Type; --sl_key : Stem_Key_Type; --sl_p : Part_Of_Speech_Type; function "<=" (Left, Right : Part_Of_Speech_Type) return Boolean is begin if Right = Left or else (Left = Pack and Right = Pron) or else Right = X then return True; else return False; end if; end "<="; function "<=" (Left, Right : Gender_Type) return Boolean is begin if Right = Left or else (Right = C and Left /= N) or else Right = X then return True; else return False; end if; end "<="; function "<=" (Left, Right : Stem_Key_Type) return Boolean is begin if Right = Left or else Right = 0 then return True; else return False; end if; end "<="; begin Sxx := (others => Null_Parse_Record); -- Essentially initializing -- For the reduced dictionary list PDL M := 0; On_Pdl : for J in 1 .. Pdl_Index loop Pdl_Part := Pdl (J).Ds.Part; Pdl_Key := Pdl (J).Ds.Key; MNPC_Part := Pdl (J).Ds.MNPC; -- Is there any point in going through the process for this PDL Pdl_P := Pdl (J).Ds.Part.Pofs; -- Used only for FIX logic below -- If there is no SUFFIX then carry on if Suffix = Null_Suffix_Item then -- No suffix working, fall through null; elsif -- No suffix for abbreviations (Pdl_P = N and then Pdl_Part.N.Decl = (9, 8)) or (Pdl_P = Adj and then Pdl_Part.Adj.Decl = (9, 8)) then -- Can be no suffix on abbreviation"); goto End_Of_Pdl_Loop; else -- There is SUFFIX, see if it agrees with PDL -- Does SUFFIX agree in ROOT if Pdl_P <= Suffix.Entr.Root and then ((Pdl_Key <= Suffix.Entr.Root_Key) or else ((Pdl_Key = 0) and then ((Pdl_P = N) or (Pdl_P = Adj) or (Pdl_P = V)) and then ((Suffix.Entr.Root_Key = 1) or (Suffix.Entr.Root_Key = 2)))) then -- Transform PDL_PART to TARGET case Suffix.Entr.Target.Pofs is when N => Pdl_Part := (N, Suffix.Entr.Target.N); when Pron => Pdl_Part := (Pron, Suffix.Entr.Target.Pron); when Adj => Pdl_Part := (Adj, Suffix.Entr.Target.Adj); when Num => Pdl_Part := (Num, Suffix.Entr.Target.Num); when Adv => Pdl_Part := (Adv, Suffix.Entr.Target.Adv); when V => Pdl_Part := (V, Suffix.Entr.Target.V); when others => null; -- No others so far, except X = all end case; Pdl_Key := Suffix.Entr.Target_Key; Pdl_P := Pdl_Part.Pofs; -- Used only for FIX logic below else --PUT_LINE ("In REDUCE_STEM_LIST There is no legal suffix"); -- exit; goto End_Of_Pdl_Loop; end if; end if; if Prefix = Null_Prefix_Item then -- No PREFIX, drop through null; elsif -- No prefix for abbreviations (Pdl_P = N and then Pdl_Part.N.Decl = (9, 8)) or (Pdl_P = Adj and then Pdl_Part.Adj.Decl = (9, 8)) or (Pdl_P = Interj or Pdl_P = Conj) -- or INTERJ or CONJ then goto End_Of_Pdl_Loop; else if (Pdl_P = Prefix.Entr.Root) or -- = ROOT (Pdl_Part.Pofs = Prefix.Entr.Root) -- or part mod by suf then null; elsif Prefix.Entr.Root = X then -- or ROOT = X null; else goto End_Of_Pdl_Loop; end if; end if; -- SUFFIX and PREFIX either agree or don't exist -- (agrees with everything) Ls := Len (Add_Suffix (Add_Prefix (Pdl (J).Ds.Stem, Prefix), Suffix)); On_Sl : for I in Sl'Range loop exit On_Sl when Sl (I) = Null_Parse_Record; if Ls = Len (Sl (I).Stem) then -- Scan through the whole unreduced stem list -- Single out those stems that match (pruned) dictionary -- entries --^^^^^should be able to do this better with new arrangement --sl_key := sl (i).ir.key; --sl_p := sl (i).ir.qual.pofs; if ( ((Pdl_Key <= Sl (I).IR.Key)) or else ((Pdl_Key = 0) and then (((Pdl_P = N) or (Pdl_P = Adj) or (Pdl_P = V)) and then ((Sl (I).IR.Key = 1) or (Sl (I).IR.Key = 2)))) ) and then -- and KEY (Pdl_Part.Pofs = Eff_Part (Sl (I).IR.Qual.Pofs)) then if Pdl_Part.Pofs = N and then Pdl_Part.N.Decl <= Sl (I).IR.Qual.Noun.Decl and then Pdl_Part.N.Gender <= Sl (I).IR.Qual.Noun.Gender then -- Need to transfer the gender of the noun -- dictionary item M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => N, Noun => ( Pdl_Part.N.Decl, Sl (I).IR.Qual.Noun.Of_Case, Sl (I).IR.Qual.Noun.Number, Pdl_Part.N.Gender)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif Pdl_Part.Pofs = Pron and then Pdl_Part.Pron.Decl <= Sl (I).IR.Qual.Pron.Decl then --PUT (" HIT PRON "); -- Need to transfer the kind of the pronoun -- dictionary item M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Pron, Pron => ( Pdl_Part.Pron.Decl, Sl (I).IR.Qual.Pron.Of_Case, Sl (I).IR.Qual.Pron.Number, Sl (I).IR.Qual.Pron.Gender)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif (Pdl_Part.Pofs = Adj) and then (Pdl_Part.Adj.Decl <= Sl (I).IR.Qual.Adj.Decl) and then ((Sl (I).IR.Qual.Adj.Comparison <= Pdl_Part.Adj.Co) or ((Sl (I).IR.Qual.Adj.Comparison = X) or (Pdl_Part.Adj.Co = X))) then -- Note the reversal on comparisom --PUT (" HIT ADJ "); -- Need to transfer the gender of the dictionary item -- Need to transfer the CO of the ADJ dictionary item if Pdl_Part.Adj.Co in Pos .. Super then -- If the dictionary entry has a unique CO, use it Com := Pdl_Part.Adj.Co; else -- Otherwise, the entry is X, generate a CO from KEY Com := Adj_Comp_From_Key (Pdl_Key); end if; M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Adj, Adj => ( Pdl_Part.Adj.Decl, Sl (I).IR.Qual.Adj.Of_Case, Sl (I).IR.Qual.Adj.Number, Sl (I).IR.Qual.Adj.Gender, Com)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif (Pdl_Part.Pofs = Num) and then (Pdl_Part.Num.Decl <= Sl (I).IR.Qual.Num.Decl) and then (Pdl_Key = Sl (I).IR.Key) then --PUT(" HIT NUM "); if Pdl_Part.Num.Sort = X then -- If the entry is X, generate a CO from KEY Num_Sort := Num_Sort_From_Key (Pdl_Key); else -- Otherwise, the dictionary entry has a -- unique CO, use it Num_Sort := Pdl_Part.Num.Sort; end if; M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Num, Num => ( Pdl_Part.Num.Decl, Sl (I).IR.Qual.Num.Of_Case, Sl (I).IR.Qual.Num.Number, Sl (I).IR.Qual.Num.Gender, Num_Sort)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif (Pdl_Part.Pofs = Adv) and then ((Pdl_Part.Adv.Co <= Sl (I).IR.Qual.Adv.Comparison) or ((Sl (I).IR.Qual.Adv.Comparison = X) or (Pdl_Part.Adv.Co = X))) then --PUT (" HIT ADV "); -- Need to transfer the CO of the ADV dictionary item if Pdl_Part.Adv.Co in Pos .. Super then -- If the dictionary entry has a unique CO, use it Com := Pdl_Part.Adv.Co; else -- The entry is X and we need to generate -- a COMP from the KEY Com := Adv_Comp_From_Key (Pdl_Key); end if; M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Adv, Adv => ( Comparison => Com)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif Pdl_Part.Pofs = V then --TEXT_IO.PUT_LINE ("V found, now check CON"); if Sl (I).IR.Qual.Pofs = V and then (Pdl_Part.V.Con <= Sl (I).IR.Qual.Verb.Con) then --TEXT_IO.PUT (" HIT V "); M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => V, Verb => ( Pdl_Part.V.Con, Sl (I).IR.Qual.Verb.Tense_Voice_Mood, Sl (I).IR.Qual.Verb.Person, Sl (I).IR.Qual.Verb.Number)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif Sl (I).IR.Qual.Pofs = Vpar and then (Pdl_Part.V.Con <= Sl (I).IR.Qual.Vpar.Con) then --PUT (" HIT VPAR "); M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Vpar, Vpar => ( Pdl_Part.V.Con, Sl (I).IR.Qual.Vpar.Of_Case, Sl (I).IR.Qual.Vpar.Number, Sl (I).IR.Qual.Vpar.Gender, Sl (I).IR.Qual.Vpar.Tense_Voice_Mood)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); elsif Sl (I).IR.Qual.Pofs = Supine and then (Pdl_Part.V.Con <= Sl (I).IR.Qual.Supine.Con) then --PUT (" HIT SUPINE"); M := M + 1; Sxx (M) := (Stem => Subtract_Prefix (Sl (I).Stem, Prefix), IR => ( Qual => ( Pofs => Supine, Supine => ( Pdl_Part.V.Con, Sl (I).IR.Qual.Supine.Of_Case, Sl (I).IR.Qual.Supine.Number, Sl (I).IR.Qual.Supine.Gender)), Key => Sl (I).IR.Key, Ending => Sl (I).IR.Ending, Age => Sl (I).IR.Age, Freq => Sl (I).IR.Freq), D_K => Pdl (J).D_K, MNPC => MNPC_Part); end if; elsif Pdl_Part.Pofs = Prep and then Pdl_Part.Prep.Obj = Sl (I).IR.Qual.Prep.Of_Case then --PUT (" HIT PREP "); M := M + 1; Sxx (M) := (Subtract_Prefix (Sl (I).Stem, Prefix), Sl (I).IR, Pdl (J).D_K, MNPC_Part); elsif Pdl_Part.Pofs = Conj then --PUT (" HIT CONJ "); M := M + 1; Sxx (M) := (Subtract_Prefix (Sl (I).Stem, Prefix), Sl (I).IR, Pdl (J).D_K, MNPC_Part); elsif Pdl_Part.Pofs = Interj then --PUT (" HIT INTERJ "); M := M + 1; Sxx (M) := (Subtract_Prefix (Sl (I).Stem, Prefix), Sl (I).IR, Pdl (J).D_K, MNPC_Part); end if; end if; end if; end loop On_Sl; <<End_Of_Pdl_Loop>> null; end loop On_Pdl; end Reduce_Stem_List; procedure Apply_Prefix (Sa : in Stem_Array_Type; Suffix : in Suffix_Item; Sx : in Sal; Sxx : in out Sal; Pa : in out Parse_Array; Pa_Last : in out Integer) is -- Worry about the stem changing re-cipio from capio -- Correspondence of parts, need EFF for VPAR -- The prefixes should be ordered with the longest/most likely first Ssa : Stem_Array; L : Integer := 0; begin --PUT_LINE ("Entering APPLY_PREFIX"); Sxx := (others => Null_Parse_Record); -- !!!!!!!!!!!!!!!!!!!!!!! if Words_Mdev (Use_Prefixes) then for I in 1 .. Number_Of_Prefixes loop -- Loop through PREFIXES L := 0; for J in Sa'Range loop -- Loop through stem array if Sa (J)(1) = Prefixes (I).Fix (1) then -- Cuts down a little -- do better if Subtract_Prefix (Sa (J), Prefixes (I)) /= Head (Sa (J), Max_Stem_Size) then L := L + 1; -- We have a hit, make new stem array item Ssa (L) := Head (Subtract_Prefix (Sa (J), Prefixes (I)), Max_Stem_Size); -- And that has prefix subtracted to match dict end if; -- with prefix subtracted stems end if; end loop; if L > 0 then -- There has been a prefix hit Search_Dictionaries (Ssa (1 .. L)); -- So run new dictionary search if Pdl_Index /= 0 then -- Dict search was successful Reduce_Stem_List (Sx, Sxx, Prefixes (I), Suffix); if Sxx (1) /= Null_Parse_Record then -- There is reduced stem result Pa_Last := Pa_Last + 1; -- So add prefix line to parse array Pa (Pa_Last).IR := ((Prefix, Null_Prefix_Record), 0, Null_Ending_Record, X, X); Pa (Pa_Last).Stem := Head (Prefixes (I).Fix, Max_Stem_Size); Pa (Pa_Last).MNPC := Dict_IO.Count (Prefixes (I).MNPC); Pa (Pa_Last).D_K := Addons; exit; -- Because we accept only one prefix end if; end if; end if; end loop; -- Loop on I for PREFIXES end if; -- On USE_PREFIXES end Apply_Prefix; procedure Apply_Suffix (Sa : in Stem_Array_Type; Sx : in Sal; Sxx : in out Sal; Pa : in out Parse_Array; Pa_Last : in out Integer) is Ssa : Stem_Array; L : Integer := 0; Suffix_Hit : Integer := 0; -- use TEXT_IO; -- use INFLECTIONS_PACKAGE.INTEGER_IO; begin for I in 1 .. Number_Of_Suffixes loop -- Loop through SUFFIXES L := 0; -- Take as many as fit for J in Sa'Range loop -- Loop through stem array if Subtract_Suffix (Sa (J), Suffixes (I)) /= Head (Sa (J), Max_Stem_Size) then L := L + 1; -- We have a hit, make new stem array item Ssa (L) := Head (Subtract_Suffix (Sa (J), Suffixes (I)), Max_Stem_Size); -- And that has prefix subtracted to match dict end if; end loop; -- Loop on J through SA if L > 0 then -- There has been a suffix hit Search_Dictionaries (Ssa (1 .. L)); -- So run new dictionary search -- For suffixes we allow as many as match if Pdl_Index /= 0 then -- Dict search was successful Suffix_Hit := I; Reduce_Stem_List (Sx, Sxx, Null_Prefix_Item, Suffixes (I)); if Sxx (1) /= Null_Parse_Record then -- There is reduced stem result Pa_Last := Pa_Last + 1; -- So add suffix line to parse array Pa (Pa_Last).IR := ((Suffix, Null_Suffix_Record), 0, Null_Ending_Record, X, X); Pa (Pa_Last).Stem := Head (Suffixes (Suffix_Hit).Fix, Max_Stem_Size); -- Maybe it would better if suffix.fix was of stem size Pa (Pa_Last).MNPC := Dict_IO.Count (Suffixes (Suffix_Hit).MNPC); Pa (Pa_Last).D_K := Addons; --- for I in Sxx'Range loop exit when Sxx (I) = Null_Parse_Record; Pa_Last := Pa_Last + 1; Pa (Pa_Last) := Sxx (I); end loop; --- end if; else -- there is suffix (L /= 0) but no dictionary hit Suffix_Hit := I; Apply_Prefix (Ssa (1 .. L), Suffixes (I), Sx, Sxx, Pa, Pa_Last); if Sxx (1) /= Null_Parse_Record then -- There is reduced stem result Pa_Last := Pa_Last + 1; -- So add suffix line to parse array Pa (Pa_Last).IR := ((Suffix, Null_Suffix_Record), 0, Null_Ending_Record, X, X); Pa (Pa_Last).Stem := Head (Suffixes (Suffix_Hit).Fix, Max_Stem_Size); Pa (Pa_Last).MNPC := Dict_IO.Count (Suffixes (Suffix_Hit).MNPC); Pa (Pa_Last).D_K := Addons; for I in Sxx'Range loop -- Set this set of results exit when Sxx (I) = Null_Parse_Record; Pa_Last := Pa_Last + 1; Pa (Pa_Last) := Sxx (I); end loop; end if; end if; end if; -- with suffix subtracted stems end loop; -- Loop on I for SUFFIXES end Apply_Suffix; procedure Prune_Stems (Input_Word : String; Sx : in Sal; Sxx : in out Sal) is J : Integer := 0; --SXX : SAL; begin if Sx (1) = Null_Parse_Record then return; end if; ----------------------------------------------------------------- Generate_Reduced_Stem_Array : begin J := 1; for Z in 0 .. Integer'Min (Max_Stem_Size, Len (Input_Word)) loop if Sa (Z) /= Not_A_Stem then --PUT (Z); PUT (J); PUT (" "); PUT_LINE (SA (Z)); Ssa (J) := Sa (Z); Ssa_Max := J; J := J + 1; end if; end loop; end Generate_Reduced_Stem_Array; if not Words_Mdev (Do_Only_Fixes) then -- Just bypass main dictionary search Search_Dictionaries (Ssa (1 .. Ssa_Max)); end if; if (((Pa_Last = 0) and -- No Uniques or Syncope (Pdl_Index = 0)) --) and then -- No dictionary match or Words_Mdev (Do_Fixes_Anyway)) and then Words_Mode (Do_Fixes) then ----So try prefixes and suffixes, --- Generate a new SAA array, search again if Sxx (1) = Null_Parse_Record then -- We could not find a match with suffix Apply_Prefix (Ssa (1 .. Ssa_Max), Null_Suffix_Item, Sx, Sxx, Pa, Pa_Last); end if; -------------- if Sxx (1) = Null_Parse_Record then -- We could not find a match with suffix Apply_Suffix (Ssa (1 .. Ssa_Max), Sx, Sxx, Pa, Pa_Last); if Sxx (1) = Null_Parse_Record then -- We could not find a match with suffix ----So try prefixes, Generate a new SAA array, search again ----Need to use the new SSA, modified to include suffixes Apply_Prefix (Ssa (1 .. Ssa_Max), Null_Suffix_Item, Sx, Sxx, Pa, Pa_Last); -------------- end if; -- Suffix failed end if; -- Suffix failed else Reduce_Stem_List (Sx, Sxx, Null_Prefix_Item, Null_Suffix_Item); if Pa_Last = 0 and then Sxx (1) = Null_Parse_Record then -------------- if Words_Mode (Do_Fixes) then Apply_Suffix (Ssa (1 .. Ssa_Max), Sx, Sxx, Pa, Pa_Last); if Sxx (1) = Null_Parse_Record then -- We could not find a match with suffix ----So try prefixes, Generate a new SAA array, search again ----Need to use the new SSA, modified to include suffixes Apply_Prefix (Ssa (1 .. Ssa_Max), Null_Suffix_Item, Sx, Sxx, Pa, Pa_Last); end if; -- Suffix failed end if; -- If DO_FIXES then do end if; -- First search passed but SXX null end if; -- First search failed end Prune_Stems; procedure Process_Packons (Input_Word : String) is Stem_Length : Integer := 0; Pr : Parse_Record; M : Integer := 1; De : Dictionary_Entry; Mean : Meaning_Type; Packon_First_Hit : Boolean := False; Sl : Sal := (others => Null_Parse_Record); Sl_Nulls : constant Sal := (others => Null_Parse_Record); begin Over_Packons : for K in Packons'Range loop -- Do whole set, more than one may apply -- PACKON if the TACKON ENTRY is PRON For_Each_Packon : declare Xword : constant String := Subtract_Tackon (Input_Word, Packons (K)); Word : String (1 .. Xword'Length) := Xword; Packon_Length : constant Integer := Trim (Packons (K).Tack)'Length; Last_Of_Word : Character := Word (Word'Last); Length_Of_Word : constant Integer := Word'Length; begin Sl := Sl_Nulls; -- Initialize SL to nulls if Word /= Input_Word then Packon_First_Hit := True; if Packons (K).Tack (1 .. 3) = "dam" and Last_Of_Word = 'n' then -- Takes care of the m - > n shift with dam Word (Word'Last) := 'm'; Last_Of_Word := 'm'; end if; -- No blank endings in these pronouns Lel_Section_Io.Read (Inflections_Sections_File, Lel, 4); M := 0; On_Inflects : for Z in reverse 1 .. Integer'Min (6, Length_Of_Word) loop -- optimum for qu-pronouns if Pell (Z, Last_Of_Word) > 0 then -- Any possible inflections at all for I in Pelf (Z, Last_Of_Word) .. Pell (Z, Last_Of_Word) loop if (Z <= Length_Of_Word) and then ((Equ (Lel (I).Ending.Suf (1 .. Z), Word (Word'Last - Z + 1 .. Word'Last))) and (Lel (I).Qual.Pron.Decl <= Packons (K).Entr.Base.Pack.Decl)) then -- Have found an ending that is a possible match -- And INFLECT agrees with PACKON.BASE -- Add to list of possible ending records Stem_Length := Word'Length - Z; Pr := (Head (Word (Word'First .. Stem_Length), Max_Stem_Size), Lel (I), Default_Dictionary_Kind, Null_MNPC); M := M + 1; Sl (M) := Pr; Ssa (1) := Head (Word (Word'First .. Word'First + Stem_Length - 1), Max_Stem_Size); -- may Get set several times end if; end loop; end if; end loop On_Inflects; -- Only one stem will emerge Pdl_Index := 0; Search_Dictionaries (Ssa (1 .. 1), Pack_Only); -- Now have a PDL, scan for agreement Pdl_Loop : for J in 1 .. Pdl_Index loop -- Go through all dictionary hits to see -- M used here where I is used in REDUCE, -- maybe make consistent M := 1; Sl_Loop : while Sl (M) /= Null_Parse_Record loop -- Over all inflection hits -- if this stem is possible -- call up the meaning to check for "(w/-" Dict_IO.Set_Index (Dict_File (Pdl (J).D_K), Pdl (J).Ds.MNPC); Dict_IO.Read (Dict_File (Pdl (J).D_K), De); Mean := De.Mean; -- there is no way this condition can be True; -- packon_length - 1 /= packon_length -- Does attached PACKON agree if Trim (Mean)(1 .. 4) = "(w/-" and then Trim (Mean)(5 .. 4 + Packon_Length) = Trim (Packons (K).Tack) then if Pdl (J).Ds.Part.Pack.Decl = Sl (M).IR.Qual.Pron.Decl then -- or if Packon_First_Hit then Pa_Last := Pa_Last + 1; Pa (Pa_Last) := (Packons (K).Tack, ((Tackon, Null_Tackon_Record), 0, Null_Ending_Record, X, X), Addons, Dict_IO.Count ((Packons (K).MNPC))); Packon_First_Hit := False; end if; Pa_Last := Pa_Last + 1; Pa (Pa_Last) := ( Stem => Sl (M).Stem, IR => ( Qual => ( Pofs => Pron, Pron => ( Pdl (J).Ds.Part.Pack.Decl, Sl (M).IR.Qual.Pron.Of_Case, Sl (M).IR.Qual.Pron.Number, Sl (M).IR.Qual.Pron.Gender)), Key => Sl (M).IR.Key, Ending => Sl (M).IR.Ending, Age => Sl (M).IR.Age, Freq => Sl (M).IR.Freq), D_K => Pdl (J).D_K, MNPC => Pdl (J).Ds.MNPC); --end if; end if; end if; M := M + 1; end loop Sl_Loop; end loop Pdl_Loop; end if; end For_Each_Packon; Packon_First_Hit := False; end loop Over_Packons; end Process_Packons; procedure Process_Qu_Pronouns (Input_Word : String; Qkey : Stem_Key_Type := 0) is Word : constant String := Lower_Case (Trim (Input_Word)); Last_Of_Word : constant Character := Word (Word'Last); Length_Of_Word : constant Integer := Word'Length; Stem_Length : Integer := 0; M : Integer := 0; Pr : Parse_Record; Sl : Sal := (others => Null_Parse_Record); begin --TEXT_IO.PUT_LINE ("PROCESS_QU_PRONOUNS " & INPUT_WORD); -- No blank endings in these pronouns Lel_Section_Io.Read (Inflections_Sections_File, Lel, 4); -- M used here while I is used in REDUCE, maybe make consistent M := 0; On_Inflects : for Z in reverse 1 .. Integer'Min (4, Length_Of_Word) loop -- optimized for qu-pronouns if Pell (Z, Last_Of_Word) > 0 then -- Any possible inflections at all for I in Pelf (Z, Last_Of_Word) .. Pell (Z, Last_Of_Word) loop if (Z <= Length_Of_Word) and then Lel (I).Key = Qkey and then Equ (Lel (I).Ending.Suf (1 .. Z), Word (Word'Last - Z + 1 .. Word'Last)) then -- Have found an ending that is a possible match -- Add to list of possible ending records Stem_Length := Word'Length - Z; Pr := (Head (Word (Word'First .. Stem_Length), Max_Stem_Size), Lel (I), Default_Dictionary_Kind, Null_MNPC); M := M + 1; Sl (M) := Pr; Ssa (1) := Head (Word (Word'First .. Word'First + Stem_Length - 1), Max_Stem_Size); -- may Get set several times end if; end loop; end if; end loop On_Inflects; -- Only one stem will emerge Pdl_Index := 0; Search_Dictionaries (Ssa (1 .. 1), Qu_Pron_Only); -- Now have a PDL, scan for agreement Pdl_Loop : for J in 1 .. Pdl_Index loop -- Go through all dictionary hits to see M := 1; Sl_Loop : while Sl (M) /= Null_Parse_Record loop -- Over all inflection hits if Pdl (J).Ds.Part.Pron.Decl = Sl (M).IR.Qual.Pron.Decl then Pa_Last := Pa_Last + 1; Pa (Pa_Last) := ( Stem => Sl (M).Stem, IR => ( Qual => ( Pofs => Pron, Pron => ( Pdl (J).Ds.Part.Pron.Decl, Sl (M).IR.Qual.Pron.Of_Case, Sl (M).IR.Qual.Pron.Number, Sl (M).IR.Qual.Pron.Gender)), Key => Sl (M).IR.Key, Ending => Sl (M).IR.Ending, Age => Sl (M).IR.Age, Freq => Sl (M).IR.Freq), D_K => Pdl (J).D_K, MNPC => Pdl (J).Ds.MNPC); end if; M := M + 1; end loop Sl_Loop; -- PDL:= PDL.SUCC; end loop Pdl_Loop; end Process_Qu_Pronouns; procedure Try_Tackons (Input_Word : String) is Tackon_Hit : Boolean := False; Tackon_On : Boolean := False; J : Integer := 0; De : Dictionary_Entry := Null_Dictionary_Entry; Entering_Pa_Last : constant Integer := Pa_Last; Start_Of_Loop : constant Integer := 5; -- 4 enclitics -- Hard number !!!!!!!!!!!!!!! End_Of_Loop : constant Integer := Number_Of_Tackons; begin Loop_Over_Tackons : for I in Start_Of_Loop .. End_Of_Loop loop Remove_A_Tackon : declare Less : constant String := Subtract_Tackon (Input_Word, Tackons (I)); begin --TEXT_IO.PUT_LINE ("LESS = " & LESS); if Less /= Input_Word then -- LESS is less Word (Less, Pa, Pa_Last); if Pa_Last > Entering_Pa_Last then -- we have a possible word if Tackons (I).Entr.Base.Pofs = X then Tackon_Hit := True; Tackon_On := False; else J := Pa_Last; while J >= Entering_Pa_Last + 1 loop -- Sweep backwards over PA -- Sweeping up inapplicable fixes, -- although we only have TACKONs for X -- or PRON or ADJ - so far -- and there are no fixes for PRON - so far if Pa (J).IR.Qual.Pofs = Prefix and then Tackon_On then null; -- check PART Tackon_On := False; elsif Pa (J).IR.Qual.Pofs = Suffix and then Tackon_On then -- check PART null; Tackon_On := False; elsif Pa (J).IR.Qual.Pofs = Tackons (I).Entr.Base.Pofs then Dict_IO.Set_Index (Dict_File (Pa (J).D_K), Pa (J).MNPC); Dict_IO.Read (Dict_File (Pa (J).D_K), De); -- check PART case Tackons (I).Entr.Base.Pofs is when N => if Pa (J).IR.Qual.Noun.Decl <= Tackons (I).Entr.Base.N.Decl then -- Ignore GEN and KIND Tackon_Hit := True; Tackon_On := True; end if; when Pron => -- Only one we have other than X if Pa (J).IR.Qual.Pron.Decl <= Tackons (I).Entr.Base.Pron.Decl then Tackon_Hit := True; Tackon_On := True; else Pa (J .. Pa_Last - 1) := Pa (J + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; end if; when Adj => -- Forego all checks, even on DECL of ADJ -- -cumque is the only one I have now -- if . .. .. .. Tackon_Hit := True; Tackon_On := True; -- else -- PA (J .. PA_LAST - 1) := -- PA (J + 1 .. PA_LAST); -- PA_LAST := PA_LAST - 1; -- end if; --when ADV => --when V => when others => Pa (J .. Pa_Last - 1) := Pa (J + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; end case; else -- check PART Pa (J .. Pa_Last - 1) := Pa (J + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; end if; -- check PART J := J - 1; end loop; -- loop sweep over PA end if; -- on PART (= X?) ----------------------------------------- if Tackon_Hit then Pa_Last := Pa_Last + 1; Pa (Entering_Pa_Last + 2 .. Pa_Last) := Pa (Entering_Pa_Last + 1 .. Pa_Last - 1); Pa (Entering_Pa_Last + 1) := (Tackons (I).Tack, ((Tackon, Null_Tackon_Record), 0, Null_Ending_Record, X, X), Addons, Dict_IO.Count ((Tackons (I).MNPC))); return; -- Be happy with one ??????? else null; end if; -- TACKON_HIT end if; -- we have a possible word end if; -- LESS is less end Remove_A_Tackon; end loop Loop_Over_Tackons; end Try_Tackons; begin -- WORD if Trim (Input_Word) = "" then return; end if; Run_Uniques (Input_Word, Pa, Pa_Last); Qu : declare Pa_Qstart : constant Integer := Pa_Last; Pa_Start : constant Integer := Pa_Last; Saved_Mode_Array : constant Mode_Array := Words_Mode; Qkey : Stem_Key_Type := 0; begin -- QU Tickons (Number_Of_Tickons + 1) := Null_Prefix_Item; Words_Mode := (others => False); for I in 1 .. Number_Of_Tickons + 1 loop declare Q_Word : constant String := Trim (Subtract_Tickon (Input_Word, Tickons (I))); begin Pa_Last := Pa_Qstart; Pa (Pa_Last + 1) := Null_Parse_Record; if (I = Number_Of_Tickons + 1) or else -- The prefix is a TICKON (Q_Word /= Input_Word) -- and it matches the start of INPUT_WORD then if I <= Number_Of_Tickons then -- Add to PA if Pa_Last := Pa_Last + 1; -- So add prefix line to parse array Pa (Pa_Last).Stem := Head (Tickons (I).Fix, Max_Stem_Size); Pa (Pa_Last).IR := ((Prefix, Null_Prefix_Record), 0, Null_Ending_Record, X, X); Pa (Pa_Last).D_K := Addons; Pa (Pa_Last).MNPC := Dict_IO.Count (Tickons (I).MNPC); end if; if Q_Word'Length >= 3 and then -- qui is shortest QU_PRON ((Q_Word (Q_Word'First .. Q_Word'First + 1) = "qu") or (Q_Word (Q_Word'First .. Q_Word'First + 1) = "cu")) then if Q_Word (Q_Word'First .. Q_Word'First + 1) = "qu" then Qkey := 1; Process_Qu_Pronouns (Q_Word, Qkey); elsif Q_Word (Q_Word'First .. Q_Word'First + 1) = "cu" then Qkey := 2; Process_Qu_Pronouns (Q_Word, Qkey); end if; if Pa_Last <= Pa_Qstart + 1 and then Qkey > 0 then -- If did not find a PACKON if Q_Word (Q_Word'First .. Q_Word'First + 1) = "qu" then Process_Packons (Q_Word); elsif Q_Word (Q_Word'First .. Q_Word'First + 1) = "cu" then Process_Packons (Q_Word); end if; else exit; end if; if Pa_Last > Pa_Qstart + 1 then exit; end if; elsif Input_Word'Length >= 6 then -- aliqui as aliQU_PRON if Input_Word (Input_Word'First .. Input_Word'First + 4) = "aliqu" then Process_Qu_Pronouns (Input_Word, 1); elsif Input_Word (Input_Word'First .. Input_Word'First + 4) = "alicu" then Process_Qu_Pronouns (Input_Word, 2); end if; end if; if Pa_Last = Pa_Start + 1 then -- Nothing found Pa_Last := Pa_Start; -- Reset PA_LAST else exit; end if; end if; end; end loop; Words_Mode := Saved_Mode_Array; exception when others => Words_Mode := Saved_Mode_Array; end Qu; --========================================================== declare Sss : Sal := (others => Null_Parse_Record); Ss : Sal := (others => Null_Parse_Record); begin Run_Inflections (Input_Word, Ss); Prune_Stems (Input_Word, Ss, Sss); if Sss (1) /= Null_Parse_Record then Order_Stems (Sss); Array_Stems (Sss, Pa, Pa_Last); Sss (1) := Null_Parse_Record; end if; end; --========================================================== if Pa_Last = Pa_Save then Try_Tackons (Input_Word); end if; exception when Storage_Error => Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Output, "STORAGE_ERROR exception in WORD while processing =>" & Raw_Word); Pa_Last := Pa_Save; if Words_Mode (Write_Unknowns_To_File) then Ada.Text_IO.Put (Unknowns, Raw_Word); Ada.Text_IO.Set_Col (Unknowns, 21); Ada.Text_IO.Put_Line (Unknowns, "======== STORAGE_ERROR "); end if; when others => if Words_Mode (Write_Unknowns_To_File) then Ada.Text_IO.Put (Unknowns, Raw_Word); Ada.Text_IO.Set_Col (Unknowns, 21); Ada.Text_IO.Put_Line (Unknowns, "======== ERROR "); end if; Pa_Last := Pa_Save; end Word; procedure Initialize_Word_Package is begin -- Initializing WORD_PACKAGE Establish_Inflections_Section; Lel_Section_Io.Open (Inflections_Sections_File, Lel_Section_Io.In_File, Inflections_Sections_Name); Try_To_Load_Dictionary (General); Try_To_Load_Dictionary (Special); Load_Local : begin -- First check if there is a LOC dictionary Check_For_Local_Dictionary : declare Dummy : Ada.Text_IO.File_Type; begin Ada.Text_IO.Open (Dummy, Ada.Text_IO.In_File, Add_File_Name_Extension (Dictionary_File_Name, "LOCAL")); -- Failure to OPEN will raise an exception, to be handled below Ada.Text_IO.Close (Dummy); end Check_For_Local_Dictionary; -- If the above does not exception out, we can load LOC Preface.Put ("LOCAL "); Dict_Loc := Null_Dictionary; Load_Dictionary (Dict_Loc, Add_File_Name_Extension (Dictionary_File_Name, "LOCAL")); -- Need to carry LOC through consistently on LOAD_D and LOAD_D_FILE Load_Stem_File (Local); Dictionary_Available (Local) := True; exception when others => Dictionary_Available (Local) := False; end Load_Local; Load_Uniques (Unq, Uniques_Full_Name); Load_Addons (Addons_Full_Name); Load_Bdl_From_Disk; if not (Dictionary_Available (General) or Dictionary_Available (Special) or Dictionary_Available (Local)) then Preface.Put_Line ("There are no main dictionaries - program will not do much"); Preface.Put_Line ("Check that there are dictionary files in this subdirectory"); Preface.Put_Line ("Except DICT.LOC that means DICTFILE, INDXFILE, STEMFILE"); end if; Try_To_Load_English_Words : begin English_Dictionary_Available (General) := False; Ewds_Direct_Io.Open (Ewds_File, Ewds_Direct_Io.In_File, "EWDSFILE.GEN"); English_Dictionary_Available (General) := True; exception when others => Preface.Put_Line ("No English available"); English_Dictionary_Available (General) := False; end Try_To_Load_English_Words; end Initialize_Word_Package; end Words_Engine.Word_Package;
oeis/018/A018900.asm
neoneye/loda-programs
11
101377
<reponame>neoneye/loda-programs<filename>oeis/018/A018900.asm ; A018900: Sums of two distinct powers of 2. ; Submitted by <NAME>(s2) ; 3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640 seq $0,130328 ; Triangle of differences between powers of 2, read by rows. mul $0,2 seq $0,3188 ; Decimal equivalent of Gray code for n.
Control/Monad/Levels.agda
oisdk/agda-playground
6
6623
<filename>Control/Monad/Levels.agda {-# OPTIONS --cubical --safe #-} module Control.Monad.Levels where open import Control.Monad.Levels.Definition public
audio/sfx/get_key_item_3.asm
opiter09/ASM-Machina
1
80549
SFX_Get_Key_Item_3_Ch5: execute_music tempo 256 volume 7, 7 duty_cycle 2 toggle_perfect_pitch note_type 5, 10, 4 octave 3 note A#, 4 note_type 5, 11, 1 octave 4 note C_, 2 note C_, 1 note C_, 1 note_type 5, 10, 4 note D#, 4 note_type 5, 11, 1 note F_, 2 note F_, 1 note F_, 1 note_type 5, 11, 4 note A#, 8 sound_ret SFX_Get_Key_Item_3_Ch6: execute_music vibrato 4, 2, 3 duty_cycle 2 note_type 5, 13, 1 octave 4 note G_, 2 note G_, 1 note G_, 1 note_type 5, 12, 4 note D#, 4 note_type 5, 13, 1 note G#, 2 note G#, 1 note G#, 1 note A#, 2 note A#, 1 note A#, 1 note_type 5, 12, 4 octave 5 note D#, 8 sound_ret SFX_Get_Key_Item_3_Ch7: execute_music note_type 5, 1, 0 octave 4 note D#, 4 note G#, 4 note G_, 4 note F_, 4 note D#, 8 sound_ret
Documentation/boot.asm
geoffthorpe/ant-architecture
0
112
<gh_stars>0 # $Id$ # # boot.asm: # 1. Initialize sp, fp, ra. 2. Initialize leh. 3. Jump to the base of the real code. 4. Code for exception handling stuff. # Standard memory map: # # 1 meg of physical RAM. # boot.asm lives in last page. # stack starts and end of second-to-last page.
Sources/Globe_3d/objects/globe_3d-impostor.adb
ForYouEyesOnly/Space-Convoy
1
29846
pragma Warnings (Off); pragma Style_Checks (Off); with GLOBE_3D.Textures, GLOBE_3D.Math; with glut.Windows; use glut.Windows; with GL.Errors; with GLU; with ada.Text_IO; use ada.Text_IO; package body GLOBE_3D.Impostor is package G3DT renames GLOBE_3D.Textures; package G3DM renames GLOBE_3D.Math; procedure destroy (o : in out Impostor) is use GL.Geometry, GL.Skins; begin free (o.skinned_Geometry.Geometry); free (o.skinned_Geometry.Skin); free (o.skinned_Geometry.Veneer); end; procedure free (o : in out p_Impostor) is procedure deallocate is new ada.unchecked_Deallocation (Impostor'Class, p_Impostor); begin if o /= null then destroy (o.all); end if; deallocate (o); end; function get_Target (O : in Impostor) return p_Visual is begin return o.Target; end; procedure set_Target (o : in out Impostor; Target : in p_Visual) is use GL, GL.Skins, GL.Geometry; begin o.Target := Target; o.is_Terrain := Target.is_Terrain; Target.pre_Calculate; -- set o.skinned_Geometry.geometry.vertices & indices -- declare Width : GL.Double := Target.bounds.sphere_Radius * 1.00; begin o.Quads.Vertices (1) := ( - Width, - Width, 0.0); o.Quads.Vertices (2) := (Width, - Width, 0.0); o.Quads.Vertices (3) := (Width, Width, 0.0); o.Quads.Vertices (4) := ( - Width, Width, 0.0); end; o.Quads.all.set_vertex_Id (1, 1, 1); -- tbd : the '.all' required for gnat gpl06 . .. not required in gpl07. o.Quads.all.set_vertex_Id (1, 2, 2); o.Quads.all.set_vertex_Id (1, 3, 3); o.Quads.all.set_vertex_Id (1, 4, 4); -- create the veneer, if necessary -- if o.skinned_Geometry.Veneer = null then --o.skinned_Geometry.Veneer := o.skinned_Geometry.Skin.new_Veneer (o.Quads.all); o.skinned_Geometry.Veneer := o.skinned_Geometry.Skin.new_Veneer (o.skinned_geometry.Geometry.all); end if; --o.bounding_sphere_Radius := bounding_sphere_Radius (o.Quads.vertex_Pool.all); --o.Bounds := o.skinned_Geometry.Geometry.Bounds; end; -- update trigger configuration -- procedure set_freshen_count_update_trigger_Mod (o : in out Impostor; To : in Positive) is begin o.freshen_count_update_trigger_Mod := Counter (To); end; function get_freshen_count_update_trigger_Mod (o : in Impostor) return Positive is begin return Positive (o.freshen_count_update_trigger_Mod); end; procedure set_size_update_trigger_Delta (o : in out Impostor; To : in Positive) is begin o.size_update_trigger_Delta := GL.SizeI (To); end; function get_size_update_trigger_Delta (o : in Impostor) return Positive is begin return Positive (o.size_update_trigger_Delta); end; function general_Update_required (o : access Impostor; the_Camera : in p_Camera; the_pixel_Region : in pixel_Region) return Boolean is use GL, Globe_3D.Math; Camera_has_moved : Boolean := the_Camera.clipper.eye_Position /= o.prior_camera_Position; Target_has_moved : Boolean := o.Target.Centre /= o.prior_target_Position; begin o.freshen_Count := o.freshen_Count + 1; if o.freshen_Count > o.freshen_count_update_trigger_Mod then return True; end if; if Camera_has_moved and then abs (Angle (the_Camera.clipper.eye_Position, o.prior_target_Position, o.prior_camera_Position)) > to_Radians (degrees => 15.0) then return True; end if; if Target_has_moved and then abs (Angle (o.target.Centre, o.prior_camera_Position, o.prior_target_Position)) > to_Radians (degrees => 15.0) then return True; end if; if o.prior_pixel_Region.Width > 40 -- ignore target rotation triggered updates when target is small on screen and then o.prior_pixel_Region.Height > 40 -- and then o.prior_target_Rotation /= o.target.Rotation then return True; end if; return False; end; function size_Update_required (o : access Impostor; the_pixel_Region : in pixel_Region) return Boolean is use GL; begin return abs (the_pixel_Region.Width - o.prior_Width_Pixels) > o.size_update_trigger_Delta or else abs (the_pixel_Region.Height - o.prior_Height_pixels) > o.size_update_trigger_Delta; end; function get_pixel_Region (o : access Impostor'Class; the_Camera : in globe_3d.p_Camera) return pixel_Region is use GL, globe_3d.Math; target_Centre : Vector_3d := the_Camera.world_Rotation * (o.Target.Centre - the_Camera.clipper.eye_Position); target_lower_Left : Vector_3d := target_Centre - (o.Target.bounds.sphere_Radius, o.Target.bounds.sphere_Radius, 0.0); target_Centre_proj : Vector_4d := the_Camera.Projection_Matrix * target_Centre; target_Lower_Left_proj : Vector_4d := the_Camera.Projection_Matrix * target_lower_Left; target_Centre_norm : Vector_3d := (target_Centre_proj (0) / target_Centre_proj (3), target_Centre_proj (1) / target_Centre_proj (3), target_Centre_proj (2) / target_Centre_proj (3)); target_Lower_Left_norm : Vector_3d := (target_Lower_Left_proj (0) / target_Lower_Left_proj (3), target_Lower_Left_proj (1) / target_Lower_Left_proj (3), target_Lower_Left_proj (2) / target_Lower_Left_proj (3)); target_Centre_norm_0to1 : Vector_3d := (target_Centre_norm (0) * 0.5 + 0.5, target_Centre_norm (1) * 0.5 + 0.5, target_Centre_norm (2) * 0.5 + 0.5); target_Lower_Left_norm_0to1 : Vector_3d := (target_Lower_Left_norm (0) * 0.5 + 0.5, target_Lower_Left_norm (1) * 0.5 + 0.5, target_Lower_Left_norm (2) * 0.5 + 0.5); viewport_Width : Integer := the_Camera.clipper.main_Clipping.x2 - the_Camera.clipper.main_Clipping.x1 + 1; viewport_Height : Integer := the_Camera.clipper.main_Clipping.y2 - the_Camera.clipper.main_Clipping.y1 + 1; Width : Real := 2.0 * Real (viewport_Width) * (target_Centre_norm_0to1 (0) - target_Lower_Left_norm_0to1 (0)); Width_pixels : GL.Sizei := GL.Sizei (Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (0) + Width) - Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (0)) + 1); Height : Real := 2.0 * Real (viewport_Height) * (target_Centre_norm_0to1 (1) - target_Lower_Left_norm_0to1 (1)); Height_pixels : GL.Sizei := GL.Sizei (Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (1) + Height) - Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (1)) + 1); begin o.all.target_camera_Distance := Norm (target_Centre); -- nb : cache distance from camera to target. return (x => GL.Int (target_Lower_Left_norm_0to1 (0) * Real (Viewport_Width)), y => GL.Int (target_Lower_Left_norm_0to1 (1) * Real (viewport_Height)), width => Width_pixels, height => Height_pixels); end; procedure update (o : in out Impostor; the_Camera : in p_Camera; texture_Pool : in GL.textures.p_Pool) is use GL, GL.Textures; Width_size : GL.textures.Size := to_Size (Natural (o.current_Width_pixels)); Height_size : GL.textures.Size := to_Size (Natural (o.current_Height_pixels)); texture_Width : GL.sizei := GL.sizei (power_of_2_Ceiling (Natural (o.current_Width_pixels))); texture_Height : GL.sizei := GL.sizei (power_of_2_Ceiling (Natural (o.current_Height_pixels))); GL_Error : Boolean; begin o.prior_pixel_Region := (o.current_copy_X, o.current_copy_Y, o.current_Width_pixels, o.current_Height_pixels); o.prior_Width_pixels := o.current_Width_pixels; o.prior_Height_pixels := o.current_Height_pixels; o.prior_target_Rotation := o.target.Rotation; o.prior_target_Position := o.target.Centre; o.prior_camera_Position := the_Camera.clipper.Eye_Position; GL.ClearColor (0.0, 0.0, 0.0, 0.0); render ((1 => o.Target), the_Camera.all); -- render the target for subsequent copy to impostor texture. declare -- set texture coordinates for the veneer. use GL.Skins; the_Veneer : p_Veneer_transparent_unlit_textured := p_Veneer_transparent_unlit_textured (o.skinned_Geometry.Veneer); X_first : Real := o.expand_X; Y_first : Real := o.expand_Y; X_last : Real := Real (o.current_Width_pixels) / Real (texture_Width) - X_First; Y_last : Real := Real (o.current_Height_pixels) / Real (texture_Height) - Y_First; begin the_Veneer.texture_Coordinates := (1 => (s => X_first, t => Y_first), 2 => (s => X_last, t => Y_first), 3 => (s => X_last, t => Y_last), 4 => (s => X_first, t => Y_last)); end; if Width_size /= GL.textures.Size_width (o.skin.Texture) or else Height_size /= GL.textures.Size_height (o.skin.Texture) then free (texture_Pool.all, o.skin.Texture); o.skin.all.Texture := new_Texture (texture_Pool, Natural (texture_Width), Natural (texture_Height)); end if; enable (o.skin.all.Texture); GL.CopyTexSubImage2D (gl.TEXTURE_2D, 0, o.current_copy_x_Offset, o.current_copy_y_Offset, o.current_copy_X, o.current_copy_Y, o.current_copy_Width, o.current_copy_Height); GL.Errors.log (error_occurred => gl_Error); if gl_Error then put_Line ("x_Offset : " & GL.Int'image (o.current_copy_x_Offset) & " ********"); put_Line ("y_Offset : " & GL.Int'image (o.current_copy_y_Offset)); put_Line ("start x : " & GL.Int'image (o.current_copy_X)); put_Line ("start y : " & GL.Int'image (o.current_copy_Y)); put_Line ("copy width : " & GL.sizei'image (o.current_copy_Width)); put_Line ("copy height : " & GL.sizei'image (o.current_copy_Height)); put_Line ("width_pixels : " & GL.sizei'image (o.current_Width_pixels)); put_Line ("height_pixels : " & GL.sizei'image (o.current_Height_pixels)); put_Line ("width_size : " & GL.textures.size'image (Width_size)); put_Line ("height_size : " & GL.textures.size'image (Height_size)); put_Line ("texture width : " & GL.sizei'image (texture_Width)); put_Line ("texutre height : " & GL.sizei'image (texture_Height)); end if; o.never_Updated := False; o.freshen_Count := 0; end; procedure freshen (o : in out Impostor'Class; the_Camera : in globe_3d.p_Camera; texture_Pool : in GL.Textures.p_Pool; is_Valid : out Boolean) is update_Required : Boolean := o.Update_required (the_Camera); -- nb : caches current update info begin if update_Required then o.update (the_Camera, texture_Pool); end if; is_Valid := o.is_Valid; end; function target_camera_Distance (o : in Impostor'Class) return Real is begin return o.target_camera_Distance; end; function is_Valid (o : in Impostor'Class) return Boolean is begin return o.is_Valid; end; function never_Updated (o : in Impostor'Class) return Boolean is begin return o.never_Updated; end; function frame_Count_since_last_update (o : in Impostor'Class) return Natural is begin return Natural (o.freshen_Count); end; function skinned_Geometrys (o : in Impostor) return GL.skinned_geometry.skinned_Geometrys is begin return (1 => o.skinned_Geometry); end; function face_Count (o : in Impostor) return Natural is begin return 1; end; procedure Display (o : in out Impostor; clip : in Clipping_data) is begin null; -- actual display is done by the renderer (ie glut.Windows), which requests all skinned Geometry's -- and then applies 'gl state' sorting for performance, before drawing. end Display; procedure set_Alpha (o : in out Impostor; Alpha : in GL.Double) is begin null; -- tbd end; function Bounds (o : in Impostor) return GL.geometry.Bounds_record is begin return o.skinned_geometry.Geometry.Bounds; end; function is_Transparent (o : in Impostor) return Boolean is begin return True; -- tbd : - if using gl alpha test, depth sorting is not needed apparently. -- in which case this could be set to False, and treated as a non - transparent in g3d.render. -- may then be faster (?). -- - seems to make little difference . .. test with different vid card. end; function Skin (o : access Impostor) return GL.skins.p_Skin_transparent_unlit_textured is begin return GL.skins.p_Skin_transparent_unlit_textured (o.skinned_geometry.skin); end; function Quads (o : in Impostor) return GL.geometry.primitives.p_Quads is use GL.Geometry.Primitives, GL.geometry.primal; begin return p_Quads (p_primal_Geometry (o.skinned_geometry.Geometry).Primitive); end; -- note : only old, unused code folows (may be useful) . .. -- -- tbd : enable_rotation is no good for impostors, since they must be aligned with the viewport -- it might be useful for general billboards however ! -- procedure enable_Rotation (o : in Impostor; camera_Site : in Vector_3D) is use globe_3d.Math, globe_3d.REF, GL; lookAt : Vector_3D := (0.0, 0.0, 1.0); objToCamProj : Vector_3D := Normalized ((camera_Site (0) - o.Centre (0), 0.0, camera_Site (2) - o.Centre (2))); upAux : Vector_3D := lookAt * objToCamProj; angleCosine : GL.Double := lookAt * objToCamProj; begin if angleCosine > - 0.9999 and angleCosine < 0.9999 then GL.Rotate (arcCos (angleCosine) * 180.0 / 3.14, upAux (0), upAux (1), upAux (2)); end if; declare objToCam : Vector_3D := Normalized ((camera_Site (0) - o.Centre (0), camera_Site (1) - o.Centre (1), camera_Site (2) - o.Centre (2))); begin angleCosine := objToCamProj * objToCam; if angleCosine > - 0.9999 and angleCosine < 0.9999 then if objToCam (1) < 0.0 then GL.Rotate (arcCos (angleCosine) * 180.0 / 3.14, 1.0, 0.0, 0.0); else GL.Rotate (arcCos (angleCosine) * 180.0 / 3.14, - 1.0, 0.0, 0.0); end if; end if; end; end; -- -- based on lighthouse3d billboard example. end GLOBE_3D.Impostor;
1-base/lace/applet/demo/event/distributed/source/chat-registrar.adb
charlie5/lace
20
16575
with lace.Observer, system.RPC, ada.Exceptions, ada.Strings.unbounded, ada.Text_IO; package body chat.Registrar is use ada.Strings.unbounded; use type Client.view; procedure last_chance_Handler (Msg : in system.Address; Line : in Integer); pragma Export (C, last_chance_Handler, "__gnat_last_chance_handler"); procedure last_chance_Handler (Msg : in System.Address; Line : in Integer) is pragma Unreferenced (Msg, Line); use ada.Text_IO; begin put_Line ("Unable to start the Registrar."); put_Line ("Please ensure the 'po_cos_naming' server is running."); put_Line ("Press Ctrl-C to quit."); delay Duration'Last; end last_chance_Handler; type client_Info is record View : Client.view; Name : unbounded_String; as_Observer : lace.Observer.view; end record; type client_Info_array is array (Positive range <>) of client_Info; max_Clients : constant := 5_000; -- Protection against race conditions. -- protected safe_Clients is procedure add (the_Client : in Client.view); procedure rid (the_Client : in Client.view); function all_client_Info return client_Info_array; private Clients : client_Info_array (1 .. max_Clients); end safe_Clients; protected body safe_Clients is procedure add (the_Client : in Client.view) is function "+" (From : in String) return unbounded_String renames to_unbounded_String; begin for i in Clients'Range loop if Clients (i).View = null then Clients (i).View := the_Client; Clients (i).Name := +the_Client.Name; Clients (i).as_Observer := the_Client.as_Observer; return; end if; end loop; end add; procedure rid (the_Client : in Client.view) is begin for i in Clients'Range loop if Clients (i).View = the_Client then Clients (i).View := null; return; end if; end loop; raise Program_Error with "Unknown client"; end rid; function all_client_Info return client_Info_array is Count : Natural := 0; Result : client_Info_array (1..max_Clients); begin for i in Clients'Range loop if Clients (i).View /= null then Count := Count + 1; Result (Count) := Clients (i); end if; end loop; return Result (1..Count); end all_client_Info; end safe_Clients; procedure register (the_Client : in Client.view) is Name : constant String := the_Client.Name; all_Info : constant client_Info_array := safe_Clients.all_client_Info; begin for Each of all_Info loop if Each.Name = Name then raise Name_already_used; end if; end loop; safe_Clients.add (the_Client); end register; procedure deregister (the_Client : in Client.view) is begin safe_Clients.rid (the_Client); end deregister; function all_Clients return chat.Client.views is all_Info : constant client_Info_array := safe_Clients.all_client_Info; Result : chat.Client.views (all_Info'Range); begin for i in Result'Range loop Result (i) := all_Info (i).View; end loop; return Result; end all_Clients; task check_Client_lives is entry halt; end check_Client_lives; task body check_Client_lives is use ada.Text_IO; Done : Boolean := False; begin loop select accept halt do Done := True; end halt; or delay 15.0; end select; exit when Done; declare all_Info : constant client_Info_array := safe_Clients.all_client_Info; Dead : client_Info_array (all_Info'Range); dead_Count : Natural := 0; function "+" (From : in unbounded_String) return String renames to_String; begin for Each of all_Info loop begin Each.View.ping; exception when system.RPC.communication_Error | storage_Error => put_Line (+Each.Name & " has died."); deregister (Each.View); dead_Count := dead_Count + 1; Dead (dead_Count) := Each; end; end loop; declare all_Clients : constant Client.views := chat.Registrar.all_Clients; begin for Each of all_Clients loop for i in 1 .. dead_Count loop begin put_Line ("Ridding " & (+Dead (i).Name) & " from " & Each.Name); Each.deregister_Client ( Dead (i).as_Observer, +Dead (i).Name); exception when chat.Client.unknown_Client => put_Line ("Deregister of " & (+Dead (i).Name) & " from " & Each.Name & " is not needed."); end; end loop; end loop; end; end; end loop; exception when E : others => new_Line; put_Line ("Error in check_Client_lives task."); new_Line; put_Line (ada.Exceptions.exception_Information (E)); end check_Client_lives; procedure shutdown is all_Clients : constant Client.views := chat.Registrar.all_Clients; begin for Each of all_Clients loop begin Each.Registrar_has_shutdown; exception when system.RPC.communication_Error => null; -- Client has died. No action needed since we are shutting down. end; end loop; check_Client_lives.halt; end shutdown; procedure ping is null; end chat.Registrar;
agda-stdlib/src/Data/Word/Base.agda
DreamLinuxer/popl21-artifact
5
9372
------------------------------------------------------------------------ -- The Agda standard library -- -- Machine words: basic type and conversion functions ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Word.Base where open import Level using (zero) import Data.Nat.Base as ℕ open import Function open import Relation.Binary using (Rel) open import Relation.Binary.PropositionalEquality ------------------------------------------------------------------------ -- Re-export built-ins publicly open import Agda.Builtin.Word public using (Word64) renaming ( primWord64ToNat to toℕ ; primWord64FromNat to fromℕ ) infix 4 _≈_ _≈_ : Rel Word64 zero _≈_ = _≡_ on toℕ infix 4 _<_ _<_ : Rel Word64 zero _<_ = ℕ._<_ on toℕ
Working Disassembly/Levels/HCZ/Misc Object Data/DPLC - Miniboss Splash.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
27366
PLC_362C7E: dc.w Frame_362C90-PLC_362C7E dc.w Frame_362C94-PLC_362C7E dc.w Frame_362C98-PLC_362C7E dc.w Frame_362C9C-PLC_362C7E dc.w Frame_362CA0-PLC_362C7E dc.w Frame_362CA4-PLC_362C7E dc.w Frame_362CA8-PLC_362C7E dc.w Frame_362CAC-PLC_362C7E dc.w Frame_362CB0-PLC_362C7E Frame_362C90: dc.w 0 dc.w 5 Frame_362C94: dc.w 0 dc.w $6F Frame_362C98: dc.w 0 dc.w $16F Frame_362C9C: dc.w 0 dc.w $26F Frame_362CA0: dc.w 0 dc.w $36F Frame_362CA4: dc.w 0 dc.w $46B Frame_362CA8: dc.w 0 dc.w $527 Frame_362CAC: dc.w 0 dc.w $5A3 Frame_362CB0: dc.w 0 dc.w $5E3
source/required/s-expint.ads
ytomino/drake
33
30472
<reponame>ytomino/drake pragma License (Unrestricted); -- implementation unit required by compiler with System.Exponentiations; package System.Exp_Int is pragma Pure; -- required for "**" with checking by compiler (s-expint.ads) function Exp_Integer is new Exponentiations.Generic_Exp_Integer (Integer); end System.Exp_Int;
pkg/parser/antlr/FqlParser.g4
solrac97gr/ferret
0
1442
<gh_stars>0 // $antlr-format off <-- used by VS Code Antlr extension parser grammar FqlParser; options { tokenVocab=FqlLexer; } program : head* body ; head : useExpression ; useExpression : use ; use : Use namespaceIdentifier ; body : bodyStatement* bodyExpression ; bodyStatement : variableDeclaration | functionCallExpression | waitForExpression ; bodyExpression : returnExpression | forExpression ; variableDeclaration : Let id=(Identifier | IgnoreIdentifier) Assign expression | Let safeReservedWord Assign expression ; returnExpression : Return (Distinct)? expression ; forExpression : For valueVariable=(Identifier | IgnoreIdentifier) (Comma counterVariable=Identifier)? In forExpressionSource forExpressionBody* forExpressionReturn | For counterVariable=(Identifier | IgnoreIdentifier) Do? While expression forExpressionBody* forExpressionReturn ; forExpressionSource : functionCallExpression | arrayLiteral | objectLiteral | variable | memberExpression | rangeOperator | param ; forExpressionClause : limitClause | sortClause | filterClause | collectClause ; forExpressionStatement : variableDeclaration | functionCallExpression ; forExpressionBody : forExpressionStatement | forExpressionClause ; forExpressionReturn : returnExpression | forExpression ; filterClause : Filter expression ; limitClause : Limit limitClauseValue (Comma limitClauseValue)? ; limitClauseValue : integerLiteral | param | variable | functionCallExpression | memberExpression ; sortClause : Sort sortClauseExpression (Comma sortClauseExpression)* ; sortClauseExpression : expression SortDirection? ; collectClause : Collect collectCounter | Collect collectAggregator | Collect collectGrouping collectAggregator | Collect collectGrouping collectGroupVariable | Collect collectGrouping collectCounter | Collect collectGrouping ; collectSelector : Identifier Assign expression ; collectGrouping : collectSelector (Comma collectSelector)* ; collectAggregator : Aggregate collectAggregateSelector (Comma collectAggregateSelector)* ; collectAggregateSelector : Identifier Assign functionCallExpression ; collectGroupVariable : Into collectSelector | Into Identifier (Keep Identifier)? ; collectCounter : With Count Into Identifier ; waitForExpression : Waitfor Event waitForEventName In waitForEventSource (optionsClause)? (filterClause)? (timeoutClause)? ; waitForEventName : stringLiteral | variable | param | functionCallExpression | memberExpression ; waitForEventSource : functionCallExpression | variable | memberExpression ; optionsClause : Options objectLiteral ; timeoutClause : Timeout (integerLiteral | variable | param | memberExpression | functionCall) ; param : Param Identifier | Param safeReservedWord ; variable : Identifier | safeReservedWord ; literal : arrayLiteral | objectLiteral | booleanLiteral | stringLiteral | floatLiteral | integerLiteral | noneLiteral ; arrayLiteral : OpenBracket argumentList? CloseBracket ; objectLiteral : OpenBrace (propertyAssignment (Comma propertyAssignment)* Comma?)? CloseBrace ; booleanLiteral : BooleanLiteral ; stringLiteral : StringLiteral ; floatLiteral : FloatLiteral ; integerLiteral : IntegerLiteral ; noneLiteral : Null | None ; propertyAssignment : propertyName Colon expression | computedPropertyName Colon expression | variable ; computedPropertyName : OpenBracket expression CloseBracket ; propertyName : Identifier | stringLiteral | param | safeReservedWord | unsafeReservedWord ; namespaceIdentifier : namespace Identifier ; namespace : NamespaceSegment* ; memberExpression : memberExpressionSource memberExpressionPath+ ; memberExpressionSource : variable | param | arrayLiteral | objectLiteral | functionCall ; functionCallExpression : functionCall errorOperator? ; functionCall : namespace functionName OpenParen argumentList? CloseParen ; functionName : Identifier | safeReservedWord | unsafeReservedWord ; argumentList : expression (Comma expression)* Comma? ; memberExpressionPath : errorOperator? Dot propertyName | (errorOperator Dot)? computedPropertyName ; safeReservedWord : And | Or | Distinct | Filter | Sort | Limit | Collect | SortDirection | Into | Keep | With | Count | All | Any | Aggregate | Event | Timeout | Options | Current ; unsafeReservedWord : Return | None | Null | Let | Use | Waitfor | While | Do | In | Like | Not | For | BooleanLiteral ; rangeOperator : left=rangeOperand Range right=rangeOperand ; rangeOperand : integerLiteral | variable | param ; expression : unaryOperator right=expression | left=expression logicalAndOperator right=expression | left=expression logicalOrOperator right=expression | condition=expression ternaryOperator=QuestionMark onTrue=expression? Colon onFalse=expression | predicate ; predicate : left=predicate equalityOperator right=predicate | left=predicate arrayOperator right=predicate | left=predicate inOperator right=predicate | left=predicate likeOperator right=predicate | expressionAtom ; expressionAtom : left=expressionAtom multiplicativeOperator right=expressionAtom | left=expressionAtom additiveOperator right=expressionAtom | left=expressionAtom regexpOperator right=expressionAtom | functionCallExpression | rangeOperator | literal | variable | memberExpression | param | OpenParen (forExpression | waitForExpression | expression) CloseParen errorOperator? ; arrayOperator : operator=(All | Any | None) (inOperator | equalityOperator) ; equalityOperator : Gt | Lt | Eq | Gte | Lte | Neq ; inOperator : Not? In ; likeOperator : Not? Like ; unaryOperator : Not | Plus | Minus ; regexpOperator : RegexMatch | RegexNotMatch ; logicalAndOperator : And ; logicalOrOperator : Or ; multiplicativeOperator : Multi | Div | Mod ; additiveOperator : Plus | Minus ; errorOperator : QuestionMark ;
Sources/Globe_3d/gl/gl-materials.ads
ForYouEyesOnly/Space-Convoy
1
21975
<reponame>ForYouEyesOnly/Space-Convoy<filename>Sources/Globe_3d/gl/gl-materials.ads<gh_stars>1-10 package GL.Materials is -- Material. Doc from the VRML 1.0 spec (refers to OpenGL): -- * The ambient color reflects ambient light evenly from all parts of -- an object regardless of viewing and lighting angles. -- -- * The diffuse color reflects all VRML light sources depending on the -- angle of the surface with respect to the light source. -- The more directly the surface faces the light, the more -- diffuse light reflects. -- -- * The specular color and shininess determine the specular highlights, -- e.g., the shiny spots on an apple. When the angle from the light -- to the surface is close to the angle from the surface to the viewer, -- the specular color is added to the diffuse and ambient color -- calculations. -- Lower shininess values produce soft glows, while higher values -- result in sharper, smaller highlights. -- -- * Emissive color models "glowing" objects. This can be useful for -- displaying radiosity - based models (where the light energy of the -- room is computed explicitly), or for displaying scientific data. type Material_type is record ambient, diffuse, specular, emission : GL.Material_Float_vector; shininess : GL.C_Float; -- 0.0 .. 128.0 end record; function is_Transparent (Self : Material_type) return Boolean; neutral_material : constant Material_type := (ambient => (0.2, 0.2, 0.2, 1.0), diffuse => (0.8, 0.8, 0.8, 1.0), specular => (0.0, 0.0, 0.0, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 0.0); -- ^ the values are GL defaults. -- A few colour - dominant materials: Red : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (1.0, 0.0, 0.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Orange : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.992157, 0.513726, 0.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Yellow : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (1.0, 0.964706, 0.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Green : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.0, 1.0, 0.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Indigo : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.0980392, 0.0, 0.458824, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Blue : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.0, 0.0, 1.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Violet : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.635294, 0.0, 1.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); White : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.992157, 0.992157, 0.992157, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Black : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.0, 0.0, 0.0, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Medium_Gray : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.454902, 0.454902, 0.454902, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); Light_Gray : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.682353, 0.682353, 0.682353, 1.0), specular => (0.0225, 0.0225, 0.0225, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 12.8 ); -- A few "material" materials: Glass : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.588235, 0.670588, 0.729412, 1.0), specular => (0.9, 0.9, 0.9, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 96.0 ); Brass : constant Material_type := ( ambient => (0.329412, 0.223529, 0.027451, 1.0), diffuse => (0.780392, 0.568627, 0.113725, 1.0), specular => (0.992157, 0.941176, 0.807843, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 27.8974); Bronze : constant Material_type := ( ambient => (0.2125, 0.1275, 0.054, 1.0), diffuse => (0.714, 0.4284, 0.18144, 1.0), specular => (0.393548, 0.271906, 0.166721, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 25.6); Polished_Bronze : constant Material_type := ( ambient => (0.25, 0.148, 0.06475, 1.0), diffuse => (0.4, 0.2368, 0.1036, 1.0), specular => (0.774597, 0.458561, 0.200621, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 76.8); Chrome : constant Material_type := ( ambient => (0.25, 0.25, 0.25, 1.0), diffuse => (0.4, 0.4, 0.4, 1.0), specular => (0.774597, 0.774597, 0.774597, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 76.8); Copper : constant Material_type := ( ambient => (0.19125, 0.0735, 0.0225, 1.0), diffuse => (0.7038, 0.27048, 0.0828, 1.0), specular => (0.256777, 0.137622, 0.086014, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 12.8); Polished_Copper : constant Material_type := ( ambient => (0.2295, 0.08825, 0.0275, 1.0), diffuse => (0.5508, 0.2118, 0.066, 1.0), specular => (0.580594, 0.223257, 0.0695701, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 51.2); Gold : constant Material_type := ( ambient => (0.24725, 0.1995, 0.0745, 1.0), diffuse => (0.75164, 0.60648, 0.22648, 1.0), specular => (0.628281, 0.555802, 0.366065, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 51.2); Polished_Gold : constant Material_type := ( ambient => (0.24725, 0.2245, 0.0645, 1.0), diffuse => (0.34615, 0.3143, 0.0903, 1.0), specular => (0.797357, 0.723991, 0.208006, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 83.2); Pewter : constant Material_type := ( ambient => (0.105882, 0.058824, 0.113725, 1.0), diffuse => (0.427451, 0.470588, 0.541176, 1.0), specular => (0.333333, 0.333333, 0.521569, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 9.84615); Silver : constant Material_type := ( ambient => (0.19225, 0.19225, 0.19225, 1.0), diffuse => (0.50754, 0.50754, 0.50754, 1.0), specular => (0.508273, 0.508273, 0.508273, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 51.2); Polished_Silver : constant Material_type := ( ambient => (0.23125, 0.23125, 0.23125, 1.0), diffuse => (0.2775, 0.2775, 0.2775, 1.0), specular => (0.773911, 0.773911, 0.773911, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 89.6); Emerald : constant Material_type := ( ambient => (0.0215, 0.1745, 0.0215, 0.55), diffuse => (0.07568, 0.61424, 0.07568, 0.55), specular => (0.633, 0.727811, 0.633, 0.55), emission => (0.0, 0.0, 0.0, 0.0), shininess => 76.8); Jade : constant Material_type := ( ambient => (0.135, 0.2225, 0.1575, 0.95), diffuse => (0.54, 0.89, 0.63, 0.95), specular => (0.316228, 0.316228, 0.316228, 0.95), emission => (0.0, 0.0, 0.0, 0.0), shininess => 12.8); Obsidian : constant Material_type := ( ambient => (0.05375, 0.05, 0.06625, 0.82), diffuse => (0.18275, 0.17, 0.22525, 0.82), specular => (0.332741, 0.328634, 0.346435, 0.82), emission => (0.0, 0.0, 0.0, 0.0), shininess => 38.4); Pearl : constant Material_type := ( ambient => (0.25, 0.20725, 0.20725, 0.922), diffuse => (1.0, 0.829, 0.829, 0.922), specular => (0.296648, 0.296648, 0.296648, 0.922), emission => (0.0, 0.0, 0.0, 0.0), shininess => 11.264); Ruby : constant Material_type := ( ambient => (0.1745, 0.01175, 0.01175, 0.55), diffuse => (0.61424, 0.04136, 0.04136, 0.55), specular => (0.727811, 0.626959, 0.626959, 0.55), emission => (0.0, 0.0, 0.0, 0.0), shininess => 76.8); Turquoise : constant Material_type := ( ambient => (0.1, 0.18725, 0.1745, 0.8), diffuse => (0.396, 0.74151, 0.69102, 0.8), specular => (0.297254, 0.30829, 0.306678, 0.8), emission => (0.0, 0.0, 0.0, 0.0), shininess => 12.8); Black_Plastic : constant Material_type := ( ambient => (0.0, 0.0, 0.0, 1.0), diffuse => (0.01, 0.01, 0.01, 1.0), specular => (0.50, 0.50, 0.50, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 32.0); Black_Rubber : constant Material_type := ( ambient => (0.02, 0.02, 0.02, 1.0), diffuse => (0.01, 0.01, 0.01, 1.0), specular => (0.4, 0.4, 0.4, 1.0), emission => (0.0, 0.0, 0.0, 0.0), shininess => 10.0); VRML_Defaults : constant Material_type := ( ambient => (0.2, 0.2, 0.2, 1.0), diffuse => (0.8, 0.8, 0.8, 1.0), specular => (0.0, 0.0, 0.0, 1.0), emission => (0.0, 0.0, 0.0, 1.0), shininess => 25.6); end GL.Materials;
programs/oeis/065/A065164.asm
neoneye/loda
22
13143
; A065164: Permutation t->t+1 of Z, folded to N. ; 2,4,1,6,3,8,5,10,7,12,9,14,11,16,13,18,15,20,17,22,19,24,21,26,23,28,25,30,27,32,29,34,31,36,33,38,35,40,37,42,39,44,41,46,43,48,45,50,47,52,49,54,51,56,53,58,55,60,57,62,59,64,61,66,63,68,65,70,67,72,69,74 add $0,1 lpb $0 sub $0,1 mul $0,2 lpe seq $0,165754 ; a(n) = nimsum(n+(n+1)+(n+2)). sub $0,1
oeis/095/A095228.asm
neoneye/loda-programs
11
172385
; A095228: n-th decimal digit of 1/n!. ; Submitted by <NAME> ; 0,0,0,6,6,3,8,4,0,5,5,5,7,5,7,4,7,1,6,2,1,9,8,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $5,$0 cmp $5,0 add $0,$5 mov $4,10 pow $4,$0 lpb $3,9 div $4,$0 sub $0,1 trn $3,7 lpe mov $0,$4 mod $0,10
test/asset/agda-stdlib-1.0/Data/Fin/Permutation.agda
omega12345/agda-mode
0
3079
<filename>test/asset/agda-stdlib-1.0/Data/Fin/Permutation.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Bijections on finite sets (i.e. permutations). ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Fin.Permutation where open import Data.Empty using (⊥-elim) open import Data.Fin open import Data.Fin.Properties import Data.Fin.Permutation.Components as PC open import Data.Nat using (ℕ; suc; zero) open import Data.Product using (proj₂) open import Function.Inverse as Inverse using (_↔_; Inverse; _InverseOf_) open import Function.Equality using (_⟨$⟩_) open import Function using (_∘_) open import Relation.Nullary using (¬_; yes; no) open import Relation.Nullary.Negation using (contradiction) open import Relation.Binary.PropositionalEquality as P using (_≡_; _≢_; refl; trans; sym; →-to-⟶; cong; cong₂) open P.≡-Reasoning ------------------------------------------------------------------------ -- Types -- A bijection between finite sets of potentially different sizes. -- There only exist inhabitants of this type if in fact m = n, however -- it is often easier to prove the existence of a bijection without -- first proving that the sets have the same size. Indeed such a -- bijection is a useful way to prove that the sets are in fact the same -- size. See '↔-≡' below. Permutation : ℕ → ℕ → Set Permutation m n = Fin m ↔ Fin n Permutation′ : ℕ → Set Permutation′ n = Permutation n n ------------------------------------------------------------------------ -- Helper functions permutation : ∀ {m n} (f : Fin m → Fin n) (g : Fin n → Fin m) → (→-to-⟶ g) InverseOf (→-to-⟶ f) → Permutation m n permutation f g inv = record { to = →-to-⟶ f ; from = →-to-⟶ g ; inverse-of = inv } _⟨$⟩ʳ_ : ∀ {m n} → Permutation m n → Fin m → Fin n _⟨$⟩ʳ_ = _⟨$⟩_ ∘ Inverse.to _⟨$⟩ˡ_ : ∀ {m n} → Permutation m n → Fin n → Fin m _⟨$⟩ˡ_ = _⟨$⟩_ ∘ Inverse.from inverseˡ : ∀ {m n} (π : Permutation m n) {i} → π ⟨$⟩ˡ (π ⟨$⟩ʳ i) ≡ i inverseˡ π = Inverse.left-inverse-of π _ inverseʳ : ∀ {m n} (π : Permutation m n) {i} → π ⟨$⟩ʳ (π ⟨$⟩ˡ i) ≡ i inverseʳ π = Inverse.right-inverse-of π _ ------------------------------------------------------------------------ -- Example permutations -- Identity id : ∀ {n} → Permutation′ n id = Inverse.id -- Transpose two indices transpose : ∀ {n} → Fin n → Fin n → Permutation′ n transpose i j = permutation (PC.transpose i j) (PC.transpose j i) record { left-inverse-of = λ _ → PC.transpose-inverse _ _ ; right-inverse-of = λ _ → PC.transpose-inverse _ _ } -- Reverse the order of indices reverse : ∀ {n} → Permutation′ n reverse = permutation PC.reverse PC.reverse record { left-inverse-of = PC.reverse-involutive ; right-inverse-of = PC.reverse-involutive } ------------------------------------------------------------------------ -- Operations -- Composition _∘ₚ_ : ∀ {m n o} → Permutation m n → Permutation n o → Permutation m o π₁ ∘ₚ π₂ = π₂ Inverse.∘ π₁ -- Flip flip : ∀ {m n} → Permutation m n → Permutation n m flip = Inverse.sym -- Element removal -- -- `remove k [0 ↦ i₀, …, k ↦ iₖ, …, n ↦ iₙ]` yields -- -- [0 ↦ i₀, …, k-1 ↦ iₖ₋₁, k ↦ iₖ₊₁, k+1 ↦ iₖ₊₂, …, n-1 ↦ iₙ] remove : ∀ {m n} → Fin (suc m) → Permutation (suc m) (suc n) → Permutation m n remove {m} {n} i π = permutation to from record { left-inverse-of = left-inverse-of ; right-inverse-of = right-inverse-of } where πʳ = π ⟨$⟩ʳ_ πˡ = π ⟨$⟩ˡ_ permute-≢ : ∀ {i j} → i ≢ j → πʳ i ≢ πʳ j permute-≢ p = p ∘ (Inverse.injective π) to-punchOut : ∀ {j : Fin m} → πʳ i ≢ πʳ (punchIn i j) to-punchOut = permute-≢ (punchInᵢ≢i _ _ ∘ sym) from-punchOut : ∀ {j : Fin n} → i ≢ πˡ (punchIn (πʳ i) j) from-punchOut {j} p = punchInᵢ≢i (πʳ i) j (sym (begin πʳ i ≡⟨ cong πʳ p ⟩ πʳ (πˡ (punchIn (πʳ i) j)) ≡⟨ inverseʳ π ⟩ punchIn (πʳ i) j ∎)) to : Fin m → Fin n to j = punchOut (to-punchOut {j}) from : Fin n → Fin m from j = punchOut {j = πˡ (punchIn (πʳ i) j)} from-punchOut left-inverse-of : ∀ j → from (to j) ≡ j left-inverse-of j = begin from (to j) ≡⟨⟩ punchOut {i = i} {πˡ (punchIn (πʳ i) (punchOut to-punchOut))} _ ≡⟨ punchOut-cong′ i (cong πˡ (punchIn-punchOut {i = πʳ i} _)) ⟩ punchOut {i = i} {πˡ (πʳ (punchIn i j))} _ ≡⟨ punchOut-cong i (inverseˡ π) ⟩ punchOut {i = i} {punchIn i j} _ ≡⟨ punchOut-punchIn i ⟩ j ∎ right-inverse-of : ∀ j → to (from j) ≡ j right-inverse-of j = begin to (from j) ≡⟨⟩ punchOut {i = πʳ i} {πʳ (punchIn i (punchOut from-punchOut))} _ ≡⟨ punchOut-cong′ (πʳ i) (cong πʳ (punchIn-punchOut {i = i} _)) ⟩ punchOut {i = πʳ i} {πʳ (πˡ (punchIn (πʳ i) j))} _ ≡⟨ punchOut-cong (πʳ i) (inverseʳ π) ⟩ punchOut {i = πʳ i} {punchIn (πʳ i) j} _ ≡⟨ punchOut-punchIn (πʳ i) ⟩ j ∎ ------------------------------------------------------------------------ -- Other properties module _ {m n} (π : Permutation (suc m) (suc n)) where private πʳ = π ⟨$⟩ʳ_ πˡ = π ⟨$⟩ˡ_ punchIn-permute : ∀ i j → πʳ (punchIn i j) ≡ punchIn (πʳ i) (remove i π ⟨$⟩ʳ j) punchIn-permute i j = begin πʳ (punchIn i j) ≡⟨ sym (punchIn-punchOut {i = πʳ i} _) ⟩ punchIn (πʳ i) (punchOut {i = πʳ i} {πʳ (punchIn i j)} _) ≡⟨⟩ punchIn (πʳ i) (remove i π ⟨$⟩ʳ j) ∎ punchIn-permute′ : ∀ i j → πʳ (punchIn (πˡ i) j) ≡ punchIn i (remove (πˡ i) π ⟨$⟩ʳ j) punchIn-permute′ i j = begin πʳ (punchIn (πˡ i) j) ≡⟨ punchIn-permute _ _ ⟩ punchIn (πʳ (πˡ i)) (remove (πˡ i) π ⟨$⟩ʳ j) ≡⟨ cong₂ punchIn (inverseʳ π) refl ⟩ punchIn i (remove (πˡ i) π ⟨$⟩ʳ j) ∎ ↔⇒≡ : ∀ {m n} → Permutation m n → m ≡ n ↔⇒≡ {zero} {zero} π = refl ↔⇒≡ {zero} {suc n} π = contradiction (π ⟨$⟩ˡ zero) ¬Fin0 ↔⇒≡ {suc m} {zero} π = contradiction (π ⟨$⟩ʳ zero) ¬Fin0 ↔⇒≡ {suc m} {suc n} π = cong suc (↔⇒≡ (remove zero π)) fromPermutation : ∀ {m n} → Permutation m n → Permutation′ m fromPermutation π = P.subst (Permutation _) (sym (↔⇒≡ π)) π refute : ∀ {m n} → m ≢ n → ¬ Permutation m n refute m≢n π = contradiction (↔⇒≡ π) m≢n
theorems/cw/cohomology/HigherCohomologyGroupsOnDiag.agda
mikeshulman/HoTT-Agda
0
9524
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory open import groups.ExactSequence open import groups.Exactness open import groups.HomSequence open import groups.KernelImageUniqueFactorization import cw.cohomology.GridPtdMap as GPM open import cw.CW module cw.cohomology.HigherCohomologyGroupsOnDiag {i} (OT : OrdinaryTheory i) {n} (⊙skel : ⊙Skeleton {i} (S (S n))) (ac : ⊙has-cells-with-choice 0 ⊙skel i) where private n≤SSn : n ≤ S (S n) n≤SSn = lteSR lteS ⊙skel₋₁ = ⊙cw-init ⊙skel ac₋₁ = ⊙init-has-cells-with-choice ⊙skel ac ⊙skel₋₂ = ⊙cw-take n≤SSn ⊙skel ac₋₂ = ⊙take-has-cells-with-choice n≤SSn ⊙skel ac open OrdinaryTheory OT open import cw.cohomology.Descending OT open import cw.cohomology.WedgeOfCells OT open import cw.cohomology.HigherCoboundary OT ⊙skel open import cw.cohomology.HigherCoboundaryGrid OT ⊙skel ac {- Coker ≃ C(X₂/X₀) ≃ C(X) ^ | | C(X₁/X₀) WoC WoC := Wedges of Cells -} private C-apex : Group i C-apex = C (ℕ-to-ℤ (S (S n))) (⊙Cofiber (⊙cw-incl-tail n≤SSn ⊙skel)) open import cohomology.LongExactSequence cohomology-theory (ℕ-to-ℤ (S n)) (⊙cw-incl-tail n≤SSn ⊙skel) C-apex-iso-C-cw : C-apex ≃ᴳ C (ℕ-to-ℤ (S (S n))) ⊙⟦ ⊙skel ⟧ C-apex-iso-C-cw = Exact2.G-trivial-and-L-trivial-implies-H-iso-K (exact-seq-index 1 C-cofiber-exact-seq) (exact-seq-index 2 C-cofiber-exact-seq) (C-cw-at-higher ⊙skel₋₂ ltS ac₋₂) (C-cw-at-higher ⊙skel₋₂ (ltSR ltS) ac₋₂) open import groups.KernelImage (cst-hom {H = Lift-group {j = i} Unit-group}) cw-co∂-last (CXₙ/Xₙ₋₁-is-abelian ⊙skel (ℕ-to-ℤ (S (S n)))) open import groups.KernelCstImage (Lift-group {j = i} Unit-group) cw-co∂-last (CXₙ/Xₙ₋₁-is-abelian ⊙skel (ℕ-to-ℤ (S (S n)))) C-cw-iso-ker/im : C (ℕ-to-ℤ (S (S n))) ⊙⟦ ⊙skel ⟧ ≃ᴳ Ker/Im C-cw-iso-ker/im = (C-apex-iso-C-cw ∘eᴳ Coker-cw-co∂-last ∘eᴳ Ker-cst-quot-Im) ⁻¹ᴳ
src/dnscatcher/dns/processor/rdata/dnscatcher-dns-processor-rdata-soa_parser.ads
DNSCatcher/DNSCatcher
4
30002
-- Copyright 2019 <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. with DNSCatcher.DNS.Processor.Packet; use DNSCatcher.DNS.Processor.Packet; -- @description -- -- RData processor for SOA records -- -- @summary -- -- SOA records are Start of Authority records; they specify the authoritive -- information for a given zone. They contain the primary nameserver for a -- zone, a responsible contact, and caching information related to a zone, -- and most importantly, the zone serial number. -- -- An SOA record will exist for every given zone, and is a fundamental part of -- the DNS record system. -- package DNSCatcher.DNS.Processor.RData.SOA_Parser is -- Parsed SOA Data -- -- @value Primary_Nameserver -- Contains the primary nameserver for the zone -- -- @value Responsible_Contact -- The contact information (usually an email) for the zone -- -- @value Serial -- The serial number of a given zone. Must be incremented every time a zone -- is updated, and used with NOTIFY operations as well. Serial numbers are -- *NOT* simple integer additions, but instead use serial number arithmetic -- to handle cases such as wraparound. -- -- @value Refresh -- A caching nameserver should refresh the SOA for a given zone every X -- seconds. If the SOA serial is unchanged, data can remained cached. -- -- @value Retry -- If the authoritive server(s) for a given zone are not responding, this -- is the interval that should be used to retry operations. It must be less -- than the Refresh value -- -- @value Expire -- This is the period of time a zone can be cached before it is deleted if -- there is no response from the authoritive nameservers -- -- @value Minimum -- The minimum time/TTL for negative caching. -- type Parsed_SOA_RData is new DNSCatcher.DNS.Processor.RData .Parsed_RData with record Primary_Nameserver : Unbounded_String; Responsible_Contact : Unbounded_String; Serial : Unsigned_32; Refresh : Unsigned_32; Retry : Unsigned_32; Expire : Unsigned_32; Minimum : Unsigned_32; end record; type Parsed_SOA_RData_Access is access all Parsed_SOA_RData; -- Converts a RR record to logicial representation -- -- @value This -- Class object -- -- @value DNS_Header -- DNS Packet Header -- -- @value Parsed_RR -- SOA parsed Resource Record from Processor.Packet -- procedure From_Parsed_RR (This : in out Parsed_SOA_RData; DNS_Header : DNS_Packet_Header; Parsed_RR : Parsed_DNS_Resource_Record); -- Represents RData as a String for debug logging -- -- @value This -- Class object -- -- @returns -- String representing the status of EDNS information -- function RData_To_String (This : in Parsed_SOA_RData) return String; -- Represents the resource record packet as a whole as a string -- -- @value This -- Class object -- -- @returns -- String in the format of "SOA *soa info* -- function Print_Packet (This : in Parsed_SOA_RData) return String; -- Frees and deallocates the class object -- -- @value This -- Class object to deallocate -- procedure Delete (This : in out Parsed_SOA_RData); end DNSCatcher.DNS.Processor.RData.SOA_Parser;
src/gl/implementation/gl.adb
Roldak/OpenGLAda
79
18571
<filename>src/gl/implementation/gl.adb -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with GL.API; with GL.Load_Function_Pointers; package body GL is procedure Init renames GL.Load_Function_Pointers; procedure Flush is begin API.Flush; end Flush; procedure Finish is begin API.Finish; end Finish; -- implementation depends on whether Auto_Exceptions has been enabled. procedure Raise_Exception_On_OpenGL_Error is separate; end GL;
zMIPS/mips2.asm
MattPhilpot/RandomHomework
0
23797
#Program 1 - Takes a string and reverses the string # # # Cosc 300 .data prompt: .asciiz " Given String is = " str: .asciiz " aaaaBBBBccccDDDD " ans: .asciiz " The String reversed is= " .text .globl main main: la $a0, prompt li $v0, 4 syscall la $a0, str li $v0, 4 syscall la $a0, ans li $v0, 4 syscall la $t1, str li $t2, 0 Loop: lb $t0, 0($t1) beqz $t0, next addi $sp, $sp, -4 sw $t0, 0($sp) j Loop next: lw $t0, 0($sp) beqz $t0, End addi $sp, $sp, 4 li $v0, 4 move $a0, $t0 syscall j next End: li $v0, 10 syscall
programs/oeis/158/A158637.asm
karttu/loda
1
7194
; A158637: a(n) = 576*n^2 + 24. ; 24,600,2328,5208,9240,14424,20760,28248,36888,46680,57624,69720,82968,97368,112920,129624,147480,166488,186648,207960,230424,254040,278808,304728,331800,360024,389400,419928,451608,484440,518424,553560,589848,627288,665880,705624,746520,788568,831768,876120,921624,968280,1016088,1065048,1115160,1166424,1218840,1272408,1327128,1383000,1440024,1498200,1557528,1618008,1679640,1742424,1806360,1871448,1937688,2005080,2073624,2143320,2214168,2286168,2359320,2433624,2509080,2585688,2663448,2742360,2822424,2903640,2986008,3069528,3154200,3240024,3327000,3415128,3504408,3594840,3686424,3779160,3873048,3968088,4064280,4161624,4260120,4359768,4460568,4562520,4665624,4769880,4875288,4981848,5089560,5198424,5308440,5419608,5531928,5645400,5760024,5875800,5992728,6110808,6230040,6350424,6471960,6594648,6718488,6843480,6969624,7096920,7225368,7354968,7485720,7617624,7750680,7884888,8020248,8156760,8294424,8433240,8573208,8714328,8856600,9000024,9144600,9290328,9437208,9585240,9734424,9884760,10036248,10188888,10342680,10497624,10653720,10810968,10969368,11128920,11289624,11451480,11614488,11778648,11943960,12110424,12278040,12446808,12616728,12787800,12960024,13133400,13307928,13483608,13660440,13838424,14017560,14197848,14379288,14561880,14745624,14930520,15116568,15303768,15492120,15681624,15872280,16064088,16257048,16451160,16646424,16842840,17040408,17239128,17439000,17640024,17842200,18045528,18250008,18455640,18662424,18870360,19079448,19289688,19501080,19713624,19927320,20142168,20358168,20575320,20793624,21013080,21233688,21455448,21678360,21902424,22127640,22354008,22581528,22810200,23040024,23271000,23503128,23736408,23970840,24206424,24443160,24681048,24920088,25160280,25401624,25644120,25887768,26132568,26378520,26625624,26873880,27123288,27373848,27625560,27878424,28132440,28387608,28643928,28901400,29160024,29419800,29680728,29942808,30206040,30470424,30735960,31002648,31270488,31539480,31809624,32080920,32353368,32626968,32901720,33177624,33454680,33732888,34012248,34292760,34574424,34857240,35141208,35426328,35712600 mov $1,$0 mul $1,24 pow $1,2 add $1,24
oeis/303/A303260.asm
neoneye/loda-programs
11
103111
; A303260: Determinant of n X n matrix A[i,j] = (j - i - 1 mod n) + [i=j], i.e., the circulant having (n, 0, 1, ..., n-2) as first row. ; Submitted by <NAME> ; 1,1,4,28,273,3421,52288,941578,19505545,456790123,11931215316,343871642632,10840081272265,371026432467913,13702802011918048,543154131059225686,23000016472483168305,1036227971225610466711,49492629462587441963140,2497992686980609418282548,132849300060919364474261281 lpb $0 sub $0,1 add $2,$3 add $3,1 mov $1,$3 mul $1,$0 add $2,$1 mov $1,2 add $4,1 mul $1,$4 sub $2,1 mul $3,$4 add $3,$2 mov $2,$1 lpe mov $0,$3 div $0,2 add $0,1
savefile/maps/0210_NorthernPassage.asm
stranck/fools2018-1
35
2699
SECTION "Map_0210", ROM0[$B800] Map_0210_Header: hdr_tileset 0 hdr_dimensions 9, 16 hdr_pointers_a Map_0210_Blocks, Map_0210_TextPointers hdr_pointers_b Map_0210_Script, Map_0210_Objects hdr_pointers_c Map_0210_InitScript, Map_0210_RAMScript hdr_palette $06 hdr_music MUSIC_ROUTES3, AUDIO_1 hdr_connection NORTH, $0523, 7, 16 hdr_connection SOUTH, $0110, 10, 1 hdr_connection WEST, $0327, 14, 8 hdr_connection EAST, $2E2B, 1, 5 Map_0210_Objects: hdr_border $0f hdr_warp_count 0 hdr_sign_count 0 hdr_object_count 2 hdr_object SPRITE_GIRL, 6, 24, STAY, NONE, $01 hdr_object SPRITE_GENTLEMAN, 9, 12, WALK, LEFT_RIGHT, $02 Map_0210_RAMScript: rs_write_3 $c6fc, $0a, $31, $0a rs_write_3 $c70b, $0a, $31, $0a rs_write_3 $c76f, $0a, $0a, $0a rs_write_3 $c77e, $31, $31, $31 rs_write_3 $c78d, $0a, $0a, $0a rs_write_2 $c80a, $55, $55 rs_write_2 $c819, $55, $55 rs_end Map_0210_Blocks: db $0f,$0f,$0a,$31,$0a,$0f,$0f,$0f,$0f db $0f,$0f,$0a,$31,$31,$31,$0f,$0f,$0f db $0f,$0f,$0a,$0a,$74,$31,$0f,$0f,$0f db $0f,$0f,$0f,$0a,$0a,$31,$0a,$0f,$0f db $0f,$0f,$0f,$07,$07,$5c,$07,$07,$0f db $0f,$0f,$0b,$0b,$0a,$31,$0a,$0b,$0f db $0a,$0a,$0a,$74,$0a,$31,$0a,$0b,$0f db $31,$31,$31,$31,$31,$31,$0a,$0b,$0f db $0a,$74,$0a,$0a,$0a,$74,$0a,$0b,$0f db $0f,$07,$07,$2f,$07,$07,$0f,$0b,$0f db $0f,$0b,$7a,$7a,$7a,$0b,$0f,$0f,$0f db $0f,$0b,$7a,$7a,$0a,$0f,$0f,$0f,$0f db $0f,$0b,$7a,$0a,$74,$0f,$0f,$0f,$0f db $0f,$0f,$55,$0a,$74,$0f,$3e,$3f,$3f db $0f,$0f,$55,$55,$0f,$0f,$28,$2c,$2c db $0f,$0f,$55,$55,$0f,$0f,$28,$2c,$2c Map_0210_TextPointers: dw Map_0210_TX1 dw Map_0210_TX2 Map_0210_InitScript: ret Map_0210_Script: ld a, [$c218] and $07 ld [$c218], a ret Map_0210_TX1: db 8 jp EnhancedTextOnly text "Hi!" next "I'm practicing spinning." para "My hobby is to make every" next "speedrunner cry when I" cont "notice them with my sick" cont "moves." para "If werster ever comes back" next "to Gen I Glitchless, I'll" cont "be there to crush his hopes" cont "and dreams!" done Map_0210_TX2: db 8 jp EnhancedTextOnly text "I would normally tell you" next "to stay out from tall grass," cont "but here's the thing..." para "In Glitchland, we don't have" next "any wild encounters." para "It's really kind of" next "disappointing..." done
alloy4fun_models/trashltl/models/11/rFL2nXx2oR5FjPh2n.als
Kaixi26/org.alloytools.alloy
0
3458
<filename>alloy4fun_models/trashltl/models/11/rFL2nXx2oR5FjPh2n.als open main pred idrFL2nXx2oR5FjPh2n_prop12 { all f : File | f not in Trash until (eventually f in Trash => eventually f not in Trash) } pred __repair { idrFL2nXx2oR5FjPh2n_prop12 } check __repair { idrFL2nXx2oR5FjPh2n_prop12 <=> prop12o }
source/amf/uml/amf-visitors-umldi_iterators.ads
svn2github/matreshka
24
30906
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.UMLDI.UML_Activity_Diagrams; with AMF.UMLDI.UML_Association_End_Labels; with AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes; with AMF.UMLDI.UML_Class_Diagrams; with AMF.UMLDI.UML_Classifier_Shapes; with AMF.UMLDI.UML_Compartmentable_Shapes; with AMF.UMLDI.UML_Compartments; with AMF.UMLDI.UML_Component_Diagrams; with AMF.UMLDI.UML_Composite_Structure_Diagrams; with AMF.UMLDI.UML_Deployment_Diagrams; with AMF.UMLDI.UML_Edges; with AMF.UMLDI.UML_Interaction_Diagrams; with AMF.UMLDI.UML_Interaction_Table_Labels; with AMF.UMLDI.UML_Keyword_Labels; with AMF.UMLDI.UML_Labels; with AMF.UMLDI.UML_Multiplicity_Labels; with AMF.UMLDI.UML_Name_Labels; with AMF.UMLDI.UML_Object_Diagrams; with AMF.UMLDI.UML_Package_Diagrams; with AMF.UMLDI.UML_Profile_Diagrams; with AMF.UMLDI.UML_Redefines_Labels; with AMF.UMLDI.UML_Shapes; with AMF.UMLDI.UML_State_Machine_Diagrams; with AMF.UMLDI.UML_State_Shapes; with AMF.UMLDI.UML_Stereotype_Property_Value_Labels; with AMF.UMLDI.UML_Styles; with AMF.UMLDI.UML_Typed_Element_Labels; with AMF.UMLDI.UML_Use_Case_Diagrams; package AMF.Visitors.UMLDI_Iterators is pragma Preelaborate; type UMLDI_Iterator is limited interface and AMF.Visitors.Abstract_Iterator; not overriding procedure Visit_UML_Activity_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Activity_Diagrams.UMLDI_UML_Activity_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Association_End_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Association_End_Labels.UMLDI_UML_Association_End_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Association_Or_Connector_Or_Link_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes.UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Class_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Class_Diagrams.UMLDI_UML_Class_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Classifier_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Classifier_Shapes.UMLDI_UML_Classifier_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Compartment (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Compartmentable_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Compartmentable_Shapes.UMLDI_UML_Compartmentable_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Component_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Component_Diagrams.UMLDI_UML_Component_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Composite_Structure_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Deployment_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Deployment_Diagrams.UMLDI_UML_Deployment_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Edge (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Interaction_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Interaction_Diagrams.UMLDI_UML_Interaction_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Interaction_Table_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Interaction_Table_Labels.UMLDI_UML_Interaction_Table_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Keyword_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Keyword_Labels.UMLDI_UML_Keyword_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Multiplicity_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Multiplicity_Labels.UMLDI_UML_Multiplicity_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Name_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Name_Labels.UMLDI_UML_Name_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Object_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Object_Diagrams.UMLDI_UML_Object_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Package_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Profile_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Profile_Diagrams.UMLDI_UML_Profile_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Redefines_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Redefines_Labels.UMLDI_UML_Redefines_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_State_Machine_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_State_Machine_Diagrams.UMLDI_UML_State_Machine_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_State_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_State_Shapes.UMLDI_UML_State_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Stereotype_Property_Value_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Stereotype_Property_Value_Labels.UMLDI_UML_Stereotype_Property_Value_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Style (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Typed_Element_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Typed_Element_Labels.UMLDI_UML_Typed_Element_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Use_Case_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Use_Case_Diagrams.UMLDI_UML_Use_Case_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; end AMF.Visitors.UMLDI_Iterators;
oeis/344/A344236.asm
neoneye/loda-programs
11
4709
<filename>oeis/344/A344236.asm ; A344236: Number of n-step walks from a universal vertex to the other on the diamond graph. ; Submitted by <NAME>(s3) ; 0,1,2,5,14,33,90,221,582,1465,3794,9653,24830,63441,162762,416525,1067574,2733673,7003970,17938661,45954542,117709185,301527354,772364093,1978473510,5067929881,12981823922,33253543445,85180839134,218195012913,558918369450 mov $1,$0 sub $0,1 gcd $0,2 seq $1,193649 ; Q-residue of the (n+1)st Fibonacci polynomial, where Q is the triangular array (t(i,j)) given by t(i,j)=1. (See Comments.) add $0,$1 sub $0,2
oeis/131/A131898.asm
neoneye/loda-programs
11
172047
; A131898: a(n) = 2^(n+1) + 2*n - 1. ; 1,5,11,21,39,73,139,269,527,1041,2067,4117,8215,16409,32795,65565,131103,262177,524323,1048613,2097191,4194345,8388651,16777261,33554479,67108913,134217779,268435509,536870967,1073741881,2147483707,4294967357,8589934655,17179869249,34359738435,68719476805,137438953543,274877907017,549755813963,1099511627853,2199023255631,4398046511185,8796093022291,17592186044501,35184372088919,70368744177753,140737488355419,281474976710749,562949953421407,1125899906842721,2251799813685347,4503599627370597 mov $1,2 pow $1,$0 add $1,$0 sub $1,1 mul $1,2 add $1,1 mov $0,$1
x86/linux/sendfile/sendfile.asm
fbaligant/shellcodes
3
175961
BITS 32 GLOBAL _start _start: jmp short get_eip run: xor eax, eax inc eax inc eax inc eax inc eax mov edi, eax xor edx, edx ; fd = sys_open(filename, 0, 0) mov eax, edi inc eax ; sys_open pop ebx ; filename xor ecx, ecx ; flags = 0 xor edx, edx ; mode = 0 int 0x80 ; sendfile(int out_fd, int in_fd, off_t *offset, size_t count) mov ecx, eax ; in_fd xor eax, eax mov al, 0xbb ; sendfile() syscall mov ebx, edi ; out_fd xor edx, edx ; offset = 0 mov esi, edi shl esi, 8 ; size (4 << 8 = 1024) int 0x80 ; sys_exit(0) xor eax, eax mov al, 1 ;exit the shellcode xor ebx,ebx int 0x80 get_eip: call run ; put address of our message onto the stack filename: db 'key', 0x0
programs/oeis/117/A117643.asm
karttu/loda
0
240573
; A117643: a(n) = n*(a(n-1)-1) starting with a(0)=3. ; 3,2,2,3,8,35,204,1421,11360,102231,1022300,11245289,134943456,1754264915,24559708796,368395631925,5894330110784,100203611883311,1803665013899580,34269635264092001 mov $1,3 mov $2,$0 lpb $2,1 sub $2,1 add $3,1 mul $1,$3 sub $1,$3 lpe
oeis/073/A073728.asm
neoneye/loda-programs
11
90824
; A073728: a(n) = Sum_{k=0..n} S(k), where S(n) are the tribonacci generalized numbers A001644. ; Submitted by <NAME>(s3) ; 3,4,7,14,25,46,85,156,287,528,971,1786,3285,6042,11113,20440,37595,69148,127183,233926,430257,791366,1455549,2677172,4924087,9056808,16658067,30638962,56353837,103650866,190643665,350648368,644942899,1186234932,2181826199,4013004030,7381065161,13575895390,24969964581,45926925132,84472785103,155369674816,285769385051,525611844970,966750904837,1778132134858,3270494884665,6015377924360,11064004943883,20349877752908,37429260621151,68843143317942,126622281692001,232894685631094,428360110641037 mov $1,3 lpb $0 sub $0,1 add $3,$1 add $1,$2 sub $1,$3 add $2,$3 add $2,3 add $3,$1 lpe mul $3,2 add $3,$1 mov $0,$3 div $0,3 add $0,2
Assignment2/MP.g4
jimodayne/ppl_hcmut_assignment
1
5505
/* - Student name: <NAME> - Student ID: 1652578 */ grammar MP; @lexer::header { from lexererr import * } options{ language=Python3; } boollit: TRUE|FALSE; program : declaration+ EOF ; declaration : functionDeclaration | varDeclaration | procedureDeclaration ; varDeclaration: VAR varDeclarationList+ ; varDeclarationList : identifierList COL primitiveType SEMI | identifierList COL ARRAY arrDeclaration SEMI ; functionDeclaration : FUNCTION funcName LB parameterList? RB COL returnType SEMI varDeclaration? compoundStatement ; procedureDeclaration : PROCEDURE procedureName LB parameterList? RB SEMI varDeclaration? compoundStatement ; funcName : identifier ; procedureName : identifier ; parameterList : parameterDeclaration (SEMI parameterDeclaration)* ; parameterDeclaration : identifierList COL returnType ; returnType : primitiveType | reComponentType ; reComponentType : ARRAY arrDeclaration ; componentType : ARRAY ; primitiveType : INTEGER | REAL | BOOLEAN | STRING ; identifierList : identifier (COM identifier)* ; arrDeclaration : LSB upArrSign? INTLIT DOD downArrSign? INTLIT RSB OF primitiveType ; upArrSign : SUBT ; downArrSign : SUBT ; string : STRINGLIT ; identifier : IDENT ; sign : ADDI | SUBT ; relationalOperator : LT | GT | LE | GE | EQUAL | NOT_EQUAL ; additiveOperator : ADDI | SUBT | OR ; multiplicativeOperator : MULT | DIVI | DIV | MOD | AND ; // statement statements : statement+ ; statement : nonSemiStateRule | semiStateRule ; semiStateRule : statementwithSemi SEMI ; nonSemiStateRule : statementwithNoSemi ; statementwithSemi : assignmentStatement | breakStatement | continueStatement | returnStatement | callStatement ; statementwithNoSemi : ifStatement | forStatement | whileStatement | compoundStatement | withStatement ; lhs : indexExpression | identifier ; assignmentStatement : (lhs ASSIGN)+ expression ; ifStatement : IF expression THEN statement (ELSE statement)? ; whileStatement : WHILE expression DO statement ; forStatement : FOR identifier ASSIGN expression (TO|DOWNTO) expression DO statement ; breakStatement : BREAK ; continueStatement : CONTINUE ; returnStatement : RETURN expression? | RETURN ; withStatement : WITH varDeclarationList+ DO statement ; callStatement : identifier LB expressionList? RB ; compoundStatement : BEGIN statements? END ; // Expression expression : calExpression | invocationExpression | indexExpression ; indexExpression : index1 | index2 | index3 ; index1 : identifier (LB expressionList? RB)? LSB expression RSB ; index2 : LB expression RB LSB expression RSB ; index3 : literals LSB expression RSB ; invocationExpression : identifier LB expressionList? RB ; expressionList : expression (COM expression)* ; /* expressionforIndex : expIn0 ; expIn0 : expIn0 (ADDI|SUBT) expIn1 | expIn1 ; expIn1 : expIn1 (MULT|DIVI|DIV|MOD) expIn2 | expIn2 ; expIn2 : SUBT expIn2 | expIn3 ; expIn3 : expIn4 LSB expIn0 RSB | expIn4 ; expIn4 : LB expIn0 RB | INTLIT | identifier | indexExpression ; */ calExpression : exp0 ; /* exp0 : exp0 (AND THEN | OR ELSE ) exp1 | exp1 ; */ exp0 : exp0 ( AND THEN | OR ELSE ) exp0 | exp1; exp1 : exp2 relationalOperator exp2 | exp2 ; exp2 : exp2 additiveOperator exp3 | exp3 ; exp3 : exp3 multiplicativeOperator exp4 | exp4 ; exp4 : (NOT | SUBT) exp4 | exp6 ; /* exp5 : exp6 LSB expression RSB | exp6 ; */ exp6 : LB exp0 RB | literals | identifier | invocationExpression | indexExpression ; LSB: '['; LB: '(' ; RB: ')' ; /* LP: '{'; RP: '}'; */ SEMI: ';'; RSB: ']'; DOD: '..'; COL: ':'; COM: ','; fragment A : ('a' | 'A') ; fragment B : ('b' | 'B') ; fragment C : ('c' | 'C') ; fragment D : ('d' | 'D') ; fragment E : ('e' | 'E') ; fragment F : ('f' | 'F') ; fragment G : ('g' | 'G') ; fragment H : ('h' | 'H') ; fragment I : ('i' | 'I') ; fragment J : ('j' | 'J') ; fragment K : ('k' | 'K') ; fragment L : ('l' | 'L') ; fragment M : ('m' | 'M') ; fragment N : ('n' | 'N') ; fragment O : ('o' | 'O') ; fragment P : ('p' | 'P') ; fragment Q : ('q' | 'Q') ; fragment R : ('r' | 'R') ; fragment S : ('s' | 'S') ; fragment T : ('t' | 'T') ; fragment U : ('u' | 'U') ; fragment V : ('v' | 'V') ; fragment W : ('w' | 'W') ; fragment X : ('x' | 'X') ; fragment Y : ('y' | 'Y') ; fragment Z : ('z' | 'Z') ; AND : A N D ; ARRAY : A R R A Y ; BEGIN : B E G I N ; BOOLEAN : B O O L E A N ; BREAK : B R E A K ; CONTINUE : C O N T I N U E ; DOWNTO : D O W N T O ; DO : D O ; DIV : D I V ; END : E N D ; ELSE : E L S E ; FALSE : F A L S E ; FUNCTION : F U N C T I O N ; FOR : F O R ; INTEGER : I N T E G E R ; IF : I F ; MOD : M O D ; NOT : N O T ; OR : O R ; OF : O F ; PROCEDURE : P R O C E D U R E ; REAL : R E A L ; RETURN : R E T U R N ; STRING : S T R I N G ; TO : T O ; TRUE : T R U E ; THEN : T H E N ; VAR : V A R ; WHILE : W H I L E ; WITH : W I T H ; // TOKEN SET type_noarr: INTEGER|REAL|STRING|BOOLEAN; // Keywords /* fragment KW1: INTEGER|REAL|STRING|BOOLEAN|ARRAY; fragment KW2: BREAK|CONTINUE|FOR|TO|DOWNTO|IF|THEN|ELSE|RETURN|WHILE|RETURN; fragment KW3: BEGIN|END|FUNCTION|PROCEDURE|VAR|OF; fragment KW4: NOT|OR|MOD|AND|DIV; fragment KW5: TRUE|FALSE; */ /* KEYW: KW1 | KW2 | KW3 | KW4 | KW5 ; */ // Operators ADDI : '+' ; SUBT : '-' ; MULT : '*' ; DIVI : '/' ; NOT_EQUAL : '<>' ; EQUAL : '=' ; LT : '<' ; LE : '<=' ; GE : '>=' ; GT : '>' ; ASSIGN : ':=' ; // Separators SEPA: LB|RB|SEMI|LSB|RSB|DOD|COL|COM; // Literals literals: INTLIT|REALLIT|boollit|STRINGLIT; // Identifiers: IDENT: [a-zA-Z_][A-Za-z0-9_]* ; INTLIT: Digit; REALLIT : (Digit '.' Digit ExponentPart? | Digit '.' Digit? | Digit '.'? ExponentPart | Digit? '.' Digit ExponentPart?); STRINGLIT: '"' ('\\' ([tbfrn] | '\'' | '"' | '\\' ) | ~('\b' | '\f' | '\r' | '\n' | '\t' | '\'' | '"' | '\\'))* '"' {self.text = self.text[1:-1]} ; fragment Digit: [0-9]+; fragment ExponentPart: [eE][-]? Digit; // Comment /* : (COMMENT_1|COMMENT_2|COMMENT_3); */ COMMENT_1 : '(*' .*? '*)' -> skip ; COMMENT_2 : '{' .*? '}' -> skip ; COMMENT_3 : '//' ~[\r\n]* -> skip ; WS : [ \t\r\n]+ -> skip // skip spaces, tabs, newlines ; ILLEGAL_ESCAPE: '"' (~[\\"'\n\t\r\f] | '\\' [ntfrb\\'"])* '\\' ~[ntrbf'"\\] {raise IllegalEscape(self.text[1:])} ; UNCLOSE_STRING : '"' ('\\' ([tbfrn] | '\'' | '"' | '\\' ) | ~('\b' | '\f' | '\r' | '\n' | '\t' | '\'' | '"' | '\\'))* {raise UncloseString(self.text[1:])} ; ERROR_CHAR: . {raise ErrorToken(self.text)}; // error token - find exception in file lexererr.py
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w56.asm
prismotizm/gigaleak
0
4495
Name: ys_w56.asm Type: file Size: 11155 Last-Modified: '2016-05-13T04:51:15Z' SHA-1: 21B6B55474E2507917FE3B312A755829B5F92A4A Description: null
programs/oeis/289/A289761.asm
jmorken/loda
1
175112
; A289761: Maximum length of a perfect Wichmann ruler with n segments. ; 3,6,9,12,15,22,29,36,43,50,57,68,79,90,101,112,123,138,153,168,183,198,213,232,251,270,289,308,327,350,373,396,419,442,465,492,519,546,573,600,627,658,689,720,751,782,813,848,883,918,953,988,1023,1062,1101,1140,1179,1218,1257,1300,1343,1386,1429,1472,1515,1562,1609,1656,1703,1750,1797,1848,1899,1950,2001,2052,2103,2158,2213,2268,2323,2378,2433,2492,2551,2610,2669,2728,2787,2850,2913,2976,3039,3102,3165,3232,3299,3366,3433,3500,3567,3638,3709,3780,3851,3922,3993,4068,4143,4218,4293,4368,4443,4522,4601,4680,4759,4838,4917,5000,5083,5166,5249,5332,5415,5502,5589,5676,5763,5850,5937,6028,6119,6210,6301,6392,6483,6578,6673,6768,6863,6958,7053,7152,7251,7350,7449,7548,7647,7750,7853,7956,8059,8162,8265,8372,8479,8586,8693,8800,8907,9018,9129,9240,9351,9462,9573,9688,9803,9918,10033,10148,10263,10382,10501,10620,10739,10858,10977,11100,11223,11346,11469,11592,11715,11842,11969,12096,12223,12350,12477,12608,12739,12870,13001,13132,13263,13398,13533,13668,13803,13938,14073,14212,14351,14490,14629,14768,14907,15050,15193,15336,15479,15622,15765,15912,16059,16206,16353,16500,16647,16798,16949,17100,17251,17402,17553,17708,17863,18018,18173,18328,18483,18642,18801,18960,19119,19278,19437,19600,19763,19926,20089,20252,20415,20582,20749,20916,21083,21250 mov $1,3 mov $2,$0 lpb $0 sub $0,4 add $1,$0 add $1,$0 sub $0,2 lpe mov $3,$1 add $1,2 add $3,$1 mov $1,$3 lpb $2 add $1,3 sub $2,1 lpe sub $1,5
backup/rogue7.asm
iSnakeBuzz/bootRogue
95
173567
; ; bootRogue game in 512 bytes (boot sector) ; ; by <NAME>. ; http://nanochess.org/ ; ; (c) Copyright 2019 <NAME>. ; ; Creation date: Sep/19/2019. Generates room boxes. ; Revision date: Sep/20/2019. Connect rooms. Allows to navigate. ; Revision date: Sep/21/2019. Added ladders to go down/up. Shows ; Amulet of Yendor at level 26. Added ; circle of light. ; Revision date: Sep/22/2019. Creates monsters and items. Now has ; hp/exp. Food, armor, weapon, and traps ; works. Added battles. ; Revision date: Sep/23/2019. Lots of optimization. ; CPU 8086 ROW_WIDTH: EQU 0x00A0 BOX_MAX_WIDTH: EQU 23 BOX_MAX_HEIGHT: EQU 6 BOX_WIDTH: EQU 26 BOX_HEIGHT: EQU 8 LIGHT_COLOR: EQU 0x06 HERO_COLOR: EQU 0x0e GR_TOP_LEFT: EQU 0xc9 GR_HORIZ: EQU 0xcd GR_TOP_RIGHT: EQU 0xbb GR_VERT: EQU 0xba GR_BOT_LEFT: EQU 0xc8 GR_BOT_RIGHT: EQU 0xbc GR_DOOR: EQU 0xce GR_TUNNEL: EQU 0xb1 GR_FLOOR: EQU 0xfa GR_HERO: EQU 0x01 GR_LADDER: EQU 0xf0 GR_YENDOR: EQU 0x0c GR_FOOD: EQU 0x05 GR_WEAPON: EQU 0x18 GR_ARMOR: EQU 0x08 GR_TRAP: EQU 0x04 GR_GOLD: EQU 0x0f YENDOR_LEVEL: EQU 26 %ifdef com_file org 0x0100 %else org 0x7c00 %endif monster: equ 0x000e rnd: equ 0x000c level: equ 0x000a ; Current level (starting at 0x01) yendor: equ 0x000b ; 0x01 = Not found. 0xff = Found. weapon: equ 0x0008 armor: equ 0x0009 exp: equ 0x0006 ; Current Exp n_exp: equ 0x0004 ; Level to next Exp hp: equ 0x0002 ; Current HP max_hp: equ 0x0000 ; Max HP start: mov ax,0x0002 int 0x10 mov ax,0xb800 mov ds,ax mov es,ax push ax in al,0x40 ; Read timer counter push ax ; Setup pseudorandom number generator mov ax,0x0101 push ax ; level + yendor push ax ; weapon + armor mov ah,0 push ax ; exp mov al,0x08 push ax ; n_exp mov al,16 push ax ; hp push ax ; max_hp mov bp,sp generate_dungeon: xor ax,ax xor di,di mov cx,0x07d0 rep stosw ; ; Start a dungeon ; mov al,[bp+rnd] ; ah is zero already and al,0x0e xchg ax,bx cs mov si,[bx+mazes] xor ax,ax .4: push ax call fill_column pop ax add ax,BOX_WIDTH*2 cmp al,0x9c jne .5 add ax,ROW_WIDTH*BOX_HEIGHT-BOX_WIDTH*3*2 .5: cmp ax,ROW_WIDTH*BOX_HEIGHT*3 jb .4 mov ax,[bp+rnd] mov si,3*ROW_WIDTH+12*2 mov di,19*ROW_WIDTH+12*2 shl al,1 jnc .2 xchg si,di .2: jns .3 add si,BOX_WIDTH*2*2 .3: mov byte [si],GR_LADDER cmp byte [bp+level],YENDOR_LEVEL jb .1 mov byte [di],GR_YENDOR .1: mov di,11*ROW_WIDTH+38*2 game_loop: mov ax,game_loop push ax call update_hp ; ; Circle of light ; mov si,dirs mov cx,11 .7: cs lodsb cbw xchg ax,bx shl bx,1 mov byte [bx+di+1],LIGHT_COLOR loop .7 ; ; Show our hero ; push word [di] mov word [di],HERO_COLOR*256+GR_HERO mov ah,0x00 int 0x16 pop word [di] mov al,ah sub al,0x47 jc move_over cmp al,0x0b jnc move_over mov bx,dirs cs xlat cbw xchg ax,bx shl bx,1 mov si,walkable mov cx,10 .14: cs lodsb cmp al,[di+bx] cs lodsw jne .15 lea di,[di+bx] cmp cl,6 jb .16 mov byte [di],GR_FLOOR .16: jmp ax .15: loop .14 mov al,[di+bx] cmp al,0x5b jb battle move_over: ret battle: lea di,[di+bx] and al,0x1f cbw mov [bp+monster],ax xchg ax,si ; Player's attack .2: mov bh,[bp+weapon] mov bl,0x01 call random sub si,ax jc .3 ; Monster's attack mov bh,[bp+monster] call random sub al,[bp+armor] jc .4 neg ax call add_hp .4: mov ah,0x00 int 0x16 jmp .2 ; Monster is dead .3: mov byte [di],GR_FLOOR mov ax,[bp+monster] inc ax shr ax,1 add ax,[bp+exp] cmp ax,[bp+n_exp] jb .5 shl word [bp+n_exp],1 shl word [bp+max_hp],1 .5: mov [bp+exp],ax ret amulet_found: neg byte [bp+yendor] ret armor_found: inc byte [bp+armor] ret weapon_found: inc byte [bp+weapon] ret food_found: mov bl,0x05 db 0xb8 ; Jump two bytes using mov ax,imm16 trap_found: mov bl,0xfa add_hp_random: mov bh,0x06 call random add_hp: add ax,[bp+hp] js $ ; Stall if dead cmp ax,[bp+max_hp] jl .1 mov ax,[bp+max_hp] .1: mov [bp+hp],ax update_hp: mov bx,0x0f9c mov ax,[bp+max_hp] call show_number mov ax,[bp+hp] show_number: xor dx,dx mov cx,10 div cx add dx,0x0a30 mov [bx],dx dec bx dec bx or ax,ax jnz show_number mov [bx],ax dec bx dec bx ret ladder_found: mov al,[bp+yendor] add [bp+level],al je $ ; Stall if reached level zero jmp generate_dungeon ; ; Fill a row with 3 rooms ; fill_column: push ax add ax,4*ROW_WIDTH+(BOX_WIDTH/2-1)*2 xchg ax,di shr si,1 mov ax,0x0000+GR_TUNNEL jnc .3 push di mov cl,BOX_WIDTH rep stosw ; Horizontal path pop di .3: shr si,1 jnc .5 mov cl,BOX_HEIGHT .4: stosb ; Vertical path add di,ROW_WIDTH-1 loop .4 .5: pop di mov bx,(BOX_MAX_WIDTH-2)*256+2 call random xchg ax,cx mov bh,BOX_MAX_HEIGHT-2 call random mov ch,al mov ax,BOX_MAX_HEIGHT*256+BOX_MAX_WIDTH sub ax,cx and ax,0xfefe xchg ax,bx mov al,ROW_WIDTH/2 mul bh mov bh,0 add ax,bx add di,ax mov dh,GR_TOP_LEFT mov bx,GR_HORIZ*256+GR_TOP_RIGHT call fill .1: mov dh,GR_VERT mov bx,GR_FLOOR*256+GR_VERT call fill dec ch jne .1 mov dh,GR_BOT_LEFT mov bx,GR_HORIZ*256+GR_BOT_RIGHT fill: push cx push di mov al,dh call door mov ch,0 .1: mov al,bh call door loop .1 mov al,bl call door pop di pop cx add di,0x00a0 ret door: cmp al,GR_FLOOR jne .3 push bx mov bx,0x6400 call random cmp al,3 ; 3% chance of creating a item jb .11 cmp al,8 ; 8% chance of creating a monster/item mov al,GR_FLOOR jnb .12 mov bh,0x08 call random mov bx,items cs xlat jmp .12 .11: mov bx,0x0400 call random add al,[bp+level] .9: sub al,0x05 cmp al,0x16 jge .9 add al,0x45 ; Offset into ASCII letters .12: pop bx .3: cmp al,GR_HORIZ je .1 cmp al,GR_VERT jne .2 .1: cmp byte [di],GR_TUNNEL jne .2 mov al,GR_DOOR .2: stosb inc di ret random: mov ax,7841 mul word [bp+rnd] add ax,83 mov [bp+rnd],ax ; rdtsc ; Would make it dependent on Pentium II ; in al,(0x40) ; Only works for slow requirements. xor ah,ah div bh mov al,ah add al,bl cbw ret walkable: db GR_FOOD dw food_found db GR_GOLD dw move_over db GR_WEAPON dw weapon_found db GR_ARMOR dw armor_found db GR_YENDOR dw amulet_found db GR_TRAP dw trap_found db GR_LADDER dw ladder_found db GR_TUNNEL dw move_over db GR_DOOR dw move_over db GR_FLOOR dw move_over ; ; Items ; items: db GR_FOOD db GR_FOOD db GR_GOLD db GR_FOOD db GR_WEAPON db GR_TRAP db GR_ARMOR db GR_TRAP dirs: db -81,-80,-79,0 db -1,0,1,0 db 79,80,81 mazes: dw $0aed dw $0be3 dw $19a7 dw $1b8d dw $42af dw $48ee dw $5363 dw $59c7 %ifdef com_file %else times 510-($-$$) db 0x4f db 0x55,0xaa ; Make it a bootable sector %endif
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_180_1325.asm
ljhsiun2/medusa
9
104770
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0x1a4df, %rbp nop nop nop sub $29433, %r15 mov (%rbp), %r9 nop nop xor $22236, %r12 lea addresses_WC_ht+0x13257, %rsi lea addresses_D_ht+0x1a8ff, %rdi and %rbp, %rbp mov $16, %rcx rep movsw nop xor %r9, %r9 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %r9 push %rcx push %rsi // Load lea addresses_A+0x1a6ff, %r8 nop nop nop xor $59876, %r14 mov (%r8), %r13d nop nop add $28800, %r8 // Store lea addresses_WC+0x17cff, %r13 nop nop nop cmp $48597, %r9 movl $0x51525354, (%r13) nop inc %rcx // Store mov $0xff, %r15 nop nop nop nop nop add %rcx, %rcx movl $0x51525354, (%r15) nop add $26068, %r15 // Faulty Load lea addresses_WC+0x17cff, %rsi nop nop nop nop cmp $62006, %r15 movb (%rsi), %r13b lea oracles, %r15 and $0xff, %r13 shlq $12, %r13 mov (%r15,%r13,1), %r13 pop %rsi pop %rcx pop %r9 pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'54': 180} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
programs/oeis/166/A166150.asm
neoneye/loda
22
98718
; A166150: a(n) = 5n^2 + 5n - 9. ; 1,21,51,91,141,201,271,351,441,541,651,771,901,1041,1191,1351,1521,1701,1891,2091,2301,2521,2751,2991,3241,3501,3771,4051,4341,4641,4951,5271,5601,5941,6291,6651,7021,7401,7791,8191,8601,9021,9451,9891,10341,10801,11271,11751,12241,12741,13251,13771,14301,14841,15391,15951,16521,17101,17691,18291,18901,19521,20151,20791,21441,22101,22771,23451,24141,24841,25551,26271,27001,27741,28491,29251,30021,30801,31591,32391,33201,34021,34851,35691,36541,37401,38271,39151,40041,40941,41851,42771,43701,44641,45591,46551,47521,48501,49491,50491 mov $1,$0 mul $0,5 add $1,3 mul $0,$1 add $0,1
complete-progress.agda
hazelgrove/hazel-palette-agda
4
12325
<filename>complete-progress.agda open import Nat open import Prelude open import core open import contexts open import progress open import lemmas-complete module complete-progress where -- as in progress, we define a datatype for the possible outcomes of -- progress for readability. data okc : (d : iexp) (Δ : hctx) → Set where V : ∀{d Δ} → d val → okc d Δ S : ∀{d Δ} → Σ[ d' ∈ iexp ] (d ↦ d') → okc d Δ complete-progress : {Δ : hctx} {d : iexp} {τ : typ} → Δ , ∅ ⊢ d :: τ → d dcomplete → okc d Δ complete-progress wt comp with progress wt complete-progress wt comp | S x = S x complete-progress wt comp | I x = abort (lem-ind-comp comp x) complete-progress wt comp | BV x = V (lem-comp-boxed-val wt comp x)
awa/plugins/awa-jobs/src/awa-jobs-services.ads
Letractively/ada-awa
0
13126
----------------------------------------------------------------------- -- awa-jobs -- AWA Jobs -- Copyright (C) 2012, 2014 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with Util.Beans.Objects; with Util.Beans.Objects.Maps; with ADO.Sessions; with AWA.Events; with AWA.Jobs.Models; -- == Job Service == -- The <b>AWA.Jobs.Services</b> package defines the type abstractions and the core operation -- to define a job operation procedure, create and schedule a job and perform the job work -- when it is scheduled. -- -- @type Abstract_Job_Type -- -- @type package AWA.Jobs.Services is -- The job is closed. The status cannot be modified. Closed_Error : exception; -- The job is already scheduled. Schedule_Error : exception; -- The job had an execution error. Execute_Error : exception; -- The parameter value is invalid and cannot be set on the job instance. Invalid_Value : exception; -- Event posted when a job is created. package Job_Create_Event is new AWA.Events.Definition (Name => "job-create"); -- Get the job status. function Get_Job_Status (Id : in ADO.Identifier) return AWA.Jobs.Models.Job_Status_Type; -- ------------------------------ -- Abstract_Job Type -- ------------------------------ -- The <b>Abstract_Job_Type</b> is an abstract tagged record which defines a job that can be -- scheduled and executed. This is the base type of any job implementation. It defines -- the <tt>Execute</tt> abstract procedure that must be implemented in concrete job types. -- It provides operation to setup and retrieve the job parameter. When the job -- <tt>Execute</tt> procedure is called, it allows to set the job execution status and result. type Abstract_Job_Type is abstract new Ada.Finalization.Limited_Controlled with private; type Abstract_Job_Access is access all Abstract_Job_Type'Class; type Work_Access is access procedure (Job : in out Abstract_Job_Type'Class); -- Execute the job. This operation must be implemented and should perform the work -- represented by the job. It should use the <tt>Get_Parameter</tt> function to retrieve -- the job parameter and it can use the <tt>Set_Result</tt> operation to save the result. procedure Execute (Job : in out Abstract_Job_Type) is abstract; -- Set the job parameter identified by the <b>Name</b> to the value given in <b>Value</b>. procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in String); -- Set the job parameter identified by the <b>Name</b> to the value given in <b>Value</b>. procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in Integer); -- Set the job parameter identified by the <b>Name</b> to the value given in <b>Value</b>. -- The value object can hold any kind of basic value type (integer, enum, date, strings). -- If the value represents a bean, the <tt>Invalid_Value</tt> exception is raised. procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in Util.Beans.Objects.Object); -- Get the job parameter identified by the <b>Name</b> and convert the value into a string. function Get_Parameter (Job : in Abstract_Job_Type; Name : in String) return String; -- Get the job parameter identified by the <b>Name</b> and convert the value as an integer. -- If the parameter is not defined, return the default value passed in <b>Default</b>. function Get_Parameter (Job : in Abstract_Job_Type; Name : in String; Default : in Integer) return Integer; -- Get the job parameter identified by the <b>Name</b> and return it as a typed object. function Get_Parameter (Job : in Abstract_Job_Type; Name : in String) return Util.Beans.Objects.Object; -- Get the job status. function Get_Status (Job : in Abstract_Job_Type) return AWA.Jobs.Models.Job_Status_Type; -- Get the job identifier once the job was scheduled. The job identifier allows to -- retrieve the job and check its execution and completion status later on. function Get_Identifier (Job : in Abstract_Job_Type) return ADO.Identifier; -- Set the job status. -- When the job is terminated, it is closed and the job parameters or results cannot be -- changed. procedure Set_Status (Job : in out Abstract_Job_Type; Status : in AWA.Jobs.Models.Job_Status_Type); -- Set the job result identified by the <b>Name</b> to the value given in <b>Value</b>. -- The value object can hold any kind of basic value type (integer, enum, date, strings). -- If the value represents a bean, the <tt>Invalid_Value</tt> exception is raised. procedure Set_Result (Job : in out Abstract_Job_Type; Name : in String; Value : in Util.Beans.Objects.Object); -- Set the job result identified by the <b>Name</b> to the value given in <b>Value</b>. procedure Set_Result (Job : in out Abstract_Job_Type; Name : in String; Value : in String); -- Save the job information in the database. Use the database session defined by <b>DB</b> -- to save the job. procedure Save (Job : in out Abstract_Job_Type; DB : in out ADO.Sessions.Master_Session'Class); -- ------------------------------ -- Job Type -- ------------------------------ -- The <tt>Job_Type</tt> is a concrete job used by the <tt>Work_Factory</tt> to execute -- a simple <tt>Work_Access</tt> procedure. type Job_Type is new Abstract_Job_Type with private; overriding procedure Execute (Job : in out Job_Type); -- ------------------------------ -- Job Factory -- ------------------------------ -- The <b>Job_Factory</b> is the interface that allows to create a job instance in order -- to execute a scheduled job. The <tt>Create</tt> function is called to create a new -- job instance when the job is scheduled for execution. type Job_Factory is abstract tagged limited null record; type Job_Factory_Access is access all Job_Factory'Class; -- Create the job instance using the job factory. function Create (Factory : in Job_Factory) return Abstract_Job_Access is abstract; -- Get the job factory name. function Get_Name (Factory : in Job_Factory'Class) return String; -- Schedule the job. procedure Schedule (Job : in out Abstract_Job_Type; Definition : in Job_Factory'Class); -- ------------------------------ -- Work Factory -- ------------------------------ -- The <tt>Work_Factory</tt> is a simplified <tt>Job_Factory</tt> that allows to register -- simple <tt>Work_Access</tt> procedures to execute the job. type Work_Factory (Work : Work_Access) is new Job_Factory with null record; -- Create the job instance to execute the associated <tt>Work_Access</tt> procedure. overriding function Create (Factory : in Work_Factory) return Abstract_Job_Access; -- ------------------------------ -- Job Declaration -- ------------------------------ -- The <tt>Definition</tt> package must be instantiated with a given job type to -- register the new job definition. generic type T is new Abstract_Job_Type with private; package Definition is type Job_Type_Factory is new Job_Factory with null record; overriding function Create (Factory : in Job_Type_Factory) return Abstract_Job_Access; -- The job factory. Factory : constant Job_Factory_Access; private Instance : aliased Job_Type_Factory; Factory : constant Job_Factory_Access := Instance'Access; end Definition; generic Work : in Work_Access; package Work_Definition is type S_Factory is new Work_Factory with null record; -- The job factory. Factory : constant Job_Factory_Access; private Instance : aliased S_Factory := S_Factory '(Work => Work); Factory : constant Job_Factory_Access := Instance'Access; end Work_Definition; -- Execute the job associated with the given event. procedure Execute (Event : in AWA.Events.Module_Event'Class); private -- Execute the job and save the job information in the database. procedure Execute (Job : in out Abstract_Job_Type'Class; DB : in out ADO.Sessions.Master_Session'Class); type Abstract_Job_Type is abstract new Ada.Finalization.Limited_Controlled with record Job : AWA.Jobs.Models.Job_Ref; Props : Util.Beans.Objects.Maps.Map; Results : Util.Beans.Objects.Maps.Map; Props_Modified : Boolean := False; Results_Modified : Boolean := False; end record; -- ------------------------------ -- Job Type -- ------------------------------ -- The <tt>Job_Type</tt> is a concrete job used by the <tt>Work_Factory</tt> to execute -- a simple <tt>Work_Access</tt> procedure. type Job_Type is new Abstract_Job_Type with record Work : Work_Access; end record; end AWA.Jobs.Services;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2595.asm
ljhsiun2/medusa
9
242805
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2595.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r9 push %rax push %rbp lea addresses_UC_ht+0xb813, %rbp nop nop nop sub %r9, %r9 movb (%rbp), %al nop nop nop nop xor $21294, %r10 pop %rbp pop %rax pop %r9 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rax push %rcx push %rdx // Store lea addresses_D+0x16cbf, %r13 nop xor %rdx, %rdx movw $0x5152, (%r13) nop nop nop nop cmp %rcx, %rcx // Faulty Load lea addresses_UC+0xd997, %rax nop cmp %r15, %r15 vmovups (%rax), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx lea oracles, %rdx and $0xff, %rcx shlq $12, %rcx mov (%rdx,%rcx,1), %rcx pop %rdx pop %rcx pop %rax pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 3, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_UC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1063.asm
ljhsiun2/medusa
9
27303
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_normal_ht+0x12de8, %rsi lea addresses_UC_ht+0x3e88, %rdi nop nop cmp $47123, %r13 mov $72, %rcx rep movsb xor %r10, %r10 lea addresses_A_ht+0x3368, %r12 nop cmp %rax, %rax vmovups (%r12), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %rcx nop add %rax, %rax lea addresses_UC_ht+0x186c8, %r10 add $44731, %rsi mov $0x6162636465666768, %rax movq %rax, %xmm2 vmovups %ymm2, (%r10) nop nop cmp %rcx, %rcx lea addresses_WC_ht+0x1d3c8, %rax clflush (%rax) nop nop nop sub $54428, %r13 mov (%rax), %rdi nop nop nop and $16538, %rdi lea addresses_WC_ht+0x13558, %rsi lea addresses_D_ht+0xe388, %rdi nop xor $33245, %r8 mov $70, %rcx rep movsb nop nop nop nop xor %r13, %r13 lea addresses_WT_ht+0x1e308, %r12 nop nop cmp %rsi, %rsi mov (%r12), %r10d nop nop nop nop nop inc %r12 pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r14 push %r15 // Faulty Load lea addresses_PSE+0x19288, %r12 nop nop nop nop sub $37684, %r14 movb (%r12), %r15b lea oracles, %r11 and $0xff, %r15 shlq $12, %r15 mov (%r11,%r15,1), %r15 pop %r15 pop %r14 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}} {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnat/s-memory.adb
JCGobbi/Nucleo-STM32G474RE
0
24171
<reponame>JCGobbi/Nucleo-STM32G474RE ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . M E M O R Y -- -- -- -- B o d y -- -- -- -- Copyright (C) 2013-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Simple implementation for use with Ravenscar Minimal. This implementation -- is based on a simple static buffer (whose bounds are defined in the linker -- script), and allocation is performed through a protected object to -- protect against concurrency. pragma Restrictions (No_Elaboration_Code); -- This unit may be linked without being with'ed, so we need to ensure -- there is no elaboration code (since this code might not be executed). with System.Storage_Elements; package body System.Memory is use System.Storage_Elements; Heap_Start : Character; for Heap_Start'Alignment use Standard'Maximum_Alignment; pragma Import (C, Heap_Start, "__heap_start"); -- The address of the variable is the start of the heap Heap_End : Character; pragma Import (C, Heap_End, "__heap_end"); -- The address of the variable is the end of the heap Top : aliased Address := Heap_Start'Address; -- First not used address (always aligned to the maximum alignment). ---------------- -- For C code -- ---------------- function Malloc (Size : size_t) return System.Address; pragma Export (C, Malloc, "malloc"); function Calloc (N_Elem : size_t; Elem_Size : size_t) return System.Address; pragma Export (C, Calloc, "calloc"); procedure Free (Ptr : System.Address); pragma Export (C, Free, "free"); ----------- -- Alloc -- ----------- function Alloc (Size : size_t) return System.Address is function Compare_And_Swap (Ptr : access Address; Old_Val : Integer_Address; New_Val : Integer_Address) return Boolean; pragma Import (Intrinsic, Compare_And_Swap, "__sync_bool_compare_and_swap_" & (case System.Word_Size is when 32 => "4", when 64 => "8", when others => "unexpected")); Max_Align : constant := Standard'Maximum_Alignment; Max_Size : Storage_Count; Res : Address; begin if Size = 0 then -- Change size from zero to non-zero. We still want a proper pointer -- for the zero case because pointers to zero length objects have to -- be distinct. Max_Size := Max_Align; else -- Detect overflow in the addition below. Note that we know that -- upper bound of size_t is bigger than the upper bound of -- Storage_Count. if Size > size_t (Storage_Count'Last - Max_Align) then raise Storage_Error; end if; -- Compute aligned size Max_Size := ((Storage_Count (Size) + Max_Align - 1) / Max_Align) * Max_Align; end if; loop Res := Top; -- Detect too large allocation if Max_Size >= Storage_Count (Heap_End'Address - Res) then raise Storage_Error; end if; -- Atomically update the top of the heap. Restart in case of -- failure (concurrent allocation). exit when Compare_And_Swap (Top'Access, Integer_Address (Res), Integer_Address (Res + Max_Size)); end loop; return Res; end Alloc; ------------ -- Malloc -- ------------ function Malloc (Size : size_t) return System.Address is begin return Alloc (Size); end Malloc; ------------ -- Calloc -- ------------ function Calloc (N_Elem : size_t; Elem_Size : size_t) return System.Address is begin return Malloc (N_Elem * Elem_Size); end Calloc; ---------- -- Free -- ---------- procedure Free (Ptr : System.Address) is pragma Unreferenced (Ptr); begin null; end Free; end System.Memory;
programs/oeis/159/A159333.asm
karttu/loda
0
8062
; A159333: Roman factorial of n. ; -1,1,1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000 sub $2,$0 trn $0,2 fac $0 mov $1,$0 cmp $2,0 mul $2,2 sub $1,$2
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-genbig.adb
djamal2727/Main-Bearing-Analytical-Model
0
25849
<reponame>djamal2727/Main-Bearing-Analytical-Model<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-genbig.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . G E N E R I C _ B I G N U M S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2012-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides arbitrary precision signed integer arithmetic. package body System.Generic_Bignums is use Interfaces; -- So that operations on Unsigned_32/Unsigned_64 are available use Shared_Bignums; type DD is mod Base ** 2; -- Double length digit used for intermediate computations function MSD (X : DD) return SD is (SD (X / Base)); function LSD (X : DD) return SD is (SD (X mod Base)); -- Most significant and least significant digit of double digit value function "&" (X, Y : SD) return DD is (DD (X) * Base + DD (Y)); -- Compose double digit value from two single digit values subtype LLI is Long_Long_Integer; One_Data : constant Digit_Vector (1 .. 1) := (1 => 1); -- Constant one Zero_Data : constant Digit_Vector (1 .. 0) := (1 .. 0 => 0); -- Constant zero ----------------------- -- Local Subprograms -- ----------------------- function Add (X, Y : Digit_Vector; X_Neg : Boolean; Y_Neg : Boolean) return Big_Integer with Pre => X'First = 1 and then Y'First = 1; -- This procedure adds two signed numbers returning the Sum, it is used -- for both addition and subtraction. The value computed is X + Y, with -- X_Neg and Y_Neg giving the signs of the operands. type Compare_Result is (LT, EQ, GT); -- Indicates result of comparison in following call function Compare (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Compare_Result with Pre => X'First = 1 and then Y'First = 1; -- Compare (X with sign X_Neg) with (Y with sign Y_Neg), and return the -- result of the signed comparison. procedure Div_Rem (X, Y : Bignum; Quotient : out Big_Integer; Remainder : out Big_Integer; Discard_Quotient : Boolean := False; Discard_Remainder : Boolean := False); -- Returns the Quotient and Remainder from dividing abs (X) by abs (Y). The -- values of X and Y are not modified. If Discard_Quotient is True, then -- Quotient is undefined on return, and if Discard_Remainder is True, then -- Remainder is undefined on return. Service routine for Big_Div/Rem/Mod. function Normalize (X : Digit_Vector; Neg : Boolean := False) return Big_Integer; -- Given a digit vector and sign, allocate and construct a big integer -- value. Note that X may have leading zeroes which must be removed, and if -- the result is zero, the sign is forced positive. -- If X is too big, Storage_Error is raised. function "**" (X : Bignum; Y : SD) return Big_Integer; -- Exponentiation routine where we know right operand is one word --------- -- Add -- --------- function Add (X, Y : Digit_Vector; X_Neg : Boolean; Y_Neg : Boolean) return Big_Integer is begin -- If signs are the same, we are doing an addition, it is convenient to -- ensure that the first operand is the longer of the two. if X_Neg = Y_Neg then if X'Last < Y'Last then return Add (X => Y, Y => X, X_Neg => Y_Neg, Y_Neg => X_Neg); -- Here signs are the same, and the first operand is the longer else pragma Assert (X_Neg = Y_Neg and then X'Last >= Y'Last); -- Do addition, putting result in Sum (allowing for carry) declare Sum : Digit_Vector (0 .. X'Last); RD : DD; begin RD := 0; for J in reverse 1 .. X'Last loop RD := RD + DD (X (J)); if J >= 1 + (X'Last - Y'Last) then RD := RD + DD (Y (J - (X'Last - Y'Last))); end if; Sum (J) := LSD (RD); RD := RD / Base; end loop; Sum (0) := SD (RD); return Normalize (Sum, X_Neg); end; end if; -- Signs are different so really this is a subtraction, we want to make -- sure that the largest magnitude operand is the first one, and then -- the result will have the sign of the first operand. else declare CR : constant Compare_Result := Compare (X, Y, False, False); begin if CR = EQ then return Normalize (Zero_Data); elsif CR = LT then return Add (X => Y, Y => X, X_Neg => Y_Neg, Y_Neg => X_Neg); else pragma Assert (X_Neg /= Y_Neg and then CR = GT); -- Do subtraction, putting result in Diff declare Diff : Digit_Vector (1 .. X'Length); RD : DD; begin RD := 0; for J in reverse 1 .. X'Last loop RD := RD + DD (X (J)); if J >= 1 + (X'Last - Y'Last) then RD := RD - DD (Y (J - (X'Last - Y'Last))); end if; Diff (J) := LSD (RD); RD := (if RD < Base then 0 else -1); end loop; return Normalize (Diff, X_Neg); end; end if; end; end if; end Add; ------------- -- Big_Abs -- ------------- function Big_Abs (X : Bignum) return Big_Integer is begin return Normalize (X.D); end Big_Abs; ------------- -- Big_Add -- ------------- function Big_Add (X, Y : Bignum) return Big_Integer is begin return Add (X.D, Y.D, X.Neg, Y.Neg); end Big_Add; ------------- -- Big_Div -- ------------- -- This table is excerpted from RM 4.5.5(28-30) and shows how the result -- varies with the signs of the operands. -- A B A/B A B A/B -- -- 10 5 2 -10 5 -2 -- 11 5 2 -11 5 -2 -- 12 5 2 -12 5 -2 -- 13 5 2 -13 5 -2 -- 14 5 2 -14 5 -2 -- -- A B A/B A B A/B -- -- 10 -5 -2 -10 -5 2 -- 11 -5 -2 -11 -5 2 -- 12 -5 -2 -12 -5 2 -- 13 -5 -2 -13 -5 2 -- 14 -5 -2 -14 -5 2 function Big_Div (X, Y : Bignum) return Big_Integer is Q, R : aliased Big_Integer; begin Div_Rem (X, Y, Q, R, Discard_Remainder => True); To_Bignum (Q).Neg := To_Bignum (Q).Len > 0 and then (X.Neg xor Y.Neg); return Q; end Big_Div; ---------- -- "**" -- ---------- function "**" (X : Bignum; Y : SD) return Big_Integer is begin case Y is -- X ** 0 is 1 when 0 => return Normalize (One_Data); -- X ** 1 is X when 1 => return Normalize (X.D); -- X ** 2 is X * X when 2 => return Big_Mul (X, X); -- For X greater than 2, use the recursion -- X even, X ** Y = (X ** (Y/2)) ** 2; -- X odd, X ** Y = (X ** (Y/2)) ** 2 * X; when others => declare XY2 : aliased Big_Integer := X ** (Y / 2); XY2S : aliased Big_Integer := Big_Mul (To_Bignum (XY2), To_Bignum (XY2)); begin Free_Big_Integer (XY2); if (Y and 1) = 0 then return XY2S; else return Res : constant Big_Integer := Big_Mul (To_Bignum (XY2S), X) do Free_Big_Integer (XY2S); end return; end if; end; end case; end "**"; ------------- -- Big_Exp -- ------------- function Big_Exp (X, Y : Bignum) return Big_Integer is begin -- Error if right operand negative if Y.Neg then raise Constraint_Error with "exponentiation to negative power"; -- X ** 0 is always 1 (including 0 ** 0, so do this test first) elsif Y.Len = 0 then return Normalize (One_Data); -- 0 ** X is always 0 (for X non-zero) elsif X.Len = 0 then return Normalize (Zero_Data); -- (+1) ** Y = 1 -- (-1) ** Y = +/-1 depending on whether Y is even or odd elsif X.Len = 1 and then X.D (1) = 1 then return Normalize (X.D, Neg => X.Neg and then ((Y.D (Y.Len) and 1) = 1)); -- If the absolute value of the base is greater than 1, then the -- exponent must not be bigger than one word, otherwise the result -- is ludicrously large, and we just signal Storage_Error right away. elsif Y.Len > 1 then raise Storage_Error with "exponentiation result is too large"; -- Special case (+/-)2 ** K, where K is 1 .. 31 using a shift elsif X.Len = 1 and then X.D (1) = 2 and then Y.D (1) < 32 then declare D : constant Digit_Vector (1 .. 1) := (1 => Shift_Left (SD'(1), Natural (Y.D (1)))); begin return Normalize (D, X.Neg); end; -- Remaining cases have right operand of one word else return X ** Y.D (1); end if; end Big_Exp; ------------- -- Big_And -- ------------- function Big_And (X, Y : Bignum) return Big_Integer is begin if X.Len > Y.Len then return Big_And (X => Y, Y => X); end if; -- X is the smallest integer declare Result : Digit_Vector (1 .. X.Len); Diff : constant Length := Y.Len - X.Len; begin for J in 1 .. X.Len loop Result (J) := X.D (J) and Y.D (J + Diff); end loop; return Normalize (Result, X.Neg and Y.Neg); end; end Big_And; ------------ -- Big_Or -- ------------ function Big_Or (X, Y : Bignum) return Big_Integer is begin if X.Len < Y.Len then return Big_Or (X => Y, Y => X); end if; -- X is the largest integer declare Result : Digit_Vector (1 .. X.Len); Index : Length; Diff : constant Length := X.Len - Y.Len; begin Index := 1; while Index <= Diff loop Result (Index) := X.D (Index); Index := Index + 1; end loop; for J in 1 .. Y.Len loop Result (Index) := X.D (Index) or Y.D (J); Index := Index + 1; end loop; return Normalize (Result, X.Neg or Y.Neg); end; end Big_Or; -------------------- -- Big_Shift_Left -- -------------------- function Big_Shift_Left (X : Bignum; Amount : Natural) return Big_Integer is begin if X.Neg then raise Constraint_Error; elsif Amount = 0 then return Allocate_Big_Integer (X.D, False); end if; declare Shift : constant Natural := Amount rem SD'Size; Result : Digit_Vector (0 .. X.Len + Amount / SD'Size); Carry : SD := 0; begin for J in X.Len + 1 .. Result'Last loop Result (J) := 0; end loop; for J in reverse 1 .. X.Len loop Result (J) := Shift_Left (X.D (J), Shift) or Carry; Carry := Shift_Right (X.D (J), SD'Size - Shift); end loop; Result (0) := Carry; return Normalize (Result, False); end; end Big_Shift_Left; --------------------- -- Big_Shift_Right -- --------------------- function Big_Shift_Right (X : Bignum; Amount : Natural) return Big_Integer is begin if X.Neg then raise Constraint_Error; elsif Amount = 0 then return Allocate_Big_Integer (X.D, False); end if; declare Shift : constant Natural := Amount rem SD'Size; Result : Digit_Vector (1 .. X.Len - Amount / SD'Size); Carry : SD := 0; begin for J in 1 .. Result'Last - 1 loop Result (J) := Shift_Right (X.D (J), Shift) or Carry; Carry := Shift_Left (X.D (J), SD'Size - Shift); end loop; Result (Result'Last) := Shift_Right (X.D (Result'Last), Shift) or Carry; return Normalize (Result, False); end; end Big_Shift_Right; ------------ -- Big_EQ -- ------------ function Big_EQ (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) = EQ; end Big_EQ; ------------ -- Big_GE -- ------------ function Big_GE (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) /= LT; end Big_GE; ------------ -- Big_GT -- ------------ function Big_GT (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) = GT; end Big_GT; ------------ -- Big_LE -- ------------ function Big_LE (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) /= GT; end Big_LE; ------------ -- Big_LT -- ------------ function Big_LT (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) = LT; end Big_LT; ------------- -- Big_Mod -- ------------- -- This table is excerpted from RM 4.5.5(28-30) and shows how the result -- of Rem and Mod vary with the signs of the operands. -- A B A mod B A rem B A B A mod B A rem B -- 10 5 0 0 -10 5 0 0 -- 11 5 1 1 -11 5 4 -1 -- 12 5 2 2 -12 5 3 -2 -- 13 5 3 3 -13 5 2 -3 -- 14 5 4 4 -14 5 1 -4 -- A B A mod B A rem B A B A mod B A rem B -- 10 -5 0 0 -10 -5 0 0 -- 11 -5 -4 1 -11 -5 -1 -1 -- 12 -5 -3 2 -12 -5 -2 -2 -- 13 -5 -2 3 -13 -5 -3 -3 -- 14 -5 -1 4 -14 -5 -4 -4 function Big_Mod (X, Y : Bignum) return Big_Integer is Q, R : aliased Big_Integer; begin -- If signs are same, result is same as Rem if X.Neg = Y.Neg then return Big_Rem (X, Y); -- Case where Mod is different else -- Do division Div_Rem (X, Y, Q, R, Discard_Quotient => True); -- Zero result is unchanged if To_Bignum (R).Len = 0 then return R; -- Otherwise adjust result else declare T1 : aliased Big_Integer := Big_Sub (Y, To_Bignum (R)); begin To_Bignum (T1).Neg := Y.Neg; Free_Big_Integer (R); return T1; end; end if; end if; end Big_Mod; ------------- -- Big_Mul -- ------------- function Big_Mul (X, Y : Bignum) return Big_Integer is Result : Digit_Vector (1 .. X.Len + Y.Len) := (others => 0); -- Accumulate result (max length of result is sum of operand lengths) L : Length; -- Current result digit D : DD; -- Result digit begin for J in 1 .. X.Len loop for K in 1 .. Y.Len loop L := Result'Last - (X.Len - J) - (Y.Len - K); D := DD (X.D (J)) * DD (Y.D (K)) + DD (Result (L)); Result (L) := LSD (D); D := D / Base; -- D is carry which must be propagated while D /= 0 and then L >= 1 loop L := L - 1; D := D + DD (Result (L)); Result (L) := LSD (D); D := D / Base; end loop; -- Must not have a carry trying to extend max length pragma Assert (D = 0); end loop; end loop; -- Return result return Normalize (Result, X.Neg xor Y.Neg); end Big_Mul; ------------ -- Big_NE -- ------------ function Big_NE (X, Y : Bignum) return Boolean is begin return Compare (X.D, Y.D, X.Neg, Y.Neg) /= EQ; end Big_NE; ------------- -- Big_Neg -- ------------- function Big_Neg (X : Bignum) return Big_Integer is begin return Normalize (X.D, not X.Neg); end Big_Neg; ------------- -- Big_Rem -- ------------- -- This table is excerpted from RM 4.5.5(28-30) and shows how the result -- varies with the signs of the operands. -- A B A rem B A B A rem B -- 10 5 0 -10 5 0 -- 11 5 1 -11 5 -1 -- 12 5 2 -12 5 -2 -- 13 5 3 -13 5 -3 -- 14 5 4 -14 5 -4 -- A B A rem B A B A rem B -- 10 -5 0 -10 -5 0 -- 11 -5 1 -11 -5 -1 -- 12 -5 2 -12 -5 -2 -- 13 -5 3 -13 -5 -3 -- 14 -5 4 -14 -5 -4 function Big_Rem (X, Y : Bignum) return Big_Integer is Q, R : aliased Big_Integer; begin Div_Rem (X, Y, Q, R, Discard_Quotient => True); To_Bignum (R).Neg := To_Bignum (R).Len > 0 and then X.Neg; return R; end Big_Rem; ------------- -- Big_Sub -- ------------- function Big_Sub (X, Y : Bignum) return Big_Integer is begin -- If right operand zero, return left operand (avoiding sharing) if Y.Len = 0 then return Normalize (X.D, X.Neg); -- Otherwise add negative of right operand else return Add (X.D, Y.D, X.Neg, not Y.Neg); end if; end Big_Sub; ------------- -- Compare -- ------------- function Compare (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Compare_Result is begin -- Signs are different, that's decisive, since 0 is always plus if X_Neg /= Y_Neg then return (if X_Neg then LT else GT); -- Lengths are different, that's decisive since no leading zeroes elsif X'Last /= Y'Last then return (if (X'Last > Y'Last) xor X_Neg then GT else LT); -- Need to compare data else for J in X'Range loop if X (J) /= Y (J) then return (if (X (J) > Y (J)) xor X_Neg then GT else LT); end if; end loop; return EQ; end if; end Compare; ------------- -- Div_Rem -- ------------- procedure Div_Rem (X, Y : Bignum; Quotient : out Big_Integer; Remainder : out Big_Integer; Discard_Quotient : Boolean := False; Discard_Remainder : Boolean := False) is begin -- Error if division by zero if Y.Len = 0 then raise Constraint_Error with "division by zero"; end if; -- Handle simple cases with special tests -- If X < Y then quotient is zero and remainder is X if Compare (X.D, Y.D, False, False) = LT then if not Discard_Quotient then Quotient := Normalize (Zero_Data); end if; if not Discard_Remainder then Remainder := Normalize (X.D); end if; return; -- If both X and Y are less than 2**63-1, we can use Long_Long_Integer -- arithmetic. Note it is good not to do an accurate range check against -- Long_Long_Integer since -2**63 / -1 overflows. elsif (X.Len <= 1 or else (X.Len = 2 and then X.D (1) < 2**31)) and then (Y.Len <= 1 or else (Y.Len = 2 and then Y.D (1) < 2**31)) then declare A : constant LLI := abs (From_Bignum (X)); B : constant LLI := abs (From_Bignum (Y)); begin if not Discard_Quotient then Quotient := To_Bignum (A / B); end if; if not Discard_Remainder then Remainder := To_Bignum (A rem B); end if; return; end; -- Easy case if divisor is one digit elsif Y.Len = 1 then declare ND : DD; Div : constant DD := DD (Y.D (1)); Result : Digit_Vector (1 .. X.Len); Remdr : Digit_Vector (1 .. 1); begin ND := 0; for J in 1 .. X.Len loop ND := Base * ND + DD (X.D (J)); pragma Assert (Div /= 0); Result (J) := SD (ND / Div); ND := ND rem Div; end loop; if not Discard_Quotient then Quotient := Normalize (Result); end if; if not Discard_Remainder then Remdr (1) := SD (ND); Remainder := Normalize (Remdr); end if; return; end; end if; -- The complex full multi-precision case. We will employ algorithm -- D defined in the section "The Classical Algorithms" (sec. 4.3.1) -- of <NAME>'s "The Art of Computer Programming", Vol. 2, 2nd -- edition. The terminology is adjusted for this section to match that -- reference. -- We are dividing X.Len digits of X (called u here) by Y.Len digits -- of Y (called v here), developing the quotient and remainder. The -- numbers are represented using Base, which was chosen so that we have -- the operations of multiplying to single digits (SD) to form a double -- digit (DD), and dividing a double digit (DD) by a single digit (SD) -- to give a single digit quotient and a single digit remainder. -- Algorithm D from Knuth -- Comments here with square brackets are directly from Knuth Algorithm_D : declare -- The following lower case variables correspond exactly to the -- terminology used in algorithm D. m : constant Length := X.Len - Y.Len; n : constant Length := Y.Len; b : constant DD := Base; u : Digit_Vector (0 .. m + n); v : Digit_Vector (1 .. n); q : Digit_Vector (0 .. m); r : Digit_Vector (1 .. n); u0 : SD renames u (0); v1 : SD renames v (1); v2 : SD renames v (2); d : DD; j : Length; qhat : DD; rhat : DD; temp : DD; begin -- Initialize data of left and right operands for J in 1 .. m + n loop u (J) := X.D (J); end loop; for J in 1 .. n loop v (J) := Y.D (J); end loop; -- [Division of nonnegative integers.] Given nonnegative integers u -- = (ul,u2..um+n) and v = (v1,v2..vn), where v1 /= 0 and n > 1, we -- form the quotient u / v = (q0,ql..qm) and the remainder u mod v = -- (r1,r2..rn). pragma Assert (v1 /= 0); pragma Assert (n > 1); -- Dl. [Normalize.] Set d = b/(vl + 1). Then set (u0,u1,u2..um+n) -- equal to (u1,u2..um+n) times d, and set (v1,v2..vn) equal to -- (v1,v2..vn) times d. Note the introduction of a new digit position -- u0 at the left of u1; if d = 1 all we need to do in this step is -- to set u0 = 0. d := b / (DD (v1) + 1); if d = 1 then u0 := 0; else declare Carry : DD; Tmp : DD; begin -- Multiply Dividend (u) by d Carry := 0; for J in reverse 1 .. m + n loop Tmp := DD (u (J)) * d + Carry; u (J) := LSD (Tmp); Carry := Tmp / Base; end loop; u0 := SD (Carry); -- Multiply Divisor (v) by d Carry := 0; for J in reverse 1 .. n loop Tmp := DD (v (J)) * d + Carry; v (J) := LSD (Tmp); Carry := Tmp / Base; end loop; pragma Assert (Carry = 0); end; end if; -- D2. [Initialize j.] Set j = 0. The loop on j, steps D2 through D7, -- will be essentially a division of (uj, uj+1..uj+n) by (v1,v2..vn) -- to get a single quotient digit qj. j := 0; -- Loop through digits loop -- Note: In the original printing, step D3 was as follows: -- D3. [Calculate qhat.] If uj = v1, set qhat to b-l; otherwise -- set qhat to (uj,uj+1)/v1. Now test if v2 * qhat is greater than -- (uj*b + uj+1 - qhat*v1)*b + uj+2. If so, decrease qhat by 1 and -- repeat this test -- This had a bug not discovered till 1995, see Vol 2 errata: -- http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz. Under -- rare circumstances the expression in the test could overflow. -- This version was further corrected in 2005, see Vol 2 errata: -- http://www-cs-faculty.stanford.edu/~uno/all2-pre.ps.gz. -- The code below is the fixed version of this step. -- D3. [Calculate qhat.] Set qhat to (uj,uj+1)/v1 and rhat to -- to (uj,uj+1) mod v1. temp := u (j) & u (j + 1); qhat := temp / DD (v1); rhat := temp mod DD (v1); -- D3 (continued). Now test if qhat >= b or v2*qhat > (rhat,uj+2): -- if so, decrease qhat by 1, increase rhat by v1, and repeat this -- test if rhat < b. [The test on v2 determines at high speed -- most of the cases in which the trial value qhat is one too -- large, and eliminates all cases where qhat is two too large.] while qhat >= b or else DD (v2) * qhat > LSD (rhat) & u (j + 2) loop qhat := qhat - 1; rhat := rhat + DD (v1); exit when rhat >= b; end loop; -- D4. [Multiply and subtract.] Replace (uj,uj+1..uj+n) by -- (uj,uj+1..uj+n) minus qhat times (v1,v2..vn). This step -- consists of a simple multiplication by a one-place number, -- combined with a subtraction. -- The digits (uj,uj+1..uj+n) are always kept positive; if the -- result of this step is actually negative then (uj,uj+1..uj+n) -- is left as the true value plus b**(n+1), i.e. as the b's -- complement of the true value, and a "borrow" to the left is -- remembered. declare Borrow : SD; Carry : DD; Temp : DD; Negative : Boolean; -- Records if subtraction causes a negative result, requiring -- an add back (case where qhat turned out to be 1 too large). begin Borrow := 0; for K in reverse 1 .. n loop Temp := qhat * DD (v (K)) + DD (Borrow); Borrow := MSD (Temp); if LSD (Temp) > u (j + K) then Borrow := Borrow + 1; end if; u (j + K) := u (j + K) - LSD (Temp); end loop; Negative := u (j) < Borrow; u (j) := u (j) - Borrow; -- D5. [Test remainder.] Set qj = qhat. If the result of step -- D4 was negative, we will do the add back step (step D6). q (j) := LSD (qhat); if Negative then -- D6. [Add back.] Decrease qj by 1, and add (0,v1,v2..vn) -- to (uj,uj+1,uj+2..uj+n). (A carry will occur to the left -- of uj, and it is be ignored since it cancels with the -- borrow that occurred in D4.) q (j) := q (j) - 1; Carry := 0; for K in reverse 1 .. n loop Temp := DD (v (K)) + DD (u (j + K)) + Carry; u (j + K) := LSD (Temp); Carry := Temp / Base; end loop; u (j) := u (j) + SD (Carry); end if; end; -- D7. [Loop on j.] Increase j by one. Now if j <= m, go back to -- D3 (the start of the loop on j). j := j + 1; exit when not (j <= m); end loop; -- D8. [Unnormalize.] Now (qo,ql..qm) is the desired quotient, and -- the desired remainder may be obtained by dividing (um+1..um+n) -- by d. if not Discard_Quotient then Quotient := Normalize (q); end if; if not Discard_Remainder then declare Remdr : DD; begin Remdr := 0; for K in 1 .. n loop Remdr := Base * Remdr + DD (u (m + K)); r (K) := SD (Remdr / d); Remdr := Remdr rem d; end loop; pragma Assert (Remdr = 0); end; Remainder := Normalize (r); end if; end Algorithm_D; end Div_Rem; ----------------- -- From_Bignum -- ----------------- function From_Bignum (X : Bignum) return Long_Long_Integer is begin if X.Len = 0 then return 0; elsif X.Len = 1 then return (if X.Neg then -LLI (X.D (1)) else LLI (X.D (1))); elsif X.Len = 2 then declare Mag : constant DD := X.D (1) & X.D (2); begin if X.Neg and then Mag <= 2 ** 63 then return -LLI (Mag); elsif Mag < 2 ** 63 then return LLI (Mag); end if; end; end if; raise Constraint_Error with "expression value out of range"; end From_Bignum; ------------------------- -- Bignum_In_LLI_Range -- ------------------------- function Bignum_In_LLI_Range (X : Bignum) return Boolean is begin -- If length is 0 or 1, definitely fits if X.Len <= 1 then return True; -- If length is greater than 2, definitely does not fit elsif X.Len > 2 then return False; -- Length is 2, more tests needed else declare Mag : constant DD := X.D (1) & X.D (2); begin return Mag < 2 ** 63 or else (X.Neg and then Mag = 2 ** 63); end; end if; end Bignum_In_LLI_Range; --------------- -- Normalize -- --------------- Bignum_Limit : constant := 200; function Normalize (X : Digit_Vector; Neg : Boolean := False) return Big_Integer is J : Length; begin J := X'First; while J <= X'Last and then X (J) = 0 loop J := J + 1; end loop; if X'Last - J > Bignum_Limit then raise Storage_Error with "big integer limit exceeded"; end if; return Allocate_Big_Integer (X (J .. X'Last), J <= X'Last and then Neg); end Normalize; --------------- -- To_Bignum -- --------------- function To_Bignum (X : Long_Long_Integer) return Big_Integer is begin if X = 0 then return Allocate_Big_Integer ((1 .. 0 => <>), False); -- One word result elsif X in -(2 ** 32 - 1) .. +(2 ** 32 - 1) then return Allocate_Big_Integer ((1 => SD (abs X)), X < 0); -- Largest negative number annoyance elsif X = Long_Long_Integer'First then return Allocate_Big_Integer ((2 ** 31, 0), True); -- Other negative numbers elsif X < 0 then return Allocate_Big_Integer ((SD ((-X) / Base), SD ((-X) mod Base)), True); -- Positive numbers else return Allocate_Big_Integer ((SD (X / Base), SD (X mod Base)), False); end if; end To_Bignum; function To_Bignum (X : Unsigned_64) return Big_Integer is begin if X = 0 then return Allocate_Big_Integer ((1 .. 0 => <>), False); -- One word result elsif X < 2 ** 32 then return Allocate_Big_Integer ((1 => SD (X)), False); -- Two word result else return Allocate_Big_Integer ((SD (X / Base), SD (X mod Base)), False); end if; end To_Bignum; --------------- -- To_String -- --------------- Hex_Chars : constant array (0 .. 15) of Character := "0123456789ABCDEF"; function To_String (X : Bignum; Width : Natural := 0; Base : Positive := 10) return String is Big_Base : aliased Bignum_Data := (1, False, (1 => SD (Base))); function Add_Base (S : String) return String; -- Add base information if Base /= 10 function Leading_Padding (Str : String; Min_Length : Natural; Char : Character := ' ') return String; -- Return padding of Char concatenated with Str so that the resulting -- string is at least Min_Length long. function Image (Arg : Bignum) return String; -- Return image of Arg, assuming Arg is positive. function Image (N : Natural) return String; -- Return image of N, with no leading space. -------------- -- Add_Base -- -------------- function Add_Base (S : String) return String is begin if Base = 10 then return S; else return Image (Base) & "#" & S & "#"; end if; end Add_Base; ----------- -- Image -- ----------- function Image (N : Natural) return String is S : constant String := Natural'Image (N); begin return S (2 .. S'Last); end Image; function Image (Arg : Bignum) return String is begin if Big_LT (Arg, Big_Base'Unchecked_Access) then return (1 => Hex_Chars (Natural (From_Bignum (Arg)))); else declare Div : aliased Big_Integer; Remain : aliased Big_Integer; R : Natural; begin Div_Rem (Arg, Big_Base'Unchecked_Access, Div, Remain); R := Natural (From_Bignum (To_Bignum (Remain))); Free_Big_Integer (Remain); return S : constant String := Image (To_Bignum (Div)) & Hex_Chars (R) do Free_Big_Integer (Div); end return; end; end if; end Image; --------------------- -- Leading_Padding -- --------------------- function Leading_Padding (Str : String; Min_Length : Natural; Char : Character := ' ') return String is begin return (1 .. Integer'Max (Integer (Min_Length) - Str'Length, 0) => Char) & Str; end Leading_Padding; Zero : aliased Bignum_Data := (0, False, D => Zero_Data); begin if Big_LT (X, Zero'Unchecked_Access) then declare X_Pos : aliased Bignum_Data := (X.Len, not X.Neg, X.D); begin return Leading_Padding ("-" & Add_Base (Image (X_Pos'Unchecked_Access)), Width); end; else return Leading_Padding (" " & Add_Base (Image (X)), Width); end if; end To_String; ------------- -- Is_Zero -- ------------- function Is_Zero (X : Bignum) return Boolean is (X /= null and then X.D = Zero_Data); end System.Generic_Bignums;
programs/oeis/241/A241219.asm
karttu/loda
1
89514
<filename>programs/oeis/241/A241219.asm ; A241219: Number of ways to choose two points on a centered hexagonal grid of size n. ; 0,21,171,666,1830,4095,8001,14196,23436,36585,54615,78606,109746,149331,198765,259560,333336,421821,526851,650370,794430,961191,1152921,1371996,1620900,1902225,2218671,2573046,2968266,3407355,3893445,4429776,5019696,5666661,6374235,7146090,7986006,8897871,9885681,10953540,12105660,13346361,14680071,16111326,17644770,19285155,21037341,22906296,24897096,27014925,29265075,31652946,34184046,36863991,39698505,42693420,45854676,49188321,52700511,56397510,60285690,64371531,68661621,73162656,77881440,82824885,88000011,93413946,99073926,104987295,111161505,117604116,124322796,131325321,138619575,146213550,154115346,162333171,170875341,179750280,188966520,198532701,208457571,218749986,229418910,240473415,251922681,263775996,276042756,288732465,301854735,315419286,329435946,343914651,358865445,374298480,390224016,406652421,423594171,441059850,459060150,477605871,496707921,516377316,536625180,557462745,578901351,600952446,623627586,646938435,670896765,695514456,720803496,746775981,773444115,800820210,828916686,857746071,887321001,917654220,948758580,980647041,1013332671,1046828646,1081148250,1116304875,1152312021,1189183296,1226932416,1265573205,1305119595,1345585626,1386985446,1429333311,1472643585,1516930740,1562209356,1608494121,1655799831,1704141390,1753533810,1803992211,1855531821,1908167976,1961916120,2016791805,2072810691,2129988546,2188341246,2247884775,2308635225,2370608796,2433821796,2498290641,2564031855,2631062070,2699398026,2769056571,2840054661,2912409360,2986137840,3061257381,3137785371,3215739306,3295136790,3375995535,3458333361,3542168196,3627518076,3714401145,3802835655,3892839966,3984432546,4077631971,4172456925,4268926200,4367058696,4466873421,4568389491,4671626130,4776602670,4883338551,4991853321,5102166636,5214298260,5328268065,5444096031,5561802246,5681406906,5802930315,5926392885,6051815136,6179217696,6308621301,6440046795,6573515130,6709047366,6846664671,6986388321,7128239700,7272240300,7418411721,7566775671,7717353966,7870168530,8025241395,8182594701,8342250696,8504231736,8668560285,8835258915,9004350306,9175857246,9349802631,9526209465,9705100860,9886500036,10070430321,10256915151,10445978070,10637642730,10831932891,11028872421,11228485296,11430795600,11635827525,11843605371,12054153546,12267496566,12483659055,12702665745,12924541476,13149311196,13376999961,13607632935,13841235390,14077832706,14317450371,14560113981,14805849240,15054681960,15306638061,15561743571,15820024626,16081507470,16346218455,16614184041,16885430796,17159985396,17437874625 add $0,1 bin $0,2 mov $1,$0 mov $2,6 mul $2,$0 mul $0,$2 add $1,$0 mul $1,3
programs/oeis/345/A345668.asm
neoneye/loda
22
102457
<gh_stars>10-100 ; A345668: Last prime minus distance to last prime. ; 1,2,1,4,3,6,5,4,3,10,9,12,11,10,9,16,15,18,17,16,15,22,21,20,19,18,17,28,27,30,29,28,27,26,25,36,35,34,33,40,39,42,41,40,39,46,45,44,43,42,41,52,51,50,49,48,47,58,57,60,59,58,57,56,55,66,65,64 add $0,1 mov $1,2 sub $1,$0 seq $0,175851 ; a(n) = 1 for noncomposite n, a(n) = n - previousprime(n) + 1 for composite n. add $1,$0 add $0,$1 mov $1,138100 sub $1,$0 sub $1,138096 mov $0,$1
P6/data_P6_2/MDTest132.asm
alxzzhou/BUAA_CO_2020
1
96200
ori $ra,$ra,0xf addu $6,$4,$2 multu $0,$1 sll $3,$3,14 addiu $0,$6,28752 divu $4,$ra addiu $5,$1,-12106 srav $4,$4,$3 mflo $6 mult $3,$0 mtlo $1 lui $4,40975 addiu $4,$1,-30801 addiu $4,$4,-18330 mtlo $0 ori $5,$1,32393 mflo $4 lui $1,47290 ori $5,$5,10774 div $4,$ra lb $2,13($0) sb $0,7($0) mtlo $4 lb $4,1($0) mtlo $0 div $4,$ra sb $1,16($0) addu $2,$2,$2 mflo $5 addiu $2,$5,7627 divu $4,$ra divu $5,$ra divu $5,$ra mfhi $4 lb $1,8($0) mfhi $6 lb $4,15($0) addiu $0,$0,4025 mtlo $5 mflo $4 mult $3,$5 multu $4,$4 addiu $2,$2,-4457 mthi $4 ori $4,$2,60638 mfhi $0 mthi $1 div $1,$ra sb $3,14($0) mflo $3 sll $3,$3,5 mthi $6 srav $4,$1,$0 mflo $1 addiu $5,$1,-7601 sb $1,1($0) sb $0,0($0) addu $6,$0,$6 srav $1,$1,$1 lb $2,1($0) mtlo $0 mult $4,$1 lui $2,46924 sb $0,9($0) lui $1,26313 srav $5,$4,$4 lui $4,46243 addu $1,$1,$4 mult $3,$5 multu $1,$2 mthi $1 sll $3,$6,14 sb $6,13($0) lui $1,48123 mfhi $1 mult $4,$2 sb $5,8($0) ori $2,$2,15181 mflo $0 ori $5,$0,51528 sll $4,$1,17 sb $1,0($0) mtlo $1 sb $4,13($0) mult $2,$5 mult $1,$6 lui $0,53890 sb $1,14($0) multu $1,$2 mflo $0 addiu $0,$0,24602 sll $1,$4,7 lb $4,10($0) sll $5,$5,23 mfhi $1 addu $4,$2,$2 multu $5,$4 mtlo $2 addiu $1,$2,-6473 mfhi $4 addu $4,$2,$3 mfhi $6 addiu $4,$5,22937 mthi $4 lui $4,49818 sb $5,14($0) addu $1,$2,$2 mflo $2 mtlo $0 lui $0,5730 addiu $0,$2,14419 addu $2,$2,$5 mult $5,$5 mfhi $4 sb $4,3($0) addu $6,$4,$2 multu $0,$0 mflo $1 div $0,$ra sb $0,9($0) addu $5,$1,$2 mfhi $4 lb $3,12($0) srav $5,$1,$4 addu $0,$0,$1 lb $3,6($0) mtlo $1 lui $0,43994 mtlo $1 ori $0,$1,20950 lui $1,47787 multu $1,$6 divu $4,$ra mflo $4 sll $1,$6,24 ori $1,$1,44120 mthi $0 mflo $2 ori $5,$4,58226 addiu $4,$4,28509 sll $4,$0,27 sll $1,$0,10 mtlo $3 addu $6,$4,$3 lb $1,10($0) srav $0,$5,$3 srav $6,$4,$6 sll $6,$5,11 divu $4,$ra srav $4,$2,$0 mflo $1 divu $5,$ra ori $5,$5,30701 sll $5,$1,4 lui $5,3319 mthi $4 mthi $2 mult $4,$0 lui $4,64945 sb $2,6($0) ori $0,$4,31025 mult $2,$2 sll $1,$2,28 mtlo $1 sb $4,5($0) mult $0,$5 divu $5,$ra mthi $4 lb $6,8($0) mflo $0 ori $4,$0,27688 lb $5,0($0) mtlo $1 sb $4,0($0) addu $4,$3,$3 mflo $6 lui $6,47180 mult $4,$1 sb $0,0($0) mfhi $5 addu $1,$2,$2 divu $4,$ra addu $4,$4,$1 lui $2,14862 lui $5,27028 mult $6,$2 divu $3,$ra div $4,$ra mflo $4 sb $4,12($0) addiu $1,$0,-27916 addu $5,$1,$5 sb $5,15($0) multu $1,$1 div $1,$ra div $0,$ra ori $3,$4,34126 mtlo $4 multu $4,$4 sb $6,15($0) multu $1,$1 srav $5,$5,$5 multu $5,$1 lui $1,17775 sll $4,$5,17 sb $4,14($0) ori $3,$4,53370 addu $0,$6,$1 lb $5,4($0) sll $3,$3,13 mult $1,$1 mtlo $3 div $6,$ra mfhi $4 lui $6,35925 mflo $1 sb $1,16($0) addu $4,$3,$3 addiu $3,$3,-20888 lb $4,3($0) sll $2,$2,27 multu $6,$2 lui $0,1127 ori $2,$2,35733 mthi $1 sll $0,$2,4 addiu $3,$3,4437 mthi $6 mfhi $4 div $5,$ra sb $4,7($0) div $4,$ra divu $6,$ra sb $5,3($0) div $0,$ra lb $4,0($0) mflo $3 ori $4,$2,61602 mfhi $1 addiu $4,$5,-3950 mult $0,$2 sll $5,$2,24 addiu $5,$6,2774 srav $1,$0,$1 mult $1,$2 mflo $0 mflo $4 multu $4,$5 mtlo $4 ori $4,$4,14070 addiu $5,$1,-11472 mtlo $1 mflo $5 div $1,$ra addu $4,$4,$1 mult $5,$5 mtlo $6 mflo $6 ori $5,$5,45371 mtlo $4 sll $3,$5,9 lui $4,52966 mthi $5 divu $1,$ra mflo $0 div $4,$ra ori $0,$6,48186 mthi $4 div $5,$ra sll $4,$1,1 mflo $5 multu $6,$1 lui $5,23387 ori $4,$1,60075 ori $5,$6,59110 mfhi $4 srav $0,$2,$3 mtlo $2 sll $1,$0,14 ori $4,$2,29894 sll $5,$6,20 ori $3,$3,33604 addiu $4,$4,1289 addiu $5,$5,-8019 addiu $1,$5,-8550 lb $3,13($0) mult $5,$5 lui $6,63747 addiu $4,$1,-22135 mtlo $1 lb $4,3($0) srav $4,$4,$3 addiu $5,$2,-7662 sb $1,0($0) mtlo $4 srav $2,$0,$2 lb $6,11($0) mtlo $4 multu $1,$1 mtlo $4 ori $0,$4,56552 sb $3,11($0) mthi $0 sb $6,4($0) lui $4,18514 sb $0,12($0) mthi $6 sb $4,8($0) srav $5,$5,$5 addiu $4,$4,23294 multu $5,$6 sb $0,7($0) mtlo $1 div $6,$ra mtlo $4 divu $0,$ra lui $0,15376 ori $5,$5,7205 ori $4,$5,45008 divu $4,$ra divu $1,$ra mflo $4 sb $6,2($0) sb $1,12($0) addiu $5,$2,-17254 mfhi $0 addiu $0,$4,-2593 multu $4,$1 sb $1,0($0) mfhi $1 mflo $2 mfhi $4 mult $4,$4 lui $4,15293 divu $3,$ra lb $0,7($0) divu $3,$ra div $0,$ra lb $4,13($0) sll $5,$5,23 div $1,$ra mflo $4 lb $6,7($0) sll $1,$2,7 mthi $4 mthi $1 mthi $2 mtlo $1 div $4,$ra mult $5,$4 addiu $5,$2,-3531 mflo $0 mult $1,$1 addiu $4,$2,-4869 mthi $1 lui $5,11359 sll $2,$2,4 addiu $5,$2,9217 mflo $0 mflo $0 mtlo $5 addu $4,$4,$4 multu $5,$5 addu $1,$2,$3 div $4,$ra sb $4,6($0) mthi $2 sll $5,$5,23 lui $6,47538 srav $5,$5,$5 mfhi $0 srav $3,$3,$3 addiu $2,$2,11563 sb $4,10($0) lb $5,13($0) lb $2,6($0) mflo $1 mthi $4 mthi $3 mult $6,$4 multu $4,$5 addu $4,$4,$5 div $1,$ra mflo $5 mflo $5 srav $1,$3,$3 multu $2,$2 sb $6,5($0) sll $5,$5,16 mfhi $2 ori $2,$5,59760 lui $2,56260 mthi $4 srav $3,$1,$3 addu $3,$1,$3 mthi $6 addu $3,$0,$3 lb $2,12($0) sb $2,7($0) multu $4,$4 mthi $5 mtlo $2 addu $4,$0,$1 lb $3,3($0) lui $1,24471 multu $6,$4 addu $6,$6,$4 mthi $2 mult $5,$6 mult $4,$5 multu $2,$2 lui $2,17031 lb $4,3($0) lui $4,15991 ori $3,$4,5740 addu $4,$2,$5 multu $1,$2 lb $1,3($0) sb $4,8($0) sll $6,$2,5 sll $5,$5,0 lui $4,47455 sll $0,$2,22 multu $6,$4 lui $5,33020 mthi $6 srav $1,$4,$1 mfhi $4 mfhi $4 mfhi $2 multu $2,$2 lb $4,6($0) addiu $4,$4,22379 lui $2,46072 mult $4,$4 mtlo $6 sb $5,2($0) srav $4,$0,$0 multu $6,$1 addiu $1,$1,-24445 ori $0,$0,27315 ori $4,$4,38317 lb $6,6($0) mflo $2 lb $1,10($0) sb $5,12($0) sb $3,8($0) lui $4,48799 divu $3,$ra lb $0,13($0) addu $4,$4,$4 ori $2,$2,33977 mthi $1 srav $4,$4,$5 divu $4,$ra mfhi $5 mfhi $6 addu $6,$0,$4 mthi $5 mflo $4 mthi $5 ori $4,$2,35377 addu $5,$2,$1 mflo $4 ori $4,$1,52437 sll $5,$5,10 sb $1,5($0) sll $2,$2,23 mult $2,$1 mult $4,$4 addu $5,$5,$2 div $1,$ra sb $4,5($0) sb $4,7($0) addiu $5,$4,-2759 mflo $1 mult $0,$0 srav $1,$4,$1 mfhi $1 ori $1,$1,27754 divu $4,$ra addiu $1,$0,-714 mfhi $3 sll $4,$4,20 sb $3,2($0) lb $5,8($0) divu $3,$ra multu $0,$5 div $4,$ra sll $5,$5,19 mthi $0 mthi $3 addiu $1,$2,17780 srav $5,$0,$3 mthi $2 addu $4,$1,$1 addiu $6,$6,-15459 addu $4,$2,$4 lb $1,6($0) multu $1,$2 sb $3,11($0) mthi $2 mfhi $5 mflo $2 div $5,$ra sb $2,1($0) mtlo $5 divu $4,$ra mtlo $6 lb $1,3($0) lui $0,63004 mthi $1 mthi $4 addiu $5,$4,-18813 mflo $6 div $5,$ra addu $4,$4,$4 mflo $4 mfhi $4 mult $2,$1 srav $4,$4,$4 sb $0,6($0) srav $0,$1,$3 srav $3,$4,$3 ori $3,$3,18991 mflo $3 srav $5,$0,$1 div $4,$ra sb $2,2($0) lui $0,35019 mfhi $5 mfhi $6 addiu $4,$4,-8410 ori $1,$6,24974 sll $3,$5,17 sll $5,$2,3 sb $5,1($0) sb $2,4($0) divu $3,$ra srav $1,$4,$6 mfhi $4 divu $6,$ra multu $5,$0 sll $1,$5,24 mtlo $5 sb $5,12($0) lui $0,55612 sll $4,$4,20 multu $1,$4 divu $4,$ra srav $1,$3,$3 lui $4,8888 div $4,$ra srav $5,$4,$2 div $4,$ra div $1,$ra mflo $4 sb $2,6($0) addu $6,$4,$4 mult $3,$3 addiu $4,$3,20051 mthi $4 div $4,$ra addiu $4,$4,28252 sll $0,$5,0 addiu $0,$0,-2581 lui $5,16396 mthi $5 addu $4,$4,$4 mult $1,$1 lui $6,36232 lui $5,59708 multu $1,$4 mflo $6 lb $1,12($0) divu $2,$ra mtlo $3 srav $4,$6,$6 mult $4,$2 sb $1,13($0) srav $4,$4,$2 sb $2,5($0) multu $0,$0 mflo $4 srav $1,$4,$2 addiu $6,$6,7857 addiu $1,$6,25833 mflo $4 divu $5,$ra ori $1,$6,34283 srav $4,$5,$5 mfhi $3 mflo $1 ori $1,$5,56606 div $1,$ra mtlo $3 mtlo $5 mflo $6 addu $4,$2,$3 mtlo $1 mult $4,$1 mult $4,$5 multu $5,$5 mthi $4 mfhi $3 divu $6,$ra lui $1,45410 divu $4,$ra divu $1,$ra mfhi $4 mthi $3 mtlo $0 sll $5,$5,21 multu $4,$3 mfhi $5 addu $6,$1,$6 sb $5,7($0) lb $5,6($0) mfhi $3 sb $5,0($0) sb $2,11($0) lui $4,40755 srav $5,$4,$1 mult $1,$4 mult $4,$1 sb $4,5($0) addu $2,$5,$2 mult $4,$4 multu $4,$0 lui $4,59771 multu $1,$2 ori $6,$4,26978 div $5,$ra srav $1,$6,$4 divu $5,$ra addu $4,$1,$4 mflo $4 lui $4,60491 ori $0,$5,35541 sb $0,8($0) srav $4,$0,$4 ori $1,$1,48038 srav $0,$4,$4 lb $1,12($0) divu $4,$ra mtlo $4 addiu $4,$0,-32264 mflo $1 mtlo $4 addu $5,$6,$5 lui $1,11361 ori $2,$2,5380 mthi $5 addu $5,$4,$4 addu $0,$5,$5 divu $4,$ra mthi $6 mthi $2 addu $1,$1,$6 mfhi $1 lb $5,7($0) mthi $0 divu $0,$ra srav $2,$2,$2 mtlo $2 mult $5,$5 mfhi $4 srav $2,$2,$2 mtlo $4 srav $4,$5,$5 lui $1,62870 divu $6,$ra mult $4,$4 mthi $5 sll $6,$6,27 sb $4,14($0) mthi $3 multu $4,$1 mtlo $4 mflo $4 ori $4,$6,64912 mflo $2 multu $5,$4 mult $3,$6 sb $0,3($0) sll $4,$2,7 addiu $5,$4,-23522 lui $1,43019 lui $4,27024 lui $1,15866 multu $0,$0 srav $6,$4,$6 addiu $1,$6,3414 lb $6,16($0) mult $4,$1 mflo $5 sb $4,10($0) addu $4,$5,$5 addiu $4,$2,8219 mthi $1 mflo $3 mthi $6 mfhi $1 addiu $4,$4,-20729 mthi $2 sll $5,$4,30 sb $0,0($0) multu $1,$0 addu $5,$2,$5 div $1,$ra sb $1,4($0) multu $3,$2 sb $0,16($0) mfhi $0 ori $6,$6,37377 addu $1,$2,$4 multu $5,$0 mthi $6 ori $5,$4,44633 divu $1,$ra mult $1,$0 lb $1,6($0) divu $3,$ra sll $1,$5,0 mtlo $4 mtlo $5 addu $4,$6,$3 lb $5,3($0) lb $2,16($0) srav $6,$1,$3 mtlo $4 addu $3,$0,$3 addiu $4,$2,18323 mfhi $4 mfhi $4 srav $4,$0,$0 ori $0,$1,30783 mflo $2 mflo $4 srav $5,$5,$3 addu $1,$5,$1 addiu $6,$5,17925 divu $5,$ra ori $4,$4,43584 mfhi $4 divu $0,$ra multu $4,$4 ori $1,$5,38395 mult $1,$2 sb $4,1($0) div $4,$ra lui $4,18053 mflo $1 sll $4,$2,7 div $0,$ra lui $1,46315 mflo $1 mthi $5 mfhi $2 lb $5,8($0) lb $5,10($0) divu $3,$ra mtlo $1 srav $4,$4,$4 mfhi $5 sb $4,7($0) divu $0,$ra mfhi $1 mflo $3 mthi $2 div $5,$ra sll $4,$2,25 lb $2,3($0) divu $4,$ra lb $1,3($0) multu $4,$0 lb $4,8($0) mthi $4 sb $1,13($0) lb $5,1($0) div $5,$ra mtlo $6 sll $6,$4,1 multu $0,$1 addiu $6,$2,27710 addu $5,$5,$4 srav $5,$4,$5 addu $4,$4,$4 multu $5,$1 addu $4,$4,$3 addu $1,$1,$2 mtlo $6 mthi $1 multu $2,$1 sb $5,5($0) mfhi $3 lb $4,2($0) divu $1,$ra ori $2,$2,13954 mtlo $5 addu $0,$6,$6 mflo $2 srav $4,$4,$0 multu $5,$5 addiu $5,$3,26410 addu $0,$6,$3 multu $2,$2 div $5,$ra ori $3,$4,11640 sb $4,7($0) addu $4,$4,$0 addiu $1,$1,12530 mtlo $3 divu $4,$ra mfhi $4 div $5,$ra div $4,$ra mult $1,$5 divu $5,$ra mthi $5 addiu $2,$5,17592 multu $4,$4 multu $2,$2 lb $2,8($0) addiu $1,$4,-12752 div $1,$ra lb $6,15($0) mflo $5 sll $5,$6,16 addiu $1,$1,32642 sll $1,$4,11 divu $1,$ra multu $3,$3 addu $6,$2,$3 mflo $4 mfhi $5 mult $4,$4 div $5,$ra mthi $3 addiu $1,$2,7409 lui $4,58293 lb $1,14($0) mthi $3 sll $0,$0,28 lui $0,2027 lui $4,1881 srav $4,$5,$3 mflo $1 lb $3,9($0) sb $1,15($0) divu $0,$ra addu $6,$5,$5 lb $2,11($0) mthi $3 mthi $1 ori $3,$2,49523 sb $4,5($0) mthi $5 mult $5,$5 div $3,$ra lui $4,36709 sb $6,5($0) multu $6,$1 divu $5,$ra mfhi $1 addiu $5,$2,9109 mult $5,$5 multu $1,$1 div $1,$ra lui $2,29033 mthi $2 ori $3,$4,7302 lui $0,14545 mfhi $6 mthi $0 ori $6,$2,42490 sb $4,13($0) mthi $1 multu $1,$1 mult $5,$2 lb $0,4($0) addiu $1,$1,-27070 mult $1,$6 ori $5,$5,16167 sb $4,10($0) lb $1,3($0) sb $1,15($0) ori $4,$2,61762 addu $4,$4,$1
test/Fail/CopatternsSplitErrorWithUnboundDBIndex.agda
cruhland/agda
1,989
5924
-- Andreas, 2013-10-26 -- What if user tried to eliminate function type by copattern? {-# OPTIONS --copatterns #-} -- {-# OPTIONS -v tc.lhs.split:30 #-} module CopatternsSplitErrorWithUnboundDBIndex where import Common.Level record _×_ (A B : Set) : Set where constructor _,_ field fst : A snd : B open _×_ -- pair defined by copatterns test : {A B : Set} → A → A → A × A fst test a = a snd test a = a -- Bad error WAS: -- An internal error has occurred. Please report this as a bug. -- Location of the error: src/full/Agda/TypeChecking/Rules/LHS.hs:250 -- Correct error: -- Cannot eliminate type A → A → A × A with projection pattern fst -- when checking that the clause fst test a = a has type -- {A : Set} → {Set} → A → A → A × A -- -- pair defined by copatterns pair : {A B : Set} → A → B → A × B fst pair a b = a snd pair a b = b -- Bad error WAS: Unbound index in error message: -- -- Cannot eliminate type @3 × A with pattern b (did you supply too many arguments?) -- when checking that the clause fst pair a b = a has type -- {A B : Set} → A → B → A × B
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1025.asm
ljhsiun2/medusa
9
16885
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_normal_ht+0x19959, %r14 nop xor %r8, %r8 movb $0x61, (%r14) inc %r8 lea addresses_A_ht+0x195d9, %r13 nop nop nop nop xor $24779, %r12 mov (%r13), %rcx nop nop nop nop nop sub %r14, %r14 lea addresses_WC_ht+0x14ff9, %rsi nop sub %rdi, %rdi movw $0x6162, (%rsi) nop add %rcx, %rcx lea addresses_normal_ht+0x11159, %rsi lea addresses_UC_ht+0x16681, %rdi clflush (%rsi) nop nop nop xor $35951, %r15 mov $24, %rcx rep movsq nop nop nop inc %r14 lea addresses_WC_ht+0x97d9, %rcx nop nop nop nop nop cmp $58788, %r14 mov (%rcx), %si cmp %rdi, %rdi lea addresses_A_ht+0x7077, %rsi lea addresses_UC_ht+0x13a81, %rdi nop nop cmp $11102, %r14 mov $120, %rcx rep movsl nop nop nop xor $60384, %rcx lea addresses_WC_ht+0x5f09, %rcx nop nop nop cmp $16083, %r14 mov $0x6162636465666768, %rdi movq %rdi, %xmm0 movups %xmm0, (%rcx) nop nop nop nop nop cmp %r15, %r15 lea addresses_D_ht+0x6759, %r12 nop nop dec %r14 mov $0x6162636465666768, %rcx movq %rcx, %xmm0 vmovups %ymm0, (%r12) nop nop inc %r12 lea addresses_D_ht+0xd2d9, %rcx and $58007, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm3 movups %xmm3, (%rcx) nop nop nop nop nop inc %r8 lea addresses_WC_ht+0xa0d9, %rsi lea addresses_WC_ht+0x11759, %rdi xor %r15, %r15 mov $55, %rcx rep movsb nop nop nop nop nop dec %rsi lea addresses_UC_ht+0x15759, %rsi lea addresses_WC_ht+0x5fd9, %rdi nop nop nop nop inc %r8 mov $21, %rcx rep movsl nop nop dec %r14 lea addresses_UC_ht+0x1ab59, %rsi lea addresses_WT_ht+0x1c359, %rdi nop nop nop nop nop xor $62146, %r8 mov $82, %rcx rep movsw nop nop sub %r13, %r13 lea addresses_UC_ht+0xad98, %rcx nop nop nop nop nop cmp $952, %r15 mov $0x6162636465666768, %r14 movq %r14, %xmm5 movups %xmm5, (%rcx) nop nop sub %r14, %r14 lea addresses_UC_ht+0xa1d9, %rsi lea addresses_WC_ht+0xa359, %rdi nop nop nop nop sub $27643, %r14 mov $127, %rcx rep movsq nop nop nop nop nop cmp $45384, %r13 lea addresses_WT_ht+0xd1d9, %rsi lea addresses_WC_ht+0x16bdb, %rdi nop nop nop nop nop xor %r12, %r12 mov $111, %rcx rep movsl nop dec %r12 pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r9 push %rbx push %rsi // Faulty Load lea addresses_PSE+0xf759, %r12 and %rsi, %rsi movb (%r12), %bl lea oracles, %rsi and $0xff, %rbx shlq $12, %rbx mov (%rsi,%rbx,1), %rbx pop %rsi pop %rbx pop %r9 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 2, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': True, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
oeis/255/A255178.asm
neoneye/loda-programs
11
169192
<filename>oeis/255/A255178.asm<gh_stars>10-100 ; A255178: Second differences of eighth powers (A001016). ; 1,254,6050,52670,266114,963902,2796194,6927230,15257090,30683774,57405602,101263934,170126210,274309310,427043234,644975102,948713474,1363412990,1919399330,2652834494,3606422402,4830154814,6382097570,8329217150,10748247554,13726597502,17363297954,21769989950,27071952770,33409172414,40937450402,49829552894,60276400130,72488296190,86696199074,103153031102,122135029634,143943138110,168904437410,197373617534,229734489602,266401538174,307821513890,354475066430,406878417794,465585075902,531187588514 mov $1,$0 trn $1,1 mov $6,$0 sub $0,$1 add $0,1 mov $3,$6 mov $5,$6 lpb $3 sub $3,1 add $4,$5 lpe mov $2,56 mov $5,$4 lpb $2 add $0,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $3,$6 mov $5,$4 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,140 mov $5,$4 lpb $2 add $0,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $3,$6 mov $5,$4 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,56 mov $5,$4 lpb $2 add $0,$5 sub $2,1 lpe
.emacs.d/elpa/ada-mode-5.3.1/gps_source/generic_stack.adb
caqg/linux-home
0
28207
<gh_stars>0 ------------------------------------------------------------------------------ -- G P S -- -- -- -- Copyright (C) 2001-2016, AdaCore -- -- -- -- This 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. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY 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 this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; package body Generic_Stack is procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Type_Array, Type_Array_Access); ----------- -- Clear -- ----------- procedure Clear (Stack : in out Simple_Stack) is begin Unchecked_Free (Stack.Values); Stack.Last := 0; end Clear; ---------- -- Push -- ---------- Minimal_Array_Length : constant := 64; -- Minimal length to allocate on an array procedure Push (Stack : in out Simple_Stack; Value : Generic_Type) is Tmp : Type_Array_Access; begin if Stack.Values = null then Stack.Values := new Type_Array (1 .. Minimal_Array_Length); elsif Stack.Last >= Stack.Values'Last then Tmp := Stack.Values; Stack.Values := new Type_Array (1 .. Tmp'Length * 2); Stack.Values (Tmp'Range) := Tmp.all; Unchecked_Free (Tmp); end if; Stack.Last := Stack.Last + 1; Stack.Values (Stack.Last) := Value; end Push; --------- -- Pop -- --------- procedure Pop (Stack : in out Simple_Stack; Value : out Generic_Type) is begin if Stack.Last = 0 then raise Stack_Empty; else Value := Stack.Values (Stack.Last); Stack.Last := Stack.Last - 1; end if; end Pop; procedure Pop (Stack : in out Simple_Stack) is Value : Generic_Type; begin Pop (Stack, Value); end Pop; --------- -- Top -- --------- function Top (Stack : Simple_Stack) return Generic_Type_Access is begin if Stack.Last = 0 then raise Stack_Empty; else return Stack.Values (Stack.Last)'Access; end if; end Top; ---------- -- Next -- ---------- function Next (Stack : Simple_Stack) return Generic_Type_Access is begin if Stack.Last <= 1 then return null; else return Stack.Values (Stack.Last - 1)'Access; end if; end Next; -------------- -- Is_Empty -- -------------- function Is_Empty (Stack : Simple_Stack) return Boolean is begin return Stack.Last = 0; end Is_Empty; -------------------- -- Traverse_Stack -- -------------------- procedure Traverse_Stack (Stack : Simple_Stack; Callback : access function (Obj : Generic_Type) return Boolean) is begin for J in 1 .. Stack.Last loop exit when not Callback (Stack.Values (J)); end loop; end Traverse_Stack; end Generic_Stack;
Bitmaps/src/bitmaps-io.ads
kochab/simulatedannealing-ada
0
15305
<filename>Bitmaps/src/bitmaps-io.ads with Ada.Streams; with Bitmaps.RGB; package Bitmaps.IO is procedure Write_PPM_P6(To : not null access Ada.Streams.Root_Stream_Type'Class; Source : in Bitmaps.RGB.Image); end Bitmaps.IO;