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
|
---|---|---|---|---|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca_notsx.log_21829_883.asm
|
ljhsiun2/medusa
| 9 |
178624
|
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca_notsx.log_21829_883.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %rdi
push %rdx
lea addresses_A_ht+0xd7ff, %rdx
nop
nop
nop
nop
nop
cmp %rdi, %rdi
movw $0x6162, (%rdx)
nop
nop
nop
add $22971, %rdi
pop %rdx
pop %rdi
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x2105, %rcx
nop
nop
nop
nop
xor %r12, %r12
mov $0x5152535455565758, %r10
movq %r10, (%rcx)
nop
nop
xor $22484, %rcx
// Store
lea addresses_RW+0x1ec43, %r11
nop
nop
cmp $53337, %rdi
movw $0x5152, (%r11)
nop
nop
nop
nop
nop
cmp %rbp, %rbp
// Store
lea addresses_US+0xcf9e, %rdi
nop
and %rcx, %rcx
movl $0x51525354, (%rdi)
nop
nop
nop
nop
dec %rcx
// Store
mov $0x49375e000000008b, %rbp
nop
nop
nop
sub $53249, %r11
mov $0x5152535455565758, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rbp)
and $23683, %r11
// Store
lea addresses_WT+0x1353, %r12
nop
nop
nop
and $18008, %rsi
mov $0x5152535455565758, %r11
movq %r11, (%r12)
nop
nop
nop
nop
add $23717, %rbp
// Store
lea addresses_D+0x17d2b, %rbp
nop
nop
cmp %rdi, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
movups %xmm5, (%rbp)
nop
nop
nop
xor $17483, %rdi
// Faulty Load
mov $0x62611c0000000e53, %r10
clflush (%r10)
nop
sub %rdi, %rdi
movb (%r10), %r12b
lea oracles, %r10
and $0xff, %r12
shlq $12, %r12
mov (%r10,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'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
*/
|
linux/calc.asm
|
zhyhang/asm-misc
| 0 |
162407
|
<filename>linux/calc.asm<gh_stars>0
;author - http://github.com/flouthoc
;Contributers - Add your name here
;; ----------------- calc.asm - Minimal arithmetic calculator in x86 assembly -------------------
section .data
FEW_ARGS: db "Too Few Arguments", 0xA
INVALID_OPERATOR: db "Invalid Operator", 0xA
INVALID_OPERAND: db "Invalid Operand", 0XA
BYTE_BUFFER: times 10 db 0 ;It's just a memory to size 10 , each slot holds the value 0
section .text
global _start:
_start:
mov rbp, rsp; for correct debugging
pop rdx ;put argc in rdx from the stack, so we can check number of arguments
cmp rdx, 4 ;compare the number of arguments against 4
jne few_args ; if number of arguments is less than 4 (i.e. [program-name] <operator> <operand1> <operand2>) go to error block - prompt 'FEW_ARGS' and exit
add rsp, 8 ; skip over argv[0], the programme name - rsp is now pointing at argv[1] (4 bytes + 4 bytes = 8)
pop rsi ;let's pop our first argument (i.e argv[1]) from argument stack which is our operand
;This is part is all checking part which switches the block according to our <operand> + - / *
cmp byte[rsi], 0x2A ;If operator is '*' then goto block multiplication , can be used only if escaped manually while giving input
je multiplication
cmp byte[rsi], 0x78 ;If operator is 'x' then goto block multiplication , cause you know some shells or every have '*' as wildcard
je multiplication
cmp byte[rsi], 0x2B ;If operator is '+' then goto block addition
je addition
cmp byte[rsi], 0x2D ;If operator is '-' then goto block subtraction
je subtraction
cmp byte[rsi], 0x2F ;If operator is '/' then goto block division
je division
cmp byte[rsi], 0x25 ;If operator is '%' then goto block modulo
je modulo
;If <operator> does not match to any case then goto block invalid_operator
jmp invalid_operator ; go to error block - prompt 'Invalid Operator' and exit
addition:
pop rsi ;Let's Pop our second argument (i.e argv[2]) from argument stack which is our <operand1>
;Well even if it is a number it is in its ASCII code representation lets convert it to our actual integer
;This is function will take number in its ASCII form (rsi as argument) and return its integer equivalent in rax
call char_to_int
mov r10, rax ;Lets store integer equivalent of <operand1> in r10
pop rsi ;Let's Pop our third argument (i.e argv[3]) from argument stack which is our <operand2>
call char_to_int ;Do same for <operand2>
add rax, r10 ;Let's add them integer equivalent of <operand1> and integer equivalent of <operand2>
jmp print_result ;Throw cursor at block print cursor, which will print the result
;Same thing we are doing in block subtraction , multiplication and division
subtraction:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
sub r10, rax
mov rax, r10
jmp print_result
multiplication:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mul r10
jmp print_result
division:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mov r11, rax
mov rax, r10
mov rdx, 0
div r11 ;Divide the value in rax (implied by 'div') by r11
jmp print_result
modulo:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mov r11, rax
mov rax, r10
mov rdx, 0
div r11
mov rax, rdx ;Move the remainder into rax
jmp print_result
;This block is responsible for printing the content to the screen
;you have to store your content in rax and jump to it , it'll do the rest :)
print_result:
;This function will convert our integer in rax back to ASCII format (character)
; Argument - takes integer to be converted (must be stored in rax)
; Returns pointer to the char string (returns r9 as pointer to the string or char)
call int_to_char
mov rax, 1 ;Store syscall number , 1 is for sys_write
mov rdi, 1 ;Descriptor where we want to write , 1 is for stdout
mov rsi, r9 ;This is pointer to the string which was returned by int_to_char
mov rdx, r11 ;r11 stores the number of chars in our string , read about how to make syscall in asm
syscall ;interrupt , give the wheel to OS it'll handle your systemcall
jmp exit
;Read previous comments, just performing printing in these blocks
;As per convention error messages are printed to stderr(2)
few_args:
mov rdi, FEW_ARGS
call print_error
invalid_operator:
mov rdi, INVALID_OPERATOR
call print_error
invalid_operand:
mov rdi, INVALID_OPERAND
call print_error
print_error:
push rdi
call strlen ;calculate the length of rdi (error message)
mov rdi, 2 ;write to stderr
pop rsi
mov rdx, rax ;result of strlen
mov rax, 1 ;write syscall
syscall
call error_exit
ret
strlen:
xor rax, rax ;store zero in rax
.strlen_loop:
cmp BYTE [rdi + rax], 0xA ;compare byte to a newline
je .strlen_break ;break if the current byte is a newline
inc rax
jmp .strlen_loop ;repeat if the current byte isn't a newline
.strlen_break:
inc rax ;add one to string length to count the newline
ret
;This is the function which will convert our character input to integers
;Argument - pointer to string or char ( takes rsi as argument )
;Returns equivalent integer value (in rax)
char_to_int:
xor ax, ax ;store zero in ax
xor cx, cx ;same
mov bx, 10 ; store 10 in bx - the input string is in base 10, so each place value increases by a factor of 10
.loop_block:
;REMEMBER rsi is base address to the string which we want to convert to integer equivalent
mov cl, [rsi] ;Store value at address (rsi + 0) or (rsi + index) in cl, rsi is incremented below so dont worry about where is index.
cmp cl, byte 0 ;If value at address (rsi + index ) is byte 0 (NULL) , means our string is terminated here
je .return_block
;Each digit must be between 0 (ASCII code 48) and 9 (ASCII code 57)
cmp cl, 0x30 ;If value is lesser than 0 goto invalid operand
jl invalid_operand
cmp cl, 0x39 ;If value is greater than 9 goto invalid operand
jg invalid_operand
sub cl, 48 ;Convert ASCII to integer by subtracting 48 - '0' is ASCII code 48, so subtracting 48 gives us the integer value
;Multiply the value in 'ax' (implied by 'mul') by bx (always 10). This can be thought of as shifting the current value
;to the left by one place (e.g. '123' -> '1230'), which 'makes room' for the current digit to be added onto the end.
;The result is stored in dx:ax.
mul bx
;Add the current digit, stored in cl, to the current intermediate number.
;The resulting sum will be mulitiplied by 10 during the next iteration of the loop, with a new digit being added onto it
add ax, cx
inc rsi ;Increment the rsi's index i.e (rdi + index ) we are incrementing the index
jmp .loop_block ;Keep looping until loop breaks on its own
.return_block:
ret
;This is the function which will convert our integers back to characters
;Argument - Integer Value in rax
;Returns pointer to equivalent string (in r9)
int_to_char:
mov rbx, 10
;We have declared a memory which we will use as buffer to store our result
mov r9, BYTE_BUFFER+10 ;We are are storing the number in backward order like LSB in 10 index and decrementing index as we move to MSB
mov [r9], byte 0 ;Store NULL terminating byte in last slot
dec r9 ;Decrement memory index
mov [r9], byte 0XA ;Store break line
dec r9 ;Decrement memory index
mov r11, 2;r11 will store the size of our string stored in buffer we will use it while printing as argument to sys_write
.loop_block:
mov rdx, 0
div rbx ;Get the LSB by dividing number by 10 , LSB will be remainder (stored in 'dl') like 23 divider 10 will give us 3 as remainder which is LSB here
cmp rax, 0 ;If rax (quotient) becomes 0 our procedure reached to the MSB of the number we should leave now
je .return_block
add dl, 48 ;Convert each digit to its ASCII value
mov [r9], dl ;Store the ASCII value in memory by using r9 as index
dec r9 ;Dont forget to decrement r9 remember we are using memory backwards
inc r11 ;Increment size as soon as you add a digit in memory
jmp .loop_block ;Loop until it breaks on its own
.return_block:
add dl, 48 ;Don't forget to repeat the routine for out last MSB as loop ended early
mov [r9], dl
dec r9
inc r11
ret
;Syscall 60 is exit. Return code normally is 0, on errors set it to 1
error_exit:
mov rax, 60
mov rdi, 1
syscall
exit:
mov rax, 60
mov rdi, 0
syscall
;We are all done :) If you think you can improve this more make a pull request (http://github.com/flouthoc/calc.asm)
|
programs/oeis/279/A279539.asm
|
karttu/loda
| 0 |
374
|
; A279539: Sum of ceilings of natural logs of first n integers.
; 0,1,3,5,7,9,11,14,17,20,23,26,29,32,35,38,41,44,47,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,191,196,201,206,211,216,221,226,231,236,241,246,251,256,261,266,271,276,281,286
mov $14,$0
mov $16,$0
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
lpb $13,1
mov $0,$11
sub $13,1
sub $0,$13
mov $7,$0
mov $9,2
lpb $9,1
mov $0,$7
sub $9,1
add $0,$9
sub $0,1
mul $0,6
mov $1,0
lpb $0,1
div $0,2
add $1,2
sub $0,$1
lpe
mul $1,2
mov $10,$9
lpb $10,1
mov $8,$1
sub $10,1
lpe
lpe
lpb $7,1
mov $7,0
sub $8,$1
lpe
mov $1,$8
div $1,4
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
programs/oeis/286/A286687.asm
|
karttu/loda
| 1 |
15133
|
<reponame>karttu/loda
; A286687: Positions of 1 in A286685; complement of A286686.
; 2,4,5,8,10,11,14,16,18,19,22,24,25,28,30,32,33,36,38,39,42,44,45,48,50,52,53,56,58,59,62,64,66,67,70,72,73,76,78,79,82,84,86,87,90,92,93,96,98,100,101,104,106,107,110,112,114,115,118,120,121,124,126,127,130,132,134,135,138,140,141,144,146,148,149,152,154,155,158,160,161,164,166,168,169,172,174,175,178,180,182,183,186,188,189,192,194,196,197,200,202,203,206,208,209,212,214,216,217,220,222,223,226,228,230,231,234,236,237,240,242,243,246,248,250,251,254,256,257,260,262,264,265,268,270,271,274,276,277,280,282,284,285,288,290,291,294,296,298,299,302,304,305,308,310,312,313,316,318,319,322,324,325,328,330,332,333,336,338,339,342,344,346,347,350,352,353,356,358,359,362,364,366,367,370,372,373,376,378,380,381,384,386,387,390,392,394,395,398,400,401,404,406,407,410,412,414,415,418,420,421,424,426,428,429,432,434,435,438,440,441,444,446,448,449,452,454,455,458,460,462,463,466,468,469,472,474,475,478,480,482,483,486,488,489,492,494,496,497,500
mov $2,$0
cal $0,171588 ; The Pell word: Fixed point of the morphism 0->001, 1->0.
cal $0,7 ; The characteristic function of {0}: a(n) = 0^n.
mov $1,$0
mov $3,$2
mul $3,2
add $1,$3
add $1,1
|
test/asset/agda-stdlib-1.0/Algebra/Solver/Ring/Simple.agda
|
omega12345/agda-mode
| 0 |
9964
|
<reponame>omega12345/agda-mode<gh_stars>0
------------------------------------------------------------------------
-- The Agda standard library
--
-- Instantiates the ring solver with two copies of the same ring with
-- decidable equality
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Algebra.Solver.Ring.AlmostCommutativeRing
open import Relation.Binary
open import Relation.Binary.Consequences using (dec⟶weaklyDec)
module Algebra.Solver.Ring.Simple
{r₁ r₂} (R : AlmostCommutativeRing r₁ r₂)
(_≟_ : Decidable (AlmostCommutativeRing._≈_ R))
where
open AlmostCommutativeRing R
import Algebra.Solver.Ring as RS
open RS rawRing R (-raw-almostCommutative⟶ R) (dec⟶weaklyDec _≟_) public
|
oeis/119/A119411.asm
|
neoneye/loda-programs
| 11 |
11966
|
<gh_stars>10-100
; A119411: Product of the first prime(n) primes.
; Submitted by <NAME>
; 6,30,2310,510510,200560490130,304250263527210,1922760350154212639070,7858321551080267055879090,267064515689275851355624017992790,279734996817854936178276161872067809674997230
seq $0,6093 ; a(n) = prime(n) - 1.
seq $0,88860 ; Twice the primorials (first definition), 2*A002110(n).
div $0,12
mul $0,6
|
test/Fail/Issue799a.agda
|
cruhland/agda
| 1,989 |
12010
|
<filename>test/Fail/Issue799a.agda
-- Andreas, 2013-02-26
module Issue799a where
data D (A : Set1) : Set where
d : D A
x : D Set
x = d {A = _} -- correct parameter name
y : D Set
y = d {B = _} -- wrong parameter name, should give error
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_2754.asm
|
ljhsiun2/medusa
| 9 |
165247
|
<reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1dacd, %r13
nop
nop
nop
nop
nop
cmp $62852, %r8
mov (%r13), %r10w
nop
nop
sub $45783, %r11
lea addresses_D_ht+0xbbcd, %rsi
lea addresses_WC_ht+0x5e8d, %rdi
nop
nop
xor $14191, %rdx
mov $69, %rcx
rep movsb
nop
nop
nop
nop
dec %r11
lea addresses_normal_ht+0x12b1d, %rsi
lea addresses_WC_ht+0xf635, %rdi
nop
nop
nop
nop
nop
add $56770, %r13
mov $14, %rcx
rep movsq
nop
nop
nop
nop
inc %rdx
lea addresses_WC_ht+0x55cd, %rsi
nop
nop
nop
nop
nop
add $52835, %r13
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
xor %r10, %r10
lea addresses_WC_ht+0x57cd, %rsi
nop
nop
nop
add %rdx, %rdx
mov (%rsi), %r8d
nop
nop
nop
nop
sub $22048, %r11
lea addresses_D_ht+0xea8d, %rdx
nop
nop
nop
nop
sub %r11, %r11
mov (%rdx), %r8w
nop
nop
nop
nop
nop
add $50563, %rdx
lea addresses_UC_ht+0x16ced, %rsi
lea addresses_D_ht+0x10247, %rdi
nop
dec %r13
mov $1, %rcx
rep movsw
sub $52420, %rdi
lea addresses_WC_ht+0xafcd, %rsi
lea addresses_WT_ht+0x1cfcd, %rdi
add %rdx, %rdx
mov $45, %rcx
rep movsb
nop
nop
cmp $62775, %rsi
lea addresses_D_ht+0x11771, %rsi
lea addresses_UC_ht+0x1c34d, %rdi
nop
dec %r8
mov $77, %rcx
rep movsl
inc %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r9
push %rax
push %rbp
// Store
lea addresses_WC+0x16393, %rax
nop
nop
dec %r9
movb $0x51, (%rax)
nop
nop
and %r12, %r12
// Store
mov $0x12d, %rax
nop
nop
nop
sub %r11, %r11
movl $0x51525354, (%rax)
nop
nop
nop
nop
nop
sub %r12, %r12
// Store
lea addresses_D+0x185ad, %r10
cmp %r9, %r9
mov $0x5152535455565758, %rax
movq %rax, %xmm7
movups %xmm7, (%r10)
nop
nop
and %r9, %r9
// Store
lea addresses_D+0xd3cd, %r10
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, (%r10)
nop
nop
nop
nop
add $45177, %r9
// Store
mov $0xcd, %rbp
nop
nop
cmp $26256, %r13
movb $0x51, (%rbp)
nop
nop
nop
sub $45789, %r13
// Faulty Load
lea addresses_US+0x3fcd, %r9
nop
nop
nop
nop
nop
sub $63334, %rax
mov (%r9), %rbp
lea oracles, %rax
and $0xff, %rbp
shlq $12, %rbp
mov (%rax,%rbp,1), %rbp
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': 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
*/
|
ADL/Assemble/Update/0/SHR_update.asm
|
MaxMorning/LinkedListVisualization
| 3 |
94131
|
<gh_stars>1-10
aLine 0
gNew updatePtr
gMoveNext updatePtr, Root
aLine 1
gBne updatePtr, null, 3
aLine 2
Exception NOT_FOUND
aLine 4
gNewVPtr updateNext
gMoveNext updateNext, updatePtr
sInit i, 0
sBge i, {0:D}, 11
aLine 5
gBne updateNext, null, 3
aLine 6
Exception NOT_FOUND
aLine 8
gMove updatePtr, updateNext
gMoveNext updateNext, updateNext
aLine 4
sInc i, 1
Jmp -10
aLine 10
nSetValue updatePtr, {1:D}
aLine 11
gDelete updatePtr
gDelete updateNext
aStd
Halt
|
programs/oeis/021/A021319.asm
|
neoneye/loda
| 22 |
19646
|
<reponame>neoneye/loda<filename>programs/oeis/021/A021319.asm
; A021319: Decimal expansion of 1/315.
; 0,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3
add $0,3
mov $1,10
pow $1,$0
div $1,875
sub $1,1
mod $1,10
mov $0,$1
|
anyHR/constraint/grammar/ConstraintParser.g4
|
figlerg/anyHR
| 1 |
1327
|
parser grammar ConstraintParser ;
options {
tokenVocab = ConstraintLexer ;
}
lra
:
expression LEQ expression #LRA_LEQ
| expression GEQ expression #LRA_GEQ
| expression LESS expression #LRA_Less
| expression GREATER expression #LRA_Greater
| expression EQ expression #LRA_Eq
| expression NEQ expression #LRA_Neq
| expression IN LPAREN expression COMMA expression RPAREN #LRA_In
;
expression
:
Identifier #ExpressionVariable
| literal #ExpressionConstant
| LPAREN expression RPAREN #ExpressionParanthesis
| EULER EXP expression #ExpressionExponential
| expression TIMES expression #ExpressionMultiplication
| expression PLUS expression #ExpressionAddition
| expression MINUS expression #ExpressionSubtraction
;
literal
: IntegerLiteral
| RealLiteral
| MINUS literal
;
|
library/standalone/removeExtraAppsFromDock.applescript
|
NYHTC/applescript-fm-helper
| 1 |
3284
|
-- removeExtraAppsFromDock{listOfAllowedAppNames:null}
-- <NAME>, NYHTC
-- Remove all apps from the dock that are not specified. Has a default set of apps, but is ignored if a list is passed in
(*
HISTORY:
2020-03-04 ( dshockley ): Standardized version.
1.0 - created
TODO:
whenever an app is removed, the iterator (oneDockItem) should be set back by one. It seems to be going past the separator instead of exiting.
*)
on run
removeExtraAppsFromDock(prefs)
end run
--------------------
-- START OF CODE
--------------------
on removeExtraAppsFromDock(prefs)
-- version 2020-03-04-1536
set defaultPrefs to {listOfAllowedAppNames:{"Finder", "FileMaker Pro Advanced", "FileMaker Pro Advanced", "Script Editor", "Terminal", "System Preferences", "Downloads", "Documents", "Trash"}}
set prefst to prefs & defaultPrefs
set listOfAllowedAppNames to listOfAllowedAppNames of prefs
set removeButton to "Remove from Dock"
tell application "System Events"
tell process "Dock"
set listOfDockApps to every UI element of list 1
repeat with oneDockItem in listOfDockApps
-- we hit the separator, so no need to continue
if description of oneDockItem is equal to "separator dock item" then exit repeat
set oneName to name of oneDockItem
if listOfAllowedAppNames contains oneName then
-- allowed, so continue to the next app
else
-- remove this app from the dock
tell UI element oneName of list 1
perform action "AXShowMenu"
delay 0.1
click menu item "Options" of menu 1
delay 0.1
-- depending on if teh app is open the options are different. Let's cover both cases
set optionsMenuObj to menu 1 of menu item "Options" of menu 1
set menuOptions to name of every menu item of optionsMenuObj
if menuOptions contains removeButton then
click menu item removeButton of optionsMenuObj
else
set keepMenuItem to menu item "Keep in Dock" of optionsMenuObj
if enabled of keepMenuItem is true then click keepMenuItem
end if
end tell
end if -- app is allowed
end repeat -- of apps in dock
end tell
end tell
return true
end removeExtraAppsFromDock
--------------------
-- END OF CODE
--------------------
|
programs/oeis/281/A281746.asm
|
karttu/loda
| 0 |
83875
|
<reponame>karttu/loda<filename>programs/oeis/281/A281746.asm
; A281746: Nonnegative numbers k such that k == 0 (mod 3) or k == 0 (mod 5).
; 0,3,5,6,9,10,12,15,18,20,21,24,25,27,30,33,35,36,39,40,42,45,48,50,51,54,55,57,60,63,65,66,69,70,72,75,78,80,81,84,85,87,90,93,95,96,99,100,102,105,108,110,111,114,115,117,120,123,125,126,129,130,132,135,138,140,141,144,145,147,150,153,155,156,159,160,162,165,168,170,171,174,175,177,180,183,185,186,189,190,192,195,198,200,201,204,205,207,210,213,215,216,219,220,222,225,228,230,231,234,235,237,240,243,245,246,249,250,252,255,258,260,261,264,265,267,270,273,275,276,279,280,282,285,288,290,291,294,295,297,300,303,305,306,309,310,312,315,318,320,321,324,325,327,330,333,335,336,339,340,342,345,348,350,351,354,355,357,360,363,365,366,369,370,372,375,378,380,381,384,385,387,390,393,395,396,399,400,402,405,408,410,411,414,415,417,420,423,425,426,429,430,432,435,438,440,441,444,445,447,450,453,455,456,459,460,462,465,468,470,471,474,475,477,480,483,485,486,489,490,492,495,498,500,501,504,505,507,510,513,515,516,519,520,522,525,528,530,531,534
mov $3,$0
mov $9,$0
lpb $3,1
mov $0,$9
sub $3,1
sub $0,$3
mov $2,$0
mov $4,2
mov $5,4
mov $6,4
mov $7,3
add $7,$0
sub $7,2
lpb $2,1
add $6,$7
lpb $4,1
sub $4,1
add $5,1
add $6,8
mov $8,1
lpe
mov $7,7
lpb $5,1
mov $2,$0
mod $2,7
sub $2,$8
add $7,$6
sub $7,$5
sub $5,$8
lpe
lpb $6,1
add $2,1
mov $6,8
div $7,2
lpe
mov $0,3
mul $0,$7
trn $2,1
mov $4,5
sub $4,$2
mov $6,$5
mov $5,10
lpe
mov $7,$4
sub $7,2
add $1,$7
lpe
|
src/main/resources/project-templates/gtkada_minimal/src/@[email protected]
|
WinterAlexander/Ada-IntelliJ
| 17 |
28312
|
with Gtk.Box; use Gtk.Box;
with Gtk.Label; use Gtk.Label;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Main;
with Gtk.Window; use Gtk.Window;
procedure @_Main_Name_@ is
Win : Gtk_Window;
Label : Gtk_Label;
Box : Gtk_Vbox;
begin
-- Initialize GtkAda.
Gtk.Main.Init;
-- Create a window with a size of 400x400
Gtk_New (Win);
Win.Set_Default_Size (400, 400);
-- Create a box to organize vertically the contents of the window
Gtk_New_Vbox (Box);
Win.Add (Box);
-- Add a label
Gtk_New (Label, "Hello world.");
Box.Add (Label);
-- Show the window and present it
Win.Show_All;
Win.Present;
-- Start the Gtk+ main loop
Gtk.Main.Main;
end @_Main_Name_@;
|
src/servlet-rest.adb
|
My-Colaborations/ada-servlet
| 6 |
1047
|
-----------------------------------------------------------------------
-- servlet-rest -- REST Support
-- Copyright (C) 2016, 2017, 2018 <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 Servlet.Routes;
with Servlet.Routes.Servlets.Rest;
with Servlet.Core.Rest;
with EL.Contexts.Default;
with Util.Log.Loggers;
package body Servlet.Rest is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Servlet.Rest");
-- ------------------------------
-- Get the permission index associated with the REST operation.
-- ------------------------------
function Get_Permission (Handler : in Descriptor)
return Security.Permissions.Permission_Index is
begin
return Handler.Permission;
end Get_Permission;
-- ------------------------------
-- Register the API descriptor in a list.
-- ------------------------------
procedure Register (List : in out Descriptor_Access;
Item : in Descriptor_Access) is
begin
Item.Next := List;
List := Item;
end Register;
-- ------------------------------
-- Register the list of API descriptors for a given servlet and a root path.
-- ------------------------------
procedure Register (Registry : in out Servlet.Core.Servlet_Registry;
Name : in String;
URI : in String;
ELContext : in EL.Contexts.ELContext'Class;
List : in Descriptor_Access) is
procedure Insert (Route : in out Servlet.Routes.Route_Type_Ref);
Item : Descriptor_Access := List;
procedure Insert (Route : in out Servlet.Routes.Route_Type_Ref) is
begin
if not Route.Is_Null then
declare
R : constant Servlet.Routes.Route_Type_Accessor := Route.Value;
D : access Servlet.Routes.Servlets.Rest.API_Route_Type'Class;
begin
if not (R in Servlet.Routes.Servlets.Rest.API_Route_Type'Class) then
Log.Error ("Route API for {0}/{1} already used by another page",
URI, Item.Pattern.all);
return;
end if;
D := Servlet.Routes.Servlets.Rest.API_Route_Type'Class (R.Element.all)'Access;
if D.Descriptors (Item.Method) /= null then
Log.Error ("Route API for {0}/{1} is already used", URI, Item.Pattern.all);
end if;
D.Descriptors (Item.Method) := Item;
end;
else
declare
D : access Servlet.Routes.Servlets.Rest.API_Route_Type'Class;
begin
D := Servlet.Core.Rest.Create_Route (Registry, Name);
Route := Servlet.Routes.Route_Type_Refs.Create (D.all'Access);
if D.Descriptors (Item.Method) /= null then
Log.Error ("Route API for {0}/{1} is already used", URI, Item.Pattern.all);
end if;
D.Descriptors (Item.Method) := Item;
end;
end if;
end Insert;
begin
Log.Info ("Adding API route {0}", URI);
while Item /= null loop
Log.Debug ("Adding API route {0}/{1}", URI, Item.Pattern.all);
Registry.Add_Route (URI & "/" & Item.Pattern.all, ELContext, Insert'Access);
Item := Item.Next;
end loop;
end Register;
-- ------------------------------
-- Dispatch the request to the API handler.
-- ------------------------------
overriding
procedure Dispatch (Handler : in Static_Descriptor;
Req : in out Servlet.Rest.Request'Class;
Reply : in out Servlet.Rest.Response'Class;
Stream : in out Output_Stream'Class) is
begin
Handler.Handler (Req, Reply, Stream);
end Dispatch;
-- ------------------------------
-- Register the API definition in the servlet registry.
-- ------------------------------
procedure Register (Registry : in out Servlet.Core.Servlet_Registry'Class;
Definition : in Descriptor_Access) is
use type Servlet.Core.Servlet_Access;
procedure Insert (Route : in out Routes.Route_Type_Ref);
Dispatcher : constant Servlet.Core.Request_Dispatcher
:= Registry.Get_Request_Dispatcher (Definition.Pattern.all);
Servlet : constant Core.Servlet_Access := Core.Get_Servlet (Dispatcher);
procedure Insert (Route : in out Routes.Route_Type_Ref) is
begin
if not Route.Is_Null then
declare
R : constant Routes.Route_Type_Accessor := Route.Value;
D : access Routes.Servlets.Rest.API_Route_Type'Class;
begin
if not (R in Routes.Servlets.Rest.API_Route_Type'Class) then
Log.Error ("Route API for {0} already used by another page",
Definition.Pattern.all);
D := Core.Rest.Create_Route (Servlet);
Route := Routes.Route_Type_Refs.Create (D.all'Access);
else
D := Routes.Servlets.Rest.API_Route_Type'Class (R.Element.all)'Access;
end if;
if D.Descriptors (Definition.Method) /= null then
Log.Error ("Route API for {0} is already used", Definition.Pattern.all);
end if;
D.Descriptors (Definition.Method) := Definition;
end;
else
declare
D : access Routes.Servlets.Rest.API_Route_Type'Class;
begin
D := Core.Rest.Create_Route (Servlet);
Route := Routes.Route_Type_Refs.Create (D.all'Access);
if D.Descriptors (Definition.Method) /= null then
Log.Error ("Route API for {0} is already used", Definition.Pattern.all);
end if;
D.Descriptors (Definition.Method) := Definition;
end;
end if;
end Insert;
Ctx : EL.Contexts.Default.Default_Context;
begin
if Servlet = null then
Log.Error ("Cannot register REST operation {0}: no REST servlet",
Definition.Pattern.all);
return;
end if;
Registry.Add_Route (Definition.Pattern.all, Ctx, Insert'Access);
end Register;
end Servlet.Rest;
|
src/entry/definitions.asm
|
marvinborner/SegelBoot
| 1 |
93289
|
<reponame>marvinborner/SegelBoot
; MIT License, Copyright (c) 2021 <NAME>
; This file includes definitions to reduce magic numbers
; Boot constants
%define LOCATION 0x7c00 ; Bootloader location
%define SECTOR_END_SIG 0xaa55 ; Bootsector end signature
%define SECTOR_SIZE 512 ; Bootsector size
; Interrupts
%define SCREEN_INT 0x10 ; Screen/video BIOS interrupt
%define DISK_INT 0x13 ; Disk BIOS interrupt
; Characters
%define NEWLINE 0x0A ; Newline character (\n)
%define RETURN 0x0D ; Return character (\r)
%define NULL 0x00 ; NULL character (\0)
; Screen/video commands (for SCREEN_INT; using VGA interface)
%define SCREEN_CLEAR 0x03 ; Clear screen command
%define SCREEN_OUT 0x0e ; Screen output command
; Disk commands
%define DISK_EXT_CHECK 0x41 ; Disk extension check command
%define DISK_EXT_CHECK_REQ 0x55aa ; First extension check signature (request)
%define DISK_EXT_CHECK_RESP 0xaa55 ; Second extension check signature (response)
%define DISK_READ 0x42 ; Disk extended read command
; GDT constants (bitmap)
%define GDT_MAX_LIMIT 0xffff ; I just use the max limit lel
%define GDT_PRESENT 0b10000000 ; Is present
%define GDT_RING3 0b01100000 ; Privilege level 3
%define GDT_DESCRIPTOR 0b00010000 ; Descriptor type, set for code/data
%define GDT_EXECUTABLE 0b00001000 ; Can be executed
%define GDT_READWRITE 0b00000010 ; Read/write access for code/data
%define GDT_ACCESSED 0b00000001 ; Whether segment is accessible
%define GDT_GRANULARITY 0x80 ; Page granularity (4KiB)
%define GDT_SIZE 0x40 ; Use 32 bit selectors
%define GDT_DATA_OFFSET 0x10 ; Offset to GDT data segment
|
theorems/cohomology/Wedge.agda
|
mikeshulman/HoTT-Agda
| 0 |
15881
|
<filename>theorems/cohomology/Wedge.agda
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import groups.Exactness
open import homotopy.CofiberSequence
open import cohomology.Theory
{- Finite additivity is provable (and in a stronger form) without using
- the additivity axiom. We have
Cⁿ(X ∨ Y) == Cⁿ(X) × Cⁿ(Y)
- and over this path
- ∙ Cⁿ(winl) corresponds to fst : Cⁿ(X) × Cⁿ(Y) → Cⁿ(X),
- ∙ Cⁿ(winr) corresponds to snd : Cⁿ(X) × Cⁿ(Y) → Cⁿ(Y),
- ∙ Cⁿ(Wedge-rec winl* winr* wglue*) : Cⁿ(Z) → Cⁿ(X ∨ Y)
corresponds to Cⁿ(winl*) × Cⁿ(winr*).
- ∙ Cⁿ(f) : Cⁿ(X ∨ Y) → Cⁿ(Z)
corresponds to Cⁿ(projl ∘ f) + Cⁿ(projr ∘ f) : Cⁿ(X) × Cⁿ(Y) → Cⁿ(Z)
-}
module cohomology.Wedge {i} (CT : CohomologyTheory i)
(n : ℤ) (X Y : Ptd i) where
open import homotopy.WedgeCofiber X Y
open CohomologyTheory CT
open import cohomology.PtdMapSequence CT
private
abstract
βl : ∀ x → CEl-fmap n ⊙winl (CEl-fmap n (⊙projl X Y) x) == x
βl = CEl-fmap-inverse n ⊙winl (⊙projl X Y) λ _ → idp
βr : ∀ y → CEl-fmap n ⊙winr (CEl-fmap n (⊙projr X Y) y) == y
βr = CEl-fmap-inverse n ⊙winr (⊙projr X Y) λ _ → idp
C-projr-C-winl-is-exact : is-exact (C-fmap n (⊙projr X Y)) (C-fmap n ⊙winl)
C-projr-C-winl-is-exact = equiv-preserves'-exact
(C-comm-square n cfcod-winl-projr-comm-sqr)
(C-comm-square n $ comm-sqr λ _ → idp)
(snd (C-emap n CofWinl.⊙eq))
(C-isemap n (⊙idf _) (idf-is-equiv _))
(C-isemap n (⊙idf _) (idf-is-equiv _))
(C-exact n ⊙winl)
C-projl-C-winr-is-exact : is-exact (C-fmap n (⊙projl X Y)) (C-fmap n ⊙winr)
C-projl-C-winr-is-exact = equiv-preserves'-exact
(C-comm-square n cfcod-winr-projl-comm-sqr)
(C-comm-square n $ comm-sqr λ _ → idp)
(snd (C-emap n CofWinr.⊙eq))
(C-isemap n (⊙idf _) (idf-is-equiv _))
(C-isemap n (⊙idf _) (idf-is-equiv _))
(C-exact n ⊙winr)
import groups.ProductRepr
(C-fmap n (⊙projl X Y)) (C-fmap n (⊙projr X Y))
(C-fmap n ⊙winl) (C-fmap n ⊙winr) βl βr
C-projl-C-winr-is-exact
C-projr-C-winl-is-exact as PR
C-Wedge : C n (X ⊙∨ Y) ≃ᴳ C n X ×ᴳ C n Y
C-Wedge = PR.iso
{-
⊙Wedge-rec-over : {Z : Ptd i} (winl* : X ⊙→ Z) (winr* : Y ⊙→ Z)
→ CF-hom n (⊙Wedge-rec winl* winr*)
== ×ᴳ-fanout (CF-hom n winl*) (CF-hom n (winr*))
[ (λ K → C n Z →ᴳ K) ↓ path ]
⊙Wedge-rec-over winl* winr* = codomain-over-iso $
codomain-over-equiv (CF n R.⊙f) _
▹ ap2 (λ f g z → (f z , g z))
(ap GroupHom.f $ ! (CF-comp n R.⊙f ⊙winl) ∙ ap (CF-hom n) R.⊙winl-β)
(ap GroupHom.f $ ! (CF-comp n R.⊙f ⊙winr) ∙ ap (CF-hom n) R.⊙winr-β)
where
module R = ⊙WedgeRec winl* winr*
Wedge-hom-η : {Z : Ptd i} (φ : C n (⊙Wedge X Y) →ᴳ C n Z)
→ φ == ×ᴳ-fanin (C-is-abelian n _) (φ ∘ᴳ CF-hom n (⊙projl X Y))
(φ ∘ᴳ CF-hom n (⊙projr X Y))
[ (λ G → G →ᴳ C n Z) ↓ path ]
Wedge-hom-η φ =
lemma (C-is-abelian n _) (C-is-abelian n _) inl-over inr-over
where
lemma : {G H K L : Group i}
(aG : is-abelian G) (aL : is-abelian L) {p : G == H ×ᴳ K}
{φ : H →ᴳ G} {ψ : K →ᴳ G} {χ : G →ᴳ L}
→ φ == ×ᴳ-inl [ (λ J → H →ᴳ J) ↓ p ]
→ ψ == ×ᴳ-inr {G = H} [ (λ J → K →ᴳ J) ↓ p ]
→ χ == ×ᴳ-fanin aL (χ ∘ᴳ φ) (χ ∘ᴳ ψ) [ (λ J → J →ᴳ L) ↓ p ]
lemma {H = H} {K = K} aG aL {p = idp} {χ = χ} idp idp =
ap (λ α → χ ∘ᴳ α) (×ᴳ-fanin-η H K aG)
∙ ! (×ᴳ-fanin-pre∘ aG aL χ (×ᴳ-inl {G = H}) (×ᴳ-inr {G = H}))
Wedge-in-over : {Z : Ptd i} (f : Z ⊙→ ⊙Wedge X Y)
→ CF-hom n f
== ×ᴳ-fanin (C-is-abelian n _) (CF-hom n (⊙projl X Y ⊙∘ f))
(CF-hom n (⊙projr X Y ⊙∘ f))
[ (λ G → G →ᴳ C n Z) ↓ path ]
Wedge-in-over f =
Wedge-hom-η (CF-hom n f)
▹ ap2 (×ᴳ-fanin (C-is-abelian n _))
(! (CF-comp n (⊙projl X Y) f))
(! (CF-comp n (⊙projr X Y) f))
-}
|
Transynther/x86/_processed/NONE/_un_/i9-9900K_12_0xa0.log_1_1076.asm
|
ljhsiun2/medusa
| 9 |
92046
|
.global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x4199, %rbp
nop
nop
nop
nop
add %rbx, %rbx
movb $0x61, (%rbp)
nop
nop
add %rbx, %rbx
lea addresses_UC_ht+0x16193, %rbp
nop
nop
nop
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %rax
movq %rax, %xmm6
vmovups %ymm6, (%rbp)
nop
nop
nop
nop
sub %r8, %r8
lea addresses_UC_ht+0x2ea3, %r8
clflush (%r8)
nop
nop
nop
dec %rdx
mov (%r8), %ebp
nop
xor %r8, %r8
lea addresses_normal_ht+0x10419, %rsi
lea addresses_normal_ht+0x3b93, %rdi
nop
nop
nop
cmp %r8, %r8
mov $66, %rcx
rep movsw
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_WT_ht+0xecef, %rcx
nop
nop
nop
cmp %rbp, %rbp
movups (%rcx), %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
xor $22317, %rbx
lea addresses_normal_ht+0x16213, %rsi
lea addresses_normal_ht+0x1ae93, %rdi
nop
cmp %r8, %r8
mov $100, %rcx
rep movsl
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_normal_ht+0x5667, %rsi
lea addresses_D_ht+0x3b93, %rdi
nop
nop
nop
nop
add %rax, %rax
mov $111, %rcx
rep movsb
nop
nop
nop
nop
nop
add $59404, %rbx
lea addresses_WT_ht+0x14a8b, %rsi
nop
nop
nop
nop
nop
and $39898, %r8
movups (%rsi), %xmm2
vpextrq $0, %xmm2, %rbx
nop
nop
nop
sub $7787, %rbp
lea addresses_UC_ht+0x12fcb, %rdx
xor $18109, %r8
mov (%rdx), %ebp
nop
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0xe87a, %rsi
lea addresses_WT_ht+0x12293, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $67, %rcx
rep movsw
xor $17932, %rsi
lea addresses_UC_ht+0x10ad3, %rdx
nop
xor $2039, %r8
movl $0x61626364, (%rdx)
nop
nop
dec %rbp
lea addresses_UC_ht+0x19913, %r8
clflush (%r8)
nop
nop
nop
add %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
nop
nop
add %r8, %r8
lea addresses_WC_ht+0x5f93, %rsi
lea addresses_normal_ht+0x1e793, %rdi
nop
nop
sub %rdx, %rdx
mov $31, %rcx
rep movsl
nop
nop
cmp %rbx, %rbx
lea addresses_UC_ht+0x2793, %rsi
lea addresses_normal_ht+0x19c43, %rdi
nop
nop
nop
sub $9811, %rdx
mov $42, %rcx
rep movsl
nop
cmp $31772, %rbx
lea addresses_D_ht+0xc093, %rsi
lea addresses_A_ht+0x1ea23, %rdi
nop
nop
add %rbx, %rbx
mov $122, %rcx
rep movsb
nop
nop
nop
nop
xor $56661, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x14313, %r12
nop
nop
nop
nop
nop
dec %r8
movb $0x51, (%r12)
nop
nop
cmp $13292, %r8
// Store
lea addresses_PSE+0xd123, %r11
nop
nop
nop
nop
xor $46081, %rax
mov $0x5152535455565758, %r12
movq %r12, (%r11)
nop
nop
nop
nop
inc %rax
// Store
lea addresses_A+0x14824, %r15
nop
nop
cmp $42124, %rax
movb $0x51, (%r15)
nop
nop
nop
nop
dec %r11
// Store
mov $0x2af8f50000000e6b, %r15
nop
nop
nop
dec %rdi
movl $0x51525354, (%r15)
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_D+0x13393, %r8
clflush (%r8)
nop
and %r13, %r13
movb $0x51, (%r8)
nop
nop
inc %rdi
// Store
lea addresses_US+0x50af, %rax
add $38060, %r12
mov $0x5152535455565758, %r8
movq %r8, (%rax)
// Exception!!!
nop
nop
nop
nop
xor %r8, %r8
div %r8
nop
nop
nop
nop
nop
sub $41763, %r15
// Store
lea addresses_UC+0x104b, %r15
nop
nop
nop
nop
nop
xor %r8, %r8
mov $0x5152535455565758, %r11
movq %r11, %xmm2
vmovups %ymm2, (%r15)
nop
sub $11208, %r13
// Store
lea addresses_UC+0x5793, %r8
nop
nop
cmp $15980, %rax
movw $0x5152, (%r8)
// Exception!!!
nop
nop
nop
xor %rax, %rax
div %rax
nop
nop
cmp $29882, %r11
// REPMOV
lea addresses_normal+0x1908f, %rsi
mov $0x683, %rdi
nop
nop
nop
nop
xor %r15, %r15
mov $113, %rcx
rep movsl
// Exception!!!
nop
nop
nop
nop
mov (0), %r11
nop
nop
nop
nop
cmp $47924, %rdi
// Store
lea addresses_UC+0x1bf3, %r15
nop
nop
nop
nop
and $59094, %r11
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
vmovups %ymm2, (%r15)
nop
nop
dec %rax
// Faulty Load
lea addresses_RW+0x1793, %r13
clflush (%r13)
cmp %rax, %rax
mov (%r13), %esi
lea oracles, %r11
and $0xff, %rsi
shlq $12, %rsi
mov (%r11,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': True, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_NC', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 10, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_P'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 4}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': True, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'7d': 1}
7d
*/
|
Structure/Operator/Vector/Eigen.agda
|
Lolirofle/stuff-in-agda
| 6 |
17267
|
<filename>Structure/Operator/Vector/Eigen.agda
import Lvl
open import Structure.Operator.Vector
open import Structure.Setoid
open import Type
module Structure.Operator.Vector.Eigen
{ℓᵥ ℓₛ ℓᵥₑ ℓₛₑ}
{V : Type{ℓᵥ}} ⦃ equiv-V : Equiv{ℓᵥₑ}(V) ⦄
{S : Type{ℓₛ}} ⦃ equiv-S : Equiv{ℓₛₑ}(S) ⦄
(_+ᵥ_ : V → V → V)
(_⋅ₛᵥ_ : S → V → V)
(_+ₛ_ _⋅ₛ_ : S → S → S)
⦃ vectorSpace : VectorSpace(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) ⦄
where
open VectorSpace(vectorSpace)
open import Logic
open import Logic.Predicate
open import Logic.Propositional
open import Syntax.Function
-- v is a eigenvector for the eigenvalue 𝜆 of the linear transformation f.
-- Multiplication by an eigenvalue can replace a linear transformation for certain vectors.
Eigenpair : (V → V) → S → V → Stmt
Eigenpair(f)(𝜆)(v) = ((v ≢ 𝟎ᵥ) ∧ (f(v) ≡ 𝜆 ⋅ₛᵥ v))
Eigenvector : (V → V) → V → Stmt
Eigenvector(f)(v) = ∃(𝜆 ↦ Eigenpair(f)(𝜆)(v))
Eigenvalue : (V → V) → S → Stmt
Eigenvalue(f)(𝜆) = ∃(v ↦ Eigenpair(f)(𝜆)(v))
|
antlr-testing/lingua.g4
|
cjdb/ltcpp-ranges
| 0 |
1145
|
grammar lingua;
translation_unit: module_preamble global_declaration*;
// Modules
module_preamble: module_declaration import_declaration*;
module_declaration: 'module' module_identifier ';';
import_declaration: 'import' module_identifier ';';
module_identifier: IDENTIFIER ('.' IDENTIFIER)*;
// Declarations
global_declaration: 'export'? declaration;
declaration: type_declaration ';'
| function_declaration ';'
| variable_declaration ';'
;
type_declaration: struct_declaration
| enum_declaration
;
struct_declaration: 'type' IDENTIFIER '{' global_declaration* '}';
enum_declaration: 'enum' IDENTIFIER '{' identifier_list '}';
function_declaration: 'fun' IDENTIFIER '(' parameter_list ')' return_type? compound_statement;
return_type: '->' type;
parameter_list: parameter_declaration (',' parameter_declaration)*;
parameter_declaration: IDENTIFIER ':' type;
variable_declaration: 'let' IDENTIFIER (':' type)? initialiser;
initialiser: '<-' expression;
// Types
type: type_modifier? ref_modifier? type_specifier;
type_specifier: 'bool'
| 'char8'
| 'int8'
| 'int16'
| 'int32'
| 'int64'
| 'float16'
| 'float32'
| 'float64'
| 'string'
| 'void'
;
type_modifier: 'readable'
| 'writable'
| 'mutable'
;
ref_modifier: 'ref';
// Expressions
expression: assignment_expression;
assignment_expression: logical_or_expression (ASSIGNMENT_OPERATOR assignment_expression)?;
logical_or_expression: logical_and_expression ('or' logical_or_expression)?;
logical_and_expression: equality_expression ('and' logical_and_expression)?;
equality_expression: inequality_expression (EQUALITY_OPERATOR equality_expression)?;
inequality_expression: additive_expression (INEQUALITY_OPERATOR inequality_expression)?;
additive_expression: multiplicative_expression (ADDITIVE_OPERATOR additive_expression)?;
multiplicative_expression: unary_expression (MULTIPLICATIVE_OPERATOR multiplicative_expression)?;
unary_expression: unary_operator? primary_expression;
unary_operator: '+'
| '-'
| '++'
| '--'
| 'addressof'
| 'copy'
| 'not'
| 'sizeof'
| 'valueof'
;
primary_expression: '(' expression ')'
| IDENTIFIER postfix_expression?
| BOOLEAN_LITERAL
| CHARACTER_LITERAL
| FLOATING_LITERAL
| INTEGRAL_LITERAL
| STRING_LITERAL
;
postfix_expression: '.' IDENTIFIER postfix_expression?
| '[' expression ']'
| '(' argument_list? ')'
;
argument_list: argument (',' argument)*;
argument: expression;
// Statements
statement: compound_statement
| selection_statement
| iteration_statement
| assert_statement
| break_statement
| continue_statement
| expression_statement
| return_statement
| declaration_statement
;
compound_statement: '{' statement* '}';
assert_statement: 'assert' expression ';';
break_statement: 'break' ';';
continue_statement: 'continue' ';';
expression_statement: expression ';';
return_statement: 'return' expression? ';';
declaration_statement: variable_declaration ';';
// Selection statements
selection_statement: if_statement;
if_statement: 'if' expression compound_statement;
// Iteration statements
iteration_statement: while_statement
| for_statement
;
while_statement: 'while' expression compound_statement;
for_statement: 'for' parameter_declaration 'in' IDENTIFIER compound_statement;
// Miscellaneous
identifier_list: IDENTIFIER (',' IDENTIFIER)*;
// Terminal tokens
fragment ESCAPED_QUOTE : '\\"';
MODULE_SEPARATOR: [.];
BOOLEAN_LITERAL: 'false' | 'true';
IDENTIFIER: [A-Za-z][A-Za-z0-9_]*;
CHARACTER_LITERAL: '\'' (ESCAPED_QUOTE | ~('\n' | '\r')) '\'';
FLOATING_LITERAL: [0-9]+'.'[0-9]+([Ee][+-]?[0-9]+)?;
INTEGRAL_LITERAL: [0-9]+;
STRING_LITERAL : '"' ( ESCAPED_QUOTE | ~('\n'|'\r') )*? '"';
EQUALITY_OPERATOR: '=' | '!=';
INEQUALITY_OPERATOR: [<>] '='?;
ASSIGNMENT_OPERATOR: '<-';
ADDITIVE_OPERATOR: [+-];
MULTIPLICATIVE_OPERATOR: [*/%];
WS: [ \t\r\n]+ -> skip;
|
src/dds-request_reply-impl.adb
|
persan/dds-requestreply
| 0 |
14288
|
<filename>src/dds-request_reply-impl.adb
with DDS.Condition;
with DDS.ConditionSeq;
with GNAT.Source_Info;
with Interfaces.C.Extensions;
package body DDS.Request_Reply.Impl is
use DDS.DomainParticipant;
use DDS.Publisher;
use DDS.Subscriber;
--------------------------
-- Create_Request_Topic --
--------------------------
function Create_Request_Topic
(Self : not null access Ref;
Topic_Name : DDS.String;
Type_Name : DDS.String;
QoS : DDS.TopicQos := DDS.DomainParticipant.TOPIC_QOS_DEFAULT) return DDS.Topic.Ref_Access
is
begin
return Self.Participant.Get_Or_Create_Topic (Topic_Name, Type_Name, Qos);
end Create_Request_Topic;
------------------------
-- Create_Reply_Topic --
------------------------
function Create_Reply_Topic
(Self : not null access Ref;
Topic_Name : DDS.String;
Type_Name : DDS.String;
QoS : DDS.TopicQos := DDS.DomainParticipant.TOPIC_QOS_DEFAULT) return DDS.Topic.Ref_Access
is
begin
return Self.Participant.Get_Or_Create_Topic (Topic_Name, Type_Name, Qos);
end Create_Reply_Topic;
---------------------------------------
-- Create_Request_Topic_With_Profile --
---------------------------------------
function Create_Request_Topic_With_Profile
(Self : not null access Ref;
Topic_Name : DDS.String;
Type_Name : DDS.String;
Library_Name : DDS.String;
Profile_Name : DDS.String) return DDS.Topic.Ref_Access
is
begin
return Self.Participant.Get_Or_Create_Topic_With_Profile (Topic_Name, Type_Name, Library_Name, Profile_Name);
end Create_Request_Topic_With_Profile;
-------------------------------------
-- Create_Reply_Topic_With_Profile --
-------------------------------------
function Create_Reply_Topic_With_Profile
(Self : not null access Ref;
Topic_Name : DDS.String;
Type_Name : DDS.String;
Library_Name : DDS.String;
Profile_Name : DDS.String) return DDS.Topic.Ref_Access
is
begin
return Self.Participant.Get_Or_Create_Topic_With_Profile (Topic_Name, Type_Name, Library_Name, Profile_Name);
end Create_Reply_Topic_With_Profile;
--------------
-- Validate --
--------------
function CreateContentFilteredTopicName ( Self : not null access Ref;
RelatedTopicName : DDS.String;
Guid : Guid_T) return Standard.String is
begin
return raise Program_Error with "CreateContentFilteredTopicName Unimplemented";
end;
procedure Validate
(Self : not null access Ref;
Publisher : DDS.Publisher.Ref_Access;
Subscriber : DDS.Subscriber.Ref_Access)
is
begin
if (Publisher /= null) then
if Self.Participant /= Publisher.Get_Participant then
raise Program_Error with "Publisher dont belong to participant";
else
Self.Publisher := Publisher;
end if;
else
Self.Publisher := Self.Participant.Get_Implicit_Publisher;
end if;
if (Subscriber /= null) then
if Self.Participant /= Subscriber.Get_Participant then
raise Program_Error with "Subscriber dont belong to participant";
else
Self.Subscriber := Self.Participant.Get_Implicit_Subscriber;
end if;
else
Self.Subscriber := Subscriber;
end if;
end Validate;
procedure Wait_For_Any_Sample (Self : not null access Ref;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Natural) is
begin
Self.Wait_For_Samples (Max_Wait,
Min_Sample_Count,
Self.Waitset,
Self.Any_Sample_Cond,
Self.Not_Read_Sample_Cond);
end Wait_For_Any_Sample;
function Get_Sample_Loaned_W_Len
(Self : not null access Ref;
Received_Data : System.Address;
Data_Count : out Integer;
Is_Loan : out Boolean;
DataSeqContiguousBuffer : Interfaces.C.Extensions.Void_Ptr;
Info_Seq : DDS.SampleInfo_Seq.Sequence;
Data_Seq_Len : Long_Integer;
Data_Seq_Max_Len : Long_Integer;
Data_Seq_Has_Ownership : Boolean;
Max_Samples : Natural;
Read_Condition : not null DDS.ReadCondition.Ref_Access;
Take : Boolean)return DDS.ReturnCode_T is
begin
return DDS.ReturnCode_T'Val(Self.Reader.read_or_take_w_condition_untypedI
(Is_Loan => Is_Loan'Unrestricted_Access,
Received_Data => Received_Data,
Data_Count => Data_Count'Unrestricted_Access,
Info_Seq => Info_Seq,
Data_Seq_Len => Data_Seq_Len,
Data_Seq_Max_Len => Data_Seq_Max_Len,
Data_Seq_Has_Ownership => Boolean'Pos(Data_Seq_Has_Ownership),
Data_Seq_Contiguous_Buffer_For_Copy => DataSeqContiguousBuffer,
Data_Size => Self.Sample_Size,
Max_Samples => Standard.Long_integer(Max_Samples),
Condition => Read_Condition,
Take => Take));
end Get_Sample_Loaned_W_Len;
function Touch_Samples
(Self : not null access Ref;
Max_Count : DDS.Natural;
ReadCondition : not null DDS.ReadCondition.Ref_Access) return Integer
is
Received_Data : System.Address := System.Null_Address;
Info_Seq : aliased DDS.SampleInfo_Seq.Sequence;
Data_Count : Integer := -1;
IsLoan : Boolean := True;
retCode : DDS.ReturnCode_T;
begin
retCode:= Self.Get_Sample_Loaned_W_Len
(Received_Data => Received_Data'Address,
Data_Count => Data_Count,
Is_Loan => IsLoan,
DataSeqContiguousBuffer => System.Null_Address,
Info_Seq => Info_Seq,
Data_Seq_Len => 0,
Data_Seq_Max_Len => 0,
Data_Seq_Has_Ownership => True,
Max_Samples => Max_Count,
Read_Condition => ReadCondition,
Take => False);
if retCode = DDS.RETCODE_OK then
self.Reader.Return_Loan_UntypedI(Received_Data,Data_Count,Info_Seq);
elsif retCode /= DDS.RETCODE_NO_DATA then
Ret_Code_To_Exception(retCode,"error with getting sample loan");
end if;
return Data_Count;
end Touch_Samples;
procedure Wait_For_Samples (Self : not null access Ref;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Integer;
WaitSet : not null DDS.WaitSet.Ref_Access;
Initial_Condition : not null DDS.ReadCondition.Ref_Access;
Condition : not null DDS.ReadCondition.Ref_Access) is
Sample_Count : DDS.Natural := (if Min_Sample_Count =DDS.LENGTH_UNLIMITED then DDS.Natural'last else Min_Sample_Count);
TimeBefore, TimeAfter : DDS.Time_T;
RemainingWait : aliased DDS.Duration_T;
ActiveConditions : aliased DDS.ConditionSeq.Sequence;
use DDS.ConditionSeq;
use Dds.Condition;
begin
if Condition.Get_Sample_State_Mask /= DDS.NOT_READ_SAMPLE_STATE then
raise PRECONDITION_NOT_MET;
end if;
if Initial_Condition.Get_Sample_State_Mask /= DDS.ANY_SAMPLE_STATE then
raise PRECONDITION_NOT_MET;
end if;
Sample_Count := Sample_Count - Self.Touch_Samples (Min_Sample_Count, Initial_Condition);
while Sample_Count > 0 loop
if Sample_Count = 1 then
WaitSet.Wait (ActiveConditions'Access, RemainingWait);
else
TimeBefore := Self.Participant.Get_Current_Time;
WaitSet.Wait (ActiveConditions'Access, RemainingWait);
TimeAfter := Self.Participant.Get_Current_Time;
RemainingWait := RemainingWait -(TimeAfter - TimeBefore);
exit when
Get_Length (ActiveConditions'Access) /= 1 or
Get (ActiveConditions'Access, 0) /= DDS.Condition.Ref_Access (Condition);
if Sample_Count > 1 then
Sample_Count := Sample_Count - Self.Touch_Samples (Min_Sample_Count, Condition);
else
Sample_Count := Sample_Count - 1;
end if;
end if;
end loop;
end Wait_For_Samples;
end DDS.Request_Reply.Impl;
|
source/nodes/program-nodes-array_component_association_vectors.ads
|
reznikmm/gela
| 0 |
24334
|
<reponame>reznikmm/gela
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Nodes.Generic_Vectors;
with Program.Elements.Array_Component_Associations;
package Program.Nodes.Array_Component_Association_Vectors is new
Program.Nodes.Generic_Vectors
(Program.Elements.Array_Component_Associations
.Array_Component_Association_Vector);
pragma Preelaborate (Program.Nodes.Array_Component_Association_Vectors);
|
oeis/120/A120995.asm
|
neoneye/loda-programs
| 11 |
29504
|
<filename>oeis/120/A120995.asm
; A120995: Denominators of rationals related to <NAME>' product formula for Pi/2 (from his 'Arithmetica infinitorum' from 1659).
; Submitted by <NAME>
; 1,15,175,3675,14553,231231,920205,234652275,2807136475,14933966047,59612442981,11425718238025,15211755050625,243077636829375,971230202264925,993568496917018275,3970836034391543625
mov $1,1
lpb $0
mov $2,$0
sub $0,1
mul $2,2
add $2,2
pow $2,2
mul $3,$2
sub $2,1
add $3,$1
mul $1,$2
lpe
gcd $3,$1
div $1,$3
mov $0,$1
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_1190.asm
|
ljhsiun2/medusa
| 9 |
6738
|
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_1190.asm
.global s_prepare_buffers
s_prepare_buffers:
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x979c, %rdx
clflush (%rdx)
nop
nop
cmp %rdi, %rdi
movw $0x6162, (%rdx)
nop
nop
nop
nop
nop
dec %rdi
pop %rsi
pop %rdx
pop %rdi
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %r9
push %rax
push %rbp
push %rcx
// Store
lea addresses_D+0x168e3, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
xor $8781, %r8
movb $0x51, (%rbp)
nop
nop
nop
nop
and $22213, %r15
// Store
lea addresses_WT+0x110ec, %rbp
sub $7403, %rcx
movl $0x51525354, (%rbp)
cmp %r15, %r15
// Faulty Load
mov $0x1b62f20000000aec, %r9
nop
nop
xor $32372, %rbp
movups (%r9), %xmm0
vpextrq $0, %xmm0, %rax
lea oracles, %r9
and $0xff, %rax
shlq $12, %rax
mov (%r9,%rax,1), %rax
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_WT'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}}
{'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
*/
|
programs/oeis/066/A066455.asm
|
karttu/loda
| 0 |
6256
|
<reponame>karttu/loda<gh_stars>0
; A066455: 6*binomial(n,4)+5*binomial(n,2)-4*n+5.
; 1,2,8,25,65,146,292,533,905,1450,2216,3257,4633,6410,8660,11461,14897,19058,24040,29945,36881,44962,54308,65045,77305,91226,106952,124633,144425,166490,190996,218117,248033,280930,317000,356441,399457,446258,497060,552085,611561,675722,744808,819065,898745,984106,1075412,1172933,1276945,1387730,1505576,1630777,1763633,1904450,2053540,2211221,2377817,2553658,2739080,2934425,3140041,3356282,3583508,3822085,4072385,4334786,4609672,4897433,5198465,5513170,5841956,6185237,6543433,6916970,7306280,7711801,8133977,8573258,9030100,9504965,9998321,10510642,11042408,11594105,12166225,12759266,13373732,14010133,14668985,15350810,16056136,16785497,17539433,18318490,19123220,19954181,20811937,21697058,22610120,23551705,24522401,25522802,26553508,27615125,28708265,29833546,30991592,32183033,33408505,34668650,35964116,37295557,38663633,40069010,41512360,42994361,44515697,46077058,47679140,49322645,51008281,52736762,54508808,56325145,58186505,60093626,62047252,64048133,66097025,68194690,70341896,72539417,74788033,77088530,79441700,81848341,84309257,86825258,89397160,92025785,94711961,97456522,100260308,103124165,106048945,109035506,112084712,115197433,118374545,121616930,124925476,128301077,131744633,135257050,138839240,142492121,146216617,150013658,153884180,157829125,161849441,165946082,170120008,174372185,178703585,183115186,187607972,192182933,196841065,201583370,206410856,211324537,216325433,221414570,226592980,231861701,237221777,242674258,248220200,253860665,259596721,265429442,271359908,277389205,283518425,289748666,296081032,302516633,309056585,315702010,322454036,329313797,336282433,343361090,350550920,357853081,365268737,372799058,380445220,388208405,396089801,404090602,412212008,420455225,428821465,437311946,445927892,454670533,463541105,472540850,481671016,490932857,500327633,509856610,519521060,529322261,539261497,549340058,559559240,569920345,580424681,591073562,601868308,612810245,623900705,635141026,646532552,658076633,669774625,681627890,693637796,705805717,718133033,730621130,743271400,756085241,769064057,782209258,795522260,809004485,822657361,836482322,850480808,864654265,879004145,893531906,908239012,923126933,938197145,953451130
mov $1,1
mov $3,1
lpb $0,1
sub $0,1
add $2,1
add $1,$2
add $1,$0
add $3,$0
add $2,$3
sub $3,1
add $2,$3
lpe
|
gameloop.asm
|
raphnet/rc201804
| 0 |
97166
|
bits 16
cpu 8086
; Should be defined before inclusion or from command-line.
;%define ZAPPER_SUPPORT
%ifdef ZAPPER_SUPPORT
%include "zapper.asm"
%endif
%define glp_setHook(symbol, function) mov word [symbol], function
section .bss
glp_mustrun: resb 1
glp_retval: resw 1
trig_active: resb 1
_first_hook:
glp_hook_esc: resw 1
glp_hook_trigger_pulled: resw 1
glp_hook_vert_retrace: resw 1
_last_hook:
section .data
section .text
;;;;; Reset all hooks to default noop values
glp_clearHooks:
push bx
push cx
mov word cx, (_last_hook - _first_hook)/2
mov bx, glp_hook_esc
.lp:
mov word [bx], gameloop_noop
add bx, 2
loop .lp
pop cx
pop bx
ret
;;;;; Call once to initialize the game loop
;
; Clears hooks
;
glp_init:
call zapperInit
call glp_clearHooks
ret
;;;;; Call from any hook to request exit from gameloop
;
; A return value can be passed in AX. Then, when glp_run
; exits, the gameloop loads this value in AX.
;
; Useful to act depending on the exit reason.
glp_end:
mov [glp_retval], ax
mov byte [glp_mustrun], 0
ret
;;;;; Run the gameloop until glp_end is called
glp_run:
push dx
mov byte [glp_mustrun], 1
.loop:
mov dx, 3DAh
mov ah, 08h
; If already in vertical retrace (fast computer or slow game code)
; wait until retrace ends. Then wait until it starts again
; to continue;
.waitNotInRetrace:
in al, dx
test al,ah
jnz .waitNotInRetrace
; Wait for retrace start
.notInRetrace:
in al, dx
test al,ah
jz .notInRetrace
%ifdef ZAPPER_SUPPORT
jmp_if_trigger_pulled .pulled
jmp .not_pulled
.pulled:
; Only call trigger hook on rising edge.
jmp_mbyte_true [trig_active], .trigger_management_done
mov byte [trig_active], 1
call [glp_hook_trigger_pulled]
jmp .trigger_management_done
.not_pulled:
mov byte [trig_active], 0
.trigger_management_done:
%endif
call [glp_hook_vert_retrace]
; Call ESC pressed hook
call checkESCpressed
jnc .esc_not_pressed
call [glp_hook_esc]
.esc_not_pressed:
cmp byte [glp_mustrun], 1
je .loop
mov ax, [glp_retval]
pop dx
ret
; Do nothing placeholder for unused hooks
gameloop_noop:
ret
|
libsrc/math/mbf64/c/sccz80/cos.asm
|
jpoikela/z88dk
| 640 |
169441
|
SECTION code_fp_mbf64
PUBLIC cos
INCLUDE "mbf64.def"
EXTERN ___mbf64_setup_single
EXTERN ___mbf32_COS
EXTERN ___mbf64_return_single
EXTERN msbios
cos:
call ___mbf64_setup_single
ld ix,___mbf32_COS
call msbios
jp ___mbf64_return_single
|
vars.asm
|
hemerfc/T-RexGameBoy
| 0 |
240056
|
;-------------
; Ram variables etc
;-------------
SECTION "RAM Vars",WRAM0[$C000]
;vblank stuffs
vblank_flag: DB
vblank_count: DB
; high -------------------------- low
;AND -> down/up/left/right/start/select/a/b
joypad_down: DB
joypad_pressed: DB
joypad_released: DB
;player vars
player_y: DB
player_x: DB
player_y2: DB
player_x2: DB
player_y3: DB
player_x3: DB
player_frame: DB
player_state: DB
player_jump_speed: DB
;enemy vars
enemy_y: DB
enemy_x: DB
enemy_frame: DB
;various things
game_over: DB
game_won: DB
cam_x: DB
cam_y: DB
;-------------
; OAM DATA
;-------------
SECTION "OAM Vars",WRAM0[$C100]
oam_sprites: DS 7
|
applet/aide/source/editors/aide-editor-of_signed_integer_type.adb
|
charlie5/aIDE
| 3 |
11331
|
<filename>applet/aide/source/editors/aide-editor-of_signed_integer_type.adb
with
aIDE.Editor.of_enumeration_literal,
AdaM.a_Type.enumeration_literal,
glib.Error,
gtk.Builder,
gtk.Handlers;
package body aIDE.Editor.of_signed_integer_type
is
use Gtk.Builder,
Glib,
glib.Error;
function on_name_Entry_leave (the_Entry : access Gtk_Entry_Record'Class;
Target : in AdaM.a_Type.signed_integer_type.view) return Boolean
is
the_Text : constant String := the_Entry.Get_Text;
begin
Target.Name_is (the_Text);
return False;
end on_name_Entry_leave;
procedure on_rid_Button_clicked (the_Button : access Gtk_Button_Record'Class;
the_Editor : in aIDE.Editor.of_signed_integer_type.view)
is
pragma Unreferenced (the_Editor);
begin
the_Button.get_Parent.destroy;
end on_rid_Button_clicked;
package Entry_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Entry_Record,
Boolean,
AdaM.a_Type.signed_integer_type.view);
package Button_Callbacks is new Gtk.Handlers.User_Callback (Gtk_Button_Record,
aIDE.Editor.of_signed_integer_type.view);
function on_is_Label_clicked (the_Label : access Gtk_Label_Record'Class;
Self : in aIDE.Editor.of_signed_integer_type.view) return Boolean
is
pragma Unreferenced (the_Label);
begin
-- Self.Target.add_Literal ("literal");
Self.freshen;
return False;
end on_is_Label_clicked;
package Label_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Label_Record,
Boolean,
aIDE.Editor.of_signed_integer_type.view);
package body Forge
is
function to_Editor (the_Target : in AdaM.a_Type.signed_integer_type.view) return View
is
use AdaM,
Glib;
Self : constant Editor.of_signed_integer_type.view := new Editor.of_signed_integer_type.item;
the_Builder : Gtk_Builder;
Error : aliased GError;
Result : Guint;
pragma Unreferenced (Result);
begin
Self.Target := the_Target;
Gtk_New (the_Builder);
Result := the_Builder.Add_From_File ("glade/editor/signed_integer_type_editor.glade", Error'Access);
if Error /= null then
raise Program_Error with "Error: adam.Editor.of_enumeration_type ~ " & Get_Message (Error);
end if;
Self.top_Box := gtk_Box (the_Builder.get_Object ("top_Box"));
Self.name_Entry := Gtk_Entry (the_Builder.get_Object ("name_Entry"));
Self.first_Entry := Gtk_Entry (the_Builder.get_Object ("first_Entry"));
Self.last_Entry := Gtk_Entry (the_Builder.get_Object ("last_Entry"));
-- Self.is_Label := Gtk_Label (the_Builder.get_Object ("is_Label"));
-- Self.literals_Box := gtk_Box (the_Builder.get_Object ("literals_Box"));
Self.rid_Button := gtk_Button (the_Builder.get_Object ("rid_Button"));
Self.name_Entry.Set_Text (+Self.Target.Name);
Entry_return_Callbacks.connect (Self.name_Entry,
"focus-out-event",
on_name_Entry_leave'Access,
the_Target);
Button_Callbacks.Connect (Self.rid_Button,
"clicked",
on_rid_Button_clicked'Access,
Self);
-- Label_return_Callbacks.Connect (Self.is_Label,
-- "button-release-event",
-- on_is_Label_clicked'Access,
-- Self);
Self.freshen;
return Self;
end to_Editor;
end Forge;
procedure destroy_Callback (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
is
begin
Widget.destroy;
end destroy_Callback;
overriding
procedure freshen (Self : in out Item)
is
use gtk.Widget;
-- the_Literals : AdaM.a_Type.enumeration_literal.vector renames Self.Target.Literals;
-- literal_Editor : aIDE.Editor.of_enumeration_literal.view;
begin
Self.first_Entry.set_Text (Long_Long_Integer'Image (Self.Target.First));
Self.last_Entry .set_Text (Long_Long_Integer'Image (Self.Target.Last));
-- Self.literals_Box.Foreach (destroy_Callback'Access);
-- for Each of the_Literals
-- loop
-- literal_Editor := Editor.of_enumeration_literal.Forge.to_Editor (Each,
-- targets_Parent => Self.Target.all'Access);
-- Self.literals_Box.pack_Start (literal_Editor.top_Widget);
-- end loop;
end freshen;
overriding
function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget
is
begin
return gtk.Widget.Gtk_Widget (Self.top_Box);
end top_Widget;
end aIDE.Editor.of_signed_integer_type;
|
oeis/229/A229679.asm
|
neoneye/loda-programs
| 11 |
103334
|
<gh_stars>10-100
; A229679: Number of defective 3-colorings of an n X 2 0..2 array connected diagonally and antidiagonally with exactly two mistakes, and colors introduced in row-major 0..2 order.
; Submitted by <NAME>(s4)
; 0,2,36,360,2688,17280,101376,559104,2949120,15040512,74711040,363331584,1736441856,8178892800,38050725888,175154135040,798863917056,3614214979584,16234976378880,72464688218112,321607151124480,1420019267272704,6240827999256576,27311868833955840,119063915148607488,517210269705830400,2239414914709979136,9666976600150769664,41613260556903383040,178666804417042317312,765251648682794680320,3270261847817321447424,13945738519724421021696,59352399057160482324480,252130097999462151487488
mul $0,2
mov $2,2
pow $2,$0
bin $0,2
mul $0,$2
mul $0,3
sub $0,24
div $0,8
add $0,3
|
source/Cosmos.Debug.DebugStub/Utilities.asm
|
ERamaM/Cosmos
| 0 |
94316
|
; Generated at 6/14/2016 12:11:29 PM
DebugStub_CheckStack:
add dword EAX, 0x4
mov dword EBX, EBP
add dword EBX, EAX
cmp dword EBX, ESP
JE near DebugStub_CheckStack_Block1_End
mov dword EAX, [ESP]
mov dword [DebugStub_CallerEIP], EAX
Call DebugStub_SendStackCorruptionOccurred
DebugStub_CheckStack_halt:
Jmp DebugStub_CheckStack_halt
DebugStub_CheckStack_Block1_End:
DebugStub_CheckStack_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_CheckStack_Exit
Ret
|
capture-mood.applescript
|
raxod502/mood-tracker
| 1 |
3828
|
<gh_stars>1-10
tell application "iTerm"
-- The path might have spaces in it. But we shouldn't need to
-- worry too much about the timestamp, since it's just an integer.
create window with default profile command "\"<PWD>/capture-mood.zsh\" <TIMESTAMP>"
activate
end tell
|
source/Quicksilver.popclipext/qs.applescript
|
cnstntn-kndrtv/PopClip-Extensions
| 1,262 |
4228
|
tell application id "com.blacktree.Quicksilver" to set selection to "{popclip text}"
|
alloy4fun_models/trashltl/models/8/ggdqBCRm545xXJGMa.als
|
Kaixi26/org.alloytools.alloy
| 0 |
2425
|
<reponame>Kaixi26/org.alloytools.alloy
open main
pred idggdqBCRm545xXJGMa_prop9 {
all f: File | always f not in Trash since f in Protected
}
pred __repair { idggdqBCRm545xXJGMa_prop9 }
check __repair { idggdqBCRm545xXJGMa_prop9 <=> prop9o }
|
audio/sfx/cry1d_3.asm
|
etdv-thevoid/pokemon-rgb-enhanced
| 1 |
11251
|
SFX_Cry1D_3_Ch4:
dutycycle 244
unknownsfx0x20 15, 240, 5, 7
unknownsfx0x20 10, 224, 0, 7
unknownsfx0x20 6, 180, 16, 7
unknownsfx0x20 4, 211, 0, 7
unknownsfx0x20 6, 178, 32, 6
unknownsfx0x20 8, 161, 36, 6
endchannel
SFX_Cry1D_3_Ch5:
dutycycle 34
unknownsfx0x20 15, 176, 195, 6
unknownsfx0x20 10, 160, 193, 6
unknownsfx0x20 6, 132, 210, 6
unknownsfx0x20 4, 147, 193, 6
unknownsfx0x20 6, 130, 225, 5
unknownsfx0x20 8, 97, 232, 5
endchannel
SFX_Cry1D_3_Ch7:
unknownnoise0x20 6, 230, 76
unknownnoise0x20 15, 214, 60
unknownnoise0x20 10, 197, 74
unknownnoise0x20 1, 178, 91
unknownnoise0x20 15, 194, 76
endchannel
|
electives/pw/lab/lista-1/ada/logger.ads
|
jerry-sky/academic-notebook
| 4 |
24558
|
<filename>electives/pw/lab/lista-1/ada/logger.ads
with External;
use External;
package Logger is
task type LoggerReceiver(n: Natural; d: Natural; k: Natural) is
entry Log(message: String);
entry LogMessageInTransit(msg: Natural; node: Natural);
entry Stop;
end LoggerReceiver;
type pLoggerReceiver is access LoggerReceiver;
end Logger;
|
src/init.asm
|
MrKomish/PYROS
| 5 |
18513
|
global kenter
global kexit
extern gdt_init
extern kmain
KERNEL_STACK_SIZE equ 4096
section .text
bits 32
align 4
kenter:
mov esp, kstack_top
push edx
push ebx
call kmain
hang:
jmp hang
kexit:
cli ; Disable CPU interrupts
hlt ; Halt the CPU
jmp hang
section .bss
align 4
kstack_bottom:
resb KERNEL_STACK_SIZE
kstack_top:
|
programs/oeis/168/A168057.asm
|
karttu/loda
| 0 |
176126
|
; A168057: Expansion of (1+8x^2+8x^3)/((1-2x)^2*(1+2x+4x^2)).
; 1,2,12,40,80,224,576,1152,2816,6656,13312,30720,69632,139264,311296,688128,1376256,3014656,6553600,13107200,28311552,60817408,121634816,260046848,553648128,1107296256,2348810240,4966055936,9932111872,20937965568,44023414784,88046829568,184683593728,386547056640,773094113280,1614907703296,3367254360064,6734508720128,14018773254144,29137058136064,58274116272128,120946279055360,250688651132928,501377302265856,1037938976620544,2146246697418752,4292493394837504,8866461766385664
mul $0,2
mov $2,$0
div $0,3
mul $0,2
add $0,1
lpb $2,1
mul $0,2
sub $2,2
lpe
mov $1,$0
|
perspective-sql/src/main/antlr4/org/meridor/perspective/sql/SQLLexer.g4
|
vania-pooh/perspective-backend
| 19 |
4148
|
lexer grammar SQLLexer;
// Query keywords
EXPLAIN
: 'explain'
;
SELECT
: 'select'
;
FROM
: 'from'
;
AS
: 'as'
;
WHERE
: 'where'
;
// Boolean operators
AND
: 'and' | '&&'
;
OR
: 'or' | '||'
;
XOR
: 'xor'
;
IS
: 'is'
;
LIKE
: 'like'
;
IN
: 'in'
;
EXISTS
: 'exists'
;
BETWEEN
: 'between'
;
ALL
: 'all'
;
ANY
: 'any'
;
NOT
: 'not' | '!'
;
// Relational operators
EQ
: '='
;
LT
: '<'
;
GT
: '>'
;
NOT_EQ
: '!='
;
LTE
: '<='
;
GTE
: '>='
;
// Arithmetic operators
MULTIPLY
: '*'
;
DIVIDE
: 'div' | '/'
;
MOD
: 'mod' | '%'
;
PLUS
: '+'
;
MINUS
: '-'
;
// String operations
REGEXP
: 'regexp'
;
// Bitwise operations
BIT_NOT
: '~'
;
BIT_OR
: '|'
;
BIT_AND
: '&'
;
BIT_XOR
: '^'
;
SHIFT_LEFT
: '<<'
;
SHIFT_RIGHT
: '>>'
;
// Misc keywords
BINARY
: 'binary'
;
ESCAPE
: 'escape'
;
USE
: 'use'
;
IGNORE
: 'ignore'
;
//Punctuation marks
RPAREN
: ')'
;
LPAREN
: '('
;
//RBRACK
// : ']'
// ;
//
//LBRACK
// : '['
// ;
//
//COLON
// : ':'
// ;
SEMICOLON
: ';'
;
COMMA
: ','
;
DOT
: '.'
;
// Join keywords
INNER
: 'inner'
;
OUTER
: 'outer'
;
JOIN
: 'join'
;
CROSS
: 'cross'
;
USING
: 'using'
;
// Or
ORDER
: 'order'
;
ASC
: 'asc'
;
DESC
: 'desc'
;
GROUP
: 'group'
;
HAVING
: 'having'
;
LIMIT
: 'limit'
;
OFFSET
: 'offset'
;
BY
: 'by'
;
STRAIGHT_JOIN
: 'straight_join'
;
NATURAL
: 'natural'
;
LEFT
: 'left'
;
RIGHT
: 'right'
;
ON
: 'on'
;
// Basic types
NULL
: 'null'
;
TRUE
: 'true'
;
FALSE
: 'false'
;
INT
: '0' .. '9'+
;
FLOAT
: ('0' .. '9')+.('0' .. '9')+
;
STRING
: '\'' ( ~'\'' )* '\''
;
ID
: ( '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' | '_' )+
;
NEWLINE
: '\r'? '\n' -> skip
;
WS
: ( ' ' | '\t' | '\n' | '\r' )+ -> skip
;
|
programs/oeis/077/A077024.asm
|
jmorken/loda
| 1 |
99842
|
<gh_stars>1-10
; A077024: Sum{Floor(n/k + 1/2): k=1,2,...,n}.
; 1,3,6,8,12,15,18,22,26,29,34,37,41,46,51,53,58,64,67,72,77,80,87,90,95,100,105,110,115,120,123,129,136,139,146,150,153,160,167,170,176,181,186,191,198,203,208,213,217,225,230,233,242,247,252,257,262,267
mov $3,$0
mov $6,$0
add $6,1
mov $12,$0
lpb $6
mov $0,$12
sub $6,1
sub $0,$6
mov $8,$0
mov $10,2
lpb $10
mov $0,$8
sub $10,1
add $0,$10
sub $0,1
mov $5,$0
mul $0,2
mov $2,2
mov $13,2
lpb $0
mov $4,$0
sub $0,1
add $13,2
div $4,$13
sub $4,1
add $4,$2
mov $2,$4
lpe
mov $7,$5
mul $7,4
mov $11,$10
mov $13,$2
add $13,$7
lpb $11
mov $9,$13
sub $11,1
lpe
lpe
lpb $8
mov $8,0
sub $9,$13
lpe
mov $13,$9
sub $13,1
add $1,$13
lpe
add $1,$3
|
programs/oeis/083/A083584.asm
|
karttu/loda
| 1 |
164096
|
<filename>programs/oeis/083/A083584.asm
; A083584: a(n) = (8*4^n - 5)/3.
; 1,9,41,169,681,2729,10921,43689,174761,699049,2796201,11184809,44739241,178956969,715827881,2863311529,11453246121,45812984489,183251937961,733007751849,2932031007401,11728124029609,46912496118441,187649984473769,750599937895081,3002399751580329
mov $1,4
pow $1,$0
div $1,3
mul $1,8
add $1,1
|
masm(msdos)/prueba.asm
|
GioProyects/ensamblador
| 0 |
18395
|
<reponame>GioProyects/ensamblador<filename>masm(msdos)/prueba.asm
page 60,132
title programa
.model small
.stack 64
.data
msg1 db "hola mundo$"
msg2 db "hola mundo$"
msg db "son iguales$"
x dw 0
.code
begin proc far
;assume ss:stacksg,ds:datasg,cs:codesg
mov ax,@data
mov ds,ax
comienzo:
mov si,x
mov al,msg2[si]
cmp msg1[si],al
jne fin
cmp msg1[si],"$"
jz final
inc x
loop comienzo
fin:
ret
final:
mov ah,09h
mov dx,offset msg
mov ax,4c00h
int 21h
begin endp
end begin
|
ImgAnnealing/src/imageops.ads
|
kochab/simulatedannealing-ada
| 0 |
10862
|
with Bitmaps.RGB;
package ImageOps is
function Manhattan_Distance (A, B : in Bitmaps.RGB.Pixel) return Natural;
function Adj_Distance_Sum
(Source : in Bitmaps.RGB.Image) return Long_Integer;
procedure Noise (Target : in out Bitmaps.RGB.Image);
end ImageOps;
|
win32/VC10/Win32/libxml2_Debug/DOCBparser.asm
|
txwizard/libxml2_x64_and_ARM
| 0 |
29455
|
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27027.1
TITLE C:\Users\DAG\Documents\_Clients\CodeProject Authors Group\Windows on ARM\libxml2\libxml2-2.9.9\DOCBparser.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM _xmlIsBaseCharGroup:BYTE:010H
COMM _xmlIsCharGroup:BYTE:010H
COMM _xmlIsCombiningGroup:BYTE:010H
COMM _xmlIsDigitGroup:BYTE:010H
COMM _xmlIsExtenderGroup:BYTE:010H
COMM _xmlIsIdeographicGroup:BYTE:010H
COMM _xmlIsPubidChar_tab:BYTE:0100H
COMM _xmlParserMaxDepth:DWORD
COMM _forbiddenExp:DWORD
COMM _emptyExp:DWORD
COMM _xmlMalloc:DWORD
COMM _xmlMallocAtomic:DWORD
COMM _xmlRealloc:DWORD
COMM _xmlFree:DWORD
COMM _xmlMemStrdup:DWORD
_DATA ENDS
msvcjmc SEGMENT
__188180DA_corecrt_math@h DB 01H
__2CC6E67D_corecrt_stdio_config@h DB 01H
__05476D76_corecrt_wstdio@h DB 01H
__A452D4A0_stdio@h DB 01H
__4FC8C4B1_docbparser@c DB 01H
msvcjmc ENDS
PUBLIC _docbEncodeEntities
PUBLIC _docbSAXParseDoc
PUBLIC _docbParseDoc
PUBLIC _docbSAXParseFile
PUBLIC _docbParseFile
PUBLIC _docbFreeParserCtxt
PUBLIC _docbCreatePushParserCtxt
PUBLIC _docbParseChunk
PUBLIC _docbCreateFileParserCtxt
PUBLIC _docbParseDocument
PUBLIC __JustMyCode_Default
PUBLIC ??_C@_0DC@BOMECCGF@docbEncodeEntities?$CI?$CJ?5deprecated@ ; `string'
PUBLIC ??_C@_0DB@NDDOLLGP@docbParseDocument?$CI?$CJ?5deprecated?5@ ; `string'
PUBLIC ??_C@_0DC@FKBIEDMA@docbFreeParserCtxt?$CI?$CJ?5deprecated@ ; `string'
PUBLIC ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@ ; `string'
PUBLIC ??_C@_0DI@INHANBFE@docbCreateFileParserCtxt?$CI?$CJ?5depr@ ; `string'
PUBLIC ??_C@_0DA@FOPOJOII@docbSAXParseFile?$CI?$CJ?5deprecated?5f@ ; `string'
PUBLIC ??_C@_0CN@PHDHKKPB@docbParseFile?$CI?$CJ?5deprecated?5func@ ; `string'
EXTRN _xmlStrlen:PROC
EXTRN ___xmlGenericError:PROC
EXTRN ___xmlGenericErrorContext:PROC
EXTRN _xmlParseDoc:PROC
EXTRN _xmlParseFile:PROC
EXTRN _xmlParseDocument:PROC
EXTRN _xmlSAXParseMemoryWithData:PROC
EXTRN _xmlSAXParseFileWithData:PROC
EXTRN _xmlFreeParserCtxt:PROC
EXTRN _xmlCreatePushParserCtxt:PROC
EXTRN _xmlParseChunk:PROC
EXTRN _xmlCreateFileParserCtxt:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN __RTC_CheckEsp:PROC
EXTRN __RTC_InitBase:PROC
EXTRN __RTC_Shutdown:PROC
_BSS SEGMENT
?deprecated@?1??docbEncodeEntities@@9@9 DD 01H DUP (?) ; `docbEncodeEntities'::`2'::deprecated
?deprecated@?1??docbParseDocument@@9@9 DD 01H DUP (?) ; `docbParseDocument'::`2'::deprecated
?deprecated@?1??docbFreeParserCtxt@@9@9 DD 01H DUP (?) ; `docbFreeParserCtxt'::`2'::deprecated
?deprecated@?1??docbParseChunk@@9@9 DD 01H DUP (?) ; `docbParseChunk'::`2'::deprecated
?deprecated@?1??docbCreatePushParserCtxt@@9@9 DD 01H DUP (?) ; `docbCreatePushParserCtxt'::`2'::deprecated
?deprecated@?1??docbSAXParseDoc@@9@9 DD 01H DUP (?) ; `docbSAXParseDoc'::`2'::deprecated
?deprecated@?1??docbParseDoc@@9@9 DD 01H DUP (?) ; `docbParseDoc'::`2'::deprecated
?deprecated@?1??docbCreateFileParserCtxt@@9@9 DD 01H DUP (?) ; `docbCreateFileParserCtxt'::`2'::deprecated
?deprecated@?1??docbSAXParseFile@@9@9 DD 01H DUP (?) ; `docbSAXParseFile'::`2'::deprecated
?deprecated@?1??docbParseFile@@9@9 DD 01H DUP (?) ; `docbParseFile'::`2'::deprecated
_BSS ENDS
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ ENDS
; COMDAT ??_C@_0CN@PHDHKKPB@docbParseFile?$CI?$CJ?5deprecated?5func@
CONST SEGMENT
??_C@_0CN@PHDHKKPB@docbParseFile?$CI?$CJ?5deprecated?5func@ DB 'docbParse'
DB 'File() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0DA@FOPOJOII@docbSAXParseFile?$CI?$CJ?5deprecated?5f@
CONST SEGMENT
??_C@_0DA@FOPOJOII@docbSAXParseFile?$CI?$CJ?5deprecated?5f@ DB 'docbSAXPa'
DB 'rseFile() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0DI@INHANBFE@docbCreateFileParserCtxt?$CI?$CJ?5depr@
CONST SEGMENT
??_C@_0DI@INHANBFE@docbCreateFileParserCtxt?$CI?$CJ?5depr@ DB 'docbCreate'
DB 'FileParserCtxt() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@
CONST SEGMENT
??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@ DB 'docbParse'
DB 'Chunk() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0DC@FKBIEDMA@docbFreeParserCtxt?$CI?$CJ?5deprecated@
CONST SEGMENT
??_C@_0DC@FKBIEDMA@docbFreeParserCtxt?$CI?$CJ?5deprecated@ DB 'docbFreePa'
DB 'rserCtxt() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0DB@NDDOLLGP@docbParseDocument?$CI?$CJ?5deprecated?5@
CONST SEGMENT
??_C@_0DB@NDDOLLGP@docbParseDocument?$CI?$CJ?5deprecated?5@ DB 'docbParse'
DB 'Document() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0DC@BOMECCGF@docbEncodeEntities?$CI?$CJ?5deprecated@
CONST SEGMENT
??_C@_0DC@BOMECCGF@docbEncodeEntities?$CI?$CJ?5deprecated@ DB 'docbEncode'
DB 'Entities() deprecated function reached', 0aH, 00H ; `string'
CONST ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbParseDocument
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_docbParseDocument PROC ; COMDAT
; 66 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 67 : static int deprecated = 0;
; 68 :
; 69 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbParseDocument@@9@9, 0
jne SHORT $LN2@docbParseD
; 70 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0DB@NDDOLLGP@docbParseDocument?$CI?$CJ?5deprecated?5@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 71 : "docbParseDocument() deprecated function reached\n");
; 72 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbParseDocument@@9@9, 1
$LN2@docbParseD:
; 73 : }
; 74 : return (xmlParseDocument(ctxt));
mov edx, DWORD PTR _ctxt$[ebp]
push edx
call _xmlParseDocument
add esp, 4
; 75 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbParseDocument ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbCreateFileParserCtxt
_TEXT SEGMENT
_filename$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_docbCreateFileParserCtxt PROC ; COMDAT
; 233 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 234 : static int deprecated = 0;
; 235 :
; 236 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbCreateFileParserCtxt@@9@9, 0
jne SHORT $LN2@docbCreate
; 237 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0DI@INHANBFE@docbCreateFileParserCtxt?$CI?$CJ?5depr@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 238 : "docbCreateFileParserCtxt() deprecated function reached\n");
; 239 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbCreateFileParserCtxt@@9@9, 1
$LN2@docbCreate:
; 240 : }
; 241 :
; 242 : return (xmlCreateFileParserCtxt(filename));
mov edx, DWORD PTR _filename$[ebp]
push edx
call _xmlCreateFileParserCtxt
add esp, 4
; 243 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbCreateFileParserCtxt ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbParseChunk
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_chunk$ = 12 ; size = 4
_size$ = 16 ; size = 4
_terminate$ = 20 ; size = 4
_docbParseChunk PROC ; COMDAT
; 114 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 115 : static int deprecated = 0;
; 116 :
; 117 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbParseChunk@@9@9, 0
jne SHORT $LN2@docbParseC
; 118 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 119 : "docbParseChunk() deprecated function reached\n");
; 120 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbParseChunk@@9@9, 1
$LN2@docbParseC:
; 121 : }
; 122 :
; 123 : return (xmlParseChunk(ctxt, chunk, size, terminate));
mov edx, DWORD PTR _terminate$[ebp]
push edx
mov eax, DWORD PTR _size$[ebp]
push eax
mov ecx, DWORD PTR _chunk$[ebp]
push ecx
mov edx, DWORD PTR _ctxt$[ebp]
push edx
call _xmlParseChunk
add esp, 16 ; 00000010H
; 124 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbParseChunk ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbCreatePushParserCtxt
_TEXT SEGMENT
_sax$ = 8 ; size = 4
_user_data$ = 12 ; size = 4
_chunk$ = 16 ; size = 4
_size$ = 20 ; size = 4
_filename$ = 24 ; size = 4
_enc$ = 28 ; size = 4
_docbCreatePushParserCtxt PROC ; COMDAT
; 149 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 150 : static int deprecated = 0;
; 151 :
; 152 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbCreatePushParserCtxt@@9@9, 0
jne SHORT $LN2@docbCreate
; 153 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 154 : "docbParseChunk() deprecated function reached\n");
; 155 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbCreatePushParserCtxt@@9@9, 1
$LN2@docbCreate:
; 156 : }
; 157 :
; 158 : return(xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename));
mov edx, DWORD PTR _filename$[ebp]
push edx
mov eax, DWORD PTR _size$[ebp]
push eax
mov ecx, DWORD PTR _chunk$[ebp]
push ecx
mov edx, DWORD PTR _user_data$[ebp]
push edx
mov eax, DWORD PTR _sax$[ebp]
push eax
call _xmlCreatePushParserCtxt
add esp, 20 ; 00000014H
; 159 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbCreatePushParserCtxt ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbFreeParserCtxt
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_docbFreeParserCtxt PROC ; COMDAT
; 87 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 88 : static int deprecated = 0;
; 89 :
; 90 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbFreeParserCtxt@@9@9, 0
jne SHORT $LN2@docbFreePa
; 91 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0DC@FKBIEDMA@docbFreeParserCtxt?$CI?$CJ?5deprecated@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 92 : "docbFreeParserCtxt() deprecated function reached\n");
; 93 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbFreeParserCtxt@@9@9, 1
$LN2@docbFreePa:
; 94 : }
; 95 : xmlFreeParserCtxt(ctxt);
mov edx, DWORD PTR _ctxt$[ebp]
push edx
call _xmlFreeParserCtxt
add esp, 4
; 96 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbFreeParserCtxt ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbParseFile
_TEXT SEGMENT
_filename$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_docbParseFile PROC ; COMDAT
; 292 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 293 : static int deprecated = 0;
; 294 :
; 295 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbParseFile@@9@9, 0
jne SHORT $LN2@docbParseF
; 296 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0CN@PHDHKKPB@docbParseFile?$CI?$CJ?5deprecated?5func@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 297 : "docbParseFile() deprecated function reached\n");
; 298 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbParseFile@@9@9, 1
$LN2@docbParseF:
; 299 : }
; 300 :
; 301 : return (xmlParseFile(filename));
mov edx, DWORD PTR _filename$[ebp]
push edx
call _xmlParseFile
add esp, 4
; 302 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbParseFile ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbSAXParseFile
_TEXT SEGMENT
_filename$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_sax$ = 16 ; size = 4
_userData$ = 20 ; size = 4
_docbSAXParseFile PROC ; COMDAT
; 265 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 266 : static int deprecated = 0;
; 267 :
; 268 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbSAXParseFile@@9@9, 0
jne SHORT $LN2@docbSAXPar
; 269 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0DA@FOPOJOII@docbSAXParseFile?$CI?$CJ?5deprecated?5f@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 270 : "docbSAXParseFile() deprecated function reached\n");
; 271 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbSAXParseFile@@9@9, 1
$LN2@docbSAXPar:
; 272 : }
; 273 :
; 274 : return (xmlSAXParseFileWithData(sax, filename, 0, userData));
mov edx, DWORD PTR _userData$[ebp]
push edx
push 0
mov eax, DWORD PTR _filename$[ebp]
push eax
mov ecx, DWORD PTR _sax$[ebp]
push ecx
call _xmlSAXParseFileWithData
add esp, 16 ; 00000010H
; 275 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbSAXParseFile ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbParseDoc
_TEXT SEGMENT
_cur$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_docbParseDoc PROC ; COMDAT
; 206 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 207 : static int deprecated = 0;
; 208 :
; 209 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbParseDoc@@9@9, 0
jne SHORT $LN2@docbParseD
; 210 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 211 : "docbParseChunk() deprecated function reached\n");
; 212 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbParseDoc@@9@9, 1
$LN2@docbParseD:
; 213 : }
; 214 :
; 215 : return (xmlParseDoc(cur));
mov edx, DWORD PTR _cur$[ebp]
push edx
call _xmlParseDoc
add esp, 4
; 216 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbParseDoc ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbSAXParseDoc
_TEXT SEGMENT
_cur$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_sax$ = 16 ; size = 4
_userData$ = 20 ; size = 4
_docbSAXParseDoc PROC ; COMDAT
; 180 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 181 : static int deprecated = 0;
; 182 :
; 183 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbSAXParseDoc@@9@9, 0
jne SHORT $LN2@docbSAXPar
; 184 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0CO@NKDAPPKB@docbParseChunk?$CI?$CJ?5deprecated?5fun@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 185 : "docbParseChunk() deprecated function reached\n");
; 186 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbSAXParseDoc@@9@9, 1
$LN2@docbSAXPar:
; 187 : }
; 188 :
; 189 : return (xmlSAXParseMemoryWithData(sax, (const char *)cur,
mov edx, DWORD PTR _userData$[ebp]
push edx
push 0
mov eax, DWORD PTR _cur$[ebp]
push eax
call _xmlStrlen
add esp, 4
push eax
mov ecx, DWORD PTR _cur$[ebp]
push ecx
mov edx, DWORD PTR _sax$[ebp]
push edx
call _xmlSAXParseMemoryWithData
add esp, 20 ; 00000014H
; 190 : xmlStrlen((const xmlChar *) cur), 0, userData));
; 191 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbSAXParseDoc ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\docbparser.c
; COMDAT _docbEncodeEntities
_TEXT SEGMENT
_out$ = 8 ; size = 4
_outlen$ = 12 ; size = 4
_in$ = 16 ; size = 4
_inlen$ = 20 ; size = 4
_quoteChar$ = 24 ; size = 4
_docbEncodeEntities PROC ; COMDAT
; 42 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __4FC8C4B1_docbparser@c
call @__CheckForDebuggerJustMyCode@4
; 43 : static int deprecated = 0;
; 44 :
; 45 : if (!deprecated) {
cmp DWORD PTR ?deprecated@?1??docbEncodeEntities@@9@9, 0
jne SHORT $LN2@docbEncode
; 46 : xmlGenericError(xmlGenericErrorContext,
mov esi, esp
push OFFSET ??_C@_0DC@BOMECCGF@docbEncodeEntities?$CI?$CJ?5deprecated@
call ___xmlGenericErrorContext
mov eax, DWORD PTR [eax]
push eax
call ___xmlGenericError
mov ecx, DWORD PTR [eax]
call ecx
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 47 : "docbEncodeEntities() deprecated function reached\n");
; 48 : deprecated = 1;
mov DWORD PTR ?deprecated@?1??docbEncodeEntities@@9@9, 1
$LN2@docbEncode:
; 49 : }
; 50 : return(-1);
or eax, -1
; 51 : }
pop esi
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_docbEncodeEntities ENDP
_TEXT ENDS
END
|
programs/oeis/333/A333461.asm
|
neoneye/loda
| 22 |
18694
|
; A333461: a(n) = gcd(2*n, binomial(2*n,n))/2.
; 1,1,1,1,1,6,1,1,1,2,1,2,1,2,15,1,1,6,1,10,3,2,1,6,1,2,1,28,1,2,1,1,3,2,7,2,1,2,1,10,1,42,1,4,45,2,1,6,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,1,5,66,1,2,3,10,1,18,1,2,15,4,77,6,1,10,1,2,1,28,5,2,3,44,1,10,91,4,1,2,5,6,1,2,33,20
add $0,1
sub $2,$0
bin $2,$0
gcd $0,$2
|
PyRInText.g4
|
AkiraHakuta/PyRInText
| 0 |
5697
|
// antlr_target(PyRLaTeXGrammar PyRInText.g4 LISTENER)
grammar PyRInText;
stat : body*;
body : ( pyr | others );
pyr : PYCODE # pycode
| PYC # pyc
| PYP # pyp
| RCODE # rcode
| RC # rc
| RCAT # rcat
;
others : OTHER+ ;
PYCODE : '\\begin{pycode}' .*? '\\end{pycode}' ;
PYC : '\\pyc{' .*? '\\pyc}' ;
PYP : '\\pyp{' .*? '\\pyp}' ;
RCODE : '\\begin{Rcode}' .*? '\\end{Rcode}' ;
RC : '\\Rc{' .*? '\\Rc}' ;
RCAT : '\\Rcat{' .*? '\\Rcat}' ;
OTHER : .(~[\\]*);
|
programs/oeis/183/A183207.asm
|
neoneye/loda
| 22 |
554
|
<reponame>neoneye/loda
; A183207: Termwise products of the natural numbers and odd integers repeated
; 1,2,9,12,25,30,49,56,81,90,121,132,169,182,225,240,289,306,361,380,441,462,529,552,625,650,729,756,841,870,961,992,1089,1122,1225,1260,1369,1406,1521,1560,1681,1722,1849,1892,2025,2070,2209,2256,2401,2450,2601,2652,2809,2862,3025,3080,3249,3306,3481,3540,3721,3782,3969,4032,4225,4290,4489,4556,4761,4830,5041,5112,5329,5402,5625,5700,5929,6006,6241,6320,6561,6642,6889,6972,7225,7310,7569,7656,7921,8010,8281,8372,8649,8742,9025,9120,9409,9506,9801,9900
mov $1,$0
add $1,1
mov $2,$0
mod $2,2
sub $2,1
sub $0,$2
mul $0,$1
|
ASM/334.asm
|
Morgan-iv/Main-source-folder
| 1 |
81613
|
global _start
section .bss
text resb 100
buf resb 1
section .data
probel db 10
section .text
_start:
xor esi, esi ;counter
read:
mov eax, 3 ;read
mov ebx, 0 ;stdin
mov ecx, text
add ecx, esi
mov edx, 1 ;read byte
int 80h
cmp eax, 0
jb error
cmp byte[text + esi], '.'
je readok
inc esi
jmp read
readok:
xor esi, esi
print:
mov eax, 4 ;write
mov ebx, 1 ;stdout
mov ecx, text ;adress
add ecx, esi ;adress[esi]
mov edx, 1 ;write 1 byte
int 80h
inc esi
cmp esi, 100
jb print
;print \n
mov eax, 4
mov ebx, 1
mov ecx, probel
mov edx, 1
int 80h
exit:
clear_buffer:
mov eax, 3
mov ebx, 0
mov ecx, buf
mov edx, 1
int 80h
cmp byte[ecx], 10
jne clear_buffer
mov eax, 1
mov ebx, 0
int 80h
error:
mov eax, 1
mov ebx, 1
int 80h
|
archive/agda-1/NaturalDeduction-PatternLambdaBug.agda
|
m0davis/oscar
| 0 |
10563
|
{-# OPTIONS --rewriting #-}
{-# OPTIONS --show-implicit #-}
module NaturalDeduction-PatternLambdaBug
where
record ⊤ : Set where
data ⊥ : Set where
foo : ⦃ _ : ⊤ ⦄ → ⊥ → Set
foo = λ {x → {!x!}}
{-
C-c C-c above generates invalid syntax:
foo = λ { }
Found an implicit lambda where an explicit lambda was expected
when checking that the expression λ {} has type ⊥ → Set
Better would have been
foo = λ {()}
-}
-- module DelayMishMash where
-- open import Level --public
-- using (Level) renaming (zero to lzero; suc to lsuc)
-- open import Size public
-- open import Prelude.Monad renaming (Monad to RawMonad)
-- --open import Category.Monad public
-- -- using (RawMonad; module RawMonad)
-- open import Data.Empty --public
-- using (⊥; ⊥-elim)
-- open import Data.List --public
-- using (List; []; _∷_; map)
-- open import Data.Maybe --public
-- using (Maybe; just; nothing) renaming (map to fmap)
-- open import Data.Product public
-- using (∃; _×_; _,_) renaming (proj₁ to fst; proj₂ to snd)
-- --infixr 1 _,_
-- open import Data.Sum --public
-- using (_⊎_; [_,_]′) renaming (inj₁ to inl; inj₂ to inr)
-- open import Data.Unit --public
-- using (⊤)
-- open import Function --public
-- using (_∘_; case_of_)
-- open import Relation.Nullary --public
-- using (Dec; yes; no)
-- open import Relation.Binary --public
-- using (Setoid; module Setoid)
-- import Relation.Binary.PreorderReasoning
-- module Pre = Relation.Binary.PreorderReasoning
-- open import Relation.Binary.PropositionalEquality --public
-- using (_≡_; refl; sym; trans; cong; cong₂; subst; module ≡-Reasoning)
-- --open ≡-Reasoning renaming (begin_ to proof_) public
-- open import Relation.Binary.HeterogeneousEquality --public
-- using (_≅_; refl; ≡-to-≅; module ≅-Reasoning)
-- renaming (sym to hsym; trans to htrans; cong to hcong;
-- cong₂ to hcong₂; subst to hsubst)
-- hcong₃ : {A : Set}{B : A → Set}{C : ∀ a → B a → Set}{D : ∀ a b → C a b → Set}
-- (f : ∀ a b c → D a b c)
-- {a a′ : A} → a ≅ a′ →
-- {b : B a}{b′ : B a′} → b ≅ b′ →
-- {c : C a b}{c′ : C a′ b′} → c ≅ c′ →
-- f a b c ≅ f a′ b′ c′
-- hcong₃ f refl refl refl = refl
-- ≅-to-≡ : ∀ {a} {A : Set a} {x y : A} → x ≅ y → x ≡ y
-- ≅-to-≡ refl = refl
-- mutual
-- data Delay (i : Size) (A : Set) : Set where
-- now : A → Delay i A
-- later : ∞Delay i A → Delay i A
-- record ∞Delay (i : Size) (A : Set) : Set where
-- coinductive
-- field
-- force : {j : Size< i} → Delay j A
-- open ∞Delay public
-- never : ∀{i A} → ∞Delay i A
-- force (never {i}) {j} = later (never {j})
-- module Bind where
-- mutual
-- bindDelay : ∀ {i A B} → Delay i A → (A → Delay i B) → Delay i B
-- bindDelay (now a) f = f a
-- bindDelay (later a∞) f = later (bind∞Delay a∞ f)
-- bind∞Delay : ∀ {i A B} → ∞Delay i A → (A → Delay i B) → ∞Delay i B
-- force (bind∞Delay a∞ f) = bindDelay (force a∞) f
-- _d>>=_ : ∀ {i A B} → Delay i A → (A → Delay i B) → Delay i B
-- _d>>=_ {i} = Bind.bindDelay {i}
-- {-
-- open import Prelude.Applicative using (Applicative)
-- instance delayApplicative : ∀ {i} → Applicative (Delay i)
-- Applicative.pure (delayApplicative {i}) x = now x
-- Applicative._<*>_ (delayApplicative {i}) (now f) x = x d>>= (now ∘ f)
-- Applicative._<*>_ (delayApplicative {i}) (later f) x = {!force f {i}!}
-- {-
-- Applicative._<*>_ (delayApplicative {i}) f (now x) = {!x!} -- Bind.bindDelay x (λ x₁ → {!!})
-- Applicative._<*>_ (delayApplicative {i}) (now f) (later x) = {!!} -- Bind.bindDelay x (λ x₁ → {!!})
-- Applicative._<*>_ (delayApplicative {i}) (later f) (later x) = {!!} -- Bind.bindDelay x (λ x₁ → {!!})
-- -}
-- Applicative.super (delayApplicative {i}) = {!!}
-- -}
-- {-
-- instance delayMonad : ∀ {i} → RawMonad (Delay i)
-- delayMonad {i} = record
-- { {-return = now
-- ; -}_>>=_ = bindDelay {i}
-- } where open Bind
-- -}
-- {-
-- module _ {i : Size} where
-- open module DelayMonad = RawMonad (delayMonad {i = i})
-- public -- renaming (_⊛_ to _<*>_)
-- -}
-- open Bind public using () renaming (bind∞Delay to _∞>>=_)
-- -- Map for Delay
-- dreturn : {i : Size} → {A : Set} → A → Delay i A
-- dreturn {i} = Delay.now {i}
-- _d<$>_ : ∀ {i A B} (f : A → B) (a : Delay i A) → Delay i B
-- f d<$> a = a d>>= λ a → dreturn (f a)
-- -- Map for ∞Delay
-- _∞<$>_ : ∀ {i A B} (f : A → B) (∞a : ∞Delay i A) → ∞Delay i B
-- f ∞<$> ∞a = ∞a ∞>>= λ a → dreturn (f a)
-- -- force (f ∞<$> ∞a) = f <$> force ∞a
-- -- Double bind
-- _=<<2_,_ : ∀ {i A B C} → (A → B → Delay i C) → Delay i A → Delay i B → Delay i C
-- f =<<2 x , y = x d>>= λ a → y d>>= λ b → f a b
-- mutual
-- data _∼_ {i : Size} {A : Set} : (a? b? : Delay ∞ A) → Set where
-- ∼now : ∀ a → now a ∼ now a
-- ∼later : ∀ {a∞ b∞} (eq : a∞ ∞∼⟨ i ⟩∼ b∞) → later a∞ ∼ later b∞
-- _∼⟨_⟩∼_ = λ {A} a? i b? → _∼_ {i}{A} a? b?
-- record _∞∼⟨_⟩∼_ {A} (a∞ : ∞Delay ∞ A) i (b∞ : ∞Delay ∞ A) : Set where
-- coinductive
-- field
-- ∼force : {j : Size< i} → force a∞ ∼⟨ j ⟩∼ force b∞
-- _∞∼_ = λ {i} {A} a∞ b∞ → _∞∼⟨_⟩∼_ {A} a∞ i b∞
-- open _∞∼⟨_⟩∼_ public
-- ∼never : ∀{i A} → (never {A = A}) ∞∼⟨ i ⟩∼ never
-- ∼force ∼never = ∼later ∼never
-- ∼refl : ∀{i A} (a? : Delay ∞ A) → a? ∼⟨ i ⟩∼ a?
-- ∞∼refl : ∀{i A} (a∞ : ∞Delay ∞ A) → a∞ ∞∼⟨ i ⟩∼ a∞
-- ∼sym : ∀{i A}{a? b? : Delay ∞ A } → a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ a?
-- ∞∼sym : ∀{i A}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ a∞
-- ∼trans : ∀{i A}{a? b? c? : Delay ∞ A} →
-- a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ c? → a? ∼⟨ i ⟩∼ c?
-- ∞∼trans : ∀{i A}{a∞ b∞ c∞ : ∞Delay ∞ A} →
-- a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ c∞ → a∞ ∞∼⟨ i ⟩∼ c∞
-- ∼refl (now a) = ∼now a
-- ∼refl (later a∞) = ∼later (∞∼refl a∞)
-- ∼force (∞∼refl a∞) = ∼refl (force a∞)
-- ∼sym (∼now a) = ∼now a
-- ∼sym (∼later eq) = ∼later (∞∼sym eq)
-- ∼force (∞∼sym eq) = ∼sym (∼force eq)
-- ∼trans (∼now a) (∼now .a) = ∼now a
-- ∼trans (∼later eq) (∼later eq′) = ∼later (∞∼trans eq eq′)
-- ∼force (∞∼trans eq eq′) = ∼trans (∼force eq) (∼force eq′)
-- -- Equality reasoning
-- ∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
-- ∼setoid i A = record
-- { Carrier = Delay ∞ A
-- ; _≈_ = _∼_ {i}
-- ; isEquivalence = record
-- { refl = λ {a?} → ∼refl a?
-- ; sym = ∼sym
-- ; trans = ∼trans
-- }
-- }
-- ∞∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
-- ∞∼setoid i A = record
-- { Carrier = ∞Delay ∞ A
-- ; _≈_ = _∞∼_ {i}
-- ; isEquivalence = record
-- { refl = λ {a?} → ∞∼refl a?
-- ; sym = ∞∼sym
-- ; trans = ∞∼trans
-- }
-- }
-- module ∼-Reasoning {i : Size} {A : Set} where
-- open Pre (Setoid.preorder (∼setoid i A)) public
-- -- using (begin_; _∎) (_≈⟨⟩_ to _∼⟨⟩_; _≈⟨_⟩_ to _∼⟨_⟩_)
-- renaming (_≈⟨⟩_ to _≡⟨⟩_; _≈⟨_⟩_ to _≡⟨_⟩_; _∼⟨_⟩_ to _∼⟨_⟩_; begin_ to proof_)
-- module ∞∼-Reasoning {i : Size} {A : Set} where
-- open Pre (Setoid.preorder (∞∼setoid i A)) public
-- -- using (begin_; _∎) (_≈⟨⟩_ to _∼⟨⟩_; _≈⟨_⟩_ to _∼⟨_⟩_)
-- renaming (_≈⟨⟩_ to _≡⟨⟩_; _≈⟨_⟩_ to _≡⟨_⟩_; _∼⟨_⟩_ to _∞∼⟨_⟩_; begin_ to proof_)
-- mutual
-- bind-assoc : ∀{i A B C} (m : Delay ∞ A)
-- {k : A → Delay ∞ B} {l : B → Delay ∞ C} →
-- ((m d>>= k) d>>= l) ∼⟨ i ⟩∼ (m d>>= λ a → (k a d>>= l))
-- bind-assoc (now a) = ∼refl _
-- bind-assoc (later a∞) = ∼later (∞bind-assoc a∞)
-- ∞bind-assoc : ∀{i A B C} (a∞ : ∞Delay ∞ A)
-- {k : A → Delay ∞ B} {l : B → Delay ∞ C} →
-- ((a∞ ∞>>= k) ∞>>= l) ∞∼⟨ i ⟩∼ (a∞ ∞>>= λ a → (k a d>>= l))
-- ∼force (∞bind-assoc a∞) = bind-assoc (force a∞)
-- bind-cong-l : ∀{i A B}{a? b? : Delay ∞ A} → a? ∼⟨ i ⟩∼ b? →
-- (k : A → Delay ∞ B) → (a? d>>= k) ∼⟨ i ⟩∼ (b? d>>= k)
-- ∞bind-cong-l : ∀{i A B}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ →
-- (k : A → Delay ∞ B) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (b∞ ∞>>= k)
-- bind-cong-r : ∀{i A B}(a? : Delay ∞ A){k l : A → Delay ∞ B} →
-- (∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a? d>>= k) ∼⟨ i ⟩∼ (a? d>>= l)
-- ∞bind-cong-r : ∀{i A B}(a∞ : ∞Delay ∞ A){k l : A → Delay ∞ B} →
-- (∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (a∞ ∞>>= l)
-- bind-cong-l (∼now a) k = ∼refl _
-- bind-cong-l (∼later eq) k = ∼later (∞bind-cong-l eq k)
-- ∼force (∞bind-cong-l eq k) = bind-cong-l (∼force eq) k
-- bind-cong-r (now a) h = h a
-- bind-cong-r (later a∞) h = ∼later (∞bind-cong-r a∞ h)
-- ∼force (∞bind-cong-r a∞ h) = bind-cong-r (force a∞) h
-- open import Prelude.Functor using (Functor; _<$>_)
-- {-
-- instance FunctorDelay : {i : Size} → Functor (Delay i)
-- Functor.fmap (FunctorDelay {i}) {A} {B} f (now x) = {!!}
-- Functor.fmap (FunctorDelay {i}) {A} {B} f (later x) = {!!}
-- -}
-- open import Prelude.Function using (_∘′_)
-- map-compose : ∀{i A B C} (a? : Delay ∞ A) {f : A → B} {g : B → C} →
-- (g d<$> (f d<$> a?)) ∼⟨ i ⟩∼ ((g ∘ f) d<$> a?)
-- map-compose a? = bind-assoc a?
-- map-cong : ∀{i A B}{a? b? : Delay ∞ A} (f : A → B) →
-- a? ∼⟨ i ⟩∼ b? → (f d<$> a?) ∼⟨ i ⟩∼ (f d<$> b?)
-- map-cong f eq = bind-cong-l eq (now ∘ f)
-- data _⇓_ {A : Set} : (a? : Delay ∞ A) (a : A) → Set where
-- now⇓ : ∀{a} → now a ⇓ a
-- later⇓ : ∀{a} {a∞ : ∞Delay ∞ A} → force a∞ ⇓ a → later a∞ ⇓ a
-- _⇓ : {A : Set} (x : Delay ∞ A) → Set
-- x ⇓ = ∃ λ a → x ⇓ a
-- map⇓ : ∀{A B}{a : A}{a? : Delay ∞ A}(f : A → B) → a? ⇓ a → (f d<$> a?) ⇓ f a
-- subst∼⇓ : ∀{A}{a? a?′ : Delay ∞ A}{a : A} → a? ⇓ a → a? ∼ a?′ → a?′ ⇓ a
-- bind⇓ : ∀{A B}(f : A → Delay ∞ B){?a : Delay ∞ A}{a : A}{b : B} →
-- ?a ⇓ a → f a ⇓ b → (?a d>>= f) ⇓ b
-- map⇓ f now⇓ = now⇓
-- map⇓ f (later⇓ a⇓) = later⇓ (map⇓ f a⇓)
-- subst∼⇓ now⇓ (∼now a) = now⇓
-- subst∼⇓ (later⇓ p) (∼later eq) = later⇓ (subst∼⇓ p (∼force eq))
-- bind⇓ f now⇓ q = q
-- bind⇓ f (later⇓ p) q = later⇓ (bind⇓ f p q)
-- --infixr 6 _⇒_
-- --infixl 1 _,_
-- module CustomPrelude where
-- open import Prelude public
-- renaming (_==_ to _≟_) -- TODO ask Agda to rename Eq._==_ to Eq._≟_
-- hiding (force) -- needed by ∞Delay
-- {-# BUILTIN REWRITE _≡_ #-}
-- --{-# DISPLAY Eq._==_ _ = _≟_ #-}
-- open import Container.List renaming (_∈_ to _∈C_; lookup∈ to lookup∈C) public
-- _∈C?_ : ∀ {ℓ} {A : Set ℓ} ⦃ _ : Eq A ⦄ (a : A) → (xs : List A) → Dec (a ∈C xs)
-- a ∈C? [] = no λ ()
-- a ∈C? (x ∷ xs) with a ≟ x
-- … | yes a≡x rewrite a≡x = yes (zero refl)
-- … | no a≢x with a ∈C? xs
-- … | yes a∈xs = yes (suc a∈xs)
-- … | no a∉xs = no (λ {(zero a≡x) → a≢x a≡x ; (suc a∈xs) → a∉xs a∈xs})
-- data _∈_ {ℓ} {A : Set ℓ} (a : A) : List A → Set ℓ
-- where
-- here : (as : List A) → a ∈ (a ∷ as)
-- there : (x : A) {as : List A} → a ∈ as → a ∈ (x ∷ as)
-- _∉_ : ∀ {ℓ} {A : Set ℓ} ⦃ _ : Eq A ⦄ (a : A) → (xs : List A) → Set ℓ
-- a ∉ xs = ¬ (a ∈ xs)
-- _∈?_ : ∀ {ℓ} {A : Set ℓ} ⦃ _ : Eq A ⦄ (a : A) → (xs : List A) → Dec (a ∈ xs)
-- a ∈? [] = no λ ()
-- a ∈? (x ∷ xs) with a ≟ x
-- … | yes a≡x rewrite a≡x = yes (here xs)
-- … | no a≢x with a ∈? xs
-- … | yes a∈xs = yes (there x a∈xs)
-- … | no a∉xs = no (λ {(here _) → a≢x refl ; (there _ a∈xs) → a∉xs a∈xs})
-- _⊆_ : ∀ {ℓ} {A : Set ℓ} → List A → List A → Set ℓ
-- R ⊆ S = ∀ {x} → x ∈ R → x ∈ S
-- _≢_ : ∀ {ℓ} {A : Set ℓ} → A → A → Set ℓ
-- x ≢ y = ¬ (x ≡ y)
-- infix 0 _↔_
-- _↔_ : {ℓ¹ : Level} → Set ℓ¹ → {ℓ² : Level} → Set ℓ² → Set (ℓ¹ ⊔ ℓ²)
-- P ↔ Q = (P → Q) × (Q → P)
-- ∃ : ∀ {ℓᴬ ℓᴮ} {A : Set ℓᴬ} (B : A → Set ℓᴮ) → Set (ℓᴬ ⊔ ℓᴮ)
-- ∃ = Σ _
-- ∄ : ∀ {ℓᴬ ℓᴮ} {A : Set ℓᴬ} (B : A → Set ℓᴮ) → Set (ℓᴬ ⊔ ℓᴮ)
-- ∄ = ¬_ ∘ ∃
-- infixl 4 _⊎_
-- _⊎_ = Either
-- --open import Agda.Builtin.Size public
-- open import Size public
-- open import Control.Monad.State public
-- open import Control.Monad.Identity public
-- open import Container.Traversable public
-- sequence : ∀ {a b} {A : Set a} {F : Set a → Set b} ⦃ _ : Applicative F ⦄ → List (F A) → F ⊤′
-- sequence [] = pure tt
-- sequence (x ∷ xs) = x *> sequence xs
-- open import Tactic.Nat public
-- open import Tactic.Deriving.Eq public
-- mutual
-- data Delay (i : Size) (A : Set) : Set where
-- now : A → Delay i A
-- later : ∞Delay i A → Delay i A
-- record ∞Delay (i : Size) (A : Set) : Set where
-- coinductive
-- field
-- force : {j : Size< i} → Delay j A
-- open ∞Delay public
-- module BindDelay
-- where
-- mutual
-- bindDelay : ∀ {i A B} → Delay i A → (A → Delay i B) → Delay i B
-- bindDelay (now a) f = f a
-- bindDelay (later ∞a) f = later (bind∞Delay ∞a f)
-- bind∞Delay : ∀ {i A B} → ∞Delay i A → (A → Delay i B) → ∞Delay i B
-- force (bind∞Delay ∞a f) = bindDelay (force ∞a) f
-- module _
-- where
-- open BindDelay
-- open BindDelay public using () renaming (bind∞Delay to _∞>>=_)
-- instance FunctorDelay : {i : Size} → Functor (Delay i)
-- Functor.fmap FunctorDelay f x = bindDelay x $ now ∘ f
-- instance ApplicativeDelay : {i : Size} → Applicative (Delay i)
-- Applicative.pure ApplicativeDelay x = now x
-- Applicative._<*>_ ApplicativeDelay (now f) x = f <$> x
-- Applicative._<*>_ ApplicativeDelay (later ∞f) x = later ∘ bind∞Delay ∞f $ flip fmap x
-- Applicative.super ApplicativeDelay = FunctorDelay
-- instance MonadDelay : {i : Size} → Monad (Delay i)
-- Monad._>>=_ MonadDelay = bindDelay
-- Monad.super MonadDelay = ApplicativeDelay
-- mutual
-- data _∼_ {i : Size} {A : Set} : (a? b? : Delay ∞ A) → Set where
-- ∼now : ∀ a → now a ∼ now a
-- ∼later : ∀ {a∞ b∞} (eq : a∞ ∞∼⟨ i ⟩∼ b∞) → later a∞ ∼ later b∞
-- _∼⟨_⟩∼_ = λ {A} a? i b? → _∼_ {i}{A} a? b?
-- record _∞∼⟨_⟩∼_ {A} (a∞ : ∞Delay ∞ A) i (b∞ : ∞Delay ∞ A) : Set where
-- coinductive
-- field
-- ∼force : {j : Size< i} → force a∞ ∼⟨ j ⟩∼ force b∞
-- open _∞∼⟨_⟩∼_ public
-- _∞∼_ = λ {i} {A} a∞ b∞ → _∞∼⟨_⟩∼_ {A} a∞ i b∞
-- mutual
-- ∼refl : ∀{i A} (a? : Delay ∞ A) → a? ∼⟨ i ⟩∼ a?
-- ∼refl (now a) = ∼now a
-- ∼refl (later a∞) = ∼later (∞∼refl a∞)
-- ∞∼refl : ∀{i A} (a∞ : ∞Delay ∞ A) → a∞ ∞∼⟨ i ⟩∼ a∞
-- ∼force (∞∼refl a∞) = ∼refl (force a∞)
-- mutual
-- ∼sym : ∀{i A}{a? b? : Delay ∞ A } → a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ a?
-- ∼sym (∼now a) = ∼now a
-- ∼sym (∼later eq) = ∼later (∞∼sym eq)
-- ∞∼sym : ∀{i A}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ a∞
-- ∼force (∞∼sym eq) = ∼sym (∼force eq)
-- mutual
-- ∼trans : ∀{i A}{a? b? c? : Delay ∞ A} →
-- a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ c? → a? ∼⟨ i ⟩∼ c?
-- ∼trans (∼now a) (∼now .a) = ∼now a
-- ∼trans (∼later eq) (∼later eq′) = ∼later (∞∼trans eq eq′)
-- ∞∼trans : ∀{i A}{a∞ b∞ c∞ : ∞Delay ∞ A} →
-- a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ c∞ → a∞ ∞∼⟨ i ⟩∼ c∞
-- ∼force (∞∼trans eq eq′) = ∼trans (∼force eq) (∼force eq′)
-- --∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
-- --∞∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
-- mutual
-- bind-assoc : ∀{i A B C} (m : Delay ∞ A)
-- {k : A → Delay ∞ B} {l : B → Delay ∞ C} →
-- ((m >>= k) >>= l) ∼⟨ i ⟩∼ (m >>= λ a → (k a >>= l))
-- bind-assoc (now a) = ∼refl _
-- bind-assoc (later a∞) = ∼later (∞bind-assoc a∞)
-- ∞bind-assoc : ∀{i A B C} (a∞ : ∞Delay ∞ A)
-- {k : A → Delay ∞ B} {l : B → Delay ∞ C} →
-- ((a∞ ∞>>= k) ∞>>= l) ∞∼⟨ i ⟩∼ (a∞ ∞>>= λ a → (k a >>= l))
-- ∼force (∞bind-assoc a∞) = bind-assoc (force a∞)
-- mutual
-- bind-cong-l : ∀{i A B}{a? b? : Delay ∞ A} → a? ∼⟨ i ⟩∼ b? →
-- (k : A → Delay ∞ B) → (a? >>= k) ∼⟨ i ⟩∼ (b? >>= k)
-- bind-cong-l (∼now a) k = ∼refl _
-- bind-cong-l (∼later eq) k = ∼later (∞bind-cong-l eq k)
-- ∞bind-cong-l : ∀{i A B}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ →
-- (k : A → Delay ∞ B) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (b∞ ∞>>= k)
-- ∼force (∞bind-cong-l eq k) = bind-cong-l (∼force eq) k
-- mutual
-- bind-cong-r : ∀{i A B}(a? : Delay ∞ A){k l : A → Delay ∞ B} →
-- (∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a? >>= k) ∼⟨ i ⟩∼ (a? >>= l)
-- bind-cong-r (now a) h = h a
-- bind-cong-r (later a∞) h = ∼later (∞bind-cong-r a∞ h)
-- ∞bind-cong-r : ∀{i A B}(a∞ : ∞Delay ∞ A){k l : A → Delay ∞ B} →
-- (∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (a∞ ∞>>= l)
-- ∼force (∞bind-cong-r a∞ h) = bind-cong-r (force a∞) h
-- map-compose : ∀{i A B C} (a? : Delay ∞ A) {f : A → B} {g : B → C} →
-- (g <$> (f <$> a?)) ∼⟨ i ⟩∼ ((g ∘ f) <$> a?)
-- map-compose a? = bind-assoc a?
-- map-cong : ∀{i A B}{a? b? : Delay ∞ A} (f : A → B) →
-- a? ∼⟨ i ⟩∼ b? → (f <$> a?) ∼⟨ i ⟩∼ (f <$> b?)
-- map-cong f eq = bind-cong-l eq (now ∘ f)
-- data _⇓_ {A : Set} : (a? : Delay ∞ A) (a : A) → Set where
-- now⇓ : ∀{a} → now a ⇓ a
-- later⇓ : ∀{a} {a∞ : ∞Delay ∞ A} → force a∞ ⇓ a → later a∞ ⇓ a
-- _⇓ : {A : Set} (x : Delay ∞ A) → Set
-- x ⇓ = ∃ λ a → x ⇓ a
-- map⇓ : ∀{A B}{a : A}{a? : Delay ∞ A}(f : A → B) → a? ⇓ a → (f <$> a?) ⇓ f a
-- map⇓ f now⇓ = now⇓
-- map⇓ f (later⇓ a⇓) = later⇓ (map⇓ f a⇓)
-- bind⇓ : ∀{A B}(f : A → Delay ∞ B){?a : Delay ∞ A}{a : A}{b : B} →
-- ?a ⇓ a → f a ⇓ b → (?a >>= f) ⇓ b
-- bind⇓ f now⇓ q = q
-- bind⇓ f (later⇓ p) q = later⇓ (bind⇓ f p q)
-- infixl 4 _>>=⇓_
-- _>>=⇓_ : ∀{A B}{f : A → Delay ∞ B}{?a : Delay ∞ A}{a : A}{b : B} →
-- ?a ⇓ a → f a ⇓ b → (?a >>= f) ⇓ b
-- _>>=⇓_ = bind⇓ _
-- infixl 4 _⇓>>=⇓_
-- _⇓>>=⇓_ : ∀{A B}{f : A → Delay ∞ B}{?a : Delay ∞ A}{b : B} →
-- (?a⇓ : ?a ⇓) → f (fst ?a⇓) ⇓ b → (?a >>= f) ⇓ b
-- _⇓>>=⇓_ (_ , a⇓) = bind⇓ _ a⇓
-- _⇓Dec>>=⇓_else⇓_ : ∀{A B}{f-yes : A → Delay ∞ B}{f-no : ¬ A → Delay ∞ B}{?a : Delay ∞ (Dec A)}{b : B} →
-- (?a⇓ : ?a ⇓) →
-- ((a : A) → f-yes a ⇓ b) →
-- ((¬a : ¬ A) → f-no ¬a ⇓ b) →
-- ((?a >>= (λ { (yes y) → f-yes y ; (no n) → f-no n }))) ⇓ b
-- (yes y , y⇓) ⇓Dec>>=⇓ fy⇓ else⇓ fn⇓ = y⇓ >>=⇓ fy⇓ y
-- (no n , n⇓) ⇓Dec>>=⇓ fy⇓ else⇓ fn⇓ = n⇓ >>=⇓ fn⇓ n
-- _⇓DecEq>>=⇓_else⇓_ : ∀{A : Set} {A₁ A₂ : A} {B}{f-yes : A₁ ≡ A₂ → Delay ∞ B}{f-no : A₁ ≢ A₂ → Delay ∞ B}{?a : Delay ∞ (Dec (A₁ ≡ A₂))}{b : B} →
-- (?a⇓ : ?a ⇓) →
-- ((eq : A₁ ≡ A₂) → f-yes eq ⇓ b) →
-- ((¬eq : A₁ ≢ A₂) → f-no ¬eq ⇓ b) →
-- ((?a >>= (λ { (yes refl) → f-yes refl ; (no n) → f-no n }))) ⇓ b
-- (yes refl , y⇓) ⇓DecEq>>=⇓ fy⇓ else⇓ fn⇓ = y⇓ >>=⇓ fy⇓ refl
-- (no n , n⇓) ⇓DecEq>>=⇓ fy⇓ else⇓ fn⇓ = n⇓ >>=⇓ fn⇓ n
-- app⇓ : ∀{A}{B}{f? : Delay ∞ (A → B)}{f : A → B}{x? : Delay ∞ A}{x : A} → f? ⇓ f → x? ⇓ x → (f? <*> x?) ⇓ f x
-- app⇓ now⇓ now⇓ = now⇓
-- app⇓ now⇓ (later⇓ x?) = later⇓ $ map⇓ _ x?
-- app⇓ (later⇓ f?) now⇓ = later⇓ $ bind⇓ _ f? now⇓
-- app⇓ (later⇓ ⇓f) (later⇓ ⇓x) = later⇓ $ bind⇓ _ ⇓f $ later⇓ $ bind⇓ _ ⇓x now⇓
-- subst∼⇓ : ∀{A}{a? a?′ : Delay ∞ A}{a : A} → a? ⇓ a → a? ∼ a?′ → a?′ ⇓ a
-- subst∼⇓ now⇓ (∼now a) = now⇓
-- subst∼⇓ (later⇓ p) (∼later eq) = later⇓ (subst∼⇓ p (∼force eq))
-- {-
-- traverse⇓' : ∀{A}{B}{f? : A → Delay ∞ B}{T : Set → Set}⦃ _ : Traversable T ⦄{X : T A} → (∀ x → f? x ⇓) → ∀ (x : T A) → traverse f? x ⇓
-- traverse⇓' x₁ x₂ = {!!} , {!!}
-- -}
-- {-
-- traverse⇓ : ∀{A}{B}{f : A → B}{T : Set → Set}⦃ _ : Traversable T ⦄{X : T A} → (∀ x → f? x ⇓) → ∀ (x : T A) → traverse f x ⇓
-- traverse⇓ x₁ x₂ = {!!} , {!!}
-- -}
-- traverse-list⇓ : ∀{A}{B} (f? : A → Delay ∞ B) → (∀ x → f? x ⇓) → (xs : List A) → traverse f? xs ⇓
-- traverse-list⇓ f? f?⇓ [] = [] , now⇓
-- traverse-list⇓ f? f?⇓ (x ∷ xs)
-- with f?⇓ x | traverse-list⇓ f? f?⇓ xs
-- … | y , y⇓ | ys , ys⇓ = y ∷ ys , app⇓ (map⇓ _ y⇓) ys⇓
-- {-
-- traverse-vec⇓' : ∀{A}{B}{𝑎} (f? : A → Delay ∞ B) → (∀ x → f? x ⇓) → (xs : Vector A 𝑎) → traverse f? xs ⇓
-- traverse-vec⇓' f? f?⇓ [] = [] , now⇓
-- traverse-vec⇓' f? f?⇓ (x ∷ xs)
-- with f?⇓ x | traverse-vec⇓' f? f?⇓ xs
-- … | y , y⇓ | ys , ys⇓ = y ∷ ys , app⇓ (map⇓ _ y⇓) ys⇓
-- traverse-vec⇓ : ∀{A}{B}{𝑎} (f : A → B) → (xs : Vector (Delay ∞ A) 𝑎) → traverse {!f!} xs ⇓
-- traverse-vec⇓ = {!!}
-- -}
-- open CustomPrelude
-- -- infix 15 _╱_
-- -- record Sequent (A : Set) ⦃ _ : BeFormula A ⦄ : Set
-- -- where
-- -- constructor _╱_
-- -- field
-- -- statement : A
-- -- suppositions : List A
-- -- open Sequent
-- -- foooo : {A : Set} ⦃ bf : BeFormula A ⦄ {-⦃ hs : HasNegation A ⦄-} {-(x : Sequent A)-} →
-- -- (∃ λ (x : A) → x ∈ List.[]) → ⊥
-- -- {-
-- -- Dec
-- -- (-- Either
-- -- (Σ A
-- -- (λ x₁ →
-- -- --Σ
-- -- ({-BeFormula.formula bf -}x₁ ∈
-- -- {-map (BeFormula.formula bf)-} [] {-(suppositions x)-})
-- -- {-
-- -- (λ _ →
-- -- ⊤
-- -- --BeFormula.formula bf (HasNegation.~ hs x₁) ∈
-- -- --map (BeFormula.formula bf) (suppositions x)
-- -- )-}
-- -- ))
-- -- {-(BeFormula.formula bf (statement x) ∈
-- -- map (BeFormula.formula bf) (suppositions x))-})
-- -- -}
-- -- foooo = λ {x → {!x!}}
-- -- {-
-- -- foooo (statement₁ ╱ []) = λ {x → {!x!}} -- no (λ {x → {!x!}})
-- -- foooo (statement₁ ╱ (x ∷ suppositions₁)) = {!!}
-- -- -}
-- -- -- TruthValue = Bool
-- -- -- -- reification of elements of the domain
-- -- -- Element = Nat
-- -- -- record VariableName : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- name : Nat
-- -- -- open VariableName
-- -- -- instance EqVariableName : Eq VariableName
-- -- -- Eq._==_ EqVariableName _ = decEq₁ (cong name) ∘ (_≟_ on name $ _)
-- -- -- record FunctionName : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- name : Nat
-- -- -- open FunctionName
-- -- -- instance EqFunctionName : Eq FunctionName
-- -- -- Eq._==_ EqFunctionName _ = decEq₁ (cong name) ∘ (_≟_ on name $ _)
-- -- -- record PredicateName : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- name : Nat
-- -- -- open PredicateName
-- -- -- instance EqPredicateName : Eq PredicateName
-- -- -- Eq._==_ EqPredicateName _ = decEq₁ (cong name) ∘ (_≟_ on name $ _)
-- -- -- record Arity : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- arity : Nat
-- -- -- open Arity
-- -- -- instance EqArity : Eq Arity
-- -- -- Eq._==_ EqArity _ = decEq₁ (cong arity) ∘ (_≟_ on arity $ _)
-- -- -- Vector : Set → Arity → Set
-- -- -- Vector A = Vec A ∘ arity
-- -- -- record Elements : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- {arity} : Arity
-- -- -- elements : Vector Element arity
-- -- -- open Elements
-- -- -- instance EqElements : Eq Elements
-- -- -- Eq._==_ EqElements (⟨_⟩ {𝑎₁} εs₁) (⟨_⟩ {𝑎₂} εs₂)
-- -- -- with 𝑎₁ ≟ 𝑎₂
-- -- -- … | no 𝑎₁≢𝑎₂ = no λ {refl → 𝑎₁≢𝑎₂ refl}
-- -- -- … | yes refl
-- -- -- with εs₁ ≟ εs₂
-- -- -- … | yes refl = yes refl
-- -- -- … | no εs₁≢εs₂ = no λ {refl → εs₁≢εs₂ refl}
-- -- -- record Interpretation : Set
-- -- -- where
-- -- -- field
-- -- -- μ⟦_⟧ : VariableName → Element
-- -- -- 𝑓⟦_⟧ : FunctionName → Elements → Element
-- -- -- 𝑃⟦_⟧ : PredicateName → Elements → TruthValue
-- -- -- open Interpretation
-- -- -- mutual
-- -- -- data Term : Set
-- -- -- where
-- -- -- variable : VariableName → Term
-- -- -- function : FunctionName → Terms → Term
-- -- -- record Terms : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- inductive
-- -- -- field
-- -- -- {arity} : Arity
-- -- -- terms : Vector Term arity
-- -- -- open Terms
-- -- -- termVariable-inj : ∀ {𝑥₁ 𝑥₂} → Term.variable 𝑥₁ ≡ variable 𝑥₂ → 𝑥₁ ≡ 𝑥₂
-- -- -- termVariable-inj refl = refl
-- -- -- termFunction-inj₁ : ∀ {𝑓₁ 𝑓₂ τ₁s τ₂s} → Term.function 𝑓₁ τ₁s ≡ function 𝑓₂ τ₂s → 𝑓₁ ≡ 𝑓₂
-- -- -- termFunction-inj₁ refl = refl
-- -- -- termFunction-inj₂ : ∀ {𝑓₁ 𝑓₂ τ₁s τ₂s} → Term.function 𝑓₁ τ₁s ≡ function 𝑓₂ τ₂s → τ₁s ≡ τ₂s
-- -- -- termFunction-inj₂ refl = refl
-- -- -- foo : ∀ a → (ts1 ts2 : Vec Term (arity a)) → (τ₁≡τ₂ : Terms.⟨ ts1 ⟩ ≡ (⟨_⟩ {a} ts2)) → _≡_ {lzero} {Vec Term (arity a)} ts1 ts2
-- -- -- foo a ts1 .ts1 refl = refl
-- -- -- mutual
-- -- -- EqTerm⇑ : ∀ {i} → (x y : Term) → Delay i ∘ Dec $ x ≡ y
-- -- -- EqTerm⇑ (variable _) (variable _) = now (decEq₁ termVariable-inj $ _≟_ _ _)
-- -- -- EqTerm⇑ (function 𝑓₁ τ₁s) (function 𝑓₂ τ₂s) = EqTerms⇑ τ₁s τ₂s >>= λ τ₁s≟τ₂s → now $ decEq₂ termFunction-inj₁ termFunction-inj₂ (𝑓₁ ≟ 𝑓₂) τ₁s≟τ₂s
-- -- -- EqTerm⇑ (variable _) (function _ _) = now $ no λ ()
-- -- -- EqTerm⇑ (function _ _) (variable _) = now $ no λ ()
-- -- -- EqTerms⇑ : ∀ {i} → (x y : Terms) → Delay i ∘ Dec $ x ≡ y
-- -- -- EqTerms⇑ (⟨_⟩ {𝑎₁} τ₁s) (⟨_⟩ {𝑎₂} τ₂s)
-- -- -- with 𝑎₁ ≟ 𝑎₂
-- -- -- … | no 𝑎₁≢𝑎₂ = now $ no λ {τ₁≡τ₂ → 𝑎₁≢𝑎₂ (cong arity τ₁≡τ₂)}
-- -- -- … | yes refl = EqVecTerm⇑ τ₁s τ₂s >>= λ { (yes refl) → now $ yes refl ; (no τ₁s≢τ₂s) → now $ no (λ ⟨τ₁s⟩≡⟨τ₂s⟩ → τ₁s≢τ₂s (foo ⟨ arity 𝑎₁ ⟩ τ₁s τ₂s ⟨τ₁s⟩≡⟨τ₂s⟩)) }
-- -- -- EqVecTerm⇑ : ∀ {i} {n} → (x y : Vec Term n) → Delay i ∘ Dec $ x ≡ y
-- -- -- EqVecTerm⇑ [] [] = now (yes refl)
-- -- -- EqVecTerm⇑ (τ₁ ∷ τ₁s) (τ₂ ∷ τ₂s) =
-- -- -- EqTerm⇑ τ₁ τ₂ >>= λ
-- -- -- { (yes refl) → EqVecTerm⇑ τ₁s τ₂s >>= λ
-- -- -- { (yes refl) → now $ yes refl
-- -- -- ; (no τ₁s≢τ₂s) → now $ no λ τ₁₁s≡τ₁₂s → τ₁s≢τ₂s $ vcons-inj-tail τ₁₁s≡τ₁₂s }
-- -- -- ; (no τ₁≢τ₂) → now $ no λ τ₁₁s≡τ₂₂s → τ₁≢τ₂ $ vcons-inj-head τ₁₁s≡τ₂₂s }
-- -- -- EqVecTerm⇓ : ∀ {n} → (x y : Vec Term n) → EqVecTerm⇑ x y ⇓
-- -- -- EqVecTerm⇓ [] [] = _ , now⇓
-- -- -- EqVecTerm⇓ (variable 𝑥₁ ∷ τ₁s) (variable 𝑥₂ ∷ τ₂s)
-- -- -- with 𝑥₁ ≟ 𝑥₂
-- -- -- … | yes refl with EqVecTerm⇓ τ₁s τ₂s
-- -- -- EqVecTerm⇓ (variable 𝑥₁ ∷ τ₁s) (variable .𝑥₁ ∷ .τ₁s) | yes refl | (yes refl , snd₁) = _ , snd₁ >>=⇓ now⇓
-- -- -- EqVecTerm⇓ (variable 𝑥₁ ∷ τ₁s) (variable .𝑥₁ ∷ τ₂s) | yes refl | (no x , snd₁) = _ , snd₁ >>=⇓ now⇓
-- -- -- EqVecTerm⇓ (variable 𝑥₁ ∷ τ₁s) (variable 𝑥₂ ∷ τ₂s) | no 𝑥₁≢𝑥₂ = _ , now⇓
-- -- -- EqVecTerm⇓ (variable x ∷ τ₁s) (function x₁ x₂ ∷ τ₂s) = _ , now⇓
-- -- -- EqVecTerm⇓ (function x x₁ ∷ τ₁s) (variable x₂ ∷ τ₂s) = _ , now⇓
-- -- -- EqVecTerm⇓ (function 𝑓₁ (⟨_⟩ {𝑎₁} τ₁s) ∷ τ₁₂s) (function 𝑓₂ (⟨_⟩ {𝑎₂} τ₂s) ∷ τ₂₂s)
-- -- -- with 𝑎₁ ≟ 𝑎₂ | 𝑓₁ ≟ 𝑓₂
-- -- -- … | no 𝑎₁≢𝑎₂ | no 𝑓₁≢𝑓₂ = _ , now⇓
-- -- -- … | no 𝑎₁≢𝑎₂ | yes refl = _ , now⇓
-- -- -- … | yes refl | no 𝑓₁≢𝑓₂
-- -- -- with EqVecTerm⇓ τ₁s τ₂s
-- -- -- … | (no τ₁s≢τ₂s , τ⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ now⇓
-- -- -- … | (yes refl , τ⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ now⇓
-- -- -- EqVecTerm⇓ (function 𝑓₁ (⟨_⟩ {𝑎₁} τ₁s) ∷ τ₁₂s) (function 𝑓₂ (⟨_⟩ {𝑎₂} τ₂s) ∷ τ₂₂s) | yes refl | yes refl
-- -- -- with EqVecTerm⇓ τ₁s τ₂s | EqVecTerm⇓ τ₁₂s τ₂₂s
-- -- -- … | (no τ₁s≢τ₂s , τ⇓) | (no τ₁₂s≢τ₂₂s , τs⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ now⇓
-- -- -- … | (yes refl , τ⇓) | (no τ₁₂s≢τ₂₂s , τs⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ (τs⇓ >>=⇓ now⇓)
-- -- -- … | (no τ₁s≢τ₂s , τ⇓) | (yes refl , τs⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ now⇓
-- -- -- … | (yes refl , τ⇓) | (yes refl , τs⇓) = _ , τ⇓ >>=⇓ now⇓ >>=⇓ now⇓ >>=⇓ (τs⇓ >>=⇓ now⇓)
-- -- -- EqTerms⇓ : (x y : Terms) → EqTerms⇑ x y ⇓
-- -- -- EqTerms⇓ (⟨_⟩ {𝑎₁} τ₁s) (⟨_⟩ {𝑎₂} τ₂s)
-- -- -- with 𝑎₁ ≟ 𝑎₂
-- -- -- … | no 𝑎₁≢𝑎₂ = _ , now⇓
-- -- -- … | yes refl
-- -- -- with EqVecTerm⇓ τ₁s τ₂s
-- -- -- … | (yes refl , τ⇓) = _ , τ⇓ >>=⇓ now⇓
-- -- -- … | (no _ , τ⇓) = _ , τ⇓ >>=⇓ now⇓
-- -- -- EqTerm⇓ : (x y : Term) → EqTerm⇑ x y ⇓
-- -- -- EqTerm⇓ (variable x) (variable x₁) = _ , now⇓
-- -- -- EqTerm⇓ (function _ τ₁s) (function _ τ₂s)
-- -- -- with EqTerms⇓ τ₁s τ₂s
-- -- -- … | (_ , τ⇓) = _ , τ⇓ >>=⇓ now⇓
-- -- -- EqTerm⇓ (variable x) (function x₁ x₂) = _ , now⇓
-- -- -- EqTerm⇓ (function x x₁) (variable x₂) = _ , now⇓
-- -- -- instance EqTerm : Eq Term
-- -- -- EqTerm = record { _==_ = λ x y → fst (EqTerm⇓ x y) }
-- -- -- instance EqTerms : Eq Terms
-- -- -- Eq._==_ EqTerms x y = fst (EqTerms⇓ x y)
-- -- -- mutual
-- -- -- τ⇑⟦_⟧ : Interpretation → {i : Size} → Term → Delay i Element
-- -- -- τ⇑⟦ I ⟧ (variable 𝑥) = now $ μ⟦ I ⟧ 𝑥
-- -- -- τ⇑⟦ I ⟧ (function 𝑓 τs) = 𝑓⟦ I ⟧ 𝑓 ∘ ⟨_⟩ <$> τs⇑⟦ I ⟧ τs
-- -- -- τs⇑⟦_⟧ : Interpretation → {i : Size} → (τs : Terms) → Delay i (Vector Element (arity τs))
-- -- -- τs⇑⟦ I ⟧ ⟨ [] ⟩ = now []
-- -- -- τs⇑⟦ I ⟧ ⟨ τ ∷ τs ⟩ = τ⇑⟦ I ⟧ τ >>= (λ t → τs⇑⟦ I ⟧ ⟨ τs ⟩ >>= λ ts → now (t ∷ ts))
-- -- -- τs⇓⟦_⟧ : (I : Interpretation) → (τs : Terms) → τs⇑⟦ I ⟧ τs ⇓
-- -- -- τs⇓⟦ I ⟧ ⟨ [] ⟩ = _ , now⇓
-- -- -- τs⇓⟦ I ⟧ ⟨ variable 𝑥 ∷ τs ⟩ = _ , τs⇓⟦ I ⟧ ⟨ τs ⟩ ⇓>>=⇓ now⇓
-- -- -- τs⇓⟦ I ⟧ ⟨ function 𝑓₁ τs₁ ∷ τs₂ ⟩ =
-- -- -- _ , τs⇓⟦ I ⟧ τs₁ ⇓>>=⇓ now⇓ >>=⇓ (τs⇓⟦ I ⟧ ⟨ τs₂ ⟩ ⇓>>=⇓ now⇓)
-- -- -- τ⇓⟦_⟧ : (I : Interpretation) → (τ : Term) → τ⇑⟦ I ⟧ τ ⇓
-- -- -- τ⇓⟦ I ⟧ (variable 𝑥) = _ , now⇓
-- -- -- τ⇓⟦ I ⟧ (function 𝑓 τs) = _ , τs⇓⟦ I ⟧ τs ⇓>>=⇓ now⇓
-- -- -- τ⟦_⟧ : (I : Interpretation) → {i : Size} → (τ : Term) → Element
-- -- -- τ⟦ I ⟧ τ = fst (τ⇓⟦ I ⟧ τ)
-- -- -- data Formula : Set
-- -- -- where
-- -- -- atomic : PredicateName → Terms → Formula
-- -- -- logical : Formula →
-- -- -- Formula →
-- -- -- Formula
-- -- -- quantified : VariableName → Formula → Formula
-- -- -- formulaAtomic-inj₁ : ∀ {𝑃₁ τs₁ 𝑃₂ τs₂} → Formula.atomic 𝑃₁ τs₁ ≡ atomic 𝑃₂ τs₂ → 𝑃₁ ≡ 𝑃₂
-- -- -- formulaAtomic-inj₁ refl = refl
-- -- -- formulaAtomic-inj₂ : ∀ {𝑃₁ τs₁ 𝑃₂ τs₂} → Formula.atomic 𝑃₁ τs₁ ≡ atomic 𝑃₂ τs₂ → τs₁ ≡ τs₂
-- -- -- formulaAtomic-inj₂ refl = refl
-- -- -- formulaLogical-inj₁ : ∀ {φ₁₁ φ₁₂ φ₂₁ φ₂₂} → Formula.logical φ₁₁ φ₁₂ ≡ logical φ₂₁ φ₂₂ → φ₁₁ ≡ φ₂₁
-- -- -- formulaLogical-inj₁ refl = refl
-- -- -- formulaLogical-inj₂ : ∀ {φ₁₁ φ₁₂ φ₂₁ φ₂₂} → Formula.logical φ₁₁ φ₁₂ ≡ logical φ₂₁ φ₂₂ → φ₁₂ ≡ φ₂₂
-- -- -- formulaLogical-inj₂ refl = refl
-- -- -- formulaQuantified-inj₁ : ∀ {𝑥₁ φ₁ 𝑥₂ φ₂} → Formula.quantified 𝑥₁ φ₁ ≡ quantified 𝑥₂ φ₂ → 𝑥₁ ≡ 𝑥₂
-- -- -- formulaQuantified-inj₁ refl = refl
-- -- -- formulaQuantified-inj₂ : ∀ {𝑥₁ φ₁ 𝑥₂ φ₂} → Formula.quantified 𝑥₁ φ₁ ≡ quantified 𝑥₂ φ₂ → φ₁ ≡ φ₂
-- -- -- formulaQuantified-inj₂ refl = refl
-- -- -- instance EqFormula : Eq Formula
-- -- -- Eq._==_ EqFormula (atomic 𝑃₁ τs₁) (atomic 𝑃₂ τs₂) = decEq₂ formulaAtomic-inj₁ formulaAtomic-inj₂ (𝑃₁ ≟ 𝑃₂) (τs₁ ≟ τs₂)
-- -- -- Eq._==_ EqFormula (logical φ₁₁ φ₁₂) (logical φ₂₁ φ₂₂) = decEq₂ formulaLogical-inj₁ formulaLogical-inj₂ (φ₁₁ ≟ φ₂₁) (φ₁₂ ≟ φ₂₂)
-- -- -- Eq._==_ EqFormula (quantified 𝑥₁ φ₁) (quantified 𝑥₂ φ₂) = decEq₂ formulaQuantified-inj₁ formulaQuantified-inj₂ (𝑥₁ ≟ 𝑥₂) (φ₁ ≟ φ₂)
-- -- -- Eq._==_ EqFormula (atomic _ _) (logical _ _) = no λ ()
-- -- -- Eq._==_ EqFormula (atomic _ _) (quantified _ _) = no λ ()
-- -- -- Eq._==_ EqFormula (logical _ _) (atomic _ _) = no λ ()
-- -- -- Eq._==_ EqFormula (logical _ _) (quantified _ _) = no λ ()
-- -- -- Eq._==_ EqFormula (quantified _ _) (atomic _ _) = no λ ()
-- -- -- Eq._==_ EqFormula (quantified _ _) (logical _ _) = no λ ()
-- -- -- record HasNegation (A : Set) : Set
-- -- -- where
-- -- -- field
-- -- -- ~ : A → A
-- -- -- open HasNegation ⦃ … ⦄
-- -- -- record BeFormula (A : Set) : Set
-- -- -- where
-- -- -- constructor ⟨_⟩
-- -- -- field
-- -- -- formula : A → Formula
-- -- -- open BeFormula ⦃ … ⦄
-- -- -- record HasSatisfaction (A : Set) : Set₁
-- -- -- where
-- -- -- field
-- -- -- _⊨_ : Interpretation → A → Set
-- -- -- _⊭_ : Interpretation → A → Set
-- -- -- _⊭_ I = ¬_ ∘ I ⊨_
-- -- -- open HasSatisfaction ⦃ … ⦄
-- -- -- record HasDecidableSatisfaction (A : Set) ⦃ _ : HasSatisfaction A ⦄ : Set₁
-- -- -- where
-- -- -- field
-- -- -- _⊨?_ : (I : Interpretation) → (x : A) → Dec (I ⊨ x)
-- -- -- open HasDecidableSatisfaction ⦃ … ⦄
-- -- -- infix 15 _╱_
-- -- -- record Sequent (A : Set) ⦃ _ : BeFormula A ⦄ : Set
-- -- -- where
-- -- -- constructor _╱_
-- -- -- field
-- -- -- statement : A
-- -- -- suppositions : List A
-- -- -- open Sequent
-- -- -- foooo : {A : Set} ⦃ bf : BeFormula A ⦄ {-⦃ hs : HasNegation A ⦄-} (x : Sequent A) →
-- -- -- Dec
-- -- -- (-- Either
-- -- -- (Σ A
-- -- -- (λ x₁ →
-- -- -- --Σ
-- -- -- ({-BeFormula.formula bf -}x₁ ∈
-- -- -- {-map (BeFormula.formula bf)-} (suppositions x))
-- -- -- {-
-- -- -- (λ _ →
-- -- -- ⊤
-- -- -- --BeFormula.formula bf (HasNegation.~ hs x₁) ∈
-- -- -- --map (BeFormula.formula bf) (suppositions x)
-- -- -- )-}
-- -- -- ))
-- -- -- {-(BeFormula.formula bf (statement x) ∈
-- -- -- map (BeFormula.formula bf) (suppositions x))-})
-- -- -- foooo (statement₁ ╱ []) = no (λ {x → {!x!}})
-- -- -- foooo (statement₁ ╱ (x ∷ suppositions₁)) = {!!}
-- -- -- -- record HasValidation (A : Set) : Set₁
-- -- -- -- where
-- -- -- -- field
-- -- -- -- ⊨_ : A → Set
-- -- -- -- ⊭_ : A → Set
-- -- -- -- ⊭_ = ¬_ ∘ ⊨_
-- -- -- -- open HasValidation ⦃ … ⦄
-- -- -- -- 𝑃[_♭_] : PredicateName → Terms → Formula
-- -- -- -- 𝑃[_♭_] = atomic
-- -- -- -- _⊗_ : Formula → Formula → Formula
-- -- -- -- _⊗_ = logical
-- -- -- -- instance
-- -- -- -- HasNegationFormula : HasNegation Formula
-- -- -- -- HasNegation.~ HasNegationFormula φ = φ ⊗ φ
-- -- -- -- data IsLiteral : Formula → Set
-- -- -- -- where
-- -- -- -- atomic : (𝑃 : PredicateName) → (τs : Terms) → IsLiteral $ 𝑃[ 𝑃 ♭ τs ]
-- -- -- -- logical : (𝑃 : PredicateName) → (τs : Terms) → IsLiteral ∘ ~ $ 𝑃[ 𝑃 ♭ τs ]
-- -- -- -- eqIsLiteral : ∀ {φ} → (lf₁ lf₂ : IsLiteral φ) → lf₁ ≡ lf₂
-- -- -- -- eqIsLiteral (atomic 𝑃 τs) (atomic .𝑃 .τs) = refl
-- -- -- -- eqIsLiteral (logical 𝑃 τs) (logical .𝑃 .τs) = refl
-- -- -- -- instance EqIsLiteral : ∀ {φ} → Eq (IsLiteral φ)
-- -- -- -- Eq._==_ EqIsLiteral lf₁ lf₂ = yes (eqIsLiteral lf₁ lf₂)
-- -- -- -- record LiteralFormula : Set
-- -- -- -- where
-- -- -- -- constructor ⟨_⟩
-- -- -- -- field
-- -- -- -- {formula} : Formula
-- -- -- -- isLiteral : IsLiteral formula
-- -- -- -- open LiteralFormula
-- -- -- -- instance EqLiteralFormula : Eq LiteralFormula
-- -- -- -- Eq._==_ EqLiteralFormula (⟨_⟩ {φ₁} lf₁) (⟨_⟩ {φ₂} lf₂)
-- -- -- -- with φ₁ ≟ φ₂
-- -- -- -- … | no φ₁≢φ₂ = no (λ {refl → φ₁≢φ₂ refl})
-- -- -- -- Eq._==_ EqLiteralFormula (⟨_⟩ {φ₁} lf₁) (⟨_⟩ {φ₂} lf₂) | yes refl = case (eqIsLiteral lf₁ lf₂) of λ {refl → yes refl}
-- -- -- -- infix 13 _¶_
-- -- -- -- record Problem (A : Set) ⦃ _ : BeFormula A ⦄ : Set
-- -- -- -- where
-- -- -- -- constructor _¶_
-- -- -- -- field
-- -- -- -- inferences : List (Sequent A)
-- -- -- -- interest : Sequent A
-- -- -- -- open Problem
-- -- -- -- record HasSubstantiveDischarge (+ : Set) (- : Set) : Set₁
-- -- -- -- where
-- -- -- -- field
-- -- -- -- _≽_ : + → - → Set
-- -- -- -- open HasSubstantiveDischarge ⦃ … ⦄
-- -- -- -- record HasVacuousDischarge (+ : Set) : Set₁
-- -- -- -- where
-- -- -- -- field
-- -- -- -- ◁_ : + → Set
-- -- -- -- open HasVacuousDischarge ⦃ … ⦄
-- -- -- -- record HasSalvation (A : Set) : Set₁
-- -- -- -- where
-- -- -- -- field
-- -- -- -- {isVacuouslyDischargable} : Set
-- -- -- -- ⦃ hasVacuousDischarge ⦄ : HasVacuousDischarge isVacuouslyDischargable
-- -- -- -- ▷_ : A → Set
-- -- -- -- open HasSalvation ⦃ … ⦄
-- -- -- -- record HasDecidableSalvation (A : Set) : Set₁
-- -- -- -- where
-- -- -- -- field
-- -- -- -- ⦃ hasSalvation ⦄ : HasSalvation A
-- -- -- -- ▷?_ : (x : A) → Dec $ ▷_ x
-- -- -- -- open HasDecidableSalvation ⦃ … ⦄
-- -- -- -- ∀[_♭_] : VariableName → Formula → Formula
-- -- -- -- ∀[_♭_] = quantified
-- -- -- -- _∧_ : Formula → Formula → Formula
-- -- -- -- φ₁ ∧ φ₂ = ~ φ₁ ⊗ ~ φ₂
-- -- -- -- _∨_ : Formula → Formula → Formula
-- -- -- -- φ₁ ∨ φ₂ = ~ (φ₁ ⊗ φ₂)
-- -- -- -- _⊃_ : Formula → Formula → Formula
-- -- -- -- φ₁ ⊃ φ₂ = ~ φ₁ ∨ φ₂
-- -- -- -- _⟷_ : Formula → Formula → Formula
-- -- -- -- φ₁ ⟷ φ₂ = (φ₁ ⊗ (φ₂ ⊗ φ₂)) ⊗ ((φ₁ ⊗ φ₁) ⊗ φ₂) -- TODO check that this is logically equivalent to the more verbose, (φ₁ ⊃ φ₂) ∧ (φ₂ ⊃ φ₁)
-- -- -- -- record _≞_/_ (𝓘 : Interpretation) (I : Interpretation) (𝑥 : VariableName) : Set
-- -- -- -- where
-- -- -- -- field
-- -- -- -- μEquality : {𝑥′ : VariableName} → 𝑥′ ≢ 𝑥 → μ⟦ 𝓘 ⟧ 𝑥 ≡ μ⟦ I ⟧ 𝑥′
-- -- -- -- 𝑓Equality : (𝑓 : FunctionName) (μs : Elements) → 𝑓⟦ 𝓘 ⟧ 𝑓 μs ≡ 𝑓⟦ I ⟧ 𝑓 μs
-- -- -- -- 𝑃Equality : (𝑃 : PredicateName) → (μs : Elements) → 𝑃⟦ 𝓘 ⟧ 𝑃 μs ≡ 𝑃⟦ I ⟧ 𝑃 μs
-- -- -- -- instance
-- -- -- -- BeFormulaFormula : BeFormula Formula
-- -- -- -- BeFormula.formula BeFormulaFormula = id
-- -- -- -- BeFormulaLiteralFormula : BeFormula LiteralFormula
-- -- -- -- BeFormula.formula BeFormulaLiteralFormula = formula
-- -- -- -- instance
-- -- -- -- HasNegationLiteralFormula : HasNegation LiteralFormula
-- -- -- -- HasNegation.~ HasNegationLiteralFormula ⟨ atomic 𝑃 τs ⟩ = ⟨ logical 𝑃 τs ⟩
-- -- -- -- HasNegation.~ HasNegationLiteralFormula ⟨ logical 𝑃 τs ⟩ = ⟨ atomic 𝑃 τs ⟩
-- -- -- -- HasNegationSequent : {A : Set} ⦃ _ : HasNegation A ⦄ ⦃ _ : BeFormula A ⦄ → HasNegation $ Sequent A
-- -- -- -- HasNegation.~ HasNegationSequent ( φᵗ ╱ φˢs ) = ~ φᵗ ╱ φˢs
-- -- -- -- instance
-- -- -- -- HasSatisfactionList : {A : Set} ⦃ _ : HasSatisfaction A ⦄ → HasSatisfaction $ List A
-- -- -- -- HasSatisfaction._⊨_ HasSatisfactionList I [] = ⊤
-- -- -- -- HasSatisfaction._⊨_ HasSatisfactionList I (x ∷ xs) = I ⊨ x × I ⊨ xs
-- -- -- -- HasSatisfactionBeFormula : {A : Set} → ⦃ _ : BeFormula A ⦄ → HasSatisfaction A
-- -- -- -- HasSatisfaction._⊨_ (HasSatisfactionBeFormula ⦃ beFormula ⦄) = λ I φ → I ⊨φ formula beFormula φ
-- -- -- -- where
-- -- -- -- _⊨φ_ : Interpretation → Formula → Set
-- -- -- -- I ⊨φ (atomic 𝑃 τs) = 𝑃⟦ I ⟧ 𝑃 ⟨ τ⟦ I ⟧ <$> terms τs ⟩ ≡ true
-- -- -- -- I ⊨φ (logical φ₁ φ₂) = ¬ I ⊨φ φ₁ × ¬ I ⊨φ φ₂
-- -- -- -- I ⊨φ (quantified 𝑥 φ) = (𝓘 : Interpretation) → 𝓘 ≞ I / 𝑥 → 𝓘 ⊨φ φ
-- -- -- -- HasSatisfactionSequent : {A : Set} ⦃ _ : BeFormula A ⦄ → HasSatisfaction $ Sequent A
-- -- -- -- HasSatisfaction._⊨_ HasSatisfactionSequent I (φᵗ ╱ φˢs) = I ⊨ φˢs → I ⊨ φᵗ
-- -- -- -- instance
-- -- -- -- postulate
-- -- -- -- HasDecidableSatisfactionFormula : HasDecidableSatisfaction Formula
-- -- -- -- instance
-- -- -- -- HasValidationBeFormula : {A : Set} ⦃ _ : BeFormula A ⦄ → HasValidation A
-- -- -- -- HasValidation.⊨_ HasValidationBeFormula φ = (I : Interpretation) → I ⊨ φ
-- -- -- -- HasValidationSequent : {A : Set} ⦃ _ : BeFormula A ⦄ → HasValidation $ Sequent A
-- -- -- -- HasValidation.⊨_ HasValidationSequent Φ = (I : Interpretation) → I ⊨ Φ
-- -- -- -- HasValidationProblem : {A : Set} ⦃ _ : BeFormula A ⦄ → HasValidation $ Problem A
-- -- -- -- HasValidation.⊨_ HasValidationProblem (χs ¶ ι) = (I : Interpretation) → I ⊨ χs → I ⊨ ι
-- -- -- -- instance
-- -- -- -- HasSubstantiveDischargeBeFormulaBeFormula : {A : Set} ⦃ _ : BeFormula A ⦄ → HasSubstantiveDischarge A A
-- -- -- -- HasSubstantiveDischarge._≽_ (HasSubstantiveDischargeBeFormulaBeFormula ⦃ ⟨ beFormula ⟩ ⦄) = _≡_ on beFormula -- _≡_ on (formula beFormula) -- _≡_
-- -- -- -- HasSubstantiveDischargeListBeFormulaBeFormula : {A : Set} ⦃ _ : BeFormula A ⦄ → HasSubstantiveDischarge (List A) A
-- -- -- -- HasSubstantiveDischarge._≽_ (HasSubstantiveDischargeListBeFormulaBeFormula ⦃ ⟨ beFormula ⟩ ⦄) +s - = beFormula - ∈ (beFormula <$> +s) -- flip _∈_
-- -- -- -- HasSubstantiveDischargeListFormulaListFormula : {A : Set} ⦃ _ : BeFormula A ⦄ → HasSubstantiveDischarge (List A) (List A)
-- -- -- -- HasSubstantiveDischarge._≽_ (HasSubstantiveDischargeListFormulaListFormula ⦃ ⟨ beFormula ⟩ ⦄) = flip $ _⊆_ on fmap beFormula -- flip _⊆_
-- -- -- -- HasSubstantiveDischargeSequentSequent : ∀ {A : Set} ⦃ _ : BeFormula A ⦄ → HasSubstantiveDischarge (Sequent A) (Sequent A)
-- -- -- -- HasSubstantiveDischarge._≽_ HasSubstantiveDischargeSequentSequent (+ᵗ ╱ +ᵖs) (-ᵗ ╱ -ᵖs) = +ᵗ ≽ -ᵗ × +ᵖs ≽ -ᵖs
-- -- -- -- HasSubstantiveDischargeListSequentSequent : ∀ {A : Set} ⦃ _ : BeFormula A ⦄ → HasSubstantiveDischarge (List $ Sequent A) (Sequent A)
-- -- -- -- HasSubstantiveDischarge._≽_ HasSubstantiveDischargeListSequentSequent χs ι = ∃ λ c → (c ∈ χs) × c ≽ ι
-- -- -- -- instance
-- -- -- -- HasVacuousDischargeList : {A : Set} ⦃ _ : HasSubstantiveDischarge (List A) A ⦄ ⦃ _ : HasNegation A ⦄ → HasVacuousDischarge (List A)
-- -- -- -- HasVacuousDischarge.◁_ (HasVacuousDischargeList {A}) xs = ∃ λ (x : A) → xs ≽ x × xs ≽ ~ x
-- -- -- -- HasVacuousDischargeSequent : {A : Set} ⦃ _ : BeFormula A ⦄ ⦃ _ : HasNegation A ⦄ → HasVacuousDischarge (Sequent A)
-- -- -- -- HasVacuousDischarge.◁_ HasVacuousDischargeSequent (_ ╱ φˢs) = ∃ λ s → (s ∈ φˢs) × (φˢs ≽ s) × (φˢs ≽ ~ s)
-- -- -- -- instance
-- -- -- -- HasSalvationSequent : {A : Set} ⦃ _ : BeFormula A ⦄ ⦃ _ : HasNegation A ⦄ {-⦃ _ : HasVacuousDischarge $ List A ⦄-} → HasSalvation $ Sequent A
-- -- -- -- HasSalvation.isVacuouslyDischargable (HasSalvationSequent {A}) = List A
-- -- -- -- HasSalvation.hasVacuousDischarge HasSalvationSequent = HasVacuousDischargeList
-- -- -- -- HasSalvation.▷_ HasSalvationSequent (φᵗ ╱ φᵖs) = (◁ φᵖs) ⊎ (φᵖs ≽ φᵗ)
-- -- -- -- HasDecidableSalvationSequent : {A : Set} ⦃ bf : BeFormula A ⦄ ⦃ hs : HasNegation A ⦄
-- -- -- -- → HasDecidableSalvation $ Sequent A
-- -- -- -- HasDecidableSalvation.hasSalvation HasDecidableSalvationSequent = HasSalvationSequent
-- -- -- -- --(HasDecidableSalvation.▷? HasDecidableSalvationSequent) (statement₁ ╱ []) = no (foo2 statement₁)
-- -- -- -- HasDecidableSalvation.▷? HasDecidableSalvationSequent = {!!}
-- -- -- -- --(HasDecidableSalvation.▷? HasDecidableSalvationSequent) (statement₁ ╱ []) = no (λ {x → {!!}})
-- -- -- -- --(HasDecidableSalvation.▷? HasDecidableSalvationSequent) (statement₁ ╱ (x₂ ∷ suppositions₁)) = {!!}
-- -- -- -- -- foo1 : ∀ {A} → ⦃ b : BeFormula A ⦄ ⦃ _ : HasNegation A ⦄ (statement₁ : A) → Σ A
-- -- -- -- -- (λ x →
-- -- -- -- -- Σ (BeFormula.formula b x ∈ [])
-- -- -- -- -- (λ _ → BeFormula.formula b (~ x) ∈ []))
-- -- -- -- -- ⊎ (BeFormula.formula b statement₁ ∈ []) →
-- -- -- -- -- ⊥
-- -- -- -- -- foo1 statement₁ (left (fst₁ , () , snd₁))
-- -- -- -- -- foo1 statement₁ (right ())
-- -- -- -- -- foo2 : ∀ {A} → ⦃ b : BeFormula A ⦄ ⦃ _ : HasNegation A ⦄ (statement₁ : A) → ▷ (statement₁ ╱ []) →
-- -- -- -- -- ⊥
-- -- -- -- -- foo2 statement₁ (left (fst₁ , () , snd₁))
-- -- -- -- -- foo2 statement₁ (right ())
|
cards/bn5/ItemCards/136-F008 Gauss' Hidden Assets.asm
|
RockmanEXEZone/MMBN-Mod-Card-Kit
| 10 |
170577
|
<filename>cards/bn5/ItemCards/136-F008 Gauss' Hidden Assets.asm<gh_stars>1-10
.include "defaults_item.asm"
table_file_jp equ "exe5-utf8.tbl"
table_file_en equ "bn5-utf8.tbl"
game_code_len equ 3
game_code equ 0x4252424A // BRBJ
game_code_2 equ 0x42524245 // BRBE
game_code_3 equ 0x42524250 // BRBP
card_type equ 0
card_id equ 28
card_no equ "028"
card_sub equ "Item Card 028"
card_sub_x equ 62
card_desc_len equ 2
card_desc_1 equ "Gauss' Hidden"
card_desc_2 equ "Assets"
card_desc_3 equ ""
card_name_jp_full equ "ガウスの隠し資産"
card_name_jp_game equ "ガウスのかくししさん"
card_name_en_full equ "Gauss' Hidden Assets"
card_name_en_game equ "Gauss' Hidden Assets"
card_game_desc_jp_len equ 2
card_game_desc_jp_1 equ "ガウスのかくししさん!"
card_game_desc_jp_2 equ "30000Zを手に入れた!"
card_game_desc_jp_3 equ ""
card_game_desc_en_len equ 2
card_game_desc_en_1 equ "Gauss' hidden assets!"
card_game_desc_en_2 equ "Got 30000 Zennys!"
card_game_desc_en_3 equ ""
|
src/Data/Real/Diff.agda
|
cspollard/diff
| 0 |
2802
|
module Data.Real.Diff where
open import Level using (0ℓ)
import Data.Real as ℝ
open ℝ using (ℝ)
open import Data.Real.Properties
import Data.Nat as ℕ
open ℕ using (ℕ; suc; zero; _⊓_; _⊔_)
open import Data.Unit.Polymorphic using (tt; ⊤)
open import Data.Product using (_×_; _,_; proj₁; proj₂)
open import Function using (_∘_; id)
-- TODO should move to _≈_ at some point
open import Relation.Binary.PropositionalEquality hiding ([_])
open ≡-Reasoning
import Data.Vec as V
open V using (Vec; []; _∷_)
import Data.Vec.Recursive as VR
open VR using (_^_; 2+_)
open import Data.Fin using (Fin; zero; suc)
Tower : ℕ → Set
Tower = Vec ℝ
Diff : Set
Diff = ∀ {d n} → Tower d ^ n → Tower d ^ n
Diff2 : Set
Diff2 = ∀ {d n} → Tower d ^ n → Tower d ^ n → Tower d ^ n
-- utility function
infix 2 _!_
_!_ : ∀ {n} → (∀ {d'} → Tower d' ^ n) → ∀ d → Tower d ^ n
x ! d = x {d}
lift : ∀ {n a} {A : Set a} → A → A ^ n
lift {n} x = VR.replicate n x
const' : ∀ {d} → ℝ → Tower d
const' {zero} x = []
const' {suc d} x = x ∷ (const' 0.0)
const : ∀ {n d} → ℝ ^ n → Tower d ^ n
const {n} = VR.map const' n
return' : ∀ {d} → ℝ → Tower (suc d)
return' x = x ∷ const' 1.0
return : ∀ {n d} → ℝ ^ n → Tower (suc d) ^ n
return {n} = VR.map return' n
extract : ∀ {d n} → Tower (suc d) ^ n → ℝ ^ n
extract {n = n} = VR.map V.head n
lop : ∀ {d} → Tower (suc d) → Tower d
lop {zero} _ = []
lop {suc d} (x ∷ xs) = x ∷ lop xs
run : ∀ {m n} (f : Tower 1 ^ m → Tower 1 ^ n) (x : ℝ ^ m) → ℝ ^ n
run f = extract ∘ f ∘ const
-_ : Diff
-_ {n = n} = VR.map (V.map λ x → ℝ.- x) n
infixl 6 _+_ _-_
infixr 9 -_
_+_ _-_ : Diff2
_+_ {n = n} = VR.zipWith (V.zipWith ℝ._+_) n
x - y = x + (- y)
*T : ∀ {d} (x y : Tower d) → Tower d
*T [] _ = []
*T xx@(x ∷ xs) yy@(y ∷ ys) = x ℝ.* y ∷ *T (lop xx) ys + *T (lop yy) xs
infixl 7 _*_
_*_ : Diff2
_*_ {zero} {n} x _ = x
_*_ {suc d} {n} = VR.zipWith *T n
-- directional derivative
du
: ∀ {m n} (f : Tower 2 ^ m → Tower 2 ^ n)
→ Tower 2 ^ m → Tower 1 ^ n
du {n = n} f xs = VR.map V.tail n (f xs)
fins : ∀ n → Fin n ^ n
fins n = VR.tabulate n id
directions : ∀ {d n} → ℝ ^ n → (Tower (suc d) ^ n) ^ n
directions {d} {n} x = VR.map (λ i → go i x) n (fins n)
where
go : ∀ {m} → Fin m → ℝ ^ m → Tower (suc d) ^ m
go {1} zero y = return y
go {2+ m} zero (y , ys) = return y , const ys
go {2+ m} (suc i) (y , ys) = const y , go i ys
outerWith
: ∀ {a b c} {A : Set a} {B : Set b} {C : Set c}
→ (f : A → B → C) → ∀ m n → A ^ m → B ^ n → (C ^ n) ^ m
outerWith f m n rm rn = VR.map (λ x → VR.map (f x) n rn) m rm
-- this is all very likely very slow
-- it's running `du` `m` times...
jacobian grad : ∀ {m n} (f : Tower 2 ^ m → Tower 2 ^ n) → ℝ ^ m → (ℝ ^ n) ^ m
jacobian {m = m} f x = VR.map (extract ∘ du f) m (directions x)
grad = jacobian
-- TODO
-- The second derivative cross terms are not currently clear to me.
-- directions2d : ∀ {d n} → ℝ ^ n → ((Tower (suc d) ^ n) ^ n) ^ n
-- directions2d {d} {n} x = rotations n dirs
-- -- VR.zipWith (λ y ys → {! !}) n (dirs) (rotations dirs)
-- where
-- dirs : (Tower (suc d) ^ n) ^ n
-- dirs = directions x
-- rotations : ∀ m → (Tower (suc d) ^ m) ^ m → ((Tower (suc d) ^ m) ^ m) ^ m
-- rotations = {! !}
-- d2u
-- : ∀ {m n} (f : Tower 3 ^ m → Tower 3 ^ n)
-- → Tower 3 ^ m → Tower 1 ^ n
-- d2u {n = n} f xs = VR.map (V.tail ∘ V.tail) n (f xs)
-- hessian
-- : ∀ {m n} (f : Tower 3 ^ m → Tower 3 ^ n)
-- → ℝ ^ m → ((ℝ ^ n) ^ m) ^ m
-- hessian {m} {n} f x =
-- VR.map (λ dir → VR.map (extract ∘ d2u f) m dir) m (directions2d x)
-- outerWith (λ y z → extract (du (du f) y)) m m (directions x) (directions x)
_>-<_ : (ℝ → ℝ) → (∀ {d'} → Tower d' → Tower d') → ∀ {d} → Tower d → Tower d
(f >-< g) {zero} [] = []
(f >-< g) {suc d} xx@(x ∷ xs) = f x ∷ xs * g (lop xx)
liftF : ∀ {d} (f : Tower d → Tower d) → ∀ {n} → Tower d ^ n → Tower d ^ n
liftF f {n} = VR.map f n
infixl 8 _^^_
_^^_ : ∀ {d n} → Tower d ^ n → (m : ℕ) → Tower d ^ n
x ^^ zero = lift (const 1.0)
x ^^ (suc d) = x * x ^^ d
module Single where
infixr 9 e^_
e^_ log recip sin cos sinh cosh abs sgn : ∀ {d} → Tower d → Tower d
e^ [] = []
e^_ {suc d} xx@(x ∷ xs) = ℝ.e^ x ∷ xs * (e^ lop xx)
log = ℝ.log >-< recip
recip [] = []
recip xx@(x ∷ xs) = 1/x ∷ 1/xx
where
1/x = 1.0 ℝ.÷ x
1/xx = recip (lop xx)
abs = ℝ.abs >-< sgn
sgn [] = []
sgn (x ∷ xs) = if does (0.0 ≤? x) then const 1.0 else const (ℝ.- 1.0)
where
open import Data.Bool using (if_then_else_)
open import Data.Real.Order
open import Relation.Nullary
-- I'm not sure why I have to write these by hand.
sin [] = []
sin xx@(x ∷ xs) = ℝ.sin x ∷ xs * cos (lop xx)
cos [] = []
cos xx@(x ∷ xs) = ℝ.cos x ∷ - xs * sin (lop xx)
sinh [] = []
sinh xx@(x ∷ xs) = ℝ.sinh x ∷ xs * cosh (lop xx)
cosh [] = []
cosh xx@(x ∷ xs) = ℝ.cosh x ∷ xs * sinh (lop xx)
infixr 9 e^_
e^_ log recip sin cos sinh cosh abs sgn : Diff
e^_ = liftF Single.e^_
log = liftF Single.log
recip = liftF Single.recip
abs = liftF Single.abs
sgn = liftF Single.sgn
sin = liftF Single.sin
cos = liftF Single.cos
sinh = liftF Single.sinh
cosh = liftF Single.cosh
infix 8 _**_
_**_ : Diff2
x ** y = e^ (y * log x)
ascend descend
: ∀ {n} (f : Tower 2 ^ n → Tower 2) (δ : ℝ ^ n) (m : ℕ) (x : ℝ ^ n) → ℝ ^ n
ascend f δ zero x = x
ascend {n = n} f δ (suc m) x = ascend f δ m (add x (mul δ (grad f x)))
where
add mul : (x y : ℝ ^ n) → ℝ ^ n
add = VR.zipWith ℝ._+_ n
mul = VR.zipWith ℝ._*_ n
descend f = ascend λ x → - f x
ascend_f=_δ=_steps=_start=_
: ∀ {n} (_ : ⊤ {0ℓ}) (f : Tower 2 ^ n → Tower 2) (δ : ℝ ^ n) (m : ℕ) (x : ℝ ^ n) → ℝ ^ n
ascend_f=_δ=_steps=_start=_ _ = ascend
∶ : ⊤ {0ℓ}
∶ = _
sterling : ℕ → ℝ
sterling n = n' ℝ.* ℝ.log n' ℝ.- n'
where
n' = ℝ.fromℕ n
logPoisson' logPoisson : ∀ {n} → ℕ ^ n → ∀ {d} → Tower d ^ n → Tower d ^ n
-- neglecting the normalization term
logPoisson' {n} k α = const k' * log α - α
where
k' = VR.map ℝ.fromℕ n k
logPoisson {n} k α = logPoisson' k α - const (VR.map sterling n k)
sum : ∀ {d n} → Tower d ^ n → Tower d
sum {d} {n} = VR.foldl (λ _ → Tower d) (const 0.0) id (λ _ x y → x + y) n
where open import Function using (id)
binned : ∀ {d n} → ℕ ^ n → Tower d ^ n → Tower d
binned n = sum ∘ logPoisson' n
test : ∀ {n} → ℝ ^ n → ℝ ^ n
test x =
ascend ∶
f= binned (lift 10)
δ= lift 1.0
steps= 1000
start= x
testgrad : ∀ {n} → ℝ ^ n → ℝ ^ n
testgrad = grad (binned (lift 10))
|
source/league/ucd/matreshka-internals-unicode-ucd-core_00aa.ads
|
svn2github/matreshka
| 24 |
26797
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_00AA is
pragma Preelaborate;
Group_00AA : aliased constant Core_Second_Stage
:= (16#00# .. 16#28# => -- AA00 .. AA28
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#29# .. 16#2E# => -- AA29 .. AA2E
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#2F# .. 16#30# => -- AA2F .. AA30
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#31# .. 16#32# => -- AA31 .. AA32
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#33# .. 16#34# => -- AA33 .. AA34
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#35# .. 16#36# => -- AA35 .. AA36
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#37# .. 16#3F# => -- AA37 .. AA3F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#40# .. 16#42# => -- AA40 .. AA42
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#43# => -- AA43
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#44# .. 16#4B# => -- AA44 .. AA4B
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#4C# => -- AA4C
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#4D# => -- AA4D
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#4E# .. 16#4F# => -- AA4E .. AA4F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#50# .. 16#59# => -- AA50 .. AA59
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#5A# .. 16#5B# => -- AA5A .. AA5B
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#5C# => -- AA5C
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#5D# .. 16#5F# => -- AA5D .. AA5F
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#70# => -- AA70
(Modifier_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#77# .. 16#79# => -- AA77 .. AA79
(Other_Symbol, Neutral,
Other, Other, Other, Complex_Context,
(Grapheme_Base => True,
others => False)),
16#7B# => -- AA7B
(Spacing_Mark, Neutral,
Other, Extend, Extend, Complex_Context,
(Diacritic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#7C# => -- AA7C
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#7D# => -- AA7D
(Spacing_Mark, Neutral,
Other, Extend, Extend, Complex_Context,
(Diacritic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#B0# => -- AAB0
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#B2# .. 16#B4# => -- AAB2 .. AAB4
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#B5# .. 16#B6# => -- AAB5 .. AAB6
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Logical_Order_Exception
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#B7# .. 16#B8# => -- AAB7 .. AAB8
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#B9# => -- AAB9
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Logical_Order_Exception
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#BB# .. 16#BC# => -- AABB .. AABC
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Logical_Order_Exception
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#BE# => -- AABE
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#BF# => -- AABF
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#C0# => -- AAC0
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Diacritic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#C1# => -- AAC1
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Complex_Context,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#C2# => -- AAC2
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Diacritic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#C3# .. 16#DA# => -- AAC3 .. AADA
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#DD# => -- AADD
(Modifier_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#DE# => -- AADE
(Other_Punctuation, Neutral,
Other, Other, Other, Complex_Context,
(Grapheme_Base => True,
others => False)),
16#DF# => -- AADF
(Other_Punctuation, Neutral,
Other, Other, Other, Complex_Context,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#E0# .. 16#EA# => -- AAE0 .. AAEA
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#EB# => -- AAEB
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#EC# .. 16#ED# => -- AAEC .. AAED
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#EE# .. 16#EF# => -- AAEE .. AAEF
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#F0# .. 16#F1# => -- AAF0 .. AAF1
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#F2# => -- AAF2
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F3# .. 16#F4# => -- AAF3 .. AAF4
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F5# => -- AAF5
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#F6# => -- AAF6
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#F7# .. 16#FF# => -- AAF7 .. AAFF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
others =>
(Other_Letter, Neutral,
Other, Other, O_Letter, Complex_Context,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_00AA;
|
ada-blinky-zfp/src/leds.ads
|
hfegran/efx32_ada_examples
| 0 |
6415
|
with Interfaces; use Interfaces;
with Interfaces.EFM32.CMU; use Interfaces.EFM32.CMU;
with Interfaces.EFM32.GPIO; use Interfaces.EFM32.GPIO;
package Leds is
type Bit is mod 2**1
with Size => 1;
type Color is (Blue, Green, Cyan, Red, Magenta, Yellow, White, Black);
type Pin_Type is (P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15);
type Led_No is (LED0, LED1);
type Port_Type is (PA, PB, PC, PD, PE, PF);
procedure Led_Init;
procedure Led_Set (LED : Led_No; Led_Color : Color);
procedure Blink(LED: Led_No; Led_Color : Color);
procedure GPIO_Tgl_Pin(Port : Port_Type; Pin : Pin_Type);
procedure GPIO_Set_Pin(Port : Port_Type; Pin : Pin_Type);
procedure GPIO_Clr_Pin(Port : Port_Type; Pin : Pin_Type);
end Leds;
|
Data/Collection.agda
|
banacorn/lambda-calculus
| 0 |
15647
|
module Data.Collection where
open import Data.Collection.Core public
open import Data.Collection.Equivalence
open import Data.Collection.Inclusion
open import Relation.Nullary
--------------------------------------------------------------------------------
-- Singleton
--------------------------------------------------------------------------------
singleton : String → Collection
singleton x = x ∷ []
--------------------------------------------------------------------------------
-- Delete
--------------------------------------------------------------------------------
delete : String → Collection → Collection
delete x [] = []
delete x (a ∷ A) with x ≟ a
delete x (a ∷ A) | yes p = delete x A -- keep deleting, because there might be many of them
delete x (a ∷ A) | no ¬p = a ∷ delete x A
--------------------------------------------------------------------------------
-- Union
--------------------------------------------------------------------------------
union : Collection → Collection → Collection
union [] B = B
union (a ∷ A) B with a ∈? B
union (a ∷ A) B | yes p = union A B
union (a ∷ A) B | no ¬p = a ∷ union A B
--
-- open import Data.List
-- open import Data.String hiding (setoid)
-- open import Data.List using ([]; _∷_) public
-- open import Data.Product
-- open import Data.Sum renaming (map to mapSum)
-- -- open import Data.Bool using (Bool; true; false; T; not)
-- open import Level renaming (zero to lvl0)
-- open import Function using (_∘_; id; flip; _on_)
-- open import Function.Equivalence using (_⇔_; Equivalence; equivalence)
--
-- open import Function.Equality using (_⟨$⟩_) renaming (cong to cong≈)
-- open import Relation.Nullary
-- open import Relation.Unary
-- open import Relation.Nullary.Negation
-- open import Relation.Nullary.Decidable renaming (map to mapDec; map′ to mapDec′)
-- open import Relation.Binary hiding (_⇒_)
-- open import Relation.Binary.PropositionalEquality
-- -- open ≡-Reasoning
--
--
-- -- I know this notation is a bit confusing
-- _⊈_ : ∀ {a ℓ₁ ℓ₂} {A : Set a} → Pred A ℓ₁ → Pred A ℓ₂ → Set _
-- P ⊈ Q = ∀ {x} → x ∉ P → x ∉ Q
--
--
-- ⊆-IsPreorder : IsPreorder _≋_ _⊆_
-- ⊆-IsPreorder = record
-- { isEquivalence = {! !}
-- ; reflexive = {! !}
-- ; trans = {! !}
-- }
--
--
-- []-empty : Empty c[ [] ]
-- []-empty = λ x → λ ()
--
-- here-respects-≡ : ∀ {A} → (λ x → x ∈ c[ A ]) Respects _≡_
-- here-respects-≡ refl = id
--
-- there-respects-≡ : ∀ {x A} → (λ a → x ∈ c[ a ∷ A ]) Respects _≡_
-- there-respects-≡ refl = id
--
-- ∈-respects-≡ : ∀ {x} → (λ P → x ∈ c[ P ]) Respects _≡_
-- ∈-respects-≡ refl = id
--
-- there-if-not-here : ∀ {x a A} → x ≢ a → x ∈ c[ a ∷ A ] → x ∈ c[ A ]
-- there-if-not-here x≢a here = contradiction refl x≢a
-- there-if-not-here x≢a (there x∈a∷A) = x∈a∷A
--
-- here-if-not-there : ∀ {x a A} → x ∉ c[ A ] → x ∈ c[ a ∷ A ] → x ≡ a
-- here-if-not-there x∉A here = refl
-- here-if-not-there x∉A (there x∈A) = contradiction x∈A x∉A
--
-- map-¬∷ : ∀ {x a A B} → (x ∉ c[ A ] → x ∉ c[ B ]) → x ≢ a → x ∉ c[ a ∷ A ] → x ∉ c[ a ∷ B ]
-- map-¬∷ f x≢x x∉a∷A here = contradiction refl x≢x
-- map-¬∷ f x≢a x∉a∷A (there x∈B) = f (x∉a∷A ∘ there) x∈B
--
-- still-not-there : ∀ {x y} A → x ≢ y → x ∉ c[ A ] → x ∉ c[ y ∷ A ]
-- still-not-there [] x≢y x∉[y] here = x≢y refl
-- still-not-there [] x≢y x∉[y] (there ())
-- still-not-there (a ∷ A) x≢y x∉a∷A here = x≢y refl
-- still-not-there (a ∷ A) x≢y x∉a∷A (there x∈a∷A) = x∉a∷A x∈a∷A
--
-- --------------------------------------------------------------------------------
-- -- Union
-- --------------------------------------------------------------------------------
--
-- union : Collection → Collection → Collection
-- union [] B = B
-- union (a ∷ A) B with a ∈? B
-- union (a ∷ A) B | yes p = union A B
-- union (a ∷ A) B | no ¬p = a ∷ union A B
--
-- in-right-union : ∀ A B → c[ B ] ⊆ c[ union A B ]
-- in-right-union [] B x∈B = x∈B
-- in-right-union (a ∷ A) B x∈B with a ∈? B
-- in-right-union (a ∷ A) B x∈B | yes p = in-right-union A B x∈B
-- in-right-union (a ∷ A) B x∈B | no ¬p = there (in-right-union A B x∈B)
--
-- in-left-union : ∀ A B → c[ A ] ⊆ c[ union A B ]
-- in-left-union [] B ()
-- in-left-union (a ∷ A) B x∈A with a ∈? B
-- in-left-union (a ∷ A) B here | yes p = in-right-union A B p
-- in-left-union (a ∷ A) B (there x∈A) | yes p = in-left-union A B x∈A
-- in-left-union (a ∷ A) B here | no ¬p = here
-- in-left-union (a ∷ A) B (there x∈A) | no ¬p = there (in-left-union A B x∈A)
--
-- ∪-left-identity : ∀ A → c[ [] ] ∪ c[ A ] ≋ c[ A ]
-- ∪-left-identity A = equivalence to inj₂
-- where
-- to : c[ [] ] ∪ c[ A ] ⊆ c[ A ]
-- to (inj₁ ())
-- to (inj₂ ∈A) = ∈A
--
-- ∪-right-identity : ∀ A → c[ A ] ∪ c[ [] ] ≋ c[ A ]
-- ∪-right-identity A = equivalence to inj₁
-- where
-- to : c[ A ] ∪ c[ [] ] ⊆ c[ A ]
-- to (inj₁ ∈A) = ∈A
-- to (inj₂ ())
--
-- in-either : ∀ A B → c[ union A B ] ⊆ c[ A ] ∪ c[ B ]
-- in-either [] B x∈A∪B = inj₂ x∈A∪B
-- in-either (a ∷ A) B x∈A∪B with a ∈? B
-- in-either (a ∷ A) B x∈A∪B | yes p = mapSum there id (in-either A B x∈A∪B)
-- in-either (a ∷ A) B here | no ¬p = inj₁ here
-- in-either (a ∷ A) B (there x∈A∪B) | no ¬p = mapSum there id (in-either A B x∈A∪B)
--
-- ∪-union : ∀ A B → c[ A ] ∪ c[ B ] ≋ c[ union A B ]
-- ∪-union A B = equivalence to (in-either A B)
-- where to : ∀ {x} → x ∈ c[ A ] ∪ c[ B ] → x ∈ c[ union A B ]
-- to (inj₁ ∈A) = in-left-union A B ∈A
-- to (inj₂ ∈B) = in-right-union A B ∈B
--
-- -- map-⊆-union : ∀ {A B C} → c[ A ] ⊆ c[ B ] → c[ B ] ⊆ c[ C ] → c[ ] ⊆ c[ union C D ]
-- -- map-⊆-union f g ∈union = {! !}
--
--
-- union-branch-1 : ∀ {x a} A B → a ∈ c[ B ] → x ∈ c[ union (a ∷ A) B ] → x ∈ c[ union A B ]
-- union-branch-1 {x} {a} A B a∈B x∈union with a ∈? B
-- union-branch-1 A B a∈B x∈union | yes p = x∈union
-- union-branch-1 A B a∈B x∈union | no ¬p = contradiction a∈B ¬p
--
-- there-left-union-coherence : ∀ {x} {a} A B → x ∈ c[ a ∷ A ] → x ∈c a ∷ union A B
-- there-left-union-coherence A B here = here
-- there-left-union-coherence A B (there x∈a∷A) = there (in-left-union A B x∈a∷A)
--
--
-- in-neither : ∀ {x} A B → x ∉c union A B → x ∉ c[ A ] × x ∉ c[ B ]
-- in-neither [] B x∉A∪B = (λ ()) , x∉A∪B
-- in-neither (a ∷ A) B x∉A∪B with a ∈? B
-- in-neither (a ∷ A) B x∉A∪B | yes a∈B = (contraposition (union-branch-1 A B a∈B ∘ in-left-union (a ∷ A) B) x∉A∪B) , (contraposition (in-right-union A B) x∉A∪B)
-- in-neither (a ∷ A) B x∉A∪B | no a∉B = (contraposition (there-left-union-coherence A B) x∉A∪B) , contraposition (there ∘ in-right-union A B) x∉A∪B
--
--
-- delete : String → Collection → Collection
-- delete x [] = []
-- delete x (a ∷ A) with x ≟ a
-- delete x (a ∷ A) | yes p = delete x A -- keep deleting, because there might be many of them
-- delete x (a ∷ A) | no ¬p = a ∷ delete x A
--
-- ∉-after-deleted : ∀ x A → x ∉ c[ delete x A ]
-- ∉-after-deleted x [] ()
-- ∉-after-deleted x (a ∷ A) with x ≟ a
-- ∉-after-deleted x (a ∷ A) | yes p = ∉-after-deleted x A
-- ∉-after-deleted x (a ∷ A) | no ¬p = still-not-there (delete x A) ¬p (∉-after-deleted x A)
--
--
-- still-∈-after-deleted : ∀ {x} y A → x ≢ y → x ∈ c[ A ] → x ∈ c[ delete y A ]
-- still-∈-after-deleted y [] x≢y ()
-- still-∈-after-deleted y (a ∷ A) x≢y x∈A with y ≟ a
-- still-∈-after-deleted y (.y ∷ A) x≢y x∈A | yes refl = still-∈-after-deleted y A x≢y (there-if-not-here x≢y x∈A)
-- still-∈-after-deleted y (a ∷ A) x≢y x∈A | no ¬p = ∷-⊆-monotone {! !} {! x∈A !}
-- -- still-∈-after-deleted y (a ∷ A) x≢y x∈A | no ¬p = ∷-⊆-monotone (still-∈-after-deleted y A x≢y) x∈A
--
-- -- still-∉-after-deleted : ∀ {x} y A → x ≢ y → x ∉ c[ A ] → x ∉ c[ delete y A ]
-- -- still-∉-after-deleted y [] x≢y x∉A = x∉A
-- -- still-∉-after-deleted y (a ∷ A) x≢y x∉A with y ≟ a
-- -- still-∉-after-deleted y (.y ∷ A) x≢y x∉A | yes refl = still-∉-after-deleted y A x≢y (x∉A ∘ there)
-- -- still-∉-after-deleted {x} y (a ∷ A) x≢y x∉A | (no ¬p) with x ≟ a
-- -- still-∉-after-deleted y (x ∷ A) x≢y x∉A | no ¬p | yes refl = contradiction here x∉A
-- -- still-∉-after-deleted y (a ∷ A) x≢y x∉A | no ¬p | no ¬q = map-¬∷ (still-∉-after-deleted y A x≢y) ¬q x∉A
-- --
-- -- still-∉-after-recovered : ∀ {x} y A → x ≢ y → x ∉c delete y A → x ∉ c[ A ]
-- -- still-∉-after-recovered y [] x≢y x∉deleted ()
-- -- still-∉-after-recovered y (a ∷ A) x≢y x∉deleted x∈a∷A with y ≟ a
-- -- still-∉-after-recovered y (.y ∷ A) x≢y x∉deleted x∈a∷A | yes refl = still-∉-after-recovered y A x≢y x∉deleted (there-if-not-here x≢y x∈a∷A)
-- -- still-∉-after-recovered {x} y (a ∷ A) x≢y x∉deleted x∈a∷A | no ¬p with x ≟ a
-- -- still-∉-after-recovered y (x ∷ A) x≢y x∉deleted x∈a∷A | no ¬p | yes refl = contradiction here x∉deleted
-- -- still-∉-after-recovered y (a ∷ A) x≢y x∉deleted x∈a∷A | no ¬p | no ¬q = x∉deleted (∷-⊆-monotone (still-∈-after-deleted y A x≢y) x∈a∷A)
--
-- singleton : String → Collection
-- singleton x = x ∷ []
--
-- singleton-≡ : ∀ {x y} → x ∈ c[ singleton y ] → x ≡ y
-- singleton-≡ here = refl
-- singleton-≡ (there ())
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_42_301.asm
|
ljhsiun2/medusa
| 9 |
162177
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x105a, %r9
nop
nop
nop
nop
and $46065, %rdx
vmovups (%r9), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %r14
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x53fa, %rsi
lea addresses_normal_ht+0x165da, %rdi
nop
nop
nop
add %r9, %r9
mov $77, %rcx
rep movsl
nop
nop
nop
inc %r14
lea addresses_WC_ht+0x925a, %rsi
nop
nop
nop
nop
dec %rbx
mov $0x6162636465666768, %rcx
movq %rcx, (%rsi)
nop
nop
dec %rcx
lea addresses_A_ht+0x245a, %rsi
lea addresses_WT_ht+0x6e5a, %rdi
nop
cmp %r14, %r14
mov $84, %rcx
rep movsb
nop
nop
nop
inc %r9
lea addresses_UC_ht+0x485a, %rbx
nop
nop
nop
inc %rdi
movl $0x61626364, (%rbx)
nop
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0x1dda, %rsi
lea addresses_WC_ht+0x8cda, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
xor %r10, %r10
mov $47, %rcx
rep movsq
nop
nop
nop
nop
inc %r10
lea addresses_WC_ht+0x1b15a, %r14
sub $45160, %r9
vmovups (%r14), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %rdi
nop
nop
inc %r10
lea addresses_WT_ht+0x8c1a, %rsi
lea addresses_UC_ht+0x705a, %rdi
nop
nop
nop
nop
nop
and %r14, %r14
mov $42, %rcx
rep movsb
add %r10, %r10
lea addresses_normal_ht+0x35f8, %rdi
nop
nop
and %rcx, %rcx
movw $0x6162, (%rdi)
and %rdx, %rdx
lea addresses_UC_ht+0xbf1a, %rsi
inc %rbx
movups (%rsi), %xmm1
vpextrq $0, %xmm1, %r10
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_UC_ht+0x45a, %rsi
lea addresses_D_ht+0x1d62, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $6238, %rdx
mov $82, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x1c5a2, %r10
cmp $63296, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
nop
nop
nop
nop
nop
sub %r14, %r14
lea addresses_D_ht+0x145a, %rdx
clflush (%rdx)
dec %rbx
movb $0x61, (%rdx)
nop
nop
nop
cmp %r10, %r10
lea addresses_WT_ht+0xc61e, %r14
nop
sub $46598, %rsi
movb (%r14), %cl
nop
sub $58912, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r8
push %r9
push %rcx
// Store
mov $0x7903d10000000247, %r9
nop
nop
inc %r11
mov $0x5152535455565758, %r8
movq %r8, %xmm6
vmovups %ymm6, (%r9)
nop
nop
xor %r9, %r9
// Store
lea addresses_normal+0x1145a, %r13
inc %rcx
movb $0x51, (%r13)
nop
nop
and %r8, %r8
// Store
lea addresses_US+0x1605a, %r8
xor %r14, %r14
mov $0x5152535455565758, %r10
movq %r10, (%r8)
nop
xor $25735, %r11
// Store
lea addresses_D+0xde5a, %r13
nop
nop
inc %r10
mov $0x5152535455565758, %r9
movq %r9, %xmm2
movups %xmm2, (%r13)
nop
nop
nop
add $50623, %r8
// Faulty Load
lea addresses_US+0xb05a, %r11
inc %r13
mov (%r11), %r14
lea oracles, %r10
and $0xff, %r14
shlq $12, %r14
mov (%r10,%r14,1), %r14
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_US', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 11}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'dst': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 6}}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 5}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 2}}
{'58': 42}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
pin-2.11/source/tools/AVX/vmovqu_app_ia32.asm
|
swchoi1994/Project
| 3 |
103310
|
.686
.XMM
.model flat, c
PUBLIC CopyViaYmmRegs
.code
CopyViaYmmRegs PROC
push ebp
mov ebp, esp
mov eax,[ebp]+8
mov ecx,[ebp]+12
vmovdqu ymm0, ymmword ptr [eax]
vmovdqu ymmword ptr [ecx], ymm0
vmovdqu ymm1, ymmword ptr [eax]+32
vmovdqu ymmword ptr [ecx]+32, ymm1
vmovdqu ymm2, ymmword ptr [eax]+64
vmovdqu ymmword ptr [ecx]+64, ymm2
vmovdqu ymm3, ymmword ptr [eax]+96
vmovdqu ymmword ptr [ecx]+96, ymm3
vmovdqu ymm4, ymmword ptr [eax]+128
vmovdqu ymmword ptr [ecx]+128, ymm4
vmovdqu ymm5, ymmword ptr [eax]+160
vmovdqu ymmword ptr [ecx]+160, ymm5
vmovdqu ymm6, ymmword ptr [eax]+192
vmovdqu ymmword ptr [ecx]+192, ymm6
vmovdqu ymm7, ymmword ptr [eax]+224
vmovdqu ymmword ptr [ecx]+224, ymm7
vmovdqu ymm0, ymmword ptr [eax]+256
vmovdqu ymmword ptr [ecx]+256, ymm0
vmovdqu ymm1, ymmword ptr [eax]+288
vmovdqu ymmword ptr [ecx]+288, ymm1
vmovdqu ymm2, ymmword ptr [eax]+320
vmovdqu ymmword ptr [ecx]+320, ymm2
vmovdqu ymm3, ymmword ptr [eax]+352
vmovdqu ymmword ptr [ecx]+352, ymm3
vmovdqu ymm4, ymmword ptr [eax]+384
vmovdqu ymmword ptr [ecx]+384, ymm4
vmovdqu ymm5, ymmword ptr [eax]+416
vmovdqu ymmword ptr [ecx]+416, ymm5
vmovdqu ymm6, ymmword ptr [eax]+448
vmovdqu ymmword ptr [ecx]+448, ymm6
vmovdqu ymm7, ymmword ptr [eax]+480
vmovdqu ymmword ptr [ecx]+480, ymm7
pop ebp
ret
CopyViaYmmRegs ENDP
end
|
strings_edit.ads
|
jrcarter/Ada_GUI
| 19 |
25796
|
<reponame>jrcarter/Ada_GUI
-- --
-- package Strings_Edit Copyright (c) <NAME> --
-- Interface Luebeck --
-- Spring, 2000 --
-- --
-- Last revision : 22:14 08 May 2009 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- The following I/O items are supported by the package:
--
-- (o) Integer numbers (generic, package Integer_Edit)
-- (o) Floating-point numbers (generic, package Float_Edit)
-- (o) Roman numbers (the child package Roman_Edit)
-- (o) Strings
--
-- The major differences to the standard Image/Value attributes and
-- Text_IO procedures.
--
-- 1. For numeric types, the base is neither written nor read. For
-- instance, output of 23 as hexadecimal gives 17, not 16#17#.
--
-- 2. Get procedures do not skip blank characters around input tokens,
-- except the cases when the blank charactes is required by the
-- syntax.
--
-- 3. Get procedures use the current string position pointer, so that
-- they can be consequently called advancing the pointer as the tokes
-- are recognized.
--
-- 4. Numeric get procedures allow to specify the expected value range.
-- When the actual value is out of the range then depending on
-- procedure parameters, either Constrain_Error is propagated or the
-- value is forced to the nearest range boundary.
--
-- 5. Put procedures also use the current string position pointer, which
-- allows to call them consequently.
--
-- 6. The format used for floating-number output is based on the number
-- precision, instead of rather typographic approach of Text_IO. The
-- precision can be specified either as the number of valid digits of
-- the current base (i.e. relative) or as the position of the last
-- valid digit (i.e. absolute). For instance, 12.345678 with relative
-- precision 3 gives 12.3. With absolute precision -3, it gives
-- 12.346.
--
-- G E T P R O C E D U R E S
--
-- Get procedures are used to scan strings. The first two parameters are
-- always Source and Pointer. Source is the string to be scaned. Pointer
-- indicates the current position. After successful completion it is
-- advanced to the first string position following the recognized item.
-- The value of Pointer shall be in the range Source'First ..
-- Source'Last+1. The Layout_Error exception is propagated when this
-- check fails. The third parameter usually accepts the value. The
-- following example shows how to use get procedures:
--
-- package Edit_Float is new Strings_Edit.Float_Edit (Float);
-- use Edit_Float;
--
-- Line : String (1..512); -- A line
-- Pointer : Integer;
-- Value : Float;
-- TabAndSpace : Ada.Strings.Maps.Character_Set :=
-- To_Set (" " & Ada.Characters.Latin_1.HT);
-- begin
-- ...
-- Pointer := Line'First;
-- Get (Line, Pointer, TabAndSpace); -- Skip tabs and spaces
-- Get (Line, Pointer, Value); -- Get number
-- Get (Line, Pointer, TabAndSpace); -- Skip tabs and spaces
-- ...
--
-- The numeric Get procedures have additional parameters controlling the
-- range of the input value. The parameters First and Last define the
-- range of the expected value. The exception Constraint_Error is
-- propagated when the value is not in the range. The exception can be
-- suppressed using the parameters ToFirst and ToLast, which cause the
-- input value to be substituted by the corresponding margin when the
-- parameter is True.
--
-- V A L U E F U N C T I O N S
--
-- Each get procedure returning some value has a corresponding function
-- Value. The function Value has the same parameter profile with the
-- exception that the parameter Pointer is absent and the value is
-- returned via result. Unlike Get the function Value tolerates spaces
-- and tabs around the converted value. The whole string should be
-- matched, otherwise, the exception Data_Error is propagated.
--
-- P U T P R O C E D U R E S
--
-- Put procedures place something into the output string Destination.
-- The string is written starting from Destination (Pointer). The
-- parameter Field defines the output size. When it has the value zero
-- then the output size is defined by the output item. Otherwise the
-- output is justified within the field and the parameter Justify
-- specifies output alignment and the parameter Fill gives the pad
-- character. When Field is greater than Destination'Last - Pointer + 1,
-- the later is used instead. After successful completion Pointer is
-- advanced to the first character following the output or to
-- Destination'Last + 1.
--
-- I M A G E F U N C T I O N S
--
-- Image functions convert a value into string. Unlike standard S'Image
-- they do not place an extra space character.
--
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings;
with Ada.Characters.Latin_1;
package Strings_Edit is
pragma Elaborate_Body (Strings_Edit);
MaxSmall : constant := 250; -- Bigger than any possible
Figures : constant String := "0123456789ABCDEF";
Blanks : constant String := ' ' & Ada.Characters.Latin_1.HT;
SpaceAndTab : constant Character_Set := To_Set (Blanks);
subtype Alignment is Ada.Strings.Alignment;
Center : Alignment renames Ada.Strings.Center;
Left : Alignment renames Ada.Strings.Left;
Right : Alignment renames Ada.Strings.Right;
subtype NumberBase is Integer range 2..16;
--
-- <NAME>
--
-- Get -- Skip blank characters
--
-- Source - The string to be processed
-- Pointer - The current position in the string
-- Blank - The blank character
--
-- This procedure skips the character Blank starting from Source
-- (Pointer). Pointer is advanced to the first non-Blank character or
-- to Source'Last + 1.
--
-- Exceptions :
--
-- Layout_Error - Pointer is not in Source'First..Source'Last + 1
--
procedure Get
( Source : String;
Pointer : in out Integer;
Blank : Character := ' '
);
--
-- Get -- Skip blank characters
--
-- Source - The string to be processed
-- Pointer - The current position in the string
-- Blanks - The set characters to be considered as blank ones
--
-- This procedure skips all the characters of the set Blanks starting
-- from Source (Pointer). Pointer is advanced to the first non-blank
-- character or to Source'Last + 1.
--
-- Exceptions :
--
-- Layout_Error - Pointer is not in Source'First..Source'Last + 1
--
procedure Get
( Source : String;
Pointer : in out Integer;
Blanks : Character_Set
);
--
-- Put -- Put a character into a string
--
-- Destination - The string that accepts the output
-- Pointer - The current position in the string
-- Value - The character to be put
-- Field - The output field
-- Justify - Alignment within the field
-- Fill - The fill character
--
-- This procedure places the specified character (Value parameter)
-- into the output string Destination. The string is written starting
-- from the Destination (Pointer).
--
-- Exceptions:
--
-- Layout_Error - Pointer is not in Destination'Range or there is
-- no room for the output.
--
procedure Put
( Destination : in out String;
Pointer : in out Integer;
Value : Character;
Field : Natural := 0;
Justify : Alignment := Left;
Fill : Character := ' '
);
--
-- Put -- Put a string into another string
--
-- Destination - The string that accepts the output
-- Pointer - The current position in the string
-- Value - The string to be put
-- Field - The output field
-- Justify - Alignment within the field
-- Fill - The fill character
--
-- This procedure places the specified by the Value parameter string
-- into the output string Destination. The string is written starting
-- from the Destination (Pointer).
--
-- Exceptions:
--
-- Layout_Error - Pointer is not in Destination'Range or there is
-- no room for the output.
--
procedure Put
( Destination : in out String;
Pointer : in out Integer;
Value : String;
Field : Natural := 0;
Justify : Alignment := Left;
Fill : Character := ' '
);
--
-- R O M A N N U M B E R S
--
-- Roman_Edit -- Child package for roman numbers
--
-- I N T E G E R N U M B E R S
--
-- Integer_Edit -- Generic child package for integer numbers
--
-- F L O A T I N G - P O I N T N U M B E R S
--
-- Float_Edit -- Generic child package for floating-point numbers
--
-- P R E F I X T E S T
--
--
-- Is_Prefix -- Test if Prefix is a prefix of Text
--
-- Prefix - To check
-- Source - The string
-- [ Pointer ] - To start at
-- [ Map ] - Used to convert characters before comparison
--
-- Returns :
--
-- True if Prefix is a prefix of Source
--
function Is_Prefix (Prefix, Source : String) return Boolean;
function Is_Prefix
( Prefix, Source : String;
Pointer : Integer
) return Boolean;
function Is_Prefix
( Prefix, Source : String;
Map : Character_Mapping
) return Boolean;
function Is_Prefix
( Prefix, Source : String;
Pointer : Integer;
Map : Character_Mapping
) return Boolean;
--
-- T R I M F U N C T I O N S
--
-- Trim -- Delete blank characters form string ends
--
-- Source - The string to be processed
-- Blank - The blank character
--
-- This function removes the Blank character from both ends of the
-- string and returns the result.
--
-- Returns :
--
-- The result string
--
function Trim
( Source : String;
Blank : Character := ' '
) return String;
--
-- Trim -- Delete blank characters form string ends
--
-- Source - The string to be processed
-- Blanks - The set of blank characters
--
-- This function removes any characters of the Blanks set from both
-- ends of the string and returns the result.
--
-- Returns :
--
-- The result string
--
function Trim
( Source : String;
Blanks : Character_Set
) return String;
private
pragma Inline (Is_Prefix);
--
-- GetDigit -- Get one digit
--
-- Symbol - To be decoded
--
-- Returns :
--
-- [0..15] The decoded digit value
-- [16] The Symbol is not a digit
--
function GetDigit (Symbol : Character) return Natural;
pragma Inline (GetDigit);
end Strings_Edit;
|
oeis/296/A296660.asm
|
neoneye/loda-programs
| 11 |
162725
|
; A296660: Expansion of the e.g.f. exp(-2*x)/(1-4*x).
; Submitted by <NAME>
; 1,2,20,232,3728,74528,1788736,50084480,1602703616,57697329664,2307893187584,101547300251648,4874270412083200,253462061428318208,14193875439985836032,851632526399150129152,54504481689545608331264,3706304754889101366394880
add $0,1
mov $2,1
lpb $0
sub $0,1
div $1,-2
mul $2,4
add $1,$2
mul $1,4
mul $2,$0
lpe
div $1,16
mov $0,$1
|
oeis/350/A350107.asm
|
neoneye/loda-programs
| 11 |
20609
|
<filename>oeis/350/A350107.asm
; A350107: a(n) = Sum_{k=1..n} k * floor(n/k)^2.
; Submitted by <NAME>
; 1,6,14,31,45,81,101,150,191,253,285,401,439,527,623,752,802,979,1035,1233,1369,1509,1577,1901,2020,2186,2362,2642,2728,3136,3228,3549,3765,3983,4215,4772,4882,5126,5382,5932,6054,6630,6758,7202,7664,7960,8100,8936,9173,9680,10016,10542,10700,11444,11812,12588,12964,13338,13514,14786,14968,15368,16020,16789,17225,18137,18337,19027,19483,20459,20671,22204,22422,22900,23676,24448,24968,26048,26284,27698,28387,28917,29165,30957,31529,32085,32661,33889,34155,36081,36697,37633,38249,38857,39497,41549
add $0,1
mov $3,$0
lpb $3
add $2,$0
mov $6,$3
cmp $6,0
add $3,$6
div $2,$3
mov $5,$3
mul $5,$2
mul $2,$5
add $4,$2
add $5,$4
div $2,$5
sub $3,1
lpe
mov $0,$4
|
oeis/155/A155148.asm
|
neoneye/loda-programs
| 11 |
102678
|
; A155148: Numbers n such that n^4 has exactly 2 different decimal digits.
; 2,3,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000
mov $1,1
mov $2,1
mov $3,$0
sub $0,1
mul $3,5
lpb $3
mul $2,$3
add $1,$2
mov $5,$0
mov $7,$0
cmp $7,0
add $5,$7
div $2,$5
sub $3,1
add $4,1
lpe
div $1,$2
mov $6,10
pow $6,$0
mov $7,$6
cmp $7,0
add $6,$7
add $1,$6
lpb $4
mov $1,$6
mod $4,7
lpe
mov $0,$1
|
src/main/antlr4/de/unknownreality/dataframe/generated/Predicate.g4
|
nRo/JavaDataFrame
| 0 |
553
|
/*
* Copyright (c) 2019 <NAME>
*
* 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.
*/
grammar Predicate;
/*
* Parser Rules
*/
compilationUnit : predicate EOF ;
field_filter :
NEGATE? OPEN_BRACKET field_filter CLOSE_BRACKET|
variable FIELD_OPERATION value|
column_predicate|
regex_filter|
boolean_filter
;
boolean_filter :
variable | (NEGATE variable);
regex_filter :
variable MATCH REGEX;
column_predicate :
COLUMN FIELD_OPERATION COLUMN;
predicate:
NEGATE? OPEN_BRACKET predicate CLOSE_BRACKET |
OPEN_BRACKET predicate PREDICATE_OPERATION predicate CLOSE_BRACKET|
predicate PREDICATE_OPERATION predicate|
field_filter;
value: (NUMBER | BOOLEAN_VALUE | TEXT_VALUE | NULL);
variable: VAR | COLUMN;
/*
* Lexer Rules
*/
fragment DIGIT : [0-9];
fragment COL_PREFIX : '.';
fragment CHAR : [a-zA-Z];
fragment STRING : '\'' (~('\'')|'\\\'') * '\''|'"' (~('"')|'\\"')* '"';
fragment UNESCAPED_STRING :~('.'| ' '|')' | '(' | '!') ~('\''|' '|')' | '(')*;
fragment EQ : ('EQ' | 'eq' | '=' | '==');
fragment NE : ('NE' | 'ne' | '!=');
fragment LE : ('LE' | 'le' | '<=');
fragment LT : ('LT' | 'lt' | '<');
fragment GE : ('GE' | 'ge' | '>=');
fragment GT : ('GT' | 'gt' | '>');
fragment LIKE : ('LIKE' | 'like');
REGEX : '/' (~('/') | '\\/')+ '/';
MATCH : ('~=' | '~' );
fragment AND : ('AND' | 'and' | '&' | '&&');
fragment OR : ('OR' | 'or' | '|' | '||');
fragment XOR : ('XOR' | 'xor') ;
fragment NOR : ('NOR' | 'nor') ;
fragment VAR_NAME : (UNESCAPED_STRING | STRING);
OPEN_BRACKET: '(';
CLOSE_BRACKET: ')';
NEGATE: '!';
PREDICATE_OPERATION : AND | OR | XOR | NOR;
FIELD_OPERATION : EQ | NE |LE | LT | GT | GE | LIKE;
NUMBER : '-'? DIGIT+([.,]DIGIT+)?;
BOOLEAN_VALUE: 'true' | 'false';
TEXT_VALUE : STRING;
NULL: 'null' | 'NULL' | 'NA' | 'na';
COLUMN : COL_PREFIX VAR_NAME;
VAR: VAR_NAME;
WHITESPACE : ' ' -> skip ;
|
src/main_menu/win_screen.asm
|
TypeDefinition/NautiBuoy
| 2 |
84112
|
INCLUDE "./src/include/hardware.inc"
INCLUDE "./src/include/util.inc"
INCLUDE "./src/include/hUGE.inc"
INCLUDE "./src/definitions/definitions.inc"
SECTION "Win Screen WRAM", WRAM0
wBGMTimer:
ds 2
SECTION "Win Screen", ROM0
; Global Jumps
JumpLoadWinScreen::
jp LoadWinScreen
; Local Jumps
JumpUpdateWinScreen:
jp UpdateWinScreen
JumpVBlankHandler:
jp VBlankHandler
LCDOn:
; Set LCDC Flags
ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINOFF | LCDCF_BG9800 | LCDCF_OBJ16 | LCDCF_OBJOFF | LCDCF_BGON
ld [hLCDC], a
ld [rLCDC], a
ret
LoadWinScreen:
di
call LCDOff
call SoundOff
ld hl, JumpVBlankHandler
call SetVBlankCallback
ld hl, JumpUpdateWinScreen
call SetProgramLoopCallback
; Copy tile data into VRAM.
set_romx_bank BANK(BGWindowTileData)
mem_copy BGWindowTileData, _VRAM9000, BGWindowTileData.end-BGWindowTileData
IF DEF(LANGUAGE_EN)
; Copy font tile data into VRAM.
set_romx_bank BANK(FontTileDataEN)
mem_copy FontTileDataEN, _VRAM9200, FontTileDataEN.end-FontTileDataEN
; Copy tile map into VRAM.
set_romx_bank BANK(WinScreenTileMapEN)
mem_copy WinScreenTileMapEN, _SCRN0, WinScreenTileMapEN.end-WinScreenTileMapEN
ENDC
IF DEF(LANGUAGE_JP)
; Copy font tile data into VRAM.
set_romx_bank BANK(FontTileDataJP)
mem_copy FontTileDataJP, _VRAM9200, FontTileDataJP.end-FontTileDataJP
; Copy tile map into VRAM.
set_romx_bank BANK(WinScreenTileMapJP)
mem_copy WinScreenTileMapJP, _SCRN0, WinScreenTileMapJP.end-WinScreenTileMapJP
ENDC
; Reset SCY & SCX.
xor a
ld [rSCY], a
ld [rSCX], a
call ResetBGWindowUpdateQueue
; Reset BGM Timer
xor a
ld [wBGMTimer], a
ld [wBGMTimer+1], a
call LCDOn
; Set BGM
call SoundOn
set_romx_bank BANK(WinScreenBGM)
ld hl, WinScreenBGM
call hUGE_init
ei
ret
UpdateWinScreen:
; Update Sound (Stop BGM after ~3 seconds.)
ld a, [wBGMTimer]
cp a, $02
call z, SoundOff
jr z, .getInput
ld a, [wBGMTimer+1]
add a, $03
ld [wBGMTimer+1], a
ld a, [wBGMTimer]
adc a, $00
ld [wBGMTimer], a
set_romx_bank BANK(WinScreenBGM)
call _hUGE_dosound
; Get Input
.getInput
call UpdateInput
ld a, [wNewlyInputKeys]
ld b, a
.onB
bit PADB_B, b
jr z, .end
ld a, HIGH(JumpLoadStageSelectScreen)
ld [wMainMenuDefaultJump], a
ld a, LOW(JumpLoadStageSelectScreen)
ld [wMainMenuDefaultJump+1], a
ld hl, JumpLoadMainMenu
call SetProgramLoopCallback
jr .end
.end
call UpdateBGWindow
ret
VBlankHandler:
push af
; Check for lag frame.
ldh a, [hWaitVBlankFlag]
and a
jr z, .lagFrame
; Reset hWaitVBlankFlag
xor a
ldh [hWaitVBlankFlag], a
push bc
push de
push hl
; Code Goes Here
pop hl
pop de
pop bc
pop af
.lagFrame
pop af
reti
|
programs/oeis/279/A279620.asm
|
karttu/loda
| 1 |
103311
|
<reponame>karttu/loda<gh_stars>1-10
; A279620: Limit of the sequence of words defined by w(1) = 1, w(2) = 1221, and w(n) = w(n-1) 2 w(n-2) 2 w(n-1) for n >= 2. Also the fixed point of the map 1 -> 122, 2 -> 12.
; 1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,1,2,1,2,2,1,2,1,2
cal $0,4641 ; Fixed under 0 -> 10, 1 -> 100.
gcd $0,2
mov $1,$0
|
libsrc/math/daimath32/c/asm/___dai32_xfabs.asm
|
ahjelm/z88dk
| 640 |
99907
|
SECTION code_fp_dai32
PUBLIC ___dai32_xfabs
EXTERN xfabs
defc ___dai32_xfabs = xfabs
|
oeis/311/A311633.asm
|
neoneye/loda-programs
| 11 |
82951
|
; A311633: Coordination sequence Gal.5.100.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,4,8,12,18,24,30,34,38,42,46,50,54,60,66,72,76,80,84,88,92,96,102,108,114,118,122,126,130,134,138,144,150,156,160,164,168,172,176,180,186,192,198,202,206,210,214,218,222,228
mov $2,$0
add $0,3
mov $3,$0
lpb $0
trn $0,6
mov $1,$3
add $1,$0
sub $0,3
add $1,2
mul $1,2
sub $1,2
add $3,2
add $0,$3
trn $0,$3
add $3,4
trn $1,$3
lpe
add $1,1
lpb $2
add $1,3
sub $2,1
lpe
mov $0,$1
|
programs/oeis/256/A256650.asm
|
karttu/loda
| 0 |
25370
|
; A256650: 30-gonal pyramidal numbers: a(n) = n*(n+1)*(28*n-25)/6.
; 0,1,31,118,290,575,1001,1596,2388,3405,4675,6226,8086,10283,12845,15800,19176,23001,27303,32110,37450,43351,49841,56948,64700,73125,82251,92106,102718,114115,126325,139376,153296,168113,183855,200550,218226,236911,256633,277420,299300,322301,346451,371778,398310,426075,455101,485416,517048,550025,584375,620126,657306,695943,736065,777700,820876,865621,911963,959930,1009550,1060851,1113861,1168608,1225120,1283425,1343551,1405526,1469378,1535135,1602825,1672476,1744116,1817773,1893475,1971250,2051126,2133131,2217293,2303640,2392200,2483001,2576071,2671438,2769130,2869175,2971601,3076436,3183708,3293445,3405675,3520426,3637726,3757603,3880085,4005200,4132976,4263441,4396623,4532550,4671250,4812751,4957081,5104268,5254340,5407325,5563251,5722146,5884038,6048955,6216925,6387976,6562136,6739433,6919895,7103550,7290426,7480551,7673953,7870660,8070700,8274101,8480891,8691098,8904750,9121875,9342501,9566656,9794368,10025665,10260575,10499126,10741346,10987263,11236905,11490300,11747476,12008461,12273283,12541970,12814550,13091051,13371501,13655928,13944360,14236825,14533351,14833966,15138698,15447575,15760625,16077876,16399356,16725093,17055115,17389450,17728126,18071171,18418613,18770480,19126800,19487601,19852911,20222758,20597170,20976175,21359801,21748076,22141028,22538685,22941075,23348226,23760166,24176923,24598525,25025000,25456376,25892681,26333943,26780190,27231450,27687751,28149121,28615588,29087180,29563925,30045851,30532986,31025358,31522995,32025925,32534176,33047776,33566753,34091135,34620950,35156226,35696991,36243273,36795100,37352500,37915501,38484131,39058418,39638390,40224075,40815501,41412696,42015688,42624505,43239175,43859726,44486186,45118583,45756945,46401300,47051676,47708101,48370603,49039210,49713950,50394851,51081941,51775248,52474800,53180625,53892751,54611206,55336018,56067215,56804825,57548876,58299396,59056413,59819955,60590050,61366726,62150011,62939933,63736520,64539800,65349801,66166551,66990078,67820410,68657575,69501601,70352516,71210348,72075125
mov $12,$0
mov $14,$0
lpb $14,1
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
lpb $11,1
mov $0,$9
sub $11,1
sub $0,$11
mul $0,4
mov $1,$0
sub $1,3
mul $1,7
sub $1,6
add $10,$1
lpe
add $13,$10
lpe
mov $1,$13
|
echo.asm
|
PieMyth/cs333
| 0 |
246582
|
_echo: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
for(i = 1; i < argc; i++)
14: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
1b: eb 3c jmp 59 <main+0x59>
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
1d: 8b 45 f4 mov -0xc(%ebp),%eax
20: 83 c0 01 add $0x1,%eax
23: 3b 03 cmp (%ebx),%eax
25: 7d 07 jge 2e <main+0x2e>
27: ba 1c 09 00 00 mov $0x91c,%edx
2c: eb 05 jmp 33 <main+0x33>
2e: ba 1e 09 00 00 mov $0x91e,%edx
33: 8b 45 f4 mov -0xc(%ebp),%eax
36: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
3d: 8b 43 04 mov 0x4(%ebx),%eax
40: 01 c8 add %ecx,%eax
42: 8b 00 mov (%eax),%eax
44: 52 push %edx
45: 50 push %eax
46: 68 20 09 00 00 push $0x920
4b: 6a 01 push $0x1
4d: e8 14 05 00 00 call 566 <printf>
52: 83 c4 10 add $0x10,%esp
int
main(int argc, char *argv[])
{
int i;
for(i = 1; i < argc; i++)
55: 83 45 f4 01 addl $0x1,-0xc(%ebp)
59: 8b 45 f4 mov -0xc(%ebp),%eax
5c: 3b 03 cmp (%ebx),%eax
5e: 7c bd jl 1d <main+0x1d>
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
exit();
60: e8 2a 03 00 00 call 38f <exit>
00000065 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
65: 55 push %ebp
66: 89 e5 mov %esp,%ebp
68: 57 push %edi
69: 53 push %ebx
asm volatile("cld; rep stosb" :
6a: 8b 4d 08 mov 0x8(%ebp),%ecx
6d: 8b 55 10 mov 0x10(%ebp),%edx
70: 8b 45 0c mov 0xc(%ebp),%eax
73: 89 cb mov %ecx,%ebx
75: 89 df mov %ebx,%edi
77: 89 d1 mov %edx,%ecx
79: fc cld
7a: f3 aa rep stos %al,%es:(%edi)
7c: 89 ca mov %ecx,%edx
7e: 89 fb mov %edi,%ebx
80: 89 5d 08 mov %ebx,0x8(%ebp)
83: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
86: 90 nop
87: 5b pop %ebx
88: 5f pop %edi
89: 5d pop %ebp
8a: c3 ret
0000008b <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
8b: 55 push %ebp
8c: 89 e5 mov %esp,%ebp
8e: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
91: 8b 45 08 mov 0x8(%ebp),%eax
94: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
97: 90 nop
98: 8b 45 08 mov 0x8(%ebp),%eax
9b: 8d 50 01 lea 0x1(%eax),%edx
9e: 89 55 08 mov %edx,0x8(%ebp)
a1: 8b 55 0c mov 0xc(%ebp),%edx
a4: 8d 4a 01 lea 0x1(%edx),%ecx
a7: 89 4d 0c mov %ecx,0xc(%ebp)
aa: 0f b6 12 movzbl (%edx),%edx
ad: 88 10 mov %dl,(%eax)
af: 0f b6 00 movzbl (%eax),%eax
b2: 84 c0 test %al,%al
b4: 75 e2 jne 98 <strcpy+0xd>
;
return os;
b6: 8b 45 fc mov -0x4(%ebp),%eax
}
b9: c9 leave
ba: c3 ret
000000bb <strcmp>:
int
strcmp(const char *p, const char *q)
{
bb: 55 push %ebp
bc: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
be: eb 08 jmp c8 <strcmp+0xd>
p++, q++;
c0: 83 45 08 01 addl $0x1,0x8(%ebp)
c4: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c8: 8b 45 08 mov 0x8(%ebp),%eax
cb: 0f b6 00 movzbl (%eax),%eax
ce: 84 c0 test %al,%al
d0: 74 10 je e2 <strcmp+0x27>
d2: 8b 45 08 mov 0x8(%ebp),%eax
d5: 0f b6 10 movzbl (%eax),%edx
d8: 8b 45 0c mov 0xc(%ebp),%eax
db: 0f b6 00 movzbl (%eax),%eax
de: 38 c2 cmp %al,%dl
e0: 74 de je c0 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
e2: 8b 45 08 mov 0x8(%ebp),%eax
e5: 0f b6 00 movzbl (%eax),%eax
e8: 0f b6 d0 movzbl %al,%edx
eb: 8b 45 0c mov 0xc(%ebp),%eax
ee: 0f b6 00 movzbl (%eax),%eax
f1: 0f b6 c0 movzbl %al,%eax
f4: 29 c2 sub %eax,%edx
f6: 89 d0 mov %edx,%eax
}
f8: 5d pop %ebp
f9: c3 ret
000000fa <strlen>:
uint
strlen(char *s)
{
fa: 55 push %ebp
fb: 89 e5 mov %esp,%ebp
fd: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
100: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
107: eb 04 jmp 10d <strlen+0x13>
109: 83 45 fc 01 addl $0x1,-0x4(%ebp)
10d: 8b 55 fc mov -0x4(%ebp),%edx
110: 8b 45 08 mov 0x8(%ebp),%eax
113: 01 d0 add %edx,%eax
115: 0f b6 00 movzbl (%eax),%eax
118: 84 c0 test %al,%al
11a: 75 ed jne 109 <strlen+0xf>
;
return n;
11c: 8b 45 fc mov -0x4(%ebp),%eax
}
11f: c9 leave
120: c3 ret
00000121 <memset>:
void*
memset(void *dst, int c, uint n)
{
121: 55 push %ebp
122: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
124: 8b 45 10 mov 0x10(%ebp),%eax
127: 50 push %eax
128: ff 75 0c pushl 0xc(%ebp)
12b: ff 75 08 pushl 0x8(%ebp)
12e: e8 32 ff ff ff call 65 <stosb>
133: 83 c4 0c add $0xc,%esp
return dst;
136: 8b 45 08 mov 0x8(%ebp),%eax
}
139: c9 leave
13a: c3 ret
0000013b <strchr>:
char*
strchr(const char *s, char c)
{
13b: 55 push %ebp
13c: 89 e5 mov %esp,%ebp
13e: 83 ec 04 sub $0x4,%esp
141: 8b 45 0c mov 0xc(%ebp),%eax
144: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
147: eb 14 jmp 15d <strchr+0x22>
if(*s == c)
149: 8b 45 08 mov 0x8(%ebp),%eax
14c: 0f b6 00 movzbl (%eax),%eax
14f: 3a 45 fc cmp -0x4(%ebp),%al
152: 75 05 jne 159 <strchr+0x1e>
return (char*)s;
154: 8b 45 08 mov 0x8(%ebp),%eax
157: eb 13 jmp 16c <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
159: 83 45 08 01 addl $0x1,0x8(%ebp)
15d: 8b 45 08 mov 0x8(%ebp),%eax
160: 0f b6 00 movzbl (%eax),%eax
163: 84 c0 test %al,%al
165: 75 e2 jne 149 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
167: b8 00 00 00 00 mov $0x0,%eax
}
16c: c9 leave
16d: c3 ret
0000016e <gets>:
char*
gets(char *buf, int max)
{
16e: 55 push %ebp
16f: 89 e5 mov %esp,%ebp
171: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
174: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
17b: eb 42 jmp 1bf <gets+0x51>
cc = read(0, &c, 1);
17d: 83 ec 04 sub $0x4,%esp
180: 6a 01 push $0x1
182: 8d 45 ef lea -0x11(%ebp),%eax
185: 50 push %eax
186: 6a 00 push $0x0
188: e8 1a 02 00 00 call 3a7 <read>
18d: 83 c4 10 add $0x10,%esp
190: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
193: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
197: 7e 33 jle 1cc <gets+0x5e>
break;
buf[i++] = c;
199: 8b 45 f4 mov -0xc(%ebp),%eax
19c: 8d 50 01 lea 0x1(%eax),%edx
19f: 89 55 f4 mov %edx,-0xc(%ebp)
1a2: 89 c2 mov %eax,%edx
1a4: 8b 45 08 mov 0x8(%ebp),%eax
1a7: 01 c2 add %eax,%edx
1a9: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1ad: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1af: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1b3: 3c 0a cmp $0xa,%al
1b5: 74 16 je 1cd <gets+0x5f>
1b7: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1bb: 3c 0d cmp $0xd,%al
1bd: 74 0e je 1cd <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1bf: 8b 45 f4 mov -0xc(%ebp),%eax
1c2: 83 c0 01 add $0x1,%eax
1c5: 3b 45 0c cmp 0xc(%ebp),%eax
1c8: 7c b3 jl 17d <gets+0xf>
1ca: eb 01 jmp 1cd <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
1cc: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1cd: 8b 55 f4 mov -0xc(%ebp),%edx
1d0: 8b 45 08 mov 0x8(%ebp),%eax
1d3: 01 d0 add %edx,%eax
1d5: c6 00 00 movb $0x0,(%eax)
return buf;
1d8: 8b 45 08 mov 0x8(%ebp),%eax
}
1db: c9 leave
1dc: c3 ret
000001dd <stat>:
int
stat(char *n, struct stat *st)
{
1dd: 55 push %ebp
1de: 89 e5 mov %esp,%ebp
1e0: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1e3: 83 ec 08 sub $0x8,%esp
1e6: 6a 00 push $0x0
1e8: ff 75 08 pushl 0x8(%ebp)
1eb: e8 df 01 00 00 call 3cf <open>
1f0: 83 c4 10 add $0x10,%esp
1f3: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1f6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1fa: 79 07 jns 203 <stat+0x26>
return -1;
1fc: b8 ff ff ff ff mov $0xffffffff,%eax
201: eb 25 jmp 228 <stat+0x4b>
r = fstat(fd, st);
203: 83 ec 08 sub $0x8,%esp
206: ff 75 0c pushl 0xc(%ebp)
209: ff 75 f4 pushl -0xc(%ebp)
20c: e8 d6 01 00 00 call 3e7 <fstat>
211: 83 c4 10 add $0x10,%esp
214: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
217: 83 ec 0c sub $0xc,%esp
21a: ff 75 f4 pushl -0xc(%ebp)
21d: e8 95 01 00 00 call 3b7 <close>
222: 83 c4 10 add $0x10,%esp
return r;
225: 8b 45 f0 mov -0x10(%ebp),%eax
}
228: c9 leave
229: c3 ret
0000022a <atoi>:
int
atoi(const char *s)
{
22a: 55 push %ebp
22b: 89 e5 mov %esp,%ebp
22d: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
230: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
237: eb 04 jmp 23d <atoi+0x13>
239: 83 45 08 01 addl $0x1,0x8(%ebp)
23d: 8b 45 08 mov 0x8(%ebp),%eax
240: 0f b6 00 movzbl (%eax),%eax
243: 3c 20 cmp $0x20,%al
245: 74 f2 je 239 <atoi+0xf>
sign = (*s == '-') ? -1 : 1;
247: 8b 45 08 mov 0x8(%ebp),%eax
24a: 0f b6 00 movzbl (%eax),%eax
24d: 3c 2d cmp $0x2d,%al
24f: 75 07 jne 258 <atoi+0x2e>
251: b8 ff ff ff ff mov $0xffffffff,%eax
256: eb 05 jmp 25d <atoi+0x33>
258: b8 01 00 00 00 mov $0x1,%eax
25d: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
260: 8b 45 08 mov 0x8(%ebp),%eax
263: 0f b6 00 movzbl (%eax),%eax
266: 3c 2b cmp $0x2b,%al
268: 74 0a je 274 <atoi+0x4a>
26a: 8b 45 08 mov 0x8(%ebp),%eax
26d: 0f b6 00 movzbl (%eax),%eax
270: 3c 2d cmp $0x2d,%al
272: 75 2b jne 29f <atoi+0x75>
s++;
274: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '9')
278: eb 25 jmp 29f <atoi+0x75>
n = n*10 + *s++ - '0';
27a: 8b 55 fc mov -0x4(%ebp),%edx
27d: 89 d0 mov %edx,%eax
27f: c1 e0 02 shl $0x2,%eax
282: 01 d0 add %edx,%eax
284: 01 c0 add %eax,%eax
286: 89 c1 mov %eax,%ecx
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 8d 50 01 lea 0x1(%eax),%edx
28e: 89 55 08 mov %edx,0x8(%ebp)
291: 0f b6 00 movzbl (%eax),%eax
294: 0f be c0 movsbl %al,%eax
297: 01 c8 add %ecx,%eax
299: 83 e8 30 sub $0x30,%eax
29c: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '9')
29f: 8b 45 08 mov 0x8(%ebp),%eax
2a2: 0f b6 00 movzbl (%eax),%eax
2a5: 3c 2f cmp $0x2f,%al
2a7: 7e 0a jle 2b3 <atoi+0x89>
2a9: 8b 45 08 mov 0x8(%ebp),%eax
2ac: 0f b6 00 movzbl (%eax),%eax
2af: 3c 39 cmp $0x39,%al
2b1: 7e c7 jle 27a <atoi+0x50>
n = n*10 + *s++ - '0';
return sign*n;
2b3: 8b 45 f8 mov -0x8(%ebp),%eax
2b6: 0f af 45 fc imul -0x4(%ebp),%eax
}
2ba: c9 leave
2bb: c3 ret
000002bc <atoo>:
int
atoo(const char *s)
{
2bc: 55 push %ebp
2bd: 89 e5 mov %esp,%ebp
2bf: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
2c2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
2c9: eb 04 jmp 2cf <atoo+0x13>
2cb: 83 45 08 01 addl $0x1,0x8(%ebp)
2cf: 8b 45 08 mov 0x8(%ebp),%eax
2d2: 0f b6 00 movzbl (%eax),%eax
2d5: 3c 20 cmp $0x20,%al
2d7: 74 f2 je 2cb <atoo+0xf>
sign = (*s == '-') ? -1 : 1;
2d9: 8b 45 08 mov 0x8(%ebp),%eax
2dc: 0f b6 00 movzbl (%eax),%eax
2df: 3c 2d cmp $0x2d,%al
2e1: 75 07 jne 2ea <atoo+0x2e>
2e3: b8 ff ff ff ff mov $0xffffffff,%eax
2e8: eb 05 jmp 2ef <atoo+0x33>
2ea: b8 01 00 00 00 mov $0x1,%eax
2ef: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
2f2: 8b 45 08 mov 0x8(%ebp),%eax
2f5: 0f b6 00 movzbl (%eax),%eax
2f8: 3c 2b cmp $0x2b,%al
2fa: 74 0a je 306 <atoo+0x4a>
2fc: 8b 45 08 mov 0x8(%ebp),%eax
2ff: 0f b6 00 movzbl (%eax),%eax
302: 3c 2d cmp $0x2d,%al
304: 75 27 jne 32d <atoo+0x71>
s++;
306: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '7')
30a: eb 21 jmp 32d <atoo+0x71>
n = n*8 + *s++ - '0';
30c: 8b 45 fc mov -0x4(%ebp),%eax
30f: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
316: 8b 45 08 mov 0x8(%ebp),%eax
319: 8d 50 01 lea 0x1(%eax),%edx
31c: 89 55 08 mov %edx,0x8(%ebp)
31f: 0f b6 00 movzbl (%eax),%eax
322: 0f be c0 movsbl %al,%eax
325: 01 c8 add %ecx,%eax
327: 83 e8 30 sub $0x30,%eax
32a: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '7')
32d: 8b 45 08 mov 0x8(%ebp),%eax
330: 0f b6 00 movzbl (%eax),%eax
333: 3c 2f cmp $0x2f,%al
335: 7e 0a jle 341 <atoo+0x85>
337: 8b 45 08 mov 0x8(%ebp),%eax
33a: 0f b6 00 movzbl (%eax),%eax
33d: 3c 37 cmp $0x37,%al
33f: 7e cb jle 30c <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
341: 8b 45 f8 mov -0x8(%ebp),%eax
344: 0f af 45 fc imul -0x4(%ebp),%eax
}
348: c9 leave
349: c3 ret
0000034a <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
34a: 55 push %ebp
34b: 89 e5 mov %esp,%ebp
34d: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
350: 8b 45 08 mov 0x8(%ebp),%eax
353: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
356: 8b 45 0c mov 0xc(%ebp),%eax
359: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
35c: eb 17 jmp 375 <memmove+0x2b>
*dst++ = *src++;
35e: 8b 45 fc mov -0x4(%ebp),%eax
361: 8d 50 01 lea 0x1(%eax),%edx
364: 89 55 fc mov %edx,-0x4(%ebp)
367: 8b 55 f8 mov -0x8(%ebp),%edx
36a: 8d 4a 01 lea 0x1(%edx),%ecx
36d: 89 4d f8 mov %ecx,-0x8(%ebp)
370: 0f b6 12 movzbl (%edx),%edx
373: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
375: 8b 45 10 mov 0x10(%ebp),%eax
378: 8d 50 ff lea -0x1(%eax),%edx
37b: 89 55 10 mov %edx,0x10(%ebp)
37e: 85 c0 test %eax,%eax
380: 7f dc jg 35e <memmove+0x14>
*dst++ = *src++;
return vdst;
382: 8b 45 08 mov 0x8(%ebp),%eax
}
385: c9 leave
386: c3 ret
00000387 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
387: b8 01 00 00 00 mov $0x1,%eax
38c: cd 40 int $0x40
38e: c3 ret
0000038f <exit>:
SYSCALL(exit)
38f: b8 02 00 00 00 mov $0x2,%eax
394: cd 40 int $0x40
396: c3 ret
00000397 <wait>:
SYSCALL(wait)
397: b8 03 00 00 00 mov $0x3,%eax
39c: cd 40 int $0x40
39e: c3 ret
0000039f <pipe>:
SYSCALL(pipe)
39f: b8 04 00 00 00 mov $0x4,%eax
3a4: cd 40 int $0x40
3a6: c3 ret
000003a7 <read>:
SYSCALL(read)
3a7: b8 05 00 00 00 mov $0x5,%eax
3ac: cd 40 int $0x40
3ae: c3 ret
000003af <write>:
SYSCALL(write)
3af: b8 10 00 00 00 mov $0x10,%eax
3b4: cd 40 int $0x40
3b6: c3 ret
000003b7 <close>:
SYSCALL(close)
3b7: b8 15 00 00 00 mov $0x15,%eax
3bc: cd 40 int $0x40
3be: c3 ret
000003bf <kill>:
SYSCALL(kill)
3bf: b8 06 00 00 00 mov $0x6,%eax
3c4: cd 40 int $0x40
3c6: c3 ret
000003c7 <exec>:
SYSCALL(exec)
3c7: b8 07 00 00 00 mov $0x7,%eax
3cc: cd 40 int $0x40
3ce: c3 ret
000003cf <open>:
SYSCALL(open)
3cf: b8 0f 00 00 00 mov $0xf,%eax
3d4: cd 40 int $0x40
3d6: c3 ret
000003d7 <mknod>:
SYSCALL(mknod)
3d7: b8 11 00 00 00 mov $0x11,%eax
3dc: cd 40 int $0x40
3de: c3 ret
000003df <unlink>:
SYSCALL(unlink)
3df: b8 12 00 00 00 mov $0x12,%eax
3e4: cd 40 int $0x40
3e6: c3 ret
000003e7 <fstat>:
SYSCALL(fstat)
3e7: b8 08 00 00 00 mov $0x8,%eax
3ec: cd 40 int $0x40
3ee: c3 ret
000003ef <link>:
SYSCALL(link)
3ef: b8 13 00 00 00 mov $0x13,%eax
3f4: cd 40 int $0x40
3f6: c3 ret
000003f7 <mkdir>:
SYSCALL(mkdir)
3f7: b8 14 00 00 00 mov $0x14,%eax
3fc: cd 40 int $0x40
3fe: c3 ret
000003ff <chdir>:
SYSCALL(chdir)
3ff: b8 09 00 00 00 mov $0x9,%eax
404: cd 40 int $0x40
406: c3 ret
00000407 <dup>:
SYSCALL(dup)
407: b8 0a 00 00 00 mov $0xa,%eax
40c: cd 40 int $0x40
40e: c3 ret
0000040f <getpid>:
SYSCALL(getpid)
40f: b8 0b 00 00 00 mov $0xb,%eax
414: cd 40 int $0x40
416: c3 ret
00000417 <sbrk>:
SYSCALL(sbrk)
417: b8 0c 00 00 00 mov $0xc,%eax
41c: cd 40 int $0x40
41e: c3 ret
0000041f <sleep>:
SYSCALL(sleep)
41f: b8 0d 00 00 00 mov $0xd,%eax
424: cd 40 int $0x40
426: c3 ret
00000427 <uptime>:
SYSCALL(uptime)
427: b8 0e 00 00 00 mov $0xe,%eax
42c: cd 40 int $0x40
42e: c3 ret
0000042f <halt>:
SYSCALL(halt)
42f: b8 16 00 00 00 mov $0x16,%eax
434: cd 40 int $0x40
436: c3 ret
00000437 <date>:
SYSCALL(date)
437: b8 17 00 00 00 mov $0x17,%eax
43c: cd 40 int $0x40
43e: c3 ret
0000043f <getuid>:
SYSCALL(getuid)
43f: b8 18 00 00 00 mov $0x18,%eax
444: cd 40 int $0x40
446: c3 ret
00000447 <getgid>:
SYSCALL(getgid)
447: b8 19 00 00 00 mov $0x19,%eax
44c: cd 40 int $0x40
44e: c3 ret
0000044f <getppid>:
SYSCALL(getppid)
44f: b8 1a 00 00 00 mov $0x1a,%eax
454: cd 40 int $0x40
456: c3 ret
00000457 <setuid>:
SYSCALL(setuid)
457: b8 1b 00 00 00 mov $0x1b,%eax
45c: cd 40 int $0x40
45e: c3 ret
0000045f <setgid>:
SYSCALL(setgid)
45f: b8 1c 00 00 00 mov $0x1c,%eax
464: cd 40 int $0x40
466: c3 ret
00000467 <getprocs>:
SYSCALL(getprocs)
467: b8 1d 00 00 00 mov $0x1d,%eax
46c: cd 40 int $0x40
46e: c3 ret
0000046f <setpriority>:
SYSCALL(setpriority)
46f: b8 1e 00 00 00 mov $0x1e,%eax
474: cd 40 int $0x40
476: c3 ret
00000477 <chmod>:
SYSCALL(chmod)
477: b8 1f 00 00 00 mov $0x1f,%eax
47c: cd 40 int $0x40
47e: c3 ret
0000047f <chown>:
SYSCALL(chown)
47f: b8 20 00 00 00 mov $0x20,%eax
484: cd 40 int $0x40
486: c3 ret
00000487 <chgrp>:
SYSCALL(chgrp)
487: b8 21 00 00 00 mov $0x21,%eax
48c: cd 40 int $0x40
48e: c3 ret
0000048f <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
48f: 55 push %ebp
490: 89 e5 mov %esp,%ebp
492: 83 ec 18 sub $0x18,%esp
495: 8b 45 0c mov 0xc(%ebp),%eax
498: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
49b: 83 ec 04 sub $0x4,%esp
49e: 6a 01 push $0x1
4a0: 8d 45 f4 lea -0xc(%ebp),%eax
4a3: 50 push %eax
4a4: ff 75 08 pushl 0x8(%ebp)
4a7: e8 03 ff ff ff call 3af <write>
4ac: 83 c4 10 add $0x10,%esp
}
4af: 90 nop
4b0: c9 leave
4b1: c3 ret
000004b2 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
4b2: 55 push %ebp
4b3: 89 e5 mov %esp,%ebp
4b5: 53 push %ebx
4b6: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
4b9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
4c0: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
4c4: 74 17 je 4dd <printint+0x2b>
4c6: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
4ca: 79 11 jns 4dd <printint+0x2b>
neg = 1;
4cc: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
4d3: 8b 45 0c mov 0xc(%ebp),%eax
4d6: f7 d8 neg %eax
4d8: 89 45 ec mov %eax,-0x14(%ebp)
4db: eb 06 jmp 4e3 <printint+0x31>
} else {
x = xx;
4dd: 8b 45 0c mov 0xc(%ebp),%eax
4e0: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
4e3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
4ea: 8b 4d f4 mov -0xc(%ebp),%ecx
4ed: 8d 41 01 lea 0x1(%ecx),%eax
4f0: 89 45 f4 mov %eax,-0xc(%ebp)
4f3: 8b 5d 10 mov 0x10(%ebp),%ebx
4f6: 8b 45 ec mov -0x14(%ebp),%eax
4f9: ba 00 00 00 00 mov $0x0,%edx
4fe: f7 f3 div %ebx
500: 89 d0 mov %edx,%eax
502: 0f b6 80 98 0b 00 00 movzbl 0xb98(%eax),%eax
509: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
50d: 8b 5d 10 mov 0x10(%ebp),%ebx
510: 8b 45 ec mov -0x14(%ebp),%eax
513: ba 00 00 00 00 mov $0x0,%edx
518: f7 f3 div %ebx
51a: 89 45 ec mov %eax,-0x14(%ebp)
51d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
521: 75 c7 jne 4ea <printint+0x38>
if(neg)
523: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
527: 74 2d je 556 <printint+0xa4>
buf[i++] = '-';
529: 8b 45 f4 mov -0xc(%ebp),%eax
52c: 8d 50 01 lea 0x1(%eax),%edx
52f: 89 55 f4 mov %edx,-0xc(%ebp)
532: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
537: eb 1d jmp 556 <printint+0xa4>
putc(fd, buf[i]);
539: 8d 55 dc lea -0x24(%ebp),%edx
53c: 8b 45 f4 mov -0xc(%ebp),%eax
53f: 01 d0 add %edx,%eax
541: 0f b6 00 movzbl (%eax),%eax
544: 0f be c0 movsbl %al,%eax
547: 83 ec 08 sub $0x8,%esp
54a: 50 push %eax
54b: ff 75 08 pushl 0x8(%ebp)
54e: e8 3c ff ff ff call 48f <putc>
553: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
556: 83 6d f4 01 subl $0x1,-0xc(%ebp)
55a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
55e: 79 d9 jns 539 <printint+0x87>
putc(fd, buf[i]);
}
560: 90 nop
561: 8b 5d fc mov -0x4(%ebp),%ebx
564: c9 leave
565: c3 ret
00000566 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
566: 55 push %ebp
567: 89 e5 mov %esp,%ebp
569: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
56c: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
573: 8d 45 0c lea 0xc(%ebp),%eax
576: 83 c0 04 add $0x4,%eax
579: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
57c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
583: e9 59 01 00 00 jmp 6e1 <printf+0x17b>
c = fmt[i] & 0xff;
588: 8b 55 0c mov 0xc(%ebp),%edx
58b: 8b 45 f0 mov -0x10(%ebp),%eax
58e: 01 d0 add %edx,%eax
590: 0f b6 00 movzbl (%eax),%eax
593: 0f be c0 movsbl %al,%eax
596: 25 ff 00 00 00 and $0xff,%eax
59b: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
59e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5a2: 75 2c jne 5d0 <printf+0x6a>
if(c == '%'){
5a4: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
5a8: 75 0c jne 5b6 <printf+0x50>
state = '%';
5aa: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
5b1: e9 27 01 00 00 jmp 6dd <printf+0x177>
} else {
putc(fd, c);
5b6: 8b 45 e4 mov -0x1c(%ebp),%eax
5b9: 0f be c0 movsbl %al,%eax
5bc: 83 ec 08 sub $0x8,%esp
5bf: 50 push %eax
5c0: ff 75 08 pushl 0x8(%ebp)
5c3: e8 c7 fe ff ff call 48f <putc>
5c8: 83 c4 10 add $0x10,%esp
5cb: e9 0d 01 00 00 jmp 6dd <printf+0x177>
}
} else if(state == '%'){
5d0: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
5d4: 0f 85 03 01 00 00 jne 6dd <printf+0x177>
if(c == 'd'){
5da: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
5de: 75 1e jne 5fe <printf+0x98>
printint(fd, *ap, 10, 1);
5e0: 8b 45 e8 mov -0x18(%ebp),%eax
5e3: 8b 00 mov (%eax),%eax
5e5: 6a 01 push $0x1
5e7: 6a 0a push $0xa
5e9: 50 push %eax
5ea: ff 75 08 pushl 0x8(%ebp)
5ed: e8 c0 fe ff ff call 4b2 <printint>
5f2: 83 c4 10 add $0x10,%esp
ap++;
5f5: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5f9: e9 d8 00 00 00 jmp 6d6 <printf+0x170>
} else if(c == 'x' || c == 'p'){
5fe: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
602: 74 06 je 60a <printf+0xa4>
604: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
608: 75 1e jne 628 <printf+0xc2>
printint(fd, *ap, 16, 0);
60a: 8b 45 e8 mov -0x18(%ebp),%eax
60d: 8b 00 mov (%eax),%eax
60f: 6a 00 push $0x0
611: 6a 10 push $0x10
613: 50 push %eax
614: ff 75 08 pushl 0x8(%ebp)
617: e8 96 fe ff ff call 4b2 <printint>
61c: 83 c4 10 add $0x10,%esp
ap++;
61f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
623: e9 ae 00 00 00 jmp 6d6 <printf+0x170>
} else if(c == 's'){
628: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
62c: 75 43 jne 671 <printf+0x10b>
s = (char*)*ap;
62e: 8b 45 e8 mov -0x18(%ebp),%eax
631: 8b 00 mov (%eax),%eax
633: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
636: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
63a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
63e: 75 25 jne 665 <printf+0xff>
s = "(null)";
640: c7 45 f4 25 09 00 00 movl $0x925,-0xc(%ebp)
while(*s != 0){
647: eb 1c jmp 665 <printf+0xff>
putc(fd, *s);
649: 8b 45 f4 mov -0xc(%ebp),%eax
64c: 0f b6 00 movzbl (%eax),%eax
64f: 0f be c0 movsbl %al,%eax
652: 83 ec 08 sub $0x8,%esp
655: 50 push %eax
656: ff 75 08 pushl 0x8(%ebp)
659: e8 31 fe ff ff call 48f <putc>
65e: 83 c4 10 add $0x10,%esp
s++;
661: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
665: 8b 45 f4 mov -0xc(%ebp),%eax
668: 0f b6 00 movzbl (%eax),%eax
66b: 84 c0 test %al,%al
66d: 75 da jne 649 <printf+0xe3>
66f: eb 65 jmp 6d6 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
671: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
675: 75 1d jne 694 <printf+0x12e>
putc(fd, *ap);
677: 8b 45 e8 mov -0x18(%ebp),%eax
67a: 8b 00 mov (%eax),%eax
67c: 0f be c0 movsbl %al,%eax
67f: 83 ec 08 sub $0x8,%esp
682: 50 push %eax
683: ff 75 08 pushl 0x8(%ebp)
686: e8 04 fe ff ff call 48f <putc>
68b: 83 c4 10 add $0x10,%esp
ap++;
68e: 83 45 e8 04 addl $0x4,-0x18(%ebp)
692: eb 42 jmp 6d6 <printf+0x170>
} else if(c == '%'){
694: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
698: 75 17 jne 6b1 <printf+0x14b>
putc(fd, c);
69a: 8b 45 e4 mov -0x1c(%ebp),%eax
69d: 0f be c0 movsbl %al,%eax
6a0: 83 ec 08 sub $0x8,%esp
6a3: 50 push %eax
6a4: ff 75 08 pushl 0x8(%ebp)
6a7: e8 e3 fd ff ff call 48f <putc>
6ac: 83 c4 10 add $0x10,%esp
6af: eb 25 jmp 6d6 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
6b1: 83 ec 08 sub $0x8,%esp
6b4: 6a 25 push $0x25
6b6: ff 75 08 pushl 0x8(%ebp)
6b9: e8 d1 fd ff ff call 48f <putc>
6be: 83 c4 10 add $0x10,%esp
putc(fd, c);
6c1: 8b 45 e4 mov -0x1c(%ebp),%eax
6c4: 0f be c0 movsbl %al,%eax
6c7: 83 ec 08 sub $0x8,%esp
6ca: 50 push %eax
6cb: ff 75 08 pushl 0x8(%ebp)
6ce: e8 bc fd ff ff call 48f <putc>
6d3: 83 c4 10 add $0x10,%esp
}
state = 0;
6d6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6dd: 83 45 f0 01 addl $0x1,-0x10(%ebp)
6e1: 8b 55 0c mov 0xc(%ebp),%edx
6e4: 8b 45 f0 mov -0x10(%ebp),%eax
6e7: 01 d0 add %edx,%eax
6e9: 0f b6 00 movzbl (%eax),%eax
6ec: 84 c0 test %al,%al
6ee: 0f 85 94 fe ff ff jne 588 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
6f4: 90 nop
6f5: c9 leave
6f6: c3 ret
000006f7 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6f7: 55 push %ebp
6f8: 89 e5 mov %esp,%ebp
6fa: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
6fd: 8b 45 08 mov 0x8(%ebp),%eax
700: 83 e8 08 sub $0x8,%eax
703: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
706: a1 b4 0b 00 00 mov 0xbb4,%eax
70b: 89 45 fc mov %eax,-0x4(%ebp)
70e: eb 24 jmp 734 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
710: 8b 45 fc mov -0x4(%ebp),%eax
713: 8b 00 mov (%eax),%eax
715: 3b 45 fc cmp -0x4(%ebp),%eax
718: 77 12 ja 72c <free+0x35>
71a: 8b 45 f8 mov -0x8(%ebp),%eax
71d: 3b 45 fc cmp -0x4(%ebp),%eax
720: 77 24 ja 746 <free+0x4f>
722: 8b 45 fc mov -0x4(%ebp),%eax
725: 8b 00 mov (%eax),%eax
727: 3b 45 f8 cmp -0x8(%ebp),%eax
72a: 77 1a ja 746 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
72c: 8b 45 fc mov -0x4(%ebp),%eax
72f: 8b 00 mov (%eax),%eax
731: 89 45 fc mov %eax,-0x4(%ebp)
734: 8b 45 f8 mov -0x8(%ebp),%eax
737: 3b 45 fc cmp -0x4(%ebp),%eax
73a: 76 d4 jbe 710 <free+0x19>
73c: 8b 45 fc mov -0x4(%ebp),%eax
73f: 8b 00 mov (%eax),%eax
741: 3b 45 f8 cmp -0x8(%ebp),%eax
744: 76 ca jbe 710 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
746: 8b 45 f8 mov -0x8(%ebp),%eax
749: 8b 40 04 mov 0x4(%eax),%eax
74c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
753: 8b 45 f8 mov -0x8(%ebp),%eax
756: 01 c2 add %eax,%edx
758: 8b 45 fc mov -0x4(%ebp),%eax
75b: 8b 00 mov (%eax),%eax
75d: 39 c2 cmp %eax,%edx
75f: 75 24 jne 785 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
761: 8b 45 f8 mov -0x8(%ebp),%eax
764: 8b 50 04 mov 0x4(%eax),%edx
767: 8b 45 fc mov -0x4(%ebp),%eax
76a: 8b 00 mov (%eax),%eax
76c: 8b 40 04 mov 0x4(%eax),%eax
76f: 01 c2 add %eax,%edx
771: 8b 45 f8 mov -0x8(%ebp),%eax
774: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
777: 8b 45 fc mov -0x4(%ebp),%eax
77a: 8b 00 mov (%eax),%eax
77c: 8b 10 mov (%eax),%edx
77e: 8b 45 f8 mov -0x8(%ebp),%eax
781: 89 10 mov %edx,(%eax)
783: eb 0a jmp 78f <free+0x98>
} else
bp->s.ptr = p->s.ptr;
785: 8b 45 fc mov -0x4(%ebp),%eax
788: 8b 10 mov (%eax),%edx
78a: 8b 45 f8 mov -0x8(%ebp),%eax
78d: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
78f: 8b 45 fc mov -0x4(%ebp),%eax
792: 8b 40 04 mov 0x4(%eax),%eax
795: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
79c: 8b 45 fc mov -0x4(%ebp),%eax
79f: 01 d0 add %edx,%eax
7a1: 3b 45 f8 cmp -0x8(%ebp),%eax
7a4: 75 20 jne 7c6 <free+0xcf>
p->s.size += bp->s.size;
7a6: 8b 45 fc mov -0x4(%ebp),%eax
7a9: 8b 50 04 mov 0x4(%eax),%edx
7ac: 8b 45 f8 mov -0x8(%ebp),%eax
7af: 8b 40 04 mov 0x4(%eax),%eax
7b2: 01 c2 add %eax,%edx
7b4: 8b 45 fc mov -0x4(%ebp),%eax
7b7: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
7ba: 8b 45 f8 mov -0x8(%ebp),%eax
7bd: 8b 10 mov (%eax),%edx
7bf: 8b 45 fc mov -0x4(%ebp),%eax
7c2: 89 10 mov %edx,(%eax)
7c4: eb 08 jmp 7ce <free+0xd7>
} else
p->s.ptr = bp;
7c6: 8b 45 fc mov -0x4(%ebp),%eax
7c9: 8b 55 f8 mov -0x8(%ebp),%edx
7cc: 89 10 mov %edx,(%eax)
freep = p;
7ce: 8b 45 fc mov -0x4(%ebp),%eax
7d1: a3 b4 0b 00 00 mov %eax,0xbb4
}
7d6: 90 nop
7d7: c9 leave
7d8: c3 ret
000007d9 <morecore>:
static Header*
morecore(uint nu)
{
7d9: 55 push %ebp
7da: 89 e5 mov %esp,%ebp
7dc: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
7df: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
7e6: 77 07 ja 7ef <morecore+0x16>
nu = 4096;
7e8: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
7ef: 8b 45 08 mov 0x8(%ebp),%eax
7f2: c1 e0 03 shl $0x3,%eax
7f5: 83 ec 0c sub $0xc,%esp
7f8: 50 push %eax
7f9: e8 19 fc ff ff call 417 <sbrk>
7fe: 83 c4 10 add $0x10,%esp
801: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
804: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
808: 75 07 jne 811 <morecore+0x38>
return 0;
80a: b8 00 00 00 00 mov $0x0,%eax
80f: eb 26 jmp 837 <morecore+0x5e>
hp = (Header*)p;
811: 8b 45 f4 mov -0xc(%ebp),%eax
814: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
817: 8b 45 f0 mov -0x10(%ebp),%eax
81a: 8b 55 08 mov 0x8(%ebp),%edx
81d: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
820: 8b 45 f0 mov -0x10(%ebp),%eax
823: 83 c0 08 add $0x8,%eax
826: 83 ec 0c sub $0xc,%esp
829: 50 push %eax
82a: e8 c8 fe ff ff call 6f7 <free>
82f: 83 c4 10 add $0x10,%esp
return freep;
832: a1 b4 0b 00 00 mov 0xbb4,%eax
}
837: c9 leave
838: c3 ret
00000839 <malloc>:
void*
malloc(uint nbytes)
{
839: 55 push %ebp
83a: 89 e5 mov %esp,%ebp
83c: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
83f: 8b 45 08 mov 0x8(%ebp),%eax
842: 83 c0 07 add $0x7,%eax
845: c1 e8 03 shr $0x3,%eax
848: 83 c0 01 add $0x1,%eax
84b: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
84e: a1 b4 0b 00 00 mov 0xbb4,%eax
853: 89 45 f0 mov %eax,-0x10(%ebp)
856: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
85a: 75 23 jne 87f <malloc+0x46>
base.s.ptr = freep = prevp = &base;
85c: c7 45 f0 ac 0b 00 00 movl $0xbac,-0x10(%ebp)
863: 8b 45 f0 mov -0x10(%ebp),%eax
866: a3 b4 0b 00 00 mov %eax,0xbb4
86b: a1 b4 0b 00 00 mov 0xbb4,%eax
870: a3 ac 0b 00 00 mov %eax,0xbac
base.s.size = 0;
875: c7 05 b0 0b 00 00 00 movl $0x0,0xbb0
87c: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
87f: 8b 45 f0 mov -0x10(%ebp),%eax
882: 8b 00 mov (%eax),%eax
884: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
887: 8b 45 f4 mov -0xc(%ebp),%eax
88a: 8b 40 04 mov 0x4(%eax),%eax
88d: 3b 45 ec cmp -0x14(%ebp),%eax
890: 72 4d jb 8df <malloc+0xa6>
if(p->s.size == nunits)
892: 8b 45 f4 mov -0xc(%ebp),%eax
895: 8b 40 04 mov 0x4(%eax),%eax
898: 3b 45 ec cmp -0x14(%ebp),%eax
89b: 75 0c jne 8a9 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
89d: 8b 45 f4 mov -0xc(%ebp),%eax
8a0: 8b 10 mov (%eax),%edx
8a2: 8b 45 f0 mov -0x10(%ebp),%eax
8a5: 89 10 mov %edx,(%eax)
8a7: eb 26 jmp 8cf <malloc+0x96>
else {
p->s.size -= nunits;
8a9: 8b 45 f4 mov -0xc(%ebp),%eax
8ac: 8b 40 04 mov 0x4(%eax),%eax
8af: 2b 45 ec sub -0x14(%ebp),%eax
8b2: 89 c2 mov %eax,%edx
8b4: 8b 45 f4 mov -0xc(%ebp),%eax
8b7: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
8ba: 8b 45 f4 mov -0xc(%ebp),%eax
8bd: 8b 40 04 mov 0x4(%eax),%eax
8c0: c1 e0 03 shl $0x3,%eax
8c3: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
8c6: 8b 45 f4 mov -0xc(%ebp),%eax
8c9: 8b 55 ec mov -0x14(%ebp),%edx
8cc: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
8cf: 8b 45 f0 mov -0x10(%ebp),%eax
8d2: a3 b4 0b 00 00 mov %eax,0xbb4
return (void*)(p + 1);
8d7: 8b 45 f4 mov -0xc(%ebp),%eax
8da: 83 c0 08 add $0x8,%eax
8dd: eb 3b jmp 91a <malloc+0xe1>
}
if(p == freep)
8df: a1 b4 0b 00 00 mov 0xbb4,%eax
8e4: 39 45 f4 cmp %eax,-0xc(%ebp)
8e7: 75 1e jne 907 <malloc+0xce>
if((p = morecore(nunits)) == 0)
8e9: 83 ec 0c sub $0xc,%esp
8ec: ff 75 ec pushl -0x14(%ebp)
8ef: e8 e5 fe ff ff call 7d9 <morecore>
8f4: 83 c4 10 add $0x10,%esp
8f7: 89 45 f4 mov %eax,-0xc(%ebp)
8fa: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8fe: 75 07 jne 907 <malloc+0xce>
return 0;
900: b8 00 00 00 00 mov $0x0,%eax
905: eb 13 jmp 91a <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
907: 8b 45 f4 mov -0xc(%ebp),%eax
90a: 89 45 f0 mov %eax,-0x10(%ebp)
90d: 8b 45 f4 mov -0xc(%ebp),%eax
910: 8b 00 mov (%eax),%eax
912: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
915: e9 6d ff ff ff jmp 887 <malloc+0x4e>
}
91a: c9 leave
91b: c3 ret
|
src/c-tests/_repcmp.asm
|
jwse2/MijnOS
| 0 |
95305
|
<filename>src/c-tests/_repcmp.asm
; MASM x86
.MODEL FLAT,C
.CONST
.CODE
public repcmp
repcmp:
push ebp
mov ebp,esp
sub esp,4
push edi
push esi
mov esi,dword ptr [ebp+0Ch]
mov edi,dword ptr [ebp+10h]
mov ecx,dword ptr [ebp+8]
xor eax,eax
repe cmpsb
setne al
return:
pop esi
pop edi
mov esp,ebp
pop ebp
ret
END
|
complete-elaboration.agda
|
hazelgrove/hazelnut-dynamics-agda
| 16 |
8620
|
<reponame>hazelgrove/hazelnut-dynamics-agda
open import Nat
open import Prelude
open import core
open import contexts
open import typed-elaboration
open import lemmas-gcomplete
open import lemmas-complete
module complete-elaboration where
mutual
complete-elaboration-synth : ∀{e τ Γ Δ d} →
Γ gcomplete →
e ecomplete →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
(d dcomplete × τ tcomplete × Δ == ∅)
complete-elaboration-synth gc ec ESConst = DCConst , TCBase , refl
complete-elaboration-synth gc ec (ESVar x₁) = DCVar , gc _ _ x₁ , refl
complete-elaboration-synth gc (ECLam2 ec x₁) (ESLam x₂ exp)
with complete-elaboration-synth (gcomp-extend gc x₁ x₂) ec exp
... | ih1 , ih2 , ih3 = DCLam ih1 x₁ , TCArr x₁ ih2 , ih3
complete-elaboration-synth gc (ECAp ec ec₁) (ESAp _ _ x MAHole x₂ x₃)
with comp-synth gc ec x
... | ()
complete-elaboration-synth gc (ECAp ec ec₁) (ESAp {Δ1 = Δ1} {Δ2 = Δ2} _ _ x MAArr x₂ x₃)
with comp-synth gc ec x
... | TCArr t1 t2
with complete-elaboration-ana gc ec (TCArr t1 t2) x₂ | complete-elaboration-ana gc ec₁ t1 x₃
... | ih1 , _ , ih4 | ih2 , _ , ih3 = DCAp (DCCast ih1 (comp-ana gc x₂ ih1) (TCArr t1 t2)) (DCCast ih2 (comp-ana gc x₃ ih2) t1) ,
t2 ,
tr (λ qq → (qq ∪ Δ2) == ∅) (! ih4) (tr (λ qq → (∅ ∪ qq) == ∅) (! ih3) refl)
complete-elaboration-synth gc () ESEHole
complete-elaboration-synth gc () (ESNEHole _ exp)
complete-elaboration-synth gc (ECAsc x ec) (ESAsc x₁)
with complete-elaboration-ana gc ec x x₁
... | ih1 , _ , ih2 = DCCast ih1 (comp-ana gc x₁ ih1) x , x , ih2
complete-elaboration-ana : ∀{e τ τ' Γ Δ d} →
Γ gcomplete →
e ecomplete →
τ tcomplete →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
(d dcomplete × τ' tcomplete × Δ == ∅)
complete-elaboration-ana gc (ECLam1 ec) () (EALam x₁ MAHole exp)
complete-elaboration-ana gc (ECLam1 ec) (TCArr t1 t2) (EALam x₁ MAArr exp)
with complete-elaboration-ana (gcomp-extend gc t1 x₁) ec t2 exp
... | ih , ih3 , ih2 = DCLam ih t1 , TCArr t1 ih3 , ih2
complete-elaboration-ana gc ec tc (EASubsume x x₁ x₂ x₃)
with complete-elaboration-synth gc ec x₂
... | ih1 , ih2 , ih3 = ih1 , ih2 , ih3
-- this is just a convenience since it shows up a few times above
comp-ana : ∀{Γ e τ d τ' Δ} →
Γ gcomplete →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
d dcomplete →
τ' tcomplete
comp-ana gc ex dc = complete-ta gc (π2 (typed-elaboration-ana ex)) dc
|
programs/oeis/283/A283971.asm
|
karttu/loda
| 1 |
90272
|
; A283971: a(n) = n except a(4*n + 2) = 2*n + 1.
; 0,1,1,3,4,5,3,7,8,9,5,11,12,13,7,15,16,17,9,19,20,21,11,23,24,25,13,27,28,29,15,31,32,33,17,35,36,37,19,39,40,41,21,43,44,45,23,47,48,49,25,51,52,53,27,55,56,57,29,59,60,61,31,63,64,65,33,67,68,69,35,71,72,73,37,75,76,77,39,79,80,81,41,83,84,85,43,87,88,89,45,91,92,93,47,95,96,97,49,99,100,101,51,103,104,105,53,107,108,109,55,111,112,113,57,115,116,117,59,119,120,121,61,123,124,125,63,127,128,129,65,131,132,133,67,135,136,137,69,139,140,141,71,143,144,145,73,147,148,149,75,151,152,153,77,155,156,157,79,159,160,161,81,163,164,165,83,167,168,169,85,171,172,173,87,175,176,177,89,179,180,181,91,183,184,185,93,187,188,189,95,191,192,193,97,195,196,197,99,199,200,201,101,203,204,205,103,207,208,209,105,211,212,213,107,215,216,217,109,219,220,221,111,223,224,225,113,227,228,229,115,231,232,233,117,235,236,237,119,239,240,241,121,243,244,245,123,247,248,249
mov $1,$0
pow $0,2
div $0,4
gcd $0,2
mul $1,$0
div $1,2
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-stobbu.adb
|
djamal2727/Main-Bearing-Analytical-Model
| 0 |
30174
|
<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.TEXT_OUTPUT.BIT_BUCKETS --
-- --
-- B o d y --
-- --
-- Copyright (C) 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. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.Text_Output.Bit_Buckets is
type Bit_Bucket_Type is new Sink with null record;
overriding procedure Full_Method (S : in out Bit_Bucket_Type);
overriding procedure Flush_Method (S : in out Bit_Bucket_Type);
The_Bit_Bucket : aliased Bit_Bucket_Type
(Chunk_Length => Default_Chunk_Length);
function Bit_Bucket return Sink_Access is (The_Bit_Bucket'Access);
overriding procedure Full_Method (S : in out Bit_Bucket_Type)
renames Flush_Method;
overriding procedure Flush_Method (S : in out Bit_Bucket_Type) is
begin
S.Last := 0;
end Flush_Method;
begin
The_Bit_Bucket.Indent_Amount := 0;
The_Bit_Bucket.Cur_Chunk := The_Bit_Bucket.Initial_Chunk'Access;
end Ada.Strings.Text_Output.Bit_Buckets;
|
ln.asm
|
KaushikKPDARE/xv6-Clone-System-Call
| 0 |
5051
|
_ln: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 10 sub $0x10,%esp
if(argc != 3){
9: 83 7d 08 03 cmpl $0x3,0x8(%ebp)
d: 74 19 je 28 <main+0x28>
printf(2, "Usage: ln old new\n");
f: c7 44 24 04 ea 08 00 movl $0x8ea,0x4(%esp)
16: 00
17: c7 04 24 02 00 00 00 movl $0x2,(%esp)
1e: e8 51 04 00 00 call 474 <printf>
exit();
23: e8 bc 02 00 00 call 2e4 <exit>
}
if(link(argv[1], argv[2]) < 0)
28: 8b 45 0c mov 0xc(%ebp),%eax
2b: 83 c0 08 add $0x8,%eax
2e: 8b 10 mov (%eax),%edx
30: 8b 45 0c mov 0xc(%ebp),%eax
33: 83 c0 04 add $0x4,%eax
36: 8b 00 mov (%eax),%eax
38: 89 54 24 04 mov %edx,0x4(%esp)
3c: 89 04 24 mov %eax,(%esp)
3f: e8 00 03 00 00 call 344 <link>
44: 85 c0 test %eax,%eax
46: 79 2c jns 74 <main+0x74>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
48: 8b 45 0c mov 0xc(%ebp),%eax
4b: 83 c0 08 add $0x8,%eax
4e: 8b 10 mov (%eax),%edx
50: 8b 45 0c mov 0xc(%ebp),%eax
53: 83 c0 04 add $0x4,%eax
56: 8b 00 mov (%eax),%eax
58: 89 54 24 0c mov %edx,0xc(%esp)
5c: 89 44 24 08 mov %eax,0x8(%esp)
60: c7 44 24 04 fd 08 00 movl $0x8fd,0x4(%esp)
67: 00
68: c7 04 24 02 00 00 00 movl $0x2,(%esp)
6f: e8 00 04 00 00 call 474 <printf>
exit();
74: e8 6b 02 00 00 call 2e4 <exit>
79: 66 90 xchg %ax,%ax
7b: 90 nop
0000007c <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
7c: 55 push %ebp
7d: 89 e5 mov %esp,%ebp
7f: 57 push %edi
80: 53 push %ebx
asm volatile("cld; rep stosb" :
81: 8b 4d 08 mov 0x8(%ebp),%ecx
84: 8b 55 10 mov 0x10(%ebp),%edx
87: 8b 45 0c mov 0xc(%ebp),%eax
8a: 89 cb mov %ecx,%ebx
8c: 89 df mov %ebx,%edi
8e: 89 d1 mov %edx,%ecx
90: fc cld
91: f3 aa rep stos %al,%es:(%edi)
93: 89 ca mov %ecx,%edx
95: 89 fb mov %edi,%ebx
97: 89 5d 08 mov %ebx,0x8(%ebp)
9a: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
9d: 5b pop %ebx
9e: 5f pop %edi
9f: 5d pop %ebp
a0: c3 ret
000000a1 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
a1: 55 push %ebp
a2: 89 e5 mov %esp,%ebp
a4: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
a7: 8b 45 08 mov 0x8(%ebp),%eax
aa: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
ad: 90 nop
ae: 8b 45 08 mov 0x8(%ebp),%eax
b1: 8d 50 01 lea 0x1(%eax),%edx
b4: 89 55 08 mov %edx,0x8(%ebp)
b7: 8b 55 0c mov 0xc(%ebp),%edx
ba: 8d 4a 01 lea 0x1(%edx),%ecx
bd: 89 4d 0c mov %ecx,0xc(%ebp)
c0: 0f b6 12 movzbl (%edx),%edx
c3: 88 10 mov %dl,(%eax)
c5: 0f b6 00 movzbl (%eax),%eax
c8: 84 c0 test %al,%al
ca: 75 e2 jne ae <strcpy+0xd>
;
return os;
cc: 8b 45 fc mov -0x4(%ebp),%eax
}
cf: c9 leave
d0: c3 ret
000000d1 <strcmp>:
int
strcmp(const char *p, const char *q)
{
d1: 55 push %ebp
d2: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
d4: eb 08 jmp de <strcmp+0xd>
p++, q++;
d6: 83 45 08 01 addl $0x1,0x8(%ebp)
da: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
de: 8b 45 08 mov 0x8(%ebp),%eax
e1: 0f b6 00 movzbl (%eax),%eax
e4: 84 c0 test %al,%al
e6: 74 10 je f8 <strcmp+0x27>
e8: 8b 45 08 mov 0x8(%ebp),%eax
eb: 0f b6 10 movzbl (%eax),%edx
ee: 8b 45 0c mov 0xc(%ebp),%eax
f1: 0f b6 00 movzbl (%eax),%eax
f4: 38 c2 cmp %al,%dl
f6: 74 de je d6 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
f8: 8b 45 08 mov 0x8(%ebp),%eax
fb: 0f b6 00 movzbl (%eax),%eax
fe: 0f b6 d0 movzbl %al,%edx
101: 8b 45 0c mov 0xc(%ebp),%eax
104: 0f b6 00 movzbl (%eax),%eax
107: 0f b6 c0 movzbl %al,%eax
10a: 29 c2 sub %eax,%edx
10c: 89 d0 mov %edx,%eax
}
10e: 5d pop %ebp
10f: c3 ret
00000110 <strlen>:
uint
strlen(char *s)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
116: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
11d: eb 04 jmp 123 <strlen+0x13>
11f: 83 45 fc 01 addl $0x1,-0x4(%ebp)
123: 8b 55 fc mov -0x4(%ebp),%edx
126: 8b 45 08 mov 0x8(%ebp),%eax
129: 01 d0 add %edx,%eax
12b: 0f b6 00 movzbl (%eax),%eax
12e: 84 c0 test %al,%al
130: 75 ed jne 11f <strlen+0xf>
;
return n;
132: 8b 45 fc mov -0x4(%ebp),%eax
}
135: c9 leave
136: c3 ret
00000137 <memset>:
void*
memset(void *dst, int c, uint n)
{
137: 55 push %ebp
138: 89 e5 mov %esp,%ebp
13a: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
13d: 8b 45 10 mov 0x10(%ebp),%eax
140: 89 44 24 08 mov %eax,0x8(%esp)
144: 8b 45 0c mov 0xc(%ebp),%eax
147: 89 44 24 04 mov %eax,0x4(%esp)
14b: 8b 45 08 mov 0x8(%ebp),%eax
14e: 89 04 24 mov %eax,(%esp)
151: e8 26 ff ff ff call 7c <stosb>
return dst;
156: 8b 45 08 mov 0x8(%ebp),%eax
}
159: c9 leave
15a: c3 ret
0000015b <strchr>:
char*
strchr(const char *s, char c)
{
15b: 55 push %ebp
15c: 89 e5 mov %esp,%ebp
15e: 83 ec 04 sub $0x4,%esp
161: 8b 45 0c mov 0xc(%ebp),%eax
164: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
167: eb 14 jmp 17d <strchr+0x22>
if(*s == c)
169: 8b 45 08 mov 0x8(%ebp),%eax
16c: 0f b6 00 movzbl (%eax),%eax
16f: 3a 45 fc cmp -0x4(%ebp),%al
172: 75 05 jne 179 <strchr+0x1e>
return (char*)s;
174: 8b 45 08 mov 0x8(%ebp),%eax
177: eb 13 jmp 18c <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
179: 83 45 08 01 addl $0x1,0x8(%ebp)
17d: 8b 45 08 mov 0x8(%ebp),%eax
180: 0f b6 00 movzbl (%eax),%eax
183: 84 c0 test %al,%al
185: 75 e2 jne 169 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
187: b8 00 00 00 00 mov $0x0,%eax
}
18c: c9 leave
18d: c3 ret
0000018e <gets>:
char*
gets(char *buf, int max)
{
18e: 55 push %ebp
18f: 89 e5 mov %esp,%ebp
191: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
194: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
19b: eb 4c jmp 1e9 <gets+0x5b>
cc = read(0, &c, 1);
19d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1a4: 00
1a5: 8d 45 ef lea -0x11(%ebp),%eax
1a8: 89 44 24 04 mov %eax,0x4(%esp)
1ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1b3: e8 44 01 00 00 call 2fc <read>
1b8: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1bb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1bf: 7f 02 jg 1c3 <gets+0x35>
break;
1c1: eb 31 jmp 1f4 <gets+0x66>
buf[i++] = c;
1c3: 8b 45 f4 mov -0xc(%ebp),%eax
1c6: 8d 50 01 lea 0x1(%eax),%edx
1c9: 89 55 f4 mov %edx,-0xc(%ebp)
1cc: 89 c2 mov %eax,%edx
1ce: 8b 45 08 mov 0x8(%ebp),%eax
1d1: 01 c2 add %eax,%edx
1d3: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1d7: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1d9: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1dd: 3c 0a cmp $0xa,%al
1df: 74 13 je 1f4 <gets+0x66>
1e1: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1e5: 3c 0d cmp $0xd,%al
1e7: 74 0b je 1f4 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1e9: 8b 45 f4 mov -0xc(%ebp),%eax
1ec: 83 c0 01 add $0x1,%eax
1ef: 3b 45 0c cmp 0xc(%ebp),%eax
1f2: 7c a9 jl 19d <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1f4: 8b 55 f4 mov -0xc(%ebp),%edx
1f7: 8b 45 08 mov 0x8(%ebp),%eax
1fa: 01 d0 add %edx,%eax
1fc: c6 00 00 movb $0x0,(%eax)
return buf;
1ff: 8b 45 08 mov 0x8(%ebp),%eax
}
202: c9 leave
203: c3 ret
00000204 <stat>:
int
stat(char *n, struct stat *st)
{
204: 55 push %ebp
205: 89 e5 mov %esp,%ebp
207: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
20a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
211: 00
212: 8b 45 08 mov 0x8(%ebp),%eax
215: 89 04 24 mov %eax,(%esp)
218: e8 07 01 00 00 call 324 <open>
21d: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
220: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
224: 79 07 jns 22d <stat+0x29>
return -1;
226: b8 ff ff ff ff mov $0xffffffff,%eax
22b: eb 23 jmp 250 <stat+0x4c>
r = fstat(fd, st);
22d: 8b 45 0c mov 0xc(%ebp),%eax
230: 89 44 24 04 mov %eax,0x4(%esp)
234: 8b 45 f4 mov -0xc(%ebp),%eax
237: 89 04 24 mov %eax,(%esp)
23a: e8 fd 00 00 00 call 33c <fstat>
23f: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
242: 8b 45 f4 mov -0xc(%ebp),%eax
245: 89 04 24 mov %eax,(%esp)
248: e8 bf 00 00 00 call 30c <close>
return r;
24d: 8b 45 f0 mov -0x10(%ebp),%eax
}
250: c9 leave
251: c3 ret
00000252 <atoi>:
int
atoi(const char *s)
{
252: 55 push %ebp
253: 89 e5 mov %esp,%ebp
255: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
258: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
25f: eb 25 jmp 286 <atoi+0x34>
n = n*10 + *s++ - '0';
261: 8b 55 fc mov -0x4(%ebp),%edx
264: 89 d0 mov %edx,%eax
266: c1 e0 02 shl $0x2,%eax
269: 01 d0 add %edx,%eax
26b: 01 c0 add %eax,%eax
26d: 89 c1 mov %eax,%ecx
26f: 8b 45 08 mov 0x8(%ebp),%eax
272: 8d 50 01 lea 0x1(%eax),%edx
275: 89 55 08 mov %edx,0x8(%ebp)
278: 0f b6 00 movzbl (%eax),%eax
27b: 0f be c0 movsbl %al,%eax
27e: 01 c8 add %ecx,%eax
280: 83 e8 30 sub $0x30,%eax
283: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
286: 8b 45 08 mov 0x8(%ebp),%eax
289: 0f b6 00 movzbl (%eax),%eax
28c: 3c 2f cmp $0x2f,%al
28e: 7e 0a jle 29a <atoi+0x48>
290: 8b 45 08 mov 0x8(%ebp),%eax
293: 0f b6 00 movzbl (%eax),%eax
296: 3c 39 cmp $0x39,%al
298: 7e c7 jle 261 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
29a: 8b 45 fc mov -0x4(%ebp),%eax
}
29d: c9 leave
29e: c3 ret
0000029f <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
29f: 55 push %ebp
2a0: 89 e5 mov %esp,%ebp
2a2: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
2a5: 8b 45 08 mov 0x8(%ebp),%eax
2a8: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
2ab: 8b 45 0c mov 0xc(%ebp),%eax
2ae: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
2b1: eb 17 jmp 2ca <memmove+0x2b>
*dst++ = *src++;
2b3: 8b 45 fc mov -0x4(%ebp),%eax
2b6: 8d 50 01 lea 0x1(%eax),%edx
2b9: 89 55 fc mov %edx,-0x4(%ebp)
2bc: 8b 55 f8 mov -0x8(%ebp),%edx
2bf: 8d 4a 01 lea 0x1(%edx),%ecx
2c2: 89 4d f8 mov %ecx,-0x8(%ebp)
2c5: 0f b6 12 movzbl (%edx),%edx
2c8: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ca: 8b 45 10 mov 0x10(%ebp),%eax
2cd: 8d 50 ff lea -0x1(%eax),%edx
2d0: 89 55 10 mov %edx,0x10(%ebp)
2d3: 85 c0 test %eax,%eax
2d5: 7f dc jg 2b3 <memmove+0x14>
*dst++ = *src++;
return vdst;
2d7: 8b 45 08 mov 0x8(%ebp),%eax
}
2da: c9 leave
2db: c3 ret
000002dc <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2dc: b8 01 00 00 00 mov $0x1,%eax
2e1: cd 40 int $0x40
2e3: c3 ret
000002e4 <exit>:
SYSCALL(exit)
2e4: b8 02 00 00 00 mov $0x2,%eax
2e9: cd 40 int $0x40
2eb: c3 ret
000002ec <wait>:
SYSCALL(wait)
2ec: b8 03 00 00 00 mov $0x3,%eax
2f1: cd 40 int $0x40
2f3: c3 ret
000002f4 <pipe>:
SYSCALL(pipe)
2f4: b8 04 00 00 00 mov $0x4,%eax
2f9: cd 40 int $0x40
2fb: c3 ret
000002fc <read>:
SYSCALL(read)
2fc: b8 05 00 00 00 mov $0x5,%eax
301: cd 40 int $0x40
303: c3 ret
00000304 <write>:
SYSCALL(write)
304: b8 10 00 00 00 mov $0x10,%eax
309: cd 40 int $0x40
30b: c3 ret
0000030c <close>:
SYSCALL(close)
30c: b8 15 00 00 00 mov $0x15,%eax
311: cd 40 int $0x40
313: c3 ret
00000314 <kill>:
SYSCALL(kill)
314: b8 06 00 00 00 mov $0x6,%eax
319: cd 40 int $0x40
31b: c3 ret
0000031c <exec>:
SYSCALL(exec)
31c: b8 07 00 00 00 mov $0x7,%eax
321: cd 40 int $0x40
323: c3 ret
00000324 <open>:
SYSCALL(open)
324: b8 0f 00 00 00 mov $0xf,%eax
329: cd 40 int $0x40
32b: c3 ret
0000032c <mknod>:
SYSCALL(mknod)
32c: b8 11 00 00 00 mov $0x11,%eax
331: cd 40 int $0x40
333: c3 ret
00000334 <unlink>:
SYSCALL(unlink)
334: b8 12 00 00 00 mov $0x12,%eax
339: cd 40 int $0x40
33b: c3 ret
0000033c <fstat>:
SYSCALL(fstat)
33c: b8 08 00 00 00 mov $0x8,%eax
341: cd 40 int $0x40
343: c3 ret
00000344 <link>:
SYSCALL(link)
344: b8 13 00 00 00 mov $0x13,%eax
349: cd 40 int $0x40
34b: c3 ret
0000034c <mkdir>:
SYSCALL(mkdir)
34c: b8 14 00 00 00 mov $0x14,%eax
351: cd 40 int $0x40
353: c3 ret
00000354 <chdir>:
SYSCALL(chdir)
354: b8 09 00 00 00 mov $0x9,%eax
359: cd 40 int $0x40
35b: c3 ret
0000035c <dup>:
SYSCALL(dup)
35c: b8 0a 00 00 00 mov $0xa,%eax
361: cd 40 int $0x40
363: c3 ret
00000364 <getpid>:
SYSCALL(getpid)
364: b8 0b 00 00 00 mov $0xb,%eax
369: cd 40 int $0x40
36b: c3 ret
0000036c <sbrk>:
SYSCALL(sbrk)
36c: b8 0c 00 00 00 mov $0xc,%eax
371: cd 40 int $0x40
373: c3 ret
00000374 <sleep>:
SYSCALL(sleep)
374: b8 0d 00 00 00 mov $0xd,%eax
379: cd 40 int $0x40
37b: c3 ret
0000037c <uptime>:
SYSCALL(uptime)
37c: b8 0e 00 00 00 mov $0xe,%eax
381: cd 40 int $0x40
383: c3 ret
00000384 <clone>:
SYSCALL(clone)
384: b8 16 00 00 00 mov $0x16,%eax
389: cd 40 int $0x40
38b: c3 ret
0000038c <join>:
38c: b8 17 00 00 00 mov $0x17,%eax
391: cd 40 int $0x40
393: c3 ret
00000394 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
394: 55 push %ebp
395: 89 e5 mov %esp,%ebp
397: 83 ec 18 sub $0x18,%esp
39a: 8b 45 0c mov 0xc(%ebp),%eax
39d: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
3a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3a7: 00
3a8: 8d 45 f4 lea -0xc(%ebp),%eax
3ab: 89 44 24 04 mov %eax,0x4(%esp)
3af: 8b 45 08 mov 0x8(%ebp),%eax
3b2: 89 04 24 mov %eax,(%esp)
3b5: e8 4a ff ff ff call 304 <write>
}
3ba: c9 leave
3bb: c3 ret
000003bc <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3bc: 55 push %ebp
3bd: 89 e5 mov %esp,%ebp
3bf: 56 push %esi
3c0: 53 push %ebx
3c1: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3c4: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
3cb: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3cf: 74 17 je 3e8 <printint+0x2c>
3d1: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3d5: 79 11 jns 3e8 <printint+0x2c>
neg = 1;
3d7: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3de: 8b 45 0c mov 0xc(%ebp),%eax
3e1: f7 d8 neg %eax
3e3: 89 45 ec mov %eax,-0x14(%ebp)
3e6: eb 06 jmp 3ee <printint+0x32>
} else {
x = xx;
3e8: 8b 45 0c mov 0xc(%ebp),%eax
3eb: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3ee: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3f5: 8b 4d f4 mov -0xc(%ebp),%ecx
3f8: 8d 41 01 lea 0x1(%ecx),%eax
3fb: 89 45 f4 mov %eax,-0xc(%ebp)
3fe: 8b 5d 10 mov 0x10(%ebp),%ebx
401: 8b 45 ec mov -0x14(%ebp),%eax
404: ba 00 00 00 00 mov $0x0,%edx
409: f7 f3 div %ebx
40b: 89 d0 mov %edx,%eax
40d: 0f b6 80 1c 0c 00 00 movzbl 0xc1c(%eax),%eax
414: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
418: 8b 75 10 mov 0x10(%ebp),%esi
41b: 8b 45 ec mov -0x14(%ebp),%eax
41e: ba 00 00 00 00 mov $0x0,%edx
423: f7 f6 div %esi
425: 89 45 ec mov %eax,-0x14(%ebp)
428: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
42c: 75 c7 jne 3f5 <printint+0x39>
if(neg)
42e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
432: 74 10 je 444 <printint+0x88>
buf[i++] = '-';
434: 8b 45 f4 mov -0xc(%ebp),%eax
437: 8d 50 01 lea 0x1(%eax),%edx
43a: 89 55 f4 mov %edx,-0xc(%ebp)
43d: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
442: eb 1f jmp 463 <printint+0xa7>
444: eb 1d jmp 463 <printint+0xa7>
putc(fd, buf[i]);
446: 8d 55 dc lea -0x24(%ebp),%edx
449: 8b 45 f4 mov -0xc(%ebp),%eax
44c: 01 d0 add %edx,%eax
44e: 0f b6 00 movzbl (%eax),%eax
451: 0f be c0 movsbl %al,%eax
454: 89 44 24 04 mov %eax,0x4(%esp)
458: 8b 45 08 mov 0x8(%ebp),%eax
45b: 89 04 24 mov %eax,(%esp)
45e: e8 31 ff ff ff call 394 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
463: 83 6d f4 01 subl $0x1,-0xc(%ebp)
467: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
46b: 79 d9 jns 446 <printint+0x8a>
putc(fd, buf[i]);
}
46d: 83 c4 30 add $0x30,%esp
470: 5b pop %ebx
471: 5e pop %esi
472: 5d pop %ebp
473: c3 ret
00000474 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
474: 55 push %ebp
475: 89 e5 mov %esp,%ebp
477: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
47a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
481: 8d 45 0c lea 0xc(%ebp),%eax
484: 83 c0 04 add $0x4,%eax
487: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
48a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
491: e9 7c 01 00 00 jmp 612 <printf+0x19e>
c = fmt[i] & 0xff;
496: 8b 55 0c mov 0xc(%ebp),%edx
499: 8b 45 f0 mov -0x10(%ebp),%eax
49c: 01 d0 add %edx,%eax
49e: 0f b6 00 movzbl (%eax),%eax
4a1: 0f be c0 movsbl %al,%eax
4a4: 25 ff 00 00 00 and $0xff,%eax
4a9: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
4ac: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4b0: 75 2c jne 4de <printf+0x6a>
if(c == '%'){
4b2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
4b6: 75 0c jne 4c4 <printf+0x50>
state = '%';
4b8: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
4bf: e9 4a 01 00 00 jmp 60e <printf+0x19a>
} else {
putc(fd, c);
4c4: 8b 45 e4 mov -0x1c(%ebp),%eax
4c7: 0f be c0 movsbl %al,%eax
4ca: 89 44 24 04 mov %eax,0x4(%esp)
4ce: 8b 45 08 mov 0x8(%ebp),%eax
4d1: 89 04 24 mov %eax,(%esp)
4d4: e8 bb fe ff ff call 394 <putc>
4d9: e9 30 01 00 00 jmp 60e <printf+0x19a>
}
} else if(state == '%'){
4de: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4e2: 0f 85 26 01 00 00 jne 60e <printf+0x19a>
if(c == 'd'){
4e8: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4ec: 75 2d jne 51b <printf+0xa7>
printint(fd, *ap, 10, 1);
4ee: 8b 45 e8 mov -0x18(%ebp),%eax
4f1: 8b 00 mov (%eax),%eax
4f3: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
4fa: 00
4fb: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
502: 00
503: 89 44 24 04 mov %eax,0x4(%esp)
507: 8b 45 08 mov 0x8(%ebp),%eax
50a: 89 04 24 mov %eax,(%esp)
50d: e8 aa fe ff ff call 3bc <printint>
ap++;
512: 83 45 e8 04 addl $0x4,-0x18(%ebp)
516: e9 ec 00 00 00 jmp 607 <printf+0x193>
} else if(c == 'x' || c == 'p'){
51b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
51f: 74 06 je 527 <printf+0xb3>
521: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
525: 75 2d jne 554 <printf+0xe0>
printint(fd, *ap, 16, 0);
527: 8b 45 e8 mov -0x18(%ebp),%eax
52a: 8b 00 mov (%eax),%eax
52c: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
533: 00
534: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
53b: 00
53c: 89 44 24 04 mov %eax,0x4(%esp)
540: 8b 45 08 mov 0x8(%ebp),%eax
543: 89 04 24 mov %eax,(%esp)
546: e8 71 fe ff ff call 3bc <printint>
ap++;
54b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
54f: e9 b3 00 00 00 jmp 607 <printf+0x193>
} else if(c == 's'){
554: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
558: 75 45 jne 59f <printf+0x12b>
s = (char*)*ap;
55a: 8b 45 e8 mov -0x18(%ebp),%eax
55d: 8b 00 mov (%eax),%eax
55f: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
562: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
566: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
56a: 75 09 jne 575 <printf+0x101>
s = "(null)";
56c: c7 45 f4 11 09 00 00 movl $0x911,-0xc(%ebp)
while(*s != 0){
573: eb 1e jmp 593 <printf+0x11f>
575: eb 1c jmp 593 <printf+0x11f>
putc(fd, *s);
577: 8b 45 f4 mov -0xc(%ebp),%eax
57a: 0f b6 00 movzbl (%eax),%eax
57d: 0f be c0 movsbl %al,%eax
580: 89 44 24 04 mov %eax,0x4(%esp)
584: 8b 45 08 mov 0x8(%ebp),%eax
587: 89 04 24 mov %eax,(%esp)
58a: e8 05 fe ff ff call 394 <putc>
s++;
58f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
593: 8b 45 f4 mov -0xc(%ebp),%eax
596: 0f b6 00 movzbl (%eax),%eax
599: 84 c0 test %al,%al
59b: 75 da jne 577 <printf+0x103>
59d: eb 68 jmp 607 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
59f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
5a3: 75 1d jne 5c2 <printf+0x14e>
putc(fd, *ap);
5a5: 8b 45 e8 mov -0x18(%ebp),%eax
5a8: 8b 00 mov (%eax),%eax
5aa: 0f be c0 movsbl %al,%eax
5ad: 89 44 24 04 mov %eax,0x4(%esp)
5b1: 8b 45 08 mov 0x8(%ebp),%eax
5b4: 89 04 24 mov %eax,(%esp)
5b7: e8 d8 fd ff ff call 394 <putc>
ap++;
5bc: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5c0: eb 45 jmp 607 <printf+0x193>
} else if(c == '%'){
5c2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
5c6: 75 17 jne 5df <printf+0x16b>
putc(fd, c);
5c8: 8b 45 e4 mov -0x1c(%ebp),%eax
5cb: 0f be c0 movsbl %al,%eax
5ce: 89 44 24 04 mov %eax,0x4(%esp)
5d2: 8b 45 08 mov 0x8(%ebp),%eax
5d5: 89 04 24 mov %eax,(%esp)
5d8: e8 b7 fd ff ff call 394 <putc>
5dd: eb 28 jmp 607 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
5df: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
5e6: 00
5e7: 8b 45 08 mov 0x8(%ebp),%eax
5ea: 89 04 24 mov %eax,(%esp)
5ed: e8 a2 fd ff ff call 394 <putc>
putc(fd, c);
5f2: 8b 45 e4 mov -0x1c(%ebp),%eax
5f5: 0f be c0 movsbl %al,%eax
5f8: 89 44 24 04 mov %eax,0x4(%esp)
5fc: 8b 45 08 mov 0x8(%ebp),%eax
5ff: 89 04 24 mov %eax,(%esp)
602: e8 8d fd ff ff call 394 <putc>
}
state = 0;
607: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
60e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
612: 8b 55 0c mov 0xc(%ebp),%edx
615: 8b 45 f0 mov -0x10(%ebp),%eax
618: 01 d0 add %edx,%eax
61a: 0f b6 00 movzbl (%eax),%eax
61d: 84 c0 test %al,%al
61f: 0f 85 71 fe ff ff jne 496 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
625: c9 leave
626: c3 ret
627: 90 nop
00000628 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
628: 55 push %ebp
629: 89 e5 mov %esp,%ebp
62b: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
62e: 8b 45 08 mov 0x8(%ebp),%eax
631: 83 e8 08 sub $0x8,%eax
634: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
637: a1 38 0c 00 00 mov 0xc38,%eax
63c: 89 45 fc mov %eax,-0x4(%ebp)
63f: eb 24 jmp 665 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
641: 8b 45 fc mov -0x4(%ebp),%eax
644: 8b 00 mov (%eax),%eax
646: 3b 45 fc cmp -0x4(%ebp),%eax
649: 77 12 ja 65d <free+0x35>
64b: 8b 45 f8 mov -0x8(%ebp),%eax
64e: 3b 45 fc cmp -0x4(%ebp),%eax
651: 77 24 ja 677 <free+0x4f>
653: 8b 45 fc mov -0x4(%ebp),%eax
656: 8b 00 mov (%eax),%eax
658: 3b 45 f8 cmp -0x8(%ebp),%eax
65b: 77 1a ja 677 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
65d: 8b 45 fc mov -0x4(%ebp),%eax
660: 8b 00 mov (%eax),%eax
662: 89 45 fc mov %eax,-0x4(%ebp)
665: 8b 45 f8 mov -0x8(%ebp),%eax
668: 3b 45 fc cmp -0x4(%ebp),%eax
66b: 76 d4 jbe 641 <free+0x19>
66d: 8b 45 fc mov -0x4(%ebp),%eax
670: 8b 00 mov (%eax),%eax
672: 3b 45 f8 cmp -0x8(%ebp),%eax
675: 76 ca jbe 641 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
677: 8b 45 f8 mov -0x8(%ebp),%eax
67a: 8b 40 04 mov 0x4(%eax),%eax
67d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
684: 8b 45 f8 mov -0x8(%ebp),%eax
687: 01 c2 add %eax,%edx
689: 8b 45 fc mov -0x4(%ebp),%eax
68c: 8b 00 mov (%eax),%eax
68e: 39 c2 cmp %eax,%edx
690: 75 24 jne 6b6 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
692: 8b 45 f8 mov -0x8(%ebp),%eax
695: 8b 50 04 mov 0x4(%eax),%edx
698: 8b 45 fc mov -0x4(%ebp),%eax
69b: 8b 00 mov (%eax),%eax
69d: 8b 40 04 mov 0x4(%eax),%eax
6a0: 01 c2 add %eax,%edx
6a2: 8b 45 f8 mov -0x8(%ebp),%eax
6a5: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
6a8: 8b 45 fc mov -0x4(%ebp),%eax
6ab: 8b 00 mov (%eax),%eax
6ad: 8b 10 mov (%eax),%edx
6af: 8b 45 f8 mov -0x8(%ebp),%eax
6b2: 89 10 mov %edx,(%eax)
6b4: eb 0a jmp 6c0 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
6b6: 8b 45 fc mov -0x4(%ebp),%eax
6b9: 8b 10 mov (%eax),%edx
6bb: 8b 45 f8 mov -0x8(%ebp),%eax
6be: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
6c0: 8b 45 fc mov -0x4(%ebp),%eax
6c3: 8b 40 04 mov 0x4(%eax),%eax
6c6: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
6cd: 8b 45 fc mov -0x4(%ebp),%eax
6d0: 01 d0 add %edx,%eax
6d2: 3b 45 f8 cmp -0x8(%ebp),%eax
6d5: 75 20 jne 6f7 <free+0xcf>
p->s.size += bp->s.size;
6d7: 8b 45 fc mov -0x4(%ebp),%eax
6da: 8b 50 04 mov 0x4(%eax),%edx
6dd: 8b 45 f8 mov -0x8(%ebp),%eax
6e0: 8b 40 04 mov 0x4(%eax),%eax
6e3: 01 c2 add %eax,%edx
6e5: 8b 45 fc mov -0x4(%ebp),%eax
6e8: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6eb: 8b 45 f8 mov -0x8(%ebp),%eax
6ee: 8b 10 mov (%eax),%edx
6f0: 8b 45 fc mov -0x4(%ebp),%eax
6f3: 89 10 mov %edx,(%eax)
6f5: eb 08 jmp 6ff <free+0xd7>
} else
p->s.ptr = bp;
6f7: 8b 45 fc mov -0x4(%ebp),%eax
6fa: 8b 55 f8 mov -0x8(%ebp),%edx
6fd: 89 10 mov %edx,(%eax)
freep = p;
6ff: 8b 45 fc mov -0x4(%ebp),%eax
702: a3 38 0c 00 00 mov %eax,0xc38
}
707: c9 leave
708: c3 ret
00000709 <morecore>:
static Header*
morecore(uint nu)
{
709: 55 push %ebp
70a: 89 e5 mov %esp,%ebp
70c: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
70f: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
716: 77 07 ja 71f <morecore+0x16>
nu = 4096;
718: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
71f: 8b 45 08 mov 0x8(%ebp),%eax
722: c1 e0 03 shl $0x3,%eax
725: 89 04 24 mov %eax,(%esp)
728: e8 3f fc ff ff call 36c <sbrk>
72d: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
730: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
734: 75 07 jne 73d <morecore+0x34>
return 0;
736: b8 00 00 00 00 mov $0x0,%eax
73b: eb 22 jmp 75f <morecore+0x56>
hp = (Header*)p;
73d: 8b 45 f4 mov -0xc(%ebp),%eax
740: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
743: 8b 45 f0 mov -0x10(%ebp),%eax
746: 8b 55 08 mov 0x8(%ebp),%edx
749: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
74c: 8b 45 f0 mov -0x10(%ebp),%eax
74f: 83 c0 08 add $0x8,%eax
752: 89 04 24 mov %eax,(%esp)
755: e8 ce fe ff ff call 628 <free>
return freep;
75a: a1 38 0c 00 00 mov 0xc38,%eax
}
75f: c9 leave
760: c3 ret
00000761 <malloc>:
void*
malloc(uint nbytes)
{
761: 55 push %ebp
762: 89 e5 mov %esp,%ebp
764: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
767: 8b 45 08 mov 0x8(%ebp),%eax
76a: 83 c0 07 add $0x7,%eax
76d: c1 e8 03 shr $0x3,%eax
770: 83 c0 01 add $0x1,%eax
773: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
776: a1 38 0c 00 00 mov 0xc38,%eax
77b: 89 45 f0 mov %eax,-0x10(%ebp)
77e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
782: 75 23 jne 7a7 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
784: c7 45 f0 30 0c 00 00 movl $0xc30,-0x10(%ebp)
78b: 8b 45 f0 mov -0x10(%ebp),%eax
78e: a3 38 0c 00 00 mov %eax,0xc38
793: a1 38 0c 00 00 mov 0xc38,%eax
798: a3 30 0c 00 00 mov %eax,0xc30
base.s.size = 0;
79d: c7 05 34 0c 00 00 00 movl $0x0,0xc34
7a4: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7a7: 8b 45 f0 mov -0x10(%ebp),%eax
7aa: 8b 00 mov (%eax),%eax
7ac: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
7af: 8b 45 f4 mov -0xc(%ebp),%eax
7b2: 8b 40 04 mov 0x4(%eax),%eax
7b5: 3b 45 ec cmp -0x14(%ebp),%eax
7b8: 72 4d jb 807 <malloc+0xa6>
if(p->s.size == nunits)
7ba: 8b 45 f4 mov -0xc(%ebp),%eax
7bd: 8b 40 04 mov 0x4(%eax),%eax
7c0: 3b 45 ec cmp -0x14(%ebp),%eax
7c3: 75 0c jne 7d1 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
7c5: 8b 45 f4 mov -0xc(%ebp),%eax
7c8: 8b 10 mov (%eax),%edx
7ca: 8b 45 f0 mov -0x10(%ebp),%eax
7cd: 89 10 mov %edx,(%eax)
7cf: eb 26 jmp 7f7 <malloc+0x96>
else {
p->s.size -= nunits;
7d1: 8b 45 f4 mov -0xc(%ebp),%eax
7d4: 8b 40 04 mov 0x4(%eax),%eax
7d7: 2b 45 ec sub -0x14(%ebp),%eax
7da: 89 c2 mov %eax,%edx
7dc: 8b 45 f4 mov -0xc(%ebp),%eax
7df: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7e2: 8b 45 f4 mov -0xc(%ebp),%eax
7e5: 8b 40 04 mov 0x4(%eax),%eax
7e8: c1 e0 03 shl $0x3,%eax
7eb: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7ee: 8b 45 f4 mov -0xc(%ebp),%eax
7f1: 8b 55 ec mov -0x14(%ebp),%edx
7f4: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7f7: 8b 45 f0 mov -0x10(%ebp),%eax
7fa: a3 38 0c 00 00 mov %eax,0xc38
return (void*)(p + 1);
7ff: 8b 45 f4 mov -0xc(%ebp),%eax
802: 83 c0 08 add $0x8,%eax
805: eb 38 jmp 83f <malloc+0xde>
}
if(p == freep)
807: a1 38 0c 00 00 mov 0xc38,%eax
80c: 39 45 f4 cmp %eax,-0xc(%ebp)
80f: 75 1b jne 82c <malloc+0xcb>
if((p = morecore(nunits)) == 0)
811: 8b 45 ec mov -0x14(%ebp),%eax
814: 89 04 24 mov %eax,(%esp)
817: e8 ed fe ff ff call 709 <morecore>
81c: 89 45 f4 mov %eax,-0xc(%ebp)
81f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
823: 75 07 jne 82c <malloc+0xcb>
return 0;
825: b8 00 00 00 00 mov $0x0,%eax
82a: eb 13 jmp 83f <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
82c: 8b 45 f4 mov -0xc(%ebp),%eax
82f: 89 45 f0 mov %eax,-0x10(%ebp)
832: 8b 45 f4 mov -0xc(%ebp),%eax
835: 8b 00 mov (%eax),%eax
837: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
83a: e9 70 ff ff ff jmp 7af <malloc+0x4e>
}
83f: c9 leave
840: c3 ret
841: 66 90 xchg %ax,%ax
843: 90 nop
00000844 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
844: 55 push %ebp
845: 89 e5 mov %esp,%ebp
847: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
84a: 8b 55 08 mov 0x8(%ebp),%edx
84d: 8b 45 0c mov 0xc(%ebp),%eax
850: 8b 4d 08 mov 0x8(%ebp),%ecx
853: f0 87 02 lock xchg %eax,(%edx)
856: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
859: 8b 45 fc mov -0x4(%ebp),%eax
}
85c: c9 leave
85d: c3 ret
0000085e <mutex_init>:
#include "types.h"
#include "user.h"
#include "x86.h"
#include "threadlib.h"
void mutex_init(mutex_t *m) {
85e: 55 push %ebp
85f: 89 e5 mov %esp,%ebp
// 0 indicates that lock is available, 1 that it is held by a thread
m->flag = 0;
861: 8b 45 08 mov 0x8(%ebp),%eax
864: c7 00 00 00 00 00 movl $0x0,(%eax)
}
86a: 5d pop %ebp
86b: c3 ret
0000086c <mutex_lock>:
void mutex_lock(mutex_t *m)
{
86c: 55 push %ebp
86d: 89 e5 mov %esp,%ebp
86f: 83 ec 08 sub $0x8,%esp
while (xchg(&m->flag, 1) == 1); // spin-wait (do nothing)
872: 90 nop
873: 8b 45 08 mov 0x8(%ebp),%eax
876: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
87d: 00
87e: 89 04 24 mov %eax,(%esp)
881: e8 be ff ff ff call 844 <xchg>
886: 83 f8 01 cmp $0x1,%eax
889: 74 e8 je 873 <mutex_lock+0x7>
}
88b: c9 leave
88c: c3 ret
0000088d <mutex_unlock>:
void mutex_unlock(mutex_t *m)
{
88d: 55 push %ebp
88e: 89 e5 mov %esp,%ebp
m->flag = 0;
890: 8b 45 08 mov 0x8(%ebp),%eax
893: c7 00 00 00 00 00 movl $0x0,(%eax)
}
899: 5d pop %ebp
89a: c3 ret
0000089b <thread_create>:
if(!pid) (*start_routine)(arg);
else return pid;
}*/
int thread_create(void(*child)(void*), void *arg_ptr)
{
89b: 55 push %ebp
89c: 89 e5 mov %esp,%ebp
89e: 83 ec 28 sub $0x28,%esp
void *stack = malloc(4096);
8a1: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
8a8: e8 b4 fe ff ff call 761 <malloc>
8ad: 89 45 f4 mov %eax,-0xc(%ebp)
int clone_pid = clone(child, arg_ptr, stack);
8b0: 8b 45 f4 mov -0xc(%ebp),%eax
8b3: 89 44 24 08 mov %eax,0x8(%esp)
8b7: 8b 45 0c mov 0xc(%ebp),%eax
8ba: 89 44 24 04 mov %eax,0x4(%esp)
8be: 8b 45 08 mov 0x8(%ebp),%eax
8c1: 89 04 24 mov %eax,(%esp)
8c4: e8 bb fa ff ff call 384 <clone>
8c9: 89 45 f0 mov %eax,-0x10(%ebp)
return clone_pid;
8cc: 8b 45 f0 mov -0x10(%ebp),%eax
}
8cf: c9 leave
8d0: c3 ret
000008d1 <thread_join>:
int thread_join(void)
{
8d1: 55 push %ebp
8d2: 89 e5 mov %esp,%ebp
8d4: 83 ec 28 sub $0x28,%esp
void *join_s;
int join_pid = join(&join_s);
8d7: 8d 45 f0 lea -0x10(%ebp),%eax
8da: 89 04 24 mov %eax,(%esp)
8dd: e8 aa fa ff ff call 38c <join>
8e2: 89 45 f4 mov %eax,-0xc(%ebp)
return join_pid;
8e5: 8b 45 f4 mov -0xc(%ebp),%eax
8e8: c9 leave
8e9: c3 ret
|
oeis/007/A007978.asm
|
neoneye/loda-programs
| 11 |
100069
|
; A007978: Least non-divisor of n.
; 2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,7,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3
mov $2,$0
mov $0,1
mov $1,1
lpb $2
add $0,$1
sub $2,$1
dif $2,$0
mul $2,$0
lpe
add $0,1
|
private/ntos/dll/i386/emstore.asm
|
King0987654/windows2000
| 17 |
96210
|
<filename>private/ntos/dll/i386/emstore.asm
subttl emstore.asm - FST, FSTP, FIST, FISTP instructions
page
;*******************************************************************************
;emstore.asm - FST, FSTP, FIST, FISTP instructions
;
; Microsoft Confidential
;
; Copyright (c) Microsoft Corporation 1991
; All Rights Reserved
;
;Purpose:
; FST, FSTP, FIST, FISTP instructions
;Inputs:
; edi = [CURstk]
; dseg:esi = pointer to memory destination
;
;Revision History:
;
; [] 09/05/91 TP Initial 32-bit version.
;
;*******************************************************************************
;******
EM_ENTRY eFSTP
eFSTP:
;******
; edi = [CURstk]
; esi = pointer to st(i) from instruction field
cmp EMSEG:[edi].bTag,bTAG_EMPTY
jz short efstp_StackError
;UNDONE: temporary hack to preserve condition codes
mov ax,[esp+4].OldStatus
mov EMSEG:[StatusWord],ax
;UNDONE: end of hack
;A common use of this instruction is FSTP st(0) just to pop the stack.
;We check for this case and optimize it.
cmp esi,edi
jz short JustPop
;Copy the register
mov eax,EMSEG:[edi].ExpSgn
mov EMSEG:[esi].ExpSgn,eax
mov eax,EMSEG:[edi].lManHi
mov EMSEG:[esi].lManHi,eax
mov eax,EMSEG:[edi].lManLo
mov EMSEG:[esi].lManLo,eax
JustPop:
POPSTret edi
efstp_StackError:
mov EMSEG:[CURerr],Invalid+StackFlag
ret
;******
EM_ENTRY eFST
eFST:
;******
; edi = [CURstk]
; esi = pointer to st(i) from instruction field
cmp EMSEG:[edi].bTag,bTAG_EMPTY
jz StackError ;In emarith.asm
;Copy the register
mov eax,EMSEG:[edi].ExpSgn
mov EMSEG:[esi].ExpSgn,eax
mov eax,EMSEG:[edi].lManHi
mov EMSEG:[esi].lManHi,eax
mov eax,EMSEG:[edi].lManLo
mov EMSEG:[esi].lManLo,eax
DontPop:
ret
;Come here if the instruction wants to pop the stack
PopStackChk:
jc DontPop ;Get unmasked error?
PopStack:
mov edi,EMSEG:[CURstk]
POPSTret edi
StoreSpcl64:
cmp cl,bTAG_DEN
jz Denorm64
.erre bTAG_NAN lt bTAG_EMPTY
.erre bTAG_NAN gt bTAG_INF
cmp cl,bTAG_NAN
mov ecx,DexpMax shl 16 ;Insert special exponent for NAN/Inf.
jb StoreIEEE64 ;Go handle infinity
ja Empty64
;Have a NAN.
test ebx,1 shl 30 ;Check for SNAN
jnz StoreIEEE64 ;Go store QNAN
or ebx,1 shl 30 ;Make SNAN into a QNAN
mov EMSEG:[CURerr],Invalid ;Flag the exception
test EMSEG:[CWmask],Invalid ;Is it masked?
jnz StoreIEEE64 ;If so, update with masked response
stc ;Don't pop stack
ret
Empty64:
;It's empty--signal invalid operation
mov EMSEG:[CURerr],StackFlag+Invalid
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing64 ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov dword ptr dseg:[esi],0
mov dword ptr dseg:[esi+4],0FFF80000H ;64-bit IEEE indefinite
ret ;CY clear
Denorm64:
mov EMSEG:[CURerr],Denormal
test EMSEG:[CWmask],Denormal ;Is it masked?
jnz NormStore64 ;If so, ignore denormalization
DoNothing64:
stc ;Don't pop stack
ret
;*****************
;Store Double Real
;*****************
EM_ENTRY eFSTP64
eFSTP64:
push offset PopStackChk ;Return here after store
EM_ENTRY eFST64
eFST64:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
mov ebx,EMSEG:[edi].lManHi
mov ecx,EMSEG:[edi].ExpSgn
mov edi,EMSEG:[edi].lManLo
;mantissa in ebx:edi, exponent in high ecx, sign in ch bit 7, tag in cl
;memory destination is dseg:esi
mov al,ch ;Save sign bit
cmp cl,bTAG_ZERO
.erre bTAG_VALID lt bTAG_ZERO
.erre bTAG_SNGL lt bTAG_ZERO
jz short SignAndStore64 ;Just set sign and exit
ja StoreSpcl64
NormStore64:
;Note that we could have a denormal exception at this point.
;Thus any additional exceptions must OR into [CURerr], not MOV.
xor cx,cx
add ecx,(DexpBias-TexpBias) shl 16 ;Correct bias
jl short Under64
cmp ecx,DexpMax shl 16 ;Exponent too big?
jge Over64
test edi,(1 shl 11) - 1 ;Any bits to round?
jz short StoreIEEE64
Round64:
or EMSEG:[CURerr],Precision ;Set flag on inexact result
test EMSEG:[CWcntl],RoundControl ;Check rounding control bits
.erre RCnear eq 0
jnz NotNearest64 ;Not just round-to-nearest
test edi,1 shl 10 ;Check rounding bit
jz short StoreIEEE64 ;If zero, don't round up
test edi,(3 shl 10)-1 ;Test LSB and sticky bits
jnz RoundUp64b
StoreIEEE64:
or ecx, ecx ;now that value is rounded,
je short Under64 ;check exponent for underflow
StoreIEEE64Continue:
and ebx,not (1 shl 31) ;Clear MSB--it's implied in IEEE64
shrd edi,ebx,11
shr ebx,11 ;Move mantissa down
shl ecx,4 ;Exponent up to position
or ebx,ecx ;Combine exponent
SignAndStore64:
and al,bSign ;Just sign bit
shl eax,24 ;Sign to MSB
or ebx,eax ;Combine sign
mov dseg:[esi],edi
mov dseg:[esi+4],ebx
;CY clear indicate no error
ret
SetUnderflow:
or EMSEG:[CURerr],Underflow ;Unmasked underflow--do nothing
DoNothing:
stc ;Indicate nothing was done
ret
Under64:
dec cl ; Is cx == 1?
jz short StoreIEEE64Continue ; Yes, we've alread been here
test EMSEG:[CWmask],Underflow ;Is underflow masked?
jz SetUnderflow ;No, do nothing more
;Produce masked underflow response
;Note that the underflow exception does not occur if the number can be
;represented exactly as a denormal.
sar ecx,16 ;Bring exponent down
cmp ecx,DexpMin-52 ;Allow for shift down to rounding bit
jl BigUnder64 ;Too small, just make it zero
.erre DexpMin eq 0
neg ecx ;Use as shift count
inc ecx ;Shift by at least one
xor edx,edx ;Place for sticky bits
cmp cl,32 ;Long shift?
jb ShortDenorm
neg edi ;CY set if non-zero
sbb edx,edx ;-1 if bits shifted off, else zero
mov edi,ebx
xor ebx,ebx ;32-bit right shift
ShortDenorm:
;Shift count is modulo-32
shrd edx,edi,cl
shrd edi,ebx,cl
shr ebx,cl
cmp edx,1 ;CY set if zero, else clear
sbb edx,edx ;Zero if bits shifted off, else -1
inc edx ;1 if bits shifted off, else zero
or edi,edx ;Collapse sticky bits into edi
mov ecx, 1 ;Biased exponent is zero, put 1 into CL (noticed by Under64)
test edi,(1 shl 11) - 1 ;Any bits to round?
jz StoreIEEE64 ;If not, no exception
or EMSEG:[CURerr],Underflow
jmp Round64
Over64:
test EMSEG:[CWmask],Overflow ;Is overflow masked?
jz SetOverflow ;No, do nothing more
;Produce masked overflow response
or EMSEG:[CURerr],Overflow+Precision
mov ebx,DexpMax shl 20
xor edi,edi ;ebx:edi = positive infinity
mov ah,EMSEG:[CWcntl] ;Get rounding control
;Return max value if RCup bit = 1 and -, or RCdown bit = 1 and +
;i.e., RCup & sign OR RCdown & not sign
.erre RCchop eq RCup + RCdown ;Always return max value
.erre RCnear eq 0 ;Never return max value
sar al,7 ;Expand sign through whole byte
.erre (RCdown and bSign) eq 0 ;Don't want to change real sign
xor al,RCdown ;Flip sign for RCdown bit
and ah,al ;RCup & sign OR RCdown & not sign
test ah,RoundControl ;Look only at RC bits
jz SignAndStore64 ;Return infinity
dec ebx
dec edi ;Max value == infinity-1
jmp SignAndStore64
SetOverflow:
or EMSEG:[CURerr],Overflow
stc ;Indicate nothing was done
ret
BigUnder64:
or EMSEG:[CURerr],Underflow+Precision
xor ebx,ebx
mov edi,ebx ;Set it to zero
mov ecx,ebx ;Including exponent
NotNearest64:
;We want to increase the magnitude if RCup and +, or RCdown and -
mov ah,EMSEG:[CWcntl] ;Get rounding control
sar al,7 ;Expand sign through whole byte
.erre (not RCup and RoundControl) eq RCdown
xor ah,al ;Flip rounding bits if negative
and ah,RoundControl
cmp ah,RCup
jnz StoreIEEE64 ;No, chop it
RoundUp64b:
mov EMSEG:[SWcc],RoundUp
add edi,1 shl 11 ;Round up
adc ebx,0
jnc StoreIEEE64
add ecx,1 shl 16 ;Mantissa overflowed, bump exponent
cmp ecx,DexpMax shl 16 ;Exponent too big?
jge Over64
jmp StoreIEEE64
;*******************************************************************************
StoreSpcl32:
cmp cl,bTAG_DEN
jz Denorm32
.erre bTAG_NAN lt bTAG_EMPTY
.erre bTAG_NAN gt bTAG_INF
cmp cl,bTAG_NAN
mov ecx,SexpMax shl 16 ;Insert special exponent
jb StoreIEEE32
ja Empty64
;Have a NAN.
test ebx,1 shl 30 ;Check for SNAN
jnz StoreIEEE32 ;Go store QNAN
or ebx,1 shl 30 ;Make SNAN into a QNAN
mov EMSEG:[CURerr],Invalid ;Flag the exception
test EMSEG:[CWmask],Invalid ;Is it masked?
jnz StoreIEEE32 ;If so, update with masked response
stc ;Don't pop stack
ret
Empty32:
;It's empty--signal invalid operation
mov EMSEG:[CURerr],StackFlag+Invalid
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing32 ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov dword ptr dseg:[esi],0FFC00000H ;32-bit IEEE indefinite
ret ;CY clear
Denorm32:
mov EMSEG:[CURerr],Denormal
test EMSEG:[CWmask],Denormal ;Is it masked?
jnz NormStore32 ;If so, ignore denormalization
DoNothing32:
stc ;Don't pop stack
ret
;*****************
;Store Single Real
;*****************
EM_ENTRY eFSTP32
eFSTP32:
push offset PopStackChk ;Return here after store
EM_ENTRY eFST32
eFST32:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
mov ebx,EMSEG:[edi].lManHi
mov ecx,EMSEG:[edi].ExpSgn
mov edi,EMSEG:[edi].lManLo
;mantissa in ebx:edi, exponent in high ecx, sign in ch bit 7, tag in cl
;memory destination is dseg:esi
mov al,ch ;Save sign bit
cmp cl,bTAG_ZERO
.erre bTAG_VALID lt bTAG_ZERO
.erre bTAG_SNGL lt bTAG_ZERO
jz SignAndStore32 ;Just set sign and exit
ja StoreSpcl32
NormStore32:
;Note that we could have a denormal exception at this point.
;Thus any additional exceptions must OR into [CURerr], not MOV.
xor cx,cx
add ecx,(SexpBias-TexpBias) shl 16 ;Correct bias
jle Under32
cmp ecx,SexpMax shl 16 ;Exponent too big?
jge Over32
;See if we need to round
mov edx,ebx ;Get low bits
and edx,(1 shl 8) - 1 ;Mask to last 8 bits
or edx,edi ;Throwing away any bits?
jz StoreIEEE32
;Result will not be exact--check rounding mode
Round32:
or EMSEG:[CURerr],Precision ;Set flag on inexact result
test EMSEG:[CWcntl],RoundControl ;Check rounding control bits
.erre RCnear eq 0
jnz NotNearest32 ;Not just round-to-nearest
test bl,1 shl 7 ;Round bit set?
jz StoreIEEE32
mov edx,ebx
and edx,(3 shl 7)-1 ;Mask to LSB and sticky bits
or edx,edi ;Combine with remaining sticky bits
jz StoreIEEE32
mov EMSEG:[SWcc],RoundUp
add ebx,1 shl 8 ;Round up
jc AddOneExp32
StoreIEEE32:
and ebx,not (1 shl 31) ;Clear MSB--it's implied in IEEE32
shr ebx,8 ;Move mantissa down
shl ecx,7 ;Exponent up to position
or ebx,ecx ;Combine exponent
SignAndStore32:
and al,bSign ;Just sign bit
shl eax,24 ;Sign to MSB
or ebx,eax ;Combine sign
mov dseg:[esi],ebx
;CY clear indicate no error
ret
Under32:
test EMSEG:[CWmask],Underflow ;Is underflow masked?
jz SetUnderflow ;No, do nothing more
;Produce masked underflow response
;Note that the underflow exception does not occur if the number can be
;represented exactly as a denormal.
sar ecx,16 ;Bring exponent down
cmp ecx,SexpMin-23 ;Allow for shift down to rounding bit
jl BigUnder32 ;Too small, just make it zero
.erre SexpMin eq 0
neg ecx ;Use as shift count
inc ecx ;Shift by at least one
xor edx,edx ;Place for sticky bits
shrd edx,ebx,cl
shr ebx,cl
xor ecx,ecx ;Biased exponent is zero
or edi,edx ;Combine sticky bits
mov edx,ebx ;Get low bits
and edx,(1 shl 8) - 1 ;Mask to last 8 bits
or edx,edi ;Throwing away any bits?
jz StoreIEEE32
or EMSEG:[CURerr],Underflow
jmp Round32
AddOneExp32:
add ecx,1 shl 16 ;Mantissa overflowed, bump exponent
cmp ecx,SexpMax shl 16 ;Exponent too big?
jl StoreIEEE32
Over32:
test EMSEG:[CWmask],Overflow ;Is overflow masked?
jz SetOverflow ;No, do nothing more
;Produce masked overflow response
or EMSEG:[CURerr],Overflow+Precision
mov ebx,SexpMax shl 23
mov ah,EMSEG:[CWcntl] ;Get rounding control
;Return max value if RCup bit = 1 and -, or RCdown bit = 1 and +
;i.e., RCup & sign OR RCdown & not sign
.erre RCchop eq RCup + RCdown ;Always return max value
.erre RCnear eq 0 ;Never return max value
sar al,7 ;Expand sign through whole byte
.erre (RCdown and bSign) eq 0 ;Don't want to change real sign
xor al,RCdown ;Flip sign for RCdown bit
and ah,al ;RCup & sign OR RCdown & not sign
test ah,RoundControl ;Look only at RC bits
jz SignAndStore32 ;Return infinity
dec ebx ;Max value == infinity-1
jmp SignAndStore32
BigUnder32:
or EMSEG:[CURerr],Underflow+Precision
xor ebx,ebx ;Set it to zero
xor ecx,ecx ;Exponent too
NotNearest32:
;We want to increase the magnitude if RCup and +, or RCdown and -
mov ah,EMSEG:[CWcntl] ;Get rounding control
sar al,7 ;Expand sign through whole byte
.erre (not RCup and RoundControl) eq RCdown
xor ah,al ;Flip rounding bits if negative
and ah,RoundControl
cmp ah,RCup
jnz StoreIEEE32 ;No, chop it
mov EMSEG:[SWcc],RoundUp
add ebx,1 shl 8 ;Round up
jnc StoreIEEE32
jmp AddOneExp32
;*******************************************************************************
StoreSpcl32Int:
cmp cl,bTAG_DEN
jz NormStore32Int ;Ignore denormal
cmp cl,bTAG_EMPTY
jnz Over32Int ;All other specials are invalid
mov EMSEG:[CURerr],StackFlag+Invalid
jmp Invalid32Int
DoNothing32Int:
stc ;Don't pop stack
ret
CheckMax32:
ja Over32Int
test al,bSign ;Is it negative?
jnz Store32Int ;If so, answer is OK
Over32Int:
;Overflow on integer store is invalid according to IEEE
mov EMSEG:[CURerr],Invalid ;Must remove precision exception
Invalid32Int:
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing32Int ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov dword ptr dseg:[esi],80000000H ;32-bit integer indefinite
ret ;CY clear
;******************
;Store Long Integer
;******************
EM_ENTRY eFISTP32
eFISTP32:
push offset PopStackChk ;Return here after store
EM_ENTRY eFIST32
eFIST32:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
mov ebx,EMSEG:[edi].lManHi
mov ecx,EMSEG:[edi].ExpSgn
mov edi,EMSEG:[edi].lManLo
;mantissa in ebx:edi, exponent in high ecx, sign in ch bit 7, tag in cl
;memory destination is dseg:esi
mov al,ch ;Save sign bit
cmp cl,bTAG_ZERO
.erre bTAG_VALID lt bTAG_ZERO
.erre bTAG_SNGL lt bTAG_ZERO
jz Store32Int ;Just store zero and exit
ja StoreSpcl32Int
NormStore32Int:
xor edx,edx
sar ecx,16 ;Bring exponent down
cmp ecx,-1 ;Is it less than 1?
jle Under32Int
cmp ecx,31
jg Over32Int
sub ecx,31
neg ecx ;cl = amount to shift right
shrd edx,edi,cl
shrd edi,ebx,cl ;Collect round and sticky bits
shr ebx,cl ;Align integer
;See if we need to round
mov ecx,edi
or ecx,edx ;Throwing away any bits?
jz StoreIEEE32Int
;Result will not be exact--check rounding mode
Round32Int:
mov EMSEG:[CURerr],Precision ;Set flag on inexact result
test EMSEG:[CWcntl],RoundControl ;Check rounding control bits
.erre RCnear eq 0
jnz NotNearest32Int ;Not just round-to-nearest
;To perform "round even" when the round bit is set and the sticky bits
;are zero, we treat the LSB as if it were a sticky bit. Thus if the LSB
;is set, that will always force a round up (to even) if the round bit is
;set. If the LSB is zero, then the sticky bits remain zero and we always
;round down.
bt ebx,0 ;Look at LSB (for round even)
adc edx,-1 ;CY set if sticky bits <>0
adc edi,(1 shl 31)-1 ;CY set if round up
jnc StoreIEEE32Int
mov EMSEG:[SWcc],RoundUp
inc ebx
jz Over32Int
StoreIEEE32Int:
cmp ebx,1 shl 31 ;Check for max value
jae CheckMax32
SignAndStore32Int:
shl eax,24 ;Sign to MSB
cdq ;Extend sign through edx
xor ebx,edx ;Complement
sub ebx,edx ; and increment if negative
clc
Store32Int:
mov dseg:[esi],ebx
;CY clear indicates no error
ret
Under32Int:
;ZF set if exponent is -1
xchg edx,edi ;32-bit right shift
xchg edi,ebx ;ebx = 0 now
jz Round32Int ;If exponent was -1, ready to round
mov EMSEG:[CURerr],Precision ;Set flag on inexact result
NotNearest32Int:
;We want to increase the magnitude if RCup and +, or RCdown and -
mov ah,EMSEG:[CWcntl] ;Get rounding control
sar al,7 ;Expand sign through whole byte
.erre (not RCup and RoundControl) eq RCdown
xor ah,al ;Flip rounding bits if negative
and ah,RoundControl
cmp ah,RCup ;Rounding up?
jnz StoreIEEE32Int ;No, chop it
mov EMSEG:[SWcc],RoundUp
inc ebx
jnc StoreIEEE32Int
jmp Over32Int
;*******************************************************************************
StoreSpcl16Int:
cmp cl,bTAG_DEN
jz NormStore16Int ;Ignore denormal
cmp cl,bTAG_EMPTY
jnz Over16Int ;All other specials are invalid
mov EMSEG:[CURerr],StackFlag+Invalid
jmp Invalid16Int
DoNothing16Int:
stc ;Don't pop stack
ret
CheckMax16:
ja Over16Int
test al,bSign ;Is it negative?
jnz Store16Int ;If so, answer is OK
Over16Int:
;Overflow on integer store is invalid according to IEEE
mov EMSEG:[CURerr],Invalid
Invalid16Int:
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing16Int ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov word ptr dseg:[esi],8000H ;16-bit integer indefinite
ret ;CY clear
;*******************
;Store Short Integer
;*******************
EM_ENTRY eFISTP16
eFISTP16:
push offset PopStackChk ;Return here after store
EM_ENTRY eFIST16
eFIST16:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
mov ebx,EMSEG:[edi].lManHi
mov ecx,EMSEG:[edi].ExpSgn
mov edi,EMSEG:[edi].lManLo
;mantissa in ebx:edi, exponent in high ecx, sign in ch bit 7, tag in cl
;memory destination is dseg:esi
mov al,ch ;Save sign bit
cmp cl,bTAG_ZERO
.erre bTAG_VALID lt bTAG_ZERO
.erre bTAG_SNGL lt bTAG_ZERO
jz Store16Int ;Just store zero and exit
ja StoreSpcl16Int
NormStore16Int:
xor edx,edx
sar ecx,16 ;Bring exponent down
cmp ecx,-1 ;Is it less than 1?
jle Under16Int
cmp ecx,15
jg Over16Int
sub ecx,31
neg ecx ;cl = amount to shift right
shrd edx,edi,cl
shrd edi,ebx,cl ;Collect round and sticky bits
shr ebx,cl ;Align integer
;See if we need to round
mov ecx,edi
or ecx,edx ;Throwing away any bits?
jz StoreIEEE16Int
;Result will not be exact--check rounding mode
Round16Int:
mov EMSEG:[CURerr],Precision ;Set flag on inexact result
test EMSEG:[CWcntl],RoundControl ;Check rounding control bits
.erre RCnear eq 0
jnz NotNearest16Int ;Not just round-to-nearest
;To perform "round even" when the round bit is set and the sticky bits
;are zero, we treat the LSB as if it were a sticky bit. Thus if the LSB
;is set, that will always force a round up (to even) if the round bit is
;set. If the LSB is zero, then the sticky bits remain zero and we always
;round down.
bt ebx,0 ;Look at LSB (for round even)
adc edx,-1 ;CY set if sticky bits <>0
adc edi,(1 shl 31)-1 ;CY set if round up
jnc StoreIEEE16Int
mov EMSEG:[SWcc],RoundUp
inc ebx
StoreIEEE16Int:
cmp ebx,1 shl 15 ;Check for max value
jae CheckMax16
SignAndStore16Int:
shl eax,24 ;Sign to MSB
cdq ;Extend sign through edx
xor ebx,edx ;Complement
sub ebx,edx ; and increment if negative
clc
Store16Int:
mov dseg:[esi],bx
;CY clear indicates no error
ret
Under16Int:
;ZF set if exponent is -1
xchg edx,edi ;16-bit right shift
xchg edi,ebx ;ebx = 0 now
jz Round16Int ;If exponent was -1, ready to round
mov EMSEG:[CURerr],Precision ;Set flag on inexact result
NotNearest16Int:
;We want to increase the magnitude if RCup and +, or RCdown and -
mov ah,EMSEG:[CWcntl] ;Get rounding control
sar al,7 ;Expand sign through whole byte
.erre (not RCup and RoundControl) eq RCdown
xor ah,al ;Flip rounding bits if negative
and ah,RoundControl
cmp ah,RCup ;Rounding up?
jnz StoreIEEE16Int ;No, chop it
mov EMSEG:[SWcc],RoundUp
inc ebx
jnc StoreIEEE16Int
jmp Over16Int
;*******************************************************************************
;******************
;Store Quad Integer
;******************
EM_ENTRY eFISTP64
eFISTP64:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
call RoundToInteger
jc Invalid64Int
;Have integer in ebx:edi
;Sign in ch
cmp ebx,1 shl 31 ;Check for max value
jae CheckMax64
or ch,ch ;Check sign
jns Store64Int
;64-bit negation
not ebx
neg edi
sbb ebx,-1
Store64Int:
mov dseg:[esi],edi
mov dseg:[esi+4],ebx
jmp PopStack
CheckMax64:
ja Over64Int
test al,bSign ;Is it negative?
jnz Store64Int ;If so, answer is OK
Over64Int:
;Overflow on integer store is invalid according to IEEE
mov EMSEG:[CURerr],Invalid
Invalid64Int:
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing80 ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov dword ptr dseg:[esi],0
mov dword ptr dseg:[esi+4],80000000H ;64-bit integer indefinite
jmp PopStack
;*******************************************************************************
Empty80:
;It's empty--signal invalid operation
mov EMSEG:[CURerr],StackFlag+Invalid
test EMSEG:[CWmask],Invalid ;Is it masked?
jz DoNothing80 ;No--leave memory unchanged
;Store Indefinite
;For FSTP, we go ahead and do the pop even though it's empty
mov dword ptr dseg:[esi],0
mov dword ptr dseg:[esi+4],0C0000000H
mov word ptr dseg:[esi+8],0FFFFH ;80-bit IEEE indefinite
jmp PopStack
DoNothing80:
ret
;***************
;Store Temp Real
;***************
EM_ENTRY eFSTP80
eFSTP80:
mov EMSEG:[PrevDataOff],esi ;Save operand pointer
mov eax,EMSEG:[edi].ExpSgn
cmp al,bTAG_EMPTY
jz Empty80
push offset PopStack
StoreTempReal:
mov ebx,EMSEG:[edi].lManHi
mov edi,EMSEG:[edi].lManLo
;mantissa in ebx:edi, exponent in high eax, sign in ah bit 7, tag in al
;memory destination is dseg:esi
mov ecx,eax ;get copy of sign and tag
shr ecx,16 ;Bring exponent down
cmp al,bTAG_ZERO
jz StoreIEEE80 ;Skip bias if zero
add ecx,IexpBias-TexpBias ;Correct bias
cmp al,bTAG_DEN
jz Denorm80
StoreIEEE80:
and eax,bSign shl 8
or ecx,eax ;Combine sign with exponent
mov dseg:[esi],edi
mov dseg:[esi+4],ebx
mov dseg:[esi+8],cx
; jmp PopStack
ret
Denorm80:
;Must change it to a denormal
dec ecx
neg ecx ;Use as shift count
cmp cl,32 ;Long shift?
jae LongDenorm
shrd edi,ebx,cl
shr ebx,cl
xor ecx,ecx ;Exponent is zero
jmp StoreIEEE80
LongDenorm:
;edi must be zero if we have 32 bits to shift
xchg ebx,edi ;32-bit right shift
shr edi,cl ;shift count is modulo-32
xor ecx,ecx ;Exponent is zero
jmp StoreIEEE80
|
weakjava/src/main/antlr4/ziprisc/WeakJava.g4
|
xt0fer/WeakJava
| 0 |
1820
|
<filename>weakjava/src/main/antlr4/ziprisc/WeakJava.g4
/* WeakJava */
/* antlr4 -package "ziprisc.parser" -o parser WeakJava.g4 */
grammar WeakJava;
// Parser Rules (things that start with lowercase letters)
program : project ;
project
: Class Project LeftBrace mainFunction functionList? RightBrace
;
functionList
: functionDefinition
| functionList functionDefinition
;
mainFunction
: Int Main Paren Thesis compoundStatement
;
functionDefinition
: typeSpecifier Identifier Paren pars Thesis compoundStatement
;
statementList
: statement
| statementList statement
;
declarationList
: declaration
| declarationList declaration
;
variable : Identifier ;
compoundStatement
: LeftBrace declarationList? statementList? RightBrace
;
ifStatement
: If Paren expr Thesis compoundStatement (Else compoundStatement)?
;
whileStatement
: While Paren expr Thesis compoundStatement
;
assignStatement : lexp Assign expr Semi ;
returnStatement : Return expr Semi ;
functionCall : Identifier Paren pars Thesis ;
typeSpecifier
: Int
| Rune
| Boolean
| typeSpecifier LeftBracket expr RightBracket // array type
;
declaration
: typeSpecifier Identifier Semi
;
statement
: ifStatement
| whileStatement
| assignStatement
| returnStatement
| functionCall // function call
| compoundStatement
| Write expr
| Read lexp
;
lexp
: Identifier
| lexp LeftBracket expr RightBracket // array access
;
expr
: lexp
| expr relationOp expr
| expr binaryOp expr
| unop expr
| Paren expr Thesis
| Number
| QRune
| Length lexp // size of an array
;
binaryOp
: Minus
| Plus
| Star
| Div
| Mod
;
relationOp
: EqualEqual
| NotEqual
| Greater
| Less
;
unop
: Minus
| Not
;
pars
: typeSpecifier Identifier (Comma typeSpecifier Identifier)*
|
;
boolValue : True | False ;
// Lexer Tokens (things which start with Uppercase Letter)
Length : 'len';
Else : 'else';
If : 'if';
Int : 'int';
String : 'string';
Rune : 'rune';
Boolean : 'boolean';
Array : 'array';
Return : 'return';
While : 'while';
Func : 'function';
Main : 'main';
Read : 'read';
Write : 'write';
Class : 'class';
Project : 'Project';
True : 'true' ;
False : 'false' ;
Assign : '=';
EqualEqual : '==';
NotEqual : '!=';
Paren : '(';
Thesis : ')';
LeftBracket : '[';
RightBracket : ']';
LeftBrace : '{';
RightBrace : '}';
Less : '<';
LessEqual : '<=';
Greater : '>';
GreaterEqual : '>=';
LeftShift : '<<';
RightShift : '>>';
Plus : '+';
PlusPlus : '++';
Minus : '-';
MinusMinus : '--';
Star : '*';
Div : '/';
Mod : '%';
And : '&';
Or : '|';
AndAnd : '&&';
OrOr : '||';
Caret : '^';
Not : '!';
Tilde : '~';
Question : '?';
Colon : ':';
Semi : ';';
Comma : ',';
Quote : '\'';
// * A **INDENTIFIER** is a string starting with a letter, followed by 0 or more letters, digits or underscores.
// * A **NUMBER** is a string of digits.
// * A **QCHAR** is a runeacter between single quotes.
// * A **QSTR** is a stringof more than one runeacter between single quotes.
Identifier
: IdentifierNondigit
( IdentifierNondigit
| Digit
)*
;
fragment
IdentifierNondigit
: Nondigit
//| UniversalCharacterName
//| // other implementation-defined characters...
;
fragment
Nondigit
: [a-zA-Z_]
;
fragment
Digit
: [0-9]
;
Number
: Digit+
;
QRune
: Quote IdentifierNondigit Quote
;
Qstr
: Quote IdentifierNondigit+ Quote
;
// STRING : '"' ~'"'* '"';
// white space
Whitespace
: [ \t]+
-> skip
;
Newline
: ( '\r' '\n'?
| '\n'
)
-> skip
;
LineComment
: '//' ~[\r\n]*
-> skip
;
|
check.adb
|
leo-brewin/Regge
| 0 |
2907
|
<reponame>leo-brewin/Regge<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
with regge;
with regge.io;
procedure check is
type Real is digits 18;
package regge_lib is new regge (Real); use regge_lib;
package regge_lib_io is new regge_lib.io; use regge_lib_io;
package Real_IO is new Ada.Text_IO.Float_IO (Real); use Real_IO;
package Integer_IO is new Ada.Text_IO.Integer_IO (Integer); use Integer_IO;
txt : File_Type;
defect : Real;
deriv : Real;
bone : Integer;
begin
num := read_command_arg (1);
read_lattice;
bone := 1;
bone_signature := get_signature (bone);
Create (txt,Out_file,"results/data-0"&str(num,1)&".txt");
get_defect (defect, bone, n_loop02(bone));
put_line (txt,"# defect");
put_line (txt, str(defect,25));
new_line (txt);
put_line (txt,"# i j d(defect)/d(lsq(i,j))");
for a in 1..n_simp1 loop
get_defect_deriv (deriv, bone, n_loop02(bone), a);
put_line (txt, str (simp01(a)(1),3) &' '&
str (simp01(a)(2),2) &' '&
str (deriv,25));
end loop;
Close (txt);
end check;
|
programs/oeis/055/A055364.asm
|
jmorken/loda
| 1 |
2101
|
; A055364: Number of asymmetric mobiles (circular rooted trees) with n nodes and 3 leaves.
; 1,4,10,22,42,73,119,184,272,389,540,731,969,1261,1614,2037,2538,3126,3811,4603,5512,6550,7728,9058,10553,12226,14090,16160,18450,20975,23751,26794,30120,33747,37692,41973,46609,51619,57022,62839,69090,75796,82979
mov $15,$0
mov $17,$0
add $17,1
lpb $17
clr $0,15
mov $0,$15
sub $17,1
sub $0,$17
mov $12,$0
mov $14,$0
add $14,1
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
add $11,1
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $2,$0
gcd $2,3
add $2,$0
mov $3,$2
div $3,2
mov $1,$3
mul $1,3
sub $1,3
div $1,3
add $1,1
add $10,$1
lpe
add $13,$10
lpe
add $16,$13
lpe
mov $1,$16
|
programs/oeis/271/A271062.asm
|
jmorken/loda
| 1 |
167853
|
<reponame>jmorken/loda
; A271062: Partial sums of the number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 261", based on the 5-celled von Neumann neighborhood.
; 1,9,10,58,59,179,180,404,405,765,766,1294,1295,2023,2024,2984,2985,4209,4210,5730,5731,7579,7580,9788,9789,12389,12390,15414,15415,18895,18896,22864,22865,27353,27354,32394,32395,38019,38020,44260,44261,51149,51150
mov $5,$0
mov $6,$0
add $6,1
lpb $6
mov $0,$5
sub $6,1
sub $0,$6
mov $4,$0
add $0,2
mov $7,$0
gcd $0,2
mov $2,8
add $4,7
lpb $0
sub $0,1
mov $3,$0
mov $0,0
sub $4,$2
add $4,$7
pow $4,2
sub $4,1
gcd $3,$4
lpe
add $1,$3
lpe
|
src/STLCRef/Semantics.agda
|
metaborg/mj.agda
| 10 |
2853
|
<reponame>metaborg/mj.agda
module STLCRef.Semantics where
-- This file contains the definitional interpreter for STLC+Ref
-- described in Section 3 of the paper.
open import Agda.Primitive
open import Data.Unit
open import Data.Nat hiding (_⊔_ ; _^_)
open import Data.Integer hiding (_⊔_)
open import Data.List
open import Data.List.Properties.Extra
open import Data.List.All.Properties.Extra
open import Data.List.Membership.Propositional
open import Data.List.Relation.Unary.Any
open import Data.List.Relation.Unary.All as All
open import Data.List.Prefix
open import Data.Product
open import Data.Maybe hiding (_>>=_)
open import Function
open import Common.Weakening
------------
-- SYNTAX --
------------
-- These definitions correspond to Section 3.1, except we have
-- included numbers (integers) and integer operations in the language.
data Ty : Set
Ctx = List Ty
data Ty where
_⇒_ : (a b : Ty) → Ty
unit : Ty
int : Ty
ref : Ty -> Ty
data Expr (Γ : List Ty) : Ty → Set where
unit : Expr Γ unit
var : ∀ {t} → t ∈ Γ → Expr Γ t
ƛ : ∀ {a b} → Expr (a ∷ Γ) b → Expr Γ (a ⇒ b)
_·_ : ∀ {a b} → Expr Γ (a ⇒ b) → Expr Γ a → Expr Γ b
num : ℤ → Expr Γ int
iop : (ℤ → ℤ → ℤ) → (l r : Expr Γ int) → Expr Γ int
ifz : ∀ {t} → Expr Γ int → Expr Γ t → Expr Γ t → Expr Γ t
ref : ∀ {t} → Expr Γ t → Expr Γ (ref t)
!_ : ∀ {t} → Expr Γ (ref t) → Expr Γ t
_≔_ : ∀ {t} → Expr Γ (ref t) → Expr Γ t → Expr Γ unit
-----------------------
-- STORES AND VALUES --
-----------------------
StoreTy = List Ty
mutual
data Val : Ty → (Σ : StoreTy) → Set where
loc : ∀ {Σ t} → t ∈ Σ → Val (ref t) Σ
unit : ∀ {Σ} → Val unit Σ
⟨_,_⟩ : ∀ {Σ Γ a b} → Expr (a ∷ Γ) b → Env Γ Σ → Val (a ⇒ b) Σ
num : ∀ {Σ} → ℤ → Val int Σ
Env : (Γ : Ctx)(Σ : StoreTy) → Set
Env Γ Σ = All (λ t → Val t Σ) Γ
Store : (Σ : StoreTy) → Set
Store Σ = All (λ t → Val t Σ) Σ
-- The `lookup-store` function is defined in terms of the `lookup`
-- function from `Data.List.All` in the Agda Standard Library.
lookup-store : ∀ {Σ t} → t ∈ Σ → Store Σ → Val t Σ
lookup-store x μ = All.lookup μ x
-- The `update-store` function is defined in terms of the update
-- function for the `All` type: `_All[_]≔'_` from the Standard Library
-- extension (contained in the `lib/*` folder of this artifact).
update-store : ∀ {Σ t} → t ∈ Σ → Val t Σ → Store Σ → Store Σ
update-store ptr v μ = μ All.[ ptr ]≔ v
-----------
-- MONAD --
-----------
-- These definitions correspond to Section 3.3.
M : ∀ {i}(Γ : Ctx) → (p : StoreTy → Set i) → (Σ : StoreTy) → Set i
M Γ p Σ = Env Γ Σ → Store Σ → Maybe (∃ λ Σ' → Store Σ' × p Σ' × Σ ⊑ Σ')
mutual
weaken-val : ∀ {a}{Σ Σ' : StoreTy} → Σ ⊑ Σ' → Val a Σ → Val a Σ'
weaken-val ext unit = unit
weaken-val ext (loc l) = loc (∈-⊒ l ext)
weaken-val ext ⟨ e , E ⟩ = ⟨ e , weaken-env ext E ⟩
weaken-val ext (num z) = num z
weaken-env : ∀ {Γ}{Σ Σ' : StoreTy} → Σ ⊑ Σ' → Env Γ Σ → Env Γ Σ'
weaken-env ext (v ∷ vs) = weaken-val ext v ∷ weaken-env ext vs
weaken-env ext [] = []
-- The definition below asserts that values can be weakened, by adding
-- an instance argument of `Weakenable (Val t)`.
--
-- Here, `Weakenable` is defined as in the paper Section 3.4; see
-- `Common.Weakening` in this artifact.
instance
weaken-val' : ∀ {t} → Weakenable (Val t)
weaken-val' = record { wk = weaken-val }
return : ∀ {Σ Γ}{p : List Ty → Set} → p Σ → M Γ p Σ
return x E μ = just (_ , μ , x , ⊑-refl)
_>>=_ : ∀ {Σ Γ}{p q : StoreTy → Set} →
(f : M Γ p Σ) → (g : ∀ {Σ'} → p Σ' → M Γ q Σ') → M Γ q Σ
(f >>= c) E μ = case (f E μ) of λ{
nothing → nothing ;
(just (_ , μ' , x , ext)) → case (c x (weaken-env ext E) μ') of λ{
nothing → nothing ;
(just (_ , μ'' , y , ext')) → just (_ , μ'' , y , ext ⊚ ext')
}}
getEnv : ∀ {Σ Γ} → M Γ (Env Γ) Σ
getEnv E = return E E
usingEnv : ∀ {Σ Γ Γ'}{p : List Ty → Set} → Env Γ Σ → M Γ p Σ → M Γ' p Σ
usingEnv E f _ = f E
timeout : ∀ {Σ Γ}{p : List Ty → Set} → M Γ p Σ
timeout _ _ = nothing
store : ∀ {Σ t Γ} → Val t Σ → M Γ (Val (ref t)) Σ
store {Σ} {t} v _ μ
= let ext = ∷ʳ-⊒ t Σ
v' = loc (∈-∷ʳ Σ t)
μ' = (All.map (weaken-val ext) μ) all-∷ʳ (weaken-val ext v)
in just (_ , μ' , v' , ext)
deref : ∀ {Σ Γ t} → t ∈ Σ → M Γ (Val t) Σ
deref x E μ = return (All.lookup μ x) E μ
update : ∀ {Σ Γ t} → t ∈ Σ → Val t Σ → M Γ (λ _ → ⊤) Σ
update x v E μ = return tt E (update-store x v μ)
weaken : ∀ {i}{p : List Ty → Set i}⦃ w : Weakenable p ⦄ → ∀ {Σ Σ'} → Σ ⊑ Σ' → p Σ → p Σ'
weaken ⦃ w ⦄ ext v = Weakenable.wk w ext v
--------------------------------
-- STRONG MONADIC INTERPRETER --
--------------------------------
-- These definitions correspond to Section 3.4.
--
-- The definition of `_^_` below is defined in terms of the `_⊗_`
-- type, which is defined in `Common.Weakening` in this artifact.
_^_ : ∀ {Σ Γ}{p q : StoreTy → Set} → ⦃ w : Weakenable q ⦄ → M Γ p Σ → q Σ → M Γ (p ⊗ q) Σ
(f ^ x) E μ = case (f E μ) of λ {
nothing → nothing ;
(just (Σ , μ' , y , ext)) → just (Σ , μ' , (y , weaken ext x) , ext) }
eval : ℕ → ∀ {Σ Γ t} → Expr Γ t → M Γ (Val t) Σ
eval zero _ =
timeout
eval (suc k) unit =
return unit
eval (suc k) (var x) =
getEnv >>= λ E →
return (All.lookup E x)
eval (suc k) (ƛ e) =
getEnv >>= λ E →
return ⟨ e , E ⟩
eval (suc k) (l · r) =
eval k l >>= λ{ ⟨ e , E ⟩ →
(eval k r ^ E) >>= λ{ (v , E) →
usingEnv (v ∷ E) (eval k e) }}
eval (suc k) (num x) =
return (num x)
eval (suc k) (iop f l r) =
eval k l >>= λ{ (num vₗ) →
eval k r >>= λ{ (num vᵣ) →
return (num (f vₗ vᵣ)) }}
eval (suc k) (ifz c t e) =
eval k c >>= λ{ (num z) →
case z of λ{ (+ zero) →
eval k t
; _ →
eval k e }}
eval (suc k) (ref e) =
eval k e >>= λ v →
store v
eval (suc k) (! e) =
eval k e >>= λ{ (loc l) →
deref l }
eval (suc k) (r ≔ e) =
eval k r >>= λ{ (loc l) →
(eval k e ^ l) >>= λ{ (v , l) →
update l v >>= λ _ →
return unit }}
|
programs/oeis/164/A164907.asm
|
karttu/loda
| 1 |
167955
|
; A164907: a(n) = (3*3^n-(-1)^n)/2.
; 1,5,13,41,121,365,1093,3281,9841,29525,88573,265721,797161,2391485,7174453,21523361,64570081,193710245,581130733,1743392201,5230176601,15690529805,47071589413,141214768241,423644304721,1270932914165,3812798742493,11438396227481,34315188682441,102945566047325,308836698141973,926510094425921,2779530283277761,8338590849833285
mov $1,3
pow $1,$0
mul $1,6
div $1,16
mul $1,4
add $1,1
|
C vs Assembly/power.asm
|
zakarialaoui10/HIGH-TO-LOW
| 18 |
242774
|
read_x:li $v0,5
syscall
la $s0,($v0)
read_n:li $v0,5
syscall
la $s1,($v0)
li $s2,1 #p
li $t0,0
loop:
beq $t0,3,print
mult $s2,$s0
mflo $s2
addi $t0,$t0,1
j loop
print:
li $v0,1
move $a0,$s2
syscall
|
Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca.log_21829_1005.asm
|
ljhsiun2/medusa
| 9 |
100941
|
<filename>Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca.log_21829_1005.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x76b9, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
inc %r11
mov $0x6162636465666768, %r9
movq %r9, %xmm2
vmovups %ymm2, (%rbx)
nop
and $59356, %rdi
lea addresses_WC_ht+0x17ec3, %rcx
nop
nop
xor $45152, %rdx
movb $0x61, (%rcx)
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WC_ht+0x96e5, %rsi
lea addresses_normal_ht+0x6703, %rdi
clflush (%rsi)
nop
nop
nop
add %rbx, %rbx
mov $66, %rcx
rep movsw
nop
nop
nop
xor $7308, %r9
lea addresses_UC_ht+0x1eec3, %r15
sub $25176, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
and $0xffffffffffffffc0, %r15
movaps %xmm0, (%r15)
inc %rcx
lea addresses_normal_ht+0x1142b, %rsi
nop
nop
nop
and $39107, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rsi)
nop
nop
and $32453, %rsi
lea addresses_WC_ht+0x11e6b, %rsi
lea addresses_normal_ht+0x14ec3, %rdi
nop
nop
cmp $59641, %r9
mov $59, %rcx
rep movsb
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0x1aa16, %rsi
nop
cmp $33597, %rdx
movb $0x61, (%rsi)
and $62063, %r11
lea addresses_UC_ht+0x176c3, %r9
nop
sub $5640, %r11
mov $0x6162636465666768, %rsi
movq %rsi, (%r9)
nop
nop
nop
nop
nop
sub $30820, %rsi
lea addresses_A_ht+0xe3f9, %rsi
lea addresses_WC_ht+0x7fe3, %rdi
nop
xor %r11, %r11
mov $15, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x11b03, %rdi
nop
nop
nop
xor %rsi, %rsi
mov (%rdi), %ecx
nop
nop
nop
nop
add $652, %r9
lea addresses_WC_ht+0xdac3, %rsi
lea addresses_A_ht+0x151e5, %rdi
clflush (%rdi)
cmp %rdx, %rdx
mov $25, %rcx
rep movsb
nop
nop
nop
nop
and $53646, %rbx
lea addresses_normal_ht+0x80c3, %rsi
lea addresses_WC_ht+0x169c7, %rdi
clflush (%rsi)
nop
nop
and $6061, %rbx
mov $32, %rcx
rep movsb
nop
sub $52274, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdx
// Store
lea addresses_normal+0x1be03, %r13
sub %rax, %rax
movb $0x51, (%r13)
inc %rax
// Store
mov $0x49f6180000000ec3, %rax
nop
nop
sub $9227, %rdx
movl $0x51525354, (%rax)
nop
nop
and %r9, %r9
// Store
lea addresses_A+0x1edc3, %r13
nop
cmp %rdx, %rdx
movb $0x51, (%r13)
nop
nop
xor %rcx, %rcx
// Store
mov $0x2b40ed0000000c03, %r13
nop
nop
nop
cmp $8413, %rcx
movw $0x5152, (%r13)
add %rcx, %rcx
// Store
mov $0x6f6c0c00000008d3, %r15
clflush (%r15)
cmp %rdx, %rdx
movl $0x51525354, (%r15)
nop
nop
and $32825, %r8
// Faulty Load
mov $0x49f6180000000ec3, %r9
nop
nop
nop
sub %rcx, %rcx
movups (%r9), %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %r15
and $0xff, %r8
shlq $12, %r8
mov (%r15,%r8,1), %r8
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': True, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 2}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': True, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}}
{'44': 3, '45': 188, '4c': 1, '00': 21474, '48': 163}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00
*/
|
programs/oeis/109/A109765.asm
|
neoneye/loda
| 22 |
15504
|
; A109765: Expansion of x/((4*x-1)*(2*x-1)*(x+1)).
; 0,1,5,23,97,399,1617,6511,26129,104687,419089,1677039,6709521,26840815,107368721,429485807,1717965073,6871903983,27487703313,109950988015,439804301585,1759217905391,7036873019665,28147494874863
lpb $0
mov $2,$0
trn $0,2
seq $2,165665 ; a(n) = (3*2^n - 2) * 2^n.
add $1,$2
lpe
div $1,8
mov $0,$1
|
Assignment 5 submission/a5a.asm
|
vridhid/CPSC355
| 0 |
6230
|
<gh_stars>0
// GLOBAL VARIABLES
MAXOP = 20 // Maxop == 20
NUMBER = 0 // Number == 0
TOOBIG = 9 // Toobig == 9
MAXVAL = 100 // Maxval == 100
// PRINT STATEMENTS THROUGHOUT THE CODE
stackFull: .string "error: stack full\n"
stackEmpty: .string "error: stack empty\n"
ungetch: .string "ungetch: too many characters\n"
.data
sp: .word 0
.bss // bss section starts
val: .skip MAXVAL * 4 // queue int array global variable
.text
.balign 4
.global push // make push global
.global pop // make pop global
.global clear // make clear global
//PUSH()
push:
stp x29, x30, [sp, -16]! // allocate memory
mov x29, sp // update x29
mov w10, w0 // place value of input f into w9
adrp x11, sp // place sp address in x11 register
add x11, x11, :lo12:sp // format lower 12 bits correctly
ldr w11, [x11] // set w11 to the value of x11
adrp x12, val // place val address in x12 register
add x12, x12, :lo12:val // format lower 12 bits correctly
ldr w12, [x12] // set w12 to the value of x12
cmp w11, MAXVAL // compare sp and MAXVAL
b.ge push_else // if sp >= MAXVAL jump to push_else, else continue down
add w11, w11, 1 // sp--: sp, sp, 1 (add 1 to sp)
str w11, [x11] // replace new sp entry with old one
str w10, [x12, w11, SXTW 2] // f = val[sp++]; sp has already been incremented and value is placed into f
b push_ret // now go branch to push_ret to end function
push_else:
adrp x9, stackFull // print error message: "error: stack full\n"
add x9, x9, :lo12:stackFull // add string to x9 register
bl printf // print message
bl clear // branch to clear function
mov w0, 0 // get function to return 0
push_ret:
ldp x29, x30, [sp], 16 // de-allocate memory
ret // return to main function
//POP()
pop:
stp x29, x30, [sp, -16]! // allocate memory
mov x29, sp // update x29
adrp x11, sp // place sp address in x11 register
add x11, x11, :lo12:sp // format lower 12 bits correctly
ldr w11, [x11] // set w11 to the value of x11
cmp w11, 0 // compare sp and 0
b.gt pop_else // if sp > 0 jump to pop_else, else continue down
adrp x9, stackEmpty // print error message: "error: stack empty\n"
add x9, x9, :lo12:stackEmpty // add string to x9 register
bl printf // print message
bl clear // branch to clear function
mov w0, 0 // get function to return 0
b pop_ret
pop_else:
sub w11, w11, 1 // sp--: sp, sp, 1 (subtract 1 from sp)
adrp x12, val // place val address in x10 register
add x12, x12, :lo12:val // format lower 12 bits correctly
ldr w12, [x12, w11, SXTW 2] // set w12 to the value of val[--sp]
mov w0, w11 // get function to return w0 which holds val[--sp] now
pop_ret:
ldp x29, x30, [sp], 16 // de-allocate memory
ret // return to main function
//CLEAR()
clear:
stp x29, x30, [sp, -16]! // allocate memory
mov x29, sp // update x29
adrp x11, sp // place sp address in x11 register
add x11, x11, :lo12:sp // format lower 12 bits correctly
ldr w11, [x11] // set w11 to the value of x11
mov w11, 0 // sp = 0: move 0 into w11
str w11, [x11] // Store new value of sp into memory.
ldp x29, x30, [sp], 16 // de-allocate memory
ret // return to main function
|
alloy4fun_models/trashltl/models/17/sfuA7iJpdTkSXqaXG.als
|
Kaixi26/org.alloytools.alloy
| 0 |
4658
|
<reponame>Kaixi26/org.alloytools.alloy<gh_stars>0
open main
pred idsfuA7iJpdTkSXqaXG_prop18 {
all f: File | (f not in Protected releases f in Trash)
}
pred __repair { idsfuA7iJpdTkSXqaXG_prop18 }
check __repair { idsfuA7iJpdTkSXqaXG_prop18 <=> prop18o }
|
Transynther/x86/_processed/NC/_ht_/i3-7100_9_0x84_notsx.log_21829_473.asm
|
ljhsiun2/medusa
| 9 |
7508
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1d729, %r9
nop
nop
nop
nop
add %r12, %r12
mov (%r9), %r10w
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_D_ht+0x7791, %rsi
lea addresses_normal_ht+0x1d13b, %rdi
nop
nop
nop
add $55783, %r11
mov $11, %rcx
rep movsq
and %r10, %r10
lea addresses_WT_ht+0x10a0d, %rsi
lea addresses_A_ht+0x18069, %rdi
nop
nop
sub %r10, %r10
mov $99, %rcx
rep movsq
dec %r12
lea addresses_UC_ht+0x1b469, %rsi
nop
nop
nop
nop
nop
inc %r10
vmovups (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdi
nop
nop
nop
nop
nop
dec %rdi
lea addresses_UC_ht+0xddd, %rsi
nop
nop
nop
nop
nop
add $17403, %rcx
movw $0x6162, (%rsi)
and $58900, %r12
lea addresses_normal_ht+0x34b9, %rsi
lea addresses_A_ht+0x16a9, %rdi
clflush (%rsi)
nop
cmp $46862, %r11
mov $127, %rcx
rep movsl
nop
nop
nop
nop
and $42401, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r9
push %rdi
push %rdx
push %rsi
// Load
lea addresses_RW+0x10da9, %r13
nop
nop
nop
xor %r15, %r15
movups (%r13), %xmm1
vpextrq $0, %xmm1, %rsi
sub $59259, %r13
// Store
lea addresses_A+0x10faf, %r9
nop
nop
nop
nop
nop
sub %rdx, %rdx
movl $0x51525354, (%r9)
cmp %rdi, %rdi
// Store
lea addresses_WT+0x1289, %r12
clflush (%r12)
nop
nop
sub $7705, %rsi
mov $0x5152535455565758, %rdi
movq %rdi, %xmm5
and $0xffffffffffffffc0, %r12
movntdq %xmm5, (%r12)
nop
sub %r9, %r9
// Faulty Load
mov $0xb05c700000006a9, %r9
nop
nop
nop
and $16585, %rdx
vmovups (%r9), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r13
lea oracles, %rdi
and $0xff, %r13
shlq $12, %r13
mov (%rdi,%r13,1), %r13
pop %rsi
pop %rdx
pop %rdi
pop %r9
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'49': 387, '47': 889, '44': 20553}
44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 47 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 47 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 47 44 44 44 44 44 44 44 47 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 47 44 47 44 44 47 44 44 44 44 47 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 47 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 47 44 44 44 47 44 44 44 44 47 44 44 44 47 44 44 47 47 44 44 44 44 44 44 44 44 44 44 44 44 47 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 47 44 44 47 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 47 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 47 44 44 44 44 47 44 47 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 47 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 47 47 44 44 44 47 44 44 44 44 44 44 47 47 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 47 44 44 44 44 44 44 47 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44
*/
|
llvm-gcc-4.2-2.9/gcc/ada/s-tfsetr-default.adb
|
vidkidz/crossbridge
| 1 |
15439
|
<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T R A C E S . S E N D --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This version is for all targets, provided that System.IO.Put_Line is
-- functional. It prints debug information to Standard Output
with System.IO; use System.IO;
with GNAT.Regpat; use GNAT.Regpat;
----------------
-- Send_Trace --
----------------
-- Prints debug information both in a human readable form
-- and in the form they are sent from upper layers.
separate (System.Traces.Format)
procedure Send_Trace (Id : Trace_T; Info : String) is
type Param_Type is
(Name_Param,
Caller_Param,
Entry_Param,
Timeout_Param,
Acceptor_Param,
Parent_Param,
Number_Param);
-- Type of parameter found in the message
Info_Trace : String_Trace := Format_Trace (Info);
function Get_Param
(Input : String_Trace;
Param : Param_Type;
How_Many : Integer)
return String;
-- Extract a parameter from the given input string
---------------
-- Get_Param --
---------------
function Get_Param
(Input : String_Trace;
Param : Param_Type;
How_Many : Integer)
return String
is
pragma Unreferenced (How_Many);
Matches : Match_Array (1 .. 2);
begin
-- We need comments here ???
case Param is
when Name_Param =>
Match ("/N:([\w]+)", Input, Matches);
when Caller_Param =>
Match ("/C:([\w]+)", Input, Matches);
when Entry_Param =>
Match ("/E:([\s]*) +([0-9 ,]+)", Input, Matches);
when Timeout_Param =>
Match ("/T:([\s]*) +([0-9]+.[0-9]+)", Input, Matches);
when Acceptor_Param =>
Match ("/A:([\w]+)", Input, Matches);
when Parent_Param =>
Match ("/P:([\w]+)", Input, Matches);
when Number_Param =>
Match ("/#:([\s]*) +([0-9]+)", Input, Matches);
end case;
if Matches (1).First < Input'First then
return "";
end if;
case Param is
when Timeout_Param | Entry_Param | Number_Param =>
return Input (Matches (2).First .. Matches (2).Last);
when others =>
return Input (Matches (1).First .. Matches (1).Last);
end case;
end Get_Param;
-- Start of processing for Send_Trace
begin
New_Line;
Put_Line ("- Trace Debug Info ----------------");
Put ("Caught event Id : ");
case Id is
when M_Accept_Complete => Put ("M_Accept_Complete");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " completes accept on entry "
& Get_Param (Info_Trace, Entry_Param, 1) & " with "
& Get_Param (Info_Trace, Caller_Param, 1));
when M_Select_Else => Put ("M_Select_Else");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " selects else statement");
when M_RDV_Complete => Put ("M_RDV_Complete");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " completes rendezvous with "
& Get_Param (Info_Trace, Caller_Param, 1));
when M_Call_Complete => Put ("M_Call_Complete");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " completes call");
when M_Delay => Put ("M_Delay");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " completes delay "
& Get_Param (Info_Trace, Timeout_Param, 1));
when E_Missed => Put ("E_Missed");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " got an invalid acceptor "
& Get_Param (Info_Trace, Acceptor_Param, 1));
when E_Timeout => Put ("E_Timeout");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " ends select due to timeout ");
when E_Kill => Put ("E_Kill");
New_Line;
Put_Line ("Asynchronous Transfer of Control on task "
& Get_Param (Info_Trace, Name_Param, 1));
when W_Delay => Put ("W_Delay");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " sleeping "
& Get_Param (Info_Trace, Timeout_Param, 1)
& " seconds");
when WU_Delay => Put ("WU_Delay");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " sleeping until "
& Get_Param (Info_Trace, Timeout_Param, 1));
when W_Call => Put ("W_Call");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " calling entry "
& Get_Param (Info_Trace, Entry_Param, 1)
& " of " & Get_Param (Info_Trace, Acceptor_Param, 1));
when W_Accept => Put ("W_Accept");
New_Line;
Put ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " waiting on "
& Get_Param (Info_Trace, Number_Param, 1)
& " accept(s)"
& ", " & Get_Param (Info_Trace, Entry_Param, 1));
New_Line;
when W_Select => Put ("W_Select");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " waiting on "
& Get_Param (Info_Trace, Number_Param, 1)
& " select(s)"
& ", " & Get_Param (Info_Trace, Entry_Param, 1));
New_Line;
when W_Completion => Put ("W_Completion");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " waiting for completion ");
when WT_Select => Put ("WT_Select");
New_Line;
Put ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " waiting " & Get_Param (Info_Trace, Timeout_Param, 1)
& " seconds on "
& Get_Param (Info_Trace, Number_Param, 1)
& " select(s)");
if Get_Param (Info_Trace, Number_Param, 1) /= "" then
Put (", " & Get_Param (Info_Trace, Entry_Param, 1));
end if;
New_Line;
when WT_Call => Put ("WT_Call");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " calling entry "
& Get_Param (Info_Trace, Entry_Param, 1)
& " of " & Get_Param (Info_Trace, Acceptor_Param, 1)
& " with timeout "
& Get_Param (Info_Trace, Timeout_Param, 1));
when WT_Completion => Put ("WT_Completion");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " waiting "
& Get_Param (Info_Trace, Timeout_Param, 1)
& " for call completion");
when PO_Call => Put ("PO_Call");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " calling protected entry "
& Get_Param (Info_Trace, Entry_Param, 1));
when POT_Call => Put ("POT_Call");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " calling protected entry "
& Get_Param (Info_Trace, Entry_Param, 1)
& " with timeout "
& Get_Param (Info_Trace, Timeout_Param, 1));
when PO_Run => Put ("PO_Run");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " running entry "
& Get_Param (Info_Trace, Entry_Param, 1)
& " for "
& Get_Param (Info_Trace, Caller_Param, 1));
when PO_Done => Put ("PO_Done");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " finished call from "
& Get_Param (Info_Trace, Caller_Param, 1));
when PO_Lock => Put ("PO_Lock");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " took lock");
when PO_Unlock => Put ("PO_Unlock");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " released lock");
when T_Create => Put ("T_Create");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " created");
when T_Activate => Put ("T_Activate");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " activated");
when T_Abort => Put ("T_Abort");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " aborted by "
& Get_Param (Info_Trace, Parent_Param, 1));
when T_Terminate => Put ("T_Terminate");
New_Line;
Put_Line ("Task " & Get_Param (Info_Trace, Name_Param, 1)
& " terminated");
when others
=> Put ("Invalid Id");
end case;
Put_Line (" --> " & Info_Trace);
Put_Line ("-----------------------------------");
New_Line;
end Send_Trace;
|
theories/alloy/PWSSyntax.als
|
pascalpoizat/fbpmn
| 27 |
4043
|
<reponame>pascalpoizat/fbpmn
module PWSSyntax
open util/boolean
/**** Message Names ****/
abstract sig Message {}
/**** Time ****/
/* Timer nodes have a constraint that can be a date, a duration, or a
duration with a repetition factor. In this last case, it can also have a
starting date xor an ending date.
TSE can only have a Date, TICE can have Date or Duration, TBE any one.
*/
abstract sig Date {
date : one Int
}
abstract sig Duration {
duration : one Int
}
abstract sig CycleDuration extends Duration {
repetition : one Int,
}
abstract sig CycleStart extends CycleDuration {
startdate : one Int
}
abstract sig CycleEnd extends CycleDuration {
enddate : one Int
}
/**************** Nodes ****************/
abstract sig Node {}
abstract sig Container extends Node {
contains: set Node
}
fact ContainerNotReflexive { no p : Container | p in p.^contains }
fact NoFreeNode { all n : Node - Process | one p : Container | n in p.contains }
abstract sig Process extends Container {}
/** Activities **/
abstract sig Task extends Node {}
abstract sig AbstractTask extends Task {}
abstract sig SendTask extends Task {}
abstract sig ReceiveTask extends Task {}
abstract sig SubProcess extends Container {}
/** Gateways **/
abstract sig Gateway extends Node {}
abstract sig ExclusiveOr extends Gateway {}
abstract sig Parallel extends Gateway {}
abstract sig InclusiveOr extends Gateway {}
abstract sig EventBased extends Gateway {}
/**** Events ****/
abstract sig Event extends Node {}
/** Start Events **/
abstract sig StartEvent extends Event {}
abstract sig NoneStartEvent extends StartEvent {}
abstract sig MessageStartEvent extends StartEvent {}
abstract sig TimerStartEvent extends StartEvent {
mode : one Date
}
/** End Events */
abstract sig EndEvent extends Event {}
abstract sig NoneEndEvent extends EndEvent {}
abstract sig TerminateEndEvent extends EndEvent {}
abstract sig MessageEndEvent extends EndEvent {}
/** Intermediate Events */
abstract sig IntermediateEvent extends Event {}
abstract sig ThrowMessageIntermediateEvent extends IntermediateEvent {}
abstract sig CatchMessageIntermediateEvent extends IntermediateEvent {}
abstract sig TimerIntermediateEvent extends IntermediateEvent {
mode : one (Date + Duration),
}
/** Boundary Events */
abstract sig BoundaryEvent extends Event {
attachedTo : one (Task + SubProcess),
interrupting : one Bool
}
abstract sig MessageBoundaryEvent extends BoundaryEvent {}
abstract sig TimerBoundaryEvent extends BoundaryEvent {
mode : one (Date + Duration)
}
/**************** Edges ****************/
abstract sig Edge {
source: one Node,
target: one Node
}
abstract sig SequentialFlow extends Edge {}
abstract sig NormalSequentialFlow extends SequentialFlow {}
abstract sig DefaultSequentialFlow extends SequentialFlow {}
abstract sig ConditionalSequentialFlow extends SequentialFlow {}
abstract sig MessageFlow extends Edge {
message: one Message
}
// process of this node
fun Node.processOf : Process {
this.^(~contains) & Process
}
|
Mixfix/Acyclic/PrecedenceGraph.agda
|
yurrriq/parser-combinators
| 7 |
3909
|
------------------------------------------------------------------------
-- Acyclic precedence graphs
------------------------------------------------------------------------
module Mixfix.Acyclic.PrecedenceGraph where
open import Data.List
open import Data.Product
open import Mixfix.Fixity
open import Mixfix.Operator
open import Mixfix.Expr
-- Precedence graphs are represented by their unfoldings as forests
-- (one tree for every node in the graph). This does not take into
-- account the sharing of the precedence graphs, but this code is
-- not aimed at efficiency.
-- Precedence trees.
data Precedence : Set where
precedence : (o : (fix : Fixity) → List (∃ (Operator fix)))
(s : List Precedence) →
Precedence
-- Precedence forests.
PrecedenceGraph : Set
PrecedenceGraph = List Precedence
-- The operators of the given precedence.
ops : Precedence → (fix : Fixity) → List (∃ (Operator fix))
ops (precedence o s) = o
-- The immediate successors of the precedence level.
↑ : Precedence → List Precedence
↑ (precedence o s) = s
-- Acyclic precedence graphs.
acyclic : PrecedenceGraphInterface
acyclic = record
{ PrecedenceGraph = PrecedenceGraph
; Precedence = λ _ → Precedence
; ops = λ _ → ops
; ↑ = λ _ → ↑
; anyPrecedence = λ g → g
}
|
test/Fail/Issue821.agda
|
hborum/agda
| 3 |
5346
|
-- Andreas, 2013-03-15 issue reported by Nisse
-- {-# OPTIONS -v tc.proj:40 -v tc.conv.elim:40 #-}
module Issue821 where
import Common.Level
data D (A : Set) : Set where
c : D A → D A
f : (A : Set) → D A → D A
f A (c x) = x
postulate
A : Set
P : D A → Set
x : D A
p : P x
Q : P (f A x) → Set
Foo : Set₁
Foo = Q p
-- An internal error has occurred. Please report this as a bug.
-- Location of the error: src/full/Agda/TypeChecking/Conversion.hs:466
-- Reason was that f is projection-like so the test x =?= f A x
-- actually becomes x =?= x .f with unequal spine shapes (empty vs. non-empty).
-- Agda thought this was impossible.
|
kv.ads
|
davidkristola/vole
| 4 |
29163
|
package kv is
pragma Pure;
end kv;
|
programs/oeis/103/A103202.asm
|
jmorken/loda
| 1 |
172368
|
<reponame>jmorken/loda
; A103202: A102370 sorted.
; 0,3,4,5,6,8,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88
mov $2,$0
add $2,3
sub $3,$2
sub $3,7
add $3,$2
sub $0,$3
div $3,$2
add $3,$0
add $3,1
mov $1,$3
mov $4,1
lpb $0
div $0,2
add $4,1
lpe
add $1,$4
sub $1,10
|
src/neogs.asm
|
LessNick/CLi-for-WildCommander
| 8 |
179730
|
;---------------------------------------
; NeoGS (General Sound) Library
;---------------------------------------
_uploadGsByte in a,(c)
rlca
jr c,uploadGsByte
ld a,(hl)
out (pDataOutReg),a
inc hl
ret
;---------------------------------------
_initGS ld a,cReset
out (pReset),a
ld b,tReset
ei
halt
djnz $-2
ret
;---------------------------------------
_detectGS in a,(pDataInReg)
ld b,#00
ld c,a
stab in a,(pDataInReg)
cp c
jr nz,wse
djnz stab
ld a,cGetRAMPages
out (pCmdReg),a
ld bc,#0f00
dik dec bc
ld a,b
or c
jr z,wse
in a,(pStatusReg)
rrca
jr c,dik
in a,(pDataInReg)
cp #03
jr c,wse
ld a,#01
out (pDataOutReg),a
ld a,#6a
call sendWaitGsCmd
xor a
out (pDataOutReg),a
ld a,#6b
call sendWaitGsCmd
xor a
wze ld (gsStatus),a
push af
ld a,#f3
call sendGsCmd
pop af
ret
wse ld a,#01
or a
jr wze
;---------------------------------------
_sendGsCmd out (pCmdReg),a
ret
_sendWaitGsCmd out (pCmdReg),a
gswc in a,(pStatusReg)
rrca
jr c,gswc
ret
;-------
gwc in a,(pStatusReg)
rrca
ret
;-------
getdat in a,(pStatusReg)
rlca
jr nc,getdat
in a,(pDataInReg)
ret
;-------
muteGs ld a,#f3
jr _sendGsCmd
;-------
playGs ld a,#31
jr _sendGsCmd
;-------
gsStatus db #FF
|
sources/ada/magics-alr.adb
|
reznikmm/jupyter
| 4 |
10313
|
<gh_stars>1-10
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
----------------------------------------------------------------
with Ada.Characters.Wide_Wide_Latin_1;
with Ada.Exceptions;
with Ada.Streams;
with Ada.Wide_Wide_Text_IO;
with League.JSON.Objects;
with League.JSON.Values;
with League.Stream_Element_Vectors;
with League.String_Vectors;
with League.Text_Codecs;
with League.Regexps;
with Spawn.Processes.Monitor_Loop;
with Spawn.Processes;
with Spawn.String_Vectors;
with Jupyter.Kernels;
with Processes;
procedure Magics.ALR
(IO_Pub : not null Jupyter.Kernels.IO_Pub_Access;
ALR : League.Strings.Universal_String;
Dir : League.Strings.Universal_String;
Args : League.String_Vectors.Universal_String_Vector;
Env : in out Processes.Environment;
Silent : Boolean)
is
procedure Write (Text : League.Strings.Universal_String);
-- Write text to jupyter
procedure Execute (Ok : in out Boolean);
-- Execute ALR with Args in Dir
procedure ALR_Print_Env;
-- Execute ALR printenv
procedure Parse_Line (Line : League.Strings.Universal_String);
Codec : constant League.Text_Codecs.Text_Codec :=
League.Text_Codecs.Codec_For_Application_Locale;
Pattern : constant League.Regexps.Regexp_Pattern :=
League.Regexps.Compile
(+"^export\ ([A-Za-z0-9_\-]+)\=\""(.*)\""$");
package Base is
type Listener is abstract limited new Spawn.Processes.Process_Listener
with record
Process : Spawn.Processes.Process;
Error : League.Stream_Element_Vectors.Stream_Element_Vector;
Done : Boolean := False;
Ok : Boolean := False;
end record;
overriding procedure Standard_Input_Available (Self : in out Listener)
is null;
overriding procedure Started (Self : in out Listener) is null;
overriding procedure Finished
(Self : in out Listener;
Exit_Status : Spawn.Processes.Process_Exit_Status;
Exit_Code : Spawn.Processes.Process_Exit_Code);
overriding procedure Error_Occurred
(Self : in out Listener;
Process_Error : Integer);
overriding procedure Exception_Occurred
(Self : in out Listener;
Occurrence : Ada.Exceptions.Exception_Occurrence);
overriding procedure Standard_Error_Available (Self : in out Listener);
end Base;
package body Base is
--------------------
-- Error_Occurred --
--------------------
procedure Error_Occurred
(Self : in out Listener;
Process_Error : Integer)
is
pragma Unreferenced (Self);
Result : League.Strings.Universal_String;
begin
Result.Append (+"Unexpected error:");
Result.Append (+Integer'Wide_Wide_Image (Process_Error));
Write (Result);
end Error_Occurred;
------------------------
-- Exception_Occurred --
------------------------
procedure Exception_Occurred
(Self : in out Listener;
Occurrence : Ada.Exceptions.Exception_Occurrence)
is
Result : League.Strings.Universal_String;
begin
Result.Append ("Exception: ");
Result.Append
(League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Name (Occurrence)));
Result.Append (Ada.Characters.Wide_Wide_Latin_1.LF);
Result.Append
(League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Message (Occurrence)));
Self.Done := True;
Write (Result);
end Exception_Occurred;
--------------
-- Finished --
--------------
procedure Finished
(Self : in out Listener;
Exit_Status : Spawn.Processes.Process_Exit_Status;
Exit_Code : Spawn.Processes.Process_Exit_Code)
is
use all type Spawn.Processes.Process_Exit_Status;
Result : League.Strings.Universal_String;
begin
if Exit_Status = Normal then
Self.Ok := True;
else
Result.Append (+"Exit code: ");
Result.Append (+Exit_Code'Wide_Wide_Image);
Write (Result);
end if;
Self.Done := True;
end Finished;
------------------------------
-- Standard_Error_Available --
------------------------------
procedure Standard_Error_Available (Self : in out Listener) is
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Count;
Data : Ada.Streams.Stream_Element_Array (1 .. 512);
Last : Ada.Streams.Stream_Element_Count;
Tail : Ada.Streams.Stream_Element_Count := 0;
begin
loop
Self.Process.Read_Standard_Error (Data, Last);
exit when Last < Data'First;
for J in reverse 1 .. Last loop
if Data (J) <= 16#7F# then
Self.Error.Append (Data (1 .. J));
Tail := J + 1;
exit;
elsif Data (J) >= 16#C0# then
Self.Error.Append (Data (1 .. J - 1));
Tail := J;
end if;
end loop;
end loop;
Write (Codec.Decode (Self.Error));
Self.Error.Clear;
Self.Error.Append (Data (Tail .. Last));
end Standard_Error_Available;
end Base;
procedure ALR_Print_Env is
type Listener is new Base.Listener with record
Output : League.Stream_Element_Vectors.Stream_Element_Vector;
Status : Integer := 0;
end record;
procedure Standard_Output_Available (Self : in out Listener);
-------------------------------
-- Standard_Output_Available --
-------------------------------
procedure Standard_Output_Available (Self : in out Listener) is
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Count;
Data : Ada.Streams.Stream_Element_Array (1 .. 512);
Last : Ada.Streams.Stream_Element_Count;
begin
loop
Self.Process.Read_Standard_Output (Data, Last);
for J in 1 .. Last loop
if Data (J) = 16#0A# then
Parse_Line (Codec.Decode (Self.Output));
Self.Output.Clear;
else
Self.Output.Append (Data (J));
end if;
end loop;
exit when Last < Data'First;
end loop;
end Standard_Output_Available;
Feedback : aliased Listener;
Process : Spawn.Processes.Process renames Feedback.Process;
Params : Spawn.String_Vectors.UTF_8_String_Vector;
begin
Params.Append ("printenv");
Process.Set_Arguments (Params);
Process.Set_Working_Directory (Dir.To_UTF_8_String);
Process.Set_Program (ALR.To_UTF_8_String);
Process.Set_Listener (Feedback'Unchecked_Access);
Process.Start;
while not Feedback.Done loop
Spawn.Processes.Monitor_Loop (Timeout => 50);
end loop;
end ALR_Print_Env;
procedure Execute (Ok : in out Boolean) is
type Listener is new Base.Listener with record
Output : League.Stream_Element_Vectors.Stream_Element_Vector;
Write : Boolean := True;
end record;
overriding procedure Standard_Output_Available (Self : in out Listener);
overriding procedure Finished
(Self : in out Listener;
Exit_Status : Spawn.Processes.Process_Exit_Status;
Exit_Code : Spawn.Processes.Process_Exit_Code);
overriding procedure Error_Occurred
(Self : in out Listener;
Process_Error : Integer);
overriding procedure Exception_Occurred
(Self : in out Listener;
Occurrence : Ada.Exceptions.Exception_Occurrence);
Codec : constant League.Text_Codecs.Text_Codec :=
League.Text_Codecs.Codec_For_Application_Locale;
--------------------
-- Error_Occurred --
--------------------
procedure Error_Occurred
(Self : in out Listener;
Process_Error : Integer)
is
pragma Unreferenced (Self);
Result : League.Strings.Universal_String;
begin
Result.Append (+"Unexpected error:");
Result.Append (+Integer'Wide_Wide_Image (Process_Error));
Write (Result);
end Error_Occurred;
------------------------
-- Exception_Occurred --
------------------------
procedure Exception_Occurred
(Self : in out Listener;
Occurrence : Ada.Exceptions.Exception_Occurrence)
is
Result : League.Strings.Universal_String;
begin
Result.Append ("Exception: ");
Result.Append
(League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Name (Occurrence)));
Result.Append (Ada.Characters.Wide_Wide_Latin_1.LF);
Result.Append
(League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Message (Occurrence)));
Self.Done := True;
Write (Result);
end Exception_Occurred;
--------------
-- Finished --
--------------
procedure Finished
(Self : in out Listener;
Exit_Status : Spawn.Processes.Process_Exit_Status;
Exit_Code : Spawn.Processes.Process_Exit_Code)
is
use all type Spawn.Processes.Process_Exit_Status;
Result : League.Strings.Universal_String;
begin
if Exit_Status = Normal then
Self.Ok := True;
else
Result.Append (+"Exit code: ");
Result.Append (+Exit_Code'Wide_Wide_Image);
Write (Result);
end if;
Self.Done := True;
end Finished;
-------------------------------
-- Standard_Output_Available --
-------------------------------
procedure Standard_Output_Available (Self : in out Listener) is
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Count;
Data : Ada.Streams.Stream_Element_Array (1 .. 512);
Last : Ada.Streams.Stream_Element_Count;
Tail : Ada.Streams.Stream_Element_Count := 0;
begin
loop
Self.Process.Read_Standard_Output (Data, Last);
exit when Last < Data'First;
for J in reverse 1 .. Last loop
if Data (J) <= 16#7F# then
Self.Output.Append (Data (1 .. J));
Tail := J + 1;
exit;
elsif Data (J) >= 16#C0# then
Self.Output.Append (Data (1 .. J - 1));
Tail := J;
end if;
end loop;
end loop;
Write (Codec.Decode (Self.Output));
Self.Output.Clear;
Self.Output.Append (Data (Tail .. Last));
end Standard_Output_Available;
Feedback : aliased Listener;
Process : Spawn.Processes.Process renames Feedback.Process;
Params : Spawn.String_Vectors.UTF_8_String_Vector;
begin
Params.Append ("--non-interactive");
Params.Append ("--no-tty");
Params.Append ("--no-color");
for J in 1 .. Args.Length loop
Params.Append (Args (J).To_UTF_8_String);
end loop;
Process.Set_Arguments (Params);
Process.Set_Working_Directory (Dir.To_UTF_8_String);
Process.Set_Program (ALR.To_UTF_8_String);
Process.Set_Listener (Feedback'Unchecked_Access);
Process.Start;
while not Feedback.Done loop
Spawn.Processes.Monitor_Loop (Timeout => 50);
end loop;
Ok := Feedback.Ok;
end Execute;
----------------
-- Parse_Line --
----------------
procedure Parse_Line (Line : League.Strings.Universal_String) is
Index : Natural;
Match : constant League.Regexps.Regexp_Match :=
Pattern.Find_Match (Line);
begin
if not Match.Is_Matched then
return;
end if;
Index := Env.Names.Index (Match.Capture (1));
if Index > 0 then
Env.Values.Replace (Index, Match.Capture (2));
else
Env.Names.Append (Match.Capture (1));
Env.Values.Append (Match.Capture (2));
end if;
end Parse_Line;
-----------
-- Write --
-----------
procedure Write (Text : League.Strings.Universal_String) is
Data : League.JSON.Objects.JSON_Object;
begin
if not Silent then
Data.Insert (+"text/plain", League.JSON.Values.To_JSON_Value (Text));
IO_Pub.Execute_Result
(Data => Data,
Metadata => League.JSON.Objects.Empty_JSON_Object,
Transient => League.JSON.Objects.Empty_JSON_Object);
end if;
end Write;
Ok : Boolean := False;
begin
Execute (Ok);
if Ok then
-- Run `alr printenv` to update environment
ALR_Print_Env;
for J in 1 .. Env.Names.Length loop
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
Env.Names (J).To_Wide_Wide_String & "=" &
Env.Values (J).To_Wide_Wide_String);
end loop;
end if;
end Magics.ALR;
|
demo/test.asm
|
henesy/tis100
| 1 |
87918
|
<reponame>henesy/tis100
## Baka
@1
nop # potato
hcf #foo bar
@5
@0
# Foo
mov up down
@4
mov up down
@8
mov up down
# ## ☺
|
source/vampire-villages-load.ads
|
ytomino/vampire
| 1 |
18948
|
<reponame>ytomino/vampire<filename>source/vampire-villages-load.ads
-- The Village of Vampire by YT, このソースコードはNYSLです
procedure Vampire.Villages.Load (
Name : in String;
Village : in out Village_Type;
Info_Only : in Boolean := False);
|
libsrc/_DEVELOPMENT/stdlib/c/sccz80/ftoa_callee.asm
|
jpoikela/z88dk
| 640 |
241955
|
<reponame>jpoikela/z88dk
; size_t ftoa(float x, char *buf, uint16_t prec, uint16_t flag)
SECTION code_clib
SECTION code_stdlib
PUBLIC ftoa_callee
EXTERN dtoa_callee
defc ftoa_callee = dtoa_callee
|
programs/oeis/214/A214856.asm
|
neoneye/loda
| 22 |
245887
|
; A214856: Number of triangular numbers in interval ](n-1)^2, n^2] for n>0, a(0)=1.
; 1,1,1,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1
mov $4,$0
mov $5,2
lpb $5
sub $5,1
add $0,$5
sub $0,1
mov $2,$5
mov $3,$0
pow $3,2
seq $3,2024 ; n appears n times; a(n) = floor(sqrt(2n) + 1/2).
mul $2,$3
add $1,$2
mov $6,$3
lpe
min $4,1
mul $4,$6
sub $1,$4
mov $0,$1
|
oeis/019/A019782.asm
|
neoneye/loda-programs
| 11 |
245670
|
; A019782: Decimal expansion of sqrt(e)/9.
; Submitted by <NAME>(s2)
; 1,8,3,1,9,1,2,5,2,3,0,0,0,1,4,2,3,8,5,3,8,7,3,8,9,7,6,4,2,3,7,9,5,9,5,2,4,0,5,9,7,5,1,2,2,3,0,1,1,2,7,5,5,6,8,4,1,6,7,5,4,7,9,0,7,1,1,8,4,5,5,7,9,1,0,4,6,8,4,0,0,9,5,9,1,9,7,3,9,1,1,1,7,3,7,4,0,7,1,4
add $0,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $2,$3
add $1,$2
div $1,$0
mul $2,2
div $2,$0
sub $3,1
lpe
mov $4,10
pow $4,$0
mul $4,2
div $2,$4
mul $2,9
div $1,$2
mod $1,10
mov $0,$1
|
programs/oeis/234/A234306.asm
|
neoneye/loda
| 22 |
23207
|
<reponame>neoneye/loda
; A234306: a(n) = n + 1 - d(2n), where d(n) is the number of divisors of n.
; 0,0,0,1,2,1,4,4,4,5,8,5,10,9,8,11,14,10,16,13,14,17,20,15,20,21,20,21,26,19,28,26,26,29,28,25,34,33,32,31,38,31,40,37,34,41,44,37,44,42,44,45,50,43,48,47,50,53,56,45,58,57,52,57,58,55,64,61,62,59,68,58,70,69,64,69,70,67,76,69,72,77,80,69,78,81,80,79,86,73,84,85,86,89,88,83,94,90,88,89
mov $2,$0
seq $2,69930 ; Number of integers of the form (n+k)/(n-k) with 1<=k<=n-1.
sub $0,$2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.